Changeset 174216 in webkit


Ignore:
Timestamp:
Oct 2, 2014 8:15:03 AM (10 years ago)
Author:
mark.lam@apple.com
Message:

Fixed the Inspector to be able to properly distinguish between scope types.
<https://webkit.org/b/137279>

Source/JavaScriptCore:

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.

Source/WebInspectorUI:

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.
Location:
trunk/Source
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r174188 r174216  
     12014-10-02  Mark Lam  <mark.lam@apple.com>
     2
     3        Fixed the Inspector to be able to properly distinguish between scope types.
     4        <https://webkit.org/b/137279>
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        The pre-existing code incorrectly labels Catch Scopes and Function Name Scopes
     9        as With Scopes.  This patch will fix this.
     10
     11        * bytecode/BytecodeList.json:
     12        * bytecompiler/BytecodeGenerator.cpp:
     13        (JSC::BytecodeGenerator::emitPushFunctionNameScope):
     14        (JSC::BytecodeGenerator::emitPushCatchScope):
     15        - These now passes stores the desired JSNameScope::Type in a bytecode operand.
     16        * debugger/DebuggerScope.cpp:
     17        (JSC::DebuggerScope::isCatchScope):
     18        (JSC::DebuggerScope::isFunctionNameScope):
     19        - Added queries to be able to explicitly test if the scope is a CatchScope
     20          or FunctionNameScope.  The FunctionNameScope is the case where the
     21          NameScope is used to capture the function name of a function expression.
     22        * debugger/DebuggerScope.h:
     23        * inspector/InjectedScriptSource.js:
     24        * inspector/JSJavaScriptCallFrame.cpp:
     25        (Inspector::JSJavaScriptCallFrame::scopeType):
     26        * inspector/JSJavaScriptCallFrame.h:
     27        * inspector/JSJavaScriptCallFramePrototype.cpp:
     28        (Inspector::JSJavaScriptCallFramePrototype::finishCreation):
     29        (Inspector::jsJavaScriptCallFrameConstantFUNCTION_NAME_SCOPE):
     30        * inspector/protocol/Debugger.json:
     31        * jit/CCallHelpers.h:
     32        (JSC::CCallHelpers::setupArgumentsWithExecState):
     33        * jit/JIT.h:
     34        * jit/JITInlines.h:
     35        (JSC::JIT::callOperation):
     36        * jit/JITOpcodes.cpp:
     37        (JSC::JIT::emit_op_push_name_scope):
     38        * jit/JITOpcodes32_64.cpp:
     39        (JSC::JIT::emit_op_push_name_scope):
     40        * jit/JITOperations.cpp:
     41        * jit/JITOperations.h:
     42        * llint/LLIntSlowPaths.cpp:
     43        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
     44        * llint/LowLevelInterpreter.asm:
     45        * runtime/JSFunction.cpp:
     46        (JSC::JSFunction::addNameScopeIfNeeded):
     47        * runtime/JSNameScope.h:
     48        (JSC::JSNameScope::create):
     49        (JSC::JSNameScope::isFunctionNameScope):
     50        (JSC::JSNameScope::isCatchScope):
     51        (JSC::JSNameScope::JSNameScope):
     52        - Now stores the JSNameScope::Type in a field.
     53
    1542014-10-01  Commit Queue  <commit-queue@webkit.org>
    255
  • trunk/Source/JavaScriptCore/bytecode/BytecodeList.json

    r173517 r174216  
    113113            { "name" : "op_push_with_scope", "length" : 2 },
    114114            { "name" : "op_pop_scope", "length" : 1 },
    115             { "name" : "op_push_name_scope", "length" : 4 },
     115            { "name" : "op_push_name_scope", "length" : 5 },
    116116            { "name" : "op_catch", "length" : 2 },
    117117            { "name" : "op_throw", "length" : 2 },
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r173517 r174216  
    22952295    instructions().append(value->index());
    22962296    instructions().append(attributes);
     2297    instructions().append(JSNameScope::FunctionNameScope);
    22972298}
    22982299
     
    23082309    instructions().append(value->index());
    23092310    instructions().append(attributes);
     2311    instructions().append(JSNameScope::CatchScope);
    23102312}
    23112313
  • trunk/Source/JavaScriptCore/debugger/DebuggerScope.cpp

    r173896 r174216  
    2929#include "JSLexicalEnvironment.h"
    3030#include "JSCInlines.h"
     31#include "JSNameScope.h"
    3132#include "JSWithScope.h"
    3233
     
    155156}
    156157
     158bool DebuggerScope::isCatchScope() const
     159{
     160    return m_scope->isNameScopeObject() && reinterpret_cast<JSNameScope*>(m_scope.get())->isCatchScope();
     161}
     162
     163bool DebuggerScope::isFunctionNameScope() const
     164{
     165    return m_scope->isNameScopeObject() && reinterpret_cast<JSNameScope*>(m_scope.get())->isFunctionNameScope();
     166}
     167
    157168bool DebuggerScope::isWithScope() const
    158169{
  • trunk/Source/JavaScriptCore/debugger/DebuggerScope.h

    r173100 r174216  
    8585    bool isValid() const { return !!m_scope; }
    8686
     87    bool isCatchScope() const;
     88    bool isFunctionNameScope() const;
    8789    bool isWithScope() const;
    8890    bool isGlobalScope() const;
  • trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js

    r166971 r174216  
    11/*
    2  * Copyright (C) 2007 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2007, 2014 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    10191019    const CLOSURE_SCOPE = 3;
    10201020    const CATCH_SCOPE = 4;
     1021    const FUNCTION_NAME_SCOPE = 5;
    10211022
    10221023    /** @type {!Object.<number, string>} */
     
    10271028    scopeTypeNames[CLOSURE_SCOPE] = "closure";
    10281029    scopeTypeNames[CATCH_SCOPE] = "catch";
     1030    scopeTypeNames[FUNCTION_NAME_SCOPE] = "functionName";
    10291031
    10301032    return {
  • trunk/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp

    r173410 r174216  
    112112
    113113        if (!index) {
     114            if (scope->isCatchScope())
     115                return jsNumber(JSJavaScriptCallFrame::CATCH_SCOPE);
     116            if (scope->isFunctionNameScope())
     117                return jsNumber(JSJavaScriptCallFrame::FUNCTION_NAME_SCOPE);
    114118            if (scope->isWithScope())
    115119                return jsNumber(JSJavaScriptCallFrame::WITH_SCOPE);
     
    118122                return jsNumber(JSJavaScriptCallFrame::GLOBAL_SCOPE);
    119123            }
    120             // FIXME: We should be identifying and returning CATCH_SCOPE appropriately.
    121124            ASSERT(scope->isFunctionOrEvalScope());
    122125            return jsNumber(JSJavaScriptCallFrame::CLOSURE_SCOPE);
  • trunk/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.h

    r162970 r174216  
    7878    static const unsigned short CLOSURE_SCOPE = 3;
    7979    static const unsigned short CATCH_SCOPE = 4;
     80    static const unsigned short FUNCTION_NAME_SCOPE = 5;
    8081
    8182protected:
  • trunk/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp

    r171824 r174216  
    6060static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantCLOSURE_SCOPE(ExecState*);
    6161static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantCATCH_SCOPE(ExecState*);
     62static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantFUNCTION_NAME_SCOPE(ExecState*);
    6263
    6364const ClassInfo JSJavaScriptCallFramePrototype::s_info = { "JavaScriptCallFrame", &Base::s_info, 0, CREATE_METHOD_TABLE(JSJavaScriptCallFramePrototype) };
     
    9596    JSC_NATIVE_NON_INDEX_ACCESSOR("CLOSURE_SCOPE", jsJavaScriptCallFrameConstantCLOSURE_SCOPE, DontEnum | Accessor);
    9697    JSC_NATIVE_NON_INDEX_ACCESSOR("CATCH_SCOPE", jsJavaScriptCallFrameConstantCATCH_SCOPE, DontEnum | Accessor);
     98    JSC_NATIVE_NON_INDEX_ACCESSOR("FUNCTION_NAME_SCOPE", jsJavaScriptCallFrameConstantFUNCTION_NAME_SCOPE, DontEnum | Accessor);
    9799}
    98100
     
    232234}
    233235
     236EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantFUNCTION_NAME_SCOPE(ExecState*)
     237{
     238    return JSValue::encode(jsNumber(JSJavaScriptCallFrame::FUNCTION_NAME_SCOPE));
     239}
     240
    234241} // namespace Inspector
    235242
  • trunk/Source/JavaScriptCore/inspector/protocol/Debugger.json

    r163477 r174216  
    8181            "type": "object",
    8282            "properties": [
    83                 { "name": "type", "type": "string", "enum": ["global", "local", "with", "closure", "catch"], "description": "Scope type." },
     83                { "name": "type", "type": "string", "enum": ["global", "local", "with", "closure", "catch", "functionName"], "description": "Scope type." },
    8484                { "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." }
    8585            ],
  • trunk/Source/JavaScriptCore/jit/CCallHelpers.h

    r173069 r174216  
    473473        addCallArgument(arg3);
    474474        addCallArgument(arg4);
     475    }
     476
     477    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5)
     478    {
     479        resetCallArguments();
     480        addCallArgument(GPRInfo::callFrameRegister);
     481        addCallArgument(arg1);
     482        addCallArgument(arg2);
     483        addCallArgument(arg3);
     484        addCallArgument(arg4);
     485        addCallArgument(arg5);
    475486    }
    476487
     
    12861297    }
    12871298
     1299#if CPU(X86_64) || CPU(ARM64)
     1300    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImm32 arg4)
     1301    {
     1302        move(arg2, GPRInfo::argumentGPR2); // In case arg2 is argumentGPR1.
     1303        move(arg1, GPRInfo::argumentGPR1);
     1304        move(arg3, GPRInfo::argumentGPR3);
     1305        move(arg4, GPRInfo::argumentGPR4);
     1306        move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
     1307    }
     1308#endif
     1309
    12881310    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImmPtr arg3)
    12891311    {
     
    13651387    }
    13661388
     1389    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5)
     1390    {
     1391        poke(arg5, POKE_ARGUMENT_OFFSET + 1);
     1392        poke(arg4, POKE_ARGUMENT_OFFSET);
     1393        setupArgumentsWithExecState(arg1, arg2, arg3);
     1394    }
     1395
    13671396    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImmPtr arg5)
    13681397    {
     
    16461675    }
    16471676   
     1677    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5)
     1678    {
     1679        setupTwoStubArgsGPR<GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg2, arg3);
     1680        move(arg1, GPRInfo::argumentGPR1);
     1681        move(arg4, GPRInfo::argumentGPR4);
     1682        move(arg5, GPRInfo::argumentGPR5);
     1683        move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
     1684    }
     1685
    16481686    ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4)
    16491687    {
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r173517 r174216  
    720720        MacroAssembler::Call callOperation(V_JITOperation_ECICC, RegisterID, const Identifier*, RegisterID, RegisterID);
    721721        MacroAssembler::Call callOperation(J_JITOperation_EE, RegisterID);
    722         MacroAssembler::Call callOperation(V_JITOperation_EIdJZ, const Identifier*, RegisterID, int32_t);
     722        MacroAssembler::Call callOperation(V_JITOperation_EIdJZZ, const Identifier*, RegisterID, int32_t, int32_t);
    723723        MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID);
    724724#if USE(JSVALUE64)
     
    752752        MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID, RegisterID);
    753753        MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID, RegisterID, RegisterID);
    754         MacroAssembler::Call callOperation(V_JITOperation_EIdJZ, const Identifier*, RegisterID, RegisterID, int32_t);
     754        MacroAssembler::Call callOperation(V_JITOperation_EIdJZZ, const Identifier*, RegisterID, RegisterID, int32_t, int32_t);
    755755        MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID, RegisterID);
    756756        MacroAssembler::Call callOperation(V_JITOperation_EJJJ, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID);
  • trunk/Source/JavaScriptCore/jit/JITInlines.h

    r173282 r174216  
    442442}
    443443
    444 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EIdJZ operation, const Identifier* identOp1, RegisterID regOp2, int32_t op3)
    445 {
    446     setupArgumentsWithExecState(TrustedImmPtr(identOp1), regOp2, TrustedImm32(op3));
     444ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EIdJZZ operation, const Identifier* identOp1, RegisterID regOp2, int32_t op3, int32_t op4)
     445{
     446    setupArgumentsWithExecState(TrustedImmPtr(identOp1), regOp2, TrustedImm32(op3), TrustedImm32(op4));
    447447    return appendCallWithExceptionCheck(operation);
    448448}
     
    576576}
    577577
    578 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EIdJZ operation, const Identifier* identOp1, RegisterID regOp2Tag, RegisterID regOp2Payload, int32_t op3)
    579 {
    580     setupArgumentsWithExecState(TrustedImmPtr(identOp1), regOp2Payload, regOp2Tag, TrustedImm32(op3));
     578ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EIdJZZ operation, const Identifier* identOp1, RegisterID regOp2Tag, RegisterID regOp2Payload, int32_t op3, int32_t op4)
     579{
     580    setupArgumentsWithExecState(TrustedImmPtr(identOp1), regOp2Payload, regOp2Tag, TrustedImm32(op3), TrustedImm32(op4));
    581581    return appendCallWithExceptionCheck(operation);
    582582}
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r173517 r174216  
    526526{
    527527    emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);
    528     callOperation(operationPushNameScope, &m_codeBlock->identifier(currentInstruction[1].u.operand), regT0, currentInstruction[3].u.operand);
     528    callOperation(operationPushNameScope, &m_codeBlock->identifier(currentInstruction[1].u.operand), regT0, currentInstruction[3].u.operand, currentInstruction[4].u.operand);
    529529}
    530530
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r173517 r174216  
    806806{
    807807    emitLoad(currentInstruction[2].u.operand, regT1, regT0);
    808     callOperation(operationPushNameScope, &m_codeBlock->identifier(currentInstruction[1].u.operand), regT1, regT0, currentInstruction[3].u.operand);
     808    callOperation(operationPushNameScope, &m_codeBlock->identifier(currentInstruction[1].u.operand), regT1, regT0, currentInstruction[3].u.operand, currentInstruction[4].u.operand);
    809809}
    810810
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r173517 r174216  
    13091309#endif
    13101310
    1311 void JIT_OPERATION operationPushNameScope(ExecState* exec, Identifier* identifier, EncodedJSValue encodedValue, int32_t attibutes)
    1312 {
    1313     VM& vm = exec->vm();
    1314     NativeCallFrameTracer tracer(&vm, exec);
    1315 
    1316     JSNameScope* scope = JSNameScope::create(exec, *identifier, JSValue::decode(encodedValue), attibutes);
     1311void JIT_OPERATION operationPushNameScope(ExecState* exec, Identifier* identifier, EncodedJSValue encodedValue, int32_t attibutes, int32_t type)
     1312{
     1313    VM& vm = exec->vm();
     1314    NativeCallFrameTracer tracer(&vm, exec);
     1315
     1316    JSNameScope::Type scopeType = static_cast<JSNameScope::Type>(type);
     1317    JSNameScope* scope = JSNameScope::create(exec, *identifier, JSValue::decode(encodedValue), attibutes, scopeType);
    13171318
    13181319    exec->setScope(scope);
  • trunk/Source/JavaScriptCore/jit/JITOperations.h

    r173517 r174216  
    165165typedef void JIT_OPERATION (*V_JITOperation_ECZ)(ExecState*, JSCell*, int32_t);
    166166typedef void JIT_OPERATION (*V_JITOperation_ECC)(ExecState*, JSCell*, JSCell*);
    167 typedef void JIT_OPERATION (*V_JITOperation_EIdJZ)(ExecState*, Identifier*, EncodedJSValue, int32_t);
     167typedef void JIT_OPERATION (*V_JITOperation_EIdJZZ)(ExecState*, Identifier*, EncodedJSValue, int32_t, int32_t);
    168168typedef void JIT_OPERATION (*V_JITOperation_EJ)(ExecState*, EncodedJSValue);
    169169typedef void JIT_OPERATION (*V_JITOperation_EJCI)(ExecState*, EncodedJSValue, JSCell*, StringImpl*);
     
    278278void JIT_OPERATION operationPutGetterSetter(ExecState*, JSCell*, Identifier*, JSCell*, JSCell*) WTF_INTERNAL;
    279279#endif
    280 void JIT_OPERATION operationPushNameScope(ExecState*, Identifier*, EncodedJSValue, int32_t) WTF_INTERNAL;
     280void JIT_OPERATION operationPushNameScope(ExecState*, Identifier*, EncodedJSValue, int32_t, int32_t) WTF_INTERNAL;
    281281void JIT_OPERATION operationPushWithScope(ExecState*, EncodedJSValue) WTF_INTERNAL;
    282282void JIT_OPERATION operationPopScope(ExecState*) WTF_INTERNAL;
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r173517 r174216  
    13011301    LLINT_BEGIN();
    13021302    CodeBlock* codeBlock = exec->codeBlock();
    1303     JSNameScope* scope = JSNameScope::create(exec, codeBlock->identifier(pc[1].u.operand), LLINT_OP(2).jsValue(), pc[3].u.operand);
     1303    JSNameScope::Type type = static_cast<JSNameScope::Type>(pc[4].u.operand);
     1304    JSNameScope* scope = JSNameScope::create(exec, codeBlock->identifier(pc[1].u.operand), LLINT_OP(2).jsValue(), pc[3].u.operand, type);
    13041305    exec->setScope(scope);
    13051306    LLINT_END();
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r173886 r174216  
    12471247    traceExecution()
    12481248    callSlowPath(_llint_slow_path_push_name_scope)
    1249     dispatch(4)
     1249    dispatch(5)
    12501250
    12511251
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r173600 r174216  
    117117    if (!functionNameScopeIsDynamic(executable->usesEval(), executable->isStrictMode()))
    118118        return;
    119     setScope(vm, JSNameScope::create(vm, scope()->globalObject(), executable->name(), this, ReadOnly | DontDelete, scope()));
     119    setScope(vm, JSNameScope::create(vm, scope()->globalObject(), executable->name(), this, ReadOnly | DontDelete, scope(), JSNameScope::FunctionNameScope));
    120120}
    121121
  • trunk/Source/JavaScriptCore/runtime/JSNameScope.h

    r173490 r174216  
    3737    typedef JSEnvironmentRecord Base;
    3838
    39     static JSNameScope* create(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes)
     39    enum Type {
     40        CatchScope,
     41        FunctionNameScope
     42    };
     43
     44    static JSNameScope* create(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes, Type type)
    4045    {
    4146        VM& vm = exec->vm();
    42         JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(vm, exec->lexicalGlobalObject(), exec->scope());
     47        JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(vm, exec->lexicalGlobalObject(), exec->scope(), type);
    4348        scopeObject->finishCreation(vm, identifier, value, attributes);
    4449        return scopeObject;
    4550    }
    4651
    47     static JSNameScope* create(VM& vm, JSGlobalObject* globalObject, const Identifier& identifier, JSValue value, unsigned attributes, JSScope* next)
     52    static JSNameScope* create(VM& vm, JSGlobalObject* globalObject, const Identifier& identifier, JSValue value, unsigned attributes, JSScope* next, Type type)
    4853    {
    49         JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(vm, globalObject, next);
     54        JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(vm, globalObject, next, type);
    5055        scopeObject->finishCreation(vm, identifier, value, attributes);
    5156        return scopeObject;
     
    6166    DECLARE_INFO;
    6267
     68    bool isFunctionNameScope() { return m_type == FunctionNameScope; }
     69    bool isCatchScope() { return m_type == CatchScope; }
     70
    6371protected:
    6472    void finishCreation(VM& vm, const Identifier& identifier, JSValue value, unsigned attributes)
     
    7280
    7381private:
    74     JSNameScope(VM& vm, JSGlobalObject* globalObject, JSScope* next)
     82    JSNameScope(VM& vm, JSGlobalObject* globalObject, JSScope* next, Type type)
    7583        : Base(
    7684            vm,
     
    7987            next
    8088        )
     89        , m_type(type)
    8190    {
    8291    }
    8392
    8493    WriteBarrier<Unknown> m_registerStore;
     94    Type m_type;
    8595};
    8696
  • trunk/Source/WebInspectorUI/ChangeLog

    r174207 r174216  
     12014-10-02  Mark Lam  <mark.lam@apple.com>
     2
     3        Fixed the Inspector to be able to properly distinguish between scope types.
     4        <https://webkit.org/b/137279>
     5
     6        Reviewed by Geoffrey Garen and Joseph Pecoraro.
     7
     8        * Localizations/en.lproj/localizedStrings.js:
     9        * UserInterface/Controllers/DebuggerManager.js:
     10        * UserInterface/Models/ScopeChainNode.js:
     11        * UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
     12        - Added handling of the FunctionNameScope case.
     13
    1142014-10-02  Andres Gomez  <agomez@igalia.com>
    215
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r173929 r174216  
    215215localizedStrings["Full URL"] = "Full URL";
    216216localizedStrings["Function"] = "Function";
     217localizedStrings["Function Name Variable"] = "Function Name Variable";
    217218localizedStrings["Global Variables"] = "Global Variables";
    218219localizedStrings["Grammar"] = "Grammar";
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js

    r172412 r174216  
    573573            type = WebInspector.ScopeChainNode.Type.Catch;
    574574            break;
     575        case "functionName":
     576            type = WebInspector.ScopeChainNode.Type.FunctionName;
     577            break;
    575578        default:
    576579            console.error("Unknown type: " + payload.type);
  • trunk/Source/WebInspectorUI/UserInterface/Models/ScopeChainNode.js

    r164543 r174216  
    4343    With: "scope-chain-type-with",
    4444    Closure: "scope-chain-type-closure",
    45     Catch: "scope-chain-type-catch"
     45    Catch: "scope-chain-type-catch",
     46    FunctionName: "scope-chain-type-functionName"
    4647};
    4748
  • trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js

    r173436 r174216  
    122122                    break;
    123123
     124                case WebInspector.ScopeChainNode.Type.FunctionName:
     125                    title = WebInspector.UIString("Function Name Variable");
     126                    dontHighlightNonEnumerableProperties = true;
     127                    collapsedByDefault = true;
     128                    break;
     129
    124130                case WebInspector.ScopeChainNode.Type.With:
    125131                    title = WebInspector.UIString("With Object Properties");
Note: See TracChangeset for help on using the changeset viewer.