summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore
diff options
context:
space:
mode:
authorAndrei Popescu <andreip@google.com>2009-08-19 14:09:30 +0100
committerAndrei Popescu <andreip@google.com>2009-08-19 14:09:30 +0100
commit058ccc7ba0a4d59b9f6e92808332aa9895425fc7 (patch)
tree276aad5a2bbc2fd7d65d21bfca42c9de88b3dd20 /JavaScriptCore
parent2796dd1bf3b4b01e7e1d96ea91bd3a212f647579 (diff)
downloadexternal_webkit-058ccc7ba0a4d59b9f6e92808332aa9895425fc7.zip
external_webkit-058ccc7ba0a4d59b9f6e92808332aa9895425fc7.tar.gz
external_webkit-058ccc7ba0a4d59b9f6e92808332aa9895425fc7.tar.bz2
Revert "Merge WebKit r47420"
This reverts commit d227fc870c7a697500a3c900c31baf05fb9a8524.
Diffstat (limited to 'JavaScriptCore')
-rw-r--r--JavaScriptCore/API/JSCallbackConstructor.h2
-rw-r--r--JavaScriptCore/API/JSCallbackFunction.cpp1
-rw-r--r--JavaScriptCore/API/JSCallbackFunction.h2
-rw-r--r--JavaScriptCore/API/JSObjectRef.cpp1
-rw-r--r--JavaScriptCore/Android.mk1
-rw-r--r--JavaScriptCore/ChangeLog1226
-rw-r--r--JavaScriptCore/Configurations/FeatureDefines.xcconfig4
-rw-r--r--JavaScriptCore/GNUmakefile.am11
-rw-r--r--JavaScriptCore/JavaScriptCore.exp13
-rw-r--r--JavaScriptCore/JavaScriptCore.pri11
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def21
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj4
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops2
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj6
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def21
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops52
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops2
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops2
-rw-r--r--JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj18
-rw-r--r--JavaScriptCore/assembler/ARMAssembler.cpp21
-rw-r--r--JavaScriptCore/assembler/ARMAssembler.h24
-rw-r--r--JavaScriptCore/assembler/ARMv7Assembler.h1
-rw-r--r--JavaScriptCore/assembler/AbstractMacroAssembler.h10
-rw-r--r--JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h25
-rw-r--r--JavaScriptCore/assembler/MacroAssemblerARM.h30
-rw-r--r--JavaScriptCore/assembler/X86Assembler.h1
-rw-r--r--JavaScriptCore/bytecode/CodeBlock.cpp98
-rw-r--r--JavaScriptCore/bytecode/CodeBlock.h93
-rw-r--r--JavaScriptCore/bytecode/EvalCodeCache.h36
-rw-r--r--JavaScriptCore/bytecode/SamplingTool.cpp2
-rw-r--r--JavaScriptCore/bytecompiler/BytecodeGenerator.cpp50
-rw-r--r--JavaScriptCore/bytecompiler/BytecodeGenerator.h20
-rw-r--r--JavaScriptCore/debugger/Debugger.cpp66
-rw-r--r--JavaScriptCore/debugger/Debugger.h28
-rw-r--r--JavaScriptCore/debugger/DebuggerCallFrame.cpp16
-rw-r--r--JavaScriptCore/interpreter/CachedCall.h2
-rw-r--r--JavaScriptCore/interpreter/CallFrameClosure.h2
-rw-r--r--JavaScriptCore/interpreter/Interpreter.cpp125
-rw-r--r--JavaScriptCore/interpreter/Interpreter.h16
-rw-r--r--JavaScriptCore/jit/JIT.cpp4
-rw-r--r--JavaScriptCore/jit/JIT.h67
-rw-r--r--JavaScriptCore/jit/JITCall.cpp6
-rw-r--r--JavaScriptCore/jit/JITInlineMethods.h33
-rw-r--r--JavaScriptCore/jit/JITOpcodes.cpp34
-rw-r--r--JavaScriptCore/jit/JITPropertyAccess.cpp21
-rw-r--r--JavaScriptCore/jit/JITStubs.cpp46
-rw-r--r--JavaScriptCore/jit/JITStubs.h6
-rw-r--r--JavaScriptCore/parser/Grammar.y486
-rw-r--r--JavaScriptCore/parser/Lexer.cpp101
-rw-r--r--JavaScriptCore/parser/Lexer.h8
-rw-r--r--JavaScriptCore/parser/NodeConstructors.h17
-rw-r--r--JavaScriptCore/parser/Nodes.cpp186
-rw-r--r--JavaScriptCore/parser/Nodes.h154
-rw-r--r--JavaScriptCore/parser/Parser.h63
-rw-r--r--JavaScriptCore/profiler/ProfileGenerator.cpp1
-rw-r--r--JavaScriptCore/profiler/Profiler.cpp23
-rw-r--r--JavaScriptCore/runtime/Arguments.h12
-rw-r--r--JavaScriptCore/runtime/ArrayConstructor.cpp14
-rw-r--r--JavaScriptCore/runtime/ArrayConstructor.h2
-rw-r--r--JavaScriptCore/runtime/ArrayPrototype.cpp12
-rw-r--r--JavaScriptCore/runtime/BooleanObject.h5
-rw-r--r--JavaScriptCore/runtime/BooleanPrototype.cpp4
-rw-r--r--JavaScriptCore/runtime/CallData.h4
-rw-r--r--JavaScriptCore/runtime/Collector.cpp52
-rw-r--r--JavaScriptCore/runtime/CommonIdentifiers.h1
-rw-r--r--JavaScriptCore/runtime/Completion.cpp21
-rw-r--r--JavaScriptCore/runtime/ConstructData.h4
-rw-r--r--JavaScriptCore/runtime/DateConstructor.cpp2
-rw-r--r--JavaScriptCore/runtime/DatePrototype.cpp64
-rw-r--r--JavaScriptCore/runtime/Error.cpp6
-rw-r--r--JavaScriptCore/runtime/Error.h1
-rw-r--r--JavaScriptCore/runtime/ExceptionHelpers.cpp10
-rw-r--r--JavaScriptCore/runtime/Executable.cpp216
-rw-r--r--JavaScriptCore/runtime/Executable.h268
-rw-r--r--JavaScriptCore/runtime/FunctionConstructor.cpp32
-rw-r--r--JavaScriptCore/runtime/FunctionConstructor.h4
-rw-r--r--JavaScriptCore/runtime/FunctionPrototype.cpp15
-rw-r--r--JavaScriptCore/runtime/FunctionPrototype.h2
-rw-r--r--JavaScriptCore/runtime/InternalFunction.h2
-rw-r--r--JavaScriptCore/runtime/JSAPIValueWrapper.h1
-rw-r--r--JavaScriptCore/runtime/JSActivation.cpp14
-rw-r--r--JavaScriptCore/runtime/JSActivation.h10
-rw-r--r--JavaScriptCore/runtime/JSArray.cpp20
-rw-r--r--JavaScriptCore/runtime/JSArray.h73
-rw-r--r--JavaScriptCore/runtime/JSByteArray.cpp2
-rw-r--r--JavaScriptCore/runtime/JSCell.h26
-rw-r--r--JavaScriptCore/runtime/JSFunction.cpp42
-rw-r--r--JavaScriptCore/runtime/JSFunction.h57
-rw-r--r--JavaScriptCore/runtime/JSGlobalData.cpp9
-rw-r--r--JavaScriptCore/runtime/JSGlobalData.h5
-rw-r--r--JavaScriptCore/runtime/JSGlobalObject.cpp10
-rw-r--r--JavaScriptCore/runtime/JSGlobalObject.h5
-rw-r--r--JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp14
-rw-r--r--JavaScriptCore/runtime/JSNumberCell.h2
-rw-r--r--JavaScriptCore/runtime/JSONObject.cpp9
-rw-r--r--JavaScriptCore/runtime/JSONObject.h2
-rw-r--r--JavaScriptCore/runtime/JSObject.cpp31
-rw-r--r--JavaScriptCore/runtime/JSObject.h37
-rw-r--r--JavaScriptCore/runtime/JSString.h2
-rw-r--r--JavaScriptCore/runtime/JSType.h1
-rw-r--r--JavaScriptCore/runtime/JSValue.h2
-rw-r--r--JavaScriptCore/runtime/MarkStack.h21
-rw-r--r--JavaScriptCore/runtime/MarkStackWin.cpp6
-rw-r--r--JavaScriptCore/runtime/MathObject.h2
-rw-r--r--JavaScriptCore/runtime/NumberConstructor.h2
-rw-r--r--JavaScriptCore/runtime/NumberObject.h5
-rw-r--r--JavaScriptCore/runtime/ObjectConstructor.cpp1
-rw-r--r--JavaScriptCore/runtime/PropertySlot.cpp3
-rw-r--r--JavaScriptCore/runtime/RegExpConstructor.cpp3
-rw-r--r--JavaScriptCore/runtime/RegExpConstructor.h2
-rw-r--r--JavaScriptCore/runtime/RegExpObject.h2
-rw-r--r--JavaScriptCore/runtime/RegExpPrototype.cpp13
-rw-r--r--JavaScriptCore/runtime/ScopeChain.cpp2
-rw-r--r--JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h2
-rw-r--r--JavaScriptCore/runtime/StringPrototype.cpp19
-rw-r--r--JavaScriptCore/runtime/TypeInfo.h3
-rw-r--r--JavaScriptCore/runtime/UString.cpp92
-rw-r--r--JavaScriptCore/runtime/UString.h4
-rw-r--r--JavaScriptCore/wtf/FastMalloc.cpp30
-rw-r--r--JavaScriptCore/wtf/FastMalloc.h42
-rw-r--r--JavaScriptCore/wtf/Platform.h74
-rw-r--r--JavaScriptCore/wtf/PossiblyNull.h59
-rw-r--r--JavaScriptCore/wtf/SegmentedVector.h3
-rw-r--r--JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp1
-rw-r--r--JavaScriptCore/yarr/RegexInterpreter.cpp226
125 files changed, 1514 insertions, 3552 deletions
diff --git a/JavaScriptCore/API/JSCallbackConstructor.h b/JavaScriptCore/API/JSCallbackConstructor.h
index 1e28aaf..1f06249 100644
--- a/JavaScriptCore/API/JSCallbackConstructor.h
+++ b/JavaScriptCore/API/JSCallbackConstructor.h
@@ -41,7 +41,7 @@ public:
static PassRefPtr<Structure> createStructure(JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot | HasDefaultMark));
+ return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot));
}
private:
diff --git a/JavaScriptCore/API/JSCallbackFunction.cpp b/JavaScriptCore/API/JSCallbackFunction.cpp
index b7dd768..1b3217b 100644
--- a/JavaScriptCore/API/JSCallbackFunction.cpp
+++ b/JavaScriptCore/API/JSCallbackFunction.cpp
@@ -28,7 +28,6 @@
#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 3a17fa2..7dd87b5 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 | HasDefaultMark));
+ return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot));
}
private:
diff --git a/JavaScriptCore/API/JSObjectRef.cpp b/JavaScriptCore/API/JSObjectRef.cpp
index 06ef578..87d36ec 100644
--- a/JavaScriptCore/API/JSObjectRef.cpp
+++ b/JavaScriptCore/API/JSObjectRef.cpp
@@ -28,7 +28,6 @@
#include "JSObjectRef.h"
#include "APICast.h"
-#include "CodeBlock.h"
#include "DateConstructor.h"
#include "ErrorConstructor.h"
#include "FunctionConstructor.h"
diff --git a/JavaScriptCore/Android.mk b/JavaScriptCore/Android.mk
index c27c703..6973fa1 100644
--- a/JavaScriptCore/Android.mk
+++ b/JavaScriptCore/Android.mk
@@ -108,7 +108,6 @@ LOCAL_SRC_FILES := \
runtime/ErrorInstance.cpp \
runtime/ErrorPrototype.cpp \
runtime/ExceptionHelpers.cpp \
- runtime/Executable.cpp \
runtime/FunctionConstructor.cpp \
runtime/FunctionPrototype.cpp \
runtime/GetterSetter.cpp \
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index f67d27d..1afea5f 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,1229 +1,3 @@
-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>
-
- Reviewed by NOBODY (build fix).
-
- * 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>
-
- Reviewed by NOBODY (Build fix).
-
- 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>
-
- Reviewed by NOBODY (build fix).
-
- * 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).
diff --git a/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/JavaScriptCore/Configurations/FeatureDefines.xcconfig
index d4ec563..10328e8 100644
--- a/JavaScriptCore/Configurations/FeatureDefines.xcconfig
+++ b/JavaScriptCore/Configurations/FeatureDefines.xcconfig
@@ -36,12 +36,10 @@ ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING;
ENABLE_DATABASE = ENABLE_DATABASE;
ENABLE_DATAGRID = ENABLE_DATAGRID;
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_NOTIFICATIONS = ;
ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS;
ENABLE_RUBY = ENABLE_RUBY;
ENABLE_SHARED_WORKERS = ;
@@ -59,4 +57,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_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(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);
+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);
diff --git a/JavaScriptCore/GNUmakefile.am b/JavaScriptCore/GNUmakefile.am
index b20c0cd..6b4dc6d 100644
--- a/JavaScriptCore/GNUmakefile.am
+++ b/JavaScriptCore/GNUmakefile.am
@@ -193,6 +193,7 @@ javascriptcore_sources += \
JavaScriptCore/runtime/LiteralParser.h \
JavaScriptCore/runtime/MarkStack.cpp \
JavaScriptCore/runtime/MarkStack.h \
+ JavaScriptCore/runtime/MarkStackPosix.cpp \
JavaScriptCore/runtime/SmallStrings.cpp \
JavaScriptCore/runtime/SmallStrings.h \
JavaScriptCore/runtime/Structure.cpp \
@@ -287,12 +288,10 @@ javascriptcore_sources += \
if TARGET_WIN32
javascriptcore_sources += \
JavaScriptCore/wtf/ThreadSpecificWin.cpp \
- JavaScriptCore/jit/ExecutableAllocatorWin.cpp \
- JavaScriptCore/runtime/MarkStackWin.cpp
+ JavaScriptCore/jit/ExecutableAllocatorWin.cpp
else
javascriptcore_sources += \
- JavaScriptCore/jit/ExecutableAllocatorPosix.cpp \
- JavaScriptCore/runtime/MarkStackPosix.cpp
+ JavaScriptCore/jit/ExecutableAllocatorPosix.cpp
endif
# ----
@@ -394,7 +393,6 @@ javascriptcore_sources += \
JavaScriptCore/runtime/ErrorInstance.h \
JavaScriptCore/runtime/ErrorPrototype.cpp \
JavaScriptCore/runtime/ErrorPrototype.h \
- JavaScriptCore/runtime/Executable.cpp \
JavaScriptCore/runtime/FunctionConstructor.cpp \
JavaScriptCore/runtime/FunctionConstructor.h \
JavaScriptCore/runtime/FunctionPrototype.cpp \
@@ -441,6 +439,9 @@ 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 8351f83..3a2acd7 100644
--- a/JavaScriptCore/JavaScriptCore.exp
+++ b/JavaScriptCore/JavaScriptCore.exp
@@ -95,6 +95,7 @@ __ZN3JSC10Identifier24checkSameIdentifierTableEPNS_12JSGlobalDataEPNS_7UString3R
__ZN3JSC10Identifier24checkSameIdentifierTableEPNS_9ExecStateEPNS_7UString3RepE
__ZN3JSC10Identifier3addEPNS_9ExecStateEPKc
__ZN3JSC10Identifier5equalEPKNS_7UString3RepEPKc
+__ZN3JSC10JSFunction4infoE
__ZN3JSC10JSFunctionC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectESA_RKNS_7ArgListEE
__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeE
__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeEPKc
@@ -142,9 +143,9 @@ __ZN3JSC14TimeoutChecker5resetEv
__ZN3JSC14constructArrayEPNS_9ExecStateERKNS_7ArgListE
__ZN3JSC15JSWrapperObject12markChildrenERNS_9MarkStackE
__ZN3JSC15toInt32SlowCaseEdRb
-__ZN3JSC16FunctionBodyNode13finishParsingEPNS_10IdentifierEmRKS1_
+__ZN3JSC16FunctionBodyNode13finishParsingEPNS_10IdentifierEm
__ZN3JSC16FunctionBodyNode14copyParametersEv
-__ZN3JSC16FunctionBodyNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm0EEEPNS6_IPS0_Lm0EEERKNS_10SourceCodeEji
+__ZN3JSC16FunctionBodyNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm0EEEPNS6_IPNS_12FuncDeclNodeELm0EEERKNS_10SourceCodeEji
__ZN3JSC16InternalFunction4infoE
__ZN3JSC16InternalFunction4nameEPNS_12JSGlobalDataE
__ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEN3WTF10PassRefPtrINS_9StructureEEERKNS_10IdentifierE
@@ -195,8 +196,8 @@ __ZN3JSC6JSCell3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutProper
__ZN3JSC6JSCell3putEPNS_9ExecStateEjNS_7JSValueE
__ZN3JSC6JSCell9getObjectEv
__ZN3JSC6JSCellnwEmPNS_9ExecStateE
-__ZN3JSC6JSLock12DropAllLocksC1ENS_14JSLockBehaviorE
__ZN3JSC6JSLock12DropAllLocksC1EPNS_9ExecStateE
+__ZN3JSC6JSLock12DropAllLocksC1ENS_14JSLockBehaviorE
__ZN3JSC6JSLock12DropAllLocksD1Ev
__ZN3JSC6JSLock4lockENS_14JSLockBehaviorE
__ZN3JSC6JSLock6unlockENS_14JSLockBehaviorE
@@ -226,9 +227,9 @@ __ZN3JSC7UString6appendERKS0_
__ZN3JSC7UStringC1EPKc
__ZN3JSC7UStringC1EPKti
__ZN3JSC7UStringaSEPKc
-__ZN3JSC8Debugger23recompileAllJSFunctionsEPNS_12JSGlobalDataE
__ZN3JSC8Debugger6attachEPNS_14JSGlobalObjectE
__ZN3JSC8Debugger6detachEPNS_14JSGlobalObjectE
+__ZN3JSC8DebuggerC2Ev
__ZN3JSC8DebuggerD2Ev
__ZN3JSC8JSObject11hasInstanceEPNS_9ExecStateENS_7JSValueES3_
__ZN3JSC8JSObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPS0_
@@ -323,13 +324,14 @@ __ZN3WTF8CollatorC1EPKc
__ZN3WTF8CollatorD1Ev
__ZN3WTF8fastFreeEPv
__ZN3WTF9ByteArray6createEm
-__ZNK3JSC10JSFunction23isHostFunctionNonInlineEv
__ZNK3JSC11Interpreter14retrieveCallerEPNS_9ExecStateEPNS_16InternalFunctionE
__ZNK3JSC11Interpreter18retrieveLastCallerEPNS_9ExecStateERiRlRNS_7UStringERNS_7JSValueE
__ZNK3JSC12DateInstance7getTimeERdRi
__ZNK3JSC12StringObject12toThisStringEPNS_9ExecStateE
__ZNK3JSC12StringObject8toStringEPNS_9ExecStateE
__ZNK3JSC14JSGlobalObject14isDynamicScopeEv
+
+__ZNK3JSC16FunctionBodyNode14isHostFunctionEv
__ZNK3JSC16InternalFunction9classInfoEv
__ZNK3JSC16JSVariableObject16isVariableObjectEv
__ZNK3JSC16JSVariableObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj
@@ -377,7 +379,6 @@ __ZTVN3JSC15JSWrapperObjectE
__ZTVN3JSC16InternalFunctionE
__ZTVN3JSC16JSVariableObjectE
__ZTVN3JSC17JSAPIValueWrapperE
-__ZTVN3JSC8DebuggerE
__ZTVN3JSC8JSObjectE
__ZTVN3JSC8JSStringE
_jscore_fastmalloc_introspection
diff --git a/JavaScriptCore/JavaScriptCore.pri b/JavaScriptCore/JavaScriptCore.pri
index 490f020..dd48c9a 100644
--- a/JavaScriptCore/JavaScriptCore.pri
+++ b/JavaScriptCore/JavaScriptCore.pri
@@ -99,6 +99,7 @@ SOURCES += \
runtime/JSONObject.cpp \
runtime/LiteralParser.cpp \
runtime/MarkStack.cpp \
+ runtime/MarkStackPosix.cpp \
runtime/TimeoutChecker.cpp \
bytecode/CodeBlock.cpp \
bytecode/StructureStubInfo.cpp \
@@ -122,13 +123,8 @@ SOURCES += \
yarr/RegexJIT.cpp \
interpreter/RegisterFile.cpp
-win32-* {
- SOURCES += jit/ExecutableAllocatorWin.cpp \
- runtime/MarkStackWin.cpp
-} else {
- SOURCES += jit/ExecutableAllocatorPosix.cpp \
- runtime/MarkStackPosix.cpp
-}
+win32-*: SOURCES += jit/ExecutableAllocatorWin.cpp
+else: SOURCES += jit/ExecutableAllocatorPosix.cpp
# AllInOneFile.cpp helps gcc analize and optimize code
# Other compilers may be able to do this at link time
@@ -158,7 +154,6 @@ SOURCES += \
runtime/ErrorInstance.cpp \
runtime/ErrorPrototype.cpp \
interpreter/CallFrame.cpp \
- runtime/Executable.cpp \
runtime/FunctionConstructor.cpp \
runtime/FunctionPrototype.cpp \
runtime/GetterSetter.cpp \
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
index 9f73d6d..0de51bf 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
@@ -1,7 +1,13 @@
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
??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
@@ -41,6 +47,7 @@ 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
@@ -68,7 +75,7 @@ EXPORTS
?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@PAVFunctionBodyNode@JSC@@$0A@@4@ABVSourceCode@2@IH@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
@@ -113,11 +120,10 @@ EXPORTS
?fastRealloc@WTF@@YAPAXPAXI@Z
?fastZeroedMalloc@WTF@@YAPAXI@Z
?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAVJSValue@2@@Z
- ?finishParsing@FunctionBodyNode@JSC@@QAEXPAVIdentifier@2@IABV32@@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
@@ -158,7 +164,7 @@ EXPORTS
?isBusy@Heap@JSC@@QAE_NXZ
?isDynamicScope@JSGlobalObject@JSC@@UBE_NXZ
?isGetterSetter@JSCell@JSC@@UBE_NXZ
- ?isHostFunctionNonInline@JSFunction@JSC@@ABE_NXZ
+ ?isHostFunction@FunctionBodyNode@JSC@@QBE_NXZ
?isMainThread@WTF@@YA_NXZ
?isVariableObject@JSVariableObject@JSC@@UBE_NXZ
?jsNumberCell@JSC@@YA?AVJSValue@1@PAVExecState@1@N@Z
@@ -177,7 +183,6 @@ EXPORTS
?markChildren@JSWrapperObject@JSC@@UAEXAAVMarkStack@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
@@ -201,7 +206,6 @@ 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
@@ -224,7 +228,6 @@ EXPORTS
?stopProfiling@Profiler@JSC@@QAE?AV?$PassRefPtr@VProfile@JSC@@@WTF@@PAVExecState@2@ABVUString@2@@Z
?strtod@WTF@@YANPBDPAPAD@Z
?substr@UString@JSC@@QBE?AV12@HH@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
@@ -242,7 +245,6 @@ EXPORTS
?toObject@JSAPIValueWrapper@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z
?toObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z
?toObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z
- ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
?toPrimitive@JSAPIValueWrapper@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
@@ -256,14 +258,13 @@ EXPORTS
?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@@YA?AUTryMallocReturnValue@1@II@Z
+ ?tryFastCalloc@WTF@@YAPAXII@Z
?tryLock@Mutex@WTF@@QAE_NXZ
?type@DebuggerCallFrame@JSC@@QBE?AW4Type@12@XZ
?unlock@JSLock@JSC@@SAXW4JSLockBehavior@2@@Z
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
index 4aae5b2..1c5e963 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
@@ -644,10 +644,6 @@
>
</File>
<File
- RelativePath="..\..\runtime\Executable.cpp"
- >
- </File>
- <File
RelativePath="..\..\runtime\FunctionConstructor.cpp"
>
</File>
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops
index ba6bbfd..5f90011 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops
@@ -21,7 +21,7 @@
/>
<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&#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="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;"
/>
<Tool
Name="VCPreLinkEventTool"
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj
index eb8e44c..954045e 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj
@@ -23,9 +23,9 @@
>
<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"
+ 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=""
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def
index 8ec1aec..65998ca 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def
@@ -1,7 +1,13 @@
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
??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
@@ -40,7 +46,6 @@ 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
@@ -68,7 +73,7 @@ EXPORTS
?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@PAVFunctionBodyNode@JSC@@$0A@@4@ABVSourceCode@2@IH@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
@@ -113,11 +118,10 @@ EXPORTS
?fastRealloc@WTF@@YAPAXPAXI@Z
?fastZeroedMalloc@WTF@@YAPAXI@Z
?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAVJSValue@2@@Z
- ?finishParsing@FunctionBodyNode@JSC@@QAEXPAVIdentifier@2@IABV32@@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
@@ -158,7 +162,7 @@ EXPORTS
?isBusy@Heap@JSC@@QAE_NXZ
?isDynamicScope@JSGlobalObject@JSC@@UBE_NXZ
?isGetterSetter@JSCell@JSC@@UBE_NXZ
- ?isHostFunctionNonInline@JSFunction@JSC@@ABE_NXZ
+ ?isHostFunction@FunctionBodyNode@JSC@@QBE_NXZ
?isMainThread@WTF@@YA_NXZ
?isVariableObject@JSVariableObject@JSC@@UBE_NXZ
?jsNumberCell@JSC@@YA?AVJSValue@1@PAVExecState@1@N@Z
@@ -177,7 +181,6 @@ EXPORTS
?markChildren@JSWrapperObject@JSC@@UAEXAAVMarkStack@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
@@ -201,7 +204,6 @@ 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
@@ -224,7 +226,6 @@ EXPORTS
?stopProfiling@Profiler@JSC@@QAE?AV?$PassRefPtr@VProfile@JSC@@@WTF@@PAVExecState@2@ABVUString@2@@Z
?strtod@WTF@@YANPBDPAPAD@Z
?substr@UString@JSC@@QBE?AV12@HH@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
@@ -242,7 +243,6 @@ EXPORTS
?toObject@JSAPIValueWrapper@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z
?toObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z
?toObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z
- ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
?toPrimitive@JSAPIValueWrapper@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
@@ -256,14 +256,13 @@ EXPORTS
?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@@YA?AUTryMallocReturnValue@1@II@Z
+ ?tryFastCalloc@WTF@@YAPAXII@Z
?tryLock@Mutex@WTF@@QAE_NXZ
?type@DebuggerCallFrame@JSC@@QBE?AW4Type@12@XZ
?unlock@JSLock@JSC@@SAXW4JSLockBehavior@2@@Z
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops
index d78ff43..20b32f3 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="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c"
- />
-</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="set PATH=%SystemDrive%\cygwin\bin;%PATH%"
+ />
+</VisualStudioPropertySheet>
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops
index 7e8a193..3a1e42e 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops
+++ b/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops
@@ -20,6 +20,6 @@
/>
<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&#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="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;"
/>
</VisualStudioPropertySheet>
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops
index 738d4d5..2a36c18 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops
+++ b/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops
@@ -21,6 +21,6 @@
/>
<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&#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="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;"
/>
</VisualStudioPropertySheet>
diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index 973e3a3..6c3d49f 100644
--- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -95,7 +95,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 = (); }; };
+ 14F3488F0E95EF8A003648BC /* CollectorHeapIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F3488E0E95EF8A003648BC /* CollectorHeapIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
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"; }; };
@@ -132,8 +132,6 @@
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 = (Private, ); }; };
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 */; };
@@ -209,11 +207,11 @@
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 */; };
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 */; };
@@ -306,7 +304,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 = (); }; };
+ BC18C44B0E16F5CD00B34460 /* Parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F0B3AA09BB4DC00068FCE3 /* Parser.h */; settings = {ATTRIBUTES = (Private, ); }; };
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 */; };
@@ -648,8 +646,6 @@
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>"; };
@@ -756,7 +752,6 @@
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>"; };
@@ -1247,7 +1242,6 @@
44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */,
6580F795094070560082C219 /* PassRefPtr.h */,
65D6D87E09B5A32E0002E4D7 /* Platform.h */,
- A7D649A91015224E009B2E1B /* PossiblyNull.h */,
0B1F921B0F17502D0036468E /* PtrAndFlags.h */,
088FA5B90EF76D4300578E6F /* RandomNumber.cpp */,
088FA5BA0EF76D4300578E6F /* RandomNumber.h */,
@@ -1381,8 +1375,6 @@
BC02E9070E1839DB000F9297 /* ErrorPrototype.h */,
1429D8770ED21ACD00B89619 /* ExceptionHelpers.cpp */,
A72701B30DADE94900E548D7 /* ExceptionHelpers.h */,
- 86CA032D1038E8440028A609 /* Executable.cpp */,
- 86CAFEE21035DDE60028A609 /* Executable.h */,
BC2680C00E16D4E900A06E92 /* FunctionConstructor.cpp */,
BC2680C10E16D4E900A06E92 /* FunctionConstructor.h */,
F692A85C0255597D01FF60F7 /* FunctionPrototype.cpp */,
@@ -1768,6 +1760,7 @@
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 */,
@@ -1909,8 +1902,6 @@
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 */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2279,7 +2270,6 @@
1429DAC00ED263E700B89619 /* WRECParser.cpp in Sources */,
A7C530E4102A3813005BC741 /* MarkStackPosix.cpp in Sources */,
A74B3499102A5F8E0032AB98 /* MarkStack.cpp in Sources */,
- 86CA032E1038E8440028A609 /* Executable.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/JavaScriptCore/assembler/ARMAssembler.cpp b/JavaScriptCore/assembler/ARMAssembler.cpp
index c8b07fc..69daa16 100644
--- a/JavaScriptCore/assembler/ARMAssembler.cpp
+++ b/JavaScriptCore/assembler/ARMAssembler.cpp
@@ -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, int useConstantPool)
+void ARMAssembler::linkBranch(void* code, JmpSrc from, void* to)
{
ARMWord* insn = reinterpret_cast<ARMWord*>(code) + (from.m_offset / sizeof(ARMWord));
- if (!useConstantPool) {
+ if (!from.m_latePatch) {
int diff = reinterpret_cast<ARMWord*>(to) - reinterpret_cast<ARMWord*>(insn + 2);
if ((diff <= BOFFSET_MAX && diff >= BOFFSET_MIN)) {
@@ -367,22 +367,13 @@ void ARMAssembler::doubleTransfer(bool isLoad, FPRegisterID srcDst, RegisterID b
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) {
- // 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));
- }
+ ARMWord* ldrAddr = reinterpret_cast<ARMWord*>(data + *iter);
+ ARMWord* offset = getLdrImmAddress(ldrAddr);
+ if (*offset != 0xffffffff)
+ linkBranch(data, JmpSrc(*iter), data + *offset);
}
return data;
diff --git a/JavaScriptCore/assembler/ARMAssembler.h b/JavaScriptCore/assembler/ARMAssembler.h
index 0206770..d3fe782 100644
--- a/JavaScriptCore/assembler/ARMAssembler.h
+++ b/JavaScriptCore/assembler/ARMAssembler.h
@@ -77,7 +77,7 @@ namespace ARM {
typedef ARM::RegisterID RegisterID;
typedef ARM::FPRegisterID FPRegisterID;
typedef AssemblerBufferWithConstantPool<2048, 4, 4, ARMAssembler> ARMBuffer;
- typedef SegmentedVector<int, 64> Jumps;
+ typedef WTF::SegmentedVector<int, 64> Jumps;
ARMAssembler() { }
@@ -180,16 +180,20 @@ 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;
+ int m_offset : 31;
+ int m_latePatch : 1;
};
class JmpDst {
@@ -563,11 +567,6 @@ namespace ARM {
m_buffer.ensureSpace(insnSpace, constSpace);
}
- int sizeOfConstantPool()
- {
- return m_buffer.sizeOfConstantPool();
- }
-
JmpDst label()
{
return JmpDst(m_buffer.size());
@@ -581,12 +580,11 @@ namespace ARM {
return label();
}
- JmpSrc jmp(Condition cc = AL, int useConstantPool = 0)
+ JmpSrc jmp(Condition cc = AL)
{
- ensureSpace(sizeof(ARMWord), sizeof(ARMWord));
- int s = m_buffer.uncheckedSize();
+ int s = size();
ldr_un_imm(ARM::pc, 0xffffffff, cc);
- m_jumps.append(s | (useConstantPool & 0x1));
+ m_jumps.append(s);
return JmpSrc(s);
}
@@ -595,7 +593,7 @@ namespace ARM {
// Patching helpers
static ARMWord* getLdrImmAddress(ARMWord* insn, uint32_t* constPool = 0);
- static void linkBranch(void* code, JmpSrc from, void* to, int useConstantPool = 0);
+ static void linkBranch(void* code, JmpSrc from, void* to);
static void patchPointerInternal(intptr_t from, void* to)
{
@@ -662,7 +660,7 @@ namespace ARM {
static void linkCall(void* code, JmpSrc from, void* to)
{
- linkBranch(code, from, to, true);
+ linkBranch(code, from, to);
}
static void relinkCall(void* from, void* to)
diff --git a/JavaScriptCore/assembler/ARMv7Assembler.h b/JavaScriptCore/assembler/ARMv7Assembler.h
index 7cf8873..f7e2fb4 100644
--- a/JavaScriptCore/assembler/ARMv7Assembler.h
+++ b/JavaScriptCore/assembler/ARMv7Assembler.h
@@ -442,6 +442,7 @@ public:
{
}
+ void enableLatePatch() { }
private:
JmpSrc(int offset)
: m_offset(offset)
diff --git a/JavaScriptCore/assembler/AbstractMacroAssembler.h b/JavaScriptCore/assembler/AbstractMacroAssembler.h
index 525fe98..f927ed2 100644
--- a/JavaScriptCore/assembler/AbstractMacroAssembler.h
+++ b/JavaScriptCore/assembler/AbstractMacroAssembler.h
@@ -320,6 +320,11 @@ public:
return Call(jump.m_jmp, Linkable);
}
+ void enableLatePatch()
+ {
+ m_jmp.enableLatePatch();
+ }
+
JmpSrc m_jmp;
private:
Flags m_flags;
@@ -356,6 +361,11 @@ 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 af3c3be..f15b7f3 100644
--- a/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
+++ b/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
@@ -34,8 +34,6 @@
#include "AssemblerBuffer.h"
#include <wtf/SegmentedVector.h>
-#define ASSEMBLER_HAS_CONSTANT_POOL 1
-
namespace JSC {
/*
@@ -86,7 +84,7 @@ namespace JSC {
template <int maxPoolSize, int barrierSize, int maxInstructionSize, class AssemblerType>
class AssemblerBufferWithConstantPool: public AssemblerBuffer {
- typedef SegmentedVector<uint32_t, 512> LoadOffsets;
+ typedef WTF::SegmentedVector<uint32_t, 512> LoadOffsets;
public:
enum {
UniqueConst,
@@ -179,11 +177,6 @@ public:
return AssemblerBuffer::size();
}
- int uncheckedSize()
- {
- return AssemblerBuffer::size();
- }
-
void* executableCopy(ExecutablePool* allocator)
{
flushConstantPool(false);
@@ -214,10 +207,10 @@ public:
}
// This flushing mechanism can be called after any unconditional jumps.
- void flushWithoutBarrier(bool isForced = false)
+ void flushWithoutBarrier()
{
// Flush if constant pool is more than 60% full to avoid overuse of this function.
- if (isForced || 5 * m_numConsts > 3 * maxPoolSize / sizeof(uint32_t))
+ if (5 * m_numConsts > 3 * maxPoolSize / sizeof(uint32_t))
flushConstantPool(false);
}
@@ -226,11 +219,6 @@ public:
return m_pool;
}
- int sizeOfConstantPool()
- {
- return m_numConsts;
- }
-
private:
void correctDeltas(int insnSize)
{
@@ -288,8 +276,7 @@ private:
{
if (m_numConsts == 0)
return;
- int lastConstDelta = m_lastConstDelta > nextInsnSize ? m_lastConstDelta - nextInsnSize : 0;
- if ((m_maxDistance < nextInsnSize + lastConstDelta + barrierSize + (int)sizeof(uint32_t)))
+ if ((m_maxDistance < nextInsnSize + m_lastConstDelta + barrierSize + (int)sizeof(uint32_t)))
flushConstantPool();
}
@@ -297,8 +284,8 @@ private:
{
if (m_numConsts == 0)
return;
- if ((m_maxDistance < nextInsnSize + m_lastConstDelta + nextConstSize + barrierSize + (int)sizeof(uint32_t)) ||
- (m_numConsts * sizeof(uint32_t) + nextConstSize >= maxPoolSize))
+ if ((m_maxDistance < nextInsnSize + m_lastConstDelta + barrierSize + (int)sizeof(uint32_t)) ||
+ (m_numConsts + nextConstSize / sizeof(uint32_t) >= maxPoolSize))
flushConstantPool();
}
diff --git a/JavaScriptCore/assembler/MacroAssemblerARM.h b/JavaScriptCore/assembler/MacroAssemblerARM.h
index 19cbfcb..b04ed13 100644
--- a/JavaScriptCore/assembler/MacroAssemblerARM.h
+++ b/JavaScriptCore/assembler/MacroAssemblerARM.h
@@ -324,20 +324,20 @@ public:
move(src, dest);
}
- Jump branch32(Condition cond, RegisterID left, RegisterID right, int useConstantPool = 0)
+ Jump branch32(Condition cond, RegisterID left, RegisterID right)
{
m_assembler.cmp_r(left, right);
- return Jump(m_assembler.jmp(ARMCondition(cond), useConstantPool));
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
}
- Jump branch32(Condition cond, RegisterID left, Imm32 right, int useConstantPool = 0)
+ Jump branch32(Condition cond, RegisterID left, Imm32 right)
{
if (right.m_isPointer) {
m_assembler.ldr_un_imm(ARM::S0, right.m_value);
m_assembler.cmp_r(left, ARM::S0);
} else
m_assembler.cmp_r(left, m_assembler.getImm(right.m_value, ARM::S0));
- return Jump(m_assembler.jmp(ARMCondition(cond), useConstantPool));
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
}
Jump branch32(Condition cond, RegisterID left, Address right)
@@ -497,7 +497,7 @@ public:
Call nearCall()
{
prepareCall();
- return Call(m_assembler.jmp(ARMAssembler::AL, true), Call::LinkableNear);
+ return Call(m_assembler.jmp(), Call::LinkableNear);
}
Call call(RegisterID target)
@@ -587,7 +587,7 @@ public:
Call call()
{
prepareCall();
- return Call(m_assembler.jmp(ARMAssembler::AL, true), Call::Linkable);
+ return Call(m_assembler.jmp(), Call::Linkable);
}
Call tailRecursiveCall()
@@ -610,7 +610,8 @@ 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, true);
+ Jump jump = branch32(cond, left, ARM::S1);
+ jump.enableLatePatch();
return jump;
}
@@ -618,7 +619,8 @@ public:
{
load32(left, ARM::S1);
dataLabel = moveWithPatch(initialRightValue, ARM::S0);
- Jump jump = branch32(cond, ARM::S0, ARM::S1, true);
+ Jump jump = branch32(cond, ARM::S0, ARM::S1);
+ jump.enableLatePatch();
return jump;
}
@@ -720,19 +722,9 @@ 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()
{
- ensureSpace(3 * sizeof(ARMWord), sizeof(ARMWord));
+ m_assembler.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);
diff --git a/JavaScriptCore/assembler/X86Assembler.h b/JavaScriptCore/assembler/X86Assembler.h
index b5b8808..fb58361 100644
--- a/JavaScriptCore/assembler/X86Assembler.h
+++ b/JavaScriptCore/assembler/X86Assembler.h
@@ -231,6 +231,7 @@ public:
{
}
+ void enableLatePatch() { }
private:
JmpSrc(int offset)
: m_offset(offset)
diff --git a/JavaScriptCore/bytecode/CodeBlock.cpp b/JavaScriptCore/bytecode/CodeBlock.cpp
index b63e826..e22f25a 100644
--- a/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -33,8 +33,6 @@
#include "JIT.h"
#include "JSValue.h"
#include "Interpreter.h"
-#include "JSFunction.h"
-#include "JSStaticScopeObject.h"
#include "Debugger.h"
#include "BytecodeGenerator.h"
#include <stdio.h>
@@ -1248,11 +1246,11 @@ void CodeBlock::dumpStatistics()
#endif
}
-CodeBlock::CodeBlock(ExecutableBase* ownerExecutable)
+CodeBlock::CodeBlock(ScopeNode* ownerNode)
: m_numCalleeRegisters(0)
, m_numVars(0)
, m_numParameters(0)
- , m_ownerExecutable(ownerExecutable)
+ , m_ownerNode(ownerNode)
, m_globalData(0)
#ifndef NDEBUG
, m_instructionCount(0)
@@ -1270,17 +1268,17 @@ CodeBlock::CodeBlock(ExecutableBase* ownerExecutable)
#endif
}
-CodeBlock::CodeBlock(ExecutableBase* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)
+CodeBlock::CodeBlock(ScopeNode* ownerNode, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)
: m_numCalleeRegisters(0)
, m_numVars(0)
, m_numParameters(0)
- , m_ownerExecutable(ownerExecutable)
+ , m_ownerNode(ownerNode)
, m_globalData(0)
#ifndef NDEBUG
, m_instructionCount(0)
#endif
- , m_needsFullScopeChain(ownerExecutable->needsActivation())
- , m_usesEval(ownerExecutable->usesEval())
+ , m_needsFullScopeChain(ownerNode->needsActivation())
+ , m_usesEval(ownerNode->usesEval())
, m_isNumericCompareFunction(false)
, m_codeType(codeType)
, m_source(sourceProvider)
@@ -1437,10 +1435,15 @@ void CodeBlock::markAggregate(MarkStack& markStack)
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);
+ 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);
+ }
}
void CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame)
@@ -1462,7 +1465,56 @@ void CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame)
scopeChain = scopeChain->next;
}
- m_exceptionInfo.set(m_ownerExecutable->reparseExceptionInfo(m_globalData, scopeChain, this));
+ 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();
+ }
}
HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset)
@@ -1493,7 +1545,7 @@ int CodeBlock::lineNumberForBytecodeOffset(CallFrame* callFrame, unsigned byteco
ASSERT(m_exceptionInfo);
if (!m_exceptionInfo->m_lineInfo.size())
- return m_ownerExecutable->source().firstLine(); // Empty function
+ return m_ownerNode->source().firstLine(); // Empty function
int low = 0;
int high = m_exceptionInfo->m_lineInfo.size();
@@ -1506,7 +1558,7 @@ int CodeBlock::lineNumberForBytecodeOffset(CallFrame* callFrame, unsigned byteco
}
if (!low)
- return m_ownerExecutable->source().firstLine();
+ return m_ownerNode->source().firstLine();
return m_exceptionInfo->m_lineInfo[low - 1].lineNumber;
}
@@ -1649,6 +1701,18 @@ 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();
@@ -1664,8 +1728,7 @@ void CodeBlock::shrinkToFit()
#endif
m_identifiers.shrinkToFit();
- m_functionDecls.shrinkToFit();
- m_functionExprs.shrinkToFit();
+ m_functionExpressions.shrinkToFit();
m_constantRegisters.shrinkToFit();
if (m_exceptionInfo) {
@@ -1676,6 +1739,7 @@ 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 fdeb4db..39b1db3 100644
--- a/JavaScriptCore/bytecode/CodeBlock.h
+++ b/JavaScriptCore/bytecode/CodeBlock.h
@@ -248,22 +248,11 @@ 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(ExecutableBase* ownerExecutable);
- CodeBlock(ExecutableBase* ownerExecutable, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset);
public:
+ CodeBlock(ScopeNode* ownerNode);
+ CodeBlock(ScopeNode* ownerNode, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset);
~CodeBlock();
void markAggregate(MarkStack&);
@@ -340,7 +329,7 @@ namespace JSC {
unsigned getBytecodeIndex(CallFrame* callFrame, ReturnAddressPtr returnAddress)
{
reparseForExceptionInfoIfNecessary(callFrame);
- return binaryChop<CallReturnOffsetToBytecodeIndex, unsigned, getCallReturnOffset>(callReturnIndexVector().begin(), callReturnIndexVector().size(), ownerExecutable()->generatedJITCode().offsetOf(returnAddress.value()))->bytecodeIndex;
+ return binaryChop<CallReturnOffsetToBytecodeIndex, unsigned, getCallReturnOffset>(callReturnIndexVector().begin(), callReturnIndexVector().size(), ownerNode()->generatedJITCode().offsetOf(returnAddress.value()))->bytecodeIndex;
}
bool functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex);
@@ -350,19 +339,17 @@ 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 ownerExecutable()->generatedJITCode(); }
- ExecutablePool* executablePool() { return ownerExecutable()->getExecutablePool(); }
+ JITCode& getJITCode() { return ownerNode()->generatedJITCode(); }
+ void setJITCode(JITCode);
+ ExecutablePool* executablePool() { return ownerNode()->getExecutablePool(); }
#endif
- ExecutableBase* ownerExecutable() const { return m_ownerExecutable; }
+ ScopeNode* ownerNode() const { return m_ownerNode; }
void setGlobalData(JSGlobalData* globalData) { m_globalData = globalData; }
@@ -417,7 +404,6 @@ 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); }
@@ -442,11 +428,13 @@ 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 addFunctionDecl(PassRefPtr<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(PassRefPtr<FunctionExecutable> n) { unsigned size = m_functionExprs.size(); m_functionExprs.append(n); return size; }
- FunctionExecutable* functionExpr(int index) { return m_functionExprs[index].get(); }
+ 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 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(); }
@@ -493,7 +481,7 @@ namespace JSC {
m_rareData.set(new RareData);
}
- ExecutableBase* m_ownerExecutable;
+ ScopeNode* m_ownerNode;
JSGlobalData* m_globalData;
Vector<Instruction> m_instructions;
@@ -529,17 +517,26 @@ namespace JSC {
// Constant Pool
Vector<Identifier> m_identifiers;
Vector<Register> m_constantRegisters;
- Vector<RefPtr<FunctionExecutable> > m_functionDecls;
- Vector<RefPtr<FunctionExecutable> > m_functionExprs;
+ Vector<RefPtr<FuncExprNode> > m_functionExpressions;
SymbolTable m_symbolTable;
+ struct ExceptionInfo : FastAllocBase {
+ Vector<ExpressionRangeInfo> m_expressionInfo;
+ Vector<LineInfo> m_lineInfo;
+ Vector<GetByIdExceptionInfo> m_getByIdExceptionInfo;
+
+#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
@@ -559,16 +556,16 @@ namespace JSC {
// Program code is not marked by any function, so we make the global object
// responsible for marking it.
- class GlobalCodeBlock : public CodeBlock {
+ class ProgramCodeBlock : public CodeBlock {
public:
- GlobalCodeBlock(ExecutableBase* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, JSGlobalObject* globalObject)
- : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset)
+ ProgramCodeBlock(ScopeNode* ownerNode, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider)
+ : CodeBlock(ownerNode, codeType, sourceProvider, 0)
, m_globalObject(globalObject)
{
m_globalObject->codeBlocks().add(this);
}
- ~GlobalCodeBlock()
+ ~ProgramCodeBlock()
{
if (m_globalObject)
m_globalObject->codeBlocks().remove(this);
@@ -580,18 +577,10 @@ namespace JSC {
JSGlobalObject* m_globalObject; // For program and eval nodes, the global object that marks the constant pool.
};
- class ProgramCodeBlock : public GlobalCodeBlock {
+ class EvalCodeBlock : public ProgramCodeBlock {
public:
- 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)
+ EvalCodeBlock(ScopeNode* ownerNode, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, int baseScopeDepth)
+ : ProgramCodeBlock(ownerNode, EvalCode, globalObject, sourceProvider)
, m_baseScopeDepth(baseScopeDepth)
{
}
@@ -602,22 +591,6 @@ namespace JSC {
int m_baseScopeDepth;
};
- class FunctionCodeBlock : public CodeBlock {
- public:
- FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)
- : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset)
- {
- }
- };
-
- class NativeCodeBlock : public CodeBlock {
- public:
- NativeCodeBlock(FunctionExecutable* ownerExecutable)
- : CodeBlock(ownerExecutable)
- {
- }
- };
-
inline Register& ExecState::r(int index)
{
CodeBlock* codeBlock = this->codeBlock();
diff --git a/JavaScriptCore/bytecode/EvalCodeCache.h b/JavaScriptCore/bytecode/EvalCodeCache.h
index c486e42..986525c 100644
--- a/JavaScriptCore/bytecode/EvalCodeCache.h
+++ b/JavaScriptCore/bytecode/EvalCodeCache.h
@@ -29,7 +29,6 @@
#ifndef EvalCodeCache_h
#define EvalCodeCache_h
-#include "Executable.h"
#include "JSGlobalObject.h"
#include "Nodes.h"
#include "Parser.h"
@@ -42,33 +41,44 @@ namespace JSC {
class EvalCodeCache {
public:
- PassRefPtr<CacheableEvalExecutable> get(ExecState* exec, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)
+ PassRefPtr<EvalNode> get(ExecState* exec, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)
{
- RefPtr<CacheableEvalExecutable> evalExecutable;
+ RefPtr<EvalNode> evalNode;
if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject())
- evalExecutable = m_cacheMap.get(evalSource.rep());
+ evalNode = m_cacheMap.get(evalSource.rep());
- if (!evalExecutable) {
- evalExecutable = CacheableEvalExecutable::create(makeSource(evalSource));
- exceptionValue = evalExecutable->parse(exec);
- if (exceptionValue)
+ 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);
return 0;
-
- if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries)
- m_cacheMap.set(evalSource.rep(), evalExecutable);
+ }
}
- return evalExecutable.release();
+ return evalNode.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<CacheableEvalExecutable> > EvalCacheMap;
+ typedef HashMap<RefPtr<UString::Rep>, RefPtr<EvalNode> > EvalCacheMap;
EvalCacheMap m_cacheMap;
};
diff --git a/JavaScriptCore/bytecode/SamplingTool.cpp b/JavaScriptCore/bytecode/SamplingTool.cpp
index 8d0faa1..8651723 100644
--- a/JavaScriptCore/bytecode/SamplingTool.cpp
+++ b/JavaScriptCore/bytecode/SamplingTool.cpp
@@ -197,7 +197,7 @@ void SamplingTool::doRun()
#if ENABLE(CODEBLOCK_SAMPLING)
if (CodeBlock* codeBlock = sample.codeBlock()) {
MutexLocker locker(m_scopeSampleMapMutex);
- ScopeSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable());
+ ScopeSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerNode());
ASSERT(record);
record->sample(codeBlock, sample.vPC());
}
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
index a4fd0d3..59537b6 100644
--- a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
+++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
@@ -256,9 +256,9 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d
m_nextGlobalIndex -= symbolTable->size();
for (size_t i = 0; i < functionStack.size(); ++i) {
- 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);
+ 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);
}
Vector<RegisterID*, 32> newVars;
@@ -272,8 +272,8 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d
emitLoad(newVars[i], jsUndefined());
} else {
for (size_t i = 0; i < functionStack.size(); ++i) {
- FunctionBodyNode* function = functionStack[i];
- globalObject->putWithAttributes(exec, function->ident(), new (exec) JSFunction(exec, adoptRef(new FunctionExecutable(function->ident(), function)), scopeChain.node()), DontDelete);
+ FuncDeclNode* funcDecl = functionStack[i];
+ globalObject->putWithAttributes(exec, funcDecl->m_ident, funcDecl->makeFunction(exec, scopeChain.node()), DontDelete);
}
for (size_t i = 0; i < varStack.size(); ++i) {
if (globalObject->hasProperty(exec, varStack[i].first))
@@ -339,10 +339,10 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug
const DeclarationStacks::FunctionStack& functionStack = functionBody->functionStack();
for (size_t i = 0; i < functionStack.size(); ++i) {
- FunctionBodyNode* function = functionStack[i];
- const Identifier& ident = function->ident();
+ FuncDeclNode* funcDecl = functionStack[i];
+ const Identifier& ident = funcDecl->m_ident;
m_functions.add(ident.ustring().rep());
- emitNewFunction(addVar(ident, false), function);
+ emitNewFunction(addVar(ident, false), funcDecl);
}
const DeclarationStacks::VarStack& varStack = functionBody->varStack();
@@ -397,12 +397,6 @@ 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) {
- FunctionBodyNode* function = functionStack[i];
- m_codeBlock->addFunctionDecl(adoptRef(new FunctionExecutable(function->ident(), function)));
- }
-
preserveLastVar();
}
@@ -476,8 +470,7 @@ RegisterID* BytecodeGenerator::constRegisterFor(const Identifier& ident)
return 0;
SymbolTableEntry entry = symbolTable().get(ident.ustring().rep());
- if (entry.isNull())
- return 0;
+ ASSERT(!entry.isNull());
return &registerFor(entry.getIndex());
}
@@ -772,6 +765,18 @@ 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();
@@ -1308,13 +1313,11 @@ RegisterID* BytecodeGenerator::emitNewArray(RegisterID* dst, ElementNode* elemen
return dst;
}
-RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode* function)
+RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FuncDeclNode* n)
{
- unsigned index = m_codeBlock->addFunctionDecl(adoptRef(new FunctionExecutable(function->ident(), function)));
-
emitOpcode(op_new_func);
instructions().append(dst->index());
- instructions().append(index);
+ instructions().append(addConstant(n));
return dst;
}
@@ -1329,12 +1332,9 @@ RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp)
RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n)
{
- FunctionBodyNode* function = n->body();
- unsigned index = m_codeBlock->addFunctionExpr(adoptRef(new FunctionExecutable(function->ident(), function)));
-
emitOpcode(op_new_func_exp);
instructions().append(r0->index());
- instructions().append(index);
+ instructions().append(addConstant(n));
return r0;
}
@@ -1805,7 +1805,7 @@ void BytecodeGenerator::emitSubroutineReturn(RegisterID* retAddrSrc)
instructions().append(retAddrSrc->index());
}
-void BytecodeGenerator::emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value)
+void BytecodeGenerator::emitPushNewScope(RegisterID* dst, Identifier& property, RegisterID* value)
{
ControlFlowContext context;
context.isFinallyBlock = false;
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/JavaScriptCore/bytecompiler/BytecodeGenerator.h
index 79f0093..c273597 100644
--- a/JavaScriptCore/bytecompiler/BytecodeGenerator.h
+++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.h
@@ -61,7 +61,7 @@ namespace JSC {
FinallyContext finallyContext;
};
- class BytecodeGenerator : public FastAllocBase {
+ class BytecodeGenerator : public WTF::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, FunctionBodyNode* body);
+ RegisterID* emitNewFunction(RegisterID* dst, FuncDeclNode* func);
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, const Identifier& property, RegisterID* value);
+ void emitPushNewScope(RegisterID* dst, Identifier& property, RegisterID* value);
RegisterID* emitPushScope(RegisterID* scope);
void emitPopScope();
@@ -413,6 +413,8 @@ namespace JSC {
return m_globals[-index - 1];
}
+ unsigned addConstant(FuncDeclNode*);
+ unsigned addConstant(FuncExprNode*);
unsigned addConstant(const Identifier&);
RegisterID* addConstantValue(JSValue);
unsigned addRegExp(RegExp*);
@@ -443,12 +445,12 @@ namespace JSC {
RegisterID m_thisRegister;
RegisterID m_argumentsRegister;
int m_activationRegisterIndex;
- 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;
+ 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;
RefPtr<RegisterID> m_lastVar;
int m_finallyDepth;
int m_dynamicScopeDepth;
diff --git a/JavaScriptCore/debugger/Debugger.cpp b/JavaScriptCore/debugger/Debugger.cpp
index dcc6ef7..7d791e7 100644
--- a/JavaScriptCore/debugger/Debugger.cpp
+++ b/JavaScriptCore/debugger/Debugger.cpp
@@ -22,16 +22,16 @@
#include "config.h"
#include "Debugger.h"
-#include "CollectorHeapIterator.h"
-#include "Error.h"
-#include "Interpreter.h"
-#include "JSFunction.h"
#include "JSGlobalObject.h"
+#include "Interpreter.h"
#include "Parser.h"
-#include "Protect.h"
namespace JSC {
+Debugger::Debugger()
+{
+}
+
Debugger::~Debugger()
{
HashSet<JSGlobalObject*>::iterator end = m_globalObjects.end();
@@ -53,60 +53,18 @@ 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->executable();
-
- // 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();
- EvalExecutable eval(makeSource(script));
- JSObject* error = eval.parse(globalCallFrame);
- if (error)
- return error;
+ 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());
- return globalObject->globalData()->interpreter->execute(&eval, globalCallFrame, globalObject, globalCallFrame->scopeChain(), &exception);
+ return globalObject->globalData()->interpreter->execute(evalNode.get(), globalCallFrame, globalObject, globalCallFrame->scopeChain(), &exception);
}
} // namespace JSC
diff --git a/JavaScriptCore/debugger/Debugger.h b/JavaScriptCore/debugger/Debugger.h
index 3ee9767..98d0935 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, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 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,42 +22,40 @@
#ifndef Debugger_h
#define Debugger_h
-#include <wtf/HashSet.h>
+#include "Protect.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 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 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 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*);
+ 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;
private:
HashSet<JSGlobalObject*> m_globalObjects;
};
- // This function exists only for backwards compatibility with existing WebScriptDebugger clients.
+ // This method exists only for backwards compatibility with existing
+ // WebScriptDebugger clients
JSValue evaluateInGlobalCallFrame(const UString&, JSValue& exception, JSGlobalObject*);
} // namespace JSC
diff --git a/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/JavaScriptCore/debugger/DebuggerCallFrame.cpp
index f2afba6..cd8702b 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 = asFunction(m_callFrame->callee());
+ JSFunction* function = static_cast<JSFunction*>(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 = asFunction(m_callFrame->callee());
+ JSFunction* function = static_cast<JSFunction*>(m_callFrame->callee());
if (!function)
return 0;
return function->calculatedDisplayName(&m_callFrame->globalData());
@@ -79,12 +79,14 @@ JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) c
if (!m_callFrame->codeBlock())
return JSValue();
- EvalExecutable eval(makeSource(script));
- JSObject* error = eval.parse(m_callFrame);
- if (error)
- return error;
+ 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());
- return m_callFrame->scopeChain()->globalData->interpreter->execute(&eval, m_callFrame, thisObject(), m_callFrame->scopeChain(), &exception);
+ return m_callFrame->scopeChain()->globalData->interpreter->execute(evalNode.get(), m_callFrame, thisObject(), m_callFrame->scopeChain(), &exception);
}
} // namespace JSC
diff --git a/JavaScriptCore/interpreter/CachedCall.h b/JavaScriptCore/interpreter/CachedCall.h
index b22753e..767c262 100644
--- a/JavaScriptCore/interpreter/CachedCall.h
+++ b/JavaScriptCore/interpreter/CachedCall.h
@@ -40,7 +40,7 @@ namespace JSC {
, m_exception(exception)
, m_globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : function->scope().node()->globalObject())
{
- m_closure = m_interpreter->prepareForRepeatCall(function->executable(), callFrame, function, argCount, function->scope().node(), exception);
+ m_closure = m_interpreter->prepareForRepeatCall(function->body(), callFrame, function, argCount, function->scope().node(), exception);
m_valid = !*exception;
}
diff --git a/JavaScriptCore/interpreter/CallFrameClosure.h b/JavaScriptCore/interpreter/CallFrameClosure.h
index a301060..9085327 100644
--- a/JavaScriptCore/interpreter/CallFrameClosure.h
+++ b/JavaScriptCore/interpreter/CallFrameClosure.h
@@ -32,7 +32,7 @@ struct CallFrameClosure {
CallFrame* oldCallFrame;
CallFrame* newCallFrame;
JSFunction* function;
- FunctionExecutable* functionExecutable;
+ FunctionBodyNode* functionBody;
JSGlobalData* globalData;
Register* oldEnd;
ScopeChainNode* scopeChain;
diff --git a/JavaScriptCore/interpreter/Interpreter.cpp b/JavaScriptCore/interpreter/Interpreter.cpp
index 5175e16..f102739 100644
--- a/JavaScriptCore/interpreter/Interpreter.cpp
+++ b/JavaScriptCore/interpreter/Interpreter.cpp
@@ -350,14 +350,15 @@ 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<CacheableEvalExecutable> eval = codeBlock->evalCodeCache().get(callFrame, programSource, scopeChain, exceptionValue);
+ RefPtr<EvalNode> evalNode = codeBlock->evalCodeCache().get(callFrame, programSource, scopeChain, exceptionValue);
JSValue result = jsUndefined();
- if (eval)
- result = callFrame->globalData().interpreter->execute(eval.get(), callFrame, callFrame->thisValue().toThisObject(callFrame), callFrame->registers() - registerFile->start() + registerOffset, scopeChain, &exceptionValue);
+ if (evalNode)
+ result = callFrame->globalData().interpreter->execute(evalNode.get(), callFrame, callFrame->thisValue().toThisObject(callFrame), callFrame->registers() - registerFile->start() + registerOffset, scopeChain, &exceptionValue);
return result;
}
@@ -489,21 +490,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->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->lastLine());
+ debugger->returnEvent(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->lastLine());
else
- debugger->didExecuteProgram(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->lastLine());
+ debugger->didExecuteProgram(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->lastLine());
}
if (Profiler* profiler = *Profiler::enabledProfilerReference()) {
if (callFrame->callee())
profiler->didExecute(callFrame, callFrame->callee());
else
- profiler->didExecute(callFrame, codeBlock->ownerExecutable()->sourceURL(), codeBlock->ownerExecutable()->lineNo());
+ profiler->didExecute(callFrame, codeBlock->ownerNode()->sourceURL(), codeBlock->ownerNode()->lineNo());
}
// If this call frame created an activation or an 'arguments' object, tear it off.
if (oldCodeBlock->codeType() == FunctionCode && oldCodeBlock->needsFullScopeChain()) {
- while (!scopeChain->object->inherits(&JSActivation::info))
+ while (!scopeChain->object->isObject(&JSActivation::info))
scopeChain = scopeChain->pop();
static_cast<JSActivation*>(scopeChain->object)->copyRegisters(callFrame->optionalCalleeArguments());
} else if (Arguments* arguments = callFrame->optionalCalleeArguments()) {
@@ -554,8 +555,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->ownerExecutable()->sourceID()), ReadOnly | DontDelete);
- exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerExecutable()->sourceURL()), 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);
}
if (exception->isWatchdogException()) {
@@ -569,7 +570,7 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {
DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
- debugger->exception(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset));
+ debugger->exception(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset));
}
// If we throw in the middle of a call instruction, we need to notify
@@ -609,7 +610,7 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
return handler;
}
-JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, ScopeChainNode* scopeChain, JSObject* thisObj, JSValue* exception)
+JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, ScopeChainNode* scopeChain, JSObject* thisObj, JSValue* exception)
{
ASSERT(!scopeChain->globalData->exception);
@@ -620,7 +621,7 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, S
}
}
- CodeBlock* codeBlock = &program->bytecode(scopeChain);
+ CodeBlock* codeBlock = &programNode->bytecode(scopeChain);
Register* oldEnd = m_registerFile.end();
Register* newEnd = oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;
@@ -644,7 +645,7 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, S
Profiler** profiler = Profiler::enabledProfilerReference();
if (*profiler)
- (*profiler)->willExecute(newCallFrame, program->sourceURL(), program->lineNo());
+ (*profiler)->willExecute(newCallFrame, programNode->sourceURL(), programNode->lineNo());
JSValue result;
{
@@ -652,7 +653,7 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, S
m_reentryDepth++;
#if ENABLE(JIT)
- result = program->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
+ result = programNode->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
#else
result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
#endif
@@ -660,7 +661,7 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, S
}
if (*profiler)
- (*profiler)->didExecute(callFrame, program->sourceURL(), program->lineNo());
+ (*profiler)->didExecute(callFrame, programNode->sourceURL(), programNode->lineNo());
if (m_reentryDepth && lastGlobalObject && globalObject != lastGlobalObject)
lastGlobalObject->copyGlobalsTo(m_registerFile);
@@ -670,7 +671,7 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, S
return result;
}
-JSValue Interpreter::execute(FunctionExecutable* functionExecutable, CallFrame* callFrame, JSFunction* function, JSObject* thisObj, const ArgList& args, ScopeChainNode* scopeChain, JSValue* exception)
+JSValue Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* callFrame, JSFunction* function, JSObject* thisObj, const ArgList& args, ScopeChainNode* scopeChain, JSValue* exception)
{
ASSERT(!scopeChain->globalData->exception);
@@ -698,7 +699,7 @@ JSValue Interpreter::execute(FunctionExecutable* functionExecutable, CallFrame*
for (ArgList::const_iterator it = args.begin(); it != end; ++it)
newCallFrame->r(++dst) = *it;
- CodeBlock* codeBlock = &functionExecutable->bytecode(scopeChain);
+ CodeBlock* codeBlock = &functionBodyNode->bytecode(scopeChain);
newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc);
if (UNLIKELY(!newCallFrame)) {
*exception = createStackOverflowError(callFrame);
@@ -718,7 +719,7 @@ JSValue Interpreter::execute(FunctionExecutable* functionExecutable, CallFrame*
m_reentryDepth++;
#if ENABLE(JIT)
- result = functionExecutable->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
+ result = functionBodyNode->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
#else
result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
#endif
@@ -732,7 +733,7 @@ JSValue Interpreter::execute(FunctionExecutable* functionExecutable, CallFrame*
return result;
}
-CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* FunctionExecutable, CallFrame* callFrame, JSFunction* function, int argCount, ScopeChainNode* scopeChain, JSValue* exception)
+CallFrameClosure Interpreter::prepareForRepeatCall(FunctionBodyNode* functionBodyNode, CallFrame* callFrame, JSFunction* function, int argCount, ScopeChainNode* scopeChain, JSValue* exception)
{
ASSERT(!scopeChain->globalData->exception);
@@ -756,7 +757,7 @@ CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* FunctionE
for (int i = 0; i < argc; ++i)
newCallFrame->r(++dst) = jsUndefined();
- CodeBlock* codeBlock = &FunctionExecutable->bytecode(scopeChain);
+ CodeBlock* codeBlock = &functionBodyNode->bytecode(scopeChain);
newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc);
if (UNLIKELY(!newCallFrame)) {
*exception = createStackOverflowError(callFrame);
@@ -766,10 +767,10 @@ CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* FunctionE
// a 0 codeBlock indicates a built-in caller
newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), 0, argc, function);
#if ENABLE(JIT)
- FunctionExecutable->jitCode(scopeChain);
+ functionBodyNode->jitCode(scopeChain);
#endif
- CallFrameClosure result = { callFrame, newCallFrame, function, FunctionExecutable, scopeChain->globalData, oldEnd, scopeChain, codeBlock->m_numParameters, argc };
+ CallFrameClosure result = { callFrame, newCallFrame, function, functionBodyNode, scopeChain->globalData, oldEnd, scopeChain, codeBlock->m_numParameters, argc };
return result;
}
@@ -786,7 +787,7 @@ JSValue Interpreter::execute(CallFrameClosure& closure, JSValue* exception)
m_reentryDepth++;
#if ENABLE(JIT)
- result = closure.functionExecutable->generatedJITCode().execute(&m_registerFile, closure.newCallFrame, closure.globalData, exception);
+ result = closure.functionBody->generatedJITCode().execute(&m_registerFile, closure.newCallFrame, closure.globalData, exception);
#else
result = privateExecute(Normal, &m_registerFile, closure.newCallFrame, exception);
#endif
@@ -803,12 +804,12 @@ void Interpreter::endRepeatCall(CallFrameClosure& closure)
m_registerFile.shrink(closure.oldEnd);
}
-JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception)
+JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception)
{
- return execute(eval, callFrame, thisObj, m_registerFile.size() + eval->bytecode(scopeChain).m_numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception);
+ return execute(evalNode, callFrame, thisObj, m_registerFile.size() + evalNode->bytecode(scopeChain).m_numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception);
}
-JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObject* thisObj, int globalRegisterOffset, ScopeChainNode* scopeChain, JSValue* exception)
+JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, int globalRegisterOffset, ScopeChainNode* scopeChain, JSValue* exception)
{
ASSERT(!scopeChain->globalData->exception);
@@ -821,7 +822,7 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObjec
DynamicGlobalObjectScope globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : scopeChain->globalObject());
- EvalCodeBlock* codeBlock = &eval->bytecode(scopeChain);
+ EvalCodeBlock* codeBlock = &evalNode->bytecode(scopeChain);
JSVariableObject* variableObject;
for (ScopeChainNode* node = scopeChain; ; node = node->next) {
@@ -836,7 +837,7 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObjec
BatchedTransitionOptimizer optimizer(variableObject);
- const DeclarationStacks::VarStack& varStack = static_cast<EvalExecutable*>(codeBlock->ownerExecutable())->varStack();
+ 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;
@@ -846,11 +847,11 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObjec
}
}
- int numFunctions = codeBlock->numberOfFunctionDecls();
- for (int i = 0; i < numFunctions; ++i) {
- FunctionExecutable* function = codeBlock->functionDecl(i);
+ 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) {
PutPropertySlot slot;
- variableObject->put(callFrame, function->name(), function->make(callFrame, scopeChain), slot);
+ variableObject->put(callFrame, (*it)->m_ident, (*it)->makeFunction(callFrame, scopeChain), slot);
}
}
@@ -873,7 +874,7 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObjec
Profiler** profiler = Profiler::enabledProfilerReference();
if (*profiler)
- (*profiler)->willExecute(newCallFrame, eval->sourceURL(), eval->lineNo());
+ (*profiler)->willExecute(newCallFrame, evalNode->sourceURL(), evalNode->lineNo());
JSValue result;
{
@@ -881,7 +882,7 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObjec
m_reentryDepth++;
#if ENABLE(JIT)
- result = eval->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
+ result = evalNode->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
#else
result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
#endif
@@ -889,7 +890,7 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObjec
}
if (*profiler)
- (*profiler)->didExecute(callFrame, eval->sourceURL(), eval->lineNo());
+ (*profiler)->didExecute(callFrame, evalNode->sourceURL(), evalNode->lineNo());
m_registerFile.shrink(oldEnd);
return result;
@@ -903,22 +904,22 @@ NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHook
switch (debugHookID) {
case DidEnterCallFrame:
- debugger->callEvent(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), firstLine);
+ debugger->callEvent(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
return;
case WillLeaveCallFrame:
- debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), lastLine);
+ debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
return;
case WillExecuteStatement:
- debugger->atStatement(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), firstLine);
+ debugger->atStatement(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
return;
case WillExecuteProgram:
- debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), firstLine);
+ debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
return;
case DidExecuteProgram:
- debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), lastLine);
+ debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
return;
case DidReachBreakpoint:
- debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), lastLine);
+ debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
return;
}
}
@@ -2920,7 +2921,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int dst = (++vPC)->u.operand;
int func = (++vPC)->u.operand;
- callFrame->r(dst) = JSValue(callFrame->codeBlock()->functionDecl(func)->make(callFrame, callFrame->scopeChain()));
+ callFrame->r(dst) = JSValue(callFrame->codeBlock()->function(func)->makeFunction(callFrame, callFrame->scopeChain()));
++vPC;
NEXT_INSTRUCTION();
@@ -2934,24 +2935,9 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
puts the result in register dst.
*/
int dst = (++vPC)->u.operand;
- int funcIndex = (++vPC)->u.operand;
-
- 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);
- }
+ int func = (++vPC)->u.operand;
- callFrame->r(dst) = JSValue(func);
+ callFrame->r(dst) = JSValue(callFrame->codeBlock()->functionExpression(func)->makeFunction(callFrame, callFrame->scopeChain()));
++vPC;
NEXT_INSTRUCTION();
@@ -3017,7 +3003,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (callType == CallTypeJS) {
ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
- CodeBlock* newCodeBlock = &callData.js.functionExecutable->bytecode(callDataScopeChain);
+ FunctionBodyNode* functionBodyNode = callData.js.functionBody;
+ CodeBlock* newCodeBlock = &functionBodyNode->bytecode(callDataScopeChain);
CallFrame* previousCallFrame = callFrame;
@@ -3083,7 +3070,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
exceptionValue = createStackOverflowError(callFrame);
goto vm_throw;
}
- int32_t expectedParams = callFrame->callee()->executable()->parameterCount();
+ int32_t expectedParams = callFrame->callee()->body()->parameterCount();
int32_t inplaceArgs = min(argCount, expectedParams);
int32_t i = 0;
Register* argStore = callFrame->registers() + argsOffset;
@@ -3170,7 +3157,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (callType == CallTypeJS) {
ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
- CodeBlock* newCodeBlock = &callData.js.functionExecutable->bytecode(callDataScopeChain);
+ FunctionBodyNode* functionBodyNode = callData.js.functionBody;
+ CodeBlock* newCodeBlock = &functionBodyNode->bytecode(callDataScopeChain);
CallFrame* previousCallFrame = callFrame;
@@ -3332,7 +3320,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<FunctionExecutable*>(codeBlock->ownerExecutable()));
+ JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionBodyNode*>(codeBlock->ownerNode()));
callFrame->r(dst) = JSValue(activation);
callFrame->setScopeChain(callFrame->scopeChain()->copy()->push(activation));
@@ -3418,7 +3406,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (constructType == ConstructTypeJS) {
ScopeChainNode* callDataScopeChain = constructData.js.scopeChain;
- CodeBlock* newCodeBlock = &constructData.js.functionExecutable->bytecode(callDataScopeChain);
+ FunctionBodyNode* functionBodyNode = constructData.js.functionBody;
+ CodeBlock* newCodeBlock = &functionBodyNode->bytecode(callDataScopeChain);
Structure* structure;
JSValue prototype = callFrame->r(proto).jsValue();
@@ -3668,7 +3657,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->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()));
+ 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()));
++vPC;
NEXT_INSTRUCTION();
@@ -3896,8 +3885,8 @@ void Interpreter::retrieveLastCaller(CallFrame* callFrame, int& lineNumber, intp
unsigned bytecodeOffset = bytecodeOffsetForPC(callerFrame, callerCodeBlock, callFrame->returnPC());
lineNumber = callerCodeBlock->lineNumberForBytecodeOffset(callerFrame, bytecodeOffset - 1);
- sourceID = callerCodeBlock->ownerExecutable()->sourceID();
- sourceURL = callerCodeBlock->ownerExecutable()->sourceURL();
+ sourceID = callerCodeBlock->ownerNode()->sourceID();
+ sourceURL = callerCodeBlock->ownerNode()->sourceURL();
function = callerFrame->callee();
}
diff --git a/JavaScriptCore/interpreter/Interpreter.h b/JavaScriptCore/interpreter/Interpreter.h
index 8cb75d2..519c508 100644
--- a/JavaScriptCore/interpreter/Interpreter.h
+++ b/JavaScriptCore/interpreter/Interpreter.h
@@ -42,12 +42,12 @@
namespace JSC {
class CodeBlock;
- class EvalExecutable;
- class FunctionExecutable;
+ class EvalNode;
+ class FunctionBodyNode;
class InternalFunction;
class JSFunction;
class JSGlobalObject;
- class ProgramExecutable;
+ class ProgramNode;
class Register;
class ScopeChainNode;
class SamplingTool;
@@ -95,9 +95,9 @@ namespace JSC {
bool isOpcode(Opcode);
- 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 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 retrieveArguments(CallFrame*, JSFunction*) const;
JSValue retrieveCaller(CallFrame*, InternalFunction*) const;
@@ -115,11 +115,11 @@ namespace JSC {
private:
enum ExecutionFlag { Normal, InitializeAndReturn };
- CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, JSFunction*, int argCount, ScopeChainNode*, JSValue* exception);
+ CallFrameClosure prepareForRepeatCall(FunctionBodyNode*, CallFrame*, JSFunction*, int argCount, ScopeChainNode*, JSValue* exception);
void endRepeatCall(CallFrameClosure&);
JSValue execute(CallFrameClosure&, JSValue* exception);
- JSValue execute(EvalExecutable*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*, JSValue* exception);
+ JSValue execute(EvalNode*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*, JSValue* exception);
#if USE(INTERPRETER)
NEVER_INLINE bool resolve(CallFrame*, Instruction*, JSValue& exceptionValue);
diff --git a/JavaScriptCore/jit/JIT.cpp b/JavaScriptCore/jit/JIT.cpp
index c50b6de..0d6d1b8 100644
--- a/JavaScriptCore/jit/JIT.cpp
+++ b/JavaScriptCore/jit/JIT.cpp
@@ -438,7 +438,7 @@ void JIT::privateCompileSlowCases()
#endif
}
-JITCode JIT::privateCompile()
+void JIT::privateCompile()
{
sampleCodeBlock(m_codeBlock);
#if ENABLE(OPCODE_SAMPLING)
@@ -552,7 +552,7 @@ JITCode JIT::privateCompile()
info.callReturnLocation = m_codeBlock->structureStubInfo(m_methodCallCompilationInfo[i].propertyAccessIndex).callReturnLocation;
}
- return patchBuffer.finalizeCode();
+ m_codeBlock->setJITCode(patchBuffer.finalizeCode());
}
#if !USE(JSVALUE32_64)
diff --git a/JavaScriptCore/jit/JIT.h b/JavaScriptCore/jit/JIT.h
index 5c6607c..93f47d9 100644
--- a/JavaScriptCore/jit/JIT.h
+++ b/JavaScriptCore/jit/JIT.h
@@ -277,9 +277,10 @@ namespace JSC {
static const int patchGetByIdDefaultOffset = 256;
public:
- static JITCode compile(JSGlobalData* globalData, CodeBlock* codeBlock)
+ static void compile(JSGlobalData* globalData, CodeBlock* codeBlock)
{
- return JIT(globalData, codeBlock).privateCompile();
+ JIT jit(globalData, codeBlock);
+ jit.privateCompile();
}
static void compileGetByIdProto(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, ReturnAddressPtr returnAddress)
@@ -352,7 +353,7 @@ namespace JSC {
void privateCompileMainPass();
void privateCompileLinkPass();
void privateCompileSlowCases();
- JITCode privateCompile();
+ void 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);
@@ -594,62 +595,9 @@ namespace JSC {
static const int patchOffsetMethodCheckProtoObj = 18;
static const int patchOffsetMethodCheckProtoStruct = 28;
static const int patchOffsetMethodCheckPutFunction = 46;
-#elif PLATFORM(ARM)
- // 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) && !PLATFORM_ARM_ARCH(7)
- // 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*);
@@ -887,13 +835,6 @@ 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/JITCall.cpp b/JavaScriptCore/jit/JITCall.cpp
index a19fae8..7fdb845 100644
--- a/JavaScriptCore/jit/JITCall.cpp
+++ b/JavaScriptCore/jit/JITCall.cpp
@@ -617,13 +617,7 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca
// This deliberately leaves the callee in ecx, used when setting up the stack frame below
emitGetVirtualRegister(callee, regT2);
DataLabelPtr addressOfLinkedFunctionCheck;
-
- BEGIN_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
-
Jump jumpToSlow = branchPtrWithPatch(NotEqual, regT2, addressOfLinkedFunctionCheck, ImmPtr(JSValue::encode(JSValue())));
-
- END_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
-
addSlowCase(jumpToSlow);
ASSERT(differenceBetween(addressOfLinkedFunctionCheck, jumpToSlow) == patchOffsetOpCallCompareToJump);
m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck;
diff --git a/JavaScriptCore/jit/JITInlineMethods.h b/JavaScriptCore/jit/JITInlineMethods.h
index ca34502..b5aaafc 100644
--- a/JavaScriptCore/jit/JITInlineMethods.h
+++ b/JavaScriptCore/jit/JITInlineMethods.h
@@ -102,39 +102,6 @@ ALWAYS_INLINE JIT::Call JIT::emitNakedCall(CodePtr function)
return nakedCall;
}
-#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
-
-ALWAYS_INLINE void JIT::beginUninterruptedSequence(int insnSpace, int constSpace)
-{
-#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)
-#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(X86) || PLATFORM(X86_64) || (PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7))
ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg)
diff --git a/JavaScriptCore/jit/JITOpcodes.cpp b/JavaScriptCore/jit/JITOpcodes.cpp
index 5a9be28..13fc981 100644
--- a/JavaScriptCore/jit/JITOpcodes.cpp
+++ b/JavaScriptCore/jit/JITOpcodes.cpp
@@ -68,8 +68,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
Label virtualCallLinkBegin = align();
// regT0 holds callee, regT1 holds argCount.
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
- loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_codeBlock)), regT2);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_body)), regT2);
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionBodyNode, m_code)), regT2);
Jump hasCodeBlock2 = branchTestPtr(NonZero, regT2);
// Lazily generate a CodeBlock.
@@ -114,8 +114,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
Label virtualCallBegin = align();
// regT0 holds callee, regT1 holds argCount.
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
- loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_codeBlock)), regT2);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_body)), regT2);
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionBodyNode, m_code)), regT2);
Jump hasCodeBlock3 = branchTestPtr(NonZero, regT2);
// Lazily generate a CodeBlock.
@@ -146,8 +146,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
arityCheckOkay3.link(this);
isNativeFunc3.link(this);
compileOpCallInitializeCallFrame();
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT0);
- loadPtr(Address(regT0, OBJECT_OFFSETOF(FunctionExecutable, m_jitCode)), regT0);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_body)), regT0);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(FunctionBodyNode, m_jitCode)), regT0);
jump(regT0);
#if PLATFORM(X86)
@@ -544,7 +544,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->functionDecl(currentInstruction[2].u.operand)));
+ stubCall.addArgument(ImmPtr(m_codeBlock->function(currentInstruction[2].u.operand)));
stubCall.call(currentInstruction[1].u.operand);
}
@@ -1180,7 +1180,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->functionExpr(currentInstruction[2].u.operand)));
+ stubCall.addArgument(ImmPtr(m_codeBlock->functionExpression(currentInstruction[2].u.operand)));
stubCall.call(currentInstruction[1].u.operand);
}
@@ -1487,8 +1487,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
Label virtualCallLinkBegin = align();
// Load the callee CodeBlock* into eax
- loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3);
- loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionExecutable, m_codeBlock)), regT0);
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_body)), regT3);
+ loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionBodyNode, m_code)), regT0);
Jump hasCodeBlock2 = branchTestPtr(NonZero, regT0);
preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
@@ -1527,8 +1527,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
Label virtualCallBegin = align();
// Load the callee CodeBlock* into eax
- loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3);
- loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionExecutable, m_codeBlock)), regT0);
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_body)), regT3);
+ loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionBodyNode, m_code)), regT0);
Jump hasCodeBlock3 = branchTestPtr(NonZero, regT0);
preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
@@ -1536,7 +1536,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
emitGetJITStubArg(1, regT2);
emitGetJITStubArg(3, regT1);
restoreReturnAddressBeforeReturn(regT3);
- loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3); // reload the function body nody, so we can reload the code pointer.
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_body)), regT3); // reload the function body nody, so we can reload the code pointer.
hasCodeBlock3.link(this);
Jump isNativeFunc3 = branch32(Equal, Address(regT0, OBJECT_OFFSETOF(CodeBlock, m_codeType)), Imm32(NativeCode));
@@ -1552,12 +1552,12 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
emitGetJITStubArg(1, regT2);
emitGetJITStubArg(3, regT1);
restoreReturnAddressBeforeReturn(regT3);
- loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3); // reload the function body nody, so we can reload the code pointer.
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_body)), regT3); // reload the function body nody, so we can reload the code pointer.
arityCheckOkay3.link(this);
isNativeFunc3.link(this);
// load ctiCode from the new codeBlock.
- loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionExecutable, m_jitCode)), regT0);
+ loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionBodyNode, m_jitCode)), regT0);
compileOpCallInitializeCallFrame();
jump(regT0);
@@ -1971,7 +1971,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->functionDecl(currentInstruction[2].u.operand)));
+ stubCall.addArgument(ImmPtr(m_codeBlock->function(currentInstruction[2].u.operand)));
stubCall.call(currentInstruction[1].u.operand);
}
@@ -2325,7 +2325,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->functionExpr(currentInstruction[2].u.operand)));
+ stubCall.addArgument(ImmPtr(m_codeBlock->functionExpression(currentInstruction[2].u.operand)));
stubCall.call(currentInstruction[1].u.operand);
}
diff --git a/JavaScriptCore/jit/JITPropertyAccess.cpp b/JavaScriptCore/jit/JITPropertyAccess.cpp
index 85a731d..9dba2e2 100644
--- a/JavaScriptCore/jit/JITPropertyAccess.cpp
+++ b/JavaScriptCore/jit/JITPropertyAccess.cpp
@@ -1122,20 +1122,13 @@ 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);
@@ -1199,8 +1192,6 @@ void JIT::compileGetByIdHotPath(int, int baseVReg, Identifier*, unsigned propert
emitJumpSlowCaseIfNotJSCell(regT0, baseVReg);
- BEGIN_UNINTERRUPTED_SEQUENCE(sequenceGetByIdHotPath);
-
Label hotPathBegin(this);
m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].hotPathBegin = hotPathBegin;
@@ -1219,9 +1210,6 @@ 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);
}
@@ -1245,8 +1233,6 @@ void JIT::compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident
linkSlowCaseIfNotJSCell(iter, baseVReg);
linkSlowCase(iter);
- BEGIN_UNINTERRUPTED_SEQUENCE(sequenceGetByIdSlowCase);
-
#ifndef NDEBUG
Label coldPathBegin(this);
#endif
@@ -1255,8 +1241,6 @@ 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.
@@ -1280,8 +1264,6 @@ 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;
@@ -1297,9 +1279,6 @@ 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);
}
diff --git a/JavaScriptCore/jit/JITStubs.cpp b/JavaScriptCore/jit/JITStubs.cpp
index 55dab0b..d563f58 100644
--- a/JavaScriptCore/jit/JITStubs.cpp
+++ b/JavaScriptCore/jit/JITStubs.cpp
@@ -1467,7 +1467,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_new_func)
{
STUB_INIT_STACK_FRAME(stackFrame);
- return stackFrame.args[0].function()->make(stackFrame.callFrame, stackFrame.callFrame->scopeChain());
+ return stackFrame.args[0].funcDeclNode()->makeFunction(stackFrame.callFrame, stackFrame.callFrame->scopeChain());
}
DEFINE_STUB_FUNCTION(void*, op_call_JSFunction)
@@ -1480,12 +1480,12 @@ DEFINE_STUB_FUNCTION(void*, op_call_JSFunction)
#endif
JSFunction* function = asFunction(stackFrame.args[0].jsValue());
- FunctionExecutable* executable = function->executable();
- ASSERT(!executable->isHostFunction());
+ ASSERT(!function->isHostFunction());
+ FunctionBodyNode* body = function->body();
ScopeChainNode* callDataScopeChain = function->scope().node();
- executable->jitCode(callDataScopeChain);
+ body->jitCode(callDataScopeChain);
- return &executable->generatedBytecode();
+ return &(body->generatedBytecode());
}
DEFINE_STUB_FUNCTION(VoidPtrPair, op_call_arityCheck)
@@ -1539,14 +1539,13 @@ DEFINE_STUB_FUNCTION(void*, vm_lazyLinkCall)
{
STUB_INIT_STACK_FRAME(stackFrame);
JSFunction* callee = asFunction(stackFrame.args[0].jsValue());
- FunctionExecutable* executable = callee->executable();
- JITCode& jitCode = executable->generatedJITCode();
+ JITCode& jitCode = callee->body()->generatedJITCode();
CodeBlock* codeBlock = 0;
- if (!executable->isHostFunction())
- codeBlock = &executable->bytecode(callee->scope().node());
+ if (!callee->isHostFunction())
+ codeBlock = &callee->body()->bytecode(callee->scope().node());
else
- codeBlock = &executable->generatedBytecode();
+ codeBlock = &callee->body()->generatedBytecode();
CallLinkInfo* callLinkInfo = &stackFrame.callFrame->callerFrame()->codeBlock()->getCallLinkInfo(stackFrame.args[1].returnAddress());
if (!callLinkInfo->seenOnce())
@@ -1562,7 +1561,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_push_activation)
{
STUB_INIT_STACK_FRAME(stackFrame);
- JSActivation* activation = new (stackFrame.globalData) JSActivation(stackFrame.callFrame, static_cast<FunctionExecutable*>(stackFrame.callFrame->codeBlock()->ownerExecutable()));
+ JSActivation* activation = new (stackFrame.globalData) JSActivation(stackFrame.callFrame, static_cast<FunctionBodyNode*>(stackFrame.callFrame->codeBlock()->ownerNode()));
stackFrame.callFrame->setScopeChain(stackFrame.callFrame->scopeChain()->copy()->push(activation));
return activation;
}
@@ -1716,8 +1715,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_construct_JSConstruct)
STUB_INIT_STACK_FRAME(stackFrame);
JSFunction* constructor = asFunction(stackFrame.args[0].jsValue());
- FunctionExecutable* executable = constructor->executable();
- if (executable && executable->isHostFunction()) {
+ if (constructor->isHostFunction()) {
CallFrame* callFrame = stackFrame.callFrame;
CodeBlock* codeBlock = callFrame->codeBlock();
unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
@@ -2044,7 +2042,7 @@ DEFINE_STUB_FUNCTION(int, op_load_varargs)
stackFrame.globalData->exception = createStackOverflowError(callFrame);
VM_THROW_EXCEPTION();
}
- int32_t expectedParams = callFrame->callee()->executable()->parameterCount();
+ int32_t expectedParams = callFrame->callee()->body()->parameterCount();
int32_t inplaceArgs = min(providedParams, expectedParams);
Register* inplaceArgsDst = callFrame->registers() + argsOffset;
@@ -2519,24 +2517,8 @@ 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 func;
+ return stackFrame.args[0].funcExprNode()->makeFunction(stackFrame.callFrame, stackFrame.callFrame->scopeChain());
}
DEFINE_STUB_FUNCTION(EncodedJSValue, op_mod)
@@ -2996,7 +2978,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->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
+ return Error::create(callFrame, static_cast<ErrorType>(type), message.toString(callFrame), lineNumber, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
}
DEFINE_STUB_FUNCTION(void, op_debug)
diff --git a/JavaScriptCore/jit/JITStubs.h b/JavaScriptCore/jit/JITStubs.h
index 1dbdeaa..8f02435 100644
--- a/JavaScriptCore/jit/JITStubs.h
+++ b/JavaScriptCore/jit/JITStubs.h
@@ -42,7 +42,6 @@ namespace JSC {
class CodeBlock;
class ExecutablePool;
- class FunctionExecutable;
class Identifier;
class JSGlobalData;
class JSGlobalData;
@@ -54,6 +53,8 @@ namespace JSC {
class PropertySlot;
class PutPropertySlot;
class RegisterFile;
+ class FuncDeclNode;
+ class FuncExprNode;
class JSGlobalObject;
class RegExp;
@@ -66,7 +67,8 @@ namespace JSC {
Identifier& identifier() { return *static_cast<Identifier*>(asPointer); }
int32_t int32() { return asInt32; }
CodeBlock* codeBlock() { return static_cast<CodeBlock*>(asPointer); }
- FunctionExecutable* function() { return static_cast<FunctionExecutable*>(asPointer); }
+ FuncDeclNode* funcDeclNode() { return static_cast<FuncDeclNode*>(asPointer); }
+ FuncExprNode* funcExprNode() { return static_cast<FuncExprNode*>(asPointer); }
RegExp* regExp() { return static_cast<RegExp*>(asPointer); }
JSPropertyNameIterator* propertyNameIterator() { return static_cast<JSPropertyNameIterator*>(asPointer); }
JSGlobalObject* globalObject() { return static_cast<JSGlobalObject*>(asPointer); }
diff --git a/JavaScriptCore/parser/Grammar.y b/JavaScriptCore/parser/Grammar.y
index 227fdb5..354c786 100644
--- a/JavaScriptCore/parser/Grammar.y
+++ b/JavaScriptCore/parser/Grammar.y
@@ -25,12 +25,18 @@
#include "config.h"
+#include <string.h>
+#include <stdlib.h>
+#include "JSValue.h"
#include "JSObject.h"
-#include "JSString.h"
#include "NodeConstructors.h"
+#include "Lexer.h"
+#include "JSString.h"
+#include "JSGlobalData.h"
+#include "CommonIdentifiers.h"
#include "NodeInfo.h"
-#include <stdlib.h>
-#include <string.h>
+#include "Parser.h"
+#include <wtf/FastMalloc.h>
#include <wtf/MathExtras.h>
#define YYMALLOC fastMalloc
@@ -39,44 +45,46 @@
#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 by not setting this on the Darwin platform.
-// FIXME: Is this still needed?
+ // avoid triggering warnings in older bison
#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 AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*GLOBAL_DATA->lexer, yychar)) YYABORT; } while (0)
+#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)
using namespace JSC;
using namespace std;
-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);
+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);
#if COMPILER(MSVC)
@@ -89,17 +97,17 @@ static ExpressionNode* combineCommaNodes(JSGlobalData*, ExpressionNode* list, Ex
#define YYPARSE_PARAM globalPtr
#define YYLEX_PARAM globalPtr
-template <typename T> inline NodeDeclarationInfo<T> createNodeDeclarationInfo(T node,
- ParserArenaData<DeclarationStacks::VarStack>* varDecls,
- ParserArenaData<DeclarationStacks::FunctionStack>* funcDecls,
- CodeFeatures info, int numConstants)
+template <typename T> 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> inline NodeInfo<T> createNodeInfo(T node, CodeFeatures info, int numConstants)
+template <typename T> NodeInfo<T> createNodeInfo(T node, CodeFeatures info, int numConstants)
{
ASSERT((info & ~AllFeatures) == 0);
NodeInfo<T> result = { node, info, numConstants };
@@ -125,21 +133,21 @@ template <typename T> inline T mergeDeclarationLists(T decls1, T decls2)
return decls1;
}
-static void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
+static void appendToVarDeclarationList(void* globalPtr, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
{
if (!varDecls)
- varDecls = new (globalData) ParserArenaData<DeclarationStacks::VarStack>;
+ varDecls = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
varDecls->data.append(make_pair(ident, attrs));
}
-static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
+static inline void appendToVarDeclarationList(void* globalPtr, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
{
unsigned attrs = DeclarationStacks::IsConstant;
if (decl->hasInitializer())
attrs |= DeclarationStacks::HasInitializer;
- appendToVarDeclarationList(globalData, varDecls, decl->ident(), attrs);
+ appendToVarDeclarationList(globalPtr, varDecls, decl->ident(), attrs);
}
%}
@@ -176,20 +184,6 @@ static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserAr
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 */
@@ -297,25 +291,21 @@ 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 = *GLOBAL_DATA->lexer;
- const Identifier* pattern;
- const Identifier* flags;
- if (!l.scanRegExp(pattern, flags))
+ Lexer& l = *LEXER;
+ if (!l.scanRegExp())
YYABORT;
- 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);
+ 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);
$$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
}
| DIVEQUAL /* regexp with /= */ {
- Lexer& l = *GLOBAL_DATA->lexer;
- const Identifier* pattern;
- const Identifier* flags;
- if (!l.scanRegExp(pattern, flags, '='))
+ Lexer& l = *LEXER;
+ if (!l.scanRegExp())
YYABORT;
- 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);
+ 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);
$$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
}
;
@@ -323,14 +313,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, $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; }
+ | 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; }
| IDENT IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
{
- $$ = 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);
+ $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, $4.m_node.head, $7, LEXER->sourceCode($6, $8, @6.first_line)), $4.m_features | ClosureFeature, 0);
if ($4.m_features & ArgumentsFeature)
$7->setUsesArguments();
- setStatementLocation($7, @6, @8);
+ DBG($7, @6, @8);
if (!$$.m_node)
YYABORT;
}
@@ -395,15 +385,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);
- setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
+ SET_EXCEPTION_LOCATION(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);
- setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
+ SET_EXCEPTION_LOCATION(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);
- setExceptionLocation(node, @1.first_column, @2.last_column, @3.last_column);
+ SET_EXCEPTION_LOCATION(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);
}
;
@@ -411,15 +401,15 @@ MemberExpr:
MemberExprNoBF:
PrimaryExprNoBrace
| MemberExprNoBF '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
+ SET_EXCEPTION_LOCATION(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);
- setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
+ SET_EXCEPTION_LOCATION(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);
- setExceptionLocation(node, @1.first_column, @2.last_column, @3.last_column);
+ SET_EXCEPTION_LOCATION(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);
}
;
@@ -427,7 +417,7 @@ MemberExprNoBF:
NewExpr:
MemberExpr
| NEW NewExpr { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
+ SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants);
}
;
@@ -435,32 +425,32 @@ NewExpr:
NewExprNoBF:
MemberExprNoBF
| NEW NewExpr { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
+ SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants);
}
;
CallExpr:
- 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); }
+ 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); }
| CallExpr '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
+ SET_EXCEPTION_LOCATION(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);
- setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
+ SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants); }
;
CallExprNoBF:
- 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); }
+ 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); }
| CallExprNoBF '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
+ SET_EXCEPTION_LOCATION(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);
- setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
+ SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
$$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
}
;
@@ -578,10 +568,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);
- setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
+ SET_EXCEPTION_LOCATION(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);
- setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
+ SET_EXCEPTION_LOCATION(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); }
;
@@ -593,7 +583,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);
- setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
+ SET_EXCEPTION_LOCATION(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); }
;
@@ -605,11 +595,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);
- setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
+ SET_EXCEPTION_LOCATION(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);
- setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
+ SET_EXCEPTION_LOCATION(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); }
;
@@ -820,17 +810,17 @@ Statement:
;
Block:
- 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); }
+ 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); }
;
VariableStatement:
VAR VariableDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
- setStatementLocation($$.m_node, @1, @3); }
+ DBG($$.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);
- setStatementLocation($$.m_node, @1, @2);
+ DBG($$.m_node, @1, @2);
AUTO_SEMICOLON; }
;
@@ -843,7 +833,7 @@ VariableDeclarationList:
$$.m_numConstants = 0;
}
| IDENT Initializer { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @2.first_column + 1, @2.last_column);
+ SET_EXCEPTION_LOCATION(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);
@@ -861,7 +851,7 @@ VariableDeclarationList:
}
| VariableDeclarationList ',' IDENT Initializer
{ AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature);
- setExceptionLocation(node, @3.first_column, @4.first_column + 1, @4.last_column);
+ SET_EXCEPTION_LOCATION(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);
@@ -880,7 +870,7 @@ VariableDeclarationListNoIn:
$$.m_numConstants = 0;
}
| IDENT InitializerNoIn { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @2.first_column + 1, @2.last_column);
+ SET_EXCEPTION_LOCATION(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);
@@ -898,7 +888,7 @@ VariableDeclarationListNoIn:
}
| VariableDeclarationListNoIn ',' IDENT InitializerNoIn
{ AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature);
- setExceptionLocation(node, @3.first_column, @4.first_column + 1, @4.last_column);
+ SET_EXCEPTION_LOCATION(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);
@@ -910,10 +900,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);
- setStatementLocation($$.m_node, @1, @3); }
+ DBG($$.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);
- setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
+ DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
;
ConstDeclarationList:
@@ -955,36 +945,36 @@ EmptyStatement:
ExprStatement:
ExprNoBF ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants);
- setStatementLocation($$.m_node, @1, @2); }
+ DBG($$.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);
- setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
+ DBG($$.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);
- setStatementLocation($$.m_node, @1, @4); }
+ DBG($$.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);
- setStatementLocation($$.m_node, @1, @4); }
+ DBG($$.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);
- setStatementLocation($$.m_node, @1, @3); }
+ DBG($$.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);
- setStatementLocation($$.m_node, @1, @3); } // Always performs automatic semicolon insertion.
+ DBG($$.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);
- setStatementLocation($$.m_node, @1, @4); }
+ DBG($$.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);
- setStatementLocation($$.m_node, @1, @8);
+ DBG($$.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),
@@ -992,30 +982,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);
- setStatementLocation($$.m_node, @1, @9); }
+ DBG($$.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);
- setExceptionLocation(node, @3.first_column, @3.last_column, @5.last_column);
+ SET_EXCEPTION_LOCATION(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);
- setStatementLocation($$.m_node, @1, @6);
+ DBG($$.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);
- setExceptionLocation(forIn, @4.first_column, @5.first_column + 1, @6.last_column);
+ SET_EXCEPTION_LOCATION(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);
- setStatementLocation($$.m_node, @1, @7); }
+ DBG($$.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);
- setExceptionLocation(forIn, @4.first_column, @6.first_column + 1, @7.last_column);
+ SET_EXCEPTION_LOCATION(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);
- setStatementLocation($$.m_node, @1, @8); }
+ DBG($$.m_node, @1, @8); }
;
ExprOpt:
@@ -1030,63 +1020,63 @@ ExprNoInOpt:
ContinueStatement:
CONTINUE ';' { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
- setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
+ SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
$$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- setStatementLocation($$.m_node, @1, @2); }
+ DBG($$.m_node, @1, @2); }
| CONTINUE error { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
- setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
+ SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
$$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
+ DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
| CONTINUE IDENT ';' { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
+ SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
$$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- setStatementLocation($$.m_node, @1, @3); }
+ DBG($$.m_node, @1, @3); }
| CONTINUE IDENT error { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
+ SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
$$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
+ DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
;
BreakStatement:
BREAK ';' { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
- setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); }
+ 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); }
| BREAK error { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
- 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; }
+ 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; }
| BREAK IDENT ';' { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @3); }
+ 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); }
| BREAK IDENT error { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2);
- 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; }
+ 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; }
;
ReturnStatement:
RETURN ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
- setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); }
+ 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); }
| RETURN error { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
- 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; }
+ 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; }
| RETURN Expr ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node);
- 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); }
+ 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); }
| RETURN Expr error { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node);
- 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; }
+ 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; }
;
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);
- setStatementLocation($$.m_node, @1, @4); }
+ DBG($$.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);
- setStatementLocation($$.m_node, @1, @4); }
+ DBG($$.m_node, @1, @4); }
;
CaseBlock:
@@ -1100,7 +1090,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
;
@@ -1132,18 +1122,18 @@ DefaultClause:
LabelledStatement:
IDENT ':' Statement { LabelNode* node = new (GLOBAL_DATA) LabelNode(GLOBAL_DATA, *$1, $3.m_node);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
+ SET_EXCEPTION_LOCATION(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);
- 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);
+ 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);
}
| THROW Expr error { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node);
- 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;
+ 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;
}
;
@@ -1153,57 +1143,57 @@ TryStatement:
mergeDeclarationLists($2.m_funcDeclarations, $4.m_funcDeclarations),
$2.m_features | $4.m_features,
$2.m_numConstants + $4.m_numConstants);
- setStatementLocation($$.m_node, @1, @2); }
+ DBG($$.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);
- setStatementLocation($$.m_node, @1, @2); }
+ DBG($$.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);
- setStatementLocation($$.m_node, @1, @2); }
+ DBG($$.m_node, @1, @2); }
;
DebuggerStatement:
DEBUGGER ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
- setStatementLocation($$.m_node, @1, @2); }
+ DBG($$.m_node, @1, @2); }
| DEBUGGER error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
- setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
+ DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
;
FunctionDeclaration:
- 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 '(' ')' 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 '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
- {
- $$ = 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);
+ {
+ $$ = 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);
if ($4.m_features & ArgumentsFeature)
- $7->setUsesArguments();
- setStatementLocation($7, @6, @8);
- $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)->body());
+ $7->setUsesArguments();
+ DBG($7, @6, @8);
+ $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node));
}
;
FunctionExpr:
- 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)
+ 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)
$6->setUsesArguments();
- setStatementLocation($6, @5, @7);
+ DBG($6, @5, @7);
}
- | 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);
+ | 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);
if ($4.m_features & ArgumentsFeature)
$7->setUsesArguments();
- setStatementLocation($7, @6, @8);
+ DBG($7, @6, @8);
}
;
@@ -1251,8 +1241,8 @@ Literal_NoNode:
| FALSETOKEN
| NUMBER { }
| STRING { }
- | '/' /* regexp */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; }
- | DIVEQUAL /* regexp with /= */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; }
+ | '/' /* regexp */ { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; }
+ | DIVEQUAL /* regexp with /= */ { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; }
;
Property_NoNode:
@@ -1834,28 +1824,26 @@ SourceElements_NoNode:
%%
-#undef GLOBAL_DATA
-
-static ExpressionNode* makeAssignNode(JSGlobalData* globalData, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
+static ExpressionNode* makeAssignNode(void* globalPtr, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
{
if (!loc->isLocation())
- return new (globalData) AssignErrorNode(globalData, loc, op, expr, divot, divot - start, end - divot);
+ return new (GLOBAL_DATA) AssignErrorNode(GLOBAL_DATA, loc, op, expr, divot, divot - start, end - divot);
if (loc->isResolveNode()) {
ResolveNode* resolve = static_cast<ResolveNode*>(loc);
if (op == OpEqual) {
- AssignResolveNode* node = new (globalData) AssignResolveNode(globalData, resolve->identifier(), expr, exprHasAssignments);
- setExceptionLocation(node, start, divot, end);
+ AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, resolve->identifier(), expr, exprHasAssignments);
+ SET_EXCEPTION_LOCATION(node, start, divot, end);
return node;
} else
- return new (globalData) ReadModifyResolveNode(globalData, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
+ return new (GLOBAL_DATA) ReadModifyResolveNode(GLOBAL_DATA, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
}
if (loc->isBracketAccessorNode()) {
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc);
if (op == OpEqual)
- return new (globalData) AssignBracketNode(globalData, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
+ return new (GLOBAL_DATA) AssignBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
else {
- ReadModifyBracketNode* node = new (globalData) ReadModifyBracketNode(globalData, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot);
+ ReadModifyBracketNode* node = new (GLOBAL_DATA) ReadModifyBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot);
node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
return node;
}
@@ -1863,117 +1851,117 @@ static ExpressionNode* makeAssignNode(JSGlobalData* globalData, ExpressionNode*
ASSERT(loc->isDotAccessorNode());
DotAccessorNode* dot = static_cast<DotAccessorNode*>(loc);
if (op == OpEqual)
- return new (globalData) AssignDotNode(globalData, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
+ return new (GLOBAL_DATA) AssignDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
- ReadModifyDotNode* node = new (globalData) ReadModifyDotNode(globalData, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
+ ReadModifyDotNode* node = new (GLOBAL_DATA) ReadModifyDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
node->setSubexpressionInfo(dot->divot(), dot->endOffset());
return node;
}
-static ExpressionNode* makePrefixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
+static ExpressionNode* makePrefixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
{
if (!expr->isLocation())
- return new (globalData) PrefixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
+ return new (GLOBAL_DATA) PrefixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
if (expr->isResolveNode()) {
ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (globalData) PrefixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
+ return new (GLOBAL_DATA) PrefixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot);
}
if (expr->isBracketAccessorNode()) {
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
- PrefixBracketNode* node = new (globalData) PrefixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
+ PrefixBracketNode* node = new (GLOBAL_DATA) PrefixBracketNode(GLOBAL_DATA, 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 (globalData) PrefixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
+ PrefixDotNode* node = new (GLOBAL_DATA) PrefixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
node->setSubexpressionInfo(dot->divot(), dot->startOffset());
return node;
}
-static ExpressionNode* makePostfixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
+static ExpressionNode* makePostfixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
{
if (!expr->isLocation())
- return new (globalData) PostfixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
+ return new (GLOBAL_DATA) PostfixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
if (expr->isResolveNode()) {
ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (globalData) PostfixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
+ return new (GLOBAL_DATA) PostfixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot);
}
if (expr->isBracketAccessorNode()) {
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
- PostfixBracketNode* node = new (globalData) PostfixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
+ PostfixBracketNode* node = new (GLOBAL_DATA) PostfixBracketNode(GLOBAL_DATA, 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 (globalData) PostfixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
+ PostfixDotNode* node = new (GLOBAL_DATA) PostfixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
node->setSubexpressionInfo(dot->divot(), dot->endOffset());
return node;
}
-static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData* globalData, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end)
+static ExpressionNodeInfo makeFunctionCallNode(void* globalPtr, 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 (globalData) FunctionCallValueNode(globalData, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants);
+ return createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) FunctionCallValueNode(GLOBAL_DATA, 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 == 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 (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 (func.m_node->isBracketAccessorNode()) {
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func.m_node);
- FunctionCallBracketNode* node = new (globalData) FunctionCallBracketNode(globalData, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot);
+ FunctionCallBracketNode* node = new (GLOBAL_DATA) FunctionCallBracketNode(GLOBAL_DATA, 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() == 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);
+ 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);
else
- node = new (globalData) FunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
+ node = new (GLOBAL_DATA) FunctionCallDotNode(GLOBAL_DATA, 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(JSGlobalData* globalData, ExpressionNode* expr)
+static ExpressionNode* makeTypeOfNode(void* globalPtr, ExpressionNode* expr)
{
if (expr->isResolveNode()) {
ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (globalData) TypeOfResolveNode(globalData, resolve->identifier());
+ return new (GLOBAL_DATA) TypeOfResolveNode(GLOBAL_DATA, resolve->identifier());
}
- return new (globalData) TypeOfValueNode(globalData, expr);
+ return new (GLOBAL_DATA) TypeOfValueNode(GLOBAL_DATA, expr);
}
-static ExpressionNode* makeDeleteNode(JSGlobalData* globalData, ExpressionNode* expr, int start, int divot, int end)
+static ExpressionNode* makeDeleteNode(void* globalPtr, ExpressionNode* expr, int start, int divot, int end)
{
if (!expr->isLocation())
- return new (globalData) DeleteValueNode(globalData, expr);
+ return new (GLOBAL_DATA) DeleteValueNode(GLOBAL_DATA, expr);
if (expr->isResolveNode()) {
ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (globalData) DeleteResolveNode(globalData, resolve->identifier(), divot, divot - start, end - divot);
+ return new (GLOBAL_DATA) DeleteResolveNode(GLOBAL_DATA, resolve->identifier(), divot, divot - start, end - divot);
}
if (expr->isBracketAccessorNode()) {
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
- return new (globalData) DeleteBracketNode(globalData, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
+ return new (GLOBAL_DATA) DeleteBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
}
ASSERT(expr->isDotAccessorNode());
DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
- return new (globalData) DeleteDotNode(globalData, dot->base(), dot->identifier(), divot, divot - start, end - divot);
+ return new (GLOBAL_DATA) DeleteDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), divot, divot - start, end - divot);
}
-static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData* globalData, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source)
+static PropertyNode* makeGetterOrSetterPropertyNode(void* globalPtr, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source)
{
PropertyNode::Type type;
if (getOrSet == "get")
@@ -1982,10 +1970,10 @@ static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData* globalData, co
type = PropertyNode::Setter;
else
return 0;
- return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames->nullIdentifier, body, source, params), type);
+ return new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, name, new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, body, source, params), type);
}
-static ExpressionNode* makeNegateNode(JSGlobalData* globalData, ExpressionNode* n)
+static ExpressionNode* makeNegateNode(void* globalPtr, ExpressionNode* n)
{
if (n->isNumber()) {
NumberNode* number = static_cast<NumberNode*>(n);
@@ -1996,92 +1984,92 @@ static ExpressionNode* makeNegateNode(JSGlobalData* globalData, ExpressionNode*
}
}
- return new (globalData) NegateNode(globalData, n);
+ return new (GLOBAL_DATA) NegateNode(GLOBAL_DATA, n);
}
-static NumberNode* makeNumberNode(JSGlobalData* globalData, double d)
+static NumberNode* makeNumberNode(void* globalPtr, double d)
{
- return new (globalData) NumberNode(globalData, d);
+ return new (GLOBAL_DATA) NumberNode(GLOBAL_DATA, d);
}
-static ExpressionNode* makeBitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr)
+static ExpressionNode* makeBitwiseNotNode(void* globalPtr, ExpressionNode* expr)
{
if (expr->isNumber())
- return makeNumberNode(globalData, ~toInt32(static_cast<NumberNode*>(expr)->value()));
- return new (globalData) BitwiseNotNode(globalData, expr);
+ return makeNumberNode(globalPtr, ~toInt32(static_cast<NumberNode*>(expr)->value()));
+ return new (GLOBAL_DATA) BitwiseNotNode(GLOBAL_DATA, expr);
}
-static ExpressionNode* makeMultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+static ExpressionNode* makeMultNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{
expr1 = expr1->stripUnaryPlus();
expr2 = expr2->stripUnaryPlus();
if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value());
+ return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value());
if (expr1->isNumber() && static_cast<NumberNode*>(expr1)->value() == 1)
- return new (globalData) UnaryPlusNode(globalData, expr2);
+ return new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, expr2);
if (expr2->isNumber() && static_cast<NumberNode*>(expr2)->value() == 1)
- return new (globalData) UnaryPlusNode(globalData, expr1);
+ return new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, expr1);
- return new (globalData) MultNode(globalData, expr1, expr2, rightHasAssignments);
+ return new (GLOBAL_DATA) MultNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
}
-static ExpressionNode* makeDivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+static ExpressionNode* makeDivNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{
expr1 = expr1->stripUnaryPlus();
expr2 = expr2->stripUnaryPlus();
if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value());
- return new (globalData) DivNode(globalData, expr1, expr2, rightHasAssignments);
+ return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value());
+ return new (GLOBAL_DATA) DivNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
}
-static ExpressionNode* makeAddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+static ExpressionNode* makeAddNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{
if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value());
- return new (globalData) AddNode(globalData, expr1, expr2, rightHasAssignments);
+ return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value());
+ return new (GLOBAL_DATA) AddNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
}
-static ExpressionNode* makeSubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+static ExpressionNode* makeSubNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{
expr1 = expr1->stripUnaryPlus();
expr2 = expr2->stripUnaryPlus();
if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value());
- return new (globalData) SubNode(globalData, expr1, expr2, rightHasAssignments);
+ return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value());
+ return new (GLOBAL_DATA) SubNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
}
-static ExpressionNode* makeLeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+static ExpressionNode* makeLeftShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{
if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
- return new (globalData) LeftShiftNode(globalData, expr1, expr2, rightHasAssignments);
+ 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);
}
-static ExpressionNode* makeRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+static ExpressionNode* makeRightShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{
if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
- return new (globalData) RightShiftNode(globalData, expr1, expr2, rightHasAssignments);
+ 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);
}
-// 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(JSGlobalData* globalData, ExpressionNode* list, ExpressionNode* init)
+static ExpressionNode* combineCommaNodes(void* globalPtr, ExpressionNode* list, ExpressionNode* init)
{
if (!list)
return init;
@@ -2089,15 +2077,17 @@ static ExpressionNode* combineCommaNodes(JSGlobalData* globalData, ExpressionNod
static_cast<CommaNode*>(list)->append(init);
return list;
}
- return new (globalData) CommaNode(globalData, list, init);
+ return new (GLOBAL_DATA) CommaNode(GLOBAL_DATA, 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(JSGlobalData* globalData, ExpressionNode* expr)
+static StatementNode* makeVarStatementNode(void* globalPtr, ExpressionNode* expr)
{
if (!expr)
- return new (globalData) EmptyStatementNode(globalData);
- return new (globalData) VarStatementNode(globalData, expr);
+ return new (GLOBAL_DATA) EmptyStatementNode(GLOBAL_DATA);
+ return new (GLOBAL_DATA) VarStatementNode(GLOBAL_DATA, expr);
}
+
+#undef GLOBAL_DATA
diff --git a/JavaScriptCore/parser/Lexer.cpp b/JavaScriptCore/parser/Lexer.cpp
index febd9a4..8e89c18 100644
--- a/JavaScriptCore/parser/Lexer.cpp
+++ b/JavaScriptCore/parser/Lexer.cpp
@@ -908,107 +908,45 @@ returnError:
return -1;
}
-bool Lexer::scanRegExp(const Identifier*& pattern, const Identifier*& flags, UChar patternPrefix)
+bool Lexer::scanRegExp()
{
ASSERT(m_buffer16.isEmpty());
bool lastWasEscape = false;
bool inBrackets = false;
- if (patternPrefix) {
- ASSERT(!isLineTerminator(patternPrefix));
- ASSERT(patternPrefix != '/');
- ASSERT(patternPrefix != '[');
- record16(patternPrefix);
- }
-
while (true) {
- int current = m_current;
-
- if (isLineTerminator(current) || current == -1) {
- m_buffer16.resize(0);
+ if (isLineTerminator(m_current) || m_current == -1)
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;
+ 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);
+ m_buffer16.resize(0);
+ shift1();
break;
}
+ shift1();
}
- pattern = makeIdentifier(m_buffer16.data(), m_buffer16.size());
- m_buffer16.resize(0);
-
while (isIdentPart(m_current)) {
record16(m_current);
shift1();
}
-
- flags = makeIdentifier(m_buffer16.data(), m_buffer16.size());
+ m_flags = UString(m_buffer16);
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();
@@ -1023,6 +961,9 @@ 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 23c2890..2583162 100644
--- a/JavaScriptCore/parser/Lexer.h
+++ b/JavaScriptCore/parser/Lexer.h
@@ -50,8 +50,9 @@ 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 Identifier*& pattern, const Identifier*& flags, UChar patternPrefix = 0);
- bool skipRegExp();
+ bool scanRegExp();
+ const UString& pattern() const { return m_pattern; }
+ const UString& flags() const { return m_flags; }
// Functions for use after parsing.
bool sawError() const { return m_error; }
@@ -111,6 +112,9 @@ namespace JSC {
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 0052746..780a624 100644
--- a/JavaScriptCore/parser/NodeConstructors.h
+++ b/JavaScriptCore/parser/NodeConstructors.h
@@ -89,7 +89,7 @@ namespace JSC {
{
}
- inline RegExpNode::RegExpNode(JSGlobalData* globalData, const Identifier& pattern, const Identifier& flags)
+ inline RegExpNode::RegExpNode(JSGlobalData* globalData, const UString& pattern, const UString& flags)
: ExpressionNode(globalData)
, m_pattern(pattern)
, m_flags(flags)
@@ -154,13 +154,6 @@ namespace JSC {
{
}
- inline PropertyNode::PropertyNode(JSGlobalData* globalData, double name, ExpressionNode* assign, Type type)
- : m_name(Identifier(globalData, UString::from(name)))
- , m_assign(assign)
- , m_type(type)
- {
- }
-
inline PropertyListNode::PropertyListNode(JSGlobalData* globalData, PropertyNode* node)
: Node(globalData)
, m_node(node)
@@ -821,16 +814,20 @@ 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, ident);
+ m_body->finishParsing(source, parameter);
}
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, ident);
+ m_body->finishParsing(source, parameter);
}
inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr)
diff --git a/JavaScriptCore/parser/Nodes.cpp b/JavaScriptCore/parser/Nodes.cpp
index 11a24b5..4324a06 100644
--- a/JavaScriptCore/parser/Nodes.cpp
+++ b/JavaScriptCore/parser/Nodes.cpp
@@ -138,7 +138,7 @@ RegisterID* StringNode::emitBytecode(BytecodeGenerator& generator, RegisterID* d
RegisterID* RegExpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
{
- RefPtr<RegExp> regExp = RegExp::create(generator.globalData(), m_pattern.ustring(), m_flags.ustring());
+ RefPtr<RegExp> regExp = RegExp::create(generator.globalData(), m_pattern, m_flags);
if (!regExp->isValid())
return emitThrowError(generator, SyntaxError, ("Invalid regular expression: " + UString(regExp->errorMessage())).UTF8String().c_str());
if (dst == generator.ignoredResult())
@@ -1205,13 +1205,7 @@ 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);
@@ -1824,6 +1818,17 @@ ScopeNodeData::ScopeNodeData(ParserArena& arena, SourceElements* children, VarSt
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 -----------------------------
ScopeNode::ScopeNode(JSGlobalData* globalData)
@@ -1881,6 +1886,30 @@ RegisterID* ProgramNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
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)
@@ -1912,6 +1941,54 @@ RegisterID* EvalNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
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);
+}
+
+#if ENABLE(JIT)
+void EvalNode::generateJITCode(ScopeChainNode* scopeChainNode)
+{
+ bytecode(scopeChainNode);
+ ASSERT(m_code);
+ ASSERT(!m_jitCode);
+ JIT::compile(scopeChainNode->globalData, m_code.get());
+ ASSERT(m_jitCode);
+}
+#endif
+
// ------------------------------ FunctionBodyNode -----------------------------
inline FunctionBodyNode::FunctionBodyNode(JSGlobalData* globalData)
@@ -1935,7 +2012,7 @@ FunctionBodyNode::~FunctionBodyNode()
fastFree(m_parameters);
}
-void FunctionBodyNode::finishParsing(const SourceCode& source, ParameterNode* firstParameter, const Identifier& ident)
+void FunctionBodyNode::finishParsing(const SourceCode& source, ParameterNode* firstParameter)
{
Vector<Identifier> parameters;
for (ParameterNode* parameter = firstParameter; parameter; parameter = parameter->nextParam())
@@ -1943,15 +2020,36 @@ void FunctionBodyNode::finishParsing(const SourceCode& source, ParameterNode* fi
size_t count = parameters.size();
setSource(source);
- finishParsing(parameters.releaseBuffer(), count, ident);
+ finishParsing(parameters.releaseBuffer(), count);
}
-void FunctionBodyNode::finishParsing(Identifier* parameters, size_t parameterCount, const Identifier& ident)
+void FunctionBodyNode::finishParsing(Identifier* parameters, size_t parameterCount)
{
ASSERT(!source().isNull());
m_parameters = parameters;
m_parameterCount = parameterCount;
- m_ident = ident;
+}
+
+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;
}
FunctionBodyNode* FunctionBodyNode::create(JSGlobalData* globalData)
@@ -1970,13 +2068,50 @@ PassRefPtr<FunctionBodyNode> FunctionBodyNode::create(JSGlobalData* globalData,
return node.release();
}
-void FunctionBodyNode::reparseDataIfNecessary(ScopeChainNode* scopeChainNode)
+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*)
@@ -2016,6 +2151,11 @@ Identifier* FunctionBodyNode::copyParameters()
// ------------------------------ 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())
@@ -2030,4 +2170,24 @@ 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 58caa19..703b384 100644
--- a/JavaScriptCore/parser/Nodes.h
+++ b/JavaScriptCore/parser/Nodes.h
@@ -39,16 +39,12 @@
namespace JSC {
class ArgumentListNode;
- class BytecodeGenerator;
class CodeBlock;
- class EvalCodeBlock;
- class EvalExecutable;
+ class BytecodeGenerator;
class FuncDeclNode;
- class FunctionBodyNode;
- class FunctionCodeBlock;
+ class EvalCodeBlock;
class JSFunction;
class ProgramCodeBlock;
- class ProgramExecutable;
class PropertyListNode;
class ReadModifyResolveNode;
class RegisterID;
@@ -91,7 +87,7 @@ namespace JSC {
namespace DeclarationStacks {
enum VarAttrs { IsConstant = 1, HasInitializer = 2 };
typedef Vector<std::pair<Identifier, unsigned> > VarStack;
- typedef Vector<FunctionBodyNode*> FunctionStack;
+ typedef Vector<FuncDeclNode*> FunctionStack;
}
struct SwitchInfo {
@@ -361,13 +357,13 @@ namespace JSC {
class RegExpNode : public ExpressionNode, public ThrowableExpressionData {
public:
- RegExpNode(JSGlobalData*, const Identifier& pattern, const Identifier& flags);
+ RegExpNode(JSGlobalData*, const UString& pattern, const UString& flags);
private:
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- Identifier m_pattern;
- Identifier m_flags;
+ UString m_pattern;
+ UString m_flags;
};
class ThisNode : public ExpressionNode {
@@ -433,7 +429,6 @@ namespace JSC {
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; }
@@ -1394,6 +1389,8 @@ namespace JSC {
FunctionStack m_functionStack;
int m_numConstants;
StatementVector m_children;
+
+ void markAggregate(MarkStack&);
};
class ScopeNode : public StatementNode, public ParserArenaRefCounted {
@@ -1439,9 +1436,33 @@ namespace JSC {
return m_data->m_numConstants + 2;
}
+ virtual void markAggregate(MarkStack&) { }
+
+#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
+
protected:
void setSource(const SourceCode& source) { m_source = source; }
+#if ENABLE(JIT)
+ JITCode m_jitCode;
+#endif
+
private:
OwnPtr<ScopeNodeData> m_data;
CodeFeatures m_features;
@@ -1452,32 +1473,78 @@ 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
+
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);
- void partialDestroyData()
+ 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)
{
- // 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();
+ if (!m_jitCode)
+ generateJITCode(scopeChain);
+ return m_jitCode;
}
+#endif
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 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();
@@ -1489,25 +1556,63 @@ namespace JSC {
virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- void finishParsing(const SourceCode&, ParameterNode*, const Identifier& ident);
- void finishParsing(Identifier* parameters, size_t parameterCount, const Identifier& ident);
+ 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);
- const Identifier& ident() { return m_ident; }
+ UString toSourceString() const { return source().toString(); }
- void reparseDataIfNecessary(ScopeChainNode* scopeChainNode);
+ CodeBlock& bytecodeForExceptionInfoReparse(ScopeChainNode*, CodeBlock*);
+#if ENABLE(JIT)
+ JITCode& jitCode(ScopeChainNode* scopeChain)
+ {
+ if (!m_jitCode)
+ generateJITCode(scopeChain);
+ return m_jitCode;
+ }
+#endif
+ 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);
- Identifier m_ident;
+
+ void generateBytecode(ScopeChainNode*);
+#if ENABLE(JIT)
+ void generateJITCode(ScopeChainNode*);
+#endif
Identifier* m_parameters;
size_t m_parameterCount;
+ OwnPtr<CodeBlock> m_code;
};
- class FuncExprNode : public ExpressionNode {
+ class FuncExprNode : public ExpressionNode, public ParserArenaRefCounted {
public:
FuncExprNode(JSGlobalData*, const Identifier&, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter = 0);
+ JSFunction* makeFunction(ExecState*, ScopeChainNode*);
+
FunctionBodyNode* body() { return m_body.get(); }
private:
@@ -1515,13 +1620,18 @@ namespace JSC {
virtual bool isFuncExprNode() const { return true; }
+ Identifier m_ident;
RefPtr<FunctionBodyNode> m_body;
};
- class FuncDeclNode : public StatementNode {
+ class FuncDeclNode : public StatementNode, public ParserArenaRefCounted {
public:
FuncDeclNode(JSGlobalData*, const Identifier&, FunctionBodyNode*, const SourceCode&, ParameterNode* = 0);
+ JSFunction* makeFunction(ExecState*, ScopeChainNode*);
+
+ Identifier m_ident;
+
FunctionBodyNode* body() { return m_body.get(); }
private:
diff --git a/JavaScriptCore/parser/Parser.h b/JavaScriptCore/parser/Parser.h
index 6166bb2..373dc00 100644
--- a/JavaScriptCore/parser/Parser.h
+++ b/JavaScriptCore/parser/Parser.h
@@ -24,8 +24,6 @@
#define Parser_h
#include "Debugger.h"
-#include "Executable.h"
-#include "JSGlobalObject.h"
#include "Nodes.h"
#include "SourceProvider.h"
#include <wtf/Forward.h>
@@ -43,12 +41,9 @@ 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*);
+ 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*);
- PassRefPtr<FunctionBodyNode> parseFunctionFromGlobalCode(ExecState*, Debugger*, const SourceCode&, int* errLine = 0, UString* errMsg = 0);
void didFinishParsing(SourceElements*, ParserArenaData<DeclarationStacks::VarStack>*,
ParserArenaData<DeclarationStacks::FunctionStack>*, CodeFeatures features, int lastLine, int numConstants);
@@ -68,8 +63,7 @@ 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(ExecState* exec, Debugger* debugger, const SourceCode& source, int* errLine, UString* errMsg)
{
m_source = &source;
parse(&exec->globalData(), errLine, errMsg);
@@ -96,8 +90,7 @@ namespace JSC {
return result.release();
}
- template <class ParsedNode>
- PassRefPtr<ParsedNode> Parser::reparse(JSGlobalData* globalData, ParsedNode* oldParsedNode)
+ template <class ParsedNode> PassRefPtr<ParsedNode> Parser::reparse(JSGlobalData* globalData, ParsedNode* oldParsedNode)
{
m_source = &oldParsedNode->source();
parse(globalData, 0, 0);
@@ -122,54 +115,6 @@ namespace JSC {
return result.release();
}
- inline PassRefPtr<FunctionBodyNode> Parser::parseFunctionFromGlobalCode(ExecState* exec, Debugger* debugger, const SourceCode& source, int* errLine, UString* errMsg)
- {
- RefPtr<ProgramNode> program = parse<ProgramNode>(exec, debugger, source, errLine, errMsg);
-
- 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;
-
- RefPtr<FunctionBodyNode> body = static_cast<FuncExprNode*>(funcExpr)->body();
- ASSERT(body);
- return body.release();
- }
-
- inline JSObject* EvalExecutable::parse(ExecState* exec, bool allowDebug)
- {
- int errLine;
- UString errMsg;
- m_node = exec->globalData().parser->parse<EvalNode>(exec, allowDebug ? exec->dynamicGlobalObject()->debugger() : 0, m_source, &errLine, &errMsg);
- if (!m_node)
- return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url());
- return 0;
- }
-
- inline JSObject* ProgramExecutable::parse(ExecState* exec, bool allowDebug)
- {
- int errLine;
- UString errMsg;
- m_node = exec->globalData().parser->parse<ProgramNode>(exec, allowDebug ? exec->dynamicGlobalObject()->debugger() : 0, m_source, &errLine, &errMsg);
- if (!m_node)
- return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url());
- return 0;
- }
-
} // namespace JSC
#endif // Parser_h
diff --git a/JavaScriptCore/profiler/ProfileGenerator.cpp b/JavaScriptCore/profiler/ProfileGenerator.cpp
index dc68ecb..1a061cb 100644
--- a/JavaScriptCore/profiler/ProfileGenerator.cpp
+++ b/JavaScriptCore/profiler/ProfileGenerator.cpp
@@ -27,7 +27,6 @@
#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 4565fe6..e103fd1 100644
--- a/JavaScriptCore/profiler/Profiler.cpp
+++ b/JavaScriptCore/profiler/Profiler.cpp
@@ -31,7 +31,6 @@
#include "CommonIdentifiers.h"
#include "CallFrame.h"
-#include "CodeBlock.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "Nodes.h"
@@ -135,26 +134,26 @@ 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 functionValue, const UString& defaultSourceURL, int defaultLineNumber)
+CallIdentifier Profiler::createCallIdentifier(JSGlobalData* globalData, JSValue function, const UString& defaultSourceURL, int defaultLineNumber)
{
- if (!functionValue)
+ if (!function)
return CallIdentifier(GlobalCodeExecution, defaultSourceURL, defaultLineNumber);
- if (!functionValue.isObject())
+ if (!function.isObject())
return CallIdentifier("(unknown)", defaultSourceURL, defaultLineNumber);
- if (asObject(functionValue)->inherits(&JSFunction::info)) {
- JSFunction* function = asFunction(functionValue);
- if (!function->executable()->isHostFunction())
- return createCallIdentifierFromFunctionImp(globalData, function);
+ if (asObject(function)->inherits(&JSFunction::info)) {
+ JSFunction* func = asFunction(function);
+ if (!func->isHostFunction())
+ return createCallIdentifierFromFunctionImp(globalData, func);
}
- 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);
+ 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);
}
CallIdentifier createCallIdentifierFromFunctionImp(JSGlobalData* globalData, JSFunction* function)
{
const UString& name = function->calculatedDisplayName(globalData);
- return CallIdentifier(name.isEmpty() ? AnonymousFunction : name, function->executable()->sourceURL(), function->executable()->lineNo());
+ return CallIdentifier(name.isEmpty() ? AnonymousFunction : name, function->body()->sourceURL(), function->body()->lineNo());
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/Arguments.h b/JavaScriptCore/runtime/Arguments.h
index 390f7e2..79fe720 100644
--- a/JavaScriptCore/runtime/Arguments.h
+++ b/JavaScriptCore/runtime/Arguments.h
@@ -28,8 +28,6 @@
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "Interpreter.h"
-#include "ObjectConstructor.h"
-#include "PrototypeFunction.h"
namespace JSC {
@@ -116,7 +114,7 @@ namespace JSC {
{
function = callFrame->callee();
- CodeBlock* codeBlock = &function->executable()->generatedBytecode();
+ CodeBlock* codeBlock = &function->body()->generatedBytecode();
int numParameters = codeBlock->m_numParameters;
argc = callFrame->argumentCount();
@@ -139,7 +137,7 @@ namespace JSC {
int numArguments;
getArgumentsData(callFrame, callee, firstParameterIndex, argv, numArguments);
- d->numParameters = callee->executable()->parameterCount();
+ d->numParameters = callee->body()->parameterCount();
d->firstParameterIndex = firstParameterIndex;
d->numArguments = numArguments;
@@ -170,7 +168,7 @@ namespace JSC {
: JSObject(callFrame->lexicalGlobalObject()->argumentsStructure())
, d(new ArgumentsData)
{
- ASSERT(!callFrame->callee()->executable()->parameterCount());
+ ASSERT(!callFrame->callee()->body()->parameterCount());
unsigned numArguments = callFrame->argumentCount() - 1;
@@ -216,8 +214,8 @@ namespace JSC {
{
ASSERT(!d()->registerArray);
- size_t numParametersMinusThis = d()->functionExecutable->generatedBytecode().m_numParameters - 1;
- size_t numVars = d()->functionExecutable->generatedBytecode().m_numVars;
+ size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1;
+ size_t numVars = d()->functionBody->generatedBytecode().m_numVars;
size_t numLocals = numVars + numParametersMinusThis;
if (!numLocals)
diff --git a/JavaScriptCore/runtime/ArrayConstructor.cpp b/JavaScriptCore/runtime/ArrayConstructor.cpp
index c60cb0e..e96bdfc 100644
--- a/JavaScriptCore/runtime/ArrayConstructor.cpp
+++ b/JavaScriptCore/runtime/ArrayConstructor.cpp
@@ -25,19 +25,15 @@
#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, Structure* prototypeFunctionStructure)
+ArrayConstructor::ArrayConstructor(ExecState* exec, PassRefPtr<Structure> structure, ArrayPrototype* arrayPrototype)
: InternalFunction(&exec->globalData(), structure, Identifier(exec, arrayPrototype->classInfo()->className))
{
// ECMA 15.4.3.1 Array.prototype
@@ -45,9 +41,6 @@ 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)
@@ -89,9 +82,4 @@ 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 2b79510..8300d8c 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*, Structure*);
+ ArrayConstructor(ExecState*, PassRefPtr<Structure>, ArrayPrototype*);
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallData(CallData&);
diff --git a/JavaScriptCore/runtime/ArrayPrototype.cpp b/JavaScriptCore/runtime/ArrayPrototype.cpp
index 95d3ffc..807e59a 100644
--- a/JavaScriptCore/runtime/ArrayPrototype.cpp
+++ b/JavaScriptCore/runtime/ArrayPrototype.cpp
@@ -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.functionExecutable->jitCode(callData.js.scopeChain);
- CodeBlock& codeBlock = callData.js.functionExecutable->generatedBytecode();
+ callData.js.functionBody->jitCode(callData.js.scopeChain);
+ CodeBlock& codeBlock = callData.js.functionBody->generatedBytecode();
#else
- CodeBlock& codeBlock = callData.js.functionExecutable->bytecode(callData.js.scopeChain);
+ CodeBlock& codeBlock = callData.js.functionBody->bytecode(callData.js.scopeChain);
#endif
return codeBlock.isNumericCompareFunction();
@@ -144,7 +144,7 @@ static void putProperty(ExecState* exec, JSObject* obj, const Identifier& proper
JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&JSArray::info))
+ if (!thisValue.isObject(&JSArray::info))
return throwError(exec, TypeError);
JSObject* thisObj = asArray(thisValue);
@@ -190,7 +190,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec, JSObject*, JSValue
JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&JSArray::info))
+ if (!thisValue.isObject(&JSArray::info))
return throwError(exec, TypeError);
JSObject* thisObj = asArray(thisValue);
@@ -298,7 +298,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.inherits(&JSArray::info)) {
+ if (curArg.isObject(&JSArray::info)) {
unsigned length = curArg.get(exec, exec->propertyNames().length).toUInt32(exec);
JSObject* curObject = curArg.toObject(exec);
for (unsigned k = 0; k < length; ++k) {
diff --git a/JavaScriptCore/runtime/BooleanObject.h b/JavaScriptCore/runtime/BooleanObject.h
index 1361e46..cfd55fe 100644
--- a/JavaScriptCore/runtime/BooleanObject.h
+++ b/JavaScriptCore/runtime/BooleanObject.h
@@ -31,11 +31,6 @@ namespace JSC {
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));
- }
};
BooleanObject* asBooleanObject(JSValue);
diff --git a/JavaScriptCore/runtime/BooleanPrototype.cpp b/JavaScriptCore/runtime/BooleanPrototype.cpp
index cf4fbd7..703a568 100644
--- a/JavaScriptCore/runtime/BooleanPrototype.cpp
+++ b/JavaScriptCore/runtime/BooleanPrototype.cpp
@@ -59,7 +59,7 @@ JSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec, JSObject*, JSVal
if (thisValue == jsBoolean(true))
return jsNontrivialString(exec, "true");
- if (!thisValue.inherits(&BooleanObject::info))
+ if (!thisValue.isObject(&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.inherits(&BooleanObject::info))
+ if (!thisValue.isObject(&BooleanObject::info))
return throwError(exec, TypeError);
return asBooleanObject(thisValue)->internalValue();
diff --git a/JavaScriptCore/runtime/CallData.h b/JavaScriptCore/runtime/CallData.h
index 24c19f9..d5b0172 100644
--- a/JavaScriptCore/runtime/CallData.h
+++ b/JavaScriptCore/runtime/CallData.h
@@ -35,7 +35,7 @@ namespace JSC {
class ArgList;
class ExecState;
- class FunctionExecutable;
+ class FunctionBodyNode;
class JSObject;
class JSValue;
class ScopeChainNode;
@@ -53,7 +53,7 @@ namespace JSC {
NativeFunction function;
} native;
struct {
- FunctionExecutable* functionExecutable;
+ FunctionBodyNode* functionBody;
ScopeChainNode* scopeChain;
} js;
};
diff --git a/JavaScriptCore/runtime/Collector.cpp b/JavaScriptCore/runtime/Collector.cpp
index f48e243..c188016 100644
--- a/JavaScriptCore/runtime/Collector.cpp
+++ b/JavaScriptCore/runtime/Collector.cpp
@@ -23,10 +23,8 @@
#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"
@@ -61,16 +59,10 @@
#include <windows.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)
@@ -83,13 +75,6 @@
#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
@@ -501,33 +486,6 @@ 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)
@@ -553,8 +511,6 @@ 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);
@@ -573,10 +529,6 @@ 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;
@@ -1139,8 +1091,8 @@ bool Heap::collect()
markStack.append(m_globalData->exception);
m_globalData->interpreter->registerFile().markCallFrames(markStack, this);
m_globalData->smallStrings.mark();
- if (m_globalData->functionCodeBlockBeingReparsed)
- m_globalData->functionCodeBlockBeingReparsed->markAggregate(markStack);
+ if (m_globalData->scopeNodeBeingReparsed)
+ m_globalData->scopeNodeBeingReparsed->markAggregate(markStack);
if (m_globalData->firstStringifierToMark)
JSONObject::markStringifiers(markStack, m_globalData->firstStringifierToMark);
diff --git a/JavaScriptCore/runtime/CommonIdentifiers.h b/JavaScriptCore/runtime/CommonIdentifiers.h
index 678e109..148d3dd 100644
--- a/JavaScriptCore/runtime/CommonIdentifiers.h
+++ b/JavaScriptCore/runtime/CommonIdentifiers.h
@@ -47,7 +47,6 @@
macro(ignoreCase) \
macro(index) \
macro(input) \
- macro(isArray) \
macro(isPrototypeOf) \
macro(length) \
macro(message) \
diff --git a/JavaScriptCore/runtime/Completion.cpp b/JavaScriptCore/runtime/Completion.cpp
index 6ae5aa2..b8b1581 100644
--- a/JavaScriptCore/runtime/Completion.cpp
+++ b/JavaScriptCore/runtime/Completion.cpp
@@ -41,27 +41,30 @@ Completion checkSyntax(ExecState* exec, const SourceCode& source)
{
JSLock lock(exec);
- ProgramExecutable program(source);
- JSObject* error = program.parse(exec);
- if (error)
- return Completion(Throw, error);
+ int errLine;
+ UString errMsg;
+ 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);
- ProgramExecutable program(source);
- JSObject* error = program.parse(exec);
- if (error)
- return Completion(Throw, error);
+ if (!programNode)
+ return Completion(Throw, Error::create(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url()));
JSObject* thisObj = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec);
JSValue exception;
- JSValue result = exec->interpreter()->execute(&program, exec, scopeChain.node(), thisObj, &exception);
+ JSValue result = exec->interpreter()->execute(programNode.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 6b954a6..9d580d5 100644
--- a/JavaScriptCore/runtime/ConstructData.h
+++ b/JavaScriptCore/runtime/ConstructData.h
@@ -33,7 +33,7 @@ namespace JSC {
class ArgList;
class ExecState;
- class FunctionExecutable;
+ class FunctionBodyNode;
class JSObject;
class JSValue;
class ScopeChainNode;
@@ -51,7 +51,7 @@ namespace JSC {
NativeConstructor function;
} native;
struct {
- FunctionExecutable* functionExecutable;
+ FunctionBodyNode* functionBody;
ScopeChainNode* scopeChain;
} js;
};
diff --git a/JavaScriptCore/runtime/DateConstructor.cpp b/JavaScriptCore/runtime/DateConstructor.cpp
index 1879c3f..2f52cff 100644
--- a/JavaScriptCore/runtime/DateConstructor.cpp
+++ b/JavaScriptCore/runtime/DateConstructor.cpp
@@ -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).inherits(&DateInstance::info))
+ if (args.at(0).isObject(&DateInstance::info))
value = asDateInstance(args.at(0))->internalNumber();
else {
JSValue primitive = args.at(0).toPrimitive(exec);
diff --git a/JavaScriptCore/runtime/DatePrototype.cpp b/JavaScriptCore/runtime/DatePrototype.cpp
index 54d3cf3..e2482f4 100644
--- a/JavaScriptCore/runtime/DatePrototype.cpp
+++ b/JavaScriptCore/runtime/DatePrototype.cpp
@@ -411,7 +411,7 @@ bool DatePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& proper
JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -428,7 +428,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec, JSObject*, JSValue
JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -445,7 +445,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSVal
JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -467,7 +467,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSVal
JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -484,7 +484,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec, JSObject*, JSVa
JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -501,7 +501,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.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -514,7 +514,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.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -527,7 +527,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec, JSObject*
JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -540,7 +540,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject*
JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -553,7 +553,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.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -570,7 +570,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSVal
JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -587,7 +587,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JS
JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -604,7 +604,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSVal
JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -621,7 +621,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue
JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -638,7 +638,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSVal
JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -655,7 +655,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.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -672,7 +672,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValu
JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -689,7 +689,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.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -706,7 +706,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValue
JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -723,7 +723,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue
JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -740,7 +740,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSVal
JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -757,7 +757,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValu
JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -774,7 +774,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSV
JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -791,7 +791,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValu
JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -808,7 +808,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSV
JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -823,7 +823,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, J
JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -838,7 +838,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject*
JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -855,7 +855,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*,
JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
- if (!thisValue.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -868,7 +868,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.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -899,7 +899,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.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -1020,7 +1020,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.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -1062,7 +1062,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.inherits(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
diff --git a/JavaScriptCore/runtime/Error.cpp b/JavaScriptCore/runtime/Error.cpp
index ddd4bc4..db1d8cc 100644
--- a/JavaScriptCore/runtime/Error.cpp
+++ b/JavaScriptCore/runtime/Error.cpp
@@ -97,12 +97,6 @@ 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 e959cff..adf7fdf 100644
--- a/JavaScriptCore/runtime/Error.h
+++ b/JavaScriptCore/runtime/Error.h
@@ -59,7 +59,6 @@ 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/ExceptionHelpers.cpp b/JavaScriptCore/runtime/ExceptionHelpers.cpp
index cc18b95..e63594c 100644
--- a/JavaScriptCore/runtime/ExceptionHelpers.cpp
+++ b/JavaScriptCore/runtime/ExceptionHelpers.cpp
@@ -74,7 +74,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->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
+ JSObject* exception = Error::create(exec, ReferenceError, message, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->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 +136,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->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
+ JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->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 +157,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->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
+ JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->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 +171,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->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
+ JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->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 +201,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->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
+ JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->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/Executable.cpp b/JavaScriptCore/runtime/Executable.cpp
deleted file mode 100644
index 053dbfb..0000000
--- a/JavaScriptCore/runtime/Executable.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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"
-
-namespace JSC {
-
-EvalExecutable::~EvalExecutable()
-{
- delete m_evalCodeBlock;
-}
-
-ProgramExecutable::~ProgramExecutable()
-{
- delete m_programCodeBlock;
-}
-
-FunctionExecutable::~FunctionExecutable()
-{
- delete m_codeBlock;
-}
-
-void EvalExecutable::generateBytecode(ScopeChainNode* scopeChainNode)
-{
- 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(), globalObject->debugger(), scopeChain, &m_evalCodeBlock->symbolTable(), m_evalCodeBlock));
- generator->generate();
-
- evalNode()->partialDestroyData();
-}
-
-void ProgramExecutable::generateBytecode(ScopeChainNode* scopeChainNode)
-{
- 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(), globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock));
- generator->generate();
-
- programNode()->destroyData();
-}
-
-void FunctionExecutable::generateBytecode(ScopeChainNode* scopeChainNode)
-{
- body()->reparseDataIfNecessary(scopeChainNode);
-
- 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(), globalObject->debugger(), scopeChain, &m_codeBlock->symbolTable(), m_codeBlock));
- generator->generate();
-
- body()->destroyData();
-}
-
-#if ENABLE(JIT)
-
-void EvalExecutable::generateJITCode(ScopeChainNode* scopeChainNode)
-{
- CodeBlock* codeBlock = &bytecode(scopeChainNode);
- m_jitCode = JIT::compile(scopeChainNode->globalData, codeBlock);
-
-#if !ENABLE(OPCODE_SAMPLING)
- if (!BytecodeGenerator::dumpsGeneratedCode())
- codeBlock->discardBytecode();
-#endif
-}
-
-void ProgramExecutable::generateJITCode(ScopeChainNode* scopeChainNode)
-{
- CodeBlock* codeBlock = &bytecode(scopeChainNode);
- m_jitCode = JIT::compile(scopeChainNode->globalData, codeBlock);
-
-#if !ENABLE(OPCODE_SAMPLING)
- if (!BytecodeGenerator::dumpsGeneratedCode())
- codeBlock->discardBytecode();
-#endif
-}
-
-void FunctionExecutable::generateJITCode(ScopeChainNode* scopeChainNode)
-{
- CodeBlock* codeBlock = &bytecode(scopeChainNode);
- m_jitCode = JIT::compile(scopeChainNode->globalData, codeBlock);
-
-#if !ENABLE(OPCODE_SAMPLING)
- if (!BytecodeGenerator::dumpsGeneratedCode())
- codeBlock->discardBytecode();
-#endif
-}
-
-#endif
-
-bool FunctionExecutable::isHostFunction() const
-{
- return m_codeBlock && m_codeBlock->codeType() == NativeCode;
-}
-
-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->reparse<FunctionBodyNode>(globalData, body());
- ASSERT(newFunctionBody);
- newFunctionBody->finishParsing(body()->copyParameters(), body()->parameterCount(), body()->ident());
-
- 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->reparse<EvalNode>(globalData, evalNode());
-
- 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* exec)
-{
- FunctionBodyNode* oldBody = body();
- RefPtr<FunctionBodyNode> newBody = exec->globalData().parser->parse<FunctionBodyNode>(exec, 0, m_source);
- ASSERT(newBody);
- newBody->finishParsing(oldBody->copyParameters(), oldBody->parameterCount(), oldBody->ident());
- m_node = newBody;
- delete m_codeBlock;
- m_codeBlock = 0;
-#if ENABLE(JIT)
- m_jitCode = JITCode();
-#endif
-}
-
-#if ENABLE(JIT)
-FunctionExecutable::FunctionExecutable(ExecState* exec)
- : m_codeBlock(new NativeCodeBlock(this))
- , m_name(Identifier(exec, "<native thunk>"))
-{
- m_jitCode = JITCode(JITCode::HostFunction(exec->globalData().jitStubs.ctiNativeCallThunk()));
-}
-#endif
-
-};
-
-
diff --git a/JavaScriptCore/runtime/Executable.h b/JavaScriptCore/runtime/Executable.h
deleted file mode 100644
index 29288df..0000000
--- a/JavaScriptCore/runtime/Executable.h
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * 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 "Nodes.h"
-
-namespace JSC {
-
- class CodeBlock;
- class EvalCodeBlock;
- class ProgramCodeBlock;
- class ScopeChainNode;
-
- struct ExceptionInfo;
-
- class ExecutableBase {
- friend class JIT;
- public:
- virtual ~ExecutableBase() {}
-
- ExecutableBase(const SourceCode& source)
- : m_source(source)
- {
- }
-
- const SourceCode& source() { return m_source; }
- intptr_t sourceID() const { return m_node->sourceID(); }
- const UString& sourceURL() const { return m_node->sourceURL(); }
- int lineNo() const { return m_node->lineNo(); }
- int lastLine() const { return m_node->lastLine(); }
-
- bool usesEval() const { return m_node->usesEval(); }
- bool usesArguments() const { return m_node->usesArguments(); }
- bool needsActivation() const { return m_node->needsActivation(); }
-
- virtual ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*) = 0;
-
- ScopeNode* astNode() { return m_node.get(); }
-
- protected:
- RefPtr<ScopeNode> m_node;
- SourceCode m_source;
-
- private:
- // For use making native thunk.
- friend class FunctionExecutable;
- ExecutableBase()
- {
- }
-
-#if ENABLE(JIT)
- public:
- JITCode& generatedJITCode()
- {
- ASSERT(m_jitCode);
- return m_jitCode;
- }
-
- ExecutablePool* getExecutablePool()
- {
- return m_jitCode.getExecutablePool();
- }
-
- protected:
- JITCode m_jitCode;
-#endif
- };
-
- class EvalExecutable : public ExecutableBase {
- public:
- EvalExecutable(const SourceCode& source)
- : ExecutableBase(source)
- , m_evalCodeBlock(0)
- {
- }
-
- ~EvalExecutable();
-
- JSObject* parse(ExecState* exec, bool allowDebug = true);
-
- EvalCodeBlock& bytecode(ScopeChainNode* scopeChainNode)
- {
- if (!m_evalCodeBlock)
- generateBytecode(scopeChainNode);
- return *m_evalCodeBlock;
- }
-
- DeclarationStacks::VarStack& varStack() { return m_node->varStack(); }
-
- ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*);
-
- private:
- EvalNode* evalNode() { return static_cast<EvalNode*>(m_node.get()); }
-
- void generateBytecode(ScopeChainNode*);
-
- EvalCodeBlock* m_evalCodeBlock;
-
-#if ENABLE(JIT)
- public:
- JITCode& jitCode(ScopeChainNode* scopeChainNode)
- {
- if (!m_jitCode)
- generateJITCode(scopeChainNode);
- return m_jitCode;
- }
-
- private:
- void generateJITCode(ScopeChainNode*);
-#endif
- };
-
- class CacheableEvalExecutable : public EvalExecutable, public RefCounted<CacheableEvalExecutable> {
- public:
- static PassRefPtr<CacheableEvalExecutable> create(const SourceCode& source) { return adoptRef(new CacheableEvalExecutable(source)); }
-
- private:
- CacheableEvalExecutable(const SourceCode& source)
- : EvalExecutable(source)
- {
- }
- };
-
- class ProgramExecutable : public ExecutableBase {
- public:
- ProgramExecutable(const SourceCode& source)
- : ExecutableBase(source)
- , m_programCodeBlock(0)
- {
- }
-
- ~ProgramExecutable();
-
- JSObject* parse(ExecState* exec, bool allowDebug = true);
-
- // CodeBlocks for program code are transient and therefore to not gain from from throwing out there exception information.
- ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*) { ASSERT_NOT_REACHED(); return 0; }
-
- ProgramCodeBlock& bytecode(ScopeChainNode* scopeChainNode)
- {
- if (!m_programCodeBlock)
- generateBytecode(scopeChainNode);
- return *m_programCodeBlock;
- }
-
- private:
- ProgramNode* programNode() { return static_cast<ProgramNode*>(m_node.get()); }
-
- void generateBytecode(ScopeChainNode*);
-
- ProgramCodeBlock* m_programCodeBlock;
-
-#if ENABLE(JIT)
- public:
- JITCode& jitCode(ScopeChainNode* scopeChainNode)
- {
- if (!m_jitCode)
- generateJITCode(scopeChainNode);
- return m_jitCode;
- }
-
- private:
- void generateJITCode(ScopeChainNode*);
-#endif
- };
-
- class FunctionExecutable : public ExecutableBase, public RefCounted<FunctionExecutable> {
- friend class JIT;
- public:
- FunctionExecutable(const Identifier& name, FunctionBodyNode* body)
- : ExecutableBase(body->source())
- , m_codeBlock(0)
- , m_name(name)
- {
- m_node = body;
- }
-
- ~FunctionExecutable();
-
- const Identifier& name() { return m_name; }
-
- JSFunction* make(ExecState* exec, ScopeChainNode* scopeChain);
-
- CodeBlock& bytecode(ScopeChainNode* scopeChainNode)
- {
- ASSERT(scopeChainNode);
- if (!m_codeBlock)
- generateBytecode(scopeChainNode);
- return *m_codeBlock;
- }
- CodeBlock& generatedBytecode()
- {
- ASSERT(m_codeBlock);
- return *m_codeBlock;
- }
-
- bool usesEval() const { return body()->usesEval(); }
- bool usesArguments() const { return body()->usesArguments(); }
- size_t parameterCount() const { return body()->parameterCount(); }
- UString paramString() const { return body()->paramString(); }
-
- bool isHostFunction() const;
- bool isGenerated() const
- {
- return m_codeBlock;
- }
-
- void recompile(ExecState* exec);
-
- ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*);
-
- void markAggregate(MarkStack& markStack);
-
- private:
- FunctionBodyNode* body() const { return static_cast<FunctionBodyNode*>(m_node.get()); }
-
- void generateBytecode(ScopeChainNode*);
-
- CodeBlock* m_codeBlock;
- const Identifier& m_name;
-
-#if ENABLE(JIT)
- public:
- JITCode& jitCode(ScopeChainNode* scopeChainNode)
- {
- if (!m_jitCode)
- generateJITCode(scopeChainNode);
- return m_jitCode;
- }
-
- static PassRefPtr<FunctionExecutable> createNativeThunk(ExecState* exec)
- {
- return adoptRef(new FunctionExecutable(exec));
- }
-
- private:
- FunctionExecutable(ExecState* exec);
- void generateJITCode(ScopeChainNode*);
-#endif
- };
-
-};
-
-#endif
diff --git a/JavaScriptCore/runtime/FunctionConstructor.cpp b/JavaScriptCore/runtime/FunctionConstructor.cpp
index 2783b35..f4f5cc8 100644
--- a/JavaScriptCore/runtime/FunctionConstructor.cpp
+++ b/JavaScriptCore/runtime/FunctionConstructor.cpp
@@ -66,6 +66,32 @@ 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)
{
@@ -87,13 +113,15 @@ JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifi
int errLine;
UString errMsg;
SourceCode source = makeSource(program, sourceURL, lineNumber);
- RefPtr<FunctionBodyNode> body = exec->globalData().parser->parseFunctionFromGlobalCode(exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);
+ RefPtr<ProgramNode> programNode = exec->globalData().parser->parse<ProgramNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);
+
+ FunctionBodyNode* body = extractFunctionBody(programNode.get());
if (!body)
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, adoptRef(new FunctionExecutable(functionName, body.get())), scopeChain.node());
+ return new (exec) JSFunction(exec, functionName, body, scopeChain.node());
}
// ECMA 15.3.2 The Function Constructor
diff --git a/JavaScriptCore/runtime/FunctionConstructor.h b/JavaScriptCore/runtime/FunctionConstructor.h
index e8486dc..124b354 100644
--- a/JavaScriptCore/runtime/FunctionConstructor.h
+++ b/JavaScriptCore/runtime/FunctionConstructor.h
@@ -26,6 +26,8 @@
namespace JSC {
class FunctionPrototype;
+ class ProgramNode;
+ class FunctionBodyNode;
class FunctionConstructor : public InternalFunction {
public:
@@ -39,6 +41,8 @@ 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 d911f2f..9ba2144 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, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 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
@@ -84,17 +84,16 @@ static inline void insertSemicolonIfNeeded(UString& functionBody)
JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (thisValue.inherits(&JSFunction::info)) {
+ if (thisValue.isObject(&JSFunction::info)) {
JSFunction* function = asFunction(thisValue);
- FunctionExecutable* executable = function->executable();
- if (!executable->isHostFunction()) {
- UString sourceString = executable->source().toString();
- insertSemicolonIfNeeded(sourceString);
- return jsString(exec, "function " + function->name(&exec->globalData()) + "(" + executable->paramString() + ") " + sourceString);
+ if (!function->isHostFunction()) {
+ UString functionBody = function->body()->toSourceString();
+ insertSemicolonIfNeeded(functionBody);
+ return jsString(exec, "function " + function->name(&exec->globalData()) + "(" + function->body()->paramString() + ") " + functionBody);
}
}
- if (thisValue.inherits(&InternalFunction::info)) {
+ if (thisValue.isObject(&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 4f674f5..607ddab 100644
--- a/JavaScriptCore/runtime/FunctionPrototype.h
+++ b/JavaScriptCore/runtime/FunctionPrototype.h
@@ -34,7 +34,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark));
+ return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot));
}
private:
diff --git a/JavaScriptCore/runtime/InternalFunction.h b/JavaScriptCore/runtime/InternalFunction.h
index 37077f6..310644c 100644
--- a/JavaScriptCore/runtime/InternalFunction.h
+++ b/JavaScriptCore/runtime/InternalFunction.h
@@ -42,7 +42,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot | HasDefaultMark));
+ return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot));
}
protected:
diff --git a/JavaScriptCore/runtime/JSAPIValueWrapper.h b/JavaScriptCore/runtime/JSAPIValueWrapper.h
index 5cd4bdd..21a9710 100644
--- a/JavaScriptCore/runtime/JSAPIValueWrapper.h
+++ b/JavaScriptCore/runtime/JSAPIValueWrapper.h
@@ -54,7 +54,6 @@ 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 d025abb..87adbcd 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<FunctionExecutable> functionExecutable)
- : Base(callFrame->globalData().activationStructure, new JSActivationData(functionExecutable, callFrame->registers()))
+JSActivation::JSActivation(CallFrame* callFrame, PassRefPtr<FunctionBodyNode> functionBody)
+ : Base(callFrame->globalData().activationStructure, new JSActivationData(functionBody, callFrame->registers()))
{
}
@@ -57,12 +57,12 @@ void JSActivation::markChildren(MarkStack& markStack)
if (!registerArray)
return;
- size_t numParametersMinusThis = d()->functionExecutable->generatedBytecode().m_numParameters - 1;
+ size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1;
size_t count = numParametersMinusThis;
markStack.appendValues(registerArray, count);
- size_t numVars = d()->functionExecutable->generatedBytecode().m_numVars;
+ size_t numVars = d()->functionBody->generatedBytecode().m_numVars;
// 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()->functionExecutable->usesEval();
+ return d()->functionBody->usesEval();
}
JSValue JSActivation::argumentsGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
JSActivation* activation = asActivation(slot.slotBase());
- if (activation->d()->functionExecutable->usesArguments()) {
+ if (activation->d()->functionBody->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->inherits(&Arguments::info));
+ ASSERT(arguments->isObject(&Arguments::info));
return arguments;
}
diff --git a/JavaScriptCore/runtime/JSActivation.h b/JavaScriptCore/runtime/JSActivation.h
index 285ae67..6a08439 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<FunctionExecutable>);
+ JSActivation(CallFrame*, PassRefPtr<FunctionBodyNode>);
virtual ~JSActivation();
virtual void markChildren(MarkStack&);
@@ -70,13 +70,13 @@ namespace JSC {
private:
struct JSActivationData : public JSVariableObjectData {
- JSActivationData(PassRefPtr<FunctionExecutable> functionExecutable, Register* registers)
- : JSVariableObjectData(&functionExecutable->generatedBytecode().symbolTable(), registers)
- , functionExecutable(functionExecutable)
+ JSActivationData(PassRefPtr<FunctionBodyNode> functionBody, Register* registers)
+ : JSVariableObjectData(&functionBody->generatedBytecode().symbolTable(), registers)
+ , functionBody(functionBody)
{
}
- RefPtr<FunctionExecutable> functionExecutable;
+ RefPtr<FunctionBodyNode> functionBody;
};
static JSValue argumentsGetter(ExecState*, const Identifier&, const PropertySlot&);
diff --git a/JavaScriptCore/runtime/JSArray.cpp b/JavaScriptCore/runtime/JSArray.cpp
index 90e0434..7d7d4c4 100644
--- a/JavaScriptCore/runtime/JSArray.cpp
+++ b/JavaScriptCore/runtime/JSArray.cpp
@@ -25,7 +25,6 @@
#include "ArrayPrototype.h"
#include "CachedCall.h"
-#include "Error.h"
#include "PropertyNameArray.h"
#include <wtf/AVLTree.h>
#include <wtf/Assertions.h>
@@ -349,7 +348,8 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu
}
}
- if (!tryFastRealloc(storage, storageSize(newVectorLength)).getValue(storage)) {
+ storage = static_cast<ArrayStorage*>(tryFastRealloc(storage, storageSize(newVectorLength)));
+ if (!storage) {
throwOutOfMemoryError(exec);
return;
}
@@ -467,7 +467,8 @@ bool JSArray::increaseVectorLength(unsigned newLength)
ASSERT(newLength <= MAX_STORAGE_VECTOR_INDEX);
unsigned newVectorLength = increasedVectorLength(newLength);
- if (!tryFastRealloc(storage, storageSize(newVectorLength)).getValue(storage))
+ storage = static_cast<ArrayStorage*>(tryFastRealloc(storage, storageSize(newVectorLength)));
+ if (!storage)
return false;
Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength));
@@ -602,7 +603,18 @@ void JSArray::push(ExecState* exec, JSValue value)
void JSArray::markChildren(MarkStack& markStack)
{
- markChildrenDirect(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);
+ }
}
static int compareNumbersForQSort(const void* a, const void* b)
diff --git a/JavaScriptCore/runtime/JSArray.h b/JavaScriptCore/runtime/JSArray.h
index 88d8ee4..49df6c4 100644
--- a/JavaScriptCore/runtime/JSArray.h
+++ b/JavaScriptCore/runtime/JSArray.h
@@ -82,8 +82,6 @@ namespace JSC {
{
return Structure::create(prototype, TypeInfo(ObjectType));
}
-
- inline void markChildrenDirect(MarkStack& markStack);
protected:
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
@@ -127,77 +125,6 @@ namespace JSC {
inline bool isJSArray(JSGlobalData* globalData, JSValue v) { return v.isCell() && v.asCell()->vptr() == globalData->jsArrayVPtr; }
- void JSArray::markChildrenDirect(MarkStack& markStack) {
- JSObject::markChildrenDirect(markStack);
-
- ArrayStorage* storage = m_storage;
-
- unsigned usedVectorLength = std::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);
- }
- }
-
- 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 v = *current.m_values;
- current.m_values++;
-
- if (!v || v.marked()) {
- if (current.m_values == end) {
- m_markSets.removeLast();
- continue;
- }
- goto findNextUnmarkedNullValue;
- }
-
- JSCell* currentCell = v.asCell();
- currentCell->markCellDirect();
- if (currentCell->structure()->typeInfo().type() < CompoundType) {
- if (current.m_values == end) {
- m_markSets.removeLast();
- continue;
- }
- goto findNextUnmarkedNullValue;
- }
-
- if (current.m_values == end)
- m_markSets.removeLast();
-
- if (currentCell->structure()->typeInfo().hasDefaultMark())
- static_cast<JSObject*>(currentCell)->markChildrenDirect(*this);
- else if (currentCell->vptr() == m_jsArrayVPtr)
- static_cast<JSArray*>(currentCell)->markChildrenDirect(*this);
- else
- currentCell->markChildren(*this);
- }
- while (!m_values.isEmpty()) {
- JSCell* current = m_values.removeLast();
- ASSERT(current->marked());
- if (current->structure()->typeInfo().hasDefaultMark())
- static_cast<JSObject*>(current)->markChildrenDirect(*this);
- else if (current->vptr() == m_jsArrayVPtr)
- static_cast<JSArray*>(current)->markChildrenDirect(*this);
- else
- current->markChildren(*this);
- }
- }
- }
-
} // namespace JSC
#endif // JSArray_h
diff --git a/JavaScriptCore/runtime/JSByteArray.cpp b/JavaScriptCore/runtime/JSByteArray.cpp
index f832578..2a5e72f 100644
--- a/JavaScriptCore/runtime/JSByteArray.cpp
+++ b/JavaScriptCore/runtime/JSByteArray.cpp
@@ -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, HasDefaultMark));
+ PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType));
return result;
}
diff --git a/JavaScriptCore/runtime/JSCell.h b/JavaScriptCore/runtime/JSCell.h
index 485ad2e..75ccf7f 100644
--- a/JavaScriptCore/runtime/JSCell.h
+++ b/JavaScriptCore/runtime/JSCell.h
@@ -55,7 +55,7 @@ namespace JSC {
bool isString() const;
bool isObject() const;
virtual bool isGetterSetter() const;
- bool inherits(const ClassInfo*) const;
+ virtual bool isObject(const ClassInfo*) const;
virtual bool isAPIValueWrapper() const { return false; }
Structure* structure() const;
@@ -379,6 +379,30 @@ namespace JSC {
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);
+ }
+ }
+ }
} // namespace JSC
#endif // JSCell_h
diff --git a/JavaScriptCore/runtime/JSFunction.cpp b/JavaScriptCore/runtime/JSFunction.cpp
index f8e3d82..84c6263 100644
--- a/JavaScriptCore/runtime/JSFunction.cpp
+++ b/JavaScriptCore/runtime/JSFunction.cpp
@@ -45,26 +45,12 @@ ASSERT_CLASS_FITS_IN_CELL(JSFunction);
const ClassInfo JSFunction::info = { "Function", &InternalFunction::info, 0, 0 };
-inline bool JSFunction::isHostFunction() const
-{
- return m_executable && m_executable->isHostFunction();
-}
-
-bool JSFunction::isHostFunctionNonInline() const
-{
- return isHostFunction();
-}
-
-JSFunction::JSFunction(PassRefPtr<Structure> structure)
- : Base(structure)
-{
- clearScopeChain();
-}
-
JSFunction::JSFunction(ExecState* exec, PassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func)
: Base(&exec->globalData(), structure, name)
#if ENABLE(JIT)
- , m_executable(FunctionExecutable::createNativeThunk(exec))
+ , m_body(FunctionBodyNode::createNativeThunk(&exec->globalData()))
+#else
+ , m_body(0)
#endif
{
#if ENABLE(JIT)
@@ -77,9 +63,9 @@ JSFunction::JSFunction(ExecState* exec, PassRefPtr<Structure> structure, int len
#endif
}
-JSFunction::JSFunction(ExecState* exec, PassRefPtr<FunctionExecutable> executable, ScopeChainNode* scopeChainNode)
- : Base(&exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), executable->name())
- , m_executable(executable)
+JSFunction::JSFunction(ExecState* exec, const Identifier& name, FunctionBodyNode* body, ScopeChainNode* scopeChainNode)
+ : Base(&exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), name)
+ , m_body(body)
{
setScopeChain(scopeChainNode);
}
@@ -90,8 +76,8 @@ JSFunction::~JSFunction()
// 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 ENABLE(JIT_OPTIMIZE_CALL)
- if (m_executable && m_executable->isGenerated())
- m_executable->generatedBytecode().unlinkCallers();
+ if (m_body && m_body->isGenerated())
+ m_body->generatedBytecode().unlinkCallers();
#endif
if (!isHostFunction())
scopeChain().~ScopeChain(); // FIXME: Don't we need to do this in the interpreter too?
@@ -100,7 +86,7 @@ JSFunction::~JSFunction()
void JSFunction::markChildren(MarkStack& markStack)
{
Base::markChildren(markStack);
- m_executable->markAggregate(markStack);
+ m_body->markAggregate(markStack);
if (!isHostFunction())
scopeChain().markAggregate(markStack);
}
@@ -111,7 +97,7 @@ CallType JSFunction::getCallData(CallData& callData)
callData.native.function = nativeFunction();
return CallTypeHost;
}
- callData.js.functionExecutable = m_executable.get();
+ callData.js.functionBody = m_body.get();
callData.js.scopeChain = scopeChain().node();
return CallTypeJS;
}
@@ -119,7 +105,7 @@ CallType JSFunction::getCallData(CallData& callData)
JSValue JSFunction::call(ExecState* exec, JSValue thisValue, const ArgList& args)
{
ASSERT(!isHostFunction());
- return exec->interpreter()->execute(m_executable.get(), exec, this, thisValue.toThisObject(exec), args, scopeChain().node(), exec->exceptionSlot());
+ return exec->interpreter()->execute(m_body.get(), exec, this, thisValue.toThisObject(exec), args, scopeChain().node(), exec->exceptionSlot());
}
JSValue JSFunction::argumentsGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
@@ -140,7 +126,7 @@ JSValue JSFunction::lengthGetter(ExecState* exec, const Identifier&, const Prope
{
JSFunction* thisObj = asFunction(slot.slotBase());
ASSERT(!thisObj->isHostFunction());
- return jsNumber(exec, thisObj->m_executable->parameterCount());
+ return jsNumber(exec, thisObj->m_body->parameterCount());
}
bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
@@ -204,7 +190,7 @@ ConstructType JSFunction::getConstructData(ConstructData& constructData)
{
if (isHostFunction())
return ConstructTypeNone;
- constructData.js.functionExecutable = m_executable.get();
+ constructData.js.functionBody = m_body.get();
constructData.js.scopeChain = scopeChain().node();
return ConstructTypeJS;
}
@@ -220,7 +206,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_executable.get(), exec, this, thisObj, args, scopeChain().node(), exec->exceptionSlot());
+ JSValue result = exec->interpreter()->execute(m_body.get(), 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 71998dc..cab1e5b 100644
--- a/JavaScriptCore/runtime/JSFunction.h
+++ b/JavaScriptCore/runtime/JSFunction.h
@@ -24,11 +24,15 @@
#ifndef JSFunction_h
#define JSFunction_h
-#include "Executable.h"
#include "InternalFunction.h"
+#include "JSVariableObject.h"
+#include "SymbolTable.h"
+#include "Nodes.h"
+#include "JSObject.h"
namespace JSC {
+ class FunctionBodyNode;
class FunctionPrototype;
class JSActivation;
class JSGlobalObject;
@@ -39,10 +43,20 @@ namespace JSC {
typedef InternalFunction Base;
+ JSFunction(PassRefPtr<Structure> structure)
+ : InternalFunction(structure)
+ {
+ clearScopeChain();
+ }
+
public:
JSFunction(ExecState*, PassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
- JSFunction(ExecState*, PassRefPtr<FunctionExecutable>, ScopeChainNode*);
- virtual ~JSFunction();
+ 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);
JSObject* construct(ExecState*, const ArgList&);
JSValue call(ExecState*, JSValue thisValue, const ArgList&);
@@ -50,7 +64,11 @@ namespace JSC {
void setScope(const ScopeChain& scopeChain) { setScopeChain(scopeChain); }
ScopeChain& scope() { return scopeChain(); }
- FunctionExecutable* executable() const { return m_executable.get(); }
+ void setBody(FunctionBodyNode* body) { m_body = body; }
+ void setBody(PassRefPtr<FunctionBodyNode> body) { m_body = body; }
+ FunctionBodyNode* body() const { return m_body.get(); }
+
+ virtual void markChildren(MarkStack&);
static JS_EXPORTDATA const ClassInfo info;
@@ -59,6 +77,11 @@ 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);
@@ -68,42 +91,31 @@ namespace JSC {
virtual CallType getCallData(CallData&);
private:
- JSFunction(PassRefPtr<Structure>);
-
- bool isHostFunction() const;
- bool isHostFunctionNonInline() const;
-
- virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
- 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<FunctionExecutable> m_executable;
+ RefPtr<FunctionBodyNode> m_body;
ScopeChain& scopeChain()
{
- ASSERT(!isHostFunctionNonInline());
+ ASSERT(!isHostFunction());
return *reinterpret_cast<ScopeChain*>(m_data);
}
void clearScopeChain()
{
- ASSERT(!isHostFunctionNonInline());
+ ASSERT(!isHostFunction());
new (m_data) ScopeChain(NoScopeChain());
}
void setScopeChain(ScopeChainNode* sc)
{
- ASSERT(!isHostFunctionNonInline());
+ ASSERT(!isHostFunction());
new (m_data) ScopeChain(sc);
}
void setScopeChain(const ScopeChain& sc)
{
- ASSERT(!isHostFunctionNonInline());
+ ASSERT(!isHostFunction());
*reinterpret_cast<ScopeChain*>(m_data) = sc;
}
void setNativeFunction(NativeFunction func)
@@ -121,11 +133,6 @@ namespace JSC {
return static_cast<JSFunction*>(asObject(value));
}
- inline JSFunction* FunctionExecutable::make(ExecState* exec, ScopeChainNode* scopeChain)
- {
- return new (exec) JSFunction(exec, this, scopeChain);
- }
-
} // namespace JSC
#endif // JSFunction_h
diff --git a/JavaScriptCore/runtime/JSGlobalData.cpp b/JavaScriptCore/runtime/JSGlobalData.cpp
index 38ee1d0..03df41d 100644
--- a/JavaScriptCore/runtime/JSGlobalData.cpp
+++ b/JavaScriptCore/runtime/JSGlobalData.cpp
@@ -144,9 +144,8 @@ JSGlobalData::JSGlobalData(bool isShared, const VPtrSet& vptrSet)
, initializingLazyNumericCompareFunction(false)
, head(0)
, dynamicGlobalObject(0)
- , functionCodeBlockBeingReparsed(0)
+ , scopeNodeBeingReparsed(0)
, firstStringifierToMark(0)
- , markStack(vptrSet.jsArrayVPtr)
{
#if PLATFORM(MAC)
startProfilerServerIfNeeded();
@@ -236,9 +235,9 @@ const Vector<Instruction>& JSGlobalData::numericCompareFunction(ExecState* exec)
{
if (!lazyNumericCompareFunction.size() && !initializingLazyNumericCompareFunction) {
initializingLazyNumericCompareFunction = true;
- RefPtr<FunctionBodyNode> functionBody = parser->parseFunctionFromGlobalCode(exec, 0, makeSource(UString("(function (v1, v2) { return v1 - v2; })")), 0, 0);
- FunctionExecutable function(functionBody->ident(), functionBody.get());
- lazyNumericCompareFunction = function.bytecode(exec->scopeChain()).instructions();
+ 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();
initializingLazyNumericCompareFunction = false;
}
diff --git a/JavaScriptCore/runtime/JSGlobalData.h b/JavaScriptCore/runtime/JSGlobalData.h
index 77556b7..88cb516 100644
--- a/JavaScriptCore/runtime/JSGlobalData.h
+++ b/JavaScriptCore/runtime/JSGlobalData.h
@@ -45,14 +45,15 @@ 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;
@@ -144,7 +145,7 @@ namespace JSC {
HashSet<JSObject*> arrayVisitedElements;
- CodeBlock* functionCodeBlockBeingReparsed;
+ ScopeNode* scopeNodeBeingReparsed;
Stringifier* firstStringifierToMark;
MarkStack markStack;
diff --git a/JavaScriptCore/runtime/JSGlobalObject.cpp b/JavaScriptCore/runtime/JSGlobalObject.cpp
index 3a1909d..a90f18f 100644
--- a/JavaScriptCore/runtime/JSGlobalObject.cpp
+++ b/JavaScriptCore/runtime/JSGlobalObject.cpp
@@ -112,8 +112,8 @@ JSGlobalObject::~JSGlobalObject()
if (headObject == this)
headObject = 0;
- HashSet<GlobalCodeBlock*>::const_iterator end = codeBlocks().end();
- for (HashSet<GlobalCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
+ HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end();
+ for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
(*it)->clearGlobalObject();
RegisterFile& registerFile = globalData()->interpreter->registerFile();
@@ -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, d()->prototypeFunctionStructure.get());
+ JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype);
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<GlobalCodeBlock*>::const_iterator end = codeBlocks().end();
- for (HashSet<GlobalCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
+ HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end();
+ for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
(*it)->markAggregate(markStack);
RegisterFile& registerFile = globalData()->interpreter->registerFile();
diff --git a/JavaScriptCore/runtime/JSGlobalObject.h b/JavaScriptCore/runtime/JSGlobalObject.h
index cc36ada..cda49bd 100644
--- a/JavaScriptCore/runtime/JSGlobalObject.h
+++ b/JavaScriptCore/runtime/JSGlobalObject.h
@@ -38,7 +38,6 @@ namespace JSC {
class Debugger;
class ErrorConstructor;
class FunctionPrototype;
- class GlobalCodeBlock;
class GlobalEvalFunction;
class NativeErrorConstructor;
class ProgramCodeBlock;
@@ -145,7 +144,7 @@ namespace JSC {
RefPtr<JSGlobalData> globalData;
- HashSet<GlobalCodeBlock*> codeBlocks;
+ HashSet<ProgramCodeBlock*> codeBlocks;
};
public:
@@ -247,7 +246,7 @@ namespace JSC {
virtual bool isDynamicScope() const;
- HashSet<GlobalCodeBlock*>& codeBlocks() { return d()->codeBlocks; }
+ HashSet<ProgramCodeBlock*>& codeBlocks() { return d()->codeBlocks; }
void copyGlobalsFrom(RegisterFile&);
void copyGlobalsTo(RegisterFile&);
diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
index 50ea27f..affb99c 100644
--- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
+++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -286,12 +286,16 @@ JSValue JSC_HOST_CALL globalFuncEval(ExecState* exec, JSObject* function, JSValu
if (JSValue parsedObject = preparser.tryLiteralParse())
return parsedObject;
- EvalExecutable eval(makeSource(s));
- JSObject* error = eval.parse(exec);
- if (error)
- return throwError(exec, error);
+ int errLine;
+ UString errMsg;
- return exec->interpreter()->execute(&eval, exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot());
+ 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());
}
JSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec, JSObject*, JSValue, const ArgList& args)
diff --git a/JavaScriptCore/runtime/JSNumberCell.h b/JavaScriptCore/runtime/JSNumberCell.h
index 6a48081..04cccef 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 | HasDefaultMark)); }
+ static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(NumberType, NeedsThisConversion)); }
private:
JSNumberCell(JSGlobalData* globalData, double value)
diff --git a/JavaScriptCore/runtime/JSONObject.cpp b/JavaScriptCore/runtime/JSONObject.cpp
index fed9fc3..d643808 100644
--- a/JavaScriptCore/runtime/JSONObject.cpp
+++ b/JavaScriptCore/runtime/JSONObject.cpp
@@ -381,15 +381,6 @@ 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.");
diff --git a/JavaScriptCore/runtime/JSONObject.h b/JavaScriptCore/runtime/JSONObject.h
index c61b0dd..faca7c7 100644
--- a/JavaScriptCore/runtime/JSONObject.h
+++ b/JavaScriptCore/runtime/JSONObject.h
@@ -41,7 +41,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType, HasDefaultMark));
+ return Structure::create(prototype, TypeInfo(ObjectType));
}
static void markStringifiers(MarkStack&, Stringifier*);
diff --git a/JavaScriptCore/runtime/JSObject.cpp b/JavaScriptCore/runtime/JSObject.cpp
index 57624fb..419dfe9 100644
--- a/JavaScriptCore/runtime/JSObject.cpp
+++ b/JavaScriptCore/runtime/JSObject.cpp
@@ -37,6 +37,26 @@
#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 {
@@ -44,7 +64,16 @@ ASSERT_CLASS_FITS_IN_CELL(JSObject);
void JSObject::markChildren(MarkStack& markStack)
{
- markChildrenDirect(markStack);
+ JSOBJECT_MARK_BEGIN();
+
+ JSCell::markChildren(markStack);
+ m_structure->markAggregate(markStack);
+
+ PropertyStorage storage = propertyStorage();
+ size_t storageSize = m_structure->propertyStorageSize();
+ markStack.appendValues(reinterpret_cast<JSValue*>(storage), storageSize);
+
+ JSOBJECT_MARK_END();
}
UString JSObject::className() const
diff --git a/JavaScriptCore/runtime/JSObject.h b/JavaScriptCore/runtime/JSObject.h
index 856c5a1..decd5e9 100644
--- a/JavaScriptCore/runtime/JSObject.h
+++ b/JavaScriptCore/runtime/JSObject.h
@@ -27,9 +27,7 @@
#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"
@@ -76,12 +74,13 @@ namespace JSC {
explicit JSObject(PassRefPtr<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);
@@ -202,22 +201,10 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark));
+ return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot));
}
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); }
@@ -306,7 +293,7 @@ inline bool Structure::isUsingInlineStorage() const
return (propertyStorageCapacity() == JSObject::inlineStorageCapacity);
}
-inline bool JSCell::inherits(const ClassInfo* info) const
+inline bool JSCell::isObject(const ClassInfo* info) const
{
for (const ClassInfo* ci = classInfo(); ci; ci = ci->parentClass) {
if (ci == info)
@@ -315,10 +302,10 @@ inline bool JSCell::inherits(const ClassInfo* info) const
return false;
}
-// this method is here to be after the inline declaration of JSCell::inherits
-inline bool JSValue::inherits(const ClassInfo* classInfo) const
+// this method is here to be after the inline declaration of JSCell::isObject
+inline bool JSValue::isObject(const ClassInfo* classInfo) const
{
- return isCell() && asCell()->inherits(classInfo);
+ return isCell() && asCell()->isObject(classInfo);
}
ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
@@ -640,16 +627,6 @@ 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/JSString.h b/JavaScriptCore/runtime/JSString.h
index f9b0a8f..3daf58a 100644
--- a/JavaScriptCore/runtime/JSString.h
+++ b/JavaScriptCore/runtime/JSString.h
@@ -90,7 +90,7 @@ namespace JSC {
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 | HasDefaultMark)); }
+ static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(StringType, NeedsThisConversion)); }
private:
enum VPtrStealingHackType { VPtrStealingHack };
diff --git a/JavaScriptCore/runtime/JSType.h b/JavaScriptCore/runtime/JSType.h
index 882b218..a118b87 100644
--- a/JavaScriptCore/runtime/JSType.h
+++ b/JavaScriptCore/runtime/JSType.h
@@ -33,6 +33,7 @@ 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/JSValue.h b/JavaScriptCore/runtime/JSValue.h
index b72cc6e..408c187 100644
--- a/JavaScriptCore/runtime/JSValue.h
+++ b/JavaScriptCore/runtime/JSValue.h
@@ -130,7 +130,7 @@ namespace JSC {
bool isString() const;
bool isGetterSetter() const;
bool isObject() const;
- bool inherits(const ClassInfo*) const;
+ bool isObject(const ClassInfo*) const;
// Extracting the value.
bool getBoolean(bool&) const;
diff --git a/JavaScriptCore/runtime/MarkStack.h b/JavaScriptCore/runtime/MarkStack.h
index a97aa7e..7a7b3af 100644
--- a/JavaScriptCore/runtime/MarkStack.h
+++ b/JavaScriptCore/runtime/MarkStack.h
@@ -31,15 +31,15 @@
#include <wtf/Noncopyable.h>
namespace JSC {
- class JSGlobalData;
class Register;
enum MarkSetProperties { MayContainNullValues, NoNullValues };
class MarkStack : Noncopyable {
public:
- MarkStack(void* jsArrayVPtr)
- : m_jsArrayVPtr(jsArrayVPtr)
+ MarkStack()
+ : m_markSets()
+ , m_values()
{
}
@@ -82,7 +82,6 @@ namespace JSC {
, m_end(end)
, m_properties(properties)
{
- ASSERT(values);
}
JSValue* m_values;
JSValue* m_end;
@@ -137,12 +136,6 @@ 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()
{
@@ -157,14 +150,7 @@ namespace JSC {
ASSERT(0 == (size % MarkStack::pageSize()));
if (size == m_allocated)
return;
-#if PLATFORM(WIN)
- // 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);
}
@@ -176,7 +162,6 @@ namespace JSC {
T* m_data;
};
- void* m_jsArrayVPtr;
MarkStackArray<MarkSet> m_markSets;
MarkStackArray<JSCell*> m_values;
static size_t s_pageSize;
diff --git a/JavaScriptCore/runtime/MarkStackWin.cpp b/JavaScriptCore/runtime/MarkStackWin.cpp
index 1fdd06a..dbc3306 100644
--- a/JavaScriptCore/runtime/MarkStackWin.cpp
+++ b/JavaScriptCore/runtime/MarkStackWin.cpp
@@ -43,11 +43,9 @@ void* MarkStack::allocateStack(size_t size)
{
return VirtualAlloc(0, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
}
-void MarkStack::releaseStack(void* addr, size_t)
+void MarkStack::releaseStack(void* addr, size_t size)
{
- // 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);
+ VirtualFree(addr, size, MEM_RELEASE);
}
}
diff --git a/JavaScriptCore/runtime/MathObject.h b/JavaScriptCore/runtime/MathObject.h
index 06aa54b..3557d1e 100644
--- a/JavaScriptCore/runtime/MathObject.h
+++ b/JavaScriptCore/runtime/MathObject.h
@@ -36,7 +36,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType, HasDefaultMark));
+ return Structure::create(prototype, TypeInfo(ObjectType));
}
};
diff --git a/JavaScriptCore/runtime/NumberConstructor.h b/JavaScriptCore/runtime/NumberConstructor.h
index 6e67840..b1224ec 100644
--- a/JavaScriptCore/runtime/NumberConstructor.h
+++ b/JavaScriptCore/runtime/NumberConstructor.h
@@ -38,7 +38,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasDefaultMark));
+ return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance));
}
enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue };
diff --git a/JavaScriptCore/runtime/NumberObject.h b/JavaScriptCore/runtime/NumberObject.h
index 07a013f..d354b9b 100644
--- a/JavaScriptCore/runtime/NumberObject.h
+++ b/JavaScriptCore/runtime/NumberObject.h
@@ -30,11 +30,6 @@ namespace JSC {
explicit NumberObject(PassRefPtr<Structure>);
static const ClassInfo info;
-
- static PassRefPtr<Structure> createStructure(JSValue prototype)
- {
- return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark));
- }
private:
virtual const ClassInfo* classInfo() const { return &info; }
diff --git a/JavaScriptCore/runtime/ObjectConstructor.cpp b/JavaScriptCore/runtime/ObjectConstructor.cpp
index b05b910..70c7cd1 100644
--- a/JavaScriptCore/runtime/ObjectConstructor.cpp
+++ b/JavaScriptCore/runtime/ObjectConstructor.cpp
@@ -21,7 +21,6 @@
#include "config.h"
#include "ObjectConstructor.h"
-#include "Error.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "ObjectPrototype.h"
diff --git a/JavaScriptCore/runtime/PropertySlot.cpp b/JavaScriptCore/runtime/PropertySlot.cpp
index a0a2f48..36fa5d8 100644
--- a/JavaScriptCore/runtime/PropertySlot.cpp
+++ b/JavaScriptCore/runtime/PropertySlot.cpp
@@ -23,6 +23,7 @@
#include "JSFunction.h"
#include "JSGlobalObject.h"
+#include "JSObject.h"
namespace JSC {
@@ -38,7 +39,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 asFunction(slot.m_data.getterFunc)->call(exec, slot.slotBase(), exec->emptyList());
+ return static_cast<JSFunction*>(slot.m_data.getterFunc)->call(exec, slot.slotBase(), exec->emptyList());
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/RegExpConstructor.cpp b/JavaScriptCore/runtime/RegExpConstructor.cpp
index 62d56e9..6a8089d 100644
--- a/JavaScriptCore/runtime/RegExpConstructor.cpp
+++ b/JavaScriptCore/runtime/RegExpConstructor.cpp
@@ -23,7 +23,6 @@
#include "RegExpConstructor.h"
#include "ArrayPrototype.h"
-#include "Error.h"
#include "JSArray.h"
#include "JSFunction.h"
#include "JSString.h"
@@ -330,7 +329,7 @@ JSObject* constructRegExp(ExecState* exec, const ArgList& args)
JSValue arg0 = args.at(0);
JSValue arg1 = args.at(1);
- if (arg0.inherits(&RegExpObject::info)) {
+ if (arg0.isObject(&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 30b9750..6823f3f 100644
--- a/JavaScriptCore/runtime/RegExpConstructor.h
+++ b/JavaScriptCore/runtime/RegExpConstructor.h
@@ -36,7 +36,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType, ImplementsHasInstance | HasDefaultMark));
+ return Structure::create(prototype, TypeInfo(ObjectType, ImplementsHasInstance));
}
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
diff --git a/JavaScriptCore/runtime/RegExpObject.h b/JavaScriptCore/runtime/RegExpObject.h
index 5ca3b3f..e83e0ac 100644
--- a/JavaScriptCore/runtime/RegExpObject.h
+++ b/JavaScriptCore/runtime/RegExpObject.h
@@ -48,7 +48,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType, HasDefaultMark));
+ return Structure::create(prototype, TypeInfo(ObjectType));
}
private:
diff --git a/JavaScriptCore/runtime/RegExpPrototype.cpp b/JavaScriptCore/runtime/RegExpPrototype.cpp
index 30420e9..b1ab889 100644
--- a/JavaScriptCore/runtime/RegExpPrototype.cpp
+++ b/JavaScriptCore/runtime/RegExpPrototype.cpp
@@ -22,7 +22,6 @@
#include "RegExpPrototype.h"
#include "ArrayPrototype.h"
-#include "Error.h"
#include "JSArray.h"
#include "JSFunction.h"
#include "JSObject.h"
@@ -59,28 +58,28 @@ RegExpPrototype::RegExpPrototype(ExecState* exec, PassRefPtr<Structure> structur
JSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
- if (!thisValue.inherits(&RegExpObject::info))
+ if (!thisValue.isObject(&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.inherits(&RegExpObject::info))
+ if (!thisValue.isObject(&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.inherits(&RegExpObject::info))
+ if (!thisValue.isObject(&RegExpObject::info))
return throwError(exec, TypeError);
RefPtr<RegExp> regExp;
JSValue arg0 = args.at(0);
JSValue arg1 = args.at(1);
- if (arg0.inherits(&RegExpObject::info)) {
+ if (arg0.isObject(&RegExpObject::info)) {
if (!arg1.isUndefined())
return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another.");
regExp = asRegExpObject(arg0)->regExp();
@@ -100,8 +99,8 @@ JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec, JSObject*, JSValue
JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- if (!thisValue.inherits(&RegExpObject::info)) {
- if (thisValue.inherits(&RegExpPrototype::info))
+ if (!thisValue.isObject(&RegExpObject::info)) {
+ if (thisValue.isObject(&RegExpPrototype::info))
return jsNontrivialString(exec, "//");
return throwError(exec, TypeError);
}
diff --git a/JavaScriptCore/runtime/ScopeChain.cpp b/JavaScriptCore/runtime/ScopeChain.cpp
index 960c525..5c2edab 100644
--- a/JavaScriptCore/runtime/ScopeChain.cpp
+++ b/JavaScriptCore/runtime/ScopeChain.cpp
@@ -56,7 +56,7 @@ int ScopeChain::localDepth() const
int scopeDepth = 0;
ScopeChainIterator iter = this->begin();
ScopeChainIterator end = this->end();
- while (!(*iter)->inherits(&JSActivation::info)) {
+ while (!(*iter)->isObject(&JSActivation::info)) {
++iter;
if (iter == end)
break;
diff --git a/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h b/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
index 1d2e03f..bc5c0a5 100644
--- a/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
+++ b/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
@@ -44,7 +44,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, MasqueradesAsUndefined | HasDefaultMark));
+ return Structure::create(proto, TypeInfo(ObjectType, MasqueradesAsUndefined));
}
virtual bool toBoolean(ExecState*) const { return false; }
diff --git a/JavaScriptCore/runtime/StringPrototype.cpp b/JavaScriptCore/runtime/StringPrototype.cpp
index b4f7634..531a302 100644
--- a/JavaScriptCore/runtime/StringPrototype.cpp
+++ b/JavaScriptCore/runtime/StringPrototype.cpp
@@ -23,7 +23,6 @@
#include "StringPrototype.h"
#include "CachedCall.h"
-#include "Error.h"
#include "JSArray.h"
#include "JSFunction.h"
#include "ObjectPrototype.h"
@@ -221,7 +220,7 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec, JSObject*, JSValue
if (callType == CallTypeNone)
replacementString = replacement.toString(exec);
- if (pattern.inherits(&RegExpObject::info)) {
+ if (pattern.isObject(&RegExpObject::info)) {
RegExp* reg = asRegExpObject(pattern)->regExp();
bool global = reg->global();
@@ -366,7 +365,7 @@ JSValue JSC_HOST_CALL stringProtoFuncToString(ExecState* exec, JSObject*, JSValu
if (thisValue.isString())
return thisValue;
- if (thisValue.inherits(&StringObject::info))
+ if (thisValue.isObject(&StringObject::info))
return asStringObject(thisValue)->internalValue();
return throwError(exec, TypeError);
@@ -467,7 +466,7 @@ JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec, JSObject*, JSValue t
UString u = s;
RefPtr<RegExp> reg;
RegExpObject* imp = 0;
- if (a0.inherits(&RegExpObject::info))
+ if (a0.isObject(&RegExpObject::info))
reg = asRegExpObject(a0)->regExp();
else {
/*
@@ -517,7 +516,7 @@ JSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec, JSObject*, JSValue
UString u = s;
RefPtr<RegExp> reg;
- if (a0.inherits(&RegExpObject::info))
+ if (a0.isObject(&RegExpObject::info))
reg = asRegExpObject(a0)->regExp();
else {
/*
@@ -569,7 +568,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.inherits(&RegExpObject::info)) {
+ if (a0.isObject(&RegExpObject::info)) {
RegExp* reg = asRegExpObject(a0)->regExp();
if (s.isEmpty() && reg->match(s, 0) >= 0) {
// empty string matched by regexp -> empty array
@@ -822,8 +821,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;
- if (!tryFastMalloc(bufferSize * sizeof(UChar)).getValue(buffer))
+ UChar* buffer = static_cast<UChar*>(tryFastMalloc(bufferSize * sizeof(UChar)));
+ if (!buffer)
return jsUndefined();
buffer[0] = '<';
buffer[1] = 'f';
@@ -870,8 +869,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;
- if (!tryFastMalloc(bufferSize * sizeof(UChar)).getValue(buffer))
+ UChar* buffer = static_cast<UChar*>(tryFastMalloc(bufferSize * sizeof(UChar)));
+ if (!buffer)
return jsUndefined();
buffer[0] = '<';
buffer[1] = 'a';
diff --git a/JavaScriptCore/runtime/TypeInfo.h b/JavaScriptCore/runtime/TypeInfo.h
index 20c13ea..70aeed3 100644
--- a/JavaScriptCore/runtime/TypeInfo.h
+++ b/JavaScriptCore/runtime/TypeInfo.h
@@ -38,7 +38,6 @@ 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;
class TypeInfo {
friend class JIT;
@@ -60,7 +59,7 @@ 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; }
+
unsigned flags() const { return m_flags; }
private:
diff --git a/JavaScriptCore/runtime/UString.cpp b/JavaScriptCore/runtime/UString.cpp
index 9977f12..118751e 100644
--- a/JavaScriptCore/runtime/UString.cpp
+++ b/JavaScriptCore/runtime/UString.cpp
@@ -32,14 +32,12 @@
#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>
@@ -70,20 +68,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 PossiblyNull<UChar*> allocChars(size_t length)
+static inline UChar* allocChars(size_t length)
{
ASSERT(length);
if (length > maxUChars())
return 0;
- return tryFastMalloc(sizeof(UChar) * length);
+ return static_cast<UChar*>(tryFastMalloc(sizeof(UChar) * length));
}
-static inline PossiblyNull<UChar*> reallocChars(UChar* buffer, size_t length)
+static inline UChar* reallocChars(UChar* buffer, size_t length)
{
ASSERT(length);
if (length > maxUChars())
return 0;
- return tryFastRealloc(buffer, sizeof(UChar) * length);
+ return static_cast<UChar*>(tryFastRealloc(buffer, sizeof(UChar) * length));
}
static inline void copyChars(UChar* destination, const UChar* source, unsigned numCharacters)
@@ -482,7 +480,8 @@ static inline bool expandCapacity(UString::Rep* rep, int requiredLength)
if (requiredLength > base->capacity) {
size_t newCapacity = expandedSize(requiredLength, base->preCapacity);
UChar* oldBuf = base->buf;
- if (!reallocChars(base->buf, newCapacity).getValue(base->buf)) {
+ base->buf = reallocChars(base->buf, newCapacity);
+ if (!base->buf) {
base->buf = oldBuf;
return false;
}
@@ -513,7 +512,8 @@ bool UString::Rep::reserveCapacity(int capacity)
size_t newCapacity = expandedSize(capacity, base->preCapacity);
UChar* oldBuf = base->buf;
- if (!reallocChars(base->buf, newCapacity).getValue(base->buf)) {
+ base->buf = reallocChars(base->buf, newCapacity);
+ if (!base->buf) {
base->buf = oldBuf;
return false;
}
@@ -540,8 +540,8 @@ void UString::expandPreCapacity(int requiredPreCap)
size_t newCapacity = expandedSize(requiredPreCap, base->capacity);
int delta = newCapacity - base->capacity - base->preCapacity;
- UChar* newBuf;
- if (!allocChars(newCapacity).getValue(newBuf)) {
+ UChar* newBuf = allocChars(newCapacity);
+ if (!newBuf) {
makeNull();
return;
}
@@ -566,8 +566,8 @@ static PassRefPtr<UString::Rep> createRep(const char* c)
return &UString::Rep::empty();
size_t length = strlen(c);
- UChar* d;
- if (!allocChars(length).getValue(d))
+ UChar* d = allocChars(length);
+ if (!d)
return &UString::Rep::null();
else {
for (size_t i = 0; i < length; i++)
@@ -656,8 +656,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;
- if (!allocChars(newCapacity).getValue(d))
+ UChar* d = allocChars(newCapacity);
+ if (!d)
rep = &UString::Rep::null();
else {
copyChars(d, rep->data(), thisSize);
@@ -712,8 +712,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;
- if (!allocChars(newCapacity).getValue(d))
+ UChar* d = allocChars(newCapacity);
+ if (!d)
rep = &UString::Rep::null();
else {
copyChars(d, rep->data(), thisSize);
@@ -800,8 +800,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;
- if (!allocChars(newCapacity).getValue(d))
+ UChar* d = allocChars(newCapacity);
+ if (!d)
return 0;
copyChars(d, a->data(), aSize);
copyChars(d + aSize, b->data(), bSize);
@@ -942,39 +942,6 @@ 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];
@@ -1109,8 +1076,8 @@ UString UString::spliceSubstringsWithSeparators(const Range* substringRanges, in
if (totalLength == 0)
return "";
- UChar* buffer;
- if (!allocChars(totalLength).getValue(buffer))
+ UChar* buffer = allocChars(totalLength);
+ if (!buffer)
return null();
int maxCount = max(rangeCount, separatorCount);
@@ -1138,8 +1105,8 @@ UString UString::replaceRange(int rangeStart, int rangeLength, const UString& re
if (totalLength == 0)
return "";
- UChar* buffer;
- if (!allocChars(totalLength).getValue(buffer))
+ UChar* buffer = allocChars(totalLength);
+ if (!buffer)
return null();
copyChars(buffer, data(), rangeStart);
@@ -1186,8 +1153,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;
- if (!allocChars(newCapacity).getValue(d))
+ UChar* d = allocChars(newCapacity);
+ if (!d)
makeNull();
else {
copyChars(d, data(), thisSize);
@@ -1239,8 +1206,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;
- if (!allocChars(newCapacity).getValue(d))
+ UChar* d = allocChars(newCapacity);
+ if (!d)
makeNull();
else {
d[0] = c;
@@ -1267,8 +1234,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;
- if (!allocChars(newCapacity).getValue(d))
+ UChar* d = allocChars(newCapacity);
+ if (!d)
makeNull();
else {
copyChars(d, data(), length);
@@ -1346,7 +1313,8 @@ UString& UString::operator=(const char* c)
m_rep->_hash = 0;
m_rep->len = l;
} else {
- if (!allocChars(l).getValue(d)) {
+ d = allocChars(l);
+ if (!d) {
makeNull();
return *this;
}
diff --git a/JavaScriptCore/runtime/UString.h b/JavaScriptCore/runtime/UString.h
index 2dbca1f..d01b75d 100644
--- a/JavaScriptCore/runtime/UString.h
+++ b/JavaScriptCore/runtime/UString.h
@@ -91,8 +91,7 @@ namespace JSC {
{
// Guard against integer overflow
if (size < (std::numeric_limits<size_t>::max() / sizeof(UChar))) {
- void* buf = 0;
- if (tryFastMalloc(size * sizeof(UChar)).getValue(buf))
+ if (void * buf = tryFastMalloc(size * sizeof(UChar)))
return adoptRef(new BaseString(static_cast<UChar*>(buf), 0, size));
}
return adoptRef(new BaseString(0, 0, 0));
@@ -257,7 +256,6 @@ namespace JSC {
}
static UString from(int);
- static UString from(long long);
static UString from(unsigned int);
static UString from(long);
static UString from(double);
diff --git a/JavaScriptCore/wtf/FastMalloc.cpp b/JavaScriptCore/wtf/FastMalloc.cpp
index afa48e9..c14b755 100644
--- a/JavaScriptCore/wtf/FastMalloc.cpp
+++ b/JavaScriptCore/wtf/FastMalloc.cpp
@@ -178,10 +178,10 @@ void* fastZeroedMalloc(size_t n)
return result;
}
-TryMallocReturnValue tryFastZeroedMalloc(size_t n)
+void* tryFastZeroedMalloc(size_t n)
{
- void* result;
- if (!tryFastMalloc(n).getValue(result))
+ void* result = tryFastMalloc(n);
+ if (!result)
return 0;
memset(result, 0, n);
return result;
@@ -200,7 +200,7 @@ TryMallocReturnValue tryFastZeroedMalloc(size_t n)
namespace WTF {
-TryMallocReturnValue tryFastMalloc(size_t n)
+void* tryFastMalloc(size_t n)
{
ASSERT(!isForbidden());
@@ -226,9 +226,7 @@ void* fastMalloc(size_t n)
ASSERT(!isForbidden());
#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
- TryMallocReturnValue returnValue = tryFastMalloc(n);
- void* result;
- returnValue.getValue(result);
+ void* result = tryFastMalloc(n);
#else
void* result = malloc(n);
#endif
@@ -238,7 +236,7 @@ void* fastMalloc(size_t n)
return result;
}
-TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size)
+void* tryFastCalloc(size_t n_elements, size_t element_size)
{
ASSERT(!isForbidden());
@@ -266,9 +264,7 @@ void* fastCalloc(size_t n_elements, size_t element_size)
ASSERT(!isForbidden());
#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
- TryMallocReturnValue returnValue = tryFastCalloc(n_elements, element_size);
- void* result;
- returnValue.getValue(result);
+ void* result = tryFastCalloc(n_elements, element_size);
#else
void* result = calloc(n_elements, element_size);
#endif
@@ -295,7 +291,7 @@ void fastFree(void* p)
#endif
}
-TryMallocReturnValue tryFastRealloc(void* p, size_t n)
+void* tryFastRealloc(void* p, size_t n)
{
ASSERT(!isForbidden());
@@ -327,9 +323,7 @@ void* fastRealloc(void* p, size_t n)
ASSERT(!isForbidden());
#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
- TryMallocReturnValue returnValue = tryFastRealloc(p, n);
- void* result;
- returnValue.getValue(result);
+ void* result = tryFastRealloc(p, n);
#else
void* result = realloc(p, n);
#endif
@@ -3582,7 +3576,7 @@ void* fastMalloc(size_t size)
return malloc<true>(size);
}
-TryMallocReturnValue tryFastMalloc(size_t size)
+void* tryFastMalloc(size_t size)
{
return malloc<false>(size);
}
@@ -3643,7 +3637,7 @@ void* fastCalloc(size_t n, size_t elem_size)
return calloc<true>(n, elem_size);
}
-TryMallocReturnValue tryFastCalloc(size_t n, size_t elem_size)
+void* tryFastCalloc(size_t n, size_t elem_size)
{
return calloc<false>(n, elem_size);
}
@@ -3707,7 +3701,7 @@ void* fastRealloc(void* old_ptr, size_t new_size)
return realloc<true>(old_ptr, new_size);
}
-TryMallocReturnValue tryFastRealloc(void* old_ptr, size_t new_size)
+void* 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 b23e7b0..787251f 100644
--- a/JavaScriptCore/wtf/FastMalloc.h
+++ b/JavaScriptCore/wtf/FastMalloc.h
@@ -22,7 +22,6 @@
#define WTF_FastMalloc_h
#include "Platform.h"
-#include "PossiblyNull.h"
#include <stdlib.h>
#include <new>
@@ -34,42 +33,11 @@ namespace WTF {
void* fastCalloc(size_t numElements, size_t elementSize);
void* fastRealloc(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);
+ // 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);
void fastFree(void*);
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index c431629..845684e 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -108,13 +108,6 @@
#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 */
@@ -125,9 +118,7 @@
|| defined(unix) \
|| defined(__unix) \
|| defined(__unix__) \
- || defined(_AIX) \
- || defined(__HAIKU__) \
- || defined(__QNXNTO__)
+ || defined(_AIX)
#define WTF_PLATFORM_UNIX 1
#endif
@@ -152,8 +143,6 @@
#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)
@@ -200,7 +189,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) && !PLATFORM(HAIKU)
+#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) && !PLATFORM(WINCE)
#define WTF_PLATFORM_CAIRO 1
#endif
@@ -466,14 +455,6 @@
#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
@@ -484,9 +465,7 @@
#define HAVE_SIGNAL_H 1
#endif
-#if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !PLATFORM(QNX) \
- && !PLATFORM(SYMBIAN) && !PLATFORM(HAIKU) && !COMPILER(RVCT) \
- && !PLATFORM(ANDROID)
+#if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !PLATFORM(SYMBIAN) && !COMPILER(RVCT) && !PLATFORM(ANDROID)
#define HAVE_TM_GMTOFF 1
#define HAVE_TM_ZONE 1
#define HAVE_TIMEGM 1
@@ -546,24 +525,12 @@
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_TIME_H 1
-#elif PLATFORM(QNX)
-
-#define HAVE_ERRNO_H 1
-#define HAVE_MMAP 1
-#define HAVE_SBRK 1
-#define HAVE_STRINGS_H 1
-#define HAVE_SYS_PARAM_H 1
-#define HAVE_SYS_TIME_H 1
-
#else
/* 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
@@ -627,10 +594,6 @@
#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
@@ -645,9 +608,9 @@
#endif
#if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64)
-#if PLATFORM(X86_64) && (PLATFORM(MAC) || PLATFORM(LINUX))
+#if PLATFORM(X86_64) && (PLATFORM(MAC) || (PLATFORM(LINUX) && !PLATFORM(QT)))
#define WTF_USE_JSVALUE64 1
-#elif PLATFORM(ARM) || PLATFORM(PPC64)
+#elif PLATFORM(PPC64) || PLATFORM(QT) /* All Qt layout tests crash in JSVALUE32_64 mode. */
#define WTF_USE_JSVALUE32 1
#else
#define WTF_USE_JSVALUE32_64 1
@@ -676,20 +639,18 @@
#define ENABLE_JIT 1
#endif
-#if PLATFORM(QT)
-#if PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100
+#if PLATFORM(X86) && PLATFORM(QT)
+#if PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100
#define ENABLE_JIT 1
#define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
-#elif PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MSVC)
+#elif PLATFORM(WIN_OS) && COMPILER(MSVC)
#define ENABLE_JIT 1
#define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
-#elif PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100
+#elif PLATFORM(LINUX) && GCC_VERSION >= 40100
#define ENABLE_JIT 1
#define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
-#elif PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) && PLATFORM(LINUX)
- #define ENABLE_JIT 1
#endif
-#endif /* PLATFORM(QT) */
+#endif /* PLATFORM(QT) && PLATFORM(X86) */
#endif /* !defined(ENABLE_JIT) */
@@ -739,11 +700,10 @@
#define ENABLE_YARR_JIT 1
#endif
-#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) && !PLATFORM_ARM_ARCH(7) && PLATFORM(LINUX))
+#if PLATFORM(X86) && PLATFORM(QT)
+#if (PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \
+ || (PLATFORM(WIN_OS) && COMPILER(MSVC)) \
+ || (PLATFORM(LINUX) && GCC_VERSION >= 40100)
#define ENABLE_YARR 1
#define ENABLE_YARR_JIT 1
#endif
@@ -797,10 +757,4 @@
#define WTF_USE_ACCELERATED_COMPOSITING 1
#endif
-#if COMPILER(GCC)
-#define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result))
-#else
-#define WARN_UNUSED_RETURN
-#endif
-
#endif /* WTF_Platform_h */
diff --git a/JavaScriptCore/wtf/PossiblyNull.h b/JavaScriptCore/wtf/PossiblyNull.h
deleted file mode 100644
index 79c4d82..0000000
--- a/JavaScriptCore/wtf/PossiblyNull.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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/SegmentedVector.h b/JavaScriptCore/wtf/SegmentedVector.h
index b1cbc4d..065c19c 100644
--- a/JavaScriptCore/wtf/SegmentedVector.h
+++ b/JavaScriptCore/wtf/SegmentedVector.h
@@ -116,7 +116,6 @@ namespace WTF {
}
size_t size() const { return m_size; }
- bool isEmpty() const { return !size(); }
T& at(size_t index)
{
@@ -250,6 +249,4 @@ namespace WTF {
} // namespace WTF
-using WTF::SegmentedVector;
-
#endif // SegmentedVector_h
diff --git a/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp b/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp
index 10c4248..4fd7b35 100644
--- a/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp
+++ b/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp
@@ -30,7 +30,6 @@
#include "config.h"
#include "MainThread.h"
-#include "NotImplemented.h"
namespace WTF {
diff --git a/JavaScriptCore/yarr/RegexInterpreter.cpp b/JavaScriptCore/yarr/RegexInterpreter.cpp
index aafea3c..b0aae65 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);
- popParenthesesDisjunctionContext(backTrack);
freeParenthesesDisjunctionContext(context);
+ popParenthesesDisjunctionContext(backTrack);
}
return false;
@@ -910,8 +910,8 @@ public:
}
} else {
resetMatches(term, context);
- popParenthesesDisjunctionContext(backTrack);
freeParenthesesDisjunctionContext(context);
+ popParenthesesDisjunctionContext(backTrack);
}
if (backTrack->matchAmount) {
@@ -946,11 +946,11 @@ public:
}
return true;
}
-
+
// pop a match off the stack
resetMatches(term, context);
- popParenthesesDisjunctionContext(backTrack);
freeParenthesesDisjunctionContext(context);
+ popParenthesesDisjunctionContext(backTrack);
}
return false;
@@ -1266,37 +1266,37 @@ public:
ByteCompiler(RegexPattern& pattern)
: m_pattern(pattern)
{
- m_bodyDisjunction = 0;
- m_currentAlternativeIndex = 0;
+ bodyDisjunction = 0;
+ currentAlternativeIndex = 0;
}
-
+
BytecodePattern* compile()
{
regexBegin(m_pattern.m_numSubpatterns, m_pattern.m_body->m_callFrameSize);
emitDisjunction(m_pattern.m_body);
regexEnd();
- return new BytecodePattern(m_bodyDisjunction, m_allParenthesesInfo, m_pattern);
+ return new BytecodePattern(bodyDisjunction, m_allParenthesesInfo, m_pattern);
}
-
+
void checkInput(unsigned count)
{
- m_bodyDisjunction->terms.append(ByteTerm::CheckInput(count));
+ bodyDisjunction->terms.append(ByteTerm::CheckInput(count));
}
void assertionBOL(int inputPosition)
{
- m_bodyDisjunction->terms.append(ByteTerm::BOL(inputPosition));
+ bodyDisjunction->terms.append(ByteTerm::BOL(inputPosition));
}
void assertionEOL(int inputPosition)
{
- m_bodyDisjunction->terms.append(ByteTerm::EOL(inputPosition));
+ bodyDisjunction->terms.append(ByteTerm::EOL(inputPosition));
}
void assertionWordBoundary(bool invert, int inputPosition)
{
- m_bodyDisjunction->terms.append(ByteTerm::WordBoundary(invert, inputPosition));
+ 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) {
- m_bodyDisjunction->terms.append(ByteTerm(lo, hi, inputPosition, frameLocation, quantityCount, quantityType));
+ bodyDisjunction->terms.append(ByteTerm(lo, hi, inputPosition, frameLocation, quantityCount, quantityType));
return;
}
}
- m_bodyDisjunction->terms.append(ByteTerm(ch, inputPosition, frameLocation, quantityCount, quantityType));
+ bodyDisjunction->terms.append(ByteTerm(ch, inputPosition, frameLocation, quantityCount, quantityType));
}
-
+
void atomCharacterClass(CharacterClass* characterClass, bool invert, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
{
- m_bodyDisjunction->terms.append(ByteTerm(characterClass, invert, inputPosition));
+ bodyDisjunction->terms.append(ByteTerm(characterClass, invert, inputPosition));
- 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;
+ 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;
}
void atomBackReference(unsigned subpatternId, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
{
ASSERT(subpatternId);
- m_bodyDisjunction->terms.append(ByteTerm::BackReference(subpatternId, inputPosition));
+ bodyDisjunction->terms.append(ByteTerm::BackReference(subpatternId, inputPosition));
- 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;
+ 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;
}
void atomParenthesesSubpatternBegin(unsigned subpatternId, bool capture, int inputPosition, unsigned frameLocation, unsigned alternativeFrameLocation)
{
- int beginTerm = m_bodyDisjunction->terms.size();
+ int beginTerm = bodyDisjunction->terms.size();
- 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;
+ 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_parenthesesStack.append(ParenthesesStackEntry(beginTerm, m_currentAlternativeIndex));
- m_currentAlternativeIndex = beginTerm + 1;
+ m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, currentAlternativeIndex));
+ currentAlternativeIndex = beginTerm + 1;
}
void atomParentheticalAssertionBegin(unsigned subpatternId, bool invert, unsigned frameLocation, unsigned alternativeFrameLocation)
{
- int beginTerm = m_bodyDisjunction->terms.size();
+ int beginTerm = bodyDisjunction->terms.size();
- 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;
+ 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_parenthesesStack.append(ParenthesesStackEntry(beginTerm, m_currentAlternativeIndex));
- m_currentAlternativeIndex = beginTerm + 1;
+ m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, currentAlternativeIndex));
+ 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;
- m_currentAlternativeIndex = m_parenthesesStack[stackEnd].savedAlternativeIndex;
+ currentAlternativeIndex = m_parenthesesStack[stackEnd].savedAlternativeIndex;
m_parenthesesStack.shrink(stackEnd);
- ASSERT(beginTerm < m_bodyDisjunction->terms.size());
- ASSERT(m_currentAlternativeIndex < m_bodyDisjunction->terms.size());
-
+ ASSERT(beginTerm < bodyDisjunction->terms.size());
+ ASSERT(currentAlternativeIndex < bodyDisjunction->terms.size());
+
return beginTerm;
}
@@ -1387,25 +1387,25 @@ public:
void closeAlternative(int beginTerm)
{
int origBeginTerm = beginTerm;
- ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeAlternativeBegin);
- int endIndex = m_bodyDisjunction->terms.size();
+ ASSERT(bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeAlternativeBegin);
+ int endIndex = bodyDisjunction->terms.size();
- unsigned frameLocation = m_bodyDisjunction->terms[beginTerm].frameLocation;
+ unsigned frameLocation = bodyDisjunction->terms[beginTerm].frameLocation;
- if (!m_bodyDisjunction->terms[beginTerm].alternative.next)
- m_bodyDisjunction->terms.remove(beginTerm);
+ if (!bodyDisjunction->terms[beginTerm].alternative.next)
+ bodyDisjunction->terms.remove(beginTerm);
else {
- 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;
+ 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;
}
+
+ bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm;
- m_bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm;
-
- m_bodyDisjunction->terms.append(ByteTerm::AlternativeEnd());
- m_bodyDisjunction->terms[endIndex].frameLocation = frameLocation;
+ bodyDisjunction->terms.append(ByteTerm::AlternativeEnd());
+ bodyDisjunction->terms[endIndex].frameLocation = frameLocation;
}
}
@@ -1413,46 +1413,46 @@ public:
{
int beginTerm = 0;
int origBeginTerm = 0;
- ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeBodyAlternativeBegin);
- int endIndex = m_bodyDisjunction->terms.size();
+ ASSERT(bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeBodyAlternativeBegin);
+ int endIndex = bodyDisjunction->terms.size();
- unsigned frameLocation = m_bodyDisjunction->terms[beginTerm].frameLocation;
+ unsigned frameLocation = bodyDisjunction->terms[beginTerm].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;
+ 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;
}
+
+ bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm;
- m_bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm;
-
- m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeEnd());
- m_bodyDisjunction->terms[endIndex].frameLocation = frameLocation;
+ bodyDisjunction->terms.append(ByteTerm::BodyAlternativeEnd());
+ 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 = m_bodyDisjunction->terms.size();
+ unsigned endTerm = bodyDisjunction->terms.size();
- bool isAssertion = m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParentheticalAssertionBegin;
- bool invertOrCapture = m_bodyDisjunction->terms[beginTerm].invertOrCapture;
- unsigned subpatternId = m_bodyDisjunction->terms[beginTerm].atom.subpatternId;
+ bool isAssertion = bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParentheticalAssertionBegin;
+ bool invertOrCapture = bodyDisjunction->terms[beginTerm].invertOrCapture;
+ unsigned subpatternId = bodyDisjunction->terms[beginTerm].atom.subpatternId;
- 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;
+ 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;
if (doInline) {
- 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;
+ bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount;
+ bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType;
+ bodyDisjunction->terms[endTerm].atom.quantityCount = quantityCount;
+ bodyDisjunction->terms[endTerm].atom.quantityType = quantityType;
} else {
- ByteTerm& parenthesesBegin = m_bodyDisjunction->terms[beginTerm];
+ ByteTerm& parenthesesBegin = 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(m_bodyDisjunction->terms[termInParentheses]);
+ parenthesesDisjunction->terms.append(bodyDisjunction->terms[termInParentheses]);
parenthesesDisjunction->terms.append(ByteTerm::SubpatternEnd());
- m_bodyDisjunction->terms.shrink(beginTerm);
+ bodyDisjunction->terms.shrink(beginTerm);
m_allParenthesesInfo.append(parenthesesDisjunction);
- m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpattern, subpatternId, parenthesesDisjunction, invertOrCapture, inputPosition));
+ bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpattern, subpatternId, parenthesesDisjunction, invertOrCapture, inputPosition));
- m_bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount;
- m_bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType;
- m_bodyDisjunction->terms[beginTerm].frameLocation = frameLocation;
+ bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount;
+ bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType;
+ bodyDisjunction->terms[beginTerm].frameLocation = frameLocation;
}
}
void regexBegin(unsigned numSubpatterns, unsigned callFrameSize)
{
- m_bodyDisjunction = new ByteDisjunction(numSubpatterns, callFrameSize);
- m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeBegin());
- m_bodyDisjunction->terms[0].frameLocation = 0;
- m_currentAlternativeIndex = 0;
+ bodyDisjunction = new ByteDisjunction(numSubpatterns, callFrameSize);
+ bodyDisjunction->terms.append(ByteTerm::BodyAlternativeBegin());
+ bodyDisjunction->terms[0].frameLocation = 0;
+ currentAlternativeIndex = 0;
}
void regexEnd()
@@ -1492,27 +1492,27 @@ public:
void alterantiveBodyDisjunction()
{
- int newAlternativeIndex = m_bodyDisjunction->terms.size();
- m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex;
- m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeDisjunction());
+ int newAlternativeIndex = bodyDisjunction->terms.size();
+ bodyDisjunction->terms[currentAlternativeIndex].alternative.next = newAlternativeIndex - currentAlternativeIndex;
+ bodyDisjunction->terms.append(ByteTerm::BodyAlternativeDisjunction());
- m_currentAlternativeIndex = newAlternativeIndex;
+ currentAlternativeIndex = newAlternativeIndex;
}
void alterantiveDisjunction()
{
- int newAlternativeIndex = m_bodyDisjunction->terms.size();
- m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex;
- m_bodyDisjunction->terms.append(ByteTerm::AlternativeDisjunction());
+ int newAlternativeIndex = bodyDisjunction->terms.size();
+ bodyDisjunction->terms[currentAlternativeIndex].alternative.next = newAlternativeIndex - currentAlternativeIndex;
+ bodyDisjunction->terms.append(ByteTerm::AlternativeDisjunction());
- m_currentAlternativeIndex = newAlternativeIndex;
+ 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* m_bodyDisjunction;
- unsigned m_currentAlternativeIndex;
+ ByteDisjunction* bodyDisjunction;
+ unsigned currentAlternativeIndex;
Vector<ParenthesesStackEntry> m_parenthesesStack;
Vector<ByteDisjunction*> m_allParenthesesInfo;
};