diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-08-25 19:20:41 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:30:55 +0000 |
commit | 6882a04fb36642862b11efe514251d32070c3d65 (patch) | |
tree | b7959826000b061fd5ccc7512035c7478742f7b0 /Source/JavaScriptCore/runtime/JSScope.h | |
parent | ab6df191029eeeb0b0f16f127d553265659f739e (diff) | |
download | qtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz |
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSScope.h')
-rw-r--r-- | Source/JavaScriptCore/runtime/JSScope.h | 59 |
1 files changed, 24 insertions, 35 deletions
diff --git a/Source/JavaScriptCore/runtime/JSScope.h b/Source/JavaScriptCore/runtime/JSScope.h index 95db8ad56..4b17972c2 100644 --- a/Source/JavaScriptCore/runtime/JSScope.h +++ b/Source/JavaScriptCore/runtime/JSScope.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Apple Inc. All Rights Reserved. + * Copyright (C) 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 @@ -26,37 +26,47 @@ #ifndef JSScope_h #define JSScope_h +#include "GetPutInfo.h" #include "JSObject.h" -#include "ResolveOperation.h" +#include "VariableEnvironment.h" namespace JSC { class ScopeChainIterator; +class WatchpointSet; class JSScope : public JSNonFinalObject { public: typedef JSNonFinalObject Base; + static const unsigned StructureFlags = Base::StructureFlags; friend class LLIntOffsetsExtractor; static size_t offsetOfNext(); - JS_EXPORT_PRIVATE static JSObject* objectAtScope(JSScope*); + static JSObject* objectAtScope(JSScope*); - static JSValue resolve(CallFrame*, const Identifier&, ResolveOperations*); - static JSValue resolveBase(CallFrame*, const Identifier&, bool isStrict, ResolveOperations*, PutToBaseOperation*); - static JSValue resolveWithBase(CallFrame*, const Identifier&, Register* base, ResolveOperations*, PutToBaseOperation*); - static JSValue resolveWithThis(CallFrame*, const Identifier&, Register* base, ResolveOperations*); - static JSValue resolveGlobal(CallFrame*, const Identifier&, JSGlobalObject*, ResolveOperation*); - static void resolvePut(CallFrame*, JSValue base, const Identifier&, JSValue, PutToBaseOperation*); + static JSValue resolve(ExecState*, JSScope*, const Identifier&); + static ResolveOp abstractResolve(ExecState*, size_t depthOffset, JSScope*, const Identifier&, GetOrPut, ResolveType, InitializationMode); + + static bool hasConstantScope(ResolveType); + static JSScope* constantScopeForCodeBlock(ResolveType, CodeBlock*); + + static void collectVariablesUnderTDZ(JSScope*, VariableEnvironment& result); static void visitChildren(JSCell*, SlotVisitor&); - bool isDynamicScope(bool& requiresDynamicChecks) const; + bool isVarScope(); + bool isLexicalScope(); + bool isModuleScope(); + bool isGlobalLexicalEnvironment(); + bool isCatchScope(); + bool isFunctionNameScopeObject(); + + bool isNestedLexicalScope(); ScopeChainIterator begin(); ScopeChainIterator end(); JSScope* next(); - int localDepth(); JSGlobalObject* globalObject(); VM* vm(); @@ -64,20 +74,9 @@ public: protected: JSScope(VM&, Structure*, JSScope* next); - static const unsigned StructureFlags = OverridesVisitChildren | Base::StructureFlags; private: WriteBarrier<JSScope> m_next; - enum ReturnValues { - ReturnValue = 1, - ReturnBase = 2, - ReturnThis = 4, - ReturnBaseAndValue = ReturnValue | ReturnBase, - ReturnThisAndValue = ReturnValue | ReturnThis, - }; - enum LookupMode { UnknownResolve, KnownResolve }; - template <LookupMode, ReturnValues> static JSObject* resolveContainingScopeInternal(CallFrame*, const Identifier&, PropertySlot&, ResolveOperations*, PutToBaseOperation*, bool isStrict); - template <ReturnValues> static JSObject* resolveContainingScope(CallFrame*, const Identifier&, PropertySlot&, ResolveOperations*, PutToBaseOperation*, bool isStrict); }; inline JSScope::JSScope(VM& vm, Structure* structure, JSScope* next) @@ -95,6 +94,7 @@ 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; } @@ -129,7 +129,7 @@ inline JSGlobalObject* JSScope::globalObject() inline VM* JSScope::vm() { - return Heap::heap(this)->vm(); + return MarkedBlock::blockFor(this)->vm(); } inline Register& Register::operator=(JSScope* scope) @@ -143,20 +143,9 @@ 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 scope()->globalObject(); -} - -inline JSObject* ExecState::globalThisValue() const -{ - return scope()->globalThis(); + return callee()->globalObject(); } inline size_t JSScope::offsetOfNext() |