diff options
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSScope.h')
| -rw-r--r-- | Source/JavaScriptCore/runtime/JSScope.h | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/Source/JavaScriptCore/runtime/JSScope.h b/Source/JavaScriptCore/runtime/JSScope.h index a65316749..3f62a45ac 100644 --- a/Source/JavaScriptCore/runtime/JSScope.h +++ b/Source/JavaScriptCore/runtime/JSScope.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012, 2013, 2014 Apple Inc. All Rights Reserved. + * Copyright (C) 2012, 2013 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,12 +27,11 @@ #define JSScope_h #include "JSObject.h" -#include "VariableEnvironment.h" namespace JSC { class ScopeChainIterator; -class WatchpointSet; +class VariableWatchpointSet; enum ResolveMode { ThrowIfNotFound, @@ -44,7 +43,6 @@ enum ResolveType { GlobalProperty, GlobalVar, ClosureVar, - LocalClosureVar, // Ditto, but at least one intervening scope used non-strict eval, which // can inject an intercepting var delcaration at runtime. @@ -56,9 +54,6 @@ enum ResolveType { Dynamic }; -const char* resolveModeName(ResolveMode mode); -const char* resolveTypeName(ResolveType type); - inline ResolveType makeType(ResolveType type, bool needsVarInjectionChecks) { if (!needsVarInjectionChecks) @@ -70,7 +65,6 @@ inline ResolveType makeType(ResolveType type, bool needsVarInjectionChecks) case GlobalVar: return GlobalVarWithVarInjectionChecks; case ClosureVar: - case LocalClosureVar: return ClosureVarWithVarInjectionChecks; case GlobalPropertyWithVarInjectionChecks: case GlobalVarWithVarInjectionChecks: @@ -89,7 +83,6 @@ inline bool needsVarInjectionChecks(ResolveType type) case GlobalProperty: case GlobalVar: case ClosureVar: - case LocalClosureVar: return false; case GlobalPropertyWithVarInjectionChecks: case GlobalVarWithVarInjectionChecks: @@ -103,11 +96,11 @@ inline bool needsVarInjectionChecks(ResolveType type) } struct ResolveOp { - ResolveOp(ResolveType type, size_t depth, Structure* structure, JSLexicalEnvironment* lexicalEnvironment, WatchpointSet* watchpointSet, uintptr_t operand) + ResolveOp(ResolveType type, size_t depth, Structure* structure, JSActivation* activation, VariableWatchpointSet* watchpointSet, uintptr_t operand) : type(type) , depth(depth) , structure(structure) - , lexicalEnvironment(lexicalEnvironment) + , activation(activation) , watchpointSet(watchpointSet) , operand(operand) { @@ -116,8 +109,8 @@ struct ResolveOp { ResolveType type; size_t depth; Structure* structure; - JSLexicalEnvironment* lexicalEnvironment; - WatchpointSet* watchpointSet; + JSActivation* activation; + VariableWatchpointSet* watchpointSet; uintptr_t operand; }; @@ -150,27 +143,21 @@ enum GetOrPut { Get, Put }; class JSScope : public JSNonFinalObject { public: typedef JSNonFinalObject Base; - static const unsigned StructureFlags = Base::StructureFlags; friend class LLIntOffsetsExtractor; static size_t offsetOfNext(); - static JSObject* objectAtScope(JSScope*); + JS_EXPORT_PRIVATE static JSObject* objectAtScope(JSScope*); static JSValue resolve(ExecState*, JSScope*, const Identifier&); - static ResolveOp abstractResolve(ExecState*, size_t depthOffset, JSScope*, const Identifier&, GetOrPut, ResolveType); - - static void collectVariablesUnderTDZ(JSScope*, VariableEnvironment& result); + static ResolveOp abstractResolve(ExecState*, JSScope*, const Identifier&, GetOrPut, ResolveType); static void visitChildren(JSCell*, SlotVisitor&); - bool isLexicalScope(); - bool isCatchScope(); - bool isFunctionNameScopeObject(); - ScopeChainIterator begin(); ScopeChainIterator end(); JSScope* next(); + int depth(); JSGlobalObject* globalObject(); VM* vm(); @@ -178,6 +165,7 @@ public: protected: JSScope(VM&, Structure*, JSScope* next); + static const unsigned StructureFlags = OverridesVisitChildren | Base::StructureFlags; private: WriteBarrier<JSScope> m_next; @@ -198,7 +186,6 @@ public: JSObject* get() const { return JSScope::objectAtScope(m_node); } JSObject* operator->() const { return JSScope::objectAtScope(m_node); } - JSScope* scope() const { return m_node; } ScopeChainIterator& operator++() { m_node = m_node->next(); return *this; } @@ -247,9 +234,20 @@ inline JSScope* Register::scope() const return jsCast<JSScope*>(jsValue()); } +inline VM& ExecState::vm() const +{ + ASSERT(scope()->vm()); + return *scope()->vm(); +} + inline JSGlobalObject* ExecState::lexicalGlobalObject() const { - return callee()->globalObject(); + return scope()->globalObject(); +} + +inline JSObject* ExecState::globalThisValue() const +{ + return scope()->globalThis(); } inline size_t JSScope::offsetOfNext() |
