From ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Thu, 8 Jul 2010 12:51:48 +0100 Subject: Merge WebKit at r62496: Initial merge by git Change-Id: Ie3da0770eca22a70a632e3571f31cfabc80facb2 --- JavaScriptCore/API/tests/testapi.c | 5 +- JavaScriptCore/Android.mk | 8 - JavaScriptCore/CMakeLists.txt | 11 - JavaScriptCore/ChangeLog | 808 ++++++++ .../Configurations/FeatureDefines.xcconfig | 5 +- JavaScriptCore/Configurations/Version.xcconfig | 2 +- JavaScriptCore/DerivedSources.make | 11 - JavaScriptCore/DerivedSources.pro | 10 - JavaScriptCore/GNUmakefile.am | 592 +++--- JavaScriptCore/JavaScriptCore.pro | 2 - .../JavaScriptCore/JavaScriptCore.vcproj | 72 - .../JavaScriptCore.xcodeproj/project.pbxproj | 16 +- JavaScriptCore/assembler/ARMv7Assembler.h | 564 ++++-- JavaScriptCore/assembler/AbstractMacroAssembler.h | 1 - JavaScriptCore/assembler/MacroAssemblerARM.h | 2 + JavaScriptCore/assembler/MacroAssemblerARMv7.h | 95 +- JavaScriptCore/assembler/MacroAssemblerMIPS.h | 1 + JavaScriptCore/assembler/MacroAssemblerX86Common.h | 1 + JavaScriptCore/bytecode/Opcode.cpp | 2 +- JavaScriptCore/interpreter/Interpreter.cpp | 16 +- JavaScriptCore/jit/JITOpcodes.cpp | 31 + JavaScriptCore/jit/JITStubs.cpp | 43 +- JavaScriptCore/parser/Grammar.y | 2099 -------------------- JavaScriptCore/parser/JSParser.cpp | 5 - JavaScriptCore/parser/JSParser.h | 2 - JavaScriptCore/parser/Lexer.cpp | 775 ++++---- JavaScriptCore/parser/Lexer.h | 26 +- JavaScriptCore/parser/NodeConstructors.h | 4 - JavaScriptCore/parser/Parser.cpp | 6 +- JavaScriptCore/parser/SourceProvider.h | 23 +- JavaScriptCore/pcre/pcre_compile.cpp | 5 +- JavaScriptCore/qt/ChangeLog | 59 + JavaScriptCore/qt/api/qscriptengine.cpp | 75 + JavaScriptCore/qt/api/qscriptengine.h | 7 + JavaScriptCore/qt/api/qscriptengine_p.cpp | 27 + JavaScriptCore/qt/api/qscriptengine_p.h | 74 +- JavaScriptCore/qt/api/qscriptvalue.cpp | 38 + JavaScriptCore/qt/api/qscriptvalue.h | 12 +- JavaScriptCore/qt/api/qscriptvalue_p.h | 72 +- JavaScriptCore/qt/benchmarks/benchmarks.pri | 19 + JavaScriptCore/qt/benchmarks/benchmarks.pro | 4 + .../qt/benchmarks/qscriptengine/qscriptengine.pro | 13 + .../benchmarks/qscriptengine/tst_qscriptengine.cpp | 142 ++ .../qt/benchmarks/qscriptvalue/qscriptvalue.pro | 9 + .../benchmarks/qscriptvalue/tst_qscriptvalue.cpp | 442 +++++ .../qt/tests/qscriptengine/tst_qscriptengine.cpp | 104 + .../qt/tests/qscriptvalue/tst_qscriptvalue.cpp | 13 + .../qt/tests/qscriptvalue/tst_qscriptvalue.h | 1 + JavaScriptCore/runtime/Arguments.h | 4 + JavaScriptCore/runtime/Collector.cpp | 4 +- JavaScriptCore/runtime/Collector.h | 9 +- JavaScriptCore/runtime/CollectorHeapIterator.h | 2 +- JavaScriptCore/runtime/DateInstanceCache.h | 2 +- JavaScriptCore/runtime/JSArray.cpp | 6 +- JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp | 9 +- JavaScriptCore/runtime/JSImmediate.h | 8 - JavaScriptCore/runtime/JSString.cpp | 4 +- JavaScriptCore/runtime/JSString.h | 2 +- JavaScriptCore/runtime/NumericStrings.h | 9 +- JavaScriptCore/runtime/RegExp.cpp | 61 +- JavaScriptCore/runtime/RegExp.h | 5 +- JavaScriptCore/runtime/RegExpCache.cpp | 21 +- JavaScriptCore/runtime/RegExpCache.h | 8 +- JavaScriptCore/runtime/SmallStrings.h | 5 +- JavaScriptCore/runtime/UString.cpp | 11 +- JavaScriptCore/runtime/UString.h | 46 +- JavaScriptCore/wtf/AVLTree.h | 3 +- JavaScriptCore/wtf/Assertions.h | 10 + JavaScriptCore/wtf/FixedArray.h | 53 + JavaScriptCore/wtf/HashSet.h | 47 +- JavaScriptCore/wtf/HashTable.h | 10 + JavaScriptCore/wtf/PassRefPtr.h | 126 +- JavaScriptCore/wtf/Platform.h | 12 +- JavaScriptCore/wtf/RefCounted.h | 40 +- JavaScriptCore/wtf/StringExtras.h | 25 +- JavaScriptCore/wtf/efl/MainThreadEfl.cpp | 2 +- JavaScriptCore/wtf/text/StringImpl.h | 31 + JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp | 5 + JavaScriptCore/wtf/unicode/wince/UnicodeWince.h | 5 +- JavaScriptCore/yarr/RegexInterpreter.cpp | 2 +- 80 files changed, 3577 insertions(+), 3364 deletions(-) delete mode 100644 JavaScriptCore/parser/Grammar.y create mode 100644 JavaScriptCore/qt/ChangeLog create mode 100644 JavaScriptCore/qt/benchmarks/benchmarks.pri create mode 100644 JavaScriptCore/qt/benchmarks/benchmarks.pro create mode 100644 JavaScriptCore/qt/benchmarks/qscriptengine/qscriptengine.pro create mode 100644 JavaScriptCore/qt/benchmarks/qscriptengine/tst_qscriptengine.cpp create mode 100644 JavaScriptCore/qt/benchmarks/qscriptvalue/qscriptvalue.pro create mode 100644 JavaScriptCore/qt/benchmarks/qscriptvalue/tst_qscriptvalue.cpp create mode 100644 JavaScriptCore/wtf/FixedArray.h (limited to 'JavaScriptCore') diff --git a/JavaScriptCore/API/tests/testapi.c b/JavaScriptCore/API/tests/testapi.c index 780e996..183abf5 100644 --- a/JavaScriptCore/API/tests/testapi.c +++ b/JavaScriptCore/API/tests/testapi.c @@ -927,7 +927,8 @@ int main(int argc, char* argv[]) JSStringRelease(EmptyObjectIString); JSStringRef lengthStr = JSStringCreateWithUTF8CString("length"); - aHeapRef = JSObjectMakeArray(context, 0, 0, 0); + JSObjectRef aStackRef = JSObjectMakeArray(context, 0, 0, 0); + aHeapRef = aStackRef; JSObjectSetProperty(context, aHeapRef, lengthStr, JSValueMakeNumber(context, 10), 0, 0); JSStringRef privatePropertyName = JSStringCreateWithUTF8CString("privateProperty"); if (!JSObjectSetPrivateProperty(context, myObject, privatePropertyName, aHeapRef)) { @@ -936,6 +937,7 @@ int main(int argc, char* argv[]) } else { printf("PASS: Set private property.\n"); } + aStackRef = 0; if (JSObjectSetPrivateProperty(context, aHeapRef, privatePropertyName, aHeapRef)) { printf("FAIL: JSObjectSetPrivateProperty should fail on non-API objects.\n"); failed = 1; @@ -964,6 +966,7 @@ int main(int argc, char* argv[]) for (int i = 0; i < 10000; i++) JSObjectMake(context, 0, 0); + aHeapRef = JSValueToObject(context, JSObjectGetPrivateProperty(context, myObject, privatePropertyName), 0); if (JSValueToNumber(context, JSObjectGetProperty(context, aHeapRef, lengthStr, 0), 0) != 10) { printf("FAIL: Private property has been collected.\n"); failed = 1; diff --git a/JavaScriptCore/Android.mk b/JavaScriptCore/Android.mk index ded912e..42df087 100644 --- a/JavaScriptCore/Android.mk +++ b/JavaScriptCore/Android.mk @@ -196,14 +196,6 @@ LOCAL_SRC_FILES := \ yarr/RegexInterpreter.cpp \ yarr/RegexJIT.cpp -# Rule to build grammar.y with our custom bison. -GEN := $(intermediates)/parser/Grammar.cpp -$(GEN) : PRIVATE_YACCFLAGS := -p jscyy -$(GEN) : $(LOCAL_PATH)/parser/Grammar.y - $(call local-transform-y-to-cpp,.cpp) -$(GEN) : $(LOCAL_BISON) -LOCAL_GENERATED_SOURCES += $(GEN) - # generated headers JSC_OBJECTS := $(addprefix $(intermediates)/runtime/, \ ArrayPrototype.lut.h \ diff --git a/JavaScriptCore/CMakeLists.txt b/JavaScriptCore/CMakeLists.txt index c1946ff..bdb1467 100644 --- a/JavaScriptCore/CMakeLists.txt +++ b/JavaScriptCore/CMakeLists.txt @@ -203,17 +203,6 @@ ENDFOREACH () GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/parser/Keywords.table ${DERIVED_SOURCES_DIR}/Lexer.lut.h MAIN_DEPENDENCY) LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/Lexer.lut.h) -# GENERATOR 2: bison grammar -ADD_CUSTOM_COMMAND( - OUTPUT ${DERIVED_SOURCES_DIR}/Grammar.cpp ${DERIVED_SOURCES_DIR}/Grammar.h - MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/parser/Grammar.y - COMMAND ${BISON_EXECUTABLE} -d -p jscyy ${JAVASCRIPTCORE_DIR}/parser/Grammar.y -o ${DERIVED_SOURCES_DIR}/Grammar.cpp --defines=${DERIVED_SOURCES_DIR}/Grammar.h - COMMENT "[BISON][JSCYY] Building parser with bison" - VERBATIM) -LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/Grammar.h) -LIST(APPEND JavaScriptCore_SOURCES ${DERIVED_SOURCES_DIR}/Grammar.cpp) - - # GENERATOR: "chartables.c": compile and execute the chartables generator (and add it to sources) IF (MSVC) SET(JSC_DFTABLES_PREPROCESSOR --preprocessor=cl.exe) diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog index ff017ca..c6cbd6d 100644 --- a/JavaScriptCore/ChangeLog +++ b/JavaScriptCore/ChangeLog @@ -1,3 +1,811 @@ +2010-07-05 Steve Block + + Reviewed by Darin Adler. + + ThreadingPthreads.cpp should use JNIUtility.h on Android, not outdated jni_utility.h + https://bugs.webkit.org/show_bug.cgi?id=41594 + + * wtf/ThreadingPthreads.cpp: + +2010-07-04 Mark Rowe + + Build fix after r62456. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): Be slightly more consistent in using uint32_t to prevent + warnings about comparisons between signed and unsigned types, and attempts to call an overload + of std::min that doesn't exist. + +2010-07-02 Sam Weinig + + Reviewed by Darin Adler. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41553 + Make StringExtras.h versions of snprintf and vsnprintf match the unix versions. + + - MSVC does not ensure the buffers are null terminated as the unix versions do. + + * runtime/JSGlobalObjectFunctions.cpp: Cleanup includes. + * runtime/UString.cpp: Clean up includes. + (JSC::UString::from): Don't pass sizeof(buf) - 1, that is wrong. + * wtf/StringExtras.h: + (snprintf): Ensure null termination of buffer. + (vsnprintf): Ditto. + +2010-07-03 Yong Li + + Reviewed by Darin Adler. + + Make Arguments::MaxArguments clamping work for numbers >= 0x80000000 in + the interpreter as well as the JIT. + + https://bugs.webkit.org/show_bug.cgi?id=41351 + rdar://problem/8142141 + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): Fix signed integer overflow problem + in op_load_varargs handling. 0xFFFFFFFF was read as -1. + +2010-06-26 Jeremy Orlow + + Reviewed by Dumitru Daniliuc. + + Support for keys and in-memory storage for IndexedDB + https://bugs.webkit.org/show_bug.cgi?id=41252 + + Set the role to Private. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2010-07-02 Oliver Hunt + + Reviewed by Geoffrey Garen. + + Move BOM handling out of the lexer and parser + https://bugs.webkit.org/show_bug.cgi?id=41539 + + Doing the BOM stripping in the lexer meant that we could + end up having to strip the BOMs from a source multiple times. + To deal with this we now require all strings provided by + a SourceProvider to already have had the BOMs stripped. + This also simplifies some of the lexer logic. + + * parser/Lexer.cpp: + (JSC::Lexer::setCode): + (JSC::Lexer::sourceCode): + * parser/SourceProvider.h: + (JSC::SourceProvider::SourceProvider): + (JSC::UStringSourceProvider::create): + (JSC::UStringSourceProvider::getRange): + (JSC::UStringSourceProvider::UStringSourceProvider): + * wtf/text/StringImpl.h: + (WebCore::StringImpl::copyStringWithoutBOMs): + +2010-07-03 Patrick Gansterer + + Reviewed by Kent Tamura. + + [WINCE] Implement Unicode::isAlphanumeric and Unicode::isArabicChar. + https://bugs.webkit.org/show_bug.cgi?id=41411 + + * wtf/unicode/wince/UnicodeWince.cpp: + (WTF::Unicode::isAlphanumeric): + * wtf/unicode/wince/UnicodeWince.h: + (WTF::Unicode::isArabicChar): + +2010-07-03 Kwang Yul Seo + + Reviewed by Kent Tamura. + + [BREWMP] Change the CRASH() macro to print "WebKit CRASH" log. + https://bugs.webkit.org/show_bug.cgi?id=41524 + + Print "WebKit CRASH" before crashing. + + * wtf/Assertions.h: + +2010-07-02 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Bug 41565 - Repatching in ARMv7Assembler::repatchLoadPtrToLEA is broken + + This method tried to repatch a LDR (T2) into an ADD (T3) - but it only + repatches the first instruction word. The layout of the fields in the + second word is different, and also needs repatching. + + * assembler/ARMv7Assembler.h: + (JSC::ARMv7Assembler::repatchLoadPtrToLEA): + +2010-07-02 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Clamp the number of arguments supported by function.apply + https://bugs.webkit.org/show_bug.cgi?id=41351 + + + Add clamping logic to function.apply similar to that + enforced by firefox. We have a smaller clamp than + firefox as our calling convention means that stack + usage is proportional to argument count -- the firefox + limit is larger than you could actually call. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * runtime/Arguments.h: + (JSC::Arguments::): + +2010-07-02 Chao-ying Fu + + Reviewed by Oliver Hunt. + + Re-enable JIT_OPTIMIZE_NATIVE_CALL on MIPS + https://bugs.webkit.org/show_bug.cgi?id=40179 + + Add the MIPS part to re-enable JIT_OPTIMIZE_NATIVE_CALL. + + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTINativeCall): + * wtf/Platform.h: + +2010-07-02 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Bug 41552 - Clean up ARMv7 vfp code generation + Emit separate opcode individually, remove magic numbers. + + Also remove invalid assert from JSImmediate (number cells are not CELL_MASK aligned). + + * assembler/ARMv7Assembler.h: + (JSC::ARMv7Assembler::): + (JSC::ARMv7Assembler::vadd_F64): + (JSC::ARMv7Assembler::vcmp_F64): + (JSC::ARMv7Assembler::vcvt_F64_S32): + (JSC::ARMv7Assembler::vcvtr_S32_F64): + (JSC::ARMv7Assembler::vdiv_F64): + (JSC::ARMv7Assembler::vldr): + (JSC::ARMv7Assembler::vmov_F64_0): + (JSC::ARMv7Assembler::vmov): + (JSC::ARMv7Assembler::vmrs): + (JSC::ARMv7Assembler::vmul_F64): + (JSC::ARMv7Assembler::vstr): + (JSC::ARMv7Assembler::vsub_F64): + (JSC::ARMv7Assembler::VFPOperand::VFPOperand): + (JSC::ARMv7Assembler::VFPOperand::bits1): + (JSC::ARMv7Assembler::VFPOperand::bits4): + (JSC::ARMv7Assembler::vcvtOp): + (JSC::ARMv7Assembler::ARMInstructionFormatter::vfpOp): + (JSC::ARMv7Assembler::ARMInstructionFormatter::vfpMemOp): + * assembler/MacroAssemblerARMv7.h: + (JSC::MacroAssemblerARMv7::branchDouble): + * runtime/JSImmediate.h: + (JSC::JSValue::isCell): + +2010-07-02 Sheriff Bot + + Unreviewed, rolling out r62410. + http://trac.webkit.org/changeset/62410 + https://bugs.webkit.org/show_bug.cgi?id=41549 + + accursed last minute changes (Requested by olliej on #webkit). + + * parser/Lexer.cpp: + (JSC::Lexer::setCode): + (JSC::Lexer::copyCodeWithoutBOMs): + (JSC::Lexer::sourceCode): + * parser/SourceProvider.h: + (JSC::): + (JSC::SourceProvider::SourceProvider): + (JSC::SourceProvider::hasBOMs): + (JSC::UStringSourceProvider::create): + (JSC::UStringSourceProvider::getRange): + (JSC::UStringSourceProvider::UStringSourceProvider): + * wtf/text/StringImpl.h: + +2010-07-02 Sam Weinig + + Reviewed by Geoffrey Garen. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41548 + Use snprintf instead of sprintf everywhere in JavaScriptCore + + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::encode): + (JSC::globalFuncEscape): + * runtime/UString.cpp: + (JSC::UString::from): + +2010-07-02 Oliver Hunt + + Reviewed by Geoffrey Garen. + + Move BOM handling out of the lexer and parser + https://bugs.webkit.org/show_bug.cgi?id=41539 + + Doing the BOM stripping in the lexer meant that we could + end up having to strip the BOMs from a source multiple times. + To deal with this we now require all strings provided by + a SourceProvider to already have had the BOMs stripped. + This also simplifies some of the lexer logic. + + * parser/Lexer.cpp: + (JSC::Lexer::setCode): + (JSC::Lexer::sourceCode): + * parser/SourceProvider.h: + (JSC::SourceProvider::SourceProvider): + (JSC::UStringSourceProvider::create): + (JSC::UStringSourceProvider::getRange): + (JSC::UStringSourceProvider::UStringSourceProvider): + * wtf/text/StringImpl.h: + (WebCore::StringImpl::copyStringWithoutBOMs): + +2010-07-02 Renata Hodovan + + Reviewed by Oliver Hunt. + + [ Updated after rollout. ] + + Merged RegExp constructor and RegExp::create methods. + Both functions are called with three parameters and check whether + flags (the third param) is given or not. + Avoid extra hash lookups in RegExpCache::create by passing a pre-computed + iterator parameter. + https://bugs.webkit.org/show_bug.cgi?id=41055 + + * runtime/RegExp.cpp: + (JSC::RegExp::RegExp): + * runtime/RegExp.h: + * runtime/RegExpCache.cpp: + (JSC::RegExpCache::lookupOrCreate): + (JSC::RegExpCache::create): + * runtime/RegExpCache.h: + +2010-07-02 Martin Robinson + + Unreviewed. Build fix for GTK+. + + Build Lexer.lut.h with the rest of the .lut.h files. Later these should + all probably be moved to DerivedSources. + + * GNUmakefile.am: + +2010-06-23 Martin Robinson + + Reviewed by Gustavo Noronha Silva. + + [GTK] Separate DerivedSources per-project + https://bugs.webkit.org/show_bug.cgi?id=41109 + + Generate JavaScriptCore derived sources in /DerivedSources/JavaScriptCore. + + * GNUmakefile.am: + +2010-07-02 Peter Varga + + Reviewed by Oliver Hunt. + + The alternativeFrameLocation value is wrong in the emitDisjunction function in + case of PatternTerm::TypeParentheticalAssertion. This value needs to be + computed from term.frameLocation instead of term.inputPosition. This mistake caused glibc + memory corruption in some cases. + Layout test added for checking of TypeParentheticalAssertion case. + https://bugs.webkit.org/show_bug.cgi?id=41458 + + * yarr/RegexInterpreter.cpp: + (JSC::Yarr::ByteCompiler::emitDisjunction): + +2010-07-01 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + Add a FixedArray template to encapsulate fixed length arrays + https://bugs.webkit.org/show_bug.cgi?id=41506 + + This new type is used in place of fixed length C arrays so + that debug builds can guard against attempts to go beyond + the end of the array. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * bytecode/Opcode.cpp: + (JSC::OpcodeStats::~OpcodeStats): + * pcre/pcre_compile.cpp: + (calculateCompiledPatternLength): + * runtime/Collector.cpp: + (JSC::Heap::allocateBlock): + (JSC::Heap::allocate): + * runtime/Collector.h: + (JSC::CollectorBitmap::clearAll): + * runtime/CollectorHeapIterator.h: + (JSC::CollectorHeapIterator::operator*): + * runtime/DateInstanceCache.h: + * runtime/JSString.cpp: + (JSC::JSString::replaceCharacter): + * runtime/JSString.h: + (JSC::RopeBuilder::JSStringFinalizerStruct::): + * runtime/NumericStrings.h: + * runtime/RegExpCache.h: + * runtime/SmallStrings.h: + (JSC::SmallStrings::singleCharacterStrings): + * wtf/AVLTree.h: + * wtf/FixedArray.h: Added. + (WTF::FixedArray::operator[]): + (WTF::FixedArray::data): + +2010-07-01 Zoltan Herczeg + + Reviewed by Oliver Hunt. + + Improve the main lexer switch by mapping input characters to their type + https://bugs.webkit.org/show_bug.cgi?id=41459 + + Sunsipder: no change (from 532.9ms to 531.5ms) + SunSpider --parse-only: 1.025x as fast (from 33.1ms to 32.3ms) + + * parser/Lexer.cpp: + (JSC::): + (JSC::Lexer::lex): + +2010-07-01 Sam Weinig + + Rubber-stamped by Ander Carlsson. + + Define HAVE_HOSTED_CORE_ANIMATION on Snow Leopard. + + * wtf/Platform.h: + +2010-07-01 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Bug 41490 - Add missing operations to MacroAssemblerARMv7 + Also, make single, double, quad register numbers in ARMv7Assembler distinct & strongly typed. + + * assembler/ARMv7Assembler.h: + (JSC::ARMRegisters::): + (JSC::ARMRegisters::asSingle): + (JSC::ARMRegisters::asDouble): + (JSC::VFPImmediate::VFPImmediate): + (JSC::VFPImmediate::isValid): + (JSC::VFPImmediate::value): + (JSC::ARMv7Assembler::singleRegisterMask): + (JSC::ARMv7Assembler::doubleRegisterMask): + (JSC::ARMv7Assembler::): + (JSC::ARMv7Assembler::add_S): + (JSC::ARMv7Assembler::neg): + (JSC::ARMv7Assembler::orr_S): + (JSC::ARMv7Assembler::sub): + (JSC::ARMv7Assembler::sub_S): + (JSC::ARMv7Assembler::vadd_F64): + (JSC::ARMv7Assembler::vcmp_F64): + (JSC::ARMv7Assembler::vcvt_F64_S32): + (JSC::ARMv7Assembler::vcvtr_S32_F64): + (JSC::ARMv7Assembler::vdiv_F64): + (JSC::ARMv7Assembler::vldr): + (JSC::ARMv7Assembler::vmov_F64_0): + (JSC::ARMv7Assembler::vmov): + (JSC::ARMv7Assembler::vmul_F64): + (JSC::ARMv7Assembler::vstr): + (JSC::ARMv7Assembler::vsub_F64): + (JSC::ARMv7Assembler::vcvt): + (JSC::ARMv7Assembler::vmem): + * assembler/AbstractMacroAssembler.h: + * assembler/MacroAssemblerARM.h: + * assembler/MacroAssemblerARMv7.h: + (JSC::MacroAssemblerARMv7::fpTempRegisterAsSingle): + (JSC::MacroAssemblerARMv7::neg32): + (JSC::MacroAssemblerARMv7::loadDouble): + (JSC::MacroAssemblerARMv7::divDouble): + (JSC::MacroAssemblerARMv7::convertInt32ToDouble): + (JSC::MacroAssemblerARMv7::branchConvertDoubleToInt32): + (JSC::MacroAssemblerARMv7::zeroDouble): + (JSC::MacroAssemblerARMv7::branchOr32): + (JSC::MacroAssemblerARMv7::set32): + (JSC::MacroAssemblerARMv7::set8): + * assembler/MacroAssemblerMIPS.h: + * assembler/MacroAssemblerX86Common.h: + +2010-07-01 Oliver Hunt + + Reviewed by Geoff Garen. + + Improve reentrancy logic in polymorphic cache stubs + + + + Make the polymorphic cache stubs handle reentrancy + better. + + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + (JSC::getPolymorphicAccessStructureListSlot): + +2010-07-01 Antti Koivisto + + Revert accidental commit. + + * runtime/Collector.cpp: + (JSC::Heap::allocateBlock): + +2010-06-30 Darin Adler + + Reviewed by Adam Barth. + + Add assertion, off by default, for when you forget to do adoptRef + https://bugs.webkit.org/show_bug.cgi?id=41422 + + * wtf/PassRefPtr.h: Tweaked formatting. Added a new adopted + function, called on the pointer by adoptRef, with an empty inline + default version, meant to be overloaded. Unified the inlining + with a macro named REF_DEREF_INLINE to make it clearer what's + going on in the refIfNotNull/derefIfNotNull functions. Renamed + releaseRef to leakRef, but left the old name in for compatibility + for now. + + * wtf/RefCounted.h: Added code to require adoption and assert if + you don't call adoptRef. For now, it is turned off because of the + LOOSE_REF_COUNTED define in this header. Later we can turn it on + once we get everything working without asserting. + +2010-06-29 Michael Saboff + + Reviewed by Darin Adler. + + Bug 41238 - RegExp performance slow on Dromaeo benchmark + + Other javascript engines appear to cache prior results of regular + expression operations. + + Suggest adding some sort of caching mechanism to regular expression + processing. + + Added a single entry cache of match() results to RegExp class. + + Also added performance improvements to UString == operator. + First check the impls for equality. Then get the length of + each of the non-null impls. Next check the sizes for equality. + Then check the data for the case of different impls that point + to the same data (most likely due to substrings from the beginning of + another string). Lastly we check the underlying data for equality. + + * runtime/RegExp.cpp: + (JSC::RegExp::RegExp): + (JSC::RegExp::match): + * runtime/RegExp.h: + * runtime/UString.h: + (JSC::operator==): + +2010-06-29 Nathan Lawrence + + Reviewed by Geoffrey Garen. + + WTF::HashSet iterators are quasi-mutable. Changing the value through + dereferencing an iterator will not change the behavior of methods like + contains or find, but will change the behavior of iterating. + + * wtf/HashSet.h: + (WTF::::begin): + (WTF::::end): + (WTF::::find): + (WTF::::remove): + * wtf/HashTable.h: + +2010-06-29 Martin Robinson + + Reviewed by Xan Lopez. + + [GTK] Clean up the source lists in the GNUMakefile.am files + https://bugs.webkit.org/show_bug.cgi?id=41229 + + Clean up the GNUMakefile.am a little bit. Alphabetize and conglomerate + the source lists. + + * GNUmakefile.am: + +2010-06-29 Caio Marcelo de Oliveira Filho + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix QtScript build after QScriptValuePrivate ctor changes + https://bugs.webkit.org/show_bug.cgi?id=41307 + + * qt/api/qscriptvalue_p.h: + (QScriptValuePrivate::prototype): + * qt/benchmarks/qscriptengine/qscriptengine.pro: + +2010-06-28 Caio Marcelo de Oliveira Filho + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QScriptEngine API should contain a newArray function + https://bugs.webkit.org/show_bug.cgi?id=39115 + + * qt/api/qscriptengine.cpp: + (QScriptEngine::newArray): + * qt/api/qscriptengine.h: + * qt/api/qscriptengine_p.cpp: + (QScriptEnginePrivate::newArray): + * qt/api/qscriptengine_p.h: + * qt/tests/qscriptengine/tst_qscriptengine.cpp: + (tst_QScriptEngine::newArray): + +2010-06-28 Xan Lopez + + Reviewed by Gustavo Noronha. + + Install jsc as jsc-X where X is the major API version to allow + parallel installation of both GTK+ 2.x and 3.x versions. + + * GNUmakefile.am: + +2010-06-28 John Gregg + + Reviewed by Kent Tamura. + + add ENABLE_DIRECTORY_UPLOAD build support + https://bugs.webkit.org/show_bug.cgi?id=41100 + + * Configurations/FeatureDefines.xcconfig: + +2010-06-28 Xan Lopez + + Revert to build jsc, since the tests expect this. + + * GNUmakefile.am: + +2010-06-28 Zoltan Herczeg + + Reviewed by Oliver Hunt. + + Only one character lookahead should be enough for the lexer + https://bugs.webkit.org/show_bug.cgi?id=41213 + + The lexer had 4 character lookahead before, which required + a complex shifting mechanism. This can be improved by using + only one character lookahead for most decisions, and a + peek() function as a fallback when it is absolutely necessary. + + * parser/Lexer.cpp: + (JSC::Lexer::currentCharacter): + (JSC::Lexer::currentOffset): + (JSC::Lexer::setCode): + (JSC::Lexer::shift): + (JSC::Lexer::peek): + (JSC::Lexer::getUnicodeCharacter): + (JSC::Lexer::shiftLineTerminator): + (JSC::Lexer::lastTokenWasRestrKeyword): + (JSC::Lexer::lex): + (JSC::Lexer::scanRegExp): + (JSC::Lexer::skipRegExp): + * parser/Lexer.h: + +2010-06-28 Lucas De Marchi + + Unreviewed build fix. + + [EFL] Build fix for latest version of Ecore library. + Ecore recently changed return type of callbacks from int to Eina_Bool. + + * wtf/efl/MainThreadEfl.cpp: + (WTF::timeoutFired): Return Eina_Bool instead of int. + +2010-06-28 Caio Marcelo de Oliveira Filho + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QScriptValue should have API for accessing object properties + https://bugs.webkit.org/show_bug.cgi?id=40903 + + Make possible to access properties inside QScriptValues. While this + still doesn't support the ResolveLocal parameter, it is already useful + for testing the API. + + The tests from upstream QtScript weren't imported since most of them + depend on the setProperty() function as well. A simple test was created. + + * qt/api/qscriptvalue.cpp: + (QScriptValue::property): + * qt/api/qscriptvalue.h: + (QScriptValue::): + * qt/api/qscriptvalue_p.h: + (QScriptValuePrivate::property): + * qt/tests/qscriptvalue/tst_qscriptvalue.cpp: + (tst_QScriptValue::propertySimple): + * qt/tests/qscriptvalue/tst_qscriptvalue.h: + +2010-06-28 Xan Lopez + + Reviewed by Gustavo Noronha. + + [GTK] Add support for GTK+3 + https://bugs.webkit.org/show_bug.cgi?id=41253 + + Suffix jsc with the API version of the library, so that + libwebkitgtk 1.x and 3.x can install jsc. + + * GNUmakefile.am: + +2010-06-27 Kwang Yul Seo + + Reviewed by Kent Tamura. + + [BREWMP] Turn ENABLE(SINGLE_THREADED) on. + https://bugs.webkit.org/show_bug.cgi?id=41135 + + Brew MP does not support preemptive multi-threading. + Disable threading for Brew MP. + + * wtf/Platform.h: + +2010-06-26 Tony Gentilcore + + Reviewed by Dimitri Glazkov. + + Add an ENABLE_WEB_TIMING option for enabling Web Timing support. + https://bugs.webkit.org/show_bug.cgi?id=38924 + + * Configurations/FeatureDefines.xcconfig: + +2010-06-25 Nathan Lawrence + + Reviewed by Geoffrey Garen. + + We assume in testapi.c that the value aHeapRef refers to will not be + moved. When we have movable objects, this will not be the case. + + * API/tests/testapi.c: + (main): + +2010-06-25 Sheriff Bot + + Unreviewed, rolling out r61924. + http://trac.webkit.org/changeset/61924 + https://bugs.webkit.org/show_bug.cgi?id=41240 + + It was rolled out, but cq+ wasn't removed (Requested by Ossy_ + on #webkit). + + * runtime/RegExp.cpp: + (JSC::RegExp::RegExp): + (JSC::RegExp::create): + * runtime/RegExp.h: + * runtime/RegExpCache.cpp: + (JSC::RegExpCache::lookupOrCreate): + (JSC::RegExpCache::create): + * runtime/RegExpCache.h: + +2010-06-25 Renata Hodovan + + Reviewed by Geoffrey Garen. + + Merge RegExp constructor and RegExp::create methods into one. + Both of function are called with tree parameters and check whether + flags (the third param) is given or not. + Simplify hash lookups in RegExpCache::create with giving them an extra + iterator parameter. + https://bugs.webkit.org/show_bug.cgi?id=41055 + + * runtime/RegExp.cpp: + (JSC::RegExp::RegExp): + * runtime/RegExp.h: + * runtime/RegExpCache.cpp: + (JSC::RegExpCache::lookupOrCreate): + (JSC::RegExpCache::create): + * runtime/RegExpCache.h: + +2010-06-25 Jedrzej Nowacki + + Reviewed by Simon Hausmann. + + Introduce QtScript benchmarks. + + The QtScript performance should be tested regularly. The patch introduces + micro benchmarks for existing API. + + [Qt] Performance of the QtScript API is not tested. + https://bugs.webkit.org/show_bug.cgi?id=40911 + + * qt/benchmarks/benchmarks.pri: Copied from JavaScriptCore/qt/tests/tests.pri. + * qt/benchmarks/benchmarks.pro: Added. + * qt/benchmarks/qscriptengine/qscriptengine.pro: Added. + * qt/benchmarks/qscriptengine/tst_qscriptengine.cpp: Added. + (tst_QScriptEngine::checkSyntax_data): + (tst_QScriptEngine::checkSyntax): + (tst_QScriptEngine::constructor): + (tst_QScriptEngine::evaluateString_data): + (tst_QScriptEngine::evaluateString): + (tst_QScriptEngine::evaluateProgram_data): + (tst_QScriptEngine::evaluateProgram): + (tst_QScriptEngine::newObject): + (tst_QScriptEngine::nullValue): + (tst_QScriptEngine::undefinedValue): + (tst_QScriptEngine::globalObject): + (tst_QScriptEngine::toStringHandle): + * qt/benchmarks/qscriptvalue/qscriptvalue.pro: Added. + * qt/benchmarks/qscriptvalue/tst_qscriptvalue.cpp: Added. + (tst_QScriptValue::tst_QScriptValue): + (tst_QScriptValue::~tst_QScriptValue): + (tst_QScriptValue::values_data): + (tst_QScriptValue::ctorBool): + (tst_QScriptValue::ctorReal): + (tst_QScriptValue::ctorNumber): + (tst_QScriptValue::ctorQString): + (tst_QScriptValue::ctorCString): + (tst_QScriptValue::ctorSpecial): + (tst_QScriptValue::ctorQScriptValue): + (tst_QScriptValue::isValid_data): + (tst_QScriptValue::isValid): + (tst_QScriptValue::isBool_data): + (tst_QScriptValue::isBool): + (tst_QScriptValue::isNumber_data): + (tst_QScriptValue::isNumber): + (tst_QScriptValue::isFunction_data): + (tst_QScriptValue::isFunction): + (tst_QScriptValue::isNull_data): + (tst_QScriptValue::isNull): + (tst_QScriptValue::isString_data): + (tst_QScriptValue::isString): + (tst_QScriptValue::isUndefined_data): + (tst_QScriptValue::isUndefined): + (tst_QScriptValue::isObject_data): + (tst_QScriptValue::isObject): + (tst_QScriptValue::isError_data): + (tst_QScriptValue::isError): + (tst_QScriptValue::toString_data): + (tst_QScriptValue::toString): + (tst_QScriptValue::toNumber_data): + (tst_QScriptValue::toNumber): + (tst_QScriptValue::toBool_data): + (tst_QScriptValue::toBool): + (tst_QScriptValue::toInteger_data): + (tst_QScriptValue::toInteger): + (tst_QScriptValue::toInt32_data): + (tst_QScriptValue::toInt32): + (tst_QScriptValue::toUInt32_data): + (tst_QScriptValue::toUInt32): + (tst_QScriptValue::toUInt16_data): + (tst_QScriptValue::toUInt16): + (tst_QScriptValue::toObject_data): + (tst_QScriptValue::toObject): + (tst_QScriptValue::equals_data): + (tst_QScriptValue::equals): + (tst_QScriptValue::strictlyEquals_data): + (tst_QScriptValue::strictlyEquals): + (tst_QScriptValue::instanceOf_data): + (tst_QScriptValue::instanceOf): + +2010-06-25 Oliver Hunt + + Reviewed by Geoffrey Garen. + + Remove old js parser + https://bugs.webkit.org/show_bug.cgi?id=41222 + + Remove the old yacc parser, this also solves the tiger problem. Which + was a conflict between yacc generated token values and those in the + custom parser + + * Android.mk: + * CMakeLists.txt: + * DerivedSources.make: + * DerivedSources.pro: + * GNUmakefile.am: + * JavaScriptCore.pro: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * parser/Grammar.y: Removed. + * parser/JSParser.cpp: + * parser/JSParser.h: + * parser/Lexer.cpp: + * parser/NodeConstructors.h: + (JSC::Node::Node): + * parser/Parser.cpp: + (JSC::Parser::parse): + * wtf/Platform.h: + 2010-06-25 Jedrzej Nowacki Reviewed by Simon Hausmann. diff --git a/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/JavaScriptCore/Configurations/FeatureDefines.xcconfig index 08d9ef9..8f86fc3 100644 --- a/JavaScriptCore/Configurations/FeatureDefines.xcconfig +++ b/JavaScriptCore/Configurations/FeatureDefines.xcconfig @@ -48,6 +48,7 @@ ENABLE_DATABASE = ENABLE_DATABASE; ENABLE_DATAGRID = ; ENABLE_DATALIST = ENABLE_DATALIST; ENABLE_DEVICE_ORIENTATION = ; +ENABLE_DIRECTORY_UPLOAD = ; ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE; ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; ENABLE_FILTERS = ENABLE_FILTERS; @@ -76,10 +77,12 @@ ENABLE_SVG_FOREIGN_OBJECT = ENABLE_SVG_FOREIGN_OBJECT; ENABLE_SVG_USE = ENABLE_SVG_USE; ENABLE_VIDEO = ENABLE_VIDEO; ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS; +ENABLE_WEB_TIMING = ; ENABLE_WML = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(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_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(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_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); + diff --git a/JavaScriptCore/Configurations/Version.xcconfig b/JavaScriptCore/Configurations/Version.xcconfig index f775a54..2749545 100644 --- a/JavaScriptCore/Configurations/Version.xcconfig +++ b/JavaScriptCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 2; +MINOR_VERSION = 3; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/JavaScriptCore/DerivedSources.make b/JavaScriptCore/DerivedSources.make index 37020f1..2e8adb4 100644 --- a/JavaScriptCore/DerivedSources.make +++ b/JavaScriptCore/DerivedSources.make @@ -39,7 +39,6 @@ all : \ ArrayPrototype.lut.h \ chartables.c \ DatePrototype.lut.h \ - Grammar.cpp \ JSONObject.lut.h \ Lexer.lut.h \ MathObject.lut.h \ @@ -61,16 +60,6 @@ all : \ Lexer.lut.h: create_hash_table Keywords.table $^ > $@ -# JavaScript language grammar - -Grammar.cpp: Grammar.y - bison -d -p jscyy $< -o $@ > bison_out.txt 2>&1 - perl -p -e 'END { if ($$conflict) { unlink "Grammar.cpp"; die; } } $$conflict ||= /conflict/' < bison_out.txt - touch Grammar.cpp.h - touch Grammar.hpp - cat Grammar.cpp.h Grammar.hpp > Grammar.h - rm -f Grammar.cpp.h Grammar.hpp bison_out.txt - # character tables for PCRE chartables.c : dftables diff --git a/JavaScriptCore/DerivedSources.pro b/JavaScriptCore/DerivedSources.pro index 7c5aad8..f358c8b 100644 --- a/JavaScriptCore/DerivedSources.pro +++ b/JavaScriptCore/DerivedSources.pro @@ -26,9 +26,6 @@ LUT_FILES += \ KEYWORDLUT_FILES += \ parser/Keywords.table -JSCBISON += \ - parser/Grammar.y - RVCT_STUB_FILES += \ jit/JITStubs.cpp @@ -68,13 +65,6 @@ keywordlut.commands = perl $$keywordlut.wkScript ${QMAKE_FILE_NAME} -i > ${QMAKE keywordlut.depends = ${QMAKE_FILE_NAME} addExtraCompiler(keywordlut) -# GENERATOR 2: bison grammar -jscbison.output = $${JSC_GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.cpp -jscbison.input = JSCBISON -jscbison.commands = bison -d -p jscyy ${QMAKE_FILE_NAME} -o $${JSC_GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.tab.c && $(MOVE) $${JSC_GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.tab.c ${QMAKE_FILE_OUT} && $(MOVE) $${JSC_GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.tab.h $${JSC_GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.h -jscbison.depends = ${QMAKE_FILE_NAME} -addExtraCompiler(jscbison) - # GENERATOR 3: JIT Stub functions for RVCT rvctstubs.output = $${JSC_GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}Generated${QMAKE_FILE_BASE}_RVCT.h rvctstubs.wkScript = $$PWD/create_jit_stubs diff --git a/JavaScriptCore/GNUmakefile.am b/JavaScriptCore/GNUmakefile.am index 957c743..aefc4fb 100644 --- a/JavaScriptCore/GNUmakefile.am +++ b/JavaScriptCore/GNUmakefile.am @@ -34,7 +34,7 @@ javascriptcore_h_api += \ JavaScriptCore/API/WebKitAvailability.h javascriptcore_built_nosources += \ - DerivedSources/Lexer.lut.h \ + JavaScriptCore/Lexer.lut.h \ JavaScriptCore/RegExpJitTables.h \ JavaScriptCore/runtime/ArrayPrototype.lut.h \ JavaScriptCore/runtime/DatePrototype.lut.h \ @@ -56,8 +56,8 @@ javascriptcore_sources += \ JavaScriptCore/API/JSCallbackFunction.cpp \ JavaScriptCore/API/JSCallbackFunction.h \ JavaScriptCore/API/JSCallbackObject.cpp \ - JavaScriptCore/API/JSCallbackObject.h \ JavaScriptCore/API/JSCallbackObjectFunctions.h \ + JavaScriptCore/API/JSCallbackObject.h \ JavaScriptCore/API/JSClassRef.cpp \ JavaScriptCore/API/JSClassRef.h \ JavaScriptCore/API/JSContextRef.cpp \ @@ -70,68 +70,65 @@ javascriptcore_sources += \ JavaScriptCore/API/JSWeakObjectMapRefInternal.h \ JavaScriptCore/API/OpaqueJSString.cpp \ JavaScriptCore/API/OpaqueJSString.h \ - JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h \ - JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h \ - JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h \ - JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h \ - JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h \ - JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h \ - JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h \ - JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h \ - JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h \ - JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h \ - JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h \ - JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h \ - JavaScriptCore/JavaScriptCorePrefix.h \ - JavaScriptCore/jit/ExecutableAllocator.h \ - JavaScriptCore/jit/JIT.cpp \ - JavaScriptCore/jit/JITOpcodes.cpp \ - JavaScriptCore/jit/JITOpcodes32_64.cpp \ - JavaScriptCore/jit/JITCall.cpp \ - JavaScriptCore/jit/JITCall32_64.cpp \ - JavaScriptCore/jit/JITCode.h \ - JavaScriptCore/jit/JITPropertyAccess.cpp \ - JavaScriptCore/jit/JITPropertyAccess32_64.cpp \ - JavaScriptCore/jit/JITArithmetic.cpp \ - JavaScriptCore/jit/JITArithmetic32_64.cpp \ - JavaScriptCore/jit/ExecutableAllocator.cpp \ - JavaScriptCore/jit/JIT.h \ - JavaScriptCore/jit/JITInlineMethods.h \ - JavaScriptCore/jit/JITStubs.cpp \ - JavaScriptCore/jit/JITStubs.h \ - JavaScriptCore/jit/JITStubCall.h \ - JavaScriptCore/jit/JSInterfaceJIT.h \ - JavaScriptCore/jit/SpecializedThunkJIT.h \ - JavaScriptCore/jit/ThunkGenerators.cpp \ - JavaScriptCore/jit/ThunkGenerators.h \ - JavaScriptCore/bytecode/StructureStubInfo.cpp \ - JavaScriptCore/bytecode/StructureStubInfo.h \ + JavaScriptCore/assembler/AbstractMacroAssembler.h \ + JavaScriptCore/assembler/ARMAssembler.cpp \ + JavaScriptCore/assembler/ARMAssembler.h \ + JavaScriptCore/assembler/AssemblerBuffer.h \ + JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h \ + JavaScriptCore/assembler/CodeLocation.h \ + JavaScriptCore/assembler/LinkBuffer.h \ + JavaScriptCore/assembler/MacroAssemblerARM.cpp \ + JavaScriptCore/assembler/MacroAssemblerARM.h \ + JavaScriptCore/assembler/MacroAssemblerCodeRef.h \ + JavaScriptCore/assembler/MacroAssembler.h \ + JavaScriptCore/assembler/MacroAssemblerX86_64.h \ + JavaScriptCore/assembler/MacroAssemblerX86Common.h \ + JavaScriptCore/assembler/MacroAssemblerX86.h \ + JavaScriptCore/assembler/RepatchBuffer.h \ + JavaScriptCore/assembler/X86Assembler.h \ JavaScriptCore/bytecode/CodeBlock.cpp \ JavaScriptCore/bytecode/CodeBlock.h \ - JavaScriptCore/bytecode/JumpTable.cpp \ - JavaScriptCore/bytecode/JumpTable.h \ JavaScriptCore/bytecode/EvalCodeCache.h \ JavaScriptCore/bytecode/Instruction.h \ - JavaScriptCore/bytecompiler/Label.h \ - JavaScriptCore/interpreter/Interpreter.cpp \ - JavaScriptCore/interpreter/Interpreter.h \ + JavaScriptCore/bytecode/JumpTable.cpp \ + JavaScriptCore/bytecode/JumpTable.h \ JavaScriptCore/bytecode/Opcode.cpp \ JavaScriptCore/bytecode/Opcode.h \ - JavaScriptCore/interpreter/Register.h \ - JavaScriptCore/bytecompiler/RegisterID.h \ JavaScriptCore/bytecode/SamplingTool.cpp \ JavaScriptCore/bytecode/SamplingTool.h \ + JavaScriptCore/bytecode/StructureStubInfo.cpp \ + JavaScriptCore/bytecode/StructureStubInfo.h \ + JavaScriptCore/bytecompiler/BytecodeGenerator.cpp \ + JavaScriptCore/bytecompiler/BytecodeGenerator.h \ + JavaScriptCore/bytecompiler/Label.h \ + JavaScriptCore/bytecompiler/LabelScope.h \ + JavaScriptCore/bytecompiler/NodesCodegen.cpp \ + JavaScriptCore/bytecompiler/RegisterID.h \ JavaScriptCore/config.h \ JavaScriptCore/debugger/DebuggerActivation.cpp \ JavaScriptCore/debugger/DebuggerActivation.h \ JavaScriptCore/debugger/DebuggerCallFrame.cpp \ JavaScriptCore/debugger/DebuggerCallFrame.h \ + JavaScriptCore/debugger/Debugger.cpp \ + JavaScriptCore/debugger/Debugger.h \ + JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h \ + JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h \ + JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h \ + JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h \ + JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h \ + JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h \ + JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h \ + JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h \ + JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h \ + JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h \ + JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h \ + JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h \ JavaScriptCore/icu/unicode/parseerr.h \ JavaScriptCore/icu/unicode/platform.h \ JavaScriptCore/icu/unicode/putil.h \ JavaScriptCore/icu/unicode/uchar.h \ - JavaScriptCore/icu/unicode/ucnv.h \ JavaScriptCore/icu/unicode/ucnv_err.h \ + JavaScriptCore/icu/unicode/ucnv.h \ JavaScriptCore/icu/unicode/ucol.h \ JavaScriptCore/icu/unicode/uconfig.h \ JavaScriptCore/icu/unicode/uenum.h \ @@ -142,245 +139,45 @@ javascriptcore_sources += \ JavaScriptCore/icu/unicode/urename.h \ JavaScriptCore/icu/unicode/uset.h \ JavaScriptCore/icu/unicode/ustring.h \ - JavaScriptCore/icu/unicode/utf.h \ JavaScriptCore/icu/unicode/utf16.h \ JavaScriptCore/icu/unicode/utf8.h \ + JavaScriptCore/icu/unicode/utf.h \ JavaScriptCore/icu/unicode/utf_old.h \ JavaScriptCore/icu/unicode/utypes.h \ JavaScriptCore/icu/unicode/uversion.h \ - JavaScriptCore/assembler/ARMAssembler.h \ - JavaScriptCore/assembler/ARMAssembler.cpp \ - JavaScriptCore/assembler/X86Assembler.h \ - JavaScriptCore/assembler/AbstractMacroAssembler.h \ - JavaScriptCore/assembler/AssemblerBuffer.h \ - JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h \ - JavaScriptCore/assembler/CodeLocation.h \ - JavaScriptCore/assembler/LinkBuffer.h \ - JavaScriptCore/assembler/MacroAssembler.h \ - JavaScriptCore/assembler/MacroAssemblerARM.h \ - JavaScriptCore/assembler/MacroAssemblerARM.cpp \ - JavaScriptCore/assembler/MacroAssemblerCodeRef.h \ - JavaScriptCore/assembler/MacroAssemblerX86.h \ - JavaScriptCore/assembler/MacroAssemblerX86_64.h \ - JavaScriptCore/assembler/MacroAssemblerX86Common.h \ - JavaScriptCore/assembler/RepatchBuffer.h \ - JavaScriptCore/os-win32/stdbool.h \ - JavaScriptCore/os-win32/stdint.h \ - JavaScriptCore/pcre/pcre.h \ - JavaScriptCore/pcre/pcre_compile.cpp \ - JavaScriptCore/pcre/pcre_exec.cpp \ - JavaScriptCore/pcre/pcre_internal.h \ - JavaScriptCore/pcre/pcre_tables.cpp \ - JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp \ - JavaScriptCore/pcre/pcre_xclass.cpp \ - JavaScriptCore/pcre/ucpinternal.h \ - JavaScriptCore/profiler/CallIdentifier.h \ - JavaScriptCore/profiler/Profile.cpp \ - JavaScriptCore/profiler/Profile.h \ - JavaScriptCore/profiler/ProfileGenerator.cpp \ - JavaScriptCore/profiler/ProfileGenerator.h \ - JavaScriptCore/profiler/ProfileNode.cpp \ - JavaScriptCore/profiler/ProfileNode.h \ - JavaScriptCore/profiler/Profiler.cpp \ - JavaScriptCore/profiler/Profiler.h \ JavaScriptCore/interpreter/CachedCall.h \ + JavaScriptCore/interpreter/CallFrameClosure.h \ JavaScriptCore/interpreter/CallFrame.cpp \ JavaScriptCore/interpreter/CallFrame.h \ - JavaScriptCore/interpreter/CallFrameClosure.h \ - JavaScriptCore/runtime/CachedTranscendentalFunction.h \ - JavaScriptCore/runtime/ExceptionHelpers.cpp \ - JavaScriptCore/runtime/ExceptionHelpers.h \ - JavaScriptCore/runtime/Executable.cpp \ - JavaScriptCore/runtime/Executable.h \ - JavaScriptCore/runtime/InitializeThreading.cpp \ - JavaScriptCore/runtime/InitializeThreading.h \ - JavaScriptCore/runtime/JSActivation.cpp \ - JavaScriptCore/runtime/JSActivation.h \ - JavaScriptCore/runtime/JSByteArray.cpp \ - JavaScriptCore/runtime/JSByteArray.h \ - JavaScriptCore/runtime/JSGlobalData.cpp \ - JavaScriptCore/runtime/JSGlobalData.h \ - JavaScriptCore/runtime/JSNotAnObject.cpp \ - JavaScriptCore/runtime/JSNotAnObject.h \ - JavaScriptCore/runtime/JSONObject.cpp \ - JavaScriptCore/runtime/JSONObject.h \ - JavaScriptCore/runtime/JSPropertyNameIterator.cpp \ - JavaScriptCore/runtime/JSPropertyNameIterator.h \ - JavaScriptCore/runtime/JSStringBuilder.h \ - JavaScriptCore/runtime/JSZombie.h \ - JavaScriptCore/runtime/LiteralParser.cpp \ - JavaScriptCore/runtime/LiteralParser.h \ - JavaScriptCore/runtime/MarkStack.cpp \ - JavaScriptCore/runtime/MarkStack.h \ - JavaScriptCore/runtime/NumericStrings.h \ - JavaScriptCore/runtime/PropertyDescriptor.h \ - JavaScriptCore/runtime/PropertyDescriptor.cpp \ - JavaScriptCore/runtime/SmallStrings.cpp \ - JavaScriptCore/runtime/SmallStrings.h \ - JavaScriptCore/runtime/StringBuilder.h \ - JavaScriptCore/runtime/Structure.cpp \ - JavaScriptCore/runtime/Structure.h \ - JavaScriptCore/runtime/StructureChain.cpp \ - JavaScriptCore/runtime/StructureChain.h \ - JavaScriptCore/runtime/StructureTransitionTable.h \ - JavaScriptCore/runtime/Terminator.h \ - JavaScriptCore/runtime/TimeoutChecker.cpp \ - JavaScriptCore/runtime/TimeoutChecker.h \ - JavaScriptCore/runtime/JSTypeInfo.h \ - JavaScriptCore/runtime/WeakGCMap.h \ - JavaScriptCore/runtime/WeakGCPtr.h \ - JavaScriptCore/wtf/ASCIICType.h \ - JavaScriptCore/wtf/AVLTree.h \ - JavaScriptCore/wtf/AlwaysInline.h \ - JavaScriptCore/wtf/Assertions.cpp \ - JavaScriptCore/wtf/Assertions.h \ - JavaScriptCore/wtf/Atomics.h \ - JavaScriptCore/wtf/ByteArray.cpp \ - JavaScriptCore/wtf/ByteArray.h \ - JavaScriptCore/wtf/CrossThreadRefCounted.h \ - JavaScriptCore/wtf/CurrentTime.cpp \ - JavaScriptCore/wtf/CurrentTime.h \ - JavaScriptCore/wtf/DateMath.cpp \ - JavaScriptCore/wtf/DateMath.h \ - JavaScriptCore/wtf/Deque.h \ - JavaScriptCore/wtf/DisallowCType.h \ - JavaScriptCore/wtf/Forward.h \ - JavaScriptCore/wtf/GetPtr.h \ - JavaScriptCore/wtf/HashCountedSet.h \ - JavaScriptCore/wtf/HashFunctions.h \ - JavaScriptCore/wtf/HashIterators.h \ - JavaScriptCore/wtf/HashMap.h \ - JavaScriptCore/wtf/HashSet.h \ - JavaScriptCore/wtf/HashTable.cpp \ - JavaScriptCore/wtf/HashTable.h \ - JavaScriptCore/wtf/HashTraits.h \ - JavaScriptCore/wtf/ListHashSet.h \ - JavaScriptCore/wtf/ListRefPtr.h \ - JavaScriptCore/wtf/Locker.h \ - JavaScriptCore/wtf/MD5.cpp \ - JavaScriptCore/wtf/MD5.h \ - JavaScriptCore/wtf/MainThread.cpp \ - JavaScriptCore/wtf/MainThread.h \ - JavaScriptCore/wtf/MathExtras.h \ - JavaScriptCore/wtf/MessageQueue.h \ - JavaScriptCore/wtf/Noncopyable.h \ - JavaScriptCore/wtf/NotFound.h \ - JavaScriptCore/wtf/OwnArrayPtr.h \ - JavaScriptCore/wtf/OwnFastMallocPtr.h \ - JavaScriptCore/wtf/OwnPtr.h \ - JavaScriptCore/wtf/OwnPtrCommon.h \ - JavaScriptCore/wtf/PassOwnPtr.h \ - JavaScriptCore/wtf/PassRefPtr.h \ - JavaScriptCore/wtf/Platform.h \ - JavaScriptCore/wtf/PossiblyNull.h \ - JavaScriptCore/wtf/RandomNumber.cpp \ - JavaScriptCore/wtf/RandomNumber.h \ - JavaScriptCore/wtf/RandomNumberSeed.h \ - JavaScriptCore/wtf/RefCounted.h \ - JavaScriptCore/wtf/RefCountedLeakCounter.cpp \ - JavaScriptCore/wtf/RefCountedLeakCounter.h \ - JavaScriptCore/wtf/RefPtr.h \ - JavaScriptCore/wtf/RefPtrHashMap.h \ - JavaScriptCore/wtf/RetainPtr.h \ - JavaScriptCore/wtf/SegmentedVector.h \ - JavaScriptCore/wtf/StaticConstructors.h \ - JavaScriptCore/wtf/StdLibExtras.h \ - JavaScriptCore/wtf/StringExtras.h \ - JavaScriptCore/wtf/StringHashFunctions.h \ - JavaScriptCore/wtf/TCPackedCache.h \ - JavaScriptCore/wtf/TCPageMap.h \ - JavaScriptCore/wtf/TCSpinLock.h \ - JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp \ - JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h \ - JavaScriptCore/wtf/Threading.cpp \ - JavaScriptCore/wtf/Threading.h \ - JavaScriptCore/wtf/ThreadingPrimitives.h \ - JavaScriptCore/wtf/ThreadingPthreads.cpp \ - JavaScriptCore/wtf/ThreadSafeShared.h \ - JavaScriptCore/wtf/ThreadSpecific.h \ - JavaScriptCore/wtf/TypeTraits.cpp \ - JavaScriptCore/wtf/TypeTraits.h \ - JavaScriptCore/wtf/UnusedParam.h \ - JavaScriptCore/wtf/ValueCheck.h \ - JavaScriptCore/wtf/Vector.h \ - JavaScriptCore/wtf/VectorTraits.h \ - JavaScriptCore/wtf/WTFThreadData.cpp \ - JavaScriptCore/wtf/WTFThreadData.h \ - JavaScriptCore/wtf/gobject/GOwnPtr.cpp \ - JavaScriptCore/wtf/gobject/GOwnPtr.h \ - JavaScriptCore/wtf/gobject/GRefPtr.cpp \ - JavaScriptCore/wtf/gobject/GRefPtr.h \ - JavaScriptCore/wtf/gtk/MainThreadGtk.cpp \ - JavaScriptCore/wtf/gtk/ThreadingGtk.cpp \ - JavaScriptCore/wtf/text/AtomicString.cpp \ - JavaScriptCore/wtf/text/AtomicString.h \ - JavaScriptCore/wtf/text/AtomicStringImpl.h \ - JavaScriptCore/wtf/text/CString.cpp \ - JavaScriptCore/wtf/text/CString.h \ - JavaScriptCore/wtf/text/StringBuffer.h \ - JavaScriptCore/wtf/text/StringHash.h \ - JavaScriptCore/wtf/text/StringImpl.cpp \ - JavaScriptCore/wtf/text/StringImpl.h \ - JavaScriptCore/wtf/text/StringImplBase.h \ - JavaScriptCore/wtf/text/StringStatics.cpp \ - JavaScriptCore/wtf/text/WTFString.cpp \ - JavaScriptCore/wtf/text/WTFString.h \ - JavaScriptCore/wtf/unicode/Collator.h \ - JavaScriptCore/wtf/unicode/CollatorDefault.cpp \ - JavaScriptCore/wtf/unicode/UTF8.cpp \ - JavaScriptCore/wtf/unicode/UTF8.h \ - JavaScriptCore/wtf/unicode/Unicode.h - -if TARGET_WIN32 -javascriptcore_sources += \ - JavaScriptCore/wtf/ThreadSpecificWin.cpp \ - JavaScriptCore/jit/ExecutableAllocatorWin.cpp \ - JavaScriptCore/runtime/MarkStackWin.cpp -else -javascriptcore_sources += \ - JavaScriptCore/jit/ExecutableAllocatorPosix.cpp \ - JavaScriptCore/runtime/MarkStackPosix.cpp -endif - -# ---- -# icu unicode backend -# ---- -if USE_ICU_UNICODE -javascriptcore_sources += \ - JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp \ - JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h -endif # USE_ICU_UNICODE - -# ---- -# glib unicode backend -# ---- -if USE_GLIB_UNICODE -javascriptcore_sources += \ - JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h \ - JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp \ - JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h -endif - -javascriptcore_sources += \ - JavaScriptCore/wtf/VMTags.h \ - JavaScriptCore/yarr/RegexCompiler.cpp \ - JavaScriptCore/yarr/RegexCompiler.h \ - JavaScriptCore/yarr/RegexInterpreter.cpp \ - JavaScriptCore/yarr/RegexInterpreter.h \ - JavaScriptCore/yarr/RegexJIT.cpp \ - JavaScriptCore/yarr/RegexJIT.h \ - JavaScriptCore/yarr/RegexParser.h \ - JavaScriptCore/yarr/RegexPattern.h - -javascriptcore_sources += \ + JavaScriptCore/interpreter/Interpreter.cpp \ + JavaScriptCore/interpreter/Interpreter.h \ JavaScriptCore/interpreter/RegisterFile.cpp \ JavaScriptCore/interpreter/RegisterFile.h \ - JavaScriptCore/bytecompiler/BytecodeGenerator.cpp \ - JavaScriptCore/bytecompiler/BytecodeGenerator.h \ - JavaScriptCore/bytecompiler/NodesCodegen.cpp \ - JavaScriptCore/bytecompiler/LabelScope.h \ - JavaScriptCore/debugger/Debugger.cpp \ - JavaScriptCore/debugger/Debugger.h \ + JavaScriptCore/interpreter/Register.h \ + JavaScriptCore/JavaScriptCorePrefix.h \ + JavaScriptCore/jit/ExecutableAllocator.cpp \ + JavaScriptCore/jit/ExecutableAllocator.h \ + JavaScriptCore/jit/JITArithmetic32_64.cpp \ + JavaScriptCore/jit/JITArithmetic.cpp \ + JavaScriptCore/jit/JITCall32_64.cpp \ + JavaScriptCore/jit/JITCall.cpp \ + JavaScriptCore/jit/JITCode.h \ + JavaScriptCore/jit/JIT.cpp \ + JavaScriptCore/jit/JIT.h \ + JavaScriptCore/jit/JITInlineMethods.h \ + JavaScriptCore/jit/JITOpcodes32_64.cpp \ + JavaScriptCore/jit/JITOpcodes.cpp \ + JavaScriptCore/jit/JITPropertyAccess32_64.cpp \ + JavaScriptCore/jit/JITPropertyAccess.cpp \ + JavaScriptCore/jit/JITStubCall.h \ + JavaScriptCore/jit/JITStubs.cpp \ + JavaScriptCore/jit/JITStubs.h \ + JavaScriptCore/jit/JSInterfaceJIT.h \ + JavaScriptCore/jit/SpecializedThunkJIT.h \ + JavaScriptCore/jit/ThunkGenerators.cpp \ + JavaScriptCore/jit/ThunkGenerators.h \ + JavaScriptCore/os-win32/stdbool.h \ + JavaScriptCore/os-win32/stdint.h \ JavaScriptCore/parser/ASTBuilder.h \ JavaScriptCore/parser/JSParser.cpp \ JavaScriptCore/parser/JSParser.h \ @@ -390,14 +187,31 @@ javascriptcore_sources += \ JavaScriptCore/parser/NodeInfo.h \ JavaScriptCore/parser/Nodes.cpp \ JavaScriptCore/parser/Nodes.h \ - JavaScriptCore/parser/Parser.cpp \ - JavaScriptCore/parser/Parser.h \ JavaScriptCore/parser/ParserArena.cpp \ JavaScriptCore/parser/ParserArena.h \ + JavaScriptCore/parser/Parser.cpp \ + JavaScriptCore/parser/Parser.h \ JavaScriptCore/parser/ResultType.h \ JavaScriptCore/parser/SourceCode.h \ JavaScriptCore/parser/SourceProvider.h \ JavaScriptCore/parser/SyntaxChecker.h \ + JavaScriptCore/pcre/pcre_compile.cpp \ + JavaScriptCore/pcre/pcre_exec.cpp \ + JavaScriptCore/pcre/pcre.h \ + JavaScriptCore/pcre/pcre_internal.h \ + JavaScriptCore/pcre/pcre_tables.cpp \ + JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp \ + JavaScriptCore/pcre/pcre_xclass.cpp \ + JavaScriptCore/pcre/ucpinternal.h \ + JavaScriptCore/profiler/CallIdentifier.h \ + JavaScriptCore/profiler/Profile.cpp \ + JavaScriptCore/profiler/ProfileGenerator.cpp \ + JavaScriptCore/profiler/ProfileGenerator.h \ + JavaScriptCore/profiler/Profile.h \ + JavaScriptCore/profiler/ProfileNode.cpp \ + JavaScriptCore/profiler/ProfileNode.h \ + JavaScriptCore/profiler/Profiler.cpp \ + JavaScriptCore/profiler/Profiler.h \ JavaScriptCore/runtime/ArgList.cpp \ JavaScriptCore/runtime/ArgList.h \ JavaScriptCore/runtime/Arguments.cpp \ @@ -413,6 +227,7 @@ javascriptcore_sources += \ JavaScriptCore/runtime/BooleanObject.h \ JavaScriptCore/runtime/BooleanPrototype.cpp \ JavaScriptCore/runtime/BooleanPrototype.h \ + JavaScriptCore/runtime/CachedTranscendentalFunction.h \ JavaScriptCore/runtime/CallData.cpp \ JavaScriptCore/runtime/CallData.h \ JavaScriptCore/runtime/ClassInfo.h \ @@ -421,6 +236,7 @@ javascriptcore_sources += \ JavaScriptCore/runtime/CollectorHeapIterator.h \ JavaScriptCore/runtime/CommonIdentifiers.cpp \ JavaScriptCore/runtime/CommonIdentifiers.h \ + JavaScriptCore/runtime/Completion.cpp \ JavaScriptCore/runtime/Completion.h \ JavaScriptCore/runtime/ConstructData.cpp \ JavaScriptCore/runtime/ConstructData.h \ @@ -428,19 +244,23 @@ javascriptcore_sources += \ JavaScriptCore/runtime/DateConstructor.h \ JavaScriptCore/runtime/DateConversion.cpp \ JavaScriptCore/runtime/DateConversion.h \ + JavaScriptCore/runtime/DateInstanceCache.h \ JavaScriptCore/runtime/DateInstance.cpp \ JavaScriptCore/runtime/DateInstance.h \ - JavaScriptCore/runtime/DateInstanceCache.h \ JavaScriptCore/runtime/DatePrototype.cpp \ JavaScriptCore/runtime/DatePrototype.h \ - JavaScriptCore/runtime/Error.cpp \ - JavaScriptCore/runtime/Error.h \ JavaScriptCore/runtime/ErrorConstructor.cpp \ JavaScriptCore/runtime/ErrorConstructor.h \ + JavaScriptCore/runtime/Error.cpp \ + JavaScriptCore/runtime/Error.h \ JavaScriptCore/runtime/ErrorInstance.cpp \ JavaScriptCore/runtime/ErrorInstance.h \ JavaScriptCore/runtime/ErrorPrototype.cpp \ JavaScriptCore/runtime/ErrorPrototype.h \ + JavaScriptCore/runtime/ExceptionHelpers.cpp \ + JavaScriptCore/runtime/ExceptionHelpers.h \ + JavaScriptCore/runtime/Executable.cpp \ + JavaScriptCore/runtime/Executable.h \ JavaScriptCore/runtime/FunctionConstructor.cpp \ JavaScriptCore/runtime/FunctionConstructor.h \ JavaScriptCore/runtime/FunctionPrototype.cpp \ @@ -451,44 +271,64 @@ javascriptcore_sources += \ JavaScriptCore/runtime/GlobalEvalFunction.h \ JavaScriptCore/runtime/Identifier.cpp \ JavaScriptCore/runtime/Identifier.h \ + JavaScriptCore/runtime/InitializeThreading.cpp \ + JavaScriptCore/runtime/InitializeThreading.h \ JavaScriptCore/runtime/InternalFunction.cpp \ JavaScriptCore/runtime/InternalFunction.h \ - JavaScriptCore/runtime/Completion.cpp \ - JavaScriptCore/runtime/JSArray.cpp \ - JavaScriptCore/runtime/JSArray.h \ + JavaScriptCore/runtime/JSActivation.cpp \ + JavaScriptCore/runtime/JSActivation.h \ JavaScriptCore/runtime/JSAPIValueWrapper.cpp \ JavaScriptCore/runtime/JSAPIValueWrapper.h \ + JavaScriptCore/runtime/JSArray.cpp \ + JavaScriptCore/runtime/JSArray.h \ + JavaScriptCore/runtime/JSByteArray.cpp \ + JavaScriptCore/runtime/JSByteArray.h \ JavaScriptCore/runtime/JSCell.cpp \ JavaScriptCore/runtime/JSCell.h \ JavaScriptCore/runtime/JSFunction.cpp \ JavaScriptCore/runtime/JSFunction.h \ + JavaScriptCore/runtime/JSGlobalData.cpp \ + JavaScriptCore/runtime/JSGlobalData.h \ JavaScriptCore/runtime/JSGlobalObject.cpp \ - JavaScriptCore/runtime/JSGlobalObject.h \ JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp \ JavaScriptCore/runtime/JSGlobalObjectFunctions.h \ + JavaScriptCore/runtime/JSGlobalObject.h \ JavaScriptCore/runtime/JSImmediate.cpp \ JavaScriptCore/runtime/JSImmediate.h \ JavaScriptCore/runtime/JSLock.cpp \ JavaScriptCore/runtime/JSLock.h \ + JavaScriptCore/runtime/JSNotAnObject.cpp \ + JavaScriptCore/runtime/JSNotAnObject.h \ JavaScriptCore/runtime/JSNumberCell.cpp \ JavaScriptCore/runtime/JSNumberCell.h \ JavaScriptCore/runtime/JSObject.cpp \ + JavaScriptCore/runtime/JSObject.h \ JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp \ JavaScriptCore/runtime/JSObjectWithGlobalObject.h \ - JavaScriptCore/runtime/JSObject.h \ + JavaScriptCore/runtime/JSONObject.cpp \ + JavaScriptCore/runtime/JSONObject.h \ + JavaScriptCore/runtime/JSPropertyNameIterator.cpp \ + JavaScriptCore/runtime/JSPropertyNameIterator.h \ JavaScriptCore/runtime/JSStaticScopeObject.cpp \ JavaScriptCore/runtime/JSStaticScopeObject.h \ + JavaScriptCore/runtime/JSStringBuilder.h \ JavaScriptCore/runtime/JSString.cpp \ JavaScriptCore/runtime/JSString.h \ JavaScriptCore/runtime/JSType.h \ + JavaScriptCore/runtime/JSTypeInfo.h \ JavaScriptCore/runtime/JSValue.cpp \ JavaScriptCore/runtime/JSValue.h \ JavaScriptCore/runtime/JSVariableObject.cpp \ JavaScriptCore/runtime/JSVariableObject.h \ JavaScriptCore/runtime/JSWrapperObject.cpp \ JavaScriptCore/runtime/JSWrapperObject.h \ + JavaScriptCore/runtime/JSZombie.h \ + JavaScriptCore/runtime/LiteralParser.cpp \ + JavaScriptCore/runtime/LiteralParser.h \ JavaScriptCore/runtime/Lookup.cpp \ JavaScriptCore/runtime/Lookup.h \ + JavaScriptCore/runtime/MarkStack.cpp \ + JavaScriptCore/runtime/MarkStack.h \ JavaScriptCore/runtime/MathObject.cpp \ JavaScriptCore/runtime/MathObject.h \ JavaScriptCore/runtime/NativeErrorConstructor.cpp \ @@ -502,12 +342,15 @@ javascriptcore_sources += \ JavaScriptCore/runtime/NumberObject.h \ JavaScriptCore/runtime/NumberPrototype.cpp \ JavaScriptCore/runtime/NumberPrototype.h \ + JavaScriptCore/runtime/NumericStrings.h \ JavaScriptCore/runtime/ObjectConstructor.cpp \ JavaScriptCore/runtime/ObjectConstructor.h \ JavaScriptCore/runtime/ObjectPrototype.cpp \ JavaScriptCore/runtime/ObjectPrototype.h \ JavaScriptCore/runtime/Operations.cpp \ JavaScriptCore/runtime/Operations.h \ + JavaScriptCore/runtime/PropertyDescriptor.cpp \ + JavaScriptCore/runtime/PropertyDescriptor.h \ JavaScriptCore/runtime/PropertyMapHashTable.h \ JavaScriptCore/runtime/PropertyNameArray.cpp \ JavaScriptCore/runtime/PropertyNameArray.h \ @@ -517,12 +360,12 @@ javascriptcore_sources += \ JavaScriptCore/runtime/PrototypeFunction.cpp \ JavaScriptCore/runtime/PrototypeFunction.h \ JavaScriptCore/runtime/PutPropertySlot.h \ - JavaScriptCore/runtime/RegExp.cpp \ - JavaScriptCore/runtime/RegExp.h \ JavaScriptCore/runtime/RegExpCache.cpp \ JavaScriptCore/runtime/RegExpCache.h \ JavaScriptCore/runtime/RegExpConstructor.cpp \ JavaScriptCore/runtime/RegExpConstructor.h \ + JavaScriptCore/runtime/RegExp.cpp \ + JavaScriptCore/runtime/RegExp.h \ JavaScriptCore/runtime/RegExpKey.h \ JavaScriptCore/runtime/RegExpMatchesArray.h \ JavaScriptCore/runtime/RegExpObject.cpp \ @@ -534,6 +377,9 @@ javascriptcore_sources += \ JavaScriptCore/runtime/ScopeChain.cpp \ JavaScriptCore/runtime/ScopeChain.h \ JavaScriptCore/runtime/ScopeChainMark.h \ + JavaScriptCore/runtime/SmallStrings.cpp \ + JavaScriptCore/runtime/SmallStrings.h \ + JavaScriptCore/runtime/StringBuilder.h \ JavaScriptCore/runtime/StringConstructor.cpp \ JavaScriptCore/runtime/StringConstructor.h \ JavaScriptCore/runtime/StringObject.cpp \ @@ -541,34 +387,172 @@ javascriptcore_sources += \ JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h \ JavaScriptCore/runtime/StringPrototype.cpp \ JavaScriptCore/runtime/StringPrototype.h \ + JavaScriptCore/runtime/StructureChain.cpp \ + JavaScriptCore/runtime/StructureChain.h \ + JavaScriptCore/runtime/Structure.cpp \ + JavaScriptCore/runtime/Structure.h \ + JavaScriptCore/runtime/StructureTransitionTable.h \ JavaScriptCore/runtime/SymbolTable.h \ + JavaScriptCore/runtime/Terminator.h \ + JavaScriptCore/runtime/TimeoutChecker.cpp \ + JavaScriptCore/runtime/TimeoutChecker.h \ JavaScriptCore/runtime/Tracing.h \ JavaScriptCore/runtime/UString.cpp \ JavaScriptCore/runtime/UString.h \ JavaScriptCore/runtime/UStringImpl.h \ + JavaScriptCore/runtime/WeakGCMap.h \ + JavaScriptCore/runtime/WeakGCPtr.h \ JavaScriptCore/runtime/WeakRandom.h \ + JavaScriptCore/wtf/AlwaysInline.h \ + JavaScriptCore/wtf/ASCIICType.h \ + JavaScriptCore/wtf/Assertions.cpp \ + JavaScriptCore/wtf/Assertions.h \ + JavaScriptCore/wtf/Atomics.h \ + JavaScriptCore/wtf/AVLTree.h \ + JavaScriptCore/wtf/ByteArray.cpp \ + JavaScriptCore/wtf/ByteArray.h \ + JavaScriptCore/wtf/CrossThreadRefCounted.h \ + JavaScriptCore/wtf/CurrentTime.cpp \ + JavaScriptCore/wtf/CurrentTime.h \ + JavaScriptCore/wtf/DateMath.cpp \ + JavaScriptCore/wtf/DateMath.h \ + JavaScriptCore/wtf/Deque.h \ + JavaScriptCore/wtf/DisallowCType.h \ + JavaScriptCore/wtf/dtoa.cpp \ + JavaScriptCore/wtf/dtoa.h \ JavaScriptCore/wtf/FastAllocBase.h \ JavaScriptCore/wtf/FastMalloc.cpp \ JavaScriptCore/wtf/FastMalloc.h \ + JavaScriptCore/wtf/Forward.h \ + JavaScriptCore/wtf/GetPtr.h \ + JavaScriptCore/wtf/gobject/GOwnPtr.cpp \ + JavaScriptCore/wtf/gobject/GOwnPtr.h \ + JavaScriptCore/wtf/gobject/GRefPtr.cpp \ + JavaScriptCore/wtf/gobject/GRefPtr.h \ + JavaScriptCore/wtf/gtk/MainThreadGtk.cpp \ + JavaScriptCore/wtf/gtk/ThreadingGtk.cpp \ + JavaScriptCore/wtf/HashCountedSet.h \ + JavaScriptCore/wtf/HashFunctions.h \ + JavaScriptCore/wtf/HashIterators.h \ + JavaScriptCore/wtf/HashMap.h \ + JavaScriptCore/wtf/HashSet.h \ + JavaScriptCore/wtf/HashTable.cpp \ + JavaScriptCore/wtf/HashTable.h \ + JavaScriptCore/wtf/HashTraits.h \ + JavaScriptCore/wtf/ListHashSet.h \ + JavaScriptCore/wtf/ListRefPtr.h \ + JavaScriptCore/wtf/Locker.h \ + JavaScriptCore/wtf/MainThread.cpp \ + JavaScriptCore/wtf/MainThread.h \ JavaScriptCore/wtf/MallocZoneSupport.h \ + JavaScriptCore/wtf/MathExtras.h \ + JavaScriptCore/wtf/MD5.cpp \ + JavaScriptCore/wtf/MD5.h \ + JavaScriptCore/wtf/MessageQueue.h \ + JavaScriptCore/wtf/Noncopyable.h \ + JavaScriptCore/wtf/NotFound.h \ + JavaScriptCore/wtf/OwnArrayPtr.h \ + JavaScriptCore/wtf/OwnFastMallocPtr.h \ + JavaScriptCore/wtf/OwnPtrCommon.h \ + JavaScriptCore/wtf/OwnPtr.h \ + JavaScriptCore/wtf/PassOwnPtr.h \ + JavaScriptCore/wtf/PassRefPtr.h \ + JavaScriptCore/wtf/Platform.h \ + JavaScriptCore/wtf/PossiblyNull.h \ + JavaScriptCore/wtf/RandomNumber.cpp \ + JavaScriptCore/wtf/RandomNumber.h \ + JavaScriptCore/wtf/RandomNumberSeed.h \ + JavaScriptCore/wtf/RefCounted.h \ + JavaScriptCore/wtf/RefCountedLeakCounter.cpp \ + JavaScriptCore/wtf/RefCountedLeakCounter.h \ + JavaScriptCore/wtf/RefPtr.h \ + JavaScriptCore/wtf/RefPtrHashMap.h \ + JavaScriptCore/wtf/RetainPtr.h \ + JavaScriptCore/wtf/SegmentedVector.h \ + JavaScriptCore/wtf/StaticConstructors.h \ + JavaScriptCore/wtf/StdLibExtras.h \ + JavaScriptCore/wtf/StringExtras.h \ + JavaScriptCore/wtf/StringHashFunctions.h \ + JavaScriptCore/wtf/TCPackedCache.h \ + JavaScriptCore/wtf/TCPageMap.h \ + JavaScriptCore/wtf/TCSpinLock.h \ JavaScriptCore/wtf/TCSystemAlloc.cpp \ JavaScriptCore/wtf/TCSystemAlloc.h \ - JavaScriptCore/wtf/dtoa.cpp \ - JavaScriptCore/wtf/dtoa.h + JavaScriptCore/wtf/text/AtomicString.cpp \ + JavaScriptCore/wtf/text/AtomicString.h \ + JavaScriptCore/wtf/text/AtomicStringImpl.h \ + JavaScriptCore/wtf/text/CString.cpp \ + JavaScriptCore/wtf/text/CString.h \ + JavaScriptCore/wtf/text/StringBuffer.h \ + JavaScriptCore/wtf/text/StringHash.h \ + JavaScriptCore/wtf/text/StringImplBase.h \ + JavaScriptCore/wtf/text/StringImpl.cpp \ + JavaScriptCore/wtf/text/StringImpl.h \ + JavaScriptCore/wtf/text/StringStatics.cpp \ + JavaScriptCore/wtf/text/WTFString.cpp \ + JavaScriptCore/wtf/text/WTFString.h \ + JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp \ + JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h \ + JavaScriptCore/wtf/Threading.cpp \ + JavaScriptCore/wtf/Threading.h \ + JavaScriptCore/wtf/ThreadingPrimitives.h \ + JavaScriptCore/wtf/ThreadingPthreads.cpp \ + JavaScriptCore/wtf/ThreadSafeShared.h \ + JavaScriptCore/wtf/ThreadSpecific.h \ + JavaScriptCore/wtf/TypeTraits.cpp \ + JavaScriptCore/wtf/TypeTraits.h \ + JavaScriptCore/wtf/unicode/CollatorDefault.cpp \ + JavaScriptCore/wtf/unicode/Collator.h \ + JavaScriptCore/wtf/unicode/Unicode.h \ + JavaScriptCore/wtf/unicode/UTF8.cpp \ + JavaScriptCore/wtf/unicode/UTF8.h \ + JavaScriptCore/wtf/UnusedParam.h \ + JavaScriptCore/wtf/ValueCheck.h \ + JavaScriptCore/wtf/Vector.h \ + JavaScriptCore/wtf/VectorTraits.h \ + JavaScriptCore/wtf/VMTags.h \ + JavaScriptCore/wtf/WTFThreadData.cpp \ + JavaScriptCore/wtf/WTFThreadData.h \ + JavaScriptCore/yarr/RegexCompiler.cpp \ + JavaScriptCore/yarr/RegexCompiler.h \ + JavaScriptCore/yarr/RegexInterpreter.cpp \ + JavaScriptCore/yarr/RegexInterpreter.h \ + JavaScriptCore/yarr/RegexJIT.cpp \ + JavaScriptCore/yarr/RegexJIT.h \ + JavaScriptCore/yarr/RegexParser.h \ + JavaScriptCore/yarr/RegexPattern.h -javascriptcore_built_sources += \ - DerivedSources/Grammar.cpp \ - DerivedSources/Grammar.h +if TARGET_WIN32 +javascriptcore_sources += \ + JavaScriptCore/wtf/ThreadSpecificWin.cpp \ + JavaScriptCore/jit/ExecutableAllocatorWin.cpp \ + JavaScriptCore/runtime/MarkStackWin.cpp +else +javascriptcore_sources += \ + JavaScriptCore/jit/ExecutableAllocatorPosix.cpp \ + JavaScriptCore/runtime/MarkStackPosix.cpp +endif -DerivedSources/Grammar.h: DerivedSources/Grammar.cpp; +# ---- +# icu unicode backend +# ---- +if USE_ICU_UNICODE +javascriptcore_sources += \ + JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp \ + JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h +endif # USE_ICU_UNICODE -DerivedSources/Grammar.cpp: $(srcdir)/JavaScriptCore/parser/Grammar.y - $(BISON) -d -p jscyy $(srcdir)/JavaScriptCore/parser/Grammar.y -o $@ > bison_out.txt 2>&1 - $(PERL) -p -e 'END { if ($$conflict) { unlink "Grammar.cpp"; die; } } $$conflict ||= /conflict/' < bison_out.txt - cat $(GENSOURCES)/Grammar.hpp > $(GENSOURCES)/Grammar.h - rm -f $(GENSOURCES)/Grammar.hpp bison_out.txt +# ---- +# glib unicode backend +# ---- +if USE_GLIB_UNICODE +javascriptcore_sources += \ + JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h \ + JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp \ + JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h +endif -DerivedSources/Lexer.lut.h: $(CREATE_HASH_TABLE) $(srcdir)/JavaScriptCore/parser/Keywords.table +JavaScriptCore/Lexer.lut.h: $(CREATE_HASH_TABLE) $(srcdir)/JavaScriptCore/parser/Keywords.table $(PERL) $^ > $@ JavaScriptCore/%.lut.h: $(CREATE_HASH_TABLE) $(srcdir)/JavaScriptCore/%.cpp @@ -581,9 +565,10 @@ JavaScriptCore/pcre/chartables.c: $(srcdir)/JavaScriptCore/pcre/dftables $(PERL) $^ $@ bin_PROGRAMS += \ - Programs/jsc + Programs/jsc-@WEBKITGTK_API_MAJOR_VERSION@ noinst_PROGRAMS += \ + Programs/jsc \ Programs/minidom # minidom @@ -618,6 +603,11 @@ Programs_minidom_LDFLAGS = \ -no-fast-install # jsc +Programs/jsc-@WEBKITGTK_API_MAJOR_VERSION@: Programs/jsc + $(AM_V_GEN)cp -f Programs/jsc Programs/jsc-@WEBKITGTK_API_MAJOR_VERSION@ +Programs_jsc_@WEBKITGTK_API_MAJOR_VERSION@_LDADD = +Programs_jsc_@WEBKITGTK_API_MAJOR_VERSION@_SOURCES = + Programs_jsc_SOURCES = \ JavaScriptCore/jsc.cpp @@ -648,7 +638,6 @@ javascriptcore_dist += \ JavaScriptCore/pcre/AUTHORS \ JavaScriptCore/pcre/dftables \ JavaScriptCore/pcre/ucptable.cpp \ - JavaScriptCore/parser/Grammar.y \ JavaScriptCore/parser/Keywords.table # Clean rules for JavaScriptCore @@ -663,4 +652,5 @@ CLEANFILES += \ JavaScriptCore/runtime/StringPrototype.lut.h \ JavaScriptCore/pcre/chartables.c \ Programs/jsc \ + Programs/jsc-@WEBKITGTK_API_MAJOR_VERSION@ \ Programs/minidom diff --git a/JavaScriptCore/JavaScriptCore.pro b/JavaScriptCore/JavaScriptCore.pro index 8ee4f09..84ce83c 100644 --- a/JavaScriptCore/JavaScriptCore.pro +++ b/JavaScriptCore/JavaScriptCore.pro @@ -235,8 +235,6 @@ SOURCES += \ yarr/RegexJIT.cpp # Generated files, simply list them for JavaScriptCore -SOURCES += \ - $${JSC_GENERATED_SOURCES_DIR}/Grammar.cpp !contains(DEFINES, USE_SYSTEM_MALLOC) { SOURCES += wtf/TCSystemAlloc.cpp diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj index 8117f78..dbddfe0 100644 --- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj +++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj @@ -1881,78 +1881,6 @@ > - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj index bc58f5d..2dd4abd 100644 --- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj @@ -145,7 +145,6 @@ 1482B74E0A43032800517CFC /* JSStringRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1482B74C0A43032800517CFC /* JSStringRef.cpp */; }; 1482B7E40A43076000517CFC /* JSObjectRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1482B7E20A43076000517CFC /* JSObjectRef.cpp */; }; 148CD1D8108CF902008163C6 /* JSContextRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 148CD1D7108CF902008163C6 /* JSContextRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 148F21A3107EC5310042EC2C /* Grammar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FB3F4809D11B2400F49DEB /* Grammar.cpp */; }; 148F21AA107EC53A0042EC2C /* BytecodeGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 969A07200ED1CE3300F1F681 /* BytecodeGenerator.cpp */; }; 148F21B0107EC5410042EC2C /* Lexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8650255597D01FF60F7 /* Lexer.cpp */; }; 148F21B7107EC5470042EC2C /* Nodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A86D0255597D01FF60F7 /* Nodes.cpp */; }; @@ -330,6 +329,7 @@ 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 */; }; + A7F19ECE11DD490900931E70 /* FixedArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F19ECD11DD490900931E70 /* FixedArray.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7F9935F0FD7325100A0B2D0 /* JSONObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F9935D0FD7325100A0B2D0 /* JSONObject.h */; }; A7F993600FD7325100A0B2D0 /* JSONObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7F9935E0FD7325100A0B2D0 /* JSONObject.cpp */; }; A7FB60A4103F7DC20017A286 /* PropertyDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7FB60A3103F7DC20017A286 /* PropertyDescriptor.cpp */; }; @@ -350,7 +350,7 @@ BC18C3E70E16F5CD00B34460 /* ArrayPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A84E0255597D01FF60F7 /* ArrayPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C3E90E16F5CD00B34460 /* ASCIICType.h in Headers */ = {isa = PBXBuildFile; fileRef = 938C4F690CA06BC700D9310A /* ASCIICType.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C3EA0E16F5CD00B34460 /* Assertions.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E217B708E7EECC0023E5F6 /* Assertions.h */; settings = {ATTRIBUTES = (Private, ); }; }; - BC18C3EB0E16F5CD00B34460 /* AVLTree.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A596370DE3E1C300C17E37 /* AVLTree.h */; }; + BC18C3EB0E16F5CD00B34460 /* AVLTree.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A596370DE3E1C300C17E37 /* AVLTree.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C3EC0E16F5CD00B34460 /* BooleanObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 704FD35305697E6D003DBED9 /* BooleanObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C3ED0E16F5CD00B34460 /* CallData.h in Headers */ = {isa = PBXBuildFile; fileRef = 145C507F0D9DF63B0088F6B9 /* CallData.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C3F00E16F5CD00B34460 /* Collator.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A862AA0D7EBB7D001EC6AA /* Collator.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -476,7 +476,6 @@ BC18C52A0E16FCC200B34460 /* MathObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C5290E16FCC200B34460 /* MathObject.lut.h */; }; BC18C52C0E16FCD200B34460 /* RegExpObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C52B0E16FCD200B34460 /* RegExpObject.lut.h */; }; BC18C52E0E16FCE100B34460 /* Lexer.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C52D0E16FCE100B34460 /* Lexer.lut.h */; }; - BC18C5300E16FCEB00B34460 /* Grammar.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C52F0E16FCEB00B34460 /* Grammar.h */; }; BC257DE80E1F51C50016B6C9 /* Arguments.h in Headers */ = {isa = PBXBuildFile; fileRef = BC257DE60E1F51C50016B6C9 /* Arguments.h */; }; BC257DF00E1F52ED0016B6C9 /* GlobalEvalFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = BC257DEE0E1F52ED0016B6C9 /* GlobalEvalFunction.h */; }; BC257DF40E1F53740016B6C9 /* PrototypeFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = BC257DF20E1F53740016B6C9 /* PrototypeFunction.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -758,7 +757,6 @@ 65EA4C9A092AF9E20093D800 /* JSLock.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = JSLock.h; sourceTree = ""; tabWidth = 8; }; 65EA73620BAE35D1001BB560 /* CommonIdentifiers.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CommonIdentifiers.cpp; sourceTree = ""; }; 65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CommonIdentifiers.h; sourceTree = ""; }; - 65FB3F4809D11B2400F49DEB /* Grammar.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Grammar.cpp; sourceTree = ""; }; 704FD35305697E6D003DBED9 /* BooleanObject.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = BooleanObject.h; sourceTree = ""; tabWidth = 8; }; 7E2C6C980D31C6B6002D44E2 /* ScopeChainMark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScopeChainMark.h; sourceTree = ""; }; 7E4EE7080EBB7963005934AA /* StructureChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureChain.h; sourceTree = ""; }; @@ -843,7 +841,6 @@ 932F5BE10822A1C700736975 /* jsc */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jsc; sourceTree = BUILT_PRODUCTS_DIR; }; 93303FE80E6A72B500786E6A /* SmallStrings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SmallStrings.cpp; sourceTree = ""; }; 93303FEA0E6A72C000786E6A /* SmallStrings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmallStrings.h; sourceTree = ""; }; - 933A3499038AE7C6008635CE /* Grammar.y */ = {isa = PBXFileReference; explicitFileType = sourcecode.yacc; fileEncoding = 4; indentWidth = 4; path = Grammar.y; sourceTree = ""; tabWidth = 8; }; 933A349A038AE7C6008635CE /* Identifier.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Identifier.h; sourceTree = ""; tabWidth = 8; }; 933A349D038AE80F008635CE /* Identifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Identifier.cpp; sourceTree = ""; tabWidth = 8; }; 935AF46909E9D9DB00ACD1D8 /* Forward.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Forward.h; sourceTree = ""; }; @@ -938,6 +935,7 @@ A7E2EA6A0FB460CF00601F06 /* LiteralParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LiteralParser.cpp; sourceTree = ""; }; A7E42C180E3938830065A544 /* JSStaticScopeObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStaticScopeObject.h; sourceTree = ""; }; A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStaticScopeObject.cpp; sourceTree = ""; }; + A7F19ECD11DD490900931E70 /* FixedArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FixedArray.h; sourceTree = ""; }; A7F8690E0F9584A100558697 /* CachedCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedCall.h; sourceTree = ""; }; A7F869EC0F95C2EC00558697 /* CallFrameClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallFrameClosure.h; sourceTree = ""; }; A7F9935D0FD7325100A0B2D0 /* JSONObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONObject.h; sourceTree = ""; }; @@ -979,7 +977,6 @@ BC18C5290E16FCC200B34460 /* MathObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathObject.lut.h; sourceTree = ""; }; BC18C52B0E16FCD200B34460 /* RegExpObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpObject.lut.h; sourceTree = ""; }; BC18C52D0E16FCE100B34460 /* Lexer.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Lexer.lut.h; sourceTree = ""; }; - BC18C52F0E16FCEB00B34460 /* Grammar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Grammar.h; sourceTree = ""; }; BC22A3980E16E14800AF21C8 /* JSObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSObject.cpp; sourceTree = ""; }; BC22A3990E16E14800AF21C8 /* JSObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSObject.h; sourceTree = ""; }; BC22A39A0E16E14800AF21C8 /* JSVariableObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVariableObject.cpp; sourceTree = ""; }; @@ -1381,8 +1378,6 @@ BC18C5230E16FC8A00B34460 /* ArrayPrototype.lut.h */, 65B174BE09D1000200820339 /* chartables.c */, BCD203E70E1718F4002C7E82 /* DatePrototype.lut.h */, - 65FB3F4809D11B2400F49DEB /* Grammar.cpp */, - BC18C52F0E16FCEB00B34460 /* Grammar.h */, BC87CDB810712ACA000614CF /* JSONObject.lut.h */, BC18C52D0E16FCE100B34460 /* Lexer.lut.h */, BC18C5290E16FCC200B34460 /* MathObject.lut.h */, @@ -1491,6 +1486,7 @@ 96DD73780F9DA3100027FBCC /* VMTags.h */, 86D08D5111793613006E5ED0 /* WTFThreadData.cpp */, 86D08D5211793613006E5ED0 /* WTFThreadData.h */, + A7F19ECD11DD490900931E70 /* FixedArray.h */, ); path = wtf; sourceTree = ""; @@ -1531,7 +1527,6 @@ isa = PBXGroup; children = ( A7A7EE7411B98B8D0065A14F /* ASTBuilder.h */, - 933A3499038AE7C6008635CE /* Grammar.y */, A7A7EE7511B98B8D0065A14F /* JSParser.cpp */, A7A7EE7611B98B8D0065A14F /* JSParser.h */, 93F1981A08245AAE001E9ABC /* Keywords.table */, @@ -1967,7 +1962,6 @@ BC18C4050E16F5CD00B34460 /* FunctionPrototype.h in Headers */, BC18C4060E16F5CD00B34460 /* GetPtr.h in Headers */, BC257DF00E1F52ED0016B6C9 /* GlobalEvalFunction.h in Headers */, - BC18C5300E16FCEB00B34460 /* Grammar.h in Headers */, BC18C4080E16F5CD00B34460 /* HashCountedSet.h in Headers */, BC18C4090E16F5CD00B34460 /* HashFunctions.h in Headers */, BC18C40A0E16F5CD00B34460 /* HashIterators.h in Headers */, @@ -2192,6 +2186,7 @@ A784A26111D16622005776AC /* ASTBuilder.h in Headers */, A784A26311D16622005776AC /* JSParser.h in Headers */, A784A26411D16622005776AC /* SyntaxChecker.h in Headers */, + A7F19ECE11DD490900931E70 /* FixedArray.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2505,7 +2500,6 @@ 147F39CC107EC37600427A48 /* FunctionPrototype.cpp in Sources */, 14280855107EC0E70013E7B2 /* GetterSetter.cpp in Sources */, 147F39CD107EC37600427A48 /* GlobalEvalFunction.cpp in Sources */, - 148F21A3107EC5310042EC2C /* Grammar.cpp in Sources */, 65DFC93308EA173A00F7300B /* HashTable.cpp in Sources */, 147F39CE107EC37600427A48 /* Identifier.cpp in Sources */, E178636D0D9BEEC300D74E75 /* InitializeThreading.cpp in Sources */, diff --git a/JavaScriptCore/assembler/ARMv7Assembler.h b/JavaScriptCore/assembler/ARMv7Assembler.h index f910d15..48eef53 100644 --- a/JavaScriptCore/assembler/ARMv7Assembler.h +++ b/JavaScriptCore/assembler/ARMv7Assembler.h @@ -56,107 +56,122 @@ namespace ARMRegisters { r15, pc = r15, } RegisterID; - // s0 == d0 == q0 - // s4 == d2 == q1 - // etc typedef enum { - s0 = 0, - s1 = 1, - s2 = 2, - s3 = 3, - s4 = 4, - s5 = 5, - s6 = 6, - s7 = 7, - s8 = 8, - s9 = 9, - s10 = 10, - s11 = 11, - s12 = 12, - s13 = 13, - s14 = 14, - s15 = 15, - s16 = 16, - s17 = 17, - s18 = 18, - s19 = 19, - s20 = 20, - s21 = 21, - s22 = 22, - s23 = 23, - s24 = 24, - s25 = 25, - s26 = 26, - s27 = 27, - s28 = 28, - s29 = 29, - s30 = 30, - s31 = 31, - d0 = 0 << 1, - d1 = 1 << 1, - d2 = 2 << 1, - d3 = 3 << 1, - d4 = 4 << 1, - d5 = 5 << 1, - d6 = 6 << 1, - d7 = 7 << 1, - d8 = 8 << 1, - d9 = 9 << 1, - d10 = 10 << 1, - d11 = 11 << 1, - d12 = 12 << 1, - d13 = 13 << 1, - d14 = 14 << 1, - d15 = 15 << 1, - d16 = 16 << 1, - d17 = 17 << 1, - d18 = 18 << 1, - d19 = 19 << 1, - d20 = 20 << 1, - d21 = 21 << 1, - d22 = 22 << 1, - d23 = 23 << 1, - d24 = 24 << 1, - d25 = 25 << 1, - d26 = 26 << 1, - d27 = 27 << 1, - d28 = 28 << 1, - d29 = 29 << 1, - d30 = 30 << 1, - d31 = 31 << 1, - q0 = 0 << 2, - q1 = 1 << 2, - q2 = 2 << 2, - q3 = 3 << 2, - q4 = 4 << 2, - q5 = 5 << 2, - q6 = 6 << 2, - q7 = 7 << 2, - q8 = 8 << 2, - q9 = 9 << 2, - q10 = 10 << 2, - q11 = 11 << 2, - q12 = 12 << 2, - q13 = 13 << 2, - q14 = 14 << 2, - q15 = 15 << 2, - q16 = 16 << 2, - q17 = 17 << 2, - q18 = 18 << 2, - q19 = 19 << 2, - q20 = 20 << 2, - q21 = 21 << 2, - q22 = 22 << 2, - q23 = 23 << 2, - q24 = 24 << 2, - q25 = 25 << 2, - q26 = 26 << 2, - q27 = 27 << 2, - q28 = 28 << 2, - q29 = 29 << 2, - q30 = 30 << 2, - q31 = 31 << 2, - } FPRegisterID; + s0, + s1, + s2, + s3, + s4, + s5, + s6, + s7, + s8, + s9, + s10, + s11, + s12, + s13, + s14, + s15, + s16, + s17, + s18, + s19, + s20, + s21, + s22, + s23, + s24, + s25, + s26, + s27, + s28, + s29, + s30, + s31, + } FPSingleRegisterID; + + typedef enum { + d0, + d1, + d2, + d3, + d4, + d5, + d6, + d7, + d8, + d9, + d10, + d11, + d12, + d13, + d14, + d15, + d16, + d17, + d18, + d19, + d20, + d21, + d22, + d23, + d24, + d25, + d26, + d27, + d28, + d29, + d30, + d31, + } FPDoubleRegisterID; + + typedef enum { + q0, + q1, + q2, + q3, + q4, + q5, + q6, + q7, + q8, + q9, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + } FPQuadRegisterID; + + inline FPSingleRegisterID asSingle(FPDoubleRegisterID reg) + { + ASSERT(reg < d16); + return (FPSingleRegisterID)(reg << 1); + } + + inline FPDoubleRegisterID asDouble(FPSingleRegisterID reg) + { + ASSERT(!(reg & 1)); + return (FPDoubleRegisterID)(reg >> 1); + } } class ARMv7Assembler; @@ -354,6 +369,39 @@ private: ThumbImmediateValue m_value; }; +class VFPImmediate { +public: + VFPImmediate(double d) + : m_value(-1) + { + union { + uint64_t i; + double d; + } u; + + u.d = d; + + int sign = (u.i >> 63); + int exponent = (u.i >> 52) & 0x7ff; + uint64_t mantissa = u.i & 0x000fffffffffffffull; + + if ((exponent >= 0x3fc) && (exponent <= 0x403) && !(mantissa & 0x0000ffffffffffffull)) + m_value = (sign << 7) | ((exponent & 7) << 4) | (int)(mantissa >> 48); + } + + bool isValid() + { + return m_value != -1; + } + + uint8_t value() + { + return (uint8_t)m_value; + } + +private: + int m_value; +}; typedef enum { SRType_LSL, @@ -398,17 +446,6 @@ private: }; -/* -Some features of the Thumb instruction set are deprecated in ARMv7. Deprecated features affecting -instructions supported by ARMv7-M are as follows: -• use of the PC as or in a 16-bit ADD (SP plus register) instruction -• use of the SP as in a 16-bit ADD (SP plus register) instruction -• use of the SP as in a 16-bit CMP (register) instruction -• use of MOV (register) instructions in which is the SP or PC and is also the SP or PC. -• use of as the lowest-numbered register in the register list of a 16-bit STM instruction with base -register writeback -*/ - class ARMv7Assembler { public: ~ARMv7Assembler() @@ -417,7 +454,9 @@ public: } typedef ARMRegisters::RegisterID RegisterID; - typedef ARMRegisters::FPRegisterID FPRegisterID; + typedef ARMRegisters::FPSingleRegisterID FPSingleRegisterID; + typedef ARMRegisters::FPDoubleRegisterID FPDoubleRegisterID; + typedef ARMRegisters::FPQuadRegisterID FPQuadRegisterID; // (HS, LO, HI, LS) -> (AE, B, A, BE) // (VS, VC) -> (O, NO) @@ -503,53 +542,16 @@ private: return (reg == ARMRegisters::sp) || (reg == ARMRegisters::pc); } - bool isSingleRegister(FPRegisterID reg) - { - // Check that the high bit isn't set (q16+), and that the low bit isn't (s1, s3, etc). - return !(reg & ~31); - } - - bool isDoubleRegister(FPRegisterID reg) - { - // Check that the high bit isn't set (q16+), and that the low bit isn't (s1, s3, etc). - return !(reg & ~(31 << 1)); - } - - bool isQuadRegister(FPRegisterID reg) - { - return !(reg & ~(31 << 2)); - } - - uint32_t singleRegisterNum(FPRegisterID reg) - { - ASSERT(isSingleRegister(reg)); - return reg; - } - - uint32_t doubleRegisterNum(FPRegisterID reg) - { - ASSERT(isDoubleRegister(reg)); - return reg >> 1; - } - - uint32_t quadRegisterNum(FPRegisterID reg) - { - ASSERT(isQuadRegister(reg)); - return reg >> 2; - } - - uint32_t singleRegisterMask(FPRegisterID rd, int highBitsShift, int lowBitShift) + uint32_t singleRegisterMask(FPSingleRegisterID rdNum, int highBitsShift, int lowBitShift) { - uint32_t rdNum = singleRegisterNum(rd); uint32_t rdMask = (rdNum >> 1) << highBitsShift; if (rdNum & 1) rdMask |= 1 << lowBitShift; return rdMask; } - uint32_t doubleRegisterMask(FPRegisterID rd, int highBitShift, int lowBitsShift) + uint32_t doubleRegisterMask(FPDoubleRegisterID rdNum, int highBitShift, int lowBitsShift) { - uint32_t rdNum = doubleRegisterNum(rd); uint32_t rdMask = (rdNum & 0xf) << lowBitsShift; if (rdNum & 16) rdMask |= 1 << highBitShift; @@ -558,22 +560,17 @@ private: typedef enum { OP_ADD_reg_T1 = 0x1800, - OP_ADD_S_reg_T1 = 0x1800, OP_SUB_reg_T1 = 0x1A00, - OP_SUB_S_reg_T1 = 0x1A00, OP_ADD_imm_T1 = 0x1C00, - OP_ADD_S_imm_T1 = 0x1C00, OP_SUB_imm_T1 = 0x1E00, - OP_SUB_S_imm_T1 = 0x1E00, OP_MOV_imm_T1 = 0x2000, OP_CMP_imm_T1 = 0x2800, OP_ADD_imm_T2 = 0x3000, - OP_ADD_S_imm_T2 = 0x3000, OP_SUB_imm_T2 = 0x3800, - OP_SUB_S_imm_T2 = 0x3800, OP_AND_reg_T1 = 0x4000, OP_EOR_reg_T1 = 0x4040, OP_TST_reg_T1 = 0x4200, + OP_RSB_imm_T1 = 0x4240, OP_CMP_reg_T1 = 0x4280, OP_ORR_reg_T1 = 0x4300, OP_MVN_reg_T1 = 0x43C0, @@ -603,6 +600,7 @@ private: OP_AND_reg_T2 = 0xEA00, OP_TST_reg_T2 = 0xEA10, OP_ORR_reg_T2 = 0xEA40, + OP_ORR_S_reg_T2 = 0xEA50, OP_ASR_imm_T1 = 0xEA4F, OP_LSL_imm_T1 = 0xEA4F, OP_LSR_imm_T1 = 0xEA4F, @@ -614,6 +612,18 @@ private: OP_SUB_reg_T2 = 0xEBA0, OP_SUB_S_reg_T2 = 0xEBB0, OP_CMP_reg_T2 = 0xEBB0, + OP_VSTR = 0xED00, + OP_VLDR = 0xED10, + OP_VMOV_StoC = 0xEE00, + OP_VMOV_CtoS = 0xEE10, + OP_VMUL_T2 = 0xEE20, + OP_VADD_T2 = 0xEE30, + OP_VSUB_T2 = 0xEE30, + OP_VDIV = 0xEE80, + OP_VCMP_T1 = 0xEEB0, + OP_VCVT_FPIVFP = 0xEEB0, + OP_VMOV_IMM_T2 = 0xEEB0, + OP_VMRS = 0xEEB0, OP_B_T4a = 0xF000, OP_AND_imm_T1 = 0xF000, OP_TST_imm = 0xF010, @@ -627,6 +637,7 @@ private: OP_SUB_imm_T3 = 0xF1A0, OP_SUB_S_imm_T3 = 0xF1B0, OP_CMP_imm_T2 = 0xF1B0, + OP_RSB_imm_T2 = 0xF1C0, OP_ADD_imm_T4 = 0xF200, OP_MOV_imm_T3 = 0xF240, OP_SUB_imm_T4 = 0xF2A0, @@ -652,8 +663,20 @@ private: } OpcodeID1; typedef enum { - OP_B_T4b = 0x9000, + OP_VADD_T2b = 0x0A00, + OP_VDIVb = 0x0A00, + OP_VLDRb = 0x0A00, + OP_VMOV_IMM_T2b = 0x0A00, + OP_VMUL_T2b = 0x0A00, + OP_VSTRb = 0x0A00, + OP_VMOV_CtoSb = 0x0A10, + OP_VMOV_StoCb = 0x0A10, + OP_VMRSb = 0x0A10, + OP_VCMP_T1b = 0x0A40, + OP_VCVT_FPIVFPb = 0x0A40, + OP_VSUB_T2b = 0x0A40, OP_NOP_T2b = 0x8000, + OP_B_T4b = 0x9000, } OpcodeID2; struct FourFours { @@ -784,10 +807,10 @@ public: if (!((rd | rn) & 8)) { if (imm.isUInt3()) { - m_formatter.oneWordOp7Reg3Reg3Reg3(OP_ADD_S_imm_T1, (RegisterID)imm.getUInt3(), rn, rd); + m_formatter.oneWordOp7Reg3Reg3Reg3(OP_ADD_imm_T1, (RegisterID)imm.getUInt3(), rn, rd); return; } else if ((rd == rn) && imm.isUInt8()) { - m_formatter.oneWordOp5Reg3Imm8(OP_ADD_S_imm_T2, rd, imm.getUInt8()); + m_formatter.oneWordOp5Reg3Imm8(OP_ADD_imm_T2, rd, imm.getUInt8()); return; } } @@ -809,7 +832,7 @@ public: void add_S(RegisterID rd, RegisterID rn, RegisterID rm) { if (!((rd | rn | rm) & 8)) - m_formatter.oneWordOp7Reg3Reg3Reg3(OP_ADD_S_reg_T1, rm, rn, rd); + m_formatter.oneWordOp7Reg3Reg3Reg3(OP_ADD_reg_T1, rm, rn, rd); else add_S(rd, rn, rm, ShiftTypeAndAmount()); } @@ -1219,6 +1242,12 @@ public: mvn(rd, rm, ShiftTypeAndAmount()); } + void neg(RegisterID rd, RegisterID rm) + { + ARMThumbImmediate zero = ARMThumbImmediate::makeUInt12(0); + sub(rd, zero, rm); + } + void orr(RegisterID rd, RegisterID rn, ARMThumbImmediate imm) { ASSERT(!BadReg(rd)); @@ -1245,6 +1274,24 @@ public: orr(rd, rn, rm, ShiftTypeAndAmount()); } + void orr_S(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift) + { + ASSERT(!BadReg(rd)); + ASSERT(!BadReg(rn)); + ASSERT(!BadReg(rm)); + m_formatter.twoWordOp12Reg4FourFours(OP_ORR_S_reg_T2, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm)); + } + + void orr_S(RegisterID rd, RegisterID rn, RegisterID rm) + { + if ((rd == rn) && !((rd | rm) & 8)) + m_formatter.oneWordOp10Reg3Reg3(OP_ORR_reg_T1, rm, rd); + else if ((rd == rm) && !((rd | rn) & 8)) + m_formatter.oneWordOp10Reg3Reg3(OP_ORR_reg_T1, rn, rd); + else + orr_S(rd, rn, rm, ShiftTypeAndAmount()); + } + void ror(RegisterID rd, RegisterID rm, int32_t shiftAmount) { ASSERT(!BadReg(rd)); @@ -1361,6 +1408,19 @@ public: } } + void sub(RegisterID rd, ARMThumbImmediate imm, RegisterID rn) + { + ASSERT(rd != ARMRegisters::pc); + ASSERT(rn != ARMRegisters::pc); + ASSERT(imm.isValid()); + ASSERT(imm.isUInt12()); + + if (!((rd | rn) & 8) && !imm.getUInt12()) + m_formatter.oneWordOp10Reg3Reg3(OP_RSB_imm_T1, rn, rd); + else + m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_RSB_imm_T2, rn, rd, imm); + } + void sub(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift) { ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp)); @@ -1393,10 +1453,10 @@ public: return; } else if (!((rd | rn) & 8)) { if (imm.isUInt3()) { - m_formatter.oneWordOp7Reg3Reg3Reg3(OP_SUB_S_imm_T1, (RegisterID)imm.getUInt3(), rn, rd); + m_formatter.oneWordOp7Reg3Reg3Reg3(OP_SUB_imm_T1, (RegisterID)imm.getUInt3(), rn, rd); return; } else if ((rd == rn) && imm.isUInt8()) { - m_formatter.oneWordOp5Reg3Imm8(OP_SUB_S_imm_T2, rd, imm.getUInt8()); + m_formatter.oneWordOp5Reg3Imm8(OP_SUB_imm_T2, rd, imm.getUInt8()); return; } } @@ -1418,7 +1478,7 @@ public: void sub_S(RegisterID rd, RegisterID rn, RegisterID rm) { if (!((rd | rn | rm) & 8)) - m_formatter.oneWordOp7Reg3Reg3Reg3(OP_SUB_S_reg_T1, rm, rn, rd); + m_formatter.oneWordOp7Reg3Reg3Reg3(OP_SUB_reg_T1, rm, rn, rd); else sub_S(rd, rn, rm, ShiftTypeAndAmount()); } @@ -1446,62 +1506,75 @@ public: m_formatter.oneWordOp10Reg3Reg3(OP_TST_reg_T1, rm, rn); } - void vadd_F64(FPRegisterID rd, FPRegisterID rn, FPRegisterID rm) + void vadd_F64(FPDoubleRegisterID rd, FPDoubleRegisterID rn, FPDoubleRegisterID rm) + { + m_formatter.vfpOp(OP_VADD_T2, OP_VADD_T2b, true, rn, rd, rm); + } + + void vcmp_F64(FPDoubleRegisterID rd, FPDoubleRegisterID rm) { - m_formatter.vfpOp(0x0b00ee30 | doubleRegisterMask(rd, 6, 28) | doubleRegisterMask(rn, 23, 0) | doubleRegisterMask(rm, 21, 16)); + m_formatter.vfpOp(OP_VCMP_T1, OP_VCMP_T1b, true, VFPOperand(4), rd, rm); } - void vcmp_F64(FPRegisterID rd, FPRegisterID rm) + void vcvt_F64_S32(FPDoubleRegisterID rd, FPSingleRegisterID rm) { - m_formatter.vfpOp(0x0bc0eeb4 | doubleRegisterMask(rd, 6, 28) | doubleRegisterMask(rm, 21, 16)); + // boolean values are 64bit (toInt, unsigned, roundZero) + m_formatter.vfpOp(OP_VCVT_FPIVFP, OP_VCVT_FPIVFPb, true, vcvtOp(false, false, false), rd, rm); } - void vcvt_F64_S32(FPRegisterID fd, FPRegisterID sm) + void vcvtr_S32_F64(FPSingleRegisterID rd, FPDoubleRegisterID rm) { - m_formatter.vfpOp(0x0bc0eeb8 | doubleRegisterMask(fd, 6, 28) | singleRegisterMask(sm, 16, 21)); + // boolean values are 64bit (toInt, unsigned, roundZero) + m_formatter.vfpOp(OP_VCVT_FPIVFP, OP_VCVT_FPIVFPb, true, vcvtOp(true, false, true), rd, rm); } - void vcvt_S32_F64(FPRegisterID sd, FPRegisterID fm) + void vdiv_F64(FPDoubleRegisterID rd, FPDoubleRegisterID rn, FPDoubleRegisterID rm) { - m_formatter.vfpOp(0x0bc0eebd | singleRegisterMask(sd, 28, 6) | doubleRegisterMask(fm, 21, 16)); + m_formatter.vfpOp(OP_VDIV, OP_VDIVb, true, rn, rd, rm); } - void vldr(FPRegisterID rd, RegisterID rn, int32_t imm) + void vldr(FPDoubleRegisterID rd, RegisterID rn, int32_t imm) { - vmem(rd, rn, imm, true); + m_formatter.vfpMemOp(OP_VLDR, OP_VLDRb, true, rn, rd, imm); } - void vmov(RegisterID rd, FPRegisterID sn) + void vmov_F64_0(FPDoubleRegisterID rd) { - m_formatter.vfpOp(0x0a10ee10 | (rd << 28) | singleRegisterMask(sn, 0, 23)); + m_formatter.vfpOp(OP_VMOV_IMM_T2, OP_VMOV_IMM_T2b, true, VFPOperand(0), rd, VFPOperand(0)); } - void vmov(FPRegisterID sn, RegisterID rd) + void vmov(RegisterID rd, FPSingleRegisterID rn) { - m_formatter.vfpOp(0x0a10ee00 | (rd << 28) | singleRegisterMask(sn, 0, 23)); + ASSERT(!BadReg(rd)); + m_formatter.vfpOp(OP_VMOV_CtoS, OP_VMOV_CtoSb, false, rn, rd, VFPOperand(0)); } - // move FPSCR flags to APSR. - void vmrs_APSR_nzcv_FPSCR() + void vmov(FPSingleRegisterID rd, RegisterID rn) { - m_formatter.vfpOp(0xfa10eef1); + ASSERT(!BadReg(rn)); + m_formatter.vfpOp(OP_VMOV_StoC, OP_VMOV_StoCb, false, rd, rn, VFPOperand(0)); } - void vmul_F64(FPRegisterID rd, FPRegisterID rn, FPRegisterID rm) + void vmrs(RegisterID reg = ARMRegisters::pc) { - m_formatter.vfpOp(0x0b00ee20 | doubleRegisterMask(rd, 6, 28) | doubleRegisterMask(rn, 23, 0) | doubleRegisterMask(rm, 21, 16)); + ASSERT(reg != ARMRegisters::sp); + m_formatter.vfpOp(OP_VMRS, OP_VMRSb, false, VFPOperand(1), VFPOperand(0x10 | reg), VFPOperand(0)); } - void vstr(FPRegisterID rd, RegisterID rn, int32_t imm) + void vmul_F64(FPDoubleRegisterID rd, FPDoubleRegisterID rn, FPDoubleRegisterID rm) { - vmem(rd, rn, imm, false); + m_formatter.vfpOp(OP_VMUL_T2, OP_VMUL_T2b, true, rn, rd, rm); } - void vsub_F64(FPRegisterID rd, FPRegisterID rn, FPRegisterID rm) + void vstr(FPDoubleRegisterID rd, RegisterID rn, int32_t imm) { - m_formatter.vfpOp(0x0b40ee30 | doubleRegisterMask(rd, 6, 28) | doubleRegisterMask(rn, 23, 0) | doubleRegisterMask(rm, 21, 16)); + m_formatter.vfpMemOp(OP_VSTR, OP_VSTRb, true, rn, rd, imm); } + void vsub_F64(FPDoubleRegisterID rd, FPDoubleRegisterID rn, FPDoubleRegisterID rm) + { + m_formatter.vfpOp(OP_VSUB_T2, OP_VSUB_T2b, true, rn, rd, rm); + } JmpDst label() { @@ -1654,36 +1727,83 @@ public: static void repatchLoadPtrToLEA(void* where) { ASSERT(!(reinterpret_cast(where) & 1)); - uint16_t* loadOp = reinterpret_cast(where) + 4; - ASSERT((*loadOp & 0xfff0) == OP_LDR_reg_T2); - *loadOp = OP_ADD_reg_T3 | (*loadOp & 0xf); - ExecutableAllocator::cacheFlush(loadOp, sizeof(uint16_t)); + ASSERT((loadOp[0] & 0xfff0) == OP_LDR_reg_T2); + ASSERT((loadOp[1] & 0x0ff0) == 0); + int rn = loadOp[0] & 0xf; + int rt = loadOp[1] >> 12; + int rm = loadOp[1] & 0xf; + + loadOp[0] = OP_ADD_reg_T3 | rn; + loadOp[1] = rt << 8 | rm; + ExecutableAllocator::cacheFlush(loadOp, sizeof(uint32_t)); } private: + // VFP operations commonly take one or more 5-bit operands, typically representing a + // floating point register number. This will commonly be encoded in the instruction + // in two parts, with one single bit field, and one 4-bit field. In the case of + // double precision operands the high bit of the register number will be encoded + // separately, and for single precision operands the high bit of the register number + // will be encoded individually. + // VFPOperand encapsulates a 5-bit VFP operand, with bits 0..3 containing the 4-bit + // field to be encoded together in the instruction (the low 4-bits of a double + // register number, or the high 4-bits of a single register number), and bit 4 + // contains the bit value to be encoded individually. + struct VFPOperand { + explicit VFPOperand(uint32_t value) + : m_value(value) + { + ASSERT(!(m_value & ~0x1f)); + } - // Arm vfp addresses can be offset by a 9-bit ones-comp immediate, left shifted by 2. - // (i.e. +/-(0..255) 32-bit words) - void vmem(FPRegisterID rd, RegisterID rn, int32_t imm, bool isLoad) - { - bool up; - uint32_t offset; - if (imm < 0) { - offset = -imm; - up = false; - } else { - offset = imm; - up = true; + VFPOperand(FPDoubleRegisterID reg) + : m_value(reg) + { + } + + VFPOperand(RegisterID reg) + : m_value(reg) + { } - // offset is effectively leftshifted by 2 already (the bottom two bits are zero, and not - // reperesented in the instruction. Left shift by 14, to mov it into position 0x00AA0000. - ASSERT((offset & ~(0xff << 2)) == 0); - offset <<= 14; + VFPOperand(FPSingleRegisterID reg) + : m_value(((reg & 1) << 4) | (reg >> 1)) // rotate the lowest bit of 'reg' to the top. + { + } + + uint32_t bits1() + { + return m_value >> 4; + } - m_formatter.vfpOp(0x0b00ed00 | offset | (up << 7) | (isLoad << 4) | doubleRegisterMask(rd, 6, 28) | rn); + uint32_t bits4() + { + return m_value & 0xf; + } + + uint32_t m_value; + }; + + VFPOperand vcvtOp(bool toInteger, bool isUnsigned, bool isRoundZero) + { + // Cannot specify rounding when converting to float. + ASSERT(toInteger || !isRoundZero); + + uint32_t op = 0x8; + if (toInteger) { + // opc2 indicates both toInteger & isUnsigned. + op |= isUnsigned ? 0x4 : 0x5; + // 'op' field in instruction is isRoundZero + if (isRoundZero) + op |= 0x10; + } else { + // 'op' field in instruction is isUnsigned + if (!isUnsigned) + op |= 0x10; + } + return VFPOperand(op); } static void setInt32(void* code, uint32_t value) @@ -1873,11 +1993,35 @@ private: m_buffer.putShort((reg2 << 12) | imm); } - void vfpOp(int32_t op) + // Formats up instructions of the pattern: + // 111111111B11aaaa:bbbb222SA2C2cccc + // Where 1s in the pattern come from op1, 2s in the pattern come from op2, S is the provided size bit. + // Operands provide 5 bit values of the form Aaaaa, Bbbbb, Ccccc. + void vfpOp(OpcodeID1 op1, OpcodeID2 op2, bool size, VFPOperand a, VFPOperand b, VFPOperand c) { - m_buffer.putInt(op); + ASSERT(!(op1 & 0x004f)); + ASSERT(!(op2 & 0xf1af)); + m_buffer.putShort(op1 | b.bits1() << 6 | a.bits4()); + m_buffer.putShort(op2 | b.bits4() << 12 | size << 8 | a.bits1() << 7 | c.bits1() << 5 | c.bits4()); } + // Arm vfp addresses can be offset by a 9-bit ones-comp immediate, left shifted by 2. + // (i.e. +/-(0..255) 32-bit words) + void vfpMemOp(OpcodeID1 op1, OpcodeID2 op2, bool size, RegisterID rn, VFPOperand rd, int32_t imm) + { + bool up = true; + if (imm < 0) { + imm = -imm; + up = false; + } + + uint32_t offset = imm; + ASSERT(!(offset & ~0x3fc)); + offset >>= 2; + + m_buffer.putShort(op1 | (up << 7) | rd.bits1() << 6 | rn); + m_buffer.putShort(op2 | rd.bits4() << 12 | size << 8 | offset); + } // Administrative methods: diff --git a/JavaScriptCore/assembler/AbstractMacroAssembler.h b/JavaScriptCore/assembler/AbstractMacroAssembler.h index 1c7f269..aab9089 100644 --- a/JavaScriptCore/assembler/AbstractMacroAssembler.h +++ b/JavaScriptCore/assembler/AbstractMacroAssembler.h @@ -49,7 +49,6 @@ public: class Jump; typedef typename AssemblerType::RegisterID RegisterID; - typedef typename AssemblerType::FPRegisterID FPRegisterID; typedef typename AssemblerType::JmpSrc JmpSrc; typedef typename AssemblerType::JmpDst JmpDst; diff --git a/JavaScriptCore/assembler/MacroAssemblerARM.h b/JavaScriptCore/assembler/MacroAssemblerARM.h index 7f11ca9..1c64071 100644 --- a/JavaScriptCore/assembler/MacroAssemblerARM.h +++ b/JavaScriptCore/assembler/MacroAssemblerARM.h @@ -40,6 +40,8 @@ class MacroAssemblerARM : public AbstractMacroAssembler { static const int DoubleConditionBitSpecial = 0x10; COMPILE_ASSERT(!(DoubleConditionBitSpecial & DoubleConditionMask), DoubleConditionBitSpecial_should_not_interfere_with_ARMAssembler_Condition_codes); public: + typedef ARMRegisters::FPRegisterID FPRegisterID; + enum Condition { Equal = ARMAssembler::EQ, NotEqual = ARMAssembler::NE, diff --git a/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/JavaScriptCore/assembler/MacroAssemblerARMv7.h index 380d5f8..64513fd 100644 --- a/JavaScriptCore/assembler/MacroAssemblerARMv7.h +++ b/JavaScriptCore/assembler/MacroAssemblerARMv7.h @@ -38,10 +38,13 @@ class MacroAssemblerARMv7 : public AbstractMacroAssembler { // FIXME: switch dataTempRegister & addressTempRegister, or possibly use r7? // - dTR is likely used more than aTR, and we'll get better instruction // encoding if it's in the low 8 registers. - static const ARMRegisters::RegisterID dataTempRegister = ARMRegisters::ip; + static const RegisterID dataTempRegister = ARMRegisters::ip; static const RegisterID addressTempRegister = ARMRegisters::r3; - static const FPRegisterID fpTempRegister = ARMRegisters::d7; + static const ARMRegisters::FPDoubleRegisterID fpTempRegister = ARMRegisters::d7; + inline ARMRegisters::FPSingleRegisterID fpTempRegisterAsSingle() { return ARMRegisters::asSingle(fpTempRegister); } + +public: struct ArmAddress { enum AddressType { HasOffset, @@ -73,6 +76,7 @@ class MacroAssemblerARMv7 : public AbstractMacroAssembler { }; public: + typedef ARMRegisters::FPDoubleRegisterID FPRegisterID; static const Scale ScalePtr = TimesFour; @@ -222,6 +226,11 @@ public: m_assembler.smull(dest, dataTempRegister, src, dataTempRegister); } + void neg32(RegisterID srcDest) + { + m_assembler.neg(srcDest, srcDest); + } + void not32(RegisterID srcDest) { m_assembler.mvn(srcDest, srcDest); @@ -540,6 +549,12 @@ public: m_assembler.vldr(dest, base, offset); } + void loadDouble(const void* address, FPRegisterID dest) + { + move(ImmPtr(address), addressTempRegister); + m_assembler.vldr(dest, addressTempRegister, 0); + } + void storeDouble(FPRegisterID src, ImplicitAddress address) { RegisterID base = address.base; @@ -566,6 +581,11 @@ public: addDouble(fpTempRegister, dest); } + void divDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.vdiv_F64(dest, dest, src); + } + void subDouble(FPRegisterID src, FPRegisterID dest) { m_assembler.vsub_F64(dest, dest, src); @@ -595,14 +615,30 @@ public: void convertInt32ToDouble(RegisterID src, FPRegisterID dest) { - m_assembler.vmov(fpTempRegister, src); - m_assembler.vcvt_F64_S32(dest, fpTempRegister); + m_assembler.vmov(fpTempRegisterAsSingle(), src); + m_assembler.vcvt_F64_S32(dest, fpTempRegisterAsSingle()); + } + + void convertInt32ToDouble(Address address, FPRegisterID dest) + { + // Fixme: load directly into the fpr! + load32(address, dataTempRegister); + m_assembler.vmov(fpTempRegisterAsSingle(), dataTempRegister); + m_assembler.vcvt_F64_S32(dest, fpTempRegisterAsSingle()); + } + + void convertInt32ToDouble(AbsoluteAddress address, FPRegisterID dest) + { + // Fixme: load directly into the fpr! + load32(address.m_ptr, dataTempRegister); + m_assembler.vmov(fpTempRegisterAsSingle(), dataTempRegister); + m_assembler.vcvt_F64_S32(dest, fpTempRegisterAsSingle()); } Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right) { m_assembler.vcmp_F64(left, right); - m_assembler.vmrs_APSR_nzcv_FPSCR(); + m_assembler.vmrs(); if (cond == DoubleNotEqual) { // ConditionNE jumps if NotEqual *or* unordered - force the unordered cases not to jump. @@ -629,6 +665,27 @@ public: return jump(); } + // Convert 'src' to an integer, and places the resulting 'dest'. + // If the result is not representable as a 32 bit value, branch. + // May also branch for some values that are representable in 32 bits + // (specifically, in this case, 0). + void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID) + { + m_assembler.vcvtr_S32_F64(fpTempRegisterAsSingle(), src); + m_assembler.vmov(dest, fpTempRegisterAsSingle()); + + // Convert the integer result back to float & compare to the original value - if not equal or unordered (NaN) then jump. + m_assembler.vcvt_F64_S32(fpTempRegister, fpTempRegisterAsSingle()); + failureCases.append(branchDouble(DoubleNotEqualOrUnordered, src, fpTempRegister)); + + // If the result is zero, it might have been -0.0, and the double comparison won't catch this! + failureCases.append(branchTest32(Zero, dest)); + } + + void zeroDouble(FPRegisterID dest) + { + m_assembler.vmov_F64_0(dest); + } // Stack manipulation operations: // @@ -970,6 +1027,13 @@ public: return branch32(NotEqual, addressTempRegister, dataTempRegister); } + Jump branchOr32(Condition cond, RegisterID src, RegisterID dest) + { + ASSERT((cond == Signed) || (cond == Zero) || (cond == NonZero)); + m_assembler.orr_S(dest, dest, src); + return Jump(makeBranch(cond)); + } + Jump branchSub32(Condition cond, RegisterID src, RegisterID dest) { ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); @@ -1034,6 +1098,12 @@ public: m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(0)); } + void set32(Condition cond, Address left, RegisterID right, RegisterID dest) + { + load32(left, dataTempRegister); + set32(cond, dataTempRegister, right, dest); + } + void set32(Condition cond, RegisterID left, Imm32 right, RegisterID dest) { compare32(left, right); @@ -1042,6 +1112,21 @@ public: m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(0)); } + void set8(Condition cond, RegisterID left, RegisterID right, RegisterID dest) + { + set32(cond, left, right, dest); + } + + void set8(Condition cond, Address left, RegisterID right, RegisterID dest) + { + set32(cond, left, right, dest); + } + + void set8(Condition cond, RegisterID left, Imm32 right, RegisterID dest) + { + set32(cond, left, right, dest); + } + // FIXME: // The mask should be optional... paerhaps the argument order should be // dest-src, operations always have a dest? ... possibly not true, considering diff --git a/JavaScriptCore/assembler/MacroAssemblerMIPS.h b/JavaScriptCore/assembler/MacroAssemblerMIPS.h index 88132f7..3bb9e75 100644 --- a/JavaScriptCore/assembler/MacroAssemblerMIPS.h +++ b/JavaScriptCore/assembler/MacroAssemblerMIPS.h @@ -36,6 +36,7 @@ namespace JSC { class MacroAssemblerMIPS : public AbstractMacroAssembler { public: + typedef MIPSRegisters::FPRegisterID FPRegisterID; MacroAssemblerMIPS() : m_fixedWidth(false) diff --git a/JavaScriptCore/assembler/MacroAssemblerX86Common.h b/JavaScriptCore/assembler/MacroAssemblerX86Common.h index 7296193..cb86da7 100644 --- a/JavaScriptCore/assembler/MacroAssemblerX86Common.h +++ b/JavaScriptCore/assembler/MacroAssemblerX86Common.h @@ -39,6 +39,7 @@ class MacroAssemblerX86Common : public AbstractMacroAssembler { static const int DoubleConditionBits = DoubleConditionBitInvert | DoubleConditionBitSpecial; public: + typedef X86Assembler::FPRegisterID FPRegisterID; enum Condition { Equal = X86Assembler::ConditionE, diff --git a/JavaScriptCore/bytecode/Opcode.cpp b/JavaScriptCore/bytecode/Opcode.cpp index bb7696d..8f7f01f 100644 --- a/JavaScriptCore/bytecode/Opcode.cpp +++ b/JavaScriptCore/bytecode/Opcode.cpp @@ -101,7 +101,7 @@ OpcodeStats::~OpcodeStats() for (int j = 0; j < numOpcodeIDs; ++j) totalInstructionPairs += opcodePairCounts[i][j]; - int sortedIndices[numOpcodeIDs]; + FixedArray sortedIndices; for (int i = 0; i < numOpcodeIDs; ++i) sortedIndices[i] = i; qsort(sortedIndices, numOpcodeIDs, sizeof(int), compareOpcodeIndices); diff --git a/JavaScriptCore/interpreter/Interpreter.cpp b/JavaScriptCore/interpreter/Interpreter.cpp index 7c5bc6f..8160249 100644 --- a/JavaScriptCore/interpreter/Interpreter.cpp +++ b/JavaScriptCore/interpreter/Interpreter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2008 Cameron Zwarich * * Redistribution and use in source and binary forms, with or without @@ -3693,9 +3693,10 @@ skip_id_custom_self: int argsOffset = vPC[2].u.operand; JSValue arguments = callFrame->r(argsOffset).jsValue(); - int32_t argCount = 0; + uint32_t argCount = 0; if (!arguments) { argCount = (uint32_t)(callFrame->argumentCount()); + argCount = min(argCount, Arguments::MaxArguments); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -3703,9 +3704,9 @@ skip_id_custom_self: goto vm_throw; } ASSERT(!asFunction(callFrame->callee())->isHostFunction()); - int32_t expectedParams = asFunction(callFrame->callee())->jsExecutable()->parameterCount(); - int32_t inplaceArgs = min(argCount, expectedParams); - int32_t i = 0; + uint32_t expectedParams = asFunction(callFrame->callee())->jsExecutable()->parameterCount(); + uint32_t inplaceArgs = min(argCount, expectedParams); + uint32_t i = 0; Register* argStore = callFrame->registers() + argsOffset; // First step is to copy the "expected" parameters from their normal location relative to the callframe @@ -3722,6 +3723,7 @@ skip_id_custom_self: if (asObject(arguments)->classInfo() == &Arguments::info) { Arguments* args = asArguments(arguments); argCount = args->numProvidedArguments(callFrame); + argCount = min(argCount, Arguments::MaxArguments); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -3732,6 +3734,7 @@ skip_id_custom_self: } else if (isJSArray(&callFrame->globalData(), arguments)) { JSArray* array = asArray(arguments); argCount = array->length(); + argCount = min(argCount, Arguments::MaxArguments); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -3742,6 +3745,7 @@ skip_id_custom_self: } else if (asObject(arguments)->inherits(&JSArray::info)) { JSObject* argObject = asObject(arguments); argCount = argObject->get(callFrame, callFrame->propertyNames().length).toUInt32(callFrame); + argCount = min(argCount, Arguments::MaxArguments); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -3749,7 +3753,7 @@ skip_id_custom_self: goto vm_throw; } Register* argsBuffer = callFrame->registers() + argsOffset; - for (int32_t i = 0; i < argCount; ++i) { + for (uint32_t i = 0; i < argCount; ++i) { argsBuffer[i] = asObject(arguments)->get(callFrame, i); CHECK_FOR_EXCEPTION(); } diff --git a/JavaScriptCore/jit/JITOpcodes.cpp b/JavaScriptCore/jit/JITOpcodes.cpp index 9a34931..8e86d40 100644 --- a/JavaScriptCore/jit/JITOpcodes.cpp +++ b/JavaScriptCore/jit/JITOpcodes.cpp @@ -241,6 +241,37 @@ JIT::Label JIT::privateCompileCTINativeCall(JSGlobalData* globalData, bool isCon restoreReturnAddressBeforeReturn(regT3); +#elif CPU(MIPS) + // Load caller frame's scope chain into this callframe so that whatever we call can + // get to its global data. + emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT0); + emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT0); + emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain); + + preserveReturnAddressAfterCall(regT3); // Callee preserved + emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC); + + // Calling convention: f(a0, a1, a2, a3); + // Host function signature: f(ExecState*); + + // Allocate stack space for 16 bytes (8-byte aligned) + // 16 bytes (unused) for 4 arguments + subPtr(Imm32(16), stackPointerRegister); + + // Setup arg0 + move(callFrameRegister, MIPSRegisters::a0); + + // Call + emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, MIPSRegisters::a2); + loadPtr(Address(MIPSRegisters::a2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2); + move(regT0, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack. + call(Address(regT2, executableOffsetToFunction)); + + // Restore stack space + addPtr(Imm32(16), stackPointerRegister); + + restoreReturnAddressBeforeReturn(regT3); + #elif ENABLE(JIT_OPTIMIZE_NATIVE_CALL) #error "JIT_OPTIMIZE_NATIVE_CALL not yet supported on this platform." #else diff --git a/JavaScriptCore/jit/JITStubs.cpp b/JavaScriptCore/jit/JITStubs.cpp index c4a6507..30a9898 100644 --- a/JavaScriptCore/jit/JITStubs.cpp +++ b/JavaScriptCore/jit/JITStubs.cpp @@ -1531,17 +1531,18 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_self_fail) if (stubInfo->accessType == access_get_by_id_self) { ASSERT(!stubInfo->stubRoutine); polymorphicStructureList = new PolymorphicAccessStructureList(CodeLocationLabel(), stubInfo->u.getByIdSelf.baseObjectStructure); - stubInfo->initGetByIdSelfList(polymorphicStructureList, 2); + stubInfo->initGetByIdSelfList(polymorphicStructureList, 1); } else { polymorphicStructureList = stubInfo->u.getByIdSelfList.structureList; listIndex = stubInfo->u.getByIdSelfList.listSize; - stubInfo->u.getByIdSelfList.listSize++; } + if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) { + stubInfo->u.getByIdSelfList.listSize++; + JIT::compileGetByIdSelfList(callFrame->scopeChain()->globalData, codeBlock, stubInfo, polymorphicStructureList, listIndex, asCell(baseValue)->structure(), ident, slot, slot.cachedOffset()); - JIT::compileGetByIdSelfList(callFrame->scopeChain()->globalData, codeBlock, stubInfo, polymorphicStructureList, listIndex, asCell(baseValue)->structure(), ident, slot, slot.cachedOffset()); - - if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) - ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic)); + if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) + ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic)); + } } else ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic)); return JSValue::encode(result); @@ -1566,13 +1567,14 @@ static PolymorphicAccessStructureList* getPolymorphicAccessStructureListSlot(Str case access_get_by_id_proto_list: prototypeStructureList = stubInfo->u.getByIdProtoList.structureList; listIndex = stubInfo->u.getByIdProtoList.listSize; - stubInfo->u.getByIdProtoList.listSize++; + if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) + stubInfo->u.getByIdProtoList.listSize++; break; default: ASSERT_NOT_REACHED(); } - ASSERT(listIndex < POLYMORPHIC_LIST_CACHE_SIZE); + ASSERT(listIndex <= POLYMORPHIC_LIST_CACHE_SIZE); return prototypeStructureList; } @@ -1647,21 +1649,24 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_proto_list) int listIndex; PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(stubInfo, listIndex); + if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) { + JIT::compileGetByIdProtoList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, slotBaseObject->structure(), propertyName, slot, offset); - JIT::compileGetByIdProtoList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, slotBaseObject->structure(), propertyName, slot, offset); - - if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) - ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full)); + if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) + ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full)); + } } else if (size_t count = normalizePrototypeChain(callFrame, baseValue, slot.slotBase(), propertyName, offset)) { ASSERT(!asCell(baseValue)->structure()->isDictionary()); int listIndex; PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(stubInfo, listIndex); + + if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) { + StructureChain* protoChain = structure->prototypeChain(callFrame); + JIT::compileGetByIdChainList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, protoChain, count, propertyName, slot, offset); - StructureChain* protoChain = structure->prototypeChain(callFrame); - JIT::compileGetByIdChainList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, protoChain, count, propertyName, slot, offset); - - if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) - ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full)); + if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) + ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full)); + } } else ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail)); @@ -2452,6 +2457,7 @@ DEFINE_STUB_FUNCTION(int, op_load_varargs) if (!arguments) { int providedParams = callFrame->registers()[RegisterFile::ArgumentCount].i() - 1; argCount = providedParams; + argCount = min(argCount, static_cast(Arguments::MaxArguments)); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -2487,6 +2493,7 @@ DEFINE_STUB_FUNCTION(int, op_load_varargs) if (asObject(arguments)->classInfo() == &Arguments::info) { Arguments* argsObject = asArguments(arguments); argCount = argsObject->numProvidedArguments(callFrame); + argCount = min(argCount, static_cast(Arguments::MaxArguments)); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -2497,6 +2504,7 @@ DEFINE_STUB_FUNCTION(int, op_load_varargs) } else if (isJSArray(&callFrame->globalData(), arguments)) { JSArray* array = asArray(arguments); argCount = array->length(); + argCount = min(argCount, static_cast(Arguments::MaxArguments)); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -2507,6 +2515,7 @@ DEFINE_STUB_FUNCTION(int, op_load_varargs) } else if (asObject(arguments)->inherits(&JSArray::info)) { JSObject* argObject = asObject(arguments); argCount = argObject->get(callFrame, callFrame->propertyNames().length).toUInt32(callFrame); + argCount = min(argCount, static_cast(Arguments::MaxArguments)); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { diff --git a/JavaScriptCore/parser/Grammar.y b/JavaScriptCore/parser/Grammar.y deleted file mode 100644 index 4d6e7d1..0000000 --- a/JavaScriptCore/parser/Grammar.y +++ /dev/null @@ -1,2099 +0,0 @@ -%pure_parser - -%{ - -/* - * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) - * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - * Copyright (C) 2007 Eric Seidel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include "config.h" - -#include "JSObject.h" -#include "JSString.h" -#include "Lexer.h" -#include "NodeConstructors.h" -#include "NodeInfo.h" -#include -#include -#include - -#define YYMALLOC fastMalloc -#define YYFREE fastFree - -#define YYMAXDEPTH 10000 -#define YYENABLE_NLS 0 - -// 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 !OS(DARWIN) -// Avoid triggering warnings in older bison by not setting this on the Darwin platform. -// FIXME: Is this still needed? -#define YYERROR_VERBOSE -#endif - -int jscyyerror(const char*); - -static inline bool allowAutomaticSemicolon(JSC::Lexer&, int); - -#define GLOBAL_DATA static_cast(globalPtr) -#define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*GLOBAL_DATA->lexer, yychar)) YYABORT; } while (0) - -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); - -#if COMPILER(MSVC) - -#pragma warning(disable: 4065) -#pragma warning(disable: 4244) -#pragma warning(disable: 4702) - -#endif - -#define YYPARSE_PARAM globalPtr -#define YYLEX_PARAM globalPtr - -template inline NodeDeclarationInfo createNodeDeclarationInfo(T node, - ParserArenaData* varDecls, - ParserArenaData* funcDecls, - CodeFeatures info, int numConstants) -{ - ASSERT((info & ~AllFeatures) == 0); - NodeDeclarationInfo result = { node, varDecls, funcDecls, info, numConstants }; - return result; -} - -template inline NodeInfo createNodeInfo(T node, CodeFeatures info, int numConstants) -{ - ASSERT((info & ~AllFeatures) == 0); - NodeInfo result = { node, info, numConstants }; - return result; -} - -template inline T mergeDeclarationLists(T decls1, T decls2) -{ - // decls1 or both are null - if (!decls1) - return decls2; - // only decls1 is non-null - if (!decls2) - return decls1; - - // Both are non-null - decls1->data.append(decls2->data); - - // Manually release as much as possible from the now-defunct declaration lists - // to avoid accumulating so many unused heap allocated vectors. - decls2->data.clear(); - - return decls1; -} - -static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData*& varDecls, const Identifier& ident, unsigned attrs) -{ - if (!varDecls) - varDecls = new (globalData) ParserArenaData; - - varDecls->data.append(make_pair(&ident, attrs)); -} - -static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData*& varDecls, ConstDeclNode* decl) -{ - unsigned attrs = DeclarationStacks::IsConstant; - if (decl->hasInitializer()) - attrs |= DeclarationStacks::HasInitializer; - appendToVarDeclarationList(globalData, varDecls, decl->ident(), attrs); -} - -%} - -%union { - int intValue; - double doubleValue; - const Identifier* ident; - - // expression subtrees - ExpressionNodeInfo expressionNode; - FuncDeclNodeInfo funcDeclNode; - PropertyNodeInfo propertyNode; - ArgumentsNodeInfo argumentsNode; - ConstDeclNodeInfo constDeclNode; - CaseBlockNodeInfo caseBlockNode; - CaseClauseNodeInfo caseClauseNode; - FuncExprNodeInfo funcExprNode; - - // statement nodes - StatementNodeInfo statementNode; - FunctionBodyNode* functionBodyNode; - ProgramNode* programNode; - - SourceElementsInfo sourceElements; - PropertyListInfo propertyList; - ArgumentListInfo argumentList; - VarDeclListInfo varDeclList; - ConstDeclListInfo constDeclList; - ClauseListInfo clauseList; - ElementListInfo elementList; - ParameterListInfo parameterList; - - Operator op; -} - -%{ - -template 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 */ -%token NULLTOKEN TRUETOKEN FALSETOKEN - -/* keywords */ -%token BREAK CASE DEFAULT FOR NEW VAR CONSTTOKEN CONTINUE -%token FUNCTION RETURN VOIDTOKEN DELETETOKEN -%token IF THISTOKEN DO WHILE INTOKEN INSTANCEOF TYPEOF -%token SWITCH WITH RESERVED -%token THROW TRY CATCH FINALLY -%token DEBUGGER - -/* give an if without an else higher precedence than an else to resolve the ambiguity */ -%nonassoc IF_WITHOUT_ELSE -%nonassoc ELSE - -/* punctuators */ -%token EQEQ NE /* == and != */ -%token STREQ STRNEQ /* === and !== */ -%token LE GE /* < and > */ -%token OR AND /* || and && */ -%token PLUSPLUS MINUSMINUS /* ++ and -- */ -%token LSHIFT /* << */ -%token RSHIFT URSHIFT /* >> and >>> */ -%token PLUSEQUAL MINUSEQUAL /* += and -= */ -%token MULTEQUAL DIVEQUAL /* *= and /= */ -%token LSHIFTEQUAL /* <<= */ -%token RSHIFTEQUAL URSHIFTEQUAL /* >>= and >>>= */ -%token ANDEQUAL MODEQUAL /* &= and %= */ -%token XOREQUAL OREQUAL /* ^= and |= */ -%token OPENBRACE /* { (with char offset) */ -%token CLOSEBRACE /* } (with char offset) */ - -/* terminal types */ -%token NUMBER -%token IDENT STRING - -/* automatically inserted semicolon */ -%token AUTOPLUSPLUS AUTOMINUSMINUS - -/* non-terminal types */ -%type Literal ArrayLiteral - -%type PrimaryExpr PrimaryExprNoBrace -%type MemberExpr MemberExprNoBF /* BF => brace or function */ -%type NewExpr NewExprNoBF -%type CallExpr CallExprNoBF -%type LeftHandSideExpr LeftHandSideExprNoBF -%type PostfixExpr PostfixExprNoBF -%type UnaryExpr UnaryExprNoBF UnaryExprCommon -%type MultiplicativeExpr MultiplicativeExprNoBF -%type AdditiveExpr AdditiveExprNoBF -%type ShiftExpr ShiftExprNoBF -%type RelationalExpr RelationalExprNoIn RelationalExprNoBF -%type EqualityExpr EqualityExprNoIn EqualityExprNoBF -%type BitwiseANDExpr BitwiseANDExprNoIn BitwiseANDExprNoBF -%type BitwiseXORExpr BitwiseXORExprNoIn BitwiseXORExprNoBF -%type BitwiseORExpr BitwiseORExprNoIn BitwiseORExprNoBF -%type LogicalANDExpr LogicalANDExprNoIn LogicalANDExprNoBF -%type LogicalORExpr LogicalORExprNoIn LogicalORExprNoBF -%type ConditionalExpr ConditionalExprNoIn ConditionalExprNoBF -%type AssignmentExpr AssignmentExprNoIn AssignmentExprNoBF -%type Expr ExprNoIn ExprNoBF - -%type ExprOpt ExprNoInOpt - -%type Statement Block -%type VariableStatement ConstStatement EmptyStatement ExprStatement -%type IfStatement IterationStatement ContinueStatement -%type BreakStatement ReturnStatement WithStatement -%type SwitchStatement LabelledStatement -%type ThrowStatement TryStatement -%type DebuggerStatement - -%type Initializer InitializerNoIn -%type FunctionDeclaration -%type FunctionExpr -%type FunctionBody -%type SourceElements -%type FormalParameterList -%type AssignmentOperator -%type Arguments -%type ArgumentList -%type VariableDeclarationList VariableDeclarationListNoIn -%type ConstDeclarationList -%type ConstDeclaration -%type CaseBlock -%type CaseClause DefaultClause -%type CaseClauses CaseClausesOpt -%type Elision ElisionOpt -%type ElementList -%type Property -%type PropertyList -%% - -// FIXME: There are currently two versions of the grammar in this file, the normal one, and the NoNodes version used for -// lazy recompilation of FunctionBodyNodes. We should move to generating the two versions from a script to avoid bugs. -// In the mean time, make sure to make any changes to the grammar in both versions. - -Literal: - NULLTOKEN { $$ = createNodeInfo(new (GLOBAL_DATA) NullNode(GLOBAL_DATA), 0, 1); } - | TRUETOKEN { $$ = createNodeInfo(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, true), 0, 1); } - | FALSETOKEN { $$ = createNodeInfo(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, false), 0, 1); } - | NUMBER { $$ = createNodeInfo(makeNumberNode(GLOBAL_DATA, $1), 0, 1); } - | STRING { $$ = createNodeInfo(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)) - 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); - $$ = createNodeInfo(node, 0, 0); - } - | DIVEQUAL /* regexp with /= */ { - Lexer& l = *GLOBAL_DATA->lexer; - const Identifier* pattern; - const Identifier* flags; - if (!l.scanRegExp(pattern, flags, '=')) - YYABORT; - RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags); - int size = pattern->size() + 2; // + 2 for the two /'s - setExceptionLocation(node, @1.first_column, @1.first_column + size, @1.first_column + size); - $$ = createNodeInfo(node, 0, 0); - } -; - -Property: - IDENT ':' AssignmentExpr { $$ = createNodeInfo(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); } - | STRING ':' AssignmentExpr { $$ = createNodeInfo(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); } - | NUMBER ':' AssignmentExpr { $$ = createNodeInfo(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, $1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); } - | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, 0, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); setStatementLocation($6, @5, @7); if (!$$.m_node) YYABORT; } - | IDENT IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE - { - $$ = createNodeInfo(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, $4.m_node.head, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line)), $4.m_features | ClosureFeature, 0); - if ($4.m_features & ArgumentsFeature) - $7->setUsesArguments(); - setStatementLocation($7, @6, @8); - if (!$$.m_node) - YYABORT; - } -; - -PropertyList: - Property { $$.m_node.head = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, $1.m_node); - $$.m_node.tail = $$.m_node.head; - $$.m_features = $1.m_features; - $$.m_numConstants = $1.m_numConstants; } - | PropertyList ',' Property { $$.m_node.head = $1.m_node.head; - $$.m_node.tail = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, $3.m_node, $1.m_node.tail); - $$.m_features = $1.m_features | $3.m_features; - $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; } -; - -PrimaryExpr: - PrimaryExprNoBrace - | OPENBRACE CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA), 0, 0); } - | OPENBRACE PropertyList CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); } - /* allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939 */ - | OPENBRACE PropertyList ',' CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); } -; - -PrimaryExprNoBrace: - THISTOKEN { $$ = createNodeInfo(new (GLOBAL_DATA) ThisNode(GLOBAL_DATA), ThisFeature, 0); } - | Literal - | ArrayLiteral - | IDENT { $$ = createNodeInfo(new (GLOBAL_DATA) ResolveNode(GLOBAL_DATA, *$1, @1.first_column), (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); } - | '(' Expr ')' { $$ = $2; } -; - -ArrayLiteral: - '[' ElisionOpt ']' { $$ = createNodeInfo(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $2), 0, $2 ? 1 : 0); } - | '[' ElementList ']' { $$ = createNodeInfo(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); } - | '[' ElementList ',' ElisionOpt ']' { $$ = createNodeInfo(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $4, $2.m_node.head), $2.m_features, $4 ? $2.m_numConstants + 1 : $2.m_numConstants); } -; - -ElementList: - ElisionOpt AssignmentExpr { $$.m_node.head = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, $1, $2.m_node); - $$.m_node.tail = $$.m_node.head; - $$.m_features = $2.m_features; - $$.m_numConstants = $2.m_numConstants; } - | ElementList ',' ElisionOpt AssignmentExpr - { $$.m_node.head = $1.m_node.head; - $$.m_node.tail = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, $1.m_node.tail, $3, $4.m_node); - $$.m_features = $1.m_features | $4.m_features; - $$.m_numConstants = $1.m_numConstants + $4.m_numConstants; } -; - -ElisionOpt: - /* nothing */ { $$ = 0; } - | Elision -; - -Elision: - ',' { $$ = 1; } - | Elision ',' { $$ = $1 + 1; } -; - -MemberExpr: - PrimaryExpr - | FunctionExpr { $$ = createNodeInfo($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); - $$ = createNodeInfo(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); - $$ = createNodeInfo(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); - $$ = createNodeInfo(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants); - } -; - -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); - $$ = createNodeInfo(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); - $$ = createNodeInfo(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); - $$ = createNodeInfo(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants); - } -; - -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); - $$ = createNodeInfo(node, $2.m_features, $2.m_numConstants); - } -; - -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); - $$ = createNodeInfo(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); } - | 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); - $$ = createNodeInfo(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); - $$ = createNodeInfo(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); } - | 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); - $$ = createNodeInfo(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); - $$ = createNodeInfo(node, $1.m_features, $1.m_numConstants); - } -; - -Arguments: - '(' ')' { $$ = createNodeInfo(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA), 0, 0); } - | '(' ArgumentList ')' { $$ = createNodeInfo(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); } -; - -ArgumentList: - AssignmentExpr { $$.m_node.head = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, $1.m_node); - $$.m_node.tail = $$.m_node.head; - $$.m_features = $1.m_features; - $$.m_numConstants = $1.m_numConstants; } - | ArgumentList ',' AssignmentExpr { $$.m_node.head = $1.m_node.head; - $$.m_node.tail = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, $1.m_node.tail, $3.m_node); - $$.m_features = $1.m_features | $3.m_features; - $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; } -; - -LeftHandSideExpr: - NewExpr - | CallExpr -; - -LeftHandSideExprNoBF: - NewExprNoBF - | CallExprNoBF -; - -PostfixExpr: - LeftHandSideExpr - | LeftHandSideExpr PLUSPLUS { $$ = createNodeInfo(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); } - | LeftHandSideExpr MINUSMINUS { $$ = createNodeInfo(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); } -; - -PostfixExprNoBF: - LeftHandSideExprNoBF - | LeftHandSideExprNoBF PLUSPLUS { $$ = createNodeInfo(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); } - | LeftHandSideExprNoBF MINUSMINUS { $$ = createNodeInfo(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); } -; - -UnaryExprCommon: - DELETETOKEN UnaryExpr { $$ = createNodeInfo(makeDeleteNode(GLOBAL_DATA, $2.m_node, @1.first_column, @2.last_column, @2.last_column), $2.m_features, $2.m_numConstants); } - | VOIDTOKEN UnaryExpr { $$ = createNodeInfo(new (GLOBAL_DATA) VoidNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants + 1); } - | TYPEOF UnaryExpr { $$ = createNodeInfo(makeTypeOfNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); } - | PLUSPLUS UnaryExpr { $$ = createNodeInfo(makePrefixNode(GLOBAL_DATA, $2.m_node, OpPlusPlus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); } - | AUTOPLUSPLUS UnaryExpr { $$ = createNodeInfo(makePrefixNode(GLOBAL_DATA, $2.m_node, OpPlusPlus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); } - | MINUSMINUS UnaryExpr { $$ = createNodeInfo(makePrefixNode(GLOBAL_DATA, $2.m_node, OpMinusMinus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); } - | AUTOMINUSMINUS UnaryExpr { $$ = createNodeInfo(makePrefixNode(GLOBAL_DATA, $2.m_node, OpMinusMinus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); } - | '+' UnaryExpr { $$ = createNodeInfo(new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); } - | '-' UnaryExpr { $$ = createNodeInfo(makeNegateNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); } - | '~' UnaryExpr { $$ = createNodeInfo(makeBitwiseNotNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); } - | '!' UnaryExpr { $$ = createNodeInfo(new (GLOBAL_DATA) LogicalNotNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); } - -UnaryExpr: - PostfixExpr - | UnaryExprCommon -; - -UnaryExprNoBF: - PostfixExprNoBF - | UnaryExprCommon -; - -MultiplicativeExpr: - UnaryExpr - | MultiplicativeExpr '*' UnaryExpr { $$ = createNodeInfo(makeMultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | MultiplicativeExpr '/' UnaryExpr { $$ = createNodeInfo(makeDivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | MultiplicativeExpr '%' UnaryExpr { $$ = createNodeInfo(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -MultiplicativeExprNoBF: - UnaryExprNoBF - | MultiplicativeExprNoBF '*' UnaryExpr - { $$ = createNodeInfo(makeMultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | MultiplicativeExprNoBF '/' UnaryExpr - { $$ = createNodeInfo(makeDivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | MultiplicativeExprNoBF '%' UnaryExpr - { $$ = createNodeInfo(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -AdditiveExpr: - MultiplicativeExpr - | AdditiveExpr '+' MultiplicativeExpr { $$ = createNodeInfo(makeAddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | AdditiveExpr '-' MultiplicativeExpr { $$ = createNodeInfo(makeSubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -AdditiveExprNoBF: - MultiplicativeExprNoBF - | AdditiveExprNoBF '+' MultiplicativeExpr - { $$ = createNodeInfo(makeAddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | AdditiveExprNoBF '-' MultiplicativeExpr - { $$ = createNodeInfo(makeSubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -ShiftExpr: - AdditiveExpr - | ShiftExpr LSHIFT AdditiveExpr { $$ = createNodeInfo(makeLeftShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | ShiftExpr RSHIFT AdditiveExpr { $$ = createNodeInfo(makeRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | ShiftExpr URSHIFT AdditiveExpr { $$ = createNodeInfo(new (GLOBAL_DATA) UnsignedRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -ShiftExprNoBF: - AdditiveExprNoBF - | ShiftExprNoBF LSHIFT AdditiveExpr { $$ = createNodeInfo(makeLeftShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | ShiftExprNoBF RSHIFT AdditiveExpr { $$ = createNodeInfo(makeRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | ShiftExprNoBF URSHIFT AdditiveExpr { $$ = createNodeInfo(new (GLOBAL_DATA) UnsignedRightShiftNode(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: - ShiftExpr - | RelationalExpr '<' ShiftExpr { $$ = createNodeInfo(new (GLOBAL_DATA) LessNode(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 '>' ShiftExpr { $$ = createNodeInfo(new (GLOBAL_DATA) GreaterNode(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 LE ShiftExpr { $$ = createNodeInfo(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(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); - $$ = createNodeInfo(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); - $$ = createNodeInfo(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -RelationalExprNoIn: - ShiftExpr - | RelationalExprNoIn '<' ShiftExpr { $$ = createNodeInfo(new (GLOBAL_DATA) LessNode(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 '>' ShiftExpr { $$ = createNodeInfo(new (GLOBAL_DATA) GreaterNode(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 LE ShiftExpr { $$ = createNodeInfo(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); } - | RelationalExprNoIn GE ShiftExpr { $$ = createNodeInfo(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); - $$ = createNodeInfo(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -RelationalExprNoBF: - ShiftExprNoBF - | RelationalExprNoBF '<' ShiftExpr { $$ = createNodeInfo(new (GLOBAL_DATA) LessNode(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 '>' ShiftExpr { $$ = createNodeInfo(new (GLOBAL_DATA) GreaterNode(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 LE ShiftExpr { $$ = createNodeInfo(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); } - | RelationalExprNoBF GE ShiftExpr { $$ = createNodeInfo(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); - $$ = createNodeInfo(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); - $$ = createNodeInfo(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -EqualityExpr: - RelationalExpr - | EqualityExpr EQEQ RelationalExpr { $$ = createNodeInfo(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | EqualityExpr NE RelationalExpr { $$ = createNodeInfo(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | EqualityExpr STREQ RelationalExpr { $$ = createNodeInfo(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | EqualityExpr STRNEQ RelationalExpr { $$ = createNodeInfo(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -EqualityExprNoIn: - RelationalExprNoIn - | EqualityExprNoIn EQEQ RelationalExprNoIn - { $$ = createNodeInfo(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | EqualityExprNoIn NE RelationalExprNoIn - { $$ = createNodeInfo(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | EqualityExprNoIn STREQ RelationalExprNoIn - { $$ = createNodeInfo(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | EqualityExprNoIn STRNEQ RelationalExprNoIn - { $$ = createNodeInfo(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -EqualityExprNoBF: - RelationalExprNoBF - | EqualityExprNoBF EQEQ RelationalExpr - { $$ = createNodeInfo(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | EqualityExprNoBF NE RelationalExpr { $$ = createNodeInfo(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | EqualityExprNoBF STREQ RelationalExpr - { $$ = createNodeInfo(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } - | EqualityExprNoBF STRNEQ RelationalExpr - { $$ = createNodeInfo(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -BitwiseANDExpr: - EqualityExpr - | BitwiseANDExpr '&' EqualityExpr { $$ = createNodeInfo(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -BitwiseANDExprNoIn: - EqualityExprNoIn - | BitwiseANDExprNoIn '&' EqualityExprNoIn - { $$ = createNodeInfo(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -BitwiseANDExprNoBF: - EqualityExprNoBF - | BitwiseANDExprNoBF '&' EqualityExpr { $$ = createNodeInfo(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -BitwiseXORExpr: - BitwiseANDExpr - | BitwiseXORExpr '^' BitwiseANDExpr { $$ = createNodeInfo(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -BitwiseXORExprNoIn: - BitwiseANDExprNoIn - | BitwiseXORExprNoIn '^' BitwiseANDExprNoIn - { $$ = createNodeInfo(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -BitwiseXORExprNoBF: - BitwiseANDExprNoBF - | BitwiseXORExprNoBF '^' BitwiseANDExpr - { $$ = createNodeInfo(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -BitwiseORExpr: - BitwiseXORExpr - | BitwiseORExpr '|' BitwiseXORExpr { $$ = createNodeInfo(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -BitwiseORExprNoIn: - BitwiseXORExprNoIn - | BitwiseORExprNoIn '|' BitwiseXORExprNoIn - { $$ = createNodeInfo(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -BitwiseORExprNoBF: - BitwiseXORExprNoBF - | BitwiseORExprNoBF '|' BitwiseXORExpr - { $$ = createNodeInfo(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -LogicalANDExpr: - BitwiseORExpr - | LogicalANDExpr AND BitwiseORExpr { $$ = createNodeInfo(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -LogicalANDExprNoIn: - BitwiseORExprNoIn - | LogicalANDExprNoIn AND BitwiseORExprNoIn - { $$ = createNodeInfo(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -LogicalANDExprNoBF: - BitwiseORExprNoBF - | LogicalANDExprNoBF AND BitwiseORExpr - { $$ = createNodeInfo(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -LogicalORExpr: - LogicalANDExpr - | LogicalORExpr OR LogicalANDExpr { $$ = createNodeInfo(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -LogicalORExprNoIn: - LogicalANDExprNoIn - | LogicalORExprNoIn OR LogicalANDExprNoIn - { $$ = createNodeInfo(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -LogicalORExprNoBF: - LogicalANDExprNoBF - | LogicalORExprNoBF OR LogicalANDExpr { $$ = createNodeInfo(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -ConditionalExpr: - LogicalORExpr - | LogicalORExpr '?' AssignmentExpr ':' AssignmentExpr - { $$ = createNodeInfo(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); } -; - -ConditionalExprNoIn: - LogicalORExprNoIn - | LogicalORExprNoIn '?' AssignmentExprNoIn ':' AssignmentExprNoIn - { $$ = createNodeInfo(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); } -; - -ConditionalExprNoBF: - LogicalORExprNoBF - | LogicalORExprNoBF '?' AssignmentExpr ':' AssignmentExpr - { $$ = createNodeInfo(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); } -; - -AssignmentExpr: - ConditionalExpr - | LeftHandSideExpr AssignmentOperator AssignmentExpr - { $$ = createNodeInfo(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature, - @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants); - } -; - -AssignmentExprNoIn: - ConditionalExprNoIn - | LeftHandSideExpr AssignmentOperator AssignmentExprNoIn - { $$ = createNodeInfo(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature, - @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants); - } -; - -AssignmentExprNoBF: - ConditionalExprNoBF - | LeftHandSideExprNoBF AssignmentOperator AssignmentExpr - { $$ = createNodeInfo(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature, - @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants); - } -; - -AssignmentOperator: - '=' { $$ = OpEqual; } - | PLUSEQUAL { $$ = OpPlusEq; } - | MINUSEQUAL { $$ = OpMinusEq; } - | MULTEQUAL { $$ = OpMultEq; } - | DIVEQUAL { $$ = OpDivEq; } - | LSHIFTEQUAL { $$ = OpLShift; } - | RSHIFTEQUAL { $$ = OpRShift; } - | URSHIFTEQUAL { $$ = OpURShift; } - | ANDEQUAL { $$ = OpAndEq; } - | XOREQUAL { $$ = OpXOrEq; } - | OREQUAL { $$ = OpOrEq; } - | MODEQUAL { $$ = OpModEq; } -; - -Expr: - AssignmentExpr - | Expr ',' AssignmentExpr { $$ = createNodeInfo(combineCommaNodes(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -ExprNoIn: - AssignmentExprNoIn - | ExprNoIn ',' AssignmentExprNoIn { $$ = createNodeInfo(combineCommaNodes(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -ExprNoBF: - AssignmentExprNoBF - | ExprNoBF ',' AssignmentExpr { $$ = createNodeInfo(combineCommaNodes(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } -; - -Statement: - Block - | VariableStatement - | ConstStatement - | FunctionDeclaration - | EmptyStatement - | ExprStatement - | IfStatement - | IterationStatement - | ContinueStatement - | BreakStatement - | ReturnStatement - | WithStatement - | SwitchStatement - | LabelledStatement - | ThrowStatement - | TryStatement - | DebuggerStatement -; - -Block: - OPENBRACE CLOSEBRACE { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0); - setStatementLocation($$.m_node, @1, @2); } - | OPENBRACE SourceElements CLOSEBRACE { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants); - setStatementLocation($$.m_node, @1, @3); } -; - -VariableStatement: - VAR VariableDeclarationList ';' { $$ = createNodeDeclarationInfo(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants); - setStatementLocation($$.m_node, @1, @3); } - | VAR VariableDeclarationList error { $$ = createNodeDeclarationInfo(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants); - setStatementLocation($$.m_node, @1, @2); - AUTO_SEMICOLON; } -; - -VariableDeclarationList: - IDENT { $$.m_node = 0; - $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData; - appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0); - $$.m_funcDeclarations = 0; - $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0; - $$.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); - $$.m_node = node; - $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData; - appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer); - $$.m_funcDeclarations = 0; - $$.m_features = ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features; - $$.m_numConstants = $2.m_numConstants; - } - | VariableDeclarationList ',' IDENT - { $$.m_node = $1.m_node; - $$.m_varDeclarations = $1.m_varDeclarations; - appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0); - $$.m_funcDeclarations = 0; - $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0); - $$.m_numConstants = $1.m_numConstants; - } - | 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); - $$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node); - $$.m_varDeclarations = $1.m_varDeclarations; - appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer); - $$.m_funcDeclarations = 0; - $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features; - $$.m_numConstants = $1.m_numConstants + $4.m_numConstants; - } -; - -VariableDeclarationListNoIn: - IDENT { $$.m_node = 0; - $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData; - appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0); - $$.m_funcDeclarations = 0; - $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0; - $$.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); - $$.m_node = node; - $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData; - appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer); - $$.m_funcDeclarations = 0; - $$.m_features = ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features; - $$.m_numConstants = $2.m_numConstants; - } - | VariableDeclarationListNoIn ',' IDENT - { $$.m_node = $1.m_node; - $$.m_varDeclarations = $1.m_varDeclarations; - appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0); - $$.m_funcDeclarations = 0; - $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0); - $$.m_numConstants = $1.m_numConstants; - } - | 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); - $$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node); - $$.m_varDeclarations = $1.m_varDeclarations; - appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer); - $$.m_funcDeclarations = 0; - $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features; - $$.m_numConstants = $1.m_numConstants + $4.m_numConstants; - } -; - -ConstStatement: - CONSTTOKEN ConstDeclarationList ';' { $$ = createNodeDeclarationInfo(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); } - | CONSTTOKEN ConstDeclarationList error - { $$ = createNodeDeclarationInfo(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; } -; - -ConstDeclarationList: - ConstDeclaration { $$.m_node.head = $1.m_node; - $$.m_node.tail = $$.m_node.head; - $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData; - appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $1.m_node); - $$.m_funcDeclarations = 0; - $$.m_features = $1.m_features; - $$.m_numConstants = $1.m_numConstants; - } - | ConstDeclarationList ',' ConstDeclaration - { $$.m_node.head = $1.m_node.head; - $1.m_node.tail->m_next = $3.m_node; - $$.m_node.tail = $3.m_node; - $$.m_varDeclarations = $1.m_varDeclarations; - appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $3.m_node); - $$.m_funcDeclarations = 0; - $$.m_features = $1.m_features | $3.m_features; - $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; } -; - -ConstDeclaration: - IDENT { $$ = createNodeInfo(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *$1, 0), (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); } - | IDENT Initializer { $$ = createNodeInfo(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *$1, $2.m_node), ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features, $2.m_numConstants); } -; - -Initializer: - '=' AssignmentExpr { $$ = $2; } -; - -InitializerNoIn: - '=' AssignmentExprNoIn { $$ = $2; } -; - -EmptyStatement: - ';' { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); } -; - -ExprStatement: - ExprNoBF ';' { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants); - setStatementLocation($$.m_node, @1, @2); } - | ExprNoBF error { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants); - setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; } -; - -IfStatement: - IF '(' Expr ')' Statement %prec IF_WITHOUT_ELSE - { $$ = createNodeDeclarationInfo(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); } - | IF '(' Expr ')' Statement ELSE Statement - { $$ = createNodeDeclarationInfo(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); } -; - -IterationStatement: - DO Statement WHILE '(' Expr ')' ';' { $$ = createNodeDeclarationInfo(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); } - | DO Statement WHILE '(' Expr ')' error { $$ = createNodeDeclarationInfo(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. - | WHILE '(' Expr ')' Statement { $$ = createNodeDeclarationInfo(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); } - | FOR '(' ExprNoInOpt ';' ExprOpt ';' ExprOpt ')' Statement - { $$ = createNodeDeclarationInfo(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); - } - | FOR '(' VAR VariableDeclarationListNoIn ';' ExprOpt ';' ExprOpt ')' Statement - { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, $4.m_node, $6.m_node, $8.m_node, $10.m_node, true), - mergeDeclarationLists($4.m_varDeclarations, $10.m_varDeclarations), - 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); } - | 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); - $$ = createNodeDeclarationInfo(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); - } - | 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); - appendToVarDeclarationList(GLOBAL_DATA, $8.m_varDeclarations, *$4, DeclarationStacks::HasInitializer); - $$ = createNodeDeclarationInfo(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); } - | 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); - appendToVarDeclarationList(GLOBAL_DATA, $9.m_varDeclarations, *$4, DeclarationStacks::HasInitializer); - $$ = createNodeDeclarationInfo(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); } -; - -ExprOpt: - /* nothing */ { $$ = createNodeInfo(0, 0, 0); } - | Expr -; - -ExprNoInOpt: - /* nothing */ { $$ = createNodeInfo(0, 0, 0); } - | ExprNoIn -; - -ContinueStatement: - CONTINUE ';' { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA); - setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column); - $$ = createNodeDeclarationInfo(node, 0, 0, 0, 0); - setStatementLocation($$.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); - $$ = createNodeDeclarationInfo(node, 0, 0, 0, 0); - setStatementLocation($$.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); - $$ = createNodeDeclarationInfo(node, 0, 0, 0, 0); - setStatementLocation($$.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); - $$ = createNodeDeclarationInfo(node, 0, 0, 0, 0); - setStatementLocation($$.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(node, 0, 0, 0, 0); setStatementLocation($$.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(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA), 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; } - | BREAK IDENT ';' { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2); - setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); - $$ = createNodeDeclarationInfo(node, 0, 0, 0, 0); setStatementLocation($$.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(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2), 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; } -; - -ReturnStatement: - RETURN ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0); - setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column); - $$ = createNodeDeclarationInfo(node, 0, 0, 0, 0); setStatementLocation($$.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(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; } - | RETURN Expr ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node); - setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); - $$ = createNodeDeclarationInfo(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @3); } - | RETURN Expr error { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node); - setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); - $$ = createNodeDeclarationInfo(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; } -; - -WithStatement: - WITH '(' Expr ')' Statement { $$ = createNodeDeclarationInfo(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); } -; - -SwitchStatement: - SWITCH '(' Expr ')' CaseBlock { $$ = createNodeDeclarationInfo(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); } -; - -CaseBlock: - OPENBRACE CaseClausesOpt CLOSEBRACE { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, $2.m_node.head, 0, 0), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants); } - | OPENBRACE CaseClausesOpt DefaultClause CaseClausesOpt CLOSEBRACE - { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, $2.m_node.head, $3.m_node, $4.m_node.head), - mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $3.m_varDeclarations), $4.m_varDeclarations), - mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $3.m_funcDeclarations), $4.m_funcDeclarations), - $2.m_features | $3.m_features | $4.m_features, - $2.m_numConstants + $3.m_numConstants + $4.m_numConstants); } -; - -CaseClausesOpt: - /* nothing */ { $$.m_node.head = 0; $$.m_node.tail = 0; $$.m_varDeclarations = 0; $$.m_funcDeclarations = 0; $$.m_features = 0; $$.m_numConstants = 0; } - | CaseClauses -; - -CaseClauses: - CaseClause { $$.m_node.head = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, $1.m_node); - $$.m_node.tail = $$.m_node.head; - $$.m_varDeclarations = $1.m_varDeclarations; - $$.m_funcDeclarations = $1.m_funcDeclarations; - $$.m_features = $1.m_features; - $$.m_numConstants = $1.m_numConstants; } - | CaseClauses CaseClause { $$.m_node.head = $1.m_node.head; - $$.m_node.tail = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, $1.m_node.tail, $2.m_node); - $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations); - $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations); - $$.m_features = $1.m_features | $2.m_features; - $$.m_numConstants = $1.m_numConstants + $2.m_numConstants; - } -; - -CaseClause: - CASE Expr ':' { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, $2.m_node), 0, 0, $2.m_features, $2.m_numConstants); } - | CASE Expr ':' SourceElements { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, $2.m_node, $4.m_node), $4.m_varDeclarations, $4.m_funcDeclarations, $2.m_features | $4.m_features, $2.m_numConstants + $4.m_numConstants); } -; - -DefaultClause: - DEFAULT ':' { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); } - | DEFAULT ':' SourceElements { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0, $3.m_node), $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_features, $3.m_numConstants); } -; - -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); - $$ = createNodeDeclarationInfo(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(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); - } - | THROW Expr error { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node); - setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); - $$ = createNodeDeclarationInfo(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; - } -; - -TryStatement: - TRY Block FINALLY Block { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, $4.m_node), - mergeDeclarationLists($2.m_varDeclarations, $4.m_varDeclarations), - mergeDeclarationLists($2.m_funcDeclarations, $4.m_funcDeclarations), - $2.m_features | $4.m_features, - $2.m_numConstants + $4.m_numConstants); - setStatementLocation($$.m_node, @1, @2); } - | TRY Block CATCH '(' IDENT ')' Block { $$ = createNodeDeclarationInfo(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); } - | TRY Block CATCH '(' IDENT ')' Block FINALLY Block - { $$ = createNodeDeclarationInfo(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); } -; - -DebuggerStatement: - DEBUGGER ';' { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); - setStatementLocation($$.m_node, @1, @2); } - | DEBUGGER error { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); - setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; } -; - -FunctionDeclaration: - FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeDeclarationInfo(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *$2, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), 0, new (GLOBAL_DATA) ParserArenaData, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); setStatementLocation($6, @5, @7); $$.m_funcDeclarations->data.append(static_cast($$.m_node)->body()); } - | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE - { - $$ = createNodeDeclarationInfo(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, ((*$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($$.m_node)->body()); - } -; - -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) - $6->setUsesArguments(); - setStatementLocation($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); - if ($4.m_features & ArgumentsFeature) - $7->setUsesArguments(); - setStatementLocation($7, @6, @8); - } -; - -FormalParameterList: - IDENT { $$.m_node.head = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, *$1); - $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0; - $$.m_node.tail = $$.m_node.head; } - | FormalParameterList ',' IDENT { $$.m_node.head = $1.m_node.head; - $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0); - $$.m_node.tail = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, $1.m_node.tail, *$3); } -; - -FunctionBody: - /* not in spec */ { $$ = FunctionBodyNode::create(GLOBAL_DATA); } - | SourceElements_NoNode { $$ = FunctionBodyNode::create(GLOBAL_DATA); } -; - -Program: - /* not in spec */ { GLOBAL_DATA->parser->didFinishParsing(new (GLOBAL_DATA) SourceElements(GLOBAL_DATA), 0, 0, NoFeatures, @0.last_line, 0); } - | SourceElements { GLOBAL_DATA->parser->didFinishParsing($1.m_node, $1.m_varDeclarations, $1.m_funcDeclarations, $1.m_features, - @1.last_line, $1.m_numConstants); } -; - -SourceElements: - Statement { $$.m_node = new (GLOBAL_DATA) SourceElements(GLOBAL_DATA); - $$.m_node->append($1.m_node); - $$.m_varDeclarations = $1.m_varDeclarations; - $$.m_funcDeclarations = $1.m_funcDeclarations; - $$.m_features = $1.m_features; - $$.m_numConstants = $1.m_numConstants; - } - | SourceElements Statement { $$.m_node->append($2.m_node); - $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations); - $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations); - $$.m_features = $1.m_features | $2.m_features; - $$.m_numConstants = $1.m_numConstants + $2.m_numConstants; - } -; - -// Start NoNodes - -Literal_NoNode: - NULLTOKEN - | TRUETOKEN - | FALSETOKEN - | NUMBER { } - | STRING { } - | '/' /* regexp */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; } - | DIVEQUAL /* regexp with /= */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; } -; - -Property_NoNode: - IDENT ':' AssignmentExpr_NoNode { } - | STRING ':' AssignmentExpr_NoNode { } - | NUMBER ':' AssignmentExpr_NoNode { } - | IDENT IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE { if (*$1 != "get" && *$1 != "set") YYABORT; } - | IDENT IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE { if (*$1 != "get" && *$1 != "set") YYABORT; } -; - -PropertyList_NoNode: - Property_NoNode - | PropertyList_NoNode ',' Property_NoNode -; - -PrimaryExpr_NoNode: - PrimaryExprNoBrace_NoNode - | OPENBRACE CLOSEBRACE { } - | OPENBRACE PropertyList_NoNode CLOSEBRACE { } - /* allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939 */ - | OPENBRACE PropertyList_NoNode ',' CLOSEBRACE { } -; - -PrimaryExprNoBrace_NoNode: - THISTOKEN - | Literal_NoNode - | ArrayLiteral_NoNode - | IDENT { } - | '(' Expr_NoNode ')' -; - -ArrayLiteral_NoNode: - '[' ElisionOpt_NoNode ']' - | '[' ElementList_NoNode ']' - | '[' ElementList_NoNode ',' ElisionOpt_NoNode ']' -; - -ElementList_NoNode: - ElisionOpt_NoNode AssignmentExpr_NoNode - | ElementList_NoNode ',' ElisionOpt_NoNode AssignmentExpr_NoNode -; - -ElisionOpt_NoNode: - /* nothing */ - | Elision_NoNode -; - -Elision_NoNode: - ',' - | Elision_NoNode ',' -; - -MemberExpr_NoNode: - PrimaryExpr_NoNode - | FunctionExpr_NoNode - | MemberExpr_NoNode '[' Expr_NoNode ']' - | MemberExpr_NoNode '.' IDENT - | NEW MemberExpr_NoNode Arguments_NoNode -; - -MemberExprNoBF_NoNode: - PrimaryExprNoBrace_NoNode - | MemberExprNoBF_NoNode '[' Expr_NoNode ']' - | MemberExprNoBF_NoNode '.' IDENT - | NEW MemberExpr_NoNode Arguments_NoNode -; - -NewExpr_NoNode: - MemberExpr_NoNode - | NEW NewExpr_NoNode -; - -NewExprNoBF_NoNode: - MemberExprNoBF_NoNode - | NEW NewExpr_NoNode -; - -CallExpr_NoNode: - MemberExpr_NoNode Arguments_NoNode - | CallExpr_NoNode Arguments_NoNode - | CallExpr_NoNode '[' Expr_NoNode ']' - | CallExpr_NoNode '.' IDENT -; - -CallExprNoBF_NoNode: - MemberExprNoBF_NoNode Arguments_NoNode - | CallExprNoBF_NoNode Arguments_NoNode - | CallExprNoBF_NoNode '[' Expr_NoNode ']' - | CallExprNoBF_NoNode '.' IDENT -; - -Arguments_NoNode: - '(' ')' - | '(' ArgumentList_NoNode ')' -; - -ArgumentList_NoNode: - AssignmentExpr_NoNode - | ArgumentList_NoNode ',' AssignmentExpr_NoNode -; - -LeftHandSideExpr_NoNode: - NewExpr_NoNode - | CallExpr_NoNode -; - -LeftHandSideExprNoBF_NoNode: - NewExprNoBF_NoNode - | CallExprNoBF_NoNode -; - -PostfixExpr_NoNode: - LeftHandSideExpr_NoNode - | LeftHandSideExpr_NoNode PLUSPLUS - | LeftHandSideExpr_NoNode MINUSMINUS -; - -PostfixExprNoBF_NoNode: - LeftHandSideExprNoBF_NoNode - | LeftHandSideExprNoBF_NoNode PLUSPLUS - | LeftHandSideExprNoBF_NoNode MINUSMINUS -; - -UnaryExprCommon_NoNode: - DELETETOKEN UnaryExpr_NoNode - | VOIDTOKEN UnaryExpr_NoNode - | TYPEOF UnaryExpr_NoNode - | PLUSPLUS UnaryExpr_NoNode - | AUTOPLUSPLUS UnaryExpr_NoNode - | MINUSMINUS UnaryExpr_NoNode - | AUTOMINUSMINUS UnaryExpr_NoNode - | '+' UnaryExpr_NoNode - | '-' UnaryExpr_NoNode - | '~' UnaryExpr_NoNode - | '!' UnaryExpr_NoNode - -UnaryExpr_NoNode: - PostfixExpr_NoNode - | UnaryExprCommon_NoNode -; - -UnaryExprNoBF_NoNode: - PostfixExprNoBF_NoNode - | UnaryExprCommon_NoNode -; - -MultiplicativeExpr_NoNode: - UnaryExpr_NoNode - | MultiplicativeExpr_NoNode '*' UnaryExpr_NoNode - | MultiplicativeExpr_NoNode '/' UnaryExpr_NoNode - | MultiplicativeExpr_NoNode '%' UnaryExpr_NoNode -; - -MultiplicativeExprNoBF_NoNode: - UnaryExprNoBF_NoNode - | MultiplicativeExprNoBF_NoNode '*' UnaryExpr_NoNode - | MultiplicativeExprNoBF_NoNode '/' UnaryExpr_NoNode - | MultiplicativeExprNoBF_NoNode '%' UnaryExpr_NoNode -; - -AdditiveExpr_NoNode: - MultiplicativeExpr_NoNode - | AdditiveExpr_NoNode '+' MultiplicativeExpr_NoNode - | AdditiveExpr_NoNode '-' MultiplicativeExpr_NoNode -; - -AdditiveExprNoBF_NoNode: - MultiplicativeExprNoBF_NoNode - | AdditiveExprNoBF_NoNode '+' MultiplicativeExpr_NoNode - | AdditiveExprNoBF_NoNode '-' MultiplicativeExpr_NoNode -; - -ShiftExpr_NoNode: - AdditiveExpr_NoNode - | ShiftExpr_NoNode LSHIFT AdditiveExpr_NoNode - | ShiftExpr_NoNode RSHIFT AdditiveExpr_NoNode - | ShiftExpr_NoNode URSHIFT AdditiveExpr_NoNode -; - -ShiftExprNoBF_NoNode: - AdditiveExprNoBF_NoNode - | ShiftExprNoBF_NoNode LSHIFT AdditiveExpr_NoNode - | ShiftExprNoBF_NoNode RSHIFT AdditiveExpr_NoNode - | ShiftExprNoBF_NoNode URSHIFT AdditiveExpr_NoNode -; - -RelationalExpr_NoNode: - ShiftExpr_NoNode - | RelationalExpr_NoNode '<' ShiftExpr_NoNode - | RelationalExpr_NoNode '>' ShiftExpr_NoNode - | RelationalExpr_NoNode LE ShiftExpr_NoNode - | RelationalExpr_NoNode GE ShiftExpr_NoNode - | RelationalExpr_NoNode INSTANCEOF ShiftExpr_NoNode - | RelationalExpr_NoNode INTOKEN ShiftExpr_NoNode -; - -RelationalExprNoIn_NoNode: - ShiftExpr_NoNode - | RelationalExprNoIn_NoNode '<' ShiftExpr_NoNode - | RelationalExprNoIn_NoNode '>' ShiftExpr_NoNode - | RelationalExprNoIn_NoNode LE ShiftExpr_NoNode - | RelationalExprNoIn_NoNode GE ShiftExpr_NoNode - | RelationalExprNoIn_NoNode INSTANCEOF ShiftExpr_NoNode -; - -RelationalExprNoBF_NoNode: - ShiftExprNoBF_NoNode - | RelationalExprNoBF_NoNode '<' ShiftExpr_NoNode - | RelationalExprNoBF_NoNode '>' ShiftExpr_NoNode - | RelationalExprNoBF_NoNode LE ShiftExpr_NoNode - | RelationalExprNoBF_NoNode GE ShiftExpr_NoNode - | RelationalExprNoBF_NoNode INSTANCEOF ShiftExpr_NoNode - | RelationalExprNoBF_NoNode INTOKEN ShiftExpr_NoNode -; - -EqualityExpr_NoNode: - RelationalExpr_NoNode - | EqualityExpr_NoNode EQEQ RelationalExpr_NoNode - | EqualityExpr_NoNode NE RelationalExpr_NoNode - | EqualityExpr_NoNode STREQ RelationalExpr_NoNode - | EqualityExpr_NoNode STRNEQ RelationalExpr_NoNode -; - -EqualityExprNoIn_NoNode: - RelationalExprNoIn_NoNode - | EqualityExprNoIn_NoNode EQEQ RelationalExprNoIn_NoNode - | EqualityExprNoIn_NoNode NE RelationalExprNoIn_NoNode - | EqualityExprNoIn_NoNode STREQ RelationalExprNoIn_NoNode - | EqualityExprNoIn_NoNode STRNEQ RelationalExprNoIn_NoNode -; - -EqualityExprNoBF_NoNode: - RelationalExprNoBF_NoNode - | EqualityExprNoBF_NoNode EQEQ RelationalExpr_NoNode - | EqualityExprNoBF_NoNode NE RelationalExpr_NoNode - | EqualityExprNoBF_NoNode STREQ RelationalExpr_NoNode - | EqualityExprNoBF_NoNode STRNEQ RelationalExpr_NoNode -; - -BitwiseANDExpr_NoNode: - EqualityExpr_NoNode - | BitwiseANDExpr_NoNode '&' EqualityExpr_NoNode -; - -BitwiseANDExprNoIn_NoNode: - EqualityExprNoIn_NoNode - | BitwiseANDExprNoIn_NoNode '&' EqualityExprNoIn_NoNode -; - -BitwiseANDExprNoBF_NoNode: - EqualityExprNoBF_NoNode - | BitwiseANDExprNoBF_NoNode '&' EqualityExpr_NoNode -; - -BitwiseXORExpr_NoNode: - BitwiseANDExpr_NoNode - | BitwiseXORExpr_NoNode '^' BitwiseANDExpr_NoNode -; - -BitwiseXORExprNoIn_NoNode: - BitwiseANDExprNoIn_NoNode - | BitwiseXORExprNoIn_NoNode '^' BitwiseANDExprNoIn_NoNode -; - -BitwiseXORExprNoBF_NoNode: - BitwiseANDExprNoBF_NoNode - | BitwiseXORExprNoBF_NoNode '^' BitwiseANDExpr_NoNode -; - -BitwiseORExpr_NoNode: - BitwiseXORExpr_NoNode - | BitwiseORExpr_NoNode '|' BitwiseXORExpr_NoNode -; - -BitwiseORExprNoIn_NoNode: - BitwiseXORExprNoIn_NoNode - | BitwiseORExprNoIn_NoNode '|' BitwiseXORExprNoIn_NoNode -; - -BitwiseORExprNoBF_NoNode: - BitwiseXORExprNoBF_NoNode - | BitwiseORExprNoBF_NoNode '|' BitwiseXORExpr_NoNode -; - -LogicalANDExpr_NoNode: - BitwiseORExpr_NoNode - | LogicalANDExpr_NoNode AND BitwiseORExpr_NoNode -; - -LogicalANDExprNoIn_NoNode: - BitwiseORExprNoIn_NoNode - | LogicalANDExprNoIn_NoNode AND BitwiseORExprNoIn_NoNode -; - -LogicalANDExprNoBF_NoNode: - BitwiseORExprNoBF_NoNode - | LogicalANDExprNoBF_NoNode AND BitwiseORExpr_NoNode -; - -LogicalORExpr_NoNode: - LogicalANDExpr_NoNode - | LogicalORExpr_NoNode OR LogicalANDExpr_NoNode -; - -LogicalORExprNoIn_NoNode: - LogicalANDExprNoIn_NoNode - | LogicalORExprNoIn_NoNode OR LogicalANDExprNoIn_NoNode -; - -LogicalORExprNoBF_NoNode: - LogicalANDExprNoBF_NoNode - | LogicalORExprNoBF_NoNode OR LogicalANDExpr_NoNode -; - -ConditionalExpr_NoNode: - LogicalORExpr_NoNode - | LogicalORExpr_NoNode '?' AssignmentExpr_NoNode ':' AssignmentExpr_NoNode -; - -ConditionalExprNoIn_NoNode: - LogicalORExprNoIn_NoNode - | LogicalORExprNoIn_NoNode '?' AssignmentExprNoIn_NoNode ':' AssignmentExprNoIn_NoNode -; - -ConditionalExprNoBF_NoNode: - LogicalORExprNoBF_NoNode - | LogicalORExprNoBF_NoNode '?' AssignmentExpr_NoNode ':' AssignmentExpr_NoNode -; - -AssignmentExpr_NoNode: - ConditionalExpr_NoNode - | LeftHandSideExpr_NoNode AssignmentOperator_NoNode AssignmentExpr_NoNode -; - -AssignmentExprNoIn_NoNode: - ConditionalExprNoIn_NoNode - | LeftHandSideExpr_NoNode AssignmentOperator_NoNode AssignmentExprNoIn_NoNode -; - -AssignmentExprNoBF_NoNode: - ConditionalExprNoBF_NoNode - | LeftHandSideExprNoBF_NoNode AssignmentOperator_NoNode AssignmentExpr_NoNode -; - -AssignmentOperator_NoNode: - '=' - | PLUSEQUAL - | MINUSEQUAL - | MULTEQUAL - | DIVEQUAL - | LSHIFTEQUAL - | RSHIFTEQUAL - | URSHIFTEQUAL - | ANDEQUAL - | XOREQUAL - | OREQUAL - | MODEQUAL -; - -Expr_NoNode: - AssignmentExpr_NoNode - | Expr_NoNode ',' AssignmentExpr_NoNode -; - -ExprNoIn_NoNode: - AssignmentExprNoIn_NoNode - | ExprNoIn_NoNode ',' AssignmentExprNoIn_NoNode -; - -ExprNoBF_NoNode: - AssignmentExprNoBF_NoNode - | ExprNoBF_NoNode ',' AssignmentExpr_NoNode -; - -Statement_NoNode: - Block_NoNode - | VariableStatement_NoNode - | ConstStatement_NoNode - | FunctionDeclaration_NoNode - | EmptyStatement_NoNode - | ExprStatement_NoNode - | IfStatement_NoNode - | IterationStatement_NoNode - | ContinueStatement_NoNode - | BreakStatement_NoNode - | ReturnStatement_NoNode - | WithStatement_NoNode - | SwitchStatement_NoNode - | LabelledStatement_NoNode - | ThrowStatement_NoNode - | TryStatement_NoNode - | DebuggerStatement_NoNode -; - -Block_NoNode: - OPENBRACE CLOSEBRACE { } - | OPENBRACE SourceElements_NoNode CLOSEBRACE { } -; - -VariableStatement_NoNode: - VAR VariableDeclarationList_NoNode ';' - | VAR VariableDeclarationList_NoNode error { AUTO_SEMICOLON; } -; - -VariableDeclarationList_NoNode: - IDENT { } - | IDENT Initializer_NoNode { } - | VariableDeclarationList_NoNode ',' IDENT - | VariableDeclarationList_NoNode ',' IDENT Initializer_NoNode -; - -VariableDeclarationListNoIn_NoNode: - IDENT { } - | IDENT InitializerNoIn_NoNode { } - | VariableDeclarationListNoIn_NoNode ',' IDENT - | VariableDeclarationListNoIn_NoNode ',' IDENT InitializerNoIn_NoNode -; - -ConstStatement_NoNode: - CONSTTOKEN ConstDeclarationList_NoNode ';' - | CONSTTOKEN ConstDeclarationList_NoNode error { AUTO_SEMICOLON; } -; - -ConstDeclarationList_NoNode: - ConstDeclaration_NoNode - | ConstDeclarationList_NoNode ',' ConstDeclaration_NoNode -; - -ConstDeclaration_NoNode: - IDENT { } - | IDENT Initializer_NoNode { } -; - -Initializer_NoNode: - '=' AssignmentExpr_NoNode -; - -InitializerNoIn_NoNode: - '=' AssignmentExprNoIn_NoNode -; - -EmptyStatement_NoNode: - ';' -; - -ExprStatement_NoNode: - ExprNoBF_NoNode ';' - | ExprNoBF_NoNode error { AUTO_SEMICOLON; } -; - -IfStatement_NoNode: - IF '(' Expr_NoNode ')' Statement_NoNode %prec IF_WITHOUT_ELSE - | IF '(' Expr_NoNode ')' Statement_NoNode ELSE Statement_NoNode -; - -IterationStatement_NoNode: - DO Statement_NoNode WHILE '(' Expr_NoNode ')' ';' - | DO Statement_NoNode WHILE '(' Expr_NoNode ')' error // Always performs automatic semicolon insertion - | WHILE '(' Expr_NoNode ')' Statement_NoNode - | FOR '(' ExprNoInOpt_NoNode ';' ExprOpt_NoNode ';' ExprOpt_NoNode ')' Statement_NoNode - | FOR '(' VAR VariableDeclarationListNoIn_NoNode ';' ExprOpt_NoNode ';' ExprOpt_NoNode ')' Statement_NoNode - | FOR '(' LeftHandSideExpr_NoNode INTOKEN Expr_NoNode ')' Statement_NoNode - | FOR '(' VAR IDENT INTOKEN Expr_NoNode ')' Statement_NoNode - | FOR '(' VAR IDENT InitializerNoIn_NoNode INTOKEN Expr_NoNode ')' Statement_NoNode -; - -ExprOpt_NoNode: - /* nothing */ - | Expr_NoNode -; - -ExprNoInOpt_NoNode: - /* nothing */ - | ExprNoIn_NoNode -; - -ContinueStatement_NoNode: - CONTINUE ';' - | CONTINUE error { AUTO_SEMICOLON; } - | CONTINUE IDENT ';' - | CONTINUE IDENT error { AUTO_SEMICOLON; } -; - -BreakStatement_NoNode: - BREAK ';' - | BREAK error { AUTO_SEMICOLON; } - | BREAK IDENT ';' - | BREAK IDENT error { AUTO_SEMICOLON; } -; - -ReturnStatement_NoNode: - RETURN ';' - | RETURN error { AUTO_SEMICOLON; } - | RETURN Expr_NoNode ';' - | RETURN Expr_NoNode error { AUTO_SEMICOLON; } -; - -WithStatement_NoNode: - WITH '(' Expr_NoNode ')' Statement_NoNode -; - -SwitchStatement_NoNode: - SWITCH '(' Expr_NoNode ')' CaseBlock_NoNode -; - -CaseBlock_NoNode: - OPENBRACE CaseClausesOpt_NoNode CLOSEBRACE { } - | OPENBRACE CaseClausesOpt_NoNode DefaultClause_NoNode CaseClausesOpt_NoNode CLOSEBRACE { } -; - -CaseClausesOpt_NoNode: - /* nothing */ - | CaseClauses_NoNode -; - -CaseClauses_NoNode: - CaseClause_NoNode - | CaseClauses_NoNode CaseClause_NoNode -; - -CaseClause_NoNode: - CASE Expr_NoNode ':' - | CASE Expr_NoNode ':' SourceElements_NoNode -; - -DefaultClause_NoNode: - DEFAULT ':' - | DEFAULT ':' SourceElements_NoNode -; - -LabelledStatement_NoNode: - IDENT ':' Statement_NoNode { } -; - -ThrowStatement_NoNode: - THROW Expr_NoNode ';' - | THROW Expr_NoNode error { AUTO_SEMICOLON; } -; - -TryStatement_NoNode: - TRY Block_NoNode FINALLY Block_NoNode - | TRY Block_NoNode CATCH '(' IDENT ')' Block_NoNode - | TRY Block_NoNode CATCH '(' IDENT ')' Block_NoNode FINALLY Block_NoNode -; - -DebuggerStatement_NoNode: - DEBUGGER ';' - | DEBUGGER error { AUTO_SEMICOLON; } -; - -FunctionDeclaration_NoNode: - FUNCTION IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE - | FUNCTION IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE -; - -FunctionExpr_NoNode: - FUNCTION '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE - | FUNCTION '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE - | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE - | FUNCTION IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE -; - -FormalParameterList_NoNode: - IDENT { } - | FormalParameterList_NoNode ',' IDENT -; - -FunctionBody_NoNode: - /* not in spec */ - | SourceElements_NoNode -; - -SourceElements_NoNode: - Statement_NoNode - | SourceElements_NoNode Statement_NoNode -; - -// End NoNodes - -%% - -#undef GLOBAL_DATA - -static ExpressionNode* makeAssignNode(JSGlobalData* globalData, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end) -{ - if (!loc->isLocation()) - return new (globalData) AssignErrorNode(globalData, loc, op, expr, divot, divot - start, end - divot); - - if (loc->isResolveNode()) { - ResolveNode* resolve = static_cast(loc); - if (op == OpEqual) { - AssignResolveNode* node = new (globalData) AssignResolveNode(globalData, resolve->identifier(), expr, exprHasAssignments); - setExceptionLocation(node, start, divot, end); - return node; - } else - return new (globalData) ReadModifyResolveNode(globalData, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot); - } - if (loc->isBracketAccessorNode()) { - BracketAccessorNode* bracket = static_cast(loc); - if (op == OpEqual) - return new (globalData) AssignBracketNode(globalData, 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); - node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); - return node; - } - } - ASSERT(loc->isDotAccessorNode()); - DotAccessorNode* dot = static_cast(loc); - if (op == OpEqual) - return new (globalData) AssignDotNode(globalData, 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); - node->setSubexpressionInfo(dot->divot(), dot->endOffset()); - return node; -} - -static ExpressionNode* makePrefixNode(JSGlobalData* globalData, 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); - - if (expr->isResolveNode()) { - ResolveNode* resolve = static_cast(expr); - return new (globalData) PrefixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot); - } - if (expr->isBracketAccessorNode()) { - BracketAccessorNode* bracket = static_cast(expr); - PrefixBracketNode* node = new (globalData) PrefixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot); - node->setSubexpressionInfo(bracket->divot(), bracket->startOffset()); - return node; - } - ASSERT(expr->isDotAccessorNode()); - DotAccessorNode* dot = static_cast(expr); - PrefixDotNode* node = new (globalData) PrefixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot); - node->setSubexpressionInfo(dot->divot(), dot->startOffset()); - return node; -} - -static ExpressionNode* makePostfixNode(JSGlobalData* globalData, 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); - - if (expr->isResolveNode()) { - ResolveNode* resolve = static_cast(expr); - return new (globalData) PostfixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot); - } - if (expr->isBracketAccessorNode()) { - BracketAccessorNode* bracket = static_cast(expr); - PostfixBracketNode* node = new (globalData) PostfixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot); - node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); - return node; - - } - ASSERT(expr->isDotAccessorNode()); - DotAccessorNode* dot = static_cast(expr); - PostfixDotNode* node = new (globalData) PostfixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot); - node->setSubexpressionInfo(dot->divot(), dot->endOffset()); - return node; -} - -static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData* globalData, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end) -{ - CodeFeatures features = func.m_features | args.m_features; - int numConstants = func.m_numConstants + args.m_numConstants; - if (!func.m_node->isLocation()) - return createNodeInfo(new (globalData) FunctionCallValueNode(globalData, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants); - if (func.m_node->isResolveNode()) { - ResolveNode* resolve = static_cast(func.m_node); - const Identifier& identifier = resolve->identifier(); - if (identifier == globalData->propertyNames->eval) - return createNodeInfo(new (globalData) EvalFunctionCallNode(globalData, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants); - return createNodeInfo(new (globalData) FunctionCallResolveNode(globalData, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants); - } - if (func.m_node->isBracketAccessorNode()) { - BracketAccessorNode* bracket = static_cast(func.m_node); - FunctionCallBracketNode* node = new (globalData) FunctionCallBracketNode(globalData, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot); - node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); - return createNodeInfo(node, features, numConstants); - } - ASSERT(func.m_node->isDotAccessorNode()); - DotAccessorNode* dot = static_cast(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); - else - node = new (globalData) FunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot); - node->setSubexpressionInfo(dot->divot(), dot->endOffset()); - return createNodeInfo(node, features, numConstants); -} - -static ExpressionNode* makeTypeOfNode(JSGlobalData* globalData, ExpressionNode* expr) -{ - if (expr->isResolveNode()) { - ResolveNode* resolve = static_cast(expr); - return new (globalData) TypeOfResolveNode(globalData, resolve->identifier()); - } - return new (globalData) TypeOfValueNode(globalData, expr); -} - -static ExpressionNode* makeDeleteNode(JSGlobalData* globalData, ExpressionNode* expr, int start, int divot, int end) -{ - if (!expr->isLocation()) - return new (globalData) DeleteValueNode(globalData, expr); - if (expr->isResolveNode()) { - ResolveNode* resolve = static_cast(expr); - return new (globalData) DeleteResolveNode(globalData, resolve->identifier(), divot, divot - start, end - divot); - } - if (expr->isBracketAccessorNode()) { - BracketAccessorNode* bracket = static_cast(expr); - return new (globalData) DeleteBracketNode(globalData, bracket->base(), bracket->subscript(), divot, divot - start, end - divot); - } - ASSERT(expr->isDotAccessorNode()); - DotAccessorNode* dot = static_cast(expr); - return new (globalData) DeleteDotNode(globalData, 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) -{ - PropertyNode::Type type; - if (getOrSet == "get") - type = PropertyNode::Getter; - else if (getOrSet == "set") - type = PropertyNode::Setter; - else - return 0; - return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames->nullIdentifier, body, source, params), type); -} - -static ExpressionNode* makeNegateNode(JSGlobalData* globalData, ExpressionNode* n) -{ - if (n->isNumber()) { - NumberNode* numberNode = static_cast(n); - numberNode->setValue(-numberNode->value()); - return numberNode; - } - - return new (globalData) NegateNode(globalData, n); -} - -static NumberNode* makeNumberNode(JSGlobalData* globalData, double d) -{ - return new (globalData) NumberNode(globalData, d); -} - -static ExpressionNode* makeBitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr) -{ - if (expr->isNumber()) - return makeNumberNode(globalData, ~toInt32(static_cast(expr)->value())); - return new (globalData) BitwiseNotNode(globalData, expr); -} - -static ExpressionNode* makeMultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) -{ - expr1 = expr1->stripUnaryPlus(); - expr2 = expr2->stripUnaryPlus(); - - if (expr1->isNumber() && expr2->isNumber()) - return makeNumberNode(globalData, static_cast(expr1)->value() * static_cast(expr2)->value()); - - if (expr1->isNumber() && static_cast(expr1)->value() == 1) - return new (globalData) UnaryPlusNode(globalData, expr2); - - if (expr2->isNumber() && static_cast(expr2)->value() == 1) - return new (globalData) UnaryPlusNode(globalData, expr1); - - return new (globalData) MultNode(globalData, expr1, expr2, rightHasAssignments); -} - -static ExpressionNode* makeDivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) -{ - expr1 = expr1->stripUnaryPlus(); - expr2 = expr2->stripUnaryPlus(); - - if (expr1->isNumber() && expr2->isNumber()) - return makeNumberNode(globalData, static_cast(expr1)->value() / static_cast(expr2)->value()); - return new (globalData) DivNode(globalData, expr1, expr2, rightHasAssignments); -} - -static ExpressionNode* makeAddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) -{ - if (expr1->isNumber() && expr2->isNumber()) - return makeNumberNode(globalData, static_cast(expr1)->value() + static_cast(expr2)->value()); - return new (globalData) AddNode(globalData, expr1, expr2, rightHasAssignments); -} - -static ExpressionNode* makeSubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) -{ - expr1 = expr1->stripUnaryPlus(); - expr2 = expr2->stripUnaryPlus(); - - if (expr1->isNumber() && expr2->isNumber()) - return makeNumberNode(globalData, static_cast(expr1)->value() - static_cast(expr2)->value()); - return new (globalData) SubNode(globalData, expr1, expr2, rightHasAssignments); -} - -static ExpressionNode* makeLeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) -{ - if (expr1->isNumber() && expr2->isNumber()) - return makeNumberNode(globalData, toInt32(static_cast(expr1)->value()) << (toUInt32(static_cast(expr2)->value()) & 0x1f)); - return new (globalData) LeftShiftNode(globalData, expr1, expr2, rightHasAssignments); -} - -static ExpressionNode* makeRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) -{ - if (expr1->isNumber() && expr2->isNumber()) - return makeNumberNode(globalData, toInt32(static_cast(expr1)->value()) >> (toUInt32(static_cast(expr2)->value()) & 0x1f)); - return new (globalData) RightShiftNode(globalData, expr1, expr2, rightHasAssignments); -} - -// Called by yyparse on error. -int yyerror(const char*) -{ - return 1; -} - -// 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) -{ - if (!list) - return init; - if (list->isCommaNode()) { - static_cast(list)->append(init); - return list; - } - return new (globalData) CommaNode(globalData, list, init); -} - -// We turn variable declarations into either assignments or empty -// statements (which later get stripped out), because the actual -// declaration work is hoisted up to the start of the function body -static StatementNode* makeVarStatementNode(JSGlobalData* globalData, ExpressionNode* expr) -{ - if (!expr) - return new (globalData) EmptyStatementNode(globalData); - return new (globalData) VarStatementNode(globalData, expr); -} diff --git a/JavaScriptCore/parser/JSParser.cpp b/JavaScriptCore/parser/JSParser.cpp index 1934c0c..5825270 100644 --- a/JavaScriptCore/parser/JSParser.cpp +++ b/JavaScriptCore/parser/JSParser.cpp @@ -25,14 +25,12 @@ #include "config.h" -#if ENABLE(RECURSIVE_PARSE) #include "JSParser.h" using namespace JSC; #include "JSGlobalData.h" #include "NodeInfo.h" -#include "Grammar.h" #include "ASTBuilder.h" #include @@ -1499,6 +1497,3 @@ template TreeExpression JSParser::parseUnaryExpression(TreeB } } - -#endif - diff --git a/JavaScriptCore/parser/JSParser.h b/JavaScriptCore/parser/JSParser.h index e212b2a..554556f 100644 --- a/JavaScriptCore/parser/JSParser.h +++ b/JavaScriptCore/parser/JSParser.h @@ -25,7 +25,6 @@ #ifndef JSParser_h #define JSParser_h -#if ENABLE(RECURSIVE_PARSE) namespace JSC { @@ -121,5 +120,4 @@ struct JSToken { int jsParse(JSGlobalData*); } -#endif #endif // JSParser_h diff --git a/JavaScriptCore/parser/Lexer.cpp b/JavaScriptCore/parser/Lexer.cpp index 3a38273..660b1a4 100644 --- a/JavaScriptCore/parser/Lexer.cpp +++ b/JavaScriptCore/parser/Lexer.cpp @@ -2,6 +2,7 @@ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All Rights Reserved. * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca) + * Copyright (C) 2010 Zoltan Herczeg (zherczeg@inf.u-szeged.hu) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -38,19 +39,178 @@ using namespace WTF; using namespace Unicode; -#if ENABLE(RECURSIVE_PARSE) #include "JSParser.h" -#else -using namespace JSC; -#include "Grammar.h" -#endif - #include "Lookup.h" #include "Lexer.lut.h" namespace JSC { -static const UChar byteOrderMark = 0xFEFF; + +enum CharacterTypes { + // Types for the main switch + CharacterInvalid, + + CharacterAlpha, + CharacterZero, + CharacterNumber, + + CharacterLineTerminator, + CharacterExclamationMark, + CharacterSimple, + CharacterQuote, + CharacterDot, + CharacterSlash, + CharacterBackSlash, + CharacterSemicolon, + CharacterOpenBrace, + CharacterCloseBrace, + + CharacterAdd, + CharacterSub, + CharacterMultiply, + CharacterModulo, + CharacterAnd, + CharacterXor, + CharacterOr, + CharacterLess, + CharacterGreater, + CharacterEqual, + + // Other types (only one so far) + CharacterWhiteSpace, +}; + +// 128 ascii codes +static unsigned char AsciiCharacters[128] = { +/* 0 - Null */ CharacterInvalid, +/* 1 - Start of Heading */ CharacterInvalid, +/* 2 - Start of Text */ CharacterInvalid, +/* 3 - End of Text */ CharacterInvalid, +/* 4 - End of Transm. */ CharacterInvalid, +/* 5 - Enquiry */ CharacterInvalid, +/* 6 - Acknowledgment */ CharacterInvalid, +/* 7 - Bell */ CharacterInvalid, +/* 8 - Back Space */ CharacterInvalid, +/* 9 - Horizontal Tab */ CharacterWhiteSpace, +/* 10 - Line Feed */ CharacterLineTerminator, +/* 11 - Vertical Tab */ CharacterWhiteSpace, +/* 12 - Form Feed */ CharacterWhiteSpace, +/* 13 - Carriage Return */ CharacterLineTerminator, +/* 14 - Shift Out */ CharacterInvalid, +/* 15 - Shift In */ CharacterInvalid, +/* 16 - Data Line Escape */ CharacterInvalid, +/* 17 - Device Control 1 */ CharacterInvalid, +/* 18 - Device Control 2 */ CharacterInvalid, +/* 19 - Device Control 3 */ CharacterInvalid, +/* 20 - Device Control 4 */ CharacterInvalid, +/* 21 - Negative Ack. */ CharacterInvalid, +/* 22 - Synchronous Idle */ CharacterInvalid, +/* 23 - End of Transmit */ CharacterInvalid, +/* 24 - Cancel */ CharacterInvalid, +/* 25 - End of Medium */ CharacterInvalid, +/* 26 - Substitute */ CharacterInvalid, +/* 27 - Escape */ CharacterInvalid, +/* 28 - File Separator */ CharacterInvalid, +/* 29 - Group Separator */ CharacterInvalid, +/* 30 - Record Separator */ CharacterInvalid, +/* 31 - Unit Separator */ CharacterInvalid, +/* 32 - Space */ CharacterWhiteSpace, +/* 33 - ! */ CharacterExclamationMark, +/* 34 - " */ CharacterQuote, +/* 35 - # */ CharacterInvalid, +/* 36 - $ */ CharacterAlpha, +/* 37 - % */ CharacterModulo, +/* 38 - & */ CharacterAnd, +/* 39 - ' */ CharacterQuote, +/* 40 - ( */ CharacterSimple, +/* 41 - ) */ CharacterSimple, +/* 42 - * */ CharacterMultiply, +/* 43 - + */ CharacterAdd, +/* 44 - , */ CharacterSimple, +/* 45 - - */ CharacterSub, +/* 46 - . */ CharacterDot, +/* 47 - / */ CharacterSlash, +/* 48 - 0 */ CharacterZero, +/* 49 - 1 */ CharacterNumber, +/* 50 - 2 */ CharacterNumber, +/* 51 - 3 */ CharacterNumber, +/* 52 - 4 */ CharacterNumber, +/* 53 - 5 */ CharacterNumber, +/* 54 - 6 */ CharacterNumber, +/* 55 - 7 */ CharacterNumber, +/* 56 - 8 */ CharacterNumber, +/* 57 - 9 */ CharacterNumber, +/* 58 - : */ CharacterSimple, +/* 59 - ; */ CharacterSemicolon, +/* 60 - < */ CharacterLess, +/* 61 - = */ CharacterEqual, +/* 62 - > */ CharacterGreater, +/* 63 - ? */ CharacterSimple, +/* 64 - @ */ CharacterInvalid, +/* 65 - A */ CharacterAlpha, +/* 66 - B */ CharacterAlpha, +/* 67 - C */ CharacterAlpha, +/* 68 - D */ CharacterAlpha, +/* 69 - E */ CharacterAlpha, +/* 70 - F */ CharacterAlpha, +/* 71 - G */ CharacterAlpha, +/* 72 - H */ CharacterAlpha, +/* 73 - I */ CharacterAlpha, +/* 74 - J */ CharacterAlpha, +/* 75 - K */ CharacterAlpha, +/* 76 - L */ CharacterAlpha, +/* 77 - M */ CharacterAlpha, +/* 78 - N */ CharacterAlpha, +/* 79 - O */ CharacterAlpha, +/* 80 - P */ CharacterAlpha, +/* 81 - Q */ CharacterAlpha, +/* 82 - R */ CharacterAlpha, +/* 83 - S */ CharacterAlpha, +/* 84 - T */ CharacterAlpha, +/* 85 - U */ CharacterAlpha, +/* 86 - V */ CharacterAlpha, +/* 87 - W */ CharacterAlpha, +/* 88 - X */ CharacterAlpha, +/* 89 - Y */ CharacterAlpha, +/* 90 - Z */ CharacterAlpha, +/* 91 - [ */ CharacterSimple, +/* 92 - \ */ CharacterBackSlash, +/* 93 - ] */ CharacterSimple, +/* 94 - ^ */ CharacterXor, +/* 95 - _ */ CharacterAlpha, +/* 96 - ` */ CharacterInvalid, +/* 97 - a */ CharacterAlpha, +/* 98 - b */ CharacterAlpha, +/* 99 - c */ CharacterAlpha, +/* 100 - d */ CharacterAlpha, +/* 101 - e */ CharacterAlpha, +/* 102 - f */ CharacterAlpha, +/* 103 - g */ CharacterAlpha, +/* 104 - h */ CharacterAlpha, +/* 105 - i */ CharacterAlpha, +/* 106 - j */ CharacterAlpha, +/* 107 - k */ CharacterAlpha, +/* 108 - l */ CharacterAlpha, +/* 109 - m */ CharacterAlpha, +/* 110 - n */ CharacterAlpha, +/* 111 - o */ CharacterAlpha, +/* 112 - p */ CharacterAlpha, +/* 113 - q */ CharacterAlpha, +/* 114 - r */ CharacterAlpha, +/* 115 - s */ CharacterAlpha, +/* 116 - t */ CharacterAlpha, +/* 117 - u */ CharacterAlpha, +/* 118 - v */ CharacterAlpha, +/* 119 - w */ CharacterAlpha, +/* 120 - x */ CharacterAlpha, +/* 121 - y */ CharacterAlpha, +/* 122 - z */ CharacterAlpha, +/* 123 - { */ CharacterOpenBrace, +/* 124 - | */ CharacterOr, +/* 125 - } */ CharacterCloseBrace, +/* 126 - ~ */ CharacterSimple, +/* 127 - Delete */ CharacterInvalid, +}; Lexer::Lexer(JSGlobalData* globalData) : m_isReparsing(false) @@ -64,77 +224,17 @@ Lexer::~Lexer() m_keywordTable.deleteTable(); } -inline const UChar* Lexer::currentCharacter() const +ALWAYS_INLINE const UChar* Lexer::currentCharacter() const { - return m_code - 4; + ASSERT(m_code <= m_codeEnd); + return m_code; } -inline int Lexer::currentOffset() const +ALWAYS_INLINE int Lexer::currentOffset() const { return currentCharacter() - m_codeStart; } -ALWAYS_INLINE void Lexer::shift1() -{ - m_current = m_next1; - m_next1 = m_next2; - m_next2 = m_next3; - if (LIKELY(m_code < m_codeEnd)) - m_next3 = m_code[0]; - else - m_next3 = -1; - - ++m_code; -} - -ALWAYS_INLINE void Lexer::shift2() -{ - m_current = m_next2; - m_next1 = m_next3; - if (LIKELY(m_code + 1 < m_codeEnd)) { - m_next2 = m_code[0]; - m_next3 = m_code[1]; - } else { - m_next2 = m_code < m_codeEnd ? m_code[0] : -1; - m_next3 = -1; - } - - m_code += 2; -} - -ALWAYS_INLINE void Lexer::shift3() -{ - m_current = m_next3; - if (LIKELY(m_code + 2 < m_codeEnd)) { - m_next1 = m_code[0]; - m_next2 = m_code[1]; - m_next3 = m_code[2]; - } else { - m_next1 = m_code < m_codeEnd ? m_code[0] : -1; - m_next2 = m_code + 1 < m_codeEnd ? m_code[1] : -1; - m_next3 = -1; - } - - m_code += 3; -} - -ALWAYS_INLINE void Lexer::shift4() -{ - if (LIKELY(m_code + 3 < m_codeEnd)) { - m_current = m_code[0]; - m_next1 = m_code[1]; - m_next2 = m_code[2]; - m_next3 = m_code[3]; - } else { - m_current = m_code < m_codeEnd ? m_code[0] : -1; - m_next1 = m_code + 1 < m_codeEnd ? m_code[1] : -1; - m_next2 = m_code + 2 < m_codeEnd ? m_code[2] : -1; - m_next3 = -1; - } - - m_code += 4; -} - void Lexer::setCode(const SourceCode& source, ParserArena& arena) { m_arena = &arena.identifierArena(); @@ -155,50 +255,58 @@ void Lexer::setCode(const SourceCode& source, ParserArena& arena) m_buffer8.reserveInitialCapacity(initialReadBufferCapacity); m_buffer16.reserveInitialCapacity((m_codeEnd - m_code) / 2); - // ECMA-262 calls for stripping all Cf characters, but we only strip BOM characters. - // See for details. - if (source.provider()->hasBOMs()) { - for (const UChar* p = m_codeStart; p < m_codeEnd; ++p) { - if (UNLIKELY(*p == byteOrderMark)) { - copyCodeWithoutBOMs(); - break; - } - } - } - - // Read the first characters into the 4-character buffer. - shift4(); + if (LIKELY(m_code < m_codeEnd)) + m_current = *m_code; + else + m_current = -1; ASSERT(currentOffset() == source.startOffset()); } -void Lexer::copyCodeWithoutBOMs() +ALWAYS_INLINE void Lexer::shift() { - // Note: In this case, the character offset data for debugging will be incorrect. - // If it's important to correctly debug code with extraneous BOMs, then the caller - // should strip the BOMs when creating the SourceProvider object and do its own - // mapping of offsets within the stripped text to original text offset. - - m_codeWithoutBOMs.reserveCapacity(m_codeEnd - m_code); - for (const UChar* p = m_code; p < m_codeEnd; ++p) { - UChar c = *p; - if (c != byteOrderMark) - m_codeWithoutBOMs.append(c); - } - ptrdiff_t startDelta = m_codeStart - m_code; - m_code = m_codeWithoutBOMs.data(); - m_codeStart = m_code + startDelta; - m_codeEnd = m_codeWithoutBOMs.data() + m_codeWithoutBOMs.size(); + // Faster than an if-else sequence + ASSERT(m_current != -1); + m_current = -1; + ++m_code; + if (LIKELY(m_code < m_codeEnd)) + m_current = *m_code; +} + +ALWAYS_INLINE int Lexer::peek(int offset) +{ + // Only use if necessary + ASSERT(offset > 0 && offset < 5); + const UChar* code = m_code + offset; + return (code < m_codeEnd) ? *code : -1; +} + +int Lexer::getUnicodeCharacter() +{ + int char1 = peek(1); + int char2 = peek(2); + int char3 = peek(3); + + if (UNLIKELY(!isASCIIHexDigit(m_current) || !isASCIIHexDigit(char1) || !isASCIIHexDigit(char2) || !isASCIIHexDigit(char3))) + return -1; + + int result = convertUnicode(m_current, char1, char2, char3); + shift(); + shift(); + shift(); + shift(); + return result; } void Lexer::shiftLineTerminator() { ASSERT(isLineTerminator(m_current)); + int m_prev = m_current; + shift(); + // Allow both CRLF and LFCR. - if (m_current + m_next1 == '\n' + '\r') - shift2(); - else - shift1(); + if (m_prev + m_current == '\n' + '\r') + shift(); ++m_lineNumber; } @@ -208,7 +316,7 @@ ALWAYS_INLINE const Identifier* Lexer::makeIdentifier(const UChar* characters, s return &m_arena->makeIdentifier(m_globalData, characters, length); } -inline bool Lexer::lastTokenWasRestrKeyword() const +ALWAYS_INLINE bool Lexer::lastTokenWasRestrKeyword() const { return m_lastToken == CONTINUE || m_lastToken == BREAK || m_lastToken == RETURN || m_lastToken == THROW; } @@ -286,11 +394,11 @@ int Lexer::lex(void* p1, void* p2) start: while (isWhiteSpace(m_current)) - shift1(); + shift(); int startOffset = currentOffset(); - if (m_current == -1) { + if (UNLIKELY(m_current == -1)) { if (!m_terminator && !m_delimited && !m_isReparsing) { // automatic semicolon insertion if program incomplete token = ';'; @@ -300,265 +408,268 @@ start: } m_delimited = false; - switch (m_current) { - case '>': - if (m_next1 == '>' && m_next2 == '>') { - if (m_next3 == '=') { - shift4(); - token = URSHIFTEQUAL; + ASSERT(m_current >= 0); + + if (m_current < 128) { + ASSERT(isASCII(m_current)); + + switch (AsciiCharacters[m_current]) { + case CharacterGreater: + shift(); + if (m_current == '>') { + shift(); + if (m_current == '>') { + shift(); + if (m_current == '=') { + shift(); + token = URSHIFTEQUAL; + break; + } + token = URSHIFT; break; } - shift3(); - token = URSHIFT; - break; - } - if (m_next1 == '>') { - if (m_next2 == '=') { - shift3(); + if (m_current == '=') { + shift(); token = RSHIFTEQUAL; break; } - shift2(); token = RSHIFT; break; } - if (m_next1 == '=') { - shift2(); + if (m_current == '=') { + shift(); token = GE; break; } - shift1(); token = '>'; break; - case '=': - if (m_next1 == '=') { - if (m_next2 == '=') { - shift3(); + case CharacterEqual: + shift(); + if (m_current == '=') { + shift(); + if (m_current == '=') { + shift(); token = STREQ; break; } - shift2(); token = EQEQ; break; } - shift1(); token = '='; break; - case '!': - if (m_next1 == '=') { - if (m_next2 == '=') { - shift3(); - token = STRNEQ; - break; - } - shift2(); - token = NE; - break; - } - shift1(); - token = '!'; - break; - case '<': - if (m_next1 == '!' && m_next2 == '-' && m_next3 == '-') { + case CharacterLess: + shift(); + if (m_current == '!' && peek(1) == '-' && peek(2) == '-') { //