blob: 44ed7b15ecc8f8852b163268e1a8ff67dc385437 [file] [log] [blame]
barraclough@apple.comc48fc1b2012-06-06 05:08:45 +000012012-06-05 Gavin Barraclough <barraclough@apple.com>
2
3 Remove JSObject::m_inheritorID
4 https://bugs.webkit.org/show_bug.cgi?id=88378
5
6 Reviewed by Geoff Garen.
7
8 This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
9 and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
10 Instead use a private named value in the object's property storage.
11
12 * dfg/DFGSpeculativeJIT.h:
13 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
14 - No need m_inheritorID to initialize!
15 * jit/JITInlineMethods.h:
16 (JSC::JIT::emitAllocateBasicJSObject):
17 - No need m_inheritorID to initialize!
18 * llint/LowLevelInterpreter.asm:
19 - No need m_inheritorID to initialize!
20 * runtime/JSGlobalData.h:
21 (JSGlobalData):
22 - Added private name 'm_inheritorIDKey'.
23 * runtime/JSGlobalThis.cpp:
24 (JSC::JSGlobalThis::setUnwrappedObject):
25 - resetInheritorID is now passed a JSGlobalData&.
26 * runtime/JSObject.cpp:
27 (JSC::JSObject::visitChildren):
28 - No m_inheritorID to be marked.
29 (JSC::JSObject::createInheritorID):
30 - Store the newly created inheritorID in the property map.
31 * runtime/JSObject.h:
32 (JSC::JSObject::resetInheritorID):
33 - Remove the inheritorID from property storage.
34 (JSC::JSObject::inheritorID):
35 - Read the inheritorID from property storage.
36
fpizlo@apple.come7bee132012-06-05 21:32:18 +0000372012-06-05 Filip Pizlo <fpizlo@apple.com>
38
39 DFG CFG simplification should not attempt to deref nodes inside of an unreachable subgraph
40 https://bugs.webkit.org/show_bug.cgi?id=88362
41
42 Reviewed by Gavin Barraclough.
43
44 * dfg/DFGCFGSimplificationPhase.cpp:
45 (JSC::DFG::CFGSimplificationPhase::fixPhis):
46 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
47
mhahnenberg@apple.com47c9c532012-06-05 20:38:21 +0000482012-06-05 Mark Hahnenberg <mhahnenberg@apple.com>
49
50 Entry into JSC should CRASH() if the Heap is busy
51 https://bugs.webkit.org/show_bug.cgi?id=88355
52
53 Reviewed by Geoffrey Garen.
54
55 Interpreter::execute() returns jsNull() right now if we try to enter it while
56 the Heap is busy (e.g. with a collection), which is okay, but some code paths
57 that call Interpreter::execute() allocate objects before checking if the Heap
58 is busy. Attempting to execute JS code while the Heap is busy should not be
59 allowed and should be enforced by a release-mode CRASH() to prevent vague,
60 unhelpful backtraces later on if somebody makes a mistake. Normally, recursively
61 executing JS code is okay, e.g. for evals, but it should not occur during a
62 Heap allocation or collection because the Heap is not guaranteed to be in a
63 consistent state (especially during collections). We are protected from
64 executing JS on the same Heap concurrently on two separate threads because
65 they must each take a JSLock first. However, we are not protected from reentrant
66 execution of JS on the same thread because JSLock allows reentrancy. Therefore,
67 we should fail early if we detect an entrance into JS code while the Heap is busy.
68
69 * heap/Heap.cpp: Changed Heap::collect so that it sets the m_operationInProgress field
70 at the beginning of collection and then unsets it at the end so that it is set at all
71 times throughout the duration of a collection rather than sporadically during various
72 phases. There is no reason to unset during a collection because our collector does
73 not currently support running additional JS between the phases of a collection.
74 (JSC::Heap::getConservativeRegisterRoots):
75 (JSC::Heap::markRoots):
76 (JSC::Heap::collect):
77 * interpreter/Interpreter.cpp:
78 (JSC::Interpreter::execute): Crash if the Heap is busy.
79 * runtime/Completion.cpp: Crash if the Heap is busy. We do it here before we call
80 Interpreter::execute() because we do some allocation prior to calling execute() which
81 could cause Heap corruption if, for example, that allocation caused a collection.
82 (JSC::evaluate):
83
commit-queue@webkit.org3401b2d2012-06-05 11:32:22 +0000842012-06-05 Dongwoo Im <dw.im@samsung.com>
85
86 Add 'isProtocolHandlerRegistered' and 'unregisterProtocolHandler'.
87 https://bugs.webkit.org/show_bug.cgi?id=73176
88
89 Reviewed by Adam Barth.
90
91 Two more APIs are added in Custom Scheme Handler specification.
92 http://dev.w3.org/html5/spec/Overview.html#custom-handlers
93 One is 'isProtocolHandlerRegistered' to query whether the specific URL
94 is registered or not.
95 The other is 'unregisterProtocolHandler' to remove the registered URL.
96
97 * Configurations/FeatureDefines.xcconfig: Add a macro 'ENABLE_CUSTOM_SCHEME_HANDLER'.
98
fpizlo@apple.com9cce18d2012-06-05 06:40:48 +0000992012-06-04 Filip Pizlo <fpizlo@apple.com>
100
101 DFG CFG simplification should correct the variables at the head of the predecessor block
102 https://bugs.webkit.org/show_bug.cgi?id=88284
103
104 Reviewed by Geoffrey Garen.
105
106 * dfg/DFGCFGSimplificationPhase.cpp:
107 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
108
ggaren@apple.com825cc102012-06-05 03:17:15 +00001092012-06-04 Geoffrey Garen <ggaren@apple.com>
110
111 Unreviewed.
112
113 Rolled out r119364 because it's still causing crashes (when running
114 v8-earley in release builds of DRT)
115
116 This time for sure!
117
118 * heap/Heap.cpp:
119 (JSC::Heap::collect):
120 * heap/MarkedBlock.cpp:
121 (JSC::MarkedBlock::sweep):
122 * heap/MarkedBlock.h:
123 (JSC::MarkedBlock::resetAllocator):
124 (JSC):
125 * heap/MarkedSpace.cpp:
126 (JSC::ResetAllocator::operator()):
127 (JSC):
128 (JSC::MarkedSpace::resetAllocators):
129 (JSC::MarkedSpace::sweepWeakSets):
130 * heap/MarkedSpace.h:
131 (MarkedSpace):
132 * heap/WeakBlock.cpp:
133 (JSC::WeakBlock::sweep):
134 * heap/WeakSet.cpp:
135 (JSC::WeakSet::sweep):
136 (JSC::WeakSet::tryFindAllocator):
137 * heap/WeakSet.h:
138 (JSC::WeakSet::shrink):
139
fpizlo@apple.com9cd38a62012-06-05 00:28:49 +00001402012-06-04 Filip Pizlo <fpizlo@apple.com>
141
142 DFG arguments simplification should have rationalized handling of TearOffArguments
143 https://bugs.webkit.org/show_bug.cgi?id=88206
144
145 Reviewed by Geoffrey Garen.
146
147 - Accesses to the unmodified arguments register ought to have the same effect on
148 alias/escape analysis of arguments as accesses to the mutable arguments register.
149
150 - The existence of TearOffArguments should not get in the way of arguments aliasing.
151
152 - TearOffArguments should be eliminated if CreateArguments is eliminated.
153
154 * dfg/DFGArgumentsSimplificationPhase.cpp:
155 (JSC::DFG::ArgumentsSimplificationPhase::run):
156 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
157
barraclough@apple.com282d26a2012-06-05 00:00:17 +00001582012-06-04 Gavin Barraclough <barraclough@apple.com>
159
160 Remove enabledProfilerReference
161 https://bugs.webkit.org/show_bug.cgi?id=88258
162
163 Reviewed by Michael Saboff.
164
165 Make the enabled profiler a member of JSGlobalData, and switch code that accesses it to do so directly
166 via the JSGlobalData, rather than holding a Profiler** reference to it. Do not pass the Profiler**
167 reference to JIT code. This patch does not change the stack layout on entry into JIT code (passing an
168 unused void* instead), since this is an intrusive change better handled in a separate patch.
169
170 * interpreter/Interpreter.cpp:
171 (JSC::Interpreter::throwException):
172 (JSC::Interpreter::execute):
173 (JSC::Interpreter::executeCall):
174 (JSC::Interpreter::executeConstruct):
175 (JSC::Interpreter::privateExecute):
176 * jit/JITCode.h:
177 (JSC::JITCode::execute):
178 - Don't pass Profiler** to JIT code.
179 * jit/JITOpcodes.cpp:
180 (JSC::JIT::emit_op_profile_will_call):
181 (JSC::JIT::emit_op_profile_did_call):
182 * jit/JITOpcodes32_64.cpp:
183 (JSC::JIT::emit_op_profile_will_call):
184 (JSC::JIT::emit_op_profile_did_call):
185 * jit/JITStubs.cpp:
186 (JSC):
187 (JSC::ctiTrampoline):
188 (JSC::ctiVMThrowTrampoline):
189 (JSC::ctiOpThrowNotCaught):
190 (JSC::JITThunks::JITThunks):
191 (JSC::DEFINE_STUB_FUNCTION):
192 - For ARM_THUMB2, rename ENABLE_PROFILER_REFERENCE_OFFSET to FIRST_STACK_ARGUMENT (which is how it is being used).
193 - For MIPS, remove ENABLE_PROFILER_REFERENCE_OFFSET.
194 * jit/JITStubs.h:
195 (JITStackFrame):
196 (JSC):
197 - Renamed enabledProfilerReference to unusedX.
198 * llint/LLIntSlowPaths.cpp:
199 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
200 * llint/LowLevelInterpreter.asm:
201 * profiler/Profiler.cpp:
202 (JSC):
203 (JSC::Profiler::startProfiling):
204 (JSC::Profiler::stopProfiling):
205 * profiler/Profiler.h:
206 (Profiler):
207 - Removed s_sharedEnabledProfilerReference, enabledProfilerReference().
208 * runtime/JSGlobalData.cpp:
209 (JSC::JSGlobalData::JSGlobalData):
210 * runtime/JSGlobalData.h:
211 (JSC):
212 (JSC::JSGlobalData::enabledProfiler):
213 (JSGlobalData):
214 - Added m_enabledProfiler, enabledProfiler().
215 * runtime/JSGlobalObject.cpp:
216 (JSC::JSGlobalObject::~JSGlobalObject):
217
fpizlo@apple.com3d579cc2012-06-04 23:27:34 +00002182012-06-04 Filip Pizlo <fpizlo@apple.com>
219
fpizlo@apple.com477ce382012-06-04 23:32:57 +0000220 get_argument_by_val should be profiled everywhere
221 https://bugs.webkit.org/show_bug.cgi?id=88205
222
223 Reviewed by Geoffrey Garen.
224
225 * jit/JITOpcodes32_64.cpp:
226 (JSC::JIT::emitSlow_op_get_argument_by_val):
227 * llint/LLIntSlowPaths.cpp:
228 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
229
2302012-06-04 Filip Pizlo <fpizlo@apple.com>
231
fpizlo@apple.com3d579cc2012-06-04 23:27:34 +0000232 DFG arguments simplification takes unkindly to direct accesses to the arguments register
233 https://bugs.webkit.org/show_bug.cgi?id=88261
234
235 Reviewed by Geoffrey Garen.
236
237 Fixed arguments simplification for direct accesses to the arguments register, which may
238 arise if CSE had not run. Fixed CSE so that it does run prior to arguments simplification,
239 by making it a full-fledged member of the fixpoint. Fixed other issues in arguments
240 simplification, like realizing that it needs to bail if there is a direct assignment to
241 the arguments register, and failing to turn CreateArguments into PhantomArguments. Also
242 fixed CSE's handling of store elimination of captured locals in the presence of a
243 GetMyArgumentByVal (or one of its friends), and fixed CSE to correctly fixup variables at
244 tail if the Flush it removes is the last operation on a local in a basic block.
245
246 * bytecode/CodeBlock.cpp:
247 (JSC::CodeBlock::dump):
248 * dfg/DFGArgumentsSimplificationPhase.cpp:
249 (JSC::DFG::ArgumentsSimplificationPhase::run):
250 (JSC::DFG::ArgumentsSimplificationPhase::isOKToOptimize):
251 * dfg/DFGCSEPhase.cpp:
252 (JSC::DFG::CSEPhase::run):
253 (JSC::DFG::CSEPhase::setLocalStoreElimination):
254 (JSC::DFG::CSEPhase::performNodeCSE):
255 (CSEPhase):
256 * dfg/DFGDriver.cpp:
257 (JSC::DFG::compile):
258
andersca@apple.comea6c6b22012-06-04 21:56:32 +00002592012-06-04 Anders Carlsson <andersca@apple.com>
260
261 Fix a struct/class mismatch.
262
263 * heap/Handle.h:
264 (Handle):
265
ddkilzer@apple.comba58a612012-06-04 14:55:26 +00002662012-06-04 David Kilzer <ddkilzer@apple.com>
267
268 BUILD FIX: FeatureDefines.xcconfig should match across projects
269
270 * Configurations/FeatureDefines.xcconfig:
271 - Add missing ENABLE_LEGACY_CSS_VENDOR_PREFIXES.
272
ggaren@apple.com02dec622012-06-03 21:16:55 +00002732012-06-02 Geoffrey Garen <ggaren@apple.com>
274
275 Weak pointer finalization should be lazy
276 https://bugs.webkit.org/show_bug.cgi?id=87599
277
278 Reviewed by Sam Weinig.
279
280 This time for sure!
281
282 * heap/Heap.cpp:
283 (JSC::Heap::collect): Don't sweep eagerly -- we'll sweep lazily instead.
284
285 * heap/MarkedBlock.cpp:
286 (JSC::MarkedBlock::sweep): Sweep our weak set before we sweep our other
287 destructors -- this is our last chance to run weak set finalizers before
288 we recycle our memory.
289
290 * heap/MarkedBlock.h:
291 (JSC::MarkedBlock::resetAllocator):
292 * heap/MarkedSpace.cpp:
293 (JSC::MarkedSpace::resetAllocators):
294 * heap/MarkedSpace.h:
295 (JSC::MarkedSpace::resetAllocators): Don't force allocator reset anymore.
296 It will happen automatically when a weak set is swept. It's simpler to
297 have only one canonical way for this to happen, and it wasn't buying
298 us anything to do it eagerly.
299
300 * heap/WeakBlock.cpp:
301 (JSC::WeakBlock::sweep): Don't short-circuit a sweep unless we know
302 the sweep would be a no-op. If even one finalizer is pending, we need to
303 run it, since we won't get another chance.
304
305 * heap/WeakSet.cpp:
306 (JSC::WeakSet::sweep): This loop can be simpler now that
307 WeakBlock::sweep() does what we mean.
308
309 Reset our allocator after a sweep because this is the optimal time to
310 start trying to recycle old weak pointers.
311
312 (JSC::WeakSet::tryFindAllocator): Don't sweep when searching for an
313 allocator because we've swept already, and forcing a new sweep would be
314 wasteful.
315
316 * heap/WeakSet.h:
317 (JSC::WeakSet::shrink): Be sure to reset our allocator after a shrink
318 because the shrink may have removed the block the allocator was going to
319 allocate out of.
320
fpizlo@apple.comb80bc2a32012-06-02 22:58:48 +00003212012-06-02 Filip Pizlo <fpizlo@apple.com>
322
fpizlo@apple.come0c200c2012-06-03 00:41:08 +0000323 If the DFG bytecode parser detects that op_method_check has gone polymorphic, it
324 shouldn't revert all the way to GetById/GetByIdFlush
325 https://bugs.webkit.org/show_bug.cgi?id=88176
326
327 Reviewed by Geoffrey Garen.
328
329 Refactored the code so that the op_method_check case of the parser gracefully falls
330 through to all of the goodness of the normal op_get_by_id case.
331
332 * dfg/DFGByteCodeParser.cpp:
333 (ByteCodeParser):
334 (JSC::DFG::ByteCodeParser::handleGetById):
335 (DFG):
336 (JSC::DFG::ByteCodeParser::parseBlock):
337
3382012-06-02 Filip Pizlo <fpizlo@apple.com>
339
fpizlo@apple.comb80bc2a32012-06-02 22:58:48 +0000340 DFG CSE should be able to eliminate unnecessary flushes of arguments and captured variables
341 https://bugs.webkit.org/show_bug.cgi?id=87929
342
343 Reviewed by Geoffrey Garen.
344
345 Slight speed-up on V8. Big win (up to 50%) on programs that inline very small functions.
346
347 This required a bunch of changes:
348
349 - The obvious change is making CSE essentially ignore whether or not the set of
350 operations between the Flush and the SetLocal can exit, and instead focus on whether or
351 not that set of operations can clobber the world or access local variables. This code
352 is now refactored to return a set of flags indicating any of these events, and the CSE
353 decides what to do based on those flags. If the set of operations is non-clobbering
354 and non-accessing, then the Flush is turned into a Phantom on the child of the
355 SetLocal. This expands the liveness of the relevant variable but virtually guarantees
356 that it will be register allocated and not flushed to the stack. So, yeah, this patch
357 is a lot of work to save a few stores to the stack.
358
359 - Previously, CheckArgumentsNotCreated was optimized "lazily" in that you only knew if
360 it was a no-op if you were holding onto a CFA abstract state. But this would make the
361 CSE act pessimistically, since it doesn't use the CFA. Hence, this patch changes the
362 constant folding phase into something more broad; it now fixes up
363 CheckArgumentsNotCreated nodes by turning them into phantoms if it knows that they are
364 no-ops.
365
366 - Arguments simplification was previously relying on this very strange PhantomArguments
367 node, which had two different meanings: for normal execution it meant the empty value
368 but for OSR exit it meant that the arguments should be reified. This produces problems
369 when set SetLocals to the captured arguments registers are CSE'd away, since we'd be
370 triggering reification of arguments without having initialized the arguments registers
371 to empty. The cleanest solution was to fix PhantomArguments to have one meaning:
372 namely, arguments reification on OSR exit. Hence, this patch changes arguments
373 simplification to change SetLocal of CreateArguments on the arguments registers to be
374 a SetLocal of Empty.
375
376 - Argument value recoveries were previously derived from the value source of the
377 arguments at the InlineStart. But that relies on all SetLocals to arguments having
378 been flushed. It's possible that we could have elided the SetLocal to the arguments
379 at the callsite because there were subsequent SetLocals to the arguments inside of the
380 callee, in which case the InlineStart would get the wrong information. Hence, this
381 patch changes argument value recovery computation to operate over the ArgumentPositions
382 directly.
383
384 - But that doesn't actually work, because previously, there was no way to link an
385 InlineStart back to the corresponding ArgumentPositions, at least not without some
386 ugliness. So this patch instates the rule that the m_argumentPositions vector consists
387 of disjoint subsequences such that each subsequence corresponds to an inline callsite
388 and can be identified by its first index, and within each subsequence are the
389 ArgumentPositions of all of the arguments ordered by argument index. This required
390 flipping the order in which ArgumentPositions are added to the vector, and giving
391 InlineStart an operand that indicates the start of that inline callsite's
392 ArgumentPosition subsequence.
393
394 - This patch also revealed a nasty bug in the reification of arguments in inline call
395 frames on OSR exit. Since the reification was happening after the values of virtual
396 registers were recovered, the value recoveries of the inline arguments were wrong.
397 Hence using operationCreateInlinedArguments is wrong. For example a value recovery
398 might say that you have to box a double, but if we had already boxed it then boxing
399 it a second time will result in garbage. The specific case of this bug was this patch
400 uncovered was that now it is possible for an inline call frame to not have any valid
401 value recoveries for any inline arguments, if the optimization elides all argument
402 flushes, while at the same time optimizing away arguments creation. Then OSR exit
403 would try to recover the arguments using the inline call frame, which had bogus
404 information, and humorous crashes would ensue. This patch fixes this issue by moving
405 arguments reification to after call frame reification, so that arguments reification
406 can always use operationCreateArguments instead of operationCreateInlinedArguments.
407
408 - This patch may turn a Flush into a Phantom. That's kind of the whole point. But that
409 broke forward speculation checks, which knew to look for a Flush prior to a SetLocal
410 but didn't know that there could alternatively be a Phantom in place of the Flush.
411 This patch fixes that by augmenting the forward speculation check logic.
412
413 - Finally, in the process of having fun with all of the above, I realized that my DFG
414 validation was not actually running on every phase like I had originally designed it
415 to. In fact it was only running just after bytecode parsing. I initially tried to
416 make it run in every phase but found that this causes some tests to timeout
417 (specifically the evil fuzzing ones), so I decided on a compromise where: (i) in
418 release mode validation never runs, (ii) in debug mode validation will run just
419 after parsing and just before the backend, and (iii) it's possible with a simple
420 switch to enable validation to run on every phase.
421
422 Luckily all of the above issues were already covered by the 77 or so DFG-specific
423 layout tests. Hence, this patch does not introduce any new tests despite being so
424 meaty.
425
426 * dfg/DFGAbstractState.cpp:
427 (JSC::DFG::AbstractState::execute):
428 * dfg/DFGArgumentPosition.h:
429 (JSC::DFG::ArgumentPosition::prediction):
430 (JSC::DFG::ArgumentPosition::doubleFormatState):
431 (JSC::DFG::ArgumentPosition::shouldUseDoubleFormat):
432 (ArgumentPosition):
433 * dfg/DFGArgumentsSimplificationPhase.cpp:
434 (JSC::DFG::ArgumentsSimplificationPhase::run):
435 * dfg/DFGByteCodeParser.cpp:
436 (JSC::DFG::ByteCodeParser::handleInlining):
437 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
438 * dfg/DFGCSEPhase.cpp:
439 (JSC::DFG::CSEPhase::SetLocalStoreEliminationResult::SetLocalStoreEliminationResult):
440 (SetLocalStoreEliminationResult):
441 (JSC::DFG::CSEPhase::setLocalStoreElimination):
442 (JSC::DFG::CSEPhase::performNodeCSE):
443 * dfg/DFGCommon.h:
444 * dfg/DFGConstantFoldingPhase.cpp:
445 (JSC::DFG::ConstantFoldingPhase::run):
446 * dfg/DFGDriver.cpp:
447 (JSC::DFG::compile):
448 * dfg/DFGNode.h:
449 (Node):
450 (JSC::DFG::Node::hasArgumentPositionStart):
451 (JSC::DFG::Node::argumentPositionStart):
452 * dfg/DFGOSRExitCompiler32_64.cpp:
453 (JSC::DFG::OSRExitCompiler::compileExit):
454 * dfg/DFGOSRExitCompiler64.cpp:
455 (JSC::DFG::OSRExitCompiler::compileExit):
456 * dfg/DFGPhase.cpp:
457 (DFG):
458 * dfg/DFGPhase.h:
459 (Phase):
460 * dfg/DFGSpeculativeJIT.cpp:
461 (JSC::DFG::SpeculativeJIT::compile):
462 * dfg/DFGSpeculativeJIT.h:
463 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
464 * dfg/DFGSpeculativeJIT32_64.cpp:
465 (JSC::DFG::SpeculativeJIT::compile):
466 * dfg/DFGSpeculativeJIT64.cpp:
467 (JSC::DFG::SpeculativeJIT::compile):
468
ggaren@apple.com32eb24b2012-06-02 22:49:05 +00004692012-06-02 Geoffrey Garen <ggaren@apple.com>
470
471 DOM string cache should hash pointers, not characters
472 https://bugs.webkit.org/show_bug.cgi?id=88175
473
474 Reviewed by Phil Pizlo and Sam Weinig.
475
476 * heap/Weak.h:
477 (JSC::weakAdd):
478 (JSC::weakRemove): Made these function templates slightly more generic
479 to accommodate new client types.
480
fpizlo@apple.comcc5b61b2012-06-01 21:32:45 +00004812012-06-01 Filip Pizlo <fpizlo@apple.com>
482
fpizlo@apple.coma4754892012-06-02 00:22:31 +0000483 DFG CFA should know that PutByVal can clobber the world
484 https://bugs.webkit.org/show_bug.cgi?id=88155
485
486 Reviewed by Gavin Barraclough.
487
488 * dfg/DFGAbstractState.cpp:
489 (JSC::DFG::AbstractState::execute):
490
4912012-06-01 Filip Pizlo <fpizlo@apple.com>
492
fpizlo@apple.com8e537cd2012-06-01 23:54:36 +0000493 DFG CFA should mark basic blocks as having constants if local accesses yield constants
494 https://bugs.webkit.org/show_bug.cgi?id=88153
495
496 Reviewed by Gavin Barraclough.
497
498 * dfg/DFGAbstractState.cpp:
499 (JSC::DFG::AbstractState::execute):
500
5012012-06-01 Filip Pizlo <fpizlo@apple.com>
502
fpizlo@apple.comacc9dd22012-06-01 23:47:28 +0000503 DFG arguments simplification phase uses a node.codeOrigin after appending a node
504 https://bugs.webkit.org/show_bug.cgi?id=88151
505
506 Reviewed by Geoffrey Garen.
507
508 The right thing to do is to save the CodeOrigin before appending to the graph.
509
510 * dfg/DFGArgumentsSimplificationPhase.cpp:
511 (JSC::DFG::ArgumentsSimplificationPhase::run):
512
5132012-06-01 Filip Pizlo <fpizlo@apple.com>
514
fpizlo@apple.com4f337c22012-06-01 23:18:59 +0000515 DFG should not emit unnecessary speculation checks when performing an int32 to double conversion on
516 a value that is proved to be a number, predicted to be an int32, but not proved to be an int32
517 https://bugs.webkit.org/show_bug.cgi?id=88146
518
519 Reviewed by Gavin Barraclough.
520
521 * dfg/DFGSpeculativeJIT.cpp:
522 (JSC::DFG::SpeculativeJIT::compileInt32ToDouble):
523
5242012-06-01 Filip Pizlo <fpizlo@apple.com>
525
fpizlo@apple.comafc07412012-06-01 22:44:43 +0000526 DFG constant folding search for the last local access skips the immediately previous local access
527 https://bugs.webkit.org/show_bug.cgi?id=88141
528
529 Reviewed by Michael Saboff.
530
531 If you use a loop in the style of:
532
533 for (i = start; i--;)
534
535 then you need to remember that the first value of 'i' that the loop body will see is 'start - 1'.
536 Hence the following is probably wrong:
537
538 for (i = start - 1; i--;)
539
540 * dfg/DFGConstantFoldingPhase.cpp:
541 (JSC::DFG::ConstantFoldingPhase::run):
542
5432012-06-01 Filip Pizlo <fpizlo@apple.com>
544
fpizlo@apple.comcc5b61b2012-06-01 21:32:45 +0000545 DFG constant folding should be OK with GetLocal of captured variables having a constant
546 https://bugs.webkit.org/show_bug.cgi?id=88137
547
548 Reviewed by Gavin Barraclough.
549
550 * dfg/DFGConstantFoldingPhase.cpp:
551 (JSC::DFG::ConstantFoldingPhase::run):
552
mhahnenberg@apple.com016c5782012-06-01 00:02:09 +00005532012-05-31 Mark Hahnenberg <mhahnenberg@apple.com>
554
555 JSGlobalObject does not mark m_privateNameStructure
556 https://bugs.webkit.org/show_bug.cgi?id=88023
557
558 Rubber stamped by Gavin Barraclough.
559
560 * runtime/JSGlobalObject.cpp:
561 (JSC::JSGlobalObject::visitChildren): We need to mark this so it doesn't get
562 inadvertently garbage collected.
563
arv@chromium.org31fddbc2012-05-31 18:00:03 +00005642012-05-31 Erik Arvidsson <arv@chromium.org>
565
566 Make DOM Exceptions Errors
567 https://bugs.webkit.org/show_bug.cgi?id=85078
568
569 Reviewed by Oliver Hunt.
570
571 WebIDL mandates that exceptions should have Error.prototype on its prototype chain.
572
573 For JSC we have access to the Error.prototype from the binding code.
574
575 For V8 we set a field in the WrapperTypeInfo and when the constructor function is created we
576 set the prototype as needed.
577
578 Updated test: fast/dom/DOMException/prototype-object.html
579
580 * JavaScriptCore.xcodeproj/project.pbxproj:
581 * runtime/JSGlobalObject.cpp:
582 (JSC::JSGlobalObject::reset):
583 * runtime/JSGlobalObject.h:
584 (JSC):
585 (JSGlobalObject):
586 (JSC::JSGlobalObject::errorPrototype):
587
wingo@igalia.com8de6a8a2012-05-31 17:28:21 +00005882012-05-31 Andy Wingo <wingo@igalia.com>
589
590 Fix reference to unset variable in debug mode
591 https://bugs.webkit.org/show_bug.cgi?id=87981
592
593 Reviewed by Geoffrey Garen.
594
595 * runtime/JSONObject.cpp (Stringifier::Holder::Holder):
596 Initialize m_size in debug mode, as we check it later in an assert.
597
mhahnenberg@apple.comeb39abc2012-05-31 03:04:00 +00005982012-05-30 Mark Hahnenberg <mhahnenberg@apple.com>
599
600 Heap should sweep incrementally
601 https://bugs.webkit.org/show_bug.cgi?id=85429
602
603 We shouldn't have to wait for the opportunistic GC timer to fire in order
604 to call object destructors. Instead, we should incrementally sweep some
605 subset of the blocks requiring sweeping periodically. We tie this sweeping
606 to a timer rather than to collections because we want to reclaim this memory
607 even if we stop allocating. This way, our memory usage scales smoothly with
608 actual use, regardless of whether we've recently done an opportunistic GC or not.
609
610 Reviewed by Geoffrey Garen.
611
612 * CMakeLists.txt:
613 * GNUmakefile.list.am:
614 * JavaScriptCore.gypi:
615 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
616 * JavaScriptCore.xcodeproj/project.pbxproj:
617 * Target.pri:
618 * heap/Heap.cpp:
619 (JSC::Heap::Heap):
620 (JSC::Heap::collect): We no longer sweep during a full sweep. We only shrink now,
621 which we will switch over to being done during incremental sweeping too as soon as
622 all finalizers can be run lazily (and, by extension, incrementally).
623 (JSC::Heap::sweeper):
624 (JSC):
625 * heap/Heap.h:
626 (JSC):
627 (Heap):
628 * heap/IncrementalSweeper.cpp: Added.
629 (JSC):
630 (JSC::IncrementalSweeper::timerDidFire): The IncrementalSweeper works very similarly to
631 GCActivityCallback. It is tied to a run-loop based timer that fires periodically based
632 on how long the previous sweep increment took to run. The IncrementalSweeper doesn't do
633 anything if the platform doesn't support CoreFoundation.
634 (JSC::IncrementalSweeper::IncrementalSweeper):
635 (JSC::IncrementalSweeper::~IncrementalSweeper):
636 (JSC::IncrementalSweeper::create):
637 (JSC::IncrementalSweeper::scheduleTimer):
638 (JSC::IncrementalSweeper::cancelTimer):
639 (JSC::IncrementalSweeper::doSweep): Iterates over the snapshot of the MarkedSpace taken
640 during the last collection, checking to see which blocks need sweeping. If it successfully
641 gets to the end of the blocks that need sweeping then it cancels the timer.
642 (JSC::IncrementalSweeper::startSweeping): We take a snapshot of the Heap and store it in
643 a Vector that the incremental sweep will iterate over. We also reset our index into this Vector.
644 * heap/IncrementalSweeper.h: Added.
645 (JSC):
646 (IncrementalSweeper):
647 * heap/MarkedBlock.h:
648 (JSC::MarkedBlock::needsSweeping): If a block is in the Marked state it needs sweeping
649 to be usable and to run any destructors that need to be run.
650
paroga@webkit.orgecd0fb62012-05-31 01:38:17 +00006512012-05-30 Patrick Gansterer <paroga@webkit.org>
652
653 [WINCE] Fix JSString after r115516.
654 https://bugs.webkit.org/show_bug.cgi?id=87892
655
656 Reviewed by Geoffrey Garen.
657
658 r115516 splitted JSString into two classes, with addition nested classes.
659 Add a workaround for the WinCE compiler since it can't resolve the friend class
660 declerations corretly and denies the access to protected members of JSString.
661
662 * runtime/JSString.h:
663 (JSC::JSRopeString::RopeBuilder::append):
664 (JSC::JSRopeString::append):
665 (JSRopeString):
666
oliver@apple.com3c996382012-05-30 23:47:27 +00006672012-05-30 Oliver Hunt <oliver@apple.com>
668
669 Really provide error information with the inspector disabled
670 https://bugs.webkit.org/show_bug.cgi?id=87910
671
672 Reviewed by Filip Pizlo.
673
674 Don't bother checking for anything other than pre-existing error info.
675 In the absence of complete line number information you'll only get the
676 line a function starts on, but at least it's something.
677
678 * interpreter/Interpreter.cpp:
679 (JSC::Interpreter::throwException):
680
fpizlo@apple.com074918c2012-05-30 20:18:00 +00006812012-05-30 Filip Pizlo <fpizlo@apple.com>
682
fpizlo@apple.com5673fe62012-05-30 23:09:45 +0000683 LLInt broken on x86-32 with JIT turned off
684 https://bugs.webkit.org/show_bug.cgi?id=87906
685
686 Reviewed by Geoffrey Garen.
687
688 Fixed the code to not clobber registers that contain important things, like the call frame.
689
690 * llint/LowLevelInterpreter32_64.asm:
691
6922012-05-30 Filip Pizlo <fpizlo@apple.com>
693
fpizlo@apple.com074918c2012-05-30 20:18:00 +0000694 ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
695 https://bugs.webkit.org/show_bug.cgi?id=87887
696
fpizlo@apple.comd55e8152012-05-30 21:04:23 +0000697 Reviewed by Darin Adler.
698
699 Better fix - we now never call SourceProvider::asID() if SourceProvider* is 0.
700
701 * parser/Nodes.h:
702 (JSC::ScopeNode::sourceID):
703 * parser/SourceCode.h:
704 (JSC::SourceCode::providerID):
705 (SourceCode):
706 * parser/SourceProvider.h:
707 (SourceProvider):
708 (JSC::SourceProvider::asID):
709 * runtime/Executable.h:
710 (JSC::ScriptExecutable::sourceID):
711
7122012-05-30 Filip Pizlo <fpizlo@apple.com>
713
714 ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
715 https://bugs.webkit.org/show_bug.cgi?id=87887
716
fpizlo@apple.com074918c2012-05-30 20:18:00 +0000717 Reviewed by Geoffrey Garen.
718
719 * parser/SourceProvider.h:
720 (JSC::SourceProvider::asID):
721
oliver@apple.comc55314a2012-05-30 19:45:20 +00007222012-05-30 Oliver Hunt <oliver@apple.com>
723
724 DFG does not correctly handle exceptions caught in the LLInt
725 https://bugs.webkit.org/show_bug.cgi?id=87885
726
727 Reviewed by Filip Pizlo.
728
729 Make the DFG use genericThrow, rather than reimplementing a small portion of it.
730 Also make the LLInt slow paths validate that their PC is correct.
731
732 * dfg/DFGOperations.cpp:
733 * llint/LLIntSlowPaths.cpp:
734 (LLInt):
735
fpizlo@apple.com75824e82012-05-30 17:02:49 +00007362012-05-29 Filip Pizlo <fpizlo@apple.com>
737
738 DFG CFA should infer types and values of captured variables
739 https://bugs.webkit.org/show_bug.cgi?id=87813
740
741 Reviewed by Gavin Barraclough.
742
743 Slight speed-up in V8/earley-boyer (~1%).
744
745 * bytecode/CodeBlock.h:
746 (JSC::CodeBlock::argumentsAreCaptured):
747 (JSC::CodeBlock::argumentIsCaptured):
748 (CodeBlock):
749 * dfg/DFGAbstractState.cpp:
750 (DFG):
751 (JSC::DFG::AbstractState::beginBasicBlock):
752 (JSC::DFG::AbstractState::initialize):
753 (JSC::DFG::AbstractState::endBasicBlock):
754 (JSC::DFG::AbstractState::execute):
755 (JSC::DFG::AbstractState::clobberWorld):
756 (JSC::DFG::AbstractState::clobberStructures):
757 (JSC::DFG::AbstractState::mergeStateAtTail):
758 (JSC::DFG::AbstractState::merge):
759 (JSC::DFG::AbstractState::mergeToSuccessors):
760 * dfg/DFGAbstractState.h:
761 (JSC::DFG::AbstractState::variables):
762 (AbstractState):
763 * dfg/DFGSpeculativeJIT32_64.cpp:
764 (JSC::DFG::SpeculativeJIT::compile):
765 * dfg/DFGSpeculativeJIT64.cpp:
766 (JSC::DFG::SpeculativeJIT::compile):
767
paroga@webkit.orge373ab72012-05-30 16:44:03 +00007682012-05-30 Patrick Gansterer <paroga@webkit.org>
769
770 Unreviewed. Build fix for !ENABLE(JIT) after r117823.
771
772 * bytecode/CodeBlock.cpp:
773 (JSC::CodeBlock::dump):
774
commit-queue@webkit.org4ac40e0d2012-05-30 07:17:05 +00007752012-05-30 Sheriff Bot <webkit.review.bot@gmail.com>
776
777 Unreviewed, rolling out r118868.
778 http://trac.webkit.org/changeset/118868
779 https://bugs.webkit.org/show_bug.cgi?id=87828
780
781 introduced ~20 crashes on Mac and Qt bots (Requested by pizlo_
782 on #webkit).
783
784 * heap/Heap.cpp:
785 (JSC::Heap::collect):
786 * heap/MarkedBlock.cpp:
787 (JSC::MarkedBlock::sweep):
788 * heap/MarkedBlock.h:
789 (JSC::MarkedBlock::sweepWeakSet):
790 (JSC):
791 * heap/MarkedSpace.cpp:
792 (JSC::SweepWeakSet::operator()):
793 (JSC):
794 (JSC::MarkedSpace::sweepWeakSets):
795 * heap/MarkedSpace.h:
796 (MarkedSpace):
797
ggaren@apple.com15344ae2012-05-30 01:05:35 +00007982012-05-29 Geoffrey Garen <ggaren@apple.com>
799
800 Rolled back in r118646, now that
801 https://bugs.webkit.org/show_bug.cgi?id=87784 is fixed.
802
803 http://trac.webkit.org/changeset/118646
804 https://bugs.webkit.org/show_bug.cgi?id=87599
805
806 * heap/Heap.cpp:
807 (JSC::Heap::collect):
808 * heap/MarkedBlock.cpp:
809 (JSC::MarkedBlock::sweep):
810 * heap/MarkedBlock.h:
811 (JSC):
812 * heap/MarkedSpace.cpp:
813 (JSC):
814 * heap/MarkedSpace.h:
815 (MarkedSpace):
816
fpizlo@apple.com4c0875e2012-05-29 23:43:16 +00008172012-05-29 Filip Pizlo <fpizlo@apple.com>
818
819 DFG should keep captured variables alive until the (inline) return.
820 https://bugs.webkit.org/show_bug.cgi?id=87205
821
822 Reviewed by Gavin Barraclough.
823
824 Changes the way we do flushing for captured variables and arguments. Instead of flushing
825 each SetLocal immediately, we flush at kill points. So a SetLocal will cause a Flush of
826 whatever was live in the variable previously, and a return will cause a Flush of all
827 captured variables and all arguments.
828
829 * dfg/DFGByteCodeParser.cpp:
830 (JSC::DFG::ByteCodeParser::setDirect):
831 (JSC::DFG::ByteCodeParser::set):
832 (JSC::DFG::ByteCodeParser::setLocal):
833 (JSC::DFG::ByteCodeParser::getArgument):
834 (JSC::DFG::ByteCodeParser::setArgument):
835 (JSC::DFG::ByteCodeParser::findArgumentPositionForArgument):
836 (ByteCodeParser):
837 (JSC::DFG::ByteCodeParser::findArgumentPositionForLocal):
838 (JSC::DFG::ByteCodeParser::findArgumentPosition):
839 (JSC::DFG::ByteCodeParser::flush):
840 (JSC::DFG::ByteCodeParser::flushDirect):
841 (JSC::DFG::ByteCodeParser::flushArgumentsAndCapturedVariables):
842 (JSC::DFG::ByteCodeParser::handleInlining):
843 (JSC::DFG::ByteCodeParser::parseBlock):
844 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
845 * dfg/DFGCSEPhase.cpp:
846 (JSC::DFG::CSEPhase::setLocalStoreElimination):
847 (JSC::DFG::CSEPhase::performNodeCSE):
848 * dfg/DFGSpeculativeJIT.cpp:
849 (JSC::DFG::SpeculativeJIT::compile):
850 * dfg/DFGSpeculativeJIT.h:
851 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
852
ggaren@apple.com7cc57362012-05-29 23:40:26 +00008532012-05-29 Geoffrey Garen <ggaren@apple.com>
854
855 WeakGCMap should be lazy-finalization-safe
856 https://bugs.webkit.org/show_bug.cgi?id=87784
857
858 Reviewed by Darin Adler.
859
860 * runtime/WeakGCMap.h:
861 (JSC::WeakGCMap::get): Since this is a map of raw WeakImpl pointers, and
862 not Weak<T>, we need to verify manually that the WeakImpl is live before
863 we return its payload.
864
mhahnenberg@apple.com7ea7e8f2012-05-29 18:38:14 +00008652012-05-29 Mark Hahnenberg <mhahnenberg@apple.com>
866
867 CopiedSpace::doneCopying could start another collection
868 https://bugs.webkit.org/show_bug.cgi?id=86538
869
870 Reviewed by Geoffrey Garen.
871
872 It's possible that if we don't have anything at the head of to-space
873 after a collection and the BlockAllocator doesn't have any fresh blocks
874 to give us right now we could start another collection while still in
875 the middle of the first collection when we call CopiedSpace::addNewBlock().
876
877 One way to resolve this would be to have Heap::shouldCollect() check that
878 m_operationInProgress is NoOperation. This would prevent the path in
879 getFreshBlock() that starts the collection if we're already in the middle of one.
880
881 I could not come up with a test case to reproduce this crash on ToT.
882
883 * heap/Heap.h:
884 (JSC::Heap::shouldCollect): We shouldn't collect if we're already in the middle
885 of a collection, i.e. the current operation should be NoOperation.
886
commit-queue@webkit.orgd5058402012-05-29 14:44:38 +00008872012-05-29 David Barr <davidbarr@chromium.org>
888
889 Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag
890 https://bugs.webkit.org/show_bug.cgi?id=87685
891
892 Reviewed by Eric Seidel.
893
894 Add a configuration option for CSS image-resolution support, disabling it by default.
895
896 * Configurations/FeatureDefines.xcconfig:
897
commit-queue@webkit.org10c0df22012-05-29 03:24:49 +00008982012-05-28 Sheriff Bot <webkit.review.bot@gmail.com>
899
900 Unreviewed, rolling out r118646.
901 http://trac.webkit.org/changeset/118646
902 https://bugs.webkit.org/show_bug.cgi?id=87691
903
904 broke V8 raytrace benchmark (Requested by pizlo_ on #webkit).
905
906 * heap/Heap.cpp:
907 (JSC::Heap::collect):
908 * heap/MarkedBlock.cpp:
909 (JSC::MarkedBlock::sweep):
910 * heap/MarkedBlock.h:
911 (JSC::MarkedBlock::sweepWeakSet):
912 (JSC):
913 * heap/MarkedSpace.cpp:
914 (JSC::SweepWeakSet::operator()):
915 (JSC):
916 (JSC::MarkedSpace::sweepWeakSets):
917 * heap/MarkedSpace.h:
918 (MarkedSpace):
919
fpizlo@apple.com26ece8e2012-05-29 02:43:30 +00009202012-05-28 Filip Pizlo <fpizlo@apple.com>
921
922 DFG should not generate code for code that the CFA proves to be unreachable
923 https://bugs.webkit.org/show_bug.cgi?id=87682
924
925 Reviewed by Sam Weinig.
926
927 This also fixes a small performance bug where CFA was not marking blocks
928 as having constants (and hence not triggering constant folding) if the only
929 constants were on GetLocals.
930
931 And fixing that bug revealed another bug: constant folding was assuming that
932 a GetLocal must be the first access to a local in a basic block. This isn't
933 true. The first access may be a Flush. This patch fixes that issue using the
934 safest approach possible, since we don't need to be clever for something that
935 only happens in one of our benchmarks.
936
937 * dfg/DFGAbstractState.cpp:
938 (JSC::DFG::AbstractState::execute):
939 * dfg/DFGConstantFoldingPhase.cpp:
940 (JSC::DFG::ConstantFoldingPhase::run):
941 * dfg/DFGJITCompiler.h:
942 (JSC::DFG::JITCompiler::noticeOSREntry):
943 * dfg/DFGSpeculativeJIT.cpp:
944 (JSC::DFG::SpeculativeJIT::compile):
945
carlosgc@webkit.orgb69727c2012-05-28 10:21:31 +00009462012-05-28 Carlos Garcia Campos <cgarcia@igalia.com>
947
948 Unreviewed. Fix make distcheck.
949
950 * GNUmakefile.list.am: Add missing header file.
951
ggaren@apple.comb816d752012-05-28 04:56:01 +00009522012-05-27 Geoffrey Garen <ggaren@apple.com>
953
954 Weak pointer finalization should be lazy
955 https://bugs.webkit.org/show_bug.cgi?id=87599
956
957 Reviewed by Darin Adler.
958
959 * heap/Heap.cpp:
960 (JSC::Heap::collect): Don't force immediate finalization -- it will
961 happen lazily.
962
963 * heap/MarkedBlock.cpp:
964 (JSC::MarkedBlock::sweep): Sweep a block's weak set when sweeping the
965 block. The weak set may not have been swept yet, and this is our last
966 chance to run weak finalizers before we recycle the memory they reference.
967
968 * heap/MarkedBlock.h:
969 * heap/MarkedSpace.cpp:
970 (JSC::MarkedBlock::sweepWeakSets):
971 * heap/MarkedSpace.h:
972 (JSC::MarkedSpace::sweepWeakSets): Nixed sweepWeakSets because it's unused
973 now.
974
ggaren@apple.com72da8112012-05-26 22:40:46 +00009752012-05-26 Geoffrey Garen <ggaren@apple.com>
976
977 WebKit should be lazy-finalization-safe (esp. the DOM) v2
978 https://bugs.webkit.org/show_bug.cgi?id=87581
979
980 Reviewed by Oliver Hunt.
981
982 * heap/MarkedBlock.cpp:
983 (JSC::MarkedBlock::callDestructor):
984 * heap/WeakBlock.h:
985 * heap/WeakSetInlines.h:
986 (JSC::WeakBlock::finalize): Since we don't guarantee destruction order,
987 it's not valid to access GC pointers like the Structure pointer during
988 finalization. We NULL out the structure pointer in debug builds to try
989 to make this programming mistake more obvious.
990
991 * API/JSCallbackConstructor.cpp:
992 (JSC::JSCallbackConstructor::destroy):
993 * API/JSCallbackObject.cpp:
994 (JSC::::destroy):
995 (JSC::JSCallbackObjectData::finalize):
996 * runtime/Arguments.cpp:
997 (JSC::Arguments::destroy):
998 * runtime/DateInstance.cpp:
999 (JSC::DateInstance::destroy):
1000 * runtime/Error.cpp:
1001 (JSC::StrictModeTypeErrorFunction::destroy):
1002 * runtime/Executable.cpp:
1003 (JSC::ExecutableBase::destroy):
1004 (JSC::NativeExecutable::destroy):
1005 (JSC::ScriptExecutable::destroy):
1006 (JSC::EvalExecutable::destroy):
1007 (JSC::ProgramExecutable::destroy):
1008 (JSC::FunctionExecutable::destroy):
1009 * runtime/JSGlobalObject.cpp:
1010 (JSC::JSGlobalObject::destroy):
1011 * runtime/JSPropertyNameIterator.cpp:
1012 (JSC::JSPropertyNameIterator::destroy):
1013 * runtime/JSStaticScopeObject.cpp:
1014 (JSC::JSStaticScopeObject::destroy):
1015 * runtime/JSString.cpp:
1016 (JSC::JSString::destroy):
1017 * runtime/JSVariableObject.cpp:
1018 (JSC::JSVariableObject::destroy):
1019 * runtime/NameInstance.cpp:
1020 (JSC::NameInstance::destroy):
1021 * runtime/RegExp.cpp:
1022 (JSC::RegExp::destroy):
1023 * runtime/RegExpConstructor.cpp:
1024 (JSC::RegExpConstructor::destroy):
1025 * runtime/Structure.cpp:
1026 (JSC::Structure::destroy):
1027 * runtime/StructureChain.cpp:
1028 (JSC::StructureChain::destroy): Use static_cast instead of jsCast because
1029 jsCast does Structure-based validation, and our Structure is not guaranteed
1030 to be alive when we get finalized.
1031
fpizlo@apple.com7e0f6502012-05-25 22:45:57 +000010322012-05-22 Filip Pizlo <fpizlo@apple.com>
1033
fpizlo@apple.com190f5252012-05-25 23:00:26 +00001034 DFG CSE should eliminate redundant WeakJSConstants
1035 https://bugs.webkit.org/show_bug.cgi?id=87179
1036
1037 Reviewed by Gavin Barraclough.
1038
1039 Merged r118141 from dfgopt.
1040
1041 * dfg/DFGCSEPhase.cpp:
1042 (JSC::DFG::CSEPhase::weakConstantCSE):
1043 (CSEPhase):
1044 (JSC::DFG::CSEPhase::performNodeCSE):
1045 * dfg/DFGNode.h:
1046 (JSC::DFG::Node::weakConstant):
1047
10482012-05-22 Filip Pizlo <fpizlo@apple.com>
1049
fpizlo@apple.com7e0f6502012-05-25 22:45:57 +00001050 DFG CSE should do redundant store elimination
1051 https://bugs.webkit.org/show_bug.cgi?id=87161
1052
1053 Reviewed by Oliver Hunt.
1054
1055 Merge r118138 from dfgopt.
1056
1057 This patch adds redundant store elimination. For example, consider this
1058 code:
1059
1060 o.x = 42;
1061 o.x = 84;
1062
1063 If o.x is speculated to be a well-behaved field, the first assignment is
1064 unnecessary, since the second just overwrites it. We would like to
1065 eliminate the first assignment in these cases. The need for this
1066 optimization arises mostly from stores that our runtime requires. For
1067 example:
1068
1069 o = {f:1, g:2, h:3};
1070
1071 This will have four assignments to the structure for the newly created
1072 object - one assignment for the empty structure, one for {f}, one for
1073 {f, g}, and one for {f, g, h}. We would like to only have the last of
1074 those assigments in this case.
1075
1076 Intriguingly, doing so for captured variables breaks the way arguments
1077 simplification used to work. Consider that prior to either arguments
1078 simplification or store elimination we will have IR that looks like:
1079
1080 a: SetLocal(r0, Empty)
1081 b: SetLocal(r1, Empty)
1082 c: GetLocal(r0)
1083 d: CreateArguments(@c)
1084 e: SetLocal(r0, @d)
1085 f: SetLocal(r1, @d)
1086
1087 Then redundant store elimination will eliminate the stores that
1088 initialize the arguments registers to Empty, but then arguments
1089 simplification eliminates the stores that initialize the arguments to
1090 the newly created arguments - and at this point we no longer have any
1091 stores to the arguments register, leading to hilarious crashes. This
1092 patch therefore changes arguments simplification to replace
1093 CreateArguments with JSConstant(Empty) rather than eliminating the
1094 SetLocals. But this revealed bugs where arguments simplification was
1095 being overzealous, so I fixed those bugs.
1096
1097 This is a minor speed-up on V8/early and a handful of other tests.
1098
1099 * bytecode/CodeBlock.h:
1100 (JSC::CodeBlock::uncheckedActivationRegister):
1101 * dfg/DFGAbstractState.cpp:
1102 (JSC::DFG::AbstractState::execute):
1103 * dfg/DFGArgumentsSimplificationPhase.cpp:
1104 (JSC::DFG::ArgumentsSimplificationPhase::run):
1105 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
1106 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUses):
1107 (JSC::DFG::ArgumentsSimplificationPhase::observeProperArgumentsUse):
1108 * dfg/DFGCSEPhase.cpp:
1109 (JSC::DFG::CSEPhase::globalVarStoreElimination):
1110 (CSEPhase):
1111 (JSC::DFG::CSEPhase::putStructureStoreElimination):
1112 (JSC::DFG::CSEPhase::putByOffsetStoreElimination):
1113 (JSC::DFG::CSEPhase::setLocalStoreElimination):
1114 (JSC::DFG::CSEPhase::setReplacement):
1115 (JSC::DFG::CSEPhase::eliminate):
1116 (JSC::DFG::CSEPhase::performNodeCSE):
1117 * dfg/DFGGraph.h:
1118 (JSC::DFG::Graph::uncheckedActivationRegisterFor):
1119 (Graph):
1120 * dfg/DFGNode.h:
1121 (JSC::DFG::Node::isPhantomArguments):
1122 (Node):
1123 (JSC::DFG::Node::hasConstant):
1124 (JSC::DFG::Node::valueOfJSConstant):
1125 (JSC::DFG::Node::hasStructureTransitionData):
1126 * dfg/DFGNodeType.h:
1127 (DFG):
1128 * dfg/DFGPredictionPropagationPhase.cpp:
1129 (JSC::DFG::PredictionPropagationPhase::propagate):
1130 * dfg/DFGSpeculativeJIT.cpp:
1131 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
1132 * dfg/DFGSpeculativeJIT32_64.cpp:
1133 (JSC::DFG::SpeculativeJIT::compile):
1134 * dfg/DFGSpeculativeJIT64.cpp:
1135 (JSC::DFG::SpeculativeJIT::compile):
1136
fpizlo@apple.com016fd682012-05-25 20:19:55 +000011372012-05-21 Filip Pizlo <fpizlo@apple.com>
1138
1139 DFG ConvertThis should just be a CheckStructure if the structure is known
1140 https://bugs.webkit.org/show_bug.cgi?id=87057
1141
1142 Reviewed by Gavin Barraclough.
1143
1144 Merged r118021 from dfgopt.
1145
1146 This gives ValueProfile the ability to track singleton values - i.e. profiling
1147 sites that always see the same value.
1148
1149 That is then used to profile the structure in op_convert_this.
1150
1151 This is then used to optimize op_convert_this into a CheckStructure if the
1152 structure is always the same.
1153
1154 That then results in better CSE in inlined code that uses 'this', since
1155 previously we couldn't CSE accesses on 'this' from different inline call frames.
1156
1157 Also fixed a bug where we were unnecessarily flushing 'this'.
1158
1159 * bytecode/CodeBlock.cpp:
1160 (JSC::CodeBlock::dump):
1161 (JSC::CodeBlock::stronglyVisitStrongReferences):
1162 * bytecode/LazyOperandValueProfile.cpp:
1163 (JSC::CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions):
1164 * bytecode/LazyOperandValueProfile.h:
1165 (CompressedLazyOperandValueProfileHolder):
1166 * bytecode/Opcode.h:
1167 (JSC):
1168 (JSC::padOpcodeName):
1169 * bytecode/ValueProfile.h:
1170 (JSC::ValueProfileBase::ValueProfileBase):
1171 (JSC::ValueProfileBase::dump):
1172 (JSC::ValueProfileBase::computeUpdatedPrediction):
1173 (ValueProfileBase):
1174 * bytecompiler/BytecodeGenerator.cpp:
1175 (JSC::BytecodeGenerator::BytecodeGenerator):
1176 * dfg/DFGByteCodeParser.cpp:
1177 (JSC::DFG::ByteCodeParser::setArgument):
1178 (JSC::DFG::ByteCodeParser::parseBlock):
1179 * jit/JITOpcodes.cpp:
1180 (JSC::JIT::emit_op_convert_this):
1181 (JSC::JIT::emitSlow_op_convert_this):
1182 * jit/JITOpcodes32_64.cpp:
1183 (JSC::JIT::emit_op_convert_this):
1184 (JSC::JIT::emitSlow_op_convert_this):
1185 * llint/LLIntSlowPaths.cpp:
1186 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
1187 * llint/LowLevelInterpreter32_64.asm:
1188 * llint/LowLevelInterpreter64.asm:
1189 * runtime/JSValue.h:
1190 (JSValue):
1191 * runtime/Structure.h:
1192 (JSC::JSValue::structureOrUndefined):
1193 (JSC):
1194
timothy_horton@apple.com3f03ac12012-05-25 06:53:27 +000011952012-05-24 Tim Horton <timothy_horton@apple.com>
1196
1197 Add feature defines for web-facing parts of CSS Regions and Exclusions
1198 https://bugs.webkit.org/show_bug.cgi?id=87442
1199 <rdar://problem/10887709>
1200
1201 Reviewed by Dan Bernstein.
1202
1203 * Configurations/FeatureDefines.xcconfig:
1204
ggaren@apple.com9e1789f2012-05-25 06:52:00 +000012052012-05-24 Geoffrey Garen <ggaren@apple.com>
1206
1207 WebKit should be lazy-finalization-safe (esp. the DOM)
1208 https://bugs.webkit.org/show_bug.cgi?id=87456
1209
1210 Reviewed by Filip Pizlo.
1211
1212 Lazy finalization adds one twist to weak pointer use:
1213
1214 A HashMap of weak pointers may contain logically null entries.
1215 (Weak pointers behave as-if null once their payloads die.)
1216 Insertion must not assume that a pre-existing entry is
1217 necessarily valid, and iteration must not assume that all
1218 entries can be dereferenced.
1219
1220 (Previously, I thought that it also added a second twist:
1221
1222 A demand-allocated weak pointer may replace a dead payload
1223 before the payload's finalizer runs. In that case, when the
1224 payload's finalizer runs, the payload has already been
1225 overwritten, and the finalizer should not clear the payload,
1226 which now points to something new.
1227
1228 But that's not the case here, since we cancel the old payload's
1229 finalizer when we over-write it. I've added ASSERTs to verify this
1230 assumption, in case it ever changes.)
1231
1232 * API/JSClassRef.cpp:
1233 (OpaqueJSClass::prototype): No need to specify null; that's the default.
1234
1235 * API/JSWeakObjectMapRefPrivate.cpp: Use remove, since take() is gone.
1236
1237 * heap/PassWeak.h:
1238 (WeakImplAccessor::was): This is no longer a debug-only function, since
1239 it's required to reason about lazily finalized pointers.
1240
1241 * heap/Weak.h:
1242 (JSC::weakAdd):
1243 (JSC::weakRemove):
1244 (JSC::weakClear): Added these helper functions for the common idioms of
1245 what clients want to do in their weak pointer finalizers.
1246
1247 * jit/JITStubs.cpp:
1248 (JSC::JITThunks::hostFunctionStub): Use the new idioms. Otherwise, we
1249 would return NULL for a "zombie" executable weak pointer that was waiting
1250 for finalization (item (2)), and finalizing a dead executable weak pointer
1251 would potentially destroy a new, live one (item (1)).
1252
1253 * runtime/RegExpCache.cpp:
1254 (JSC::RegExpCache::lookupOrCreate):
1255 (JSC::RegExpCache::finalize): Ditto.
1256
1257 (JSC::RegExpCache::invalidateCode): Check for null while iterating. (See
1258 item (2).)
1259
1260 * runtime/Structure.cpp:
1261 (JSC::StructureTransitionTable::contains):
1262 (JSC::StructureTransitionTable::add): Use get and set instead of add and
1263 contains, since add and contains are not compatible with lazy finalization.
1264
1265 * runtime/WeakGCMap.h:
1266 (WeakGCMap):
1267 (JSC::WeakGCMap::clear):
1268 (JSC::WeakGCMap::remove): Removed a bunch of code that was incompatible with
1269 lazy finalization because I didn't feel like making it compatible, and I had
1270 no way to test it.
1271
fpizlo@apple.com0b9b37a2012-05-25 03:29:18 +000012722012-05-24 Filip Pizlo <fpizlo@apple.com>
1273
fpizlo@apple.com9d899a42012-05-25 05:41:03 +00001274 REGRESSION (r118013-r118031): Loops/Reloads under www.yahoo.com, quits after three tries with error
1275 https://bugs.webkit.org/show_bug.cgi?id=87327
1276
1277 Reviewed by Geoffrey Garen.
1278
1279 If you use AbstractValue::filter(StructureSet) to test subset relationships between TOP and a
1280 set containing >=2 elements, you're going to have a bad time.
1281
1282 That's because AbstractValue considers a set with >=2 elements to be equivalent to TOP, in order
1283 to save space and speed up convergence. So filtering has no effect in this case, which made
1284 the code think that the abstract value was proving that the structure check was unnecessary.
1285 The correct thing to do is to use isSubsetOf() on the StructureAbstractValue, which does the
1286 right thingies for TOP and >=2 elements.
1287
1288 * dfg/DFGAbstractState.cpp:
1289 (JSC::DFG::AbstractState::execute):
1290 * dfg/DFGSpeculativeJIT32_64.cpp:
1291 (JSC::DFG::SpeculativeJIT::compile):
1292 * dfg/DFGSpeculativeJIT64.cpp:
1293 (JSC::DFG::SpeculativeJIT::compile):
1294
12952012-05-24 Filip Pizlo <fpizlo@apple.com>
1296
fpizlo@apple.com0b9b37a2012-05-25 03:29:18 +00001297 new test fast/js/dfg-arguments-mixed-alias.html fails on JSVALUE32_64
1298 https://bugs.webkit.org/show_bug.cgi?id=87378
1299
1300 Reviewed by Gavin Barraclough.
1301
1302 - Captured variable tracking forgot did not consistently handle arguments, leading to OSR
1303 badness.
1304
1305 - Nodes capable of exiting were tracked in a non-monotonic way, leading to compiler errors.
1306
1307 * dfg/DFGByteCodeParser.cpp:
1308 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
1309 * dfg/DFGCSEPhase.cpp:
1310 (JSC::DFG::CSEPhase::CSEPhase):
1311 (CSEPhase):
1312 (JSC::DFG::performCSE):
1313 * dfg/DFGCSEPhase.h:
1314 (DFG):
1315 * dfg/DFGCommon.h:
1316 * dfg/DFGDriver.cpp:
1317 (JSC::DFG::compile):
1318 * dfg/DFGGraph.cpp:
1319 (JSC::DFG::Graph::resetExitStates):
1320 (DFG):
1321 * dfg/DFGGraph.h:
1322 (Graph):
1323 * dfg/DFGPhase.h:
1324 (DFG):
1325 (JSC::DFG::runPhase):
1326
ggaren@apple.com39281e22012-05-24 21:18:10 +000013272012-05-24 Geoffrey Garen <ggaren@apple.com>
1328
1329 Made WeakSet per-block instead of per-heap
1330 https://bugs.webkit.org/show_bug.cgi?id=87401
1331
1332 Reviewed by Oliver Hunt.
1333
1334 This allows us fast access to the set of all weak pointers for a block,
1335 which is a step toward lazy finalization.
1336
1337 No performance change.
1338
1339 * heap/Heap.cpp:
1340 (JSC::Heap::Heap):
1341 (JSC::Heap::lastChanceToFinalize): Removed the per-heap weak set, since
1342 it's per-block now.
1343
1344 (JSC::Heap::markRoots): Delegate weak set visiting to the marked space,
1345 since it knows how to iterate all blocks.
1346
1347 (JSC::Heap::collect): Moved the reaping outside of markRoots, since it
1348 doesn't mark anything.
1349
1350 Make sure to reset allocators after shrinking, since shrinking may
1351 deallocate the current allocator.
1352
1353 * heap/Heap.h:
1354 (Heap): No more per-heap weak set, since it's per-block now.
1355
1356 * heap/MarkedBlock.cpp:
1357 (JSC::MarkedBlock::MarkedBlock):
1358 * heap/MarkedBlock.h:
1359 (MarkedBlock):
1360 (JSC::MarkedBlock::lastChanceToFinalize): Migrated finalization logic
1361 here from the heap, so the heap doesn't need to know about our internal
1362 data structures like our weak set.
1363
1364 (JSC::MarkedBlock::heap):
1365 (JSC::MarkedBlock::weakSet):
1366 (JSC::MarkedBlock::shrink):
1367 (JSC::MarkedBlock::resetAllocator):
1368 (JSC::MarkedBlock::visitWeakSet):
1369 (JSC::MarkedBlock::reapWeakSet):
1370 (JSC::MarkedBlock::sweepWeakSet):
1371 * heap/MarkedSpace.cpp:
1372 (JSC::VisitWeakSet::VisitWeakSet):
1373 (JSC::VisitWeakSet::operator()):
1374 (VisitWeakSet):
1375 (JSC):
1376 (JSC::ReapWeakSet::operator()):
1377 (JSC::SweepWeakSet::operator()):
1378 (JSC::LastChanceToFinalize::operator()):
1379 (JSC::MarkedSpace::lastChanceToFinalize):
1380 (JSC::ResetAllocator::operator()):
1381 (JSC::MarkedSpace::resetAllocators):
1382 (JSC::MarkedSpace::visitWeakSets):
1383 (JSC::MarkedSpace::reapWeakSets):
1384 (JSC::MarkedSpace::sweepWeakSets):
1385 (JSC::Shrink::operator()):
1386 (JSC::MarkedSpace::shrink):
1387 * heap/MarkedSpace.h:
1388 (MarkedSpace): Make sure to account for our weak sets when sweeping,
1389 shrinking, etc.
1390
1391 * heap/WeakSet.cpp:
1392 (JSC):
1393 * heap/WeakSet.h:
1394 (WeakSet):
1395 (JSC::WeakSet::heap):
1396 (JSC):
1397 (JSC::WeakSet::lastChanceToFinalize):
1398 (JSC::WeakSet::visit):
1399 (JSC::WeakSet::reap):
1400 (JSC::WeakSet::shrink):
1401 (JSC::WeakSet::resetAllocator): Inlined some things since they're called
1402 once per block now instead of once per heap.
1403
1404 * heap/WeakSetInlines.h:
1405 (JSC::WeakSet::allocate): Use the per-block weak set since there is no
1406 per-heap weak set anymore.
1407
barraclough@apple.comefdbf472012-05-24 21:14:07 +000014082012-05-24 Gavin Barraclough <barraclough@apple.com>
1409
barraclough@apple.com8ca6a7a2012-05-24 21:17:38 +00001410 Fix arm build
1411
1412 Rubber stamped by Geoff Garen
1413
1414 * dfg/DFGGPRInfo.h:
1415 (GPRInfo):
1416
14172012-05-24 Gavin Barraclough <barraclough@apple.com>
1418
barraclough@apple.comefdbf472012-05-24 21:14:07 +00001419 Move cacheFlush from ExecutableAllocator to Assembler classes
1420 https://bugs.webkit.org/show_bug.cgi?id=87420
1421
1422 Reviewed by Oliver Hunt.
1423
1424 Makes more sense there, & remove a pile of #ifdefs.
1425
1426 * assembler/ARMAssembler.cpp:
1427 (JSC):
1428 (JSC::ARMAssembler::cacheFlush):
1429 * assembler/ARMAssembler.h:
1430 (ARMAssembler):
1431 (JSC::ARMAssembler::cacheFlush):
1432 * assembler/ARMv7Assembler.h:
1433 (JSC::ARMv7Assembler::relinkJump):
1434 (JSC::ARMv7Assembler::cacheFlush):
1435 (ARMv7Assembler):
1436 (JSC::ARMv7Assembler::setInt32):
1437 (JSC::ARMv7Assembler::setUInt7ForLoad):
1438 * assembler/AbstractMacroAssembler.h:
1439 (JSC::AbstractMacroAssembler::cacheFlush):
1440 * assembler/LinkBuffer.h:
1441 (JSC::LinkBuffer::performFinalization):
1442 * assembler/MIPSAssembler.h:
1443 (JSC::MIPSAssembler::relinkJump):
1444 (JSC::MIPSAssembler::relinkCall):
1445 (JSC::MIPSAssembler::repatchInt32):
1446 (JSC::MIPSAssembler::cacheFlush):
1447 (MIPSAssembler):
1448 * assembler/SH4Assembler.h:
1449 (JSC::SH4Assembler::repatchCompact):
1450 (JSC::SH4Assembler::cacheFlush):
1451 (SH4Assembler):
1452 * assembler/X86Assembler.h:
1453 (X86Assembler):
1454 (JSC::X86Assembler::cacheFlush):
1455 * jit/ExecutableAllocator.cpp:
1456 (JSC):
1457 * jit/ExecutableAllocator.h:
1458 (ExecutableAllocator):
1459
commit-queue@webkit.org2c8bcde2012-05-24 20:01:53 +000014602012-05-24 John Mellor <johnme@chromium.org>
1461
1462 Font Boosting: Add compile flag and runtime setting
1463 https://bugs.webkit.org/show_bug.cgi?id=87394
1464
1465 Reviewed by Adam Barth.
1466
1467 Add ENABLE_FONT_BOOSTING.
1468
1469 * Configurations/FeatureDefines.xcconfig:
1470
commit-queue@webkit.orgd553c622012-05-24 10:50:40 +000014712012-05-24 Allan Sandfeld Jensen <allan.jensen@nokia.com>
1472
1473 cti_vm_throw gets kicked out by gcc 4.6 -flto
1474 https://bugs.webkit.org/show_bug.cgi?id=56088
1475
1476 Reviewed by Darin Adler.
1477
1478 Add REFERENCED_FROM_ASM to functions only referenced from assembler.
1479
1480 * dfg/DFGOperations.cpp:
1481 * jit/HostCallReturnValue.h:
1482 * jit/JITStubs.h:
1483 * jit/ThunkGenerators.cpp:
1484
fpizlo@apple.com36f14462012-05-24 07:35:05 +000014852012-05-24 Filip Pizlo <fpizlo@apple.com>
1486
1487 Incorrect merge of r117542 from dfg opt branch in r118323 is leading to fast/js/dfg-arguments-osr-exit.html failing
1488 https://bugs.webkit.org/show_bug.cgi?id=87350
1489
1490 Reviewed by Maciej Stachowiak.
1491
1492 The dfgopt branch introduced the notion of a local variable being killed because it was aliased
1493 to the Arguments object as in cases like:
1494
1495 var a = arguments;
1496 return a.length;
1497
1498 This required changes to OSR exit handling - if the variable is dead but aliased to arguments, then
1499 OSR exit should reify the arguments. But meanwhile, in tip of tree we introduced special handling for
1500 dead variables on OSR exit. When the two were merged in r118323, the structure of the if/else branches
1501 ended up being such that we would treat dead arguments variables as totally dead as opposed to treating
1502 them as variables that need arguments reification.
1503
1504 This fixes the structure of the relevant if/else block so that variables that are dead-but-arguments
1505 end up being treated as reified arguments objects, while variables that are dead but not aliased to
1506 arguments are treated as tip of tree would have treated them (initialize to Undefined).
1507
1508 * dfg/DFGSpeculativeJIT.cpp:
1509 (JSC::DFG::SpeculativeJIT::compile):
1510
ossy@webkit.orgbc0d6372012-05-24 07:05:31 +000015112012-05-24 Csaba Osztrogonác <ossy@webkit.org>
1512
1513 Unreviewed 32 bit buildfix after r118325.
1514
1515 * dfg/DFGSpeculativeJIT32_64.cpp:
1516 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): Use ASSERT_UNUSED instead ASSERT.
1517
fpizlo@apple.comd96eb4e2012-05-24 06:58:52 +000015182012-05-23 Filip Pizlo <fpizlo@apple.com>
1519
fpizlo@apple.comb3ac2422012-05-24 07:00:24 +00001520 DFG operationTearOffActivation should return after handling the null activation case
1521 https://bugs.webkit.org/show_bug.cgi?id=87348
1522 <rdar://problem/11522295>
1523
1524 Reviewed by Oliver Hunt.
1525
1526 * dfg/DFGOperations.cpp:
1527
15282012-05-23 Filip Pizlo <fpizlo@apple.com>
1529
fpizlo@apple.comd96eb4e2012-05-24 06:58:52 +00001530 Unreviewed, merge the arguments fix in r118138 to get bots green.
1531
1532 * dfg/DFGArgumentsSimplificationPhase.cpp:
1533 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
1534
fpizlo@apple.comb9c94622012-05-24 05:51:05 +000015352012-05-20 Filip Pizlo <fpizlo@apple.com>
1536
fpizlo@apple.com91b2c682012-05-24 06:24:36 +00001537 DFG CFA should record if a node can OSR exit
1538 https://bugs.webkit.org/show_bug.cgi?id=86905
1539
1540 Reviewed by Oliver Hunt.
1541
1542 Merged r117931 from dfgopt.
1543
1544 Adds a NodeFlag that denotes nodes that are known to not have OSR exits.
1545 This ought to aid any backwards analyses that need to know when a
1546 backward flow merge might happen due to a side exit.
1547
1548 Also added assertions into speculationCheck() that ensure that we did not
1549 mark a node as non-exiting and then promptly compile in an exit. This
1550 helped catch some minor bugs where we were doing unnecessary speculation
1551 checks.
1552
1553 This is a perf-neutral change. The speculation checks that this removes
1554 were not on hot paths of major benchmarks.
1555
1556 * bytecode/PredictedType.h:
1557 (JSC):
1558 (JSC::isAnyPrediction):
1559 * dfg/DFGAbstractState.cpp:
1560 (JSC::DFG::AbstractState::execute):
1561 * dfg/DFGAbstractState.h:
1562 (JSC::DFG::AbstractState::speculateInt32Unary):
1563 (AbstractState):
1564 (JSC::DFG::AbstractState::speculateNumberUnary):
1565 (JSC::DFG::AbstractState::speculateBooleanUnary):
1566 (JSC::DFG::AbstractState::speculateInt32Binary):
1567 (JSC::DFG::AbstractState::speculateNumberBinary):
1568 * dfg/DFGNode.h:
1569 (JSC::DFG::Node::mergeFlags):
1570 (JSC::DFG::Node::filterFlags):
1571 (Node):
1572 (JSC::DFG::Node::setCanExit):
1573 (JSC::DFG::Node::canExit):
1574 * dfg/DFGNodeFlags.cpp:
1575 (JSC::DFG::nodeFlagsAsString):
1576 * dfg/DFGNodeFlags.h:
1577 (DFG):
1578 * dfg/DFGSpeculativeJIT.cpp:
1579 (JSC::DFG::SpeculativeJIT::SpeculativeJIT):
1580 (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
1581 (JSC::DFG::SpeculativeJIT::compileValueToInt32):
1582 * dfg/DFGSpeculativeJIT.h:
1583 (JSC::DFG::SpeculativeJIT::speculationCheck):
1584 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
1585 (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution):
1586 (SpeculativeJIT):
1587 * dfg/DFGSpeculativeJIT32_64.cpp:
1588 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
1589 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
1590 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
1591 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
1592 (JSC::DFG::SpeculativeJIT::compile):
1593 * dfg/DFGSpeculativeJIT64.cpp:
1594 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
1595 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
1596 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
1597 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
1598 (JSC::DFG::SpeculativeJIT::compile):
1599
16002012-05-20 Filip Pizlo <fpizlo@apple.com>
1601
fpizlo@apple.comb9c94622012-05-24 05:51:05 +00001602 DFG should not do unnecessary indirections when storing to objects
1603 https://bugs.webkit.org/show_bug.cgi?id=86959
1604
1605 Reviewed by Oliver Hunt.
1606
1607 Merged r117819 from dfgopt.
1608
1609 * dfg/DFGByteCodeParser.cpp:
1610 (JSC::DFG::ByteCodeParser::parseBlock):
1611 * dfg/DFGCSEPhase.cpp:
1612 (JSC::DFG::CSEPhase::getByOffsetLoadElimination):
1613 * dfg/DFGSpeculativeJIT32_64.cpp:
1614 (JSC::DFG::SpeculativeJIT::compile):
1615 * dfg/DFGSpeculativeJIT64.cpp:
1616 (JSC::DFG::SpeculativeJIT::compile):
1617
fpizlo@apple.com9a548f12012-05-24 05:33:09 +000016182012-05-17 Filip Pizlo <fpizlo@apple.com>
1619
1620 DFG should optimize aliased uses of the Arguments object of the current call frame
1621 https://bugs.webkit.org/show_bug.cgi?id=86552
1622
1623 Reviewed by Geoff Garen.
1624
1625 Merged r117542 and r117543 from dfgopt.
1626
1627 Performs must-alias and escape analysis on uses of CreateArguments, and if
1628 a variable is must-aliased to CreateArguments and does not escape, then we
1629 turn all uses of that variable into direct arguments accesses.
1630
1631 36% speed-up on V8/earley leading to a 2.3% speed-up overall in V8.
1632
1633 * bytecode/CodeBlock.h:
1634 (JSC::CodeBlock::uncheckedArgumentsRegister):
1635 * bytecode/ValueRecovery.h:
1636 (JSC::ValueRecovery::argumentsThatWereNotCreated):
1637 (ValueRecovery):
1638 (JSC::ValueRecovery::dump):
1639 * dfg/DFGAbstractState.cpp:
1640 (JSC::DFG::AbstractState::execute):
1641 * dfg/DFGAdjacencyList.h:
1642 (AdjacencyList):
1643 (JSC::DFG::AdjacencyList::removeEdgeFromBag):
1644 * dfg/DFGArgumentsSimplificationPhase.cpp:
1645 (JSC::DFG::ArgumentsSimplificationPhase::run):
1646 (ArgumentsSimplificationPhase):
1647 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
1648 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUses):
1649 (JSC::DFG::ArgumentsSimplificationPhase::observeProperArgumentsUse):
1650 (JSC::DFG::ArgumentsSimplificationPhase::isOKToOptimize):
1651 (JSC::DFG::ArgumentsSimplificationPhase::removeArgumentsReferencingPhantomChild):
1652 * dfg/DFGAssemblyHelpers.h:
1653 (JSC::DFG::AssemblyHelpers::argumentsRegisterFor):
1654 (AssemblyHelpers):
1655 * dfg/DFGByteCodeParser.cpp:
1656 (JSC::DFG::ByteCodeParser::parseBlock):
1657 * dfg/DFGCFGSimplificationPhase.cpp:
1658 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
1659 * dfg/DFGGPRInfo.h:
1660 (GPRInfo):
1661 * dfg/DFGGraph.cpp:
1662 (JSC::DFG::Graph::collectGarbage):
1663 (DFG):
1664 * dfg/DFGGraph.h:
1665 (Graph):
1666 (JSC::DFG::Graph::executableFor):
1667 (JSC::DFG::Graph::argumentsRegisterFor):
1668 (JSC::DFG::Graph::uncheckedArgumentsRegisterFor):
1669 (JSC::DFG::Graph::clobbersWorld):
1670 * dfg/DFGNode.h:
1671 (JSC::DFG::Node::hasHeapPrediction):
1672 * dfg/DFGNodeType.h:
1673 (DFG):
1674 * dfg/DFGOSRExitCompiler.cpp:
1675 * dfg/DFGOSRExitCompiler.h:
1676 (JSC::DFG::OSRExitCompiler::OSRExitCompiler):
1677 (OSRExitCompiler):
1678 * dfg/DFGOSRExitCompiler32_64.cpp:
1679 (JSC::DFG::OSRExitCompiler::compileExit):
1680 * dfg/DFGOSRExitCompiler64.cpp:
1681 (JSC::DFG::OSRExitCompiler::compileExit):
1682 * dfg/DFGOperations.cpp:
1683 * dfg/DFGPredictionPropagationPhase.cpp:
1684 (JSC::DFG::PredictionPropagationPhase::propagate):
1685 * dfg/DFGSpeculativeJIT.cpp:
1686 (JSC::DFG::ValueSource::dump):
1687 (JSC::DFG::SpeculativeJIT::compile):
1688 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
1689 * dfg/DFGSpeculativeJIT.h:
1690 * dfg/DFGSpeculativeJIT32_64.cpp:
1691 (JSC::DFG::SpeculativeJIT::compile):
1692 * dfg/DFGSpeculativeJIT64.cpp:
1693 (JSC::DFG::SpeculativeJIT::compile):
1694 * dfg/DFGVariableAccessData.h:
1695 (JSC::DFG::VariableAccessData::VariableAccessData):
1696 (JSC::DFG::VariableAccessData::mergeIsArgumentsAlias):
1697 (VariableAccessData):
1698 (JSC::DFG::VariableAccessData::isArgumentsAlias):
1699 * jit/JITOpcodes.cpp:
1700 (JSC::JIT::emitSlow_op_get_argument_by_val):
1701
fpizlo@apple.comdb7ba192012-05-24 02:28:52 +000017022012-05-23 Filip Pizlo <fpizlo@apple.com>
1703
fpizlo@apple.comae3413b2012-05-24 02:34:09 +00001704 DFGCapabilities should not try to get an arguments register from code blocks that don't have one
1705 https://bugs.webkit.org/show_bug.cgi?id=87332
1706
1707 Reviewed by Andy Estes.
1708
1709 * dfg/DFGCapabilities.h:
1710 (JSC::DFG::canInlineOpcode):
1711
17122012-05-23 Filip Pizlo <fpizlo@apple.com>
1713
fpizlo@apple.comdb7ba192012-05-24 02:28:52 +00001714 DFG should have sparse conditional constant propagation
1715 https://bugs.webkit.org/show_bug.cgi?id=86580
1716
1717 Reviewed by Oliver Hunt.
1718
1719 Merged r117370 from dfgopt.
1720
1721 This enhances CFA so that if it suspects at any point during the fixpoint that a
1722 branch will only go one way, then it only propagates in that one way.
1723
1724 This vastly increases the opportunities for CFG simplification. For example, it
1725 enables us to evaporate this loop:
1726
1727 for (var i = 0; i < 1; ++i) doThings(i);
1728
1729 As a result, it uncovered loads of bugs in the CFG simplifier. In particular:
1730
1731 - Phi fixup was assuming that all Phis worth fixing up are shouldGenerate().
1732 That's not true; we also fixup Phis that are dead.
1733
1734 - GetLocal fixup was assuming that it's only necessary to rewire links to a
1735 GetLocal, and that the GetLocal's own links don't need to be rewired. Untrue,
1736 because the GetLocal may not be rewirable (first block has no GetLocal for r42
1737 but second block does have a GetLocal), in which case it will refer to a Phi
1738 in the second block. We need it to refer to a Phi from the first block to
1739 ensure that subsequent transformations work.
1740
1741 - Tail operand fixup was ignoring the fact that Phis in successors may contain
1742 references to the children of our tail variables. Hence, successor Phi child
1743 substitution needs to use the original second block variable table as its
1744 prior, rather than trying to reconstruct the prior later (since by that point
1745 the children of the second block's tail variables will have been fixed up, so
1746 we will not know what the prior would have been).
1747
1748 * dfg/DFGAbstractState.cpp:
1749 (JSC::DFG::AbstractState::beginBasicBlock):
1750 (JSC::DFG::AbstractState::endBasicBlock):
1751 (JSC::DFG::AbstractState::reset):
1752 (JSC::DFG::AbstractState::execute):
1753 (JSC::DFG::AbstractState::mergeToSuccessors):
1754 * dfg/DFGAbstractState.h:
1755 (JSC::DFG::AbstractState::branchDirectionToString):
1756 (AbstractState):
1757 * dfg/DFGCFGSimplificationPhase.cpp:
1758 (JSC::DFG::CFGSimplificationPhase::run):
1759 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
1760 (JSC::DFG::CFGSimplificationPhase::OperandSubstitution::OperandSubstitution):
1761 (OperandSubstitution):
1762 (JSC::DFG::CFGSimplificationPhase::skipGetLocal):
1763 (JSC::DFG::CFGSimplificationPhase::recordPossibleIncomingReference):
1764 (CFGSimplificationPhase):
1765 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
1766 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
1767 * dfg/DFGGraph.h:
1768 (JSC::DFG::Graph::changeEdge):
1769
ojan@chromium.org959e4a22012-05-24 02:03:04 +000017702012-05-23 Ojan Vafai <ojan@chromium.org>
1771
1772 add back the ability to disable flexbox
1773 https://bugs.webkit.org/show_bug.cgi?id=87147
1774
1775 Reviewed by Tony Chang.
1776
1777 * Configurations/FeatureDefines.xcconfig:
1778
fpizlo@apple.com9b928722012-05-24 00:18:55 +000017792012-05-23 Filip Pizlo <fpizlo@apple.com>
1780
fpizlo@apple.com16faaea2012-05-24 01:04:55 +00001781 Unreviewed, fix Windows build.
1782
1783 * bytecode/CodeBlock.h:
1784 * dfg/DFGCapabilities.h:
1785 (JSC::DFG::canCompileOpcode):
1786 (JSC::DFG::canCompileOpcodes):
1787 * dfg/DFGCommon.h:
1788 (DFG):
1789
17902012-05-23 Filip Pizlo <fpizlo@apple.com>
1791
fpizlo@apple.com9b928722012-05-24 00:18:55 +00001792 DFG should optimize inlined uses of arguments.length and arguments[i]
1793 https://bugs.webkit.org/show_bug.cgi?id=86327
1794
1795 Reviewed by Gavin Barraclough.
1796
1797 Merged r117017 from dfgopt.
1798
1799 Turns inlined uses of arguments.length into a constant.
1800
1801 Turns inlined uses of arguments[constant] into a direct reference to the
1802 argument.
1803
1804 Big win on micro-benchmarks. Not yet a win on V8 because the hot uses of
1805 arguments.length and arguments[i] are aliased. I'll leave the aliasing
1806 optimizations to a later patch.
1807
1808 * CMakeLists.txt:
1809 * GNUmakefile.list.am:
1810 * JavaScriptCore.xcodeproj/project.pbxproj:
1811 * Target.pri:
1812 * bytecode/DFGExitProfile.h:
1813 (FrequentExitSite):
1814 (JSC::DFG::FrequentExitSite::FrequentExitSite):
1815 (JSC::DFG::QueryableExitProfile::hasExitSite):
1816 (QueryableExitProfile):
1817 * dfg/DFGAbstractState.cpp:
1818 (JSC::DFG::AbstractState::execute):
1819 * dfg/DFGArgumentsSimplificationPhase.cpp: Added.
1820 (DFG):
1821 (ArgumentsSimplificationPhase):
1822 (JSC::DFG::ArgumentsSimplificationPhase::ArgumentsSimplificationPhase):
1823 (JSC::DFG::ArgumentsSimplificationPhase::run):
1824 (JSC::DFG::performArgumentsSimplification):
1825 * dfg/DFGArgumentsSimplificationPhase.h: Added.
1826 (DFG):
1827 * dfg/DFGAssemblyHelpers.cpp:
1828 (JSC::DFG::AssemblyHelpers::executableFor):
1829 (DFG):
1830 * dfg/DFGAssemblyHelpers.h:
1831 (AssemblyHelpers):
1832 * dfg/DFGByteCodeParser.cpp:
1833 (JSC::DFG::ByteCodeParser::parseBlock):
1834 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
1835 * dfg/DFGCSEPhase.cpp:
1836 (JSC::DFG::CSEPhase::getLocalLoadElimination):
1837 (JSC::DFG::CSEPhase::performNodeCSE):
1838 * dfg/DFGDriver.cpp:
1839 (JSC::DFG::compile):
1840 * dfg/DFGGraph.h:
1841 (JSC::DFG::Graph::Graph):
1842 (JSC::DFG::Graph::executableFor):
1843 (Graph):
1844 (JSC::DFG::Graph::clobbersWorld):
1845 * dfg/DFGNode.h:
1846 (JSC::DFG::Node::convertToConstant):
1847 (JSC::DFG::Node::convertToGetLocalUnlinked):
1848 (Node):
1849 (JSC::DFG::Node::unlinkedLocal):
1850 * dfg/DFGNodeType.h:
1851 (DFG):
1852 * dfg/DFGOSRExit.cpp:
1853 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
1854 * dfg/DFGPredictionPropagationPhase.cpp:
1855 (JSC::DFG::PredictionPropagationPhase::propagate):
1856 * dfg/DFGSpeculativeJIT32_64.cpp:
1857 (JSC::DFG::SpeculativeJIT::compile):
1858 * dfg/DFGSpeculativeJIT64.cpp:
1859 (JSC::DFG::SpeculativeJIT::compile):
1860
fpizlo@apple.com5e3852d2012-05-24 00:05:21 +000018612012-05-13 Filip Pizlo <fpizlo@apple.com>
1862
1863 DFG should be able to optimize foo.apply(bar, arguments)
1864 https://bugs.webkit.org/show_bug.cgi?id=86306
1865
1866 Reviewed by Gavin Barraclough.
1867
1868 Merge r116912 from dfgopt.
1869
1870 Enables compilation of op_jneq_ptr and some forms of op_call_varargs.
1871
1872 Also includes a bunch of bug fixes that were made necessary by the increased
1873 pressure on the CFG simplifier.
1874
1875 This is a 1-2% win on V8.
1876
1877 * bytecode/CodeBlock.cpp:
1878 (JSC::CodeBlock::printCallOp):
1879 (JSC::CodeBlock::CodeBlock):
1880 (JSC::ProgramCodeBlock::canCompileWithDFGInternal):
1881 (JSC::EvalCodeBlock::canCompileWithDFGInternal):
1882 (JSC::FunctionCodeBlock::canCompileWithDFGInternal):
1883 * bytecode/CodeBlock.h:
1884 (CodeBlock):
1885 (JSC::CodeBlock::canCompileWithDFG):
1886 (JSC::CodeBlock::canCompileWithDFGState):
1887 (ProgramCodeBlock):
1888 (EvalCodeBlock):
1889 (FunctionCodeBlock):
1890 * dfg/DFGAbstractState.cpp:
1891 (JSC::DFG::AbstractState::execute):
1892 * dfg/DFGByteCodeParser.cpp:
1893 (JSC::DFG::ByteCodeParser::parseBlock):
1894 (JSC::DFG::ByteCodeParser::processPhiStack):
1895 (JSC::DFG::ByteCodeParser::parse):
1896 * dfg/DFGCFGSimplificationPhase.cpp:
1897 (JSC::DFG::CFGSimplificationPhase::run):
1898 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
1899 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
1900 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
1901 * dfg/DFGCSEPhase.cpp:
1902 (JSC::DFG::CSEPhase::getLocalLoadElimination):
1903 (CSEPhase):
1904 (JSC::DFG::CSEPhase::setReplacement):
1905 (JSC::DFG::CSEPhase::performNodeCSE):
1906 * dfg/DFGCapabilities.cpp:
1907 (JSC::DFG::debugFail):
1908 (DFG):
1909 (JSC::DFG::canHandleOpcodes):
1910 (JSC::DFG::canCompileOpcodes):
1911 (JSC::DFG::canInlineOpcodes):
1912 * dfg/DFGCapabilities.h:
1913 (JSC::DFG::canCompileOpcode):
1914 (JSC::DFG::canInlineOpcode):
1915 (DFG):
1916 (JSC::DFG::canCompileOpcodes):
1917 (JSC::DFG::canCompileEval):
1918 (JSC::DFG::canCompileProgram):
1919 (JSC::DFG::canCompileFunctionForCall):
1920 (JSC::DFG::canCompileFunctionForConstruct):
1921 * dfg/DFGCommon.h:
1922 * dfg/DFGGraph.cpp:
1923 (JSC::DFG::Graph::dump):
1924 * dfg/DFGNodeType.h:
1925 (DFG):
1926 * dfg/DFGPredictionPropagationPhase.cpp:
1927 (JSC::DFG::PredictionPropagationPhase::propagate):
1928 * dfg/DFGSpeculativeJIT32_64.cpp:
1929 (JSC::DFG::SpeculativeJIT::compile):
1930 * dfg/DFGSpeculativeJIT64.cpp:
1931 (JSC::DFG::SpeculativeJIT::emitCall):
1932 (JSC::DFG::SpeculativeJIT::compile):
1933 * dfg/DFGValidate.cpp:
1934 (Validate):
1935 (JSC::DFG::Validate::validate):
1936 (JSC::DFG::Validate::checkOperand):
1937 (JSC::DFG::Validate::reportValidationContext):
1938 * jit/JIT.cpp:
1939 (JSC::JIT::emitOptimizationCheck):
1940 (JSC::JIT::privateCompileSlowCases):
1941 (JSC::JIT::privateCompile):
1942 * jit/JIT.h:
1943 * jit/JITArithmetic.cpp:
1944 (JSC::JIT::compileBinaryArithOp):
1945 * jit/JITPropertyAccess.cpp:
1946 (JSC::JIT::privateCompilePutByIdTransition):
1947 * jit/JITPropertyAccess32_64.cpp:
1948 (JSC::JIT::privateCompilePutByIdTransition):
1949 * tools/CodeProfile.cpp:
1950 (JSC::CodeProfile::sample):
1951
ggaren@apple.com7070d422012-05-23 23:55:27 +000019522012-05-23 Geoffrey Garen <ggaren@apple.com>
1953
1954 Refactored WeakBlock to use malloc, clarify behavior
1955 https://bugs.webkit.org/show_bug.cgi?id=87318
1956
1957 Reviewed by Filip Pizlo.
1958
1959 We want to use malloc so we can make these smaller than 4KB,
1960 since an individual MarkedBlock will usually have fewer than
1961 4KB worth of weak pointers.
1962
1963 * heap/Heap.cpp:
1964 (JSC::Heap::markRoots): Renamed visitLiveWeakImpls to visit, since
1965 we no longer need to distinguish from "visitDeadWeakImpls".
1966
1967 Renamed "visitDeadWeakImpls" to "reap" because we're not actually
1968 doing any visiting -- we're just tagging things as dead.
1969
1970 * heap/WeakBlock.cpp:
1971 (JSC::WeakBlock::create):
1972 (JSC::WeakBlock::destroy):
1973 (JSC::WeakBlock::WeakBlock): Malloc!
1974
1975 (JSC::WeakBlock::visit):
1976 (JSC::WeakBlock::reap): Renamed as above.
1977
1978 * heap/WeakBlock.h:
1979 (WeakBlock): Reduced to 3KB, as explained above.
1980
1981 * heap/WeakSet.cpp:
1982 (JSC::WeakSet::visit):
1983 (JSC::WeakSet::reap):
1984 * heap/WeakSet.h:
1985 (WeakSet): Updated for renames, and to match WebKit style.
1986
fpizlo@apple.com11e2f372012-05-23 22:25:21 +000019872012-05-23 Filip Pizlo <fpizlo@apple.com>
1988
fpizlo@apple.combc96e8f2012-05-23 23:12:59 +00001989 Use after free in JSC::DFG::ByteCodeParser::processPhiStack
1990 https://bugs.webkit.org/show_bug.cgi?id=87312
1991 <rdar://problem/11518848>
1992
1993 Reviewed by Oliver Hunt.
1994
1995 * dfg/DFGByteCodeParser.cpp:
1996 (JSC::DFG::ByteCodeParser::processPhiStack):
1997 (JSC::DFG::ByteCodeParser::parse):
1998
19992012-05-23 Filip Pizlo <fpizlo@apple.com>
2000
fpizlo@apple.com11e2f372012-05-23 22:25:21 +00002001 It should be possible to make C function calls from DFG code on ARM in debug mode
2002 https://bugs.webkit.org/show_bug.cgi?id=87313
2003
2004 Reviewed by Gavin Barraclough.
2005
2006 * dfg/DFGSpeculativeJIT.h:
2007 (SpeculativeJIT):
2008
fpizlo@apple.comc6446112012-05-23 20:52:42 +000020092012-05-11 Filip Pizlo <fpizlo@apple.com>
2010
2011 DFG should be able to inline functions that use arguments reflectively
2012 https://bugs.webkit.org/show_bug.cgi?id=86132
2013
2014 Reviewed by Oliver Hunt.
2015
2016 Merged r116838 from dfgopt.
2017
2018 This turns on inlining of functions that use arguments reflectively, but it
2019 does not do any of the obvious optimizations that this exposes. I'll save that
2020 for another patch - the important thing for now is that this contains all of
2021 the plumbing necessary to make this kind of inlining sound even in bizarro
2022 cases like an inline callee escaping the arguments object to parts of the
2023 inline caller where the arguments are otherwise dead. Or even more fun cases
2024 like where you've inlined to an inline stack that is three-deep, and the
2025 function on top of the inline stack reflectively accesses the arguments of a
2026 function that is in the middle of the inline stack. Any subsequent
2027 optimizations that we do for the obvious cases of arguments usage in inline
2028 functions will have to take care not to break the baseline functionality that
2029 this patch plumbs together.
2030
2031 * bytecode/CodeBlock.cpp:
2032 (JSC::CodeBlock::printCallOp):
2033 (JSC::CodeBlock::dump):
2034 * bytecode/CodeBlock.h:
2035 * dfg/DFGAssemblyHelpers.h:
2036 (JSC::DFG::AssemblyHelpers::argumentsRegisterFor):
2037 (AssemblyHelpers):
2038 * dfg/DFGByteCodeParser.cpp:
2039 (InlineStackEntry):
2040 (JSC::DFG::ByteCodeParser::handleCall):
2041 (JSC::DFG::ByteCodeParser::handleInlining):
2042 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
2043 (JSC::DFG::ByteCodeParser::parse):
2044 * dfg/DFGCCallHelpers.h:
2045 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
2046 (CCallHelpers):
2047 * dfg/DFGCapabilities.h:
2048 (JSC::DFG::canInlineOpcode):
2049 * dfg/DFGDriver.cpp:
2050 (JSC::DFG::compile):
2051 * dfg/DFGFixupPhase.cpp:
2052 (JSC::DFG::FixupPhase::fixupNode):
2053 * dfg/DFGOperations.cpp:
2054 * dfg/DFGOperations.h:
2055 * dfg/DFGSpeculativeJIT.h:
2056 (JSC::DFG::SpeculativeJIT::callOperation):
2057 * dfg/DFGSpeculativeJIT32_64.cpp:
2058 (JSC::DFG::SpeculativeJIT::compile):
2059 * dfg/DFGSpeculativeJIT64.cpp:
2060 (JSC::DFG::SpeculativeJIT::compile):
2061 * interpreter/CallFrame.cpp:
2062 (JSC):
2063 (JSC::CallFrame::someCodeBlockForPossiblyInlinedCode):
2064 * interpreter/CallFrame.h:
2065 (ExecState):
2066 (JSC::ExecState::someCodeBlockForPossiblyInlinedCode):
2067 * interpreter/Interpreter.cpp:
2068 (JSC::Interpreter::retrieveArgumentsFromVMCode):
2069 * runtime/Arguments.cpp:
2070 (JSC::Arguments::tearOff):
2071 (JSC):
2072 (JSC::Arguments::tearOffForInlineCallFrame):
2073 * runtime/Arguments.h:
2074 (Arguments):
2075 (JSC::Arguments::create):
2076 (JSC::Arguments::finishCreation):
2077 (JSC):
2078
fpizlo@apple.comfe244b02012-05-23 20:51:21 +000020792012-05-23 Filip Pizlo <fpizlo@apple.com>
2080
2081 Every OSR exit on ARM results in a crash
2082 https://bugs.webkit.org/show_bug.cgi?id=87307
2083
2084 Reviewed by Geoffrey Garen.
2085
2086 * dfg/DFGThunks.cpp:
2087 (JSC::DFG::osrExitGenerationThunkGenerator):
2088
ggaren@apple.com96fa0e72012-05-23 20:47:46 +000020892012-05-23 Geoffrey Garen <ggaren@apple.com>
2090
2091 Refactored heap tear-down to use normal value semantics (i.e., destructors)
2092 https://bugs.webkit.org/show_bug.cgi?id=87302
2093
2094 Reviewed by Oliver Hunt.
2095
2096 This is a step toward incremental DOM finalization.
2097
2098 * heap/CopiedSpace.cpp:
2099 (JSC::CopiedSpace::~CopiedSpace):
2100 * heap/CopiedSpace.h:
2101 (CopiedSpace): Just use our destructor, instead of relying on the heap
2102 to send us a special message at a special time.
2103
2104 * heap/Heap.cpp:
2105 (JSC::Heap::Heap): Use OwnPtr for m_markListSet because this is not Sparta.
2106
2107 (JSC::Heap::~Heap): No need for delete or freeAllBlocks because normal
2108 destructors do this work automatically now.
2109
2110 (JSC::Heap::lastChanceToFinalize): Just call lastChanceToFinalize on our
2111 sub-objects, and assume it does the right thing. This improves encapsulation,
2112 so we can add items requiring finalization to our sub-objects.
2113
2114 * heap/Heap.h: Moved m_blockAllocator to get the right destruction order.
2115
2116 * heap/MarkedSpace.cpp:
2117 (Take):
2118 (JSC):
2119 (JSC::Take::Take):
2120 (JSC::Take::operator()):
2121 (JSC::Take::returnValue): Moved to the top of the file so it can be used
2122 in another function.
2123
2124 (JSC::MarkedSpace::~MarkedSpace): Delete all outstanding memory, like a good
2125 destructor should.
2126
2127 (JSC::MarkedSpace::lastChanceToFinalize): Moved some code here from the heap,
2128 since it pertains to our internal implementation details.
2129
2130 * heap/MarkedSpace.h:
2131 (MarkedSpace):
2132 * heap/WeakBlock.cpp:
2133 (JSC::WeakBlock::lastChanceToFinalize):
2134 * heap/WeakBlock.h:
2135 (WeakBlock):
2136 * heap/WeakSet.cpp:
2137 (JSC::WeakSet::lastChanceToFinalize):
2138 * heap/WeakSet.h:
2139 (WeakSet): Stop using a special freeAllBlocks() callback and just implement
2140 lastChanceToFinalize.
2141
ggaren@apple.comd6376d22012-05-23 18:29:55 +000021422011-05-22 Geoffrey Garen <ggaren@apple.com>
2143
2144 Encapsulated some calculations for whether portions of the heap are empty
2145 https://bugs.webkit.org/show_bug.cgi?id=87210
2146
2147 Reviewed by Gavin Barraclough.
2148
2149 This is a step toward incremental DOM finalization.
2150
2151 * heap/Heap.cpp:
2152 (JSC::Heap::~Heap): Explicitly call freeAllBlocks() instead of relying
2153 implicitly on all blocks thinking they're empty. In future, we may
2154 choose to tear down the heap without first setting all data structures
2155 to "empty".
2156
2157 * heap/MarkedBlock.h:
2158 (JSC::MarkedBlock::isEmpty):
2159 (JSC::MarkedBlock::gatherDirtyCells): Renamed markCountIsZero to isEmpty,
2160 in preparation for making it check for outstanding finalizers in addition
2161 to marked cells.
2162
2163 * heap/MarkedSpace.cpp:
2164 (Take):
2165 (JSC::Take::Take):
2166 (JSC::Take::operator()):
2167 (JSC::Take::returnValue):
2168 (JSC::MarkedSpace::shrink):
2169 (JSC::MarkedSpace::freeAllBlocks): Refactored the "Take" functor to support
2170 a conditional isEmpty check, so it dould be shared by shrink() and freeAllBlocks().
2171
2172 * heap/WeakBlock.cpp:
2173 (JSC::WeakBlock::WeakBlock):
2174 (JSC::WeakBlock::visitLiveWeakImpls):
2175 (JSC::WeakBlock::visitDeadWeakImpls):
2176 * heap/WeakBlock.h:
2177 (WeakBlock):
2178 (JSC::WeakBlock::isEmpty):
2179 * heap/WeakSet.cpp:
2180 (JSC::WeakSet::sweep):
2181 (JSC::WeakSet::shrink): Use isEmpty(), in preparation for changes in
2182 its implementation.
2183
vestbo@webkit.orgb1f6e922012-05-23 10:50:53 +000021842012-05-23 Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2185
2186 [Qt] Remove references to $$QT_SOURCE_TREE
2187
2188 With a modularized Qt, it's ambigious. What we really want is qtbase,
2189 which qtcore is a proxy for (we assume it will always live in qtbase).
2190
2191 Reviewed by Tor Arne Vestbø.
2192
2193 * JavaScriptCore.pri:
2194 * Target.pri:
2195
fpizlo@apple.comb6b454cd2012-05-23 07:53:44 +000021962012-05-09 Filip Pizlo <fpizlo@apple.com>
2197
2198 DFG should allow inlining in case of certain arity mismatches
2199 https://bugs.webkit.org/show_bug.cgi?id=86059
2200
2201 Reviewed by Geoff Garen.
fpizlo@apple.comb92907c2012-05-23 07:55:12 +00002202
2203 Merge r116620 from dfgopt.
fpizlo@apple.comb6b454cd2012-05-23 07:53:44 +00002204
2205 * dfg/DFGByteCodeParser.cpp:
2206 (JSC::DFG::ByteCodeParser::handleInlining):
2207
fpizlo@apple.com6d4456e2012-05-23 03:48:52 +000022082012-05-08 Filip Pizlo <fpizlo@apple.com>
2209
fpizlo@apple.com1688cc12012-05-23 07:29:02 +00002210 DFG variable capture analysis should work even if the variables arose through inlining
2211 https://bugs.webkit.org/show_bug.cgi?id=85945
2212
2213 Reviewed by Oliver Hunt.
2214
2215 Merged r116555 from dfgopt.
2216
2217 This just changes how the DFG queries whether a variable is captured. It does not
2218 change any user-visible behavior.
2219
2220 As part of this change, I further solidified the policy that the CFA behaves in an
2221 undefined way for captured locals and queries about their values will not yield
2222 reliable results. This will likely be changed in the future, but for now it makes
2223 sense.
2224
2225 One fun part about this change is that it recognizes that the same variable may
2226 be both captured and not, at the same time, because their live interval spans
2227 inlining boundaries. This only happens in the case of arguments to functions that
2228 capture their arguments, and this change treats them with just the right touch of
2229 conservatism: they will be treated as if captured by the caller as well as the
2230 callee.
2231
2232 Finally, this also adds captured variable reasoning to the InlineCallFrame, which
2233 I thought might be useful for later tooling.
2234
2235 This is perf-neutral, since it does it does not make the DFG take advantage of this
2236 new functionality in any way. In particular, it is still the case that the DFG will
2237 not inline functions that use arguments reflectively or that create activations.
2238
2239 * bytecode/CodeBlock.h:
2240 (CodeBlock):
2241 (JSC::CodeBlock::needsActivation):
2242 (JSC::CodeBlock::argumentIsCaptured):
2243 (JSC::CodeBlock::localIsCaptured):
2244 (JSC::CodeBlock::isCaptured):
2245 * bytecode/CodeOrigin.h:
2246 (InlineCallFrame):
2247 * dfg/DFGAbstractState.cpp:
2248 (JSC::DFG::AbstractState::initialize):
2249 (JSC::DFG::AbstractState::endBasicBlock):
2250 (JSC::DFG::AbstractState::execute):
2251 (JSC::DFG::AbstractState::merge):
2252 * dfg/DFGByteCodeParser.cpp:
2253 (JSC::DFG::ByteCodeParser::newVariableAccessData):
2254 (JSC::DFG::ByteCodeParser::getLocal):
2255 (JSC::DFG::ByteCodeParser::setLocal):
2256 (JSC::DFG::ByteCodeParser::getArgument):
2257 (JSC::DFG::ByteCodeParser::setArgument):
2258 (JSC::DFG::ByteCodeParser::flushArgument):
2259 (JSC::DFG::ByteCodeParser::parseBlock):
2260 (JSC::DFG::ByteCodeParser::processPhiStack):
2261 (JSC::DFG::ByteCodeParser::fixVariableAccessPredictions):
2262 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
2263 * dfg/DFGCFGSimplificationPhase.cpp:
2264 (CFGSimplificationPhase):
2265 (JSC::DFG::CFGSimplificationPhase::keepOperandAlive):
2266 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
2267 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
2268 * dfg/DFGCommon.h:
2269 * dfg/DFGFixupPhase.cpp:
2270 (JSC::DFG::FixupPhase::fixupNode):
2271 * dfg/DFGGraph.cpp:
2272 (JSC::DFG::Graph::nameOfVariableAccessData):
2273 * dfg/DFGGraph.h:
2274 (JSC::DFG::Graph::needsActivation):
2275 (JSC::DFG::Graph::usesArguments):
2276 * dfg/DFGPredictionPropagationPhase.cpp:
2277 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):
2278 * dfg/DFGSpeculativeJIT.cpp:
2279 (JSC::DFG::SpeculativeJIT::compile):
2280 * dfg/DFGSpeculativeJIT32_64.cpp:
2281 (JSC::DFG::SpeculativeJIT::compile):
2282 * dfg/DFGSpeculativeJIT64.cpp:
2283 (JSC::DFG::SpeculativeJIT::compile):
2284 * dfg/DFGVariableAccessData.h:
2285 (JSC::DFG::VariableAccessData::VariableAccessData):
2286 (JSC::DFG::VariableAccessData::mergeIsCaptured):
2287 (VariableAccessData):
2288 (JSC::DFG::VariableAccessData::isCaptured):
2289
22902012-05-08 Filip Pizlo <fpizlo@apple.com>
2291
fpizlo@apple.com6d4456e2012-05-23 03:48:52 +00002292 DFG should support op_get_argument_by_val and op_get_arguments_length
2293 https://bugs.webkit.org/show_bug.cgi?id=85911
2294
2295 Reviewed by Oliver Hunt.
2296
2297 Merged r116467 from dfgopt.
2298
2299 This adds a simple and relatively conservative implementation of op_get_argument_by_val
2300 and op_get_arguments_length. We can optimize these later. For now it's great to have
2301 the additional coverage.
2302
2303 This patch appears to be perf-neutral.
2304
2305 * dfg/DFGAbstractState.cpp:
2306 (JSC::DFG::AbstractState::execute):
2307 * dfg/DFGAssemblyHelpers.h:
2308 (JSC::DFG::AssemblyHelpers::addressFor):
2309 (JSC::DFG::AssemblyHelpers::tagFor):
2310 (JSC::DFG::AssemblyHelpers::payloadFor):
2311 * dfg/DFGByteCodeParser.cpp:
2312 (JSC::DFG::ByteCodeParser::parseBlock):
2313 * dfg/DFGCapabilities.h:
2314 (JSC::DFG::canCompileOpcode):
2315 (JSC::DFG::canInlineOpcode):
2316 * dfg/DFGNode.h:
2317 (JSC::DFG::Node::hasHeapPrediction):
2318 * dfg/DFGNodeType.h:
2319 (DFG):
2320 * dfg/DFGOperations.cpp:
2321 * dfg/DFGOperations.h:
2322 * dfg/DFGPredictionPropagationPhase.cpp:
2323 (JSC::DFG::PredictionPropagationPhase::propagate):
2324 * dfg/DFGSpeculativeJIT.h:
2325 (JSC::DFG::SpeculativeJIT::callOperation):
2326 (SpeculativeJIT):
2327 * dfg/DFGSpeculativeJIT32_64.cpp:
2328 (JSC::DFG::SpeculativeJIT::compile):
2329 * dfg/DFGSpeculativeJIT64.cpp:
2330 (JSC::DFG::SpeculativeJIT::compile):
2331 * jit/JITOpcodes.cpp:
2332 (JSC::JIT::emit_op_get_argument_by_val):
2333 * jit/JITOpcodes32_64.cpp:
2334 (JSC::JIT::emit_op_get_argument_by_val):
2335 * llint/LowLevelInterpreter32_64.asm:
2336 * llint/LowLevelInterpreter64.asm:
2337
fpizlo@apple.com15c03c72012-05-23 02:34:13 +000023382012-05-07 Filip Pizlo <fpizlo@apple.com>
2339
2340 DFG should support op_tear_off_arguments
2341 https://bugs.webkit.org/show_bug.cgi?id=85847
2342
2343 Reviewed by Michael Saboff.
2344
2345 Merged r116378 from dfgopt.
2346
2347 * dfg/DFGAbstractState.cpp:
2348 (JSC::DFG::AbstractState::execute):
2349 * dfg/DFGByteCodeParser.cpp:
2350 (JSC::DFG::ByteCodeParser::parseBlock):
2351 * dfg/DFGCapabilities.h:
2352 (JSC::DFG::canCompileOpcode):
2353 (JSC::DFG::canInlineOpcode):
2354 * dfg/DFGNodeType.h:
2355 (DFG):
2356 * dfg/DFGOperations.cpp:
2357 * dfg/DFGOperations.h:
2358 * dfg/DFGPredictionPropagationPhase.cpp:
2359 (JSC::DFG::PredictionPropagationPhase::propagate):
2360 * dfg/DFGSpeculativeJIT.h:
2361 (SpeculativeJIT):
2362 (JSC::DFG::SpeculativeJIT::callOperation):
2363 * dfg/DFGSpeculativeJIT32_64.cpp:
2364 (JSC::DFG::SpeculativeJIT::compile):
2365 * dfg/DFGSpeculativeJIT64.cpp:
2366 (JSC::DFG::SpeculativeJIT::compile):
2367
mhahnenberg@apple.com3041bc12012-05-23 01:28:03 +000023682012-05-22 Mark Hahnenberg <mhahnenberg@apple.com>
2369
2370 CopiedSpace::contains doesn't check for oversize blocks
2371 https://bugs.webkit.org/show_bug.cgi?id=87180
2372
2373 Reviewed by Geoffrey Garen.
2374
2375 When doing a conservative scan we use CopiedSpace::contains to determine if a particular
2376 address points into the CopiedSpace. Currently contains() only checks if the address
2377 points to a block in to-space, which means that pointers to oversize blocks may not get scanned.
2378
2379 * heap/CopiedSpace.cpp:
2380 (JSC::CopiedSpace::tryAllocateOversize):
2381 (JSC::CopiedSpace::tryReallocateOversize):
2382 (JSC::CopiedSpace::doneFillingBlock):
2383 (JSC::CopiedSpace::doneCopying):
2384 * heap/CopiedSpace.h: Refactored CopiedSpace so that all blocks (oversize and to-space) are
2385 in a single hash set and bloom filter for membership testing.
2386 (CopiedSpace):
2387 * heap/CopiedSpaceInlineMethods.h:
2388 (JSC::CopiedSpace::contains): We check for the normal block first. Since the oversize blocks are
2389 only page aligned, rather than block aligned, we have to re-mask the ptr to check if it's in
2390 CopiedSpace. Also added a helper function of the same name that takes a CopiedBlock* and checks
2391 if it's in CopiedSpace so that check isn't typed out twice.
2392 (JSC):
2393 (JSC::CopiedSpace::startedCopying):
2394 (JSC::CopiedSpace::addNewBlock):
2395
ggaren@apple.coma68a6502012-05-22 23:59:51 +000023962012-05-22 Geoffrey Garen <ggaren@apple.com>
2397
2398 CopiedBlock and MarkedBlock should have proper value semantics (i.e., destructors)
2399 https://bugs.webkit.org/show_bug.cgi?id=87172
2400
2401 Reviewed by Oliver Hunt and Phil Pizlo.
2402
2403 This enables MarkedBlock to own non-trivial sub-objects that require
2404 destruction. It also fixes a FIXME about casting a CopiedBlock to a
2405 MarkedBlock at destroy time.
2406
2407 CopiedBlock and MarkedBlock now accept an allocation chunk at create
2408 time and return it at destroy time. Their client is expected to
2409 allocate, recycle, and destroy these chunks.
2410
2411 * heap/BlockAllocator.cpp:
2412 (JSC::BlockAllocator::releaseFreeBlocks):
2413 (JSC::BlockAllocator::blockFreeingThreadMain): Don't call MarkedBlock::destroy
2414 because we expect that to be called before a block is put on our free
2415 list now. Do manually deallocate our allocation chunk because that's
2416 our job now.
2417
2418 * heap/BlockAllocator.h:
2419 (BlockAllocator):
2420 (JSC::BlockAllocator::allocate): Allocate never fails now. This is a
2421 cleaner abstraction because only one object does all the VM allocation
2422 and deallocation. Caching is an implementation detail.
2423
2424 (JSC::BlockAllocator::deallocate): We take an allocation chunk argument
2425 instead of a block because we now expect the block to have been destroyed
2426 before we recycle its memory. For convenience, we still use the HeapBlock
2427 class as our linked list node. This is OK because HeapBlock is a POD type.
2428
2429 * heap/CopiedBlock.h:
2430 (CopiedBlock):
2431 (JSC::CopiedBlock::create):
2432 (JSC::CopiedBlock::destroy):
2433 (JSC::CopiedBlock::CopiedBlock): Added proper create and destroy functions,
2434 to match MarkedBlock.
2435
2436 * heap/CopiedSpace.cpp:
2437 (JSC::CopiedSpace::tryAllocateOversize):
2438 (JSC::CopiedSpace::tryReallocateOversize):
2439 (JSC::CopiedSpace::doneCopying):
2440 (JSC::CopiedSpace::getFreshBlock):
2441 (JSC::CopiedSpace::freeAllBlocks):
2442 * heap/CopiedSpaceInlineMethods.h:
2443 (JSC::CopiedSpace::recycleBlock): Make sure to call destroy before
2444 returning a block to the BlockAllocator. Otherwise, our destructors
2445 won't run. (If we get this wrong now, we'll get a compile error.)
2446
2447 * heap/HeapBlock.h:
2448 (JSC::HeapBlock::HeapBlock): const!
2449
2450 * heap/MarkedAllocator.cpp:
2451 (JSC::MarkedAllocator::allocateBlock): No need to distinguish between
2452 create and recycle -- MarkedBlock always accepts memory allocated by
2453 its client now.
2454
2455 * heap/MarkedBlock.cpp:
2456 (JSC::MarkedBlock::create): Don't allocate memory -- we assume that we're
2457 passed already-allocated memory, to clarify the responsibility for VM
2458 recycling.
2459
2460 (JSC::MarkedBlock::destroy): Do run our destructor before giving back
2461 our VM -- that is the whole point of this patch.
2462
2463 (JSC::MarkedBlock::MarkedBlock):
2464 * heap/MarkedBlock.h:
2465 (MarkedBlock):
2466 * heap/MarkedSpace.cpp: const!
2467
2468 (JSC::MarkedSpace::freeBlocks): Make sure to call destroy before
2469 returning a block to the BlockAllocator. Otherwise, our destructors
2470 won't run. (If we get this wrong now, we'll get a compile error.)
2471
simon.fraser@apple.com9bd2c702012-05-22 20:37:14 +00002472== Rolled over to ChangeLog-2012-05-22 ==