source: webkit/trunk/Source/JavaScriptCore/DerivedSources.pri@ 146089

Last change on this file since 146089 was 146089, checked in by [email protected], 12 years ago

DFG string conversions and allocations should be inlined
https://bugs.webkit.org/show_bug.cgi?id=112376

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

This turns new String(), String(), String.prototype.valueOf(), and
String.prototype.toString() into intrinsics. It gives the DFG the ability to handle
conversions from StringObject to JSString and vice-versa, and also gives it the
ability to handle cases where a variable may be either a StringObject or a JSString.
To do this, I added StringObject to value profiling (and removed the stale
distinction between Myarguments and Foreignarguments). I also cleaned up ToPrimitive
handling, using some of the new functionality but also taking advantage of the
existence of Identity(String:@a).

This is a 2% SunSpider speed-up. Also there are some speed-ups on V8v7 and Kraken.
On microbenchmarks that stress new String() this is a 14x speed-up.

  • CMakeLists.txt:
  • DerivedSources.make:
  • DerivedSources.pri:
  • GNUmakefile.list.am:
  • bytecode/CodeBlock.h:

(CodeBlock):
(JSC::CodeBlock::hasExitSite):
(JSC):

  • bytecode/DFGExitProfile.cpp:

(JSC::DFG::ExitProfile::hasExitSite):
(DFG):

  • bytecode/DFGExitProfile.h:

(ExitProfile):
(JSC::DFG::ExitProfile::hasExitSite):

  • bytecode/ExitKind.cpp:

(JSC::exitKindToString):

  • bytecode/ExitKind.h:
  • bytecode/SpeculatedType.cpp:

(JSC::dumpSpeculation):
(JSC::speculationToAbbreviatedString):
(JSC::speculationFromClassInfo):

  • bytecode/SpeculatedType.h:

(JSC):
(JSC::isStringObjectSpeculation):
(JSC::isStringOrStringObjectSpeculation):

  • create_hash_table:
  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::executeEffects):

  • dfg/DFGAbstractState.h:

(JSC::DFG::AbstractState::filterEdgeByUse):

  • dfg/DFGByteCodeParser.cpp:

(ByteCodeParser):
(JSC::DFG::ByteCodeParser::handleCall):
(JSC::DFG::ByteCodeParser::emitArgumentPhantoms):
(DFG):
(JSC::DFG::ByteCodeParser::handleConstantInternalFunction):

  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::putStructureStoreElimination):

  • dfg/DFGEdge.h:

(JSC::DFG::Edge::shift):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::isStringPrototypeMethodSane):
(FixupPhase):
(JSC::DFG::FixupPhase::canOptimizeStringObjectAccess):
(JSC::DFG::FixupPhase::observeUseKindOnNode):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::hasGlobalExitSite):
(Graph):
(JSC::DFG::Graph::hasExitSite):
(JSC::DFG::Graph::clobbersWorld):

  • dfg/DFGNode.h:

(JSC::DFG::Node::convertToToString):
(Node):
(JSC::DFG::Node::hasStructure):
(JSC::DFG::Node::shouldSpeculateStringObject):
(JSC::DFG::Node::shouldSpeculateStringOrStringObject):

  • dfg/DFGNodeType.h:

