Diff
Modified: trunk/Source/_javascript_Core/CMakeLists.txt (180459 => 180460)
--- trunk/Source/_javascript_Core/CMakeLists.txt 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/CMakeLists.txt 2015-02-20 22:54:31 UTC (rev 180460)
@@ -463,6 +463,7 @@
runtime/JSGlobalObjectDebuggable.cpp
runtime/JSCJSValue.cpp
runtime/JSCallee.cpp
+ runtime/JSCatchScope.cpp
runtime/JSCell.cpp
runtime/JSConsole.cpp
runtime/JSDataView.cpp
@@ -470,6 +471,7 @@
runtime/JSDateMath.cpp
runtime/JSEnvironmentRecord.cpp
runtime/JSFunction.cpp
+ runtime/JSFunctionNameScope.cpp
runtime/JSGlobalObject.cpp
runtime/JSGlobalObjectFunctions.cpp
runtime/JSLock.cpp
Modified: trunk/Source/_javascript_Core/ChangeLog (180459 => 180460)
--- trunk/Source/_javascript_Core/ChangeLog 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-02-20 22:54:31 UTC (rev 180460)
@@ -1,3 +1,57 @@
+2015-02-20 Filip Pizlo <[email protected]>
+
+ Get rid of JSNameScope::m_type
+ https://bugs.webkit.org/show_bug.cgi?id=141851
+
+ Reviewed by Geoffrey Garen.
+
+ This is a big step towards getting rid of JSEnvironmentRecord::m_registers. To do it we need
+ to ensure that subclasses of JSEnvironmentRecord never have additional C++ fields, so that
+ JSEnvironmentRecord can always place "registers" right after the end of itself.
+
+ * CMakeLists.txt:
+ * _javascript_Core.vcxproj/_javascript_Core.vcxproj:
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * debugger/DebuggerScope.cpp:
+ (JSC::DebuggerScope::isCatchScope):
+ (JSC::DebuggerScope::isFunctionNameScope):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ * jit/JITOperations.cpp:
+ * llint/LLIntSlowPaths.cpp:
+ (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+ * runtime/JSCatchScope.cpp: Added.
+ * runtime/JSCatchScope.h: Added.
+ (JSC::JSCatchScope::JSCatchScope):
+ (JSC::JSCatchScope::create):
+ (JSC::JSCatchScope::createStructure):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::addNameScopeIfNeeded):
+ * runtime/JSFunctionNameScope.cpp: Added.
+ * runtime/JSFunctionNameScope.h: Added.
+ (JSC::JSFunctionNameScope::JSFunctionNameScope):
+ (JSC::JSFunctionNameScope::create):
+ (JSC::JSFunctionNameScope::createStructure):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+ (JSC::JSGlobalObject::visitChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::catchScopeStructure):
+ (JSC::JSGlobalObject::functionNameScopeStructure):
+ (JSC::JSGlobalObject::nameScopeStructure): Deleted.
+ * runtime/JSNameScope.cpp:
+ (JSC::JSNameScope::create):
+ * runtime/JSNameScope.h:
+ (JSC::JSNameScope::create):
+ (JSC::JSNameScope::JSNameScope):
+ (JSC::JSNameScope::createStructure): Deleted.
+ (JSC::JSNameScope::isFunctionNameScope): Deleted.
+ (JSC::JSNameScope::isCatchScope): Deleted.
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::isCatchScopeObject):
+ (JSC::JSObject::isFunctionNameScopeObject):
+ * runtime/JSObject.h:
+
2015-02-20 Mark Lam <[email protected]>
[JSObjCClassInfo reallocateConstructorAndOrPrototype] should also reallocate super class prototype chain.
Modified: trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj (180459 => 180460)
--- trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj 2015-02-20 22:54:31 UTC (rev 180460)
@@ -730,12 +730,14 @@
<ClCompile Include="..\runtime\JSBoundFunction.cpp" />
<ClCompile Include="..\runtime\JSCJSValue.cpp" />
<ClCompile Include="..\runtime\JSCallee.cpp" />
+ <ClCompile Include="..\runtime\JSCatchScope.cpp" />
<ClCompile Include="..\runtime\JSCell.cpp" />
<ClCompile Include="..\runtime\JSConsole.cpp" />
<ClCompile Include="..\runtime\JSDataView.cpp" />
<ClCompile Include="..\runtime\JSDataViewPrototype.cpp" />
<ClCompile Include="..\runtime\JSDateMath.cpp" />
<ClCompile Include="..\runtime\JSFunction.cpp" />
+ <ClCompile Include="..\runtime\JSFunctionNameScope.cpp" />
<ClCompile Include="..\runtime\JSGlobalObject.cpp" />
<ClCompile Include="..\runtime\JSGlobalObjectFunctions.cpp" />
<ClCompile Include="..\runtime\JSLock.cpp" />
@@ -1505,6 +1507,7 @@
<ClInclude Include="..\runtime\JSCJSValue.h" />
<ClInclude Include="..\runtime\JSCJSValueInlines.h" />
<ClInclude Include="..\runtime\JSCallee.h" />
+ <ClInclude Include="..\runtime\JSCatchScope.h" />
<ClInclude Include="..\runtime\JSCell.h" />
<ClInclude Include="..\runtime\JSConsole.h" />
<ClInclude Include="..\runtime\JSDataView.h" />
@@ -1515,6 +1518,7 @@
<ClInclude Include="..\runtime\JSFloat32Array.h" />
<ClInclude Include="..\runtime\JSFloat64Array.h" />
<ClInclude Include="..\runtime\JSFunction.h" />
+ <ClInclude Include="..\runtime\JSFunctionNameScope.h" />
<ClInclude Include="..\runtime\JSGenericTypedArrayView.h" />
<ClInclude Include="..\runtime\JSGenericTypedArrayViewConstructor.h" />
<ClInclude Include="..\runtime\JSGenericTypedArrayViewConstructorInlines.h" />
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (180459 => 180460)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2015-02-20 22:54:31 UTC (rev 180460)
@@ -591,6 +591,10 @@
0FD8A32A17D51F5700CA2C40 /* DFGToFTLDeferredCompilationCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD8A32217D51F5700CA2C40 /* DFGToFTLDeferredCompilationCallback.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FD8A32B17D51F5700CA2C40 /* DFGToFTLForOSREntryDeferredCompilationCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FD8A32317D51F5700CA2C40 /* DFGToFTLForOSREntryDeferredCompilationCallback.cpp */; };
0FD8A32C17D51F5700CA2C40 /* DFGToFTLForOSREntryDeferredCompilationCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD8A32417D51F5700CA2C40 /* DFGToFTLForOSREntryDeferredCompilationCallback.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 0FD949821A97DB9600E28966 /* JSCatchScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FD9497E1A97DB9600E28966 /* JSCatchScope.cpp */; };
+ 0FD949831A97DB9600E28966 /* JSCatchScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD9497F1A97DB9600E28966 /* JSCatchScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 0FD949841A97DB9600E28966 /* JSFunctionNameScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FD949801A97DB9600E28966 /* JSFunctionNameScope.cpp */; };
+ 0FD949851A97DB9600E28966 /* JSFunctionNameScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD949811A97DB9600E28966 /* JSFunctionNameScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FDB2CC9173DA520007B3C1B /* FTLAbbreviatedTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDB2CC7173DA51E007B3C1B /* FTLAbbreviatedTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FDB2CCA173DA523007B3C1B /* FTLValueFromBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDB2CC8173DA51E007B3C1B /* FTLValueFromBlock.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FDB2CE7174830A2007B3C1B /* DFGWorklist.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FDB2CE5174830A2007B3C1B /* DFGWorklist.cpp */; };
@@ -2281,6 +2285,10 @@
0FD8A32217D51F5700CA2C40 /* DFGToFTLDeferredCompilationCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGToFTLDeferredCompilationCallback.h; path = dfg/DFGToFTLDeferredCompilationCallback.h; sourceTree = "<group>"; };
0FD8A32317D51F5700CA2C40 /* DFGToFTLForOSREntryDeferredCompilationCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGToFTLForOSREntryDeferredCompilationCallback.cpp; path = dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp; sourceTree = "<group>"; };
0FD8A32417D51F5700CA2C40 /* DFGToFTLForOSREntryDeferredCompilationCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGToFTLForOSREntryDeferredCompilationCallback.h; path = dfg/DFGToFTLForOSREntryDeferredCompilationCallback.h; sourceTree = "<group>"; };
+ 0FD9497E1A97DB9600E28966 /* JSCatchScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCatchScope.cpp; sourceTree = "<group>"; };
+ 0FD9497F1A97DB9600E28966 /* JSCatchScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCatchScope.h; sourceTree = "<group>"; };
+ 0FD949801A97DB9600E28966 /* JSFunctionNameScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFunctionNameScope.cpp; sourceTree = "<group>"; };
+ 0FD949811A97DB9600E28966 /* JSFunctionNameScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFunctionNameScope.h; sourceTree = "<group>"; };
0FDB2CC7173DA51E007B3C1B /* FTLAbbreviatedTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FTLAbbreviatedTypes.h; path = ftl/FTLAbbreviatedTypes.h; sourceTree = "<group>"; };
0FDB2CC8173DA51E007B3C1B /* FTLValueFromBlock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FTLValueFromBlock.h; path = ftl/FTLValueFromBlock.h; sourceTree = "<group>"; };
0FDB2CE5174830A2007B3C1B /* DFGWorklist.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGWorklist.cpp; path = dfg/DFGWorklist.cpp; sourceTree = "<group>"; };
@@ -4340,6 +4348,8 @@
86FA9E90142BBB2E001773B7 /* JSBoundFunction.h */,
657CF45619BF6662004ACBF2 /* JSCallee.cpp */,
657CF45719BF6662004ACBF2 /* JSCallee.h */,
+ 0FD9497E1A97DB9600E28966 /* JSCatchScope.cpp */,
+ 0FD9497F1A97DB9600E28966 /* JSCatchScope.h */,
BC7F8FBA0E19D1EF008632C0 /* JSCell.cpp */,
BC1167D80E19BCC9008066DD /* JSCell.h */,
0F97496F1687ADE200A4FF6A /* JSCellInlines.h */,
@@ -4364,6 +4374,8 @@
F692A85E0255597D01FF60F7 /* JSFunction.cpp */,
F692A85F0255597D01FF60F7 /* JSFunction.h */,
A72028B91797603D0098028C /* JSFunctionInlines.h */,
+ 0FD949801A97DB9600E28966 /* JSFunctionNameScope.cpp */,
+ 0FD949811A97DB9600E28966 /* JSFunctionNameScope.h */,
0F2B66C317B6B5AB00A7AE3F /* JSGenericTypedArrayView.h */,
0F2B66C417B6B5AB00A7AE3F /* JSGenericTypedArrayViewConstructor.h */,
0F2B66C517B6B5AB00A7AE3F /* JSGenericTypedArrayViewConstructorInlines.h */,
@@ -5662,6 +5674,7 @@
0FFB921C16D02F110055A5DB /* DFGOSRExitCompilationInfo.h in Headers */,
0FC0977114693AF500CF2442 /* DFGOSRExitCompiler.h in Headers */,
0F7025AA1714B0FC00382C0E /* DFGOSRExitCompilerCommon.h in Headers */,
+ 0FD949851A97DB9600E28966 /* JSFunctionNameScope.h in Headers */,
0FEFC9AB1681A3B600567F53 /* DFGOSRExitJumpPlaceholder.h in Headers */,
0F4CED5F18CEA7AB00802FE0 /* PolymorphicGetByIdList.h in Headers */,
0F235BEE17178E7300690C7F /* DFGOSRExitPreparation.h in Headers */,
@@ -6013,6 +6026,7 @@
0F2B9CE719D0BA7D00B1D1B5 /* DFGObjectAllocationSinkingPhase.h in Headers */,
A7CA3AE817DA41AE006538AF /* JSWeakMap.h in Headers */,
A7482E93116A7CAD003B0712 /* JSWeakObjectMapRefInternal.h in Headers */,
+ 0FD949831A97DB9600E28966 /* JSCatchScope.h in Headers */,
A7482B9311671147003B0712 /* JSWeakObjectMapRefPrivate.h in Headers */,
1442566215EDE98D0066A49B /* JSWithScope.h in Headers */,
86E3C619167BABEE006D760A /* JSWrapperMap.h in Headers */,
@@ -7108,6 +7122,7 @@
1440FCE40A51E46B0005F061 /* JSClassRef.cpp in Sources */,
86E3C616167BABEE006D760A /* JSContext.mm in Sources */,
14BD5A300A3E91F600BAF59C /* JSContextRef.cpp in Sources */,
+ 0FD949821A97DB9600E28966 /* JSCatchScope.cpp in Sources */,
A72028B61797601E0098028C /* JSCTestRunnerUtils.cpp in Sources */,
0F2B66EB17B6B5AB00A7AE3F /* JSDataView.cpp in Sources */,
0F2B66ED17B6B5AB00A7AE3F /* JSDataViewPrototype.cpp in Sources */,
@@ -7185,6 +7200,7 @@
0F4680D214BBD16500BFE272 /* LLIntData.cpp in Sources */,
0F38B01117CF078000B144D3 /* LLIntEntrypoint.cpp in Sources */,
0F4680A814BA7FAB00BFE272 /* LLIntExceptions.cpp in Sources */,
+ 0FD949841A97DB9600E28966 /* JSFunctionNameScope.cpp in Sources */,
0F4680A414BA7F8D00BFE272 /* LLIntSlowPaths.cpp in Sources */,
0F0B839C14BCF46300885B4F /* LLIntThunks.cpp in Sources */,
0FCEFACD1805E75500472CE4 /* LLVMAPI.cpp in Sources */,
Modified: trunk/Source/_javascript_Core/debugger/DebuggerScope.cpp (180459 => 180460)
--- trunk/Source/_javascript_Core/debugger/DebuggerScope.cpp 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/debugger/DebuggerScope.cpp 2015-02-20 22:54:31 UTC (rev 180460)
@@ -157,12 +157,12 @@
bool DebuggerScope::isCatchScope() const
{
- return m_scope->isNameScopeObject() && reinterpret_cast<JSNameScope*>(m_scope.get())->isCatchScope();
+ return m_scope->isCatchScopeObject();
}
bool DebuggerScope::isFunctionNameScope() const
{
- return m_scope->isNameScopeObject() && reinterpret_cast<JSNameScope*>(m_scope.get())->isFunctionNameScope();
+ return m_scope->isFunctionNameScopeObject();
}
bool DebuggerScope::isWithScope() const
Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (180459 => 180460)
--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2015-02-20 22:54:31 UTC (rev 180460)
@@ -1089,7 +1089,8 @@
} else {
for (JSScope* node = scope; ; node = node->next()) {
RELEASE_ASSERT(node);
- if (node->isVariableObject() && !node->isNameScopeObject()) {
+ if (node->isVariableObject()) {
+ ASSERT(!node->isNameScopeObject());
variableObject = node;
break;
}
Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (180459 => 180460)
--- trunk/Source/_javascript_Core/jit/JITOperations.cpp 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp 2015-02-20 22:54:31 UTC (rev 180460)
@@ -1278,7 +1278,7 @@
// This should be changed to pass in the new scope.
JSScope* currentScope = exec->uncheckedR(dst).Register::scope();
JSNameScope::Type scopeType = static_cast<JSNameScope::Type>(type);
- JSNameScope* scope = JSNameScope::create(exec, currentScope, *identifier, JSValue::decode(encodedValue), attibutes, scopeType);
+ JSNameScope* scope = JSNameScope::create(vm, exec->lexicalGlobalObject(), currentScope, *identifier, JSValue::decode(encodedValue), attibutes, scopeType);
// FIXME: This won't work if this operation is called from the DFG or FTL.
// This should be changed to return the new scope.
Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (180459 => 180460)
--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2015-02-20 22:54:31 UTC (rev 180460)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011, 2012, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-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
@@ -1290,7 +1290,7 @@
int scopeReg = pc[1].u.operand;
JSScope* currentScope = exec->uncheckedR(scopeReg).Register::scope();
JSNameScope::Type type = static_cast<JSNameScope::Type>(pc[5].u.operand);
- JSNameScope* scope = JSNameScope::create(exec, currentScope, codeBlock->identifier(pc[2].u.operand), LLINT_OP(3).jsValue(), pc[4].u.operand, type);
+ JSNameScope* scope = JSNameScope::create(vm, exec->lexicalGlobalObject(), currentScope, codeBlock->identifier(pc[2].u.operand), LLINT_OP(3).jsValue(), pc[4].u.operand, type);
exec->uncheckedR(scopeReg) = scope;
LLINT_END();
}
Added: trunk/Source/_javascript_Core/runtime/JSCatchScope.cpp (0 => 180460)
--- trunk/Source/_javascript_Core/runtime/JSCatchScope.cpp (rev 0)
+++ trunk/Source/_javascript_Core/runtime/JSCatchScope.cpp 2015-02-20 22:54:31 UTC (rev 180460)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 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
+ * 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 "JSCatchScope.h"
+
+#include "JSCInlines.h"
+
+namespace JSC {
+
+const ClassInfo JSCatchScope::s_info = { "CatchScope", &Base::s_info, 0, CREATE_METHOD_TABLE(JSCatchScope) };
+
+} // namespace JSC
+
Added: trunk/Source/_javascript_Core/runtime/JSCatchScope.h (0 => 180460)
--- trunk/Source/_javascript_Core/runtime/JSCatchScope.h (rev 0)
+++ trunk/Source/_javascript_Core/runtime/JSCatchScope.h 2015-02-20 22:54:31 UTC (rev 180460)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 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
+ * 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 JSCatchScope_h
+#define JSCatchScope_h
+
+#include "JSNameScope.h"
+
+namespace JSC {
+
+class JSCatchScope : public JSNameScope {
+public:
+ typedef JSNameScope Base;
+
+private:
+ friend class JSNameScope;
+
+ JSCatchScope(VM& vm, JSGlobalObject* globalObject, JSScope* next)
+ : Base(vm, globalObject->catchScopeStructure(), next)
+ {
+ }
+
+public:
+ static JSCatchScope* create(VM& vm, JSGlobalObject* globalObject, JSScope* currentScope, const Identifier& identifier, JSValue value, unsigned attributes)
+ {
+ return Base::create<JSCatchScope>(vm, globalObject, currentScope, identifier, value, attributes);
+ }
+
+ static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
+ {
+ return Structure::create(vm, globalObject, proto, TypeInfo(NameScopeObjectType, StructureFlags), info());
+ }
+
+ DECLARE_INFO;
+};
+
+} // namespace JSC
+
+#endif // JSCatchScope_h
+
Modified: trunk/Source/_javascript_Core/runtime/JSFunction.cpp (180459 => 180460)
--- trunk/Source/_javascript_Core/runtime/JSFunction.cpp 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/runtime/JSFunction.cpp 2015-02-20 22:54:31 UTC (rev 180460)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 1999-2002 Harri Porten ([email protected])
* Copyright (C) 2001 Peter Kelly ([email protected])
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2015 Apple Inc. All rights reserved.
* Copyright (C) 2007 Cameron Zwarich ([email protected])
* Copyright (C) 2007 Maks Orlovich
*
@@ -35,8 +35,8 @@
#include "JSArray.h"
#include "JSBoundFunction.h"
#include "JSFunctionInlines.h"
+#include "JSFunctionNameScope.h"
#include "JSGlobalObject.h"
-#include "JSNameScope.h"
#include "JSNotAnObject.h"
#include "Interpreter.h"
#include "ObjectConstructor.h"
@@ -116,7 +116,7 @@
return;
if (!functionNameScopeIsDynamic(executable->usesEval(), executable->isStrictMode()))
return;
- setScope(vm, JSNameScope::create(vm, scope()->globalObject(), executable->name(), this, ReadOnly | DontDelete, scope(), JSNameScope::FunctionNameScope));
+ setScope(vm, JSFunctionNameScope::create(vm, scope()->globalObject(), scope(), executable->name(), this, ReadOnly | DontDelete));
}
JSFunction* JSFunction::createBuiltinFunction(VM& vm, FunctionExecutable* executable, JSGlobalObject* globalObject)
Added: trunk/Source/_javascript_Core/runtime/JSFunctionNameScope.cpp (0 => 180460)
--- trunk/Source/_javascript_Core/runtime/JSFunctionNameScope.cpp (rev 0)
+++ trunk/Source/_javascript_Core/runtime/JSFunctionNameScope.cpp 2015-02-20 22:54:31 UTC (rev 180460)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 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
+ * 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 "JSFunctionNameScope.h"
+
+#include "JSCInlines.h"
+
+namespace JSC {
+
+const ClassInfo JSFunctionNameScope::s_info = { "FunctionNameScope", &Base::s_info, 0, CREATE_METHOD_TABLE(JSFunctionNameScope) };
+
+} // namespace JSC
+
Added: trunk/Source/_javascript_Core/runtime/JSFunctionNameScope.h (0 => 180460)
--- trunk/Source/_javascript_Core/runtime/JSFunctionNameScope.h (rev 0)
+++ trunk/Source/_javascript_Core/runtime/JSFunctionNameScope.h 2015-02-20 22:54:31 UTC (rev 180460)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 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
+ * 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 JSFunctionNameScope_h
+#define JSFunctionNameScope_h
+
+#include "JSNameScope.h"
+
+namespace JSC {
+
+class JSFunctionNameScope : public JSNameScope {
+public:
+ typedef JSNameScope Base;
+
+private:
+ friend class JSNameScope;
+
+ JSFunctionNameScope(VM& vm, JSGlobalObject* globalObject, JSScope* next)
+ : Base(vm, globalObject->catchScopeStructure(), next)
+ {
+ }
+
+public:
+ static JSFunctionNameScope* create(VM& vm, JSGlobalObject* globalObject, JSScope* currentScope, const Identifier& identifier, JSValue value, unsigned attributes)
+ {
+ return Base::create<JSFunctionNameScope>(vm, globalObject, currentScope, identifier, value, attributes);
+ }
+
+ static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
+ {
+ return Structure::create(vm, globalObject, proto, TypeInfo(NameScopeObjectType, StructureFlags), info());
+ }
+
+ DECLARE_INFO;
+};
+
+} // namespace JSC
+
+#endif // JSFunctionNameScope_h
+
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (180459 => 180460)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2015-02-20 22:54:31 UTC (rev 180460)
@@ -65,10 +65,12 @@
#include "JSCallbackConstructor.h"
#include "JSCallbackFunction.h"
#include "JSCallbackObject.h"
+#include "JSCatchScope.h"
#include "JSConsole.h"
#include "JSDataView.h"
#include "JSDataViewPrototype.h"
#include "JSFunction.h"
+#include "JSFunctionNameScope.h"
#include "JSGenericTypedArrayViewConstructorInlines.h"
#include "JSGenericTypedArrayViewInlines.h"
#include "JSGenericTypedArrayViewPrototypeInlines.h"
@@ -77,7 +79,6 @@
#include "JSLock.h"
#include "JSMap.h"
#include "JSMapIterator.h"
-#include "JSNameScope.h"
#include "JSONObject.h"
#include "JSSet.h"
#include "JSSetIterator.h"
@@ -265,7 +266,8 @@
m_typedArrays[toIndex(TypeFloat64)].structure.set(vm, this, JSFloat64Array::createStructure(vm, this, m_typedArrays[toIndex(TypeFloat64)].prototype.get()));
m_typedArrays[toIndex(TypeDataView)].structure.set(vm, this, JSDataView::createStructure(vm, this, m_typedArrays[toIndex(TypeDataView)].prototype.get()));
- m_nameScopeStructure.set(vm, this, JSNameScope::createStructure(vm, this, jsNull()));
+ m_catchScopeStructure.set(vm, this, JSCatchScope::createStructure(vm, this, jsNull()));
+ m_functionNameScopeStructure.set(vm, this, JSFunctionNameScope::createStructure(vm, this, jsNull()));
m_lexicalEnvironmentStructure.set(vm, this, JSLexicalEnvironment::createStructure(vm, this));
m_strictEvalActivationStructure.set(vm, this, StrictEvalActivation::createStructure(vm, this, jsNull()));
m_debuggerScopeStructure.set(m_vm, this, DebuggerScope::createStructure(m_vm, this));
@@ -676,7 +678,8 @@
visitor.append(&thisObject->m_withScopeStructure);
visitor.append(&thisObject->m_strictEvalActivationStructure);
visitor.append(&thisObject->m_lexicalEnvironmentStructure);
- visitor.append(&thisObject->m_nameScopeStructure);
+ visitor.append(&thisObject->m_catchScopeStructure);
+ visitor.append(&thisObject->m_functionNameScopeStructure);
visitor.append(&thisObject->m_argumentsStructure);
for (unsigned i = 0; i < NumberOfIndexingShapes; ++i)
visitor.append(&thisObject->m_originalArrayStructureForIndexingShape[i]);
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (180459 => 180460)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2015-02-20 22:54:31 UTC (rev 180460)
@@ -197,7 +197,8 @@
WriteBarrier<Structure> m_withScopeStructure;
WriteBarrier<Structure> m_strictEvalActivationStructure;
WriteBarrier<Structure> m_lexicalEnvironmentStructure;
- WriteBarrier<Structure> m_nameScopeStructure;
+ WriteBarrier<Structure> m_catchScopeStructure;
+ WriteBarrier<Structure> m_functionNameScopeStructure;
WriteBarrier<Structure> m_argumentsStructure;
// Lists the actual structures used for having these particular indexing shapes.
@@ -408,7 +409,8 @@
Structure* withScopeStructure() const { return m_withScopeStructure.get(); }
Structure* strictEvalActivationStructure() const { return m_strictEvalActivationStructure.get(); }
Structure* activationStructure() const { return m_lexicalEnvironmentStructure.get(); }
- Structure* nameScopeStructure() const { return m_nameScopeStructure.get(); }
+ Structure* catchScopeStructure() const { return m_catchScopeStructure.get(); }
+ Structure* functionNameScopeStructure() const { return m_functionNameScopeStructure.get(); }
Structure* argumentsStructure() const { return m_argumentsStructure.get(); }
Structure* originalArrayStructureForIndexingType(IndexingType indexingType) const
{
Modified: trunk/Source/_javascript_Core/runtime/JSNameScope.cpp (180459 => 180460)
--- trunk/Source/_javascript_Core/runtime/JSNameScope.cpp 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/runtime/JSNameScope.cpp 2015-02-20 22:54:31 UTC (rev 180460)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2009, 2012 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2009, 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
@@ -28,11 +28,24 @@
#include "Error.h"
#include "JSCInlines.h"
+#include "JSCatchScope.h"
+#include "JSFunctionNameScope.h"
namespace JSC {
const ClassInfo JSNameScope::s_info = { "NameScope", &Base::s_info, 0, CREATE_METHOD_TABLE(JSNameScope) };
+JSNameScope* JSNameScope::create(VM& vm, JSGlobalObject* globalObject, JSScope* currentScope, const Identifier& identifier, JSValue value, unsigned attributes, Type type)
+{
+ switch (type) {
+ case CatchScope:
+ return JSCatchScope::create(vm, globalObject, currentScope, identifier, value, attributes);
+ case FunctionNameScope:
+ return JSFunctionNameScope::create(vm, globalObject, currentScope, identifier, value, attributes);
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+}
+
void JSNameScope::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
JSNameScope* thisObject = jsCast<JSNameScope*>(cell);
Modified: trunk/Source/_javascript_Core/runtime/JSNameScope.h (180459 => 180460)
--- trunk/Source/_javascript_Core/runtime/JSNameScope.h 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/runtime/JSNameScope.h 2015-02-20 22:54:31 UTC (rev 180460)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2009, 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
@@ -41,33 +41,23 @@
FunctionNameScope
};
- static JSNameScope* create(ExecState* exec, JSScope* currentScope, const Identifier& identifier, JSValue value, unsigned attributes, Type type)
+ template<typename T>
+ static T* create(VM& vm, JSGlobalObject* globalObject, JSScope* currentScope, const Identifier& identifier, JSValue value, unsigned attributes)
{
- VM& vm = exec->vm();
- JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(vm, exec->lexicalGlobalObject(), currentScope, type);
+ T* scopeObject = new (NotNull, allocateCell<T>(vm.heap)) T(vm, globalObject, currentScope);
scopeObject->finishCreation(vm, identifier, value, attributes);
return scopeObject;
}
+
+ static JSNameScope* create(VM&, JSGlobalObject*, JSScope* currentScope, const Identifier&, JSValue, unsigned attributes, Type);
- static JSNameScope* create(VM& vm, JSGlobalObject* globalObject, const Identifier& identifier, JSValue value, unsigned attributes, JSScope* next, Type type)
- {
- JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(vm, globalObject, next, type);
- scopeObject->finishCreation(vm, identifier, value, attributes);
- return scopeObject;
- }
-
static void visitChildren(JSCell*, SlotVisitor&);
static JSValue toThis(JSCell*, ExecState*, ECMAMode);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
- static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(vm, globalObject, proto, TypeInfo(NameScopeObjectType, StructureFlags), info()); }
-
DECLARE_INFO;
- bool isFunctionNameScope() const { return m_type == FunctionNameScope; }
- bool isCatchScope() const { return m_type == CatchScope; }
-
JSValue value() const { return m_registerStore.get(); }
protected:
@@ -80,20 +70,18 @@
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | Base::StructureFlags;
-private:
- JSNameScope(VM& vm, JSGlobalObject* globalObject, JSScope* next, Type type)
+ JSNameScope(VM& vm, Structure* structure, JSScope* next)
: Base(
vm,
- globalObject->nameScopeStructure(),
+ structure,
reinterpret_cast<Register*>(&m_registerStore + 1),
next
)
- , m_type(type)
{
}
+private:
WriteBarrier<Unknown> m_registerStore;
- Type m_type;
};
}
Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (180459 => 180460)
--- trunk/Source/_javascript_Core/runtime/JSObject.cpp 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp 2015-02-20 22:54:31 UTC (rev 180460)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 1999-2001 Harri Porten ([email protected])
* Copyright (C) 2001 Peter Kelly ([email protected])
- * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2012, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2003-2006, 2008, 2009, 2012-2015 Apple Inc. All rights reserved.
* Copyright (C) 2007 Eric Seidel ([email protected])
*
* This library is free software; you can redistribute it and/or
@@ -34,7 +34,9 @@
#include "Executable.h"
#include "GetterSetter.h"
#include "IndexingHeaderInlines.h"
+#include "JSCatchScope.h"
#include "JSFunction.h"
+#include "JSFunctionNameScope.h"
#include "JSGlobalObject.h"
#include "Lookup.h"
#include "NativeErrorConstructor.h"
@@ -1620,6 +1622,16 @@
return jsCast<JSObject*>(cell);
}
+bool JSObject::isCatchScopeObject() const
+{
+ return inherits(JSCatchScope::info());
+}
+
+bool JSObject::isFunctionNameScopeObject() const
+{
+ return inherits(JSFunctionNameScope::info());
+}
+
void JSObject::seal(VM& vm)
{
if (isSealed(vm))
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (180459 => 180460)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2015-02-20 22:46:07 UTC (rev 180459)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2015-02-20 22:54:31 UTC (rev 180460)
@@ -593,6 +593,8 @@
bool isVariableObject() const;
bool isStaticScopeObject() const;
bool isNameScopeObject() const;
+ bool isCatchScopeObject() const;
+ bool isFunctionNameScopeObject() const;
bool isActivationObject() const;
bool isErrorInstance() const;
bool isWithScope() const;
@@ -1131,7 +1133,6 @@
return type == NameScopeObjectType || type == ActivationObjectType;
}
-
inline bool JSObject::isNameScopeObject() const
{
return type() == NameScopeObjectType;