Changeset 153145 in webkit
- Timestamp:
- Jul 24, 2013 8:59:41 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 88 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r153121 r153145 1 2013-05-05 Geoffrey Garen <ggaren@apple.com> 2 3 Rolled back in r149527 with crash fixed. 4 5 Reviewed by Oliver Hunt. 6 7 Rationalized 'this' value conversion 8 https://bugs.webkit.org/show_bug.cgi?id=115542 9 1 10 2013-04-03 Filip Pizlo <fpizlo@apple.com> 2 11 -
trunk/LayoutTests/fast/js/Object-defineProperty-expected.txt
r110521 r153145 100 100 PASS 'use strict'; var o = Object.defineProperty({}, 'foo', {set:function(x){this.result = x;}}); o.foo = 42; o.result; is 42 101 101 PASS 'use strict'; var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}, set:undefined}); o.foo is 42 102 PASS 'use strict'; var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}, set:undefined}); o.foo = 42; o.result; threw exception TypeError: setting a property that has only a getter.102 PASS 'use strict'; var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}, set:undefined}); o.foo = 42; o.result; threw exception TypeError: Attempted to assign to readonly property.. 103 103 PASS 'use strict'; var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}}); o.foo is 42 104 PASS 'use strict'; var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}}); o.foo = 42; o.result; threw exception TypeError: setting a property that has only a getter.104 PASS 'use strict'; var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}}); o.foo = 42; o.result; threw exception TypeError: Attempted to assign to readonly property.. 105 105 PASS 'use strict'; var o = Object.defineProperty({}, 'foo', {get:undefined, set:undefined}); o.foo is undefined 106 PASS 'use strict'; var o = Object.defineProperty({}, 'foo', {get:undefined, set:undefined}); o.foo = 42; o.result; threw exception TypeError: setting a property that has only a getter.106 PASS 'use strict'; var o = Object.defineProperty({}, 'foo', {get:undefined, set:undefined}); o.foo = 42; o.result; threw exception TypeError: Attempted to assign to readonly property.. 107 107 PASS 'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {get:function(){return 13;}}); o.foo is 13 108 108 PASS 'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {get:function(){return 13;}}); o.foo = 42; o.result; is 42 … … 112 112 PASS 'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {set:function(){this.result = 13;}}); o.foo = 42; o.result; is 13 113 113 PASS 'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {set:undefined}); o.foo is 42 114 PASS 'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {set:undefined}); o.foo = 42; o.result; threw exception TypeError: setting a property that has only a getter.114 PASS 'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {set:undefined}); o.foo = 42; o.result; threw exception TypeError: Attempted to assign to readonly property.. 115 115 PASS 0 in Object.prototype is true 116 116 PASS '0' in Object.prototype is true -
trunk/LayoutTests/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.1_The_this_Keyword/S11.1.1_A2-expected.txt
r108729 r153145 1 1 S11.1.1_A2 2 2 3 FAIL SputnikError: #1: this.toString() === toString(). Actual: [object Window] 3 PASS 4 4 5 5 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.10_String.prototype.match/S15.5.4.10_A1_T3-expected.txt
r91344 r153145 1 1 S15.5.4.10_A1_T3 2 2 3 FAIL TypeError: Type error 3 PASS 4 4 5 5 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.11_String.prototype.replace/S15.5.4.11_A1_T3-expected.txt
r91344 r153145 1 1 S15.5.4.11_A1_T3 2 2 3 FAIL TypeError: Type error 3 PASS 4 4 5 5 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.12_String.prototype.search/S15.5.4.12_A1_T3-expected.txt
r91344 r153145 1 1 S15.5.4.12_A1_T3 2 2 3 FAIL TypeError: Type error 3 PASS 4 4 5 5 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.13_String.prototype.slice/S15.5.4.13_A1_T3-expected.txt
r91344 r153145 1 1 S15.5.4.13_A1_T3 2 2 3 FAIL TypeError: Type error 3 PASS 4 4 5 5 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.14_String.prototype.split/S15.5.4.14_A1_T3-expected.txt
r91344 r153145 1 1 S15.5.4.14_A1_T3 2 2 3 FAIL TypeError: Type error 3 PASS 4 4 5 5 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.15_String.prototype.substring/S15.5.4.15_A1_T3-expected.txt
r91344 r153145 1 1 S15.5.4.15_A1_T3 2 2 3 FAIL TypeError: Type error 3 PASS 4 4 5 5 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.6_String.prototype.concat/S15.5.4.6_A1_T3-expected.txt
r91344 r153145 1 1 S15.5.4.6_A1_T3 2 2 3 FAIL TypeError: Type error 3 PASS 4 4 5 5 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.7_String.prototype.indexOf/S15.5.4.7_A1_T3-expected.txt
r91344 r153145 1 1 S15.5.4.7_A1_T3 2 2 3 FAIL TypeError: Type error 3 PASS 4 4 5 5 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.8_String.prototype.lastIndexOf/S15.5.4.8_A1_T3-expected.txt
r91344 r153145 1 1 S15.5.4.8_A1_T3 2 2 3 FAIL TypeError: Type error 3 PASS 4 4 5 5 TEST COMPLETE -
trunk/Source/JavaScriptCore/API/JSCallbackFunction.cpp
r148696 r153145 68 68 JSContextRef execRef = toRef(exec); 69 69 JSObjectRef functionRef = toRef(exec->callee()); 70 JSObjectRef thisObjRef = toRef( exec->hostThisValue().toThisObject(exec));70 JSObjectRef thisObjRef = toRef(jsCast<JSObject*>(exec->hostThisValue().toThis(exec, NotStrictMode))); 71 71 72 72 size_t argumentCount = exec->argumentCount(); -
trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
r150990 r153145 491 491 JSContextRef execRef = toRef(exec); 492 492 JSObjectRef functionRef = toRef(exec->callee()); 493 JSObjectRef thisObjRef = toRef( exec->hostThisValue().toThisObject(exec));493 JSObjectRef thisObjRef = toRef(jsCast<JSObject*>(exec->hostThisValue().toThis(exec, NotStrictMode))); 494 494 495 495 for (JSClassRef jsClass = jsCast<JSCallbackObject<Parent>*>(toJS(functionRef))->classRef(); jsClass; jsClass = jsClass->parentClass) { -
trunk/Source/JavaScriptCore/API/JSContextRef.cpp
r152494 r153145 136 136 if (!globalObjectClass) { 137 137 JSGlobalObject* globalObject = JSGlobalObject::create(*vm, JSGlobalObject::createStructure(*vm, jsNull())); 138 globalObject->setGlobalThis(*vm, JSProxy::create(*vm, JSProxy::createStructure(*vm, globalObject, globalObject->prototype()), globalObject)); 138 139 return JSGlobalContextRetain(toGlobalRef(globalObject->globalExec())); 139 140 } … … 187 188 APIEntryShim entryShim(exec); 188 189 189 // It is necessary to call toThisObject to get the wrapper object when used with WebCore. 190 return toRef(exec->lexicalGlobalObject()->methodTable()->toThisObject(exec->lexicalGlobalObject(), exec)); 190 return toRef(jsCast<JSObject*>(exec->lexicalGlobalObject()->methodTable()->toThis(exec->lexicalGlobalObject(), exec, NotStrictMode))); 191 191 } 192 192 -
trunk/Source/JavaScriptCore/API/JSObjectRef.cpp
r150381 r153145 278 278 JSValue jsValue = toJS(exec, value); 279 279 280 jsObject->setPrototypeWithCycleCheck(exec ->vm(), jsValue.isObject() ? jsValue : jsNull());280 jsObject->setPrototypeWithCycleCheck(exec, jsValue.isObject() ? jsValue : jsNull()); 281 281 } 282 282 … … 529 529 jsThisObject = exec->globalThisValue(); 530 530 531 jsThisObject = jsThisObject->methodTable()->toThisObject(jsThisObject, exec);532 533 531 MarkedArgumentBuffer argList; 534 532 for (size_t i = 0; i < argumentCount; i++) -
trunk/Source/JavaScriptCore/ChangeLog
r153144 r153145 1 2013-05-06 Mark Lam <mark.lam@apple.com> 2 3 Fix broken 32-bit build + some clean up in JITStubs.cpp. 4 https://bugs.webkit.org/show_bug.cgi?id=115684. 5 6 Reviewed by Geoffrey Garen. 7 8 * dfg/DFGSpeculativeJIT32_64.cpp: 9 (JSC::DFG::SpeculativeJIT::compile): 10 * jit/JITStubs.cpp: 11 - removed unneeded stubs for CPU(X86_64) && USE(JSVALUE32_64). 12 - added some line breaks to more clearly delineate between 13 ports/configurations of stub code. 14 15 2013-05-05 Geoffrey Garen <ggaren@apple.com> 16 17 Rolled back in r149527 with crash fixed. 18 19 Reviewed by Oliver Hunt. 20 21 Rationalized 'this' value conversion 22 https://bugs.webkit.org/show_bug.cgi?id=115542 23 24 This fixes a bunch of Sputnik tests, and some bad pointer access. 25 26 The new model is that the callee always performs 'this' value conversion. 27 28 My ultimate goal is to break up resolve_with_this into single-result 29 opcodes. This step avoids having to add a special form of convert_this 30 that distinguishes callers vs callees. 31 32 Only the callee knows whether it uses 'this' and/or whether 'this' 33 conversion should use StrictMode, so it's most natural to perform 34 convert_this in the callee. 35 36 * API/JSCallbackFunction.cpp: 37 (JSC::JSCallbackFunction::call): Perform 'this' value conversion for 38 our callee, since it may observe 'this'. 39 40 * API/JSCallbackObjectFunctions.h: 41 (JSC::::call): Ditto. 42 43 * API/JSContextRef.cpp: 44 (JSGlobalContextCreateInGroup): Use a proxy 'this' object in global scope 45 even when we're not in the browser. This eliminates some odd cases where 46 API clients used to be able to get a direct reference to an environment 47 record. Now, any reference to an environment record unambiguously means 48 that the VM resolved that record in the scope chain. 49 50 (JSContextGetGlobalObject): Removed an incorrect comment. Now that JSC 51 participates in the proxy 'this' object scheme, the behavior is not 52 WebCore-only. 53 54 * API/JSObjectRef.cpp: 55 (JSObjectSetPrototype): 56 (JSObjectCallAsFunction): Don't perform 'this' value conversion in the 57 caller; the callee will do it if needed. 58 59 * JavaScriptCore.order: Order! 60 61 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreExports.def: 62 * JavaScriptCore.vcxproj/JavaScriptCoreExportGenerator/JavaScriptCoreExports.def.in: 63 What are the chances that this will work? 64 65 * bytecode/CodeBlock.cpp: 66 (JSC::CodeBlock::dumpBytecode): 67 (JSC::CodeBlock::CodeBlock): Renamed convert_this to to_this, to match our 68 other conversion opcodes. 69 70 * bytecode/CodeOrigin.h: 71 (CodeOrigin): 72 (InlineCallFrame): 73 (JSC::CodeOrigin::codeOriginOwner): Use the more precise type for our 74 executable, so compilation can discover where we're in strict mode. 75 76 * bytecode/Opcode.h: 77 (JSC::padOpcodeName): Updated for rename. 78 79 * bytecompiler/BytecodeGenerator.cpp: 80 (JSC::BytecodeGenerator::BytecodeGenerator): Always emit to_this when 81 'this' is in use -- strict mode still needs to convert environment 82 records to 'undefined'. 83 84 * dfg/DFGAbstractState.cpp: 85 (JSC::DFG::AbstractState::executeEffects): 86 * dfg/DFGByteCodeParser.cpp: 87 (JSC::DFG::ByteCodeParser::parseBlock): 88 * dfg/DFGCapabilities.h: 89 (JSC::DFG::canCompileOpcode): Updated for renames. 90 91 * dfg/DFGFixupPhase.cpp: 92 (JSC::DFG::FixupPhase::fixupNode): Tightened up this code to consider 93 strict mode (a new requirement) and to consider the global object (which 94 was always a requirement). 95 96 * dfg/DFGGraph.h: 97 (JSC::DFG::Graph::globalThisObjectFor): 98 (JSC::DFG::Graph::executableFor): 99 * dfg/DFGNodeType.h: 100 * dfg/DFGOperations.cpp: 101 * dfg/DFGOperations.h: 102 * dfg/DFGPredictionPropagationPhase.cpp: 103 (JSC::DFG::PredictionPropagationPhase::propagate): 104 * dfg/DFGSpeculativeJIT32_64.cpp: 105 (JSC::DFG::SpeculativeJIT::compile): 106 * dfg/DFGSpeculativeJIT64.cpp: 107 (JSC::DFG::SpeculativeJIT::compile): Ditto. 108 109 * interpreter/Interpreter.cpp: 110 (JSC::eval): 111 (JSC::Interpreter::execute): 112 (JSC::Interpreter::executeCall): 113 * interpreter/Interpreter.h: Don't ASSERT about 'this' -- it's our job 114 to fix it up if needed. 115 116 * jit/JIT.cpp: 117 (JSC::JIT::privateCompileMainPass): 118 (JSC::JIT::privateCompileSlowCases): 119 * jit/JIT.h: 120 (JIT): 121 * jit/JITOpcodes.cpp: 122 (JSC::JIT::emit_op_to_this): 123 (JSC::JIT::emitSlow_op_to_this): 124 * jit/JITOpcodes32_64.cpp: 125 (JSC::JIT::emit_op_to_this): 126 (JSC::JIT::emitSlow_op_to_this): 127 * jit/JITStubs.cpp: 128 (JSC::DEFINE_STUB_FUNCTION): 129 * jit/JITStubs.h: Removed special-case code for various kinds of 130 conversions. The baseline fast path is now final objects only. It hurt 131 my brain to think through how to keep the other fast paths working, and 132 our benchmarks do not object. 133 134 * llint/LLIntData.cpp: 135 (JSC::LLInt::Data::performAssertions): 136 * llint/LLIntSlowPaths.cpp: 137 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 138 * llint/LLIntSlowPaths.h: 139 (LLInt): 140 * llint/LowLevelInterpreter.asm: 141 * llint/LowLevelInterpreter32_64.asm: 142 * llint/LowLevelInterpreter64.asm: Updated for renames. Removed some 143 special case code, as in the JIT above. 144 145 * profiler/ProfileGenerator.cpp: 146 (JSC::ProfileGenerator::addParentForConsoleStart): 147 * runtime/CallData.cpp: 148 (JSC::call): 149 * runtime/ClassInfo.h: 150 (MethodTable): 151 * runtime/Completion.cpp: 152 (JSC::evaluate): 153 * runtime/DatePrototype.cpp: 154 (JSC::dateProtoFuncToJSON): The callee performs 'this' conversion, not 155 the caller. 156 157 * runtime/GetterSetter.cpp: 158 (JSC::callGetter): 159 (JSC::callSetter): 160 * runtime/GetterSetter.h: Added helper functions for invoking getters 161 and setters from C++ code, since this was duplicated in a bunch of 162 places. 163 164 * runtime/JSActivation.cpp: 165 (JSC::JSActivation::toThis): 166 * runtime/JSActivation.h: 167 (JSActivation): 168 * runtime/JSCJSValue.cpp: 169 (JSC::JSValue::toThisSlowCase): 170 (JSC::JSValue::putToPrimitive): 171 * runtime/JSCJSValue.h: 172 (JSValue): 173 * runtime/JSCJSValueInlines.h: 174 (JSC::JSValue::toThis): 175 * runtime/JSCell.cpp: 176 (JSC::JSCell::toThis): 177 * runtime/JSCell.h: 178 (JSCell): 179 * runtime/JSGlobalObject.cpp: 180 (JSC::JSGlobalObject::toThis): 181 * runtime/JSGlobalObject.h: 182 (JSGlobalObject): Filled out runtime support for converting 'this' 183 values as needed, according to the appropriate strictness, using 184 helper functions where getter/setter code was duplicated. 185 186 * runtime/JSGlobalObjectFunctions.cpp: 187 (JSC::globalFuncProtoGetter): 188 (JSC::globalFuncProtoSetter): Perform 'this' value conversion, since we 189 observe 'this'. 190 191 * runtime/JSNameScope.cpp: 192 (JSC::JSNameScope::toThis): 193 * runtime/JSNameScope.h: 194 (JSNameScope): Same as JSActivation. 195 196 * runtime/JSObject.cpp: 197 (JSC::JSObject::put): 198 (JSC::JSObject::setPrototypeWithCycleCheck): Bug fix. Don't peform 199 'this' value conversion in this helper function. The __proto__ 200 setter does this for us, since it's the function that logically observes 201 'this' -- and we can ASSERT so. Also, the previous code used 202 "globalExec()->thisValue()", which is a read past the beginning of a 203 buffer! I don't think this ever worked on purpose. 204 205 (JSC::JSObject::toThis): 206 (JSC::JSObject::fillGetterPropertySlot): 207 * runtime/JSObject.h: 208 (JSC::JSObject::inlineGetOwnPropertySlot): 209 * runtime/JSScope.cpp: 210 (JSC::JSScope::resolveWithThis): 211 * runtime/JSString.cpp: 212 (JSC::JSString::toThis): 213 * runtime/JSString.h: 214 (JSString): 215 * runtime/PropertySlot.cpp: 216 (JSC::PropertySlot::functionGetter): 217 * runtime/PropertySlot.h: 218 (JSC): 219 (JSC::PropertySlot::setGetterSlot): 220 (JSC::PropertySlot::setCacheableGetterSlot): 221 * runtime/SparseArrayValueMap.cpp: 222 (JSC::SparseArrayEntry::get): 223 (JSC::SparseArrayEntry::put): 224 * runtime/StrictEvalActivation.cpp: 225 (JSC::StrictEvalActivation::toThis): 226 * runtime/StrictEvalActivation.h: 227 (StrictEvalActivation): Ditto. 228 1 229 2013-05-03 Filip Pizlo <fpizlo@apple.com> 2 230 -
trunk/Source/JavaScriptCore/JavaScriptCore.order
r150833 r153145 338 338 __ZNK3JSC8JSObject8toObjectEPNS_9ExecStateEPNS_14JSGlobalObjectE 339 339 _JSContextGetGlobalObject 340 __ZNK3JSC8JSObject12toThisObjectEPNS_9ExecStateE341 340 _JSStringCreateWithUTF8CString 342 341 _JSObjectGetProperty … … 813 812 _JSValueMakeString 814 813 __ZN3JSC8ThisNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE 815 __ZN3JSC3JIT20emit_op_convert_thisEPNS_11InstructionE816 814 __ZN3JSC23MacroAssemblerX86Common11branchTest8ENS0_15ResultConditionENS_22AbstractMacroAssemblerINS_12X86AssemblerEE7AddressENS4_12TrustedImm32E 817 __ZN3JSC3JIT24emitSlow_op_convert_thisEPNS_11InstructionERPNS_13SlowCaseEntryE818 815 __ZN3JSC8JSObject13visitChildrenERNS_9MarkStackE 819 816 __ZN3JSC14JSGlobalObject13visitChildrenERNS_9MarkStackE … … 990 987 __ZN3WTF7HashMapINS_6RefPtrINS_10StringImplEEEN3JSC12WriteBarrierINS4_14EvalExecutableEEENS_10StringHashENS_10HashTraitsIS3_EENS9_IS7_EEE3setEPS2_RKS7_ 991 988 __ZN3WTF9HashTableINS_6RefPtrINS_10StringImplEEESt4pairIS3_N3JSC12WriteBarrierINS5_14EvalExecutableEEEENS_18PairFirstExtractorIS9_EENS_10StringHashENS_14PairHashTraitsINS_10HashTraitsIS3_EENSE_IS8_EEEESF_E6expandEv 992 __ZNK3JSC7JSValue20toThisObjectSlowCaseEPNS_9ExecStateE993 989 __ZN3JSC11Interpreter7executeEPNS_14EvalExecutableEPNS_9ExecStateEPNS_8JSObjectEiPNS_14ScopeChainNodeE 994 990 _cti_op_resolve … … 1437 1433 __ZNK3JSC8NullNode6isNullEv 1438 1434 __ZN3JSC3JIT17emit_op_jneq_nullEPNS_11InstructionE 1439 _cti_op_convert_this1440 1435 _cti_vm_lazyLinkConstruct 1441 1436 __ZN3JSC18FunctionExecutable27compileForConstructInternalEPNS_9ExecStateEPNS_14ScopeChainNodeE … … 1559 1554 __ZN3JSC3JIT27emit_op_get_argument_by_valEPNS_11InstructionE 1560 1555 __ZN3JSC3JIT31emitSlow_op_get_argument_by_valEPNS_11InstructionERPNS_13SlowCaseEntryE 1561 __ZNK3JSC8JSString12toThisObjectEPNS_9ExecStateE1562 1556 __ZN3JSCL20arrayProtoFuncSpliceEPNS_9ExecStateE 1563 1557 __ZN3JSC7JSArray9setLengthEj … … 2023 2017 __ZN3JSCL26stringFromCharCodeSlowCaseEPNS_9ExecStateE 2024 2018 __ZN3JSCL25stringProtoFuncCharCodeAtEPNS_9ExecStateE 2025 __ZNK3JSC12JSActivation12toThisObjectEPNS_9ExecStateE2026 2019 __ZN3JSC12StringObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE 2027 2020 __ZN3JSC9ExecState11stringTableEPS0_ … … 2270 2263 __ZN3JSCL20arrayProtoFuncReduceEPNS_9ExecStateE 2271 2264 __ZN3JSCL25arrayProtoFuncReduceRightEPNS_9ExecStateE 2272 __ZN3JSC3JIT27emit_op_convert_this_strictEPNS_11InstructionE2273 __ZN3JSC3JIT31emitSlow_op_convert_this_strictEPNS_11InstructionERPNS_13SlowCaseEntryE2274 2265 __ZN3JSC9Arguments33createStrictModeCalleeIfNecessaryEPNS_9ExecStateE 2275 2266 __ZN3JSC23createTypeErrorFunctionEPNS_9ExecStateERKNS_7UStringE … … 2340 2331 __ZN3JSCL29objectConstructorIsExtensibleEPNS_9ExecStateE 2341 2332 __ZN3JSC4Yarr25CharacterClassConstructor9addSortedERN3WTF6VectorItLm0EEEt 2342 __ZNK3JSC19JSStaticScopeObject12toThisObjectEPNS_9ExecStateE2343 2333 __ZN3JSCL23stringProtoFuncTrimLeftEPNS_9ExecStateE 2344 2334 __ZN3JSCL24stringProtoFuncTrimRightEPNS_9ExecStateE -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r153142 r153145 717 717 break; 718 718 } 719 case op_ convert_this: {720 int r0 = (++it)->u.operand; 721 out.printf("[%4d] convert_this\t %s", location, registerName(r0).data());719 case op_to_this: { 720 int r0 = (++it)->u.operand; 721 out.printf("[%4d] to_this\t %s", location, registerName(r0).data()); 722 722 ++it; // Skip value profile. 723 723 break; … … 1775 1775 // fallthrough 1776 1776 } 1777 case op_ convert_this:1777 case op_to_this: 1778 1778 case op_get_by_id: 1779 1779 case op_call_put_result: -
trunk/Source/JavaScriptCore/bytecode/CodeOrigin.h
r153142 r153145 40 40 struct InlineCallFrame; 41 41 class ExecState; 42 class ExecutableBase;42 class ScriptExecutable; 43 43 class JSFunction; 44 44 … … 83 83 // If the code origin corresponds to inlined code, gives you the heap object that 84 84 // would have owned the code if it had not been inlined. Otherwise returns 0. 85 ExecutableBase* codeOriginOwner() const;85 ScriptExecutable* codeOriginOwner() const; 86 86 87 87 unsigned stackOffset() const; … … 101 101 struct InlineCallFrame { 102 102 Vector<ValueRecovery> arguments; 103 WriteBarrier< ExecutableBase> executable;103 WriteBarrier<ScriptExecutable> executable; 104 104 WriteBarrier<JSFunction> callee; // This may be null, indicating that this is a closure call and that the JSFunction and JSScope are already on the stack. 105 105 CodeOrigin caller; … … 150 150 } 151 151 152 inline ExecutableBase* CodeOrigin::codeOriginOwner() const152 inline ScriptExecutable* CodeOrigin::codeOriginOwner() const 153 153 { 154 154 if (!inlineCallFrame) -
trunk/Source/JavaScriptCore/bytecode/Opcode.h
r149418 r153145 47 47 macro(op_create_this, 4) \ 48 48 macro(op_get_callee, 3) \ 49 macro(op_ convert_this, 3) \49 macro(op_to_this, 3) \ 50 50 \ 51 51 macro(op_new_object, 4) \ -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r153132 r153145 396 396 if (isConstructor()) { 397 397 emitCreateThis(&m_thisRegister); 398 } else if ( !codeBlock->isStrictMode() && (functionBody->usesThis() || codeBlock->usesEval() || m_shouldEmitDebugHooks)) {399 UnlinkedValueProfile profile = emitProfiledOpcode(op_ convert_this);398 } else if (functionBody->usesThis() || codeBlock->usesEval() || m_shouldEmitDebugHooks) { 399 UnlinkedValueProfile profile = emitProfiledOpcode(op_to_this); 400 400 instructions().append(kill(&m_thisRegister)); 401 401 instructions().append(profile); -
trunk/Source/JavaScriptCore/dfg/DFGAbstractState.cpp
r153142 r153145 1140 1140 break; 1141 1141 1142 case ConvertThis: {1142 case ToThis: { 1143 1143 AbstractValue& source = forNode(node->child1()); 1144 1144 AbstractValue& destination = forNode(node); -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r153144 r153145 2026 2026 NEXT_OPCODE(op_enter); 2027 2027 2028 case op_ convert_this: {2028 case op_to_this: { 2029 2029 Node* op1 = getThis(); 2030 if (op1->op() != ConvertThis) {2030 if (op1->op() != ToThis) { 2031 2031 CodeBlockLocker locker(m_inlineStackTop->m_profiledBlock->m_lock); 2032 2032 ValueProfile* profile = … … 2042 2042 || !profile->m_singletonValue.isCell() 2043 2043 || profile->m_singletonValue.asCell()->classInfo() != &Structure::s_info) 2044 setThis(addToGraph( ConvertThis, op1));2044 setThis(addToGraph(ToThis, op1)); 2045 2045 else { 2046 2046 addToGraph( … … 2050 2050 } 2051 2051 } 2052 NEXT_OPCODE(op_ convert_this);2052 NEXT_OPCODE(op_to_this); 2053 2053 } 2054 2054 -
trunk/Source/JavaScriptCore/dfg/DFGCapabilities.h
r149247 r153145 87 87 switch (opcodeID) { 88 88 case op_enter: 89 case op_ convert_this:89 case op_to_this: 90 90 case op_create_this: 91 91 case op_get_callee: -
trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
r153142 r153145 636 636 } 637 637 638 case ConvertThis: { 638 case ToThis: { 639 ECMAMode ecmaMode = m_graph.executableFor(node->codeOrigin)->isStrictMode() ? StrictMode : NotStrictMode; 640 639 641 if (isOtherSpeculation(node->child1()->prediction())) { 642 if (ecmaMode == StrictMode) { 643 setUseKindAndUnboxIfProfitable<OtherUse>(node->child1()); 644 node->convertToIdentity(); 645 break; 646 } 647 640 648 m_insertionSet.insertNode( 641 649 m_indexInBlock, SpecNone, Phantom, node->codeOrigin, … … 646 654 } 647 655 648 if (is ObjectSpeculation(node->child1()->prediction())) {656 if (isFinalObjectSpeculation(node->child1()->prediction())) { 649 657 setUseKindAndUnboxIfProfitable<ObjectUse>(node->child1()); 650 658 node->convertToIdentity(); -
trunk/Source/JavaScriptCore/dfg/DFGGraph.h
r153142 r153145 358 358 { 359 359 JSGlobalObject* object = globalObjectFor(codeOrigin); 360 return object->methodTable()->toThisObject(object, 0);361 } 362 363 ExecutableBase* executableFor(InlineCallFrame* inlineCallFrame)360 return jsCast<JSObject*>(object->methodTable()->toThis(object, object->globalExec(), NotStrictMode)); 361 } 362 363 ScriptExecutable* executableFor(InlineCallFrame* inlineCallFrame) 364 364 { 365 365 if (!inlineCallFrame) … … 369 369 } 370 370 371 ExecutableBase* executableFor(const CodeOrigin& codeOrigin)371 ScriptExecutable* executableFor(const CodeOrigin& codeOrigin) 372 372 { 373 373 return executableFor(codeOrigin.inlineCallFrame); -
trunk/Source/JavaScriptCore/dfg/DFGNodeType.h
r153121 r153145 50 50 \ 51 51 /* Nodes for handling functions (both as call and as construct). */\ 52 macro( ConvertThis, NodeResultJS) \52 macro(ToThis, NodeResultJS) \ 53 53 macro(CreateThis, NodeResultJS) /* Note this is not MustGenerate since we're returning it anyway. */ \ 54 54 macro(GetCallee, NodeResultJS) \ -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r153142 r153145 342 342 extern "C" { 343 343 344 EncodedJSValue DFG_OPERATION operation ConvertThis(ExecState* exec, EncodedJSValue encodedOp)345 { 346 VM* vm = &exec->vm(); 347 NativeCallFrameTracer tracer(vm, exec); 348 349 return JSValue::encode(JSValue::decode(encodedOp).toThis Object(exec));344 EncodedJSValue DFG_OPERATION operationToThis(ExecState* exec, EncodedJSValue encodedOp) 345 { 346 VM* vm = &exec->vm(); 347 NativeCallFrameTracer tracer(vm, exec); 348 349 return JSValue::encode(JSValue::decode(encodedOp).toThis(exec, exec->codeBlock()->isStrictMode() ? StrictMode : NotStrictMode)); 350 350 } 351 351 … … 571 571 } 572 572 573 EncodedJSValue DFG_OPERATION operationCallGetter(ExecState* exec, JSCell* base, JSCell* value) 574 { 575 VM* vm = &exec->vm(); 576 NativeCallFrameTracer tracer(vm, exec); 577 578 GetterSetter* getterSetter = asGetterSetter(value); 579 JSObject* getter = getterSetter->getter(); 580 if (!getter) 581 return JSValue::encode(jsUndefined()); 582 CallData callData; 583 CallType callType = getter->methodTable()->getCallData(getter, callData); 584 return JSValue::encode(call(exec, getter, callType, callData, asObject(base), ArgList())); 573 EncodedJSValue DFG_OPERATION operationCallGetter(ExecState* exec, JSCell* base, JSCell* getterSetter) 574 { 575 VM* vm = &exec->vm(); 576 NativeCallFrameTracer tracer(vm, exec); 577 578 return JSValue::encode(callGetter(exec, base, getterSetter)); 585 579 } 586 580 -
trunk/Source/JavaScriptCore/dfg/DFGOperations.h
r153142 r153145 133 133 JSCell* DFG_OPERATION operationNewObject(ExecState*, Structure*) WTF_INTERNAL; 134 134 JSCell* DFG_OPERATION operationCreateThis(ExecState*, JSObject* constructor, int32_t inlineCapacity) WTF_INTERNAL; 135 EncodedJSValue DFG_OPERATION operation ConvertThis(ExecState*, EncodedJSValue encodedOp1) WTF_INTERNAL;135 EncodedJSValue DFG_OPERATION operationToThis(ExecState*, EncodedJSValue encodedOp1) WTF_INTERNAL; 136 136 EncodedJSValue DFG_OPERATION operationValueAdd(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL; 137 137 EncodedJSValue DFG_OPERATION operationValueAddNotNumber(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL; -
trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
r152813 r153145 382 382 } 383 383 384 case ConvertThis: {384 case ToThis: { 385 385 SpeculatedType prediction = node->child1()->prediction(); 386 386 if (prediction) { -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r153142 r153145 3695 3695 } 3696 3696 3697 case ConvertThis: {3697 case ToThis: { 3698 3698 ASSERT(node->child1().useKind() == UntypedUse); 3699 3699 … … 3706 3706 GPRResult2 resultTag(this); 3707 3707 GPRResult resultPayload(this); 3708 callOperation(operation ConvertThis, resultTag.gpr(), resultPayload.gpr(), thisValueTagGPR, thisValuePayloadGPR);3708 callOperation(operationToThis, resultTag.gpr(), resultPayload.gpr(), thisValueTagGPR, thisValuePayloadGPR); 3709 3709 3710 3710 cellResult(resultPayload.gpr(), node); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r153142 r153145 3608 3608 } 3609 3609 3610 case ConvertThis: {3610 case ToThis: { 3611 3611 ASSERT(node->child1().useKind() == UntypedUse); 3612 3612 JSValueOperand thisValue(this, node->child1()); … … 3616 3616 3617 3617 GPRResult result(this); 3618 callOperation(operation ConvertThis, result.gpr(), thisValueGPR);3618 callOperation(operationToThis, result.gpr(), thisValueGPR); 3619 3619 3620 3620 cellResult(result.gpr(), node); -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r153115 r153145 156 156 157 157 JSValue thisValue = callerFrame->thisValue(); 158 ASSERT(isValidThisObject(thisValue, callFrame));159 158 Interpreter* interpreter = callFrame->vm().interpreter; 160 159 return interpreter->execute(eval, callFrame, thisValue, callerScopeChain); … … 799 798 VM& vm = *scope->vm(); 800 799 801 ASSERT(isValidThisObject(thisObj, callFrame));802 800 ASSERT(!vm.exception); 803 801 ASSERT(!vm.isCollectorBusy()); … … 964 962 { 965 963 VM& vm = callFrame->vm(); 966 ASSERT(isValidThisObject(thisValue, callFrame));967 964 ASSERT(!callFrame->hadException()); 968 965 ASSERT(!vm.isCollectorBusy()); … … 1221 1218 1222 1219 ASSERT(scope->vm() == &callFrame->vm()); 1223 ASSERT(isValidThisObject(thisValue, callFrame));1224 1220 ASSERT(!vm.exception); 1225 1221 ASSERT(!vm.isCollectorBusy()); -
trunk/Source/JavaScriptCore/interpreter/Interpreter.h
r152494 r153145 265 265 }; 266 266 267 // This value must not be an object that would require this conversion (WebCore's global object).268 inline bool isValidThisObject(JSValue thisValue, ExecState* exec)269 {270 return !thisValue.isObject() || thisValue.toThisObject(exec) == thisValue;271 }272 273 267 JSValue eval(CallFrame*); 274 268 CallFrame* loadVarargs(CallFrame*, JSStack*, JSValue thisValue, JSValue arguments, int firstFreeRegister); -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r153143 r153145 229 229 DEFINE_OP(op_get_callee) 230 230 DEFINE_OP(op_create_this) 231 DEFINE_OP(op_ convert_this)231 DEFINE_OP(op_to_this) 232 232 DEFINE_OP(op_init_lazy_reg) 233 233 DEFINE_OP(op_create_arguments) … … 432 432 DEFINE_SLOWCASE_OP(op_call_varargs) 433 433 DEFINE_SLOWCASE_OP(op_construct) 434 DEFINE_SLOWCASE_OP(op_ convert_this)434 DEFINE_SLOWCASE_OP(op_to_this) 435 435 DEFINE_SLOWCASE_OP(op_create_this) 436 436 DEFINE_SLOWCASE_OP(op_div) -
trunk/Source/JavaScriptCore/jit/JIT.h
r153113 r153145 654 654 void emit_op_get_callee(Instruction*); 655 655 void emit_op_create_this(Instruction*); 656 void emit_op_ convert_this(Instruction*);656 void emit_op_to_this(Instruction*); 657 657 void emit_op_create_arguments(Instruction*); 658 658 void emit_op_debug(Instruction*); … … 757 757 void emitSlow_op_call_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&); 758 758 void emitSlow_op_construct(Instruction*, Vector<SlowCaseEntry>::iterator&); 759 void emitSlow_op_ convert_this(Instruction*, Vector<SlowCaseEntry>::iterator&);759 void emitSlow_op_to_this(Instruction*, Vector<SlowCaseEntry>::iterator&); 760 760 void emitSlow_op_create_this(Instruction*, Vector<SlowCaseEntry>::iterator&); 761 761 void emitSlow_op_div(Instruction*, Vector<SlowCaseEntry>::iterator&); -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r149418 r153145 888 888 } 889 889 890 void JIT::emit_op_ convert_this(Instruction* currentInstruction)890 void JIT::emit_op_to_this(Instruction* currentInstruction) 891 891 { 892 892 emitGetVirtualRegister(currentInstruction[1].u.operand, regT1); 893 893 894 894 emitJumpSlowCaseIfNotJSCell(regT1); 895 if (shouldEmitProfiling()) {896 loadPtr(Address(regT1, JSCell::structureOffset()), regT0);895 loadPtr(Address(regT1, JSCell::structureOffset()), regT0); 896 if (shouldEmitProfiling()) 897 897 emitValueProfilingSite(); 898 } 899 addSlowCase(branch Ptr(Equal, Address(regT1, JSCell::structureOffset()), TrustedImmPtr(m_vm->stringStructure.get())));898 899 addSlowCase(branch8(NotEqual, Address(regT0, Structure::typeInfoTypeOffset()), TrustedImm32(FinalObjectType))); 900 900 } 901 901 … … 953 953 // Slow cases 954 954 955 void JIT::emitSlow_op_convert_this(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 956 { 957 void* globalThis = m_codeBlock->globalObject()->globalThis(); 958 959 linkSlowCase(iter); 960 if (shouldEmitProfiling()) 961 move(TrustedImm64((JSValue::encode(jsUndefined()))), regT0); 962 Jump isNotUndefined = branch64(NotEqual, regT1, TrustedImm64(JSValue::encode(jsUndefined()))); 963 emitValueProfilingSite(); 964 move(TrustedImm64(JSValue::encode(JSValue(static_cast<JSCell*>(globalThis)))), regT0); 965 emitPutVirtualRegister(currentInstruction[1].u.operand, regT0); 966 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_convert_this)); 967 968 linkSlowCase(iter); 969 if (shouldEmitProfiling()) 970 move(TrustedImm64(JSValue::encode(m_vm->stringStructure.get())), regT0); 971 isNotUndefined.link(this); 972 emitValueProfilingSite(); 973 JITStubCall stubCall(this, cti_op_convert_this); 955 void JIT::emitSlow_op_to_this(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 956 { 957 linkSlowCase(iter); 958 linkSlowCase(iter); 959 JITStubCall stubCall(this, cti_op_to_this); 974 960 stubCall.addArgument(regT1); 975 961 stubCall.call(currentInstruction[1].u.operand); -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r150569 r153145 1181 1181 } 1182 1182 1183 void JIT::emit_op_ convert_this(Instruction* currentInstruction)1183 void JIT::emit_op_to_this(Instruction* currentInstruction) 1184 1184 { 1185 1185 unsigned thisRegister = currentInstruction[1].u.operand; … … 1188 1188 1189 1189 addSlowCase(branch32(NotEqual, regT3, TrustedImm32(JSValue::CellTag))); 1190 loadPtr(Address(regT2, JSCell::structureOffset()), regT0); 1190 1191 if (shouldEmitProfiling()) { 1191 loadPtr(Address(regT2, JSCell::structureOffset()), regT0);1192 1192 move(regT3, regT1); 1193 1193 emitValueProfilingSite(); 1194 1194 } 1195 addSlowCase(branchPtr(Equal, Address(regT2, JSCell::structureOffset()), TrustedImmPtr(m_vm->stringStructure.get()))); 1196 } 1197 1198 void JIT::emitSlow_op_convert_this(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 1199 { 1200 void* globalThis = m_codeBlock->globalObject()->globalThis(); 1195 addSlowCase(branch8(NotEqual, Address(regT0, Structure::typeInfoTypeOffset()), TrustedImm32(FinalObjectType))); 1196 } 1197 1198 void JIT::emitSlow_op_to_this(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 1199 { 1201 1200 unsigned thisRegister = currentInstruction[1].u.operand; 1202 1201 1203 1202 linkSlowCase(iter); 1204 if (shouldEmitProfiling()) { 1205 move(TrustedImm32(JSValue::UndefinedTag), regT1); 1206 move(TrustedImm32(0), regT0); 1207 } 1208 Jump isNotUndefined = branch32(NotEqual, regT3, TrustedImm32(JSValue::UndefinedTag)); 1209 emitValueProfilingSite(); 1210 move(TrustedImmPtr(globalThis), regT0); 1211 move(TrustedImm32(JSValue::CellTag), regT1); 1212 emitStore(thisRegister, regT1, regT0); 1213 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_convert_this)); 1214 1215 linkSlowCase(iter); 1216 if (shouldEmitProfiling()) { 1217 move(TrustedImm32(JSValue::CellTag), regT1); 1218 move(TrustedImmPtr(m_vm->stringStructure.get()), regT0); 1219 } 1220 isNotUndefined.link(this); 1221 emitValueProfilingSite(); 1222 JITStubCall stubCall(this, cti_op_convert_this); 1203 linkSlowCase(iter); 1204 JITStubCall stubCall(this, cti_op_to_this); 1223 1205 stubCall.addArgument(regT3, regT2); 1224 1206 stubCall.call(thisRegister); -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r153123 r153145 138 138 ); 139 139 140 #elif COMPILER(GCC) && CPU(X86_64)141 142 // These ASSERTs remind you that, if you change the layout of JITStackFrame, you143 // need to change the assembly trampolines below to match.144 COMPILE_ASSERT(offsetof(struct JITStackFrame, code) % 32 == 0x0, JITStackFrame_maintains_32byte_stack_alignment);145 COMPILE_ASSERT(offsetof(struct JITStackFrame, savedRBX) == 0x48, JITStackFrame_stub_argument_space_matches_ctiTrampoline);146 COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x90, JITStackFrame_callFrame_offset_matches_ctiTrampoline);147 COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x80, JITStackFrame_code_offset_matches_ctiTrampoline);148 149 asm (150 ".globl " SYMBOL_STRING(ctiTrampoline) "\n"151 HIDE_SYMBOL(ctiTrampoline) "\n"152 SYMBOL_STRING(ctiTrampoline) ":" "\n"153 "pushq %rbp" "\n"154 "movq %rsp, %rbp" "\n"155 "pushq %r12" "\n"156 "pushq %r13" "\n"157 "pushq %r14" "\n"158 "pushq %r15" "\n"159 "pushq %rbx" "\n"160 "subq $0x48, %rsp" "\n"161 "movq $512, %r12" "\n"162 "movq $0xFFFF000000000000, %r14" "\n"163 "movq $0xFFFF000000000002, %r15" "\n"164 "movq 0x90(%rsp), %r13" "\n"165 "call *0x80(%rsp)" "\n"166 "addq $0x48, %rsp" "\n"167 "popq %rbx" "\n"168 "popq %r15" "\n"169 "popq %r14" "\n"170 "popq %r13" "\n"171 "popq %r12" "\n"172 "popq %rbp" "\n"173 "ret" "\n"174 ".globl " SYMBOL_STRING(ctiTrampolineEnd) "\n"175 HIDE_SYMBOL(ctiTrampolineEnd) "\n"176 SYMBOL_STRING(ctiTrampolineEnd) ":" "\n"177 );178 179 asm (180 ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"181 HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"182 SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"183 "movq %rsp, %rdi" "\n"184 "call " LOCAL_REFERENCE(cti_vm_throw) "\n"185 "int3" "\n"186 );187 188 asm (189 ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"190 HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"191 SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"192 "addq $0x48, %rsp" "\n"193 "popq %rbx" "\n"194 "popq %r15" "\n"195 "popq %r14" "\n"196 "popq %r13" "\n"197 "popq %r12" "\n"198 "popq %rbp" "\n"199 "ret" "\n"200 );201 202 140 #elif (COMPILER(GCC) || COMPILER(RVCT)) && CPU(ARM_THUMB2) 203 141 … … 294 232 #define GLOBAL_DATA_OFFSET 108 295 233 #define STACK_LENGTH 112 234 296 235 #elif CPU(SH4) 236 297 237 #define SYMBOL_STRING(name) #name 298 238 /* code (r4), JSStack* (r5), CallFrame* (r6), void* unused1 (r7), void* unused2(sp), VM (sp)*/ … … 1457 1397 } 1458 1398 1459 DEFINE_STUB_FUNCTION(EncodedJSValue, op_ convert_this)1399 DEFINE_STUB_FUNCTION(EncodedJSValue, op_to_this) 1460 1400 { 1461 1401 STUB_INIT_STACK_FRAME(stackFrame); … … 1464 1404 CallFrame* callFrame = stackFrame.callFrame; 1465 1405 1466 ASSERT(v1.isPrimitive()); 1467 1468 JSObject* result = v1.toThisObject(callFrame); 1406 JSValue result = v1.toThis(callFrame, callFrame->codeBlock()->isStrictMode() ? StrictMode : NotStrictMode); 1469 1407 CHECK_FOR_EXCEPTION_AT_END(); 1470 1408 return JSValue::encode(result); … … 1782 1720 STUB_INIT_STACK_FRAME(stackFrame); 1783 1721 CallFrame* callFrame = stackFrame.callFrame; 1784 GetterSetter* getterSetter = asGetterSetter(stackFrame.args[0].jsObject()); 1785 if (!getterSetter->getter()) 1786 return JSValue::encode(jsUndefined()); 1787 JSObject* getter = asObject(getterSetter->getter()); 1788 CallData callData; 1789 CallType callType = getter->methodTable()->getCallData(getter, callData); 1790 JSValue result = call(callFrame, getter, callType, callData, stackFrame.args[1].jsObject(), ArgList()); 1722 JSValue result = callGetter(callFrame, stackFrame.args[1].jsObject(), stackFrame.args[0].jsObject()); 1791 1723 if (callFrame->hadException()) 1792 1724 returnToThrowTrampoline(&callFrame->vm(), stackFrame.args[2].returnAddress(), STUB_RETURN_ADDRESS); -
trunk/Source/JavaScriptCore/jit/JITStubs.h
r150146 r153145 330 330 EncodedJSValue JIT_STUB cti_op_check_has_instance(STUB_ARGS_DECLARATION) WTF_INTERNAL; 331 331 EncodedJSValue JIT_STUB cti_op_create_this(STUB_ARGS_DECLARATION) WTF_INTERNAL; 332 EncodedJSValue JIT_STUB cti_op_ convert_this(STUB_ARGS_DECLARATION) WTF_INTERNAL;332 EncodedJSValue JIT_STUB cti_op_to_this(STUB_ARGS_DECLARATION) WTF_INTERNAL; 333 333 EncodedJSValue JIT_STUB cti_op_create_arguments(STUB_ARGS_DECLARATION) WTF_INTERNAL; 334 334 EncodedJSValue JIT_STUB cti_op_del_by_id(STUB_ARGS_DECLARATION) WTF_INTERNAL; -
trunk/Source/JavaScriptCore/llint/LLIntData.cpp
r152206 r153145 105 105 ASSERT(StringType == 5); 106 106 ASSERT(ObjectType == 17); 107 ASSERT(FinalObjectType == 18); 107 108 ASSERT(MasqueradesAsUndefined == 1); 108 109 ASSERT(ImplementsHasInstance == 2); -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r153123 r153145 492 492 } 493 493 494 LLINT_SLOW_PATH_DECL(slow_path_ convert_this)494 LLINT_SLOW_PATH_DECL(slow_path_to_this) 495 495 { 496 496 LLINT_BEGIN(); 497 497 JSValue v1 = LLINT_OP(1).jsValue(); 498 ASSERT(v1.isPrimitive());499 498 #if ENABLE(VALUE_PROFILER) 500 pc[OPCODE_LENGTH(op_ convert_this) - 1].u.profile->m_buckets[0] =499 pc[OPCODE_LENGTH(op_to_this) - 1].u.profile->m_buckets[0] = 501 500 JSValue::encode(v1.structureOrUndefined()); 502 501 #endif 503 LLINT_RETURN(v1.toThis Object(exec));502 LLINT_RETURN(v1.toThis(exec, exec->codeBlock()->isStrictMode() ? StrictMode : NotStrictMode)); 504 503 } 505 504 -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.h
r149418 r153145 119 119 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_create_arguments); 120 120 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_create_this); 121 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_ convert_this);121 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_to_this); 122 122 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_object); 123 123 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_array); -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r152209 r153145 101 101 const StringType = 5 102 102 const ObjectType = 17 103 const FinalObjectType = 18 103 104 104 105 # Type flags constants. -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
r153104 r153145 397 397 398 398 399 _llint_op_ convert_this:400 traceExecution() 401 loadi 4[PC], t0 402 bineq TagOffset[cfr, t0, 8], CellTag, .op ConvertThisSlow399 _llint_op_to_this: 400 traceExecution() 401 loadi 4[PC], t0 402 bineq TagOffset[cfr, t0, 8], CellTag, .opToThisSlow 403 403 loadi PayloadOffset[cfr, t0, 8], t0 404 404 loadp JSCell::m_structure[t0], t0 405 bb b Structure::m_typeInfo + TypeInfo::m_type[t0], ObjectType, .opConvertThisSlow405 bbneq Structure::m_typeInfo + TypeInfo::m_type[t0], FinalObjectType, .opToThisSlow 406 406 loadi 8[PC], t1 407 407 valueProfile(CellTag, t0, t1) 408 408 dispatch(3) 409 409 410 .op ConvertThisSlow:411 callSlowPath(_llint_slow_path_ convert_this)410 .opToThisSlow: 411 callSlowPath(_llint_slow_path_to_this) 412 412 dispatch(3) 413 413 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
r153104 r153145 280 280 281 281 282 _llint_op_ convert_this:282 _llint_op_to_this: 283 283 traceExecution() 284 284 loadisFromInstruction(1, t0) 285 285 loadq [cfr, t0, 8], t0 286 btqnz t0, tagMask, .op ConvertThisSlow286 btqnz t0, tagMask, .opToThisSlow 287 287 loadp JSCell::m_structure[t0], t0 288 bb b Structure::m_typeInfo + TypeInfo::m_type[t0], ObjectType, .opConvertThisSlow288 bbneq Structure::m_typeInfo + TypeInfo::m_type[t0], FinalObjectType, .opToThisSlow 289 289 loadpFromInstruction(2, t1) 290 290 valueProfile(t0, t1) 291 291 dispatch(3) 292 292 293 .op ConvertThisSlow:294 callSlowPath(_llint_slow_path_ convert_this)293 .opToThisSlow: 294 callSlowPath(_llint_slow_path_to_this) 295 295 dispatch(3) 296 296 -
trunk/Source/JavaScriptCore/profiler/ProfileGenerator.cpp
r139541 r153145 65 65 66 66 exec->interpreter()->retrieveLastCaller(exec, lineNumber, sourceID, sourceURL, function); 67 m_currentNode = ProfileNode::create(exec, LegacyProfiler::createCallIdentifier(exec, function ? function.toThisObject(exec) : 0, sourceURL, lineNumber), m_head.get(), m_head.get());67 m_currentNode = ProfileNode::create(exec, LegacyProfiler::createCallIdentifier(exec, function, sourceURL, lineNumber), m_head.get(), m_head.get()); 68 68 m_head->insertNode(m_currentNode.get()); 69 69 } -
trunk/Source/JavaScriptCore/runtime/CallData.cpp
r139541 r153145 37 37 { 38 38 ASSERT(callType == CallTypeJS || callType == CallTypeHost); 39 ASSERT(isValidThisObject(thisValue, exec));40 39 return exec->interpreter()->executeCall(exec, asObject(functionObject), callType, callData, thisValue, args); 41 40 } -
trunk/Source/JavaScriptCore/runtime/ClassInfo.h
r134898 r153145 67 67 GetOwnPropertySlotByIndexFunctionPtr getOwnPropertySlotByIndex; 68 68 69 typedef JS Object* (*ToThisObjectFunctionPtr)(JSCell*, ExecState*);70 ToThis ObjectFunctionPtr toThisObject;69 typedef JSValue (*ToThisFunctionPtr)(JSCell*, ExecState*, ECMAMode); 70 ToThisFunctionPtr toThis; 71 71 72 72 typedef JSValue (*DefaultValueFunctionPtr)(const JSObject*, ExecState*, PreferredPrimitiveType); … … 129 129 &ClassName::getOwnPropertySlot, \ 130 130 &ClassName::getOwnPropertySlotByIndex, \ 131 &ClassName::toThis Object, \131 &ClassName::toThis, \ 132 132 &ClassName::defaultValue, \ 133 133 &ClassName::getOwnPropertyNames, \ -
trunk/Source/JavaScriptCore/runtime/Completion.cpp
r149130 r153145 80 80 if (!thisValue || thisValue.isUndefinedOrNull()) 81 81 thisValue = exec->dynamicGlobalObject(); 82 JSObject* thisObj = thisValue.toThisObject(exec);82 JSObject* thisObj = jsCast<JSObject*>(thisValue.toThis(exec, NotStrictMode)); 83 83 JSValue result = exec->interpreter()->execute(program, exec, thisObj); 84 84 -
trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp
r149980 r153145 1107 1107 { 1108 1108 JSValue thisValue = exec->hostThisValue(); 1109 JSObject* object = thisValue.toThisObject(exec);1109 JSObject* object = jsCast<JSObject*>(thisValue.toThis(exec, NotStrictMode)); 1110 1110 if (exec->hadException()) 1111 1111 return JSValue::encode(jsNull()); -
trunk/Source/JavaScriptCore/runtime/GetterSetter.cpp
r139541 r153145 24 24 #include "GetterSetter.h" 25 25 26 #include "Error.h" 26 27 #include "JSObject.h" 27 28 #include "Operations.h" … … 45 46 } 46 47 48 JSValue callGetter(ExecState* exec, JSValue base, JSValue getterSetter) 49 { 50 // FIXME: Some callers may invoke get() without checking for an exception first. 51 // We work around that by checking here. 52 if (exec->hadException()) 53 return exec->exception(); 54 55 JSObject* getter = jsCast<GetterSetter*>(getterSetter)->getter(); 56 if (!getter) 57 return jsUndefined(); 58 59 CallData callData; 60 CallType callType = getter->methodTable()->getCallData(getter, callData); 61 return call(exec, getter, callType, callData, base, ArgList()); 62 } 63 64 void callSetter(ExecState* exec, JSValue base, JSValue getterSetter, JSValue value, ECMAMode ecmaMode) 65 { 66 JSObject* setter = jsCast<GetterSetter*>(getterSetter)->setter(); 67 if (!setter) { 68 if (ecmaMode == StrictMode) 69 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 70 return; 71 } 72 73 MarkedArgumentBuffer args; 74 args.append(value); 75 76 CallData callData; 77 CallType callType = setter->methodTable()->getCallData(setter, callData); 78 call(exec, setter, callType, callData, base, args); 79 } 80 47 81 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/GetterSetter.h
r148696 r153145 80 80 } 81 81 82 JSValue callGetter(ExecState*, JSValue base, JSValue getterSetter); 83 void callSetter(ExecState*, JSValue base, JSValue getterSetter, JSValue value, ECMAMode); 82 84 83 85 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSActivation.cpp
r153132 r153145 237 237 } 238 238 239 JSObject* JSActivation::toThisObject(JSCell*, ExecState* exec) 240 { 239 JSValue JSActivation::toThis(JSCell*, ExecState* exec, ECMAMode ecmaMode) 240 { 241 if (ecmaMode == StrictMode) 242 return jsUndefined(); 241 243 return exec->globalThisValue(); 242 244 } -
trunk/Source/JavaScriptCore/runtime/JSActivation.h
r148696 r153145 74 74 static bool deleteProperty(JSCell*, ExecState*, PropertyName); 75 75 76 static JS Object* toThisObject(JSCell*, ExecState*);76 static JSValue toThis(JSCell*, ExecState*, ECMAMode); 77 77 78 78 void tearOff(VM&); -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp
r148696 r153145 81 81 } 82 82 83 JS Object* JSValue::toThisObjectSlowCase(ExecState* exec) const83 JSValue JSValue::toThisSlowCase(ExecState* exec, ECMAMode ecmaMode) const 84 84 { 85 85 ASSERT(!isCell()); 86 87 if (ecmaMode == StrictMode) 88 return *this; 86 89 87 90 if (isInt32() || isDouble()) … … 148 151 JSValue gs = obj->getDirect(offset); 149 152 if (gs.isGetterSetter()) { 150 JSObject* setterFunc = asGetterSetter(gs)->setter(); 151 if (!setterFunc) { 152 if (slot.isStrictMode()) 153 throwError(exec, createTypeError(exec, ASCIILiteral("setting a property that has only a getter"))); 154 return; 155 } 156 157 CallData callData; 158 CallType callType = setterFunc->methodTable()->getCallData(setterFunc, callData); 159 MarkedArgumentBuffer args; 160 args.append(value); 161 162 // If this is WebCore's global object then we need to substitute the shell. 163 call(exec, setterFunc, callType, callData, *this, args); 153 callSetter(exec, *this, gs, value, slot.isStrictMode() ? StrictMode : NotStrictMode); 164 154 return; 165 155 } -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.h
r152613 r153145 73 73 74 74 enum PreferredPrimitiveType { NoPreference, PreferNumber, PreferString }; 75 75 enum ECMAMode { StrictMode, NotStrictMode }; 76 76 77 77 typedef int64_t EncodedJSValue; … … 246 246 void putByIndex(ExecState*, unsigned propertyName, JSValue, bool shouldThrow); 247 247 248 JS Object* toThisObject(ExecState*) const;248 JSValue toThis(ExecState*, ECMAMode) const; 249 249 250 250 static bool equal(ExecState*, JSValue v1, JSValue v2); … … 276 276 JS_EXPORT_PRIVATE WTF::String toWTFStringSlowCase(ExecState*) const; 277 277 JS_EXPORT_PRIVATE JSObject* toObjectSlowCase(ExecState*, JSGlobalObject*) const; 278 JS_EXPORT_PRIVATE JS Object* toThisObjectSlowCase(ExecState*) const;278 JS_EXPORT_PRIVATE JSValue toThisSlowCase(ExecState*, ECMAMode) const; 279 279 280 280 #if USE(JSVALUE32_64) -
trunk/Source/JavaScriptCore/runtime/JSCJSValueInlines.h
r150659 r153145 615 615 } 616 616 617 inline JS Object* JSValue::toThisObject(ExecState* exec) const618 { 619 return isCell() ? asCell()->methodTable()->toThis Object(asCell(), exec) : toThisObjectSlowCase(exec);617 inline JSValue JSValue::toThis(ExecState* exec, ECMAMode ecmaMode) const 618 { 619 return isCell() ? asCell()->methodTable()->toThis(asCell(), exec, ecmaMode) : toThisSlowCase(exec, ecmaMode); 620 620 } 621 621 -
trunk/Source/JavaScriptCore/runtime/JSCell.cpp
r152573 r153145 140 140 } 141 141 142 JSObject* JSCell::toThisObject(JSCell* cell, ExecState* exec) 143 { 142 JSValue JSCell::toThis(JSCell* cell, ExecState* exec, ECMAMode ecmaMode) 143 { 144 if (ecmaMode == StrictMode) 145 return cell; 144 146 return cell->toObject(exec, exec->lexicalGlobalObject()); 145 147 } -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r149236 r153145 114 114 static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); 115 115 116 static JS Object* toThisObject(JSCell*, ExecState*);116 static JSValue toThis(JSCell*, ExecState*, ECMAMode); 117 117 118 118 void zap() { *reinterpret_cast<uintptr_t**>(this) = 0; } -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r151605 r153145 530 530 } 531 531 532 JSObject* JSGlobalObject::toThisObject(JSCell* cell, ExecState*) 533 { 534 return jsCast<JSGlobalObject*>(cell)->globalThis(); 532 JSValue JSGlobalObject::toThis(JSCell*, ExecState* exec, ECMAMode ecmaMode) 533 { 534 if (ecmaMode == StrictMode) 535 return jsUndefined(); 536 return exec->globalThisValue(); 535 537 } 536 538 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r149836 r153145 385 385 VM& vm() const { return *Heap::heap(this)->vm(); } 386 386 JSObject* globalThis() const; 387 JS_EXPORT_PRIVATE void setGlobalThis(VM&, JSObject* globalThis); 387 388 388 389 static Structure* createStructure(VM& vm, JSValue prototype) … … 433 434 JS_EXPORT_PRIVATE void addStaticGlobals(GlobalPropertyInfo*, int count); 434 435 435 JS_EXPORT_PRIVATE static JSC::JSObject* toThisObject(JSC::JSCell*, JSC::ExecState*); 436 437 JS_EXPORT_PRIVATE void setGlobalThis(VM&, JSObject* globalThis); 436 JS_EXPORT_PRIVATE static JSC::JSValue toThis(JSC::JSCell*, JSC::ExecState*, ECMAMode); 438 437 439 438 private: -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r153135 r153145 708 708 EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState* exec) 709 709 { 710 if (!exec->thisValue().isObject()) 710 JSObject* thisObject = jsDynamicCast<JSObject*>(exec->thisValue().toThis(exec, NotStrictMode)); 711 712 if (!thisObject) 711 713 return JSValue::encode(exec->thisValue().synthesizePrototype(exec)); 712 714 713 JSObject* thisObject = asObject(exec->thisValue());714 715 if (!thisObject->allowsAccessFrom(exec->trueCallerFrame())) 715 716 return JSValue::encode(jsUndefined()); … … 722 723 JSValue value = exec->argument(0); 723 724 725 JSObject* thisObject = jsDynamicCast<JSObject*>(exec->thisValue().toThis(exec, NotStrictMode)); 726 724 727 // Setting __proto__ of a primitive should have no effect. 725 if (! exec->thisValue().isObject())728 if (!thisObject) 726 729 return JSValue::encode(jsUndefined()); 727 730 728 JSObject* thisObject = asObject(exec->thisValue());729 731 if (!thisObject->allowsAccessFrom(exec->trueCallerFrame())) 730 732 return JSValue::encode(jsUndefined()); … … 737 739 return throwVMError(exec, createTypeError(exec, StrictModeReadonlyPropertyWriteError)); 738 740 739 if (!thisObject->setPrototypeWithCycleCheck(exec ->vm(), value))741 if (!thisObject->setPrototypeWithCycleCheck(exec, value)) 740 742 throwError(exec, createError(exec, "cyclic __proto__ value")); 741 743 return JSValue::encode(jsUndefined()); -
trunk/Source/JavaScriptCore/runtime/JSNameScope.cpp
r140594 r153145 45 45 } 46 46 47 JS Object* JSNameScope::toThisObject(JSCell*, ExecState* exec)47 JSValue JSNameScope::toThis(JSCell*, ExecState* exec, ECMAMode ecmaMode) 48 48 { 49 if (ecmaMode == StrictMode) 50 return jsUndefined(); 49 51 return exec->globalThisValue(); 50 52 } -
trunk/Source/JavaScriptCore/runtime/JSNameScope.h
r148696 r153145 53 53 static void visitChildren(JSCell*, SlotVisitor&); 54 54 bool isDynamicScope(bool& requiresDynamicChecks) const; 55 static JS Object* toThisObject(JSCell*, ExecState*);55 static JSValue toThis(JSCell*, ExecState*, ECMAMode); 56 56 static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); 57 57 static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r152784 r153145 383 383 JSValue gs = obj->getDirect(offset); 384 384 if (gs.isGetterSetter()) { 385 ASSERT(attributes & Accessor); 386 ASSERT(thisObject->structure()->prototypeChainMayInterceptStoreTo(exec->vm(), propertyName) || obj == thisObject); 387 JSObject* setterFunc = asGetterSetter(gs)->setter(); 388 if (!setterFunc) { 389 if (slot.isStrictMode()) 390 throwError(exec, createTypeError(exec, ASCIILiteral("setting a property that has only a getter"))); 391 return; 392 } 393 394 CallData callData; 395 CallType callType = setterFunc->methodTable()->getCallData(setterFunc, callData); 396 MarkedArgumentBuffer args; 397 args.append(value); 398 399 // If this is WebCore's global object then we need to substitute the shell. 400 call(exec, setterFunc, callType, callData, thisObject->methodTable()->toThisObject(thisObject, exec), args); 385 callSetter(exec, cell, gs, value, slot.isStrictMode() ? StrictMode : NotStrictMode); 401 386 return; 402 387 } else … … 1173 1158 } 1174 1159 1175 bool JSObject::setPrototypeWithCycleCheck(VM& vm, JSValue prototype) 1176 { 1177 JSValue checkFor = this; 1178 if (this->isGlobalObject()) 1179 checkFor = jsCast<JSGlobalObject*>(this)->globalExec()->thisValue(); 1180 1160 bool JSObject::setPrototypeWithCycleCheck(ExecState* exec, JSValue prototype) 1161 { 1162 ASSERT(methodTable()->toThis(this, exec, NotStrictMode) == this); 1181 1163 JSValue nextPrototype = prototype; 1182 1164 while (nextPrototype && nextPrototype.isObject()) { 1183 if (nextPrototype == checkFor)1165 if (nextPrototype == this) 1184 1166 return false; 1185 1167 nextPrototype = asObject(nextPrototype)->prototype(); 1186 1168 } 1187 setPrototype( vm, prototype);1169 setPrototype(exec->vm(), prototype); 1188 1170 return true; 1189 1171 } … … 1561 1543 } 1562 1544 1563 JS Object* JSObject::toThisObject(JSCell* cell, ExecState*)1545 JSValue JSObject::toThis(JSCell* cell, ExecState*, ECMAMode) 1564 1546 { 1565 1547 return jsCast<JSObject*>(cell); … … 1641 1623 } 1642 1624 1643 NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, PropertyOffset offset) 1644 { 1645 if (JSObject* getterFunction = asGetterSetter(getDirect(offset))->getter()) { 1646 if (!structure()->isDictionary()) 1647 slot.setCacheableGetterSlot(this, getterFunction, offset); 1648 else 1649 slot.setGetterSlot(getterFunction); 1650 } else 1651 slot.setUndefined(); 1625 NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, JSValue getterSetter, PropertyOffset offset) 1626 { 1627 if (structure()->isDictionary()) { 1628 slot.setGetterSlot(jsCast<GetterSetter*>(getterSetter)); 1629 return; 1630 } 1631 1632 slot.setCacheableGetterSlot(this, jsCast<GetterSetter*>(getterSetter), offset); 1652 1633 } 1653 1634 -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r151605 r153145 123 123 JSValue prototype() const; 124 124 void setPrototype(VM&, JSValue prototype); 125 bool setPrototypeWithCycleCheck( VM&, JSValue prototype);125 bool setPrototypeWithCycleCheck(ExecState*, JSValue prototype); 126 126 127 127 bool mayInterceptIndexedAccesses() … … 487 487 JS_EXPORT_PRIVATE JSString* toString(ExecState*) const; 488 488 489 // NOTE: JSObject and its subclasses must be able to gracefully handle ExecState* = 0, 490 // because this call may come from inside the compiler. 491 JS_EXPORT_PRIVATE static JSObject* toThisObject(JSCell*, ExecState*); 489 JS_EXPORT_PRIVATE static JSValue toThis(JSCell*, ExecState*, ECMAMode); 492 490 493 491 bool getPropertySpecificValue(ExecState*, PropertyName, JSCell*& specificFunction) const; … … 926 924 927 925 bool inlineGetOwnPropertySlot(ExecState*, PropertyName, PropertySlot&); 928 JS_EXPORT_PRIVATE void fillGetterPropertySlot(PropertySlot&, PropertyOffset);926 JS_EXPORT_PRIVATE void fillGetterPropertySlot(PropertySlot&, JSValue, PropertyOffset); 929 927 930 928 const HashEntry* findPropertyHashEntry(ExecState*, PropertyName) const; … … 1161 1159 JSValue value = getDirect(offset); 1162 1160 if (structure()->hasGetterSetterProperties() && value.isGetterSetter()) 1163 fillGetterPropertySlot(slot, offset);1161 fillGetterPropertySlot(slot, value, offset); 1164 1162 else 1165 1163 slot.setValue(this, value, offset); -
trunk/Source/JavaScriptCore/runtime/JSScope.cpp
r153123 r153145 537 537 return JSValue(); 538 538 ASSERT(value); 539 *base = propertyBase->structure()->typeInfo().isEnvironmentRecord() ? jsUndefined() :JSValue(propertyBase);539 *base = JSValue(propertyBase); 540 540 return value; 541 541 } -
trunk/Source/JavaScriptCore/runtime/JSString.cpp
r148696 r153145 272 272 } 273 273 274 JSObject* JSString::toThisObject(JSCell* cell, ExecState* exec) 275 { 274 JSValue JSString::toThis(JSCell* cell, ExecState* exec, ECMAMode ecmaMode) 275 { 276 if (ecmaMode == StrictMode) 277 return cell; 276 278 return StringObject::create(exec, exec->lexicalGlobalObject(), jsCast<JSString*>(cell)); 277 279 } -
trunk/Source/JavaScriptCore/runtime/JSString.h
r152613 r153145 201 201 friend class LLIntOffsetsExtractor; 202 202 203 static JS Object* toThisObject(JSCell*, ExecState*);203 static JSValue toThis(JSCell*, ExecState*, ECMAMode); 204 204 205 205 // Actually getPropertySlot, not getOwnPropertySlot (see JSCell). -
trunk/Source/JavaScriptCore/runtime/PropertySlot.cpp
r139541 r153145 22 22 #include "PropertySlot.h" 23 23 24 #include "JSFunction.h" 25 #include "JSGlobalObject.h" 26 #include "Operations.h" 24 #include "GetterSetter.h" 25 #include "JSCJSValueInlines.h" 27 26 28 27 namespace JSC { … … 30 29 JSValue PropertySlot::functionGetter(ExecState* exec) const 31 30 { 32 // Prevent getter functions from observing execution if an exception is pending. 33 if (exec->hadException()) 34 return exec->exception(); 35 36 CallData callData; 37 CallType callType = m_data.getterFunc->methodTable()->getCallData(m_data.getterFunc, callData); 38 return call(exec, m_data.getterFunc, callType, callData, m_thisValue.isObject() ? m_thisValue.toThisObject(exec) : m_thisValue, exec->emptyList()); 31 return callGetter(exec, m_thisValue, m_data.getterSetter); 39 32 } 40 33 -
trunk/Source/JavaScriptCore/runtime/PropertySlot.h
r140718 r153145 32 32 33 33 class ExecState; 34 class JSObject;34 class GetterSetter; 35 35 36 36 #define JSC_VALUE_MARKER 0 … … 154 154 } 155 155 156 void setGetterSlot( JSObject* getterFunc)157 { 158 ASSERT(getter Func);156 void setGetterSlot(GetterSetter* getterSetter) 157 { 158 ASSERT(getterSetter); 159 159 m_thisValue = m_slotBase; 160 160 m_getValue = GETTER_FUNCTION_MARKER; 161 m_data.getter Func = getterFunc;162 } 163 164 void setCacheableGetterSlot(JSValue slotBase, JSObject* getterFunc, PropertyOffset offset)165 { 166 ASSERT(getter Func);161 m_data.getterSetter = getterSetter; 162 } 163 164 void setCacheableGetterSlot(JSValue slotBase, GetterSetter* getterSetter, PropertyOffset offset) 165 { 166 ASSERT(getterSetter); 167 167 m_getValue = GETTER_FUNCTION_MARKER; 168 168 m_thisValue = m_slotBase; 169 169 m_slotBase = slotBase; 170 m_data.getter Func = getterFunc;170 m_data.getterSetter = getterSetter; 171 171 m_offset = offset; 172 172 m_cachedPropertyType = Getter; … … 227 227 JSValue m_slotBase; 228 228 union { 229 JSObject* getterFunc;229 GetterSetter* getterSetter; 230 230 unsigned index; 231 231 } m_data; -
trunk/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
r148696 r153145 133 133 } 134 134 135 JSObject* getter = asGetterSetter(value)->getter(); 136 if (!getter) { 137 slot.setUndefined(); 138 return; 139 } 140 141 slot.setGetterSlot(getter); 135 slot.setGetterSlot(jsCast<GetterSetter*>(value)); 142 136 } 143 137 … … 149 143 JSValue SparseArrayEntry::get(ExecState* exec, JSObject* array) const 150 144 { 151 JSValue result= Base::get();152 ASSERT( result);145 JSValue value = Base::get(); 146 ASSERT(value); 153 147 154 if (LIKELY(! result.isGetterSetter()))155 return result;148 if (LIKELY(!value.isGetterSetter())) 149 return value; 156 150 157 JSObject* getter = asGetterSetter(result)->getter(); 158 if (!getter) 159 return jsUndefined(); 160 161 CallData callData; 162 CallType callType = getter->methodTable()->getCallData(getter, callData); 163 return call(exec, getter, callType, callData, array->methodTable()->toThisObject(array, exec), exec->emptyList()); 151 return callGetter(exec, array, jsCast<GetterSetter*>(value)); 164 152 } 165 153 … … 177 165 } 178 166 179 JSValue accessor = Base::get(); 180 ASSERT(accessor.isGetterSetter()); 181 JSObject* setter = asGetterSetter(accessor)->setter(); 182 183 if (!setter) { 184 if (shouldThrow) 185 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 186 return; 187 } 188 189 CallData callData; 190 CallType callType = setter->methodTable()->getCallData(setter, callData); 191 MarkedArgumentBuffer args; 192 args.append(value); 193 if (thisValue.isObject()) 194 thisValue = asObject(thisValue)->methodTable()->toThisObject(asObject(thisValue), exec); 195 call(exec, setter, callType, callData, thisValue, args); 167 callSetter(exec, thisValue, Base::get(), value, shouldThrow ? StrictMode : NotStrictMode); 196 168 } 197 169 -
trunk/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp
r148696 r153145 50 50 } 51 51 52 JS Object* StrictEvalActivation::toThisObject(JSCell*, ExecState* exec)52 JSValue StrictEvalActivation::toThis(JSCell*, ExecState* exec, ECMAMode ecmaMode) 53 53 { 54 if (ecmaMode == StrictMode) 55 return jsUndefined(); 54 56 return exec->globalThisValue(); 55 57 } -
trunk/Source/JavaScriptCore/runtime/StrictEvalActivation.h
r148696 r153145 43 43 44 44 static bool deleteProperty(JSCell*, ExecState*, PropertyName); 45 static JS Object* toThisObject(JSCell*, ExecState*);45 static JSValue toThis(JSCell*, ExecState*, ECMAMode); 46 46 47 47 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) -
trunk/Source/WebCore/ChangeLog
r153135 r153145 1 2013-05-05 Geoffrey Garen <ggaren@apple.com> 2 3 Rolled back in r149527 with crash fixed. 4 5 Reviewed by Oliver Hunt. 6 7 Rationalized 'this' value conversion 8 https://bugs.webkit.org/show_bug.cgi?id=115542 9 1 10 2013-04-29 Filip Pizlo <fpizlo@apple.com> 2 11 -
trunk/Source/WebCore/WebCore.order
r152685 r153145 2802 2802 __ZN7WebCore13ScriptElement13executeScriptERKNS_16ScriptSourceCodeE 2803 2803 __ZNK7WebCore21ContentSecurityPolicy17allowInlineScriptEv 2804 __ZNK7WebCore15JSDOMWindowBase12toThisObjectEPN3JSC9ExecStateE2805 2804 __ZN7WebCore16JSDOMWindowShell18getOwnPropertySlotEPN3JSC9ExecStateERKNS1_10IdentifierERNS1_12PropertySlotE 2806 2805 __ZN7WebCore16JSDOMWindowShell17putWithAttributesEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueEj -
trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp
r148696 r153145 93 93 DynamicGlobalObjectScope globalObjectScope(vm, vm.dynamicGlobalObject ? vm.dynamicGlobalObject : globalObject); 94 94 95 JSValue thisValue = globalObject->methodTable()->toThisObject(globalObject, exec);96 97 95 JSValue returnValue = scriptExecutionContext->isDocument() 98 ? JSMainThreadExecState::call(exec, jsFunction, callType, callData, thisValue, args)99 : JSC::call(exec, jsFunction, callType, callData, thisValue, args);96 ? JSMainThreadExecState::call(exec, jsFunction, callType, callData, globalObject, args) 97 : JSC::call(exec, jsFunction, callType, callData, globalObject, args); 100 98 101 99 globalObject->setCurrentEvent(savedEvent); -
trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
r148696 r153145 113 113 return jsUndefined(); 114 114 115 JSObject* thisObject = exec->argument(0).toThisObject(exec);115 JSObject* thisObject = jsCast<JSObject*>(exec->argument(0).toThis(exec, NotStrictMode)); 116 116 String result = thisObject->methodTable()->className(thisObject); 117 117 return jsStringWithCache(exec, result); -
trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h
r130021 r153145 51 51 { 52 52 JSMainThreadExecState currentState(exec); 53 // Ensure DOM global object is unwrapped to the shell.54 if (thisValue.isObject())55 thisValue = thisValue.toThisObject(exec);56 53 return JSC::call(exec, functionObject, callType, callData, thisValue, args); 57 54 }; -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r152844 r153145 2498 2498 } else { 2499 2499 if ($interfaceName eq "DOMWindow") { 2500 push(@implContent, " $className* castedThis = toJSDOMWindow(exec->hostThisValue().toThis Object(exec));\n");2500 push(@implContent, " $className* castedThis = toJSDOMWindow(exec->hostThisValue().toThis(exec, NotStrictMode));\n"); 2501 2501 push(@implContent, " if (!castedThis)\n"); 2502 2502 push(@implContent, " return throwVMTypeError(exec);\n"); 2503 } elsif ($ codeGenerator->InheritsInterface($interface, "WorkerGlobalScope")) {2504 push(@implContent, " $className* castedThis = to${className}(exec->hostThisValue().toThis Object(exec));\n");2503 } elsif ($interface->extendedAttributes->{"WorkerGlobalScope"}) { 2504 push(@implContent, " $className* castedThis = to${className}(exec->hostThisValue().toThis(exec, NotStrictMode));\n"); 2505 2505 push(@implContent, " if (!castedThis)\n"); 2506 2506 push(@implContent, " return throwVMTypeError(exec);\n"); -
trunk/Source/WebCore/bridge/NP_jsobject.cpp
r130612 r153145 235 235 MarkedArgumentBuffer argList; 236 236 getListFromVariantArgs(exec, args, argCount, rootObject, argList); 237 JSValue resultV = JSC::call(exec, function, callType, callData, obj->imp ->methodTable()->toThisObject(obj->imp, exec), argList);237 JSValue resultV = JSC::call(exec, function, callType, callData, obj->imp, argList); 238 238 239 239 // Convert and return the result of the function call. -
trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp
r153017 r153145 398 398 return; 399 399 400 JSC::JSObject* thisObj = globalObject->methodTable()->toThisObject(globalObject, exec); 401 402 JSC::call(exec, overlay, callType, callData, thisObj, argList); 400 JSC::call(exec, overlay, callType, callData, globalObject, argList); 403 401 } 404 402 -
trunk/Source/WebKit/mac/ChangeLog
r152814 r153145 1 2013-05-05 Geoffrey Garen <ggaren@apple.com> 2 3 Rolled back in r149527 with crash fixed. 4 5 Reviewed by Oliver Hunt. 6 7 Rationalized 'this' value conversion 8 https://bugs.webkit.org/show_bug.cgi?id=115542 9 1 10 2013-07-17 Commit Queue <commit-queue@webkit.org> 2 11 -
trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
r152238 r153145 912 912 demarshalValues(exec, argumentsData, argumentsLength, argList); 913 913 914 JSValue value = call(exec, function, callType, callData, object ->methodTable()->toThisObject(object, exec), argList);914 JSValue value = call(exec, function, callType, callData, object, argList); 915 915 916 916 marshalValue(exec, value, resultData, resultLength); … … 944 944 demarshalValues(exec, argumentsData, argumentsLength, argList); 945 945 946 JSValue value = call(exec, object, callType, callData, object ->methodTable()->toThisObject(object, exec), argList);946 JSValue value = call(exec, object, callType, callData, object, argList); 947 947 948 948 marshalValue(exec, value, resultData, resultLength); -
trunk/Source/WebKit2/ChangeLog
r153108 r153145 1 2013-05-05 Geoffrey Garen <ggaren@apple.com> 2 3 Rolled back in r149527 with crash fixed. 4 5 Reviewed by Oliver Hunt. 6 7 Rationalized 'this' value conversion 8 https://bugs.webkit.org/show_bug.cgi?id=115542 9 1 10 2013-07-24 Ruth Fong <ruth_fong@apple.com> 2 11 -
trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp
r148696 r153145 294 294 argumentList.append(m_objectMap->convertNPVariantToJSValue(exec, globalObject, arguments[i])); 295 295 296 JSValue value = JSC::call(exec, function, callType, callData, m_jsObject ->methodTable()->toThisObject(m_jsObject.get(), exec), argumentList);296 JSValue value = JSC::call(exec, function, callType, callData, m_jsObject.get(), argumentList); 297 297 298 298 // Convert and return the result of the function call.
Note: See TracChangeset
for help on using the changeset viewer.