OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca> | 3 * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca> |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 10 matching lines...) Expand all Loading... |
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #include "config.h" | 30 #include "config.h" |
31 #include "Interpreter.h" | 31 #include "JITStubs.h" |
| 32 |
| 33 #if ENABLE(JIT) |
32 | 34 |
33 #include "Arguments.h" | 35 #include "Arguments.h" |
34 #include "BatchedTransitionOptimizer.h" | 36 #include "CallFrame.h" |
35 #include "CodeBlock.h" | 37 #include "CodeBlock.h" |
36 #include "DebuggerCallFrame.h" | 38 #include "Collector.h" |
37 #include "EvalCodeCache.h" | 39 #include "Debugger.h" |
38 #include "ExceptionHelpers.h" | 40 #include "ExceptionHelpers.h" |
39 #include "CallFrame.h" | |
40 #include "GlobalEvalFunction.h" | 41 #include "GlobalEvalFunction.h" |
| 42 #include "JIT.h" |
41 #include "JSActivation.h" | 43 #include "JSActivation.h" |
42 #include "JSArray.h" | 44 #include "JSArray.h" |
43 #include "JSByteArray.h" | 45 #include "JSByteArray.h" |
44 #include "JSFunction.h" | 46 #include "JSFunction.h" |
45 #include "JSNotAnObject.h" | 47 #include "JSNotAnObject.h" |
46 #include "JSPropertyNameIterator.h" | 48 #include "JSPropertyNameIterator.h" |
47 #include "JSStaticScopeObject.h" | 49 #include "JSStaticScopeObject.h" |
48 #include "JSString.h" | 50 #include "JSString.h" |
49 #include "ObjectPrototype.h" | 51 #include "ObjectPrototype.h" |
| 52 #include "Operations.h" |
50 #include "Parser.h" | 53 #include "Parser.h" |
51 #include "Profiler.h" | 54 #include "Profiler.h" |
52 #include "RegExpObject.h" | 55 #include "RegExpObject.h" |
53 #include "RegExpPrototype.h" | 56 #include "RegExpPrototype.h" |
54 #include "Register.h" | 57 #include "Register.h" |
55 #include "Collector.h" | |
56 #include "Debugger.h" | |
57 #include "Operations.h" | |
58 #include "SamplingTool.h" | 58 #include "SamplingTool.h" |
59 #include <stdio.h> | 59 #include <stdio.h> |
60 | 60 |
61 #if ENABLE(JIT) | |
62 #include "JIT.h" | |
63 #endif | |
64 | |
65 #if ENABLE(ASSEMBLER) | |
66 #include "AssemblerBuffer.h" | |
67 #endif | |
68 | |
69 #if PLATFORM(DARWIN) | |
70 #include <mach/mach.h> | |
71 #endif | |
72 | |
73 #if HAVE(SYS_TIME_H) | |
74 #include <sys/time.h> | |
75 #endif | |
76 | |
77 #if PLATFORM(WIN_OS) | |
78 #include <windows.h> | |
79 #endif | |
80 | |
81 #if PLATFORM(QT) | |
82 #include <QDateTime> | |
83 #endif | |
84 | |
85 using namespace std; | 61 using namespace std; |
86 | 62 |
87 namespace JSC { | 63 namespace JSC { |
88 | 64 |
89 #if ENABLE(JIT) | |
90 | |
91 #if ENABLE(OPCODE_SAMPLING) | 65 #if ENABLE(OPCODE_SAMPLING) |
92 #define CTI_SAMPLER ARG_globalData->interpreter->sampler() | 66 #define CTI_SAMPLER ARG_globalData->interpreter->sampler() |
93 #else | 67 #else |
94 #define CTI_SAMPLER 0 | 68 #define CTI_SAMPLER 0 |
95 #endif | 69 #endif |
96 | 70 |
| 71 JITStubs::JITStubs(JSGlobalData* globalData) |
| 72 : m_ctiArrayLengthTrampoline(0) |
| 73 , m_ctiStringLengthTrampoline(0) |
| 74 , m_ctiVirtualCallPreLink(0) |
| 75 , m_ctiVirtualCallLink(0) |
| 76 , m_ctiVirtualCall(0) |
| 77 { |
| 78 JIT::compileCTIMachineTrampolines(globalData, &m_executablePool, &m_ctiArray
LengthTrampoline, &m_ctiStringLengthTrampoline, &m_ctiVirtualCallPreLink, &m_cti
VirtualCallLink, &m_ctiVirtualCall); |
| 79 } |
| 80 |
97 #if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) | 81 #if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) |
98 | 82 |
99 NEVER_INLINE void Interpreter::tryCTICachePutByID(CallFrame* callFrame, CodeBloc
k* codeBlock, void* returnAddress, JSValuePtr baseValue, const PutPropertySlot&
slot) | 83 NEVER_INLINE void JITStubs::tryCachePutByID(CallFrame* callFrame, CodeBlock* cod
eBlock, void* returnAddress, JSValuePtr baseValue, const PutPropertySlot& slot) |
100 { | 84 { |
101 // The interpreter checks for recursion here; I do not believe this can occu
r in CTI. | 85 // The interpreter checks for recursion here; I do not believe this can occu
r in CTI. |
102 | 86 |
103 if (!baseValue.isCell()) | 87 if (!baseValue.isCell()) |
104 return; | 88 return; |
105 | 89 |
106 // Uncacheable: give up. | 90 // Uncacheable: give up. |
107 if (!slot.isCacheable()) { | 91 if (!slot.isCacheable()) { |
108 ctiPatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(cti_o
p_put_by_id_generic)); | 92 ctiPatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(JITSt
ubs::cti_op_put_by_id_generic)); |
109 return; | 93 return; |
110 } | 94 } |
111 | 95 |
112 JSCell* baseCell = asCell(baseValue); | 96 JSCell* baseCell = asCell(baseValue); |
113 Structure* structure = baseCell->structure(); | 97 Structure* structure = baseCell->structure(); |
114 | 98 |
115 if (structure->isDictionary()) { | 99 if (structure->isDictionary()) { |
116 ctiPatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(cti_o
p_put_by_id_generic)); | 100 ctiPatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(JITSt
ubs::cti_op_put_by_id_generic)); |
117 return; | 101 return; |
118 } | 102 } |
119 | 103 |
120 // If baseCell != base, then baseCell must be a proxy for another object. | 104 // If baseCell != base, then baseCell must be a proxy for another object. |
121 if (baseCell != slot.base()) { | 105 if (baseCell != slot.base()) { |
122 ctiPatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(cti_o
p_put_by_id_generic)); | 106 ctiPatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(JITSt
ubs::cti_op_put_by_id_generic)); |
123 return; | 107 return; |
124 } | 108 } |
125 | 109 |
126 StructureStubInfo* stubInfo = &codeBlock->getStubInfo(returnAddress); | 110 StructureStubInfo* stubInfo = &codeBlock->getStubInfo(returnAddress); |
127 | 111 |
128 // Cache hit: Specialize instruction and ref Structures. | 112 // Cache hit: Specialize instruction and ref Structures. |
129 | 113 |
130 // Structure transition, cache transition info | 114 // Structure transition, cache transition info |
131 if (slot.type() == PutPropertySlot::NewProperty) { | 115 if (slot.type() == PutPropertySlot::NewProperty) { |
132 StructureChain* chain = structure->cachedPrototypeChain(); | 116 StructureChain* chain = structure->cachedPrototypeChain(); |
(...skipping 12 matching lines...) Expand all Loading... |
145 | 129 |
146 stubInfo->initPutByIdReplace(structure); | 130 stubInfo->initPutByIdReplace(structure); |
147 | 131 |
148 #if USE(CTI_REPATCH_PIC) | 132 #if USE(CTI_REPATCH_PIC) |
149 JIT::patchPutByIdReplace(stubInfo, structure, slot.cachedOffset(), returnAdd
ress); | 133 JIT::patchPutByIdReplace(stubInfo, structure, slot.cachedOffset(), returnAdd
ress); |
150 #else | 134 #else |
151 JIT::compilePutByIdReplace(callFrame->scopeChain()->globalData, callFrame, c
odeBlock, stubInfo, structure, slot.cachedOffset(), returnAddress); | 135 JIT::compilePutByIdReplace(callFrame->scopeChain()->globalData, callFrame, c
odeBlock, stubInfo, structure, slot.cachedOffset(), returnAddress); |
152 #endif | 136 #endif |
153 } | 137 } |
154 | 138 |
155 NEVER_INLINE void Interpreter::tryCTICacheGetByID(CallFrame* callFrame, CodeBloc
k* codeBlock, void* returnAddress, JSValuePtr baseValue, const Identifier& prope
rtyName, const PropertySlot& slot) | 139 NEVER_INLINE void JITStubs::tryCacheGetByID(CallFrame* callFrame, CodeBlock* cod
eBlock, void* returnAddress, JSValuePtr baseValue, const Identifier& propertyNam
e, const PropertySlot& slot) |
156 { | 140 { |
157 // FIXME: Write a test that proves we need to check for recursion here just | 141 // FIXME: Write a test that proves we need to check for recursion here just |
158 // like the interpreter does, then add a check for recursion. | 142 // like the interpreter does, then add a check for recursion. |
159 | 143 |
160 // FIXME: Cache property access for immediates. | 144 // FIXME: Cache property access for immediates. |
161 if (!baseValue.isCell()) { | 145 if (!baseValue.isCell()) { |
162 ctiPatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(cti_o
p_get_by_id_generic)); | 146 ctiPatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(JITSt
ubs::cti_op_get_by_id_generic)); |
163 return; | 147 return; |
164 } | 148 } |
| 149 |
| 150 JSGlobalData* globalData = &callFrame->globalData(); |
165 | 151 |
166 if (isJSArray(baseValue) && propertyName == callFrame->propertyNames().lengt
h) { | 152 if (isJSArray(globalData, baseValue) && propertyName == callFrame->propertyN
ames().length) { |
167 #if USE(CTI_REPATCH_PIC) | 153 #if USE(CTI_REPATCH_PIC) |
168 JIT::compilePatchGetArrayLength(callFrame->scopeChain()->globalData, cod
eBlock, returnAddress); | 154 JIT::compilePatchGetArrayLength(callFrame->scopeChain()->globalData, cod
eBlock, returnAddress); |
169 #else | 155 #else |
170 ctiPatchCallByReturnAddress(returnAddress, m_ctiArrayLengthTrampoline); | 156 ctiPatchCallByReturnAddress(returnAddress, globalData->jitStubs.ctiArray
LengthTrampoline()); |
171 #endif | 157 #endif |
172 return; | 158 return; |
173 } | 159 } |
174 if (isJSString(baseValue) && propertyName == callFrame->propertyNames().leng
th) { | 160 |
| 161 if (isJSString(globalData, baseValue) && propertyName == callFrame->property
Names().length) { |
175 // The tradeoff of compiling an patched inline string length access rout
ine does not seem | 162 // The tradeoff of compiling an patched inline string length access rout
ine does not seem |
176 // to pay off, so we currently only do this for arrays. | 163 // to pay off, so we currently only do this for arrays. |
177 ctiPatchCallByReturnAddress(returnAddress, m_ctiStringLengthTrampoline); | 164 ctiPatchCallByReturnAddress(returnAddress, globalData->jitStubs.ctiStrin
gLengthTrampoline()); |
178 return; | 165 return; |
179 } | 166 } |
180 | 167 |
181 // Uncacheable: give up. | 168 // Uncacheable: give up. |
182 if (!slot.isCacheable()) { | 169 if (!slot.isCacheable()) { |
183 ctiPatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(cti_o
p_get_by_id_generic)); | 170 ctiPatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(JITSt
ubs::cti_op_get_by_id_generic)); |
184 return; | 171 return; |
185 } | 172 } |
186 | 173 |
187 JSCell* baseCell = asCell(baseValue); | 174 JSCell* baseCell = asCell(baseValue); |
188 Structure* structure = baseCell->structure(); | 175 Structure* structure = baseCell->structure(); |
189 | 176 |
190 if (structure->isDictionary()) { | 177 if (structure->isDictionary()) { |
191 ctiPatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(cti_o
p_get_by_id_generic)); | 178 ctiPatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(JITSt
ubs::cti_op_get_by_id_generic)); |
192 return; | 179 return; |
193 } | 180 } |
194 | 181 |
195 // In the interpreter the last structure is trapped here; in CTI we use the | 182 // In the interpreter the last structure is trapped here; in CTI we use the |
196 // *_second method to achieve a similar (but not quite the same) effect. | 183 // *_second method to achieve a similar (but not quite the same) effect. |
197 | 184 |
198 StructureStubInfo* stubInfo = &codeBlock->getStubInfo(returnAddress); | 185 StructureStubInfo* stubInfo = &codeBlock->getStubInfo(returnAddress); |
199 | 186 |
200 // Cache hit: Specialize instruction and ref Structures. | 187 // Cache hit: Specialize instruction and ref Structures. |
201 | 188 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 VM_THROW_EXCEPTION_AT_END(); \ | 323 VM_THROW_EXCEPTION_AT_END(); \ |
337 } while (0) | 324 } while (0) |
338 #define CHECK_FOR_EXCEPTION_VOID() \ | 325 #define CHECK_FOR_EXCEPTION_VOID() \ |
339 do { \ | 326 do { \ |
340 if (UNLIKELY(ARG_globalData->exception != noValue())) { \ | 327 if (UNLIKELY(ARG_globalData->exception != noValue())) { \ |
341 VM_THROW_EXCEPTION_AT_END(); \ | 328 VM_THROW_EXCEPTION_AT_END(); \ |
342 return; \ | 329 return; \ |
343 } \ | 330 } \ |
344 } while (0) | 331 } while (0) |
345 | 332 |
346 JSObject* Interpreter::cti_op_convert_this(STUB_ARGS) | 333 JSObject* JITStubs::cti_op_convert_this(STUB_ARGS) |
347 { | 334 { |
348 BEGIN_STUB_FUNCTION(); | 335 BEGIN_STUB_FUNCTION(); |
349 | 336 |
350 JSValuePtr v1 = ARG_src1; | 337 JSValuePtr v1 = ARG_src1; |
351 CallFrame* callFrame = ARG_callFrame; | 338 CallFrame* callFrame = ARG_callFrame; |
352 | 339 |
353 JSObject* result = v1.toThisObject(callFrame); | 340 JSObject* result = v1.toThisObject(callFrame); |
354 CHECK_FOR_EXCEPTION_AT_END(); | 341 CHECK_FOR_EXCEPTION_AT_END(); |
355 return result; | 342 return result; |
356 } | 343 } |
357 | 344 |
358 void Interpreter::cti_op_end(STUB_ARGS) | 345 void JITStubs::cti_op_end(STUB_ARGS) |
359 { | 346 { |
360 BEGIN_STUB_FUNCTION(); | 347 BEGIN_STUB_FUNCTION(); |
361 | 348 |
362 ScopeChainNode* scopeChain = ARG_callFrame->scopeChain(); | 349 ScopeChainNode* scopeChain = ARG_callFrame->scopeChain(); |
363 ASSERT(scopeChain->refCount > 1); | 350 ASSERT(scopeChain->refCount > 1); |
364 scopeChain->deref(); | 351 scopeChain->deref(); |
365 } | 352 } |
366 | 353 |
367 JSValueEncodedAsPointer* Interpreter::cti_op_add(STUB_ARGS) | 354 JSValueEncodedAsPointer* JITStubs::cti_op_add(STUB_ARGS) |
368 { | 355 { |
369 BEGIN_STUB_FUNCTION(); | 356 BEGIN_STUB_FUNCTION(); |
370 | 357 |
371 JSValuePtr v1 = ARG_src1; | 358 JSValuePtr v1 = ARG_src1; |
372 JSValuePtr v2 = ARG_src2; | 359 JSValuePtr v2 = ARG_src2; |
373 | 360 |
374 double left; | 361 double left; |
375 double right = 0.0; | 362 double right = 0.0; |
376 | 363 |
377 bool rightIsNumber = v2.getNumber(right); | 364 bool rightIsNumber = v2.getNumber(right); |
(...skipping 24 matching lines...) Expand all Loading... |
402 } | 389 } |
403 return JSValuePtr::encode(jsString(ARG_globalData, value.release())); | 390 return JSValuePtr::encode(jsString(ARG_globalData, value.release())); |
404 } | 391 } |
405 | 392 |
406 // All other cases are pretty uncommon | 393 // All other cases are pretty uncommon |
407 JSValuePtr result = jsAddSlowCase(callFrame, v1, v2); | 394 JSValuePtr result = jsAddSlowCase(callFrame, v1, v2); |
408 CHECK_FOR_EXCEPTION_AT_END(); | 395 CHECK_FOR_EXCEPTION_AT_END(); |
409 return JSValuePtr::encode(result); | 396 return JSValuePtr::encode(result); |
410 } | 397 } |
411 | 398 |
412 JSValueEncodedAsPointer* Interpreter::cti_op_pre_inc(STUB_ARGS) | 399 JSValueEncodedAsPointer* JITStubs::cti_op_pre_inc(STUB_ARGS) |
413 { | 400 { |
414 BEGIN_STUB_FUNCTION(); | 401 BEGIN_STUB_FUNCTION(); |
415 | 402 |
416 JSValuePtr v = ARG_src1; | 403 JSValuePtr v = ARG_src1; |
417 | 404 |
418 CallFrame* callFrame = ARG_callFrame; | 405 CallFrame* callFrame = ARG_callFrame; |
419 JSValuePtr result = jsNumber(ARG_globalData, v.toNumber(callFrame) + 1); | 406 JSValuePtr result = jsNumber(ARG_globalData, v.toNumber(callFrame) + 1); |
420 CHECK_FOR_EXCEPTION_AT_END(); | 407 CHECK_FOR_EXCEPTION_AT_END(); |
421 return JSValuePtr::encode(result); | 408 return JSValuePtr::encode(result); |
422 } | 409 } |
423 | 410 |
424 int Interpreter::cti_timeout_check(STUB_ARGS) | 411 int JITStubs::cti_timeout_check(STUB_ARGS) |
425 { | 412 { |
426 BEGIN_STUB_FUNCTION(); | 413 BEGIN_STUB_FUNCTION(); |
427 Interpreter* interpreter = ARG_globalData->interpreter; | 414 |
| 415 JSGlobalData* globalData = ARG_globalData; |
| 416 TimeoutChecker& timeoutChecker = globalData->timeoutChecker; |
428 | 417 |
429 if (interpreter->checkTimeout(ARG_callFrame->dynamicGlobalObject())) { | 418 if (timeoutChecker.didTimeOut(ARG_callFrame)) { |
430 ARG_globalData->exception = createInterruptedExecutionException(ARG_glob
alData); | 419 globalData->exception = createInterruptedExecutionException(globalData); |
431 VM_THROW_EXCEPTION_AT_END(); | 420 VM_THROW_EXCEPTION_AT_END(); |
432 } | 421 } |
433 | 422 |
434 return interpreter->m_ticksUntilNextTimeoutCheck; | 423 return timeoutChecker.ticksUntilNextCheck(); |
435 } | 424 } |
436 | 425 |
437 void Interpreter::cti_register_file_check(STUB_ARGS) | 426 void JITStubs::cti_register_file_check(STUB_ARGS) |
438 { | 427 { |
439 BEGIN_STUB_FUNCTION(); | 428 BEGIN_STUB_FUNCTION(); |
440 | 429 |
441 if (LIKELY(ARG_registerFile->grow(ARG_callFrame + ARG_callFrame->codeBlock()
->m_numCalleeRegisters))) | 430 if (LIKELY(ARG_registerFile->grow(ARG_callFrame + ARG_callFrame->codeBlock()
->m_numCalleeRegisters))) |
442 return; | 431 return; |
443 | 432 |
444 // Rewind to the previous call frame because op_call already optimistically | 433 // Rewind to the previous call frame because op_call already optimistically |
445 // moved the call frame forward. | 434 // moved the call frame forward. |
446 CallFrame* oldCallFrame = ARG_callFrame->callerFrame(); | 435 CallFrame* oldCallFrame = ARG_callFrame->callerFrame(); |
447 ARG_setCallFrame(oldCallFrame); | 436 ARG_setCallFrame(oldCallFrame); |
448 throwStackOverflowError(oldCallFrame, ARG_globalData, oldCallFrame->returnPC
(), STUB_RETURN_ADDRESS); | 437 throwStackOverflowError(oldCallFrame, ARG_globalData, oldCallFrame->returnPC
(), STUB_RETURN_ADDRESS); |
449 } | 438 } |
450 | 439 |
451 int Interpreter::cti_op_loop_if_less(STUB_ARGS) | 440 int JITStubs::cti_op_loop_if_less(STUB_ARGS) |
452 { | 441 { |
453 BEGIN_STUB_FUNCTION(); | 442 BEGIN_STUB_FUNCTION(); |
454 | 443 |
455 JSValuePtr src1 = ARG_src1; | 444 JSValuePtr src1 = ARG_src1; |
456 JSValuePtr src2 = ARG_src2; | 445 JSValuePtr src2 = ARG_src2; |
457 CallFrame* callFrame = ARG_callFrame; | 446 CallFrame* callFrame = ARG_callFrame; |
458 | 447 |
459 bool result = jsLess(callFrame, src1, src2); | 448 bool result = jsLess(callFrame, src1, src2); |
460 CHECK_FOR_EXCEPTION_AT_END(); | 449 CHECK_FOR_EXCEPTION_AT_END(); |
461 return result; | 450 return result; |
462 } | 451 } |
463 | 452 |
464 int Interpreter::cti_op_loop_if_lesseq(STUB_ARGS) | 453 int JITStubs::cti_op_loop_if_lesseq(STUB_ARGS) |
465 { | 454 { |
466 BEGIN_STUB_FUNCTION(); | 455 BEGIN_STUB_FUNCTION(); |
467 | 456 |
468 JSValuePtr src1 = ARG_src1; | 457 JSValuePtr src1 = ARG_src1; |
469 JSValuePtr src2 = ARG_src2; | 458 JSValuePtr src2 = ARG_src2; |
470 CallFrame* callFrame = ARG_callFrame; | 459 CallFrame* callFrame = ARG_callFrame; |
471 | 460 |
472 bool result = jsLessEq(callFrame, src1, src2); | 461 bool result = jsLessEq(callFrame, src1, src2); |
473 CHECK_FOR_EXCEPTION_AT_END(); | 462 CHECK_FOR_EXCEPTION_AT_END(); |
474 return result; | 463 return result; |
475 } | 464 } |
476 | 465 |
477 JSObject* Interpreter::cti_op_new_object(STUB_ARGS) | 466 JSObject* JITStubs::cti_op_new_object(STUB_ARGS) |
478 { | 467 { |
479 BEGIN_STUB_FUNCTION(); | 468 BEGIN_STUB_FUNCTION(); |
480 | 469 |
481 return constructEmptyObject(ARG_callFrame); | 470 return constructEmptyObject(ARG_callFrame); |
482 } | 471 } |
483 | 472 |
484 void Interpreter::cti_op_put_by_id_generic(STUB_ARGS) | 473 void JITStubs::cti_op_put_by_id_generic(STUB_ARGS) |
485 { | 474 { |
486 BEGIN_STUB_FUNCTION(); | 475 BEGIN_STUB_FUNCTION(); |
487 | 476 |
488 PutPropertySlot slot; | 477 PutPropertySlot slot; |
489 ARG_src1.put(ARG_callFrame, *ARG_id2, ARG_src3, slot); | 478 ARG_src1.put(ARG_callFrame, *ARG_id2, ARG_src3, slot); |
490 CHECK_FOR_EXCEPTION_AT_END(); | 479 CHECK_FOR_EXCEPTION_AT_END(); |
491 } | 480 } |
492 | 481 |
493 JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_generic(STUB_ARGS) | 482 JSValueEncodedAsPointer* JITStubs::cti_op_get_by_id_generic(STUB_ARGS) |
494 { | 483 { |
495 BEGIN_STUB_FUNCTION(); | 484 BEGIN_STUB_FUNCTION(); |
496 | 485 |
497 CallFrame* callFrame = ARG_callFrame; | 486 CallFrame* callFrame = ARG_callFrame; |
498 Identifier& ident = *ARG_id2; | 487 Identifier& ident = *ARG_id2; |
499 | 488 |
500 JSValuePtr baseValue = ARG_src1; | 489 JSValuePtr baseValue = ARG_src1; |
501 PropertySlot slot(baseValue); | 490 PropertySlot slot(baseValue); |
502 JSValuePtr result = baseValue.get(callFrame, ident, slot); | 491 JSValuePtr result = baseValue.get(callFrame, ident, slot); |
503 | 492 |
504 CHECK_FOR_EXCEPTION_AT_END(); | 493 CHECK_FOR_EXCEPTION_AT_END(); |
505 return JSValuePtr::encode(result); | 494 return JSValuePtr::encode(result); |
506 } | 495 } |
507 | 496 |
508 #if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) | 497 #if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) |
509 | 498 |
510 void Interpreter::cti_op_put_by_id(STUB_ARGS) | 499 void JITStubs::cti_op_put_by_id(STUB_ARGS) |
511 { | 500 { |
512 BEGIN_STUB_FUNCTION(); | 501 BEGIN_STUB_FUNCTION(); |
513 | 502 |
514 CallFrame* callFrame = ARG_callFrame; | 503 CallFrame* callFrame = ARG_callFrame; |
515 Identifier& ident = *ARG_id2; | 504 Identifier& ident = *ARG_id2; |
516 | 505 |
517 PutPropertySlot slot; | 506 PutPropertySlot slot; |
518 ARG_src1.put(callFrame, ident, ARG_src3, slot); | 507 ARG_src1.put(callFrame, ident, ARG_src3, slot); |
519 | 508 |
520 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<void*>(cti
_op_put_by_id_second)); | 509 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<void*>(cti
_op_put_by_id_second)); |
521 | 510 |
522 CHECK_FOR_EXCEPTION_AT_END(); | 511 CHECK_FOR_EXCEPTION_AT_END(); |
523 } | 512 } |
524 | 513 |
525 void Interpreter::cti_op_put_by_id_second(STUB_ARGS) | 514 void JITStubs::cti_op_put_by_id_second(STUB_ARGS) |
526 { | 515 { |
527 BEGIN_STUB_FUNCTION(); | 516 BEGIN_STUB_FUNCTION(); |
528 | 517 |
529 PutPropertySlot slot; | 518 PutPropertySlot slot; |
530 ARG_src1.put(ARG_callFrame, *ARG_id2, ARG_src3, slot); | 519 ARG_src1.put(ARG_callFrame, *ARG_id2, ARG_src3, slot); |
531 ARG_globalData->interpreter->tryCTICachePutByID(ARG_callFrame, ARG_callFrame
->codeBlock(), STUB_RETURN_ADDRESS, ARG_src1, slot); | 520 tryCachePutByID(ARG_callFrame, ARG_callFrame->codeBlock(), STUB_RETURN_ADDRE
SS, ARG_src1, slot); |
532 CHECK_FOR_EXCEPTION_AT_END(); | 521 CHECK_FOR_EXCEPTION_AT_END(); |
533 } | 522 } |
534 | 523 |
535 void Interpreter::cti_op_put_by_id_fail(STUB_ARGS) | 524 void JITStubs::cti_op_put_by_id_fail(STUB_ARGS) |
536 { | 525 { |
537 BEGIN_STUB_FUNCTION(); | 526 BEGIN_STUB_FUNCTION(); |
538 | 527 |
539 CallFrame* callFrame = ARG_callFrame; | 528 CallFrame* callFrame = ARG_callFrame; |
540 Identifier& ident = *ARG_id2; | 529 Identifier& ident = *ARG_id2; |
541 | 530 |
542 PutPropertySlot slot; | 531 PutPropertySlot slot; |
543 ARG_src1.put(callFrame, ident, ARG_src3, slot); | 532 ARG_src1.put(callFrame, ident, ARG_src3, slot); |
544 | 533 |
545 CHECK_FOR_EXCEPTION_AT_END(); | 534 CHECK_FOR_EXCEPTION_AT_END(); |
546 } | 535 } |
547 | 536 |
548 JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id(STUB_ARGS) | 537 JSValueEncodedAsPointer* JITStubs::cti_op_get_by_id(STUB_ARGS) |
549 { | 538 { |
550 BEGIN_STUB_FUNCTION(); | 539 BEGIN_STUB_FUNCTION(); |
551 | 540 |
552 CallFrame* callFrame = ARG_callFrame; | 541 CallFrame* callFrame = ARG_callFrame; |
553 Identifier& ident = *ARG_id2; | 542 Identifier& ident = *ARG_id2; |
554 | 543 |
555 JSValuePtr baseValue = ARG_src1; | 544 JSValuePtr baseValue = ARG_src1; |
556 PropertySlot slot(baseValue); | 545 PropertySlot slot(baseValue); |
557 JSValuePtr result = baseValue.get(callFrame, ident, slot); | 546 JSValuePtr result = baseValue.get(callFrame, ident, slot); |
558 | 547 |
559 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<void*>(cti
_op_get_by_id_second)); | 548 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<void*>(cti
_op_get_by_id_second)); |
560 | 549 |
561 CHECK_FOR_EXCEPTION_AT_END(); | 550 CHECK_FOR_EXCEPTION_AT_END(); |
562 return JSValuePtr::encode(result); | 551 return JSValuePtr::encode(result); |
563 } | 552 } |
564 | 553 |
565 JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_second(STUB_ARGS) | 554 JSValueEncodedAsPointer* JITStubs::cti_op_get_by_id_second(STUB_ARGS) |
566 { | 555 { |
567 BEGIN_STUB_FUNCTION(); | 556 BEGIN_STUB_FUNCTION(); |
568 | 557 |
569 CallFrame* callFrame = ARG_callFrame; | 558 CallFrame* callFrame = ARG_callFrame; |
570 Identifier& ident = *ARG_id2; | 559 Identifier& ident = *ARG_id2; |
571 | 560 |
572 JSValuePtr baseValue = ARG_src1; | 561 JSValuePtr baseValue = ARG_src1; |
573 PropertySlot slot(baseValue); | 562 PropertySlot slot(baseValue); |
574 JSValuePtr result = baseValue.get(callFrame, ident, slot); | 563 JSValuePtr result = baseValue.get(callFrame, ident, slot); |
575 | 564 |
576 ARG_globalData->interpreter->tryCTICacheGetByID(callFrame, callFrame->codeBl
ock(), STUB_RETURN_ADDRESS, baseValue, ident, slot); | 565 tryCacheGetByID(callFrame, callFrame->codeBlock(), STUB_RETURN_ADDRESS, base
Value, ident, slot); |
577 | 566 |
578 CHECK_FOR_EXCEPTION_AT_END(); | 567 CHECK_FOR_EXCEPTION_AT_END(); |
579 return JSValuePtr::encode(result); | 568 return JSValuePtr::encode(result); |
580 } | 569 } |
581 | 570 |
582 JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_self_fail(STUB_ARGS) | 571 JSValueEncodedAsPointer* JITStubs::cti_op_get_by_id_self_fail(STUB_ARGS) |
583 { | 572 { |
584 BEGIN_STUB_FUNCTION(); | 573 BEGIN_STUB_FUNCTION(); |
585 | 574 |
586 CallFrame* callFrame = ARG_callFrame; | 575 CallFrame* callFrame = ARG_callFrame; |
587 Identifier& ident = *ARG_id2; | 576 Identifier& ident = *ARG_id2; |
588 | 577 |
589 JSValuePtr baseValue = ARG_src1; | 578 JSValuePtr baseValue = ARG_src1; |
590 PropertySlot slot(baseValue); | 579 PropertySlot slot(baseValue); |
591 JSValuePtr result = baseValue.get(callFrame, ident, slot); | 580 JSValuePtr result = baseValue.get(callFrame, ident, slot); |
592 | 581 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 stubInfo->u.getByIdProtoList.listSize++; | 636 stubInfo->u.getByIdProtoList.listSize++; |
648 break; | 637 break; |
649 default: | 638 default: |
650 ASSERT_NOT_REACHED(); | 639 ASSERT_NOT_REACHED(); |
651 } | 640 } |
652 | 641 |
653 ASSERT(listIndex < POLYMORPHIC_LIST_CACHE_SIZE); | 642 ASSERT(listIndex < POLYMORPHIC_LIST_CACHE_SIZE); |
654 return prototypeStructureList; | 643 return prototypeStructureList; |
655 } | 644 } |
656 | 645 |
657 JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_proto_list(STUB_ARGS) | 646 JSValueEncodedAsPointer* JITStubs::cti_op_get_by_id_proto_list(STUB_ARGS) |
658 { | 647 { |
659 BEGIN_STUB_FUNCTION(); | 648 BEGIN_STUB_FUNCTION(); |
660 | 649 |
661 CallFrame* callFrame = ARG_callFrame; | 650 CallFrame* callFrame = ARG_callFrame; |
662 | 651 |
663 JSValuePtr baseValue = ARG_src1; | 652 JSValuePtr baseValue = ARG_src1; |
664 PropertySlot slot(baseValue); | 653 PropertySlot slot(baseValue); |
665 JSValuePtr result = baseValue.get(callFrame, *ARG_id2, slot); | 654 JSValuePtr result = baseValue.get(callFrame, *ARG_id2, slot); |
666 | 655 |
667 CHECK_FOR_EXCEPTION(); | 656 CHECK_FOR_EXCEPTION(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 JIT::compileGetByIdChainList(callFrame->scopeChain()->globalData, callFr
ame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, chain, c
ount, slot.cachedOffset()); | 697 JIT::compileGetByIdChainList(callFrame->scopeChain()->globalData, callFr
ame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, chain, c
ount, slot.cachedOffset()); |
709 | 698 |
710 if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) | 699 if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) |
711 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<vo
id*>(cti_op_get_by_id_proto_list_full)); | 700 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<vo
id*>(cti_op_get_by_id_proto_list_full)); |
712 } else | 701 } else |
713 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<void*>
(cti_op_get_by_id_proto_fail)); | 702 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<void*>
(cti_op_get_by_id_proto_fail)); |
714 | 703 |
715 return JSValuePtr::encode(result); | 704 return JSValuePtr::encode(result); |
716 } | 705 } |
717 | 706 |
718 JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_proto_list_full(STUB_ARGS
) | 707 JSValueEncodedAsPointer* JITStubs::cti_op_get_by_id_proto_list_full(STUB_ARGS) |
719 { | 708 { |
720 BEGIN_STUB_FUNCTION(); | 709 BEGIN_STUB_FUNCTION(); |
721 | 710 |
722 JSValuePtr baseValue = ARG_src1; | 711 JSValuePtr baseValue = ARG_src1; |
723 PropertySlot slot(baseValue); | 712 PropertySlot slot(baseValue); |
724 JSValuePtr result = baseValue.get(ARG_callFrame, *ARG_id2, slot); | 713 JSValuePtr result = baseValue.get(ARG_callFrame, *ARG_id2, slot); |
725 | 714 |
726 CHECK_FOR_EXCEPTION_AT_END(); | 715 CHECK_FOR_EXCEPTION_AT_END(); |
727 return JSValuePtr::encode(result); | 716 return JSValuePtr::encode(result); |
728 } | 717 } |
729 | 718 |
730 JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_proto_fail(STUB_ARGS) | 719 JSValueEncodedAsPointer* JITStubs::cti_op_get_by_id_proto_fail(STUB_ARGS) |
731 { | 720 { |
732 BEGIN_STUB_FUNCTION(); | 721 BEGIN_STUB_FUNCTION(); |
733 | 722 |
734 JSValuePtr baseValue = ARG_src1; | 723 JSValuePtr baseValue = ARG_src1; |
735 PropertySlot slot(baseValue); | 724 PropertySlot slot(baseValue); |
736 JSValuePtr result = baseValue.get(ARG_callFrame, *ARG_id2, slot); | 725 JSValuePtr result = baseValue.get(ARG_callFrame, *ARG_id2, slot); |
737 | 726 |
738 CHECK_FOR_EXCEPTION_AT_END(); | 727 CHECK_FOR_EXCEPTION_AT_END(); |
739 return JSValuePtr::encode(result); | 728 return JSValuePtr::encode(result); |
740 } | 729 } |
741 | 730 |
742 JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_array_fail(STUB_ARGS) | 731 JSValueEncodedAsPointer* JITStubs::cti_op_get_by_id_array_fail(STUB_ARGS) |
743 { | 732 { |
744 BEGIN_STUB_FUNCTION(); | 733 BEGIN_STUB_FUNCTION(); |
745 | 734 |
746 JSValuePtr baseValue = ARG_src1; | 735 JSValuePtr baseValue = ARG_src1; |
747 PropertySlot slot(baseValue); | 736 PropertySlot slot(baseValue); |
748 JSValuePtr result = baseValue.get(ARG_callFrame, *ARG_id2, slot); | 737 JSValuePtr result = baseValue.get(ARG_callFrame, *ARG_id2, slot); |
749 | 738 |
750 CHECK_FOR_EXCEPTION_AT_END(); | 739 CHECK_FOR_EXCEPTION_AT_END(); |
751 return JSValuePtr::encode(result); | 740 return JSValuePtr::encode(result); |
752 } | 741 } |
753 | 742 |
754 JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_string_fail(STUB_ARGS) | 743 JSValueEncodedAsPointer* JITStubs::cti_op_get_by_id_string_fail(STUB_ARGS) |
755 { | 744 { |
756 BEGIN_STUB_FUNCTION(); | 745 BEGIN_STUB_FUNCTION(); |
757 | 746 |
758 JSValuePtr baseValue = ARG_src1; | 747 JSValuePtr baseValue = ARG_src1; |
759 PropertySlot slot(baseValue); | 748 PropertySlot slot(baseValue); |
760 JSValuePtr result = baseValue.get(ARG_callFrame, *ARG_id2, slot); | 749 JSValuePtr result = baseValue.get(ARG_callFrame, *ARG_id2, slot); |
761 | 750 |
762 CHECK_FOR_EXCEPTION_AT_END(); | 751 CHECK_FOR_EXCEPTION_AT_END(); |
763 return JSValuePtr::encode(result); | 752 return JSValuePtr::encode(result); |
764 } | 753 } |
765 | 754 |
766 #endif | 755 #endif |
767 | 756 |
768 JSValueEncodedAsPointer* Interpreter::cti_op_instanceof(STUB_ARGS) | 757 JSValueEncodedAsPointer* JITStubs::cti_op_instanceof(STUB_ARGS) |
769 { | 758 { |
770 BEGIN_STUB_FUNCTION(); | 759 BEGIN_STUB_FUNCTION(); |
771 | 760 |
772 CallFrame* callFrame = ARG_callFrame; | 761 CallFrame* callFrame = ARG_callFrame; |
773 JSValuePtr value = ARG_src1; | 762 JSValuePtr value = ARG_src1; |
774 JSValuePtr baseVal = ARG_src2; | 763 JSValuePtr baseVal = ARG_src2; |
775 JSValuePtr proto = ARG_src3; | 764 JSValuePtr proto = ARG_src3; |
776 | 765 |
777 // at least one of these checks must have failed to get to the slow case | 766 // at least one of these checks must have failed to get to the slow case |
778 ASSERT(!value.isCell() || !baseVal.isCell() || !proto.isCell() | 767 ASSERT(!value.isCell() || !baseVal.isCell() || !proto.isCell() |
(...skipping 18 matching lines...) Expand all Loading... |
797 | 786 |
798 if (!value.isObject()) | 787 if (!value.isObject()) |
799 return JSValuePtr::encode(jsBoolean(false)); | 788 return JSValuePtr::encode(jsBoolean(false)); |
800 | 789 |
801 JSValuePtr result = jsBoolean(asObject(baseVal)->hasInstance(callFrame, valu
e, proto)); | 790 JSValuePtr result = jsBoolean(asObject(baseVal)->hasInstance(callFrame, valu
e, proto)); |
802 CHECK_FOR_EXCEPTION_AT_END(); | 791 CHECK_FOR_EXCEPTION_AT_END(); |
803 | 792 |
804 return JSValuePtr::encode(result); | 793 return JSValuePtr::encode(result); |
805 } | 794 } |
806 | 795 |
807 JSValueEncodedAsPointer* Interpreter::cti_op_del_by_id(STUB_ARGS) | 796 JSValueEncodedAsPointer* JITStubs::cti_op_del_by_id(STUB_ARGS) |
808 { | 797 { |
809 BEGIN_STUB_FUNCTION(); | 798 BEGIN_STUB_FUNCTION(); |
810 | 799 |
811 CallFrame* callFrame = ARG_callFrame; | 800 CallFrame* callFrame = ARG_callFrame; |
812 | 801 |
813 JSObject* baseObj = ARG_src1.toObject(callFrame); | 802 JSObject* baseObj = ARG_src1.toObject(callFrame); |
814 | 803 |
815 JSValuePtr result = jsBoolean(baseObj->deleteProperty(callFrame, *ARG_id2)); | 804 JSValuePtr result = jsBoolean(baseObj->deleteProperty(callFrame, *ARG_id2)); |
816 CHECK_FOR_EXCEPTION_AT_END(); | 805 CHECK_FOR_EXCEPTION_AT_END(); |
817 return JSValuePtr::encode(result); | 806 return JSValuePtr::encode(result); |
818 } | 807 } |
819 | 808 |
820 JSValueEncodedAsPointer* Interpreter::cti_op_mul(STUB_ARGS) | 809 JSValueEncodedAsPointer* JITStubs::cti_op_mul(STUB_ARGS) |
821 { | 810 { |
822 BEGIN_STUB_FUNCTION(); | 811 BEGIN_STUB_FUNCTION(); |
823 | 812 |
824 JSValuePtr src1 = ARG_src1; | 813 JSValuePtr src1 = ARG_src1; |
825 JSValuePtr src2 = ARG_src2; | 814 JSValuePtr src2 = ARG_src2; |
826 | 815 |
827 double left; | 816 double left; |
828 double right; | 817 double right; |
829 if (src1.getNumber(left) && src2.getNumber(right)) | 818 if (src1.getNumber(left) && src2.getNumber(right)) |
830 return JSValuePtr::encode(jsNumber(ARG_globalData, left * right)); | 819 return JSValuePtr::encode(jsNumber(ARG_globalData, left * right)); |
831 | 820 |
832 CallFrame* callFrame = ARG_callFrame; | 821 CallFrame* callFrame = ARG_callFrame; |
833 JSValuePtr result = jsNumber(ARG_globalData, src1.toNumber(callFrame) * src2
.toNumber(callFrame)); | 822 JSValuePtr result = jsNumber(ARG_globalData, src1.toNumber(callFrame) * src2
.toNumber(callFrame)); |
834 CHECK_FOR_EXCEPTION_AT_END(); | 823 CHECK_FOR_EXCEPTION_AT_END(); |
835 return JSValuePtr::encode(result); | 824 return JSValuePtr::encode(result); |
836 } | 825 } |
837 | 826 |
838 JSObject* Interpreter::cti_op_new_func(STUB_ARGS) | 827 JSObject* JITStubs::cti_op_new_func(STUB_ARGS) |
839 { | 828 { |
840 BEGIN_STUB_FUNCTION(); | 829 BEGIN_STUB_FUNCTION(); |
841 | 830 |
842 return ARG_func1->makeFunction(ARG_callFrame, ARG_callFrame->scopeChain()); | 831 return ARG_func1->makeFunction(ARG_callFrame, ARG_callFrame->scopeChain()); |
843 } | 832 } |
844 | 833 |
845 void* Interpreter::cti_op_call_JSFunction(STUB_ARGS) | 834 void* JITStubs::cti_op_call_JSFunction(STUB_ARGS) |
846 { | 835 { |
847 BEGIN_STUB_FUNCTION(); | 836 BEGIN_STUB_FUNCTION(); |
848 | 837 |
849 #ifndef NDEBUG | 838 #ifndef NDEBUG |
850 CallData callData; | 839 CallData callData; |
851 ASSERT(ARG_src1.getCallData(callData) == CallTypeJS); | 840 ASSERT(ARG_src1.getCallData(callData) == CallTypeJS); |
852 #endif | 841 #endif |
853 | 842 |
854 ScopeChainNode* callDataScopeChain = asFunction(ARG_src1)->m_scopeChain.node
(); | 843 ScopeChainNode* callDataScopeChain = asFunction(ARG_src1)->scope().node(); |
855 CodeBlock* newCodeBlock = &asFunction(ARG_src1)->body()->bytecode(callDataSc
opeChain); | 844 CodeBlock* newCodeBlock = &asFunction(ARG_src1)->body()->bytecode(callDataSc
opeChain); |
856 | 845 |
857 if (!newCodeBlock->jitCode()) | 846 if (!newCodeBlock->jitCode()) |
858 JIT::compile(ARG_globalData, newCodeBlock); | 847 JIT::compile(ARG_globalData, newCodeBlock); |
859 | 848 |
860 return newCodeBlock; | 849 return newCodeBlock; |
861 } | 850 } |
862 | 851 |
863 VoidPtrPair Interpreter::cti_op_call_arityCheck(STUB_ARGS) | 852 VoidPtrPair JITStubs::cti_op_call_arityCheck(STUB_ARGS) |
864 { | 853 { |
865 BEGIN_STUB_FUNCTION(); | 854 BEGIN_STUB_FUNCTION(); |
866 | 855 |
867 CallFrame* callFrame = ARG_callFrame; | 856 CallFrame* callFrame = ARG_callFrame; |
868 CodeBlock* newCodeBlock = ARG_codeBlock4; | 857 CodeBlock* newCodeBlock = ARG_codeBlock4; |
869 int argCount = ARG_int3; | 858 int argCount = ARG_int3; |
870 | 859 |
871 ASSERT(argCount != newCodeBlock->m_numParameters); | 860 ASSERT(argCount != newCodeBlock->m_numParameters); |
872 | 861 |
873 CallFrame* oldCallFrame = callFrame->callerFrame(); | 862 CallFrame* oldCallFrame = callFrame->callerFrame(); |
(...skipping 24 matching lines...) Expand all Loading... |
898 for (size_t i = 0; i < omittedArgCount; ++i) | 887 for (size_t i = 0; i < omittedArgCount; ++i) |
899 argv[i] = jsUndefined(); | 888 argv[i] = jsUndefined(); |
900 | 889 |
901 callFrame = CallFrame::create(r); | 890 callFrame = CallFrame::create(r); |
902 callFrame->setCallerFrame(oldCallFrame); | 891 callFrame->setCallerFrame(oldCallFrame); |
903 } | 892 } |
904 | 893 |
905 RETURN_PAIR(newCodeBlock, callFrame); | 894 RETURN_PAIR(newCodeBlock, callFrame); |
906 } | 895 } |
907 | 896 |
908 void* Interpreter::cti_vm_dontLazyLinkCall(STUB_ARGS) | 897 void* JITStubs::cti_vm_dontLazyLinkCall(STUB_ARGS) |
| 898 { |
| 899 BEGIN_STUB_FUNCTION(); |
| 900 |
| 901 JSGlobalData* globalData = ARG_globalData; |
| 902 JSFunction* callee = asFunction(ARG_src1); |
| 903 CodeBlock* codeBlock = &callee->body()->bytecode(callee->scope().node()); |
| 904 if (!codeBlock->jitCode()) |
| 905 JIT::compile(globalData, codeBlock); |
| 906 |
| 907 ctiPatchNearCallByReturnAddress(ARG_returnAddress2, globalData->jitStubs.cti
VirtualCallLink()); |
| 908 |
| 909 return codeBlock->jitCode().addressForCall(); |
| 910 } |
| 911 |
| 912 void* JITStubs::cti_vm_lazyLinkCall(STUB_ARGS) |
909 { | 913 { |
910 BEGIN_STUB_FUNCTION(); | 914 BEGIN_STUB_FUNCTION(); |
911 | 915 |
912 JSFunction* callee = asFunction(ARG_src1); | 916 JSFunction* callee = asFunction(ARG_src1); |
913 CodeBlock* codeBlock = &callee->body()->bytecode(callee->m_scopeChain.node()
); | 917 CodeBlock* codeBlock = &callee->body()->bytecode(callee->scope().node()); |
914 if (!codeBlock->jitCode()) | 918 if (!codeBlock->jitCode()) |
915 JIT::compile(ARG_globalData, codeBlock); | 919 JIT::compile(ARG_globalData, codeBlock); |
916 | 920 |
917 ctiPatchNearCallByReturnAddress(ARG_returnAddress2, ARG_globalData->interpre
ter->m_ctiVirtualCallLink); | |
918 | |
919 return codeBlock->jitCode().addressForCall(); | |
920 } | |
921 | |
922 void* Interpreter::cti_vm_lazyLinkCall(STUB_ARGS) | |
923 { | |
924 BEGIN_STUB_FUNCTION(); | |
925 | |
926 JSFunction* callee = asFunction(ARG_src1); | |
927 CodeBlock* codeBlock = &callee->body()->bytecode(callee->m_scopeChain.node()
); | |
928 if (!codeBlock->jitCode()) | |
929 JIT::compile(ARG_globalData, codeBlock); | |
930 | |
931 CallLinkInfo* callLinkInfo = &ARG_callFrame->callerFrame()->codeBlock()->get
CallLinkInfo(ARG_returnAddress2); | 921 CallLinkInfo* callLinkInfo = &ARG_callFrame->callerFrame()->codeBlock()->get
CallLinkInfo(ARG_returnAddress2); |
932 JIT::linkCall(callee, codeBlock, codeBlock->jitCode(), callLinkInfo, ARG_int
3); | 922 JIT::linkCall(callee, codeBlock, codeBlock->jitCode(), callLinkInfo, ARG_int
3); |
933 | 923 |
934 return codeBlock->jitCode().addressForCall(); | 924 return codeBlock->jitCode().addressForCall(); |
935 } | 925 } |
936 | 926 |
937 JSObject* Interpreter::cti_op_push_activation(STUB_ARGS) | 927 JSObject* JITStubs::cti_op_push_activation(STUB_ARGS) |
938 { | 928 { |
939 BEGIN_STUB_FUNCTION(); | 929 BEGIN_STUB_FUNCTION(); |
940 | 930 |
941 JSActivation* activation = new (ARG_globalData) JSActivation(ARG_callFrame,
static_cast<FunctionBodyNode*>(ARG_callFrame->codeBlock()->ownerNode())); | 931 JSActivation* activation = new (ARG_globalData) JSActivation(ARG_callFrame,
static_cast<FunctionBodyNode*>(ARG_callFrame->codeBlock()->ownerNode())); |
942 ARG_callFrame->setScopeChain(ARG_callFrame->scopeChain()->copy()->push(activ
ation)); | 932 ARG_callFrame->setScopeChain(ARG_callFrame->scopeChain()->copy()->push(activ
ation)); |
943 return activation; | 933 return activation; |
944 } | 934 } |
945 | 935 |
946 JSValueEncodedAsPointer* Interpreter::cti_op_call_NotJSFunction(STUB_ARGS) | 936 JSValueEncodedAsPointer* JITStubs::cti_op_call_NotJSFunction(STUB_ARGS) |
947 { | 937 { |
948 BEGIN_STUB_FUNCTION(); | 938 BEGIN_STUB_FUNCTION(); |
949 | 939 |
950 JSValuePtr funcVal = ARG_src1; | 940 JSValuePtr funcVal = ARG_src1; |
951 | 941 |
952 CallData callData; | 942 CallData callData; |
953 CallType callType = funcVal.getCallData(callData); | 943 CallType callType = funcVal.getCallData(callData); |
954 | 944 |
955 ASSERT(callType != CallTypeJS); | 945 ASSERT(callType != CallTypeJS); |
956 | 946 |
(...skipping 28 matching lines...) Expand all Loading... |
985 | 975 |
986 ASSERT(callType == CallTypeNone); | 976 ASSERT(callType == CallTypeNone); |
987 | 977 |
988 CallFrame* callFrame = ARG_callFrame; | 978 CallFrame* callFrame = ARG_callFrame; |
989 CodeBlock* codeBlock = callFrame->codeBlock(); | 979 CodeBlock* codeBlock = callFrame->codeBlock(); |
990 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); | 980 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); |
991 ARG_globalData->exception = createNotAFunctionError(ARG_callFrame, funcVal,
vPCIndex, codeBlock); | 981 ARG_globalData->exception = createNotAFunctionError(ARG_callFrame, funcVal,
vPCIndex, codeBlock); |
992 VM_THROW_EXCEPTION(); | 982 VM_THROW_EXCEPTION(); |
993 } | 983 } |
994 | 984 |
995 void Interpreter::cti_op_create_arguments(STUB_ARGS) | 985 void JITStubs::cti_op_create_arguments(STUB_ARGS) |
996 { | 986 { |
997 BEGIN_STUB_FUNCTION(); | 987 BEGIN_STUB_FUNCTION(); |
998 | 988 |
999 Arguments* arguments = new (ARG_globalData) Arguments(ARG_callFrame); | 989 Arguments* arguments = new (ARG_globalData) Arguments(ARG_callFrame); |
1000 ARG_callFrame->setCalleeArguments(arguments); | 990 ARG_callFrame->setCalleeArguments(arguments); |
1001 ARG_callFrame[RegisterFile::ArgumentsRegister] = arguments; | 991 ARG_callFrame[RegisterFile::ArgumentsRegister] = arguments; |
1002 } | 992 } |
1003 | 993 |
1004 void Interpreter::cti_op_create_arguments_no_params(STUB_ARGS) | 994 void JITStubs::cti_op_create_arguments_no_params(STUB_ARGS) |
1005 { | 995 { |
1006 BEGIN_STUB_FUNCTION(); | 996 BEGIN_STUB_FUNCTION(); |
1007 | 997 |
1008 Arguments* arguments = new (ARG_globalData) Arguments(ARG_callFrame, Argumen
ts::NoParameters); | 998 Arguments* arguments = new (ARG_globalData) Arguments(ARG_callFrame, Argumen
ts::NoParameters); |
1009 ARG_callFrame->setCalleeArguments(arguments); | 999 ARG_callFrame->setCalleeArguments(arguments); |
1010 ARG_callFrame[RegisterFile::ArgumentsRegister] = arguments; | 1000 ARG_callFrame[RegisterFile::ArgumentsRegister] = arguments; |
1011 } | 1001 } |
1012 | 1002 |
1013 void Interpreter::cti_op_tear_off_activation(STUB_ARGS) | 1003 void JITStubs::cti_op_tear_off_activation(STUB_ARGS) |
1014 { | 1004 { |
1015 BEGIN_STUB_FUNCTION(); | 1005 BEGIN_STUB_FUNCTION(); |
1016 | 1006 |
1017 ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain()); | 1007 ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain()); |
1018 asActivation(ARG_src1)->copyRegisters(ARG_callFrame->optionalCalleeArguments
()); | 1008 asActivation(ARG_src1)->copyRegisters(ARG_callFrame->optionalCalleeArguments
()); |
1019 } | 1009 } |
1020 | 1010 |
1021 void Interpreter::cti_op_tear_off_arguments(STUB_ARGS) | 1011 void JITStubs::cti_op_tear_off_arguments(STUB_ARGS) |
1022 { | 1012 { |
1023 BEGIN_STUB_FUNCTION(); | 1013 BEGIN_STUB_FUNCTION(); |
1024 | 1014 |
1025 ASSERT(ARG_callFrame->codeBlock()->usesArguments() && !ARG_callFrame->codeBl
ock()->needsFullScopeChain()); | 1015 ASSERT(ARG_callFrame->codeBlock()->usesArguments() && !ARG_callFrame->codeBl
ock()->needsFullScopeChain()); |
1026 ARG_callFrame->optionalCalleeArguments()->copyRegisters(); | 1016 ARG_callFrame->optionalCalleeArguments()->copyRegisters(); |
1027 } | 1017 } |
1028 | 1018 |
1029 void Interpreter::cti_op_profile_will_call(STUB_ARGS) | 1019 void JITStubs::cti_op_profile_will_call(STUB_ARGS) |
1030 { | 1020 { |
1031 BEGIN_STUB_FUNCTION(); | 1021 BEGIN_STUB_FUNCTION(); |
1032 | 1022 |
1033 ASSERT(*ARG_profilerReference); | 1023 ASSERT(*ARG_profilerReference); |
1034 (*ARG_profilerReference)->willExecute(ARG_callFrame, ARG_src1); | 1024 (*ARG_profilerReference)->willExecute(ARG_callFrame, ARG_src1); |
1035 } | 1025 } |
1036 | 1026 |
1037 void Interpreter::cti_op_profile_did_call(STUB_ARGS) | 1027 void JITStubs::cti_op_profile_did_call(STUB_ARGS) |
1038 { | 1028 { |
1039 BEGIN_STUB_FUNCTION(); | 1029 BEGIN_STUB_FUNCTION(); |
1040 | 1030 |
1041 ASSERT(*ARG_profilerReference); | 1031 ASSERT(*ARG_profilerReference); |
1042 (*ARG_profilerReference)->didExecute(ARG_callFrame, ARG_src1); | 1032 (*ARG_profilerReference)->didExecute(ARG_callFrame, ARG_src1); |
1043 } | 1033 } |
1044 | 1034 |
1045 void Interpreter::cti_op_ret_scopeChain(STUB_ARGS) | 1035 void JITStubs::cti_op_ret_scopeChain(STUB_ARGS) |
1046 { | 1036 { |
1047 BEGIN_STUB_FUNCTION(); | 1037 BEGIN_STUB_FUNCTION(); |
1048 | 1038 |
1049 ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain()); | 1039 ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain()); |
1050 ARG_callFrame->scopeChain()->deref(); | 1040 ARG_callFrame->scopeChain()->deref(); |
1051 } | 1041 } |
1052 | 1042 |
1053 JSObject* Interpreter::cti_op_new_array(STUB_ARGS) | 1043 JSObject* JITStubs::cti_op_new_array(STUB_ARGS) |
1054 { | 1044 { |
1055 BEGIN_STUB_FUNCTION(); | 1045 BEGIN_STUB_FUNCTION(); |
1056 | 1046 |
1057 ArgList argList(&ARG_callFrame->registers()[ARG_int1], ARG_int2); | 1047 ArgList argList(&ARG_callFrame->registers()[ARG_int1], ARG_int2); |
1058 return constructArray(ARG_callFrame, argList); | 1048 return constructArray(ARG_callFrame, argList); |
1059 } | 1049 } |
1060 | 1050 |
1061 JSValueEncodedAsPointer* Interpreter::cti_op_resolve(STUB_ARGS) | 1051 JSValueEncodedAsPointer* JITStubs::cti_op_resolve(STUB_ARGS) |
1062 { | 1052 { |
1063 BEGIN_STUB_FUNCTION(); | 1053 BEGIN_STUB_FUNCTION(); |
1064 | 1054 |
1065 CallFrame* callFrame = ARG_callFrame; | 1055 CallFrame* callFrame = ARG_callFrame; |
1066 ScopeChainNode* scopeChain = callFrame->scopeChain(); | 1056 ScopeChainNode* scopeChain = callFrame->scopeChain(); |
1067 | 1057 |
1068 ScopeChainIterator iter = scopeChain->begin(); | 1058 ScopeChainIterator iter = scopeChain->begin(); |
1069 ScopeChainIterator end = scopeChain->end(); | 1059 ScopeChainIterator end = scopeChain->end(); |
1070 ASSERT(iter != end); | 1060 ASSERT(iter != end); |
1071 | 1061 |
1072 Identifier& ident = *ARG_id1; | 1062 Identifier& ident = *ARG_id1; |
1073 do { | 1063 do { |
1074 JSObject* o = *iter; | 1064 JSObject* o = *iter; |
1075 PropertySlot slot(o); | 1065 PropertySlot slot(o); |
1076 if (o->getPropertySlot(callFrame, ident, slot)) { | 1066 if (o->getPropertySlot(callFrame, ident, slot)) { |
1077 JSValuePtr result = slot.getValue(callFrame, ident); | 1067 JSValuePtr result = slot.getValue(callFrame, ident); |
1078 CHECK_FOR_EXCEPTION_AT_END(); | 1068 CHECK_FOR_EXCEPTION_AT_END(); |
1079 return JSValuePtr::encode(result); | 1069 return JSValuePtr::encode(result); |
1080 } | 1070 } |
1081 } while (++iter != end); | 1071 } while (++iter != end); |
1082 | 1072 |
1083 CodeBlock* codeBlock = callFrame->codeBlock(); | 1073 CodeBlock* codeBlock = callFrame->codeBlock(); |
1084 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); | 1074 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); |
1085 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, v
PCIndex, codeBlock); | 1075 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, v
PCIndex, codeBlock); |
1086 VM_THROW_EXCEPTION(); | 1076 VM_THROW_EXCEPTION(); |
1087 } | 1077 } |
1088 | 1078 |
1089 JSObject* Interpreter::cti_op_construct_JSConstruct(STUB_ARGS) | 1079 JSObject* JITStubs::cti_op_construct_JSConstruct(STUB_ARGS) |
1090 { | 1080 { |
1091 BEGIN_STUB_FUNCTION(); | 1081 BEGIN_STUB_FUNCTION(); |
1092 | 1082 |
1093 #ifndef NDEBUG | 1083 #ifndef NDEBUG |
1094 ConstructData constructData; | 1084 ConstructData constructData; |
1095 ASSERT(asFunction(ARG_src1)->getConstructData(constructData) == ConstructTyp
eJS); | 1085 ASSERT(asFunction(ARG_src1)->getConstructData(constructData) == ConstructTyp
eJS); |
1096 #endif | 1086 #endif |
1097 | 1087 |
1098 Structure* structure; | 1088 Structure* structure; |
1099 if (ARG_src4.isObject()) | 1089 if (ARG_src4.isObject()) |
1100 structure = asObject(ARG_src4)->inheritorID(); | 1090 structure = asObject(ARG_src4)->inheritorID(); |
1101 else | 1091 else |
1102 structure = asFunction(ARG_src1)->m_scopeChain.node()->globalObject()->e
mptyObjectStructure(); | 1092 structure = asFunction(ARG_src1)->scope().node()->globalObject()->emptyO
bjectStructure(); |
1103 return new (ARG_globalData) JSObject(structure); | 1093 return new (ARG_globalData) JSObject(structure); |
1104 } | 1094 } |
1105 | 1095 |
1106 JSValueEncodedAsPointer* Interpreter::cti_op_construct_NotJSConstruct(STUB_ARGS) | 1096 JSValueEncodedAsPointer* JITStubs::cti_op_construct_NotJSConstruct(STUB_ARGS) |
1107 { | 1097 { |
1108 BEGIN_STUB_FUNCTION(); | 1098 BEGIN_STUB_FUNCTION(); |
1109 | 1099 |
1110 CallFrame* callFrame = ARG_callFrame; | 1100 CallFrame* callFrame = ARG_callFrame; |
1111 | 1101 |
1112 JSValuePtr constrVal = ARG_src1; | 1102 JSValuePtr constrVal = ARG_src1; |
1113 int argCount = ARG_int3; | 1103 int argCount = ARG_int3; |
1114 int thisRegister = ARG_int5; | 1104 int thisRegister = ARG_int5; |
1115 | 1105 |
1116 ConstructData constructData; | 1106 ConstructData constructData; |
(...skipping 13 matching lines...) Expand all Loading... |
1130 } | 1120 } |
1131 | 1121 |
1132 ASSERT(constructType == ConstructTypeNone); | 1122 ASSERT(constructType == ConstructTypeNone); |
1133 | 1123 |
1134 CodeBlock* codeBlock = callFrame->codeBlock(); | 1124 CodeBlock* codeBlock = callFrame->codeBlock(); |
1135 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); | 1125 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); |
1136 ARG_globalData->exception = createNotAConstructorError(callFrame, constrVal,
vPCIndex, codeBlock); | 1126 ARG_globalData->exception = createNotAConstructorError(callFrame, constrVal,
vPCIndex, codeBlock); |
1137 VM_THROW_EXCEPTION(); | 1127 VM_THROW_EXCEPTION(); |
1138 } | 1128 } |
1139 | 1129 |
1140 JSValueEncodedAsPointer* Interpreter::cti_op_get_by_val(STUB_ARGS) | 1130 JSValueEncodedAsPointer* JITStubs::cti_op_get_by_val(STUB_ARGS) |
1141 { | 1131 { |
1142 BEGIN_STUB_FUNCTION(); | 1132 BEGIN_STUB_FUNCTION(); |
1143 | 1133 |
1144 CallFrame* callFrame = ARG_callFrame; | 1134 CallFrame* callFrame = ARG_callFrame; |
1145 Interpreter* interpreter = ARG_globalData->interpreter; | 1135 JSGlobalData* globalData = ARG_globalData; |
1146 | 1136 |
1147 JSValuePtr baseValue = ARG_src1; | 1137 JSValuePtr baseValue = ARG_src1; |
1148 JSValuePtr subscript = ARG_src2; | 1138 JSValuePtr subscript = ARG_src2; |
1149 | 1139 |
1150 JSValuePtr result; | 1140 JSValuePtr result; |
1151 | 1141 |
1152 if (LIKELY(subscript.isUInt32Fast())) { | 1142 if (LIKELY(subscript.isUInt32Fast())) { |
1153 uint32_t i = subscript.getUInt32Fast(); | 1143 uint32_t i = subscript.getUInt32Fast(); |
1154 if (interpreter->isJSArray(baseValue)) { | 1144 if (isJSArray(globalData, baseValue)) { |
1155 JSArray* jsArray = asArray(baseValue); | 1145 JSArray* jsArray = asArray(baseValue); |
1156 if (jsArray->canGetIndex(i)) | 1146 if (jsArray->canGetIndex(i)) |
1157 result = jsArray->getIndex(i); | 1147 result = jsArray->getIndex(i); |
1158 else | 1148 else |
1159 result = jsArray->JSArray::get(callFrame, i); | 1149 result = jsArray->JSArray::get(callFrame, i); |
1160 } else if (interpreter->isJSString(baseValue) && asString(baseValue)->ca
nGetIndex(i)) | 1150 } else if (isJSString(globalData, baseValue) && asString(baseValue)->can
GetIndex(i)) |
1161 result = asString(baseValue)->getIndex(ARG_globalData, i); | 1151 result = asString(baseValue)->getIndex(ARG_globalData, i); |
1162 else if (interpreter->isJSByteArray(baseValue) && asByteArray(baseValue)
->canAccessIndex(i)) { | 1152 else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)-
>canAccessIndex(i)) { |
1163 // All fast byte array accesses are safe from exceptions so return i
mmediately to avoid exception checks. | 1153 // All fast byte array accesses are safe from exceptions so return i
mmediately to avoid exception checks. |
1164 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<vo
id*>(cti_op_get_by_val_byte_array)); | 1154 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<vo
id*>(cti_op_get_by_val_byte_array)); |
1165 return JSValuePtr::encode(asByteArray(baseValue)->getIndex(callFrame
, i)); | 1155 return JSValuePtr::encode(asByteArray(baseValue)->getIndex(callFrame
, i)); |
1166 } else | 1156 } else |
1167 result = baseValue.get(callFrame, i); | 1157 result = baseValue.get(callFrame, i); |
1168 } else { | 1158 } else { |
1169 Identifier property(callFrame, subscript.toString(callFrame)); | 1159 Identifier property(callFrame, subscript.toString(callFrame)); |
1170 result = baseValue.get(callFrame, property); | 1160 result = baseValue.get(callFrame, property); |
1171 } | 1161 } |
1172 | 1162 |
1173 CHECK_FOR_EXCEPTION_AT_END(); | 1163 CHECK_FOR_EXCEPTION_AT_END(); |
1174 return JSValuePtr::encode(result); | 1164 return JSValuePtr::encode(result); |
1175 } | 1165 } |
1176 | 1166 |
1177 JSValueEncodedAsPointer* Interpreter::cti_op_get_by_val_byte_array(STUB_ARGS) | 1167 JSValueEncodedAsPointer* JITStubs::cti_op_get_by_val_byte_array(STUB_ARGS) |
1178 { | 1168 { |
1179 BEGIN_STUB_FUNCTION(); | 1169 BEGIN_STUB_FUNCTION(); |
1180 | 1170 |
1181 CallFrame* callFrame = ARG_callFrame; | 1171 CallFrame* callFrame = ARG_callFrame; |
1182 Interpreter* interpreter = ARG_globalData->interpreter; | 1172 JSGlobalData* globalData = ARG_globalData; |
1183 | 1173 |
1184 JSValuePtr baseValue = ARG_src1; | 1174 JSValuePtr baseValue = ARG_src1; |
1185 JSValuePtr subscript = ARG_src2; | 1175 JSValuePtr subscript = ARG_src2; |
1186 | 1176 |
1187 JSValuePtr result; | 1177 JSValuePtr result; |
1188 | 1178 |
1189 if (LIKELY(subscript.isUInt32Fast())) { | 1179 if (LIKELY(subscript.isUInt32Fast())) { |
1190 uint32_t i = subscript.getUInt32Fast(); | 1180 uint32_t i = subscript.getUInt32Fast(); |
1191 if (interpreter->isJSByteArray(baseValue) && asByteArray(baseValue)->can
AccessIndex(i)) { | 1181 if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canA
ccessIndex(i)) { |
1192 // All fast byte array accesses are safe from exceptions so return i
mmediately to avoid exception checks. | 1182 // All fast byte array accesses are safe from exceptions so return i
mmediately to avoid exception checks. |
1193 return JSValuePtr::encode(asByteArray(baseValue)->getIndex(callFrame
, i)); | 1183 return JSValuePtr::encode(asByteArray(baseValue)->getIndex(callFrame
, i)); |
1194 } | 1184 } |
1195 | 1185 |
1196 result = baseValue.get(callFrame, i); | 1186 result = baseValue.get(callFrame, i); |
1197 if (!interpreter->isJSByteArray(baseValue)) | 1187 if (!isJSByteArray(globalData, baseValue)) |
1198 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<vo
id*>(cti_op_get_by_val)); | 1188 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<vo
id*>(cti_op_get_by_val)); |
1199 } else { | 1189 } else { |
1200 Identifier property(callFrame, subscript.toString(callFrame)); | 1190 Identifier property(callFrame, subscript.toString(callFrame)); |
1201 result = baseValue.get(callFrame, property); | 1191 result = baseValue.get(callFrame, property); |
1202 } | 1192 } |
1203 | 1193 |
1204 CHECK_FOR_EXCEPTION_AT_END(); | 1194 CHECK_FOR_EXCEPTION_AT_END(); |
1205 return JSValuePtr::encode(result); | 1195 return JSValuePtr::encode(result); |
1206 } | 1196 } |
1207 | 1197 |
1208 VoidPtrPair Interpreter::cti_op_resolve_func(STUB_ARGS) | 1198 VoidPtrPair JITStubs::cti_op_resolve_func(STUB_ARGS) |
1209 { | 1199 { |
1210 BEGIN_STUB_FUNCTION(); | 1200 BEGIN_STUB_FUNCTION(); |
1211 | 1201 |
1212 CallFrame* callFrame = ARG_callFrame; | 1202 CallFrame* callFrame = ARG_callFrame; |
1213 ScopeChainNode* scopeChain = callFrame->scopeChain(); | 1203 ScopeChainNode* scopeChain = callFrame->scopeChain(); |
1214 | 1204 |
1215 ScopeChainIterator iter = scopeChain->begin(); | 1205 ScopeChainIterator iter = scopeChain->begin(); |
1216 ScopeChainIterator end = scopeChain->end(); | 1206 ScopeChainIterator end = scopeChain->end(); |
1217 | 1207 |
1218 // FIXME: add scopeDepthIsZero optimization | 1208 // FIXME: add scopeDepthIsZero optimization |
(...skipping 21 matching lines...) Expand all Loading... |
1240 } | 1230 } |
1241 ++iter; | 1231 ++iter; |
1242 } while (iter != end); | 1232 } while (iter != end); |
1243 | 1233 |
1244 CodeBlock* codeBlock = callFrame->codeBlock(); | 1234 CodeBlock* codeBlock = callFrame->codeBlock(); |
1245 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); | 1235 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); |
1246 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, v
PCIndex, codeBlock); | 1236 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, v
PCIndex, codeBlock); |
1247 VM_THROW_EXCEPTION_2(); | 1237 VM_THROW_EXCEPTION_2(); |
1248 } | 1238 } |
1249 | 1239 |
1250 JSValueEncodedAsPointer* Interpreter::cti_op_sub(STUB_ARGS) | 1240 JSValueEncodedAsPointer* JITStubs::cti_op_sub(STUB_ARGS) |
1251 { | 1241 { |
1252 BEGIN_STUB_FUNCTION(); | 1242 BEGIN_STUB_FUNCTION(); |
1253 | 1243 |
1254 JSValuePtr src1 = ARG_src1; | 1244 JSValuePtr src1 = ARG_src1; |
1255 JSValuePtr src2 = ARG_src2; | 1245 JSValuePtr src2 = ARG_src2; |
1256 | 1246 |
1257 double left; | 1247 double left; |
1258 double right; | 1248 double right; |
1259 if (src1.getNumber(left) && src2.getNumber(right)) | 1249 if (src1.getNumber(left) && src2.getNumber(right)) |
1260 return JSValuePtr::encode(jsNumber(ARG_globalData, left - right)); | 1250 return JSValuePtr::encode(jsNumber(ARG_globalData, left - right)); |
1261 | 1251 |
1262 CallFrame* callFrame = ARG_callFrame; | 1252 CallFrame* callFrame = ARG_callFrame; |
1263 JSValuePtr result = jsNumber(ARG_globalData, src1.toNumber(callFrame) - src2
.toNumber(callFrame)); | 1253 JSValuePtr result = jsNumber(ARG_globalData, src1.toNumber(callFrame) - src2
.toNumber(callFrame)); |
1264 CHECK_FOR_EXCEPTION_AT_END(); | 1254 CHECK_FOR_EXCEPTION_AT_END(); |
1265 return JSValuePtr::encode(result); | 1255 return JSValuePtr::encode(result); |
1266 } | 1256 } |
1267 | 1257 |
1268 void Interpreter::cti_op_put_by_val(STUB_ARGS) | 1258 void JITStubs::cti_op_put_by_val(STUB_ARGS) |
1269 { | 1259 { |
1270 BEGIN_STUB_FUNCTION(); | 1260 BEGIN_STUB_FUNCTION(); |
1271 | 1261 |
1272 CallFrame* callFrame = ARG_callFrame; | 1262 CallFrame* callFrame = ARG_callFrame; |
1273 Interpreter* interpreter = ARG_globalData->interpreter; | 1263 JSGlobalData* globalData = ARG_globalData; |
1274 | 1264 |
1275 JSValuePtr baseValue = ARG_src1; | 1265 JSValuePtr baseValue = ARG_src1; |
1276 JSValuePtr subscript = ARG_src2; | 1266 JSValuePtr subscript = ARG_src2; |
1277 JSValuePtr value = ARG_src3; | 1267 JSValuePtr value = ARG_src3; |
1278 | 1268 |
1279 if (LIKELY(subscript.isUInt32Fast())) { | 1269 if (LIKELY(subscript.isUInt32Fast())) { |
1280 uint32_t i = subscript.getUInt32Fast(); | 1270 uint32_t i = subscript.getUInt32Fast(); |
1281 if (interpreter->isJSArray(baseValue)) { | 1271 if (isJSArray(globalData, baseValue)) { |
1282 JSArray* jsArray = asArray(baseValue); | 1272 JSArray* jsArray = asArray(baseValue); |
1283 if (jsArray->canSetIndex(i)) | 1273 if (jsArray->canSetIndex(i)) |
1284 jsArray->setIndex(i, value); | 1274 jsArray->setIndex(i, value); |
1285 else | 1275 else |
1286 jsArray->JSArray::put(callFrame, i, value); | 1276 jsArray->JSArray::put(callFrame, i, value); |
1287 } else if (interpreter->isJSByteArray(baseValue) && asByteArray(baseValu
e)->canAccessIndex(i)) { | 1277 } else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue
)->canAccessIndex(i)) { |
1288 JSByteArray* jsByteArray = asByteArray(baseValue); | 1278 JSByteArray* jsByteArray = asByteArray(baseValue); |
1289 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<vo
id*>(cti_op_put_by_val_byte_array)); | 1279 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<vo
id*>(cti_op_put_by_val_byte_array)); |
1290 // All fast byte array accesses are safe from exceptions so return i
mmediately to avoid exception checks. | 1280 // All fast byte array accesses are safe from exceptions so return i
mmediately to avoid exception checks. |
1291 if (value.isInt32Fast()) { | 1281 if (value.isInt32Fast()) { |
1292 jsByteArray->setIndex(i, value.getInt32Fast()); | 1282 jsByteArray->setIndex(i, value.getInt32Fast()); |
1293 return; | 1283 return; |
1294 } else { | 1284 } else { |
1295 double dValue = 0; | 1285 double dValue = 0; |
1296 if (value.getNumber(dValue)) { | 1286 if (value.getNumber(dValue)) { |
1297 jsByteArray->setIndex(i, dValue); | 1287 jsByteArray->setIndex(i, dValue); |
1298 return; | 1288 return; |
1299 } | 1289 } |
1300 } | 1290 } |
1301 | 1291 |
1302 baseValue.put(callFrame, i, value); | 1292 baseValue.put(callFrame, i, value); |
1303 } else | 1293 } else |
1304 baseValue.put(callFrame, i, value); | 1294 baseValue.put(callFrame, i, value); |
1305 } else { | 1295 } else { |
1306 Identifier property(callFrame, subscript.toString(callFrame)); | 1296 Identifier property(callFrame, subscript.toString(callFrame)); |
1307 if (!ARG_globalData->exception) { // Don't put to an object if toString
threw an exception. | 1297 if (!ARG_globalData->exception) { // Don't put to an object if toString
threw an exception. |
1308 PutPropertySlot slot; | 1298 PutPropertySlot slot; |
1309 baseValue.put(callFrame, property, value, slot); | 1299 baseValue.put(callFrame, property, value, slot); |
1310 } | 1300 } |
1311 } | 1301 } |
1312 | 1302 |
1313 CHECK_FOR_EXCEPTION_AT_END(); | 1303 CHECK_FOR_EXCEPTION_AT_END(); |
1314 } | 1304 } |
1315 | 1305 |
1316 void Interpreter::cti_op_put_by_val_array(STUB_ARGS) | 1306 void JITStubs::cti_op_put_by_val_array(STUB_ARGS) |
1317 { | 1307 { |
1318 BEGIN_STUB_FUNCTION(); | 1308 BEGIN_STUB_FUNCTION(); |
1319 | 1309 |
1320 CallFrame* callFrame = ARG_callFrame; | 1310 CallFrame* callFrame = ARG_callFrame; |
1321 | |
1322 JSValuePtr baseValue = ARG_src1; | 1311 JSValuePtr baseValue = ARG_src1; |
1323 int i = ARG_int2; | 1312 int i = ARG_int2; |
1324 JSValuePtr value = ARG_src3; | 1313 JSValuePtr value = ARG_src3; |
1325 | 1314 |
1326 ASSERT(ARG_globalData->interpreter->isJSArray(baseValue)); | 1315 ASSERT(isJSArray(ARG_globalData, baseValue)); |
1327 | 1316 |
1328 if (LIKELY(i >= 0)) | 1317 if (LIKELY(i >= 0)) |
1329 asArray(baseValue)->JSArray::put(callFrame, i, value); | 1318 asArray(baseValue)->JSArray::put(callFrame, i, value); |
1330 else { | 1319 else { |
1331 // This should work since we're re-boxing an immediate unboxed in JIT co
de. | 1320 // This should work since we're re-boxing an immediate unboxed in JIT co
de. |
1332 ASSERT(JSValuePtr::makeInt32Fast(i)); | 1321 ASSERT(JSValuePtr::makeInt32Fast(i)); |
1333 Identifier property(callFrame, JSValuePtr::makeInt32Fast(i).toString(cal
lFrame)); | 1322 Identifier property(callFrame, JSValuePtr::makeInt32Fast(i).toString(cal
lFrame)); |
1334 // FIXME: can toString throw an exception here? | 1323 // FIXME: can toString throw an exception here? |
1335 if (!ARG_globalData->exception) { // Don't put to an object if toString
threw an exception. | 1324 if (!ARG_globalData->exception) { // Don't put to an object if toString
threw an exception. |
1336 PutPropertySlot slot; | 1325 PutPropertySlot slot; |
1337 baseValue.put(callFrame, property, value, slot); | 1326 baseValue.put(callFrame, property, value, slot); |
1338 } | 1327 } |
1339 } | 1328 } |
1340 | 1329 |
1341 CHECK_FOR_EXCEPTION_AT_END(); | 1330 CHECK_FOR_EXCEPTION_AT_END(); |
1342 } | 1331 } |
1343 | 1332 |
1344 void Interpreter::cti_op_put_by_val_byte_array(STUB_ARGS) | 1333 void JITStubs::cti_op_put_by_val_byte_array(STUB_ARGS) |
1345 { | 1334 { |
1346 BEGIN_STUB_FUNCTION(); | 1335 BEGIN_STUB_FUNCTION(); |
1347 | 1336 |
1348 CallFrame* callFrame = ARG_callFrame; | 1337 CallFrame* callFrame = ARG_callFrame; |
1349 Interpreter* interpreter = ARG_globalData->interpreter; | 1338 JSGlobalData* globalData = ARG_globalData; |
1350 | 1339 |
1351 JSValuePtr baseValue = ARG_src1; | 1340 JSValuePtr baseValue = ARG_src1; |
1352 JSValuePtr subscript = ARG_src2; | 1341 JSValuePtr subscript = ARG_src2; |
1353 JSValuePtr value = ARG_src3; | 1342 JSValuePtr value = ARG_src3; |
1354 | 1343 |
1355 if (LIKELY(subscript.isUInt32Fast())) { | 1344 if (LIKELY(subscript.isUInt32Fast())) { |
1356 uint32_t i = subscript.getUInt32Fast(); | 1345 uint32_t i = subscript.getUInt32Fast(); |
1357 if (interpreter->isJSByteArray(baseValue) && asByteArray(baseValue)->can
AccessIndex(i)) { | 1346 if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canA
ccessIndex(i)) { |
1358 JSByteArray* jsByteArray = asByteArray(baseValue); | 1347 JSByteArray* jsByteArray = asByteArray(baseValue); |
1359 | 1348 |
1360 // All fast byte array accesses are safe from exceptions so return i
mmediately to avoid exception checks. | 1349 // All fast byte array accesses are safe from exceptions so return i
mmediately to avoid exception checks. |
1361 if (value.isInt32Fast()) { | 1350 if (value.isInt32Fast()) { |
1362 jsByteArray->setIndex(i, value.getInt32Fast()); | 1351 jsByteArray->setIndex(i, value.getInt32Fast()); |
1363 return; | 1352 return; |
1364 } else { | 1353 } else { |
1365 double dValue = 0; | 1354 double dValue = 0; |
1366 if (value.getNumber(dValue)) { | 1355 if (value.getNumber(dValue)) { |
1367 jsByteArray->setIndex(i, dValue); | 1356 jsByteArray->setIndex(i, dValue); |
1368 return; | 1357 return; |
1369 } | 1358 } |
1370 } | 1359 } |
1371 } | 1360 } |
1372 | 1361 |
1373 if (!interpreter->isJSByteArray(baseValue)) | 1362 if (!isJSByteArray(globalData, baseValue)) |
1374 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<vo
id*>(cti_op_put_by_val)); | 1363 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<vo
id*>(cti_op_put_by_val)); |
1375 baseValue.put(callFrame, i, value); | 1364 baseValue.put(callFrame, i, value); |
1376 } else { | 1365 } else { |
1377 Identifier property(callFrame, subscript.toString(callFrame)); | 1366 Identifier property(callFrame, subscript.toString(callFrame)); |
1378 if (!ARG_globalData->exception) { // Don't put to an object if toString
threw an exception. | 1367 if (!ARG_globalData->exception) { // Don't put to an object if toString
threw an exception. |
1379 PutPropertySlot slot; | 1368 PutPropertySlot slot; |
1380 baseValue.put(callFrame, property, value, slot); | 1369 baseValue.put(callFrame, property, value, slot); |
1381 } | 1370 } |
1382 } | 1371 } |
1383 | 1372 |
1384 CHECK_FOR_EXCEPTION_AT_END(); | 1373 CHECK_FOR_EXCEPTION_AT_END(); |
1385 } | 1374 } |
1386 | 1375 |
1387 JSValueEncodedAsPointer* Interpreter::cti_op_lesseq(STUB_ARGS) | 1376 JSValueEncodedAsPointer* JITStubs::cti_op_lesseq(STUB_ARGS) |
1388 { | 1377 { |
1389 BEGIN_STUB_FUNCTION(); | 1378 BEGIN_STUB_FUNCTION(); |
1390 | 1379 |
1391 CallFrame* callFrame = ARG_callFrame; | 1380 CallFrame* callFrame = ARG_callFrame; |
1392 JSValuePtr result = jsBoolean(jsLessEq(callFrame, ARG_src1, ARG_src2)); | 1381 JSValuePtr result = jsBoolean(jsLessEq(callFrame, ARG_src1, ARG_src2)); |
1393 CHECK_FOR_EXCEPTION_AT_END(); | 1382 CHECK_FOR_EXCEPTION_AT_END(); |
1394 return JSValuePtr::encode(result); | 1383 return JSValuePtr::encode(result); |
1395 } | 1384 } |
1396 | 1385 |
1397 int Interpreter::cti_op_loop_if_true(STUB_ARGS) | 1386 int JITStubs::cti_op_loop_if_true(STUB_ARGS) |
1398 { | 1387 { |
1399 BEGIN_STUB_FUNCTION(); | 1388 BEGIN_STUB_FUNCTION(); |
1400 | 1389 |
1401 JSValuePtr src1 = ARG_src1; | 1390 JSValuePtr src1 = ARG_src1; |
1402 | 1391 |
1403 CallFrame* callFrame = ARG_callFrame; | 1392 CallFrame* callFrame = ARG_callFrame; |
1404 | 1393 |
1405 bool result = src1.toBoolean(callFrame); | 1394 bool result = src1.toBoolean(callFrame); |
1406 CHECK_FOR_EXCEPTION_AT_END(); | 1395 CHECK_FOR_EXCEPTION_AT_END(); |
1407 return result; | 1396 return result; |
1408 } | 1397 } |
1409 | 1398 |
1410 JSValueEncodedAsPointer* Interpreter::cti_op_negate(STUB_ARGS) | 1399 JSValueEncodedAsPointer* JITStubs::cti_op_negate(STUB_ARGS) |
1411 { | 1400 { |
1412 BEGIN_STUB_FUNCTION(); | 1401 BEGIN_STUB_FUNCTION(); |
1413 | 1402 |
1414 JSValuePtr src = ARG_src1; | 1403 JSValuePtr src = ARG_src1; |
1415 | 1404 |
1416 double v; | 1405 double v; |
1417 if (src.getNumber(v)) | 1406 if (src.getNumber(v)) |
1418 return JSValuePtr::encode(jsNumber(ARG_globalData, -v)); | 1407 return JSValuePtr::encode(jsNumber(ARG_globalData, -v)); |
1419 | 1408 |
1420 CallFrame* callFrame = ARG_callFrame; | 1409 CallFrame* callFrame = ARG_callFrame; |
1421 JSValuePtr result = jsNumber(ARG_globalData, -src.toNumber(callFrame)); | 1410 JSValuePtr result = jsNumber(ARG_globalData, -src.toNumber(callFrame)); |
1422 CHECK_FOR_EXCEPTION_AT_END(); | 1411 CHECK_FOR_EXCEPTION_AT_END(); |
1423 return JSValuePtr::encode(result); | 1412 return JSValuePtr::encode(result); |
1424 } | 1413 } |
1425 | 1414 |
1426 JSValueEncodedAsPointer* Interpreter::cti_op_resolve_base(STUB_ARGS) | 1415 JSValueEncodedAsPointer* JITStubs::cti_op_resolve_base(STUB_ARGS) |
1427 { | 1416 { |
1428 BEGIN_STUB_FUNCTION(); | 1417 BEGIN_STUB_FUNCTION(); |
1429 | 1418 |
1430 return JSValuePtr::encode(JSC::resolveBase(ARG_callFrame, *ARG_id1, ARG_call
Frame->scopeChain())); | 1419 return JSValuePtr::encode(JSC::resolveBase(ARG_callFrame, *ARG_id1, ARG_call
Frame->scopeChain())); |
1431 } | 1420 } |
1432 | 1421 |
1433 JSValueEncodedAsPointer* Interpreter::cti_op_resolve_skip(STUB_ARGS) | 1422 JSValueEncodedAsPointer* JITStubs::cti_op_resolve_skip(STUB_ARGS) |
1434 { | 1423 { |
1435 BEGIN_STUB_FUNCTION(); | 1424 BEGIN_STUB_FUNCTION(); |
1436 | 1425 |
1437 CallFrame* callFrame = ARG_callFrame; | 1426 CallFrame* callFrame = ARG_callFrame; |
1438 ScopeChainNode* scopeChain = callFrame->scopeChain(); | 1427 ScopeChainNode* scopeChain = callFrame->scopeChain(); |
1439 | 1428 |
1440 int skip = ARG_int2; | 1429 int skip = ARG_int2; |
1441 | 1430 |
1442 ScopeChainIterator iter = scopeChain->begin(); | 1431 ScopeChainIterator iter = scopeChain->begin(); |
1443 ScopeChainIterator end = scopeChain->end(); | 1432 ScopeChainIterator end = scopeChain->end(); |
(...skipping 12 matching lines...) Expand all Loading... |
1456 return JSValuePtr::encode(result); | 1445 return JSValuePtr::encode(result); |
1457 } | 1446 } |
1458 } while (++iter != end); | 1447 } while (++iter != end); |
1459 | 1448 |
1460 CodeBlock* codeBlock = callFrame->codeBlock(); | 1449 CodeBlock* codeBlock = callFrame->codeBlock(); |
1461 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); | 1450 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); |
1462 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, v
PCIndex, codeBlock); | 1451 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, v
PCIndex, codeBlock); |
1463 VM_THROW_EXCEPTION(); | 1452 VM_THROW_EXCEPTION(); |
1464 } | 1453 } |
1465 | 1454 |
1466 JSValueEncodedAsPointer* Interpreter::cti_op_resolve_global(STUB_ARGS) | 1455 JSValueEncodedAsPointer* JITStubs::cti_op_resolve_global(STUB_ARGS) |
1467 { | 1456 { |
1468 BEGIN_STUB_FUNCTION(); | 1457 BEGIN_STUB_FUNCTION(); |
1469 | 1458 |
1470 CallFrame* callFrame = ARG_callFrame; | 1459 CallFrame* callFrame = ARG_callFrame; |
1471 JSGlobalObject* globalObject = asGlobalObject(ARG_src1); | 1460 JSGlobalObject* globalObject = asGlobalObject(ARG_src1); |
1472 Identifier& ident = *ARG_id2; | 1461 Identifier& ident = *ARG_id2; |
1473 unsigned globalResolveInfoIndex = ARG_int3; | 1462 unsigned globalResolveInfoIndex = ARG_int3; |
1474 ASSERT(globalObject->isGlobalObject()); | 1463 ASSERT(globalObject->isGlobalObject()); |
1475 | 1464 |
1476 PropertySlot slot(globalObject); | 1465 PropertySlot slot(globalObject); |
(...skipping 11 matching lines...) Expand all Loading... |
1488 | 1477 |
1489 CHECK_FOR_EXCEPTION_AT_END(); | 1478 CHECK_FOR_EXCEPTION_AT_END(); |
1490 return JSValuePtr::encode(result); | 1479 return JSValuePtr::encode(result); |
1491 } | 1480 } |
1492 | 1481 |
1493 unsigned vPCIndex = callFrame->codeBlock()->getBytecodeIndex(callFrame, STUB
_RETURN_ADDRESS); | 1482 unsigned vPCIndex = callFrame->codeBlock()->getBytecodeIndex(callFrame, STUB
_RETURN_ADDRESS); |
1494 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, v
PCIndex, callFrame->codeBlock()); | 1483 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, v
PCIndex, callFrame->codeBlock()); |
1495 VM_THROW_EXCEPTION(); | 1484 VM_THROW_EXCEPTION(); |
1496 } | 1485 } |
1497 | 1486 |
1498 JSValueEncodedAsPointer* Interpreter::cti_op_div(STUB_ARGS) | 1487 JSValueEncodedAsPointer* JITStubs::cti_op_div(STUB_ARGS) |
1499 { | 1488 { |
1500 BEGIN_STUB_FUNCTION(); | 1489 BEGIN_STUB_FUNCTION(); |
1501 | 1490 |
1502 JSValuePtr src1 = ARG_src1; | 1491 JSValuePtr src1 = ARG_src1; |
1503 JSValuePtr src2 = ARG_src2; | 1492 JSValuePtr src2 = ARG_src2; |
1504 | 1493 |
1505 double left; | 1494 double left; |
1506 double right; | 1495 double right; |
1507 if (src1.getNumber(left) && src2.getNumber(right)) | 1496 if (src1.getNumber(left) && src2.getNumber(right)) |
1508 return JSValuePtr::encode(jsNumber(ARG_globalData, left / right)); | 1497 return JSValuePtr::encode(jsNumber(ARG_globalData, left / right)); |
1509 | 1498 |
1510 CallFrame* callFrame = ARG_callFrame; | 1499 CallFrame* callFrame = ARG_callFrame; |
1511 JSValuePtr result = jsNumber(ARG_globalData, src1.toNumber(callFrame) / src2
.toNumber(callFrame)); | 1500 JSValuePtr result = jsNumber(ARG_globalData, src1.toNumber(callFrame) / src2
.toNumber(callFrame)); |
1512 CHECK_FOR_EXCEPTION_AT_END(); | 1501 CHECK_FOR_EXCEPTION_AT_END(); |
1513 return JSValuePtr::encode(result); | 1502 return JSValuePtr::encode(result); |
1514 } | 1503 } |
1515 | 1504 |
1516 JSValueEncodedAsPointer* Interpreter::cti_op_pre_dec(STUB_ARGS) | 1505 JSValueEncodedAsPointer* JITStubs::cti_op_pre_dec(STUB_ARGS) |
1517 { | 1506 { |
1518 BEGIN_STUB_FUNCTION(); | 1507 BEGIN_STUB_FUNCTION(); |
1519 | 1508 |
1520 JSValuePtr v = ARG_src1; | 1509 JSValuePtr v = ARG_src1; |
1521 | 1510 |
1522 CallFrame* callFrame = ARG_callFrame; | 1511 CallFrame* callFrame = ARG_callFrame; |
1523 JSValuePtr result = jsNumber(ARG_globalData, v.toNumber(callFrame) - 1); | 1512 JSValuePtr result = jsNumber(ARG_globalData, v.toNumber(callFrame) - 1); |
1524 CHECK_FOR_EXCEPTION_AT_END(); | 1513 CHECK_FOR_EXCEPTION_AT_END(); |
1525 return JSValuePtr::encode(result); | 1514 return JSValuePtr::encode(result); |
1526 } | 1515 } |
1527 | 1516 |
1528 int Interpreter::cti_op_jless(STUB_ARGS) | 1517 int JITStubs::cti_op_jless(STUB_ARGS) |
1529 { | 1518 { |
1530 BEGIN_STUB_FUNCTION(); | 1519 BEGIN_STUB_FUNCTION(); |
1531 | 1520 |
1532 JSValuePtr src1 = ARG_src1; | 1521 JSValuePtr src1 = ARG_src1; |
1533 JSValuePtr src2 = ARG_src2; | 1522 JSValuePtr src2 = ARG_src2; |
1534 CallFrame* callFrame = ARG_callFrame; | 1523 CallFrame* callFrame = ARG_callFrame; |
1535 | 1524 |
1536 bool result = jsLess(callFrame, src1, src2); | 1525 bool result = jsLess(callFrame, src1, src2); |
1537 CHECK_FOR_EXCEPTION_AT_END(); | 1526 CHECK_FOR_EXCEPTION_AT_END(); |
1538 return result; | 1527 return result; |
1539 } | 1528 } |
1540 | 1529 |
1541 JSValueEncodedAsPointer* Interpreter::cti_op_not(STUB_ARGS) | 1530 JSValueEncodedAsPointer* JITStubs::cti_op_not(STUB_ARGS) |
1542 { | 1531 { |
1543 BEGIN_STUB_FUNCTION(); | 1532 BEGIN_STUB_FUNCTION(); |
1544 | 1533 |
1545 JSValuePtr src = ARG_src1; | 1534 JSValuePtr src = ARG_src1; |
1546 | 1535 |
1547 CallFrame* callFrame = ARG_callFrame; | 1536 CallFrame* callFrame = ARG_callFrame; |
1548 | 1537 |
1549 JSValuePtr result = jsBoolean(!src.toBoolean(callFrame)); | 1538 JSValuePtr result = jsBoolean(!src.toBoolean(callFrame)); |
1550 CHECK_FOR_EXCEPTION_AT_END(); | 1539 CHECK_FOR_EXCEPTION_AT_END(); |
1551 return JSValuePtr::encode(result); | 1540 return JSValuePtr::encode(result); |
1552 } | 1541 } |
1553 | 1542 |
1554 int Interpreter::cti_op_jtrue(STUB_ARGS) | 1543 int JITStubs::cti_op_jtrue(STUB_ARGS) |
1555 { | 1544 { |
1556 BEGIN_STUB_FUNCTION(); | 1545 BEGIN_STUB_FUNCTION(); |
1557 | 1546 |
1558 JSValuePtr src1 = ARG_src1; | 1547 JSValuePtr src1 = ARG_src1; |
1559 | 1548 |
1560 CallFrame* callFrame = ARG_callFrame; | 1549 CallFrame* callFrame = ARG_callFrame; |
1561 | 1550 |
1562 bool result = src1.toBoolean(callFrame); | 1551 bool result = src1.toBoolean(callFrame); |
1563 CHECK_FOR_EXCEPTION_AT_END(); | 1552 CHECK_FOR_EXCEPTION_AT_END(); |
1564 return result; | 1553 return result; |
1565 } | 1554 } |
1566 | 1555 |
1567 VoidPtrPair Interpreter::cti_op_post_inc(STUB_ARGS) | 1556 VoidPtrPair JITStubs::cti_op_post_inc(STUB_ARGS) |
1568 { | 1557 { |
1569 BEGIN_STUB_FUNCTION(); | 1558 BEGIN_STUB_FUNCTION(); |
1570 | 1559 |
1571 JSValuePtr v = ARG_src1; | 1560 JSValuePtr v = ARG_src1; |
1572 | 1561 |
1573 CallFrame* callFrame = ARG_callFrame; | 1562 CallFrame* callFrame = ARG_callFrame; |
1574 | 1563 |
1575 JSValuePtr number = v.toJSNumber(callFrame); | 1564 JSValuePtr number = v.toJSNumber(callFrame); |
1576 CHECK_FOR_EXCEPTION_AT_END(); | 1565 CHECK_FOR_EXCEPTION_AT_END(); |
1577 | 1566 |
1578 RETURN_PAIR(JSValuePtr::encode(number), JSValuePtr::encode(jsNumber(ARG_glob
alData, number.uncheckedGetNumber() + 1))); | 1567 RETURN_PAIR(JSValuePtr::encode(number), JSValuePtr::encode(jsNumber(ARG_glob
alData, number.uncheckedGetNumber() + 1))); |
1579 } | 1568 } |
1580 | 1569 |
1581 JSValueEncodedAsPointer* Interpreter::cti_op_eq(STUB_ARGS) | 1570 JSValueEncodedAsPointer* JITStubs::cti_op_eq(STUB_ARGS) |
1582 { | 1571 { |
1583 BEGIN_STUB_FUNCTION(); | 1572 BEGIN_STUB_FUNCTION(); |
1584 | 1573 |
1585 JSValuePtr src1 = ARG_src1; | 1574 JSValuePtr src1 = ARG_src1; |
1586 JSValuePtr src2 = ARG_src2; | 1575 JSValuePtr src2 = ARG_src2; |
1587 | 1576 |
1588 CallFrame* callFrame = ARG_callFrame; | 1577 CallFrame* callFrame = ARG_callFrame; |
1589 | 1578 |
1590 ASSERT(!JSValuePtr::areBothInt32Fast(src1, src2)); | 1579 ASSERT(!JSValuePtr::areBothInt32Fast(src1, src2)); |
1591 JSValuePtr result = jsBoolean(JSValuePtr::equalSlowCaseInline(callFrame, src
1, src2)); | 1580 JSValuePtr result = jsBoolean(JSValuePtr::equalSlowCaseInline(callFrame, src
1, src2)); |
1592 CHECK_FOR_EXCEPTION_AT_END(); | 1581 CHECK_FOR_EXCEPTION_AT_END(); |
1593 return JSValuePtr::encode(result); | 1582 return JSValuePtr::encode(result); |
1594 } | 1583 } |
1595 | 1584 |
1596 JSValueEncodedAsPointer* Interpreter::cti_op_lshift(STUB_ARGS) | 1585 JSValueEncodedAsPointer* JITStubs::cti_op_lshift(STUB_ARGS) |
1597 { | 1586 { |
1598 BEGIN_STUB_FUNCTION(); | 1587 BEGIN_STUB_FUNCTION(); |
1599 | 1588 |
1600 JSValuePtr val = ARG_src1; | 1589 JSValuePtr val = ARG_src1; |
1601 JSValuePtr shift = ARG_src2; | 1590 JSValuePtr shift = ARG_src2; |
1602 | 1591 |
1603 int32_t left; | 1592 int32_t left; |
1604 uint32_t right; | 1593 uint32_t right; |
1605 if (JSValuePtr::areBothInt32Fast(val, shift)) | 1594 if (JSValuePtr::areBothInt32Fast(val, shift)) |
1606 return JSValuePtr::encode(jsNumber(ARG_globalData, val.getInt32Fast() <<
(shift.getInt32Fast() & 0x1f))); | 1595 return JSValuePtr::encode(jsNumber(ARG_globalData, val.getInt32Fast() <<
(shift.getInt32Fast() & 0x1f))); |
1607 if (val.numberToInt32(left) && shift.numberToUInt32(right)) | 1596 if (val.numberToInt32(left) && shift.numberToUInt32(right)) |
1608 return JSValuePtr::encode(jsNumber(ARG_globalData, left << (right & 0x1f
))); | 1597 return JSValuePtr::encode(jsNumber(ARG_globalData, left << (right & 0x1f
))); |
1609 | 1598 |
1610 CallFrame* callFrame = ARG_callFrame; | 1599 CallFrame* callFrame = ARG_callFrame; |
1611 JSValuePtr result = jsNumber(ARG_globalData, (val.toInt32(callFrame)) << (sh
ift.toUInt32(callFrame) & 0x1f)); | 1600 JSValuePtr result = jsNumber(ARG_globalData, (val.toInt32(callFrame)) << (sh
ift.toUInt32(callFrame) & 0x1f)); |
1612 CHECK_FOR_EXCEPTION_AT_END(); | 1601 CHECK_FOR_EXCEPTION_AT_END(); |
1613 return JSValuePtr::encode(result); | 1602 return JSValuePtr::encode(result); |
1614 } | 1603 } |
1615 | 1604 |
1616 JSValueEncodedAsPointer* Interpreter::cti_op_bitand(STUB_ARGS) | 1605 JSValueEncodedAsPointer* JITStubs::cti_op_bitand(STUB_ARGS) |
1617 { | 1606 { |
1618 BEGIN_STUB_FUNCTION(); | 1607 BEGIN_STUB_FUNCTION(); |
1619 | 1608 |
1620 JSValuePtr src1 = ARG_src1; | 1609 JSValuePtr src1 = ARG_src1; |
1621 JSValuePtr src2 = ARG_src2; | 1610 JSValuePtr src2 = ARG_src2; |
1622 | 1611 |
1623 int32_t left; | 1612 int32_t left; |
1624 int32_t right; | 1613 int32_t right; |
1625 if (src1.numberToInt32(left) && src2.numberToInt32(right)) | 1614 if (src1.numberToInt32(left) && src2.numberToInt32(right)) |
1626 return JSValuePtr::encode(jsNumber(ARG_globalData, left & right)); | 1615 return JSValuePtr::encode(jsNumber(ARG_globalData, left & right)); |
1627 | 1616 |
1628 CallFrame* callFrame = ARG_callFrame; | 1617 CallFrame* callFrame = ARG_callFrame; |
1629 JSValuePtr result = jsNumber(ARG_globalData, src1.toInt32(callFrame) & src2.
toInt32(callFrame)); | 1618 JSValuePtr result = jsNumber(ARG_globalData, src1.toInt32(callFrame) & src2.
toInt32(callFrame)); |
1630 CHECK_FOR_EXCEPTION_AT_END(); | 1619 CHECK_FOR_EXCEPTION_AT_END(); |
1631 return JSValuePtr::encode(result); | 1620 return JSValuePtr::encode(result); |
1632 } | 1621 } |
1633 | 1622 |
1634 JSValueEncodedAsPointer* Interpreter::cti_op_rshift(STUB_ARGS) | 1623 JSValueEncodedAsPointer* JITStubs::cti_op_rshift(STUB_ARGS) |
1635 { | 1624 { |
1636 BEGIN_STUB_FUNCTION(); | 1625 BEGIN_STUB_FUNCTION(); |
1637 | 1626 |
1638 JSValuePtr val = ARG_src1; | 1627 JSValuePtr val = ARG_src1; |
1639 JSValuePtr shift = ARG_src2; | 1628 JSValuePtr shift = ARG_src2; |
1640 | 1629 |
1641 int32_t left; | 1630 int32_t left; |
1642 uint32_t right; | 1631 uint32_t right; |
1643 if (JSFastMath::canDoFastRshift(val, shift)) | 1632 if (JSFastMath::canDoFastRshift(val, shift)) |
1644 return JSValuePtr::encode(JSFastMath::rightShiftImmediateNumbers(val, sh
ift)); | 1633 return JSValuePtr::encode(JSFastMath::rightShiftImmediateNumbers(val, sh
ift)); |
1645 if (val.numberToInt32(left) && shift.numberToUInt32(right)) | 1634 if (val.numberToInt32(left) && shift.numberToUInt32(right)) |
1646 return JSValuePtr::encode(jsNumber(ARG_globalData, left >> (right & 0x1f
))); | 1635 return JSValuePtr::encode(jsNumber(ARG_globalData, left >> (right & 0x1f
))); |
1647 | 1636 |
1648 CallFrame* callFrame = ARG_callFrame; | 1637 CallFrame* callFrame = ARG_callFrame; |
1649 JSValuePtr result = jsNumber(ARG_globalData, (val.toInt32(callFrame)) >> (sh
ift.toUInt32(callFrame) & 0x1f)); | 1638 JSValuePtr result = jsNumber(ARG_globalData, (val.toInt32(callFrame)) >> (sh
ift.toUInt32(callFrame) & 0x1f)); |
1650 CHECK_FOR_EXCEPTION_AT_END(); | 1639 CHECK_FOR_EXCEPTION_AT_END(); |
1651 return JSValuePtr::encode(result); | 1640 return JSValuePtr::encode(result); |
1652 } | 1641 } |
1653 | 1642 |
1654 JSValueEncodedAsPointer* Interpreter::cti_op_bitnot(STUB_ARGS) | 1643 JSValueEncodedAsPointer* JITStubs::cti_op_bitnot(STUB_ARGS) |
1655 { | 1644 { |
1656 BEGIN_STUB_FUNCTION(); | 1645 BEGIN_STUB_FUNCTION(); |
1657 | 1646 |
1658 JSValuePtr src = ARG_src1; | 1647 JSValuePtr src = ARG_src1; |
1659 | 1648 |
1660 int value; | 1649 int value; |
1661 if (src.numberToInt32(value)) | 1650 if (src.numberToInt32(value)) |
1662 return JSValuePtr::encode(jsNumber(ARG_globalData, ~value)); | 1651 return JSValuePtr::encode(jsNumber(ARG_globalData, ~value)); |
1663 | 1652 |
1664 CallFrame* callFrame = ARG_callFrame; | 1653 CallFrame* callFrame = ARG_callFrame; |
1665 JSValuePtr result = jsNumber(ARG_globalData, ~src.toInt32(callFrame)); | 1654 JSValuePtr result = jsNumber(ARG_globalData, ~src.toInt32(callFrame)); |
1666 CHECK_FOR_EXCEPTION_AT_END(); | 1655 CHECK_FOR_EXCEPTION_AT_END(); |
1667 return JSValuePtr::encode(result); | 1656 return JSValuePtr::encode(result); |
1668 } | 1657 } |
1669 | 1658 |
1670 VoidPtrPair Interpreter::cti_op_resolve_with_base(STUB_ARGS) | 1659 VoidPtrPair JITStubs::cti_op_resolve_with_base(STUB_ARGS) |
1671 { | 1660 { |
1672 BEGIN_STUB_FUNCTION(); | 1661 BEGIN_STUB_FUNCTION(); |
1673 | 1662 |
1674 CallFrame* callFrame = ARG_callFrame; | 1663 CallFrame* callFrame = ARG_callFrame; |
1675 ScopeChainNode* scopeChain = callFrame->scopeChain(); | 1664 ScopeChainNode* scopeChain = callFrame->scopeChain(); |
1676 | 1665 |
1677 ScopeChainIterator iter = scopeChain->begin(); | 1666 ScopeChainIterator iter = scopeChain->begin(); |
1678 ScopeChainIterator end = scopeChain->end(); | 1667 ScopeChainIterator end = scopeChain->end(); |
1679 | 1668 |
1680 // FIXME: add scopeDepthIsZero optimization | 1669 // FIXME: add scopeDepthIsZero optimization |
(...skipping 13 matching lines...) Expand all Loading... |
1694 } | 1683 } |
1695 ++iter; | 1684 ++iter; |
1696 } while (iter != end); | 1685 } while (iter != end); |
1697 | 1686 |
1698 CodeBlock* codeBlock = callFrame->codeBlock(); | 1687 CodeBlock* codeBlock = callFrame->codeBlock(); |
1699 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); | 1688 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); |
1700 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, v
PCIndex, codeBlock); | 1689 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, v
PCIndex, codeBlock); |
1701 VM_THROW_EXCEPTION_2(); | 1690 VM_THROW_EXCEPTION_2(); |
1702 } | 1691 } |
1703 | 1692 |
1704 JSObject* Interpreter::cti_op_new_func_exp(STUB_ARGS) | 1693 JSObject* JITStubs::cti_op_new_func_exp(STUB_ARGS) |
1705 { | 1694 { |
1706 BEGIN_STUB_FUNCTION(); | 1695 BEGIN_STUB_FUNCTION(); |
1707 | 1696 |
1708 return ARG_funcexp1->makeFunction(ARG_callFrame, ARG_callFrame->scopeChain()
); | 1697 return ARG_funcexp1->makeFunction(ARG_callFrame, ARG_callFrame->scopeChain()
); |
1709 } | 1698 } |
1710 | 1699 |
1711 JSValueEncodedAsPointer* Interpreter::cti_op_mod(STUB_ARGS) | 1700 JSValueEncodedAsPointer* JITStubs::cti_op_mod(STUB_ARGS) |
1712 { | 1701 { |
1713 BEGIN_STUB_FUNCTION(); | 1702 BEGIN_STUB_FUNCTION(); |
1714 | 1703 |
1715 JSValuePtr dividendValue = ARG_src1; | 1704 JSValuePtr dividendValue = ARG_src1; |
1716 JSValuePtr divisorValue = ARG_src2; | 1705 JSValuePtr divisorValue = ARG_src2; |
1717 | 1706 |
1718 CallFrame* callFrame = ARG_callFrame; | 1707 CallFrame* callFrame = ARG_callFrame; |
1719 double d = dividendValue.toNumber(callFrame); | 1708 double d = dividendValue.toNumber(callFrame); |
1720 JSValuePtr result = jsNumber(ARG_globalData, fmod(d, divisorValue.toNumber(c
allFrame))); | 1709 JSValuePtr result = jsNumber(ARG_globalData, fmod(d, divisorValue.toNumber(c
allFrame))); |
1721 CHECK_FOR_EXCEPTION_AT_END(); | 1710 CHECK_FOR_EXCEPTION_AT_END(); |
1722 return JSValuePtr::encode(result); | 1711 return JSValuePtr::encode(result); |
1723 } | 1712 } |
1724 | 1713 |
1725 JSValueEncodedAsPointer* Interpreter::cti_op_less(STUB_ARGS) | 1714 JSValueEncodedAsPointer* JITStubs::cti_op_less(STUB_ARGS) |
1726 { | 1715 { |
1727 BEGIN_STUB_FUNCTION(); | 1716 BEGIN_STUB_FUNCTION(); |
1728 | 1717 |
1729 CallFrame* callFrame = ARG_callFrame; | 1718 CallFrame* callFrame = ARG_callFrame; |
1730 JSValuePtr result = jsBoolean(jsLess(callFrame, ARG_src1, ARG_src2)); | 1719 JSValuePtr result = jsBoolean(jsLess(callFrame, ARG_src1, ARG_src2)); |
1731 CHECK_FOR_EXCEPTION_AT_END(); | 1720 CHECK_FOR_EXCEPTION_AT_END(); |
1732 return JSValuePtr::encode(result); | 1721 return JSValuePtr::encode(result); |
1733 } | 1722 } |
1734 | 1723 |
1735 JSValueEncodedAsPointer* Interpreter::cti_op_neq(STUB_ARGS) | 1724 JSValueEncodedAsPointer* JITStubs::cti_op_neq(STUB_ARGS) |
1736 { | 1725 { |
1737 BEGIN_STUB_FUNCTION(); | 1726 BEGIN_STUB_FUNCTION(); |
1738 | 1727 |
1739 JSValuePtr src1 = ARG_src1; | 1728 JSValuePtr src1 = ARG_src1; |
1740 JSValuePtr src2 = ARG_src2; | 1729 JSValuePtr src2 = ARG_src2; |
1741 | 1730 |
1742 ASSERT(!JSValuePtr::areBothInt32Fast(src1, src2)); | 1731 ASSERT(!JSValuePtr::areBothInt32Fast(src1, src2)); |
1743 | 1732 |
1744 CallFrame* callFrame = ARG_callFrame; | 1733 CallFrame* callFrame = ARG_callFrame; |
1745 JSValuePtr result = jsBoolean(!JSValuePtr::equalSlowCaseInline(callFrame, sr
c1, src2)); | 1734 JSValuePtr result = jsBoolean(!JSValuePtr::equalSlowCaseInline(callFrame, sr
c1, src2)); |
1746 CHECK_FOR_EXCEPTION_AT_END(); | 1735 CHECK_FOR_EXCEPTION_AT_END(); |
1747 return JSValuePtr::encode(result); | 1736 return JSValuePtr::encode(result); |
1748 } | 1737 } |
1749 | 1738 |
1750 VoidPtrPair Interpreter::cti_op_post_dec(STUB_ARGS) | 1739 VoidPtrPair JITStubs::cti_op_post_dec(STUB_ARGS) |
1751 { | 1740 { |
1752 BEGIN_STUB_FUNCTION(); | 1741 BEGIN_STUB_FUNCTION(); |
1753 | 1742 |
1754 JSValuePtr v = ARG_src1; | 1743 JSValuePtr v = ARG_src1; |
1755 | 1744 |
1756 CallFrame* callFrame = ARG_callFrame; | 1745 CallFrame* callFrame = ARG_callFrame; |
1757 | 1746 |
1758 JSValuePtr number = v.toJSNumber(callFrame); | 1747 JSValuePtr number = v.toJSNumber(callFrame); |
1759 CHECK_FOR_EXCEPTION_AT_END(); | 1748 CHECK_FOR_EXCEPTION_AT_END(); |
1760 | 1749 |
1761 RETURN_PAIR(JSValuePtr::encode(number), JSValuePtr::encode(jsNumber(ARG_glob
alData, number.uncheckedGetNumber() - 1))); | 1750 RETURN_PAIR(JSValuePtr::encode(number), JSValuePtr::encode(jsNumber(ARG_glob
alData, number.uncheckedGetNumber() - 1))); |
1762 } | 1751 } |
1763 | 1752 |
1764 JSValueEncodedAsPointer* Interpreter::cti_op_urshift(STUB_ARGS) | 1753 JSValueEncodedAsPointer* JITStubs::cti_op_urshift(STUB_ARGS) |
1765 { | 1754 { |
1766 BEGIN_STUB_FUNCTION(); | 1755 BEGIN_STUB_FUNCTION(); |
1767 | 1756 |
1768 JSValuePtr val = ARG_src1; | 1757 JSValuePtr val = ARG_src1; |
1769 JSValuePtr shift = ARG_src2; | 1758 JSValuePtr shift = ARG_src2; |
1770 | 1759 |
1771 CallFrame* callFrame = ARG_callFrame; | 1760 CallFrame* callFrame = ARG_callFrame; |
1772 | 1761 |
1773 if (JSFastMath::canDoFastUrshift(val, shift)) | 1762 if (JSFastMath::canDoFastUrshift(val, shift)) |
1774 return JSValuePtr::encode(JSFastMath::rightShiftImmediateNumbers(val, sh
ift)); | 1763 return JSValuePtr::encode(JSFastMath::rightShiftImmediateNumbers(val, sh
ift)); |
1775 else { | 1764 else { |
1776 JSValuePtr result = jsNumber(ARG_globalData, (val.toUInt32(callFrame)) >
> (shift.toUInt32(callFrame) & 0x1f)); | 1765 JSValuePtr result = jsNumber(ARG_globalData, (val.toUInt32(callFrame)) >
> (shift.toUInt32(callFrame) & 0x1f)); |
1777 CHECK_FOR_EXCEPTION_AT_END(); | 1766 CHECK_FOR_EXCEPTION_AT_END(); |
1778 return JSValuePtr::encode(result); | 1767 return JSValuePtr::encode(result); |
1779 } | 1768 } |
1780 } | 1769 } |
1781 | 1770 |
1782 JSValueEncodedAsPointer* Interpreter::cti_op_bitxor(STUB_ARGS) | 1771 JSValueEncodedAsPointer* JITStubs::cti_op_bitxor(STUB_ARGS) |
1783 { | 1772 { |
1784 BEGIN_STUB_FUNCTION(); | 1773 BEGIN_STUB_FUNCTION(); |
1785 | 1774 |
1786 JSValuePtr src1 = ARG_src1; | 1775 JSValuePtr src1 = ARG_src1; |
1787 JSValuePtr src2 = ARG_src2; | 1776 JSValuePtr src2 = ARG_src2; |
1788 | 1777 |
1789 CallFrame* callFrame = ARG_callFrame; | 1778 CallFrame* callFrame = ARG_callFrame; |
1790 | 1779 |
1791 JSValuePtr result = jsNumber(ARG_globalData, src1.toInt32(callFrame) ^ src2.
toInt32(callFrame)); | 1780 JSValuePtr result = jsNumber(ARG_globalData, src1.toInt32(callFrame) ^ src2.
toInt32(callFrame)); |
1792 CHECK_FOR_EXCEPTION_AT_END(); | 1781 CHECK_FOR_EXCEPTION_AT_END(); |
1793 return JSValuePtr::encode(result); | 1782 return JSValuePtr::encode(result); |
1794 } | 1783 } |
1795 | 1784 |
1796 JSObject* Interpreter::cti_op_new_regexp(STUB_ARGS) | 1785 JSObject* JITStubs::cti_op_new_regexp(STUB_ARGS) |
1797 { | 1786 { |
1798 BEGIN_STUB_FUNCTION(); | 1787 BEGIN_STUB_FUNCTION(); |
1799 | 1788 |
1800 return new (ARG_globalData) RegExpObject(ARG_callFrame->lexicalGlobalObject(
)->regExpStructure(), ARG_regexp1); | 1789 return new (ARG_globalData) RegExpObject(ARG_callFrame->lexicalGlobalObject(
)->regExpStructure(), ARG_regexp1); |
1801 } | 1790 } |
1802 | 1791 |
1803 JSValueEncodedAsPointer* Interpreter::cti_op_bitor(STUB_ARGS) | 1792 JSValueEncodedAsPointer* JITStubs::cti_op_bitor(STUB_ARGS) |
1804 { | 1793 { |
1805 BEGIN_STUB_FUNCTION(); | 1794 BEGIN_STUB_FUNCTION(); |
1806 | 1795 |
1807 JSValuePtr src1 = ARG_src1; | 1796 JSValuePtr src1 = ARG_src1; |
1808 JSValuePtr src2 = ARG_src2; | 1797 JSValuePtr src2 = ARG_src2; |
1809 | 1798 |
1810 CallFrame* callFrame = ARG_callFrame; | 1799 CallFrame* callFrame = ARG_callFrame; |
1811 | 1800 |
1812 JSValuePtr result = jsNumber(ARG_globalData, src1.toInt32(callFrame) | src2.
toInt32(callFrame)); | 1801 JSValuePtr result = jsNumber(ARG_globalData, src1.toInt32(callFrame) | src2.
toInt32(callFrame)); |
1813 CHECK_FOR_EXCEPTION_AT_END(); | 1802 CHECK_FOR_EXCEPTION_AT_END(); |
1814 return JSValuePtr::encode(result); | 1803 return JSValuePtr::encode(result); |
1815 } | 1804 } |
1816 | 1805 |
1817 JSValueEncodedAsPointer* Interpreter::cti_op_call_eval(STUB_ARGS) | 1806 JSValueEncodedAsPointer* JITStubs::cti_op_call_eval(STUB_ARGS) |
1818 { | 1807 { |
1819 BEGIN_STUB_FUNCTION(); | 1808 BEGIN_STUB_FUNCTION(); |
1820 | 1809 |
1821 CallFrame* callFrame = ARG_callFrame; | 1810 CallFrame* callFrame = ARG_callFrame; |
1822 RegisterFile* registerFile = ARG_registerFile; | 1811 RegisterFile* registerFile = ARG_registerFile; |
1823 | 1812 |
1824 Interpreter* interpreter = ARG_globalData->interpreter; | 1813 Interpreter* interpreter = ARG_globalData->interpreter; |
1825 | 1814 |
1826 JSValuePtr funcVal = ARG_src1; | 1815 JSValuePtr funcVal = ARG_src1; |
1827 int registerOffset = ARG_int2; | 1816 int registerOffset = ARG_int2; |
(...skipping 10 matching lines...) Expand all Loading... |
1838 if (UNLIKELY(exceptionValue != noValue())) { | 1827 if (UNLIKELY(exceptionValue != noValue())) { |
1839 ARG_globalData->exception = exceptionValue; | 1828 ARG_globalData->exception = exceptionValue; |
1840 VM_THROW_EXCEPTION_AT_END(); | 1829 VM_THROW_EXCEPTION_AT_END(); |
1841 } | 1830 } |
1842 return JSValuePtr::encode(result); | 1831 return JSValuePtr::encode(result); |
1843 } | 1832 } |
1844 | 1833 |
1845 return JSValuePtr::encode(jsImpossibleValue()); | 1834 return JSValuePtr::encode(jsImpossibleValue()); |
1846 } | 1835 } |
1847 | 1836 |
1848 JSValueEncodedAsPointer* Interpreter::cti_op_throw(STUB_ARGS) | 1837 JSValueEncodedAsPointer* JITStubs::cti_op_throw(STUB_ARGS) |
1849 { | 1838 { |
1850 BEGIN_STUB_FUNCTION(); | 1839 BEGIN_STUB_FUNCTION(); |
1851 | 1840 |
1852 CallFrame* callFrame = ARG_callFrame; | 1841 CallFrame* callFrame = ARG_callFrame; |
1853 CodeBlock* codeBlock = callFrame->codeBlock(); | 1842 CodeBlock* codeBlock = callFrame->codeBlock(); |
1854 | 1843 |
1855 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); | 1844 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRE
SS); |
1856 | 1845 |
1857 JSValuePtr exceptionValue = ARG_src1; | 1846 JSValuePtr exceptionValue = ARG_src1; |
1858 ASSERT(exceptionValue); | 1847 ASSERT(exceptionValue); |
1859 | 1848 |
1860 HandlerInfo* handler = ARG_globalData->interpreter->throwException(callFrame
, exceptionValue, vPCIndex, true); | 1849 HandlerInfo* handler = ARG_globalData->interpreter->throwException(callFrame
, exceptionValue, vPCIndex, true); |
1861 | 1850 |
1862 if (!handler) { | 1851 if (!handler) { |
1863 *ARG_exception = exceptionValue; | 1852 *ARG_exception = exceptionValue; |
1864 return JSValuePtr::encode(jsNull()); | 1853 return JSValuePtr::encode(jsNull()); |
1865 } | 1854 } |
1866 | 1855 |
1867 ARG_setCallFrame(callFrame); | 1856 ARG_setCallFrame(callFrame); |
1868 void* catchRoutine = handler->nativeCode.addressForExceptionHandler(); | 1857 void* catchRoutine = handler->nativeCode.addressForExceptionHandler(); |
1869 ASSERT(catchRoutine); | 1858 ASSERT(catchRoutine); |
1870 STUB_SET_RETURN_ADDRESS(catchRoutine); | 1859 STUB_SET_RETURN_ADDRESS(catchRoutine); |
1871 return JSValuePtr::encode(exceptionValue); | 1860 return JSValuePtr::encode(exceptionValue); |
1872 } | 1861 } |
1873 | 1862 |
1874 JSPropertyNameIterator* Interpreter::cti_op_get_pnames(STUB_ARGS) | 1863 JSPropertyNameIterator* JITStubs::cti_op_get_pnames(STUB_ARGS) |
1875 { | 1864 { |
1876 BEGIN_STUB_FUNCTION(); | 1865 BEGIN_STUB_FUNCTION(); |
1877 | 1866 |
1878 return JSPropertyNameIterator::create(ARG_callFrame, ARG_src1); | 1867 return JSPropertyNameIterator::create(ARG_callFrame, ARG_src1); |
1879 } | 1868 } |
1880 | 1869 |
1881 JSValueEncodedAsPointer* Interpreter::cti_op_next_pname(STUB_ARGS) | 1870 JSValueEncodedAsPointer* JITStubs::cti_op_next_pname(STUB_ARGS) |
1882 { | 1871 { |
1883 BEGIN_STUB_FUNCTION(); | 1872 BEGIN_STUB_FUNCTION(); |
1884 | 1873 |
1885 JSPropertyNameIterator* it = ARG_pni1; | 1874 JSPropertyNameIterator* it = ARG_pni1; |
1886 JSValuePtr temp = it->next(ARG_callFrame); | 1875 JSValuePtr temp = it->next(ARG_callFrame); |
1887 if (!temp) | 1876 if (!temp) |
1888 it->invalidate(); | 1877 it->invalidate(); |
1889 return JSValuePtr::encode(temp); | 1878 return JSValuePtr::encode(temp); |
1890 } | 1879 } |
1891 | 1880 |
1892 JSObject* Interpreter::cti_op_push_scope(STUB_ARGS) | 1881 JSObject* JITStubs::cti_op_push_scope(STUB_ARGS) |
1893 { | 1882 { |
1894 BEGIN_STUB_FUNCTION(); | 1883 BEGIN_STUB_FUNCTION(); |
1895 | 1884 |
1896 JSObject* o = ARG_src1.toObject(ARG_callFrame); | 1885 JSObject* o = ARG_src1.toObject(ARG_callFrame); |
1897 CHECK_FOR_EXCEPTION(); | 1886 CHECK_FOR_EXCEPTION(); |
1898 ARG_callFrame->setScopeChain(ARG_callFrame->scopeChain()->push(o)); | 1887 ARG_callFrame->setScopeChain(ARG_callFrame->scopeChain()->push(o)); |
1899 return o; | 1888 return o; |
1900 } | 1889 } |
1901 | 1890 |
1902 void Interpreter::cti_op_pop_scope(STUB_ARGS) | 1891 void JITStubs::cti_op_pop_scope(STUB_ARGS) |
1903 { | 1892 { |
1904 BEGIN_STUB_FUNCTION(); | 1893 BEGIN_STUB_FUNCTION(); |
1905 | 1894 |
1906 ARG_callFrame->setScopeChain(ARG_callFrame->scopeChain()->pop()); | 1895 ARG_callFrame->setScopeChain(ARG_callFrame->scopeChain()->pop()); |
1907 } | 1896 } |
1908 | 1897 |
1909 JSValueEncodedAsPointer* Interpreter::cti_op_typeof(STUB_ARGS) | 1898 JSValueEncodedAsPointer* JITStubs::cti_op_typeof(STUB_ARGS) |
1910 { | 1899 { |
1911 BEGIN_STUB_FUNCTION(); | 1900 BEGIN_STUB_FUNCTION(); |
1912 | 1901 |
1913 return JSValuePtr::encode(jsTypeStringForValue(ARG_callFrame, ARG_src1)); | 1902 return JSValuePtr::encode(jsTypeStringForValue(ARG_callFrame, ARG_src1)); |
1914 } | 1903 } |
1915 | 1904 |
1916 JSValueEncodedAsPointer* Interpreter::cti_op_is_undefined(STUB_ARGS) | 1905 JSValueEncodedAsPointer* JITStubs::cti_op_is_undefined(STUB_ARGS) |
1917 { | 1906 { |
1918 BEGIN_STUB_FUNCTION(); | 1907 BEGIN_STUB_FUNCTION(); |
1919 | 1908 |
1920 JSValuePtr v = ARG_src1; | 1909 JSValuePtr v = ARG_src1; |
1921 return JSValuePtr::encode(jsBoolean(v.isCell() ? v.asCell()->structure()->ty
peInfo().masqueradesAsUndefined() : v.isUndefined())); | 1910 return JSValuePtr::encode(jsBoolean(v.isCell() ? v.asCell()->structure()->ty
peInfo().masqueradesAsUndefined() : v.isUndefined())); |
1922 } | 1911 } |
1923 | 1912 |
1924 JSValueEncodedAsPointer* Interpreter::cti_op_is_boolean(STUB_ARGS) | 1913 JSValueEncodedAsPointer* JITStubs::cti_op_is_boolean(STUB_ARGS) |
1925 { | 1914 { |
1926 BEGIN_STUB_FUNCTION(); | 1915 BEGIN_STUB_FUNCTION(); |
1927 | 1916 |
1928 return JSValuePtr::encode(jsBoolean(ARG_src1.isBoolean())); | 1917 return JSValuePtr::encode(jsBoolean(ARG_src1.isBoolean())); |
1929 } | 1918 } |
1930 | 1919 |
1931 JSValueEncodedAsPointer* Interpreter::cti_op_is_number(STUB_ARGS) | 1920 JSValueEncodedAsPointer* JITStubs::cti_op_is_number(STUB_ARGS) |
1932 { | 1921 { |
1933 BEGIN_STUB_FUNCTION(); | 1922 BEGIN_STUB_FUNCTION(); |
1934 | 1923 |
1935 return JSValuePtr::encode(jsBoolean(ARG_src1.isNumber())); | 1924 return JSValuePtr::encode(jsBoolean(ARG_src1.isNumber())); |
1936 } | 1925 } |
1937 | 1926 |
1938 JSValueEncodedAsPointer* Interpreter::cti_op_is_string(STUB_ARGS) | 1927 JSValueEncodedAsPointer* JITStubs::cti_op_is_string(STUB_ARGS) |
1939 { | 1928 { |
1940 BEGIN_STUB_FUNCTION(); | 1929 BEGIN_STUB_FUNCTION(); |
1941 | 1930 |
1942 return JSValuePtr::encode(jsBoolean(ARG_globalData->interpreter->isJSString(
ARG_src1))); | 1931 return JSValuePtr::encode(jsBoolean(isJSString(ARG_globalData, ARG_src1))); |
1943 } | 1932 } |
1944 | 1933 |
1945 JSValueEncodedAsPointer* Interpreter::cti_op_is_object(STUB_ARGS) | 1934 JSValueEncodedAsPointer* JITStubs::cti_op_is_object(STUB_ARGS) |
1946 { | 1935 { |
1947 BEGIN_STUB_FUNCTION(); | 1936 BEGIN_STUB_FUNCTION(); |
1948 | 1937 |
1949 return JSValuePtr::encode(jsBoolean(jsIsObjectType(ARG_src1))); | 1938 return JSValuePtr::encode(jsBoolean(jsIsObjectType(ARG_src1))); |
1950 } | 1939 } |
1951 | 1940 |
1952 JSValueEncodedAsPointer* Interpreter::cti_op_is_function(STUB_ARGS) | 1941 JSValueEncodedAsPointer* JITStubs::cti_op_is_function(STUB_ARGS) |
1953 { | 1942 { |
1954 BEGIN_STUB_FUNCTION(); | 1943 BEGIN_STUB_FUNCTION(); |
1955 | 1944 |
1956 return JSValuePtr::encode(jsBoolean(jsIsFunctionType(ARG_src1))); | 1945 return JSValuePtr::encode(jsBoolean(jsIsFunctionType(ARG_src1))); |
1957 } | 1946 } |
1958 | 1947 |
1959 JSValueEncodedAsPointer* Interpreter::cti_op_stricteq(STUB_ARGS) | 1948 JSValueEncodedAsPointer* JITStubs::cti_op_stricteq(STUB_ARGS) |
1960 { | 1949 { |
1961 BEGIN_STUB_FUNCTION(); | 1950 BEGIN_STUB_FUNCTION(); |
1962 | 1951 |
1963 JSValuePtr src1 = ARG_src1; | 1952 JSValuePtr src1 = ARG_src1; |
1964 JSValuePtr src2 = ARG_src2; | 1953 JSValuePtr src2 = ARG_src2; |
1965 | 1954 |
1966 return JSValuePtr::encode(jsBoolean(JSValuePtr::strictEqual(src1, src2))); | 1955 return JSValuePtr::encode(jsBoolean(JSValuePtr::strictEqual(src1, src2))); |
1967 } | 1956 } |
1968 | 1957 |
1969 JSValueEncodedAsPointer* Interpreter::cti_op_nstricteq(STUB_ARGS) | 1958 JSValueEncodedAsPointer* JITStubs::cti_op_nstricteq(STUB_ARGS) |
1970 { | 1959 { |
1971 BEGIN_STUB_FUNCTION(); | 1960 BEGIN_STUB_FUNCTION(); |
1972 | 1961 |
1973 JSValuePtr src1 = ARG_src1; | 1962 JSValuePtr src1 = ARG_src1; |
1974 JSValuePtr src2 = ARG_src2; | 1963 JSValuePtr src2 = ARG_src2; |
1975 | 1964 |
1976 return JSValuePtr::encode(jsBoolean(!JSValuePtr::strictEqual(src1, src2))); | 1965 return JSValuePtr::encode(jsBoolean(!JSValuePtr::strictEqual(src1, src2))); |
1977 } | 1966 } |
1978 | 1967 |
1979 JSValueEncodedAsPointer* Interpreter::cti_op_to_jsnumber(STUB_ARGS) | 1968 JSValueEncodedAsPointer* JITStubs::cti_op_to_jsnumber(STUB_ARGS) |
1980 { | 1969 { |
1981 BEGIN_STUB_FUNCTION(); | 1970 BEGIN_STUB_FUNCTION(); |
1982 | 1971 |
1983 JSValuePtr src = ARG_src1; | 1972 JSValuePtr src = ARG_src1; |
1984 CallFrame* callFrame = ARG_callFrame; | 1973 CallFrame* callFrame = ARG_callFrame; |
1985 | 1974 |
1986 JSValuePtr result = src.toJSNumber(callFrame); | 1975 JSValuePtr result = src.toJSNumber(callFrame); |
1987 CHECK_FOR_EXCEPTION_AT_END(); | 1976 CHECK_FOR_EXCEPTION_AT_END(); |
1988 return JSValuePtr::encode(result); | 1977 return JSValuePtr::encode(result); |
1989 } | 1978 } |
1990 | 1979 |
1991 JSValueEncodedAsPointer* Interpreter::cti_op_in(STUB_ARGS) | 1980 JSValueEncodedAsPointer* JITStubs::cti_op_in(STUB_ARGS) |
1992 { | 1981 { |
1993 BEGIN_STUB_FUNCTION(); | 1982 BEGIN_STUB_FUNCTION(); |
1994 | 1983 |
1995 CallFrame* callFrame = ARG_callFrame; | 1984 CallFrame* callFrame = ARG_callFrame; |
1996 JSValuePtr baseVal = ARG_src2; | 1985 JSValuePtr baseVal = ARG_src2; |
1997 | 1986 |
1998 if (!baseVal.isObject()) { | 1987 if (!baseVal.isObject()) { |
1999 CallFrame* callFrame = ARG_callFrame; | 1988 CallFrame* callFrame = ARG_callFrame; |
2000 CodeBlock* codeBlock = callFrame->codeBlock(); | 1989 CodeBlock* codeBlock = callFrame->codeBlock(); |
2001 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_A
DDRESS); | 1990 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_A
DDRESS); |
2002 ARG_globalData->exception = createInvalidParamError(callFrame, "in", bas
eVal, vPCIndex, codeBlock); | 1991 ARG_globalData->exception = createInvalidParamError(callFrame, "in", bas
eVal, vPCIndex, codeBlock); |
2003 VM_THROW_EXCEPTION(); | 1992 VM_THROW_EXCEPTION(); |
2004 } | 1993 } |
2005 | 1994 |
2006 JSValuePtr propName = ARG_src1; | 1995 JSValuePtr propName = ARG_src1; |
2007 JSObject* baseObj = asObject(baseVal); | 1996 JSObject* baseObj = asObject(baseVal); |
2008 | 1997 |
2009 uint32_t i; | 1998 uint32_t i; |
2010 if (propName.getUInt32(i)) | 1999 if (propName.getUInt32(i)) |
2011 return JSValuePtr::encode(jsBoolean(baseObj->hasProperty(callFrame, i)))
; | 2000 return JSValuePtr::encode(jsBoolean(baseObj->hasProperty(callFrame, i)))
; |
2012 | 2001 |
2013 Identifier property(callFrame, propName.toString(callFrame)); | 2002 Identifier property(callFrame, propName.toString(callFrame)); |
2014 CHECK_FOR_EXCEPTION(); | 2003 CHECK_FOR_EXCEPTION(); |
2015 return JSValuePtr::encode(jsBoolean(baseObj->hasProperty(callFrame, property
))); | 2004 return JSValuePtr::encode(jsBoolean(baseObj->hasProperty(callFrame, property
))); |
2016 } | 2005 } |
2017 | 2006 |
2018 JSObject* Interpreter::cti_op_push_new_scope(STUB_ARGS) | 2007 JSObject* JITStubs::cti_op_push_new_scope(STUB_ARGS) |
2019 { | 2008 { |
2020 BEGIN_STUB_FUNCTION(); | 2009 BEGIN_STUB_FUNCTION(); |
2021 | 2010 |
2022 JSObject* scope = new (ARG_globalData) JSStaticScopeObject(ARG_callFrame, *A
RG_id1, ARG_src2, DontDelete); | 2011 JSObject* scope = new (ARG_globalData) JSStaticScopeObject(ARG_callFrame, *A
RG_id1, ARG_src2, DontDelete); |
2023 | 2012 |
2024 CallFrame* callFrame = ARG_callFrame; | 2013 CallFrame* callFrame = ARG_callFrame; |
2025 callFrame->setScopeChain(callFrame->scopeChain()->push(scope)); | 2014 callFrame->setScopeChain(callFrame->scopeChain()->push(scope)); |
2026 return scope; | 2015 return scope; |
2027 } | 2016 } |
2028 | 2017 |
2029 void Interpreter::cti_op_jmp_scopes(STUB_ARGS) | 2018 void JITStubs::cti_op_jmp_scopes(STUB_ARGS) |
2030 { | 2019 { |
2031 BEGIN_STUB_FUNCTION(); | 2020 BEGIN_STUB_FUNCTION(); |
2032 | 2021 |
2033 unsigned count = ARG_int1; | 2022 unsigned count = ARG_int1; |
2034 CallFrame* callFrame = ARG_callFrame; | 2023 CallFrame* callFrame = ARG_callFrame; |
2035 | 2024 |
2036 ScopeChainNode* tmp = callFrame->scopeChain(); | 2025 ScopeChainNode* tmp = callFrame->scopeChain(); |
2037 while (count--) | 2026 while (count--) |
2038 tmp = tmp->pop(); | 2027 tmp = tmp->pop(); |
2039 callFrame->setScopeChain(tmp); | 2028 callFrame->setScopeChain(tmp); |
2040 } | 2029 } |
2041 | 2030 |
2042 void Interpreter::cti_op_put_by_index(STUB_ARGS) | 2031 void JITStubs::cti_op_put_by_index(STUB_ARGS) |
2043 { | 2032 { |
2044 BEGIN_STUB_FUNCTION(); | 2033 BEGIN_STUB_FUNCTION(); |
2045 | 2034 |
2046 CallFrame* callFrame = ARG_callFrame; | 2035 CallFrame* callFrame = ARG_callFrame; |
2047 unsigned property = ARG_int2; | 2036 unsigned property = ARG_int2; |
2048 | 2037 |
2049 ARG_src1.put(callFrame, property, ARG_src3); | 2038 ARG_src1.put(callFrame, property, ARG_src3); |
2050 } | 2039 } |
2051 | 2040 |
2052 void* Interpreter::cti_op_switch_imm(STUB_ARGS) | 2041 void* JITStubs::cti_op_switch_imm(STUB_ARGS) |
2053 { | 2042 { |
2054 BEGIN_STUB_FUNCTION(); | 2043 BEGIN_STUB_FUNCTION(); |
2055 | 2044 |
2056 JSValuePtr scrutinee = ARG_src1; | 2045 JSValuePtr scrutinee = ARG_src1; |
2057 unsigned tableIndex = ARG_int2; | 2046 unsigned tableIndex = ARG_int2; |
2058 CallFrame* callFrame = ARG_callFrame; | 2047 CallFrame* callFrame = ARG_callFrame; |
2059 CodeBlock* codeBlock = callFrame->codeBlock(); | 2048 CodeBlock* codeBlock = callFrame->codeBlock(); |
2060 | 2049 |
2061 if (scrutinee.isInt32Fast()) | 2050 if (scrutinee.isInt32Fast()) |
2062 return codeBlock->immediateSwitchJumpTable(tableIndex).ctiForValue(scrut
inee.getInt32Fast()).addressForSwitch(); | 2051 return codeBlock->immediateSwitchJumpTable(tableIndex).ctiForValue(scrut
inee.getInt32Fast()).addressForSwitch(); |
2063 else { | 2052 else { |
2064 int32_t value; | 2053 int32_t value; |
2065 if (scrutinee.numberToInt32(value)) | 2054 if (scrutinee.numberToInt32(value)) |
2066 return codeBlock->immediateSwitchJumpTable(tableIndex).ctiForValue(v
alue).addressForSwitch(); | 2055 return codeBlock->immediateSwitchJumpTable(tableIndex).ctiForValue(v
alue).addressForSwitch(); |
2067 else | 2056 else |
2068 return codeBlock->immediateSwitchJumpTable(tableIndex).ctiDefault.ad
dressForSwitch(); | 2057 return codeBlock->immediateSwitchJumpTable(tableIndex).ctiDefault.ad
dressForSwitch(); |
2069 } | 2058 } |
2070 } | 2059 } |
2071 | 2060 |
2072 void* Interpreter::cti_op_switch_char(STUB_ARGS) | 2061 void* JITStubs::cti_op_switch_char(STUB_ARGS) |
2073 { | 2062 { |
2074 BEGIN_STUB_FUNCTION(); | 2063 BEGIN_STUB_FUNCTION(); |
2075 | 2064 |
2076 JSValuePtr scrutinee = ARG_src1; | 2065 JSValuePtr scrutinee = ARG_src1; |
2077 unsigned tableIndex = ARG_int2; | 2066 unsigned tableIndex = ARG_int2; |
2078 CallFrame* callFrame = ARG_callFrame; | 2067 CallFrame* callFrame = ARG_callFrame; |
2079 CodeBlock* codeBlock = callFrame->codeBlock(); | 2068 CodeBlock* codeBlock = callFrame->codeBlock(); |
2080 | 2069 |
2081 void* result = codeBlock->characterSwitchJumpTable(tableIndex).ctiDefault.ad
dressForSwitch(); | 2070 void* result = codeBlock->characterSwitchJumpTable(tableIndex).ctiDefault.ad
dressForSwitch(); |
2082 | 2071 |
2083 if (scrutinee.isString()) { | 2072 if (scrutinee.isString()) { |
2084 UString::Rep* value = asString(scrutinee)->value().rep(); | 2073 UString::Rep* value = asString(scrutinee)->value().rep(); |
2085 if (value->size() == 1) | 2074 if (value->size() == 1) |
2086 result = codeBlock->characterSwitchJumpTable(tableIndex).ctiForValue
(value->data()[0]).addressForSwitch(); | 2075 result = codeBlock->characterSwitchJumpTable(tableIndex).ctiForValue
(value->data()[0]).addressForSwitch(); |
2087 } | 2076 } |
2088 | 2077 |
2089 return result; | 2078 return result; |
2090 } | 2079 } |
2091 | 2080 |
2092 void* Interpreter::cti_op_switch_string(STUB_ARGS) | 2081 void* JITStubs::cti_op_switch_string(STUB_ARGS) |
2093 { | 2082 { |
2094 BEGIN_STUB_FUNCTION(); | 2083 BEGIN_STUB_FUNCTION(); |
2095 | 2084 |
2096 JSValuePtr scrutinee = ARG_src1; | 2085 JSValuePtr scrutinee = ARG_src1; |
2097 unsigned tableIndex = ARG_int2; | 2086 unsigned tableIndex = ARG_int2; |
2098 CallFrame* callFrame = ARG_callFrame; | 2087 CallFrame* callFrame = ARG_callFrame; |
2099 CodeBlock* codeBlock = callFrame->codeBlock(); | 2088 CodeBlock* codeBlock = callFrame->codeBlock(); |
2100 | 2089 |
2101 void* result = codeBlock->stringSwitchJumpTable(tableIndex).ctiDefault.addre
ssForSwitch(); | 2090 void* result = codeBlock->stringSwitchJumpTable(tableIndex).ctiDefault.addre
ssForSwitch(); |
2102 | 2091 |
2103 if (scrutinee.isString()) { | 2092 if (scrutinee.isString()) { |
2104 UString::Rep* value = asString(scrutinee)->value().rep(); | 2093 UString::Rep* value = asString(scrutinee)->value().rep(); |
2105 result = codeBlock->stringSwitchJumpTable(tableIndex).ctiForValue(value)
.addressForSwitch(); | 2094 result = codeBlock->stringSwitchJumpTable(tableIndex).ctiForValue(value)
.addressForSwitch(); |
2106 } | 2095 } |
2107 | 2096 |
2108 return result; | 2097 return result; |
2109 } | 2098 } |
2110 | 2099 |
2111 JSValueEncodedAsPointer* Interpreter::cti_op_del_by_val(STUB_ARGS) | 2100 JSValueEncodedAsPointer* JITStubs::cti_op_del_by_val(STUB_ARGS) |
2112 { | 2101 { |
2113 BEGIN_STUB_FUNCTION(); | 2102 BEGIN_STUB_FUNCTION(); |
2114 | 2103 |
2115 CallFrame* callFrame = ARG_callFrame; | 2104 CallFrame* callFrame = ARG_callFrame; |
2116 | 2105 |
2117 JSValuePtr baseValue = ARG_src1; | 2106 JSValuePtr baseValue = ARG_src1; |
2118 JSObject* baseObj = baseValue.toObject(callFrame); // may throw | 2107 JSObject* baseObj = baseValue.toObject(callFrame); // may throw |
2119 | 2108 |
2120 JSValuePtr subscript = ARG_src2; | 2109 JSValuePtr subscript = ARG_src2; |
2121 JSValuePtr result; | 2110 JSValuePtr result; |
2122 uint32_t i; | 2111 uint32_t i; |
2123 if (subscript.getUInt32(i)) | 2112 if (subscript.getUInt32(i)) |
2124 result = jsBoolean(baseObj->deleteProperty(callFrame, i)); | 2113 result = jsBoolean(baseObj->deleteProperty(callFrame, i)); |
2125 else { | 2114 else { |
2126 CHECK_FOR_EXCEPTION(); | 2115 CHECK_FOR_EXCEPTION(); |
2127 Identifier property(callFrame, subscript.toString(callFrame)); | 2116 Identifier property(callFrame, subscript.toString(callFrame)); |
2128 CHECK_FOR_EXCEPTION(); | 2117 CHECK_FOR_EXCEPTION(); |
2129 result = jsBoolean(baseObj->deleteProperty(callFrame, property)); | 2118 result = jsBoolean(baseObj->deleteProperty(callFrame, property)); |
2130 } | 2119 } |
2131 | 2120 |
2132 CHECK_FOR_EXCEPTION_AT_END(); | 2121 CHECK_FOR_EXCEPTION_AT_END(); |
2133 return JSValuePtr::encode(result); | 2122 return JSValuePtr::encode(result); |
2134 } | 2123 } |
2135 | 2124 |
2136 void Interpreter::cti_op_put_getter(STUB_ARGS) | 2125 void JITStubs::cti_op_put_getter(STUB_ARGS) |
2137 { | 2126 { |
2138 BEGIN_STUB_FUNCTION(); | 2127 BEGIN_STUB_FUNCTION(); |
2139 | 2128 |
2140 CallFrame* callFrame = ARG_callFrame; | 2129 CallFrame* callFrame = ARG_callFrame; |
2141 | 2130 |
2142 ASSERT(ARG_src1.isObject()); | 2131 ASSERT(ARG_src1.isObject()); |
2143 JSObject* baseObj = asObject(ARG_src1); | 2132 JSObject* baseObj = asObject(ARG_src1); |
2144 ASSERT(ARG_src3.isObject()); | 2133 ASSERT(ARG_src3.isObject()); |
2145 baseObj->defineGetter(callFrame, *ARG_id2, asObject(ARG_src3)); | 2134 baseObj->defineGetter(callFrame, *ARG_id2, asObject(ARG_src3)); |
2146 } | 2135 } |
2147 | 2136 |
2148 void Interpreter::cti_op_put_setter(STUB_ARGS) | 2137 void JITStubs::cti_op_put_setter(STUB_ARGS) |
2149 { | 2138 { |
2150 BEGIN_STUB_FUNCTION(); | 2139 BEGIN_STUB_FUNCTION(); |
2151 | 2140 |
2152 CallFrame* callFrame = ARG_callFrame; | 2141 CallFrame* callFrame = ARG_callFrame; |
2153 | 2142 |
2154 ASSERT(ARG_src1.isObject()); | 2143 ASSERT(ARG_src1.isObject()); |
2155 JSObject* baseObj = asObject(ARG_src1); | 2144 JSObject* baseObj = asObject(ARG_src1); |
2156 ASSERT(ARG_src3.isObject()); | 2145 ASSERT(ARG_src3.isObject()); |
2157 baseObj->defineSetter(callFrame, *ARG_id2, asObject(ARG_src3)); | 2146 baseObj->defineSetter(callFrame, *ARG_id2, asObject(ARG_src3)); |
2158 } | 2147 } |
2159 | 2148 |
2160 JSObject* Interpreter::cti_op_new_error(STUB_ARGS) | 2149 JSObject* JITStubs::cti_op_new_error(STUB_ARGS) |
2161 { | 2150 { |
2162 BEGIN_STUB_FUNCTION(); | 2151 BEGIN_STUB_FUNCTION(); |
2163 | 2152 |
2164 CallFrame* callFrame = ARG_callFrame; | 2153 CallFrame* callFrame = ARG_callFrame; |
2165 CodeBlock* codeBlock = callFrame->codeBlock(); | 2154 CodeBlock* codeBlock = callFrame->codeBlock(); |
2166 unsigned type = ARG_int1; | 2155 unsigned type = ARG_int1; |
2167 JSValuePtr message = ARG_src2; | 2156 JSValuePtr message = ARG_src2; |
2168 unsigned bytecodeOffset = ARG_int3; | 2157 unsigned bytecodeOffset = ARG_int3; |
2169 | 2158 |
2170 unsigned lineNumber = codeBlock->lineNumberForBytecodeOffset(callFrame, byte
codeOffset); | 2159 unsigned lineNumber = codeBlock->lineNumberForBytecodeOffset(callFrame, byte
codeOffset); |
2171 return Error::create(callFrame, static_cast<ErrorType>(type), message.toStri
ng(callFrame), lineNumber, codeBlock->ownerNode()->sourceID(), codeBlock->ownerN
ode()->sourceURL()); | 2160 return Error::create(callFrame, static_cast<ErrorType>(type), message.toStri
ng(callFrame), lineNumber, codeBlock->ownerNode()->sourceID(), codeBlock->ownerN
ode()->sourceURL()); |
2172 } | 2161 } |
2173 | 2162 |
2174 void Interpreter::cti_op_debug(STUB_ARGS) | 2163 void JITStubs::cti_op_debug(STUB_ARGS) |
2175 { | 2164 { |
2176 BEGIN_STUB_FUNCTION(); | 2165 BEGIN_STUB_FUNCTION(); |
2177 | 2166 |
2178 CallFrame* callFrame = ARG_callFrame; | 2167 CallFrame* callFrame = ARG_callFrame; |
2179 | 2168 |
2180 int debugHookID = ARG_int1; | 2169 int debugHookID = ARG_int1; |
2181 int firstLine = ARG_int2; | 2170 int firstLine = ARG_int2; |
2182 int lastLine = ARG_int3; | 2171 int lastLine = ARG_int3; |
2183 | 2172 |
2184 ARG_globalData->interpreter->debug(callFrame, static_cast<DebugHookID>(debug
HookID), firstLine, lastLine); | 2173 ARG_globalData->interpreter->debug(callFrame, static_cast<DebugHookID>(debug
HookID), firstLine, lastLine); |
2185 } | 2174 } |
2186 | 2175 |
2187 JSValueEncodedAsPointer* Interpreter::cti_vm_throw(STUB_ARGS) | 2176 JSValueEncodedAsPointer* JITStubs::cti_vm_throw(STUB_ARGS) |
2188 { | 2177 { |
2189 BEGIN_STUB_FUNCTION(); | 2178 BEGIN_STUB_FUNCTION(); |
2190 | 2179 |
2191 CallFrame* callFrame = ARG_callFrame; | 2180 CallFrame* callFrame = ARG_callFrame; |
2192 CodeBlock* codeBlock = callFrame->codeBlock(); | 2181 CodeBlock* codeBlock = callFrame->codeBlock(); |
2193 JSGlobalData* globalData = ARG_globalData; | 2182 JSGlobalData* globalData = ARG_globalData; |
2194 | 2183 |
2195 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, globalData->excep
tionLocation); | 2184 unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, globalData->excep
tionLocation); |
2196 | 2185 |
2197 JSValuePtr exceptionValue = globalData->exception; | 2186 JSValuePtr exceptionValue = globalData->exception; |
(...skipping 17 matching lines...) Expand all Loading... |
2215 #undef STUB_RETURN_ADDRESS | 2204 #undef STUB_RETURN_ADDRESS |
2216 #undef STUB_SET_RETURN_ADDRESS | 2205 #undef STUB_SET_RETURN_ADDRESS |
2217 #undef BEGIN_STUB_FUNCTION | 2206 #undef BEGIN_STUB_FUNCTION |
2218 #undef CHECK_FOR_EXCEPTION | 2207 #undef CHECK_FOR_EXCEPTION |
2219 #undef CHECK_FOR_EXCEPTION_AT_END | 2208 #undef CHECK_FOR_EXCEPTION_AT_END |
2220 #undef CHECK_FOR_EXCEPTION_VOID | 2209 #undef CHECK_FOR_EXCEPTION_VOID |
2221 #undef VM_THROW_EXCEPTION | 2210 #undef VM_THROW_EXCEPTION |
2222 #undef VM_THROW_EXCEPTION_2 | 2211 #undef VM_THROW_EXCEPTION_2 |
2223 #undef VM_THROW_EXCEPTION_AT_END | 2212 #undef VM_THROW_EXCEPTION_AT_END |
2224 | 2213 |
| 2214 } // namespace JSC |
| 2215 |
2225 #endif // ENABLE(JIT) | 2216 #endif // ENABLE(JIT) |
2226 | |
2227 } // namespace JSC | |
OLD | NEW |