Refactored and consolidated variable resolution functions
https://bugs.webkit.org/show_bug.cgi?id=95166
Reviewed by Filip Pizlo.
This patch does a few things:
(1) Introduces a new class, JSScope, which is the base class for all
objects that represent a scope in the scope chain.
(2) Refactors and consolidates duplicate implementations of variable
resolution into the JSScope class.
(3) Renames JSStaticScopeObject to JSNameScope because, as distinct from
something like a 'let' scope, JSStaticScopeObject only has storage for a
single name.
These changes makes logical sense to me as-is. I will also use them in an
upcoming optimization.
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri: Build!
* bytecode/CodeBlock.cpp:
(JSC): Build fix for LLInt-only builds.
* bytecode/GlobalResolveInfo.h:
(GlobalResolveInfo): Use PropertyOffset to be consistent with other parts
of the engine.
* bytecompiler/NodesCodegen.cpp:
* dfg/DFGOperations.cpp: Use the shared code in JSScope instead of rolling
our own.
* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
(JSC::Interpreter::createExceptionScope):
(JSC::Interpreter::privateExecute):
* interpreter/Interpreter.h: Use the shared code in JSScope instead of rolling
our own.
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION): Use the shared code in JSScope instead of rolling
our own.
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(LLInt): Use the shared code in JSScope instead of rolling our own. Note
that one of these slow paths calls the wrong helper function. I left it
that way to avoid a behavior change in a refactoring patch.
* parser/Nodes.cpp: Updated for rename.
* runtime/CommonSlowPaths.h:
(CommonSlowPaths): Removed resolve slow paths because were duplicative.
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::JSGlobalData):
* runtime/JSGlobalData.h:
(JSGlobalData): Updated for renames.
* runtime/JSNameScope.cpp: Copied from Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp.
(JSC):
(JSC::JSNameScope::visitChildren):
(JSC::JSNameScope::toThisObject):
(JSC::JSNameScope::put):
(JSC::JSNameScope::getOwnPropertySlot):
* runtime/JSNameScope.h: Copied from Source/JavaScriptCore/runtime/JSStaticScopeObject.h.
(JSC):
(JSC::JSNameScope::create):
(JSC::JSNameScope::createStructure):
(JSNameScope):
(JSC::JSNameScope::JSNameScope):
(JSC::JSNameScope::isDynamicScope): Used do-webcore-rename script here.
It is fabulous!
* runtime/JSObject.h:
(JSObject):
(JSC::JSObject::isNameScopeObject): More rename.
* runtime/JSScope.cpp: Added.
(JSC):
(JSC::JSScope::isDynamicScope):
(JSC::JSScope::resolve):
(JSC::JSScope::resolveSkip):
(JSC::JSScope::resolveGlobal):
(JSC::JSScope::resolveGlobalDynamic):
(JSC::JSScope::resolveBase):
(JSC::JSScope::resolveWithBase):
(JSC::JSScope::resolveWithThis):
* runtime/JSScope.h: Added.
(JSC):
(JSScope):
(JSC::JSScope::JSScope): All the code here is a port from the
Interpreter.cpp implementations of this functionality.
* runtime/JSStaticScopeObject.cpp: Removed.
* runtime/JSStaticScopeObject.h: Removed.
* runtime/JSSymbolTableObject.cpp:
(JSC):
* runtime/JSSymbolTableObject.h:
(JSSymbolTableObject):
* runtime/JSType.h: Updated for rename.
* runtime/Operations.h:
(JSC::resolveBase): Removed because it was duplicative.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@126893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt
index 44bdc56..a458dcf 100644
--- a/Source/JavaScriptCore/CMakeLists.txt
+++ b/Source/JavaScriptCore/CMakeLists.txt
@@ -207,7 +207,8 @@
runtime/JSONObject.cpp
runtime/JSPropertyNameIterator.cpp
runtime/JSSegmentedVariableObject.cpp
- runtime/JSStaticScopeObject.cpp
+ runtime/JSNameScope.cpp
+ runtime/JSScope.cpp
runtime/JSString.cpp
runtime/JSStringJoiner.cpp
runtime/JSSymbolTableObject.cpp
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 9fd740c..0415a06 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,116 @@
+2012-08-27 Geoffrey Garen <ggaren@apple.com>
+
+ Refactored and consolidated variable resolution functions
+ https://bugs.webkit.org/show_bug.cgi?id=95166
+
+ Reviewed by Filip Pizlo.
+
+ This patch does a few things:
+
+ (1) Introduces a new class, JSScope, which is the base class for all
+ objects that represent a scope in the scope chain.
+
+ (2) Refactors and consolidates duplicate implementations of variable
+ resolution into the JSScope class.
+
+ (3) Renames JSStaticScopeObject to JSNameScope because, as distinct from
+ something like a 'let' scope, JSStaticScopeObject only has storage for a
+ single name.
+
+ These changes makes logical sense to me as-is. I will also use them in an
+ upcoming optimization.
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * Target.pri: Build!
+
+ * bytecode/CodeBlock.cpp:
+ (JSC): Build fix for LLInt-only builds.
+
+ * bytecode/GlobalResolveInfo.h:
+ (GlobalResolveInfo): Use PropertyOffset to be consistent with other parts
+ of the engine.
+
+ * bytecompiler/NodesCodegen.cpp:
+ * dfg/DFGOperations.cpp: Use the shared code in JSScope instead of rolling
+ our own.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::createExceptionScope):
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Interpreter.h: Use the shared code in JSScope instead of rolling
+ our own.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION): Use the shared code in JSScope instead of rolling
+ our own.
+
+ * llint/LLIntSlowPaths.cpp:
+ (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+ (LLInt): Use the shared code in JSScope instead of rolling our own. Note
+ that one of these slow paths calls the wrong helper function. I left it
+ that way to avoid a behavior change in a refactoring patch.
+
+ * parser/Nodes.cpp: Updated for rename.
+
+ * runtime/CommonSlowPaths.h:
+ (CommonSlowPaths): Removed resolve slow paths because were duplicative.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ (JSGlobalData): Updated for renames.
+
+ * runtime/JSNameScope.cpp: Copied from Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp.
+ (JSC):
+ (JSC::JSNameScope::visitChildren):
+ (JSC::JSNameScope::toThisObject):
+ (JSC::JSNameScope::put):
+ (JSC::JSNameScope::getOwnPropertySlot):
+ * runtime/JSNameScope.h: Copied from Source/JavaScriptCore/runtime/JSStaticScopeObject.h.
+ (JSC):
+ (JSC::JSNameScope::create):
+ (JSC::JSNameScope::createStructure):
+ (JSNameScope):
+ (JSC::JSNameScope::JSNameScope):
+ (JSC::JSNameScope::isDynamicScope): Used do-webcore-rename script here.
+ It is fabulous!
+
+ * runtime/JSObject.h:
+ (JSObject):
+ (JSC::JSObject::isNameScopeObject): More rename.
+
+ * runtime/JSScope.cpp: Added.
+ (JSC):
+ (JSC::JSScope::isDynamicScope):
+ (JSC::JSScope::resolve):
+ (JSC::JSScope::resolveSkip):
+ (JSC::JSScope::resolveGlobal):
+ (JSC::JSScope::resolveGlobalDynamic):
+ (JSC::JSScope::resolveBase):
+ (JSC::JSScope::resolveWithBase):
+ (JSC::JSScope::resolveWithThis):
+ * runtime/JSScope.h: Added.
+ (JSC):
+ (JSScope):
+ (JSC::JSScope::JSScope): All the code here is a port from the
+ Interpreter.cpp implementations of this functionality.
+
+ * runtime/JSStaticScopeObject.cpp: Removed.
+ * runtime/JSStaticScopeObject.h: Removed.
+
+ * runtime/JSSymbolTableObject.cpp:
+ (JSC):
+ * runtime/JSSymbolTableObject.h:
+ (JSSymbolTableObject):
+ * runtime/JSType.h: Updated for rename.
+
+ * runtime/Operations.h:
+ (JSC::resolveBase): Removed because it was duplicative.
+
2012-08-28 Alban Browaeys <prahal@yahoo.com>
[GTK] LLint build fails with -g -02
diff --git a/Source/JavaScriptCore/GNUmakefile.list.am b/Source/JavaScriptCore/GNUmakefile.list.am
index ae22b84..63ccf39 100644
--- a/Source/JavaScriptCore/GNUmakefile.list.am
+++ b/Source/JavaScriptCore/GNUmakefile.list.am
@@ -547,8 +547,10 @@
Source/JavaScriptCore/runtime/JSPropertyNameIterator.h \
Source/JavaScriptCore/runtime/JSSegmentedVariableObject.cpp \
Source/JavaScriptCore/runtime/JSSegmentedVariableObject.h \
- Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp \
- Source/JavaScriptCore/runtime/JSStaticScopeObject.h \
+ Source/JavaScriptCore/runtime/JSNameScope.cpp \
+ Source/JavaScriptCore/runtime/JSNameScope.h \
+ Source/JavaScriptCore/runtime/JSScope.cpp \
+ Source/JavaScriptCore/runtime/JSScope.h \
Source/JavaScriptCore/runtime/JSStringBuilder.h \
Source/JavaScriptCore/runtime/JSStringJoiner.cpp \
Source/JavaScriptCore/runtime/JSStringJoiner.h \
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
index 78c44fe..c78cefb 100644
--- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
@@ -882,11 +882,19 @@
>
</File>
<File
- RelativePath="..\..\runtime\JSStaticScopeObject.cpp"
+ RelativePath="..\..\runtime\JSNameScope.cpp"
>
</File>
<File
- RelativePath="..\..\runtime\JSStaticScopeObject.h"
+ RelativePath="..\..\runtime\JSNameScope.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSScope.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSScope.h"
>
</File>
<File
diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index b51650e..764f56c 100644
--- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -253,7 +253,6 @@
0FFFC95F14EF90BB00C72532 /* DFGVirtualRegisterAllocationPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FFFC95314EF909500C72532 /* DFGVirtualRegisterAllocationPhase.cpp */; };
0FFFC96014EF90BD00C72532 /* DFGVirtualRegisterAllocationPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FFFC95414EF909500C72532 /* DFGVirtualRegisterAllocationPhase.h */; settings = {ATTRIBUTES = (Private, ); }; };
140566C4107EC255005DBC8D /* JSAPIValueWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0894D50FAFBA2D00001865 /* JSAPIValueWrapper.cpp */; };
- 140566D1107EC267005DBC8D /* JSStaticScopeObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */; };
140566D6107EC271005DBC8D /* JSFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A85E0255597D01FF60F7 /* JSFunction.cpp */; };
140B7D1D0DC69AF7009C42B8 /* JSActivation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14DA818F0D99FD2000B0A4FB /* JSActivation.cpp */; };
140D17D70E8AD4A9000CD17D /* JSBasePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 140D17D60E8AD4A9000CD17D /* JSBasePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -368,6 +367,10 @@
14816E1C154CC56C00B8054C /* BlockAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 14816E1A154CC56C00B8054C /* BlockAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; };
1482B74E0A43032800517CFC /* JSStringRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1482B74C0A43032800517CFC /* JSStringRef.cpp */; };
1482B7E40A43076000517CFC /* JSObjectRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1482B7E20A43076000517CFC /* JSObjectRef.cpp */; };
+ 14874AE315EBDE4A002E3587 /* JSNameScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14874ADF15EBDE4A002E3587 /* JSNameScope.cpp */; };
+ 14874AE415EBDE4A002E3587 /* JSNameScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 14874AE015EBDE4A002E3587 /* JSNameScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 14874AE515EBDE4A002E3587 /* JSScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14874AE115EBDE4A002E3587 /* JSScope.cpp */; };
+ 14874AE615EBDE4A002E3587 /* JSScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 14874AE215EBDE4A002E3587 /* JSScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
148CD1D8108CF902008163C6 /* JSContextRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 148CD1D7108CF902008163C6 /* JSContextRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
148F21AA107EC53A0042EC2C /* BytecodeGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 969A07200ED1CE3300F1F681 /* BytecodeGenerator.cpp */; };
148F21B0107EC5410042EC2C /* Lexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8650255597D01FF60F7 /* Lexer.cpp */; };
@@ -1076,6 +1079,10 @@
1482B78A0A4305AB00517CFC /* APICast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APICast.h; sourceTree = "<group>"; };
1482B7E10A43076000517CFC /* JSObjectRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSObjectRef.h; sourceTree = "<group>"; };
1482B7E20A43076000517CFC /* JSObjectRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSObjectRef.cpp; sourceTree = "<group>"; };
+ 14874ADF15EBDE4A002E3587 /* JSNameScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNameScope.cpp; sourceTree = "<group>"; };
+ 14874AE015EBDE4A002E3587 /* JSNameScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNameScope.h; sourceTree = "<group>"; };
+ 14874AE115EBDE4A002E3587 /* JSScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScope.cpp; sourceTree = "<group>"; };
+ 14874AE215EBDE4A002E3587 /* JSScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScope.h; sourceTree = "<group>"; };
148CD1D7108CF902008163C6 /* JSContextRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSContextRefPrivate.h; sourceTree = "<group>"; };
149559ED0DDCDDF700648087 /* DebuggerCallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DebuggerCallFrame.cpp; sourceTree = "<group>"; };
1497209014EB831500FEB1B7 /* PassWeak.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassWeak.h; sourceTree = "<group>"; };
@@ -1348,8 +1355,6 @@
A7DCB77912E3D90500911940 /* WriteBarrier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WriteBarrier.h; sourceTree = "<group>"; };
A7E2EA690FB460CF00601F06 /* LiteralParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiteralParser.h; sourceTree = "<group>"; };
A7E2EA6A0FB460CF00601F06 /* LiteralParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LiteralParser.cpp; sourceTree = "<group>"; };
- A7E42C180E3938830065A544 /* JSStaticScopeObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStaticScopeObject.h; sourceTree = "<group>"; };
- A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStaticScopeObject.cpp; sourceTree = "<group>"; };
A7F8690E0F9584A100558697 /* CachedCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedCall.h; sourceTree = "<group>"; };
A7F869EC0F95C2EC00558697 /* CallFrameClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallFrameClosure.h; sourceTree = "<group>"; };
A7F9935D0FD7325100A0B2D0 /* JSONObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONObject.h; sourceTree = "<group>"; };
@@ -2011,7 +2016,6 @@
7EF6E0BB0EB7A1EC0079AFAF /* runtime */ = {
isa = PBXGroup;
children = (
- C2D58C3315912FEE0021A844 /* GCActivityCallback.cpp */,
BCF605110E203EF800B9A64D /* ArgList.cpp */,
BCF605120E203EF800B9A64D /* ArgList.h */,
BC257DE50E1F51C50016B6C9 /* Arguments.cpp */,
@@ -2066,6 +2070,7 @@
BC2680C10E16D4E900A06E92 /* FunctionConstructor.h */,
F692A85C0255597D01FF60F7 /* FunctionPrototype.cpp */,
F692A85D0255597D01FF60F7 /* FunctionPrototype.h */,
+ C2D58C3315912FEE0021A844 /* GCActivityCallback.cpp */,
DDF7ABD211F60ED200108E36 /* GCActivityCallback.h */,
BC02E9B80E184545000F9297 /* GetterSetter.cpp */,
BC337BDE0E1AF0B80076918A /* GetterSetter.h */,
@@ -2099,6 +2104,8 @@
8604F503143CE1C100B295F5 /* JSGlobalThis.h */,
65EA4C99092AF9E20093D800 /* JSLock.cpp */,
65EA4C9A092AF9E20093D800 /* JSLock.h */,
+ 14874ADF15EBDE4A002E3587 /* JSNameScope.cpp */,
+ 14874AE015EBDE4A002E3587 /* JSNameScope.h */,
A72700780DAC605600E548D7 /* JSNotAnObject.cpp */,
A72700770DAC605600E548D7 /* JSNotAnObject.h */,
BC22A3980E16E14800AF21C8 /* JSObject.cpp */,
@@ -2107,10 +2114,10 @@
A7F9935D0FD7325100A0B2D0 /* JSONObject.h */,
A727FF660DA3053B00E548D7 /* JSPropertyNameIterator.cpp */,
A727FF650DA3053B00E548D7 /* JSPropertyNameIterator.h */,
+ 14874AE115EBDE4A002E3587 /* JSScope.cpp */,
+ 14874AE215EBDE4A002E3587 /* JSScope.h */,
0F919D0E157F3327004A4E7D /* JSSegmentedVariableObject.cpp */,
0F919D0F157F3327004A4E7D /* JSSegmentedVariableObject.h */,
- A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */,
- A7E42C180E3938830065A544 /* JSStaticScopeObject.h */,
BC02E9B60E1842FA000F9297 /* JSString.cpp */,
F692A8620255597D01FF60F7 /* JSString.h */,
86E85538111B9968001AF51E /* JSStringBuilder.h */,
@@ -2896,6 +2903,8 @@
0F63945515D07057006A597C /* ArrayProfile.h in Headers */,
0F63948515E4811B006A597C /* DFGArrayMode.h in Headers */,
0F63947815DCE34B006A597C /* DFGStructureAbstractValue.h in Headers */,
+ 14874AE415EBDE4A002E3587 /* JSNameScope.h in Headers */,
+ 14874AE615EBDE4A002E3587 /* JSScope.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3348,7 +3357,6 @@
A7F993600FD7325100A0B2D0 /* JSONObject.cpp in Sources */,
95F6E6950E5B5F970091E860 /* JSProfilerPrivate.cpp in Sources */,
A727FF6B0DA3092200E548D7 /* JSPropertyNameIterator.cpp in Sources */,
- 140566D1107EC267005DBC8D /* JSStaticScopeObject.cpp in Sources */,
147F39D5107EC37600427A48 /* JSString.cpp in Sources */,
2600B5A6152BAAA70091EE5F /* JSStringJoiner.cpp in Sources */,
1482B74E0A43032800517CFC /* JSStringRef.cpp in Sources */,
@@ -3497,6 +3505,8 @@
0F63945415D07055006A597C /* ArrayProfile.cpp in Sources */,
0F63948415E48118006A597C /* DFGArrayMode.cpp in Sources */,
C21122E115DD9AB300790E3A /* GCThreadSharedData.cpp in Sources */,
+ 14874AE315EBDE4A002E3587 /* JSNameScope.cpp in Sources */,
+ 14874AE515EBDE4A002E3587 /* JSScope.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Source/JavaScriptCore/Target.pri b/Source/JavaScriptCore/Target.pri
index 2007a76..ed8d278 100644
--- a/Source/JavaScriptCore/Target.pri
+++ b/Source/JavaScriptCore/Target.pri
@@ -209,7 +209,8 @@
runtime/JSONObject.cpp \
runtime/JSPropertyNameIterator.cpp \
runtime/JSSegmentedVariableObject.cpp \
- runtime/JSStaticScopeObject.cpp \
+ runtime/JSNameScope.cpp \
+ runtime/JSScope.cpp \
runtime/JSString.cpp \
runtime/JSStringJoiner.cpp \
runtime/JSSymbolTableObject.cpp \
diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
index d452bd4..3fe2965 100644
--- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -40,7 +40,7 @@
#include "JITStubs.h"
#include "JSActivation.h"
#include "JSFunction.h"
-#include "JSStaticScopeObject.h"
+#include "JSNameScope.h"
#include "JSValue.h"
#include "LowLevelInterpreter.h"
#include "MethodCallLinkStatus.h"
@@ -2030,13 +2030,11 @@
performTracingFixpointIteration(visitor);
}
-#if ENABLE(JIT)
#if ENABLE(JIT_VERBOSE_OSR)
static const bool verboseUnlinking = true;
#else
static const bool verboseUnlinking = false;
#endif
-#endif // ENABLE(JIT)
void CodeBlock::finalizeUnconditionally()
{
diff --git a/Source/JavaScriptCore/bytecode/GlobalResolveInfo.h b/Source/JavaScriptCore/bytecode/GlobalResolveInfo.h
index c466c75..99292b7 100644
--- a/Source/JavaScriptCore/bytecode/GlobalResolveInfo.h
+++ b/Source/JavaScriptCore/bytecode/GlobalResolveInfo.h
@@ -40,7 +40,7 @@
}
WriteBarrier<Structure> structure;
- unsigned offset;
+ PropertyOffset offset;
unsigned bytecodeOffset; // Only valid in old JIT code. This means nothing in the DFG.
};
diff --git a/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp b/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
index 9da59a0..0d63808 100644
--- a/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
+++ b/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
@@ -34,7 +34,7 @@
#include "JIT.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
-#include "JSStaticScopeObject.h"
+#include "JSNameScope.h"
#include "LabelScope.h"
#include "Lexer.h"
#include "Operations.h"
diff --git a/Source/JavaScriptCore/dfg/DFGOperations.cpp b/Source/JavaScriptCore/dfg/DFGOperations.cpp
index 1d02005..d3da538 100644
--- a/Source/JavaScriptCore/dfg/DFGOperations.cpp
+++ b/Source/JavaScriptCore/dfg/DFGOperations.cpp
@@ -39,7 +39,7 @@
#include "JITExceptions.h"
#include "JSActivation.h"
#include "JSGlobalData.h"
-#include "JSStaticScopeObject.h"
+#include "JSNameScope.h"
#include "NameInstance.h"
#include "Operations.h"
#include <wtf/InlineASM.h>
@@ -1039,20 +1039,7 @@
{
JSGlobalData* globalData = &exec->globalData();
NativeCallFrameTracer tracer(globalData, exec);
-
- ScopeChainNode* scopeChain = exec->scopeChain();
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator end = scopeChain->end();
- ASSERT(iter != end);
-
- do {
- JSObject* record = iter->get();
- PropertySlot slot(record);
- if (record->getPropertySlot(exec, *propertyName, slot))
- return JSValue::encode(slot.getValue(exec, *propertyName));
- } while (++iter != end);
-
- return throwVMError(exec, createUndefinedVariableError(exec, *propertyName));
+ return JSValue::encode(JSScope::resolve(exec, *propertyName));
}
EncodedJSValue DFG_OPERATION operationResolveBase(ExecState* exec, Identifier* propertyName)
@@ -1060,7 +1047,7 @@
JSGlobalData* globalData = &exec->globalData();
NativeCallFrameTracer tracer(globalData, exec);
- return JSValue::encode(resolveBase(exec, *propertyName, exec->scopeChain(), false));
+ return JSValue::encode(JSScope::resolveBase(exec, *propertyName, false));
}
EncodedJSValue DFG_OPERATION operationResolveBaseStrictPut(ExecState* exec, Identifier* propertyName)
@@ -1068,30 +1055,15 @@
JSGlobalData* globalData = &exec->globalData();
NativeCallFrameTracer tracer(globalData, exec);
- JSValue base = resolveBase(exec, *propertyName, exec->scopeChain(), true);
- if (!base)
- throwError(exec, createErrorForInvalidGlobalAssignment(exec, propertyName->ustring()));
- return JSValue::encode(base);
+ return JSValue::encode(JSScope::resolveBase(exec, *propertyName, true));
}
EncodedJSValue DFG_OPERATION operationResolveGlobal(ExecState* exec, GlobalResolveInfo* resolveInfo, JSGlobalObject* globalObject, Identifier* propertyName)
{
JSGlobalData* globalData = &exec->globalData();
NativeCallFrameTracer tracer(globalData, exec);
-
- PropertySlot slot(globalObject);
- if (globalObject->getPropertySlot(exec, *propertyName, slot)) {
- JSValue result = slot.getValue(exec, *propertyName);
- if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
- resolveInfo->structure.set(exec->globalData(), exec->codeBlock()->ownerExecutable(), globalObject->structure());
- resolveInfo->offset = slot.cachedOffset();
- }
-
- return JSValue::encode(result);
- }
-
- return throwVMError(exec, createUndefinedVariableError(exec, *propertyName));
+ return JSValue::encode(JSScope::resolveGlobal(exec, *propertyName, globalObject, &resolveInfo->structure, &resolveInfo->offset));
}
EncodedJSValue DFG_OPERATION operationToPrimitive(ExecState* exec, EncodedJSValue value)
@@ -1265,8 +1237,8 @@
static_cast<FunctionExecutable*>(functionExecutableAsCell);
JSFunction *function = functionExecutable->make(exec, exec->scopeChain());
if (!functionExecutable->name().isNull()) {
- JSStaticScopeObject* functionScopeObject =
- JSStaticScopeObject::create(
+ JSNameScope* functionScopeObject =
+ JSNameScope::create(
exec, functionExecutable->name(), function, ReadOnly | DontDelete);
function->setScope(exec->globalData(), function->scope()->push(functionScopeObject));
}
diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp
index f6a197e..0f56028 100644
--- a/Source/JavaScriptCore/interpreter/Interpreter.cpp
+++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp
@@ -45,11 +45,11 @@
#include "JSActivation.h"
#include "JSArray.h"
#include "JSBoundFunction.h"
+#include "JSNameScope.h"
#include "JSNotAnObject.h"
#include "JSPropertyNameIterator.h"
-#include "LiteralParser.h"
-#include "JSStaticScopeObject.h"
#include "JSString.h"
+#include "LiteralParser.h"
#include "NameInstance.h"
#include "ObjectPrototype.h"
#include "Operations.h"
@@ -93,282 +93,6 @@
return jsString(exec, strings, count);
}
-NEVER_INLINE bool Interpreter::resolve(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
-{
- int dst = vPC[1].u.operand;
- int property = vPC[2].u.operand;
-
- ScopeChainNode* scopeChain = callFrame->scopeChain();
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator end = scopeChain->end();
- ASSERT(iter != end);
-
- CodeBlock* codeBlock = callFrame->codeBlock();
- Identifier& ident = codeBlock->identifier(property);
- do {
- JSObject* o = iter->get();
- PropertySlot slot(o);
- if (o->getPropertySlot(callFrame, ident, slot)) {
- JSValue result = slot.getValue(callFrame, ident);
- exceptionValue = callFrame->globalData().exception;
- if (exceptionValue)
- return false;
- callFrame->uncheckedR(dst) = JSValue(result);
- return true;
- }
- } while (++iter != end);
- exceptionValue = createUndefinedVariableError(callFrame, ident);
- return false;
-}
-
-NEVER_INLINE bool Interpreter::resolveSkip(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
-{
- CodeBlock* codeBlock = callFrame->codeBlock();
-
- int dst = vPC[1].u.operand;
- int property = vPC[2].u.operand;
- int skip = vPC[3].u.operand;
-
- ScopeChainNode* scopeChain = callFrame->scopeChain();
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator end = scopeChain->end();
- ASSERT(iter != end);
- bool checkTopLevel = codeBlock->codeType() == FunctionCode && codeBlock->needsFullScopeChain();
- ASSERT(skip || !checkTopLevel);
- if (checkTopLevel && skip--) {
- if (callFrame->uncheckedR(codeBlock->activationRegister()).jsValue())
- ++iter;
- }
- while (skip--) {
- ++iter;
- ASSERT(iter != end);
- }
- Identifier& ident = codeBlock->identifier(property);
- do {
- JSObject* o = iter->get();
- PropertySlot slot(o);
- if (o->getPropertySlot(callFrame, ident, slot)) {
- JSValue result = slot.getValue(callFrame, ident);
- exceptionValue = callFrame->globalData().exception;
- if (exceptionValue)
- return false;
- ASSERT(result);
- callFrame->uncheckedR(dst) = JSValue(result);
- return true;
- }
- } while (++iter != end);
- exceptionValue = createUndefinedVariableError(callFrame, ident);
- return false;
-}
-
-NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
-{
- int dst = vPC[1].u.operand;
- CodeBlock* codeBlock = callFrame->codeBlock();
- JSGlobalObject* globalObject = codeBlock->globalObject();
- ASSERT(globalObject->isGlobalObject());
- int property = vPC[2].u.operand;
- Structure* structure = vPC[3].u.structure.get();
- int offset = vPC[4].u.operand;
-
- if (structure == globalObject->structure()) {
- callFrame->uncheckedR(dst) = JSValue(globalObject->getDirectOffset(offset));
- return true;
- }
-
- Identifier& ident = codeBlock->identifier(property);
- PropertySlot slot(globalObject);
- if (globalObject->getPropertySlot(callFrame, ident, slot)) {
- JSValue result = slot.getValue(callFrame, ident);
- if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
- vPC[3].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), globalObject->structure());
- vPC[4] = slot.cachedOffset();
- callFrame->uncheckedR(dst) = JSValue(result);
- return true;
- }
-
- exceptionValue = callFrame->globalData().exception;
- if (exceptionValue)
- return false;
- callFrame->uncheckedR(dst) = JSValue(result);
- return true;
- }
-
- exceptionValue = createUndefinedVariableError(callFrame, ident);
- return false;
-}
-
-NEVER_INLINE bool Interpreter::resolveGlobalDynamic(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
-{
- int dst = vPC[1].u.operand;
- CodeBlock* codeBlock = callFrame->codeBlock();
- JSGlobalObject* globalObject = codeBlock->globalObject();
- ASSERT(globalObject->isGlobalObject());
- int property = vPC[2].u.operand;
- Structure* structure = vPC[3].u.structure.get();
- int offset = vPC[4].u.operand;
- int skip = vPC[5].u.operand;
-
- ScopeChainNode* scopeChain = callFrame->scopeChain();
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator end = scopeChain->end();
- ASSERT(iter != end);
- bool checkTopLevel = codeBlock->codeType() == FunctionCode && codeBlock->needsFullScopeChain();
- ASSERT(skip || !checkTopLevel);
- if (checkTopLevel && skip--) {
- if (callFrame->uncheckedR(codeBlock->activationRegister()).jsValue())
- ++iter;
- }
- while (skip--) {
- JSObject* o = iter->get();
- if (o->hasCustomProperties()) {
- Identifier& ident = codeBlock->identifier(property);
- do {
- PropertySlot slot(o);
- if (o->getPropertySlot(callFrame, ident, slot)) {
- JSValue result = slot.getValue(callFrame, ident);
- exceptionValue = callFrame->globalData().exception;
- if (exceptionValue)
- return false;
- ASSERT(result);
- callFrame->uncheckedR(dst) = JSValue(result);
- return true;
- }
- if (iter == end)
- break;
- o = iter->get();
- ++iter;
- } while (true);
- exceptionValue = createUndefinedVariableError(callFrame, ident);
- return false;
- }
- ++iter;
- }
-
- if (structure == globalObject->structure()) {
- callFrame->uncheckedR(dst) = JSValue(globalObject->getDirectOffset(offset));
- ASSERT(callFrame->uncheckedR(dst).jsValue());
- return true;
- }
-
- Identifier& ident = codeBlock->identifier(property);
- PropertySlot slot(globalObject);
- if (globalObject->getPropertySlot(callFrame, ident, slot)) {
- JSValue result = slot.getValue(callFrame, ident);
- if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
- vPC[3].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), globalObject->structure());
- vPC[4] = slot.cachedOffset();
- ASSERT(result);
- callFrame->uncheckedR(dst) = JSValue(result);
- return true;
- }
-
- exceptionValue = callFrame->globalData().exception;
- if (exceptionValue)
- return false;
- ASSERT(result);
- callFrame->uncheckedR(dst) = JSValue(result);
- return true;
- }
-
- exceptionValue = createUndefinedVariableError(callFrame, ident);
- return false;
-}
-
-NEVER_INLINE void Interpreter::resolveBase(CallFrame* callFrame, Instruction* vPC)
-{
- int dst = vPC[1].u.operand;
- int property = vPC[2].u.operand;
- bool isStrictPut = vPC[3].u.operand;
- Identifier ident = callFrame->codeBlock()->identifier(property);
- JSValue result = JSC::resolveBase(callFrame, ident, callFrame->scopeChain(), isStrictPut);
- if (result) {
- callFrame->uncheckedR(dst) = result;
- ASSERT(callFrame->uncheckedR(dst).jsValue());
- } else
- callFrame->globalData().exception = createErrorForInvalidGlobalAssignment(callFrame, ident.ustring());
-}
-
-NEVER_INLINE bool Interpreter::resolveBaseAndProperty(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
-{
- int baseDst = vPC[1].u.operand;
- int propDst = vPC[2].u.operand;
- int property = vPC[3].u.operand;
-
- ScopeChainNode* scopeChain = callFrame->scopeChain();
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator end = scopeChain->end();
-
- // FIXME: add scopeDepthIsZero optimization
-
- ASSERT(iter != end);
-
- CodeBlock* codeBlock = callFrame->codeBlock();
- Identifier& ident = codeBlock->identifier(property);
- JSObject* base;
- do {
- base = iter->get();
- PropertySlot slot(base);
- if (base->getPropertySlot(callFrame, ident, slot)) {
- JSValue result = slot.getValue(callFrame, ident);
- exceptionValue = callFrame->globalData().exception;
- if (exceptionValue)
- return false;
- callFrame->uncheckedR(propDst) = JSValue(result);
- callFrame->uncheckedR(baseDst) = JSValue(base);
- return true;
- }
- ++iter;
- } while (iter != end);
-
- exceptionValue = createUndefinedVariableError(callFrame, ident);
- return false;
-}
-
-NEVER_INLINE bool Interpreter::resolveThisAndProperty(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
-{
- int thisDst = vPC[1].u.operand;
- int propDst = vPC[2].u.operand;
- int property = vPC[3].u.operand;
-
- ScopeChainNode* scopeChain = callFrame->scopeChain();
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator end = scopeChain->end();
-
- // FIXME: add scopeDepthIsZero optimization
-
- ASSERT(iter != end);
-
- CodeBlock* codeBlock = callFrame->codeBlock();
- Identifier& ident = codeBlock->identifier(property);
- JSObject* base;
- do {
- base = iter->get();
- ++iter;
- PropertySlot slot(base);
- if (base->getPropertySlot(callFrame, ident, slot)) {
- JSValue result = slot.getValue(callFrame, ident);
- exceptionValue = callFrame->globalData().exception;
- if (exceptionValue)
- return false;
- callFrame->uncheckedR(propDst) = JSValue(result);
- // All entries on the scope chain should be EnvironmentRecords (activations etc),
- // other then 'with' object, which are directly referenced from the scope chain,
- // and the global object. If we hit either an EnvironmentRecord or a global
- // object at the end of the scope chain, this is undefined. If we hit a non-
- // EnvironmentRecord within the scope chain, pass the base as the this value.
- if (iter == end || base->structure()->typeInfo().isEnvironmentRecord())
- callFrame->uncheckedR(thisDst) = jsUndefined();
- else
- callFrame->uncheckedR(thisDst) = JSValue(base);
- return true;
- }
- } while (iter != end);
-
- exceptionValue = createUndefinedVariableError(callFrame, ident);
- return false;
-}
-
#endif // ENABLE(CLASSIC_INTERPRETER)
ALWAYS_INLINE CallFrame* Interpreter::slideRegisterWindowForCall(CodeBlock* newCodeBlock, RegisterFile* registerFile, CallFrame* callFrame, size_t registerOffset, int argumentCountIncludingThis)
@@ -1561,7 +1285,7 @@
JSObject* variableObject;
for (ScopeChainNode* node = scopeChain; ; node = node->next.get()) {
ASSERT(node);
- if (node->object->isVariableObject() && !node->object->isStaticScopeObject()) {
+ if (node->object->isVariableObject() && !node->object->isNameScopeObject()) {
variableObject = jsCast<JSSymbolTableObject*>(node->object.get());
break;
}
@@ -1678,7 +1402,7 @@
CodeBlock* codeBlock = callFrame->codeBlock();
Identifier& property = codeBlock->identifier(vPC[2].u.operand);
JSValue value = callFrame->r(vPC[3].u.operand).jsValue();
- JSObject* scope = JSStaticScopeObject::create(callFrame, property, value, DontDelete);
+ JSObject* scope = JSNameScope::create(callFrame, property, value, DontDelete);
callFrame->uncheckedR(dst) = JSValue(scope);
return callFrame->scopeChain()->push(scope);
@@ -2825,8 +2549,13 @@
scope chain, and writes the resulting value to register
dst. If the property is not found, raises an exception.
*/
- if (UNLIKELY(!resolve(callFrame, vPC, exceptionValue)))
- goto vm_throw;
+ int dst = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ Identifier& ident = callFrame->codeBlock()->identifier(property);
+
+ JSValue result = JSScope::resolve(callFrame, ident);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
vPC += OPCODE_LENGTH(op_resolve);
NEXT_INSTRUCTION();
@@ -2838,11 +2567,16 @@
scope chain skipping the top 'skip' levels, and writes the resulting
value to register dst. If the property is not found, raises an exception.
*/
- if (UNLIKELY(!resolveSkip(callFrame, vPC, exceptionValue)))
- goto vm_throw;
+ int dst = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ int skip = vPC[3].u.operand;
+ Identifier& ident = callFrame->codeBlock()->identifier(property);
+
+ JSValue result = JSScope::resolveSkip(callFrame, ident, skip);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
vPC += OPCODE_LENGTH(op_resolve_skip);
-
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_resolve_global) {
@@ -2853,11 +2587,21 @@
a fast lookup using the case offset, otherwise fall back to a full resolve and
cache the new structure and offset
*/
- if (UNLIKELY(!resolveGlobal(callFrame, vPC, exceptionValue)))
- goto vm_throw;
-
+ int dst = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ Identifier& ident = callFrame->codeBlock()->identifier(property);
+
+ JSValue result = JSScope::resolveGlobal(
+ callFrame,
+ ident,
+ callFrame->lexicalGlobalObject(),
+ &vPC[3].u.structure,
+ &vPC[4].u.operand
+ );
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+
vPC += OPCODE_LENGTH(op_resolve_global);
-
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_resolve_global_dynamic) {
@@ -2871,11 +2615,16 @@
This walks through n levels of the scope chain to verify that none of those levels
in the scope chain include dynamically added properties.
*/
- if (UNLIKELY(!resolveGlobalDynamic(callFrame, vPC, exceptionValue)))
- goto vm_throw;
-
+ int dst = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ int skip = vPC[5].u.operand;
+ Identifier& ident = callFrame->codeBlock()->identifier(property);
+
+ JSValue result = JSScope::resolveGlobalDynamic(callFrame, ident, skip, &vPC[3].u.structure, &vPC[4].u.operand);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+
vPC += OPCODE_LENGTH(op_resolve_global_dynamic);
-
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_get_global_var) {
@@ -3004,8 +2753,14 @@
outermost scope (which will be the global object) is
stored in register dst.
*/
- resolveBase(callFrame, vPC);
+ int dst = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ bool isStrict = vPC[3].u.operand;
+ Identifier& ident = callFrame->codeBlock()->identifier(property);
+
+ JSValue result = JSScope::resolveBase(callFrame, ident, isStrict);
CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
vPC += OPCODE_LENGTH(op_resolve_base);
NEXT_INSTRUCTION();
@@ -3042,8 +2797,14 @@
resolve, or resolve_base followed by get_by_id, as it
avoids duplicate hash lookups.
*/
- if (UNLIKELY(!resolveBaseAndProperty(callFrame, vPC, exceptionValue)))
- goto vm_throw;
+ int baseDst = vPC[1].u.operand;
+ int propDst = vPC[2].u.operand;
+ int property = vPC[3].u.operand;
+ Identifier& ident = codeBlock->identifier(property);
+
+ JSValue prop = JSScope::resolveWithBase(callFrame, ident, &callFrame->uncheckedR(baseDst));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(propDst) = prop;
vPC += OPCODE_LENGTH(op_resolve_with_base);
NEXT_INSTRUCTION();
@@ -3058,8 +2819,14 @@
If the property is not found, raises an exception.
*/
- if (UNLIKELY(!resolveThisAndProperty(callFrame, vPC, exceptionValue)))
- goto vm_throw;
+ int thisDst = vPC[1].u.operand;
+ int propDst = vPC[2].u.operand;
+ int property = vPC[3].u.operand;
+ Identifier& ident = codeBlock->identifier(property);
+
+ JSValue prop = JSScope::resolveWithThis(callFrame, ident, &callFrame->uncheckedR(thisDst));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(propDst) = prop;
vPC += OPCODE_LENGTH(op_resolve_with_this);
NEXT_INSTRUCTION();
@@ -4488,7 +4255,7 @@
does not affect the scope enclosing the FunctionExpression.
*/
if (!function->name().isNull()) {
- JSStaticScopeObject* functionScopeObject = JSStaticScopeObject::create(callFrame, function->name(), func, ReadOnly | DontDelete);
+ JSNameScope* functionScopeObject = JSNameScope::create(callFrame, function->name(), func, ReadOnly | DontDelete);
func->setScope(*globalData, func->scope()->push(functionScopeObject));
}
@@ -5132,7 +4899,7 @@
DEFINE_OPCODE(op_push_new_scope) {
/* new_scope dst(r) property(id) value(r)
- Constructs a new StaticScopeObject with property set to value. That scope
+ Constructs a new NameScopeObject with property set to value. That scope
object is then pushed onto the ScopeChain. The scope object is then stored
in dst for GC.
*/
diff --git a/Source/JavaScriptCore/interpreter/Interpreter.h b/Source/JavaScriptCore/interpreter/Interpreter.h
index f4ccd99..d07f83c 100644
--- a/Source/JavaScriptCore/interpreter/Interpreter.h
+++ b/Source/JavaScriptCore/interpreter/Interpreter.h
@@ -259,13 +259,6 @@
JSValue execute(CallFrameClosure&);
#if ENABLE(CLASSIC_INTERPRETER)
- NEVER_INLINE bool resolve(CallFrame*, Instruction*, JSValue& exceptionValue);
- NEVER_INLINE bool resolveSkip(CallFrame*, Instruction*, JSValue& exceptionValue);
- NEVER_INLINE bool resolveGlobal(CallFrame*, Instruction*, JSValue& exceptionValue);
- NEVER_INLINE bool resolveGlobalDynamic(CallFrame*, Instruction*, JSValue& exceptionValue);
- NEVER_INLINE void resolveBase(CallFrame*, Instruction* vPC);
- NEVER_INLINE bool resolveBaseAndProperty(CallFrame*, Instruction*, JSValue& exceptionValue);
- NEVER_INLINE bool resolveThisAndProperty(CallFrame*, Instruction*, JSValue& exceptionValue);
NEVER_INLINE ScopeChainNode* createExceptionScope(CallFrame*, const Instruction* vPC);
void tryCacheGetByID(CallFrame*, CodeBlock*, Instruction*, JSValue baseValue, const Identifier& propertyName, const PropertySlot&);
diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp
index cc89958..e0faa0f 100644
--- a/Source/JavaScriptCore/jit/JITStubs.cpp
+++ b/Source/JavaScriptCore/jit/JITStubs.cpp
@@ -50,9 +50,9 @@
#include "JSArray.h"
#include "JSFunction.h"
#include "JSGlobalObjectFunctions.h"
+#include "JSNameScope.h"
#include "JSNotAnObject.h"
#include "JSPropertyNameIterator.h"
-#include "JSStaticScopeObject.h"
#include "JSString.h"
#include "NameInstance.h"
#include "ObjectPrototype.h"
@@ -2393,7 +2393,7 @@
CallFrame* callFrame = stackFrame.callFrame;
- JSValue result = CommonSlowPaths::opResolve(callFrame, stackFrame.args[0].identifier());
+ JSValue result = JSScope::resolve(callFrame, stackFrame.args[0].identifier());
CHECK_FOR_EXCEPTION_AT_END();
return JSValue::encode(result);
}
@@ -2624,18 +2624,16 @@
{
STUB_INIT_STACK_FRAME(stackFrame);
- return JSValue::encode(JSC::resolveBase(stackFrame.callFrame, stackFrame.args[0].identifier(), stackFrame.callFrame->scopeChain(), false));
+ return JSValue::encode(JSScope::resolveBase(stackFrame.callFrame, stackFrame.args[0].identifier(), false));
}
DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_base_strict_put)
{
STUB_INIT_STACK_FRAME(stackFrame);
- JSValue base = JSC::resolveBase(stackFrame.callFrame, stackFrame.args[0].identifier(), stackFrame.callFrame->scopeChain(), true);
- if (!base) {
- stackFrame.globalData->exception = createErrorForInvalidGlobalAssignment(stackFrame.callFrame, stackFrame.args[0].identifier().ustring());
- VM_THROW_EXCEPTION();
- }
- return JSValue::encode(base);
+
+ if (JSValue result = JSScope::resolveBase(stackFrame.callFrame, stackFrame.args[0].identifier(), true))
+ return JSValue::encode(result);
+ VM_THROW_EXCEPTION();
}
DEFINE_STUB_FUNCTION(EncodedJSValue, op_ensure_property_exists)
@@ -2657,7 +2655,7 @@
{
STUB_INIT_STACK_FRAME(stackFrame);
- JSValue result = CommonSlowPaths::opResolveSkip(stackFrame.callFrame, stackFrame.args[0].identifier(), stackFrame.args[1].int32());
+ JSValue result = JSScope::resolveSkip(stackFrame.callFrame, stackFrame.args[0].identifier(), stackFrame.args[1].int32());
CHECK_FOR_EXCEPTION_AT_END();
return JSValue::encode(result);
}
@@ -2667,28 +2665,20 @@
STUB_INIT_STACK_FRAME(stackFrame);
CallFrame* callFrame = stackFrame.callFrame;
- CodeBlock* codeBlock = callFrame->codeBlock();
- JSGlobalObject* globalObject = codeBlock->globalObject();
Identifier& ident = stackFrame.args[0].identifier();
+ CodeBlock* codeBlock = callFrame->codeBlock();
unsigned globalResolveInfoIndex = stackFrame.args[1].int32();
- ASSERT(globalObject->isGlobalObject());
+ GlobalResolveInfo& globalResolveInfo = codeBlock->globalResolveInfo(globalResolveInfoIndex);
- PropertySlot slot(globalObject);
- if (globalObject->getPropertySlot(callFrame, ident, slot)) {
- JSValue result = slot.getValue(callFrame, ident);
- if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
- GlobalResolveInfo& globalResolveInfo = codeBlock->globalResolveInfo(globalResolveInfoIndex);
- globalResolveInfo.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), globalObject->structure());
- globalResolveInfo.offset = slot.cachedOffset();
- return JSValue::encode(result);
- }
-
- CHECK_FOR_EXCEPTION_AT_END();
- return JSValue::encode(result);
- }
-
- stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident);
- VM_THROW_EXCEPTION();
+ JSValue result = JSScope::resolveGlobal(
+ callFrame,
+ ident,
+ callFrame->lexicalGlobalObject(),
+ &globalResolveInfo.structure,
+ &globalResolveInfo.offset
+ );
+ CHECK_FOR_EXCEPTION();
+ return JSValue::encode(result);
}
DEFINE_STUB_FUNCTION(EncodedJSValue, op_div)
@@ -2970,7 +2960,7 @@
STUB_INIT_STACK_FRAME(stackFrame);
CallFrame* callFrame = stackFrame.callFrame;
- JSValue result = CommonSlowPaths::opResolveWithBase(callFrame, stackFrame.args[0].identifier(), callFrame->registers()[stackFrame.args[1].int32()]);
+ JSValue result = JSScope::resolveWithBase(callFrame, stackFrame.args[0].identifier(), &callFrame->registers()[stackFrame.args[1].int32()]);
CHECK_FOR_EXCEPTION_AT_END();
return JSValue::encode(result);
}
@@ -2980,7 +2970,7 @@
STUB_INIT_STACK_FRAME(stackFrame);
CallFrame* callFrame = stackFrame.callFrame;
- JSValue result = CommonSlowPaths::opResolveWithThis(callFrame, stackFrame.args[0].identifier(), callFrame->registers()[stackFrame.args[1].int32()]);
+ JSValue result = JSScope::resolveWithThis(callFrame, stackFrame.args[0].identifier(), &callFrame->registers()[stackFrame.args[1].int32()]);
CHECK_FOR_EXCEPTION_AT_END();
return JSValue::encode(result);
}
@@ -3002,7 +2992,7 @@
does not affect the scope enclosing the FunctionExpression.
*/
if (!function->name().isNull()) {
- JSStaticScopeObject* functionScopeObject = JSStaticScopeObject::create(callFrame, function->name(), func, ReadOnly | DontDelete);
+ JSNameScope* functionScopeObject = JSNameScope::create(callFrame, function->name(), func, ReadOnly | DontDelete);
func->setScope(callFrame->globalData(), func->scope()->push(functionScopeObject));
}
@@ -3271,7 +3261,7 @@
{
STUB_INIT_STACK_FRAME(stackFrame);
- JSObject* scope = JSStaticScopeObject::create(stackFrame.callFrame, stackFrame.args[0].identifier(), stackFrame.args[1].jsValue(), DontDelete);
+ JSObject* scope = JSNameScope::create(stackFrame.callFrame, stackFrame.args[0].identifier(), stackFrame.args[1].jsValue(), DontDelete);
CallFrame* callFrame = stackFrame.callFrame;
callFrame->setScopeChain(callFrame->scopeChain()->push(scope));
diff --git a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
index eef54ac..3480560 100644
--- a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
+++ b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
@@ -38,8 +38,8 @@
#include "JITDriver.h"
#include "JSActivation.h"
#include "JSGlobalObjectFunctions.h"
+#include "JSNameScope.h"
#include "JSPropertyNameIterator.h"
-#include "JSStaticScopeObject.h"
#include "JSString.h"
#include "JSValue.h"
#include "LLIntCommon.h"
@@ -757,7 +757,7 @@
LLINT_SLOW_PATH_DECL(slow_path_resolve)
{
LLINT_BEGIN();
- LLINT_RETURN_PROFILED(op_resolve, CommonSlowPaths::opResolve(exec, exec->codeBlock()->identifier(pc[2].u.operand)));
+ LLINT_RETURN_PROFILED(op_resolve, JSScope::resolve(exec, exec->codeBlock()->identifier(pc[2].u.operand)));
}
LLINT_SLOW_PATH_DECL(slow_path_resolve_skip)
@@ -765,57 +765,31 @@
LLINT_BEGIN();
LLINT_RETURN_PROFILED(
op_resolve_skip,
- CommonSlowPaths::opResolveSkip(
+ JSScope::resolveSkip(
exec,
exec->codeBlock()->identifier(pc[2].u.operand),
pc[3].u.operand));
}
-static JSValue resolveGlobal(ExecState* exec, Instruction* pc)
-{
- CodeBlock* codeBlock = exec->codeBlock();
- JSGlobalObject* globalObject = codeBlock->globalObject();
- ASSERT(globalObject->isGlobalObject());
- int property = pc[2].u.operand;
- Structure* structure = pc[3].u.structure.get();
-
- ASSERT_UNUSED(structure, structure != globalObject->structure());
-
- Identifier& ident = codeBlock->identifier(property);
- PropertySlot slot(globalObject);
-
- if (globalObject->getPropertySlot(exec, ident, slot)) {
- JSValue result = slot.getValue(exec, ident);
- if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary()
- && slot.slotBase() == globalObject) {
- pc[3].u.structure.set(
- exec->globalData(), codeBlock->ownerExecutable(), globalObject->structure());
- pc[4] = slot.cachedOffset();
- }
-
- return result;
- }
-
- exec->globalData().exception = createUndefinedVariableError(exec, ident);
- return JSValue();
-}
-
LLINT_SLOW_PATH_DECL(slow_path_resolve_global)
{
LLINT_BEGIN();
- LLINT_RETURN_PROFILED(op_resolve_global, resolveGlobal(exec, pc));
+ Identifier& ident = exec->codeBlock()->identifier(pc[2].u.operand);
+ LLINT_RETURN_PROFILED(op_resolve_global, JSScope::resolveGlobal(exec, ident, exec->lexicalGlobalObject(), &pc[3].u.structure, &pc[4].u.operand));
}
LLINT_SLOW_PATH_DECL(slow_path_resolve_global_dynamic)
{
+ // FIXME: <rdar://problem/12185487> LLInt resolve_global_dynamic doesn't check intervening scopes for modification
LLINT_BEGIN();
- LLINT_RETURN_PROFILED(op_resolve_global_dynamic, resolveGlobal(exec, pc));
+ Identifier& ident = exec->codeBlock()->identifier(pc[2].u.operand);
+ LLINT_RETURN_PROFILED(op_resolve_global_dynamic, JSScope::resolveGlobal(exec, ident, exec->lexicalGlobalObject(), &pc[3].u.structure, &pc[4].u.operand));
}
LLINT_SLOW_PATH_DECL(slow_path_resolve_for_resolve_global_dynamic)
{
LLINT_BEGIN();
- LLINT_RETURN_PROFILED(op_resolve_global_dynamic, CommonSlowPaths::opResolve(exec, exec->codeBlock()->identifier(pc[2].u.operand)));
+ LLINT_RETURN_PROFILED(op_resolve_global_dynamic, JSScope::resolve(exec, exec->codeBlock()->identifier(pc[2].u.operand)));
}
LLINT_SLOW_PATH_DECL(slow_path_resolve_base)
@@ -823,13 +797,12 @@
LLINT_BEGIN();
Identifier& ident = exec->codeBlock()->identifier(pc[2].u.operand);
if (pc[3].u.operand) {
- JSValue base = JSC::resolveBase(exec, ident, exec->scopeChain(), true);
- if (!base)
- LLINT_THROW(createErrorForInvalidGlobalAssignment(exec, ident.ustring()));
- LLINT_RETURN(base);
+ if (JSValue result = JSScope::resolveBase(exec, ident, true))
+ LLINT_RETURN(result);
+ LLINT_THROW(globalData.exception);
}
-
- LLINT_RETURN_PROFILED(op_resolve_base, JSC::resolveBase(exec, ident, exec->scopeChain(), false));
+
+ LLINT_RETURN_PROFILED(op_resolve_base, JSScope::resolveBase(exec, ident, false));
}
LLINT_SLOW_PATH_DECL(slow_path_ensure_property_exists)
@@ -846,7 +819,7 @@
LLINT_SLOW_PATH_DECL(slow_path_resolve_with_base)
{
LLINT_BEGIN();
- JSValue result = CommonSlowPaths::opResolveWithBase(exec, exec->codeBlock()->identifier(pc[3].u.operand), LLINT_OP(1));
+ JSValue result = JSScope::resolveWithBase(exec, exec->codeBlock()->identifier(pc[3].u.operand), &LLINT_OP(1));
LLINT_CHECK_EXCEPTION();
LLINT_OP(2) = result;
// FIXME: technically should have profiling, but we don't do it because the DFG won't use it.
@@ -856,7 +829,7 @@
LLINT_SLOW_PATH_DECL(slow_path_resolve_with_this)
{
LLINT_BEGIN();
- JSValue result = CommonSlowPaths::opResolveWithThis(exec, exec->codeBlock()->identifier(pc[3].u.operand), LLINT_OP(1));
+ JSValue result = JSScope::resolveWithThis(exec, exec->codeBlock()->identifier(pc[3].u.operand), &LLINT_OP(1));
LLINT_CHECK_EXCEPTION();
LLINT_OP(2) = result;
// FIXME: technically should have profiling, but we don't do it because the DFG won't use it.
@@ -1295,7 +1268,7 @@
JSFunction* func = function->make(exec, exec->scopeChain());
if (!function->name().isNull()) {
- JSStaticScopeObject* functionScopeObject = JSStaticScopeObject::create(exec, function->name(), func, ReadOnly | DontDelete);
+ JSNameScope* functionScopeObject = JSNameScope::create(exec, function->name(), func, ReadOnly | DontDelete);
func->setScope(globalData, func->scope()->push(functionScopeObject));
}
@@ -1578,7 +1551,7 @@
{
LLINT_BEGIN();
CodeBlock* codeBlock = exec->codeBlock();
- JSObject* scope = JSStaticScopeObject::create(exec, codeBlock->identifier(pc[2].u.operand), LLINT_OP(3).jsValue(), DontDelete);
+ JSObject* scope = JSNameScope::create(exec, codeBlock->identifier(pc[2].u.operand), LLINT_OP(3).jsValue(), DontDelete);
exec->setScopeChain(exec->scopeChain()->push(scope));
LLINT_RETURN(scope);
}
diff --git a/Source/JavaScriptCore/parser/Nodes.cpp b/Source/JavaScriptCore/parser/Nodes.cpp
index 0172359..c057517 100644
--- a/Source/JavaScriptCore/parser/Nodes.cpp
+++ b/Source/JavaScriptCore/parser/Nodes.cpp
@@ -33,7 +33,7 @@
#include "JIT.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
-#include "JSStaticScopeObject.h"
+#include "JSNameScope.h"
#include "LabelScope.h"
#include "Lexer.h"
#include "Operations.h"
diff --git a/Source/JavaScriptCore/runtime/CommonSlowPaths.h b/Source/JavaScriptCore/runtime/CommonSlowPaths.h
index 0d34801..e4c76ad 100644
--- a/Source/JavaScriptCore/runtime/CommonSlowPaths.h
+++ b/Source/JavaScriptCore/runtime/CommonSlowPaths.h
@@ -119,123 +119,6 @@
return baseObj->hasProperty(exec, property);
}
-ALWAYS_INLINE JSValue opResolve(ExecState* exec, Identifier& ident)
-{
- ScopeChainNode* scopeChain = exec->scopeChain();
-
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator end = scopeChain->end();
- ASSERT(iter != end);
-
- do {
- JSObject* o = iter->get();
- PropertySlot slot(o);
- if (o->getPropertySlot(exec, ident, slot))
- return slot.getValue(exec, ident);
- } while (++iter != end);
-
- exec->globalData().exception = createUndefinedVariableError(exec, ident);
- return JSValue();
-}
-
-ALWAYS_INLINE JSValue opResolveSkip(ExecState* exec, Identifier& ident, int skip)
-{
- ScopeChainNode* scopeChain = exec->scopeChain();
-
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator end = scopeChain->end();
- ASSERT(iter != end);
- CodeBlock* codeBlock = exec->codeBlock();
- bool checkTopLevel = codeBlock->codeType() == FunctionCode && codeBlock->needsFullScopeChain();
- ASSERT(skip || !checkTopLevel);
- if (checkTopLevel && skip--) {
- if (exec->uncheckedR(codeBlock->activationRegister()).jsValue())
- ++iter;
- }
- while (skip--) {
- ++iter;
- ASSERT(iter != end);
- }
- do {
- JSObject* o = iter->get();
- PropertySlot slot(o);
- if (o->getPropertySlot(exec, ident, slot))
- return slot.getValue(exec, ident);
- } while (++iter != end);
-
- exec->globalData().exception = createUndefinedVariableError(exec, ident);
- return JSValue();
-}
-
-ALWAYS_INLINE JSValue opResolveWithBase(ExecState* exec, Identifier& ident, Register& baseSlot)
-{
- ScopeChainNode* scopeChain = exec->scopeChain();
-
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator end = scopeChain->end();
-
- // FIXME: add scopeDepthIsZero optimization
-
- ASSERT(iter != end);
-
- JSObject* base;
- do {
- base = iter->get();
- PropertySlot slot(base);
- if (base->getPropertySlot(exec, ident, slot)) {
- JSValue result = slot.getValue(exec, ident);
- if (exec->globalData().exception)
- return JSValue();
-
- baseSlot = JSValue(base);
- return result;
- }
- ++iter;
- } while (iter != end);
-
- exec->globalData().exception = createUndefinedVariableError(exec, ident);
- return JSValue();
-}
-
-ALWAYS_INLINE JSValue opResolveWithThis(ExecState* exec, Identifier& ident, Register& baseSlot)
-{
- ScopeChainNode* scopeChain = exec->scopeChain();
-
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator end = scopeChain->end();
-
- // FIXME: add scopeDepthIsZero optimization
-
- ASSERT(iter != end);
-
- JSObject* base;
- do {
- base = iter->get();
- ++iter;
- PropertySlot slot(base);
- if (base->getPropertySlot(exec, ident, slot)) {
- JSValue result = slot.getValue(exec, ident);
- if (exec->globalData().exception)
- return JSValue();
-
- // All entries on the scope chain should be EnvironmentRecords (activations etc),
- // other then 'with' object, which are directly referenced from the scope chain,
- // and the global object. If we hit either an EnvironmentRecord or a global
- // object at the end of the scope chain, this is undefined. If we hit a non-
- // EnvironmentRecord within the scope chain, pass the base as the this value.
- if (iter == end || base->structure()->typeInfo().isEnvironmentRecord())
- baseSlot = jsUndefined();
- else
- baseSlot = JSValue(base);
- return result;
- }
- } while (iter != end);
-
- exec->globalData().exception = createUndefinedVariableError(exec, ident);
- return JSValue();
-}
-
} } // namespace JSC::CommonSlowPaths
#endif // CommonSlowPaths_h
-
diff --git a/Source/JavaScriptCore/runtime/JSActivation.h b/Source/JavaScriptCore/runtime/JSActivation.h
index bcc3c16..3abe5f5 100644
--- a/Source/JavaScriptCore/runtime/JSActivation.h
+++ b/Source/JavaScriptCore/runtime/JSActivation.h
@@ -79,7 +79,7 @@
protected:
void finishCreation(CallFrame*, FunctionExecutable*);
- static const unsigned StructureFlags = IsEnvironmentRecord | OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | Base::StructureFlags;
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | Base::StructureFlags;
private:
bool symbolTableGet(PropertyName, PropertySlot&);
diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.cpp b/Source/JavaScriptCore/runtime/JSGlobalData.cpp
index aab710d..64d47492 100644
--- a/Source/JavaScriptCore/runtime/JSGlobalData.cpp
+++ b/Source/JavaScriptCore/runtime/JSGlobalData.cpp
@@ -30,12 +30,12 @@
#include "JSGlobalData.h"
#include "ArgList.h"
-#include "Heap.h"
#include "CommonIdentifiers.h"
#include "DebuggerActivation.h"
#include "FunctionConstructor.h"
#include "GCActivityCallback.h"
#include "GetterSetter.h"
+#include "Heap.h"
#include "HostCallReturnValue.h"
#include "IncrementalSweeper.h"
#include "Interpreter.h"
@@ -45,9 +45,9 @@
#include "JSClassRef.h"
#include "JSFunction.h"
#include "JSLock.h"
+#include "JSNameScope.h"
#include "JSNotAnObject.h"
#include "JSPropertyNameIterator.h"
-#include "JSStaticScopeObject.h"
#include "Lexer.h"
#include "Lookup.h"
#include "Nodes.h"
@@ -189,7 +189,7 @@
activationStructure.set(*this, JSActivation::createStructure(*this, 0, jsNull()));
interruptedExecutionErrorStructure.set(*this, InterruptedExecutionError::createStructure(*this, 0, jsNull()));
terminatedExecutionErrorStructure.set(*this, TerminatedExecutionError::createStructure(*this, 0, jsNull()));
- staticScopeStructure.set(*this, JSStaticScopeObject::createStructure(*this, 0, jsNull()));
+ nameScopeStructure.set(*this, JSNameScope::createStructure(*this, 0, jsNull()));
strictEvalActivationStructure.set(*this, StrictEvalActivation::createStructure(*this, 0, jsNull()));
stringStructure.set(*this, JSString::createStructure(*this, 0, jsNull()));
notAnObjectStructure.set(*this, JSNotAnObject::createStructure(*this, 0, jsNull()));
diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.h b/Source/JavaScriptCore/runtime/JSGlobalData.h
index 14e77ab..ed764a3 100644
--- a/Source/JavaScriptCore/runtime/JSGlobalData.h
+++ b/Source/JavaScriptCore/runtime/JSGlobalData.h
@@ -224,7 +224,7 @@
Strong<Structure> activationStructure;
Strong<Structure> interruptedExecutionErrorStructure;
Strong<Structure> terminatedExecutionErrorStructure;
- Strong<Structure> staticScopeStructure;
+ Strong<Structure> nameScopeStructure;
Strong<Structure> strictEvalActivationStructure;
Strong<Structure> stringStructure;
Strong<Structure> notAnObjectStructure;
diff --git a/Source/JavaScriptCore/runtime/JSNameScope.cpp b/Source/JavaScriptCore/runtime/JSNameScope.cpp
new file mode 100644
index 0000000..5dc665c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSNameScope.cpp
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2008, 2009, 2012 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSNameScope.h"
+
+#include "Error.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(JSNameScope);
+
+const ClassInfo JSNameScope::s_info = { "NameScope", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSNameScope) };
+
+void JSNameScope::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+ JSNameScope* thisObject = jsCast<JSNameScope*>(cell);
+ ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
+ COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
+ ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
+
+ Base::visitChildren(thisObject, visitor);
+ visitor.append(&thisObject->m_registerStore);
+}
+
+JSObject* JSNameScope::toThisObject(JSCell*, ExecState* exec)
+{
+ return exec->globalThisValue();
+}
+
+void JSNameScope::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
+{
+ JSNameScope* thisObject = jsCast<JSNameScope*>(cell);
+ if (slot.isStrictMode()) {
+ // Double lookup in strict mode, but this only occurs when
+ // a) indirectly writing to an exception slot
+ // b) writing to a function expression name
+ // (a) is unlikely, and (b) is an error.
+ // Also with a single entry the symbol table lookup should simply be
+ // a pointer compare.
+ PropertySlot slot;
+ bool isWritable = true;
+ symbolTableGet(thisObject, propertyName, slot, isWritable);
+ if (!isWritable) {
+ throwError(exec, createTypeError(exec, StrictModeReadonlyPropertyWriteError));
+ return;
+ }
+ }
+ if (symbolTablePut(thisObject, exec, propertyName, value, slot.isStrictMode()))
+ return;
+
+ ASSERT_NOT_REACHED();
+}
+
+bool JSNameScope::getOwnPropertySlot(JSCell* cell, ExecState*, PropertyName propertyName, PropertySlot& slot)
+{
+ return symbolTableGet(jsCast<JSNameScope*>(cell), propertyName, slot);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSNameScope.h b/Source/JavaScriptCore/runtime/JSNameScope.h
new file mode 100644
index 0000000..752e4e1
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSNameScope.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSNameScope_h
+#define JSNameScope_h
+
+#include "JSVariableObject.h"
+
+namespace JSC {
+
+// Used for scopes with a single named variable: catch and named function expression.
+class JSNameScope : public JSVariableObject {
+public:
+ typedef JSVariableObject Base;
+
+ static JSNameScope* create(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes)
+ {
+ JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(*exec->heap())) JSNameScope(exec);
+ scopeObject->finishCreation(exec, identifier, value, attributes);
+ return scopeObject;
+ }
+
+ static void visitChildren(JSCell*, SlotVisitor&);
+ bool isDynamicScope(bool& requiresDynamicChecks) const;
+ static JSObject* toThisObject(JSCell*, ExecState*);
+ static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&);
+ static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
+
+ static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(globalData, globalObject, proto, TypeInfo(NameScopeObjectType, StructureFlags), &s_info); }
+
+ static const ClassInfo s_info;
+
+protected:
+ void finishCreation(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes)
+ {
+ Base::finishCreation(exec->globalData());
+ m_registerStore.set(exec->globalData(), this, value);
+ symbolTable()->add(identifier.impl(), SymbolTableEntry(-1, attributes));
+ }
+
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | Base::StructureFlags;
+
+private:
+ JSNameScope(ExecState* exec)
+ : Base(exec->globalData(), exec->globalData().nameScopeStructure.get(), reinterpret_cast<Register*>(&m_registerStore + 1))
+ {
+ }
+
+ WriteBarrier<Unknown> m_registerStore;
+};
+
+inline bool JSNameScope::isDynamicScope(bool&) const
+{
+ return false;
+}
+
+}
+
+#endif // JSNameScope_h
diff --git a/Source/JavaScriptCore/runtime/JSObject.h b/Source/JavaScriptCore/runtime/JSObject.h
index 0a26830..9e1445e 100644
--- a/Source/JavaScriptCore/runtime/JSObject.h
+++ b/Source/JavaScriptCore/runtime/JSObject.h
@@ -254,7 +254,7 @@
bool isGlobalObject() const;
bool isVariableObject() const;
- bool isStaticScopeObject() const;
+ bool isNameScopeObject() const;
bool isActivationObject() const;
bool isErrorInstance() const;
bool isGlobalThis() const;
@@ -471,9 +471,9 @@
return structure()->typeInfo().type() >= VariableObjectType;
}
-inline bool JSObject::isStaticScopeObject() const
+inline bool JSObject::isNameScopeObject() const
{
- return structure()->typeInfo().type() == StaticScopeObjectType;
+ return structure()->typeInfo().type() == NameScopeObjectType;
}
inline bool JSObject::isActivationObject() const
diff --git a/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp b/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp
index 611a078..e69de29 100644
--- a/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp
+++ b/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "JSStaticScopeObject.h"
-
-#include "Error.h"
-
-namespace JSC {
-ASSERT_CLASS_FITS_IN_CELL(JSStaticScopeObject);
-
-const ClassInfo JSStaticScopeObject::s_info = { "Object", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSStaticScopeObject) };
-
-void JSStaticScopeObject::visitChildren(JSCell* cell, SlotVisitor& visitor)
-{
- JSStaticScopeObject* thisObject = jsCast<JSStaticScopeObject*>(cell);
- ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
- COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
- ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
-
- JSVariableObject::visitChildren(thisObject, visitor);
- visitor.append(&thisObject->m_registerStore);
-}
-
-JSObject* JSStaticScopeObject::toThisObject(JSCell*, ExecState* exec)
-{
- return exec->globalThisValue();
-}
-
-void JSStaticScopeObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
-{
- JSStaticScopeObject* thisObject = jsCast<JSStaticScopeObject*>(cell);
- if (slot.isStrictMode()) {
- // Double lookup in strict mode, but this only occurs when
- // a) indirectly writing to an exception slot
- // b) writing to a function expression name
- // (a) is unlikely, and (b) is an error.
- // Also with a single entry the symbol table lookup should simply be
- // a pointer compare.
- PropertySlot slot;
- bool isWritable = true;
- symbolTableGet(thisObject, propertyName, slot, isWritable);
- if (!isWritable) {
- throwError(exec, createTypeError(exec, StrictModeReadonlyPropertyWriteError));
- return;
- }
- }
- if (symbolTablePut(thisObject, exec, propertyName, value, slot.isStrictMode()))
- return;
-
- ASSERT_NOT_REACHED();
-}
-
-void JSStaticScopeObject::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes)
-{
- JSStaticScopeObject* thisObject = jsCast<JSStaticScopeObject*>(object);
- if (symbolTablePutWithAttributes(thisObject, exec->globalData(), propertyName, value, attributes))
- return;
-
- ASSERT_NOT_REACHED();
-}
-
-bool JSStaticScopeObject::getOwnPropertySlot(JSCell* cell, ExecState*, PropertyName propertyName, PropertySlot& slot)
-{
- return symbolTableGet(jsCast<JSStaticScopeObject*>(cell), propertyName, slot);
-}
-
-}
diff --git a/Source/JavaScriptCore/runtime/JSStaticScopeObject.h b/Source/JavaScriptCore/runtime/JSStaticScopeObject.h
index 8118a2f..e69de29 100644
--- a/Source/JavaScriptCore/runtime/JSStaticScopeObject.h
+++ b/Source/JavaScriptCore/runtime/JSStaticScopeObject.h
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef JSStaticScopeObject_h
-#define JSStaticScopeObject_h
-
-#include "JSVariableObject.h"
-
-namespace JSC{
-
- class JSStaticScopeObject : public JSVariableObject {
- public:
- typedef JSVariableObject Base;
-
- static JSStaticScopeObject* create(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes)
- {
- JSStaticScopeObject* scopeObject = new (NotNull, allocateCell<JSStaticScopeObject>(*exec->heap())) JSStaticScopeObject(exec);
- scopeObject->finishCreation(exec, identifier, value, attributes);
- return scopeObject;
- }
-
- static void visitChildren(JSCell*, SlotVisitor&);
- bool isDynamicScope(bool& requiresDynamicChecks) const;
- static JSObject* toThisObject(JSCell*, ExecState*);
- static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&);
- static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
-
- static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes);
-
- static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(globalData, globalObject, proto, TypeInfo(StaticScopeObjectType, StructureFlags), &s_info); }
-
- static const ClassInfo s_info;
-
- protected:
- void finishCreation(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes)
- {
- Base::finishCreation(exec->globalData());
- m_registerStore.set(exec->globalData(), this, value);
- symbolTable()->add(identifier.impl(), SymbolTableEntry(-1, attributes));
- }
- static const unsigned StructureFlags = IsEnvironmentRecord | OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
-
- private:
- JSStaticScopeObject(ExecState* exec)
- : JSVariableObject(exec->globalData(), exec->globalData().staticScopeStructure.get(), reinterpret_cast<Register*>(&m_registerStore + 1))
- {
- }
-
- WriteBarrier<Unknown> m_registerStore;
- };
-
- inline bool JSStaticScopeObject::isDynamicScope(bool&) const
- {
- return false;
- }
-
-}
-
-#endif // JSStaticScopeObject_h
diff --git a/Source/JavaScriptCore/runtime/JSSymbolTableObject.cpp b/Source/JavaScriptCore/runtime/JSSymbolTableObject.cpp
index 2334a08c..72caa33 100644
--- a/Source/JavaScriptCore/runtime/JSSymbolTableObject.cpp
+++ b/Source/JavaScriptCore/runtime/JSSymbolTableObject.cpp
@@ -31,7 +31,7 @@
#include "JSActivation.h"
#include "JSGlobalObject.h"
-#include "JSStaticScopeObject.h"
+#include "JSNameScope.h"
#include "PropertyNameArray.h"
namespace JSC {
@@ -73,22 +73,4 @@
ASSERT_NOT_REACHED();
}
-bool JSSymbolTableObject::isDynamicScope(bool& requiresDynamicChecks) const
-{
- switch (structure()->typeInfo().type()) {
- case GlobalObjectType:
- return static_cast<const JSGlobalObject*>(this)->isDynamicScope(requiresDynamicChecks);
- case ActivationObjectType:
- return static_cast<const JSActivation*>(this)->isDynamicScope(requiresDynamicChecks);
- case StaticScopeObjectType:
- return static_cast<const JSStaticScopeObject*>(this)->isDynamicScope(requiresDynamicChecks);
- default:
- ASSERT_NOT_REACHED();
- break;
- }
-
- return false;
-}
-
} // namespace JSC
-
diff --git a/Source/JavaScriptCore/runtime/JSSymbolTableObject.h b/Source/JavaScriptCore/runtime/JSSymbolTableObject.h
index 1a99b19..8129b0e 100644
--- a/Source/JavaScriptCore/runtime/JSSymbolTableObject.h
+++ b/Source/JavaScriptCore/runtime/JSSymbolTableObject.h
@@ -29,15 +29,15 @@
#ifndef JSSymbolTableObject_h
#define JSSymbolTableObject_h
-#include "JSObject.h"
+#include "JSScope.h"
#include "PropertyDescriptor.h"
#include "SymbolTable.h"
namespace JSC {
-class JSSymbolTableObject : public JSNonFinalObject {
+class JSSymbolTableObject : public JSScope {
public:
- typedef JSNonFinalObject Base;
+ typedef JSScope Base;
SharedSymbolTable* symbolTable() const { return m_symbolTable.get(); }
@@ -46,10 +46,8 @@
JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName);
JS_EXPORT_PRIVATE static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
- bool isDynamicScope(bool& requiresDynamicChecks) const;
-
protected:
- static const unsigned StructureFlags = OverridesVisitChildren | OverridesGetPropertyNames | Base::StructureFlags;
+ static const unsigned StructureFlags = IsEnvironmentRecord | OverridesVisitChildren | OverridesGetPropertyNames | Base::StructureFlags;
JSSymbolTableObject(JSGlobalData& globalData, Structure* structure)
: Base(globalData, structure)
diff --git a/Source/JavaScriptCore/runtime/JSType.h b/Source/JavaScriptCore/runtime/JSType.h
index c960343..3d44dd7 100644
--- a/Source/JavaScriptCore/runtime/JSType.h
+++ b/Source/JavaScriptCore/runtime/JSType.h
@@ -50,9 +50,9 @@
ErrorInstanceType,
GlobalThisType,
- StaticScopeObjectType,
+ NameScopeObjectType,
// VariableObjectType must be less than MOST of the types of its subclasses and only its subclasses.
- // We use >=VariableObjectType checks to test for Global & Activation objects, but exclude StaticScopes.
+ // We use >=VariableObjectType checks to test for Global & Activation objects, but exclude NameScopes.
VariableObjectType,
GlobalObjectType,
ActivationObjectType,
diff --git a/Source/JavaScriptCore/runtime/Operations.h b/Source/JavaScriptCore/runtime/Operations.h
index 88fffda..24053c5 100644
--- a/Source/JavaScriptCore/runtime/Operations.h
+++ b/Source/JavaScriptCore/runtime/Operations.h
@@ -347,33 +347,6 @@
}
}
- ALWAYS_INLINE JSValue resolveBase(CallFrame* callFrame, Identifier& property, ScopeChainNode* scopeChain, bool isStrictPut)
- {
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator next = iter;
- ++next;
- ScopeChainIterator end = scopeChain->end();
- ASSERT(iter != end);
-
- PropertySlot slot;
- JSObject* base;
- while (true) {
- base = iter->get();
- if (next == end) {
- if (isStrictPut && !base->getPropertySlot(callFrame, property, slot))
- return JSValue();
- return base;
- }
- if (base->getPropertySlot(callFrame, property, slot))
- return base;
-
- iter = next;
- ++next;
- }
-
- ASSERT_NOT_REACHED();
- return JSValue();
- }
} // namespace JSC
#endif // Operations_h