(DFG):

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileToStringOnCell):
(DFG):
(JSC::DFG::SpeculativeJIT::compileNewStringObject):
(JSC::DFG::SpeculativeJIT::speculateObject):
(JSC::DFG::SpeculativeJIT::speculateObjectOrOther):
(JSC::DFG::SpeculativeJIT::speculateString):
(JSC::DFG::SpeculativeJIT::speculateStringObject):
(JSC::DFG::SpeculativeJIT::speculateStringOrStringObject):
(JSC::DFG::SpeculativeJIT::speculate):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::callOperation):
(SpeculativeJIT):
(JSC::DFG::SpeculateCellOperand::SpeculateCellOperand):
(DFG):
(JSC::DFG::SpeculativeJIT::speculateStringObjectForStructure):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::fillSpeculateCell):
(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::fillSpeculateCell):
(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGUseKind.cpp:

(WTF::printInternal):

  • dfg/DFGUseKind.h:

(JSC::DFG::typeFilterFor):

  • interpreter/CallFrame.h:

(JSC::ExecState::regExpPrototypeTable):

  • runtime/CommonIdentifiers.h:
  • runtime/Intrinsic.h:
  • runtime/JSDestructibleObject.h:

(JSDestructibleObject):
(JSC::JSDestructibleObject::classInfoOffset):

  • runtime/JSGlobalData.cpp:

(JSC):
(JSC::JSGlobalData::JSGlobalData):
(JSC::JSGlobalData::~JSGlobalData):

  • runtime/JSGlobalData.h:

(JSGlobalData):

  • runtime/JSObject.cpp:
  • runtime/JSObject.h:

(JSC):

  • runtime/JSWrapperObject.h:

(JSC::JSWrapperObject::allocationSize):
(JSWrapperObject):
(JSC::JSWrapperObject::internalValueOffset):
(JSC::JSWrapperObject::internalValueCellOffset):

  • runtime/StringPrototype.cpp:

(JSC):
(JSC::StringPrototype::finishCreation):
(JSC::StringPrototype::create):

  • runtime/StringPrototype.h:

(StringPrototype):

LayoutTests:

Reviewed by Geoffrey Garen.

  • fast/js/dfg-to-string-bad-toString-expected.txt: Added.
  • fast/js/dfg-to-string-bad-toString.html: Added.
  • fast/js/dfg-to-string-bad-valueOf-expected.txt: Added.
  • fast/js/dfg-to-string-bad-valueOf.html: Added.
  • fast/js/dfg-to-string-int-expected.txt: Added.
  • fast/js/dfg-to-string-int-or-string-expected.txt: Added.
  • fast/js/dfg-to-string-int-or-string.html: Added.
  • fast/js/dfg-to-string-int.html: Added.
  • fast/js/dfg-to-string-side-effect-clobbers-toString-expected.txt: Added.
  • fast/js/dfg-to-string-side-effect-clobbers-toString.html: Added.
  • fast/js/dfg-to-string-side-effect-expected.txt: Added.
  • fast/js/dfg-to-string-side-effect.html: Added.
  • fast/js/dfg-to-string-toString-becomes-bad-expected.txt: Added.
  • fast/js/dfg-to-string-toString-becomes-bad-with-dictionary-string-prototype-expected.txt: Added.
  • fast/js/dfg-to-string-toString-becomes-bad-with-dictionary-string-prototype.html: Added.
  • fast/js/dfg-to-string-toString-becomes-bad.html: Added.
  • fast/js/dfg-to-string-toString-in-string-expected.txt: Added.
  • fast/js/dfg-to-string-toString-in-string.html: Added.
  • fast/js/dfg-to-string-valueOf-becomes-bad-expected.txt: Added.
  • fast/js/dfg-to-string-valueOf-becomes-bad.html: Added.
  • fast/js/dfg-to-string-valueOf-in-string-expected.txt: Added.
  • fast/js/dfg-to-string-valueOf-in-string.html: Added.
  • fast/js/jsc-test-list:
  • fast/js/regress/script-tests/string-concat-object.js: Added.

(foo):

  • fast/js/regress/script-tests/string-concat-pair-object.js: Added.

(foo):

  • fast/js/regress/script-tests/string-concat-pair-simple.js: Added.

(foo):

  • fast/js/regress/script-tests/string-concat-simple.js: Added.

(foo):

  • fast/js/regress/script-tests/string-cons-repeat.js: Added.

(foo):

  • fast/js/regress/script-tests/string-cons-tower.js: Added.

(foo):

  • fast/js/regress/string-concat-object-expected.txt: Added.
  • fast/js/regress/string-concat-object.html: Added.
  • fast/js/regress/string-concat-pair-object-expected.txt: Added.
  • fast/js/regress/string-concat-pair-object.html: Added.
  • fast/js/regress/string-concat-pair-simple-expected.txt: Added.
  • fast/js/regress/string-concat-pair-simple.html: Added.
  • fast/js/regress/string-concat-simple-expected.txt: Added.
  • fast/js/regress/string-concat-simple.html: Added.
  • fast/js/regress/string-cons-repeat-expected.txt: Added.
  • fast/js/regress/string-cons-repeat.html: Added.
  • fast/js/regress/string-cons-tower-expected.txt: Added.
  • fast/js/regress/string-cons-tower.html: Added.
  • fast/js/script-tests/dfg-to-string-bad-toString.js: Added.

(String.prototype.toString):
(foo):

  • fast/js/script-tests/dfg-to-string-bad-valueOf.js: Added.

(String.prototype.valueOf):
(foo):

  • fast/js/script-tests/dfg-to-string-int-or-string.js: Added.

(foo):

  • fast/js/script-tests/dfg-to-string-int.js: Added.

(foo):

  • fast/js/script-tests/dfg-to-string-side-effect-clobbers-toString.js: Added.

(foo):

  • fast/js/script-tests/dfg-to-string-side-effect.js: Added.

(foo):

  • fast/js/script-tests/dfg-to-string-toString-becomes-bad-with-dictionary-string-prototype.js: Added.

(foo):
(.String.prototype.toString):

  • fast/js/script-tests/dfg-to-string-toString-becomes-bad.js: Added.

(foo):
(.String.prototype.toString):

  • fast/js/script-tests/dfg-to-string-toString-in-string.js: Added.

(foo):
(.argument.toString):

  • fast/js/script-tests/dfg-to-string-valueOf-becomes-bad.js: Added.

(foo):
(.String.prototype.valueOf):

  • fast/js/script-tests/dfg-to-string-valueOf-in-string.js: Added.

(foo):
(.argument.valueOf):

File size: 4.0 KB
Line 
1# -------------------------------------------------------------------
2# Derived sources for JavaScriptSource
3#
4# See 'Tools/qmake/README' for an overview of the build system
5# -------------------------------------------------------------------
6
7TEMPLATE = derived
8
9LUT_FILES += \
10 runtime/ArrayConstructor.cpp \
11 runtime/ArrayPrototype.cpp \
12 runtime/BooleanPrototype.cpp \
13 runtime/DateConstructor.cpp \
14 runtime/DatePrototype.cpp \
15 runtime/ErrorPrototype.cpp \
16 runtime/JSGlobalObject.cpp \
17 runtime/JSONObject.cpp \
18 runtime/MathObject.cpp \
19 runtime/NamePrototype.cpp \
20 runtime/NumberConstructor.cpp \
21 runtime/NumberPrototype.cpp \
22 runtime/ObjectConstructor.cpp \
23 runtime/RegExpConstructor.cpp \
24 runtime/RegExpObject.cpp \
25 runtime/RegExpPrototype.cpp \
26 runtime/StringConstructor.cpp \
27
28KEYWORDLUT_FILES += \
29 parser/Keywords.table
30
31JIT_STUB_FILES += \
32 jit/JITStubs.cpp
33
34LLINT_ASSEMBLER = $$PWD/llint/LowLevelInterpreter.asm
35
36LLINT_DEPENDENCY = \
37 $$PWD/llint/LowLevelInterpreter32_64.asm \
38 $$PWD/llint/LowLevelInterpreter64.asm \
39 $$LLINT_ASSEMBLER
40
41DISASSEMBLER_FILES = \
42 disassembler/udis86/optable.xml
43
44DISASSEMBLER_DEPENDENCY = \
45 $$PWD/disassembler/udis86/ud_opcode.py \
46 $$PWD/disassembler/udis86/ud_optable.py
47
48# GENERATOR 1-A: LUT creator
49lut.output = ${QMAKE_FILE_BASE}.lut.h
50lut.input = LUT_FILES
51lut.script = $$PWD/create_hash_table
52lut.commands = perl $$lut.script ${QMAKE_FILE_NAME} -i > ${QMAKE_FILE_OUT}
53lut.depends = ${QMAKE_FILE_NAME}
54GENERATORS += lut
55
56# GENERATOR 1-B: particular LUT creator (for 1 file only)
57keywordlut.output = Lexer.lut.h
58keywordlut.input = KEYWORDLUT_FILES
59keywordlut.script = $$PWD/create_hash_table
60keywordlut.commands = perl $$keywordlut.script ${QMAKE_FILE_NAME} -i > ${QMAKE_FILE_OUT}
61keywordlut.depends = ${QMAKE_FILE_NAME}
62GENERATORS += keywordlut
63
64# GENERATOR 2-A: JIT Stub functions for RVCT
65rvctstubs.output = Generated${QMAKE_FILE_BASE}_RVCT.h
66rvctstubs.script = $$PWD/create_jit_stubs
67rvctstubs.commands = perl -i $$rvctstubs.script --prefix RVCT ${QMAKE_FILE_NAME} > ${QMAKE_FILE_OUT}
68rvctstubs.depends = ${QMAKE_FILE_NAME}
69rvctstubs.input = JIT_STUB_FILES
70rvctstubs.CONFIG += no_link
71GENERATORS += rvctstubs
72
73# GENERATOR 2-B: JIT Stub functions for MSVC
74msvcstubs.output = Generated${QMAKE_FILE_BASE}_MSVC.asm
75msvcstubs.script = $$PWD/create_jit_stubs
76msvcstubs.commands = perl -i $$msvcstubs.script --prefix MSVC ${QMAKE_FILE_NAME} > ${QMAKE_FILE_OUT}
77msvcstubs.depends = ${QMAKE_FILE_NAME}
78msvcstubs.input = JIT_STUB_FILES
79msvcstubs.CONFIG += no_link
80GENERATORS += msvcstubs
81
82#GENERATOR: "RegExpJitTables.h": tables used by Yarr
83retgen.output = RegExpJitTables.h
84retgen.script = $$PWD/create_regex_tables
85retgen.input = retgen.script
86retgen.commands = python $$retgen.script > ${QMAKE_FILE_OUT}
87GENERATORS += retgen
88
89#GENERATOR: "KeywordLookup.h": decision tree used by the lexer
90klgen.output = KeywordLookup.h
91klgen.script = $$PWD/KeywordLookupGenerator.py
92klgen.input = KEYWORDLUT_FILES
93klgen.commands = python $$klgen.script ${QMAKE_FILE_NAME} > ${QMAKE_FILE_OUT}
94GENERATORS += klgen
95
96EXTRACTOR_BINARY = LLIntOffsetsExtractor$$BIN_EXTENSION
97DIRS = $$OUT_PWD $$OUT_PWD/debug $$OUT_PWD/release
98for(dir, DIRS) {
99 file = $$dir/$$EXTRACTOR_BINARY
100 exists($$file): LLINT_FILES += $$file
101}
102
103#GENERATOR: LLInt
104llint.output = ${QMAKE_FILE_IN_PATH}$${QMAKE_DIR_SEP}LLIntAssembly.h
105llint.script = $$PWD/offlineasm/asm.rb
106llint.input = LLINT_FILES
107llint.depends = $$LLINT_DEPENDENCY
108llint.commands = ruby $$llint.script $$LLINT_ASSEMBLER ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
109GENERATORS += llint
110
111linux-*:if(isEqual(QT_ARCH, "i386")|isEqual(QT_ARCH, "x86_64")) {
112 # GENERATOR: disassembler
113 disassembler.output = udis86_itab.c
114 disassembler.input = DISASSEMBLER_FILES
115 disassembler.script = $$PWD/disassembler/udis86/itab.py
116 disassembler.depends = $$DISASSEMBLER_DEPENDENCY
117 disassembler.commands = python $$disassembler.script ${QMAKE_FILE_NAME} --outputDir ${QMAKE_FUNC_FILE_OUT_PATH}
118 disassembler.CONFIG += no_link
119 GENERATORS += disassembler
120}
Note: See TracBrowser for help on using the repository browser.