Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (174215 => 174216)
--- trunk/Source/_javascript_Core/ChangeLog 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-10-02 15:15:03 UTC (rev 174216)
@@ -1,3 +1,56 @@
+2014-10-02 Mark Lam <[email protected]>
+
+ Fixed the Inspector to be able to properly distinguish between scope types.
+ <https://webkit.org/b/137279>
+
+ Reviewed by Geoffrey Garen.
+
+ The pre-existing code incorrectly labels Catch Scopes and Function Name Scopes
+ as With Scopes. This patch will fix this.
+
+ * bytecode/BytecodeList.json:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitPushFunctionNameScope):
+ (JSC::BytecodeGenerator::emitPushCatchScope):
+ - These now passes stores the desired JSNameScope::Type in a bytecode operand.
+ * debugger/DebuggerScope.cpp:
+ (JSC::DebuggerScope::isCatchScope):
+ (JSC::DebuggerScope::isFunctionNameScope):
+ - Added queries to be able to explicitly test if the scope is a CatchScope
+ or FunctionNameScope. The FunctionNameScope is the case where the
+ NameScope is used to capture the function name of a function _expression_.
+ * debugger/DebuggerScope.h:
+ * inspector/InjectedScriptSource.js:
+ * inspector/JSJavaScriptCallFrame.cpp:
+ (Inspector::JSJavaScriptCallFrame::scopeType):
+ * inspector/JSJavaScriptCallFrame.h:
+ * inspector/JSJavaScriptCallFramePrototype.cpp:
+ (Inspector::JSJavaScriptCallFramePrototype::finishCreation):
+ (Inspector::jsJavaScriptCallFrameConstantFUNCTION_NAME_SCOPE):
+ * inspector/protocol/Debugger.json:
+ * 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:
+ * jit/JITOperations.h:
+ * llint/LLIntSlowPaths.cpp:
+ (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+ * llint/LowLevelInterpreter.asm:
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::addNameScopeIfNeeded):
+ * runtime/JSNameScope.h:
+ (JSC::JSNameScope::create):
+ (JSC::JSNameScope::isFunctionNameScope):
+ (JSC::JSNameScope::isCatchScope):
+ (JSC::JSNameScope::JSNameScope):
+ - Now stores the JSNameScope::Type in a field.
+
2014-10-01 Commit Queue <[email protected]>
Unreviewed, rolling out r174180, r174183, and r174186.
Modified: trunk/Source/_javascript_Core/bytecode/BytecodeList.json (174215 => 174216)
--- trunk/Source/_javascript_Core/bytecode/BytecodeList.json 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeList.json 2014-10-02 15:15:03 UTC (rev 174216)
@@ -112,7 +112,7 @@
{ "name" : "op_put_to_scope", "length" : 7 },
{ "name" : "op_push_with_scope", "length" : 2 },
{ "name" : "op_pop_scope", "length" : 1 },
- { "name" : "op_push_name_scope", "length" : 4 },
+ { "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 (174215 => 174216)
--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2014-10-02 15:15:03 UTC (rev 174216)
@@ -2294,6 +2294,7 @@
instructions().append(addConstant(property));
instructions().append(value->index());
instructions().append(attributes);
+ instructions().append(JSNameScope::FunctionNameScope);
}
void BytecodeGenerator::emitPushCatchScope(const Identifier& property, RegisterID* value, unsigned attributes)
@@ -2307,6 +2308,7 @@
instructions().append(addConstant(property));
instructions().append(value->index());
instructions().append(attributes);
+ instructions().append(JSNameScope::CatchScope);
}
void BytecodeGenerator::beginSwitch(RegisterID* scrutineeRegister, SwitchInfo::SwitchType type)
Modified: trunk/Source/_javascript_Core/debugger/DebuggerScope.cpp (174215 => 174216)
--- trunk/Source/_javascript_Core/debugger/DebuggerScope.cpp 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/debugger/DebuggerScope.cpp 2014-10-02 15:15:03 UTC (rev 174216)
@@ -28,6 +28,7 @@
#include "JSLexicalEnvironment.h"
#include "JSCInlines.h"
+#include "JSNameScope.h"
#include "JSWithScope.h"
namespace JSC {
@@ -154,6 +155,16 @@
}
}
+bool DebuggerScope::isCatchScope() const
+{
+ return m_scope->isNameScopeObject() && reinterpret_cast<JSNameScope*>(m_scope.get())->isCatchScope();
+}
+
+bool DebuggerScope::isFunctionNameScope() const
+{
+ return m_scope->isNameScopeObject() && reinterpret_cast<JSNameScope*>(m_scope.get())->isFunctionNameScope();
+}
+
bool DebuggerScope::isWithScope() const
{
return m_scope->isWithScope();
Modified: trunk/Source/_javascript_Core/debugger/DebuggerScope.h (174215 => 174216)
--- trunk/Source/_javascript_Core/debugger/DebuggerScope.h 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/debugger/DebuggerScope.h 2014-10-02 15:15:03 UTC (rev 174216)
@@ -84,6 +84,8 @@
void invalidateChain();
bool isValid() const { return !!m_scope; }
+ bool isCatchScope() const;
+ bool isFunctionNameScope() const;
bool isWithScope() const;
bool isGlobalScope() const;
bool isFunctionOrEvalScope() const;
Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js (174215 => 174216)
--- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2014-10-02 15:15:03 UTC (rev 174216)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -1018,6 +1018,7 @@
const WITH_SCOPE = 2;
const CLOSURE_SCOPE = 3;
const CATCH_SCOPE = 4;
+ const FUNCTION_NAME_SCOPE = 5;
/** @type {!Object.<number, string>} */
var scopeTypeNames = {};
@@ -1026,6 +1027,7 @@
scopeTypeNames[WITH_SCOPE] = "with";
scopeTypeNames[CLOSURE_SCOPE] = "closure";
scopeTypeNames[CATCH_SCOPE] = "catch";
+ scopeTypeNames[FUNCTION_NAME_SCOPE] = "functionName";
return {
object: injectedScript._wrapObject(scopeObject, groupId),
Modified: trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFrame.cpp (174215 => 174216)
--- trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFrame.cpp 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFrame.cpp 2014-10-02 15:15:03 UTC (rev 174216)
@@ -111,13 +111,16 @@
}
if (!index) {
+ if (scope->isCatchScope())
+ return jsNumber(JSJavaScriptCallFrame::CATCH_SCOPE);
+ if (scope->isFunctionNameScope())
+ return jsNumber(JSJavaScriptCallFrame::FUNCTION_NAME_SCOPE);
if (scope->isWithScope())
return jsNumber(JSJavaScriptCallFrame::WITH_SCOPE);
if (scope->isGlobalScope()) {
ASSERT(++iter == end);
return jsNumber(JSJavaScriptCallFrame::GLOBAL_SCOPE);
}
- // FIXME: We should be identifying and returning CATCH_SCOPE appropriately.
ASSERT(scope->isFunctionOrEvalScope());
return jsNumber(JSJavaScriptCallFrame::CLOSURE_SCOPE);
}
Modified: trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFrame.h (174215 => 174216)
--- trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFrame.h 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFrame.h 2014-10-02 15:15:03 UTC (rev 174216)
@@ -77,6 +77,7 @@
static const unsigned short WITH_SCOPE = 2;
static const unsigned short CLOSURE_SCOPE = 3;
static const unsigned short CATCH_SCOPE = 4;
+ static const unsigned short FUNCTION_NAME_SCOPE = 5;
protected:
static const unsigned StructureFlags = Base::StructureFlags;
Modified: trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFramePrototype.cpp (174215 => 174216)
--- trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFramePrototype.cpp 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFramePrototype.cpp 2014-10-02 15:15:03 UTC (rev 174216)
@@ -59,6 +59,7 @@
static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantWITH_SCOPE(ExecState*);
static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantCLOSURE_SCOPE(ExecState*);
static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantCATCH_SCOPE(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantFUNCTION_NAME_SCOPE(ExecState*);
const ClassInfo JSJavaScriptCallFramePrototype::s_info = { "_javascript_CallFrame", &Base::s_info, 0, CREATE_METHOD_TABLE(JSJavaScriptCallFramePrototype) };
@@ -94,6 +95,7 @@
JSC_NATIVE_NON_INDEX_ACCESSOR("WITH_SCOPE", jsJavaScriptCallFrameConstantWITH_SCOPE, DontEnum | Accessor);
JSC_NATIVE_NON_INDEX_ACCESSOR("CLOSURE_SCOPE", jsJavaScriptCallFrameConstantCLOSURE_SCOPE, DontEnum | Accessor);
JSC_NATIVE_NON_INDEX_ACCESSOR("CATCH_SCOPE", jsJavaScriptCallFrameConstantCATCH_SCOPE, DontEnum | Accessor);
+ JSC_NATIVE_NON_INDEX_ACCESSOR("FUNCTION_NAME_SCOPE", jsJavaScriptCallFrameConstantFUNCTION_NAME_SCOPE, DontEnum | Accessor);
}
EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFramePrototypeFunctionEvaluate(ExecState* exec)
@@ -231,6 +233,11 @@
return JSValue::encode(jsNumber(JSJavaScriptCallFrame::CATCH_SCOPE));
}
+EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantFUNCTION_NAME_SCOPE(ExecState*)
+{
+ return JSValue::encode(jsNumber(JSJavaScriptCallFrame::FUNCTION_NAME_SCOPE));
+}
+
} // namespace Inspector
#endif // ENABLE(INSPECTOR)
Modified: trunk/Source/_javascript_Core/inspector/protocol/Debugger.json (174215 => 174216)
--- trunk/Source/_javascript_Core/inspector/protocol/Debugger.json 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/inspector/protocol/Debugger.json 2014-10-02 15:15:03 UTC (rev 174216)
@@ -80,7 +80,7 @@
"id": "Scope",
"type": "object",
"properties": [
- { "name": "type", "type": "string", "enum": ["global", "local", "with", "closure", "catch"], "description": "Scope type." },
+ { "name": "type", "type": "string", "enum": ["global", "local", "with", "closure", "catch", "functionName"], "description": "Scope type." },
{ "name": "object", "$ref": "Runtime.RemoteObject", "description": "Object representing the scope. For <code>global</code> and <code>with</code> scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties." }
],
"description": "Scope description."
Modified: trunk/Source/_javascript_Core/jit/CCallHelpers.h (174215 => 174216)
--- trunk/Source/_javascript_Core/jit/CCallHelpers.h 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/jit/CCallHelpers.h 2014-10-02 15:15:03 UTC (rev 174216)
@@ -474,6 +474,17 @@
addCallArgument(arg4);
}
+ ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5)
+ {
+ resetCallArguments();
+ addCallArgument(GPRInfo::callFrameRegister);
+ addCallArgument(arg1);
+ addCallArgument(arg2);
+ addCallArgument(arg3);
+ addCallArgument(arg4);
+ addCallArgument(arg5);
+ }
+
ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImmPtr arg5)
{
resetCallArguments();
@@ -1285,6 +1296,17 @@
move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
}
+#if CPU(X86_64) || CPU(ARM64)
+ ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImm32 arg4)
+ {
+ move(arg2, GPRInfo::argumentGPR2); // In case arg2 is argumentGPR1.
+ move(arg1, GPRInfo::argumentGPR1);
+ move(arg3, GPRInfo::argumentGPR3);
+ move(arg4, GPRInfo::argumentGPR4);
+ move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+ }
+#endif
+
ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImmPtr arg3)
{
move(arg2, GPRInfo::argumentGPR2); // In case arg2 is argumentGPR1.
@@ -1364,6 +1386,13 @@
setupArgumentsWithExecState(arg1, arg2, arg3);
}
+ ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5)
+ {
+ poke(arg5, POKE_ARGUMENT_OFFSET + 1);
+ poke(arg4, POKE_ARGUMENT_OFFSET);
+ setupArgumentsWithExecState(arg1, arg2, arg3);
+ }
+
ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImmPtr arg5)
{
poke(arg5, POKE_ARGUMENT_OFFSET + 1);
@@ -1645,6 +1674,15 @@
move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
}
+ ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5)
+ {
+ setupTwoStubArgsGPR<GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg2, arg3);
+ move(arg1, GPRInfo::argumentGPR1);
+ move(arg4, GPRInfo::argumentGPR4);
+ move(arg5, GPRInfo::argumentGPR5);
+ move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+ }
+
ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4)
{
setupThreeStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg1, arg2, arg3);
Modified: trunk/Source/_javascript_Core/jit/JIT.h (174215 => 174216)
--- trunk/Source/_javascript_Core/jit/JIT.h 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/jit/JIT.h 2014-10-02 15:15:03 UTC (rev 174216)
@@ -719,7 +719,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);
- MacroAssembler::Call callOperation(V_JITOperation_EIdJZ, const Identifier*, RegisterID, int32_t);
+ MacroAssembler::Call callOperation(V_JITOperation_EIdJZZ, const Identifier*, RegisterID, int32_t, int32_t);
MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID);
#if USE(JSVALUE64)
MacroAssembler::Call callOperationNoExceptionCheck(V_JITOperation_EJ, RegisterID);
@@ -751,7 +751,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_EIdJZ, const Identifier*, RegisterID, RegisterID, int32_t);
+ MacroAssembler::Call callOperation(V_JITOperation_EIdJZZ, const Identifier*, RegisterID, RegisterID, int32_t, int32_t);
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 (174215 => 174216)
--- trunk/Source/_javascript_Core/jit/JITInlines.h 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/jit/JITInlines.h 2014-10-02 15:15:03 UTC (rev 174216)
@@ -441,9 +441,9 @@
return appendCallWithExceptionCheck(operation);
}
-ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EIdJZ operation, const Identifier* identOp1, RegisterID regOp2, int32_t op3)
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EIdJZZ operation, const Identifier* identOp1, RegisterID regOp2, int32_t op3, int32_t op4)
{
- setupArgumentsWithExecState(TrustedImmPtr(identOp1), regOp2, TrustedImm32(op3));
+ setupArgumentsWithExecState(TrustedImmPtr(identOp1), regOp2, TrustedImm32(op3), TrustedImm32(op4));
return appendCallWithExceptionCheck(operation);
}
@@ -575,9 +575,9 @@
return appendCallWithExceptionCheck(operation);
}
-ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EIdJZ operation, const Identifier* identOp1, RegisterID regOp2Tag, RegisterID regOp2Payload, int32_t op3)
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EIdJZZ operation, const Identifier* identOp1, RegisterID regOp2Tag, RegisterID regOp2Payload, int32_t op3, int32_t op4)
{
- setupArgumentsWithExecState(TrustedImmPtr(identOp1), regOp2Payload, regOp2Tag, TrustedImm32(op3));
+ setupArgumentsWithExecState(TrustedImmPtr(identOp1), regOp2Payload, regOp2Tag, TrustedImm32(op3), TrustedImm32(op4));
return appendCallWithExceptionCheck(operation);
}
Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (174215 => 174216)
--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2014-10-02 15:15:03 UTC (rev 174216)
@@ -525,7 +525,7 @@
void JIT::emit_op_push_name_scope(Instruction* currentInstruction)
{
emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);
- callOperation(operationPushNameScope, &m_codeBlock->identifier(currentInstruction[1].u.operand), regT0, currentInstruction[3].u.operand);
+ callOperation(operationPushNameScope, &m_codeBlock->identifier(currentInstruction[1].u.operand), regT0, currentInstruction[3].u.operand, currentInstruction[4].u.operand);
}
void JIT::emit_op_catch(Instruction* currentInstruction)
Modified: trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp (174215 => 174216)
--- trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp 2014-10-02 15:15:03 UTC (rev 174216)
@@ -805,7 +805,7 @@
void JIT::emit_op_push_name_scope(Instruction* currentInstruction)
{
emitLoad(currentInstruction[2].u.operand, regT1, regT0);
- callOperation(operationPushNameScope, &m_codeBlock->identifier(currentInstruction[1].u.operand), regT1, regT0, currentInstruction[3].u.operand);
+ callOperation(operationPushNameScope, &m_codeBlock->identifier(currentInstruction[1].u.operand), regT1, regT0, currentInstruction[3].u.operand, currentInstruction[4].u.operand);
}
void JIT::emit_op_catch(Instruction* currentInstruction)
Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (174215 => 174216)
--- trunk/Source/_javascript_Core/jit/JITOperations.cpp 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp 2014-10-02 15:15:03 UTC (rev 174216)
@@ -1308,12 +1308,13 @@
}
#endif
-void JIT_OPERATION operationPushNameScope(ExecState* exec, Identifier* identifier, EncodedJSValue encodedValue, int32_t attibutes)
+void JIT_OPERATION operationPushNameScope(ExecState* exec, Identifier* identifier, EncodedJSValue encodedValue, int32_t attibutes, int32_t type)
{
VM& vm = exec->vm();
NativeCallFrameTracer tracer(&vm, exec);
- JSNameScope* scope = JSNameScope::create(exec, *identifier, JSValue::decode(encodedValue), attibutes);
+ JSNameScope::Type scopeType = static_cast<JSNameScope::Type>(type);
+ JSNameScope* scope = JSNameScope::create(exec, *identifier, JSValue::decode(encodedValue), attibutes, scopeType);
exec->setScope(scope);
}
Modified: trunk/Source/_javascript_Core/jit/JITOperations.h (174215 => 174216)
--- trunk/Source/_javascript_Core/jit/JITOperations.h 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/jit/JITOperations.h 2014-10-02 15:15:03 UTC (rev 174216)
@@ -164,7 +164,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*);
-typedef void JIT_OPERATION (*V_JITOperation_EIdJZ)(ExecState*, Identifier*, EncodedJSValue, int32_t);
+typedef void JIT_OPERATION (*V_JITOperation_EIdJZZ)(ExecState*, Identifier*, EncodedJSValue, int32_t, int32_t);
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);
@@ -277,7 +277,7 @@
#else
void JIT_OPERATION operationPutGetterSetter(ExecState*, JSCell*, Identifier*, JSCell*, JSCell*) WTF_INTERNAL;
#endif
-void JIT_OPERATION operationPushNameScope(ExecState*, Identifier*, EncodedJSValue, int32_t) WTF_INTERNAL;
+void JIT_OPERATION operationPushNameScope(ExecState*, Identifier*, EncodedJSValue, int32_t, int32_t) WTF_INTERNAL;
void JIT_OPERATION operationPushWithScope(ExecState*, EncodedJSValue) WTF_INTERNAL;
void JIT_OPERATION operationPopScope(ExecState*) WTF_INTERNAL;
void JIT_OPERATION operationProfileDidCall(ExecState*, EncodedJSValue) WTF_INTERNAL;
Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (174215 => 174216)
--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2014-10-02 15:15:03 UTC (rev 174216)
@@ -1300,7 +1300,8 @@
{
LLINT_BEGIN();
CodeBlock* codeBlock = exec->codeBlock();
- JSNameScope* scope = JSNameScope::create(exec, codeBlock->identifier(pc[1].u.operand), LLINT_OP(2).jsValue(), pc[3].u.operand);
+ JSNameScope::Type type = static_cast<JSNameScope::Type>(pc[4].u.operand);
+ JSNameScope* scope = JSNameScope::create(exec, codeBlock->identifier(pc[1].u.operand), LLINT_OP(2).jsValue(), pc[3].u.operand, type);
exec->setScope(scope);
LLINT_END();
}
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (174215 => 174216)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2014-10-02 15:15:03 UTC (rev 174216)
@@ -1246,7 +1246,7 @@
_llint_op_push_name_scope:
traceExecution()
callSlowPath(_llint_slow_path_push_name_scope)
- dispatch(4)
+ dispatch(5)
_llint_op_throw:
Modified: trunk/Source/_javascript_Core/runtime/JSFunction.cpp (174215 => 174216)
--- trunk/Source/_javascript_Core/runtime/JSFunction.cpp 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/runtime/JSFunction.cpp 2014-10-02 15:15:03 UTC (rev 174216)
@@ -116,7 +116,7 @@
return;
if (!functionNameScopeIsDynamic(executable->usesEval(), executable->isStrictMode()))
return;
- setScope(vm, JSNameScope::create(vm, scope()->globalObject(), executable->name(), this, ReadOnly | DontDelete, scope()));
+ setScope(vm, JSNameScope::create(vm, scope()->globalObject(), executable->name(), this, ReadOnly | DontDelete, scope(), JSNameScope::FunctionNameScope));
}
JSFunction* JSFunction::createBuiltinFunction(VM& vm, FunctionExecutable* executable, JSGlobalObject* globalObject)
Modified: trunk/Source/_javascript_Core/runtime/JSNameScope.h (174215 => 174216)
--- trunk/Source/_javascript_Core/runtime/JSNameScope.h 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/_javascript_Core/runtime/JSNameScope.h 2014-10-02 15:15:03 UTC (rev 174216)
@@ -36,17 +36,22 @@
public:
typedef JSEnvironmentRecord Base;
- static JSNameScope* create(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes)
+ enum Type {
+ CatchScope,
+ FunctionNameScope
+ };
+
+ static JSNameScope* create(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes, Type type)
{
VM& vm = exec->vm();
- JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(vm, exec->lexicalGlobalObject(), exec->scope());
+ JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(vm, exec->lexicalGlobalObject(), exec->scope(), type);
scopeObject->finishCreation(vm, identifier, value, attributes);
return scopeObject;
}
- static JSNameScope* create(VM& vm, JSGlobalObject* globalObject, const Identifier& identifier, JSValue value, unsigned attributes, JSScope* next)
+ static JSNameScope* create(VM& vm, JSGlobalObject* globalObject, const Identifier& identifier, JSValue value, unsigned attributes, JSScope* next, Type type)
{
- JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(vm, globalObject, next);
+ JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(vm, globalObject, next, type);
scopeObject->finishCreation(vm, identifier, value, attributes);
return scopeObject;
}
@@ -60,6 +65,9 @@
DECLARE_INFO;
+ bool isFunctionNameScope() { return m_type == FunctionNameScope; }
+ bool isCatchScope() { return m_type == CatchScope; }
+
protected:
void finishCreation(VM& vm, const Identifier& identifier, JSValue value, unsigned attributes)
{
@@ -71,17 +79,19 @@
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | Base::StructureFlags;
private:
- JSNameScope(VM& vm, JSGlobalObject* globalObject, JSScope* next)
+ JSNameScope(VM& vm, JSGlobalObject* globalObject, JSScope* next, Type type)
: Base(
vm,
globalObject->nameScopeStructure(),
reinterpret_cast<Register*>(&m_registerStore + 1),
next
)
+ , m_type(type)
{
}
WriteBarrier<Unknown> m_registerStore;
+ Type m_type;
};
}
Modified: trunk/Source/WebInspectorUI/ChangeLog (174215 => 174216)
--- trunk/Source/WebInspectorUI/ChangeLog 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/WebInspectorUI/ChangeLog 2014-10-02 15:15:03 UTC (rev 174216)
@@ -1,3 +1,16 @@
+2014-10-02 Mark Lam <[email protected]>
+
+ Fixed the Inspector to be able to properly distinguish between scope types.
+ <https://webkit.org/b/137279>
+
+ Reviewed by Geoffrey Garen and Joseph Pecoraro.
+
+ * Localizations/en.lproj/localizedStrings.js:
+ * UserInterface/Controllers/DebuggerManager.js:
+ * UserInterface/Models/ScopeChainNode.js:
+ * UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
+ - Added handling of the FunctionNameScope case.
+
2014-10-02 Andres Gomez <[email protected]>
Web Inspector: [GTK] Missing icons and enhancing the proportion and visibility of some icons
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (174215 => 174216)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2014-10-02 13:06:54 UTC (rev 174215)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2014-10-02 15:15:03 UTC (rev 174216)
@@ -214,6 +214,7 @@
l o c a l i z e d S t r i n g s [ "