summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore')
-rw-r--r--JavaScriptCore/API/JSBase.h2
-rw-r--r--JavaScriptCore/API/JSCallbackConstructor.cpp2
-rw-r--r--JavaScriptCore/API/JSCallbackConstructor.h4
-rw-r--r--JavaScriptCore/API/JSCallbackFunction.cpp1
-rw-r--r--JavaScriptCore/API/JSCallbackFunction.h2
-rw-r--r--JavaScriptCore/API/JSCallbackObject.h4
-rw-r--r--JavaScriptCore/API/JSCallbackObjectFunctions.h6
-rw-r--r--JavaScriptCore/API/JSObjectRef.cpp1
-rw-r--r--JavaScriptCore/API/JSStringRef.h2
-rw-r--r--JavaScriptCore/ChangeLog5073
-rw-r--r--JavaScriptCore/Configurations/FeatureDefines.xcconfig12
-rw-r--r--JavaScriptCore/Configurations/Version.xcconfig2
-rw-r--r--JavaScriptCore/GNUmakefile.am26
-rw-r--r--JavaScriptCore/JavaScriptCore.exp87
-rw-r--r--JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp205
-rw-r--r--JavaScriptCore/JavaScriptCore.gypi4
-rw-r--r--JavaScriptCore/JavaScriptCore.pri34
-rw-r--r--JavaScriptCore/JavaScriptCore.pro1
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def96
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc6
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj34
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops2
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops2
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj106
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def96
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops52
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj61
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops2
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/testapi/testapi.vcproj145
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops4
-rw-r--r--JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj52
-rw-r--r--JavaScriptCore/JavaScriptCoreSources.bkl1
-rw-r--r--JavaScriptCore/assembler/ARMAssembler.cpp65
-rw-r--r--JavaScriptCore/assembler/ARMAssembler.h156
-rw-r--r--JavaScriptCore/assembler/ARMv7Assembler.h119
-rw-r--r--JavaScriptCore/assembler/AbstractMacroAssembler.h10
-rw-r--r--JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h25
-rw-r--r--JavaScriptCore/assembler/MacroAssembler.h4
-rw-r--r--JavaScriptCore/assembler/MacroAssemblerARM.cpp94
-rw-r--r--JavaScriptCore/assembler/MacroAssemblerARM.h287
-rw-r--r--JavaScriptCore/assembler/MacroAssemblerARMv7.h29
-rw-r--r--JavaScriptCore/assembler/MacroAssemblerCodeRef.h6
-rw-r--r--JavaScriptCore/assembler/MacroAssemblerX86Common.h37
-rw-r--r--JavaScriptCore/assembler/MacroAssemblerX86_64.h58
-rw-r--r--JavaScriptCore/assembler/X86Assembler.h29
-rw-r--r--JavaScriptCore/bytecode/CodeBlock.cpp134
-rw-r--r--JavaScriptCore/bytecode/CodeBlock.h118
-rw-r--r--JavaScriptCore/bytecode/EvalCodeCache.h36
-rw-r--r--JavaScriptCore/bytecode/SamplingTool.cpp30
-rw-r--r--JavaScriptCore/bytecode/SamplingTool.h22
-rw-r--r--JavaScriptCore/bytecompiler/BytecodeGenerator.cpp70
-rw-r--r--JavaScriptCore/bytecompiler/BytecodeGenerator.h30
-rw-r--r--JavaScriptCore/debugger/Debugger.cpp65
-rw-r--r--JavaScriptCore/debugger/Debugger.h28
-rw-r--r--JavaScriptCore/debugger/DebuggerActivation.cpp10
-rw-r--r--JavaScriptCore/debugger/DebuggerActivation.h8
-rw-r--r--JavaScriptCore/debugger/DebuggerCallFrame.cpp16
-rw-r--r--JavaScriptCore/interpreter/CachedCall.h5
-rw-r--r--JavaScriptCore/interpreter/CallFrame.h4
-rw-r--r--JavaScriptCore/interpreter/CallFrameClosure.h2
-rw-r--r--JavaScriptCore/interpreter/Interpreter.cpp214
-rw-r--r--JavaScriptCore/interpreter/Interpreter.h26
-rw-r--r--JavaScriptCore/interpreter/Register.h8
-rw-r--r--JavaScriptCore/interpreter/RegisterFile.cpp5
-rw-r--r--JavaScriptCore/interpreter/RegisterFile.h12
-rw-r--r--JavaScriptCore/jit/ExecutableAllocator.h41
-rw-r--r--JavaScriptCore/jit/ExecutableAllocatorPosix.cpp5
-rw-r--r--JavaScriptCore/jit/ExecutableAllocatorWin.cpp5
-rw-r--r--JavaScriptCore/jit/JIT.cpp13
-rw-r--r--JavaScriptCore/jit/JIT.h225
-rw-r--r--JavaScriptCore/jit/JITArithmetic.cpp319
-rw-r--r--JavaScriptCore/jit/JITCall.cpp137
-rw-r--r--JavaScriptCore/jit/JITInlineMethods.h135
-rw-r--r--JavaScriptCore/jit/JITOpcodes.cpp328
-rw-r--r--JavaScriptCore/jit/JITPropertyAccess.cpp151
-rw-r--r--JavaScriptCore/jit/JITStubs.cpp159
-rw-r--r--JavaScriptCore/jit/JITStubs.h13
-rw-r--r--JavaScriptCore/jsc.cpp62
-rw-r--r--JavaScriptCore/os-win32/stdbool.h4
-rw-r--r--JavaScriptCore/os-win32/stdint.h7
-rw-r--r--JavaScriptCore/parser/Grammar.y491
-rw-r--r--JavaScriptCore/parser/Lexer.cpp112
-rw-r--r--JavaScriptCore/parser/Lexer.h16
-rw-r--r--JavaScriptCore/parser/NodeConstructors.h58
-rw-r--r--JavaScriptCore/parser/Nodes.cpp362
-rw-r--r--JavaScriptCore/parser/Nodes.h366
-rw-r--r--JavaScriptCore/parser/Parser.cpp29
-rw-r--r--JavaScriptCore/parser/Parser.h57
-rw-r--r--JavaScriptCore/parser/ParserArena.cpp72
-rw-r--r--JavaScriptCore/parser/ParserArena.h82
-rw-r--r--JavaScriptCore/parser/SourceCode.h3
-rwxr-xr-xJavaScriptCore/pcre/dftables2
-rw-r--r--JavaScriptCore/profiler/ProfileGenerator.cpp1
-rw-r--r--JavaScriptCore/profiler/Profiler.cpp24
-rw-r--r--JavaScriptCore/runtime/ArgList.h7
-rw-r--r--JavaScriptCore/runtime/Arguments.cpp25
-rw-r--r--JavaScriptCore/runtime/Arguments.h22
-rw-r--r--JavaScriptCore/runtime/ArrayConstructor.cpp14
-rw-r--r--JavaScriptCore/runtime/ArrayConstructor.h2
-rw-r--r--JavaScriptCore/runtime/ArrayPrototype.cpp72
-rw-r--r--JavaScriptCore/runtime/ArrayPrototype.h3
-rw-r--r--JavaScriptCore/runtime/BatchedTransitionOptimizer.h2
-rw-r--r--JavaScriptCore/runtime/BooleanConstructor.cpp2
-rw-r--r--JavaScriptCore/runtime/BooleanConstructor.h2
-rw-r--r--JavaScriptCore/runtime/BooleanObject.cpp2
-rw-r--r--JavaScriptCore/runtime/BooleanObject.h7
-rw-r--r--JavaScriptCore/runtime/BooleanPrototype.cpp6
-rw-r--r--JavaScriptCore/runtime/BooleanPrototype.h2
-rw-r--r--JavaScriptCore/runtime/CallData.h4
-rw-r--r--JavaScriptCore/runtime/Collector.cpp275
-rw-r--r--JavaScriptCore/runtime/Collector.h14
-rw-r--r--JavaScriptCore/runtime/CommonIdentifiers.h12
-rw-r--r--JavaScriptCore/runtime/Completion.cpp25
-rw-r--r--JavaScriptCore/runtime/ConstructData.h4
-rw-r--r--JavaScriptCore/runtime/DateConstructor.cpp4
-rw-r--r--JavaScriptCore/runtime/DateConstructor.h2
-rw-r--r--JavaScriptCore/runtime/DateInstance.cpp11
-rw-r--r--JavaScriptCore/runtime/DateInstance.h5
-rw-r--r--JavaScriptCore/runtime/DatePrototype.cpp84
-rw-r--r--JavaScriptCore/runtime/DatePrototype.h5
-rw-r--r--JavaScriptCore/runtime/Error.cpp6
-rw-r--r--JavaScriptCore/runtime/Error.h1
-rw-r--r--JavaScriptCore/runtime/ErrorConstructor.cpp2
-rw-r--r--JavaScriptCore/runtime/ErrorConstructor.h2
-rw-r--r--JavaScriptCore/runtime/ErrorInstance.cpp2
-rw-r--r--JavaScriptCore/runtime/ErrorInstance.h2
-rw-r--r--JavaScriptCore/runtime/ErrorPrototype.cpp2
-rw-r--r--JavaScriptCore/runtime/ErrorPrototype.h2
-rw-r--r--JavaScriptCore/runtime/ExceptionHelpers.cpp15
-rw-r--r--JavaScriptCore/runtime/ExceptionHelpers.h1
-rw-r--r--JavaScriptCore/runtime/Executable.cpp280
-rw-r--r--JavaScriptCore/runtime/Executable.h356
-rw-r--r--JavaScriptCore/runtime/FunctionConstructor.cpp38
-rw-r--r--JavaScriptCore/runtime/FunctionConstructor.h6
-rw-r--r--JavaScriptCore/runtime/FunctionPrototype.cpp15
-rw-r--r--JavaScriptCore/runtime/FunctionPrototype.h4
-rw-r--r--JavaScriptCore/runtime/GetterSetter.cpp42
-rw-r--r--JavaScriptCore/runtime/GetterSetter.h7
-rw-r--r--JavaScriptCore/runtime/GlobalEvalFunction.cpp2
-rw-r--r--JavaScriptCore/runtime/GlobalEvalFunction.h7
-rw-r--r--JavaScriptCore/runtime/Identifier.h2
-rw-r--r--JavaScriptCore/runtime/InternalFunction.cpp2
-rw-r--r--JavaScriptCore/runtime/InternalFunction.h6
-rw-r--r--JavaScriptCore/runtime/JSAPIValueWrapper.cpp36
-rw-r--r--JavaScriptCore/runtime/JSAPIValueWrapper.h7
-rw-r--r--JavaScriptCore/runtime/JSActivation.cpp14
-rw-r--r--JavaScriptCore/runtime/JSActivation.h17
-rw-r--r--JavaScriptCore/runtime/JSArray.cpp203
-rw-r--r--JavaScriptCore/runtime/JSArray.h128
-rw-r--r--JavaScriptCore/runtime/JSByteArray.cpp21
-rw-r--r--JavaScriptCore/runtime/JSByteArray.h5
-rw-r--r--JavaScriptCore/runtime/JSCell.cpp38
-rw-r--r--JavaScriptCore/runtime/JSCell.h134
-rw-r--r--JavaScriptCore/runtime/JSFunction.cpp75
-rw-r--r--JavaScriptCore/runtime/JSFunction.h57
-rw-r--r--JavaScriptCore/runtime/JSGlobalData.cpp26
-rw-r--r--JavaScriptCore/runtime/JSGlobalData.h15
-rw-r--r--JavaScriptCore/runtime/JSGlobalObject.cpp27
-rw-r--r--JavaScriptCore/runtime/JSGlobalObject.h77
-rw-r--r--JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp14
-rw-r--r--JavaScriptCore/runtime/JSNotAnObject.cpp8
-rw-r--r--JavaScriptCore/runtime/JSNotAnObject.h3
-rw-r--r--JavaScriptCore/runtime/JSNumberCell.cpp4
-rw-r--r--JavaScriptCore/runtime/JSNumberCell.h2
-rw-r--r--JavaScriptCore/runtime/JSONObject.cpp180
-rw-r--r--JavaScriptCore/runtime/JSONObject.h5
-rw-r--r--JavaScriptCore/runtime/JSObject.cpp202
-rw-r--r--JavaScriptCore/runtime/JSObject.h104
-rw-r--r--JavaScriptCore/runtime/JSPropertyNameIterator.cpp36
-rw-r--r--JavaScriptCore/runtime/JSPropertyNameIterator.h7
-rw-r--r--JavaScriptCore/runtime/JSString.cpp27
-rw-r--r--JavaScriptCore/runtime/JSString.h25
-rw-r--r--JavaScriptCore/runtime/JSType.h1
-rw-r--r--JavaScriptCore/runtime/JSTypeInfo.h (renamed from JavaScriptCore/runtime/TypeInfo.h)14
-rw-r--r--JavaScriptCore/runtime/JSValue.cpp5
-rw-r--r--JavaScriptCore/runtime/JSValue.h32
-rw-r--r--JavaScriptCore/runtime/JSVariableObject.cpp15
-rw-r--r--JavaScriptCore/runtime/JSVariableObject.h10
-rw-r--r--JavaScriptCore/runtime/JSWrapperObject.h22
-rw-r--r--JavaScriptCore/runtime/LiteralParser.cpp3
-rw-r--r--JavaScriptCore/runtime/LiteralParser.h2
-rw-r--r--JavaScriptCore/runtime/Lookup.h60
-rw-r--r--JavaScriptCore/runtime/MarkStack.cpp3
-rw-r--r--JavaScriptCore/runtime/MarkStack.h46
-rw-r--r--JavaScriptCore/runtime/MarkStackSymbian.cpp44
-rw-r--r--JavaScriptCore/runtime/MarkStackWin.cpp6
-rw-r--r--JavaScriptCore/runtime/MathObject.cpp14
-rw-r--r--JavaScriptCore/runtime/MathObject.h5
-rw-r--r--JavaScriptCore/runtime/NativeErrorConstructor.cpp2
-rw-r--r--JavaScriptCore/runtime/NativeErrorConstructor.h2
-rw-r--r--JavaScriptCore/runtime/NativeErrorPrototype.cpp2
-rw-r--r--JavaScriptCore/runtime/NativeErrorPrototype.h2
-rw-r--r--JavaScriptCore/runtime/NumberConstructor.cpp7
-rw-r--r--JavaScriptCore/runtime/NumberConstructor.h5
-rw-r--r--JavaScriptCore/runtime/NumberObject.cpp2
-rw-r--r--JavaScriptCore/runtime/NumberObject.h14
-rw-r--r--JavaScriptCore/runtime/NumberPrototype.cpp2
-rw-r--r--JavaScriptCore/runtime/NumberPrototype.h2
-rw-r--r--JavaScriptCore/runtime/NumericStrings.h74
-rw-r--r--JavaScriptCore/runtime/ObjectConstructor.cpp223
-rw-r--r--JavaScriptCore/runtime/ObjectConstructor.h2
-rw-r--r--JavaScriptCore/runtime/ObjectPrototype.cpp21
-rw-r--r--JavaScriptCore/runtime/ObjectPrototype.h8
-rw-r--r--JavaScriptCore/runtime/Operations.h13
-rw-r--r--JavaScriptCore/runtime/PropertyDescriptor.cpp195
-rw-r--r--JavaScriptCore/runtime/PropertyDescriptor.h80
-rw-r--r--JavaScriptCore/runtime/PropertyMapHashTable.h1
-rw-r--r--JavaScriptCore/runtime/PropertyNameArray.h2
-rw-r--r--JavaScriptCore/runtime/PropertySlot.cpp3
-rw-r--r--JavaScriptCore/runtime/PrototypeFunction.cpp2
-rw-r--r--JavaScriptCore/runtime/PrototypeFunction.h2
-rw-r--r--JavaScriptCore/runtime/RegExpConstructor.cpp10
-rw-r--r--JavaScriptCore/runtime/RegExpConstructor.h5
-rw-r--r--JavaScriptCore/runtime/RegExpMatchesArray.h11
-rw-r--r--JavaScriptCore/runtime/RegExpObject.cpp7
-rw-r--r--JavaScriptCore/runtime/RegExpObject.h7
-rw-r--r--JavaScriptCore/runtime/RegExpPrototype.cpp15
-rw-r--r--JavaScriptCore/runtime/RegExpPrototype.h2
-rw-r--r--JavaScriptCore/runtime/ScopeChain.cpp6
-rw-r--r--JavaScriptCore/runtime/ScopeChain.h17
-rw-r--r--JavaScriptCore/runtime/SmallStrings.cpp10
-rw-r--r--JavaScriptCore/runtime/SmallStrings.h6
-rw-r--r--JavaScriptCore/runtime/StringConstructor.cpp2
-rw-r--r--JavaScriptCore/runtime/StringConstructor.h2
-rw-r--r--JavaScriptCore/runtime/StringObject.cpp32
-rw-r--r--JavaScriptCore/runtime/StringObject.h14
-rw-r--r--JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h4
-rw-r--r--JavaScriptCore/runtime/StringPrototype.cpp27
-rw-r--r--JavaScriptCore/runtime/StringPrototype.h3
-rw-r--r--JavaScriptCore/runtime/Structure.cpp181
-rw-r--r--JavaScriptCore/runtime/Structure.h112
-rw-r--r--JavaScriptCore/runtime/StructureChain.cpp5
-rw-r--r--JavaScriptCore/runtime/StructureTransitionTable.h159
-rw-r--r--JavaScriptCore/runtime/SymbolTable.h4
-rw-r--r--JavaScriptCore/runtime/TimeoutChecker.cpp25
-rw-r--r--JavaScriptCore/runtime/UString.cpp107
-rw-r--r--JavaScriptCore/runtime/UString.h6
-rw-r--r--JavaScriptCore/wrec/WRECGenerator.cpp12
-rw-r--r--JavaScriptCore/wrec/WRECGenerator.h28
-rw-r--r--JavaScriptCore/wscript21
-rw-r--r--JavaScriptCore/wtf/Assertions.cpp4
-rw-r--r--JavaScriptCore/wtf/Assertions.h32
-rw-r--r--JavaScriptCore/wtf/ByteArray.h13
-rw-r--r--JavaScriptCore/wtf/CrossThreadRefCounted.h14
-rw-r--r--JavaScriptCore/wtf/DateMath.cpp2
-rw-r--r--JavaScriptCore/wtf/DisallowCType.h32
-rw-r--r--JavaScriptCore/wtf/FastAllocBase.h12
-rw-r--r--JavaScriptCore/wtf/FastMalloc.cpp44
-rw-r--r--JavaScriptCore/wtf/FastMalloc.h47
-rw-r--r--JavaScriptCore/wtf/Forward.h5
-rw-r--r--JavaScriptCore/wtf/HashCountedSet.h38
-rw-r--r--JavaScriptCore/wtf/HashSet.h18
-rw-r--r--JavaScriptCore/wtf/ListRefPtr.h23
-rw-r--r--JavaScriptCore/wtf/PassRefPtr.h81
-rw-r--r--JavaScriptCore/wtf/Platform.h255
-rw-r--r--JavaScriptCore/wtf/PossiblyNull.h59
-rw-r--r--JavaScriptCore/wtf/PtrAndFlags.h21
-rw-r--r--JavaScriptCore/wtf/RandomNumber.cpp17
-rw-r--r--JavaScriptCore/wtf/RefPtr.h27
-rw-r--r--JavaScriptCore/wtf/SegmentedVector.h3
-rw-r--r--JavaScriptCore/wtf/StringExtras.h16
-rw-r--r--JavaScriptCore/wtf/TCSpinLock.h7
-rw-r--r--JavaScriptCore/wtf/ThreadSpecific.h20
-rw-r--r--JavaScriptCore/wtf/Threading.h17
-rw-r--r--JavaScriptCore/wtf/ThreadingPthreads.cpp5
-rw-r--r--JavaScriptCore/wtf/Vector.h28
-rw-r--r--JavaScriptCore/wtf/VectorTraits.h8
-rw-r--r--JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp1
-rw-r--r--JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h2
-rw-r--r--JavaScriptCore/yarr/RegexInterpreter.cpp226
-rw-r--r--JavaScriptCore/yarr/RegexInterpreter.h4
-rw-r--r--JavaScriptCore/yarr/RegexJIT.cpp102
272 files changed, 12851 insertions, 4200 deletions
diff --git a/JavaScriptCore/API/JSBase.h b/JavaScriptCore/API/JSBase.h
index 9f3d88e..d1ce9b3 100644
--- a/JavaScriptCore/API/JSBase.h
+++ b/JavaScriptCore/API/JSBase.h
@@ -67,7 +67,7 @@ typedef struct OpaqueJSValue* JSObjectRef;
#undef JS_EXPORT
#if defined(BUILDING_WX__)
#define JS_EXPORT
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) && !defined(__CC_ARM) && !defined(__ARMCC__)
#define JS_EXPORT __attribute__((visibility("default")))
#elif defined(_WIN32_WCE)
#if defined(JS_BUILDING_JS)
diff --git a/JavaScriptCore/API/JSCallbackConstructor.cpp b/JavaScriptCore/API/JSCallbackConstructor.cpp
index 64c83cb..1c33962 100644
--- a/JavaScriptCore/API/JSCallbackConstructor.cpp
+++ b/JavaScriptCore/API/JSCallbackConstructor.cpp
@@ -36,7 +36,7 @@ namespace JSC {
const ClassInfo JSCallbackConstructor::info = { "CallbackConstructor", 0, 0, 0 };
-JSCallbackConstructor::JSCallbackConstructor(PassRefPtr<Structure> structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
+JSCallbackConstructor::JSCallbackConstructor(NonNullPassRefPtr<Structure> structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
: JSObject(structure)
, m_class(jsClass)
, m_callback(callback)
diff --git a/JavaScriptCore/API/JSCallbackConstructor.h b/JavaScriptCore/API/JSCallbackConstructor.h
index 1f06249..202b119 100644
--- a/JavaScriptCore/API/JSCallbackConstructor.h
+++ b/JavaScriptCore/API/JSCallbackConstructor.h
@@ -33,7 +33,7 @@ namespace JSC {
class JSCallbackConstructor : public JSObject {
public:
- JSCallbackConstructor(PassRefPtr<Structure>, JSClassRef, JSObjectCallAsConstructorCallback);
+ JSCallbackConstructor(NonNullPassRefPtr<Structure>, JSClassRef, JSObjectCallAsConstructorCallback);
virtual ~JSCallbackConstructor();
JSClassRef classRef() const { return m_class; }
JSObjectCallAsConstructorCallback callback() const { return m_callback; }
@@ -41,7 +41,7 @@ public:
static PassRefPtr<Structure> createStructure(JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot));
+ return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot | HasDefaultMark | HasDefaultGetPropertyNames));
}
private:
diff --git a/JavaScriptCore/API/JSCallbackFunction.cpp b/JavaScriptCore/API/JSCallbackFunction.cpp
index 1b3217b..b7dd768 100644
--- a/JavaScriptCore/API/JSCallbackFunction.cpp
+++ b/JavaScriptCore/API/JSCallbackFunction.cpp
@@ -28,6 +28,7 @@
#include "JSCallbackFunction.h"
#include "APICast.h"
+#include "CodeBlock.h"
#include "JSFunction.h"
#include "FunctionPrototype.h"
#include <runtime/JSGlobalObject.h>
diff --git a/JavaScriptCore/API/JSCallbackFunction.h b/JavaScriptCore/API/JSCallbackFunction.h
index 7dd87b5..3a17fa2 100644
--- a/JavaScriptCore/API/JSCallbackFunction.h
+++ b/JavaScriptCore/API/JSCallbackFunction.h
@@ -41,7 +41,7 @@ public:
// refactor the code so this override isn't necessary
static PassRefPtr<Structure> createStructure(JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot));
+ return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark));
}
private:
diff --git a/JavaScriptCore/API/JSCallbackObject.h b/JavaScriptCore/API/JSCallbackObject.h
index 9d22ad9..86f2f32 100644
--- a/JavaScriptCore/API/JSCallbackObject.h
+++ b/JavaScriptCore/API/JSCallbackObject.h
@@ -36,7 +36,7 @@ namespace JSC {
template <class Base>
class JSCallbackObject : public Base {
public:
- JSCallbackObject(ExecState*, PassRefPtr<Structure>, JSClassRef, void* data);
+ JSCallbackObject(ExecState*, NonNullPassRefPtr<Structure>, JSClassRef, void* data);
JSCallbackObject(JSClassRef);
virtual ~JSCallbackObject();
@@ -66,7 +66,7 @@ private:
virtual bool hasInstance(ExecState* exec, JSValue value, JSValue proto);
- virtual void getPropertyNames(ExecState*, PropertyNameArray&);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&);
virtual double toNumber(ExecState*) const;
virtual UString toString(ExecState*) const;
diff --git a/JavaScriptCore/API/JSCallbackObjectFunctions.h b/JavaScriptCore/API/JSCallbackObjectFunctions.h
index 1abed3f..9b726e8 100644
--- a/JavaScriptCore/API/JSCallbackObjectFunctions.h
+++ b/JavaScriptCore/API/JSCallbackObjectFunctions.h
@@ -47,7 +47,7 @@ inline JSCallbackObject<Base>* JSCallbackObject<Base>::asCallbackObject(JSValue
}
template <class Base>
-JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, PassRefPtr<Structure> structure, JSClassRef jsClass, void* data)
+JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, NonNullPassRefPtr<Structure> structure, JSClassRef jsClass, void* data)
: Base(structure)
, m_callbackObjectData(new JSCallbackObjectData(data, jsClass))
{
@@ -373,7 +373,7 @@ JSValue JSCallbackObject<Base>::call(ExecState* exec, JSObject* functionObject,
}
template <class Base>
-void JSCallbackObject<Base>::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
+void JSCallbackObject<Base>::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
{
JSContextRef execRef = toRef(exec);
JSObjectRef thisRef = toRef(this);
@@ -407,7 +407,7 @@ void JSCallbackObject<Base>::getPropertyNames(ExecState* exec, PropertyNameArray
}
}
- Base::getPropertyNames(exec, propertyNames);
+ Base::getOwnPropertyNames(exec, propertyNames);
}
template <class Base>
diff --git a/JavaScriptCore/API/JSObjectRef.cpp b/JavaScriptCore/API/JSObjectRef.cpp
index 87d36ec..06ef578 100644
--- a/JavaScriptCore/API/JSObjectRef.cpp
+++ b/JavaScriptCore/API/JSObjectRef.cpp
@@ -28,6 +28,7 @@
#include "JSObjectRef.h"
#include "APICast.h"
+#include "CodeBlock.h"
#include "DateConstructor.h"
#include "ErrorConstructor.h"
#include "FunctionConstructor.h"
diff --git a/JavaScriptCore/API/JSStringRef.h b/JavaScriptCore/API/JSStringRef.h
index 8b17ee2..c58b958 100644
--- a/JavaScriptCore/API/JSStringRef.h
+++ b/JavaScriptCore/API/JSStringRef.h
@@ -37,7 +37,7 @@
extern "C" {
#endif
-#if !defined(WIN32) && !defined(_WIN32)
+#if !defined(WIN32) && !defined(_WIN32) && !defined(__WINSCW__)
/*!
@typedef JSChar
@abstract A Unicode character.
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 1afea5f..7cf56bd 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,5058 @@
+2009-10-08 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix for JIT'ed op_call instructions (evals, constructs, etc.)
+ when !ENABLE(JIT_OPTIMIZE_CALL) && USE(JSVALUE32_64)
+
+ https://bugs.webkit.org/show_bug.cgi?id=30201
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+
+2009-10-07 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: removed no longer exported symbol.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-10-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed <rdar://problem/5751979> Database code takes JSLock on secondary
+ thread, permanently slowing down JavaScript
+
+ Removed the optional lock from Heap::protect, Heap::unprotect, and friends,
+ since WebCore no longer uses it.
+
+ * JavaScriptCore.exp:
+ * runtime/Collector.cpp:
+ (JSC::Heap::protect):
+ (JSC::Heap::unprotect):
+ (JSC::Heap::markProtectedObjects):
+ (JSC::Heap::protectedGlobalObjectCount):
+ (JSC::Heap::protectedObjectCount):
+ (JSC::Heap::protectedObjectTypeCounts):
+ * runtime/Collector.h:
+
+2009-10-07 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for JavaScriptCore's IdentifierArena
+ https://bugs.webkit.org/show_bug.cgi?id=30158
+
+ Inherits IdentifierArena class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/parser/ParserArena.cpp:36.
+
+ * parser/ParserArena.h:
+
+2009-10-07 Adam Roben <aroben@apple.com>
+
+ Export DateInstance::info in a way that works on Windows
+
+ Fixes <http://webkit.org/b/30171>
+ fast/dom/Window/window-postmessage-clone.html fails on Windows
+
+ Reviewed by Anders Carlsson.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ Removed the export of DateInstance::info from here.
+
+ * runtime/DateInstance.h: Use JS_EXPORTDATA to export
+ DateInstance::info, which is the required way of exporting data on
+ Windows.
+
+2009-10-07 Jørgen Lind <jorgen.lind@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ When enabling or disabling the JIT through .qmake.cache, make sure
+ to also toggle ENABLE_YARR_JIT.
+
+ * JavaScriptCore.pri:
+
+2009-10-06 Priit Laes <plaes@plaes.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Linking fails with "relocation R_X86_64_PC32 against symbol
+ `cti_vm_throw'"
+ https://bugs.webkit.org/show_bug.cgi?id=28422
+
+ * jit/JITStubs.cpp:
+ Mark cti_vm_throw symbol as PLT-indirect symbol, so it doesn't end up
+ in text segment causing relocation errors on amd64 architecture.
+ Introduced new define SYMBOL_STRING_RELOCATION for such symbols.
+
+2009-10-06 Oliver Hunt <oliver@apple.com>
+
+ Windows linking fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-10-06 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Windows build fix.
+
+ * runtime/DateInstance.cpp:
+
+2009-10-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ It should be possible to post (clone) built-in JS objects to Workers
+ https://bugs.webkit.org/show_bug.cgi?id=22878
+
+ Expose helpers to throw correct exceptions during object graph walk
+ used for cloning and add a helper function to create Date instances
+ without going through the JS Date constructor function.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DateInstance.h:
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createTypeError):
+ * runtime/ExceptionHelpers.h:
+
+2009-10-06 David Levin <levin@chromium.org>
+
+ Reviewed by Oliver Hunt.
+
+ StringImpl needs a method to get an instance for another thread which doesn't copy the underlying buffer.
+ https://bugs.webkit.org/show_bug.cgi?id=30095
+
+ * wtf/CrossThreadRefCounted.h:
+ Removed an unused function and assert improvement.
+ (WTF::CrossThreadRefCounted::isOwnedByCurrentThread): Moved out common code from asserts.
+ (WTF::CrossThreadRefCounted::ref): Changed assert to use the common method.
+ (WTF::CrossThreadRefCounted::deref): Changed assert to use the common method.
+ (WTF::CrossThreadRefCounted::crossThreadCopy): Since this includes a potentially
+ non-threadsafe operation, add an assert that the class is owned by the current thread.
+
+2009-10-05 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix. Add Symbian files to the list of excludes.
+
+ * wscript:
+
+2009-10-05 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Remove precompiled header from JavaScriptCore compilation to
+ prevent qmake warning during autonomous compilation.
+ https://bugs.webkit.org/show_bug.cgi?id=30069
+
+ * JavaScriptCore.pro:
+
+2009-10-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed the concept of a "fast access cutoff" in arrays, because it
+ punished some patterns of array access too much, and made things too
+ complex for inlining in some cases.
+
+ 1.3% speedup on SunSpider.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emitSlow_op_put_by_val):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::emitSlow_op_put_by_val):
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+ (JSC::): Check m_vectorLength instead of m_fastAccessCutoff when
+ getting / putting from / to an array. Inline putting past the end of
+ the array.
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::getOwnPropertyNames):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::push):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::fillArgList):
+ (JSC::JSArray::copyToRegisters):
+ (JSC::JSArray::compactForSorting):
+ (JSC::JSArray::checkConsistency):
+ * runtime/JSArray.h:
+ (JSC::JSArray::canGetIndex):
+ (JSC::JSArray::canSetIndex):
+ (JSC::JSArray::setIndex):
+ (JSC::JSArray::markChildrenDirect): Removed m_fastAccessCutoff, and
+ replaced with checks for JSValue() to detect reads and writes from / to
+ uninitialized parts of the array.
+
+2009-10-02 Jonni Rainisto <jonni.rainisto@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Math.random() gives too low values on Win32 when _CRT_RAND_S is not defined
+ https://bugs.webkit.org/show_bug.cgi?id=29956
+
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber): Added PLATFORM(WIN_OS) to handle 15bit rand()
+
+2009-10-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Take one branch instead of two to test for JSValue().
+
+ 1.1% SunSpider speedup.
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_to_jsnumber):
+ (JSC::JIT::emit_op_create_arguments):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val): Test for the empty value tag, instead
+ of testing for the cell tag with a 0 payload.
+
+ * runtime/JSValue.cpp:
+ (JSC::JSValue::description): Added support for dumping the new empty value,
+ and deleted values, in debug builds.
+
+ * runtime/JSValue.h:
+ (JSC::JSValue::JSValue()): Construct JSValue() with the empty value tag.
+
+ (JSC::JSValue::JSValue(JSCell*)): Convert null pointer to the empty value
+ tag, to avoid having two different c++ versions of null / empty.
+
+ (JSC::JSValue::operator bool): Test for the empty value tag, instead
+ of testing for the cell tag with a 0 payload.
+
+2009-10-02 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=29989>
+ Safari version number shouldn't be exposed in WebKit code
+
+ For a WebKit version of 532.3.4:
+ Product version is: 5.32.3.4 (was 4.0.3.0)
+ File version is: 5.32.3.4 (was 4.532.3.4)
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc:
+
+2009-10-02 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Rubber-stamped by Simon Hausmann.
+
+ Fix the Qt on Mac OS X build.
+
+ * wtf/FastMalloc.cpp:
+
+2009-10-02 Jørgen Lind <jorgen.lind@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Allow enabling and disabling of the JIT through a qmake variable.
+
+ Qt's configure may set this variable through .qmake.cache if a
+ commandline option is given and/or the compile test for hwcap.h
+ failed/succeeded.
+
+ * JavaScriptCore.pri:
+
+2009-10-01 Mark Rowe <mrowe@apple.com>
+
+ Fix the Tiger build. Don't unconditionally enable 3D canvas as it is not supported on Tiger.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-10-01 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29187
+
+ Don't inline ~ListRefPtr() to work around winscw compiler forward declaration
+ bug regarding templated classes.
+
+ The compiler bug is reported at:
+ https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812
+
+ The change will be reverted when the above bug is fixed in winscw compiler.
+
+ * wtf/ListRefPtr.h:
+ (WTF::::~ListRefPtr):
+
+2009-10-01 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Allow custom memory allocation control for the whole JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=27029
+
+ Since in JavaScriptCore almost every class which has been instantiated by operator new is
+ inherited from FastAllocBase (bug #20422), we disable customizing global operator new for the Qt-port
+ when USE_SYSTEM_MALLOC=0.
+
+ Add #include <unistd.h> to FastMalloc.cpp because it's used by TCMalloc_PageHeap::scavengerThread().
+ (It's needed for the functionality of TCmalloc.)
+
+ Add TCSystemAlloc.cpp to JavaScriptCore.pri if USE_SYSTEM_MALLOC is disabled.
+
+ * JavaScriptCore.pri:
+ * wtf/FastMalloc.cpp:
+ (WTF::sleep):
+ * wtf/FastMalloc.h:
+
+2009-09-30 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by George Staikos.
+
+ Defines two pseudo-platforms for ARM and Thumb-2 instruction set.
+ https://bugs.webkit.org/show_bug.cgi?id=29122
+
+ Introduces WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2
+ macros on ARM platforms. The PLATFORM(ARM_THUMB2) should be used
+ when Thumb-2 instruction set is the required target. The
+ PLATFORM(ARM_TRADITIONAL) is for generic ARM instruction set. In
+ case where the code is common the PLATFORM(ARM) have to be used.
+
+ Modified by George Wright <gwright@rim.com> to correctly work
+ with the RVCT-defined __TARGET_ARCH_ARM and __TARGET_ARCH_THUMB
+ compiler macros, as well as adding readability changes.
+
+ * wtf/Platform.h:
+
+2009-09-30 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Devirtualise array toString conversion
+
+ Tweak the implementation of Array.prototype.toString to have a fast path
+ when acting on a true JSArray.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+
+2009-09-30 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Geoffrey Garen.
+
+ Buildfix for platforms using JSVALUE32.
+ https://bugs.webkit.org/show_bug.cgi?id=29915
+
+ After http://trac.webkit.org/changeset/48905 the build broke in JSVALUE32 case.
+ Also removed unreachable code.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_add):
+ - Declaration of "OperandTypes types" moved before first use.
+ - Typos fixed: dst modified to result, regT2 added.
+ - Unreachable code removed.
+ (JSC::JIT::emitSlow_op_add):
+ - Missing declaration of "OperandTypes types" added.
+
+2009-09-30 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Reduce heap size on Symbian from 64MB to 8MB.
+
+ This is not a perfect fix, it requires more fine tuning.
+ But this makes it possible again to debug in the emulator,
+ which is more important in order to be able to fix other
+ run-time issues.
+
+ * runtime/Collector.h:
+
+2009-09-30 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix CRASH() macro for Symbian build.
+
+ * wtf/Assertions.h: Added missing }
+
+2009-09-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Inlined a few math operations.
+
+ ~1% SunSpider speedup.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ (JSC::JIT::emitSlow_op_add):
+ (JSC::JIT::emitSlow_op_mul):
+ (JSC::JIT::emit_op_sub):
+ (JSC::JIT::emitSlow_op_sub): Don't take a stub call when operating on
+ a constant int and a double.
+
+2009-09-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Tidy up codeblock sampler
+ https://bugs.webkit.org/show_bug.cgi?id=29836
+
+ Some rather simple refactoring of codeblock sampler so that
+ it's easier for us to use it to find problems in non-jsc
+ environments
+
+ * JavaScriptCore.exp:
+ * bytecode/SamplingTool.h:
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::Interpreter):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::enableSampler):
+ (JSC::Interpreter::dumpSampleData):
+ (JSC::Interpreter::startSampling):
+ (JSC::Interpreter::stopSampling):
+ * interpreter/Interpreter.h:
+ (JSC::Interpreter::sampler):
+ * jit/JIT.h:
+ * jsc.cpp:
+ (runWithScripts):
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::evaluate):
+ * runtime/Executable.h:
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::ProgramExecutable::create):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::startSampling):
+ (JSC::JSGlobalData::stopSampling):
+ (JSC::JSGlobalData::dumpSampleData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+
+2009-09-29 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add GYP generated files to svn:ignore
+ https://bugs.webkit.org/show_bug.cgi?id=29895
+
+ The following files are generated by JavaScriptCore's GYP file and should be ignored:
+
+ pcre.mk
+ wtf.scons
+ wtf.mk
+ SConstruct
+ wtf_config.scons
+ wtf_config.mk
+ pcre.scons
+
+ * JavaScriptCore.gyp: Changed property svn:ignore.
+
+2009-09-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Standardized an optimization for adding non-numbers.
+
+ SunSpider says maybe a tiny speedup.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_add):
+ (JSC::JIT::emitSlow_op_add):
+
+2009-09-29 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: export a new symbol.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed virtual destructor from JSGlobalObjectData to eliminate pointer
+ fix-ups when accessing JSGlobalObject::d.
+
+ Replaced with an explicit destructor function pointer.
+
+ 6% speedup on bench-alloc-nonretained.js.
+
+ * JavaScriptCore.exp:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::~JSGlobalObject):
+ (JSC::JSGlobalObject::destroyJSGlobalObjectData):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (JSC::JSGlobalObject::JSGlobalObject):
+
+2009-09-29 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by David Kilzer.
+
+ [Qt] Assert messages prints visible in Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=29808
+
+ Asserts use vprintf to print the messages to stderr.
+ In Symbian Open C it is not possible to see stderr so
+ I routed the messages to stdout instead.
+
+ * wtf/Assertions.cpp:
+
+2009-09-29 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Darin Adler.
+
+ [Qt] Symbian CRASH macro implementation
+
+ Added Symbian specific crash macro that
+ stops to crash line if JIT debugging is used.
+ Additional differentiation of access violation
+ (KERN-EXEC 3) and CRASH panic.
+
+ * wtf/Assertions.h:
+
+2009-09-28 Mark Rowe <mrowe@apple.com>
+
+ Fix the PowerPC build.
+
+ * JavaScriptCore.exp:
+
+2009-09-28 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://problem/7195704> JavaScriptCore fails to mark registers when built for x86_64 using LLVM GCC.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::markCurrentThreadConservatively): Force jmp_buf to use the appropriate alignment for a pointer
+ to ensure that we correctly interpret the contents of registers during marking.
+
+2009-09-28 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: added new exports.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-28 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: removed exports that no longer exist.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ NotNullPassRefPtr: smart pointer optimized for passing references that are not null
+ https://bugs.webkit.org/show_bug.cgi?id=29822
+
+ Added NotNullPassRefPtr, and deployed it in all places that initialize
+ JavaScript objects.
+
+ 2.2% speedup on bench-allocate-nonretained.js.
+
+ * API/JSCallbackConstructor.cpp:
+ (JSC::JSCallbackConstructor::JSCallbackConstructor):
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::JSCallbackObject::JSCallbackObject):
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::addFunctionDecl):
+ (JSC::CodeBlock::addFunctionExpr):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ * runtime/ArrayConstructor.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::ArrayPrototype::ArrayPrototype):
+ * runtime/ArrayPrototype.h:
+ * runtime/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ * runtime/BooleanConstructor.h:
+ * runtime/BooleanObject.cpp:
+ (JSC::BooleanObject::BooleanObject):
+ * runtime/BooleanObject.h:
+ * runtime/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * runtime/BooleanPrototype.h:
+ * runtime/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * runtime/DateConstructor.h:
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DateInstance.h:
+ * runtime/DatePrototype.cpp:
+ (JSC::DatePrototype::DatePrototype):
+ * runtime/DatePrototype.h:
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * runtime/ErrorConstructor.h:
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ * runtime/ErrorInstance.h:
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/ErrorPrototype.h:
+ * runtime/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * runtime/FunctionConstructor.h:
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ * runtime/FunctionPrototype.h:
+ * runtime/GlobalEvalFunction.cpp:
+ (JSC::GlobalEvalFunction::GlobalEvalFunction):
+ * runtime/GlobalEvalFunction.h:
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/InternalFunction.h:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::JSActivation):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::JSActivationData::JSActivationData):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ * runtime/JSArray.h:
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSByteArray.h:
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObject):
+ * runtime/JSONObject.h:
+ (JSC::JSONObject::JSONObject):
+ * runtime/JSObject.h:
+ (JSC::JSObject::JSObject):
+ (JSC::JSObject::setStructure):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::JSVariableObject):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::JSWrapperObject):
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * runtime/MathObject.h:
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * runtime/NativeErrorPrototype.h:
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ * runtime/NumberConstructor.h:
+ * runtime/NumberObject.cpp:
+ (JSC::NumberObject::NumberObject):
+ * runtime/NumberObject.h:
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/NumberPrototype.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ * runtime/ObjectConstructor.h:
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * runtime/ObjectPrototype.h:
+ * runtime/PropertyNameArray.h:
+ (JSC::PropertyNameArrayData::setCachedPrototypeChain):
+ * runtime/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * runtime/PrototypeFunction.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ * runtime/RegExpConstructor.h:
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::RegExpObject):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::RegExpObjectData::RegExpObjectData):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::RegExpPrototype::RegExpPrototype):
+ * runtime/RegExpPrototype.h:
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * runtime/StringConstructor.h:
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::StringObject):
+ * runtime/StringObject.h:
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/StringPrototype.h:
+ * wtf/PassRefPtr.h:
+ (WTF::NotNullPassRefPtr::NotNullPassRefPtr):
+ (WTF::NotNullPassRefPtr::~NotNullPassRefPtr):
+ (WTF::NotNullPassRefPtr::get):
+ (WTF::NotNullPassRefPtr::clear):
+ (WTF::NotNullPassRefPtr::releaseRef):
+ (WTF::NotNullPassRefPtr::operator*):
+ (WTF::NotNullPassRefPtr::operator->):
+ (WTF::NotNullPassRefPtr::operator!):
+ (WTF::NotNullPassRefPtr::operator UnspecifiedBoolType):
+ * wtf/RefPtr.h:
+ (WTF::RefPtr::RefPtr):
+ (WTF::operator==):
+
+2009-09-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Hard dependency on SSE2 instruction set with JIT
+ https://bugs.webkit.org/show_bug.cgi?id=29779
+
+ Add floating point support checks to op_jfalse and op_jtrue, and
+ fix the logic for the slow case of op_add
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_add):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jfalse):
+ (JSC::JIT::emit_op_jtrue):
+
+2009-09-28 Yaar Schnitman <yaar@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Chromium port - recognize we are being built independently
+ of chromium and look for dependencies under webkit/chromium rather
+ than chromium/src.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29722
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+
+2009-09-28 Jakub Wieczorek <faw217@gmail.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Implement XSLT support with QtXmlPatterns.
+ https://bugs.webkit.org/show_bug.cgi?id=28303
+
+ * wtf/Platform.h: Add a WTF_USE_QXMLQUERY #define.
+
+2009-09-28 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ Remove __clear_cache which is an internal function of GCC
+ https://bugs.webkit.org/show_bug.cgi?id=28886
+
+ Although __clear_cache is exported from GCC, this is an internal
+ function. GCC makes no promises about it.
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2009-09-28 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Fix an absolute path to somewhere in Oliver's machine to a relative path
+ for derived JSONObject.lut.h.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-09-28 Joerg Bornemann <joerg.bornemann@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Add ARM version detection for Windows CE.
+
+ * wtf/Platform.h:
+
+2009-09-26 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Add MarkStackSymbian.cpp to build JavascriptCore for Symbian.
+
+ Re-use Windows shrinkAllocation implementation because Symbian doesn't
+ support releasing part of memory region.
+
+ Use fastMalloc and fastFree to implement allocateStack and releaseStack
+ for Symbian port.
+
+ * JavaScriptCore.pri:
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::MarkStackArray::shrinkAllocation):
+ * runtime/MarkStackSymbian.cpp: Added.
+ (JSC::MarkStack::initializePagesize):
+ (JSC::MarkStack::allocateStack):
+ (JSC::MarkStack::releaseStack):
+
+2009-09-25 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix unaligned data access in YARR_JIT on ARMv5 and below.
+ https://bugs.webkit.org/show_bug.cgi?id=29695
+
+ On ARMv5 and below all data access should be naturally aligned.
+ In the YARR_JIT there is a case when character pairs are
+ loaded from the input string, but this data access is not
+ naturally aligned. This fix introduces load32WithUnalignedHalfWords
+ and branch32WithUnalignedHalfWords functions which contain
+ naturally aligned memory loads - half word loads - on ARMv5 and below.
+
+ * assembler/MacroAssemblerARM.cpp:
+ (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerARM::branch32WithUnalignedHalfWords):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::load32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerARMv7::branch32):
+ (JSC::MacroAssemblerARMv7::branch32WithUnalignedHalfWords):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::load32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerX86Common::branch32WithUnalignedHalfWords):
+ * wtf/Platform.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterPair):
+
+2009-09-25 Jeremy Orlow <jorlow@chromium.org>
+
+ This is breaking Chromium try bots, so I'm counting this as a build fix.
+
+ Add more svn:ignore exceptions. On different platforms, these files are
+ generated with different case for JavaScriptCore. Also there are some
+ wtf project files that get built apparently.
+
+ * JavaScriptCore.gyp: Changed property svn:ignore.
+
+2009-09-25 Ada Chan <adachan@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Inlined some object creation code, including lexicalGlobalObject access
+ https://bugs.webkit.org/show_bug.cgi?id=29750
+
+ SunSpider says 0.5% faster.
+
+ 0.8% speedup on bench-alloc-nonretained.js.
+ 2.5% speedup on v8-splay.js.
+
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::CachedCall):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::lexicalGlobalObject):
+ (JSC::ExecState::globalThisValue):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::dumpRegisters):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/ScopeChain.cpp:
+ (JSC::ScopeChainNode::print):
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::ScopeChainNode):
+ (JSC::ScopeChainNode::~ScopeChainNode):
+ (JSC::ScopeChainNode::push):
+ (JSC::ScopeChain::ScopeChain):
+ (JSC::ScopeChain::globalObject): Added a globalObject data member to ScopeChainNode.
+ Replaced accessor function for globalObject() with data member. Replaced
+ globalThisObject() accessor with direct access to globalThis, to match.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+ * runtime/JSGlobalObject.h: Inlined array and object construction.
+
+2009-09-25 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Add ARM version detection rules for Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=29715
+
+ * wtf/Platform.h:
+
+2009-09-24 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Mark "Do It!" Rowe.
+
+ Some GCC versions don't like C++-style comments in preprocessor
+ directives, change to C-style to shut them up.
+
+ * wtf/Platform.h:
+
+2009-09-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Division is needlessly slow in 64-bit
+ https://bugs.webkit.org/show_bug.cgi?id=29723
+
+ Add codegen for op_div on x86-64
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ (JSC::JIT::emit_op_div):
+ (JSC::JIT::emitSlow_op_div):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::isOperandConstantImmediateDouble):
+ (JSC::JIT::addressFor):
+ (JSC::JIT::emitLoadDouble):
+ (JSC::JIT::emitLoadInt32ToDouble):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmediateNumber):
+
+2009-09-24 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add GYP generated files to svn:ignore
+ https://bugs.webkit.org/show_bug.cgi?id=29724
+
+ Adding the following files to the svn:ignore list (all in the
+ JavaScriptCore/JavaScriptCore.gyp directory)
+
+ JavaScriptCore.xcodeproj
+ JavaScriptCore.sln
+ JavaScriptCore.vcproj
+ JavaScriptCore_Debug.rules
+ JavaScriptCore_Release.rules
+ JavaScriptCore_Release - no tcmalloc.rules
+ JavaScriptCore_Purify.rules
+ JavaScriptCore.mk
+ JavaScriptCore_Debug_rules.mk
+ JavaScriptCore_Release_rules.mk
+ JavaScriptCore_Release - no tcmalloc_rules.mk
+ JavaScriptCore_Purify_rules.mk
+ JavaScriptCore.scons
+ JavaScriptCore_main.scons
+
+ * JavaScriptCore.gyp: Changed property svn:ignore.
+
+2009-09-24 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by Adam Barth.
+
+ Replace platform-dependent code with WTF::currentTime()
+ https://bugs.webkit.org/show_bug.cgi?id=29148
+
+ * jsc.cpp:
+ (StopWatch::start):
+ (StopWatch::stop):
+ (StopWatch::getElapsedMS):
+ * runtime/TimeoutChecker.cpp:
+ (JSC::getCPUTime):
+
+2009-09-24 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/7215058> FastMalloc scavenging thread should be named
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::scavengerThread): Set the thread name.
+ * wtf/Platform.h: Move the knowledge of whether pthread_setname_np exists to here as HAVE(PTHREAD_SETNAME_NP).
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::setThreadNameInternal): Use HAVE(PTHREAD_SETNAME_NP).
+
+2009-09-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renamed clear to removeAll, as suggested by Darin Adler.
+
+ * wtf/HashCountedSet.h:
+ (WTF::::removeAll):
+
+2009-09-24 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix FastMalloc to build with assertions enabled.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_Central_FreeList::ReleaseToSpans):
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SpinLock::IsHeld):
+
+2009-09-24 Geoffrey Garen <ggaren@apple.com>
+
+ Suggested by Darin Adler.
+
+ Removed some unnecessary parameter names.
+
+ * wtf/HashCountedSet.h:
+
+2009-09-24 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ On Windows JSChar is typedef'ed to wchar_t.
+
+ When building with WINSCW for Symbian we need to do the
+ same typedef.
+
+ * API/JSStringRef.h:
+
+2009-09-23 Geoffrey Garen <ggaren@apple.com>
+
+ A piece of my last patch that I forgot.
+
+ * wtf/HashCountedSet.h:
+ (WTF::::clear): Added HashCountedSet::clear.
+
+2009-09-24 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Avoid __clear_cache built-in function if DISABLE_BUILTIN_CLEAR_CACHE define is set
+ https://bugs.webkit.org/show_bug.cgi?id=28886
+
+ There are some GCC packages (for example GCC-2006q3 from CodeSourcery)
+ which contain __clear_cache built-in function only for C while the C++
+ version of __clear_cache is missing on ARM architectures.
+
+ Fixed a small bug in the inline assembly of cacheFlush function on
+ ARM_TRADITIONAL.
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2009-09-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added the ability to swap vectors with inline capacities, so you can
+ store a vector with inline capacity in a hash table.
+
+ * wtf/Vector.h:
+ (WTF::swap):
+ (WTF::VectorBuffer::swap):
+
+2009-09-23 David Kilzer <ddkilzer@apple.com>
+
+ Move definition of USE(PLUGIN_HOST_PROCESS) from WebKitPrefix.h to Platform.h
+
+ Reviewed by Mark Rowe.
+
+ * wtf/Platform.h: Define WTF_USE_PLUGIN_HOST_PROCESS to 1 when
+ building on 64-bit SnowLeopard. Define to 0 elsewhere.
+
+2009-09-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Code sampling builds are broken.
+ https://bugs.webkit.org/show_bug.cgi?id=29662
+
+ Fix build.
+
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * bytecode/SamplingTool.cpp:
+ (JSC::ScriptSampleRecord::sample):
+ (JSC::SamplingTool::doRun):
+ (JSC::SamplingTool::notifyOfScope):
+ (JSC::compareScriptSampleRecords):
+ (JSC::SamplingTool::dump):
+ * bytecode/SamplingTool.h:
+ (JSC::ScriptSampleRecord::ScriptSampleRecord):
+ (JSC::ScriptSampleRecord::~ScriptSampleRecord):
+ (JSC::SamplingTool::SamplingTool):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ (JSC::BytecodeGenerator::emitNewFunctionExpression):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::makeFunction):
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * parser/Nodes.cpp:
+ (JSC::ScopeNode::ScopeNode):
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::evaluate):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::fromGlobalCode):
+ * runtime/Executable.h:
+ (JSC::ScriptExecutable::ScriptExecutable):
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::EvalExecutable::create):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ (JSC::FunctionExecutable::create):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+
+2009-09-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ * wtf/Forward.h: Added PassOwnPtr.
+
+2009-09-22 Yaar Schnitman <yaar@chromium.org>
+
+ Reviewed by David Levin.
+
+ Ported chromium.org's javascriptcore.gyp for the webkit chromium port.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29617
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp: Added.
+
+2009-09-22 Thiago Macieira <thiago.macieira@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix compilation with WINSCW: no varargs macros
+
+ Disable variadic arguments for WINSCW just like we do
+ for MSVC7.
+
+ * wtf/Assertions.h:
+
+2009-09-22 Kent Hansen <khansen@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Disable variadic macros on MSVC7.
+
+ This was originally added in r26589 but not extended
+ when LOG_DISABLED/ASSERT_DISABLED was introduced.
+
+ * wtf/Assertions.h:
+
+2009-09-22 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed build fix for Windows CE < 5
+
+ Define WINCEBASIC to disable the IsDebuggerPresent() code in
+ wtf/Assertions.cpp.
+
+ * JavaScriptCore.pri:
+
+2009-09-22 Joerg Bornemann <joerg.bornemann@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix major memory leak in JavaScriptCore RegisterFile on Windows CE
+
+ https://bugs.webkit.org/show_bug.cgi?id=29367
+
+ On Widows CE we must decommit all committed pages before we release
+ them. See VirtualFree documentation.
+ Desktop Windows behaves much smoother in this situation.
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::~RegisterFile):
+
+2009-09-21 Greg Bolsinga <bolsinga@apple.com>
+
+ Reviewed by Simon Fraser & Sam Weinig.
+
+ Add ENABLE(ORIENTATION_EVENTS)
+ https://bugs.webkit.org/show_bug.cgi?id=29508
+
+ * wtf/Platform.h: Also sort PLATFORM(IPHONE) #defines.
+
+2009-09-21 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ [Fix] SourceCode's uninitialized member
+
+ Potential source of crashes and bugs was fixed. Default constructor
+ didn't initialized m_provider member.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29364
+
+ * parser/SourceCode.h:
+ (JSC::SourceCode::SourceCode):
+
+2009-09-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ REGRESSION (r48582): Crash in StructureStubInfo::initPutByIdTransition when reloading trac.webkit.org
+ https://bugs.webkit.org/show_bug.cgi?id=29599
+
+ It is unsafe to attempt to cache new property transitions on
+ dictionaries of any type.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCachePutByID):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+
+2009-09-21 Oliver Hunt <oliver@apple.com>
+
+ RS=Maciej Stachowiak.
+
+ Re-land SNES fix with corrected assertion.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::Interpreter::tryCacheGetByID):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::removeDirect):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::getEnumerablePropertyNames):
+ (JSC::Structure::despecifyDictionaryFunction):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::removePropertyTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::toCacheableDictionaryTransition):
+ (JSC::Structure::toUncacheableDictionaryTransition):
+ (JSC::Structure::fromDictionaryTransition):
+ (JSC::Structure::removePropertyWithoutTransition):
+ * runtime/Structure.h:
+ (JSC::Structure::isDictionary):
+ (JSC::Structure::isUncacheableDictionary):
+ (JSC::Structure::):
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::isCacheable):
+
+2009-09-21 Adam Roben <aroben@apple.com>
+
+ Revert r48573, as it caused many assertion failures
+
+ * interpreter/Interpreter.cpp:
+ * jit/JITStubs.cpp:
+ * runtime/BatchedTransitionOptimizer.h:
+ * runtime/JSObject.cpp:
+ * runtime/Structure.cpp:
+ * runtime/Structure.h:
+ * runtime/StructureChain.cpp:
+
+2009-09-21 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Unreviewed make dist build fix. Missing files.
+
+ * GNUmakefile.am:
+
+2009-09-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam 'Cabin Boy' Weinig.
+
+ Fix stack alignment with ARM THUMB2 JIT.
+ https://bugs.webkit.org/show_bug.cgi?id=29526
+
+ Stack is currently being decremented by 0x3c, bump this to 0x40 to make this a
+ multiple of 16 bytes.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ * jit/JITStubs.h:
+
+2009-09-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ SNES is too slow
+ https://bugs.webkit.org/show_bug.cgi?id=29534
+
+ The problem was that the emulator used multiple classes with
+ more properties than our dictionary cutoff allowed, this resulted
+ in more or less all critical logic inside the emulator requiring
+ uncached property access.
+
+ Rather than simply bumping the dictionary cutoff, this patch
+ recognises that there are two ways to create a "dictionary"
+ structure. Either by adding a large number of properties, or
+ by removing a property. In the case of adding properties we
+ know all the existing properties will maintain their existing
+ offsets, so we could cache access to those properties, if we
+ know they won't be removed.
+
+ To make this possible, this patch adds the logic required to
+ distinguish a dictionary created by addition from one created
+ by removal. With this logic in place we can now cache access
+ to objects with large numbers of properties.
+
+ SNES performance improved by more than 6x.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::Interpreter::tryCacheGetByID):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::removeDirect):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::getEnumerablePropertyNames):
+ (JSC::Structure::despecifyDictionaryFunction):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::removePropertyTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::toCacheableDictionaryTransition):
+ (JSC::Structure::toUncacheableDictionaryTransition):
+ (JSC::Structure::fromDictionaryTransition):
+ (JSC::Structure::removePropertyWithoutTransition):
+ * runtime/Structure.h:
+ (JSC::Structure::isDictionary):
+ (JSC::Structure::isUncacheableDictionary):
+ (JSC::Structure::):
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::isCacheable):
+
+2009-09-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Implement ES5 Object.create function
+ https://bugs.webkit.org/show_bug.cgi?id=29524
+
+ Implement Object.create. Very simple patch, effectively Object.defineProperties
+ only creating the target object itself.
+
+ * runtime/CommonIdentifiers.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorCreate):
+
+2009-09-19 Dan Bernstein <mitz@apple.com>
+
+ Fix clean debug builds.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-19 Joerg Bornemann <joerg.bornemann@nokia.com>
+
+ Reviewed by George Staikos.
+
+ QtWebKit Windows CE compile fix
+
+ https://bugs.webkit.org/show_bug.cgi?id=29379
+
+ There is no _aligned_alloc or _aligned_free on Windows CE.
+ We just use the Windows code that was there before and use VirtualAlloc.
+ But that also means that the BLOCK_SIZE must be 64K as this function
+ allocates on 64K boundaries.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::allocateBlock):
+ (JSC::Heap::freeBlock):
+ * runtime/Collector.h:
+
+2009-09-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implement ES5 Object.defineProperties function
+ https://bugs.webkit.org/show_bug.cgi?id=29522
+
+ Implement Object.defineProperties. Fairly simple patch, simply makes use of
+ existing functionality used for defineProperty.
+
+ * runtime/CommonIdentifiers.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::defineProperties):
+ (JSC::objectConstructorDefineProperties):
+
+2009-09-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Windows build fix part2
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Buildfix).
+
+ Windows build fix part 1.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Implement ES5 Object.defineProperty function
+ https://bugs.webkit.org/show_bug.cgi?id=29503
+
+ Implement Object.defineProperty. This requires adding the API to
+ ObjectConstructor, along with a helper function that implements the
+ ES5 internal [[ToPropertyDescriptor]] function. It then adds
+ JSObject::defineOwnProperty that implements the appropriate ES5 semantics.
+ Currently defineOwnProperty uses a delete followed by a put to redefine
+ attributes of a property, clearly this is less efficient than it could be
+ but we can improve this if it needs to be possible in future.
+
+ * JavaScriptCore.exp:
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::defineGetter):
+ (JSC::DebuggerActivation::defineSetter):
+ * debugger/DebuggerActivation.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ Update defineGetter/Setter calls
+ * runtime/CommonIdentifiers.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertySlot):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::defineGetter):
+ (JSC::JSGlobalObject::defineSetter):
+ * runtime/JSGlobalObject.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::putDescriptor):
+ (JSC::JSObject::defineOwnProperty):
+ * runtime/JSObject.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ (JSC::toPropertyDescriptor):
+ (JSC::objectConstructorDefineProperty):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ * runtime/PropertyDescriptor.cpp:
+ (JSC::PropertyDescriptor::writable):
+ (JSC::PropertyDescriptor::enumerable):
+ (JSC::PropertyDescriptor::configurable):
+ (JSC::PropertyDescriptor::isDataDescriptor):
+ (JSC::PropertyDescriptor::isGenericDescriptor):
+ (JSC::PropertyDescriptor::isAccessorDescriptor):
+ (JSC::PropertyDescriptor::getter):
+ (JSC::PropertyDescriptor::setter):
+ (JSC::PropertyDescriptor::setDescriptor):
+ (JSC::PropertyDescriptor::setAccessorDescriptor):
+ (JSC::PropertyDescriptor::setWritable):
+ (JSC::PropertyDescriptor::setEnumerable):
+ (JSC::PropertyDescriptor::setConfigurable):
+ (JSC::PropertyDescriptor::setSetter):
+ (JSC::PropertyDescriptor::setGetter):
+ (JSC::PropertyDescriptor::equalTo):
+ (JSC::PropertyDescriptor::attributesEqual):
+ (JSC::PropertyDescriptor::attributesWithOverride):
+ * runtime/PropertyDescriptor.h:
+ (JSC::PropertyDescriptor::PropertyDescriptor):
+ (JSC::PropertyDescriptor::value):
+ (JSC::PropertyDescriptor::setValue):
+ (JSC::PropertyDescriptor::isEmpty):
+ (JSC::PropertyDescriptor::writablePresent):
+ (JSC::PropertyDescriptor::enumerablePresent):
+ (JSC::PropertyDescriptor::configurablePresent):
+ (JSC::PropertyDescriptor::setterPresent):
+ (JSC::PropertyDescriptor::getterPresent):
+ (JSC::PropertyDescriptor::operator==):
+ (JSC::PropertyDescriptor::):
+
+2009-09-18 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Build fix to enable ARM_THUMB2 on Linux
+ https://bugs.webkit.org/show_bug.cgi?id=
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+ * jit/JITStubs.cpp:
+ * wtf/Platform.h:
+
+2009-09-18 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Defines two pseudo-platforms for ARM and Thumb-2 instruction set.
+ https://bugs.webkit.org/show_bug.cgi?id=29122
+
+ Introduces WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2
+ macros on ARM platforms. The PLATFORM(ARM_THUMB2) should be used
+ when Thumb-2 instruction set is the required target. The
+ PLATFORM(ARM_TRADITIONAL) is for generic ARM instruction set. In
+ case where the code is common the PLATFORM(ARM) have to be used.
+
+ * assembler/ARMAssembler.cpp:
+ * assembler/ARMAssembler.h:
+ * assembler/ARMv7Assembler.h:
+ * assembler/MacroAssembler.h:
+ * assembler/MacroAssemblerARM.cpp:
+ * assembler/MacroAssemblerARM.h:
+ * assembler/MacroAssemblerCodeRef.h:
+ (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr):
+ * jit/ExecutableAllocator.h:
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::beginUninterruptedSequence):
+ (JSC::JIT::preserveReturnAddressAfterCall):
+ (JSC::JIT::restoreReturnAddressBeforeReturn):
+ (JSC::JIT::restoreArgumentReference):
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ * jit/JITOpcodes.cpp:
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ * jit/JITStubs.h:
+ * wtf/Platform.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateEnter):
+
+2009-09-18 Joerg Bornemann <joerg.bornemann@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix the Qt/Windows CE build.
+
+ * JavaScriptCore.pri: Build the ce_time.cpp functions from
+ within Qt externally.
+ * wtf/DateMath.cpp: Removed unnecessary Qt #ifdef, for the
+ Qt build these functions are no external, too.
+
+2009-09-17 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Symbian/WINSCW build fox.
+
+ Repeat Q_OS_WIN wchar_t hack for WINSCW, similar to
+ revision 24774.
+
+ WINSCW defines wchar_t, thus UChar has to be wchar_t
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+
+2009-09-17 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Symbian/WINSCW build fix.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29186
+
+ WINSCW Template specialisation name in declaration must the be the same as in implementation.
+
+ * runtime/LiteralParser.h:
+
+2009-09-15 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27060
+
+ Symbian compiler for emulator target (WINSCW) fails with
+ "illegal operand" for m_attributesInPrevious in structure.ccp
+ (when calling make_pair functions).
+ This error is apparently due to the compiler not properly
+ resolving the unsigned type of the declared bitfield.
+
+ Initial patch explicitly casted m_attributesInPrevious
+ to unsigned, but since bitfield optimization is not critical for
+ the emulator target, this conditional change in header file
+ appears to be least intrusive.
+
+ * runtime/Structure.h:
+
+2009-09-16 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Fix GCC warnings on ARM_THUMB2 platform
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMThumbImmediate::countLeadingZerosPartial):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::branchTruncateDoubleToInt32):
+ (JSC::MacroAssemblerARMv7::moveFixedWidthEncoding):
+
+2009-09-16 Greg Bolsinga <bolsinga@apple.com>
+
+ Add ENABLE(INSPECTOR)
+ https://bugs.webkit.org/show_bug.cgi?id=29260
+
+ Reviewed by David Kilzer.
+
+ * wtf/Platform.h:
+
+2009-09-16 Greg Bolsinga <bolsinga@apple.com>
+
+ Add ENABLE(CONTEXT_MENUS)
+ https://bugs.webkit.org/show_bug.cgi?id=29225
+
+ Reviewed by David Kilzer.
+
+ * wtf/Platform.h:
+
+2009-09-16 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Reviewed by Eric Seidel.
+
+ The webkit stdint and stdbool headers exists because
+ the compiler MSVC doesn't include them. The check
+ should not check for PLATFORM(WIN_OS) but for MSVC.
+
+ * os-win32/stdbool.h:
+ * os-win32/stdint.h:
+
+2009-09-16 Greg Bolsinga <bolsinga@apple.com>
+
+ Add ENABLE(DRAG_SUPPORT)
+ https://bugs.webkit.org/show_bug.cgi?id=29233
+
+ Reviewed by David Kilzer.
+
+ * wtf/Platform.h:
+
+2009-09-16 Kevin Ollivier <kevino@theolliviers.com>
+
+ waf build fix after flag was moved to correct place.
+
+ * wscript:
+
+2009-09-16 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Build fix for 64-bit Qt on Mac OS X
+
+ * wtf/Platform.h: Use JSVALUE64 on DARWIN, not only on MAC
+
+2009-09-16 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix wtf/ThreadSpecific.h under Qt to free thread local objects.
+ https://bugs.webkit.org/show_bug.cgi?id=29295
+
+ This is an important fix when JavaScript workers are in use, since
+ unfreed ThreadGlobalDatas leak a big amount of memory (50-100k each).
+ QThreadStorage calls the destructor of a given object, which is the
+ ThreadSpecific::Data. Unlike pthread, Qt is object oriented, and does
+ not support the calling of a static utility function when the thread
+ is about to close. In this patch we call the ThreadSpecific::destroy()
+ utility function from the destructor of ThreadSpecific::Data. Moreover,
+ since Qt resets all thread local values to 0 before the calling of the
+ appropriate destructors, we set back the pointer to its original value.
+ This is necessary because the get() method of the ThreadSpecific
+ object may be called during the exuction of the destructor.
+
+ * wtf/ThreadSpecific.h:
+ (WTF::ThreadSpecific::Data::~Data):
+ (WTF::::~ThreadSpecific):
+ (WTF::::set):
+ (WTF::::destroy):
+
+2009-09-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Allow anonymous storage inside JSObject
+ https://bugs.webkit.org/show_bug.cgi?id=29168
+
+ Add the concept of anonymous slots to Structures so that it is
+ possible to store references to values that need marking in the
+ standard JSObject storage buffer. This allows us to reduce the
+ malloc overhead of some objects (by allowing them to store JS
+ values in the inline storage of the object) and reduce the
+ dependence of custom mark functions (if all an objects children
+ are in the standard object property storage there's no need to
+ mark them manually).
+
+ * JavaScriptCore.exp:
+ * runtime/JSObject.h:
+ (JSC::JSObject::putAnonymousValue):
+ (JSC::JSObject::getAnonymousValue):
+ (JSC::JSObject::addAnonymousSlots):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::createStructure):
+ (JSC::JSWrapperObject::JSWrapperObject):
+ (JSC::JSWrapperObject::setInternalValue):
+ * runtime/PropertyMapHashTable.h:
+ * runtime/Structure.cpp:
+ (JSC::Structure::~Structure):
+ (JSC::Structure::materializePropertyMap):
+ (JSC::Structure::addAnonymousSlotsTransition):
+ (JSC::Structure::copyPropertyTable):
+ (JSC::Structure::put):
+ (JSC::Structure::rehashPropertyMapHashTable):
+ * runtime/Structure.h:
+ (JSC::Structure::propertyStorageSize):
+ (JSC::StructureTransitionTable::reifySingleTransition):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTable::TransitionTable::addSlotTransition):
+ (JSC::StructureTransitionTable::TransitionTable::removeSlotTransition):
+ (JSC::StructureTransitionTable::TransitionTable::getSlotTransition):
+ (JSC::StructureTransitionTable::getAnonymousSlotTransition):
+ (JSC::StructureTransitionTable::addAnonymousSlotTransition):
+ (JSC::StructureTransitionTable::removeAnonymousSlotTransition):
+
+2009-09-15 Alex Milowski <alex@milowski.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Added the ENABLE_MATHML define to the features
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-09-15 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Build fix for windows.
+
+ After http://trac.webkit.org/changeset/47795 the MinGW build broke,
+ because MinGW has __mingw_aligned_malloc instead of _aligned_malloc.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::allocateBlock): MinGW case added.
+ (JSC::Heap::freeBlock): MinGW case added.
+
+2009-09-15 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Build fix for Windows/MinGW
+
+ https://bugs.webkit.org/show_bug.cgi?id=29268
+
+ * wtf/Platform.h: JSVALUE32_64 temporarily disabled on PLATFORM(WIN_OS) with COMPILER(MINGW)
+
+2009-09-14 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Detect VFP at runtime in generic ARM port on Linux platform.
+ https://bugs.webkit.org/show_bug.cgi?id=29076
+
+ * JavaScriptCore.pri:
+ * assembler/MacroAssemblerARM.cpp: Added.
+ (JSC::isVFPPresent):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::supportsFloatingPoint):
+
+2009-09-14 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Build fix for windows build.
+
+ * JavaScriptCore.pri: Correct a logic error.
+ * pcre/dftables: Add missing paranthesis for tmpdir function.
+
+2009-09-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Build fix for windows exports (again).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Build fix for windows exports.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Correct fix for non-allinonefile builds
+
+ * runtime/ObjectConstructor.cpp:
+
+2009-09-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Fix non-allinonefile builds
+
+ * runtime/ObjectConstructor.cpp:
+
+2009-09-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ [ES5] Implement Object.keys
+ https://bugs.webkit.org/show_bug.cgi?id=29170
+
+ This patch basically requires two separate steps, the first is to split getPropertyNames
+ into two functions -- getOwnPropertyNames and getPropertyNames, basically making them behave
+ in the same way as getOwnPropertySlot and getPropertySlot. In essence getOwnPropertyNames
+ produces the list of properties on an object excluding its prototype chain and getPropertyNames
+ just iterates the the object and its prototype chain calling getOwnPropertyNames at each level.
+
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::getOwnPropertyNames):
+ * JavaScriptCore.exp:
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::getOwnPropertyNames):
+ * debugger/DebuggerActivation.h:
+ * runtime/CommonIdentifiers.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertyNames):
+ * runtime/JSArray.h:
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::getOwnPropertyNames):
+ * runtime/JSByteArray.h:
+ * runtime/JSNotAnObject.cpp:
+ (JSC::JSNotAnObject::getOwnPropertyNames):
+ * runtime/JSNotAnObject.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::getOwnPropertyNames):
+ * runtime/JSObject.h:
+ * runtime/JSVariableObject.cpp:
+ (JSC::JSVariableObject::getOwnPropertyNames):
+ * runtime/JSVariableObject.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorKeys):
+ * runtime/RegExpMatchesArray.h:
+ (JSC::RegExpMatchesArray::getOwnPropertyNames):
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::getOwnPropertyNames):
+ * runtime/StringObject.h:
+ * runtime/Structure.cpp:
+ (JSC::Structure::getOwnEnumerablePropertyNames):
+ (JSC::Structure::getEnumerablePropertyNames):
+ * runtime/Structure.h:
+
+2009-09-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ getPropertyNames caching is invalid when the prototype chain contains objects with custom getPropertyNames
+ https://bugs.webkit.org/show_bug.cgi?id=29214
+
+ Add a flag to TypeInfo to indicate whether a type overrides getPropertyNames.
+ This flag is used to make sure that caching of the property name data is safe.
+
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructure):
+ * debugger/DebuggerActivation.h:
+ (JSC::DebuggerActivation::createStructure):
+ * runtime/BooleanObject.h:
+ (JSC::BooleanObject::createStructure):
+ * runtime/DatePrototype.h:
+ (JSC::DatePrototype::createStructure):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/JSONObject.h:
+ (JSC::JSONObject::createStructure):
+ * runtime/JSObject.h:
+ (JSC::JSObject::createStructure):
+ * runtime/JSTypeInfo.h:
+ (JSC::TypeInfo::hasDefaultGetPropertyNames):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::createStructure):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::createStructure):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructure):
+ * runtime/NumberObject.h:
+ (JSC::NumberObject::createStructure):
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructure):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::createStructure):
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::isCacheable):
+
+2009-09-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29207
+ Add checks for using WebCore JS context on secondary threads
+
+ * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ Added a new mainThreadOnly flag that WebCore would set.
+
+ * runtime/Collector.cpp: (JSC::Heap::registerThread): JSC API methods always call this,
+ so this is a good place to check that the API isn't used form a wrong thread.
+
+2009-09-11 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Compiling JavaScriptCore on sparc 64 with gcc fails.
+
+ ThreadSafeShared uses the atomic __gnu_cxx::__exchange_and_add with an int,
+ however on sparc 64 the _Atomic_word argument is typedefed to long (8 bytes).
+
+ The patch disables WTF_USE_LOCKFREE_THREADSAFESHARED in ThreadSafeShared to use
+ a mutex instead when compiling for sparc 64 with gcc.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29175
+
+ * wtf/Platform.h:
+ __sparc64__ is not defined on all OS.
+ Uses instead: __sparc__ && __arch64__ || __sparcv9
+ * wtf/Threading.h:
+
+2009-09-11 Prasanth Ullattil <prasanth.ullattil@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix compile error on Windows7(64Bit) with latest SDK.
+
+ Added the missing include file.
+
+ * runtime/UString.cpp:
+
+2009-09-11 Joerg Bornemann <joerg.bornemann@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Qt/Windows CE compile fix, include the executable allocator and
+ markstack implementation in the windows build.
+
+ * JavaScriptCore.pri:
+
+2009-09-08 John Abd-El-Malek <jam@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Remove unneeded define for ActiveX.
+ https://bugs.webkit.org/show_bug.cgi?id=29054
+
+ * wtf/Platform.h:
+
+2009-09-10 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Update JavaScriptCore and WebKit's FeatureDefines.xcconfig so that they are in sync with WebCore as they need to be.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-09-10 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Export WTF::tryFastMalloc used in WebSocketChannel.
+ https://bugs.webkit.org/show_bug.cgi?id=28038
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Make StructureTransitionTable use an enum for the PtrAndFlags member
+ used for the single transition slot optimisation.
+
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTable::StructureTransitionTable):
+ (JSC::StructureTransitionTable::usingSingleTransitionSlot):
+ (JSC::StructureTransitionTable::):
+
+2009-09-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Refactor StructureTransitionTable and Structure to unify handling of the single slot optimization
+ https://bugs.webkit.org/show_bug.cgi?id=29141
+
+ Make StructureTransitionTable encapsulate the single transition slot optimization.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::~Structure):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::addPropertyWithoutTransition):
+ (JSC::Structure::removePropertyWithoutTransition):
+ (JSC::Structure::hasTransition):
+ * runtime/Structure.h:
+ (JSC::StructureTransitionTable::contains):
+ (JSC::StructureTransitionTable::get):
+ (JSC::StructureTransitionTable::hasTransition):
+ (JSC::StructureTransitionTable::reifySingleTransition):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTable::StructureTransitionTable):
+ (JSC::StructureTransitionTable::~StructureTransitionTable):
+ (JSC::StructureTransitionTable::remove):
+ (JSC::StructureTransitionTable::add):
+ (JSC::StructureTransitionTable::table):
+ (JSC::StructureTransitionTable::singleTransition):
+ (JSC::StructureTransitionTable::usingSingleTransitionSlot):
+ (JSC::StructureTransitionTable::setSingleTransition):
+ (JSC::StructureTransitionTable::setTransitionTable):
+ (JSC::StructureTransitionTable::):
+ * wtf/PtrAndFlags.h:
+ (WTF::PtrAndFlags::PtrAndFlags):
+
+2009-09-10 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Implement fastDeleteSkippingDestructor for FastAllocBase and fastDeleteAllValues for HashSet
+ https://bugs.webkit.org/show_bug.cgi?id=25930
+
+ FastAllocBase has been extended with fastDeleteSkippingDestructor function which
+ releases memory without destructor call. fastDeleteAllValues has been implemented
+ similar as deleteAllValues but it uses fastDelete function to release memory.
+
+ * wtf/FastAllocBase.h:
+ (WTF::fastDeleteSkippingDestructor):
+ * wtf/HashSet.h:
+ (WTF::fastDeleteAllValues):
+
+2009-09-10 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ ARM compiler does not understand GCC visibility attribute
+ https://bugs.webkit.org/show_bug.cgi?id=29079
+
+ * API/JSBase.h: Make the test more specific to hit only
+ the GCC compiler
+
+2009-09-10 Adam Barth <abarth@webkit.org>
+
+ Unreviewed revert of the previous change. It broke the tests.
+
+ * wtf/dtoa.cpp:
+ (WTF::dtoa):
+
+2009-09-10 Ben Laurie <benl@google.com>
+
+ Reviewed by Adam Barth.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=26836>
+
+ If dtoa was given a small buffer and the number was either infinite or
+ NaN, then the buffer would be overflowed.
+
+ * wtf/dtoa.cpp:
+
+2009-09-09 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Change reinterpret_cast to static_cast in r48212.
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2009-09-09 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Remove WTF_PLATFORM_FORCE_PACK as it is no longer used
+ https://bugs.webkit.org/show_bug.cgi?id=29066
+
+ * wtf/Platform.h:
+
+2009-09-09 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Implement flushing the instruction cache for Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=29075
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush): Call IMB_Range to flush
+ the instruction cache on Symbian
+
+2009-09-09 Kent Hansen <khansen@trolltech.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29024
+ Make JavaScriptCore compile on platforms with case-insensitive file systems and typeinfo.h in STL
+
+ These platforms include Microsoft Visual Studio 2003, and Symbian with Metrowerks compiler.
+
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSTypeInfo.h: Copied from JavaScriptCore/runtime/TypeInfo.h.
+ * runtime/Structure.h:
+ * runtime/TypeInfo.h: Removed.
+
+2009-09-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ JSON.stringify(Date) loses the milliseconds information
+ https://bugs.webkit.org/show_bug.cgi?id=29063
+
+ Make sure we include milliseconds in the output of toISOString.
+
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToISOString):
+
+2009-09-08 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix, generate derived sources earlier in order to make sure
+ they're found by the build system when generating the list of sources to build.
+
+ * wscript:
+
+2009-09-08 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Build fix when USE(LOCKFREE_THREADSAFESHARED) is not defined
+ https://bugs.webkit.org/show_bug.cgi?id=29011
+
+ * wtf/Threading.h: Use LOCKFREE_THREADSAFESHARED guard for
+ atomicIncrement and atomicDecrement
+
+2009-09-07 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control in Yarr's RegexInterpreter
+ https://bugs.webkit.org/show_bug.cgi?id=29025
+
+ Inherits RegexInterpreter classes from FastAllocBase (bug #20422), which has
+ been instantiated by 'new':
+
+ class ByteDisjunction
+ -> instantiated in JavaScriptCore/yarr/RegexInterpreter.cpp:1462
+
+ struct BytecodePattern
+ -> instantiated in JavaScriptCore/yarr/RegexInterpreter.cpp:1279
+
+ * yarr/RegexInterpreter.h:
+
+2009-09-07 Drew Wilson <atwilson@google.com>
+
+ Reverting r48121 to fix Windows build errors.
+
+ * JavaScriptCore.exp:
+
+2009-09-07 Drew Wilson <atwilson@google.com>
+
+ Reviewed by David Levin.
+
+ Enable SHARED_WORKERS by default
+ https://bugs.webkit.org/show_bug.cgi?id=28959
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-09-07 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Export WTF::tryFastMalloc used in WebSocketChannel.
+ https://bugs.webkit.org/show_bug.cgi?id=28038
+
+ * JavaScriptCore.exp:
+
+2009-09-04 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Fix windows export files
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-04 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [[ToString]] conversion should use the actual toString function for String objects.
+
+ Remove incorrect specialisations of toString conversions on StringObject.
+
+ * JavaScriptCore.exp:
+ * runtime/StringObject.cpp:
+ * runtime/StringObject.h:
+
+2009-09-04 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Add new export.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Add new export.
+
+2009-09-04 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Remove unneeded export.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Remove unneeded export.
+
+2009-09-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ DateInstance object collected on ARM JIT (JSValue: WTF_USE_JSVALUE32)
+ https://bugs.webkit.org/show_bug.cgi?id=28909
+
+ Part two.
+
+ Make some improvements to garbage collection code:
+
+ 1) Create a runtime assertion that catches any classes that
+ override markChildren but have the HasDefaultMark bit set.
+ 2) Remove checks of the mark bit outside the MarkStack::append
+ function; they are redundant.
+ 3) Improve the efficiency of the asObject and asArray functions
+ when called on JSCell* to avoid a round trip to JSValue.
+ 4) Make more callers use the checked asCell and asObject
+ casting functions rather than unchecked casts.
+ 5) Removed the JSCell::marked function and other GC-related
+ functions because these operations are no longer things that
+ code other than the core GC code needs to do directly. Fixed
+ callers that were calling them.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::markConservatively): Removed unneeded call to MarkStack::drain.
+ (JSC::Heap::markProtectedObjects): Removed unneeded check of the mark
+ bit and call to MarkStack::drain.
+ (JSC::Heap::collect): Removed unneeded checks of the mark bit and also
+ changed call to SmallStrings::mark to call markChildren instead to match
+ the rest of the objects.
+ (JSC::typeName): Removed unneeded cast to JSObject*.
+
+ * runtime/JSArray.h:
+ (JSC::asArray): Added an overload for JSCell* and changed the JSValue
+ version to call it. Removed some unneeded casts.
+ (JSC::JSArray::markChildrenDirect): Marked this function inline. It's in
+ a header, and if not marked inline this could lead to linking problems.
+ (JSC::MarkStack::markChildren): Added. This helper function is used by
+ the drain function to avoid repating code. Also added the code here to
+ check fro default mark violations in debug code. If a markChildren
+ function adds something to the mark stack, but the type info claimed
+ hasDefaultMark was true, then we will get an assertion now. Also fixed
+ the assertion about the mark bit to use the Heap function directly
+ because we don't have a JSCell::marked function any more.
+ (JSC::MarkStack::drain): Changed a local variable from "v" to "value",
+ and from "currentCell" to "cell". Changed to call markChildren in two
+ places instead of repeating a chain of if statements twice. Changed
+ code that reads and writes the mark bit to use Heap::isCellMarked and
+ Heap::markCell so we can eliminate the JSCell::marked and
+ JSCell::markCellDirect functions.
+
+ * runtime/JSCell.h: Removed JSCell's markCellDirect and marked member
+ functions. Added a comment explaining that asCell should be deprecated
+ in favor of the JSValue asCell member function.
+ (JSC::MarkStack::append): Added the assertion that catches callers
+ that have set the HasDefaultMark bit incorrectly. Changed
+ code that reads and writes the mark bit to use Heap::isCellMarked and
+ Heap::markCell so we can eliminate the JSCell::marked and
+ JSCell::markCellDirect functions. Moved the overload of
+ MarkStack::append for JSValue here so it can call through to the cell
+ version. The old version had a copy of all the code instead, but that
+ repeated the conversion from JSValue to JSCell* and the check for
+ whether a value is a cell multiple times.
+ (JSC::Structure::markAggregate): Moved this function here to avoid
+ dependencies for Structure.h, since this calls MarkStack::append.
+
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::markChildren): Added code to clear
+ m_isCheckingForDefaultMarkViolation so the marking done by JSObject
+ doesn't trigger the assertion.
+
+ * runtime/JSValue.h: Moved some stray includes that were outside the
+ header guard inside it. Not sure how that happened! Removed the
+ GC-related member functions markChildren, hasChildren, marked, and
+ markDirect.
+
+ * runtime/JSWrapperObject.h: Made markChildren private.
+ (JSC::JSWrapperObject::createStructure): Added. Fixes a bug where the
+ HasDefaultMark bit was set.
+
+ * runtime/MarkStack.h: Added m_isCheckingForDefaultMarkViolation and
+ initialized it to false. Moved the append function body from here to
+ JSCell.h. Added a declaration of a private markChildren function used
+ inside the drain function.
+
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStrings::markChildren): Changed the name and style of this
+ function to match other functions. This allows us to share the normal
+ mark stack code path.
+
+ * runtime/SmallStrings.h: Changed the name and interface of mark to
+ the more-normal markChildren style.
+
+ * runtime/Structure.h: Moved the body of markAggregate into the
+ JSCell.h to avoid a circular dependency with JSCell.h.
+
+2009-09-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ DateInstance object collected on ARM JIT (JSValue: WTF_USE_JSVALUE32)
+ https://bugs.webkit.org/show_bug.cgi?id=28909
+
+ Part one.
+
+ Make some improvements to garbage collection code:
+
+ 1) Fix the two classes that had the default mark bit set but
+ should not.
+ 2) Remove checks of the mark bit outside the MarkStack::append
+ function; they are redundant.
+ 3) Make more callers use the checked asCell and asObject
+ casting functions rather than unchecked casts.
+ 4) Removed some GC-related functions because these operations are
+ no longer things that code other than the core GC code needs
+ to do directly. Fixed callers that were calling them.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::markAggregate): Removed unneeded check of the mark
+ bit before calling MarkStack::append.
+
+ * interpreter/Register.h: Removed unneeded marked and markChildren
+ functions.
+
+ * jit/JITStubs.cpp:
+ (op_eq): Removed unneeded assertions, instead using checked casting
+ functions such as asObject.
+
+ * runtime/ArgList.h: Added now-needed forward declaration of MarkStack.
+
+ * runtime/GetterSetter.cpp:
+ (JSC::GetterSetter::markChildren): Remmoved unneeded check of the mark bit.
+
+ * runtime/GlobalEvalFunction.h:
+ (JSC::GlobalEvalFunction::createStructure): Added. Fixes a bug where the
+ HasDefaultMark bit was set.
+
+ * runtime/JSCell.cpp:
+ (JSC::JSCell::getObject): Use asObject to avoid a direct static_cast.
+
+ * runtime/JSObject.h:
+ (JSC::asObject): Added an overload for JSCell* and changed the JSValue
+ version to call it.
+ (JSC::JSValue::get): Use asObject to avoid a direct static_cast.
+
+ * runtime/JSWrapperObject.h: Made markChildren private.
+ (JSC::JSWrapperObject::createStructure): Added. Fixes a bug where the
+ HasDefaultMark bit was set. Later we may want to optimize this for
+ wrapper types that never have cells in their internal values, but there
+ is no measured performance regression in SunSpider or V8 doing this
+ all the time.
+
+ * runtime/MarkStack.cpp: Tweaked formatting.
+
+2009-09-04 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix. Switch USE_ defines over to the compiler so that they can be
+ checked by files not including config.h (like WebCorePrefix.h).
+
+ * wtf/Platform.h:
+
+2009-09-03 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by David Levin.
+
+ Remove unnecessary dependency on unistd.h
+ https://bugs.webkit.org/show_bug.cgi?id=28962
+
+ * runtime/Completion.cpp:
+
+2009-09-03 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Add strnstr for Linux and Windows in StringExtras.h
+ https://bugs.webkit.org/show_bug.cgi?id=28901
+
+ * wtf/StringExtras.h:
+ (strnstr):
+
+2009-09-03 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for JavaScriptCore's HashEntry class
+ https://bugs.webkit.org/show_bug.cgi?id=27830
+
+ Inherits HashEntry class from FastAllocBase because it has been
+ instantiated by 'new' JavaScriptCore/runtime/Lookup.cpp:32.
+
+ * runtime/Lookup.h:
+
+2009-09-02 Gavin Barraclough <barraclough@apple.com>
+
+ Should crash if JIT code buffer allocation fails.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28926
+ <rdar://problem/7031922>
+
+ * jit/ExecutableAllocatorPosix.cpp:
+ (JSC::ExecutablePool::systemAlloc):
+ * jit/ExecutableAllocatorWin.cpp:
+ (JSC::ExecutablePool::systemAlloc):
+
+2009-09-02 Kevin Ollivier <kevino@theolliviers.com>
+
+ waf build fixes for Windows/MSVC.
+
+ * wscript:
+
+2009-09-02 Kevin Ollivier <kevino@theolliviers.com>
+
+ Build fix for building on Windows.
+
+ * wtf/ThreadingPthreads.cpp:
+
+2009-09-02 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ Use fastMalloc when neither MMAP nor VIRTUALALLOC are enabled
+
+ RegisterFile constructor currently throws #error when both
+ MMAP and VIRTUALALLOC conditions fail.
+ On any platform that does not provide these features
+ (for instance, Symbian),
+ the fallback should be regular malloc (or fastMalloc).
+ It is functionally equivalent in this case, even though it may
+ have certain drawbacks such as lack of dynamic pre-allocation.
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::~RegisterFile):
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+
+2009-08-31 Robert Agoston <Agoston.Robert@stud.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Fixed typo.
+ https://bugs.webkit.org/show_bug.cgi?id=28691
+
+ * parser/Parser.h:
+ (JSC::Parser::parse):
+
+2009-08-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ JSON Stringifier does not follow ES5 spec for handling of Number, String and Boolean objects
+ https://bugs.webkit.org/show_bug.cgi?id=28797
+
+ Fixed unwrapBoxedPrimitive to do the right thing, which necessitated a couple of new exception
+ checks, and corrected the logic in gap to correctly convert Number and String objects.
+
+ * runtime/JSONObject.cpp:
+ (JSC::unwrapBoxedPrimitive):
+ (JSC::gap):
+ (JSC::Stringifier::Stringifier):
+ (JSC::Stringifier::appendStringifiedValue):
+
+2009-08-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Adam Roben.
+
+ JSON.stringify replacer array does not accept values that are not string primitives.
+ https://bugs.webkit.org/show_bug.cgi?id=28788
+
+ Update the JSON stringifier to initialise its replacer array according to the most
+ recent version of the spec.
+
+ * runtime/Identifier.h:
+ (JSC::Identifier::from):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Stringifier):
+
+2009-08-27 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28753
+ <rdar://problem/7173448> Excessive number of threads (and a crash)
+
+ * wtf/Threading.h: (WTF::atomicIncrement): Changed atomicIncrement to match decrement
+ and return the new value. Also added using directives for these functions, to match
+ te rest of WTF.
+
+2009-08-27 Brent Fulgham <bfulgham@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Link the testapi against CFLite when building the WinCairo port.
+
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add new Release_CFLite
+ target. Update all targets to inherit from either the
+ JavaScriptCF.vsprops (Apple target) or the JavaScriptCFLite.vsprops
+ file (WinCairo target).
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops: Remove
+ input file CoreFoundation.lib. This is provided by either the
+ JavaScriptCF.vsprops or JavaScriptCFLite.vsprops file.
+
+2009-08-27 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Fix Windows-specific crash due to missing memory clearing call.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::allocateBlock):
+
+2009-08-27 Brent Fulgham <bfulgham@webkit.org>
+
+ Build fix: JavaScriptCore_debug.def missing some exports. Apple
+ Windows build does not use this file, so it was not noticed previously.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-27 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ x86-64 GTK broken due to code offsets changing, pointers sometimes packed into immediates.
+ https://bugs.webkit.org/show_bug.cgi?id=28317
+
+ Missed one, fix part II.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::move):
+ * assembler/X86Assembler.h:
+ (JSC::CAN_SIGN_EXTEND_8_32):
+
+2009-08-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Adam Roben.
+
+ JSON.stringify replacer array does not accept values that are not string primitives.
+ https://bugs.webkit.org/show_bug.cgi?id=28788
+
+ Update the JSON stringifier to initialise its replacer array according to the most
+ recent version of the spec.
+
+ * runtime/Identifier.h:
+ (JSC::Identifier::from):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Stringifier):
+
+2009-08-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ JSON parser accepts trailing comma in array literals
+ https://bugs.webkit.org/show_bug.cgi?id=28779
+
+ Update parser to correctly fail if there's a trailing comma.
+
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::parse):
+
+2009-08-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ 'this' in JSON.parse reviver is the global object
+ https://bugs.webkit.org/show_bug.cgi?id=28752
+
+ This is a technically simple change, we merely update the code for calling
+ the reviver function to pass the correct this object. Doing so however
+ exposes the holder to arbitrary mutation by the reviver function so it is
+ necessary for us to now guard all property accesses against the possibility
+ of failure.
+
+ * runtime/JSArray.h:
+ JSON needs to delete a property from the array, so we friend its
+ Walker class so that we can make a non-virtual call to the arrays
+ delete and getOwnPropertySlot methods.
+ * runtime/JSONObject.cpp:
+ (JSC::Walker::callReviver):
+ We need to pass the correct this object
+ (JSC::Walker::walk):
+ Update calls to callReviver, and update property logic logic
+ to correctly handle the holder being mutated by the reviver
+ function.
+
+2009-08-26 Alice Liu <alice.liu@apple.com>
+
+ Windows build fix: added some exported symbols
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-26 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: Removed some exported symbols that no longer exist.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Olliejver Hunt.
+
+ x86-64 GTK broken due to code offsets changing, pointers sometimes packed into immediates.
+ https://bugs.webkit.org/show_bug.cgi?id=28317
+
+ We rely on a slightly OS X specific behaviour, that x86-64 applications have a 4Gb zero page,
+ so pointers are never representable as a 32-bit integer, and always have to be represented by
+ a separate immediate load instruction, rather than within the immediate field of an arithmetic
+ or memory operation.
+
+ We explicitly check for a couple of cases where a value might be representable in 32-bit, but
+ these probably never kick in on Mac OS, and only kick in to hose GTK. Deleting these does not
+ show a performance degradation on SunSpider. Remove.
+
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::storePtr):
+ (JSC::MacroAssemblerX86_64::branchPtr):
+
+2009-08-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A bit of Collector refatoring.
+
+ SunSpider says no change. v8 says 1.003x faster (1.02x faster on splay).
+
+ * JavaScriptCore.exp:
+
+ * runtime/JSCell.cpp:
+ (JSC::JSCell::toPrimitive):
+ (JSC::JSCell::getPrimitiveNumber):
+ (JSC::JSCell::toBoolean):
+ (JSC::JSCell::toNumber):
+ (JSC::JSCell::toString):
+ (JSC::JSCell::toObject): Removed pure virtual functions from
+ JSCell, so the collector can construct one. This allowed
+ me to remove a bunch of ASSERT_NOT_REACHED throughout the
+ code, too.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::JSCell): ditto
+ (JSC::Heap::heap): Inlined this function because it's trivial.
+
+ * JavaScriptCore.exp:
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::destroy):
+ (JSC::Heap::allocateBlock):
+ (JSC::Heap::freeBlock):
+ (JSC::Heap::freeBlocks): Renamed freeHeap to freeBlocks, since
+ it doesn't actually free the Heap object.
+ (JSC::Heap::heapAllocate):
+ (JSC::Heap::sweep):
+ * runtime/Collector.h: Refactored block allocation and destruction
+ into helper functions.
+
+ * runtime/GetterSetter.cpp:
+ * runtime/JSAPIValueWrapper.cpp:
+ * runtime/JSPropertyNameIterator.cpp: Removed dummy implementations
+ of pure virtual functions. (See above.)
+
+=== End re-roll-in of r47738:47740 with Windows crash fixed ===
+
+2009-08-26 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: start out with a 32-bit value to avoid a shortening warning.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::sweep):
+
+2009-08-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Substantially reduced VM thrash in the GC heap.
+
+ 1.08x faster on v8 (1.60x faster on v8-splay).
+
+ 1.40x faster on bench-alloc-nonretained.
+
+ 1.90x faster on bench-alloc-retained.
+
+ SunSpider says no change.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::heapAllocate): Fixed a long-standing bug: update a few local
+ variables unconditionally after calling collect(), since they may be used
+ even if we don't "goto scan". (In the bug I saw, usedBlocks got out of
+ sync with heap.usedBlocks).
+ (JSC::Heap::sweep): Keep enough free heap space to accomodate
+ the number of objects we'll allocate before the next GC, plus 25%, for
+ good measure.
+ * runtime/Collector.h: Bumped the block size to 256k. This seems to give
+ the best cache performance, and it prevents us from initiating lots of
+ VM traffic to recover very small chunks of memory.
+
+=== Begin re-roll-in of r47738:47740 with Windows crash fixed ===
+
+2009-08-25 Drew Wilson <atwilson@google.com>
+
+ Reviewed by David Levin.
+
+ postMessage() spec now supports sending arrays of ports
+ https://bugs.webkit.org/show_bug.cgi?id=26902
+
+ Added OwnPtr to VectorTraits so we can store OwnPtrs in Vectors.
+
+ * wtf/VectorTraits.h:
+
+2009-08-26 Xan Lopez <xlopez@igalia.com>
+
+ Rubber-stamped by Gustavo Noronha.
+
+ Remove duplicated files from file list.
+
+ * GNUmakefile.am:
+
+2009-08-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ More export fixes.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Hopefully fix all the exports from JSC on windows
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fixes).
+
+ Forgot I added files to JavaScriptCore.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCoreSources.bkl:
+
+2009-08-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [ES5] Implement getOwnPropertyDescriptor
+ https://bugs.webkit.org/show_bug.cgi?id=28724
+
+ Implement the core runtime support for getOwnPropertyDescriptor.
+ This adds a virtual getOwnPropertyDescriptor method to every class
+ that implements getOwnPropertySlot that shadows the behaviour of
+ getOwnPropertySlot. The alternative would be to make getOwnPropertySlot
+ (or PropertySlots in general) provide property attribute information,
+ but quick testing showed this to be a regression.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ * runtime/Arguments.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::ArrayPrototype::getOwnPropertyDescriptor):
+ * runtime/ArrayPrototype.h:
+ * runtime/CommonIdentifiers.h:
+ * runtime/DatePrototype.cpp:
+ (JSC::DatePrototype::getOwnPropertyDescriptor):
+ * runtime/DatePrototype.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ * runtime/JSArray.h:
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::getOwnPropertyDescriptor):
+ * runtime/JSByteArray.h:
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::getOwnPropertyDescriptor):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::getOwnPropertyDescriptor):
+ * runtime/JSNotAnObject.cpp:
+ (JSC::JSNotAnObject::getOwnPropertyDescriptor):
+ * runtime/JSNotAnObject.h:
+ * runtime/JSONObject.cpp:
+ (JSC::JSONObject::getOwnPropertySlot):
+ (JSC::JSONObject::getOwnPropertyDescriptor):
+ * runtime/JSONObject.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::getOwnPropertyDescriptor):
+ (JSC::JSObject::getPropertyDescriptor):
+ * runtime/JSObject.h:
+ * runtime/JSString.cpp:
+ (JSC::JSString::getStringPropertyDescriptor):
+ (JSC::JSString::getOwnPropertyDescriptor):
+ * runtime/JSString.h:
+ * runtime/JSVariableObject.cpp:
+ (JSC::JSVariableObject::symbolTableGet):
+ * runtime/JSVariableObject.h:
+ * runtime/Lookup.h:
+ (JSC::getStaticPropertyDescriptor):
+ (JSC::getStaticFunctionDescriptor):
+ (JSC::getStaticValueDescriptor):
+ Add property descriptor equivalents of the lookup
+ table access functions
+
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::getOwnPropertySlot):
+ (JSC::MathObject::getOwnPropertyDescriptor):
+ * runtime/MathObject.h:
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::getOwnPropertyDescriptor):
+ * runtime/NumberConstructor.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ * runtime/PropertyDescriptor.cpp: Added.
+ (JSC::PropertyDescriptor::writable):
+ (JSC::PropertyDescriptor::enumerable):
+ (JSC::PropertyDescriptor::configurable):
+ (JSC::PropertyDescriptor::hasAccessors):
+ (JSC::PropertyDescriptor::setUndefined):
+ (JSC::PropertyDescriptor::getter):
+ (JSC::PropertyDescriptor::setter):
+ (JSC::PropertyDescriptor::setDescriptor):
+ (JSC::PropertyDescriptor::setAccessorDescriptor):
+ * runtime/PropertyDescriptor.h: Added.
+ (JSC::PropertyDescriptor::PropertyDescriptor):
+ (JSC::PropertyDescriptor::attributes):
+ (JSC::PropertyDescriptor::isValid):
+ (JSC::PropertyDescriptor::value):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::getOwnPropertyDescriptor):
+ * runtime/RegExpConstructor.h:
+ * runtime/RegExpMatchesArray.h:
+ (JSC::RegExpMatchesArray::getOwnPropertyDescriptor):
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::getOwnPropertyDescriptor):
+ * runtime/RegExpObject.h:
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::getOwnPropertyDescriptor):
+ * runtime/StringObject.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::getOwnPropertyDescriptor):
+ * runtime/StringPrototype.h:
+
+2009-08-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ How many copies of the parameters do you need?
+ https://bugs.webkit.org/show_bug.cgi?id=28701
+
+ The function parameters in JSC get copied a lot - and unnecessarily so.
+
+ Originally this happened due to duplicating FunctionBodyNodes on recompilation,
+ though the problem has been exacerbated by copying the parameters from the
+ original function body onto the executable, then back onto the real body that
+ will be generated (this happens on every function). And this is all made worse
+ since the data structures in question are a little ugly - C style arrays of C++
+ objects containing ref counts, so they need a full copy-construct (rather than
+ a simple memcpy).
+
+ This can all be greatly simplified by just punting the parameters off into
+ their own ref-counted object, and forgoing all the copying.
+
+ ~no performance change, possible slight progression.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::makeFunction):
+ * parser/Nodes.cpp:
+ (JSC::FunctionParameters::FunctionParameters):
+ (JSC::FunctionBodyNode::FunctionBodyNode):
+ (JSC::FunctionBodyNode::finishParsing):
+ * parser/Nodes.h:
+ (JSC::FunctionBodyNode::parameters):
+ (JSC::FunctionBodyNode::parameterCount):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::~FunctionExecutable):
+ (JSC::FunctionExecutable::compile):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::FunctionExecutable::fromGlobalCode):
+ (JSC::FunctionExecutable::paramString):
+ * runtime/Executable.h:
+ (JSC::FunctionExecutable::FunctionExecutable):
+ (JSC::FunctionExecutable::parameterCount):
+
+2009-08-25 Brent Fulgham <bfulgham@webkit.org>
+
+ Reviewed by NOBODY (Buildfix).
+
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj: Add Debug_CFLite target
+ that inherits from the debug_wincairo property sheet and therefore
+ links to the proper debug library.
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add Debug_CFLite target
+ that inherits from the debug_wincairo property sheet and therefore
+ links to the proper debug library.
+
+2009-08-25 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Export tryFastMalloc for Canvas3D work
+ https://bugs.webkit.org/show_bug.cgi?id=28018
+
+ * JavaScriptCore.exp:
+
+2009-08-25 David Levin <levin@chromium.org>
+
+ Reviewed by Adam Roben.
+
+ PLATFORM(CFNETWORK) should be USE(CFNETWORK).
+ https://bugs.webkit.org/show_bug.cgi?id=28713
+
+ * wtf/Platform.h: Added a #define to catch this issue in the
+ future. The define would generate an error on gcc without the
+ space in the expansion, but Visual C++ needs the space to cause an error.
+
+2009-08-24 Brent Fulgham <bfulgham@webkit.org>
+
+ Reviewed by Steve Falkenburg.
+
+ Revise CFLite Debug build to emit DLL's with _debug label.
+ https://bugs.webkit.org/show_bug.cgi?id=28695.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Modify
+ Cairo debug build to inherit from new debug_cairo property sheet.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops:
+ Modify to look for debug CFLite when in debug build.
+
+2009-08-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Adler & Darin Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28691
+ Do not retain ScopeNodes outside of parsing
+
+ There is now no need for these to exist outside of parsing - their use in the runtime is replaced by Executable types.
+
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ (JSC::BytecodeGenerator::emitNewFunctionExpression):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::makeFunction):
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions):
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::prepareForRepeatCall):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * parser/Nodes.cpp:
+ (JSC::ScopeNodeData::ScopeNodeData):
+ (JSC::ProgramNode::create):
+ (JSC::EvalNode::create):
+ (JSC::FunctionBodyNode::create):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::adoptData):
+ (JSC::FunctionBodyNode::parameterCount):
+ * parser/Parser.cpp:
+ * parser/Parser.h:
+ (JSC::Parser::arena):
+ (JSC::Parser::Parser):
+ (JSC::Parser::parse):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::isNumericCompareFunction):
+ (JSC::arrayProtoFuncSort):
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::evaluate):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::~FunctionExecutable):
+ (JSC::EvalExecutable::compile):
+ (JSC::ProgramExecutable::checkSyntax):
+ (JSC::ProgramExecutable::compile):
+ (JSC::FunctionExecutable::compile):
+ (JSC::EvalExecutable::generateJITCode):
+ (JSC::ProgramExecutable::generateJITCode):
+ (JSC::FunctionExecutable::generateJITCode):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ (JSC::FunctionExecutable::recompile):
+ (JSC::FunctionExecutable::fromGlobalCode):
+ (JSC::FunctionExecutable::copyParameters):
+ (JSC::FunctionExecutable::paramString):
+ * runtime/Executable.h:
+ (JSC::ScriptExecutable::ScriptExecutable):
+ (JSC::ScriptExecutable::sourceID):
+ (JSC::ScriptExecutable::sourceURL):
+ (JSC::ScriptExecutable::lineNo):
+ (JSC::ScriptExecutable::lastLine):
+ (JSC::ScriptExecutable::usesEval):
+ (JSC::ScriptExecutable::usesArguments):
+ (JSC::ScriptExecutable::needsActivation):
+ (JSC::ScriptExecutable::recordParse):
+ (JSC::EvalExecutable::bytecode):
+ (JSC::EvalExecutable::jitCode):
+ (JSC::ProgramExecutable::bytecode):
+ (JSC::ProgramExecutable::reparseExceptionInfo):
+ (JSC::ProgramExecutable::jitCode):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ (JSC::FunctionExecutable::make):
+ (JSC::FunctionExecutable::bytecode):
+ (JSC::FunctionExecutable::isGenerated):
+ (JSC::FunctionExecutable::name):
+ (JSC::FunctionExecutable::parameterCount):
+ (JSC::FunctionExecutable::jitCode):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::numericCompareFunction):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+
+2009-08-24 Darin Adler <darin@apple.com>
+
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::put): Landed revised version I had tested but forgot
+ to land. Leave out the branch, since we don't need one.
+
+2009-08-24 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Array index miss case creates a string every time
+ https://bugs.webkit.org/show_bug.cgi?id=28664
+
+ SunSpider test results I saw:
+
+ 0.5% faster overall
+ 1% faster on crypto-aes
+ 20% faster on crypto-md5
+ 13% faster on crypto-sha1
+
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype): Initialize m_hasNoPropertiesWithUInt32Names
+ to true.
+ (JSC::ObjectPrototype::put): Clearly m_hasNoPropertiesWithUInt32Names if the new
+ property has a name that is the string form of a UInt32.
+ (JSC::ObjectPrototype::getOwnPropertySlot): Don't call JSObject::getOwnPropertySlot
+ if m_hasNoPropertiesWithUInt32Names is true, and it is highly likely to be true.
+
+ * runtime/ObjectPrototype.h: Added declarations for the above.
+
+2009-08-24 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Unreviewed. Fix a typo in my distcheck build fix.
+
+ * GNUmakefile.am:
+
+2009-08-23 Gustavo Noronha Silva <gns@gnome.org>
+
+ Unreviewed build fix for make distcheck.
+
+ * GNUmakefile.am: Added files required for the build.
+
+2009-08-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ REGRESSION(r47639-r47660): Webkit crashes on launch on PowerPC
+ https://bugs.webkit.org/show_bug.cgi?id=28655
+
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction): Initialize properly with a VPtrHackExecutable.
+ * wtf/Platform.h:
+
+2009-08-22 Darin Adler <darin@apple.com>
+
+ Fix storage leak from syntax tree arena allocation patch.
+
+ * parser/Nodes.h: CommaNode needs to inherit from ParserArenaDeletable
+ because it has a vector.
+
+2009-08-21 Darin Adler <darin@apple.com>
+
+ Fix Qt build.
+
+ * parser/Nodes.cpp:
+ (JSC::ScopeNodeData::ScopeNodeData): Made non-inline again.
+ This is used outside Nodes.cpp so can't be inline unless
+ it is in the header.
+
+2009-08-21 Darin Adler <darin@apple.com>
+
+ Two loose ends from the last commit.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Made ParserArena.h
+ and create_hash_table project-internal instead of "private".
+ * runtime/Executable.h: Removed accidentally-added constructor.
+
+2009-08-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Syntax tree nodes should use arena allocation
+ https://bugs.webkit.org/show_bug.cgi?id=25674
+
+ Use an actual arena now. 0.6% speedup on SunSpider.
+
+ New and improved with 100% less leaking of the universe.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ Removed all exports involving the class FunctionBodyNode, which no
+ longer needs to be used outside JavaScriptCore.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Made Nodes.h and
+ Executable.h project-internal instead of "private".
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator): Updated since VarStack
+ contains const Identifier* now.
+
+ * parser/Grammar.y: Made identifiers from the lexer be const
+ Identifier* and updated since VarStack contains const Identifier* now.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::setCode): Pass in ParserArena, used for identifiers.
+ (JSC::Lexer::makeIdentifier): Changed return type to const Identifier*
+ and changed to call ParserArena.
+ (JSC::Lexer::clear): Removed the code to manage m_identifiers and
+ added code to set m_arena to 0.
+ * parser/Lexer.h: Updated for changes above.
+
+ * parser/NodeConstructors.h:
+ (JSC::ParserArenaFreeable::operator new): Added. Calls allocateFreeable
+ on the arena.
+ (JSC::ParserArenaDeletable::operator new): Changed to call the
+ allocateDeletable function on the arena instead of deleteWithArena.
+ (JSC::PropertyNode::PropertyNode): Added new constructor that makes
+ numeric identifiers. Some day we might want to optimize this for
+ integers so it doesn't create a string for each one.
+ (JSC::ContinueNode::ContinueNode): Initialize m_ident to nullIdentifier
+ since it's now a const Identifier& so it can't be left uninitialized.
+ (JSC::BreakNode::BreakNode): Ditto.
+ (JSC::CaseClauseNode::CaseClauseNode): Updated to use SourceElements*
+ to keep track of the statements rather than a separate statement vector.
+ (JSC::BlockNode::BlockNode): Ditto.
+ (JSC::ForInNode::ForInNode): Initialize m_ident to nullIdentifier.
+
+ * parser/Nodes.cpp: Moved the comment explaining emitBytecode in here.
+ It seemed strangely out of place in the header.
+ (JSC::ThrowableExpressionData::emitThrowError): Added an overload for
+ UString as well as Identifier.
+ (JSC::SourceElements::singleStatement): Added.
+ (JSC::SourceElements::lastStatement): Added.
+ (JSC::RegExpNode::emitBytecode): Changed the throwError code to use
+ the substitution mechanism instead of doing a string append.
+ (JSC::SourceElements::emitBytecode): Added. Replaces the old
+ statementListEmitCode function, since we now keep the SourceElements
+ objects around.
+ (JSC::BlockNode::lastStatement): Added.
+ (JSC::BlockNode::emitBytecode): Changed to use emitBytecode instead of
+ statementListEmitCode.
+ (JSC::CaseClauseNode::emitBytecode): Added.
+ (JSC::CaseBlockNode::emitBytecodeForBlock): Changed to use emitBytecode
+ instead of statementListEmitCode.
+ (JSC::ScopeNodeData::ScopeNodeData): Changed to store the
+ SourceElements* instead of using releaseContentsIntoVector.
+ (JSC::ScopeNode::emitStatementsBytecode): Added.
+ (JSC::ScopeNode::singleStatement): Added.
+ (JSC::ProgramNode::emitBytecode): Call emitStatementsBytecode instead
+ of statementListEmitCode.
+ (JSC::EvalNode::emitBytecode): Ditto.
+ (JSC::FunctionBodyNode::emitBytecode): Call emitStatementsBytecode
+ insetad of statementListEmitCode and check for the return node using
+ the new functions.
+
+ * parser/Nodes.h: Changed VarStack to store const Identifier* instead
+ of Identifier and rely on the arena to control lifetime. Added a new
+ ParserArenaFreeable class. Made ParserArenaDeletable inherit from
+ FastAllocBase instead of having its own operator new. Base the Node
+ class on ParserArenaFreeable. Changed the various Node classes
+ to use const Identifier& instead of Identifier to avoid the need to
+ call their destructors and allow them to function as "freeable" in the
+ arena. Removed extraneous JSC_FAST_CALL on definitions of inline functions.
+ Changed ElementNode, PropertyNode, ArgumentsNode, ParameterNode,
+ CaseClauseNode, ClauseListNode, and CaseBlockNode to use ParserArenaFreeable
+ as a base class since they do not descend from Node. Eliminated the
+ StatementVector type and instead have various classes use SourceElements*
+ instead of StatementVector. This prevents those classes from having to
+ use ParserArenaDeletable to make sure the vector destructor is called.
+
+ * parser/Parser.cpp:
+ (JSC::Parser::parse): Pass the arena to the lexer.
+
+ * parser/Parser.h: Added an include of ParserArena.h, which is no longer
+ included by Nodes.h.
+ (JSC::Parser::parseFunctionFromGlobalCode): Changed to use the
+ singleStatement function, since there is no longer any children function.
+ Removed some unneeded use of RefPtr.
+
+ * parser/ParserArena.cpp:
+ (JSC::ParserArena::ParserArena): Added. Initializes the new members,
+ m_freeableMemory, m_freeablePoolEnd, and m_identifiers.
+ (JSC::ParserArena::freeablePool): Added. Computes the pool pointer,
+ since we store only the current pointer and the end of pool pointer.
+ (JSC::ParserArena::deallocateObjects): Added. Contains the common
+ memory-deallocation logic used by both the destructor and the
+ reset function.
+ (JSC::ParserArena::~ParserArena): Changed to call deallocateObjects.
+ (JSC::ParserArena::reset): Ditto. Also added code to zero out the
+ new structures, and switched to use clear() instead of shrink(0) since
+ we don't really reuse arenas.
+ (JSC::ParserArena::makeNumericIdentifier): Added.
+ (JSC::ParserArena::allocateFreeablePool): Added. Used when the pool
+ is empty.
+ (JSC::ParserArena::isEmpty): Added. No longer inline, which is fine
+ since this is used only for assertions at the moment.
+ (JSC::ParserArena::derefWithArena): Make non-inline.
+
+ * parser/ParserArena.h: Added an actual arena of "freeable" objects,
+ ones that don't need destructors to be called. Also added a separate
+ IdentifierArena object, a segmented vector of identifiers that used
+ to be in the Lexer.
+
+ * runtime/Executable.h: Moved the definition of the
+ FunctionExecutable::make function here. It can't go in JSFunction.h
+ since that header has to be used outside JavaScriptCore and so can't
+ include this, which includes Nodes.h. The function could be moved
+ elswhere if we don't want to include JSFunction.h in this header, but
+ for now this seems to be the best place.
+
+ * runtime/JSFunction.h: Removed the include of Executable.h and
+ definition of the FunctionExecutable::make function.
+
+ * wtf/FastMalloc.cpp: Fixed an incorrect comment.
+
+2009-08-21 Mark Rowe <mrowe@apple.com>
+
+ Fix the non-JIT build.
+
+ * runtime/Executable.cpp:
+ * runtime/Executable.h:
+
+2009-08-21 Gavin Barraclough <barraclough@apple.com>
+
+ Speculative QuickTime build fix.
+
+ * runtime/JSArray.cpp:
+
+2009-08-21 Gavin Barraclough <barraclough@apple.com>
+
+ Speculative QT build fix.
+
+ * runtime/StringPrototype.cpp:
+
+2009-08-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Restructure Executable types so that host functions do not hold a FunctionExecutable.
+ https://bugs.webkit.org/show_bug.cgi?id=28621
+
+ All JSFunction objects have a pointer to an Executable*. This is currently always a
+ FunctionExecutable, however this has a couple of drawbacks. Host functions do not
+ store a range of information that the FunctionExecutable provides (source, name,
+ CodeBlock & information presently held on the FunctionBodyNode).
+
+ [ * nearly all... see below! ]
+
+ Instead, make JSFunctions hold a pointer to an ExecutableBase, move fields specific
+ to JS sourced executable types (source, node) into a new subclass (ScriptExecutable),
+ and create a new NativeExecutable type. We now provide a new method in JSFunction
+ to access & downcast to FunctionExecutable, but in doing so we can make an early
+ check (with an ASSERT) to ensure that the Executable read from a function will only
+ be treated as a FunctionExecutable (and thus the JS sepcific fields will only be
+ accessed) if the JSFunction is not a host function.
+
+ There is one JSFunction that currently does not have an Executable, which is the
+ object created to allow us to read out the vtable pointer. By making this change
+ we can also add a new Executable type fror this object (VPtrHackExecutable).
+ Since this means that really all JSFunctions have an Executable we no longer have
+ to null-check m_executable before us it - particularly in isHostFunction().
+
+ This patch removes CacheableEvalExecutable, since all subclasses of ExecutableBase
+ can now be ref-counted - since both JSFunction holds (and ref-counts) an ExecutableBase
+ that might be a FunctionExecutable or a NativeExecutable. This does now mean that all
+ ProgramExecutables and EvalExecutables (unnecessarily) provide an interface to be
+ ref-counted, however this seems less-bad than host functions unnecessarily providing
+ interface to access non-host specific information.
+
+ The class hierarcy has changed from this:
+
+ - ExecutableBase
+ - ProgramExecutable
+ - EvalExecutable
+ - CacheableEvalExecutable (also RefCounted by multiple-inheritance)
+ - FunctionExecutable (also RefCounted by multiple-inheritance, 'special' FunctionExecutable also used for host functions)
+
+ To this:
+
+ - RefCounted
+ - ExecutableBase
+ - NativeExecutable
+ - VPtrHackExecutable
+ - ScriptExecutable
+ - ProgramExecutable
+ - EvalExecutable
+ - FunctionExecutable
+
+ This patch speeds up sunspidey by a couple of ms (presumably due to the changes to isHostFunction()).
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::ownerExecutable):
+ (JSC::GlobalCodeBlock::GlobalCodeBlock):
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions):
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::CachedCall):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * profiler/Profiler.cpp:
+ (JSC::createCallIdentifierFromFunctionImp):
+ * runtime/Arguments.h:
+ (JSC::Arguments::getArgumentsData):
+ (JSC::Arguments::Arguments):
+ * runtime/Executable.cpp:
+ (JSC::NativeExecutable::~NativeExecutable):
+ (JSC::VPtrHackExecutable::~VPtrHackExecutable):
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::ExecutableBase):
+ (JSC::ExecutableBase::~ExecutableBase):
+ (JSC::ExecutableBase::isHostFunction):
+ (JSC::NativeExecutable::NativeExecutable):
+ (JSC::VPtrHackExecutable::VPtrHackExecutable):
+ (JSC::ScriptExecutable::ScriptExecutable):
+ (JSC::ScriptExecutable::source):
+ (JSC::ScriptExecutable::sourceID):
+ (JSC::ScriptExecutable::sourceURL):
+ (JSC::ScriptExecutable::lineNo):
+ (JSC::ScriptExecutable::lastLine):
+ (JSC::ScriptExecutable::usesEval):
+ (JSC::ScriptExecutable::usesArguments):
+ (JSC::ScriptExecutable::needsActivation):
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::EvalExecutable::create):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::~JSFunction):
+ (JSC::JSFunction::markChildren):
+ (JSC::JSFunction::getCallData):
+ (JSC::JSFunction::call):
+ (JSC::JSFunction::lengthGetter):
+ (JSC::JSFunction::getConstructData):
+ (JSC::JSFunction::construct):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::executable):
+ (JSC::JSFunction::jsExecutable):
+ (JSC::JSFunction::isHostFunction):
+
+2009-08-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Browser hangs on opening Web Inspector.
+ https://bugs.webkit.org/show_bug.cgi?id=28438
+
+ Code generation needs to be able to walk the entire scopechain in some
+ cases, however the symbol table used by activations was a member of the
+ codeblock. Following recompilation this may no longer exist, leading
+ to a crash or hang on lookup.
+
+ We fix this by introducing a refcounted SymbolTable subclass, SharedSymbolTable,
+ for the CodeBlocks used by function code. This allows activations to
+ maintain ownership of a copy of the symbol table even after recompilation so
+ they can continue to work.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::symbolTable):
+ (JSC::CodeBlock::sharedSymbolTable):
+ (JSC::GlobalCodeBlock::GlobalCodeBlock):
+ (JSC::FunctionCodeBlock::FunctionCodeBlock):
+ (JSC::FunctionCodeBlock::~FunctionCodeBlock):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::retrieveArguments):
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::generateBytecode):
+ (JSC::FunctionExecutable::generateBytecode):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::JSActivationData::JSActivationData):
+ (JSC::JSActivation::JSActivationData::~JSActivationData):
+ * runtime/SymbolTable.h:
+
+2009-08-20 Xan Lopez <xlopez@igalia.com>
+
+ Add new file to GTK+ build.
+
+ * GNUmakefile.am:
+
+2009-08-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Added a number => string cache.
+
+ 1.07x faster on v8 (1.7x faster on v8-splay).
+ 1.004x faster on SunSpider.
+
+ * runtime/JSCell.h: Moved JSValue::toString to JSString.h.
+ * runtime/JSGlobalData.h: Holds the cache.
+ * runtime/JSNumberCell.cpp:
+ (JSC::JSNumberCell::toString):
+ (JSC::JSNumberCell::toThisString): Removed -0 special case.
+ UString handles this now, since too many clients were
+ special-casing it.
+
+ * runtime/JSString.h:
+ (JSC::JSValue::toString): Use the cache when converting
+ an int or double to string.
+
+ * runtime/Operations.h:
+ (JSC::concatenateStrings): Call toString to take advantage
+ of the cache.
+
+ * runtime/SmallStrings.h:
+ (JSC::NumericStrings::add):
+ (JSC::NumericStrings::lookup): The cache.
+
+ * runtime/UString.cpp:
+ (JSC::UString::from): Added -0 special case mentioned above.
+ Removed appendNumeric because it's mutually exclusive with the
+ cache.
+
+2009-08-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION: fast/profiler/call.html is crashing occasionally
+ https://bugs.webkit.org/show_bug.cgi?id=28476
+
+ Using the codeblock for information about how many parameters and
+ locals a function has is unsafe in certain circumstances. The
+ basic scenario is all function code being cleared in response to
+ the debugger or profiler being enabled, and then an activation is
+ marked before its associated function is re-executed.
+
+ To deal with this scenario we store the variable count of a function
+ directly in the FunctionExecutable, and then use that information.
+
+ * runtime/Arguments.h:
+ (JSC::Arguments::getArgumentsData):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::generateBytecode):
+ * runtime/Executable.h:
+ (JSC::FunctionExecutable::FunctionExecutable):
+ (JSC::FunctionExecutable::variableCount):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::markChildren):
+
+2009-08-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Numbering of arguments to emitGetJITStubArg/emitPutJITStubArg incorrect
+ <bug lost in the great bug disasteroony of 08/20/09!>
+
+ The argumentNumber argument to emitGetJITStubArg/emitPutJITStubArg should match
+ the argument number used within the stub functions in JITStubs.cpp, but it doesn't.
+
+ Firstly, all the numbers changed when we added a void* 'reserved' as the first slot
+ (rather than leaving argument 0 unused), and secondly in 32_64 builds the index to
+ peek/poke needs to be multiplies by 2 (since the argument to peek/poke is a number
+ of machine words, and on 32_64 build the argument slots to stub functions are two
+ words wide).
+
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpConstructSetupArgs):
+ (JSC::JIT::compileOpCallVarargsSetupArgs):
+ (JSC::JIT::compileOpCall):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitPutJITStubArg):
+ (JSC::JIT::emitPutJITStubArgConstant):
+ (JSC::JIT::emitGetJITStubArg):
+ (JSC::JIT::emitPutJITStubArgFromVirtualRegister):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+
+2009-08-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ REGRESSION: significant slowdown on Celtic Kane "AJAX declaration" subtest
+ https://bugs.webkit.org/show_bug.cgi?id=28332
+
+ Follow up style fixes that were missed in review.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::hasTransition):
+ * runtime/Structure.h:
+ (JSC::Structure::get):
+ (JSC::StructureTransitionTable::contains):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTable::add):
+
+2009-08-20 Oliver Hunt <oliver@apple.com>
+
+ Add new exports to windows jsc build
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION: significant slowdown on Celtic Kane "AJAX declaration" subtest
+ https://bugs.webkit.org/show_bug.cgi?id=28332
+
+ The method check optimisation made transitions aware of the value being
+ assigned when a transition was assigning a function. This had the side
+ effect of making every assignment of a function expression result in a
+ new transition, and thus a new Structure. The net result of this is that
+ the common JS idiom of
+
+ function MyObject() {
+ this.myFunction = function(...){...};
+ }
+ new MyObject();
+
+ Will produce a unique structure on every iteration, meaning that all
+ caching is defeated and there is a significant amount of structure churn.
+
+ The fix is to return the transition to its original form where it is
+ keyed off a property name + attributes tuple, but have each transition
+ support an optional transition on a specific value.
+
+ * JavaScriptCore.exp:
+ * runtime/JSObject.h:
+ (JSC::JSObject::putDirectInternal):
+ * runtime/Structure.cpp:
+ (JSC::Structure::~Structure):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::hasTransition):
+ * runtime/Structure.h:
+ (JSC::Structure::transitionedFor):
+ (JSC::Structure::hasTransition):
+ (JSC::Structure::):
+ (JSC::StructureTransitionTable::contains):
+ (JSC::StructureTransitionTable::get):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTableHashTraits::emptyValue):
+ (JSC::StructureTransitionTable::hasTransition):
+ (JSC::StructureTransitionTable::remove):
+ (JSC::StructureTransitionTable::add):
+
+2009-08-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Remove FunctionCodeBlock.
+ https://bugs.webkit.org/show_bug.cgi?id=28502
+
+ These only exist to allow JIT code to dereference properties off the
+ CodeBlock for any callee, regardless of whether it is a host function.
+
+ Instead just use the FunctionExecutable. Copy the m_parameters field
+ from the CodeBlock into the Executable, and use this to distinguish
+ between host functions, functions that have been bytecompiled, and
+ functions that have not.
+
+ m_parameters is moved to ExecutableBase rather than FunctionExecutable
+ so that (as a separate change) we can move make a separate class of
+ executable for host code, which is not devived from FunctionExecutable
+ (host code does not feature any of the properties that normal executable
+ do and will provide, such as source, attributes, and a parsed name).
+
+ 1% win on v8 tests, 0.5% on sunspider.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::refStructures):
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ (JSC::CodeBlock::handlerForBytecodeOffset):
+ (JSC::CodeBlock::lineNumberForBytecodeOffset):
+ (JSC::CodeBlock::expressionRangeForBytecodeOffset):
+ (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset):
+ (JSC::CodeBlock::functionRegisterForBytecodeOffset):
+ (JSC::CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset):
+ (JSC::CodeBlock::hasGlobalResolveInfoAtBytecodeOffset):
+ * bytecode/CodeBlock.h:
+ (JSC::):
+ (JSC::CodeBlock::source):
+ (JSC::CodeBlock::sourceOffset):
+ (JSC::CodeBlock::evalCodeCache):
+ (JSC::CodeBlock::createRareDataIfNecessary):
+
+ remove NativeCodeBlocks and the NativeCode code type.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::linkCall):
+
+ Revert to previous behaviour (as currently still commented!) that Hhost functions have a null codeblock.
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpCallVarargsSetupArgs):
+ (JSC::JIT::compileOpConstructSetupArgs):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+
+ Bring the 32_64 & non-32_64 JITs into line with each other, callee in regT0.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+
+ Rewrite call trampolines to not use the CodeBlock.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+
+ Make call_JSFunction & call_arityCheck return the callee, don't expect to be passed the CodeBlock.
+
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::generateBytecode):
+ (JSC::FunctionExecutable::recompile):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::):
+ (JSC::ExecutableBase::ExecutableBase):
+ (JSC::FunctionExecutable::isHostFunction):
+
+ Add m_numParameters.
+
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::~JSFunction):
+
+ Only call generatedBytecode() on JSFunctions non-host FunctionExecutables.
+
+2009-08-20 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28054
+
+ Use a helper function to work around winscw compiler forward declaration bug
+ regarding templated classes.
+
+ Add parenthesis around (PassRefPtr::*UnspecifiedBoolType) to make winscw compiler
+ work with the default UnSpecifiedBoolType() operator, which removes the winscw
+ specific bool cast hack.
+
+ * wtf/PassRefPtr.h:
+ (WTF::derefIfNotNull):
+ (WTF::PassRefPtr::~PassRefPtr):
+
+2009-08-19 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Change namespace ARM to ARMRegisters
+ X86 to X86Registers to avoid conflict with macros
+ https://bugs.webkit.org/show_bug.cgi?id=28428
+
+ * assembler/ARMAssembler.cpp:
+ * assembler/ARMAssembler.h:
+ * assembler/ARMv7Assembler.h:
+ * assembler/MacroAssemblerARM.h:
+ * assembler/MacroAssemblerARMv7.h:
+ * assembler/MacroAssemblerX86Common.h:
+ * assembler/MacroAssemblerX86_64.h:
+ * assembler/X86Assembler.h:
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ * jit/JITInlineMethods.h:
+ * jit/JITOpcodes.cpp:
+ * wrec/WRECGenerator.cpp:
+ * wrec/WRECGenerator.h:
+ * yarr/RegexJIT.cpp:
+
+2009-08-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Devirtualise marking
+ https://bugs.webkit.org/show_bug.cgi?id=28294
+
+ We actually need to mark the value in a number object if we're using the
+ 32bit number representation.
+
+ * runtime/NumberObject.h:
+ (JSC::NumberObject::createStructure):
+
+2009-08-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ We probably shouldn't be keeping the AST for eval nodes around forevar.
+ https://bugs.webkit.org/show_bug.cgi?id=28469
+
+ EvalNodes don't destroyData() (delete their parser data) since they need to hold onto
+ their varStack. Copy a list of variable onto EvalCodeBlock, and this can go away.
+
+ * bytecode/CodeBlock.h:
+ (JSC::EvalCodeBlock::variable):
+ (JSC::EvalCodeBlock::numVariables):
+ (JSC::EvalCodeBlock::adoptVariables):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ * parser/Nodes.h:
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::generateBytecode):
+ * runtime/Executable.h:
+
+2009-08-19 Jungshik Shin <jshin@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ http://bugs.webkit.org/show_bug.cgi?id=28441
+
+ Fix a build issue with ICU 4.2 or later on Windows with Visual C++.
+ Instead of defining all isXXX and toupper/tolower as
+ WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h,
+ #define them to be different by prepending 'WTF_...ASCIIType_h' with
+ the originial names like 'toupper_WTF_...ASCIIType_h'.
+
+ * wtf/DisallowCType.h:
+
+2009-08-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Assigning a function to an object should always use the existing transition, even if the transition is not specialized
+ https://bugs.webkit.org/show_bug.cgi?id=28442
+
+ Check for an unspecialized transition as an alternative to always failing if specialisation does not match.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+
+2009-08-18 Dirk Schulze <krit@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Added additional getter to ByteArray with an unsigned char as return.
+ ByteArray can take unsigned char directly now.
+
+ * wtf/ByteArray.h:
+ (WTF::ByteArray::set):
+ (WTF::ByteArray::get):
+
+2009-08-18 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28415
+ Set svn:eol-style CRLF on all .sln and .vcproj files that don't already
+ have it.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+
+2009-08-18 Xan Lopez <xlopez@igalia.com>
+
+ Try to fix the GTK+ build.
+
+ * GNUmakefile.am:
+
+2009-08-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ No, silly runtime, AST nodes are not for you.
+
+ We still use AST nodes (ScopeNodes, particularly FunctionBodyNodes) within
+ the runtime, which means that these nodes must be persisted outside of the
+ arena, contain both parser & runtime data, etc. This is all a bit of a mess.
+
+ Move functionality into a new FunctionExecutable class.
+
+ * API/JSCallbackFunction.cpp:
+ * API/JSObjectRef.cpp:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::markAggregate):
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ (JSC::CodeBlock::lineNumberForBytecodeOffset):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::getBytecodeIndex):
+ (JSC::CodeBlock::discardBytecode):
+ (JSC::CodeBlock::instructionCount):
+ (JSC::CodeBlock::getJITCode):
+ (JSC::CodeBlock::executablePool):
+ (JSC::CodeBlock::ownerExecutable):
+ (JSC::CodeBlock::extractExceptionInfo):
+ (JSC::CodeBlock::addFunctionDecl):
+ (JSC::CodeBlock::functionDecl):
+ (JSC::CodeBlock::numberOfFunctionDecls):
+ (JSC::CodeBlock::addFunctionExpr):
+ (JSC::CodeBlock::functionExpr):
+ (JSC::GlobalCodeBlock::GlobalCodeBlock):
+ (JSC::ProgramCodeBlock::ProgramCodeBlock):
+ (JSC::EvalCodeBlock::EvalCodeBlock):
+ (JSC::FunctionCodeBlock::FunctionCodeBlock):
+ (JSC::NativeCodeBlock::NativeCodeBlock):
+ * bytecode/EvalCodeCache.h:
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingTool::doRun):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ (JSC::BytecodeGenerator::emitNewFunctionExpression):
+ * bytecompiler/BytecodeGenerator.h:
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions):
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::CachedCall):
+ * interpreter/CallFrameClosure.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::prepareForRepeatCall):
+ (JSC::Interpreter::debug):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveLastCaller):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ (JSC::JIT::compile):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::emit_op_new_func):
+ (JSC::JIT::emit_op_new_func_exp):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::):
+ * parser/Nodes.cpp:
+ (JSC::FunctionBodyNode::reparseDataIfNecessary):
+ * parser/Nodes.h:
+ (JSC::EvalNode::partialDestroyData):
+ * parser/Parser.h:
+ * profiler/ProfileGenerator.cpp:
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier):
+ (JSC::createCallIdentifierFromFunctionImp):
+ * runtime/Arguments.h:
+ (JSC::Arguments::getArgumentsData):
+ (JSC::Arguments::Arguments):
+ (JSC::JSActivation::copyRegisters):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::isNumericCompareFunction):
+ * runtime/CallData.h:
+ (JSC::):
+ * runtime/Collector.cpp:
+ (JSC::Heap::collect):
+ * runtime/ConstructData.h:
+ (JSC::):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createUndefinedVariableError):
+ (JSC::createInvalidParamError):
+ (JSC::createNotAConstructorError):
+ (JSC::createNotAFunctionError):
+ (JSC::createNotAnObjectError):
+ * runtime/Executable.cpp: Added.
+ (JSC::EvalExecutable::generateBytecode):
+ (JSC::ProgramExecutable::generateBytecode):
+ (JSC::FunctionExecutable::generateBytecode):
+ (JSC::EvalExecutable::generateJITCode):
+ (JSC::ProgramExecutable::generateJITCode):
+ (JSC::FunctionExecutable::generateJITCode):
+ (JSC::FunctionExecutable::isHostFunction):
+ (JSC::FunctionExecutable::markAggregate):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ (JSC::FunctionExecutable::recompile):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::~ExecutableBase):
+ (JSC::ExecutableBase::ExecutableBase):
+ (JSC::ExecutableBase::source):
+ (JSC::ExecutableBase::sourceID):
+ (JSC::ExecutableBase::lastLine):
+ (JSC::ExecutableBase::usesEval):
+ (JSC::ExecutableBase::usesArguments):
+ (JSC::ExecutableBase::needsActivation):
+ (JSC::ExecutableBase::astNode):
+ (JSC::ExecutableBase::generatedJITCode):
+ (JSC::ExecutableBase::getExecutablePool):
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::EvalExecutable::bytecode):
+ (JSC::EvalExecutable::varStack):
+ (JSC::EvalExecutable::evalNode):
+ (JSC::EvalExecutable::jitCode):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ (JSC::ProgramExecutable::reparseExceptionInfo):
+ (JSC::ProgramExecutable::bytecode):
+ (JSC::ProgramExecutable::programNode):
+ (JSC::ProgramExecutable::jitCode):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ (JSC::FunctionExecutable::name):
+ (JSC::FunctionExecutable::bytecode):
+ (JSC::FunctionExecutable::generatedBytecode):
+ (JSC::FunctionExecutable::usesEval):
+ (JSC::FunctionExecutable::usesArguments):
+ (JSC::FunctionExecutable::parameterCount):
+ (JSC::FunctionExecutable::paramString):
+ (JSC::FunctionExecutable::isGenerated):
+ (JSC::FunctionExecutable::body):
+ (JSC::FunctionExecutable::jitCode):
+ (JSC::FunctionExecutable::createNativeThunk):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::JSActivation):
+ (JSC::JSActivation::markChildren):
+ (JSC::JSActivation::isDynamicScope):
+ (JSC::JSActivation::argumentsGetter):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::JSActivationData::JSActivationData):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::isHostFunction):
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::~JSFunction):
+ (JSC::JSFunction::markChildren):
+ (JSC::JSFunction::getCallData):
+ (JSC::JSFunction::call):
+ (JSC::JSFunction::lengthGetter):
+ (JSC::JSFunction::getConstructData):
+ (JSC::JSFunction::construct):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::executable):
+ (JSC::FunctionExecutable::make):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::numericCompareFunction):
+ * runtime/JSGlobalData.h:
+
+2009-08-17 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fix 300,000+ leaks seen during the regression tests.
+
+ EvalCodeCache::get was heap-allocating an EvalExecutable instance without adopting the initial reference.
+ While fixing this we noticed that EvalExecutable was a RefCounted type that was sometimes stack allocated.
+ To make this cleaner and to prevent clients from attempting to ref a stack-allocated instance, we move the
+ refcounting down to a new CacheableEvalExecutable class that derives from EvalExecutable. EvalCodeCache::get
+ now uses CacheableEvalExecutable::create and avoids the leak.
+
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ * runtime/Executable.h:
+ (JSC::CacheableEvalExecutable::create):
+ (JSC::CacheableEvalExecutable::CacheableEvalExecutable):
+
+2009-08-17 Oliver Hunt <oliver@apple.com>
+
+ RS=Mark Rowe.
+
+ REGRESSION (r47292): Prototype.js is broken by ES5 Arguments changes
+ https://bugs.webkit.org/show_bug.cgi?id=28341
+ <rdar://problem/7145615>
+
+ Reverting r47292. Alas Prototype.js breaks with Arguments inheriting
+ from Array as ES5 attempted. Prototype.js defines $A in terms of a
+ function it places on (among other global objects) the Array prototype,
+ thus breaking $A for arrays.
+
+ * runtime/Arguments.h:
+ (JSC::Arguments::Arguments):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * runtime/ObjectPrototype.h:
+ * tests/mozilla/ecma_3/Function/arguments-001.js:
+
+2009-08-17 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Steve Falkenburg.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27323
+ Only add Cygwin to the path when it isn't already there. This avoids
+ causing problems for people who purposefully have non-Cygwin versions of
+ executables like svn in front of the Cygwin ones in their paths.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops:
+
+2009-08-17 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Mark Rowe.
+
+ Fix build with FAST_MALLOC_MATCH_VALIDATION enabled.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMalloc):
+ (WTF::fastCalloc):
+ (WTF::fastRealloc):
+
+2009-08-16 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Mark Rowe.
+
+ Fix crash on ./ecma_2/RegExp/exec-002.js.
+ https://bugs.webkit.org/show_bug.cgi?id=28353
+
+ Change the order of freeParenthesesDisjunctionContext and
+ popParenthesesDisjunctionContext on all call sites as the pop
+ method is accessing backTrack->lastContext which is the context
+ that is about to be freed.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::parenthesesDoBacktrack):
+ (JSC::Yarr::Interpreter::backtrackParentheses):
+
+2009-08-16 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28352
+
+ Fix coding style violations. Use m_ for C++ class members. Remove
+ trailing whitespace on empty lines.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::ParenthesesDisjunctionContext):
+ (JSC::Yarr::Interpreter::tryConsumeCharacter):
+ (JSC::Yarr::Interpreter::tryConsumeBackReference):
+ (JSC::Yarr::Interpreter::parenthesesDoBacktrack):
+ (JSC::Yarr::Interpreter::backtrackParentheses):
+ (JSC::Yarr::ByteCompiler::ByteCompiler):
+ (JSC::Yarr::ByteCompiler::compile):
+ (JSC::Yarr::ByteCompiler::checkInput):
+ (JSC::Yarr::ByteCompiler::assertionBOL):
+ (JSC::Yarr::ByteCompiler::assertionEOL):
+ (JSC::Yarr::ByteCompiler::assertionWordBoundary):
+ (JSC::Yarr::ByteCompiler::atomPatternCharacter):
+ (JSC::Yarr::ByteCompiler::atomCharacterClass):
+ (JSC::Yarr::ByteCompiler::atomBackReference):
+ (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternBegin):
+ (JSC::Yarr::ByteCompiler::atomParentheticalAssertionBegin):
+ (JSC::Yarr::ByteCompiler::popParenthesesStack):
+ (JSC::Yarr::ByteCompiler::closeAlternative):
+ (JSC::Yarr::ByteCompiler::closeBodyAlternative):
+ (JSC::Yarr::ByteCompiler::atomParenthesesEnd):
+ (JSC::Yarr::ByteCompiler::regexBegin):
+ (JSC::Yarr::ByteCompiler::alterantiveBodyDisjunction):
+ (JSC::Yarr::ByteCompiler::alterantiveDisjunction):
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+
+2009-08-15 Mark Rowe <mrowe@apple.com>
+
+ Fix the build with JIT disabled.
+
+ * runtime/Arguments.h: Only compile the jitCode method when the JIT is enabled.
+ * runtime/Executable.h: Include PrototypeFunction.h so the compiler knows what
+ NativeFunctionWrapper is when the JIT is disabled.
+
+2009-08-15 Adam Bergkvist <adam.bergkvist@ericsson.com>
+
+ Reviewed by Sam Weinig.
+
+ Added ENABLE_EVENTSOURCE flag.
+ https://bugs.webkit.org/show_bug.cgi?id=14997
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-08-14 Gavin Barraclough <barraclough@apple.com>
+
+ * parser/Parser.h:
+ (JSC::EvalExecutable::parse):
+ (JSC::ProgramExecutable::parse):
+ * runtime/Executable.h:
+
+2009-08-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Remove AST nodes from use within the Runtime (outside of parsing), stage 1
+ https://bugs.webkit.org/show_bug.cgi?id=28330
+
+ Remove the EvalNode and ProgramNode from use in the runtime. They still exist
+ after this patch, but are hidden behind EvalExecutable and FunctionExecutable,
+ and are also still reachable behind CodeBlock::m_ownerNode.
+
+ The next step will be to beat back FunctionBodyNode in the same fashion.
+ Then remove the usage via CodeBlock, then only construct these nodes only on
+ demand during bytecode generation.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.h:
+ (JSC::GlobalCodeBlock::GlobalCodeBlock):
+ (JSC::GlobalCodeBlock::~GlobalCodeBlock):
+ (JSC::ProgramCodeBlock::ProgramCodeBlock):
+ (JSC::EvalCodeBlock::EvalCodeBlock):
+ (JSC::FunctionCodeBlock::FunctionCodeBlock):
+ (JSC::NativeCodeBlock::NativeCodeBlock):
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::execute):
+ * interpreter/Interpreter.h:
+ * parser/Nodes.cpp:
+ (JSC::FunctionBodyNode::createNativeThunk):
+ (JSC::FunctionBodyNode::generateBytecode):
+ (JSC::FunctionBodyNode::bytecodeForExceptionInfoReparse):
+ * parser/Parser.h:
+ (JSC::Parser::parse):
+ (JSC::Parser::reparse):
+ (JSC::Parser::parseFunctionFromGlobalCode):
+ (JSC::::parse):
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::evaluate):
+ * runtime/Error.cpp:
+ (JSC::throwError):
+ * runtime/Error.h:
+ * runtime/Executable.h: Added.
+ (JSC::TemplateExecutable::TemplateExecutable):
+ (JSC::TemplateExecutable::markAggregate):
+ (JSC::TemplateExecutable::sourceURL):
+ (JSC::TemplateExecutable::lineNo):
+ (JSC::TemplateExecutable::bytecode):
+ (JSC::TemplateExecutable::jitCode):
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/FunctionConstructor.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::numericCompareFunction):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::~JSGlobalObject):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::codeBlocks):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+
+2009-08-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Rename the confusing isObject(<class>) to inherits(<class>).
+ It still works on non-objects, returning false.
+
+ * runtime/ArrayConstructor.cpp:
+ (JSC::arrayConstructorIsArray): Removed unneeded isObject call
+ and updated remaining isObject call to new name, inherits.
+
+ * runtime/JSCell.h: Renamed isObject(<class>) to inherits(<class>)
+ but more importantly, made it non-virtual (it was already inline)
+ so it is now as fast as JSObject::inherits was.
+
+ * runtime/JSObject.h: Removed inherits function since the one
+ in the base class is fine as-is. Also made various JSCell functions
+ that should not be called on JSObject uncallable by making them
+ both private and not implemented.
+ (JSC::JSCell::inherits): Updated name.
+ (JSC::JSValue::inherits): Ditto.
+
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncConcat):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::booleanProtoFuncToString):
+ (JSC::booleanProtoFuncValueOf):
+ * runtime/DateConstructor.cpp:
+ (JSC::constructDate):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToISOString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncToLocaleString):
+ (JSC::dateProtoFuncToLocaleDateString):
+ (JSC::dateProtoFuncToLocaleTimeString):
+ (JSC::dateProtoFuncGetTime):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetMilliSeconds):
+ (JSC::dateProtoFuncGetUTCMilliseconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::argumentsGetter):
+ * runtime/JSValue.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncTest):
+ (JSC::regExpProtoFuncExec):
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString):
+ * runtime/ScopeChain.cpp:
+ (JSC::ScopeChain::localDepth):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncToString):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ (JSC::stringProtoFuncSplit):
+ Updated to new name, inherits, from old name, isObject.
+
+2009-07-31 Harald Fernengel <harald.fernengel@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Adding QNX as a platform. Currently only tested with Qt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27885
+
+ * JavaScriptCore/runtime/Collector.cpp: Added retrieving of stack base
+ since QNX doesn't have the pthread _nt functions
+ * JavaScriptCore/wtf/Platform.h: Added WTF_PLATFORM_QNX and corresponding
+ defines
+ * WebCore/bridge/npapi.h: Build fix for missing typedefs on QNX
+
+2009-08-14 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ Currently generic ARM and ARMv7 platforms work only with JSVALUE32
+ https://bugs.webkit.org/show_bug.cgi?id=28300
+
+ * wtf/Platform.h:
+
+2009-08-14 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ Enable JIT on ARM for QT by default
+ https://bugs.webkit.org/show_bug.cgi?id=28259
+
+ * wtf/Platform.h:
+
+2009-08-14 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ Enable YARR_JIT on ARM for QT by default
+ https://bugs.webkit.org/show_bug.cgi?id=28259
+
+ * wtf/Platform.h:
+
+2009-08-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [ES5] Arguments object should inherit from Array
+ https://bugs.webkit.org/show_bug.cgi?id=28298
+
+ Make the Arguments object conform to the behaviour specified in ES5.
+ The simple portion of this is to make Arguments use Array.prototype
+ as its prototype rather than Object.prototype.
+
+ The spec then requires us to set instance.constructor to the pristine
+ Object constructor, and instance.toString and instance.toLocaleString
+ to the pristine versions from Object.prototype. To do this we now
+ make the ObjectPrototype constructor return its toString and
+ toLocaleString functions (similar to the call and apply functions
+ from FunctionPrototype).
+
+ Oddly enough this reports itself as a slight win, but given the code
+ isn't hit in the tests that claim to have improved I put this down to
+ code motion.
+
+ * runtime/Arguments.h:
+ (JSC::Arguments::Arguments):
+ (JSC::Arguments::initializeStandardProperties):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (JSC::JSGlobalObject::objectConstructor):
+ (JSC::JSGlobalObject::objectToStringFunction):
+ (JSC::JSGlobalObject::objectToLocaleStringFunction):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * runtime/ObjectPrototype.h:
+ * tests/mozilla/ecma_3/Function/arguments-001.js:
+ Update test to new es5 behaviour
+
+2009-08-14 Oliver Hunt <oliver@apple.com>
+
+ Remove MarkStack::drain from the JSC exports file
+
+ MarkStack::drain is now marked inline, the including it in the exports file
+ produces an ld warning
+
+ * JavaScriptCore.exp:
+
+2009-08-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Remove accidentally left in debugging statement.
+
+ * runtime/JSArray.h:
+ (JSC::MarkStack::drain):
+
+2009-08-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ [ES5] Implement Array.isArray
+ https://bugs.webkit.org/show_bug.cgi?id=28296
+
+ Add support for Array.isArray to the Array constructor
+
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ (JSC::arrayConstructorIsArray):
+ * runtime/ArrayConstructor.h:
+ * runtime/CommonIdentifiers.h:
+ * runtime/JSArray.h:
+ (JSC::MarkStack::drain):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+
+2009-08-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Buildfix).
+
+ Attempt to fix windows build
+
+ * runtime/Collector.cpp:
+
+2009-08-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Devirtualise marking
+ https://bugs.webkit.org/show_bug.cgi?id=28294
+
+ Add a bit to TypeInfo to indicate that an object uses the standard
+ JSObject::markChildren method. This allows us to devirtualise marking
+ of most objects (though a branch is still needed). We also add a branch
+ to identify arrays thus devirtualising marking in that case as well.
+
+ In order to make the best use of this devirtualisation I've also reworked
+ the MarkStack::drain() logic to make the iteration more efficient.
+
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructure):
+ * API/JSCallbackFunction.h:
+ (JSC::JSCallbackFunction::createStructure):
+ * JavaScriptCore.exp:
+ * runtime/BooleanObject.h:
+ (JSC::BooleanObject::createStructure):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/InternalFunction.h:
+ (JSC::InternalFunction::createStructure):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::JSAPIValueWrapper):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::markChildren):
+ * runtime/JSArray.h:
+ (JSC::JSArray::markChildrenDirect):
+ (JSC::MarkStack::drain):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::createStructure):
+ * runtime/JSCell.h:
+ (JSC::MarkStack::append):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSNumberCell.h:
+ (JSC::JSNumberCell::createStructure):
+ * runtime/JSONObject.h:
+ (JSC::JSONObject::createStructure):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::markChildren):
+ * runtime/JSObject.h:
+ (JSC::JSObject::markChildrenDirect):
+ (JSC::JSObject::createStructure):
+ * runtime/JSString.h:
+ (JSC::JSString::createStructure):
+ * runtime/JSType.h:
+ (JSC::):
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::MarkStack):
+ (JSC::MarkStack::MarkSet::MarkSet):
+ (JSC::MarkStack::MarkStackArray::last):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructure):
+ * runtime/NumberObject.h:
+ (JSC::NumberObject::createStructure):
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructure):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::createStructure):
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
+ * runtime/TypeInfo.h:
+ (JSC::TypeInfo::hasDefaultMark):
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Some small bits of housekeeping.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Make Parser.h
+ project instead of private. Remove JSONObject.lut.h.
+
+ * assembler/ARMAssembler.h: Remove unneeded WTF prefix.
+ * assembler/AssemblerBufferWithConstantPool.h: Ditto.
+ * bytecompiler/BytecodeGenerator.h: Ditto.
+
+ * wtf/SegmentedVector.h: Add a "using" statement as we do
+ with the other WTF headers.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Fix Tiger build.
+
+ * parser/Grammar.y: Use a template function so we can compile
+ setStatementLocation even if it comes before YYLTYPE is defined.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by George Staikos.
+
+ Too much use of void* in Grammar.y
+ https://bugs.webkit.org/show_bug.cgi?id=28287
+
+ * parser/Grammar.y: Changed all the helper functions to
+ take a JSGlobalData* instead of a void*. A couple formatting
+ tweaks that I missed when breaking this into pieces.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by George Staikos.
+
+ Another part of https://bugs.webkit.org/show_bug.cgi?id=28287
+
+ * parser/Grammar.y: Reduced and sorted includes. Tweaked comment
+ format. Marked a few more functions inline.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by George Staikos.
+
+ Another part of https://bugs.webkit.org/show_bug.cgi?id=28287
+
+ * parser/Grammar.y: Pass the number to the PropertyNode instead of
+ first turning it into an Identifier.
+
+ * parser/NodeConstructors.h:
+ (JSC::PropertyNode::PropertyNode): Add an overload that takes a double
+ so the code to convert to a string can be here instead of Grammar.y.
+ * parser/Nodes.h: Ditto.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by George Staikos.
+
+ Another part of https://bugs.webkit.org/show_bug.cgi?id=28287
+
+ * parser/Grammar.y: Eliminate the DBG macro.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by George Staikos.
+
+ Another part of https://bugs.webkit.org/show_bug.cgi?id=28287
+
+ * parser/Grammar.y: Eliminate the SET_EXCEPTION_LOCATION macro.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by George Staikos.
+
+ George asked me to break the patch from
+ https://bugs.webkit.org/show_bug.cgi?id=28287
+ into smaller pieces and land it in stages.
+
+ * parser/Grammar.y: Eliminate the LEXER macro.
+
+2009-08-13 Mark Rowe <mrowe@apple.com>
+
+ Try some more to fix the Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export a new symbol.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Ditto.
+
+2009-08-13 Mark Rowe <mrowe@apple.com>
+
+ Try and fix the Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export a new symbol.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Ditto.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by David Levin.
+
+ JavaScriptCore tweaks to get ready for the parser arena
+ https://bugs.webkit.org/show_bug.cgi?id=28243
+
+ Eliminate dependencies on Nodes.h outside JavaScriptCore,
+ and cut down on them inside JavaScriptCore.
+
+ Change regular expression parsing to use identifiers as
+ with other strings we parse.
+
+ Fix a couple things that are needed to use const Identifier
+ more, which will be part of the parser arena work.
+
+ * JavaScriptCore.exp: Resorted and updated.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Changed
+ CollectorHeapIterator.h to be project-internal.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitPushNewScope): Added const.
+ * bytecompiler/BytecodeGenerator.h: Ditto.
+
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions): Moved this function
+ here from WebCore. Here is better since it uses so many internals.
+ Removed unimportant optimization for the no listener case.
+ * debugger/Debugger.h: Ditto. Also removed unneeded include
+ and tweaked formatting and comments.
+
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::functionName): Call asFunction instead
+ of doing the unchecked static_cast.
+ (JSC::DebuggerCallFrame::calculatedFunctionName): Ditto.
+
+ * jit/JITStubs.cpp:
+ (JSC::op_call_JSFunction): Call isHostFunction on the body rather
+ than on the JSFunction.
+ (JSC::vm_lazyLinkCall): Ditto.
+ (JSC::op_construct_JSConstruct): Ditto.
+
+ * parser/Grammar.y: Changed callers to use new scanRegExp with
+ out arguments instead of relying on state in the Lexer. And
+ callers that just want to skip a regular expression to use
+ skipRegExp.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::scanRegExp): Changed to use out arguments, and to
+ add a prefix argument so we can add in the "=" character as needed.
+ Also rewrote to streamline the logic a bit inspired by suggestions
+ by David Levin.
+ (JSC::Lexer::skipRegExp): Added. Version of the function above that
+ does not actually put the regular expression into a string.
+ (JSC::Lexer::clear): Removed code to clear m_pattern and m_flags.
+ * parser/Lexer.h: Changed scanRegExp to have out arguments. Added
+ skipRegExp. Eliminated pattern, flags, m_pattern, and m_flags.
+
+ * parser/NodeConstructors.h:
+ (JSC::RegExpNode::RegExpNode): Changed to take const Identifier&.
+ * parser/Nodes.cpp:
+ (JSC::RegExpNode::emitBytecode): Changed since m_pattern and
+ m_flags are now Identifier instead of UString.
+ (JSC::FunctionBodyNode::make): Moved this function here instead
+ of putting it in the JSFunction.h header.
+ * parser/Nodes.h: Changed RegExpNode to use Identifier.
+
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier): Changed to use isHostFunction
+ on the body instead of on the JSFunction object.
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString): Ditto.
+
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::isHostFunction): Moved here from header.
+ (JSC::JSFunction::isHostFunctionNonInline): Added.
+ (JSC::JSFunction::JSFunction): Removed unneeded initialization of
+ m_body to 0.
+ (JSC::JSFunction::setBody): Moved here from header.
+
+ * runtime/JSFunction.h: Removed unneeded includes. Moved private
+ constructor down to the private section. Made virtual functions
+ private. Removed unneeded overload of setBody and moved the body
+ of the function into the .cpp file. Changed assertions to use
+ the non-inline version of isHostFunction.
+
+ * runtime/PropertySlot.cpp:
+ (JSC::PropertySlot::functionGetter): Use asFunction instead
+ of doing the unchecked static_cast.
+
+ * wtf/SegmentedVector.h:
+ (WTF::SegmentedVector::isEmpty): Added.
+
+2009-08-13 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Darin Adler.
+
+ Use the version of operator new that takes a JSGlobalData when allocating FuncDeclNode and FuncExprNode
+ from within the grammar to prevent these nodes from being leaked.
+
+ * parser/Grammar.y:
+
+2009-08-13 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Remove the special-case for Qt wrt JSVALUE_32 introduced in
+ r46709. It must've been a dependency issue on the bot, as
+ after a manual build all the tests pass on amd64 and ia32.
+
+ * wtf/Platform.h:
+
+2009-08-12 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Add optimize call and property access support for ARM JIT.
+ https://bugs.webkit.org/show_bug.cgi?id=24986
+
+ For tightly coupled sequences the BEGIN_UNINTERRUPTED_SEQUENCE and
+ END_UNINTERRUPTED_SEQUENCE macros have been introduced which ensure
+ space for instructions and constants of the named sequence. This
+ method is vital for those architecture which are using constant pool.
+
+ The 'latePatch' method - which was linked to JmpSrc - is replaced with
+ a port specific solution (each calls are marked to place their address
+ on the constant pool).
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::linkBranch):
+ (JSC::ARMAssembler::executableCopy): Add extra align for constant pool.
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::JmpSrc::JmpSrc):
+ (JSC::ARMAssembler::sizeOfConstantPool):
+ (JSC::ARMAssembler::jmp):
+ (JSC::ARMAssembler::linkCall):
+ * assembler/ARMv7Assembler.h:
+ * assembler/AbstractMacroAssembler.h:
+ * assembler/AssemblerBufferWithConstantPool.h:
+ (JSC::AssemblerBufferWithConstantPool::flushIfNoSpaceFor): Fix the
+ computation of the remaining space.
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::branch32):
+ (JSC::MacroAssemblerARM::nearCall):
+ (JSC::MacroAssemblerARM::call):
+ (JSC::MacroAssemblerARM::branchPtrWithPatch):
+ (JSC::MacroAssemblerARM::ensureSpace):
+ (JSC::MacroAssemblerARM::sizeOfConstantPool):
+ (JSC::MacroAssemblerARM::prepareCall):
+ * assembler/X86Assembler.h:
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::beginUninterruptedSequence):
+ (JSC::JIT::endUninterruptedSequence):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::emit_op_put_by_id):
+
+2009-08-12 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Dave Kilzer.
+
+ Disable WTF_USE_JSVALUE32_64 on iPhone for now (support not yet added for ARMv7).
+
+ * wtf/Platform.h:
+
+2009-08-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Maciej Stachoviak.
+
+ Ooops - moved code that had been accidentally added to op_new_func instead of
+ op_new_func_exp, to where it shoulds be.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * wtf/Platform.h:
+
+2009-08-12 Ada Chan <adachan@apple.com>
+
+ Added workaround for the limitation that VirtualFree with MEM_RELEASE
+ can only accept the base address returned by VirtualAlloc when the region
+ was reserved and it can only free the entire region, and not a part of it.
+
+ Reviewed by Oliver Hunt.
+
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::MarkStackArray::shrinkAllocation):
+ * runtime/MarkStackWin.cpp:
+ (JSC::MarkStack::releaseStack):
+
+2009-08-12 Balazs Kelemen <kelemen.balazs.3@stud.u-szeged.hu>
+
+ Reviewed by Ariya Hidayat.
+
+ Build fix: use std::numeric_limits<long long>::min() instead of LLONG_MIN
+ since LLONG_MIN is not defined in standard c++.
+
+ * runtime/UString.cpp:
+ (JSC::UString::from):
+
+2009-08-12 Benjamin Otte <otte@gnome.org>
+
+ Reviewed by Jan Alonzo.
+
+ Buildfix for Gtk platforms debug builds.
+
+ * GNUmakefile.am: Choose MarkStackPosix.cpp or MarkStackWin.cpp
+ depending on platform.
+
+2009-08-12 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Prospective build fix for Mac and 32-bit Windows.
+
+ * runtime/UString.cpp: Include wtf/StringExtras.h for snprintf.
+ (JSC::UString::from): Use %lld instead of %I64d for snprintf
+ on non-windows platforms.
+
+2009-08-12 Prasanth Ullattil <prasanth.ullattil@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix compile error on 64Bit Windows, when UString::from
+ is called with an intptr_t.
+
+ Added new UString::From overload with long long parameter.
+
+ Thanks to Holger for the long long idea.
+
+ * runtime/UString.cpp:
+ (JSC::UString::from):
+ * runtime/UString.h:
+
+2009-08-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Minor style fixes.
+
+ * runtime/UString.h:
+ (JSC::UString::Rep::createEmptyBuffer):
+ * wtf/FastMalloc.h:
+ (WTF::TryMallocReturnValue::getValue):
+
+2009-08-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Make it harder to misuse try* allocation routines
+ https://bugs.webkit.org/show_bug.cgi?id=27469
+
+ Jump through a few hoops to make it much harder to accidentally
+ miss null-checking of values returned by the try-* allocation
+ routines.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::increaseVectorLength):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncLink):
+ * runtime/UString.cpp:
+ (JSC::allocChars):
+ (JSC::reallocChars):
+ (JSC::expandCapacity):
+ (JSC::UString::Rep::reserveCapacity):
+ (JSC::UString::expandPreCapacity):
+ (JSC::createRep):
+ (JSC::concatenate):
+ (JSC::UString::spliceSubstringsWithSeparators):
+ (JSC::UString::replaceRange):
+ (JSC::UString::append):
+ (JSC::UString::operator=):
+ * runtime/UString.h:
+ (JSC::UString::Rep::createEmptyBuffer):
+ * wtf/FastMalloc.cpp:
+ (WTF::tryFastZeroedMalloc):
+ (WTF::tryFastMalloc):
+ (WTF::tryFastCalloc):
+ (WTF::tryFastRealloc):
+ (WTF::TCMallocStats::tryFastMalloc):
+ (WTF::TCMallocStats::tryFastCalloc):
+ (WTF::TCMallocStats::tryFastRealloc):
+ * wtf/FastMalloc.h:
+ (WTF::TryMallocReturnValue::TryMallocReturnValue):
+ (WTF::TryMallocReturnValue::~TryMallocReturnValue):
+ (WTF::TryMallocReturnValue::operator PossiblyNull<T>):
+ (WTF::TryMallocReturnValue::getValue):
+ * wtf/Platform.h:
+ * wtf/PossiblyNull.h: Added.
+ (WTF::PossiblyNull::PossiblyNull):
+ (WTF::PossiblyNull::~PossiblyNull):
+ (WTF::::getValue):
+
+2009-08-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix part deux).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-11 Gavin Barraclough <barraclough@apple.com>
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Restrict use of FuncDeclNode & FuncExprNode to the parser.
+ https://bugs.webkit.org/show_bug.cgi?id=28209
+
+ These objects were also being referenced from the CodeBlock. By changing this
+ to just retain pointers to FunctionBodyNodes these classes can be restricted to
+ use during parsing.
+
+ No performance impact (or sub-percent progression).
+
+ * JavaScriptCore.exp:
+ Update symbols.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::mark):
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::addFunction):
+ (JSC::CodeBlock::function):
+ Unify m_functions & m_functionExpressions into a single Vector<RefPtr<FuncExprNode> >.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::addConstant):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ (JSC::BytecodeGenerator::emitNewFunctionExpression):
+ * bytecompiler/BytecodeGenerator.h:
+ FunctionStacks now contain FunctionBodyNodes not FuncDeclNodes.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::privateExecute):
+ Update to reflect chnages in CodeBlock.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_new_func_exp):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::):
+ Update to reflect chnages in CodeBlock.
+
+ * parser/Grammar.y:
+ FunctionStacks now contain FunctionBodyNodes not FuncDeclNodes.
+
+ * parser/NodeConstructors.h:
+ (JSC::FuncExprNode::FuncExprNode):
+ (JSC::FuncDeclNode::FuncDeclNode):
+ * parser/Nodes.cpp:
+ (JSC::ScopeNodeData::mark):
+ (JSC::FunctionBodyNode::finishParsing):
+ * parser/Nodes.h:
+ (JSC::FunctionBodyNode::ident):
+ Move m_ident & make methods from FuncDeclNode & FuncExprNode to FunctionBodyNode.
+
+ * runtime/JSFunction.h:
+ (JSC::FunctionBodyNode::make):
+ Make this method inline (was FuncDeclNode::makeFunction).
+
+2009-08-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Native JSON.stringify does not omit functions
+ https://bugs.webkit.org/show_bug.cgi?id=28117
+
+ Objects that are callable should be treated as undefined when
+ serialising to JSON.
+
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::appendStringifiedValue):
+
+2009-08-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ REGRESSION: Hang/crash in BytecodeGenerator::constRegisterFor loading simple page
+ https://bugs.webkit.org/show_bug.cgi?id=28169
+
+ Handle the case where someone has attempted to shadow a property
+ on the global object with a constant.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::constRegisterFor):
+ * parser/Nodes.cpp:
+ (JSC::ConstDeclNode::emitCodeSingle):
+
+2009-08-11 John Gregg <johnnyg@google.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Desktop Notifications API
+ https://bugs.webkit.org/show_bug.cgi?id=25463
+
+ Adds ENABLE_NOTIFICATION flag.
+
+ * Configurations/FeatureDefines.xcconfig:
+ * wtf/Platform.h:
+
+2009-08-11 Maxime Simon <simon.maxime@gmail.com>
+
+ Reviewed by Eric Seidel.
+
+ Modifications on JavaScriptCore to allow Haiku port.
+ https://bugs.webkit.org/show_bug.cgi?id=28121
+
+ * runtime/Collector.cpp: Haiku doesn't have sys/mman.h, using OS.h instead.
+ (JSC::currentThreadStackBase): Haiku uses its own threading system.
+ * wtf/Platform.h: Defining all Haiku platform values.
+ * wtf/haiku/MainThreadHaiku.cpp: Adding a missing header (NotImplemented.h).
+
+2009-08-11 Jessie Berlin <jberlin@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Fix windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-11 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Buildfix for Qt-win platforms.
+
+ * JavaScriptCore.pri: Choose MarkStackPosix.cpp or MarkStackWin.cpp depend on platform.
+
2009-08-10 Oliver Hunt <oliver@apple.com>
Reviewed by NOBODY (And another build fix).
@@ -19,8 +5074,6 @@
2009-08-10 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Build fix).
-
Add includes needed for non-allinonefile builds
* runtime/GetterSetter.h:
@@ -28,16 +5081,12 @@
2009-08-10 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Build fix).
-
Fix export file for last build fix
* JavaScriptCore.exp:
2009-08-10 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Build fix).
-
Hoist page size initialization into platform specific code.
* jit/ExecutableAllocatorPosix.cpp:
@@ -608,8 +5657,6 @@
2009-08-04 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (build fix).
-
PPC64 Build fix
* wtf/Platform.h:
@@ -864,8 +5911,6 @@
2009-07-30 Gavin Barraclough <barraclough@apple.com>
- Reviewed by NOBODY (build fix).
-
Temporarily revert r46618 since this is b0rking on Linux.
2009-07-23 Gavin Barraclough <barraclough@apple.com>
@@ -3901,8 +8946,6 @@
2009-07-20 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Build fix).
-
Build fix attempt #2
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
@@ -3910,8 +8953,6 @@
2009-07-20 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Build fix).
-
Build fix attempt #1
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
@@ -4927,8 +9968,6 @@
2009-07-09 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Build fix).
-
* interpreter/Interpreter.cpp:
(JSC::Interpreter::privateExecute):
@@ -5563,8 +10602,6 @@
2009-06-21 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Build fix).
-
Remove dead code.
* runtime/LiteralParser.cpp:
diff --git a/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/JavaScriptCore/Configurations/FeatureDefines.xcconfig
index 10328e8..ed387aa 100644
--- a/JavaScriptCore/Configurations/FeatureDefines.xcconfig
+++ b/JavaScriptCore/Configurations/FeatureDefines.xcconfig
@@ -28,6 +28,10 @@
// Set any ENABLE_FEATURE_NAME macro to an empty string to disable that feature.
+ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(MAC_OS_X_VERSION_MAJOR));
+ENABLE_3D_CANVAS_1050 = ENABLE_3D_CANVAS;
+ENABLE_3D_CANVAS_1060 = ENABLE_3D_CANVAS;
+
ENABLE_3D_RENDERING = $(ENABLE_3D_RENDERING_$(MAC_OS_X_VERSION_MAJOR));
ENABLE_3D_RENDERING_1050 = ENABLE_3D_RENDERING;
ENABLE_3D_RENDERING_1060 = ENABLE_3D_RENDERING;
@@ -35,14 +39,18 @@ ENABLE_3D_RENDERING_1060 = ENABLE_3D_RENDERING;
ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING;
ENABLE_DATABASE = ENABLE_DATABASE;
ENABLE_DATAGRID = ENABLE_DATAGRID;
+ENABLE_DATALIST = ENABLE_DATALIST;
ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE;
+ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE;
ENABLE_FILTERS = ;
ENABLE_GEOLOCATION = ;
ENABLE_ICONDATABASE = ENABLE_ICONDATABASE;
ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER;
+ENABLE_MATHML = ;
+ENABLE_NOTIFICATIONS = ;
ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS;
ENABLE_RUBY = ENABLE_RUBY;
-ENABLE_SHARED_WORKERS = ;
+ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS;
ENABLE_SVG = ENABLE_SVG;
ENABLE_SVG_ANIMATION = ENABLE_SVG_ANIMATION;
ENABLE_SVG_AS_IMAGE = ENABLE_SVG_AS_IMAGE;
@@ -57,4 +65,4 @@ ENABLE_WORKERS = ENABLE_WORKERS;
ENABLE_XPATH = ENABLE_XPATH;
ENABLE_XSLT = ENABLE_XSLT;
-FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DOM_STORAGE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT);
diff --git a/JavaScriptCore/Configurations/Version.xcconfig b/JavaScriptCore/Configurations/Version.xcconfig
index d07d57f..66d574b 100644
--- a/JavaScriptCore/Configurations/Version.xcconfig
+++ b/JavaScriptCore/Configurations/Version.xcconfig
@@ -22,7 +22,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MAJOR_VERSION = 532;
-MINOR_VERSION = 0;
+MINOR_VERSION = 2;
TINY_VERSION = 0;
FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION);
diff --git a/JavaScriptCore/GNUmakefile.am b/JavaScriptCore/GNUmakefile.am
index 6b4dc6d..32e2642 100644
--- a/JavaScriptCore/GNUmakefile.am
+++ b/JavaScriptCore/GNUmakefile.am
@@ -96,8 +96,6 @@ javascriptcore_sources += \
JavaScriptCore/bytecode/JumpTable.cpp \
JavaScriptCore/bytecode/JumpTable.h \
JavaScriptCore/bytecode/EvalCodeCache.h \
- JavaScriptCore/runtime/ExceptionHelpers.cpp \
- JavaScriptCore/runtime/ExceptionHelpers.h \
JavaScriptCore/bytecode/Instruction.h \
JavaScriptCore/bytecompiler/Label.h \
JavaScriptCore/interpreter/Interpreter.cpp \
@@ -173,8 +171,10 @@ javascriptcore_sources += \
JavaScriptCore/interpreter/CallFrame.cpp \
JavaScriptCore/interpreter/CallFrame.h \
JavaScriptCore/interpreter/CallFrameClosure.h \
- JavaScriptCore/runtime/TimeoutChecker.cpp \
- JavaScriptCore/runtime/TimeoutChecker.h \
+ JavaScriptCore/runtime/ExceptionHelpers.cpp \
+ JavaScriptCore/runtime/ExceptionHelpers.h \
+ JavaScriptCore/runtime/Executable.cpp \
+ JavaScriptCore/runtime/Executable.h \
JavaScriptCore/runtime/InitializeThreading.cpp \
JavaScriptCore/runtime/InitializeThreading.h \
JavaScriptCore/runtime/JSActivation.cpp \
@@ -193,7 +193,9 @@ javascriptcore_sources += \
JavaScriptCore/runtime/LiteralParser.h \
JavaScriptCore/runtime/MarkStack.cpp \
JavaScriptCore/runtime/MarkStack.h \
- JavaScriptCore/runtime/MarkStackPosix.cpp \
+ JavaScriptCore/runtime/NumericStrings.h \
+ JavaScriptCore/runtime/PropertyDescriptor.h \
+ JavaScriptCore/runtime/PropertyDescriptor.cpp \
JavaScriptCore/runtime/SmallStrings.cpp \
JavaScriptCore/runtime/SmallStrings.h \
JavaScriptCore/runtime/Structure.cpp \
@@ -201,7 +203,9 @@ javascriptcore_sources += \
JavaScriptCore/runtime/StructureChain.cpp \
JavaScriptCore/runtime/StructureChain.h \
JavaScriptCore/runtime/StructureTransitionTable.h \
- JavaScriptCore/runtime/TypeInfo.h \
+ JavaScriptCore/runtime/TimeoutChecker.cpp \
+ JavaScriptCore/runtime/TimeoutChecker.h \
+ JavaScriptCore/runtime/JSTypeInfo.h \
JavaScriptCore/wrec/CharacterClass.h \
JavaScriptCore/wrec/CharacterClassConstructor.h \
JavaScriptCore/wrec/Escapes.h \
@@ -252,6 +256,7 @@ javascriptcore_sources += \
JavaScriptCore/wtf/PassOwnPtr.h \
JavaScriptCore/wtf/PassRefPtr.h \
JavaScriptCore/wtf/Platform.h \
+ JavaScriptCore/wtf/PossiblyNull.h \
JavaScriptCore/wtf/PtrAndFlags.h \
JavaScriptCore/wtf/RandomNumber.cpp \
JavaScriptCore/wtf/RandomNumber.h \
@@ -288,10 +293,12 @@ javascriptcore_sources += \
if TARGET_WIN32
javascriptcore_sources += \
JavaScriptCore/wtf/ThreadSpecificWin.cpp \
- JavaScriptCore/jit/ExecutableAllocatorWin.cpp
+ JavaScriptCore/jit/ExecutableAllocatorWin.cpp \
+ JavaScriptCore/runtime/MarkStackWin.cpp
else
javascriptcore_sources += \
- JavaScriptCore/jit/ExecutableAllocatorPosix.cpp
+ JavaScriptCore/jit/ExecutableAllocatorPosix.cpp \
+ JavaScriptCore/runtime/MarkStackPosix.cpp
endif
# ----
@@ -439,9 +446,6 @@ javascriptcore_sources += \
JavaScriptCore/runtime/JSWrapperObject.h \
JavaScriptCore/runtime/Lookup.cpp \
JavaScriptCore/runtime/Lookup.h \
- JavaScriptCore/runtime/MarkStack.cpp \
- JavaScriptCore/runtime/MarkStack.h \
- JavaScriptCore/runtime/MarkStackWin.cpp \
JavaScriptCore/runtime/MathObject.cpp \
JavaScriptCore/runtime/MathObject.h \
JavaScriptCore/runtime/NativeErrorConstructor.cpp \
diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp
index 3a2acd7..2934655 100644
--- a/JavaScriptCore/JavaScriptCore.exp
+++ b/JavaScriptCore/JavaScriptCore.exp
@@ -95,32 +95,34 @@ __ZN3JSC10Identifier24checkSameIdentifierTableEPNS_12JSGlobalDataEPNS_7UString3R
__ZN3JSC10Identifier24checkSameIdentifierTableEPNS_9ExecStateEPNS_7UString3RepE
__ZN3JSC10Identifier3addEPNS_9ExecStateEPKc
__ZN3JSC10Identifier5equalEPKNS_7UString3RepEPKc
-__ZN3JSC10JSFunction4infoE
-__ZN3JSC10JSFunctionC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectESA_RKNS_7ArgListEE
+__ZN3JSC10JSFunctionC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectESA_RKNS_7ArgListEE
__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeE
__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeEPKc
__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeERKNS_7UStringE
__ZN3JSC11JSByteArray15createStructureENS_7JSValueE
-__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPNS3_9ByteArrayEPKNS_9ClassInfoE
+__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS3_9ByteArrayEPKNS_9ClassInfoE
__ZN3JSC11ParserArena5resetEv
__ZN3JSC11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeE
__ZN3JSC12DateInstance4infoE
+__ZN3JSC12DateInstanceC1EPNS_9ExecStateEd
__ZN3JSC12JSGlobalData10ClientDataD2Ev
__ZN3JSC12JSGlobalData12createLeakedEv
+__ZN3JSC12JSGlobalData12stopSamplingEv
+__ZN3JSC12JSGlobalData13startSamplingEv
+__ZN3JSC12JSGlobalData14dumpSampleDataEPNS_9ExecStateE
__ZN3JSC12JSGlobalData14sharedInstanceEv
__ZN3JSC12JSGlobalData6createEb
__ZN3JSC12JSGlobalDataD1Ev
-__ZN3JSC12SamplingTool4dumpEPNS_9ExecStateE
__ZN3JSC12SamplingTool5setupEv
__ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE
__ZN3JSC12StringObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
-__ZN3JSC12StringObject14toThisJSStringEPNS_9ExecStateE
-__ZN3JSC12StringObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
__ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
__ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+__ZN3JSC12StringObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
+__ZN3JSC12StringObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
__ZN3JSC12StringObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
__ZN3JSC12StringObject4infoE
-__ZN3JSC12StringObjectC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEERKNS_7UStringE
+__ZN3JSC12StringObjectC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_7UStringE
__ZN3JSC12jsNumberCellEPNS_9ExecStateEd
__ZN3JSC12nonInlineNaNEv
__ZN3JSC13SamplingFlags4stopEv
@@ -129,53 +131,60 @@ __ZN3JSC13SamplingFlags7s_flagsE
__ZN3JSC13StatementNode6setLocEii
__ZN3JSC13jsOwnedStringEPNS_12JSGlobalDataERKNS_7UStringE
__ZN3JSC14JSGlobalObject10globalExecEv
-__ZN3JSC14JSGlobalObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectE
-__ZN3JSC14JSGlobalObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectE
+__ZN3JSC14JSGlobalObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectEj
+__ZN3JSC14JSGlobalObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectEj
__ZN3JSC14JSGlobalObject12markChildrenERNS_9MarkStackE
__ZN3JSC14JSGlobalObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj
+__ZN3JSC14JSGlobalObject25destroyJSGlobalObjectDataEPv
__ZN3JSC14JSGlobalObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
__ZN3JSC14JSGlobalObject4initEPNS_8JSObjectE
__ZN3JSC14JSGlobalObjectD2Ev
__ZN3JSC14JSGlobalObjectnwEmPNS_12JSGlobalDataE
__ZN3JSC14SamplingThread4stopEv
__ZN3JSC14SamplingThread5startEj
+__ZN3JSC14TimeoutChecker10didTimeOutEPNS_9ExecStateE
__ZN3JSC14TimeoutChecker5resetEv
-__ZN3JSC14constructArrayEPNS_9ExecStateERKNS_7ArgListE
+__ZN3JSC15createTypeErrorEPNS_9ExecStateEPKc
__ZN3JSC15JSWrapperObject12markChildrenERNS_9MarkStackE
__ZN3JSC15toInt32SlowCaseEdRb
-__ZN3JSC16FunctionBodyNode13finishParsingEPNS_10IdentifierEm
-__ZN3JSC16FunctionBodyNode14copyParametersEv
-__ZN3JSC16FunctionBodyNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm0EEEPNS6_IPNS_12FuncDeclNodeELm0EEERKNS_10SourceCodeEji
__ZN3JSC16InternalFunction4infoE
__ZN3JSC16InternalFunction4nameEPNS_12JSGlobalDataE
-__ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEN3WTF10PassRefPtrINS_9StructureEEERKNS_10IdentifierE
+__ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_10IdentifierE
__ZN3JSC16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
-__ZN3JSC16JSVariableObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
+__ZN3JSC16JSVariableObject14symbolTableGetERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC16JSVariableObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
__ZN3JSC16toUInt32SlowCaseEdRb
__ZN3JSC17BytecodeGenerator21setDumpsGeneratedCodeEb
__ZN3JSC17PropertyNameArray3addEPNS_7UString3RepE
-__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectESA_RKNS_7ArgListEE
+__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectESA_RKNS_7ArgListEE
__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectES6_RKNS_7ArgListEE
__ZN3JSC17constructFunctionEPNS_9ExecStateERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
__ZN3JSC18DebuggerActivationC1EPNS_8JSObjectE
-__ZN3JSC19constructEmptyArrayEPNS_9ExecStateE
+__ZN3JSC18PropertyDescriptor11setWritableEb
+__ZN3JSC18PropertyDescriptor12setUndefinedEv
+__ZN3JSC18PropertyDescriptor13setDescriptorENS_7JSValueEj
+__ZN3JSC18PropertyDescriptor13setEnumerableEb
+__ZN3JSC18PropertyDescriptor15setConfigurableEb
+__ZN3JSC18PropertyDescriptor17defaultAttributesE
+__ZN3JSC18PropertyDescriptor21setAccessorDescriptorENS_7JSValueES1_j
+__ZN3JSC18PropertyDescriptor9setGetterENS_7JSValueE
+__ZN3JSC18PropertyDescriptor9setSetterENS_7JSValueE
__ZN3JSC19initializeThreadingEv
__ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE
-__ZN3JSC20constructEmptyObjectEPNS_9ExecStateE
__ZN3JSC23AbstractSamplingCounter4dumpEv
__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
__ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC24createStackOverflowErrorEPNS_9ExecStateE
__ZN3JSC25evaluateInGlobalCallFrameERKNS_7UStringERNS_7JSValueEPNS_14JSGlobalObjectE
+__ZN3JSC35createInterruptedExecutionExceptionEPNS_12JSGlobalDataE
__ZN3JSC4Heap11objectCountEv
__ZN3JSC4Heap14primaryHeapEndEv
__ZN3JSC4Heap15recordExtraCostEm
__ZN3JSC4Heap16primaryHeapBeginEv
__ZN3JSC4Heap17globalObjectCountEv
__ZN3JSC4Heap20protectedObjectCountEv
-__ZN3JSC4Heap24setGCProtectNeedsLockingEv
__ZN3JSC4Heap25protectedObjectTypeCountsEv
__ZN3JSC4Heap26protectedGlobalObjectCountEv
-__ZN3JSC4Heap4heapENS_7JSValueE
__ZN3JSC4Heap6isBusyEv
__ZN3JSC4Heap7collectEv
__ZN3JSC4Heap7destroyEv
@@ -192,12 +201,13 @@ __ZN3JSC6JSCell14toThisJSStringEPNS_9ExecStateE
__ZN3JSC6JSCell16getConstructDataERNS_13ConstructDataE
__ZN3JSC6JSCell18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
__ZN3JSC6JSCell18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+__ZN3JSC6JSCell18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE
__ZN3JSC6JSCell3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
__ZN3JSC6JSCell3putEPNS_9ExecStateEjNS_7JSValueE
__ZN3JSC6JSCell9getObjectEv
__ZN3JSC6JSCellnwEmPNS_9ExecStateE
-__ZN3JSC6JSLock12DropAllLocksC1EPNS_9ExecStateE
__ZN3JSC6JSLock12DropAllLocksC1ENS_14JSLockBehaviorE
+__ZN3JSC6JSLock12DropAllLocksC1EPNS_9ExecStateE
__ZN3JSC6JSLock12DropAllLocksD1Ev
__ZN3JSC6JSLock4lockENS_14JSLockBehaviorE
__ZN3JSC6JSLock6unlockENS_14JSLockBehaviorE
@@ -207,6 +217,9 @@ __ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE
__ZN3JSC7CStringD1Ev
__ZN3JSC7CStringaSERKS0_
__ZN3JSC7JSArray4infoE
+__ZN3JSC7JSArray9setLengthEj
+__ZN3JSC7JSArrayC1EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC7JSArrayC1EN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_7ArgListE
__ZN3JSC7Profile10restoreAllEv
__ZN3JSC7Profile5focusEPKNS_11ProfileNodeE
__ZN3JSC7Profile7excludeEPKNS_11ProfileNodeE
@@ -227,13 +240,13 @@ __ZN3JSC7UString6appendERKS0_
__ZN3JSC7UStringC1EPKc
__ZN3JSC7UStringC1EPKti
__ZN3JSC7UStringaSEPKc
+__ZN3JSC8Debugger23recompileAllJSFunctionsEPNS_12JSGlobalDataE
__ZN3JSC8Debugger6attachEPNS_14JSGlobalObjectE
__ZN3JSC8Debugger6detachEPNS_14JSGlobalObjectE
-__ZN3JSC8DebuggerC2Ev
__ZN3JSC8DebuggerD2Ev
__ZN3JSC8JSObject11hasInstanceEPNS_9ExecStateENS_7JSValueES3_
-__ZN3JSC8JSObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPS0_
-__ZN3JSC8JSObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPS0_
+__ZN3JSC8JSObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPS0_j
+__ZN3JSC8JSObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPS0_j
__ZN3JSC8JSObject12lookupGetterEPNS_9ExecStateERKNS_10IdentifierE
__ZN3JSC8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE
__ZN3JSC8JSObject12markChildrenERNS_9MarkStackE
@@ -242,14 +255,18 @@ __ZN3JSC8JSObject14deletePropertyEPNS_9ExecStateEj
__ZN3JSC8JSObject15unwrappedObjectEv
__ZN3JSC8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
__ZN3JSC8JSObject17createInheritorIDEv
+__ZN3JSC8JSObject17defineOwnPropertyEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb
__ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_16InternalFunctionEj
__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj
__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEjbRNS_15PutPropertySlotE
__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateEjNS_7JSValueEj
__ZN3JSC8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3JSC8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE
+__ZN3JSC8JSObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
+__ZN3JSC8JSObject21getPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
__ZN3JSC8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPNS_7JSValueE
__ZN3JSC8JSObject23allocatePropertyStorageEmm
+__ZN3JSC8JSObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
__ZN3JSC8JSObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
__ZN3JSC8JSObject3putEPNS_9ExecStateEjNS_7JSValueE
__ZN3JSC8Profiler13stopProfilingEPNS_9ExecStateERKNS_7UStringE
@@ -263,11 +280,13 @@ __ZN3JSC9MarkStack10s_pageSizeE
__ZN3JSC9MarkStack12releaseStackEPvm
__ZN3JSC9MarkStack13allocateStackEm
__ZN3JSC9MarkStack18initializePagesizeEv
+__ZN3JSC9Structure13hasTransitionEPNS_7UString3RepEj
__ZN3JSC9Structure17stopIgnoringLeaksEv
__ZN3JSC9Structure18startIgnoringLeaksEv
__ZN3JSC9Structure21addPropertyTransitionEPS0_RKNS_10IdentifierEjPNS_6JSCellERm
__ZN3JSC9Structure22materializePropertyMapEv
__ZN3JSC9Structure25changePrototypeTransitionEPS0_NS_7JSValueE
+__ZN3JSC9Structure27addAnonymousSlotsTransitionEPS0_j
__ZN3JSC9Structure27despecifyDictionaryFunctionERKNS_10IdentifierE
__ZN3JSC9Structure27despecifyFunctionTransitionEPS0_RKNS_10IdentifierE
__ZN3JSC9Structure28addPropertyWithoutTransitionERKNS_10IdentifierEjPNS_6JSCellE
@@ -290,6 +309,7 @@ __ZN3WTF12isMainThreadEv
__ZN3WTF12randomNumberEv
__ZN3WTF13currentThreadEv
__ZN3WTF13tryFastCallocEmm
+__ZN3WTF13tryFastMallocEm
__ZN3WTF15ThreadCondition4waitERNS_5MutexE
__ZN3WTF15ThreadCondition6signalEv
__ZN3WTF15ThreadCondition9broadcastEv
@@ -324,14 +344,11 @@ __ZN3WTF8CollatorC1EPKc
__ZN3WTF8CollatorD1Ev
__ZN3WTF8fastFreeEPv
__ZN3WTF9ByteArray6createEm
+__ZNK3JSC10JSFunction23isHostFunctionNonInlineEv
__ZNK3JSC11Interpreter14retrieveCallerEPNS_9ExecStateEPNS_16InternalFunctionE
__ZNK3JSC11Interpreter18retrieveLastCallerEPNS_9ExecStateERiRlRNS_7UStringERNS_7JSValueE
__ZNK3JSC12DateInstance7getTimeERdRi
-__ZNK3JSC12StringObject12toThisStringEPNS_9ExecStateE
-__ZNK3JSC12StringObject8toStringEPNS_9ExecStateE
__ZNK3JSC14JSGlobalObject14isDynamicScopeEv
-
-__ZNK3JSC16FunctionBodyNode14isHostFunctionEv
__ZNK3JSC16InternalFunction9classInfoEv
__ZNK3JSC16JSVariableObject16isVariableObjectEv
__ZNK3JSC16JSVariableObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj
@@ -340,14 +357,26 @@ __ZNK3JSC17DebuggerCallFrame12functionNameEv
__ZNK3JSC17DebuggerCallFrame22calculatedFunctionNameEv
__ZNK3JSC17DebuggerCallFrame4typeEv
__ZNK3JSC17DebuggerCallFrame8evaluateERKNS_7UStringERNS_7JSValueE
+__ZNK3JSC18PropertyDescriptor10enumerableEv
+__ZNK3JSC18PropertyDescriptor12configurableEv
+__ZNK3JSC18PropertyDescriptor16isDataDescriptorEv
+__ZNK3JSC18PropertyDescriptor20isAccessorDescriptorEv
+__ZNK3JSC18PropertyDescriptor6getterEv
+__ZNK3JSC18PropertyDescriptor6setterEv
+__ZNK3JSC18PropertyDescriptor8writableEv
__ZNK3JSC4Heap10statisticsEv
+__ZNK3JSC6JSCell11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
__ZNK3JSC6JSCell12toThisObjectEPNS_9ExecStateE
__ZNK3JSC6JSCell12toThisStringEPNS_9ExecStateE
__ZNK3JSC6JSCell14isGetterSetterEv
+__ZNK3JSC6JSCell8toNumberEPNS_9ExecStateE
+__ZNK3JSC6JSCell8toObjectEPNS_9ExecStateE
+__ZNK3JSC6JSCell8toStringEPNS_9ExecStateE
__ZNK3JSC6JSCell9classInfoEv
__ZNK3JSC6JSCell9getStringERNS_7UStringE
__ZNK3JSC6JSCell9getStringEv
__ZNK3JSC6JSCell9getUInt32ERj
+__ZNK3JSC6JSCell9toBooleanEPNS_9ExecStateE
__ZNK3JSC7ArgList8getSliceEiRS0_
__ZNK3JSC7JSValue16toObjectSlowCaseEPNS_9ExecStateE
__ZNK3JSC7JSValue19synthesizePrototypeEPNS_9ExecStateE
@@ -378,7 +407,7 @@ __ZTVN3JSC14JSGlobalObjectE
__ZTVN3JSC15JSWrapperObjectE
__ZTVN3JSC16InternalFunctionE
__ZTVN3JSC16JSVariableObjectE
-__ZTVN3JSC17JSAPIValueWrapperE
+__ZTVN3JSC8DebuggerE
__ZTVN3JSC8JSObjectE
__ZTVN3JSC8JSStringE
_jscore_fastmalloc_introspection
diff --git a/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp b/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp
new file mode 100644
index 0000000..88fe484
--- /dev/null
+++ b/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp
@@ -0,0 +1,205 @@
+#
+# Copyright (C) 2009 Google 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:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * 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.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "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 THE COPYRIGHT
+# OWNER 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.
+#
+
+{
+ 'includes': [
+ # FIXME: Sense whether upstream or downstream build, and
+ # include the right features.gypi
+ '../../WebKit/chromium/features.gypi',
+ '../JavaScriptCore.gypi',
+ ],
+ 'variables': {
+ # Location of the chromium src directory.
+ 'conditions': [
+ ['inside_chromium_build==0', {
+ # Webkit is being built outside of the full chromium project.
+ 'chromium_src_dir': '../../WebKit/chromium',
+ },{
+ # WebKit is checked out in src/chromium/third_party/WebKit
+ 'chromium_src_dir': '../../../..',
+ }],
+ ],
+ },
+ 'targets': [
+ {
+ # This target sets up defines and includes that are required by WTF and
+ # its dependents.
+ 'target_name': 'wtf_config',
+ 'type': 'none',
+ 'msvs_guid': '2E2D3301-2EC4-4C0F-B889-87073B30F673',
+ 'direct_dependent_settings': {
+ 'defines': [
+ # Import features_defines from features.gypi
+ '<@(feature_defines)',
+
+ # Turns on #if PLATFORM(CHROMIUM)
+ 'BUILDING_CHROMIUM__=1',
+ # Controls wtf/FastMalloc
+ # FIXME: consider moving into config.h
+ 'USE_SYSTEM_MALLOC=1',
+ ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'defines': [
+ '__STD_C',
+ '_CRT_SECURE_NO_DEPRECATE',
+ '_SCL_SECURE_NO_DEPRECATE',
+ 'CRASH=__debugbreak',
+ ],
+ 'include_dirs': [
+ '../os-win32',
+ '<(chromium_src_dir)/webkit/build/JavaScriptCore',
+ ],
+ }],
+ ['OS=="mac"', {
+ 'defines': [
+ # Ensure that only Leopard features are used when doing the
+ # Mac build.
+ 'BUILDING_ON_LEOPARD',
+
+ # Use USE_NEW_THEME on Mac.
+ 'WTF_USE_NEW_THEME=1',
+ ],
+ }],
+ ['OS=="linux" or OS=="freebsd"', {
+ 'defines': [
+ 'WTF_USE_PTHREADS=1',
+ ],
+ }],
+ ],
+ }
+ },
+ {
+ 'target_name': 'wtf',
+ 'type': '<(library)',
+ 'msvs_guid': 'AA8A5A85-592B-4357-BC60-E0E91E026AF6',
+ 'dependencies': [
+ 'wtf_config',
+ '<(chromium_src_dir)/third_party/icu/icu.gyp:icui18n',
+ '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc',
+ ],
+ 'include_dirs': [
+ '../',
+ '../wtf',
+ '../wtf/unicode',
+ ],
+ 'sources': [
+ '<@(javascriptcore_files)',
+ ],
+ 'sources/': [
+ # First exclude everything ...
+ ['exclude', '../'],
+ # ... Then include what we want.
+ ['include', '../wtf/'],
+ # GLib/GTK, even though its name doesn't really indicate.
+ ['exclude', '/(GOwnPtr|glib/.*)\\.(cpp|h)$'],
+ ['exclude', '(Default|Gtk|Mac|None|Qt|Win|Wx)\\.(cpp|mm)$'],
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '../',
+ '../wtf',
+ ],
+ },
+ 'export_dependent_settings': [
+ 'wtf_config',
+ '<(chromium_src_dir)/third_party/icu/icu.gyp:icui18n',
+ '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc',
+ ],
+ 'msvs_disabled_warnings': [4127, 4355, 4510, 4512, 4610, 4706],
+ 'conditions': [
+ ['OS=="win"', {
+ 'sources/': [
+ ['exclude', 'ThreadingPthreads\\.cpp$'],
+ ['include', 'Thread(ing|Specific)Win\\.cpp$']
+ ],
+ 'include_dirs': [
+ '<(chromium_src_dir)/webkit/build',
+ '../kjs',
+ '../API',
+ # These 3 do not seem to exist.
+ '../bindings',
+ '../bindings/c',
+ '../bindings/jni',
+ # FIXME: removed these - don't seem to exist
+ 'pending',
+ 'pending/wtf',
+ ],
+ 'include_dirs!': [
+ '<(SHARED_INTERMEDIATE_DIR)/webkit',
+ ],
+ }],
+ ],
+ },
+ {
+ 'target_name': 'pcre',
+ 'type': '<(library)',
+ 'dependencies': [
+ 'wtf',
+ ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'dependencies': ['<(chromium_src_dir)/build/win/system.gyp:cygwin'],
+ }],
+ ],
+ 'msvs_guid': '49909552-0B0C-4C14-8CF6-DB8A2ADE0934',
+ 'actions': [
+ {
+ 'action_name': 'dftables',
+ 'inputs': [
+ '../pcre/dftables',
+ ],
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/chartables.c',
+ ],
+ 'action': ['perl', '-w', '<@(_inputs)', '<@(_outputs)'],
+ },
+ ],
+ 'include_dirs': [
+ '<(INTERMEDIATE_DIR)',
+ ],
+ 'sources': [
+ '<@(javascriptcore_files)',
+ ],
+ 'sources/': [
+ # First exclude everything ...
+ ['exclude', '../'],
+ # ... Then include what we want.
+ ['include', '../pcre/'],
+ # ucptable.cpp is #included by pcre_ucp_searchfunchs.cpp and is not
+ # intended to be compiled directly.
+ ['exclude', '../pcre/ucptable.cpp$'],
+ ],
+ 'export_dependent_settings': [
+ 'wtf',
+ ],
+ },
+ ], # targets
+}
diff --git a/JavaScriptCore/JavaScriptCore.gypi b/JavaScriptCore/JavaScriptCore.gypi
index 462c38f..15a0c0f 100644
--- a/JavaScriptCore/JavaScriptCore.gypi
+++ b/JavaScriptCore/JavaScriptCore.gypi
@@ -255,6 +255,7 @@
'runtime/JSString.cpp',
'runtime/JSString.h',
'runtime/JSType.h',
+ 'runtime/JSTypeInfo.h',
'runtime/JSValue.cpp',
'runtime/JSValue.h',
'runtime/JSVariableObject.cpp',
@@ -287,6 +288,8 @@
'runtime/ObjectPrototype.h',
'runtime/Operations.cpp',
'runtime/Operations.h',
+ 'runtime/PropertyDescriptor.cpp',
+ 'runtime/PropertyDescriptor.h',
'runtime/PropertyMapHashTable.h',
'runtime/PropertyNameArray.cpp',
'runtime/PropertyNameArray.h',
@@ -326,7 +329,6 @@
'runtime/TimeoutChecker.cpp',
'runtime/TimeoutChecker.h',
'runtime/Tracing.h',
- 'runtime/TypeInfo.h',
'runtime/UString.cpp',
'runtime/UString.h',
'wrec/CharacterClass.cpp',
diff --git a/JavaScriptCore/JavaScriptCore.pri b/JavaScriptCore/JavaScriptCore.pri
index dd48c9a..d69bccb 100644
--- a/JavaScriptCore/JavaScriptCore.pri
+++ b/JavaScriptCore/JavaScriptCore.pri
@@ -36,6 +36,14 @@ GENERATED_SOURCES_DIR_SLASH = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}
win32-* {
LIBS += -lwinmm
}
+contains(JAVASCRIPTCORE_JIT,yes) {
+ DEFINES+=ENABLE_JIT=1
+ DEFINES+=ENABLE_YARR_JIT=1
+}
+contains(JAVASCRIPTCORE_JIT,no) {
+ DEFINES+=ENABLE_JIT=0
+ DEFINES+=ENABLE_YARR_JIT=0
+}
# In debug mode JIT disabled until crash fixed
win32-* {
@@ -50,6 +58,11 @@ win32-* {
}
}
+wince* {
+ SOURCES += $$QT_SOURCE_TREE/src/3rdparty/ce-compat/ce_time.cpp
+ DEFINES += WINCEBASIC
+}
+
include(pcre/pcre.pri)
LUT_FILES += \
@@ -99,12 +112,12 @@ SOURCES += \
runtime/JSONObject.cpp \
runtime/LiteralParser.cpp \
runtime/MarkStack.cpp \
- runtime/MarkStackPosix.cpp \
runtime/TimeoutChecker.cpp \
bytecode/CodeBlock.cpp \
bytecode/StructureStubInfo.cpp \
bytecode/JumpTable.cpp \
assembler/ARMAssembler.cpp \
+ assembler/MacroAssemblerARM.cpp \
jit/JIT.cpp \
jit/JITCall.cpp \
jit/JITArithmetic.cpp \
@@ -123,8 +136,21 @@ SOURCES += \
yarr/RegexJIT.cpp \
interpreter/RegisterFile.cpp
-win32-*: SOURCES += jit/ExecutableAllocatorWin.cpp
-else: SOURCES += jit/ExecutableAllocatorPosix.cpp
+symbian {
+ SOURCES += runtime/MarkStackSymbian.cpp
+} else {
+ win32-*|wince* {
+ SOURCES += jit/ExecutableAllocatorWin.cpp \
+ runtime/MarkStackWin.cpp
+ } else {
+ SOURCES += jit/ExecutableAllocatorPosix.cpp \
+ runtime/MarkStackPosix.cpp
+ }
+}
+
+!contains(DEFINES, USE_SYSTEM_MALLOC) {
+ SOURCES += wtf/TCSystemAlloc.cpp
+}
# AllInOneFile.cpp helps gcc analize and optimize code
# Other compilers may be able to do this at link time
@@ -154,6 +180,7 @@ SOURCES += \
runtime/ErrorInstance.cpp \
runtime/ErrorPrototype.cpp \
interpreter/CallFrame.cpp \
+ runtime/Executable.cpp \
runtime/FunctionConstructor.cpp \
runtime/FunctionPrototype.cpp \
runtime/GetterSetter.cpp \
@@ -188,6 +215,7 @@ SOURCES += \
runtime/Operations.cpp \
parser/Parser.cpp \
parser/ParserArena.cpp \
+ runtime/PropertyDescriptor.cpp \
runtime/PropertyNameArray.cpp \
runtime/PropertySlot.cpp \
runtime/PrototypeFunction.cpp \
diff --git a/JavaScriptCore/JavaScriptCore.pro b/JavaScriptCore/JavaScriptCore.pro
index 0cd2e1a..a1affd4 100644
--- a/JavaScriptCore/JavaScriptCore.pro
+++ b/JavaScriptCore/JavaScriptCore.pro
@@ -16,7 +16,6 @@ CONFIG(QTDIR_build) {
include($$QT_SOURCE_TREE/src/qbase.pri)
INSTALLS =
DESTDIR = $$OLDDESTDIR
- PRECOMPILED_HEADER = $$PWD/../WebKit/qt/WebKit_pch.h
DEFINES *= NDEBUG
}
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
index 0de51bf..a580b98 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
@@ -1,22 +1,18 @@
LIBRARY "JavaScriptCore"
EXPORTS
- ?from@UString@JSC@@SA?AV12@N@Z
- ?nonInlineNaN@JSC@@YANXZ
- ?synthesizePrototype@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
- ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
- ?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
??0Collator@WTF@@QAE@PBD@Z
- ??0Debugger@JSC@@QAE@XZ
+ ??0DateInstance@JSC@@QAE@PAVExecState@1@N@Z
??0DropAllLocks@JSLock@JSC@@QAE@W4JSLockBehavior@2@@Z
- ??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@ABVIdentifier@1@@Z
- ??0JSByteArray@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@PAVByteArray@4@PBUClassInfo@1@@Z
- ??0JSFunction@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
+ ??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVIdentifier@1@@Z
+ ??0JSArray@JSC@@QAE@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@@Z
+ ??0JSArray@JSC@@QAE@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVArgList@1@@Z
+ ??0JSByteArray@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@PAVByteArray@4@PBUClassInfo@1@@Z
+ ??0JSFunction@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
??0Mutex@WTF@@QAE@XZ
??0PrototypeFunction@JSC@@QAE@PAVExecState@1@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V41@ABVArgList@1@@Z@Z
- ??0PrototypeFunction@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
??0RefCountedLeakCounter@WTF@@QAE@PBD@Z
- ??0StringObject@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@ABVUString@1@@Z
+ ??0StringObject@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVUString@1@@Z
??0Structure@JSC@@AAE@VJSValue@1@ABVTypeInfo@1@@Z
??0ThreadCondition@WTF@@QAE@XZ
??0UString@JSC@@QAE@PBD@Z
@@ -47,7 +43,6 @@ EXPORTS
?allocate@Heap@JSC@@QAEPAXI@Z
?allocatePropertyStorage@JSObject@JSC@@QAEXII@Z
?allocateStack@MarkStack@JSC@@CAPAXI@Z
- ?allocateStack@MarkStack@JSC@@CAPAXI@Z
?append@UString@JSC@@QAEAAV12@ABV12@@Z
?append@UString@JSC@@QAEAAV12@PBD@Z
?ascii@UString@JSC@@QBEPADXZ
@@ -67,33 +62,37 @@ EXPORTS
?collect@Heap@JSC@@QAE_NXZ
?computeHash@Rep@UString@JSC@@SAIPBDH@Z
?computeHash@Rep@UString@JSC@@SAIPB_WH@Z
+ ?configurable@PropertyDescriptor@JSC@@QBE_NXZ
?construct@JSC@@YAPAVJSObject@1@PAVExecState@1@VJSValue@1@W4ConstructType@1@ABTConstructData@1@ABVArgList@1@@Z
?constructArray@JSC@@YAPAVJSArray@1@PAVExecState@1@ABVArgList@1@@Z
?constructEmptyArray@JSC@@YAPAVJSArray@1@PAVExecState@1@@Z
?constructEmptyObject@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
?constructFunction@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVArgList@1@ABVIdentifier@1@ABVUString@1@H@Z
?convertUTF16ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPB_WPB_WPAPADPAD_N@Z
- ?copyParameters@FunctionBodyNode@JSC@@QAEPAVIdentifier@2@XZ
?create@ByteArray@WTF@@SA?AV?$PassRefPtr@VByteArray@WTF@@@2@I@Z
- ?create@FunctionBodyNode@JSC@@SA?AV?$PassRefPtr@VFunctionBodyNode@JSC@@@WTF@@PAVJSGlobalData@2@PAVSourceElements@2@PAV?$Vector@U?$pair@VIdentifier@JSC@@I@std@@$0A@@4@PAV?$Vector@PAVFuncDeclNode@JSC@@$0A@@4@ABVSourceCode@2@IH@Z
?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@_N@Z
?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVUString@JSC@@@Z
?create@Rep@UString@JSC@@SA?AV?$PassRefPtr@URep@UString@JSC@@@WTF@@PA_WHV?$PassRefPtr@V?$CrossThreadRefCounted@V?$OwnFastMallocPtr@_W@WTF@@@WTF@@@5@@Z
?createEmptyString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@@Z
?createInheritorID@JSObject@JSC@@AAEPAVStructure@2@XZ
+ ?createInterruptedExecutionException@JSC@@YA?AVJSValue@1@PAVJSGlobalData@1@@Z
?createLeaked@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@XZ
+ ?createStackOverflowError@JSC@@YA?AVJSValue@1@PAVExecState@1@@Z
?createStructure@JSByteArray@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@VJSValue@2@@Z
?createTable@HashTable@JSC@@ABEXPAVJSGlobalData@2@@Z
?createThread@WTF@@YAIP6APAXPAX@Z0@Z
?createThread@WTF@@YAIP6APAXPAX@Z0PBD@Z
+ ?createTypeError@JSC@@YA?AVJSValue@1@PAVExecState@1@PBD@Z
?currentThread@WTF@@YAIXZ
?currentTime@WTF@@YANXZ
?decrement@RefCountedLeakCounter@WTF@@QAEXXZ
+ ?defaultAttributes@PropertyDescriptor@JSC@@0IA
?defaultValue@JSObject@JSC@@UBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z
- ?defineGetter@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAVJSObject@2@@Z
- ?defineGetter@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAV12@@Z
- ?defineSetter@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAVJSObject@2@@Z
- ?defineSetter@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAV12@@Z
+ ?defineGetter@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAVJSObject@2@I@Z
+ ?defineGetter@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAV12@I@Z
+ ?defineOwnProperty@JSObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@_N@Z
+ ?defineSetter@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAVJSObject@2@I@Z
+ ?defineSetter@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAV12@I@Z
?deleteOwnedPtr@WTF@@YAXPAUHBITMAP__@@@Z
?deleteOwnedPtr@WTF@@YAXPAUHRGN__@@@Z
?deleteProperty@JSCell@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@@Z
@@ -107,8 +106,12 @@ EXPORTS
?despecifyFunctionTransition@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@PAV12@ABVIdentifier@2@@Z
?destroy@Heap@JSC@@QAEXXZ
?destroy@Rep@UString@JSC@@QAEXXZ
+ ?destroyJSGlobalObjectData@JSGlobalObject@JSC@@CAXPAX@Z
?detach@Debugger@JSC@@UAEXPAVJSGlobalObject@2@@Z
?detachThread@WTF@@YAXI@Z
+ ?didTimeOut@TimeoutChecker@JSC@@QAE_NPAVExecState@2@@Z
+ ?dumpSampleData@JSGlobalData@JSC@@QAEXPAVExecState@2@@Z
+ ?enumerable@PropertyDescriptor@JSC@@QBE_NXZ
?equal@Identifier@JSC@@SA_NPBURep@UString@2@PBD@Z
?equal@JSC@@YA_NPBURep@UString@1@0@Z
?evaluate@DebuggerCallFrame@JSC@@QBE?AVJSValue@2@ABVUString@2@AAV32@@Z
@@ -120,16 +123,22 @@ EXPORTS
?fastRealloc@WTF@@YAPAXPAXI@Z
?fastZeroedMalloc@WTF@@YAPAXI@Z
?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAVJSValue@2@@Z
- ?finishParsing@FunctionBodyNode@JSC@@QAEXPAVIdentifier@2@I@Z
?focus@Profile@JSC@@QAEXPBVProfileNode@2@@Z
?from@UString@JSC@@SA?AV12@H@Z
?from@UString@JSC@@SA?AV12@I@Z
+ ?from@UString@JSC@@SA?AV12@N@Z
?functionName@DebuggerCallFrame@JSC@@QBEPBVUString@2@XZ
?get@Structure@JSC@@QAEIPBURep@UString@2@AAIAAPAVJSCell@2@@Z
?getCallData@JSCell@JSC@@UAE?AW4CallType@2@AATCallData@2@@Z
?getConstructData@JSCell@JSC@@UAE?AW4ConstructType@2@AATConstructData@2@@Z
?getJSNumber@JSCell@JSC@@UAE?AVJSValue@2@XZ
?getObject@JSCell@JSC@@QAEPAVJSObject@2@XZ
+ ?getOwnPropertyDescriptor@JSObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
+ ?getOwnPropertyDescriptor@JSString@JSC@@EAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
+ ?getOwnPropertyDescriptor@StringObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
+ ?getOwnPropertyNames@JSObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@@Z
+ ?getOwnPropertyNames@JSVariableObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@@Z
+ ?getOwnPropertyNames@StringObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@@Z
?getOwnPropertySlot@JSCell@JSC@@EAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertySlot@2@@Z
?getOwnPropertySlot@JSCell@JSC@@EAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
?getOwnPropertySlot@JSObject@JSC@@UAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
@@ -137,23 +146,24 @@ EXPORTS
?getOwnPropertySlot@JSString@JSC@@EAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
?getOwnPropertySlot@StringObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertySlot@2@@Z
?getOwnPropertySlot@StringObject@JSC@@UAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
- ?getPrimitiveNumber@JSAPIValueWrapper@JSC@@UAE_NPAVExecState@2@AANAAVJSValue@2@@Z
+ ?getPrimitiveNumber@JSCell@JSC@@UAE_NPAVExecState@2@AANAAVJSValue@2@@Z
?getPrimitiveNumber@JSObject@JSC@@UAE_NPAVExecState@2@AANAAVJSValue@2@@Z
?getPrimitiveNumber@JSString@JSC@@EAE_NPAVExecState@2@AANAAVJSValue@2@@Z
?getPropertyAttributes@JSObject@JSC@@UBE_NPAVExecState@2@ABVIdentifier@2@AAI@Z
?getPropertyAttributes@JSVariableObject@JSC@@UBE_NPAVExecState@2@ABVIdentifier@2@AAI@Z
+ ?getPropertyDescriptor@JSObject@JSC@@QAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
?getPropertyNames@JSObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@@Z
- ?getPropertyNames@JSVariableObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@@Z
- ?getPropertyNames@StringObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@@Z
?getSlice@ArgList@JSC@@QBEXHAAV12@@Z
?getString@JSCell@JSC@@QBE?AVUString@2@XZ
?getString@JSCell@JSC@@QBE_NAAVUString@2@@Z
?getUInt32@JSCell@JSC@@UBE_NAAI@Z
+ ?getter@PropertyDescriptor@JSC@@QBE?AVJSValue@2@XZ
?globalExec@JSGlobalObject@JSC@@UAEPAVExecState@2@XZ
?globalObjectCount@Heap@JSC@@QAEIXZ
?hasInstance@JSObject@JSC@@UAE_NPAVExecState@2@VJSValue@2@1@Z
?hasProperty@JSObject@JSC@@QBE_NPAVExecState@2@ABVIdentifier@2@@Z
?hasProperty@JSObject@JSC@@QBE_NPAVExecState@2@I@Z
+ ?hasTransition@Structure@JSC@@QAE_NPAURep@UString@2@I@Z
?heap@Heap@JSC@@SAPAV12@VJSValue@2@@Z
?increment@RefCountedLeakCounter@WTF@@QAEXXZ
?init@JSGlobalObject@JSC@@AAEXPAVJSObject@2@@Z
@@ -161,10 +171,12 @@ EXPORTS
?initializeThreading@JSC@@YAXXZ
?initializeThreading@WTF@@YAXXZ
?is8Bit@UString@JSC@@QBE_NXZ
+ ?isAccessorDescriptor@PropertyDescriptor@JSC@@QBE_NXZ
?isBusy@Heap@JSC@@QAE_NXZ
+ ?isDataDescriptor@PropertyDescriptor@JSC@@QBE_NXZ
?isDynamicScope@JSGlobalObject@JSC@@UBE_NXZ
?isGetterSetter@JSCell@JSC@@UBE_NXZ
- ?isHostFunction@FunctionBodyNode@JSC@@QBE_NXZ
+ ?isHostFunctionNonInline@JSFunction@JSC@@ABE_NXZ
?isMainThread@WTF@@YA_NXZ
?isVariableObject@JSVariableObject@JSC@@UBE_NXZ
?jsNumberCell@JSC@@YA?AVJSValue@1@PAVExecState@1@N@Z
@@ -180,9 +192,10 @@ EXPORTS
?lookupSetter@JSObject@JSC@@UAE?AVJSValue@2@PAVExecState@2@ABVIdentifier@2@@Z
?markChildren@JSGlobalObject@JSC@@UAEXAAVMarkStack@2@@Z
?markChildren@JSObject@JSC@@UAEXAAVMarkStack@2@@Z
- ?markChildren@JSWrapperObject@JSC@@UAEXAAVMarkStack@2@@Z
+ ?markChildren@JSWrapperObject@JSC@@EAEXAAVMarkStack@2@@Z
?materializePropertyMap@Structure@JSC@@AAEXXZ
?name@InternalFunction@JSC@@QAEABVUString@2@PAVJSGlobalData@2@@Z
+ ?nonInlineNaN@JSC@@YANXZ
?objectCount@Heap@JSC@@QAEIXZ
?objectProtoFuncToString@JSC@@YI?AVJSValue@1@PAVExecState@1@PAVJSObject@1@V21@ABVArgList@1@@Z
?parse@Parser@JSC@@AAEXPAVJSGlobalData@2@PAHPAVUString@2@@Z
@@ -206,6 +219,7 @@ EXPORTS
?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I_NAAVPutPropertySlot@2@@Z
?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@IVJSValue@2@I@Z
?randomNumber@WTF@@YANXZ
+ ?recompileAllJSFunctions@Debugger@JSC@@QAEXPAVJSGlobalData@2@@Z
?recordExtraCost@Heap@JSC@@AAEXI@Z
?releaseStack@MarkStack@JSC@@CAXPAXI@Z
?reset@ParserArena@JSC@@QAEXXZ
@@ -213,21 +227,34 @@ EXPORTS
?restoreAll@Profile@JSC@@QAEXXZ
?retrieveCaller@Interpreter@JSC@@QBE?AVJSValue@2@PAVExecState@2@PAVInternalFunction@2@@Z
?retrieveLastCaller@Interpreter@JSC@@QBEXPAVExecState@2@AAH1AAVUString@2@AAVJSValue@2@@Z
+ ?setAccessorDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@0I@Z
+ ?setConfigurable@PropertyDescriptor@JSC@@QAEX_N@Z
+ ?setDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@I@Z
?setDumpsGeneratedCode@BytecodeGenerator@JSC@@SAX_N@Z
- ?setGCProtectNeedsLocking@Heap@JSC@@QAEXXZ
+ ?setEnumerable@PropertyDescriptor@JSC@@QAEX_N@Z
+ ?setGetter@PropertyDescriptor@JSC@@QAEXVJSValue@2@@Z
+ ?setLength@JSArray@JSC@@QAEXI@Z
?setLoc@StatementNode@JSC@@QAEXHH@Z
?setMainThreadCallbacksPaused@WTF@@YAX_N@Z
?setOrderLowerFirst@Collator@WTF@@QAEX_N@Z
+ ?setSetter@PropertyDescriptor@JSC@@QAEXVJSValue@2@@Z
+ ?setUndefined@PropertyDescriptor@JSC@@QAEXXZ
?setUpStaticFunctionSlot@JSC@@YAXPAVExecState@1@PBVHashEntry@1@PAVJSObject@1@ABVIdentifier@1@AAVPropertySlot@1@@Z
+ ?setWritable@PropertyDescriptor@JSC@@QAEX_N@Z
+ ?setter@PropertyDescriptor@JSC@@QBE?AVJSValue@2@XZ
?sharedBuffer@Rep@UString@JSC@@QAEPAV?$CrossThreadRefCounted@V?$OwnFastMallocPtr@_W@WTF@@@WTF@@XZ
?signal@ThreadCondition@WTF@@QAEXXZ
?slowAppend@MarkedArgumentBuffer@JSC@@AAEXVJSValue@2@@Z
?startIgnoringLeaks@Structure@JSC@@SAXXZ
?startProfiling@Profiler@JSC@@QAEXPAVExecState@2@ABVUString@2@@Z
+ ?startSampling@JSGlobalData@JSC@@QAEXXZ
?stopIgnoringLeaks@Structure@JSC@@SAXXZ
?stopProfiling@Profiler@JSC@@QAE?AV?$PassRefPtr@VProfile@JSC@@@WTF@@PAVExecState@2@ABVUString@2@@Z
+ ?stopSampling@JSGlobalData@JSC@@QAEXXZ
?strtod@WTF@@YANPBDPAPAD@Z
?substr@UString@JSC@@QBE?AV12@HH@Z
+ ?symbolTableGet@JSVariableObject@JSC@@IAE_NABVIdentifier@2@AAVPropertyDescriptor@2@@Z
+ ?synthesizePrototype@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
?thisObject@DebuggerCallFrame@JSC@@QBEPAVJSObject@2@XZ
?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@W4ErrorType@1@@Z
?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@W4ErrorType@1@ABVUString@1@@Z
@@ -235,36 +262,36 @@ EXPORTS
?timedWait@ThreadCondition@WTF@@QAE_NAAVMutex@2@N@Z
?tlsKeyCount@WTF@@YAAAJXZ
?tlsKeys@WTF@@YAPAKXZ
- ?toBoolean@JSAPIValueWrapper@JSC@@UBE_NPAVExecState@2@@Z
+ ?toBoolean@JSCell@JSC@@UBE_NPAVExecState@2@@Z
?toBoolean@JSObject@JSC@@UBE_NPAVExecState@2@@Z
?toBoolean@JSString@JSC@@EBE_NPAVExecState@2@@Z
?toInt32SlowCase@JSC@@YAHNAA_N@Z
- ?toNumber@JSAPIValueWrapper@JSC@@UBENPAVExecState@2@@Z
+ ?toNumber@JSCell@JSC@@UBENPAVExecState@2@@Z
?toNumber@JSObject@JSC@@UBENPAVExecState@2@@Z
?toNumber@JSString@JSC@@EBENPAVExecState@2@@Z
- ?toObject@JSAPIValueWrapper@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z
+ ?toObject@JSCell@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z
?toObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z
?toObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z
- ?toPrimitive@JSAPIValueWrapper@JSC@@UBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z
+ ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
+ ?toPrimitive@JSCell@JSC@@UBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z
?toPrimitive@JSString@JSC@@EBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z
?toStrictUInt32@UString@JSC@@QBEIPA_N@Z
- ?toString@JSAPIValueWrapper@JSC@@UBE?AVUString@2@PAVExecState@2@@Z
+ ?toString@JSCell@JSC@@UBE?AVUString@2@PAVExecState@2@@Z
?toString@JSObject@JSC@@UBE?AVUString@2@PAVExecState@2@@Z
?toString@JSString@JSC@@EBE?AVUString@2@PAVExecState@2@@Z
- ?toString@StringObject@JSC@@EBE?AVUString@2@PAVExecState@2@@Z
?toThisJSString@JSCell@JSC@@UAEPAVJSString@2@PAVExecState@2@@Z
?toThisJSString@JSString@JSC@@EAEPAV12@PAVExecState@2@@Z
- ?toThisJSString@StringObject@JSC@@EAEPAVJSString@2@PAVExecState@2@@Z
?toThisObject@JSCell@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z
?toThisObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z
?toThisObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z
+ ?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
?toThisString@JSCell@JSC@@UBE?AVUString@2@PAVExecState@2@@Z
?toThisString@JSString@JSC@@EBE?AVUString@2@PAVExecState@2@@Z
- ?toThisString@StringObject@JSC@@EBE?AVUString@2@PAVExecState@2@@Z
?toUInt32@UString@JSC@@QBEIPA_N@Z
?toUInt32@UString@JSC@@QBEIPA_N_N@Z
?toUInt32SlowCase@JSC@@YAINAA_N@Z
- ?tryFastCalloc@WTF@@YAPAXII@Z
+ ?tryFastCalloc@WTF@@YA?AUTryMallocReturnValue@1@II@Z
+ ?tryFastMalloc@WTF@@YA?AUTryMallocReturnValue@1@I@Z
?tryLock@Mutex@WTF@@QAE_NXZ
?type@DebuggerCallFrame@JSC@@QBE?AW4Type@12@XZ
?unlock@JSLock@JSC@@SAXW4JSLockBehavior@2@@Z
@@ -274,6 +301,7 @@ EXPORTS
?unwrappedObject@JSObject@JSC@@UAEPAV12@XZ
?wait@ThreadCondition@WTF@@QAEXAAVMutex@2@@Z
?waitForThreadCompletion@WTF@@YAHIPAPAX@Z
+ ?writable@PropertyDescriptor@JSC@@QBE_NXZ
WTFLog
WTFLogVerbose
WTFReportArgumentAssertionFailure
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc
index bb2b0fe..f2b0dd3 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc
@@ -14,8 +14,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION __VERSION_MAJOR__,__BUILD_NUMBER_MAJOR__,__BUILD_NUMBER_MINOR__,__BUILD_NUMBER_VARIANT__
- PRODUCTVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,0
+ FILEVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,__VERSION_BUILD__
+ PRODUCTVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,__VERSION_BUILD__
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -37,7 +37,7 @@ BEGIN
VALUE "LegalCopyright", "Copyright Apple Inc. 2003-2009"
VALUE "OriginalFilename", "JavaScriptCore.dll"
VALUE "ProductName", " JavaScriptCore"
- VALUE "ProductVersion", __BUILD_NUMBER_SHORT__
+ VALUE "ProductVersion", __VERSION_TEXT__
END
END
BLOCK "VarFileInfo"
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
index 1c5e963..c86ef7c 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
@@ -328,7 +328,7 @@
<Configuration
Name="Debug_CFLite|Win32"
ConfigurationType="2"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;.\JavaScriptCoreCommon.vsprops;.\JavaScriptCoreCFLite.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\debug_wincairo.vsprops;$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;.\JavaScriptCoreCommon.vsprops;.\JavaScriptCoreCFLite.vsprops"
CharacterSet="1"
>
<Tool
@@ -644,6 +644,10 @@
>
</File>
<File
+ RelativePath="..\..\runtime\Executable.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\runtime\FunctionConstructor.cpp"
>
</File>
@@ -884,11 +888,11 @@
>
</File>
<File
- RelativePath="..\..\runtime\MarkStack.h"
+ RelativePath="..\..\runtime\MarkStack.cpp"
>
</File>
<File
- RelativePath="..\..\runtime\MarkStack.cpp"
+ RelativePath="..\..\runtime\MarkStack.h"
>
</File>
<File
@@ -948,6 +952,10 @@
>
</File>
<File
+ RelativePath="..\..\runtime\NumericStrings.h"
+ >
+ </File>
+ <File
RelativePath="..\..\runtime\ObjectConstructor.cpp"
>
</File>
@@ -972,6 +980,14 @@
>
</File>
<File
+ RelativePath="..\..\runtime\PropertyDescriptor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\PropertyDescriptor.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\runtime\PropertyMapHashTable.h"
>
</File>
@@ -1632,15 +1648,11 @@
>
</File>
<File
- RelativePath="..\..\assembler\LinkBuffer.h"
- >
- </File>
- <File
- RelativePath="..\..\assembler\RepatchBuffer.h"
+ RelativePath="..\..\assembler\AssemblerBuffer.h"
>
</File>
<File
- RelativePath="..\..\assembler\AssemblerBuffer.h"
+ RelativePath="..\..\assembler\LinkBuffer.h"
>
</File>
<File
@@ -1656,6 +1668,10 @@
>
</File>
<File
+ RelativePath="..\..\assembler\RepatchBuffer.h"
+ >
+ </File>
+ <File
RelativePath="..\..\assembler\X86Assembler.h"
>
</File>
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops
index 02f213b..8c9e31f 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops
@@ -6,6 +6,6 @@
>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="CFLite$(LibraryConfigSuffix).lib"
+ AdditionalDependencies="CFLite$(WebKitConfigSuffix).lib"
/>
</VisualStudioPropertySheet>
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops
index 5f90011..ba6bbfd 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops
@@ -21,7 +21,7 @@
/>
<Tool
Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;&#x0D;&#x0A;bash &quot;$(WebKitLibrariesDir)\tools\scripts\auto-version.sh&quot; &quot;$(IntDir)&quot;&#x0D;&#x0A;"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;&#x0D;&#x0A;bash &quot;$(WebKitLibrariesDir)\tools\scripts\auto-version.sh&quot; &quot;$(IntDir)&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCPreLinkEventTool"
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj
index 954045e..0360c4e 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj
@@ -1,53 +1,53 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="JavaScriptCoreGenerated"
- ProjectGUID="{4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}"
- RootNamespace="JavaScriptCoreGenerated"
- Keyword="MakeFileProj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(WebKitOutputDir)\lib"
- IntermediateDirectory="$(WebKitOutputDir)\obj\$(ProjectName)\$(ConfigurationName)"
- ConfigurationType="0"
- >
- <Tool
- Name="VCNMakeTool"
- BuildCommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;&#x0D;&#x0A;nmake /nologo -f JavaScriptCoreGenerated.make"
- ReBuildCommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;&#x0D;&#x0A;nmake /nologo -f JavaScriptCoreGenerated.make clean&#x0D;&#x0A;nmake -f JavaScriptCoreGenerated.make"
- CleanCommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;&#x0D;&#x0A;nmake /nologo -f JavaScriptCoreGenerated.make clean"
- Output=""
- PreprocessorDefinitions="WIN32;NDEBUG"
- IncludeSearchPath=""
- ForcedIncludes=""
- AssemblySearchPath=""
- ForcedUsingAssemblies=""
- CompileAsManaged=""
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath=".\build-generated-files.sh"
- >
- </File>
- <File
- RelativePath=".\JavaScriptCoreGenerated.make"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="JavaScriptCoreGenerated"
+ ProjectGUID="{4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}"
+ RootNamespace="JavaScriptCoreGenerated"
+ Keyword="MakeFileProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(WebKitOutputDir)\lib"
+ IntermediateDirectory="$(WebKitOutputDir)\obj\$(ProjectName)\$(ConfigurationName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c&#x0D;&#x0A;&#x0D;&#x0A;nmake /nologo -f JavaScriptCoreGenerated.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c&#x0D;&#x0A;&#x0D;&#x0A;nmake /nologo -f JavaScriptCoreGenerated.make clean&#x0D;&#x0A;nmake -f JavaScriptCoreGenerated.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c&#x0D;&#x0A;&#x0D;&#x0A;nmake /nologo -f JavaScriptCoreGenerated.make clean"
+ Output=""
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\build-generated-files.sh"
+ >
+ </File>
+ <File
+ RelativePath=".\JavaScriptCoreGenerated.make"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def
index 65998ca..b91e7b5 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def
@@ -1,22 +1,18 @@
LIBRARY "JavaScriptCore_debug"
EXPORTS
- ?from@UString@JSC@@SA?AV12@N@Z
- ?nonInlineNaN@JSC@@YANXZ
- ?synthesizePrototype@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
- ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
- ?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
??0Collator@WTF@@QAE@PBD@Z
- ??0Debugger@JSC@@QAE@XZ
+ ??0DateInstance@JSC@@QAE@PAVExecState@1@N@Z
??0DropAllLocks@JSLock@JSC@@QAE@W4JSLockBehavior@2@@Z
- ??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@ABVIdentifier@1@@Z
- ??0JSByteArray@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@PAVByteArray@4@PBUClassInfo@1@@Z
- ??0JSFunction@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
+ ??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVIdentifier@1@@Z
+ ??0JSArray@JSC@@QAE@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@@Z
+ ??0JSArray@JSC@@QAE@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVArgList@1@@Z
+ ??0JSByteArray@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@PAVByteArray@4@PBUClassInfo@1@@Z
+ ??0JSFunction@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
??0Mutex@WTF@@QAE@XZ
??0PrototypeFunction@JSC@@QAE@PAVExecState@1@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V41@ABVArgList@1@@Z@Z
- ??0PrototypeFunction@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
??0RefCountedLeakCounter@WTF@@QAE@PBD@Z
- ??0StringObject@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@ABVUString@1@@Z
+ ??0StringObject@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVUString@1@@Z
??0Structure@JSC@@AAE@VJSValue@1@ABVTypeInfo@1@@Z
??0ThreadCondition@WTF@@QAE@XZ
??0UString@JSC@@QAE@PBD@Z
@@ -46,6 +42,7 @@ EXPORTS
?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@URep@UString@JSC@@@WTF@@PAVJSGlobalData@2@PAURep@UString@2@@Z
?allocate@Heap@JSC@@QAEPAXI@Z
?allocatePropertyStorage@JSObject@JSC@@QAEXII@Z
+ ?allocateStack@MarkStack@JSC@@CAPAXI@Z
?append@UString@JSC@@QAEAAV12@ABV12@@Z
?append@UString@JSC@@QAEAAV12@PBD@Z
?ascii@UString@JSC@@QBEPADXZ
@@ -65,33 +62,37 @@ EXPORTS
?collect@Heap@JSC@@QAE_NXZ
?computeHash@Rep@UString@JSC@@SAIPBDH@Z
?computeHash@Rep@UString@JSC@@SAIPB_WH@Z
+ ?configurable@PropertyDescriptor@JSC@@QBE_NXZ
?construct@JSC@@YAPAVJSObject@1@PAVExecState@1@VJSValue@1@W4ConstructType@1@ABTConstructData@1@ABVArgList@1@@Z
?constructArray@JSC@@YAPAVJSArray@1@PAVExecState@1@ABVArgList@1@@Z
?constructEmptyArray@JSC@@YAPAVJSArray@1@PAVExecState@1@@Z
?constructEmptyObject@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
?constructFunction@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVArgList@1@ABVIdentifier@1@ABVUString@1@H@Z
?convertUTF16ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPB_WPB_WPAPADPAD_N@Z
- ?copyParameters@FunctionBodyNode@JSC@@QAEPAVIdentifier@2@XZ
?create@ByteArray@WTF@@SA?AV?$PassRefPtr@VByteArray@WTF@@@2@I@Z
- ?create@FunctionBodyNode@JSC@@SA?AV?$PassRefPtr@VFunctionBodyNode@JSC@@@WTF@@PAVJSGlobalData@2@PAVSourceElements@2@PAV?$Vector@U?$pair@VIdentifier@JSC@@I@std@@$0A@@4@PAV?$Vector@PAVFuncDeclNode@JSC@@$0A@@4@ABVSourceCode@2@IH@Z
?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@_N@Z
?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVUString@JSC@@@Z
?create@Rep@UString@JSC@@SA?AV?$PassRefPtr@URep@UString@JSC@@@WTF@@PA_WHV?$PassRefPtr@V?$CrossThreadRefCounted@V?$OwnFastMallocPtr@_W@WTF@@@WTF@@@5@@Z
?createEmptyString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@@Z
?createInheritorID@JSObject@JSC@@AAEPAVStructure@2@XZ
+ ?createInterruptedExecutionException@JSC@@YA?AVJSValue@1@PAVJSGlobalData@1@@Z
?createLeaked@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@XZ
+ ?createStackOverflowError@JSC@@YA?AVJSValue@1@PAVExecState@1@@Z
?createStructure@JSByteArray@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@VJSValue@2@@Z
?createTable@HashTable@JSC@@ABEXPAVJSGlobalData@2@@Z
?createThread@WTF@@YAIP6APAXPAX@Z0@Z
?createThread@WTF@@YAIP6APAXPAX@Z0PBD@Z
+ ?createTypeError@JSC@@YA?AVJSValue@1@PAVExecState@1@PBD@Z
?currentThread@WTF@@YAIXZ
?currentTime@WTF@@YANXZ
?decrement@RefCountedLeakCounter@WTF@@QAEXXZ
+ ?defaultAttributes@PropertyDescriptor@JSC@@0IA
?defaultValue@JSObject@JSC@@UBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z
- ?defineGetter@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAVJSObject@2@@Z
- ?defineGetter@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAV12@@Z
- ?defineSetter@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAVJSObject@2@@Z
- ?defineSetter@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAV12@@Z
+ ?defineGetter@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAVJSObject@2@I@Z
+ ?defineGetter@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAV12@I@Z
+ ?defineOwnProperty@JSObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@_N@Z
+ ?defineSetter@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAVJSObject@2@I@Z
+ ?defineSetter@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAV12@I@Z
?deleteOwnedPtr@WTF@@YAXPAUHBITMAP__@@@Z
?deleteOwnedPtr@WTF@@YAXPAUHRGN__@@@Z
?deleteProperty@JSCell@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@@Z
@@ -105,8 +106,12 @@ EXPORTS
?despecifyFunctionTransition@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@PAV12@ABVIdentifier@2@@Z
?destroy@Heap@JSC@@QAEXXZ
?destroy@Rep@UString@JSC@@QAEXXZ
+ ?destroyJSGlobalObjectData@JSGlobalObject@JSC@@CAXPAX@Z
?detach@Debugger@JSC@@UAEXPAVJSGlobalObject@2@@Z
?detachThread@WTF@@YAXI@Z
+ ?didTimeOut@TimeoutChecker@JSC@@QAE_NPAVExecState@2@@Z
+ ?dumpSampleData@JSGlobalData@JSC@@QAEXPAVExecState@2@@Z
+ ?enumerable@PropertyDescriptor@JSC@@QBE_NXZ
?equal@Identifier@JSC@@SA_NPBURep@UString@2@PBD@Z
?equal@JSC@@YA_NPBURep@UString@1@0@Z
?evaluate@DebuggerCallFrame@JSC@@QBE?AVJSValue@2@ABVUString@2@AAV32@@Z
@@ -118,16 +123,22 @@ EXPORTS
?fastRealloc@WTF@@YAPAXPAXI@Z
?fastZeroedMalloc@WTF@@YAPAXI@Z
?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAVJSValue@2@@Z
- ?finishParsing@FunctionBodyNode@JSC@@QAEXPAVIdentifier@2@I@Z
?focus@Profile@JSC@@QAEXPBVProfileNode@2@@Z
?from@UString@JSC@@SA?AV12@H@Z
?from@UString@JSC@@SA?AV12@I@Z
+ ?from@UString@JSC@@SA?AV12@N@Z
?functionName@DebuggerCallFrame@JSC@@QBEPBVUString@2@XZ
?get@Structure@JSC@@QAEIPBURep@UString@2@AAIAAPAVJSCell@2@@Z
?getCallData@JSCell@JSC@@UAE?AW4CallType@2@AATCallData@2@@Z
?getConstructData@JSCell@JSC@@UAE?AW4ConstructType@2@AATConstructData@2@@Z
?getJSNumber@JSCell@JSC@@UAE?AVJSValue@2@XZ
?getObject@JSCell@JSC@@QAEPAVJSObject@2@XZ
+ ?getOwnPropertyDescriptor@JSObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
+ ?getOwnPropertyDescriptor@JSString@JSC@@EAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
+ ?getOwnPropertyDescriptor@StringObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
+ ?getOwnPropertyNames@JSObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@@Z
+ ?getOwnPropertyNames@JSVariableObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@@Z
+ ?getOwnPropertyNames@StringObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@@Z
?getOwnPropertySlot@JSCell@JSC@@EAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertySlot@2@@Z
?getOwnPropertySlot@JSCell@JSC@@EAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
?getOwnPropertySlot@JSObject@JSC@@UAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
@@ -135,23 +146,24 @@ EXPORTS
?getOwnPropertySlot@JSString@JSC@@EAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
?getOwnPropertySlot@StringObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertySlot@2@@Z
?getOwnPropertySlot@StringObject@JSC@@UAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
- ?getPrimitiveNumber@JSAPIValueWrapper@JSC@@UAE_NPAVExecState@2@AANAAVJSValue@2@@Z
+ ?getPrimitiveNumber@JSCell@JSC@@UAE_NPAVExecState@2@AANAAVJSValue@2@@Z
?getPrimitiveNumber@JSObject@JSC@@UAE_NPAVExecState@2@AANAAVJSValue@2@@Z
?getPrimitiveNumber@JSString@JSC@@EAE_NPAVExecState@2@AANAAVJSValue@2@@Z
?getPropertyAttributes@JSObject@JSC@@UBE_NPAVExecState@2@ABVIdentifier@2@AAI@Z
?getPropertyAttributes@JSVariableObject@JSC@@UBE_NPAVExecState@2@ABVIdentifier@2@AAI@Z
+ ?getPropertyDescriptor@JSObject@JSC@@QAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
?getPropertyNames@JSObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@@Z
- ?getPropertyNames@JSVariableObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@@Z
- ?getPropertyNames@StringObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@@Z
?getSlice@ArgList@JSC@@QBEXHAAV12@@Z
?getString@JSCell@JSC@@QBE?AVUString@2@XZ
?getString@JSCell@JSC@@QBE_NAAVUString@2@@Z
?getUInt32@JSCell@JSC@@UBE_NAAI@Z
+ ?getter@PropertyDescriptor@JSC@@QBE?AVJSValue@2@XZ
?globalExec@JSGlobalObject@JSC@@UAEPAVExecState@2@XZ
?globalObjectCount@Heap@JSC@@QAEIXZ
?hasInstance@JSObject@JSC@@UAE_NPAVExecState@2@VJSValue@2@1@Z
?hasProperty@JSObject@JSC@@QBE_NPAVExecState@2@ABVIdentifier@2@@Z
?hasProperty@JSObject@JSC@@QBE_NPAVExecState@2@I@Z
+ ?hasTransition@Structure@JSC@@QAE_NPAURep@UString@2@I@Z
?heap@Heap@JSC@@SAPAV12@VJSValue@2@@Z
?increment@RefCountedLeakCounter@WTF@@QAEXXZ
?init@JSGlobalObject@JSC@@AAEXPAVJSObject@2@@Z
@@ -159,10 +171,12 @@ EXPORTS
?initializeThreading@JSC@@YAXXZ
?initializeThreading@WTF@@YAXXZ
?is8Bit@UString@JSC@@QBE_NXZ
+ ?isAccessorDescriptor@PropertyDescriptor@JSC@@QBE_NXZ
?isBusy@Heap@JSC@@QAE_NXZ
+ ?isDataDescriptor@PropertyDescriptor@JSC@@QBE_NXZ
?isDynamicScope@JSGlobalObject@JSC@@UBE_NXZ
?isGetterSetter@JSCell@JSC@@UBE_NXZ
- ?isHostFunction@FunctionBodyNode@JSC@@QBE_NXZ
+ ?isHostFunctionNonInline@JSFunction@JSC@@ABE_NXZ
?isMainThread@WTF@@YA_NXZ
?isVariableObject@JSVariableObject@JSC@@UBE_NXZ
?jsNumberCell@JSC@@YA?AVJSValue@1@PAVExecState@1@N@Z
@@ -178,9 +192,10 @@ EXPORTS
?lookupSetter@JSObject@JSC@@UAE?AVJSValue@2@PAVExecState@2@ABVIdentifier@2@@Z
?markChildren@JSGlobalObject@JSC@@UAEXAAVMarkStack@2@@Z
?markChildren@JSObject@JSC@@UAEXAAVMarkStack@2@@Z
- ?markChildren@JSWrapperObject@JSC@@UAEXAAVMarkStack@2@@Z
+ ?markChildren@JSWrapperObject@JSC@@EAEXAAVMarkStack@2@@Z
?materializePropertyMap@Structure@JSC@@AAEXXZ
?name@InternalFunction@JSC@@QAEABVUString@2@PAVJSGlobalData@2@@Z
+ ?nonInlineNaN@JSC@@YANXZ
?objectCount@Heap@JSC@@QAEIXZ
?objectProtoFuncToString@JSC@@YI?AVJSValue@1@PAVExecState@1@PAVJSObject@1@V21@ABVArgList@1@@Z
?parse@Parser@JSC@@AAEXPAVJSGlobalData@2@PAHPAVUString@2@@Z
@@ -204,6 +219,7 @@ EXPORTS
?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I_NAAVPutPropertySlot@2@@Z
?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@IVJSValue@2@I@Z
?randomNumber@WTF@@YANXZ
+ ?recompileAllJSFunctions@Debugger@JSC@@QAEXPAVJSGlobalData@2@@Z
?recordExtraCost@Heap@JSC@@AAEXI@Z
?releaseStack@MarkStack@JSC@@CAXPAXI@Z
?reset@ParserArena@JSC@@QAEXXZ
@@ -211,21 +227,34 @@ EXPORTS
?restoreAll@Profile@JSC@@QAEXXZ
?retrieveCaller@Interpreter@JSC@@QBE?AVJSValue@2@PAVExecState@2@PAVInternalFunction@2@@Z
?retrieveLastCaller@Interpreter@JSC@@QBEXPAVExecState@2@AAH1AAVUString@2@AAVJSValue@2@@Z
+ ?setAccessorDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@0I@Z
+ ?setConfigurable@PropertyDescriptor@JSC@@QAEX_N@Z
+ ?setDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@I@Z
?setDumpsGeneratedCode@BytecodeGenerator@JSC@@SAX_N@Z
- ?setGCProtectNeedsLocking@Heap@JSC@@QAEXXZ
+ ?setEnumerable@PropertyDescriptor@JSC@@QAEX_N@Z
+ ?setGetter@PropertyDescriptor@JSC@@QAEXVJSValue@2@@Z
+ ?setLength@JSArray@JSC@@QAEXI@Z
?setLoc@StatementNode@JSC@@QAEXHH@Z
?setMainThreadCallbacksPaused@WTF@@YAX_N@Z
?setOrderLowerFirst@Collator@WTF@@QAEX_N@Z
+ ?setSetter@PropertyDescriptor@JSC@@QAEXVJSValue@2@@Z
+ ?setUndefined@PropertyDescriptor@JSC@@QAEXXZ
?setUpStaticFunctionSlot@JSC@@YAXPAVExecState@1@PBVHashEntry@1@PAVJSObject@1@ABVIdentifier@1@AAVPropertySlot@1@@Z
+ ?setWritable@PropertyDescriptor@JSC@@QAEX_N@Z
+ ?setter@PropertyDescriptor@JSC@@QBE?AVJSValue@2@XZ
?sharedBuffer@Rep@UString@JSC@@QAEPAV?$CrossThreadRefCounted@V?$OwnFastMallocPtr@_W@WTF@@@WTF@@XZ
?signal@ThreadCondition@WTF@@QAEXXZ
?slowAppend@MarkedArgumentBuffer@JSC@@AAEXVJSValue@2@@Z
?startIgnoringLeaks@Structure@JSC@@SAXXZ
?startProfiling@Profiler@JSC@@QAEXPAVExecState@2@ABVUString@2@@Z
+ ?startSampling@JSGlobalData@JSC@@QAEXXZ
?stopIgnoringLeaks@Structure@JSC@@SAXXZ
?stopProfiling@Profiler@JSC@@QAE?AV?$PassRefPtr@VProfile@JSC@@@WTF@@PAVExecState@2@ABVUString@2@@Z
+ ?stopSampling@JSGlobalData@JSC@@QAEXXZ
?strtod@WTF@@YANPBDPAPAD@Z
?substr@UString@JSC@@QBE?AV12@HH@Z
+ ?symbolTableGet@JSVariableObject@JSC@@IAE_NABVIdentifier@2@AAVPropertyDescriptor@2@@Z
+ ?synthesizePrototype@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
?thisObject@DebuggerCallFrame@JSC@@QBEPAVJSObject@2@XZ
?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@W4ErrorType@1@@Z
?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@W4ErrorType@1@ABVUString@1@@Z
@@ -233,36 +262,36 @@ EXPORTS
?timedWait@ThreadCondition@WTF@@QAE_NAAVMutex@2@N@Z
?tlsKeyCount@WTF@@YAAAJXZ
?tlsKeys@WTF@@YAPAKXZ
- ?toBoolean@JSAPIValueWrapper@JSC@@UBE_NPAVExecState@2@@Z
+ ?toBoolean@JSCell@JSC@@UBE_NPAVExecState@2@@Z
?toBoolean@JSObject@JSC@@UBE_NPAVExecState@2@@Z
?toBoolean@JSString@JSC@@EBE_NPAVExecState@2@@Z
?toInt32SlowCase@JSC@@YAHNAA_N@Z
- ?toNumber@JSAPIValueWrapper@JSC@@UBENPAVExecState@2@@Z
+ ?toNumber@JSCell@JSC@@UBENPAVExecState@2@@Z
?toNumber@JSObject@JSC@@UBENPAVExecState@2@@Z
?toNumber@JSString@JSC@@EBENPAVExecState@2@@Z
- ?toObject@JSAPIValueWrapper@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z
+ ?toObject@JSCell@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z
?toObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z
?toObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z
- ?toPrimitive@JSAPIValueWrapper@JSC@@UBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z
+ ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
+ ?toPrimitive@JSCell@JSC@@UBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z
?toPrimitive@JSString@JSC@@EBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z
?toStrictUInt32@UString@JSC@@QBEIPA_N@Z
- ?toString@JSAPIValueWrapper@JSC@@UBE?AVUString@2@PAVExecState@2@@Z
+ ?toString@JSCell@JSC@@UBE?AVUString@2@PAVExecState@2@@Z
?toString@JSObject@JSC@@UBE?AVUString@2@PAVExecState@2@@Z
?toString@JSString@JSC@@EBE?AVUString@2@PAVExecState@2@@Z
- ?toString@StringObject@JSC@@EBE?AVUString@2@PAVExecState@2@@Z
?toThisJSString@JSCell@JSC@@UAEPAVJSString@2@PAVExecState@2@@Z
?toThisJSString@JSString@JSC@@EAEPAV12@PAVExecState@2@@Z
- ?toThisJSString@StringObject@JSC@@EAEPAVJSString@2@PAVExecState@2@@Z
?toThisObject@JSCell@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z
?toThisObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z
?toThisObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z
+ ?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
?toThisString@JSCell@JSC@@UBE?AVUString@2@PAVExecState@2@@Z
?toThisString@JSString@JSC@@EBE?AVUString@2@PAVExecState@2@@Z
- ?toThisString@StringObject@JSC@@EBE?AVUString@2@PAVExecState@2@@Z
?toUInt32@UString@JSC@@QBEIPA_N@Z
?toUInt32@UString@JSC@@QBEIPA_N_N@Z
?toUInt32SlowCase@JSC@@YAINAA_N@Z
- ?tryFastCalloc@WTF@@YAPAXII@Z
+ ?tryFastCalloc@WTF@@YA?AUTryMallocReturnValue@1@II@Z
+ ?tryFastMalloc@WTF@@YA?AUTryMallocReturnValue@1@I@Z
?tryLock@Mutex@WTF@@QAE_NXZ
?type@DebuggerCallFrame@JSC@@QBE?AW4Type@12@XZ
?unlock@JSLock@JSC@@SAXW4JSLockBehavior@2@@Z
@@ -272,6 +301,7 @@ EXPORTS
?unwrappedObject@JSObject@JSC@@UAEPAV12@XZ
?wait@ThreadCondition@WTF@@QAEXAAVMutex@2@@Z
?waitForThreadCompletion@WTF@@YAHIPAPAX@Z
+ ?writable@PropertyDescriptor@JSC@@QBE_NXZ
WTFLog
WTFLogVerbose
WTFReportArgumentAssertionFailure
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops
index 20b32f3..d78ff43 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops
+++ b/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="WTFCommon"
- OutputDirectory="$(WebKitOutputDir)\lib"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\&quot;;../../;&quot;../../os-win32/&quot;;../../pcre/;../../parser/;../../wtf/;../../wtf/unicode/;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\icu&quot;;../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;"
- PreprocessorDefinitions="__STD_C"
- />
- <Tool
- Name="VCLibrarianTool"
- AdditionalDependencies="user32.lib"
- OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).lib"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;"
- />
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%"
- />
-</VisualStudioPropertySheet>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="WTFCommon"
+ OutputDirectory="$(WebKitOutputDir)\lib"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\&quot;;../../;&quot;../../os-win32/&quot;;../../pcre/;../../parser/;../../wtf/;../../wtf/unicode/;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\icu&quot;;../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;"
+ PreprocessorDefinitions="__STD_C"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="user32.lib"
+ OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).lib"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;"
+ />
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c"
+ />
+</VisualStudioPropertySheet>
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj
index ce2fe04..dd18269 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj
+++ b/JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj
@@ -199,6 +199,67 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
+ <Configuration
+ Name="Debug_CFLite|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_wincairo.vsprops;.\jscCommon.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
</Configurations>
<References>
</References>
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops
index 3a1e42e..7e8a193 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops
+++ b/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops
@@ -20,6 +20,6 @@
/>
<Tool
Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
/>
</VisualStudioPropertySheet>
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapi.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapi.vcproj
index ef45c5b..fbc4672 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapi.vcproj
+++ b/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapi.vcproj
@@ -18,7 +18,7 @@
<Configuration
Name="Debug|Win32"
ConfigurationType="1"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;.\testapiCommon.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;.\testapiCommon.vsprops;..\JavaScriptCore\JavaScriptCoreCF.vsprops"
CharacterSet="1"
>
<Tool
@@ -79,7 +79,7 @@
<Configuration
Name="Release|Win32"
ConfigurationType="1"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\release.vsprops;.\testapiCommon.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\release.vsprops;.\testapiCommon.vsprops;..\JavaScriptCore\JavaScriptCoreCF.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
@@ -141,7 +141,7 @@
<Configuration
Name="Debug_Internal|Win32"
ConfigurationType="1"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops;.\testapiCommon.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops;.\testapiCommon.vsprops;..\JavaScriptCore\JavaScriptCoreCF.vsprops"
CharacterSet="1"
>
<Tool
@@ -199,6 +199,129 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
+ <Configuration
+ Name="Debug_CFLite|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_wincairo.vsprops;.\testapiCommon.vsprops;..\JavaScriptCore\JavaScriptCoreCFLite.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_CFLite|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\release.vsprops;.\testapiCommon.vsprops;..\JavaScriptCore\JavaScriptCoreCFLite.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
</Configurations>
<References>
</References>
@@ -230,6 +353,22 @@
CompileAs="2"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Debug_CFLite|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_CFLite|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\API\tests\testapi.js"
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops
index 2a36c18..7c6d126 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops
+++ b/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops
@@ -12,7 +12,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WTF$(WebKitConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib"
+ AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WTF$(WebKitConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib"
SubSystem="1"
/>
<Tool
@@ -21,6 +21,6 @@
/>
<Tool
Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
/>
</VisualStudioPropertySheet>
diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index 6c3d49f..f108b77 100644
--- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -67,6 +67,7 @@
1429DAC00ED263E700B89619 /* WRECParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429DABE0ED263E700B89619 /* WRECParser.cpp */; };
1429DAE00ED2645B00B89619 /* WRECGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1429DADE0ED2645B00B89619 /* WRECGenerator.h */; };
1429DAE10ED2645B00B89619 /* WRECGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429DADF0ED2645B00B89619 /* WRECGenerator.cpp */; };
+ 142D3939103E4560007DCB52 /* NumericStrings.h in Headers */ = {isa = PBXBuildFile; fileRef = 142D3938103E4560007DCB52 /* NumericStrings.h */; settings = {ATTRIBUTES = (Private, ); }; };
143A97E60A4A06E200456B66 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */; };
1440057F0A5335640005F061 /* JSNode.c in Sources */ = {isa = PBXBuildFile; fileRef = 1440F6420A4F8B6A0005F061 /* JSNode.c */; };
144005CB0A5338D10005F061 /* JSNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440F6410A4F8B6A0005F061 /* JSNode.h */; };
@@ -95,7 +96,7 @@
14BD5A300A3E91F600BAF59C /* JSContextRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14BD5A290A3E91F600BAF59C /* JSContextRef.cpp */; };
14BD5A320A3E91F600BAF59C /* JSValueRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */; };
14C5242B0F5355E900BA3D04 /* JITStubs.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A6581A0F4E36F4000150FD /* JITStubs.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 14F3488F0E95EF8A003648BC /* CollectorHeapIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F3488E0E95EF8A003648BC /* CollectorHeapIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 14F3488F0E95EF8A003648BC /* CollectorHeapIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F3488E0E95EF8A003648BC /* CollectorHeapIterator.h */; settings = {ATTRIBUTES = (); }; };
180B9B080F16D94F009BDBC5 /* CurrentTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 180B9AF00F16C569009BDBC5 /* CurrentTime.h */; settings = {ATTRIBUTES = (Private, ); }; };
180B9BFE0F16E94D009BDBC5 /* CurrentTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 180B9AEF0F16C569009BDBC5 /* CurrentTime.cpp */; };
1C61516C0EBAC7A00031376F /* ProfilerServer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C61516A0EBAC7A00031376F /* ProfilerServer.mm */; settings = {COMPILER_FLAGS = "-fno-strict-aliasing"; }; };
@@ -109,8 +110,8 @@
5D5D8AB60E0D0A7200F9C692 /* jsc in Copy Into Framework */ = {isa = PBXBuildFile; fileRef = 932F5BE10822A1C700736975 /* jsc */; };
5D5D8AD10E0D0EBE00F9C692 /* libedit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */; };
5D6A566B0F05995500266145 /* Threading.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D6A566A0F05995500266145 /* Threading.cpp */; };
- 5DE6E5B30E1728EC00180407 /* create_hash_table in Headers */ = {isa = PBXBuildFile; fileRef = F692A8540255597D01FF60F7 /* create_hash_table */; settings = {ATTRIBUTES = (Private, ); }; };
- 6507D29E0E871E5E00D7D896 /* TypeInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6507D2970E871E4A00D7D896 /* TypeInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 5DE6E5B30E1728EC00180407 /* create_hash_table in Headers */ = {isa = PBXBuildFile; fileRef = F692A8540255597D01FF60F7 /* create_hash_table */; settings = {ATTRIBUTES = (); }; };
+ 6507D29E0E871E5E00D7D896 /* JSTypeInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6507D2970E871E4A00D7D896 /* JSTypeInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
659126BD0BDD1728001921FB /* AllInOneFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 659126BC0BDD1728001921FB /* AllInOneFile.cpp */; };
65DFC93308EA173A00F7300B /* HashTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65DFC92D08EA173A00F7300B /* HashTable.cpp */; };
65FDE49C0BDD1D4A00E80111 /* Assertions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65E217B808E7EECC0023E5F6 /* Assertions.cpp */; settings = {COMPILER_FLAGS = "-Wno-missing-format-attribute"; }; };
@@ -132,6 +133,8 @@
86ADD1450FDDEA980006EEC2 /* ARMv7Assembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86ADD1430FDDEA980006EEC2 /* ARMv7Assembler.h */; };
86ADD1460FDDEA980006EEC2 /* MacroAssemblerARMv7.h in Headers */ = {isa = PBXBuildFile; fileRef = 86ADD1440FDDEA980006EEC2 /* MacroAssemblerARMv7.h */; };
86C36EEA0EE1289D00B3DF59 /* MacroAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86C36EE90EE1289D00B3DF59 /* MacroAssembler.h */; };
+ 86CA032E1038E8440028A609 /* Executable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CA032D1038E8440028A609 /* Executable.cpp */; };
+ 86CAFEE31035DDE60028A609 /* Executable.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CAFEE21035DDE60028A609 /* Executable.h */; settings = {ATTRIBUTES = (); }; };
86CC85A10EE79A4700288682 /* JITInlineMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CC85A00EE79A4700288682 /* JITInlineMethods.h */; };
86CC85A30EE79B7400288682 /* JITCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CC85A20EE79B7400288682 /* JITCall.cpp */; };
86CC85C40EE7A89400288682 /* JITPropertyAccess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */; };
@@ -155,7 +158,7 @@
905B02AE0E28640F006DF882 /* RefCountedLeakCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 905B02AD0E28640F006DF882 /* RefCountedLeakCounter.cpp */; };
90D3469C0E285280009492EE /* RefCountedLeakCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D3469B0E285280009492EE /* RefCountedLeakCounter.h */; settings = {ATTRIBUTES = (Private, ); }; };
93052C340FB792190048FDC3 /* ParserArena.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93052C320FB792190048FDC3 /* ParserArena.cpp */; };
- 93052C350FB792190048FDC3 /* ParserArena.h in Headers */ = {isa = PBXBuildFile; fileRef = 93052C330FB792190048FDC3 /* ParserArena.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 93052C350FB792190048FDC3 /* ParserArena.h in Headers */ = {isa = PBXBuildFile; fileRef = 93052C330FB792190048FDC3 /* ParserArena.h */; settings = {ATTRIBUTES = (); }; };
930754C108B0F68000AB3056 /* pcre_compile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930754BF08B0F68000AB3056 /* pcre_compile.cpp */; };
930754D008B0F74600AB3056 /* pcre_tables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930754CE08B0F74500AB3056 /* pcre_tables.cpp */; };
930754EB08B0F78500AB3056 /* pcre_exec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930754E908B0F78500AB3056 /* pcre_exec.cpp */; settings = {COMPILER_FLAGS = "-fno-move-loop-invariants"; }; };
@@ -207,11 +210,13 @@
A7A1F7AD0F252B3C00E184E2 /* ByteArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A1F7AB0F252B3C00E184E2 /* ByteArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7B48F490EE8936F00DCBDB6 /* ExecutableAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */; };
A7C530E4102A3813005BC741 /* MarkStackPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C530E3102A3813005BC741 /* MarkStackPosix.cpp */; };
+ A7D649AA1015224E009B2E1B /* PossiblyNull.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D649A91015224E009B2E1B /* PossiblyNull.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7E2EA6B0FB460CF00601F06 /* LiteralParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A7E2EA690FB460CF00601F06 /* LiteralParser.h */; };
A7E2EA6C0FB460CF00601F06 /* LiteralParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E2EA6A0FB460CF00601F06 /* LiteralParser.cpp */; };
A7F9935F0FD7325100A0B2D0 /* JSONObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F9935D0FD7325100A0B2D0 /* JSONObject.h */; };
A7F993600FD7325100A0B2D0 /* JSONObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7F9935E0FD7325100A0B2D0 /* JSONObject.cpp */; };
- A7F9949B0FD746A300A0B2D0 /* JSONObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F9949A0FD746A300A0B2D0 /* JSONObject.lut.h */; };
+ A7FB60A4103F7DC20017A286 /* PropertyDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7FB60A3103F7DC20017A286 /* PropertyDescriptor.cpp */; };
+ A7FB61001040C38B0017A286 /* PropertyDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC02E90D0E1839DB000F9297 /* ErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9050E1839DB000F9297 /* ErrorConstructor.h */; };
BC02E90F0E1839DB000F9297 /* ErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9070E1839DB000F9297 /* ErrorPrototype.h */; };
BC02E9110E1839DB000F9297 /* NativeErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9090E1839DB000F9297 /* NativeErrorConstructor.h */; };
@@ -240,7 +245,7 @@
BC18C3FC0E16F5CD00B34460 /* Deque.h in Headers */ = {isa = PBXBuildFile; fileRef = 5186111D0CC824830081412B /* Deque.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C3FD0E16F5CD00B34460 /* DisallowCType.h in Headers */ = {isa = PBXBuildFile; fileRef = 938C4F6B0CA06BCE00D9310A /* DisallowCType.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C3FE0E16F5CD00B34460 /* dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 651F6413039D5B5F0078395C /* dtoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
- BC18C4000E16F5CD00B34460 /* ExceptionHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = A72701B30DADE94900E548D7 /* ExceptionHelpers.h */; };
+ BC18C4000E16F5CD00B34460 /* ExceptionHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = A72701B30DADE94900E548D7 /* ExceptionHelpers.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C4020E16F5CD00B34460 /* FastMalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E217BA08E7EECC0023E5F6 /* FastMalloc.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C4030E16F5CD00B34460 /* Forward.h in Headers */ = {isa = PBXBuildFile; fileRef = 935AF46909E9D9DB00ACD1D8 /* Forward.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C4040E16F5CD00B34460 /* FunctionConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2680C10E16D4E900A06E92 /* FunctionConstructor.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -293,7 +298,7 @@
BC18C43B0E16F5CD00B34460 /* MathExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF6553B0A2048DE0038A194 /* MathExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C43C0E16F5CD00B34460 /* MathObject.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A86B0255597D01FF60F7 /* MathObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C43E0E16F5CD00B34460 /* MessageQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE798B0D6CA53D00FEA3BA /* MessageQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
- BC18C43F0E16F5CD00B34460 /* Nodes.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A86E0255597D01FF60F7 /* Nodes.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C43F0E16F5CD00B34460 /* Nodes.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A86E0255597D01FF60F7 /* Nodes.h */; settings = {ATTRIBUTES = (); }; };
BC18C4400E16F5CD00B34460 /* Noncopyable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9303F5690991190000AD71B8 /* Noncopyable.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C4410E16F5CD00B34460 /* NumberConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2680C30E16D4E900A06E92 /* NumberConstructor.h */; };
BC18C4420E16F5CD00B34460 /* NumberConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2680E60E16D52300A06E92 /* NumberConstructor.lut.h */; };
@@ -304,7 +309,7 @@
BC18C4480E16F5CD00B34460 /* Operations.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8780255597D01FF60F7 /* Operations.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C4490E16F5CD00B34460 /* OwnArrayPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 9303F5A409911A5800AD71B8 /* OwnArrayPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C44A0E16F5CD00B34460 /* OwnPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 9303F567099118FA00AD71B8 /* OwnPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
- BC18C44B0E16F5CD00B34460 /* Parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F0B3AA09BB4DC00068FCE3 /* Parser.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C44B0E16F5CD00B34460 /* Parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F0B3AA09BB4DC00068FCE3 /* Parser.h */; settings = {ATTRIBUTES = (); }; };
BC18C44C0E16F5CD00B34460 /* PassRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 6580F795094070560082C219 /* PassRefPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C44D0E16F5CD00B34460 /* pcre.h in Headers */ = {isa = PBXBuildFile; fileRef = 6541720F039E08B90058BFEB /* pcre.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C44E0E16F5CD00B34460 /* pcre_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E26BE508B1517100F85226 /* pcre_internal.h */; };
@@ -362,6 +367,7 @@
BC6AAAE50E1F426500AD87D8 /* ClassInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6AAAE40E1F426500AD87D8 /* ClassInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC756FC90E2031B200DE7D12 /* JSGlobalObjectFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */; };
BC7F8FB90E19D1C3008632C0 /* JSNumberCell.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7F8FB80E19D1C3008632C0 /* JSNumberCell.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC87CDB910712AD4000614CF /* JSONObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC87CDB810712ACA000614CF /* JSONObject.lut.h */; };
BC9041480EB9250900FE26FA /* StructureTransitionTable.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9041470EB9250900FE26FA /* StructureTransitionTable.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC95437D0EBA70FD0072B6D3 /* PropertyMapHashTable.h in Headers */ = {isa = PBXBuildFile; fileRef = BC95437C0EBA70FD0072B6D3 /* PropertyMapHashTable.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCCF0D080EF0AAB900413C8F /* StructureStubInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF0D070EF0AAB900413C8F /* StructureStubInfo.h */; };
@@ -502,6 +508,7 @@
1429DABE0ED263E700B89619 /* WRECParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WRECParser.cpp; sourceTree = "<group>"; };
1429DADE0ED2645B00B89619 /* WRECGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WRECGenerator.h; sourceTree = "<group>"; };
1429DADF0ED2645B00B89619 /* WRECGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WRECGenerator.cpp; sourceTree = "<group>"; };
+ 142D3938103E4560007DCB52 /* NumericStrings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumericStrings.h; sourceTree = "<group>"; };
1440051F0A531D3B0005F061 /* Node.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Node.h; path = tests/Node.h; sourceTree = "<group>"; };
144005200A531D3B0005F061 /* Node.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Node.c; path = tests/Node.c; sourceTree = "<group>"; };
144007480A536CC20005F061 /* NodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NodeList.h; path = tests/NodeList.h; sourceTree = "<group>"; };
@@ -584,7 +591,7 @@
5DA479650CFBCF56009328A0 /* TCPackedCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCPackedCache.h; sourceTree = "<group>"; };
5DBD18AF0C5401A700C15EAE /* MallocZoneSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MallocZoneSupport.h; sourceTree = "<group>"; };
5DE3D0F40DD8DDFB00468714 /* WebKitAvailability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitAvailability.h; sourceTree = "<group>"; };
- 6507D2970E871E4A00D7D896 /* TypeInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeInfo.h; sourceTree = "<group>"; };
+ 6507D2970E871E4A00D7D896 /* JSTypeInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTypeInfo.h; sourceTree = "<group>"; };
651F6412039D5B5F0078395C /* dtoa.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dtoa.cpp; sourceTree = "<group>"; tabWidth = 8; };
651F6413039D5B5F0078395C /* dtoa.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = dtoa.h; sourceTree = "<group>"; tabWidth = 8; };
652246A40C8D7A0E007BDAF7 /* HashIterators.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashIterators.h; sourceTree = "<group>"; };
@@ -646,6 +653,8 @@
86ADD1430FDDEA980006EEC2 /* ARMv7Assembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARMv7Assembler.h; sourceTree = "<group>"; };
86ADD1440FDDEA980006EEC2 /* MacroAssemblerARMv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerARMv7.h; sourceTree = "<group>"; };
86C36EE90EE1289D00B3DF59 /* MacroAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssembler.h; sourceTree = "<group>"; };
+ 86CA032D1038E8440028A609 /* Executable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Executable.cpp; sourceTree = "<group>"; };
+ 86CAFEE21035DDE60028A609 /* Executable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Executable.h; sourceTree = "<group>"; };
86CC85A00EE79A4700288682 /* JITInlineMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITInlineMethods.h; sourceTree = "<group>"; };
86CC85A20EE79B7400288682 /* JITCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITCall.cpp; sourceTree = "<group>"; };
86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPropertyAccess.cpp; sourceTree = "<group>"; };
@@ -752,6 +761,7 @@
A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecutableAllocator.h; sourceTree = "<group>"; };
A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocator.cpp; sourceTree = "<group>"; };
A7C530E3102A3813005BC741 /* MarkStackPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkStackPosix.cpp; sourceTree = "<group>"; };
+ A7D649A91015224E009B2E1B /* PossiblyNull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PossiblyNull.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>"; };
@@ -760,7 +770,8 @@
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>"; };
A7F9935E0FD7325100A0B2D0 /* JSONObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONObject.cpp; sourceTree = "<group>"; };
- A7F9949A0FD746A300A0B2D0 /* JSONObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSONObject.lut.h; path = /Users/oliver/builds/Debug/DerivedSources/JavaScriptCore/JSONObject.lut.h; sourceTree = "<absolute>"; };
+ A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PropertyDescriptor.h; sourceTree = "<group>"; };
+ A7FB60A3103F7DC20017A286 /* PropertyDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PropertyDescriptor.cpp; sourceTree = "<group>"; };
A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObjectFunctions.h; sourceTree = "<group>"; };
A8E894330CD0603F00367179 /* JSGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObject.h; sourceTree = "<group>"; };
BC02E9040E1839DB000F9297 /* ErrorConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorConstructor.cpp; sourceTree = "<group>"; };
@@ -831,6 +842,7 @@
BC7952350E15EB5600A898AB /* BooleanPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BooleanPrototype.h; sourceTree = "<group>"; };
BC7F8FB80E19D1C3008632C0 /* JSNumberCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNumberCell.h; sourceTree = "<group>"; };
BC7F8FBA0E19D1EF008632C0 /* JSCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCell.cpp; sourceTree = "<group>"; };
+ BC87CDB810712ACA000614CF /* JSONObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONObject.lut.h; sourceTree = "<group>"; };
BC8F3CCF0DAF17BA00577A80 /* ConstructData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConstructData.h; sourceTree = "<group>"; };
BC9041470EB9250900FE26FA /* StructureTransitionTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureTransitionTable.h; sourceTree = "<group>"; };
BC95437C0EBA70FD0072B6D3 /* PropertyMapHashTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PropertyMapHashTable.h; sourceTree = "<group>"; };
@@ -1176,7 +1188,7 @@
BCD203E70E1718F4002C7E82 /* DatePrototype.lut.h */,
65FB3F4809D11B2400F49DEB /* grammar.cpp */,
BC18C52F0E16FCEB00B34460 /* grammar.h */,
- A7F9949A0FD746A300A0B2D0 /* JSONObject.lut.h */,
+ BC87CDB810712ACA000614CF /* JSONObject.lut.h */,
BC18C52D0E16FCE100B34460 /* lexer.lut.h */,
BC18C5290E16FCC200B34460 /* MathObject.lut.h */,
BC2680E60E16D52300A06E92 /* NumberConstructor.lut.h */,
@@ -1242,6 +1254,7 @@
44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */,
6580F795094070560082C219 /* PassRefPtr.h */,
65D6D87E09B5A32E0002E4D7 /* Platform.h */,
+ A7D649A91015224E009B2E1B /* PossiblyNull.h */,
0B1F921B0F17502D0036468E /* PtrAndFlags.h */,
088FA5B90EF76D4300578E6F /* RandomNumber.cpp */,
088FA5BA0EF76D4300578E6F /* RandomNumber.h */,
@@ -1330,6 +1343,7 @@
7EF6E0BB0EB7A1EC0079AFAF /* runtime */ = {
isa = PBXGroup;
children = (
+ A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */,
BCF605110E203EF800B9A64D /* ArgList.cpp */,
BCF605120E203EF800B9A64D /* ArgList.h */,
BC257DE50E1F51C50016B6C9 /* Arguments.cpp */,
@@ -1375,6 +1389,8 @@
BC02E9070E1839DB000F9297 /* ErrorPrototype.h */,
1429D8770ED21ACD00B89619 /* ExceptionHelpers.cpp */,
A72701B30DADE94900E548D7 /* ExceptionHelpers.h */,
+ 86CA032D1038E8440028A609 /* Executable.cpp */,
+ 86CAFEE21035DDE60028A609 /* Executable.h */,
BC2680C00E16D4E900A06E92 /* FunctionConstructor.cpp */,
BC2680C10E16D4E900A06E92 /* FunctionConstructor.h */,
F692A85C0255597D01FF60F7 /* FunctionPrototype.cpp */,
@@ -1447,6 +1463,7 @@
F692A8710255597D01FF60F7 /* NumberObject.h */,
BC2680C40E16D4E900A06E92 /* NumberPrototype.cpp */,
BC2680C50E16D4E900A06E92 /* NumberPrototype.h */,
+ 142D3938103E4560007DCB52 /* NumericStrings.h */,
BC2680C60E16D4E900A06E92 /* ObjectConstructor.cpp */,
BC2680C70E16D4E900A06E92 /* ObjectConstructor.h */,
BC2680C80E16D4E900A06E92 /* ObjectPrototype.cpp */,
@@ -1493,12 +1510,13 @@
14A42E3E0F4F60EE00599099 /* TimeoutChecker.h */,
5D53726D0E1C546B0021E549 /* Tracing.d */,
5D53726E0E1C54880021E549 /* Tracing.h */,
- 6507D2970E871E4A00D7D896 /* TypeInfo.h */,
+ 6507D2970E871E4A00D7D896 /* JSTypeInfo.h */,
F692A8850255597D01FF60F7 /* UString.cpp */,
F692A8860255597D01FF60F7 /* UString.h */,
A779558F101A74D500114E55 /* MarkStack.h */,
A7C530E3102A3813005BC741 /* MarkStackPosix.cpp */,
A74B3498102A5F8E0032AB98 /* MarkStack.cpp */,
+ A7FB60A3103F7DC20017A286 /* PropertyDescriptor.cpp */,
);
path = runtime;
sourceTree = "<group>";
@@ -1760,7 +1778,6 @@
BC18C4240E16F5CD00B34460 /* JSObject.h in Headers */,
BC18C4250E16F5CD00B34460 /* JSObjectRef.h in Headers */,
A7F9935F0FD7325100A0B2D0 /* JSONObject.h in Headers */,
- A7F9949B0FD746A300A0B2D0 /* JSONObject.lut.h in Headers */,
9534AAFB0E5B7A9600B8A45B /* JSProfilerPrivate.h in Headers */,
BC18C4260E16F5CD00B34460 /* JSRetainPtr.h in Headers */,
BC18C4270E16F5CD00B34460 /* JSString.h in Headers */,
@@ -1884,7 +1901,7 @@
BC18C4710E16F5CD00B34460 /* ThreadSpecific.h in Headers */,
14A42E400F4F60EE00599099 /* TimeoutChecker.h in Headers */,
5D53726F0E1C54880021E549 /* Tracing.h in Headers */,
- 6507D29E0E871E5E00D7D896 /* TypeInfo.h in Headers */,
+ 6507D29E0E871E5E00D7D896 /* JSTypeInfo.h in Headers */,
0B4D7E630F319AC800AD7E58 /* TypeTraits.h in Headers */,
BC18C4720E16F5CD00B34460 /* ucpinternal.h in Headers */,
BC18C4730E16F5CD00B34460 /* Unicode.h in Headers */,
@@ -1902,6 +1919,11 @@
1429DABF0ED263E700B89619 /* WRECParser.h in Headers */,
9688CB160ED12B4E001D649F /* X86Assembler.h in Headers */,
A7795590101A74D500114E55 /* MarkStack.h in Headers */,
+ A7D649AA1015224E009B2E1B /* PossiblyNull.h in Headers */,
+ 86CAFEE31035DDE60028A609 /* Executable.h in Headers */,
+ 142D3939103E4560007DCB52 /* NumericStrings.h in Headers */,
+ A7FB61001040C38B0017A286 /* PropertyDescriptor.h in Headers */,
+ BC87CDB910712AD4000614CF /* JSONObject.lut.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2270,6 +2292,8 @@
1429DAC00ED263E700B89619 /* WRECParser.cpp in Sources */,
A7C530E4102A3813005BC741 /* MarkStackPosix.cpp in Sources */,
A74B3499102A5F8E0032AB98 /* MarkStack.cpp in Sources */,
+ 86CA032E1038E8440028A609 /* Executable.cpp in Sources */,
+ A7FB60A4103F7DC20017A286 /* PropertyDescriptor.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/JavaScriptCore/JavaScriptCoreSources.bkl b/JavaScriptCore/JavaScriptCoreSources.bkl
index 1bdf251..1852d12 100644
--- a/JavaScriptCore/JavaScriptCoreSources.bkl
+++ b/JavaScriptCore/JavaScriptCoreSources.bkl
@@ -134,6 +134,7 @@ Source files for JSCore.
runtime/ObjectConstructor.cpp
runtime/ObjectPrototype.cpp
runtime/Operations.cpp
+ runtime/PropertyDescriptor.cpp
runtime/PropertyNameArray.cpp
runtime/PropertySlot.cpp
runtime/PrototypeFunction.cpp
diff --git a/JavaScriptCore/assembler/ARMAssembler.cpp b/JavaScriptCore/assembler/ARMAssembler.cpp
index 69daa16..1324586 100644
--- a/JavaScriptCore/assembler/ARMAssembler.cpp
+++ b/JavaScriptCore/assembler/ARMAssembler.cpp
@@ -26,7 +26,7 @@
#include "config.h"
-#if ENABLE(ASSEMBLER) && PLATFORM(ARM)
+#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
#include "ARMAssembler.h"
@@ -49,11 +49,11 @@ ARMWord* ARMAssembler::getLdrImmAddress(ARMWord* insn, uint32_t* constPool)
return reinterpret_cast<ARMWord*>(addr - (*insn & SDT_OFFSET_MASK));
}
-void ARMAssembler::linkBranch(void* code, JmpSrc from, void* to)
+void ARMAssembler::linkBranch(void* code, JmpSrc from, void* to, int useConstantPool)
{
ARMWord* insn = reinterpret_cast<ARMWord*>(code) + (from.m_offset / sizeof(ARMWord));
- if (!from.m_latePatch) {
+ if (!useConstantPool) {
int diff = reinterpret_cast<ARMWord*>(to) - reinterpret_cast<ARMWord*>(insn + 2);
if ((diff <= BOFFSET_MAX && diff >= BOFFSET_MIN)) {
@@ -291,10 +291,10 @@ void ARMAssembler::dataTransfer32(bool isLoad, RegisterID srcDst, RegisterID bas
if (offset <= 0xfff)
dtr_u(isLoad, srcDst, base, offset);
else if (offset <= 0xfffff) {
- add_r(ARM::S0, base, OP2_IMM | (offset >> 12) | (10 << 8));
- dtr_u(isLoad, srcDst, ARM::S0, offset & 0xfff);
+ add_r(ARMRegisters::S0, base, OP2_IMM | (offset >> 12) | (10 << 8));
+ dtr_u(isLoad, srcDst, ARMRegisters::S0, offset & 0xfff);
} else {
- ARMWord reg = getImm(offset, ARM::S0);
+ ARMWord reg = getImm(offset, ARMRegisters::S0);
dtr_ur(isLoad, srcDst, base, reg);
}
} else {
@@ -302,10 +302,10 @@ void ARMAssembler::dataTransfer32(bool isLoad, RegisterID srcDst, RegisterID bas
if (offset <= 0xfff)
dtr_d(isLoad, srcDst, base, offset);
else if (offset <= 0xfffff) {
- sub_r(ARM::S0, base, OP2_IMM | (offset >> 12) | (10 << 8));
- dtr_d(isLoad, srcDst, ARM::S0, offset & 0xfff);
+ sub_r(ARMRegisters::S0, base, OP2_IMM | (offset >> 12) | (10 << 8));
+ dtr_d(isLoad, srcDst, ARMRegisters::S0, offset & 0xfff);
} else {
- ARMWord reg = getImm(offset, ARM::S0);
+ ARMWord reg = getImm(offset, ARMRegisters::S0);
dtr_dr(isLoad, srcDst, base, reg);
}
}
@@ -319,19 +319,19 @@ void ARMAssembler::baseIndexTransfer32(bool isLoad, RegisterID srcDst, RegisterI
op2 = lsl(index, scale);
if (offset >= 0 && offset <= 0xfff) {
- add_r(ARM::S0, base, op2);
- dtr_u(isLoad, srcDst, ARM::S0, offset);
+ add_r(ARMRegisters::S0, base, op2);
+ dtr_u(isLoad, srcDst, ARMRegisters::S0, offset);
return;
}
if (offset <= 0 && offset >= -0xfff) {
- add_r(ARM::S0, base, op2);
- dtr_d(isLoad, srcDst, ARM::S0, -offset);
+ add_r(ARMRegisters::S0, base, op2);
+ dtr_d(isLoad, srcDst, ARMRegisters::S0, -offset);
return;
}
- ldr_un_imm(ARM::S0, offset);
- add_r(ARM::S0, ARM::S0, op2);
- dtr_ur(isLoad, srcDst, base, ARM::S0);
+ ldr_un_imm(ARMRegisters::S0, offset);
+ add_r(ARMRegisters::S0, ARMRegisters::S0, op2);
+ dtr_ur(isLoad, srcDst, base, ARMRegisters::S0);
}
void ARMAssembler::doubleTransfer(bool isLoad, FPRegisterID srcDst, RegisterID base, int32_t offset)
@@ -342,8 +342,8 @@ void ARMAssembler::doubleTransfer(bool isLoad, FPRegisterID srcDst, RegisterID b
return;
}
if (offset <= 0x3ffff && offset >= 0) {
- add_r(ARM::S0, base, OP2_IMM | (offset >> 10) | (11 << 8));
- fdtr_u(isLoad, srcDst, ARM::S0, (offset >> 2) & 0xff);
+ add_r(ARMRegisters::S0, base, OP2_IMM | (offset >> 10) | (11 << 8));
+ fdtr_u(isLoad, srcDst, ARMRegisters::S0, (offset >> 2) & 0xff);
return;
}
offset = -offset;
@@ -353,27 +353,36 @@ void ARMAssembler::doubleTransfer(bool isLoad, FPRegisterID srcDst, RegisterID b
return;
}
if (offset <= 0x3ffff && offset >= 0) {
- sub_r(ARM::S0, base, OP2_IMM | (offset >> 10) | (11 << 8));
- fdtr_d(isLoad, srcDst, ARM::S0, (offset >> 2) & 0xff);
+ sub_r(ARMRegisters::S0, base, OP2_IMM | (offset >> 10) | (11 << 8));
+ fdtr_d(isLoad, srcDst, ARMRegisters::S0, (offset >> 2) & 0xff);
return;
}
offset = -offset;
}
- ldr_un_imm(ARM::S0, offset);
- add_r(ARM::S0, ARM::S0, base);
- fdtr_u(isLoad, srcDst, ARM::S0, 0);
+ ldr_un_imm(ARMRegisters::S0, offset);
+ add_r(ARMRegisters::S0, ARMRegisters::S0, base);
+ fdtr_u(isLoad, srcDst, ARMRegisters::S0, 0);
}
void* ARMAssembler::executableCopy(ExecutablePool* allocator)
{
+ // 64-bit alignment is required for next constant pool and JIT code as well
+ m_buffer.flushWithoutBarrier(true);
+ if (m_buffer.uncheckedSize() & 0x7)
+ bkpt(0);
+
char* data = reinterpret_cast<char*>(m_buffer.executableCopy(allocator));
for (Jumps::Iterator iter = m_jumps.begin(); iter != m_jumps.end(); ++iter) {
- ARMWord* ldrAddr = reinterpret_cast<ARMWord*>(data + *iter);
- ARMWord* offset = getLdrImmAddress(ldrAddr);
- if (*offset != 0xffffffff)
- linkBranch(data, JmpSrc(*iter), data + *offset);
+ // The last bit is set if the constant must be placed on constant pool.
+ int pos = (*iter) & (~0x1);
+ ARMWord* ldrAddr = reinterpret_cast<ARMWord*>(data + pos);
+ ARMWord offset = *getLdrImmAddress(ldrAddr);
+ if (offset != 0xffffffff) {
+ JmpSrc jmpSrc(pos);
+ linkBranch(data, jmpSrc, data + offset, ((*iter) & 1));
+ }
}
return data;
@@ -381,4 +390,4 @@ void* ARMAssembler::executableCopy(ExecutablePool* allocator)
} // namespace JSC
-#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM)
+#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
diff --git a/JavaScriptCore/assembler/ARMAssembler.h b/JavaScriptCore/assembler/ARMAssembler.h
index d3fe782..9f9a450 100644
--- a/JavaScriptCore/assembler/ARMAssembler.h
+++ b/JavaScriptCore/assembler/ARMAssembler.h
@@ -29,55 +29,55 @@
#include <wtf/Platform.h>
-#if ENABLE(ASSEMBLER) && PLATFORM(ARM)
+#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
#include "AssemblerBufferWithConstantPool.h"
#include <wtf/Assertions.h>
namespace JSC {
-typedef uint32_t ARMWord;
-
-namespace ARM {
- typedef enum {
- r0 = 0,
- r1,
- r2,
- r3,
- S0 = r3,
- r4,
- r5,
- r6,
- r7,
- r8,
- S1 = r8,
- r9,
- r10,
- r11,
- r12,
- r13,
- sp = r13,
- r14,
- lr = r14,
- r15,
- pc = r15
- } RegisterID;
-
- typedef enum {
- d0,
- d1,
- d2,
- d3,
- SD0 = d3
- } FPRegisterID;
-
-} // namespace ARM
+ typedef uint32_t ARMWord;
+
+ namespace ARMRegisters {
+ typedef enum {
+ r0 = 0,
+ r1,
+ r2,
+ r3,
+ S0 = r3,
+ r4,
+ r5,
+ r6,
+ r7,
+ r8,
+ S1 = r8,
+ r9,
+ r10,
+ r11,
+ r12,
+ r13,
+ sp = r13,
+ r14,
+ lr = r14,
+ r15,
+ pc = r15
+ } RegisterID;
+
+ typedef enum {
+ d0,
+ d1,
+ d2,
+ d3,
+ SD0 = d3
+ } FPRegisterID;
+
+ } // namespace ARMRegisters
class ARMAssembler {
public:
- typedef ARM::RegisterID RegisterID;
- typedef ARM::FPRegisterID FPRegisterID;
+ typedef ARMRegisters::RegisterID RegisterID;
+ typedef ARMRegisters::FPRegisterID FPRegisterID;
typedef AssemblerBufferWithConstantPool<2048, 4, 4, ARMAssembler> ARMBuffer;
- typedef WTF::SegmentedVector<int, 64> Jumps;
+ typedef SegmentedVector<int, 64> Jumps;
ARMAssembler() { }
@@ -180,20 +180,16 @@ namespace ARM {
public:
JmpSrc()
: m_offset(-1)
- , m_latePatch(false)
{
}
- void enableLatePatch() { m_latePatch = true; }
private:
JmpSrc(int offset)
: m_offset(offset)
- , m_latePatch(false)
{
}
- int m_offset : 31;
- int m_latePatch : 1;
+ int m_offset;
};
class JmpDst {
@@ -334,12 +330,12 @@ namespace ARM {
void mov_r(int rd, ARMWord op2, Condition cc = AL)
{
- emitInst(static_cast<ARMWord>(cc) | MOV, rd, ARM::r0, op2);
+ emitInst(static_cast<ARMWord>(cc) | MOV, rd, ARMRegisters::r0, op2);
}
void movs_r(int rd, ARMWord op2, Condition cc = AL)
{
- emitInst(static_cast<ARMWord>(cc) | MOV | SET_CC, rd, ARM::r0, op2);
+ emitInst(static_cast<ARMWord>(cc) | MOV | SET_CC, rd, ARMRegisters::r0, op2);
}
void bic_r(int rd, int rn, ARMWord op2, Condition cc = AL)
@@ -354,12 +350,12 @@ namespace ARM {
void mvn_r(int rd, ARMWord op2, Condition cc = AL)
{
- emitInst(static_cast<ARMWord>(cc) | MVN, rd, ARM::r0, op2);
+ emitInst(static_cast<ARMWord>(cc) | MVN, rd, ARMRegisters::r0, op2);
}
void mvns_r(int rd, ARMWord op2, Condition cc = AL)
{
- emitInst(static_cast<ARMWord>(cc) | MVN | SET_CC, rd, ARM::r0, op2);
+ emitInst(static_cast<ARMWord>(cc) | MVN | SET_CC, rd, ARMRegisters::r0, op2);
}
void mul_r(int rd, int rn, int rm, Condition cc = AL)
@@ -399,12 +395,12 @@ namespace ARM {
void ldr_imm(int rd, ARMWord imm, Condition cc = AL)
{
- m_buffer.putIntWithConstantInt(static_cast<ARMWord>(cc) | DTR | DT_LOAD | DT_UP | RN(ARM::pc) | RD(rd), imm, true);
+ m_buffer.putIntWithConstantInt(static_cast<ARMWord>(cc) | DTR | DT_LOAD | DT_UP | RN(ARMRegisters::pc) | RD(rd), imm, true);
}
void ldr_un_imm(int rd, ARMWord imm, Condition cc = AL)
{
- m_buffer.putIntWithConstantInt(static_cast<ARMWord>(cc) | DTR | DT_LOAD | DT_UP | RN(ARM::pc) | RD(rd), imm);
+ m_buffer.putIntWithConstantInt(static_cast<ARMWord>(cc) | DTR | DT_LOAD | DT_UP | RN(ARMRegisters::pc) | RD(rd), imm);
}
void dtr_u(bool isLoad, int rd, int rb, ARMWord op2, Condition cc = AL)
@@ -462,23 +458,23 @@ namespace ARM {
void push_r(int reg, Condition cc = AL)
{
ASSERT(ARMWord(reg) <= 0xf);
- m_buffer.putInt(cc | DTR | DT_WB | RN(ARM::sp) | RD(reg) | 0x4);
+ m_buffer.putInt(cc | DTR | DT_WB | RN(ARMRegisters::sp) | RD(reg) | 0x4);
}
void pop_r(int reg, Condition cc = AL)
{
ASSERT(ARMWord(reg) <= 0xf);
- m_buffer.putInt(cc | (DTR ^ DT_PRE) | DT_LOAD | DT_UP | RN(ARM::sp) | RD(reg) | 0x4);
+ m_buffer.putInt(cc | (DTR ^ DT_PRE) | DT_LOAD | DT_UP | RN(ARMRegisters::sp) | RD(reg) | 0x4);
}
inline void poke_r(int reg, Condition cc = AL)
{
- dtr_d(false, ARM::sp, 0, reg, cc);
+ dtr_d(false, ARMRegisters::sp, 0, reg, cc);
}
inline void peek_r(int reg, Condition cc = AL)
{
- dtr_u(true, reg, ARM::sp, 0, cc);
+ dtr_u(true, reg, ARMRegisters::sp, 0, cc);
}
void fmsr_r(int dd, int rn, Condition cc = AL)
@@ -509,49 +505,49 @@ namespace ARM {
m_buffer.putInt(BKPT | ((value & 0xff0) << 4) | (value & 0xf));
#else
// Cannot access to Zero memory address
- dtr_dr(true, ARM::S0, ARM::S0, ARM::S0);
+ dtr_dr(true, ARMRegisters::S0, ARMRegisters::S0, ARMRegisters::S0);
#endif
}
static ARMWord lsl(int reg, ARMWord value)
{
- ASSERT(reg <= ARM::pc);
+ ASSERT(reg <= ARMRegisters::pc);
ASSERT(value <= 0x1f);
return reg | (value << 7) | 0x00;
}
static ARMWord lsr(int reg, ARMWord value)
{
- ASSERT(reg <= ARM::pc);
+ ASSERT(reg <= ARMRegisters::pc);
ASSERT(value <= 0x1f);
return reg | (value << 7) | 0x20;
}
static ARMWord asr(int reg, ARMWord value)
{
- ASSERT(reg <= ARM::pc);
+ ASSERT(reg <= ARMRegisters::pc);
ASSERT(value <= 0x1f);
return reg | (value << 7) | 0x40;
}
static ARMWord lsl_r(int reg, int shiftReg)
{
- ASSERT(reg <= ARM::pc);
- ASSERT(shiftReg <= ARM::pc);
+ ASSERT(reg <= ARMRegisters::pc);
+ ASSERT(shiftReg <= ARMRegisters::pc);
return reg | (shiftReg << 8) | 0x10;
}
static ARMWord lsr_r(int reg, int shiftReg)
{
- ASSERT(reg <= ARM::pc);
- ASSERT(shiftReg <= ARM::pc);
+ ASSERT(reg <= ARMRegisters::pc);
+ ASSERT(shiftReg <= ARMRegisters::pc);
return reg | (shiftReg << 8) | 0x30;
}
static ARMWord asr_r(int reg, int shiftReg)
{
- ASSERT(reg <= ARM::pc);
- ASSERT(shiftReg <= ARM::pc);
+ ASSERT(reg <= ARMRegisters::pc);
+ ASSERT(shiftReg <= ARMRegisters::pc);
return reg | (shiftReg << 8) | 0x50;
}
@@ -567,6 +563,11 @@ namespace ARM {
m_buffer.ensureSpace(insnSpace, constSpace);
}
+ int sizeOfConstantPool()
+ {
+ return m_buffer.sizeOfConstantPool();
+ }
+
JmpDst label()
{
return JmpDst(m_buffer.size());
@@ -575,16 +576,17 @@ namespace ARM {
JmpDst align(int alignment)
{
while (!m_buffer.isAligned(alignment))
- mov_r(ARM::r0, ARM::r0);
+ mov_r(ARMRegisters::r0, ARMRegisters::r0);
return label();
}
- JmpSrc jmp(Condition cc = AL)
+ JmpSrc jmp(Condition cc = AL, int useConstantPool = 0)
{
- int s = size();
- ldr_un_imm(ARM::pc, 0xffffffff, cc);
- m_jumps.append(s);
+ ensureSpace(sizeof(ARMWord), sizeof(ARMWord));
+ int s = m_buffer.uncheckedSize();
+ ldr_un_imm(ARMRegisters::pc, 0xffffffff, cc);
+ m_jumps.append(s | (useConstantPool & 0x1));
return JmpSrc(s);
}
@@ -593,7 +595,7 @@ namespace ARM {
// Patching helpers
static ARMWord* getLdrImmAddress(ARMWord* insn, uint32_t* constPool = 0);
- static void linkBranch(void* code, JmpSrc from, void* to);
+ static void linkBranch(void* code, JmpSrc from, void* to, int useConstantPool = 0);
static void patchPointerInternal(intptr_t from, void* to)
{
@@ -660,7 +662,7 @@ namespace ARM {
static void linkCall(void* code, JmpSrc from, void* to)
{
- linkBranch(code, from, to);
+ linkBranch(code, from, to, true);
}
static void relinkCall(void* from, void* to)
@@ -727,25 +729,25 @@ namespace ARM {
private:
ARMWord RM(int reg)
{
- ASSERT(reg <= ARM::pc);
+ ASSERT(reg <= ARMRegisters::pc);
return reg;
}
ARMWord RS(int reg)
{
- ASSERT(reg <= ARM::pc);
+ ASSERT(reg <= ARMRegisters::pc);
return reg << 8;
}
ARMWord RD(int reg)
{
- ASSERT(reg <= ARM::pc);
+ ASSERT(reg <= ARMRegisters::pc);
return reg << 12;
}
ARMWord RN(int reg)
{
- ASSERT(reg <= ARM::pc);
+ ASSERT(reg <= ARMRegisters::pc);
return reg << 16;
}
@@ -762,6 +764,6 @@ namespace ARM {
} // namespace JSC
-#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM)
+#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
#endif // ARMAssembler_h
diff --git a/JavaScriptCore/assembler/ARMv7Assembler.h b/JavaScriptCore/assembler/ARMv7Assembler.h
index f7e2fb4..078de44 100644
--- a/JavaScriptCore/assembler/ARMv7Assembler.h
+++ b/JavaScriptCore/assembler/ARMv7Assembler.h
@@ -28,7 +28,7 @@
#include <wtf/Platform.h>
-#if ENABLE(ASSEMBLER) && PLATFORM_ARM_ARCH(7)
+#if ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2)
#include "AssemblerBuffer.h"
#include <wtf/Assertions.h>
@@ -37,7 +37,7 @@
namespace JSC {
-namespace ARM {
+namespace ARMRegisters {
typedef enum {
r0,
r1,
@@ -199,7 +199,7 @@ class ARMThumbImmediate {
};
} PatternBytes;
- ALWAYS_INLINE static int32_t countLeadingZerosPartial(uint32_t& value, int32_t& zeros, const int N)
+ ALWAYS_INLINE static void countLeadingZerosPartial(uint32_t& value, int32_t& zeros, const int N)
{
if (value & ~((1<<N)-1)) /* check for any of the top N bits (of 2N bits) are set */ \
value >>= N; /* if any were set, lose the bottom N */ \
@@ -407,8 +407,8 @@ register writeback
class ARMv7Assembler {
public:
- typedef ARM::RegisterID RegisterID;
- typedef ARM::FPRegisterID FPRegisterID;
+ typedef ARMRegisters::RegisterID RegisterID;
+ typedef ARMRegisters::FPRegisterID FPRegisterID;
// (HS, LO, HI, LS) -> (AE, B, A, BE)
// (VS, VC) -> (O, NO)
@@ -442,7 +442,6 @@ public:
{
}
- void enableLatePatch() { }
private:
JmpSrc(int offset)
: m_offset(offset)
@@ -481,7 +480,7 @@ private:
// ARMv7, Appx-A.6.3
bool BadReg(RegisterID reg)
{
- return (reg == ARM::sp) || (reg == ARM::pc);
+ return (reg == ARMRegisters::sp) || (reg == ARMRegisters::pc);
}
bool isSingleRegister(FPRegisterID reg)
@@ -693,16 +692,16 @@ public:
void add(RegisterID rd, RegisterID rn, ARMThumbImmediate imm)
{
// Rd can only be SP if Rn is also SP.
- ASSERT((rd != ARM::sp) || (rn == ARM::sp));
- ASSERT(rd != ARM::pc);
- ASSERT(rn != ARM::pc);
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(imm.isValid());
- if (rn == ARM::sp) {
+ if (rn == ARMRegisters::sp) {
if (!(rd & 8) && imm.isUInt10()) {
m_formatter.oneWordOp5Reg3Imm8(OP_ADD_SP_imm_T1, rd, imm.getUInt10() >> 2);
return;
- } else if ((rd == ARM::sp) && imm.isUInt9()) {
+ } else if ((rd == ARMRegisters::sp) && imm.isUInt9()) {
m_formatter.oneWordOp9Imm7(OP_ADD_SP_imm_T2, imm.getUInt9() >> 2);
return;
}
@@ -726,9 +725,9 @@ public:
void add(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
{
- ASSERT((rd != ARM::sp) || (rn == ARM::sp));
- ASSERT(rd != ARM::pc);
- ASSERT(rn != ARM::pc);
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(!BadReg(rm));
m_formatter.twoWordOp12Reg4FourFours(OP_ADD_reg_T3, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm));
}
@@ -750,9 +749,9 @@ public:
void add_S(RegisterID rd, RegisterID rn, ARMThumbImmediate imm)
{
// Rd can only be SP if Rn is also SP.
- ASSERT((rd != ARM::sp) || (rn == ARM::sp));
- ASSERT(rd != ARM::pc);
- ASSERT(rn != ARM::pc);
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(imm.isEncodedImm());
if (!((rd | rn) & 8)) {
@@ -771,9 +770,9 @@ public:
// Not allowed in an IT (if then) block?
void add_S(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
{
- ASSERT((rd != ARM::sp) || (rn == ARM::sp));
- ASSERT(rd != ARM::pc);
- ASSERT(rn != ARM::pc);
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(!BadReg(rm));
m_formatter.twoWordOp12Reg4FourFours(OP_ADD_S_reg_T3, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm));
}
@@ -839,7 +838,7 @@ public:
// Only allowed in IT (if then) block if last instruction.
JmpSrc blx(RegisterID rm)
{
- ASSERT(rm != ARM::pc);
+ ASSERT(rm != ARMRegisters::pc);
m_formatter.oneWordOp8RegReg143(OP_BLX, rm, (RegisterID)8);
return JmpSrc(m_formatter.size());
}
@@ -858,7 +857,7 @@ public:
void cmn(RegisterID rn, ARMThumbImmediate imm)
{
- ASSERT(rn != ARM::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(imm.isEncodedImm());
m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_CMN_imm, rn, (RegisterID)0xf, imm);
@@ -866,7 +865,7 @@ public:
void cmp(RegisterID rn, ARMThumbImmediate imm)
{
- ASSERT(rn != ARM::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(imm.isEncodedImm());
if (!(rn & 8) && imm.isUInt8())
@@ -877,7 +876,7 @@ public:
void cmp(RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
{
- ASSERT(rn != ARM::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(!BadReg(rm));
m_formatter.twoWordOp12Reg4FourFours(OP_CMP_reg_T2, rn, FourFours(shift.hi4(), 0xf, shift.lo4(), rm));
}
@@ -939,15 +938,15 @@ public:
m_formatter.oneWordOp8Imm8(OP_IT, ifThenElse(cond, inst2if, inst3if, inst4if));
}
- // rt == ARM::pc only allowed if last instruction in IT (if then) block.
+ // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block.
void ldr(RegisterID rt, RegisterID rn, ARMThumbImmediate imm)
{
- ASSERT(rn != ARM::pc); // LDR (literal)
+ ASSERT(rn != ARMRegisters::pc); // LDR (literal)
ASSERT(imm.isUInt12());
if (!((rt | rn) & 8) && imm.isUInt7())
m_formatter.oneWordOp5Imm5Reg3Reg3(OP_LDR_imm_T1, imm.getUInt7() >> 2, rn, rt);
- else if ((rn == ARM::sp) && !(rt & 8) && imm.isUInt10())
+ else if ((rn == ARMRegisters::sp) && !(rt & 8) && imm.isUInt10())
m_formatter.oneWordOp5Reg3Imm8(OP_LDR_imm_T2, rt, imm.getUInt10() >> 2);
else
m_formatter.twoWordOp12Reg4Reg4Imm12(OP_LDR_imm_T3, rn, rt, imm.getUInt12());
@@ -966,8 +965,8 @@ public:
// if (wback) REG[rn] = _tmp
void ldr(RegisterID rt, RegisterID rn, int offset, bool index, bool wback)
{
- ASSERT(rt != ARM::pc);
- ASSERT(rn != ARM::pc);
+ ASSERT(rt != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(index || wback);
ASSERT(!wback | (rt != rn));
@@ -986,10 +985,10 @@ public:
m_formatter.twoWordOp12Reg4Reg4Imm12(OP_LDR_imm_T4, rn, rt, offset);
}
- // rt == ARM::pc only allowed if last instruction in IT (if then) block.
+ // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block.
void ldr(RegisterID rt, RegisterID rn, RegisterID rm, unsigned shift=0)
{
- ASSERT(rn != ARM::pc); // LDR (literal)
+ ASSERT(rn != ARMRegisters::pc); // LDR (literal)
ASSERT(!BadReg(rm));
ASSERT(shift <= 3);
@@ -999,10 +998,10 @@ public:
m_formatter.twoWordOp12Reg4FourFours(OP_LDR_reg_T2, rn, FourFours(rt, 0, shift, rm));
}
- // rt == ARM::pc only allowed if last instruction in IT (if then) block.
+ // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block.
void ldrh(RegisterID rt, RegisterID rn, ARMThumbImmediate imm)
{
- ASSERT(rn != ARM::pc); // LDR (literal)
+ ASSERT(rn != ARMRegisters::pc); // LDR (literal)
ASSERT(imm.isUInt12());
if (!((rt | rn) & 8) && imm.isUInt6())
@@ -1024,8 +1023,8 @@ public:
// if (wback) REG[rn] = _tmp
void ldrh(RegisterID rt, RegisterID rn, int offset, bool index, bool wback)
{
- ASSERT(rt != ARM::pc);
- ASSERT(rn != ARM::pc);
+ ASSERT(rt != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(index || wback);
ASSERT(!wback | (rt != rn));
@@ -1047,7 +1046,7 @@ public:
void ldrh(RegisterID rt, RegisterID rn, RegisterID rm, unsigned shift=0)
{
ASSERT(!BadReg(rt)); // Memory hint
- ASSERT(rn != ARM::pc); // LDRH (literal)
+ ASSERT(rn != ARMRegisters::pc); // LDRH (literal)
ASSERT(!BadReg(rm));
ASSERT(shift <= 3);
@@ -1198,16 +1197,16 @@ public:
m_formatter.twoWordOp12Reg4FourFours(OP_SMULL_T1, rn, FourFours(rdLo, rdHi, 0, rm));
}
- // rt == ARM::pc only allowed if last instruction in IT (if then) block.
+ // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block.
void str(RegisterID rt, RegisterID rn, ARMThumbImmediate imm)
{
- ASSERT(rt != ARM::pc);
- ASSERT(rn != ARM::pc);
+ ASSERT(rt != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(imm.isUInt12());
if (!((rt | rn) & 8) && imm.isUInt7())
m_formatter.oneWordOp5Imm5Reg3Reg3(OP_STR_imm_T1, imm.getUInt7() >> 2, rn, rt);
- else if ((rn == ARM::sp) && !(rt & 8) && imm.isUInt10())
+ else if ((rn == ARMRegisters::sp) && !(rt & 8) && imm.isUInt10())
m_formatter.oneWordOp5Reg3Imm8(OP_STR_imm_T2, rt, imm.getUInt10() >> 2);
else
m_formatter.twoWordOp12Reg4Reg4Imm12(OP_STR_imm_T3, rn, rt, imm.getUInt12());
@@ -1226,8 +1225,8 @@ public:
// if (wback) REG[rn] = _tmp
void str(RegisterID rt, RegisterID rn, int offset, bool index, bool wback)
{
- ASSERT(rt != ARM::pc);
- ASSERT(rn != ARM::pc);
+ ASSERT(rt != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(index || wback);
ASSERT(!wback | (rt != rn));
@@ -1246,10 +1245,10 @@ public:
m_formatter.twoWordOp12Reg4Reg4Imm12(OP_STR_imm_T4, rn, rt, offset);
}
- // rt == ARM::pc only allowed if last instruction in IT (if then) block.
+ // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block.
void str(RegisterID rt, RegisterID rn, RegisterID rm, unsigned shift=0)
{
- ASSERT(rn != ARM::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(!BadReg(rm));
ASSERT(shift <= 3);
@@ -1262,12 +1261,12 @@ public:
void sub(RegisterID rd, RegisterID rn, ARMThumbImmediate imm)
{
// Rd can only be SP if Rn is also SP.
- ASSERT((rd != ARM::sp) || (rn == ARM::sp));
- ASSERT(rd != ARM::pc);
- ASSERT(rn != ARM::pc);
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(imm.isValid());
- if ((rn == ARM::sp) && (rd == ARM::sp) && imm.isUInt9()) {
+ if ((rn == ARMRegisters::sp) && (rd == ARMRegisters::sp) && imm.isUInt9()) {
m_formatter.oneWordOp9Imm7(OP_SUB_SP_imm_T1, imm.getUInt9() >> 2);
return;
} else if (!((rd | rn) & 8)) {
@@ -1290,9 +1289,9 @@ public:
void sub(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
{
- ASSERT((rd != ARM::sp) || (rn == ARM::sp));
- ASSERT(rd != ARM::pc);
- ASSERT(rn != ARM::pc);
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(!BadReg(rm));
m_formatter.twoWordOp12Reg4FourFours(OP_SUB_reg_T2, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm));
}
@@ -1310,12 +1309,12 @@ public:
void sub_S(RegisterID rd, RegisterID rn, ARMThumbImmediate imm)
{
// Rd can only be SP if Rn is also SP.
- ASSERT((rd != ARM::sp) || (rn == ARM::sp));
- ASSERT(rd != ARM::pc);
- ASSERT(rn != ARM::pc);
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(imm.isValid());
- if ((rn == ARM::sp) && (rd == ARM::sp) && imm.isUInt9()) {
+ if ((rn == ARMRegisters::sp) && (rd == ARMRegisters::sp) && imm.isUInt9()) {
m_formatter.oneWordOp9Imm7(OP_SUB_SP_imm_T1, imm.getUInt9() >> 2);
return;
} else if (!((rd | rn) & 8)) {
@@ -1334,9 +1333,9 @@ public:
// Not allowed in an IT (if then) block?
void sub_S(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
{
- ASSERT((rd != ARM::sp) || (rn == ARM::sp));
- ASSERT(rd != ARM::pc);
- ASSERT(rn != ARM::pc);
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
ASSERT(!BadReg(rm));
m_formatter.twoWordOp12Reg4FourFours(OP_SUB_S_reg_T2, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm));
}
@@ -1754,6 +1753,6 @@ private:
} // namespace JSC
-#endif // ENABLE(ASSEMBLER) && PLATFORM_ARM_ARCH(7)
+#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2)
#endif // ARMAssembler_h
diff --git a/JavaScriptCore/assembler/AbstractMacroAssembler.h b/JavaScriptCore/assembler/AbstractMacroAssembler.h
index f927ed2..525fe98 100644
--- a/JavaScriptCore/assembler/AbstractMacroAssembler.h
+++ b/JavaScriptCore/assembler/AbstractMacroAssembler.h
@@ -320,11 +320,6 @@ public:
return Call(jump.m_jmp, Linkable);
}
- void enableLatePatch()
- {
- m_jmp.enableLatePatch();
- }
-
JmpSrc m_jmp;
private:
Flags m_flags;
@@ -361,11 +356,6 @@ public:
masm->m_assembler.linkJump(m_jmp, label.m_label);
}
- void enableLatePatch()
- {
- m_jmp.enableLatePatch();
- }
-
private:
JmpSrc m_jmp;
};
diff --git a/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h b/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
index f15b7f3..af3c3be 100644
--- a/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
+++ b/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
@@ -34,6 +34,8 @@
#include "AssemblerBuffer.h"
#include <wtf/SegmentedVector.h>
+#define ASSEMBLER_HAS_CONSTANT_POOL 1
+
namespace JSC {
/*
@@ -84,7 +86,7 @@ namespace JSC {
template <int maxPoolSize, int barrierSize, int maxInstructionSize, class AssemblerType>
class AssemblerBufferWithConstantPool: public AssemblerBuffer {
- typedef WTF::SegmentedVector<uint32_t, 512> LoadOffsets;
+ typedef SegmentedVector<uint32_t, 512> LoadOffsets;
public:
enum {
UniqueConst,
@@ -177,6 +179,11 @@ public:
return AssemblerBuffer::size();
}
+ int uncheckedSize()
+ {
+ return AssemblerBuffer::size();
+ }
+
void* executableCopy(ExecutablePool* allocator)
{
flushConstantPool(false);
@@ -207,10 +214,10 @@ public:
}
// This flushing mechanism can be called after any unconditional jumps.
- void flushWithoutBarrier()
+ void flushWithoutBarrier(bool isForced = false)
{
// Flush if constant pool is more than 60% full to avoid overuse of this function.
- if (5 * m_numConsts > 3 * maxPoolSize / sizeof(uint32_t))
+ if (isForced || 5 * m_numConsts > 3 * maxPoolSize / sizeof(uint32_t))
flushConstantPool(false);
}
@@ -219,6 +226,11 @@ public:
return m_pool;
}
+ int sizeOfConstantPool()
+ {
+ return m_numConsts;
+ }
+
private:
void correctDeltas(int insnSize)
{
@@ -276,7 +288,8 @@ private:
{
if (m_numConsts == 0)
return;
- if ((m_maxDistance < nextInsnSize + m_lastConstDelta + barrierSize + (int)sizeof(uint32_t)))
+ int lastConstDelta = m_lastConstDelta > nextInsnSize ? m_lastConstDelta - nextInsnSize : 0;
+ if ((m_maxDistance < nextInsnSize + lastConstDelta + barrierSize + (int)sizeof(uint32_t)))
flushConstantPool();
}
@@ -284,8 +297,8 @@ private:
{
if (m_numConsts == 0)
return;
- if ((m_maxDistance < nextInsnSize + m_lastConstDelta + barrierSize + (int)sizeof(uint32_t)) ||
- (m_numConsts + nextConstSize / sizeof(uint32_t) >= maxPoolSize))
+ if ((m_maxDistance < nextInsnSize + m_lastConstDelta + nextConstSize + barrierSize + (int)sizeof(uint32_t)) ||
+ (m_numConsts * sizeof(uint32_t) + nextConstSize >= maxPoolSize))
flushConstantPool();
}
diff --git a/JavaScriptCore/assembler/MacroAssembler.h b/JavaScriptCore/assembler/MacroAssembler.h
index 9e1c5d3..2743ab4 100644
--- a/JavaScriptCore/assembler/MacroAssembler.h
+++ b/JavaScriptCore/assembler/MacroAssembler.h
@@ -30,11 +30,11 @@
#if ENABLE(ASSEMBLER)
-#if PLATFORM_ARM_ARCH(7)
+#if PLATFORM(ARM_THUMB2)
#include "MacroAssemblerARMv7.h"
namespace JSC { typedef MacroAssemblerARMv7 MacroAssemblerBase; };
-#elif PLATFORM(ARM)
+#elif PLATFORM(ARM_TRADITIONAL)
#include "MacroAssemblerARM.h"
namespace JSC { typedef MacroAssemblerARM MacroAssemblerBase; };
diff --git a/JavaScriptCore/assembler/MacroAssemblerARM.cpp b/JavaScriptCore/assembler/MacroAssemblerARM.cpp
new file mode 100644
index 0000000..d726ecd
--- /dev/null
+++ b/JavaScriptCore/assembler/MacroAssemblerARM.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2009 University of Szeged
+ * 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 UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED 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"
+
+#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
+
+#include "MacroAssemblerARM.h"
+
+#if PLATFORM(LINUX)
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <elf.h>
+#include <asm/hwcap.h>
+#endif
+
+namespace JSC {
+
+static bool isVFPPresent()
+{
+#if PLATFORM(LINUX)
+ int fd = open("/proc/self/auxv", O_RDONLY);
+ if (fd > 0) {
+ Elf32_auxv_t aux;
+ while (read(fd, &aux, sizeof(Elf32_auxv_t))) {
+ if (aux.a_type == AT_HWCAP) {
+ close(fd);
+ return aux.a_un.a_val & HWCAP_VFP;
+ }
+ }
+ close(fd);
+ }
+#endif
+
+ return false;
+}
+
+const bool MacroAssemblerARM::s_isVFPPresent = isVFPPresent();
+
+#if defined(ARM_REQUIRE_NATURAL_ALIGNMENT) && ARM_REQUIRE_NATURAL_ALIGNMENT
+void MacroAssemblerARM::load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest)
+{
+ ARMWord op2;
+
+ ASSERT(address.scale >= 0 && address.scale <= 3);
+ op2 = m_assembler.lsl(address.index, static_cast<int>(address.scale));
+
+ if (address.offset >= 0 && address.offset + 0x2 <= 0xff) {
+ m_assembler.add_r(ARMRegisters::S0, address.base, op2);
+ m_assembler.ldrh_u(dest, ARMRegisters::S0, ARMAssembler::getOp2Byte(address.offset));
+ m_assembler.ldrh_u(ARMRegisters::S0, ARMRegisters::S0, ARMAssembler::getOp2Byte(address.offset + 0x2));
+ } else if (address.offset < 0 && address.offset >= -0xff) {
+ m_assembler.add_r(ARMRegisters::S0, address.base, op2);
+ m_assembler.ldrh_d(dest, ARMRegisters::S0, ARMAssembler::getOp2Byte(-address.offset));
+ m_assembler.ldrh_d(ARMRegisters::S0, ARMRegisters::S0, ARMAssembler::getOp2Byte(-address.offset - 0x2));
+ } else {
+ m_assembler.ldr_un_imm(ARMRegisters::S0, address.offset);
+ m_assembler.add_r(ARMRegisters::S0, ARMRegisters::S0, op2);
+ m_assembler.ldrh_r(dest, address.base, ARMRegisters::S0);
+ m_assembler.add_r(ARMRegisters::S0, ARMRegisters::S0, ARMAssembler::OP2_IMM | 0x2);
+ m_assembler.ldrh_r(ARMRegisters::S0, address.base, ARMRegisters::S0);
+ }
+ m_assembler.orr_r(dest, dest, m_assembler.lsl(ARMRegisters::S0, 16));
+}
+#endif
+
+}
+
+#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
diff --git a/JavaScriptCore/assembler/MacroAssemblerARM.h b/JavaScriptCore/assembler/MacroAssemblerARM.h
index b04ed13..aa8cbb0 100644
--- a/JavaScriptCore/assembler/MacroAssemblerARM.h
+++ b/JavaScriptCore/assembler/MacroAssemblerARM.h
@@ -30,7 +30,7 @@
#include <wtf/Platform.h>
-#if ENABLE(ASSEMBLER) && PLATFORM(ARM)
+#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
#include "ARMAssembler.h"
#include "AbstractMacroAssembler.h"
@@ -64,7 +64,7 @@ public:
DoubleLessThanOrEqual = ARMAssembler::LE,
};
- static const RegisterID stackPointerRegister = ARM::sp;
+ static const RegisterID stackPointerRegister = ARMRegisters::sp;
static const Scale ScalePtr = TimesFour;
@@ -75,20 +75,20 @@ public:
void add32(Imm32 imm, Address address)
{
- load32(address, ARM::S1);
- add32(imm, ARM::S1);
- store32(ARM::S1, address);
+ load32(address, ARMRegisters::S1);
+ add32(imm, ARMRegisters::S1);
+ store32(ARMRegisters::S1, address);
}
void add32(Imm32 imm, RegisterID dest)
{
- m_assembler.adds_r(dest, dest, m_assembler.getImm(imm.m_value, ARM::S0));
+ m_assembler.adds_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
}
void add32(Address src, RegisterID dest)
{
- load32(src, ARM::S1);
- add32(ARM::S1, dest);
+ load32(src, ARMRegisters::S1);
+ add32(ARMRegisters::S1, dest);
}
void and32(RegisterID src, RegisterID dest)
@@ -98,7 +98,7 @@ public:
void and32(Imm32 imm, RegisterID dest)
{
- ARMWord w = m_assembler.getImm(imm.m_value, ARM::S0, true);
+ ARMWord w = m_assembler.getImm(imm.m_value, ARMRegisters::S0, true);
if (w & ARMAssembler::OP2_INV_IMM)
m_assembler.bics_r(dest, dest, w & ~ARMAssembler::OP2_INV_IMM);
else
@@ -118,16 +118,16 @@ public:
void mul32(RegisterID src, RegisterID dest)
{
if (src == dest) {
- move(src, ARM::S0);
- src = ARM::S0;
+ move(src, ARMRegisters::S0);
+ src = ARMRegisters::S0;
}
m_assembler.muls_r(dest, dest, src);
}
void mul32(Imm32 imm, RegisterID src, RegisterID dest)
{
- move(imm, ARM::S0);
- m_assembler.muls_r(dest, src, ARM::S0);
+ move(imm, ARMRegisters::S0);
+ m_assembler.muls_r(dest, src, ARMRegisters::S0);
}
void not32(RegisterID dest)
@@ -142,7 +142,7 @@ public:
void or32(Imm32 imm, RegisterID dest)
{
- m_assembler.orrs_r(dest, dest, m_assembler.getImm(imm.m_value, ARM::S0));
+ m_assembler.orrs_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
}
void rshift32(RegisterID shift_amount, RegisterID dest)
@@ -162,20 +162,20 @@ public:
void sub32(Imm32 imm, RegisterID dest)
{
- m_assembler.subs_r(dest, dest, m_assembler.getImm(imm.m_value, ARM::S0));
+ m_assembler.subs_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
}
void sub32(Imm32 imm, Address address)
{
- load32(address, ARM::S1);
- sub32(imm, ARM::S1);
- store32(ARM::S1, address);
+ load32(address, ARMRegisters::S1);
+ sub32(imm, ARMRegisters::S1);
+ store32(ARMRegisters::S1, address);
}
void sub32(Address src, RegisterID dest)
{
- load32(src, ARM::S1);
- sub32(ARM::S1, dest);
+ load32(src, ARMRegisters::S1);
+ sub32(ARMRegisters::S1, dest);
}
void xor32(RegisterID src, RegisterID dest)
@@ -185,7 +185,7 @@ public:
void xor32(Imm32 imm, RegisterID dest)
{
- m_assembler.eors_r(dest, dest, m_assembler.getImm(imm.m_value, ARM::S0));
+ m_assembler.eors_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
}
void load32(ImplicitAddress address, RegisterID dest)
@@ -198,11 +198,20 @@ public:
m_assembler.baseIndexTransfer32(true, dest, address.base, address.index, static_cast<int>(address.scale), address.offset);
}
+#if defined(ARM_REQUIRE_NATURAL_ALIGNMENT) && ARM_REQUIRE_NATURAL_ALIGNMENT
+ void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest);
+#else
+ void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest)
+ {
+ load32(address, dest);
+ }
+#endif
+
DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest)
{
DataLabel32 dataLabel(this);
- m_assembler.ldr_un_imm(ARM::S0, 0);
- m_assembler.dtr_ur(true, dest, address.base, ARM::S0);
+ m_assembler.ldr_un_imm(ARMRegisters::S0, 0);
+ m_assembler.dtr_ur(true, dest, address.base, ARMRegisters::S0);
return dataLabel;
}
@@ -215,18 +224,18 @@ public:
void load16(BaseIndex address, RegisterID dest)
{
- m_assembler.add_r(ARM::S0, address.base, m_assembler.lsl(address.index, address.scale));
+ m_assembler.add_r(ARMRegisters::S0, address.base, m_assembler.lsl(address.index, address.scale));
if (address.offset>=0)
- m_assembler.ldrh_u(dest, ARM::S0, ARMAssembler::getOp2Byte(address.offset));
+ m_assembler.ldrh_u(dest, ARMRegisters::S0, ARMAssembler::getOp2Byte(address.offset));
else
- m_assembler.ldrh_d(dest, ARM::S0, ARMAssembler::getOp2Byte(-address.offset));
+ m_assembler.ldrh_d(dest, ARMRegisters::S0, ARMAssembler::getOp2Byte(-address.offset));
}
DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address)
{
DataLabel32 dataLabel(this);
- m_assembler.ldr_un_imm(ARM::S0, 0);
- m_assembler.dtr_ur(false, src, address.base, ARM::S0);
+ m_assembler.ldr_un_imm(ARMRegisters::S0, 0);
+ m_assembler.dtr_ur(false, src, address.base, ARMRegisters::S0);
return dataLabel;
}
@@ -243,26 +252,26 @@ public:
void store32(Imm32 imm, ImplicitAddress address)
{
if (imm.m_isPointer)
- m_assembler.ldr_un_imm(ARM::S1, imm.m_value);
+ m_assembler.ldr_un_imm(ARMRegisters::S1, imm.m_value);
else
- move(imm, ARM::S1);
- store32(ARM::S1, address);
+ move(imm, ARMRegisters::S1);
+ store32(ARMRegisters::S1, address);
}
void store32(RegisterID src, void* address)
{
- m_assembler.ldr_un_imm(ARM::S0, reinterpret_cast<ARMWord>(address));
- m_assembler.dtr_u(false, src, ARM::S0, 0);
+ m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address));
+ m_assembler.dtr_u(false, src, ARMRegisters::S0, 0);
}
void store32(Imm32 imm, void* address)
{
- m_assembler.ldr_un_imm(ARM::S0, reinterpret_cast<ARMWord>(address));
+ m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address));
if (imm.m_isPointer)
- m_assembler.ldr_un_imm(ARM::S1, imm.m_value);
+ m_assembler.ldr_un_imm(ARMRegisters::S1, imm.m_value);
else
- m_assembler.moveImm(imm.m_value, ARM::S1);
- m_assembler.dtr_u(false, ARM::S1, ARM::S0, 0);
+ m_assembler.moveImm(imm.m_value, ARMRegisters::S1);
+ m_assembler.dtr_u(false, ARMRegisters::S1, ARMRegisters::S0, 0);
}
void pop(RegisterID dest)
@@ -277,14 +286,14 @@ public:
void push(Address address)
{
- load32(address, ARM::S1);
- push(ARM::S1);
+ load32(address, ARMRegisters::S1);
+ push(ARMRegisters::S1);
}
void push(Imm32 imm)
{
- move(imm, ARM::S0);
- push(ARM::S0);
+ move(imm, ARMRegisters::S0);
+ push(ARMRegisters::S0);
}
void move(Imm32 imm, RegisterID dest)
@@ -307,9 +316,9 @@ public:
void swap(RegisterID reg1, RegisterID reg2)
{
- m_assembler.mov_r(ARM::S0, reg1);
+ m_assembler.mov_r(ARMRegisters::S0, reg1);
m_assembler.mov_r(reg1, reg2);
- m_assembler.mov_r(reg2, ARM::S0);
+ m_assembler.mov_r(reg2, ARMRegisters::S0);
}
void signExtend32ToPtr(RegisterID src, RegisterID dest)
@@ -324,44 +333,50 @@ public:
move(src, dest);
}
- Jump branch32(Condition cond, RegisterID left, RegisterID right)
+ Jump branch32(Condition cond, RegisterID left, RegisterID right, int useConstantPool = 0)
{
m_assembler.cmp_r(left, right);
- return Jump(m_assembler.jmp(ARMCondition(cond)));
+ return Jump(m_assembler.jmp(ARMCondition(cond), useConstantPool));
}
- Jump branch32(Condition cond, RegisterID left, Imm32 right)
+ Jump branch32(Condition cond, RegisterID left, Imm32 right, int useConstantPool = 0)
{
if (right.m_isPointer) {
- m_assembler.ldr_un_imm(ARM::S0, right.m_value);
- m_assembler.cmp_r(left, ARM::S0);
+ m_assembler.ldr_un_imm(ARMRegisters::S0, right.m_value);
+ m_assembler.cmp_r(left, ARMRegisters::S0);
} else
- m_assembler.cmp_r(left, m_assembler.getImm(right.m_value, ARM::S0));
- return Jump(m_assembler.jmp(ARMCondition(cond)));
+ m_assembler.cmp_r(left, m_assembler.getImm(right.m_value, ARMRegisters::S0));
+ return Jump(m_assembler.jmp(ARMCondition(cond), useConstantPool));
}
Jump branch32(Condition cond, RegisterID left, Address right)
{
- load32(right, ARM::S1);
- return branch32(cond, left, ARM::S1);
+ load32(right, ARMRegisters::S1);
+ return branch32(cond, left, ARMRegisters::S1);
}
Jump branch32(Condition cond, Address left, RegisterID right)
{
- load32(left, ARM::S1);
- return branch32(cond, ARM::S1, right);
+ load32(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
}
Jump branch32(Condition cond, Address left, Imm32 right)
{
- load32(left, ARM::S1);
- return branch32(cond, ARM::S1, right);
+ load32(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
}
Jump branch32(Condition cond, BaseIndex left, Imm32 right)
{
- load32(left, ARM::S1);
- return branch32(cond, ARM::S1, right);
+ load32(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right)
+ {
+ load32WithUnalignedHalfWords(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
}
Jump branch16(Condition cond, BaseIndex left, RegisterID right)
@@ -375,9 +390,9 @@ public:
Jump branch16(Condition cond, BaseIndex left, Imm32 right)
{
- load16(left, ARM::S0);
- move(right, ARM::S1);
- m_assembler.cmp_r(ARM::S0, ARM::S1);
+ load16(left, ARMRegisters::S0);
+ move(right, ARMRegisters::S1);
+ m_assembler.cmp_r(ARMRegisters::S0, ARMRegisters::S1);
return m_assembler.jmp(ARMCondition(cond));
}
@@ -391,9 +406,9 @@ public:
Jump branchTest32(Condition cond, RegisterID reg, Imm32 mask = Imm32(-1))
{
ASSERT((cond == Zero) || (cond == NonZero));
- ARMWord w = m_assembler.getImm(mask.m_value, ARM::S0, true);
+ ARMWord w = m_assembler.getImm(mask.m_value, ARMRegisters::S0, true);
if (w & ARMAssembler::OP2_INV_IMM)
- m_assembler.bics_r(ARM::S0, reg, w & ~ARMAssembler::OP2_INV_IMM);
+ m_assembler.bics_r(ARMRegisters::S0, reg, w & ~ARMAssembler::OP2_INV_IMM);
else
m_assembler.tst_r(reg, w);
return Jump(m_assembler.jmp(ARMCondition(cond)));
@@ -401,14 +416,14 @@ public:
Jump branchTest32(Condition cond, Address address, Imm32 mask = Imm32(-1))
{
- load32(address, ARM::S1);
- return branchTest32(cond, ARM::S1, mask);
+ load32(address, ARMRegisters::S1);
+ return branchTest32(cond, ARMRegisters::S1, mask);
}
Jump branchTest32(Condition cond, BaseIndex address, Imm32 mask = Imm32(-1))
{
- load32(address, ARM::S1);
- return branchTest32(cond, ARM::S1, mask);
+ load32(address, ARMRegisters::S1);
+ return branchTest32(cond, ARMRegisters::S1, mask);
}
Jump jump()
@@ -418,12 +433,12 @@ public:
void jump(RegisterID target)
{
- move(target, ARM::pc);
+ move(target, ARMRegisters::pc);
}
void jump(Address address)
{
- load32(address, ARM::pc);
+ load32(address, ARMRegisters::pc);
}
Jump branchAdd32(Condition cond, RegisterID src, RegisterID dest)
@@ -443,11 +458,11 @@ public:
void mull32(RegisterID src1, RegisterID src2, RegisterID dest)
{
if (src1 == dest) {
- move(src1, ARM::S0);
- src1 = ARM::S0;
+ move(src1, ARMRegisters::S0);
+ src1 = ARMRegisters::S0;
}
- m_assembler.mull_r(ARM::S1, dest, src2, src1);
- m_assembler.cmp_r(ARM::S1, m_assembler.asr(dest, 31));
+ m_assembler.mull_r(ARMRegisters::S1, dest, src2, src1);
+ m_assembler.cmp_r(ARMRegisters::S1, m_assembler.asr(dest, 31));
}
Jump branchMul32(Condition cond, RegisterID src, RegisterID dest)
@@ -466,8 +481,8 @@ public:
{
ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
if (cond == Overflow) {
- move(imm, ARM::S0);
- mull32(ARM::S0, src, dest);
+ move(imm, ARMRegisters::S0);
+ mull32(ARMRegisters::S0, src, dest);
cond = NonZero;
}
else
@@ -497,13 +512,13 @@ public:
Call nearCall()
{
prepareCall();
- return Call(m_assembler.jmp(), Call::LinkableNear);
+ return Call(m_assembler.jmp(ARMAssembler::AL, true), Call::LinkableNear);
}
Call call(RegisterID target)
{
prepareCall();
- move(ARM::pc, target);
+ move(ARMRegisters::pc, target);
JmpSrc jmpSrc;
return Call(jmpSrc, Call::None);
}
@@ -515,7 +530,7 @@ public:
void ret()
{
- pop(ARM::pc);
+ pop(ARMRegisters::pc);
}
void set32(Condition cond, RegisterID left, RegisterID right, RegisterID dest)
@@ -527,67 +542,67 @@ public:
void set32(Condition cond, RegisterID left, Imm32 right, RegisterID dest)
{
- m_assembler.cmp_r(left, m_assembler.getImm(right.m_value, ARM::S0));
+ m_assembler.cmp_r(left, m_assembler.getImm(right.m_value, ARMRegisters::S0));
m_assembler.mov_r(dest, ARMAssembler::getOp2(0));
m_assembler.mov_r(dest, ARMAssembler::getOp2(1), ARMCondition(cond));
}
void setTest32(Condition cond, Address address, Imm32 mask, RegisterID dest)
{
- load32(address, ARM::S1);
+ load32(address, ARMRegisters::S1);
if (mask.m_value == -1)
- m_assembler.cmp_r(0, ARM::S1);
+ m_assembler.cmp_r(0, ARMRegisters::S1);
else
- m_assembler.tst_r(ARM::S1, m_assembler.getImm(mask.m_value, ARM::S0));
+ m_assembler.tst_r(ARMRegisters::S1, m_assembler.getImm(mask.m_value, ARMRegisters::S0));
m_assembler.mov_r(dest, ARMAssembler::getOp2(0));
m_assembler.mov_r(dest, ARMAssembler::getOp2(1), ARMCondition(cond));
}
void add32(Imm32 imm, RegisterID src, RegisterID dest)
{
- m_assembler.add_r(dest, src, m_assembler.getImm(imm.m_value, ARM::S0));
+ m_assembler.add_r(dest, src, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
}
void add32(Imm32 imm, AbsoluteAddress address)
{
- m_assembler.ldr_un_imm(ARM::S1, reinterpret_cast<ARMWord>(address.m_ptr));
- m_assembler.dtr_u(true, ARM::S1, ARM::S1, 0);
- add32(imm, ARM::S1);
- m_assembler.ldr_un_imm(ARM::S0, reinterpret_cast<ARMWord>(address.m_ptr));
- m_assembler.dtr_u(false, ARM::S1, ARM::S0, 0);
+ m_assembler.ldr_un_imm(ARMRegisters::S1, reinterpret_cast<ARMWord>(address.m_ptr));
+ m_assembler.dtr_u(true, ARMRegisters::S1, ARMRegisters::S1, 0);
+ add32(imm, ARMRegisters::S1);
+ m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address.m_ptr));
+ m_assembler.dtr_u(false, ARMRegisters::S1, ARMRegisters::S0, 0);
}
void sub32(Imm32 imm, AbsoluteAddress address)
{
- m_assembler.ldr_un_imm(ARM::S1, reinterpret_cast<ARMWord>(address.m_ptr));
- m_assembler.dtr_u(true, ARM::S1, ARM::S1, 0);
- sub32(imm, ARM::S1);
- m_assembler.ldr_un_imm(ARM::S0, reinterpret_cast<ARMWord>(address.m_ptr));
- m_assembler.dtr_u(false, ARM::S1, ARM::S0, 0);
+ m_assembler.ldr_un_imm(ARMRegisters::S1, reinterpret_cast<ARMWord>(address.m_ptr));
+ m_assembler.dtr_u(true, ARMRegisters::S1, ARMRegisters::S1, 0);
+ sub32(imm, ARMRegisters::S1);
+ m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address.m_ptr));
+ m_assembler.dtr_u(false, ARMRegisters::S1, ARMRegisters::S0, 0);
}
void load32(void* address, RegisterID dest)
{
- m_assembler.ldr_un_imm(ARM::S0, reinterpret_cast<ARMWord>(address));
- m_assembler.dtr_u(true, dest, ARM::S0, 0);
+ m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address));
+ m_assembler.dtr_u(true, dest, ARMRegisters::S0, 0);
}
Jump branch32(Condition cond, AbsoluteAddress left, RegisterID right)
{
- load32(left.m_ptr, ARM::S1);
- return branch32(cond, ARM::S1, right);
+ load32(left.m_ptr, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
}
Jump branch32(Condition cond, AbsoluteAddress left, Imm32 right)
{
- load32(left.m_ptr, ARM::S1);
- return branch32(cond, ARM::S1, right);
+ load32(left.m_ptr, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
}
Call call()
{
prepareCall();
- return Call(m_assembler.jmp(), Call::Linkable);
+ return Call(m_assembler.jmp(ARMAssembler::AL, true), Call::Linkable);
}
Call tailRecursiveCall()
@@ -609,25 +624,23 @@ public:
Jump branchPtrWithPatch(Condition cond, RegisterID left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0))
{
- dataLabel = moveWithPatch(initialRightValue, ARM::S1);
- Jump jump = branch32(cond, left, ARM::S1);
- jump.enableLatePatch();
+ dataLabel = moveWithPatch(initialRightValue, ARMRegisters::S1);
+ Jump jump = branch32(cond, left, ARMRegisters::S1, true);
return jump;
}
Jump branchPtrWithPatch(Condition cond, Address left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0))
{
- load32(left, ARM::S1);
- dataLabel = moveWithPatch(initialRightValue, ARM::S0);
- Jump jump = branch32(cond, ARM::S0, ARM::S1);
- jump.enableLatePatch();
+ load32(left, ARMRegisters::S1);
+ dataLabel = moveWithPatch(initialRightValue, ARMRegisters::S0);
+ Jump jump = branch32(cond, ARMRegisters::S0, ARMRegisters::S1, true);
return jump;
}
DataLabelPtr storePtrWithPatch(ImmPtr initialValue, ImplicitAddress address)
{
- DataLabelPtr dataLabel = moveWithPatch(initialValue, ARM::S1);
- store32(ARM::S1, address);
+ DataLabelPtr dataLabel = moveWithPatch(initialValue, ARMRegisters::S1);
+ store32(ARMRegisters::S1, address);
return dataLabel;
}
@@ -639,8 +652,7 @@ public:
// Floating point operators
bool supportsFloatingPoint() const
{
- // FIXME: should be a dynamic test: VFP, FPA, or nothing
- return false;
+ return s_isVFPPresent;
}
bool supportsFloatingPointTruncate() const
@@ -665,8 +677,8 @@ public:
void addDouble(Address src, FPRegisterID dest)
{
- loadDouble(src, ARM::SD0);
- addDouble(ARM::SD0, dest);
+ loadDouble(src, ARMRegisters::SD0);
+ addDouble(ARMRegisters::SD0, dest);
}
void subDouble(FPRegisterID src, FPRegisterID dest)
@@ -676,8 +688,8 @@ public:
void subDouble(Address src, FPRegisterID dest)
{
- loadDouble(src, ARM::SD0);
- subDouble(ARM::SD0, dest);
+ loadDouble(src, ARMRegisters::SD0);
+ subDouble(ARMRegisters::SD0, dest);
}
void mulDouble(FPRegisterID src, FPRegisterID dest)
@@ -687,8 +699,8 @@ public:
void mulDouble(Address src, FPRegisterID dest)
{
- loadDouble(src, ARM::SD0);
- mulDouble(ARM::SD0, dest);
+ loadDouble(src, ARMRegisters::SD0);
+ mulDouble(ARMRegisters::SD0, dest);
}
void convertInt32ToDouble(RegisterID src, FPRegisterID dest)
@@ -722,46 +734,56 @@ protected:
return static_cast<ARMAssembler::Condition>(cond);
}
+ void ensureSpace(int insnSpace, int constSpace)
+ {
+ m_assembler.ensureSpace(insnSpace, constSpace);
+ }
+
+ int sizeOfConstantPool()
+ {
+ return m_assembler.sizeOfConstantPool();
+ }
+
void prepareCall()
{
- m_assembler.ensureSpace(3 * sizeof(ARMWord), sizeof(ARMWord));
+ ensureSpace(3 * sizeof(ARMWord), sizeof(ARMWord));
// S0 might be used for parameter passing
- m_assembler.add_r(ARM::S1, ARM::pc, ARMAssembler::OP2_IMM | 0x4);
- m_assembler.push_r(ARM::S1);
+ m_assembler.add_r(ARMRegisters::S1, ARMRegisters::pc, ARMAssembler::OP2_IMM | 0x4);
+ m_assembler.push_r(ARMRegisters::S1);
}
void call32(RegisterID base, int32_t offset)
{
- if (base == ARM::sp)
+ if (base == ARMRegisters::sp)
offset += 4;
if (offset >= 0) {
if (offset <= 0xfff) {
prepareCall();
- m_assembler.dtr_u(true, ARM::pc, base, offset);
+ m_assembler.dtr_u(true, ARMRegisters::pc, base, offset);
} else if (offset <= 0xfffff) {
- m_assembler.add_r(ARM::S0, base, ARMAssembler::OP2_IMM | (offset >> 12) | (10 << 8));
+ m_assembler.add_r(ARMRegisters::S0, base, ARMAssembler::OP2_IMM | (offset >> 12) | (10 << 8));
prepareCall();
- m_assembler.dtr_u(true, ARM::pc, ARM::S0, offset & 0xfff);
+ m_assembler.dtr_u(true, ARMRegisters::pc, ARMRegisters::S0, offset & 0xfff);
} else {
- ARMWord reg = m_assembler.getImm(offset, ARM::S0);
+ ARMWord reg = m_assembler.getImm(offset, ARMRegisters::S0);
prepareCall();
- m_assembler.dtr_ur(true, ARM::pc, base, reg);
+ m_assembler.dtr_ur(true, ARMRegisters::pc, base, reg);
}
} else {
offset = -offset;
if (offset <= 0xfff) {
prepareCall();
- m_assembler.dtr_d(true, ARM::pc, base, offset);
+ m_assembler.dtr_d(true, ARMRegisters::pc, base, offset);
} else if (offset <= 0xfffff) {
- m_assembler.sub_r(ARM::S0, base, ARMAssembler::OP2_IMM | (offset >> 12) | (10 << 8));
+ m_assembler.sub_r(ARMRegisters::S0, base, ARMAssembler::OP2_IMM | (offset >> 12) | (10 << 8));
prepareCall();
- m_assembler.dtr_d(true, ARM::pc, ARM::S0, offset & 0xfff);
+ m_assembler.dtr_d(true, ARMRegisters::pc, ARMRegisters::S0, offset & 0xfff);
} else {
- ARMWord reg = m_assembler.getImm(offset, ARM::S0);
+ ARMWord reg = m_assembler.getImm(offset, ARMRegisters::S0);
prepareCall();
- m_assembler.dtr_dr(true, ARM::pc, base, reg);
+ m_assembler.dtr_dr(true, ARMRegisters::pc, base, reg);
}
}
}
@@ -785,10 +807,11 @@ private:
ARMAssembler::relinkCall(call.dataLocation(), destination.executableAddress());
}
+ static const bool s_isVFPPresent;
};
}
-#endif
+#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL)
#endif // MacroAssemblerARM_h
diff --git a/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/JavaScriptCore/assembler/MacroAssemblerARMv7.h
index f7a8402..a549604 100644
--- a/JavaScriptCore/assembler/MacroAssemblerARMv7.h
+++ b/JavaScriptCore/assembler/MacroAssemblerARMv7.h
@@ -39,9 +39,9 @@ class MacroAssemblerARMv7 : public AbstractMacroAssembler<ARMv7Assembler> {
// FIXME: switch dataTempRegister & addressTempRegister, or possibly use r7?
// - dTR is likely used more than aTR, and we'll get better instruction
// encoding if it's in the low 8 registers.
- static const ARM::RegisterID dataTempRegister = ARM::ip;
- static const RegisterID addressTempRegister = ARM::r3;
- static const FPRegisterID fpTempRegister = ARM::d7;
+ static const ARMRegisters::RegisterID dataTempRegister = ARMRegisters::ip;
+ static const RegisterID addressTempRegister = ARMRegisters::r3;
+ static const FPRegisterID fpTempRegister = ARMRegisters::d7;
struct ArmAddress {
enum AddressType {
@@ -102,8 +102,8 @@ public:
DoubleLessThanOrEqual = ARMv7Assembler::ConditionLS,
};
- static const RegisterID stackPointerRegister = ARM::sp;
- static const RegisterID linkRegister = ARM::lr;
+ static const RegisterID stackPointerRegister = ARMRegisters::sp;
+ static const RegisterID linkRegister = ARMRegisters::lr;
// Integer arithmetic operations:
//
@@ -375,6 +375,11 @@ public:
load32(setupArmAddress(address), dest);
}
+ void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest)
+ {
+ load32(setupArmAddress(address), dest);
+ }
+
void load32(void* address, RegisterID dest)
{
move(ImmPtr(address), addressTempRegister);
@@ -532,6 +537,7 @@ public:
Jump branchTruncateDoubleToInt32(FPRegisterID, RegisterID)
{
ASSERT_NOT_REACHED();
+ return jump();
}
@@ -546,13 +552,13 @@ public:
void pop(RegisterID dest)
{
// store postindexed with writeback
- m_assembler.ldr(dest, ARM::sp, sizeof(void*), false, true);
+ m_assembler.ldr(dest, ARMRegisters::sp, sizeof(void*), false, true);
}
void push(RegisterID src)
{
// store preindexed with writeback
- m_assembler.str(src, ARM::sp, -sizeof(void*), true, true);
+ m_assembler.str(src, ARMRegisters::sp, -sizeof(void*), true, true);
}
void push(Address address)
@@ -716,6 +722,13 @@ public:
return branch32(cond, addressTempRegister, right);
}
+ Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right)
+ {
+ // use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
+ load32WithUnalignedHalfWords(left, addressTempRegister);
+ return branch32(cond, addressTempRegister, right);
+ }
+
Jump branch32(Condition cond, AbsoluteAddress left, RegisterID right)
{
load32(left.m_ptr, dataTempRegister);
@@ -1038,7 +1051,7 @@ protected:
return addressTempRegister;
}
- DataLabel32 moveFixedWidthEncoding(Imm32 imm, RegisterID dst)
+ void moveFixedWidthEncoding(Imm32 imm, RegisterID dst)
{
uint32_t value = imm.m_value;
m_assembler.movT3(dst, ARMThumbImmediate::makeUInt16(value & 0xffff));
diff --git a/JavaScriptCore/assembler/MacroAssemblerCodeRef.h b/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
index 341a7ff..568260a 100644
--- a/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
+++ b/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
@@ -37,7 +37,7 @@
// ASSERT_VALID_CODE_POINTER checks that ptr is a non-null pointer, and that it is a valid
// instruction address on the platform (for example, check any alignment requirements).
-#if PLATFORM_ARM_ARCH(7)
+#if PLATFORM(ARM_THUMB2)
// ARM/thumb instructions must be 16-bit aligned, but all code pointers to be loaded
// into the processor are decorated with the bottom bit set, indicating that this is
// thumb code (as oposed to 32-bit traditional ARM). The first test checks for both
@@ -124,7 +124,7 @@ public:
}
explicit MacroAssemblerCodePtr(void* value)
-#if PLATFORM_ARM_ARCH(7)
+#if PLATFORM(ARM_THUMB2)
// Decorate the pointer as a thumb code pointer.
: m_value(reinterpret_cast<char*>(value) + 1)
#else
@@ -141,7 +141,7 @@ public:
}
void* executableAddress() const { return m_value; }
-#if PLATFORM_ARM_ARCH(7)
+#if PLATFORM(ARM_THUMB2)
// To use this pointer as a data address remove the decoration.
void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return reinterpret_cast<char*>(m_value) - 1; }
#else
diff --git a/JavaScriptCore/assembler/MacroAssemblerX86Common.h b/JavaScriptCore/assembler/MacroAssemblerX86Common.h
index c9e3569..5ebefa7 100644
--- a/JavaScriptCore/assembler/MacroAssemblerX86Common.h
+++ b/JavaScriptCore/assembler/MacroAssemblerX86Common.h
@@ -64,7 +64,7 @@ public:
DoubleLessThanOrEqual = X86Assembler::ConditionBE,
};
- static const RegisterID stackPointerRegister = X86::esp;
+ static const RegisterID stackPointerRegister = X86Registers::esp;
// Integer arithmetic operations:
//
@@ -132,20 +132,20 @@ public:
{
// On x86 we can only shift by ecx; if asked to shift by another register we'll
// need rejig the shift amount into ecx first, and restore the registers afterwards.
- if (shift_amount != X86::ecx) {
- swap(shift_amount, X86::ecx);
+ if (shift_amount != X86Registers::ecx) {
+ swap(shift_amount, X86Registers::ecx);
// E.g. transform "shll %eax, %eax" -> "xchgl %eax, %ecx; shll %ecx, %ecx; xchgl %eax, %ecx"
if (dest == shift_amount)
- m_assembler.shll_CLr(X86::ecx);
+ m_assembler.shll_CLr(X86Registers::ecx);
// E.g. transform "shll %eax, %ecx" -> "xchgl %eax, %ecx; shll %ecx, %eax; xchgl %eax, %ecx"
- else if (dest == X86::ecx)
+ else if (dest == X86Registers::ecx)
m_assembler.shll_CLr(shift_amount);
// E.g. transform "shll %eax, %ebx" -> "xchgl %eax, %ecx; shll %ecx, %ebx; xchgl %eax, %ecx"
else
m_assembler.shll_CLr(dest);
- swap(shift_amount, X86::ecx);
+ swap(shift_amount, X86Registers::ecx);
} else
m_assembler.shll_CLr(dest);
}
@@ -214,20 +214,20 @@ public:
{
// On x86 we can only shift by ecx; if asked to shift by another register we'll
// need rejig the shift amount into ecx first, and restore the registers afterwards.
- if (shift_amount != X86::ecx) {
- swap(shift_amount, X86::ecx);
+ if (shift_amount != X86Registers::ecx) {
+ swap(shift_amount, X86Registers::ecx);
// E.g. transform "shll %eax, %eax" -> "xchgl %eax, %ecx; shll %ecx, %ecx; xchgl %eax, %ecx"
if (dest == shift_amount)
- m_assembler.sarl_CLr(X86::ecx);
+ m_assembler.sarl_CLr(X86Registers::ecx);
// E.g. transform "shll %eax, %ecx" -> "xchgl %eax, %ecx; shll %ecx, %eax; xchgl %eax, %ecx"
- else if (dest == X86::ecx)
+ else if (dest == X86Registers::ecx)
m_assembler.sarl_CLr(shift_amount);
// E.g. transform "shll %eax, %ebx" -> "xchgl %eax, %ecx; shll %ecx, %ebx; xchgl %eax, %ecx"
else
m_assembler.sarl_CLr(dest);
- swap(shift_amount, X86::ecx);
+ swap(shift_amount, X86Registers::ecx);
} else
m_assembler.sarl_CLr(dest);
}
@@ -306,6 +306,11 @@ public:
m_assembler.movl_mr(address.offset, address.base, address.index, address.scale, dest);
}
+ void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest)
+ {
+ load32(address, dest);
+ }
+
DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest)
{
m_assembler.movl_mr_disp32(address.offset, address.base, dest);
@@ -499,10 +504,7 @@ public:
void move(ImmPtr imm, RegisterID dest)
{
- if (CAN_SIGN_EXTEND_U32_64(imm.asIntptr()))
- m_assembler.movl_i32r(static_cast<int32_t>(imm.asIntptr()), dest);
- else
- m_assembler.movq_i64r(imm.asIntptr(), dest);
+ m_assembler.movq_i64r(imm.asIntptr(), dest);
}
void swap(RegisterID reg1, RegisterID reg2)
@@ -607,6 +609,11 @@ public:
return Jump(m_assembler.jCC(x86Condition(cond)));
}
+ Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right)
+ {
+ return branch32(cond, left, right);
+ }
+
Jump branch16(Condition cond, BaseIndex left, RegisterID right)
{
m_assembler.cmpw_rm(right, left.offset, left.base, left.index, left.scale);
diff --git a/JavaScriptCore/assembler/MacroAssemblerX86_64.h b/JavaScriptCore/assembler/MacroAssemblerX86_64.h
index e3d296c..0f95fe6 100644
--- a/JavaScriptCore/assembler/MacroAssemblerX86_64.h
+++ b/JavaScriptCore/assembler/MacroAssemblerX86_64.h
@@ -38,7 +38,7 @@ namespace JSC {
class MacroAssemblerX86_64 : public MacroAssemblerX86Common {
protected:
- static const X86::RegisterID scratchRegister = X86::r11;
+ static const X86Registers::RegisterID scratchRegister = X86Registers::r11;
public:
static const Scale ScalePtr = TimesEight;
@@ -79,12 +79,12 @@ public:
void load32(void* address, RegisterID dest)
{
- if (dest == X86::eax)
+ if (dest == X86Registers::eax)
m_assembler.movl_mEAX(address);
else {
- move(X86::eax, dest);
+ move(X86Registers::eax, dest);
m_assembler.movl_mEAX(address);
- swap(X86::eax, dest);
+ swap(X86Registers::eax, dest);
}
}
@@ -102,10 +102,10 @@ public:
void store32(Imm32 imm, void* address)
{
- move(X86::eax, scratchRegister);
- move(imm, X86::eax);
+ move(X86Registers::eax, scratchRegister);
+ move(imm, X86Registers::eax);
m_assembler.movl_EAXm(address);
- move(scratchRegister, X86::eax);
+ move(scratchRegister, X86Registers::eax);
}
Call call()
@@ -196,20 +196,20 @@ public:
{
// On x86 we can only shift by ecx; if asked to shift by another register we'll
// need rejig the shift amount into ecx first, and restore the registers afterwards.
- if (shift_amount != X86::ecx) {
- swap(shift_amount, X86::ecx);
+ if (shift_amount != X86Registers::ecx) {
+ swap(shift_amount, X86Registers::ecx);
// E.g. transform "shll %eax, %eax" -> "xchgl %eax, %ecx; shll %ecx, %ecx; xchgl %eax, %ecx"
if (dest == shift_amount)
- m_assembler.sarq_CLr(X86::ecx);
+ m_assembler.sarq_CLr(X86Registers::ecx);
// E.g. transform "shll %eax, %ecx" -> "xchgl %eax, %ecx; shll %ecx, %eax; xchgl %eax, %ecx"
- else if (dest == X86::ecx)
+ else if (dest == X86Registers::ecx)
m_assembler.sarq_CLr(shift_amount);
// E.g. transform "shll %eax, %ebx" -> "xchgl %eax, %ecx; shll %ecx, %ebx; xchgl %eax, %ecx"
else
m_assembler.sarq_CLr(dest);
- swap(shift_amount, X86::ecx);
+ swap(shift_amount, X86Registers::ecx);
} else
m_assembler.sarq_CLr(dest);
}
@@ -258,12 +258,12 @@ public:
void loadPtr(void* address, RegisterID dest)
{
- if (dest == X86::eax)
+ if (dest == X86Registers::eax)
m_assembler.movq_mEAX(address);
else {
- move(X86::eax, dest);
+ move(X86Registers::eax, dest);
m_assembler.movq_mEAX(address);
- swap(X86::eax, dest);
+ swap(X86Registers::eax, dest);
}
}
@@ -285,24 +285,19 @@ public:
void storePtr(RegisterID src, void* address)
{
- if (src == X86::eax)
+ if (src == X86Registers::eax)
m_assembler.movq_EAXm(address);
else {
- swap(X86::eax, src);
+ swap(X86Registers::eax, src);
m_assembler.movq_EAXm(address);
- swap(X86::eax, src);
+ swap(X86Registers::eax, src);
}
}
void storePtr(ImmPtr imm, ImplicitAddress address)
{
- intptr_t ptr = imm.asIntptr();
- if (CAN_SIGN_EXTEND_32_64(ptr))
- m_assembler.movq_i32m(static_cast<int>(ptr), address.offset, address.base);
- else {
- move(imm, scratchRegister);
- storePtr(scratchRegister, address);
- }
+ move(imm, scratchRegister);
+ storePtr(scratchRegister, address);
}
DataLabel32 storePtrWithAddressOffsetPatch(RegisterID src, Address address)
@@ -339,17 +334,8 @@ public:
Jump branchPtr(Condition cond, RegisterID left, ImmPtr right)
{
- intptr_t imm = right.asIntptr();
- if (CAN_SIGN_EXTEND_32_64(imm)) {
- if (!imm)
- m_assembler.testq_rr(left, left);
- else
- m_assembler.cmpq_ir(imm, left);
- return Jump(m_assembler.jCC(x86Condition(cond)));
- } else {
- move(right, scratchRegister);
- return branchPtr(cond, left, scratchRegister);
- }
+ move(right, scratchRegister);
+ return branchPtr(cond, left, scratchRegister);
}
Jump branchPtr(Condition cond, RegisterID left, Address right)
diff --git a/JavaScriptCore/assembler/X86Assembler.h b/JavaScriptCore/assembler/X86Assembler.h
index fb58361..cbbaaa5 100644
--- a/JavaScriptCore/assembler/X86Assembler.h
+++ b/JavaScriptCore/assembler/X86Assembler.h
@@ -38,12 +38,8 @@
namespace JSC {
inline bool CAN_SIGN_EXTEND_8_32(int32_t value) { return value == (int32_t)(signed char)value; }
-#if PLATFORM(X86_64)
-inline bool CAN_SIGN_EXTEND_32_64(intptr_t value) { return value == (intptr_t)(int32_t)value; }
-inline bool CAN_SIGN_EXTEND_U32_64(intptr_t value) { return value == (intptr_t)(uint32_t)value; }
-#endif
-namespace X86 {
+namespace X86Registers {
typedef enum {
eax,
ecx,
@@ -80,8 +76,8 @@ namespace X86 {
class X86Assembler {
public:
- typedef X86::RegisterID RegisterID;
- typedef X86::XMMRegisterID XMMRegisterID;
+ typedef X86Registers::RegisterID RegisterID;
+ typedef X86Registers::XMMRegisterID XMMRegisterID;
typedef XMMRegisterID FPRegisterID;
typedef enum {
@@ -231,7 +227,6 @@ public:
{
}
- void enableLatePatch() { }
private:
JmpSrc(int offset)
: m_offset(offset)
@@ -1119,7 +1114,7 @@ public:
#else
void movl_rm(RegisterID src, void* addr)
{
- if (src == X86::eax)
+ if (src == X86Registers::eax)
movl_EAXm(addr);
else
m_formatter.oneByteOp(OP_MOV_EvGv, src, addr);
@@ -1127,7 +1122,7 @@ public:
void movl_mr(void* addr, RegisterID dst)
{
- if (dst == X86::eax)
+ if (dst == X86Registers::eax)
movl_mEAX(addr);
else
m_formatter.oneByteOp(OP_MOV_GvEv, dst, addr);
@@ -1893,23 +1888,23 @@ private:
// Internals; ModRm and REX formatters.
- static const RegisterID noBase = X86::ebp;
- static const RegisterID hasSib = X86::esp;
- static const RegisterID noIndex = X86::esp;
+ static const RegisterID noBase = X86Registers::ebp;
+ static const RegisterID hasSib = X86Registers::esp;
+ static const RegisterID noIndex = X86Registers::esp;
#if PLATFORM(X86_64)
- static const RegisterID noBase2 = X86::r13;
- static const RegisterID hasSib2 = X86::r12;
+ static const RegisterID noBase2 = X86Registers::r13;
+ static const RegisterID hasSib2 = X86Registers::r12;
// Registers r8 & above require a REX prefixe.
inline bool regRequiresRex(int reg)
{
- return (reg >= X86::r8);
+ return (reg >= X86Registers::r8);
}
// Byte operand register spl & above require a REX prefix (to prevent the 'H' registers be accessed).
inline bool byteRegRequiresRex(int reg)
{
- return (reg >= X86::esp);
+ return (reg >= X86Registers::esp);
}
// Format a REX prefix byte.
diff --git a/JavaScriptCore/bytecode/CodeBlock.cpp b/JavaScriptCore/bytecode/CodeBlock.cpp
index e22f25a..6bac9b9 100644
--- a/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -33,6 +33,8 @@
#include "JIT.h"
#include "JSValue.h"
#include "Interpreter.h"
+#include "JSFunction.h"
+#include "JSStaticScopeObject.h"
#include "Debugger.h"
#include "BytecodeGenerator.h"
#include <stdio.h>
@@ -1246,43 +1248,22 @@ void CodeBlock::dumpStatistics()
#endif
}
-CodeBlock::CodeBlock(ScopeNode* ownerNode)
+CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, SymbolTable* symTab)
: m_numCalleeRegisters(0)
, m_numVars(0)
, m_numParameters(0)
- , m_ownerNode(ownerNode)
+ , m_ownerExecutable(ownerExecutable)
, m_globalData(0)
#ifndef NDEBUG
, m_instructionCount(0)
#endif
- , m_needsFullScopeChain(false)
- , m_usesEval(false)
- , m_isNumericCompareFunction(false)
- , m_codeType(NativeCode)
- , m_source(0)
- , m_sourceOffset(0)
- , m_exceptionInfo(0)
-{
-#if DUMP_CODE_BLOCK_STATISTICS
- liveCodeBlockSet.add(this);
-#endif
-}
-
-CodeBlock::CodeBlock(ScopeNode* ownerNode, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)
- : m_numCalleeRegisters(0)
- , m_numVars(0)
- , m_numParameters(0)
- , m_ownerNode(ownerNode)
- , m_globalData(0)
-#ifndef NDEBUG
- , m_instructionCount(0)
-#endif
- , m_needsFullScopeChain(ownerNode->needsActivation())
- , m_usesEval(ownerNode->usesEval())
+ , m_needsFullScopeChain(ownerExecutable->needsActivation())
+ , m_usesEval(ownerExecutable->usesEval())
, m_isNumericCompareFunction(false)
, m_codeType(codeType)
, m_source(sourceProvider)
, m_sourceOffset(sourceOffset)
+ , m_symbolTable(symTab)
, m_exceptionInfo(new ExceptionInfo)
{
ASSERT(m_source);
@@ -1350,7 +1331,6 @@ void CodeBlock::unlinkCallers()
void CodeBlock::derefStructures(Instruction* vPC) const
{
- ASSERT(m_codeType != NativeCode);
Interpreter* interpreter = m_globalData->interpreter;
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) {
@@ -1396,7 +1376,6 @@ void CodeBlock::derefStructures(Instruction* vPC) const
void CodeBlock::refStructures(Instruction* vPC) const
{
- ASSERT(m_codeType != NativeCode);
Interpreter* interpreter = m_globalData->interpreter;
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) {
@@ -1430,25 +1409,16 @@ void CodeBlock::refStructures(Instruction* vPC) const
void CodeBlock::markAggregate(MarkStack& markStack)
{
- for (size_t i = 0; i < m_constantRegisters.size(); ++i) {
- if (!m_constantRegisters[i].marked())
- markStack.append(m_constantRegisters[i].jsValue());
- }
-
- for (size_t i = 0; i < m_functionExpressions.size(); ++i)
- m_functionExpressions[i]->body()->markAggregate(markStack);
-
- if (m_rareData) {
- for (size_t i = 0; i < m_rareData->m_functions.size(); ++i)
- m_rareData->m_functions[i]->body()->markAggregate(markStack);
-
- m_rareData->m_evalCodeCache.markAggregate(markStack);
- }
+ for (size_t i = 0; i < m_constantRegisters.size(); ++i)
+ markStack.append(m_constantRegisters[i].jsValue());
+ for (size_t i = 0; i < m_functionExprs.size(); ++i)
+ m_functionExprs[i]->markAggregate(markStack);
+ for (size_t i = 0; i < m_functionDecls.size(); ++i)
+ m_functionDecls[i]->markAggregate(markStack);
}
void CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame)
{
- ASSERT(m_codeType != NativeCode);
if (m_exceptionInfo)
return;
@@ -1465,61 +1435,11 @@ void CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame)
scopeChain = scopeChain->next;
}
- switch (m_codeType) {
- case FunctionCode: {
- FunctionBodyNode* ownerFunctionBodyNode = static_cast<FunctionBodyNode*>(m_ownerNode);
- RefPtr<FunctionBodyNode> newFunctionBody = m_globalData->parser->reparse<FunctionBodyNode>(m_globalData, ownerFunctionBodyNode);
- ASSERT(newFunctionBody);
- newFunctionBody->finishParsing(ownerFunctionBodyNode->copyParameters(), ownerFunctionBodyNode->parameterCount());
-
- m_globalData->scopeNodeBeingReparsed = newFunctionBody.get();
-
- CodeBlock& newCodeBlock = newFunctionBody->bytecodeForExceptionInfoReparse(scopeChain, this);
- ASSERT(newCodeBlock.m_exceptionInfo);
- ASSERT(newCodeBlock.m_instructionCount == m_instructionCount);
-
-#if ENABLE(JIT)
- JIT::compile(m_globalData, &newCodeBlock);
- ASSERT(newFunctionBody->generatedJITCode().size() == ownerNode()->generatedJITCode().size());
-#endif
-
- m_exceptionInfo.set(newCodeBlock.m_exceptionInfo.release());
-
- m_globalData->scopeNodeBeingReparsed = 0;
-
- break;
- }
- case EvalCode: {
- EvalNode* ownerEvalNode = static_cast<EvalNode*>(m_ownerNode);
- RefPtr<EvalNode> newEvalBody = m_globalData->parser->reparse<EvalNode>(m_globalData, ownerEvalNode);
-
- m_globalData->scopeNodeBeingReparsed = newEvalBody.get();
-
- EvalCodeBlock& newCodeBlock = newEvalBody->bytecodeForExceptionInfoReparse(scopeChain, this);
- ASSERT(newCodeBlock.m_exceptionInfo);
- ASSERT(newCodeBlock.m_instructionCount == m_instructionCount);
-
-#if ENABLE(JIT)
- JIT::compile(m_globalData, &newCodeBlock);
- ASSERT(newEvalBody->generatedJITCode().size() == ownerNode()->generatedJITCode().size());
-#endif
-
- m_exceptionInfo.set(newCodeBlock.m_exceptionInfo.release());
-
- m_globalData->scopeNodeBeingReparsed = 0;
-
- break;
- }
- default:
- // CodeBlocks for Global code blocks are transient and therefore to not gain from
- // from throwing out there exception information.
- ASSERT_NOT_REACHED();
- }
+ m_exceptionInfo.set(m_ownerExecutable->reparseExceptionInfo(m_globalData, scopeChain, this));
}
HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset)
{
- ASSERT(m_codeType != NativeCode);
ASSERT(bytecodeOffset < m_instructionCount);
if (!m_rareData)
@@ -1538,14 +1458,13 @@ HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset)
int CodeBlock::lineNumberForBytecodeOffset(CallFrame* callFrame, unsigned bytecodeOffset)
{
- ASSERT(m_codeType != NativeCode);
ASSERT(bytecodeOffset < m_instructionCount);
reparseForExceptionInfoIfNecessary(callFrame);
ASSERT(m_exceptionInfo);
if (!m_exceptionInfo->m_lineInfo.size())
- return m_ownerNode->source().firstLine(); // Empty function
+ return m_ownerExecutable->source().firstLine(); // Empty function
int low = 0;
int high = m_exceptionInfo->m_lineInfo.size();
@@ -1558,13 +1477,12 @@ int CodeBlock::lineNumberForBytecodeOffset(CallFrame* callFrame, unsigned byteco
}
if (!low)
- return m_ownerNode->source().firstLine();
+ return m_ownerExecutable->source().firstLine();
return m_exceptionInfo->m_lineInfo[low - 1].lineNumber;
}
int CodeBlock::expressionRangeForBytecodeOffset(CallFrame* callFrame, unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset)
{
- ASSERT(m_codeType != NativeCode);
ASSERT(bytecodeOffset < m_instructionCount);
reparseForExceptionInfoIfNecessary(callFrame);
@@ -1604,7 +1522,6 @@ int CodeBlock::expressionRangeForBytecodeOffset(CallFrame* callFrame, unsigned b
bool CodeBlock::getByIdExceptionInfoForBytecodeOffset(CallFrame* callFrame, unsigned bytecodeOffset, OpcodeID& opcodeID)
{
- ASSERT(m_codeType != NativeCode);
ASSERT(bytecodeOffset < m_instructionCount);
reparseForExceptionInfoIfNecessary(callFrame);
@@ -1633,7 +1550,6 @@ bool CodeBlock::getByIdExceptionInfoForBytecodeOffset(CallFrame* callFrame, unsi
#if ENABLE(JIT)
bool CodeBlock::functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex)
{
- ASSERT(m_codeType != NativeCode);
ASSERT(bytecodeOffset < m_instructionCount);
if (!m_rareData || !m_rareData->m_functionRegisterInfos.size())
@@ -1660,7 +1576,6 @@ bool CodeBlock::functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int&
#if !ENABLE(JIT)
bool CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset(unsigned bytecodeOffset)
{
- ASSERT(m_codeType != NativeCode);
if (m_globalResolveInstructions.isEmpty())
return false;
@@ -1681,7 +1596,6 @@ bool CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset(unsigned bytecodeOff
#else
bool CodeBlock::hasGlobalResolveInfoAtBytecodeOffset(unsigned bytecodeOffset)
{
- ASSERT(m_codeType != NativeCode);
if (m_globalResolveInfos.isEmpty())
return false;
@@ -1701,18 +1615,6 @@ bool CodeBlock::hasGlobalResolveInfoAtBytecodeOffset(unsigned bytecodeOffset)
}
#endif
-#if ENABLE(JIT)
-void CodeBlock::setJITCode(JITCode jitCode)
-{
- ASSERT(m_codeType != NativeCode);
- ownerNode()->setJITCode(jitCode);
-#if !ENABLE(OPCODE_SAMPLING)
- if (!BytecodeGenerator::dumpsGeneratedCode())
- m_instructions.clear();
-#endif
-}
-#endif
-
void CodeBlock::shrinkToFit()
{
m_instructions.shrinkToFit();
@@ -1728,7 +1630,8 @@ void CodeBlock::shrinkToFit()
#endif
m_identifiers.shrinkToFit();
- m_functionExpressions.shrinkToFit();
+ m_functionDecls.shrinkToFit();
+ m_functionExprs.shrinkToFit();
m_constantRegisters.shrinkToFit();
if (m_exceptionInfo) {
@@ -1739,7 +1642,6 @@ void CodeBlock::shrinkToFit()
if (m_rareData) {
m_rareData->m_exceptionHandlers.shrinkToFit();
- m_rareData->m_functions.shrinkToFit();
m_rareData->m_regexps.shrinkToFit();
m_rareData->m_immediateSwitchJumpTables.shrinkToFit();
m_rareData->m_characterSwitchJumpTables.shrinkToFit();
diff --git a/JavaScriptCore/bytecode/CodeBlock.h b/JavaScriptCore/bytecode/CodeBlock.h
index 39b1db3..4ba58d7 100644
--- a/JavaScriptCore/bytecode/CodeBlock.h
+++ b/JavaScriptCore/bytecode/CodeBlock.h
@@ -61,7 +61,7 @@ namespace JSC {
class ExecState;
- enum CodeType { GlobalCode, EvalCode, FunctionCode, NativeCode };
+ enum CodeType { GlobalCode, EvalCode, FunctionCode };
static ALWAYS_INLINE int missingThisObjectMarker() { return std::numeric_limits<int>::max(); }
@@ -248,12 +248,22 @@ namespace JSC {
}
#endif
+ struct ExceptionInfo : FastAllocBase {
+ Vector<ExpressionRangeInfo> m_expressionInfo;
+ Vector<LineInfo> m_lineInfo;
+ Vector<GetByIdExceptionInfo> m_getByIdExceptionInfo;
+
+#if ENABLE(JIT)
+ Vector<CallReturnOffsetToBytecodeIndex> m_callReturnIndexVector;
+#endif
+ };
+
class CodeBlock : public FastAllocBase {
friend class JIT;
+ protected:
+ CodeBlock(ScriptExecutable* ownerExecutable, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable* symbolTable);
public:
- CodeBlock(ScopeNode* ownerNode);
- CodeBlock(ScopeNode* ownerNode, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset);
- ~CodeBlock();
+ virtual ~CodeBlock();
void markAggregate(MarkStack&);
void refStructures(Instruction* vPC) const;
@@ -329,7 +339,7 @@ namespace JSC {
unsigned getBytecodeIndex(CallFrame* callFrame, ReturnAddressPtr returnAddress)
{
reparseForExceptionInfoIfNecessary(callFrame);
- return binaryChop<CallReturnOffsetToBytecodeIndex, unsigned, getCallReturnOffset>(callReturnIndexVector().begin(), callReturnIndexVector().size(), ownerNode()->generatedJITCode().offsetOf(returnAddress.value()))->bytecodeIndex;
+ return binaryChop<CallReturnOffsetToBytecodeIndex, unsigned, getCallReturnOffset>(callReturnIndexVector().begin(), callReturnIndexVector().size(), ownerExecutable()->generatedJITCode().offsetOf(returnAddress.value()))->bytecodeIndex;
}
bool functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex);
@@ -339,17 +349,19 @@ namespace JSC {
bool isNumericCompareFunction() { return m_isNumericCompareFunction; }
Vector<Instruction>& instructions() { return m_instructions; }
+ void discardBytecode() { m_instructions.clear(); }
+
#ifndef NDEBUG
+ unsigned instructionCount() { return m_instructionCount; }
void setInstructionCount(unsigned instructionCount) { m_instructionCount = instructionCount; }
#endif
#if ENABLE(JIT)
- JITCode& getJITCode() { return ownerNode()->generatedJITCode(); }
- void setJITCode(JITCode);
- ExecutablePool* executablePool() { return ownerNode()->getExecutablePool(); }
+ JITCode& getJITCode() { return ownerExecutable()->generatedJITCode(); }
+ ExecutablePool* executablePool() { return ownerExecutable()->getExecutablePool(); }
#endif
- ScopeNode* ownerNode() const { return m_ownerNode; }
+ ScriptExecutable* ownerExecutable() const { return m_ownerExecutable; }
void setGlobalData(JSGlobalData* globalData) { m_globalData = globalData; }
@@ -365,8 +377,8 @@ namespace JSC {
CodeType codeType() const { return m_codeType; }
- SourceProvider* source() const { ASSERT(m_codeType != NativeCode); return m_source.get(); }
- unsigned sourceOffset() const { ASSERT(m_codeType != NativeCode); return m_sourceOffset; }
+ SourceProvider* source() const { return m_source.get(); }
+ unsigned sourceOffset() const { return m_sourceOffset; }
size_t numberOfJumpTargets() const { return m_jumpTargets.size(); }
void addJumpTarget(unsigned jumpTarget) { m_jumpTargets.append(jumpTarget); }
@@ -404,6 +416,7 @@ namespace JSC {
bool hasExceptionInfo() const { return m_exceptionInfo; }
void clearExceptionInfo() { m_exceptionInfo.clear(); }
+ ExceptionInfo* extractExceptionInfo() { ASSERT(m_exceptionInfo); return m_exceptionInfo.release(); }
void addExpressionInfo(const ExpressionRangeInfo& expressionInfo) { ASSERT(m_exceptionInfo); m_exceptionInfo->m_expressionInfo.append(expressionInfo); }
void addGetByIdExceptionInfo(const GetByIdExceptionInfo& info) { ASSERT(m_exceptionInfo); m_exceptionInfo->m_getByIdExceptionInfo.append(info); }
@@ -428,13 +441,11 @@ namespace JSC {
ALWAYS_INLINE bool isConstantRegisterIndex(int index) { return index >= FirstConstantRegisterIndex; }
ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].jsValue(); }
- unsigned addFunctionExpression(FuncExprNode* n) { unsigned size = m_functionExpressions.size(); m_functionExpressions.append(n); return size; }
- FuncExprNode* functionExpression(int index) const { return m_functionExpressions[index].get(); }
-
- unsigned addFunction(FuncDeclNode* n) { createRareDataIfNecessary(); unsigned size = m_rareData->m_functions.size(); m_rareData->m_functions.append(n); return size; }
- FuncDeclNode* function(int index) const { ASSERT(m_rareData); return m_rareData->m_functions[index].get(); }
-
- bool hasFunctions() const { return m_functionExpressions.size() || (m_rareData && m_rareData->m_functions.size()); }
+ unsigned addFunctionDecl(NonNullPassRefPtr<FunctionExecutable> n) { unsigned size = m_functionDecls.size(); m_functionDecls.append(n); return size; }
+ FunctionExecutable* functionDecl(int index) { return m_functionDecls[index].get(); }
+ int numberOfFunctionDecls() { return m_functionDecls.size(); }
+ unsigned addFunctionExpr(NonNullPassRefPtr<FunctionExecutable> n) { unsigned size = m_functionExprs.size(); m_functionExprs.append(n); return size; }
+ FunctionExecutable* functionExpr(int index) { return m_functionExprs[index].get(); }
unsigned addRegExp(RegExp* r) { createRareDataIfNecessary(); unsigned size = m_rareData->m_regexps.size(); m_rareData->m_regexps.append(r); return size; }
RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); }
@@ -455,9 +466,10 @@ namespace JSC {
StringJumpTable& stringSwitchJumpTable(int tableIndex) { ASSERT(m_rareData); return m_rareData->m_stringSwitchJumpTables[tableIndex]; }
- SymbolTable& symbolTable() { return m_symbolTable; }
+ SymbolTable* symbolTable() { return m_symbolTable; }
+ SharedSymbolTable* sharedSymbolTable() { ASSERT(m_codeType == FunctionCode); return static_cast<SharedSymbolTable*>(m_symbolTable); }
- EvalCodeCache& evalCodeCache() { ASSERT(m_codeType != NativeCode); createRareDataIfNecessary(); return m_rareData->m_evalCodeCache; }
+ EvalCodeCache& evalCodeCache() { createRareDataIfNecessary(); return m_rareData->m_evalCodeCache; }
void shrinkToFit();
@@ -476,12 +488,11 @@ namespace JSC {
void createRareDataIfNecessary()
{
- ASSERT(m_codeType != NativeCode);
if (!m_rareData)
m_rareData.set(new RareData);
}
- ScopeNode* m_ownerNode;
+ ScriptExecutable* m_ownerExecutable;
JSGlobalData* m_globalData;
Vector<Instruction> m_instructions;
@@ -517,26 +528,17 @@ namespace JSC {
// Constant Pool
Vector<Identifier> m_identifiers;
Vector<Register> m_constantRegisters;
- Vector<RefPtr<FuncExprNode> > m_functionExpressions;
-
- SymbolTable m_symbolTable;
+ Vector<RefPtr<FunctionExecutable> > m_functionDecls;
+ Vector<RefPtr<FunctionExecutable> > m_functionExprs;
- struct ExceptionInfo : FastAllocBase {
- Vector<ExpressionRangeInfo> m_expressionInfo;
- Vector<LineInfo> m_lineInfo;
- Vector<GetByIdExceptionInfo> m_getByIdExceptionInfo;
+ SymbolTable* m_symbolTable;
-#if ENABLE(JIT)
- Vector<CallReturnOffsetToBytecodeIndex> m_callReturnIndexVector;
-#endif
- };
OwnPtr<ExceptionInfo> m_exceptionInfo;
struct RareData : FastAllocBase {
Vector<HandlerInfo> m_exceptionHandlers;
// Rare Constants
- Vector<RefPtr<FuncDeclNode> > m_functions;
Vector<RefPtr<RegExp> > m_regexps;
// Jump Tables
@@ -556,16 +558,16 @@ namespace JSC {
// Program code is not marked by any function, so we make the global object
// responsible for marking it.
- class ProgramCodeBlock : public CodeBlock {
+ class GlobalCodeBlock : public CodeBlock {
public:
- ProgramCodeBlock(ScopeNode* ownerNode, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider)
- : CodeBlock(ownerNode, codeType, sourceProvider, 0)
+ GlobalCodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, JSGlobalObject* globalObject)
+ : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, &m_unsharedSymbolTable)
, m_globalObject(globalObject)
{
m_globalObject->codeBlocks().add(this);
}
- ~ProgramCodeBlock()
+ ~GlobalCodeBlock()
{
if (m_globalObject)
m_globalObject->codeBlocks().remove(this);
@@ -575,20 +577,54 @@ namespace JSC {
private:
JSGlobalObject* m_globalObject; // For program and eval nodes, the global object that marks the constant pool.
+ SymbolTable m_unsharedSymbolTable;
};
- class EvalCodeBlock : public ProgramCodeBlock {
+ class ProgramCodeBlock : public GlobalCodeBlock {
public:
- EvalCodeBlock(ScopeNode* ownerNode, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, int baseScopeDepth)
- : ProgramCodeBlock(ownerNode, EvalCode, globalObject, sourceProvider)
+ ProgramCodeBlock(ProgramExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider)
+ : GlobalCodeBlock(ownerExecutable, codeType, sourceProvider, 0, globalObject)
+ {
+ }
+ };
+
+ class EvalCodeBlock : public GlobalCodeBlock {
+ public:
+ EvalCodeBlock(EvalExecutable* ownerExecutable, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, int baseScopeDepth)
+ : GlobalCodeBlock(ownerExecutable, EvalCode, sourceProvider, 0, globalObject)
, m_baseScopeDepth(baseScopeDepth)
{
}
int baseScopeDepth() const { return m_baseScopeDepth; }
+ const Identifier& variable(unsigned index) { return m_variables[index]; }
+ unsigned numVariables() { return m_variables.size(); }
+ void adoptVariables(Vector<Identifier>& variables)
+ {
+ ASSERT(m_variables.isEmpty());
+ m_variables.swap(variables);
+ }
+
private:
int m_baseScopeDepth;
+ Vector<Identifier> m_variables;
+ };
+
+ class FunctionCodeBlock : public CodeBlock {
+ public:
+ // Rather than using the usual RefCounted::create idiom for SharedSymbolTable we just use new
+ // as we need to initialise the CodeBlock before we could initialise any RefPtr to hold the shared
+ // symbol table, so we just pass as a raw pointer with a ref count of 1. We then manually deref
+ // in the destructor.
+ FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)
+ : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, new SharedSymbolTable)
+ {
+ }
+ ~FunctionCodeBlock()
+ {
+ sharedSymbolTable()->deref();
+ }
};
inline Register& ExecState::r(int index)
diff --git a/JavaScriptCore/bytecode/EvalCodeCache.h b/JavaScriptCore/bytecode/EvalCodeCache.h
index 986525c..05834fc 100644
--- a/JavaScriptCore/bytecode/EvalCodeCache.h
+++ b/JavaScriptCore/bytecode/EvalCodeCache.h
@@ -29,6 +29,7 @@
#ifndef EvalCodeCache_h
#define EvalCodeCache_h
+#include "Executable.h"
#include "JSGlobalObject.h"
#include "Nodes.h"
#include "Parser.h"
@@ -41,44 +42,33 @@ namespace JSC {
class EvalCodeCache {
public:
- PassRefPtr<EvalNode> get(ExecState* exec, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)
+ PassRefPtr<EvalExecutable> get(ExecState* exec, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)
{
- RefPtr<EvalNode> evalNode;
+ RefPtr<EvalExecutable> evalExecutable;
if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject())
- evalNode = m_cacheMap.get(evalSource.rep());
+ evalExecutable = m_cacheMap.get(evalSource.rep());
- if (!evalNode) {
- int errorLine;
- UString errorMessage;
-
- SourceCode source = makeSource(evalSource);
- evalNode = exec->globalData().parser->parse<EvalNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errorLine, &errorMessage);
- if (evalNode) {
- if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries)
- m_cacheMap.set(evalSource.rep(), evalNode);
- } else {
- exceptionValue = Error::create(exec, SyntaxError, errorMessage, errorLine, source.provider()->asID(), 0);
+ if (!evalExecutable) {
+ evalExecutable = EvalExecutable::create(exec, makeSource(evalSource));
+ exceptionValue = evalExecutable->compile(exec, scopeChain);
+ if (exceptionValue)
return 0;
- }
+
+ if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries)
+ m_cacheMap.set(evalSource.rep(), evalExecutable);
}
- return evalNode.release();
+ return evalExecutable.release();
}
bool isEmpty() const { return m_cacheMap.isEmpty(); }
- void markAggregate(MarkStack& markStack)
- {
- EvalCacheMap::iterator end = m_cacheMap.end();
- for (EvalCacheMap::iterator ptr = m_cacheMap.begin(); ptr != end; ++ptr)
- ptr->second->markAggregate(markStack);
- }
private:
static const int maxCacheableSourceLength = 256;
static const int maxCacheEntries = 64;
- typedef HashMap<RefPtr<UString::Rep>, RefPtr<EvalNode> > EvalCacheMap;
+ typedef HashMap<RefPtr<UString::Rep>, RefPtr<EvalExecutable> > EvalCacheMap;
EvalCacheMap m_cacheMap;
};
diff --git a/JavaScriptCore/bytecode/SamplingTool.cpp b/JavaScriptCore/bytecode/SamplingTool.cpp
index 8651723..865c919 100644
--- a/JavaScriptCore/bytecode/SamplingTool.cpp
+++ b/JavaScriptCore/bytecode/SamplingTool.cpp
@@ -157,7 +157,7 @@ void SamplingThread::stop()
}
-void ScopeSampleRecord::sample(CodeBlock* codeBlock, Instruction* vPC)
+void ScriptSampleRecord::sample(CodeBlock* codeBlock, Instruction* vPC)
{
if (!m_samples) {
m_size = codeBlock->instructions().size();
@@ -196,8 +196,8 @@ void SamplingTool::doRun()
#if ENABLE(CODEBLOCK_SAMPLING)
if (CodeBlock* codeBlock = sample.codeBlock()) {
- MutexLocker locker(m_scopeSampleMapMutex);
- ScopeSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerNode());
+ MutexLocker locker(m_scriptSampleMapMutex);
+ ScriptSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable());
ASSERT(record);
record->sample(codeBlock, sample.vPC());
}
@@ -209,13 +209,13 @@ void SamplingTool::sample()
s_samplingTool->doRun();
}
-void SamplingTool::notifyOfScope(ScopeNode* scope)
+void SamplingTool::notifyOfScope(ScriptExecutable* script)
{
#if ENABLE(CODEBLOCK_SAMPLING)
- MutexLocker locker(m_scopeSampleMapMutex);
- m_scopeSampleMap->set(scope, new ScopeSampleRecord(scope));
+ MutexLocker locker(m_scriptSampleMapMutex);
+ m_scopeSampleMap->set(script, new ScriptSampleRecord(script));
#else
- UNUSED_PARAM(scope);
+ UNUSED_PARAM(script);
#endif
}
@@ -254,10 +254,10 @@ static int compareLineCountInfoSampling(const void* left, const void* right)
return (leftLineCount->line > rightLineCount->line) ? 1 : (leftLineCount->line < rightLineCount->line) ? -1 : 0;
}
-static int compareScopeSampleRecords(const void* left, const void* right)
+static int compareScriptSampleRecords(const void* left, const void* right)
{
- const ScopeSampleRecord* const leftValue = *static_cast<const ScopeSampleRecord* const *>(left);
- const ScopeSampleRecord* const rightValue = *static_cast<const ScopeSampleRecord* const *>(right);
+ const ScriptSampleRecord* const leftValue = *static_cast<const ScriptSampleRecord* const *>(left);
+ const ScriptSampleRecord* const rightValue = *static_cast<const ScriptSampleRecord* const *>(right);
return (leftValue->m_sampleCount < rightValue->m_sampleCount) ? 1 : (leftValue->m_sampleCount > rightValue->m_sampleCount) ? -1 : 0;
}
@@ -318,26 +318,26 @@ void SamplingTool::dump(ExecState* exec)
// (3) Build and sort 'codeBlockSamples' array.
int scopeCount = m_scopeSampleMap->size();
- Vector<ScopeSampleRecord*> codeBlockSamples(scopeCount);
- ScopeSampleRecordMap::iterator iter = m_scopeSampleMap->begin();
+ Vector<ScriptSampleRecord*> codeBlockSamples(scopeCount);
+ ScriptSampleRecordMap::iterator iter = m_scopeSampleMap->begin();
for (int i = 0; i < scopeCount; ++i, ++iter)
codeBlockSamples[i] = iter->second;
- qsort(codeBlockSamples.begin(), scopeCount, sizeof(ScopeSampleRecord*), compareScopeSampleRecords);
+ qsort(codeBlockSamples.begin(), scopeCount, sizeof(ScriptSampleRecord*), compareScriptSampleRecords);
// (4) Print data from 'codeBlockSamples' array.
printf("\nCodeBlock samples\n\n");
for (int i = 0; i < scopeCount; ++i) {
- ScopeSampleRecord* record = codeBlockSamples[i];
+ ScriptSampleRecord* record = codeBlockSamples[i];
CodeBlock* codeBlock = record->m_codeBlock;
double blockPercent = (record->m_sampleCount * 100.0) / m_sampleCount;
if (blockPercent >= 1) {
//Instruction* code = codeBlock->instructions().begin();
- printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_scope->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForBytecodeOffset(exec, 0), record->m_sampleCount, m_sampleCount, blockPercent);
+ printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_executable->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForBytecodeOffset(exec, 0), record->m_sampleCount, m_sampleCount, blockPercent);
if (i < 10) {
HashMap<unsigned,unsigned> lineCounts;
codeBlock->dump(exec);
diff --git a/JavaScriptCore/bytecode/SamplingTool.h b/JavaScriptCore/bytecode/SamplingTool.h
index 1a3f7cf..8e3ed9e 100644
--- a/JavaScriptCore/bytecode/SamplingTool.h
+++ b/JavaScriptCore/bytecode/SamplingTool.h
@@ -38,6 +38,8 @@
namespace JSC {
+ class ScriptExecutable;
+
class SamplingFlags {
friend class JIT;
public:
@@ -92,9 +94,9 @@ namespace JSC {
class ScopeNode;
struct Instruction;
- struct ScopeSampleRecord {
- ScopeSampleRecord(ScopeNode* scope)
- : m_scope(scope)
+ struct ScriptSampleRecord {
+ ScriptSampleRecord(ScriptExecutable* executable)
+ : m_executable(executable)
, m_codeBlock(0)
, m_sampleCount(0)
, m_opcodeSampleCount(0)
@@ -103,7 +105,7 @@ namespace JSC {
{
}
- ~ScopeSampleRecord()
+ ~ScriptSampleRecord()
{
if (m_samples)
free(m_samples);
@@ -111,7 +113,7 @@ namespace JSC {
void sample(CodeBlock*, Instruction*);
- RefPtr<ScopeNode> m_scope;
+ RefPtr<ScriptExecutable> m_executable;
CodeBlock* m_codeBlock;
int m_sampleCount;
int m_opcodeSampleCount;
@@ -119,7 +121,7 @@ namespace JSC {
unsigned m_size;
};
- typedef WTF::HashMap<ScopeNode*, ScopeSampleRecord*> ScopeSampleRecordMap;
+ typedef WTF::HashMap<ScriptExecutable*, ScriptSampleRecord*> ScriptSampleRecordMap;
class SamplingThread {
public:
@@ -193,7 +195,7 @@ namespace JSC {
, m_sampleCount(0)
, m_opcodeSampleCount(0)
#if ENABLE(CODEBLOCK_SAMPLING)
- , m_scopeSampleMap(new ScopeSampleRecordMap())
+ , m_scopeSampleMap(new ScriptSampleRecordMap())
#endif
{
memset(m_opcodeSamples, 0, sizeof(m_opcodeSamples));
@@ -210,7 +212,7 @@ namespace JSC {
void setup();
void dump(ExecState*);
- void notifyOfScope(ScopeNode* scope);
+ void notifyOfScope(ScriptExecutable* scope);
void sample(CodeBlock* codeBlock, Instruction* vPC)
{
@@ -266,8 +268,8 @@ namespace JSC {
unsigned m_opcodeSamplesInCTIFunctions[numOpcodeIDs];
#if ENABLE(CODEBLOCK_SAMPLING)
- Mutex m_scopeSampleMapMutex;
- OwnPtr<ScopeSampleRecordMap> m_scopeSampleMap;
+ Mutex m_scriptSampleMapMutex;
+ OwnPtr<ScriptSampleRecordMap> m_scopeSampleMap;
#endif
};
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
index 59537b6..8951ce3 100644
--- a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
+++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
@@ -256,15 +256,15 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d
m_nextGlobalIndex -= symbolTable->size();
for (size_t i = 0; i < functionStack.size(); ++i) {
- FuncDeclNode* funcDecl = functionStack[i];
- globalObject->removeDirect(funcDecl->m_ident); // Make sure our new function is not shadowed by an old property.
- emitNewFunction(addGlobalVar(funcDecl->m_ident, false), funcDecl);
+ FunctionBodyNode* function = functionStack[i];
+ globalObject->removeDirect(function->ident()); // Make sure our new function is not shadowed by an old property.
+ emitNewFunction(addGlobalVar(function->ident(), false), function);
}
Vector<RegisterID*, 32> newVars;
for (size_t i = 0; i < varStack.size(); ++i)
- if (!globalObject->hasProperty(exec, varStack[i].first))
- newVars.append(addGlobalVar(varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant));
+ if (!globalObject->hasProperty(exec, *varStack[i].first))
+ newVars.append(addGlobalVar(*varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant));
preserveLastVar();
@@ -272,16 +272,16 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d
emitLoad(newVars[i], jsUndefined());
} else {
for (size_t i = 0; i < functionStack.size(); ++i) {
- FuncDeclNode* funcDecl = functionStack[i];
- globalObject->putWithAttributes(exec, funcDecl->m_ident, funcDecl->makeFunction(exec, scopeChain.node()), DontDelete);
+ FunctionBodyNode* function = functionStack[i];
+ globalObject->putWithAttributes(exec, function->ident(), new (exec) JSFunction(exec, makeFunction(exec, function), scopeChain.node()), DontDelete);
}
for (size_t i = 0; i < varStack.size(); ++i) {
- if (globalObject->hasProperty(exec, varStack[i].first))
+ if (globalObject->hasProperty(exec, *varStack[i].first))
continue;
int attributes = DontDelete;
if (varStack[i].second & DeclarationStacks::IsConstant)
attributes |= ReadOnly;
- globalObject->putWithAttributes(exec, varStack[i].first, jsUndefined(), attributes);
+ globalObject->putWithAttributes(exec, *varStack[i].first, jsUndefined(), attributes);
}
preserveLastVar();
@@ -339,18 +339,18 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug
const DeclarationStacks::FunctionStack& functionStack = functionBody->functionStack();
for (size_t i = 0; i < functionStack.size(); ++i) {
- FuncDeclNode* funcDecl = functionStack[i];
- const Identifier& ident = funcDecl->m_ident;
+ FunctionBodyNode* function = functionStack[i];
+ const Identifier& ident = function->ident();
m_functions.add(ident.ustring().rep());
- emitNewFunction(addVar(ident, false), funcDecl);
+ emitNewFunction(addVar(ident, false), function);
}
const DeclarationStacks::VarStack& varStack = functionBody->varStack();
for (size_t i = 0; i < varStack.size(); ++i)
- addVar(varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant);
+ addVar(*varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant);
- const Identifier* parameters = functionBody->parameters();
- size_t parameterCount = functionBody->parameterCount();
+ FunctionParameters& parameters = *functionBody->parameters();
+ size_t parameterCount = parameters.size();
m_nextParameterIndex = -RegisterFile::CallFrameHeaderSize - parameterCount - 1;
m_parameters.grow(1 + parameterCount); // reserve space for "this"
@@ -397,6 +397,18 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugge
codeBlock->setGlobalData(m_globalData);
m_codeBlock->m_numParameters = 1; // Allocate space for "this"
+ const DeclarationStacks::FunctionStack& functionStack = evalNode->functionStack();
+ for (size_t i = 0; i < functionStack.size(); ++i)
+ m_codeBlock->addFunctionDecl(makeFunction(m_globalData, functionStack[i]));
+
+ const DeclarationStacks::VarStack& varStack = evalNode->varStack();
+ unsigned numVariables = varStack.size();
+ Vector<Identifier> variables;
+ variables.reserveCapacity(numVariables);
+ for (size_t i = 0; i < numVariables; ++i)
+ variables.append(*varStack[i].first);
+ codeBlock->adoptVariables(variables);
+
preserveLastVar();
}
@@ -470,7 +482,8 @@ RegisterID* BytecodeGenerator::constRegisterFor(const Identifier& ident)
return 0;
SymbolTableEntry entry = symbolTable().get(ident.ustring().rep());
- ASSERT(!entry.isNull());
+ if (entry.isNull())
+ return 0;
return &registerFor(entry.getIndex());
}
@@ -765,18 +778,6 @@ PassRefPtr<Label> BytecodeGenerator::emitJumpIfNotFunctionApply(RegisterID* cond
return target;
}
-unsigned BytecodeGenerator::addConstant(FuncDeclNode* n)
-{
- // No need to explicitly unique function body nodes -- they're unique already.
- return m_codeBlock->addFunction(n);
-}
-
-unsigned BytecodeGenerator::addConstant(FuncExprNode* n)
-{
- // No need to explicitly unique function expression nodes -- they're unique already.
- return m_codeBlock->addFunctionExpression(n);
-}
-
unsigned BytecodeGenerator::addConstant(const Identifier& ident)
{
UString::Rep* rep = ident.ustring().rep();
@@ -1313,11 +1314,13 @@ RegisterID* BytecodeGenerator::emitNewArray(RegisterID* dst, ElementNode* elemen
return dst;
}
-RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FuncDeclNode* n)
+RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode* function)
{
+ unsigned index = m_codeBlock->addFunctionDecl(makeFunction(m_globalData, function));
+
emitOpcode(op_new_func);
instructions().append(dst->index());
- instructions().append(addConstant(n));
+ instructions().append(index);
return dst;
}
@@ -1332,9 +1335,12 @@ RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp)
RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n)
{
+ FunctionBodyNode* function = n->body();
+ unsigned index = m_codeBlock->addFunctionExpr(makeFunction(m_globalData, function));
+
emitOpcode(op_new_func_exp);
instructions().append(r0->index());
- instructions().append(addConstant(n));
+ instructions().append(index);
return r0;
}
@@ -1805,7 +1811,7 @@ void BytecodeGenerator::emitSubroutineReturn(RegisterID* retAddrSrc)
instructions().append(retAddrSrc->index());
}
-void BytecodeGenerator::emitPushNewScope(RegisterID* dst, Identifier& property, RegisterID* value)
+void BytecodeGenerator::emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value)
{
ControlFlowContext context;
context.isFinallyBlock = false;
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/JavaScriptCore/bytecompiler/BytecodeGenerator.h
index c273597..1a83ce9 100644
--- a/JavaScriptCore/bytecompiler/BytecodeGenerator.h
+++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.h
@@ -61,7 +61,7 @@ namespace JSC {
FinallyContext finallyContext;
};
- class BytecodeGenerator : public WTF::FastAllocBase {
+ class BytecodeGenerator : public FastAllocBase {
public:
typedef DeclarationStacks::VarStack VarStack;
typedef DeclarationStacks::FunctionStack FunctionStack;
@@ -254,7 +254,7 @@ namespace JSC {
RegisterID* emitNewObject(RegisterID* dst);
RegisterID* emitNewArray(RegisterID* dst, ElementNode*); // stops at first elision
- RegisterID* emitNewFunction(RegisterID* dst, FuncDeclNode* func);
+ RegisterID* emitNewFunction(RegisterID* dst, FunctionBodyNode* body);
RegisterID* emitNewFunctionExpression(RegisterID* dst, FuncExprNode* func);
RegisterID* emitNewRegExp(RegisterID* dst, RegExp* regExp);
@@ -318,7 +318,7 @@ namespace JSC {
RegisterID* emitCatch(RegisterID*, Label* start, Label* end);
void emitThrow(RegisterID* exc) { emitUnaryNoDstOp(op_throw, exc); }
RegisterID* emitNewError(RegisterID* dst, ErrorType type, JSValue message);
- void emitPushNewScope(RegisterID* dst, Identifier& property, RegisterID* value);
+ void emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value);
RegisterID* emitPushScope(RegisterID* scope);
void emitPopScope();
@@ -413,12 +413,20 @@ namespace JSC {
return m_globals[-index - 1];
}
- unsigned addConstant(FuncDeclNode*);
- unsigned addConstant(FuncExprNode*);
unsigned addConstant(const Identifier&);
RegisterID* addConstantValue(JSValue);
unsigned addRegExp(RegExp*);
+ PassRefPtr<FunctionExecutable> makeFunction(ExecState* exec, FunctionBodyNode* body)
+ {
+ return FunctionExecutable::create(exec, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine());
+ }
+
+ PassRefPtr<FunctionExecutable> makeFunction(JSGlobalData* globalData, FunctionBodyNode* body)
+ {
+ return FunctionExecutable::create(globalData, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine());
+ }
+
Vector<Instruction>& instructions() { return m_codeBlock->instructions(); }
SymbolTable& symbolTable() { return *m_symbolTable; }
@@ -445,12 +453,12 @@ namespace JSC {
RegisterID m_thisRegister;
RegisterID m_argumentsRegister;
int m_activationRegisterIndex;
- WTF::SegmentedVector<RegisterID, 32> m_constantPoolRegisters;
- WTF::SegmentedVector<RegisterID, 32> m_calleeRegisters;
- WTF::SegmentedVector<RegisterID, 32> m_parameters;
- WTF::SegmentedVector<RegisterID, 32> m_globals;
- WTF::SegmentedVector<Label, 32> m_labels;
- WTF::SegmentedVector<LabelScope, 8> m_labelScopes;
+ SegmentedVector<RegisterID, 32> m_constantPoolRegisters;
+ SegmentedVector<RegisterID, 32> m_calleeRegisters;
+ SegmentedVector<RegisterID, 32> m_parameters;
+ SegmentedVector<RegisterID, 32> m_globals;
+ SegmentedVector<Label, 32> m_labels;
+ SegmentedVector<LabelScope, 8> m_labelScopes;
RefPtr<RegisterID> m_lastVar;
int m_finallyDepth;
int m_dynamicScopeDepth;
diff --git a/JavaScriptCore/debugger/Debugger.cpp b/JavaScriptCore/debugger/Debugger.cpp
index 7d791e7..902a802 100644
--- a/JavaScriptCore/debugger/Debugger.cpp
+++ b/JavaScriptCore/debugger/Debugger.cpp
@@ -22,16 +22,16 @@
#include "config.h"
#include "Debugger.h"
-#include "JSGlobalObject.h"
+#include "CollectorHeapIterator.h"
+#include "Error.h"
#include "Interpreter.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
#include "Parser.h"
+#include "Protect.h"
namespace JSC {
-Debugger::Debugger()
-{
-}
-
Debugger::~Debugger()
{
HashSet<JSGlobalObject*>::iterator end = m_globalObjects.end();
@@ -53,18 +53,59 @@ void Debugger::detach(JSGlobalObject* globalObject)
globalObject->setDebugger(0);
}
+void Debugger::recompileAllJSFunctions(JSGlobalData* globalData)
+{
+ // If JavaScript is running, it's not safe to recompile, since we'll end
+ // up throwing away code that is live on the stack.
+ ASSERT(!globalData->dynamicGlobalObject);
+ if (globalData->dynamicGlobalObject)
+ return;
+
+ typedef HashSet<FunctionExecutable*> FunctionExecutableSet;
+ typedef HashMap<SourceProvider*, ExecState*> SourceProviderMap;
+
+ FunctionExecutableSet functionExecutables;
+ SourceProviderMap sourceProviders;
+
+ Heap::iterator heapEnd = globalData->heap.primaryHeapEnd();
+ for (Heap::iterator it = globalData->heap.primaryHeapBegin(); it != heapEnd; ++it) {
+ if (!(*it)->inherits(&JSFunction::info))
+ continue;
+
+ JSFunction* function = asFunction(*it);
+ if (function->executable()->isHostFunction())
+ continue;
+
+ FunctionExecutable* executable = function->jsExecutable();
+
+ // Check if the function is already in the set - if so,
+ // we've already retranslated it, nothing to do here.
+ if (!functionExecutables.add(executable).second)
+ continue;
+
+ ExecState* exec = function->scope().globalObject()->JSGlobalObject::globalExec();
+ executable->recompile(exec);
+ if (function->scope().globalObject()->debugger() == this)
+ sourceProviders.add(executable->source().provider(), exec);
+ }
+
+ // Call sourceParsed() after reparsing all functions because it will execute
+ // JavaScript in the inspector.
+ SourceProviderMap::const_iterator end = sourceProviders.end();
+ for (SourceProviderMap::const_iterator iter = sourceProviders.begin(); iter != end; ++iter)
+ sourceParsed(iter->second, SourceCode(iter->first), -1, 0);
+}
+
JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSGlobalObject* globalObject)
{
CallFrame* globalCallFrame = globalObject->globalExec();
- int errLine;
- UString errMsg;
- SourceCode source = makeSource(script);
- RefPtr<EvalNode> evalNode = globalObject->globalData()->parser->parse<EvalNode>(globalCallFrame, globalObject->debugger(), source, &errLine, &errMsg);
- if (!evalNode)
- return Error::create(globalCallFrame, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url());
+ RefPtr<EvalExecutable> eval = EvalExecutable::create(globalCallFrame, makeSource(script));
+ JSObject* error = eval->compile(globalCallFrame, globalCallFrame->scopeChain());
+ if (error)
+ return error;
- return globalObject->globalData()->interpreter->execute(evalNode.get(), globalCallFrame, globalObject, globalCallFrame->scopeChain(), &exception);
+ return globalObject->globalData()->interpreter->execute(eval.get(), globalCallFrame, globalObject, globalCallFrame->scopeChain(), &exception);
}
} // namespace JSC
diff --git a/JavaScriptCore/debugger/Debugger.h b/JavaScriptCore/debugger/Debugger.h
index 98d0935..3ee9767 100644
--- a/JavaScriptCore/debugger/Debugger.h
+++ b/JavaScriptCore/debugger/Debugger.h
@@ -1,7 +1,7 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -22,40 +22,42 @@
#ifndef Debugger_h
#define Debugger_h
-#include "Protect.h"
+#include <wtf/HashSet.h>
namespace JSC {
class DebuggerCallFrame;
class ExecState;
+ class JSGlobalData;
class JSGlobalObject;
+ class JSValue;
class SourceCode;
class UString;
class Debugger {
public:
- Debugger();
virtual ~Debugger();
void attach(JSGlobalObject*);
virtual void detach(JSGlobalObject*);
- virtual void sourceParsed(ExecState*, const SourceCode&, int errorLine, const UString& errorMsg) = 0;
- virtual void exception(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
- virtual void atStatement(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
- virtual void callEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
- virtual void returnEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
+ virtual void sourceParsed(ExecState*, const SourceCode&, int errorLineNumber, const UString& errorMessage) = 0;
+ virtual void exception(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+ virtual void atStatement(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+ virtual void callEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+ virtual void returnEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
- virtual void willExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
- virtual void didExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
- virtual void didReachBreakpoint(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
+ virtual void willExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+ virtual void didExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+ virtual void didReachBreakpoint(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+
+ void recompileAllJSFunctions(JSGlobalData*);
private:
HashSet<JSGlobalObject*> m_globalObjects;
};
- // This method exists only for backwards compatibility with existing
- // WebScriptDebugger clients
+ // This function exists only for backwards compatibility with existing WebScriptDebugger clients.
JSValue evaluateInGlobalCallFrame(const UString&, JSValue& exception, JSGlobalObject*);
} // namespace JSC
diff --git a/JavaScriptCore/debugger/DebuggerActivation.cpp b/JavaScriptCore/debugger/DebuggerActivation.cpp
index 34d0447..5cc9a9f 100644
--- a/JavaScriptCore/debugger/DebuggerActivation.cpp
+++ b/JavaScriptCore/debugger/DebuggerActivation.cpp
@@ -71,7 +71,7 @@ bool DebuggerActivation::deleteProperty(ExecState* exec, const Identifier& prope
return m_activation->deleteProperty(exec, propertyName);
}
-void DebuggerActivation::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
+void DebuggerActivation::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
{
m_activation->getPropertyNames(exec, propertyNames);
}
@@ -81,14 +81,14 @@ bool DebuggerActivation::getPropertyAttributes(JSC::ExecState* exec, const Ident
return m_activation->getPropertyAttributes(exec, propertyName, attributes);
}
-void DebuggerActivation::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction)
+void DebuggerActivation::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
{
- m_activation->defineGetter(exec, propertyName, getterFunction);
+ m_activation->defineGetter(exec, propertyName, getterFunction, attributes);
}
-void DebuggerActivation::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction)
+void DebuggerActivation::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
{
- m_activation->defineSetter(exec, propertyName, setterFunction);
+ m_activation->defineSetter(exec, propertyName, setterFunction, attributes);
}
JSValue DebuggerActivation::lookupGetter(ExecState* exec, const Identifier& propertyName)
diff --git a/JavaScriptCore/debugger/DebuggerActivation.h b/JavaScriptCore/debugger/DebuggerActivation.h
index 82cde4d..dd34265 100644
--- a/JavaScriptCore/debugger/DebuggerActivation.h
+++ b/JavaScriptCore/debugger/DebuggerActivation.h
@@ -42,16 +42,16 @@ namespace JSC {
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue, unsigned attributes);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
- virtual void getPropertyNames(ExecState*, PropertyNameArray&);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&);
virtual bool getPropertyAttributes(ExecState*, const Identifier& propertyName, unsigned& attributes) const;
- virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction);
- virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction);
+ virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes);
+ virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes);
virtual JSValue lookupGetter(ExecState*, const Identifier& propertyName);
virtual JSValue lookupSetter(ExecState*, const Identifier& propertyName);
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType));
+ return Structure::create(prototype, TypeInfo(ObjectType, HasDefaultGetPropertyNames));
}
private:
diff --git a/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/JavaScriptCore/debugger/DebuggerCallFrame.cpp
index cd8702b..c9d7cc6 100644
--- a/JavaScriptCore/debugger/DebuggerCallFrame.cpp
+++ b/JavaScriptCore/debugger/DebuggerCallFrame.cpp
@@ -41,7 +41,7 @@ const UString* DebuggerCallFrame::functionName() const
if (!m_callFrame->codeBlock())
return 0;
- JSFunction* function = static_cast<JSFunction*>(m_callFrame->callee());
+ JSFunction* function = asFunction(m_callFrame->callee());
if (!function)
return 0;
return &function->name(&m_callFrame->globalData());
@@ -52,7 +52,7 @@ UString DebuggerCallFrame::calculatedFunctionName() const
if (!m_callFrame->codeBlock())
return 0;
- JSFunction* function = static_cast<JSFunction*>(m_callFrame->callee());
+ JSFunction* function = asFunction(m_callFrame->callee());
if (!function)
return 0;
return function->calculatedDisplayName(&m_callFrame->globalData());
@@ -79,14 +79,12 @@ JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) c
if (!m_callFrame->codeBlock())
return JSValue();
- int errLine;
- UString errMsg;
- SourceCode source = makeSource(script);
- RefPtr<EvalNode> evalNode = m_callFrame->scopeChain()->globalData->parser->parse<EvalNode>(m_callFrame, m_callFrame->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);
- if (!evalNode)
- return Error::create(m_callFrame, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url());
+ RefPtr<EvalExecutable> eval = EvalExecutable::create(m_callFrame, makeSource(script));
+ JSObject* error = eval->compile(m_callFrame, m_callFrame->scopeChain());
+ if (error)
+ return error;
- return m_callFrame->scopeChain()->globalData->interpreter->execute(evalNode.get(), m_callFrame, thisObject(), m_callFrame->scopeChain(), &exception);
+ return m_callFrame->scopeChain()->globalData->interpreter->execute(eval.get(), m_callFrame, thisObject(), m_callFrame->scopeChain(), &exception);
}
} // namespace JSC
diff --git a/JavaScriptCore/interpreter/CachedCall.h b/JavaScriptCore/interpreter/CachedCall.h
index 767c262..e903b79 100644
--- a/JavaScriptCore/interpreter/CachedCall.h
+++ b/JavaScriptCore/interpreter/CachedCall.h
@@ -38,9 +38,10 @@ namespace JSC {
: m_valid(false)
, m_interpreter(callFrame->interpreter())
, m_exception(exception)
- , m_globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : function->scope().node()->globalObject())
+ , m_globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : function->scope().globalObject())
{
- m_closure = m_interpreter->prepareForRepeatCall(function->body(), callFrame, function, argCount, function->scope().node(), exception);
+ ASSERT(!function->isHostFunction());
+ m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, function, argCount, function->scope().node(), exception);
m_valid = !*exception;
}
diff --git a/JavaScriptCore/interpreter/CallFrame.h b/JavaScriptCore/interpreter/CallFrame.h
index 92ec06e..b4d49db 100644
--- a/JavaScriptCore/interpreter/CallFrame.h
+++ b/JavaScriptCore/interpreter/CallFrame.h
@@ -51,14 +51,14 @@ namespace JSC {
// Differs from dynamicGlobalObject() during function calls across web browser frames.
JSGlobalObject* lexicalGlobalObject() const
{
- return scopeChain()->globalObject();
+ return scopeChain()->globalObject;
}
// Differs from lexicalGlobalObject because this will have DOM window shell rather than
// the actual DOM window, which can't be "this" for security reasons.
JSObject* globalThisValue() const
{
- return scopeChain()->globalThisObject();
+ return scopeChain()->globalThis;
}
// FIXME: Elsewhere, we use JSGlobalData* rather than JSGlobalData&.
diff --git a/JavaScriptCore/interpreter/CallFrameClosure.h b/JavaScriptCore/interpreter/CallFrameClosure.h
index 9085327..a301060 100644
--- a/JavaScriptCore/interpreter/CallFrameClosure.h
+++ b/JavaScriptCore/interpreter/CallFrameClosure.h
@@ -32,7 +32,7 @@ struct CallFrameClosure {
CallFrame* oldCallFrame;
CallFrame* newCallFrame;
JSFunction* function;
- FunctionBodyNode* functionBody;
+ FunctionExecutable* functionExecutable;
JSGlobalData* globalData;
Register* oldEnd;
ScopeChainNode* scopeChain;
diff --git a/JavaScriptCore/interpreter/Interpreter.cpp b/JavaScriptCore/interpreter/Interpreter.cpp
index f102739..847b1fa 100644
--- a/JavaScriptCore/interpreter/Interpreter.cpp
+++ b/JavaScriptCore/interpreter/Interpreter.cpp
@@ -169,7 +169,7 @@ NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction*
PropertySlot slot(globalObject);
if (globalObject->getPropertySlot(callFrame, ident, slot)) {
JSValue result = slot.getValue(callFrame, ident);
- if (slot.isCacheable() && !globalObject->structure()->isDictionary() && slot.slotBase() == globalObject) {
+ if (slot.isCacheable() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
if (vPC[4].u.structure)
vPC[4].u.structure->deref();
globalObject->structure()->ref();
@@ -350,24 +350,26 @@ NEVER_INLINE JSValue Interpreter::callEval(CallFrame* callFrame, RegisterFile* r
LiteralParser preparser(callFrame, programSource, LiteralParser::NonStrictJSON);
if (JSValue parsedObject = preparser.tryLiteralParse())
return parsedObject;
-
-
+
ScopeChainNode* scopeChain = callFrame->scopeChain();
CodeBlock* codeBlock = callFrame->codeBlock();
- RefPtr<EvalNode> evalNode = codeBlock->evalCodeCache().get(callFrame, programSource, scopeChain, exceptionValue);
+ RefPtr<EvalExecutable> eval = codeBlock->evalCodeCache().get(callFrame, programSource, scopeChain, exceptionValue);
JSValue result = jsUndefined();
- if (evalNode)
- result = callFrame->globalData().interpreter->execute(evalNode.get(), callFrame, callFrame->thisValue().toThisObject(callFrame), callFrame->registers() - registerFile->start() + registerOffset, scopeChain, &exceptionValue);
+ if (eval)
+ result = callFrame->globalData().interpreter->execute(eval.get(), callFrame, callFrame->thisValue().toThisObject(callFrame), callFrame->registers() - registerFile->start() + registerOffset, scopeChain, &exceptionValue);
return result;
}
Interpreter::Interpreter()
- : m_sampler(0)
+ : m_sampleEntryDepth(0)
, m_reentryDepth(0)
{
privateExecute(InitializeAndReturn, 0, 0, 0);
+#if ENABLE(OPCODE_SAMPLING)
+ enableSampler();
+#endif
}
#ifndef NDEBUG
@@ -386,7 +388,7 @@ void Interpreter::dumpRegisters(CallFrame* callFrame)
printf("-----------------------------------------------------------------------------\n");
CodeBlock* codeBlock = callFrame->codeBlock();
- RegisterFile* registerFile = &callFrame->scopeChain()->globalObject()->globalData()->interpreter->registerFile();
+ RegisterFile* registerFile = &callFrame->scopeChain()->globalObject->globalData()->interpreter->registerFile();
const Register* it;
const Register* end;
JSValue v;
@@ -490,21 +492,21 @@ NEVER_INLINE bool Interpreter::unwindCallFrame(CallFrame*& callFrame, JSValue ex
if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {
DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
if (callFrame->callee())
- debugger->returnEvent(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->lastLine());
+ debugger->returnEvent(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->lastLine());
else
- debugger->didExecuteProgram(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->lastLine());
+ debugger->didExecuteProgram(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->lastLine());
}
if (Profiler* profiler = *Profiler::enabledProfilerReference()) {
if (callFrame->callee())
profiler->didExecute(callFrame, callFrame->callee());
else
- profiler->didExecute(callFrame, codeBlock->ownerNode()->sourceURL(), codeBlock->ownerNode()->lineNo());
+ profiler->didExecute(callFrame, codeBlock->ownerExecutable()->sourceURL(), codeBlock->ownerExecutable()->lineNo());
}
// If this call frame created an activation or an 'arguments' object, tear it off.
if (oldCodeBlock->codeType() == FunctionCode && oldCodeBlock->needsFullScopeChain()) {
- while (!scopeChain->object->isObject(&JSActivation::info))
+ while (!scopeChain->object->inherits(&JSActivation::info))
scopeChain = scopeChain->pop();
static_cast<JSActivation*>(scopeChain->object)->copyRegisters(callFrame->optionalCalleeArguments());
} else if (Arguments* arguments = callFrame->optionalCalleeArguments()) {
@@ -555,8 +557,8 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
exception->putWithAttributes(callFrame, Identifier(callFrame, expressionEndOffsetPropertyName), jsNumber(callFrame, divotPoint + endOffset), ReadOnly | DontDelete);
} else
exception->putWithAttributes(callFrame, Identifier(callFrame, "line"), jsNumber(callFrame, codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset)), ReadOnly | DontDelete);
- exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerNode()->sourceID()), ReadOnly | DontDelete);
- exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerNode()->sourceURL()), ReadOnly | DontDelete);
+ exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerExecutable()->sourceID()), ReadOnly | DontDelete);
+ exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerExecutable()->sourceURL()), ReadOnly | DontDelete);
}
if (exception->isWatchdogException()) {
@@ -570,7 +572,7 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {
DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
- debugger->exception(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset));
+ debugger->exception(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset));
}
// If we throw in the middle of a call instruction, we need to notify
@@ -610,7 +612,7 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
return handler;
}
-JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, ScopeChainNode* scopeChain, JSObject* thisObj, JSValue* exception)
+JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, ScopeChainNode* scopeChain, JSObject* thisObj, JSValue* exception)
{
ASSERT(!scopeChain->globalData->exception);
@@ -621,7 +623,7 @@ JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sco
}
}
- CodeBlock* codeBlock = &programNode->bytecode(scopeChain);
+ CodeBlock* codeBlock = &program->bytecode(callFrame, scopeChain);
Register* oldEnd = m_registerFile.end();
Register* newEnd = oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;
@@ -630,7 +632,7 @@ JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sco
return jsNull();
}
- DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject());
+ DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject);
JSGlobalObject* lastGlobalObject = m_registerFile.globalObject();
JSGlobalObject* globalObject = callFrame->dynamicGlobalObject();
@@ -645,15 +647,15 @@ JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sco
Profiler** profiler = Profiler::enabledProfilerReference();
if (*profiler)
- (*profiler)->willExecute(newCallFrame, programNode->sourceURL(), programNode->lineNo());
+ (*profiler)->willExecute(newCallFrame, program->sourceURL(), program->lineNo());
JSValue result;
{
- SamplingTool::CallRecord callRecord(m_sampler);
+ SamplingTool::CallRecord callRecord(m_sampler.get());
m_reentryDepth++;
#if ENABLE(JIT)
- result = programNode->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
+ result = program->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
#else
result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
#endif
@@ -661,7 +663,7 @@ JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sco
}
if (*profiler)
- (*profiler)->didExecute(callFrame, programNode->sourceURL(), programNode->lineNo());
+ (*profiler)->didExecute(callFrame, program->sourceURL(), program->lineNo());
if (m_reentryDepth && lastGlobalObject && globalObject != lastGlobalObject)
lastGlobalObject->copyGlobalsTo(m_registerFile);
@@ -671,7 +673,7 @@ JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sco
return result;
}
-JSValue Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* callFrame, JSFunction* function, JSObject* thisObj, const ArgList& args, ScopeChainNode* scopeChain, JSValue* exception)
+JSValue Interpreter::execute(FunctionExecutable* functionExecutable, CallFrame* callFrame, JSFunction* function, JSObject* thisObj, const ArgList& args, ScopeChainNode* scopeChain, JSValue* exception)
{
ASSERT(!scopeChain->globalData->exception);
@@ -690,7 +692,7 @@ JSValue Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* call
return jsNull();
}
- DynamicGlobalObjectScope globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : scopeChain->globalObject());
+ DynamicGlobalObjectScope globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : scopeChain->globalObject);
CallFrame* newCallFrame = CallFrame::create(oldEnd);
size_t dst = 0;
@@ -699,7 +701,7 @@ JSValue Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* call
for (ArgList::const_iterator it = args.begin(); it != end; ++it)
newCallFrame->r(++dst) = *it;
- CodeBlock* codeBlock = &functionBodyNode->bytecode(scopeChain);
+ CodeBlock* codeBlock = &functionExecutable->bytecode(callFrame, scopeChain);
newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc);
if (UNLIKELY(!newCallFrame)) {
*exception = createStackOverflowError(callFrame);
@@ -715,11 +717,11 @@ JSValue Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* call
JSValue result;
{
- SamplingTool::CallRecord callRecord(m_sampler);
+ SamplingTool::CallRecord callRecord(m_sampler.get());
m_reentryDepth++;
#if ENABLE(JIT)
- result = functionBodyNode->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
+ result = functionExecutable->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
#else
result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
#endif
@@ -733,7 +735,7 @@ JSValue Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* call
return result;
}
-CallFrameClosure Interpreter::prepareForRepeatCall(FunctionBodyNode* functionBodyNode, CallFrame* callFrame, JSFunction* function, int argCount, ScopeChainNode* scopeChain, JSValue* exception)
+CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* FunctionExecutable, CallFrame* callFrame, JSFunction* function, int argCount, ScopeChainNode* scopeChain, JSValue* exception)
{
ASSERT(!scopeChain->globalData->exception);
@@ -757,7 +759,7 @@ CallFrameClosure Interpreter::prepareForRepeatCall(FunctionBodyNode* functionBod
for (int i = 0; i < argc; ++i)
newCallFrame->r(++dst) = jsUndefined();
- CodeBlock* codeBlock = &functionBodyNode->bytecode(scopeChain);
+ CodeBlock* codeBlock = &FunctionExecutable->bytecode(callFrame, scopeChain);
newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc);
if (UNLIKELY(!newCallFrame)) {
*exception = createStackOverflowError(callFrame);
@@ -767,10 +769,10 @@ CallFrameClosure Interpreter::prepareForRepeatCall(FunctionBodyNode* functionBod
// a 0 codeBlock indicates a built-in caller
newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), 0, argc, function);
#if ENABLE(JIT)
- functionBodyNode->jitCode(scopeChain);
+ FunctionExecutable->jitCode(newCallFrame, scopeChain);
#endif
- CallFrameClosure result = { callFrame, newCallFrame, function, functionBodyNode, scopeChain->globalData, oldEnd, scopeChain, codeBlock->m_numParameters, argc };
+ CallFrameClosure result = { callFrame, newCallFrame, function, FunctionExecutable, scopeChain->globalData, oldEnd, scopeChain, codeBlock->m_numParameters, argc };
return result;
}
@@ -783,11 +785,11 @@ JSValue Interpreter::execute(CallFrameClosure& closure, JSValue* exception)
JSValue result;
{
- SamplingTool::CallRecord callRecord(m_sampler);
+ SamplingTool::CallRecord callRecord(m_sampler.get());
m_reentryDepth++;
#if ENABLE(JIT)
- result = closure.functionBody->generatedJITCode().execute(&m_registerFile, closure.newCallFrame, closure.globalData, exception);
+ result = closure.functionExecutable->generatedJITCode().execute(&m_registerFile, closure.newCallFrame, closure.globalData, exception);
#else
result = privateExecute(Normal, &m_registerFile, closure.newCallFrame, exception);
#endif
@@ -804,12 +806,12 @@ void Interpreter::endRepeatCall(CallFrameClosure& closure)
m_registerFile.shrink(closure.oldEnd);
}
-JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception)
+JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception)
{
- return execute(evalNode, callFrame, thisObj, m_registerFile.size() + evalNode->bytecode(scopeChain).m_numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception);
+ return execute(eval, callFrame, thisObj, m_registerFile.size() + eval->bytecode(callFrame, scopeChain).m_numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception);
}
-JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, int globalRegisterOffset, ScopeChainNode* scopeChain, JSValue* exception)
+JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObject* thisObj, int globalRegisterOffset, ScopeChainNode* scopeChain, JSValue* exception)
{
ASSERT(!scopeChain->globalData->exception);
@@ -820,9 +822,9 @@ JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject*
}
}
- DynamicGlobalObjectScope globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : scopeChain->globalObject());
+ DynamicGlobalObjectScope globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : scopeChain->globalObject);
- EvalCodeBlock* codeBlock = &evalNode->bytecode(scopeChain);
+ EvalCodeBlock* codeBlock = &eval->bytecode(callFrame, scopeChain);
JSVariableObject* variableObject;
for (ScopeChainNode* node = scopeChain; ; node = node->next) {
@@ -837,21 +839,20 @@ JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject*
BatchedTransitionOptimizer optimizer(variableObject);
- const DeclarationStacks::VarStack& varStack = codeBlock->ownerNode()->varStack();
- DeclarationStacks::VarStack::const_iterator varStackEnd = varStack.end();
- for (DeclarationStacks::VarStack::const_iterator it = varStack.begin(); it != varStackEnd; ++it) {
- const Identifier& ident = (*it).first;
+ unsigned numVariables = codeBlock->numVariables();
+ for (unsigned i = 0; i < numVariables; ++i) {
+ const Identifier& ident = codeBlock->variable(i);
if (!variableObject->hasProperty(callFrame, ident)) {
PutPropertySlot slot;
variableObject->put(callFrame, ident, jsUndefined(), slot);
}
}
- const DeclarationStacks::FunctionStack& functionStack = codeBlock->ownerNode()->functionStack();
- DeclarationStacks::FunctionStack::const_iterator functionStackEnd = functionStack.end();
- for (DeclarationStacks::FunctionStack::const_iterator it = functionStack.begin(); it != functionStackEnd; ++it) {
+ int numFunctions = codeBlock->numberOfFunctionDecls();
+ for (int i = 0; i < numFunctions; ++i) {
+ FunctionExecutable* function = codeBlock->functionDecl(i);
PutPropertySlot slot;
- variableObject->put(callFrame, (*it)->m_ident, (*it)->makeFunction(callFrame, scopeChain), slot);
+ variableObject->put(callFrame, function->name(), function->make(callFrame, scopeChain), slot);
}
}
@@ -874,15 +875,15 @@ JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject*
Profiler** profiler = Profiler::enabledProfilerReference();
if (*profiler)
- (*profiler)->willExecute(newCallFrame, evalNode->sourceURL(), evalNode->lineNo());
+ (*profiler)->willExecute(newCallFrame, eval->sourceURL(), eval->lineNo());
JSValue result;
{
- SamplingTool::CallRecord callRecord(m_sampler);
+ SamplingTool::CallRecord callRecord(m_sampler.get());
m_reentryDepth++;
#if ENABLE(JIT)
- result = evalNode->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
+ result = eval->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
#else
result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
#endif
@@ -890,7 +891,7 @@ JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject*
}
if (*profiler)
- (*profiler)->didExecute(callFrame, evalNode->sourceURL(), evalNode->lineNo());
+ (*profiler)->didExecute(callFrame, eval->sourceURL(), eval->lineNo());
m_registerFile.shrink(oldEnd);
return result;
@@ -904,22 +905,22 @@ NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHook
switch (debugHookID) {
case DidEnterCallFrame:
- debugger->callEvent(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
+ debugger->callEvent(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), firstLine);
return;
case WillLeaveCallFrame:
- debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
+ debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), lastLine);
return;
case WillExecuteStatement:
- debugger->atStatement(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
+ debugger->atStatement(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), firstLine);
return;
case WillExecuteProgram:
- debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
+ debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), firstLine);
return;
case DidExecuteProgram:
- debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
+ debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), lastLine);
return;
case DidReachBreakpoint:
- debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
+ debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), lastLine);
return;
}
}
@@ -955,7 +956,7 @@ NEVER_INLINE void Interpreter::tryCachePutByID(CallFrame* callFrame, CodeBlock*
JSCell* baseCell = asCell(baseValue);
Structure* structure = baseCell->structure();
- if (structure->isDictionary()) {
+ if (structure->isUncacheableDictionary()) {
vPC[0] = getOpcode(op_put_by_id_generic);
return;
}
@@ -990,6 +991,10 @@ NEVER_INLINE void Interpreter::tryCachePutByID(CallFrame* callFrame, CodeBlock*
// Structure transition, cache transition info
if (slot.type() == PutPropertySlot::NewProperty) {
+ if (structure->isDictionary()) {
+ vPC[0] = getOpcode(op_put_by_id_generic);
+ return;
+ }
vPC[0] = getOpcode(op_put_by_id_transition);
vPC[4] = structure->previousID();
vPC[5] = structure;
@@ -1042,7 +1047,7 @@ NEVER_INLINE void Interpreter::tryCacheGetByID(CallFrame* callFrame, CodeBlock*
Structure* structure = asCell(baseValue)->structure();
- if (structure->isDictionary()) {
+ if (structure->isUncacheableDictionary()) {
vPC[0] = getOpcode(op_get_by_id_generic);
return;
}
@@ -1240,7 +1245,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = (++vPC)->u.operand;
int regExp = (++vPC)->u.operand;
- callFrame->r(dst) = JSValue(new (globalData) RegExpObject(callFrame->scopeChain()->globalObject()->regExpStructure(), callFrame->codeBlock()->regexp(regExp)));
+ callFrame->r(dst) = JSValue(new (globalData) RegExpObject(callFrame->scopeChain()->globalObject->regExpStructure(), callFrame->codeBlock()->regexp(regExp)));
++vPC;
NEXT_INSTRUCTION();
@@ -2921,7 +2926,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int dst = (++vPC)->u.operand;
int func = (++vPC)->u.operand;
- callFrame->r(dst) = JSValue(callFrame->codeBlock()->function(func)->makeFunction(callFrame, callFrame->scopeChain()));
+ callFrame->r(dst) = JSValue(callFrame->codeBlock()->functionDecl(func)->make(callFrame, callFrame->scopeChain()));
++vPC;
NEXT_INSTRUCTION();
@@ -2935,9 +2940,24 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
puts the result in register dst.
*/
int dst = (++vPC)->u.operand;
- int func = (++vPC)->u.operand;
+ int funcIndex = (++vPC)->u.operand;
- callFrame->r(dst) = JSValue(callFrame->codeBlock()->functionExpression(func)->makeFunction(callFrame, callFrame->scopeChain()));
+ FunctionExecutable* function = callFrame->codeBlock()->functionExpr(funcIndex);
+ JSFunction* func = function->make(callFrame, callFrame->scopeChain());
+
+ /*
+ The Identifier in a FunctionExpression can be referenced from inside
+ the FunctionExpression's FunctionBody to allow the function to call
+ itself recursively. However, unlike in a FunctionDeclaration, the
+ Identifier in a FunctionExpression cannot be referenced from and
+ does not affect the scope enclosing the FunctionExpression.
+ */
+ if (!function->name().isNull()) {
+ JSStaticScopeObject* functionScopeObject = new (callFrame) JSStaticScopeObject(callFrame, function->name(), func, ReadOnly | DontDelete);
+ func->scope().push(functionScopeObject);
+ }
+
+ callFrame->r(dst) = JSValue(func);
++vPC;
NEXT_INSTRUCTION();
@@ -2964,7 +2984,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
Register* newCallFrame = callFrame->registers() + registerOffset;
Register* argv = newCallFrame - RegisterFile::CallFrameHeaderSize - argCount;
JSValue thisValue = argv[0].jsValue();
- JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject();
+ JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject;
if (thisValue == globalObject && funcVal == globalObject->evalFunction()) {
JSValue result = callEval(callFrame, registerFile, argv, argCount, registerOffset, exceptionValue);
@@ -3003,8 +3023,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (callType == CallTypeJS) {
ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
- FunctionBodyNode* functionBodyNode = callData.js.functionBody;
- CodeBlock* newCodeBlock = &functionBodyNode->bytecode(callDataScopeChain);
+ CodeBlock* newCodeBlock = &callData.js.functionExecutable->bytecode(callFrame, callDataScopeChain);
CallFrame* previousCallFrame = callFrame;
@@ -3040,7 +3059,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
JSValue returnValue;
{
- SamplingTool::HostCallRecord callRecord(m_sampler);
+ SamplingTool::HostCallRecord callRecord(m_sampler.get());
returnValue = callData.native.function(newCallFrame, asObject(v), thisValue, args);
}
CHECK_FOR_EXCEPTION();
@@ -3070,7 +3089,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
exceptionValue = createStackOverflowError(callFrame);
goto vm_throw;
}
- int32_t expectedParams = callFrame->callee()->body()->parameterCount();
+ ASSERT(!callFrame->callee()->isHostFunction());
+ int32_t expectedParams = callFrame->callee()->jsExecutable()->parameterCount();
int32_t inplaceArgs = min(argCount, expectedParams);
int32_t i = 0;
Register* argStore = callFrame->registers() + argsOffset;
@@ -3157,8 +3177,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (callType == CallTypeJS) {
ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
- FunctionBodyNode* functionBodyNode = callData.js.functionBody;
- CodeBlock* newCodeBlock = &functionBodyNode->bytecode(callDataScopeChain);
+ CodeBlock* newCodeBlock = &callData.js.functionExecutable->bytecode(callFrame, callDataScopeChain);
CallFrame* previousCallFrame = callFrame;
@@ -3194,7 +3213,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
JSValue returnValue;
{
- SamplingTool::HostCallRecord callRecord(m_sampler);
+ SamplingTool::HostCallRecord callRecord(m_sampler.get());
returnValue = callData.native.function(newCallFrame, asObject(v), thisValue, args);
}
CHECK_FOR_EXCEPTION();
@@ -3320,7 +3339,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
callFrame->r(i) = jsUndefined();
int dst = (++vPC)->u.operand;
- JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionBodyNode*>(codeBlock->ownerNode()));
+ JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionExecutable*>(codeBlock->ownerExecutable()));
callFrame->r(dst) = JSValue(activation);
callFrame->setScopeChain(callFrame->scopeChain()->copy()->push(activation));
@@ -3406,15 +3425,14 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (constructType == ConstructTypeJS) {
ScopeChainNode* callDataScopeChain = constructData.js.scopeChain;
- FunctionBodyNode* functionBodyNode = constructData.js.functionBody;
- CodeBlock* newCodeBlock = &functionBodyNode->bytecode(callDataScopeChain);
+ CodeBlock* newCodeBlock = &constructData.js.functionExecutable->bytecode(callFrame, callDataScopeChain);
Structure* structure;
JSValue prototype = callFrame->r(proto).jsValue();
if (prototype.isObject())
structure = asObject(prototype)->inheritorID();
else
- structure = callDataScopeChain->globalObject()->emptyObjectStructure();
+ structure = callDataScopeChain->globalObject->emptyObjectStructure();
JSObject* newObject = new (globalData) JSObject(structure);
callFrame->r(thisRegister) = JSValue(newObject); // "this" value
@@ -3447,7 +3465,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
JSValue returnValue;
{
- SamplingTool::HostCallRecord callRecord(m_sampler);
+ SamplingTool::HostCallRecord callRecord(m_sampler.get());
returnValue = constructData.native.function(newCallFrame, asObject(v), args);
}
CHECK_FOR_EXCEPTION();
@@ -3657,7 +3675,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int message = (++vPC)->u.operand;
CodeBlock* codeBlock = callFrame->codeBlock();
- callFrame->r(dst) = JSValue(Error::create(callFrame, (ErrorType)type, callFrame->r(message).jsValue().toString(callFrame), codeBlock->lineNumberForBytecodeOffset(callFrame, vPC - codeBlock->instructions().begin()), codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()));
+ callFrame->r(dst) = JSValue(Error::create(callFrame, (ErrorType)type, callFrame->r(message).jsValue().toString(callFrame), codeBlock->lineNumberForBytecodeOffset(callFrame, vPC - codeBlock->instructions().begin()), codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()));
++vPC;
NEXT_INSTRUCTION();
@@ -3720,7 +3738,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
JSObject* baseObj = asObject(callFrame->r(base).jsValue());
Identifier& ident = callFrame->codeBlock()->identifier(property);
ASSERT(callFrame->r(function).jsValue().isObject());
- baseObj->defineSetter(callFrame, ident, asObject(callFrame->r(function).jsValue()));
+ baseObj->defineSetter(callFrame, ident, asObject(callFrame->r(function).jsValue()), 0);
++vPC;
NEXT_INSTRUCTION();
@@ -3832,7 +3850,7 @@ JSValue Interpreter::retrieveArguments(CallFrame* callFrame, JSFunction* functio
CodeBlock* codeBlock = functionCallFrame->codeBlock();
if (codeBlock->usesArguments()) {
ASSERT(codeBlock->codeType() == FunctionCode);
- SymbolTable& symbolTable = codeBlock->symbolTable();
+ SymbolTable& symbolTable = *codeBlock->symbolTable();
int argumentsIndex = symbolTable.get(functionCallFrame->propertyNames().arguments.ustring().rep()).getIndex();
if (!functionCallFrame->r(argumentsIndex).jsValue()) {
Arguments* arguments = new (callFrame) Arguments(functionCallFrame);
@@ -3885,8 +3903,8 @@ void Interpreter::retrieveLastCaller(CallFrame* callFrame, int& lineNumber, intp
unsigned bytecodeOffset = bytecodeOffsetForPC(callerFrame, callerCodeBlock, callFrame->returnPC());
lineNumber = callerCodeBlock->lineNumberForBytecodeOffset(callerFrame, bytecodeOffset - 1);
- sourceID = callerCodeBlock->ownerNode()->sourceID();
- sourceURL = callerCodeBlock->ownerNode()->sourceURL();
+ sourceID = callerCodeBlock->ownerExecutable()->sourceID();
+ sourceURL = callerCodeBlock->ownerExecutable()->sourceURL();
function = callerFrame->callee();
}
@@ -3899,4 +3917,40 @@ CallFrame* Interpreter::findFunctionCallFrame(CallFrame* callFrame, InternalFunc
return 0;
}
+void Interpreter::enableSampler()
+{
+#if ENABLE(OPCODE_SAMPLING)
+ if (!m_sampler) {
+ m_sampler.set(new SamplingTool(this));
+ m_sampler->setup();
+ }
+#endif
+}
+void Interpreter::dumpSampleData(ExecState* exec)
+{
+#if ENABLE(OPCODE_SAMPLING)
+ if (m_sampler)
+ m_sampler->dump(exec);
+#else
+ UNUSED_PARAM(exec);
+#endif
+}
+void Interpreter::startSampling()
+{
+#if ENABLE(SAMPLING_THREAD)
+ if (!m_sampleEntryDepth)
+ SamplingThread::start();
+
+ m_sampleEntryDepth++;
+#endif
+}
+void Interpreter::stopSampling()
+{
+#if ENABLE(SAMPLING_THREAD)
+ m_sampleEntryDepth--;
+ if (!m_sampleEntryDepth)
+ SamplingThread::stop();
+#endif
+}
+
} // namespace JSC
diff --git a/JavaScriptCore/interpreter/Interpreter.h b/JavaScriptCore/interpreter/Interpreter.h
index 519c508..3046b28 100644
--- a/JavaScriptCore/interpreter/Interpreter.h
+++ b/JavaScriptCore/interpreter/Interpreter.h
@@ -42,12 +42,12 @@
namespace JSC {
class CodeBlock;
- class EvalNode;
- class FunctionBodyNode;
+ class EvalExecutable;
+ class FunctionExecutable;
class InternalFunction;
class JSFunction;
class JSGlobalObject;
- class ProgramNode;
+ class ProgramExecutable;
class Register;
class ScopeChainNode;
class SamplingTool;
@@ -95,9 +95,9 @@ namespace JSC {
bool isOpcode(Opcode);
- JSValue execute(ProgramNode*, CallFrame*, ScopeChainNode*, JSObject* thisObj, JSValue* exception);
- JSValue execute(FunctionBodyNode*, CallFrame*, JSFunction*, JSObject* thisObj, const ArgList& args, ScopeChainNode*, JSValue* exception);
- JSValue execute(EvalNode* evalNode, CallFrame* exec, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception);
+ JSValue execute(ProgramExecutable*, CallFrame*, ScopeChainNode*, JSObject* thisObj, JSValue* exception);
+ JSValue execute(FunctionExecutable*, CallFrame*, JSFunction*, JSObject* thisObj, const ArgList& args, ScopeChainNode*, JSValue* exception);
+ JSValue execute(EvalExecutable* evalNode, CallFrame* exec, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception);
JSValue retrieveArguments(CallFrame*, JSFunction*) const;
JSValue retrieveCaller(CallFrame*, InternalFunction*) const;
@@ -105,21 +105,23 @@ namespace JSC {
void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc);
- void setSampler(SamplingTool* sampler) { m_sampler = sampler; }
- SamplingTool* sampler() { return m_sampler; }
+ SamplingTool* sampler() { return m_sampler.get(); }
NEVER_INLINE JSValue callEval(CallFrame*, RegisterFile*, Register* argv, int argc, int registerOffset, JSValue& exceptionValue);
NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValue&, unsigned bytecodeOffset, bool);
NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine);
+ void dumpSampleData(ExecState* exec);
+ void startSampling();
+ void stopSampling();
private:
enum ExecutionFlag { Normal, InitializeAndReturn };
- CallFrameClosure prepareForRepeatCall(FunctionBodyNode*, CallFrame*, JSFunction*, int argCount, ScopeChainNode*, JSValue* exception);
+ CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, JSFunction*, int argCount, ScopeChainNode*, JSValue* exception);
void endRepeatCall(CallFrameClosure&);
JSValue execute(CallFrameClosure&, JSValue* exception);
- JSValue execute(EvalNode*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*, JSValue* exception);
+ JSValue execute(EvalExecutable*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*, JSValue* exception);
#if USE(INTERPRETER)
NEVER_INLINE bool resolve(CallFrame*, Instruction*, JSValue& exceptionValue);
@@ -149,7 +151,9 @@ namespace JSC {
bool isCallBytecode(Opcode opcode) { return opcode == getOpcode(op_call) || opcode == getOpcode(op_construct) || opcode == getOpcode(op_call_eval); }
- SamplingTool* m_sampler;
+ void enableSampler();
+ int m_sampleEntryDepth;
+ OwnPtr<SamplingTool> m_sampler;
int m_reentryDepth;
diff --git a/JavaScriptCore/interpreter/Register.h b/JavaScriptCore/interpreter/Register.h
index 95ae5f6..76184ba 100644
--- a/JavaScriptCore/interpreter/Register.h
+++ b/JavaScriptCore/interpreter/Register.h
@@ -54,9 +54,6 @@ namespace JSC {
Register(JSValue);
JSValue jsValue() const;
-
- bool marked() const;
- void markChildren(MarkStack&);
Register(JSActivation*);
Register(CallFrame*);
@@ -114,11 +111,6 @@ namespace JSC {
{
return JSValue::decode(u.value);
}
-
- ALWAYS_INLINE bool Register::marked() const
- {
- return jsValue().marked();
- }
// Interpreter functions
diff --git a/JavaScriptCore/interpreter/RegisterFile.cpp b/JavaScriptCore/interpreter/RegisterFile.cpp
index cfcf1d3..5424199 100644
--- a/JavaScriptCore/interpreter/RegisterFile.cpp
+++ b/JavaScriptCore/interpreter/RegisterFile.cpp
@@ -36,9 +36,12 @@ RegisterFile::~RegisterFile()
#if HAVE(MMAP)
munmap(m_buffer, ((m_max - m_start) + m_maxGlobals) * sizeof(Register));
#elif HAVE(VIRTUALALLOC)
+#if PLATFORM(WINCE)
+ VirtualFree(m_buffer, DWORD(m_commitEnd) - DWORD(m_buffer), MEM_DECOMMIT);
+#endif
VirtualFree(m_buffer, 0, MEM_RELEASE);
#else
- #error "Don't know how to release virtual memory on this platform."
+ fastFree(m_buffer);
#endif
}
diff --git a/JavaScriptCore/interpreter/RegisterFile.h b/JavaScriptCore/interpreter/RegisterFile.h
index b5f7452..953c70f 100644
--- a/JavaScriptCore/interpreter/RegisterFile.h
+++ b/JavaScriptCore/interpreter/RegisterFile.h
@@ -204,8 +204,16 @@ namespace JSC {
CRASH();
}
m_commitEnd = reinterpret_cast<Register*>(reinterpret_cast<char*>(m_buffer) + committedSize);
- #else
- #error "Don't know how to reserve virtual memory on this platform."
+ #else
+ /*
+ * If neither MMAP nor VIRTUALALLOC are available - use fastMalloc instead.
+ *
+ * Please note that this is the fallback case, which is non-optimal.
+ * If any possible, the platform should provide for a better memory
+ * allocation mechanism that allows for "lazy commit" or dynamic
+ * pre-allocation, similar to mmap or VirtualAlloc, to avoid waste of memory.
+ */
+ m_buffer = static_cast<Register*>(fastMalloc(bufferLength));
#endif
m_start = m_buffer + maxGlobals;
m_end = m_start;
diff --git a/JavaScriptCore/jit/ExecutableAllocator.h b/JavaScriptCore/jit/ExecutableAllocator.h
index 4ed47e3..3274fcc 100644
--- a/JavaScriptCore/jit/ExecutableAllocator.h
+++ b/JavaScriptCore/jit/ExecutableAllocator.h
@@ -38,6 +38,10 @@
#include <sys/mman.h>
#endif
+#if PLATFORM(SYMBIAN)
+#include <e32std.h>
+#endif
+
#define JIT_ALLOCATOR_PAGE_SIZE (ExecutableAllocator::pageSize)
#define JIT_ALLOCATOR_LARGE_ALLOC_SIZE (ExecutableAllocator::pageSize * 4)
@@ -176,30 +180,35 @@ public:
static void cacheFlush(void*, size_t)
{
}
-#elif PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE)
+#elif PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE)
static void cacheFlush(void* code, size_t size)
{
sys_dcache_flush(code, size);
sys_icache_invalidate(code, size);
}
-#elif PLATFORM(ARM)
+#elif PLATFORM(SYMBIAN)
+ static void cacheFlush(void* code, size_t size)
+ {
+ User::IMB_Range(code, static_cast<char*>(code) + size);
+ }
+#elif PLATFORM(ARM_TRADITIONAL) && PLATFORM(LINUX)
static void cacheFlush(void* code, size_t size)
{
- #if COMPILER(GCC) && (GCC_VERSION >= 30406)
- __clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(code) + size);
- #else
- const int syscall = 0xf0002;
- __asm __volatile (
- "mov r0, %0\n"
- "mov r1, %1\n"
- "mov r7, %2\n"
- "mov r2, #0x0\n"
- "swi 0x00000000\n"
- :
- : "r" (code), "r" (reinterpret_cast<char*>(code) + size), "r" (syscall)
- : "r0", "r1", "r7");
- #endif // COMPILER(GCC) && (GCC_VERSION >= 30406)
+ asm volatile (
+ "push {r7}\n"
+ "mov r0, %0\n"
+ "mov r1, %1\n"
+ "mov r7, #0xf0000\n"
+ "add r7, r7, #0x2\n"
+ "mov r2, #0x0\n"
+ "svc 0x0\n"
+ "pop {r7}\n"
+ :
+ : "r" (code), "r" (reinterpret_cast<char*>(code) + size)
+ : "r0", "r1");
}
+#else
+ #error "The cacheFlush support is missing on this platform."
#endif
private:
diff --git a/JavaScriptCore/jit/ExecutableAllocatorPosix.cpp b/JavaScriptCore/jit/ExecutableAllocatorPosix.cpp
index 4bd5a2c..13a8626 100644
--- a/JavaScriptCore/jit/ExecutableAllocatorPosix.cpp
+++ b/JavaScriptCore/jit/ExecutableAllocatorPosix.cpp
@@ -44,7 +44,10 @@ void ExecutableAllocator::intializePageSize()
ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
{
- ExecutablePool::Allocation alloc = { reinterpret_cast<char*>(mmap(NULL, n, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0)), n };
+ void* allocation = mmap(NULL, n, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0);
+ if (allocation == MAP_FAILED)
+ CRASH();
+ ExecutablePool::Allocation alloc = { reinterpret_cast<char*>(allocation), n };
return alloc;
}
diff --git a/JavaScriptCore/jit/ExecutableAllocatorWin.cpp b/JavaScriptCore/jit/ExecutableAllocatorWin.cpp
index a9ba7d0..e6ac855 100644
--- a/JavaScriptCore/jit/ExecutableAllocatorWin.cpp
+++ b/JavaScriptCore/jit/ExecutableAllocatorWin.cpp
@@ -42,7 +42,10 @@ void ExecutableAllocator::intializePageSize()
ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
{
- ExecutablePool::Allocation alloc = {reinterpret_cast<char*>(VirtualAlloc(0, n, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE)), n};
+ void* allocation = VirtualAlloc(0, n, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
+ if (!allocation)
+ CRASH();
+ ExecutablePool::Allocation alloc = {reinterpret_cast<char*>(allocation), n};
return alloc;
}
diff --git a/JavaScriptCore/jit/JIT.cpp b/JavaScriptCore/jit/JIT.cpp
index 0d6d1b8..ea8434e 100644
--- a/JavaScriptCore/jit/JIT.cpp
+++ b/JavaScriptCore/jit/JIT.cpp
@@ -195,7 +195,7 @@ void JIT::privateCompileMainPass()
switch (m_interpreter->getOpcodeID(currentInstruction->u.opcode)) {
DEFINE_BINARY_OP(op_del_by_val)
-#if !USE(JSVALUE32_64)
+#if USE(JSVALUE32)
DEFINE_BINARY_OP(op_div)
#endif
DEFINE_BINARY_OP(op_in)
@@ -230,7 +230,7 @@ void JIT::privateCompileMainPass()
DEFINE_OP(op_create_arguments)
DEFINE_OP(op_debug)
DEFINE_OP(op_del_by_id)
-#if USE(JSVALUE32_64)
+#if !USE(JSVALUE32)
DEFINE_OP(op_div)
#endif
DEFINE_OP(op_end)
@@ -379,7 +379,7 @@ void JIT::privateCompileSlowCases()
DEFINE_SLOWCASE_OP(op_construct)
DEFINE_SLOWCASE_OP(op_construct_verify)
DEFINE_SLOWCASE_OP(op_convert_this)
-#if USE(JSVALUE32_64)
+#if !USE(JSVALUE32)
DEFINE_SLOWCASE_OP(op_div)
#endif
DEFINE_SLOWCASE_OP(op_eq)
@@ -438,7 +438,7 @@ void JIT::privateCompileSlowCases()
#endif
}
-void JIT::privateCompile()
+JITCode JIT::privateCompile()
{
sampleCodeBlock(m_codeBlock);
#if ENABLE(OPCODE_SAMPLING)
@@ -552,7 +552,7 @@ void JIT::privateCompile()
info.callReturnLocation = m_codeBlock->structureStubInfo(m_methodCallCompilationInfo[i].propertyAccessIndex).callReturnLocation;
}
- m_codeBlock->setJITCode(patchBuffer.finalizeCode());
+ return patchBuffer.finalizeCode();
}
#if !USE(JSVALUE32_64)
@@ -587,12 +587,11 @@ void JIT::unlinkCall(CallLinkInfo* callLinkInfo)
void JIT::linkCall(JSFunction* callee, CodeBlock* callerCodeBlock, CodeBlock* calleeCodeBlock, JITCode& code, CallLinkInfo* callLinkInfo, int callerArgCount, JSGlobalData* globalData)
{
- ASSERT(calleeCodeBlock);
RepatchBuffer repatchBuffer(callerCodeBlock);
// Currently we only link calls with the exact number of arguments.
// If this is a native call calleeCodeBlock is null so the number of parameters is unimportant
- if (callerArgCount == calleeCodeBlock->m_numParameters || calleeCodeBlock->codeType() == NativeCode) {
+ if (!calleeCodeBlock || (callerArgCount == calleeCodeBlock->m_numParameters)) {
ASSERT(!callLinkInfo->isLinked());
if (calleeCodeBlock)
diff --git a/JavaScriptCore/jit/JIT.h b/JavaScriptCore/jit/JIT.h
index 93f47d9..0712743 100644
--- a/JavaScriptCore/jit/JIT.h
+++ b/JavaScriptCore/jit/JIT.h
@@ -191,82 +191,82 @@ namespace JSC {
// MacroAssembler will need to plant register swaps if it is not -
// however the code will still function correctly.
#if PLATFORM(X86_64)
- static const RegisterID returnValueRegister = X86::eax;
- static const RegisterID cachedResultRegister = X86::eax;
- static const RegisterID firstArgumentRegister = X86::edi;
-
- static const RegisterID timeoutCheckRegister = X86::r12;
- static const RegisterID callFrameRegister = X86::r13;
- static const RegisterID tagTypeNumberRegister = X86::r14;
- static const RegisterID tagMaskRegister = X86::r15;
-
- static const RegisterID regT0 = X86::eax;
- static const RegisterID regT1 = X86::edx;
- static const RegisterID regT2 = X86::ecx;
- static const RegisterID regT3 = X86::ebx;
-
- static const FPRegisterID fpRegT0 = X86::xmm0;
- static const FPRegisterID fpRegT1 = X86::xmm1;
- static const FPRegisterID fpRegT2 = X86::xmm2;
+ static const RegisterID returnValueRegister = X86Registers::eax;
+ static const RegisterID cachedResultRegister = X86Registers::eax;
+ static const RegisterID firstArgumentRegister = X86Registers::edi;
+
+ static const RegisterID timeoutCheckRegister = X86Registers::r12;
+ static const RegisterID callFrameRegister = X86Registers::r13;
+ static const RegisterID tagTypeNumberRegister = X86Registers::r14;
+ static const RegisterID tagMaskRegister = X86Registers::r15;
+
+ static const RegisterID regT0 = X86Registers::eax;
+ static const RegisterID regT1 = X86Registers::edx;
+ static const RegisterID regT2 = X86Registers::ecx;
+ static const RegisterID regT3 = X86Registers::ebx;
+
+ static const FPRegisterID fpRegT0 = X86Registers::xmm0;
+ static const FPRegisterID fpRegT1 = X86Registers::xmm1;
+ static const FPRegisterID fpRegT2 = X86Registers::xmm2;
#elif PLATFORM(X86)
- static const RegisterID returnValueRegister = X86::eax;
- static const RegisterID cachedResultRegister = X86::eax;
+ static const RegisterID returnValueRegister = X86Registers::eax;
+ static const RegisterID cachedResultRegister = X86Registers::eax;
// On x86 we always use fastcall conventions = but on
// OS X if might make more sense to just use regparm.
- static const RegisterID firstArgumentRegister = X86::ecx;
-
- static const RegisterID timeoutCheckRegister = X86::esi;
- static const RegisterID callFrameRegister = X86::edi;
-
- static const RegisterID regT0 = X86::eax;
- static const RegisterID regT1 = X86::edx;
- static const RegisterID regT2 = X86::ecx;
- static const RegisterID regT3 = X86::ebx;
-
- static const FPRegisterID fpRegT0 = X86::xmm0;
- static const FPRegisterID fpRegT1 = X86::xmm1;
- static const FPRegisterID fpRegT2 = X86::xmm2;
-#elif PLATFORM_ARM_ARCH(7)
- static const RegisterID returnValueRegister = ARM::r0;
- static const RegisterID cachedResultRegister = ARM::r0;
- static const RegisterID firstArgumentRegister = ARM::r0;
-
- static const RegisterID regT0 = ARM::r0;
- static const RegisterID regT1 = ARM::r1;
- static const RegisterID regT2 = ARM::r2;
- static const RegisterID regT3 = ARM::r4;
-
- static const RegisterID callFrameRegister = ARM::r5;
- static const RegisterID timeoutCheckRegister = ARM::r6;
-
- static const FPRegisterID fpRegT0 = ARM::d0;
- static const FPRegisterID fpRegT1 = ARM::d1;
- static const FPRegisterID fpRegT2 = ARM::d2;
-#elif PLATFORM(ARM)
- static const RegisterID returnValueRegister = ARM::r0;
- static const RegisterID cachedResultRegister = ARM::r0;
- static const RegisterID firstArgumentRegister = ARM::r0;
-
- static const RegisterID timeoutCheckRegister = ARM::r5;
- static const RegisterID callFrameRegister = ARM::r4;
- static const RegisterID ctiReturnRegister = ARM::r6;
-
- static const RegisterID regT0 = ARM::r0;
- static const RegisterID regT1 = ARM::r1;
- static const RegisterID regT2 = ARM::r2;
+ static const RegisterID firstArgumentRegister = X86Registers::ecx;
+
+ static const RegisterID timeoutCheckRegister = X86Registers::esi;
+ static const RegisterID callFrameRegister = X86Registers::edi;
+
+ static const RegisterID regT0 = X86Registers::eax;
+ static const RegisterID regT1 = X86Registers::edx;
+ static const RegisterID regT2 = X86Registers::ecx;
+ static const RegisterID regT3 = X86Registers::ebx;
+
+ static const FPRegisterID fpRegT0 = X86Registers::xmm0;
+ static const FPRegisterID fpRegT1 = X86Registers::xmm1;
+ static const FPRegisterID fpRegT2 = X86Registers::xmm2;
+#elif PLATFORM(ARM_THUMB2)
+ static const RegisterID returnValueRegister = ARMRegisters::r0;
+ static const RegisterID cachedResultRegister = ARMRegisters::r0;
+ static const RegisterID firstArgumentRegister = ARMRegisters::r0;
+
+ static const RegisterID regT0 = ARMRegisters::r0;
+ static const RegisterID regT1 = ARMRegisters::r1;
+ static const RegisterID regT2 = ARMRegisters::r2;
+ static const RegisterID regT3 = ARMRegisters::r4;
+
+ static const RegisterID callFrameRegister = ARMRegisters::r5;
+ static const RegisterID timeoutCheckRegister = ARMRegisters::r6;
+
+ static const FPRegisterID fpRegT0 = ARMRegisters::d0;
+ static const FPRegisterID fpRegT1 = ARMRegisters::d1;
+ static const FPRegisterID fpRegT2 = ARMRegisters::d2;
+#elif PLATFORM(ARM_TRADITIONAL)
+ static const RegisterID returnValueRegister = ARMRegisters::r0;
+ static const RegisterID cachedResultRegister = ARMRegisters::r0;
+ static const RegisterID firstArgumentRegister = ARMRegisters::r0;
+
+ static const RegisterID timeoutCheckRegister = ARMRegisters::r5;
+ static const RegisterID callFrameRegister = ARMRegisters::r4;
+ static const RegisterID ctiReturnRegister = ARMRegisters::r6;
+
+ static const RegisterID regT0 = ARMRegisters::r0;
+ static const RegisterID regT1 = ARMRegisters::r1;
+ static const RegisterID regT2 = ARMRegisters::r2;
// Callee preserved
- static const RegisterID regT3 = ARM::r7;
+ static const RegisterID regT3 = ARMRegisters::r7;
- static const RegisterID regS0 = ARM::S0;
+ static const RegisterID regS0 = ARMRegisters::S0;
// Callee preserved
- static const RegisterID regS1 = ARM::S1;
+ static const RegisterID regS1 = ARMRegisters::S1;
- static const RegisterID regStackPtr = ARM::sp;
- static const RegisterID regLink = ARM::lr;
+ static const RegisterID regStackPtr = ARMRegisters::sp;
+ static const RegisterID regLink = ARMRegisters::lr;
- static const FPRegisterID fpRegT0 = ARM::d0;
- static const FPRegisterID fpRegT1 = ARM::d1;
- static const FPRegisterID fpRegT2 = ARM::d2;
+ static const FPRegisterID fpRegT0 = ARMRegisters::d0;
+ static const FPRegisterID fpRegT1 = ARMRegisters::d1;
+ static const FPRegisterID fpRegT2 = ARMRegisters::d2;
#else
#error "JIT not supported on this platform."
#endif
@@ -277,10 +277,9 @@ namespace JSC {
static const int patchGetByIdDefaultOffset = 256;
public:
- static void compile(JSGlobalData* globalData, CodeBlock* codeBlock)
+ static JITCode compile(JSGlobalData* globalData, CodeBlock* codeBlock)
{
- JIT jit(globalData, codeBlock);
- jit.privateCompile();
+ return JIT(globalData, codeBlock).privateCompile();
}
static void compileGetByIdProto(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, ReturnAddressPtr returnAddress)
@@ -353,7 +352,7 @@ namespace JSC {
void privateCompileMainPass();
void privateCompileLinkPass();
void privateCompileSlowCases();
- void privateCompile();
+ JITCode privateCompile();
void privateCompileGetByIdProto(StructureStubInfo*, Structure*, Structure* prototypeStructure, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame);
void privateCompileGetByIdSelfList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, size_t cachedOffset);
void privateCompileGetByIdProtoList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, Structure* prototypeStructure, size_t cachedOffset, CallFrame* callFrame);
@@ -380,14 +379,18 @@ namespace JSC {
enum CompileOpStrictEqType { OpStrictEq, OpNStrictEq };
void compileOpStrictEq(Instruction* instruction, CompileOpStrictEqType type);
+ bool isOperandConstantImmediateDouble(unsigned src);
+
+ void emitLoadDouble(unsigned index, FPRegisterID value);
+ void emitLoadInt32ToDouble(unsigned index, FPRegisterID value);
+
+ Address addressFor(unsigned index, RegisterID base = callFrameRegister);
#if USE(JSVALUE32_64)
Address tagFor(unsigned index, RegisterID base = callFrameRegister);
Address payloadFor(unsigned index, RegisterID base = callFrameRegister);
- Address addressFor(unsigned index, RegisterID base = callFrameRegister);
bool getOperandConstantImmediateInt(unsigned op1, unsigned op2, unsigned& op, int32_t& constant);
- bool isOperandConstantImmediateDouble(unsigned src);
void emitLoadTag(unsigned index, RegisterID tag);
void emitLoadPayload(unsigned index, RegisterID payload);
@@ -395,8 +398,6 @@ namespace JSC {
void emitLoad(const JSValue& v, RegisterID tag, RegisterID payload);
void emitLoad(unsigned index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
void emitLoad2(unsigned index1, RegisterID tag1, RegisterID payload1, unsigned index2, RegisterID tag2, RegisterID payload2);
- void emitLoadDouble(unsigned index, FPRegisterID value);
- void emitLoadInt32ToDouble(unsigned index, FPRegisterID value);
void emitStore(unsigned index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
void emitStore(unsigned index, const JSValue constant, RegisterID base = callFrameRegister);
@@ -500,6 +501,7 @@ namespace JSC {
JIT::Jump emitJumpIfNotImmediateInteger(RegisterID);
JIT::Jump emitJumpIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);
void emitJumpSlowCaseIfNotImmediateInteger(RegisterID);
+ void emitJumpSlowCaseIfNotImmediateNumber(RegisterID);
void emitJumpSlowCaseIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);
#if !USE(JSVALUE64)
@@ -512,7 +514,11 @@ namespace JSC {
void emitTagAsBoolImmediate(RegisterID reg);
void compileBinaryArithOp(OpcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi);
- void compileBinaryArithOpSlowCase(OpcodeID, Vector<SlowCaseEntry>::iterator&, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi);
+#if USE(JSVALUE64)
+ void compileBinaryArithOpSlowCase(OpcodeID, Vector<SlowCaseEntry>::iterator&, unsigned dst, unsigned src1, unsigned src2, OperandTypes, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase);
+#else
+ void compileBinaryArithOpSlowCase(OpcodeID, Vector<SlowCaseEntry>::iterator&, unsigned dst, unsigned src1, unsigned src2, OperandTypes);
+#endif
#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
void compileGetByIdHotPath(int resultVReg, int baseVReg, Identifier* ident, unsigned propertyAccessInstructionIndex);
@@ -536,7 +542,7 @@ namespace JSC {
static const int patchOffsetGetByIdPropertyMapOffset = 31;
static const int patchOffsetGetByIdPutResult = 31;
#if ENABLE(OPCODE_SAMPLING)
- static const int patchOffsetGetByIdSlowCaseCall = 63;
+ static const int patchOffsetGetByIdSlowCaseCall = 64;
#else
static const int patchOffsetGetByIdSlowCaseCall = 41;
#endif
@@ -572,7 +578,7 @@ namespace JSC {
static const int patchOffsetMethodCheckProtoObj = 11;
static const int patchOffsetMethodCheckProtoStruct = 18;
static const int patchOffsetMethodCheckPutFunction = 29;
-#elif PLATFORM_ARM_ARCH(7)
+#elif PLATFORM(ARM_THUMB2)
// These architecture specific value are used to enable patching - see comment on op_put_by_id.
static const int patchOffsetPutByIdStructure = 10;
static const int patchOffsetPutByIdExternalLoad = 20;
@@ -595,9 +601,62 @@ namespace JSC {
static const int patchOffsetMethodCheckProtoObj = 18;
static const int patchOffsetMethodCheckProtoStruct = 28;
static const int patchOffsetMethodCheckPutFunction = 46;
+#elif PLATFORM(ARM_TRADITIONAL)
+ // These architecture specific value are used to enable patching - see comment on op_put_by_id.
+ static const int patchOffsetPutByIdStructure = 4;
+ static const int patchOffsetPutByIdExternalLoad = 16;
+ static const int patchLengthPutByIdExternalLoad = 4;
+ static const int patchOffsetPutByIdPropertyMapOffset = 20;
+ // These architecture specific value are used to enable patching - see comment on op_get_by_id.
+ static const int patchOffsetGetByIdStructure = 4;
+ static const int patchOffsetGetByIdBranchToSlowCase = 16;
+ static const int patchOffsetGetByIdExternalLoad = 16;
+ static const int patchLengthGetByIdExternalLoad = 4;
+ static const int patchOffsetGetByIdPropertyMapOffset = 20;
+ static const int patchOffsetGetByIdPutResult = 28;
+#if ENABLE(OPCODE_SAMPLING)
+ #error "OPCODE_SAMPLING is not yet supported"
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 36;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 12;
+
+ static const int patchOffsetMethodCheckProtoObj = 12;
+ static const int patchOffsetMethodCheckProtoStruct = 20;
+ static const int patchOffsetMethodCheckPutFunction = 32;
#endif
#endif // USE(JSVALUE32_64)
+#if PLATFORM(ARM_TRADITIONAL)
+ // sequenceOpCall
+ static const int sequenceOpCallInstructionSpace = 12;
+ static const int sequenceOpCallConstantSpace = 2;
+ // sequenceMethodCheck
+ static const int sequenceMethodCheckInstructionSpace = 40;
+ static const int sequenceMethodCheckConstantSpace = 6;
+ // sequenceGetByIdHotPath
+ static const int sequenceGetByIdHotPathInstructionSpace = 28;
+ static const int sequenceGetByIdHotPathConstantSpace = 3;
+ // sequenceGetByIdSlowCase
+ static const int sequenceGetByIdSlowCaseInstructionSpace = 40;
+ static const int sequenceGetByIdSlowCaseConstantSpace = 2;
+ // sequencePutById
+ static const int sequencePutByIdInstructionSpace = 28;
+ static const int sequencePutByIdConstantSpace = 3;
+#endif
+
+#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
+#define BEGIN_UNINTERRUPTED_SEQUENCE(name) beginUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace)
+#define END_UNINTERRUPTED_SEQUENCE(name) endUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace)
+
+ void beginUninterruptedSequence(int, int);
+ void endUninterruptedSequence(int, int);
+
+#else
+#define BEGIN_UNINTERRUPTED_SEQUENCE(name)
+#define END_UNINTERRUPTED_SEQUENCE(name)
+#endif
+
void emit_op_add(Instruction*);
void emit_op_bitand(Instruction*);
void emit_op_bitnot(Instruction*);
@@ -741,6 +800,7 @@ namespace JSC {
/* These functions are deprecated: Please use JITStubCall instead. */
void emitPutJITStubArg(RegisterID src, unsigned argumentNumber);
#if USE(JSVALUE32_64)
+ void emitPutJITStubArg(RegisterID tag, RegisterID payload, unsigned argumentNumber);
void emitPutJITStubArgFromVirtualRegister(unsigned src, unsigned argumentNumber, RegisterID scratch1, RegisterID scratch2);
#else
void emitPutJITStubArgFromVirtualRegister(unsigned src, unsigned argumentNumber, RegisterID scratch);
@@ -835,6 +895,13 @@ namespace JSC {
int m_lastResultBytecodeRegister;
unsigned m_jumpTargetsPosition;
#endif
+
+#ifndef NDEBUG
+#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
+ Label m_uninterruptedInstructionSequenceBegin;
+ int m_uninterruptedConstantSequenceBegin;
+#endif
+#endif
} JIT_CLASS_ALIGNMENT;
} // namespace JSC
diff --git a/JavaScriptCore/jit/JITArithmetic.cpp b/JavaScriptCore/jit/JITArithmetic.cpp
index ea343d8..7afc1f2 100644
--- a/JavaScriptCore/jit/JITArithmetic.cpp
+++ b/JavaScriptCore/jit/JITArithmetic.cpp
@@ -566,6 +566,14 @@ void JIT::emit_op_add(Instruction* currentInstruction)
unsigned op2 = currentInstruction[3].u.operand;
OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+ if (!types.first().mightBeNumber() || !types.second().mightBeNumber()) {
+ JITStubCall stubCall(this, cti_op_add);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(dst);
+ return;
+ }
+
JumpList notInt32Op1;
JumpList notInt32Op2;
@@ -630,19 +638,21 @@ void JIT::emitSlow_op_add(Instruction* currentInstruction, Vector<SlowCaseEntry>
unsigned op2 = currentInstruction[3].u.operand;
OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+ if (!types.first().mightBeNumber() || !types.second().mightBeNumber())
+ return;
+
unsigned op;
int32_t constant;
if (getOperandConstantImmediateInt(op1, op2, op, constant)) {
linkSlowCase(iter); // overflow check
- if (!supportsFloatingPoint()) {
+ if (!supportsFloatingPoint())
linkSlowCase(iter); // non-sse case
- return;
+ else {
+ ResultType opType = op == op1 ? types.first() : types.second();
+ if (!opType.definitelyIsNumber())
+ linkSlowCase(iter); // double check
}
-
- ResultType opType = op == op1 ? types.first() : types.second();
- if (!opType.definitelyIsNumber())
- linkSlowCase(iter); // double check
} else {
linkSlowCase(iter); // overflow check
@@ -1053,33 +1063,33 @@ void JIT::emit_op_mod(Instruction* currentInstruction)
unsigned op2 = currentInstruction[3].u.operand;
if (isOperandConstantImmediateInt(op2) && getConstantOperand(op2).asInt32() != 0) {
- emitLoad(op1, X86::edx, X86::eax);
- move(Imm32(getConstantOperand(op2).asInt32()), X86::ecx);
- addSlowCase(branch32(NotEqual, X86::edx, Imm32(JSValue::Int32Tag)));
+ emitLoad(op1, X86Registers::edx, X86Registers::eax);
+ move(Imm32(getConstantOperand(op2).asInt32()), X86Registers::ecx);
+ addSlowCase(branch32(NotEqual, X86Registers::edx, Imm32(JSValue::Int32Tag)));
if (getConstantOperand(op2).asInt32() == -1)
- addSlowCase(branch32(Equal, X86::eax, Imm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC
+ addSlowCase(branch32(Equal, X86Registers::eax, Imm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC
} else {
- emitLoad2(op1, X86::edx, X86::eax, op2, X86::ebx, X86::ecx);
- addSlowCase(branch32(NotEqual, X86::edx, Imm32(JSValue::Int32Tag)));
- addSlowCase(branch32(NotEqual, X86::ebx, Imm32(JSValue::Int32Tag)));
+ emitLoad2(op1, X86Registers::edx, X86Registers::eax, op2, X86Registers::ebx, X86Registers::ecx);
+ addSlowCase(branch32(NotEqual, X86Registers::edx, Imm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, X86Registers::ebx, Imm32(JSValue::Int32Tag)));
- addSlowCase(branch32(Equal, X86::eax, Imm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC
- addSlowCase(branch32(Equal, X86::ecx, Imm32(0))); // divide by 0
+ addSlowCase(branch32(Equal, X86Registers::eax, Imm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC
+ addSlowCase(branch32(Equal, X86Registers::ecx, Imm32(0))); // divide by 0
}
- move(X86::eax, X86::ebx); // Save dividend payload, in case of 0.
+ move(X86Registers::eax, X86Registers::ebx); // Save dividend payload, in case of 0.
m_assembler.cdq();
- m_assembler.idivl_r(X86::ecx);
+ m_assembler.idivl_r(X86Registers::ecx);
// If the remainder is zero and the dividend is negative, the result is -0.
- Jump storeResult1 = branchTest32(NonZero, X86::edx);
- Jump storeResult2 = branchTest32(Zero, X86::ebx, Imm32(0x80000000)); // not negative
+ Jump storeResult1 = branchTest32(NonZero, X86Registers::edx);
+ Jump storeResult2 = branchTest32(Zero, X86Registers::ebx, Imm32(0x80000000)); // not negative
emitStore(dst, jsNumber(m_globalData, -0.0));
Jump end = jump();
storeResult1.link(this);
storeResult2.link(this);
- emitStoreInt32(dst, X86::edx, (op1 == dst || op2 == dst));
+ emitStoreInt32(dst, X86Registers::edx, (op1 == dst || op2 == dst));
end.link(this);
}
@@ -1847,21 +1857,21 @@ void JIT::emit_op_mod(Instruction* currentInstruction)
unsigned op1 = currentInstruction[2].u.operand;
unsigned op2 = currentInstruction[3].u.operand;
- emitGetVirtualRegisters(op1, X86::eax, op2, X86::ecx);
- emitJumpSlowCaseIfNotImmediateInteger(X86::eax);
- emitJumpSlowCaseIfNotImmediateInteger(X86::ecx);
+ emitGetVirtualRegisters(op1, X86Registers::eax, op2, X86Registers::ecx);
+ emitJumpSlowCaseIfNotImmediateInteger(X86Registers::eax);
+ emitJumpSlowCaseIfNotImmediateInteger(X86Registers::ecx);
#if USE(JSVALUE64)
- addSlowCase(branchPtr(Equal, X86::ecx, ImmPtr(JSValue::encode(jsNumber(m_globalData, 0)))));
+ addSlowCase(branchPtr(Equal, X86Registers::ecx, ImmPtr(JSValue::encode(jsNumber(m_globalData, 0)))));
m_assembler.cdq();
- m_assembler.idivl_r(X86::ecx);
+ m_assembler.idivl_r(X86Registers::ecx);
#else
- emitFastArithDeTagImmediate(X86::eax);
- addSlowCase(emitFastArithDeTagImmediateJumpIfZero(X86::ecx));
+ emitFastArithDeTagImmediate(X86Registers::eax);
+ addSlowCase(emitFastArithDeTagImmediateJumpIfZero(X86Registers::ecx));
m_assembler.cdq();
- m_assembler.idivl_r(X86::ecx);
- signExtend32ToPtr(X86::edx, X86::edx);
+ m_assembler.idivl_r(X86Registers::ecx);
+ signExtend32ToPtr(X86Registers::edx, X86Registers::edx);
#endif
- emitFastArithReTagImmediate(X86::edx, X86::eax);
+ emitFastArithReTagImmediate(X86Registers::edx, X86Registers::eax);
emitPutVirtualRegister(result);
}
@@ -1877,14 +1887,14 @@ void JIT::emitSlow_op_mod(Instruction* currentInstruction, Vector<SlowCaseEntry>
Jump notImm1 = getSlowCase(iter);
Jump notImm2 = getSlowCase(iter);
linkSlowCase(iter);
- emitFastArithReTagImmediate(X86::eax, X86::eax);
- emitFastArithReTagImmediate(X86::ecx, X86::ecx);
+ emitFastArithReTagImmediate(X86Registers::eax, X86Registers::eax);
+ emitFastArithReTagImmediate(X86Registers::ecx, X86Registers::ecx);
notImm1.link(this);
notImm2.link(this);
#endif
JITStubCall stubCall(this, cti_op_mod);
- stubCall.addArgument(X86::eax);
- stubCall.addArgument(X86::ecx);
+ stubCall.addArgument(X86Registers::eax);
+ stubCall.addArgument(X86Registers::ecx);
stubCall.call(result);
}
@@ -1932,55 +1942,87 @@ void JIT::compileBinaryArithOp(OpcodeID opcodeID, unsigned, unsigned op1, unsign
emitFastArithIntToImmNoCheck(regT0, regT0);
}
-void JIT::compileBinaryArithOpSlowCase(OpcodeID opcodeID, Vector<SlowCaseEntry>::iterator& iter, unsigned result, unsigned op1, unsigned, OperandTypes types)
+void JIT::compileBinaryArithOpSlowCase(OpcodeID opcodeID, Vector<SlowCaseEntry>::iterator& iter, unsigned result, unsigned op1, unsigned op2, OperandTypes types, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase)
{
// We assume that subtracting TagTypeNumber is equivalent to adding DoubleEncodeOffset.
COMPILE_ASSERT(((JSImmediate::TagTypeNumber + JSImmediate::DoubleEncodeOffset) == 0), TagTypeNumber_PLUS_DoubleEncodeOffset_EQUALS_0);
-
- Jump notImm1 = getSlowCase(iter);
- Jump notImm2 = getSlowCase(iter);
+
+ Jump notImm1;
+ Jump notImm2;
+ if (op1HasImmediateIntFastCase) {
+ notImm2 = getSlowCase(iter);
+ } else if (op2HasImmediateIntFastCase) {
+ notImm1 = getSlowCase(iter);
+ } else {
+ notImm1 = getSlowCase(iter);
+ notImm2 = getSlowCase(iter);
+ }
linkSlowCase(iter); // Integer overflow case - we could handle this in JIT code, but this is likely rare.
- if (opcodeID == op_mul) // op_mul has an extra slow case to handle 0 * negative number.
+ if (opcodeID == op_mul && !op1HasImmediateIntFastCase && !op2HasImmediateIntFastCase) // op_mul has an extra slow case to handle 0 * negative number.
linkSlowCase(iter);
emitGetVirtualRegister(op1, regT0);
Label stubFunctionCall(this);
JITStubCall stubCall(this, opcodeID == op_add ? cti_op_add : opcodeID == op_sub ? cti_op_sub : cti_op_mul);
+ if (op1HasImmediateIntFastCase || op2HasImmediateIntFastCase) {
+ emitGetVirtualRegister(op1, regT0);
+ emitGetVirtualRegister(op2, regT1);
+ }
stubCall.addArgument(regT0);
stubCall.addArgument(regT1);
stubCall.call(result);
Jump end = jump();
- // if we get here, eax is not an int32, edx not yet checked.
- notImm1.link(this);
- if (!types.first().definitelyIsNumber())
- emitJumpIfNotImmediateNumber(regT0).linkTo(stubFunctionCall, this);
- if (!types.second().definitelyIsNumber())
- emitJumpIfNotImmediateNumber(regT1).linkTo(stubFunctionCall, this);
- addPtr(tagTypeNumberRegister, regT0);
- movePtrToDouble(regT0, fpRegT1);
- Jump op2isDouble = emitJumpIfNotImmediateInteger(regT1);
- convertInt32ToDouble(regT1, fpRegT2);
- Jump op2wasInteger = jump();
-
- // if we get here, eax IS an int32, edx is not.
- notImm2.link(this);
- if (!types.second().definitelyIsNumber())
- emitJumpIfNotImmediateNumber(regT1).linkTo(stubFunctionCall, this);
- convertInt32ToDouble(regT0, fpRegT1);
- op2isDouble.link(this);
- addPtr(tagTypeNumberRegister, regT1);
- movePtrToDouble(regT1, fpRegT2);
- op2wasInteger.link(this);
+ if (op1HasImmediateIntFastCase) {
+ notImm2.link(this);
+ if (!types.second().definitelyIsNumber())
+ emitJumpIfNotImmediateNumber(regT0).linkTo(stubFunctionCall, this);
+ emitGetVirtualRegister(op1, regT1);
+ convertInt32ToDouble(regT1, fpRegT1);
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT2);
+ } else if (op2HasImmediateIntFastCase) {
+ notImm1.link(this);
+ if (!types.first().definitelyIsNumber())
+ emitJumpIfNotImmediateNumber(regT0).linkTo(stubFunctionCall, this);
+ emitGetVirtualRegister(op2, regT1);
+ convertInt32ToDouble(regT1, fpRegT1);
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT2);
+ } else {
+ // if we get here, eax is not an int32, edx not yet checked.
+ notImm1.link(this);
+ if (!types.first().definitelyIsNumber())
+ emitJumpIfNotImmediateNumber(regT0).linkTo(stubFunctionCall, this);
+ if (!types.second().definitelyIsNumber())
+ emitJumpIfNotImmediateNumber(regT1).linkTo(stubFunctionCall, this);
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT1);
+ Jump op2isDouble = emitJumpIfNotImmediateInteger(regT1);
+ convertInt32ToDouble(regT1, fpRegT2);
+ Jump op2wasInteger = jump();
+
+ // if we get here, eax IS an int32, edx is not.
+ notImm2.link(this);
+ if (!types.second().definitelyIsNumber())
+ emitJumpIfNotImmediateNumber(regT1).linkTo(stubFunctionCall, this);
+ convertInt32ToDouble(regT0, fpRegT1);
+ op2isDouble.link(this);
+ addPtr(tagTypeNumberRegister, regT1);
+ movePtrToDouble(regT1, fpRegT2);
+ op2wasInteger.link(this);
+ }
if (opcodeID == op_add)
addDouble(fpRegT2, fpRegT1);
else if (opcodeID == op_sub)
subDouble(fpRegT2, fpRegT1);
- else {
- ASSERT(opcodeID == op_mul);
+ else if (opcodeID == op_mul)
mulDouble(fpRegT2, fpRegT1);
+ else {
+ ASSERT(opcodeID == op_div);
+ divDouble(fpRegT2, fpRegT1);
}
moveDoubleToPtr(fpRegT1, regT0);
subPtr(tagTypeNumberRegister, regT0);
@@ -2025,16 +2067,14 @@ void JIT::emitSlow_op_add(Instruction* currentInstruction, Vector<SlowCaseEntry>
unsigned result = currentInstruction[1].u.operand;
unsigned op1 = currentInstruction[2].u.operand;
unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
- if (isOperandConstantImmediateInt(op1) || isOperandConstantImmediateInt(op2)) {
- linkSlowCase(iter);
- linkSlowCase(iter);
- JITStubCall stubCall(this, cti_op_add);
- stubCall.addArgument(op1, regT2);
- stubCall.addArgument(op2, regT2);
- stubCall.call(result);
- } else
- compileBinaryArithOpSlowCase(op_add, iter, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand));
+ if (!types.first().mightBeNumber() || !types.second().mightBeNumber())
+ return;
+
+ bool op1HasImmediateIntFastCase = isOperandConstantImmediateInt(op1);
+ bool op2HasImmediateIntFastCase = !op1HasImmediateIntFastCase && isOperandConstantImmediateInt(op2);
+ compileBinaryArithOpSlowCase(op_add, iter, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand), op1HasImmediateIntFastCase, op2HasImmediateIntFastCase);
}
void JIT::emit_op_mul(Instruction* currentInstruction)
@@ -2069,17 +2109,106 @@ void JIT::emitSlow_op_mul(Instruction* currentInstruction, Vector<SlowCaseEntry>
unsigned op2 = currentInstruction[3].u.operand;
OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
- if ((isOperandConstantImmediateInt(op1) && (getConstantOperandImmediateInt(op1) > 0))
- || (isOperandConstantImmediateInt(op2) && (getConstantOperandImmediateInt(op2) > 0))) {
- linkSlowCase(iter);
- linkSlowCase(iter);
- // There is an extra slow case for (op1 * -N) or (-N * op2), to check for 0 since this should produce a result of -0.
- JITStubCall stubCall(this, cti_op_mul);
- stubCall.addArgument(op1, regT2);
- stubCall.addArgument(op2, regT2);
- stubCall.call(result);
- } else
- compileBinaryArithOpSlowCase(op_mul, iter, result, op1, op2, types);
+ bool op1HasImmediateIntFastCase = isOperandConstantImmediateInt(op1) && getConstantOperandImmediateInt(op1) > 0;
+ bool op2HasImmediateIntFastCase = !op1HasImmediateIntFastCase && isOperandConstantImmediateInt(op2) && getConstantOperandImmediateInt(op2) > 0;
+ compileBinaryArithOpSlowCase(op_mul, iter, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand), op1HasImmediateIntFastCase, op2HasImmediateIntFastCase);
+}
+
+void JIT::emit_op_div(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ if (isOperandConstantImmediateDouble(op1)) {
+ emitGetVirtualRegister(op1, regT0);
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT0);
+ } else if (isOperandConstantImmediateInt(op1)) {
+ emitLoadInt32ToDouble(op1, fpRegT0);
+ } else {
+ emitGetVirtualRegister(op1, regT0);
+ if (!types.first().definitelyIsNumber())
+ emitJumpSlowCaseIfNotImmediateNumber(regT0);
+ Jump notInt = emitJumpIfNotImmediateInteger(regT0);
+ convertInt32ToDouble(regT0, fpRegT0);
+ Jump skipDoubleLoad = jump();
+ notInt.link(this);
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT0);
+ skipDoubleLoad.link(this);
+ }
+
+ if (isOperandConstantImmediateDouble(op2)) {
+ emitGetVirtualRegister(op2, regT1);
+ addPtr(tagTypeNumberRegister, regT1);
+ movePtrToDouble(regT1, fpRegT1);
+ } else if (isOperandConstantImmediateInt(op2)) {
+ emitLoadInt32ToDouble(op2, fpRegT1);
+ } else {
+ emitGetVirtualRegister(op2, regT1);
+ if (!types.second().definitelyIsNumber())
+ emitJumpSlowCaseIfNotImmediateNumber(regT1);
+ Jump notInt = emitJumpIfNotImmediateInteger(regT1);
+ convertInt32ToDouble(regT1, fpRegT1);
+ Jump skipDoubleLoad = jump();
+ notInt.link(this);
+ addPtr(tagTypeNumberRegister, regT1);
+ movePtrToDouble(regT1, fpRegT1);
+ skipDoubleLoad.link(this);
+ }
+ divDouble(fpRegT1, fpRegT0);
+
+ JumpList doubleResult;
+ Jump end;
+ bool attemptIntConversion = (!isOperandConstantImmediateInt(op1) || getConstantOperand(op1).asInt32() > 1) && isOperandConstantImmediateInt(op2);
+ if (attemptIntConversion) {
+ m_assembler.cvttsd2si_rr(fpRegT0, regT0);
+ doubleResult.append(branchTest32(Zero, regT0));
+ m_assembler.ucomisd_rr(fpRegT1, fpRegT0);
+
+ doubleResult.append(m_assembler.jne());
+ doubleResult.append(m_assembler.jp());
+ emitFastArithIntToImmNoCheck(regT0, regT0);
+ end = jump();
+ }
+
+ // Double result.
+ doubleResult.link(this);
+ moveDoubleToPtr(fpRegT0, regT0);
+ subPtr(tagTypeNumberRegister, regT0);
+
+ if (attemptIntConversion)
+ end.link(this);
+ emitPutVirtualRegister(dst, regT0);
+}
+
+void JIT::emitSlow_op_div(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+ if (types.first().definitelyIsNumber() && types.second().definitelyIsNumber()) {
+#ifndef NDEBUG
+ breakpoint();
+#endif
+ return;
+ }
+ if (!isOperandConstantImmediateDouble(op1) && !isOperandConstantImmediateInt(op1)) {
+ if (!types.first().definitelyIsNumber())
+ linkSlowCase(iter);
+ }
+ if (!isOperandConstantImmediateDouble(op2) && !isOperandConstantImmediateInt(op2)) {
+ if (!types.second().definitelyIsNumber())
+ linkSlowCase(iter);
+ }
+ // There is an extra slow case for (op1 * -N) or (-N * op2), to check for 0 since this should produce a result of -0.
+ JITStubCall stubCall(this, cti_op_div);
+ stubCall.addArgument(op1, regT2);
+ stubCall.addArgument(op2, regT2);
+ stubCall.call(result);
}
void JIT::emit_op_sub(Instruction* currentInstruction)
@@ -2090,7 +2219,6 @@ void JIT::emit_op_sub(Instruction* currentInstruction)
OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
compileBinaryArithOp(op_sub, result, op1, op2, types);
-
emitPutVirtualRegister(result);
}
@@ -2101,7 +2229,7 @@ void JIT::emitSlow_op_sub(Instruction* currentInstruction, Vector<SlowCaseEntry>
unsigned op2 = currentInstruction[3].u.operand;
OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
- compileBinaryArithOpSlowCase(op_sub, iter, result, op1, op2, types);
+ compileBinaryArithOpSlowCase(op_sub, iter, result, op1, op2, types, false, false);
}
#else // USE(JSVALUE64)
@@ -2284,6 +2412,15 @@ void JIT::emit_op_add(Instruction* currentInstruction)
unsigned result = currentInstruction[1].u.operand;
unsigned op1 = currentInstruction[2].u.operand;
unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ if (!types.first().mightBeNumber() || !types.second().mightBeNumber()) {
+ JITStubCall stubCall(this, cti_op_add);
+ stubCall.addArgument(op1, regT2);
+ stubCall.addArgument(op2, regT2);
+ stubCall.call(result);
+ return;
+ }
if (isOperandConstantImmediateInt(op1)) {
emitGetVirtualRegister(op2, regT0);
@@ -2298,15 +2435,7 @@ void JIT::emit_op_add(Instruction* currentInstruction)
signExtend32ToPtr(regT0, regT0);
emitPutVirtualRegister(result);
} else {
- OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
- if (types.first().mightBeNumber() && types.second().mightBeNumber())
- compileBinaryArithOp(op_add, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand));
- else {
- JITStubCall stubCall(this, cti_op_add);
- stubCall.addArgument(op1, regT2);
- stubCall.addArgument(op2, regT2);
- stubCall.call(result);
- }
+ compileBinaryArithOp(op_add, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand));
}
}
@@ -2316,6 +2445,10 @@ void JIT::emitSlow_op_add(Instruction* currentInstruction, Vector<SlowCaseEntry>
unsigned op1 = currentInstruction[2].u.operand;
unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+ if (!types.first().mightBeNumber() || !types.second().mightBeNumber())
+ return;
+
if (isOperandConstantImmediateInt(op1)) {
Jump notImm = getSlowCase(iter);
linkSlowCase(iter);
diff --git a/JavaScriptCore/jit/JITCall.cpp b/JavaScriptCore/jit/JITCall.cpp
index 7fdb845..cfaa69f 100644
--- a/JavaScriptCore/jit/JITCall.cpp
+++ b/JavaScriptCore/jit/JITCall.cpp
@@ -64,10 +64,9 @@ void JIT::compileOpCallSetupArgs(Instruction* instruction)
int argCount = instruction[3].u.operand;
int registerOffset = instruction[4].u.operand;
- emitPutJITStubArg(regT0, 1);
- emitPutJITStubArg(regT1, 2);
- emitPutJITStubArgConstant(registerOffset, 3);
- emitPutJITStubArgConstant(argCount, 5);
+ emitPutJITStubArg(regT1, regT0, 0);
+ emitPutJITStubArgConstant(registerOffset, 1);
+ emitPutJITStubArgConstant(argCount, 2);
}
void JIT::compileOpConstructSetupArgs(Instruction* instruction)
@@ -77,20 +76,18 @@ void JIT::compileOpConstructSetupArgs(Instruction* instruction)
int proto = instruction[5].u.operand;
int thisRegister = instruction[6].u.operand;
- emitPutJITStubArg(regT0, 1);
- emitPutJITStubArg(regT1, 2);
- emitPutJITStubArgConstant(registerOffset, 3);
- emitPutJITStubArgConstant(argCount, 5);
- emitPutJITStubArgFromVirtualRegister(proto, 7, regT2, regT3);
- emitPutJITStubArgConstant(thisRegister, 9);
+ emitPutJITStubArg(regT1, regT0, 0);
+ emitPutJITStubArgConstant(registerOffset, 1);
+ emitPutJITStubArgConstant(argCount, 2);
+ emitPutJITStubArgFromVirtualRegister(proto, 3, regT2, regT3);
+ emitPutJITStubArgConstant(thisRegister, 4);
}
void JIT::compileOpCallVarargsSetupArgs(Instruction*)
{
- emitPutJITStubArg(regT0, 1);
- emitPutJITStubArg(regT1, 2);
- emitPutJITStubArg(regT3, 3); // registerOffset
- emitPutJITStubArg(regT2, 5); // argCount
+ emitPutJITStubArg(regT1, regT0, 0);
+ emitPutJITStubArg(regT3, 1); // registerOffset
+ emitPutJITStubArg(regT2, 2); // argCount
}
void JIT::compileOpCallVarargs(Instruction* instruction)
@@ -239,19 +236,17 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
int argCount = instruction[3].u.operand;
int registerOffset = instruction[4].u.operand;
- Jump wasEval1;
- Jump wasEval2;
+ Jump wasEval;
if (opcodeID == op_call_eval) {
JITStubCall stubCall(this, cti_op_call_eval);
stubCall.addArgument(callee);
stubCall.addArgument(JIT::Imm32(registerOffset));
stubCall.addArgument(JIT::Imm32(argCount));
stubCall.call();
- wasEval1 = branchTest32(NonZero, regT0);
- wasEval2 = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
+ wasEval = branch32(NotEqual, regT1, Imm32(JSValue::EmptyValueTag));
}
- emitLoad(callee, regT1, regT2);
+ emitLoad(callee, regT1, regT0);
if (opcodeID == op_call)
compileOpCallSetupArgs(instruction);
@@ -259,12 +254,12 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
compileOpConstructSetupArgs(instruction);
emitJumpSlowCaseIfNotJSCell(callee, regT1);
- addSlowCase(branchPtr(NotEqual, Address(regT2), ImmPtr(m_globalData->jsFunctionVPtr)));
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr)));
// First, in the case of a construct, allocate the new object.
if (opcodeID == op_construct) {
JITStubCall(this, cti_op_construct_JSConstruct).call(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
- emitLoad(callee, regT1, regT2);
+ emitLoad(callee, regT1, regT0);
}
// Speculatively roll the callframe, assuming argCount will match the arity.
@@ -274,12 +269,10 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
emitNakedCall(m_globalData->jitStubs.ctiVirtualCall());
- if (opcodeID == op_call_eval) {
- wasEval1.link(this);
- wasEval2.link(this);
- }
+ if (opcodeID == op_call_eval)
+ wasEval.link(this);
- emitStore(dst, regT1, regT0);;
+ emitStore(dst, regT1, regT0);
sampleCodeBlock(m_codeBlock);
}
@@ -309,16 +302,14 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca
int argCount = instruction[3].u.operand;
int registerOffset = instruction[4].u.operand;
- Jump wasEval1;
- Jump wasEval2;
+ Jump wasEval;
if (opcodeID == op_call_eval) {
JITStubCall stubCall(this, cti_op_call_eval);
stubCall.addArgument(callee);
stubCall.addArgument(JIT::Imm32(registerOffset));
stubCall.addArgument(JIT::Imm32(argCount));
stubCall.call();
- wasEval1 = branchTest32(NonZero, regT0);
- wasEval2 = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
+ wasEval = branch32(NotEqual, regT1, Imm32(JSValue::EmptyValueTag));
}
emitLoad(callee, regT1, regT0);
@@ -362,10 +353,8 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca
// Call to the callee
m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall();
- if (opcodeID == op_call_eval) {
- wasEval1.link(this);
- wasEval2.link(this);
- }
+ if (opcodeID == op_call_eval)
+ wasEval.link(this);
// Put the return value in dst. In the interpreter, op_ret does this.
emitStore(dst, regT1, regT0);
@@ -439,10 +428,10 @@ void JIT::compileOpCallInitializeCallFrame()
{
store32(regT1, Address(callFrameRegister, RegisterFile::ArgumentCount * static_cast<int>(sizeof(Register))));
- loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_data) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // newScopeChain
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_data) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // newScopeChain
storePtr(ImmPtr(JSValue::encode(JSValue())), Address(callFrameRegister, RegisterFile::OptionalCalleeArguments * static_cast<int>(sizeof(Register))));
- storePtr(regT2, Address(callFrameRegister, RegisterFile::Callee * static_cast<int>(sizeof(Register))));
+ storePtr(regT0, Address(callFrameRegister, RegisterFile::Callee * static_cast<int>(sizeof(Register))));
storePtr(regT1, Address(callFrameRegister, RegisterFile::ScopeChain * static_cast<int>(sizeof(Register))));
}
@@ -452,9 +441,9 @@ void JIT::compileOpCallSetupArgs(Instruction* instruction)
int registerOffset = instruction[4].u.operand;
// ecx holds func
- emitPutJITStubArg(regT2, 1);
- emitPutJITStubArgConstant(argCount, 3);
- emitPutJITStubArgConstant(registerOffset, 2);
+ emitPutJITStubArg(regT0, 0);
+ emitPutJITStubArgConstant(argCount, 2);
+ emitPutJITStubArgConstant(registerOffset, 1);
}
void JIT::compileOpCallVarargsSetupArgs(Instruction* instruction)
@@ -462,10 +451,10 @@ void JIT::compileOpCallVarargsSetupArgs(Instruction* instruction)
int registerOffset = instruction[4].u.operand;
// ecx holds func
+ emitPutJITStubArg(regT0, 0);
+ emitPutJITStubArg(regT1, 2);
+ addPtr(Imm32(registerOffset), regT1, regT2);
emitPutJITStubArg(regT2, 1);
- emitPutJITStubArg(regT1, 3);
- addPtr(Imm32(registerOffset), regT1, regT0);
- emitPutJITStubArg(regT0, 2);
}
void JIT::compileOpConstructSetupArgs(Instruction* instruction)
@@ -476,11 +465,11 @@ void JIT::compileOpConstructSetupArgs(Instruction* instruction)
int thisRegister = instruction[6].u.operand;
// ecx holds func
- emitPutJITStubArg(regT2, 1);
- emitPutJITStubArgConstant(registerOffset, 2);
- emitPutJITStubArgConstant(argCount, 3);
- emitPutJITStubArgFromVirtualRegister(proto, 4, regT0);
- emitPutJITStubArgConstant(thisRegister, 5);
+ emitPutJITStubArg(regT0, 0);
+ emitPutJITStubArgConstant(registerOffset, 1);
+ emitPutJITStubArgConstant(argCount, 2);
+ emitPutJITStubArgFromVirtualRegister(proto, 3, regT2);
+ emitPutJITStubArgConstant(thisRegister, 4);
}
void JIT::compileOpCallVarargs(Instruction* instruction)
@@ -490,20 +479,20 @@ void JIT::compileOpCallVarargs(Instruction* instruction)
int argCountRegister = instruction[3].u.operand;
emitGetVirtualRegister(argCountRegister, regT1);
- emitGetVirtualRegister(callee, regT2);
+ emitGetVirtualRegister(callee, regT0);
compileOpCallVarargsSetupArgs(instruction);
// Check for JSFunctions.
- emitJumpSlowCaseIfNotJSCell(regT2);
- addSlowCase(branchPtr(NotEqual, Address(regT2), ImmPtr(m_globalData->jsFunctionVPtr)));
-
+ emitJumpSlowCaseIfNotJSCell(regT0);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr)));
+
// Speculatively roll the callframe, assuming argCount will match the arity.
- mul32(Imm32(sizeof(Register)), regT0, regT0);
+ mul32(Imm32(sizeof(Register)), regT2, regT2);
intptr_t offset = (intptr_t)sizeof(Register) * (intptr_t)RegisterFile::CallerFrame;
- addPtr(Imm32((int32_t)offset), regT0, regT3);
+ addPtr(Imm32((int32_t)offset), regT2, regT3);
addPtr(callFrameRegister, regT3);
storePtr(callFrameRegister, regT3);
- addPtr(regT0, callFrameRegister);
+ addPtr(regT2, callFrameRegister);
emitNakedCall(m_globalData->jitStubs.ctiVirtualCall());
// Put the return value in dst. In the interpreter, op_ret does this.
@@ -539,14 +528,14 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
Jump wasEval;
if (opcodeID == op_call_eval) {
JITStubCall stubCall(this, cti_op_call_eval);
- stubCall.addArgument(callee, regT2);
+ stubCall.addArgument(callee, regT0);
stubCall.addArgument(JIT::Imm32(registerOffset));
stubCall.addArgument(JIT::Imm32(argCount));
stubCall.call();
wasEval = branchPtr(NotEqual, regT0, ImmPtr(JSValue::encode(JSValue())));
}
- emitGetVirtualRegister(callee, regT2);
+ emitGetVirtualRegister(callee, regT0);
// The arguments have been set up on the hot path for op_call_eval
if (opcodeID == op_call)
compileOpCallSetupArgs(instruction);
@@ -554,13 +543,13 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
compileOpConstructSetupArgs(instruction);
// Check for JSFunctions.
- emitJumpSlowCaseIfNotJSCell(regT2);
- addSlowCase(branchPtr(NotEqual, Address(regT2), ImmPtr(m_globalData->jsFunctionVPtr)));
+ emitJumpSlowCaseIfNotJSCell(regT0);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr)));
// First, in the case of a construct, allocate the new object.
if (opcodeID == op_construct) {
JITStubCall(this, cti_op_construct_JSConstruct).call(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
- emitGetVirtualRegister(callee, regT2);
+ emitGetVirtualRegister(callee, regT0);
}
// Speculatively roll the callframe, assuming argCount will match the arity.
@@ -606,7 +595,7 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca
Jump wasEval;
if (opcodeID == op_call_eval) {
JITStubCall stubCall(this, cti_op_call_eval);
- stubCall.addArgument(callee, regT2);
+ stubCall.addArgument(callee, regT0);
stubCall.addArgument(JIT::Imm32(registerOffset));
stubCall.addArgument(JIT::Imm32(argCount));
stubCall.call();
@@ -615,9 +604,15 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca
// This plants a check for a cached JSFunction value, so we can plant a fast link to the callee.
// This deliberately leaves the callee in ecx, used when setting up the stack frame below
- emitGetVirtualRegister(callee, regT2);
+ emitGetVirtualRegister(callee, regT0);
DataLabelPtr addressOfLinkedFunctionCheck;
- Jump jumpToSlow = branchPtrWithPatch(NotEqual, regT2, addressOfLinkedFunctionCheck, ImmPtr(JSValue::encode(JSValue())));
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
+
+ Jump jumpToSlow = branchPtrWithPatch(NotEqual, regT0, addressOfLinkedFunctionCheck, ImmPtr(JSValue::encode(JSValue())));
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
+
addSlowCase(jumpToSlow);
ASSERT(differenceBetween(addressOfLinkedFunctionCheck, jumpToSlow) == patchOffsetOpCallCompareToJump);
m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck;
@@ -629,18 +624,18 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca
int proto = instruction[5].u.operand;
int thisRegister = instruction[6].u.operand;
- emitPutJITStubArg(regT2, 1);
- emitPutJITStubArgFromVirtualRegister(proto, 4, regT0);
+ emitPutJITStubArg(regT0, 0);
+ emitPutJITStubArgFromVirtualRegister(proto, 3, regT2);
JITStubCall stubCall(this, cti_op_construct_JSConstruct);
stubCall.call(thisRegister);
- emitGetVirtualRegister(callee, regT2);
+ emitGetVirtualRegister(callee, regT0);
}
// Fast version of stack frame initialization, directly relative to edi.
// Note that this omits to set up RegisterFile::CodeBlock, which is set in the callee
storePtr(ImmPtr(JSValue::encode(JSValue())), Address(callFrameRegister, (registerOffset + RegisterFile::OptionalCalleeArguments) * static_cast<int>(sizeof(Register))));
- storePtr(regT2, Address(callFrameRegister, (registerOffset + RegisterFile::Callee) * static_cast<int>(sizeof(Register))));
- loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_data) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // newScopeChain
+ storePtr(regT0, Address(callFrameRegister, (registerOffset + RegisterFile::Callee) * static_cast<int>(sizeof(Register))));
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_data) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // newScopeChain
store32(Imm32(argCount), Address(callFrameRegister, (registerOffset + RegisterFile::ArgumentCount) * static_cast<int>(sizeof(Register))));
storePtr(callFrameRegister, Address(callFrameRegister, (registerOffset + RegisterFile::CallerFrame) * static_cast<int>(sizeof(Register))));
storePtr(regT1, Address(callFrameRegister, (registerOffset + RegisterFile::ScopeChain) * static_cast<int>(sizeof(Register))));
@@ -674,13 +669,13 @@ void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>:
compileOpConstructSetupArgs(instruction);
// Fast check for JS function.
- Jump callLinkFailNotObject = emitJumpIfNotJSCell(regT2);
- Jump callLinkFailNotJSFunction = branchPtr(NotEqual, Address(regT2), ImmPtr(m_globalData->jsFunctionVPtr));
+ Jump callLinkFailNotObject = emitJumpIfNotJSCell(regT0);
+ Jump callLinkFailNotJSFunction = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr));
// First, in the case of a construct, allocate the new object.
if (opcodeID == op_construct) {
JITStubCall(this, cti_op_construct_JSConstruct).call(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
- emitGetVirtualRegister(callee, regT2);
+ emitGetVirtualRegister(callee, regT0);
}
// Speculatively roll the callframe, assuming argCount will match the arity.
@@ -688,6 +683,8 @@ void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>:
addPtr(Imm32(registerOffset * static_cast<int>(sizeof(Register))), callFrameRegister);
move(Imm32(argCount), regT1);
+ move(regT0, regT2);
+
m_callStructureStubCompilationInfo[callLinkInfoIndex].callReturnLocation = emitNakedCall(m_globalData->jitStubs.ctiVirtualCallLink());
// Put the return value in dst.
diff --git a/JavaScriptCore/jit/JITInlineMethods.h b/JavaScriptCore/jit/JITInlineMethods.h
index b5aaafc..f26457a 100644
--- a/JavaScriptCore/jit/JITInlineMethods.h
+++ b/JavaScriptCore/jit/JITInlineMethods.h
@@ -37,28 +37,37 @@ namespace JSC {
// puts an arg onto the stack, as an arg to a context threaded function.
ALWAYS_INLINE void JIT::emitPutJITStubArg(RegisterID src, unsigned argumentNumber)
{
- poke(src, argumentNumber);
+ unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + 1;
+ poke(src, argumentStackOffset);
}
/* Deprecated: Please use JITStubCall instead. */
ALWAYS_INLINE void JIT::emitPutJITStubArgConstant(unsigned value, unsigned argumentNumber)
{
- poke(Imm32(value), argumentNumber);
+ unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + 1;
+ poke(Imm32(value), argumentStackOffset);
}
/* Deprecated: Please use JITStubCall instead. */
ALWAYS_INLINE void JIT::emitPutJITStubArgConstant(void* value, unsigned argumentNumber)
{
- poke(ImmPtr(value), argumentNumber);
+ unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + 1;
+ poke(ImmPtr(value), argumentStackOffset);
}
/* Deprecated: Please use JITStubCall instead. */
ALWAYS_INLINE void JIT::emitGetJITStubArg(unsigned argumentNumber, RegisterID dst)
{
- peek(dst, argumentNumber);
+ unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + 1;
+ peek(dst, argumentStackOffset);
+}
+
+ALWAYS_INLINE bool JIT::isOperandConstantImmediateDouble(unsigned src)
+{
+ return m_codeBlock->isConstantRegisterIndex(src) && getConstantOperand(src).isDouble();
}
ALWAYS_INLINE JSValue JIT::getConstantOperand(unsigned src)
@@ -102,38 +111,71 @@ ALWAYS_INLINE JIT::Call JIT::emitNakedCall(CodePtr function)
return nakedCall;
}
-#if PLATFORM(X86) || PLATFORM(X86_64) || (PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7))
+#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
+
+ALWAYS_INLINE void JIT::beginUninterruptedSequence(int insnSpace, int constSpace)
+{
+#if PLATFORM(ARM_TRADITIONAL)
+#ifndef NDEBUG
+ // Ensure the label after the sequence can also fit
+ insnSpace += sizeof(ARMWord);
+ constSpace += sizeof(uint64_t);
+#endif
+
+ ensureSpace(insnSpace, constSpace);
+
+#endif
+
+#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
+#ifndef NDEBUG
+ m_uninterruptedInstructionSequenceBegin = label();
+ m_uninterruptedConstantSequenceBegin = sizeOfConstantPool();
+#endif
+#endif
+}
+
+ALWAYS_INLINE void JIT::endUninterruptedSequence(int insnSpace, int constSpace)
+{
+#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
+ ASSERT(differenceBetween(m_uninterruptedInstructionSequenceBegin, label()) == insnSpace);
+ ASSERT(sizeOfConstantPool() - m_uninterruptedConstantSequenceBegin == constSpace);
+#endif
+}
+
+#endif
+
+#if PLATFORM(ARM_THUMB2)
ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg)
{
- pop(reg);
+ move(linkRegister, reg);
}
ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg)
{
- push(reg);
+ move(reg, linkRegister);
}
ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address)
{
- push(address);
+ loadPtr(address, linkRegister);
}
-#elif PLATFORM_ARM_ARCH(7)
+#else // PLATFORM(X86) || PLATFORM(X86_64) || PLATFORM(ARM_TRADITIONAL)
ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg)
{
- move(linkRegister, reg);
+ pop(reg);
}
ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg)
{
- move(reg, linkRegister);
+ push(reg);
}
ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address)
{
- loadPtr(address, linkRegister);
+ push(address);
}
#endif
@@ -149,8 +191,8 @@ ALWAYS_INLINE void JIT::restoreArgumentReference()
{
move(stackPointerRegister, firstArgumentRegister);
poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*));
-#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)
- move(ctiReturnRegister, ARM::lr);
+#if PLATFORM(ARM_TRADITIONAL)
+ move(ctiReturnRegister, ARMRegisters::lr);
#endif
}
ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline()
@@ -158,7 +200,7 @@ ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline()
#if PLATFORM(X86)
// Within a trampoline the return address will be on the stack at this point.
addPtr(Imm32(sizeof(void*)), stackPointerRegister, firstArgumentRegister);
-#elif PLATFORM_ARM_ARCH(7)
+#elif PLATFORM(ARM_THUMB2)
move(stackPointerRegister, firstArgumentRegister);
#endif
// In the trampoline on x86-64, the first argument register is not overwritten.
@@ -242,8 +284,8 @@ ALWAYS_INLINE void JIT::emitCount(AbstractSamplingCounter& counter, uint32_t cou
#if PLATFORM(X86_64)
ALWAYS_INLINE void JIT::sampleInstruction(Instruction* instruction, bool inHostFunction)
{
- move(ImmPtr(m_interpreter->sampler()->sampleSlot()), X86::ecx);
- storePtr(ImmPtr(m_interpreter->sampler()->encodeSample(instruction, inHostFunction)), X86::ecx);
+ move(ImmPtr(m_interpreter->sampler()->sampleSlot()), X86Registers::ecx);
+ storePtr(ImmPtr(m_interpreter->sampler()->encodeSample(instruction, inHostFunction)), X86Registers::ecx);
}
#else
ALWAYS_INLINE void JIT::sampleInstruction(Instruction* instruction, bool inHostFunction)
@@ -257,8 +299,8 @@ ALWAYS_INLINE void JIT::sampleInstruction(Instruction* instruction, bool inHostF
#if PLATFORM(X86_64)
ALWAYS_INLINE void JIT::sampleCodeBlock(CodeBlock* codeBlock)
{
- move(ImmPtr(m_interpreter->sampler()->codeBlockSlot()), X86::ecx);
- storePtr(ImmPtr(codeBlock), X86::ecx);
+ move(ImmPtr(m_interpreter->sampler()->codeBlockSlot()), X86Registers::ecx);
+ storePtr(ImmPtr(codeBlock), X86Registers::ecx);
}
#else
ALWAYS_INLINE void JIT::sampleCodeBlock(CodeBlock* codeBlock)
@@ -268,6 +310,11 @@ ALWAYS_INLINE void JIT::sampleCodeBlock(CodeBlock* codeBlock)
#endif
#endif
+inline JIT::Address JIT::addressFor(unsigned index, RegisterID base)
+{
+ return Address(base, (index * sizeof(Register)));
+}
+
#if USE(JSVALUE32_64)
inline JIT::Address JIT::tagFor(unsigned index, RegisterID base)
@@ -280,11 +327,6 @@ inline JIT::Address JIT::payloadFor(unsigned index, RegisterID base)
return Address(base, (index * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.payload));
}
-inline JIT::Address JIT::addressFor(unsigned index, RegisterID base)
-{
- return Address(base, (index * sizeof(Register)));
-}
-
inline void JIT::emitLoadTag(unsigned index, RegisterID tag)
{
RegisterID mappedTag;
@@ -542,23 +584,28 @@ ALWAYS_INLINE bool JIT::getOperandConstantImmediateInt(unsigned op1, unsigned op
return false;
}
-ALWAYS_INLINE bool JIT::isOperandConstantImmediateDouble(unsigned src)
+/* Deprecated: Please use JITStubCall instead. */
+
+ALWAYS_INLINE void JIT::emitPutJITStubArg(RegisterID tag, RegisterID payload, unsigned argumentNumber)
{
- return m_codeBlock->isConstantRegisterIndex(src) && getConstantOperand(src).isDouble();
+ unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + 1;
+ poke(payload, argumentStackOffset);
+ poke(tag, argumentStackOffset + 1);
}
/* Deprecated: Please use JITStubCall instead. */
ALWAYS_INLINE void JIT::emitPutJITStubArgFromVirtualRegister(unsigned src, unsigned argumentNumber, RegisterID scratch1, RegisterID scratch2)
{
+ unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + 1;
if (m_codeBlock->isConstantRegisterIndex(src)) {
JSValue constant = m_codeBlock->getConstant(src);
- poke(Imm32(constant.payload()), argumentNumber);
- poke(Imm32(constant.tag()), argumentNumber + 1);
+ poke(Imm32(constant.payload()), argumentStackOffset);
+ poke(Imm32(constant.tag()), argumentStackOffset + 1);
} else {
emitLoad(src, scratch1, scratch2);
- poke(scratch2, argumentNumber);
- poke(scratch1, argumentNumber + 1);
+ poke(scratch2, argumentStackOffset);
+ poke(scratch1, argumentStackOffset + 1);
}
}
@@ -685,6 +732,24 @@ ALWAYS_INLINE JIT::Jump JIT::emitJumpIfNotImmediateNumber(RegisterID reg)
{
return branchTestPtr(Zero, reg, tagTypeNumberRegister);
}
+
+inline void JIT::emitLoadDouble(unsigned index, FPRegisterID value)
+{
+ if (m_codeBlock->isConstantRegisterIndex(index)) {
+ Register& inConstantPool = m_codeBlock->constantRegister(index);
+ loadDouble(&inConstantPool, value);
+ } else
+ loadDouble(addressFor(index), value);
+}
+
+inline void JIT::emitLoadInt32ToDouble(unsigned index, FPRegisterID value)
+{
+ if (m_codeBlock->isConstantRegisterIndex(index)) {
+ Register& inConstantPool = m_codeBlock->constantRegister(index);
+ convertInt32ToDouble(AbsoluteAddress(&inConstantPool), value);
+ } else
+ convertInt32ToDouble(addressFor(index), value);
+}
#endif
ALWAYS_INLINE JIT::Jump JIT::emitJumpIfImmediateInteger(RegisterID reg)
@@ -722,6 +787,11 @@ ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotImmediateIntegers(RegisterID reg1,
addSlowCase(emitJumpIfNotImmediateIntegers(reg1, reg2, scratch));
}
+ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotImmediateNumber(RegisterID reg)
+{
+ addSlowCase(emitJumpIfNotImmediateNumber(reg));
+}
+
#if !USE(JSVALUE64)
ALWAYS_INLINE void JIT::emitFastArithDeTagImmediate(RegisterID reg)
{
@@ -779,12 +849,13 @@ ALWAYS_INLINE void JIT::emitTagAsBoolImmediate(RegisterID reg)
// get arg puts an arg from the SF register array onto the stack, as an arg to a context threaded function.
ALWAYS_INLINE void JIT::emitPutJITStubArgFromVirtualRegister(unsigned src, unsigned argumentNumber, RegisterID scratch)
{
+ unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + 1;
if (m_codeBlock->isConstantRegisterIndex(src)) {
JSValue value = m_codeBlock->getConstant(src);
- emitPutJITStubArgConstant(JSValue::encode(value), argumentNumber);
+ poke(ImmPtr(JSValue::encode(value)), argumentStackOffset);
} else {
loadPtr(Address(callFrameRegister, src * sizeof(Register)), scratch);
- emitPutJITStubArg(scratch, argumentNumber);
+ poke(scratch, argumentStackOffset);
}
killLastResultRegister();
diff --git a/JavaScriptCore/jit/JITOpcodes.cpp b/JavaScriptCore/jit/JITOpcodes.cpp
index 13fc981..f362d75 100644
--- a/JavaScriptCore/jit/JITOpcodes.cpp
+++ b/JavaScriptCore/jit/JITOpcodes.cpp
@@ -64,90 +64,77 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
// (2) Trampolines for the slow cases of op_call / op_call_eval / op_construct.
#if ENABLE(JIT_OPTIMIZE_CALL)
- /* VirtualCallLink Trampoline */
+ // VirtualCallLink Trampoline
+ // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
Label virtualCallLinkBegin = align();
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
- // regT0 holds callee, regT1 holds argCount.
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_body)), regT2);
- loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionBodyNode, m_code)), regT2);
- Jump hasCodeBlock2 = branchTestPtr(NonZero, regT2);
+ Jump isNativeFunc2 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
- // Lazily generate a CodeBlock.
- preserveReturnAddressAfterCall(regT3); // return address
+ Jump hasCodeBlock2 = branch32(GreaterThan, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
+ preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
Call callJSFunction2 = call();
- move(regT0, regT2);
- emitGetJITStubArg(1, regT0); // callee
- emitGetJITStubArg(5, regT1); // argCount
- restoreReturnAddressBeforeReturn(regT3); // return address
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+ emitGetJITStubArg(2, regT1); // argCount
+ restoreReturnAddressBeforeReturn(regT3);
hasCodeBlock2.link(this);
- // regT2 holds codeBlock.
- Jump isNativeFunc2 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(CodeBlock, m_codeType)), Imm32(NativeCode));
-
// Check argCount matches callee arity.
- Jump arityCheckOkay2 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(CodeBlock, m_numParameters)), regT1);
+ Jump arityCheckOkay2 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), regT1);
preserveReturnAddressAfterCall(regT3);
- emitPutJITStubArg(regT3, 3); // return address
- emitPutJITStubArg(regT2, 7); // codeBlock
+ emitPutJITStubArg(regT3, 1); // return address
restoreArgumentReference();
Call callArityCheck2 = call();
move(regT1, callFrameRegister);
- emitGetJITStubArg(1, regT0); // callee
- emitGetJITStubArg(5, regT1); // argCount
- restoreReturnAddressBeforeReturn(regT3); // return address
-
+ emitGetJITStubArg(2, regT1); // argCount
+ restoreReturnAddressBeforeReturn(regT3);
arityCheckOkay2.link(this);
+
isNativeFunc2.link(this);
compileOpCallInitializeCallFrame();
preserveReturnAddressAfterCall(regT3);
- emitPutJITStubArg(regT3, 3);
+ emitPutJITStubArg(regT3, 1); // return address
restoreArgumentReference();
Call callLazyLinkCall = call();
restoreReturnAddressBeforeReturn(regT3);
jump(regT0);
#endif // ENABLE(JIT_OPTIMIZE_CALL)
- /* VirtualCall Trampoline */
+ // VirtualCall Trampoline
+ // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
Label virtualCallBegin = align();
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
- // regT0 holds callee, regT1 holds argCount.
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_body)), regT2);
- loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionBodyNode, m_code)), regT2);
- Jump hasCodeBlock3 = branchTestPtr(NonZero, regT2);
+ Jump isNativeFunc3 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
- // Lazily generate a CodeBlock.
- preserveReturnAddressAfterCall(regT3); // return address
+ Jump hasCodeBlock3 = branch32(GreaterThan, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
+ preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
Call callJSFunction1 = call();
- move(regT0, regT2);
- emitGetJITStubArg(1, regT0); // callee
- emitGetJITStubArg(5, regT1); // argCount
- restoreReturnAddressBeforeReturn(regT3); // return address
+ emitGetJITStubArg(2, regT1); // argCount
+ restoreReturnAddressBeforeReturn(regT3);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
hasCodeBlock3.link(this);
- // regT2 holds codeBlock.
- Jump isNativeFunc3 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(CodeBlock, m_codeType)), Imm32(NativeCode));
-
- // Check argCount matches callee.
- Jump arityCheckOkay3 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(CodeBlock, m_numParameters)), regT1);
+ // Check argCount matches callee arity.
+ Jump arityCheckOkay3 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), regT1);
preserveReturnAddressAfterCall(regT3);
- emitPutJITStubArg(regT3, 3); // return address
- emitPutJITStubArg(regT2, 7); // codeBlock
+ emitPutJITStubArg(regT3, 1); // return address
restoreArgumentReference();
Call callArityCheck1 = call();
move(regT1, callFrameRegister);
- emitGetJITStubArg(1, regT0); // callee
- emitGetJITStubArg(5, regT1); // argCount
- restoreReturnAddressBeforeReturn(regT3); // return address
-
+ emitGetJITStubArg(2, regT1); // argCount
+ restoreReturnAddressBeforeReturn(regT3);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
arityCheckOkay3.link(this);
+
isNativeFunc3.link(this);
+
compileOpCallInitializeCallFrame();
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_body)), regT0);
- loadPtr(Address(regT0, OBJECT_OFFSETOF(FunctionBodyNode, m_jitCode)), regT0);
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_jitCode)), regT0);
jump(regT0);
#if PLATFORM(X86)
@@ -237,23 +224,23 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
#if COMPILER(MSVC) || PLATFORM(LINUX)
// ArgList is passed by reference so is stackPointerRegister + 4 * sizeof(Register)
- addPtr(Imm32(OBJECT_OFFSETOF(NativeCallFrameStructure, result)), stackPointerRegister, X86::ecx);
+ addPtr(Imm32(OBJECT_OFFSETOF(NativeCallFrameStructure, result)), stackPointerRegister, X86Registers::ecx);
// Plant callee
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86::eax);
- storePtr(X86::eax, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, callee)));
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::eax);
+ storePtr(X86Registers::eax, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, callee)));
// Plant callframe
- move(callFrameRegister, X86::edx);
+ move(callFrameRegister, X86Registers::edx);
- call(Address(X86::eax, OBJECT_OFFSETOF(JSFunction, m_data)));
+ call(Address(X86Registers::eax, OBJECT_OFFSETOF(JSFunction, m_data)));
// JSValue is a non-POD type, so eax points to it
- emitLoad(0, regT1, regT0, X86::eax);
+ emitLoad(0, regT1, regT0, X86Registers::eax);
#else
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86::edx); // callee
- move(callFrameRegister, X86::ecx); // callFrame
- call(Address(X86::edx, OBJECT_OFFSETOF(JSFunction, m_data)));
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::edx); // callee
+ move(callFrameRegister, X86Registers::ecx); // callFrame
+ call(Address(X86Registers::edx, OBJECT_OFFSETOF(JSFunction, m_data)));
#endif
// We've put a few temporaries on the stack in addition to the actual arguments
@@ -261,10 +248,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
addPtr(Imm32(NativeCallFrameSize - sizeof(NativeFunctionCalleeSignature)), stackPointerRegister);
// Check for an exception
- // FIXME: Maybe we can optimize this comparison to JSValue().
move(ImmPtr(&globalData->exception), regT2);
- Jump sawException1 = branch32(NotEqual, tagFor(0, regT2), Imm32(JSValue::CellTag));
- Jump sawException2 = branch32(NonZero, payloadFor(0, regT2), Imm32(0));
+ Jump sawException = branch32(NotEqual, tagFor(0, regT2), Imm32(JSValue::EmptyValueTag));
// Grab the return address.
emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT3);
@@ -277,8 +262,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
ret();
// Handle an exception
- sawException1.link(this);
- sawException2.link(this);
+ sawException.link(this);
// Grab the return address.
emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1);
move(ImmPtr(&globalData->exceptionLocation), regT2);
@@ -544,7 +528,7 @@ void JIT::emitSlow_op_instanceof(Instruction* currentInstruction, Vector<SlowCas
void JIT::emit_op_new_func(Instruction* currentInstruction)
{
JITStubCall stubCall(this, cti_op_new_func);
- stubCall.addArgument(ImmPtr(m_codeBlock->function(currentInstruction[2].u.operand)));
+ stubCall.addArgument(ImmPtr(m_codeBlock->functionDecl(currentInstruction[2].u.operand)));
stubCall.call(currentInstruction[1].u.operand);
}
@@ -807,14 +791,17 @@ void JIT::emit_op_jfalse(Instruction* currentInstruction)
Jump isTrue2 = branch32(NotEqual, regT0, Imm32(0));
addJump(jump(), target + 2);
- isNotInteger.link(this);
+ if (supportsFloatingPoint()) {
+ isNotInteger.link(this);
- addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag)));
+ addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag)));
+
+ zeroDouble(fpRegT0);
+ emitLoadDouble(cond, fpRegT1);
+ addJump(branchDouble(DoubleEqual, fpRegT0, fpRegT1), target + 2);
+ } else
+ addSlowCase(isNotInteger);
- zeroDouble(fpRegT0);
- emitLoadDouble(cond, fpRegT1);
- addJump(branchDouble(DoubleEqual, fpRegT0, fpRegT1), target + 2);
-
isTrue.link(this);
isTrue2.link(this);
}
@@ -845,14 +832,17 @@ void JIT::emit_op_jtrue(Instruction* currentInstruction)
Jump isFalse2 = branch32(Equal, regT0, Imm32(0));
addJump(jump(), target + 2);
- isNotInteger.link(this);
+ if (supportsFloatingPoint()) {
+ isNotInteger.link(this);
- addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag)));
+ addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag)));
+
+ zeroDouble(fpRegT0);
+ emitLoadDouble(cond, fpRegT1);
+ addJump(branchDouble(DoubleNotEqual, fpRegT0, fpRegT1), target + 2);
+ } else
+ addSlowCase(isNotInteger);
- zeroDouble(fpRegT0);
- emitLoadDouble(cond, fpRegT1);
- addJump(branchDouble(DoubleNotEqual, fpRegT0, fpRegT1), target + 2);
-
isFalse.link(this);
isFalse2.link(this);
}
@@ -1180,7 +1170,7 @@ void JIT::emit_op_resolve_with_base(Instruction* currentInstruction)
void JIT::emit_op_new_func_exp(Instruction* currentInstruction)
{
JITStubCall stubCall(this, cti_op_new_func_exp);
- stubCall.addArgument(ImmPtr(m_codeBlock->functionExpression(currentInstruction[2].u.operand)));
+ stubCall.addArgument(ImmPtr(m_codeBlock->functionExpr(currentInstruction[2].u.operand)));
stubCall.call(currentInstruction[1].u.operand);
}
@@ -1244,7 +1234,7 @@ void JIT::emit_op_to_jsnumber(Instruction* currentInstruction)
emitLoad(src, regT1, regT0);
Jump isInt32 = branch32(Equal, regT1, Imm32(JSValue::Int32Tag));
- addSlowCase(branch32(AboveOrEqual, regT1, Imm32(JSValue::DeletedValueTag)));
+ addSlowCase(branch32(AboveOrEqual, regT1, Imm32(JSValue::EmptyValueTag)));
isInt32.link(this);
if (src != dst)
@@ -1388,8 +1378,7 @@ void JIT::emit_op_enter_with_activation(Instruction* currentInstruction)
void JIT::emit_op_create_arguments(Instruction*)
{
- Jump argsNotCell = branch32(NotEqual, tagFor(RegisterFile::ArgumentsRegister, callFrameRegister), Imm32(JSValue::CellTag));
- Jump argsNotNull = branchTestPtr(NonZero, payloadFor(RegisterFile::ArgumentsRegister, callFrameRegister));
+ Jump argsCreated = branch32(NotEqual, tagFor(RegisterFile::ArgumentsRegister, callFrameRegister), Imm32(JSValue::EmptyValueTag));
// If we get here the arguments pointer is a null cell - i.e. arguments need lazy creation.
if (m_codeBlock->m_numParameters == 1)
@@ -1397,8 +1386,7 @@ void JIT::emit_op_create_arguments(Instruction*)
else
JITStubCall(this, cti_op_create_arguments).call();
- argsNotCell.link(this);
- argsNotNull.link(this);
+ argsCreated.link(this);
}
void JIT::emit_op_init_arguments(Instruction*)
@@ -1484,85 +1472,77 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
// (3) Trampolines for the slow cases of op_call / op_call_eval / op_construct.
COMPILE_ASSERT(sizeof(CodeType) == 4, CodeTypeEnumMustBe32Bit);
+ // VirtualCallLink Trampoline
+ // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
Label virtualCallLinkBegin = align();
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
- // Load the callee CodeBlock* into eax
- loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_body)), regT3);
- loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionBodyNode, m_code)), regT0);
- Jump hasCodeBlock2 = branchTestPtr(NonZero, regT0);
+ Jump isNativeFunc2 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
+
+ Jump hasCodeBlock2 = branch32(GreaterThan, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
Call callJSFunction2 = call();
- emitGetJITStubArg(1, regT2);
- emitGetJITStubArg(3, regT1);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+ emitGetJITStubArg(2, regT1); // argCount
restoreReturnAddressBeforeReturn(regT3);
hasCodeBlock2.link(this);
- Jump isNativeFunc2 = branch32(Equal, Address(regT0, OBJECT_OFFSETOF(CodeBlock, m_codeType)), Imm32(NativeCode));
-
// Check argCount matches callee arity.
- Jump arityCheckOkay2 = branch32(Equal, Address(regT0, OBJECT_OFFSETOF(CodeBlock, m_numParameters)), regT1);
+ Jump arityCheckOkay2 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), regT1);
preserveReturnAddressAfterCall(regT3);
- emitPutJITStubArg(regT3, 2);
- emitPutJITStubArg(regT0, 4);
+ emitPutJITStubArg(regT3, 1); // return address
restoreArgumentReference();
Call callArityCheck2 = call();
move(regT1, callFrameRegister);
- emitGetJITStubArg(1, regT2);
- emitGetJITStubArg(3, regT1);
+ emitGetJITStubArg(2, regT1); // argCount
restoreReturnAddressBeforeReturn(regT3);
arityCheckOkay2.link(this);
+
isNativeFunc2.link(this);
compileOpCallInitializeCallFrame();
-
preserveReturnAddressAfterCall(regT3);
- emitPutJITStubArg(regT3, 2);
+ emitPutJITStubArg(regT3, 1); // return address
restoreArgumentReference();
Call callLazyLinkCall = call();
restoreReturnAddressBeforeReturn(regT3);
-
jump(regT0);
+ // VirtualCall Trampoline
+ // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
Label virtualCallBegin = align();
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
- // Load the callee CodeBlock* into eax
- loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_body)), regT3);
- loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionBodyNode, m_code)), regT0);
- Jump hasCodeBlock3 = branchTestPtr(NonZero, regT0);
+ Jump isNativeFunc3 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
+
+ Jump hasCodeBlock3 = branch32(GreaterThan, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
Call callJSFunction1 = call();
- emitGetJITStubArg(1, regT2);
- emitGetJITStubArg(3, regT1);
+ emitGetJITStubArg(2, regT1); // argCount
restoreReturnAddressBeforeReturn(regT3);
- loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_body)), regT3); // reload the function body nody, so we can reload the code pointer.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
hasCodeBlock3.link(this);
- Jump isNativeFunc3 = branch32(Equal, Address(regT0, OBJECT_OFFSETOF(CodeBlock, m_codeType)), Imm32(NativeCode));
-
// Check argCount matches callee arity.
- Jump arityCheckOkay3 = branch32(Equal, Address(regT0, OBJECT_OFFSETOF(CodeBlock, m_numParameters)), regT1);
+ Jump arityCheckOkay3 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), regT1);
preserveReturnAddressAfterCall(regT3);
- emitPutJITStubArg(regT3, 2);
- emitPutJITStubArg(regT0, 4);
+ emitPutJITStubArg(regT3, 1); // return address
restoreArgumentReference();
Call callArityCheck1 = call();
move(regT1, callFrameRegister);
- emitGetJITStubArg(1, regT2);
- emitGetJITStubArg(3, regT1);
+ emitGetJITStubArg(2, regT1); // argCount
restoreReturnAddressBeforeReturn(regT3);
- loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_body)), regT3); // reload the function body nody, so we can reload the code pointer.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
arityCheckOkay3.link(this);
+
isNativeFunc3.link(this);
- // load ctiCode from the new codeBlock.
- loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionBodyNode, m_jitCode)), regT0);
-
compileOpCallInitializeCallFrame();
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_jitCode)), regT0);
jump(regT0);
-
Label nativeCallThunk = align();
preserveReturnAddressAfterCall(regT0);
emitPutToCallFrameHeader(regT0, RegisterFile::ReturnPC); // Push return address
@@ -1575,39 +1555,39 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
#if PLATFORM(X86_64)
- emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, X86::ecx);
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, X86Registers::ecx);
// Allocate stack space for our arglist
subPtr(Imm32(sizeof(ArgList)), stackPointerRegister);
COMPILE_ASSERT((sizeof(ArgList) & 0xf) == 0, ArgList_should_by_16byte_aligned);
// Set up arguments
- subPtr(Imm32(1), X86::ecx); // Don't include 'this' in argcount
+ subPtr(Imm32(1), X86Registers::ecx); // Don't include 'this' in argcount
// Push argcount
- storePtr(X86::ecx, Address(stackPointerRegister, OBJECT_OFFSETOF(ArgList, m_argCount)));
+ storePtr(X86Registers::ecx, Address(stackPointerRegister, OBJECT_OFFSETOF(ArgList, m_argCount)));
// Calculate the start of the callframe header, and store in edx
- addPtr(Imm32(-RegisterFile::CallFrameHeaderSize * (int32_t)sizeof(Register)), callFrameRegister, X86::edx);
+ addPtr(Imm32(-RegisterFile::CallFrameHeaderSize * (int32_t)sizeof(Register)), callFrameRegister, X86Registers::edx);
// Calculate start of arguments as callframe header - sizeof(Register) * argcount (ecx)
- mul32(Imm32(sizeof(Register)), X86::ecx, X86::ecx);
- subPtr(X86::ecx, X86::edx);
+ mul32(Imm32(sizeof(Register)), X86Registers::ecx, X86Registers::ecx);
+ subPtr(X86Registers::ecx, X86Registers::edx);
// push pointer to arguments
- storePtr(X86::edx, Address(stackPointerRegister, OBJECT_OFFSETOF(ArgList, m_args)));
+ storePtr(X86Registers::edx, Address(stackPointerRegister, OBJECT_OFFSETOF(ArgList, m_args)));
// ArgList is passed by reference so is stackPointerRegister
- move(stackPointerRegister, X86::ecx);
+ move(stackPointerRegister, X86Registers::ecx);
// edx currently points to the first argument, edx-sizeof(Register) points to 'this'
- loadPtr(Address(X86::edx, -(int32_t)sizeof(Register)), X86::edx);
+ loadPtr(Address(X86Registers::edx, -(int32_t)sizeof(Register)), X86Registers::edx);
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86::esi);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::esi);
- move(callFrameRegister, X86::edi);
+ move(callFrameRegister, X86Registers::edi);
- call(Address(X86::esi, OBJECT_OFFSETOF(JSFunction, m_data)));
+ call(Address(X86Registers::esi, OBJECT_OFFSETOF(JSFunction, m_data)));
addPtr(Imm32(sizeof(ArgList)), stackPointerRegister);
#elif PLATFORM(X86)
@@ -1676,33 +1656,33 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
#if COMPILER(MSVC) || PLATFORM(LINUX)
// ArgList is passed by reference so is stackPointerRegister + 4 * sizeof(Register)
- addPtr(Imm32(OBJECT_OFFSETOF(NativeCallFrameStructure, result)), stackPointerRegister, X86::ecx);
+ addPtr(Imm32(OBJECT_OFFSETOF(NativeCallFrameStructure, result)), stackPointerRegister, X86Registers::ecx);
// Plant callee
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86::eax);
- storePtr(X86::eax, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, callee)));
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::eax);
+ storePtr(X86Registers::eax, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, callee)));
// Plant callframe
- move(callFrameRegister, X86::edx);
+ move(callFrameRegister, X86Registers::edx);
- call(Address(X86::eax, OBJECT_OFFSETOF(JSFunction, m_data)));
+ call(Address(X86Registers::eax, OBJECT_OFFSETOF(JSFunction, m_data)));
// JSValue is a non-POD type
- loadPtr(Address(X86::eax), X86::eax);
+ loadPtr(Address(X86Registers::eax), X86Registers::eax);
#else
// Plant callee
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86::edx);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::edx);
// Plant callframe
- move(callFrameRegister, X86::ecx);
- call(Address(X86::edx, OBJECT_OFFSETOF(JSFunction, m_data)));
+ move(callFrameRegister, X86Registers::ecx);
+ call(Address(X86Registers::edx, OBJECT_OFFSETOF(JSFunction, m_data)));
#endif
// We've put a few temporaries on the stack in addition to the actual arguments
// so pull them off now
addPtr(Imm32(NativeCallFrameSize - sizeof(NativeFunctionCalleeSignature)), stackPointerRegister);
-#elif PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)
+#elif PLATFORM(ARM_TRADITIONAL)
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
// Allocate stack space for our arglist
@@ -1736,9 +1716,9 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
move(callFrameRegister, regT0);
// Setup arg4: This is a plain hack
- move(stackPointerRegister, ARM::S0);
+ move(stackPointerRegister, ARMRegisters::S0);
- move(ctiReturnRegister, ARM::lr);
+ move(ctiReturnRegister, ARMRegisters::lr);
call(Address(regT1, OBJECT_OFFSETOF(JSFunction, m_data)));
addPtr(Imm32(sizeof(ArgList)), stackPointerRegister);
@@ -1971,7 +1951,7 @@ void JIT::emit_op_instanceof(Instruction* currentInstruction)
void JIT::emit_op_new_func(Instruction* currentInstruction)
{
JITStubCall stubCall(this, cti_op_new_func);
- stubCall.addArgument(ImmPtr(m_codeBlock->function(currentInstruction[2].u.operand)));
+ stubCall.addArgument(ImmPtr(m_codeBlock->functionDecl(currentInstruction[2].u.operand)));
stubCall.call(currentInstruction[1].u.operand);
}
@@ -2325,7 +2305,7 @@ void JIT::emit_op_resolve_with_base(Instruction* currentInstruction)
void JIT::emit_op_new_func_exp(Instruction* currentInstruction)
{
JITStubCall stubCall(this, cti_op_new_func_exp);
- stubCall.addArgument(ImmPtr(m_codeBlock->functionExpression(currentInstruction[2].u.operand)));
+ stubCall.addArgument(ImmPtr(m_codeBlock->functionExpr(currentInstruction[2].u.operand)));
stubCall.call(currentInstruction[1].u.operand);
}
@@ -2711,32 +2691,20 @@ void JIT::emitSlow_op_to_primitive(Instruction* currentInstruction, Vector<SlowC
void JIT::emitSlow_op_get_by_val(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
{
- // The slow void JIT::emitSlow_that handles accesses to arrays (below) may jump back up to here.
- Label beginGetByValSlow(this);
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned base = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
- Jump notImm = getSlowCase(iter);
- linkSlowCase(iter);
- linkSlowCase(iter);
- emitFastArithIntToImmNoCheck(regT1, regT1);
+ linkSlowCase(iter); // property int32 check
+ linkSlowCaseIfNotJSCell(iter, base); // base cell check
+ linkSlowCase(iter); // base array check
+ linkSlowCase(iter); // vector length check
+ linkSlowCase(iter); // empty value
- notImm.link(this);
JITStubCall stubCall(this, cti_op_get_by_val);
- stubCall.addArgument(regT0);
- stubCall.addArgument(regT1);
- stubCall.call(currentInstruction[1].u.operand);
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_get_by_val));
-
- // This is slow void JIT::emitSlow_that handles accesses to arrays above the fast cut-off.
- // First, check if this is an access to the vector
- linkSlowCase(iter);
- branch32(AboveOrEqual, regT1, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_vectorLength)), beginGetByValSlow);
-
- // okay, missed the fast region, but it is still in the vector. Get the value.
- loadPtr(BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), regT2);
- // Check whether the value loaded is zero; if so we need to return undefined.
- branchTestPtr(Zero, regT2, beginGetByValSlow);
- move(regT2, regT0);
- emitPutVirtualRegister(currentInstruction[1].u.operand, regT0);
+ stubCall.addArgument(base, regT2);
+ stubCall.addArgument(property, regT2);
+ stubCall.call(dst);
}
void JIT::emitSlow_op_loop_if_less(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
@@ -2793,30 +2761,20 @@ void JIT::emitSlow_op_loop_if_lesseq(Instruction* currentInstruction, Vector<Slo
void JIT::emitSlow_op_put_by_val(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
{
- // Normal slow cases - either is not an immediate imm, or is an array.
- Jump notImm = getSlowCase(iter);
- linkSlowCase(iter);
- linkSlowCase(iter);
- emitFastArithIntToImmNoCheck(regT1, regT1);
+ unsigned base = currentInstruction[1].u.operand;
+ unsigned property = currentInstruction[2].u.operand;
+ unsigned value = currentInstruction[3].u.operand;
- notImm.link(this); {
- JITStubCall stubCall(this, cti_op_put_by_val);
- stubCall.addArgument(regT0);
- stubCall.addArgument(regT1);
- stubCall.addArgument(currentInstruction[3].u.operand, regT2);
- stubCall.call();
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_put_by_val));
- }
+ linkSlowCase(iter); // property int32 check
+ linkSlowCaseIfNotJSCell(iter, base); // base cell check
+ linkSlowCase(iter); // base not array check
+ linkSlowCase(iter); // in vector check
- // slow cases for immediate int accesses to arrays
- linkSlowCase(iter);
- linkSlowCase(iter); {
- JITStubCall stubCall(this, cti_op_put_by_val_array);
- stubCall.addArgument(regT0);
- stubCall.addArgument(regT1);
- stubCall.addArgument(currentInstruction[3].u.operand, regT2);
- stubCall.call();
- }
+ JITStubCall stubPutByValCall(this, cti_op_put_by_val);
+ stubPutByValCall.addArgument(regT0);
+ stubPutByValCall.addArgument(property, regT2);
+ stubPutByValCall.addArgument(value, regT2);
+ stubPutByValCall.call();
}
void JIT::emitSlow_op_loop_if_true(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
diff --git a/JavaScriptCore/jit/JITPropertyAccess.cpp b/JavaScriptCore/jit/JITPropertyAccess.cpp
index 9dba2e2..9edfd01 100644
--- a/JavaScriptCore/jit/JITPropertyAccess.cpp
+++ b/JavaScriptCore/jit/JITPropertyAccess.cpp
@@ -273,11 +273,14 @@ void JIT::emit_op_get_by_val(Instruction* currentInstruction)
addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
emitJumpSlowCaseIfNotJSCell(base, regT1);
addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr)));
- addSlowCase(branch32(AboveOrEqual, regT2, Address(regT0, OBJECT_OFFSETOF(JSArray, m_fastAccessCutoff))));
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT0);
- load32(BaseIndex(regT0, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4), regT1); // tag
- load32(BaseIndex(regT0, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), regT0); // payload
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT3);
+ addSlowCase(branch32(AboveOrEqual, regT2, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength))));
+
+ load32(BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4), regT1); // tag
+ load32(BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), regT0); // payload
+ addSlowCase(branch32(Equal, regT1, Imm32(JSValue::EmptyValueTag)));
+
emitStore(dst, regT1, regT0);
map(m_bytecodeIndex + OPCODE_LENGTH(op_get_by_val), dst, regT1, regT0);
}
@@ -288,35 +291,16 @@ void JIT::emitSlow_op_get_by_val(Instruction* currentInstruction, Vector<SlowCas
unsigned base = currentInstruction[2].u.operand;
unsigned property = currentInstruction[3].u.operand;
- // The slow void JIT::emitSlow_that handles accesses to arrays (below) may jump back up to here.
- Label callGetByValJITStub(this);
-
linkSlowCase(iter); // property int32 check
linkSlowCaseIfNotJSCell(iter, base); // base cell check
linkSlowCase(iter); // base array check
+ linkSlowCase(iter); // vector length check
+ linkSlowCase(iter); // empty value
JITStubCall stubCall(this, cti_op_get_by_val);
stubCall.addArgument(base);
stubCall.addArgument(property);
stubCall.call(dst);
-
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_get_by_val));
-
- linkSlowCase(iter); // array fast cut-off check
-
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT0);
- branch32(AboveOrEqual, regT2, Address(regT0, OBJECT_OFFSETOF(ArrayStorage, m_vectorLength)), callGetByValJITStub);
-
- // Missed the fast region, but it is still in the vector.
- load32(BaseIndex(regT0, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4), regT1); // tag
- load32(BaseIndex(regT0, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), regT0); // payload
-
- // FIXME: Maybe we can optimize this comparison to JSValue().
- Jump skip = branch32(NotEqual, regT0, Imm32(0));
- branch32(Equal, regT1, Imm32(JSValue::CellTag), callGetByValJITStub);
-
- skip.link(this);
- emitStore(dst, regT1, regT0);
}
void JIT::emit_op_put_by_val(Instruction* currentInstruction)
@@ -330,24 +314,27 @@ void JIT::emit_op_put_by_val(Instruction* currentInstruction)
addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
emitJumpSlowCaseIfNotJSCell(base, regT1);
addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr)));
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT3);
-
- Jump inFastVector = branch32(Below, regT2, Address(regT0, OBJECT_OFFSETOF(JSArray, m_fastAccessCutoff)));
+ addSlowCase(branch32(AboveOrEqual, regT2, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength))));
- // Check if the access is within the vector.
- addSlowCase(branch32(AboveOrEqual, regT2, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_vectorLength))));
-
- // This is a write to the slow part of the vector; first, we have to check if this would be the first write to this location.
- // FIXME: should be able to handle initial write to array; increment the the number of items in the array, and potentially update fast access cutoff.
- Jump skip = branch32(NotEqual, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4), Imm32(JSValue::CellTag));
- addSlowCase(branch32(Equal, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), Imm32(0)));
- skip.link(this);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT3);
- inFastVector.link(this);
+ Jump empty = branch32(Equal, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4), Imm32(JSValue::EmptyValueTag));
+ Label storeResult(this);
emitLoad(value, regT1, regT0);
store32(regT0, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); // payload
store32(regT1, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4)); // tag
+ Jump end = jump();
+
+ empty.link(this);
+ add32(Imm32(1), Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector)));
+ branch32(Below, regT2, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length))).linkTo(storeResult, this);
+
+ add32(Imm32(1), regT2, regT0);
+ store32(regT0, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length)));
+ jump().linkTo(storeResult, this);
+
+ end.link(this);
}
void JIT::emitSlow_op_put_by_val(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
@@ -359,24 +346,13 @@ void JIT::emitSlow_op_put_by_val(Instruction* currentInstruction, Vector<SlowCas
linkSlowCase(iter); // property int32 check
linkSlowCaseIfNotJSCell(iter, base); // base cell check
linkSlowCase(iter); // base not array check
+ linkSlowCase(iter); // in vector check
JITStubCall stubPutByValCall(this, cti_op_put_by_val);
stubPutByValCall.addArgument(base);
stubPutByValCall.addArgument(property);
stubPutByValCall.addArgument(value);
stubPutByValCall.call();
-
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_get_by_val));
-
- // Slow cases for immediate int accesses to arrays.
- linkSlowCase(iter); // in vector check
- linkSlowCase(iter); // written to slot check
-
- JITStubCall stubCall(this, cti_op_put_by_val_array);
- stubCall.addArgument(regT1, regT0);
- stubCall.addArgument(regT2);
- stubCall.addArgument(value);
- stubCall.call();
}
void JIT::emit_op_get_by_id(Instruction* currentInstruction)
@@ -958,12 +934,16 @@ void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* str
void JIT::emit_op_get_by_val(Instruction* currentInstruction)
{
- emitGetVirtualRegisters(currentInstruction[2].u.operand, regT0, currentInstruction[3].u.operand, regT1);
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned base = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
+
+ emitGetVirtualRegisters(base, regT0, property, regT1);
emitJumpSlowCaseIfNotImmediateInteger(regT1);
#if USE(JSVALUE64)
// This is technically incorrect - we're zero-extending an int32. On the hot path this doesn't matter.
- // We check the value as if it was a uint32 against the m_fastAccessCutoff - which will always fail if
- // number was signed since m_fastAccessCutoff is always less than intmax (since the total allocation
+ // We check the value as if it was a uint32 against the m_vectorLength - which will always fail if
+ // number was signed since m_vectorLength is always less than intmax (since the total allocation
// size is always less than 4Gb). As such zero extending wil have been correct (and extending the value
// to 64-bits is necessary since it's used in the address calculation. We zero extend rather than sign
// extending since it makes it easier to re-tag the value in the slow case.
@@ -971,21 +951,25 @@ void JIT::emit_op_get_by_val(Instruction* currentInstruction)
#else
emitFastArithImmToInt(regT1);
#endif
- emitJumpSlowCaseIfNotJSCell(regT0);
+ emitJumpSlowCaseIfNotJSCell(regT0, base);
addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr)));
- // This is an array; get the m_storage pointer into ecx, then check if the index is below the fast cutoff
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT2);
- addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, OBJECT_OFFSETOF(JSArray, m_fastAccessCutoff))));
+ addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength))));
- // Get the value from the vector
loadPtr(BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), regT0);
- emitPutVirtualRegister(currentInstruction[1].u.operand);
+ addSlowCase(branchTestPtr(Zero, regT0));
+
+ emitPutVirtualRegister(dst);
}
void JIT::emit_op_put_by_val(Instruction* currentInstruction)
{
- emitGetVirtualRegisters(currentInstruction[1].u.operand, regT0, currentInstruction[2].u.operand, regT1);
+ unsigned base = currentInstruction[1].u.operand;
+ unsigned property = currentInstruction[2].u.operand;
+ unsigned value = currentInstruction[3].u.operand;
+
+ emitGetVirtualRegisters(base, regT0, property, regT1);
emitJumpSlowCaseIfNotImmediateInteger(regT1);
#if USE(JSVALUE64)
// See comment in op_get_by_val.
@@ -993,23 +977,29 @@ void JIT::emit_op_put_by_val(Instruction* currentInstruction)
#else
emitFastArithImmToInt(regT1);
#endif
- emitJumpSlowCaseIfNotJSCell(regT0);
+ emitJumpSlowCaseIfNotJSCell(regT0, base);
addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr)));
+ addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength))));
- // This is an array; get the m_storage pointer into ecx, then check if the index is below the fast cutoff
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT2);
- Jump inFastVector = branch32(Below, regT1, Address(regT0, OBJECT_OFFSETOF(JSArray, m_fastAccessCutoff)));
- // No; oh well, check if the access if within the vector - if so, we may still be okay.
- addSlowCase(branch32(AboveOrEqual, regT1, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_vectorLength))));
- // This is a write to the slow part of the vector; first, we have to check if this would be the first write to this location.
- // FIXME: should be able to handle initial write to array; increment the the number of items in the array, and potentially update fast access cutoff.
- addSlowCase(branchTestPtr(Zero, BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))));
+ Jump empty = branchTestPtr(Zero, BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])));
- // All good - put the value into the array.
- inFastVector.link(this);
- emitGetVirtualRegister(currentInstruction[3].u.operand, regT0);
+ Label storeResult(this);
+ emitGetVirtualRegister(value, regT0);
storePtr(regT0, BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])));
+ Jump end = jump();
+
+ empty.link(this);
+ add32(Imm32(1), Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector)));
+ branch32(Below, regT1, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length))).linkTo(storeResult, this);
+
+ move(regT1, regT0);
+ add32(Imm32(1), regT0);
+ store32(regT0, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length)));
+ jump().linkTo(storeResult, this);
+
+ end.link(this);
}
void JIT::emit_op_put_by_index(Instruction* currentInstruction)
@@ -1122,13 +1112,20 @@ void JIT::emit_op_method_check(Instruction* currentInstruction)
// Do the method check - check the object & its prototype's structure inline (this is the common case).
m_methodCallCompilationInfo.append(MethodCallCompilationInfo(m_propertyAccessInstructionIndex));
MethodCallCompilationInfo& info = m_methodCallCompilationInfo.last();
+
Jump notCell = emitJumpIfNotJSCell(regT0);
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceMethodCheck);
+
Jump structureCheck = branchPtrWithPatch(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), info.structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
DataLabelPtr protoStructureToCompare, protoObj = moveWithPatch(ImmPtr(0), regT1);
Jump protoStructureCheck = branchPtrWithPatch(NotEqual, Address(regT1, OBJECT_OFFSETOF(JSCell, m_structure)), protoStructureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
// This will be relinked to load the function without doing a load.
DataLabelPtr putFunction = moveWithPatch(ImmPtr(0), regT0);
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceMethodCheck);
+
Jump match = jump();
ASSERT(differenceBetween(info.structureToCompare, protoObj) == patchOffsetMethodCheckProtoObj);
@@ -1192,6 +1189,8 @@ void JIT::compileGetByIdHotPath(int, int baseVReg, Identifier*, unsigned propert
emitJumpSlowCaseIfNotJSCell(regT0, baseVReg);
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceGetByIdHotPath);
+
Label hotPathBegin(this);
m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].hotPathBegin = hotPathBegin;
@@ -1210,6 +1209,9 @@ void JIT::compileGetByIdHotPath(int, int baseVReg, Identifier*, unsigned propert
ASSERT(differenceBetween(hotPathBegin, displacementLabel) == patchOffsetGetByIdPropertyMapOffset);
Label putResult(this);
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdHotPath);
+
ASSERT(differenceBetween(hotPathBegin, putResult) == patchOffsetGetByIdPutResult);
}
@@ -1233,6 +1235,8 @@ void JIT::compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident
linkSlowCaseIfNotJSCell(iter, baseVReg);
linkSlowCase(iter);
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceGetByIdSlowCase);
+
#ifndef NDEBUG
Label coldPathBegin(this);
#endif
@@ -1241,6 +1245,8 @@ void JIT::compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident
stubCall.addArgument(ImmPtr(ident));
Call call = stubCall.call(resultVReg);
+ END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdSlowCase);
+
ASSERT(differenceBetween(coldPathBegin, call) == patchOffsetGetByIdSlowCaseCall);
// Track the location of the call; this will be used to recover patch information.
@@ -1264,6 +1270,8 @@ void JIT::emit_op_put_by_id(Instruction* currentInstruction)
// Jump to a slow case if either the base object is an immediate, or if the Structure does not match.
emitJumpSlowCaseIfNotJSCell(regT0, baseVReg);
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequencePutById);
+
Label hotPathBegin(this);
m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].hotPathBegin = hotPathBegin;
@@ -1279,6 +1287,9 @@ void JIT::emit_op_put_by_id(Instruction* currentInstruction)
ASSERT(differenceBetween(externalLoad, externalLoadComplete) == patchLengthPutByIdExternalLoad);
DataLabel32 displacementLabel = storePtrWithAddressOffsetPatch(regT1, Address(regT0, patchGetByIdDefaultOffset));
+
+ END_UNINTERRUPTED_SEQUENCE(sequencePutById);
+
ASSERT(differenceBetween(hotPathBegin, displacementLabel) == patchOffsetPutByIdPropertyMapOffset);
}
@@ -1382,7 +1393,7 @@ void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure
stubCall.addArgument(Imm32(oldStructure->propertyStorageCapacity()));
stubCall.addArgument(Imm32(newStructure->propertyStorageCapacity()));
stubCall.call(regT0);
- emitGetJITStubArg(3, regT1);
+ emitGetJITStubArg(2, regT1);
restoreReturnAddressBeforeReturn(regT3);
}
diff --git a/JavaScriptCore/jit/JITStubs.cpp b/JavaScriptCore/jit/JITStubs.cpp
index d563f58..c7257af 100644
--- a/JavaScriptCore/jit/JITStubs.cpp
+++ b/JavaScriptCore/jit/JITStubs.cpp
@@ -69,6 +69,18 @@ namespace JSC {
#define SYMBOL_STRING(name) #name
#endif
+#if PLATFORM(IPHONE)
+#define THUMB_FUNC_PARAM(name) SYMBOL_STRING(name)
+#else
+#define THUMB_FUNC_PARAM(name)
+#endif
+
+#if PLATFORM(LINUX) && PLATFORM(X86_64)
+#define SYMBOL_STRING_RELOCATION(name) #name "@plt"
+#else
+#define SYMBOL_STRING_RELOCATION(name) SYMBOL_STRING(name)
+#endif
+
#if USE(JSVALUE32_64)
#if COMPILER(GCC) && PLATFORM(X86)
@@ -106,7 +118,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
#if !USE(JIT_STUB_ARGUMENT_VA_LIST)
"movl %esp, %ecx" "\n"
#endif
- "call " SYMBOL_STRING(cti_vm_throw) "\n"
+ "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
"addl $0x3c, %esp" "\n"
"popl %ebx" "\n"
"popl %edi" "\n"
@@ -169,7 +181,7 @@ asm volatile (
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"movq %rsp, %rdi" "\n"
- "call " SYMBOL_STRING(cti_vm_throw) "\n"
+ "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
"addq $0x48, %rsp" "\n"
"popq %rbx" "\n"
"popq %r15" "\n"
@@ -193,7 +205,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"ret" "\n"
);
-#elif COMPILER(GCC) && PLATFORM_ARM_ARCH(7)
+#elif COMPILER(GCC) && PLATFORM(ARM_THUMB2)
#if USE(JIT_STUB_ARGUMENT_VA_LIST)
#error "JIT_STUB_ARGUMENT_VA_LIST not supported on ARMv7."
@@ -204,7 +216,7 @@ asm volatile (
".align 2" "\n"
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
".thumb" "\n"
-".thumb_func " SYMBOL_STRING(ctiTrampoline) "\n"
+".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n"
SYMBOL_STRING(ctiTrampoline) ":" "\n"
"sub sp, sp, #0x3c" "\n"
"str lr, [sp, #0x20]" "\n"
@@ -230,10 +242,10 @@ asm volatile (
".align 2" "\n"
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
".thumb" "\n"
-".thumb_func " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n"
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"cpy r0, sp" "\n"
- "bl " SYMBOL_STRING(cti_vm_throw) "\n"
+ "bl " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
"ldr r6, [sp, #0x2c]" "\n"
"ldr r5, [sp, #0x28]" "\n"
"ldr r4, [sp, #0x24]" "\n"
@@ -247,7 +259,7 @@ asm volatile (
".align 2" "\n"
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
".thumb" "\n"
-".thumb_func " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+".thumb_func " THUMB_FUNC_PARAM(ctiOpThrowNotCaught) "\n"
SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"ldr r6, [sp, #0x2c]" "\n"
"ldr r5, [sp, #0x28]" "\n"
@@ -359,7 +371,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
#if !USE(JIT_STUB_ARGUMENT_VA_LIST)
"movl %esp, %ecx" "\n"
#endif
- "call " SYMBOL_STRING(cti_vm_throw) "\n"
+ "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
"addl $0x1c, %esp" "\n"
"popl %ebx" "\n"
"popl %edi" "\n"
@@ -428,7 +440,7 @@ asm volatile (
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"movq %rsp, %rdi" "\n"
- "call " SYMBOL_STRING(cti_vm_throw) "\n"
+ "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
"addq $0x78, %rsp" "\n"
"popq %rbx" "\n"
"popq %r15" "\n"
@@ -452,7 +464,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"ret" "\n"
);
-#elif COMPILER(GCC) && PLATFORM_ARM_ARCH(7)
+#elif COMPILER(GCC) && PLATFORM(ARM_THUMB2)
#if USE(JIT_STUB_ARGUMENT_VA_LIST)
#error "JIT_STUB_ARGUMENT_VA_LIST not supported on ARMv7."
@@ -463,9 +475,9 @@ asm volatile (
".align 2" "\n"
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
".thumb" "\n"
-".thumb_func " SYMBOL_STRING(ctiTrampoline) "\n"
+".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n"
SYMBOL_STRING(ctiTrampoline) ":" "\n"
- "sub sp, sp, #0x3c" "\n"
+ "sub sp, sp, #0x40" "\n"
"str lr, [sp, #0x20]" "\n"
"str r4, [sp, #0x24]" "\n"
"str r5, [sp, #0x28]" "\n"
@@ -480,7 +492,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n"
"ldr r5, [sp, #0x28]" "\n"
"ldr r4, [sp, #0x24]" "\n"
"ldr lr, [sp, #0x20]" "\n"
- "add sp, sp, #0x3c" "\n"
+ "add sp, sp, #0x40" "\n"
"bx lr" "\n"
);
@@ -489,15 +501,15 @@ asm volatile (
".align 2" "\n"
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
".thumb" "\n"
-".thumb_func " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n"
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"cpy r0, sp" "\n"
- "bl " SYMBOL_STRING(cti_vm_throw) "\n"
+ "bl " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
"ldr r6, [sp, #0x2c]" "\n"
"ldr r5, [sp, #0x28]" "\n"
"ldr r4, [sp, #0x24]" "\n"
"ldr lr, [sp, #0x20]" "\n"
- "add sp, sp, #0x3c" "\n"
+ "add sp, sp, #0x40" "\n"
"bx lr" "\n"
);
@@ -506,7 +518,7 @@ asm volatile (
".align 2" "\n"
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
".thumb" "\n"
-".thumb_func " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+".thumb_func " THUMB_FUNC_PARAM(ctiOpThrowNotCaught) "\n"
SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"ldr r6, [sp, #0x2c]" "\n"
"ldr r5, [sp, #0x28]" "\n"
@@ -516,7 +528,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"bx lr" "\n"
);
-#elif COMPILER(GCC) && PLATFORM(ARM)
+#elif COMPILER(GCC) && PLATFORM(ARM_TRADITIONAL)
asm volatile (
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
@@ -548,7 +560,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"mov lr, r6" "\n"
"add r8, pc, #4" "\n"
"str r8, [sp, #-4]!" "\n"
- "b " SYMBOL_STRING(cti_vm_throw) "\n"
+ "b " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
// Both has the same return sequence
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
@@ -636,7 +648,7 @@ JITThunks::JITThunks(JSGlobalData* globalData)
{
JIT::compileCTIMachineTrampolines(globalData, &m_executablePool, &m_ctiStringLengthTrampoline, &m_ctiVirtualCallLink, &m_ctiVirtualCall, &m_ctiNativeCallThunk);
-#if PLATFORM_ARM_ARCH(7)
+#if PLATFORM(ARM_THUMB2)
// Unfortunate the arm compiler does not like the use of offsetof on JITStackFrame (since it contains non POD types),
// and the OBJECT_OFFSETOF macro does not appear constantish enough for it to be happy with its use in COMPILE_ASSERT
// macros.
@@ -649,7 +661,7 @@ JITThunks::JITThunks(JSGlobalData* globalData)
ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, callFrame) == 0x34);
ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, exception) == 0x38);
// The fifth argument is the first item already on the stack.
- ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, enabledProfilerReference) == 0x3c);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, enabledProfilerReference) == 0x40);
ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, thunkReturnAddress) == 0x1C);
#endif
@@ -673,7 +685,7 @@ NEVER_INLINE void JITThunks::tryCachePutByID(CallFrame* callFrame, CodeBlock* co
JSCell* baseCell = asCell(baseValue);
Structure* structure = baseCell->structure();
- if (structure->isDictionary()) {
+ if (structure->isUncacheableDictionary()) {
ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_put_by_id_generic));
return;
}
@@ -689,7 +701,7 @@ NEVER_INLINE void JITThunks::tryCachePutByID(CallFrame* callFrame, CodeBlock* co
// Structure transition, cache transition info
if (slot.type() == PutPropertySlot::NewProperty) {
StructureChain* prototypeChain = structure->prototypeChain(callFrame);
- if (!prototypeChain->isCacheable()) {
+ if (!prototypeChain->isCacheable() || structure->isDictionary()) {
ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_put_by_id_generic));
return;
}
@@ -737,7 +749,7 @@ NEVER_INLINE void JITThunks::tryCacheGetByID(CallFrame* callFrame, CodeBlock* co
JSCell* baseCell = asCell(baseValue);
Structure* structure = baseCell->structure();
- if (structure->isDictionary()) {
+ if (structure->isUncacheableDictionary()) {
ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_get_by_id_generic));
return;
}
@@ -876,7 +888,7 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD
} \
} while (0)
-#if PLATFORM_ARM_ARCH(7)
+#if PLATFORM(ARM_THUMB2)
#define DEFINE_STUB_FUNCTION(rtype, op) \
extern "C" { \
@@ -887,7 +899,7 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD
".align 2" "\n" \
".globl " SYMBOL_STRING(cti_##op) "\n" \
".thumb" "\n" \
- ".thumb_func " SYMBOL_STRING(cti_##op) "\n" \
+ ".thumb_func " THUMB_FUNC_PARAM(cti_##op) "\n" \
SYMBOL_STRING(cti_##op) ":" "\n" \
"str lr, [sp, #0x1c]" "\n" \
"bl " SYMBOL_STRING(JITStubThunked_##op) "\n" \
@@ -1148,7 +1160,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_method_check)
JSObject* slotBaseObject;
if (baseValue.isCell()
&& slot.isCacheable()
- && !(structure = asCell(baseValue)->structure())->isDictionary()
+ && !(structure = asCell(baseValue)->structure())->isUncacheableDictionary()
&& (slotBaseObject = asObject(slot.slotBase()))->getPropertySpecificValue(callFrame, ident, specific)
&& specific
) {
@@ -1176,7 +1188,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_method_check)
// for now. For now it performs a check on a special object on the global object only used for this
// purpose. The object is in no way exposed, and as such the check will always pass.
if (slot.slotBase() == baseValue) {
- JIT::patchMethodCallProto(codeBlock, methodCallLinkInfo, callee, structure, callFrame->scopeChain()->globalObject()->methodCallDummy(), STUB_RETURN_ADDRESS);
+ JIT::patchMethodCallProto(codeBlock, methodCallLinkInfo, callee, structure, callFrame->scopeChain()->globalObject->methodCallDummy(), STUB_RETURN_ADDRESS);
return JSValue::encode(result);
}
}
@@ -1222,7 +1234,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_self_fail)
if (baseValue.isCell()
&& slot.isCacheable()
- && !asCell(baseValue)->structure()->isDictionary()
+ && !asCell(baseValue)->structure()->isUncacheableDictionary()
&& slot.slotBase() == baseValue) {
CodeBlock* codeBlock = callFrame->codeBlock();
@@ -1293,7 +1305,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_proto_list)
CHECK_FOR_EXCEPTION();
- if (!baseValue.isCell() || !slot.isCacheable() || asCell(baseValue)->structure()->isDictionary()) {
+ if (!baseValue.isCell() || !slot.isCacheable() || asCell(baseValue)->structure()->isUncacheableDictionary()) {
ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));
return JSValue::encode(result);
}
@@ -1467,7 +1479,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_new_func)
{
STUB_INIT_STACK_FRAME(stackFrame);
- return stackFrame.args[0].funcDeclNode()->makeFunction(stackFrame.callFrame, stackFrame.callFrame->scopeChain());
+ return stackFrame.args[0].function()->make(stackFrame.callFrame, stackFrame.callFrame->scopeChain());
}
DEFINE_STUB_FUNCTION(void*, op_call_JSFunction)
@@ -1481,11 +1493,11 @@ DEFINE_STUB_FUNCTION(void*, op_call_JSFunction)
JSFunction* function = asFunction(stackFrame.args[0].jsValue());
ASSERT(!function->isHostFunction());
- FunctionBodyNode* body = function->body();
+ FunctionExecutable* executable = function->jsExecutable();
ScopeChainNode* callDataScopeChain = function->scope().node();
- body->jitCode(callDataScopeChain);
+ executable->jitCode(stackFrame.callFrame, callDataScopeChain);
- return &(body->generatedBytecode());
+ return function;
}
DEFINE_STUB_FUNCTION(VoidPtrPair, op_call_arityCheck)
@@ -1493,8 +1505,9 @@ DEFINE_STUB_FUNCTION(VoidPtrPair, op_call_arityCheck)
STUB_INIT_STACK_FRAME(stackFrame);
CallFrame* callFrame = stackFrame.callFrame;
- CodeBlock* newCodeBlock = stackFrame.args[3].codeBlock();
- ASSERT(newCodeBlock->codeType() != NativeCode);
+ JSFunction* callee = asFunction(stackFrame.args[0].jsValue());
+ ASSERT(!callee->isHostFunction());
+ CodeBlock* newCodeBlock = &callee->jsExecutable()->generatedBytecode();
int argCount = stackFrame.args[2].int32();
ASSERT(argCount != newCodeBlock->m_numParameters);
@@ -1531,7 +1544,7 @@ DEFINE_STUB_FUNCTION(VoidPtrPair, op_call_arityCheck)
callFrame->setCallerFrame(oldCallFrame);
}
- RETURN_POINTER_PAIR(newCodeBlock, callFrame);
+ RETURN_POINTER_PAIR(callee, callFrame);
}
#if ENABLE(JIT_OPTIMIZE_CALL)
@@ -1539,13 +1552,12 @@ DEFINE_STUB_FUNCTION(void*, vm_lazyLinkCall)
{
STUB_INIT_STACK_FRAME(stackFrame);
JSFunction* callee = asFunction(stackFrame.args[0].jsValue());
- JITCode& jitCode = callee->body()->generatedJITCode();
+ ExecutableBase* executable = callee->executable();
+ JITCode& jitCode = executable->generatedJITCode();
CodeBlock* codeBlock = 0;
- if (!callee->isHostFunction())
- codeBlock = &callee->body()->bytecode(callee->scope().node());
- else
- codeBlock = &callee->body()->generatedBytecode();
+ if (!executable->isHostFunction())
+ codeBlock = &static_cast<FunctionExecutable*>(executable)->bytecode(stackFrame.callFrame, callee->scope().node());
CallLinkInfo* callLinkInfo = &stackFrame.callFrame->callerFrame()->codeBlock()->getCallLinkInfo(stackFrame.args[1].returnAddress());
if (!callLinkInfo->seenOnce())
@@ -1561,7 +1573,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_push_activation)
{
STUB_INIT_STACK_FRAME(stackFrame);
- JSActivation* activation = new (stackFrame.globalData) JSActivation(stackFrame.callFrame, static_cast<FunctionBodyNode*>(stackFrame.callFrame->codeBlock()->ownerNode()));
+ JSActivation* activation = new (stackFrame.globalData) JSActivation(stackFrame.callFrame, static_cast<FunctionExecutable*>(stackFrame.callFrame->codeBlock()->ownerExecutable()));
stackFrame.callFrame->setScopeChain(stackFrame.callFrame->scopeChain()->copy()->push(activation));
return activation;
}
@@ -1732,7 +1744,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_construct_JSConstruct)
if (stackFrame.args[3].jsValue().isObject())
structure = asObject(stackFrame.args[3].jsValue())->inheritorID();
else
- structure = constructor->scope().node()->globalObject()->emptyObjectStructure();
+ structure = constructor->scope().node()->globalObject->emptyObjectStructure();
return new (stackFrame.globalData) JSObject(structure);
}
@@ -1936,28 +1948,6 @@ DEFINE_STUB_FUNCTION(void, op_put_by_val)
CHECK_FOR_EXCEPTION_AT_END();
}
-DEFINE_STUB_FUNCTION(void, op_put_by_val_array)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
- CallFrame* callFrame = stackFrame.callFrame;
- JSValue baseValue = stackFrame.args[0].jsValue();
- int i = stackFrame.args[1].int32();
- JSValue value = stackFrame.args[2].jsValue();
-
- ASSERT(isJSArray(stackFrame.globalData, baseValue));
-
- if (LIKELY(i >= 0))
- asArray(baseValue)->JSArray::put(callFrame, i, value);
- else {
- Identifier property(callFrame, UString::from(i));
- PutPropertySlot slot;
- baseValue.put(callFrame, property, value, slot);
- }
-
- CHECK_FOR_EXCEPTION_AT_END();
-}
-
DEFINE_STUB_FUNCTION(void, op_put_by_val_byte_array)
{
STUB_INIT_STACK_FRAME(stackFrame);
@@ -2042,7 +2032,7 @@ DEFINE_STUB_FUNCTION(int, op_load_varargs)
stackFrame.globalData->exception = createStackOverflowError(callFrame);
VM_THROW_EXCEPTION();
}
- int32_t expectedParams = callFrame->callee()->body()->parameterCount();
+ int32_t expectedParams = callFrame->callee()->jsExecutable()->parameterCount();
int32_t inplaceArgs = min(providedParams, expectedParams);
Register* inplaceArgsDst = callFrame->registers() + argsOffset;
@@ -2182,7 +2172,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_global)
PropertySlot slot(globalObject);
if (globalObject->getPropertySlot(callFrame, ident, slot)) {
JSValue result = slot.getValue(callFrame, ident);
- if (slot.isCacheable() && !globalObject->structure()->isDictionary() && slot.slotBase() == globalObject) {
+ if (slot.isCacheable() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
GlobalResolveInfo& globalResolveInfo = callFrame->codeBlock()->globalResolveInfo(globalResolveInfoIndex);
if (globalResolveInfo.structure)
globalResolveInfo.structure->deref();
@@ -2358,8 +2348,6 @@ DEFINE_STUB_FUNCTION(int, op_eq)
if (src1.isNull())
return src2.isCell() && asCell(src2)->structure()->typeInfo().masqueradesAsUndefined();
- ASSERT(src1.isCell());
-
JSCell* cell1 = asCell(src1);
if (cell1->isString()) {
@@ -2375,21 +2363,18 @@ DEFINE_STUB_FUNCTION(int, op_eq)
if (src2.isFalse())
return static_cast<JSString*>(cell1)->value().toDouble() == 0.0;
- ASSERT(src2.isCell());
JSCell* cell2 = asCell(src2);
if (cell2->isString())
return static_cast<JSString*>(cell1)->value() == static_cast<JSString*>(cell2)->value();
- ASSERT(cell2->isObject());
- src2 = static_cast<JSObject*>(cell2)->toPrimitive(stackFrame.callFrame);
+ src2 = asObject(cell2)->toPrimitive(stackFrame.callFrame);
CHECK_FOR_EXCEPTION();
goto start;
}
- ASSERT(cell1->isObject());
if (src2.isObject())
- return static_cast<JSObject*>(cell1) == asObject(src2);
- src1 = static_cast<JSObject*>(cell1)->toPrimitive(stackFrame.callFrame);
+ return asObject(cell1) == asObject(src2);
+ src1 = asObject(cell1)->toPrimitive(stackFrame.callFrame);
CHECK_FOR_EXCEPTION();
goto start;
}
@@ -2517,8 +2502,24 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_with_base)
DEFINE_STUB_FUNCTION(JSObject*, op_new_func_exp)
{
STUB_INIT_STACK_FRAME(stackFrame);
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ FunctionExecutable* function = stackFrame.args[0].function();
+ JSFunction* func = function->make(callFrame, callFrame->scopeChain());
+
+ /*
+ The Identifier in a FunctionExpression can be referenced from inside
+ the FunctionExpression's FunctionBody to allow the function to call
+ itself recursively. However, unlike in a FunctionDeclaration, the
+ Identifier in a FunctionExpression cannot be referenced from and
+ does not affect the scope enclosing the FunctionExpression.
+ */
+ if (!function->name().isNull()) {
+ JSStaticScopeObject* functionScopeObject = new (callFrame) JSStaticScopeObject(callFrame, function->name(), func, ReadOnly | DontDelete);
+ func->scope().push(functionScopeObject);
+ }
- return stackFrame.args[0].funcExprNode()->makeFunction(stackFrame.callFrame, stackFrame.callFrame->scopeChain());
+ return func;
}
DEFINE_STUB_FUNCTION(EncodedJSValue, op_mod)
@@ -2624,7 +2625,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_eval)
Register* newCallFrame = callFrame->registers() + registerOffset;
Register* argv = newCallFrame - RegisterFile::CallFrameHeaderSize - argCount;
JSValue thisValue = argv[0].jsValue();
- JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject();
+ JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject;
if (thisValue == globalObject && funcVal == globalObject->evalFunction()) {
JSValue exceptionValue;
@@ -2978,7 +2979,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_new_error)
unsigned bytecodeOffset = stackFrame.args[2].int32();
unsigned lineNumber = codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset);
- return Error::create(callFrame, static_cast<ErrorType>(type), message.toString(callFrame), lineNumber, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
+ return Error::create(callFrame, static_cast<ErrorType>(type), message.toString(callFrame), lineNumber, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
}
DEFINE_STUB_FUNCTION(void, op_debug)
diff --git a/JavaScriptCore/jit/JITStubs.h b/JavaScriptCore/jit/JITStubs.h
index 8f02435..daae043 100644
--- a/JavaScriptCore/jit/JITStubs.h
+++ b/JavaScriptCore/jit/JITStubs.h
@@ -42,6 +42,7 @@ namespace JSC {
class CodeBlock;
class ExecutablePool;
+ class FunctionExecutable;
class Identifier;
class JSGlobalData;
class JSGlobalData;
@@ -53,8 +54,6 @@ namespace JSC {
class PropertySlot;
class PutPropertySlot;
class RegisterFile;
- class FuncDeclNode;
- class FuncExprNode;
class JSGlobalObject;
class RegExp;
@@ -67,8 +66,7 @@ namespace JSC {
Identifier& identifier() { return *static_cast<Identifier*>(asPointer); }
int32_t int32() { return asInt32; }
CodeBlock* codeBlock() { return static_cast<CodeBlock*>(asPointer); }
- FuncDeclNode* funcDeclNode() { return static_cast<FuncDeclNode*>(asPointer); }
- FuncExprNode* funcExprNode() { return static_cast<FuncExprNode*>(asPointer); }
+ FunctionExecutable* function() { return static_cast<FunctionExecutable*>(asPointer); }
RegExp* regExp() { return static_cast<RegExp*>(asPointer); }
JSPropertyNameIterator* propertyNameIterator() { return static_cast<JSPropertyNameIterator*>(asPointer); }
JSGlobalObject* globalObject() { return static_cast<JSGlobalObject*>(asPointer); }
@@ -131,7 +129,7 @@ namespace JSC {
#if COMPILER(MSVC)
#pragma pack(pop)
#endif // COMPILER(MSVC)
-#elif PLATFORM_ARM_ARCH(7)
+#elif PLATFORM(ARM_THUMB2)
struct JITStackFrame {
void* reserved; // Unused
JITStubArg args[6];
@@ -151,13 +149,15 @@ namespace JSC {
CallFrame* callFrame;
JSValue* exception;
+ void* padding2;
+
// These arguments passed on the stack.
Profiler** enabledProfilerReference;
JSGlobalData* globalData;
ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; }
};
-#elif PLATFORM(ARM)
+#elif PLATFORM(ARM_TRADITIONAL)
struct JITStackFrame {
JITStubArg padding; // Unused
JITStubArg args[7];
@@ -345,7 +345,6 @@ extern "C" {
void JIT_STUB cti_op_put_by_id_generic(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_put_by_index(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_put_by_val(STUB_ARGS_DECLARATION);
- void JIT_STUB cti_op_put_by_val_array(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_put_by_val_byte_array(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_put_getter(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_put_setter(STUB_ARGS_DECLARATION);
diff --git a/JavaScriptCore/jsc.cpp b/JavaScriptCore/jsc.cpp
index 92b1e58..9399b1a 100644
--- a/JavaScriptCore/jsc.cpp
+++ b/JavaScriptCore/jsc.cpp
@@ -24,6 +24,7 @@
#include "BytecodeGenerator.h"
#include "Completion.h"
+#include "CurrentTime.h"
#include "InitializeThreading.h"
#include "JSArray.h"
#include "JSFunction.h"
@@ -118,53 +119,23 @@ public:
long getElapsedMS(); // call stop() first
private:
-#if PLATFORM(QT)
- uint m_startTime;
- uint m_stopTime;
-#elif PLATFORM(WIN_OS)
- DWORD m_startTime;
- DWORD m_stopTime;
-#else
- // Windows does not have timeval, disabling this class for now (bug 7399)
- timeval m_startTime;
- timeval m_stopTime;
-#endif
+ double m_startTime;
+ double m_stopTime;
};
void StopWatch::start()
{
-#if PLATFORM(QT)
- QDateTime t = QDateTime::currentDateTime();
- m_startTime = t.toTime_t() * 1000 + t.time().msec();
-#elif PLATFORM(WIN_OS)
- m_startTime = timeGetTime();
-#else
- gettimeofday(&m_startTime, 0);
-#endif
+ m_startTime = currentTime();
}
void StopWatch::stop()
{
-#if PLATFORM(QT)
- QDateTime t = QDateTime::currentDateTime();
- m_stopTime = t.toTime_t() * 1000 + t.time().msec();
-#elif PLATFORM(WIN_OS)
- m_stopTime = timeGetTime();
-#else
- gettimeofday(&m_stopTime, 0);
-#endif
+ m_stopTime = currentTime();
}
long StopWatch::getElapsedMS()
{
-#if PLATFORM(WIN_OS) || PLATFORM(QT)
- return m_stopTime - m_startTime;
-#else
- timeval elapsedTime;
- timersub(&m_stopTime, &m_startTime, &elapsedTime);
-
- return elapsedTime.tv_sec * 1000 + lroundf(elapsedTime.tv_usec / 1000.0f);
-#endif
+ return static_cast<long>((m_stopTime - m_startTime) * 1000);
}
class GlobalObject : public JSGlobalObject {
@@ -389,11 +360,8 @@ static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scr
if (dump)
BytecodeGenerator::setDumpsGeneratedCode(true);
-#if ENABLE(OPCODE_SAMPLING)
- Interpreter* interpreter = globalObject->globalData()->interpreter;
- interpreter->setSampler(new SamplingTool(interpreter));
- interpreter->sampler()->setup();
-#endif
+ JSGlobalData* globalData = globalObject->globalData();
+
#if ENABLE(SAMPLING_FLAGS)
SamplingFlags::start();
#endif
@@ -410,9 +378,7 @@ static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scr
fileName = "[Command Line]";
}
-#if ENABLE(SAMPLING_THREAD)
- SamplingThread::start();
-#endif
+ globalData->startSampling();
Completion completion = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script, fileName));
success = success && completion.complType() != Throw;
@@ -423,20 +389,14 @@ static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scr
printf("End: %s\n", completion.value().toString(globalObject->globalExec()).ascii());
}
-#if ENABLE(SAMPLING_THREAD)
- SamplingThread::stop();
-#endif
-
+ globalData->stopSampling();
globalObject->globalExec()->clearException();
}
#if ENABLE(SAMPLING_FLAGS)
SamplingFlags::stop();
#endif
-#if ENABLE(OPCODE_SAMPLING)
- interpreter->sampler()->dump(globalObject->globalExec());
- delete interpreter->sampler();
-#endif
+ globalData->dumpSampleData(globalObject->globalExec());
#if ENABLE(SAMPLING_COUNTERS)
AbstractSamplingCounter::dump();
#endif
diff --git a/JavaScriptCore/os-win32/stdbool.h b/JavaScriptCore/os-win32/stdbool.h
index 8e7bace..fc8ee28 100644
--- a/JavaScriptCore/os-win32/stdbool.h
+++ b/JavaScriptCore/os-win32/stdbool.h
@@ -21,8 +21,8 @@
#ifndef STDBOOL_WIN32_H
#define STDBOOL_WIN32_H
-#if !PLATFORM(WIN_OS)
-#error "This stdbool.h file should only be compiled under Windows"
+#if !COMPILER(MSVC)
+#error "This stdbool.h file should only be compiled with MSVC"
#endif
#ifndef __cplusplus
diff --git a/JavaScriptCore/os-win32/stdint.h b/JavaScriptCore/os-win32/stdint.h
index efab2ae..1d8787e 100644
--- a/JavaScriptCore/os-win32/stdint.h
+++ b/JavaScriptCore/os-win32/stdint.h
@@ -23,10 +23,11 @@
#include <wtf/Platform.h>
-/* This file emulates enough of stdint.h on Windows to make JavaScriptCore and WebCore compile. */
+/* This file emulates enough of stdint.h on Windows to make JavaScriptCore and WebCore
+ compile using MSVC which does not ship with the stdint.h header. */
-#if !PLATFORM(WIN_OS)
-#error "This stdint.h file should only be compiled under Windows"
+#if !COMPILER(MSVC)
+#error "This stdint.h file should only be compiled with MSVC"
#endif
#include <limits.h>
diff --git a/JavaScriptCore/parser/Grammar.y b/JavaScriptCore/parser/Grammar.y
index 354c786..85fd163 100644
--- a/JavaScriptCore/parser/Grammar.y
+++ b/JavaScriptCore/parser/Grammar.y
@@ -25,18 +25,12 @@
#include "config.h"
-#include <string.h>
-#include <stdlib.h>
-#include "JSValue.h"
#include "JSObject.h"
-#include "NodeConstructors.h"
-#include "Lexer.h"
#include "JSString.h"
-#include "JSGlobalData.h"
-#include "CommonIdentifiers.h"
+#include "NodeConstructors.h"
#include "NodeInfo.h"
-#include "Parser.h"
-#include <wtf/FastMalloc.h>
+#include <stdlib.h>
+#include <string.h>
#include <wtf/MathExtras.h>
#define YYMALLOC fastMalloc
@@ -45,46 +39,44 @@
#define YYMAXDEPTH 10000
#define YYENABLE_NLS 0
-/* default values for bison */
+// Default values for bison.
#define YYDEBUG 0 // Set to 1 to debug a parse error.
#define jscyydebug 0 // Set to 1 to debug a parse error.
#if !PLATFORM(DARWIN)
- // avoid triggering warnings in older bison
+// Avoid triggering warnings in older bison by not setting this on the Darwin platform.
+// FIXME: Is this still needed?
#define YYERROR_VERBOSE
#endif
int jscyylex(void* lvalp, void* llocp, void* globalPtr);
int jscyyerror(const char*);
+
static inline bool allowAutomaticSemicolon(JSC::Lexer&, int);
#define GLOBAL_DATA static_cast<JSGlobalData*>(globalPtr)
-#define LEXER (GLOBAL_DATA->lexer)
-
-#define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*LEXER, yychar)) YYABORT; } while (0)
-#define SET_EXCEPTION_LOCATION(node, start, divot, end) node->setExceptionSourceCode((divot), (divot) - (start), (end) - (divot))
-#define DBG(l, s, e) (l)->setLoc((s).first_line, (e).last_line)
+#define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*GLOBAL_DATA->lexer, yychar)) YYABORT; } while (0)
using namespace JSC;
using namespace std;
-static ExpressionNode* makeAssignNode(void*, ExpressionNode* loc, Operator, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end);
-static ExpressionNode* makePrefixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end);
-static ExpressionNode* makePostfixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end);
-static PropertyNode* makeGetterOrSetterPropertyNode(void*, const Identifier &getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceCode&);
-static ExpressionNodeInfo makeFunctionCallNode(void*, ExpressionNodeInfo func, ArgumentsNodeInfo, int start, int divot, int end);
-static ExpressionNode* makeTypeOfNode(void*, ExpressionNode*);
-static ExpressionNode* makeDeleteNode(void*, ExpressionNode*, int start, int divot, int end);
-static ExpressionNode* makeNegateNode(void*, ExpressionNode*);
-static NumberNode* makeNumberNode(void*, double);
-static ExpressionNode* makeBitwiseNotNode(void*, ExpressionNode*);
-static ExpressionNode* makeMultNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
-static ExpressionNode* makeDivNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
-static ExpressionNode* makeAddNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
-static ExpressionNode* makeSubNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
-static ExpressionNode* makeLeftShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
-static ExpressionNode* makeRightShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
-static StatementNode* makeVarStatementNode(void*, ExpressionNode*);
-static ExpressionNode* combineCommaNodes(void*, ExpressionNode* list, ExpressionNode* init);
+static ExpressionNode* makeAssignNode(JSGlobalData*, ExpressionNode* left, Operator, ExpressionNode* right, bool leftHasAssignments, bool rightHasAssignments, int start, int divot, int end);
+static ExpressionNode* makePrefixNode(JSGlobalData*, ExpressionNode*, Operator, int start, int divot, int end);
+static ExpressionNode* makePostfixNode(JSGlobalData*, ExpressionNode*, Operator, int start, int divot, int end);
+static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData*, const Identifier& getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceCode&);
+static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData*, ExpressionNodeInfo function, ArgumentsNodeInfo, int start, int divot, int end);
+static ExpressionNode* makeTypeOfNode(JSGlobalData*, ExpressionNode*);
+static ExpressionNode* makeDeleteNode(JSGlobalData*, ExpressionNode*, int start, int divot, int end);
+static ExpressionNode* makeNegateNode(JSGlobalData*, ExpressionNode*);
+static NumberNode* makeNumberNode(JSGlobalData*, double);
+static ExpressionNode* makeBitwiseNotNode(JSGlobalData*, ExpressionNode*);
+static ExpressionNode* makeMultNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+static ExpressionNode* makeDivNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+static ExpressionNode* makeAddNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+static ExpressionNode* makeSubNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+static ExpressionNode* makeLeftShiftNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+static ExpressionNode* makeRightShiftNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+static StatementNode* makeVarStatementNode(JSGlobalData*, ExpressionNode*);
+static ExpressionNode* combineCommaNodes(JSGlobalData*, ExpressionNode* list, ExpressionNode* init);
#if COMPILER(MSVC)
@@ -97,17 +89,17 @@ static ExpressionNode* combineCommaNodes(void*, ExpressionNode* list, Expression
#define YYPARSE_PARAM globalPtr
#define YYLEX_PARAM globalPtr
-template <typename T> NodeDeclarationInfo<T> createNodeDeclarationInfo(T node, ParserArenaData<DeclarationStacks::VarStack>* varDecls,
- ParserArenaData<DeclarationStacks::FunctionStack>* funcDecls,
- CodeFeatures info,
- int numConstants)
+template <typename T> inline NodeDeclarationInfo<T> createNodeDeclarationInfo(T node,
+ ParserArenaData<DeclarationStacks::VarStack>* varDecls,
+ ParserArenaData<DeclarationStacks::FunctionStack>* funcDecls,
+ CodeFeatures info, int numConstants)
{
ASSERT((info & ~AllFeatures) == 0);
NodeDeclarationInfo<T> result = { node, varDecls, funcDecls, info, numConstants };
return result;
}
-template <typename T> NodeInfo<T> createNodeInfo(T node, CodeFeatures info, int numConstants)
+template <typename T> inline NodeInfo<T> createNodeInfo(T node, CodeFeatures info, int numConstants)
{
ASSERT((info & ~AllFeatures) == 0);
NodeInfo<T> result = { node, info, numConstants };
@@ -133,21 +125,20 @@ template <typename T> inline T mergeDeclarationLists(T decls1, T decls2)
return decls1;
}
-static void appendToVarDeclarationList(void* globalPtr, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
+static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
{
if (!varDecls)
- varDecls = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
-
- varDecls->data.append(make_pair(ident, attrs));
+ varDecls = new (globalData) ParserArenaData<DeclarationStacks::VarStack>;
+ varDecls->data.append(make_pair(&ident, attrs));
}
-static inline void appendToVarDeclarationList(void* globalPtr, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
+static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
{
unsigned attrs = DeclarationStacks::IsConstant;
if (decl->hasInitializer())
attrs |= DeclarationStacks::HasInitializer;
- appendToVarDeclarationList(globalPtr, varDecls, decl->ident(), attrs);
+ appendToVarDeclarationList(globalData, varDecls, decl->ident(), attrs);
}
%}
@@ -155,7 +146,7 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserArenaData<D
%union {
int intValue;
double doubleValue;
- Identifier* ident;
+ const Identifier* ident;
// expression subtrees
ExpressionNodeInfo expressionNode;
@@ -184,6 +175,20 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserArenaData<D
Operator op;
}
+%{
+
+template <typename T> inline void setStatementLocation(StatementNode* statement, const T& start, const T& end)
+{
+ statement->setLoc(start.first_line, end.last_line);
+}
+
+static inline void setExceptionLocation(ThrowableExpressionData* node, unsigned start, unsigned divot, unsigned end)
+{
+ node->setExceptionSourceCode(divot, divot - start, end - divot);
+}
+
+%}
+
%start Program
/* literals */
@@ -291,21 +296,25 @@ Literal:
| NUMBER { $$ = createNodeInfo<ExpressionNode*>(makeNumberNode(GLOBAL_DATA, $1), 0, 1); }
| STRING { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StringNode(GLOBAL_DATA, *$1), 0, 1); }
| '/' /* regexp */ {
- Lexer& l = *LEXER;
- if (!l.scanRegExp())
+ Lexer& l = *GLOBAL_DATA->lexer;
+ const Identifier* pattern;
+ const Identifier* flags;
+ if (!l.scanRegExp(pattern, flags))
YYABORT;
- RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, l.pattern(), l.flags());
- int size = l.pattern().size() + 2; // + 2 for the two /'s
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size);
+ RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags);
+ int size = pattern->size() + 2; // + 2 for the two /'s
+ setExceptionLocation(node, @1.first_column, @1.first_column + size, @1.first_column + size);
$$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
}
| DIVEQUAL /* regexp with /= */ {
- Lexer& l = *LEXER;
- if (!l.scanRegExp())
+ Lexer& l = *GLOBAL_DATA->lexer;
+ const Identifier* pattern;
+ const Identifier* flags;
+ if (!l.scanRegExp(pattern, flags, '='))
YYABORT;
- RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, "=" + l.pattern(), l.flags());
- int size = l.pattern().size() + 2; // + 2 for the two /'s
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size);
+ RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags);
+ int size = pattern->size() + 2; // + 2 for the two /'s
+ setExceptionLocation(node, @1.first_column, @1.first_column + size, @1.first_column + size);
$$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
}
;
@@ -313,14 +322,14 @@ Literal:
Property:
IDENT ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
| STRING ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
- | NUMBER ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from($1)), $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
- | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, 0, $6, LEXER->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); DBG($6, @5, @7); if (!$$.m_node) YYABORT; }
+ | NUMBER ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, $1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
+ | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, 0, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); setStatementLocation($6, @5, @7); if (!$$.m_node) YYABORT; }
| IDENT IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
{
- $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, $4.m_node.head, $7, LEXER->sourceCode($6, $8, @6.first_line)), $4.m_features | ClosureFeature, 0);
+ $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, $4.m_node.head, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line)), $4.m_features | ClosureFeature, 0);
if ($4.m_features & ArgumentsFeature)
$7->setUsesArguments();
- DBG($7, @6, @8);
+ setStatementLocation($7, @6, @8);
if (!$$.m_node)
YYABORT;
}
@@ -385,15 +394,15 @@ MemberExpr:
PrimaryExpr
| FunctionExpr { $$ = createNodeInfo<ExpressionNode*>($1.m_node, $1.m_features, $1.m_numConstants); }
| MemberExpr '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
+ setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
}
| MemberExpr '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
+ setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
}
| NEW MemberExpr Arguments { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @3.last_column);
+ setExceptionLocation(node, @1.first_column, @2.last_column, @3.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants);
}
;
@@ -401,15 +410,15 @@ MemberExpr:
MemberExprNoBF:
PrimaryExprNoBrace
| MemberExprNoBF '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
+ setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
}
| MemberExprNoBF '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
+ setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
}
| NEW MemberExpr Arguments { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @3.last_column);
+ setExceptionLocation(node, @1.first_column, @2.last_column, @3.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants);
}
;
@@ -417,7 +426,7 @@ MemberExprNoBF:
NewExpr:
MemberExpr
| NEW NewExpr { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
+ setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants);
}
;
@@ -425,32 +434,32 @@ NewExpr:
NewExprNoBF:
MemberExprNoBF
| NEW NewExpr { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
+ setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants);
}
;
CallExpr:
- MemberExpr Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
- | CallExpr Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
+ MemberExpr Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
+ | CallExpr Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
| CallExpr '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
+ setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
}
| CallExpr '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
+ setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants); }
;
CallExprNoBF:
- MemberExprNoBF Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
- | CallExprNoBF Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
+ MemberExprNoBF Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
+ | CallExprNoBF Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
| CallExprNoBF '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
+ setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
}
| CallExprNoBF '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
+ setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
}
;
@@ -568,10 +577,10 @@ RelationalExpr:
| RelationalExpr LE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
| RelationalExpr GE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
| RelationalExpr INSTANCEOF ShiftExpr { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
+ setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
| RelationalExpr INTOKEN ShiftExpr { InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
+ setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
;
@@ -583,7 +592,7 @@ RelationalExprNoIn:
| RelationalExprNoIn GE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
| RelationalExprNoIn INSTANCEOF ShiftExpr
{ InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
+ setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
;
@@ -595,11 +604,11 @@ RelationalExprNoBF:
| RelationalExprNoBF GE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
| RelationalExprNoBF INSTANCEOF ShiftExpr
{ InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
+ setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
| RelationalExprNoBF INTOKEN ShiftExpr
{ InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
+ setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
;
@@ -810,17 +819,17 @@ Statement:
;
Block:
- OPENBRACE CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0);
- DBG($$.m_node, @1, @2); }
- | OPENBRACE SourceElements CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
- DBG($$.m_node, @1, @3); }
+ OPENBRACE CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0);
+ setStatementLocation($$.m_node, @1, @2); }
+ | OPENBRACE SourceElements CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
+ setStatementLocation($$.m_node, @1, @3); }
;
VariableStatement:
VAR VariableDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
- DBG($$.m_node, @1, @3); }
+ setStatementLocation($$.m_node, @1, @3); }
| VAR VariableDeclarationList error { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
- DBG($$.m_node, @1, @2);
+ setStatementLocation($$.m_node, @1, @2);
AUTO_SEMICOLON; }
;
@@ -833,7 +842,7 @@ VariableDeclarationList:
$$.m_numConstants = 0;
}
| IDENT Initializer { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.first_column + 1, @2.last_column);
+ setExceptionLocation(node, @1.first_column, @2.first_column + 1, @2.last_column);
$$.m_node = node;
$$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
@@ -851,7 +860,7 @@ VariableDeclarationList:
}
| VariableDeclarationList ',' IDENT Initializer
{ AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature);
- SET_EXCEPTION_LOCATION(node, @3.first_column, @4.first_column + 1, @4.last_column);
+ setExceptionLocation(node, @3.first_column, @4.first_column + 1, @4.last_column);
$$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node);
$$.m_varDeclarations = $1.m_varDeclarations;
appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
@@ -870,7 +879,7 @@ VariableDeclarationListNoIn:
$$.m_numConstants = 0;
}
| IDENT InitializerNoIn { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.first_column + 1, @2.last_column);
+ setExceptionLocation(node, @1.first_column, @2.first_column + 1, @2.last_column);
$$.m_node = node;
$$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
@@ -888,7 +897,7 @@ VariableDeclarationListNoIn:
}
| VariableDeclarationListNoIn ',' IDENT InitializerNoIn
{ AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature);
- SET_EXCEPTION_LOCATION(node, @3.first_column, @4.first_column + 1, @4.last_column);
+ setExceptionLocation(node, @3.first_column, @4.first_column + 1, @4.last_column);
$$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node);
$$.m_varDeclarations = $1.m_varDeclarations;
appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
@@ -900,10 +909,10 @@ VariableDeclarationListNoIn:
ConstStatement:
CONSTTOKEN ConstDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
- DBG($$.m_node, @1, @3); }
+ setStatementLocation($$.m_node, @1, @3); }
| CONSTTOKEN ConstDeclarationList error
{ $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
- DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
+ setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
;
ConstDeclarationList:
@@ -945,36 +954,36 @@ EmptyStatement:
ExprStatement:
ExprNoBF ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants);
- DBG($$.m_node, @1, @2); }
+ setStatementLocation($$.m_node, @1, @2); }
| ExprNoBF error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants);
- DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
+ setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
;
IfStatement:
IF '(' Expr ')' Statement %prec IF_WITHOUT_ELSE
{ $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants);
- DBG($$.m_node, @1, @4); }
+ setStatementLocation($$.m_node, @1, @4); }
| IF '(' Expr ')' Statement ELSE Statement
{ $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfElseNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node),
mergeDeclarationLists($5.m_varDeclarations, $7.m_varDeclarations),
mergeDeclarationLists($5.m_funcDeclarations, $7.m_funcDeclarations),
$3.m_features | $5.m_features | $7.m_features,
$3.m_numConstants + $5.m_numConstants + $7.m_numConstants);
- DBG($$.m_node, @1, @4); }
+ setStatementLocation($$.m_node, @1, @4); }
;
IterationStatement:
DO Statement WHILE '(' Expr ')' ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, $2.m_node, $5.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features | $5.m_features, $2.m_numConstants + $5.m_numConstants);
- DBG($$.m_node, @1, @3); }
+ setStatementLocation($$.m_node, @1, @3); }
| DO Statement WHILE '(' Expr ')' error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, $2.m_node, $5.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features | $5.m_features, $2.m_numConstants + $5.m_numConstants);
- DBG($$.m_node, @1, @3); } // Always performs automatic semicolon insertion.
+ setStatementLocation($$.m_node, @1, @3); } // Always performs automatic semicolon insertion.
| WHILE '(' Expr ')' Statement { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WhileNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants);
- DBG($$.m_node, @1, @4); }
+ setStatementLocation($$.m_node, @1, @4); }
| FOR '(' ExprNoInOpt ';' ExprOpt ';' ExprOpt ')' Statement
{ $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node, $9.m_node, false), $9.m_varDeclarations, $9.m_funcDeclarations,
$3.m_features | $5.m_features | $7.m_features | $9.m_features,
$3.m_numConstants + $5.m_numConstants + $7.m_numConstants + $9.m_numConstants);
- DBG($$.m_node, @1, @8);
+ setStatementLocation($$.m_node, @1, @8);
}
| FOR '(' VAR VariableDeclarationListNoIn ';' ExprOpt ';' ExprOpt ')' Statement
{ $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, $4.m_node, $6.m_node, $8.m_node, $10.m_node, true),
@@ -982,30 +991,30 @@ IterationStatement:
mergeDeclarationLists($4.m_funcDeclarations, $10.m_funcDeclarations),
$4.m_features | $6.m_features | $8.m_features | $10.m_features,
$4.m_numConstants + $6.m_numConstants + $8.m_numConstants + $10.m_numConstants);
- DBG($$.m_node, @1, @9); }
+ setStatementLocation($$.m_node, @1, @9); }
| FOR '(' LeftHandSideExpr INTOKEN Expr ')' Statement
{
ForInNode* node = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node);
- SET_EXCEPTION_LOCATION(node, @3.first_column, @3.last_column, @5.last_column);
+ setExceptionLocation(node, @3.first_column, @3.last_column, @5.last_column);
$$ = createNodeDeclarationInfo<StatementNode*>(node, $7.m_varDeclarations, $7.m_funcDeclarations,
$3.m_features | $5.m_features | $7.m_features,
$3.m_numConstants + $5.m_numConstants + $7.m_numConstants);
- DBG($$.m_node, @1, @6);
+ setStatementLocation($$.m_node, @1, @6);
}
| FOR '(' VAR IDENT INTOKEN Expr ')' Statement
{ ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *$4, 0, $6.m_node, $8.m_node, @5.first_column, @5.first_column - @4.first_column, @6.last_column - @5.first_column);
- SET_EXCEPTION_LOCATION(forIn, @4.first_column, @5.first_column + 1, @6.last_column);
+ setExceptionLocation(forIn, @4.first_column, @5.first_column + 1, @6.last_column);
appendToVarDeclarationList(GLOBAL_DATA, $8.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
$$ = createNodeDeclarationInfo<StatementNode*>(forIn, $8.m_varDeclarations, $8.m_funcDeclarations, ((*$4 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $6.m_features | $8.m_features, $6.m_numConstants + $8.m_numConstants);
- DBG($$.m_node, @1, @7); }
+ setStatementLocation($$.m_node, @1, @7); }
| FOR '(' VAR IDENT InitializerNoIn INTOKEN Expr ')' Statement
{ ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *$4, $5.m_node, $7.m_node, $9.m_node, @5.first_column, @5.first_column - @4.first_column, @5.last_column - @5.first_column);
- SET_EXCEPTION_LOCATION(forIn, @4.first_column, @6.first_column + 1, @7.last_column);
+ setExceptionLocation(forIn, @4.first_column, @6.first_column + 1, @7.last_column);
appendToVarDeclarationList(GLOBAL_DATA, $9.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
$$ = createNodeDeclarationInfo<StatementNode*>(forIn, $9.m_varDeclarations, $9.m_funcDeclarations,
((*$4 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $5.m_features | $7.m_features | $9.m_features,
$5.m_numConstants + $7.m_numConstants + $9.m_numConstants);
- DBG($$.m_node, @1, @8); }
+ setStatementLocation($$.m_node, @1, @8); }
;
ExprOpt:
@@ -1020,63 +1029,63 @@ ExprNoInOpt:
ContinueStatement:
CONTINUE ';' { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
+ setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
$$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- DBG($$.m_node, @1, @2); }
+ setStatementLocation($$.m_node, @1, @2); }
| CONTINUE error { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
+ setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
$$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
+ setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
| CONTINUE IDENT ';' { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
+ setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
$$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- DBG($$.m_node, @1, @3); }
+ setStatementLocation($$.m_node, @1, @3); }
| CONTINUE IDENT error { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
+ setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
$$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
+ setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
;
BreakStatement:
BREAK ';' { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @2); }
+ setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
+ $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); }
| BREAK error { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA), 0, 0, 0, 0); DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
+ setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
+ $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA), 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
| BREAK IDENT ';' { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @3); }
+ setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
+ $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @3); }
| BREAK IDENT error { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2), 0, 0, 0, 0); DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
+ setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
+ $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2), 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
;
ReturnStatement:
RETURN ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @2); }
+ setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
+ $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); }
| RETURN error { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
+ setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
+ $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
| RETURN Expr ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); DBG($$.m_node, @1, @3); }
+ setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
+ $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @3); }
| RETURN Expr error { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
+ setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
+ $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
;
WithStatement:
WITH '(' Expr ')' Statement { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WithNode(GLOBAL_DATA, $3.m_node, $5.m_node, @3.last_column, @3.last_column - @3.first_column),
$5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features | WithFeature, $3.m_numConstants + $5.m_numConstants);
- DBG($$.m_node, @1, @4); }
+ setStatementLocation($$.m_node, @1, @4); }
;
SwitchStatement:
SWITCH '(' Expr ')' CaseBlock { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) SwitchNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations,
$3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants);
- DBG($$.m_node, @1, @4); }
+ setStatementLocation($$.m_node, @1, @4); }
;
CaseBlock:
@@ -1090,7 +1099,7 @@ CaseBlock:
;
CaseClausesOpt:
-/* nothing */ { $$.m_node.head = 0; $$.m_node.tail = 0; $$.m_varDeclarations = 0; $$.m_funcDeclarations = 0; $$.m_features = 0; $$.m_numConstants = 0; }
+ /* nothing */ { $$.m_node.head = 0; $$.m_node.tail = 0; $$.m_varDeclarations = 0; $$.m_funcDeclarations = 0; $$.m_features = 0; $$.m_numConstants = 0; }
| CaseClauses
;
@@ -1122,18 +1131,18 @@ DefaultClause:
LabelledStatement:
IDENT ':' Statement { LabelNode* node = new (GLOBAL_DATA) LabelNode(GLOBAL_DATA, *$1, $3.m_node);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
+ setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
$$ = createNodeDeclarationInfo<StatementNode*>(node, $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_features, $3.m_numConstants); }
;
ThrowStatement:
THROW Expr ';' { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); DBG($$.m_node, @1, @2);
+ setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
+ $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2);
}
| THROW Expr error { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node);
- SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); DBG($$.m_node, @1, @2); AUTO_SEMICOLON;
+ setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
+ $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON;
}
;
@@ -1143,57 +1152,57 @@ TryStatement:
mergeDeclarationLists($2.m_funcDeclarations, $4.m_funcDeclarations),
$2.m_features | $4.m_features,
$2.m_numConstants + $4.m_numConstants);
- DBG($$.m_node, @1, @2); }
+ setStatementLocation($$.m_node, @1, @2); }
| TRY Block CATCH '(' IDENT ')' Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, *$5, ($7.m_features & EvalFeature) != 0, $7.m_node, 0),
mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations),
mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations),
$2.m_features | $7.m_features | CatchFeature,
$2.m_numConstants + $7.m_numConstants);
- DBG($$.m_node, @1, @2); }
+ setStatementLocation($$.m_node, @1, @2); }
| TRY Block CATCH '(' IDENT ')' Block FINALLY Block
{ $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, *$5, ($7.m_features & EvalFeature) != 0, $7.m_node, $9.m_node),
mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations), $9.m_varDeclarations),
mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations), $9.m_funcDeclarations),
$2.m_features | $7.m_features | $9.m_features | CatchFeature,
$2.m_numConstants + $7.m_numConstants + $9.m_numConstants);
- DBG($$.m_node, @1, @2); }
+ setStatementLocation($$.m_node, @1, @2); }
;
DebuggerStatement:
DEBUGGER ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
- DBG($$.m_node, @1, @2); }
+ setStatementLocation($$.m_node, @1, @2); }
| DEBUGGER error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
- DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
+ setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
;
FunctionDeclaration:
- FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *$2, $6, LEXER->sourceCode($5, $7, @5.first_line)), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); DBG($6, @5, @7); $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)); }
+ FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *$2, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); setStatementLocation($6, @5, @7); $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)->body()); }
| FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
- {
- $$ = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *$2, $7, LEXER->sourceCode($6, $8, @6.first_line), $4.m_node.head), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features | ClosureFeature, 0);
+ {
+ $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *$2, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line), $4.m_node.head), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features | ClosureFeature, 0);
if ($4.m_features & ArgumentsFeature)
- $7->setUsesArguments();
- DBG($7, @6, @8);
- $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node));
+ $7->setUsesArguments();
+ setStatementLocation($7, @6, @8);
+ $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)->body());
}
;
FunctionExpr:
- FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, LEXER->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); DBG($5, @4, @6); }
- | FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
- {
- $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, LEXER->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0);
- if ($3.m_features & ArgumentsFeature)
+ FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, GLOBAL_DATA->lexer->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); setStatementLocation($5, @4, @6); }
+ | FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
+ {
+ $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0);
+ if ($3.m_features & ArgumentsFeature)
$6->setUsesArguments();
- DBG($6, @5, @7);
+ setStatementLocation($6, @5, @7);
}
- | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *$2, $6, LEXER->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); DBG($6, @5, @7); }
- | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
- {
- $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *$2, $7, LEXER->sourceCode($6, $8, @6.first_line), $4.m_node.head), $4.m_features | ClosureFeature, 0);
+ | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *$2, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); setStatementLocation($6, @5, @7); }
+ | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
+ {
+ $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *$2, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line), $4.m_node.head), $4.m_features | ClosureFeature, 0);
if ($4.m_features & ArgumentsFeature)
$7->setUsesArguments();
- DBG($7, @6, @8);
+ setStatementLocation($7, @6, @8);
}
;
@@ -1241,8 +1250,8 @@ Literal_NoNode:
| FALSETOKEN
| NUMBER { }
| STRING { }
- | '/' /* regexp */ { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; }
- | DIVEQUAL /* regexp with /= */ { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; }
+ | '/' /* regexp */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; }
+ | DIVEQUAL /* regexp with /= */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; }
;
Property_NoNode:
@@ -1824,26 +1833,28 @@ SourceElements_NoNode:
%%
-static ExpressionNode* makeAssignNode(void* globalPtr, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
+#undef GLOBAL_DATA
+
+static ExpressionNode* makeAssignNode(JSGlobalData* globalData, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
{
if (!loc->isLocation())
- return new (GLOBAL_DATA) AssignErrorNode(GLOBAL_DATA, loc, op, expr, divot, divot - start, end - divot);
+ return new (globalData) AssignErrorNode(globalData, loc, op, expr, divot, divot - start, end - divot);
if (loc->isResolveNode()) {
ResolveNode* resolve = static_cast<ResolveNode*>(loc);
if (op == OpEqual) {
- AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, resolve->identifier(), expr, exprHasAssignments);
- SET_EXCEPTION_LOCATION(node, start, divot, end);
+ AssignResolveNode* node = new (globalData) AssignResolveNode(globalData, resolve->identifier(), expr, exprHasAssignments);
+ setExceptionLocation(node, start, divot, end);
return node;
} else
- return new (GLOBAL_DATA) ReadModifyResolveNode(GLOBAL_DATA, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
+ return new (globalData) ReadModifyResolveNode(globalData, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
}
if (loc->isBracketAccessorNode()) {
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc);
if (op == OpEqual)
- return new (GLOBAL_DATA) AssignBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
+ return new (globalData) AssignBracketNode(globalData, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
else {
- ReadModifyBracketNode* node = new (GLOBAL_DATA) ReadModifyBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot);
+ ReadModifyBracketNode* node = new (globalData) ReadModifyBracketNode(globalData, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot);
node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
return node;
}
@@ -1851,117 +1862,117 @@ static ExpressionNode* makeAssignNode(void* globalPtr, ExpressionNode* loc, Oper
ASSERT(loc->isDotAccessorNode());
DotAccessorNode* dot = static_cast<DotAccessorNode*>(loc);
if (op == OpEqual)
- return new (GLOBAL_DATA) AssignDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
+ return new (globalData) AssignDotNode(globalData, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
- ReadModifyDotNode* node = new (GLOBAL_DATA) ReadModifyDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
+ ReadModifyDotNode* node = new (globalData) ReadModifyDotNode(globalData, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
node->setSubexpressionInfo(dot->divot(), dot->endOffset());
return node;
}
-static ExpressionNode* makePrefixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
+static ExpressionNode* makePrefixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
{
if (!expr->isLocation())
- return new (GLOBAL_DATA) PrefixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
+ return new (globalData) PrefixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
if (expr->isResolveNode()) {
ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (GLOBAL_DATA) PrefixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot);
+ return new (globalData) PrefixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
}
if (expr->isBracketAccessorNode()) {
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
- PrefixBracketNode* node = new (GLOBAL_DATA) PrefixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
+ PrefixBracketNode* node = new (globalData) PrefixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
node->setSubexpressionInfo(bracket->divot(), bracket->startOffset());
return node;
}
ASSERT(expr->isDotAccessorNode());
DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
- PrefixDotNode* node = new (GLOBAL_DATA) PrefixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
+ PrefixDotNode* node = new (globalData) PrefixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
node->setSubexpressionInfo(dot->divot(), dot->startOffset());
return node;
}
-static ExpressionNode* makePostfixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
+static ExpressionNode* makePostfixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
{
if (!expr->isLocation())
- return new (GLOBAL_DATA) PostfixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
+ return new (globalData) PostfixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
if (expr->isResolveNode()) {
ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (GLOBAL_DATA) PostfixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot);
+ return new (globalData) PostfixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
}
if (expr->isBracketAccessorNode()) {
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
- PostfixBracketNode* node = new (GLOBAL_DATA) PostfixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
+ PostfixBracketNode* node = new (globalData) PostfixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
return node;
}
ASSERT(expr->isDotAccessorNode());
DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
- PostfixDotNode* node = new (GLOBAL_DATA) PostfixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
+ PostfixDotNode* node = new (globalData) PostfixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
node->setSubexpressionInfo(dot->divot(), dot->endOffset());
return node;
}
-static ExpressionNodeInfo makeFunctionCallNode(void* globalPtr, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end)
+static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData* globalData, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end)
{
CodeFeatures features = func.m_features | args.m_features;
int numConstants = func.m_numConstants + args.m_numConstants;
if (!func.m_node->isLocation())
- return createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) FunctionCallValueNode(GLOBAL_DATA, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants);
+ return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallValueNode(globalData, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants);
if (func.m_node->isResolveNode()) {
ResolveNode* resolve = static_cast<ResolveNode*>(func.m_node);
const Identifier& identifier = resolve->identifier();
- if (identifier == GLOBAL_DATA->propertyNames->eval)
- return createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EvalFunctionCallNode(GLOBAL_DATA, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants);
- return createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) FunctionCallResolveNode(GLOBAL_DATA, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants);
+ if (identifier == globalData->propertyNames->eval)
+ return createNodeInfo<ExpressionNode*>(new (globalData) EvalFunctionCallNode(globalData, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants);
+ return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallResolveNode(globalData, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants);
}
if (func.m_node->isBracketAccessorNode()) {
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func.m_node);
- FunctionCallBracketNode* node = new (GLOBAL_DATA) FunctionCallBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot);
+ FunctionCallBracketNode* node = new (globalData) FunctionCallBracketNode(globalData, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot);
node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
return createNodeInfo<ExpressionNode*>(node, features, numConstants);
}
ASSERT(func.m_node->isDotAccessorNode());
DotAccessorNode* dot = static_cast<DotAccessorNode*>(func.m_node);
FunctionCallDotNode* node;
- if (dot->identifier() == GLOBAL_DATA->propertyNames->call)
- node = new (GLOBAL_DATA) CallFunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
- else if (dot->identifier() == GLOBAL_DATA->propertyNames->apply)
- node = new (GLOBAL_DATA) ApplyFunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
+ if (dot->identifier() == globalData->propertyNames->call)
+ node = new (globalData) CallFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
+ else if (dot->identifier() == globalData->propertyNames->apply)
+ node = new (globalData) ApplyFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
else
- node = new (GLOBAL_DATA) FunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
+ node = new (globalData) FunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
node->setSubexpressionInfo(dot->divot(), dot->endOffset());
return createNodeInfo<ExpressionNode*>(node, features, numConstants);
}
-static ExpressionNode* makeTypeOfNode(void* globalPtr, ExpressionNode* expr)
+static ExpressionNode* makeTypeOfNode(JSGlobalData* globalData, ExpressionNode* expr)
{
if (expr->isResolveNode()) {
ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (GLOBAL_DATA) TypeOfResolveNode(GLOBAL_DATA, resolve->identifier());
+ return new (globalData) TypeOfResolveNode(globalData, resolve->identifier());
}
- return new (GLOBAL_DATA) TypeOfValueNode(GLOBAL_DATA, expr);
+ return new (globalData) TypeOfValueNode(globalData, expr);
}
-static ExpressionNode* makeDeleteNode(void* globalPtr, ExpressionNode* expr, int start, int divot, int end)
+static ExpressionNode* makeDeleteNode(JSGlobalData* globalData, ExpressionNode* expr, int start, int divot, int end)
{
if (!expr->isLocation())
- return new (GLOBAL_DATA) DeleteValueNode(GLOBAL_DATA, expr);
+ return new (globalData) DeleteValueNode(globalData, expr);
if (expr->isResolveNode()) {
ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (GLOBAL_DATA) DeleteResolveNode(GLOBAL_DATA, resolve->identifier(), divot, divot - start, end - divot);
+ return new (globalData) DeleteResolveNode(globalData, resolve->identifier(), divot, divot - start, end - divot);
}
if (expr->isBracketAccessorNode()) {
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
- return new (GLOBAL_DATA) DeleteBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
+ return new (globalData) DeleteBracketNode(globalData, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
}
ASSERT(expr->isDotAccessorNode());
DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
- return new (GLOBAL_DATA) DeleteDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), divot, divot - start, end - divot);
+ return new (globalData) DeleteDotNode(globalData, dot->base(), dot->identifier(), divot, divot - start, end - divot);
}
-static PropertyNode* makeGetterOrSetterPropertyNode(void* globalPtr, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source)
+static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData* globalData, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source)
{
PropertyNode::Type type;
if (getOrSet == "get")
@@ -1970,10 +1981,10 @@ static PropertyNode* makeGetterOrSetterPropertyNode(void* globalPtr, const Ident
type = PropertyNode::Setter;
else
return 0;
- return new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, name, new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, body, source, params), type);
+ return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames->nullIdentifier, body, source, params), type);
}
-static ExpressionNode* makeNegateNode(void* globalPtr, ExpressionNode* n)
+static ExpressionNode* makeNegateNode(JSGlobalData* globalData, ExpressionNode* n)
{
if (n->isNumber()) {
NumberNode* number = static_cast<NumberNode*>(n);
@@ -1984,92 +1995,92 @@ static ExpressionNode* makeNegateNode(void* globalPtr, ExpressionNode* n)
}
}
- return new (GLOBAL_DATA) NegateNode(GLOBAL_DATA, n);
+ return new (globalData) NegateNode(globalData, n);
}
-static NumberNode* makeNumberNode(void* globalPtr, double d)
+static NumberNode* makeNumberNode(JSGlobalData* globalData, double d)
{
- return new (GLOBAL_DATA) NumberNode(GLOBAL_DATA, d);
+ return new (globalData) NumberNode(globalData, d);
}
-static ExpressionNode* makeBitwiseNotNode(void* globalPtr, ExpressionNode* expr)
+static ExpressionNode* makeBitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr)
{
if (expr->isNumber())
- return makeNumberNode(globalPtr, ~toInt32(static_cast<NumberNode*>(expr)->value()));
- return new (GLOBAL_DATA) BitwiseNotNode(GLOBAL_DATA, expr);
+ return makeNumberNode(globalData, ~toInt32(static_cast<NumberNode*>(expr)->value()));
+ return new (globalData) BitwiseNotNode(globalData, expr);
}
-static ExpressionNode* makeMultNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+static ExpressionNode* makeMultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{
expr1 = expr1->stripUnaryPlus();
expr2 = expr2->stripUnaryPlus();
if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value());
+ return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value());
if (expr1->isNumber() && static_cast<NumberNode*>(expr1)->value() == 1)
- return new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, expr2);
+ return new (globalData) UnaryPlusNode(globalData, expr2);
if (expr2->isNumber() && static_cast<NumberNode*>(expr2)->value() == 1)
- return new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, expr1);
+ return new (globalData) UnaryPlusNode(globalData, expr1);
- return new (GLOBAL_DATA) MultNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
+ return new (globalData) MultNode(globalData, expr1, expr2, rightHasAssignments);
}
-static ExpressionNode* makeDivNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+static ExpressionNode* makeDivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{
expr1 = expr1->stripUnaryPlus();
expr2 = expr2->stripUnaryPlus();
if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value());
- return new (GLOBAL_DATA) DivNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
+ return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value());
+ return new (globalData) DivNode(globalData, expr1, expr2, rightHasAssignments);
}
-static ExpressionNode* makeAddNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+static ExpressionNode* makeAddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{
if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value());
- return new (GLOBAL_DATA) AddNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
+ return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value());
+ return new (globalData) AddNode(globalData, expr1, expr2, rightHasAssignments);
}
-static ExpressionNode* makeSubNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+static ExpressionNode* makeSubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{
expr1 = expr1->stripUnaryPlus();
expr2 = expr2->stripUnaryPlus();
if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value());
- return new (GLOBAL_DATA) SubNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
+ return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value());
+ return new (globalData) SubNode(globalData, expr1, expr2, rightHasAssignments);
}
-static ExpressionNode* makeLeftShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+static ExpressionNode* makeLeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{
if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalPtr, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
- return new (GLOBAL_DATA) LeftShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
+ return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
+ return new (globalData) LeftShiftNode(globalData, expr1, expr2, rightHasAssignments);
}
-static ExpressionNode* makeRightShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+static ExpressionNode* makeRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{
if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalPtr, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
- return new (GLOBAL_DATA) RightShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
+ return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
+ return new (globalData) RightShiftNode(globalData, expr1, expr2, rightHasAssignments);
}
-/* called by yyparse on error */
-int yyerror(const char *)
+// Called by yyparse on error.
+int yyerror(const char*)
{
return 1;
}
-/* may we automatically insert a semicolon ? */
+// May we automatically insert a semicolon?
static bool allowAutomaticSemicolon(Lexer& lexer, int yychar)
{
return yychar == CLOSEBRACE || yychar == 0 || lexer.prevTerminator();
}
-static ExpressionNode* combineCommaNodes(void* globalPtr, ExpressionNode* list, ExpressionNode* init)
+static ExpressionNode* combineCommaNodes(JSGlobalData* globalData, ExpressionNode* list, ExpressionNode* init)
{
if (!list)
return init;
@@ -2077,17 +2088,15 @@ static ExpressionNode* combineCommaNodes(void* globalPtr, ExpressionNode* list,
static_cast<CommaNode*>(list)->append(init);
return list;
}
- return new (GLOBAL_DATA) CommaNode(GLOBAL_DATA, list, init);
+ return new (globalData) CommaNode(globalData, list, init);
}
// We turn variable declarations into either assignments or empty
// statements (which later get stripped out), because the actual
// declaration work is hoisted up to the start of the function body
-static StatementNode* makeVarStatementNode(void* globalPtr, ExpressionNode* expr)
+static StatementNode* makeVarStatementNode(JSGlobalData* globalData, ExpressionNode* expr)
{
if (!expr)
- return new (GLOBAL_DATA) EmptyStatementNode(GLOBAL_DATA);
- return new (GLOBAL_DATA) VarStatementNode(GLOBAL_DATA, expr);
+ return new (globalData) EmptyStatementNode(globalData);
+ return new (globalData) VarStatementNode(globalData, expr);
}
-
-#undef GLOBAL_DATA
diff --git a/JavaScriptCore/parser/Lexer.cpp b/JavaScriptCore/parser/Lexer.cpp
index 8e89c18..785b219 100644
--- a/JavaScriptCore/parser/Lexer.cpp
+++ b/JavaScriptCore/parser/Lexer.cpp
@@ -141,8 +141,10 @@ ALWAYS_INLINE void Lexer::shift4()
m_code += 4;
}
-void Lexer::setCode(const SourceCode& source)
+void Lexer::setCode(const SourceCode& source, ParserArena& arena)
{
+ m_arena = &arena.identifierArena();
+
m_lineNumber = source.firstLine();
m_delimited = false;
m_lastToken = -1;
@@ -204,10 +206,9 @@ void Lexer::shiftLineTerminator()
++m_lineNumber;
}
-ALWAYS_INLINE Identifier* Lexer::makeIdentifier(const UChar* characters, size_t length)
+ALWAYS_INLINE const Identifier* Lexer::makeIdentifier(const UChar* characters, size_t length)
{
- m_identifiers.append(Identifier(m_globalData, characters, length));
- return &m_identifiers.last();
+ return &m_arena->makeIdentifier(m_globalData, characters, length);
}
inline bool Lexer::lastTokenWasRestrKeyword() const
@@ -908,48 +909,110 @@ returnError:
return -1;
}
-bool Lexer::scanRegExp()
+bool Lexer::scanRegExp(const Identifier*& pattern, const Identifier*& flags, UChar patternPrefix)
{
ASSERT(m_buffer16.isEmpty());
bool lastWasEscape = false;
bool inBrackets = false;
+ if (patternPrefix) {
+ ASSERT(!isLineTerminator(patternPrefix));
+ ASSERT(patternPrefix != '/');
+ ASSERT(patternPrefix != '[');
+ record16(patternPrefix);
+ }
+
while (true) {
- if (isLineTerminator(m_current) || m_current == -1)
- return false;
- if (m_current != '/' || lastWasEscape || inBrackets) {
- // keep track of '[' and ']'
- if (!lastWasEscape) {
- if (m_current == '[' && !inBrackets)
- inBrackets = true;
- if (m_current == ']' && inBrackets)
- inBrackets = false;
- }
- record16(m_current);
- lastWasEscape = !lastWasEscape && m_current == '\\';
- } else { // end of regexp
- m_pattern = UString(m_buffer16);
+ int current = m_current;
+
+ if (isLineTerminator(current) || current == -1) {
m_buffer16.resize(0);
- shift1();
- break;
+ return false;
}
+
shift1();
+
+ if (current == '/' && !lastWasEscape && !inBrackets)
+ break;
+
+ record16(current);
+
+ if (lastWasEscape) {
+ lastWasEscape = false;
+ continue;
+ }
+
+ switch (current) {
+ case '[':
+ inBrackets = true;
+ break;
+ case ']':
+ inBrackets = false;
+ break;
+ case '\\':
+ lastWasEscape = true;
+ break;
+ }
}
+ pattern = makeIdentifier(m_buffer16.data(), m_buffer16.size());
+ m_buffer16.resize(0);
+
while (isIdentPart(m_current)) {
record16(m_current);
shift1();
}
- m_flags = UString(m_buffer16);
+
+ flags = makeIdentifier(m_buffer16.data(), m_buffer16.size());
m_buffer16.resize(0);
return true;
}
+bool Lexer::skipRegExp()
+{
+ bool lastWasEscape = false;
+ bool inBrackets = false;
+
+ while (true) {
+ int current = m_current;
+
+ if (isLineTerminator(current) || current == -1)
+ return false;
+
+ shift1();
+
+ if (current == '/' && !lastWasEscape && !inBrackets)
+ break;
+
+ if (lastWasEscape) {
+ lastWasEscape = false;
+ continue;
+ }
+
+ switch (current) {
+ case '[':
+ inBrackets = true;
+ break;
+ case ']':
+ inBrackets = false;
+ break;
+ case '\\':
+ lastWasEscape = true;
+ break;
+ }
+ }
+
+ while (isIdentPart(m_current))
+ shift1();
+
+ return true;
+}
+
void Lexer::clear()
{
- m_identifiers.clear();
+ m_arena = 0;
m_codeWithoutBOMs.clear();
Vector<char> newBuffer8;
@@ -961,9 +1024,6 @@ void Lexer::clear()
m_buffer16.swap(newBuffer16);
m_isReparsing = false;
-
- m_pattern = UString();
- m_flags = UString();
}
SourceCode Lexer::sourceCode(int openBrace, int closeBrace, int firstLine)
diff --git a/JavaScriptCore/parser/Lexer.h b/JavaScriptCore/parser/Lexer.h
index 2583162..174e05a 100644
--- a/JavaScriptCore/parser/Lexer.h
+++ b/JavaScriptCore/parser/Lexer.h
@@ -23,6 +23,7 @@
#define Lexer_h
#include "Lookup.h"
+#include "ParserArena.h"
#include "SourceCode.h"
#include <wtf/ASCIICType.h>
#include <wtf/SegmentedVector.h>
@@ -42,7 +43,7 @@ namespace JSC {
static UChar convertUnicode(int c1, int c2, int c3, int c4);
// Functions to set up parsing.
- void setCode(const SourceCode&);
+ void setCode(const SourceCode&, ParserArena&);
void setIsReparsing() { m_isReparsing = true; }
// Functions for the parser itself.
@@ -50,9 +51,8 @@ namespace JSC {
int lineNumber() const { return m_lineNumber; }
bool prevTerminator() const { return m_terminator; }
SourceCode sourceCode(int openBrace, int closeBrace, int firstLine);
- bool scanRegExp();
- const UString& pattern() const { return m_pattern; }
- const UString& flags() const { return m_flags; }
+ bool scanRegExp(const Identifier*& pattern, const Identifier*& flags, UChar patternPrefix = 0);
+ bool skipRegExp();
// Functions for use after parsing.
bool sawError() const { return m_error; }
@@ -79,12 +79,11 @@ namespace JSC {
int currentOffset() const;
const UChar* currentCharacter() const;
- JSC::Identifier* makeIdentifier(const UChar* buffer, size_t length);
+ const Identifier* makeIdentifier(const UChar* characters, size_t length);
bool lastTokenWasRestrKeyword() const;
static const size_t initialReadBufferCapacity = 32;
- static const size_t initialIdentifierTableCapacity = 64;
int m_lineNumber;
@@ -108,13 +107,10 @@ namespace JSC {
int m_next2;
int m_next3;
- WTF::SegmentedVector<JSC::Identifier, initialIdentifierTableCapacity> m_identifiers;
+ IdentifierArena* m_arena;
JSGlobalData* m_globalData;
- UString m_pattern;
- UString m_flags;
-
const HashTable m_keywordTable;
Vector<UChar> m_codeWithoutBOMs;
diff --git a/JavaScriptCore/parser/NodeConstructors.h b/JavaScriptCore/parser/NodeConstructors.h
index 780a624..dd3b981 100644
--- a/JavaScriptCore/parser/NodeConstructors.h
+++ b/JavaScriptCore/parser/NodeConstructors.h
@@ -27,21 +27,14 @@
namespace JSC {
- inline void* ParserArenaDeletable::operator new(size_t size, JSGlobalData* globalData)
+ inline void* ParserArenaFreeable::operator new(size_t size, JSGlobalData* globalData)
{
- ParserArenaDeletable* deletable = static_cast<ParserArenaDeletable*>(fastMalloc(size));
- globalData->parser->arena().deleteWithArena(deletable);
- return deletable;
+ return globalData->parser->arena().allocateFreeable(size);
}
- inline void* ParserArenaDeletable::operator new(size_t size)
- {
- return fastMalloc(size);
- }
-
- inline void ParserArenaDeletable::operator delete(void* p)
+ inline void* ParserArenaDeletable::operator new(size_t size, JSGlobalData* globalData)
{
- fastFree(p);
+ return globalData->parser->arena().allocateDeletable(size);
}
inline ParserArenaRefCounted::ParserArenaRefCounted(JSGlobalData* globalData)
@@ -77,19 +70,19 @@ namespace JSC {
{
}
- inline NumberNode::NumberNode(JSGlobalData* globalData, double v)
+ inline NumberNode::NumberNode(JSGlobalData* globalData, double value)
: ExpressionNode(globalData, ResultType::numberType())
- , m_double(v)
+ , m_value(value)
{
}
- inline StringNode::StringNode(JSGlobalData* globalData, const Identifier& v)
+ inline StringNode::StringNode(JSGlobalData* globalData, const Identifier& value)
: ExpressionNode(globalData, ResultType::stringType())
- , m_value(v)
+ , m_value(value)
{
}
- inline RegExpNode::RegExpNode(JSGlobalData* globalData, const UString& pattern, const UString& flags)
+ inline RegExpNode::RegExpNode(JSGlobalData* globalData, const Identifier& pattern, const Identifier& flags)
: ExpressionNode(globalData)
, m_pattern(pattern)
, m_flags(flags)
@@ -154,6 +147,13 @@ namespace JSC {
{
}
+ inline PropertyNode::PropertyNode(JSGlobalData* globalData, double name, ExpressionNode* assign, Type type)
+ : m_name(globalData->parser->arena().identifierArena().makeNumericIdentifier(globalData, name))
+ , m_assign(assign)
+ , m_type(type)
+ {
+ }
+
inline PropertyListNode::PropertyListNode(JSGlobalData* globalData, PropertyNode* node)
: Node(globalData)
, m_node(node)
@@ -741,6 +741,7 @@ namespace JSC {
inline ContinueNode::ContinueNode(JSGlobalData* globalData)
: StatementNode(globalData)
+ , m_ident(globalData->propertyNames->nullIdentifier)
{
}
@@ -752,6 +753,7 @@ namespace JSC {
inline BreakNode::BreakNode(JSGlobalData* globalData)
: StatementNode(globalData)
+ , m_ident(globalData->propertyNames->nullIdentifier)
{
}
@@ -814,32 +816,22 @@ namespace JSC {
inline FuncExprNode::FuncExprNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
: ExpressionNode(globalData)
- , ParserArenaRefCounted(globalData)
- , m_ident(ident)
, m_body(body)
{
- m_body->finishParsing(source, parameter);
+ m_body->finishParsing(source, parameter, ident);
}
inline FuncDeclNode::FuncDeclNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
: StatementNode(globalData)
- , ParserArenaRefCounted(globalData)
- , m_ident(ident)
, m_body(body)
{
- m_body->finishParsing(source, parameter);
- }
-
- inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr)
- : m_expr(expr)
- {
+ m_body->finishParsing(source, parameter, ident);
}
- inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr, SourceElements* children)
+ inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr, SourceElements* statements)
: m_expr(expr)
+ , m_statements(statements)
{
- if (children)
- children->releaseContentsIntoVector(m_children);
}
inline ClauseListNode::ClauseListNode(JSGlobalData*, CaseClauseNode* clause)
@@ -877,15 +869,15 @@ namespace JSC {
{
}
- inline BlockNode::BlockNode(JSGlobalData* globalData, SourceElements* children)
+ inline BlockNode::BlockNode(JSGlobalData* globalData, SourceElements* statements)
: StatementNode(globalData)
+ , m_statements(statements)
{
- if (children)
- children->releaseContentsIntoVector(m_children);
}
inline ForInNode::ForInNode(JSGlobalData* globalData, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement)
: StatementNode(globalData)
+ , m_ident(globalData->propertyNames->nullIdentifier)
, m_init(0)
, m_lexpr(l)
, m_expr(expr)
diff --git a/JavaScriptCore/parser/Nodes.cpp b/JavaScriptCore/parser/Nodes.cpp
index 4324a06..3bd318a 100644
--- a/JavaScriptCore/parser/Nodes.cpp
+++ b/JavaScriptCore/parser/Nodes.cpp
@@ -49,7 +49,28 @@ using namespace WTF;
namespace JSC {
-static void substitute(UString& string, const UString& substring);
+/*
+ Details of the emitBytecode function.
+
+ Return value: The register holding the production's value.
+ dst: An optional parameter specifying the most efficient destination at
+ which to store the production's value. The callee must honor dst.
+
+ The dst argument provides for a crude form of copy propagation. For example,
+
+ x = 1
+
+ becomes
+
+ load r[x], 1
+
+ instead of
+
+ load r0, 1
+ mov r[x], r0
+
+ because the assignment node, "x =", passes r[x] as dst to the number node, "1".
+*/
// ------------------------------ ThrowableExpressionData --------------------------------
@@ -63,24 +84,29 @@ static void substitute(UString& string, const UString& substring)
string = newString;
}
-RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType e, const char* msg)
+RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType type, const char* message)
{
generator.emitExpressionInfo(divot(), startOffset(), endOffset());
- RegisterID* exception = generator.emitNewError(generator.newTemporary(), e, jsString(generator.globalData(), msg));
+ RegisterID* exception = generator.emitNewError(generator.newTemporary(), type, jsString(generator.globalData(), message));
generator.emitThrow(exception);
return exception;
}
-RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType e, const char* msg, const Identifier& label)
+RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType type, const char* messageTemplate, const UString& label)
{
- UString message = msg;
- substitute(message, label.ustring());
+ UString message = messageTemplate;
+ substitute(message, label);
generator.emitExpressionInfo(divot(), startOffset(), endOffset());
- RegisterID* exception = generator.emitNewError(generator.newTemporary(), e, jsString(generator.globalData(), message));
+ RegisterID* exception = generator.emitNewError(generator.newTemporary(), type, jsString(generator.globalData(), message));
generator.emitThrow(exception);
return exception;
}
+inline RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType type, const char* messageTemplate, const Identifier& label)
+{
+ return emitThrowError(generator, type, messageTemplate, label.ustring());
+}
+
// ------------------------------ StatementNode --------------------------------
void StatementNode::setLoc(int firstLine, int lastLine)
@@ -98,6 +124,18 @@ void SourceElements::append(StatementNode* statement)
m_statements.append(statement);
}
+inline StatementNode* SourceElements::singleStatement() const
+{
+ size_t size = m_statements.size();
+ return size == 1 ? m_statements[0] : 0;
+}
+
+inline StatementNode* SourceElements::lastStatement() const
+{
+ size_t size = m_statements.size();
+ return size ? m_statements[size - 1] : 0;
+}
+
// ------------------------------ NullNode -------------------------------------
RegisterID* NullNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
@@ -122,7 +160,7 @@ RegisterID* NumberNode::emitBytecode(BytecodeGenerator& generator, RegisterID* d
{
if (dst == generator.ignoredResult())
return 0;
- return generator.emitLoad(dst, m_double);
+ return generator.emitLoad(dst, m_value);
}
// ------------------------------ StringNode -----------------------------------
@@ -138,9 +176,9 @@ RegisterID* StringNode::emitBytecode(BytecodeGenerator& generator, RegisterID* d
RegisterID* RegExpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
{
- RefPtr<RegExp> regExp = RegExp::create(generator.globalData(), m_pattern, m_flags);
+ RefPtr<RegExp> regExp = RegExp::create(generator.globalData(), m_pattern.ustring(), m_flags.ustring());
if (!regExp->isValid())
- return emitThrowError(generator, SyntaxError, ("Invalid regular expression: " + UString(regExp->errorMessage())).UTF8String().c_str());
+ return emitThrowError(generator, SyntaxError, "Invalid regular expression: %s", regExp->errorMessage());
if (dst == generator.ignoredResult())
return 0;
return generator.emitNewRegExp(generator.finalDestination(dst), regExp.get());
@@ -596,7 +634,9 @@ RegisterID* PostfixDotNode::emitBytecode(BytecodeGenerator& generator, RegisterI
RegisterID* PostfixErrorNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
{
- return emitThrowError(generator, ReferenceError, m_operator == OpPlusPlus ? "Postfix ++ operator applied to value that is not a reference." : "Postfix -- operator applied to value that is not a reference.");
+ return emitThrowError(generator, ReferenceError, m_operator == OpPlusPlus
+ ? "Postfix ++ operator applied to value that is not a reference."
+ : "Postfix -- operator applied to value that is not a reference.");
}
// ------------------------------ DeleteResolveNode -----------------------------------
@@ -758,7 +798,9 @@ RegisterID* PrefixDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID
RegisterID* PrefixErrorNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
{
- return emitThrowError(generator, ReferenceError, m_operator == OpPlusPlus ? "Prefix ++ operator applied to value that is not a reference." : "Prefix -- operator applied to value that is not a reference.");
+ return emitThrowError(generator, ReferenceError, m_operator == OpPlusPlus
+ ? "Prefix ++ operator applied to value that is not a reference."
+ : "Prefix -- operator applied to value that is not a reference.");
}
// ------------------------------ Unary Operation Nodes -----------------------------------
@@ -1205,7 +1247,13 @@ RegisterID* ConstDeclNode::emitCodeSingle(BytecodeGenerator& generator)
return generator.emitNode(local, m_init);
}
-
+
+ if (generator.codeType() != EvalCode) {
+ if (m_init)
+ return generator.emitNode(m_init);
+ else
+ return generator.emitResolve(generator.newTemporary(), m_ident);
+ }
// FIXME: While this code should only be hit in eval code, it will potentially
// assign to the wrong base if m_ident exists in an intervening dynamic scope.
RefPtr<RegisterID> base = generator.emitResolveBase(generator.newTemporary(), m_ident);
@@ -1230,20 +1278,26 @@ RegisterID* ConstStatementNode::emitBytecode(BytecodeGenerator& generator, Regis
return generator.emitNode(m_next);
}
-// ------------------------------ Helper functions for handling Vectors of StatementNode -------------------------------
+// ------------------------------ SourceElements -------------------------------
-static inline void statementListEmitCode(const StatementVector& statements, BytecodeGenerator& generator, RegisterID* dst)
+inline void SourceElements::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
{
- size_t size = statements.size();
+ size_t size = m_statements.size();
for (size_t i = 0; i < size; ++i)
- generator.emitNode(dst, statements[i]);
+ generator.emitNode(dst, m_statements[i]);
}
// ------------------------------ BlockNode ------------------------------------
+inline StatementNode* BlockNode::lastStatement() const
+{
+ return m_statements ? m_statements->lastStatement() : 0;
+}
+
RegisterID* BlockNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
{
- statementListEmitCode(m_children, generator, dst);
+ if (m_statements)
+ m_statements->emitBytecode(generator, dst);
return 0;
}
@@ -1545,6 +1599,14 @@ RegisterID* WithNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst
return result;
}
+// ------------------------------ CaseClauseNode --------------------------------
+
+inline void CaseClauseNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (m_statements)
+ m_statements->emitBytecode(generator, dst);
+}
+
// ------------------------------ CaseBlockNode --------------------------------
enum SwitchKind {
@@ -1664,17 +1726,17 @@ RegisterID* CaseBlockNode::emitBytecodeForBlock(BytecodeGenerator& generator, Re
size_t i = 0;
for (ClauseListNode* list = m_list1; list; list = list->getNext()) {
generator.emitLabel(labelVector[i++].get());
- statementListEmitCode(list->getClause()->children(), generator, dst);
+ list->getClause()->emitBytecode(generator, dst);
}
if (m_defaultClause) {
generator.emitLabel(defaultLabel.get());
- statementListEmitCode(m_defaultClause->children(), generator, dst);
+ m_defaultClause->emitBytecode(generator, dst);
}
for (ClauseListNode* list = m_list2; list; list = list->getNext()) {
generator.emitLabel(labelVector[i++].get());
- statementListEmitCode(list->getClause()->children(), generator, dst);
+ list->getClause()->emitBytecode(generator, dst);
}
if (!m_defaultClause)
generator.emitLabel(defaultLabel.get());
@@ -1806,27 +1868,15 @@ RegisterID* TryNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
// -----------------------------ScopeNodeData ---------------------------
-ScopeNodeData::ScopeNodeData(ParserArena& arena, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, int numConstants)
+ScopeNodeData::ScopeNodeData(ParserArena& arena, SourceElements* statements, VarStack* varStack, FunctionStack* funcStack, int numConstants)
: m_numConstants(numConstants)
+ , m_statements(statements)
{
m_arena.swap(arena);
if (varStack)
m_varStack.swap(*varStack);
if (funcStack)
m_functionStack.swap(*funcStack);
- if (children)
- children->releaseContentsIntoVector(m_children);
-}
-
-void ScopeNodeData::markAggregate(MarkStack& markStack)
-{
- FunctionStack::iterator end = m_functionStack.end();
- for (FunctionStack::iterator ptr = m_functionStack.begin(); ptr != end; ++ptr) {
- FunctionBodyNode* body = (*ptr)->body();
- if (!body->isGenerated())
- continue;
- body->generatedBytecode().markAggregate(markStack);
- }
}
// ------------------------------ ScopeNode -----------------------------
@@ -1836,10 +1886,6 @@ ScopeNode::ScopeNode(JSGlobalData* globalData)
, ParserArenaRefCounted(globalData)
, m_features(NoFeatures)
{
-#if ENABLE(CODEBLOCK_SAMPLING)
- if (SamplingTool* sampler = globalData->interpreter->sampler())
- sampler->notifyOfScope(this);
-#endif
}
ScopeNode::ScopeNode(JSGlobalData* globalData, const SourceCode& source, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, CodeFeatures features, int numConstants)
@@ -1849,10 +1895,17 @@ ScopeNode::ScopeNode(JSGlobalData* globalData, const SourceCode& source, SourceE
, m_features(features)
, m_source(source)
{
-#if ENABLE(CODEBLOCK_SAMPLING)
- if (SamplingTool* sampler = globalData->interpreter->sampler())
- sampler->notifyOfScope(this);
-#endif
+}
+
+inline void ScopeNode::emitStatementsBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (m_data->m_statements)
+ m_data->m_statements->emitBytecode(generator, dst);
+}
+
+StatementNode* ScopeNode::singleStatement() const
+{
+ return m_data->m_statements ? m_data->m_statements->singleStatement() : 0;
}
// ------------------------------ ProgramNode -----------------------------
@@ -1879,37 +1932,13 @@ RegisterID* ProgramNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
RefPtr<RegisterID> dstRegister = generator.newTemporary();
generator.emitLoad(dstRegister.get(), jsUndefined());
- statementListEmitCode(children(), generator, dstRegister.get());
+ emitStatementsBytecode(generator, dstRegister.get());
generator.emitDebugHook(DidExecuteProgram, firstLine(), lastLine());
generator.emitEnd(dstRegister.get());
return 0;
}
-void ProgramNode::generateBytecode(ScopeChainNode* scopeChainNode)
-{
- ScopeChain scopeChain(scopeChainNode);
- JSGlobalObject* globalObject = scopeChain.globalObject();
-
- m_code.set(new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider()));
-
- OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(this, globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_code.get()));
- generator->generate();
-
- destroyData();
-}
-
-#if ENABLE(JIT)
-void ProgramNode::generateJITCode(ScopeChainNode* scopeChainNode)
-{
- bytecode(scopeChainNode);
- ASSERT(m_code);
- ASSERT(!m_jitCode);
- JIT::compile(scopeChainNode->globalData, m_code.get());
- ASSERT(m_jitCode);
-}
-#endif
-
// ------------------------------ EvalNode -----------------------------
inline EvalNode::EvalNode(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, const SourceCode& source, CodeFeatures features, int numConstants)
@@ -1934,122 +1963,42 @@ RegisterID* EvalNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
RefPtr<RegisterID> dstRegister = generator.newTemporary();
generator.emitLoad(dstRegister.get(), jsUndefined());
- statementListEmitCode(children(), generator, dstRegister.get());
+ emitStatementsBytecode(generator, dstRegister.get());
generator.emitDebugHook(DidExecuteProgram, firstLine(), lastLine());
generator.emitEnd(dstRegister.get());
return 0;
}
-void EvalNode::generateBytecode(ScopeChainNode* scopeChainNode)
-{
- ScopeChain scopeChain(scopeChainNode);
- JSGlobalObject* globalObject = scopeChain.globalObject();
-
- m_code.set(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth()));
-
- OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get()));
- generator->generate();
-
- // Eval code needs to hang on to its declaration stacks to keep declaration info alive until Interpreter::execute time,
- // so the entire ScopeNodeData cannot be destoyed.
- children().clear();
-}
-
-EvalCodeBlock& EvalNode::bytecodeForExceptionInfoReparse(ScopeChainNode* scopeChainNode, CodeBlock* codeBlockBeingRegeneratedFrom)
-{
- ASSERT(!m_code);
-
- ScopeChain scopeChain(scopeChainNode);
- JSGlobalObject* globalObject = scopeChain.globalObject();
-
- m_code.set(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth()));
-
- OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get()));
- generator->setRegeneratingForExceptionInfo(codeBlockBeingRegeneratedFrom);
- generator->generate();
-
- return *m_code;
-}
-
-void EvalNode::markAggregate(MarkStack& markStack)
-{
- // We don't need to mark our own CodeBlock as the JSGlobalObject takes care of that
- data()->markAggregate(markStack);
-}
+// ------------------------------ FunctionBodyNode -----------------------------
-#if ENABLE(JIT)
-void EvalNode::generateJITCode(ScopeChainNode* scopeChainNode)
+FunctionParameters::FunctionParameters(ParameterNode* firstParameter)
{
- bytecode(scopeChainNode);
- ASSERT(m_code);
- ASSERT(!m_jitCode);
- JIT::compile(scopeChainNode->globalData, m_code.get());
- ASSERT(m_jitCode);
+ for (ParameterNode* parameter = firstParameter; parameter; parameter = parameter->nextParam())
+ append(parameter->ident());
}
-#endif
-
-// ------------------------------ FunctionBodyNode -----------------------------
inline FunctionBodyNode::FunctionBodyNode(JSGlobalData* globalData)
: ScopeNode(globalData)
- , m_parameters(0)
- , m_parameterCount(0)
{
}
inline FunctionBodyNode::FunctionBodyNode(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, const SourceCode& sourceCode, CodeFeatures features, int numConstants)
: ScopeNode(globalData, sourceCode, children, varStack, funcStack, features, numConstants)
- , m_parameters(0)
- , m_parameterCount(0)
{
}
-FunctionBodyNode::~FunctionBodyNode()
+void FunctionBodyNode::finishParsing(const SourceCode& source, ParameterNode* firstParameter, const Identifier& ident)
{
- for (size_t i = 0; i < m_parameterCount; ++i)
- m_parameters[i].~Identifier();
- fastFree(m_parameters);
-}
-
-void FunctionBodyNode::finishParsing(const SourceCode& source, ParameterNode* firstParameter)
-{
- Vector<Identifier> parameters;
- for (ParameterNode* parameter = firstParameter; parameter; parameter = parameter->nextParam())
- parameters.append(parameter->ident());
- size_t count = parameters.size();
-
setSource(source);
- finishParsing(parameters.releaseBuffer(), count);
+ finishParsing(FunctionParameters::create(firstParameter), ident);
}
-void FunctionBodyNode::finishParsing(Identifier* parameters, size_t parameterCount)
+void FunctionBodyNode::finishParsing(PassRefPtr<FunctionParameters> parameters, const Identifier& ident)
{
ASSERT(!source().isNull());
m_parameters = parameters;
- m_parameterCount = parameterCount;
-}
-
-void FunctionBodyNode::markAggregate(MarkStack& markStack)
-{
- if (m_code)
- m_code->markAggregate(markStack);
-}
-
-#if ENABLE(JIT)
-PassRefPtr<FunctionBodyNode> FunctionBodyNode::createNativeThunk(JSGlobalData* globalData)
-{
- RefPtr<FunctionBodyNode> body = new FunctionBodyNode(globalData);
- globalData->parser->arena().reset();
- body->m_code.set(new CodeBlock(body.get()));
- body->m_jitCode = JITCode(JITCode::HostFunction(globalData->jitStubs.ctiNativeCallThunk()));
- return body.release();
-}
-#endif
-
-bool FunctionBodyNode::isHostFunction() const
-{
- return m_code && m_code->codeType() == NativeCode;
+ m_ident = ident;
}
FunctionBodyNode* FunctionBodyNode::create(JSGlobalData* globalData)
@@ -2068,59 +2017,14 @@ PassRefPtr<FunctionBodyNode> FunctionBodyNode::create(JSGlobalData* globalData,
return node.release();
}
-void FunctionBodyNode::generateBytecode(ScopeChainNode* scopeChainNode)
-{
- // This branch is only necessary since you can still create a non-stub FunctionBodyNode by
- // calling Parser::parse<FunctionBodyNode>().
- if (!data())
- scopeChainNode->globalData->parser->reparseInPlace(scopeChainNode->globalData, this);
- ASSERT(data());
-
- ScopeChain scopeChain(scopeChainNode);
- JSGlobalObject* globalObject = scopeChain.globalObject();
-
- m_code.set(new CodeBlock(this, FunctionCode, source().provider(), source().startOffset()));
-
- OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get()));
- generator->generate();
-
- destroyData();
-}
-
-#if ENABLE(JIT)
-void FunctionBodyNode::generateJITCode(ScopeChainNode* scopeChainNode)
-{
- bytecode(scopeChainNode);
- ASSERT(m_code);
- ASSERT(!m_jitCode);
- JIT::compile(scopeChainNode->globalData, m_code.get());
- ASSERT(m_jitCode);
-}
-#endif
-
-CodeBlock& FunctionBodyNode::bytecodeForExceptionInfoReparse(ScopeChainNode* scopeChainNode, CodeBlock* codeBlockBeingRegeneratedFrom)
-{
- ASSERT(!m_code);
-
- ScopeChain scopeChain(scopeChainNode);
- JSGlobalObject* globalObject = scopeChain.globalObject();
-
- m_code.set(new CodeBlock(this, FunctionCode, source().provider(), source().startOffset()));
-
- OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get()));
- generator->setRegeneratingForExceptionInfo(codeBlockBeingRegeneratedFrom);
- generator->generate();
-
- return *m_code;
-}
-
RegisterID* FunctionBodyNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
{
generator.emitDebugHook(DidEnterCallFrame, firstLine(), lastLine());
- statementListEmitCode(children(), generator, generator.ignoredResult());
- if (children().size() && children().last()->isBlock()) {
- BlockNode* blockNode = static_cast<BlockNode*>(children().last());
- if (blockNode->children().size() && blockNode->children().last()->isReturnNode())
+ emitStatementsBytecode(generator, generator.ignoredResult());
+ StatementNode* singleStatement = this->singleStatement();
+ if (singleStatement && singleStatement->isBlock()) {
+ StatementNode* lastStatementInBlock = static_cast<BlockNode*>(singleStatement)->lastStatement();
+ if (lastStatementInBlock && lastStatementInBlock->isReturnNode())
return 0;
}
@@ -2130,32 +2034,8 @@ RegisterID* FunctionBodyNode::emitBytecode(BytecodeGenerator& generator, Registe
return 0;
}
-UString FunctionBodyNode::paramString() const
-{
- UString s("");
- for (size_t pos = 0; pos < m_parameterCount; ++pos) {
- if (!s.isEmpty())
- s += ", ";
- s += parameters()[pos].ustring();
- }
-
- return s;
-}
-
-Identifier* FunctionBodyNode::copyParameters()
-{
- Identifier* parameters = static_cast<Identifier*>(fastMalloc(m_parameterCount * sizeof(Identifier)));
- VectorCopier<false, Identifier>::uninitializedCopy(m_parameters, m_parameters + m_parameterCount, parameters);
- return parameters;
-}
-
// ------------------------------ FuncDeclNode ---------------------------------
-JSFunction* FuncDeclNode::makeFunction(ExecState* exec, ScopeChainNode* scopeChain)
-{
- return new (exec) JSFunction(exec, m_ident, m_body.get(), scopeChain);
-}
-
RegisterID* FuncDeclNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
{
if (dst == generator.ignoredResult())
@@ -2170,24 +2050,4 @@ RegisterID* FuncExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID*
return generator.emitNewFunctionExpression(generator.finalDestination(dst), this);
}
-JSFunction* FuncExprNode::makeFunction(ExecState* exec, ScopeChainNode* scopeChain)
-{
- JSFunction* func = new (exec) JSFunction(exec, m_ident, m_body.get(), scopeChain);
-
- /*
- The Identifier in a FunctionExpression can be referenced from inside
- the FunctionExpression's FunctionBody to allow the function to call
- itself recursively. However, unlike in a FunctionDeclaration, the
- Identifier in a FunctionExpression cannot be referenced from and
- does not affect the scope enclosing the FunctionExpression.
- */
-
- if (!m_ident.isNull()) {
- JSStaticScopeObject* functionScopeObject = new (exec) JSStaticScopeObject(exec, m_ident, func, ReadOnly | DontDelete);
- func->scope().push(functionScopeObject);
- }
-
- return func;
-}
-
} // namespace JSC
diff --git a/JavaScriptCore/parser/Nodes.h b/JavaScriptCore/parser/Nodes.h
index 703b384..be84c4a 100644
--- a/JavaScriptCore/parser/Nodes.h
+++ b/JavaScriptCore/parser/Nodes.h
@@ -34,21 +34,17 @@
#include "SourceCode.h"
#include "SymbolTable.h"
#include <wtf/MathExtras.h>
-#include <wtf/OwnPtr.h>
namespace JSC {
class ArgumentListNode;
- class CodeBlock;
class BytecodeGenerator;
- class FuncDeclNode;
- class EvalCodeBlock;
- class JSFunction;
- class ProgramCodeBlock;
+ class FunctionBodyNode;
class PropertyListNode;
class ReadModifyResolveNode;
class RegisterID;
class ScopeChainNode;
+ class ScopeNode;
typedef unsigned CodeFeatures;
@@ -86,8 +82,8 @@ namespace JSC {
namespace DeclarationStacks {
enum VarAttrs { IsConstant = 1, HasInitializer = 2 };
- typedef Vector<std::pair<Identifier, unsigned> > VarStack;
- typedef Vector<FuncDeclNode*> FunctionStack;
+ typedef Vector<std::pair<const Identifier*, unsigned> > VarStack;
+ typedef Vector<FunctionBodyNode*> FunctionStack;
}
struct SwitchInfo {
@@ -96,24 +92,23 @@ namespace JSC {
SwitchType switchType;
};
- class ParserArenaDeletable {
- protected:
- ParserArenaDeletable() { }
+ class ParserArenaFreeable {
+ public:
+ // ParserArenaFreeable objects are are freed when the arena is deleted.
+ // Destructors are not called. Clients must not call delete on such objects.
+ void* operator new(size_t, JSGlobalData*);
+ };
+ class ParserArenaDeletable {
public:
virtual ~ParserArenaDeletable() { }
- // Objects created with this version of new are deleted when the arena is deleted.
+ // ParserArenaDeletable objects are deleted when the arena is deleted.
+ // Clients must not call delete directly on such objects.
void* operator new(size_t, JSGlobalData*);
-
- // Objects created with this version of new are not deleted when the arena is deleted.
- // Other arrangements must be made.
- void* operator new(size_t);
-
- void operator delete(void*);
};
- class ParserArenaRefCounted : public RefCountedCustomAllocated<ParserArenaRefCounted> {
+ class ParserArenaRefCounted : public RefCounted<ParserArenaRefCounted> {
protected:
ParserArenaRefCounted(JSGlobalData*);
@@ -124,34 +119,14 @@ namespace JSC {
}
};
- class Node : public ParserArenaDeletable {
+ class Node : public ParserArenaFreeable {
protected:
Node(JSGlobalData*);
public:
- /*
- Return value: The register holding the production's value.
- dst: An optional parameter specifying the most efficient
- destination at which to store the production's value.
- The callee must honor dst.
-
- dst provides for a crude form of copy propagation. For example,
-
- x = 1
+ virtual ~Node() { }
- becomes
-
- load r[x], 1
-
- instead of
-
- load r0, 1
- mov r[x], r0
-
- because the assignment node, "x =", passes r[x] as dst to the number
- node, "1".
- */
- virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* dst = 0) = 0;
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* destination = 0) = 0;
int lineNo() const { return m_line; }
@@ -160,9 +135,10 @@ namespace JSC {
};
class ExpressionNode : public Node {
- public:
+ protected:
ExpressionNode(JSGlobalData*, ResultType = ResultType::unknownType());
+ public:
virtual bool isNumber() const { return false; }
virtual bool isString() const { return false; }
virtual bool isNull() const { return false; }
@@ -180,18 +156,16 @@ namespace JSC {
ResultType resultDescriptor() const { return m_resultType; }
- // This needs to be in public in order to compile using GCC 3.x
- typedef enum { EvalOperator, FunctionCall } CallerType;
-
private:
ResultType m_resultType;
};
class StatementNode : public Node {
- public:
+ protected:
StatementNode(JSGlobalData*);
- void setLoc(int line0, int line1);
+ public:
+ void setLoc(int firstLine, int lastLine);
int firstLine() const { return lineNo(); }
int lastLine() const { return m_lastLine; }
@@ -229,10 +203,10 @@ namespace JSC {
class NumberNode : public ExpressionNode {
public:
- NumberNode(JSGlobalData*, double v);
+ NumberNode(JSGlobalData*, double value);
- double value() const { return m_double; }
- void setValue(double d) { m_double = d; }
+ double value() const { return m_value; }
+ void setValue(double value) { m_value = value; }
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
@@ -240,22 +214,23 @@ namespace JSC {
virtual bool isNumber() const { return true; }
virtual bool isPure(BytecodeGenerator&) const { return true; }
- double m_double;
+ double m_value;
};
class StringNode : public ExpressionNode {
public:
- StringNode(JSGlobalData*, const Identifier& v);
+ StringNode(JSGlobalData*, const Identifier&);
const Identifier& value() { return m_value; }
- virtual bool isPure(BytecodeGenerator&) const { return true; }
private:
+ virtual bool isPure(BytecodeGenerator&) const { return true; }
+
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
virtual bool isString() const { return true; }
- Identifier m_value;
+ const Identifier& m_value;
};
class ThrowableExpressionData {
@@ -286,8 +261,9 @@ namespace JSC {
uint16_t endOffset() const { return m_endOffset; }
protected:
- RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* msg);
- RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* msg, const Identifier&);
+ RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* message);
+ RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* message, const UString&);
+ RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* message, const Identifier&);
private:
uint32_t m_divot;
@@ -298,8 +274,7 @@ namespace JSC {
class ThrowableSubExpressionData : public ThrowableExpressionData {
public:
ThrowableSubExpressionData()
- : ThrowableExpressionData()
- , m_subexpressionDivotOffset(0)
+ : m_subexpressionDivotOffset(0)
, m_subexpressionEndOffset(0)
{
}
@@ -328,8 +303,7 @@ namespace JSC {
class ThrowablePrefixedSubExpressionData : public ThrowableExpressionData {
public:
ThrowablePrefixedSubExpressionData()
- : ThrowableExpressionData()
- , m_subexpressionDivotOffset(0)
+ : m_subexpressionDivotOffset(0)
, m_subexpressionStartOffset(0)
{
}
@@ -357,13 +331,13 @@ namespace JSC {
class RegExpNode : public ExpressionNode, public ThrowableExpressionData {
public:
- RegExpNode(JSGlobalData*, const UString& pattern, const UString& flags);
+ RegExpNode(JSGlobalData*, const Identifier& pattern, const Identifier& flags);
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- UString m_pattern;
- UString m_flags;
+ const Identifier& m_pattern;
+ const Identifier& m_flags;
};
class ThisNode : public ExpressionNode {
@@ -387,11 +361,11 @@ namespace JSC {
virtual bool isLocation() const { return true; }
virtual bool isResolveNode() const { return true; }
- Identifier m_ident;
+ const Identifier& m_ident;
int32_t m_startOffset;
};
- class ElementNode : public ParserArenaDeletable {
+ class ElementNode : public ParserArenaFreeable {
public:
ElementNode(JSGlobalData*, int elision, ExpressionNode*);
ElementNode(JSGlobalData*, ElementNode*, int elision, ExpressionNode*);
@@ -424,17 +398,18 @@ namespace JSC {
bool m_optional;
};
- class PropertyNode : public ParserArenaDeletable {
+ class PropertyNode : public ParserArenaFreeable {
public:
enum Type { Constant, Getter, Setter };
PropertyNode(JSGlobalData*, const Identifier& name, ExpressionNode* value, Type);
+ PropertyNode(JSGlobalData*, double name, ExpressionNode* value, Type);
const Identifier& name() const { return m_name; }
private:
friend class PropertyListNode;
- Identifier m_name;
+ const Identifier& m_name;
ExpressionNode* m_assign;
Type m_type;
};
@@ -494,7 +469,7 @@ namespace JSC {
virtual bool isDotAccessorNode() const { return true; }
ExpressionNode* m_base;
- Identifier m_ident;
+ const Identifier& m_ident;
};
class ArgumentListNode : public Node {
@@ -509,7 +484,7 @@ namespace JSC {
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
};
- class ArgumentsNode : public ParserArenaDeletable {
+ class ArgumentsNode : public ParserArenaFreeable {
public:
ArgumentsNode(JSGlobalData*);
ArgumentsNode(JSGlobalData*, ArgumentListNode*);
@@ -557,7 +532,7 @@ namespace JSC {
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- Identifier m_ident;
+ const Identifier& m_ident;
ArgumentsNode* m_args;
size_t m_index; // Used by LocalVarFunctionCallNode.
size_t m_scopeDepth; // Used by ScopedVarFunctionCallNode and NonLocalVarFunctionCallNode
@@ -584,7 +559,7 @@ namespace JSC {
protected:
ExpressionNode* m_base;
- const Identifier m_ident;
+ const Identifier& m_ident;
ArgumentsNode* m_args;
};
@@ -609,7 +584,7 @@ namespace JSC {
PrePostResolveNode(JSGlobalData*, const Identifier&, unsigned divot, unsigned startOffset, unsigned endOffset);
protected:
- const Identifier m_ident;
+ const Identifier& m_ident;
};
class PostfixResolveNode : public PrePostResolveNode {
@@ -642,7 +617,7 @@ namespace JSC {
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
ExpressionNode* m_base;
- Identifier m_ident;
+ const Identifier& m_ident;
Operator m_operator;
};
@@ -664,7 +639,7 @@ namespace JSC {
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- Identifier m_ident;
+ const Identifier& m_ident;
};
class DeleteBracketNode : public ExpressionNode, public ThrowableExpressionData {
@@ -686,7 +661,7 @@ namespace JSC {
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
ExpressionNode* m_base;
- Identifier m_ident;
+ const Identifier& m_ident;
};
class DeleteValueNode : public ExpressionNode {
@@ -718,7 +693,7 @@ namespace JSC {
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- Identifier m_ident;
+ const Identifier& m_ident;
};
class TypeOfValueNode : public ExpressionNode {
@@ -761,7 +736,7 @@ namespace JSC {
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
ExpressionNode* m_base;
- Identifier m_ident;
+ const Identifier& m_ident;
Operator m_operator;
};
@@ -820,7 +795,7 @@ namespace JSC {
BinaryOpNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID, bool rightHasAssignments);
BinaryOpNode(JSGlobalData*, ResultType, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID, bool rightHasAssignments);
- RegisterID* emitStrcat(BytecodeGenerator& generator, RegisterID* dst, RegisterID* lhs = 0, ReadModifyResolveNode* emitExpressionInfoForMe = 0);
+ RegisterID* emitStrcat(BytecodeGenerator& generator, RegisterID* destination, RegisterID* lhs = 0, ReadModifyResolveNode* emitExpressionInfoForMe = 0);
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
@@ -1003,7 +978,7 @@ namespace JSC {
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- Identifier m_ident;
+ const Identifier& m_ident;
ExpressionNode* m_right;
size_t m_index; // Used by ReadModifyLocalVarNode.
Operator m_operator;
@@ -1017,7 +992,7 @@ namespace JSC {
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- Identifier m_ident;
+ const Identifier& m_ident;
ExpressionNode* m_right;
size_t m_index; // Used by ReadModifyLocalVarNode.
bool m_rightHasAssignments;
@@ -1060,7 +1035,7 @@ namespace JSC {
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
ExpressionNode* m_base;
- Identifier m_ident;
+ const Identifier& m_ident;
ExpressionNode* m_right;
bool m_rightHasAssignments;
};
@@ -1073,7 +1048,7 @@ namespace JSC {
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
ExpressionNode* m_base;
- Identifier m_ident;
+ const Identifier& m_ident;
ExpressionNode* m_right;
Operator m_operator : 31;
bool m_rightHasAssignments : 1;
@@ -1093,10 +1068,12 @@ namespace JSC {
typedef Vector<ExpressionNode*, 8> ExpressionVector;
- class CommaNode : public ExpressionNode {
+ class CommaNode : public ExpressionNode, public ParserArenaDeletable {
public:
CommaNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2);
+ using ParserArenaDeletable::operator new;
+
void append(ExpressionNode* expr) { m_expressions.append(expr); }
private:
@@ -1117,7 +1094,7 @@ namespace JSC {
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
virtual RegisterID* emitCodeSingle(BytecodeGenerator&);
- Identifier m_ident;
+ const Identifier& m_ident;
public:
ConstDeclNode* m_next;
@@ -1136,36 +1113,33 @@ namespace JSC {
ConstDeclNode* m_next;
};
- typedef Vector<StatementNode*> StatementVector;
-
class SourceElements : public ParserArenaDeletable {
public:
SourceElements(JSGlobalData*);
void append(StatementNode*);
- void releaseContentsIntoVector(StatementVector& destination)
- {
- ASSERT(destination.isEmpty());
- m_statements.swap(destination);
- destination.shrinkToFit();
- }
+
+ StatementNode* singleStatement() const;
+ StatementNode* lastStatement() const;
+
+ void emitBytecode(BytecodeGenerator&, RegisterID* destination);
private:
- StatementVector m_statements;
+ Vector<StatementNode*> m_statements;
};
class BlockNode : public StatementNode {
public:
- BlockNode(JSGlobalData*, SourceElements* children);
+ BlockNode(JSGlobalData*, SourceElements* = 0);
- StatementVector& children() { return m_children; }
+ StatementNode* lastStatement() const;
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
virtual bool isBlock() const { return true; }
- StatementVector m_children;
+ SourceElements* m_statements;
};
class EmptyStatementNode : public StatementNode {
@@ -1275,7 +1249,7 @@ namespace JSC {
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- Identifier m_ident;
+ const Identifier& m_ident;
ExpressionNode* m_init;
ExpressionNode* m_lexpr;
ExpressionNode* m_expr;
@@ -1291,7 +1265,7 @@ namespace JSC {
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- Identifier m_ident;
+ const Identifier& m_ident;
};
class BreakNode : public StatementNode, public ThrowableExpressionData {
@@ -1302,7 +1276,7 @@ namespace JSC {
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- Identifier m_ident;
+ const Identifier& m_ident;
};
class ReturnNode : public StatementNode, public ThrowableExpressionData {
@@ -1337,7 +1311,7 @@ namespace JSC {
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- Identifier m_name;
+ const Identifier& m_name;
StatementNode* m_statement;
};
@@ -1356,16 +1330,16 @@ namespace JSC {
TryNode(JSGlobalData*, StatementNode* tryBlock, const Identifier& exceptionIdent, bool catchHasEval, StatementNode* catchBlock, StatementNode* finallyBlock);
private:
- virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* dst = 0);
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
StatementNode* m_tryBlock;
- Identifier m_exceptionIdent;
+ const Identifier& m_exceptionIdent;
StatementNode* m_catchBlock;
StatementNode* m_finallyBlock;
bool m_catchHasEval;
};
- class ParameterNode : public ParserArenaDeletable {
+ class ParameterNode : public ParserArenaFreeable {
public:
ParameterNode(JSGlobalData*, const Identifier&);
ParameterNode(JSGlobalData*, ParameterNode*, const Identifier&);
@@ -1374,7 +1348,7 @@ namespace JSC {
ParameterNode* nextParam() const { return m_next; }
private:
- Identifier m_ident;
+ const Identifier& m_ident;
ParameterNode* m_next;
};
@@ -1388,9 +1362,7 @@ namespace JSC {
VarStack m_varStack;
FunctionStack m_functionStack;
int m_numConstants;
- StatementVector m_children;
-
- void markAggregate(MarkStack&);
+ SourceElements* m_statements;
};
class ScopeNode : public StatementNode, public ParserArenaRefCounted {
@@ -1401,6 +1373,8 @@ namespace JSC {
ScopeNode(JSGlobalData*);
ScopeNode(JSGlobalData*, const SourceCode&, SourceElements*, VarStack*, FunctionStack*, CodeFeatures, int numConstants);
+ using ParserArenaRefCounted::operator new;
+
void adoptData(std::auto_ptr<ScopeNodeData> data)
{
ASSERT(!data->m_arena.contains(this));
@@ -1426,8 +1400,6 @@ namespace JSC {
VarStack& varStack() { ASSERT(m_data); return m_data->m_varStack; }
FunctionStack& functionStack() { ASSERT(m_data); return m_data->m_functionStack; }
- StatementVector& children() { ASSERT(m_data); return m_data->m_children; }
-
int neededConstants()
{
ASSERT(m_data);
@@ -1436,33 +1408,13 @@ namespace JSC {
return m_data->m_numConstants + 2;
}
- virtual void markAggregate(MarkStack&) { }
+ StatementNode* singleStatement() const;
-#if ENABLE(JIT)
- JITCode& generatedJITCode()
- {
- ASSERT(m_jitCode);
- return m_jitCode;
- }
-
- ExecutablePool* getExecutablePool()
- {
- return m_jitCode.getExecutablePool();
- }
-
- void setJITCode(const JITCode jitCode)
- {
- m_jitCode = jitCode;
- }
-#endif
+ void emitStatementsBytecode(BytecodeGenerator&, RegisterID* destination);
protected:
void setSource(const SourceCode& source) { m_source = source; }
-#if ENABLE(JIT)
- JITCode m_jitCode;
-#endif
-
private:
OwnPtr<ScopeNodeData> m_data;
CodeFeatures m_features;
@@ -1473,187 +1425,99 @@ namespace JSC {
public:
static PassRefPtr<ProgramNode> create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants);
- ProgramCodeBlock& bytecode(ScopeChainNode* scopeChain)
- {
- if (!m_code)
- generateBytecode(scopeChain);
- return *m_code;
- }
-
-#if ENABLE(JIT)
- JITCode& jitCode(ScopeChainNode* scopeChain)
- {
- if (!m_jitCode)
- generateJITCode(scopeChain);
- return m_jitCode;
- }
-#endif
+ static const bool scopeIsFunction = false;
private:
ProgramNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants);
- void generateBytecode(ScopeChainNode*);
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
-
-#if ENABLE(JIT)
- void generateJITCode(ScopeChainNode*);
-#endif
-
- OwnPtr<ProgramCodeBlock> m_code;
};
class EvalNode : public ScopeNode {
public:
static PassRefPtr<EvalNode> create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants);
- EvalCodeBlock& bytecode(ScopeChainNode* scopeChain)
- {
- if (!m_code)
- generateBytecode(scopeChain);
- return *m_code;
- }
-
- EvalCodeBlock& bytecodeForExceptionInfoReparse(ScopeChainNode*, CodeBlock*);
-
- virtual void markAggregate(MarkStack&);
-
-#if ENABLE(JIT)
- JITCode& jitCode(ScopeChainNode* scopeChain)
- {
- if (!m_jitCode)
- generateJITCode(scopeChain);
- return m_jitCode;
- }
-#endif
+ static const bool scopeIsFunction = false;
private:
EvalNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants);
- void generateBytecode(ScopeChainNode*);
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ };
-#if ENABLE(JIT)
- void generateJITCode(ScopeChainNode*);
-#endif
-
- OwnPtr<EvalCodeBlock> m_code;
+ class FunctionParameters : public Vector<Identifier>, public RefCounted<FunctionParameters> {
+ public:
+ static PassRefPtr<FunctionParameters> create(ParameterNode* firstParameter) { return adoptRef(new FunctionParameters(firstParameter)); }
+
+ private:
+ FunctionParameters(ParameterNode*);
};
class FunctionBodyNode : public ScopeNode {
- friend class JIT;
public:
-#if ENABLE(JIT)
- static PassRefPtr<FunctionBodyNode> createNativeThunk(JSGlobalData*);
-#endif
static FunctionBodyNode* create(JSGlobalData*);
static PassRefPtr<FunctionBodyNode> create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants);
- virtual ~FunctionBodyNode();
- const Identifier* parameters() const { return m_parameters; }
- size_t parameterCount() const { return m_parameterCount; }
- UString paramString() const ;
- Identifier* copyParameters();
+ FunctionParameters* parameters() const { return m_parameters.get(); }
+ size_t parameterCount() const { return m_parameters->size(); }
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- bool isGenerated() const
- {
- return m_code;
- }
-
- bool isHostFunction() const;
-
- virtual void markAggregate(MarkStack&);
-
- void finishParsing(const SourceCode&, ParameterNode*);
- void finishParsing(Identifier* parameters, size_t parameterCount);
+ void finishParsing(const SourceCode&, ParameterNode*, const Identifier&);
+ void finishParsing(PassRefPtr<FunctionParameters>, const Identifier&);
- UString toSourceString() const { return source().toString(); }
+ const Identifier& ident() { return m_ident; }
- CodeBlock& bytecodeForExceptionInfoReparse(ScopeChainNode*, CodeBlock*);
-#if ENABLE(JIT)
- JITCode& jitCode(ScopeChainNode* scopeChain)
- {
- if (!m_jitCode)
- generateJITCode(scopeChain);
- return m_jitCode;
- }
-#endif
+ static const bool scopeIsFunction = true;
- CodeBlock& bytecode(ScopeChainNode* scopeChain)
- {
- ASSERT(scopeChain);
- if (!m_code)
- generateBytecode(scopeChain);
- return *m_code;
- }
-
- CodeBlock& generatedBytecode()
- {
- ASSERT(m_code);
- return *m_code;
- }
-
private:
FunctionBodyNode(JSGlobalData*);
FunctionBodyNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants);
- void generateBytecode(ScopeChainNode*);
-#if ENABLE(JIT)
- void generateJITCode(ScopeChainNode*);
-#endif
- Identifier* m_parameters;
- size_t m_parameterCount;
- OwnPtr<CodeBlock> m_code;
+ Identifier m_ident;
+ RefPtr<FunctionParameters> m_parameters;
};
- class FuncExprNode : public ExpressionNode, public ParserArenaRefCounted {
+ class FuncExprNode : public ExpressionNode {
public:
FuncExprNode(JSGlobalData*, const Identifier&, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter = 0);
- JSFunction* makeFunction(ExecState*, ScopeChainNode*);
-
- FunctionBodyNode* body() { return m_body.get(); }
+ FunctionBodyNode* body() { return m_body; }
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
virtual bool isFuncExprNode() const { return true; }
- Identifier m_ident;
- RefPtr<FunctionBodyNode> m_body;
+ FunctionBodyNode* m_body;
};
- class FuncDeclNode : public StatementNode, public ParserArenaRefCounted {
+ class FuncDeclNode : public StatementNode {
public:
FuncDeclNode(JSGlobalData*, const Identifier&, FunctionBodyNode*, const SourceCode&, ParameterNode* = 0);
- JSFunction* makeFunction(ExecState*, ScopeChainNode*);
-
- Identifier m_ident;
-
- FunctionBodyNode* body() { return m_body.get(); }
+ FunctionBodyNode* body() { return m_body; }
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- RefPtr<FunctionBodyNode> m_body;
+ FunctionBodyNode* m_body;
};
- class CaseClauseNode : public ParserArenaDeletable {
+ class CaseClauseNode : public ParserArenaFreeable {
public:
- CaseClauseNode(JSGlobalData*, ExpressionNode*);
- CaseClauseNode(JSGlobalData*, ExpressionNode*, SourceElements*);
+ CaseClauseNode(JSGlobalData*, ExpressionNode*, SourceElements* = 0);
ExpressionNode* expr() const { return m_expr; }
- StatementVector& children() { return m_children; }
+
+ void emitBytecode(BytecodeGenerator&, RegisterID* destination);
private:
ExpressionNode* m_expr;
- StatementVector m_children;
+ SourceElements* m_statements;
};
- class ClauseListNode : public ParserArenaDeletable {
+ class ClauseListNode : public ParserArenaFreeable {
public:
ClauseListNode(JSGlobalData*, CaseClauseNode*);
ClauseListNode(JSGlobalData*, ClauseListNode*, CaseClauseNode*);
@@ -1666,11 +1530,11 @@ namespace JSC {
ClauseListNode* m_next;
};
- class CaseBlockNode : public ParserArenaDeletable {
+ class CaseBlockNode : public ParserArenaFreeable {
public:
CaseBlockNode(JSGlobalData*, ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2);
- RegisterID* emitBytecodeForBlock(BytecodeGenerator&, RegisterID* input, RegisterID* dst = 0);
+ RegisterID* emitBytecodeForBlock(BytecodeGenerator&, RegisterID* input, RegisterID* destination);
private:
SwitchInfo::SwitchType tryOptimizedSwitch(Vector<ExpressionNode*, 8>& literalVector, int32_t& min_num, int32_t& max_num);
diff --git a/JavaScriptCore/parser/Parser.cpp b/JavaScriptCore/parser/Parser.cpp
index da47ab2..003ca0b 100644
--- a/JavaScriptCore/parser/Parser.cpp
+++ b/JavaScriptCore/parser/Parser.cpp
@@ -60,7 +60,7 @@ void Parser::parse(JSGlobalData* globalData, int* errLine, UString* errMsg)
*errMsg = 0;
Lexer& lexer = *globalData->lexer;
- lexer.setCode(*m_source);
+ lexer.setCode(*m_source, m_arena);
int parseError = jscyyparse(globalData);
bool lexError = lexer.sawError();
@@ -77,33 +77,6 @@ void Parser::parse(JSGlobalData* globalData, int* errLine, UString* errMsg)
#endif
}
-void Parser::reparseInPlace(JSGlobalData* globalData, FunctionBodyNode* functionBodyNode)
-{
- ASSERT(!functionBodyNode->data());
-
- m_source = &functionBodyNode->source();
- globalData->lexer->setIsReparsing();
- parse(globalData, 0, 0);
- ASSERT(m_sourceElements);
-
- functionBodyNode->adoptData(std::auto_ptr<ScopeNodeData>(new ScopeNodeData(globalData->parser->arena(),
- m_sourceElements,
- m_varDeclarations ? &m_varDeclarations->data : 0,
- m_funcDeclarations ? &m_funcDeclarations->data : 0,
- m_numConstants)));
- bool usesArguments = functionBodyNode->usesArguments();
- functionBodyNode->setFeatures(m_features);
- if (usesArguments && !functionBodyNode->usesArguments())
- functionBodyNode->setUsesArguments();
-
- ASSERT(globalData->parser->arena().isEmpty());
-
- m_source = 0;
- m_sourceElements = 0;
- m_varDeclarations = 0;
- m_funcDeclarations = 0;
-}
-
void Parser::didFinishParsing(SourceElements* sourceElements, ParserArenaData<DeclarationStacks::VarStack>* varStack,
ParserArenaData<DeclarationStacks::FunctionStack>* funcStack, CodeFeatures features, int lastLine, int numConstants)
{
diff --git a/JavaScriptCore/parser/Parser.h b/JavaScriptCore/parser/Parser.h
index 373dc00..894f709 100644
--- a/JavaScriptCore/parser/Parser.h
+++ b/JavaScriptCore/parser/Parser.h
@@ -24,7 +24,11 @@
#define Parser_h
#include "Debugger.h"
+#include "Executable.h"
+#include "JSGlobalObject.h"
+#include "Lexer.h"
#include "Nodes.h"
+#include "ParserArena.h"
#include "SourceProvider.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
@@ -41,9 +45,8 @@ namespace JSC {
class Parser : public Noncopyable {
public:
- template <class ParsedNode> PassRefPtr<ParsedNode> parse(ExecState*, Debugger*, const SourceCode&, int* errLine = 0, UString* errMsg = 0);
- template <class ParsedNode> PassRefPtr<ParsedNode> reparse(JSGlobalData*, ParsedNode*);
- void reparseInPlace(JSGlobalData*, FunctionBodyNode*);
+ template <class ParsedNode>
+ PassRefPtr<ParsedNode> parse(JSGlobalData* globalData, Debugger*, ExecState*, const SourceCode& source, int* errLine = 0, UString* errMsg = 0);
void didFinishParsing(SourceElements*, ParserArenaData<DeclarationStacks::VarStack>*,
ParserArenaData<DeclarationStacks::FunctionStack>*, CodeFeatures features, int lastLine, int numConstants);
@@ -63,55 +66,35 @@ namespace JSC {
int m_numConstants;
};
- template <class ParsedNode> PassRefPtr<ParsedNode> Parser::parse(ExecState* exec, Debugger* debugger, const SourceCode& source, int* errLine, UString* errMsg)
+ template <class ParsedNode>
+ PassRefPtr<ParsedNode> Parser::parse(JSGlobalData* globalData, Debugger* debugger, ExecState* debuggerExecState, const SourceCode& source, int* errLine, UString* errMsg)
{
m_source = &source;
- parse(&exec->globalData(), errLine, errMsg);
- RefPtr<ParsedNode> result;
- if (m_sourceElements) {
- result = ParsedNode::create(&exec->globalData(),
- m_sourceElements,
- m_varDeclarations ? &m_varDeclarations->data : 0,
- m_funcDeclarations ? &m_funcDeclarations->data : 0,
- *m_source,
- m_features,
- m_numConstants);
- result->setLoc(m_source->firstLine(), m_lastLine);
- }
-
- m_arena.reset();
-
- m_source = 0;
- m_varDeclarations = 0;
- m_funcDeclarations = 0;
+ if (ParsedNode::scopeIsFunction)
+ globalData->lexer->setIsReparsing();
+ parse(globalData, errLine, errMsg);
- if (debugger)
- debugger->sourceParsed(exec, source, *errLine, *errMsg);
- return result.release();
- }
-
- template <class ParsedNode> PassRefPtr<ParsedNode> Parser::reparse(JSGlobalData* globalData, ParsedNode* oldParsedNode)
- {
- m_source = &oldParsedNode->source();
- parse(globalData, 0, 0);
RefPtr<ParsedNode> result;
if (m_sourceElements) {
result = ParsedNode::create(globalData,
- m_sourceElements,
- m_varDeclarations ? &m_varDeclarations->data : 0,
- m_funcDeclarations ? &m_funcDeclarations->data : 0,
- *m_source,
- oldParsedNode->features(),
- m_numConstants);
+ m_sourceElements,
+ m_varDeclarations ? &m_varDeclarations->data : 0,
+ m_funcDeclarations ? &m_funcDeclarations->data : 0,
+ source,
+ m_features,
+ m_numConstants);
result->setLoc(m_source->firstLine(), m_lastLine);
}
m_arena.reset();
m_source = 0;
+ m_sourceElements = 0;
m_varDeclarations = 0;
m_funcDeclarations = 0;
+ if (debugger && !ParsedNode::scopeIsFunction)
+ debugger->sourceParsed(debuggerExecState, source, *errLine, *errMsg);
return result.release();
}
diff --git a/JavaScriptCore/parser/ParserArena.cpp b/JavaScriptCore/parser/ParserArena.cpp
index 2617506..a8e8159 100644
--- a/JavaScriptCore/parser/ParserArena.cpp
+++ b/JavaScriptCore/parser/ParserArena.cpp
@@ -30,9 +30,39 @@
namespace JSC {
+ParserArena::ParserArena()
+ : m_freeableMemory(0)
+ , m_freeablePoolEnd(0)
+ , m_identifierArena(new IdentifierArena)
+{
+}
+
+inline void* ParserArena::freeablePool()
+{
+ ASSERT(m_freeablePoolEnd);
+ return m_freeablePoolEnd - freeablePoolSize;
+}
+
+inline void ParserArena::deallocateObjects()
+{
+ if (m_freeablePoolEnd)
+ fastFree(freeablePool());
+
+ size_t size = m_freeablePools.size();
+ for (size_t i = 0; i < size; ++i)
+ fastFree(m_freeablePools[i]);
+
+ size = m_deletableObjects.size();
+ for (size_t i = 0; i < size; ++i) {
+ ParserArenaDeletable* object = m_deletableObjects[i];
+ object->~ParserArenaDeletable();
+ fastFree(object);
+ }
+}
+
ParserArena::~ParserArena()
{
- deleteAllValues(m_deletableObjects);
+ deallocateObjects();
}
bool ParserArena::contains(ParserArenaRefCounted* object) const
@@ -52,9 +82,43 @@ void ParserArena::removeLast()
void ParserArena::reset()
{
- deleteAllValues(m_deletableObjects);
- m_deletableObjects.shrink(0);
- m_refCountedObjects.shrink(0);
+ // Since this code path is used only when parsing fails, it's not bothering to reuse
+ // any of the memory the arena allocated. We could improve that later if we want to
+ // efficiently reuse the same arena.
+
+ deallocateObjects();
+
+ m_freeableMemory = 0;
+ m_freeablePoolEnd = 0;
+ m_identifierArena->clear();
+ m_freeablePools.clear();
+ m_deletableObjects.clear();
+ m_refCountedObjects.clear();
+}
+
+void ParserArena::allocateFreeablePool()
+{
+ if (m_freeablePoolEnd)
+ m_freeablePools.append(freeablePool());
+
+ char* pool = static_cast<char*>(fastMalloc(freeablePoolSize));
+ m_freeableMemory = pool;
+ m_freeablePoolEnd = pool + freeablePoolSize;
+ ASSERT(freeablePool() == pool);
+}
+
+bool ParserArena::isEmpty() const
+{
+ return !m_freeablePoolEnd
+ && m_identifierArena->isEmpty()
+ && m_freeablePools.isEmpty()
+ && m_deletableObjects.isEmpty()
+ && m_refCountedObjects.isEmpty();
+}
+
+void ParserArena::derefWithArena(PassRefPtr<ParserArenaRefCounted> object)
+{
+ m_refCountedObjects.append(object);
}
}
diff --git a/JavaScriptCore/parser/ParserArena.h b/JavaScriptCore/parser/ParserArena.h
index 66c8529..eef8e93 100644
--- a/JavaScriptCore/parser/ParserArena.h
+++ b/JavaScriptCore/parser/ParserArena.h
@@ -26,35 +26,101 @@
#ifndef ParserArena_h
#define ParserArena_h
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
+#include "Identifier.h"
+#include <wtf/SegmentedVector.h>
namespace JSC {
class ParserArenaDeletable;
class ParserArenaRefCounted;
- class ParserArena {
+ class IdentifierArena : public FastAllocBase {
public:
+ ALWAYS_INLINE const Identifier& makeIdentifier(JSGlobalData*, const UChar* characters, size_t length);
+ const Identifier& makeNumericIdentifier(JSGlobalData*, double number);
+
+ void clear() { m_identifiers.clear(); }
+ bool isEmpty() const { return m_identifiers.isEmpty(); }
+
+ private:
+ typedef SegmentedVector<Identifier, 64> IdentifierVector;
+ IdentifierVector m_identifiers;
+ };
+
+ ALWAYS_INLINE const Identifier& IdentifierArena::makeIdentifier(JSGlobalData* globalData, const UChar* characters, size_t length)
+ {
+ m_identifiers.append(Identifier(globalData, characters, length));
+ return m_identifiers.last();
+ }
+
+ inline const Identifier& IdentifierArena::makeNumericIdentifier(JSGlobalData* globalData, double number)
+ {
+ m_identifiers.append(Identifier(globalData, UString::from(number)));
+ return m_identifiers.last();
+ }
+
+ class ParserArena : Noncopyable {
+ public:
+ ParserArena();
+ ~ParserArena();
+
void swap(ParserArena& otherArena)
{
+ std::swap(m_freeableMemory, otherArena.m_freeableMemory);
+ std::swap(m_freeablePoolEnd, otherArena.m_freeablePoolEnd);
+ m_identifierArena.swap(otherArena.m_identifierArena);
+ m_freeablePools.swap(otherArena.m_freeablePools);
m_deletableObjects.swap(otherArena.m_deletableObjects);
m_refCountedObjects.swap(otherArena.m_refCountedObjects);
}
- ~ParserArena();
- void deleteWithArena(ParserArenaDeletable* object) { m_deletableObjects.append(object); }
- void derefWithArena(PassRefPtr<ParserArenaRefCounted> object) { m_refCountedObjects.append(object); }
+ void* allocateFreeable(size_t size)
+ {
+ ASSERT(size);
+ ASSERT(size <= freeablePoolSize);
+ size_t alignedSize = alignSize(size);
+ ASSERT(alignedSize <= freeablePoolSize);
+ if (UNLIKELY(static_cast<size_t>(m_freeablePoolEnd - m_freeableMemory) < alignedSize))
+ allocateFreeablePool();
+ void* block = m_freeableMemory;
+ m_freeableMemory += alignedSize;
+ return block;
+ }
+
+ void* allocateDeletable(size_t size)
+ {
+ ParserArenaDeletable* deletable = static_cast<ParserArenaDeletable*>(fastMalloc(size));
+ m_deletableObjects.append(deletable);
+ return deletable;
+ }
+ void derefWithArena(PassRefPtr<ParserArenaRefCounted>);
bool contains(ParserArenaRefCounted*) const;
ParserArenaRefCounted* last() const;
void removeLast();
- bool isEmpty() const { return m_deletableObjects.isEmpty() && m_refCountedObjects.isEmpty(); }
+ bool isEmpty() const;
void reset();
+ IdentifierArena& identifierArena() { return *m_identifierArena; }
+
private:
+ static const size_t freeablePoolSize = 8000;
+
+ static size_t alignSize(size_t size)
+ {
+ return (size + sizeof(WTF::AllocAlignmentInteger) - 1) & ~(sizeof(WTF::AllocAlignmentInteger) - 1);
+ }
+
+ void* freeablePool();
+ void allocateFreeablePool();
+ void deallocateObjects();
+
+ char* m_freeableMemory;
+ char* m_freeablePoolEnd;
+
+ OwnPtr<IdentifierArena> m_identifierArena;
+ Vector<void*> m_freeablePools;
Vector<ParserArenaDeletable*> m_deletableObjects;
Vector<RefPtr<ParserArenaRefCounted> > m_refCountedObjects;
};
diff --git a/JavaScriptCore/parser/SourceCode.h b/JavaScriptCore/parser/SourceCode.h
index 84360b8..9ba4da3 100644
--- a/JavaScriptCore/parser/SourceCode.h
+++ b/JavaScriptCore/parser/SourceCode.h
@@ -37,7 +37,8 @@ namespace JSC {
class SourceCode {
public:
SourceCode()
- : m_startChar(0)
+ : m_provider(0)
+ , m_startChar(0)
, m_endChar(0)
, m_firstLine(0)
{
diff --git a/JavaScriptCore/pcre/dftables b/JavaScriptCore/pcre/dftables
index 8a2d140..1f0ea01 100755
--- a/JavaScriptCore/pcre/dftables
+++ b/JavaScriptCore/pcre/dftables
@@ -244,7 +244,7 @@ sub readHeaderValues()
my ($fh, $tempFile) = tempfile(
basename($0) . "-XXXXXXXX",
- DIR => File::Spec->tmpdir,
+ DIR => File::Spec->tmpdir(),
SUFFIX => ".in",
UNLINK => 0,
);
diff --git a/JavaScriptCore/profiler/ProfileGenerator.cpp b/JavaScriptCore/profiler/ProfileGenerator.cpp
index 1a061cb..dc68ecb 100644
--- a/JavaScriptCore/profiler/ProfileGenerator.cpp
+++ b/JavaScriptCore/profiler/ProfileGenerator.cpp
@@ -27,6 +27,7 @@
#include "ProfileGenerator.h"
#include "CallFrame.h"
+#include "CodeBlock.h"
#include "JSGlobalObject.h"
#include "JSStringRef.h"
#include "JSFunction.h"
diff --git a/JavaScriptCore/profiler/Profiler.cpp b/JavaScriptCore/profiler/Profiler.cpp
index e103fd1..6f72e08 100644
--- a/JavaScriptCore/profiler/Profiler.cpp
+++ b/JavaScriptCore/profiler/Profiler.cpp
@@ -31,6 +31,7 @@
#include "CommonIdentifiers.h"
#include "CallFrame.h"
+#include "CodeBlock.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "Nodes.h"
@@ -134,26 +135,27 @@ void Profiler::didExecute(ExecState* exec, const UString& sourceURL, int startin
dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(&exec->globalData(), JSValue(), sourceURL, startingLineNumber), exec->lexicalGlobalObject()->profileGroup());
}
-CallIdentifier Profiler::createCallIdentifier(JSGlobalData* globalData, JSValue function, const UString& defaultSourceURL, int defaultLineNumber)
+CallIdentifier Profiler::createCallIdentifier(JSGlobalData* globalData, JSValue functionValue, const UString& defaultSourceURL, int defaultLineNumber)
{
- if (!function)
+ if (!functionValue)
return CallIdentifier(GlobalCodeExecution, defaultSourceURL, defaultLineNumber);
- if (!function.isObject())
+ if (!functionValue.isObject())
return CallIdentifier("(unknown)", defaultSourceURL, defaultLineNumber);
- if (asObject(function)->inherits(&JSFunction::info)) {
- JSFunction* func = asFunction(function);
- if (!func->isHostFunction())
- return createCallIdentifierFromFunctionImp(globalData, func);
+ if (asObject(functionValue)->inherits(&JSFunction::info)) {
+ JSFunction* function = asFunction(functionValue);
+ if (!function->executable()->isHostFunction())
+ return createCallIdentifierFromFunctionImp(globalData, function);
}
- if (asObject(function)->inherits(&InternalFunction::info))
- return CallIdentifier(static_cast<InternalFunction*>(asObject(function))->name(globalData), defaultSourceURL, defaultLineNumber);
- return CallIdentifier("(" + asObject(function)->className() + " object)", defaultSourceURL, defaultLineNumber);
+ if (asObject(functionValue)->inherits(&InternalFunction::info))
+ return CallIdentifier(static_cast<InternalFunction*>(asObject(functionValue))->name(globalData), defaultSourceURL, defaultLineNumber);
+ return CallIdentifier("(" + asObject(functionValue)->className() + " object)", defaultSourceURL, defaultLineNumber);
}
CallIdentifier createCallIdentifierFromFunctionImp(JSGlobalData* globalData, JSFunction* function)
{
+ ASSERT(!function->isHostFunction());
const UString& name = function->calculatedDisplayName(globalData);
- return CallIdentifier(name.isEmpty() ? AnonymousFunction : name, function->body()->sourceURL(), function->body()->lineNo());
+ return CallIdentifier(name.isEmpty() ? AnonymousFunction : name, function->jsExecutable()->sourceURL(), function->jsExecutable()->lineNo());
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ArgList.h b/JavaScriptCore/runtime/ArgList.h
index ab501b6..3227770 100644
--- a/JavaScriptCore/runtime/ArgList.h
+++ b/JavaScriptCore/runtime/ArgList.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
- * Copyright (C) 2003, 2007, 2008, 2009 Apple Computer, Inc.
+ * Copyright (C) 2003, 2007, 2008, 2009 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -23,13 +23,14 @@
#define ArgList_h
#include "Register.h"
-
#include <wtf/HashSet.h>
#include <wtf/Noncopyable.h>
#include <wtf/Vector.h>
namespace JSC {
-
+
+ class MarkStack;
+
class MarkedArgumentBuffer : public Noncopyable {
private:
static const unsigned inlineCapacity = 8;
diff --git a/JavaScriptCore/runtime/Arguments.cpp b/JavaScriptCore/runtime/Arguments.cpp
index ec9c450..86a8f0a 100644
--- a/JavaScriptCore/runtime/Arguments.cpp
+++ b/JavaScriptCore/runtime/Arguments.cpp
@@ -179,6 +179,31 @@ bool Arguments::getOwnPropertySlot(ExecState* exec, const Identifier& propertyNa
return JSObject::getOwnPropertySlot(exec, propertyName, slot);
}
+bool Arguments::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ bool isArrayIndex;
+ unsigned i = propertyName.toArrayIndex(&isArrayIndex);
+ if (isArrayIndex && i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
+ if (i < d->numParameters) {
+ descriptor.setDescriptor(d->registers[d->firstParameterIndex + i].jsValue(), DontEnum);
+ } else
+ descriptor.setDescriptor(d->extraArguments[i - d->numParameters].jsValue(), DontEnum);
+ return true;
+ }
+
+ if (propertyName == exec->propertyNames().length && LIKELY(!d->overrodeLength)) {
+ descriptor.setDescriptor(jsNumber(exec, d->numArguments), DontEnum);
+ return true;
+ }
+
+ if (propertyName == exec->propertyNames().callee && LIKELY(!d->overrodeCallee)) {
+ descriptor.setDescriptor(d->callee, DontEnum);
+ return true;
+ }
+
+ return JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+}
+
void Arguments::put(ExecState* exec, unsigned i, JSValue value, PutPropertySlot& slot)
{
if (i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
diff --git a/JavaScriptCore/runtime/Arguments.h b/JavaScriptCore/runtime/Arguments.h
index 79fe720..5be84a2 100644
--- a/JavaScriptCore/runtime/Arguments.h
+++ b/JavaScriptCore/runtime/Arguments.h
@@ -28,6 +28,8 @@
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "Interpreter.h"
+#include "ObjectConstructor.h"
+#include "PrototypeFunction.h"
namespace JSC {
@@ -90,6 +92,7 @@ namespace JSC {
void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc);
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual void put(ExecState*, unsigned propertyName, JSValue, PutPropertySlot&);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
@@ -113,18 +116,17 @@ namespace JSC {
ALWAYS_INLINE void Arguments::getArgumentsData(CallFrame* callFrame, JSFunction*& function, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc)
{
function = callFrame->callee();
-
- CodeBlock* codeBlock = &function->body()->generatedBytecode();
- int numParameters = codeBlock->m_numParameters;
+
+ int numParameters = function->jsExecutable()->parameterCount();
argc = callFrame->argumentCount();
if (argc <= numParameters)
- argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters + 1; // + 1 to skip "this"
+ argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters;
else
- argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters - argc + 1; // + 1 to skip "this"
+ argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters - argc;
argc -= 1; // - 1 to skip "this"
- firstParameterIndex = -RegisterFile::CallFrameHeaderSize - numParameters + 1; // + 1 to skip "this"
+ firstParameterIndex = -RegisterFile::CallFrameHeaderSize - numParameters;
}
inline Arguments::Arguments(CallFrame* callFrame)
@@ -137,7 +139,7 @@ namespace JSC {
int numArguments;
getArgumentsData(callFrame, callee, firstParameterIndex, argv, numArguments);
- d->numParameters = callee->body()->parameterCount();
+ d->numParameters = callee->jsExecutable()->parameterCount();
d->firstParameterIndex = firstParameterIndex;
d->numArguments = numArguments;
@@ -168,7 +170,7 @@ namespace JSC {
: JSObject(callFrame->lexicalGlobalObject()->argumentsStructure())
, d(new ArgumentsData)
{
- ASSERT(!callFrame->callee()->body()->parameterCount());
+ ASSERT(!callFrame->callee()->jsExecutable()->parameterCount());
unsigned numArguments = callFrame->argumentCount() - 1;
@@ -214,8 +216,8 @@ namespace JSC {
{
ASSERT(!d()->registerArray);
- size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1;
- size_t numVars = d()->functionBody->generatedBytecode().m_numVars;
+ size_t numParametersMinusThis = d()->functionExecutable->generatedBytecode().m_numParameters - 1;
+ size_t numVars = d()->functionExecutable->generatedBytecode().m_numVars;
size_t numLocals = numVars + numParametersMinusThis;
if (!numLocals)
diff --git a/JavaScriptCore/runtime/ArrayConstructor.cpp b/JavaScriptCore/runtime/ArrayConstructor.cpp
index e96bdfc..0237fd4 100644
--- a/JavaScriptCore/runtime/ArrayConstructor.cpp
+++ b/JavaScriptCore/runtime/ArrayConstructor.cpp
@@ -25,15 +25,19 @@
#include "ArrayConstructor.h"
#include "ArrayPrototype.h"
+#include "Error.h"
#include "JSArray.h"
#include "JSFunction.h"
#include "Lookup.h"
+#include "PrototypeFunction.h"
namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor);
+
+static JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*, JSObject*, JSValue, const ArgList&);
-ArrayConstructor::ArrayConstructor(ExecState* exec, PassRefPtr<Structure> structure, ArrayPrototype* arrayPrototype)
+ArrayConstructor::ArrayConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, ArrayPrototype* arrayPrototype, Structure* prototypeFunctionStructure)
: InternalFunction(&exec->globalData(), structure, Identifier(exec, arrayPrototype->classInfo()->className))
{
// ECMA 15.4.3.1 Array.prototype
@@ -41,6 +45,9 @@ ArrayConstructor::ArrayConstructor(ExecState* exec, PassRefPtr<Structure> struct
// no. of arguments for constructor
putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
+
+ // ES5
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().isArray, arrayConstructorIsArray), DontEnum);
}
static JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgList& args)
@@ -82,4 +89,9 @@ CallType ArrayConstructor::getCallData(CallData& callData)
return CallTypeHost;
}
+JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*, JSObject*, JSValue, const ArgList& args)
+{
+ return jsBoolean(args.at(0).inherits(&JSArray::info));
+}
+
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ArrayConstructor.h b/JavaScriptCore/runtime/ArrayConstructor.h
index 8300d8c..6d25400 100644
--- a/JavaScriptCore/runtime/ArrayConstructor.h
+++ b/JavaScriptCore/runtime/ArrayConstructor.h
@@ -29,7 +29,7 @@ namespace JSC {
class ArrayConstructor : public InternalFunction {
public:
- ArrayConstructor(ExecState*, PassRefPtr<Structure>, ArrayPrototype*);
+ ArrayConstructor(ExecState*, NonNullPassRefPtr<Structure>, ArrayPrototype*, Structure*);
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallData(CallData&);
diff --git a/JavaScriptCore/runtime/ArrayPrototype.cpp b/JavaScriptCore/runtime/ArrayPrototype.cpp
index 807e59a..7a89447 100644
--- a/JavaScriptCore/runtime/ArrayPrototype.cpp
+++ b/JavaScriptCore/runtime/ArrayPrototype.cpp
@@ -67,7 +67,7 @@ static JSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState*, JSObject*, JS
namespace JSC {
-static inline bool isNumericCompareFunction(CallType callType, const CallData& callData)
+static inline bool isNumericCompareFunction(ExecState* exec, CallType callType, const CallData& callData)
{
if (callType != CallTypeJS)
return false;
@@ -75,10 +75,10 @@ static inline bool isNumericCompareFunction(CallType callType, const CallData& c
#if ENABLE(JIT)
// If the JIT is enabled then we need to preserve the invariant that every
// function with a CodeBlock also has JIT code.
- callData.js.functionBody->jitCode(callData.js.scopeChain);
- CodeBlock& codeBlock = callData.js.functionBody->generatedBytecode();
+ callData.js.functionExecutable->jitCode(exec, callData.js.scopeChain);
+ CodeBlock& codeBlock = callData.js.functionExecutable->generatedBytecode();
#else
- CodeBlock& codeBlock = callData.js.functionBody->bytecode(callData.js.scopeChain);
+ CodeBlock& codeBlock = callData.js.functionExecutable->bytecode(exec, callData.js.scopeChain);
#endif
return codeBlock.isNumericCompareFunction();
@@ -115,7 +115,7 @@ const ClassInfo ArrayPrototype::info = {"Array", &JSArray::info, 0, ExecState::a
*/
// ECMA 15.4.4
-ArrayPrototype::ArrayPrototype(PassRefPtr<Structure> structure)
+ArrayPrototype::ArrayPrototype(NonNullPassRefPtr<Structure> structure)
: JSArray(structure)
{
}
@@ -125,6 +125,11 @@ bool ArrayPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& prope
return getStaticFunctionSlot<JSArray>(exec, ExecState::arrayTable(exec), this, propertyName, slot);
}
+bool ArrayPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticFunctionDescriptor<JSArray>(exec, ExecState::arrayTable(exec), this, propertyName, descriptor);
+}
+
// ------------------------------ Array Functions ----------------------------
// Helper function
@@ -144,10 +149,11 @@ static void putProperty(ExecState* exec, JSObject* obj, const Identifier& proper
JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&JSArray::info))
+ bool isRealArray = isJSArray(&exec->globalData(), thisValue);
+ if (!isRealArray && !thisValue.inherits(&JSArray::info))
return throwError(exec, TypeError);
- JSObject* thisObj = asArray(thisValue);
-
+ JSArray* thisObj = asArray(thisValue);
+
HashSet<JSObject*>& arrayVisitedElements = exec->globalData().arrayVisitedElements;
if (arrayVisitedElements.size() >= MaxSecondaryThreadReentryDepth) {
if (!isMainThread() || arrayVisitedElements.size() >= MaxMainThreadReentryDepth)
@@ -158,39 +164,53 @@ JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec, JSObject*, JSValue
if (alreadyVisited)
return jsEmptyString(exec); // return an empty string, avoiding infinite recursion.
- Vector<UChar, 256> strBuffer;
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ unsigned totalSize = length ? length - 1 : 0;
+ Vector<RefPtr<UString::Rep>, 256> strBuffer(length);
for (unsigned k = 0; k < length; k++) {
- if (k >= 1)
- strBuffer.append(',');
- if (!strBuffer.data()) {
- JSObject* error = Error::create(exec, GeneralError, "Out of memory");
- exec->setException(error);
- break;
- }
-
- JSValue element = thisObj->get(exec, k);
+ JSValue element;
+ if (isRealArray && thisObj->canGetIndex(k))
+ element = thisObj->getIndex(k);
+ else
+ element = thisObj->get(exec, k);
+
if (element.isUndefinedOrNull())
continue;
-
+
UString str = element.toString(exec);
- strBuffer.append(str.data(), str.size());
-
+ strBuffer[k] = str.rep();
+ totalSize += str.size();
+
if (!strBuffer.data()) {
JSObject* error = Error::create(exec, GeneralError, "Out of memory");
exec->setException(error);
}
-
+
if (exec->hadException())
break;
}
arrayVisitedElements.remove(thisObj);
- return jsString(exec, UString(strBuffer.data(), strBuffer.data() ? strBuffer.size() : 0));
+ if (!totalSize)
+ return jsEmptyString(exec);
+ Vector<UChar> buffer;
+ buffer.reserveCapacity(totalSize);
+ if (!buffer.data())
+ return throwError(exec, GeneralError, "Out of memory");
+
+ for (unsigned i = 0; i < length; i++) {
+ if (i)
+ buffer.append(',');
+ if (RefPtr<UString::Rep> rep = strBuffer[i])
+ buffer.append(rep->data(), rep->size());
+ }
+ ASSERT(buffer.size() == totalSize);
+ unsigned finalSize = buffer.size();
+ return jsString(exec, UString(buffer.releaseBuffer(), finalSize, false));
}
JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&JSArray::info))
+ if (!thisValue.inherits(&JSArray::info))
return throwError(exec, TypeError);
JSObject* thisObj = asArray(thisValue);
@@ -298,7 +318,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec, JSObject*, JSValue t
ArgList::const_iterator it = args.begin();
ArgList::const_iterator end = args.end();
while (1) {
- if (curArg.isObject(&JSArray::info)) {
+ if (curArg.inherits(&JSArray::info)) {
unsigned length = curArg.get(exec, exec->propertyNames().length).toUInt32(exec);
JSObject* curObject = curArg.toObject(exec);
for (unsigned k = 0; k < length; ++k) {
@@ -456,7 +476,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec, JSObject*, JSValue thi
CallType callType = function.getCallData(callData);
if (thisObj->classInfo() == &JSArray::info) {
- if (isNumericCompareFunction(callType, callData))
+ if (isNumericCompareFunction(exec, callType, callData))
asArray(thisObj)->sortNumeric(exec, function, callType, callData);
else if (callType != CallTypeNone)
asArray(thisObj)->sort(exec, function, callType, callData);
diff --git a/JavaScriptCore/runtime/ArrayPrototype.h b/JavaScriptCore/runtime/ArrayPrototype.h
index 2165089..e52914c 100644
--- a/JavaScriptCore/runtime/ArrayPrototype.h
+++ b/JavaScriptCore/runtime/ArrayPrototype.h
@@ -28,9 +28,10 @@ namespace JSC {
class ArrayPrototype : public JSArray {
public:
- explicit ArrayPrototype(PassRefPtr<Structure>);
+ explicit ArrayPrototype(NonNullPassRefPtr<Structure>);
bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
diff --git a/JavaScriptCore/runtime/BatchedTransitionOptimizer.h b/JavaScriptCore/runtime/BatchedTransitionOptimizer.h
index b9f738f..929a5e7 100644
--- a/JavaScriptCore/runtime/BatchedTransitionOptimizer.h
+++ b/JavaScriptCore/runtime/BatchedTransitionOptimizer.h
@@ -38,7 +38,7 @@ namespace JSC {
: m_object(object)
{
if (!m_object->structure()->isDictionary())
- m_object->setStructure(Structure::toDictionaryTransition(m_object->structure()));
+ m_object->setStructure(Structure::toCacheableDictionaryTransition(m_object->structure()));
}
~BatchedTransitionOptimizer()
diff --git a/JavaScriptCore/runtime/BooleanConstructor.cpp b/JavaScriptCore/runtime/BooleanConstructor.cpp
index 9fcba37..b0d8df3 100644
--- a/JavaScriptCore/runtime/BooleanConstructor.cpp
+++ b/JavaScriptCore/runtime/BooleanConstructor.cpp
@@ -28,7 +28,7 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(BooleanConstructor);
-BooleanConstructor::BooleanConstructor(ExecState* exec, PassRefPtr<Structure> structure, BooleanPrototype* booleanPrototype)
+BooleanConstructor::BooleanConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, BooleanPrototype* booleanPrototype)
: InternalFunction(&exec->globalData(), structure, Identifier(exec, booleanPrototype->classInfo()->className))
{
putDirectWithoutTransition(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
diff --git a/JavaScriptCore/runtime/BooleanConstructor.h b/JavaScriptCore/runtime/BooleanConstructor.h
index d9f51ab..1d8a26a 100644
--- a/JavaScriptCore/runtime/BooleanConstructor.h
+++ b/JavaScriptCore/runtime/BooleanConstructor.h
@@ -29,7 +29,7 @@ namespace JSC {
class BooleanConstructor : public InternalFunction {
public:
- BooleanConstructor(ExecState*, PassRefPtr<Structure>, BooleanPrototype*);
+ BooleanConstructor(ExecState*, NonNullPassRefPtr<Structure>, BooleanPrototype*);
private:
virtual ConstructType getConstructData(ConstructData&);
diff --git a/JavaScriptCore/runtime/BooleanObject.cpp b/JavaScriptCore/runtime/BooleanObject.cpp
index 01f695a..c9b3846 100644
--- a/JavaScriptCore/runtime/BooleanObject.cpp
+++ b/JavaScriptCore/runtime/BooleanObject.cpp
@@ -27,7 +27,7 @@ ASSERT_CLASS_FITS_IN_CELL(BooleanObject);
const ClassInfo BooleanObject::info = { "Boolean", 0, 0, 0 };
-BooleanObject::BooleanObject(PassRefPtr<Structure> structure)
+BooleanObject::BooleanObject(NonNullPassRefPtr<Structure> structure)
: JSWrapperObject(structure)
{
}
diff --git a/JavaScriptCore/runtime/BooleanObject.h b/JavaScriptCore/runtime/BooleanObject.h
index cfd55fe..28f796a 100644
--- a/JavaScriptCore/runtime/BooleanObject.h
+++ b/JavaScriptCore/runtime/BooleanObject.h
@@ -27,10 +27,15 @@ namespace JSC {
class BooleanObject : public JSWrapperObject {
public:
- explicit BooleanObject(PassRefPtr<Structure>);
+ explicit BooleanObject(NonNullPassRefPtr<Structure>);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark | HasDefaultGetPropertyNames));
+ }
};
BooleanObject* asBooleanObject(JSValue);
diff --git a/JavaScriptCore/runtime/BooleanPrototype.cpp b/JavaScriptCore/runtime/BooleanPrototype.cpp
index 703a568..8d338f9 100644
--- a/JavaScriptCore/runtime/BooleanPrototype.cpp
+++ b/JavaScriptCore/runtime/BooleanPrototype.cpp
@@ -37,7 +37,7 @@ static JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*, JSObject*, JSVa
// ECMA 15.6.4
-BooleanPrototype::BooleanPrototype(ExecState* exec, PassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
+BooleanPrototype::BooleanPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
: BooleanObject(structure)
{
setInternalValue(jsBoolean(false));
@@ -59,7 +59,7 @@ JSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec, JSObject*, JSVal
if (thisValue == jsBoolean(true))
return jsNontrivialString(exec, "true");
- if (!thisValue.isObject(&BooleanObject::info))
+ if (!thisValue.inherits(&BooleanObject::info))
return throwError(exec, TypeError);
if (asBooleanObject(thisValue)->internalValue() == jsBoolean(false))
@@ -74,7 +74,7 @@ JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState* exec, JSObject*, JSValu
if (thisValue.isBoolean())
return thisValue;
- if (!thisValue.isObject(&BooleanObject::info))
+ if (!thisValue.inherits(&BooleanObject::info))
return throwError(exec, TypeError);
return asBooleanObject(thisValue)->internalValue();
diff --git a/JavaScriptCore/runtime/BooleanPrototype.h b/JavaScriptCore/runtime/BooleanPrototype.h
index 16f80b5..cc69b3f 100644
--- a/JavaScriptCore/runtime/BooleanPrototype.h
+++ b/JavaScriptCore/runtime/BooleanPrototype.h
@@ -27,7 +27,7 @@ namespace JSC {
class BooleanPrototype : public BooleanObject {
public:
- BooleanPrototype(ExecState*, PassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ BooleanPrototype(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
};
} // namespace JSC
diff --git a/JavaScriptCore/runtime/CallData.h b/JavaScriptCore/runtime/CallData.h
index d5b0172..24c19f9 100644
--- a/JavaScriptCore/runtime/CallData.h
+++ b/JavaScriptCore/runtime/CallData.h
@@ -35,7 +35,7 @@ namespace JSC {
class ArgList;
class ExecState;
- class FunctionBodyNode;
+ class FunctionExecutable;
class JSObject;
class JSValue;
class ScopeChainNode;
@@ -53,7 +53,7 @@ namespace JSC {
NativeFunction function;
} native;
struct {
- FunctionBodyNode* functionBody;
+ FunctionExecutable* functionExecutable;
ScopeChainNode* scopeChain;
} js;
};
diff --git a/JavaScriptCore/runtime/Collector.cpp b/JavaScriptCore/runtime/Collector.cpp
index c188016..1a5eb89 100644
--- a/JavaScriptCore/runtime/Collector.cpp
+++ b/JavaScriptCore/runtime/Collector.cpp
@@ -23,8 +23,10 @@
#include "ArgList.h"
#include "CallFrame.h"
+#include "CodeBlock.h"
#include "CollectorHeapIterator.h"
#include "Interpreter.h"
+#include "JSArray.h"
#include "JSGlobalObject.h"
#include "JSLock.h"
#include "JSONObject.h"
@@ -58,11 +60,18 @@
#elif PLATFORM(WIN_OS)
#include <windows.h>
+#include <malloc.h>
+
+#elif PLATFORM(HAIKU)
+
+#include <OS.h>
#elif PLATFORM(UNIX)
#include <stdlib.h>
+#if !PLATFORM(HAIKU)
#include <sys/mman.h>
+#endif
#include <unistd.h>
#if PLATFORM(SOLARIS)
@@ -75,9 +84,15 @@
#include <pthread_np.h>
#endif
+#if PLATFORM(QNX)
+#include <fcntl.h>
+#include <sys/procfs.h>
+#include <stdio.h>
+#include <errno.h>
+#endif
+
#endif
-#define DEBUG_COLLECTOR 0
#define COLLECT_ON_EVERY_ALLOCATION 0
using std::max;
@@ -86,7 +101,6 @@ namespace JSC {
// tunable parameters
-const size_t SPARE_EMPTY_BLOCKS = 2;
const size_t GROWTH_FACTOR = 2;
const size_t LOW_WATER_FACTOR = 4;
const size_t ALLOCATIONS_PER_COLLECTION = 4000;
@@ -99,8 +113,6 @@ const size_t MAX_NUM_BLOCKS = 256; // Max size of collector heap set to 16 MB
static RHeap* userChunk = 0;
#endif
-static void freeHeap(CollectorHeap*);
-
#if ENABLE(JSC_MULTIPLE_THREADS)
#if PLATFORM(DARWIN)
@@ -189,8 +201,8 @@ void Heap::destroy()
ASSERT(!primaryHeap.numLiveObjects);
- freeHeap(&primaryHeap);
- freeHeap(&numberHeap);
+ freeBlocks(&primaryHeap);
+ freeBlocks(&numberHeap);
#if ENABLE(JSC_MULTIPLE_THREADS)
if (m_currentThreadRegistrar) {
@@ -210,7 +222,7 @@ void Heap::destroy()
}
template <HeapType heapType>
-static NEVER_INLINE CollectorBlock* allocateBlock()
+NEVER_INLINE CollectorBlock* Heap::allocateBlock()
{
#if PLATFORM(DARWIN)
vm_address_t address = 0;
@@ -224,9 +236,15 @@ static NEVER_INLINE CollectorBlock* allocateBlock()
uintptr_t address = reinterpret_cast<uintptr_t>(mask);
memset(reinterpret_cast<void*>(address), 0, BLOCK_SIZE);
+#elif PLATFORM(WINCE)
+ void* address = VirtualAlloc(NULL, BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
#elif PLATFORM(WIN_OS)
- // windows virtual address granularity is naturally 64k
- LPVOID address = VirtualAlloc(NULL, BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
+#if COMPILER(MINGW)
+ void* address = __mingw_aligned_malloc(BLOCK_SIZE, BLOCK_SIZE);
+#else
+ void* address = _aligned_malloc(BLOCK_SIZE, BLOCK_SIZE);
+#endif
+ memset(address, 0, BLOCK_SIZE);
#elif HAVE(POSIX_MEMALIGN)
void* address;
posix_memalign(&address, BLOCK_SIZE, BLOCK_SIZE);
@@ -258,18 +276,58 @@ static NEVER_INLINE CollectorBlock* allocateBlock()
address += adjust;
memset(reinterpret_cast<void*>(address), 0, BLOCK_SIZE);
#endif
- reinterpret_cast<CollectorBlock*>(address)->type = heapType;
- return reinterpret_cast<CollectorBlock*>(address);
+
+ CollectorBlock* block = reinterpret_cast<CollectorBlock*>(address);
+ block->freeList = block->cells;
+ block->heap = this;
+ block->type = heapType;
+
+ CollectorHeap& heap = heapType == PrimaryHeap ? primaryHeap : numberHeap;
+ size_t numBlocks = heap.numBlocks;
+ if (heap.usedBlocks == numBlocks) {
+ static const size_t maxNumBlocks = ULONG_MAX / sizeof(CollectorBlock*) / GROWTH_FACTOR;
+ if (numBlocks > maxNumBlocks)
+ CRASH();
+ numBlocks = max(MIN_ARRAY_SIZE, numBlocks * GROWTH_FACTOR);
+ heap.numBlocks = numBlocks;
+ heap.blocks = static_cast<CollectorBlock**>(fastRealloc(heap.blocks, numBlocks * sizeof(CollectorBlock*)));
+ }
+ heap.blocks[heap.usedBlocks++] = block;
+
+ return block;
+}
+
+template <HeapType heapType>
+NEVER_INLINE void Heap::freeBlock(size_t block)
+{
+ CollectorHeap& heap = heapType == PrimaryHeap ? primaryHeap : numberHeap;
+
+ freeBlock(heap.blocks[block]);
+
+ // swap with the last block so we compact as we go
+ heap.blocks[block] = heap.blocks[heap.usedBlocks - 1];
+ heap.usedBlocks--;
+
+ if (heap.numBlocks > MIN_ARRAY_SIZE && heap.usedBlocks < heap.numBlocks / LOW_WATER_FACTOR) {
+ heap.numBlocks = heap.numBlocks / GROWTH_FACTOR;
+ heap.blocks = static_cast<CollectorBlock**>(fastRealloc(heap.blocks, heap.numBlocks * sizeof(CollectorBlock*)));
+ }
}
-static void freeBlock(CollectorBlock* block)
+NEVER_INLINE void Heap::freeBlock(CollectorBlock* block)
{
#if PLATFORM(DARWIN)
vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(block), BLOCK_SIZE);
#elif PLATFORM(SYMBIAN)
userChunk->Free(reinterpret_cast<TAny*>(block));
-#elif PLATFORM(WIN_OS)
+#elif PLATFORM(WINCE)
VirtualFree(block, 0, MEM_RELEASE);
+#elif PLATFORM(WIN_OS)
+#if COMPILER(MINGW)
+ __mingw_aligned_free(block);
+#else
+ _aligned_free(block);
+#endif
#elif HAVE(POSIX_MEMALIGN)
free(block);
#else
@@ -277,7 +335,7 @@ static void freeBlock(CollectorBlock* block)
#endif
}
-static void freeHeap(CollectorHeap* heap)
+void Heap::freeBlocks(CollectorHeap* heap)
{
for (size_t i = 0; i < heap->usedBlocks; ++i)
if (heap->blocks[i])
@@ -370,38 +428,23 @@ collect:
#ifndef NDEBUG
heap.operationInProgress = NoOperation;
#endif
- bool collected = collect();
+ bool foundGarbage = collect();
+ numLiveObjects = heap.numLiveObjects;
+ usedBlocks = heap.usedBlocks;
+ i = heap.firstBlockWithPossibleSpace;
#ifndef NDEBUG
heap.operationInProgress = Allocation;
#endif
- if (collected) {
- numLiveObjects = heap.numLiveObjects;
- usedBlocks = heap.usedBlocks;
- i = heap.firstBlockWithPossibleSpace;
+ if (foundGarbage)
goto scan;
- }
- }
-
- // didn't find a block, and GC didn't reclaim anything, need to allocate a new block
- size_t numBlocks = heap.numBlocks;
- if (usedBlocks == numBlocks) {
- static const size_t maxNumBlocks = ULONG_MAX / sizeof(CollectorBlock*) / GROWTH_FACTOR;
- if (numBlocks > maxNumBlocks)
- CRASH();
- numBlocks = max(MIN_ARRAY_SIZE, numBlocks * GROWTH_FACTOR);
- heap.numBlocks = numBlocks;
- heap.blocks = static_cast<CollectorBlock**>(fastRealloc(heap.blocks, numBlocks * sizeof(CollectorBlock*)));
}
+ // didn't find a block, and GC didn't reclaim anything, need to allocate a new block
targetBlock = reinterpret_cast<Block*>(allocateBlock<heapType>());
- targetBlock->freeList = targetBlock->cells;
- targetBlock->heap = this;
+ heap.firstBlockWithPossibleSpace = heap.usedBlocks - 1;
targetBlockUsedCells = 0;
- heap.blocks[usedBlocks] = reinterpret_cast<CollectorBlock*>(targetBlock);
- heap.usedBlocks = usedBlocks + 1;
- heap.firstBlockWithPossibleSpace = usedBlocks;
}
-
+
// find a free spot in the block and detach it from the free list
Cell* newCell = targetBlock->freeList;
@@ -486,6 +529,33 @@ static void* getStackBase(void* previousFrame)
}
#endif
+#if PLATFORM(QNX)
+static inline void *currentThreadStackBaseQNX()
+{
+ static void* stackBase = 0;
+ static size_t stackSize = 0;
+ static pthread_t stackThread;
+ pthread_t thread = pthread_self();
+ if (stackBase == 0 || thread != stackThread) {
+ struct _debug_thread_info threadInfo;
+ memset(&threadInfo, 0, sizeof(threadInfo));
+ threadInfo.tid = pthread_self();
+ int fd = open("/proc/self", O_RDONLY);
+ if (fd == -1) {
+ LOG_ERROR("Unable to open /proc/self (errno: %d)", errno);
+ return 0;
+ }
+ devctl(fd, DCMD_PROC_TIDSTATUS, &threadInfo, sizeof(threadInfo), 0);
+ close(fd);
+ stackBase = reinterpret_cast<void*>(threadInfo.stkbase);
+ stackSize = threadInfo.stksize;
+ ASSERT(stackBase);
+ stackThread = thread;
+ }
+ return static_cast<char*>(stackBase) + stackSize;
+}
+#endif
+
static inline void* currentThreadStackBase()
{
#if PLATFORM(DARWIN)
@@ -511,6 +581,8 @@ static inline void* currentThreadStackBase()
: "=r" (pTib)
);
return static_cast<void*>(pTib->StackBase);
+#elif PLATFORM(QNX)
+ return currentThreadStackBaseQNX();
#elif PLATFORM(SOLARIS)
stack_t s;
thr_stksegment(&s);
@@ -529,6 +601,10 @@ static inline void* currentThreadStackBase()
stackBase = (void*)info.iBase;
}
return (void*)stackBase;
+#elif PLATFORM(HAIKU)
+ thread_info threadInfo;
+ get_thread_info(find_thread(NULL), &threadInfo);
+ return threadInfo.stack_end;
#elif PLATFORM(UNIX)
static void* stackBase = 0;
static size_t stackSize = 0;
@@ -587,6 +663,8 @@ void Heap::makeUsableFromMultipleThreads()
void Heap::registerThread()
{
+ ASSERT(!m_globalData->mainThreadOnly || isMainThread());
+
if (!m_currentThreadRegistrar || pthread_getspecific(m_currentThreadRegistrar))
return;
@@ -683,7 +761,7 @@ void Heap::markConservatively(MarkStack& markStack, void* start, void* end)
// Mark the primary heap
for (size_t block = 0; block < usedPrimaryBlocks; block++) {
if ((primaryBlocks[block] == blockAddr) & (offset <= lastCellOffset)) {
- if (reinterpret_cast<CollectorCell*>(xAsBits)->u.freeCell.zeroIfFree != 0) {
+ if (reinterpret_cast<CollectorCell*>(xAsBits)->u.freeCell.zeroIfFree) {
markStack.append(reinterpret_cast<JSCell*>(xAsBits));
markStack.drain();
}
@@ -704,10 +782,16 @@ void NEVER_INLINE Heap::markCurrentThreadConservativelyInternal(MarkStack& markS
markConservatively(markStack, stackPointer, stackBase);
}
+#if COMPILER(GCC)
+#define REGISTER_BUFFER_ALIGNMENT __attribute__ ((aligned (sizeof(void*))))
+#else
+#define REGISTER_BUFFER_ALIGNMENT
+#endif
+
void Heap::markCurrentThreadConservatively(MarkStack& markStack)
{
// setjmp forces volatile registers onto the stack
- jmp_buf registers;
+ jmp_buf registers REGISTER_BUFFER_ALIGNMENT;
#if COMPILER(MSVC)
#pragma warning(push)
#pragma warning(disable: 4611)
@@ -896,16 +980,6 @@ void Heap::markStackObjectsConservatively(MarkStack& markStack)
#endif
}
-void Heap::setGCProtectNeedsLocking()
-{
- // Most clients do not need to call this, with the notable exception of WebCore.
- // Clients that use shared heap have JSLock protection, while others are supposed
- // to do explicit locking. WebCore violates this contract in Database code,
- // which calls gcUnprotect from a secondary thread.
- if (!m_protectedValuesMutex)
- m_protectedValuesMutex.set(new Mutex);
-}
-
void Heap::protect(JSValue k)
{
ASSERT(k);
@@ -914,13 +988,7 @@ void Heap::protect(JSValue k)
if (!k.isCell())
return;
- if (m_protectedValuesMutex)
- m_protectedValuesMutex->lock();
-
m_protectedValues.add(k.asCell());
-
- if (m_protectedValuesMutex)
- m_protectedValuesMutex->unlock();
}
void Heap::unprotect(JSValue k)
@@ -931,38 +999,16 @@ void Heap::unprotect(JSValue k)
if (!k.isCell())
return;
- if (m_protectedValuesMutex)
- m_protectedValuesMutex->lock();
-
m_protectedValues.remove(k.asCell());
-
- if (m_protectedValuesMutex)
- m_protectedValuesMutex->unlock();
-}
-
-Heap* Heap::heap(JSValue v)
-{
- if (!v.isCell())
- return 0;
- return Heap::cellBlock(v.asCell())->heap;
}
void Heap::markProtectedObjects(MarkStack& markStack)
{
- if (m_protectedValuesMutex)
- m_protectedValuesMutex->lock();
-
ProtectCountSet::iterator end = m_protectedValues.end();
for (ProtectCountSet::iterator it = m_protectedValues.begin(); it != end; ++it) {
- JSCell* val = it->first;
- if (!val->marked()) {
- markStack.append(val);
- markStack.drain();
- }
+ markStack.append(it->first);
+ markStack.drain();
}
-
- if (m_protectedValuesMutex)
- m_protectedValuesMutex->unlock();
}
template <HeapType heapType> size_t Heap::sweep()
@@ -1036,31 +1082,34 @@ template <HeapType heapType> size_t Heap::sweep()
curBlock->freeList = freeList;
curBlock->marked.clearAll();
- if (usedCells == 0) {
- emptyBlocks++;
- if (emptyBlocks > SPARE_EMPTY_BLOCKS) {
-#if !DEBUG_COLLECTOR
- freeBlock(reinterpret_cast<CollectorBlock*>(curBlock));
-#endif
- // swap with the last block so we compact as we go
- heap.blocks[block] = heap.blocks[heap.usedBlocks - 1];
- heap.usedBlocks--;
- block--; // Don't move forward a step in this case
-
- if (heap.numBlocks > MIN_ARRAY_SIZE && heap.usedBlocks < heap.numBlocks / LOW_WATER_FACTOR) {
- heap.numBlocks = heap.numBlocks / GROWTH_FACTOR;
- heap.blocks = static_cast<CollectorBlock**>(fastRealloc(heap.blocks, heap.numBlocks * sizeof(CollectorBlock*)));
- }
- }
- }
+ if (!usedCells)
+ ++emptyBlocks;
}
if (heap.numLiveObjects != numLiveObjects)
heap.firstBlockWithPossibleSpace = 0;
-
+
heap.numLiveObjects = numLiveObjects;
heap.numLiveObjectsAtLastCollect = numLiveObjects;
heap.extraCost = 0;
+
+ if (!emptyBlocks)
+ return numLiveObjects;
+
+ size_t neededCells = 1.25f * (numLiveObjects + max(ALLOCATIONS_PER_COLLECTION, numLiveObjects));
+ size_t neededBlocks = (neededCells + HeapConstants<heapType>::cellsPerBlock - 1) / HeapConstants<heapType>::cellsPerBlock;
+ for (size_t block = 0; block < heap.usedBlocks; block++) {
+ if (heap.usedBlocks <= neededBlocks)
+ break;
+
+ Block* curBlock = reinterpret_cast<Block*>(heap.blocks[block]);
+ if (curBlock->usedCells)
+ continue;
+
+ freeBlock<heapType>(block);
+ block--; // Don't move forward a step in this case
+ }
+
return numLiveObjects;
}
@@ -1087,12 +1136,12 @@ bool Heap::collect()
markProtectedObjects(markStack);
if (m_markListSet && m_markListSet->size())
MarkedArgumentBuffer::markLists(markStack, *m_markListSet);
- if (m_globalData->exception && !m_globalData->exception.marked())
+ if (m_globalData->exception)
markStack.append(m_globalData->exception);
m_globalData->interpreter->registerFile().markCallFrames(markStack, this);
- m_globalData->smallStrings.mark();
- if (m_globalData->scopeNodeBeingReparsed)
- m_globalData->scopeNodeBeingReparsed->markAggregate(markStack);
+ m_globalData->smallStrings.markChildren(markStack);
+ if (m_globalData->functionCodeBlockBeingReparsed)
+ m_globalData->functionCodeBlockBeingReparsed->markAggregate(markStack);
if (m_globalData->firstStringifierToMark)
JSONObject::markStringifiers(markStack, m_globalData->firstStringifierToMark);
@@ -1151,9 +1200,6 @@ size_t Heap::globalObjectCount()
size_t Heap::protectedGlobalObjectCount()
{
- if (m_protectedValuesMutex)
- m_protectedValuesMutex->lock();
-
size_t count = 0;
if (JSGlobalObject* head = m_globalData->head) {
JSGlobalObject* o = head;
@@ -1164,23 +1210,12 @@ size_t Heap::protectedGlobalObjectCount()
} while (o != head);
}
- if (m_protectedValuesMutex)
- m_protectedValuesMutex->unlock();
-
return count;
}
size_t Heap::protectedObjectCount()
{
- if (m_protectedValuesMutex)
- m_protectedValuesMutex->lock();
-
- size_t result = m_protectedValues.size();
-
- if (m_protectedValuesMutex)
- m_protectedValuesMutex->unlock();
-
- return result;
+ return m_protectedValues.size();
}
static const char* typeName(JSCell* cell)
@@ -1194,7 +1229,7 @@ static const char* typeName(JSCell* cell)
if (cell->isGetterSetter())
return "gettersetter";
ASSERT(cell->isObject());
- const ClassInfo* info = static_cast<JSObject*>(cell)->classInfo();
+ const ClassInfo* info = cell->classInfo();
return info ? info->className : "Object";
}
@@ -1202,16 +1237,10 @@ HashCountedSet<const char*>* Heap::protectedObjectTypeCounts()
{
HashCountedSet<const char*>* counts = new HashCountedSet<const char*>;
- if (m_protectedValuesMutex)
- m_protectedValuesMutex->lock();
-
ProtectCountSet::iterator end = m_protectedValues.end();
for (ProtectCountSet::iterator it = m_protectedValues.begin(); it != end; ++it)
counts->add(typeName(it->first));
- if (m_protectedValuesMutex)
- m_protectedValuesMutex->unlock();
-
return counts;
}
diff --git a/JavaScriptCore/runtime/Collector.h b/JavaScriptCore/runtime/Collector.h
index 877f890..2ce13dc 100644
--- a/JavaScriptCore/runtime/Collector.h
+++ b/JavaScriptCore/runtime/Collector.h
@@ -96,11 +96,11 @@ namespace JSC {
};
Statistics statistics() const;
- void setGCProtectNeedsLocking();
void protect(JSValue);
void unprotect(JSValue);
static Heap* heap(JSValue); // 0 for immediate values
+ static Heap* heap(JSCell*);
size_t globalObjectCount();
size_t protectedObjectCount();
@@ -133,6 +133,11 @@ namespace JSC {
Heap(JSGlobalData*);
~Heap();
+ template <HeapType heapType> NEVER_INLINE CollectorBlock* allocateBlock();
+ template <HeapType heapType> NEVER_INLINE void freeBlock(size_t);
+ NEVER_INLINE void freeBlock(CollectorBlock*);
+ void freeBlocks(CollectorHeap*);
+
void recordExtraCost(size_t);
void markProtectedObjects(MarkStack&);
void markCurrentThreadConservatively(MarkStack&);
@@ -145,7 +150,6 @@ namespace JSC {
CollectorHeap primaryHeap;
CollectorHeap numberHeap;
- OwnPtr<Mutex> m_protectedValuesMutex; // Only non-null if the client explicitly requested it via setGCPrtotectNeedsLocking().
ProtectCountSet m_protectedValues;
HashSet<MarkedArgumentBuffer*>* m_markListSet;
@@ -175,7 +179,11 @@ namespace JSC {
#endif
template<> struct CellSize<sizeof(uint64_t)> { static const size_t m_value = 64; };
- const size_t BLOCK_SIZE = 16 * 4096; // 64k
+#if PLATFORM(WINCE) || PLATFORM(SYMBIAN)
+ const size_t BLOCK_SIZE = 64 * 1024; // 64k
+#else
+ const size_t BLOCK_SIZE = 64 * 4096; // 256k
+#endif
// derived constants
const size_t BLOCK_OFFSET_MASK = BLOCK_SIZE - 1;
diff --git a/JavaScriptCore/runtime/CommonIdentifiers.h b/JavaScriptCore/runtime/CommonIdentifiers.h
index 148d3dd..abe5038 100644
--- a/JavaScriptCore/runtime/CommonIdentifiers.h
+++ b/JavaScriptCore/runtime/CommonIdentifiers.h
@@ -37,17 +37,26 @@
macro(callee) \
macro(caller) \
macro(compile) \
+ macro(configurable) \
macro(constructor) \
+ macro(create) \
+ macro(defineProperty) \
+ macro(defineProperties) \
+ macro(enumerable) \
macro(eval) \
macro(exec) \
macro(fromCharCode) \
macro(global) \
+ macro(get) \
macro(getPrototypeOf) \
+ macro(getOwnPropertyDescriptor) \
macro(hasOwnProperty) \
macro(ignoreCase) \
macro(index) \
macro(input) \
+ macro(isArray) \
macro(isPrototypeOf) \
+ macro(keys) \
macro(length) \
macro(message) \
macro(multiline) \
@@ -56,6 +65,7 @@
macro(parse) \
macro(propertyIsEnumerable) \
macro(prototype) \
+ macro(set) \
macro(source) \
macro(test) \
macro(toExponential) \
@@ -66,7 +76,9 @@
macro(toPrecision) \
macro(toString) \
macro(UTC) \
+ macro(value) \
macro(valueOf) \
+ macro(writable) \
macro(displayName)
namespace JSC {
diff --git a/JavaScriptCore/runtime/Completion.cpp b/JavaScriptCore/runtime/Completion.cpp
index b8b1581..2507698 100644
--- a/JavaScriptCore/runtime/Completion.cpp
+++ b/JavaScriptCore/runtime/Completion.cpp
@@ -31,40 +31,33 @@
#include "Debugger.h"
#include <stdio.h>
-#if !PLATFORM(WIN_OS)
-#include <unistd.h>
-#endif
-
namespace JSC {
Completion checkSyntax(ExecState* exec, const SourceCode& source)
{
JSLock lock(exec);
- int errLine;
- UString errMsg;
+ RefPtr<ProgramExecutable> program = ProgramExecutable::create(exec, source);
+ JSObject* error = program->checkSyntax(exec);
+ if (error)
+ return Completion(Throw, error);
- RefPtr<ProgramNode> progNode = exec->globalData().parser->parse<ProgramNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);
- if (!progNode)
- return Completion(Throw, Error::create(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url()));
return Completion(Normal);
}
Completion evaluate(ExecState* exec, ScopeChain& scopeChain, const SourceCode& source, JSValue thisValue)
{
JSLock lock(exec);
-
- int errLine;
- UString errMsg;
- RefPtr<ProgramNode> programNode = exec->globalData().parser->parse<ProgramNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);
- if (!programNode)
- return Completion(Throw, Error::create(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url()));
+ RefPtr<ProgramExecutable> program = ProgramExecutable::create(exec, source);
+ JSObject* error = program->compile(exec, scopeChain.node());
+ if (error)
+ return Completion(Throw, error);
JSObject* thisObj = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec);
JSValue exception;
- JSValue result = exec->interpreter()->execute(programNode.get(), exec, scopeChain.node(), thisObj, &exception);
+ JSValue result = exec->interpreter()->execute(program.get(), exec, scopeChain.node(), thisObj, &exception);
if (exception) {
if (exception.isObject() && asObject(exception)->isWatchdogException())
diff --git a/JavaScriptCore/runtime/ConstructData.h b/JavaScriptCore/runtime/ConstructData.h
index 9d580d5..6b954a6 100644
--- a/JavaScriptCore/runtime/ConstructData.h
+++ b/JavaScriptCore/runtime/ConstructData.h
@@ -33,7 +33,7 @@ namespace JSC {
class ArgList;
class ExecState;
- class FunctionBodyNode;
+ class FunctionExecutable;
class JSObject;
class JSValue;
class ScopeChainNode;
@@ -51,7 +51,7 @@ namespace JSC {
NativeConstructor function;
} native;
struct {
- FunctionBodyNode* functionBody;
+ FunctionExecutable* functionExecutable;
ScopeChainNode* scopeChain;
} js;
};
diff --git a/JavaScriptCore/runtime/DateConstructor.cpp b/JavaScriptCore/runtime/DateConstructor.cpp
index 2f52cff..f9b7d84 100644
--- a/JavaScriptCore/runtime/DateConstructor.cpp
+++ b/JavaScriptCore/runtime/DateConstructor.cpp
@@ -57,7 +57,7 @@ static JSValue JSC_HOST_CALL dateParse(ExecState*, JSObject*, JSValue, const Arg
static JSValue JSC_HOST_CALL dateNow(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL dateUTC(ExecState*, JSObject*, JSValue, const ArgList&);
-DateConstructor::DateConstructor(ExecState* exec, PassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, DatePrototype* datePrototype)
+DateConstructor::DateConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, DatePrototype* datePrototype)
: InternalFunction(&exec->globalData(), structure, Identifier(exec, datePrototype->classInfo()->className))
{
putDirectWithoutTransition(exec->propertyNames().prototype, datePrototype, DontEnum|DontDelete|ReadOnly);
@@ -79,7 +79,7 @@ JSObject* constructDate(ExecState* exec, const ArgList& args)
if (numArgs == 0) // new Date() ECMA 15.9.3.3
value = getCurrentUTCTime();
else if (numArgs == 1) {
- if (args.at(0).isObject(&DateInstance::info))
+ if (args.at(0).inherits(&DateInstance::info))
value = asDateInstance(args.at(0))->internalNumber();
else {
JSValue primitive = args.at(0).toPrimitive(exec);
diff --git a/JavaScriptCore/runtime/DateConstructor.h b/JavaScriptCore/runtime/DateConstructor.h
index dcef3cc..10e450e 100644
--- a/JavaScriptCore/runtime/DateConstructor.h
+++ b/JavaScriptCore/runtime/DateConstructor.h
@@ -29,7 +29,7 @@ namespace JSC {
class DateConstructor : public InternalFunction {
public:
- DateConstructor(ExecState*, PassRefPtr<Structure>, Structure* prototypeFunctionStructure, DatePrototype*);
+ DateConstructor(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure, DatePrototype*);
private:
virtual ConstructType getConstructData(ConstructData&);
diff --git a/JavaScriptCore/runtime/DateInstance.cpp b/JavaScriptCore/runtime/DateInstance.cpp
index 62791ae..4cd58f5 100644
--- a/JavaScriptCore/runtime/DateInstance.cpp
+++ b/JavaScriptCore/runtime/DateInstance.cpp
@@ -22,6 +22,8 @@
#include "config.h"
#include "DateInstance.h"
+#include "JSGlobalObject.h"
+
#include <math.h>
#include <wtf/DateMath.h>
#include <wtf/MathExtras.h>
@@ -39,12 +41,19 @@ struct DateInstance::Cache {
const ClassInfo DateInstance::info = {"Date", 0, 0, 0};
-DateInstance::DateInstance(PassRefPtr<Structure> structure)
+DateInstance::DateInstance(NonNullPassRefPtr<Structure> structure)
: JSWrapperObject(structure)
, m_cache(0)
{
}
+DateInstance::DateInstance(ExecState* exec, double time)
+ : JSWrapperObject(exec->lexicalGlobalObject()->dateStructure())
+ , m_cache(0)
+{
+ setInternalValue(jsNumber(exec, timeClip(time)));
+}
+
DateInstance::~DateInstance()
{
delete m_cache;
diff --git a/JavaScriptCore/runtime/DateInstance.h b/JavaScriptCore/runtime/DateInstance.h
index 3b73521..36d90b1 100644
--- a/JavaScriptCore/runtime/DateInstance.h
+++ b/JavaScriptCore/runtime/DateInstance.h
@@ -31,7 +31,8 @@ namespace JSC {
class DateInstance : public JSWrapperObject {
public:
- explicit DateInstance(PassRefPtr<Structure>);
+ DateInstance(ExecState*, double);
+ explicit DateInstance(NonNullPassRefPtr<Structure>);
virtual ~DateInstance();
double internalNumber() const { return internalValue().uncheckedGetNumber(); }
@@ -41,7 +42,7 @@ namespace JSC {
bool getTime(double& milliseconds, int& offset) const;
bool getUTCTime(double& milliseconds) const;
- static const ClassInfo info;
+ static JS_EXPORTDATA const ClassInfo info;
void msToGregorianDateTime(double, bool outputIsUTC, WTF::GregorianDateTime&) const;
diff --git a/JavaScriptCore/runtime/DatePrototype.cpp b/JavaScriptCore/runtime/DatePrototype.cpp
index e2482f4..e46ab67 100644
--- a/JavaScriptCore/runtime/DatePrototype.cpp
+++ b/JavaScriptCore/runtime/DatePrototype.cpp
@@ -198,8 +198,8 @@ static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, L
{
#if HAVE(LANGINFO_H)
static const nl_item formats[] = { D_T_FMT, D_FMT, T_FMT };
-#elif PLATFORM(WINCE) && !PLATFORM(QT)
- // strftime() we are using does not support #
+#elif (PLATFORM(WINCE) && !PLATFORM(QT)) || PLATFORM(SYMBIAN)
+ // strftime() does not support '#' on WinCE or Symbian
static const char* const formatStrings[] = { "%c", "%x", "%X" };
#else
static const char* const formatStrings[] = { "%#c", "%#x", "%X" };
@@ -395,7 +395,7 @@ const ClassInfo DatePrototype::info = {"Date", &DateInstance::info, 0, ExecState
// ECMA 15.9.4
-DatePrototype::DatePrototype(ExecState* exec, PassRefPtr<Structure> structure)
+DatePrototype::DatePrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure)
: DateInstance(structure)
{
setInternalValue(jsNaN(exec));
@@ -407,11 +407,17 @@ bool DatePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& proper
return getStaticFunctionSlot<JSObject>(exec, ExecState::dateTable(exec), this, propertyName, slot);
}
+
+bool DatePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticFunctionDescriptor<JSObject>(exec, ExecState::dateTable(exec), this, propertyName, descriptor);
+}
+
// Functions
JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -428,7 +434,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec, JSObject*, JSValue
JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -445,7 +451,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSVal
JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -457,17 +463,17 @@ JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSVal
GregorianDateTime t;
thisDateObj->msToGregorianDateTime(milli, utc, t);
- // Maximum amount of space we need in buffer: 6 (max. digits in year) + 2 * 5 (2 characters each for month, day, hour, minute, second)
- // 6 for formatting and one for null termination = 23. We add one extra character to allow us to force null termination.
- char buffer[24];
- snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02dZ", 1900 + t.year, t.month + 1, t.monthDay, t.hour, t.minute, t.second);
+ // Maximum amount of space we need in buffer: 6 (max. digits in year) + 2 * 5 (2 characters each for month, day, hour, minute, second) + 4 (. + 3 digits for milliseconds)
+ // 6 for formatting and one for null termination = 27. We add one extra character to allow us to force null termination.
+ char buffer[28];
+ snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + t.year, t.month + 1, t.monthDay, t.hour, t.minute, t.second, static_cast<int>(fmod(milli, 1000)));
buffer[sizeof(buffer) - 1] = 0;
return jsNontrivialString(exec, buffer);
}
JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -484,7 +490,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec, JSObject*, JSVa
JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -501,7 +507,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSVa
JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -514,7 +520,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JS
JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -527,7 +533,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec, JSObject*
JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -540,7 +546,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject*
JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -553,7 +559,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue t
JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -570,7 +576,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSVal
JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -587,7 +593,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JS
JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -604,7 +610,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSVal
JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -621,7 +627,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue
JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -638,7 +644,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSVal
JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -655,7 +661,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValue t
JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -672,7 +678,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValu
JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -689,7 +695,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValue th
JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -706,7 +712,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValue
JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -723,7 +729,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue
JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -740,7 +746,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSVal
JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -757,7 +763,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValu
JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -774,7 +780,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSV
JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -791,7 +797,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValu
JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -808,7 +814,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSV
JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -823,7 +829,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, J
JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -838,7 +844,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject*
JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -855,7 +861,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*,
JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -868,7 +874,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec, JSObject*, JSValue t
static JSValue setNewValueFromTimeArgs(ExecState* exec, JSValue thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -899,7 +905,7 @@ static JSValue setNewValueFromTimeArgs(ExecState* exec, JSValue thisValue, const
static JSValue setNewValueFromDateArgs(ExecState* exec, JSValue thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -1020,7 +1026,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState* exec, JSObject*, JS
JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -1062,7 +1068,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t
JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&DateInstance::info))
+ if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
diff --git a/JavaScriptCore/runtime/DatePrototype.h b/JavaScriptCore/runtime/DatePrototype.h
index 5f4d0ec..caed2d4 100644
--- a/JavaScriptCore/runtime/DatePrototype.h
+++ b/JavaScriptCore/runtime/DatePrototype.h
@@ -29,16 +29,17 @@ namespace JSC {
class DatePrototype : public DateInstance {
public:
- DatePrototype(ExecState*, PassRefPtr<Structure>);
+ DatePrototype(ExecState*, NonNullPassRefPtr<Structure>);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType));
+ return Structure::create(prototype, TypeInfo(ObjectType, HasDefaultGetPropertyNames));
}
};
diff --git a/JavaScriptCore/runtime/Error.cpp b/JavaScriptCore/runtime/Error.cpp
index db1d8cc..ddd4bc4 100644
--- a/JavaScriptCore/runtime/Error.cpp
+++ b/JavaScriptCore/runtime/Error.cpp
@@ -97,6 +97,12 @@ JSObject* Error::create(ExecState* exec, ErrorType type, const char* message)
return create(exec, type, message, -1, -1, NULL);
}
+JSObject* throwError(ExecState* exec, JSObject* error)
+{
+ exec->setException(error);
+ return error;
+}
+
JSObject* throwError(ExecState* exec, ErrorType type)
{
JSObject* error = Error::create(exec, type, UString(), -1, -1, NULL);
diff --git a/JavaScriptCore/runtime/Error.h b/JavaScriptCore/runtime/Error.h
index adf7fdf..e959cff 100644
--- a/JavaScriptCore/runtime/Error.h
+++ b/JavaScriptCore/runtime/Error.h
@@ -59,6 +59,7 @@ namespace JSC {
JSObject* throwError(ExecState*, ErrorType, const UString& message);
JSObject* throwError(ExecState*, ErrorType, const char* message);
JSObject* throwError(ExecState*, ErrorType);
+ JSObject* throwError(ExecState*, JSObject*);
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ErrorConstructor.cpp b/JavaScriptCore/runtime/ErrorConstructor.cpp
index 07b7e23..b9c3f58 100644
--- a/JavaScriptCore/runtime/ErrorConstructor.cpp
+++ b/JavaScriptCore/runtime/ErrorConstructor.cpp
@@ -29,7 +29,7 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(ErrorConstructor);
-ErrorConstructor::ErrorConstructor(ExecState* exec, PassRefPtr<Structure> structure, ErrorPrototype* errorPrototype)
+ErrorConstructor::ErrorConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, ErrorPrototype* errorPrototype)
: InternalFunction(&exec->globalData(), structure, Identifier(exec, errorPrototype->classInfo()->className))
{
// ECMA 15.11.3.1 Error.prototype
diff --git a/JavaScriptCore/runtime/ErrorConstructor.h b/JavaScriptCore/runtime/ErrorConstructor.h
index 2dd4124..e3d789b 100644
--- a/JavaScriptCore/runtime/ErrorConstructor.h
+++ b/JavaScriptCore/runtime/ErrorConstructor.h
@@ -30,7 +30,7 @@ namespace JSC {
class ErrorConstructor : public InternalFunction {
public:
- ErrorConstructor(ExecState*, PassRefPtr<Structure>, ErrorPrototype*);
+ ErrorConstructor(ExecState*, NonNullPassRefPtr<Structure>, ErrorPrototype*);
private:
virtual ConstructType getConstructData(ConstructData&);
diff --git a/JavaScriptCore/runtime/ErrorInstance.cpp b/JavaScriptCore/runtime/ErrorInstance.cpp
index 2e2cdce..1cdb87a 100644
--- a/JavaScriptCore/runtime/ErrorInstance.cpp
+++ b/JavaScriptCore/runtime/ErrorInstance.cpp
@@ -25,7 +25,7 @@ namespace JSC {
const ClassInfo ErrorInstance::info = { "Error", 0, 0, 0 };
-ErrorInstance::ErrorInstance(PassRefPtr<Structure> structure)
+ErrorInstance::ErrorInstance(NonNullPassRefPtr<Structure> structure)
: JSObject(structure)
{
}
diff --git a/JavaScriptCore/runtime/ErrorInstance.h b/JavaScriptCore/runtime/ErrorInstance.h
index 6f9d262..9f53b51 100644
--- a/JavaScriptCore/runtime/ErrorInstance.h
+++ b/JavaScriptCore/runtime/ErrorInstance.h
@@ -27,7 +27,7 @@ namespace JSC {
class ErrorInstance : public JSObject {
public:
- explicit ErrorInstance(PassRefPtr<Structure>);
+ explicit ErrorInstance(NonNullPassRefPtr<Structure>);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
diff --git a/JavaScriptCore/runtime/ErrorPrototype.cpp b/JavaScriptCore/runtime/ErrorPrototype.cpp
index 599390e..a9a7a43 100644
--- a/JavaScriptCore/runtime/ErrorPrototype.cpp
+++ b/JavaScriptCore/runtime/ErrorPrototype.cpp
@@ -34,7 +34,7 @@ ASSERT_CLASS_FITS_IN_CELL(ErrorPrototype);
static JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
// ECMA 15.9.4
-ErrorPrototype::ErrorPrototype(ExecState* exec, PassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
+ErrorPrototype::ErrorPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
: ErrorInstance(structure)
{
// The constructor will be added later in ErrorConstructor's constructor
diff --git a/JavaScriptCore/runtime/ErrorPrototype.h b/JavaScriptCore/runtime/ErrorPrototype.h
index 53d12d9..a561590 100644
--- a/JavaScriptCore/runtime/ErrorPrototype.h
+++ b/JavaScriptCore/runtime/ErrorPrototype.h
@@ -29,7 +29,7 @@ namespace JSC {
class ErrorPrototype : public ErrorInstance {
public:
- ErrorPrototype(ExecState*, PassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ ErrorPrototype(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
};
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ExceptionHelpers.cpp b/JavaScriptCore/runtime/ExceptionHelpers.cpp
index e63594c..5bead90 100644
--- a/JavaScriptCore/runtime/ExceptionHelpers.cpp
+++ b/JavaScriptCore/runtime/ExceptionHelpers.cpp
@@ -66,6 +66,11 @@ JSValue createStackOverflowError(ExecState* exec)
return createError(exec, RangeError, "Maximum call stack size exceeded.");
}
+JSValue createTypeError(ExecState* exec, const char* message)
+{
+ return createError(exec, TypeError, message);
+}
+
JSValue createUndefinedVariableError(ExecState* exec, const Identifier& ident, unsigned bytecodeOffset, CodeBlock* codeBlock)
{
int startOffset = 0;
@@ -74,7 +79,7 @@ JSValue createUndefinedVariableError(ExecState* exec, const Identifier& ident, u
int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
UString message = "Can't find variable: ";
message.append(ident.ustring());
- JSObject* exception = Error::create(exec, ReferenceError, message, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
+ JSObject* exception = Error::create(exec, ReferenceError, message, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
@@ -136,7 +141,7 @@ JSObject* createInvalidParamError(ExecState* exec, const char* op, JSValue value
int divotPoint = 0;
int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint, divotPoint + endOffset, value, message);
- JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
+ JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
@@ -157,7 +162,7 @@ JSObject* createNotAConstructorError(ExecState* exec, JSValue value, unsigned by
startPoint++;
UString errorMessage = createErrorMessage(exec, codeBlock, line, startPoint, divotPoint, value, "not a constructor");
- JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
+ JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
@@ -171,7 +176,7 @@ JSValue createNotAFunctionError(ExecState* exec, JSValue value, unsigned bytecod
int divotPoint = 0;
int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, value, "not a function");
- JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
+ JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
@@ -201,7 +206,7 @@ JSObject* createNotAnObjectError(ExecState* exec, JSNotAnObjectErrorStub* error,
int divotPoint = 0;
int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, error->isNull() ? jsNull() : jsUndefined(), "not an object");
- JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
+ JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
diff --git a/JavaScriptCore/runtime/ExceptionHelpers.h b/JavaScriptCore/runtime/ExceptionHelpers.h
index 4c5bec1..e739d09 100644
--- a/JavaScriptCore/runtime/ExceptionHelpers.h
+++ b/JavaScriptCore/runtime/ExceptionHelpers.h
@@ -44,6 +44,7 @@ namespace JSC {
JSValue createInterruptedExecutionException(JSGlobalData*);
JSValue createStackOverflowError(ExecState*);
+ JSValue createTypeError(ExecState*, const char* message);
JSValue createUndefinedVariableError(ExecState*, const Identifier&, unsigned bytecodeOffset, CodeBlock*);
JSNotAnObjectErrorStub* createNotAnObjectErrorStub(ExecState*, bool isNull);
JSObject* createInvalidParamError(ExecState*, const char* op, JSValue, unsigned bytecodeOffset, CodeBlock*);
diff --git a/JavaScriptCore/runtime/Executable.cpp b/JavaScriptCore/runtime/Executable.cpp
new file mode 100644
index 0000000..7586746
--- /dev/null
+++ b/JavaScriptCore/runtime/Executable.cpp
@@ -0,0 +1,280 @@
+/*
+ * Copyright (C) 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 "Executable.h"
+
+#include "BytecodeGenerator.h"
+#include "CodeBlock.h"
+#include "JIT.h"
+#include "Parser.h"
+#include "Vector.h"
+
+namespace JSC {
+
+#if ENABLE(JIT)
+NativeExecutable::~NativeExecutable()
+{
+}
+#endif
+
+VPtrHackExecutable::~VPtrHackExecutable()
+{
+}
+
+EvalExecutable::~EvalExecutable()
+{
+ delete m_evalCodeBlock;
+}
+
+ProgramExecutable::~ProgramExecutable()
+{
+ delete m_programCodeBlock;
+}
+
+FunctionExecutable::~FunctionExecutable()
+{
+ delete m_codeBlock;
+}
+
+JSObject* EvalExecutable::compile(ExecState* exec, ScopeChainNode* scopeChainNode)
+{
+ int errLine;
+ UString errMsg;
+ RefPtr<EvalNode> evalNode = exec->globalData().parser->parse<EvalNode>(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg);
+ if (!evalNode)
+ return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url());
+ recordParse(evalNode->features(), evalNode->lineNo(), evalNode->lastLine());
+
+ ScopeChain scopeChain(scopeChainNode);
+ JSGlobalObject* globalObject = scopeChain.globalObject();
+
+ ASSERT(!m_evalCodeBlock);
+ m_evalCodeBlock = new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth());
+ OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(evalNode.get(), globalObject->debugger(), scopeChain, m_evalCodeBlock->symbolTable(), m_evalCodeBlock));
+ generator->generate();
+
+ evalNode->destroyData();
+ return 0;
+}
+
+JSObject* ProgramExecutable::checkSyntax(ExecState* exec)
+{
+ int errLine;
+ UString errMsg;
+ RefPtr<ProgramNode> programNode = exec->globalData().parser->parse<ProgramNode>(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg);
+ if (!programNode)
+ return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url());
+ return 0;
+}
+
+JSObject* ProgramExecutable::compile(ExecState* exec, ScopeChainNode* scopeChainNode)
+{
+ int errLine;
+ UString errMsg;
+ RefPtr<ProgramNode> programNode = exec->globalData().parser->parse<ProgramNode>(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg);
+ if (!programNode)
+ return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url());
+ recordParse(programNode->features(), programNode->lineNo(), programNode->lastLine());
+
+ ScopeChain scopeChain(scopeChainNode);
+ JSGlobalObject* globalObject = scopeChain.globalObject();
+
+ ASSERT(!m_programCodeBlock);
+ m_programCodeBlock = new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider());
+ OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(programNode.get(), globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock));
+ generator->generate();
+
+ programNode->destroyData();
+ return 0;
+}
+
+void FunctionExecutable::compile(ExecState*, ScopeChainNode* scopeChainNode)
+{
+ JSGlobalData* globalData = scopeChainNode->globalData;
+ RefPtr<FunctionBodyNode> body = globalData->parser->parse<FunctionBodyNode>(globalData, 0, 0, m_source);
+ if (m_forceUsesArguments)
+ body->setUsesArguments();
+ body->finishParsing(m_parameters, m_name);
+ recordParse(body->features(), body->lineNo(), body->lastLine());
+
+ ScopeChain scopeChain(scopeChainNode);
+ JSGlobalObject* globalObject = scopeChain.globalObject();
+
+ ASSERT(!m_codeBlock);
+ m_codeBlock = new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset());
+ OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlock->symbolTable(), m_codeBlock));
+ generator->generate();
+ m_numParameters = m_codeBlock->m_numParameters;
+ ASSERT(m_numParameters);
+ m_numVariables = m_codeBlock->m_numVars;
+
+ body->destroyData();
+}
+
+#if ENABLE(JIT)
+
+void EvalExecutable::generateJITCode(ExecState* exec, ScopeChainNode* scopeChainNode)
+{
+ CodeBlock* codeBlock = &bytecode(exec, scopeChainNode);
+ m_jitCode = JIT::compile(scopeChainNode->globalData, codeBlock);
+
+#if !ENABLE(OPCODE_SAMPLING)
+ if (!BytecodeGenerator::dumpsGeneratedCode())
+ codeBlock->discardBytecode();
+#endif
+}
+
+void ProgramExecutable::generateJITCode(ExecState* exec, ScopeChainNode* scopeChainNode)
+{
+ CodeBlock* codeBlock = &bytecode(exec, scopeChainNode);
+ m_jitCode = JIT::compile(scopeChainNode->globalData, codeBlock);
+
+#if !ENABLE(OPCODE_SAMPLING)
+ if (!BytecodeGenerator::dumpsGeneratedCode())
+ codeBlock->discardBytecode();
+#endif
+}
+
+void FunctionExecutable::generateJITCode(ExecState* exec, ScopeChainNode* scopeChainNode)
+{
+ CodeBlock* codeBlock = &bytecode(exec, scopeChainNode);
+ m_jitCode = JIT::compile(scopeChainNode->globalData, codeBlock);
+
+#if !ENABLE(OPCODE_SAMPLING)
+ if (!BytecodeGenerator::dumpsGeneratedCode())
+ codeBlock->discardBytecode();
+#endif
+}
+
+#endif
+
+void FunctionExecutable::markAggregate(MarkStack& markStack)
+{
+ if (m_codeBlock)
+ m_codeBlock->markAggregate(markStack);
+}
+
+ExceptionInfo* FunctionExecutable::reparseExceptionInfo(JSGlobalData* globalData, ScopeChainNode* scopeChainNode, CodeBlock* codeBlock)
+{
+ RefPtr<FunctionBodyNode> newFunctionBody = globalData->parser->parse<FunctionBodyNode>(globalData, 0, 0, m_source);
+ if (m_forceUsesArguments)
+ newFunctionBody->setUsesArguments();
+ newFunctionBody->finishParsing(m_parameters, m_name);
+
+ ScopeChain scopeChain(scopeChainNode);
+ JSGlobalObject* globalObject = scopeChain.globalObject();
+
+ OwnPtr<CodeBlock> newCodeBlock(new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset()));
+ globalData->functionCodeBlockBeingReparsed = newCodeBlock.get();
+
+ OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(newFunctionBody.get(), globalObject->debugger(), scopeChain, newCodeBlock->symbolTable(), newCodeBlock.get()));
+ generator->setRegeneratingForExceptionInfo(static_cast<FunctionCodeBlock*>(codeBlock));
+ generator->generate();
+
+ ASSERT(newCodeBlock->instructionCount() == codeBlock->instructionCount());
+
+#if ENABLE(JIT)
+ JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get());
+ ASSERT(newJITCode.size() == generatedJITCode().size());
+#endif
+
+ globalData->functionCodeBlockBeingReparsed = 0;
+
+ return newCodeBlock->extractExceptionInfo();
+}
+
+ExceptionInfo* EvalExecutable::reparseExceptionInfo(JSGlobalData* globalData, ScopeChainNode* scopeChainNode, CodeBlock* codeBlock)
+{
+ RefPtr<EvalNode> newEvalBody = globalData->parser->parse<EvalNode>(globalData, 0, 0, m_source);
+
+ ScopeChain scopeChain(scopeChainNode);
+ JSGlobalObject* globalObject = scopeChain.globalObject();
+
+ OwnPtr<EvalCodeBlock> newCodeBlock(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth()));
+
+ OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(newEvalBody.get(), globalObject->debugger(), scopeChain, newCodeBlock->symbolTable(), newCodeBlock.get()));
+ generator->setRegeneratingForExceptionInfo(static_cast<EvalCodeBlock*>(codeBlock));
+ generator->generate();
+
+ ASSERT(newCodeBlock->instructionCount() == codeBlock->instructionCount());
+
+#if ENABLE(JIT)
+ JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get());
+ ASSERT(newJITCode.size() == generatedJITCode().size());
+#endif
+
+ return newCodeBlock->extractExceptionInfo();
+}
+
+void FunctionExecutable::recompile(ExecState*)
+{
+ delete m_codeBlock;
+ m_codeBlock = 0;
+ m_numParameters = NUM_PARAMETERS_NOT_COMPILED;
+#if ENABLE(JIT)
+ m_jitCode = JITCode();
+#endif
+}
+
+PassRefPtr<FunctionExecutable> FunctionExecutable::fromGlobalCode(const Identifier& functionName, ExecState* exec, Debugger* debugger, const SourceCode& source, int* errLine, UString* errMsg)
+{
+ RefPtr<ProgramNode> program = exec->globalData().parser->parse<ProgramNode>(&exec->globalData(), debugger, exec, source, errLine, errMsg);
+ if (!program)
+ return 0;
+
+ StatementNode* exprStatement = program->singleStatement();
+ ASSERT(exprStatement);
+ ASSERT(exprStatement->isExprStatement());
+ if (!exprStatement || !exprStatement->isExprStatement())
+ return 0;
+
+ ExpressionNode* funcExpr = static_cast<ExprStatementNode*>(exprStatement)->expr();
+ ASSERT(funcExpr);
+ ASSERT(funcExpr->isFuncExprNode());
+ if (!funcExpr || !funcExpr->isFuncExprNode())
+ return 0;
+
+ FunctionBodyNode* body = static_cast<FuncExprNode*>(funcExpr)->body();
+ ASSERT(body);
+ return FunctionExecutable::create(&exec->globalData(), functionName, body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine());
+}
+
+UString FunctionExecutable::paramString() const
+{
+ FunctionParameters& parameters = *m_parameters;
+ UString s("");
+ for (size_t pos = 0; pos < parameters.size(); ++pos) {
+ if (!s.isEmpty())
+ s += ", ";
+ s += parameters[pos].ustring();
+ }
+
+ return s;
+}
+
+};
+
+
diff --git a/JavaScriptCore/runtime/Executable.h b/JavaScriptCore/runtime/Executable.h
new file mode 100644
index 0000000..f74abe9
--- /dev/null
+++ b/JavaScriptCore/runtime/Executable.h
@@ -0,0 +1,356 @@
+/*
+ * Copyright (C) 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 Executable_h
+#define Executable_h
+
+#include "JSFunction.h"
+#include "Interpreter.h"
+#include "Nodes.h"
+#include "SamplingTool.h"
+
+namespace JSC {
+
+ class CodeBlock;
+ class Debugger;
+ class EvalCodeBlock;
+ class ProgramCodeBlock;
+ class ScopeChainNode;
+
+ struct ExceptionInfo;
+
+ class ExecutableBase : public RefCounted<ExecutableBase> {
+ friend class JIT;
+
+ protected:
+ static const int NUM_PARAMETERS_IS_HOST = 0;
+ static const int NUM_PARAMETERS_NOT_COMPILED = -1;
+
+ public:
+ ExecutableBase(int numParameters)
+ : m_numParameters(numParameters)
+ {
+ }
+
+ virtual ~ExecutableBase() {}
+
+ bool isHostFunction() const { return m_numParameters == NUM_PARAMETERS_IS_HOST; }
+
+ protected:
+ int m_numParameters;
+
+#if ENABLE(JIT)
+ public:
+ JITCode& generatedJITCode()
+ {
+ ASSERT(m_jitCode);
+ return m_jitCode;
+ }
+
+ ExecutablePool* getExecutablePool()
+ {
+ return m_jitCode.getExecutablePool();
+ }
+
+ protected:
+ JITCode m_jitCode;
+#endif
+ };
+
+#if ENABLE(JIT)
+ class NativeExecutable : public ExecutableBase {
+ public:
+ NativeExecutable(ExecState* exec)
+ : ExecutableBase(NUM_PARAMETERS_IS_HOST)
+ {
+ m_jitCode = JITCode(JITCode::HostFunction(exec->globalData().jitStubs.ctiNativeCallThunk()));
+ }
+
+ ~NativeExecutable();
+ };
+#endif
+
+ class VPtrHackExecutable : public ExecutableBase {
+ public:
+ VPtrHackExecutable()
+ : ExecutableBase(NUM_PARAMETERS_IS_HOST)
+ {
+ }
+
+ ~VPtrHackExecutable();
+ };
+
+ class ScriptExecutable : public ExecutableBase {
+ public:
+ ScriptExecutable(JSGlobalData* globalData, const SourceCode& source)
+ : ExecutableBase(NUM_PARAMETERS_NOT_COMPILED)
+ , m_source(source)
+ , m_features(0)
+ {
+#if ENABLE(CODEBLOCK_SAMPLING)
+ if (SamplingTool* sampler = globalData->interpreter->sampler())
+ sampler->notifyOfScope(this);
+#else
+ UNUSED_PARAM(globalData);
+#endif
+ }
+
+ ScriptExecutable(ExecState* exec, const SourceCode& source)
+ : ExecutableBase(NUM_PARAMETERS_NOT_COMPILED)
+ , m_source(source)
+ , m_features(0)
+ {
+#if ENABLE(CODEBLOCK_SAMPLING)
+ if (SamplingTool* sampler = exec->globalData().interpreter->sampler())
+ sampler->notifyOfScope(this);
+#else
+ UNUSED_PARAM(exec);
+#endif
+ }
+
+ const SourceCode& source() { return m_source; }
+ intptr_t sourceID() const { return m_source.provider()->asID(); }
+ const UString& sourceURL() const { return m_source.provider()->url(); }
+ int lineNo() const { return m_firstLine; }
+ int lastLine() const { return m_lastLine; }
+
+ bool usesEval() const { return m_features & EvalFeature; }
+ bool usesArguments() const { return m_features & ArgumentsFeature; }
+ bool needsActivation() const { return m_features & (EvalFeature | ClosureFeature | WithFeature | CatchFeature); }
+
+ virtual ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*) = 0;
+
+ protected:
+ void recordParse(CodeFeatures features, int firstLine, int lastLine)
+ {
+ m_features = features;
+ m_firstLine = firstLine;
+ m_lastLine = lastLine;
+ }
+
+ SourceCode m_source;
+ CodeFeatures m_features;
+ int m_firstLine;
+ int m_lastLine;
+ };
+
+ class EvalExecutable : public ScriptExecutable {
+ public:
+
+ ~EvalExecutable();
+
+ EvalCodeBlock& bytecode(ExecState* exec, ScopeChainNode* scopeChainNode)
+ {
+ if (!m_evalCodeBlock) {
+ JSObject* error = compile(exec, scopeChainNode);
+ ASSERT_UNUSED(!error, error);
+ }
+ return *m_evalCodeBlock;
+ }
+
+ JSObject* compile(ExecState*, ScopeChainNode*);
+
+ ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*);
+ static PassRefPtr<EvalExecutable> create(ExecState* exec, const SourceCode& source) { return adoptRef(new EvalExecutable(exec, source)); }
+
+ private:
+ EvalExecutable(ExecState* exec, const SourceCode& source)
+ : ScriptExecutable(exec, source)
+ , m_evalCodeBlock(0)
+ {
+ }
+ EvalCodeBlock* m_evalCodeBlock;
+
+#if ENABLE(JIT)
+ public:
+ JITCode& jitCode(ExecState* exec, ScopeChainNode* scopeChainNode)
+ {
+ if (!m_jitCode)
+ generateJITCode(exec, scopeChainNode);
+ return m_jitCode;
+ }
+
+ private:
+ void generateJITCode(ExecState*, ScopeChainNode*);
+#endif
+ };
+
+ class ProgramExecutable : public ScriptExecutable {
+ public:
+ static PassRefPtr<ProgramExecutable> create(ExecState* exec, const SourceCode& source)
+ {
+ return adoptRef(new ProgramExecutable(exec, source));
+ }
+
+ ~ProgramExecutable();
+
+ ProgramCodeBlock& bytecode(ExecState* exec, ScopeChainNode* scopeChainNode)
+ {
+ if (!m_programCodeBlock) {
+ JSObject* error = compile(exec, scopeChainNode);
+ ASSERT_UNUSED(!error, error);
+ }
+ return *m_programCodeBlock;
+ }
+
+ JSObject* checkSyntax(ExecState*);
+ JSObject* compile(ExecState*, ScopeChainNode*);
+
+ // CodeBlocks for program code are transient and therefore do not gain from from throwing out there exception information.
+ ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*) { ASSERT_NOT_REACHED(); return 0; }
+
+ private:
+ ProgramExecutable(ExecState* exec, const SourceCode& source)
+ : ScriptExecutable(exec, source)
+ , m_programCodeBlock(0)
+ {
+ }
+ ProgramCodeBlock* m_programCodeBlock;
+
+#if ENABLE(JIT)
+ public:
+ JITCode& jitCode(ExecState* exec, ScopeChainNode* scopeChainNode)
+ {
+ if (!m_jitCode)
+ generateJITCode(exec, scopeChainNode);
+ return m_jitCode;
+ }
+
+ private:
+ void generateJITCode(ExecState*, ScopeChainNode*);
+#endif
+ };
+
+ class FunctionExecutable : public ScriptExecutable {
+ friend class JIT;
+ public:
+ static PassRefPtr<FunctionExecutable> create(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
+ {
+ return adoptRef(new FunctionExecutable(exec, name, source, forceUsesArguments, parameters, firstLine, lastLine));
+ }
+
+ static PassRefPtr<FunctionExecutable> create(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
+ {
+ return adoptRef(new FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, firstLine, lastLine));
+ }
+
+ ~FunctionExecutable();
+
+ JSFunction* make(ExecState* exec, ScopeChainNode* scopeChain)
+ {
+ return new (exec) JSFunction(exec, this, scopeChain);
+ }
+
+ CodeBlock& bytecode(ExecState* exec, ScopeChainNode* scopeChainNode)
+ {
+ ASSERT(scopeChainNode);
+ if (!m_codeBlock)
+ compile(exec, scopeChainNode);
+ return *m_codeBlock;
+ }
+
+ bool isGenerated() const
+ {
+ return m_codeBlock;
+ }
+
+ CodeBlock& generatedBytecode()
+ {
+ ASSERT(m_codeBlock);
+ return *m_codeBlock;
+ }
+
+ const Identifier& name() { return m_name; }
+ size_t parameterCount() const { return m_parameters->size(); }
+ size_t variableCount() const { return m_numVariables; }
+ UString paramString() const;
+
+ void recompile(ExecState*);
+ ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*);
+ void markAggregate(MarkStack& markStack);
+ static PassRefPtr<FunctionExecutable> fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, int* errLine = 0, UString* errMsg = 0);
+
+ private:
+ FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
+ : ScriptExecutable(globalData, source)
+ , m_forceUsesArguments(forceUsesArguments)
+ , m_parameters(parameters)
+ , m_codeBlock(0)
+ , m_name(name)
+ , m_numVariables(0)
+ {
+ m_firstLine = firstLine;
+ m_lastLine = lastLine;
+ }
+
+ FunctionExecutable(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
+ : ScriptExecutable(exec, source)
+ , m_forceUsesArguments(forceUsesArguments)
+ , m_parameters(parameters)
+ , m_codeBlock(0)
+ , m_name(name)
+ , m_numVariables(0)
+ {
+ m_firstLine = firstLine;
+ m_lastLine = lastLine;
+ }
+
+ void compile(ExecState*, ScopeChainNode*);
+
+ bool m_forceUsesArguments;
+ RefPtr<FunctionParameters> m_parameters;
+ CodeBlock* m_codeBlock;
+ Identifier m_name;
+ size_t m_numVariables;
+
+#if ENABLE(JIT)
+ public:
+ JITCode& jitCode(ExecState* exec, ScopeChainNode* scopeChainNode)
+ {
+ if (!m_jitCode)
+ generateJITCode(exec, scopeChainNode);
+ return m_jitCode;
+ }
+
+ private:
+ void generateJITCode(ExecState*, ScopeChainNode*);
+#endif
+ };
+
+ inline FunctionExecutable* JSFunction::jsExecutable() const
+ {
+ ASSERT(!isHostFunctionNonInline());
+ return static_cast<FunctionExecutable*>(m_executable.get());
+ }
+
+ inline bool JSFunction::isHostFunction() const
+ {
+ ASSERT(m_executable);
+ return m_executable->isHostFunction();
+ }
+
+}
+
+#endif
diff --git a/JavaScriptCore/runtime/FunctionConstructor.cpp b/JavaScriptCore/runtime/FunctionConstructor.cpp
index f4f5cc8..9d88400 100644
--- a/JavaScriptCore/runtime/FunctionConstructor.cpp
+++ b/JavaScriptCore/runtime/FunctionConstructor.cpp
@@ -34,7 +34,7 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(FunctionConstructor);
-FunctionConstructor::FunctionConstructor(ExecState* exec, PassRefPtr<Structure> structure, FunctionPrototype* functionPrototype)
+FunctionConstructor::FunctionConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, FunctionPrototype* functionPrototype)
: InternalFunction(&exec->globalData(), structure, Identifier(exec, functionPrototype->classInfo()->className))
{
putDirectWithoutTransition(exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
@@ -66,32 +66,6 @@ CallType FunctionConstructor::getCallData(CallData& callData)
return CallTypeHost;
}
-FunctionBodyNode* extractFunctionBody(ProgramNode* program)
-{
- if (!program)
- return 0;
-
- StatementVector& children = program->children();
- if (children.size() != 1)
- return 0;
-
- StatementNode* exprStatement = children[0];
- ASSERT(exprStatement);
- ASSERT(exprStatement->isExprStatement());
- if (!exprStatement || !exprStatement->isExprStatement())
- return 0;
-
- ExpressionNode* funcExpr = static_cast<ExprStatementNode*>(exprStatement)->expr();
- ASSERT(funcExpr);
- ASSERT(funcExpr->isFuncExprNode());
- if (!funcExpr || !funcExpr->isFuncExprNode())
- return 0;
-
- FunctionBodyNode* body = static_cast<FuncExprNode*>(funcExpr)->body();
- ASSERT(body);
- return body;
-}
-
// ECMA 15.3.2 The Function Constructor
JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifier& functionName, const UString& sourceURL, int lineNumber)
{
@@ -113,15 +87,13 @@ JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifi
int errLine;
UString errMsg;
SourceCode source = makeSource(program, sourceURL, lineNumber);
- RefPtr<ProgramNode> programNode = exec->globalData().parser->parse<ProgramNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);
-
- FunctionBodyNode* body = extractFunctionBody(programNode.get());
- if (!body)
+ RefPtr<FunctionExecutable> function = FunctionExecutable::fromGlobalCode(functionName, exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);
+ if (!function)
return throwError(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url());
JSGlobalObject* globalObject = exec->lexicalGlobalObject();
- ScopeChain scopeChain(globalObject, globalObject->globalData(), exec->globalThisValue());
- return new (exec) JSFunction(exec, functionName, body, scopeChain.node());
+ ScopeChain scopeChain(globalObject, globalObject->globalData(), globalObject, exec->globalThisValue());
+ return new (exec) JSFunction(exec, function, scopeChain.node());
}
// ECMA 15.3.2 The Function Constructor
diff --git a/JavaScriptCore/runtime/FunctionConstructor.h b/JavaScriptCore/runtime/FunctionConstructor.h
index 124b354..197f320 100644
--- a/JavaScriptCore/runtime/FunctionConstructor.h
+++ b/JavaScriptCore/runtime/FunctionConstructor.h
@@ -26,12 +26,10 @@
namespace JSC {
class FunctionPrototype;
- class ProgramNode;
- class FunctionBodyNode;
class FunctionConstructor : public InternalFunction {
public:
- FunctionConstructor(ExecState*, PassRefPtr<Structure>, FunctionPrototype*);
+ FunctionConstructor(ExecState*, NonNullPassRefPtr<Structure>, FunctionPrototype*);
private:
virtual ConstructType getConstructData(ConstructData&);
@@ -41,8 +39,6 @@ namespace JSC {
JSObject* constructFunction(ExecState*, const ArgList&, const Identifier& functionName, const UString& sourceURL, int lineNumber);
JSObject* constructFunction(ExecState*, const ArgList&);
- FunctionBodyNode* extractFunctionBody(ProgramNode*);
-
} // namespace JSC
#endif // FunctionConstructor_h
diff --git a/JavaScriptCore/runtime/FunctionPrototype.cpp b/JavaScriptCore/runtime/FunctionPrototype.cpp
index 9ba2144..45f17b1 100644
--- a/JavaScriptCore/runtime/FunctionPrototype.cpp
+++ b/JavaScriptCore/runtime/FunctionPrototype.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -37,7 +37,7 @@ static JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState*, JSObject*, JS
static JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*, JSObject*, JSValue, const ArgList&);
-FunctionPrototype::FunctionPrototype(ExecState* exec, PassRefPtr<Structure> structure)
+FunctionPrototype::FunctionPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure)
: InternalFunction(&exec->globalData(), structure, exec->propertyNames().nullIdentifier)
{
putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);
@@ -84,16 +84,17 @@ static inline void insertSemicolonIfNeeded(UString& functionBody)
JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (thisValue.isObject(&JSFunction::info)) {
+ if (thisValue.inherits(&JSFunction::info)) {
JSFunction* function = asFunction(thisValue);
if (!function->isHostFunction()) {
- UString functionBody = function->body()->toSourceString();
- insertSemicolonIfNeeded(functionBody);
- return jsString(exec, "function " + function->name(&exec->globalData()) + "(" + function->body()->paramString() + ") " + functionBody);
+ FunctionExecutable* executable = function->jsExecutable();
+ UString sourceString = executable->source().toString();
+ insertSemicolonIfNeeded(sourceString);
+ return jsString(exec, "function " + function->name(&exec->globalData()) + "(" + executable->paramString() + ") " + sourceString);
}
}
- if (thisValue.isObject(&InternalFunction::info)) {
+ if (thisValue.inherits(&InternalFunction::info)) {
InternalFunction* function = asInternalFunction(thisValue);
return jsString(exec, "function " + function->name(&exec->globalData()) + "() {\n [native code]\n}");
}
diff --git a/JavaScriptCore/runtime/FunctionPrototype.h b/JavaScriptCore/runtime/FunctionPrototype.h
index 607ddab..0e38549 100644
--- a/JavaScriptCore/runtime/FunctionPrototype.h
+++ b/JavaScriptCore/runtime/FunctionPrototype.h
@@ -29,12 +29,12 @@ namespace JSC {
class FunctionPrototype : public InternalFunction {
public:
- FunctionPrototype(ExecState*, PassRefPtr<Structure>);
+ FunctionPrototype(ExecState*, NonNullPassRefPtr<Structure>);
void addFunctionProperties(ExecState*, Structure* prototypeFunctionStructure, NativeFunctionWrapper** callFunction, NativeFunctionWrapper** applyFunction);
static PassRefPtr<Structure> createStructure(JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot));
+ return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark | HasDefaultGetPropertyNames));
}
private:
diff --git a/JavaScriptCore/runtime/GetterSetter.cpp b/JavaScriptCore/runtime/GetterSetter.cpp
index cc85354..7e54053 100644
--- a/JavaScriptCore/runtime/GetterSetter.cpp
+++ b/JavaScriptCore/runtime/GetterSetter.cpp
@@ -32,50 +32,12 @@ void GetterSetter::markChildren(MarkStack& markStack)
{
JSCell::markChildren(markStack);
- if (m_getter && !m_getter->marked())
+ if (m_getter)
markStack.append(m_getter);
- if (m_setter && !m_setter->marked())
+ if (m_setter)
markStack.append(m_setter);
}
-JSValue GetterSetter::toPrimitive(ExecState*, PreferredPrimitiveType) const
-{
- ASSERT_NOT_REACHED();
- return jsNull();
-}
-
-bool GetterSetter::getPrimitiveNumber(ExecState*, double& number, JSValue& value)
-{
- ASSERT_NOT_REACHED();
- number = 0;
- value = JSValue();
- return true;
-}
-
-bool GetterSetter::toBoolean(ExecState*) const
-{
- ASSERT_NOT_REACHED();
- return false;
-}
-
-double GetterSetter::toNumber(ExecState*) const
-{
- ASSERT_NOT_REACHED();
- return 0.0;
-}
-
-UString GetterSetter::toString(ExecState*) const
-{
- ASSERT_NOT_REACHED();
- return UString::null();
-}
-
-JSObject* GetterSetter::toObject(ExecState* exec) const
-{
- ASSERT_NOT_REACHED();
- return jsNull().toObject(exec);
-}
-
bool GetterSetter::isGetterSetter() const
{
return true;
diff --git a/JavaScriptCore/runtime/GetterSetter.h b/JavaScriptCore/runtime/GetterSetter.h
index b7a8794..73dd854 100644
--- a/JavaScriptCore/runtime/GetterSetter.h
+++ b/JavaScriptCore/runtime/GetterSetter.h
@@ -55,13 +55,6 @@ namespace JSC {
private:
virtual bool isGetterSetter() const;
- virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
- virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value);
- virtual bool toBoolean(ExecState*) const;
- virtual double toNumber(ExecState*) const;
- virtual UString toString(ExecState*) const;
- virtual JSObject* toObject(ExecState*) const;
-
JSObject* m_getter;
JSObject* m_setter;
};
diff --git a/JavaScriptCore/runtime/GlobalEvalFunction.cpp b/JavaScriptCore/runtime/GlobalEvalFunction.cpp
index 3074f95..c26002b 100644
--- a/JavaScriptCore/runtime/GlobalEvalFunction.cpp
+++ b/JavaScriptCore/runtime/GlobalEvalFunction.cpp
@@ -32,7 +32,7 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(GlobalEvalFunction);
-GlobalEvalFunction::GlobalEvalFunction(ExecState* exec, PassRefPtr<Structure> structure, int len, const Identifier& name, NativeFunction function, JSGlobalObject* cachedGlobalObject)
+GlobalEvalFunction::GlobalEvalFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int len, const Identifier& name, NativeFunction function, JSGlobalObject* cachedGlobalObject)
: PrototypeFunction(exec, structure, len, name, function)
, m_cachedGlobalObject(cachedGlobalObject)
{
diff --git a/JavaScriptCore/runtime/GlobalEvalFunction.h b/JavaScriptCore/runtime/GlobalEvalFunction.h
index cdba4a0..b62ad3e 100644
--- a/JavaScriptCore/runtime/GlobalEvalFunction.h
+++ b/JavaScriptCore/runtime/GlobalEvalFunction.h
@@ -32,9 +32,14 @@ namespace JSC {
class GlobalEvalFunction : public PrototypeFunction {
public:
- GlobalEvalFunction(ExecState*, PassRefPtr<Structure>, int len, const Identifier&, NativeFunction, JSGlobalObject* expectedThisObject);
+ GlobalEvalFunction(ExecState*, NonNullPassRefPtr<Structure>, int len, const Identifier&, NativeFunction, JSGlobalObject* expectedThisObject);
JSGlobalObject* cachedGlobalObject() const { return m_cachedGlobalObject; }
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot));
+ }
+
private:
virtual void markChildren(MarkStack&);
diff --git a/JavaScriptCore/runtime/Identifier.h b/JavaScriptCore/runtime/Identifier.h
index 631cf42..2249179 100644
--- a/JavaScriptCore/runtime/Identifier.h
+++ b/JavaScriptCore/runtime/Identifier.h
@@ -54,6 +54,8 @@ namespace JSC {
const char* ascii() const { return _ustring.ascii(); }
static Identifier from(ExecState* exec, unsigned y) { return Identifier(exec, UString::from(y)); }
+ static Identifier from(ExecState* exec, int y) { return Identifier(exec, UString::from(y)); }
+ static Identifier from(ExecState* exec, double y) { return Identifier(exec, UString::from(y)); }
bool isNull() const { return _ustring.isNull(); }
bool isEmpty() const { return _ustring.isEmpty(); }
diff --git a/JavaScriptCore/runtime/InternalFunction.cpp b/JavaScriptCore/runtime/InternalFunction.cpp
index b5c9571..2ba2984 100644
--- a/JavaScriptCore/runtime/InternalFunction.cpp
+++ b/JavaScriptCore/runtime/InternalFunction.cpp
@@ -37,7 +37,7 @@ const ClassInfo* InternalFunction::classInfo() const
return &info;
}
-InternalFunction::InternalFunction(JSGlobalData* globalData, PassRefPtr<Structure> structure, const Identifier& name)
+InternalFunction::InternalFunction(JSGlobalData* globalData, NonNullPassRefPtr<Structure> structure, const Identifier& name)
: JSObject(structure)
{
putDirect(globalData->propertyNames->name, jsString(globalData, name.ustring()), DontDelete | ReadOnly | DontEnum);
diff --git a/JavaScriptCore/runtime/InternalFunction.h b/JavaScriptCore/runtime/InternalFunction.h
index 310644c..fdd5cc1 100644
--- a/JavaScriptCore/runtime/InternalFunction.h
+++ b/JavaScriptCore/runtime/InternalFunction.h
@@ -42,12 +42,12 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot));
+ return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot | HasDefaultMark));
}
protected:
- InternalFunction(PassRefPtr<Structure> structure) : JSObject(structure) { }
- InternalFunction(JSGlobalData*, PassRefPtr<Structure>, const Identifier&);
+ InternalFunction(NonNullPassRefPtr<Structure> structure) : JSObject(structure) { }
+ InternalFunction(JSGlobalData*, NonNullPassRefPtr<Structure>, const Identifier&);
private:
virtual CallType getCallData(CallData&) = 0;
diff --git a/JavaScriptCore/runtime/JSAPIValueWrapper.cpp b/JavaScriptCore/runtime/JSAPIValueWrapper.cpp
index 475fad5..e83724a 100644
--- a/JavaScriptCore/runtime/JSAPIValueWrapper.cpp
+++ b/JavaScriptCore/runtime/JSAPIValueWrapper.cpp
@@ -28,40 +28,4 @@
namespace JSC {
-JSValue JSAPIValueWrapper::toPrimitive(ExecState*, PreferredPrimitiveType) const
-{
- ASSERT_NOT_REACHED();
- return JSValue();
-}
-
-bool JSAPIValueWrapper::getPrimitiveNumber(ExecState*, double&, JSValue&)
-{
- ASSERT_NOT_REACHED();
- return false;
-}
-
-bool JSAPIValueWrapper::toBoolean(ExecState*) const
-{
- ASSERT_NOT_REACHED();
- return false;
-}
-
-double JSAPIValueWrapper::toNumber(ExecState*) const
-{
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-UString JSAPIValueWrapper::toString(ExecState*) const
-{
- ASSERT_NOT_REACHED();
- return UString();
-}
-
-JSObject* JSAPIValueWrapper::toObject(ExecState*) const
-{
- ASSERT_NOT_REACHED();
- return 0;
-}
-
} // namespace JSC
diff --git a/JavaScriptCore/runtime/JSAPIValueWrapper.h b/JavaScriptCore/runtime/JSAPIValueWrapper.h
index 21a9710..88a8493 100644
--- a/JavaScriptCore/runtime/JSAPIValueWrapper.h
+++ b/JavaScriptCore/runtime/JSAPIValueWrapper.h
@@ -37,12 +37,6 @@ namespace JSC {
virtual bool isAPIValueWrapper() const { return true; }
- virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
- virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&);
- virtual bool toBoolean(ExecState*) const;
- virtual double toNumber(ExecState*) const;
- virtual UString toString(ExecState*) const;
- virtual JSObject* toObject(ExecState*) const;
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(CompoundType));
@@ -54,6 +48,7 @@ namespace JSC {
: JSCell(exec->globalData().apiWrapperStructure.get())
, m_value(value)
{
+ ASSERT(!value.isCell());
}
JSValue m_value;
diff --git a/JavaScriptCore/runtime/JSActivation.cpp b/JavaScriptCore/runtime/JSActivation.cpp
index 87adbcd..22fdaaf 100644
--- a/JavaScriptCore/runtime/JSActivation.cpp
+++ b/JavaScriptCore/runtime/JSActivation.cpp
@@ -39,8 +39,8 @@ ASSERT_CLASS_FITS_IN_CELL(JSActivation);
const ClassInfo JSActivation::info = { "JSActivation", 0, 0, 0 };
-JSActivation::JSActivation(CallFrame* callFrame, PassRefPtr<FunctionBodyNode> functionBody)
- : Base(callFrame->globalData().activationStructure, new JSActivationData(functionBody, callFrame->registers()))
+JSActivation::JSActivation(CallFrame* callFrame, NonNullPassRefPtr<FunctionExecutable> functionExecutable)
+ : Base(callFrame->globalData().activationStructure, new JSActivationData(functionExecutable, callFrame->registers()))
{
}
@@ -57,12 +57,12 @@ void JSActivation::markChildren(MarkStack& markStack)
if (!registerArray)
return;
- size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1;
+ size_t numParametersMinusThis = d()->functionExecutable->parameterCount();
size_t count = numParametersMinusThis;
markStack.appendValues(registerArray, count);
- size_t numVars = d()->functionBody->generatedBytecode().m_numVars;
+ size_t numVars = d()->functionExecutable->variableCount();
// Skip the call frame, which sits between the parameters and vars.
markStack.appendValues(registerArray + count + RegisterFile::CallFrameHeaderSize, numVars, MayContainNullValues);
@@ -136,14 +136,14 @@ JSObject* JSActivation::toThisObject(ExecState* exec) const
bool JSActivation::isDynamicScope() const
{
- return d()->functionBody->usesEval();
+ return d()->functionExecutable->usesEval();
}
JSValue JSActivation::argumentsGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
JSActivation* activation = asActivation(slot.slotBase());
- if (activation->d()->functionBody->usesArguments()) {
+ if (activation->d()->functionExecutable->usesArguments()) {
PropertySlot slot;
activation->symbolTableGet(exec->propertyNames().arguments, slot);
return slot.getValue(exec, exec->propertyNames().arguments);
@@ -156,7 +156,7 @@ JSValue JSActivation::argumentsGetter(ExecState* exec, const Identifier&, const
arguments->copyRegisters();
callFrame->setCalleeArguments(arguments);
}
- ASSERT(arguments->isObject(&Arguments::info));
+ ASSERT(arguments->inherits(&Arguments::info));
return arguments;
}
diff --git a/JavaScriptCore/runtime/JSActivation.h b/JavaScriptCore/runtime/JSActivation.h
index 6a08439..583b988 100644
--- a/JavaScriptCore/runtime/JSActivation.h
+++ b/JavaScriptCore/runtime/JSActivation.h
@@ -43,7 +43,7 @@ namespace JSC {
class JSActivation : public JSVariableObject {
typedef JSVariableObject Base;
public:
- JSActivation(CallFrame*, PassRefPtr<FunctionBodyNode>);
+ JSActivation(CallFrame*, NonNullPassRefPtr<FunctionExecutable>);
virtual ~JSActivation();
virtual void markChildren(MarkStack&);
@@ -70,13 +70,20 @@ namespace JSC {
private:
struct JSActivationData : public JSVariableObjectData {
- JSActivationData(PassRefPtr<FunctionBodyNode> functionBody, Register* registers)
- : JSVariableObjectData(&functionBody->generatedBytecode().symbolTable(), registers)
- , functionBody(functionBody)
+ JSActivationData(NonNullPassRefPtr<FunctionExecutable> _functionExecutable, Register* registers)
+ : JSVariableObjectData(_functionExecutable->generatedBytecode().symbolTable(), registers)
+ , functionExecutable(_functionExecutable)
{
+ // We have to manually ref and deref the symbol table as JSVariableObjectData
+ // doesn't know about SharedSymbolTable
+ functionExecutable->generatedBytecode().sharedSymbolTable()->ref();
+ }
+ ~JSActivationData()
+ {
+ static_cast<SharedSymbolTable*>(symbolTable)->deref();
}
- RefPtr<FunctionBodyNode> functionBody;
+ RefPtr<FunctionExecutable> functionExecutable;
};
static JSValue argumentsGetter(ExecState*, const Identifier&, const PropertySlot&);
diff --git a/JavaScriptCore/runtime/JSArray.cpp b/JavaScriptCore/runtime/JSArray.cpp
index 7d7d4c4..fd9e7b2 100644
--- a/JavaScriptCore/runtime/JSArray.cpp
+++ b/JavaScriptCore/runtime/JSArray.cpp
@@ -25,6 +25,8 @@
#include "ArrayPrototype.h"
#include "CachedCall.h"
+#include "Error.h"
+#include "Executable.h"
#include "PropertyNameArray.h"
#include <wtf/AVLTree.h>
#include <wtf/Assertions.h>
@@ -128,27 +130,25 @@ inline void JSArray::checkConsistency(ConsistencyCheckType)
#endif
-JSArray::JSArray(PassRefPtr<Structure> structure)
+JSArray::JSArray(NonNullPassRefPtr<Structure> structure)
: JSObject(structure)
{
unsigned initialCapacity = 0;
m_storage = static_cast<ArrayStorage*>(fastZeroedMalloc(storageSize(initialCapacity)));
- m_storage->m_vectorLength = initialCapacity;
-
- m_fastAccessCutoff = 0;
+ m_vectorLength = initialCapacity;
checkConsistency();
}
-JSArray::JSArray(PassRefPtr<Structure> structure, unsigned initialLength)
+JSArray::JSArray(NonNullPassRefPtr<Structure> structure, unsigned initialLength)
: JSObject(structure)
{
unsigned initialCapacity = min(initialLength, MIN_SPARSE_ARRAY_INDEX);
m_storage = static_cast<ArrayStorage*>(fastMalloc(storageSize(initialCapacity)));
m_storage->m_length = initialLength;
- m_storage->m_vectorLength = initialCapacity;
+ m_vectorLength = initialCapacity;
m_storage->m_numValuesInVector = 0;
m_storage->m_sparseValueMap = 0;
m_storage->lazyCreationData = 0;
@@ -157,21 +157,19 @@ JSArray::JSArray(PassRefPtr<Structure> structure, unsigned initialLength)
for (size_t i = 0; i < initialCapacity; ++i)
vector[i] = JSValue();
- m_fastAccessCutoff = 0;
-
checkConsistency();
Heap::heap(this)->reportExtraMemoryCost(initialCapacity * sizeof(JSValue));
}
-JSArray::JSArray(PassRefPtr<Structure> structure, const ArgList& list)
+JSArray::JSArray(NonNullPassRefPtr<Structure> structure, const ArgList& list)
: JSObject(structure)
{
unsigned initialCapacity = list.size();
m_storage = static_cast<ArrayStorage*>(fastMalloc(storageSize(initialCapacity)));
m_storage->m_length = initialCapacity;
- m_storage->m_vectorLength = initialCapacity;
+ m_vectorLength = initialCapacity;
m_storage->m_numValuesInVector = initialCapacity;
m_storage->m_sparseValueMap = 0;
@@ -180,8 +178,6 @@ JSArray::JSArray(PassRefPtr<Structure> structure, const ArgList& list)
for (ArgList::const_iterator it = list.begin(); it != end; ++it, ++i)
m_storage->m_vector[i] = *it;
- m_fastAccessCutoff = initialCapacity;
-
checkConsistency();
Heap::heap(this)->reportExtraMemoryCost(storageSize(initialCapacity));
@@ -205,7 +201,7 @@ bool JSArray::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot
return false;
}
- if (i < storage->m_vectorLength) {
+ if (i < m_vectorLength) {
JSValue& valueSlot = storage->m_vector[i];
if (valueSlot) {
slot.setValueSlot(&valueSlot);
@@ -221,7 +217,7 @@ bool JSArray::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot
}
}
- return false;
+ return JSObject::getOwnPropertySlot(exec, Identifier::from(exec, i), slot);
}
bool JSArray::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
@@ -239,6 +235,37 @@ bool JSArray::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName
return JSObject::getOwnPropertySlot(exec, propertyName, slot);
}
+bool JSArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ if (propertyName == exec->propertyNames().length) {
+ descriptor.setDescriptor(jsNumber(exec, length()), DontDelete | DontEnum);
+ return true;
+ }
+
+ bool isArrayIndex;
+ unsigned i = propertyName.toArrayIndex(&isArrayIndex);
+ if (isArrayIndex) {
+ if (i >= m_storage->m_length)
+ return false;
+ if (i < m_vectorLength) {
+ JSValue& value = m_storage->m_vector[i];
+ if (value) {
+ descriptor.setDescriptor(value, 0);
+ return true;
+ }
+ } else if (SparseArrayValueMap* map = m_storage->m_sparseValueMap) {
+ if (i >= MIN_SPARSE_ARRAY_INDEX) {
+ SparseArrayValueMap::iterator it = map->find(i);
+ if (it != map->end()) {
+ descriptor.setDescriptor(it->second, 0);
+ return true;
+ }
+ }
+ }
+ }
+ return JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+}
+
// ECMA 15.4.5.1
void JSArray::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
{
@@ -272,7 +299,7 @@ void JSArray::put(ExecState* exec, unsigned i, JSValue value)
m_storage->m_length = length;
}
- if (i < m_storage->m_vectorLength) {
+ if (i < m_vectorLength) {
JSValue& valueSlot = m_storage->m_vector[i];
if (valueSlot) {
valueSlot = value;
@@ -280,8 +307,7 @@ void JSArray::put(ExecState* exec, unsigned i, JSValue value)
return;
}
valueSlot = value;
- if (++m_storage->m_numValuesInVector == m_storage->m_length)
- m_fastAccessCutoff = m_storage->m_length;
+ ++m_storage->m_numValuesInVector;
checkConsistency();
return;
}
@@ -319,8 +345,7 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu
if (increaseVectorLength(i + 1)) {
storage = m_storage;
storage->m_vector[i] = value;
- if (++storage->m_numValuesInVector == storage->m_length)
- m_fastAccessCutoff = storage->m_length;
+ ++storage->m_numValuesInVector;
checkConsistency();
} else
throwOutOfMemoryError(exec);
@@ -330,7 +355,7 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu
// Decide how many values it would be best to move from the map.
unsigned newNumValuesInVector = storage->m_numValuesInVector + 1;
unsigned newVectorLength = increasedVectorLength(i + 1);
- for (unsigned j = max(storage->m_vectorLength, MIN_SPARSE_ARRAY_INDEX); j < newVectorLength; ++j)
+ for (unsigned j = max(m_vectorLength, MIN_SPARSE_ARRAY_INDEX); j < newVectorLength; ++j)
newNumValuesInVector += map->contains(j);
if (i >= MIN_SPARSE_ARRAY_INDEX)
newNumValuesInVector -= map->contains(i);
@@ -348,13 +373,12 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu
}
}
- storage = static_cast<ArrayStorage*>(tryFastRealloc(storage, storageSize(newVectorLength)));
- if (!storage) {
+ if (!tryFastRealloc(storage, storageSize(newVectorLength)).getValue(storage)) {
throwOutOfMemoryError(exec);
return;
}
- unsigned vectorLength = storage->m_vectorLength;
+ unsigned vectorLength = m_vectorLength;
Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength));
@@ -372,7 +396,7 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu
storage->m_vector[i] = value;
- storage->m_vectorLength = newVectorLength;
+ m_vectorLength = newVectorLength;
storage->m_numValuesInVector = newNumValuesInVector;
m_storage = storage;
@@ -399,7 +423,7 @@ bool JSArray::deleteProperty(ExecState* exec, unsigned i)
ArrayStorage* storage = m_storage;
- if (i < storage->m_vectorLength) {
+ if (i < m_vectorLength) {
JSValue& valueSlot = storage->m_vector[i];
if (!valueSlot) {
checkConsistency();
@@ -407,8 +431,6 @@ bool JSArray::deleteProperty(ExecState* exec, unsigned i)
}
valueSlot = JSValue();
--storage->m_numValuesInVector;
- if (m_fastAccessCutoff > i)
- m_fastAccessCutoff = i;
checkConsistency();
return true;
}
@@ -432,7 +454,7 @@ bool JSArray::deleteProperty(ExecState* exec, unsigned i)
return false;
}
-void JSArray::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
+void JSArray::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
{
// FIXME: Filling PropertyNameArray with an identifier for every integer
// is incredibly inefficient for large arrays. We need a different approach,
@@ -440,7 +462,7 @@ void JSArray::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames
ArrayStorage* storage = m_storage;
- unsigned usedVectorLength = min(storage->m_length, storage->m_vectorLength);
+ unsigned usedVectorLength = min(storage->m_length, m_vectorLength);
for (unsigned i = 0; i < usedVectorLength; ++i) {
if (storage->m_vector[i])
propertyNames.add(Identifier::from(exec, i));
@@ -452,7 +474,7 @@ void JSArray::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames
propertyNames.add(Identifier::from(exec, it->first));
}
- JSObject::getPropertyNames(exec, propertyNames);
+ JSObject::getOwnPropertyNames(exec, propertyNames);
}
bool JSArray::increaseVectorLength(unsigned newLength)
@@ -462,17 +484,16 @@ bool JSArray::increaseVectorLength(unsigned newLength)
ArrayStorage* storage = m_storage;
- unsigned vectorLength = storage->m_vectorLength;
+ unsigned vectorLength = m_vectorLength;
ASSERT(newLength > vectorLength);
ASSERT(newLength <= MAX_STORAGE_VECTOR_INDEX);
unsigned newVectorLength = increasedVectorLength(newLength);
- storage = static_cast<ArrayStorage*>(tryFastRealloc(storage, storageSize(newVectorLength)));
- if (!storage)
+ if (!tryFastRealloc(storage, storageSize(newVectorLength)).getValue(storage))
return false;
Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength));
- storage->m_vectorLength = newVectorLength;
+ m_vectorLength = newVectorLength;
for (unsigned i = vectorLength; i < newVectorLength; ++i)
storage->m_vector[i] = JSValue();
@@ -490,10 +511,7 @@ void JSArray::setLength(unsigned newLength)
unsigned length = m_storage->m_length;
if (newLength < length) {
- if (m_fastAccessCutoff > newLength)
- m_fastAccessCutoff = newLength;
-
- unsigned usedVectorLength = min(length, storage->m_vectorLength);
+ unsigned usedVectorLength = min(length, m_vectorLength);
for (unsigned i = newLength; i < usedVectorLength; ++i) {
JSValue& valueSlot = storage->m_vector[i];
bool hadValue = valueSlot;
@@ -532,20 +550,13 @@ JSValue JSArray::pop()
JSValue result;
- if (m_fastAccessCutoff > length) {
- JSValue& valueSlot = m_storage->m_vector[length];
- result = valueSlot;
- ASSERT(result);
- valueSlot = JSValue();
- --m_storage->m_numValuesInVector;
- m_fastAccessCutoff = length;
- } else if (length < m_storage->m_vectorLength) {
+ if (length < m_vectorLength) {
JSValue& valueSlot = m_storage->m_vector[length];
- result = valueSlot;
- valueSlot = JSValue();
- if (result)
+ if (valueSlot) {
--m_storage->m_numValuesInVector;
- else
+ result = valueSlot;
+ valueSlot = JSValue();
+ } else
result = jsUndefined();
} else {
result = jsUndefined();
@@ -573,11 +584,10 @@ void JSArray::push(ExecState* exec, JSValue value)
{
checkConsistency();
- if (m_storage->m_length < m_storage->m_vectorLength) {
- ASSERT(!m_storage->m_vector[m_storage->m_length]);
+ if (m_storage->m_length < m_vectorLength) {
m_storage->m_vector[m_storage->m_length] = value;
- if (++m_storage->m_numValuesInVector == ++m_storage->m_length)
- m_fastAccessCutoff = m_storage->m_length;
+ ++m_storage->m_numValuesInVector;
+ ++m_storage->m_length;
checkConsistency();
return;
}
@@ -587,8 +597,8 @@ void JSArray::push(ExecState* exec, JSValue value)
if (!map || map->isEmpty()) {
if (increaseVectorLength(m_storage->m_length + 1)) {
m_storage->m_vector[m_storage->m_length] = value;
- if (++m_storage->m_numValuesInVector == ++m_storage->m_length)
- m_fastAccessCutoff = m_storage->m_length;
+ ++m_storage->m_numValuesInVector;
+ ++m_storage->m_length;
checkConsistency();
return;
}
@@ -603,18 +613,7 @@ void JSArray::push(ExecState* exec, JSValue value)
void JSArray::markChildren(MarkStack& markStack)
{
- JSObject::markChildren(markStack);
-
- ArrayStorage* storage = m_storage;
-
- unsigned usedVectorLength = min(storage->m_length, storage->m_vectorLength);
- markStack.appendValues(storage->m_vector, usedVectorLength, MayContainNullValues);
-
- if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
- SparseArrayValueMap::iterator end = map->end();
- for (SparseArrayValueMap::iterator it = map->begin(); it != end; ++it)
- markStack.append(it->second);
- }
+ markChildrenDirect(markStack);
}
static int compareNumbersForQSort(const void* a, const void* b)
@@ -817,7 +816,7 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType,
if (!m_storage->m_length)
return;
- unsigned usedVectorLength = min(m_storage->m_length, m_storage->m_vectorLength);
+ unsigned usedVectorLength = min(m_storage->m_length, m_vectorLength);
AVLTree<AVLTreeAbstractorForArrayCompare, 44> tree; // Depth 44 is enough for 2^31 items
tree.abstractor().m_exec = exec;
@@ -866,7 +865,7 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType,
if (SparseArrayValueMap* map = m_storage->m_sparseValueMap) {
newUsedVectorLength += map->size();
- if (newUsedVectorLength > m_storage->m_vectorLength) {
+ if (newUsedVectorLength > m_vectorLength) {
// Check that it is possible to allocate an array large enough to hold all the entries.
if ((newUsedVectorLength > MAX_STORAGE_VECTOR_LENGTH) || !increaseVectorLength(newUsedVectorLength)) {
throwOutOfMemoryError(exec);
@@ -906,7 +905,6 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType,
for (unsigned i = newUsedVectorLength; i < usedVectorLength; ++i)
m_storage->m_vector[i] = JSValue();
- m_fastAccessCutoff = newUsedVectorLength;
m_storage->m_numValuesInVector = newUsedVectorLength;
checkConsistency(SortConsistencyCheck);
@@ -914,10 +912,16 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType,
void JSArray::fillArgList(ExecState* exec, MarkedArgumentBuffer& args)
{
- unsigned fastAccessLength = min(m_storage->m_length, m_fastAccessCutoff);
+ JSValue* vector = m_storage->m_vector;
+ unsigned vectorEnd = min(m_storage->m_length, m_vectorLength);
unsigned i = 0;
- for (; i < fastAccessLength; ++i)
- args.append(getIndex(i));
+ for (; i < vectorEnd; ++i) {
+ JSValue& v = vector[i];
+ if (!v)
+ break;
+ args.append(v);
+ }
+
for (; i < m_storage->m_length; ++i)
args.append(get(exec, i));
}
@@ -926,12 +930,17 @@ void JSArray::copyToRegisters(ExecState* exec, Register* buffer, uint32_t maxSiz
{
ASSERT(m_storage->m_length == maxSize);
UNUSED_PARAM(maxSize);
- unsigned fastAccessLength = min(m_storage->m_length, m_fastAccessCutoff);
+ JSValue* vector = m_storage->m_vector;
+ unsigned vectorEnd = min(m_storage->m_length, m_vectorLength);
unsigned i = 0;
- for (; i < fastAccessLength; ++i)
- buffer[i] = getIndex(i);
- uint32_t size = m_storage->m_length;
- for (; i < size; ++i)
+ for (; i < vectorEnd; ++i) {
+ JSValue& v = vector[i];
+ if (!v)
+ break;
+ buffer[i] = v;
+ }
+
+ for (; i < m_storage->m_length; ++i)
buffer[i] = get(exec, i);
}
@@ -941,7 +950,7 @@ unsigned JSArray::compactForSorting()
ArrayStorage* storage = m_storage;
- unsigned usedVectorLength = min(m_storage->m_length, storage->m_vectorLength);
+ unsigned usedVectorLength = min(m_storage->m_length, m_vectorLength);
unsigned numDefined = 0;
unsigned numUndefined = 0;
@@ -965,7 +974,7 @@ unsigned JSArray::compactForSorting()
if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
newUsedVectorLength += map->size();
- if (newUsedVectorLength > storage->m_vectorLength) {
+ if (newUsedVectorLength > m_vectorLength) {
// Check that it is possible to allocate an array large enough to hold all the entries - if not,
// exception is thrown by caller.
if ((newUsedVectorLength > MAX_STORAGE_VECTOR_LENGTH) || !increaseVectorLength(newUsedVectorLength))
@@ -986,7 +995,6 @@ unsigned JSArray::compactForSorting()
for (unsigned i = newUsedVectorLength; i < usedVectorLength; ++i)
storage->m_vector[i] = JSValue();
- m_fastAccessCutoff = newUsedVectorLength;
storage->m_numValuesInVector = newUsedVectorLength;
checkConsistency(SortConsistencyCheck);
@@ -1012,30 +1020,27 @@ void JSArray::checkConsistency(ConsistencyCheckType type)
if (type == SortConsistencyCheck)
ASSERT(!m_storage->m_sparseValueMap);
- ASSERT(m_fastAccessCutoff <= m_storage->m_length);
- ASSERT(m_fastAccessCutoff <= m_storage->m_numValuesInVector);
-
unsigned numValuesInVector = 0;
- for (unsigned i = 0; i < m_storage->m_vectorLength; ++i) {
+ for (unsigned i = 0; i < m_vectorLength; ++i) {
if (JSValue value = m_storage->m_vector[i]) {
ASSERT(i < m_storage->m_length);
if (type != DestructorConsistencyCheck)
value->type(); // Likely to crash if the object was deallocated.
++numValuesInVector;
} else {
- ASSERT(i >= m_fastAccessCutoff);
if (type == SortConsistencyCheck)
ASSERT(i >= m_storage->m_numValuesInVector);
}
}
ASSERT(numValuesInVector == m_storage->m_numValuesInVector);
+ ASSERT(numValuesInVector <= m_storage->m_length);
if (m_storage->m_sparseValueMap) {
SparseArrayValueMap::iterator end = m_storage->m_sparseValueMap->end();
for (SparseArrayValueMap::iterator it = m_storage->m_sparseValueMap->begin(); it != end; ++it) {
unsigned index = it->first;
ASSERT(index < m_storage->m_length);
- ASSERT(index >= m_storage->m_vectorLength);
+ ASSERT(index >= m_vectorLength);
ASSERT(index <= MAX_ARRAY_INDEX);
ASSERT(it->second);
if (type != DestructorConsistencyCheck)
@@ -1046,26 +1051,4 @@ void JSArray::checkConsistency(ConsistencyCheckType type)
#endif
-JSArray* constructEmptyArray(ExecState* exec)
-{
- return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure());
-}
-
-JSArray* constructEmptyArray(ExecState* exec, unsigned initialLength)
-{
- return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), initialLength);
-}
-
-JSArray* constructArray(ExecState* exec, JSValue singleItemValue)
-{
- MarkedArgumentBuffer values;
- values.append(singleItemValue);
- return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), values);
-}
-
-JSArray* constructArray(ExecState* exec, const ArgList& values)
-{
- return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), values);
-}
-
} // namespace JSC
diff --git a/JavaScriptCore/runtime/JSArray.h b/JavaScriptCore/runtime/JSArray.h
index 49df6c4..66b5a1d 100644
--- a/JavaScriptCore/runtime/JSArray.h
+++ b/JavaScriptCore/runtime/JSArray.h
@@ -29,7 +29,6 @@ namespace JSC {
struct ArrayStorage {
unsigned m_length;
- unsigned m_vectorLength;
unsigned m_numValuesInVector;
SparseArrayValueMap* m_sparseValueMap;
void* lazyCreationData; // A JSArray subclass can use this to fill the vector lazily.
@@ -38,15 +37,17 @@ namespace JSC {
class JSArray : public JSObject {
friend class JIT;
+ friend class Walker;
public:
- explicit JSArray(PassRefPtr<Structure>);
- JSArray(PassRefPtr<Structure>, unsigned initialLength);
- JSArray(PassRefPtr<Structure>, const ArgList& initialValues);
+ explicit JSArray(NonNullPassRefPtr<Structure>);
+ JSArray(NonNullPassRefPtr<Structure>, unsigned initialLength);
+ JSArray(NonNullPassRefPtr<Structure>, const ArgList& initialValues);
virtual ~JSArray();
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void put(ExecState*, unsigned propertyName, JSValue); // FIXME: Make protected and add setItem.
static JS_EXPORTDATA const ClassInfo info;
@@ -61,18 +62,24 @@ namespace JSC {
void push(ExecState*, JSValue);
JSValue pop();
- bool canGetIndex(unsigned i) { return i < m_fastAccessCutoff; }
+ bool canGetIndex(unsigned i) { return i < m_vectorLength && m_storage->m_vector[i]; }
JSValue getIndex(unsigned i)
{
ASSERT(canGetIndex(i));
return m_storage->m_vector[i];
}
- bool canSetIndex(unsigned i) { return i < m_fastAccessCutoff; }
- JSValue setIndex(unsigned i, JSValue v)
+ bool canSetIndex(unsigned i) { return i < m_vectorLength; }
+ void setIndex(unsigned i, JSValue v)
{
ASSERT(canSetIndex(i));
- return m_storage->m_vector[i] = v;
+ JSValue& x = m_storage->m_vector[i];
+ if (!x) {
+ ++m_storage->m_numValuesInVector;
+ if (i >= m_storage->m_length)
+ m_storage->m_length = i + 1;
+ }
+ x = v;
}
void fillArgList(ExecState*, MarkedArgumentBuffer&);
@@ -82,12 +89,14 @@ namespace JSC {
{
return Structure::create(prototype, TypeInfo(ObjectType));
}
+
+ inline void markChildrenDirect(MarkStack& markStack);
protected:
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
virtual bool deleteProperty(ExecState*, unsigned propertyName);
- virtual void getPropertyNames(ExecState*, PropertyNameArray&);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&);
virtual void markChildren(MarkStack&);
void* lazyCreationData();
@@ -106,25 +115,110 @@ namespace JSC {
enum ConsistencyCheckType { NormalConsistencyCheck, DestructorConsistencyCheck, SortConsistencyCheck };
void checkConsistency(ConsistencyCheckType = NormalConsistencyCheck);
- unsigned m_fastAccessCutoff;
+ unsigned m_vectorLength;
ArrayStorage* m_storage;
};
JSArray* asArray(JSValue);
- JSArray* constructEmptyArray(ExecState*);
- JSArray* constructEmptyArray(ExecState*, unsigned initialLength);
- JSArray* constructArray(ExecState*, JSValue singleItemValue);
- JSArray* constructArray(ExecState*, const ArgList& values);
+ inline JSArray* asArray(JSCell* cell)
+ {
+ ASSERT(cell->inherits(&JSArray::info));
+ return static_cast<JSArray*>(cell);
+ }
inline JSArray* asArray(JSValue value)
{
- ASSERT(asObject(value)->inherits(&JSArray::info));
- return static_cast<JSArray*>(asObject(value));
+ return asArray(value.asCell());
+ }
+
+ inline bool isJSArray(JSGlobalData* globalData, JSValue v)
+ {
+ return v.isCell() && v.asCell()->vptr() == globalData->jsArrayVPtr;
+ }
+ inline bool isJSArray(JSGlobalData* globalData, JSCell* cell) { return cell->vptr() == globalData->jsArrayVPtr; }
+
+ inline void JSArray::markChildrenDirect(MarkStack& markStack)
+ {
+ JSObject::markChildrenDirect(markStack);
+
+ ArrayStorage* storage = m_storage;
+
+ unsigned usedVectorLength = std::min(storage->m_length, m_vectorLength);
+ markStack.appendValues(storage->m_vector, usedVectorLength, MayContainNullValues);
+
+ if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
+ SparseArrayValueMap::iterator end = map->end();
+ for (SparseArrayValueMap::iterator it = map->begin(); it != end; ++it)
+ markStack.append(it->second);
+ }
}
- inline bool isJSArray(JSGlobalData* globalData, JSValue v) { return v.isCell() && v.asCell()->vptr() == globalData->jsArrayVPtr; }
+ inline void MarkStack::markChildren(JSCell* cell)
+ {
+ ASSERT(Heap::isCellMarked(cell));
+ if (cell->structure()->typeInfo().hasDefaultMark()) {
+#ifdef NDEBUG
+ asObject(cell)->markChildrenDirect(*this);
+#else
+ ASSERT(!m_isCheckingForDefaultMarkViolation);
+ m_isCheckingForDefaultMarkViolation = true;
+ cell->markChildren(*this);
+ ASSERT(m_isCheckingForDefaultMarkViolation);
+ m_isCheckingForDefaultMarkViolation = false;
+#endif
+ return;
+ }
+ if (cell->vptr() == m_jsArrayVPtr) {
+ asArray(cell)->markChildrenDirect(*this);
+ return;
+ }
+ cell->markChildren(*this);
+ }
+ inline void MarkStack::drain()
+ {
+ while (!m_markSets.isEmpty() || !m_values.isEmpty()) {
+ while (!m_markSets.isEmpty() && m_values.size() < 50) {
+ ASSERT(!m_markSets.isEmpty());
+ MarkSet& current = m_markSets.last();
+ ASSERT(current.m_values);
+ JSValue* end = current.m_end;
+ ASSERT(current.m_values);
+ ASSERT(current.m_values != end);
+ findNextUnmarkedNullValue:
+ ASSERT(current.m_values != end);
+ JSValue value = *current.m_values;
+ current.m_values++;
+
+ JSCell* cell;
+ if (!value || !value.isCell() || Heap::isCellMarked(cell = value.asCell())) {
+ if (current.m_values == end) {
+ m_markSets.removeLast();
+ continue;
+ }
+ goto findNextUnmarkedNullValue;
+ }
+
+ Heap::markCell(cell);
+ if (cell->structure()->typeInfo().type() < CompoundType) {
+ if (current.m_values == end) {
+ m_markSets.removeLast();
+ continue;
+ }
+ goto findNextUnmarkedNullValue;
+ }
+
+ if (current.m_values == end)
+ m_markSets.removeLast();
+
+ markChildren(cell);
+ }
+ while (!m_values.isEmpty())
+ markChildren(m_values.removeLast());
+ }
+ }
+
} // namespace JSC
#endif // JSArray_h
diff --git a/JavaScriptCore/runtime/JSByteArray.cpp b/JavaScriptCore/runtime/JSByteArray.cpp
index 2a5e72f..90d39f0 100644
--- a/JavaScriptCore/runtime/JSByteArray.cpp
+++ b/JavaScriptCore/runtime/JSByteArray.cpp
@@ -35,7 +35,7 @@ namespace JSC {
const ClassInfo JSByteArray::s_defaultInfo = { "ByteArray", 0, 0, 0 };
-JSByteArray::JSByteArray(ExecState* exec, PassRefPtr<Structure> structure, ByteArray* storage, const JSC::ClassInfo* classInfo)
+JSByteArray::JSByteArray(ExecState* exec, NonNullPassRefPtr<Structure> structure, ByteArray* storage, const JSC::ClassInfo* classInfo)
: JSObject(structure)
, m_storage(storage)
, m_classInfo(classInfo)
@@ -45,7 +45,7 @@ JSByteArray::JSByteArray(ExecState* exec, PassRefPtr<Structure> structure, ByteA
PassRefPtr<Structure> JSByteArray::createStructure(JSValue prototype)
{
- PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType));
+ PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType, HasDefaultMark));
return result;
}
@@ -59,7 +59,18 @@ bool JSByteArray::getOwnPropertySlot(ExecState* exec, const Identifier& property
}
return JSObject::getOwnPropertySlot(exec, propertyName, slot);
}
-
+
+bool JSByteArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ bool ok;
+ unsigned index = propertyName.toUInt32(&ok, false);
+ if (ok && canAccessIndex(index)) {
+ descriptor.setDescriptor(getIndex(exec, index), DontDelete);
+ return true;
+ }
+ return JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+}
+
bool JSByteArray::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
{
if (canAccessIndex(propertyName)) {
@@ -85,12 +96,12 @@ void JSByteArray::put(ExecState* exec, unsigned propertyName, JSValue value)
setIndex(exec, propertyName, value);
}
-void JSByteArray::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
+void JSByteArray::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
{
unsigned length = m_storage->length();
for (unsigned i = 0; i < length; ++i)
propertyNames.add(Identifier::from(exec, i));
- JSObject::getPropertyNames(exec, propertyNames);
+ JSObject::getOwnPropertyNames(exec, propertyNames);
}
}
diff --git a/JavaScriptCore/runtime/JSByteArray.h b/JavaScriptCore/runtime/JSByteArray.h
index a56aca6..006f4a2 100644
--- a/JavaScriptCore/runtime/JSByteArray.h
+++ b/JavaScriptCore/runtime/JSByteArray.h
@@ -73,15 +73,16 @@ namespace JSC {
setIndex(i, byteValue);
}
- JSByteArray(ExecState* exec, PassRefPtr<Structure>, WTF::ByteArray* storage, const JSC::ClassInfo* = &s_defaultInfo);
+ JSByteArray(ExecState* exec, NonNullPassRefPtr<Structure>, WTF::ByteArray* storage, const JSC::ClassInfo* = &s_defaultInfo);
static PassRefPtr<Structure> createStructure(JSValue prototype);
virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
virtual bool getOwnPropertySlot(JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);
virtual void put(JSC::ExecState*, unsigned propertyName, JSC::JSValue);
- virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);
+ virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);
virtual const ClassInfo* classInfo() const { return m_classInfo; }
static const ClassInfo s_defaultInfo;
diff --git a/JavaScriptCore/runtime/JSCell.cpp b/JavaScriptCore/runtime/JSCell.cpp
index c733ed9..aa93252 100644
--- a/JavaScriptCore/runtime/JSCell.cpp
+++ b/JavaScriptCore/runtime/JSCell.cpp
@@ -105,7 +105,7 @@ UString JSCell::getString() const
JSObject* JSCell::getObject()
{
- return isObject() ? static_cast<JSObject*>(this) : 0;
+ return isObject() ? asObject(this) : 0;
}
const JSObject* JSCell::getObject() const
@@ -197,4 +197,40 @@ bool JSCell::isGetterSetter() const
return false;
}
+JSValue JSCell::toPrimitive(ExecState*, PreferredPrimitiveType) const
+{
+ ASSERT_NOT_REACHED();
+ return JSValue();
+}
+
+bool JSCell::getPrimitiveNumber(ExecState*, double&, JSValue&)
+{
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
+bool JSCell::toBoolean(ExecState*) const
+{
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
+double JSCell::toNumber(ExecState*) const
+{
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+UString JSCell::toString(ExecState*) const
+{
+ ASSERT_NOT_REACHED();
+ return UString();
+}
+
+JSObject* JSCell::toObject(ExecState*) const
+{
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
} // namespace JSC
diff --git a/JavaScriptCore/runtime/JSCell.h b/JavaScriptCore/runtime/JSCell.h
index 75ccf7f..503c6c4 100644
--- a/JavaScriptCore/runtime/JSCell.h
+++ b/JavaScriptCore/runtime/JSCell.h
@@ -23,11 +23,12 @@
#ifndef JSCell_h
#define JSCell_h
-#include <wtf/Noncopyable.h>
-#include "Structure.h"
-#include "JSValue.h"
-#include "JSImmediate.h"
#include "Collector.h"
+#include "JSImmediate.h"
+#include "JSValue.h"
+#include "MarkStack.h"
+#include "Structure.h"
+#include <wtf/Noncopyable.h>
namespace JSC {
@@ -45,6 +46,7 @@ namespace JSC {
private:
explicit JSCell(Structure*);
+ JSCell(); // Only used for initializing Collector blocks.
virtual ~JSCell();
public:
@@ -55,7 +57,7 @@ namespace JSC {
bool isString() const;
bool isObject() const;
virtual bool isGetterSetter() const;
- virtual bool isObject(const ClassInfo*) const;
+ bool inherits(const ClassInfo*) const;
virtual bool isAPIValueWrapper() const { return false; }
Structure* structure() const;
@@ -74,21 +76,19 @@ namespace JSC {
virtual bool getUInt32(uint32_t&) const;
// Basic conversions.
- virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const = 0;
- virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&) = 0;
- virtual bool toBoolean(ExecState*) const = 0;
- virtual double toNumber(ExecState*) const = 0;
- virtual UString toString(ExecState*) const = 0;
- virtual JSObject* toObject(ExecState*) const = 0;
+ virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
+ virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&);
+ virtual bool toBoolean(ExecState*) const;
+ virtual double toNumber(ExecState*) const;
+ virtual UString toString(ExecState*) const;
+ virtual JSObject* toObject(ExecState*) const;
// Garbage collection.
void* operator new(size_t, ExecState*);
void* operator new(size_t, JSGlobalData*);
void* operator new(size_t, void* placementNewDestination) { return placementNewDestination; }
- void markCellDirect();
virtual void markChildren(MarkStack&);
- bool marked() const;
// Object operations, with the toObject operation included.
virtual const ClassInfo* classInfo() const;
@@ -112,6 +112,7 @@ namespace JSC {
Structure* m_structure;
};
+ // FIXME: We should deprecate this and just use JSValue::asCell() instead.
JSCell* asCell(JSValue);
inline JSCell* asCell(JSValue value)
@@ -124,6 +125,11 @@ namespace JSC {
{
}
+ // Only used for initializing Collector blocks.
+ inline JSCell::JSCell()
+ {
+ }
+
inline JSCell::~JSCell()
{
}
@@ -150,19 +156,8 @@ namespace JSC {
return m_structure;
}
- inline bool JSCell::marked() const
- {
- return Heap::isCellMarked(this);
- }
-
- inline void JSCell::markCellDirect()
- {
- Heap::markCell(this);
- }
-
inline void JSCell::markChildren(MarkStack&)
{
- ASSERT(marked());
}
inline void* JSCell::operator new(size_t size, JSGlobalData* globalData)
@@ -231,23 +226,6 @@ namespace JSC {
return false;
}
- inline void JSValue::markDirect()
- {
- ASSERT(!marked());
- asCell()->markCellDirect();
- }
-
- inline void JSValue::markChildren(MarkStack& markStack)
- {
- ASSERT(marked());
- asCell()->markChildren(markStack);
- }
-
- inline bool JSValue::marked() const
- {
- return !isCell() || asCell()->marked();
- }
-
#if !USE(JSVALUE32_64)
ALWAYS_INLINE JSCell* JSValue::asCell() const
{
@@ -315,24 +293,6 @@ namespace JSC {
return isUndefined() ? nonInlineNaN() : 0; // null and false both convert to 0.
}
- inline UString JSValue::toString(ExecState* exec) const
- {
- if (isCell())
- return asCell()->toString(exec);
- if (isInt32())
- return UString::from(asInt32());
- if (isDouble())
- return asDouble() == 0.0 ? "0" : UString::from(asDouble());
- if (isTrue())
- return "true";
- if (isFalse())
- return "false";
- if (isNull())
- return "null";
- ASSERT(isUndefined());
- return "undefined";
- }
-
inline bool JSValue::needsThisConversion() const
{
if (UNLIKELY(!isCell()))
@@ -353,12 +313,6 @@ namespace JSC {
return asCell()->getJSNumber();
return JSValue();
}
-
- inline bool JSValue::hasChildren() const
- {
- return asCell()->structure()->typeInfo().type() >= CompoundType;
- }
-
inline JSObject* JSValue::toObject(ExecState* exec) const
{
@@ -372,37 +326,39 @@ namespace JSC {
ALWAYS_INLINE void MarkStack::append(JSCell* cell)
{
+ ASSERT(!m_isCheckingForDefaultMarkViolation);
ASSERT(cell);
- if (cell->marked())
+ if (Heap::isCellMarked(cell))
return;
- cell->markCellDirect();
+ Heap::markCell(cell);
if (cell->structure()->typeInfo().type() >= CompoundType)
m_values.append(cell);
}
- inline void MarkStack::drain() {
- while (!m_markSets.isEmpty() || !m_values.isEmpty()) {
- while ((!m_markSets.isEmpty()) && m_values.size() < 50) {
- const MarkSet& current = m_markSets.removeLast();
- JSValue* ptr = current.m_values;
- JSValue* end = current.m_end;
- if (current.m_properties == NoNullValues) {
- while (ptr != end)
- append(*ptr++);
- } else {
- while (ptr != end) {
- if (JSValue value = *ptr++)
- append(value);
- }
- }
- }
- while (!m_values.isEmpty()) {
- JSCell* current = m_values.removeLast();
- ASSERT(current->marked());
- current->markChildren(*this);
- }
- }
+ ALWAYS_INLINE void MarkStack::append(JSValue value)
+ {
+ ASSERT(value);
+ if (value.isCell())
+ append(value.asCell());
+ }
+
+ inline void Structure::markAggregate(MarkStack& markStack)
+ {
+ markStack.append(m_prototype);
+ }
+
+ inline Heap* Heap::heap(JSValue v)
+ {
+ if (!v.isCell())
+ return 0;
+ return heap(v.asCell());
+ }
+
+ inline Heap* Heap::heap(JSCell* c)
+ {
+ return cellBlock(c)->heap;
}
+
} // namespace JSC
#endif // JSCell_h
diff --git a/JavaScriptCore/runtime/JSFunction.cpp b/JavaScriptCore/runtime/JSFunction.cpp
index 84c6263..024e586 100644
--- a/JavaScriptCore/runtime/JSFunction.cpp
+++ b/JavaScriptCore/runtime/JSFunction.cpp
@@ -45,12 +45,21 @@ ASSERT_CLASS_FITS_IN_CELL(JSFunction);
const ClassInfo JSFunction::info = { "Function", &InternalFunction::info, 0, 0 };
-JSFunction::JSFunction(ExecState* exec, PassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func)
+bool JSFunction::isHostFunctionNonInline() const
+{
+ return isHostFunction();
+}
+
+JSFunction::JSFunction(NonNullPassRefPtr<Structure> structure)
+ : Base(structure)
+ , m_executable(adoptRef(new VPtrHackExecutable()))
+{
+}
+
+JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func)
: Base(&exec->globalData(), structure, name)
#if ENABLE(JIT)
- , m_body(FunctionBodyNode::createNativeThunk(&exec->globalData()))
-#else
- , m_body(0)
+ , m_executable(adoptRef(new NativeExecutable(exec)))
#endif
{
#if ENABLE(JIT)
@@ -63,9 +72,9 @@ JSFunction::JSFunction(ExecState* exec, PassRefPtr<Structure> structure, int len
#endif
}
-JSFunction::JSFunction(ExecState* exec, const Identifier& name, FunctionBodyNode* body, ScopeChainNode* scopeChainNode)
- : Base(&exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), name)
- , m_body(body)
+JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<FunctionExecutable> executable, ScopeChainNode* scopeChainNode)
+ : Base(&exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), executable->name())
+ , m_executable(executable)
{
setScopeChain(scopeChainNode);
}
@@ -75,20 +84,23 @@ JSFunction::~JSFunction()
// JIT code for other functions may have had calls linked directly to the code for this function; these links
// are based on a check for the this pointer value for this JSFunction - which will no longer be valid once
// this memory is freed and may be reused (potentially for another, different JSFunction).
+ if (!isHostFunction()) {
#if ENABLE(JIT_OPTIMIZE_CALL)
- if (m_body && m_body->isGenerated())
- m_body->generatedBytecode().unlinkCallers();
+ ASSERT(m_executable);
+ if (jsExecutable()->isGenerated())
+ jsExecutable()->generatedBytecode().unlinkCallers();
#endif
- if (!isHostFunction())
scopeChain().~ScopeChain(); // FIXME: Don't we need to do this in the interpreter too?
+ }
}
void JSFunction::markChildren(MarkStack& markStack)
{
Base::markChildren(markStack);
- m_body->markAggregate(markStack);
- if (!isHostFunction())
+ if (!isHostFunction()) {
+ jsExecutable()->markAggregate(markStack);
scopeChain().markAggregate(markStack);
+ }
}
CallType JSFunction::getCallData(CallData& callData)
@@ -97,7 +109,7 @@ CallType JSFunction::getCallData(CallData& callData)
callData.native.function = nativeFunction();
return CallTypeHost;
}
- callData.js.functionBody = m_body.get();
+ callData.js.functionExecutable = jsExecutable();
callData.js.scopeChain = scopeChain().node();
return CallTypeJS;
}
@@ -105,7 +117,7 @@ CallType JSFunction::getCallData(CallData& callData)
JSValue JSFunction::call(ExecState* exec, JSValue thisValue, const ArgList& args)
{
ASSERT(!isHostFunction());
- return exec->interpreter()->execute(m_body.get(), exec, this, thisValue.toThisObject(exec), args, scopeChain().node(), exec->exceptionSlot());
+ return exec->interpreter()->execute(jsExecutable(), exec, this, thisValue.toThisObject(exec), args, scopeChain().node(), exec->exceptionSlot());
}
JSValue JSFunction::argumentsGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
@@ -126,7 +138,7 @@ JSValue JSFunction::lengthGetter(ExecState* exec, const Identifier&, const Prope
{
JSFunction* thisObj = asFunction(slot.slotBase());
ASSERT(!thisObj->isHostFunction());
- return jsNumber(exec, thisObj->m_body->parameterCount());
+ return jsNumber(exec, thisObj->jsExecutable()->parameterCount());
}
bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
@@ -165,6 +177,35 @@ bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyN
return Base::getOwnPropertySlot(exec, propertyName, slot);
}
+ bool JSFunction::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+ {
+ if (isHostFunction())
+ return Base::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+
+ if (propertyName == exec->propertyNames().prototype) {
+ PropertySlot slot;
+ getOwnPropertySlot(exec, propertyName, slot);
+ return Base::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+ }
+
+ if (propertyName == exec->propertyNames().arguments) {
+ descriptor.setDescriptor(exec->interpreter()->retrieveArguments(exec, this), ReadOnly | DontEnum | DontDelete);
+ return true;
+ }
+
+ if (propertyName == exec->propertyNames().length) {
+ descriptor.setDescriptor(jsNumber(exec, jsExecutable()->parameterCount()), ReadOnly | DontEnum | DontDelete);
+ return true;
+ }
+
+ if (propertyName == exec->propertyNames().caller) {
+ descriptor.setDescriptor(exec->interpreter()->retrieveCaller(exec, this), ReadOnly | DontEnum | DontDelete);
+ return true;
+ }
+
+ return Base::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+ }
+
void JSFunction::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
{
if (isHostFunction()) {
@@ -190,7 +231,7 @@ ConstructType JSFunction::getConstructData(ConstructData& constructData)
{
if (isHostFunction())
return ConstructTypeNone;
- constructData.js.functionBody = m_body.get();
+ constructData.js.functionExecutable = jsExecutable();
constructData.js.scopeChain = scopeChain().node();
return ConstructTypeJS;
}
@@ -206,7 +247,7 @@ JSObject* JSFunction::construct(ExecState* exec, const ArgList& args)
structure = exec->lexicalGlobalObject()->emptyObjectStructure();
JSObject* thisObj = new (exec) JSObject(structure);
- JSValue result = exec->interpreter()->execute(m_body.get(), exec, this, thisObj, args, scopeChain().node(), exec->exceptionSlot());
+ JSValue result = exec->interpreter()->execute(jsExecutable(), exec, this, thisObj, args, scopeChain().node(), exec->exceptionSlot());
if (exec->hadException() || !result.isObject())
return thisObj;
return asObject(result);
diff --git a/JavaScriptCore/runtime/JSFunction.h b/JavaScriptCore/runtime/JSFunction.h
index cab1e5b..a9ac63e 100644
--- a/JavaScriptCore/runtime/JSFunction.h
+++ b/JavaScriptCore/runtime/JSFunction.h
@@ -25,14 +25,11 @@
#define JSFunction_h
#include "InternalFunction.h"
-#include "JSVariableObject.h"
-#include "SymbolTable.h"
-#include "Nodes.h"
-#include "JSObject.h"
namespace JSC {
- class FunctionBodyNode;
+ class ExecutableBase;
+ class FunctionExecutable;
class FunctionPrototype;
class JSActivation;
class JSGlobalObject;
@@ -43,20 +40,10 @@ namespace JSC {
typedef InternalFunction Base;
- JSFunction(PassRefPtr<Structure> structure)
- : InternalFunction(structure)
- {
- clearScopeChain();
- }
-
public:
- JSFunction(ExecState*, PassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
- JSFunction(ExecState*, const Identifier&, FunctionBodyNode*, ScopeChainNode*);
- ~JSFunction();
-
- virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
- virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
- virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
+ JSFunction(ExecState*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
+ JSFunction(ExecState*, NonNullPassRefPtr<FunctionExecutable>, ScopeChainNode*);
+ virtual ~JSFunction();
JSObject* construct(ExecState*, const ArgList&);
JSValue call(ExecState*, JSValue thisValue, const ArgList&);
@@ -64,11 +51,11 @@ namespace JSC {
void setScope(const ScopeChain& scopeChain) { setScopeChain(scopeChain); }
ScopeChain& scope() { return scopeChain(); }
- void setBody(FunctionBodyNode* body) { m_body = body; }
- void setBody(PassRefPtr<FunctionBodyNode> body) { m_body = body; }
- FunctionBodyNode* body() const { return m_body.get(); }
+ ExecutableBase* executable() const { return m_executable.get(); }
- virtual void markChildren(MarkStack&);
+ // To call either of these methods include Executable.h
+ inline bool isHostFunction() const;
+ FunctionExecutable* jsExecutable() const;
static JS_EXPORTDATA const ClassInfo info;
@@ -77,11 +64,6 @@ namespace JSC {
return Structure::create(prototype, TypeInfo(ObjectType, ImplementsHasInstance));
}
-#if ENABLE(JIT)
- bool isHostFunction() const { return m_body && m_body->isHostFunction(); }
-#else
- bool isHostFunction() const { return false; }
-#endif
NativeFunction nativeFunction()
{
return *reinterpret_cast<NativeFunction*>(m_data);
@@ -91,31 +73,42 @@ namespace JSC {
virtual CallType getCallData(CallData&);
private:
+ JSFunction(NonNullPassRefPtr<Structure>);
+
+ bool isHostFunctionNonInline() const;
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+ virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
+ virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
+
+ virtual void markChildren(MarkStack&);
+
virtual const ClassInfo* classInfo() const { return &info; }
static JSValue argumentsGetter(ExecState*, const Identifier&, const PropertySlot&);
static JSValue callerGetter(ExecState*, const Identifier&, const PropertySlot&);
static JSValue lengthGetter(ExecState*, const Identifier&, const PropertySlot&);
- RefPtr<FunctionBodyNode> m_body;
+ RefPtr<ExecutableBase> m_executable;
ScopeChain& scopeChain()
{
- ASSERT(!isHostFunction());
+ ASSERT(!isHostFunctionNonInline());
return *reinterpret_cast<ScopeChain*>(m_data);
}
void clearScopeChain()
{
- ASSERT(!isHostFunction());
+ ASSERT(!isHostFunctionNonInline());
new (m_data) ScopeChain(NoScopeChain());
}
void setScopeChain(ScopeChainNode* sc)
{
- ASSERT(!isHostFunction());
+ ASSERT(!isHostFunctionNonInline());
new (m_data) ScopeChain(sc);
}
void setScopeChain(const ScopeChain& sc)
{
- ASSERT(!isHostFunction());
+ ASSERT(!isHostFunctionNonInline());
*reinterpret_cast<ScopeChain*>(m_data) = sc;
}
void setNativeFunction(NativeFunction func)
diff --git a/JavaScriptCore/runtime/JSGlobalData.cpp b/JavaScriptCore/runtime/JSGlobalData.cpp
index 03df41d..1221ef2 100644
--- a/JavaScriptCore/runtime/JSGlobalData.cpp
+++ b/JavaScriptCore/runtime/JSGlobalData.cpp
@@ -144,8 +144,12 @@ JSGlobalData::JSGlobalData(bool isShared, const VPtrSet& vptrSet)
, initializingLazyNumericCompareFunction(false)
, head(0)
, dynamicGlobalObject(0)
- , scopeNodeBeingReparsed(0)
+ , functionCodeBlockBeingReparsed(0)
, firstStringifierToMark(0)
+ , markStack(vptrSet.jsArrayVPtr)
+#ifndef NDEBUG
+ , mainThreadOnly(false)
+#endif
{
#if PLATFORM(MAC)
startProfilerServerIfNeeded();
@@ -235,9 +239,8 @@ const Vector<Instruction>& JSGlobalData::numericCompareFunction(ExecState* exec)
{
if (!lazyNumericCompareFunction.size() && !initializingLazyNumericCompareFunction) {
initializingLazyNumericCompareFunction = true;
- RefPtr<ProgramNode> programNode = parser->parse<ProgramNode>(exec, 0, makeSource(UString("(function (v1, v2) { return v1 - v2; })")), 0, 0);
- RefPtr<FunctionBodyNode> functionBody = extractFunctionBody(programNode.get());
- lazyNumericCompareFunction = functionBody->bytecode(exec->scopeChain()).instructions();
+ RefPtr<FunctionExecutable> function = FunctionExecutable::fromGlobalCode(Identifier(exec, "numericCompare"), exec, 0, makeSource(UString("(function (v1, v2) { return v1 - v2; })")), 0, 0);
+ lazyNumericCompareFunction = function->bytecode(exec, exec->scopeChain()).instructions();
initializingLazyNumericCompareFunction = false;
}
@@ -248,4 +251,19 @@ JSGlobalData::ClientData::~ClientData()
{
}
+void JSGlobalData::startSampling()
+{
+ interpreter->startSampling();
+}
+
+void JSGlobalData::stopSampling()
+{
+ interpreter->stopSampling();
+}
+
+void JSGlobalData::dumpSampleData(ExecState* exec)
+{
+ interpreter->dumpSampleData(exec);
+}
+
} // namespace JSC
diff --git a/JavaScriptCore/runtime/JSGlobalData.h b/JavaScriptCore/runtime/JSGlobalData.h
index 88cb516..3ad90ad 100644
--- a/JavaScriptCore/runtime/JSGlobalData.h
+++ b/JavaScriptCore/runtime/JSGlobalData.h
@@ -34,6 +34,7 @@
#include "JITStubs.h"
#include "JSValue.h"
#include "MarkStack.h"
+#include "NumericStrings.h"
#include "SmallStrings.h"
#include "TimeoutChecker.h"
#include <wtf/Forward.h>
@@ -45,15 +46,14 @@ struct OpaqueJSClassContextData;
namespace JSC {
+ class CodeBlock;
class CommonIdentifiers;
- class FunctionBodyNode;
class IdentifierTable;
class Interpreter;
class JSGlobalObject;
class JSObject;
class Lexer;
class Parser;
- class ScopeNode;
class Stringifier;
class Structure;
class UString;
@@ -115,6 +115,7 @@ namespace JSC {
CommonIdentifiers* propertyNames;
const MarkedArgumentBuffer* emptyList; // Lists are supposed to be allocated on the stack to have their elements properly marked, which is not the case here - but this list has nothing to mark.
SmallStrings smallStrings;
+ NumericStrings numericStrings;
#if ENABLE(ASSEMBLER)
ExecutableAllocator executableAllocator;
@@ -145,10 +146,18 @@ namespace JSC {
HashSet<JSObject*> arrayVisitedElements;
- ScopeNode* scopeNodeBeingReparsed;
+ CodeBlock* functionCodeBlockBeingReparsed;
Stringifier* firstStringifierToMark;
MarkStack markStack;
+
+#ifndef NDEBUG
+ bool mainThreadOnly;
+#endif
+
+ void startSampling();
+ void stopSampling();
+ void dumpSampleData(ExecState* exec);
private:
JSGlobalData(bool isShared, const VPtrSet&);
static JSGlobalData*& sharedInstanceInternal();
diff --git a/JavaScriptCore/runtime/JSGlobalObject.cpp b/JavaScriptCore/runtime/JSGlobalObject.cpp
index a90f18f..3bb281e 100644
--- a/JavaScriptCore/runtime/JSGlobalObject.cpp
+++ b/JavaScriptCore/runtime/JSGlobalObject.cpp
@@ -112,8 +112,8 @@ JSGlobalObject::~JSGlobalObject()
if (headObject == this)
headObject = 0;
- HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end();
- for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
+ HashSet<GlobalCodeBlock*>::const_iterator end = codeBlocks().end();
+ for (HashSet<GlobalCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
(*it)->clearGlobalObject();
RegisterFile& registerFile = globalData()->interpreter->registerFile();
@@ -121,7 +121,7 @@ JSGlobalObject::~JSGlobalObject()
registerFile.setGlobalObject(0);
registerFile.setNumGlobals(0);
}
- delete d();
+ d()->destructor(d());
}
void JSGlobalObject::init(JSObject* thisValue)
@@ -129,7 +129,7 @@ void JSGlobalObject::init(JSObject* thisValue)
ASSERT(JSLock::currentThreadIsHoldingLock());
d()->globalData = Heap::heap(this)->globalData();
- d()->globalScopeChain = ScopeChain(this, d()->globalData.get(), thisValue);
+ d()->globalScopeChain = ScopeChain(this, d()->globalData.get(), this, thisValue);
JSGlobalObject::globalExec()->init(0, 0, d()->globalScopeChain.node(), CallFrame::noCaller(), 0, 0, 0);
@@ -175,18 +175,18 @@ void JSGlobalObject::putWithAttributes(ExecState* exec, const Identifier& proper
}
}
-void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc)
+void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes)
{
PropertySlot slot;
if (!symbolTableGet(propertyName, slot))
- JSVariableObject::defineGetter(exec, propertyName, getterFunc);
+ JSVariableObject::defineGetter(exec, propertyName, getterFunc, attributes);
}
-void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc)
+void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes)
{
PropertySlot slot;
if (!symbolTableGet(propertyName, slot))
- JSVariableObject::defineSetter(exec, propertyName, setterFunc);
+ JSVariableObject::defineSetter(exec, propertyName, setterFunc, attributes);
}
static inline JSObject* lastInPrototypeChain(JSObject* object)
@@ -258,7 +258,7 @@ void JSGlobalObject::reset(JSValue prototype)
JSCell* objectConstructor = new (exec) ObjectConstructor(exec, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype, d()->prototypeFunctionStructure.get());
JSCell* functionConstructor = new (exec) FunctionConstructor(exec, FunctionConstructor::createStructure(d()->functionPrototype), d()->functionPrototype);
- JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype);
+ JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype, d()->prototypeFunctionStructure.get());
JSCell* stringConstructor = new (exec) StringConstructor(exec, StringConstructor::createStructure(d()->functionPrototype), d()->prototypeFunctionStructure.get(), d()->stringPrototype);
JSCell* booleanConstructor = new (exec) BooleanConstructor(exec, BooleanConstructor::createStructure(d()->functionPrototype), d()->booleanPrototype);
JSCell* numberConstructor = new (exec) NumberConstructor(exec, NumberConstructor::createStructure(d()->functionPrototype), d()->numberPrototype);
@@ -361,8 +361,8 @@ void JSGlobalObject::markChildren(MarkStack& markStack)
{
JSVariableObject::markChildren(markStack);
- HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end();
- for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
+ HashSet<GlobalCodeBlock*>::const_iterator end = codeBlocks().end();
+ for (HashSet<GlobalCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
(*it)->markAggregate(markStack);
RegisterFile& registerFile = globalData()->interpreter->registerFile();
@@ -455,4 +455,9 @@ void* JSGlobalObject::operator new(size_t size, JSGlobalData* globalData)
#endif
}
+void JSGlobalObject::destroyJSGlobalObjectData(void* jsGlobalObjectData)
+{
+ delete static_cast<JSGlobalObjectData*>(jsGlobalObjectData);
+}
+
} // namespace JSC
diff --git a/JavaScriptCore/runtime/JSGlobalObject.h b/JavaScriptCore/runtime/JSGlobalObject.h
index cda49bd..2106783 100644
--- a/JavaScriptCore/runtime/JSGlobalObject.h
+++ b/JavaScriptCore/runtime/JSGlobalObject.h
@@ -22,6 +22,7 @@
#ifndef JSGlobalObject_h
#define JSGlobalObject_h
+#include "JSArray.h"
#include "JSGlobalData.h"
#include "JSVariableObject.h"
#include "NativeFunctionWrapper.h"
@@ -38,6 +39,7 @@ namespace JSC {
class Debugger;
class ErrorConstructor;
class FunctionPrototype;
+ class GlobalCodeBlock;
class GlobalEvalFunction;
class NativeErrorConstructor;
class ProgramCodeBlock;
@@ -50,14 +52,22 @@ namespace JSC {
struct HashTable;
typedef Vector<ExecState*, 16> ExecStateStack;
-
+
class JSGlobalObject : public JSVariableObject {
protected:
using JSVariableObject::JSVariableObjectData;
struct JSGlobalObjectData : public JSVariableObjectData {
- JSGlobalObjectData()
+ // We use an explicit destructor function pointer instead of a
+ // virtual destructor because we want to avoid adding a vtable
+ // pointer to this struct. Adding a vtable pointer would force the
+ // compiler to emit costly pointer fixup code when casting from
+ // JSVariableObjectData* to JSGlobalObjectData*.
+ typedef void (*Destructor)(void*);
+
+ JSGlobalObjectData(Destructor destructor)
: JSVariableObjectData(&symbolTable, 0)
+ , destructor(destructor)
, registerArraySize(0)
, globalScopeChain(NoScopeChain())
, regExpConstructor(0)
@@ -83,10 +93,8 @@ namespace JSC {
{
}
- virtual ~JSGlobalObjectData()
- {
- }
-
+ Destructor destructor;
+
size_t registerArraySize;
JSGlobalObject* next;
@@ -144,20 +152,20 @@ namespace JSC {
RefPtr<JSGlobalData> globalData;
- HashSet<ProgramCodeBlock*> codeBlocks;
+ HashSet<GlobalCodeBlock*> codeBlocks;
};
public:
void* operator new(size_t, JSGlobalData*);
explicit JSGlobalObject()
- : JSVariableObject(JSGlobalObject::createStructure(jsNull()), new JSGlobalObjectData)
+ : JSVariableObject(JSGlobalObject::createStructure(jsNull()), new JSGlobalObjectData(destroyJSGlobalObjectData))
{
init(this);
}
protected:
- JSGlobalObject(PassRefPtr<Structure> structure, JSGlobalObjectData* data, JSObject* thisValue)
+ JSGlobalObject(NonNullPassRefPtr<Structure> structure, JSGlobalObjectData* data, JSObject* thisValue)
: JSVariableObject(structure, data)
{
init(thisValue);
@@ -169,12 +177,13 @@ namespace JSC {
virtual void markChildren(MarkStack&);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual bool hasOwnPropertyForWrite(ExecState*, const Identifier&);
virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&);
virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue value, unsigned attributes);
- virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunc);
- virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunc);
+ virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes);
+ virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes);
// Linked list of all global objects that use the same JSGlobalData.
JSGlobalObject*& head() { return d()->globalData->head; }
@@ -246,7 +255,7 @@ namespace JSC {
virtual bool isDynamicScope() const;
- HashSet<ProgramCodeBlock*>& codeBlocks() { return d()->codeBlocks; }
+ HashSet<GlobalCodeBlock*>& codeBlocks() { return d()->codeBlocks; }
void copyGlobalsFrom(RegisterFile&);
void copyGlobalsTo(RegisterFile&);
@@ -277,6 +286,8 @@ namespace JSC {
void addStaticGlobals(GlobalPropertyInfo*, int count);
private:
+ static void destroyJSGlobalObjectData(void*);
+
// FIXME: Fold reset into init.
void init(JSObject* thisValue);
void reset(JSValue prototype);
@@ -325,6 +336,13 @@ namespace JSC {
return symbolTableGet(propertyName, slot);
}
+ inline bool JSGlobalObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+ {
+ if (symbolTableGet(propertyName, descriptor))
+ return true;
+ return JSVariableObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+ }
+
inline bool JSGlobalObject::hasOwnPropertyForWrite(ExecState* exec, const Identifier& propertyName)
{
PropertySlot slot;
@@ -334,14 +352,6 @@ namespace JSC {
return symbolTableGet(propertyName, slot, slotIsWriteable);
}
- inline JSGlobalObject* ScopeChainNode::globalObject() const
- {
- const ScopeChainNode* n = this;
- while (n->next)
- n = n->next;
- return asGlobalObject(n->object);
- }
-
inline JSValue Structure::prototypeForLookup(ExecState* exec) const
{
if (typeInfo().type() == ObjectType)
@@ -396,6 +406,33 @@ namespace JSC {
return globalData().dynamicGlobalObject;
}
+ inline JSObject* constructEmptyObject(ExecState* exec)
+ {
+ return new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure());
+ }
+
+ inline JSArray* constructEmptyArray(ExecState* exec)
+ {
+ return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure());
+ }
+
+ inline JSArray* constructEmptyArray(ExecState* exec, unsigned initialLength)
+ {
+ return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), initialLength);
+ }
+
+ inline JSArray* constructArray(ExecState* exec, JSValue singleItemValue)
+ {
+ MarkedArgumentBuffer values;
+ values.append(singleItemValue);
+ return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), values);
+ }
+
+ inline JSArray* constructArray(ExecState* exec, const ArgList& values)
+ {
+ return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), values);
+ }
+
class DynamicGlobalObjectScope : public Noncopyable {
public:
DynamicGlobalObjectScope(CallFrame* callFrame, JSGlobalObject* dynamicGlobalObject)
diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
index affb99c..dc32718 100644
--- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
+++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -286,16 +286,12 @@ JSValue JSC_HOST_CALL globalFuncEval(ExecState* exec, JSObject* function, JSValu
if (JSValue parsedObject = preparser.tryLiteralParse())
return parsedObject;
- int errLine;
- UString errMsg;
+ RefPtr<EvalExecutable> eval = EvalExecutable::create(exec, makeSource(s));
+ JSObject* error = eval->compile(exec, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node());
+ if (error)
+ return throwError(exec, error);
- SourceCode source = makeSource(s);
- RefPtr<EvalNode> evalNode = exec->globalData().parser->parse<EvalNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);
-
- if (!evalNode)
- return throwError(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), NULL);
-
- return exec->interpreter()->execute(evalNode.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot());
+ return exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot());
}
JSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec, JSObject*, JSValue, const ArgList& args)
diff --git a/JavaScriptCore/runtime/JSNotAnObject.cpp b/JavaScriptCore/runtime/JSNotAnObject.cpp
index a542a9f..c36dc10 100644
--- a/JavaScriptCore/runtime/JSNotAnObject.cpp
+++ b/JavaScriptCore/runtime/JSNotAnObject.cpp
@@ -93,6 +93,12 @@ bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, unsigned, PropertySlot&)
return false;
}
+bool JSNotAnObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier&, PropertyDescriptor&)
+{
+ ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
+ return false;
+}
+
void JSNotAnObject::put(ExecState* exec, const Identifier& , JSValue, PutPropertySlot&)
{
ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
@@ -115,7 +121,7 @@ bool JSNotAnObject::deleteProperty(ExecState* exec, unsigned)
return false;
}
-void JSNotAnObject::getPropertyNames(ExecState* exec, PropertyNameArray&)
+void JSNotAnObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray&)
{
ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
}
diff --git a/JavaScriptCore/runtime/JSNotAnObject.h b/JavaScriptCore/runtime/JSNotAnObject.h
index b65ff5f..0d9aca6 100644
--- a/JavaScriptCore/runtime/JSNotAnObject.h
+++ b/JavaScriptCore/runtime/JSNotAnObject.h
@@ -80,6 +80,7 @@ namespace JSC {
// JSObject methods
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual void put(ExecState*, unsigned propertyName, JSValue);
@@ -87,7 +88,7 @@ namespace JSC {
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
virtual bool deleteProperty(ExecState*, unsigned propertyName);
- virtual void getPropertyNames(ExecState*, PropertyNameArray&);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&);
JSNotAnObjectErrorStub* m_exception;
};
diff --git a/JavaScriptCore/runtime/JSNumberCell.cpp b/JavaScriptCore/runtime/JSNumberCell.cpp
index 0654da7..f1009b9 100644
--- a/JavaScriptCore/runtime/JSNumberCell.cpp
+++ b/JavaScriptCore/runtime/JSNumberCell.cpp
@@ -54,15 +54,11 @@ double JSNumberCell::toNumber(ExecState*) const
UString JSNumberCell::toString(ExecState*) const
{
- if (m_value == 0.0) // +0.0 or -0.0
- return "0";
return UString::from(m_value);
}
UString JSNumberCell::toThisString(ExecState*) const
{
- if (m_value == 0.0) // +0.0 or -0.0
- return "0";
return UString::from(m_value);
}
diff --git a/JavaScriptCore/runtime/JSNumberCell.h b/JavaScriptCore/runtime/JSNumberCell.h
index 04cccef..6a48081 100644
--- a/JavaScriptCore/runtime/JSNumberCell.h
+++ b/JavaScriptCore/runtime/JSNumberCell.h
@@ -84,7 +84,7 @@ namespace JSC {
#endif
}
- static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(NumberType, NeedsThisConversion)); }
+ static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(NumberType, NeedsThisConversion | HasDefaultMark)); }
private:
JSNumberCell(JSGlobalData* globalData, double value)
diff --git a/JavaScriptCore/runtime/JSONObject.cpp b/JavaScriptCore/runtime/JSONObject.cpp
index d643808..297d457 100644
--- a/JavaScriptCore/runtime/JSONObject.cpp
+++ b/JavaScriptCore/runtime/JSONObject.cpp
@@ -120,38 +120,47 @@ private:
// ------------------------------ helper functions --------------------------------
-static inline JSValue unwrapBoxedPrimitive(JSValue value)
+static inline JSValue unwrapBoxedPrimitive(ExecState* exec, JSValue value)
{
if (!value.isObject())
return value;
- if (!asObject(value)->inherits(&NumberObject::info) && !asObject(value)->inherits(&StringObject::info) && !asObject(value)->inherits(&BooleanObject::info))
- return value;
- return static_cast<JSWrapperObject*>(asObject(value))->internalValue();
+ JSObject* object = asObject(value);
+ if (object->inherits(&NumberObject::info))
+ return jsNumber(exec, object->toNumber(exec));
+ if (object->inherits(&StringObject::info))
+ return jsString(exec, object->toString(exec));
+ if (object->inherits(&BooleanObject::info))
+ return object->toPrimitive(exec);
+ return value;
}
-static inline UString gap(JSValue space)
+static inline UString gap(ExecState* exec, JSValue space)
{
- space = unwrapBoxedPrimitive(space);
+ const int maxGapLength = 10;
+ space = unwrapBoxedPrimitive(exec, space);
// If the space value is a number, create a gap string with that number of spaces.
double spaceCount;
if (space.getNumber(spaceCount)) {
- const int maxSpaceCount = 100;
int count;
- if (spaceCount > maxSpaceCount)
- count = maxSpaceCount;
+ if (spaceCount > maxGapLength)
+ count = maxGapLength;
else if (!(spaceCount > 0))
count = 0;
else
count = static_cast<int>(spaceCount);
- UChar spaces[maxSpaceCount];
+ UChar spaces[maxGapLength];
for (int i = 0; i < count; ++i)
spaces[i] = ' ';
return UString(spaces, count);
}
// If the space value is a string, use it as the gap string, otherwise use no gap string.
- return space.getString();
+ UString spaces = space.getString();
+ if (spaces.size() > maxGapLength) {
+ spaces = spaces.substr(0, maxGapLength);
+ }
+ return spaces;
}
// ------------------------------ PropertyNameForFunctionCall --------------------------------
@@ -187,7 +196,7 @@ Stringifier::Stringifier(ExecState* exec, JSValue replacer, JSValue space)
, m_usingArrayReplacer(false)
, m_arrayReplacerPropertyNames(exec)
, m_replacerCallType(CallTypeNone)
- , m_gap(gap(space))
+ , m_gap(gap(exec, space))
{
exec->globalData().firstStringifierToMark = this;
@@ -202,12 +211,27 @@ Stringifier::Stringifier(ExecState* exec, JSValue replacer, JSValue space)
JSValue name = array->get(exec, i);
if (exec->hadException())
break;
+
UString propertyName;
- if (!name.getString(propertyName))
+ if (name.getString(propertyName)) {
+ m_arrayReplacerPropertyNames.add(Identifier(exec, propertyName));
continue;
- if (exec->hadException())
- return;
- m_arrayReplacerPropertyNames.add(Identifier(exec, propertyName));
+ }
+
+ double value = 0;
+ if (name.getNumber(value)) {
+ m_arrayReplacerPropertyNames.add(Identifier::from(exec, value));
+ continue;
+ }
+
+ if (name.isObject()) {
+ if (!asObject(name)->inherits(&NumberObject::info) && !asObject(name)->inherits(&StringObject::info))
+ continue;
+ propertyName = name.toString(exec);
+ if (exec->hadException())
+ break;
+ m_arrayReplacerPropertyNames.add(Identifier(exec, propertyName));
+ }
}
return;
}
@@ -354,7 +378,10 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder&
return StringifySucceeded;
}
- value = unwrapBoxedPrimitive(value);
+ value = unwrapBoxedPrimitive(m_exec, value);
+
+ if (m_exec->hadException())
+ return StringifyFailed;
if (value.isBoolean()) {
builder.append(value.getBoolean() ? "true" : "false");
@@ -381,6 +408,15 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder&
JSObject* object = asObject(value);
+ CallData callData;
+ if (object->getCallData(callData) != CallTypeNone) {
+ if (holder->inherits(&JSArray::info)) {
+ builder.append("null");
+ return StringifySucceeded;
+ }
+ return StringifyFailedDueToUndefinedValue;
+ }
+
// Handle cycle detection, and put the holder on the stack.
if (!m_holderCycleDetector.add(object).second) {
throwError(m_exec, TypeError, "JSON.stringify cannot serialize cyclic structures.");
@@ -572,13 +608,12 @@ const ClassInfo JSONObject::info = { "JSON", 0, 0, ExecState::jsonTable };
bool JSONObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
- const HashEntry* entry = ExecState::jsonTable(exec)->entry(exec, propertyName);
- if (!entry)
- return JSObject::getOwnPropertySlot(exec, propertyName, slot);
+ return getStaticFunctionSlot<JSObject>(exec, ExecState::jsonTable(exec), this, propertyName, slot);
+}
- ASSERT(entry->attributes() & Function);
- setUpStaticFunctionSlot(exec, entry, this, propertyName, slot);
- return true;
+bool JSONObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticFunctionDescriptor<JSObject>(exec, ExecState::jsonTable(exec), this, propertyName, descriptor);
}
void JSONObject::markStringifiers(MarkStack& markStack, Stringifier* stringifier)
@@ -597,11 +632,11 @@ public:
}
JSValue walk(JSValue unfiltered);
private:
- JSValue callReviver(JSValue property, JSValue unfiltered)
+ JSValue callReviver(JSObject* thisObj, JSValue property, JSValue unfiltered)
{
JSValue args[] = { property, unfiltered };
ArgList argList(args, 2);
- return call(m_exec, m_function, m_callType, m_callData, jsNull(), argList);
+ return call(m_exec, m_function, m_callType, m_callData, thisObj, argList);
}
friend class Holder;
@@ -611,7 +646,10 @@ private:
CallType m_callType;
CallData m_callData;
};
-
+
+// We clamp recursion well beyond anything reasonable, but we also have a timeout check
+// to guard against "infinite" execution by inserting arbitrarily large objects.
+static const unsigned maximumFilterRecursion = 40000;
enum WalkerState { StateUnknown, ArrayStartState, ArrayStartVisitMember, ArrayEndVisitMember,
ObjectStartState, ObjectStartVisitMember, ObjectEndVisitMember };
NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
@@ -625,12 +663,21 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
WalkerState state = StateUnknown;
JSValue inValue = unfiltered;
JSValue outValue = jsNull();
+
+ TimeoutChecker localTimeoutChecker(m_exec->globalData().timeoutChecker);
+ localTimeoutChecker.reset();
+ unsigned tickCount = localTimeoutChecker.ticksUntilNextCheck();
while (1) {
switch (state) {
arrayStartState:
case ArrayStartState: {
ASSERT(inValue.isObject());
- ASSERT(isJSArray(&m_exec->globalData(), asObject(inValue)));
+ ASSERT(isJSArray(&m_exec->globalData(), asObject(inValue)) || asObject(inValue)->inherits(&JSArray::info));
+ if (objectStack.size() + arrayStack.size() > maximumFilterRecursion) {
+ m_exec->setException(createStackOverflowError(m_exec));
+ return jsUndefined();
+ }
+
JSArray* array = asArray(inValue);
arrayStack.append(array);
indexStack.append(0);
@@ -638,6 +685,14 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
}
arrayStartVisitMember:
case ArrayStartVisitMember: {
+ if (!--tickCount) {
+ if (localTimeoutChecker.didTimeOut(m_exec)) {
+ m_exec->setException(createInterruptedExecutionException(&m_exec->globalData()));
+ return jsUndefined();
+ }
+ tickCount = localTimeoutChecker.ticksUntilNextCheck();
+ }
+
JSArray* array = arrayStack.last();
uint32_t index = indexStack.last();
if (index == array->length()) {
@@ -646,7 +701,16 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
indexStack.removeLast();
break;
}
- inValue = array->getIndex(index);
+ if (isJSArray(&m_exec->globalData(), array) && array->canGetIndex(index))
+ inValue = array->getIndex(index);
+ else {
+ PropertySlot slot;
+ if (array->getOwnPropertySlot(m_exec, index, slot))
+ inValue = slot.getValue(m_exec, index);
+ else
+ inValue = jsUndefined();
+ }
+
if (inValue.isObject()) {
stateStack.append(ArrayEndVisitMember);
goto stateUnknown;
@@ -656,7 +720,15 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
}
case ArrayEndVisitMember: {
JSArray* array = arrayStack.last();
- array->setIndex(indexStack.last(), callReviver(jsString(m_exec, UString::from(indexStack.last())), outValue));
+ JSValue filteredValue = callReviver(array, jsString(m_exec, UString::from(indexStack.last())), outValue);
+ if (filteredValue.isUndefined())
+ array->deleteProperty(m_exec, indexStack.last());
+ else {
+ if (isJSArray(&m_exec->globalData(), array) && array->canSetIndex(indexStack.last()))
+ array->setIndex(indexStack.last(), filteredValue);
+ else
+ array->put(m_exec, indexStack.last(), filteredValue);
+ }
if (m_exec->hadException())
return jsNull();
indexStack.last()++;
@@ -665,7 +737,12 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
objectStartState:
case ObjectStartState: {
ASSERT(inValue.isObject());
- ASSERT(!isJSArray(&m_exec->globalData(), asObject(inValue)));
+ ASSERT(!isJSArray(&m_exec->globalData(), asObject(inValue)) && !asObject(inValue)->inherits(&JSArray::info));
+ if (objectStack.size() + arrayStack.size() > maximumFilterRecursion) {
+ m_exec->setException(createStackOverflowError(m_exec));
+ return jsUndefined();
+ }
+
JSObject* object = asObject(inValue);
objectStack.append(object);
indexStack.append(0);
@@ -675,6 +752,14 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
}
objectStartVisitMember:
case ObjectStartVisitMember: {
+ if (!--tickCount) {
+ if (localTimeoutChecker.didTimeOut(m_exec)) {
+ m_exec->setException(createInterruptedExecutionException(&m_exec->globalData()));
+ return jsUndefined();
+ }
+ tickCount = localTimeoutChecker.ticksUntilNextCheck();
+ }
+
JSObject* object = objectStack.last();
uint32_t index = indexStack.last();
PropertyNameArray& properties = propertyStack.last();
@@ -686,9 +771,15 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
break;
}
PropertySlot slot;
- object->getOwnPropertySlot(m_exec, properties[index], slot);
- inValue = slot.getValue(m_exec, properties[index]);
- ASSERT(!m_exec->hadException());
+ if (object->getOwnPropertySlot(m_exec, properties[index], slot))
+ inValue = slot.getValue(m_exec, properties[index]);
+ else
+ inValue = jsUndefined();
+
+ // The holder may be modified by the reviver function so any lookup may throw
+ if (m_exec->hadException())
+ return jsNull();
+
if (inValue.isObject()) {
stateStack.append(ObjectEndVisitMember);
goto stateUnknown;
@@ -700,7 +791,11 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
JSObject* object = objectStack.last();
Identifier prop = propertyStack.last()[indexStack.last()];
PutPropertySlot slot;
- object->put(m_exec, prop, callReviver(jsString(m_exec, prop.ustring()), outValue), slot);
+ JSValue filteredValue = callReviver(object, jsString(m_exec, prop.ustring()), outValue);
+ if (filteredValue.isUndefined())
+ object->deleteProperty(m_exec, prop);
+ else
+ object->put(m_exec, prop, filteredValue, slot);
if (m_exec->hadException())
return jsNull();
indexStack.last()++;
@@ -712,16 +807,29 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
outValue = inValue;
break;
}
- if (isJSArray(&m_exec->globalData(), asObject(inValue)))
+ JSObject* object = asObject(inValue);
+ if (isJSArray(&m_exec->globalData(), object) || object->inherits(&JSArray::info))
goto arrayStartState;
goto objectStartState;
}
if (stateStack.isEmpty())
break;
+
state = stateStack.last();
stateStack.removeLast();
+
+ if (!--tickCount) {
+ if (localTimeoutChecker.didTimeOut(m_exec)) {
+ m_exec->setException(createInterruptedExecutionException(&m_exec->globalData()));
+ return jsUndefined();
+ }
+ tickCount = localTimeoutChecker.ticksUntilNextCheck();
+ }
}
- return callReviver(jsEmptyString(m_exec), outValue);
+ JSObject* finalHolder = constructEmptyObject(m_exec);
+ PutPropertySlot slot;
+ finalHolder->put(m_exec, m_exec->globalData().propertyNames->emptyIdentifier, outValue, slot);
+ return callReviver(finalHolder, jsEmptyString(m_exec), outValue);
}
// ECMA-262 v5 15.12.2
diff --git a/JavaScriptCore/runtime/JSONObject.h b/JavaScriptCore/runtime/JSONObject.h
index faca7c7..65c9803 100644
--- a/JavaScriptCore/runtime/JSONObject.h
+++ b/JavaScriptCore/runtime/JSONObject.h
@@ -34,20 +34,21 @@ namespace JSC {
class JSONObject : public JSObject {
public:
- JSONObject(PassRefPtr<Structure> structure)
+ JSONObject(NonNullPassRefPtr<Structure> structure)
: JSObject(structure)
{
}
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType));
+ return Structure::create(prototype, TypeInfo(ObjectType, HasDefaultMark | HasDefaultGetPropertyNames));
}
static void markStringifiers(MarkStack&, Stringifier*);
private:
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
diff --git a/JavaScriptCore/runtime/JSObject.cpp b/JavaScriptCore/runtime/JSObject.cpp
index 419dfe9..db2a9b2 100644
--- a/JavaScriptCore/runtime/JSObject.cpp
+++ b/JavaScriptCore/runtime/JSObject.cpp
@@ -30,6 +30,7 @@
#include "JSGlobalObject.h"
#include "NativeErrorConstructor.h"
#include "ObjectPrototype.h"
+#include "PropertyDescriptor.h"
#include "PropertyNameArray.h"
#include "Lookup.h"
#include "Nodes.h"
@@ -37,43 +38,22 @@
#include <math.h>
#include <wtf/Assertions.h>
-#define JSOBJECT_MARK_TRACING 0
-
-#if JSOBJECT_MARK_TRACING
-
-#define JSOBJECT_MARK_BEGIN() \
- static int markStackDepth = 0; \
- for (int i = 0; i < markStackDepth; i++) \
- putchar('-'); \
- printf("%s (%p)\n", className().UTF8String().c_str(), this); \
- markStackDepth++; \
-
-#define JSOBJECT_MARK_END() \
- markStackDepth--;
-
-#else // JSOBJECT_MARK_TRACING
-
-#define JSOBJECT_MARK_BEGIN()
-#define JSOBJECT_MARK_END()
-
-#endif // JSOBJECT_MARK_TRACING
-
namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(JSObject);
void JSObject::markChildren(MarkStack& markStack)
{
- JSOBJECT_MARK_BEGIN();
+#ifndef NDEBUG
+ bool wasCheckingForDefaultMarkViolation = markStack.m_isCheckingForDefaultMarkViolation;
+ markStack.m_isCheckingForDefaultMarkViolation = false;
+#endif
- JSCell::markChildren(markStack);
- m_structure->markAggregate(markStack);
+ markChildrenDirect(markStack);
- PropertyStorage storage = propertyStorage();
- size_t storageSize = m_structure->propertyStorageSize();
- markStack.appendValues(reinterpret_cast<JSValue*>(storage), storageSize);
-
- JSOBJECT_MARK_END();
+#ifndef NDEBUG
+ markStack.m_isCheckingForDefaultMarkViolation = wasCheckingForDefaultMarkViolation;
+#endif
}
UString JSObject::className() const
@@ -295,7 +275,7 @@ const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifi
return 0;
}
-void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction)
+void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
{
JSValue object = getDirect(propertyName);
if (object && object.isGetterSetter()) {
@@ -306,7 +286,7 @@ void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSO
PutPropertySlot slot;
GetterSetter* getterSetter = new (exec) GetterSetter(exec);
- putDirectInternal(exec->globalData(), propertyName, getterSetter, Getter, true, slot);
+ putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Getter, true, slot);
// putDirect will change our Structure if we add a new property. For
// getters and setters, though, we also need to change our Structure
@@ -322,7 +302,7 @@ void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSO
getterSetter->setGetter(getterFunction);
}
-void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction)
+void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
{
JSValue object = getDirect(propertyName);
if (object && object.isGetterSetter()) {
@@ -333,7 +313,7 @@ void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSO
PutPropertySlot slot;
GetterSetter* getterSetter = new (exec) GetterSetter(exec);
- putDirectInternal(exec->globalData(), propertyName, getterSetter, Setter, true, slot);
+ putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Setter, true, slot);
// putDirect will change our Structure if we add a new property. For
// getters and setters, though, we also need to change our Structure
@@ -447,6 +427,11 @@ void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyName
m_structure->getEnumerablePropertyNames(exec, propertyNames, this);
}
+void JSObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
+{
+ m_structure->getOwnEnumerablePropertyNames(exec, propertyNames, this);
+}
+
bool JSObject::toBoolean(ExecState*) const
{
return true;
@@ -486,7 +471,7 @@ JSObject* JSObject::unwrappedObject()
void JSObject::removeDirect(const Identifier& propertyName)
{
size_t offset;
- if (m_structure->isDictionary()) {
+ if (m_structure->isUncacheableDictionary()) {
offset = m_structure->removePropertyWithoutTransition(propertyName);
if (offset != WTF::notFound)
putDirectOffset(offset, jsUndefined());
@@ -528,9 +513,154 @@ void JSObject::allocatePropertyStorage(size_t oldSize, size_t newSize)
allocatePropertyStorageInline(oldSize, newSize);
}
-JSObject* constructEmptyObject(ExecState* exec)
+bool JSObject::getOwnPropertyDescriptor(ExecState*, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ unsigned attributes = 0;
+ JSCell* cell = 0;
+ size_t offset = m_structure->get(propertyName, attributes, cell);
+ if (offset == WTF::notFound)
+ return false;
+ descriptor.setDescriptor(getDirectOffset(offset), attributes);
+ return true;
+}
+
+bool JSObject::getPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
- return new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure());
+ JSObject* object = this;
+ while (true) {
+ if (object->getOwnPropertyDescriptor(exec, propertyName, descriptor))
+ return true;
+ JSValue prototype = object->prototype();
+ if (!prototype.isObject())
+ return false;
+ object = asObject(prototype);
+ }
+}
+
+static bool putDescriptor(ExecState* exec, JSObject* target, const Identifier& propertyName, PropertyDescriptor& descriptor, unsigned attributes, JSValue oldValue)
+{
+ if (descriptor.isGenericDescriptor() || descriptor.isDataDescriptor()) {
+ target->putWithAttributes(exec, propertyName, descriptor.value() ? descriptor.value() : oldValue, attributes & ~(Getter | Setter));
+ return true;
+ }
+ attributes &= ~ReadOnly;
+ if (descriptor.getter() && descriptor.getter().isObject())
+ target->defineGetter(exec, propertyName, asObject(descriptor.getter()), attributes);
+ if (exec->hadException())
+ return false;
+ if (descriptor.setter() && descriptor.setter().isObject())
+ target->defineSetter(exec, propertyName, asObject(descriptor.setter()), attributes);
+ return !exec->hadException();
+}
+
+bool JSObject::defineOwnProperty(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException)
+{
+ // If we have a new property we can just put it on normally
+ PropertyDescriptor current;
+ if (!getOwnPropertyDescriptor(exec, propertyName, current))
+ return putDescriptor(exec, this, propertyName, descriptor, descriptor.attributes(), jsUndefined());
+
+ if (descriptor.isEmpty())
+ return true;
+
+ if (current.equalTo(descriptor))
+ return true;
+
+ // Filter out invalid changes
+ if (!current.configurable()) {
+ if (descriptor.configurable()) {
+ if (throwException)
+ throwError(exec, TypeError, "Attempting to configurable attribute of unconfigurable property.");
+ return false;
+ }
+ if (descriptor.enumerablePresent() && descriptor.enumerable() != current.enumerable()) {
+ if (throwException)
+ throwError(exec, TypeError, "Attempting to change enumerable attribute of unconfigurable property.");
+ return false;
+ }
+ }
+
+ // A generic descriptor is simply changing the attributes of an existing property
+ if (descriptor.isGenericDescriptor()) {
+ if (!current.attributesEqual(descriptor)) {
+ deleteProperty(exec, propertyName);
+ putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value());
+ }
+ return true;
+ }
+
+ // Changing between a normal property or an accessor property
+ if (descriptor.isDataDescriptor() != current.isDataDescriptor()) {
+ if (!current.configurable()) {
+ if (throwException)
+ throwError(exec, TypeError, "Attempting to change access mechanism for an unconfigurable property.");
+ return false;
+ }
+ deleteProperty(exec, propertyName);
+ return putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value() ? current.value() : jsUndefined());
+ }
+
+ // Changing the value and attributes of an existing property
+ if (descriptor.isDataDescriptor()) {
+ if (!current.configurable()) {
+ if (!current.writable() && descriptor.writable()) {
+ if (throwException)
+ throwError(exec, TypeError, "Attempting to change writable attribute of unconfigurable property.");
+ return false;
+ }
+ if (!current.writable()) {
+ if (descriptor.value() || !JSValue::strictEqual(current.value(), descriptor.value())) {
+ if (throwException)
+ throwError(exec, TypeError, "Attempting to change value of a readonly property.");
+ return false;
+ }
+ }
+ } else if (current.attributesEqual(descriptor)) {
+ if (!descriptor.value())
+ return true;
+ PutPropertySlot slot;
+ put(exec, propertyName, descriptor.value(), slot);
+ if (exec->hadException())
+ return false;
+ return true;
+ }
+ deleteProperty(exec, propertyName);
+ return putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value());
+ }
+
+ // Changing the accessor functions of an existing accessor property
+ ASSERT(descriptor.isAccessorDescriptor());
+ if (!current.configurable()) {
+ if (descriptor.setterPresent() && !(current.setter() && JSValue::strictEqual(current.setter(), descriptor.setter()))) {
+ if (throwException)
+ throwError(exec, TypeError, "Attempting to change the setter of an unconfigurable property.");
+ return false;
+ }
+ if (descriptor.getterPresent() && !(current.getter() && JSValue::strictEqual(current.getter(), descriptor.getter()))) {
+ if (throwException)
+ throwError(exec, TypeError, "Attempting to change the getter of an unconfigurable property.");
+ return false;
+ }
+ }
+ JSValue accessor = getDirect(propertyName);
+ if (!accessor)
+ return false;
+ GetterSetter* getterSetter = asGetterSetter(accessor);
+ if (current.attributesEqual(descriptor)) {
+ if (descriptor.setter())
+ getterSetter->setSetter(asObject(descriptor.setter()));
+ if (descriptor.getter())
+ getterSetter->setGetter(asObject(descriptor.getter()));
+ return true;
+ }
+ deleteProperty(exec, propertyName);
+ unsigned attrs = current.attributesWithOverride(descriptor);
+ if (descriptor.setter())
+ attrs |= Setter;
+ if (descriptor.getter())
+ attrs |= Getter;
+ putDirect(propertyName, getterSetter, attrs);
+ return true;
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/JSObject.h b/JavaScriptCore/runtime/JSObject.h
index decd5e9..84b5f4b 100644
--- a/JavaScriptCore/runtime/JSObject.h
+++ b/JavaScriptCore/runtime/JSObject.h
@@ -27,7 +27,9 @@
#include "ClassInfo.h"
#include "CommonIdentifiers.h"
#include "CallFrame.h"
+#include "JSCell.h"
#include "JSNumberCell.h"
+#include "MarkStack.h"
#include "PropertySlot.h"
#include "PutPropertySlot.h"
#include "ScopeChain.h"
@@ -46,6 +48,7 @@ namespace JSC {
class HashEntry;
class InternalFunction;
+ class PropertyDescriptor;
class PropertyNameArray;
class Structure;
struct HashTable;
@@ -71,20 +74,19 @@ namespace JSC {
friend class JSCell;
public:
- explicit JSObject(PassRefPtr<Structure>);
+ explicit JSObject(NonNullPassRefPtr<Structure>);
virtual void markChildren(MarkStack&);
+ ALWAYS_INLINE void markChildrenDirect(MarkStack& markStack);
// The inline virtual destructor cannot be the first virtual function declared
// in the class as it results in the vtable being generated as a weak symbol
virtual ~JSObject();
- bool inherits(const ClassInfo* classInfo) const { return JSCell::isObject(classInfo); }
-
JSValue prototype() const;
void setPrototype(JSValue prototype);
- void setStructure(PassRefPtr<Structure>);
+ void setStructure(NonNullPassRefPtr<Structure>);
Structure* inheritorID();
virtual UString className() const;
@@ -94,9 +96,11 @@ namespace JSC {
bool getPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
bool getPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ bool getPropertyDescriptor(ExecState*, const Identifier& propertyName, PropertyDescriptor&);
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void put(ExecState*, const Identifier& propertyName, JSValue value, PutPropertySlot&);
virtual void put(ExecState*, unsigned propertyName, JSValue value);
@@ -119,6 +123,7 @@ namespace JSC {
virtual bool hasInstance(ExecState*, JSValue, JSValue prototypeProperty);
virtual void getPropertyNames(ExecState*, PropertyNameArray&);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&);
virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const;
virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value);
@@ -181,10 +186,11 @@ namespace JSC {
void fillGetterPropertySlot(PropertySlot&, JSValue* location);
- virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction);
- virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction);
+ virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes = 0);
+ virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes = 0);
virtual JSValue lookupGetter(ExecState*, const Identifier& propertyName);
virtual JSValue lookupSetter(ExecState*, const Identifier& propertyName);
+ virtual bool defineOwnProperty(ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow);
virtual bool isGlobalObject() const { return false; }
virtual bool isVariableObject() const { return false; }
@@ -201,10 +207,33 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot));
+ return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark | HasDefaultGetPropertyNames));
+ }
+
+ protected:
+ void addAnonymousSlots(unsigned count);
+ void putAnonymousValue(unsigned index, JSValue value)
+ {
+ *locationForOffset(index) = value;
+ }
+ JSValue getAnonymousValue(unsigned index)
+ {
+ return *locationForOffset(index);
}
private:
+ // Nobody should ever ask any of these questions on something already known to be a JSObject.
+ using JSCell::isAPIValueWrapper;
+ using JSCell::isGetterSetter;
+ using JSCell::toObject;
+ void getObject();
+ void getString();
+ void isObject();
+ void isString();
+#if USE(JSVALUE32)
+ void isNumber();
+#endif
+
ConstPropertyStorage propertyStorage() const { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
PropertyStorage propertyStorage() { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
@@ -235,18 +264,20 @@ namespace JSC {
RefPtr<Structure> m_inheritorID;
};
-JSObject* constructEmptyObject(ExecState*);
+inline JSObject* asObject(JSCell* cell)
+{
+ ASSERT(cell->isObject());
+ return static_cast<JSObject*>(cell);
+}
inline JSObject* asObject(JSValue value)
{
- ASSERT(asCell(value)->isObject());
- return static_cast<JSObject*>(asCell(value));
+ return asObject(value.asCell());
}
-inline JSObject::JSObject(PassRefPtr<Structure> structure)
+inline JSObject::JSObject(NonNullPassRefPtr<Structure> structure)
: JSCell(structure.releaseRef()) // ~JSObject balances this ref()
{
- ASSERT(m_structure);
ASSERT(m_structure->propertyStorageCapacity() == inlineStorageCapacity);
ASSERT(m_structure->isEmpty());
ASSERT(prototype().isNull() || Heap::heap(this) == Heap::heap(prototype()));
@@ -275,7 +306,7 @@ inline void JSObject::setPrototype(JSValue prototype)
setStructure(newStructure.release());
}
-inline void JSObject::setStructure(PassRefPtr<Structure> structure)
+inline void JSObject::setStructure(NonNullPassRefPtr<Structure> structure)
{
m_structure->deref();
m_structure = structure.releaseRef(); // ~JSObject balances this ref()
@@ -293,7 +324,7 @@ inline bool Structure::isUsingInlineStorage() const
return (propertyStorageCapacity() == JSObject::inlineStorageCapacity);
}
-inline bool JSCell::isObject(const ClassInfo* info) const
+inline bool JSCell::inherits(const ClassInfo* info) const
{
for (const ClassInfo* ci = classInfo(); ci; ci = ci->parentClass) {
if (ci == info)
@@ -302,10 +333,10 @@ inline bool JSCell::isObject(const ClassInfo* info) const
return false;
}
-// this method is here to be after the inline declaration of JSCell::isObject
-inline bool JSValue::isObject(const ClassInfo* classInfo) const
+// this method is here to be after the inline declaration of JSCell::inherits
+inline bool JSValue::inherits(const ClassInfo* classInfo) const
{
- return isCell() && asCell()->isObject(classInfo);
+ return isCell() && asCell()->inherits(classInfo);
}
ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
@@ -454,7 +485,18 @@ inline void JSObject::putDirectInternal(const Identifier& propertyName, JSValue
return;
}
+ // If we have a specific function, we may have got to this point if there is
+ // already a transition with the correct property name and attributes, but
+ // specialized to a different function. In this case we just want to give up
+ // and despecialize the transition.
+ // In this case we clear the value of specificFunction which will result
+ // in us adding a non-specific transition, and any subsequent lookup in
+ // Structure::addPropertyTransitionToExistingStructure will just use that.
+ if (specificFunction && m_structure->hasTransition(propertyName, attributes))
+ specificFunction = 0;
+
RefPtr<Structure> structure = Structure::addPropertyTransition(m_structure, propertyName, attributes, specificFunction, offset);
+
if (currentCapacity != structure->propertyStorageCapacity())
allocatePropertyStorage(currentCapacity, structure->propertyStorageCapacity());
@@ -480,6 +522,17 @@ inline void JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi
putDirectInternal(propertyName, value, attributes, false, slot, getJSFunction(globalData, value));
}
+inline void JSObject::addAnonymousSlots(unsigned count)
+{
+ size_t currentCapacity = m_structure->propertyStorageCapacity();
+ RefPtr<Structure> structure = Structure::addAnonymousSlotsTransition(m_structure, count);
+
+ if (currentCapacity != structure->propertyStorageCapacity())
+ allocatePropertyStorage(currentCapacity, structure->propertyStorageCapacity());
+
+ setStructure(structure.release());
+}
+
inline void JSObject::putDirect(const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
{
ASSERT(value);
@@ -555,8 +608,7 @@ inline JSValue JSValue::get(ExecState* exec, const Identifier& propertyName, Pro
while (true) {
if (cell->fastGetOwnPropertySlot(exec, propertyName, slot))
return slot.getValue(exec, propertyName);
- ASSERT(cell->isObject());
- JSValue prototype = static_cast<JSObject*>(cell)->prototype();
+ JSValue prototype = asObject(cell)->prototype();
if (!prototype.isObject())
return jsUndefined();
cell = asObject(prototype);
@@ -581,8 +633,7 @@ inline JSValue JSValue::get(ExecState* exec, unsigned propertyName, PropertySlot
while (true) {
if (cell->getOwnPropertySlot(exec, propertyName, slot))
return slot.getValue(exec, propertyName);
- ASSERT(cell->isObject());
- JSValue prototype = static_cast<JSObject*>(cell)->prototype();
+ JSValue prototype = asObject(cell)->prototype();
if (!prototype.isObject())
return jsUndefined();
cell = prototype.asCell();
@@ -627,6 +678,17 @@ ALWAYS_INLINE void JSObject::allocatePropertyStorageInline(size_t oldSize, size_
m_externalStorage = newPropertyStorage;
}
+ALWAYS_INLINE void JSObject::markChildrenDirect(MarkStack& markStack)
+{
+ JSCell::markChildren(markStack);
+
+ m_structure->markAggregate(markStack);
+
+ PropertyStorage storage = propertyStorage();
+ size_t storageSize = m_structure->propertyStorageSize();
+ markStack.appendValues(reinterpret_cast<JSValue*>(storage), storageSize);
+}
+
} // namespace JSC
#endif // JSObject_h
diff --git a/JavaScriptCore/runtime/JSPropertyNameIterator.cpp b/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
index dc0304f..e08a3d9 100644
--- a/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
+++ b/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
@@ -37,42 +37,6 @@ JSPropertyNameIterator::~JSPropertyNameIterator()
{
}
-JSValue JSPropertyNameIterator::toPrimitive(ExecState*, PreferredPrimitiveType) const
-{
- ASSERT_NOT_REACHED();
- return JSValue();
-}
-
-bool JSPropertyNameIterator::getPrimitiveNumber(ExecState*, double&, JSValue&)
-{
- ASSERT_NOT_REACHED();
- return false;
-}
-
-bool JSPropertyNameIterator::toBoolean(ExecState*) const
-{
- ASSERT_NOT_REACHED();
- return false;
-}
-
-double JSPropertyNameIterator::toNumber(ExecState*) const
-{
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-UString JSPropertyNameIterator::toString(ExecState*) const
-{
- ASSERT_NOT_REACHED();
- return "";
-}
-
-JSObject* JSPropertyNameIterator::toObject(ExecState*) const
-{
- ASSERT_NOT_REACHED();
- return 0;
-}
-
void JSPropertyNameIterator::markChildren(MarkStack& markStack)
{
JSCell::markChildren(markStack);
diff --git a/JavaScriptCore/runtime/JSPropertyNameIterator.h b/JavaScriptCore/runtime/JSPropertyNameIterator.h
index 4534528..d2849a8 100644
--- a/JavaScriptCore/runtime/JSPropertyNameIterator.h
+++ b/JavaScriptCore/runtime/JSPropertyNameIterator.h
@@ -44,13 +44,6 @@ namespace JSC {
virtual ~JSPropertyNameIterator();
- virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
- virtual bool getPrimitiveNumber(ExecState*, double&, JSValue&);
- virtual bool toBoolean(ExecState*) const;
- virtual double toNumber(ExecState*) const;
- virtual UString toString(ExecState*) const;
- virtual JSObject* toObject(ExecState*) const;
-
virtual void markChildren(MarkStack&);
JSValue next(ExecState*);
diff --git a/JavaScriptCore/runtime/JSString.cpp b/JavaScriptCore/runtime/JSString.cpp
index 86f95e0..91ddaeb 100644
--- a/JavaScriptCore/runtime/JSString.cpp
+++ b/JavaScriptCore/runtime/JSString.cpp
@@ -103,6 +103,33 @@ bool JSString::getOwnPropertySlot(ExecState* exec, const Identifier& propertyNam
return true;
}
+bool JSString::getStringPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ if (propertyName == exec->propertyNames().length) {
+ descriptor.setDescriptor(jsNumber(exec, m_value.size()), DontEnum | DontDelete | ReadOnly);
+ return true;
+ }
+
+ bool isStrictUInt32;
+ unsigned i = propertyName.toStrictUInt32(&isStrictUInt32);
+ if (isStrictUInt32 && i < static_cast<unsigned>(m_value.size())) {
+ descriptor.setDescriptor(jsSingleCharacterSubstring(exec, m_value, i), DontDelete | ReadOnly);
+ return true;
+ }
+
+ return false;
+}
+
+bool JSString::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ if (getStringPropertyDescriptor(exec, propertyName, descriptor))
+ return true;
+ if (propertyName != exec->propertyNames().underscoreProto)
+ return false;
+ descriptor.setDescriptor(exec->lexicalGlobalObject()->stringPrototype(), DontEnum);
+ return true;
+}
+
bool JSString::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
{
// The semantics here are really getPropertySlot, not getOwnPropertySlot.
diff --git a/JavaScriptCore/runtime/JSString.h b/JavaScriptCore/runtime/JSString.h
index 3daf58a..1e46551 100644
--- a/JavaScriptCore/runtime/JSString.h
+++ b/JavaScriptCore/runtime/JSString.h
@@ -27,6 +27,7 @@
#include "CommonIdentifiers.h"
#include "Identifier.h"
#include "JSNumberCell.h"
+#include "PropertyDescriptor.h"
#include "PropertySlot.h"
namespace JSC {
@@ -86,11 +87,12 @@ namespace JSC {
bool getStringPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
bool getStringPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ bool getStringPropertyDescriptor(ExecState*, const Identifier& propertyName, PropertyDescriptor&);
bool canGetIndex(unsigned i) { return i < static_cast<unsigned>(m_value.size()); }
JSString* getIndex(JSGlobalData*, unsigned);
- static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(StringType, NeedsThisConversion)); }
+ static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(StringType, NeedsThisConversion | HasDefaultMark)); }
private:
enum VPtrStealingHackType { VPtrStealingHack };
@@ -113,6 +115,7 @@ namespace JSC {
// Actually getPropertySlot, not getOwnPropertySlot (see JSCell).
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
UString m_value;
};
@@ -211,6 +214,26 @@ namespace JSC {
return isCell() ? asCell()->toThisJSString(exec) : jsString(exec, toString(exec));
}
+ inline UString JSValue::toString(ExecState* exec) const
+ {
+ if (isString())
+ return static_cast<JSString*>(asCell())->value();
+ if (isInt32())
+ return exec->globalData().numericStrings.add(asInt32());
+ if (isDouble())
+ return exec->globalData().numericStrings.add(asDouble());
+ if (isTrue())
+ return "true";
+ if (isFalse())
+ return "false";
+ if (isNull())
+ return "null";
+ if (isUndefined())
+ return "undefined";
+ ASSERT(isCell());
+ return asCell()->toString(exec);
+ }
+
} // namespace JSC
#endif // JSString_h
diff --git a/JavaScriptCore/runtime/JSType.h b/JavaScriptCore/runtime/JSType.h
index a118b87..882b218 100644
--- a/JavaScriptCore/runtime/JSType.h
+++ b/JavaScriptCore/runtime/JSType.h
@@ -33,7 +33,6 @@ namespace JSC {
NumberType = 3,
NullType = 4,
StringType = 5,
-
// The CompoundType value must come before any JSType that may have children
CompoundType = 6,
ObjectType = 7,
diff --git a/JavaScriptCore/runtime/TypeInfo.h b/JavaScriptCore/runtime/JSTypeInfo.h
index 70aeed3..279510b 100644
--- a/JavaScriptCore/runtime/TypeInfo.h
+++ b/JavaScriptCore/runtime/JSTypeInfo.h
@@ -24,8 +24,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef TypeInfo_h
-#define TypeInfo_h
+#ifndef JSTypeInfo_h
+#define JSTypeInfo_h
+
+// This file would be called TypeInfo.h, but that conflicts with <typeinfo.h>
+// in the STL on systems without case-sensitive file systems.
#include "JSType.h"
@@ -38,6 +41,8 @@ namespace JSC {
static const unsigned ImplementsDefaultHasInstance = 1 << 3;
static const unsigned NeedsThisConversion = 1 << 4;
static const unsigned HasStandardGetOwnPropertySlot = 1 << 5;
+ static const unsigned HasDefaultMark = 1 << 6;
+ static const unsigned HasDefaultGetPropertyNames = 1 << 7;
class TypeInfo {
friend class JIT;
@@ -59,7 +64,8 @@ namespace JSC {
bool overridesHasInstance() const { return m_flags & OverridesHasInstance; }
bool needsThisConversion() const { return m_flags & NeedsThisConversion; }
bool hasStandardGetOwnPropertySlot() const { return m_flags & HasStandardGetOwnPropertySlot; }
-
+ bool hasDefaultMark() const { return m_flags & HasDefaultMark; }
+ bool hasDefaultGetPropertyNames() const { return m_flags & HasDefaultGetPropertyNames; }
unsigned flags() const { return m_flags; }
private:
@@ -69,4 +75,4 @@ namespace JSC {
}
-#endif // TypeInfo_h
+#endif // JSTypeInfo_h
diff --git a/JavaScriptCore/runtime/JSValue.cpp b/JavaScriptCore/runtime/JSValue.cpp
index 39a4093..699c1cd 100644
--- a/JavaScriptCore/runtime/JSValue.cpp
+++ b/JavaScriptCore/runtime/JSValue.cpp
@@ -110,7 +110,10 @@ char* JSValue::description()
{
static const size_t size = 32;
static char description[size];
- if (isInt32())
+
+ if (!*this)
+ snprintf(description, size, "<JSValue()>");
+ else if (isInt32())
snprintf(description, size, "Int32: %d", asInt32());
else if (isDouble())
snprintf(description, size, "Double: %lf", asDouble());
diff --git a/JavaScriptCore/runtime/JSValue.h b/JavaScriptCore/runtime/JSValue.h
index 408c187..3c511d8 100644
--- a/JavaScriptCore/runtime/JSValue.h
+++ b/JavaScriptCore/runtime/JSValue.h
@@ -20,15 +20,14 @@
*
*/
-#include <stddef.h> // for size_t
-#include <stdint.h>
-
#ifndef JSValue_h
#define JSValue_h
#include "CallData.h"
#include "ConstructData.h"
#include <math.h>
+#include <stddef.h> // for size_t
+#include <stdint.h>
#include <wtf/AlwaysInline.h>
#include <wtf/Assertions.h>
#include <wtf/HashTraits.h>
@@ -42,7 +41,6 @@ namespace JSC {
class JSImmediate;
class JSObject;
class JSString;
- class MarkStack;
class PropertySlot;
class PutPropertySlot;
class UString;
@@ -130,7 +128,7 @@ namespace JSC {
bool isString() const;
bool isGetterSetter() const;
bool isObject() const;
- bool isObject(const ClassInfo*) const;
+ bool inherits(const ClassInfo*) const;
// Extracting the value.
bool getBoolean(bool&) const;
@@ -172,12 +170,6 @@ namespace JSC {
// signle precision float is not a representation used in JS or JSC).
float toFloat(ExecState* exec) const { return static_cast<float>(toNumber(exec)); }
- // Garbage collection.
- void markChildren(MarkStack&);
- bool hasChildren() const;
- bool marked() const;
- void markDirect();
-
// Object operations, with the toObject operation included.
JSValue get(ExecState*, const Identifier& propertyName) const;
JSValue get(ExecState*, const Identifier& propertyName, PropertySlot&) const;
@@ -221,7 +213,8 @@ namespace JSC {
enum { FalseTag = 0xfffffffc };
enum { NullTag = 0xfffffffb };
enum { UndefinedTag = 0xfffffffa };
- enum { DeletedValueTag = 0xfffffff9 };
+ enum { EmptyValueTag = 0xfffffff9 };
+ enum { DeletedValueTag = 0xfffffff8 };
enum { LowestTag = DeletedValueTag };
@@ -435,7 +428,7 @@ namespace JSC {
inline JSValue::JSValue()
{
- u.asBits.tag = CellTag;
+ u.asBits.tag = EmptyValueTag;
u.asBits.payload = 0;
}
@@ -471,19 +464,26 @@ namespace JSC {
inline JSValue::JSValue(JSCell* ptr)
{
- u.asBits.tag = CellTag;
+ if (ptr)
+ u.asBits.tag = CellTag;
+ else
+ u.asBits.tag = EmptyValueTag;
u.asBits.payload = reinterpret_cast<int32_t>(ptr);
}
inline JSValue::JSValue(const JSCell* ptr)
{
- u.asBits.tag = CellTag;
+ if (ptr)
+ u.asBits.tag = CellTag;
+ else
+ u.asBits.tag = EmptyValueTag;
u.asBits.payload = reinterpret_cast<int32_t>(const_cast<JSCell*>(ptr));
}
inline JSValue::operator bool() const
{
- return u.asBits.payload || tag() != CellTag;
+ ASSERT(tag() != DeletedValueTag);
+ return tag() != EmptyValueTag;
}
inline bool JSValue::operator==(const JSValue& other) const
diff --git a/JavaScriptCore/runtime/JSVariableObject.cpp b/JavaScriptCore/runtime/JSVariableObject.cpp
index a36cefa..6586393 100644
--- a/JavaScriptCore/runtime/JSVariableObject.cpp
+++ b/JavaScriptCore/runtime/JSVariableObject.cpp
@@ -30,6 +30,7 @@
#include "JSVariableObject.h"
#include "PropertyNameArray.h"
+#include "PropertyDescriptor.h"
namespace JSC {
@@ -41,7 +42,7 @@ bool JSVariableObject::deleteProperty(ExecState* exec, const Identifier& propert
return JSObject::deleteProperty(exec, propertyName);
}
-void JSVariableObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
+void JSVariableObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
{
SymbolTable::const_iterator end = symbolTable().end();
for (SymbolTable::const_iterator it = symbolTable().begin(); it != end; ++it) {
@@ -49,7 +50,7 @@ void JSVariableObject::getPropertyNames(ExecState* exec, PropertyNameArray& prop
propertyNames.add(Identifier(exec, it->first.get()));
}
- JSObject::getPropertyNames(exec, propertyNames);
+ JSObject::getOwnPropertyNames(exec, propertyNames);
}
bool JSVariableObject::getPropertyAttributes(ExecState* exec, const Identifier& propertyName, unsigned& attributes) const
@@ -67,4 +68,14 @@ bool JSVariableObject::isVariableObject() const
return true;
}
+bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ SymbolTableEntry entry = symbolTable().inlineGet(propertyName.ustring().rep());
+ if (!entry.isNull()) {
+ descriptor.setDescriptor(registerAt(entry.getIndex()).jsValue(), entry.getAttributes() | DontDelete);
+ return true;
+ }
+ return false;
+}
+
} // namespace JSC
diff --git a/JavaScriptCore/runtime/JSVariableObject.h b/JavaScriptCore/runtime/JSVariableObject.h
index b969da5..66e78c3 100644
--- a/JavaScriptCore/runtime/JSVariableObject.h
+++ b/JavaScriptCore/runtime/JSVariableObject.h
@@ -49,7 +49,7 @@ namespace JSC {
virtual void putWithAttributes(ExecState*, const Identifier&, JSValue, unsigned attributes) = 0;
virtual bool deleteProperty(ExecState*, const Identifier&);
- virtual void getPropertyNames(ExecState*, PropertyNameArray&);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&);
virtual bool isVariableObject() const;
virtual bool isDynamicScope() const = 0;
@@ -58,6 +58,11 @@ namespace JSC {
Register& registerAt(int index) const { return d->registers[index]; }
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark));
+ }
+
protected:
// Subclasses of JSVariableObject can subclass this struct to add data
// without increasing their own size (since there's a hard limit on the
@@ -79,7 +84,7 @@ namespace JSC {
JSVariableObjectData& operator=(const JSVariableObjectData&);
};
- JSVariableObject(PassRefPtr<Structure> structure, JSVariableObjectData* data)
+ JSVariableObject(NonNullPassRefPtr<Structure> structure, JSVariableObjectData* data)
: JSObject(structure)
, d(data) // Subclass owns this pointer.
{
@@ -89,6 +94,7 @@ namespace JSC {
void setRegisters(Register* r, Register* registerArray);
bool symbolTableGet(const Identifier&, PropertySlot&);
+ bool symbolTableGet(const Identifier&, PropertyDescriptor&);
bool symbolTableGet(const Identifier&, PropertySlot&, bool& slotIsWriteable);
bool symbolTablePut(const Identifier&, JSValue);
bool symbolTablePutWithAttributes(const Identifier&, JSValue, unsigned attributes);
diff --git a/JavaScriptCore/runtime/JSWrapperObject.h b/JavaScriptCore/runtime/JSWrapperObject.h
index 0b2c680..723b75d 100644
--- a/JavaScriptCore/runtime/JSWrapperObject.h
+++ b/JavaScriptCore/runtime/JSWrapperObject.h
@@ -25,33 +25,41 @@
#include "JSObject.h"
namespace JSC {
-
+
// This class is used as a base for classes such as String,
// Number, Boolean and Date which are wrappers for primitive types.
class JSWrapperObject : public JSObject {
protected:
- explicit JSWrapperObject(PassRefPtr<Structure>);
+ explicit JSWrapperObject(NonNullPassRefPtr<Structure>);
public:
JSValue internalValue() const { return m_internalValue; }
void setInternalValue(JSValue);
-
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultGetPropertyNames | HasDefaultMark));
+ }
+
+ private:
virtual void markChildren(MarkStack&);
- private:
JSValue m_internalValue;
};
-
- inline JSWrapperObject::JSWrapperObject(PassRefPtr<Structure> structure)
+
+ inline JSWrapperObject::JSWrapperObject(NonNullPassRefPtr<Structure> structure)
: JSObject(structure)
{
+ addAnonymousSlots(1);
+ putAnonymousValue(0, jsNull());
}
-
+
inline void JSWrapperObject::setInternalValue(JSValue value)
{
ASSERT(value);
ASSERT(!value.isObject());
m_internalValue = value;
+ putAnonymousValue(0, value);
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/LiteralParser.cpp b/JavaScriptCore/runtime/LiteralParser.cpp
index 17ec906..d242282 100644
--- a/JavaScriptCore/runtime/LiteralParser.cpp
+++ b/JavaScriptCore/runtime/LiteralParser.cpp
@@ -295,7 +295,10 @@ JSValue LiteralParser::parse(ParserState initialState)
}
doParseArrayStartExpression:
case DoParseArrayStartExpression: {
+ TokenType lastToken = m_lexer.currentToken().type;
if (m_lexer.next() == TokRBracket) {
+ if (lastToken == TokComma)
+ return JSValue();
m_lexer.next();
lastValue = objectStack.last();
objectStack.removeLast();
diff --git a/JavaScriptCore/runtime/LiteralParser.h b/JavaScriptCore/runtime/LiteralParser.h
index bceee7c..0f8072b 100644
--- a/JavaScriptCore/runtime/LiteralParser.h
+++ b/JavaScriptCore/runtime/LiteralParser.h
@@ -89,7 +89,7 @@ namespace JSC {
private:
TokenType lex(LiteralParserToken&);
- template <ParserMode parserMode> TokenType lexString(LiteralParserToken&);
+ template <ParserMode mode> TokenType lexString(LiteralParserToken&);
TokenType lexNumber(LiteralParserToken&);
LiteralParserToken m_currentToken;
UString m_string;
diff --git a/JavaScriptCore/runtime/Lookup.h b/JavaScriptCore/runtime/Lookup.h
index 167f2bc..4d70689 100644
--- a/JavaScriptCore/runtime/Lookup.h
+++ b/JavaScriptCore/runtime/Lookup.h
@@ -51,7 +51,7 @@ namespace JSC {
typedef PropertySlot::GetValueFunc GetFunction;
typedef void (*PutFunction)(ExecState*, JSObject* baseObject, JSValue value);
- class HashEntry {
+ class HashEntry : public FastAllocBase {
public:
void initialize(UString::Rep* key, unsigned char attributes, intptr_t v1, intptr_t v2)
{
@@ -186,6 +186,24 @@ namespace JSC {
return true;
}
+ template <class ThisImp, class ParentImp>
+ inline bool getStaticPropertyDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertyDescriptor& descriptor)
+ {
+ const HashEntry* entry = table->entry(exec, propertyName);
+
+ if (!entry) // not found, forward to parent
+ return thisObj->ParentImp::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+
+ PropertySlot slot;
+ if (entry->attributes() & Function)
+ setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);
+ else
+ slot.setCustom(thisObj, entry->propertyGetter());
+
+ descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
+ return true;
+ }
+
/**
* Simplified version of getStaticPropertySlot in case there are only functions.
* Using this instead of getStaticPropertySlot allows 'this' to avoid implementing
@@ -204,6 +222,27 @@ namespace JSC {
setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);
return true;
}
+
+ /**
+ * Simplified version of getStaticPropertyDescriptor in case there are only functions.
+ * Using this instead of getStaticPropertyDescriptor allows 'this' to avoid implementing
+ * a dummy getValueProperty.
+ */
+ template <class ParentImp>
+ inline bool getStaticFunctionDescriptor(ExecState* exec, const HashTable* table, JSObject* thisObj, const Identifier& propertyName, PropertyDescriptor& descriptor)
+ {
+ if (static_cast<ParentImp*>(thisObj)->ParentImp::getOwnPropertyDescriptor(exec, propertyName, descriptor))
+ return true;
+
+ const HashEntry* entry = table->entry(exec, propertyName);
+ if (!entry)
+ return false;
+
+ PropertySlot slot;
+ setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);
+ descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
+ return true;
+ }
/**
* Simplified version of getStaticPropertySlot in case there are no functions, only "values".
@@ -224,6 +263,25 @@ namespace JSC {
}
/**
+ * Simplified version of getStaticPropertyDescriptor in case there are no functions, only "values".
+ * Using this instead of getStaticPropertyDescriptor removes the need for a FuncImp class.
+ */
+ template <class ThisImp, class ParentImp>
+ inline bool getStaticValueDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertyDescriptor& descriptor)
+ {
+ const HashEntry* entry = table->entry(exec, propertyName);
+
+ if (!entry) // not found, forward to parent
+ return thisObj->ParentImp::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+
+ ASSERT(!(entry->attributes() & Function));
+ PropertySlot slot;
+ slot.setCustom(thisObj, entry->propertyGetter());
+ descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
+ return true;
+ }
+
+ /**
* This one is for "put".
* It looks up a hash entry for the property to be set. If an entry
* is found it sets the value and returns true, else it returns false.
diff --git a/JavaScriptCore/runtime/MarkStack.cpp b/JavaScriptCore/runtime/MarkStack.cpp
index 80dbb17..a350c35 100644
--- a/JavaScriptCore/runtime/MarkStack.cpp
+++ b/JavaScriptCore/runtime/MarkStack.cpp
@@ -26,8 +26,7 @@
#include "config.h"
#include "MarkStack.h"
-namespace JSC
-{
+namespace JSC {
size_t MarkStack::s_pageSize = 0;
diff --git a/JavaScriptCore/runtime/MarkStack.h b/JavaScriptCore/runtime/MarkStack.h
index 7a7b3af..ba00057 100644
--- a/JavaScriptCore/runtime/MarkStack.h
+++ b/JavaScriptCore/runtime/MarkStack.h
@@ -27,33 +27,27 @@
#define MarkStack_h
#include "JSValue.h"
-
#include <wtf/Noncopyable.h>
namespace JSC {
+
+ class JSGlobalData;
class Register;
enum MarkSetProperties { MayContainNullValues, NoNullValues };
class MarkStack : Noncopyable {
public:
- MarkStack()
- : m_markSets()
- , m_values()
- {
- }
-
- ALWAYS_INLINE void append(JSValue value)
+ MarkStack(void* jsArrayVPtr)
+ : m_jsArrayVPtr(jsArrayVPtr)
+#ifndef NDEBUG
+ , m_isCheckingForDefaultMarkViolation(false)
+#endif
{
- ASSERT(value);
- if (value.marked())
- return;
- value.markDirect();
- if (value.hasChildren())
- m_values.append(value.asCell());
}
- ALWAYS_INLINE void append(JSCell* cell);
+ ALWAYS_INLINE void append(JSValue);
+ ALWAYS_INLINE void append(JSCell*);
ALWAYS_INLINE void appendValues(Register* values, size_t count, MarkSetProperties properties = NoNullValues)
{
@@ -76,12 +70,15 @@ namespace JSC {
}
private:
+ void markChildren(JSCell*);
+
struct MarkSet {
MarkSet(JSValue* values, JSValue* end, MarkSetProperties properties)
: m_values(values)
, m_end(end)
, m_properties(properties)
{
+ ASSERT(values);
}
JSValue* m_values;
JSValue* m_end;
@@ -136,6 +133,12 @@ namespace JSC {
ASSERT(m_top);
return m_data[--m_top];
}
+
+ inline T& last()
+ {
+ ASSERT(m_top);
+ return m_data[m_top - 1];
+ }
inline bool isEmpty()
{
@@ -150,7 +153,14 @@ namespace JSC {
ASSERT(0 == (size % MarkStack::pageSize()));
if (size == m_allocated)
return;
+#if PLATFORM(WIN) || PLATFORM(SYMBIAN)
+ // We cannot release a part of a region with VirtualFree. To get around this,
+ // we'll release the entire region and reallocate the size that we want.
+ releaseStack(m_data, m_allocated);
+ m_data = reinterpret_cast<T*>(allocateStack(size));
+#else
releaseStack(reinterpret_cast<char*>(m_data) + size, m_allocated - size);
+#endif
m_allocated = size;
m_capacity = m_allocated / sizeof(T);
}
@@ -162,9 +172,15 @@ namespace JSC {
T* m_data;
};
+ void* m_jsArrayVPtr;
MarkStackArray<MarkSet> m_markSets;
MarkStackArray<JSCell*> m_values;
static size_t s_pageSize;
+
+#ifndef NDEBUG
+ public:
+ bool m_isCheckingForDefaultMarkViolation;
+#endif
};
}
diff --git a/JavaScriptCore/runtime/MarkStackSymbian.cpp b/JavaScriptCore/runtime/MarkStackSymbian.cpp
new file mode 100644
index 0000000..a0ce8f6
--- /dev/null
+++ b/JavaScriptCore/runtime/MarkStackSymbian.cpp
@@ -0,0 +1,44 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "MarkStack.h"
+
+#include <e32hal.h>
+
+namespace JSC {
+
+void MarkStack::initializePagesize()
+{
+ TInt page_size;
+ UserHal::PageSizeInBytes(page_size);
+ MarkStack::s_pageSize = page_size;
+}
+
+void* MarkStack::allocateStack(size_t size)
+{
+ return fastMalloc(size);
+}
+
+void MarkStack::releaseStack(void* addr, size_t size)
+{
+ return fastFree(addr);
+}
+
+}
diff --git a/JavaScriptCore/runtime/MarkStackWin.cpp b/JavaScriptCore/runtime/MarkStackWin.cpp
index dbc3306..1fdd06a 100644
--- a/JavaScriptCore/runtime/MarkStackWin.cpp
+++ b/JavaScriptCore/runtime/MarkStackWin.cpp
@@ -43,9 +43,11 @@ void* MarkStack::allocateStack(size_t size)
{
return VirtualAlloc(0, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
}
-void MarkStack::releaseStack(void* addr, size_t size)
+void MarkStack::releaseStack(void* addr, size_t)
{
- VirtualFree(addr, size, MEM_RELEASE);
+ // According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx,
+ // dwSize must be 0 if dwFreeType is MEM_RELEASE.
+ VirtualFree(addr, 0, MEM_RELEASE);
}
}
diff --git a/JavaScriptCore/runtime/MathObject.cpp b/JavaScriptCore/runtime/MathObject.cpp
index 2572bc9..e8b7b97 100644
--- a/JavaScriptCore/runtime/MathObject.cpp
+++ b/JavaScriptCore/runtime/MathObject.cpp
@@ -85,7 +85,7 @@ const ClassInfo MathObject::info = { "Math", 0, 0, ExecState::mathTable };
@end
*/
-MathObject::MathObject(ExecState* exec, PassRefPtr<Structure> structure)
+MathObject::MathObject(ExecState* exec, NonNullPassRefPtr<Structure> structure)
: JSObject(structure)
{
putDirectWithoutTransition(Identifier(exec, "E"), jsNumber(exec, exp(1.0)), DontDelete | DontEnum | ReadOnly);
@@ -103,14 +103,12 @@ MathObject::MathObject(ExecState* exec, PassRefPtr<Structure> structure)
bool MathObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
{
- const HashEntry* entry = ExecState::mathTable(exec)->entry(exec, propertyName);
-
- if (!entry)
- return JSObject::getOwnPropertySlot(exec, propertyName, slot);
+ return getStaticFunctionSlot<JSObject>(exec, ExecState::mathTable(exec), this, propertyName, slot);
+}
- ASSERT(entry->attributes() & Function);
- setUpStaticFunctionSlot(exec, entry, this, propertyName, slot);
- return true;
+bool MathObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticFunctionDescriptor<JSObject>(exec, ExecState::mathTable(exec), this, propertyName, descriptor);
}
// ------------------------------ Functions --------------------------------
diff --git a/JavaScriptCore/runtime/MathObject.h b/JavaScriptCore/runtime/MathObject.h
index 3557d1e..fee5ec5 100644
--- a/JavaScriptCore/runtime/MathObject.h
+++ b/JavaScriptCore/runtime/MathObject.h
@@ -27,16 +27,17 @@ namespace JSC {
class MathObject : public JSObject {
public:
- MathObject(ExecState*, PassRefPtr<Structure>);
+ MathObject(ExecState*, NonNullPassRefPtr<Structure>);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType));
+ return Structure::create(prototype, TypeInfo(ObjectType, HasDefaultMark | HasDefaultGetPropertyNames));
}
};
diff --git a/JavaScriptCore/runtime/NativeErrorConstructor.cpp b/JavaScriptCore/runtime/NativeErrorConstructor.cpp
index 0205fc5..c655fae 100644
--- a/JavaScriptCore/runtime/NativeErrorConstructor.cpp
+++ b/JavaScriptCore/runtime/NativeErrorConstructor.cpp
@@ -32,7 +32,7 @@ ASSERT_CLASS_FITS_IN_CELL(NativeErrorConstructor);
const ClassInfo NativeErrorConstructor::info = { "Function", &InternalFunction::info, 0, 0 };
-NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, PassRefPtr<Structure> structure, NativeErrorPrototype* nativeErrorPrototype)
+NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, NativeErrorPrototype* nativeErrorPrototype)
: InternalFunction(&exec->globalData(), structure, Identifier(exec, nativeErrorPrototype->getDirect(exec->propertyNames().name).getString()))
, m_errorStructure(ErrorInstance::createStructure(nativeErrorPrototype))
{
diff --git a/JavaScriptCore/runtime/NativeErrorConstructor.h b/JavaScriptCore/runtime/NativeErrorConstructor.h
index 118d1f4..152dbac 100644
--- a/JavaScriptCore/runtime/NativeErrorConstructor.h
+++ b/JavaScriptCore/runtime/NativeErrorConstructor.h
@@ -31,7 +31,7 @@ namespace JSC {
class NativeErrorConstructor : public InternalFunction {
public:
- NativeErrorConstructor(ExecState*, PassRefPtr<Structure>, NativeErrorPrototype*);
+ NativeErrorConstructor(ExecState*, NonNullPassRefPtr<Structure>, NativeErrorPrototype*);
static const ClassInfo info;
diff --git a/JavaScriptCore/runtime/NativeErrorPrototype.cpp b/JavaScriptCore/runtime/NativeErrorPrototype.cpp
index 84190a0..aa46a6a 100644
--- a/JavaScriptCore/runtime/NativeErrorPrototype.cpp
+++ b/JavaScriptCore/runtime/NativeErrorPrototype.cpp
@@ -29,7 +29,7 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(NativeErrorPrototype);
-NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, PassRefPtr<Structure> structure, const UString& name, const UString& message)
+NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, const UString& name, const UString& message)
: JSObject(structure)
{
putDirect(exec->propertyNames().name, jsString(exec, name), 0);
diff --git a/JavaScriptCore/runtime/NativeErrorPrototype.h b/JavaScriptCore/runtime/NativeErrorPrototype.h
index 77bfe8a..0c65a9c 100644
--- a/JavaScriptCore/runtime/NativeErrorPrototype.h
+++ b/JavaScriptCore/runtime/NativeErrorPrototype.h
@@ -27,7 +27,7 @@ namespace JSC {
class NativeErrorPrototype : public JSObject {
public:
- NativeErrorPrototype(ExecState*, PassRefPtr<Structure>, const UString& name, const UString& message);
+ NativeErrorPrototype(ExecState*, NonNullPassRefPtr<Structure>, const UString& name, const UString& message);
};
} // namespace JSC
diff --git a/JavaScriptCore/runtime/NumberConstructor.cpp b/JavaScriptCore/runtime/NumberConstructor.cpp
index 2840bf0..cc6c51d 100644
--- a/JavaScriptCore/runtime/NumberConstructor.cpp
+++ b/JavaScriptCore/runtime/NumberConstructor.cpp
@@ -53,7 +53,7 @@ const ClassInfo NumberConstructor::info = { "Function", &InternalFunction::info,
@end
*/
-NumberConstructor::NumberConstructor(ExecState* exec, PassRefPtr<Structure> structure, NumberPrototype* numberPrototype)
+NumberConstructor::NumberConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, NumberPrototype* numberPrototype)
: InternalFunction(&exec->globalData(), structure, Identifier(exec, numberPrototype->info.className))
{
// Number.Prototype
@@ -68,6 +68,11 @@ bool NumberConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& pr
return getStaticValueSlot<NumberConstructor, InternalFunction>(exec, ExecState::numberTable(exec), this, propertyName, slot);
}
+bool NumberConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<NumberConstructor, InternalFunction>(exec, ExecState::numberTable(exec), this, propertyName, descriptor);
+}
+
static JSValue numberConstructorNaNValue(ExecState* exec, const Identifier&, const PropertySlot&)
{
return jsNaN(exec);
diff --git a/JavaScriptCore/runtime/NumberConstructor.h b/JavaScriptCore/runtime/NumberConstructor.h
index b1224ec..908c55f 100644
--- a/JavaScriptCore/runtime/NumberConstructor.h
+++ b/JavaScriptCore/runtime/NumberConstructor.h
@@ -29,16 +29,17 @@ namespace JSC {
class NumberConstructor : public InternalFunction {
public:
- NumberConstructor(ExecState*, PassRefPtr<Structure>, NumberPrototype*);
+ NumberConstructor(ExecState*, NonNullPassRefPtr<Structure>, NumberPrototype*);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
JSValue getValueProperty(ExecState*, int token) const;
static const ClassInfo info;
static PassRefPtr<Structure> createStructure(JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance));
+ return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasDefaultMark | HasDefaultGetPropertyNames));
}
enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue };
diff --git a/JavaScriptCore/runtime/NumberObject.cpp b/JavaScriptCore/runtime/NumberObject.cpp
index 0e8df17..1a7e44c 100644
--- a/JavaScriptCore/runtime/NumberObject.cpp
+++ b/JavaScriptCore/runtime/NumberObject.cpp
@@ -31,7 +31,7 @@ ASSERT_CLASS_FITS_IN_CELL(NumberObject);
const ClassInfo NumberObject::info = { "Number", 0, 0, 0 };
-NumberObject::NumberObject(PassRefPtr<Structure> structure)
+NumberObject::NumberObject(NonNullPassRefPtr<Structure> structure)
: JSWrapperObject(structure)
{
}
diff --git a/JavaScriptCore/runtime/NumberObject.h b/JavaScriptCore/runtime/NumberObject.h
index d354b9b..ca3923d 100644
--- a/JavaScriptCore/runtime/NumberObject.h
+++ b/JavaScriptCore/runtime/NumberObject.h
@@ -27,10 +27,20 @@ namespace JSC {
class NumberObject : public JSWrapperObject {
public:
- explicit NumberObject(PassRefPtr<Structure>);
+ explicit NumberObject(NonNullPassRefPtr<Structure>);
static const ClassInfo info;
-
+#if USE(JSVALUE32)
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultGetPropertyNames));
+ }
+#else
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark | HasDefaultGetPropertyNames));
+ }
+#endif
private:
virtual const ClassInfo* classInfo() const { return &info; }
diff --git a/JavaScriptCore/runtime/NumberPrototype.cpp b/JavaScriptCore/runtime/NumberPrototype.cpp
index 947324c..df31404 100644
--- a/JavaScriptCore/runtime/NumberPrototype.cpp
+++ b/JavaScriptCore/runtime/NumberPrototype.cpp
@@ -45,7 +45,7 @@ static JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*, JSObject*, J
// ECMA 15.7.4
-NumberPrototype::NumberPrototype(ExecState* exec, PassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
+NumberPrototype::NumberPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
: NumberObject(structure)
{
setInternalValue(jsNumber(exec, 0));
diff --git a/JavaScriptCore/runtime/NumberPrototype.h b/JavaScriptCore/runtime/NumberPrototype.h
index 0a3a544..1fb2077 100644
--- a/JavaScriptCore/runtime/NumberPrototype.h
+++ b/JavaScriptCore/runtime/NumberPrototype.h
@@ -27,7 +27,7 @@ namespace JSC {
class NumberPrototype : public NumberObject {
public:
- NumberPrototype(ExecState*, PassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ NumberPrototype(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
};
} // namespace JSC
diff --git a/JavaScriptCore/runtime/NumericStrings.h b/JavaScriptCore/runtime/NumericStrings.h
new file mode 100644
index 0000000..c0696a4
--- /dev/null
+++ b/JavaScriptCore/runtime/NumericStrings.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 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 NumericStrings_h
+#define NumericStrings_h
+
+#include "UString.h"
+#include <wtf/HashFunctions.h>
+
+namespace JSC {
+
+ class NumericStrings {
+ public:
+ UString add(double d)
+ {
+ CacheEntry<double>& entry = lookup(d);
+ if (d == entry.key && !entry.value.isNull())
+ return entry.value;
+ entry.key = d;
+ entry.value = UString::from(d);
+ return entry.value;
+ }
+
+ UString add(int i)
+ {
+ CacheEntry<int>& entry = lookup(i);
+ if (i == entry.key && !entry.value.isNull())
+ return entry.value;
+ entry.key = i;
+ entry.value = UString::from(i);
+ return entry.value;
+ }
+
+ private:
+ static const size_t cacheSize = 64;
+
+ template<typename T>
+ struct CacheEntry {
+ T key;
+ UString value;
+ };
+
+ CacheEntry<double>& lookup(double d) { return doubleCache[WTF::FloatHash<double>::hash(d) & (cacheSize - 1)]; }
+ CacheEntry<int>& lookup(int i) { return intCache[WTF::IntHash<int>::hash(i) & (cacheSize - 1)]; }
+
+ CacheEntry<double> doubleCache[cacheSize];
+ CacheEntry<int> intCache[cacheSize];
+ };
+
+} // namespace JSC
+
+#endif // NumericStrings_h
diff --git a/JavaScriptCore/runtime/ObjectConstructor.cpp b/JavaScriptCore/runtime/ObjectConstructor.cpp
index 70c7cd1..a456423 100644
--- a/JavaScriptCore/runtime/ObjectConstructor.cpp
+++ b/JavaScriptCore/runtime/ObjectConstructor.cpp
@@ -21,9 +21,13 @@
#include "config.h"
#include "ObjectConstructor.h"
+#include "Error.h"
#include "JSFunction.h"
+#include "JSArray.h"
#include "JSGlobalObject.h"
#include "ObjectPrototype.h"
+#include "PropertyDescriptor.h"
+#include "PropertyNameArray.h"
#include "PrototypeFunction.h"
namespace JSC {
@@ -31,17 +35,27 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(ObjectConstructor);
static JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*, JSObject*, JSValue, const ArgList&);
+static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*, JSObject*, JSValue, const ArgList&);
+static JSValue JSC_HOST_CALL objectConstructorKeys(ExecState*, JSObject*, JSValue, const ArgList&);
+static JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*, JSObject*, JSValue, const ArgList&);
+static JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*, JSObject*, JSValue, const ArgList&);
+static JSValue JSC_HOST_CALL objectConstructorCreate(ExecState*, JSObject*, JSValue, const ArgList&);
-ObjectConstructor::ObjectConstructor(ExecState* exec, PassRefPtr<Structure> structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, "Object"))
+ObjectConstructor::ObjectConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure)
+: InternalFunction(&exec->globalData(), structure, Identifier(exec, "Object"))
{
// ECMA 15.2.3.1
putDirectWithoutTransition(exec->propertyNames().prototype, objectPrototype, DontEnum | DontDelete | ReadOnly);
-
+
// no. of arguments for constructor
putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
-
+
putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().getPrototypeOf, objectConstructorGetPrototypeOf), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().getOwnPropertyDescriptor, objectConstructorGetOwnPropertyDescriptor), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().keys, objectConstructorKeys), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 3, exec->propertyNames().defineProperty, objectConstructorDefineProperty), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().defineProperties, objectConstructorDefineProperties), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().create, objectConstructorCreate), DontEnum);
}
// ECMA 15.2.2
@@ -82,4 +96,205 @@ JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec, JSObject*
return asObject(args.at(0))->prototype();
}
+JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
+{
+ if (!args.at(0).isObject())
+ return throwError(exec, TypeError, "Requested property descriptor of a value that is not an object.");
+ UString propertyName = args.at(1).toString(exec);
+ if (exec->hadException())
+ return jsNull();
+ JSObject* object = asObject(args.at(0));
+ PropertyDescriptor descriptor;
+ if (!object->getOwnPropertyDescriptor(exec, Identifier(exec, propertyName), descriptor))
+ return jsUndefined();
+ if (exec->hadException())
+ return jsUndefined();
+
+ JSObject* description = constructEmptyObject(exec);
+ if (!descriptor.isAccessorDescriptor()) {
+ description->putDirect(exec->propertyNames().value, descriptor.value() ? descriptor.value() : jsUndefined(), 0);
+ description->putDirect(exec->propertyNames().writable, jsBoolean(descriptor.writable()), 0);
+ } else {
+ description->putDirect(exec->propertyNames().get, descriptor.getter() ? descriptor.getter() : jsUndefined(), 0);
+ description->putDirect(exec->propertyNames().set, descriptor.setter() ? descriptor.setter() : jsUndefined(), 0);
+ }
+
+ description->putDirect(exec->propertyNames().enumerable, jsBoolean(descriptor.enumerable()), 0);
+ description->putDirect(exec->propertyNames().configurable, jsBoolean(descriptor.configurable()), 0);
+
+ return description;
+}
+
+JSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec, JSObject*, JSValue, const ArgList& args)
+{
+ if (!args.at(0).isObject())
+ return throwError(exec, TypeError, "Requested keys of a value that is not an object.");
+ PropertyNameArray properties(exec);
+ asObject(args.at(0))->getOwnPropertyNames(exec, properties);
+ JSArray* keys = constructEmptyArray(exec);
+ size_t numProperties = properties.size();
+ for (size_t i = 0; i < numProperties; i++)
+ keys->push(exec, jsOwnedString(exec, properties[i].ustring()));
+ return keys;
+}
+
+// ES5 8.10.5 ToPropertyDescriptor
+static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor& desc)
+{
+ if (!in.isObject()) {
+ throwError(exec, TypeError, "Property description must be an object.");
+ return false;
+ }
+ JSObject* description = asObject(in);
+
+ PropertySlot enumerableSlot;
+ if (description->getPropertySlot(exec, exec->propertyNames().enumerable, enumerableSlot)) {
+ desc.setEnumerable(enumerableSlot.getValue(exec, exec->propertyNames().enumerable).toBoolean(exec));
+ if (exec->hadException())
+ return false;
+ }
+
+ PropertySlot configurableSlot;
+ if (description->getPropertySlot(exec, exec->propertyNames().configurable, configurableSlot)) {
+ desc.setConfigurable(configurableSlot.getValue(exec, exec->propertyNames().configurable).toBoolean(exec));
+ if (exec->hadException())
+ return false;
+ }
+
+ JSValue value;
+ PropertySlot valueSlot;
+ if (description->getPropertySlot(exec, exec->propertyNames().value, valueSlot)) {
+ desc.setValue(valueSlot.getValue(exec, exec->propertyNames().value));
+ if (exec->hadException())
+ return false;
+ }
+
+ PropertySlot writableSlot;
+ if (description->getPropertySlot(exec, exec->propertyNames().writable, writableSlot)) {
+ desc.setWritable(writableSlot.getValue(exec, exec->propertyNames().writable).toBoolean(exec));
+ if (exec->hadException())
+ return false;
+ }
+
+ PropertySlot getSlot;
+ if (description->getPropertySlot(exec, exec->propertyNames().get, getSlot)) {
+ JSValue get = getSlot.getValue(exec, exec->propertyNames().get);
+ if (exec->hadException())
+ return false;
+ if (!get.isUndefined()) {
+ CallData callData;
+ if (get.getCallData(callData) == CallTypeNone) {
+ throwError(exec, TypeError, "Getter must be a function.");
+ return false;
+ }
+ } else
+ get = JSValue();
+ desc.setGetter(get);
+ }
+
+ PropertySlot setSlot;
+ if (description->getPropertySlot(exec, exec->propertyNames().set, setSlot)) {
+ JSValue set = setSlot.getValue(exec, exec->propertyNames().set);
+ if (exec->hadException())
+ return false;
+ if (!set.isUndefined()) {
+ CallData callData;
+ if (set.getCallData(callData) == CallTypeNone) {
+ throwError(exec, TypeError, "Setter must be a function.");
+ return false;
+ }
+ } else
+ set = JSValue();
+
+ desc.setSetter(set);
+ }
+
+ if (!desc.isAccessorDescriptor())
+ return true;
+
+ if (desc.value()) {
+ throwError(exec, TypeError, "Invalid property. 'value' present on property with getter or setter.");
+ return false;
+ }
+
+ if (desc.writablePresent()) {
+ throwError(exec, TypeError, "Invalid property. 'writable' present on property with getter or setter.");
+ return false;
+ }
+ return true;
+}
+
+JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec, JSObject*, JSValue, const ArgList& args)
+{
+ if (!args.at(0).isObject())
+ return throwError(exec, TypeError, "Properties can only be defined on Objects.");
+ JSObject* O = asObject(args.at(0));
+ UString propertyName = args.at(1).toString(exec);
+ if (exec->hadException())
+ return jsNull();
+ PropertyDescriptor descriptor;
+ if (!toPropertyDescriptor(exec, args.at(2), descriptor))
+ return jsNull();
+ ASSERT((descriptor.attributes() & (Getter | Setter)) || (!descriptor.isAccessorDescriptor()));
+ ASSERT(!exec->hadException());
+ O->defineOwnProperty(exec, Identifier(exec, propertyName), descriptor, true);
+ return O;
+}
+
+static JSValue defineProperties(ExecState* exec, JSObject* object, JSObject* properties)
+{
+ PropertyNameArray propertyNames(exec);
+ asObject(properties)->getOwnPropertyNames(exec, propertyNames);
+ size_t numProperties = propertyNames.size();
+ Vector<PropertyDescriptor> descriptors;
+ MarkedArgumentBuffer markBuffer;
+ for (size_t i = 0; i < numProperties; i++) {
+ PropertySlot slot;
+ JSValue prop = properties->get(exec, propertyNames[i]);
+ if (exec->hadException())
+ return jsNull();
+ PropertyDescriptor descriptor;
+ if (!toPropertyDescriptor(exec, prop, descriptor))
+ return jsNull();
+ descriptors.append(descriptor);
+ // Ensure we mark all the values that we're accumulating
+ if (descriptor.isDataDescriptor() && descriptor.value())
+ markBuffer.append(descriptor.value());
+ if (descriptor.isAccessorDescriptor()) {
+ if (descriptor.getter())
+ markBuffer.append(descriptor.getter());
+ if (descriptor.setter())
+ markBuffer.append(descriptor.setter());
+ }
+ }
+ for (size_t i = 0; i < numProperties; i++) {
+ object->defineOwnProperty(exec, propertyNames[i], descriptors[i], true);
+ if (exec->hadException())
+ return jsNull();
+ }
+ return object;
+}
+
+JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec, JSObject*, JSValue, const ArgList& args)
+{
+ if (!args.at(0).isObject())
+ return throwError(exec, TypeError, "Properties can only be defined on Objects.");
+ if (!args.at(1).isObject())
+ return throwError(exec, TypeError, "Property descriptor list must be an Object.");
+ return defineProperties(exec, asObject(args.at(0)), asObject(args.at(1)));
+}
+
+JSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec, JSObject*, JSValue, const ArgList& args)
+{
+ if (!args.at(0).isObject() && !args.at(0).isNull())
+ return throwError(exec, TypeError, "Object prototype may only be an Object or null.");
+ JSObject* newObject = constructEmptyObject(exec);
+ newObject->setPrototype(args.at(0));
+ if (args.at(1).isUndefined())
+ return newObject;
+ if (!args.at(1).isObject())
+ return throwError(exec, TypeError, "Property descriptor list must be an Object.");
+ return defineProperties(exec, newObject, asObject(args.at(1)));
+}
+
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ObjectConstructor.h b/JavaScriptCore/runtime/ObjectConstructor.h
index 9373781..1d2cdde 100644
--- a/JavaScriptCore/runtime/ObjectConstructor.h
+++ b/JavaScriptCore/runtime/ObjectConstructor.h
@@ -29,7 +29,7 @@ namespace JSC {
class ObjectConstructor : public InternalFunction {
public:
- ObjectConstructor(ExecState*, PassRefPtr<Structure>, ObjectPrototype*, Structure* prototypeFunctionStructure);
+ ObjectConstructor(ExecState*, NonNullPassRefPtr<Structure>, ObjectPrototype*, Structure* prototypeFunctionStructure);
private:
virtual ConstructType getConstructData(ConstructData&);
diff --git a/JavaScriptCore/runtime/ObjectPrototype.cpp b/JavaScriptCore/runtime/ObjectPrototype.cpp
index 98e4713..0970b7c 100644
--- a/JavaScriptCore/runtime/ObjectPrototype.cpp
+++ b/JavaScriptCore/runtime/ObjectPrototype.cpp
@@ -40,8 +40,9 @@ static JSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState*, JSObject*,
static JSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*, JSObject*, JSValue, const ArgList&);
-ObjectPrototype::ObjectPrototype(ExecState* exec, PassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure)
+ObjectPrototype::ObjectPrototype(ExecState* exec, NonNullPassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure)
: JSObject(stucture)
+ , m_hasNoPropertiesWithUInt32Names(true)
{
putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
@@ -57,6 +58,24 @@ ObjectPrototype::ObjectPrototype(ExecState* exec, PassRefPtr<Structure> stucture
putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);
}
+void ObjectPrototype::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ JSObject::put(exec, propertyName, value, slot);
+
+ if (m_hasNoPropertiesWithUInt32Names) {
+ bool isUInt32;
+ propertyName.toStrictUInt32(&isUInt32);
+ m_hasNoPropertiesWithUInt32Names = !isUInt32;
+ }
+}
+
+bool ObjectPrototype::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
+{
+ if (m_hasNoPropertiesWithUInt32Names)
+ return false;
+ return JSObject::getOwnPropertySlot(exec, propertyName, slot);
+}
+
// ------------------------------ Functions --------------------------------
// ECMA 15.2.4.2, 15.2.4.4, 15.2.4.5, 15.2.4.7
diff --git a/JavaScriptCore/runtime/ObjectPrototype.h b/JavaScriptCore/runtime/ObjectPrototype.h
index 7790ae0..489d962 100644
--- a/JavaScriptCore/runtime/ObjectPrototype.h
+++ b/JavaScriptCore/runtime/ObjectPrototype.h
@@ -27,7 +27,13 @@ namespace JSC {
class ObjectPrototype : public JSObject {
public:
- ObjectPrototype(ExecState*, PassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ ObjectPrototype(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+
+ private:
+ virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&);
+ virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+
+ bool m_hasNoPropertiesWithUInt32Names;
};
JSValue JSC_HOST_CALL objectProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
diff --git a/JavaScriptCore/runtime/Operations.h b/JavaScriptCore/runtime/Operations.h
index c4900d3..5da9e38 100644
--- a/JavaScriptCore/runtime/Operations.h
+++ b/JavaScriptCore/runtime/Operations.h
@@ -308,20 +308,13 @@ namespace JSC {
resultRep = UString::Rep::createEmptyBuffer(bufferSize);
UString result(resultRep);
- // Loop over the openards, writing them into the output buffer.
+ // Loop over the operands, writing them into the output buffer.
for (unsigned i = 0; i < count; ++i) {
JSValue v = strings[i].jsValue();
if (LIKELY(v.isString()))
result.append(asString(v)->value());
- else if (v.isInt32())
- result.appendNumeric(v.asInt32());
- else {
- double d;
- if (v.getNumber(d))
- result.appendNumeric(d);
- else
- result.append(v.toString(callFrame));
- }
+ else
+ result.append(v.toString(callFrame));
}
return jsString(callFrame, result);
diff --git a/JavaScriptCore/runtime/PropertyDescriptor.cpp b/JavaScriptCore/runtime/PropertyDescriptor.cpp
new file mode 100644
index 0000000..4db814f
--- /dev/null
+++ b/JavaScriptCore/runtime/PropertyDescriptor.cpp
@@ -0,0 +1,195 @@
+/*
+ * Copyright (C) 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 "PropertyDescriptor.h"
+
+#include "GetterSetter.h"
+#include "JSObject.h"
+#include "Operations.h"
+
+namespace JSC {
+unsigned PropertyDescriptor::defaultAttributes = (DontDelete << 1) - 1;
+
+bool PropertyDescriptor::writable() const
+{
+ ASSERT(!isAccessorDescriptor());
+ return !(m_attributes & ReadOnly);
+}
+
+bool PropertyDescriptor::enumerable() const
+{
+ return !(m_attributes & DontEnum);
+}
+
+bool PropertyDescriptor::configurable() const
+{
+ return !(m_attributes & DontDelete);
+}
+
+bool PropertyDescriptor::isDataDescriptor() const
+{
+ return m_value || (m_seenAttributes & WritablePresent);
+}
+
+bool PropertyDescriptor::isGenericDescriptor() const
+{
+ return !isAccessorDescriptor() && !isDataDescriptor();
+}
+
+bool PropertyDescriptor::isAccessorDescriptor() const
+{
+ return m_getter || m_setter;
+}
+
+void PropertyDescriptor::setUndefined()
+{
+ m_value = jsUndefined();
+ m_attributes = ReadOnly | DontDelete | DontEnum;
+}
+
+JSValue PropertyDescriptor::getter() const
+{
+ ASSERT(isAccessorDescriptor());
+ return m_getter;
+}
+
+JSValue PropertyDescriptor::setter() const
+{
+ ASSERT(isAccessorDescriptor());
+ return m_setter;
+}
+
+void PropertyDescriptor::setDescriptor(JSValue value, unsigned attributes)
+{
+ ASSERT(value);
+ m_attributes = attributes;
+ if (attributes & (Getter | Setter)) {
+ GetterSetter* accessor = asGetterSetter(value);
+ m_getter = accessor->getter();
+ m_setter = accessor->setter();
+ ASSERT(m_getter || m_setter);
+ m_seenAttributes = EnumerablePresent | ConfigurablePresent;
+ m_attributes &= ~ReadOnly;
+ } else {
+ m_value = value;
+ m_seenAttributes = EnumerablePresent | ConfigurablePresent | WritablePresent;
+ }
+}
+
+void PropertyDescriptor::setAccessorDescriptor(JSValue getter, JSValue setter, unsigned attributes)
+{
+ ASSERT(attributes & (Getter | Setter));
+ ASSERT(getter || setter);
+ m_attributes = attributes;
+ m_getter = getter;
+ m_setter = setter;
+ m_attributes &= ~ReadOnly;
+ m_seenAttributes = EnumerablePresent | ConfigurablePresent;
+}
+
+void PropertyDescriptor::setWritable(bool writable)
+{
+ if (writable)
+ m_attributes &= ~ReadOnly;
+ else
+ m_attributes |= ReadOnly;
+ m_seenAttributes |= WritablePresent;
+}
+
+void PropertyDescriptor::setEnumerable(bool enumerable)
+{
+ if (enumerable)
+ m_attributes &= ~DontEnum;
+ else
+ m_attributes |= DontEnum;
+ m_seenAttributes |= EnumerablePresent;
+}
+
+void PropertyDescriptor::setConfigurable(bool configurable)
+{
+ if (configurable)
+ m_attributes &= ~DontDelete;
+ else
+ m_attributes |= DontDelete;
+ m_seenAttributes |= ConfigurablePresent;
+}
+
+void PropertyDescriptor::setSetter(JSValue setter)
+{
+ m_setter = setter;
+ m_attributes |= Setter;
+ m_attributes &= ~ReadOnly;
+}
+
+void PropertyDescriptor::setGetter(JSValue getter)
+{
+ m_getter = getter;
+ m_attributes |= Getter;
+ m_attributes &= ~ReadOnly;
+}
+
+bool PropertyDescriptor::equalTo(const PropertyDescriptor& other) const
+{
+ if (!other.m_value == m_value ||
+ !other.m_getter == m_getter ||
+ !other.m_setter == m_setter)
+ return false;
+ return (!m_value || JSValue::strictEqual(other.m_value, m_value)) &&
+ (!m_getter || JSValue::strictEqual(other.m_getter, m_getter)) &&
+ (!m_setter || JSValue::strictEqual(other.m_setter, m_setter)) &&
+ attributesEqual(other);
+}
+
+bool PropertyDescriptor::attributesEqual(const PropertyDescriptor& other) const
+{
+ unsigned mismatch = other.m_attributes ^ m_attributes;
+ unsigned sharedSeen = other.m_seenAttributes & m_seenAttributes;
+ if (sharedSeen & WritablePresent && mismatch & ReadOnly)
+ return false;
+ if (sharedSeen & ConfigurablePresent && mismatch & DontDelete)
+ return false;
+ if (sharedSeen & EnumerablePresent && mismatch & DontEnum)
+ return false;
+ return true;
+}
+
+unsigned PropertyDescriptor::attributesWithOverride(const PropertyDescriptor& other) const
+{
+ unsigned mismatch = other.m_attributes ^ m_attributes;
+ unsigned sharedSeen = other.m_seenAttributes & m_seenAttributes;
+ unsigned newAttributes = m_attributes & defaultAttributes;
+ if (sharedSeen & WritablePresent && mismatch & ReadOnly)
+ newAttributes ^= ReadOnly;
+ if (sharedSeen & ConfigurablePresent && mismatch & DontDelete)
+ newAttributes ^= DontDelete;
+ if (sharedSeen & EnumerablePresent && mismatch & DontEnum)
+ newAttributes ^= DontEnum;
+ return newAttributes;
+}
+
+}
diff --git a/JavaScriptCore/runtime/PropertyDescriptor.h b/JavaScriptCore/runtime/PropertyDescriptor.h
new file mode 100644
index 0000000..40bec86
--- /dev/null
+++ b/JavaScriptCore/runtime/PropertyDescriptor.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 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 PropertyDescriptor_h
+#define PropertyDescriptor_h
+
+#include "JSValue.h"
+
+namespace JSC {
+ class PropertyDescriptor {
+ public:
+ PropertyDescriptor()
+ : m_attributes(defaultAttributes)
+ , m_seenAttributes(0)
+ {
+ }
+ bool writable() const;
+ bool enumerable() const;
+ bool configurable() const;
+ bool isDataDescriptor() const;
+ bool isGenericDescriptor() const;
+ bool isAccessorDescriptor() const;
+ unsigned attributes() const { return m_attributes; }
+ JSValue value() const { return m_value; }
+ JSValue getter() const;
+ JSValue setter() const;
+ void setUndefined();
+ void setDescriptor(JSValue value, unsigned attributes);
+ void setAccessorDescriptor(JSValue getter, JSValue setter, unsigned attributes);
+ void setWritable(bool);
+ void setEnumerable(bool);
+ void setConfigurable(bool);
+ void setValue(JSValue value) { m_value = value; }
+ void setSetter(JSValue);
+ void setGetter(JSValue);
+ bool isEmpty() const { return !(m_value || m_getter || m_setter || m_seenAttributes); }
+ bool writablePresent() const { return m_seenAttributes & WritablePresent; }
+ bool enumerablePresent() const { return m_seenAttributes & EnumerablePresent; }
+ bool configurablePresent() const { return m_seenAttributes & ConfigurablePresent; }
+ bool setterPresent() const { return m_setter; }
+ bool getterPresent() const { return m_getter; }
+ bool equalTo(const PropertyDescriptor& other) const;
+ bool attributesEqual(const PropertyDescriptor& other) const;
+ unsigned attributesWithOverride(const PropertyDescriptor& other) const;
+ private:
+ static unsigned defaultAttributes;
+ bool operator==(const PropertyDescriptor&){ return false; }
+ enum { WritablePresent = 1, EnumerablePresent = 2, ConfigurablePresent = 4};
+ // May be a getter/setter
+ JSValue m_value;
+ JSValue m_getter;
+ JSValue m_setter;
+ unsigned m_attributes;
+ unsigned m_seenAttributes;
+ };
+}
+
+#endif
diff --git a/JavaScriptCore/runtime/PropertyMapHashTable.h b/JavaScriptCore/runtime/PropertyMapHashTable.h
index 44dc2b8..5b63f79 100644
--- a/JavaScriptCore/runtime/PropertyMapHashTable.h
+++ b/JavaScriptCore/runtime/PropertyMapHashTable.h
@@ -61,6 +61,7 @@ namespace JSC {
unsigned size;
unsigned keyCount;
unsigned deletedSentinelCount;
+ unsigned anonymousSlotCount;
unsigned lastIndexUsed;
Vector<unsigned>* deletedOffsets;
unsigned entryIndices[1];
diff --git a/JavaScriptCore/runtime/PropertyNameArray.h b/JavaScriptCore/runtime/PropertyNameArray.h
index b4382f4..afcc83f 100644
--- a/JavaScriptCore/runtime/PropertyNameArray.h
+++ b/JavaScriptCore/runtime/PropertyNameArray.h
@@ -44,7 +44,7 @@ namespace JSC {
void setCachedStructure(Structure* structure) { m_cachedStructure = structure; }
Structure* cachedStructure() const { return m_cachedStructure; }
- void setCachedPrototypeChain(PassRefPtr<StructureChain> cachedPrototypeChain) { m_cachedPrototypeChain = cachedPrototypeChain; }
+ void setCachedPrototypeChain(NonNullPassRefPtr<StructureChain> cachedPrototypeChain) { m_cachedPrototypeChain = cachedPrototypeChain; }
StructureChain* cachedPrototypeChain() { return m_cachedPrototypeChain.get(); }
private:
diff --git a/JavaScriptCore/runtime/PropertySlot.cpp b/JavaScriptCore/runtime/PropertySlot.cpp
index 36fa5d8..a0a2f48 100644
--- a/JavaScriptCore/runtime/PropertySlot.cpp
+++ b/JavaScriptCore/runtime/PropertySlot.cpp
@@ -23,7 +23,6 @@
#include "JSFunction.h"
#include "JSGlobalObject.h"
-#include "JSObject.h"
namespace JSC {
@@ -39,7 +38,7 @@ JSValue PropertySlot::functionGetter(ExecState* exec, const Identifier&, const P
return callData.native.function(exec, slot.m_data.getterFunc, slot.slotBase(), exec->emptyList());
ASSERT(callType == CallTypeJS);
// FIXME: Can this be done more efficiently using the callData?
- return static_cast<JSFunction*>(slot.m_data.getterFunc)->call(exec, slot.slotBase(), exec->emptyList());
+ return asFunction(slot.m_data.getterFunc)->call(exec, slot.slotBase(), exec->emptyList());
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/PrototypeFunction.cpp b/JavaScriptCore/runtime/PrototypeFunction.cpp
index 8e3d107..38f8adb 100644
--- a/JavaScriptCore/runtime/PrototypeFunction.cpp
+++ b/JavaScriptCore/runtime/PrototypeFunction.cpp
@@ -40,7 +40,7 @@ PrototypeFunction::PrototypeFunction(ExecState* exec, int length, const Identifi
putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum);
}
-PrototypeFunction::PrototypeFunction(ExecState* exec, PassRefPtr<Structure> prototypeFunctionStructure, int length, const Identifier& name, NativeFunction function)
+PrototypeFunction::PrototypeFunction(ExecState* exec, NonNullPassRefPtr<Structure> prototypeFunctionStructure, int length, const Identifier& name, NativeFunction function)
: InternalFunction(&exec->globalData(), prototypeFunctionStructure, name)
, m_function(function)
{
diff --git a/JavaScriptCore/runtime/PrototypeFunction.h b/JavaScriptCore/runtime/PrototypeFunction.h
index 99ab327..70ee034 100644
--- a/JavaScriptCore/runtime/PrototypeFunction.h
+++ b/JavaScriptCore/runtime/PrototypeFunction.h
@@ -32,7 +32,7 @@ namespace JSC {
class PrototypeFunction : public InternalFunction {
public:
PrototypeFunction(ExecState*, int length, const Identifier&, NativeFunction);
- PrototypeFunction(ExecState*, PassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
+ PrototypeFunction(ExecState*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
private:
virtual CallType getCallData(CallData&);
diff --git a/JavaScriptCore/runtime/RegExpConstructor.cpp b/JavaScriptCore/runtime/RegExpConstructor.cpp
index 6a8089d..dbf2d44 100644
--- a/JavaScriptCore/runtime/RegExpConstructor.cpp
+++ b/JavaScriptCore/runtime/RegExpConstructor.cpp
@@ -23,6 +23,7 @@
#include "RegExpConstructor.h"
#include "ArrayPrototype.h"
+#include "Error.h"
#include "JSArray.h"
#include "JSFunction.h"
#include "JSString.h"
@@ -111,7 +112,7 @@ struct RegExpConstructorPrivate : FastAllocBase {
unsigned lastOvectorIndex : 1;
};
-RegExpConstructor::RegExpConstructor(ExecState* exec, PassRefPtr<Structure> structure, RegExpPrototype* regExpPrototype)
+RegExpConstructor::RegExpConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, RegExpPrototype* regExpPrototype)
: InternalFunction(&exec->globalData(), structure, Identifier(exec, "RegExp"))
, d(new RegExpConstructorPrivate)
{
@@ -233,6 +234,11 @@ bool RegExpConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& pr
return getStaticValueSlot<RegExpConstructor, InternalFunction>(exec, ExecState::regExpConstructorTable(exec), this, propertyName, slot);
}
+bool RegExpConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<RegExpConstructor, InternalFunction>(exec, ExecState::regExpConstructorTable(exec), this, propertyName, descriptor);
+}
+
JSValue regExpConstructorDollar1(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
return asRegExpConstructor(slot.slotBase())->getBackref(exec, 1);
@@ -329,7 +335,7 @@ JSObject* constructRegExp(ExecState* exec, const ArgList& args)
JSValue arg0 = args.at(0);
JSValue arg1 = args.at(1);
- if (arg0.isObject(&RegExpObject::info)) {
+ if (arg0.inherits(&RegExpObject::info)) {
if (!arg1.isUndefined())
return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another.");
return asObject(arg0);
diff --git a/JavaScriptCore/runtime/RegExpConstructor.h b/JavaScriptCore/runtime/RegExpConstructor.h
index 6823f3f..f8bccf4 100644
--- a/JavaScriptCore/runtime/RegExpConstructor.h
+++ b/JavaScriptCore/runtime/RegExpConstructor.h
@@ -32,15 +32,16 @@ namespace JSC {
class RegExpConstructor : public InternalFunction {
public:
- RegExpConstructor(ExecState*, PassRefPtr<Structure>, RegExpPrototype*);
+ RegExpConstructor(ExecState*, NonNullPassRefPtr<Structure>, RegExpPrototype*);
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType, ImplementsHasInstance));
+ return Structure::create(prototype, TypeInfo(ObjectType, ImplementsHasInstance | HasDefaultMark | HasDefaultGetPropertyNames));
}
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
static const ClassInfo info;
diff --git a/JavaScriptCore/runtime/RegExpMatchesArray.h b/JavaScriptCore/runtime/RegExpMatchesArray.h
index 9ae18b9..829f7cf 100644
--- a/JavaScriptCore/runtime/RegExpMatchesArray.h
+++ b/JavaScriptCore/runtime/RegExpMatchesArray.h
@@ -44,6 +44,13 @@ namespace JSC {
return JSArray::getOwnPropertySlot(exec, propertyName, slot);
}
+ virtual bool getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+ {
+ if (lazyCreationData())
+ fillArrayInstance(exec);
+ return JSArray::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+ }
+
virtual void put(ExecState* exec, const Identifier& propertyName, JSValue v, PutPropertySlot& slot)
{
if (lazyCreationData())
@@ -72,11 +79,11 @@ namespace JSC {
return JSArray::deleteProperty(exec, propertyName);
}
- virtual void getPropertyNames(ExecState* exec, PropertyNameArray& arr)
+ virtual void getOwnPropertyNames(ExecState* exec, PropertyNameArray& arr)
{
if (lazyCreationData())
fillArrayInstance(exec);
- JSArray::getPropertyNames(exec, arr);
+ JSArray::getOwnPropertyNames(exec, arr);
}
void fillArrayInstance(ExecState*);
diff --git a/JavaScriptCore/runtime/RegExpObject.cpp b/JavaScriptCore/runtime/RegExpObject.cpp
index 687844e..877d7b6 100644
--- a/JavaScriptCore/runtime/RegExpObject.cpp
+++ b/JavaScriptCore/runtime/RegExpObject.cpp
@@ -57,7 +57,7 @@ const ClassInfo RegExpObject::info = { "RegExp", 0, 0, ExecState::regExpTable };
@end
*/
-RegExpObject::RegExpObject(PassRefPtr<Structure> structure, PassRefPtr<RegExp> regExp)
+RegExpObject::RegExpObject(NonNullPassRefPtr<Structure> structure, NonNullPassRefPtr<RegExp> regExp)
: JSObject(structure)
, d(new RegExpObjectData(regExp, 0))
{
@@ -72,6 +72,11 @@ bool RegExpObject::getOwnPropertySlot(ExecState* exec, const Identifier& propert
return getStaticValueSlot<RegExpObject, JSObject>(exec, ExecState::regExpTable(exec), this, propertyName, slot);
}
+bool RegExpObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<RegExpObject, JSObject>(exec, ExecState::regExpTable(exec), this, propertyName, descriptor);
+}
+
JSValue regExpObjectGlobal(ExecState*, const Identifier&, const PropertySlot& slot)
{
return jsBoolean(asRegExpObject(slot.slotBase())->regExp()->global());
diff --git a/JavaScriptCore/runtime/RegExpObject.h b/JavaScriptCore/runtime/RegExpObject.h
index e83e0ac..f5a9340 100644
--- a/JavaScriptCore/runtime/RegExpObject.h
+++ b/JavaScriptCore/runtime/RegExpObject.h
@@ -28,7 +28,7 @@ namespace JSC {
class RegExpObject : public JSObject {
public:
- RegExpObject(PassRefPtr<Structure>, PassRefPtr<RegExp>);
+ RegExpObject(NonNullPassRefPtr<Structure>, NonNullPassRefPtr<RegExp>);
virtual ~RegExpObject();
void setRegExp(PassRefPtr<RegExp> r) { d->regExp = r; }
@@ -41,6 +41,7 @@ namespace JSC {
JSValue exec(ExecState*, const ArgList&);
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual const ClassInfo* classInfo() const { return &info; }
@@ -48,7 +49,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType));
+ return Structure::create(prototype, TypeInfo(ObjectType, HasDefaultMark | HasDefaultGetPropertyNames));
}
private:
@@ -57,7 +58,7 @@ namespace JSC {
virtual CallType getCallData(CallData&);
struct RegExpObjectData : FastAllocBase {
- RegExpObjectData(PassRefPtr<RegExp> regExp, double lastIndex)
+ RegExpObjectData(NonNullPassRefPtr<RegExp> regExp, double lastIndex)
: regExp(regExp)
, lastIndex(lastIndex)
{
diff --git a/JavaScriptCore/runtime/RegExpPrototype.cpp b/JavaScriptCore/runtime/RegExpPrototype.cpp
index b1ab889..bbc9e85 100644
--- a/JavaScriptCore/runtime/RegExpPrototype.cpp
+++ b/JavaScriptCore/runtime/RegExpPrototype.cpp
@@ -22,6 +22,7 @@
#include "RegExpPrototype.h"
#include "ArrayPrototype.h"
+#include "Error.h"
#include "JSArray.h"
#include "JSFunction.h"
#include "JSObject.h"
@@ -45,7 +46,7 @@ static JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*, JSObject*, JSVa
const ClassInfo RegExpPrototype::info = { "RegExpPrototype", 0, 0, 0 };
-RegExpPrototype::RegExpPrototype(ExecState* exec, PassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
+RegExpPrototype::RegExpPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
: JSObject(structure)
{
putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);
@@ -58,28 +59,28 @@ RegExpPrototype::RegExpPrototype(ExecState* exec, PassRefPtr<Structure> structur
JSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
- if (!thisValue.isObject(&RegExpObject::info))
+ if (!thisValue.inherits(&RegExpObject::info))
return throwError(exec, TypeError);
return asRegExpObject(thisValue)->test(exec, args);
}
JSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
- if (!thisValue.isObject(&RegExpObject::info))
+ if (!thisValue.inherits(&RegExpObject::info))
return throwError(exec, TypeError);
return asRegExpObject(thisValue)->exec(exec, args);
}
JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
- if (!thisValue.isObject(&RegExpObject::info))
+ if (!thisValue.inherits(&RegExpObject::info))
return throwError(exec, TypeError);
RefPtr<RegExp> regExp;
JSValue arg0 = args.at(0);
JSValue arg1 = args.at(1);
- if (arg0.isObject(&RegExpObject::info)) {
+ if (arg0.inherits(&RegExpObject::info)) {
if (!arg1.isUndefined())
return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another.");
regExp = asRegExpObject(arg0)->regExp();
@@ -99,8 +100,8 @@ JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec, JSObject*, JSValue
JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.isObject(&RegExpObject::info)) {
- if (thisValue.isObject(&RegExpPrototype::info))
+ if (!thisValue.inherits(&RegExpObject::info)) {
+ if (thisValue.inherits(&RegExpPrototype::info))
return jsNontrivialString(exec, "//");
return throwError(exec, TypeError);
}
diff --git a/JavaScriptCore/runtime/RegExpPrototype.h b/JavaScriptCore/runtime/RegExpPrototype.h
index f5db720..d3979bd 100644
--- a/JavaScriptCore/runtime/RegExpPrototype.h
+++ b/JavaScriptCore/runtime/RegExpPrototype.h
@@ -27,7 +27,7 @@ namespace JSC {
class RegExpPrototype : public JSObject {
public:
- RegExpPrototype(ExecState*, PassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ RegExpPrototype(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
diff --git a/JavaScriptCore/runtime/ScopeChain.cpp b/JavaScriptCore/runtime/ScopeChain.cpp
index 5c2edab..981794b 100644
--- a/JavaScriptCore/runtime/ScopeChain.cpp
+++ b/JavaScriptCore/runtime/ScopeChain.cpp
@@ -36,8 +36,8 @@ void ScopeChainNode::print() const
ScopeChainIterator scopeEnd = end();
for (ScopeChainIterator scopeIter = begin(); scopeIter != scopeEnd; ++scopeIter) {
JSObject* o = *scopeIter;
- PropertyNameArray propertyNames(globalObject()->globalExec());
- o->getPropertyNames(globalObject()->globalExec(), propertyNames);
+ PropertyNameArray propertyNames(globalObject->globalExec());
+ o->getPropertyNames(globalObject->globalExec(), propertyNames);
PropertyNameArray::const_iterator propEnd = propertyNames.end();
fprintf(stderr, "----- [scope %p] -----\n", o);
@@ -56,7 +56,7 @@ int ScopeChain::localDepth() const
int scopeDepth = 0;
ScopeChainIterator iter = this->begin();
ScopeChainIterator end = this->end();
- while (!(*iter)->isObject(&JSActivation::info)) {
+ while (!(*iter)->inherits(&JSActivation::info)) {
++iter;
if (iter == end)
break;
diff --git a/JavaScriptCore/runtime/ScopeChain.h b/JavaScriptCore/runtime/ScopeChain.h
index c5e16c9..0b15b67 100644
--- a/JavaScriptCore/runtime/ScopeChain.h
+++ b/JavaScriptCore/runtime/ScopeChain.h
@@ -33,14 +33,16 @@ namespace JSC {
class ScopeChainNode : public FastAllocBase {
public:
- ScopeChainNode(ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSObject* globalThis)
+ ScopeChainNode(ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis)
: next(next)
, object(object)
, globalData(globalData)
+ , globalObject(globalObject)
, globalThis(globalThis)
, refCount(1)
{
ASSERT(globalData);
+ ASSERT(globalObject);
}
#ifndef NDEBUG
// Due to the number of subtle and timing dependent bugs that have occurred due
@@ -51,6 +53,7 @@ namespace JSC {
next = 0;
object = 0;
globalData = 0;
+ globalObject = 0;
globalThis = 0;
}
#endif
@@ -58,6 +61,7 @@ namespace JSC {
ScopeChainNode* next;
JSObject* object;
JSGlobalData* globalData;
+ JSGlobalObject* globalObject;
JSObject* globalThis;
int refCount;
@@ -82,9 +86,6 @@ namespace JSC {
ScopeChainIterator begin() const;
ScopeChainIterator end() const;
- JSGlobalObject* globalObject() const; // defined in JSGlobalObject.h
- JSObject* globalThisObject() const { return globalThis; }
-
#ifndef NDEBUG
void print() const;
#endif
@@ -93,7 +94,7 @@ namespace JSC {
inline ScopeChainNode* ScopeChainNode::push(JSObject* o)
{
ASSERT(o);
- return new ScopeChainNode(this, o, globalData, globalThis);
+ return new ScopeChainNode(this, o, globalData, globalObject, globalThis);
}
inline ScopeChainNode* ScopeChainNode::pop()
@@ -163,8 +164,8 @@ namespace JSC {
{
}
- ScopeChain(JSObject* o, JSGlobalData* globalData, JSObject* globalThis)
- : m_node(new ScopeChainNode(0, o, globalData, globalThis))
+ ScopeChain(JSObject* o, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis)
+ : m_node(new ScopeChainNode(0, o, globalData, globalObject, globalThis))
{
}
@@ -203,7 +204,7 @@ namespace JSC {
void pop() { m_node = m_node->pop(); }
void clear() { m_node->deref(); m_node = 0; }
- JSGlobalObject* globalObject() const { return m_node->globalObject(); }
+ JSGlobalObject* globalObject() const { return m_node->globalObject; }
void markAggregate(MarkStack&) const;
diff --git a/JavaScriptCore/runtime/SmallStrings.cpp b/JavaScriptCore/runtime/SmallStrings.cpp
index 2f92cc1..04701cb 100644
--- a/JavaScriptCore/runtime/SmallStrings.cpp
+++ b/JavaScriptCore/runtime/SmallStrings.cpp
@@ -82,13 +82,13 @@ SmallStrings::~SmallStrings()
{
}
-void SmallStrings::mark()
+void SmallStrings::markChildren(MarkStack& markStack)
{
- if (m_emptyString && !m_emptyString->marked())
- m_emptyString->markCellDirect();
+ if (m_emptyString)
+ markStack.append(m_emptyString);
for (unsigned i = 0; i < numCharactersToStore; ++i) {
- if (m_singleCharacterStrings[i] && !m_singleCharacterStrings[i]->marked())
- m_singleCharacterStrings[i]->markCellDirect();
+ if (m_singleCharacterStrings[i])
+ markStack.append(m_singleCharacterStrings[i]);
}
}
diff --git a/JavaScriptCore/runtime/SmallStrings.h b/JavaScriptCore/runtime/SmallStrings.h
index f0dd8df..efecbb0 100644
--- a/JavaScriptCore/runtime/SmallStrings.h
+++ b/JavaScriptCore/runtime/SmallStrings.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * 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
@@ -33,7 +33,7 @@ namespace JSC {
class JSGlobalData;
class JSString;
-
+ class MarkStack;
class SmallStringsStorage;
class SmallStrings : public Noncopyable {
@@ -56,7 +56,7 @@ namespace JSC {
UString::Rep* singleCharacterStringRep(unsigned char character);
- void mark();
+ void markChildren(MarkStack&);
unsigned count() const;
diff --git a/JavaScriptCore/runtime/StringConstructor.cpp b/JavaScriptCore/runtime/StringConstructor.cpp
index 6380445..2f3adbe 100644
--- a/JavaScriptCore/runtime/StringConstructor.cpp
+++ b/JavaScriptCore/runtime/StringConstructor.cpp
@@ -47,7 +47,7 @@ static JSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec, JSObject*, JSVa
ASSERT_CLASS_FITS_IN_CELL(StringConstructor);
-StringConstructor::StringConstructor(ExecState* exec, PassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, StringPrototype* stringPrototype)
+StringConstructor::StringConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, StringPrototype* stringPrototype)
: InternalFunction(&exec->globalData(), structure, Identifier(exec, stringPrototype->classInfo()->className))
{
// ECMA 15.5.3.1 String.prototype
diff --git a/JavaScriptCore/runtime/StringConstructor.h b/JavaScriptCore/runtime/StringConstructor.h
index 7d52c69..e511f7b 100644
--- a/JavaScriptCore/runtime/StringConstructor.h
+++ b/JavaScriptCore/runtime/StringConstructor.h
@@ -29,7 +29,7 @@ namespace JSC {
class StringConstructor : public InternalFunction {
public:
- StringConstructor(ExecState*, PassRefPtr<Structure>, Structure* prototypeFunctionStructure, StringPrototype*);
+ StringConstructor(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure, StringPrototype*);
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallData(CallData&);
diff --git a/JavaScriptCore/runtime/StringObject.cpp b/JavaScriptCore/runtime/StringObject.cpp
index fb44498..7216d3a 100644
--- a/JavaScriptCore/runtime/StringObject.cpp
+++ b/JavaScriptCore/runtime/StringObject.cpp
@@ -29,19 +29,19 @@ ASSERT_CLASS_FITS_IN_CELL(StringObject);
const ClassInfo StringObject::info = { "String", 0, 0, 0 };
-StringObject::StringObject(ExecState* exec, PassRefPtr<Structure> structure)
+StringObject::StringObject(ExecState* exec, NonNullPassRefPtr<Structure> structure)
: JSWrapperObject(structure)
{
setInternalValue(jsEmptyString(exec));
}
-StringObject::StringObject(PassRefPtr<Structure> structure, JSString* string)
+StringObject::StringObject(NonNullPassRefPtr<Structure> structure, JSString* string)
: JSWrapperObject(structure)
{
setInternalValue(string);
}
-StringObject::StringObject(ExecState* exec, PassRefPtr<Structure> structure, const UString& string)
+StringObject::StringObject(ExecState* exec, NonNullPassRefPtr<Structure> structure, const UString& string)
: JSWrapperObject(structure)
{
setInternalValue(jsString(exec, string));
@@ -61,6 +61,13 @@ bool StringObject::getOwnPropertySlot(ExecState* exec, unsigned propertyName, Pr
return JSObject::getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
}
+bool StringObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ if (internalValue()->getStringPropertyDescriptor(exec, propertyName, descriptor))
+ return true;
+ return JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+}
+
void StringObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
{
if (propertyName == exec->propertyNames().length)
@@ -75,27 +82,12 @@ bool StringObject::deleteProperty(ExecState* exec, const Identifier& propertyNam
return JSObject::deleteProperty(exec, propertyName);
}
-void StringObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
+void StringObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
{
int size = internalValue()->value().size();
for (int i = 0; i < size; ++i)
propertyNames.add(Identifier(exec, UString::from(i)));
- return JSObject::getPropertyNames(exec, propertyNames);
-}
-
-UString StringObject::toString(ExecState*) const
-{
- return internalValue()->value();
-}
-
-UString StringObject::toThisString(ExecState*) const
-{
- return internalValue()->value();
-}
-
-JSString* StringObject::toThisJSString(ExecState*)
-{
- return internalValue();
+ return JSObject::getOwnPropertyNames(exec, propertyNames);
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/StringObject.h b/JavaScriptCore/runtime/StringObject.h
index ea3a045..944f6ba 100644
--- a/JavaScriptCore/runtime/StringObject.h
+++ b/JavaScriptCore/runtime/StringObject.h
@@ -28,17 +28,18 @@ namespace JSC {
class StringObject : public JSWrapperObject {
public:
- StringObject(ExecState*, PassRefPtr<Structure>);
- StringObject(ExecState*, PassRefPtr<Structure>, const UString&);
+ StringObject(ExecState*, NonNullPassRefPtr<Structure>);
+ StringObject(ExecState*, NonNullPassRefPtr<Structure>, const UString&);
static StringObject* create(ExecState*, JSString*);
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void put(ExecState* exec, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
- virtual void getPropertyNames(ExecState*, PropertyNameArray&);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&);
virtual const ClassInfo* classInfo() const { return &info; }
static const JS_EXPORTDATA ClassInfo info;
@@ -51,12 +52,7 @@ namespace JSC {
}
protected:
- StringObject(PassRefPtr<Structure>, JSString*);
-
- private:
- virtual UString toString(ExecState*) const;
- virtual UString toThisString(ExecState*) const;
- virtual JSString* toThisJSString(ExecState*);
+ StringObject(NonNullPassRefPtr<Structure>, JSString*);
};
StringObject* asStringObject(JSValue);
diff --git a/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h b/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
index bc5c0a5..0cba83d 100644
--- a/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
+++ b/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
@@ -37,14 +37,14 @@ namespace JSC {
}
private:
- StringObjectThatMasqueradesAsUndefined(ExecState* exec, PassRefPtr<Structure> structure, const UString& string)
+ StringObjectThatMasqueradesAsUndefined(ExecState* exec, NonNullPassRefPtr<Structure> structure, const UString& string)
: StringObject(exec, structure, string)
{
}
static PassRefPtr<Structure> createStructure(JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, MasqueradesAsUndefined));
+ return Structure::create(proto, TypeInfo(ObjectType, MasqueradesAsUndefined | HasDefaultMark));
}
virtual bool toBoolean(ExecState*) const { return false; }
diff --git a/JavaScriptCore/runtime/StringPrototype.cpp b/JavaScriptCore/runtime/StringPrototype.cpp
index 531a302..b57732a 100644
--- a/JavaScriptCore/runtime/StringPrototype.cpp
+++ b/JavaScriptCore/runtime/StringPrototype.cpp
@@ -23,6 +23,8 @@
#include "StringPrototype.h"
#include "CachedCall.h"
+#include "Error.h"
+#include "Executable.h"
#include "JSArray.h"
#include "JSFunction.h"
#include "ObjectPrototype.h"
@@ -119,7 +121,7 @@ const ClassInfo StringPrototype::info = { "String", &StringObject::info, 0, Exec
*/
// ECMA 15.5.4
-StringPrototype::StringPrototype(ExecState* exec, PassRefPtr<Structure> structure)
+StringPrototype::StringPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure)
: StringObject(exec, structure)
{
// The constructor will be added later, after StringConstructor has been built
@@ -131,6 +133,11 @@ bool StringPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& prop
return getStaticFunctionSlot<StringObject>(exec, ExecState::stringTable(exec), this, propertyName, slot);
}
+bool StringPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticFunctionDescriptor<StringObject>(exec, ExecState::stringTable(exec), this, propertyName, descriptor);
+}
+
// ------------------------------ Functions --------------------------
static inline UString substituteBackreferences(const UString& replacement, const UString& source, const int* ovector, RegExp* reg)
@@ -220,7 +227,7 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec, JSObject*, JSValue
if (callType == CallTypeNone)
replacementString = replacement.toString(exec);
- if (pattern.isObject(&RegExpObject::info)) {
+ if (pattern.inherits(&RegExpObject::info)) {
RegExp* reg = asRegExpObject(pattern)->regExp();
bool global = reg->global();
@@ -365,7 +372,7 @@ JSValue JSC_HOST_CALL stringProtoFuncToString(ExecState* exec, JSObject*, JSValu
if (thisValue.isString())
return thisValue;
- if (thisValue.isObject(&StringObject::info))
+ if (thisValue.inherits(&StringObject::info))
return asStringObject(thisValue)->internalValue();
return throwError(exec, TypeError);
@@ -466,7 +473,7 @@ JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec, JSObject*, JSValue t
UString u = s;
RefPtr<RegExp> reg;
RegExpObject* imp = 0;
- if (a0.isObject(&RegExpObject::info))
+ if (a0.inherits(&RegExpObject::info))
reg = asRegExpObject(a0)->regExp();
else {
/*
@@ -516,7 +523,7 @@ JSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec, JSObject*, JSValue
UString u = s;
RefPtr<RegExp> reg;
- if (a0.isObject(&RegExpObject::info))
+ if (a0.inherits(&RegExpObject::info))
reg = asRegExpObject(a0)->regExp();
else {
/*
@@ -568,7 +575,7 @@ JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec, JSObject*, JSValue t
unsigned i = 0;
int p0 = 0;
unsigned limit = a1.isUndefined() ? 0xFFFFFFFFU : a1.toUInt32(exec);
- if (a0.isObject(&RegExpObject::info)) {
+ if (a0.inherits(&RegExpObject::info)) {
RegExp* reg = asRegExpObject(a0)->regExp();
if (s.isEmpty() && reg->match(s, 0) >= 0) {
// empty string matched by regexp -> empty array
@@ -821,8 +828,8 @@ JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec, JSObject*, JSValu
if (a0.getUInt32(smallInteger) && smallInteger <= 9) {
unsigned stringSize = s.size();
unsigned bufferSize = 22 + stringSize;
- UChar* buffer = static_cast<UChar*>(tryFastMalloc(bufferSize * sizeof(UChar)));
- if (!buffer)
+ UChar* buffer;
+ if (!tryFastMalloc(bufferSize * sizeof(UChar)).getValue(buffer))
return jsUndefined();
buffer[0] = '<';
buffer[1] = 'f';
@@ -869,8 +876,8 @@ JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec, JSObject*, JSValue th
unsigned linkTextSize = linkText.size();
unsigned stringSize = s.size();
unsigned bufferSize = 15 + linkTextSize + stringSize;
- UChar* buffer = static_cast<UChar*>(tryFastMalloc(bufferSize * sizeof(UChar)));
- if (!buffer)
+ UChar* buffer;
+ if (!tryFastMalloc(bufferSize * sizeof(UChar)).getValue(buffer))
return jsUndefined();
buffer[0] = '<';
buffer[1] = 'a';
diff --git a/JavaScriptCore/runtime/StringPrototype.h b/JavaScriptCore/runtime/StringPrototype.h
index 6f5344e..3a6a2a3 100644
--- a/JavaScriptCore/runtime/StringPrototype.h
+++ b/JavaScriptCore/runtime/StringPrototype.h
@@ -29,9 +29,10 @@ namespace JSC {
class StringPrototype : public StringObject {
public:
- StringPrototype(ExecState*, PassRefPtr<Structure>);
+ StringPrototype(ExecState*, NonNullPassRefPtr<Structure>);
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
diff --git a/JavaScriptCore/runtime/Structure.cpp b/JavaScriptCore/runtime/Structure.cpp
index 5dfd919..7209b5f 100644
--- a/JavaScriptCore/runtime/Structure.cpp
+++ b/JavaScriptCore/runtime/Structure.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * 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
@@ -127,17 +127,14 @@ Structure::Structure(JSValue prototype, const TypeInfo& typeInfo)
, m_propertyTable(0)
, m_propertyStorageCapacity(JSObject::inlineStorageCapacity)
, m_offset(noOffset)
- , m_isDictionary(false)
+ , m_dictionaryKind(NoneDictionaryKind)
, m_isPinnedPropertyTable(false)
, m_hasGetterSetterProperties(false)
- , m_usingSingleTransitionSlot(true)
, m_attributesInPrevious(0)
{
ASSERT(m_prototype);
ASSERT(m_prototype.isObject() || m_prototype.isNull());
- m_transitions.singleTransition = 0;
-
#ifndef NDEBUG
#if ENABLE(JSC_MULTIPLE_THREADS)
MutexLocker protect(ignoreSetMutex);
@@ -156,20 +153,16 @@ Structure::Structure(JSValue prototype, const TypeInfo& typeInfo)
Structure::~Structure()
{
if (m_previous) {
- if (m_previous->m_usingSingleTransitionSlot) {
- m_previous->m_transitions.singleTransition = 0;
- } else {
- ASSERT(m_previous->m_transitions.table->contains(make_pair(m_nameInPrevious.get(), make_pair(m_attributesInPrevious, m_specificValueInPrevious))));
- m_previous->m_transitions.table->remove(make_pair(m_nameInPrevious.get(), make_pair(m_attributesInPrevious, m_specificValueInPrevious)));
- }
+ if (m_nameInPrevious)
+ m_previous->table.remove(make_pair(m_nameInPrevious.get(), m_attributesInPrevious), m_specificValueInPrevious);
+ else
+ m_previous->table.removeAnonymousSlotTransition(m_anonymousSlotsInPrevious);
+
}
if (m_cachedPropertyNameArrayData)
m_cachedPropertyNameArrayData->setCachedStructure(0);
- if (!m_usingSingleTransitionSlot)
- delete m_transitions.table;
-
if (m_propertyTable) {
unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount;
for (unsigned i = 1; i <= entryCount; i++) {
@@ -279,15 +272,25 @@ void Structure::materializePropertyMap()
for (ptrdiff_t i = structures.size() - 2; i >= 0; --i) {
structure = structures[i];
+ if (!structure->m_nameInPrevious) {
+ m_propertyTable->anonymousSlotCount += structure->m_anonymousSlotsInPrevious;
+ continue;
+ }
structure->m_nameInPrevious->ref();
PropertyMapEntry entry(structure->m_nameInPrevious.get(), structure->m_offset, structure->m_attributesInPrevious, structure->m_specificValueInPrevious, ++m_propertyTable->lastIndexUsed);
insertIntoPropertyMapHashTable(entry);
}
}
+void Structure::getOwnEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject)
+{
+ getEnumerableNamesFromPropertyTable(propertyNames);
+ getEnumerableNamesFromClassInfoTable(exec, baseObject->classInfo(), propertyNames);
+}
+
void Structure::getEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject)
{
- bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || m_isDictionary);
+ bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || isDictionary());
if (shouldCache && m_cachedPropertyNameArrayData) {
if (m_cachedPropertyNameArrayData->cachedPrototypeChain() == prototypeChain(exec)) {
@@ -297,12 +300,22 @@ void Structure::getEnumerablePropertyNames(ExecState* exec, PropertyNameArray& p
clearEnumerationCache();
}
- getEnumerableNamesFromPropertyTable(propertyNames);
- getEnumerableNamesFromClassInfoTable(exec, baseObject->classInfo(), propertyNames);
+ baseObject->getOwnPropertyNames(exec, propertyNames);
if (m_prototype.isObject()) {
propertyNames.setShouldCache(false); // No need for our prototypes to waste memory on caching, since they're not being enumerated directly.
- asObject(m_prototype)->getPropertyNames(exec, propertyNames);
+ JSObject* prototype = asObject(m_prototype);
+ while(1) {
+ if (!prototype->structure()->typeInfo().hasDefaultGetPropertyNames()) {
+ prototype->getPropertyNames(exec, propertyNames);
+ break;
+ }
+ prototype->getOwnPropertyNames(exec, propertyNames);
+ JSValue nextProto = prototype->prototype();
+ if (!nextProto.isObject())
+ break;
+ prototype = asObject(nextProto);
+ }
}
if (shouldCache) {
@@ -336,7 +349,7 @@ void Structure::despecifyDictionaryFunction(const Identifier& propertyName)
materializePropertyMapIfNecessary();
- ASSERT(m_isDictionary);
+ ASSERT(isDictionary());
ASSERT(m_propertyTable);
unsigned i = rep->computedHash();
@@ -378,25 +391,13 @@ void Structure::despecifyDictionaryFunction(const Identifier& propertyName)
PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset)
{
- ASSERT(!structure->m_isDictionary);
+ ASSERT(!structure->isDictionary());
ASSERT(structure->typeInfo().type() == ObjectType);
- if (structure->m_usingSingleTransitionSlot) {
- Structure* existingTransition = structure->m_transitions.singleTransition;
- if (existingTransition && existingTransition->m_nameInPrevious.get() == propertyName.ustring().rep()
- && existingTransition->m_attributesInPrevious == attributes
- && existingTransition->m_specificValueInPrevious == specificValue) {
-
- ASSERT(structure->m_transitions.singleTransition->m_offset != noOffset);
- offset = structure->m_transitions.singleTransition->m_offset;
- return existingTransition;
- }
- } else {
- if (Structure* existingTransition = structure->m_transitions.table->get(make_pair(propertyName.ustring().rep(), make_pair(attributes, specificValue)))) {
- ASSERT(existingTransition->m_offset != noOffset);
- offset = existingTransition->m_offset;
- return existingTransition;
- }
+ if (Structure* existingTransition = structure->table.get(make_pair(propertyName.ustring().rep(), attributes), specificValue)) {
+ ASSERT(existingTransition->m_offset != noOffset);
+ offset = existingTransition->m_offset;
+ return existingTransition;
}
return 0;
@@ -404,12 +405,12 @@ PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Struct
PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset)
{
- ASSERT(!structure->m_isDictionary);
+ ASSERT(!structure->isDictionary());
ASSERT(structure->typeInfo().type() == ObjectType);
ASSERT(!Structure::addPropertyTransitionToExistingStructure(structure, propertyName, attributes, specificValue, offset));
if (structure->transitionCount() > s_maxTransitionLength) {
- RefPtr<Structure> transition = toDictionaryTransition(structure);
+ RefPtr<Structure> transition = toCacheableDictionaryTransition(structure);
ASSERT(structure != transition);
offset = transition->put(propertyName, attributes, specificValue);
if (transition->propertyStorageSize() > transition->propertyStorageCapacity())
@@ -447,27 +448,15 @@ PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, con
transition->m_offset = offset;
- if (structure->m_usingSingleTransitionSlot) {
- if (!structure->m_transitions.singleTransition) {
- structure->m_transitions.singleTransition = transition.get();
- return transition.release();
- }
-
- Structure* existingTransition = structure->m_transitions.singleTransition;
- structure->m_usingSingleTransitionSlot = false;
- StructureTransitionTable* transitionTable = new StructureTransitionTable;
- structure->m_transitions.table = transitionTable;
- transitionTable->add(make_pair(existingTransition->m_nameInPrevious.get(), make_pair(existingTransition->m_attributesInPrevious, existingTransition->m_specificValueInPrevious)), existingTransition);
- }
- structure->m_transitions.table->add(make_pair(propertyName.ustring().rep(), make_pair(attributes, specificValue)), transition.get());
+ structure->table.add(make_pair(propertyName.ustring().rep(), attributes), transition.get(), specificValue);
return transition.release();
}
PassRefPtr<Structure> Structure::removePropertyTransition(Structure* structure, const Identifier& propertyName, size_t& offset)
{
- ASSERT(!structure->m_isDictionary);
+ ASSERT(!structure->isUncacheableDictionary());
- RefPtr<Structure> transition = toDictionaryTransition(structure);
+ RefPtr<Structure> transition = toUncacheableDictionaryTransition(structure);
offset = transition->remove(propertyName);
@@ -509,6 +498,47 @@ PassRefPtr<Structure> Structure::despecifyFunctionTransition(Structure* structur
return transition.release();
}
+PassRefPtr<Structure> Structure::addAnonymousSlotsTransition(Structure* structure, unsigned count)
+{
+ if (Structure* transition = structure->table.getAnonymousSlotTransition(count)) {
+ ASSERT(transition->storedPrototype() == structure->storedPrototype());
+ return transition;
+ }
+ ASSERT(count);
+ ASSERT(count < ((1<<6) - 2));
+ RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo());
+
+ transition->m_cachedPrototypeChain = structure->m_cachedPrototypeChain;
+ transition->m_previous = structure;
+ transition->m_nameInPrevious = 0;
+ transition->m_attributesInPrevious = 0;
+ transition->m_anonymousSlotsInPrevious = count;
+ transition->m_specificValueInPrevious = 0;
+ transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity;
+ transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties;
+
+ if (structure->m_propertyTable) {
+ if (structure->m_isPinnedPropertyTable)
+ transition->m_propertyTable = structure->copyPropertyTable();
+ else {
+ transition->m_propertyTable = structure->m_propertyTable;
+ structure->m_propertyTable = 0;
+ }
+ } else {
+ if (structure->m_previous)
+ transition->materializePropertyMap();
+ else
+ transition->createPropertyMapHashTable();
+ }
+
+ transition->addAnonymousSlots(count);
+ if (transition->propertyStorageSize() > transition->propertyStorageCapacity())
+ transition->growPropertyStorageCapacity();
+
+ structure->table.addAnonymousSlotTransition(count, transition.get());
+ return transition.release();
+}
+
PassRefPtr<Structure> Structure::getterSetterTransition(Structure* structure)
{
RefPtr<Structure> transition = create(structure->storedPrototype(), structure->typeInfo());
@@ -524,25 +554,35 @@ PassRefPtr<Structure> Structure::getterSetterTransition(Structure* structure)
return transition.release();
}
-PassRefPtr<Structure> Structure::toDictionaryTransition(Structure* structure)
+PassRefPtr<Structure> Structure::toDictionaryTransition(Structure* structure, DictionaryKind kind)
{
- ASSERT(!structure->m_isDictionary);
-
+ ASSERT(!structure->isUncacheableDictionary());
+
RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo());
- transition->m_isDictionary = true;
+ transition->m_dictionaryKind = kind;
transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity;
transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties;
-
+
structure->materializePropertyMapIfNecessary();
transition->m_propertyTable = structure->copyPropertyTable();
transition->m_isPinnedPropertyTable = true;
-
+
return transition.release();
}
+PassRefPtr<Structure> Structure::toCacheableDictionaryTransition(Structure* structure)
+{
+ return toDictionaryTransition(structure, CachedDictionaryKind);
+}
+
+PassRefPtr<Structure> Structure::toUncacheableDictionaryTransition(Structure* structure)
+{
+ return toDictionaryTransition(structure, UncachedDictionaryKind);
+}
+
PassRefPtr<Structure> Structure::fromDictionaryTransition(Structure* structure)
{
- ASSERT(structure->m_isDictionary);
+ ASSERT(structure->isDictionary());
// Since dictionary Structures are not shared, and no opcodes specialize
// for them, we don't need to allocate a new Structure when transitioning
@@ -551,15 +591,13 @@ PassRefPtr<Structure> Structure::fromDictionaryTransition(Structure* structure)
// FIMXE: We can make this more efficient by canonicalizing the Structure (draining the
// deleted offsets vector) before transitioning from dictionary.
if (!structure->m_propertyTable || !structure->m_propertyTable->deletedOffsets || structure->m_propertyTable->deletedOffsets->isEmpty())
- structure->m_isDictionary = false;
+ structure->m_dictionaryKind = NoneDictionaryKind;
return structure;
}
size_t Structure::addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes, JSCell* specificValue)
{
- ASSERT(!m_transitions.singleTransition);
-
materializePropertyMapIfNecessary();
m_isPinnedPropertyTable = true;
@@ -572,8 +610,7 @@ size_t Structure::addPropertyWithoutTransition(const Identifier& propertyName, u
size_t Structure::removePropertyWithoutTransition(const Identifier& propertyName)
{
- ASSERT(!m_transitions.singleTransition);
- ASSERT(m_isDictionary);
+ ASSERT(isUncacheableDictionary());
materializePropertyMapIfNecessary();
@@ -636,6 +673,7 @@ PropertyMapHashTable* Structure::copyPropertyTable()
if (m_propertyTable->deletedOffsets)
newTable->deletedOffsets = new Vector<unsigned>(*m_propertyTable->deletedOffsets);
+ newTable->anonymousSlotCount = m_propertyTable->anonymousSlotCount;
return newTable;
}
@@ -815,7 +853,7 @@ size_t Structure::put(const Identifier& propertyName, unsigned attributes, JSCel
newOffset = m_propertyTable->deletedOffsets->last();
m_propertyTable->deletedOffsets->removeLast();
} else
- newOffset = m_propertyTable->keyCount;
+ newOffset = m_propertyTable->keyCount + m_propertyTable->anonymousSlotCount;
m_propertyTable->entries()[entryIndex - 1].offset = newOffset;
++m_propertyTable->keyCount;
@@ -827,6 +865,16 @@ size_t Structure::put(const Identifier& propertyName, unsigned attributes, JSCel
return newOffset;
}
+void Structure::addAnonymousSlots(unsigned count)
+{
+ m_propertyTable->anonymousSlotCount += count;
+}
+
+bool Structure::hasTransition(UString::Rep* rep, unsigned attributes)
+{
+ return table.hasTransition(make_pair(rep, attributes));
+}
+
size_t Structure::remove(const Identifier& propertyName)
{
ASSERT(!propertyName.isNull());
@@ -980,6 +1028,7 @@ void Structure::rehashPropertyMapHashTable(unsigned newTableSize)
m_propertyTable = static_cast<PropertyMapHashTable*>(fastZeroedMalloc(PropertyMapHashTable::allocationSize(newTableSize)));
m_propertyTable->size = newTableSize;
m_propertyTable->sizeMask = newTableSize - 1;
+ m_propertyTable->anonymousSlotCount = oldTable->anonymousSlotCount;
unsigned lastIndexUsed = 0;
unsigned entryCount = oldTable->keyCount + oldTable->deletedSentinelCount;
diff --git a/JavaScriptCore/runtime/Structure.h b/JavaScriptCore/runtime/Structure.h
index f3a0c7c..ed9f6e5 100644
--- a/JavaScriptCore/runtime/Structure.h
+++ b/JavaScriptCore/runtime/Structure.h
@@ -29,11 +29,10 @@
#include "Identifier.h"
#include "JSType.h"
#include "JSValue.h"
-#include "MarkStack.h"
#include "PropertyMapHashTable.h"
#include "StructureChain.h"
#include "StructureTransitionTable.h"
-#include "TypeInfo.h"
+#include "JSTypeInfo.h"
#include "UString.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -46,12 +45,14 @@
namespace JSC {
+ class MarkStack;
class PropertyNameArray;
class PropertyNameArrayData;
class Structure : public RefCounted<Structure> {
public:
friend class JIT;
+ friend class StructureTransitionTable;
static PassRefPtr<Structure> create(JSValue prototype, const TypeInfo& typeInfo)
{
return adoptRef(new Structure(prototype, typeInfo));
@@ -66,24 +67,24 @@ namespace JSC {
static PassRefPtr<Structure> addPropertyTransitionToExistingStructure(Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset);
static PassRefPtr<Structure> removePropertyTransition(Structure*, const Identifier& propertyName, size_t& offset);
static PassRefPtr<Structure> changePrototypeTransition(Structure*, JSValue prototype);
- static PassRefPtr<Structure> despecifyFunctionTransition(Structure*, const Identifier&);
+ static PassRefPtr<Structure> despecifyFunctionTransition(Structure*, const Identifier&);
+ static PassRefPtr<Structure> addAnonymousSlotsTransition(Structure*, unsigned count);
static PassRefPtr<Structure> getterSetterTransition(Structure*);
- static PassRefPtr<Structure> toDictionaryTransition(Structure*);
+ static PassRefPtr<Structure> toCacheableDictionaryTransition(Structure*);
+ static PassRefPtr<Structure> toUncacheableDictionaryTransition(Structure*);
static PassRefPtr<Structure> fromDictionaryTransition(Structure*);
~Structure();
- void markAggregate(MarkStack& markStack)
- {
- markStack.append(m_prototype);
- }
+ void markAggregate(MarkStack&);
// These should be used with caution.
size_t addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes, JSCell* specificValue);
size_t removePropertyWithoutTransition(const Identifier& propertyName);
void setPrototypeWithoutTransition(JSValue prototype) { m_prototype = prototype; }
-
- bool isDictionary() const { return m_isDictionary; }
+
+ bool isDictionary() const { return m_dictionaryKind != NoneDictionaryKind; }
+ bool isUncacheableDictionary() const { return m_dictionaryKind == UncachedDictionaryKind; }
const TypeInfo& typeInfo() const { return m_typeInfo; }
@@ -95,7 +96,7 @@ namespace JSC {
void growPropertyStorageCapacity();
size_t propertyStorageCapacity() const { return m_propertyStorageCapacity; }
- size_t propertyStorageSize() const { return m_propertyTable ? m_propertyTable->keyCount + (m_propertyTable->deletedOffsets ? m_propertyTable->deletedOffsets->size() : 0) : m_offset + 1; }
+ size_t propertyStorageSize() const { return m_propertyTable ? m_propertyTable->keyCount + m_propertyTable->anonymousSlotCount + (m_propertyTable->deletedOffsets ? m_propertyTable->deletedOffsets->size() : 0) : m_offset + 1; }
bool isUsingInlineStorage() const;
size_t get(const Identifier& propertyName);
@@ -103,10 +104,20 @@ namespace JSC {
size_t get(const Identifier& propertyName, unsigned& attributes, JSCell*& specificValue)
{
ASSERT(!propertyName.isNull());
- return get(propertyName._ustring.rep(), attributes, specificValue);
+ return get(propertyName.ustring().rep(), attributes, specificValue);
+ }
+ bool transitionedFor(const JSCell* specificValue)
+ {
+ return m_specificValueInPrevious == specificValue;
+ }
+ bool hasTransition(UString::Rep*, unsigned attributes);
+ bool hasTransition(const Identifier& propertyName, unsigned attributes)
+ {
+ return hasTransition(propertyName._ustring.rep(), attributes);
}
void getEnumerablePropertyNames(ExecState*, PropertyNameArray&, JSObject*);
+ void getOwnEnumerablePropertyNames(ExecState*, PropertyNameArray&, JSObject*);
bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; }
void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; }
@@ -118,9 +129,17 @@ namespace JSC {
private:
Structure(JSValue prototype, const TypeInfo&);
+
+ typedef enum {
+ NoneDictionaryKind = 0,
+ CachedDictionaryKind = 1,
+ UncachedDictionaryKind = 2
+ } DictionaryKind;
+ static PassRefPtr<Structure> toDictionaryTransition(Structure*, DictionaryKind);
size_t put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue);
size_t remove(const Identifier& propertyName);
+ void addAnonymousSlots(unsigned slotCount);
void getEnumerableNamesFromPropertyTable(PropertyNameArray&);
void getEnumerableNamesFromClassInfoTable(ExecState*, const ClassInfo*, PropertyNameArray&);
@@ -166,13 +185,10 @@ namespace JSC {
RefPtr<Structure> m_previous;
RefPtr<UString::Rep> m_nameInPrevious;
-
- union {
- Structure* singleTransition;
- StructureTransitionTable* table;
- } m_transitions;
JSCell* m_specificValueInPrevious;
+ StructureTransitionTable table;
+
RefPtr<PropertyNameArrayData> m_cachedPropertyNameArrayData;
PropertyMapHashTable* m_propertyTable;
@@ -180,11 +196,18 @@ namespace JSC {
size_t m_propertyStorageCapacity;
signed char m_offset;
- bool m_isDictionary : 1;
+ unsigned m_dictionaryKind : 2;
bool m_isPinnedPropertyTable : 1;
bool m_hasGetterSetterProperties : 1;
- bool m_usingSingleTransitionSlot : 1;
+#if COMPILER(WINSCW)
+ // Workaround for Symbian WINSCW compiler that cannot resolve unsigned type of the declared
+ // bitfield, when used as argument in make_pair() function calls in structure.ccp.
+ // This bitfield optimization is insignificant for the Symbian emulator target.
+ unsigned m_attributesInPrevious;
+#else
unsigned m_attributesInPrevious : 7;
+#endif
+ unsigned m_anonymousSlotsInPrevious : 6;
};
inline size_t Structure::get(const Identifier& propertyName)
@@ -231,7 +254,58 @@ namespace JSC {
return m_propertyTable->entries()[entryIndex - 1].offset;
}
}
+
+ bool StructureTransitionTable::contains(const StructureTransitionTableHash::Key& key, JSCell* specificValue)
+ {
+ if (usingSingleTransitionSlot()) {
+ Structure* existingTransition = singleTransition();
+ return existingTransition && existingTransition->m_nameInPrevious.get() == key.first
+ && existingTransition->m_attributesInPrevious == key.second
+ && (existingTransition->m_specificValueInPrevious == specificValue || existingTransition->m_specificValueInPrevious == 0);
+ }
+ TransitionTable::iterator find = table()->find(key);
+ if (find == table()->end())
+ return false;
+
+ return find->second.first || find->second.second->transitionedFor(specificValue);
+ }
+
+ Structure* StructureTransitionTable::get(const StructureTransitionTableHash::Key& key, JSCell* specificValue) const
+ {
+ if (usingSingleTransitionSlot()) {
+ Structure* existingTransition = singleTransition();
+ if (existingTransition && existingTransition->m_nameInPrevious.get() == key.first
+ && existingTransition->m_attributesInPrevious == key.second
+ && (existingTransition->m_specificValueInPrevious == specificValue || existingTransition->m_specificValueInPrevious == 0))
+ return existingTransition;
+ return 0;
+ }
+
+ Transition transition = table()->get(key);
+ if (transition.second && transition.second->transitionedFor(specificValue))
+ return transition.second;
+ return transition.first;
+ }
+ bool StructureTransitionTable::hasTransition(const StructureTransitionTableHash::Key& key) const
+ {
+ if (usingSingleTransitionSlot()) {
+ Structure* transition = singleTransition();
+ return transition && transition->m_nameInPrevious == key.first
+ && transition->m_attributesInPrevious == key.second;
+ }
+ return table()->contains(key);
+ }
+
+ void StructureTransitionTable::reifySingleTransition()
+ {
+ ASSERT(usingSingleTransitionSlot());
+ Structure* existingTransition = singleTransition();
+ TransitionTable* transitionTable = new TransitionTable;
+ setTransitionTable(transitionTable);
+ if (existingTransition)
+ add(make_pair(existingTransition->m_nameInPrevious.get(), existingTransition->m_attributesInPrevious), existingTransition, existingTransition->m_specificValueInPrevious);
+ }
} // namespace JSC
#endif // Structure_h
diff --git a/JavaScriptCore/runtime/StructureChain.cpp b/JavaScriptCore/runtime/StructureChain.cpp
index 85049b1..6e8a0ee 100644
--- a/JavaScriptCore/runtime/StructureChain.cpp
+++ b/JavaScriptCore/runtime/StructureChain.cpp
@@ -51,7 +51,10 @@ bool StructureChain::isCacheable() const
uint32_t i = 0;
while (m_vector[i]) {
- if (m_vector[i++]->isDictionary())
+ // Both classes of dictionary structure may change arbitrarily so we can't cache them
+ if (m_vector[i]->isDictionary())
+ return false;
+ if (!m_vector[i++]->typeInfo().hasDefaultGetPropertyNames())
return false;
}
return true;
diff --git a/JavaScriptCore/runtime/StructureTransitionTable.h b/JavaScriptCore/runtime/StructureTransitionTable.h
index 804cbeb..0fa7b73 100644
--- a/JavaScriptCore/runtime/StructureTransitionTable.h
+++ b/JavaScriptCore/runtime/StructureTransitionTable.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * 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
@@ -30,6 +30,8 @@
#include <wtf/HashFunctions.h>
#include <wtf/HashMap.h>
#include <wtf/HashTraits.h>
+#include <wtf/PtrAndFlags.h>
+#include <wtf/OwnPtr.h>
#include <wtf/RefPtr.h>
namespace JSC {
@@ -37,7 +39,7 @@ namespace JSC {
class Structure;
struct StructureTransitionTableHash {
- typedef std::pair<RefPtr<UString::Rep>, std::pair<unsigned, JSCell*> > Key;
+ typedef std::pair<RefPtr<UString::Rep>, unsigned> Key;
static unsigned hash(const Key& p)
{
return p.first->computedHash();
@@ -53,20 +55,159 @@ namespace JSC {
struct StructureTransitionTableHashTraits {
typedef WTF::HashTraits<RefPtr<UString::Rep> > FirstTraits;
- typedef WTF::GenericHashTraits<unsigned> SecondFirstTraits;
- typedef WTF::GenericHashTraits<JSCell*> SecondSecondTraits;
- typedef std::pair<FirstTraits::TraitType, std::pair<SecondFirstTraits::TraitType, SecondSecondTraits::TraitType> > TraitType;
+ typedef WTF::GenericHashTraits<unsigned> SecondTraits;
+ typedef std::pair<FirstTraits::TraitType, SecondTraits::TraitType > TraitType;
- static const bool emptyValueIsZero = FirstTraits::emptyValueIsZero && SecondFirstTraits::emptyValueIsZero && SecondSecondTraits::emptyValueIsZero;
- static TraitType emptyValue() { return std::make_pair(FirstTraits::emptyValue(), std::make_pair(SecondFirstTraits::emptyValue(), SecondSecondTraits::emptyValue())); }
+ static const bool emptyValueIsZero = FirstTraits::emptyValueIsZero && SecondTraits::emptyValueIsZero;
+ static TraitType emptyValue() { return std::make_pair(FirstTraits::emptyValue(), SecondTraits::emptyValue()); }
- static const bool needsDestruction = FirstTraits::needsDestruction || SecondFirstTraits::needsDestruction || SecondSecondTraits::needsDestruction;
+ static const bool needsDestruction = FirstTraits::needsDestruction || SecondTraits::needsDestruction;
static void constructDeletedValue(TraitType& slot) { FirstTraits::constructDeletedValue(slot.first); }
static bool isDeletedValue(const TraitType& value) { return FirstTraits::isDeletedValue(value.first); }
};
- typedef HashMap<StructureTransitionTableHash::Key, Structure*, StructureTransitionTableHash, StructureTransitionTableHashTraits> StructureTransitionTable;
+ class StructureTransitionTable {
+ typedef std::pair<Structure*, Structure*> Transition;
+ struct TransitionTable : public HashMap<StructureTransitionTableHash::Key, Transition, StructureTransitionTableHash, StructureTransitionTableHashTraits> {
+ typedef HashMap<unsigned, Structure*> AnonymousSlotMap;
+
+ void addSlotTransition(unsigned count, Structure* structure)
+ {
+ ASSERT(!getSlotTransition(count));
+ if (!m_anonymousSlotTable)
+ m_anonymousSlotTable.set(new AnonymousSlotMap);
+ m_anonymousSlotTable->add(count, structure);
+ }
+
+ void removeSlotTransition(unsigned count)
+ {
+ ASSERT(getSlotTransition(count));
+ m_anonymousSlotTable->remove(count);
+ }
+
+ Structure* getSlotTransition(unsigned count)
+ {
+ if (!m_anonymousSlotTable)
+ return 0;
+
+ AnonymousSlotMap::iterator find = m_anonymousSlotTable->find(count);
+ if (find == m_anonymousSlotTable->end())
+ return 0;
+ return find->second;
+ }
+ private:
+ OwnPtr<AnonymousSlotMap> m_anonymousSlotTable;
+ };
+ public:
+ StructureTransitionTable() {
+ m_transitions.m_singleTransition.set(0);
+ m_transitions.m_singleTransition.setFlag(usingSingleSlot);
+ }
+
+ ~StructureTransitionTable() {
+ if (!usingSingleTransitionSlot())
+ delete table();
+ }
+
+ // The contains and get methods accept imprecise matches, so if an unspecialised transition exists
+ // for the given key they will consider that transition to be a match. If a specialised transition
+ // exists and it matches the provided specificValue, get will return the specific transition.
+ inline bool contains(const StructureTransitionTableHash::Key&, JSCell* specificValue);
+ inline Structure* get(const StructureTransitionTableHash::Key&, JSCell* specificValue) const;
+ inline bool hasTransition(const StructureTransitionTableHash::Key& key) const;
+ void remove(const StructureTransitionTableHash::Key& key, JSCell* specificValue)
+ {
+ if (usingSingleTransitionSlot()) {
+ ASSERT(contains(key, specificValue));
+ setSingleTransition(0);
+ return;
+ }
+ TransitionTable::iterator find = table()->find(key);
+ if (!specificValue)
+ find->second.first = 0;
+ else
+ find->second.second = 0;
+ if (!find->second.first && !find->second.second)
+ table()->remove(find);
+ }
+ void add(const StructureTransitionTableHash::Key& key, Structure* structure, JSCell* specificValue)
+ {
+ if (usingSingleTransitionSlot()) {
+ if (!singleTransition()) {
+ setSingleTransition(structure);
+ return;
+ }
+ reifySingleTransition();
+ }
+ if (!specificValue) {
+ TransitionTable::iterator find = table()->find(key);
+ if (find == table()->end())
+ table()->add(key, Transition(structure, 0));
+ else
+ find->second.first = structure;
+ } else {
+ // If we're adding a transition to a specific value, then there cannot be
+ // an existing transition
+ ASSERT(!table()->contains(key));
+ table()->add(key, Transition(0, structure));
+ }
+ }
+
+ Structure* getAnonymousSlotTransition(unsigned count)
+ {
+ if (usingSingleTransitionSlot())
+ return 0;
+ return table()->getSlotTransition(count);
+ }
+
+ void addAnonymousSlotTransition(unsigned count, Structure* structure)
+ {
+ if (usingSingleTransitionSlot())
+ reifySingleTransition();
+ ASSERT(!table()->getSlotTransition(count));
+ table()->addSlotTransition(count, structure);
+ }
+
+ void removeAnonymousSlotTransition(unsigned count)
+ {
+ ASSERT(!usingSingleTransitionSlot());
+ table()->removeSlotTransition(count);
+ }
+ private:
+ TransitionTable* table() const { ASSERT(!usingSingleTransitionSlot()); return m_transitions.m_table; }
+ Structure* singleTransition() const {
+ ASSERT(usingSingleTransitionSlot());
+ return m_transitions.m_singleTransition.get();
+ }
+ bool usingSingleTransitionSlot() const { return m_transitions.m_singleTransition.isFlagSet(usingSingleSlot); }
+ void setSingleTransition(Structure* structure)
+ {
+ ASSERT(usingSingleTransitionSlot());
+ m_transitions.m_singleTransition.set(structure);
+ }
+
+ void setTransitionTable(TransitionTable* table)
+ {
+ ASSERT(usingSingleTransitionSlot());
+#ifndef NDEBUG
+ setSingleTransition(0);
+#endif
+ m_transitions.m_table = table;
+ // This implicitly clears the flag that indicates we're using a single transition
+ ASSERT(!usingSingleTransitionSlot());
+ }
+ inline void reifySingleTransition();
+
+ enum UsingSingleSlot {
+ usingSingleSlot
+ };
+ // Last bit indicates whether we are using the single transition optimisation
+ union {
+ TransitionTable* m_table;
+ PtrAndFlagsBase<Structure, UsingSingleSlot> m_singleTransition;
+ } m_transitions;
+ };
} // namespace JSC
diff --git a/JavaScriptCore/runtime/SymbolTable.h b/JavaScriptCore/runtime/SymbolTable.h
index c00f95a..f5e2669 100644
--- a/JavaScriptCore/runtime/SymbolTable.h
+++ b/JavaScriptCore/runtime/SymbolTable.h
@@ -121,6 +121,10 @@ namespace JSC {
typedef HashMap<RefPtr<UString::Rep>, SymbolTableEntry, IdentifierRepHash, HashTraits<RefPtr<UString::Rep> >, SymbolTableIndexHashTraits> SymbolTable;
+ class SharedSymbolTable : public SymbolTable, public RefCounted<SharedSymbolTable>
+ {
+ };
+
} // namespace JSC
#endif // SymbolTable_h
diff --git a/JavaScriptCore/runtime/TimeoutChecker.cpp b/JavaScriptCore/runtime/TimeoutChecker.cpp
index 30ba6e9..2a056c9 100644
--- a/JavaScriptCore/runtime/TimeoutChecker.cpp
+++ b/JavaScriptCore/runtime/TimeoutChecker.cpp
@@ -35,18 +35,10 @@
#if PLATFORM(DARWIN)
#include <mach/mach.h>
-#endif
-
-#if HAVE(SYS_TIME_H)
-#include <sys/time.h>
-#endif
-
-#if PLATFORM(WIN_OS)
+#elif PLATFORM(WIN_OS)
#include <windows.h>
-#endif
-
-#if PLATFORM(QT)
-#include <QDateTime>
+#else
+#include "CurrentTime.h"
#endif
using namespace std;
@@ -75,14 +67,6 @@ static inline unsigned getCPUTime()
time += info.system_time.seconds * 1000 + info.system_time.microseconds / 1000;
return time;
-#elif HAVE(SYS_TIME_H)
- // FIXME: This should probably use getrusage with the RUSAGE_THREAD flag.
- struct timeval tv;
- gettimeofday(&tv, 0);
- return tv.tv_sec * 1000 + tv.tv_usec / 1000;
-#elif PLATFORM(QT)
- QDateTime t = QDateTime::currentDateTime();
- return t.toTime_t() * 1000 + t.time().msec();
#elif PLATFORM(WIN_OS)
union {
FILETIME fileTime;
@@ -97,7 +81,8 @@ static inline unsigned getCPUTime()
return userTime.fileTimeAsLong / 10000 + kernelTime.fileTimeAsLong / 10000;
#else
-#error Platform does not have getCurrentTime function
+ // FIXME: We should return the time the current thread has spent executing.
+ return currentTime() * 1000;
#endif
}
diff --git a/JavaScriptCore/runtime/UString.cpp b/JavaScriptCore/runtime/UString.cpp
index 118751e..e66ca93 100644
--- a/JavaScriptCore/runtime/UString.cpp
+++ b/JavaScriptCore/runtime/UString.cpp
@@ -32,14 +32,17 @@
#include <ctype.h>
#include <float.h>
#include <limits.h>
+#include <limits>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <wtf/ASCIICType.h>
#include <wtf/Assertions.h>
#include <wtf/MathExtras.h>
+#include <wtf/StringExtras.h>
#include <wtf/Vector.h>
#include <wtf/unicode/UTF8.h>
+#include <wtf/StringExtras.h>
#if HAVE(STRING_H)
#include <string.h>
@@ -68,20 +71,20 @@ static const int minLengthToShare = 10;
static inline size_t overflowIndicator() { return std::numeric_limits<size_t>::max(); }
static inline size_t maxUChars() { return std::numeric_limits<size_t>::max() / sizeof(UChar); }
-static inline UChar* allocChars(size_t length)
+static inline PossiblyNull<UChar*> allocChars(size_t length)
{
ASSERT(length);
if (length > maxUChars())
return 0;
- return static_cast<UChar*>(tryFastMalloc(sizeof(UChar) * length));
+ return tryFastMalloc(sizeof(UChar) * length);
}
-static inline UChar* reallocChars(UChar* buffer, size_t length)
+static inline PossiblyNull<UChar*> reallocChars(UChar* buffer, size_t length)
{
ASSERT(length);
if (length > maxUChars())
return 0;
- return static_cast<UChar*>(tryFastRealloc(buffer, sizeof(UChar) * length));
+ return tryFastRealloc(buffer, sizeof(UChar) * length);
}
static inline void copyChars(UChar* destination, const UChar* source, unsigned numCharacters)
@@ -480,8 +483,7 @@ static inline bool expandCapacity(UString::Rep* rep, int requiredLength)
if (requiredLength > base->capacity) {
size_t newCapacity = expandedSize(requiredLength, base->preCapacity);
UChar* oldBuf = base->buf;
- base->buf = reallocChars(base->buf, newCapacity);
- if (!base->buf) {
+ if (!reallocChars(base->buf, newCapacity).getValue(base->buf)) {
base->buf = oldBuf;
return false;
}
@@ -512,8 +514,7 @@ bool UString::Rep::reserveCapacity(int capacity)
size_t newCapacity = expandedSize(capacity, base->preCapacity);
UChar* oldBuf = base->buf;
- base->buf = reallocChars(base->buf, newCapacity);
- if (!base->buf) {
+ if (!reallocChars(base->buf, newCapacity).getValue(base->buf)) {
base->buf = oldBuf;
return false;
}
@@ -540,8 +541,8 @@ void UString::expandPreCapacity(int requiredPreCap)
size_t newCapacity = expandedSize(requiredPreCap, base->capacity);
int delta = newCapacity - base->capacity - base->preCapacity;
- UChar* newBuf = allocChars(newCapacity);
- if (!newBuf) {
+ UChar* newBuf;
+ if (!allocChars(newCapacity).getValue(newBuf)) {
makeNull();
return;
}
@@ -566,8 +567,8 @@ static PassRefPtr<UString::Rep> createRep(const char* c)
return &UString::Rep::empty();
size_t length = strlen(c);
- UChar* d = allocChars(length);
- if (!d)
+ UChar* d;
+ if (!allocChars(length).getValue(d))
return &UString::Rep::null();
else {
for (size_t i = 0; i < length; i++)
@@ -656,8 +657,8 @@ static ALWAYS_INLINE PassRefPtr<UString::Rep> concatenate(PassRefPtr<UString::Re
} else {
// This is shared in some way that prevents us from modifying base, so we must make a whole new string.
size_t newCapacity = expandedSize(length, 0);
- UChar* d = allocChars(newCapacity);
- if (!d)
+ UChar* d;
+ if (!allocChars(newCapacity).getValue(d))
rep = &UString::Rep::null();
else {
copyChars(d, rep->data(), thisSize);
@@ -712,8 +713,8 @@ static ALWAYS_INLINE PassRefPtr<UString::Rep> concatenate(PassRefPtr<UString::Re
} else {
// This is shared in some way that prevents us from modifying base, so we must make a whole new string.
size_t newCapacity = expandedSize(length, 0);
- UChar* d = allocChars(newCapacity);
- if (!d)
+ UChar* d;
+ if (!allocChars(newCapacity).getValue(d))
rep = &UString::Rep::null();
else {
copyChars(d, rep->data(), thisSize);
@@ -800,8 +801,8 @@ PassRefPtr<UString::Rep> concatenate(UString::Rep* a, UString::Rep* b)
// a does not qualify for append, and b does not qualify for prepend, gotta make a whole new string
size_t newCapacity = expandedSize(length, 0);
- UChar* d = allocChars(newCapacity);
- if (!d)
+ UChar* d;
+ if (!allocChars(newCapacity).getValue(d))
return 0;
copyChars(d, a->data(), aSize);
copyChars(d + aSize, b->data(), bSize);
@@ -942,6 +943,39 @@ UString UString::from(int i)
return UString(p, static_cast<int>(end - p));
}
+UString UString::from(long long i)
+{
+ UChar buf[1 + sizeof(i) * 3];
+ UChar* end = buf + sizeof(buf) / sizeof(UChar);
+ UChar* p = end;
+
+ if (i == 0)
+ *--p = '0';
+ else if (i == std::numeric_limits<long long>::min()) {
+ char minBuf[1 + sizeof(i) * 3];
+#if PLATFORM(WIN_OS)
+ snprintf(minBuf, sizeof(minBuf) - 1, "%I64d", std::numeric_limits<long long>::min());
+#else
+ snprintf(minBuf, sizeof(minBuf) - 1, "%lld", std::numeric_limits<long long>::min());
+#endif
+ return UString(minBuf);
+ } else {
+ bool negative = false;
+ if (i < 0) {
+ negative = true;
+ i = -i;
+ }
+ while (i) {
+ *--p = static_cast<unsigned short>((i % 10) + '0');
+ i /= 10;
+ }
+ if (negative)
+ *--p = '-';
+ }
+
+ return UString(p, static_cast<int>(end - p));
+}
+
UString UString::from(unsigned int u)
{
UChar buf[sizeof(u) * 3];
@@ -994,6 +1028,8 @@ UString UString::from(double d)
// avoid ever printing -NaN, in JS conceptually there is only one NaN value
if (isnan(d))
return "NaN";
+ if (!d)
+ return "0"; // -0 -> "0"
char buf[80];
int decimalPoint;
@@ -1076,8 +1112,8 @@ UString UString::spliceSubstringsWithSeparators(const Range* substringRanges, in
if (totalLength == 0)
return "";
- UChar* buffer = allocChars(totalLength);
- if (!buffer)
+ UChar* buffer;
+ if (!allocChars(totalLength).getValue(buffer))
return null();
int maxCount = max(rangeCount, separatorCount);
@@ -1105,8 +1141,8 @@ UString UString::replaceRange(int rangeStart, int rangeLength, const UString& re
if (totalLength == 0)
return "";
- UChar* buffer = allocChars(totalLength);
- if (!buffer)
+ UChar* buffer;
+ if (!allocChars(totalLength).getValue(buffer))
return null();
copyChars(buffer, data(), rangeStart);
@@ -1153,8 +1189,8 @@ UString& UString::append(const UString &t)
} else {
// This is shared in some way that prevents us from modifying base, so we must make a whole new string.
size_t newCapacity = expandedSize(length, 0);
- UChar* d = allocChars(newCapacity);
- if (!d)
+ UChar* d;
+ if (!allocChars(newCapacity).getValue(d))
makeNull();
else {
copyChars(d, data(), thisSize);
@@ -1176,18 +1212,6 @@ UString& UString::append(const UChar* tData, int tSize)
return *this;
}
-UString& UString::appendNumeric(int i)
-{
- m_rep = concatenate(rep(), i);
- return *this;
-}
-
-UString& UString::appendNumeric(double d)
-{
- m_rep = concatenate(rep(), d);
- return *this;
-}
-
UString& UString::append(const char* t)
{
m_rep = concatenate(m_rep.release(), t);
@@ -1206,8 +1230,8 @@ UString& UString::append(UChar c)
if (length == 0) {
// this is empty - must make a new m_rep because we don't want to pollute the shared empty one
size_t newCapacity = expandedSize(1, 0);
- UChar* d = allocChars(newCapacity);
- if (!d)
+ UChar* d;
+ if (!allocChars(newCapacity).getValue(d))
makeNull();
else {
d[0] = c;
@@ -1234,8 +1258,8 @@ UString& UString::append(UChar c)
} else {
// This is shared in some way that prevents us from modifying base, so we must make a whole new string.
size_t newCapacity = expandedSize(length + 1, 0);
- UChar* d = allocChars(newCapacity);
- if (!d)
+ UChar* d;
+ if (!allocChars(newCapacity).getValue(d))
makeNull();
else {
copyChars(d, data(), length);
@@ -1313,8 +1337,7 @@ UString& UString::operator=(const char* c)
m_rep->_hash = 0;
m_rep->len = l;
} else {
- d = allocChars(l);
- if (!d) {
+ if (!allocChars(l).getValue(d)) {
makeNull();
return *this;
}
diff --git a/JavaScriptCore/runtime/UString.h b/JavaScriptCore/runtime/UString.h
index d01b75d..c4dad2a 100644
--- a/JavaScriptCore/runtime/UString.h
+++ b/JavaScriptCore/runtime/UString.h
@@ -91,7 +91,8 @@ namespace JSC {
{
// Guard against integer overflow
if (size < (std::numeric_limits<size_t>::max() / sizeof(UChar))) {
- if (void * buf = tryFastMalloc(size * sizeof(UChar)))
+ void* buf = 0;
+ if (tryFastMalloc(size * sizeof(UChar)).getValue(buf))
return adoptRef(new BaseString(static_cast<UChar*>(buf), 0, size));
}
return adoptRef(new BaseString(0, 0, 0));
@@ -256,6 +257,7 @@ namespace JSC {
}
static UString from(int);
+ static UString from(long long);
static UString from(unsigned int);
static UString from(long);
static UString from(double);
@@ -285,8 +287,6 @@ namespace JSC {
UString& append(UChar);
UString& append(char c) { return append(static_cast<UChar>(static_cast<unsigned char>(c))); }
UString& append(const UChar*, int size);
- UString& appendNumeric(int);
- UString& appendNumeric(double);
bool getCString(CStringBuffer&) const;
diff --git a/JavaScriptCore/wrec/WRECGenerator.cpp b/JavaScriptCore/wrec/WRECGenerator.cpp
index e2e8aba..e62add3 100644
--- a/JavaScriptCore/wrec/WRECGenerator.cpp
+++ b/JavaScriptCore/wrec/WRECGenerator.cpp
@@ -42,8 +42,8 @@ void Generator::generateEnter()
{
#if PLATFORM(X86)
// On x86 edi & esi are callee preserved registers.
- push(X86::edi);
- push(X86::esi);
+ push(X86Registers::edi);
+ push(X86Registers::esi);
#if COMPILER(MSVC)
// Move the arguments into registers.
@@ -72,8 +72,8 @@ void Generator::generateReturnSuccess()
// Restore callee save registers.
#if PLATFORM(X86)
- pop(X86::esi);
- pop(X86::edi);
+ pop(X86Registers::esi);
+ pop(X86Registers::edi);
#endif
ret();
}
@@ -111,8 +111,8 @@ void Generator::generateReturnFailure()
move(Imm32(-1), returnRegister);
#if PLATFORM(X86)
- pop(X86::esi);
- pop(X86::edi);
+ pop(X86Registers::esi);
+ pop(X86Registers::edi);
#endif
ret();
}
diff --git a/JavaScriptCore/wrec/WRECGenerator.h b/JavaScriptCore/wrec/WRECGenerator.h
index 8562cac..294c3d0 100644
--- a/JavaScriptCore/wrec/WRECGenerator.h
+++ b/JavaScriptCore/wrec/WRECGenerator.h
@@ -63,26 +63,26 @@ namespace JSC {
}
#if PLATFORM(X86)
- static const RegisterID input = X86::eax;
- static const RegisterID index = X86::edx;
- static const RegisterID length = X86::ecx;
- static const RegisterID output = X86::edi;
+ static const RegisterID input = X86Registers::eax;
+ static const RegisterID index = X86Registers::edx;
+ static const RegisterID length = X86Registers::ecx;
+ static const RegisterID output = X86Registers::edi;
- static const RegisterID character = X86::esi;
- static const RegisterID repeatCount = X86::ebx; // How many times the current atom repeats in the current match.
+ static const RegisterID character = X86Registers::esi;
+ static const RegisterID repeatCount = X86Registers::ebx; // How many times the current atom repeats in the current match.
- static const RegisterID returnRegister = X86::eax;
+ static const RegisterID returnRegister = X86Registers::eax;
#endif
#if PLATFORM(X86_64)
- static const RegisterID input = X86::edi;
- static const RegisterID index = X86::esi;
- static const RegisterID length = X86::edx;
- static const RegisterID output = X86::ecx;
+ static const RegisterID input = X86Registers::edi;
+ static const RegisterID index = X86Registers::esi;
+ static const RegisterID length = X86Registers::edx;
+ static const RegisterID output = X86Registers::ecx;
- static const RegisterID character = X86::eax;
- static const RegisterID repeatCount = X86::ebx; // How many times the current atom repeats in the current match.
+ static const RegisterID character = X86Registers::eax;
+ static const RegisterID repeatCount = X86Registers::ebx; // How many times the current atom repeats in the current match.
- static const RegisterID returnRegister = X86::eax;
+ static const RegisterID returnRegister = X86Registers::eax;
#endif
void generateEnter();
diff --git a/JavaScriptCore/wscript b/JavaScriptCore/wscript
index df11430..7a5ba1b 100644
--- a/JavaScriptCore/wscript
+++ b/JavaScriptCore/wscript
@@ -30,15 +30,15 @@ import commands
from settings import *
jscore_excludes = ['jsc.cpp', 'ucptable.cpp', 'GOwnPtr.cpp']
-jscore_excludes.extend(get_excludes(jscore_dir, ['*CF.cpp']))
+jscore_excludes.extend(get_excludes(jscore_dir, ['*CF.cpp', '*Symbian.cpp']))
sources = []
jscore_excludes.extend(get_excludes(jscore_dir, ['*Win.cpp', '*None.cpp']))
if building_on_win32:
- jscore_excludes.append('ExecutableAllocatorPosix.cpp')
- sources.append('jit/ExecutableAllocatorWin.cpp')
+ jscore_excludes += ['ExecutableAllocatorPosix.cpp', 'MarkStackPosix.cpp']
+ sources += ['jit/ExecutableAllocatorWin.cpp', 'runtime/MarkStackWin.cpp']
else:
jscore_excludes.append('JSStringRefBSTR.cpp')
@@ -62,17 +62,14 @@ def set_options(opt):
common_set_options(opt)
def configure(conf):
- common_configure(conf)
+ common_configure(conf)
+ generate_jscore_derived_sources()
def build(bld):
import Options
- generate_jscore_derived_sources()
-
full_dirs = get_dirs_for_features(jscore_dir, features=[build_port], dirs=jscore_dirs)
- print 'full_dirs = %r' % full_dirs
-
includes = common_includes + full_dirs
# 1. A simple program
@@ -81,7 +78,7 @@ def build(bld):
includes = '. .. assembler wrec DerivedSources ForwardingHeaders ' + ' '.join(includes),
source = sources,
target = 'jscore',
- uselib = 'WX ICU ' + waf_configname,
+ uselib = 'WX ICU ' + get_config(),
uselib_local = '',
install_path = output_dir)
@@ -92,15 +89,15 @@ def build(bld):
includes = '. .. assembler wrec DerivedSources ForwardingHeaders ' + ' '.join(includes),
source = 'jsc.cpp',
target = 'jsc',
- uselib = 'WX ICU ' + waf_configname,
+ uselib = 'WX ICU ' + get_config(),
uselib_local = 'jscore',
install_path = output_dir,
)
# we'll get an error if exceptions are on because of an unwind error when using __try
if building_on_win32:
- flags = obj.env.CPPFLAGS
+ flags = obj.env.CXXFLAGS
flags.remove('/EHsc')
- obj.env.CPPFLAGS = flags
+ obj.env.CXXFLAGS = flags
bld.install_files(os.path.join(output_dir, 'JavaScriptCore'), 'API/*.h')
diff --git a/JavaScriptCore/wtf/Assertions.cpp b/JavaScriptCore/wtf/Assertions.cpp
index 819ed9a..6c5e2e3 100644
--- a/JavaScriptCore/wtf/Assertions.cpp
+++ b/JavaScriptCore/wtf/Assertions.cpp
@@ -105,7 +105,11 @@ static void vprintf_stderr_common(const char* format, va_list args)
} while (size > 1024);
}
#endif
+#if PLATFORM(SYMBIAN)
+ vfprintf(stdout, format, args);
+#else
vfprintf(stderr, format, args);
+#endif
}
WTF_ATTRIBUTE_PRINTF(1, 2)
diff --git a/JavaScriptCore/wtf/Assertions.h b/JavaScriptCore/wtf/Assertions.h
index 59efd84..e3340f1 100644
--- a/JavaScriptCore/wtf/Assertions.h
+++ b/JavaScriptCore/wtf/Assertions.h
@@ -50,6 +50,11 @@
#include <inttypes.h>
#endif
+#if PLATFORM(SYMBIAN)
+#include <e32def.h>
+#include <e32debug.h>
+#endif
+
#ifdef NDEBUG
#define ASSERTIONS_DISABLED_DEFAULT 1
#else
@@ -120,11 +125,18 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann
/* CRASH -- gets us into the debugger or the crash reporter -- signals are ignored by the crash reporter so we must do better */
#ifndef CRASH
+#if PLATFORM(SYMBIAN)
+#define CRASH() do { \
+ __DEBUGGER(); \
+ User::Panic(_L("Webkit CRASH"),0); \
+ } while(false)
+#else
#define CRASH() do { \
*(int *)(uintptr_t)0xbbadbeef = 0; \
((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \
} while(false)
#endif
+#endif
/* ASSERT, ASSERT_WITH_MESSAGE, ASSERT_NOT_REACHED */
@@ -144,7 +156,11 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann
#if ASSERT_DISABLED
#define ASSERT(assertion) ((void)0)
+#if COMPILER(MSVC7) || COMPILER(WINSCW)
+#define ASSERT_WITH_MESSAGE(assertion) ((void)0)
+#else
#define ASSERT_WITH_MESSAGE(assertion, ...) ((void)0)
+#endif /* COMPILER(MSVC7) */
#define ASSERT_NOT_REACHED() ((void)0)
#define ASSERT_UNUSED(variable, assertion) ((void)variable)
@@ -156,7 +172,7 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann
CRASH(); \
} \
while (0)
-#if COMPILER(MSVC7)
+#if COMPILER(MSVC7) || COMPILER(WINSCW)
#define ASSERT_WITH_MESSAGE(assertion) ((void)0)
#else
#define ASSERT_WITH_MESSAGE(assertion, ...) do \
@@ -199,7 +215,7 @@ while (0)
/* FATAL */
-#if FATAL_DISABLED
+#if FATAL_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW)
#define FATAL(...) ((void)0)
#elif COMPILER(MSVC7)
#define FATAL() ((void)0)
@@ -212,9 +228,9 @@ while (0)
/* LOG_ERROR */
-#if ERROR_DISABLED
+#if ERROR_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW)
#define LOG_ERROR(...) ((void)0)
-#elif COMPILER(MSVC7)
+#elif COMPILER(MSVC7) || COMPILER(WINSCW)
#define LOG_ERROR() ((void)0)
#else
#define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__)
@@ -222,9 +238,9 @@ while (0)
/* LOG */
-#if LOG_DISABLED
+#if LOG_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW)
#define LOG(channel, ...) ((void)0)
-#elif COMPILER(MSVC7)
+#elif COMPILER(MSVC7) || COMPILER(WINSCW)
#define LOG() ((void)0)
#else
#define LOG(channel, ...) WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__)
@@ -234,9 +250,9 @@ while (0)
/* LOG_VERBOSE */
-#if LOG_DISABLED
+#if LOG_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW)
#define LOG_VERBOSE(channel, ...) ((void)0)
-#elif COMPILER(MSVC7)
+#elif COMPILER(MSVC7) || COMPILER(WINSCW)
#define LOG_VERBOSE(channel) ((void)0)
#else
#define LOG_VERBOSE(channel, ...) WTFLogVerbose(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__)
diff --git a/JavaScriptCore/wtf/ByteArray.h b/JavaScriptCore/wtf/ByteArray.h
index 96e9cc2..f5f5ded 100644
--- a/JavaScriptCore/wtf/ByteArray.h
+++ b/JavaScriptCore/wtf/ByteArray.h
@@ -45,6 +45,13 @@ namespace WTF {
m_data[index] = static_cast<unsigned char>(value + 0.5);
}
+ void set(unsigned index, unsigned char value)
+ {
+ if (index >= m_size)
+ return;
+ m_data[index] = value;
+ }
+
bool get(unsigned index, unsigned char& result) const
{
if (index >= m_size)
@@ -53,6 +60,12 @@ namespace WTF {
return true;
}
+ unsigned char get(unsigned index) const
+ {
+ ASSERT(index < m_size);
+ return m_data[index];
+ }
+
unsigned char* data() { return m_data; }
void deref()
diff --git a/JavaScriptCore/wtf/CrossThreadRefCounted.h b/JavaScriptCore/wtf/CrossThreadRefCounted.h
index 6a05211..f682f0d 100644
--- a/JavaScriptCore/wtf/CrossThreadRefCounted.h
+++ b/JavaScriptCore/wtf/CrossThreadRefCounted.h
@@ -70,10 +70,6 @@ namespace WTF {
return !m_refCounter.hasOneRef() || (m_threadSafeRefCounter && !m_threadSafeRefCounter->hasOneRef());
}
-#ifndef NDEBUG
- bool mayBePassedToAnotherThread() const { ASSERT(!m_threadId); return m_refCounter.hasOneRef(); }
-#endif
-
private:
CrossThreadRefCounted(T* data, ThreadSafeSharedBase* threadedCounter)
: m_threadSafeRefCounter(threadedCounter)
@@ -92,6 +88,10 @@ namespace WTF {
void threadSafeDeref();
+#ifndef NDEBUG
+ bool isOwnedByCurrentThread() const { return !m_threadId || m_threadId == currentThread(); }
+#endif
+
RefCountedBase m_refCounter;
ThreadSafeSharedBase* m_threadSafeRefCounter;
T* m_data;
@@ -103,7 +103,7 @@ namespace WTF {
template<class T>
void CrossThreadRefCounted<T>::ref()
{
- ASSERT(!m_threadId || m_threadId == currentThread());
+ ASSERT(isOwnedByCurrentThread());
m_refCounter.ref();
#ifndef NDEBUG
// Store the threadId as soon as the ref count gets to 2.
@@ -119,7 +119,7 @@ namespace WTF {
template<class T>
void CrossThreadRefCounted<T>::deref()
{
- ASSERT(!m_threadId || m_threadId == currentThread());
+ ASSERT(isOwnedByCurrentThread());
if (m_refCounter.derefBase()) {
threadSafeDeref();
delete this;
@@ -146,10 +146,12 @@ namespace WTF {
template<class T>
PassRefPtr<CrossThreadRefCounted<T> > CrossThreadRefCounted<T>::crossThreadCopy()
{
+ ASSERT(isOwnedByCurrentThread());
if (m_threadSafeRefCounter)
m_threadSafeRefCounter->ref();
else
m_threadSafeRefCounter = new ThreadSafeSharedBase(2);
+
return adoptRef(new CrossThreadRefCounted<T>(m_data, m_threadSafeRefCounter));
}
diff --git a/JavaScriptCore/wtf/DateMath.cpp b/JavaScriptCore/wtf/DateMath.cpp
index 6a5b22f..0386494 100644
--- a/JavaScriptCore/wtf/DateMath.cpp
+++ b/JavaScriptCore/wtf/DateMath.cpp
@@ -65,7 +65,7 @@
#include <notify.h>
#endif
-#if PLATFORM(WINCE) && !PLATFORM(QT)
+#if PLATFORM(WINCE)
extern "C" size_t strftime(char * const s, const size_t maxsize, const char * const format, const struct tm * const t);
extern "C" struct tm * localtime(const time_t *timer);
#endif
diff --git a/JavaScriptCore/wtf/DisallowCType.h b/JavaScriptCore/wtf/DisallowCType.h
index 5dccb0e..436f7f2 100644
--- a/JavaScriptCore/wtf/DisallowCType.h
+++ b/JavaScriptCore/wtf/DisallowCType.h
@@ -54,21 +54,21 @@
#undef tolower
#undef toupper
-#define isalnum WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define isalpha WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define isascii WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define isblank WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define iscntrl WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define isdigit WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define isgraph WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define islower WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define isprint WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define ispunct WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define isspace WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define isupper WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define isxdigit WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define toascii WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define tolower WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
-#define toupper WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isalnum isalnum_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isalpha isalpha_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isascii isascii_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isblank isblank_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define iscntrl iscntrl_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isdigit isdigit_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isgraph isgraph_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define islower islower_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isprint isprint_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define ispunct ispunct_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isspace isspace_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isupper isupper_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isxdigit isxdigit_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define toascii toascii_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define tolower tolower_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define toupper toupper_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
#endif
diff --git a/JavaScriptCore/wtf/FastAllocBase.h b/JavaScriptCore/wtf/FastAllocBase.h
index 9fcbbc1..81b1de0 100644
--- a/JavaScriptCore/wtf/FastAllocBase.h
+++ b/JavaScriptCore/wtf/FastAllocBase.h
@@ -301,6 +301,16 @@ namespace WTF {
fastFree(p);
}
+ template <typename T>
+ inline void fastDeleteSkippingDestructor(T* p)
+ {
+ if (!p)
+ return;
+
+ fastMallocMatchValidateFree(p, Internal::AllocTypeFastNew);
+ fastFree(p);
+ }
+
namespace Internal {
// This is a support template for fastDeleteArray.
// This handles the case wherein T has a trivial dtor.
@@ -397,7 +407,7 @@ namespace WTF {
} // namespace WTF
-// Using WTF::FastAllocBase to avoid using FastAllocBase's explicit qualification by WTF::.
using WTF::FastAllocBase;
+using WTF::fastDeleteSkippingDestructor;
#endif // FastAllocBase_h
diff --git a/JavaScriptCore/wtf/FastMalloc.cpp b/JavaScriptCore/wtf/FastMalloc.cpp
index c14b755..6cd8ef0 100644
--- a/JavaScriptCore/wtf/FastMalloc.cpp
+++ b/JavaScriptCore/wtf/FastMalloc.cpp
@@ -178,10 +178,10 @@ void* fastZeroedMalloc(size_t n)
return result;
}
-void* tryFastZeroedMalloc(size_t n)
+TryMallocReturnValue tryFastZeroedMalloc(size_t n)
{
- void* result = tryFastMalloc(n);
- if (!result)
+ void* result;
+ if (!tryFastMalloc(n).getValue(result))
return 0;
memset(result, 0, n);
return result;
@@ -200,7 +200,7 @@ void* tryFastZeroedMalloc(size_t n)
namespace WTF {
-void* tryFastMalloc(size_t n)
+TryMallocReturnValue tryFastMalloc(size_t n)
{
ASSERT(!isForbidden());
@@ -226,7 +226,9 @@ void* fastMalloc(size_t n)
ASSERT(!isForbidden());
#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
- void* result = tryFastMalloc(n);
+ TryMallocReturnValue returnValue = tryFastMalloc(n);
+ void* result;
+ returnValue.getValue(result);
#else
void* result = malloc(n);
#endif
@@ -236,7 +238,7 @@ void* fastMalloc(size_t n)
return result;
}
-void* tryFastCalloc(size_t n_elements, size_t element_size)
+TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size)
{
ASSERT(!isForbidden());
@@ -264,7 +266,9 @@ void* fastCalloc(size_t n_elements, size_t element_size)
ASSERT(!isForbidden());
#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
- void* result = tryFastCalloc(n_elements, element_size);
+ TryMallocReturnValue returnValue = tryFastCalloc(n_elements, element_size);
+ void* result;
+ returnValue.getValue(result);
#else
void* result = calloc(n_elements, element_size);
#endif
@@ -291,7 +295,7 @@ void fastFree(void* p)
#endif
}
-void* tryFastRealloc(void* p, size_t n)
+TryMallocReturnValue tryFastRealloc(void* p, size_t n)
{
ASSERT(!isForbidden());
@@ -323,7 +327,9 @@ void* fastRealloc(void* p, size_t n)
ASSERT(!isForbidden());
#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
- void* result = tryFastRealloc(p, n);
+ TryMallocReturnValue returnValue = tryFastRealloc(p, n);
+ void* result;
+ returnValue.getValue(result);
#else
void* result = realloc(p, n);
#endif
@@ -373,6 +379,9 @@ extern "C" const int jscore_fastmalloc_introspection = 0;
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
+#if PLATFORM(UNIX)
+#include <unistd.h>
+#endif
#if COMPILER(MSVC)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
@@ -385,6 +394,7 @@ extern "C" const int jscore_fastmalloc_introspection = 0;
#if PLATFORM(DARWIN)
#include "MallocZoneSupport.h"
#include <wtf/HashSet.h>
+#include <wtf/Vector.h>
#endif
#ifndef PRIuS
@@ -539,7 +549,7 @@ static const size_t kNumClasses = 68;
static const size_t kPageMapBigAllocationThreshold = 128 << 20;
// Minimum number of pages to fetch from system at a time. Must be
-// significantly bigger than kBlockSize to amortize system-call
+// significantly bigger than kPageSize to amortize system-call
// overhead, and also to reduce external fragementation. Also, we
// should keep this value big because various incarnations of Linux
// have small limits on the number of mmap() regions per
@@ -2268,7 +2278,7 @@ static inline TCMalloc_PageHeap* getPageHeap()
#define pageheap getPageHeap()
#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
-#if PLATFORM(WIN)
+#if PLATFORM(WIN_OS)
static void sleep(unsigned seconds)
{
::Sleep(seconds * 1000);
@@ -2277,6 +2287,10 @@ static void sleep(unsigned seconds)
void TCMalloc_PageHeap::scavengerThread()
{
+#if HAVE(PTHREAD_SETNAME_NP)
+ pthread_setname_np("JavaScriptCore: FastMalloc scavenger");
+#endif
+
while (1) {
if (!shouldContinueScavenging()) {
pthread_mutex_lock(&m_scavengeMutex);
@@ -2382,7 +2396,7 @@ ALWAYS_INLINE void TCMalloc_Central_FreeList::ReleaseToSpans(void* object) {
// The following check is expensive, so it is disabled by default
if (false) {
// Check that object does not occur in list
- int got = 0;
+ unsigned got = 0;
for (void* p = span->objects; p != NULL; p = *((void**) p)) {
ASSERT(p != object);
got++;
@@ -3576,7 +3590,7 @@ void* fastMalloc(size_t size)
return malloc<true>(size);
}
-void* tryFastMalloc(size_t size)
+TryMallocReturnValue tryFastMalloc(size_t size)
{
return malloc<false>(size);
}
@@ -3637,7 +3651,7 @@ void* fastCalloc(size_t n, size_t elem_size)
return calloc<true>(n, elem_size);
}
-void* tryFastCalloc(size_t n, size_t elem_size)
+TryMallocReturnValue tryFastCalloc(size_t n, size_t elem_size)
{
return calloc<false>(n, elem_size);
}
@@ -3701,7 +3715,7 @@ void* fastRealloc(void* old_ptr, size_t new_size)
return realloc<true>(old_ptr, new_size);
}
-void* tryFastRealloc(void* old_ptr, size_t new_size)
+TryMallocReturnValue tryFastRealloc(void* old_ptr, size_t new_size)
{
return realloc<false>(old_ptr, new_size);
}
diff --git a/JavaScriptCore/wtf/FastMalloc.h b/JavaScriptCore/wtf/FastMalloc.h
index 787251f..ca0961c 100644
--- a/JavaScriptCore/wtf/FastMalloc.h
+++ b/JavaScriptCore/wtf/FastMalloc.h
@@ -22,6 +22,7 @@
#define WTF_FastMalloc_h
#include "Platform.h"
+#include "PossiblyNull.h"
#include <stdlib.h>
#include <new>
@@ -33,11 +34,42 @@ namespace WTF {
void* fastCalloc(size_t numElements, size_t elementSize);
void* fastRealloc(void*, size_t);
- // These functions return 0 if an allocation fails.
- void* tryFastMalloc(size_t);
- void* tryFastZeroedMalloc(size_t);
- void* tryFastCalloc(size_t numElements, size_t elementSize);
- void* tryFastRealloc(void*, size_t);
+ struct TryMallocReturnValue {
+ TryMallocReturnValue(void* data)
+ : m_data(data)
+ {
+ }
+ TryMallocReturnValue(const TryMallocReturnValue& source)
+ : m_data(source.m_data)
+ {
+ source.m_data = 0;
+ }
+ ~TryMallocReturnValue() { ASSERT(!m_data); }
+ template <typename T> bool getValue(T& data) WARN_UNUSED_RETURN;
+ template <typename T> operator PossiblyNull<T>()
+ {
+ T value;
+ getValue(value);
+ return PossiblyNull<T>(value);
+ }
+ private:
+ mutable void* m_data;
+ };
+
+ template <typename T> bool TryMallocReturnValue::getValue(T& data)
+ {
+ union u { void* data; T target; } res;
+ res.data = m_data;
+ data = res.target;
+ bool returnValue = !!m_data;
+ m_data = 0;
+ return returnValue;
+ }
+
+ TryMallocReturnValue tryFastMalloc(size_t n);
+ TryMallocReturnValue tryFastZeroedMalloc(size_t n);
+ TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size);
+ TryMallocReturnValue tryFastRealloc(void* p, size_t n);
void fastFree(void*);
@@ -181,6 +213,9 @@ using WTF::fastMallocAllow;
// debug-only code to make sure we don't use the system malloc via the default operator
// new by accident.
+// We musn't customize the global operator new and delete for the Qt port.
+#if !PLATFORM(QT)
+
WTF_PRIVATE_INLINE void* operator new(size_t size) { return fastMalloc(size); }
WTF_PRIVATE_INLINE void* operator new(size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); }
WTF_PRIVATE_INLINE void operator delete(void* p) { fastFree(p); }
@@ -192,4 +227,6 @@ WTF_PRIVATE_INLINE void operator delete[](void* p, const std::nothrow_t&) throw(
#endif
+#endif
+
#endif /* WTF_FastMalloc_h */
diff --git a/JavaScriptCore/wtf/Forward.h b/JavaScriptCore/wtf/Forward.h
index 67dc3be..448de7d 100644
--- a/JavaScriptCore/wtf/Forward.h
+++ b/JavaScriptCore/wtf/Forward.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006, 2009 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -27,6 +27,7 @@ namespace WTF {
template<typename T> class ListRefPtr;
template<typename T> class OwnArrayPtr;
template<typename T> class OwnPtr;
+ template<typename T> class PassOwnPtr;
template<typename T> class PassRefPtr;
template<typename T> class RefPtr;
template<typename T, size_t inlineCapacity> class Vector;
@@ -35,9 +36,9 @@ namespace WTF {
using WTF::ListRefPtr;
using WTF::OwnArrayPtr;
using WTF::OwnPtr;
+using WTF::PassOwnPtr;
using WTF::PassRefPtr;
using WTF::RefPtr;
using WTF::Vector;
#endif // WTF_Forward_h
-
diff --git a/JavaScriptCore/wtf/HashCountedSet.h b/JavaScriptCore/wtf/HashCountedSet.h
index 1a422d8..165eb41 100644
--- a/JavaScriptCore/wtf/HashCountedSet.h
+++ b/JavaScriptCore/wtf/HashCountedSet.h
@@ -49,23 +49,28 @@ namespace WTF {
const_iterator begin() const;
const_iterator end() const;
- iterator find(const ValueType& value);
- const_iterator find(const ValueType& value) const;
- bool contains(const ValueType& value) const;
- unsigned count(const ValueType& value) const;
+ iterator find(const ValueType&);
+ const_iterator find(const ValueType&) const;
+ bool contains(const ValueType&) const;
+ unsigned count(const ValueType&) const;
// increases the count if an equal value is already present
// the return value is a pair of an interator to the new value's location,
// and a bool that is true if an new entry was added
- std::pair<iterator, bool> add(const ValueType &value);
+ std::pair<iterator, bool> add(const ValueType&);
// reduces the count of the value, and removes it if count
// goes down to zero
- void remove(const ValueType& value);
- void remove(iterator it);
+ void remove(const ValueType&);
+ void remove(iterator);
- void clear();
-
+ // removes the value, regardless of its count
+ void removeAll(iterator);
+ void removeAll(const ValueType&);
+
+ // clears the whole set
+ void clear();
+
private:
ImplType m_impl;
};
@@ -166,6 +171,21 @@ namespace WTF {
}
template<typename Value, typename HashFunctions, typename Traits>
+ inline void HashCountedSet<Value, HashFunctions, Traits>::removeAll(const ValueType& value)
+ {
+ removeAll(find(value));
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline void HashCountedSet<Value, HashFunctions, Traits>::removeAll(iterator it)
+ {
+ if (it == end())
+ return;
+
+ m_impl.remove(it);
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
inline void HashCountedSet<Value, HashFunctions, Traits>::clear()
{
m_impl.clear();
diff --git a/JavaScriptCore/wtf/HashSet.h b/JavaScriptCore/wtf/HashSet.h
index 990670d..f4e2cf7 100644
--- a/JavaScriptCore/wtf/HashSet.h
+++ b/JavaScriptCore/wtf/HashSet.h
@@ -29,6 +29,8 @@ namespace WTF {
template<typename Value, typename HashFunctions, typename Traits> class HashSet;
template<typename Value, typename HashFunctions, typename Traits>
void deleteAllValues(const HashSet<Value, HashFunctions, Traits>&);
+ template<typename Value, typename HashFunctions, typename Traits>
+ void fastDeleteAllValues(const HashSet<Value, HashFunctions, Traits>&);
template<typename T> struct IdentityExtractor;
@@ -91,6 +93,7 @@ namespace WTF {
private:
friend void deleteAllValues<>(const HashSet&);
+ friend void fastDeleteAllValues<>(const HashSet&);
HashTableType m_impl;
};
@@ -251,6 +254,21 @@ namespace WTF {
{
deleteAllValues<typename HashSet<T, U, V>::ValueType>(collection.m_impl);
}
+
+ template<typename ValueType, typename HashTableType>
+ void fastDeleteAllValues(HashTableType& collection)
+ {
+ typedef typename HashTableType::const_iterator iterator;
+ iterator end = collection.end();
+ for (iterator it = collection.begin(); it != end; ++it)
+ fastDelete(*it);
+ }
+
+ template<typename T, typename U, typename V>
+ inline void fastDeleteAllValues(const HashSet<T, U, V>& collection)
+ {
+ fastDeleteAllValues<typename HashSet<T, U, V>::ValueType>(collection.m_impl);
+ }
template<typename T, typename U, typename V, typename W>
inline void copyToVector(const HashSet<T, U, V>& collection, W& vector)
diff --git a/JavaScriptCore/wtf/ListRefPtr.h b/JavaScriptCore/wtf/ListRefPtr.h
index 9f9a354..8bf6447 100644
--- a/JavaScriptCore/wtf/ListRefPtr.h
+++ b/JavaScriptCore/wtf/ListRefPtr.h
@@ -34,13 +34,8 @@ namespace WTF {
ListRefPtr(const RefPtr<T>& o) : RefPtr<T>(o) {}
// see comment in PassRefPtr.h for why this takes const reference
template <typename U> ListRefPtr(const PassRefPtr<U>& o) : RefPtr<T>(o) {}
-
- ~ListRefPtr()
- {
- RefPtr<T> reaper = this->release();
- while (reaper && reaper->hasOneRef())
- reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper
- }
+
+ ~ListRefPtr();
ListRefPtr& operator=(T* optr) { RefPtr<T>::operator=(optr); return *this; }
ListRefPtr& operator=(const RefPtr<T>& o) { RefPtr<T>::operator=(o); return *this; }
@@ -49,6 +44,20 @@ namespace WTF {
template <typename U> ListRefPtr& operator=(const PassRefPtr<U>& o) { RefPtr<T>::operator=(o); return *this; }
};
+ // Remove inline for winscw compiler to prevent the compiler agressively resolving
+ // T::ref() in RefPtr<T>'s copy constructor. The bug is reported at:
+ // https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812.
+ template <typename T>
+#if !COMPILER(WINSCW)
+ inline
+#endif
+ ListRefPtr<T>::~ListRefPtr()
+ {
+ RefPtr<T> reaper = this->release();
+ while (reaper && reaper->hasOneRef())
+ reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper
+ }
+
template <typename T> inline T* getPtr(const ListRefPtr<T>& p)
{
return p.get();
diff --git a/JavaScriptCore/wtf/PassRefPtr.h b/JavaScriptCore/wtf/PassRefPtr.h
index d80ed62..36ba78e 100644
--- a/JavaScriptCore/wtf/PassRefPtr.h
+++ b/JavaScriptCore/wtf/PassRefPtr.h
@@ -28,6 +28,19 @@ namespace WTF {
template<typename T> class RefPtr;
template<typename T> class PassRefPtr;
template <typename T> PassRefPtr<T> adoptRef(T*);
+
+ // Remove inline for winscw compiler to prevent the compiler agressively resolving
+ // T::deref(), which will fail compiling when PassRefPtr<T> is used as class member
+ // or function arguments before T is defined.
+ template<typename T>
+#if !COMPILER(WINSCW)
+ inline
+#endif
+ void derefIfNotNull(T* ptr)
+ {
+ if (UNLIKELY(ptr != 0))
+ ptr->deref();
+ }
template<typename T> class PassRefPtr {
public:
@@ -40,8 +53,8 @@ namespace WTF {
PassRefPtr(const PassRefPtr& o) : m_ptr(o.releaseRef()) {}
template <typename U> PassRefPtr(const PassRefPtr<U>& o) : m_ptr(o.releaseRef()) { }
- ALWAYS_INLINE ~PassRefPtr() { if (UNLIKELY(m_ptr != 0)) m_ptr->deref(); }
-
+ ALWAYS_INLINE ~PassRefPtr() { derefIfNotNull<T>(m_ptr); }
+
template <class U>
PassRefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { if (T* ptr = m_ptr) ptr->ref(); }
@@ -56,12 +69,9 @@ namespace WTF {
bool operator!() const { return !m_ptr; }
// This conversion operator allows implicit conversion to bool but not to other integer types.
-#if COMPILER(WINSCW)
- operator bool() const { return m_ptr; }
-#else
- typedef T* PassRefPtr::*UnspecifiedBoolType;
+ typedef T* (PassRefPtr::*UnspecifiedBoolType);
operator UnspecifiedBoolType() const { return m_ptr ? &PassRefPtr::m_ptr : 0; }
-#endif
+
PassRefPtr& operator=(T*);
PassRefPtr& operator=(const PassRefPtr&);
template <typename U> PassRefPtr& operator=(const PassRefPtr<U>&);
@@ -74,6 +84,62 @@ namespace WTF {
mutable T* m_ptr;
};
+ // NonNullPassRefPtr: Optimized for passing non-null pointers. A NonNullPassRefPtr
+ // begins life non-null, and can only become null through a call to releaseRef()
+ // or clear().
+
+ // FIXME: NonNullPassRefPtr could just inherit from PassRefPtr. However,
+ // if we use inheritance, GCC's optimizer fails to realize that destruction
+ // of a released NonNullPassRefPtr is a no-op. So, for now, just copy the
+ // most important code from PassRefPtr.
+ template <typename T> class NonNullPassRefPtr {
+ public:
+ NonNullPassRefPtr(T* ptr)
+ : m_ptr(ptr)
+ {
+ ASSERT(m_ptr);
+ m_ptr->ref();
+ }
+
+ template <class U> NonNullPassRefPtr(const RefPtr<U>& o)
+ : m_ptr(o.get())
+ {
+ ASSERT(m_ptr);
+ m_ptr->ref();
+ }
+
+ NonNullPassRefPtr(const NonNullPassRefPtr& o)
+ : m_ptr(o.releaseRef())
+ {
+ ASSERT(m_ptr);
+ }
+
+ template <class U> NonNullPassRefPtr(const NonNullPassRefPtr<U>& o)
+ : m_ptr(o.releaseRef())
+ {
+ ASSERT(m_ptr);
+ }
+
+ template <class U> NonNullPassRefPtr(const PassRefPtr<U>& o)
+ : m_ptr(o.releaseRef())
+ {
+ ASSERT(m_ptr);
+ }
+
+ ALWAYS_INLINE ~NonNullPassRefPtr() { derefIfNotNull(m_ptr); }
+
+ T* get() const { return m_ptr; }
+
+ void clear() { derefIfNotNull(m_ptr); m_ptr = 0; }
+ T* releaseRef() const { T* tmp = m_ptr; m_ptr = 0; return tmp; }
+
+ T& operator*() const { return *m_ptr; }
+ T* operator->() const { return m_ptr; }
+
+ private:
+ mutable T* m_ptr;
+ };
+
template <typename T> template <typename U> inline PassRefPtr<T>& PassRefPtr<T>::operator=(const RefPtr<U>& o)
{
T* optr = o.get();
@@ -188,6 +254,7 @@ namespace WTF {
} // namespace WTF
using WTF::PassRefPtr;
+using WTF::NonNullPassRefPtr;
using WTF::adoptRef;
using WTF::static_pointer_cast;
using WTF::const_pointer_cast;
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index 845684e..0f97bfe 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -108,6 +108,13 @@
#define WTF_PLATFORM_NETBSD 1
#endif
+/* PLATFORM(QNX) */
+/* Operating system level dependencies for QNX that should be used */
+/* regardless of operating environment */
+#if defined(__QNXNTO__)
+#define WTF_PLATFORM_QNX 1
+#endif
+
/* PLATFORM(UNIX) */
/* Operating system level dependencies for Unix-like systems that */
/* should be used regardless of operating environment */
@@ -118,7 +125,9 @@
|| defined(unix) \
|| defined(__unix) \
|| defined(__unix__) \
- || defined(_AIX)
+ || defined(_AIX) \
+ || defined(__HAIKU__) \
+ || defined(__QNXNTO__)
#define WTF_PLATFORM_UNIX 1
#endif
@@ -143,6 +152,8 @@
#define WTF_PLATFORM_WX 1
#elif defined(BUILDING_GTK__)
#define WTF_PLATFORM_GTK 1
+#elif defined(BUILDING_HAIKU__)
+#define WTF_PLATFORM_HAIKU 1
#elif PLATFORM(DARWIN)
#define WTF_PLATFORM_MAC 1
#elif PLATFORM(WIN_OS)
@@ -189,7 +200,7 @@
/* Makes PLATFORM(WIN) default to PLATFORM(CAIRO) */
/* FIXME: This should be changed from a blacklist to a whitelist */
-#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) && !PLATFORM(WINCE)
+#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) && !PLATFORM(WINCE) && !PLATFORM(HAIKU)
#define WTF_PLATFORM_CAIRO 1
#endif
@@ -240,15 +251,27 @@
#endif
/* PLATFORM(ARM) */
+#define PLATFORM_ARM_ARCH(N) (PLATFORM(ARM) && ARM_ARCH_VERSION >= N)
+
#if defined(arm) \
|| defined(__arm__)
#define WTF_PLATFORM_ARM 1
+
#if defined(__ARMEB__)
#define WTF_PLATFORM_BIG_ENDIAN 1
+<<<<<<< HEAD:JavaScriptCore/wtf/Platform.h
#elif !defined(__ARM_EABI__) && !defined(__EABI__) && !defined(__VFP_FP__)
#if !defined(ANDROID)
+=======
+
+#elif !defined(__ARM_EABI__) \
+ && !defined(__EABI__) \
+ && !defined(__VFP_FP__)
+>>>>>>> webkit.org at 49305:JavaScriptCore/wtf/Platform.h
#define WTF_PLATFORM_MIDDLE_ENDIAN 1
+
#endif
+<<<<<<< HEAD:JavaScriptCore/wtf/Platform.h
#endif
#if !defined(__ARM_EABI__) && !defined(__EABI__)
#define WTF_PLATFORM_FORCE_PACK 1
@@ -256,26 +279,98 @@
#define ARM_ARCH_VERSION 3
#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
#undef ARM_ARCH_VERSION
+=======
+
+/* Set ARM_ARCH_VERSION */
+#if defined(__ARM_ARCH_4__) \
+ || defined(__ARM_ARCH_4T__) \
+ || defined(__MARM_ARMV4__) \
+ || defined(_ARMV4I_)
+>>>>>>> webkit.org at 49305:JavaScriptCore/wtf/Platform.h
#define ARM_ARCH_VERSION 4
-#endif
-#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
- || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
- || defined(__ARM_ARCH_5TEJ__)
-#undef ARM_ARCH_VERSION
+
+#elif defined(__ARM_ARCH_5__) \
+ || defined(__ARM_ARCH_5T__) \
+ || defined(__ARM_ARCH_5E__) \
+ || defined(__ARM_ARCH_5TE__) \
+ || defined(__ARM_ARCH_5TEJ__) \
+ || defined(__MARM_ARMV5__)
#define ARM_ARCH_VERSION 5
-#endif
-#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
- || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
- || defined(__ARM_ARCH_6ZK__)
-#undef ARM_ARCH_VERSION
+
+#elif defined(__ARM_ARCH_6__) \
+ || defined(__ARM_ARCH_6J__) \
+ || defined(__ARM_ARCH_6K__) \
+ || defined(__ARM_ARCH_6Z__) \
+ || defined(__ARM_ARCH_6ZK__) \
+ || defined(__ARM_ARCH_6T2__) \
+ || defined(__ARMV6__)
#define ARM_ARCH_VERSION 6
-#endif
-#if defined(__ARM_ARCH_7A__)
-#undef ARM_ARCH_VERSION
+
+#elif defined(__ARM_ARCH_7A__) \
+ || defined(__ARM_ARCH_7R__)
#define ARM_ARCH_VERSION 7
+
+/* RVCT sets _TARGET_ARCH_ARM */
+#elif defined(__TARGET_ARCH_ARM)
+#define ARM_ARCH_VERSION __TARGET_ARCH_ARM
+
+#else
+#define ARM_ARCH_VERSION 0
+
#endif
+
+/* Set THUMB_ARM_VERSION */
+#if defined(__ARM_ARCH_4T__)
+#define THUMB_ARCH_VERSION 1
+
+#elif defined(__ARM_ARCH_5T__) \
+ || defined(__ARM_ARCH_5TE__) \
+ || defined(__ARM_ARCH_5TEJ__)
+#define THUMB_ARCH_VERSION 2
+
+#elif defined(__ARM_ARCH_6J__) \
+ || defined(__ARM_ARCH_6K__) \
+ || defined(__ARM_ARCH_6Z__) \
+ || defined(__ARM_ARCH_6ZK__) \
+ || defined(__ARM_ARCH_6M__)
+#define THUMB_ARCH_VERSION 3
+
+#elif defined(__ARM_ARCH_6T2__) \
+ || defined(__ARM_ARCH_7__) \
+ || defined(__ARM_ARCH_7A__) \
+ || defined(__ARM_ARCH_7R__) \
+ || defined(__ARM_ARCH_7M__)
+#define THUMB_ARCH_VERSION 4
+
+/* RVCT sets __TARGET_ARCH_THUMB */
+#elif defined(__TARGET_ARCH_THUMB)
+#define THUMB_ARCH_VERSION __TARGET_ARCH_THUMB
+
+#else
+#define THUMB_ARCH_VERSION 0
+#endif
+
+/* On ARMv5 and below the natural alignment is required. */
+#if !defined(ARM_REQUIRE_NATURAL_ALIGNMENT) && ARM_ARCH_VERSION <= 5
+#define ARM_REQUIRE_NATURAL_ALIGNMENT 1
+#endif
+
+/* Defines two pseudo-platforms for ARM and Thumb-2 instruction set. */
+#if !defined(WTF_PLATFORM_ARM_TRADITIONAL) && !defined(WTF_PLATFORM_ARM_THUMB2)
+# if defined(thumb2) || defined(__thumb2__) \
+ || ((defined(__thumb) || defined(__thumb__)) && THUMB_ARCH_VERSION == 4)
+# define WTF_PLATFORM_ARM_TRADITIONAL 0
+# define WTF_PLATFORM_ARM_THUMB2 1
+# elif PLATFORM_ARM_ARCH(4)
+# define WTF_PLATFORM_ARM_TRADITIONAL 1
+# define WTF_PLATFORM_ARM_THUMB2 0
+# else
+# error "Not supported ARM architecture"
+# endif
+#elif PLATFORM(ARM_TRADITIONAL) && PLATFORM(ARM_THUMB2) /* Sanity Check */
+# error "Cannot use both of WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2 platforms"
+#endif // !defined(ARM_TRADITIONAL) && !defined(ARM_THUMB2)
#endif /* ARM */
-#define PLATFORM_ARM_ARCH(N) (PLATFORM(ARM) && ARM_ARCH_VERSION >= N)
/* PLATFORM(X86) */
#if defined(__i386__) \
@@ -298,7 +393,7 @@
#endif
/* PLATFORM(SPARC64) */
-#if defined(__sparc64__)
+#if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9)
#define WTF_PLATFORM_SPARC64 1
#define WTF_PLATFORM_BIG_ENDIAN 1
#endif
@@ -411,6 +506,9 @@
#if PLATFORM(MAC) && !PLATFORM(IPHONE)
#define WTF_PLATFORM_CF 1
#define WTF_USE_PTHREADS 1
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && defined(__x86_64__)
+#define WTF_USE_PLUGIN_HOST_PROCESS 1
+#endif
#if !defined(ENABLE_MAC_JAVA_BRIDGE)
#define ENABLE_MAC_JAVA_BRIDGE 1
#endif
@@ -419,8 +517,12 @@
#endif
#define HAVE_READLINE 1
#define HAVE_RUNLOOP_TIMER 1
+<<<<<<< HEAD:JavaScriptCore/wtf/Platform.h
#define HAVE_PTHREAD_RWLOCK 1
#endif
+=======
+#endif /* PLATFORM(MAC) && !PLATFORM(IPHONE) */
+>>>>>>> webkit.org at 49305:JavaScriptCore/wtf/Platform.h
#if PLATFORM(CHROMIUM) && PLATFORM(DARWIN)
#define WTF_PLATFORM_CF 1
@@ -428,15 +530,19 @@
#endif
#if PLATFORM(IPHONE)
-#define WTF_PLATFORM_CF 1
-#define WTF_USE_PTHREADS 1
+#define ENABLE_CONTEXT_MENUS 0
+#define ENABLE_DRAG_SUPPORT 0
#define ENABLE_FTPDIR 1
-#define ENABLE_MAC_JAVA_BRIDGE 0
-#define ENABLE_ICONDATABASE 0
#define ENABLE_GEOLOCATION 1
+#define ENABLE_ICONDATABASE 0
+#define ENABLE_INSPECTOR 0
+#define ENABLE_MAC_JAVA_BRIDGE 0
#define ENABLE_NETSCAPE_PLUGIN_API 0
-#define HAVE_READLINE 1
+#define ENABLE_ORIENTATION_EVENTS 1
#define ENABLE_REPAINT_THROTTLING 1
+#define HAVE_READLINE 1
+#define WTF_PLATFORM_CF 1
+#define WTF_USE_PTHREADS 1
#endif
#if PLATFORM(WIN)
@@ -445,8 +551,6 @@
#if PLATFORM(WX)
#define ENABLE_ASSEMBLER 1
-#define WTF_USE_CURL 1
-#define WTF_USE_PTHREADS 1
#endif
#if PLATFORM(GTK)
@@ -455,6 +559,14 @@
#endif
#endif
+#if PLATFORM(HAIKU)
+#define HAVE_POSIX_MEMALIGN 1
+#define WTF_USE_CURL 1
+#define WTF_USE_PTHREADS 1
+#define USE_SYSTEM_MALLOC 1
+#define ENABLE_NETSCAPE_PLUGIN_API 0
+#endif
+
#if !defined(HAVE_ACCESSIBILITY)
#if PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM)
#define HAVE_ACCESSIBILITY 1
@@ -465,7 +577,12 @@
#define HAVE_SIGNAL_H 1
#endif
+<<<<<<< HEAD:JavaScriptCore/wtf/Platform.h
#if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !PLATFORM(SYMBIAN) && !COMPILER(RVCT) && !PLATFORM(ANDROID)
+=======
+#if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !PLATFORM(QNX) \
+ && !PLATFORM(SYMBIAN) && !PLATFORM(HAIKU) && !COMPILER(RVCT)
+>>>>>>> webkit.org at 49305:JavaScriptCore/wtf/Platform.h
#define HAVE_TM_GMTOFF 1
#define HAVE_TM_ZONE 1
#define HAVE_TIMEGM 1
@@ -486,6 +603,7 @@
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !PLATFORM(IPHONE)
#define HAVE_MADV_FREE_REUSE 1
#define HAVE_MADV_FREE 1
+#define HAVE_PTHREAD_SETNAME_NP 1
#endif
#if PLATFORM(IPHONE)
@@ -515,10 +633,17 @@
#define HAVE_SYS_PARAM_H 1
#endif
+<<<<<<< HEAD:JavaScriptCore/wtf/Platform.h
#elif PLATFORM(ANDROID)
+=======
+#elif PLATFORM(QNX)
+>>>>>>> webkit.org at 49305:JavaScriptCore/wtf/Platform.h
#define HAVE_ERRNO_H 1
+<<<<<<< HEAD:JavaScriptCore/wtf/Platform.h
#define HAVE_LANGINFO_H 0
+=======
+>>>>>>> webkit.org at 49305:JavaScriptCore/wtf/Platform.h
#define HAVE_MMAP 1
#define HAVE_SBRK 1
#define HAVE_STRINGS_H 1
@@ -530,7 +655,10 @@
/* FIXME: is this actually used or do other platforms generate their own config.h? */
#define HAVE_ERRNO_H 1
+/* As long as Haiku doesn't have a complete support of locale this will be disabled. */
+#if !PLATFORM(HAIKU)
#define HAVE_LANGINFO_H 1
+#endif
#define HAVE_MMAP 1
#define HAVE_SBRK 1
#define HAVE_STRINGS_H 1
@@ -563,10 +691,22 @@
#define ENABLE_FTPDIR 1
#endif
+#if !defined(ENABLE_CONTEXT_MENUS)
+#define ENABLE_CONTEXT_MENUS 1
+#endif
+
+#if !defined(ENABLE_DRAG_SUPPORT)
+#define ENABLE_DRAG_SUPPORT 1
+#endif
+
#if !defined(ENABLE_DASHBOARD_SUPPORT)
#define ENABLE_DASHBOARD_SUPPORT 0
#endif
+#if !defined(ENABLE_INSPECTOR)
+#define ENABLE_INSPECTOR 1
+#endif
+
#if !defined(ENABLE_MAC_JAVA_BRIDGE)
#define ENABLE_MAC_JAVA_BRIDGE 0
#endif
@@ -575,6 +715,14 @@
#define ENABLE_NETSCAPE_PLUGIN_API 1
#endif
+#if !defined(WTF_USE_PLUGIN_HOST_PROCESS)
+#define WTF_USE_PLUGIN_HOST_PROCESS 0
+#endif
+
+#if !defined(ENABLE_ORIENTATION_EVENTS)
+#define ENABLE_ORIENTATION_EVENTS 0
+#endif
+
#if !defined(ENABLE_OPCODE_STATS)
#define ENABLE_OPCODE_STATS 0
#endif
@@ -594,6 +742,10 @@
#define ENABLE_GEOLOCATION 0
#endif
+#if !defined(ENABLE_NOTIFICATIONS)
+#define ENABLE_NOTIFICATIONS 0
+#endif
+
#if !defined(ENABLE_TEXT_CARET)
#define ENABLE_TEXT_CARET 1
#endif
@@ -608,9 +760,13 @@
#endif
#if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64)
-#if PLATFORM(X86_64) && (PLATFORM(MAC) || (PLATFORM(LINUX) && !PLATFORM(QT)))
+#if PLATFORM(X86_64) && (PLATFORM(DARWIN) || PLATFORM(LINUX))
#define WTF_USE_JSVALUE64 1
-#elif PLATFORM(PPC64) || PLATFORM(QT) /* All Qt layout tests crash in JSVALUE32_64 mode. */
+#elif PLATFORM(ARM) || PLATFORM(PPC64)
+#define WTF_USE_JSVALUE32 1
+#elif PLATFORM(WIN_OS) && COMPILER(MINGW)
+/* Using JSVALUE32_64 causes padding/alignement issues for JITStubArg
+on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#define WTF_USE_JSVALUE32 1
#else
#define WTF_USE_JSVALUE32_64 1
@@ -630,7 +786,7 @@
#elif PLATFORM(X86) && PLATFORM(MAC)
#define ENABLE_JIT 1
#define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
-#elif PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE)
+#elif PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE)
/* Under development, temporarily disabled until 16Mb link range limit in assembler is fixed. */
#define ENABLE_JIT 0
#define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0
@@ -639,18 +795,23 @@
#define ENABLE_JIT 1
#endif
-#if PLATFORM(X86) && PLATFORM(QT)
-#if PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100
+#if PLATFORM(QT)
+#if PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100
#define ENABLE_JIT 1
#define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
-#elif PLATFORM(WIN_OS) && COMPILER(MSVC)
+#elif PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MSVC)
#define ENABLE_JIT 1
#define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
-#elif PLATFORM(LINUX) && GCC_VERSION >= 40100
+#elif PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100
#define ENABLE_JIT 1
#define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
+#elif PLATFORM(ARM_TRADITIONAL) && PLATFORM(LINUX)
+ #define ENABLE_JIT 1
+ #if PLATFORM(ARM_THUMB2)
+ #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0
+ #endif
#endif
-#endif /* PLATFORM(QT) && PLATFORM(X86) */
+#endif /* PLATFORM(QT) */
#endif /* !defined(ENABLE_JIT) */
@@ -694,16 +855,17 @@
#if (PLATFORM(X86) && PLATFORM(MAC)) \
|| (PLATFORM(X86_64) && PLATFORM(MAC)) \
/* Under development, temporarily disabled until 16Mb link range limit in assembler is fixed. */ \
- || (PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE) && 0) \
+ || (PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE) && 0) \
|| (PLATFORM(X86) && PLATFORM(WIN))
#define ENABLE_YARR 1
#define ENABLE_YARR_JIT 1
#endif
-#if PLATFORM(X86) && PLATFORM(QT)
-#if (PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \
- || (PLATFORM(WIN_OS) && COMPILER(MSVC)) \
- || (PLATFORM(LINUX) && GCC_VERSION >= 40100)
+#if PLATFORM(QT)
+#if (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \
+ || (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MSVC)) \
+ || (PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100) \
+ || (PLATFORM(ARM_TRADITIONAL) && PLATFORM(LINUX))
#define ENABLE_YARR 1
#define ENABLE_YARR_JIT 1
#endif
@@ -731,15 +893,11 @@
#define ENABLE_PAN_SCROLLING 1
#endif
-#if !defined(ENABLE_ACTIVEX_TYPE_CONVERSION_WMPLAYER)
-#define ENABLE_ACTIVEX_TYPE_CONVERSION_WMPLAYER 1
-#endif
-
-/* Use the QtXmlStreamReader implementation for XMLTokenizer */
+/* Use the QXmlStreamReader implementation for XMLTokenizer */
+/* Use the QXmlQuery implementation for XSLTProcessor */
#if PLATFORM(QT)
-#if !ENABLE(XSLT)
#define WTF_USE_QXMLSTREAM 1
-#endif
+#define WTF_USE_QXMLQUERY 1
#endif
#if !PLATFORM(QT)
@@ -757,4 +915,13 @@
#define WTF_USE_ACCELERATED_COMPOSITING 1
#endif
+#if COMPILER(GCC)
+#define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result))
+#else
+#define WARN_UNUSED_RETURN
+#endif
+
+/* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */
+#define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK
+
#endif /* WTF_Platform_h */
diff --git a/JavaScriptCore/wtf/PossiblyNull.h b/JavaScriptCore/wtf/PossiblyNull.h
new file mode 100644
index 0000000..79c4d82
--- /dev/null
+++ b/JavaScriptCore/wtf/PossiblyNull.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 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 PossiblyNull_h
+#define PossiblyNull_h
+
+#include "Assertions.h"
+
+namespace WTF {
+
+template <typename T> struct PossiblyNull {
+ PossiblyNull(T data)
+ : m_data(data)
+ {
+ }
+ PossiblyNull(const PossiblyNull<T>& source)
+ : m_data(source.m_data)
+ {
+ source.m_data = 0;
+ }
+ ~PossiblyNull() { ASSERT(!m_data); }
+ bool getValue(T& out) WARN_UNUSED_RETURN;
+private:
+ mutable T m_data;
+};
+
+template <typename T> bool PossiblyNull<T>::getValue(T& out)
+{
+ out = m_data;
+ bool result = !!m_data;
+ m_data = 0;
+ return result;
+}
+
+}
+
+#endif
diff --git a/JavaScriptCore/wtf/PtrAndFlags.h b/JavaScriptCore/wtf/PtrAndFlags.h
index 485c595..5d0bd2a 100644
--- a/JavaScriptCore/wtf/PtrAndFlags.h
+++ b/JavaScriptCore/wtf/PtrAndFlags.h
@@ -34,11 +34,8 @@
#include <wtf/Assertions.h>
namespace WTF {
- template<class T, typename FlagEnum> class PtrAndFlags {
+ template<class T, typename FlagEnum> class PtrAndFlagsBase {
public:
- PtrAndFlags() : m_ptrAndFlags(0) {}
- PtrAndFlags(T* ptr) : m_ptrAndFlags(0) { set(ptr); }
-
bool isFlagSet(FlagEnum flagNumber) const { ASSERT(flagNumber < 2); return m_ptrAndFlags & (1 << flagNumber); }
void setFlag(FlagEnum flagNumber) { ASSERT(flagNumber < 2); m_ptrAndFlags |= (1 << flagNumber);}
void clearFlag(FlagEnum flagNumber) { ASSERT(flagNumber < 2); m_ptrAndFlags &= ~(1 << flagNumber);}
@@ -55,14 +52,28 @@ namespace WTF {
bool operator!() const { return !get(); }
T* operator->() const { return reinterpret_cast<T*>(m_ptrAndFlags & ~3); }
- private:
+ protected:
intptr_t m_ptrAndFlags;
#ifndef NDEBUG
void* m_leaksPtr; // Only used to allow tools like leaks on OSX to detect that the memory is referenced.
#endif
};
+
+ template<class T, typename FlagEnum> class PtrAndFlags : public PtrAndFlagsBase<T, FlagEnum> {
+ public:
+ PtrAndFlags()
+ {
+ PtrAndFlagsBase<T, FlagEnum>::m_ptrAndFlags = 0;
+ }
+ PtrAndFlags(T* ptr)
+ {
+ PtrAndFlagsBase<T, FlagEnum>::m_ptrAndFlags = 0;
+ set(ptr);
+ }
+ };
} // namespace WTF
+using WTF::PtrAndFlagsBase;
using WTF::PtrAndFlags;
#endif // PtrAndFlags_h
diff --git a/JavaScriptCore/wtf/RandomNumber.cpp b/JavaScriptCore/wtf/RandomNumber.cpp
index 0e6e208..52fb130 100644
--- a/JavaScriptCore/wtf/RandomNumber.cpp
+++ b/JavaScriptCore/wtf/RandomNumber.cpp
@@ -82,6 +82,23 @@ double randomNumber()
return static_cast<double>(fullRandom)/static_cast<double>(1LL << 53);
#elif PLATFORM(WINCE)
return genrand_res53();
+#elif PLATFORM(WIN_OS)
+ uint32_t part1 = rand() & (RAND_MAX - 1);
+ uint32_t part2 = rand() & (RAND_MAX - 1);
+ uint32_t part3 = rand() & (RAND_MAX - 1);
+ uint32_t part4 = rand() & (RAND_MAX - 1);
+ // rand only provides 15 bits on Win32
+ uint64_t fullRandom = part1;
+ fullRandom <<= 15;
+ fullRandom |= part2;
+ fullRandom <<= 15;
+ fullRandom |= part3;
+ fullRandom <<= 15;
+ fullRandom |= part4;
+
+ // Mask off the low 53bits
+ fullRandom &= (1LL << 53) - 1;
+ return static_cast<double>(fullRandom)/static_cast<double>(1LL << 53);
#else
uint32_t part1 = rand() & (RAND_MAX - 1);
uint32_t part2 = rand() & (RAND_MAX - 1);
diff --git a/JavaScriptCore/wtf/RefPtr.h b/JavaScriptCore/wtf/RefPtr.h
index 74cd0ea..e6d1047 100644
--- a/JavaScriptCore/wtf/RefPtr.h
+++ b/JavaScriptCore/wtf/RefPtr.h
@@ -30,6 +30,7 @@ namespace WTF {
enum PlacementNewAdoptType { PlacementNewAdopt };
template <typename T> class PassRefPtr;
+ template <typename T> class NonNullPassRefPtr;
enum HashTableDeletedValueType { HashTableDeletedValue };
@@ -40,6 +41,7 @@ namespace WTF {
RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { if (T* ptr = m_ptr) ptr->ref(); }
// see comment in PassRefPtr.h for why this takes const reference
template <typename U> RefPtr(const PassRefPtr<U>&);
+ template <typename U> RefPtr(const NonNullPassRefPtr<U>&);
// Special constructor for cases where we overwrite an object in place.
RefPtr(PlacementNewAdoptType) { }
@@ -73,8 +75,10 @@ namespace WTF {
RefPtr& operator=(const RefPtr&);
RefPtr& operator=(T*);
RefPtr& operator=(const PassRefPtr<T>&);
+ RefPtr& operator=(const NonNullPassRefPtr<T>&);
template <typename U> RefPtr& operator=(const RefPtr<U>&);
template <typename U> RefPtr& operator=(const PassRefPtr<U>&);
+ template <typename U> RefPtr& operator=(const NonNullPassRefPtr<U>&);
void swap(RefPtr&);
@@ -89,6 +93,11 @@ namespace WTF {
{
}
+ template <typename T> template <typename U> inline RefPtr<T>::RefPtr(const NonNullPassRefPtr<U>& o)
+ : m_ptr(o.releaseRef())
+ {
+ }
+
template <typename T> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr<T>& o)
{
T* optr = o.get();
@@ -133,6 +142,15 @@ namespace WTF {
return *this;
}
+ template <typename T> inline RefPtr<T>& RefPtr<T>::operator=(const NonNullPassRefPtr<T>& o)
+ {
+ T* ptr = m_ptr;
+ m_ptr = o.releaseRef();
+ if (ptr)
+ ptr->deref();
+ return *this;
+ }
+
template <typename T> template <typename U> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<U>& o)
{
T* ptr = m_ptr;
@@ -142,6 +160,15 @@ namespace WTF {
return *this;
}
+ template <typename T> template <typename U> inline RefPtr<T>& RefPtr<T>::operator=(const NonNullPassRefPtr<U>& o)
+ {
+ T* ptr = m_ptr;
+ m_ptr = o.releaseRef();
+ if (ptr)
+ ptr->deref();
+ return *this;
+ }
+
template <class T> inline void RefPtr<T>::swap(RefPtr<T>& o)
{
std::swap(m_ptr, o.m_ptr);
diff --git a/JavaScriptCore/wtf/SegmentedVector.h b/JavaScriptCore/wtf/SegmentedVector.h
index 065c19c..b1cbc4d 100644
--- a/JavaScriptCore/wtf/SegmentedVector.h
+++ b/JavaScriptCore/wtf/SegmentedVector.h
@@ -116,6 +116,7 @@ namespace WTF {
}
size_t size() const { return m_size; }
+ bool isEmpty() const { return !size(); }
T& at(size_t index)
{
@@ -249,4 +250,6 @@ namespace WTF {
} // namespace WTF
+using WTF::SegmentedVector;
+
#endif // SegmentedVector_h
diff --git a/JavaScriptCore/wtf/StringExtras.h b/JavaScriptCore/wtf/StringExtras.h
index 1c23390..559e3f2 100644
--- a/JavaScriptCore/wtf/StringExtras.h
+++ b/JavaScriptCore/wtf/StringExtras.h
@@ -85,4 +85,20 @@ inline int strcasecmp(const char* s1, const char* s2)
#endif
+#if PLATFORM(WIN_OS) || PLATFORM(LINUX)
+
+inline char* strnstr(const char* buffer, const char* target, size_t bufferLength)
+{
+ size_t targetLength = strlen(target);
+ if (targetLength == 0)
+ return const_cast<char*>(buffer);
+ for (const char* start = buffer; *start && start + targetLength <= buffer + bufferLength; start++) {
+ if (*start == *target && strncmp(start + 1, target + 1, targetLength - 1) == 0)
+ return const_cast<char*>(start);
+ }
+ return 0;
+}
+
+#endif
+
#endif // WTF_StringExtras_h
diff --git a/JavaScriptCore/wtf/TCSpinLock.h b/JavaScriptCore/wtf/TCSpinLock.h
index ced2283..4cf30c2 100644
--- a/JavaScriptCore/wtf/TCSpinLock.h
+++ b/JavaScriptCore/wtf/TCSpinLock.h
@@ -209,6 +209,13 @@ struct TCMalloc_SpinLock {
inline void Unlock() {
if (pthread_mutex_unlock(&private_lock_) != 0) CRASH();
}
+ bool IsHeld() {
+ if (pthread_mutex_trylock(&private_lock_))
+ return true;
+
+ Unlock();
+ return false;
+ }
};
#define SPINLOCK_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }
diff --git a/JavaScriptCore/wtf/ThreadSpecific.h b/JavaScriptCore/wtf/ThreadSpecific.h
index 4d5d2f7..b6f5fd3 100644
--- a/JavaScriptCore/wtf/ThreadSpecific.h
+++ b/JavaScriptCore/wtf/ThreadSpecific.h
@@ -79,10 +79,13 @@ private:
#if USE(PTHREADS) || PLATFORM(QT) || PLATFORM(WIN_OS)
struct Data : Noncopyable {
Data(T* value, ThreadSpecific<T>* owner) : value(value), owner(owner) {}
+#if PLATFORM(QT)
+ ~Data() { owner->destroy(this); }
+#endif
T* value;
ThreadSpecific<T>* owner;
-#if !USE(PTHREADS)
+#if !USE(PTHREADS) && !PLATFORM(QT)
void (*destructor)(void*);
#endif
};
@@ -136,9 +139,7 @@ inline ThreadSpecific<T>::ThreadSpecific()
template<typename T>
inline ThreadSpecific<T>::~ThreadSpecific()
{
- Data* data = static_cast<Data*>(m_key.localData());
- if (data)
- data->destructor(data);
+ // Does not invoke destructor functions. QThreadStorage will do it
}
template<typename T>
@@ -153,7 +154,6 @@ inline void ThreadSpecific<T>::set(T* ptr)
{
ASSERT(!get());
Data* data = new Data(ptr, this);
- data->destructor = &ThreadSpecific<T>::destroy;
m_key.setLocalData(data);
}
@@ -218,21 +218,27 @@ inline void ThreadSpecific<T>::destroy(void* ptr)
// Some pthreads implementations zero out the pointer before calling destroy(), so we temporarily reset it.
pthread_setspecific(data->owner->m_key, ptr);
#endif
-
+#if PLATFORM(QT)
+ // See comment as above
+ data->owner->m_key.setLocalData(data);
+#endif
+
data->value->~T();
fastFree(data->value);
#if USE(PTHREADS)
pthread_setspecific(data->owner->m_key, 0);
#elif PLATFORM(QT)
- data->owner->m_key.setLocalData(0);
+ // Do nothing here
#elif PLATFORM(WIN_OS)
TlsSetValue(tlsKeys()[data->owner->m_index], 0);
#else
#error ThreadSpecific is not implemented for this platform.
#endif
+#if !PLATFORM(QT)
delete data;
+#endif
}
template<typename T>
diff --git a/JavaScriptCore/wtf/Threading.h b/JavaScriptCore/wtf/Threading.h
index bbfe8b5..e4a0b05 100644
--- a/JavaScriptCore/wtf/Threading.h
+++ b/JavaScriptCore/wtf/Threading.h
@@ -221,28 +221,32 @@ private:
#define WTF_USE_LOCKFREE_THREADSAFESHARED 1
#if COMPILER(MINGW) || COMPILER(MSVC7) || PLATFORM(WINCE)
-inline void atomicIncrement(int* addend) { InterlockedIncrement(reinterpret_cast<long*>(addend)); }
+inline int atomicIncrement(int* addend) { return InterlockedIncrement(reinterpret_cast<long*>(addend)); }
inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpret_cast<long*>(addend)); }
#else
-inline void atomicIncrement(int volatile* addend) { InterlockedIncrement(reinterpret_cast<long volatile*>(addend)); }
+inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(reinterpret_cast<long volatile*>(addend)); }
inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(reinterpret_cast<long volatile*>(addend)); }
#endif
#elif PLATFORM(DARWIN)
#define WTF_USE_LOCKFREE_THREADSAFESHARED 1
-inline void atomicIncrement(int volatile* addend) { OSAtomicIncrement32Barrier(const_cast<int*>(addend)); }
+inline int atomicIncrement(int volatile* addend) { return OSAtomicIncrement32Barrier(const_cast<int*>(addend)); }
inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Barrier(const_cast<int*>(addend)); }
+<<<<<<< HEAD:JavaScriptCore/wtf/Threading.h
#elif defined ANDROID
inline void atomicIncrement(int volatile* addend) { android_atomic_inc(addend); }
inline int atomicDecrement(int volatile* addend) { return android_atomic_dec(addend); }
#elif COMPILER(GCC)
+=======
+#elif COMPILER(GCC) && !PLATFORM(SPARC64) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc
+>>>>>>> webkit.org at 49305:JavaScriptCore/wtf/Threading.h
#define WTF_USE_LOCKFREE_THREADSAFESHARED 1
-inline void atomicIncrement(int volatile* addend) { __gnu_cxx::__atomic_add(addend, 1); }
+inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; }
inline int atomicDecrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, -1) - 1; }
#endif
@@ -336,6 +340,11 @@ using WTF::ThreadCondition;
using WTF::ThreadIdentifier;
using WTF::ThreadSafeShared;
+#if USE(LOCKFREE_THREADSAFESHARED)
+using WTF::atomicDecrement;
+using WTF::atomicIncrement;
+#endif
+
using WTF::createThread;
using WTF::currentThread;
using WTF::isMainThread;
diff --git a/JavaScriptCore/wtf/ThreadingPthreads.cpp b/JavaScriptCore/wtf/ThreadingPthreads.cpp
index ea09a1f..abefb40 100644
--- a/JavaScriptCore/wtf/ThreadingPthreads.cpp
+++ b/JavaScriptCore/wtf/ThreadingPthreads.cpp
@@ -39,8 +39,11 @@
#include "StdLibExtras.h"
#include "UnusedParam.h"
#include <errno.h>
+
+#if !COMPILER(MSVC)
#include <limits.h>
#include <sys/time.h>
+#endif
#if PLATFORM(ANDROID)
#include "jni_utility.h"
@@ -184,7 +187,7 @@ ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, con
void setThreadNameInternal(const char* threadName)
{
-#if PLATFORM(DARWIN) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !PLATFORM(IPHONE)
+#if HAVE(PTHREAD_SETNAME_NP)
pthread_setname_np(threadName);
#else
UNUSED_PARAM(threadName);
diff --git a/JavaScriptCore/wtf/Vector.h b/JavaScriptCore/wtf/Vector.h
index 7cba4e4..e1fc5b4 100644
--- a/JavaScriptCore/wtf/Vector.h
+++ b/JavaScriptCore/wtf/Vector.h
@@ -63,6 +63,13 @@ namespace WTF {
template <size_t size> struct AlignedBuffer<size, 32> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 32); };
template <size_t size> struct AlignedBuffer<size, 64> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 64); };
+ template <size_t size, size_t alignment>
+ void swap(AlignedBuffer<size, alignment>& a, AlignedBuffer<size, alignment>& b)
+ {
+ for (size_t i = 0; i < size; ++i)
+ std::swap(a.buffer[i], b.buffer[i]);
+ }
+
template <bool needsDestruction, typename T>
class VectorDestructor;
@@ -404,6 +411,27 @@ namespace WTF {
Base::deallocateBuffer(bufferToDeallocate);
}
+ void swap(VectorBuffer<T, inlineCapacity>& other)
+ {
+ if (buffer() == inlineBuffer() && other.buffer() == other.inlineBuffer()) {
+ WTF::swap(m_inlineBuffer, other.m_inlineBuffer);
+ std::swap(m_capacity, other.m_capacity);
+ } else if (buffer() == inlineBuffer()) {
+ m_buffer = other.m_buffer;
+ other.m_buffer = other.inlineBuffer();
+ WTF::swap(m_inlineBuffer, other.m_inlineBuffer);
+ std::swap(m_capacity, other.m_capacity);
+ } else if (other.buffer() == other.inlineBuffer()) {
+ other.m_buffer = m_buffer;
+ m_buffer = inlineBuffer();
+ WTF::swap(m_inlineBuffer, other.m_inlineBuffer);
+ std::swap(m_capacity, other.m_capacity);
+ } else {
+ std::swap(m_buffer, other.m_buffer);
+ std::swap(m_capacity, other.m_capacity);
+ }
+ }
+
void restoreInlineBufferIfNeeded()
{
if (m_buffer)
diff --git a/JavaScriptCore/wtf/VectorTraits.h b/JavaScriptCore/wtf/VectorTraits.h
index 7974b9a..eb4c279 100644
--- a/JavaScriptCore/wtf/VectorTraits.h
+++ b/JavaScriptCore/wtf/VectorTraits.h
@@ -21,6 +21,7 @@
#ifndef WTF_VectorTraits_h
#define WTF_VectorTraits_h
+#include "OwnPtr.h"
#include "RefPtr.h"
#include "TypeTraits.h"
#include <utility>
@@ -71,11 +72,14 @@ namespace WTF {
static const bool canCompareWithMemcmp = true;
};
- // we know RefPtr is simple enough that initializing to 0 and moving with memcpy
+ // we know OwnPtr and RefPtr are simple enough that initializing to 0 and moving with memcpy
// (and then not destructing the original) will totally work
template<typename P>
struct VectorTraits<RefPtr<P> > : SimpleClassVectorTraits { };
-
+
+ template<typename P>
+ struct VectorTraits<OwnPtr<P> > : SimpleClassVectorTraits { };
+
template<typename P>
struct VectorTraits<std::auto_ptr<P> > : SimpleClassVectorTraits { };
diff --git a/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp b/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp
index 4fd7b35..10c4248 100644
--- a/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp
+++ b/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp
@@ -30,6 +30,7 @@
#include "config.h"
#include "MainThread.h"
+#include "NotImplemented.h"
namespace WTF {
diff --git a/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h b/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
index 1531694..bdf2028 100644
--- a/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
+++ b/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
@@ -58,7 +58,7 @@ QT_END_NAMESPACE
#endif
// ugly hack to make UChar compatible with JSChar in API/JSStringRef.h
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) || COMPILER(WINSCW)
typedef wchar_t UChar;
#else
typedef uint16_t UChar;
diff --git a/JavaScriptCore/yarr/RegexInterpreter.cpp b/JavaScriptCore/yarr/RegexInterpreter.cpp
index b0aae65..aafea3c 100644
--- a/JavaScriptCore/yarr/RegexInterpreter.cpp
+++ b/JavaScriptCore/yarr/RegexInterpreter.cpp
@@ -20,7 +20,7 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
@@ -90,7 +90,7 @@ public:
: term(0)
{
}
-
+
void* operator new(size_t, void* where)
{
return where;
@@ -124,7 +124,7 @@ public:
subpatternBackup[i] = output[(firstSubpatternId << 1) + i];
output[(firstSubpatternId << 1) + i] = -1;
}
-
+
new(getDisjunctionContext(term)) DisjunctionContext();
}
@@ -138,7 +138,7 @@ public:
for (unsigned i = 0; i < (numNestedSubpatterns << 1); ++i)
output[(firstSubpatternId << 1) + i] = subpatternBackup[i];
}
-
+
DisjunctionContext* getDisjunctionContext(ByteTerm& term)
{
return reinterpret_cast<DisjunctionContext*>(&(subpatternBackup[term.atom.parenthesesDisjunction->m_numSubpatterns << 1]));
@@ -208,7 +208,7 @@ public:
return input[pos - 1];
return -1;
}
-
+
unsigned getPos()
{
return pos;
@@ -218,7 +218,7 @@ public:
{
pos = p;
}
-
+
bool atStart()
{
return pos == 0;
@@ -284,7 +284,7 @@ public:
{
if (input.atEnd())
return false;
-
+
int ch = input.read();
if (pattern->m_ignoreCase ? ((Unicode::toLower(testChar) == ch) || (Unicode::toUpper(testChar) == ch)) : (testChar == ch)) {
@@ -341,7 +341,7 @@ public:
return false;
}
}
-
+
return true;
}
@@ -606,10 +606,10 @@ public:
if (matchDisjunction(term.atom.parenthesesDisjunction, context->getDisjunctionContext(term), true))
return true;
-
+
resetMatches(term, context);
- freeParenthesesDisjunctionContext(context);
popParenthesesDisjunctionContext(backTrack);
+ freeParenthesesDisjunctionContext(context);
}
return false;
@@ -910,8 +910,8 @@ public:
}
} else {
resetMatches(term, context);
- freeParenthesesDisjunctionContext(context);
popParenthesesDisjunctionContext(backTrack);
+ freeParenthesesDisjunctionContext(context);
}
if (backTrack->matchAmount) {
@@ -946,11 +946,11 @@ public:
}
return true;
}
-
+
// pop a match off the stack
resetMatches(term, context);
- freeParenthesesDisjunctionContext(context);
popParenthesesDisjunctionContext(backTrack);
+ freeParenthesesDisjunctionContext(context);
}
return false;
@@ -1266,37 +1266,37 @@ public:
ByteCompiler(RegexPattern& pattern)
: m_pattern(pattern)
{
- bodyDisjunction = 0;
- currentAlternativeIndex = 0;
+ m_bodyDisjunction = 0;
+ m_currentAlternativeIndex = 0;
}
-
+
BytecodePattern* compile()
{
regexBegin(m_pattern.m_numSubpatterns, m_pattern.m_body->m_callFrameSize);
emitDisjunction(m_pattern.m_body);
regexEnd();
- return new BytecodePattern(bodyDisjunction, m_allParenthesesInfo, m_pattern);
+ return new BytecodePattern(m_bodyDisjunction, m_allParenthesesInfo, m_pattern);
}
-
+
void checkInput(unsigned count)
{
- bodyDisjunction->terms.append(ByteTerm::CheckInput(count));
+ m_bodyDisjunction->terms.append(ByteTerm::CheckInput(count));
}
void assertionBOL(int inputPosition)
{
- bodyDisjunction->terms.append(ByteTerm::BOL(inputPosition));
+ m_bodyDisjunction->terms.append(ByteTerm::BOL(inputPosition));
}
void assertionEOL(int inputPosition)
{
- bodyDisjunction->terms.append(ByteTerm::EOL(inputPosition));
+ m_bodyDisjunction->terms.append(ByteTerm::EOL(inputPosition));
}
void assertionWordBoundary(bool invert, int inputPosition)
{
- bodyDisjunction->terms.append(ByteTerm::WordBoundary(invert, inputPosition));
+ m_bodyDisjunction->terms.append(ByteTerm::WordBoundary(invert, inputPosition));
}
void atomPatternCharacter(UChar ch, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
@@ -1304,60 +1304,60 @@ public:
if (m_pattern.m_ignoreCase) {
UChar lo = Unicode::toLower(ch);
UChar hi = Unicode::toUpper(ch);
-
+
if (lo != hi) {
- bodyDisjunction->terms.append(ByteTerm(lo, hi, inputPosition, frameLocation, quantityCount, quantityType));
+ m_bodyDisjunction->terms.append(ByteTerm(lo, hi, inputPosition, frameLocation, quantityCount, quantityType));
return;
}
}
- bodyDisjunction->terms.append(ByteTerm(ch, inputPosition, frameLocation, quantityCount, quantityType));
+ m_bodyDisjunction->terms.append(ByteTerm(ch, inputPosition, frameLocation, quantityCount, quantityType));
}
-
+
void atomCharacterClass(CharacterClass* characterClass, bool invert, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
{
- bodyDisjunction->terms.append(ByteTerm(characterClass, invert, inputPosition));
+ m_bodyDisjunction->terms.append(ByteTerm(characterClass, invert, inputPosition));
- bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].atom.quantityCount = quantityCount;
- bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].atom.quantityType = quantityType;
- bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].atom.quantityType = quantityType;
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
}
void atomBackReference(unsigned subpatternId, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
{
ASSERT(subpatternId);
- bodyDisjunction->terms.append(ByteTerm::BackReference(subpatternId, inputPosition));
+ m_bodyDisjunction->terms.append(ByteTerm::BackReference(subpatternId, inputPosition));
- bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].atom.quantityCount = quantityCount;
- bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].atom.quantityType = quantityType;
- bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].atom.quantityType = quantityType;
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
}
void atomParenthesesSubpatternBegin(unsigned subpatternId, bool capture, int inputPosition, unsigned frameLocation, unsigned alternativeFrameLocation)
{
- int beginTerm = bodyDisjunction->terms.size();
+ int beginTerm = m_bodyDisjunction->terms.size();
- bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpatternOnceBegin, subpatternId, capture, inputPosition));
- bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
- bodyDisjunction->terms.append(ByteTerm::AlternativeBegin());
- bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].frameLocation = alternativeFrameLocation;
+ m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpatternOnceBegin, subpatternId, capture, inputPosition));
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
+ m_bodyDisjunction->terms.append(ByteTerm::AlternativeBegin());
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = alternativeFrameLocation;
- m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, currentAlternativeIndex));
- currentAlternativeIndex = beginTerm + 1;
+ m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, m_currentAlternativeIndex));
+ m_currentAlternativeIndex = beginTerm + 1;
}
void atomParentheticalAssertionBegin(unsigned subpatternId, bool invert, unsigned frameLocation, unsigned alternativeFrameLocation)
{
- int beginTerm = bodyDisjunction->terms.size();
+ int beginTerm = m_bodyDisjunction->terms.size();
- bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParentheticalAssertionBegin, subpatternId, invert, 0));
- bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
- bodyDisjunction->terms.append(ByteTerm::AlternativeBegin());
- bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].frameLocation = alternativeFrameLocation;
+ m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParentheticalAssertionBegin, subpatternId, invert, 0));
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
+ m_bodyDisjunction->terms.append(ByteTerm::AlternativeBegin());
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = alternativeFrameLocation;
- m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, currentAlternativeIndex));
- currentAlternativeIndex = beginTerm + 1;
+ m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, m_currentAlternativeIndex));
+ m_currentAlternativeIndex = beginTerm + 1;
}
unsigned popParenthesesStack()
@@ -1365,12 +1365,12 @@ public:
ASSERT(m_parenthesesStack.size());
int stackEnd = m_parenthesesStack.size() - 1;
unsigned beginTerm = m_parenthesesStack[stackEnd].beginTerm;
- currentAlternativeIndex = m_parenthesesStack[stackEnd].savedAlternativeIndex;
+ m_currentAlternativeIndex = m_parenthesesStack[stackEnd].savedAlternativeIndex;
m_parenthesesStack.shrink(stackEnd);
- ASSERT(beginTerm < bodyDisjunction->terms.size());
- ASSERT(currentAlternativeIndex < bodyDisjunction->terms.size());
-
+ ASSERT(beginTerm < m_bodyDisjunction->terms.size());
+ ASSERT(m_currentAlternativeIndex < m_bodyDisjunction->terms.size());
+
return beginTerm;
}
@@ -1387,25 +1387,25 @@ public:
void closeAlternative(int beginTerm)
{
int origBeginTerm = beginTerm;
- ASSERT(bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeAlternativeBegin);
- int endIndex = bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeAlternativeBegin);
+ int endIndex = m_bodyDisjunction->terms.size();
- unsigned frameLocation = bodyDisjunction->terms[beginTerm].frameLocation;
+ unsigned frameLocation = m_bodyDisjunction->terms[beginTerm].frameLocation;
- if (!bodyDisjunction->terms[beginTerm].alternative.next)
- bodyDisjunction->terms.remove(beginTerm);
+ if (!m_bodyDisjunction->terms[beginTerm].alternative.next)
+ m_bodyDisjunction->terms.remove(beginTerm);
else {
- while (bodyDisjunction->terms[beginTerm].alternative.next) {
- beginTerm += bodyDisjunction->terms[beginTerm].alternative.next;
- ASSERT(bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeAlternativeDisjunction);
- bodyDisjunction->terms[beginTerm].alternative.end = endIndex - beginTerm;
- bodyDisjunction->terms[beginTerm].frameLocation = frameLocation;
+ while (m_bodyDisjunction->terms[beginTerm].alternative.next) {
+ beginTerm += m_bodyDisjunction->terms[beginTerm].alternative.next;
+ ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeAlternativeDisjunction);
+ m_bodyDisjunction->terms[beginTerm].alternative.end = endIndex - beginTerm;
+ m_bodyDisjunction->terms[beginTerm].frameLocation = frameLocation;
}
-
- bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm;
- bodyDisjunction->terms.append(ByteTerm::AlternativeEnd());
- bodyDisjunction->terms[endIndex].frameLocation = frameLocation;
+ m_bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm;
+
+ m_bodyDisjunction->terms.append(ByteTerm::AlternativeEnd());
+ m_bodyDisjunction->terms[endIndex].frameLocation = frameLocation;
}
}
@@ -1413,46 +1413,46 @@ public:
{
int beginTerm = 0;
int origBeginTerm = 0;
- ASSERT(bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeBodyAlternativeBegin);
- int endIndex = bodyDisjunction->terms.size();
+ ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeBodyAlternativeBegin);
+ int endIndex = m_bodyDisjunction->terms.size();
- unsigned frameLocation = bodyDisjunction->terms[beginTerm].frameLocation;
+ unsigned frameLocation = m_bodyDisjunction->terms[beginTerm].frameLocation;
- while (bodyDisjunction->terms[beginTerm].alternative.next) {
- beginTerm += bodyDisjunction->terms[beginTerm].alternative.next;
- ASSERT(bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeBodyAlternativeDisjunction);
- bodyDisjunction->terms[beginTerm].alternative.end = endIndex - beginTerm;
- bodyDisjunction->terms[beginTerm].frameLocation = frameLocation;
+ while (m_bodyDisjunction->terms[beginTerm].alternative.next) {
+ beginTerm += m_bodyDisjunction->terms[beginTerm].alternative.next;
+ ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeBodyAlternativeDisjunction);
+ m_bodyDisjunction->terms[beginTerm].alternative.end = endIndex - beginTerm;
+ m_bodyDisjunction->terms[beginTerm].frameLocation = frameLocation;
}
-
- bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm;
- bodyDisjunction->terms.append(ByteTerm::BodyAlternativeEnd());
- bodyDisjunction->terms[endIndex].frameLocation = frameLocation;
+ m_bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm;
+
+ m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeEnd());
+ m_bodyDisjunction->terms[endIndex].frameLocation = frameLocation;
}
void atomParenthesesEnd(bool doInline, unsigned lastSubpatternId, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType, unsigned callFrameSize = 0)
{
unsigned beginTerm = popParenthesesStack();
closeAlternative(beginTerm + 1);
- unsigned endTerm = bodyDisjunction->terms.size();
+ unsigned endTerm = m_bodyDisjunction->terms.size();
- bool isAssertion = bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParentheticalAssertionBegin;
- bool invertOrCapture = bodyDisjunction->terms[beginTerm].invertOrCapture;
- unsigned subpatternId = bodyDisjunction->terms[beginTerm].atom.subpatternId;
+ bool isAssertion = m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParentheticalAssertionBegin;
+ bool invertOrCapture = m_bodyDisjunction->terms[beginTerm].invertOrCapture;
+ unsigned subpatternId = m_bodyDisjunction->terms[beginTerm].atom.subpatternId;
- bodyDisjunction->terms.append(ByteTerm(isAssertion ? ByteTerm::TypeParentheticalAssertionEnd : ByteTerm::TypeParenthesesSubpatternOnceEnd, subpatternId, invertOrCapture, inputPosition));
- bodyDisjunction->terms[beginTerm].atom.parenthesesWidth = endTerm - beginTerm;
- bodyDisjunction->terms[endTerm].atom.parenthesesWidth = endTerm - beginTerm;
- bodyDisjunction->terms[endTerm].frameLocation = frameLocation;
+ m_bodyDisjunction->terms.append(ByteTerm(isAssertion ? ByteTerm::TypeParentheticalAssertionEnd : ByteTerm::TypeParenthesesSubpatternOnceEnd, subpatternId, invertOrCapture, inputPosition));
+ m_bodyDisjunction->terms[beginTerm].atom.parenthesesWidth = endTerm - beginTerm;
+ m_bodyDisjunction->terms[endTerm].atom.parenthesesWidth = endTerm - beginTerm;
+ m_bodyDisjunction->terms[endTerm].frameLocation = frameLocation;
if (doInline) {
- bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount;
- bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType;
- bodyDisjunction->terms[endTerm].atom.quantityCount = quantityCount;
- bodyDisjunction->terms[endTerm].atom.quantityType = quantityType;
+ m_bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType;
+ m_bodyDisjunction->terms[endTerm].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[endTerm].atom.quantityType = quantityType;
} else {
- ByteTerm& parenthesesBegin = bodyDisjunction->terms[beginTerm];
+ ByteTerm& parenthesesBegin = m_bodyDisjunction->terms[beginTerm];
ASSERT(parenthesesBegin.type == ByteTerm::TypeParenthesesSubpatternOnceBegin);
bool invertOrCapture = parenthesesBegin.invertOrCapture;
@@ -1463,26 +1463,26 @@ public:
parenthesesDisjunction->terms.append(ByteTerm::SubpatternBegin());
for (unsigned termInParentheses = beginTerm + 1; termInParentheses < endTerm; ++termInParentheses)
- parenthesesDisjunction->terms.append(bodyDisjunction->terms[termInParentheses]);
+ parenthesesDisjunction->terms.append(m_bodyDisjunction->terms[termInParentheses]);
parenthesesDisjunction->terms.append(ByteTerm::SubpatternEnd());
- bodyDisjunction->terms.shrink(beginTerm);
+ m_bodyDisjunction->terms.shrink(beginTerm);
m_allParenthesesInfo.append(parenthesesDisjunction);
- bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpattern, subpatternId, parenthesesDisjunction, invertOrCapture, inputPosition));
+ m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpattern, subpatternId, parenthesesDisjunction, invertOrCapture, inputPosition));
- bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount;
- bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType;
- bodyDisjunction->terms[beginTerm].frameLocation = frameLocation;
+ m_bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType;
+ m_bodyDisjunction->terms[beginTerm].frameLocation = frameLocation;
}
}
void regexBegin(unsigned numSubpatterns, unsigned callFrameSize)
{
- bodyDisjunction = new ByteDisjunction(numSubpatterns, callFrameSize);
- bodyDisjunction->terms.append(ByteTerm::BodyAlternativeBegin());
- bodyDisjunction->terms[0].frameLocation = 0;
- currentAlternativeIndex = 0;
+ m_bodyDisjunction = new ByteDisjunction(numSubpatterns, callFrameSize);
+ m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeBegin());
+ m_bodyDisjunction->terms[0].frameLocation = 0;
+ m_currentAlternativeIndex = 0;
}
void regexEnd()
@@ -1492,27 +1492,27 @@ public:
void alterantiveBodyDisjunction()
{
- int newAlternativeIndex = bodyDisjunction->terms.size();
- bodyDisjunction->terms[currentAlternativeIndex].alternative.next = newAlternativeIndex - currentAlternativeIndex;
- bodyDisjunction->terms.append(ByteTerm::BodyAlternativeDisjunction());
+ int newAlternativeIndex = m_bodyDisjunction->terms.size();
+ m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex;
+ m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeDisjunction());
- currentAlternativeIndex = newAlternativeIndex;
+ m_currentAlternativeIndex = newAlternativeIndex;
}
void alterantiveDisjunction()
{
- int newAlternativeIndex = bodyDisjunction->terms.size();
- bodyDisjunction->terms[currentAlternativeIndex].alternative.next = newAlternativeIndex - currentAlternativeIndex;
- bodyDisjunction->terms.append(ByteTerm::AlternativeDisjunction());
+ int newAlternativeIndex = m_bodyDisjunction->terms.size();
+ m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex;
+ m_bodyDisjunction->terms.append(ByteTerm::AlternativeDisjunction());
- currentAlternativeIndex = newAlternativeIndex;
+ m_currentAlternativeIndex = newAlternativeIndex;
}
void emitDisjunction(PatternDisjunction* disjunction, unsigned inputCountAlreadyChecked = 0, unsigned parenthesesInputCountAlreadyChecked = 0)
{
for (unsigned alt = 0; alt < disjunction->m_alternatives.size(); ++alt) {
unsigned currentCountAlreadyChecked = inputCountAlreadyChecked;
-
+
if (alt) {
if (disjunction == m_pattern.m_body)
alterantiveBodyDisjunction();
@@ -1586,7 +1586,7 @@ public:
case PatternTerm::TypeParentheticalAssertion: {
unsigned alternativeFrameLocation = term.inputPosition + RegexStackSpaceForBackTrackInfoParentheticalAssertion;
-
+
atomParentheticalAssertionBegin(term.parentheses.subpatternId, term.invertOrCapture, term.frameLocation, alternativeFrameLocation);
emitDisjunction(term.parentheses.disjunction, currentCountAlreadyChecked, 0);
atomParenthesesEnd(true, term.parentheses.lastSubpatternId, 0, term.frameLocation, term.quantityCount, term.quantityType);
@@ -1599,8 +1599,8 @@ public:
private:
RegexPattern& m_pattern;
- ByteDisjunction* bodyDisjunction;
- unsigned currentAlternativeIndex;
+ ByteDisjunction* m_bodyDisjunction;
+ unsigned m_currentAlternativeIndex;
Vector<ParenthesesStackEntry> m_parenthesesStack;
Vector<ByteDisjunction*> m_allParenthesesInfo;
};
diff --git a/JavaScriptCore/yarr/RegexInterpreter.h b/JavaScriptCore/yarr/RegexInterpreter.h
index a8c122a..48c9a5e 100644
--- a/JavaScriptCore/yarr/RegexInterpreter.h
+++ b/JavaScriptCore/yarr/RegexInterpreter.h
@@ -280,7 +280,7 @@ struct ByteTerm {
}
};
-class ByteDisjunction {
+class ByteDisjunction : public FastAllocBase {
public:
ByteDisjunction(unsigned numSubpatterns, unsigned frameSize)
: m_numSubpatterns(numSubpatterns)
@@ -293,7 +293,7 @@ public:
unsigned m_frameSize;
};
-struct BytecodePattern {
+struct BytecodePattern : FastAllocBase {
BytecodePattern(ByteDisjunction* body, Vector<ByteDisjunction*> allParenthesesInfo, RegexPattern& pattern)
: m_body(body)
, m_ignoreCase(pattern.m_ignoreCase)
diff --git a/JavaScriptCore/yarr/RegexJIT.cpp b/JavaScriptCore/yarr/RegexJIT.cpp
index 663a524..d777424 100644
--- a/JavaScriptCore/yarr/RegexJIT.cpp
+++ b/JavaScriptCore/yarr/RegexJIT.cpp
@@ -45,35 +45,35 @@ class RegexGenerator : private MacroAssembler {
friend void jitCompileRegex(JSGlobalData* globalData, RegexCodeBlock& jitObject, const UString& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase, bool multiline);
#if PLATFORM(ARM)
- static const RegisterID input = ARM::r0;
- static const RegisterID index = ARM::r1;
- static const RegisterID length = ARM::r2;
- static const RegisterID output = ARM::r4;
+ static const RegisterID input = ARMRegisters::r0;
+ static const RegisterID index = ARMRegisters::r1;
+ static const RegisterID length = ARMRegisters::r2;
+ static const RegisterID output = ARMRegisters::r4;
- static const RegisterID regT0 = ARM::r5;
- static const RegisterID regT1 = ARM::r6;
+ static const RegisterID regT0 = ARMRegisters::r5;
+ static const RegisterID regT1 = ARMRegisters::r6;
- static const RegisterID returnRegister = ARM::r0;
+ static const RegisterID returnRegister = ARMRegisters::r0;
#elif PLATFORM(X86)
- static const RegisterID input = X86::eax;
- static const RegisterID index = X86::edx;
- static const RegisterID length = X86::ecx;
- static const RegisterID output = X86::edi;
+ static const RegisterID input = X86Registers::eax;
+ static const RegisterID index = X86Registers::edx;
+ static const RegisterID length = X86Registers::ecx;
+ static const RegisterID output = X86Registers::edi;
- static const RegisterID regT0 = X86::ebx;
- static const RegisterID regT1 = X86::esi;
+ static const RegisterID regT0 = X86Registers::ebx;
+ static const RegisterID regT1 = X86Registers::esi;
- static const RegisterID returnRegister = X86::eax;
+ static const RegisterID returnRegister = X86Registers::eax;
#elif PLATFORM(X86_64)
- static const RegisterID input = X86::edi;
- static const RegisterID index = X86::esi;
- static const RegisterID length = X86::edx;
- static const RegisterID output = X86::ecx;
+ static const RegisterID input = X86Registers::edi;
+ static const RegisterID index = X86Registers::esi;
+ static const RegisterID length = X86Registers::edx;
+ static const RegisterID output = X86Registers::ecx;
- static const RegisterID regT0 = X86::eax;
- static const RegisterID regT1 = X86::ebx;
+ static const RegisterID regT0 = X86Registers::eax;
+ static const RegisterID regT1 = X86Registers::ebx;
- static const RegisterID returnRegister = X86::eax;
+ static const RegisterID returnRegister = X86Registers::eax;
#endif
void optimizeAlternative(PatternAlternative* alternative)
@@ -549,11 +549,11 @@ class RegexGenerator : private MacroAssembler {
}
if (mask) {
- load32(BaseIndex(input, index, TimesTwo, state.inputOffset() * sizeof(UChar)), character);
+ load32WithUnalignedHalfWords(BaseIndex(input, index, TimesTwo, state.inputOffset() * sizeof(UChar)), character);
or32(Imm32(mask), character);
state.jumpToBacktrack(branch32(NotEqual, character, Imm32(chPair | mask)), this);
} else
- state.jumpToBacktrack(branch32(NotEqual, BaseIndex(input, index, TimesTwo, state.inputOffset() * sizeof(UChar)), Imm32(chPair)), this);
+ state.jumpToBacktrack(branch32WithUnalignedHalfWords(NotEqual, BaseIndex(input, index, TimesTwo, state.inputOffset() * sizeof(UChar)), Imm32(chPair)), this);
}
void generatePatternCharacterFixed(TermGenerationState& state)
@@ -1289,50 +1289,50 @@ class RegexGenerator : private MacroAssembler {
void generateEnter()
{
#if PLATFORM(X86_64)
- push(X86::ebp);
- move(stackPointerRegister, X86::ebp);
- push(X86::ebx);
+ push(X86Registers::ebp);
+ move(stackPointerRegister, X86Registers::ebp);
+ push(X86Registers::ebx);
#elif PLATFORM(X86)
- push(X86::ebp);
- move(stackPointerRegister, X86::ebp);
+ push(X86Registers::ebp);
+ move(stackPointerRegister, X86Registers::ebp);
// TODO: do we need spill registers to fill the output pointer if there are no sub captures?
- push(X86::ebx);
- push(X86::edi);
- push(X86::esi);
+ push(X86Registers::ebx);
+ push(X86Registers::edi);
+ push(X86Registers::esi);
// load output into edi (2 = saved ebp + return address).
#if COMPILER(MSVC)
- loadPtr(Address(X86::ebp, 2 * sizeof(void*)), input);
- loadPtr(Address(X86::ebp, 3 * sizeof(void*)), index);
- loadPtr(Address(X86::ebp, 4 * sizeof(void*)), length);
- loadPtr(Address(X86::ebp, 5 * sizeof(void*)), output);
+ loadPtr(Address(X86Registers::ebp, 2 * sizeof(void*)), input);
+ loadPtr(Address(X86Registers::ebp, 3 * sizeof(void*)), index);
+ loadPtr(Address(X86Registers::ebp, 4 * sizeof(void*)), length);
+ loadPtr(Address(X86Registers::ebp, 5 * sizeof(void*)), output);
#else
- loadPtr(Address(X86::ebp, 2 * sizeof(void*)), output);
+ loadPtr(Address(X86Registers::ebp, 2 * sizeof(void*)), output);
#endif
#elif PLATFORM(ARM)
-#if !PLATFORM_ARM_ARCH(7)
- push(ARM::lr);
+#if PLATFORM(ARM_TRADITIONAL)
+ push(ARMRegisters::lr);
#endif
- push(ARM::r4);
- push(ARM::r5);
- push(ARM::r6);
- move(ARM::r3, output);
+ push(ARMRegisters::r4);
+ push(ARMRegisters::r5);
+ push(ARMRegisters::r6);
+ move(ARMRegisters::r3, output);
#endif
}
void generateReturn()
{
#if PLATFORM(X86_64)
- pop(X86::ebx);
- pop(X86::ebp);
+ pop(X86Registers::ebx);
+ pop(X86Registers::ebp);
#elif PLATFORM(X86)
- pop(X86::esi);
- pop(X86::edi);
- pop(X86::ebx);
- pop(X86::ebp);
+ pop(X86Registers::esi);
+ pop(X86Registers::edi);
+ pop(X86Registers::ebx);
+ pop(X86Registers::ebp);
#elif PLATFORM(ARM)
- pop(ARM::r6);
- pop(ARM::r5);
- pop(ARM::r4);
+ pop(ARMRegisters::r6);
+ pop(ARMRegisters::r5);
+ pop(ARMRegisters::r4);
#endif
ret();
}