Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (180513 => 180514)
--- trunk/Source/_javascript_Core/ChangeLog 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-02-23 21:54:15 UTC (rev 180514)
@@ -1,5 +1,64 @@
2015-02-23 Filip Pizlo <[email protected]>
+ Scopes should always be created with a previously-created symbol table rather than creating one on the fly
+ https://bugs.webkit.org/show_bug.cgi?id=141915
+
+ Reviewed by Mark Lam.
+
+ The main effect of this change is that pushing name scopes no longer requires creating symbol
+ tables on the fly.
+
+ This also makes it so that JSEnvironmentRecords must always have an a priori symbol table.
+
+ JSSegmentedVariableObject still does a hack where it creates a blank symbol table on-demand.
+ This is needed because that's what JSGlobalObject and all of its many subclasses want. That's
+ harmless; I mainly needed a prior symbol tables for JSEnvironmentRecords anyway.
+
+ * bytecode/BytecodeList.json:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitPushFunctionNameScope):
+ (JSC::BytecodeGenerator::emitPushCatchScope):
+ * jit/CCallHelpers.h:
+ (JSC::CCallHelpers::setupArgumentsWithExecState):
+ * jit/JIT.h:
+ * jit/JITInlines.h:
+ (JSC::JIT::callOperation):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_push_name_scope):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_push_name_scope):
+ * jit/JITOperations.cpp:
+ (JSC::pushNameScope):
+ * jit/JITOperations.h:
+ * llint/LLIntSlowPaths.cpp:
+ (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+ * llint/LowLevelInterpreter.asm:
+ * runtime/Executable.cpp:
+ (JSC::ScriptExecutable::newCodeBlockFor):
+ * runtime/JSCatchScope.h:
+ (JSC::JSCatchScope::JSCatchScope):
+ (JSC::JSCatchScope::create):
+ * runtime/JSEnvironmentRecord.h:
+ (JSC::JSEnvironmentRecord::JSEnvironmentRecord):
+ * runtime/JSFunctionNameScope.h:
+ (JSC::JSFunctionNameScope::JSFunctionNameScope):
+ (JSC::JSFunctionNameScope::create):
+ * runtime/JSNameScope.cpp:
+ (JSC::JSNameScope::create):
+ * runtime/JSNameScope.h:
+ (JSC::JSNameScope::create):
+ (JSC::JSNameScope::finishCreation):
+ (JSC::JSNameScope::JSNameScope):
+ * runtime/JSSegmentedVariableObject.h:
+ (JSC::JSSegmentedVariableObject::finishCreation):
+ * runtime/JSSymbolTableObject.h:
+ (JSC::JSSymbolTableObject::JSSymbolTableObject):
+ (JSC::JSSymbolTableObject::finishCreation): Deleted.
+ * runtime/SymbolTable.h:
+ (JSC::SymbolTable::createNameScopeTable):
+
+2015-02-23 Filip Pizlo <[email protected]>
+
Add a comment to clarify that the test was taken from the bug report, in response to
feedback from Michael Saboff and Benjamin Poulain.
Modified: trunk/Source/_javascript_Core/bytecode/BytecodeList.json (180513 => 180514)
--- trunk/Source/_javascript_Core/bytecode/BytecodeList.json 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeList.json 2015-02-23 21:54:15 UTC (rev 180514)
@@ -109,7 +109,7 @@
{ "name" : "op_put_to_scope", "length" : 7 },
{ "name" : "op_push_with_scope", "length" : 3 },
{ "name" : "op_pop_scope", "length" : 2 },
- { "name" : "op_push_name_scope", "length" : 6 },
+ { "name" : "op_push_name_scope", "length" : 5 },
{ "name" : "op_catch", "length" : 2 },
{ "name" : "op_throw", "length" : 2 },
{ "name" : "op_throw_static_error", "length" : 3 },
Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (180513 => 180514)
--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2015-02-23 21:54:15 UTC (rev 180514)
@@ -2394,9 +2394,8 @@
{
emitOpcode(op_push_name_scope);
instructions().append(dst->index());
- instructions().append(addConstant(property));
instructions().append(value->index());
- instructions().append(attributes);
+ instructions().append(addConstantValue(SymbolTable::createNameScopeTable(*vm(), property, attributes))->index());
instructions().append(JSNameScope::FunctionNameScope);
}
@@ -2409,9 +2408,8 @@
emitOpcode(op_push_name_scope);
instructions().append(dst->index());
- instructions().append(addConstant(property));
instructions().append(value->index());
- instructions().append(attributes);
+ instructions().append(addConstantValue(SymbolTable::createNameScopeTable(*vm(), property, attributes))->index());
instructions().append(JSNameScope::CatchScope);
}
Modified: trunk/Source/_javascript_Core/jit/CCallHelpers.h (180513 => 180514)
--- trunk/Source/_javascript_Core/jit/CCallHelpers.h 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/jit/CCallHelpers.h 2015-02-23 21:54:15 UTC (rev 180514)
@@ -436,6 +436,16 @@
addCallArgument(arg5);
}
+ ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4)
+ {
+ resetCallArguments();
+ addCallArgument(GPRInfo::callFrameRegister);
+ addCallArgument(arg1);
+ addCallArgument(arg2);
+ addCallArgument(arg3);
+ addCallArgument(arg4);
+ }
+
ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4, TrustedImm32 arg5)
{
resetCallArguments();
@@ -1619,6 +1629,12 @@
setupArgumentsWithExecState(arg1, arg2, arg3);
}
+ ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4)
+ {
+ poke(arg4, POKE_ARGUMENT_OFFSET);
+ setupArgumentsWithExecState(arg1, arg2, arg3);
+ }
+
ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4, TrustedImm32 arg5)
{
poke(arg5, POKE_ARGUMENT_OFFSET + 1);
Modified: trunk/Source/_javascript_Core/jit/JIT.h (180513 => 180514)
--- trunk/Source/_javascript_Core/jit/JIT.h 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/jit/JIT.h 2015-02-23 21:54:15 UTC (rev 180514)
@@ -717,11 +717,7 @@
MacroAssembler::Call callOperation(V_JITOperation_ECC, RegisterID, RegisterID);
MacroAssembler::Call callOperation(V_JITOperation_ECICC, RegisterID, const Identifier*, RegisterID, RegisterID);
MacroAssembler::Call callOperation(J_JITOperation_EE, RegisterID);
-#if USE(JSVALUE64)
- MacroAssembler::Call callOperation(V_JITOperation_EZIdJZZ, int, const Identifier*, RegisterID, int32_t, int32_t);
-#else
- MacroAssembler::Call callOperation(V_JITOperation_EZIdJZ, int, const Identifier*, RegisterID, int32_t);
-#endif
+ MacroAssembler::Call callOperation(V_JITOperation_EZSymtabJ, int, SymbolTable*, RegisterID);
MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID);
#if USE(JSVALUE64)
MacroAssembler::Call callOperationNoExceptionCheck(V_JITOperation_EJ, RegisterID);
@@ -754,7 +750,7 @@
MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, GPRReg, size_t);
MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID, RegisterID);
MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID, RegisterID, RegisterID);
- MacroAssembler::Call callOperation(V_JITOperation_EZIdJZ, int, const Identifier*, RegisterID, RegisterID, int32_t);
+ MacroAssembler::Call callOperation(V_JITOperation_EZSymtabJ, int, SymbolTable*, RegisterID, RegisterID);
MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID, RegisterID);
MacroAssembler::Call callOperation(V_JITOperation_EJJJ, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID);
MacroAssembler::Call callOperation(V_JITOperation_EJZ, RegisterID, RegisterID, int32_t);
Modified: trunk/Source/_javascript_Core/jit/JITInlines.h (180513 => 180514)
--- trunk/Source/_javascript_Core/jit/JITInlines.h 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/jit/JITInlines.h 2015-02-23 21:54:15 UTC (rev 180514)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2012, 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -460,9 +460,9 @@
return appendCallWithExceptionCheck(operation);
}
-ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EZIdJZZ operation, int op1, const Identifier* identOp2, RegisterID regOp3, int32_t op4, int32_t op5)
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EZSymtabJ operation, int op1, SymbolTable* symbolTable, RegisterID regOp3)
{
- setupArgumentsWithExecState(TrustedImm32(op1), TrustedImmPtr(identOp2), regOp3, TrustedImm32(op4), TrustedImm32(op5));
+ setupArgumentsWithExecState(TrustedImm32(op1), TrustedImmPtr(symbolTable), regOp3);
return appendCallWithExceptionCheck(operation);
}
@@ -594,9 +594,9 @@
return appendCallWithExceptionCheck(operation);
}
-ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EZIdJZ operation, int32_t op1, const Identifier* identOp2, RegisterID regOp3Tag, RegisterID regOp3Payload, int32_t op4)
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EZSymtabJ operation, int32_t op1, SymbolTable* symbolTable, RegisterID regOp3Tag, RegisterID regOp3Payload)
{
- setupArgumentsWithExecState(TrustedImm32(op1), TrustedImmPtr(identOp2), EABI_32BIT_DUMMY_ARG regOp3Payload, regOp3Tag, TrustedImm32(op4));
+ setupArgumentsWithExecState(TrustedImm32(op1), TrustedImmPtr(symbolTable), EABI_32BIT_DUMMY_ARG regOp3Payload, regOp3Tag);
return appendCallWithExceptionCheck(operation);
}
Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (180513 => 180514)
--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2015-02-23 21:54:15 UTC (rev 180514)
@@ -37,6 +37,7 @@
#include "JSArray.h"
#include "JSCell.h"
#include "JSFunction.h"
+#include "JSNameScope.h"
#include "JSPropertyNameEnumerator.h"
#include "LinkBuffer.h"
#include "MaxFrameExtentForSlowPathCall.h"
@@ -486,8 +487,14 @@
void JIT::emit_op_push_name_scope(Instruction* currentInstruction)
{
int dst = currentInstruction[1].u.operand;
- emitGetVirtualRegister(currentInstruction[3].u.operand, regT0);
- callOperation(operationPushNameScope, dst, &m_codeBlock->identifier(currentInstruction[2].u.operand), regT0, currentInstruction[4].u.operand, currentInstruction[5].u.operand);
+ emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);
+ if (currentInstruction[4].u.operand == JSNameScope::CatchScope) {
+ callOperation(operationPushCatchScope, dst, jsCast<SymbolTable*>(getConstantOperand(currentInstruction[3].u.operand)), regT0);
+ return;
+ }
+
+ RELEASE_ASSERT(currentInstruction[4].u.operand == JSNameScope::FunctionNameScope);
+ callOperation(operationPushFunctionNameScope, dst, jsCast<SymbolTable*>(getConstantOperand(currentInstruction[3].u.operand)), regT0);
}
void JIT::emit_op_catch(Instruction* currentInstruction)
Modified: trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp (180513 => 180514)
--- trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp 2015-02-23 21:54:15 UTC (rev 180514)
@@ -779,14 +779,14 @@
void JIT::emit_op_push_name_scope(Instruction* currentInstruction)
{
int dst = currentInstruction[1].u.operand;
- emitLoad(currentInstruction[3].u.operand, regT1, regT0);
- if (currentInstruction[5].u.operand == JSNameScope::CatchScope) {
- callOperation(operationPushCatchScope, dst, &m_codeBlock->identifier(currentInstruction[2].u.operand), regT1, regT0, currentInstruction[4].u.operand);
+ emitLoad(currentInstruction[2].u.operand, regT1, regT0);
+ if (currentInstruction[4].u.operand == JSNameScope::CatchScope) {
+ callOperation(operationPushCatchScope, dst, jsCast<SymbolTable*>(getConstantOperand(currentInstruction[3].u.operand)), regT1, regT0);
return;
}
- RELEASE_ASSERT(currentInstruction[5].u.operand == JSNameScope::FunctionNameScope);
- callOperation(operationPushFunctionNameScope, dst, &m_codeBlock->identifier(currentInstruction[2].u.operand), regT1, regT0, currentInstruction[4].u.operand);
+ RELEASE_ASSERT(currentInstruction[4].u.operand == JSNameScope::FunctionNameScope);
+ callOperation(operationPushFunctionNameScope, dst, jsCast<SymbolTable*>(getConstantOperand(currentInstruction[3].u.operand)), regT1, regT0);
}
void JIT::emit_op_catch(Instruction* currentInstruction)
Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (180513 => 180514)
--- trunk/Source/_javascript_Core/jit/JITOperations.cpp 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp 2015-02-23 21:54:15 UTC (rev 180514)
@@ -44,6 +44,8 @@
#include "JIT.h"
#include "JITToDFGDeferredCompilationCallback.h"
#include "JSCInlines.h"
+#include "JSCatchScope.h"
+#include "JSFunctionNameScope.h"
#include "JSGlobalObjectFunctions.h"
#include "JSNameScope.h"
#include "JSPropertyNameEnumerator.h"
@@ -59,6 +61,24 @@
namespace JSC {
+template<typename ScopeType>
+void pushNameScope(ExecState* exec, int32_t dst, SymbolTable* symbolTable, EncodedJSValue encodedValue)
+{
+ VM& vm = exec->vm();
+ NativeCallFrameTracer tracer(&vm, exec);
+
+ ASSERT(!JITCode::isOptimizingJIT(exec->codeBlock()->jitType()));
+
+ // FIXME: This won't work if this operation is called from the DFG or FTL.
+ // This should be changed to pass in the new scope.
+ JSScope* currentScope = exec->uncheckedR(dst).Register::scope();
+ JSNameScope* scope = ScopeType::create(vm, exec->lexicalGlobalObject(), currentScope, symbolTable, JSValue::decode(encodedValue));
+
+ // FIXME: This won't work if this operation is called from the DFG or FTL.
+ // This should be changed to return the new scope.
+ exec->uncheckedR(dst) = scope;
+}
+
extern "C" {
#if COMPILER(MSVC)
@@ -1269,34 +1289,16 @@
}
#endif
-void JIT_OPERATION operationPushNameScope(ExecState* exec, int32_t dst, Identifier* identifier, EncodedJSValue encodedValue, int32_t attibutes, int32_t type)
+void JIT_OPERATION operationPushCatchScope(ExecState* exec, int32_t dst, SymbolTable* symbolTable, EncodedJSValue encodedValue)
{
- VM& vm = exec->vm();
- NativeCallFrameTracer tracer(&vm, exec);
-
- // FIXME: This won't work if this operation is called from the DFG or FTL.
- // This should be changed to pass in the new scope.
- JSScope* currentScope = exec->uncheckedR(dst).Register::scope();
- JSNameScope::Type scopeType = static_cast<JSNameScope::Type>(type);
- JSNameScope* scope = JSNameScope::create(vm, exec->lexicalGlobalObject(), currentScope, *identifier, JSValue::decode(encodedValue), attibutes, scopeType);
-
- // FIXME: This won't work if this operation is called from the DFG or FTL.
- // This should be changed to return the new scope.
- exec->uncheckedR(dst) = scope;
+ pushNameScope<JSCatchScope>(exec, dst, symbolTable, encodedValue);
}
-#if USE(JSVALUE32_64)
-void JIT_OPERATION operationPushCatchScope(ExecState* exec, int32_t dst, Identifier* identifier, EncodedJSValue encodedValue, int32_t attibutes)
+void JIT_OPERATION operationPushFunctionNameScope(ExecState* exec, int32_t dst, SymbolTable* symbolTable, EncodedJSValue encodedValue)
{
- operationPushNameScope(exec, dst, identifier, encodedValue, attibutes, JSNameScope::CatchScope);
+ pushNameScope<JSFunctionNameScope>(exec, dst, symbolTable, encodedValue);
}
-void JIT_OPERATION operationPushFunctionNameScope(ExecState* exec, int32_t dst, Identifier* identifier, EncodedJSValue encodedValue, int32_t attibutes)
-{
- operationPushNameScope(exec, dst, identifier, encodedValue, attibutes, JSNameScope::FunctionNameScope);
-}
-#endif
-
void JIT_OPERATION operationPushWithScope(ExecState* exec, int32_t dst, EncodedJSValue encodedValue)
{
VM& vm = exec->vm();
Modified: trunk/Source/_javascript_Core/jit/JITOperations.h (180513 => 180514)
--- trunk/Source/_javascript_Core/jit/JITOperations.h 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/jit/JITOperations.h 2015-02-23 21:54:15 UTC (rev 180514)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -81,6 +81,7 @@
Sprt: SlowPathReturnType
Ssi: StructureStubInfo*
St: Structure*
+ Symtab: SymbolTable*
V: void
Vm: VM*
Vws: VariableWatchpointSet*
@@ -170,11 +171,7 @@
typedef void JIT_OPERATION (*V_JITOperation_ECPSPS)(ExecState*, JSCell*, void*, size_t, void*, size_t);
typedef void JIT_OPERATION (*V_JITOperation_ECZ)(ExecState*, JSCell*, int32_t);
typedef void JIT_OPERATION (*V_JITOperation_ECC)(ExecState*, JSCell*, JSCell*);
-#if USE(JSVALUE64)
-typedef void JIT_OPERATION (*V_JITOperation_EZIdJZZ)(ExecState*, int, Identifier*, EncodedJSValue, int32_t, int32_t);
-#else
-typedef void JIT_OPERATION (*V_JITOperation_EZIdJZ)(ExecState*, int, Identifier*, EncodedJSValue, int32_t);
-#endif
+typedef void JIT_OPERATION (*V_JITOperation_EZSymtabJ)(ExecState*, int32_t, SymbolTable*, EncodedJSValue);
typedef void JIT_OPERATION (*V_JITOperation_EJ)(ExecState*, EncodedJSValue);
typedef void JIT_OPERATION (*V_JITOperation_EJCI)(ExecState*, EncodedJSValue, JSCell*, StringImpl*);
typedef void JIT_OPERATION (*V_JITOperation_EJIdJJ)(ExecState*, EncodedJSValue, Identifier*, EncodedJSValue, EncodedJSValue);
@@ -288,10 +285,9 @@
void JIT_OPERATION operationPutGetterSetter(ExecState*, EncodedJSValue, Identifier*, EncodedJSValue, EncodedJSValue) WTF_INTERNAL;
#else
void JIT_OPERATION operationPutGetterSetter(ExecState*, JSCell*, Identifier*, JSCell*, JSCell*) WTF_INTERNAL;
-void JIT_OPERATION operationPushCatchScope(ExecState*, int32_t, Identifier*, EncodedJSValue, int32_t) WTF_INTERNAL;
-void JIT_OPERATION operationPushFunctionNameScope(ExecState*, int32_t, Identifier*, EncodedJSValue, int32_t) WTF_INTERNAL;
#endif
-void JIT_OPERATION operationPushNameScope(ExecState*, int32_t, Identifier*, EncodedJSValue, int32_t, int32_t) WTF_INTERNAL;
+void JIT_OPERATION operationPushCatchScope(ExecState*, int32_t, SymbolTable*, EncodedJSValue) WTF_INTERNAL;
+void JIT_OPERATION operationPushFunctionNameScope(ExecState*, int32_t, SymbolTable*, EncodedJSValue) WTF_INTERNAL;
void JIT_OPERATION operationPushWithScope(ExecState*, int32_t, EncodedJSValue) WTF_INTERNAL;
void JIT_OPERATION operationPopScope(ExecState*, int32_t) WTF_INTERNAL;
void JIT_OPERATION operationProfileDidCall(ExecState*, EncodedJSValue) WTF_INTERNAL;
Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (180513 => 180514)
--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2015-02-23 21:54:15 UTC (rev 180514)
@@ -1286,11 +1286,12 @@
LLINT_SLOW_PATH_DECL(slow_path_push_name_scope)
{
LLINT_BEGIN();
- CodeBlock* codeBlock = exec->codeBlock();
int scopeReg = pc[1].u.operand;
JSScope* currentScope = exec->uncheckedR(scopeReg).Register::scope();
- JSNameScope::Type type = static_cast<JSNameScope::Type>(pc[5].u.operand);
- JSNameScope* scope = JSNameScope::create(vm, exec->lexicalGlobalObject(), currentScope, codeBlock->identifier(pc[2].u.operand), LLINT_OP(3).jsValue(), pc[4].u.operand, type);
+ JSValue value = LLINT_OP_C(2).jsValue();
+ SymbolTable* symbolTable = jsCast<SymbolTable*>(LLINT_OP_C(3).jsValue());
+ JSNameScope::Type type = static_cast<JSNameScope::Type>(pc[4].u.operand);
+ JSNameScope* scope = JSNameScope::create(vm, exec->lexicalGlobalObject(), currentScope, symbolTable, value, type);
exec->uncheckedR(scopeReg) = scope;
LLINT_END();
}
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (180513 => 180514)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2015-02-23 21:54:15 UTC (rev 180514)
@@ -1256,7 +1256,7 @@
_llint_op_push_name_scope:
traceExecution()
callSlowPath(_llint_slow_path_push_name_scope)
- dispatch(6)
+ dispatch(5)
_llint_op_throw:
Modified: trunk/Source/_javascript_Core/runtime/Executable.cpp (180513 => 180514)
--- trunk/Source/_javascript_Core/runtime/Executable.cpp 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/runtime/Executable.cpp 2015-02-23 21:54:15 UTC (rev 180514)
@@ -253,8 +253,10 @@
// We shouldn't have to do this. But we do, because bytecode linking requires a real scope
// chain.
// FIXME: https://bugs.webkit.org/show_bug.cgi?id=141885
+ SymbolTable* symbolTable =
+ SymbolTable::createNameScopeTable(*vm, executable->name(), ReadOnly | DontDelete);
scope = JSFunctionNameScope::create(
- *vm, scope->globalObject(), scope, executable->name(), function, ReadOnly | DontDelete);
+ *vm, scope->globalObject(), scope, symbolTable, function);
}
SourceProvider* provider = executable->source().provider();
Modified: trunk/Source/_javascript_Core/runtime/JSCatchScope.h (180513 => 180514)
--- trunk/Source/_javascript_Core/runtime/JSCatchScope.h 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/runtime/JSCatchScope.h 2015-02-23 21:54:15 UTC (rev 180514)
@@ -37,15 +37,15 @@
private:
friend class JSNameScope;
- JSCatchScope(VM& vm, JSGlobalObject* globalObject, JSScope* next)
- : Base(vm, globalObject->catchScopeStructure(), next)
+ JSCatchScope(VM& vm, JSGlobalObject* globalObject, JSScope* next, SymbolTable* symbolTable)
+ : Base(vm, globalObject->catchScopeStructure(), next, symbolTable)
{
}
public:
- static JSCatchScope* create(VM& vm, JSGlobalObject* globalObject, JSScope* currentScope, const Identifier& identifier, JSValue value, unsigned attributes)
+ static JSCatchScope* create(VM& vm, JSGlobalObject* globalObject, JSScope* currentScope, SymbolTable* symbolTable, JSValue value)
{
- return Base::create<JSCatchScope>(vm, globalObject, currentScope, identifier, value, attributes);
+ return Base::create<JSCatchScope>(vm, globalObject, currentScope, symbolTable, value);
}
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
Modified: trunk/Source/_javascript_Core/runtime/JSEnvironmentRecord.h (180513 => 180514)
--- trunk/Source/_javascript_Core/runtime/JSEnvironmentRecord.h 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/runtime/JSEnvironmentRecord.h 2015-02-23 21:54:15 UTC (rev 180514)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2008, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2012, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -62,7 +62,7 @@
Structure* structure,
Register* registers,
JSScope* scope,
- SymbolTable* symbolTable = 0)
+ SymbolTable* symbolTable)
: Base(vm, structure, scope, symbolTable)
, m_registers(reinterpret_cast<WriteBarrierBase<Unknown>*>(registers))
{
Modified: trunk/Source/_javascript_Core/runtime/JSFunctionNameScope.h (180513 => 180514)
--- trunk/Source/_javascript_Core/runtime/JSFunctionNameScope.h 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/runtime/JSFunctionNameScope.h 2015-02-23 21:54:15 UTC (rev 180514)
@@ -37,15 +37,15 @@
private:
friend class JSNameScope;
- JSFunctionNameScope(VM& vm, JSGlobalObject* globalObject, JSScope* next)
- : Base(vm, globalObject->catchScopeStructure(), next)
+ JSFunctionNameScope(VM& vm, JSGlobalObject* globalObject, JSScope* next, SymbolTable* symbolTable)
+ : Base(vm, globalObject->catchScopeStructure(), next, symbolTable)
{
}
public:
- static JSFunctionNameScope* create(VM& vm, JSGlobalObject* globalObject, JSScope* currentScope, const Identifier& identifier, JSValue value, unsigned attributes)
+ static JSFunctionNameScope* create(VM& vm, JSGlobalObject* globalObject, JSScope* currentScope, SymbolTable* symbolTable, JSValue value)
{
- return Base::create<JSFunctionNameScope>(vm, globalObject, currentScope, identifier, value, attributes);
+ return Base::create<JSFunctionNameScope>(vm, globalObject, currentScope, symbolTable, value);
}
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
Modified: trunk/Source/_javascript_Core/runtime/JSNameScope.cpp (180513 => 180514)
--- trunk/Source/_javascript_Core/runtime/JSNameScope.cpp 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/runtime/JSNameScope.cpp 2015-02-23 21:54:15 UTC (rev 180514)
@@ -35,13 +35,13 @@
const ClassInfo JSNameScope::s_info = { "NameScope", &Base::s_info, 0, CREATE_METHOD_TABLE(JSNameScope) };
-JSNameScope* JSNameScope::create(VM& vm, JSGlobalObject* globalObject, JSScope* currentScope, const Identifier& identifier, JSValue value, unsigned attributes, Type type)
+JSNameScope* JSNameScope::create(VM& vm, JSGlobalObject* globalObject, JSScope* currentScope, SymbolTable* symbolTable, JSValue value, Type type)
{
switch (type) {
case CatchScope:
- return JSCatchScope::create(vm, globalObject, currentScope, identifier, value, attributes);
+ return JSCatchScope::create(vm, globalObject, currentScope, symbolTable, value);
case FunctionNameScope:
- return JSFunctionNameScope::create(vm, globalObject, currentScope, identifier, value, attributes);
+ return JSFunctionNameScope::create(vm, globalObject, currentScope, symbolTable, value);
}
RELEASE_ASSERT_NOT_REACHED();
return nullptr;
Modified: trunk/Source/_javascript_Core/runtime/JSNameScope.h (180513 => 180514)
--- trunk/Source/_javascript_Core/runtime/JSNameScope.h 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/runtime/JSNameScope.h 2015-02-23 21:54:15 UTC (rev 180514)
@@ -42,14 +42,14 @@
};
template<typename T>
- static T* create(VM& vm, JSGlobalObject* globalObject, JSScope* currentScope, const Identifier& identifier, JSValue value, unsigned attributes)
+ static T* create(VM& vm, JSGlobalObject* globalObject, JSScope* currentScope, SymbolTable* symbolTable, JSValue value)
{
- T* scopeObject = new (NotNull, allocateCell<T>(vm.heap)) T(vm, globalObject, currentScope);
- scopeObject->finishCreation(vm, identifier, value, attributes);
+ T* scopeObject = new (NotNull, allocateCell<T>(vm.heap)) T(vm, globalObject, currentScope, symbolTable);
+ scopeObject->finishCreation(vm, value);
return scopeObject;
}
- static JSNameScope* create(VM&, JSGlobalObject*, JSScope* currentScope, const Identifier&, JSValue, unsigned attributes, Type);
+ static JSNameScope* create(VM&, JSGlobalObject*, JSScope* currentScope, SymbolTable*, JSValue, Type);
static void visitChildren(JSCell*, SlotVisitor&);
static JSValue toThis(JSCell*, ExecState*, ECMAMode);
@@ -61,22 +61,16 @@
JSValue value() const { return m_registerStore.get(); }
protected:
- void finishCreation(VM& vm, const Identifier& identifier, JSValue value, unsigned attributes)
+ void finishCreation(VM& vm, JSValue value)
{
Base::finishCreation(vm);
m_registerStore.set(vm, this, value);
- symbolTable()->add(identifier.impl(), SymbolTableEntry(-1, attributes));
}
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | Base::StructureFlags;
- JSNameScope(VM& vm, Structure* structure, JSScope* next)
- : Base(
- vm,
- structure,
- reinterpret_cast<Register*>(&m_registerStore + 1),
- next
- )
+ JSNameScope(VM& vm, Structure* structure, JSScope* next, SymbolTable* symbolTable)
+ : Base(vm, structure, reinterpret_cast<Register*>(&m_registerStore + 1), next, symbolTable)
{
}
Modified: trunk/Source/_javascript_Core/runtime/JSSegmentedVariableObject.h (180513 => 180514)
--- trunk/Source/_javascript_Core/runtime/JSSegmentedVariableObject.h 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/runtime/JSSegmentedVariableObject.h 2015-02-23 21:54:15 UTC (rev 180514)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -87,6 +87,7 @@
void finishCreation(VM& vm)
{
Base::finishCreation(vm);
+ m_symbolTable.set(vm, this, SymbolTable::create(vm));
}
SegmentedVector<WriteBarrier<Unknown>, 16> m_registers;
Modified: trunk/Source/_javascript_Core/runtime/JSSymbolTableObject.h (180513 => 180514)
--- trunk/Source/_javascript_Core/runtime/JSSymbolTableObject.h 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/runtime/JSSymbolTableObject.h 2015-02-23 21:54:15 UTC (rev 180514)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2014, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -50,18 +50,16 @@
protected:
static const unsigned StructureFlags = IsEnvironmentRecord | OverridesGetPropertyNames | Base::StructureFlags;
- JSSymbolTableObject(VM& vm, Structure* structure, JSScope* scope, SymbolTable* symbolTable = 0)
+ JSSymbolTableObject(VM& vm, Structure* structure, JSScope* scope)
: Base(vm, structure, scope)
{
- if (symbolTable)
- m_symbolTable.set(vm, this, symbolTable);
}
-
- void finishCreation(VM& vm)
+
+ JSSymbolTableObject(VM& vm, Structure* structure, JSScope* scope, SymbolTable* symbolTable)
+ : Base(vm, structure, scope)
{
- Base::finishCreation(vm);
- if (!m_symbolTable)
- m_symbolTable.set(vm, this, SymbolTable::create(vm));
+ ASSERT(symbolTable);
+ m_symbolTable.set(vm, this, symbolTable);
}
static void visitChildren(JSCell*, SlotVisitor&);
Modified: trunk/Source/_javascript_Core/runtime/SymbolTable.h (180513 => 180514)
--- trunk/Source/_javascript_Core/runtime/SymbolTable.h 2015-02-23 21:26:15 UTC (rev 180513)
+++ trunk/Source/_javascript_Core/runtime/SymbolTable.h 2015-02-23 21:54:15 UTC (rev 180514)
@@ -347,6 +347,14 @@
symbolTable->finishCreation(vm);
return symbolTable;
}
+
+ static SymbolTable* createNameScopeTable(VM& vm, const Identifier& ident, unsigned attributes)
+ {
+ SymbolTable* result = create(vm);
+ result->add(ident.impl(), SymbolTableEntry(-1, attributes));
+ return result;
+ }
+
static const bool needsDestruction = true;
static const bool hasImmortalStructure = true;
static void destroy(JSCell*);