blob: b9b0ae64419c03b908b1cf89a4257db9bb494c86 [file] [log] [blame]
fpizlo@apple.com26e27a62012-07-20 00:04:51 +000012012-07-19 Filip Pizlo <fpizlo@apple.com>
2
3 Fast path of storage resize should be removed from property storage reallocation, since it is only useful for arrays
4 https://bugs.webkit.org/show_bug.cgi?id=91796
5
6 Reviewed by Geoffrey Garen.
7
8 * dfg/DFGRepatch.cpp:
9 (JSC::DFG::emitPutTransitionStub):
10 * dfg/DFGSpeculativeJIT.cpp:
11 (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):
12 * runtime/JSObject.cpp:
13 (JSC::JSObject::growOutOfLineStorage):
14
commit-queue@webkit.orge602eca2012-07-19 20:53:22 +0000152012-07-19 Mark Lam <mark.lam@apple.com>
16
17 Bug fixes and enhancements for OfflineASM annotation system.
18 https://bugs.webkit.org/show_bug.cgi?id=91690
19
20 Reviewed by Filip Pizlo.
21
22 * offlineasm/armv7.rb: added default handling of Instruction lower().
23 * offlineasm/asm.rb: added more support for annotations and more pretty printing.
24 * offlineasm/ast.rb: added more support for annotations.
25 * offlineasm/config.rb: added $preferredCommentStartColumn, simplified $enableInstrAnnotations.
26 * offlineasm/parser.rb: added more support for annotations.
27 * offlineasm/transform.rb: added more support for annotations.
28 * offlineasm/x86.rb: added default handling of Instruction lower().
29
paroga@webkit.orgcb7c1a12012-07-19 18:20:53 +0000302012-07-19 Patrick Gansterer <paroga@webkit.org>
31
32 [WIN] Fix compilation of JSGlobalData.h with ENABLE(DFG_JIT)
33 https://bugs.webkit.org/show_bug.cgi?id=91243
34
35 Reviewed by Geoffrey Garen.
36
37 Disable MSVC warning 4200 "zero-sized array in struct/union" for JSC::ScratchBuffer.
38
39 * runtime/JSGlobalData.h:
40 (JSC):
41
commit-queue@webkit.orgf06140e2012-07-19 15:45:26 +0000422012-07-19 Mark Lam <mark.lam@apple.com>
43
44 Fixed broken ENABLE_JIT=0 build.
45 https://bugs.webkit.org/show_bug.cgi?id=91725
46
47 Reviewed by Oliver Hunt.
48
49 * bytecode/Watchpoint.cpp:
50 * heap/JITStubRoutineSet.h:
51 (JSC):
52 (JITStubRoutineSet):
53 (JSC::JITStubRoutineSet::JITStubRoutineSet):
54 (JSC::JITStubRoutineSet::~JITStubRoutineSet):
55 (JSC::JITStubRoutineSet::add):
56 (JSC::JITStubRoutineSet::clearMarks):
57 (JSC::JITStubRoutineSet::mark):
58 (JSC::JITStubRoutineSet::deleteUnmarkedJettisonedStubRoutines):
59 (JSC::JITStubRoutineSet::traceMarkedStubRoutines):
60
kkristof@inf.u-szeged.hub203f612012-07-19 13:21:38 +0000612012-07-19 Kristóf Kosztyó <kkristof@inf.u-szeged.hu>
62
63 [Qt] Unreviewed buildfix after r123042.
64
65 * interpreter/Interpreter.cpp:
66 (JSC::Interpreter::dumpRegisters):
67
fpizlo@apple.com1ffdcff2012-07-19 00:30:34 +0000682012-07-18 Filip Pizlo <fpizlo@apple.com>
69
70 DFG should emit inline code for property storage (re)allocation
71 https://bugs.webkit.org/show_bug.cgi?id=91597
72
73 Reviewed by Oliver Hunt.
74
75 This adds two new ops to the DFG IR: AllocatePropertyStorage and
76 ReallocatePropertyStorage. It enables these to interact properly with
77 CSE so that a GetPropertyStorage on something for which we have
78 obviously done a (Re)AllocatePropertyStorage will result in the
79 GetPropertyStorage being eliminated. Other than that, the code
80 emitted for these ops is identical to the code we were emitting in
81 the corresponding PutById stub.
82
83 * dfg/DFGAbstractState.cpp:
84 (JSC::DFG::AbstractState::execute):
85 * dfg/DFGByteCodeParser.cpp:
86 (JSC::DFG::ByteCodeParser::parseBlock):
87 * dfg/DFGCSEPhase.cpp:
88 (JSC::DFG::CSEPhase::putStructureStoreElimination):
89 (JSC::DFG::CSEPhase::getPropertyStorageLoadElimination):
90 * dfg/DFGNode.h:
91 (JSC::DFG::Node::hasStructureTransitionData):
92 * dfg/DFGNodeType.h:
93 (DFG):
94 * dfg/DFGOperations.cpp:
95 * dfg/DFGOperations.h:
96 * dfg/DFGPredictionPropagationPhase.cpp:
97 (JSC::DFG::PredictionPropagationPhase::propagate):
98 * dfg/DFGSpeculativeJIT.cpp:
99 (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage):
100 (DFG):
101 (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):
102 * dfg/DFGSpeculativeJIT.h:
103 (JSC::DFG::SpeculativeJIT::callOperation):
104 (SpeculativeJIT):
105 * dfg/DFGSpeculativeJIT32_64.cpp:
106 (JSC::DFG::SpeculativeJIT::compile):
107 * dfg/DFGSpeculativeJIT64.cpp:
108 (JSC::DFG::SpeculativeJIT::compile):
109 * runtime/Structure.cpp:
110 (JSC::nextOutOfLineStorageCapacity):
111 * runtime/Structure.h:
112 (JSC):
113
oliver@apple.coma08210b2012-07-18 23:26:06 +00001142012-07-16 Oliver Hunt <oliver@apple.com>
115
116 dumpCallFrame is broken in ToT
117 https://bugs.webkit.org/show_bug.cgi?id=91444
118
119 Reviewed by Gavin Barraclough.
120
121 Various changes have been made to the SF calling convention, but
122 dumpCallFrame has not been updated to reflect these changes.
123 That resulted in both bogus information, as well as numerous
124 assertions of sadness.
125
126 This patch makes dumpCallFrame actually work again and adds the
127 wonderful feature of telling you the name of the variable that a
128 register reflects, or what value it contains.
129
130 * bytecode/CodeBlock.cpp:
131 (JSC::CodeBlock::nameForRegister):
132 A really innefficient mechanism for finding the name of a local register.
133 This should only ever be used by debug code so this should be okay.
134 * bytecode/CodeBlock.h:
135 (CodeBlock):
136 * bytecompiler/BytecodeGenerator.cpp:
137 (JSC::BytecodeGenerator::generate):
138 Debug builds no longer throw away a functions symbol table, this allows
139 us to actually perform a register# to name mapping
140 * dfg/DFGJITCompiler.cpp:
141 (JSC::DFG::JITCompiler::link):
142 We weren't propogating the bytecode offset here leading to assertions
143 in debug builds when dumping bytecode of DFG compiled code.
144 * interpreter/Interpreter.cpp:
145 (JSC):
146 (JSC::Interpreter::dumpRegisters):
147 Rework to actually be correct.
148 (JSC::getCallerInfo):
149 Return the byteocde offset as well now, given we have to determine it
150 anyway.
151 (JSC::Interpreter::getStackTrace):
152 (JSC::Interpreter::retrieveCallerFromVMCode):
153 * interpreter/Interpreter.h:
154 (Interpreter):
155 * jsc.cpp:
156 (GlobalObject::finishCreation):
157 (functionDumpCallFrame):
158 Give debug builds of JSC a method for calling dumpCallFrame so we can
159 inspect a callframe without requiring us to break in a debugger.
160
fpizlo@apple.comc6429b82012-07-18 22:17:18 +00001612012-07-18 Filip Pizlo <fpizlo@apple.com>
162
163 DFG 32-bit PutById transition stub storage reallocation case copies the first pointer of each JSValue instead of the whole JSValue
164 https://bugs.webkit.org/show_bug.cgi?id=91599
165
166 Reviewed by Geoffrey Garen.
167
168 * dfg/DFGRepatch.cpp:
169 (JSC::DFG::emitPutTransitionStub):
170
fpizlo@apple.com07669e22012-07-17 23:11:23 +00001712012-07-17 Filip Pizlo <fpizlo@apple.com>
172
fpizlo@apple.com41c6f1e2012-07-18 04:42:55 +0000173 DFG 32-bit PutById transition stub passes the payload/tag arguments to a DFG operation in the wrong order
174 https://bugs.webkit.org/show_bug.cgi?id=91576
175
176 Reviewed by Gavin Barraclough.
177
178 * dfg/DFGRepatch.cpp:
179 (JSC::DFG::emitPutTransitionStub):
180
1812012-07-17 Filip Pizlo <fpizlo@apple.com>
182
fpizlo@apple.com07669e22012-07-17 23:11:23 +0000183 [Qt] REGRESSION(r122768, r122771): They broke jquery/data.html and inspector/elements/edit-dom-actions.html
184 https://bugs.webkit.org/show_bug.cgi?id=91476
185
186 Reviewed by Mark Hahnenberg.
187
188 The 32-bit repatching code was not correctly adapted to the new world where there may not always
189 be an available scratch register. Fixed it by ensuring that the scratch register we select does
190 not overlap with the value tag.
191
192 * dfg/DFGRepatch.cpp:
193 (JSC::DFG::generateProtoChainAccessStub):
194 (JSC::DFG::tryCacheGetByID):
195 (JSC::DFG::tryBuildGetByIDList):
196 (JSC::DFG::emitPutReplaceStub):
197
rgabor@webkit.org600a0c12012-07-17 07:59:57 +00001982012-07-17 Gabor Rapcsanyi <rgabor@webkit.org>
199
200 Unreviewed buildfix from Zoltan Herczeg after 122768.
201
202 * dfg/DFGCCallHelpers.h:
203 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
204 (CCallHelpers):
205
commit-queue@webkit.org7bf73302012-07-17 07:11:52 +00002062012-07-17 David Barr <davidbarr@chromium.org>
207
208 Introduce ENABLE_CSS_IMAGE_ORIENTATION compile flag
209 https://bugs.webkit.org/show_bug.cgi?id=89055
210
211 Reviewed by Kent Tamura.
212
213 The css3-images module is at candidate recommendation.
214 http://www.w3.org/TR/2012/CR-css3-images-20120417/#the-image-orientation
215
216 Add a configuration option for CSS image-orientation support, disabling it by default.
217
218 * Configurations/FeatureDefines.xcconfig:
219
fpizlo@apple.com68bef1d2012-07-17 01:43:56 +00002202012-07-16 Filip Pizlo <fpizlo@apple.com>
221
222 Unreviewed, roll out 122790 because it broke the Windows build. I'm not
223 sure what to do with exported symbols that are predicated on NDEBUG.
224
225 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
226 * bytecode/CodeBlock.cpp:
227 (JSC):
228 * bytecode/CodeBlock.h:
229 (CodeBlock):
230 * bytecompiler/BytecodeGenerator.cpp:
231 (JSC::BytecodeGenerator::generate):
232 * dfg/DFGJITCompiler.cpp:
233 (JSC::DFG::JITCompiler::link):
234 * interpreter/Interpreter.cpp:
235 (JSC):
236 (JSC::Interpreter::dumpRegisters):
237 (JSC::getCallerInfo):
238 (JSC::Interpreter::getStackTrace):
239 (JSC::Interpreter::retrieveCallerFromVMCode):
240 * interpreter/Interpreter.h:
241 (Interpreter):
242 * jsc.cpp:
243 (GlobalObject::finishCreation):
244
oliver@apple.com0acb42b2012-07-17 01:14:18 +00002452012-07-16 Oliver Hunt <oliver@apple.com>
246
247 dumpCallFrame is broken in ToT
248 https://bugs.webkit.org/show_bug.cgi?id=91444
249
250 Reviewed by Gavin Barraclough.
251
252 Various changes have been made to the SF calling convention, but
253 dumpCallFrame has not been updated to reflect these changes.
254 That resulted in both bogus information, as well as numerous
255 assertions of sadness.
256
257 This patch makes dumpCallFrame actually work again and adds the
258 wonderful feature of telling you the name of the variable that a
259 register reflects, or what value it contains.
260
261 * bytecode/CodeBlock.cpp:
262 (JSC::CodeBlock::nameForRegister):
263 A really innefficient mechanism for finding the name of a local register.
264 This should only ever be used by debug code so this should be okay.
265 * bytecode/CodeBlock.h:
266 (CodeBlock):
267 * bytecompiler/BytecodeGenerator.cpp:
268 (JSC::BytecodeGenerator::generate):
269 Debug builds no longer throw away a functions symbol table, this allows
270 us to actually perform a register# to name mapping
271 * dfg/DFGJITCompiler.cpp:
272 (JSC::DFG::JITCompiler::link):
273 We weren't propogating the bytecode offset here leading to assertions
274 in debug builds when dumping bytecode of DFG compiled code.
275 * interpreter/Interpreter.cpp:
276 (JSC):
277 (JSC::Interpreter::dumpRegisters):
278 Rework to actually be correct.
279 (JSC::getCallerInfo):
280 Return the byteocde offset as well now, given we have to determine it
281 anyway.
282 (JSC::Interpreter::getStackTrace):
283 (JSC::Interpreter::retrieveCallerFromVMCode):
284 * interpreter/Interpreter.h:
285 (Interpreter):
286 * jsc.cpp:
287 (GlobalObject::finishCreation):
288 (functionDumpCallFrame):
289 Give debug builds of JSC a method for calling dumpCallFrame so we can
290 inspect a callframe without requiring us to break in a debugger.
291
fpizlo@apple.comcd8b6662012-07-16 22:17:29 +00002922012-07-16 Filip Pizlo <fpizlo@apple.com>
293
294 Unreviewed, adding forgotten files.
295
296 * dfg/DFGRegisterSet.h: Added.
297 (DFG):
298 (RegisterSet):
299 (JSC::DFG::RegisterSet::RegisterSet):
300 (JSC::DFG::RegisterSet::asPOD):
301 (JSC::DFG::RegisterSet::copyInfo):
302 (JSC::DFG::RegisterSet::set):
303 (JSC::DFG::RegisterSet::setGPRByIndex):
304 (JSC::DFG::RegisterSet::clear):
305 (JSC::DFG::RegisterSet::get):
306 (JSC::DFG::RegisterSet::getGPRByIndex):
307 (JSC::DFG::RegisterSet::getFreeGPR):
308 (JSC::DFG::RegisterSet::setFPRByIndex):
309 (JSC::DFG::RegisterSet::getFPRByIndex):
310 (JSC::DFG::RegisterSet::setByIndex):
311 (JSC::DFG::RegisterSet::getByIndex):
312 (JSC::DFG::RegisterSet::numberOfSetGPRs):
313 (JSC::DFG::RegisterSet::numberOfSetFPRs):
314 (JSC::DFG::RegisterSet::numberOfSetRegisters):
315 (JSC::DFG::RegisterSet::setBit):
316 (JSC::DFG::RegisterSet::clearBit):
317 (JSC::DFG::RegisterSet::getBit):
318 * dfg/DFGScratchRegisterAllocator.h: Added.
319 (DFG):
320 (ScratchRegisterAllocator):
321 (JSC::DFG::ScratchRegisterAllocator::ScratchRegisterAllocator):
322 (JSC::DFG::ScratchRegisterAllocator::lock):
323 (JSC::DFG::ScratchRegisterAllocator::allocateScratch):
324 (JSC::DFG::ScratchRegisterAllocator::allocateScratchGPR):
325 (JSC::DFG::ScratchRegisterAllocator::allocateScratchFPR):
326 (JSC::DFG::ScratchRegisterAllocator::didReuseRegisters):
327 (JSC::DFG::ScratchRegisterAllocator::preserveReusedRegistersByPushing):
328 (JSC::DFG::ScratchRegisterAllocator::restoreReusedRegistersByPopping):
329 (JSC::DFG::ScratchRegisterAllocator::desiredScratchBufferSize):
330 (JSC::DFG::ScratchRegisterAllocator::preserveUsedRegistersToScratchBuffer):
331 (JSC::DFG::ScratchRegisterAllocator::restoreUsedRegistersFromScratchBuffer):
332
fpizlo@apple.com2f2052a2012-07-16 22:08:21 +00003332012-07-15 Filip Pizlo <fpizlo@apple.com>
334
335 DFG PutById transition should handle storage allocation, and inline it
336 https://bugs.webkit.org/show_bug.cgi?id=91337
337
338 Reviewed by Oliver Hunt.
339
340 This enables the patching of DFG PutById to handle the out-of-line storage
341 allocation case. Furthermore, it inlines out-of-line storage allocation (and
342 reallocation) into the generated stubs.
343
344 To do this, this patch adds the ability to store the relevant register
345 allocation state (i.e. the set of in-use registers) in the structure stub
346 info so that the stub generation code can more flexibly select scratch
347 registers: sometimes it needs none, sometimes one - or sometimes up to
348 three. Moreover, to make the stub generation register allocation simple and
349 maintainable, this patch introduces a reusable scratch register allocator
350 class. This register allocator understands that some registers are in use by
351 the main path code and so must be spilled as necessary, other registers are
352 locked for use in the stub itself and so cannot even be spilled, while still
353 others may be allocated for scratch purposes. A scratch register that is
354 used must be spilled. If a register is locked, it cannot be used as a
355 scratch register. If a register is used, it can be used as a scratch
356 register so long as it is spilled.
357
358 This is a sub-1% speed-up on V8 and neutral elsewhere.
359
360 * GNUmakefile.list.am:
361 * JavaScriptCore.xcodeproj/project.pbxproj:
362 * assembler/MacroAssemblerCodeRef.h:
363 (FunctionPtr):
364 (JSC::FunctionPtr::FunctionPtr):
365 * bytecode/StructureStubInfo.h:
366 * dfg/DFGCCallHelpers.h:
367 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
368 (CCallHelpers):
369 * dfg/DFGGPRInfo.h:
370 * dfg/DFGJITCompiler.cpp:
371 (JSC::DFG::JITCompiler::link):
372 * dfg/DFGJITCompiler.h:
373 (JSC::DFG::PropertyAccessRecord::PropertyAccessRecord):
374 (PropertyAccessRecord):
375 * dfg/DFGOperations.cpp:
376 * dfg/DFGOperations.h:
377 * dfg/DFGRegisterBank.h:
378 (JSC::DFG::RegisterBank::isInUse):
379 (RegisterBank):
380 * dfg/DFGRegisterSet.h: Added.
381 (DFG):
382 (RegisterSet):
383 (JSC::DFG::RegisterSet::RegisterSet):
384 (JSC::DFG::RegisterSet::asPOD):
385 (JSC::DFG::RegisterSet::copyInfo):
386 (JSC::DFG::RegisterSet::set):
387 (JSC::DFG::RegisterSet::setGPRByIndex):
388 (JSC::DFG::RegisterSet::clear):
389 (JSC::DFG::RegisterSet::get):
390 (JSC::DFG::RegisterSet::getGPRByIndex):
391 (JSC::DFG::RegisterSet::getFreeGPR):
392 (JSC::DFG::RegisterSet::setFPRByIndex):
393 (JSC::DFG::RegisterSet::getFPRByIndex):
394 (JSC::DFG::RegisterSet::setByIndex):
395 (JSC::DFG::RegisterSet::getByIndex):
396 (JSC::DFG::RegisterSet::numberOfSetGPRs):
397 (JSC::DFG::RegisterSet::numberOfSetFPRs):
398 (JSC::DFG::RegisterSet::numberOfSetRegisters):
399 (JSC::DFG::RegisterSet::setBit):
400 (JSC::DFG::RegisterSet::clearBit):
401 (JSC::DFG::RegisterSet::getBit):
402 * dfg/DFGRepatch.cpp:
403 (JSC::DFG::generateProtoChainAccessStub):
404 (JSC::DFG::tryCacheGetByID):
405 (JSC::DFG::tryBuildGetByIDList):
406 (JSC::DFG::emitPutReplaceStub):
407 (JSC::DFG::emitPutTransitionStub):
408 (JSC::DFG::tryCachePutByID):
409 (JSC::DFG::tryBuildPutByIdList):
410 * dfg/DFGScratchRegisterAllocator.h: Added.
411 (DFG):
412 (ScratchRegisterAllocator):
413 (JSC::DFG::ScratchRegisterAllocator::ScratchRegisterAllocator):
414 (JSC::DFG::ScratchRegisterAllocator::lock):
415 (JSC::DFG::ScratchRegisterAllocator::allocateScratch):
416 (JSC::DFG::ScratchRegisterAllocator::allocateScratchGPR):
417 (JSC::DFG::ScratchRegisterAllocator::allocateScratchFPR):
418 (JSC::DFG::ScratchRegisterAllocator::didReuseRegisters):
419 (JSC::DFG::ScratchRegisterAllocator::preserveReusedRegistersByPushing):
420 (JSC::DFG::ScratchRegisterAllocator::restoreReusedRegistersByPopping):
421 (JSC::DFG::ScratchRegisterAllocator::desiredScratchBufferSize):
422 (JSC::DFG::ScratchRegisterAllocator::preserveUsedRegistersToScratchBuffer):
423 (JSC::DFG::ScratchRegisterAllocator::restoreUsedRegistersFromScratchBuffer):
424 * dfg/DFGSpeculativeJIT.h:
425 (SpeculativeJIT):
426 (JSC::DFG::SpeculativeJIT::usedRegisters):
427 * dfg/DFGSpeculativeJIT32_64.cpp:
428 (JSC::DFG::SpeculativeJIT::cachedGetById):
429 (JSC::DFG::SpeculativeJIT::cachedPutById):
430 (JSC::DFG::SpeculativeJIT::compile):
431 * dfg/DFGSpeculativeJIT64.cpp:
432 (JSC::DFG::SpeculativeJIT::cachedGetById):
433 (JSC::DFG::SpeculativeJIT::cachedPutById):
434 (JSC::DFG::SpeculativeJIT::compile):
435 * heap/CopiedAllocator.h:
436 (CopiedAllocator):
437 (JSC::CopiedAllocator::fastPathShouldSucceed):
438 (JSC):
439
paroga@webkit.org24c86b82012-07-16 20:06:15 +00004402012-07-16 Patrick Gansterer <paroga@webkit.org>
441
442 Add dfg switch to create_jit_stubs script
443 https://bugs.webkit.org/show_bug.cgi?id=91256
444
445 Reviewed by Geoffrey Garen.
446
447 * create_jit_stubs: Add a switch to enable or disable the generation of
448 stub functions in #if ENABLE(DFG_JIT) conditions.
449
rgabor@webkit.org58c69f82012-07-16 15:05:57 +00004502012-07-16 Gabor Rapcsanyi <rgabor@webkit.org>
451
rgabor@webkit.org43ad3e52012-07-16 16:16:03 +0000452 Unreviewed buildfix after r122729. Typo fix.
453
454 * assembler/MacroAssemblerARM.h:
455 (JSC::MacroAssemblerARM::add32):
456
4572012-07-16 Gabor Rapcsanyi <rgabor@webkit.org>
458
rgabor@webkit.org58c69f82012-07-16 15:05:57 +0000459 Unreviewed buildfix from Zoltan Herczeg after r122677.
460 Implement missing add32 function to MacroAssemblerARM.
461
462 * assembler/MacroAssemblerARM.h:
463 (JSC::MacroAssemblerARM::add32):
464 (MacroAssemblerARM):
465
fpizlo@apple.com327f2372012-07-15 04:02:16 +00004662012-07-14 Filip Pizlo <fpizlo@apple.com>
467
fpizlo@apple.coma4eaa8a2012-07-15 05:23:58 +0000468 DFG PutByVal opcodes should accept more than 3 operands
469 https://bugs.webkit.org/show_bug.cgi?id=91332
470
471 Reviewed by Oliver Hunt.
472
473 Turned PutByVal/PutByValAlias into var-arg nodes, so that we can give them
474 4 or more operands in the future.
475
476 * dfg/DFGAbstractState.cpp:
477 (JSC::DFG::AbstractState::execute):
478 * dfg/DFGByteCodeParser.cpp:
479 (JSC::DFG::ByteCodeParser::parseBlock):
480 * dfg/DFGCSEPhase.cpp:
481 (JSC::DFG::CSEPhase::getByValLoadElimination):
482 (JSC::DFG::CSEPhase::getIndexedPropertyStorageLoadElimination):
483 (JSC::DFG::CSEPhase::performNodeCSE):
484 * dfg/DFGFixupPhase.cpp:
485 (JSC::DFG::FixupPhase::fixupNode):
486 (JSC::DFG::FixupPhase::fixDoubleEdge):
487 * dfg/DFGGraph.h:
488 (JSC::DFG::Graph::byValIsPure):
489 (JSC::DFG::Graph::varArgNumChildren):
490 (Graph):
491 (JSC::DFG::Graph::numChildren):
492 (JSC::DFG::Graph::varArgChild):
493 (JSC::DFG::Graph::child):
494 * dfg/DFGNodeType.h:
495 (DFG):
496 * dfg/DFGPredictionPropagationPhase.cpp:
497 (JSC::DFG::PredictionPropagationPhase::propagate):
498 * dfg/DFGSpeculativeJIT.cpp:
499 (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
500 (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
501 * dfg/DFGSpeculativeJIT32_64.cpp:
502 (JSC::DFG::SpeculativeJIT::compile):
503 * dfg/DFGSpeculativeJIT64.cpp:
504 (JSC::DFG::SpeculativeJIT::compile):
505
5062012-07-14 Filip Pizlo <fpizlo@apple.com>
507
fpizlo@apple.com327f2372012-07-15 04:02:16 +0000508 Rationalize and optimize storage allocation
509 https://bugs.webkit.org/show_bug.cgi?id=91303
510
511 Reviewed by Oliver Hunt.
512
513 This implements a backwards bump allocator for copied space storage
514 allocation, shown in pseudo-code below:
515
516 pointer bump(size) {
517 pointer tmp = allocator->remaining;
518 tmp -= size;
519 if (tmp < 0)
520 fail;
521 allocator->remaining = tmp;
522 return allocator->payloadEnd - tmp - size;
523 }
524
525 The advantage of this allocator is that it:
526
527 - Only requires one comparison in the common case where size is known to
528 not be huge, and this comparison can be done by checking the sign bit
529 of the subtraction.
530
531 - Can be implemented even when only one register is available. This
532 register is reused for both temporary storage during allocation and
533 for the result.
534
535 - Preserves the behavior that memory in a block is filled in from lowest
536 address to highest address, which allows for a cheap reallocation fast
537 path.
538
539 - Is resilient against the block used for allocation being the last one
540 in virtual memory, thereby otherwise leading to the risk of overflow
541 in the bump pointer, despite only doing one branch.
542
543 In order to implement this allocator using the smallest possible chunk
544 of code, I refactored the copied space code so that all of the allocation
545 logic is in CopiedAllocator, and all of the state is in either
546 CopiedBlock or CopiedAllocator. This should make changing the allocation
547 fast path easier in the future.
548
549 In order to do this, I needed to add some new assembler support,
550 particularly for various forms of add(address, register) and negPtr().
551
552 This is performance neutral. The purpose of this change is to facilitate
553 further inlining of storage allocation without having to reserve
554 additional registers or emit too much code.
555
556 * assembler/MacroAssembler.h:
557 (JSC::MacroAssembler::addPtr):
558 (MacroAssembler):
559 (JSC::MacroAssembler::negPtr):
560 * assembler/MacroAssemblerARMv7.h:
561 (MacroAssemblerARMv7):
562 (JSC::MacroAssemblerARMv7::add32):
563 * assembler/MacroAssemblerX86.h:
564 (JSC::MacroAssemblerX86::add32):
565 (MacroAssemblerX86):
566 * assembler/MacroAssemblerX86_64.h:
567 (MacroAssemblerX86_64):
568 (JSC::MacroAssemblerX86_64::addPtr):
569 (JSC::MacroAssemblerX86_64::negPtr):
570 * assembler/X86Assembler.h:
571 (X86Assembler):
572 (JSC::X86Assembler::addl_mr):
573 (JSC::X86Assembler::addq_mr):
574 (JSC::X86Assembler::negq_r):
575 * heap/CopiedAllocator.h:
576 (CopiedAllocator):
577 (JSC::CopiedAllocator::isValid):
578 (JSC::CopiedAllocator::CopiedAllocator):
579 (JSC::CopiedAllocator::tryAllocate):
580 (JSC):
581 (JSC::CopiedAllocator::tryReallocate):
582 (JSC::CopiedAllocator::forceAllocate):
583 (JSC::CopiedAllocator::resetCurrentBlock):
584 (JSC::CopiedAllocator::setCurrentBlock):
585 (JSC::CopiedAllocator::currentCapacity):
586 * heap/CopiedBlock.h:
587 (CopiedBlock):
588 (JSC::CopiedBlock::create):
589 (JSC::CopiedBlock::zeroFillWilderness):
590 (JSC::CopiedBlock::CopiedBlock):
591 (JSC::CopiedBlock::payloadEnd):
592 (JSC):
593 (JSC::CopiedBlock::payloadCapacity):
594 (JSC::CopiedBlock::data):
595 (JSC::CopiedBlock::dataEnd):
596 (JSC::CopiedBlock::dataSize):
597 (JSC::CopiedBlock::wilderness):
598 (JSC::CopiedBlock::wildernessEnd):
599 (JSC::CopiedBlock::wildernessSize):
600 (JSC::CopiedBlock::size):
601 * heap/CopiedSpace.cpp:
602 (JSC::CopiedSpace::tryAllocateSlowCase):
603 (JSC::CopiedSpace::tryAllocateOversize):
604 (JSC::CopiedSpace::tryReallocate):
605 (JSC::CopiedSpace::doneFillingBlock):
606 (JSC::CopiedSpace::doneCopying):
607 * heap/CopiedSpace.h:
608 (CopiedSpace):
609 * heap/CopiedSpaceInlineMethods.h:
610 (JSC::CopiedSpace::startedCopying):
611 (JSC::CopiedSpace::allocateBlockForCopyingPhase):
612 (JSC::CopiedSpace::allocateBlock):
613 (JSC::CopiedSpace::tryAllocate):
614 (JSC):
615 * heap/MarkStack.cpp:
616 (JSC::SlotVisitor::startCopying):
617 (JSC::SlotVisitor::allocateNewSpace):
618 (JSC::SlotVisitor::doneCopying):
619 * heap/SlotVisitor.h:
620 (JSC::SlotVisitor::SlotVisitor):
621 * jit/JIT.h:
622 * jit/JITInlineMethods.h:
623 (JSC::JIT::emitAllocateBasicStorage):
624 (JSC::JIT::emitAllocateJSArray):
625
commit-queue@webkit.org782c20b2012-07-14 00:44:47 +00006262012-07-13 Mark Lam <mark.lam@apple.com>
627
628 OfflineASM Pretty printing and commenting enhancements.
629 https://bugs.webkit.org/show_bug.cgi?id=91281
630
631 Reviewed by Filip Pizlo.
632
633 Added some minor pretty printing in the OfflineASM.
634 Also added infrastruture for adding multiple types of comments and
635 annotations with the ability to enable/disable them in the generated
636 output as desired.
637
638 * GNUmakefile.list.am: add new file config.rb.
639 * llint/LLIntOfflineAsmConfig.h:
640 Added OFFLINE_ASM_BEGIN, OFFLINE_ASM_END, and OFFLINE_ASM_LOCAL_LABEL macros.
641 This will allow us to redefine these for other backends later.
642 * llint/LowLevelInterpreter32_64.asm:
643 Add a small example of instruction annotations for now.
644 * llint/LowLevelInterpreter64.asm:
645 Add a small example of instruction annotations for now.
646 * offlineasm/armv7.rb: Added handling of annotations.
647 * offlineasm/asm.rb:
648 Added machinery to dump the new comments and annotations.
649 Also added some indentations to make the output a little prettier.
650 * offlineasm/ast.rb: Added annotation field in class Instruction.
651 * offlineasm/backends.rb:
652 * offlineasm/config.rb: Added.
653 Currently only contains commenting options. This file is meant to be
654 a centralized place for build config values much like config.h for
655 JavaScriptCore.
656 * offlineasm/generate_offset_extractor.rb:
657 * offlineasm/instructions.rb:
658 * offlineasm/offsets.rb:
659 * offlineasm/opt.rb:
660 * offlineasm/parser.rb: Parse and record annotations.
661 * offlineasm/registers.rb:
662 * offlineasm/self_hash.rb:
663 * offlineasm/settings.rb:
664 * offlineasm/transform.rb:
665 * offlineasm/x86.rb: Added handling of annotations.
666
fpizlo@apple.com8ff7c5e72012-07-13 23:55:18 +00006672012-07-13 Filip Pizlo <fpizlo@apple.com>
668
669 ASSERTION FAILED: use.useKind() != DoubleUse
670 https://bugs.webkit.org/show_bug.cgi?id=91082
671
672 Reviewed by Geoffrey Garen.
673
674 The implementation of Branch() was unwisely relying on register allocation state
675 to decide what speculations to perform. That's never correct.
676
677 * dfg/DFGSpeculativeJIT32_64.cpp:
678 (JSC::DFG::SpeculativeJIT::compile):
679 * dfg/DFGSpeculativeJIT64.cpp:
680 (JSC::DFG::SpeculativeJIT::compile):
681
commit-queue@webkit.org2e002d12012-07-13 23:36:34 +00006822012-07-13 Sheriff Bot <webkit.review.bot@gmail.com>
683
684 Unreviewed, rolling out r122640.
685 http://trac.webkit.org/changeset/122640
686 https://bugs.webkit.org/show_bug.cgi?id=91298
687
688 LLInt apparently does not expect to mark these (Requested by
689 olliej on #webkit).
690
691 * bytecode/CodeBlock.cpp:
692 (JSC::CodeBlock::visitStructures):
693 (JSC::CodeBlock::stronglyVisitStrongReferences):
694
oliver@apple.comca095d52012-07-13 23:12:14 +00006952012-07-13 Oliver Hunt <oliver@apple.com>
696
697 LLInt fails to mark structures stored in the bytecode
698 https://bugs.webkit.org/show_bug.cgi?id=91296
699
700 Reviewed by Geoffrey Garen.
701
702 LLInt stores structures in the bytecode, so we need to visit the appropriate
703 instructions as we would if we were running in the classic interpreter.
704 This requires adding additional checks for the LLInt specific opcodes, and
705 the lint specific variants of operand ordering.
706
707 * bytecode/CodeBlock.cpp:
708 (JSC::CodeBlock::visitStructures):
709 (JSC::CodeBlock::stronglyVisitStrongReferences):
710
commit-queue@webkit.orgf9b0ef22012-07-13 20:12:36 +00007112012-07-13 Yong Li <yoli@rim.com>
712
713 [BlackBerry] Implement GCActivityCallback with platform timer
714 https://bugs.webkit.org/show_bug.cgi?id=90175
715
716 Reviewed by Rob Buis.
717
718 Implement GCActivityCallback and HeapTimer for BlackBerry port.
719
720 * heap/HeapTimer.cpp:
721 (JSC):
722 (JSC::HeapTimer::HeapTimer):
723 (JSC::HeapTimer::~HeapTimer):
724 (JSC::HeapTimer::timerDidFire):
725 (JSC::HeapTimer::synchronize):
726 (JSC::HeapTimer::invalidate):
727 (JSC::HeapTimer::didStartVMShutdown):
728 * heap/HeapTimer.h:
729 (HeapTimer):
730 * runtime/GCActivityCallbackBlackBerry.cpp:
731 (JSC):
732 (JSC::DefaultGCActivityCallback::doWork):
733 (JSC::DefaultGCActivityCallback::didAllocate):
734 (JSC::DefaultGCActivityCallback::willCollect):
735 (JSC::DefaultGCActivityCallback::cancel):
736
paroga@webkit.orgcc7dc5b2012-07-13 16:35:46 +00007372012-07-13 Patrick Gansterer <paroga@webkit.org>
738
paroga@webkit.org4a3ecbd2012-07-13 16:53:20 +0000739 [WIN] Fix compilation of DFGRepatch.cpp
740 https://bugs.webkit.org/show_bug.cgi?id=91241
741
742 Reviewed by Geoffrey Garen.
743
744 Use intptr_t instead of uintptr_t when calling CodeLocationCommon::dataLabelPtrAtOffset(int)
745 to fix MSVC "unary minus operator applied to unsigned type, result still unsigned" warning.
746
747 * dfg/DFGRepatch.cpp:
748 (JSC::DFG::dfgResetGetByID):
749 (JSC::DFG::dfgResetPutByID):
750
7512012-07-13 Patrick Gansterer <paroga@webkit.org>
752
paroga@webkit.orgcc7dc5b2012-07-13 16:35:46 +0000753 Fix ARM_TRADITIONAL JIT for COMPILER(MSVC) and COMPILER(RVCT) after r121885
754 https://bugs.webkit.org/show_bug.cgi?id=91238
755
756 Reviewed by Zoltan Herczeg.
757
758 r121885 changed the assembler instruction only for COMPILER(GCC).
759 Use the same instructions for the other compilers too.
760
761 * jit/JITStubs.cpp:
762 (JSC::ctiTrampoline):
763 (JSC::ctiTrampolineEnd):
764 (JSC::ctiVMThrowTrampoline):
765
fpizlo@apple.comedcb7a92012-07-13 05:31:05 +00007662012-07-12 Filip Pizlo <fpizlo@apple.com>
767
fpizlo@apple.comcf716122012-07-13 06:41:18 +0000768 DFG property access stubs should use structure transition watchpoints
769 https://bugs.webkit.org/show_bug.cgi?id=91135
770
771 Reviewed by Geoffrey Garen.
772
773 This adds a Watchpoint subclass that will clear a structure stub (i.e.
774 a property access stub) when fired. The DFG stub generation code now
775 uses this optimization.
776
777 * CMakeLists.txt:
778 * GNUmakefile.list.am:
779 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
780 * JavaScriptCore.xcodeproj/project.pbxproj:
781 * Target.pri:
782 * bytecode/CodeBlock.cpp:
783 (JSC):
784 (JSC::CodeBlock::finalizeUnconditionally):
785 (JSC::CodeBlock::resetStub):
786 (JSC::CodeBlock::resetStubInternal):
787 * bytecode/CodeBlock.h:
788 (JSC):
789 (CodeBlock):
790 * bytecode/StructureStubClearingWatchpoint.cpp: Added.
791 (JSC):
792 (JSC::StructureStubClearingWatchpoint::~StructureStubClearingWatchpoint):
793 (JSC::StructureStubClearingWatchpoint::push):
794 (JSC::StructureStubClearingWatchpoint::fireInternal):
795 (JSC::WatchpointsOnStructureStubInfo::~WatchpointsOnStructureStubInfo):
796 (JSC::WatchpointsOnStructureStubInfo::addWatchpoint):
797 (JSC::WatchpointsOnStructureStubInfo::ensureReferenceAndAddWatchpoint):
798 * bytecode/StructureStubClearingWatchpoint.h: Added.
799 (JSC):
800 (StructureStubClearingWatchpoint):
801 (JSC::StructureStubClearingWatchpoint::StructureStubClearingWatchpoint):
802 (WatchpointsOnStructureStubInfo):
803 (JSC::WatchpointsOnStructureStubInfo::WatchpointsOnStructureStubInfo):
804 (JSC::WatchpointsOnStructureStubInfo::codeBlock):
805 (JSC::WatchpointsOnStructureStubInfo::stubInfo):
806 * bytecode/StructureStubInfo.h:
807 (JSC::StructureStubInfo::reset):
808 (JSC::StructureStubInfo::addWatchpoint):
809 (StructureStubInfo):
810 * dfg/DFGRepatch.cpp:
811 (JSC::DFG::addStructureTransitionCheck):
812 (DFG):
813 (JSC::DFG::generateProtoChainAccessStub):
814 (JSC::DFG::emitPutTransitionStub):
815 * jit/JumpReplacementWatchpoint.h:
816
8172012-07-12 Filip Pizlo <fpizlo@apple.com>
818
fpizlo@apple.comedcb7a92012-07-13 05:31:05 +0000819 DFG CFA may get overzealous in loops that have code that must exit
820 https://bugs.webkit.org/show_bug.cgi?id=91188
821
822 Reviewed by Gavin Barraclough.
823
824 Ensure that if the CFA assumes that an operation must exit, then it will always exit
825 no matter what happens after. That's necessary to preserve soundness.
826
827 Remove a broken fixup done by the DFG simplifier, where it was trying to say that the
828 variable-at-head was the first access in the second block in the merge, if the first
829 block did not read the variable. That's totally wrong, if the first block was in fact
830 doing a phantom read. I removed that fixup and instead hardened the rest of the
831 compiler.
832
833 * dfg/DFGAbstractState.cpp:
834 (JSC::DFG::AbstractState::endBasicBlock):
835 * dfg/DFGBasicBlock.h:
836 (JSC::DFG::BasicBlock::BasicBlock):
837 (BasicBlock):
838 * dfg/DFGCFAPhase.cpp:
839 (JSC::DFG::CFAPhase::performBlockCFA):
840 * dfg/DFGCFGSimplificationPhase.cpp:
841 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
842 * dfg/DFGConstantFoldingPhase.cpp:
843 (JSC::DFG::ConstantFoldingPhase::ConstantFoldingPhase):
844 (JSC::DFG::ConstantFoldingPhase::run):
845 (ConstantFoldingPhase):
846 (JSC::DFG::ConstantFoldingPhase::foldConstants):
847 (JSC::DFG::ConstantFoldingPhase::paintUnreachableCode):
848 * dfg/DFGVariableEventStream.cpp:
849 (JSC::DFG::VariableEventStream::reconstruct):
850
allan.jensen@nokia.comb619bbf22012-07-12 15:34:35 +00008512012-07-12 Allan Sandfeld Jensen <allan.jensen@nokia.com>
852
853 [Qt] Implement MemoryUsageSupport
854 https://bugs.webkit.org/show_bug.cgi?id=91094
855
856 Reviewed by Adam Barth.
857
858 Compile in MemoryStatistics so we can make use of the interface.
859
860 * Target.pri:
861
ossy@webkit.org8db5d862012-07-12 07:53:08 +00008622012-07-12 Csaba Osztrogonác <ossy@webkit.org>
863
864 Remove dead code after r122392.
865 https://bugs.webkit.org/show_bug.cgi?id=91049
866
867 Reviewed by Filip Pizlo.
868
869 * dfg/DFGSpeculativeJIT64.cpp:
870 (JSC::DFG::SpeculativeJIT::emitCall):
871
commit-queue@webkit.org55a950b2012-07-12 02:49:24 +00008722012-07-11 Adenilson Cavalcanti <cavalcantii@gmail.com>
873
874 Build fix + remove dead code
875 https://bugs.webkit.org/show_bug.cgi?id=91039
876
877 Reviewed by Filip Pizlo.
878
879 An unused variable was breaking compilation (thanks to warnings being treated as errors).
880
881 * dfg/DFGSpeculativeJIT32_64.cpp:
882 (JSC::DFG::SpeculativeJIT::emitCall):
883
mrowe@apple.comc8887bf2012-07-12 02:01:25 +00008842012-07-11 Mark Rowe <mrowe@apple.com>
885
886 <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions.
887
888 Reviewed by Dan Bernstein.
889
890 The deployment target is already set to the version that we're targeting, and it's that setting
891 which determines which functionality from the SDK is available to us.
892
893 * Configurations/Base.xcconfig:
894
fpizlo@apple.com3d949152012-07-11 23:12:35 +00008952012-07-11 Filip Pizlo <fpizlo@apple.com>
896
fpizlo@apple.com5e135772012-07-12 00:12:03 +0000897 DFG should have fast virtual calls
898 https://bugs.webkit.org/show_bug.cgi?id=90924
899
900 Reviewed by Gavin Barraclough.
901
902 Implements virtual call support in the style of the old JIT, with the
903 caveat that we still use the same slow path for both InternalFunction
904 calls and JSFunction calls. Also rationalized the way that our
905 CodeOrigin indices tie into exception checks (previously it was a
906 strange one-to-one mapping with fairly limited assertions; now it's a
907 one-to-many mapping for CodeOrigins to exception checks, respectively).
908 I also took the opportunity to clean up
909 CallLinkInfo::callReturnLocation, which previously was either a Call or
910 a NearCall. Now it's just a NearCall. As well, exceptions during slow
911 path call resolution are now handled by returning an exception throwing
912 thunk rather than returning null. And finally, I made a few things
913 public that were previously private-with-lots-of-friends, because I
914 truly despise the thought of listing each thunk generating function as
915 a friend of JSValue and friends.
916
917 * bytecode/CallLinkInfo.cpp:
918 (JSC::CallLinkInfo::unlink):
919 * bytecode/CallLinkInfo.h:
920 (CallLinkInfo):
921 * bytecode/CodeOrigin.h:
922 (JSC::CodeOrigin::CodeOrigin):
923 (JSC::CodeOrigin::isSet):
924 * dfg/DFGAssemblyHelpers.h:
925 (JSC::DFG::AssemblyHelpers::AssemblyHelpers):
926 * dfg/DFGCCallHelpers.h:
927 (JSC::DFG::CCallHelpers::CCallHelpers):
928 * dfg/DFGGPRInfo.h:
929 (GPRInfo):
930 * dfg/DFGJITCompiler.cpp:
931 (JSC::DFG::JITCompiler::link):
932 (JSC::DFG::JITCompiler::compileFunction):
933 * dfg/DFGJITCompiler.h:
934 (JSC::DFG::CallBeginToken::CallBeginToken):
935 (JSC::DFG::CallBeginToken::~CallBeginToken):
936 (CallBeginToken):
937 (JSC::DFG::CallBeginToken::set):
938 (JSC::DFG::CallBeginToken::registerWithExceptionCheck):
939 (JSC::DFG::CallBeginToken::codeOrigin):
940 (JSC::DFG::CallExceptionRecord::CallExceptionRecord):
941 (CallExceptionRecord):
942 (JSC::DFG::JITCompiler::currentCodeOriginIndex):
943 (JITCompiler):
944 (JSC::DFG::JITCompiler::beginCall):
945 (JSC::DFG::JITCompiler::notifyCall):
946 (JSC::DFG::JITCompiler::prepareForExceptionCheck):
947 (JSC::DFG::JITCompiler::addExceptionCheck):
948 (JSC::DFG::JITCompiler::addFastExceptionCheck):
949 * dfg/DFGOperations.cpp:
950 * dfg/DFGRepatch.cpp:
951 (JSC::DFG::dfgLinkFor):
952 * dfg/DFGSpeculativeJIT.h:
953 (JSC::DFG::SpeculativeJIT::appendCallWithExceptionCheck):
954 * dfg/DFGSpeculativeJIT32_64.cpp:
955 (JSC::DFG::SpeculativeJIT::emitCall):
956 * dfg/DFGSpeculativeJIT64.cpp:
957 (JSC::DFG::SpeculativeJIT::emitCall):
958 * dfg/DFGThunks.cpp:
959 (JSC::DFG::emitPointerValidation):
960 (DFG):
961 (JSC::DFG::throwExceptionFromCallSlowPathGenerator):
962 (JSC::DFG::slowPathFor):
963 (JSC::DFG::linkForThunkGenerator):
964 (JSC::DFG::linkCallThunkGenerator):
965 (JSC::DFG::linkConstructThunkGenerator):
966 (JSC::DFG::virtualForThunkGenerator):
967 (JSC::DFG::virtualCallThunkGenerator):
968 (JSC::DFG::virtualConstructThunkGenerator):
969 * dfg/DFGThunks.h:
970 (DFG):
971 * jit/JIT.cpp:
972 (JSC::JIT::privateCompile):
973 (JSC::JIT::linkFor):
974 * runtime/Executable.h:
975 (ExecutableBase):
976 (JSC::ExecutableBase::offsetOfJITCodeFor):
977 (JSC::ExecutableBase::offsetOfNumParametersFor):
978 * runtime/JSValue.h:
979 (JSValue):
980
9812012-07-11 Filip Pizlo <fpizlo@apple.com>
982
fpizlo@apple.com3a264a12012-07-11 23:33:20 +0000983 Accidentally used the wrong license (3-clause instead of 2-clause) in some
984 files I just committed.
985
986 Rubber stamped by Oliver Hunt.
987
988 * bytecode/Watchpoint.cpp:
989 * bytecode/Watchpoint.h:
990 * jit/JumpReplacementWatchpoint.cpp:
991 * jit/JumpReplacementWatchpoint.h:
992
9932012-07-11 Filip Pizlo <fpizlo@apple.com>
994
fpizlo@apple.com3d949152012-07-11 23:12:35 +0000995 Watchpoints and jump replacement should be decoupled
996 https://bugs.webkit.org/show_bug.cgi?id=91016
997
998 Reviewed by Oliver Hunt.
999
1000 * CMakeLists.txt:
1001 * GNUmakefile.list.am:
1002 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1003 * JavaScriptCore.xcodeproj/project.pbxproj:
1004 * Target.pri:
1005 * assembler/AbstractMacroAssembler.h:
1006 (JSC):
1007 (Label):
1008 * bytecode/CodeBlock.h:
1009 (JSC::CodeBlock::appendWatchpoint):
1010 (JSC::CodeBlock::watchpoint):
1011 (DFGData):
1012 * bytecode/Watchpoint.cpp:
1013 (JSC):
1014 * bytecode/Watchpoint.h:
1015 (JSC::Watchpoint::Watchpoint):
1016 (Watchpoint):
1017 (JSC::Watchpoint::fire):
1018 * dfg/DFGSpeculativeJIT.h:
1019 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
1020 * jit/JumpReplacementWatchpoint.cpp: Added.
1021 (JSC):
1022 (JSC::JumpReplacementWatchpoint::correctLabels):
1023 (JSC::JumpReplacementWatchpoint::fireInternal):
1024 * jit/JumpReplacementWatchpoint.h: Added.
1025 (JSC):
1026 (JumpReplacementWatchpoint):
1027 (JSC::JumpReplacementWatchpoint::JumpReplacementWatchpoint):
1028 (JSC::JumpReplacementWatchpoint::setDestination):
1029
kevino@webkit.org2b81ef22012-07-11 20:23:39 +000010302012-07-11 Kevin Ollivier <kevino@theolliviers.com>
1031
1032 [wx] Unreviewed build fix. Don't try to build udis86_itab.c since it's included by
1033 another file.
1034
1035 * wscript:
1036
commit-queue@webkit.orgd847b5c2012-07-11 19:48:29 +000010372012-07-11 Chao-ying Fu <fu@mips.com>
1038
1039 Add MIPS convertibleLoadPtr and other functions
1040 https://bugs.webkit.org/show_bug.cgi?id=90714
1041
1042 Reviewed by Oliver Hunt.
1043
1044 * assembler/MIPSAssembler.h:
1045 (JSC::MIPSAssembler::labelIgnoringWatchpoints):
1046 (MIPSAssembler):
1047 (JSC::MIPSAssembler::replaceWithLoad):
1048 (JSC::MIPSAssembler::replaceWithAddressComputation):
1049 * assembler/MacroAssemblerMIPS.h:
1050 (JSC::MacroAssemblerMIPS::convertibleLoadPtr):
1051 (MacroAssemblerMIPS):
1052
andersca@apple.come73df4c2012-07-11 19:41:03 +000010532012-07-11 Anders Carlsson <andersca@apple.com>
1054
1055 Add -Wtautological-compare and -Wsign-compare warning flags
1056 https://bugs.webkit.org/show_bug.cgi?id=90994
1057
1058 Reviewed by Mark Rowe.
1059
1060 * Configurations/Base.xcconfig:
1061
benjamin@webkit.orgea8276a2012-07-11 18:15:17 +000010622012-07-11 Benjamin Poulain <bpoulain@apple.com>
1063
1064 Simplify the copying of JSC ARMv7's LinkRecord
1065 https://bugs.webkit.org/show_bug.cgi?id=90930
1066
1067 Reviewed by Filip Pizlo.
1068
1069 The class LinkRecord is used by value everywhere in ARMv7Assembler. The compiler uses
1070 memmove() to move the objects.
1071
1072 The problem is memmove() is overkill for this object, moving the value can be done with
1073 3 load-store. This patch adds an operator= to the class doing more efficient copying.
1074 This reduces the link time by 19%.
1075
1076 * assembler/ARMv7Assembler.h:
1077 (JSC::ARMv7Assembler::LinkRecord::LinkRecord):
1078 (JSC::ARMv7Assembler::LinkRecord::operator=):
1079 (JSC::ARMv7Assembler::LinkRecord::from):
1080 (JSC::ARMv7Assembler::LinkRecord::setFrom):
1081 (JSC::ARMv7Assembler::LinkRecord::to):
1082 (JSC::ARMv7Assembler::LinkRecord::type):
1083 (JSC::ARMv7Assembler::LinkRecord::linkType):
1084 (JSC::ARMv7Assembler::LinkRecord::setLinkType):
1085 (JSC::ARMv7Assembler::LinkRecord::condition):
1086
wingo@igalia.com8d1d0d42012-07-11 17:50:15 +000010872012-07-11 Andy Wingo <wingo@igalia.com>
1088
1089 jsc: Parse options before creating global data
1090 https://bugs.webkit.org/show_bug.cgi?id=90975
1091
1092 Reviewed by Filip Pizlo.
1093
1094 This patch moves the options parsing in "jsc" before the creation
1095 of the JSGlobalData, so that --useJIT=no has a chance to take
1096 effect.
1097
1098 * jsc.cpp:
1099 (CommandLine::parseArguments): Refactor to be a class, and take
1100 argc and argv as constructor arguments.
1101 (jscmain): Move arg parsing before JSGlobalData creation.
1102
fpizlo@apple.com39c94a42012-07-10 09:18:47 +000011032012-07-10 Filip Pizlo <fpizlo@apple.com>
1104
ossy@webkit.orgb626a9e2012-07-10 09:36:13 +00001105 REGRESSION(r122166): It made 170 tests crash on 32 bit platforms
1106 https://bugs.webkit.org/show_bug.cgi?id=90852
1107
1108 Reviewed by Zoltan Herczeg.
1109
1110 If we can't use the range filter, we should still make sure that the
1111 address is remotely sane, otherwise the hashtables will assert.
1112
1113 * jit/JITStubRoutine.h:
1114 (JSC::JITStubRoutine::passesFilter):
1115
11162012-07-10 Filip Pizlo <fpizlo@apple.com>
1117
fpizlo@apple.com39c94a42012-07-10 09:18:47 +00001118 DFG recompilation heuristics should be based on count, not rate
1119 https://bugs.webkit.org/show_bug.cgi?id=90146
1120
1121 Reviewed by Oliver Hunt.
1122
1123 Rolling r121511 back in after fixing the DFG's interpretation of op_div
1124 profiling, with Gavin's rubber stamp.
1125
1126 This removes a bunch of code that was previously trying to prevent spurious
1127 reoptimizations if a large enough majority of executions of a code block did
1128 not result in OSR exit. It turns out that this code was purely harmful. This
1129 patch removes all of that logic and replaces it with a dead-simple
1130 heuristic: if you exit more than N times (where N is an exponential function
1131 of the number of times the code block has already been recompiled) then we
1132 will recompile.
1133
1134 This appears to be a broad ~1% win on many benchmarks large and small.
1135
1136 * bytecode/CodeBlock.cpp:
1137 (JSC::CodeBlock::CodeBlock):
1138 * bytecode/CodeBlock.h:
1139 (JSC::CodeBlock::couldTakeSpecialFastCase):
1140 (CodeBlock):
1141 (JSC::CodeBlock::osrExitCounter):
1142 (JSC::CodeBlock::countOSRExit):
1143 (JSC::CodeBlock::addressOfOSRExitCounter):
1144 (JSC::CodeBlock::offsetOfOSRExitCounter):
1145 (JSC::CodeBlock::adjustedExitCountThreshold):
1146 (JSC::CodeBlock::exitCountThresholdForReoptimization):
1147 (JSC::CodeBlock::exitCountThresholdForReoptimizationFromLoop):
1148 (JSC::CodeBlock::shouldReoptimizeNow):
1149 (JSC::CodeBlock::shouldReoptimizeFromLoopNow):
1150 * bytecode/ExecutionCounter.cpp:
1151 (JSC::ExecutionCounter::setThreshold):
1152 * bytecode/ExecutionCounter.h:
1153 (ExecutionCounter):
1154 (JSC::ExecutionCounter::clippedThreshold):
1155 * dfg/DFGByteCodeParser.cpp:
1156 (JSC::DFG::ByteCodeParser::makeDivSafe):
1157 * dfg/DFGJITCompiler.cpp:
1158 (JSC::DFG::JITCompiler::compileBody):
1159 * dfg/DFGOSRExit.cpp:
1160 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
1161 * dfg/DFGOSRExitCompiler.cpp:
1162 (JSC::DFG::OSRExitCompiler::handleExitCounts):
1163 * dfg/DFGOperations.cpp:
1164 * jit/JITStubs.cpp:
1165 (JSC::DEFINE_STUB_FUNCTION):
1166 * runtime/Options.h:
1167 (JSC):
1168
commit-queue@webkit.orge1bba8e2012-07-10 05:45:21 +000011692012-07-09 Matt Falkenhagen <falken@chromium.org>
1170
1171 Add ENABLE_DIALOG_ELEMENT and skeleton files
1172 https://bugs.webkit.org/show_bug.cgi?id=90521
1173
1174 Reviewed by Kent Tamura.
1175
1176 * Configurations/FeatureDefines.xcconfig:
1177
fpizlo@apple.com746b8c52012-07-09 23:26:54 +000011782012-07-09 Filip Pizlo <fpizlo@apple.com>
1179
fpizlo@apple.com629c1cd2012-07-10 01:50:44 +00001180 Unreviewed, roll out http://trac.webkit.org/changeset/121511
1181 It made in-browser V8v7 10% slower.
1182
1183 * bytecode/CodeBlock.cpp:
1184 (JSC::CodeBlock::CodeBlock):
1185 * bytecode/CodeBlock.h:
1186 (CodeBlock):
1187 (JSC::CodeBlock::countSpeculationSuccess):
1188 (JSC::CodeBlock::countSpeculationFailure):
1189 (JSC::CodeBlock::speculativeSuccessCounter):
1190 (JSC::CodeBlock::speculativeFailCounter):
1191 (JSC::CodeBlock::forcedOSRExitCounter):
1192 (JSC::CodeBlock::addressOfSpeculativeSuccessCounter):
1193 (JSC::CodeBlock::addressOfSpeculativeFailCounter):
1194 (JSC::CodeBlock::addressOfForcedOSRExitCounter):
1195 (JSC::CodeBlock::offsetOfSpeculativeSuccessCounter):
1196 (JSC::CodeBlock::offsetOfSpeculativeFailCounter):
1197 (JSC::CodeBlock::offsetOfForcedOSRExitCounter):
1198 (JSC::CodeBlock::largeFailCountThreshold):
1199 (JSC::CodeBlock::largeFailCountThresholdForLoop):
1200 (JSC::CodeBlock::shouldReoptimizeNow):
1201 (JSC::CodeBlock::shouldReoptimizeFromLoopNow):
1202 * bytecode/ExecutionCounter.cpp:
1203 (JSC::ExecutionCounter::setThreshold):
1204 * bytecode/ExecutionCounter.h:
1205 (ExecutionCounter):
1206 * dfg/DFGJITCompiler.cpp:
1207 (JSC::DFG::JITCompiler::compileBody):
1208 * dfg/DFGOSRExit.cpp:
1209 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
1210 * dfg/DFGOSRExitCompiler.cpp:
1211 (JSC::DFG::OSRExitCompiler::handleExitCounts):
1212 * dfg/DFGOperations.cpp:
1213 * jit/JITStubs.cpp:
1214 (JSC::DEFINE_STUB_FUNCTION):
1215 * runtime/Options.h:
1216 (JSC):
1217
12182012-07-09 Filip Pizlo <fpizlo@apple.com>
1219
fpizlo@apple.comcacd7dc2012-07-09 23:28:53 +00001220 DFG may get stuck in an infinite fix point if it constant folds a mispredicted node
1221 https://bugs.webkit.org/show_bug.cgi?id=90829
1222 <rdar://problem/11823843>
1223
1224 Reviewed by Oliver Hunt.
1225
1226 If a node is shown to have been mispredicted during CFA, then don't allow constant
1227 folding to make the graph even more degenerate. Instead, pull back on constant folding
1228 and allow the normal OSR machinery to fix our profiling so that a future recompilation
1229 doesn't see the same mistake.
1230
1231 * dfg/DFGAbstractState.cpp:
1232 (JSC::DFG::AbstractState::execute):
1233 * dfg/DFGAbstractState.h:
1234 (JSC::DFG::AbstractState::trySetConstant):
1235 (AbstractState):
1236 * dfg/DFGPhase.h:
1237 (JSC::DFG::Phase::name):
1238 (Phase):
1239 (JSC::DFG::runAndLog):
1240 (DFG):
1241 (JSC::DFG::runPhase):
1242
12432012-07-09 Filip Pizlo <fpizlo@apple.com>
1244
fpizlo@apple.com746b8c52012-07-09 23:26:54 +00001245 It should be possible to jettison JIT stub routines even if they are currently running
1246 https://bugs.webkit.org/show_bug.cgi?id=90731
1247
1248 Reviewed by Gavin Barraclough.
1249
1250 This gives the GC awareness of all JIT-generated stubs for inline caches. That
1251 means that if you want to delete a JIT-generated stub, you don't have to worry
1252 about whether or not it is currently running: if there is a chance that it might
1253 be, the GC will kindly defer deletion until non-running-ness is proved.
1254
1255 * CMakeLists.txt:
1256 * GNUmakefile.list.am:
1257 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1258 * JavaScriptCore.xcodeproj/project.pbxproj:
1259 * Target.pri:
1260 * bytecode/Instruction.h:
1261 (JSC):
1262 (PolymorphicStubInfo):
1263 (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
1264 (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
1265 * bytecode/PolymorphicPutByIdList.cpp:
1266 (JSC::PutByIdAccess::fromStructureStubInfo):
1267 * bytecode/PolymorphicPutByIdList.h:
1268 (JSC::PutByIdAccess::transition):
1269 (JSC::PutByIdAccess::replace):
1270 (JSC::PutByIdAccess::stubRoutine):
1271 (PutByIdAccess):
1272 (JSC::PolymorphicPutByIdList::currentSlowPathTarget):
1273 * bytecode/StructureStubInfo.h:
1274 (JSC::StructureStubInfo::reset):
1275 * dfg/DFGRepatch.cpp:
1276 (JSC::DFG::generateProtoChainAccessStub):
1277 (JSC::DFG::tryCacheGetByID):
1278 (JSC::DFG::tryBuildGetByIDList):
1279 (JSC::DFG::tryBuildGetByIDProtoList):
1280 (JSC::DFG::emitPutReplaceStub):
1281 (JSC::DFG::emitPutTransitionStub):
1282 (JSC::DFG::tryCachePutByID):
1283 (JSC::DFG::tryBuildPutByIdList):
1284 * heap/ConservativeRoots.cpp:
1285 (JSC):
1286 (DummyMarkHook):
1287 (JSC::DummyMarkHook::mark):
1288 (JSC::ConservativeRoots::add):
1289 (CompositeMarkHook):
1290 (JSC::CompositeMarkHook::CompositeMarkHook):
1291 (JSC::CompositeMarkHook::mark):
1292 * heap/ConservativeRoots.h:
1293 (JSC):
1294 (ConservativeRoots):
1295 * heap/Heap.cpp:
1296 (JSC::Heap::markRoots):
1297 (JSC::Heap::deleteUnmarkedCompiledCode):
1298 * heap/Heap.h:
1299 (JSC):
1300 (Heap):
1301 * heap/JITStubRoutineSet.cpp: Added.
1302 (JSC):
1303 (JSC::JITStubRoutineSet::JITStubRoutineSet):
1304 (JSC::JITStubRoutineSet::~JITStubRoutineSet):
1305 (JSC::JITStubRoutineSet::add):
1306 (JSC::JITStubRoutineSet::clearMarks):
1307 (JSC::JITStubRoutineSet::markSlow):
1308 (JSC::JITStubRoutineSet::deleteUnmarkedJettisonedStubRoutines):
1309 (JSC::JITStubRoutineSet::traceMarkedStubRoutines):
1310 * heap/JITStubRoutineSet.h: Added.
1311 (JSC):
1312 (JITStubRoutineSet):
1313 (JSC::JITStubRoutineSet::mark):
1314 * heap/MachineStackMarker.h:
1315 (JSC):
1316 * interpreter/RegisterFile.cpp:
1317 (JSC::RegisterFile::gatherConservativeRoots):
1318 * interpreter/RegisterFile.h:
1319 (JSC):
1320 * jit/ExecutableAllocator.cpp:
1321 (JSC::DemandExecutableAllocator::DemandExecutableAllocator):
1322 * jit/ExecutableAllocator.h:
1323 (JSC):
1324 * jit/ExecutableAllocatorFixedVMPool.cpp:
1325 (JSC):
1326 (JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator):
1327 * jit/GCAwareJITStubRoutine.cpp: Added.
1328 (JSC):
1329 (JSC::GCAwareJITStubRoutine::GCAwareJITStubRoutine):
1330 (JSC::GCAwareJITStubRoutine::~GCAwareJITStubRoutine):
1331 (JSC::GCAwareJITStubRoutine::observeZeroRefCount):
1332 (JSC::GCAwareJITStubRoutine::deleteFromGC):
1333 (JSC::GCAwareJITStubRoutine::markRequiredObjectsInternal):
1334 (JSC::MarkingGCAwareJITStubRoutineWithOneObject::MarkingGCAwareJITStubRoutineWithOneObject):
1335 (JSC::MarkingGCAwareJITStubRoutineWithOneObject::~MarkingGCAwareJITStubRoutineWithOneObject):
1336 (JSC::MarkingGCAwareJITStubRoutineWithOneObject::markRequiredObjectsInternal):
1337 (JSC::createJITStubRoutine):
1338 * jit/GCAwareJITStubRoutine.h: Added.
1339 (JSC):
1340 (GCAwareJITStubRoutine):
1341 (JSC::GCAwareJITStubRoutine::markRequiredObjects):
1342 (MarkingGCAwareJITStubRoutineWithOneObject):
1343 * jit/JITPropertyAccess.cpp:
1344 (JSC::JIT::privateCompilePutByIdTransition):
1345 (JSC::JIT::privateCompilePatchGetArrayLength):
1346 (JSC::JIT::privateCompileGetByIdProto):
1347 (JSC::JIT::privateCompileGetByIdSelfList):
1348 (JSC::JIT::privateCompileGetByIdProtoList):
1349 (JSC::JIT::privateCompileGetByIdChainList):
1350 (JSC::JIT::privateCompileGetByIdChain):
1351 * jit/JITPropertyAccess32_64.cpp:
1352 (JSC::JIT::privateCompilePutByIdTransition):
1353 (JSC::JIT::privateCompilePatchGetArrayLength):
1354 (JSC::JIT::privateCompileGetByIdProto):
1355 (JSC::JIT::privateCompileGetByIdSelfList):
1356 (JSC::JIT::privateCompileGetByIdProtoList):
1357 (JSC::JIT::privateCompileGetByIdChainList):
1358 (JSC::JIT::privateCompileGetByIdChain):
1359 * jit/JITStubRoutine.cpp: Added.
1360 (JSC):
1361 (JSC::JITStubRoutine::~JITStubRoutine):
1362 (JSC::JITStubRoutine::observeZeroRefCount):
1363 * jit/JITStubRoutine.h: Added.
1364 (JSC):
1365 (JITStubRoutine):
1366 (JSC::JITStubRoutine::JITStubRoutine):
1367 (JSC::JITStubRoutine::createSelfManagedRoutine):
1368 (JSC::JITStubRoutine::code):
1369 (JSC::JITStubRoutine::asCodePtr):
1370 (JSC::JITStubRoutine::ref):
1371 (JSC::JITStubRoutine::deref):
1372 (JSC::JITStubRoutine::startAddress):
1373 (JSC::JITStubRoutine::endAddress):
1374 (JSC::JITStubRoutine::addressStep):
1375 (JSC::JITStubRoutine::canPerformRangeFilter):
1376 (JSC::JITStubRoutine::filteringStartAddress):
1377 (JSC::JITStubRoutine::filteringExtentSize):
1378 (JSC::JITStubRoutine::passesFilter):
1379 * jit/JITStubs.cpp:
1380 (JSC::DEFINE_STUB_FUNCTION):
1381 (JSC::getPolymorphicAccessStructureListSlot):
1382
commit-queue@webkit.orgfb3c9682012-07-09 15:39:09 +000013832012-07-09 Sheriff Bot <webkit.review.bot@gmail.com>
1384
1385 Unreviewed, rolling out r122107.
1386 http://trac.webkit.org/changeset/122107
1387 https://bugs.webkit.org/show_bug.cgi?id=90794
1388
1389 Build failure on Mac debug bots (Requested by falken_ on
1390 #webkit).
1391
1392 * Configurations/FeatureDefines.xcconfig:
1393
commit-queue@webkit.orgb46a45d2012-07-09 14:42:00 +000013942012-07-09 Matt Falkenhagen <falken@chromium.org>
1395
1396 Add ENABLE_DIALOG_ELEMENT and skeleton files
1397 https://bugs.webkit.org/show_bug.cgi?id=90521
1398
1399 Reviewed by Kent Tamura.
1400
1401 * Configurations/FeatureDefines.xcconfig:
1402
rniwa@webkit.orga5efe7e2012-07-09 06:19:54 +000014032012-07-08 Ryosuke Niwa <rniwa@webkit.org>
1404
1405 gcc build fix after r121925.
1406
1407 * runtime/JSObject.h:
1408 (JSC::JSFinalObject::finishCreation):
1409
zherczeg@webkit.orgadfdb1f2012-07-08 10:00:04 +000014102012-07-08 Zoltan Herczeg <zherczeg@webkit.org>
1411
1412 [Qt][ARM] Implementing missing macro assembler instructions after r121925
1413 https://bugs.webkit.org/show_bug.cgi?id=90657
1414
1415 Reviewed by Csaba Osztrogonác.
1416
1417 Implementing convertibleLoadPtr, replaceWithLoad and
1418 replaceWithAddressComputation.
1419
1420 * assembler/ARMAssembler.h:
1421 (JSC::ARMAssembler::replaceWithLoad):
1422 (ARMAssembler):
1423 (JSC::ARMAssembler::replaceWithAddressComputation):
1424 * assembler/MacroAssemblerARM.h:
1425 (JSC::MacroAssemblerARM::convertibleLoadPtr):
1426 (MacroAssemblerARM):
1427
fpizlo@apple.com18066da2012-07-07 00:43:21 +000014282012-07-06 Filip Pizlo <fpizlo@apple.com>
1429
1430 WebKit Version 5.1.7 (6534.57.2, r121935): Double-click no longer works on OpenStreetMap
1431 https://bugs.webkit.org/show_bug.cgi?id=90703
1432
1433 Reviewed by Michael Saboff.
1434
1435 It turns out that in my object model refactoring, I managed to fix get_by_pname in all
1436 execution engines except 64-bit baseline JIT.
1437
1438 * jit/JITPropertyAccess.cpp:
1439 (JSC::JIT::emit_op_get_by_pname):
1440
commit-queue@webkit.org650e3e62012-07-06 20:41:09 +000014412012-07-06 Pravin D <pravind.2k4@gmail.com>
1442
1443 Build Error on Qt Linux build
1444 https://bugs.webkit.org/show_bug.cgi?id=90699
1445
1446 Reviewed by Laszlo Gombos.
1447
1448 * parser/Parser.cpp:
1449 (JSC::::parseForStatement):
1450 Removed unused boolean variable as this was causing build error on Qt Linux.
1451
commit-queue@webkit.orgc182dfc2012-07-06 17:39:20 +000014522012-07-06 Nuno Lopes <nlopes@apple.com>
1453
1454 Fix build with recent clang.
1455 https://bugs.webkit.org/show_bug.cgi?id=90634
1456
1457 Reviewed by Oliver Hunt.
1458
1459 * jit/SpecializedThunkJIT.h:
1460 (JSC::SpecializedThunkJIT::SpecializedThunkJIT):
1461 (SpecializedThunkJIT):
1462 * jit/ThunkGenerators.cpp:
1463 (JSC::charCodeAtThunkGenerator):
1464 (JSC::charAtThunkGenerator):
1465 (JSC::fromCharCodeThunkGenerator):
1466 (JSC::sqrtThunkGenerator):
1467 (JSC::floorThunkGenerator):
1468 (JSC::ceilThunkGenerator):
1469 (JSC::roundThunkGenerator):
1470 (JSC::expThunkGenerator):
1471 (JSC::logThunkGenerator):
1472 (JSC::absThunkGenerator):
1473 (JSC::powThunkGenerator):
1474 * parser/ASTBuilder.h:
1475 (JSC::ASTBuilder::createAssignResolve):
1476 (JSC::ASTBuilder::createForLoop):
1477 (JSC::ASTBuilder::createForInLoop):
1478 (JSC::ASTBuilder::makeAssignNode):
1479 (JSC::ASTBuilder::makePrefixNode):
1480 (JSC::ASTBuilder::makePostfixNode):
1481 * parser/NodeConstructors.h:
1482 (JSC::PostfixErrorNode::PostfixErrorNode):
1483 (JSC::PrefixErrorNode::PrefixErrorNode):
1484 (JSC::AssignResolveNode::AssignResolveNode):
1485 (JSC::AssignErrorNode::AssignErrorNode):
1486 (JSC::ForNode::ForNode):
1487 (JSC::ForInNode::ForInNode):
1488 * parser/Nodes.h:
1489 (FunctionCallResolveNode):
1490 (PostfixErrorNode):
1491 (PrefixErrorNode):
1492 (ReadModifyResolveNode):
1493 (AssignResolveNode):
1494 (AssignErrorNode):
1495 (ForNode):
1496 (ForInNode):
1497 * parser/Parser.cpp:
1498 (JSC::::parseVarDeclarationList):
1499 (JSC::::parseForStatement):
1500 * parser/SyntaxChecker.h:
1501 (JSC::SyntaxChecker::createAssignResolve):
1502 (JSC::SyntaxChecker::createForLoop):
1503
zherczeg@webkit.orgb3b18db2012-07-06 08:42:29 +000015042012-07-06 Zoltan Herczeg <zherczeg@webkit.org>
1505
1506 [Qt][ARM] REGRESSION(r121885): It broke 30 jsc tests, 500+ layout tests
1507 https://bugs.webkit.org/show_bug.cgi?id=90656
1508
1509 Reviewed by Csaba Osztrogonác.
1510
1511 Typo fixes.
1512
1513 * assembler/MacroAssemblerARM.cpp:
1514 (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords):
1515 Rename getOp2Byte() -> getOp2Half()
1516 * assembler/MacroAssemblerARMv7.h:
1517 (JSC::MacroAssemblerARMv7::convertibleLoadPtr):
1518 Add a necessary space.
1519 * jit/JITStubs.cpp:
1520 (JSC):
1521 Revert INLINE_ARM_FUNCTION macro.
1522
fpizlo@apple.come26c6d22012-07-06 07:01:35 +000015232012-07-05 Filip Pizlo <fpizlo@apple.com>
1524
1525 REGRESSION(r121925): It broke 5 sputnik tests on x86 platforms
1526 https://bugs.webkit.org/show_bug.cgi?id=90658
1527
1528 Reviewed by Zoltan Herczeg.
1529
1530 Under the new object model, out-of-line property accesses such as those
1531 in ResolveGlobal must account for the fact that the offset to the Kth
1532 property is represented by K + inlineStorageCapacity. Hence, the property
1533 loads in ResolveGlobal must have an additional -inlineStorageCapacity *
1534 sizeof(JSValue) offset.
1535
1536 * dfg/DFGSpeculativeJIT32_64.cpp:
1537 (JSC::DFG::SpeculativeJIT::compile):
1538
ossy@webkit.orgc5b75fd2012-07-06 04:52:26 +000015392012-07-05 Csaba Osztrogonác <ossy@webkit.org>
1540
1541 [Qt] Unreviewed 64 bit buildfix after r121925.
1542
1543 * bytecode/PutByIdStatus.cpp:
1544 (JSC::PutByIdStatus::computeFromLLInt):
1545
msaboff@apple.comb1b64c72012-07-06 00:04:05 +000015462012-07-05 Michael Saboff <msaboff@apple.com>
1547
1548 JSString::tryHashConstLock() fails to get exclusive lock
1549 https://bugs.webkit.org/show_bug.cgi?id=90639
1550
1551 Reviewed by Oliver Hunt.
1552
1553 Added check that the string is already locked even before compare and swap.
1554
1555 * heap/MarkStack.cpp:
1556 (JSC::JSString::tryHashConstLock):
1557
fpizlo@apple.comd68b1f82012-07-05 22:55:51 +000015582012-07-04 Filip Pizlo <fpizlo@apple.com>
1559
1560 Inline property storage should not be wasted when it is exhausted
1561 https://bugs.webkit.org/show_bug.cgi?id=90347
1562
1563 Reviewed by Gavin Barraclough.
1564
1565 Previously, if we switched an object from using inline storage to out-of-line
1566 storage, we would abandon the inline storage. This would have two main implications:
1567 (i) all accesses to the object, even for properties that were previously in inline
1568 storage, must now take an extra indirection; and (ii) we waste a non-trivial amount
1569 of space since we must allocate additional out-of-line storage to hold properties
1570 that would have fit in the inline storage. There's also the copying cost when
1571 switching to out-of-line storage - we must copy all inline properties into ouf-of-line
1572 storage.
1573
1574 This patch changes the way that object property storage works so that we can use both
1575 inline and out-of-line storage concurrently. This is accomplished by introducing a
1576 new notion of property offset. This PropertyOffset is a 32-bit signed integer and it
1577 behaves as follows:
1578
1579 offset == -1: invalid offset, indicating a property that does not exist.
1580
1581 0 <= offset <= inlineStorageCapacity: offset into inline storage.
1582
1583 inlineStorageCapacity < offset: offset into out-of-line storage.
1584
1585 Because non-final objects don't have inline storage, the only valid PropertyOffsets
1586 for those objects' properties are -1 or > inlineStorageCapacity.
1587
1588 This now means that the decision to use inline or out-of-line storage for an access is
1589 made based on the offset, rather than the structure. It also means that any access
1590 where the offset is a variable must have an extra branch, unless the type of the
1591 object is also known (if it's known to be a non-final object then we can just assert
1592 that the offset is >= inlineStorageCapacity).
1593
1594 This looks like a big Kraken speed-up and a slight V8 speed-up.
1595
1596 * GNUmakefile.list.am:
1597 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
1598 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1599 * JavaScriptCore.xcodeproj/project.pbxproj:
1600 * assembler/ARMv7Assembler.h:
1601 (ARMv7Assembler):
1602 (JSC::ARMv7Assembler::ldrWide8BitImmediate):
1603 (JSC::ARMv7Assembler::replaceWithLoad):
1604 (JSC::ARMv7Assembler::replaceWithAddressComputation):
1605 * assembler/AbstractMacroAssembler.h:
1606 (AbstractMacroAssembler):
1607 (ConvertibleLoadLabel):
1608 (JSC::AbstractMacroAssembler::ConvertibleLoadLabel::ConvertibleLoadLabel):
1609 (JSC::AbstractMacroAssembler::ConvertibleLoadLabel::isSet):
1610 (JSC::AbstractMacroAssembler::labelIgnoringWatchpoints):
1611 (JSC::AbstractMacroAssembler::replaceWithLoad):
1612 (JSC::AbstractMacroAssembler::replaceWithAddressComputation):
1613 * assembler/CodeLocation.h:
1614 (JSC):
1615 (CodeLocationCommon):
1616 (CodeLocationConvertibleLoad):
1617 (JSC::CodeLocationConvertibleLoad::CodeLocationConvertibleLoad):
1618 (JSC::CodeLocationCommon::convertibleLoadAtOffset):
1619 * assembler/LinkBuffer.cpp:
1620 (JSC::LinkBuffer::finalizeCodeWithDisassembly):
1621 * assembler/LinkBuffer.h:
1622 (LinkBuffer):
1623 (JSC::LinkBuffer::locationOf):
1624 * assembler/MacroAssemblerARMv7.h:
1625 (MacroAssemblerARMv7):
1626 (JSC::MacroAssemblerARMv7::convertibleLoadPtr):
1627 * assembler/MacroAssemblerX86.h:
1628 (JSC::MacroAssemblerX86::convertibleLoadPtr):
1629 (MacroAssemblerX86):
1630 * assembler/MacroAssemblerX86_64.h:
1631 (JSC::MacroAssemblerX86_64::convertibleLoadPtr):
1632 (MacroAssemblerX86_64):
1633 * assembler/RepatchBuffer.h:
1634 (RepatchBuffer):
1635 (JSC::RepatchBuffer::replaceWithLoad):
1636 (JSC::RepatchBuffer::replaceWithAddressComputation):
1637 (JSC::RepatchBuffer::setLoadInstructionIsActive):
1638 * assembler/X86Assembler.h:
1639 (JSC::X86Assembler::replaceWithLoad):
1640 (X86Assembler):
1641 (JSC::X86Assembler::replaceWithAddressComputation):
1642 * bytecode/CodeBlock.cpp:
1643 (JSC::CodeBlock::printGetByIdOp):
1644 (JSC::CodeBlock::dump):
1645 (JSC::CodeBlock::finalizeUnconditionally):
1646 * bytecode/GetByIdStatus.cpp:
1647 (JSC::GetByIdStatus::computeFromLLInt):
1648 (JSC::GetByIdStatus::computeForChain):
1649 (JSC::GetByIdStatus::computeFor):
1650 * bytecode/GetByIdStatus.h:
1651 (JSC::GetByIdStatus::GetByIdStatus):
1652 (JSC::GetByIdStatus::offset):
1653 (GetByIdStatus):
1654 * bytecode/Opcode.h:
1655 (JSC):
1656 (JSC::padOpcodeName):
1657 * bytecode/PutByIdStatus.cpp:
1658 (JSC::PutByIdStatus::computeFromLLInt):
1659 (JSC::PutByIdStatus::computeFor):
1660 * bytecode/PutByIdStatus.h:
1661 (JSC::PutByIdStatus::PutByIdStatus):
1662 (JSC::PutByIdStatus::offset):
1663 (PutByIdStatus):
1664 * bytecode/ResolveGlobalStatus.cpp:
1665 (JSC):
1666 (JSC::computeForStructure):
1667 * bytecode/ResolveGlobalStatus.h:
1668 (JSC::ResolveGlobalStatus::ResolveGlobalStatus):
1669 (JSC::ResolveGlobalStatus::offset):
1670 (ResolveGlobalStatus):
1671 * bytecode/StructureSet.h:
1672 (StructureSet):
1673 * bytecode/StructureStubInfo.h:
1674 * dfg/DFGByteCodeParser.cpp:
1675 (ByteCodeParser):
1676 (JSC::DFG::ByteCodeParser::handleGetByOffset):
1677 (JSC::DFG::ByteCodeParser::handleGetById):
1678 (JSC::DFG::ByteCodeParser::parseBlock):
1679 * dfg/DFGCapabilities.h:
1680 (JSC::DFG::canCompileOpcode):
1681 * dfg/DFGJITCompiler.cpp:
1682 (JSC::DFG::JITCompiler::link):
1683 * dfg/DFGJITCompiler.h:
1684 (JSC::DFG::PropertyAccessRecord::PropertyAccessRecord):
1685 (PropertyAccessRecord):
1686 * dfg/DFGRepatch.cpp:
1687 (JSC::DFG::dfgRepatchByIdSelfAccess):
1688 (JSC::DFG::generateProtoChainAccessStub):
1689 (JSC::DFG::tryCacheGetByID):
1690 (JSC::DFG::tryBuildGetByIDList):
1691 (JSC::DFG::tryBuildGetByIDProtoList):
1692 (JSC::DFG::emitPutReplaceStub):
1693 (JSC::DFG::emitPutTransitionStub):
1694 (JSC::DFG::tryCachePutByID):
1695 (JSC::DFG::tryBuildPutByIdList):
1696 * dfg/DFGSpeculativeJIT.h:
1697 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
1698 * dfg/DFGSpeculativeJIT32_64.cpp:
1699 (JSC::DFG::SpeculativeJIT::cachedGetById):
1700 (JSC::DFG::SpeculativeJIT::cachedPutById):
1701 (JSC::DFG::SpeculativeJIT::compile):
1702 * dfg/DFGSpeculativeJIT64.cpp:
1703 (JSC::DFG::SpeculativeJIT::cachedGetById):
1704 (JSC::DFG::SpeculativeJIT::cachedPutById):
1705 (JSC::DFG::SpeculativeJIT::compile):
1706 * heap/MarkStack.cpp:
1707 (JSC::visitChildren):
1708 * interpreter/Interpreter.cpp:
1709 (JSC::Interpreter::tryCacheGetByID):
1710 (JSC::Interpreter::privateExecute):
1711 * jit/JIT.cpp:
1712 (JSC::JIT::privateCompileMainPass):
1713 (JSC::JIT::privateCompileSlowCases):
1714 (JSC::PropertyStubCompilationInfo::copyToStubInfo):
1715 * jit/JIT.h:
1716 (JSC::PropertyStubCompilationInfo::PropertyStubCompilationInfo):
1717 (JSC::JIT::compileGetByIdProto):
1718 (JSC::JIT::compileGetByIdSelfList):
1719 (JSC::JIT::compileGetByIdProtoList):
1720 (JSC::JIT::compileGetByIdChainList):
1721 (JSC::JIT::compileGetByIdChain):
1722 (JSC::JIT::compilePutByIdTransition):
1723 (JIT):
1724 * jit/JITInlineMethods.h:
1725 (JSC::JIT::emitAllocateBasicJSObject):
1726 * jit/JITOpcodes.cpp:
1727 (JSC::JIT::emit_op_resolve_global):
1728 * jit/JITOpcodes32_64.cpp:
1729 (JSC::JIT::emit_op_resolve_global):
1730 * jit/JITPropertyAccess.cpp:
1731 (JSC::JIT::compileGetDirectOffset):
1732 (JSC::JIT::emit_op_method_check):
1733 (JSC::JIT::compileGetByIdHotPath):
1734 (JSC::JIT::emit_op_put_by_id):
1735 (JSC::JIT::compilePutDirectOffset):
1736 (JSC::JIT::privateCompilePutByIdTransition):
1737 (JSC::JIT::patchGetByIdSelf):
1738 (JSC::JIT::patchPutByIdReplace):
1739 (JSC::JIT::privateCompileGetByIdProto):
1740 (JSC::JIT::privateCompileGetByIdSelfList):
1741 (JSC::JIT::privateCompileGetByIdProtoList):
1742 (JSC::JIT::privateCompileGetByIdChainList):
1743 (JSC::JIT::privateCompileGetByIdChain):
1744 * jit/JITPropertyAccess32_64.cpp:
1745 (JSC::JIT::emit_op_method_check):
1746 (JSC::JIT::compileGetByIdHotPath):
1747 (JSC::JIT::emit_op_put_by_id):
1748 (JSC::JIT::compilePutDirectOffset):
1749 (JSC::JIT::compileGetDirectOffset):
1750 (JSC::JIT::privateCompilePutByIdTransition):
1751 (JSC::JIT::patchGetByIdSelf):
1752 (JSC::JIT::patchPutByIdReplace):
1753 (JSC::JIT::privateCompileGetByIdProto):
1754 (JSC::JIT::privateCompileGetByIdSelfList):
1755 (JSC::JIT::privateCompileGetByIdProtoList):
1756 (JSC::JIT::privateCompileGetByIdChainList):
1757 (JSC::JIT::privateCompileGetByIdChain):
1758 (JSC::JIT::emit_op_get_by_pname):
1759 * jit/JITStubs.cpp:
1760 (JSC::JITThunks::tryCacheGetByID):
1761 (JSC::DEFINE_STUB_FUNCTION):
1762 * llint/LLIntSlowPaths.cpp:
1763 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
1764 * llint/LowLevelInterpreter.asm:
1765 * llint/LowLevelInterpreter32_64.asm:
1766 * llint/LowLevelInterpreter64.asm:
1767 * offlineasm/x86.rb:
1768 * runtime/JSGlobalObject.h:
1769 (JSGlobalObject):
1770 (JSC::JSGlobalObject::functionNameOffset):
1771 * runtime/JSObject.cpp:
1772 (JSC::JSObject::visitChildren):
1773 (JSC):
1774 (JSC::JSFinalObject::visitChildren):
1775 (JSC::JSObject::put):
1776 (JSC::JSObject::deleteProperty):
1777 (JSC::JSObject::getPropertySpecificValue):
1778 (JSC::JSObject::removeDirect):
1779 (JSC::JSObject::growOutOfLineStorage):
1780 (JSC::JSObject::getOwnPropertyDescriptor):
1781 * runtime/JSObject.h:
1782 (JSObject):
1783 (JSC::JSObject::getDirect):
1784 (JSC::JSObject::getDirectLocation):
1785 (JSC::JSObject::hasInlineStorage):
1786 (JSC::JSObject::inlineStorageUnsafe):
1787 (JSC::JSObject::inlineStorage):
1788 (JSC::JSObject::outOfLineStorage):
1789 (JSC::JSObject::locationForOffset):
1790 (JSC::JSObject::offsetForLocation):
1791 (JSC::JSObject::getDirectOffset):
1792 (JSC::JSObject::putDirectOffset):
1793 (JSC::JSObject::putUndefinedAtDirectOffset):
1794 (JSC::JSObject::addressOfOutOfLineStorage):
1795 (JSC::JSObject::finishCreation):
1796 (JSC::JSNonFinalObject::JSNonFinalObject):
1797 (JSC::JSNonFinalObject::finishCreation):
1798 (JSFinalObject):
1799 (JSC::JSFinalObject::finishCreation):
1800 (JSC::JSFinalObject::JSFinalObject):
1801 (JSC::JSObject::offsetOfOutOfLineStorage):
1802 (JSC::JSObject::setOutOfLineStorage):
1803 (JSC::JSObject::JSObject):
1804 (JSC):
1805 (JSC::JSCell::fastGetOwnProperty):
1806 (JSC::JSObject::putDirectInternal):
1807 (JSC::JSObject::setStructureAndReallocateStorageIfNecessary):
1808 (JSC::JSObject::putDirectWithoutTransition):
1809 (JSC::offsetRelativeToPatchedStorage):
1810 (JSC::indexRelativeToBase):
1811 (JSC::offsetRelativeToBase):
1812 * runtime/JSPropertyNameIterator.cpp:
1813 (JSC::JSPropertyNameIterator::create):
1814 * runtime/JSPropertyNameIterator.h:
1815 (JSPropertyNameIterator):
1816 (JSC::JSPropertyNameIterator::getOffset):
1817 (JSC::JSPropertyNameIterator::finishCreation):
1818 * runtime/JSValue.cpp:
1819 (JSC::JSValue::putToPrimitive):
1820 * runtime/Operations.h:
1821 (JSC::normalizePrototypeChain):
1822 * runtime/Options.cpp:
1823 (JSC):
1824 (JSC::Options::initialize):
1825 * runtime/PropertyMapHashTable.h:
1826 (PropertyMapEntry):
1827 (JSC::PropertyMapEntry::PropertyMapEntry):
1828 (PropertyTable):
1829 (JSC::PropertyTable::PropertyTable):
1830 (JSC::PropertyTable::getDeletedOffset):
1831 (JSC::PropertyTable::addDeletedOffset):
1832 (JSC::PropertyTable::nextOffset):
1833 (JSC):
1834 (JSC::PropertyTable::sizeInMemory):
1835 * runtime/PropertyOffset.h: Added.
1836 (JSC):
1837 (JSC::checkOffset):
1838 (JSC::validateOffset):
1839 (JSC::isValidOffset):
1840 (JSC::isInlineOffset):
1841 (JSC::isOutOfLineOffset):
1842 (JSC::offsetInInlineStorage):
1843 (JSC::offsetInOutOfLineStorage):
1844 (JSC::offsetInRespectiveStorage):
1845 (JSC::numberOfOutOfLineSlotsForLastOffset):
1846 (JSC::numberOfSlotsForLastOffset):
1847 (JSC::nextPropertyOffsetFor):
1848 (JSC::firstPropertyOffsetFor):
1849 * runtime/PropertySlot.h:
1850 (JSC::PropertySlot::cachedOffset):
1851 (JSC::PropertySlot::setValue):
1852 (JSC::PropertySlot::setCacheableGetterSlot):
1853 (JSC::PropertySlot::clearOffset):
1854 * runtime/PutPropertySlot.h:
1855 (JSC::PutPropertySlot::setExistingProperty):
1856 (JSC::PutPropertySlot::setNewProperty):
1857 (JSC::PutPropertySlot::cachedOffset):
1858 (PutPropertySlot):
1859 * runtime/Structure.cpp:
1860 (JSC::Structure::Structure):
1861 (JSC::Structure::materializePropertyMap):
1862 (JSC::nextOutOfLineStorageCapacity):
1863 (JSC::Structure::growOutOfLineCapacity):
1864 (JSC::Structure::suggestedNewOutOfLineStorageCapacity):
1865 (JSC::Structure::addPropertyTransitionToExistingStructure):
1866 (JSC::Structure::addPropertyTransition):
1867 (JSC::Structure::removePropertyTransition):
1868 (JSC::Structure::flattenDictionaryStructure):
1869 (JSC::Structure::addPropertyWithoutTransition):
1870 (JSC::Structure::removePropertyWithoutTransition):
1871 (JSC::Structure::copyPropertyTableForPinning):
1872 (JSC::Structure::get):
1873 (JSC::Structure::putSpecificValue):
1874 (JSC::Structure::remove):
1875 * runtime/Structure.h:
1876 (Structure):
1877 (JSC::Structure::putWillGrowOutOfLineStorage):
1878 (JSC::Structure::previousID):
1879 (JSC::Structure::outOfLineCapacity):
1880 (JSC::Structure::outOfLineSizeForKnownFinalObject):
1881 (JSC::Structure::outOfLineSizeForKnownNonFinalObject):
1882 (JSC::Structure::outOfLineSize):
1883 (JSC::Structure::hasInlineStorage):
1884 (JSC::Structure::inlineCapacity):
1885 (JSC::Structure::inlineSizeForKnownFinalObject):
1886 (JSC::Structure::inlineSize):
1887 (JSC::Structure::totalStorageSize):
1888 (JSC::Structure::totalStorageCapacity):
1889 (JSC::Structure::firstValidOffset):
1890 (JSC::Structure::lastValidOffset):
1891 (JSC::Structure::isValidOffset):
1892 (JSC::Structure::isEmpty):
1893 (JSC::Structure::transitionCount):
1894 (JSC::Structure::get):
1895
oliver@apple.com5635b542012-07-05 20:36:37 +000018962012-07-05 Oliver Hunt <oliver@apple.com>
1897
1898 JSObjectCallAsFunction should thisConvert the provided thisObject
1899 https://bugs.webkit.org/show_bug.cgi?id=90628
1900
1901 Reviewed by Gavin Barraclough.
1902
1903 Perform this conversion on the provided this object.
1904
1905 * API/JSObjectRef.cpp:
1906 (JSObjectCallAsFunction):
1907
zherczeg@webkit.orgd6e661f2012-07-05 07:04:16 +000019082012-07-05 Zoltan Herczeg <zherczeg@webkit.org>
1909
zherczeg@webkit.orgda8c37d2012-07-05 07:53:51 +00001910 [Qt] Unreviewed buildfix after r121886. Typo fix.
1911
1912 * assembler/MacroAssemblerARM.cpp:
1913 (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords):
1914
19152012-07-05 Zoltan Herczeg <zherczeg@webkit.org>
1916
zherczeg@webkit.orgd6e661f2012-07-05 07:04:16 +00001917 Port DFG JIT to traditional ARM
1918 https://bugs.webkit.org/show_bug.cgi?id=90198
1919
1920 Reviewed by Filip Pizlo.
1921
1922 This patch contains the macro assembler part of the
1923 DFG JIT support on ARM systems with fixed 32 bit instruction
1924 width. A large amount of old code was refactored, and the ARMv4
1925 or lower support is removed from the macro assembler.
1926
1927 Sunspider is improved by 8%, and V8 is 92%.
1928
1929 * assembler/ARMAssembler.cpp:
1930 (JSC::ARMAssembler::dataTransfer32):
1931 (JSC::ARMAssembler::baseIndexTransfer32):
1932 (JSC):
1933 (JSC::ARMAssembler::dataTransfer16):
1934 (JSC::ARMAssembler::baseIndexTransfer16):
1935 (JSC::ARMAssembler::dataTransferFloat):
1936 (JSC::ARMAssembler::baseIndexTransferFloat):
1937 (JSC::ARMAssembler::executableCopy):
1938 * assembler/ARMAssembler.h:
1939 (JSC::ARMAssembler::ARMAssembler):
1940 (JSC::ARMAssembler::emitInst):
1941 (JSC::ARMAssembler::vmov_f64_r):
1942 (ARMAssembler):
1943 (JSC::ARMAssembler::vabs_f64_r):
1944 (JSC::ARMAssembler::vneg_f64_r):
1945 (JSC::ARMAssembler::ldr_imm):
1946 (JSC::ARMAssembler::ldr_un_imm):
1947 (JSC::ARMAssembler::dtr_u):
1948 (JSC::ARMAssembler::dtr_ur):
1949 (JSC::ARMAssembler::dtr_d):
1950 (JSC::ARMAssembler::dtr_dr):
1951 (JSC::ARMAssembler::dtrh_u):
1952 (JSC::ARMAssembler::dtrh_ur):
1953 (JSC::ARMAssembler::dtrh_d):
1954 (JSC::ARMAssembler::dtrh_dr):
1955 (JSC::ARMAssembler::fdtr_u):
1956 (JSC::ARMAssembler::fdtr_d):
1957 (JSC::ARMAssembler::push_r):
1958 (JSC::ARMAssembler::pop_r):
1959 (JSC::ARMAssembler::poke_r):
1960 (JSC::ARMAssembler::peek_r):
1961 (JSC::ARMAssembler::vmov_vfp64_r):
1962 (JSC::ARMAssembler::vmov_arm64_r):
1963 (JSC::ARMAssembler::vmov_vfp32_r):
1964 (JSC::ARMAssembler::vmov_arm32_r):
1965 (JSC::ARMAssembler::vcvt_u32_f64_r):
1966 (JSC::ARMAssembler::vcvt_f64_f32_r):
1967 (JSC::ARMAssembler::vcvt_f32_f64_r):
1968 (JSC::ARMAssembler::clz_r):
1969 (JSC::ARMAssembler::bkpt):
1970 (JSC::ARMAssembler::bx):
1971 (JSC::ARMAssembler::blx):
1972 (JSC::ARMAssembler::labelIgnoringWatchpoints):
1973 (JSC::ARMAssembler::labelForWatchpoint):
1974 (JSC::ARMAssembler::label):
1975 (JSC::ARMAssembler::getLdrImmAddress):
1976 (JSC::ARMAssembler::replaceWithJump):
1977 (JSC::ARMAssembler::maxJumpReplacementSize):
1978 (JSC::ARMAssembler::getOp2Byte):
1979 (JSC::ARMAssembler::getOp2Half):
1980 (JSC::ARMAssembler::RM):
1981 (JSC::ARMAssembler::RS):
1982 (JSC::ARMAssembler::RD):
1983 (JSC::ARMAssembler::RN):
1984 * assembler/AssemblerBufferWithConstantPool.h:
1985 (JSC::AssemblerBufferWithConstantPool::ensureSpaceForAnyInstruction):
1986 * assembler/MacroAssemblerARM.cpp:
1987 (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords):
1988 * assembler/MacroAssemblerARM.h:
1989 (JSC::MacroAssemblerARM::add32):
1990 (MacroAssemblerARM):
1991 (JSC::MacroAssemblerARM::and32):
1992 (JSC::MacroAssemblerARM::lshift32):
1993 (JSC::MacroAssemblerARM::mul32):
1994 (JSC::MacroAssemblerARM::neg32):
1995 (JSC::MacroAssemblerARM::rshift32):
1996 (JSC::MacroAssemblerARM::urshift32):
1997 (JSC::MacroAssemblerARM::xor32):
1998 (JSC::MacroAssemblerARM::load8):
1999 (JSC::MacroAssemblerARM::load8Signed):
2000 (JSC::MacroAssemblerARM::load16):
2001 (JSC::MacroAssemblerARM::load16Signed):
2002 (JSC::MacroAssemblerARM::load32):
2003 (JSC::MacroAssemblerARM::load32WithAddressOffsetPatch):
2004 (JSC::MacroAssemblerARM::store32WithAddressOffsetPatch):
2005 (JSC::MacroAssemblerARM::store8):
2006 (JSC::MacroAssemblerARM::store16):
2007 (JSC::MacroAssemblerARM::store32):
2008 (JSC::MacroAssemblerARM::move):
2009 (JSC::MacroAssemblerARM::jump):
2010 (JSC::MacroAssemblerARM::branchAdd32):
2011 (JSC::MacroAssemblerARM::mull32):
2012 (JSC::MacroAssemblerARM::branchMul32):
2013 (JSC::MacroAssemblerARM::nearCall):
2014 (JSC::MacroAssemblerARM::compare32):
2015 (JSC::MacroAssemblerARM::test32):
2016 (JSC::MacroAssemblerARM::sub32):
2017 (JSC::MacroAssemblerARM::call):
2018 (JSC::MacroAssemblerARM::loadFloat):
2019 (JSC::MacroAssemblerARM::loadDouble):
2020 (JSC::MacroAssemblerARM::storeFloat):
2021 (JSC::MacroAssemblerARM::storeDouble):
2022 (JSC::MacroAssemblerARM::moveDouble):
2023 (JSC::MacroAssemblerARM::addDouble):
2024 (JSC::MacroAssemblerARM::divDouble):
2025 (JSC::MacroAssemblerARM::subDouble):
2026 (JSC::MacroAssemblerARM::mulDouble):
2027 (JSC::MacroAssemblerARM::absDouble):
2028 (JSC::MacroAssemblerARM::negateDouble):
2029 (JSC::MacroAssemblerARM::convertInt32ToDouble):
2030 (JSC::MacroAssemblerARM::convertFloatToDouble):
2031 (JSC::MacroAssemblerARM::convertDoubleToFloat):
2032 (JSC::MacroAssemblerARM::branchTruncateDoubleToInt32):
2033 (JSC::MacroAssemblerARM::branchTruncateDoubleToUint32):
2034 (JSC::MacroAssemblerARM::truncateDoubleToInt32):
2035 (JSC::MacroAssemblerARM::truncateDoubleToUint32):
2036 (JSC::MacroAssemblerARM::branchConvertDoubleToInt32):
2037 (JSC::MacroAssemblerARM::branchDoubleNonZero):
2038 (JSC::MacroAssemblerARM::branchDoubleZeroOrNaN):
2039 (JSC::MacroAssemblerARM::invert):
2040 (JSC::MacroAssemblerARM::replaceWithJump):
2041 (JSC::MacroAssemblerARM::maxJumpReplacementSize):
2042 (JSC::MacroAssemblerARM::call32):
2043 * assembler/SH4Assembler.h:
2044 (JSC::SH4Assembler::label):
2045 * dfg/DFGAssemblyHelpers.h:
2046 (JSC::DFG::AssemblyHelpers::debugCall):
2047 (JSC::DFG::AssemblyHelpers::boxDouble):
2048 (JSC::DFG::AssemblyHelpers::unboxDouble):
2049 * dfg/DFGCCallHelpers.h:
2050 (CCallHelpers):
2051 (JSC::DFG::CCallHelpers::setupArguments):
2052 * dfg/DFGFPRInfo.h:
2053 (DFG):
2054 * dfg/DFGGPRInfo.h:
2055 (DFG):
2056 (GPRInfo):
2057 * dfg/DFGOperations.cpp:
2058 (JSC):
2059 * dfg/DFGSpeculativeJIT.h:
2060 (SpeculativeJIT):
2061 (JSC::DFG::SpeculativeJIT::appendCallWithExceptionCheckSetResult):
2062 (JSC::DFG::SpeculativeJIT::appendCallSetResult):
2063 * jit/JITStubs.cpp:
2064 (JSC):
2065 * jit/JITStubs.h:
2066 (JITStackFrame):
2067 * jit/JSInterfaceJIT.h:
2068 (JSInterfaceJIT):
2069
commit-queue@webkit.orgd106bf22012-07-04 21:36:52 +000020702012-07-04 Anthony Scian <ascian@rim.com>
2071
2072 Web Inspector [JSC]: Implement ScriptCallStack::stackTrace
2073 https://bugs.webkit.org/show_bug.cgi?id=40118
2074
2075 Reviewed by Yong Li.
2076
2077 Added member functions to expose function name, urlString, and line #.
2078 Refactored toString to make use of these member functions to reduce
2079 duplicated code for future maintenance.
2080
2081 Manually tested refactoring of toString by tracing thrown exceptions.
2082
2083 * interpreter/Interpreter.h:
2084 (JSC::StackFrame::toString):
2085 (JSC::StackFrame::friendlySourceURL):
2086 (JSC::StackFrame::friendlyFunctionName):
2087 (JSC::StackFrame::friendlyLineNumber):
2088
wingo@igalia.com17649d82012-07-04 20:32:26 +000020892012-07-04 Andy Wingo <wingo@igalia.com>
2090
2091 [GTK] Enable parallel GC
2092 https://bugs.webkit.org/show_bug.cgi?id=90568
2093
2094 Reviewed by Martin Robinson.
2095
2096 * runtime/Options.cpp: Include <algorithm.h> for std::min.
2097
commit-queue@webkit.org1fcb31a2012-07-04 16:16:01 +000020982012-07-04 John Mellor <johnme@chromium.org>
2099
2100 Text Autosizing: Add compile flag and runtime setting
2101 https://bugs.webkit.org/show_bug.cgi?id=87394
2102
2103 This patch renames Font Boosting to Text Autosizing.
2104
2105 Reviewed by Adam Barth.
2106
2107 * Configurations/FeatureDefines.xcconfig:
2108
msaboff@apple.comd08f3502012-07-03 22:57:00 +000021092012-07-03 Michael Saboff <msaboff@apple.com>
2110
2111 Enh: Hash Const JSString in Backing Stores to Save Memory
2112 https://bugs.webkit.org/show_bug.cgi?id=86024
2113
2114 Reviewed by Oliver Hunt.
2115
2116 During garbage collection, each marking thread keeps a HashMap of
2117 strings. While visiting via MarkStack::copyAndAppend(), we check to
2118 see if the string we are visiting is already in the HashMap. If not
2119 we add it. If so, we change the reference to the current string we're
2120 visiting to the prior string.
2121
2122 To reduce the performance impact of this change, two throttles have
2123 ben added. 1) We only try hash consting if a significant number of new
2124 strings have been created since the last hash const. Currently this is
2125 set at 100 strings. 2) If a string is unique at the end of a marking
2126 it will not be checked during further GC phases. In some cases this
2127 won't catch all duplicates, but we are trying to catch the growth of
2128 duplicate strings.
2129
2130 * heap/Heap.cpp:
2131 (JSC::Heap::markRoots):
2132 * heap/MarkStack.cpp:
2133 (JSC::MarkStackThreadSharedData::resetChildren):
2134 (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData):
2135 (JSC::MarkStackThreadSharedData::reset):
2136 (JSC::MarkStack::setup): Check to see if enough strings have been created
2137 to hash const.
2138 (JSC::MarkStack::reset): Added call to clear m_uniqueStrings.
2139 (JSC::JSString::tryHashConstLock): New method to lock JSString for
2140 hash consting.
2141 (JSC::JSString::releaseHashConstLock): New unlock method.
2142 (JSC::JSString::shouldTryHashConst): Set of checks to see if we should
2143 try to hash const the string.
2144 (JSC::MarkStack::internalAppend): New method that performs the hash consting.
2145 (JSC::SlotVisitor::copyAndAppend): Changed to call the new hash
2146 consting internalAppend().
2147 * heap/MarkStack.h:
2148 (MarkStackThreadSharedData):
2149 (MarkStack):
2150 * runtime/JSGlobalData.cpp:
2151 (JSC::JSGlobalData::JSGlobalData):
2152 * runtime/JSGlobalData.h:
2153 (JSGlobalData):
2154 (JSC::JSGlobalData::haveEnoughNewStringsToHashConst):
2155 (JSC::JSGlobalData::resetNewStringsSinceLastHashConst):
2156 * runtime/JSString.h:
2157 (JSString): Changed from using bool flags to using an unsigned
2158 m_flags field. This works better with the weakCompareAndSwap in
2159 JSString::tryHashConstLock(). Changed the 8bitness setting and
2160 checking to use new accessors.
2161 (JSC::JSString::JSString):
2162 (JSC::JSString::finishCreation):
2163 (JSC::JSString::is8Bit): Updated for new m_flags.
2164 (JSC::JSString::setIs8Bit): New setter.
2165 New hash const flags accessors:
2166 (JSC::JSString::isHashConstSingleton):
2167 (JSC::JSString::clearHashConstSingleton):
2168 (JSC::JSString::setHashConstSingleton):
2169 (JSC::JSRopeString::finishCreation):
2170 (JSC::JSRopeString::append):
2171
tony@chromium.orga47ad862012-07-03 20:26:08 +000021722012-07-03 Tony Chang <tony@chromium.org>
2173
2174 [chromium] Unreviewed, update .gitignore to handle VS2010 files.
2175
2176 * JavaScriptCore.gyp/.gitignore:
2177
commit-queue@webkit.orgfbda60c2012-07-03 19:19:22 +000021782012-07-03 Mark Lam <mark.lam@apple.com>
2179
2180 Add ability to symbolically set and dump JSC VM options.
2181 See comments in runtime/Options.h for details on how the options work.
2182 https://bugs.webkit.org/show_bug.cgi?id=90420
2183
2184 Reviewed by Filip Pizlo.
2185
2186 * assembler/LinkBuffer.cpp:
2187 (JSC::LinkBuffer::finalizeCodeWithDisassembly):
2188 * assembler/LinkBuffer.h:
2189 (JSC):
2190 * bytecode/CodeBlock.cpp:
2191 (JSC::CodeBlock::shouldOptimizeNow):
2192 * bytecode/CodeBlock.h:
2193 (JSC::CodeBlock::likelyToTakeSlowCase):
2194 (JSC::CodeBlock::couldTakeSlowCase):
2195 (JSC::CodeBlock::likelyToTakeSpecialFastCase):
2196 (JSC::CodeBlock::likelyToTakeDeepestSlowCase):
2197 (JSC::CodeBlock::likelyToTakeAnySlowCase):
2198 (JSC::CodeBlock::jitAfterWarmUp):
2199 (JSC::CodeBlock::jitSoon):
2200 (JSC::CodeBlock::reoptimizationRetryCounter):
2201 (JSC::CodeBlock::countReoptimization):
2202 (JSC::CodeBlock::counterValueForOptimizeAfterWarmUp):
2203 (JSC::CodeBlock::counterValueForOptimizeAfterLongWarmUp):
2204 (JSC::CodeBlock::optimizeSoon):
2205 (JSC::CodeBlock::exitCountThresholdForReoptimization):
2206 (JSC::CodeBlock::exitCountThresholdForReoptimizationFromLoop):
2207 * bytecode/ExecutionCounter.h:
2208 (JSC::ExecutionCounter::clippedThreshold):
2209 * dfg/DFGByteCodeParser.cpp:
2210 (JSC::DFG::ByteCodeParser::handleInlining):
2211 * dfg/DFGCapabilities.h:
2212 (JSC::DFG::mightCompileEval):
2213 (JSC::DFG::mightCompileProgram):
2214 (JSC::DFG::mightCompileFunctionForCall):
2215 (JSC::DFG::mightCompileFunctionForConstruct):
2216 (JSC::DFG::mightInlineFunctionForCall):
2217 (JSC::DFG::mightInlineFunctionForConstruct):
2218 * dfg/DFGCommon.h:
2219 (JSC::DFG::shouldShowDisassembly):
2220 * dfg/DFGDriver.cpp:
2221 (JSC::DFG::compile):
2222 * dfg/DFGOSRExit.cpp:
2223 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
2224 * dfg/DFGVariableAccessData.h:
2225 (JSC::DFG::VariableAccessData::shouldUseDoubleFormatAccordingToVote):
2226 * heap/MarkStack.cpp:
2227 (JSC::MarkStackSegmentAllocator::allocate):
2228 (JSC::MarkStackSegmentAllocator::shrinkReserve):
2229 (JSC::MarkStackArray::MarkStackArray):
2230 (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData):
2231 (JSC::SlotVisitor::donateKnownParallel):
2232 (JSC::SlotVisitor::drain):
2233 (JSC::SlotVisitor::drainFromShared):
2234 * heap/MarkStack.h:
2235 (JSC::MarkStack::mergeOpaqueRootsIfProfitable):
2236 (JSC::MarkStack::addOpaqueRoot):
2237 * heap/SlotVisitor.h:
2238 (JSC::SlotVisitor::donate):
2239 * jit/JIT.cpp:
2240 (JSC::JIT::emitOptimizationCheck):
2241 * jsc.cpp:
2242 (printUsageStatement):
2243 (parseArguments):
2244 * runtime/InitializeThreading.cpp:
2245 (JSC::initializeThreadingOnce):
2246 * runtime/JSGlobalData.cpp:
2247 (JSC::enableAssembler):
2248 * runtime/JSGlobalObject.cpp:
2249 (JSC::JSGlobalObject::JSGlobalObject):
2250 * runtime/Options.cpp:
2251 (JSC):
2252 (JSC::overrideOptionWithHeuristic):
2253 (JSC::Options::initialize):
2254 (JSC::Options::setOption):
2255 (JSC::Options::dumpAllOptions):
2256 (JSC::Options::dumpOption):
2257 * runtime/Options.h:
2258 (JSC):
2259 (Options):
2260 (EntryInfo):
2261
commit-queue@webkit.org337179a2012-07-03 13:43:13 +000022622012-07-03 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> Joel Dillon <joel.dillon@codethink.co.uk>
2263
2264 [Qt][Win] Fix broken QtWebKit5.lib linking
2265 https://bugs.webkit.org/show_bug.cgi?id=88321
2266
2267 Reviewed by Kenneth Rohde Christiansen.
2268
2269 The goal is to have different ports build systems define STATICALLY_LINKED_WITH_WTF
2270 when building JavaScriptCore, if both are packaged in the same DLL, instead
2271 of relying on the code to handle this.
2272 The effects of BUILDING_* and STATICALLY_LINKED_WITH_* are currently the same
2273 except for a check in Source/JavaScriptCore/config.h.
2274
2275 Keeping the old way for the WX port as requested by the port's contributors.
2276 For non-Windows ports there is no difference between IMPORT and EXPORT, no
2277 change is needed.
2278
2279 * API/JSBase.h:
2280 JS symbols shouldn't be included by WTF objects anymore. Remove the export when BUILDING_WTF.
2281 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
2282 Make sure that JavaScriptCore uses import symbols of WTF for the Win port.
2283 * runtime/JSExportMacros.h:
2284
fpizlo@apple.comaedde2e2012-07-03 00:10:08 +000022852012-07-02 Filip Pizlo <fpizlo@apple.com>
2286
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +00002287 DFG OSR exit value recoveries should be computed lazily
2288 https://bugs.webkit.org/show_bug.cgi?id=82155
2289
2290 Reviewed by Gavin Barraclough.
2291
2292 This change aims to reduce one aspect of DFG compile times: the fact
2293 that we currently compute the value recoveries for each local and
2294 argument on every speculation check. We compile many speculation checks,
2295 so this can add up quick. The strategy that this change takes is to
2296 have the DFG save just enough information about how the compiler is
2297 choosing to represent state, that the DFG::OSRExitCompiler can reify
2298 the value recoveries lazily.
2299
2300 This appears to be an 0.3% SunSpider speed-up and is neutral elsewhere.
2301
2302 I also took the opportunity to fix the sampling regions profiler (it
2303 was missing an export macro) and to put in more sampling regions in
2304 the DFG (which are disabled so long as ENABLE(SAMPLING_REGIONS) is
2305 false).
2306
2307 * CMakeLists.txt:
2308 * GNUmakefile.list.am:
2309 * JavaScriptCore.xcodeproj/project.pbxproj:
2310 * Target.pri:
2311 * bytecode/CodeBlock.cpp:
2312 (JSC):
2313 (JSC::CodeBlock::shrinkDFGDataToFit):
2314 * bytecode/CodeBlock.h:
2315 (CodeBlock):
2316 (JSC::CodeBlock::minifiedDFG):
2317 (JSC::CodeBlock::variableEventStream):
2318 (DFGData):
2319 * bytecode/Operands.h:
2320 (JSC::Operands::hasOperand):
2321 (Operands):
2322 (JSC::Operands::size):
2323 (JSC::Operands::at):
2324 (JSC::Operands::operator[]):
2325 (JSC::Operands::isArgument):
2326 (JSC::Operands::isVariable):
2327 (JSC::Operands::argumentForIndex):
2328 (JSC::Operands::variableForIndex):
2329 (JSC::Operands::operandForIndex):
2330 (JSC):
2331 (JSC::dumpOperands):
2332 * bytecode/SamplingTool.h:
2333 (SamplingRegion):
2334 * dfg/DFGByteCodeParser.cpp:
2335 (JSC::DFG::parse):
2336 * dfg/DFGCFAPhase.cpp:
2337 (JSC::DFG::performCFA):
2338 * dfg/DFGCSEPhase.cpp:
2339 (JSC::DFG::performCSE):
2340 * dfg/DFGFixupPhase.cpp:
2341 (JSC::DFG::performFixup):
2342 * dfg/DFGGenerationInfo.h:
2343 (JSC::DFG::GenerationInfo::GenerationInfo):
2344 (JSC::DFG::GenerationInfo::initConstant):
2345 (JSC::DFG::GenerationInfo::initInteger):
2346 (JSC::DFG::GenerationInfo::initJSValue):
2347 (JSC::DFG::GenerationInfo::initCell):
2348 (JSC::DFG::GenerationInfo::initBoolean):
2349 (JSC::DFG::GenerationInfo::initDouble):
2350 (JSC::DFG::GenerationInfo::initStorage):
2351 (GenerationInfo):
2352 (JSC::DFG::GenerationInfo::noticeOSRBirth):
2353 (JSC::DFG::GenerationInfo::use):
2354 (JSC::DFG::GenerationInfo::spill):
2355 (JSC::DFG::GenerationInfo::setSpilled):
2356 (JSC::DFG::GenerationInfo::fillJSValue):
2357 (JSC::DFG::GenerationInfo::fillCell):
2358 (JSC::DFG::GenerationInfo::fillInteger):
2359 (JSC::DFG::GenerationInfo::fillBoolean):
2360 (JSC::DFG::GenerationInfo::fillDouble):
2361 (JSC::DFG::GenerationInfo::fillStorage):
2362 (JSC::DFG::GenerationInfo::appendFill):
2363 (JSC::DFG::GenerationInfo::appendSpill):
2364 * dfg/DFGJITCompiler.cpp:
2365 (JSC::DFG::JITCompiler::link):
2366 (JSC::DFG::JITCompiler::compile):
2367 (JSC::DFG::JITCompiler::compileFunction):
2368 * dfg/DFGMinifiedGraph.h: Added.
2369 (DFG):
2370 (MinifiedGraph):
2371 (JSC::DFG::MinifiedGraph::MinifiedGraph):
2372 (JSC::DFG::MinifiedGraph::at):
2373 (JSC::DFG::MinifiedGraph::append):
2374 (JSC::DFG::MinifiedGraph::prepareAndShrink):
2375 (JSC::DFG::MinifiedGraph::setOriginalGraphSize):
2376 (JSC::DFG::MinifiedGraph::originalGraphSize):
2377 * dfg/DFGMinifiedNode.cpp: Added.
2378 (DFG):
2379 (JSC::DFG::MinifiedNode::fromNode):
2380 * dfg/DFGMinifiedNode.h: Added.
2381 (DFG):
2382 (JSC::DFG::belongsInMinifiedGraph):
2383 (MinifiedNode):
2384 (JSC::DFG::MinifiedNode::MinifiedNode):
2385 (JSC::DFG::MinifiedNode::index):
2386 (JSC::DFG::MinifiedNode::op):
2387 (JSC::DFG::MinifiedNode::hasChild1):
2388 (JSC::DFG::MinifiedNode::child1):
2389 (JSC::DFG::MinifiedNode::hasConstant):
2390 (JSC::DFG::MinifiedNode::hasConstantNumber):
2391 (JSC::DFG::MinifiedNode::constantNumber):
2392 (JSC::DFG::MinifiedNode::hasWeakConstant):
2393 (JSC::DFG::MinifiedNode::weakConstant):
2394 (JSC::DFG::MinifiedNode::getIndex):
2395 (JSC::DFG::MinifiedNode::compareByNodeIndex):
2396 (JSC::DFG::MinifiedNode::hasChild):
2397 * dfg/DFGNode.h:
2398 (Node):
2399 * dfg/DFGOSRExit.cpp:
2400 (JSC::DFG::OSRExit::OSRExit):
2401 * dfg/DFGOSRExit.h:
2402 (OSRExit):
2403 * dfg/DFGOSRExitCompiler.cpp:
2404 * dfg/DFGOSRExitCompiler.h:
2405 (OSRExitCompiler):
2406 * dfg/DFGOSRExitCompiler32_64.cpp:
2407 (JSC::DFG::OSRExitCompiler::compileExit):
2408 * dfg/DFGOSRExitCompiler64.cpp:
2409 (JSC::DFG::OSRExitCompiler::compileExit):
2410 * dfg/DFGPredictionPropagationPhase.cpp:
2411 (JSC::DFG::performPredictionPropagation):
2412 * dfg/DFGRedundantPhiEliminationPhase.cpp:
2413 (JSC::DFG::performRedundantPhiElimination):
2414 * dfg/DFGSpeculativeJIT.cpp:
2415 (JSC::DFG::SpeculativeJIT::SpeculativeJIT):
2416 (DFG):
2417 (JSC::DFG::SpeculativeJIT::fillStorage):
2418 (JSC::DFG::SpeculativeJIT::noticeOSRBirth):
2419 (JSC::DFG::SpeculativeJIT::compileMovHint):
2420 (JSC::DFG::SpeculativeJIT::compile):
2421 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
2422 * dfg/DFGSpeculativeJIT.h:
2423 (DFG):
2424 (JSC::DFG::SpeculativeJIT::use):
2425 (SpeculativeJIT):
2426 (JSC::DFG::SpeculativeJIT::spill):
2427 (JSC::DFG::SpeculativeJIT::speculationCheck):
2428 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
2429 (JSC::DFG::SpeculativeJIT::recordSetLocal):
2430 * dfg/DFGSpeculativeJIT32_64.cpp:
2431 (JSC::DFG::SpeculativeJIT::fillInteger):
2432 (JSC::DFG::SpeculativeJIT::fillDouble):
2433 (JSC::DFG::SpeculativeJIT::fillJSValue):
2434 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
2435 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
2436 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
2437 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
2438 (JSC::DFG::SpeculativeJIT::compile):
2439 * dfg/DFGSpeculativeJIT64.cpp:
2440 (JSC::DFG::SpeculativeJIT::fillInteger):
2441 (JSC::DFG::SpeculativeJIT::fillDouble):
2442 (JSC::DFG::SpeculativeJIT::fillJSValue):
2443 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
2444 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
2445 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
2446 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
2447 (JSC::DFG::SpeculativeJIT::compile):
2448 * dfg/DFGValueRecoveryOverride.h: Added.
2449 (DFG):
2450 (ValueRecoveryOverride):
2451 (JSC::DFG::ValueRecoveryOverride::ValueRecoveryOverride):
2452 * dfg/DFGValueSource.cpp: Added.
2453 (DFG):
2454 (JSC::DFG::ValueSource::dump):
2455 * dfg/DFGValueSource.h: Added.
2456 (DFG):
2457 (JSC::DFG::dataFormatToValueSourceKind):
2458 (JSC::DFG::valueSourceKindToDataFormat):
2459 (JSC::DFG::isInRegisterFile):
2460 (ValueSource):
2461 (JSC::DFG::ValueSource::ValueSource):
2462 (JSC::DFG::ValueSource::forPrediction):
2463 (JSC::DFG::ValueSource::forDataFormat):
2464 (JSC::DFG::ValueSource::isSet):
2465 (JSC::DFG::ValueSource::kind):
2466 (JSC::DFG::ValueSource::isInRegisterFile):
2467 (JSC::DFG::ValueSource::dataFormat):
2468 (JSC::DFG::ValueSource::valueRecovery):
2469 (JSC::DFG::ValueSource::nodeIndex):
2470 (JSC::DFG::ValueSource::nodeIndexFromKind):
2471 (JSC::DFG::ValueSource::kindFromNodeIndex):
2472 * dfg/DFGVariableEvent.cpp: Added.
2473 (DFG):
2474 (JSC::DFG::VariableEvent::dump):
2475 (JSC::DFG::VariableEvent::dumpFillInfo):
2476 (JSC::DFG::VariableEvent::dumpSpillInfo):
2477 * dfg/DFGVariableEvent.h: Added.
2478 (DFG):
2479 (VariableEvent):
2480 (JSC::DFG::VariableEvent::VariableEvent):
2481 (JSC::DFG::VariableEvent::reset):
2482 (JSC::DFG::VariableEvent::fillGPR):
2483 (JSC::DFG::VariableEvent::fillPair):
2484 (JSC::DFG::VariableEvent::fillFPR):
2485 (JSC::DFG::VariableEvent::spill):
2486 (JSC::DFG::VariableEvent::death):
2487 (JSC::DFG::VariableEvent::setLocal):
2488 (JSC::DFG::VariableEvent::movHint):
2489 (JSC::DFG::VariableEvent::kind):
2490 (JSC::DFG::VariableEvent::nodeIndex):
2491 (JSC::DFG::VariableEvent::dataFormat):
2492 (JSC::DFG::VariableEvent::gpr):
2493 (JSC::DFG::VariableEvent::tagGPR):
2494 (JSC::DFG::VariableEvent::payloadGPR):
2495 (JSC::DFG::VariableEvent::fpr):
2496 (JSC::DFG::VariableEvent::virtualRegister):
2497 (JSC::DFG::VariableEvent::operand):
2498 (JSC::DFG::VariableEvent::variableRepresentation):
2499 * dfg/DFGVariableEventStream.cpp: Added.
2500 (DFG):
2501 (JSC::DFG::VariableEventStream::logEvent):
2502 (MinifiedGenerationInfo):
2503 (JSC::DFG::MinifiedGenerationInfo::MinifiedGenerationInfo):
2504 (JSC::DFG::MinifiedGenerationInfo::update):
2505 (JSC::DFG::VariableEventStream::reconstruct):
2506 * dfg/DFGVariableEventStream.h: Added.
2507 (DFG):
2508 (VariableEventStream):
2509 (JSC::DFG::VariableEventStream::appendAndLog):
2510 * dfg/DFGVirtualRegisterAllocationPhase.cpp:
2511 (JSC::DFG::performVirtualRegisterAllocation):
2512
25132012-07-02 Filip Pizlo <fpizlo@apple.com>
2514
fpizlo@apple.comaedde2e2012-07-03 00:10:08 +00002515 DFG::ArgumentsSimplificationPhase should assert that the PhantomArguments nodes it creates are not shouldGenerate()
2516 https://bugs.webkit.org/show_bug.cgi?id=90407
2517
2518 Reviewed by Mark Hahnenberg.
2519
2520 * dfg/DFGArgumentsSimplificationPhase.cpp:
2521 (JSC::DFG::ArgumentsSimplificationPhase::run):
2522
barraclough@apple.com15ab3352012-07-02 19:25:59 +000025232012-07-02 Gavin Barraclough <barraclough@apple.com>
2524
2525 Array.prototype.pop should throw if property is not configurable
2526 https://bugs.webkit.org/show_bug.cgi?id=75788
2527
2528 Rubber Stamped by Oliver Hunt.
2529
2530 No real bug here any more, but the error we throw sometimes has a misleading message.
2531
2532 * runtime/JSArray.cpp:
2533 (JSC::JSArray::pop):
2534
fpizlo@apple.com3aef57f2012-06-30 19:28:26 +000025352012-06-29 Filip Pizlo <fpizlo@apple.com>
2536
fpizlo@apple.com604d38a2012-07-01 03:54:49 +00002537 JSObject wastes too much memory on unused property slots
2538 https://bugs.webkit.org/show_bug.cgi?id=90255
2539
2540 Reviewed by Mark Hahnenberg.
2541
2542 Rolling back in after applying a simple fix: it appears that
2543 JSObject::setStructureAndReallocateStorageIfNecessary() was allocating more
2544 property storage than necessary. Fixing this appears to resolve the crash.
2545
2546 This does a few things:
2547
2548 - JSNonFinalObject no longer has inline property storage.
2549
2550 - Initial out-of-line property storage size is 4 slots for JSNonFinalObject,
2551 or 2x the inline storage for JSFinalObject.
2552
2553 - Property storage is only reallocated if it needs to be. Previously, we
2554 would reallocate the property storage on any transition where the original
2555 structure said shouldGrowProperyStorage(), but this led to spurious
2556 reallocations when doing transitionless property adds and there are
2557 deleted property slots available. That in turn led to crashes, because we
2558 would switch to out-of-line storage even if the capacity matched the
2559 criteria for inline storage.
2560
2561 - Inline JSFunction allocation is killed off because we don't have a good
2562 way of inlining property storage allocation. This didn't hurt performance.
2563 Killing off code is better than fixing it if that code wasn't doing any
2564 good.
2565
2566 This looks like a 1% progression on V8.
2567
2568 * interpreter/Interpreter.cpp:
2569 (JSC::Interpreter::privateExecute):
2570 * jit/JIT.cpp:
2571 (JSC::JIT::privateCompileSlowCases):
2572 * jit/JIT.h:
2573 * jit/JITInlineMethods.h:
2574 (JSC::JIT::emitAllocateBasicJSObject):
2575 (JSC):
2576 * jit/JITOpcodes.cpp:
2577 (JSC::JIT::emit_op_new_func):
2578 (JSC):
2579 (JSC::JIT::emit_op_new_func_exp):
2580 * runtime/JSFunction.cpp:
2581 (JSC::JSFunction::finishCreation):
2582 * runtime/JSObject.h:
2583 (JSC::JSObject::isUsingInlineStorage):
2584 (JSObject):
2585 (JSC::JSObject::finishCreation):
2586 (JSC):
2587 (JSC::JSNonFinalObject::hasInlineStorage):
2588 (JSNonFinalObject):
2589 (JSC::JSNonFinalObject::JSNonFinalObject):
2590 (JSC::JSNonFinalObject::finishCreation):
2591 (JSC::JSFinalObject::hasInlineStorage):
2592 (JSC::JSFinalObject::finishCreation):
2593 (JSC::JSObject::offsetOfInlineStorage):
2594 (JSC::JSObject::setPropertyStorage):
2595 (JSC::Structure::inlineStorageCapacity):
2596 (JSC::Structure::isUsingInlineStorage):
2597 (JSC::JSObject::putDirectInternal):
2598 (JSC::JSObject::setStructureAndReallocateStorageIfNecessary):
2599 (JSC::JSObject::putDirectWithoutTransition):
2600 * runtime/Structure.cpp:
2601 (JSC::Structure::Structure):
2602 (JSC::nextPropertyStorageCapacity):
2603 (JSC):
2604 (JSC::Structure::growPropertyStorageCapacity):
2605 (JSC::Structure::suggestedNewPropertyStorageSize):
2606 * runtime/Structure.h:
2607 (JSC::Structure::putWillGrowPropertyStorage):
2608 (Structure):
2609
26102012-06-29 Filip Pizlo <fpizlo@apple.com>
2611
fpizlo@apple.com3aef57f2012-06-30 19:28:26 +00002612 Webkit crashes in DFG on Google Docs when creating a new document
2613 https://bugs.webkit.org/show_bug.cgi?id=90209
2614
2615 Reviewed by Gavin Barraclough.
2616
2617 Don't attempt to short-circuit Phantom(GetLocal) if the GetLocal is for a
2618 captured variable.
2619
2620 * dfg/DFGCFGSimplificationPhase.cpp:
2621 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
2622
zandobersek@gmail.com069a2d32012-06-30 12:09:15 +000026232012-06-30 Zan Dobersek <zandobersek@gmail.com>
2624
2625 Unreviewed, rolling out r121605.
2626 http://trac.webkit.org/changeset/121605
2627 https://bugs.webkit.org/show_bug.cgi?id=90336
2628
2629 Changes caused flaky crashes in sputnik/Unicode tests on Apple
2630 WK1 and GTK Linux builders
2631
2632 * interpreter/Interpreter.cpp:
2633 (JSC::Interpreter::privateExecute):
2634 * jit/JIT.cpp:
2635 (JSC::JIT::privateCompileSlowCases):
2636 * jit/JIT.h:
2637 * jit/JITInlineMethods.h:
2638 (JSC::JIT::emitAllocateBasicJSObject):
2639 (JSC::JIT::emitAllocateJSFinalObject):
2640 (JSC):
2641 (JSC::JIT::emitAllocateJSFunction):
2642 * jit/JITOpcodes.cpp:
2643 (JSC::JIT::emit_op_new_func):
2644 (JSC::JIT::emitSlow_op_new_func):
2645 (JSC):
2646 (JSC::JIT::emit_op_new_func_exp):
2647 (JSC::JIT::emitSlow_op_new_func_exp):
2648 * runtime/JSFunction.cpp:
2649 (JSC::JSFunction::finishCreation):
2650 * runtime/JSObject.h:
2651 (JSC::JSObject::isUsingInlineStorage):
2652 (JSObject):
2653 (JSC::JSObject::finishCreation):
2654 (JSC):
2655 (JSNonFinalObject):
2656 (JSC::JSNonFinalObject::JSNonFinalObject):
2657 (JSC::JSNonFinalObject::finishCreation):
2658 (JSFinalObject):
2659 (JSC::JSFinalObject::finishCreation):
2660 (JSC::JSObject::offsetOfInlineStorage):
2661 (JSC::JSObject::setPropertyStorage):
2662 (JSC::Structure::isUsingInlineStorage):
2663 (JSC::JSObject::putDirectInternal):
2664 (JSC::JSObject::putDirectWithoutTransition):
2665 (JSC::JSObject::transitionTo):
2666 * runtime/Structure.cpp:
2667 (JSC::Structure::Structure):
2668 (JSC):
2669 (JSC::Structure::growPropertyStorageCapacity):
2670 (JSC::Structure::suggestedNewPropertyStorageSize):
2671 * runtime/Structure.h:
2672 (JSC::Structure::shouldGrowPropertyStorage):
2673 (JSC::Structure::propertyStorageSize):
2674
mhahnenberg@apple.com3100b432012-06-30 01:14:09 +000026752012-06-29 Mark Hahnenberg <mhahnenberg@apple.com>
2676
2677 Remove warning about protected values when the Heap is being destroyed
2678 https://bugs.webkit.org/show_bug.cgi?id=90302
2679
2680 Reviewed by Geoffrey Garen.
2681
2682 Having to do book-keeping about whether values allocated from a certain
2683 VM are or are not protected makes the JSC API much more difficult to use
2684 correctly. Clients should be able to throw an entire VM away and not have
2685 to worry about unprotecting all of the values that they protected earlier.
2686
2687 * heap/Heap.cpp:
2688 (JSC::Heap::lastChanceToFinalize):
2689
fpizlo@apple.com9243e792012-06-30 00:25:01 +000026902012-06-29 Filip Pizlo <fpizlo@apple.com>
2691
2692 JSObject wastes too much memory on unused property slots
2693 https://bugs.webkit.org/show_bug.cgi?id=90255
2694
2695 Reviewed by Mark Hahnenberg.
2696
2697 This does a few things:
2698
2699 - JSNonFinalObject no longer has inline property storage.
2700
2701 - Initial out-of-line property storage size is 4 slots for JSNonFinalObject,
2702 or 2x the inline storage for JSFinalObject.
2703
2704 - Property storage is only reallocated if it needs to be. Previously, we
2705 would reallocate the property storage on any transition where the original
2706 structure said shouldGrowProperyStorage(), but this led to spurious
2707 reallocations when doing transitionless property adds and there are
2708 deleted property slots available. That in turn led to crashes, because we
2709 would switch to out-of-line storage even if the capacity matched the
2710 criteria for inline storage.
2711
2712 - Inline JSFunction allocation is killed off because we don't have a good
2713 way of inlining property storage allocation. This didn't hurt performance.
2714 Killing off code is better than fixing it if that code wasn't doing any
2715 good.
2716
2717 This looks like a 1% progression on V8.
2718
2719 * interpreter/Interpreter.cpp:
2720 (JSC::Interpreter::privateExecute):
2721 * jit/JIT.cpp:
2722 (JSC::JIT::privateCompileSlowCases):
2723 * jit/JIT.h:
2724 * jit/JITInlineMethods.h:
2725 (JSC::JIT::emitAllocateBasicJSObject):
2726 (JSC):
2727 * jit/JITOpcodes.cpp:
2728 (JSC::JIT::emit_op_new_func):
2729 (JSC):
2730 (JSC::JIT::emit_op_new_func_exp):
2731 * runtime/JSFunction.cpp:
2732 (JSC::JSFunction::finishCreation):
2733 * runtime/JSObject.h:
2734 (JSC::JSObject::isUsingInlineStorage):
2735 (JSObject):
2736 (JSC::JSObject::finishCreation):
2737 (JSC):
2738 (JSC::JSNonFinalObject::hasInlineStorage):
2739 (JSNonFinalObject):
2740 (JSC::JSNonFinalObject::JSNonFinalObject):
2741 (JSC::JSNonFinalObject::finishCreation):
2742 (JSC::JSFinalObject::hasInlineStorage):
2743 (JSC::JSFinalObject::finishCreation):
2744 (JSC::JSObject::offsetOfInlineStorage):
2745 (JSC::JSObject::setPropertyStorage):
2746 (JSC::Structure::inlineStorageCapacity):
2747 (JSC::Structure::isUsingInlineStorage):
2748 (JSC::JSObject::putDirectInternal):
2749 (JSC::JSObject::setStructureAndReallocateStorageIfNecessary):
2750 (JSC::JSObject::putDirectWithoutTransition):
2751 * runtime/Structure.cpp:
2752 (JSC::Structure::Structure):
2753 (JSC::nextPropertyStorageCapacity):
2754 (JSC):
2755 (JSC::Structure::growPropertyStorageCapacity):
2756 (JSC::Structure::suggestedNewPropertyStorageSize):
2757 * runtime/Structure.h:
2758 (JSC::Structure::putWillGrowPropertyStorage):
2759 (Structure):
2760
fpizlo@apple.com48a964b2012-06-29 02:40:14 +000027612012-06-28 Filip Pizlo <fpizlo@apple.com>
2762
2763 DFG recompilation heuristics should be based on count, not rate
2764 https://bugs.webkit.org/show_bug.cgi?id=90146
2765
2766 Reviewed by Oliver Hunt.
2767
2768 This removes a bunch of code that was previously trying to prevent spurious
2769 reoptimizations if a large enough majority of executions of a code block did
2770 not result in OSR exit. It turns out that this code was purely harmful. This
2771 patch removes all of that logic and replaces it with a dead-simple
2772 heuristic: if you exit more than N times (where N is an exponential function
2773 of the number of times the code block has already been recompiled) then we
2774 will recompile.
2775
2776 This appears to be a broad ~1% win on many benchmarks large and small.
2777
2778 * bytecode/CodeBlock.cpp:
2779 (JSC::CodeBlock::CodeBlock):
2780 * bytecode/CodeBlock.h:
2781 (JSC::CodeBlock::osrExitCounter):
2782 (JSC::CodeBlock::countOSRExit):
2783 (CodeBlock):
2784 (JSC::CodeBlock::addressOfOSRExitCounter):
2785 (JSC::CodeBlock::offsetOfOSRExitCounter):
2786 (JSC::CodeBlock::adjustedExitCountThreshold):
2787 (JSC::CodeBlock::exitCountThresholdForReoptimization):
2788 (JSC::CodeBlock::exitCountThresholdForReoptimizationFromLoop):
2789 (JSC::CodeBlock::shouldReoptimizeNow):
2790 (JSC::CodeBlock::shouldReoptimizeFromLoopNow):
2791 * bytecode/ExecutionCounter.cpp:
2792 (JSC::ExecutionCounter::setThreshold):
2793 * bytecode/ExecutionCounter.h:
2794 (ExecutionCounter):
2795 (JSC::ExecutionCounter::clippedThreshold):
2796 * dfg/DFGJITCompiler.cpp:
2797 (JSC::DFG::JITCompiler::compileBody):
2798 * dfg/DFGOSRExit.cpp:
2799 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
2800 * dfg/DFGOSRExitCompiler.cpp:
2801 (JSC::DFG::OSRExitCompiler::handleExitCounts):
2802 * dfg/DFGOperations.cpp:
2803 * jit/JITStubs.cpp:
2804 (JSC::DEFINE_STUB_FUNCTION):
2805 * runtime/Options.cpp:
2806 (Options):
2807 (JSC::Options::initializeOptions):
2808 * runtime/Options.h:
2809 (Options):
2810
commit-queue@webkit.org97ee82b2012-06-28 23:03:07 +000028112012-06-28 Mark Lam <mark.lam@apple.com>
2812
2813 Adding a commenting utility to record BytecodeGenerator comments
2814 with opcodes that are emitted. Presently, the comments can only
2815 be constant strings. Adding comments for opcodes is optional.
2816 If a comment is added, the comment will be printed following the
2817 opcode when CodeBlock::dump() is called.
2818
2819 This utility is disabled by default, and is only meant for VM
2820 development purposes. It should not be enabled for product builds.
2821
2822 To enable this utility, set ENABLE_BYTECODE_COMMENTS in CodeBlock.h
2823 to 1.
2824
2825 https://bugs.webkit.org/show_bug.cgi?id=90095
2826
2827 Reviewed by Geoffrey Garen.
2828
2829 * GNUmakefile.list.am:
2830 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2831 * JavaScriptCore.xcodeproj/project.pbxproj:
2832 * bytecode/CodeBlock.cpp:
2833 (JSC::CodeBlock::dumpBytecodeCommentAndNewLine): Dumps the comment.
2834 (JSC):
2835 (JSC::CodeBlock::printUnaryOp): Add comment dumps.
2836 (JSC::CodeBlock::printBinaryOp): Add comment dumps.
2837 (JSC::CodeBlock::printConditionalJump): Add comment dumps.
2838 (JSC::CodeBlock::printCallOp): Add comment dumps.
2839 (JSC::CodeBlock::printPutByIdOp): Add comment dumps.
2840 (JSC::CodeBlock::dump): Add comment dumps.
2841 (JSC::CodeBlock::CodeBlock):
2842 (JSC::CodeBlock::commentForBytecodeOffset):
2843 Finds the comment for an opcode if available.
2844 (JSC::CodeBlock::dumpBytecodeComments):
2845 For debugging whether comments are collected.
2846 It is not being called anywhere.
2847 * bytecode/CodeBlock.h:
2848 (CodeBlock):
2849 (JSC::CodeBlock::bytecodeComments):
2850 * bytecode/Comment.h: Added.
2851 (JSC):
2852 (Comment):
2853 * bytecompiler/BytecodeGenerator.cpp:
2854 (JSC::BytecodeGenerator::BytecodeGenerator):
2855 (JSC::BytecodeGenerator::emitOpcode): Calls emitComment().
2856 (JSC):
2857 (JSC::BytecodeGenerator::emitComment): Adds comment to CodeBlock.
2858 (JSC::BytecodeGenerator::prependComment):
2859 Registers a comment for emitComemnt() to use later.
2860 * bytecompiler/BytecodeGenerator.h:
2861 (BytecodeGenerator):
2862 (JSC::BytecodeGenerator::emitComment):
2863 (JSC::BytecodeGenerator::prependComment):
2864 These are inlined versions of these functions that nullify them
2865 when ENABLE_BYTECODE_COMMENTS is 0.
2866 (JSC::BytecodeGenerator::comments):
2867
oliver@apple.com41383bc2012-06-28 20:54:06 +000028682012-06-28 Oliver Hunt <oliver@apple.com>
2869
2870 32bit DFG incorrectly claims an fpr is fillable even if it has not been proven double
2871 https://bugs.webkit.org/show_bug.cgi?id=90127
2872
2873 Reviewed by Filip Pizlo.
2874
2875 The 32-bit version of fillSpeculateDouble doesn't handle Number->fpr loads
2876 correctly. This patch fixes this by killing the fill info in the GenerationInfo
2877 when the spillFormat doesn't guarantee the value is a double.
2878
2879 * dfg/DFGSpeculativeJIT32_64.cpp:
2880 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
2881
tkent@chromium.orgb53db042012-06-28 08:48:20 +000028822012-06-28 Kent Tamura <tkent@chromium.org>
2883
2884 Classify form control states by their owner forms
2885 https://bugs.webkit.org/show_bug.cgi?id=89950
2886
2887 Reviewed by Hajime Morita.
2888
2889 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
2890 Expose WTF::StringBuilder::canShrink()
2891
msaboff@apple.comff141582012-06-28 01:14:20 +000028922012-06-27 Michael Saboff <msaboff@apple.com>
2893
2894 [Win] jscore-tests flakey
2895 https://bugs.webkit.org/show_bug.cgi?id=88118
2896
2897 Reviewed by Jessie Berlin.
2898
2899 jsDriver.pl on windows intermittently doesn't get the returned value from jsc,
2900 instead it gets 126. Added a new option to jsc (-x) which prints the exit
2901 code before exiting. jsDriver.pl uses this option on Windows and parses the
2902 exit code output for the exit code, removing it before comparing the actual
2903 and expected outputs. Filed a follow on "FIXME" defect:
2904 [WIN] Intermittent failure for jsc return value to propagate through jsDriver.pl
2905 https://bugs.webkit.org/show_bug.cgi?id=90119
2906
2907 * jsc.cpp:
2908 (CommandLine::CommandLine):
2909 (CommandLine):
2910 (printUsageStatement):
2911 (parseArguments):
2912 (jscmain):
2913 * tests/mozilla/jsDriver.pl:
2914 (execute_tests):
2915
commit-queue@webkit.orge12e2f32012-06-28 01:09:22 +000029162012-06-27 Sheriff Bot <webkit.review.bot@gmail.com>
2917
2918 Unreviewed, rolling out r121359.
2919 http://trac.webkit.org/changeset/121359
2920 https://bugs.webkit.org/show_bug.cgi?id=90115
2921
2922 Broke many inspector tests (Requested by jpfau on #webkit).
2923
2924 * interpreter/Interpreter.h:
2925 (JSC::StackFrame::toString):
2926
fpizlo@apple.com12c18392012-06-27 23:16:10 +000029272012-06-27 Filip Pizlo <fpizlo@apple.com>
2928
fpizlo@apple.comc01022e2012-06-28 00:49:55 +00002929 Javascript SHA-512 gives wrong hash on second and subsequent runs unless Web Inspector Javascript Debugging is on
2930 https://bugs.webkit.org/show_bug.cgi?id=90053
2931 <rdar://problem/11764613>
2932
2933 Reviewed by Mark Hahnenberg.
2934
2935 The problem is that the code was assuming that the recovery should be Undefined if the source of
2936 the SetLocal was !shouldGenerate(). But that's wrong, since the DFG optimizer may skip around a
2937 UInt32ToNumber node (hence making it !shouldGenerate()) and keep the source of that node alive.
2938 In that case we should base the recovery on the source of the UInt32ToNumber. The logic for this
2939 was already in place but the fast check for !shouldGenerate() broke it.
2940
2941 * dfg/DFGSpeculativeJIT.cpp:
2942 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
2943
29442012-06-27 Filip Pizlo <fpizlo@apple.com>
2945
fpizlo@apple.com12c18392012-06-27 23:16:10 +00002946 DFG disassembly should be easier to read
2947 https://bugs.webkit.org/show_bug.cgi?id=90106
2948
2949 Reviewed by Mark Hahnenberg.
2950
2951 Did a few things:
2952
2953 - Options::showDFGDisassembly now shows OSR exit disassembly as well.
2954
2955 - Phi node dumping doesn't attempt to do line wrapping since it just made the dump harder
2956 to read.
2957
2958 - DFG graph disassembly view shows a few additional node types that turn out to be
2959 essential for understanding OSR exits.
2960
2961 Put together, these changes reinforce the philosophy that anything needed for computing
2962 OSR exit is just as important as the machine code itself. Of course, we still don't take
2963 that philosophy to its full extreme - for example Phantom nodes are not dumped. We may
2964 revisit that in the future.
2965
2966 * assembler/LinkBuffer.cpp:
2967 (JSC::LinkBuffer::finalizeCodeWithDisassembly):
2968 * assembler/LinkBuffer.h:
2969 (JSC):
2970 * dfg/DFGDisassembler.cpp:
2971 (JSC::DFG::Disassembler::dump):
2972 * dfg/DFGGraph.cpp:
2973 (JSC::DFG::Graph::dumpBlockHeader):
2974 * dfg/DFGNode.h:
2975 (JSC::DFG::Node::willHaveCodeGenOrOSR):
2976 * dfg/DFGOSRExitCompiler.cpp:
2977 * jit/JIT.cpp:
2978 (JSC::JIT::privateCompile):
2979
mhahnenberg@apple.come16f8092012-06-27 23:08:26 +000029802012-06-25 Mark Hahnenberg <mhahnenberg@apple.com>
2981
2982 JSLock should be per-JSGlobalData
2983 https://bugs.webkit.org/show_bug.cgi?id=89123
2984
2985 Reviewed by Geoffrey Garen.
2986
2987 * API/APIShims.h:
2988 (APIEntryShimWithoutLock):
2989 (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): Added an extra parameter to the constructor to
2990 determine whether we should ref the JSGlobalData or not. We want to ref all the time except for in the
2991 HeapTimer class because timerDidFire could run after somebody has started to tear down that particular
2992 JSGlobalData, so we wouldn't want to resurrect the ref count of that JSGlobalData from 0 back to 1 after
2993 its destruction has begun.
2994 (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
2995 (JSC::APIEntryShim::APIEntryShim):
2996 (APIEntryShim):
2997 (JSC::APIEntryShim::~APIEntryShim):
2998 (JSC::APIEntryShim::init): Factored out common initialization code for the various APIEntryShim constructors.
2999 Also moved the timeoutChecker stop and start here because we need to start after we've grabbed the API lock
3000 and before we've released it, which can only done in APIEntryShim.
3001 (JSC::APICallbackShim::~APICallbackShim): We no longer need to synchronize here.
3002 * API/JSContextRef.cpp:
3003 (JSGlobalContextCreate):
3004 (JSGlobalContextCreateInGroup):
3005 (JSGlobalContextRelease):
3006 (JSContextCreateBacktrace):
3007 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
3008 * heap/CopiedSpace.cpp:
3009 (JSC::CopiedSpace::tryAllocateSlowCase):
3010 * heap/Heap.cpp:
3011 (JSC::Heap::protect):
3012 (JSC::Heap::unprotect):
3013 (JSC::Heap::collect):
3014 (JSC::Heap::setActivityCallback):
3015 (JSC::Heap::activityCallback):
3016 (JSC::Heap::sweeper):
3017 * heap/Heap.h: Changed m_activityCallback and m_sweeper to be raw pointers rather than OwnPtrs because they
3018 are now responsible for their own lifetime. Also changed the order of declaration of the GCActivityCallback
3019 and the IncrementalSweeper to make sure they're the last things that get initialized during construction to
3020 prevent any issues with uninitialized memory in the JSGlobalData/Heap they might care about.
3021 (Heap):
3022 * heap/HeapTimer.cpp: Refactored to allow for thread-safe operation and shutdown.
3023 (JSC::HeapTimer::~HeapTimer):
3024 (JSC::HeapTimer::invalidate):
3025 (JSC):
3026 (JSC::HeapTimer::didStartVMShutdown): Called at the beginning of ~JSGlobalData. If we're on the same thread
3027 that the HeapTimer is running on, we kill the HeapTimer ourselves. If not, then we set some state in the
3028 HeapTimer and schedule it to fire immediately so that it can notice and kill itself.
3029 (JSC::HeapTimer::timerDidFire): We grab our mutex and check our JSGlobalData pointer. If it has been zero-ed
3030 out, then we know the VM has started to shutdown and we should kill ourselves. Otherwise, grab the APIEntryShim,
3031 but without ref-ing the JSGlobalData (we don't want to bring the JSGlobalData's ref-count from 0 to 1) in case
3032 we were interrupted between releasing our mutex and trying to grab the APILock.
3033 * heap/HeapTimer.h:
3034 (HeapTimer):
3035 * heap/IncrementalSweeper.cpp:
3036 (JSC::IncrementalSweeper::doWork): We no longer need the API shim here since HeapTimer::timerDidFire handles
3037 all of that for us.
3038 (JSC::IncrementalSweeper::create):
3039 * heap/IncrementalSweeper.h:
3040 (IncrementalSweeper):
3041 * heap/MarkedAllocator.cpp:
3042 (JSC::MarkedAllocator::allocateSlowCase):
3043 * heap/WeakBlock.cpp:
3044 (JSC::WeakBlock::reap):
3045 * jsc.cpp:
3046 (functionGC):
3047 (functionReleaseExecutableMemory):
3048 (jscmain):
3049 * runtime/Completion.cpp:
3050 (JSC::checkSyntax):
3051 (JSC::evaluate):
3052 * runtime/GCActivityCallback.h:
3053 (DefaultGCActivityCallback):
3054 (JSC::DefaultGCActivityCallback::create):
3055 * runtime/JSGlobalData.cpp:
3056 (JSC::JSGlobalData::JSGlobalData):
3057 (JSC::JSGlobalData::~JSGlobalData): Signals to the two HeapTimers (GCActivityCallback and IncrementalSweeper)
3058 that the VM has started shutting down. It then waits until the HeapTimer is done with whatever activity
3059 it needs to do before continuing with any further destruction. Also asserts that we do not currently hold the
3060 APILock because this could potentially cause deadlock when we try to signal to the HeapTimers using their mutexes.
3061 (JSC::JSGlobalData::sharedInstance): Protect the initialization for the shared instance with the GlobalJSLock.
3062 (JSC::JSGlobalData::sharedInstanceInternal):
3063 * runtime/JSGlobalData.h: Change to be ThreadSafeRefCounted so that we don't have to worry about refing and
3064 de-refing JSGlobalDatas on separate threads since we don't do it that often anyways.
3065 (JSGlobalData):
3066 (JSC::JSGlobalData::apiLock):
3067 * runtime/JSGlobalObject.cpp:
3068 (JSC::JSGlobalObject::~JSGlobalObject):
3069 (JSC::JSGlobalObject::init):
3070 * runtime/JSLock.cpp:
3071 (JSC):
3072 (JSC::GlobalJSLock::GlobalJSLock): For accessing the shared instance.
3073 (JSC::GlobalJSLock::~GlobalJSLock):
3074 (JSC::JSLockHolder::JSLockHolder): MutexLocker for JSLock. Also refs the JSGlobalData to keep it alive so that
3075 it can successfully unlock it later without it disappearing from underneath it.
3076 (JSC::JSLockHolder::~JSLockHolder):
3077 (JSC::JSLock::JSLock):
3078 (JSC::JSLock::~JSLock):
3079 (JSC::JSLock::lock): Uses the spin lock for guarding the lock count and owner thread fields. Uses the mutex for
3080 actually waiting for long periods.
3081 (JSC::JSLock::unlock):
3082 (JSC::JSLock::currentThreadIsHoldingLock):
3083 (JSC::JSLock::dropAllLocks):
3084 (JSC::JSLock::dropAllLocksUnconditionally):
3085 (JSC::JSLock::grabAllLocks):
3086 (JSC::JSLock::DropAllLocks::DropAllLocks):
3087 (JSC::JSLock::DropAllLocks::~DropAllLocks):
3088 * runtime/JSLock.h:
3089 (JSC):
3090 (GlobalJSLock):
3091 (JSLockHolder):
3092 (JSLock):
3093 (DropAllLocks):
3094 * runtime/WeakGCMap.h:
3095 (JSC::WeakGCMap::set):
3096 * testRegExp.cpp:
3097 (realMain):
3098
fpizlo@apple.coma8de6ba2012-06-27 21:25:23 +000030992012-06-27 Filip Pizlo <fpizlo@apple.com>
3100
fpizlo@apple.com4a4978b2012-06-27 21:45:08 +00003101 x86 disassembler confuses immediates with addresses
3102 https://bugs.webkit.org/show_bug.cgi?id=90099
3103
3104 Reviewed by Mark Hahnenberg.
3105
3106 Prepend "$" to immediates to disambiguate between immediates and addresses. This is in
3107 accordance with the gas and AT&T syntax.
3108
3109 * disassembler/udis86/udis86_syn-att.c:
3110 (gen_operand):
3111
31122012-06-27 Filip Pizlo <fpizlo@apple.com>
3113
fpizlo@apple.coma8de6ba2012-06-27 21:25:23 +00003114 Add a comment clarifying Options::showDisassembly versus Options::showDFGDisassembly.
3115
3116 Rubber stamped by Mark Hahnenberg.
3117
3118 * runtime/Options.cpp:
3119 (JSC::Options::initializeOptions):
3120
commit-queue@webkit.org50c978a2012-06-27 19:54:48 +000031212012-06-27 Anthony Scian <ascian@rim.com>
3122
3123 Web Inspector [JSC]: Implement ScriptCallStack::stackTrace
3124 https://bugs.webkit.org/show_bug.cgi?id=40118
3125
3126 Reviewed by Yong Li.
3127
3128 Added member functions to expose function name, urlString, and line #.
3129 Refactored toString to make use of these member functions to reduce
3130 duplicated code for future maintenance.
3131
3132 Manually tested refactoring of toString by tracing thrown exceptions.
3133
3134 * interpreter/Interpreter.h:
3135 (StackFrame):
3136 (JSC::StackFrame::toString):
3137 (JSC::StackFrame::friendlySourceURL):
3138 (JSC::StackFrame::friendlyFunctionName):
3139 (JSC::StackFrame::friendlyLineNumber):
3140
vestbo@webkit.org36e47da2012-06-27 13:02:03 +000031412012-06-27 Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
3142
3143 [Qt] Remove redundant c++11 warning suppression code
3144
3145 This is already handled in default_post.
3146
3147 Reviewed by Tor Arne Vestbø.
3148
3149 * Target.pri:
3150
vestbo@webkit.orgcaf4d2f2012-06-27 11:30:42 +000031512012-06-26 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
3152
3153 [Qt] Add missing heades to HEADERS
3154
3155 For JavaScriptCore there aren't any Qt specific files, so we include all
3156 headers for easy editing in Qt Creator.
3157
3158 Reviewed by Simon Hausmann.
3159
3160 * Target.pri:
3161
dominicc@chromium.org5940f722012-06-27 09:44:31 +000031622012-06-26 Dominic Cooney <dominicc@chromium.org>
3163
3164 [Chromium] Remove unused build scripts and empty folders for JavaScriptCore w/ gyp
3165 https://bugs.webkit.org/show_bug.cgi?id=90029
3166
3167 Reviewed by Adam Barth.
3168
3169 * gyp: Removed.
3170 * gyp/generate-derived-sources.sh: Removed.
3171 * gyp/generate-dtrace-header.sh: Removed.
3172 * gyp/run-if-exists.sh: Removed.
3173 * gyp/update-info-plist.sh: Removed.
3174
ggaren@apple.com6b348072012-06-27 03:44:05 +000031752012-06-26 Geoffrey Garen <ggaren@apple.com>
3176
3177 Reduced (but did not eliminate) use of "berzerker GC"
3178 https://bugs.webkit.org/show_bug.cgi?id=89237
3179
3180 Reviewed by Gavin Barraclough.
3181
3182 (PART 2)
3183
3184 This part turns off "berzerker GC" and turns on incremental shrinking.
3185
3186 * heap/IncrementalSweeper.cpp:
3187 (JSC::IncrementalSweeper::doSweep): Free or shrink after sweeping to
3188 maintain the behavior we used to get from the occasional berzerker GC,
3189 which would run all finalizers and then free or shrink all blocks
3190 synchronously.
3191
3192 * heap/MarkedBlock.h:
3193 (JSC::MarkedBlock::needsSweeping): Sweep zapped blocks, too. It's always
3194 safe to sweep a zapped block (that's the point of zapping), and it's
3195 sometimes profitable. For example, consider this case: Block A does some
3196 allocation (transitioning Block A from Marked to FreeListed), then GC
3197 happens (transitioning Block A to Zapped), then all objects in Block A
3198 are free, then the incremental sweeper visits Block A. If we skipped
3199 Zapped blocks, we'd skip Block A, even though it would be profitable to
3200 run its destructors and free its memory.
3201
3202 * runtime/GCActivityCallback.cpp:
3203 (JSC::DefaultGCActivityCallback::doWork): Don't sweep eagerly; we'll do
3204 this incrementally.
3205
fpizlo@apple.com580d9d72012-06-27 01:34:01 +000032062012-06-26 Filip Pizlo <fpizlo@apple.com>
3207
3208 DFG PutByValAlias is too aggressive
3209 https://bugs.webkit.org/show_bug.cgi?id=90026
3210 <rdar://problem/11751830>
3211
3212 Reviewed by Gavin Barraclough.
3213
3214 For CSE on normal arrays, we now treat PutByVal as impure. This does not appear to affect
3215 performance by much.
3216
3217 For CSE on typed arrays, we fix PutByValAlias by making GetByVal speculate that the access
3218 is within bounds. This also has the effect of making our out-of-bounds handling consistent
3219 with WebCore.
3220
3221 * dfg/DFGCSEPhase.cpp:
3222 (JSC::DFG::CSEPhase::performNodeCSE):
3223 * dfg/DFGGraph.h:
3224 (JSC::DFG::Graph::byValIsPure):
3225 (JSC::DFG::Graph::clobbersWorld):
3226 * dfg/DFGNodeType.h:
3227 (DFG):
3228 * dfg/DFGSpeculativeJIT.cpp:
3229 (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
3230 (JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
3231
commit-queue@webkit.org63a25eb2012-06-26 19:55:32 +000032322012-06-26 Yong Li <yoli@rim.com>
3233
3234 [BlackBerry] Add JSC statistics into about:memory
3235 https://bugs.webkit.org/show_bug.cgi?id=89779
3236
3237 Reviewed by Rob Buis.
3238
3239 Fix non-JIT build on BlackBerry broken by r121196.
3240
3241 * runtime/MemoryStatistics.cpp:
3242 (JSC::globalMemoryStatistics):
3243
fpizlo@apple.com6c89cd32012-06-26 19:42:05 +000032442012-06-25 Filip Pizlo <fpizlo@apple.com>
3245
3246 DFG::operationNewArray is unnecessarily slow, and may use the wrong array
3247 prototype when inlined
3248 https://bugs.webkit.org/show_bug.cgi?id=89821
3249
3250 Reviewed by Geoffrey Garen.
3251
3252 Fixes all array allocations to use the right structure, and hence the right prototype. Adds
3253 inlining of new Array(...) with a non-zero number of arguments. Optimizes allocations of
3254 empty arrays.
3255
3256 * dfg/DFGAbstractState.cpp:
3257 (JSC::DFG::AbstractState::execute):
3258 * dfg/DFGByteCodeParser.cpp:
3259 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
3260 * dfg/DFGCCallHelpers.h:
3261 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
3262 (CCallHelpers):
3263 * dfg/DFGNodeType.h:
3264 (DFG):
3265 * dfg/DFGOperations.cpp:
3266 * dfg/DFGOperations.h:
3267 * dfg/DFGPredictionPropagationPhase.cpp:
3268 (JSC::DFG::PredictionPropagationPhase::propagate):
3269 * dfg/DFGSpeculativeJIT.h:
3270 (JSC::DFG::SpeculativeJIT::callOperation):
3271 * dfg/DFGSpeculativeJIT32_64.cpp:
3272 (JSC::DFG::SpeculativeJIT::compile):
3273 * dfg/DFGSpeculativeJIT64.cpp:
3274 (JSC::DFG::SpeculativeJIT::compile):
3275 * runtime/JSArray.h:
3276 (JSC):
3277 (JSC::constructArray):
3278 * runtime/JSGlobalObject.h:
3279 (JSC):
3280 (JSC::constructArray):
3281
fpizlo@apple.com0b6ad50752012-06-26 09:22:45 +000032822012-06-26 Filip Pizlo <fpizlo@apple.com>
3283
3284 New fast/js/dfg-store-unexpected-value-into-argument-and-osr-exit.html fails on 32 bit
3285 https://bugs.webkit.org/show_bug.cgi?id=89953
3286
3287 Reviewed by Zoltan Herczeg.
3288
3289 DFG 32-bit JIT was confused about the difference between a predicted type and a
3290 proven type. This is easy to get confused about, since a local that is predicted int32
3291 almost always means that the local must be an int32 since speculations are hoisted to
3292 stores to locals. But that is less likely to be the case for arguments, where there is
3293 an additional least-upper-bounding step: any store to an argument with a weird type
3294 may force the argument to be any type.
3295
3296 This patch basically duplicates the functionality in DFGSpeculativeJIT64.cpp for
3297 GetLocal: the decision of whether to load a local as an int32 (or as an array, or as
3298 a boolean) is made based on the AbstractValue::m_type, which is a type proof, rather
3299 than the VariableAccessData::prediction(), which is a predicted type.
3300
3301 * dfg/DFGSpeculativeJIT32_64.cpp:
3302 (JSC::DFG::SpeculativeJIT::compile):
3303
fpizlo@apple.com41a1f0e2012-06-26 02:53:39 +000033042012-06-25 Filip Pizlo <fpizlo@apple.com>
3305
3306 JSC should try to make profiling deterministic because otherwise reproducing failures is
3307 nearly impossible
3308 https://bugs.webkit.org/show_bug.cgi?id=89940
3309
3310 Rubber stamped by Gavin Barraclough.
3311
3312 This rolls out the part of http://trac.webkit.org/changeset/121215 that introduced randomness
3313 into the system. Now, instead of randomizing the tier-up threshold, we always set it to an
3314 artificially low (and statically predetermined!) value. This gives most of the benefit of
3315 threshold randomization without actually making the system behave completely differently on
3316 each invocation.
3317
3318 * bytecode/ExecutionCounter.cpp:
3319 (JSC::ExecutionCounter::setThreshold):
3320 * runtime/Options.cpp:
3321 (Options):
3322 (JSC::Options::initializeOptions):
3323 * runtime/Options.h:
3324 (Options):
3325
fpizlo@apple.com3745dbc2012-06-26 02:14:07 +000033262012-06-22 Filip Pizlo <fpizlo@apple.com>
3327
3328 Value profiling should use tier-up threshold randomization to get more coverage
3329 https://bugs.webkit.org/show_bug.cgi?id=89802
3330
3331 Reviewed by Gavin Barraclough.
3332
3333 This patch causes both LLInt and Baseline JIT code to take the OSR slow path several
3334 times before actually doing OSR. If we take the OSR slow path before the execution
3335 count threshold is reached, then we just call CodeBlock::updateAllPredictions() to
3336 compute the current latest least-upper-bound SpecType of all values seen in each
3337 ValueProfile.
3338
3339 * bytecode/CodeBlock.cpp:
3340 (JSC::CodeBlock::stronglyVisitStrongReferences):
3341 (JSC::CodeBlock::updateAllPredictionsAndCountLiveness):
3342 (JSC):
3343 (JSC::CodeBlock::updateAllPredictions):
3344 (JSC::CodeBlock::shouldOptimizeNow):
3345 * bytecode/CodeBlock.h:
3346 (JSC::CodeBlock::llintExecuteCounter):
3347 (JSC::CodeBlock::jitExecuteCounter):
3348 (CodeBlock):
3349 (JSC::CodeBlock::updateAllPredictions):
3350 * bytecode/ExecutionCounter.cpp:
3351 (JSC::ExecutionCounter::setThreshold):
3352 (JSC::ExecutionCounter::status):
3353 (JSC):
3354 * bytecode/ExecutionCounter.h:
3355 (JSC::ExecutionCounter::count):
3356 (ExecutionCounter):
3357 * dfg/DFGAbstractState.cpp:
3358 (JSC::DFG::AbstractState::execute):
3359 * dfg/DFGOperations.cpp:
3360 * dfg/DFGSpeculativeJIT.cpp:
3361 (JSC::DFG::SpeculativeJIT::compile):
3362 * jit/JITStubs.cpp:
3363 (JSC::DEFINE_STUB_FUNCTION):
3364 * llint/LLIntSlowPaths.cpp:
3365 (JSC::LLInt::jitCompileAndSetHeuristics):
3366 (JSC::LLInt::entryOSR):
3367 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
3368 * runtime/JSGlobalObject.cpp:
3369 (JSC::JSGlobalObject::JSGlobalObject):
3370 (JSC):
3371 * runtime/JSGlobalObject.h:
3372 (JSGlobalObject):
3373 (JSC::JSGlobalObject::weakRandomInteger):
3374 * runtime/Options.cpp:
3375 (Options):
3376 (JSC::Options::initializeOptions):
3377 * runtime/Options.h:
3378 (Options):
3379 * runtime/WeakRandom.h:
3380 (WeakRandom):
3381 (JSC::WeakRandom::seedUnsafe):
3382
commit-queue@webkit.orgd3790912012-06-26 00:08:19 +000033832012-06-25 Yong Li <yoli@rim.com>
3384
3385 [BlackBerry] Add JSC statistics into about:memory
3386 https://bugs.webkit.org/show_bug.cgi?id=89779
3387
3388 Reviewed by Rob Buis.
3389
3390 Add MemoryStatistics.cpp into build, and fill JITBytes for BlackBerry port.
3391
3392 * PlatformBlackBerry.cmake:
3393 * runtime/MemoryStatistics.cpp:
3394 (JSC::globalMemoryStatistics):
3395
zandobersek@gmail.coma6460e12012-06-23 13:41:40 +000033962012-06-23 Sheriff Bot <webkit.review.bot@gmail.com>
3397
3398 Unreviewed, rolling out r121058.
3399 http://trac.webkit.org/changeset/121058
3400 https://bugs.webkit.org/show_bug.cgi?id=89809
3401
3402 Patch causes plugins tests to crash in GTK debug builds
3403 (Requested by zdobersek on #webkit).
3404
3405 * API/APIShims.h:
3406 (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
3407 (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
3408 (APIEntryShimWithoutLock):
3409 (JSC::APIEntryShim::APIEntryShim):
3410 (APIEntryShim):
3411 (JSC::APICallbackShim::~APICallbackShim):
3412 * API/JSContextRef.cpp:
3413 (JSGlobalContextCreate):
3414 (JSGlobalContextCreateInGroup):
3415 (JSGlobalContextRelease):
3416 (JSContextCreateBacktrace):
3417 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
3418 * heap/CopiedSpace.cpp:
3419 (JSC::CopiedSpace::tryAllocateSlowCase):
3420 * heap/Heap.cpp:
3421 (JSC::Heap::protect):
3422 (JSC::Heap::unprotect):
3423 (JSC::Heap::collect):
3424 (JSC::Heap::setActivityCallback):
3425 (JSC::Heap::activityCallback):
3426 (JSC::Heap::sweeper):
3427 * heap/Heap.h:
3428 (Heap):
3429 * heap/HeapTimer.cpp:
3430 (JSC::HeapTimer::~HeapTimer):
3431 (JSC::HeapTimer::invalidate):
3432 (JSC::HeapTimer::timerDidFire):
3433 (JSC):
3434 * heap/HeapTimer.h:
3435 (HeapTimer):
3436 * heap/IncrementalSweeper.cpp:
3437 (JSC::IncrementalSweeper::doWork):
3438 (JSC::IncrementalSweeper::create):
3439 * heap/IncrementalSweeper.h:
3440 (IncrementalSweeper):
3441 * heap/MarkedAllocator.cpp:
3442 (JSC::MarkedAllocator::allocateSlowCase):
3443 * heap/WeakBlock.cpp:
3444 (JSC::WeakBlock::reap):
3445 * jsc.cpp:
3446 (functionGC):
3447 (functionReleaseExecutableMemory):
3448 (jscmain):
3449 * runtime/Completion.cpp:
3450 (JSC::checkSyntax):
3451 (JSC::evaluate):
3452 * runtime/GCActivityCallback.h:
3453 (DefaultGCActivityCallback):
3454 (JSC::DefaultGCActivityCallback::create):
3455 * runtime/JSGlobalData.cpp:
3456 (JSC::JSGlobalData::JSGlobalData):
3457 (JSC::JSGlobalData::~JSGlobalData):
3458 (JSC::JSGlobalData::sharedInstance):
3459 (JSC::JSGlobalData::sharedInstanceInternal):
3460 * runtime/JSGlobalData.h:
3461 (JSGlobalData):
3462 * runtime/JSGlobalObject.cpp:
3463 (JSC::JSGlobalObject::~JSGlobalObject):
3464 (JSC::JSGlobalObject::init):
3465 * runtime/JSLock.cpp:
3466 (JSC):
3467 (JSC::createJSLockCount):
3468 (JSC::JSLock::lockCount):
3469 (JSC::setLockCount):
3470 (JSC::JSLock::JSLock):
3471 (JSC::JSLock::lock):
3472 (JSC::JSLock::unlock):
3473 (JSC::JSLock::currentThreadIsHoldingLock):
3474 (JSC::JSLock::DropAllLocks::DropAllLocks):
3475 (JSC::JSLock::DropAllLocks::~DropAllLocks):
3476 * runtime/JSLock.h:
3477 (JSC):
3478 (JSLock):
3479 (JSC::JSLock::JSLock):
3480 (JSC::JSLock::~JSLock):
3481 (DropAllLocks):
3482 * runtime/WeakGCMap.h:
3483 (JSC::WeakGCMap::set):
3484 * testRegExp.cpp:
3485 (realMain):
3486
achicu@adobe.comcead7612012-06-23 01:23:48 +000034872012-06-22 Alexandru Chiculita <achicu@adobe.com>
3488
3489 [CSS Shaders] Re-enable the CSS Shaders compile time flag on Safari Mac
3490 https://bugs.webkit.org/show_bug.cgi?id=89781
3491
3492 Reviewed by Dean Jackson.
3493
3494 Added ENABLE_CSS_SHADERS flag as enabled by default on Safari for Mac.
3495
3496 * Configurations/FeatureDefines.xcconfig:
3497
fpizlo@apple.com16e2cbf2012-06-22 23:32:59 +000034982012-06-22 Filip Pizlo <fpizlo@apple.com>
3499
3500 DFG tier-up should happen in prologues, not epilogues
3501 https://bugs.webkit.org/show_bug.cgi?id=89752
3502
3503 Reviewed by Geoffrey Garen.
3504
3505 This change has two outcomes:
3506
3507 1) Slightly reduces the likelihood that a function will be optimized both
3508 standalone and via inlining. Previously, if you had a call sequence like foo()
3509 calls bar() exactly once, and nobody else calls bar(), then bar() would get
3510 optimized first (because it returns first) and then foo() gets optimized. If foo()
3511 can inline bar() then that means that bar() gets optimized twice. But now, if we
3512 optimize in prologues, then foo() will be optimized first. If it inlines bar(),
3513 that means that there will no longer be any calls to bar().
3514
3515 2) It lets us kill some code in JITStubs. Epilogue tier-up was very different from
3516 loop tier-up, since epilogue tier-up should not attempt OSR. But prologue tier-up
3517 requires OSR (albeit really easy OSR since it's the top of the compilation unit),
3518 so it becomes just like loop tier-up. As a result, we now have one optimization
3519 hook (cti_optimize) instead of two (cti_optimize_from_loop and
3520 cti_optimize_from_ret).
3521
3522 As a consequence of not having an optimization check in epilogues, the OSR exit
3523 code must now trigger reoptimization itself instead of just signaling the epilogue
3524 check to fire.
3525
3526 This also adds the ability to count the number of DFG compilations, which was
3527 useful for debugging this patch and might be useful for other things in the future.
3528
3529 * bytecode/CodeBlock.cpp:
3530 (JSC::CodeBlock::reoptimize):
3531 (JSC):
3532 * bytecode/CodeBlock.h:
3533 (CodeBlock):
3534 * dfg/DFGByteCodeParser.cpp:
3535 (JSC::DFG::ByteCodeParser::parseCodeBlock):
3536 * dfg/DFGDriver.cpp:
3537 (DFG):
3538 (JSC::DFG::getNumCompilations):
3539 (JSC::DFG::compile):
3540 * dfg/DFGDriver.h:
3541 (DFG):
3542 * dfg/DFGOSRExitCompiler.cpp:
3543 (JSC::DFG::OSRExitCompiler::handleExitCounts):
3544 * dfg/DFGOperations.cpp:
3545 * dfg/DFGOperations.h:
3546 * jit/JIT.cpp:
3547 (JSC::JIT::emitOptimizationCheck):
3548 * jit/JIT.h:
3549 * jit/JITCall32_64.cpp:
3550 (JSC::JIT::emit_op_ret):
3551 (JSC::JIT::emit_op_ret_object_or_this):
3552 * jit/JITOpcodes.cpp:
3553 (JSC::JIT::emit_op_ret):
3554 (JSC::JIT::emit_op_ret_object_or_this):
3555 (JSC::JIT::emit_op_enter):
3556 * jit/JITOpcodes32_64.cpp:
3557 (JSC::JIT::emit_op_enter):
3558 * jit/JITStubs.cpp:
3559 (JSC::DEFINE_STUB_FUNCTION):
3560 * jit/JITStubs.h:
3561
mhahnenberg@apple.com6d9f86d2012-06-22 21:42:46 +000035622012-06-20 Mark Hahnenberg <mhahnenberg@apple.com>
3563
3564 JSLock should be per-JSGlobalData
3565 https://bugs.webkit.org/show_bug.cgi?id=89123
3566
3567 Reviewed by Gavin Barraclough.
3568
3569 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
3570 * API/APIShims.h:
3571 (APIEntryShimWithoutLock):
3572 (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): Added an extra parameter to the constructor to
3573 determine whether we should ref the JSGlobalData or not. We want to ref all the time except for in the
3574 HeapTimer class because timerDidFire could run after somebody has started to tear down that particular
3575 JSGlobalData, so we wouldn't want to resurrect the ref count of that JSGlobalData from 0 back to 1 after
3576 its destruction has begun.
3577 (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock): Now derefs if it also refed.
3578 (JSC::APIEntryShim::APIEntryShim):
3579 (APIEntryShim):
3580 (JSC::APIEntryShim::~APIEntryShim):
3581 (JSC::APIEntryShim::init): Factored out common initialization code for the various APIEntryShim constructors.
3582 Also moved the timeoutChecker stop and start here because we need to start after we've grabbed the API lock
3583 and before we've released it, which can only done in APIEntryShim.
3584 (JSC::APICallbackShim::~APICallbackShim): We no longer need to synchronize here.
3585 * API/JSContextRef.cpp:
3586 (JSGlobalContextCreate):
3587 (JSGlobalContextCreateInGroup):
3588 (JSGlobalContextRelease):
3589 (JSContextCreateBacktrace):
3590 * heap/CopiedSpace.cpp:
3591 (JSC::CopiedSpace::tryAllocateSlowCase):
3592 * heap/Heap.cpp:
3593 (JSC::Heap::protect):
3594 (JSC::Heap::unprotect):
3595 (JSC::Heap::collect):
3596 (JSC::Heap::setActivityCallback):
3597 (JSC::Heap::activityCallback):
3598 (JSC::Heap::sweeper):
3599 * heap/Heap.h: Changed m_activityCallback and m_sweeper to be raw pointers rather than OwnPtrs because they
3600 are now responsible for their own lifetime. Also changed the order of declaration of the GCActivityCallback
3601 and the IncrementalSweeper to make sure they're the last things that get initialized during construction to
3602 prevent any issues with uninitialized memory in the JSGlobalData/Heap they might care about.
3603 (Heap):
3604 * heap/HeapTimer.cpp: Refactored to allow for thread-safe operation and shutdown.
3605 (JSC::HeapTimer::~HeapTimer):
3606 (JSC::HeapTimer::invalidate):
3607 (JSC):
3608 (JSC::HeapTimer::didStartVMShutdown): Called at the beginning of ~JSGlobalData. If we're on the same thread
3609 that the HeapTimer is running on, we kill the HeapTimer ourselves. If not, then we set some state in the
3610 HeapTimer and schedule it to fire immediately so that it can notice and kill itself.
3611 (JSC::HeapTimer::timerDidFire): We grab our mutex and check our JSGlobalData pointer. If it has been zero-ed
3612 out, then we know the VM has started to shutdown and we should kill ourselves. Otherwise, grab the APIEntryShim,
3613 but without ref-ing the JSGlobalData (we don't want to bring the JSGlobalData's ref-count from 0 to 1) in case
3614 we were interrupted between releasing our mutex and trying to grab the APILock.
3615 * heap/HeapTimer.h:
3616 (HeapTimer):
3617 * heap/IncrementalSweeper.cpp:
3618 (JSC::IncrementalSweeper::doWork): We no longer need the API shim here since HeapTimer::timerDidFire handles
3619 all of that for us.
3620 (JSC::IncrementalSweeper::create):
3621 * heap/IncrementalSweeper.h:
3622 (IncrementalSweeper):
3623 * heap/MarkedAllocator.cpp:
3624 (JSC::MarkedAllocator::allocateSlowCase):
3625 * heap/WeakBlock.cpp:
3626 (JSC::WeakBlock::reap):
3627 * jsc.cpp:
3628 (functionGC):
3629 (functionReleaseExecutableMemory):
3630 (jscmain):
3631 * runtime/Completion.cpp:
3632 (JSC::checkSyntax):
3633 (JSC::evaluate):
3634 * runtime/GCActivityCallback.h:
3635 (DefaultGCActivityCallback):
3636 (JSC::DefaultGCActivityCallback::create):
3637 * runtime/JSGlobalData.cpp:
3638 (JSC::JSGlobalData::JSGlobalData):
3639 (JSC::JSGlobalData::~JSGlobalData): Signals to the two HeapTimers (GCActivityCallback and IncrementalSweeper)
3640 that the VM has started shutting down. It then waits until the HeapTimer is done with whatever activity
3641 it needs to do before continuing with any further destruction. Also asserts that we do not currently hold the
3642 APILock because this could potentially cause deadlock when we try to signal to the HeapTimers using their mutexes.
3643 (JSC::JSGlobalData::sharedInstance): Protect the initialization for the shared instance with the GlobalJSLock.
3644 (JSC::JSGlobalData::sharedInstanceInternal):
3645 * runtime/JSGlobalData.h: Change to be ThreadSafeRefCounted so that we don't have to worry about refing and
3646 de-refing JSGlobalDatas on separate threads since we don't do it that often anyways.
3647 (JSGlobalData):
3648 (JSC::JSGlobalData::apiLock):
3649 * runtime/JSGlobalObject.cpp:
3650 (JSC::JSGlobalObject::~JSGlobalObject):
3651 (JSC::JSGlobalObject::init):
3652 * runtime/JSLock.cpp:
3653 (JSC):
3654 (JSC::GlobalJSLock::GlobalJSLock): For accessing the shared instance.
3655 (JSC::GlobalJSLock::~GlobalJSLock):
3656 (JSC::JSLockHolder::JSLockHolder): MutexLocker for JSLock. Also refs the JSGlobalData to keep it alive so that
3657 it can successfully unlock it later without it disappearing from underneath it.
3658 (JSC::JSLockHolder::~JSLockHolder):
3659 (JSC::JSLock::JSLock):
3660 (JSC::JSLock::~JSLock):
3661 (JSC::JSLock::lock): Uses the spin lock for guarding the lock count and owner thread fields. Uses the mutex for
3662 actually waiting for long periods.
3663 (JSC::JSLock::unlock):
3664 (JSC::JSLock::currentThreadIsHoldingLock):
3665 (JSC::JSLock::dropAllLocks):
3666 (JSC::JSLock::dropAllLocksUnconditionally):
3667 (JSC::JSLock::grabAllLocks):
3668 (JSC::JSLock::DropAllLocks::DropAllLocks):
3669 (JSC::JSLock::DropAllLocks::~DropAllLocks):
3670 * runtime/JSLock.h:
3671 (JSC):
3672 (GlobalJSLock):
3673 (JSLockHolder):
3674 (JSLock):
3675 (DropAllLocks):
3676 * runtime/WeakGCMap.h:
3677 (JSC::WeakGCMap::set):
3678 * testRegExp.cpp:
3679 (realMain):
3680
peter@chromium.org166f5bb2012-06-22 16:20:33 +000036812012-06-22 Peter Beverloo <peter@chromium.org>
3682
3683 [Chromium] Disable c++0x compatibility warnings in JavaScriptCore.gyp when building for Android
3684 https://bugs.webkit.org/show_bug.cgi?id=88853
3685
3686 Reviewed by Steve Block.
3687
3688 The Android exclusions were necessary to fix a gyp generation error, as
3689 the gcc_version variable wasn't being defined for Android. Remove these
3690 exceptions when Chromium is able to define the gcc_version variable.
3691
3692 * JavaScriptCore.gyp/JavaScriptCore.gyp:
3693
fpizlo@apple.com90011802012-06-22 01:33:30 +000036942012-06-21 Filip Pizlo <fpizlo@apple.com>
3695
3696 op_resolve_global should not prevent DFG inlining
3697 https://bugs.webkit.org/show_bug.cgi?id=89726
3698
3699 Reviewed by Gavin Barraclough.
3700
3701 * bytecode/CodeBlock.cpp:
3702 (JSC::CodeBlock::CodeBlock):
3703 (JSC::CodeBlock::shrinkToFit):
3704 * bytecode/GlobalResolveInfo.h:
3705 (JSC::GlobalResolveInfo::GlobalResolveInfo):
3706 (GlobalResolveInfo):
3707 * dfg/DFGByteCodeParser.cpp:
3708 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
3709 * dfg/DFGCapabilities.h:
3710 (JSC::DFG::canInlineOpcode):
3711 * dfg/DFGOperations.cpp:
3712 * dfg/DFGOperations.h:
3713 * dfg/DFGSpeculativeJIT.h:
3714 (JSC::DFG::SpeculativeJIT::callOperation):
3715 * dfg/DFGSpeculativeJIT32_64.cpp:
3716 (JSC::DFG::SpeculativeJIT::compile):
3717 * dfg/DFGSpeculativeJIT64.cpp:
3718 (JSC::DFG::SpeculativeJIT::compile):
3719
fpizlo@apple.com618044d2012-06-21 22:55:42 +000037202012-06-20 Filip Pizlo <fpizlo@apple.com>
3721
3722 DFG should inline 'new Array()'
3723 https://bugs.webkit.org/show_bug.cgi?id=89632
3724
3725 Reviewed by Geoffrey Garen.
3726
3727 This adds support for treating InternalFunction like intrinsics. The code
3728 to do so is actually quite clean, so I don't feel bad about perpetuating
3729 the InternalFunction vs. JSFunction-with-NativeExecutable dichotomy.
3730
3731 Currently this newfound power is only used to inline 'new Array()'.
3732
3733 * dfg/DFGByteCodeParser.cpp:
3734 (ByteCodeParser):
3735 (JSC::DFG::ByteCodeParser::handleCall):
3736 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
3737 (DFG):
3738 * dfg/DFGGraph.h:
3739 (JSC::DFG::Graph::isInternalFunctionConstant):
3740 (JSC::DFG::Graph::valueOfInternalFunctionConstant):
3741
mhahnenberg@apple.coma2373032012-06-21 22:38:39 +000037422012-06-21 Mark Hahnenberg <mhahnenberg@apple.com>
3743
3744 Adding copyrights to new files.
3745
3746 * heap/HeapTimer.cpp:
3747 * heap/HeapTimer.h:
3748 * heap/IncrementalSweeper.cpp:
3749 * heap/IncrementalSweeper.h:
3750
commit-queue@webkit.orgc8209e72012-06-21 17:34:26 +000037512012-06-21 Arnaud Renevier <arno@renevier.net>
3752
3753 make sure headers are included only once per file
3754 https://bugs.webkit.org/show_bug.cgi?id=88922
3755
3756 Reviewed by Alexey Proskuryakov.
3757
3758 * bytecode/CodeBlock.h:
3759 * heap/MachineStackMarker.cpp:
3760 * runtime/JSVariableObject.h:
3761
commit-queue@webkit.orgbff9a102012-06-21 15:46:40 +000037622012-06-21 Ryuan Choi <ryuan.choi@gmail.com>
3763
3764 [EFL][WK2] Make WebKit2/Efl headers and resources installable.
3765 https://bugs.webkit.org/show_bug.cgi?id=88207
3766
3767 Reviewed by Chang Shu.
3768
3769 * shell/CMakeLists.txt: Use ${EXEC_INSTALL_DIR} instead of hardcoding "bin"
3770
ggaren@apple.com4b67d0d2012-06-21 02:00:08 +000037712012-06-20 Geoffrey Garen <ggaren@apple.com>
3772
3773 Reduced (but did not eliminate) use of "berzerker GC"
3774 https://bugs.webkit.org/show_bug.cgi?id=89237
3775
3776 Reviewed by Gavin Barraclough.
3777
3778 (PART 1)
3779
3780 This patch turned out to be crashy, so I'm landing the non-crashy bits
3781 first.
3782
3783 This part is pre-requisite refactoring. I didn't actually turn off
3784 "berzerker GC" or turn on incremental shrinking.
3785
3786 * heap/MarkedAllocator.cpp:
3787 (JSC::MarkedAllocator::removeBlock): Make sure to clear the free list when
3788 we throw away the block we're currently allocating out of. Otherwise, we'll
3789 allocate out of a stale free list.
3790
3791 * heap/MarkedSpace.cpp:
3792 (JSC::Free::Free):
3793 (JSC::Free::operator()):
3794 (JSC::Free::returnValue): Refactored this functor to use a shared helper
3795 function, so we can share our implementation with the incremental sweeper.
3796
3797 Also changed to freeing individual blocks immediately instead of linking
3798 them into a list for later freeing. This makes the programming interface
3799 simpler, and it's slightly more efficient to boot.
3800
3801 (JSC::MarkedSpace::~MarkedSpace): Updated for rename.
3802
3803 (JSC::MarkedSpace::freeBlock):
3804 (JSC::MarkedSpace::freeOrShrinkBlock): New helper functions to share behavior
3805 with the incremental sweeper.
3806
3807 (JSC::MarkedSpace::shrink): Updated for new functor behavior.
3808
3809 * heap/MarkedSpace.h: Statically typed languages are awesome.
3810
fpizlo@apple.com8c462122012-06-20 21:07:33 +000038112012-06-20 Filip Pizlo <fpizlo@apple.com>
3812
fpizlo@apple.com3bcb2112012-06-21 01:38:49 +00003813 DFG should optimize ResolveGlobal
3814 https://bugs.webkit.org/show_bug.cgi?id=89617
3815
3816 Reviewed by Oliver Hunt.
3817
3818 This adds inlining of ResolveGlobal accesses that are known monomorphic. It also
3819 adds the specific function optimization to ResolveGlobal, when it is inlined. And,
3820 it makes internal functions act like specific functions, since that will be the
3821 most common use-case of this optimization.
3822
3823 This is only a slighy speed-up (sub 1%), since we don't yet do the obvious thing
3824 with this optimization, which is to completely inline common "globally resolved"
3825 function and constructor calls, like "new Array()".
3826
3827 * CMakeLists.txt:
3828 * GNUmakefile.list.am:
3829 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
3830 * JavaScriptCore.xcodeproj/project.pbxproj:
3831 * Target.pri:
3832 * bytecode/CodeBlock.cpp:
3833 (JSC::CodeBlock::globalResolveInfoForBytecodeOffset):
3834 * bytecode/CodeBlock.h:
3835 (CodeBlock):
3836 (JSC::CodeBlock::numberOfGlobalResolveInfos):
3837 * bytecode/GlobalResolveInfo.h:
3838 (JSC::getGlobalResolveInfoBytecodeOffset):
3839 (JSC):
3840 * bytecode/ResolveGlobalStatus.cpp: Added.
3841 (JSC):
3842 (JSC::computeForStructure):
3843 (JSC::computeForLLInt):
3844 (JSC::ResolveGlobalStatus::computeFor):
3845 * bytecode/ResolveGlobalStatus.h: Added.
3846 (JSC):
3847 (ResolveGlobalStatus):
3848 (JSC::ResolveGlobalStatus::ResolveGlobalStatus):
3849 (JSC::ResolveGlobalStatus::state):
3850 (JSC::ResolveGlobalStatus::isSet):
3851 (JSC::ResolveGlobalStatus::operator!):
3852 (JSC::ResolveGlobalStatus::isSimple):
3853 (JSC::ResolveGlobalStatus::takesSlowPath):
3854 (JSC::ResolveGlobalStatus::structure):
3855 (JSC::ResolveGlobalStatus::offset):
3856 (JSC::ResolveGlobalStatus::specificValue):
3857 * dfg/DFGByteCodeParser.cpp:
3858 (ByteCodeParser):
3859 (JSC::DFG::ByteCodeParser::handleGetByOffset):
3860 (DFG):
3861 (JSC::DFG::ByteCodeParser::handleGetById):
3862 (JSC::DFG::ByteCodeParser::parseBlock):
3863 * runtime/JSObject.cpp:
3864 (JSC::getCallableObjectSlow):
3865 (JSC):
3866 (JSC::JSObject::put):
3867 (JSC::JSObject::putDirectVirtual):
3868 (JSC::JSObject::putDirectAccessor):
3869 * runtime/JSObject.h:
3870 (JSC):
3871 (JSC::getCallableObject):
3872 (JSC::JSObject::putOwnDataProperty):
3873 (JSC::JSObject::putDirect):
3874 (JSC::JSObject::putDirectWithoutTransition):
3875
38762012-06-20 Filip Pizlo <fpizlo@apple.com>
3877
fpizlo@apple.com2e368f72012-06-20 23:55:18 +00003878 Functions on global objects should be specializable
3879 https://bugs.webkit.org/show_bug.cgi?id=89615
3880
3881 Reviewed by Oliver Hunt.
3882
3883 I tested to see if this brought back the bug in https://bugs.webkit.org/show_bug.cgi?id=33343,
3884 and it didn't. Bug 33343 was the reason why we disabled global object function specialization
3885 to begin with. So I'm guessing this is safe.
3886
3887 * runtime/JSGlobalObject.cpp:
3888 (JSC::JSGlobalObject::init):
3889
38902012-06-20 Filip Pizlo <fpizlo@apple.com>
3891
fpizlo@apple.com8c462122012-06-20 21:07:33 +00003892 build-webkit failure due to illegal 32-bit integer constants in code
3893 generated by offlineasm
3894 https://bugs.webkit.org/show_bug.cgi?id=89347
3895
3896 Reviewed by Geoffrey Garen.
3897
3898 The offending constants are the magic numbers used by offlineasm to find
3899 offsets in the generated machine code. Added code to turn them into what
3900 the C++ compiler will believe to be valid 32-bit values.
3901
3902 * offlineasm/offsets.rb:
3903
ggaren@apple.com30ef2b32012-06-20 18:24:02 +000039042012-06-19 Geoffrey Garen <ggaren@apple.com>
3905
3906 Made the incremental sweeper more aggressive
3907 https://bugs.webkit.org/show_bug.cgi?id=89527
3908
3909 Reviewed by Oliver Hunt.
3910
3911 This is a pre-requisite to getting rid of "berzerker GC" because we need
3912 the sweeper to reclaim memory in a timely fashion, or we'll see a memory
3913 footprint regression.
3914
3915 * heap/IncrementalSweeper.h:
3916 * heap/IncrementalSweeper.cpp:
3917 (JSC::IncrementalSweeper::scheduleTimer): Since the time slice is predictable,
3918 no need to use a data member to record it.
3919
3920 (JSC::IncrementalSweeper::doSweep): Sweep as many blocks as we can in a
3921 small time slice. This is better than sweeping only one block per timer
3922 fire because that strategy has a heavy timer overhead, and artificially
3923 delays memory reclamation.
3924
fpizlo@apple.com3d517672012-06-20 17:48:23 +000039252012-06-20 Filip Pizlo <fpizlo@apple.com>
3926
3927 DFG should be able to print disassembly interleaved with the IR
3928 https://bugs.webkit.org/show_bug.cgi?id=89551
3929
3930 Reviewed by Geoffrey Garen.
fpizlo@apple.come245b3f2012-06-20 17:51:07 +00003931
3932 This change also removes running Dominators unconditionally on every DFG
3933 compile. Dominators are designed to be computed on-demand, and currently
3934 the only demand is graph dumps.
fpizlo@apple.com3d517672012-06-20 17:48:23 +00003935
3936 * CMakeLists.txt:
3937 * GNUmakefile.list.am:
3938 * JavaScriptCore.xcodeproj/project.pbxproj:
3939 * Target.pri:
3940 * assembler/ARMv7Assembler.h:
3941 (JSC::ARMv7Assembler::labelIgnoringWatchpoints):
3942 (ARMv7Assembler):
3943 * assembler/AbstractMacroAssembler.h:
3944 (AbstractMacroAssembler):
3945 (JSC::AbstractMacroAssembler::labelIgnoringWatchpoints):
3946 * assembler/X86Assembler.h:
3947 (X86Assembler):
3948 (JSC::X86Assembler::labelIgnoringWatchpoints):
3949 * dfg/DFGCommon.h:
3950 (JSC::DFG::shouldShowDisassembly):
3951 (DFG):
3952 * dfg/DFGDisassembler.cpp: Added.
3953 (DFG):
3954 (JSC::DFG::Disassembler::Disassembler):
3955 (JSC::DFG::Disassembler::dump):
3956 (JSC::DFG::Disassembler::dumpDisassembly):
3957 * dfg/DFGDisassembler.h: Added.
3958 (DFG):
3959 (Disassembler):
3960 (JSC::DFG::Disassembler::setStartOfCode):
3961 (JSC::DFG::Disassembler::setForBlock):
3962 (JSC::DFG::Disassembler::setForNode):
3963 (JSC::DFG::Disassembler::setEndOfMainPath):
3964 (JSC::DFG::Disassembler::setEndOfCode):
3965 * dfg/DFGDriver.cpp:
3966 (JSC::DFG::compile):
3967 * dfg/DFGGraph.cpp:
3968 (JSC::DFG::Graph::dumpCodeOrigin):
3969 (JSC::DFG::Graph::amountOfNodeWhiteSpace):
3970 (DFG):
3971 (JSC::DFG::Graph::printNodeWhiteSpace):
3972 (JSC::DFG::Graph::dump):
3973 (JSC::DFG::Graph::dumpBlockHeader):
3974 * dfg/DFGGraph.h:
3975 * dfg/DFGJITCompiler.cpp:
3976 (JSC::DFG::JITCompiler::JITCompiler):
3977 (DFG):
3978 (JSC::DFG::JITCompiler::compile):
3979 (JSC::DFG::JITCompiler::compileFunction):
3980 * dfg/DFGJITCompiler.h:
3981 (JITCompiler):
3982 (JSC::DFG::JITCompiler::setStartOfCode):
3983 (JSC::DFG::JITCompiler::setForBlock):
3984 (JSC::DFG::JITCompiler::setForNode):
3985 (JSC::DFG::JITCompiler::setEndOfMainPath):
3986 (JSC::DFG::JITCompiler::setEndOfCode):
3987 * dfg/DFGNode.h:
3988 (Node):
3989 (JSC::DFG::Node::willHaveCodeGen):
3990 * dfg/DFGNodeFlags.cpp:
3991 (JSC::DFG::nodeFlagsAsString):
3992 * dfg/DFGSpeculativeJIT.cpp:
3993 (JSC::DFG::SpeculativeJIT::compile):
3994 * dfg/DFGSpeculativeJIT.h:
3995 (SpeculativeJIT):
3996 * runtime/Options.cpp:
3997 (Options):
3998 (JSC::Options::initializeOptions):
3999 * runtime/Options.h:
4000 (Options):
4001
fpizlo@apple.com2adf5272012-06-20 01:33:30 +000040022012-06-19 Filip Pizlo <fpizlo@apple.com>
4003
4004 JSC should be able to show disassembly for all generated JIT code
4005 https://bugs.webkit.org/show_bug.cgi?id=89536
4006
4007 Reviewed by Gavin Barraclough.
4008
4009 Now instead of doing linkBuffer.finalizeCode(), you do
4010 FINALIZE_CODE(linkBuffer, (... explanation ...)). FINALIZE_CODE() then
4011 prints your explanation and the disassembled code, if
4012 Options::showDisassembly is set to true.
4013
4014 * CMakeLists.txt:
4015 * GNUmakefile.list.am:
4016 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4017 * JavaScriptCore.xcodeproj/project.pbxproj:
4018 * Target.pri:
4019 * assembler/LinkBuffer.cpp: Added.
4020 (JSC):
4021 (JSC::LinkBuffer::finalizeCodeWithoutDisassembly):
4022 (JSC::LinkBuffer::finalizeCodeWithDisassembly):
4023 (JSC::LinkBuffer::linkCode):
4024 (JSC::LinkBuffer::performFinalization):
4025 (JSC::LinkBuffer::dumpLinkStatistics):
4026 (JSC::LinkBuffer::dumpCode):
4027 * assembler/LinkBuffer.h:
4028 (LinkBuffer):
4029 (JSC):
4030 * assembler/MacroAssemblerCodeRef.h:
4031 (JSC::MacroAssemblerCodeRef::tryToDisassemble):
4032 (MacroAssemblerCodeRef):
4033 * dfg/DFGJITCompiler.cpp:
4034 (JSC::DFG::JITCompiler::compile):
4035 (JSC::DFG::JITCompiler::compileFunction):
4036 * dfg/DFGOSRExitCompiler.cpp:
4037 * dfg/DFGRepatch.cpp:
4038 (JSC::DFG::generateProtoChainAccessStub):
4039 (JSC::DFG::tryCacheGetByID):
4040 (JSC::DFG::tryBuildGetByIDList):
4041 (JSC::DFG::emitPutReplaceStub):
4042 (JSC::DFG::emitPutTransitionStub):
4043 * dfg/DFGThunks.cpp:
4044 (JSC::DFG::osrExitGenerationThunkGenerator):
4045 * disassembler/Disassembler.h:
4046 (JSC):
4047 (JSC::tryToDisassemble):
4048 * disassembler/UDis86Disassembler.cpp:
4049 (JSC::tryToDisassemble):
4050 * jit/JIT.cpp:
4051 (JSC::JIT::privateCompile):
4052 * jit/JITCode.h:
4053 (JSC::JITCode::tryToDisassemble):
4054 * jit/JITOpcodes.cpp:
4055 (JSC::JIT::privateCompileCTIMachineTrampolines):
4056 * jit/JITOpcodes32_64.cpp:
4057 (JSC::JIT::privateCompileCTIMachineTrampolines):
4058 (JSC::JIT::privateCompileCTINativeCall):
4059 * jit/JITPropertyAccess.cpp:
4060 (JSC::JIT::stringGetByValStubGenerator):
4061 (JSC::JIT::privateCompilePutByIdTransition):
4062 (JSC::JIT::privateCompilePatchGetArrayLength):
4063 (JSC::JIT::privateCompileGetByIdProto):
4064 (JSC::JIT::privateCompileGetByIdSelfList):
4065 (JSC::JIT::privateCompileGetByIdProtoList):
4066 (JSC::JIT::privateCompileGetByIdChainList):
4067 (JSC::JIT::privateCompileGetByIdChain):
4068 * jit/JITPropertyAccess32_64.cpp:
4069 (JSC::JIT::stringGetByValStubGenerator):
4070 (JSC::JIT::privateCompilePutByIdTransition):
4071 (JSC::JIT::privateCompilePatchGetArrayLength):
4072 (JSC::JIT::privateCompileGetByIdProto):
4073 (JSC::JIT::privateCompileGetByIdSelfList):
4074 (JSC::JIT::privateCompileGetByIdProtoList):
4075 (JSC::JIT::privateCompileGetByIdChainList):
4076 (JSC::JIT::privateCompileGetByIdChain):
4077 * jit/SpecializedThunkJIT.h:
4078 (JSC::SpecializedThunkJIT::finalize):
4079 * jit/ThunkGenerators.cpp:
4080 (JSC::charCodeAtThunkGenerator):
4081 (JSC::charAtThunkGenerator):
4082 (JSC::fromCharCodeThunkGenerator):
4083 (JSC::sqrtThunkGenerator):
4084 (JSC::floorThunkGenerator):
4085 (JSC::ceilThunkGenerator):
4086 (JSC::roundThunkGenerator):
4087 (JSC::expThunkGenerator):
4088 (JSC::logThunkGenerator):
4089 (JSC::absThunkGenerator):
4090 (JSC::powThunkGenerator):
4091 * llint/LLIntThunks.cpp:
4092 (JSC::LLInt::generateThunkWithJumpTo):
4093 (JSC::LLInt::functionForCallEntryThunkGenerator):
4094 (JSC::LLInt::functionForConstructEntryThunkGenerator):
4095 (JSC::LLInt::functionForCallArityCheckThunkGenerator):
4096 (JSC::LLInt::functionForConstructArityCheckThunkGenerator):
4097 (JSC::LLInt::evalEntryThunkGenerator):
4098 (JSC::LLInt::programEntryThunkGenerator):
4099 * runtime/Options.cpp:
4100 (Options):
4101 (JSC::Options::initializeOptions):
4102 * runtime/Options.h:
4103 (Options):
4104 * yarr/YarrJIT.cpp:
4105 (JSC::Yarr::YarrGenerator::compile):
4106
mhahnenberg@apple.com7ffd08d2012-06-20 00:20:30 +000041072012-06-19 Mark Hahnenberg <mhahnenberg@apple.com>
4108
4109 [Qt][Mac] REGRESSION(r120742): It broke the build
4110 https://bugs.webkit.org/show_bug.cgi?id=89516
4111
4112 Reviewed by Geoffrey Garen.
4113
4114 Removing GCActivityCallbackCF.cpp because it doesn't mesh well with cross-platform
4115 code on Darwin (e.g. Qt). We now use plain ol' vanilla ifdefs to handle platforms
4116 without CF support. These if-defs will probably disappear in the future when we
4117 use cross-platform timers in HeapTimer.
4118
4119 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4120 * JavaScriptCore.xcodeproj/project.pbxproj:
4121 * runtime/GCActivityCallback.cpp:
4122 (JSC):
4123 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
4124 (JSC::DefaultGCActivityCallback::doWork):
4125 (JSC::DefaultGCActivityCallback::scheduleTimer):
4126 (JSC::DefaultGCActivityCallback::cancelTimer):
4127 (JSC::DefaultGCActivityCallback::didAllocate):
4128 (JSC::DefaultGCActivityCallback::willCollect):
4129 (JSC::DefaultGCActivityCallback::cancel):
4130 * runtime/GCActivityCallbackCF.cpp: Removed.
4131
fpizlo@apple.com152abff2012-06-19 23:10:12 +000041322012-06-19 Filip Pizlo <fpizlo@apple.com>
4133
4134 DFG CFA forgets to notify subsequent phases of found constants if it proves LogicalNot to be a constant
4135 https://bugs.webkit.org/show_bug.cgi?id=89511
4136 <rdar://problem/11700089>
4137
4138 Reviewed by Geoffrey Garen.
4139
4140 * dfg/DFGAbstractState.cpp:
4141 (JSC::DFG::AbstractState::execute):
4142
commit-queue@webkit.orgb6833002012-06-19 21:06:08 +000041432012-06-19 Mark Lam <mark.lam@apple.com>
4144
4145 CodeBlock::needsCallReturnIndices() is no longer needed.
4146 https://bugs.webkit.org/show_bug.cgi?id=89490
4147
4148 Reviewed by Geoffrey Garen.
4149
4150 * bytecode/CodeBlock.h:
4151 (JSC::CodeBlock::needsCallReturnIndices): removed.
4152 * dfg/DFGJITCompiler.cpp:
4153 (JSC::DFG::JITCompiler::link):
4154 * jit/JIT.cpp:
4155 (JSC::JIT::privateCompile):
4156
fpizlo@apple.com861ea7b2012-06-19 20:05:06 +000041572012-06-19 Filip Pizlo <fpizlo@apple.com>
4158
4159 Unreviewed, try to fix Windows build.
4160
4161 * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd:
4162
fpizlo@apple.com01c2a192012-06-19 19:42:55 +000041632012-06-17 Filip Pizlo <fpizlo@apple.com>
4164
4165 It should be possible to look at disassembly
4166 https://bugs.webkit.org/show_bug.cgi?id=89319
4167
4168 Reviewed by Sam Weinig.
4169
4170 This imports the udis86 disassembler library. The library is placed
4171 behind an abstraction in disassembler/Disassembler.h, so that we can
4172 in the future use other disassemblers (for other platforms) whenever
4173 appropriate. As a first step, the disassembler is being invoked for
4174 DFG verbose dumps.
4175
4176 If we ever want to merge a new version of udis86 in the future, I've
4177 made notes about changes I made to the library in
4178 disassembler/udis86/differences.txt.
4179
4180 * CMakeLists.txt:
4181 * DerivedSources.make:
4182 * GNUmakefile.list.am:
4183 * JavaScriptCore.pri:
4184 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4185 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
4186 * JavaScriptCore.xcodeproj/project.pbxproj:
4187 * dfg/DFGJITCompiler.cpp:
4188 (JSC::DFG::JITCompiler::compile):
4189 (JSC::DFG::JITCompiler::compileFunction):
4190 * disassembler: Added.
4191 * disassembler/Disassembler.h: Added.
4192 (JSC):
4193 (JSC::tryToDisassemble):
4194 * disassembler/UDis86Disassembler.cpp: Added.
4195 (JSC):
4196 (JSC::tryToDisassemble):
4197 * disassembler/udis86: Added.
4198 * disassembler/udis86/differences.txt: Added.
4199 * disassembler/udis86/itab.py: Added.
4200 (UdItabGenerator):
4201 (UdItabGenerator.__init__):
4202 (UdItabGenerator.toGroupId):
4203 (UdItabGenerator.genLookupTable):
4204 (UdItabGenerator.genLookupTableList):
4205 (UdItabGenerator.genInsnTable):
4206 (genItabH):
4207 (genItabH.UD_ITAB_H):
4208 (genItabC):
4209 (genItab):
4210 (main):
4211 * disassembler/udis86/optable.xml: Added.
4212 * disassembler/udis86/ud_opcode.py: Added.
4213 (UdOpcodeTables):
4214 (UdOpcodeTables.sizeOfTable):
4215 (UdOpcodeTables.nameOfTable):
4216 (UdOpcodeTables.updateTable):
4217 (UdOpcodeTables.Insn):
4218 (UdOpcodeTables.Insn.__init__):
4219 (UdOpcodeTables.Insn.__init__.opcode):
4220 (UdOpcodeTables.parse):
4221 (UdOpcodeTables.addInsnDef):
4222 (UdOpcodeTables.print_table):
4223 (UdOpcodeTables.print_tree):
4224 * disassembler/udis86/ud_optable.py: Added.
4225 (UdOptableXmlParser):
4226 (UdOptableXmlParser.parseDef):
4227 (UdOptableXmlParser.parse):
4228 (printFn):
4229 (parse):
4230 (main):
4231 * disassembler/udis86/udis86.c: Added.
4232 (ud_init):
4233 (ud_disassemble):
4234 (ud_set_mode):
4235 (ud_set_vendor):
4236 (ud_set_pc):
4237 (ud):
4238 (ud_insn_asm):
4239 (ud_insn_off):
4240 (ud_insn_hex):
4241 (ud_insn_ptr):
4242 (ud_insn_len):
4243 * disassembler/udis86/udis86.h: Added.
4244 * disassembler/udis86/udis86_decode.c: Added.
4245 (eff_adr_mode):
4246 (ud_lookup_mnemonic):
4247 (decode_prefixes):
4248 (modrm):
4249 (resolve_operand_size):
4250 (resolve_mnemonic):
4251 (decode_a):
4252 (decode_gpr):
4253 (resolve_gpr64):
4254 (resolve_gpr32):
4255 (resolve_reg):
4256 (decode_imm):
4257 (decode_modrm_reg):
4258 (decode_modrm_rm):
4259 (decode_o):
4260 (decode_operand):
4261 (decode_operands):
4262 (clear_insn):
4263 (resolve_mode):
4264 (gen_hex):
4265 (decode_insn):
4266 (decode_3dnow):
4267 (decode_ssepfx):
4268 (decode_ext):
4269 (decode_opcode):
4270 (ud_decode):
4271 * disassembler/udis86/udis86_decode.h: Added.
4272 (ud_itab_entry_operand):
4273 (ud_itab_entry):
4274 (ud_lookup_table_list_entry):
4275 (sse_pfx_idx):
4276 (mode_idx):
4277 (modrm_mod_idx):
4278 (vendor_idx):
4279 (is_group_ptr):
4280 (group_idx):
4281 * disassembler/udis86/udis86_extern.h: Added.
4282 * disassembler/udis86/udis86_input.c: Added.
4283 (inp_buff_hook):
4284 (inp_file_hook):
4285 (ud):
4286 (ud_set_user_opaque_data):
4287 (ud_get_user_opaque_data):
4288 (ud_set_input_buffer):
4289 (ud_set_input_file):
4290 (ud_input_skip):
4291 (ud_input_end):
4292 (ud_inp_next):
4293 (ud_inp_back):
4294 (ud_inp_peek):
4295 (ud_inp_move):
4296 (ud_inp_uint8):
4297 (ud_inp_uint16):
4298 (ud_inp_uint32):
4299 (ud_inp_uint64):
4300 * disassembler/udis86/udis86_input.h: Added.
4301 * disassembler/udis86/udis86_itab_holder.c: Added.
4302 * disassembler/udis86/udis86_syn-att.c: Added.
4303 (opr_cast):
4304 (gen_operand):
4305 (ud_translate_att):
4306 * disassembler/udis86/udis86_syn-intel.c: Added.
4307 (opr_cast):
4308 (gen_operand):
4309 (ud_translate_intel):
4310 * disassembler/udis86/udis86_syn.c: Added.
4311 * disassembler/udis86/udis86_syn.h: Added.
4312 (mkasm):
4313 * disassembler/udis86/udis86_types.h: Added.
4314 (ud_operand):
4315 (ud):
4316 * jit/JITCode.h:
4317 (JITCode):
4318 (JSC::JITCode::tryToDisassemble):
4319
mhahnenberg@apple.coma7ec41b2012-06-19 19:17:31 +000043202012-06-19 Mark Hahnenberg <mhahnenberg@apple.com>
4321
4322 GCActivityCallback and IncrementalSweeper should share code
4323 https://bugs.webkit.org/show_bug.cgi?id=89400
4324
4325 Reviewed by Geoffrey Garen.
4326
4327 A lot of functionality is duplicated between GCActivityCallback and IncrementalSweeper.
4328 We should extract the common functionality out into a separate class that both of them
4329 can inherit from. This refactoring will be an even greater boon when we add the ability
4330 to shut these two agents down in a thread-safe fashion
4331
4332 * CMakeLists.txt:
4333 * GNUmakefile.list.am:
4334 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4335 * JavaScriptCore.xcodeproj/project.pbxproj:
4336 * Target.pri:
4337 * heap/Heap.cpp:
4338 (JSC::Heap::Heap): Move initialization down so that the JSGlobalData has a valid Heap when
4339 we're initializing the GCActivityCallback and the IncrementalSweeper.
4340 * heap/Heap.h:
4341 (Heap):
4342 * heap/HeapTimer.cpp: Added.
4343 (JSC):
4344 (JSC::HeapTimer::HeapTimer): Initialize the various base class data that
4345 DefaultGCActivityCallback::commonConstructor() used to do.
4346 (JSC::HeapTimer::~HeapTimer): Call to invalidate().
4347 (JSC::HeapTimer::synchronize): Same functionality as the old DefaultGCActivityCallback::synchronize().
4348 Virtual so that non-CF subclasses can override.
4349 (JSC::HeapTimer::invalidate): Tears down the runloop timer to prevent any future firing.
4350 (JSC::HeapTimer::timerDidFire): Callback to pass to the timer function. Casts and calls the virtual doWork().
4351 * heap/HeapTimer.h: Added. This is the class that serves as the common base class for
4352 both GCActivityCallback and IncrementalSweeper. It handles setting up and tearing down run loops and synchronizing
4353 across threads for its subclasses.
4354 (JSC):
4355 (HeapTimer):
4356 * heap/IncrementalSweeper.cpp: Changes to accomodate the extraction of common functionality
4357 between IncrementalSweeper and GCActivityCallback into a common ancestor.
4358 (JSC):
4359 (JSC::IncrementalSweeper::doWork):
4360 (JSC::IncrementalSweeper::IncrementalSweeper):
4361 (JSC::IncrementalSweeper::cancelTimer):
4362 (JSC::IncrementalSweeper::create):
4363 * heap/IncrementalSweeper.h:
4364 (IncrementalSweeper):
4365 * runtime/GCActivityCallback.cpp:
4366 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
4367 (JSC::DefaultGCActivityCallback::doWork):
4368 * runtime/GCActivityCallback.h:
4369 (GCActivityCallback):
4370 (JSC::GCActivityCallback::willCollect):
4371 (JSC::GCActivityCallback::GCActivityCallback):
4372 (JSC):
4373 (DefaultGCActivityCallback): Remove the platform data struct. The platform data should be kept in
4374 the class itself so as to be accessible by doWork(). Most of the platform data for CF is kept in
4375 HeapTimer anyways, so we only need the m_delay field now.
4376 * runtime/GCActivityCallbackBlackBerry.cpp:
4377 (JSC):
4378 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
4379 (JSC::DefaultGCActivityCallback::doWork):
4380 (JSC::DefaultGCActivityCallback::didAllocate):
4381 * runtime/GCActivityCallbackCF.cpp:
4382 (JSC):
4383 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
4384 (JSC::DefaultGCActivityCallback::doWork):
4385 (JSC::DefaultGCActivityCallback::scheduleTimer):
4386 (JSC::DefaultGCActivityCallback::cancelTimer):
4387 (JSC::DefaultGCActivityCallback::didAllocate):
4388 (JSC::DefaultGCActivityCallback::willCollect):
4389 (JSC::DefaultGCActivityCallback::cancel):
4390
4391
commit-queue@webkit.orgf5584612012-06-19 09:13:52 +000043922012-06-19 Mike West <mkwst@chromium.org>
4393
4394 Introduce ENABLE_CSP_NEXT configuration flag.
4395 https://bugs.webkit.org/show_bug.cgi?id=89300
4396
4397 Reviewed by Adam Barth.
4398
4399 The 1.0 draft of the Content Security Policy spec is just about to
4400 move to Last Call. We'll hide work on the upcoming 1.1 spec behind
4401 this ENABLE flag, disabled by default.
4402
4403 Spec: https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html
4404
4405 * Configurations/FeatureDefines.xcconfig:
4406
commit-queue@webkit.org3e0a1a02012-06-19 06:07:28 +000044072012-06-18 Mark Lam <mark.lam@apple.com>
4408
4409 Changed JSC to always record line number information so that error.stack
4410 and window.onerror() can report proper line numbers.
4411 https://bugs.webkit.org/show_bug.cgi?id=89410
4412
4413 Reviewed by Geoffrey Garen.
4414
4415 * bytecode/CodeBlock.cpp:
4416 (JSC::CodeBlock::CodeBlock):
4417 (JSC::CodeBlock::lineNumberForBytecodeOffset):
4418 (JSC::CodeBlock::shrinkToFit): m_lineInfo is now available unconditionally.
4419
4420 * bytecode/CodeBlock.h:
4421 (JSC::CodeBlock::addLineInfo):
4422 (JSC::CodeBlock::hasLineInfo): Unused. Now removed.
4423 (JSC::CodeBlock::needsCallReturnIndices):
4424 (CodeBlock):
4425 (RareData): Hoisted m_lineInfo out of m_rareData. m_lineInfo is now
4426 filled in unconditionally.
4427
4428 * bytecompiler/BytecodeGenerator.h:
4429 (JSC::BytecodeGenerator::addLineInfo):
4430
aestes@apple.comf6d51392012-06-19 03:32:30 +000044312012-06-18 Andy Estes <aestes@apple.com>
4432
aestes@apple.com6cc46942012-06-19 03:34:03 +00004433 Fix r120663, which didn't land the change that was reviewed.
4434
44352012-06-18 Andy Estes <aestes@apple.com>
4436
aestes@apple.comf6d51392012-06-19 03:32:30 +00004437 [JSC] In JSGlobalData.cpp, enableAssembler() sometimes leaks two CF objects
4438 https://bugs.webkit.org/show_bug.cgi?id=89415
4439
4440 Reviewed by Sam Weinig.
4441
4442 In the case where canUseJIT was a non-NULL CFBooleanRef,
4443 enableAssembler() would leak both canUseJITKey and canUseJIT by
4444 returning before calling CFRelease. Fix this by using RetainPtr.
4445
4446 * runtime/JSGlobalData.cpp:
4447 (JSC::enableAssembler):
4448
ggaren@apple.com2318dbc2012-06-18 04:35:21 +000044492012-06-17 Geoffrey Garen <ggaren@apple.com>
4450
4451 GC copy phase spends needless cycles zero-filling blocks
4452 https://bugs.webkit.org/show_bug.cgi?id=89128
4453
4454 Reviewed by Gavin Barraclough.
4455
4456 We only need to zero-fill when we're allocating memory that might not
4457 get fully initialized before GC.
4458
4459 * heap/CopiedBlock.h:
4460 (JSC::CopiedBlock::createNoZeroFill):
4461 (JSC::CopiedBlock::create): Added a way to create without zero-filling.
4462 This is our optimization.
4463
4464 (JSC::CopiedBlock::zeroFillToEnd):
4465 (JSC::CopiedBlock::CopiedBlock): Split zero-filling out from creation,
4466 so we can sometimes create without zero-filling.
4467
4468 * heap/CopiedSpace.cpp:
4469 (JSC::CopiedSpace::init):
4470 (JSC::CopiedSpace::tryAllocateSlowCase):
4471 (JSC::CopiedSpace::doneCopying): Renamed addNewBlock to allocateBlock()
4472 to clarify that the new block is always newly-allocated.
4473
4474 (JSC::CopiedSpace::doneFillingBlock): Make sure to zero-fill to the end
4475 of a block that might be used in the future for allocation. (Most of the
4476 time, this is a no-op, since we've already filled the block completely.)
4477
4478 (JSC::CopiedSpace::getFreshBlock): Removed this function because the
4479 abstraction of "allocation must succeed" is no longer useful.
4480
4481 * heap/CopiedSpace.h: Updated declarations to match.
4482
4483 * heap/CopiedSpaceInlineMethods.h:
4484 (JSC::CopiedSpace::allocateBlockForCopyingPhase): New function, which
4485 knows that it can skip zero-filling.
4486
4487 Added tighter scoping to our lock, to improve parallelism.
4488
4489 (JSC::CopiedSpace::allocateBlock): Folded getFreshBlock functionality
4490 into this function, for simplicity.
4491
4492 * heap/MarkStack.cpp:
4493 (JSC::SlotVisitor::startCopying):
4494 (JSC::SlotVisitor::allocateNewSpace): Use our new zero-fill-free helper
4495 function for great good.
4496
fpizlo@apple.com73df57b2012-06-18 01:59:18 +000044972012-06-17 Filip Pizlo <fpizlo@apple.com>
4498
4499 DFG should attempt to use structure watchpoints for all inlined get_by_id's and put_by_id's
4500 https://bugs.webkit.org/show_bug.cgi?id=89316
4501
4502 Reviewed by Oliver Hunt.
4503
4504 * dfg/DFGByteCodeParser.cpp:
4505 (JSC::DFG::ByteCodeParser::addStructureTransitionCheck):
4506 (ByteCodeParser):
4507 (JSC::DFG::ByteCodeParser::handleGetById):
4508 (JSC::DFG::ByteCodeParser::parseBlock):
4509
commit-queue@webkit.orgf8968a72012-06-15 22:24:21 +000045102012-06-15 Yong Li <yoli@rim.com>
4511
4512 [BlackBerry] Put platform-specific GC policy in GCActivityCallback
4513 https://bugs.webkit.org/show_bug.cgi?id=89236
4514
4515 Reviewed by Rob Buis.
4516
4517 Add GCActivityCallbackBlackBerry.cpp and implement platform-specific
4518 low memory GC policy there.
4519
4520 * PlatformBlackBerry.cmake:
4521 * heap/Heap.h:
4522 (JSC::Heap::isSafeToCollect): Added.
4523 * runtime/GCActivityCallbackBlackBerry.cpp: Added.
4524 (JSC):
4525 (JSC::DefaultGCActivityCallbackPlatformData::DefaultGCActivityCallbackPlatformData):
4526 (DefaultGCActivityCallbackPlatformData):
4527 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
4528 (JSC::DefaultGCActivityCallback::~DefaultGCActivityCallback):
4529 (JSC::DefaultGCActivityCallback::didAllocate):
4530 (JSC::DefaultGCActivityCallback::willCollect):
4531 (JSC::DefaultGCActivityCallback::synchronize):
4532 (JSC::DefaultGCActivityCallback::cancel):
4533
fpizlo@apple.com666a2d52012-06-15 22:21:44 +000045342012-06-15 Filip Pizlo <fpizlo@apple.com>
4535
4536 DFG should be able to set watchpoints on structure transitions in the
4537 method check prototype chain
4538 https://bugs.webkit.org/show_bug.cgi?id=89058
4539
4540 Adding the same assertion to 32-bit that I added to 64-bit. This change
4541 does not affect correctness but it's a good thing for assertion coverage.
4542
4543 * dfg/DFGSpeculativeJIT32_64.cpp:
4544 (JSC::DFG::SpeculativeJIT::compile):
4545
fpizlo@apple.comb75911b2012-06-13 20:53:52 +000045462012-06-13 Filip Pizlo <fpizlo@apple.com>
4547
fpizlo@apple.com04e41152012-06-15 22:14:53 +00004548 DFG should be able to set watchpoints on structure transitions in the
4549 method check prototype chain
4550 https://bugs.webkit.org/show_bug.cgi?id=89058
4551
4552 Reviewed by Gavin Barraclough.
4553
4554 This adds the ability to set watchpoints on Structures, and then does
4555 the most modest thing we can do with this ability: the DFG now sets
4556 watchpoints on structure transitions in the prototype chain of method
4557 checks.
4558
4559 This appears to be a >1% speed-up on V8.
4560
4561 * bytecode/PutByIdStatus.cpp:
4562 (JSC::PutByIdStatus::computeFromLLInt):
4563 (JSC::PutByIdStatus::computeFor):
4564 * bytecode/StructureSet.h:
4565 (JSC::StructureSet::containsOnly):
4566 (StructureSet):
4567 * bytecode/Watchpoint.cpp:
4568 (JSC::WatchpointSet::WatchpointSet):
4569 (JSC::InlineWatchpointSet::add):
4570 (JSC):
4571 (JSC::InlineWatchpointSet::inflateSlow):
4572 (JSC::InlineWatchpointSet::freeFat):
4573 * bytecode/Watchpoint.h:
4574 (WatchpointSet):
4575 (JSC):
4576 (InlineWatchpointSet):
4577 (JSC::InlineWatchpointSet::InlineWatchpointSet):
4578 (JSC::InlineWatchpointSet::~InlineWatchpointSet):
4579 (JSC::InlineWatchpointSet::hasBeenInvalidated):
4580 (JSC::InlineWatchpointSet::isStillValid):
4581 (JSC::InlineWatchpointSet::startWatching):
4582 (JSC::InlineWatchpointSet::notifyWrite):
4583 (JSC::InlineWatchpointSet::isFat):
4584 (JSC::InlineWatchpointSet::fat):
4585 (JSC::InlineWatchpointSet::inflate):
4586 * dfg/DFGAbstractState.cpp:
4587 (JSC::DFG::AbstractState::execute):
4588 * dfg/DFGByteCodeParser.cpp:
4589 (JSC::DFG::ByteCodeParser::addStructureTransitionCheck):
4590 (ByteCodeParser):
4591 (JSC::DFG::ByteCodeParser::parseBlock):
4592 * dfg/DFGCSEPhase.cpp:
4593 (JSC::DFG::CSEPhase::structureTransitionWatchpointElimination):
4594 (CSEPhase):
4595 (JSC::DFG::CSEPhase::performNodeCSE):
4596 * dfg/DFGCommon.h:
4597 * dfg/DFGGraph.cpp:
4598 (JSC::DFG::Graph::dump):
4599 * dfg/DFGGraph.h:
4600 (JSC::DFG::Graph::isCellConstant):
4601 * dfg/DFGJITCompiler.h:
4602 (JSC::DFG::JITCompiler::addWeakReferences):
4603 (JITCompiler):
4604 * dfg/DFGNode.h:
4605 (JSC::DFG::Node::hasStructure):
4606 (Node):
4607 (JSC::DFG::Node::structure):
4608 * dfg/DFGNodeType.h:
4609 (DFG):
4610 * dfg/DFGPredictionPropagationPhase.cpp:
4611 (JSC::DFG::PredictionPropagationPhase::propagate):
4612 * dfg/DFGRepatch.cpp:
4613 (JSC::DFG::emitPutTransitionStub):
4614 * dfg/DFGSpeculativeJIT64.cpp:
4615 (JSC::DFG::SpeculativeJIT::compile):
4616 * jit/JITStubs.cpp:
4617 (JSC::JITThunks::tryCachePutByID):
4618 * llint/LLIntSlowPaths.cpp:
4619 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
4620 * runtime/Structure.cpp:
4621 (JSC::Structure::Structure):
4622 * runtime/Structure.h:
4623 (JSC::Structure::transitionWatchpointSetHasBeenInvalidated):
4624 (Structure):
4625 (JSC::Structure::transitionWatchpointSetIsStillValid):
4626 (JSC::Structure::addTransitionWatchpoint):
4627 (JSC::Structure::notifyTransitionFromThisStructure):
4628 (JSC::JSCell::setStructure):
4629 * runtime/SymbolTable.cpp:
4630 (JSC::SymbolTableEntry::attemptToWatch):
4631
46322012-06-13 Filip Pizlo <fpizlo@apple.com>
4633
fpizlo@apple.comb75911b2012-06-13 20:53:52 +00004634 DFG should be able to set watchpoints on global variables
4635 https://bugs.webkit.org/show_bug.cgi?id=88692
4636
4637 Reviewed by Geoffrey Garen.
4638
4639 Rolling back in after fixing Windows build issues, and implementing
4640 branchTest8 for the Qt port's strange assemblers.
4641
4642 This implements global variable constant folding by allowing the optimizing
4643 compiler to set a "watchpoint" on globals that it wishes to constant fold.
4644 If the watchpoint fires, then an OSR exit is forced by overwriting the
4645 machine code that the optimizing compiler generated with a jump.
4646
4647 As such, this patch is adding quite a bit of stuff:
4648
4649 - Jump replacement on those hardware targets supported by the optimizing
4650 JIT. It is now possible to patch in a jump instruction over any recorded
4651 watchpoint label. The jump must be "local" in the sense that it must be
4652 within the range of the largest jump distance supported by a one
4653 instruction jump.
4654
4655 - WatchpointSets and Watchpoints. A Watchpoint is a doubly-linked list node
4656 that records the location where a jump must be inserted and the
4657 destination to which it should jump. Watchpoints can be added to a
4658 WatchpointSet. The WatchpointSet can be fired all at once, which plants
4659 all jumps. WatchpointSet also remembers if it had ever been invalidated,
4660 which allows for monotonicity: we typically don't want to optimize using
4661 watchpoints on something for which watchpoints had previously fired. The
4662 act of notifying a WatchpointSet has a trivial fast path in case no
4663 Watchpoints are registered (one-byte load+branch).
4664
4665 - SpeculativeJIT::speculationWatchpoint(). It's like speculationCheck(),
4666 except that you don't have to emit branches. But, you need to know what
4667 WatchpointSet to add the resulting Watchpoint to. Not everything that
4668 you could write a speculationCheck() for will have a WatchpointSet that
4669 would get notified if the condition you were speculating against became
4670 invalid.
4671
4672 - SymbolTableEntry now has the ability to refer to a WatchpointSet. It can
4673 do so without incurring any space overhead for those entries that don't
4674 have WatchpointSets.
4675
4676 - The bytecode generator infers all global function variables to be
4677 watchable, and makes all stores perform the WatchpointSet's write check,
4678 and marks all loads as being potentially watchable (i.e. you can compile
4679 them to a watchpoint and a constant).
4680
4681 Put together, this allows for fully sleazy inlining of calls to globally
4682 declared functions. The inline prologue will no longer contain the load of
4683 the function, or any checks of the function you're calling. I.e. it's
4684 pretty much like the kind of inlining you would see in Java or C++.
4685 Furthermore, the watchpointing functionality is built to be fairly general,
4686 and should allow setting watchpoints on all sorts of interesting things
4687 in the future.
4688
4689 The sleazy inlining means that we will now sometimes inline in code paths
4690 that have never executed. Previously, to inline we would have either had
4691 to have executed the call (to read the call's inline cache) or have
4692 executed the method check (to read the method check's inline cache). Now,
4693 we might inline when the callee is a watched global variable. This
4694 revealed some humorous bugs. First, constant folding disagreed with CFA
4695 over what kinds of operations can clobber (example: code path A is dead
4696 but stores a String into variable X, all other code paths store 0 into
4697 X, and then you do CompareEq(X, 0) - CFA will say that this is a non-
4698 clobbering constant, but constant folding thought it was clobbering
4699 because it saw the String prediction). Second, inlining would crash if
4700 the inline callee had not been compiled. This patch fixes both bugs,
4701 since otherwise run-javascriptcore-tests would report regressions.
4702
4703 * CMakeLists.txt:
4704 * GNUmakefile.list.am:
4705 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
4706 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4707 * JavaScriptCore.xcodeproj/project.pbxproj:
4708 * Target.pri:
4709 * assembler/ARMv7Assembler.h:
4710 (ARMv7Assembler):
4711 (JSC::ARMv7Assembler::ARMv7Assembler):
4712 (JSC::ARMv7Assembler::labelForWatchpoint):
4713 (JSC::ARMv7Assembler::label):
4714 (JSC::ARMv7Assembler::replaceWithJump):
4715 (JSC::ARMv7Assembler::maxJumpReplacementSize):
4716 * assembler/AbstractMacroAssembler.h:
4717 (JSC):
4718 (AbstractMacroAssembler):
4719 (Label):
4720 (JSC::AbstractMacroAssembler::watchpointLabel):
4721 (JSC::AbstractMacroAssembler::readPointer):
4722 * assembler/AssemblerBuffer.h:
4723 * assembler/MacroAssemblerARM.h:
4724 (JSC::MacroAssemblerARM::branchTest8):
4725 (MacroAssemblerARM):
4726 (JSC::MacroAssemblerARM::replaceWithJump):
4727 (JSC::MacroAssemblerARM::maxJumpReplacementSize):
4728 * assembler/MacroAssemblerARMv7.h:
4729 (JSC::MacroAssemblerARMv7::load8Signed):
4730 (JSC::MacroAssemblerARMv7::load16Signed):
4731 (MacroAssemblerARMv7):
4732 (JSC::MacroAssemblerARMv7::replaceWithJump):
4733 (JSC::MacroAssemblerARMv7::maxJumpReplacementSize):
4734 (JSC::MacroAssemblerARMv7::branchTest8):
4735 (JSC::MacroAssemblerARMv7::jump):
4736 (JSC::MacroAssemblerARMv7::makeBranch):
4737 * assembler/MacroAssemblerMIPS.h:
4738 (JSC::MacroAssemblerMIPS::branchTest8):
4739 (MacroAssemblerMIPS):
4740 (JSC::MacroAssemblerMIPS::replaceWithJump):
4741 (JSC::MacroAssemblerMIPS::maxJumpReplacementSize):
4742 * assembler/MacroAssemblerSH4.h:
4743 (JSC::MacroAssemblerSH4::branchTest8):
4744 (MacroAssemblerSH4):
4745 (JSC::MacroAssemblerSH4::replaceWithJump):
4746 (JSC::MacroAssemblerSH4::maxJumpReplacementSize):
4747 * assembler/MacroAssemblerX86.h:
4748 (MacroAssemblerX86):
4749 (JSC::MacroAssemblerX86::branchTest8):
4750 * assembler/MacroAssemblerX86Common.h:
4751 (JSC::MacroAssemblerX86Common::replaceWithJump):
4752 (MacroAssemblerX86Common):
4753 (JSC::MacroAssemblerX86Common::maxJumpReplacementSize):
4754 * assembler/MacroAssemblerX86_64.h:
4755 (MacroAssemblerX86_64):
4756 (JSC::MacroAssemblerX86_64::branchTest8):
4757 * assembler/X86Assembler.h:
4758 (JSC::X86Assembler::X86Assembler):
4759 (X86Assembler):
4760 (JSC::X86Assembler::cmpb_im):
4761 (JSC::X86Assembler::testb_im):
4762 (JSC::X86Assembler::labelForWatchpoint):
4763 (JSC::X86Assembler::label):
4764 (JSC::X86Assembler::replaceWithJump):
4765 (JSC::X86Assembler::maxJumpReplacementSize):
4766 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
4767 * bytecode/CodeBlock.cpp:
4768 (JSC):
4769 (JSC::CodeBlock::printGetByIdCacheStatus):
4770 (JSC::CodeBlock::dump):
4771 * bytecode/CodeBlock.h:
4772 (JSC::CodeBlock::appendOSRExit):
4773 (JSC::CodeBlock::appendSpeculationRecovery):
4774 (CodeBlock):
4775 (JSC::CodeBlock::appendWatchpoint):
4776 (JSC::CodeBlock::numberOfWatchpoints):
4777 (JSC::CodeBlock::watchpoint):
4778 (DFGData):
4779 * bytecode/DFGExitProfile.h:
4780 (JSC::DFG::exitKindToString):
4781 (JSC::DFG::exitKindIsCountable):
4782 * bytecode/GetByIdStatus.cpp:
4783 (JSC::GetByIdStatus::computeForChain):
4784 * bytecode/Instruction.h:
4785 (Instruction):
4786 (JSC::Instruction::Instruction):
4787 * bytecode/Opcode.h:
4788 (JSC):
4789 (JSC::padOpcodeName):
4790 * bytecode/Watchpoint.cpp: Added.
4791 (JSC):
4792 (JSC::Watchpoint::~Watchpoint):
4793 (JSC::Watchpoint::correctLabels):
4794 (JSC::Watchpoint::fire):
4795 (JSC::WatchpointSet::WatchpointSet):
4796 (JSC::WatchpointSet::~WatchpointSet):
4797 (JSC::WatchpointSet::add):
4798 (JSC::WatchpointSet::notifyWriteSlow):
4799 (JSC::WatchpointSet::fireAllWatchpoints):
4800 * bytecode/Watchpoint.h: Added.
4801 (JSC):
4802 (Watchpoint):
4803 (JSC::Watchpoint::Watchpoint):
4804 (JSC::Watchpoint::setDestination):
4805 (WatchpointSet):
4806 (JSC::WatchpointSet::isStillValid):
4807 (JSC::WatchpointSet::hasBeenInvalidated):
4808 (JSC::WatchpointSet::startWatching):
4809 (JSC::WatchpointSet::notifyWrite):
4810 (JSC::WatchpointSet::addressOfIsWatched):
4811 * bytecompiler/BytecodeGenerator.cpp:
4812 (JSC::ResolveResult::checkValidity):
4813 (JSC::BytecodeGenerator::addGlobalVar):
4814 (JSC::BytecodeGenerator::BytecodeGenerator):
4815 (JSC::BytecodeGenerator::resolve):
4816 (JSC::BytecodeGenerator::emitResolve):
4817 (JSC::BytecodeGenerator::emitResolveWithBase):
4818 (JSC::BytecodeGenerator::emitResolveWithThis):
4819 (JSC::BytecodeGenerator::emitGetStaticVar):
4820 (JSC::BytecodeGenerator::emitPutStaticVar):
4821 * bytecompiler/BytecodeGenerator.h:
4822 (BytecodeGenerator):
4823 * bytecompiler/NodesCodegen.cpp:
4824 (JSC::FunctionCallResolveNode::emitBytecode):
4825 (JSC::PostfixResolveNode::emitBytecode):
4826 (JSC::PrefixResolveNode::emitBytecode):
4827 (JSC::ReadModifyResolveNode::emitBytecode):
4828 (JSC::AssignResolveNode::emitBytecode):
4829 (JSC::ConstDeclNode::emitCodeSingle):
4830 * dfg/DFGAbstractState.cpp:
4831 (JSC::DFG::AbstractState::execute):
4832 (JSC::DFG::AbstractState::clobberStructures):
4833 * dfg/DFGAbstractState.h:
4834 (AbstractState):
4835 (JSC::DFG::AbstractState::didClobber):
4836 * dfg/DFGByteCodeParser.cpp:
4837 (JSC::DFG::ByteCodeParser::handleInlining):
4838 (JSC::DFG::ByteCodeParser::parseBlock):
4839 * dfg/DFGCCallHelpers.h:
4840 (CCallHelpers):
4841 (JSC::DFG::CCallHelpers::setupArguments):
4842 * dfg/DFGCSEPhase.cpp:
4843 (JSC::DFG::CSEPhase::globalVarWatchpointElimination):
4844 (CSEPhase):
4845 (JSC::DFG::CSEPhase::globalVarStoreElimination):
4846 (JSC::DFG::CSEPhase::performNodeCSE):
4847 * dfg/DFGCapabilities.h:
4848 (JSC::DFG::canCompileOpcode):
4849 * dfg/DFGConstantFoldingPhase.cpp:
4850 (JSC::DFG::ConstantFoldingPhase::run):
4851 * dfg/DFGCorrectableJumpPoint.h:
4852 (JSC::DFG::CorrectableJumpPoint::isSet):
4853 (CorrectableJumpPoint):
4854 * dfg/DFGJITCompiler.cpp:
4855 (JSC::DFG::JITCompiler::linkOSRExits):
4856 (JSC::DFG::JITCompiler::link):
4857 * dfg/DFGNode.h:
4858 (JSC::DFG::Node::hasIdentifierNumberForCheck):
4859 (Node):
4860 (JSC::DFG::Node::identifierNumberForCheck):
4861 (JSC::DFG::Node::hasRegisterPointer):
4862 * dfg/DFGNodeType.h:
4863 (DFG):
4864 * dfg/DFGOSRExit.cpp:
4865 (JSC::DFG::OSRExit::OSRExit):
4866 * dfg/DFGOSRExit.h:
4867 (OSRExit):
4868 * dfg/DFGOperations.cpp:
4869 * dfg/DFGOperations.h:
4870 * dfg/DFGPredictionPropagationPhase.cpp:
4871 (JSC::DFG::PredictionPropagationPhase::propagate):
4872 * dfg/DFGSpeculativeJIT.h:
4873 (JSC::DFG::SpeculativeJIT::callOperation):
4874 (JSC::DFG::SpeculativeJIT::appendCall):
4875 (SpeculativeJIT):
4876 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
4877 * dfg/DFGSpeculativeJIT32_64.cpp:
4878 (JSC::DFG::SpeculativeJIT::compile):
4879 * dfg/DFGSpeculativeJIT64.cpp:
4880 (JSC::DFG::SpeculativeJIT::compile):
4881 * interpreter/Interpreter.cpp:
4882 (JSC::Interpreter::privateExecute):
4883 * jit/JIT.cpp:
4884 (JSC::JIT::privateCompileMainPass):
4885 (JSC::JIT::privateCompileSlowCases):
4886 * jit/JIT.h:
4887 * jit/JITPropertyAccess.cpp:
4888 (JSC::JIT::emit_op_put_global_var_check):
4889 (JSC):
4890 (JSC::JIT::emitSlow_op_put_global_var_check):
4891 * jit/JITPropertyAccess32_64.cpp:
4892 (JSC::JIT::emit_op_put_global_var_check):
4893 (JSC):
4894 (JSC::JIT::emitSlow_op_put_global_var_check):
4895 * jit/JITStubs.cpp:
4896 (JSC::DEFINE_STUB_FUNCTION):
4897 (JSC):
4898 * jit/JITStubs.h:
4899 * llint/LLIntSlowPaths.cpp:
4900 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
4901 (LLInt):
4902 * llint/LLIntSlowPaths.h:
4903 (LLInt):
4904 * llint/LowLevelInterpreter32_64.asm:
4905 * llint/LowLevelInterpreter64.asm:
4906 * runtime/JSObject.cpp:
4907 (JSC::JSObject::removeDirect):
4908 * runtime/JSObject.h:
4909 (JSObject):
4910 * runtime/JSSymbolTableObject.h:
4911 (JSC::symbolTableGet):
4912 (JSC::symbolTablePut):
4913 (JSC::symbolTablePutWithAttributes):
4914 * runtime/SymbolTable.cpp: Added.
4915 (JSC):
4916 (JSC::SymbolTableEntry::copySlow):
4917 (JSC::SymbolTableEntry::freeFatEntrySlow):
4918 (JSC::SymbolTableEntry::couldBeWatched):
4919 (JSC::SymbolTableEntry::attemptToWatch):
4920 (JSC::SymbolTableEntry::addressOfIsWatched):
4921 (JSC::SymbolTableEntry::addWatchpoint):
4922 (JSC::SymbolTableEntry::notifyWriteSlow):
4923 (JSC::SymbolTableEntry::inflateSlow):
4924 * runtime/SymbolTable.h:
4925 (JSC):
4926 (SymbolTableEntry):
4927 (Fast):
4928 (JSC::SymbolTableEntry::Fast::Fast):
4929 (JSC::SymbolTableEntry::Fast::isNull):
4930 (JSC::SymbolTableEntry::Fast::getIndex):
4931 (JSC::SymbolTableEntry::Fast::isReadOnly):
4932 (JSC::SymbolTableEntry::Fast::getAttributes):
4933 (JSC::SymbolTableEntry::Fast::isFat):
4934 (JSC::SymbolTableEntry::SymbolTableEntry):
4935 (JSC::SymbolTableEntry::~SymbolTableEntry):
4936 (JSC::SymbolTableEntry::operator=):
4937 (JSC::SymbolTableEntry::isNull):
4938 (JSC::SymbolTableEntry::getIndex):
4939 (JSC::SymbolTableEntry::getFast):
4940 (JSC::SymbolTableEntry::getAttributes):
4941 (JSC::SymbolTableEntry::isReadOnly):
4942 (JSC::SymbolTableEntry::watchpointSet):
4943 (JSC::SymbolTableEntry::notifyWrite):
4944 (FatEntry):
4945 (JSC::SymbolTableEntry::FatEntry::FatEntry):
4946 (JSC::SymbolTableEntry::isFat):
4947 (JSC::SymbolTableEntry::fatEntry):
4948 (JSC::SymbolTableEntry::inflate):
4949 (JSC::SymbolTableEntry::bits):
4950 (JSC::SymbolTableEntry::freeFatEntry):
4951 (JSC::SymbolTableEntry::pack):
4952 (JSC::SymbolTableEntry::isValidIndex):
4953
zandobersek@gmail.com88d53732012-06-13 09:38:42 +000049542012-06-13 Sheriff Bot <webkit.review.bot@gmail.com>
4955
4956 Unreviewed, rolling out r120172.
4957 http://trac.webkit.org/changeset/120172
4958 https://bugs.webkit.org/show_bug.cgi?id=88976
4959
4960 The patch causes compilation failures on Gtk, Qt and Apple Win
4961 bots (Requested by zdobersek on #webkit).
4962
4963 * CMakeLists.txt:
4964 * GNUmakefile.list.am:
4965 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
4966 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4967 * JavaScriptCore.xcodeproj/project.pbxproj:
4968 * Target.pri:
4969 * assembler/ARMv7Assembler.h:
4970 (JSC::ARMv7Assembler::nop):
4971 (JSC::ARMv7Assembler::label):
4972 (JSC::ARMv7Assembler::readPointer):
4973 (ARMv7Assembler):
4974 * assembler/AbstractMacroAssembler.h:
4975 (JSC):
4976 (AbstractMacroAssembler):
4977 (Label):
4978 * assembler/AssemblerBuffer.h:
4979 * assembler/MacroAssemblerARM.h:
4980 * assembler/MacroAssemblerARMv7.h:
4981 (JSC::MacroAssemblerARMv7::nop):
4982 (JSC::MacroAssemblerARMv7::jump):
4983 (JSC::MacroAssemblerARMv7::makeBranch):
4984 * assembler/MacroAssemblerMIPS.h:
4985 * assembler/MacroAssemblerSH4.h:
4986 * assembler/MacroAssemblerX86.h:
4987 (MacroAssemblerX86):
4988 (JSC::MacroAssemblerX86::moveWithPatch):
4989 * assembler/MacroAssemblerX86Common.h:
4990 * assembler/MacroAssemblerX86_64.h:
4991 (JSC::MacroAssemblerX86_64::branchTest8):
4992 * assembler/X86Assembler.h:
4993 (JSC::X86Assembler::cmpb_im):
4994 (JSC::X86Assembler::codeSize):
4995 (JSC::X86Assembler::label):
4996 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
4997 * bytecode/CodeBlock.cpp:
4998 (JSC::CodeBlock::dump):
4999 * bytecode/CodeBlock.h:
5000 (JSC::CodeBlock::appendOSRExit):
5001 (JSC::CodeBlock::appendSpeculationRecovery):
5002 (DFGData):
5003 * bytecode/DFGExitProfile.h:
5004 (JSC::DFG::exitKindToString):
5005 (JSC::DFG::exitKindIsCountable):
5006 * bytecode/Instruction.h:
5007 * bytecode/Opcode.h:
5008 (JSC):
5009 (JSC::padOpcodeName):
5010 * bytecode/Watchpoint.cpp: Removed.
5011 * bytecode/Watchpoint.h: Removed.
5012 * bytecompiler/BytecodeGenerator.cpp:
5013 (JSC::ResolveResult::checkValidity):
5014 (JSC::BytecodeGenerator::addGlobalVar):
5015 (JSC::BytecodeGenerator::BytecodeGenerator):
5016 (JSC::BytecodeGenerator::resolve):
5017 (JSC::BytecodeGenerator::emitResolve):
5018 (JSC::BytecodeGenerator::emitResolveWithBase):
5019 (JSC::BytecodeGenerator::emitResolveWithThis):
5020 (JSC::BytecodeGenerator::emitGetStaticVar):
5021 (JSC::BytecodeGenerator::emitPutStaticVar):
5022 * bytecompiler/BytecodeGenerator.h:
5023 (BytecodeGenerator):
5024 * bytecompiler/NodesCodegen.cpp:
5025 (JSC::FunctionCallResolveNode::emitBytecode):
5026 (JSC::PostfixResolveNode::emitBytecode):
5027 (JSC::PrefixResolveNode::emitBytecode):
5028 (JSC::ReadModifyResolveNode::emitBytecode):
5029 (JSC::AssignResolveNode::emitBytecode):
5030 (JSC::ConstDeclNode::emitCodeSingle):
5031 * dfg/DFGAbstractState.cpp:
5032 (JSC::DFG::AbstractState::execute):
5033 (JSC::DFG::AbstractState::clobberStructures):
5034 * dfg/DFGAbstractState.h:
5035 (AbstractState):
5036 * dfg/DFGByteCodeParser.cpp:
5037 (JSC::DFG::ByteCodeParser::handleInlining):
5038 (JSC::DFG::ByteCodeParser::parseBlock):
5039 * dfg/DFGCCallHelpers.h:
5040 (JSC::DFG::CCallHelpers::setupArguments):
5041 * dfg/DFGCSEPhase.cpp:
5042 (JSC::DFG::CSEPhase::globalVarStoreElimination):
5043 (JSC::DFG::CSEPhase::performNodeCSE):
5044 * dfg/DFGCapabilities.h:
5045 (JSC::DFG::canCompileOpcode):
5046 * dfg/DFGConstantFoldingPhase.cpp:
5047 (JSC::DFG::ConstantFoldingPhase::run):
5048 * dfg/DFGCorrectableJumpPoint.h:
5049 * dfg/DFGJITCompiler.cpp:
5050 (JSC::DFG::JITCompiler::linkOSRExits):
5051 (JSC::DFG::JITCompiler::link):
5052 * dfg/DFGNode.h:
5053 (JSC::DFG::Node::hasRegisterPointer):
5054 * dfg/DFGNodeType.h:
5055 (DFG):
5056 * dfg/DFGOSRExit.cpp:
5057 (JSC::DFG::OSRExit::OSRExit):
5058 * dfg/DFGOSRExit.h:
5059 (OSRExit):
5060 * dfg/DFGOperations.cpp:
5061 * dfg/DFGOperations.h:
5062 * dfg/DFGPredictionPropagationPhase.cpp:
5063 (JSC::DFG::PredictionPropagationPhase::propagate):
5064 * dfg/DFGSpeculativeJIT.h:
5065 (JSC::DFG::SpeculativeJIT::callOperation):
5066 (JSC::DFG::SpeculativeJIT::appendCallSetResult):
5067 (JSC::DFG::SpeculativeJIT::speculationCheck):
5068 * dfg/DFGSpeculativeJIT32_64.cpp:
5069 (JSC::DFG::SpeculativeJIT::compile):
5070 * dfg/DFGSpeculativeJIT64.cpp:
5071 (JSC::DFG::SpeculativeJIT::compile):
5072 * jit/JIT.cpp:
5073 (JSC::JIT::privateCompileMainPass):
5074 (JSC::JIT::privateCompileSlowCases):
5075 * jit/JIT.h:
5076 * jit/JITPropertyAccess.cpp:
5077 * jit/JITPropertyAccess32_64.cpp:
5078 * jit/JITStubs.cpp:
5079 * jit/JITStubs.h:
5080 * llint/LLIntSlowPaths.cpp:
5081 * llint/LLIntSlowPaths.h:
5082 (LLInt):
5083 * llint/LowLevelInterpreter32_64.asm:
5084 * llint/LowLevelInterpreter64.asm:
5085 * runtime/JSObject.cpp:
5086 (JSC::JSObject::removeDirect):
5087 * runtime/JSObject.h:
5088 (JSObject):
5089 * runtime/JSSymbolTableObject.h:
5090 (JSC::symbolTableGet):
5091 (JSC::symbolTablePut):
5092 (JSC::symbolTablePutWithAttributes):
5093 * runtime/SymbolTable.cpp: Removed.
5094 * runtime/SymbolTable.h:
5095 (JSC):
5096 (JSC::SymbolTableEntry::isNull):
5097 (JSC::SymbolTableEntry::getIndex):
5098 (SymbolTableEntry):
5099 (JSC::SymbolTableEntry::getAttributes):
5100 (JSC::SymbolTableEntry::isReadOnly):
5101 (JSC::SymbolTableEntry::pack):
5102 (JSC::SymbolTableEntry::isValidIndex):
5103
fpizlo@apple.com3bdd4c92012-06-13 04:56:22 +000051042012-06-12 Filip Pizlo <fpizlo@apple.com>
5105
fpizlo@apple.comb6c5eeb2012-06-13 08:20:39 +00005106 DFG should be able to set watchpoints on global variables
5107 https://bugs.webkit.org/show_bug.cgi?id=88692
5108
5109 Reviewed by Geoffrey Garen.
5110
5111 This implements global variable constant folding by allowing the optimizing
5112 compiler to set a "watchpoint" on globals that it wishes to constant fold.
5113 If the watchpoint fires, then an OSR exit is forced by overwriting the
5114 machine code that the optimizing compiler generated with a jump.
5115
5116 As such, this patch is adding quite a bit of stuff:
5117
5118 - Jump replacement on those hardware targets supported by the optimizing
5119 JIT. It is now possible to patch in a jump instruction over any recorded
5120 watchpoint label. The jump must be "local" in the sense that it must be
5121 within the range of the largest jump distance supported by a one
5122 instruction jump.
5123
5124 - WatchpointSets and Watchpoints. A Watchpoint is a doubly-linked list node
5125 that records the location where a jump must be inserted and the
5126 destination to which it should jump. Watchpoints can be added to a
5127 WatchpointSet. The WatchpointSet can be fired all at once, which plants
5128 all jumps. WatchpointSet also remembers if it had ever been invalidated,
5129 which allows for monotonicity: we typically don't want to optimize using
5130 watchpoints on something for which watchpoints had previously fired. The
5131 act of notifying a WatchpointSet has a trivial fast path in case no
5132 Watchpoints are registered (one-byte load+branch).
5133
5134 - SpeculativeJIT::speculationWatchpoint(). It's like speculationCheck(),
5135 except that you don't have to emit branches. But, you need to know what
5136 WatchpointSet to add the resulting Watchpoint to. Not everything that
5137 you could write a speculationCheck() for will have a WatchpointSet that
5138 would get notified if the condition you were speculating against became
5139 invalid.
5140
5141 - SymbolTableEntry now has the ability to refer to a WatchpointSet. It can
5142 do so without incurring any space overhead for those entries that don't
5143 have WatchpointSets.
5144
5145 - The bytecode generator infers all global function variables to be
5146 watchable, and makes all stores perform the WatchpointSet's write check,
5147 and marks all loads as being potentially watchable (i.e. you can compile
5148 them to a watchpoint and a constant).
5149
5150 Put together, this allows for fully sleazy inlining of calls to globally
5151 declared functions. The inline prologue will no longer contain the load of
5152 the function, or any checks of the function you're calling. I.e. it's
5153 pretty much like the kind of inlining you would see in Java or C++.
5154 Furthermore, the watchpointing functionality is built to be fairly general,
5155 and should allow setting watchpoints on all sorts of interesting things
5156 in the future.
5157
5158 The sleazy inlining means that we will now sometimes inline in code paths
5159 that have never executed. Previously, to inline we would have either had
5160 to have executed the call (to read the call's inline cache) or have
5161 executed the method check (to read the method check's inline cache). Now,
5162 we might inline when the callee is a watched global variable. This
5163 revealed some humorous bugs. First, constant folding disagreed with CFA
5164 over what kinds of operations can clobber (example: code path A is dead
5165 but stores a String into variable X, all other code paths store 0 into
5166 X, and then you do CompareEq(X, 0) - CFA will say that this is a non-
5167 clobbering constant, but constant folding thought it was clobbering
5168 because it saw the String prediction). Second, inlining would crash if
5169 the inline callee had not been compiled. This patch fixes both bugs,
5170 since otherwise run-javascriptcore-tests would report regressions.
5171
5172 * CMakeLists.txt:
5173 * GNUmakefile.list.am:
5174 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
5175 * JavaScriptCore.xcodeproj/project.pbxproj:
5176 * Target.pri:
5177 * assembler/ARMv7Assembler.h:
5178 (ARMv7Assembler):
5179 (JSC::ARMv7Assembler::ARMv7Assembler):
5180 (JSC::ARMv7Assembler::labelForWatchpoint):
5181 (JSC::ARMv7Assembler::label):
5182 (JSC::ARMv7Assembler::replaceWithJump):
5183 (JSC::ARMv7Assembler::maxJumpReplacementSize):
5184 * assembler/AbstractMacroAssembler.h:
5185 (JSC):
5186 (AbstractMacroAssembler):
5187 (Label):
5188 (JSC::AbstractMacroAssembler::watchpointLabel):
5189 * assembler/AssemblerBuffer.h:
5190 * assembler/MacroAssemblerARM.h:
5191 (JSC::MacroAssemblerARM::replaceWithJump):
5192 (MacroAssemblerARM):
5193 (JSC::MacroAssemblerARM::maxJumpReplacementSize):
5194 * assembler/MacroAssemblerARMv7.h:
5195 (MacroAssemblerARMv7):
5196 (JSC::MacroAssemblerARMv7::replaceWithJump):
5197 (JSC::MacroAssemblerARMv7::maxJumpReplacementSize):
5198 (JSC::MacroAssemblerARMv7::branchTest8):
5199 (JSC::MacroAssemblerARMv7::jump):
5200 (JSC::MacroAssemblerARMv7::makeBranch):
5201 * assembler/MacroAssemblerMIPS.h:
5202 (JSC::MacroAssemblerMIPS::replaceWithJump):
5203 (MacroAssemblerMIPS):
5204 (JSC::MacroAssemblerMIPS::maxJumpReplacementSize):
5205 * assembler/MacroAssemblerSH4.h:
5206 (JSC::MacroAssemblerSH4::replaceWithJump):
5207 (MacroAssemblerSH4):
5208 (JSC::MacroAssemblerSH4::maxJumpReplacementSize):
5209 * assembler/MacroAssemblerX86.h:
5210 (MacroAssemblerX86):
5211 (JSC::MacroAssemblerX86::branchTest8):
5212 * assembler/MacroAssemblerX86Common.h:
5213 (JSC::MacroAssemblerX86Common::replaceWithJump):
5214 (MacroAssemblerX86Common):
5215 (JSC::MacroAssemblerX86Common::maxJumpReplacementSize):
5216 * assembler/MacroAssemblerX86_64.h:
5217 (MacroAssemblerX86_64):
5218 (JSC::MacroAssemblerX86_64::branchTest8):
5219 * assembler/X86Assembler.h:
5220 (JSC::X86Assembler::X86Assembler):
5221 (X86Assembler):
5222 (JSC::X86Assembler::cmpb_im):
5223 (JSC::X86Assembler::testb_im):
5224 (JSC::X86Assembler::labelForWatchpoint):
5225 (JSC::X86Assembler::label):
5226 (JSC::X86Assembler::replaceWithJump):
5227 (JSC::X86Assembler::maxJumpReplacementSize):
5228 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
5229 * bytecode/CodeBlock.cpp:
5230 (JSC::CodeBlock::dump):
5231 * bytecode/CodeBlock.h:
5232 (JSC::CodeBlock::appendOSRExit):
5233 (JSC::CodeBlock::appendSpeculationRecovery):
5234 (CodeBlock):
5235 (JSC::CodeBlock::appendWatchpoint):
5236 (JSC::CodeBlock::numberOfWatchpoints):
5237 (JSC::CodeBlock::watchpoint):
5238 (DFGData):
5239 * bytecode/DFGExitProfile.h:
5240 (JSC::DFG::exitKindToString):
5241 (JSC::DFG::exitKindIsCountable):
5242 * bytecode/Instruction.h:
5243 (Instruction):
5244 (JSC::Instruction::Instruction):
5245 * bytecode/Opcode.h:
5246 (JSC):
5247 (JSC::padOpcodeName):
5248 * bytecode/Watchpoint.cpp: Added.
5249 (JSC):
5250 (JSC::Watchpoint::~Watchpoint):
5251 (JSC::Watchpoint::correctLabels):
5252 (JSC::Watchpoint::fire):
5253 (JSC::WatchpointSet::WatchpointSet):
5254 (JSC::WatchpointSet::~WatchpointSet):
5255 (JSC::WatchpointSet::add):
5256 (JSC::WatchpointSet::notifyWriteSlow):
5257 (JSC::WatchpointSet::fireAllWatchpoints):
5258 * bytecode/Watchpoint.h: Added.
5259 (JSC):
5260 (Watchpoint):
5261 (JSC::Watchpoint::Watchpoint):
5262 (JSC::Watchpoint::setDestination):
5263 (WatchpointSet):
5264 (JSC::WatchpointSet::isStillValid):
5265 (JSC::WatchpointSet::hasBeenInvalidated):
5266 (JSC::WatchpointSet::startWatching):
5267 (JSC::WatchpointSet::notifyWrite):
5268 (JSC::WatchpointSet::addressOfIsWatched):
5269 * bytecompiler/BytecodeGenerator.cpp:
5270 (JSC::ResolveResult::checkValidity):
5271 (JSC::BytecodeGenerator::addGlobalVar):
5272 (JSC::BytecodeGenerator::BytecodeGenerator):
5273 (JSC::BytecodeGenerator::resolve):
5274 (JSC::BytecodeGenerator::emitResolve):
5275 (JSC::BytecodeGenerator::emitResolveWithBase):
5276 (JSC::BytecodeGenerator::emitResolveWithThis):
5277 (JSC::BytecodeGenerator::emitGetStaticVar):
5278 (JSC::BytecodeGenerator::emitPutStaticVar):
5279 * bytecompiler/BytecodeGenerator.h:
5280 (BytecodeGenerator):
5281 * bytecompiler/NodesCodegen.cpp:
5282 (JSC::FunctionCallResolveNode::emitBytecode):
5283 (JSC::PostfixResolveNode::emitBytecode):
5284 (JSC::PrefixResolveNode::emitBytecode):
5285 (JSC::ReadModifyResolveNode::emitBytecode):
5286 (JSC::AssignResolveNode::emitBytecode):
5287 (JSC::ConstDeclNode::emitCodeSingle):
5288 * dfg/DFGAbstractState.cpp:
5289 (JSC::DFG::AbstractState::execute):
5290 (JSC::DFG::AbstractState::clobberStructures):
5291 * dfg/DFGAbstractState.h:
5292 (AbstractState):
5293 (JSC::DFG::AbstractState::didClobber):
5294 * dfg/DFGByteCodeParser.cpp:
5295 (JSC::DFG::ByteCodeParser::handleInlining):
5296 (JSC::DFG::ByteCodeParser::parseBlock):
5297 * dfg/DFGCCallHelpers.h:
5298 (CCallHelpers):
5299 (JSC::DFG::CCallHelpers::setupArguments):
5300 * dfg/DFGCSEPhase.cpp:
5301 (JSC::DFG::CSEPhase::globalVarWatchpointElimination):
5302 (CSEPhase):
5303 (JSC::DFG::CSEPhase::globalVarStoreElimination):
5304 (JSC::DFG::CSEPhase::performNodeCSE):
5305 * dfg/DFGCapabilities.h:
5306 (JSC::DFG::canCompileOpcode):
5307 * dfg/DFGConstantFoldingPhase.cpp:
5308 (JSC::DFG::ConstantFoldingPhase::run):
5309 * dfg/DFGCorrectableJumpPoint.h:
5310 (JSC::DFG::CorrectableJumpPoint::isSet):
5311 (CorrectableJumpPoint):
5312 * dfg/DFGJITCompiler.cpp:
5313 (JSC::DFG::JITCompiler::linkOSRExits):
5314 (JSC::DFG::JITCompiler::link):
5315 * dfg/DFGNode.h:
5316 (JSC::DFG::Node::hasIdentifierNumberForCheck):
5317 (Node):
5318 (JSC::DFG::Node::identifierNumberForCheck):
5319 (JSC::DFG::Node::hasRegisterPointer):
5320 * dfg/DFGNodeType.h:
5321 (DFG):
5322 * dfg/DFGOSRExit.cpp:
5323 (JSC::DFG::OSRExit::OSRExit):
5324 * dfg/DFGOSRExit.h:
5325 (OSRExit):
5326 * dfg/DFGOperations.cpp:
5327 * dfg/DFGOperations.h:
5328 * dfg/DFGPredictionPropagationPhase.cpp:
5329 (JSC::DFG::PredictionPropagationPhase::propagate):
5330 * dfg/DFGSpeculativeJIT.h:
5331 (JSC::DFG::SpeculativeJIT::callOperation):
5332 (JSC::DFG::SpeculativeJIT::appendCall):
5333 (SpeculativeJIT):
5334 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
5335 * dfg/DFGSpeculativeJIT32_64.cpp:
5336 (JSC::DFG::SpeculativeJIT::compile):
5337 * dfg/DFGSpeculativeJIT64.cpp:
5338 (JSC::DFG::SpeculativeJIT::compile):
5339 * jit/JIT.cpp:
5340 (JSC::JIT::privateCompileMainPass):
5341 (JSC::JIT::privateCompileSlowCases):
5342 * jit/JIT.h:
5343 * jit/JITPropertyAccess.cpp:
5344 (JSC::JIT::emit_op_put_global_var_check):
5345 (JSC):
5346 (JSC::JIT::emitSlow_op_put_global_var_check):
5347 * jit/JITPropertyAccess32_64.cpp:
5348 (JSC::JIT::emit_op_put_global_var_check):
5349 (JSC):
5350 (JSC::JIT::emitSlow_op_put_global_var_check):
5351 * jit/JITStubs.cpp:
5352 (JSC::JITThunks::JITThunks):
5353 (JSC::DEFINE_STUB_FUNCTION):
5354 (JSC):
5355 * jit/JITStubs.h:
5356 * llint/LLIntSlowPaths.cpp:
5357 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
5358 (LLInt):
5359 * llint/LLIntSlowPaths.h:
5360 (LLInt):
5361 * llint/LowLevelInterpreter32_64.asm:
5362 * llint/LowLevelInterpreter64.asm:
5363 * runtime/JSObject.cpp:
5364 (JSC::JSObject::removeDirect):
5365 * runtime/JSObject.h:
5366 (JSObject):
5367 * runtime/JSSymbolTableObject.h:
5368 (JSC::symbolTableGet):
5369 (JSC::symbolTablePut):
5370 (JSC::symbolTablePutWithAttributes):
5371 * runtime/SymbolTable.cpp: Added.
5372 (JSC):
5373 (JSC::SymbolTableEntry::copySlow):
5374 (JSC::SymbolTableEntry::freeFatEntrySlow):
5375 (JSC::SymbolTableEntry::couldBeWatched):
5376 (JSC::SymbolTableEntry::attemptToWatch):
5377 (JSC::SymbolTableEntry::addressOfIsWatched):
5378 (JSC::SymbolTableEntry::addWatchpoint):
5379 (JSC::SymbolTableEntry::notifyWriteSlow):
5380 (JSC::SymbolTableEntry::inflateSlow):
5381 * runtime/SymbolTable.h:
5382 (JSC):
5383 (SymbolTableEntry):
5384 (Fast):
5385 (JSC::SymbolTableEntry::Fast::Fast):
5386 (JSC::SymbolTableEntry::Fast::isNull):
5387 (JSC::SymbolTableEntry::Fast::getIndex):
5388 (JSC::SymbolTableEntry::Fast::isReadOnly):
5389 (JSC::SymbolTableEntry::Fast::getAttributes):
5390 (JSC::SymbolTableEntry::Fast::isFat):
5391 (JSC::SymbolTableEntry::SymbolTableEntry):
5392 (JSC::SymbolTableEntry::~SymbolTableEntry):
5393 (JSC::SymbolTableEntry::operator=):
5394 (JSC::SymbolTableEntry::isNull):
5395 (JSC::SymbolTableEntry::getIndex):
5396 (JSC::SymbolTableEntry::getFast):
5397 (JSC::SymbolTableEntry::getAttributes):
5398 (JSC::SymbolTableEntry::isReadOnly):
5399 (JSC::SymbolTableEntry::watchpointSet):
5400 (JSC::SymbolTableEntry::notifyWrite):
5401 (FatEntry):
5402 (JSC::SymbolTableEntry::FatEntry::FatEntry):
5403 (JSC::SymbolTableEntry::isFat):
5404 (JSC::SymbolTableEntry::fatEntry):
5405 (JSC::SymbolTableEntry::inflate):
5406 (JSC::SymbolTableEntry::bits):
5407 (JSC::SymbolTableEntry::freeFatEntry):
5408 (JSC::SymbolTableEntry::pack):
5409 (JSC::SymbolTableEntry::isValidIndex):
5410
54112012-06-12 Filip Pizlo <fpizlo@apple.com>
5412
fpizlo@apple.com3bdd4c92012-06-13 04:56:22 +00005413 Unreviewed build fix for ARMv7 debug builds.
5414
5415 * jit/JITStubs.cpp:
5416 (JSC::JITThunks::JITThunks):
5417
ggaren@apple.com3c89f392012-06-13 02:50:50 +000054182012-06-12 Geoffrey Garen <ggaren@apple.com>
5419
5420 Build fix for case-sensitive file systems: use the right case.
5421
5422 * heap/ListableHandler.h:
5423
ggaren@apple.com639160c2012-06-13 02:06:50 +000054242012-06-11 Geoffrey Garen <ggaren@apple.com>
5425
5426 GC should be 1.7X faster
5427 https://bugs.webkit.org/show_bug.cgi?id=88840
5428
5429 Reviewed by Oliver Hunt.
5430
5431 I profiled, and removed anything that showed up as a concurrency
5432 bottleneck. Then, I added 3 threads to our max thread count, since we
5433 can scale up to more threads now.
5434
5435 * heap/BlockAllocator.cpp:
5436 (JSC::BlockAllocator::BlockAllocator):
5437 (JSC::BlockAllocator::~BlockAllocator):
5438 (JSC::BlockAllocator::releaseFreeBlocks):
5439 (JSC::BlockAllocator::waitForRelativeTimeWhileHoldingLock):
5440 (JSC::BlockAllocator::waitForRelativeTime):
5441 (JSC::BlockAllocator::blockFreeingThreadMain):
5442 * heap/BlockAllocator.h:
5443 (BlockAllocator):
5444 (JSC::BlockAllocator::allocate):
5445 (JSC::BlockAllocator::deallocate): Use a spin lock for the common case
5446 where we're just popping a linked list. (A pthread mutex would sleep our
5447 thread even if the lock were only contended for a microsecond.)
5448
5449 Scope the lock to avoid holding it while allocating VM, since that's a
5450 slow activity and it doesn't modify any of our data structures.
5451
5452 We still use a pthread mutex to handle our condition variable since we
5453 have to, and it's not a hot path.
5454
5455 * heap/CopiedSpace.cpp:
5456 (JSC::CopiedSpace::CopiedSpace):
5457 (JSC::CopiedSpace::doneFillingBlock):
5458 * heap/CopiedSpace.h:
5459 (JSC::CopiedSpace::CopiedSpace): Use a spin lock for the to space lock,
5460 since it just guards linked list and hash table manipulation.
5461
5462 * heap/MarkStack.cpp:
5463 (JSC::MarkStackSegmentAllocator::MarkStackSegmentAllocator):
5464 (JSC::MarkStackSegmentAllocator::allocate):
5465 (JSC::MarkStackSegmentAllocator::release):
5466 (JSC::MarkStackSegmentAllocator::shrinkReserve): Use a spin lock, since
5467 we're just managing a linked list.
5468
5469 (JSC::MarkStackArray::donateSomeCellsTo): Changed donation to be proportional
5470 to our current stack size. This fixes cases where we used to donate too
5471 much. Interestingly, donating too much was starving the donor (when it
5472 ran out of work later) *and* the recipient (since it had to wait on a
5473 long donation operation to complete before it could acquire the lock).
5474
5475 In the worst case, we're still guaranteed to donate N cells in roughly log N time.
5476
5477 This change also fixes cases where we used to donate too little, since
5478 we would always keep a fixed minimum number of cells. In the worst case,
5479 with N marking threads, would could have N large object graph roots in
5480 our stack for the duration of GC, and scale to only 1 thread.
5481
5482 It's an interesting observation that a single object in the mark stack
5483 might represent an arbitrarily large object graph -- and only the act
5484 of marking can find out.
5485
5486 (JSC::MarkStackArray::stealSomeCellsFrom): Steal in proportion to idle
5487 threads. Once again, this fixes cases where constants could cause us
5488 to steal too much or too little.
5489
5490 (JSC::SlotVisitor::donateKnownParallel): Always wake up other threads
5491 if they're idle. We can afford to do this because we're conservative
5492 about when we donate.
5493
5494 (JSC::SlotVisitor::drainFromShared):
5495 * heap/MarkStack.h:
5496 (MarkStackSegmentAllocator):
5497 (MarkStackArray):
5498 (JSC):
5499 * heap/SlotVisitor.h: Merged the "should I donate?" decision into a
5500 single function, for simplicity.
5501
5502 * runtime/Options.cpp:
5503 (minimumNumberOfScansBetweenRebalance): Reduced the delay before donation
5504 a lot. We can afford to do this because, in the common case, donation is
5505 a single branch that decides not to donate.
5506
5507 (cpusToUse): Use more CPUs now, since we scale better now.
5508
5509 * runtime/Options.h:
5510 (Options): Removed now-unused variables.
5511
fpizlo@apple.com53ef1042012-06-13 01:29:07 +000055122012-06-12 Filip Pizlo <fpizlo@apple.com>
5513
5514 REGRESSION(120121): inspector tests crash in DFG
5515 https://bugs.webkit.org/show_bug.cgi?id=88941
5516
5517 Reviewed by Geoffrey Garen.
5518
5519 The CFG simplifier has two different ways of fixing up GetLocal, Phantom, and Flush. If we've
5520 already fixed up the node one way, we shouldn't try the other way. The reason why we shouldn't
5521 is that the second way depends on the node referring to other nodes in the to-be-jettisoned
5522 block. After fixup they potentially will refer to nodes in the block being merged to.
5523
5524 * dfg/DFGCFGSimplificationPhase.cpp:
5525 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
5526 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
5527
leo.yang@torchmobile.com.cneac79cd2012-06-13 00:23:49 +000055282012-06-12 Leo Yang <leo.yang@torchmobile.com.cn>
5529
5530 Dynamic hash table in DOMObjectHashTableMap is wrong in multiple threads
5531 https://bugs.webkit.org/show_bug.cgi?id=87334
5532
5533 Reviewed by Geoffrey Garen.
5534
5535 Add a copy member function to JSC::HasTable. This function will copy all data
5536 members except for *table* which contains thread specific data that prevents
5537 up copying it. When you want to copy a JSC::HashTable that was constructed
5538 on another thread you should call JSC::HashTable::copy().
5539
5540 * runtime/Lookup.h:
5541 (JSC::HashTable::copy):
5542 (HashTable):
5543
fpizlo@apple.comdfd92802012-06-12 21:15:43 +000055442012-06-12 Filip Pizlo <fpizlo@apple.com>
5545
fpizlo@apple.com888325a2012-06-12 23:16:51 +00005546 DFG should not ASSERT if you have a double use of a variable that is not revealed to be a double
5547 until after CFG simplification
5548 https://bugs.webkit.org/show_bug.cgi?id=88927
5549 <rdar://problem/11513971>
5550
5551 Reviewed by Geoffrey Garen.
5552
5553 Speculation fixup needs to run if simplification did things, because simplification can change
5554 predictions - particularly if you had a control flow path that stored weird things into a
5555 variable, but that path got axed by the simplifier.
5556
5557 Running fixup in the fixpoint requires making it idempotent, which it previously wasn't. Only
5558 one place needed to be changed, namely the un-MustGenerate-ion of ValueToInt32.
5559
5560 * dfg/DFGDriver.cpp:
5561 (JSC::DFG::compile):
5562 * dfg/DFGFixupPhase.cpp:
5563 (JSC::DFG::FixupPhase::fixupNode):
5564
55652012-06-12 Filip Pizlo <fpizlo@apple.com>
5566
fpizlo@apple.comdfd92802012-06-12 21:15:43 +00005567 REGRESSION (r119779): Javascript TypeError: 'undefined' is not an object
5568 https://bugs.webkit.org/show_bug.cgi?id=88783
5569 <rdar://problem/11640299>
5570
5571 Reviewed by Geoffrey Garen.
5572
5573 If you don't keep alive the base of an object access over the various checks
5574 you do for the prototype chain, you're going to have a bad time.
5575
5576 * dfg/DFGByteCodeParser.cpp:
5577 (JSC::DFG::ByteCodeParser::handleGetById):
5578
commit-queue@webkit.orgce7e7ef2012-06-12 07:08:14 +000055792012-06-12 Hojong Han <hojong.han@samsung.com>
5580
5581 Property names of the built-in object cannot be retrieved
5582 after trying to delete one of its properties
5583 https://bugs.webkit.org/show_bug.cgi?id=86461
5584
5585 Reviewed by Gavin Barraclough.
5586
5587 * runtime/JSObject.cpp:
5588 (JSC::getClassPropertyNames):
5589 (JSC::JSObject::getOwnPropertyNames):
5590
gyuyoung.kim@samsung.com7a201592012-06-12 00:58:24 +000055912012-06-11 Gyuyoung Kim <gyuyoung.kim@samsung.com>
5592
5593 [CMAKE][EFL] Remove duplicated executable output path
5594 https://bugs.webkit.org/show_bug.cgi?id=88765
5595
5596 Reviewed by Daniel Bates.
5597
5598 CMake files for EFL port have redefined executable output path. However, EFL port doesn't
5599 need to define again because it is already defined in top-level CMake file.
5600
5601 * shell/CMakeLists.txt:
5602
carlosgc@webkit.orgf4fbe002012-06-11 15:31:19 +000056032012-06-11 Carlos Garcia Campos <cgarcia@igalia.com>
5604
5605 Unreviewed. Fix make distcheck issues.
5606
5607 * GNUmakefile.list.am: Remove non existent header file.
5608
paroga@webkit.org7a01e282012-06-10 12:25:57 +000056092012-06-10 Patrick Gansterer <paroga@webkit.org>
5610
paroga@webkit.orga601a8b2012-06-10 12:49:32 +00005611 Unreviewed. Build fix for !ENABLE(JIT) after r119844 and r119925.
5612
5613 * runtime/Executable.h:
5614 (ExecutableBase):
5615 (JSC::ExecutableBase::clearCodeVirtual):
5616
56172012-06-10 Patrick Gansterer <paroga@webkit.org>
5618
paroga@webkit.org7a01e282012-06-10 12:25:57 +00005619 Unreviewed. Build fix for !ENABLE(JIT) after r119844.
5620
5621 * runtime/Executable.h:
5622 (ExecutableBase):
5623 (JSC):
5624
dominicc@chromium.org2a95e332012-06-10 06:31:14 +000056252012-06-09 Dominic Cooney <dominicc@chromium.org>
5626
5627 [Chromium] Remove JavaScriptCore dependencies from gyp
5628 https://bugs.webkit.org/show_bug.cgi?id=88510
5629
5630 Reviewed by Adam Barth.
5631
5632 Chromium doesn't support JSC any more and there doesn't seem to be
5633 a strong interest in using GYP as the common build system in other
5634 ports.
5635
5636 * JavaScriptCore.gyp/JavaScriptCore.gyp: WebCore still depends on YARR interpreter.
5637 * JavaScriptCore.gypi: Only include YARR source.
5638 * gyp/JavaScriptCore.gyp: Removed.
5639 * gyp/gtk.gyp: Removed.
5640
ggaren@apple.com642da3e2012-06-09 17:34:30 +000056412012-06-09 Geoffrey Garen <ggaren@apple.com>
5642
5643 Unreviewed, rolling back in part2 of r118646.
5644
5645 This patch removes eager finalization.
5646
5647 Weak pointer finalization should be lazy
5648 https://bugs.webkit.org/show_bug.cgi?id=87599
5649
5650 Reviewed by Sam Weinig.
5651
5652 * heap/Heap.cpp:
5653 (JSC::Heap::collect): Don't finalize eagerly -- we'll do it lazily.
5654
5655 * heap/MarkedBlock.cpp:
5656 (JSC::MarkedBlock::sweep): Do sweep weak sets when sweeping a block,
5657 since we won't get another chance.
5658
5659 * heap/MarkedBlock.h:
5660 (JSC::MarkedBlock::sweepWeakSet):
5661 * heap/MarkedSpace.cpp:
5662 (MarkedSpace::WeakSetSweep):
5663 * heap/MarkedSpace.h:
5664 (JSC::MarkedSpace::sweepWeakSets): Removed now-unused code.
5665
commit-queue@webkit.org5deb7492012-06-09 09:05:22 +000056662012-06-09 Sukolsak Sakshuwong <sukolsak@google.com>
5667
5668 Add UNDO_MANAGER flag
5669 https://bugs.webkit.org/show_bug.cgi?id=87908
5670
5671 Reviewed by Tony Chang.
5672
5673 * Configurations/FeatureDefines.xcconfig:
5674
ggaren@apple.com642da3e2012-06-09 17:34:30 +000056752012-06-08 Geoffrey Garen <ggaren@apple.com>
ggaren@apple.com218a16a2012-06-08 23:57:58 +00005676
5677 Unreviewed, rolling back in part1 of r118646.
5678
5679 This patch includes everything necessary for lazy finalization, but
5680 keeps eager finalization enabled for the time being.
5681
5682 Weak pointer finalization should be lazy
5683 https://bugs.webkit.org/show_bug.cgi?id=87599
5684
5685 Reviewed by Sam Weinig.
5686
5687 * heap/MarkedBlock.cpp:
5688 * heap/MarkedBlock.h:
5689 (JSC::MarkedBlock::resetAllocator):
5690 * heap/MarkedSpace.cpp:
5691 (JSC::MarkedSpace::resetAllocators):
5692 * heap/MarkedSpace.h:
5693 (JSC::MarkedSpace::resetAllocators): Don't force allocator reset anymore.
5694 It will happen automatically when a weak set is swept. It's simpler to
5695 have only one canonical way for this to happen, and it wasn't buying
5696 us anything to do it eagerly.
5697 * heap/WeakBlock.cpp:
5698 (JSC::WeakBlock::sweep): Don't short-circuit a sweep unless we know
5699 the sweep would be a no-op. If even one finalizer is pending, we need to
5700 run it, since we won't get another chance.
5701 * heap/WeakSet.cpp:
5702 (JSC::WeakSet::sweep): This loop can be simpler now that
5703 WeakBlock::sweep() does what we mean.
5704 Reset our allocator after a sweep because this is the optimal time to
5705 start trying to recycle old weak pointers.
5706 (JSC::WeakSet::tryFindAllocator): Don't sweep when searching for an
5707 allocator because we've swept already, and forcing a new sweep would be
5708 wasteful.
5709 * heap/WeakSet.h:
5710 (JSC::WeakSet::shrink): Be sure to reset our allocator after a shrink
5711 because the shrink may have removed the block the allocator was going to
5712 allocate out of.
5713
barraclough@apple.com9dd771c2012-06-08 21:30:35 +000057142012-06-08 Gavin Barraclough <barraclough@apple.com>
5715
5716 Unreviewed roll out r119795.
5717
5718 This broke jquery/core.html
5719
5720 * dfg/DFGSpeculativeJIT.h:
5721 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
5722 * jit/JITInlineMethods.h:
5723 (JSC::JIT::emitAllocateBasicJSObject):
5724 * llint/LowLevelInterpreter.asm:
5725 * runtime/JSGlobalData.h:
5726 (JSGlobalData):
5727 * runtime/JSGlobalThis.cpp:
5728 (JSC::JSGlobalThis::setUnwrappedObject):
5729 * runtime/JSObject.cpp:
5730 (JSC::JSObject::visitChildren):
5731 (JSC::JSObject::createInheritorID):
5732 * runtime/JSObject.h:
5733 (JSObject):
5734 (JSC::JSObject::resetInheritorID):
5735 (JSC):
5736 (JSC::JSObject::offsetOfInheritorID):
5737 (JSC::JSObject::inheritorID):
5738
fpizlo@apple.com0bcbc112012-06-08 20:02:57 +000057392012-06-08 Filip Pizlo <fpizlo@apple.com>
5740
5741 PredictedType should be called SpeculatedType
5742 https://bugs.webkit.org/show_bug.cgi?id=88477
5743
5744 Unreviewed, fix a renaming goof from http://trac.webkit.org/changeset/119660.
5745 I accidentally renamed ByteCodeParser::getPrediction to
5746 ByteCodeParser::getSpeculation. That was not the intent. This changes it
5747 back.
5748
5749 * dfg/DFGByteCodeParser.cpp:
5750 (JSC::DFG::ByteCodeParser::addCall):
5751 (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
5752 (JSC::DFG::ByteCodeParser::getPrediction):
5753 (JSC::DFG::ByteCodeParser::handleCall):
5754 (JSC::DFG::ByteCodeParser::parseBlock):
5755
wingo@igalia.com332e9bf2012-06-08 19:57:40 +000057562012-06-08 Andy Wingo <wingo@igalia.com>
5757
5758 Explictly mark stubs called by JIT as being internal
5759 https://bugs.webkit.org/show_bug.cgi?id=88552
5760
5761 Reviewed by Filip Pizlo.
5762
5763 * dfg/DFGOSRExitCompiler.h:
5764 * dfg/DFGOperations.cpp:
5765 * dfg/DFGOperations.h:
5766 * jit/HostCallReturnValue.h:
5767 * jit/JITStubs.cpp:
5768 * jit/JITStubs.h:
5769 * jit/ThunkGenerators.cpp:
5770 * llint/LLIntSlowPaths.h: Mark a bunch of stubs as being
5771 WTF_INTERNAL. Change most calls to SYMBOL_STRING_RELOCATION to
5772 LOCAL_REFERENCE, or GLOBAL_REFERENCE in the case of the wrappers
5773 to truly global symbols.
5774 * offlineasm/asm.rb: Generate LOCAL_REFERENCE instead of
5775 SYMBOL_STRING_RELOCATION.
5776
fpizlo@apple.comf4a2ac32012-06-08 20:04:47 +000057772012-06-08 Geoffrey Garen <ggaren@apple.com>
5778
ggaren@apple.comd7147572012-06-08 18:17:16 +00005779 Don't rely on weak pointers for eager CodeBlock finalization
5780 https://bugs.webkit.org/show_bug.cgi?id=88465
5781
5782 Reviewed by Gavin Barraclough.
5783
5784 This is incompatible with lazy weak pointer finalization.
5785
5786 I considered just making CodeBlock finalization lazy-friendly, but it
5787 turns out that the heap is already way up in CodeBlock's business when
5788 it comes to finalization, so I decided to finish the job and move full
5789 responsibility for CodeBlock finalization into the heap.
5790
5791 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Maybe this
5792 will build.
5793
5794 * debugger/Debugger.cpp: Updated for rename.
5795
5796 * heap/Heap.cpp:
5797 (JSC::Heap::deleteAllCompiledCode): Renamed for consistency. Fixed a bug
5798 where we would not delete code for a code block that had been previously
5799 jettisoned. I don't know if this happens in practice -- I mostly did
5800 this to improve consistency with deleteUnmarkedCompiledCode.
5801
5802 (JSC::Heap::deleteUnmarkedCompiledCode): New function, responsible for
5803 eager finalization of unmarked code blocks.
5804
5805 (JSC::Heap::collect): Updated for rename. Updated to call
5806 deleteUnmarkedCompiledCode(), which takes care of jettisoned DFG code
5807 blocks too.
5808
5809 (JSC::Heap::addCompiledCode): Renamed, since this points to all code
5810 now, not just functions.
5811
5812 * heap/Heap.h:
5813 (Heap): Keep track of all user code, not just functions. This is a
5814 negligible additional overhead, since most code is function code.
5815
5816 * runtime/Executable.cpp:
5817 (JSC::*::finalize): Removed these functions, since we don't rely on
5818 weak pointer finalization anymore.
5819
5820 (JSC::FunctionExecutable::FunctionExecutable): Moved linked-list stuff
5821 into base class so all executables can be in the list.
5822
5823 (JSC::EvalExecutable::clearCode):
5824 (JSC::ProgramExecutable::clearCode):
5825 (JSC::FunctionExecutable::clearCode): All we need to do is delete our
5826 CodeBlock -- that will delete all of its internal data structures.
5827
5828 (JSC::FunctionExecutable::clearCodeIfNotCompiling): Factored out a helper
5829 function to improve clarity.
5830
5831 * runtime/Executable.h:
5832 (JSC::ExecutableBase): Moved linked-list stuff
5833 into base class so all executables can be in the list.
5834
5835 (JSC::NativeExecutable::create):
5836 (NativeExecutable):
5837 (ScriptExecutable):
5838 (JSC::ScriptExecutable::finishCreation):
5839 (JSC::EvalExecutable::create):
5840 (EvalExecutable):
5841 (JSC::ProgramExecutable::create):
5842 (ProgramExecutable):
5843 (FunctionExecutable):
5844 (JSC::FunctionExecutable::create): Don't use a finalizer -- the heap
5845 will call us back to destroy our code block.
5846
5847 (JSC::FunctionExecutable::discardCode): Renamed to clearCodeIfNotCompiling()
5848 for clarity.
5849
5850 (JSC::FunctionExecutable::isCompiling): New helper function, for clarity.
5851
5852 (JSC::ScriptExecutable::clearCodeVirtual): New helper function, since
5853 the heap needs to make polymorphic calls to clear code.
5854
5855 * runtime/JSGlobalData.cpp:
5856 (JSC::StackPreservingRecompiler::operator()):
5857 * runtime/JSGlobalObject.cpp:
5858 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Updated for
5859 renames.
5860
fpizlo@apple.comfd598b92012-06-08 01:31:21 +000058612012-06-07 Filip Pizlo <fpizlo@apple.com>
5862
5863 DFG should inline prototype chain accesses, and do the right things if the
5864 specific function optimization is available
5865 https://bugs.webkit.org/show_bug.cgi?id=88594
5866
5867 Reviewed by Gavin Barraclough.
5868
5869 Looks like a 3% win on V8.
5870
5871 * bytecode/CodeBlock.h:
5872 (JSC::Structure::prototypeForLookup):
5873 (JSC):
5874 * bytecode/GetByIdStatus.cpp:
5875 (JSC::GetByIdStatus::computeFromLLInt):
5876 (JSC):
5877 (JSC::GetByIdStatus::computeForChain):
5878 (JSC::GetByIdStatus::computeFor):
5879 * bytecode/GetByIdStatus.h:
5880 (JSC::GetByIdStatus::GetByIdStatus):
5881 (JSC::GetByIdStatus::isSimple):
5882 (JSC::GetByIdStatus::chain):
5883 (JSC::GetByIdStatus::specificValue):
5884 (GetByIdStatus):
5885 * bytecode/StructureSet.h:
5886 (StructureSet):
5887 (JSC::StructureSet::singletonStructure):
5888 * bytecode/StructureStubInfo.h:
5889 (JSC::StructureStubInfo::initGetByIdProto):
5890 (JSC::StructureStubInfo::initGetByIdChain):
5891 * dfg/DFGByteCodeParser.cpp:
5892 (JSC::DFG::ByteCodeParser::handleGetById):
5893 * dfg/DFGRepatch.cpp:
5894 (JSC::DFG::tryCacheGetByID):
5895 * jit/JITStubs.cpp:
5896 (JSC::JITThunks::tryCacheGetByID):
5897 * runtime/JSGlobalObject.h:
5898 (JSC::Structure::prototypeForLookup):
5899 (JSC):
5900 * runtime/Structure.h:
5901 (Structure):
5902
barraclough@apple.com48386932012-06-08 00:29:27 +000059032012-06-07 Gavin Barraclough <barraclough@apple.com>
5904
barraclough@apple.com64b74e02012-06-08 04:25:58 +00005905 Remove JSObject::m_inheritorID
5906 https://bugs.webkit.org/show_bug.cgi?id=88378
5907
5908 Reviewed by Geoff Garen.
5909
5910 This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
5911 and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
5912 Instead use a private named value in the object's property storage.
5913
5914 * dfg/DFGSpeculativeJIT.h:
5915 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
5916 - No need m_inheritorID to initialize!
5917 * jit/JITInlineMethods.h:
5918 (JSC::JIT::emitAllocateBasicJSObject):
5919 - No need m_inheritorID to initialize!
5920 * llint/LowLevelInterpreter.asm:
5921 - No need m_inheritorID to initialize!
5922 * runtime/JSGlobalData.h:
5923 (JSGlobalData):
5924 - Added private name 'm_inheritorIDKey'.
5925 * runtime/JSGlobalThis.cpp:
5926 (JSC::JSGlobalThis::setUnwrappedObject):
5927 - resetInheritorID is now passed a JSGlobalData&.
5928 * runtime/JSObject.cpp:
5929 (JSC::JSObject::visitChildren):
5930 - No m_inheritorID to be marked.
5931 (JSC::JSObject::createInheritorID):
5932 - Store the newly created inheritorID in the property map.
5933 * runtime/JSObject.h:
5934 (JSC::JSObject::resetInheritorID):
5935 - Remove the inheritorID from property storage.
5936 (JSC::JSObject::inheritorID):
5937 - Read the inheritorID from property storage.
5938
59392012-06-07 Gavin Barraclough <barraclough@apple.com>
5940
barraclough@apple.com48386932012-06-08 00:29:27 +00005941 Math.pow on iOS does not support denormal numbers.
5942 https://bugs.webkit.org/show_bug.cgi?id=88592
5943
5944 Reviewed by Filip Pizlo.
5945
5946 Import an implementation from fdlibm, detect cases where it is safe to use the system
5947 implementation & where we should fall back to fdlibm.
5948
5949 * runtime/MathObject.cpp:
5950 (JSC::isDenormal):
5951 (JSC::isEdgeCase):
5952 (JSC::mathPow):
5953 - On iOS, detect cases where denormal support may be required & use fdlibm in these cases.
5954 (JSC::mathProtoFuncPow):
5955 - Changed to use mathPow.
5956 (JSC::fdlibmScalbn):
5957 (JSC::fdlibmPow):
5958 - These functions imported from fdlibm; original style retained to ease future merging.
5959
paroga@webkit.orga334f732012-06-07 23:24:14 +000059602012-06-07 Patrick Gansterer <paroga@webkit.org>
5961
5962 Unreviewed. Build fix for !ENABLE(JIT) after r119441.
5963
5964 * interpreter/Interpreter.cpp:
5965 (JSC::Interpreter::privateExecute):
5966
wingo@igalia.comb8305a82012-06-07 16:05:19 +000059672012-06-07 Andy Wingo <wingo@igalia.com>
5968
5969 Unreviewed build fix after r119593.
5970
5971 * llint/LLIntOfflineAsmConfig.h (OFFLINE_ASM_GLOBAL_LABEL): Fix
5972 uses of "name" to be "label", the macro's parameter. Otherwise we
5973 serialize mentions of the literal symbol "name" into the objcode.
5974 Causes a build error using GNU ld (not gold).
5975
rniwa@webkit.org475cf8d2012-06-07 02:47:14 +000059762012-06-06 Ryosuke Niwa <rniwa@webkit.org>
5977
5978 Chromium build fix attempt. Why do we need to list these files in gyp!?
5979
5980 * JavaScriptCore.gypi:
5981
fpizlo@apple.comd5547492012-06-07 00:23:36 +000059822012-06-06 Filip Pizlo <fpizlo@apple.com>
5983
fpizlo@apple.com62336162012-06-07 01:35:59 +00005984 PredictedType should be called SpeculatedType
5985 https://bugs.webkit.org/show_bug.cgi?id=88477
5986
5987 Rubber stamped by Gavin Barraclough.
5988
5989 * CMakeLists.txt:
5990 * GNUmakefile.list.am:
5991 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
5992 * JavaScriptCore.xcodeproj/project.pbxproj:
5993 * Target.pri:
5994 * bytecode/CodeBlock.cpp:
5995 (JSC::CodeBlock::shouldOptimizeNow):
5996 (JSC::CodeBlock::dumpValueProfiles):
5997 * bytecode/CodeBlock.h:
5998 (JSC::CodeBlock::valueProfilePredictionForBytecodeOffset):
5999 * bytecode/LazyOperandValueProfile.cpp:
6000 (JSC::LazyOperandValueProfileParser::prediction):
6001 * bytecode/LazyOperandValueProfile.h:
6002 (LazyOperandValueProfileParser):
6003 * bytecode/PredictedType.cpp: Removed.
6004 * bytecode/PredictedType.h: Removed.
6005 * bytecode/SpeculatedType.cpp: Copied from Source/JavaScriptCore/bytecode/PredictedType.cpp.
6006 (JSC::speculationToString):
6007 (JSC::speculationToAbbreviatedString):
6008 (JSC::speculationFromClassInfo):
6009 (JSC::speculationFromStructure):
6010 (JSC::speculationFromCell):
6011 (JSC::speculationFromValue):
6012 * bytecode/SpeculatedType.h: Copied from Source/JavaScriptCore/bytecode/PredictedType.h.
6013 (JSC):
6014 (JSC::isAnySpeculation):
6015 (JSC::isCellSpeculation):
6016 (JSC::isObjectSpeculation):
6017 (JSC::isFinalObjectSpeculation):
6018 (JSC::isFinalObjectOrOtherSpeculation):
6019 (JSC::isFixedIndexedStorageObjectSpeculation):
6020 (JSC::isStringSpeculation):
6021 (JSC::isArraySpeculation):
6022 (JSC::isFunctionSpeculation):
6023 (JSC::isInt8ArraySpeculation):
6024 (JSC::isInt16ArraySpeculation):
6025 (JSC::isInt32ArraySpeculation):
6026 (JSC::isUint8ArraySpeculation):
6027 (JSC::isUint8ClampedArraySpeculation):
6028 (JSC::isUint16ArraySpeculation):
6029 (JSC::isUint32ArraySpeculation):
6030 (JSC::isFloat32ArraySpeculation):
6031 (JSC::isFloat64ArraySpeculation):
6032 (JSC::isArgumentsSpeculation):
6033 (JSC::isActionableIntMutableArraySpeculation):
6034 (JSC::isActionableFloatMutableArraySpeculation):
6035 (JSC::isActionableTypedMutableArraySpeculation):
6036 (JSC::isActionableMutableArraySpeculation):
6037 (JSC::isActionableArraySpeculation):
6038 (JSC::isArrayOrOtherSpeculation):
6039 (JSC::isMyArgumentsSpeculation):
6040 (JSC::isInt32Speculation):
6041 (JSC::isDoubleRealSpeculation):
6042 (JSC::isDoubleSpeculation):
6043 (JSC::isNumberSpeculation):
6044 (JSC::isBooleanSpeculation):
6045 (JSC::isOtherSpeculation):
6046 (JSC::isEmptySpeculation):
6047 (JSC::mergeSpeculations):
6048 (JSC::mergeSpeculation):
6049 * bytecode/StructureSet.h:
6050 (JSC::StructureSet::speculationFromStructures):
6051 * bytecode/ValueProfile.h:
6052 (JSC::ValueProfileBase::ValueProfileBase):
6053 (JSC::ValueProfileBase::dump):
6054 (JSC::ValueProfileBase::computeUpdatedPrediction):
6055 (ValueProfileBase):
6056 * dfg/DFGAbstractState.cpp:
6057 (JSC::DFG::AbstractState::initialize):
6058 (JSC::DFG::AbstractState::execute):
6059 (JSC::DFG::AbstractState::mergeStateAtTail):
6060 * dfg/DFGAbstractState.h:
6061 (JSC::DFG::AbstractState::speculateInt32Unary):
6062 (JSC::DFG::AbstractState::speculateNumberUnary):
6063 (JSC::DFG::AbstractState::speculateBooleanUnary):
6064 (JSC::DFG::AbstractState::speculateInt32Binary):
6065 (JSC::DFG::AbstractState::speculateNumberBinary):
6066 * dfg/DFGAbstractValue.h:
6067 (JSC::DFG::StructureAbstractValue::filter):
6068 (JSC::DFG::StructureAbstractValue::speculationFromStructures):
6069 (JSC::DFG::AbstractValue::AbstractValue):
6070 (JSC::DFG::AbstractValue::clear):
6071 (JSC::DFG::AbstractValue::isClear):
6072 (JSC::DFG::AbstractValue::makeTop):
6073 (JSC::DFG::AbstractValue::clobberStructures):
6074 (JSC::DFG::AbstractValue::isTop):
6075 (JSC::DFG::AbstractValue::set):
6076 (JSC::DFG::AbstractValue::merge):
6077 (JSC::DFG::AbstractValue::filter):
6078 (JSC::DFG::AbstractValue::validateIgnoringValue):
6079 (JSC::DFG::AbstractValue::validate):
6080 (JSC::DFG::AbstractValue::checkConsistency):
6081 (JSC::DFG::AbstractValue::dump):
6082 (AbstractValue):
6083 * dfg/DFGArgumentPosition.h:
6084 (JSC::DFG::ArgumentPosition::ArgumentPosition):
6085 (JSC::DFG::ArgumentPosition::mergeArgumentAwareness):
6086 (JSC::DFG::ArgumentPosition::prediction):
6087 (ArgumentPosition):
6088 * dfg/DFGArgumentsSimplificationPhase.cpp:
6089 (JSC::DFG::ArgumentsSimplificationPhase::run):
6090 * dfg/DFGByteCodeParser.cpp:
6091 (ByteCodeParser):
6092 (JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation):
6093 (JSC::DFG::ByteCodeParser::getLocal):
6094 (JSC::DFG::ByteCodeParser::getArgument):
6095 (JSC::DFG::ByteCodeParser::addCall):
6096 (JSC::DFG::ByteCodeParser::getSpeculationWithoutOSRExit):
6097 (JSC::DFG::ByteCodeParser::getSpeculation):
6098 (InlineStackEntry):
6099 (JSC::DFG::ByteCodeParser::handleCall):
6100 (JSC::DFG::ByteCodeParser::handleIntrinsic):
6101 (JSC::DFG::ByteCodeParser::handleGetById):
6102 (JSC::DFG::ByteCodeParser::parseBlock):
6103 (JSC::DFG::ByteCodeParser::fixVariableAccessSpeculations):
6104 (JSC::DFG::ByteCodeParser::parse):
6105 * dfg/DFGCSEPhase.cpp:
6106 (JSC::DFG::CSEPhase::getIndexedPropertyStorageLoadElimination):
6107 (JSC::DFG::CSEPhase::performNodeCSE):
6108 * dfg/DFGConstantFoldingPhase.cpp:
6109 (JSC::DFG::ConstantFoldingPhase::run):
6110 * dfg/DFGFixupPhase.cpp:
6111 (JSC::DFG::FixupPhase::fixupNode):
6112 (JSC::DFG::FixupPhase::fixDoubleEdge):
6113 * dfg/DFGGraph.cpp:
6114 (JSC::DFG::Graph::nameOfVariableAccessData):
6115 (JSC::DFG::Graph::dump):
6116 (JSC::DFG::Graph::predictArgumentTypes):
6117 * dfg/DFGGraph.h:
6118 (JSC::DFG::Graph::getJSConstantSpeculation):
6119 (JSC::DFG::Graph::isPredictedNumerical):
6120 (JSC::DFG::Graph::byValIsPure):
6121 * dfg/DFGJITCompiler.h:
6122 (JSC::DFG::JITCompiler::getSpeculation):
6123 * dfg/DFGNode.h:
6124 (JSC::DFG::Node::Node):
6125 (JSC::DFG::Node::getHeapPrediction):
6126 (JSC::DFG::Node::predictHeap):
6127 (JSC::DFG::Node::prediction):
6128 (JSC::DFG::Node::predict):
6129 (JSC::DFG::Node::shouldSpeculateInteger):
6130 (JSC::DFG::Node::shouldSpeculateDouble):
6131 (JSC::DFG::Node::shouldSpeculateNumber):
6132 (JSC::DFG::Node::shouldSpeculateBoolean):
6133 (JSC::DFG::Node::shouldSpeculateFinalObject):
6134 (JSC::DFG::Node::shouldSpeculateFinalObjectOrOther):
6135 (JSC::DFG::Node::shouldSpeculateArray):
6136 (JSC::DFG::Node::shouldSpeculateArguments):
6137 (JSC::DFG::Node::shouldSpeculateInt8Array):
6138 (JSC::DFG::Node::shouldSpeculateInt16Array):
6139 (JSC::DFG::Node::shouldSpeculateInt32Array):
6140 (JSC::DFG::Node::shouldSpeculateUint8Array):
6141 (JSC::DFG::Node::shouldSpeculateUint8ClampedArray):
6142 (JSC::DFG::Node::shouldSpeculateUint16Array):
6143 (JSC::DFG::Node::shouldSpeculateUint32Array):
6144 (JSC::DFG::Node::shouldSpeculateFloat32Array):
6145 (JSC::DFG::Node::shouldSpeculateFloat64Array):
6146 (JSC::DFG::Node::shouldSpeculateArrayOrOther):
6147 (JSC::DFG::Node::shouldSpeculateObject):
6148 (JSC::DFG::Node::shouldSpeculateCell):
6149 (Node):
6150 * dfg/DFGPredictionPropagationPhase.cpp:
6151 (JSC::DFG::PredictionPropagationPhase::setPrediction):
6152 (JSC::DFG::PredictionPropagationPhase::mergePrediction):
6153 (JSC::DFG::PredictionPropagationPhase::propagate):
6154 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):
6155 * dfg/DFGSpeculativeJIT.cpp:
6156 (JSC::DFG::SpeculativeJIT::fillStorage):
6157 (JSC::DFG::SpeculativeJIT::writeBarrier):
6158 (JSC::DFG::GPRTemporary::GPRTemporary):
6159 (JSC::DFG::FPRTemporary::FPRTemporary):
6160 (JSC::DFG::SpeculativeJIT::compilePeepHoleDoubleBranch):
6161 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectEquality):
6162 (JSC::DFG::SpeculativeJIT::compilePeepHoleBranch):
6163 (JSC::DFG::SpeculativeJIT::compile):
6164 (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
6165 (JSC::DFG::SpeculativeJIT::compileGetCharCodeAt):
6166 (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
6167 (JSC::DFG::SpeculativeJIT::compileValueToInt32):
6168 (JSC::DFG::SpeculativeJIT::compileDoubleAsInt32):
6169 (JSC::DFG::SpeculativeJIT::compileInt32ToDouble):
6170 (JSC::DFG::SpeculativeJIT::compileGetTypedArrayLength):
6171 (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
6172 (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
6173 (JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
6174 (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
6175 (JSC::DFG::SpeculativeJIT::compileInstanceOf):
6176 (JSC::DFG::SpeculativeJIT::compileAdd):
6177 (JSC::DFG::SpeculativeJIT::compileArithSub):
6178 (JSC::DFG::SpeculativeJIT::compileArithNegate):
6179 (JSC::DFG::SpeculativeJIT::compileArithMul):
6180 (JSC::DFG::SpeculativeJIT::compileArithMod):
6181 (JSC::DFG::SpeculativeJIT::compare):
6182 (JSC::DFG::SpeculativeJIT::compileStrictEq):
6183 (JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage):
6184 (JSC::DFG::SpeculativeJIT::compileGetByValOnArguments):
6185 (JSC::DFG::SpeculativeJIT::compileGetArgumentsLength):
6186 (JSC::DFG::SpeculativeJIT::compileRegExpExec):
6187 * dfg/DFGSpeculativeJIT.h:
6188 (DFG):
6189 (JSC::DFG::ValueSource::forSpeculation):
6190 (SpeculativeJIT):
6191 (GPRTemporary):
6192 (FPRTemporary):
6193 (JSC::DFG::SpecDoubleOperand::SpecDoubleOperand):
6194 (JSC::DFG::SpecDoubleOperand::~SpecDoubleOperand):
6195 (JSC::DFG::SpecDoubleOperand::fpr):
6196 (JSC::DFG::SpecCellOperand::SpecCellOperand):
6197 (JSC::DFG::SpecCellOperand::~SpecCellOperand):
6198 (JSC::DFG::SpecCellOperand::gpr):
6199 (JSC::DFG::SpecBooleanOperand::SpecBooleanOperand):
6200 (JSC::DFG::SpecBooleanOperand::~SpecBooleanOperand):
6201 (JSC::DFG::SpecBooleanOperand::gpr):
6202 * dfg/DFGSpeculativeJIT32_64.cpp:
6203 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
6204 (JSC::DFG::SpeculativeJIT::fillSpecDouble):
6205 (JSC::DFG::SpeculativeJIT::fillSpecCell):
6206 (JSC::DFG::SpeculativeJIT::fillSpecBoolean):
6207 (JSC::DFG::SpeculativeJIT::compileObjectEquality):
6208 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
6209 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
6210 (JSC::DFG::SpeculativeJIT::compileDoubleCompare):
6211 (JSC::DFG::SpeculativeJIT::compileLogicalNot):
6212 (JSC::DFG::SpeculativeJIT::emitBranch):
6213 (JSC::DFG::SpeculativeJIT::compile):
6214 * dfg/DFGSpeculativeJIT64.cpp:
6215 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
6216 (JSC::DFG::SpeculativeJIT::fillSpecDouble):
6217 (JSC::DFG::SpeculativeJIT::fillSpecCell):
6218 (JSC::DFG::SpeculativeJIT::fillSpecBoolean):
6219 (JSC::DFG::SpeculativeJIT::compileObjectEquality):
6220 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
6221 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
6222 (JSC::DFG::SpeculativeJIT::compileDoubleCompare):
6223 (JSC::DFG::SpeculativeJIT::compileLogicalNot):
6224 (JSC::DFG::SpeculativeJIT::emitBranch):
6225 (JSC::DFG::SpeculativeJIT::compile):
6226 * dfg/DFGVariableAccessData.h:
6227 (JSC::DFG::VariableAccessData::VariableAccessData):
6228 (JSC::DFG::VariableAccessData::predict):
6229 (JSC::DFG::VariableAccessData::nonUnifiedPrediction):
6230 (JSC::DFG::VariableAccessData::prediction):
6231 (JSC::DFG::VariableAccessData::argumentAwarePrediction):
6232 (JSC::DFG::VariableAccessData::mergeArgumentAwarePrediction):
6233 (JSC::DFG::VariableAccessData::shouldUseDoubleFormatAccordingToVote):
6234 (JSC::DFG::VariableAccessData::makePredictionForDoubleFormat):
6235 (VariableAccessData):
6236
62372012-06-06 Filip Pizlo <fpizlo@apple.com>
6238
fpizlo@apple.com26af9b62012-06-07 00:49:34 +00006239 Global object variable accesses should not require an extra load
6240 https://bugs.webkit.org/show_bug.cgi?id=88385
6241
6242 Reviewed by Gavin Barraclough and Geoffrey Garen.
6243
6244 Previously, if you wanted to access a global variable, you'd first have
6245 to load the register array from the appropriate global object and then
6246 either load or store at an offset to the register array. This is because
6247 JSGlobalObject inherited from JSVariableObject, and JSVariableObject is
6248 designed with the pessimistic assumption that its register array may
6249 point into the call stack. This is never the case for global objects.
6250 Hence, even though the global object may add more registers at any time,
6251 it does not need to store them in a contiguous array. It can use a
6252 SegmentedVector or similar.
6253
6254 This patch refactors global objects and variable objects as follows:
6255
6256 - The functionality to track variables in an indexable array using a
6257 SymbolTable to map names to indices is moved into JSSymbolTableObject,
6258 which is now a supertype of JSVariableObject. JSVariableObject is now
6259 just a holder for a registers array and implements the registerAt()
6260 method that is left abstract in JSSymbolTableObject. Because all users
6261 of JSVariableObject know whether they are a JSStaticScopeObject,
6262 JSActivation, or JSGlobalObject, this "abstract" method is not virtual;
6263 instead the utility methods that would call registerAt() are now
6264 template functions that require you to know statically what subtype of
6265 JSSymbolTableObject you're using (JSVariableObject or something else),
6266 so that registerAt() can be statically bound.
6267
6268 - A new class is added called JSSegmentedVariableObject, which only
6269 differs from JSVariableObject in how it allocates registers. It uses a
6270 SegmentedVector instead of manually managing a pointer to a contiguous
6271 slab of registers. This changes the interface somewhat; for example
6272 with JSVariableObject if you wanted to add a register you had to do
6273 it yourself since the JSVariableObject didn't know how the registers
6274 array ought to be allocated. With JSSegmentedVariableObject you can
6275 just call addRegisters(). JSSegmentedVariableObject preserves the
6276 invariant that once you get a pointer into a register, that pointer
6277 will continue to be valid so long as the JSSegmentedVariableObject is
6278 alive. This allows the JITs and interpreters to skip the extra load.
6279
6280 - JSGlobalObject now inherits from JSSegmentedVariableObject. For now
6281 (and possibly forever) it is the only subtype of this new class.
6282
6283 - The bytecode format is changed so that get_global_var and
6284 put_global_var have a pointer to the register directly rather than
6285 having an index. A convenience method is provided in
6286 JSSegmentedVariableObject to get the index given a a pointer, which is
6287 used for assertions and debug dumps.
6288
6289 This appears to be a 1% across the board win.
6290
6291 * CMakeLists.txt:
6292 * GNUmakefile.list.am:
6293 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6294 * JavaScriptCore.xcodeproj/project.pbxproj:
6295 * Target.pri:
6296 * bytecode/CodeBlock.cpp:
6297 (JSC::CodeBlock::dump):
6298 * bytecode/Instruction.h:
6299 (Instruction):
6300 (JSC::Instruction::Instruction):
6301 * bytecompiler/BytecodeGenerator.cpp:
6302 (JSC::ResolveResult::registerPointer):
6303 (JSC):
6304 (JSC::BytecodeGenerator::BytecodeGenerator):
6305 (JSC::BytecodeGenerator::retrieveLastUnaryOp):
6306 (JSC::BytecodeGenerator::resolve):
6307 (JSC::BytecodeGenerator::resolveConstDecl):
6308 (JSC::BytecodeGenerator::emitGetStaticVar):
6309 (JSC::BytecodeGenerator::emitPutStaticVar):
6310 * bytecompiler/BytecodeGenerator.h:
6311 (ResolveResult):
6312 (BytecodeGenerator):
6313 * dfg/DFGAssemblyHelpers.h:
6314 (AssemblyHelpers):
6315 * dfg/DFGByteCodeParser.cpp:
6316 (JSC::DFG::ByteCodeParser::parseBlock):
6317 * dfg/DFGCSEPhase.cpp:
6318 (JSC::DFG::CSEPhase::globalVarLoadElimination):
6319 (JSC::DFG::CSEPhase::globalVarStoreElimination):
6320 (JSC::DFG::CSEPhase::performNodeCSE):
6321 * dfg/DFGGraph.cpp:
6322 (JSC::DFG::Graph::dump):
6323 * dfg/DFGGraph.h:
6324 (JSC::DFG::Graph::globalObjectFor):
6325 (Graph):
6326 * dfg/DFGNode.h:
6327 (JSC::DFG::Node::hasVarNumber):
6328 (Node):
6329 (JSC::DFG::Node::hasRegisterPointer):
6330 (JSC::DFG::Node::registerPointer):
6331 * dfg/DFGSpeculativeJIT32_64.cpp:
6332 (JSC::DFG::SpeculativeJIT::compile):
6333 * dfg/DFGSpeculativeJIT64.cpp:
6334 (JSC::DFG::SpeculativeJIT::compile):
6335 * heap/Heap.h:
6336 (Heap):
6337 (JSC::Heap::isWriteBarrierEnabled):
6338 (JSC):
6339 * interpreter/Interpreter.cpp:
6340 (JSC::Interpreter::execute):
6341 (JSC::Interpreter::privateExecute):
6342 * jit/JITPropertyAccess.cpp:
6343 (JSC::JIT::emit_op_get_global_var):
6344 (JSC::JIT::emit_op_put_global_var):
6345 * jit/JITPropertyAccess32_64.cpp:
6346 (JSC::JIT::emit_op_get_global_var):
6347 (JSC::JIT::emit_op_put_global_var):
6348 * llint/LowLevelInterpreter32_64.asm:
6349 * llint/LowLevelInterpreter64.asm:
6350 * runtime/JSGlobalObject.cpp:
6351 (JSC):
6352 (JSC::JSGlobalObject::put):
6353 (JSC::JSGlobalObject::putDirectVirtual):
6354 (JSC::JSGlobalObject::defineOwnProperty):
6355 (JSC::JSGlobalObject::visitChildren):
6356 (JSC::JSGlobalObject::addStaticGlobals):
6357 (JSC::JSGlobalObject::getOwnPropertySlot):
6358 (JSC::JSGlobalObject::getOwnPropertyDescriptor):
6359 * runtime/JSGlobalObject.h:
6360 (JSGlobalObject):
6361 (JSC::JSGlobalObject::JSGlobalObject):
6362 (JSC):
6363 (JSC::JSGlobalObject::hasOwnPropertyForWrite):
6364 * runtime/JSSegmentedVariableObject.cpp: Added.
6365 (JSC):
6366 (JSC::JSSegmentedVariableObject::findRegisterIndex):
6367 (JSC::JSSegmentedVariableObject::addRegisters):
6368 (JSC::JSSegmentedVariableObject::visitChildren):
6369 * runtime/JSSegmentedVariableObject.h: Added.
6370 (JSC):
6371 (JSSegmentedVariableObject):
6372 (JSC::JSSegmentedVariableObject::registerAt):
6373 (JSC::JSSegmentedVariableObject::assertRegisterIsInThisObject):
6374 (JSC::JSSegmentedVariableObject::JSSegmentedVariableObject):
6375 (JSC::JSSegmentedVariableObject::finishCreation):
6376 * runtime/JSStaticScopeObject.cpp:
6377 (JSC::JSStaticScopeObject::put):
6378 (JSC::JSStaticScopeObject::putDirectVirtual):
6379 (JSC::JSStaticScopeObject::getOwnPropertySlot):
6380 * runtime/JSSymbolTableObject.cpp: Added.
6381 (JSC):
6382 (JSC::JSSymbolTableObject::destroy):
6383 (JSC::JSSymbolTableObject::deleteProperty):
6384 (JSC::JSSymbolTableObject::getOwnPropertyNames):
6385 (JSC::JSSymbolTableObject::putDirectVirtual):
6386 (JSC::JSSymbolTableObject::isDynamicScope):
6387 * runtime/JSSymbolTableObject.h: Added.
6388 (JSC):
6389 (JSSymbolTableObject):
6390 (JSC::JSSymbolTableObject::symbolTable):
6391 (JSC::JSSymbolTableObject::JSSymbolTableObject):
6392 (JSC::JSSymbolTableObject::finishCreation):
6393 (JSC::symbolTableGet):
6394 (JSC::symbolTablePut):
6395 (JSC::symbolTablePutWithAttributes):
6396 * runtime/JSVariableObject.cpp:
6397 (JSC):
6398 * runtime/JSVariableObject.h:
6399 (JSVariableObject):
6400 (JSC::JSVariableObject::JSVariableObject):
6401 (JSC::JSVariableObject::finishCreation):
6402 (JSC):
6403 * runtime/WriteBarrier.h:
6404
64052012-06-06 Filip Pizlo <fpizlo@apple.com>
6406
fpizlo@apple.comd5547492012-06-07 00:23:36 +00006407 DFG arguments access slow path should not crash if the arguments haven't been created
6408 https://bugs.webkit.org/show_bug.cgi?id=88471
6409
6410 Reviewed by Gavin Barraclough.
6411
6412 * dfg/DFGCCallHelpers.h:
6413 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
6414 (CCallHelpers):
6415 * dfg/DFGOperations.cpp:
6416 * dfg/DFGOperations.h:
6417 * dfg/DFGSpeculativeJIT.h:
6418 (JSC::DFG::SpeculativeJIT::callOperation):
6419 * dfg/DFGSpeculativeJIT32_64.cpp:
6420 (JSC::DFG::SpeculativeJIT::compile):
6421 * dfg/DFGSpeculativeJIT64.cpp:
6422 (JSC::DFG::SpeculativeJIT::compile):
6423
msaboff@apple.com9d9eab62012-06-06 23:11:09 +000064242012-06-06 Michael Saboff <msaboff@apple.com>
6425
6426 ENH: Add Logging to GC Marking Phase
6427 https://bugs.webkit.org/show_bug.cgi?id=88364
6428
6429 Reviewed by Filip Pizlo.
6430
6431 Log GC marking to stderr or a file. The logging in controlled
6432 with the define ENABLE_OBJECT_MARK_LOGGING in wtf/Platform.h.
6433 If DATA_LOG_TO_FILE in wtf/DataLog.cpp is set to 1, output is
6434 logged to a file otherwise it is logged to stderr.
6435
6436 When logging is enabled, the GC is built single threaded since the
6437 log output from the various threads isn't buffered and output in a
6438 thread safe manner.
6439
6440 * heap/Heap.cpp:
6441 (JSC::Heap::markRoots):
6442 * heap/MarkStack.cpp:
6443 (JSC::MarkStackThreadSharedData::resetChildren):
6444 (JSC::MarkStackThreadSharedData::childVisitCount):
6445 (JSC::MarkStackThreadSharedData::markingThreadMain):
6446 (JSC::MarkStackThreadSharedData::markingThreadStartFunc):
6447 (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData):
6448 (JSC::MarkStackThreadSharedData::reset):
6449 * heap/MarkStack.h:
6450 (MarkStackThreadSharedData):
6451 (MarkStack):
6452 (JSC::MarkStack::sharedData):
6453 (JSC::MarkStack::resetChildCount):
6454 (JSC::MarkStack::childCount):
6455 (JSC::MarkStack::incrementChildCount):
6456 * runtime/JSArray.cpp:
6457 (JSC::JSArray::visitChildren):
6458 * runtime/JSCell.cpp:
6459 (JSC::JSCell::className):
6460 * runtime/JSCell.h:
6461 (JSCell):
6462 (JSC::JSCell::visitChildren):
6463 * runtime/JSString.cpp:
6464 (JSC::JSString::visitChildren):
6465 * runtime/JSString.h:
6466 (JSString):
6467 * runtime/Structure.h:
6468 (JSC::MarkStack::internalAppend):
6469
barraclough@apple.com799e44e2012-06-06 22:09:44 +000064702012-06-06 Gavin Barraclough <barraclough@apple.com>
6471
6472 Assigning to a static property should not change iteration order
6473 https://bugs.webkit.org/show_bug.cgi?id=88401
6474
6475 Reviewed by Geoff Garen.
6476
6477 A specific iteration order is not defined by the spec, but test-262 somewhat tenuously
6478 requires that it is at least stable, e.g. ch10/10.4/10.4.2/S10.4.2_A1.1_T1.js
6479
6480 Whilst it is not clear that this behavior really arises from the specification, it
6481 would seem like common sense to conform to this.
6482
6483 The problem here is that we allow properties in the structure to shadow those in the
6484 static table, and we iterate the properties in the structure first - which means that
6485 as values of existing properties are modified, their iteration order changes too.
6486
6487 The easy fix is to iterate the properties from the static table first. This has a
6488 further benefit, since it will mean that user added properties will come after those
6489 present in the static table (respected the expected insertion-order).
6490
6491 * runtime/JSObject.cpp:
6492 (JSC::JSObject::getOwnPropertyNames):
6493 - Iterate static properties first.
6494
wingo@igalia.combe8ecb92012-06-06 09:39:04 +000064952012-06-06 Andy Wingo <wingo@igalia.com>
6496
wingo@igalia.comc2fb5ba2012-06-06 18:59:35 +00006497 Ensure consistent order of evaluation in LLInt slow paths
6498 https://bugs.webkit.org/show_bug.cgi?id=88409
6499
6500 Reviewed by Geoffrey Garen.
6501
6502 * llint/LLIntSlowPaths.cpp:
6503 (slow_path_mul)
6504 (slow_path_sub)
6505 (slow_path_div)
6506 (slow_path_mod)
6507 (slow_path_lshift)
6508 (slow_path_rshift)
6509 (slow_path_urshift)
6510 (slow_path_bitand)
6511 (slow_path_bitor)
6512 (slow_path_bitxor): Avoid calling toNumber, toInt32, or toUInt32
6513 multiple times without intervening sequence points. Fixes
6514 fast/js/exception-sequencing-binops.html with GCC 4.7 on x86-64
6515 Linux, which reordered evaluation of the arguments to fmod.
6516
65172012-06-06 Andy Wingo <wingo@igalia.com>
6518
wingo@igalia.com4990fe82012-06-06 16:00:38 +00006519 [GTK] Enable the LLInt
6520 https://bugs.webkit.org/show_bug.cgi?id=88315
6521
6522 Reviewed by Filip Pizlo.
6523
6524 * GNUmakefile.am: Add rules to generate LLIntDesiredOffsets.h and
6525 LLIntAssembly.h.
6526 * GNUmakefile.list.am: Add offlineasm and llint files to the
6527 dist. Add LLInt source files to the build.
6528 * llint/LowLevelInterpreter.asm (crash): Generate a store of
6529 0xbbadbeef to a register, not to a constant. Otherwise, gas was
6530 failing to assemble result.
6531 * offlineasm/asm.rb (labelReference): Generate a
6532 SYMBOL_STRING_RELOCATION instead of a SYMBOL_STRING, so that we go
6533 through the PLT on ELF systems.
6534
65352012-06-06 Andy Wingo <wingo@igalia.com>
6536
wingo@igalia.combe8ecb92012-06-06 09:39:04 +00006537 REGRESSION (r106478): None of the Paper.js JavaScript examples work
6538 https://bugs.webkit.org/show_bug.cgi?id=87158
6539
6540 Reviewed by Michael Saboff.
6541
6542 * bytecompiler/BytecodeGenerator.cpp:
6543 (JSC::BytecodeGenerator::resolve): If we have to bail out to
6544 dynamicResolve(), only skip static scopes from the head of the
6545 scope chain. Before, we were also skipping activations with
6546 direct eval as well, which was incorrect.
6547
mitz@apple.com115e6642012-06-06 07:37:05 +000065482012-06-06 Dan Bernstein <mitz@apple.com>
6549
6550 Reverted r119567, the fix for <http://webkit.org/b/88378>, because it broke the 32-bit build.
6551
6552 * dfg/DFGSpeculativeJIT.h:
6553 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
6554 * jit/JITInlineMethods.h:
6555 (JSC::JIT::emitAllocateBasicJSObject):
6556 * llint/LowLevelInterpreter.asm:
6557 * runtime/JSGlobalData.h:
6558 (JSGlobalData):
6559 * runtime/JSGlobalThis.cpp:
6560 (JSC::JSGlobalThis::setUnwrappedObject):
6561 * runtime/JSObject.cpp:
6562 (JSC::JSObject::visitChildren):
6563 (JSC::JSObject::createInheritorID):
6564 * runtime/JSObject.h:
6565 (JSObject):
6566 (JSC::JSObject::resetInheritorID):
6567 (JSC):
6568 (JSC::JSObject::offsetOfInheritorID):
6569 (JSC::JSObject::inheritorID):
6570
yuqiang.xian@intel.come8adde62012-06-06 05:25:54 +000065712012-06-05 Yuqiang Xian <yuqiang.xian@intel.com>
6572
6573 Improve Math.round and Math.floor intrinsic
6574 https://bugs.webkit.org/show_bug.cgi?id=88314
6575
6576 Reviewed by Filip Pizlo.
6577
6578 Currently we call a native function from the JIT code to complete the
6579 "round" and "floor" operations. We could inline some fast paths
6580 especially for those positive values on the platforms where floating
6581 point truncation is supported.
6582 This brings 3% gain on Kraken, especially 32% on audio-oscillator,
6583 and slight win on SunSpider, measured on IA32.
6584
6585 * jit/ThunkGenerators.cpp:
6586 (JSC::floorThunkGenerator):
6587 (JSC):
6588 (JSC::roundThunkGenerator):
6589
barraclough@apple.comc48fc1b2012-06-06 05:08:45 +000065902012-06-05 Gavin Barraclough <barraclough@apple.com>
6591
6592 Remove JSObject::m_inheritorID
6593 https://bugs.webkit.org/show_bug.cgi?id=88378
6594
6595 Reviewed by Geoff Garen.
6596
6597 This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
6598 and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
6599 Instead use a private named value in the object's property storage.
6600
6601 * dfg/DFGSpeculativeJIT.h:
6602 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
6603 - No need m_inheritorID to initialize!
6604 * jit/JITInlineMethods.h:
6605 (JSC::JIT::emitAllocateBasicJSObject):
6606 - No need m_inheritorID to initialize!
6607 * llint/LowLevelInterpreter.asm:
6608 - No need m_inheritorID to initialize!
6609 * runtime/JSGlobalData.h:
6610 (JSGlobalData):
6611 - Added private name 'm_inheritorIDKey'.
6612 * runtime/JSGlobalThis.cpp:
6613 (JSC::JSGlobalThis::setUnwrappedObject):
6614 - resetInheritorID is now passed a JSGlobalData&.
6615 * runtime/JSObject.cpp:
6616 (JSC::JSObject::visitChildren):
6617 - No m_inheritorID to be marked.
6618 (JSC::JSObject::createInheritorID):
6619 - Store the newly created inheritorID in the property map.
6620 * runtime/JSObject.h:
6621 (JSC::JSObject::resetInheritorID):
6622 - Remove the inheritorID from property storage.
6623 (JSC::JSObject::inheritorID):
6624 - Read the inheritorID from property storage.
6625
fpizlo@apple.come7bee132012-06-05 21:32:18 +000066262012-06-05 Filip Pizlo <fpizlo@apple.com>
6627
6628 DFG CFG simplification should not attempt to deref nodes inside of an unreachable subgraph
6629 https://bugs.webkit.org/show_bug.cgi?id=88362
6630
6631 Reviewed by Gavin Barraclough.
6632
6633 * dfg/DFGCFGSimplificationPhase.cpp:
6634 (JSC::DFG::CFGSimplificationPhase::fixPhis):
6635 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
6636
mhahnenberg@apple.com47c9c532012-06-05 20:38:21 +000066372012-06-05 Mark Hahnenberg <mhahnenberg@apple.com>
6638
6639 Entry into JSC should CRASH() if the Heap is busy
6640 https://bugs.webkit.org/show_bug.cgi?id=88355
6641
6642 Reviewed by Geoffrey Garen.
6643
6644 Interpreter::execute() returns jsNull() right now if we try to enter it while
6645 the Heap is busy (e.g. with a collection), which is okay, but some code paths
6646 that call Interpreter::execute() allocate objects before checking if the Heap
6647 is busy. Attempting to execute JS code while the Heap is busy should not be
6648 allowed and should be enforced by a release-mode CRASH() to prevent vague,
6649 unhelpful backtraces later on if somebody makes a mistake. Normally, recursively
6650 executing JS code is okay, e.g. for evals, but it should not occur during a
6651 Heap allocation or collection because the Heap is not guaranteed to be in a
6652 consistent state (especially during collections). We are protected from
6653 executing JS on the same Heap concurrently on two separate threads because
6654 they must each take a JSLock first. However, we are not protected from reentrant
6655 execution of JS on the same thread because JSLock allows reentrancy. Therefore,
6656 we should fail early if we detect an entrance into JS code while the Heap is busy.
6657
6658 * heap/Heap.cpp: Changed Heap::collect so that it sets the m_operationInProgress field
6659 at the beginning of collection and then unsets it at the end so that it is set at all
6660 times throughout the duration of a collection rather than sporadically during various
6661 phases. There is no reason to unset during a collection because our collector does
6662 not currently support running additional JS between the phases of a collection.
6663 (JSC::Heap::getConservativeRegisterRoots):
6664 (JSC::Heap::markRoots):
6665 (JSC::Heap::collect):
6666 * interpreter/Interpreter.cpp:
6667 (JSC::Interpreter::execute): Crash if the Heap is busy.
6668 * runtime/Completion.cpp: Crash if the Heap is busy. We do it here before we call
6669 Interpreter::execute() because we do some allocation prior to calling execute() which
6670 could cause Heap corruption if, for example, that allocation caused a collection.
6671 (JSC::evaluate):
6672
commit-queue@webkit.org3401b2d2012-06-05 11:32:22 +000066732012-06-05 Dongwoo Im <dw.im@samsung.com>
6674
6675 Add 'isProtocolHandlerRegistered' and 'unregisterProtocolHandler'.
6676 https://bugs.webkit.org/show_bug.cgi?id=73176
6677
6678 Reviewed by Adam Barth.
6679
6680 Two more APIs are added in Custom Scheme Handler specification.
6681 http://dev.w3.org/html5/spec/Overview.html#custom-handlers
6682 One is 'isProtocolHandlerRegistered' to query whether the specific URL
6683 is registered or not.
6684 The other is 'unregisterProtocolHandler' to remove the registered URL.
6685
6686 * Configurations/FeatureDefines.xcconfig: Add a macro 'ENABLE_CUSTOM_SCHEME_HANDLER'.
6687
fpizlo@apple.com9cce18d2012-06-05 06:40:48 +000066882012-06-04 Filip Pizlo <fpizlo@apple.com>
6689
6690 DFG CFG simplification should correct the variables at the head of the predecessor block
6691 https://bugs.webkit.org/show_bug.cgi?id=88284
6692
6693 Reviewed by Geoffrey Garen.
6694
6695 * dfg/DFGCFGSimplificationPhase.cpp:
6696 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
6697
ggaren@apple.com825cc102012-06-05 03:17:15 +000066982012-06-04 Geoffrey Garen <ggaren@apple.com>
6699
6700 Unreviewed.
6701
6702 Rolled out r119364 because it's still causing crashes (when running
6703 v8-earley in release builds of DRT)
6704
6705 This time for sure!
6706
6707 * heap/Heap.cpp:
6708 (JSC::Heap::collect):
6709 * heap/MarkedBlock.cpp:
6710 (JSC::MarkedBlock::sweep):
6711 * heap/MarkedBlock.h:
6712 (JSC::MarkedBlock::resetAllocator):
6713 (JSC):
6714 * heap/MarkedSpace.cpp:
6715 (JSC::ResetAllocator::operator()):
6716 (JSC):
6717 (JSC::MarkedSpace::resetAllocators):
6718 (JSC::MarkedSpace::sweepWeakSets):
6719 * heap/MarkedSpace.h:
6720 (MarkedSpace):
6721 * heap/WeakBlock.cpp:
6722 (JSC::WeakBlock::sweep):
6723 * heap/WeakSet.cpp:
6724 (JSC::WeakSet::sweep):
6725 (JSC::WeakSet::tryFindAllocator):
6726 * heap/WeakSet.h:
6727 (JSC::WeakSet::shrink):
6728
fpizlo@apple.com9cd38a62012-06-05 00:28:49 +000067292012-06-04 Filip Pizlo <fpizlo@apple.com>
6730
6731 DFG arguments simplification should have rationalized handling of TearOffArguments
6732 https://bugs.webkit.org/show_bug.cgi?id=88206
6733
6734 Reviewed by Geoffrey Garen.
6735
6736 - Accesses to the unmodified arguments register ought to have the same effect on
6737 alias/escape analysis of arguments as accesses to the mutable arguments register.
6738
6739 - The existence of TearOffArguments should not get in the way of arguments aliasing.
6740
6741 - TearOffArguments should be eliminated if CreateArguments is eliminated.
6742
6743 * dfg/DFGArgumentsSimplificationPhase.cpp:
6744 (JSC::DFG::ArgumentsSimplificationPhase::run):
6745 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
6746
barraclough@apple.com282d26a2012-06-05 00:00:17 +000067472012-06-04 Gavin Barraclough <barraclough@apple.com>
6748
6749 Remove enabledProfilerReference
6750 https://bugs.webkit.org/show_bug.cgi?id=88258
6751
6752 Reviewed by Michael Saboff.
6753
6754 Make the enabled profiler a member of JSGlobalData, and switch code that accesses it to do so directly
6755 via the JSGlobalData, rather than holding a Profiler** reference to it. Do not pass the Profiler**
6756 reference to JIT code. This patch does not change the stack layout on entry into JIT code (passing an
6757 unused void* instead), since this is an intrusive change better handled in a separate patch.
6758
6759 * interpreter/Interpreter.cpp:
6760 (JSC::Interpreter::throwException):
6761 (JSC::Interpreter::execute):
6762 (JSC::Interpreter::executeCall):
6763 (JSC::Interpreter::executeConstruct):
6764 (JSC::Interpreter::privateExecute):
6765 * jit/JITCode.h:
6766 (JSC::JITCode::execute):
6767 - Don't pass Profiler** to JIT code.
6768 * jit/JITOpcodes.cpp:
6769 (JSC::JIT::emit_op_profile_will_call):
6770 (JSC::JIT::emit_op_profile_did_call):
6771 * jit/JITOpcodes32_64.cpp:
6772 (JSC::JIT::emit_op_profile_will_call):
6773 (JSC::JIT::emit_op_profile_did_call):
6774 * jit/JITStubs.cpp:
6775 (JSC):
6776 (JSC::ctiTrampoline):
6777 (JSC::ctiVMThrowTrampoline):
6778 (JSC::ctiOpThrowNotCaught):
6779 (JSC::JITThunks::JITThunks):
6780 (JSC::DEFINE_STUB_FUNCTION):
6781 - For ARM_THUMB2, rename ENABLE_PROFILER_REFERENCE_OFFSET to FIRST_STACK_ARGUMENT (which is how it is being used).
6782 - For MIPS, remove ENABLE_PROFILER_REFERENCE_OFFSET.
6783 * jit/JITStubs.h:
6784 (JITStackFrame):
6785 (JSC):
6786 - Renamed enabledProfilerReference to unusedX.
6787 * llint/LLIntSlowPaths.cpp:
6788 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
6789 * llint/LowLevelInterpreter.asm:
6790 * profiler/Profiler.cpp:
6791 (JSC):
6792 (JSC::Profiler::startProfiling):
6793 (JSC::Profiler::stopProfiling):
6794 * profiler/Profiler.h:
6795 (Profiler):
6796 - Removed s_sharedEnabledProfilerReference, enabledProfilerReference().
6797 * runtime/JSGlobalData.cpp:
6798 (JSC::JSGlobalData::JSGlobalData):
6799 * runtime/JSGlobalData.h:
6800 (JSC):
6801 (JSC::JSGlobalData::enabledProfiler):
6802 (JSGlobalData):
6803 - Added m_enabledProfiler, enabledProfiler().
6804 * runtime/JSGlobalObject.cpp:
6805 (JSC::JSGlobalObject::~JSGlobalObject):
6806
fpizlo@apple.com3d579cc2012-06-04 23:27:34 +000068072012-06-04 Filip Pizlo <fpizlo@apple.com>
6808
fpizlo@apple.com477ce382012-06-04 23:32:57 +00006809 get_argument_by_val should be profiled everywhere
6810 https://bugs.webkit.org/show_bug.cgi?id=88205
6811
6812 Reviewed by Geoffrey Garen.
6813
6814 * jit/JITOpcodes32_64.cpp:
6815 (JSC::JIT::emitSlow_op_get_argument_by_val):
6816 * llint/LLIntSlowPaths.cpp:
6817 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
6818
68192012-06-04 Filip Pizlo <fpizlo@apple.com>
6820
fpizlo@apple.com3d579cc2012-06-04 23:27:34 +00006821 DFG arguments simplification takes unkindly to direct accesses to the arguments register
6822 https://bugs.webkit.org/show_bug.cgi?id=88261
6823
6824 Reviewed by Geoffrey Garen.
6825
6826 Fixed arguments simplification for direct accesses to the arguments register, which may
6827 arise if CSE had not run. Fixed CSE so that it does run prior to arguments simplification,
6828 by making it a full-fledged member of the fixpoint. Fixed other issues in arguments
6829 simplification, like realizing that it needs to bail if there is a direct assignment to
6830 the arguments register, and failing to turn CreateArguments into PhantomArguments. Also
6831 fixed CSE's handling of store elimination of captured locals in the presence of a
6832 GetMyArgumentByVal (or one of its friends), and fixed CSE to correctly fixup variables at
6833 tail if the Flush it removes is the last operation on a local in a basic block.
6834
6835 * bytecode/CodeBlock.cpp:
6836 (JSC::CodeBlock::dump):
6837 * dfg/DFGArgumentsSimplificationPhase.cpp:
6838 (JSC::DFG::ArgumentsSimplificationPhase::run):
6839 (JSC::DFG::ArgumentsSimplificationPhase::isOKToOptimize):
6840 * dfg/DFGCSEPhase.cpp:
6841 (JSC::DFG::CSEPhase::run):
6842 (JSC::DFG::CSEPhase::setLocalStoreElimination):
6843 (JSC::DFG::CSEPhase::performNodeCSE):
6844 (CSEPhase):
6845 * dfg/DFGDriver.cpp:
6846 (JSC::DFG::compile):
6847
andersca@apple.comea6c6b22012-06-04 21:56:32 +000068482012-06-04 Anders Carlsson <andersca@apple.com>
6849
6850 Fix a struct/class mismatch.
6851
6852 * heap/Handle.h:
6853 (Handle):
6854
ddkilzer@apple.comba58a612012-06-04 14:55:26 +000068552012-06-04 David Kilzer <ddkilzer@apple.com>
6856
6857 BUILD FIX: FeatureDefines.xcconfig should match across projects
6858
6859 * Configurations/FeatureDefines.xcconfig:
6860 - Add missing ENABLE_LEGACY_CSS_VENDOR_PREFIXES.
6861
ggaren@apple.com02dec622012-06-03 21:16:55 +000068622012-06-02 Geoffrey Garen <ggaren@apple.com>
6863
6864 Weak pointer finalization should be lazy
6865 https://bugs.webkit.org/show_bug.cgi?id=87599
6866
6867 Reviewed by Sam Weinig.
6868
6869 This time for sure!
6870
6871 * heap/Heap.cpp:
6872 (JSC::Heap::collect): Don't sweep eagerly -- we'll sweep lazily instead.
6873
6874 * heap/MarkedBlock.cpp:
6875 (JSC::MarkedBlock::sweep): Sweep our weak set before we sweep our other
6876 destructors -- this is our last chance to run weak set finalizers before
6877 we recycle our memory.
6878
6879 * heap/MarkedBlock.h:
6880 (JSC::MarkedBlock::resetAllocator):
6881 * heap/MarkedSpace.cpp:
6882 (JSC::MarkedSpace::resetAllocators):
6883 * heap/MarkedSpace.h:
6884 (JSC::MarkedSpace::resetAllocators): Don't force allocator reset anymore.
6885 It will happen automatically when a weak set is swept. It's simpler to
6886 have only one canonical way for this to happen, and it wasn't buying
6887 us anything to do it eagerly.
6888
6889 * heap/WeakBlock.cpp:
6890 (JSC::WeakBlock::sweep): Don't short-circuit a sweep unless we know
6891 the sweep would be a no-op. If even one finalizer is pending, we need to
6892 run it, since we won't get another chance.
6893
6894 * heap/WeakSet.cpp:
6895 (JSC::WeakSet::sweep): This loop can be simpler now that
6896 WeakBlock::sweep() does what we mean.
6897
6898 Reset our allocator after a sweep because this is the optimal time to
6899 start trying to recycle old weak pointers.
6900
6901 (JSC::WeakSet::tryFindAllocator): Don't sweep when searching for an
6902 allocator because we've swept already, and forcing a new sweep would be
6903 wasteful.
6904
6905 * heap/WeakSet.h:
6906 (JSC::WeakSet::shrink): Be sure to reset our allocator after a shrink
6907 because the shrink may have removed the block the allocator was going to
6908 allocate out of.
6909
fpizlo@apple.comb80bc2a32012-06-02 22:58:48 +000069102012-06-02 Filip Pizlo <fpizlo@apple.com>
6911
fpizlo@apple.come0c200c2012-06-03 00:41:08 +00006912 If the DFG bytecode parser detects that op_method_check has gone polymorphic, it
6913 shouldn't revert all the way to GetById/GetByIdFlush
6914 https://bugs.webkit.org/show_bug.cgi?id=88176
6915
6916 Reviewed by Geoffrey Garen.
6917
6918 Refactored the code so that the op_method_check case of the parser gracefully falls
6919 through to all of the goodness of the normal op_get_by_id case.
6920
6921 * dfg/DFGByteCodeParser.cpp:
6922 (ByteCodeParser):
6923 (JSC::DFG::ByteCodeParser::handleGetById):
6924 (DFG):
6925 (JSC::DFG::ByteCodeParser::parseBlock):
6926
69272012-06-02 Filip Pizlo <fpizlo@apple.com>
6928
fpizlo@apple.comb80bc2a32012-06-02 22:58:48 +00006929 DFG CSE should be able to eliminate unnecessary flushes of arguments and captured variables
6930 https://bugs.webkit.org/show_bug.cgi?id=87929
6931
6932 Reviewed by Geoffrey Garen.
6933
6934 Slight speed-up on V8. Big win (up to 50%) on programs that inline very small functions.
6935
6936 This required a bunch of changes:
6937
6938 - The obvious change is making CSE essentially ignore whether or not the set of
6939 operations between the Flush and the SetLocal can exit, and instead focus on whether or
6940 not that set of operations can clobber the world or access local variables. This code
6941 is now refactored to return a set of flags indicating any of these events, and the CSE
6942 decides what to do based on those flags. If the set of operations is non-clobbering
6943 and non-accessing, then the Flush is turned into a Phantom on the child of the
6944 SetLocal. This expands the liveness of the relevant variable but virtually guarantees
6945 that it will be register allocated and not flushed to the stack. So, yeah, this patch
6946 is a lot of work to save a few stores to the stack.
6947
6948 - Previously, CheckArgumentsNotCreated was optimized "lazily" in that you only knew if
6949 it was a no-op if you were holding onto a CFA abstract state. But this would make the
6950 CSE act pessimistically, since it doesn't use the CFA. Hence, this patch changes the
6951 constant folding phase into something more broad; it now fixes up
6952 CheckArgumentsNotCreated nodes by turning them into phantoms if it knows that they are
6953 no-ops.
6954
6955 - Arguments simplification was previously relying on this very strange PhantomArguments
6956 node, which had two different meanings: for normal execution it meant the empty value
6957 but for OSR exit it meant that the arguments should be reified. This produces problems
6958 when set SetLocals to the captured arguments registers are CSE'd away, since we'd be
6959 triggering reification of arguments without having initialized the arguments registers
6960 to empty. The cleanest solution was to fix PhantomArguments to have one meaning:
6961 namely, arguments reification on OSR exit. Hence, this patch changes arguments
6962 simplification to change SetLocal of CreateArguments on the arguments registers to be
6963 a SetLocal of Empty.
6964
6965 - Argument value recoveries were previously derived from the value source of the
6966 arguments at the InlineStart. But that relies on all SetLocals to arguments having
6967 been flushed. It's possible that we could have elided the SetLocal to the arguments
6968 at the callsite because there were subsequent SetLocals to the arguments inside of the
6969 callee, in which case the InlineStart would get the wrong information. Hence, this
6970 patch changes argument value recovery computation to operate over the ArgumentPositions
6971 directly.
6972
6973 - But that doesn't actually work, because previously, there was no way to link an
6974 InlineStart back to the corresponding ArgumentPositions, at least not without some
6975 ugliness. So this patch instates the rule that the m_argumentPositions vector consists
6976 of disjoint subsequences such that each subsequence corresponds to an inline callsite
6977 and can be identified by its first index, and within each subsequence are the
6978 ArgumentPositions of all of the arguments ordered by argument index. This required
6979 flipping the order in which ArgumentPositions are added to the vector, and giving
6980 InlineStart an operand that indicates the start of that inline callsite's
6981 ArgumentPosition subsequence.
6982
6983 - This patch also revealed a nasty bug in the reification of arguments in inline call
6984 frames on OSR exit. Since the reification was happening after the values of virtual
6985 registers were recovered, the value recoveries of the inline arguments were wrong.
6986 Hence using operationCreateInlinedArguments is wrong. For example a value recovery
6987 might say that you have to box a double, but if we had already boxed it then boxing
6988 it a second time will result in garbage. The specific case of this bug was this patch
6989 uncovered was that now it is possible for an inline call frame to not have any valid
6990 value recoveries for any inline arguments, if the optimization elides all argument
6991 flushes, while at the same time optimizing away arguments creation. Then OSR exit
6992 would try to recover the arguments using the inline call frame, which had bogus
6993 information, and humorous crashes would ensue. This patch fixes this issue by moving
6994 arguments reification to after call frame reification, so that arguments reification
6995 can always use operationCreateArguments instead of operationCreateInlinedArguments.
6996
6997 - This patch may turn a Flush into a Phantom. That's kind of the whole point. But that
6998 broke forward speculation checks, which knew to look for a Flush prior to a SetLocal
6999 but didn't know that there could alternatively be a Phantom in place of the Flush.
7000 This patch fixes that by augmenting the forward speculation check logic.
7001
7002 - Finally, in the process of having fun with all of the above, I realized that my DFG
7003 validation was not actually running on every phase like I had originally designed it
7004 to. In fact it was only running just after bytecode parsing. I initially tried to
7005 make it run in every phase but found that this causes some tests to timeout
7006 (specifically the evil fuzzing ones), so I decided on a compromise where: (i) in
7007 release mode validation never runs, (ii) in debug mode validation will run just
7008 after parsing and just before the backend, and (iii) it's possible with a simple
7009 switch to enable validation to run on every phase.
7010
7011 Luckily all of the above issues were already covered by the 77 or so DFG-specific
7012 layout tests. Hence, this patch does not introduce any new tests despite being so
7013 meaty.
7014
7015 * dfg/DFGAbstractState.cpp:
7016 (JSC::DFG::AbstractState::execute):
7017 * dfg/DFGArgumentPosition.h:
7018 (JSC::DFG::ArgumentPosition::prediction):
7019 (JSC::DFG::ArgumentPosition::doubleFormatState):
7020 (JSC::DFG::ArgumentPosition::shouldUseDoubleFormat):
7021 (ArgumentPosition):
7022 * dfg/DFGArgumentsSimplificationPhase.cpp:
7023 (JSC::DFG::ArgumentsSimplificationPhase::run):
7024 * dfg/DFGByteCodeParser.cpp:
7025 (JSC::DFG::ByteCodeParser::handleInlining):
7026 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
7027 * dfg/DFGCSEPhase.cpp:
7028 (JSC::DFG::CSEPhase::SetLocalStoreEliminationResult::SetLocalStoreEliminationResult):
7029 (SetLocalStoreEliminationResult):
7030 (JSC::DFG::CSEPhase::setLocalStoreElimination):
7031 (JSC::DFG::CSEPhase::performNodeCSE):
7032 * dfg/DFGCommon.h:
7033 * dfg/DFGConstantFoldingPhase.cpp:
7034 (JSC::DFG::ConstantFoldingPhase::run):
7035 * dfg/DFGDriver.cpp:
7036 (JSC::DFG::compile):
7037 * dfg/DFGNode.h:
7038 (Node):
7039 (JSC::DFG::Node::hasArgumentPositionStart):
7040 (JSC::DFG::Node::argumentPositionStart):
7041 * dfg/DFGOSRExitCompiler32_64.cpp:
7042 (JSC::DFG::OSRExitCompiler::compileExit):
7043 * dfg/DFGOSRExitCompiler64.cpp:
7044 (JSC::DFG::OSRExitCompiler::compileExit):
7045 * dfg/DFGPhase.cpp:
7046 (DFG):
7047 * dfg/DFGPhase.h:
7048 (Phase):
7049 * dfg/DFGSpeculativeJIT.cpp:
7050 (JSC::DFG::SpeculativeJIT::compile):
7051 * dfg/DFGSpeculativeJIT.h:
7052 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
7053 * dfg/DFGSpeculativeJIT32_64.cpp:
7054 (JSC::DFG::SpeculativeJIT::compile):
7055 * dfg/DFGSpeculativeJIT64.cpp:
7056 (JSC::DFG::SpeculativeJIT::compile):
7057
ggaren@apple.com32eb24b2012-06-02 22:49:05 +000070582012-06-02 Geoffrey Garen <ggaren@apple.com>
7059
7060 DOM string cache should hash pointers, not characters
7061 https://bugs.webkit.org/show_bug.cgi?id=88175
7062
7063 Reviewed by Phil Pizlo and Sam Weinig.
7064
7065 * heap/Weak.h:
7066 (JSC::weakAdd):
7067 (JSC::weakRemove): Made these function templates slightly more generic
7068 to accommodate new client types.
7069
fpizlo@apple.comcc5b61b2012-06-01 21:32:45 +000070702012-06-01 Filip Pizlo <fpizlo@apple.com>
7071
fpizlo@apple.coma4754892012-06-02 00:22:31 +00007072 DFG CFA should know that PutByVal can clobber the world
7073 https://bugs.webkit.org/show_bug.cgi?id=88155
7074
7075 Reviewed by Gavin Barraclough.
7076
7077 * dfg/DFGAbstractState.cpp:
7078 (JSC::DFG::AbstractState::execute):
7079
70802012-06-01 Filip Pizlo <fpizlo@apple.com>
7081
fpizlo@apple.com8e537cd2012-06-01 23:54:36 +00007082 DFG CFA should mark basic blocks as having constants if local accesses yield constants
7083 https://bugs.webkit.org/show_bug.cgi?id=88153
7084
7085 Reviewed by Gavin Barraclough.
7086
7087 * dfg/DFGAbstractState.cpp:
7088 (JSC::DFG::AbstractState::execute):
7089
70902012-06-01 Filip Pizlo <fpizlo@apple.com>
7091
fpizlo@apple.comacc9dd22012-06-01 23:47:28 +00007092 DFG arguments simplification phase uses a node.codeOrigin after appending a node
7093 https://bugs.webkit.org/show_bug.cgi?id=88151
7094
7095 Reviewed by Geoffrey Garen.
7096
7097 The right thing to do is to save the CodeOrigin before appending to the graph.
7098
7099 * dfg/DFGArgumentsSimplificationPhase.cpp:
7100 (JSC::DFG::ArgumentsSimplificationPhase::run):
7101
71022012-06-01 Filip Pizlo <fpizlo@apple.com>
7103
fpizlo@apple.com4f337c22012-06-01 23:18:59 +00007104 DFG should not emit unnecessary speculation checks when performing an int32 to double conversion on
7105 a value that is proved to be a number, predicted to be an int32, but not proved to be an int32
7106 https://bugs.webkit.org/show_bug.cgi?id=88146
7107
7108 Reviewed by Gavin Barraclough.
7109
7110 * dfg/DFGSpeculativeJIT.cpp:
7111 (JSC::DFG::SpeculativeJIT::compileInt32ToDouble):
7112
71132012-06-01 Filip Pizlo <fpizlo@apple.com>
7114
fpizlo@apple.comafc07412012-06-01 22:44:43 +00007115 DFG constant folding search for the last local access skips the immediately previous local access
7116 https://bugs.webkit.org/show_bug.cgi?id=88141
7117
7118 Reviewed by Michael Saboff.
7119
7120 If you use a loop in the style of:
7121
7122 for (i = start; i--;)
7123
7124 then you need to remember that the first value of 'i' that the loop body will see is 'start - 1'.
7125 Hence the following is probably wrong:
7126
7127 for (i = start - 1; i--;)
7128
7129 * dfg/DFGConstantFoldingPhase.cpp:
7130 (JSC::DFG::ConstantFoldingPhase::run):
7131
71322012-06-01 Filip Pizlo <fpizlo@apple.com>
7133
fpizlo@apple.comcc5b61b2012-06-01 21:32:45 +00007134 DFG constant folding should be OK with GetLocal of captured variables having a constant
7135 https://bugs.webkit.org/show_bug.cgi?id=88137
7136
7137 Reviewed by Gavin Barraclough.
7138
7139 * dfg/DFGConstantFoldingPhase.cpp:
7140 (JSC::DFG::ConstantFoldingPhase::run):
7141
mhahnenberg@apple.com016c5782012-06-01 00:02:09 +000071422012-05-31 Mark Hahnenberg <mhahnenberg@apple.com>
7143
7144 JSGlobalObject does not mark m_privateNameStructure
7145 https://bugs.webkit.org/show_bug.cgi?id=88023
7146
7147 Rubber stamped by Gavin Barraclough.
7148
7149 * runtime/JSGlobalObject.cpp:
7150 (JSC::JSGlobalObject::visitChildren): We need to mark this so it doesn't get
7151 inadvertently garbage collected.
7152
arv@chromium.org31fddbc2012-05-31 18:00:03 +000071532012-05-31 Erik Arvidsson <arv@chromium.org>
7154
7155 Make DOM Exceptions Errors
7156 https://bugs.webkit.org/show_bug.cgi?id=85078
7157
7158 Reviewed by Oliver Hunt.
7159
7160 WebIDL mandates that exceptions should have Error.prototype on its prototype chain.
7161
7162 For JSC we have access to the Error.prototype from the binding code.
7163
7164 For V8 we set a field in the WrapperTypeInfo and when the constructor function is created we
7165 set the prototype as needed.
7166
7167 Updated test: fast/dom/DOMException/prototype-object.html
7168
7169 * JavaScriptCore.xcodeproj/project.pbxproj:
7170 * runtime/JSGlobalObject.cpp:
7171 (JSC::JSGlobalObject::reset):
7172 * runtime/JSGlobalObject.h:
7173 (JSC):
7174 (JSGlobalObject):
7175 (JSC::JSGlobalObject::errorPrototype):
7176
wingo@igalia.com8de6a8a2012-05-31 17:28:21 +000071772012-05-31 Andy Wingo <wingo@igalia.com>
7178
7179 Fix reference to unset variable in debug mode
7180 https://bugs.webkit.org/show_bug.cgi?id=87981
7181
7182 Reviewed by Geoffrey Garen.
7183
7184 * runtime/JSONObject.cpp (Stringifier::Holder::Holder):
7185 Initialize m_size in debug mode, as we check it later in an assert.
7186
mhahnenberg@apple.comeb39abc2012-05-31 03:04:00 +000071872012-05-30 Mark Hahnenberg <mhahnenberg@apple.com>
7188
7189 Heap should sweep incrementally
7190 https://bugs.webkit.org/show_bug.cgi?id=85429
7191
7192 We shouldn't have to wait for the opportunistic GC timer to fire in order
7193 to call object destructors. Instead, we should incrementally sweep some
7194 subset of the blocks requiring sweeping periodically. We tie this sweeping
7195 to a timer rather than to collections because we want to reclaim this memory
7196 even if we stop allocating. This way, our memory usage scales smoothly with
7197 actual use, regardless of whether we've recently done an opportunistic GC or not.
7198
7199 Reviewed by Geoffrey Garen.
7200
7201 * CMakeLists.txt:
7202 * GNUmakefile.list.am:
7203 * JavaScriptCore.gypi:
7204 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7205 * JavaScriptCore.xcodeproj/project.pbxproj:
7206 * Target.pri:
7207 * heap/Heap.cpp:
7208 (JSC::Heap::Heap):
7209 (JSC::Heap::collect): We no longer sweep during a full sweep. We only shrink now,
7210 which we will switch over to being done during incremental sweeping too as soon as
7211 all finalizers can be run lazily (and, by extension, incrementally).
7212 (JSC::Heap::sweeper):
7213 (JSC):
7214 * heap/Heap.h:
7215 (JSC):
7216 (Heap):
7217 * heap/IncrementalSweeper.cpp: Added.
7218 (JSC):
7219 (JSC::IncrementalSweeper::timerDidFire): The IncrementalSweeper works very similarly to
7220 GCActivityCallback. It is tied to a run-loop based timer that fires periodically based
7221 on how long the previous sweep increment took to run. The IncrementalSweeper doesn't do
7222 anything if the platform doesn't support CoreFoundation.
7223 (JSC::IncrementalSweeper::IncrementalSweeper):
7224 (JSC::IncrementalSweeper::~IncrementalSweeper):
7225 (JSC::IncrementalSweeper::create):
7226 (JSC::IncrementalSweeper::scheduleTimer):
7227 (JSC::IncrementalSweeper::cancelTimer):
7228 (JSC::IncrementalSweeper::doSweep): Iterates over the snapshot of the MarkedSpace taken
7229 during the last collection, checking to see which blocks need sweeping. If it successfully
7230 gets to the end of the blocks that need sweeping then it cancels the timer.
7231 (JSC::IncrementalSweeper::startSweeping): We take a snapshot of the Heap and store it in
7232 a Vector that the incremental sweep will iterate over. We also reset our index into this Vector.
7233 * heap/IncrementalSweeper.h: Added.
7234 (JSC):
7235 (IncrementalSweeper):
7236 * heap/MarkedBlock.h:
7237 (JSC::MarkedBlock::needsSweeping): If a block is in the Marked state it needs sweeping
7238 to be usable and to run any destructors that need to be run.
7239
paroga@webkit.orgecd0fb62012-05-31 01:38:17 +000072402012-05-30 Patrick Gansterer <paroga@webkit.org>
7241
7242 [WINCE] Fix JSString after r115516.
7243 https://bugs.webkit.org/show_bug.cgi?id=87892
7244
7245 Reviewed by Geoffrey Garen.
7246
7247 r115516 splitted JSString into two classes, with addition nested classes.
7248 Add a workaround for the WinCE compiler since it can't resolve the friend class
7249 declerations corretly and denies the access to protected members of JSString.
7250
7251 * runtime/JSString.h:
7252 (JSC::JSRopeString::RopeBuilder::append):
7253 (JSC::JSRopeString::append):
7254 (JSRopeString):
7255
oliver@apple.com3c996382012-05-30 23:47:27 +000072562012-05-30 Oliver Hunt <oliver@apple.com>
7257
7258 Really provide error information with the inspector disabled
7259 https://bugs.webkit.org/show_bug.cgi?id=87910
7260
7261 Reviewed by Filip Pizlo.
7262
7263 Don't bother checking for anything other than pre-existing error info.
7264 In the absence of complete line number information you'll only get the
7265 line a function starts on, but at least it's something.
7266
7267 * interpreter/Interpreter.cpp:
7268 (JSC::Interpreter::throwException):
7269
fpizlo@apple.com074918c2012-05-30 20:18:00 +000072702012-05-30 Filip Pizlo <fpizlo@apple.com>
7271
fpizlo@apple.com5673fe62012-05-30 23:09:45 +00007272 LLInt broken on x86-32 with JIT turned off
7273 https://bugs.webkit.org/show_bug.cgi?id=87906
7274
7275 Reviewed by Geoffrey Garen.
7276
7277 Fixed the code to not clobber registers that contain important things, like the call frame.
7278
7279 * llint/LowLevelInterpreter32_64.asm:
7280
72812012-05-30 Filip Pizlo <fpizlo@apple.com>
7282
fpizlo@apple.com074918c2012-05-30 20:18:00 +00007283 ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
7284 https://bugs.webkit.org/show_bug.cgi?id=87887
7285
fpizlo@apple.comd55e8152012-05-30 21:04:23 +00007286 Reviewed by Darin Adler.
7287
7288 Better fix - we now never call SourceProvider::asID() if SourceProvider* is 0.
7289
7290 * parser/Nodes.h:
7291 (JSC::ScopeNode::sourceID):
7292 * parser/SourceCode.h:
7293 (JSC::SourceCode::providerID):
7294 (SourceCode):
7295 * parser/SourceProvider.h:
7296 (SourceProvider):
7297 (JSC::SourceProvider::asID):
7298 * runtime/Executable.h:
7299 (JSC::ScriptExecutable::sourceID):
7300
73012012-05-30 Filip Pizlo <fpizlo@apple.com>
7302
7303 ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
7304 https://bugs.webkit.org/show_bug.cgi?id=87887
7305
fpizlo@apple.com074918c2012-05-30 20:18:00 +00007306 Reviewed by Geoffrey Garen.
7307
7308 * parser/SourceProvider.h:
7309 (JSC::SourceProvider::asID):
7310
oliver@apple.comc55314a2012-05-30 19:45:20 +000073112012-05-30 Oliver Hunt <oliver@apple.com>
7312
7313 DFG does not correctly handle exceptions caught in the LLInt
7314 https://bugs.webkit.org/show_bug.cgi?id=87885
7315
7316 Reviewed by Filip Pizlo.
7317
7318 Make the DFG use genericThrow, rather than reimplementing a small portion of it.
7319 Also make the LLInt slow paths validate that their PC is correct.
7320
7321 * dfg/DFGOperations.cpp:
7322 * llint/LLIntSlowPaths.cpp:
7323 (LLInt):
7324
fpizlo@apple.com75824e82012-05-30 17:02:49 +000073252012-05-29 Filip Pizlo <fpizlo@apple.com>
7326
7327 DFG CFA should infer types and values of captured variables
7328 https://bugs.webkit.org/show_bug.cgi?id=87813
7329
7330 Reviewed by Gavin Barraclough.
7331
7332 Slight speed-up in V8/earley-boyer (~1%).
7333
7334 * bytecode/CodeBlock.h:
7335 (JSC::CodeBlock::argumentsAreCaptured):
7336 (JSC::CodeBlock::argumentIsCaptured):
7337 (CodeBlock):
7338 * dfg/DFGAbstractState.cpp:
7339 (DFG):
7340 (JSC::DFG::AbstractState::beginBasicBlock):
7341 (JSC::DFG::AbstractState::initialize):
7342 (JSC::DFG::AbstractState::endBasicBlock):
7343 (JSC::DFG::AbstractState::execute):
7344 (JSC::DFG::AbstractState::clobberWorld):
7345 (JSC::DFG::AbstractState::clobberStructures):
7346 (JSC::DFG::AbstractState::mergeStateAtTail):
7347 (JSC::DFG::AbstractState::merge):
7348 (JSC::DFG::AbstractState::mergeToSuccessors):
7349 * dfg/DFGAbstractState.h:
7350 (JSC::DFG::AbstractState::variables):
7351 (AbstractState):
7352 * dfg/DFGSpeculativeJIT32_64.cpp:
7353 (JSC::DFG::SpeculativeJIT::compile):
7354 * dfg/DFGSpeculativeJIT64.cpp:
7355 (JSC::DFG::SpeculativeJIT::compile):
7356
paroga@webkit.orge373ab72012-05-30 16:44:03 +000073572012-05-30 Patrick Gansterer <paroga@webkit.org>
7358
7359 Unreviewed. Build fix for !ENABLE(JIT) after r117823.
7360
7361 * bytecode/CodeBlock.cpp:
7362 (JSC::CodeBlock::dump):
7363
commit-queue@webkit.org4ac40e0d2012-05-30 07:17:05 +000073642012-05-30 Sheriff Bot <webkit.review.bot@gmail.com>
7365
7366 Unreviewed, rolling out r118868.
7367 http://trac.webkit.org/changeset/118868
7368 https://bugs.webkit.org/show_bug.cgi?id=87828
7369
7370 introduced ~20 crashes on Mac and Qt bots (Requested by pizlo_
7371 on #webkit).
7372
7373 * heap/Heap.cpp:
7374 (JSC::Heap::collect):
7375 * heap/MarkedBlock.cpp:
7376 (JSC::MarkedBlock::sweep):
7377 * heap/MarkedBlock.h:
7378 (JSC::MarkedBlock::sweepWeakSet):
7379 (JSC):
7380 * heap/MarkedSpace.cpp:
7381 (JSC::SweepWeakSet::operator()):
7382 (JSC):
7383 (JSC::MarkedSpace::sweepWeakSets):
7384 * heap/MarkedSpace.h:
7385 (MarkedSpace):
7386
ggaren@apple.com15344ae2012-05-30 01:05:35 +000073872012-05-29 Geoffrey Garen <ggaren@apple.com>
7388
7389 Rolled back in r118646, now that
7390 https://bugs.webkit.org/show_bug.cgi?id=87784 is fixed.
7391
7392 http://trac.webkit.org/changeset/118646
7393 https://bugs.webkit.org/show_bug.cgi?id=87599
7394
7395 * heap/Heap.cpp:
7396 (JSC::Heap::collect):
7397 * heap/MarkedBlock.cpp:
7398 (JSC::MarkedBlock::sweep):
7399 * heap/MarkedBlock.h:
7400 (JSC):
7401 * heap/MarkedSpace.cpp:
7402 (JSC):
7403 * heap/MarkedSpace.h:
7404 (MarkedSpace):
7405
fpizlo@apple.com4c0875e2012-05-29 23:43:16 +000074062012-05-29 Filip Pizlo <fpizlo@apple.com>
7407
7408 DFG should keep captured variables alive until the (inline) return.
7409 https://bugs.webkit.org/show_bug.cgi?id=87205
7410
7411 Reviewed by Gavin Barraclough.
7412
7413 Changes the way we do flushing for captured variables and arguments. Instead of flushing
7414 each SetLocal immediately, we flush at kill points. So a SetLocal will cause a Flush of
7415 whatever was live in the variable previously, and a return will cause a Flush of all
7416 captured variables and all arguments.
7417
7418 * dfg/DFGByteCodeParser.cpp:
7419 (JSC::DFG::ByteCodeParser::setDirect):
7420 (JSC::DFG::ByteCodeParser::set):
7421 (JSC::DFG::ByteCodeParser::setLocal):
7422 (JSC::DFG::ByteCodeParser::getArgument):
7423 (JSC::DFG::ByteCodeParser::setArgument):
7424 (JSC::DFG::ByteCodeParser::findArgumentPositionForArgument):
7425 (ByteCodeParser):
7426 (JSC::DFG::ByteCodeParser::findArgumentPositionForLocal):
7427 (JSC::DFG::ByteCodeParser::findArgumentPosition):
7428 (JSC::DFG::ByteCodeParser::flush):
7429 (JSC::DFG::ByteCodeParser::flushDirect):
7430 (JSC::DFG::ByteCodeParser::flushArgumentsAndCapturedVariables):
7431 (JSC::DFG::ByteCodeParser::handleInlining):
7432 (JSC::DFG::ByteCodeParser::parseBlock):
7433 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
7434 * dfg/DFGCSEPhase.cpp:
7435 (JSC::DFG::CSEPhase::setLocalStoreElimination):
7436 (JSC::DFG::CSEPhase::performNodeCSE):
7437 * dfg/DFGSpeculativeJIT.cpp:
7438 (JSC::DFG::SpeculativeJIT::compile):
7439 * dfg/DFGSpeculativeJIT.h:
7440 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
7441
ggaren@apple.com7cc57362012-05-29 23:40:26 +000074422012-05-29 Geoffrey Garen <ggaren@apple.com>
7443
7444 WeakGCMap should be lazy-finalization-safe
7445 https://bugs.webkit.org/show_bug.cgi?id=87784
7446
7447 Reviewed by Darin Adler.
7448
7449 * runtime/WeakGCMap.h:
7450 (JSC::WeakGCMap::get): Since this is a map of raw WeakImpl pointers, and
7451 not Weak<T>, we need to verify manually that the WeakImpl is live before
7452 we return its payload.
7453
mhahnenberg@apple.com7ea7e8f2012-05-29 18:38:14 +000074542012-05-29 Mark Hahnenberg <mhahnenberg@apple.com>
7455
7456 CopiedSpace::doneCopying could start another collection
7457 https://bugs.webkit.org/show_bug.cgi?id=86538
7458
7459 Reviewed by Geoffrey Garen.
7460
7461 It's possible that if we don't have anything at the head of to-space
7462 after a collection and the BlockAllocator doesn't have any fresh blocks
7463 to give us right now we could start another collection while still in
7464 the middle of the first collection when we call CopiedSpace::addNewBlock().
7465
7466 One way to resolve this would be to have Heap::shouldCollect() check that
7467 m_operationInProgress is NoOperation. This would prevent the path in
7468 getFreshBlock() that starts the collection if we're already in the middle of one.
7469
7470 I could not come up with a test case to reproduce this crash on ToT.
7471
7472 * heap/Heap.h:
7473 (JSC::Heap::shouldCollect): We shouldn't collect if we're already in the middle
7474 of a collection, i.e. the current operation should be NoOperation.
7475
commit-queue@webkit.orgd5058402012-05-29 14:44:38 +000074762012-05-29 David Barr <davidbarr@chromium.org>
7477
7478 Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag
7479 https://bugs.webkit.org/show_bug.cgi?id=87685
7480
7481 Reviewed by Eric Seidel.
7482
7483 Add a configuration option for CSS image-resolution support, disabling it by default.
7484
7485 * Configurations/FeatureDefines.xcconfig:
7486
commit-queue@webkit.org10c0df22012-05-29 03:24:49 +000074872012-05-28 Sheriff Bot <webkit.review.bot@gmail.com>
7488
7489 Unreviewed, rolling out r118646.
7490 http://trac.webkit.org/changeset/118646
7491 https://bugs.webkit.org/show_bug.cgi?id=87691
7492
7493 broke V8 raytrace benchmark (Requested by pizlo_ on #webkit).
7494
7495 * heap/Heap.cpp:
7496 (JSC::Heap::collect):
7497 * heap/MarkedBlock.cpp:
7498 (JSC::MarkedBlock::sweep):
7499 * heap/MarkedBlock.h:
7500 (JSC::MarkedBlock::sweepWeakSet):
7501 (JSC):
7502 * heap/MarkedSpace.cpp:
7503 (JSC::SweepWeakSet::operator()):
7504 (JSC):
7505 (JSC::MarkedSpace::sweepWeakSets):
7506 * heap/MarkedSpace.h:
7507 (MarkedSpace):
7508
fpizlo@apple.com26ece8e2012-05-29 02:43:30 +000075092012-05-28 Filip Pizlo <fpizlo@apple.com>
7510
7511 DFG should not generate code for code that the CFA proves to be unreachable
7512 https://bugs.webkit.org/show_bug.cgi?id=87682
7513
7514 Reviewed by Sam Weinig.
7515
7516 This also fixes a small performance bug where CFA was not marking blocks
7517 as having constants (and hence not triggering constant folding) if the only
7518 constants were on GetLocals.
7519
7520 And fixing that bug revealed another bug: constant folding was assuming that
7521 a GetLocal must be the first access to a local in a basic block. This isn't
7522 true. The first access may be a Flush. This patch fixes that issue using the
7523 safest approach possible, since we don't need to be clever for something that
7524 only happens in one of our benchmarks.
7525
7526 * dfg/DFGAbstractState.cpp:
7527 (JSC::DFG::AbstractState::execute):
7528 * dfg/DFGConstantFoldingPhase.cpp:
7529 (JSC::DFG::ConstantFoldingPhase::run):
7530 * dfg/DFGJITCompiler.h:
7531 (JSC::DFG::JITCompiler::noticeOSREntry):
7532 * dfg/DFGSpeculativeJIT.cpp:
7533 (JSC::DFG::SpeculativeJIT::compile):
7534
carlosgc@webkit.orgb69727c2012-05-28 10:21:31 +000075352012-05-28 Carlos Garcia Campos <cgarcia@igalia.com>
7536
7537 Unreviewed. Fix make distcheck.
7538
7539 * GNUmakefile.list.am: Add missing header file.
7540
ggaren@apple.comb816d752012-05-28 04:56:01 +000075412012-05-27 Geoffrey Garen <ggaren@apple.com>
7542
7543 Weak pointer finalization should be lazy
7544 https://bugs.webkit.org/show_bug.cgi?id=87599
7545
7546 Reviewed by Darin Adler.
7547
7548 * heap/Heap.cpp:
7549 (JSC::Heap::collect): Don't force immediate finalization -- it will
7550 happen lazily.
7551
7552 * heap/MarkedBlock.cpp:
7553 (JSC::MarkedBlock::sweep): Sweep a block's weak set when sweeping the
7554 block. The weak set may not have been swept yet, and this is our last
7555 chance to run weak finalizers before we recycle the memory they reference.
7556
7557 * heap/MarkedBlock.h:
7558 * heap/MarkedSpace.cpp:
7559 (JSC::MarkedBlock::sweepWeakSets):
7560 * heap/MarkedSpace.h:
7561 (JSC::MarkedSpace::sweepWeakSets): Nixed sweepWeakSets because it's unused
7562 now.
7563
ggaren@apple.com72da8112012-05-26 22:40:46 +000075642012-05-26 Geoffrey Garen <ggaren@apple.com>
7565
7566 WebKit should be lazy-finalization-safe (esp. the DOM) v2
7567 https://bugs.webkit.org/show_bug.cgi?id=87581
7568
7569 Reviewed by Oliver Hunt.
7570
7571 * heap/MarkedBlock.cpp:
7572 (JSC::MarkedBlock::callDestructor):
7573 * heap/WeakBlock.h:
7574 * heap/WeakSetInlines.h:
7575 (JSC::WeakBlock::finalize): Since we don't guarantee destruction order,
7576 it's not valid to access GC pointers like the Structure pointer during
7577 finalization. We NULL out the structure pointer in debug builds to try
7578 to make this programming mistake more obvious.
7579
7580 * API/JSCallbackConstructor.cpp:
7581 (JSC::JSCallbackConstructor::destroy):
7582 * API/JSCallbackObject.cpp:
7583 (JSC::::destroy):
7584 (JSC::JSCallbackObjectData::finalize):
7585 * runtime/Arguments.cpp:
7586 (JSC::Arguments::destroy):
7587 * runtime/DateInstance.cpp:
7588 (JSC::DateInstance::destroy):
7589 * runtime/Error.cpp:
7590 (JSC::StrictModeTypeErrorFunction::destroy):
7591 * runtime/Executable.cpp:
7592 (JSC::ExecutableBase::destroy):
7593 (JSC::NativeExecutable::destroy):
7594 (JSC::ScriptExecutable::destroy):
7595 (JSC::EvalExecutable::destroy):
7596 (JSC::ProgramExecutable::destroy):
7597 (JSC::FunctionExecutable::destroy):
7598 * runtime/JSGlobalObject.cpp:
7599 (JSC::JSGlobalObject::destroy):
7600 * runtime/JSPropertyNameIterator.cpp:
7601 (JSC::JSPropertyNameIterator::destroy):
7602 * runtime/JSStaticScopeObject.cpp:
7603 (JSC::JSStaticScopeObject::destroy):
7604 * runtime/JSString.cpp:
7605 (JSC::JSString::destroy):
7606 * runtime/JSVariableObject.cpp:
7607 (JSC::JSVariableObject::destroy):
7608 * runtime/NameInstance.cpp:
7609 (JSC::NameInstance::destroy):
7610 * runtime/RegExp.cpp:
7611 (JSC::RegExp::destroy):
7612 * runtime/RegExpConstructor.cpp:
7613 (JSC::RegExpConstructor::destroy):
7614 * runtime/Structure.cpp:
7615 (JSC::Structure::destroy):
7616 * runtime/StructureChain.cpp:
7617 (JSC::StructureChain::destroy): Use static_cast instead of jsCast because
7618 jsCast does Structure-based validation, and our Structure is not guaranteed
7619 to be alive when we get finalized.
7620
fpizlo@apple.com7e0f6502012-05-25 22:45:57 +000076212012-05-22 Filip Pizlo <fpizlo@apple.com>
7622
fpizlo@apple.com190f5252012-05-25 23:00:26 +00007623 DFG CSE should eliminate redundant WeakJSConstants
7624 https://bugs.webkit.org/show_bug.cgi?id=87179
7625
7626 Reviewed by Gavin Barraclough.
7627
7628 Merged r118141 from dfgopt.
7629
7630 * dfg/DFGCSEPhase.cpp:
7631 (JSC::DFG::CSEPhase::weakConstantCSE):
7632 (CSEPhase):
7633 (JSC::DFG::CSEPhase::performNodeCSE):
7634 * dfg/DFGNode.h:
7635 (JSC::DFG::Node::weakConstant):
7636
76372012-05-22 Filip Pizlo <fpizlo@apple.com>
7638
fpizlo@apple.com7e0f6502012-05-25 22:45:57 +00007639 DFG CSE should do redundant store elimination
7640 https://bugs.webkit.org/show_bug.cgi?id=87161
7641
7642 Reviewed by Oliver Hunt.
7643
7644 Merge r118138 from dfgopt.
7645
7646 This patch adds redundant store elimination. For example, consider this
7647 code:
7648
7649 o.x = 42;
7650 o.x = 84;
7651
7652 If o.x is speculated to be a well-behaved field, the first assignment is
7653 unnecessary, since the second just overwrites it. We would like to
7654 eliminate the first assignment in these cases. The need for this
7655 optimization arises mostly from stores that our runtime requires. For
7656 example:
7657
7658 o = {f:1, g:2, h:3};
7659
7660 This will have four assignments to the structure for the newly created
7661 object - one assignment for the empty structure, one for {f}, one for
7662 {f, g}, and one for {f, g, h}. We would like to only have the last of
7663 those assigments in this case.
7664
7665 Intriguingly, doing so for captured variables breaks the way arguments
7666 simplification used to work. Consider that prior to either arguments
7667 simplification or store elimination we will have IR that looks like:
7668
7669 a: SetLocal(r0, Empty)
7670 b: SetLocal(r1, Empty)
7671 c: GetLocal(r0)
7672 d: CreateArguments(@c)
7673 e: SetLocal(r0, @d)
7674 f: SetLocal(r1, @d)
7675
7676 Then redundant store elimination will eliminate the stores that
7677 initialize the arguments registers to Empty, but then arguments
7678 simplification eliminates the stores that initialize the arguments to
7679 the newly created arguments - and at this point we no longer have any
7680 stores to the arguments register, leading to hilarious crashes. This
7681 patch therefore changes arguments simplification to replace
7682 CreateArguments with JSConstant(Empty) rather than eliminating the
7683 SetLocals. But this revealed bugs where arguments simplification was
7684 being overzealous, so I fixed those bugs.
7685
7686 This is a minor speed-up on V8/early and a handful of other tests.
7687
7688 * bytecode/CodeBlock.h:
7689 (JSC::CodeBlock::uncheckedActivationRegister):
7690 * dfg/DFGAbstractState.cpp:
7691 (JSC::DFG::AbstractState::execute):
7692 * dfg/DFGArgumentsSimplificationPhase.cpp:
7693 (JSC::DFG::ArgumentsSimplificationPhase::run):
7694 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
7695 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUses):
7696 (JSC::DFG::ArgumentsSimplificationPhase::observeProperArgumentsUse):
7697 * dfg/DFGCSEPhase.cpp:
7698 (JSC::DFG::CSEPhase::globalVarStoreElimination):
7699 (CSEPhase):
7700 (JSC::DFG::CSEPhase::putStructureStoreElimination):
7701 (JSC::DFG::CSEPhase::putByOffsetStoreElimination):
7702 (JSC::DFG::CSEPhase::setLocalStoreElimination):
7703 (JSC::DFG::CSEPhase::setReplacement):
7704 (JSC::DFG::CSEPhase::eliminate):
7705 (JSC::DFG::CSEPhase::performNodeCSE):
7706 * dfg/DFGGraph.h:
7707 (JSC::DFG::Graph::uncheckedActivationRegisterFor):
7708 (Graph):
7709 * dfg/DFGNode.h:
7710 (JSC::DFG::Node::isPhantomArguments):
7711 (Node):
7712 (JSC::DFG::Node::hasConstant):
7713 (JSC::DFG::Node::valueOfJSConstant):
7714 (JSC::DFG::Node::hasStructureTransitionData):
7715 * dfg/DFGNodeType.h:
7716 (DFG):
7717 * dfg/DFGPredictionPropagationPhase.cpp:
7718 (JSC::DFG::PredictionPropagationPhase::propagate):
7719 * dfg/DFGSpeculativeJIT.cpp:
7720 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
7721 * dfg/DFGSpeculativeJIT32_64.cpp:
7722 (JSC::DFG::SpeculativeJIT::compile):
7723 * dfg/DFGSpeculativeJIT64.cpp:
7724 (JSC::DFG::SpeculativeJIT::compile):
7725
fpizlo@apple.com016fd682012-05-25 20:19:55 +000077262012-05-21 Filip Pizlo <fpizlo@apple.com>
7727
7728 DFG ConvertThis should just be a CheckStructure if the structure is known
7729 https://bugs.webkit.org/show_bug.cgi?id=87057
7730
7731 Reviewed by Gavin Barraclough.
7732
7733 Merged r118021 from dfgopt.
7734
7735 This gives ValueProfile the ability to track singleton values - i.e. profiling
7736 sites that always see the same value.
7737
7738 That is then used to profile the structure in op_convert_this.
7739
7740 This is then used to optimize op_convert_this into a CheckStructure if the
7741 structure is always the same.
7742
7743 That then results in better CSE in inlined code that uses 'this', since
7744 previously we couldn't CSE accesses on 'this' from different inline call frames.
7745
7746 Also fixed a bug where we were unnecessarily flushing 'this'.
7747
7748 * bytecode/CodeBlock.cpp:
7749 (JSC::CodeBlock::dump):
7750 (JSC::CodeBlock::stronglyVisitStrongReferences):
7751 * bytecode/LazyOperandValueProfile.cpp:
7752 (JSC::CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions):
7753 * bytecode/LazyOperandValueProfile.h:
7754 (CompressedLazyOperandValueProfileHolder):
7755 * bytecode/Opcode.h:
7756 (JSC):
7757 (JSC::padOpcodeName):
7758 * bytecode/ValueProfile.h:
7759 (JSC::ValueProfileBase::ValueProfileBase):
7760 (JSC::ValueProfileBase::dump):
7761 (JSC::ValueProfileBase::computeUpdatedPrediction):
7762 (ValueProfileBase):
7763 * bytecompiler/BytecodeGenerator.cpp:
7764 (JSC::BytecodeGenerator::BytecodeGenerator):
7765 * dfg/DFGByteCodeParser.cpp:
7766 (JSC::DFG::ByteCodeParser::setArgument):
7767 (JSC::DFG::ByteCodeParser::parseBlock):
7768 * jit/JITOpcodes.cpp:
7769 (JSC::JIT::emit_op_convert_this):
7770 (JSC::JIT::emitSlow_op_convert_this):
7771 * jit/JITOpcodes32_64.cpp:
7772 (JSC::JIT::emit_op_convert_this):
7773 (JSC::JIT::emitSlow_op_convert_this):
7774 * llint/LLIntSlowPaths.cpp:
7775 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
7776 * llint/LowLevelInterpreter32_64.asm:
7777 * llint/LowLevelInterpreter64.asm:
7778 * runtime/JSValue.h:
7779 (JSValue):
7780 * runtime/Structure.h:
7781 (JSC::JSValue::structureOrUndefined):
7782 (JSC):
7783
timothy_horton@apple.com3f03ac12012-05-25 06:53:27 +000077842012-05-24 Tim Horton <timothy_horton@apple.com>
7785
7786 Add feature defines for web-facing parts of CSS Regions and Exclusions
7787 https://bugs.webkit.org/show_bug.cgi?id=87442
7788 <rdar://problem/10887709>
7789
7790 Reviewed by Dan Bernstein.
7791
7792 * Configurations/FeatureDefines.xcconfig:
7793
ggaren@apple.com9e1789f2012-05-25 06:52:00 +000077942012-05-24 Geoffrey Garen <ggaren@apple.com>
7795
7796 WebKit should be lazy-finalization-safe (esp. the DOM)
7797 https://bugs.webkit.org/show_bug.cgi?id=87456
7798
7799 Reviewed by Filip Pizlo.
7800
7801 Lazy finalization adds one twist to weak pointer use:
7802
7803 A HashMap of weak pointers may contain logically null entries.
7804 (Weak pointers behave as-if null once their payloads die.)
7805 Insertion must not assume that a pre-existing entry is
7806 necessarily valid, and iteration must not assume that all
7807 entries can be dereferenced.
7808
7809 (Previously, I thought that it also added a second twist:
7810
7811 A demand-allocated weak pointer may replace a dead payload
7812 before the payload's finalizer runs. In that case, when the
7813 payload's finalizer runs, the payload has already been
7814 overwritten, and the finalizer should not clear the payload,
7815 which now points to something new.
7816
7817 But that's not the case here, since we cancel the old payload's
7818 finalizer when we over-write it. I've added ASSERTs to verify this
7819 assumption, in case it ever changes.)
7820
7821 * API/JSClassRef.cpp:
7822 (OpaqueJSClass::prototype): No need to specify null; that's the default.
7823
7824 * API/JSWeakObjectMapRefPrivate.cpp: Use remove, since take() is gone.
7825
7826 * heap/PassWeak.h:
7827 (WeakImplAccessor::was): This is no longer a debug-only function, since
7828 it's required to reason about lazily finalized pointers.
7829
7830 * heap/Weak.h:
7831 (JSC::weakAdd):
7832 (JSC::weakRemove):
7833 (JSC::weakClear): Added these helper functions for the common idioms of
7834 what clients want to do in their weak pointer finalizers.
7835
7836 * jit/JITStubs.cpp:
7837 (JSC::JITThunks::hostFunctionStub): Use the new idioms. Otherwise, we
7838 would return NULL for a "zombie" executable weak pointer that was waiting
7839 for finalization (item (2)), and finalizing a dead executable weak pointer
7840 would potentially destroy a new, live one (item (1)).
7841
7842 * runtime/RegExpCache.cpp:
7843 (JSC::RegExpCache::lookupOrCreate):
7844 (JSC::RegExpCache::finalize): Ditto.
7845
7846 (JSC::RegExpCache::invalidateCode): Check for null while iterating. (See
7847 item (2).)
7848
7849 * runtime/Structure.cpp:
7850 (JSC::StructureTransitionTable::contains):
7851 (JSC::StructureTransitionTable::add): Use get and set instead of add and
7852 contains, since add and contains are not compatible with lazy finalization.
7853
7854 * runtime/WeakGCMap.h:
7855 (WeakGCMap):
7856 (JSC::WeakGCMap::clear):
7857 (JSC::WeakGCMap::remove): Removed a bunch of code that was incompatible with
7858 lazy finalization because I didn't feel like making it compatible, and I had
7859 no way to test it.
7860
fpizlo@apple.com0b9b37a2012-05-25 03:29:18 +000078612012-05-24 Filip Pizlo <fpizlo@apple.com>
7862
fpizlo@apple.com9d899a42012-05-25 05:41:03 +00007863 REGRESSION (r118013-r118031): Loops/Reloads under www.yahoo.com, quits after three tries with error
7864 https://bugs.webkit.org/show_bug.cgi?id=87327
7865
7866 Reviewed by Geoffrey Garen.
7867
7868 If you use AbstractValue::filter(StructureSet) to test subset relationships between TOP and a
7869 set containing >=2 elements, you're going to have a bad time.
7870
7871 That's because AbstractValue considers a set with >=2 elements to be equivalent to TOP, in order
7872 to save space and speed up convergence. So filtering has no effect in this case, which made
7873 the code think that the abstract value was proving that the structure check was unnecessary.
7874 The correct thing to do is to use isSubsetOf() on the StructureAbstractValue, which does the
7875 right thingies for TOP and >=2 elements.
7876
7877 * dfg/DFGAbstractState.cpp:
7878 (JSC::DFG::AbstractState::execute):
7879 * dfg/DFGSpeculativeJIT32_64.cpp:
7880 (JSC::DFG::SpeculativeJIT::compile):
7881 * dfg/DFGSpeculativeJIT64.cpp:
7882 (JSC::DFG::SpeculativeJIT::compile):
7883
78842012-05-24 Filip Pizlo <fpizlo@apple.com>
7885
fpizlo@apple.com0b9b37a2012-05-25 03:29:18 +00007886 new test fast/js/dfg-arguments-mixed-alias.html fails on JSVALUE32_64
7887 https://bugs.webkit.org/show_bug.cgi?id=87378
7888
7889 Reviewed by Gavin Barraclough.
7890
7891 - Captured variable tracking forgot did not consistently handle arguments, leading to OSR
7892 badness.
7893
7894 - Nodes capable of exiting were tracked in a non-monotonic way, leading to compiler errors.
7895
7896 * dfg/DFGByteCodeParser.cpp:
7897 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
7898 * dfg/DFGCSEPhase.cpp:
7899 (JSC::DFG::CSEPhase::CSEPhase):
7900 (CSEPhase):
7901 (JSC::DFG::performCSE):
7902 * dfg/DFGCSEPhase.h:
7903 (DFG):
7904 * dfg/DFGCommon.h:
7905 * dfg/DFGDriver.cpp:
7906 (JSC::DFG::compile):
7907 * dfg/DFGGraph.cpp:
7908 (JSC::DFG::Graph::resetExitStates):
7909 (DFG):
7910 * dfg/DFGGraph.h:
7911 (Graph):
7912 * dfg/DFGPhase.h:
7913 (DFG):
7914 (JSC::DFG::runPhase):
7915
ggaren@apple.com39281e22012-05-24 21:18:10 +000079162012-05-24 Geoffrey Garen <ggaren@apple.com>
7917
7918 Made WeakSet per-block instead of per-heap
7919 https://bugs.webkit.org/show_bug.cgi?id=87401
7920
7921 Reviewed by Oliver Hunt.
7922
7923 This allows us fast access to the set of all weak pointers for a block,
7924 which is a step toward lazy finalization.
7925
7926 No performance change.
7927
7928 * heap/Heap.cpp:
7929 (JSC::Heap::Heap):
7930 (JSC::Heap::lastChanceToFinalize): Removed the per-heap weak set, since
7931 it's per-block now.
7932
7933 (JSC::Heap::markRoots): Delegate weak set visiting to the marked space,
7934 since it knows how to iterate all blocks.
7935
7936 (JSC::Heap::collect): Moved the reaping outside of markRoots, since it
7937 doesn't mark anything.
7938
7939 Make sure to reset allocators after shrinking, since shrinking may
7940 deallocate the current allocator.
7941
7942 * heap/Heap.h:
7943 (Heap): No more per-heap weak set, since it's per-block now.
7944
7945 * heap/MarkedBlock.cpp:
7946 (JSC::MarkedBlock::MarkedBlock):
7947 * heap/MarkedBlock.h:
7948 (MarkedBlock):
7949 (JSC::MarkedBlock::lastChanceToFinalize): Migrated finalization logic
7950 here from the heap, so the heap doesn't need to know about our internal
7951 data structures like our weak set.
7952
7953 (JSC::MarkedBlock::heap):
7954 (JSC::MarkedBlock::weakSet):
7955 (JSC::MarkedBlock::shrink):
7956 (JSC::MarkedBlock::resetAllocator):
7957 (JSC::MarkedBlock::visitWeakSet):
7958 (JSC::MarkedBlock::reapWeakSet):
7959 (JSC::MarkedBlock::sweepWeakSet):
7960 * heap/MarkedSpace.cpp:
7961 (JSC::VisitWeakSet::VisitWeakSet):
7962 (JSC::VisitWeakSet::operator()):
7963 (VisitWeakSet):
7964 (JSC):
7965 (JSC::ReapWeakSet::operator()):
7966 (JSC::SweepWeakSet::operator()):
7967 (JSC::LastChanceToFinalize::operator()):
7968 (JSC::MarkedSpace::lastChanceToFinalize):
7969 (JSC::ResetAllocator::operator()):
7970 (JSC::MarkedSpace::resetAllocators):
7971 (JSC::MarkedSpace::visitWeakSets):
7972 (JSC::MarkedSpace::reapWeakSets):
7973 (JSC::MarkedSpace::sweepWeakSets):
7974 (JSC::Shrink::operator()):
7975 (JSC::MarkedSpace::shrink):
7976 * heap/MarkedSpace.h:
7977 (MarkedSpace): Make sure to account for our weak sets when sweeping,
7978 shrinking, etc.
7979
7980 * heap/WeakSet.cpp:
7981 (JSC):
7982 * heap/WeakSet.h:
7983 (WeakSet):
7984 (JSC::WeakSet::heap):
7985 (JSC):
7986 (JSC::WeakSet::lastChanceToFinalize):
7987 (JSC::WeakSet::visit):
7988 (JSC::WeakSet::reap):
7989 (JSC::WeakSet::shrink):
7990 (JSC::WeakSet::resetAllocator): Inlined some things since they're called
7991 once per block now instead of once per heap.
7992
7993 * heap/WeakSetInlines.h:
7994 (JSC::WeakSet::allocate): Use the per-block weak set since there is no
7995 per-heap weak set anymore.
7996
barraclough@apple.comefdbf472012-05-24 21:14:07 +000079972012-05-24 Gavin Barraclough <barraclough@apple.com>
7998
barraclough@apple.com8ca6a7a2012-05-24 21:17:38 +00007999 Fix arm build
8000
8001 Rubber stamped by Geoff Garen
8002
8003 * dfg/DFGGPRInfo.h:
8004 (GPRInfo):
8005
80062012-05-24 Gavin Barraclough <barraclough@apple.com>
8007
barraclough@apple.comefdbf472012-05-24 21:14:07 +00008008 Move cacheFlush from ExecutableAllocator to Assembler classes
8009 https://bugs.webkit.org/show_bug.cgi?id=87420
8010
8011 Reviewed by Oliver Hunt.
8012
8013 Makes more sense there, & remove a pile of #ifdefs.
8014
8015 * assembler/ARMAssembler.cpp:
8016 (JSC):
8017 (JSC::ARMAssembler::cacheFlush):
8018 * assembler/ARMAssembler.h:
8019 (ARMAssembler):
8020 (JSC::ARMAssembler::cacheFlush):
8021 * assembler/ARMv7Assembler.h:
8022 (JSC::ARMv7Assembler::relinkJump):
8023 (JSC::ARMv7Assembler::cacheFlush):
8024 (ARMv7Assembler):
8025 (JSC::ARMv7Assembler::setInt32):
8026 (JSC::ARMv7Assembler::setUInt7ForLoad):
8027 * assembler/AbstractMacroAssembler.h:
8028 (JSC::AbstractMacroAssembler::cacheFlush):
8029 * assembler/LinkBuffer.h:
8030 (JSC::LinkBuffer::performFinalization):
8031 * assembler/MIPSAssembler.h:
8032 (JSC::MIPSAssembler::relinkJump):
8033 (JSC::MIPSAssembler::relinkCall):
8034 (JSC::MIPSAssembler::repatchInt32):
8035 (JSC::MIPSAssembler::cacheFlush):
8036 (MIPSAssembler):
8037 * assembler/SH4Assembler.h:
8038 (JSC::SH4Assembler::repatchCompact):
8039 (JSC::SH4Assembler::cacheFlush):
8040 (SH4Assembler):
8041 * assembler/X86Assembler.h:
8042 (X86Assembler):
8043 (JSC::X86Assembler::cacheFlush):
8044 * jit/ExecutableAllocator.cpp:
8045 (JSC):
8046 * jit/ExecutableAllocator.h:
8047 (ExecutableAllocator):
8048
commit-queue@webkit.org2c8bcde2012-05-24 20:01:53 +000080492012-05-24 John Mellor <johnme@chromium.org>
8050
8051 Font Boosting: Add compile flag and runtime setting
8052 https://bugs.webkit.org/show_bug.cgi?id=87394
8053
8054 Reviewed by Adam Barth.
8055
8056 Add ENABLE_FONT_BOOSTING.
8057
8058 * Configurations/FeatureDefines.xcconfig:
8059
commit-queue@webkit.orgd553c622012-05-24 10:50:40 +000080602012-05-24 Allan Sandfeld Jensen <allan.jensen@nokia.com>
8061
8062 cti_vm_throw gets kicked out by gcc 4.6 -flto
8063 https://bugs.webkit.org/show_bug.cgi?id=56088
8064
8065 Reviewed by Darin Adler.
8066
8067 Add REFERENCED_FROM_ASM to functions only referenced from assembler.
8068
8069 * dfg/DFGOperations.cpp:
8070 * jit/HostCallReturnValue.h:
8071 * jit/JITStubs.h:
8072 * jit/ThunkGenerators.cpp:
8073
fpizlo@apple.com36f14462012-05-24 07:35:05 +000080742012-05-24 Filip Pizlo <fpizlo@apple.com>
8075
8076 Incorrect merge of r117542 from dfg opt branch in r118323 is leading to fast/js/dfg-arguments-osr-exit.html failing
8077 https://bugs.webkit.org/show_bug.cgi?id=87350
8078
8079 Reviewed by Maciej Stachowiak.
8080
8081 The dfgopt branch introduced the notion of a local variable being killed because it was aliased
8082 to the Arguments object as in cases like:
8083
8084 var a = arguments;
8085 return a.length;
8086
8087 This required changes to OSR exit handling - if the variable is dead but aliased to arguments, then
8088 OSR exit should reify the arguments. But meanwhile, in tip of tree we introduced special handling for
8089 dead variables on OSR exit. When the two were merged in r118323, the structure of the if/else branches
8090 ended up being such that we would treat dead arguments variables as totally dead as opposed to treating
8091 them as variables that need arguments reification.
8092
8093 This fixes the structure of the relevant if/else block so that variables that are dead-but-arguments
8094 end up being treated as reified arguments objects, while variables that are dead but not aliased to
8095 arguments are treated as tip of tree would have treated them (initialize to Undefined).
8096
8097 * dfg/DFGSpeculativeJIT.cpp:
8098 (JSC::DFG::SpeculativeJIT::compile):
8099
ossy@webkit.orgbc0d6372012-05-24 07:05:31 +000081002012-05-24 Csaba Osztrogonác <ossy@webkit.org>
8101
8102 Unreviewed 32 bit buildfix after r118325.
8103
8104 * dfg/DFGSpeculativeJIT32_64.cpp:
8105 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): Use ASSERT_UNUSED instead ASSERT.
8106
fpizlo@apple.comd96eb4e2012-05-24 06:58:52 +000081072012-05-23 Filip Pizlo <fpizlo@apple.com>
8108
fpizlo@apple.comb3ac2422012-05-24 07:00:24 +00008109 DFG operationTearOffActivation should return after handling the null activation case
8110 https://bugs.webkit.org/show_bug.cgi?id=87348
8111 <rdar://problem/11522295>
8112
8113 Reviewed by Oliver Hunt.
8114
8115 * dfg/DFGOperations.cpp:
8116
81172012-05-23 Filip Pizlo <fpizlo@apple.com>
8118
fpizlo@apple.comd96eb4e2012-05-24 06:58:52 +00008119 Unreviewed, merge the arguments fix in r118138 to get bots green.
8120
8121 * dfg/DFGArgumentsSimplificationPhase.cpp:
8122 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
8123
fpizlo@apple.comb9c94622012-05-24 05:51:05 +000081242012-05-20 Filip Pizlo <fpizlo@apple.com>
8125
fpizlo@apple.com91b2c682012-05-24 06:24:36 +00008126 DFG CFA should record if a node can OSR exit
8127 https://bugs.webkit.org/show_bug.cgi?id=86905
8128
8129 Reviewed by Oliver Hunt.
8130
8131 Merged r117931 from dfgopt.
8132
8133 Adds a NodeFlag that denotes nodes that are known to not have OSR exits.
8134 This ought to aid any backwards analyses that need to know when a
8135 backward flow merge might happen due to a side exit.
8136
8137 Also added assertions into speculationCheck() that ensure that we did not
8138 mark a node as non-exiting and then promptly compile in an exit. This
8139 helped catch some minor bugs where we were doing unnecessary speculation
8140 checks.
8141
8142 This is a perf-neutral change. The speculation checks that this removes
8143 were not on hot paths of major benchmarks.
8144
8145 * bytecode/PredictedType.h:
8146 (JSC):
8147 (JSC::isAnyPrediction):
8148 * dfg/DFGAbstractState.cpp:
8149 (JSC::DFG::AbstractState::execute):
8150 * dfg/DFGAbstractState.h:
8151 (JSC::DFG::AbstractState::speculateInt32Unary):
8152 (AbstractState):
8153 (JSC::DFG::AbstractState::speculateNumberUnary):
8154 (JSC::DFG::AbstractState::speculateBooleanUnary):
8155 (JSC::DFG::AbstractState::speculateInt32Binary):
8156 (JSC::DFG::AbstractState::speculateNumberBinary):
8157 * dfg/DFGNode.h:
8158 (JSC::DFG::Node::mergeFlags):
8159 (JSC::DFG::Node::filterFlags):
8160 (Node):
8161 (JSC::DFG::Node::setCanExit):
8162 (JSC::DFG::Node::canExit):
8163 * dfg/DFGNodeFlags.cpp:
8164 (JSC::DFG::nodeFlagsAsString):
8165 * dfg/DFGNodeFlags.h:
8166 (DFG):
8167 * dfg/DFGSpeculativeJIT.cpp:
8168 (JSC::DFG::SpeculativeJIT::SpeculativeJIT):
8169 (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
8170 (JSC::DFG::SpeculativeJIT::compileValueToInt32):
8171 * dfg/DFGSpeculativeJIT.h:
8172 (JSC::DFG::SpeculativeJIT::speculationCheck):
8173 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
8174 (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution):
8175 (SpeculativeJIT):
8176 * dfg/DFGSpeculativeJIT32_64.cpp:
8177 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
8178 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
8179 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
8180 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
8181 (JSC::DFG::SpeculativeJIT::compile):
8182 * dfg/DFGSpeculativeJIT64.cpp:
8183 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
8184 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
8185 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
8186 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
8187 (JSC::DFG::SpeculativeJIT::compile):
8188
81892012-05-20 Filip Pizlo <fpizlo@apple.com>
8190
fpizlo@apple.comb9c94622012-05-24 05:51:05 +00008191 DFG should not do unnecessary indirections when storing to objects
8192 https://bugs.webkit.org/show_bug.cgi?id=86959
8193
8194 Reviewed by Oliver Hunt.
8195
8196 Merged r117819 from dfgopt.
8197
8198 * dfg/DFGByteCodeParser.cpp:
8199 (JSC::DFG::ByteCodeParser::parseBlock):
8200 * dfg/DFGCSEPhase.cpp:
8201 (JSC::DFG::CSEPhase::getByOffsetLoadElimination):
8202 * dfg/DFGSpeculativeJIT32_64.cpp:
8203 (JSC::DFG::SpeculativeJIT::compile):
8204 * dfg/DFGSpeculativeJIT64.cpp:
8205 (JSC::DFG::SpeculativeJIT::compile):
8206
fpizlo@apple.com9a548f12012-05-24 05:33:09 +000082072012-05-17 Filip Pizlo <fpizlo@apple.com>
8208
8209 DFG should optimize aliased uses of the Arguments object of the current call frame
8210 https://bugs.webkit.org/show_bug.cgi?id=86552
8211
8212 Reviewed by Geoff Garen.
8213
8214 Merged r117542 and r117543 from dfgopt.
8215
8216 Performs must-alias and escape analysis on uses of CreateArguments, and if
8217 a variable is must-aliased to CreateArguments and does not escape, then we
8218 turn all uses of that variable into direct arguments accesses.
8219
8220 36% speed-up on V8/earley leading to a 2.3% speed-up overall in V8.
8221
8222 * bytecode/CodeBlock.h:
8223 (JSC::CodeBlock::uncheckedArgumentsRegister):
8224 * bytecode/ValueRecovery.h:
8225 (JSC::ValueRecovery::argumentsThatWereNotCreated):
8226 (ValueRecovery):
8227 (JSC::ValueRecovery::dump):
8228 * dfg/DFGAbstractState.cpp:
8229 (JSC::DFG::AbstractState::execute):
8230 * dfg/DFGAdjacencyList.h:
8231 (AdjacencyList):
8232 (JSC::DFG::AdjacencyList::removeEdgeFromBag):
8233 * dfg/DFGArgumentsSimplificationPhase.cpp:
8234 (JSC::DFG::ArgumentsSimplificationPhase::run):
8235 (ArgumentsSimplificationPhase):
8236 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
8237 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUses):
8238 (JSC::DFG::ArgumentsSimplificationPhase::observeProperArgumentsUse):
8239 (JSC::DFG::ArgumentsSimplificationPhase::isOKToOptimize):
8240 (JSC::DFG::ArgumentsSimplificationPhase::removeArgumentsReferencingPhantomChild):
8241 * dfg/DFGAssemblyHelpers.h:
8242 (JSC::DFG::AssemblyHelpers::argumentsRegisterFor):
8243 (AssemblyHelpers):
8244 * dfg/DFGByteCodeParser.cpp:
8245 (JSC::DFG::ByteCodeParser::parseBlock):
8246 * dfg/DFGCFGSimplificationPhase.cpp:
8247 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
8248 * dfg/DFGGPRInfo.h:
8249 (GPRInfo):
8250 * dfg/DFGGraph.cpp:
8251 (JSC::DFG::Graph::collectGarbage):
8252 (DFG):
8253 * dfg/DFGGraph.h:
8254 (Graph):
8255 (JSC::DFG::Graph::executableFor):
8256 (JSC::DFG::Graph::argumentsRegisterFor):
8257 (JSC::DFG::Graph::uncheckedArgumentsRegisterFor):
8258 (JSC::DFG::Graph::clobbersWorld):
8259 * dfg/DFGNode.h:
8260 (JSC::DFG::Node::hasHeapPrediction):
8261 * dfg/DFGNodeType.h:
8262 (DFG):
8263 * dfg/DFGOSRExitCompiler.cpp:
8264 * dfg/DFGOSRExitCompiler.h:
8265 (JSC::DFG::OSRExitCompiler::OSRExitCompiler):
8266 (OSRExitCompiler):
8267 * dfg/DFGOSRExitCompiler32_64.cpp:
8268 (JSC::DFG::OSRExitCompiler::compileExit):
8269 * dfg/DFGOSRExitCompiler64.cpp:
8270 (JSC::DFG::OSRExitCompiler::compileExit):
8271 * dfg/DFGOperations.cpp:
8272 * dfg/DFGPredictionPropagationPhase.cpp:
8273 (JSC::DFG::PredictionPropagationPhase::propagate):
8274 * dfg/DFGSpeculativeJIT.cpp:
8275 (JSC::DFG::ValueSource::dump):
8276 (JSC::DFG::SpeculativeJIT::compile):
8277 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
8278 * dfg/DFGSpeculativeJIT.h:
8279 * dfg/DFGSpeculativeJIT32_64.cpp:
8280 (JSC::DFG::SpeculativeJIT::compile):
8281 * dfg/DFGSpeculativeJIT64.cpp:
8282 (JSC::DFG::SpeculativeJIT::compile):
8283 * dfg/DFGVariableAccessData.h:
8284 (JSC::DFG::VariableAccessData::VariableAccessData):
8285 (JSC::DFG::VariableAccessData::mergeIsArgumentsAlias):
8286 (VariableAccessData):
8287 (JSC::DFG::VariableAccessData::isArgumentsAlias):
8288 * jit/JITOpcodes.cpp:
8289 (JSC::JIT::emitSlow_op_get_argument_by_val):
8290
fpizlo@apple.comdb7ba192012-05-24 02:28:52 +000082912012-05-23 Filip Pizlo <fpizlo@apple.com>
8292
fpizlo@apple.comae3413b2012-05-24 02:34:09 +00008293 DFGCapabilities should not try to get an arguments register from code blocks that don't have one
8294 https://bugs.webkit.org/show_bug.cgi?id=87332
8295
8296 Reviewed by Andy Estes.
8297
8298 * dfg/DFGCapabilities.h:
8299 (JSC::DFG::canInlineOpcode):
8300
83012012-05-23 Filip Pizlo <fpizlo@apple.com>
8302
fpizlo@apple.comdb7ba192012-05-24 02:28:52 +00008303 DFG should have sparse conditional constant propagation
8304 https://bugs.webkit.org/show_bug.cgi?id=86580
8305
8306 Reviewed by Oliver Hunt.
8307
8308 Merged r117370 from dfgopt.
8309
8310 This enhances CFA so that if it suspects at any point during the fixpoint that a
8311 branch will only go one way, then it only propagates in that one way.
8312
8313 This vastly increases the opportunities for CFG simplification. For example, it
8314 enables us to evaporate this loop:
8315
8316 for (var i = 0; i < 1; ++i) doThings(i);
8317
8318 As a result, it uncovered loads of bugs in the CFG simplifier. In particular:
8319
8320 - Phi fixup was assuming that all Phis worth fixing up are shouldGenerate().
8321 That's not true; we also fixup Phis that are dead.
8322
8323 - GetLocal fixup was assuming that it's only necessary to rewire links to a
8324 GetLocal, and that the GetLocal's own links don't need to be rewired. Untrue,
8325 because the GetLocal may not be rewirable (first block has no GetLocal for r42
8326 but second block does have a GetLocal), in which case it will refer to a Phi
8327 in the second block. We need it to refer to a Phi from the first block to
8328 ensure that subsequent transformations work.
8329
8330 - Tail operand fixup was ignoring the fact that Phis in successors may contain
8331 references to the children of our tail variables. Hence, successor Phi child
8332 substitution needs to use the original second block variable table as its
8333 prior, rather than trying to reconstruct the prior later (since by that point
8334 the children of the second block's tail variables will have been fixed up, so
8335 we will not know what the prior would have been).
8336
8337 * dfg/DFGAbstractState.cpp:
8338 (JSC::DFG::AbstractState::beginBasicBlock):
8339 (JSC::DFG::AbstractState::endBasicBlock):
8340 (JSC::DFG::AbstractState::reset):
8341 (JSC::DFG::AbstractState::execute):
8342 (JSC::DFG::AbstractState::mergeToSuccessors):
8343 * dfg/DFGAbstractState.h:
8344 (JSC::DFG::AbstractState::branchDirectionToString):
8345 (AbstractState):
8346 * dfg/DFGCFGSimplificationPhase.cpp:
8347 (JSC::DFG::CFGSimplificationPhase::run):
8348 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
8349 (JSC::DFG::CFGSimplificationPhase::OperandSubstitution::OperandSubstitution):
8350 (OperandSubstitution):
8351 (JSC::DFG::CFGSimplificationPhase::skipGetLocal):
8352 (JSC::DFG::CFGSimplificationPhase::recordPossibleIncomingReference):
8353 (CFGSimplificationPhase):
8354 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
8355 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
8356 * dfg/DFGGraph.h:
8357 (JSC::DFG::Graph::changeEdge):
8358
ojan@chromium.org959e4a22012-05-24 02:03:04 +000083592012-05-23 Ojan Vafai <ojan@chromium.org>
8360
8361 add back the ability to disable flexbox
8362 https://bugs.webkit.org/show_bug.cgi?id=87147
8363
8364 Reviewed by Tony Chang.
8365
8366 * Configurations/FeatureDefines.xcconfig:
8367
fpizlo@apple.com9b928722012-05-24 00:18:55 +000083682012-05-23 Filip Pizlo <fpizlo@apple.com>
8369
fpizlo@apple.com16faaea2012-05-24 01:04:55 +00008370 Unreviewed, fix Windows build.
8371
8372 * bytecode/CodeBlock.h:
8373 * dfg/DFGCapabilities.h:
8374 (JSC::DFG::canCompileOpcode):
8375 (JSC::DFG::canCompileOpcodes):
8376 * dfg/DFGCommon.h:
8377 (DFG):
8378
83792012-05-23 Filip Pizlo <fpizlo@apple.com>
8380
fpizlo@apple.com9b928722012-05-24 00:18:55 +00008381 DFG should optimize inlined uses of arguments.length and arguments[i]
8382 https://bugs.webkit.org/show_bug.cgi?id=86327
8383
8384 Reviewed by Gavin Barraclough.
8385
8386 Merged r117017 from dfgopt.
8387
8388 Turns inlined uses of arguments.length into a constant.
8389
8390 Turns inlined uses of arguments[constant] into a direct reference to the
8391 argument.
8392
8393 Big win on micro-benchmarks. Not yet a win on V8 because the hot uses of
8394 arguments.length and arguments[i] are aliased. I'll leave the aliasing
8395 optimizations to a later patch.
8396
8397 * CMakeLists.txt:
8398 * GNUmakefile.list.am:
8399 * JavaScriptCore.xcodeproj/project.pbxproj:
8400 * Target.pri:
8401 * bytecode/DFGExitProfile.h:
8402 (FrequentExitSite):
8403 (JSC::DFG::FrequentExitSite::FrequentExitSite):
8404 (JSC::DFG::QueryableExitProfile::hasExitSite):
8405 (QueryableExitProfile):
8406 * dfg/DFGAbstractState.cpp:
8407 (JSC::DFG::AbstractState::execute):
8408 * dfg/DFGArgumentsSimplificationPhase.cpp: Added.
8409 (DFG):
8410 (ArgumentsSimplificationPhase):
8411 (JSC::DFG::ArgumentsSimplificationPhase::ArgumentsSimplificationPhase):
8412 (JSC::DFG::ArgumentsSimplificationPhase::run):
8413 (JSC::DFG::performArgumentsSimplification):
8414 * dfg/DFGArgumentsSimplificationPhase.h: Added.
8415 (DFG):
8416 * dfg/DFGAssemblyHelpers.cpp:
8417 (JSC::DFG::AssemblyHelpers::executableFor):
8418 (DFG):
8419 * dfg/DFGAssemblyHelpers.h:
8420 (AssemblyHelpers):
8421 * dfg/DFGByteCodeParser.cpp:
8422 (JSC::DFG::ByteCodeParser::parseBlock):
8423 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
8424 * dfg/DFGCSEPhase.cpp:
8425 (JSC::DFG::CSEPhase::getLocalLoadElimination):
8426 (JSC::DFG::CSEPhase::performNodeCSE):
8427 * dfg/DFGDriver.cpp:
8428 (JSC::DFG::compile):
8429 * dfg/DFGGraph.h:
8430 (JSC::DFG::Graph::Graph):
8431 (JSC::DFG::Graph::executableFor):
8432 (Graph):
8433 (JSC::DFG::Graph::clobbersWorld):
8434 * dfg/DFGNode.h:
8435 (JSC::DFG::Node::convertToConstant):
8436 (JSC::DFG::Node::convertToGetLocalUnlinked):
8437 (Node):
8438 (JSC::DFG::Node::unlinkedLocal):
8439 * dfg/DFGNodeType.h:
8440 (DFG):
8441 * dfg/DFGOSRExit.cpp:
8442 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
8443 * dfg/DFGPredictionPropagationPhase.cpp:
8444 (JSC::DFG::PredictionPropagationPhase::propagate):
8445 * dfg/DFGSpeculativeJIT32_64.cpp:
8446 (JSC::DFG::SpeculativeJIT::compile):
8447 * dfg/DFGSpeculativeJIT64.cpp:
8448 (JSC::DFG::SpeculativeJIT::compile):
8449
fpizlo@apple.com5e3852d2012-05-24 00:05:21 +000084502012-05-13 Filip Pizlo <fpizlo@apple.com>
8451
8452 DFG should be able to optimize foo.apply(bar, arguments)
8453 https://bugs.webkit.org/show_bug.cgi?id=86306
8454
8455 Reviewed by Gavin Barraclough.
8456
8457 Merge r116912 from dfgopt.
8458
8459 Enables compilation of op_jneq_ptr and some forms of op_call_varargs.
8460
8461 Also includes a bunch of bug fixes that were made necessary by the increased
8462 pressure on the CFG simplifier.
8463
8464 This is a 1-2% win on V8.
8465
8466 * bytecode/CodeBlock.cpp:
8467 (JSC::CodeBlock::printCallOp):
8468 (JSC::CodeBlock::CodeBlock):
8469 (JSC::ProgramCodeBlock::canCompileWithDFGInternal):
8470 (JSC::EvalCodeBlock::canCompileWithDFGInternal):
8471 (JSC::FunctionCodeBlock::canCompileWithDFGInternal):
8472 * bytecode/CodeBlock.h:
8473 (CodeBlock):
8474 (JSC::CodeBlock::canCompileWithDFG):
8475 (JSC::CodeBlock::canCompileWithDFGState):
8476 (ProgramCodeBlock):
8477 (EvalCodeBlock):
8478 (FunctionCodeBlock):
8479 * dfg/DFGAbstractState.cpp:
8480 (JSC::DFG::AbstractState::execute):
8481 * dfg/DFGByteCodeParser.cpp:
8482 (JSC::DFG::ByteCodeParser::parseBlock):
8483 (JSC::DFG::ByteCodeParser::processPhiStack):
8484 (JSC::DFG::ByteCodeParser::parse):
8485 * dfg/DFGCFGSimplificationPhase.cpp:
8486 (JSC::DFG::CFGSimplificationPhase::run):
8487 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
8488 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
8489 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
8490 * dfg/DFGCSEPhase.cpp:
8491 (JSC::DFG::CSEPhase::getLocalLoadElimination):
8492 (CSEPhase):
8493 (JSC::DFG::CSEPhase::setReplacement):
8494 (JSC::DFG::CSEPhase::performNodeCSE):
8495 * dfg/DFGCapabilities.cpp:
8496 (JSC::DFG::debugFail):
8497 (DFG):
8498 (JSC::DFG::canHandleOpcodes):
8499 (JSC::DFG::canCompileOpcodes):
8500 (JSC::DFG::canInlineOpcodes):
8501 * dfg/DFGCapabilities.h:
8502 (JSC::DFG::canCompileOpcode):
8503 (JSC::DFG::canInlineOpcode):
8504 (DFG):
8505 (JSC::DFG::canCompileOpcodes):
8506 (JSC::DFG::canCompileEval):
8507 (JSC::DFG::canCompileProgram):
8508 (JSC::DFG::canCompileFunctionForCall):
8509 (JSC::DFG::canCompileFunctionForConstruct):
8510 * dfg/DFGCommon.h:
8511 * dfg/DFGGraph.cpp:
8512 (JSC::DFG::Graph::dump):
8513 * dfg/DFGNodeType.h:
8514 (DFG):
8515 * dfg/DFGPredictionPropagationPhase.cpp:
8516 (JSC::DFG::PredictionPropagationPhase::propagate):
8517 * dfg/DFGSpeculativeJIT32_64.cpp:
8518 (JSC::DFG::SpeculativeJIT::compile):
8519 * dfg/DFGSpeculativeJIT64.cpp:
8520 (JSC::DFG::SpeculativeJIT::emitCall):
8521 (JSC::DFG::SpeculativeJIT::compile):
8522 * dfg/DFGValidate.cpp:
8523 (Validate):
8524 (JSC::DFG::Validate::validate):
8525 (JSC::DFG::Validate::checkOperand):
8526 (JSC::DFG::Validate::reportValidationContext):
8527 * jit/JIT.cpp:
8528 (JSC::JIT::emitOptimizationCheck):
8529 (JSC::JIT::privateCompileSlowCases):
8530 (JSC::JIT::privateCompile):
8531 * jit/JIT.h:
8532 * jit/JITArithmetic.cpp:
8533 (JSC::JIT::compileBinaryArithOp):
8534 * jit/JITPropertyAccess.cpp:
8535 (JSC::JIT::privateCompilePutByIdTransition):
8536 * jit/JITPropertyAccess32_64.cpp:
8537 (JSC::JIT::privateCompilePutByIdTransition):
8538 * tools/CodeProfile.cpp:
8539 (JSC::CodeProfile::sample):
8540
ggaren@apple.com7070d422012-05-23 23:55:27 +000085412012-05-23 Geoffrey Garen <ggaren@apple.com>
8542
8543 Refactored WeakBlock to use malloc, clarify behavior
8544 https://bugs.webkit.org/show_bug.cgi?id=87318
8545
8546 Reviewed by Filip Pizlo.
8547
8548 We want to use malloc so we can make these smaller than 4KB,
8549 since an individual MarkedBlock will usually have fewer than
8550 4KB worth of weak pointers.
8551
8552 * heap/Heap.cpp:
8553 (JSC::Heap::markRoots): Renamed visitLiveWeakImpls to visit, since
8554 we no longer need to distinguish from "visitDeadWeakImpls".
8555
8556 Renamed "visitDeadWeakImpls" to "reap" because we're not actually
8557 doing any visiting -- we're just tagging things as dead.
8558
8559 * heap/WeakBlock.cpp:
8560 (JSC::WeakBlock::create):
8561 (JSC::WeakBlock::destroy):
8562 (JSC::WeakBlock::WeakBlock): Malloc!
8563
8564 (JSC::WeakBlock::visit):
8565 (JSC::WeakBlock::reap): Renamed as above.
8566
8567 * heap/WeakBlock.h:
8568 (WeakBlock): Reduced to 3KB, as explained above.
8569
8570 * heap/WeakSet.cpp:
8571 (JSC::WeakSet::visit):
8572 (JSC::WeakSet::reap):
8573 * heap/WeakSet.h:
8574 (WeakSet): Updated for renames, and to match WebKit style.
8575
fpizlo@apple.com11e2f372012-05-23 22:25:21 +000085762012-05-23 Filip Pizlo <fpizlo@apple.com>
8577
fpizlo@apple.combc96e8f2012-05-23 23:12:59 +00008578 Use after free in JSC::DFG::ByteCodeParser::processPhiStack
8579 https://bugs.webkit.org/show_bug.cgi?id=87312
8580 <rdar://problem/11518848>
8581
8582 Reviewed by Oliver Hunt.
8583
8584 * dfg/DFGByteCodeParser.cpp:
8585 (JSC::DFG::ByteCodeParser::processPhiStack):
8586 (JSC::DFG::ByteCodeParser::parse):
8587
85882012-05-23 Filip Pizlo <fpizlo@apple.com>
8589
fpizlo@apple.com11e2f372012-05-23 22:25:21 +00008590 It should be possible to make C function calls from DFG code on ARM in debug mode
8591 https://bugs.webkit.org/show_bug.cgi?id=87313
8592
8593 Reviewed by Gavin Barraclough.
8594
8595 * dfg/DFGSpeculativeJIT.h:
8596 (SpeculativeJIT):
8597
fpizlo@apple.comc6446112012-05-23 20:52:42 +000085982012-05-11 Filip Pizlo <fpizlo@apple.com>
8599
8600 DFG should be able to inline functions that use arguments reflectively
8601 https://bugs.webkit.org/show_bug.cgi?id=86132
8602
8603 Reviewed by Oliver Hunt.
8604
8605 Merged r116838 from dfgopt.
8606
8607 This turns on inlining of functions that use arguments reflectively, but it
8608 does not do any of the obvious optimizations that this exposes. I'll save that
8609 for another patch - the important thing for now is that this contains all of
8610 the plumbing necessary to make this kind of inlining sound even in bizarro
8611 cases like an inline callee escaping the arguments object to parts of the
8612 inline caller where the arguments are otherwise dead. Or even more fun cases
8613 like where you've inlined to an inline stack that is three-deep, and the
8614 function on top of the inline stack reflectively accesses the arguments of a
8615 function that is in the middle of the inline stack. Any subsequent
8616 optimizations that we do for the obvious cases of arguments usage in inline
8617 functions will have to take care not to break the baseline functionality that
8618 this patch plumbs together.
8619
8620 * bytecode/CodeBlock.cpp:
8621 (JSC::CodeBlock::printCallOp):
8622 (JSC::CodeBlock::dump):
8623 * bytecode/CodeBlock.h:
8624 * dfg/DFGAssemblyHelpers.h:
8625 (JSC::DFG::AssemblyHelpers::argumentsRegisterFor):
8626 (AssemblyHelpers):
8627 * dfg/DFGByteCodeParser.cpp:
8628 (InlineStackEntry):
8629 (JSC::DFG::ByteCodeParser::handleCall):
8630 (JSC::DFG::ByteCodeParser::handleInlining):
8631 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
8632 (JSC::DFG::ByteCodeParser::parse):
8633 * dfg/DFGCCallHelpers.h:
8634 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
8635 (CCallHelpers):
8636 * dfg/DFGCapabilities.h:
8637 (JSC::DFG::canInlineOpcode):
8638 * dfg/DFGDriver.cpp:
8639 (JSC::DFG::compile):
8640 * dfg/DFGFixupPhase.cpp:
8641 (JSC::DFG::FixupPhase::fixupNode):
8642 * dfg/DFGOperations.cpp:
8643 * dfg/DFGOperations.h:
8644 * dfg/DFGSpeculativeJIT.h:
8645 (JSC::DFG::SpeculativeJIT::callOperation):
8646 * dfg/DFGSpeculativeJIT32_64.cpp:
8647 (JSC::DFG::SpeculativeJIT::compile):
8648 * dfg/DFGSpeculativeJIT64.cpp:
8649 (JSC::DFG::SpeculativeJIT::compile):
8650 * interpreter/CallFrame.cpp:
8651 (JSC):
8652 (JSC::CallFrame::someCodeBlockForPossiblyInlinedCode):
8653 * interpreter/CallFrame.h:
8654 (ExecState):
8655 (JSC::ExecState::someCodeBlockForPossiblyInlinedCode):
8656 * interpreter/Interpreter.cpp:
8657 (JSC::Interpreter::retrieveArgumentsFromVMCode):
8658 * runtime/Arguments.cpp:
8659 (JSC::Arguments::tearOff):
8660 (JSC):
8661 (JSC::Arguments::tearOffForInlineCallFrame):
8662 * runtime/Arguments.h:
8663 (Arguments):
8664 (JSC::Arguments::create):
8665 (JSC::Arguments::finishCreation):
8666 (JSC):
8667
fpizlo@apple.comfe244b02012-05-23 20:51:21 +000086682012-05-23 Filip Pizlo <fpizlo@apple.com>
8669
8670 Every OSR exit on ARM results in a crash
8671 https://bugs.webkit.org/show_bug.cgi?id=87307
8672
8673 Reviewed by Geoffrey Garen.
8674
8675 * dfg/DFGThunks.cpp:
8676 (JSC::DFG::osrExitGenerationThunkGenerator):
8677
ggaren@apple.com96fa0e72012-05-23 20:47:46 +000086782012-05-23 Geoffrey Garen <ggaren@apple.com>
8679
8680 Refactored heap tear-down to use normal value semantics (i.e., destructors)
8681 https://bugs.webkit.org/show_bug.cgi?id=87302
8682
8683 Reviewed by Oliver Hunt.
8684
8685 This is a step toward incremental DOM finalization.
8686
8687 * heap/CopiedSpace.cpp:
8688 (JSC::CopiedSpace::~CopiedSpace):
8689 * heap/CopiedSpace.h:
8690 (CopiedSpace): Just use our destructor, instead of relying on the heap
8691 to send us a special message at a special time.
8692
8693 * heap/Heap.cpp:
8694 (JSC::Heap::Heap): Use OwnPtr for m_markListSet because this is not Sparta.
8695
8696 (JSC::Heap::~Heap): No need for delete or freeAllBlocks because normal
8697 destructors do this work automatically now.
8698
8699 (JSC::Heap::lastChanceToFinalize): Just call lastChanceToFinalize on our
8700 sub-objects, and assume it does the right thing. This improves encapsulation,
8701 so we can add items requiring finalization to our sub-objects.
8702
8703 * heap/Heap.h: Moved m_blockAllocator to get the right destruction order.
8704
8705 * heap/MarkedSpace.cpp:
8706 (Take):
8707 (JSC):
8708 (JSC::Take::Take):
8709 (JSC::Take::operator()):
8710 (JSC::Take::returnValue): Moved to the top of the file so it can be used
8711 in another function.
8712
8713 (JSC::MarkedSpace::~MarkedSpace): Delete all outstanding memory, like a good
8714 destructor should.
8715
8716 (JSC::MarkedSpace::lastChanceToFinalize): Moved some code here from the heap,
8717 since it pertains to our internal implementation details.
8718
8719 * heap/MarkedSpace.h:
8720 (MarkedSpace):
8721 * heap/WeakBlock.cpp:
8722 (JSC::WeakBlock::lastChanceToFinalize):
8723 * heap/WeakBlock.h:
8724 (WeakBlock):
8725 * heap/WeakSet.cpp:
8726 (JSC::WeakSet::lastChanceToFinalize):
8727 * heap/WeakSet.h:
8728 (WeakSet): Stop using a special freeAllBlocks() callback and just implement
8729 lastChanceToFinalize.
8730
ggaren@apple.comd6376d22012-05-23 18:29:55 +000087312011-05-22 Geoffrey Garen <ggaren@apple.com>
8732
8733 Encapsulated some calculations for whether portions of the heap are empty
8734 https://bugs.webkit.org/show_bug.cgi?id=87210
8735
8736 Reviewed by Gavin Barraclough.
8737
8738 This is a step toward incremental DOM finalization.
8739
8740 * heap/Heap.cpp:
8741 (JSC::Heap::~Heap): Explicitly call freeAllBlocks() instead of relying
8742 implicitly on all blocks thinking they're empty. In future, we may
8743 choose to tear down the heap without first setting all data structures
8744 to "empty".
8745
8746 * heap/MarkedBlock.h:
8747 (JSC::MarkedBlock::isEmpty):
8748 (JSC::MarkedBlock::gatherDirtyCells): Renamed markCountIsZero to isEmpty,
8749 in preparation for making it check for outstanding finalizers in addition
8750 to marked cells.
8751
8752 * heap/MarkedSpace.cpp:
8753 (Take):
8754 (JSC::Take::Take):
8755 (JSC::Take::operator()):
8756 (JSC::Take::returnValue):
8757 (JSC::MarkedSpace::shrink):
8758 (JSC::MarkedSpace::freeAllBlocks): Refactored the "Take" functor to support
8759 a conditional isEmpty check, so it dould be shared by shrink() and freeAllBlocks().
8760
8761 * heap/WeakBlock.cpp:
8762 (JSC::WeakBlock::WeakBlock):
8763 (JSC::WeakBlock::visitLiveWeakImpls):
8764 (JSC::WeakBlock::visitDeadWeakImpls):
8765 * heap/WeakBlock.h:
8766 (WeakBlock):
8767 (JSC::WeakBlock::isEmpty):
8768 * heap/WeakSet.cpp:
8769 (JSC::WeakSet::sweep):
8770 (JSC::WeakSet::shrink): Use isEmpty(), in preparation for changes in
8771 its implementation.
8772
vestbo@webkit.orgb1f6e922012-05-23 10:50:53 +000087732012-05-23 Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
8774
8775 [Qt] Remove references to $$QT_SOURCE_TREE
8776
8777 With a modularized Qt, it's ambigious. What we really want is qtbase,
8778 which qtcore is a proxy for (we assume it will always live in qtbase).
8779
8780 Reviewed by Tor Arne Vestbø.
8781
8782 * JavaScriptCore.pri:
8783 * Target.pri:
8784
fpizlo@apple.comb6b454cd2012-05-23 07:53:44 +000087852012-05-09 Filip Pizlo <fpizlo@apple.com>
8786
8787 DFG should allow inlining in case of certain arity mismatches
8788 https://bugs.webkit.org/show_bug.cgi?id=86059
8789
8790 Reviewed by Geoff Garen.
fpizlo@apple.comb92907c2012-05-23 07:55:12 +00008791
8792 Merge r116620 from dfgopt.
fpizlo@apple.comb6b454cd2012-05-23 07:53:44 +00008793
8794 * dfg/DFGByteCodeParser.cpp:
8795 (JSC::DFG::ByteCodeParser::handleInlining):
8796
fpizlo@apple.com6d4456e2012-05-23 03:48:52 +000087972012-05-08 Filip Pizlo <fpizlo@apple.com>
8798
fpizlo@apple.com1688cc12012-05-23 07:29:02 +00008799 DFG variable capture analysis should work even if the variables arose through inlining
8800 https://bugs.webkit.org/show_bug.cgi?id=85945
8801
8802 Reviewed by Oliver Hunt.
8803
8804 Merged r116555 from dfgopt.
8805
8806 This just changes how the DFG queries whether a variable is captured. It does not
8807 change any user-visible behavior.
8808
8809 As part of this change, I further solidified the policy that the CFA behaves in an
8810 undefined way for captured locals and queries about their values will not yield
8811 reliable results. This will likely be changed in the future, but for now it makes
8812 sense.
8813
8814 One fun part about this change is that it recognizes that the same variable may
8815 be both captured and not, at the same time, because their live interval spans
8816 inlining boundaries. This only happens in the case of arguments to functions that
8817 capture their arguments, and this change treats them with just the right touch of
8818 conservatism: they will be treated as if captured by the caller as well as the
8819 callee.
8820
8821 Finally, this also adds captured variable reasoning to the InlineCallFrame, which
8822 I thought might be useful for later tooling.
8823
8824 This is perf-neutral, since it does it does not make the DFG take advantage of this
8825 new functionality in any way. In particular, it is still the case that the DFG will
8826 not inline functions that use arguments reflectively or that create activations.
8827
8828 * bytecode/CodeBlock.h:
8829 (CodeBlock):
8830 (JSC::CodeBlock::needsActivation):
8831 (JSC::CodeBlock::argumentIsCaptured):
8832 (JSC::CodeBlock::localIsCaptured):
8833 (JSC::CodeBlock::isCaptured):
8834 * bytecode/CodeOrigin.h:
8835 (InlineCallFrame):
8836 * dfg/DFGAbstractState.cpp:
8837 (JSC::DFG::AbstractState::initialize):
8838 (JSC::DFG::AbstractState::endBasicBlock):
8839 (JSC::DFG::AbstractState::execute):
8840 (JSC::DFG::AbstractState::merge):
8841 * dfg/DFGByteCodeParser.cpp:
8842 (JSC::DFG::ByteCodeParser::newVariableAccessData):
8843 (JSC::DFG::ByteCodeParser::getLocal):
8844 (JSC::DFG::ByteCodeParser::setLocal):
8845 (JSC::DFG::ByteCodeParser::getArgument):
8846 (JSC::DFG::ByteCodeParser::setArgument):
8847 (JSC::DFG::ByteCodeParser::flushArgument):
8848 (JSC::DFG::ByteCodeParser::parseBlock):
8849 (JSC::DFG::ByteCodeParser::processPhiStack):
8850 (JSC::DFG::ByteCodeParser::fixVariableAccessPredictions):
8851 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
8852 * dfg/DFGCFGSimplificationPhase.cpp:
8853 (CFGSimplificationPhase):
8854 (JSC::DFG::CFGSimplificationPhase::keepOperandAlive):
8855 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
8856 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
8857 * dfg/DFGCommon.h:
8858 * dfg/DFGFixupPhase.cpp:
8859 (JSC::DFG::FixupPhase::fixupNode):
8860 * dfg/DFGGraph.cpp:
8861 (JSC::DFG::Graph::nameOfVariableAccessData):
8862 * dfg/DFGGraph.h:
8863 (JSC::DFG::Graph::needsActivation):
8864 (JSC::DFG::Graph::usesArguments):
8865 * dfg/DFGPredictionPropagationPhase.cpp:
8866 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):
8867 * dfg/DFGSpeculativeJIT.cpp:
8868 (JSC::DFG::SpeculativeJIT::compile):
8869 * dfg/DFGSpeculativeJIT32_64.cpp:
8870 (JSC::DFG::SpeculativeJIT::compile):
8871 * dfg/DFGSpeculativeJIT64.cpp:
8872 (JSC::DFG::SpeculativeJIT::compile):
8873 * dfg/DFGVariableAccessData.h:
8874 (JSC::DFG::VariableAccessData::VariableAccessData):
8875 (JSC::DFG::VariableAccessData::mergeIsCaptured):
8876 (VariableAccessData):
8877 (JSC::DFG::VariableAccessData::isCaptured):
8878
88792012-05-08 Filip Pizlo <fpizlo@apple.com>
8880
fpizlo@apple.com6d4456e2012-05-23 03:48:52 +00008881 DFG should support op_get_argument_by_val and op_get_arguments_length
8882 https://bugs.webkit.org/show_bug.cgi?id=85911
8883
8884 Reviewed by Oliver Hunt.
8885
8886 Merged r116467 from dfgopt.
8887
8888 This adds a simple and relatively conservative implementation of op_get_argument_by_val
8889 and op_get_arguments_length. We can optimize these later. For now it's great to have
8890 the additional coverage.
8891
8892 This patch appears to be perf-neutral.
8893
8894 * dfg/DFGAbstractState.cpp:
8895 (JSC::DFG::AbstractState::execute):
8896 * dfg/DFGAssemblyHelpers.h:
8897 (JSC::DFG::AssemblyHelpers::addressFor):
8898 (JSC::DFG::AssemblyHelpers::tagFor):
8899 (JSC::DFG::AssemblyHelpers::payloadFor):
8900 * dfg/DFGByteCodeParser.cpp:
8901 (JSC::DFG::ByteCodeParser::parseBlock):
8902 * dfg/DFGCapabilities.h:
8903 (JSC::DFG::canCompileOpcode):
8904 (JSC::DFG::canInlineOpcode):
8905 * dfg/DFGNode.h:
8906 (JSC::DFG::Node::hasHeapPrediction):
8907 * dfg/DFGNodeType.h:
8908 (DFG):
8909 * dfg/DFGOperations.cpp:
8910 * dfg/DFGOperations.h:
8911 * dfg/DFGPredictionPropagationPhase.cpp:
8912 (JSC::DFG::PredictionPropagationPhase::propagate):
8913 * dfg/DFGSpeculativeJIT.h:
8914 (JSC::DFG::SpeculativeJIT::callOperation):
8915 (SpeculativeJIT):
8916 * dfg/DFGSpeculativeJIT32_64.cpp:
8917 (JSC::DFG::SpeculativeJIT::compile):
8918 * dfg/DFGSpeculativeJIT64.cpp:
8919 (JSC::DFG::SpeculativeJIT::compile):
8920 * jit/JITOpcodes.cpp:
8921 (JSC::JIT::emit_op_get_argument_by_val):
8922 * jit/JITOpcodes32_64.cpp:
8923 (JSC::JIT::emit_op_get_argument_by_val):
8924 * llint/LowLevelInterpreter32_64.asm:
8925 * llint/LowLevelInterpreter64.asm:
8926
fpizlo@apple.com15c03c72012-05-23 02:34:13 +000089272012-05-07 Filip Pizlo <fpizlo@apple.com>
8928
8929 DFG should support op_tear_off_arguments
8930 https://bugs.webkit.org/show_bug.cgi?id=85847
8931
8932 Reviewed by Michael Saboff.
8933
8934 Merged r116378 from dfgopt.
8935
8936 * dfg/DFGAbstractState.cpp:
8937 (JSC::DFG::AbstractState::execute):
8938 * dfg/DFGByteCodeParser.cpp:
8939 (JSC::DFG::ByteCodeParser::parseBlock):
8940 * dfg/DFGCapabilities.h:
8941 (JSC::DFG::canCompileOpcode):
8942 (JSC::DFG::canInlineOpcode):
8943 * dfg/DFGNodeType.h:
8944 (DFG):
8945 * dfg/DFGOperations.cpp:
8946 * dfg/DFGOperations.h:
8947 * dfg/DFGPredictionPropagationPhase.cpp:
8948 (JSC::DFG::PredictionPropagationPhase::propagate):
8949 * dfg/DFGSpeculativeJIT.h:
8950 (SpeculativeJIT):
8951 (JSC::DFG::SpeculativeJIT::callOperation):
8952 * dfg/DFGSpeculativeJIT32_64.cpp:
8953 (JSC::DFG::SpeculativeJIT::compile):
8954 * dfg/DFGSpeculativeJIT64.cpp:
8955 (JSC::DFG::SpeculativeJIT::compile):
8956
mhahnenberg@apple.com3041bc12012-05-23 01:28:03 +000089572012-05-22 Mark Hahnenberg <mhahnenberg@apple.com>
8958
8959 CopiedSpace::contains doesn't check for oversize blocks
8960 https://bugs.webkit.org/show_bug.cgi?id=87180
8961
8962 Reviewed by Geoffrey Garen.
8963
8964 When doing a conservative scan we use CopiedSpace::contains to determine if a particular
8965 address points into the CopiedSpace. Currently contains() only checks if the address
8966 points to a block in to-space, which means that pointers to oversize blocks may not get scanned.
8967
8968 * heap/CopiedSpace.cpp:
8969 (JSC::CopiedSpace::tryAllocateOversize):
8970 (JSC::CopiedSpace::tryReallocateOversize):
8971 (JSC::CopiedSpace::doneFillingBlock):
8972 (JSC::CopiedSpace::doneCopying):
8973 * heap/CopiedSpace.h: Refactored CopiedSpace so that all blocks (oversize and to-space) are
8974 in a single hash set and bloom filter for membership testing.
8975 (CopiedSpace):
8976 * heap/CopiedSpaceInlineMethods.h:
8977 (JSC::CopiedSpace::contains): We check for the normal block first. Since the oversize blocks are
8978 only page aligned, rather than block aligned, we have to re-mask the ptr to check if it's in
8979 CopiedSpace. Also added a helper function of the same name that takes a CopiedBlock* and checks
8980 if it's in CopiedSpace so that check isn't typed out twice.
8981 (JSC):
8982 (JSC::CopiedSpace::startedCopying):
8983 (JSC::CopiedSpace::addNewBlock):
8984
ggaren@apple.coma68a6502012-05-22 23:59:51 +000089852012-05-22 Geoffrey Garen <ggaren@apple.com>
8986
8987 CopiedBlock and MarkedBlock should have proper value semantics (i.e., destructors)
8988 https://bugs.webkit.org/show_bug.cgi?id=87172
8989
8990 Reviewed by Oliver Hunt and Phil Pizlo.
8991
8992 This enables MarkedBlock to own non-trivial sub-objects that require
8993 destruction. It also fixes a FIXME about casting a CopiedBlock to a
8994 MarkedBlock at destroy time.
8995
8996 CopiedBlock and MarkedBlock now accept an allocation chunk at create
8997 time and return it at destroy time. Their client is expected to
8998 allocate, recycle, and destroy these chunks.
8999
9000 * heap/BlockAllocator.cpp:
9001 (JSC::BlockAllocator::releaseFreeBlocks):
9002 (JSC::BlockAllocator::blockFreeingThreadMain): Don't call MarkedBlock::destroy
9003 because we expect that to be called before a block is put on our free
9004 list now. Do manually deallocate our allocation chunk because that's
9005 our job now.
9006
9007 * heap/BlockAllocator.h:
9008 (BlockAllocator):
9009 (JSC::BlockAllocator::allocate): Allocate never fails now. This is a
9010 cleaner abstraction because only one object does all the VM allocation
9011 and deallocation. Caching is an implementation detail.
9012
9013 (JSC::BlockAllocator::deallocate): We take an allocation chunk argument
9014 instead of a block because we now expect the block to have been destroyed
9015 before we recycle its memory. For convenience, we still use the HeapBlock
9016 class as our linked list node. This is OK because HeapBlock is a POD type.
9017
9018 * heap/CopiedBlock.h:
9019 (CopiedBlock):
9020 (JSC::CopiedBlock::create):
9021 (JSC::CopiedBlock::destroy):
9022 (JSC::CopiedBlock::CopiedBlock): Added proper create and destroy functions,
9023 to match MarkedBlock.
9024
9025 * heap/CopiedSpace.cpp:
9026 (JSC::CopiedSpace::tryAllocateOversize):
9027 (JSC::CopiedSpace::tryReallocateOversize):
9028 (JSC::CopiedSpace::doneCopying):
9029 (JSC::CopiedSpace::getFreshBlock):
9030 (JSC::CopiedSpace::freeAllBlocks):
9031 * heap/CopiedSpaceInlineMethods.h:
9032 (JSC::CopiedSpace::recycleBlock): Make sure to call destroy before
9033 returning a block to the BlockAllocator. Otherwise, our destructors
9034 won't run. (If we get this wrong now, we'll get a compile error.)
9035
9036 * heap/HeapBlock.h:
9037 (JSC::HeapBlock::HeapBlock): const!
9038
9039 * heap/MarkedAllocator.cpp:
9040 (JSC::MarkedAllocator::allocateBlock): No need to distinguish between
9041 create and recycle -- MarkedBlock always accepts memory allocated by
9042 its client now.
9043
9044 * heap/MarkedBlock.cpp:
9045 (JSC::MarkedBlock::create): Don't allocate memory -- we assume that we're
9046 passed already-allocated memory, to clarify the responsibility for VM
9047 recycling.
9048
9049 (JSC::MarkedBlock::destroy): Do run our destructor before giving back
9050 our VM -- that is the whole point of this patch.
9051
9052 (JSC::MarkedBlock::MarkedBlock):
9053 * heap/MarkedBlock.h:
9054 (MarkedBlock):
9055 * heap/MarkedSpace.cpp: const!
9056
9057 (JSC::MarkedSpace::freeBlocks): Make sure to call destroy before
9058 returning a block to the BlockAllocator. Otherwise, our destructors
9059 won't run. (If we get this wrong now, we'll get a compile error.)
9060
simon.fraser@apple.com9bd2c702012-05-22 20:37:14 +00009061== Rolled over to ChangeLog-2012-05-22 ==