Changeset 62612 in webkit for trunk/JavaScriptCore/interpreter
- Timestamp:
- Jul 6, 2010, 6:35:56 PM (15 years ago)
- Location:
- trunk/JavaScriptCore/interpreter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/interpreter/CallFrame.h
r61553 r62612 107 107 #if ENABLE(JIT) 108 108 ReturnAddressPtr returnPC() const { return ReturnAddressPtr(this[RegisterFile::ReturnPC].vPC()); } 109 #else 110 Instruction* returnPC() const { return this[RegisterFile::ReturnPC].vPC(); } 109 #endif 110 #if ENABLE(INTERPRETER) 111 Instruction* returnVPC() const { return this[RegisterFile::ReturnPC].vPC(); } 111 112 #endif 112 113 -
trunk/JavaScriptCore/interpreter/Interpreter.cpp
r62464 r62612 80 80 } 81 81 82 #if !ENABLE(JIT)82 #if ENABLE(INTERPRETER) 83 83 NEVER_INLINE bool Interpreter::resolve(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue) 84 84 { … … 295 295 } 296 296 297 #endif // !ENABLE(JIT)297 #endif // ENABLE(INTERPRETER) 298 298 299 299 ALWAYS_INLINE CallFrame* Interpreter::slideRegisterWindowForCall(CodeBlock* newCodeBlock, RegisterFile* registerFile, CallFrame* callFrame, size_t registerOffset, int argc) … … 334 334 } 335 335 336 #if !ENABLE(JIT)336 #if ENABLE(INTERPRETER) 337 337 static NEVER_INLINE bool isInvalidParamForIn(CallFrame* callFrame, CodeBlock* codeBlock, const Instruction* vPC, JSValue value, JSValue& exceptionData) 338 338 { … … 548 548 549 549 codeBlock = callerFrame->codeBlock(); 550 bytecodeOffset = codeBlock->bytecodeOffset(callerFrame, callFrame->returnPC()); 550 #if ENABLE(JIT) 551 #if ENABLE(INTERPRETER) 552 if (callerFrame->globalData().canUseJIT()) 553 #endif 554 bytecodeOffset = codeBlock->bytecodeOffset(callerFrame, callFrame->returnPC()); 555 #if ENABLE(INTERPRETER) 556 else 557 bytecodeOffset = codeBlock->bytecodeOffset(callerFrame, callFrame->returnVPC()); 558 #endif 559 #else 560 bytecodeOffset = codeBlock->bytecodeOffset(callerFrame, callFrame->returnVPC()); 561 #endif 551 562 callFrame = callerFrame; 552 563 return true; … … 595 606 // we'll never reach the relevant op_profile_did_call. 596 607 if (Profiler* profiler = *Profiler::enabledProfilerReference()) { 597 #if !ENABLE(JIT) 598 // FIXME: Why 8? - work out what this magic value is, replace the constant with something more helpful. 599 if (isCallBytecode(codeBlock->instructions()[bytecodeOffset].u.opcode)) 600 profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 1].u.operand).jsValue()); 601 else if (codeBlock->instructions().size() > (bytecodeOffset + 8) && codeBlock->instructions()[bytecodeOffset + 8].u.opcode == getOpcode(op_construct)) 602 profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 9].u.operand).jsValue()); 603 #else 604 int functionRegisterIndex; 605 if (codeBlock->functionRegisterForBytecodeOffset(bytecodeOffset, functionRegisterIndex)) 606 profiler->didExecute(callFrame, callFrame->r(functionRegisterIndex).jsValue()); 608 #if ENABLE(INTERPRETER) 609 if (!callFrame->globalData().canUseJIT()) { 610 // FIXME: Why 8? - work out what this magic value is, replace the constant with something more helpful. 611 if (isCallBytecode(codeBlock->instructions()[bytecodeOffset].u.opcode)) 612 profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 1].u.operand).jsValue()); 613 else if (codeBlock->instructions().size() > (bytecodeOffset + 8) && codeBlock->instructions()[bytecodeOffset + 8].u.opcode == getOpcode(op_construct)) 614 profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 9].u.operand).jsValue()); 615 } 616 #if ENABLE(JIT) 617 else 618 #endif 619 #endif 620 #if ENABLE(JIT) 621 { 622 int functionRegisterIndex; 623 if (codeBlock->functionRegisterForBytecodeOffset(bytecodeOffset, functionRegisterIndex)) 624 profiler->didExecute(callFrame, callFrame->r(functionRegisterIndex).jsValue()); 625 } 607 626 #endif 608 627 } … … 677 696 SamplingTool::CallRecord callRecord(m_sampler.get()); 678 697 679 m_reentryDepth++; 698 m_reentryDepth++; 680 699 #if ENABLE(JIT) 681 result = program->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception); 682 #else 683 result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); 684 #endif 700 #if ENABLE(INTERPRETER) 701 if (callFrame->globalData().canUseJIT()) 702 #endif 703 result = program->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception); 704 #if ENABLE(INTERPRETER) 705 else 706 #endif 707 #endif 708 #if ENABLE(INTERPRETER) 709 result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); 710 #endif 711 685 712 m_reentryDepth--; 686 713 } … … 750 777 SamplingTool::CallRecord callRecord(m_sampler.get()); 751 778 752 m_reentryDepth++; 753 #if ENABLE(JIT) 754 result = callData.js.functionExecutable->jitCodeForCall(newCallFrame, callDataScopeChain).execute(&m_registerFile, newCallFrame, callDataScopeChain->globalData, exception); 755 #else 756 result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); 757 #endif 779 m_reentryDepth++; 780 #if ENABLE(JIT) 781 #if ENABLE(INTERPRETER) 782 if (callFrame->globalData().canUseJIT()) 783 #endif 784 result = callData.js.functionExecutable->jitCodeForCall(newCallFrame, callDataScopeChain).execute(&m_registerFile, newCallFrame, callDataScopeChain->globalData, exception); 785 #if ENABLE(INTERPRETER) 786 else 787 #endif 788 #endif 789 #if ENABLE(INTERPRETER) 790 result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); 791 #endif 758 792 m_reentryDepth--; 759 793 } … … 842 876 SamplingTool::CallRecord callRecord(m_sampler.get()); 843 877 844 m_reentryDepth++; 845 #if ENABLE(JIT) 846 result = constructData.js.functionExecutable->jitCodeForConstruct(newCallFrame, constructDataScopeChain).execute(&m_registerFile, newCallFrame, constructDataScopeChain->globalData, exception); 847 #else 848 result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); 849 #endif 878 m_reentryDepth++; 879 #if ENABLE(JIT) 880 #if ENABLE(INTERPRETER) 881 if (callFrame->globalData().canUseJIT()) 882 #endif 883 result = constructData.js.functionExecutable->jitCodeForConstruct(newCallFrame, constructDataScopeChain).execute(&m_registerFile, newCallFrame, constructDataScopeChain->globalData, exception); 884 #if ENABLE(INTERPRETER) 885 else 886 #endif 887 #endif 888 #if ENABLE(INTERPRETER) 889 result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); 890 #endif 850 891 m_reentryDepth--; 851 892 } … … 923 964 } 924 965 // a 0 codeBlock indicates a built-in caller 925 newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), argc, function); 966 newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), argc, function); 926 967 #if ENABLE(JIT) 927 FunctionExecutable->jitCodeForCall(newCallFrame, scopeChain); 928 #endif 929 968 #if ENABLE(INTERPRETER) 969 if (callFrame->globalData().canUseJIT()) 970 #endif 971 FunctionExecutable->jitCodeForCall(newCallFrame, scopeChain); 972 #endif 930 973 CallFrameClosure result = { callFrame, newCallFrame, function, FunctionExecutable, scopeChain->globalData, oldEnd, scopeChain, codeBlock->m_numParameters, argc }; 931 974 return result; … … 943 986 SamplingTool::CallRecord callRecord(m_sampler.get()); 944 987 945 m_reentryDepth++; 988 m_reentryDepth++; 946 989 #if ENABLE(JIT) 947 result = closure.functionExecutable->generatedJITCodeForCall().execute(&m_registerFile, closure.newCallFrame, closure.globalData, exception); 948 #else 949 result = privateExecute(Normal, &m_registerFile, closure.newCallFrame, exception); 990 #if ENABLE(INTERPRETER) 991 if (closure.newCallFrame->globalData().canUseJIT()) 992 #endif 993 result = closure.functionExecutable->generatedJITCodeForCall().execute(&m_registerFile, closure.newCallFrame, closure.globalData, exception); 994 #if ENABLE(INTERPRETER) 995 else 996 #endif 997 #endif 998 #if ENABLE(INTERPRETER) 999 result = privateExecute(Normal, &m_registerFile, closure.newCallFrame, exception); 950 1000 #endif 951 1001 m_reentryDepth--; … … 1042 1092 1043 1093 m_reentryDepth++; 1094 1044 1095 #if ENABLE(JIT) 1045 result = eval->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception); 1046 #else 1047 result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); 1096 #if ENABLE(INTERPRETER) 1097 if (callFrame->globalData().canUseJIT()) 1098 #endif 1099 result = eval->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception); 1100 #if ENABLE(INTERPRETER) 1101 else 1102 #endif 1103 #endif 1104 #if ENABLE(INTERPRETER) 1105 result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); 1048 1106 #endif 1049 1107 m_reentryDepth--; … … 1085 1143 } 1086 1144 1087 #if !ENABLE(JIT)1145 #if ENABLE(INTERPRETER) 1088 1146 NEVER_INLINE ScopeChainNode* Interpreter::createExceptionScope(CallFrame* callFrame, const Instruction* vPC) 1089 1147 { … … 1321 1379 } 1322 1380 1323 #endif // !ENABLE(JIT)1381 #endif // ENABLE(INTERPRETER) 1324 1382 1325 1383 JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFile, CallFrame* callFrame, JSValue* exception) … … 1337 1395 return JSValue(); 1338 1396 } 1339 1397 1340 1398 #if ENABLE(JIT) 1399 #if ENABLE(INTERPRETER) 1341 1400 // Mixing Interpreter + JIT is not supported. 1342 ASSERT_NOT_REACHED(); 1343 #endif 1344 #if !!ENABLE(JIT) 1401 if (callFrame->globalData().canUseJIT()) 1402 #endif 1403 ASSERT_NOT_REACHED(); 1404 #endif 1405 1406 #if !ENABLE(INTERPRETER) 1345 1407 UNUSED_PARAM(registerFile); 1346 1408 UNUSED_PARAM(callFrame); … … 3705 3767 } 3706 3768 ASSERT(!asFunction(callFrame->callee())->isHostFunction()); 3707 uint32_t expectedParams = asFunction(callFrame->callee())->jsExecutable()->parameterCount();3708 uint32_t inplaceArgs = min(argCount, expectedParams);3709 uint32_t i = 0;3769 int32_t expectedParams = asFunction(callFrame->callee())->jsExecutable()->parameterCount(); 3770 int32_t inplaceArgs = min(static_cast<int32_t>(argCount), expectedParams); 3771 int32_t i = 0; 3710 3772 Register* argStore = callFrame->registers() + argsOffset; 3711 3773 … … 3714 3776 argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams]; 3715 3777 // Then we copy any additional arguments that may be further up the stack ('-1' to account for 'this') 3716 for (; i < argCount; i++)3778 for (; i < static_cast<int32_t>(argCount); i++) 3717 3779 argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams - argCount - 1]; 3718 3780 } else if (!arguments.isUndefinedOrNull()) { … … 3908 3970 JSValue returnValue = callFrame->r(result).jsValue(); 3909 3971 3910 vPC = callFrame->return PC();3972 vPC = callFrame->returnVPC(); 3911 3973 callFrame = callFrame->callerFrame(); 3912 3974 … … 3952 4014 returnValue = callFrame->r(vPC[2].u.operand).jsValue(); 3953 4015 3954 vPC = callFrame->return PC();4016 vPC = callFrame->returnVPC(); 3955 4017 callFrame = callFrame->callerFrame(); 3956 4018 … … 4137 4199 codeBlock = newCodeBlock; 4138 4200 vPC = newCodeBlock->instructions().begin(); 4139 4140 4201 #if ENABLE(OPCODE_STATS) 4141 4202 OpcodeStats::resetLastInstruction(); … … 4537 4598 #undef CHECK_FOR_EXCEPTION 4538 4599 #undef CHECK_FOR_TIMEOUT 4539 #endif // !ENABLE(JIT)4600 #endif // ENABLE(INTERPRETER) 4540 4601 } 4541 4602 … … 4593 4654 if (!callerCodeBlock) 4594 4655 return; 4595 4596 unsigned bytecodeOffset = callerCodeBlock->bytecodeOffset(callerFrame, callFrame->returnPC()); 4656 unsigned bytecodeOffset = 0; 4657 #if ENABLE(INTERPRETER) 4658 if (!callerFrame->globalData().canUseJIT()) 4659 bytecodeOffset = callerCodeBlock->bytecodeOffset(callerFrame, callFrame->returnVPC()); 4660 #if ENABLE(JIT) 4661 else 4662 bytecodeOffset = callerCodeBlock->bytecodeOffset(callerFrame, callFrame->returnPC()); 4663 #endif 4664 #else 4665 bytecodeOffset = callerCodeBlock->bytecodeOffset(callerFrame, callFrame->returnPC()); 4666 #endif 4597 4667 lineNumber = callerCodeBlock->lineNumberForBytecodeOffset(callerFrame, bytecodeOffset - 1); 4598 4668 sourceID = callerCodeBlock->ownerExecutable()->sourceID(); -
trunk/JavaScriptCore/interpreter/Interpreter.h
r60708 r62612 124 124 JSValue execute(EvalExecutable*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*, JSValue* exception); 125 125 126 #if !ENABLE(JIT)126 #if ENABLE(INTERPRETER) 127 127 NEVER_INLINE bool resolve(CallFrame*, Instruction*, JSValue& exceptionValue); 128 128 NEVER_INLINE bool resolveSkip(CallFrame*, Instruction*, JSValue& exceptionValue); … … 137 137 void tryCachePutByID(CallFrame*, CodeBlock*, Instruction*, JSValue baseValue, const PutPropertySlot&); 138 138 void uncachePutByID(CodeBlock*, Instruction* vPC); 139 #endif // !ENABLE(JIT)139 #endif // ENABLE(INTERPRETER) 140 140 141 141 NEVER_INLINE bool unwindCallFrame(CallFrame*&, JSValue, unsigned& bytecodeOffset, CodeBlock*&);
Note:
See TracChangeset
for help on using the changeset viewer.