Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (174400 => 174401)
--- trunk/Source/_javascript_Core/ChangeLog 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-10-07 18:57:57 UTC (rev 174401)
@@ -1,3 +1,48 @@
+2014-10-07 Oliver Hunt <[email protected]>
+
+ Remove op_new_captured_func
+ https://bugs.webkit.org/show_bug.cgi?id=137491
+
+ Reviewed by Mark Lam.
+
+ Removes the op_captured_new_func opcode as part of the work
+ towards having any magical opcodes that write directly to
+ named "registers" and then have a follow on op to ensure that
+ the environment record correctly represents the stack state.
+
+ For this we add a non-captured scratch register so we don't
+ have to have any kind of magic opcode, and instead simply
+ have sensible creation and move semantics for capturing new
+ functions.
+
+ * bytecode/BytecodeList.json:
+ * bytecode/BytecodeUseDef.h:
+ (JSC::computeUsesForBytecodeOffset):
+ (JSC::computeDefsForBytecodeOffset):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dumpBytecode):
+ (JSC::CodeBlock::CodeBlock):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ (JSC::BytecodeGenerator::emitLazyNewFunction):
+ (JSC::BytecodeGenerator::emitNewFunctionInternal):
+ * bytecompiler/BytecodeGenerator.h:
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ * dfg/DFGCapabilities.cpp:
+ (JSC::DFG::capabilityLevel):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_new_captured_func): Deleted.
+ * llint/LowLevelInterpreter32_64.asm:
+ * llint/LowLevelInterpreter64.asm:
+ * runtime/CommonSlowPaths.cpp:
+ (JSC::SLOW_PATH_DECL): Deleted.
+ * runtime/CommonSlowPaths.h:
+
2014-10-06 Andy Estes <[email protected]>
Objective-C objects must be fully defined when used in a WTF::Vector
Modified: trunk/Source/_javascript_Core/bytecode/BytecodeList.json (174400 => 174401)
--- trunk/Source/_javascript_Core/bytecode/BytecodeList.json 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeList.json 2014-10-07 18:57:57 UTC (rev 174401)
@@ -93,7 +93,6 @@
{ "name" : "op_switch_char", "length" : 4 },
{ "name" : "op_switch_string", "length" : 4 },
{ "name" : "op_new_func", "length" : 4 },
- { "name" : "op_new_captured_func", "length" : 4 },
{ "name" : "op_new_func_exp", "length" : 3 },
{ "name" : "op_call", "length" : 9 },
{ "name" : "op_call_eval", "length" : 9 },
Modified: trunk/Source/_javascript_Core/bytecode/BytecodeUseDef.h (174400 => 174401)
--- trunk/Source/_javascript_Core/bytecode/BytecodeUseDef.h 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeUseDef.h 2014-10-07 18:57:57 UTC (rev 174401)
@@ -58,7 +58,6 @@
case op_touch_entry:
return;
case op_new_func:
- case op_new_captured_func:
case op_create_lexical_environment:
case op_create_arguments:
case op_to_this:
@@ -311,7 +310,6 @@
case op_new_array_with_size:
case op_new_regexp:
case op_new_func:
- case op_new_captured_func:
case op_new_func_exp:
case op_call_varargs:
case op_construct_varargs:
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (174400 => 174401)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2014-10-07 18:57:57 UTC (rev 174401)
@@ -1270,14 +1270,6 @@
out.printf("%s, f%d, %s", registerName(r0).data(), f0, shouldCheck ? "<Checked>" : "<Unchecked>");
break;
}
- case op_new_captured_func: {
- int r0 = (++it)->u.operand;
- int f0 = (++it)->u.operand;
- printLocationAndOp(out, exec, location, it, "new_captured_func");
- out.printf("%s, f%d", registerName(r0).data(), f0);
- ++it;
- break;
- }
case op_new_func_exp: {
int r0 = (++it)->u.operand;
int f0 = (++it)->u.operand;
@@ -2105,21 +2097,6 @@
break;
}
- case op_new_captured_func: {
- if (pc[3].u.index == UINT_MAX) {
- instructions[i + 3].u.watchpointSet = 0;
- break;
- }
- StringImpl* uid = identifier(pc[3].u.index).impl();
- RELEASE_ASSERT(didCloneSymbolTable);
- ConcurrentJITLocker locker(m_symbolTable->m_lock);
- SymbolTable::Map::iterator iter = m_symbolTable->find(locker, uid);
- ASSERT(iter != m_symbolTable->end(locker));
- iter->value.prepareToWatch(symbolTable());
- instructions[i + 3].u.watchpointSet = iter->value.watchpointSet();
- break;
- }
-
case op_debug: {
if (pc[1].u.index == DidReachBreakpoint)
m_hasDebuggerStatement = true;
@@ -3899,7 +3876,6 @@
case op_enter:
case op_init_lazy_reg:
case op_create_arguments:
- case op_new_captured_func:
return;
default:
break;
Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (174400 => 174401)
--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2014-10-07 18:57:57 UTC (rev 174401)
@@ -250,7 +250,7 @@
emitOpcode(op_create_lexical_environment);
instructions().append(m_lexicalEnvironmentRegister->index());
}
-
+ RegisterID* scratch = addVar();
m_symbolTable->setCaptureStart(virtualRegisterForLocal(m_codeBlock->m_numVars).offset());
if (functionBody->usesArguments() || codeBlock->usesEval()) { // May reify arguments object.
@@ -332,10 +332,8 @@
const Identifier& ident = function->ident();
if (functionBody->captures(ident) || shouldCaptureAllTheThings) {
m_functions.add(ident.impl());
- // We rely on still allocating stack space for captured variables
- // here.
- RegisterID* newFunction = emitNewFunction(addVar(ident, IsVariable, IsWatchable), IsCaptured, function);
- initializeCapturedVariable(newFunction, ident, newFunction);
+ emitNewFunction(scratch, function);
+ initializeCapturedVariable(addVar(ident, IsVariable, IsWatchable), ident, scratch);
}
}
for (size_t i = 0; i < varStack.size(); ++i) {
@@ -359,7 +357,7 @@
// Don't lazily create functions that override the name 'arguments'
// as this would complicate lazy instantiation of actual arguments.
if (!canLazilyCreateFunctions || ident == propertyNames().arguments)
- emitNewFunction(reg.get(), NotCaptured, function);
+ emitNewFunction(reg.get(), function);
else {
emitInitLazyRegister(reg.get());
m_lazyFunctions.set(reg->virtualRegister().toLocal(), function);
@@ -1657,9 +1655,9 @@
return dst;
}
-RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, CaptureMode captureMode, FunctionBodyNode* function)
+RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode* function)
{
- return emitNewFunctionInternal(dst, captureMode, m_codeBlock->addFunctionDecl(makeFunction(function)), false);
+ return emitNewFunctionInternal(dst, m_codeBlock->addFunctionDecl(makeFunction(function)), false);
}
RegisterID* BytecodeGenerator::emitLazyNewFunction(RegisterID* dst, FunctionBodyNode* function)
@@ -1667,19 +1665,15 @@
FunctionOffsetMap::AddResult ptr = m_functionOffsets.add(function, 0);
if (ptr.isNewEntry)
ptr.iterator->value = m_codeBlock->addFunctionDecl(makeFunction(function));
- return emitNewFunctionInternal(dst, NotCaptured, ptr.iterator->value, true);
+ return emitNewFunctionInternal(dst, ptr.iterator->value, true);
}
-RegisterID* BytecodeGenerator::emitNewFunctionInternal(RegisterID* dst, CaptureMode captureMode, unsigned index, bool doNullCheck)
+RegisterID* BytecodeGenerator::emitNewFunctionInternal(RegisterID* dst, unsigned index, bool doNullCheck)
{
- emitOpcode(captureMode == IsCaptured ? op_new_captured_func : op_new_func);
+ emitOpcode(op_new_func);
instructions().append(dst->index());
instructions().append(index);
- if (captureMode == IsCaptured) {
- ASSERT(!doNullCheck);
- instructions().append(watchableVariable(dst->index()));
- } else
- instructions().append(doNullCheck);
+ instructions().append(doNullCheck);
return dst;
}
Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h (174400 => 174401)
--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h 2014-10-07 18:57:57 UTC (rev 174401)
@@ -449,9 +449,9 @@
RegisterID* emitNewObject(RegisterID* dst);
RegisterID* emitNewArray(RegisterID* dst, ElementNode*, unsigned length); // stops at first elision
- RegisterID* emitNewFunction(RegisterID* dst, CaptureMode, FunctionBodyNode*);
+ RegisterID* emitNewFunction(RegisterID* dst, FunctionBodyNode*);
RegisterID* emitLazyNewFunction(RegisterID* dst, FunctionBodyNode* body);
- RegisterID* emitNewFunctionInternal(RegisterID* dst, CaptureMode, unsigned index, bool shouldNullCheck);
+ RegisterID* emitNewFunctionInternal(RegisterID* dst, unsigned index, bool shouldNullCheck);
RegisterID* emitNewFunctionExpression(RegisterID* dst, FuncExprNode* func);
RegisterID* emitNewRegExp(RegisterID* dst, RegExp*);
Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (174400 => 174401)
--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2014-10-07 18:57:57 UTC (rev 174401)
@@ -3439,16 +3439,7 @@
}
NEXT_OPCODE(op_new_func);
}
-
- case op_new_captured_func: {
- Node* function = addToGraph(
- NewFunctionNoCheck, OpInfo(currentInstruction[2].u.operand));
- if (VariableWatchpointSet* set = currentInstruction[3].u.watchpointSet)
- addToGraph(NotifyWrite, OpInfo(set), function);
- set(VirtualRegister(currentInstruction[1].u.operand), function);
- NEXT_OPCODE(op_new_captured_func);
- }
-
+
case op_new_func_exp: {
set(VirtualRegister(currentInstruction[1].u.operand),
addToGraph(NewFunctionExpression, OpInfo(currentInstruction[2].u.operand)));
Modified: trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp (174400 => 174401)
--- trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp 2014-10-07 18:57:57 UTC (rev 174401)
@@ -232,7 +232,6 @@
case op_new_regexp:
case op_create_lexical_environment:
case op_new_func:
- case op_new_captured_func:
case op_new_func_exp:
case op_switch_string: // Don't inline because we don't want to copy string tables in the concurrent JIT.
return CanCompile;
Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (174400 => 174401)
--- trunk/Source/_javascript_Core/jit/JIT.cpp 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp 2014-10-07 18:57:57 UTC (rev 174401)
@@ -256,7 +256,6 @@
DEFINE_OP(op_new_array_with_size)
DEFINE_OP(op_new_array_buffer)
DEFINE_OP(op_new_func)
- DEFINE_OP(op_new_captured_func)
DEFINE_OP(op_new_func_exp)
DEFINE_OP(op_new_object)
DEFINE_OP(op_new_regexp)
Modified: trunk/Source/_javascript_Core/jit/JIT.h (174400 => 174401)
--- trunk/Source/_javascript_Core/jit/JIT.h 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/jit/JIT.h 2014-10-07 18:57:57 UTC (rev 174401)
@@ -514,7 +514,6 @@
void emit_op_new_array_with_size(Instruction*);
void emit_op_new_array_buffer(Instruction*);
void emit_op_new_func(Instruction*);
- void emit_op_new_captured_func(Instruction*);
void emit_op_new_func_exp(Instruction*);
void emit_op_new_object(Instruction*);
void emit_op_new_regexp(Instruction*);
Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (174400 => 174401)
--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2014-10-07 18:57:57 UTC (rev 174401)
@@ -1035,12 +1035,6 @@
lazyJump.link(this);
}
-void JIT::emit_op_new_captured_func(Instruction* currentInstruction)
-{
- JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_new_captured_func);
- slowPathCall.call();
-}
-
void JIT::emit_op_new_func_exp(Instruction* currentInstruction)
{
int dst = currentInstruction[1].u.operand;
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (174400 => 174401)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm 2014-10-07 18:57:57 UTC (rev 174401)
@@ -1909,13 +1909,6 @@
.opNewFuncDone:
dispatch(4)
-
-_llint_op_new_captured_func:
- traceExecution()
- callSlowPath(_slow_path_new_captured_func)
- dispatch(4)
-
-
macro arrayProfileForCall()
loadi 16[PC], t3
negi t3
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (174400 => 174401)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2014-10-07 18:57:57 UTC (rev 174401)
@@ -1769,13 +1769,6 @@
.opNewFuncDone:
dispatch(4)
-
-_llint_op_new_captured_func:
- traceExecution()
- callSlowPath(_slow_path_new_captured_func)
- dispatch(4)
-
-
macro arrayProfileForCall()
loadisFromInstruction(4, t3)
negp t3
Modified: trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp (174400 => 174401)
--- trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp 2014-10-07 18:57:57 UTC (rev 174401)
@@ -262,17 +262,6 @@
RETURN(v1.toThis(exec, exec->codeBlock()->isStrictMode() ? StrictMode : NotStrictMode));
}
-SLOW_PATH_DECL(slow_path_new_captured_func)
-{
- BEGIN();
- CodeBlock* codeBlock = exec->codeBlock();
- ASSERT(codeBlock->codeType() != FunctionCode || !codeBlock->needsActivation() || exec->hasActivation());
- JSValue value = JSFunction::create(vm, codeBlock->functionDecl(pc[2].u.operand), exec->scope());
- if (VariableWatchpointSet* set = pc[3].u.watchpointSet)
- set->notifyWrite(vm, value, "Executed op_new_captured_func");
- RETURN(value);
-}
-
SLOW_PATH_DECL(slow_path_not)
{
BEGIN();
Modified: trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h (174400 => 174401)
--- trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h 2014-10-07 18:41:49 UTC (rev 174400)
+++ trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h 2014-10-07 18:57:57 UTC (rev 174401)
@@ -190,7 +190,6 @@
SLOW_PATH_HIDDEN_DECL(slow_path_enter);
SLOW_PATH_HIDDEN_DECL(slow_path_get_callee);
SLOW_PATH_HIDDEN_DECL(slow_path_to_this);
-SLOW_PATH_HIDDEN_DECL(slow_path_new_captured_func);
SLOW_PATH_HIDDEN_DECL(slow_path_not);
SLOW_PATH_HIDDEN_DECL(slow_path_eq);
SLOW_PATH_HIDDEN_DECL(slow_path_neq);