Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (164502 => 164503)
--- trunk/Source/_javascript_Core/ChangeLog 2014-02-21 22:34:57 UTC (rev 164502)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-02-21 22:37:29 UTC (rev 164503)
@@ -1,3 +1,32 @@
+2014-02-21 Oliver Hunt <oli...@apple.com>
+
+ Add extra space to op_call and related opcodes
+ https://bugs.webkit.org/show_bug.cgi?id=129170
+
+ Reviewed by Mark Lam.
+
+ No change in behaviour, just some refactoring to add an extra
+ slot to the op_call instructions, and refactoring to make similar
+ changes easier in future.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::printCallOp):
+ * bytecode/Opcode.h:
+ (JSC::padOpcodeName):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitCall):
+ (JSC::BytecodeGenerator::emitCallVarargs):
+ (JSC::BytecodeGenerator::emitConstruct):
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::handleIntrinsic):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ * jit/JITCall32_64.cpp:
+ (JSC::JIT::compileOpCall):
+ * llint/LowLevelInterpreter.asm:
+ * llint/LowLevelInterpreter32_64.asm:
+ * llint/LowLevelInterpreter64.asm:
+
2014-02-21 Mark Lam <mark....@apple.com>
gatherFromOtherThread() needs to align the sp before gathering roots.
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (164502 => 164503)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2014-02-21 22:34:57 UTC (rev 164502)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2014-02-21 22:37:29 UTC (rev 164503)
@@ -442,6 +442,7 @@
#endif
}
++it;
+ ++it;
dumpArrayProfiling(out, it, hasPrintedProfiling);
dumpValueProfiling(out, it, hasPrintedProfiling);
}
Modified: trunk/Source/_javascript_Core/bytecode/Opcode.h (164502 => 164503)
--- trunk/Source/_javascript_Core/bytecode/Opcode.h 2014-02-21 22:34:57 UTC (rev 164502)
+++ trunk/Source/_javascript_Core/bytecode/Opcode.h 2014-02-21 22:37:29 UTC (rev 164503)
@@ -144,15 +144,15 @@
macro(op_new_func, 4) \
macro(op_new_captured_func, 4) \
macro(op_new_func_exp, 3) \
- macro(op_call, 8) /* has value profiling */ \
- macro(op_call_eval, 8) /* has value profiling */ \
- macro(op_call_varargs, 8) /* has value profiling */ \
+ macro(op_call, 9) /* has value profiling */ \
+ macro(op_call_eval, 9) /* has value profiling */ \
+ macro(op_call_varargs, 9) /* has value profiling */ \
macro(op_tear_off_activation, 2) \
macro(op_tear_off_arguments, 3) \
macro(op_ret, 2) \
macro(op_ret_object_or_this, 3) \
\
- macro(op_construct, 8) \
+ macro(op_construct, 9) \
macro(op_strcat, 4) \
macro(op_to_primitive, 3) \
\
Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (164502 => 164503)
--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2014-02-21 22:34:57 UTC (rev 164502)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2014-02-21 22:37:29 UTC (rev 164503)
@@ -1766,6 +1766,7 @@
#else
instructions().append(0);
#endif
+ instructions().append(0);
instructions().append(arrayProfile);
instructions().append(profile);
@@ -1799,6 +1800,7 @@
instructions().append(thisRegister->index());
instructions().append(arguments->index());
instructions().append(firstFreeRegister->index());
+ instructions().append(0);
instructions().append(arrayProfile);
instructions().append(profile);
if (m_shouldEmitProfileHooks) {
@@ -1881,6 +1883,7 @@
instructions().append(0);
#endif
instructions().append(0);
+ instructions().append(0);
instructions().append(profile);
if (expectedFunction != NoExpectedFunction)
Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (164502 => 164503)
--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2014-02-21 22:34:57 UTC (rev 164502)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2014-02-21 22:37:29 UTC (rev 164503)
@@ -1567,7 +1567,7 @@
if (argumentCountIncludingThis != 2)
return false;
- ArrayMode arrayMode = getArrayMode(m_currentInstruction[6].u.arrayProfile);
+ ArrayMode arrayMode = getArrayMode(m_currentInstruction[OPCODE_LENGTH(op_call) - 2].u.arrayProfile);
if (!arrayMode.isJSArray())
return false;
switch (arrayMode.type()) {
@@ -1591,7 +1591,7 @@
if (argumentCountIncludingThis != 1)
return false;
- ArrayMode arrayMode = getArrayMode(m_currentInstruction[6].u.arrayProfile);
+ ArrayMode arrayMode = getArrayMode(m_currentInstruction[OPCODE_LENGTH(op_call) - 2].u.arrayProfile);
if (!arrayMode.isJSArray())
return false;
switch (arrayMode.type()) {
Modified: trunk/Source/_javascript_Core/jit/JITCall.cpp (164502 => 164503)
--- trunk/Source/_javascript_Core/jit/JITCall.cpp 2014-02-21 22:34:57 UTC (rev 164502)
+++ trunk/Source/_javascript_Core/jit/JITCall.cpp 2014-02-21 22:37:29 UTC (rev 164503)
@@ -174,7 +174,8 @@
- Caller initializes ScopeChain; ReturnPC; CodeBlock.
- Caller restores callFrameRegister after return.
*/
-
+ COMPILE_ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_construct), call_and_construct_opcodes_must_be_same_length);
+ COMPILE_ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_call_varargs), call_and_call_varargs_opcodes_must_be_same_length);
if (opcodeID == op_call_varargs)
compileLoadVarargs(instruction);
else {
@@ -185,7 +186,7 @@
emitGetVirtualRegister(registerOffset + CallFrame::argumentOffsetIncludingThis(0), regT0);
Jump done = emitJumpIfNotJSCell(regT0);
loadPtr(Address(regT0, JSCell::structureOffset()), regT0);
- storePtr(regT0, instruction[6].u.arrayProfile->addressOfLastSeenStructure());
+ storePtr(regT0, instruction[OPCODE_LENGTH(op_call) - 2].u.arrayProfile->addressOfLastSeenStructure());
done.link(this);
}
Modified: trunk/Source/_javascript_Core/jit/JITCall32_64.cpp (164502 => 164503)
--- trunk/Source/_javascript_Core/jit/JITCall32_64.cpp 2014-02-21 22:34:57 UTC (rev 164502)
+++ trunk/Source/_javascript_Core/jit/JITCall32_64.cpp 2014-02-21 22:37:29 UTC (rev 164503)
@@ -264,7 +264,7 @@
emitLoad(registerOffset + CallFrame::argumentOffsetIncludingThis(0), regT0, regT1);
Jump done = branch32(NotEqual, regT0, TrustedImm32(JSValue::CellTag));
loadPtr(Address(regT1, JSCell::structureOffset()), regT1);
- storePtr(regT1, instruction[6].u.arrayProfile->addressOfLastSeenStructure());
+ storePtr(regT1, instruction[OPCODE_LENGTH(op_call) - 2].u.arrayProfile->addressOfLastSeenStructure());
done.link(this);
}
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (164502 => 164503)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2014-02-21 22:34:57 UTC (rev 164502)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2014-02-21 22:37:29 UTC (rev 164503)
@@ -74,6 +74,8 @@
const LowestTag = DeletedValueTag
end
+const CallOpCodeSize = 9
+
if X86_64 or ARM64 or C_LOOP
const maxFrameExtentForSlowPathCall = 0
elsif ARM or ARMv7_TRADITIONAL or ARMv7 or SH4
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (164502 => 164503)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm 2014-02-21 22:34:57 UTC (rev 164502)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm 2014-02-21 22:37:29 UTC (rev 164503)
@@ -92,8 +92,8 @@
loadi 4[PC], t2
storei t1, TagOffset[cfr, t2, 8]
storei t0, PayloadOffset[cfr, t2, 8]
- valueProfile(t1, t0, 28, t3)
- dispatch(8)
+ valueProfile(t1, t0, 4 * (CallOpCodeSize - 1), t3)
+ dispatch(CallOpCodeSize)
end
macro cCall2(function, arg1, arg2)
@@ -1962,7 +1962,7 @@
bineq ThisArgumentOffset + TagOffset[cfr, t3, 8], CellTag, .done
loadi ThisArgumentOffset + PayloadOffset[cfr, t3, 8], t0
loadp JSCell::m_structure[t0], t0
- loadp 24[PC], t1
+ loadpFromInstruction(CallOpCodeSize - 2, t1)
storep t0, ArrayProfile::m_lastSeenStructure[t1]
.done:
end
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (164502 => 164503)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2014-02-21 22:34:57 UTC (rev 164502)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2014-02-21 22:37:29 UTC (rev 164503)
@@ -47,8 +47,8 @@
loadp CodeBlock::m_instructions[PB], PB
loadisFromInstruction(1, t1)
storeq t0, [cfr, t1, 8]
- valueProfile(t0, 7, t2)
- dispatch(8)
+ valueProfile(t0, (CallOpCodeSize - 1), t2)
+ dispatch(CallOpCodeSize)
end
macro cCall2(function, arg1, arg2)
@@ -1773,7 +1773,7 @@
loadq ThisArgumentOffset[cfr, t3, 8], t0
btqnz t0, tagMask, .done
loadp JSCell::m_structure[t0], t0
- loadpFromInstruction(6, t1)
+ loadpFromInstruction((CallOpCodeSize - 2), t1)
storep t0, ArrayProfile::m_lastSeenStructure[t1]
.done:
end