diff options
Diffstat (limited to 'JavaScriptCore/bytecode')
-rw-r--r-- | JavaScriptCore/bytecode/CodeBlock.cpp | 43 | ||||
-rw-r--r-- | JavaScriptCore/bytecode/CodeBlock.h | 44 | ||||
-rw-r--r-- | JavaScriptCore/bytecode/Opcode.h | 19 |
3 files changed, 65 insertions, 41 deletions
diff --git a/JavaScriptCore/bytecode/CodeBlock.cpp b/JavaScriptCore/bytecode/CodeBlock.cpp index 01b06a4..d0132cf 100644 --- a/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/JavaScriptCore/bytecode/CodeBlock.cpp @@ -490,11 +490,13 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& break; } case op_create_arguments: { - printf("[%4d] create_arguments\n", location); + int r0 = (++it)->u.operand; + printf("[%4d] create_arguments\t %s\n", location, registerName(exec, r0).data()); break; } case op_init_arguments: { - printf("[%4d] init_arguments\n", location); + int r0 = (++it)->u.operand; + printf("[%4d] init_arguments\t %s\n", location, registerName(exec, r0).data()); break; } case op_convert_this: { @@ -1026,27 +1028,24 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& break; } case op_call: { - int dst = (++it)->u.operand; int func = (++it)->u.operand; int argCount = (++it)->u.operand; int registerOffset = (++it)->u.operand; - printf("[%4d] call\t\t %s, %s, %d, %d\n", location, registerName(exec, dst).data(), registerName(exec, func).data(), argCount, registerOffset); + printf("[%4d] call\t\t %s, %d, %d\n", location, registerName(exec, func).data(), argCount, registerOffset); break; } case op_call_eval: { - int dst = (++it)->u.operand; int func = (++it)->u.operand; int argCount = (++it)->u.operand; int registerOffset = (++it)->u.operand; - printf("[%4d] call_eval\t %s, %s, %d, %d\n", location, registerName(exec, dst).data(), registerName(exec, func).data(), argCount, registerOffset); + printf("[%4d] call_eval\t %s, %d, %d\n", location, registerName(exec, func).data(), argCount, registerOffset); break; } case op_call_varargs: { - int dst = (++it)->u.operand; int func = (++it)->u.operand; int argCount = (++it)->u.operand; int registerOffset = (++it)->u.operand; - printf("[%4d] call_varargs\t %s, %s, %s, %d\n", location, registerName(exec, dst).data(), registerName(exec, func).data(), registerName(exec, argCount).data(), registerOffset); + printf("[%4d] call_varargs\t %s, %s, %d\n", location, registerName(exec, func).data(), registerName(exec, argCount).data(), registerOffset); break; } case op_load_varargs: { @@ -1055,11 +1054,13 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& } case op_tear_off_activation: { int r0 = (++it)->u.operand; - printf("[%4d] tear_off_activation\t %s\n", location, registerName(exec, r0).data()); + int r1 = (++it)->u.operand; + printf("[%4d] tear_off_activation\t %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data()); break; } case op_tear_off_arguments: { - printf("[%4d] tear_off_arguments\n", location); + int r0 = (++it)->u.operand; + printf("[%4d] tear_off_arguments\t %s\n", location, registerName(exec, r0).data()); break; } case op_ret: { @@ -1067,20 +1068,24 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& printf("[%4d] ret\t\t %s\n", location, registerName(exec, r0).data()); break; } + case op_call_put_result: { + int r0 = (++it)->u.operand; + printf("[%4d] op_call_put_result\t\t %s\n", location, registerName(exec, r0).data()); + break; + } + case op_ret_object_or_this: { + int r0 = (++it)->u.operand; + int r1 = (++it)->u.operand; + printf("[%4d] constructor_ret\t\t %s %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data()); + break; + } case op_construct: { - int dst = (++it)->u.operand; int func = (++it)->u.operand; int argCount = (++it)->u.operand; int registerOffset = (++it)->u.operand; int proto = (++it)->u.operand; int thisRegister = (++it)->u.operand; - printf("[%4d] construct\t %s, %s, %d, %d, %s, %s\n", location, registerName(exec, dst).data(), registerName(exec, func).data(), argCount, registerOffset, registerName(exec, proto).data(), registerName(exec, thisRegister).data()); - break; - } - case op_construct_verify: { - int r0 = (++it)->u.operand; - int r1 = (++it)->u.operand; - printf("[%4d] construct_verify\t %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data()); + printf("[%4d] construct\t %s, %d, %d, %s, %s\n", location, registerName(exec, func).data(), argCount, registerOffset, registerName(exec, proto).data(), registerName(exec, thisRegister).data()); break; } case op_strcat: { @@ -1340,9 +1345,9 @@ CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, PassR #ifndef NDEBUG , m_instructionCount(0) #endif + , m_argumentsRegister(-1) , m_needsFullScopeChain(ownerExecutable->needsActivation()) , m_usesEval(ownerExecutable->usesEval()) - , m_usesArguments(false) , m_isNumericCompareFunction(false) , m_codeType(codeType) , m_source(sourceProvider) diff --git a/JavaScriptCore/bytecode/CodeBlock.h b/JavaScriptCore/bytecode/CodeBlock.h index 13956df..e5da2b2 100644 --- a/JavaScriptCore/bytecode/CodeBlock.h +++ b/JavaScriptCore/bytecode/CodeBlock.h @@ -62,6 +62,8 @@ namespace JSC { enum CodeType { GlobalCode, EvalCode, FunctionCode }; + inline int unmodifiedArgumentsRegister(int argumentsRegister) { return argumentsRegister - 1; } + static ALWAYS_INLINE int missingThisObjectMarker() { return std::numeric_limits<int>::max(); } struct HandlerInfo { @@ -107,7 +109,7 @@ namespace JSC { { } - unsigned bytecodeIndex; + unsigned bytecodeOffset; CodeLocationNearCall callReturnLocation; CodeLocationDataLabelPtr hotPathBegin; CodeLocationNearCall hotPathOther; @@ -189,15 +191,15 @@ namespace JSC { // (given as an offset in bytes into the JIT code) back to // the bytecode index of the corresponding bytecode operation. // This is then used to look up the corresponding handler. - struct CallReturnOffsetToBytecodeIndex { - CallReturnOffsetToBytecodeIndex(unsigned callReturnOffset, unsigned bytecodeIndex) + struct CallReturnOffsetToBytecodeOffset { + CallReturnOffsetToBytecodeOffset(unsigned callReturnOffset, unsigned bytecodeOffset) : callReturnOffset(callReturnOffset) - , bytecodeIndex(bytecodeIndex) + , bytecodeOffset(bytecodeOffset) { } unsigned callReturnOffset; - unsigned bytecodeIndex; + unsigned bytecodeOffset; }; // valueAtPosition helpers for the binaryChop algorithm below. @@ -217,7 +219,7 @@ namespace JSC { return methodCallLinkInfo->callReturnLocation.executableAddress(); } - inline unsigned getCallReturnOffset(CallReturnOffsetToBytecodeIndex* pc) + inline unsigned getCallReturnOffset(CallReturnOffsetToBytecodeOffset* pc) { return pc->callReturnOffset; } @@ -265,7 +267,7 @@ namespace JSC { Vector<GetByIdExceptionInfo> m_getByIdExceptionInfo; #if ENABLE(JIT) - Vector<CallReturnOffsetToBytecodeIndex> m_callReturnIndexVector; + Vector<CallReturnOffsetToBytecodeOffset> m_callReturnIndexVector; #endif }; @@ -347,13 +349,18 @@ namespace JSC { return *(binaryChop<MethodCallLinkInfo, void*, getMethodCallLinkInfoReturnLocation>(m_methodCallLinkInfos.begin(), m_methodCallLinkInfos.size(), returnAddress.value())); } - unsigned getBytecodeIndex(CallFrame* callFrame, ReturnAddressPtr returnAddress) + unsigned bytecodeOffset(CallFrame* callFrame, ReturnAddressPtr returnAddress) { reparseForExceptionInfoIfNecessary(callFrame); - return binaryChop<CallReturnOffsetToBytecodeIndex, unsigned, getCallReturnOffset>(callReturnIndexVector().begin(), callReturnIndexVector().size(), getJITCode().offsetOf(returnAddress.value()))->bytecodeIndex; + return binaryChop<CallReturnOffsetToBytecodeOffset, unsigned, getCallReturnOffset>(callReturnIndexVector().begin(), callReturnIndexVector().size(), getJITCode().offsetOf(returnAddress.value()))->bytecodeOffset; } bool functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex); +#else + unsigned bytecodeOffset(CallFrame*, Instruction* returnAddress) + { + return static_cast<Instruction*>(returnAddress) - instructions().begin(); + } #endif void setIsNumericCompareFunction(bool isNumericCompareFunction) { m_isNumericCompareFunction = isNumericCompareFunction; } @@ -383,8 +390,19 @@ namespace JSC { bool needsFullScopeChain() const { return m_needsFullScopeChain; } void setUsesEval(bool usesEval) { m_usesEval = usesEval; } bool usesEval() const { return m_usesEval; } - void setUsesArguments(bool usesArguments) { m_usesArguments = usesArguments; } - bool usesArguments() const { return m_usesArguments; } + + void setArgumentsRegister(int argumentsRegister) + { + ASSERT(argumentsRegister != -1); + m_argumentsRegister = argumentsRegister; + ASSERT(usesArguments()); + } + int argumentsRegister() + { + ASSERT(usesArguments()); + return m_argumentsRegister; + } + bool usesArguments() const { return m_argumentsRegister != -1; } CodeType codeType() const { return m_codeType; } @@ -437,7 +455,7 @@ namespace JSC { LineInfo& lastLineInfo() { ASSERT(m_exceptionInfo); return m_exceptionInfo->m_lineInfo.last(); } #if ENABLE(JIT) - Vector<CallReturnOffsetToBytecodeIndex>& callReturnIndexVector() { ASSERT(m_exceptionInfo); return m_exceptionInfo->m_callReturnIndexVector; } + Vector<CallReturnOffsetToBytecodeOffset>& callReturnIndexVector() { ASSERT(m_exceptionInfo); return m_exceptionInfo->m_callReturnIndexVector; } #endif // Constant Pool @@ -520,10 +538,10 @@ namespace JSC { #endif int m_thisRegister; + int m_argumentsRegister; bool m_needsFullScopeChain; bool m_usesEval; - bool m_usesArguments; bool m_isNumericCompareFunction; CodeType m_codeType; diff --git a/JavaScriptCore/bytecode/Opcode.h b/JavaScriptCore/bytecode/Opcode.h index db54782..30472d5 100644 --- a/JavaScriptCore/bytecode/Opcode.h +++ b/JavaScriptCore/bytecode/Opcode.h @@ -40,8 +40,8 @@ namespace JSC { #define FOR_EACH_OPCODE_ID(macro) \ macro(op_enter, 1) \ macro(op_enter_with_activation, 2) \ - macro(op_init_arguments, 1) \ - macro(op_create_arguments, 1) \ + macro(op_init_arguments, 2) \ + macro(op_create_arguments, 2) \ macro(op_convert_this, 2) \ \ macro(op_new_object, 2) \ @@ -153,17 +153,18 @@ namespace JSC { \ macro(op_new_func, 3) \ macro(op_new_func_exp, 3) \ - macro(op_call, 5) \ - macro(op_call_eval, 5) \ - macro(op_call_varargs, 5) \ + macro(op_call, 4) \ + macro(op_call_eval, 4) \ + macro(op_call_varargs, 4) \ macro(op_load_varargs, 3) \ - macro(op_tear_off_activation, 2) \ - macro(op_tear_off_arguments, 1) \ + macro(op_tear_off_activation, 3) \ + macro(op_tear_off_arguments, 2) \ macro(op_ret, 2) \ + macro(op_call_put_result, 2) \ + macro(op_ret_object_or_this, 3) \ macro(op_method_check, 1) \ \ - macro(op_construct, 7) \ - macro(op_construct_verify, 3) \ + macro(op_construct, 6) \ macro(op_strcat, 4) \ macro(op_to_primitive, 3) \ \ |