blob: fe1f397bca8c3b9fee02028d7d3c9fdab327c700 [file] [log] [blame]
fpizlo@apple.com41a1f0e2012-06-26 02:53:39 +000012012-06-25 Filip Pizlo <fpizlo@apple.com>
2
3 JSC should try to make profiling deterministic because otherwise reproducing failures is
4 nearly impossible
5 https://bugs.webkit.org/show_bug.cgi?id=89940
6
7 Rubber stamped by Gavin Barraclough.
8
9 This rolls out the part of http://trac.webkit.org/changeset/121215 that introduced randomness
10 into the system. Now, instead of randomizing the tier-up threshold, we always set it to an
11 artificially low (and statically predetermined!) value. This gives most of the benefit of
12 threshold randomization without actually making the system behave completely differently on
13 each invocation.
14
15 * bytecode/ExecutionCounter.cpp:
16 (JSC::ExecutionCounter::setThreshold):
17 * runtime/Options.cpp:
18 (Options):
19 (JSC::Options::initializeOptions):
20 * runtime/Options.h:
21 (Options):
22
fpizlo@apple.com3745dbc2012-06-26 02:14:07 +0000232012-06-22 Filip Pizlo <fpizlo@apple.com>
24
25 Value profiling should use tier-up threshold randomization to get more coverage
26 https://bugs.webkit.org/show_bug.cgi?id=89802
27
28 Reviewed by Gavin Barraclough.
29
30 This patch causes both LLInt and Baseline JIT code to take the OSR slow path several
31 times before actually doing OSR. If we take the OSR slow path before the execution
32 count threshold is reached, then we just call CodeBlock::updateAllPredictions() to
33 compute the current latest least-upper-bound SpecType of all values seen in each
34 ValueProfile.
35
36 * bytecode/CodeBlock.cpp:
37 (JSC::CodeBlock::stronglyVisitStrongReferences):
38 (JSC::CodeBlock::updateAllPredictionsAndCountLiveness):
39 (JSC):
40 (JSC::CodeBlock::updateAllPredictions):
41 (JSC::CodeBlock::shouldOptimizeNow):
42 * bytecode/CodeBlock.h:
43 (JSC::CodeBlock::llintExecuteCounter):
44 (JSC::CodeBlock::jitExecuteCounter):
45 (CodeBlock):
46 (JSC::CodeBlock::updateAllPredictions):
47 * bytecode/ExecutionCounter.cpp:
48 (JSC::ExecutionCounter::setThreshold):
49 (JSC::ExecutionCounter::status):
50 (JSC):
51 * bytecode/ExecutionCounter.h:
52 (JSC::ExecutionCounter::count):
53 (ExecutionCounter):
54 * dfg/DFGAbstractState.cpp:
55 (JSC::DFG::AbstractState::execute):
56 * dfg/DFGOperations.cpp:
57 * dfg/DFGSpeculativeJIT.cpp:
58 (JSC::DFG::SpeculativeJIT::compile):
59 * jit/JITStubs.cpp:
60 (JSC::DEFINE_STUB_FUNCTION):
61 * llint/LLIntSlowPaths.cpp:
62 (JSC::LLInt::jitCompileAndSetHeuristics):
63 (JSC::LLInt::entryOSR):
64 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
65 * runtime/JSGlobalObject.cpp:
66 (JSC::JSGlobalObject::JSGlobalObject):
67 (JSC):
68 * runtime/JSGlobalObject.h:
69 (JSGlobalObject):
70 (JSC::JSGlobalObject::weakRandomInteger):
71 * runtime/Options.cpp:
72 (Options):
73 (JSC::Options::initializeOptions):
74 * runtime/Options.h:
75 (Options):
76 * runtime/WeakRandom.h:
77 (WeakRandom):
78 (JSC::WeakRandom::seedUnsafe):
79
commit-queue@webkit.orgd3790912012-06-26 00:08:19 +0000802012-06-25 Yong Li <yoli@rim.com>
81
82 [BlackBerry] Add JSC statistics into about:memory
83 https://bugs.webkit.org/show_bug.cgi?id=89779
84
85 Reviewed by Rob Buis.
86
87 Add MemoryStatistics.cpp into build, and fill JITBytes for BlackBerry port.
88
89 * PlatformBlackBerry.cmake:
90 * runtime/MemoryStatistics.cpp:
91 (JSC::globalMemoryStatistics):
92
zandobersek@gmail.coma6460e12012-06-23 13:41:40 +0000932012-06-23 Sheriff Bot <webkit.review.bot@gmail.com>
94
95 Unreviewed, rolling out r121058.
96 http://trac.webkit.org/changeset/121058
97 https://bugs.webkit.org/show_bug.cgi?id=89809
98
99 Patch causes plugins tests to crash in GTK debug builds
100 (Requested by zdobersek on #webkit).
101
102 * API/APIShims.h:
103 (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
104 (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
105 (APIEntryShimWithoutLock):
106 (JSC::APIEntryShim::APIEntryShim):
107 (APIEntryShim):
108 (JSC::APICallbackShim::~APICallbackShim):
109 * API/JSContextRef.cpp:
110 (JSGlobalContextCreate):
111 (JSGlobalContextCreateInGroup):
112 (JSGlobalContextRelease):
113 (JSContextCreateBacktrace):
114 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
115 * heap/CopiedSpace.cpp:
116 (JSC::CopiedSpace::tryAllocateSlowCase):
117 * heap/Heap.cpp:
118 (JSC::Heap::protect):
119 (JSC::Heap::unprotect):
120 (JSC::Heap::collect):
121 (JSC::Heap::setActivityCallback):
122 (JSC::Heap::activityCallback):
123 (JSC::Heap::sweeper):
124 * heap/Heap.h:
125 (Heap):
126 * heap/HeapTimer.cpp:
127 (JSC::HeapTimer::~HeapTimer):
128 (JSC::HeapTimer::invalidate):
129 (JSC::HeapTimer::timerDidFire):
130 (JSC):
131 * heap/HeapTimer.h:
132 (HeapTimer):
133 * heap/IncrementalSweeper.cpp:
134 (JSC::IncrementalSweeper::doWork):
135 (JSC::IncrementalSweeper::create):
136 * heap/IncrementalSweeper.h:
137 (IncrementalSweeper):
138 * heap/MarkedAllocator.cpp:
139 (JSC::MarkedAllocator::allocateSlowCase):
140 * heap/WeakBlock.cpp:
141 (JSC::WeakBlock::reap):
142 * jsc.cpp:
143 (functionGC):
144 (functionReleaseExecutableMemory):
145 (jscmain):
146 * runtime/Completion.cpp:
147 (JSC::checkSyntax):
148 (JSC::evaluate):
149 * runtime/GCActivityCallback.h:
150 (DefaultGCActivityCallback):
151 (JSC::DefaultGCActivityCallback::create):
152 * runtime/JSGlobalData.cpp:
153 (JSC::JSGlobalData::JSGlobalData):
154 (JSC::JSGlobalData::~JSGlobalData):
155 (JSC::JSGlobalData::sharedInstance):
156 (JSC::JSGlobalData::sharedInstanceInternal):
157 * runtime/JSGlobalData.h:
158 (JSGlobalData):
159 * runtime/JSGlobalObject.cpp:
160 (JSC::JSGlobalObject::~JSGlobalObject):
161 (JSC::JSGlobalObject::init):
162 * runtime/JSLock.cpp:
163 (JSC):
164 (JSC::createJSLockCount):
165 (JSC::JSLock::lockCount):
166 (JSC::setLockCount):
167 (JSC::JSLock::JSLock):
168 (JSC::JSLock::lock):
169 (JSC::JSLock::unlock):
170 (JSC::JSLock::currentThreadIsHoldingLock):
171 (JSC::JSLock::DropAllLocks::DropAllLocks):
172 (JSC::JSLock::DropAllLocks::~DropAllLocks):
173 * runtime/JSLock.h:
174 (JSC):
175 (JSLock):
176 (JSC::JSLock::JSLock):
177 (JSC::JSLock::~JSLock):
178 (DropAllLocks):
179 * runtime/WeakGCMap.h:
180 (JSC::WeakGCMap::set):
181 * testRegExp.cpp:
182 (realMain):
183
achicu@adobe.comcead7612012-06-23 01:23:48 +00001842012-06-22 Alexandru Chiculita <achicu@adobe.com>
185
186 [CSS Shaders] Re-enable the CSS Shaders compile time flag on Safari Mac
187 https://bugs.webkit.org/show_bug.cgi?id=89781
188
189 Reviewed by Dean Jackson.
190
191 Added ENABLE_CSS_SHADERS flag as enabled by default on Safari for Mac.
192
193 * Configurations/FeatureDefines.xcconfig:
194
fpizlo@apple.com16e2cbf2012-06-22 23:32:59 +00001952012-06-22 Filip Pizlo <fpizlo@apple.com>
196
197 DFG tier-up should happen in prologues, not epilogues
198 https://bugs.webkit.org/show_bug.cgi?id=89752
199
200 Reviewed by Geoffrey Garen.
201
202 This change has two outcomes:
203
204 1) Slightly reduces the likelihood that a function will be optimized both
205 standalone and via inlining. Previously, if you had a call sequence like foo()
206 calls bar() exactly once, and nobody else calls bar(), then bar() would get
207 optimized first (because it returns first) and then foo() gets optimized. If foo()
208 can inline bar() then that means that bar() gets optimized twice. But now, if we
209 optimize in prologues, then foo() will be optimized first. If it inlines bar(),
210 that means that there will no longer be any calls to bar().
211
212 2) It lets us kill some code in JITStubs. Epilogue tier-up was very different from
213 loop tier-up, since epilogue tier-up should not attempt OSR. But prologue tier-up
214 requires OSR (albeit really easy OSR since it's the top of the compilation unit),
215 so it becomes just like loop tier-up. As a result, we now have one optimization
216 hook (cti_optimize) instead of two (cti_optimize_from_loop and
217 cti_optimize_from_ret).
218
219 As a consequence of not having an optimization check in epilogues, the OSR exit
220 code must now trigger reoptimization itself instead of just signaling the epilogue
221 check to fire.
222
223 This also adds the ability to count the number of DFG compilations, which was
224 useful for debugging this patch and might be useful for other things in the future.
225
226 * bytecode/CodeBlock.cpp:
227 (JSC::CodeBlock::reoptimize):
228 (JSC):
229 * bytecode/CodeBlock.h:
230 (CodeBlock):
231 * dfg/DFGByteCodeParser.cpp:
232 (JSC::DFG::ByteCodeParser::parseCodeBlock):
233 * dfg/DFGDriver.cpp:
234 (DFG):
235 (JSC::DFG::getNumCompilations):
236 (JSC::DFG::compile):
237 * dfg/DFGDriver.h:
238 (DFG):
239 * dfg/DFGOSRExitCompiler.cpp:
240 (JSC::DFG::OSRExitCompiler::handleExitCounts):
241 * dfg/DFGOperations.cpp:
242 * dfg/DFGOperations.h:
243 * jit/JIT.cpp:
244 (JSC::JIT::emitOptimizationCheck):
245 * jit/JIT.h:
246 * jit/JITCall32_64.cpp:
247 (JSC::JIT::emit_op_ret):
248 (JSC::JIT::emit_op_ret_object_or_this):
249 * jit/JITOpcodes.cpp:
250 (JSC::JIT::emit_op_ret):
251 (JSC::JIT::emit_op_ret_object_or_this):
252 (JSC::JIT::emit_op_enter):
253 * jit/JITOpcodes32_64.cpp:
254 (JSC::JIT::emit_op_enter):
255 * jit/JITStubs.cpp:
256 (JSC::DEFINE_STUB_FUNCTION):
257 * jit/JITStubs.h:
258
mhahnenberg@apple.com6d9f86d2012-06-22 21:42:46 +00002592012-06-20 Mark Hahnenberg <mhahnenberg@apple.com>
260
261 JSLock should be per-JSGlobalData
262 https://bugs.webkit.org/show_bug.cgi?id=89123
263
264 Reviewed by Gavin Barraclough.
265
266 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
267 * API/APIShims.h:
268 (APIEntryShimWithoutLock):
269 (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): Added an extra parameter to the constructor to
270 determine whether we should ref the JSGlobalData or not. We want to ref all the time except for in the
271 HeapTimer class because timerDidFire could run after somebody has started to tear down that particular
272 JSGlobalData, so we wouldn't want to resurrect the ref count of that JSGlobalData from 0 back to 1 after
273 its destruction has begun.
274 (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock): Now derefs if it also refed.
275 (JSC::APIEntryShim::APIEntryShim):
276 (APIEntryShim):
277 (JSC::APIEntryShim::~APIEntryShim):
278 (JSC::APIEntryShim::init): Factored out common initialization code for the various APIEntryShim constructors.
279 Also moved the timeoutChecker stop and start here because we need to start after we've grabbed the API lock
280 and before we've released it, which can only done in APIEntryShim.
281 (JSC::APICallbackShim::~APICallbackShim): We no longer need to synchronize here.
282 * API/JSContextRef.cpp:
283 (JSGlobalContextCreate):
284 (JSGlobalContextCreateInGroup):
285 (JSGlobalContextRelease):
286 (JSContextCreateBacktrace):
287 * heap/CopiedSpace.cpp:
288 (JSC::CopiedSpace::tryAllocateSlowCase):
289 * heap/Heap.cpp:
290 (JSC::Heap::protect):
291 (JSC::Heap::unprotect):
292 (JSC::Heap::collect):
293 (JSC::Heap::setActivityCallback):
294 (JSC::Heap::activityCallback):
295 (JSC::Heap::sweeper):
296 * heap/Heap.h: Changed m_activityCallback and m_sweeper to be raw pointers rather than OwnPtrs because they
297 are now responsible for their own lifetime. Also changed the order of declaration of the GCActivityCallback
298 and the IncrementalSweeper to make sure they're the last things that get initialized during construction to
299 prevent any issues with uninitialized memory in the JSGlobalData/Heap they might care about.
300 (Heap):
301 * heap/HeapTimer.cpp: Refactored to allow for thread-safe operation and shutdown.
302 (JSC::HeapTimer::~HeapTimer):
303 (JSC::HeapTimer::invalidate):
304 (JSC):
305 (JSC::HeapTimer::didStartVMShutdown): Called at the beginning of ~JSGlobalData. If we're on the same thread
306 that the HeapTimer is running on, we kill the HeapTimer ourselves. If not, then we set some state in the
307 HeapTimer and schedule it to fire immediately so that it can notice and kill itself.
308 (JSC::HeapTimer::timerDidFire): We grab our mutex and check our JSGlobalData pointer. If it has been zero-ed
309 out, then we know the VM has started to shutdown and we should kill ourselves. Otherwise, grab the APIEntryShim,
310 but without ref-ing the JSGlobalData (we don't want to bring the JSGlobalData's ref-count from 0 to 1) in case
311 we were interrupted between releasing our mutex and trying to grab the APILock.
312 * heap/HeapTimer.h:
313 (HeapTimer):
314 * heap/IncrementalSweeper.cpp:
315 (JSC::IncrementalSweeper::doWork): We no longer need the API shim here since HeapTimer::timerDidFire handles
316 all of that for us.
317 (JSC::IncrementalSweeper::create):
318 * heap/IncrementalSweeper.h:
319 (IncrementalSweeper):
320 * heap/MarkedAllocator.cpp:
321 (JSC::MarkedAllocator::allocateSlowCase):
322 * heap/WeakBlock.cpp:
323 (JSC::WeakBlock::reap):
324 * jsc.cpp:
325 (functionGC):
326 (functionReleaseExecutableMemory):
327 (jscmain):
328 * runtime/Completion.cpp:
329 (JSC::checkSyntax):
330 (JSC::evaluate):
331 * runtime/GCActivityCallback.h:
332 (DefaultGCActivityCallback):
333 (JSC::DefaultGCActivityCallback::create):
334 * runtime/JSGlobalData.cpp:
335 (JSC::JSGlobalData::JSGlobalData):
336 (JSC::JSGlobalData::~JSGlobalData): Signals to the two HeapTimers (GCActivityCallback and IncrementalSweeper)
337 that the VM has started shutting down. It then waits until the HeapTimer is done with whatever activity
338 it needs to do before continuing with any further destruction. Also asserts that we do not currently hold the
339 APILock because this could potentially cause deadlock when we try to signal to the HeapTimers using their mutexes.
340 (JSC::JSGlobalData::sharedInstance): Protect the initialization for the shared instance with the GlobalJSLock.
341 (JSC::JSGlobalData::sharedInstanceInternal):
342 * runtime/JSGlobalData.h: Change to be ThreadSafeRefCounted so that we don't have to worry about refing and
343 de-refing JSGlobalDatas on separate threads since we don't do it that often anyways.
344 (JSGlobalData):
345 (JSC::JSGlobalData::apiLock):
346 * runtime/JSGlobalObject.cpp:
347 (JSC::JSGlobalObject::~JSGlobalObject):
348 (JSC::JSGlobalObject::init):
349 * runtime/JSLock.cpp:
350 (JSC):
351 (JSC::GlobalJSLock::GlobalJSLock): For accessing the shared instance.
352 (JSC::GlobalJSLock::~GlobalJSLock):
353 (JSC::JSLockHolder::JSLockHolder): MutexLocker for JSLock. Also refs the JSGlobalData to keep it alive so that
354 it can successfully unlock it later without it disappearing from underneath it.
355 (JSC::JSLockHolder::~JSLockHolder):
356 (JSC::JSLock::JSLock):
357 (JSC::JSLock::~JSLock):
358 (JSC::JSLock::lock): Uses the spin lock for guarding the lock count and owner thread fields. Uses the mutex for
359 actually waiting for long periods.
360 (JSC::JSLock::unlock):
361 (JSC::JSLock::currentThreadIsHoldingLock):
362 (JSC::JSLock::dropAllLocks):
363 (JSC::JSLock::dropAllLocksUnconditionally):
364 (JSC::JSLock::grabAllLocks):
365 (JSC::JSLock::DropAllLocks::DropAllLocks):
366 (JSC::JSLock::DropAllLocks::~DropAllLocks):
367 * runtime/JSLock.h:
368 (JSC):
369 (GlobalJSLock):
370 (JSLockHolder):
371 (JSLock):
372 (DropAllLocks):
373 * runtime/WeakGCMap.h:
374 (JSC::WeakGCMap::set):
375 * testRegExp.cpp:
376 (realMain):
377
peter@chromium.org166f5bb2012-06-22 16:20:33 +00003782012-06-22 Peter Beverloo <peter@chromium.org>
379
380 [Chromium] Disable c++0x compatibility warnings in JavaScriptCore.gyp when building for Android
381 https://bugs.webkit.org/show_bug.cgi?id=88853
382
383 Reviewed by Steve Block.
384
385 The Android exclusions were necessary to fix a gyp generation error, as
386 the gcc_version variable wasn't being defined for Android. Remove these
387 exceptions when Chromium is able to define the gcc_version variable.
388
389 * JavaScriptCore.gyp/JavaScriptCore.gyp:
390
fpizlo@apple.com90011802012-06-22 01:33:30 +00003912012-06-21 Filip Pizlo <fpizlo@apple.com>
392
393 op_resolve_global should not prevent DFG inlining
394 https://bugs.webkit.org/show_bug.cgi?id=89726
395
396 Reviewed by Gavin Barraclough.
397
398 * bytecode/CodeBlock.cpp:
399 (JSC::CodeBlock::CodeBlock):
400 (JSC::CodeBlock::shrinkToFit):
401 * bytecode/GlobalResolveInfo.h:
402 (JSC::GlobalResolveInfo::GlobalResolveInfo):
403 (GlobalResolveInfo):
404 * dfg/DFGByteCodeParser.cpp:
405 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
406 * dfg/DFGCapabilities.h:
407 (JSC::DFG::canInlineOpcode):
408 * dfg/DFGOperations.cpp:
409 * dfg/DFGOperations.h:
410 * dfg/DFGSpeculativeJIT.h:
411 (JSC::DFG::SpeculativeJIT::callOperation):
412 * dfg/DFGSpeculativeJIT32_64.cpp:
413 (JSC::DFG::SpeculativeJIT::compile):
414 * dfg/DFGSpeculativeJIT64.cpp:
415 (JSC::DFG::SpeculativeJIT::compile):
416
fpizlo@apple.com618044d2012-06-21 22:55:42 +00004172012-06-20 Filip Pizlo <fpizlo@apple.com>
418
419 DFG should inline 'new Array()'
420 https://bugs.webkit.org/show_bug.cgi?id=89632
421
422 Reviewed by Geoffrey Garen.
423
424 This adds support for treating InternalFunction like intrinsics. The code
425 to do so is actually quite clean, so I don't feel bad about perpetuating
426 the InternalFunction vs. JSFunction-with-NativeExecutable dichotomy.
427
428 Currently this newfound power is only used to inline 'new Array()'.
429
430 * dfg/DFGByteCodeParser.cpp:
431 (ByteCodeParser):
432 (JSC::DFG::ByteCodeParser::handleCall):
433 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
434 (DFG):
435 * dfg/DFGGraph.h:
436 (JSC::DFG::Graph::isInternalFunctionConstant):
437 (JSC::DFG::Graph::valueOfInternalFunctionConstant):
438
mhahnenberg@apple.coma2373032012-06-21 22:38:39 +00004392012-06-21 Mark Hahnenberg <mhahnenberg@apple.com>
440
441 Adding copyrights to new files.
442
443 * heap/HeapTimer.cpp:
444 * heap/HeapTimer.h:
445 * heap/IncrementalSweeper.cpp:
446 * heap/IncrementalSweeper.h:
447
commit-queue@webkit.orgc8209e72012-06-21 17:34:26 +00004482012-06-21 Arnaud Renevier <arno@renevier.net>
449
450 make sure headers are included only once per file
451 https://bugs.webkit.org/show_bug.cgi?id=88922
452
453 Reviewed by Alexey Proskuryakov.
454
455 * bytecode/CodeBlock.h:
456 * heap/MachineStackMarker.cpp:
457 * runtime/JSVariableObject.h:
458
commit-queue@webkit.orgbff9a102012-06-21 15:46:40 +00004592012-06-21 Ryuan Choi <ryuan.choi@gmail.com>
460
461 [EFL][WK2] Make WebKit2/Efl headers and resources installable.
462 https://bugs.webkit.org/show_bug.cgi?id=88207
463
464 Reviewed by Chang Shu.
465
466 * shell/CMakeLists.txt: Use ${EXEC_INSTALL_DIR} instead of hardcoding "bin"
467
ggaren@apple.com4b67d0d2012-06-21 02:00:08 +00004682012-06-20 Geoffrey Garen <ggaren@apple.com>
469
470 Reduced (but did not eliminate) use of "berzerker GC"
471 https://bugs.webkit.org/show_bug.cgi?id=89237
472
473 Reviewed by Gavin Barraclough.
474
475 (PART 1)
476
477 This patch turned out to be crashy, so I'm landing the non-crashy bits
478 first.
479
480 This part is pre-requisite refactoring. I didn't actually turn off
481 "berzerker GC" or turn on incremental shrinking.
482
483 * heap/MarkedAllocator.cpp:
484 (JSC::MarkedAllocator::removeBlock): Make sure to clear the free list when
485 we throw away the block we're currently allocating out of. Otherwise, we'll
486 allocate out of a stale free list.
487
488 * heap/MarkedSpace.cpp:
489 (JSC::Free::Free):
490 (JSC::Free::operator()):
491 (JSC::Free::returnValue): Refactored this functor to use a shared helper
492 function, so we can share our implementation with the incremental sweeper.
493
494 Also changed to freeing individual blocks immediately instead of linking
495 them into a list for later freeing. This makes the programming interface
496 simpler, and it's slightly more efficient to boot.
497
498 (JSC::MarkedSpace::~MarkedSpace): Updated for rename.
499
500 (JSC::MarkedSpace::freeBlock):
501 (JSC::MarkedSpace::freeOrShrinkBlock): New helper functions to share behavior
502 with the incremental sweeper.
503
504 (JSC::MarkedSpace::shrink): Updated for new functor behavior.
505
506 * heap/MarkedSpace.h: Statically typed languages are awesome.
507
fpizlo@apple.com8c462122012-06-20 21:07:33 +00005082012-06-20 Filip Pizlo <fpizlo@apple.com>
509
fpizlo@apple.com3bcb2112012-06-21 01:38:49 +0000510 DFG should optimize ResolveGlobal
511 https://bugs.webkit.org/show_bug.cgi?id=89617
512
513 Reviewed by Oliver Hunt.
514
515 This adds inlining of ResolveGlobal accesses that are known monomorphic. It also
516 adds the specific function optimization to ResolveGlobal, when it is inlined. And,
517 it makes internal functions act like specific functions, since that will be the
518 most common use-case of this optimization.
519
520 This is only a slighy speed-up (sub 1%), since we don't yet do the obvious thing
521 with this optimization, which is to completely inline common "globally resolved"
522 function and constructor calls, like "new Array()".
523
524 * CMakeLists.txt:
525 * GNUmakefile.list.am:
526 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
527 * JavaScriptCore.xcodeproj/project.pbxproj:
528 * Target.pri:
529 * bytecode/CodeBlock.cpp:
530 (JSC::CodeBlock::globalResolveInfoForBytecodeOffset):
531 * bytecode/CodeBlock.h:
532 (CodeBlock):
533 (JSC::CodeBlock::numberOfGlobalResolveInfos):
534 * bytecode/GlobalResolveInfo.h:
535 (JSC::getGlobalResolveInfoBytecodeOffset):
536 (JSC):
537 * bytecode/ResolveGlobalStatus.cpp: Added.
538 (JSC):
539 (JSC::computeForStructure):
540 (JSC::computeForLLInt):
541 (JSC::ResolveGlobalStatus::computeFor):
542 * bytecode/ResolveGlobalStatus.h: Added.
543 (JSC):
544 (ResolveGlobalStatus):
545 (JSC::ResolveGlobalStatus::ResolveGlobalStatus):
546 (JSC::ResolveGlobalStatus::state):
547 (JSC::ResolveGlobalStatus::isSet):
548 (JSC::ResolveGlobalStatus::operator!):
549 (JSC::ResolveGlobalStatus::isSimple):
550 (JSC::ResolveGlobalStatus::takesSlowPath):
551 (JSC::ResolveGlobalStatus::structure):
552 (JSC::ResolveGlobalStatus::offset):
553 (JSC::ResolveGlobalStatus::specificValue):
554 * dfg/DFGByteCodeParser.cpp:
555 (ByteCodeParser):
556 (JSC::DFG::ByteCodeParser::handleGetByOffset):
557 (DFG):
558 (JSC::DFG::ByteCodeParser::handleGetById):
559 (JSC::DFG::ByteCodeParser::parseBlock):
560 * runtime/JSObject.cpp:
561 (JSC::getCallableObjectSlow):
562 (JSC):
563 (JSC::JSObject::put):
564 (JSC::JSObject::putDirectVirtual):
565 (JSC::JSObject::putDirectAccessor):
566 * runtime/JSObject.h:
567 (JSC):
568 (JSC::getCallableObject):
569 (JSC::JSObject::putOwnDataProperty):
570 (JSC::JSObject::putDirect):
571 (JSC::JSObject::putDirectWithoutTransition):
572
5732012-06-20 Filip Pizlo <fpizlo@apple.com>
574
fpizlo@apple.com2e368f72012-06-20 23:55:18 +0000575 Functions on global objects should be specializable
576 https://bugs.webkit.org/show_bug.cgi?id=89615
577
578 Reviewed by Oliver Hunt.
579
580 I tested to see if this brought back the bug in https://bugs.webkit.org/show_bug.cgi?id=33343,
581 and it didn't. Bug 33343 was the reason why we disabled global object function specialization
582 to begin with. So I'm guessing this is safe.
583
584 * runtime/JSGlobalObject.cpp:
585 (JSC::JSGlobalObject::init):
586
5872012-06-20 Filip Pizlo <fpizlo@apple.com>
588
fpizlo@apple.com8c462122012-06-20 21:07:33 +0000589 build-webkit failure due to illegal 32-bit integer constants in code
590 generated by offlineasm
591 https://bugs.webkit.org/show_bug.cgi?id=89347
592
593 Reviewed by Geoffrey Garen.
594
595 The offending constants are the magic numbers used by offlineasm to find
596 offsets in the generated machine code. Added code to turn them into what
597 the C++ compiler will believe to be valid 32-bit values.
598
599 * offlineasm/offsets.rb:
600
ggaren@apple.com30ef2b32012-06-20 18:24:02 +00006012012-06-19 Geoffrey Garen <ggaren@apple.com>
602
603 Made the incremental sweeper more aggressive
604 https://bugs.webkit.org/show_bug.cgi?id=89527
605
606 Reviewed by Oliver Hunt.
607
608 This is a pre-requisite to getting rid of "berzerker GC" because we need
609 the sweeper to reclaim memory in a timely fashion, or we'll see a memory
610 footprint regression.
611
612 * heap/IncrementalSweeper.h:
613 * heap/IncrementalSweeper.cpp:
614 (JSC::IncrementalSweeper::scheduleTimer): Since the time slice is predictable,
615 no need to use a data member to record it.
616
617 (JSC::IncrementalSweeper::doSweep): Sweep as many blocks as we can in a
618 small time slice. This is better than sweeping only one block per timer
619 fire because that strategy has a heavy timer overhead, and artificially
620 delays memory reclamation.
621
fpizlo@apple.com3d517672012-06-20 17:48:23 +00006222012-06-20 Filip Pizlo <fpizlo@apple.com>
623
624 DFG should be able to print disassembly interleaved with the IR
625 https://bugs.webkit.org/show_bug.cgi?id=89551
626
627 Reviewed by Geoffrey Garen.
fpizlo@apple.come245b3f2012-06-20 17:51:07 +0000628
629 This change also removes running Dominators unconditionally on every DFG
630 compile. Dominators are designed to be computed on-demand, and currently
631 the only demand is graph dumps.
fpizlo@apple.com3d517672012-06-20 17:48:23 +0000632
633 * CMakeLists.txt:
634 * GNUmakefile.list.am:
635 * JavaScriptCore.xcodeproj/project.pbxproj:
636 * Target.pri:
637 * assembler/ARMv7Assembler.h:
638 (JSC::ARMv7Assembler::labelIgnoringWatchpoints):
639 (ARMv7Assembler):
640 * assembler/AbstractMacroAssembler.h:
641 (AbstractMacroAssembler):
642 (JSC::AbstractMacroAssembler::labelIgnoringWatchpoints):
643 * assembler/X86Assembler.h:
644 (X86Assembler):
645 (JSC::X86Assembler::labelIgnoringWatchpoints):
646 * dfg/DFGCommon.h:
647 (JSC::DFG::shouldShowDisassembly):
648 (DFG):
649 * dfg/DFGDisassembler.cpp: Added.
650 (DFG):
651 (JSC::DFG::Disassembler::Disassembler):
652 (JSC::DFG::Disassembler::dump):
653 (JSC::DFG::Disassembler::dumpDisassembly):
654 * dfg/DFGDisassembler.h: Added.
655 (DFG):
656 (Disassembler):
657 (JSC::DFG::Disassembler::setStartOfCode):
658 (JSC::DFG::Disassembler::setForBlock):
659 (JSC::DFG::Disassembler::setForNode):
660 (JSC::DFG::Disassembler::setEndOfMainPath):
661 (JSC::DFG::Disassembler::setEndOfCode):
662 * dfg/DFGDriver.cpp:
663 (JSC::DFG::compile):
664 * dfg/DFGGraph.cpp:
665 (JSC::DFG::Graph::dumpCodeOrigin):
666 (JSC::DFG::Graph::amountOfNodeWhiteSpace):
667 (DFG):
668 (JSC::DFG::Graph::printNodeWhiteSpace):
669 (JSC::DFG::Graph::dump):
670 (JSC::DFG::Graph::dumpBlockHeader):
671 * dfg/DFGGraph.h:
672 * dfg/DFGJITCompiler.cpp:
673 (JSC::DFG::JITCompiler::JITCompiler):
674 (DFG):
675 (JSC::DFG::JITCompiler::compile):
676 (JSC::DFG::JITCompiler::compileFunction):
677 * dfg/DFGJITCompiler.h:
678 (JITCompiler):
679 (JSC::DFG::JITCompiler::setStartOfCode):
680 (JSC::DFG::JITCompiler::setForBlock):
681 (JSC::DFG::JITCompiler::setForNode):
682 (JSC::DFG::JITCompiler::setEndOfMainPath):
683 (JSC::DFG::JITCompiler::setEndOfCode):
684 * dfg/DFGNode.h:
685 (Node):
686 (JSC::DFG::Node::willHaveCodeGen):
687 * dfg/DFGNodeFlags.cpp:
688 (JSC::DFG::nodeFlagsAsString):
689 * dfg/DFGSpeculativeJIT.cpp:
690 (JSC::DFG::SpeculativeJIT::compile):
691 * dfg/DFGSpeculativeJIT.h:
692 (SpeculativeJIT):
693 * runtime/Options.cpp:
694 (Options):
695 (JSC::Options::initializeOptions):
696 * runtime/Options.h:
697 (Options):
698
fpizlo@apple.com2adf5272012-06-20 01:33:30 +00006992012-06-19 Filip Pizlo <fpizlo@apple.com>
700
701 JSC should be able to show disassembly for all generated JIT code
702 https://bugs.webkit.org/show_bug.cgi?id=89536
703
704 Reviewed by Gavin Barraclough.
705
706 Now instead of doing linkBuffer.finalizeCode(), you do
707 FINALIZE_CODE(linkBuffer, (... explanation ...)). FINALIZE_CODE() then
708 prints your explanation and the disassembled code, if
709 Options::showDisassembly is set to true.
710
711 * CMakeLists.txt:
712 * GNUmakefile.list.am:
713 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
714 * JavaScriptCore.xcodeproj/project.pbxproj:
715 * Target.pri:
716 * assembler/LinkBuffer.cpp: Added.
717 (JSC):
718 (JSC::LinkBuffer::finalizeCodeWithoutDisassembly):
719 (JSC::LinkBuffer::finalizeCodeWithDisassembly):
720 (JSC::LinkBuffer::linkCode):
721 (JSC::LinkBuffer::performFinalization):
722 (JSC::LinkBuffer::dumpLinkStatistics):
723 (JSC::LinkBuffer::dumpCode):
724 * assembler/LinkBuffer.h:
725 (LinkBuffer):
726 (JSC):
727 * assembler/MacroAssemblerCodeRef.h:
728 (JSC::MacroAssemblerCodeRef::tryToDisassemble):
729 (MacroAssemblerCodeRef):
730 * dfg/DFGJITCompiler.cpp:
731 (JSC::DFG::JITCompiler::compile):
732 (JSC::DFG::JITCompiler::compileFunction):
733 * dfg/DFGOSRExitCompiler.cpp:
734 * dfg/DFGRepatch.cpp:
735 (JSC::DFG::generateProtoChainAccessStub):
736 (JSC::DFG::tryCacheGetByID):
737 (JSC::DFG::tryBuildGetByIDList):
738 (JSC::DFG::emitPutReplaceStub):
739 (JSC::DFG::emitPutTransitionStub):
740 * dfg/DFGThunks.cpp:
741 (JSC::DFG::osrExitGenerationThunkGenerator):
742 * disassembler/Disassembler.h:
743 (JSC):
744 (JSC::tryToDisassemble):
745 * disassembler/UDis86Disassembler.cpp:
746 (JSC::tryToDisassemble):
747 * jit/JIT.cpp:
748 (JSC::JIT::privateCompile):
749 * jit/JITCode.h:
750 (JSC::JITCode::tryToDisassemble):
751 * jit/JITOpcodes.cpp:
752 (JSC::JIT::privateCompileCTIMachineTrampolines):
753 * jit/JITOpcodes32_64.cpp:
754 (JSC::JIT::privateCompileCTIMachineTrampolines):
755 (JSC::JIT::privateCompileCTINativeCall):
756 * jit/JITPropertyAccess.cpp:
757 (JSC::JIT::stringGetByValStubGenerator):
758 (JSC::JIT::privateCompilePutByIdTransition):
759 (JSC::JIT::privateCompilePatchGetArrayLength):
760 (JSC::JIT::privateCompileGetByIdProto):
761 (JSC::JIT::privateCompileGetByIdSelfList):
762 (JSC::JIT::privateCompileGetByIdProtoList):
763 (JSC::JIT::privateCompileGetByIdChainList):
764 (JSC::JIT::privateCompileGetByIdChain):
765 * jit/JITPropertyAccess32_64.cpp:
766 (JSC::JIT::stringGetByValStubGenerator):
767 (JSC::JIT::privateCompilePutByIdTransition):
768 (JSC::JIT::privateCompilePatchGetArrayLength):
769 (JSC::JIT::privateCompileGetByIdProto):
770 (JSC::JIT::privateCompileGetByIdSelfList):
771 (JSC::JIT::privateCompileGetByIdProtoList):
772 (JSC::JIT::privateCompileGetByIdChainList):
773 (JSC::JIT::privateCompileGetByIdChain):
774 * jit/SpecializedThunkJIT.h:
775 (JSC::SpecializedThunkJIT::finalize):
776 * jit/ThunkGenerators.cpp:
777 (JSC::charCodeAtThunkGenerator):
778 (JSC::charAtThunkGenerator):
779 (JSC::fromCharCodeThunkGenerator):
780 (JSC::sqrtThunkGenerator):
781 (JSC::floorThunkGenerator):
782 (JSC::ceilThunkGenerator):
783 (JSC::roundThunkGenerator):
784 (JSC::expThunkGenerator):
785 (JSC::logThunkGenerator):
786 (JSC::absThunkGenerator):
787 (JSC::powThunkGenerator):
788 * llint/LLIntThunks.cpp:
789 (JSC::LLInt::generateThunkWithJumpTo):
790 (JSC::LLInt::functionForCallEntryThunkGenerator):
791 (JSC::LLInt::functionForConstructEntryThunkGenerator):
792 (JSC::LLInt::functionForCallArityCheckThunkGenerator):
793 (JSC::LLInt::functionForConstructArityCheckThunkGenerator):
794 (JSC::LLInt::evalEntryThunkGenerator):
795 (JSC::LLInt::programEntryThunkGenerator):
796 * runtime/Options.cpp:
797 (Options):
798 (JSC::Options::initializeOptions):
799 * runtime/Options.h:
800 (Options):
801 * yarr/YarrJIT.cpp:
802 (JSC::Yarr::YarrGenerator::compile):
803
mhahnenberg@apple.com7ffd08d2012-06-20 00:20:30 +00008042012-06-19 Mark Hahnenberg <mhahnenberg@apple.com>
805
806 [Qt][Mac] REGRESSION(r120742): It broke the build
807 https://bugs.webkit.org/show_bug.cgi?id=89516
808
809 Reviewed by Geoffrey Garen.
810
811 Removing GCActivityCallbackCF.cpp because it doesn't mesh well with cross-platform
812 code on Darwin (e.g. Qt). We now use plain ol' vanilla ifdefs to handle platforms
813 without CF support. These if-defs will probably disappear in the future when we
814 use cross-platform timers in HeapTimer.
815
816 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
817 * JavaScriptCore.xcodeproj/project.pbxproj:
818 * runtime/GCActivityCallback.cpp:
819 (JSC):
820 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
821 (JSC::DefaultGCActivityCallback::doWork):
822 (JSC::DefaultGCActivityCallback::scheduleTimer):
823 (JSC::DefaultGCActivityCallback::cancelTimer):
824 (JSC::DefaultGCActivityCallback::didAllocate):
825 (JSC::DefaultGCActivityCallback::willCollect):
826 (JSC::DefaultGCActivityCallback::cancel):
827 * runtime/GCActivityCallbackCF.cpp: Removed.
828
fpizlo@apple.com152abff2012-06-19 23:10:12 +00008292012-06-19 Filip Pizlo <fpizlo@apple.com>
830
831 DFG CFA forgets to notify subsequent phases of found constants if it proves LogicalNot to be a constant
832 https://bugs.webkit.org/show_bug.cgi?id=89511
833 <rdar://problem/11700089>
834
835 Reviewed by Geoffrey Garen.
836
837 * dfg/DFGAbstractState.cpp:
838 (JSC::DFG::AbstractState::execute):
839
commit-queue@webkit.orgb6833002012-06-19 21:06:08 +00008402012-06-19 Mark Lam <mark.lam@apple.com>
841
842 CodeBlock::needsCallReturnIndices() is no longer needed.
843 https://bugs.webkit.org/show_bug.cgi?id=89490
844
845 Reviewed by Geoffrey Garen.
846
847 * bytecode/CodeBlock.h:
848 (JSC::CodeBlock::needsCallReturnIndices): removed.
849 * dfg/DFGJITCompiler.cpp:
850 (JSC::DFG::JITCompiler::link):
851 * jit/JIT.cpp:
852 (JSC::JIT::privateCompile):
853
fpizlo@apple.com861ea7b2012-06-19 20:05:06 +00008542012-06-19 Filip Pizlo <fpizlo@apple.com>
855
856 Unreviewed, try to fix Windows build.
857
858 * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd:
859
fpizlo@apple.com01c2a192012-06-19 19:42:55 +00008602012-06-17 Filip Pizlo <fpizlo@apple.com>
861
862 It should be possible to look at disassembly
863 https://bugs.webkit.org/show_bug.cgi?id=89319
864
865 Reviewed by Sam Weinig.
866
867 This imports the udis86 disassembler library. The library is placed
868 behind an abstraction in disassembler/Disassembler.h, so that we can
869 in the future use other disassemblers (for other platforms) whenever
870 appropriate. As a first step, the disassembler is being invoked for
871 DFG verbose dumps.
872
873 If we ever want to merge a new version of udis86 in the future, I've
874 made notes about changes I made to the library in
875 disassembler/udis86/differences.txt.
876
877 * CMakeLists.txt:
878 * DerivedSources.make:
879 * GNUmakefile.list.am:
880 * JavaScriptCore.pri:
881 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
882 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
883 * JavaScriptCore.xcodeproj/project.pbxproj:
884 * dfg/DFGJITCompiler.cpp:
885 (JSC::DFG::JITCompiler::compile):
886 (JSC::DFG::JITCompiler::compileFunction):
887 * disassembler: Added.
888 * disassembler/Disassembler.h: Added.
889 (JSC):
890 (JSC::tryToDisassemble):
891 * disassembler/UDis86Disassembler.cpp: Added.
892 (JSC):
893 (JSC::tryToDisassemble):
894 * disassembler/udis86: Added.
895 * disassembler/udis86/differences.txt: Added.
896 * disassembler/udis86/itab.py: Added.
897 (UdItabGenerator):
898 (UdItabGenerator.__init__):
899 (UdItabGenerator.toGroupId):
900 (UdItabGenerator.genLookupTable):
901 (UdItabGenerator.genLookupTableList):
902 (UdItabGenerator.genInsnTable):
903 (genItabH):
904 (genItabH.UD_ITAB_H):
905 (genItabC):
906 (genItab):
907 (main):
908 * disassembler/udis86/optable.xml: Added.
909 * disassembler/udis86/ud_opcode.py: Added.
910 (UdOpcodeTables):
911 (UdOpcodeTables.sizeOfTable):
912 (UdOpcodeTables.nameOfTable):
913 (UdOpcodeTables.updateTable):
914 (UdOpcodeTables.Insn):
915 (UdOpcodeTables.Insn.__init__):
916 (UdOpcodeTables.Insn.__init__.opcode):
917 (UdOpcodeTables.parse):
918 (UdOpcodeTables.addInsnDef):
919 (UdOpcodeTables.print_table):
920 (UdOpcodeTables.print_tree):
921 * disassembler/udis86/ud_optable.py: Added.
922 (UdOptableXmlParser):
923 (UdOptableXmlParser.parseDef):
924 (UdOptableXmlParser.parse):
925 (printFn):
926 (parse):
927 (main):
928 * disassembler/udis86/udis86.c: Added.
929 (ud_init):
930 (ud_disassemble):
931 (ud_set_mode):
932 (ud_set_vendor):
933 (ud_set_pc):
934 (ud):
935 (ud_insn_asm):
936 (ud_insn_off):
937 (ud_insn_hex):
938 (ud_insn_ptr):
939 (ud_insn_len):
940 * disassembler/udis86/udis86.h: Added.
941 * disassembler/udis86/udis86_decode.c: Added.
942 (eff_adr_mode):
943 (ud_lookup_mnemonic):
944 (decode_prefixes):
945 (modrm):
946 (resolve_operand_size):
947 (resolve_mnemonic):
948 (decode_a):
949 (decode_gpr):
950 (resolve_gpr64):
951 (resolve_gpr32):
952 (resolve_reg):
953 (decode_imm):
954 (decode_modrm_reg):
955 (decode_modrm_rm):
956 (decode_o):
957 (decode_operand):
958 (decode_operands):
959 (clear_insn):
960 (resolve_mode):
961 (gen_hex):
962 (decode_insn):
963 (decode_3dnow):
964 (decode_ssepfx):
965 (decode_ext):
966 (decode_opcode):
967 (ud_decode):
968 * disassembler/udis86/udis86_decode.h: Added.
969 (ud_itab_entry_operand):
970 (ud_itab_entry):
971 (ud_lookup_table_list_entry):
972 (sse_pfx_idx):
973 (mode_idx):
974 (modrm_mod_idx):
975 (vendor_idx):
976 (is_group_ptr):
977 (group_idx):
978 * disassembler/udis86/udis86_extern.h: Added.
979 * disassembler/udis86/udis86_input.c: Added.
980 (inp_buff_hook):
981 (inp_file_hook):
982 (ud):
983 (ud_set_user_opaque_data):
984 (ud_get_user_opaque_data):
985 (ud_set_input_buffer):
986 (ud_set_input_file):
987 (ud_input_skip):
988 (ud_input_end):
989 (ud_inp_next):
990 (ud_inp_back):
991 (ud_inp_peek):
992 (ud_inp_move):
993 (ud_inp_uint8):
994 (ud_inp_uint16):
995 (ud_inp_uint32):
996 (ud_inp_uint64):
997 * disassembler/udis86/udis86_input.h: Added.
998 * disassembler/udis86/udis86_itab_holder.c: Added.
999 * disassembler/udis86/udis86_syn-att.c: Added.
1000 (opr_cast):
1001 (gen_operand):
1002 (ud_translate_att):
1003 * disassembler/udis86/udis86_syn-intel.c: Added.
1004 (opr_cast):
1005 (gen_operand):
1006 (ud_translate_intel):
1007 * disassembler/udis86/udis86_syn.c: Added.
1008 * disassembler/udis86/udis86_syn.h: Added.
1009 (mkasm):
1010 * disassembler/udis86/udis86_types.h: Added.
1011 (ud_operand):
1012 (ud):
1013 * jit/JITCode.h:
1014 (JITCode):
1015 (JSC::JITCode::tryToDisassemble):
1016
mhahnenberg@apple.coma7ec41b2012-06-19 19:17:31 +000010172012-06-19 Mark Hahnenberg <mhahnenberg@apple.com>
1018
1019 GCActivityCallback and IncrementalSweeper should share code
1020 https://bugs.webkit.org/show_bug.cgi?id=89400
1021
1022 Reviewed by Geoffrey Garen.
1023
1024 A lot of functionality is duplicated between GCActivityCallback and IncrementalSweeper.
1025 We should extract the common functionality out into a separate class that both of them
1026 can inherit from. This refactoring will be an even greater boon when we add the ability
1027 to shut these two agents down in a thread-safe fashion
1028
1029 * CMakeLists.txt:
1030 * GNUmakefile.list.am:
1031 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1032 * JavaScriptCore.xcodeproj/project.pbxproj:
1033 * Target.pri:
1034 * heap/Heap.cpp:
1035 (JSC::Heap::Heap): Move initialization down so that the JSGlobalData has a valid Heap when
1036 we're initializing the GCActivityCallback and the IncrementalSweeper.
1037 * heap/Heap.h:
1038 (Heap):
1039 * heap/HeapTimer.cpp: Added.
1040 (JSC):
1041 (JSC::HeapTimer::HeapTimer): Initialize the various base class data that
1042 DefaultGCActivityCallback::commonConstructor() used to do.
1043 (JSC::HeapTimer::~HeapTimer): Call to invalidate().
1044 (JSC::HeapTimer::synchronize): Same functionality as the old DefaultGCActivityCallback::synchronize().
1045 Virtual so that non-CF subclasses can override.
1046 (JSC::HeapTimer::invalidate): Tears down the runloop timer to prevent any future firing.
1047 (JSC::HeapTimer::timerDidFire): Callback to pass to the timer function. Casts and calls the virtual doWork().
1048 * heap/HeapTimer.h: Added. This is the class that serves as the common base class for
1049 both GCActivityCallback and IncrementalSweeper. It handles setting up and tearing down run loops and synchronizing
1050 across threads for its subclasses.
1051 (JSC):
1052 (HeapTimer):
1053 * heap/IncrementalSweeper.cpp: Changes to accomodate the extraction of common functionality
1054 between IncrementalSweeper and GCActivityCallback into a common ancestor.
1055 (JSC):
1056 (JSC::IncrementalSweeper::doWork):
1057 (JSC::IncrementalSweeper::IncrementalSweeper):
1058 (JSC::IncrementalSweeper::cancelTimer):
1059 (JSC::IncrementalSweeper::create):
1060 * heap/IncrementalSweeper.h:
1061 (IncrementalSweeper):
1062 * runtime/GCActivityCallback.cpp:
1063 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
1064 (JSC::DefaultGCActivityCallback::doWork):
1065 * runtime/GCActivityCallback.h:
1066 (GCActivityCallback):
1067 (JSC::GCActivityCallback::willCollect):
1068 (JSC::GCActivityCallback::GCActivityCallback):
1069 (JSC):
1070 (DefaultGCActivityCallback): Remove the platform data struct. The platform data should be kept in
1071 the class itself so as to be accessible by doWork(). Most of the platform data for CF is kept in
1072 HeapTimer anyways, so we only need the m_delay field now.
1073 * runtime/GCActivityCallbackBlackBerry.cpp:
1074 (JSC):
1075 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
1076 (JSC::DefaultGCActivityCallback::doWork):
1077 (JSC::DefaultGCActivityCallback::didAllocate):
1078 * runtime/GCActivityCallbackCF.cpp:
1079 (JSC):
1080 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
1081 (JSC::DefaultGCActivityCallback::doWork):
1082 (JSC::DefaultGCActivityCallback::scheduleTimer):
1083 (JSC::DefaultGCActivityCallback::cancelTimer):
1084 (JSC::DefaultGCActivityCallback::didAllocate):
1085 (JSC::DefaultGCActivityCallback::willCollect):
1086 (JSC::DefaultGCActivityCallback::cancel):
1087
1088
commit-queue@webkit.orgf5584612012-06-19 09:13:52 +000010892012-06-19 Mike West <mkwst@chromium.org>
1090
1091 Introduce ENABLE_CSP_NEXT configuration flag.
1092 https://bugs.webkit.org/show_bug.cgi?id=89300
1093
1094 Reviewed by Adam Barth.
1095
1096 The 1.0 draft of the Content Security Policy spec is just about to
1097 move to Last Call. We'll hide work on the upcoming 1.1 spec behind
1098 this ENABLE flag, disabled by default.
1099
1100 Spec: https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html
1101
1102 * Configurations/FeatureDefines.xcconfig:
1103
commit-queue@webkit.org3e0a1a02012-06-19 06:07:28 +000011042012-06-18 Mark Lam <mark.lam@apple.com>
1105
1106 Changed JSC to always record line number information so that error.stack
1107 and window.onerror() can report proper line numbers.
1108 https://bugs.webkit.org/show_bug.cgi?id=89410
1109
1110 Reviewed by Geoffrey Garen.
1111
1112 * bytecode/CodeBlock.cpp:
1113 (JSC::CodeBlock::CodeBlock):
1114 (JSC::CodeBlock::lineNumberForBytecodeOffset):
1115 (JSC::CodeBlock::shrinkToFit): m_lineInfo is now available unconditionally.
1116
1117 * bytecode/CodeBlock.h:
1118 (JSC::CodeBlock::addLineInfo):
1119 (JSC::CodeBlock::hasLineInfo): Unused. Now removed.
1120 (JSC::CodeBlock::needsCallReturnIndices):
1121 (CodeBlock):
1122 (RareData): Hoisted m_lineInfo out of m_rareData. m_lineInfo is now
1123 filled in unconditionally.
1124
1125 * bytecompiler/BytecodeGenerator.h:
1126 (JSC::BytecodeGenerator::addLineInfo):
1127
aestes@apple.comf6d51392012-06-19 03:32:30 +000011282012-06-18 Andy Estes <aestes@apple.com>
1129
aestes@apple.com6cc46942012-06-19 03:34:03 +00001130 Fix r120663, which didn't land the change that was reviewed.
1131
11322012-06-18 Andy Estes <aestes@apple.com>
1133
aestes@apple.comf6d51392012-06-19 03:32:30 +00001134 [JSC] In JSGlobalData.cpp, enableAssembler() sometimes leaks two CF objects
1135 https://bugs.webkit.org/show_bug.cgi?id=89415
1136
1137 Reviewed by Sam Weinig.
1138
1139 In the case where canUseJIT was a non-NULL CFBooleanRef,
1140 enableAssembler() would leak both canUseJITKey and canUseJIT by
1141 returning before calling CFRelease. Fix this by using RetainPtr.
1142
1143 * runtime/JSGlobalData.cpp:
1144 (JSC::enableAssembler):
1145
ggaren@apple.com2318dbc2012-06-18 04:35:21 +000011462012-06-17 Geoffrey Garen <ggaren@apple.com>
1147
1148 GC copy phase spends needless cycles zero-filling blocks
1149 https://bugs.webkit.org/show_bug.cgi?id=89128
1150
1151 Reviewed by Gavin Barraclough.
1152
1153 We only need to zero-fill when we're allocating memory that might not
1154 get fully initialized before GC.
1155
1156 * heap/CopiedBlock.h:
1157 (JSC::CopiedBlock::createNoZeroFill):
1158 (JSC::CopiedBlock::create): Added a way to create without zero-filling.
1159 This is our optimization.
1160
1161 (JSC::CopiedBlock::zeroFillToEnd):
1162 (JSC::CopiedBlock::CopiedBlock): Split zero-filling out from creation,
1163 so we can sometimes create without zero-filling.
1164
1165 * heap/CopiedSpace.cpp:
1166 (JSC::CopiedSpace::init):
1167 (JSC::CopiedSpace::tryAllocateSlowCase):
1168 (JSC::CopiedSpace::doneCopying): Renamed addNewBlock to allocateBlock()
1169 to clarify that the new block is always newly-allocated.
1170
1171 (JSC::CopiedSpace::doneFillingBlock): Make sure to zero-fill to the end
1172 of a block that might be used in the future for allocation. (Most of the
1173 time, this is a no-op, since we've already filled the block completely.)
1174
1175 (JSC::CopiedSpace::getFreshBlock): Removed this function because the
1176 abstraction of "allocation must succeed" is no longer useful.
1177
1178 * heap/CopiedSpace.h: Updated declarations to match.
1179
1180 * heap/CopiedSpaceInlineMethods.h:
1181 (JSC::CopiedSpace::allocateBlockForCopyingPhase): New function, which
1182 knows that it can skip zero-filling.
1183
1184 Added tighter scoping to our lock, to improve parallelism.
1185
1186 (JSC::CopiedSpace::allocateBlock): Folded getFreshBlock functionality
1187 into this function, for simplicity.
1188
1189 * heap/MarkStack.cpp:
1190 (JSC::SlotVisitor::startCopying):
1191 (JSC::SlotVisitor::allocateNewSpace): Use our new zero-fill-free helper
1192 function for great good.
1193
fpizlo@apple.com73df57b2012-06-18 01:59:18 +000011942012-06-17 Filip Pizlo <fpizlo@apple.com>
1195
1196 DFG should attempt to use structure watchpoints for all inlined get_by_id's and put_by_id's
1197 https://bugs.webkit.org/show_bug.cgi?id=89316
1198
1199 Reviewed by Oliver Hunt.
1200
1201 * dfg/DFGByteCodeParser.cpp:
1202 (JSC::DFG::ByteCodeParser::addStructureTransitionCheck):
1203 (ByteCodeParser):
1204 (JSC::DFG::ByteCodeParser::handleGetById):
1205 (JSC::DFG::ByteCodeParser::parseBlock):
1206
commit-queue@webkit.orgf8968a72012-06-15 22:24:21 +000012072012-06-15 Yong Li <yoli@rim.com>
1208
1209 [BlackBerry] Put platform-specific GC policy in GCActivityCallback
1210 https://bugs.webkit.org/show_bug.cgi?id=89236
1211
1212 Reviewed by Rob Buis.
1213
1214 Add GCActivityCallbackBlackBerry.cpp and implement platform-specific
1215 low memory GC policy there.
1216
1217 * PlatformBlackBerry.cmake:
1218 * heap/Heap.h:
1219 (JSC::Heap::isSafeToCollect): Added.
1220 * runtime/GCActivityCallbackBlackBerry.cpp: Added.
1221 (JSC):
1222 (JSC::DefaultGCActivityCallbackPlatformData::DefaultGCActivityCallbackPlatformData):
1223 (DefaultGCActivityCallbackPlatformData):
1224 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
1225 (JSC::DefaultGCActivityCallback::~DefaultGCActivityCallback):
1226 (JSC::DefaultGCActivityCallback::didAllocate):
1227 (JSC::DefaultGCActivityCallback::willCollect):
1228 (JSC::DefaultGCActivityCallback::synchronize):
1229 (JSC::DefaultGCActivityCallback::cancel):
1230
fpizlo@apple.com666a2d52012-06-15 22:21:44 +000012312012-06-15 Filip Pizlo <fpizlo@apple.com>
1232
1233 DFG should be able to set watchpoints on structure transitions in the
1234 method check prototype chain
1235 https://bugs.webkit.org/show_bug.cgi?id=89058
1236
1237 Adding the same assertion to 32-bit that I added to 64-bit. This change
1238 does not affect correctness but it's a good thing for assertion coverage.
1239
1240 * dfg/DFGSpeculativeJIT32_64.cpp:
1241 (JSC::DFG::SpeculativeJIT::compile):
1242
fpizlo@apple.comb75911b2012-06-13 20:53:52 +000012432012-06-13 Filip Pizlo <fpizlo@apple.com>
1244
fpizlo@apple.com04e41152012-06-15 22:14:53 +00001245 DFG should be able to set watchpoints on structure transitions in the
1246 method check prototype chain
1247 https://bugs.webkit.org/show_bug.cgi?id=89058
1248
1249 Reviewed by Gavin Barraclough.
1250
1251 This adds the ability to set watchpoints on Structures, and then does
1252 the most modest thing we can do with this ability: the DFG now sets
1253 watchpoints on structure transitions in the prototype chain of method
1254 checks.
1255
1256 This appears to be a >1% speed-up on V8.
1257
1258 * bytecode/PutByIdStatus.cpp:
1259 (JSC::PutByIdStatus::computeFromLLInt):
1260 (JSC::PutByIdStatus::computeFor):
1261 * bytecode/StructureSet.h:
1262 (JSC::StructureSet::containsOnly):
1263 (StructureSet):
1264 * bytecode/Watchpoint.cpp:
1265 (JSC::WatchpointSet::WatchpointSet):
1266 (JSC::InlineWatchpointSet::add):
1267 (JSC):
1268 (JSC::InlineWatchpointSet::inflateSlow):
1269 (JSC::InlineWatchpointSet::freeFat):
1270 * bytecode/Watchpoint.h:
1271 (WatchpointSet):
1272 (JSC):
1273 (InlineWatchpointSet):
1274 (JSC::InlineWatchpointSet::InlineWatchpointSet):
1275 (JSC::InlineWatchpointSet::~InlineWatchpointSet):
1276 (JSC::InlineWatchpointSet::hasBeenInvalidated):
1277 (JSC::InlineWatchpointSet::isStillValid):
1278 (JSC::InlineWatchpointSet::startWatching):
1279 (JSC::InlineWatchpointSet::notifyWrite):
1280 (JSC::InlineWatchpointSet::isFat):
1281 (JSC::InlineWatchpointSet::fat):
1282 (JSC::InlineWatchpointSet::inflate):
1283 * dfg/DFGAbstractState.cpp:
1284 (JSC::DFG::AbstractState::execute):
1285 * dfg/DFGByteCodeParser.cpp:
1286 (JSC::DFG::ByteCodeParser::addStructureTransitionCheck):
1287 (ByteCodeParser):
1288 (JSC::DFG::ByteCodeParser::parseBlock):
1289 * dfg/DFGCSEPhase.cpp:
1290 (JSC::DFG::CSEPhase::structureTransitionWatchpointElimination):
1291 (CSEPhase):
1292 (JSC::DFG::CSEPhase::performNodeCSE):
1293 * dfg/DFGCommon.h:
1294 * dfg/DFGGraph.cpp:
1295 (JSC::DFG::Graph::dump):
1296 * dfg/DFGGraph.h:
1297 (JSC::DFG::Graph::isCellConstant):
1298 * dfg/DFGJITCompiler.h:
1299 (JSC::DFG::JITCompiler::addWeakReferences):
1300 (JITCompiler):
1301 * dfg/DFGNode.h:
1302 (JSC::DFG::Node::hasStructure):
1303 (Node):
1304 (JSC::DFG::Node::structure):
1305 * dfg/DFGNodeType.h:
1306 (DFG):
1307 * dfg/DFGPredictionPropagationPhase.cpp:
1308 (JSC::DFG::PredictionPropagationPhase::propagate):
1309 * dfg/DFGRepatch.cpp:
1310 (JSC::DFG::emitPutTransitionStub):
1311 * dfg/DFGSpeculativeJIT64.cpp:
1312 (JSC::DFG::SpeculativeJIT::compile):
1313 * jit/JITStubs.cpp:
1314 (JSC::JITThunks::tryCachePutByID):
1315 * llint/LLIntSlowPaths.cpp:
1316 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
1317 * runtime/Structure.cpp:
1318 (JSC::Structure::Structure):
1319 * runtime/Structure.h:
1320 (JSC::Structure::transitionWatchpointSetHasBeenInvalidated):
1321 (Structure):
1322 (JSC::Structure::transitionWatchpointSetIsStillValid):
1323 (JSC::Structure::addTransitionWatchpoint):
1324 (JSC::Structure::notifyTransitionFromThisStructure):
1325 (JSC::JSCell::setStructure):
1326 * runtime/SymbolTable.cpp:
1327 (JSC::SymbolTableEntry::attemptToWatch):
1328
13292012-06-13 Filip Pizlo <fpizlo@apple.com>
1330
fpizlo@apple.comb75911b2012-06-13 20:53:52 +00001331 DFG should be able to set watchpoints on global variables
1332 https://bugs.webkit.org/show_bug.cgi?id=88692
1333
1334 Reviewed by Geoffrey Garen.
1335
1336 Rolling back in after fixing Windows build issues, and implementing
1337 branchTest8 for the Qt port's strange assemblers.
1338
1339 This implements global variable constant folding by allowing the optimizing
1340 compiler to set a "watchpoint" on globals that it wishes to constant fold.
1341 If the watchpoint fires, then an OSR exit is forced by overwriting the
1342 machine code that the optimizing compiler generated with a jump.
1343
1344 As such, this patch is adding quite a bit of stuff:
1345
1346 - Jump replacement on those hardware targets supported by the optimizing
1347 JIT. It is now possible to patch in a jump instruction over any recorded
1348 watchpoint label. The jump must be "local" in the sense that it must be
1349 within the range of the largest jump distance supported by a one
1350 instruction jump.
1351
1352 - WatchpointSets and Watchpoints. A Watchpoint is a doubly-linked list node
1353 that records the location where a jump must be inserted and the
1354 destination to which it should jump. Watchpoints can be added to a
1355 WatchpointSet. The WatchpointSet can be fired all at once, which plants
1356 all jumps. WatchpointSet also remembers if it had ever been invalidated,
1357 which allows for monotonicity: we typically don't want to optimize using
1358 watchpoints on something for which watchpoints had previously fired. The
1359 act of notifying a WatchpointSet has a trivial fast path in case no
1360 Watchpoints are registered (one-byte load+branch).
1361
1362 - SpeculativeJIT::speculationWatchpoint(). It's like speculationCheck(),
1363 except that you don't have to emit branches. But, you need to know what
1364 WatchpointSet to add the resulting Watchpoint to. Not everything that
1365 you could write a speculationCheck() for will have a WatchpointSet that
1366 would get notified if the condition you were speculating against became
1367 invalid.
1368
1369 - SymbolTableEntry now has the ability to refer to a WatchpointSet. It can
1370 do so without incurring any space overhead for those entries that don't
1371 have WatchpointSets.
1372
1373 - The bytecode generator infers all global function variables to be
1374 watchable, and makes all stores perform the WatchpointSet's write check,
1375 and marks all loads as being potentially watchable (i.e. you can compile
1376 them to a watchpoint and a constant).
1377
1378 Put together, this allows for fully sleazy inlining of calls to globally
1379 declared functions. The inline prologue will no longer contain the load of
1380 the function, or any checks of the function you're calling. I.e. it's
1381 pretty much like the kind of inlining you would see in Java or C++.
1382 Furthermore, the watchpointing functionality is built to be fairly general,
1383 and should allow setting watchpoints on all sorts of interesting things
1384 in the future.
1385
1386 The sleazy inlining means that we will now sometimes inline in code paths
1387 that have never executed. Previously, to inline we would have either had
1388 to have executed the call (to read the call's inline cache) or have
1389 executed the method check (to read the method check's inline cache). Now,
1390 we might inline when the callee is a watched global variable. This
1391 revealed some humorous bugs. First, constant folding disagreed with CFA
1392 over what kinds of operations can clobber (example: code path A is dead
1393 but stores a String into variable X, all other code paths store 0 into
1394 X, and then you do CompareEq(X, 0) - CFA will say that this is a non-
1395 clobbering constant, but constant folding thought it was clobbering
1396 because it saw the String prediction). Second, inlining would crash if
1397 the inline callee had not been compiled. This patch fixes both bugs,
1398 since otherwise run-javascriptcore-tests would report regressions.
1399
1400 * CMakeLists.txt:
1401 * GNUmakefile.list.am:
1402 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
1403 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1404 * JavaScriptCore.xcodeproj/project.pbxproj:
1405 * Target.pri:
1406 * assembler/ARMv7Assembler.h:
1407 (ARMv7Assembler):
1408 (JSC::ARMv7Assembler::ARMv7Assembler):
1409 (JSC::ARMv7Assembler::labelForWatchpoint):
1410 (JSC::ARMv7Assembler::label):
1411 (JSC::ARMv7Assembler::replaceWithJump):
1412 (JSC::ARMv7Assembler::maxJumpReplacementSize):
1413 * assembler/AbstractMacroAssembler.h:
1414 (JSC):
1415 (AbstractMacroAssembler):
1416 (Label):
1417 (JSC::AbstractMacroAssembler::watchpointLabel):
1418 (JSC::AbstractMacroAssembler::readPointer):
1419 * assembler/AssemblerBuffer.h:
1420 * assembler/MacroAssemblerARM.h:
1421 (JSC::MacroAssemblerARM::branchTest8):
1422 (MacroAssemblerARM):
1423 (JSC::MacroAssemblerARM::replaceWithJump):
1424 (JSC::MacroAssemblerARM::maxJumpReplacementSize):
1425 * assembler/MacroAssemblerARMv7.h:
1426 (JSC::MacroAssemblerARMv7::load8Signed):
1427 (JSC::MacroAssemblerARMv7::load16Signed):
1428 (MacroAssemblerARMv7):
1429 (JSC::MacroAssemblerARMv7::replaceWithJump):
1430 (JSC::MacroAssemblerARMv7::maxJumpReplacementSize):
1431 (JSC::MacroAssemblerARMv7::branchTest8):
1432 (JSC::MacroAssemblerARMv7::jump):
1433 (JSC::MacroAssemblerARMv7::makeBranch):
1434 * assembler/MacroAssemblerMIPS.h:
1435 (JSC::MacroAssemblerMIPS::branchTest8):
1436 (MacroAssemblerMIPS):
1437 (JSC::MacroAssemblerMIPS::replaceWithJump):
1438 (JSC::MacroAssemblerMIPS::maxJumpReplacementSize):
1439 * assembler/MacroAssemblerSH4.h:
1440 (JSC::MacroAssemblerSH4::branchTest8):
1441 (MacroAssemblerSH4):
1442 (JSC::MacroAssemblerSH4::replaceWithJump):
1443 (JSC::MacroAssemblerSH4::maxJumpReplacementSize):
1444 * assembler/MacroAssemblerX86.h:
1445 (MacroAssemblerX86):
1446 (JSC::MacroAssemblerX86::branchTest8):
1447 * assembler/MacroAssemblerX86Common.h:
1448 (JSC::MacroAssemblerX86Common::replaceWithJump):
1449 (MacroAssemblerX86Common):
1450 (JSC::MacroAssemblerX86Common::maxJumpReplacementSize):
1451 * assembler/MacroAssemblerX86_64.h:
1452 (MacroAssemblerX86_64):
1453 (JSC::MacroAssemblerX86_64::branchTest8):
1454 * assembler/X86Assembler.h:
1455 (JSC::X86Assembler::X86Assembler):
1456 (X86Assembler):
1457 (JSC::X86Assembler::cmpb_im):
1458 (JSC::X86Assembler::testb_im):
1459 (JSC::X86Assembler::labelForWatchpoint):
1460 (JSC::X86Assembler::label):
1461 (JSC::X86Assembler::replaceWithJump):
1462 (JSC::X86Assembler::maxJumpReplacementSize):
1463 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
1464 * bytecode/CodeBlock.cpp:
1465 (JSC):
1466 (JSC::CodeBlock::printGetByIdCacheStatus):
1467 (JSC::CodeBlock::dump):
1468 * bytecode/CodeBlock.h:
1469 (JSC::CodeBlock::appendOSRExit):
1470 (JSC::CodeBlock::appendSpeculationRecovery):
1471 (CodeBlock):
1472 (JSC::CodeBlock::appendWatchpoint):
1473 (JSC::CodeBlock::numberOfWatchpoints):
1474 (JSC::CodeBlock::watchpoint):
1475 (DFGData):
1476 * bytecode/DFGExitProfile.h:
1477 (JSC::DFG::exitKindToString):
1478 (JSC::DFG::exitKindIsCountable):
1479 * bytecode/GetByIdStatus.cpp:
1480 (JSC::GetByIdStatus::computeForChain):
1481 * bytecode/Instruction.h:
1482 (Instruction):
1483 (JSC::Instruction::Instruction):
1484 * bytecode/Opcode.h:
1485 (JSC):
1486 (JSC::padOpcodeName):
1487 * bytecode/Watchpoint.cpp: Added.
1488 (JSC):
1489 (JSC::Watchpoint::~Watchpoint):
1490 (JSC::Watchpoint::correctLabels):
1491 (JSC::Watchpoint::fire):
1492 (JSC::WatchpointSet::WatchpointSet):
1493 (JSC::WatchpointSet::~WatchpointSet):
1494 (JSC::WatchpointSet::add):
1495 (JSC::WatchpointSet::notifyWriteSlow):
1496 (JSC::WatchpointSet::fireAllWatchpoints):
1497 * bytecode/Watchpoint.h: Added.
1498 (JSC):
1499 (Watchpoint):
1500 (JSC::Watchpoint::Watchpoint):
1501 (JSC::Watchpoint::setDestination):
1502 (WatchpointSet):
1503 (JSC::WatchpointSet::isStillValid):
1504 (JSC::WatchpointSet::hasBeenInvalidated):
1505 (JSC::WatchpointSet::startWatching):
1506 (JSC::WatchpointSet::notifyWrite):
1507 (JSC::WatchpointSet::addressOfIsWatched):
1508 * bytecompiler/BytecodeGenerator.cpp:
1509 (JSC::ResolveResult::checkValidity):
1510 (JSC::BytecodeGenerator::addGlobalVar):
1511 (JSC::BytecodeGenerator::BytecodeGenerator):
1512 (JSC::BytecodeGenerator::resolve):
1513 (JSC::BytecodeGenerator::emitResolve):
1514 (JSC::BytecodeGenerator::emitResolveWithBase):
1515 (JSC::BytecodeGenerator::emitResolveWithThis):
1516 (JSC::BytecodeGenerator::emitGetStaticVar):
1517 (JSC::BytecodeGenerator::emitPutStaticVar):
1518 * bytecompiler/BytecodeGenerator.h:
1519 (BytecodeGenerator):
1520 * bytecompiler/NodesCodegen.cpp:
1521 (JSC::FunctionCallResolveNode::emitBytecode):
1522 (JSC::PostfixResolveNode::emitBytecode):
1523 (JSC::PrefixResolveNode::emitBytecode):
1524 (JSC::ReadModifyResolveNode::emitBytecode):
1525 (JSC::AssignResolveNode::emitBytecode):
1526 (JSC::ConstDeclNode::emitCodeSingle):
1527 * dfg/DFGAbstractState.cpp:
1528 (JSC::DFG::AbstractState::execute):
1529 (JSC::DFG::AbstractState::clobberStructures):
1530 * dfg/DFGAbstractState.h:
1531 (AbstractState):
1532 (JSC::DFG::AbstractState::didClobber):
1533 * dfg/DFGByteCodeParser.cpp:
1534 (JSC::DFG::ByteCodeParser::handleInlining):
1535 (JSC::DFG::ByteCodeParser::parseBlock):
1536 * dfg/DFGCCallHelpers.h:
1537 (CCallHelpers):
1538 (JSC::DFG::CCallHelpers::setupArguments):
1539 * dfg/DFGCSEPhase.cpp:
1540 (JSC::DFG::CSEPhase::globalVarWatchpointElimination):
1541 (CSEPhase):
1542 (JSC::DFG::CSEPhase::globalVarStoreElimination):
1543 (JSC::DFG::CSEPhase::performNodeCSE):
1544 * dfg/DFGCapabilities.h:
1545 (JSC::DFG::canCompileOpcode):
1546 * dfg/DFGConstantFoldingPhase.cpp:
1547 (JSC::DFG::ConstantFoldingPhase::run):
1548 * dfg/DFGCorrectableJumpPoint.h:
1549 (JSC::DFG::CorrectableJumpPoint::isSet):
1550 (CorrectableJumpPoint):
1551 * dfg/DFGJITCompiler.cpp:
1552 (JSC::DFG::JITCompiler::linkOSRExits):
1553 (JSC::DFG::JITCompiler::link):
1554 * dfg/DFGNode.h:
1555 (JSC::DFG::Node::hasIdentifierNumberForCheck):
1556 (Node):
1557 (JSC::DFG::Node::identifierNumberForCheck):
1558 (JSC::DFG::Node::hasRegisterPointer):
1559 * dfg/DFGNodeType.h:
1560 (DFG):
1561 * dfg/DFGOSRExit.cpp:
1562 (JSC::DFG::OSRExit::OSRExit):
1563 * dfg/DFGOSRExit.h:
1564 (OSRExit):
1565 * dfg/DFGOperations.cpp:
1566 * dfg/DFGOperations.h:
1567 * dfg/DFGPredictionPropagationPhase.cpp:
1568 (JSC::DFG::PredictionPropagationPhase::propagate):
1569 * dfg/DFGSpeculativeJIT.h:
1570 (JSC::DFG::SpeculativeJIT::callOperation):
1571 (JSC::DFG::SpeculativeJIT::appendCall):
1572 (SpeculativeJIT):
1573 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
1574 * dfg/DFGSpeculativeJIT32_64.cpp:
1575 (JSC::DFG::SpeculativeJIT::compile):
1576 * dfg/DFGSpeculativeJIT64.cpp:
1577 (JSC::DFG::SpeculativeJIT::compile):
1578 * interpreter/Interpreter.cpp:
1579 (JSC::Interpreter::privateExecute):
1580 * jit/JIT.cpp:
1581 (JSC::JIT::privateCompileMainPass):
1582 (JSC::JIT::privateCompileSlowCases):
1583 * jit/JIT.h:
1584 * jit/JITPropertyAccess.cpp:
1585 (JSC::JIT::emit_op_put_global_var_check):
1586 (JSC):
1587 (JSC::JIT::emitSlow_op_put_global_var_check):
1588 * jit/JITPropertyAccess32_64.cpp:
1589 (JSC::JIT::emit_op_put_global_var_check):
1590 (JSC):
1591 (JSC::JIT::emitSlow_op_put_global_var_check):
1592 * jit/JITStubs.cpp:
1593 (JSC::DEFINE_STUB_FUNCTION):
1594 (JSC):
1595 * jit/JITStubs.h:
1596 * llint/LLIntSlowPaths.cpp:
1597 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
1598 (LLInt):
1599 * llint/LLIntSlowPaths.h:
1600 (LLInt):
1601 * llint/LowLevelInterpreter32_64.asm:
1602 * llint/LowLevelInterpreter64.asm:
1603 * runtime/JSObject.cpp:
1604 (JSC::JSObject::removeDirect):
1605 * runtime/JSObject.h:
1606 (JSObject):
1607 * runtime/JSSymbolTableObject.h:
1608 (JSC::symbolTableGet):
1609 (JSC::symbolTablePut):
1610 (JSC::symbolTablePutWithAttributes):
1611 * runtime/SymbolTable.cpp: Added.
1612 (JSC):
1613 (JSC::SymbolTableEntry::copySlow):
1614 (JSC::SymbolTableEntry::freeFatEntrySlow):
1615 (JSC::SymbolTableEntry::couldBeWatched):
1616 (JSC::SymbolTableEntry::attemptToWatch):
1617 (JSC::SymbolTableEntry::addressOfIsWatched):
1618 (JSC::SymbolTableEntry::addWatchpoint):
1619 (JSC::SymbolTableEntry::notifyWriteSlow):
1620 (JSC::SymbolTableEntry::inflateSlow):
1621 * runtime/SymbolTable.h:
1622 (JSC):
1623 (SymbolTableEntry):
1624 (Fast):
1625 (JSC::SymbolTableEntry::Fast::Fast):
1626 (JSC::SymbolTableEntry::Fast::isNull):
1627 (JSC::SymbolTableEntry::Fast::getIndex):
1628 (JSC::SymbolTableEntry::Fast::isReadOnly):
1629 (JSC::SymbolTableEntry::Fast::getAttributes):
1630 (JSC::SymbolTableEntry::Fast::isFat):
1631 (JSC::SymbolTableEntry::SymbolTableEntry):
1632 (JSC::SymbolTableEntry::~SymbolTableEntry):
1633 (JSC::SymbolTableEntry::operator=):
1634 (JSC::SymbolTableEntry::isNull):
1635 (JSC::SymbolTableEntry::getIndex):
1636 (JSC::SymbolTableEntry::getFast):
1637 (JSC::SymbolTableEntry::getAttributes):
1638 (JSC::SymbolTableEntry::isReadOnly):
1639 (JSC::SymbolTableEntry::watchpointSet):
1640 (JSC::SymbolTableEntry::notifyWrite):
1641 (FatEntry):
1642 (JSC::SymbolTableEntry::FatEntry::FatEntry):
1643 (JSC::SymbolTableEntry::isFat):
1644 (JSC::SymbolTableEntry::fatEntry):
1645 (JSC::SymbolTableEntry::inflate):
1646 (JSC::SymbolTableEntry::bits):
1647 (JSC::SymbolTableEntry::freeFatEntry):
1648 (JSC::SymbolTableEntry::pack):
1649 (JSC::SymbolTableEntry::isValidIndex):
1650
zandobersek@gmail.com88d53732012-06-13 09:38:42 +000016512012-06-13 Sheriff Bot <webkit.review.bot@gmail.com>
1652
1653 Unreviewed, rolling out r120172.
1654 http://trac.webkit.org/changeset/120172
1655 https://bugs.webkit.org/show_bug.cgi?id=88976
1656
1657 The patch causes compilation failures on Gtk, Qt and Apple Win
1658 bots (Requested by zdobersek on #webkit).
1659
1660 * CMakeLists.txt:
1661 * GNUmakefile.list.am:
1662 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
1663 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1664 * JavaScriptCore.xcodeproj/project.pbxproj:
1665 * Target.pri:
1666 * assembler/ARMv7Assembler.h:
1667 (JSC::ARMv7Assembler::nop):
1668 (JSC::ARMv7Assembler::label):
1669 (JSC::ARMv7Assembler::readPointer):
1670 (ARMv7Assembler):
1671 * assembler/AbstractMacroAssembler.h:
1672 (JSC):
1673 (AbstractMacroAssembler):
1674 (Label):
1675 * assembler/AssemblerBuffer.h:
1676 * assembler/MacroAssemblerARM.h:
1677 * assembler/MacroAssemblerARMv7.h:
1678 (JSC::MacroAssemblerARMv7::nop):
1679 (JSC::MacroAssemblerARMv7::jump):
1680 (JSC::MacroAssemblerARMv7::makeBranch):
1681 * assembler/MacroAssemblerMIPS.h:
1682 * assembler/MacroAssemblerSH4.h:
1683 * assembler/MacroAssemblerX86.h:
1684 (MacroAssemblerX86):
1685 (JSC::MacroAssemblerX86::moveWithPatch):
1686 * assembler/MacroAssemblerX86Common.h:
1687 * assembler/MacroAssemblerX86_64.h:
1688 (JSC::MacroAssemblerX86_64::branchTest8):
1689 * assembler/X86Assembler.h:
1690 (JSC::X86Assembler::cmpb_im):
1691 (JSC::X86Assembler::codeSize):
1692 (JSC::X86Assembler::label):
1693 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
1694 * bytecode/CodeBlock.cpp:
1695 (JSC::CodeBlock::dump):
1696 * bytecode/CodeBlock.h:
1697 (JSC::CodeBlock::appendOSRExit):
1698 (JSC::CodeBlock::appendSpeculationRecovery):
1699 (DFGData):
1700 * bytecode/DFGExitProfile.h:
1701 (JSC::DFG::exitKindToString):
1702 (JSC::DFG::exitKindIsCountable):
1703 * bytecode/Instruction.h:
1704 * bytecode/Opcode.h:
1705 (JSC):
1706 (JSC::padOpcodeName):
1707 * bytecode/Watchpoint.cpp: Removed.
1708 * bytecode/Watchpoint.h: Removed.
1709 * bytecompiler/BytecodeGenerator.cpp:
1710 (JSC::ResolveResult::checkValidity):
1711 (JSC::BytecodeGenerator::addGlobalVar):
1712 (JSC::BytecodeGenerator::BytecodeGenerator):
1713 (JSC::BytecodeGenerator::resolve):
1714 (JSC::BytecodeGenerator::emitResolve):
1715 (JSC::BytecodeGenerator::emitResolveWithBase):
1716 (JSC::BytecodeGenerator::emitResolveWithThis):
1717 (JSC::BytecodeGenerator::emitGetStaticVar):
1718 (JSC::BytecodeGenerator::emitPutStaticVar):
1719 * bytecompiler/BytecodeGenerator.h:
1720 (BytecodeGenerator):
1721 * bytecompiler/NodesCodegen.cpp:
1722 (JSC::FunctionCallResolveNode::emitBytecode):
1723 (JSC::PostfixResolveNode::emitBytecode):
1724 (JSC::PrefixResolveNode::emitBytecode):
1725 (JSC::ReadModifyResolveNode::emitBytecode):
1726 (JSC::AssignResolveNode::emitBytecode):
1727 (JSC::ConstDeclNode::emitCodeSingle):
1728 * dfg/DFGAbstractState.cpp:
1729 (JSC::DFG::AbstractState::execute):
1730 (JSC::DFG::AbstractState::clobberStructures):
1731 * dfg/DFGAbstractState.h:
1732 (AbstractState):
1733 * dfg/DFGByteCodeParser.cpp:
1734 (JSC::DFG::ByteCodeParser::handleInlining):
1735 (JSC::DFG::ByteCodeParser::parseBlock):
1736 * dfg/DFGCCallHelpers.h:
1737 (JSC::DFG::CCallHelpers::setupArguments):
1738 * dfg/DFGCSEPhase.cpp:
1739 (JSC::DFG::CSEPhase::globalVarStoreElimination):
1740 (JSC::DFG::CSEPhase::performNodeCSE):
1741 * dfg/DFGCapabilities.h:
1742 (JSC::DFG::canCompileOpcode):
1743 * dfg/DFGConstantFoldingPhase.cpp:
1744 (JSC::DFG::ConstantFoldingPhase::run):
1745 * dfg/DFGCorrectableJumpPoint.h:
1746 * dfg/DFGJITCompiler.cpp:
1747 (JSC::DFG::JITCompiler::linkOSRExits):
1748 (JSC::DFG::JITCompiler::link):
1749 * dfg/DFGNode.h:
1750 (JSC::DFG::Node::hasRegisterPointer):
1751 * dfg/DFGNodeType.h:
1752 (DFG):
1753 * dfg/DFGOSRExit.cpp:
1754 (JSC::DFG::OSRExit::OSRExit):
1755 * dfg/DFGOSRExit.h:
1756 (OSRExit):
1757 * dfg/DFGOperations.cpp:
1758 * dfg/DFGOperations.h:
1759 * dfg/DFGPredictionPropagationPhase.cpp:
1760 (JSC::DFG::PredictionPropagationPhase::propagate):
1761 * dfg/DFGSpeculativeJIT.h:
1762 (JSC::DFG::SpeculativeJIT::callOperation):
1763 (JSC::DFG::SpeculativeJIT::appendCallSetResult):
1764 (JSC::DFG::SpeculativeJIT::speculationCheck):
1765 * dfg/DFGSpeculativeJIT32_64.cpp:
1766 (JSC::DFG::SpeculativeJIT::compile):
1767 * dfg/DFGSpeculativeJIT64.cpp:
1768 (JSC::DFG::SpeculativeJIT::compile):
1769 * jit/JIT.cpp:
1770 (JSC::JIT::privateCompileMainPass):
1771 (JSC::JIT::privateCompileSlowCases):
1772 * jit/JIT.h:
1773 * jit/JITPropertyAccess.cpp:
1774 * jit/JITPropertyAccess32_64.cpp:
1775 * jit/JITStubs.cpp:
1776 * jit/JITStubs.h:
1777 * llint/LLIntSlowPaths.cpp:
1778 * llint/LLIntSlowPaths.h:
1779 (LLInt):
1780 * llint/LowLevelInterpreter32_64.asm:
1781 * llint/LowLevelInterpreter64.asm:
1782 * runtime/JSObject.cpp:
1783 (JSC::JSObject::removeDirect):
1784 * runtime/JSObject.h:
1785 (JSObject):
1786 * runtime/JSSymbolTableObject.h:
1787 (JSC::symbolTableGet):
1788 (JSC::symbolTablePut):
1789 (JSC::symbolTablePutWithAttributes):
1790 * runtime/SymbolTable.cpp: Removed.
1791 * runtime/SymbolTable.h:
1792 (JSC):
1793 (JSC::SymbolTableEntry::isNull):
1794 (JSC::SymbolTableEntry::getIndex):
1795 (SymbolTableEntry):
1796 (JSC::SymbolTableEntry::getAttributes):
1797 (JSC::SymbolTableEntry::isReadOnly):
1798 (JSC::SymbolTableEntry::pack):
1799 (JSC::SymbolTableEntry::isValidIndex):
1800
fpizlo@apple.com3bdd4c92012-06-13 04:56:22 +000018012012-06-12 Filip Pizlo <fpizlo@apple.com>
1802
fpizlo@apple.comb6c5eeb2012-06-13 08:20:39 +00001803 DFG should be able to set watchpoints on global variables
1804 https://bugs.webkit.org/show_bug.cgi?id=88692
1805
1806 Reviewed by Geoffrey Garen.
1807
1808 This implements global variable constant folding by allowing the optimizing
1809 compiler to set a "watchpoint" on globals that it wishes to constant fold.
1810 If the watchpoint fires, then an OSR exit is forced by overwriting the
1811 machine code that the optimizing compiler generated with a jump.
1812
1813 As such, this patch is adding quite a bit of stuff:
1814
1815 - Jump replacement on those hardware targets supported by the optimizing
1816 JIT. It is now possible to patch in a jump instruction over any recorded
1817 watchpoint label. The jump must be "local" in the sense that it must be
1818 within the range of the largest jump distance supported by a one
1819 instruction jump.
1820
1821 - WatchpointSets and Watchpoints. A Watchpoint is a doubly-linked list node
1822 that records the location where a jump must be inserted and the
1823 destination to which it should jump. Watchpoints can be added to a
1824 WatchpointSet. The WatchpointSet can be fired all at once, which plants
1825 all jumps. WatchpointSet also remembers if it had ever been invalidated,
1826 which allows for monotonicity: we typically don't want to optimize using
1827 watchpoints on something for which watchpoints had previously fired. The
1828 act of notifying a WatchpointSet has a trivial fast path in case no
1829 Watchpoints are registered (one-byte load+branch).
1830
1831 - SpeculativeJIT::speculationWatchpoint(). It's like speculationCheck(),
1832 except that you don't have to emit branches. But, you need to know what
1833 WatchpointSet to add the resulting Watchpoint to. Not everything that
1834 you could write a speculationCheck() for will have a WatchpointSet that
1835 would get notified if the condition you were speculating against became
1836 invalid.
1837
1838 - SymbolTableEntry now has the ability to refer to a WatchpointSet. It can
1839 do so without incurring any space overhead for those entries that don't
1840 have WatchpointSets.
1841
1842 - The bytecode generator infers all global function variables to be
1843 watchable, and makes all stores perform the WatchpointSet's write check,
1844 and marks all loads as being potentially watchable (i.e. you can compile
1845 them to a watchpoint and a constant).
1846
1847 Put together, this allows for fully sleazy inlining of calls to globally
1848 declared functions. The inline prologue will no longer contain the load of
1849 the function, or any checks of the function you're calling. I.e. it's
1850 pretty much like the kind of inlining you would see in Java or C++.
1851 Furthermore, the watchpointing functionality is built to be fairly general,
1852 and should allow setting watchpoints on all sorts of interesting things
1853 in the future.
1854
1855 The sleazy inlining means that we will now sometimes inline in code paths
1856 that have never executed. Previously, to inline we would have either had
1857 to have executed the call (to read the call's inline cache) or have
1858 executed the method check (to read the method check's inline cache). Now,
1859 we might inline when the callee is a watched global variable. This
1860 revealed some humorous bugs. First, constant folding disagreed with CFA
1861 over what kinds of operations can clobber (example: code path A is dead
1862 but stores a String into variable X, all other code paths store 0 into
1863 X, and then you do CompareEq(X, 0) - CFA will say that this is a non-
1864 clobbering constant, but constant folding thought it was clobbering
1865 because it saw the String prediction). Second, inlining would crash if
1866 the inline callee had not been compiled. This patch fixes both bugs,
1867 since otherwise run-javascriptcore-tests would report regressions.
1868
1869 * CMakeLists.txt:
1870 * GNUmakefile.list.am:
1871 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1872 * JavaScriptCore.xcodeproj/project.pbxproj:
1873 * Target.pri:
1874 * assembler/ARMv7Assembler.h:
1875 (ARMv7Assembler):
1876 (JSC::ARMv7Assembler::ARMv7Assembler):
1877 (JSC::ARMv7Assembler::labelForWatchpoint):
1878 (JSC::ARMv7Assembler::label):
1879 (JSC::ARMv7Assembler::replaceWithJump):
1880 (JSC::ARMv7Assembler::maxJumpReplacementSize):
1881 * assembler/AbstractMacroAssembler.h:
1882 (JSC):
1883 (AbstractMacroAssembler):
1884 (Label):
1885 (JSC::AbstractMacroAssembler::watchpointLabel):
1886 * assembler/AssemblerBuffer.h:
1887 * assembler/MacroAssemblerARM.h:
1888 (JSC::MacroAssemblerARM::replaceWithJump):
1889 (MacroAssemblerARM):
1890 (JSC::MacroAssemblerARM::maxJumpReplacementSize):
1891 * assembler/MacroAssemblerARMv7.h:
1892 (MacroAssemblerARMv7):
1893 (JSC::MacroAssemblerARMv7::replaceWithJump):
1894 (JSC::MacroAssemblerARMv7::maxJumpReplacementSize):
1895 (JSC::MacroAssemblerARMv7::branchTest8):
1896 (JSC::MacroAssemblerARMv7::jump):
1897 (JSC::MacroAssemblerARMv7::makeBranch):
1898 * assembler/MacroAssemblerMIPS.h:
1899 (JSC::MacroAssemblerMIPS::replaceWithJump):
1900 (MacroAssemblerMIPS):
1901 (JSC::MacroAssemblerMIPS::maxJumpReplacementSize):
1902 * assembler/MacroAssemblerSH4.h:
1903 (JSC::MacroAssemblerSH4::replaceWithJump):
1904 (MacroAssemblerSH4):
1905 (JSC::MacroAssemblerSH4::maxJumpReplacementSize):
1906 * assembler/MacroAssemblerX86.h:
1907 (MacroAssemblerX86):
1908 (JSC::MacroAssemblerX86::branchTest8):
1909 * assembler/MacroAssemblerX86Common.h:
1910 (JSC::MacroAssemblerX86Common::replaceWithJump):
1911 (MacroAssemblerX86Common):
1912 (JSC::MacroAssemblerX86Common::maxJumpReplacementSize):
1913 * assembler/MacroAssemblerX86_64.h:
1914 (MacroAssemblerX86_64):
1915 (JSC::MacroAssemblerX86_64::branchTest8):
1916 * assembler/X86Assembler.h:
1917 (JSC::X86Assembler::X86Assembler):
1918 (X86Assembler):
1919 (JSC::X86Assembler::cmpb_im):
1920 (JSC::X86Assembler::testb_im):
1921 (JSC::X86Assembler::labelForWatchpoint):
1922 (JSC::X86Assembler::label):
1923 (JSC::X86Assembler::replaceWithJump):
1924 (JSC::X86Assembler::maxJumpReplacementSize):
1925 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
1926 * bytecode/CodeBlock.cpp:
1927 (JSC::CodeBlock::dump):
1928 * bytecode/CodeBlock.h:
1929 (JSC::CodeBlock::appendOSRExit):
1930 (JSC::CodeBlock::appendSpeculationRecovery):
1931 (CodeBlock):
1932 (JSC::CodeBlock::appendWatchpoint):
1933 (JSC::CodeBlock::numberOfWatchpoints):
1934 (JSC::CodeBlock::watchpoint):
1935 (DFGData):
1936 * bytecode/DFGExitProfile.h:
1937 (JSC::DFG::exitKindToString):
1938 (JSC::DFG::exitKindIsCountable):
1939 * bytecode/Instruction.h:
1940 (Instruction):
1941 (JSC::Instruction::Instruction):
1942 * bytecode/Opcode.h:
1943 (JSC):
1944 (JSC::padOpcodeName):
1945 * bytecode/Watchpoint.cpp: Added.
1946 (JSC):
1947 (JSC::Watchpoint::~Watchpoint):
1948 (JSC::Watchpoint::correctLabels):
1949 (JSC::Watchpoint::fire):
1950 (JSC::WatchpointSet::WatchpointSet):
1951 (JSC::WatchpointSet::~WatchpointSet):
1952 (JSC::WatchpointSet::add):
1953 (JSC::WatchpointSet::notifyWriteSlow):
1954 (JSC::WatchpointSet::fireAllWatchpoints):
1955 * bytecode/Watchpoint.h: Added.
1956 (JSC):
1957 (Watchpoint):
1958 (JSC::Watchpoint::Watchpoint):
1959 (JSC::Watchpoint::setDestination):
1960 (WatchpointSet):
1961 (JSC::WatchpointSet::isStillValid):
1962 (JSC::WatchpointSet::hasBeenInvalidated):
1963 (JSC::WatchpointSet::startWatching):
1964 (JSC::WatchpointSet::notifyWrite):
1965 (JSC::WatchpointSet::addressOfIsWatched):
1966 * bytecompiler/BytecodeGenerator.cpp:
1967 (JSC::ResolveResult::checkValidity):
1968 (JSC::BytecodeGenerator::addGlobalVar):
1969 (JSC::BytecodeGenerator::BytecodeGenerator):
1970 (JSC::BytecodeGenerator::resolve):
1971 (JSC::BytecodeGenerator::emitResolve):
1972 (JSC::BytecodeGenerator::emitResolveWithBase):
1973 (JSC::BytecodeGenerator::emitResolveWithThis):
1974 (JSC::BytecodeGenerator::emitGetStaticVar):
1975 (JSC::BytecodeGenerator::emitPutStaticVar):
1976 * bytecompiler/BytecodeGenerator.h:
1977 (BytecodeGenerator):
1978 * bytecompiler/NodesCodegen.cpp:
1979 (JSC::FunctionCallResolveNode::emitBytecode):
1980 (JSC::PostfixResolveNode::emitBytecode):
1981 (JSC::PrefixResolveNode::emitBytecode):
1982 (JSC::ReadModifyResolveNode::emitBytecode):
1983 (JSC::AssignResolveNode::emitBytecode):
1984 (JSC::ConstDeclNode::emitCodeSingle):
1985 * dfg/DFGAbstractState.cpp:
1986 (JSC::DFG::AbstractState::execute):
1987 (JSC::DFG::AbstractState::clobberStructures):
1988 * dfg/DFGAbstractState.h:
1989 (AbstractState):
1990 (JSC::DFG::AbstractState::didClobber):
1991 * dfg/DFGByteCodeParser.cpp:
1992 (JSC::DFG::ByteCodeParser::handleInlining):
1993 (JSC::DFG::ByteCodeParser::parseBlock):
1994 * dfg/DFGCCallHelpers.h:
1995 (CCallHelpers):
1996 (JSC::DFG::CCallHelpers::setupArguments):
1997 * dfg/DFGCSEPhase.cpp:
1998 (JSC::DFG::CSEPhase::globalVarWatchpointElimination):
1999 (CSEPhase):
2000 (JSC::DFG::CSEPhase::globalVarStoreElimination):
2001 (JSC::DFG::CSEPhase::performNodeCSE):
2002 * dfg/DFGCapabilities.h:
2003 (JSC::DFG::canCompileOpcode):
2004 * dfg/DFGConstantFoldingPhase.cpp:
2005 (JSC::DFG::ConstantFoldingPhase::run):
2006 * dfg/DFGCorrectableJumpPoint.h:
2007 (JSC::DFG::CorrectableJumpPoint::isSet):
2008 (CorrectableJumpPoint):
2009 * dfg/DFGJITCompiler.cpp:
2010 (JSC::DFG::JITCompiler::linkOSRExits):
2011 (JSC::DFG::JITCompiler::link):
2012 * dfg/DFGNode.h:
2013 (JSC::DFG::Node::hasIdentifierNumberForCheck):
2014 (Node):
2015 (JSC::DFG::Node::identifierNumberForCheck):
2016 (JSC::DFG::Node::hasRegisterPointer):
2017 * dfg/DFGNodeType.h:
2018 (DFG):
2019 * dfg/DFGOSRExit.cpp:
2020 (JSC::DFG::OSRExit::OSRExit):
2021 * dfg/DFGOSRExit.h:
2022 (OSRExit):
2023 * dfg/DFGOperations.cpp:
2024 * dfg/DFGOperations.h:
2025 * dfg/DFGPredictionPropagationPhase.cpp:
2026 (JSC::DFG::PredictionPropagationPhase::propagate):
2027 * dfg/DFGSpeculativeJIT.h:
2028 (JSC::DFG::SpeculativeJIT::callOperation):
2029 (JSC::DFG::SpeculativeJIT::appendCall):
2030 (SpeculativeJIT):
2031 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
2032 * dfg/DFGSpeculativeJIT32_64.cpp:
2033 (JSC::DFG::SpeculativeJIT::compile):
2034 * dfg/DFGSpeculativeJIT64.cpp:
2035 (JSC::DFG::SpeculativeJIT::compile):
2036 * jit/JIT.cpp:
2037 (JSC::JIT::privateCompileMainPass):
2038 (JSC::JIT::privateCompileSlowCases):
2039 * jit/JIT.h:
2040 * jit/JITPropertyAccess.cpp:
2041 (JSC::JIT::emit_op_put_global_var_check):
2042 (JSC):
2043 (JSC::JIT::emitSlow_op_put_global_var_check):
2044 * jit/JITPropertyAccess32_64.cpp:
2045 (JSC::JIT::emit_op_put_global_var_check):
2046 (JSC):
2047 (JSC::JIT::emitSlow_op_put_global_var_check):
2048 * jit/JITStubs.cpp:
2049 (JSC::JITThunks::JITThunks):
2050 (JSC::DEFINE_STUB_FUNCTION):
2051 (JSC):
2052 * jit/JITStubs.h:
2053 * llint/LLIntSlowPaths.cpp:
2054 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
2055 (LLInt):
2056 * llint/LLIntSlowPaths.h:
2057 (LLInt):
2058 * llint/LowLevelInterpreter32_64.asm:
2059 * llint/LowLevelInterpreter64.asm:
2060 * runtime/JSObject.cpp:
2061 (JSC::JSObject::removeDirect):
2062 * runtime/JSObject.h:
2063 (JSObject):
2064 * runtime/JSSymbolTableObject.h:
2065 (JSC::symbolTableGet):
2066 (JSC::symbolTablePut):
2067 (JSC::symbolTablePutWithAttributes):
2068 * runtime/SymbolTable.cpp: Added.
2069 (JSC):
2070 (JSC::SymbolTableEntry::copySlow):
2071 (JSC::SymbolTableEntry::freeFatEntrySlow):
2072 (JSC::SymbolTableEntry::couldBeWatched):
2073 (JSC::SymbolTableEntry::attemptToWatch):
2074 (JSC::SymbolTableEntry::addressOfIsWatched):
2075 (JSC::SymbolTableEntry::addWatchpoint):
2076 (JSC::SymbolTableEntry::notifyWriteSlow):
2077 (JSC::SymbolTableEntry::inflateSlow):
2078 * runtime/SymbolTable.h:
2079 (JSC):
2080 (SymbolTableEntry):
2081 (Fast):
2082 (JSC::SymbolTableEntry::Fast::Fast):
2083 (JSC::SymbolTableEntry::Fast::isNull):
2084 (JSC::SymbolTableEntry::Fast::getIndex):
2085 (JSC::SymbolTableEntry::Fast::isReadOnly):
2086 (JSC::SymbolTableEntry::Fast::getAttributes):
2087 (JSC::SymbolTableEntry::Fast::isFat):
2088 (JSC::SymbolTableEntry::SymbolTableEntry):
2089 (JSC::SymbolTableEntry::~SymbolTableEntry):
2090 (JSC::SymbolTableEntry::operator=):
2091 (JSC::SymbolTableEntry::isNull):
2092 (JSC::SymbolTableEntry::getIndex):
2093 (JSC::SymbolTableEntry::getFast):
2094 (JSC::SymbolTableEntry::getAttributes):
2095 (JSC::SymbolTableEntry::isReadOnly):
2096 (JSC::SymbolTableEntry::watchpointSet):
2097 (JSC::SymbolTableEntry::notifyWrite):
2098 (FatEntry):
2099 (JSC::SymbolTableEntry::FatEntry::FatEntry):
2100 (JSC::SymbolTableEntry::isFat):
2101 (JSC::SymbolTableEntry::fatEntry):
2102 (JSC::SymbolTableEntry::inflate):
2103 (JSC::SymbolTableEntry::bits):
2104 (JSC::SymbolTableEntry::freeFatEntry):
2105 (JSC::SymbolTableEntry::pack):
2106 (JSC::SymbolTableEntry::isValidIndex):
2107
21082012-06-12 Filip Pizlo <fpizlo@apple.com>
2109
fpizlo@apple.com3bdd4c92012-06-13 04:56:22 +00002110 Unreviewed build fix for ARMv7 debug builds.
2111
2112 * jit/JITStubs.cpp:
2113 (JSC::JITThunks::JITThunks):
2114
ggaren@apple.com3c89f392012-06-13 02:50:50 +000021152012-06-12 Geoffrey Garen <ggaren@apple.com>
2116
2117 Build fix for case-sensitive file systems: use the right case.
2118
2119 * heap/ListableHandler.h:
2120
ggaren@apple.com639160c2012-06-13 02:06:50 +000021212012-06-11 Geoffrey Garen <ggaren@apple.com>
2122
2123 GC should be 1.7X faster
2124 https://bugs.webkit.org/show_bug.cgi?id=88840
2125
2126 Reviewed by Oliver Hunt.
2127
2128 I profiled, and removed anything that showed up as a concurrency
2129 bottleneck. Then, I added 3 threads to our max thread count, since we
2130 can scale up to more threads now.
2131
2132 * heap/BlockAllocator.cpp:
2133 (JSC::BlockAllocator::BlockAllocator):
2134 (JSC::BlockAllocator::~BlockAllocator):
2135 (JSC::BlockAllocator::releaseFreeBlocks):
2136 (JSC::BlockAllocator::waitForRelativeTimeWhileHoldingLock):
2137 (JSC::BlockAllocator::waitForRelativeTime):
2138 (JSC::BlockAllocator::blockFreeingThreadMain):
2139 * heap/BlockAllocator.h:
2140 (BlockAllocator):
2141 (JSC::BlockAllocator::allocate):
2142 (JSC::BlockAllocator::deallocate): Use a spin lock for the common case
2143 where we're just popping a linked list. (A pthread mutex would sleep our
2144 thread even if the lock were only contended for a microsecond.)
2145
2146 Scope the lock to avoid holding it while allocating VM, since that's a
2147 slow activity and it doesn't modify any of our data structures.
2148
2149 We still use a pthread mutex to handle our condition variable since we
2150 have to, and it's not a hot path.
2151
2152 * heap/CopiedSpace.cpp:
2153 (JSC::CopiedSpace::CopiedSpace):
2154 (JSC::CopiedSpace::doneFillingBlock):
2155 * heap/CopiedSpace.h:
2156 (JSC::CopiedSpace::CopiedSpace): Use a spin lock for the to space lock,
2157 since it just guards linked list and hash table manipulation.
2158
2159 * heap/MarkStack.cpp:
2160 (JSC::MarkStackSegmentAllocator::MarkStackSegmentAllocator):
2161 (JSC::MarkStackSegmentAllocator::allocate):
2162 (JSC::MarkStackSegmentAllocator::release):
2163 (JSC::MarkStackSegmentAllocator::shrinkReserve): Use a spin lock, since
2164 we're just managing a linked list.
2165
2166 (JSC::MarkStackArray::donateSomeCellsTo): Changed donation to be proportional
2167 to our current stack size. This fixes cases where we used to donate too
2168 much. Interestingly, donating too much was starving the donor (when it
2169 ran out of work later) *and* the recipient (since it had to wait on a
2170 long donation operation to complete before it could acquire the lock).
2171
2172 In the worst case, we're still guaranteed to donate N cells in roughly log N time.
2173
2174 This change also fixes cases where we used to donate too little, since
2175 we would always keep a fixed minimum number of cells. In the worst case,
2176 with N marking threads, would could have N large object graph roots in
2177 our stack for the duration of GC, and scale to only 1 thread.
2178
2179 It's an interesting observation that a single object in the mark stack
2180 might represent an arbitrarily large object graph -- and only the act
2181 of marking can find out.
2182
2183 (JSC::MarkStackArray::stealSomeCellsFrom): Steal in proportion to idle
2184 threads. Once again, this fixes cases where constants could cause us
2185 to steal too much or too little.
2186
2187 (JSC::SlotVisitor::donateKnownParallel): Always wake up other threads
2188 if they're idle. We can afford to do this because we're conservative
2189 about when we donate.
2190
2191 (JSC::SlotVisitor::drainFromShared):
2192 * heap/MarkStack.h:
2193 (MarkStackSegmentAllocator):
2194 (MarkStackArray):
2195 (JSC):
2196 * heap/SlotVisitor.h: Merged the "should I donate?" decision into a
2197 single function, for simplicity.
2198
2199 * runtime/Options.cpp:
2200 (minimumNumberOfScansBetweenRebalance): Reduced the delay before donation
2201 a lot. We can afford to do this because, in the common case, donation is
2202 a single branch that decides not to donate.
2203
2204 (cpusToUse): Use more CPUs now, since we scale better now.
2205
2206 * runtime/Options.h:
2207 (Options): Removed now-unused variables.
2208
fpizlo@apple.com53ef1042012-06-13 01:29:07 +000022092012-06-12 Filip Pizlo <fpizlo@apple.com>
2210
2211 REGRESSION(120121): inspector tests crash in DFG
2212 https://bugs.webkit.org/show_bug.cgi?id=88941
2213
2214 Reviewed by Geoffrey Garen.
2215
2216 The CFG simplifier has two different ways of fixing up GetLocal, Phantom, and Flush. If we've
2217 already fixed up the node one way, we shouldn't try the other way. The reason why we shouldn't
2218 is that the second way depends on the node referring to other nodes in the to-be-jettisoned
2219 block. After fixup they potentially will refer to nodes in the block being merged to.
2220
2221 * dfg/DFGCFGSimplificationPhase.cpp:
2222 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
2223 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
2224
leo.yang@torchmobile.com.cneac79cd2012-06-13 00:23:49 +000022252012-06-12 Leo Yang <leo.yang@torchmobile.com.cn>
2226
2227 Dynamic hash table in DOMObjectHashTableMap is wrong in multiple threads
2228 https://bugs.webkit.org/show_bug.cgi?id=87334
2229
2230 Reviewed by Geoffrey Garen.
2231
2232 Add a copy member function to JSC::HasTable. This function will copy all data
2233 members except for *table* which contains thread specific data that prevents
2234 up copying it. When you want to copy a JSC::HashTable that was constructed
2235 on another thread you should call JSC::HashTable::copy().
2236
2237 * runtime/Lookup.h:
2238 (JSC::HashTable::copy):
2239 (HashTable):
2240
fpizlo@apple.comdfd92802012-06-12 21:15:43 +000022412012-06-12 Filip Pizlo <fpizlo@apple.com>
2242
fpizlo@apple.com888325a2012-06-12 23:16:51 +00002243 DFG should not ASSERT if you have a double use of a variable that is not revealed to be a double
2244 until after CFG simplification
2245 https://bugs.webkit.org/show_bug.cgi?id=88927
2246 <rdar://problem/11513971>
2247
2248 Reviewed by Geoffrey Garen.
2249
2250 Speculation fixup needs to run if simplification did things, because simplification can change
2251 predictions - particularly if you had a control flow path that stored weird things into a
2252 variable, but that path got axed by the simplifier.
2253
2254 Running fixup in the fixpoint requires making it idempotent, which it previously wasn't. Only
2255 one place needed to be changed, namely the un-MustGenerate-ion of ValueToInt32.
2256
2257 * dfg/DFGDriver.cpp:
2258 (JSC::DFG::compile):
2259 * dfg/DFGFixupPhase.cpp:
2260 (JSC::DFG::FixupPhase::fixupNode):
2261
22622012-06-12 Filip Pizlo <fpizlo@apple.com>
2263
fpizlo@apple.comdfd92802012-06-12 21:15:43 +00002264 REGRESSION (r119779): Javascript TypeError: 'undefined' is not an object
2265 https://bugs.webkit.org/show_bug.cgi?id=88783
2266 <rdar://problem/11640299>
2267
2268 Reviewed by Geoffrey Garen.
2269
2270 If you don't keep alive the base of an object access over the various checks
2271 you do for the prototype chain, you're going to have a bad time.
2272
2273 * dfg/DFGByteCodeParser.cpp:
2274 (JSC::DFG::ByteCodeParser::handleGetById):
2275
commit-queue@webkit.orgce7e7ef2012-06-12 07:08:14 +000022762012-06-12 Hojong Han <hojong.han@samsung.com>
2277
2278 Property names of the built-in object cannot be retrieved
2279 after trying to delete one of its properties
2280 https://bugs.webkit.org/show_bug.cgi?id=86461
2281
2282 Reviewed by Gavin Barraclough.
2283
2284 * runtime/JSObject.cpp:
2285 (JSC::getClassPropertyNames):
2286 (JSC::JSObject::getOwnPropertyNames):
2287
gyuyoung.kim@samsung.com7a201592012-06-12 00:58:24 +000022882012-06-11 Gyuyoung Kim <gyuyoung.kim@samsung.com>
2289
2290 [CMAKE][EFL] Remove duplicated executable output path
2291 https://bugs.webkit.org/show_bug.cgi?id=88765
2292
2293 Reviewed by Daniel Bates.
2294
2295 CMake files for EFL port have redefined executable output path. However, EFL port doesn't
2296 need to define again because it is already defined in top-level CMake file.
2297
2298 * shell/CMakeLists.txt:
2299
carlosgc@webkit.orgf4fbe002012-06-11 15:31:19 +000023002012-06-11 Carlos Garcia Campos <cgarcia@igalia.com>
2301
2302 Unreviewed. Fix make distcheck issues.
2303
2304 * GNUmakefile.list.am: Remove non existent header file.
2305
paroga@webkit.org7a01e282012-06-10 12:25:57 +000023062012-06-10 Patrick Gansterer <paroga@webkit.org>
2307
paroga@webkit.orga601a8b2012-06-10 12:49:32 +00002308 Unreviewed. Build fix for !ENABLE(JIT) after r119844 and r119925.
2309
2310 * runtime/Executable.h:
2311 (ExecutableBase):
2312 (JSC::ExecutableBase::clearCodeVirtual):
2313
23142012-06-10 Patrick Gansterer <paroga@webkit.org>
2315
paroga@webkit.org7a01e282012-06-10 12:25:57 +00002316 Unreviewed. Build fix for !ENABLE(JIT) after r119844.
2317
2318 * runtime/Executable.h:
2319 (ExecutableBase):
2320 (JSC):
2321
dominicc@chromium.org2a95e332012-06-10 06:31:14 +000023222012-06-09 Dominic Cooney <dominicc@chromium.org>
2323
2324 [Chromium] Remove JavaScriptCore dependencies from gyp
2325 https://bugs.webkit.org/show_bug.cgi?id=88510
2326
2327 Reviewed by Adam Barth.
2328
2329 Chromium doesn't support JSC any more and there doesn't seem to be
2330 a strong interest in using GYP as the common build system in other
2331 ports.
2332
2333 * JavaScriptCore.gyp/JavaScriptCore.gyp: WebCore still depends on YARR interpreter.
2334 * JavaScriptCore.gypi: Only include YARR source.
2335 * gyp/JavaScriptCore.gyp: Removed.
2336 * gyp/gtk.gyp: Removed.
2337
ggaren@apple.com642da3e2012-06-09 17:34:30 +000023382012-06-09 Geoffrey Garen <ggaren@apple.com>
2339
2340 Unreviewed, rolling back in part2 of r118646.
2341
2342 This patch removes eager finalization.
2343
2344 Weak pointer finalization should be lazy
2345 https://bugs.webkit.org/show_bug.cgi?id=87599
2346
2347 Reviewed by Sam Weinig.
2348
2349 * heap/Heap.cpp:
2350 (JSC::Heap::collect): Don't finalize eagerly -- we'll do it lazily.
2351
2352 * heap/MarkedBlock.cpp:
2353 (JSC::MarkedBlock::sweep): Do sweep weak sets when sweeping a block,
2354 since we won't get another chance.
2355
2356 * heap/MarkedBlock.h:
2357 (JSC::MarkedBlock::sweepWeakSet):
2358 * heap/MarkedSpace.cpp:
2359 (MarkedSpace::WeakSetSweep):
2360 * heap/MarkedSpace.h:
2361 (JSC::MarkedSpace::sweepWeakSets): Removed now-unused code.
2362
commit-queue@webkit.org5deb7492012-06-09 09:05:22 +000023632012-06-09 Sukolsak Sakshuwong <sukolsak@google.com>
2364
2365 Add UNDO_MANAGER flag
2366 https://bugs.webkit.org/show_bug.cgi?id=87908
2367
2368 Reviewed by Tony Chang.
2369
2370 * Configurations/FeatureDefines.xcconfig:
2371
ggaren@apple.com642da3e2012-06-09 17:34:30 +000023722012-06-08 Geoffrey Garen <ggaren@apple.com>
ggaren@apple.com218a16a2012-06-08 23:57:58 +00002373
2374 Unreviewed, rolling back in part1 of r118646.
2375
2376 This patch includes everything necessary for lazy finalization, but
2377 keeps eager finalization enabled for the time being.
2378
2379 Weak pointer finalization should be lazy
2380 https://bugs.webkit.org/show_bug.cgi?id=87599
2381
2382 Reviewed by Sam Weinig.
2383
2384 * heap/MarkedBlock.cpp:
2385 * heap/MarkedBlock.h:
2386 (JSC::MarkedBlock::resetAllocator):
2387 * heap/MarkedSpace.cpp:
2388 (JSC::MarkedSpace::resetAllocators):
2389 * heap/MarkedSpace.h:
2390 (JSC::MarkedSpace::resetAllocators): Don't force allocator reset anymore.
2391 It will happen automatically when a weak set is swept. It's simpler to
2392 have only one canonical way for this to happen, and it wasn't buying
2393 us anything to do it eagerly.
2394 * heap/WeakBlock.cpp:
2395 (JSC::WeakBlock::sweep): Don't short-circuit a sweep unless we know
2396 the sweep would be a no-op. If even one finalizer is pending, we need to
2397 run it, since we won't get another chance.
2398 * heap/WeakSet.cpp:
2399 (JSC::WeakSet::sweep): This loop can be simpler now that
2400 WeakBlock::sweep() does what we mean.
2401 Reset our allocator after a sweep because this is the optimal time to
2402 start trying to recycle old weak pointers.
2403 (JSC::WeakSet::tryFindAllocator): Don't sweep when searching for an
2404 allocator because we've swept already, and forcing a new sweep would be
2405 wasteful.
2406 * heap/WeakSet.h:
2407 (JSC::WeakSet::shrink): Be sure to reset our allocator after a shrink
2408 because the shrink may have removed the block the allocator was going to
2409 allocate out of.
2410
barraclough@apple.com9dd771c2012-06-08 21:30:35 +000024112012-06-08 Gavin Barraclough <barraclough@apple.com>
2412
2413 Unreviewed roll out r119795.
2414
2415 This broke jquery/core.html
2416
2417 * dfg/DFGSpeculativeJIT.h:
2418 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
2419 * jit/JITInlineMethods.h:
2420 (JSC::JIT::emitAllocateBasicJSObject):
2421 * llint/LowLevelInterpreter.asm:
2422 * runtime/JSGlobalData.h:
2423 (JSGlobalData):
2424 * runtime/JSGlobalThis.cpp:
2425 (JSC::JSGlobalThis::setUnwrappedObject):
2426 * runtime/JSObject.cpp:
2427 (JSC::JSObject::visitChildren):
2428 (JSC::JSObject::createInheritorID):
2429 * runtime/JSObject.h:
2430 (JSObject):
2431 (JSC::JSObject::resetInheritorID):
2432 (JSC):
2433 (JSC::JSObject::offsetOfInheritorID):
2434 (JSC::JSObject::inheritorID):
2435
fpizlo@apple.com0bcbc112012-06-08 20:02:57 +000024362012-06-08 Filip Pizlo <fpizlo@apple.com>
2437
2438 PredictedType should be called SpeculatedType
2439 https://bugs.webkit.org/show_bug.cgi?id=88477
2440
2441 Unreviewed, fix a renaming goof from http://trac.webkit.org/changeset/119660.
2442 I accidentally renamed ByteCodeParser::getPrediction to
2443 ByteCodeParser::getSpeculation. That was not the intent. This changes it
2444 back.
2445
2446 * dfg/DFGByteCodeParser.cpp:
2447 (JSC::DFG::ByteCodeParser::addCall):
2448 (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
2449 (JSC::DFG::ByteCodeParser::getPrediction):
2450 (JSC::DFG::ByteCodeParser::handleCall):
2451 (JSC::DFG::ByteCodeParser::parseBlock):
2452
wingo@igalia.com332e9bf2012-06-08 19:57:40 +000024532012-06-08 Andy Wingo <wingo@igalia.com>
2454
2455 Explictly mark stubs called by JIT as being internal
2456 https://bugs.webkit.org/show_bug.cgi?id=88552
2457
2458 Reviewed by Filip Pizlo.
2459
2460 * dfg/DFGOSRExitCompiler.h:
2461 * dfg/DFGOperations.cpp:
2462 * dfg/DFGOperations.h:
2463 * jit/HostCallReturnValue.h:
2464 * jit/JITStubs.cpp:
2465 * jit/JITStubs.h:
2466 * jit/ThunkGenerators.cpp:
2467 * llint/LLIntSlowPaths.h: Mark a bunch of stubs as being
2468 WTF_INTERNAL. Change most calls to SYMBOL_STRING_RELOCATION to
2469 LOCAL_REFERENCE, or GLOBAL_REFERENCE in the case of the wrappers
2470 to truly global symbols.
2471 * offlineasm/asm.rb: Generate LOCAL_REFERENCE instead of
2472 SYMBOL_STRING_RELOCATION.
2473
fpizlo@apple.comf4a2ac32012-06-08 20:04:47 +000024742012-06-08 Geoffrey Garen <ggaren@apple.com>
2475
ggaren@apple.comd7147572012-06-08 18:17:16 +00002476 Don't rely on weak pointers for eager CodeBlock finalization
2477 https://bugs.webkit.org/show_bug.cgi?id=88465
2478
2479 Reviewed by Gavin Barraclough.
2480
2481 This is incompatible with lazy weak pointer finalization.
2482
2483 I considered just making CodeBlock finalization lazy-friendly, but it
2484 turns out that the heap is already way up in CodeBlock's business when
2485 it comes to finalization, so I decided to finish the job and move full
2486 responsibility for CodeBlock finalization into the heap.
2487
2488 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Maybe this
2489 will build.
2490
2491 * debugger/Debugger.cpp: Updated for rename.
2492
2493 * heap/Heap.cpp:
2494 (JSC::Heap::deleteAllCompiledCode): Renamed for consistency. Fixed a bug
2495 where we would not delete code for a code block that had been previously
2496 jettisoned. I don't know if this happens in practice -- I mostly did
2497 this to improve consistency with deleteUnmarkedCompiledCode.
2498
2499 (JSC::Heap::deleteUnmarkedCompiledCode): New function, responsible for
2500 eager finalization of unmarked code blocks.
2501
2502 (JSC::Heap::collect): Updated for rename. Updated to call
2503 deleteUnmarkedCompiledCode(), which takes care of jettisoned DFG code
2504 blocks too.
2505
2506 (JSC::Heap::addCompiledCode): Renamed, since this points to all code
2507 now, not just functions.
2508
2509 * heap/Heap.h:
2510 (Heap): Keep track of all user code, not just functions. This is a
2511 negligible additional overhead, since most code is function code.
2512
2513 * runtime/Executable.cpp:
2514 (JSC::*::finalize): Removed these functions, since we don't rely on
2515 weak pointer finalization anymore.
2516
2517 (JSC::FunctionExecutable::FunctionExecutable): Moved linked-list stuff
2518 into base class so all executables can be in the list.
2519
2520 (JSC::EvalExecutable::clearCode):
2521 (JSC::ProgramExecutable::clearCode):
2522 (JSC::FunctionExecutable::clearCode): All we need to do is delete our
2523 CodeBlock -- that will delete all of its internal data structures.
2524
2525 (JSC::FunctionExecutable::clearCodeIfNotCompiling): Factored out a helper
2526 function to improve clarity.
2527
2528 * runtime/Executable.h:
2529 (JSC::ExecutableBase): Moved linked-list stuff
2530 into base class so all executables can be in the list.
2531
2532 (JSC::NativeExecutable::create):
2533 (NativeExecutable):
2534 (ScriptExecutable):
2535 (JSC::ScriptExecutable::finishCreation):
2536 (JSC::EvalExecutable::create):
2537 (EvalExecutable):
2538 (JSC::ProgramExecutable::create):
2539 (ProgramExecutable):
2540 (FunctionExecutable):
2541 (JSC::FunctionExecutable::create): Don't use a finalizer -- the heap
2542 will call us back to destroy our code block.
2543
2544 (JSC::FunctionExecutable::discardCode): Renamed to clearCodeIfNotCompiling()
2545 for clarity.
2546
2547 (JSC::FunctionExecutable::isCompiling): New helper function, for clarity.
2548
2549 (JSC::ScriptExecutable::clearCodeVirtual): New helper function, since
2550 the heap needs to make polymorphic calls to clear code.
2551
2552 * runtime/JSGlobalData.cpp:
2553 (JSC::StackPreservingRecompiler::operator()):
2554 * runtime/JSGlobalObject.cpp:
2555 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Updated for
2556 renames.
2557
fpizlo@apple.comfd598b92012-06-08 01:31:21 +000025582012-06-07 Filip Pizlo <fpizlo@apple.com>
2559
2560 DFG should inline prototype chain accesses, and do the right things if the
2561 specific function optimization is available
2562 https://bugs.webkit.org/show_bug.cgi?id=88594
2563
2564 Reviewed by Gavin Barraclough.
2565
2566 Looks like a 3% win on V8.
2567
2568 * bytecode/CodeBlock.h:
2569 (JSC::Structure::prototypeForLookup):
2570 (JSC):
2571 * bytecode/GetByIdStatus.cpp:
2572 (JSC::GetByIdStatus::computeFromLLInt):
2573 (JSC):
2574 (JSC::GetByIdStatus::computeForChain):
2575 (JSC::GetByIdStatus::computeFor):
2576 * bytecode/GetByIdStatus.h:
2577 (JSC::GetByIdStatus::GetByIdStatus):
2578 (JSC::GetByIdStatus::isSimple):
2579 (JSC::GetByIdStatus::chain):
2580 (JSC::GetByIdStatus::specificValue):
2581 (GetByIdStatus):
2582 * bytecode/StructureSet.h:
2583 (StructureSet):
2584 (JSC::StructureSet::singletonStructure):
2585 * bytecode/StructureStubInfo.h:
2586 (JSC::StructureStubInfo::initGetByIdProto):
2587 (JSC::StructureStubInfo::initGetByIdChain):
2588 * dfg/DFGByteCodeParser.cpp:
2589 (JSC::DFG::ByteCodeParser::handleGetById):
2590 * dfg/DFGRepatch.cpp:
2591 (JSC::DFG::tryCacheGetByID):
2592 * jit/JITStubs.cpp:
2593 (JSC::JITThunks::tryCacheGetByID):
2594 * runtime/JSGlobalObject.h:
2595 (JSC::Structure::prototypeForLookup):
2596 (JSC):
2597 * runtime/Structure.h:
2598 (Structure):
2599
barraclough@apple.com48386932012-06-08 00:29:27 +000026002012-06-07 Gavin Barraclough <barraclough@apple.com>
2601
barraclough@apple.com64b74e02012-06-08 04:25:58 +00002602 Remove JSObject::m_inheritorID
2603 https://bugs.webkit.org/show_bug.cgi?id=88378
2604
2605 Reviewed by Geoff Garen.
2606
2607 This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
2608 and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
2609 Instead use a private named value in the object's property storage.
2610
2611 * dfg/DFGSpeculativeJIT.h:
2612 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
2613 - No need m_inheritorID to initialize!
2614 * jit/JITInlineMethods.h:
2615 (JSC::JIT::emitAllocateBasicJSObject):
2616 - No need m_inheritorID to initialize!
2617 * llint/LowLevelInterpreter.asm:
2618 - No need m_inheritorID to initialize!
2619 * runtime/JSGlobalData.h:
2620 (JSGlobalData):
2621 - Added private name 'm_inheritorIDKey'.
2622 * runtime/JSGlobalThis.cpp:
2623 (JSC::JSGlobalThis::setUnwrappedObject):
2624 - resetInheritorID is now passed a JSGlobalData&.
2625 * runtime/JSObject.cpp:
2626 (JSC::JSObject::visitChildren):
2627 - No m_inheritorID to be marked.
2628 (JSC::JSObject::createInheritorID):
2629 - Store the newly created inheritorID in the property map.
2630 * runtime/JSObject.h:
2631 (JSC::JSObject::resetInheritorID):
2632 - Remove the inheritorID from property storage.
2633 (JSC::JSObject::inheritorID):
2634 - Read the inheritorID from property storage.
2635
26362012-06-07 Gavin Barraclough <barraclough@apple.com>
2637
barraclough@apple.com48386932012-06-08 00:29:27 +00002638 Math.pow on iOS does not support denormal numbers.
2639 https://bugs.webkit.org/show_bug.cgi?id=88592
2640
2641 Reviewed by Filip Pizlo.
2642
2643 Import an implementation from fdlibm, detect cases where it is safe to use the system
2644 implementation & where we should fall back to fdlibm.
2645
2646 * runtime/MathObject.cpp:
2647 (JSC::isDenormal):
2648 (JSC::isEdgeCase):
2649 (JSC::mathPow):
2650 - On iOS, detect cases where denormal support may be required & use fdlibm in these cases.
2651 (JSC::mathProtoFuncPow):
2652 - Changed to use mathPow.
2653 (JSC::fdlibmScalbn):
2654 (JSC::fdlibmPow):
2655 - These functions imported from fdlibm; original style retained to ease future merging.
2656
paroga@webkit.orga334f732012-06-07 23:24:14 +000026572012-06-07 Patrick Gansterer <paroga@webkit.org>
2658
2659 Unreviewed. Build fix for !ENABLE(JIT) after r119441.
2660
2661 * interpreter/Interpreter.cpp:
2662 (JSC::Interpreter::privateExecute):
2663
wingo@igalia.comb8305a82012-06-07 16:05:19 +000026642012-06-07 Andy Wingo <wingo@igalia.com>
2665
2666 Unreviewed build fix after r119593.
2667
2668 * llint/LLIntOfflineAsmConfig.h (OFFLINE_ASM_GLOBAL_LABEL): Fix
2669 uses of "name" to be "label", the macro's parameter. Otherwise we
2670 serialize mentions of the literal symbol "name" into the objcode.
2671 Causes a build error using GNU ld (not gold).
2672
rniwa@webkit.org475cf8d2012-06-07 02:47:14 +000026732012-06-06 Ryosuke Niwa <rniwa@webkit.org>
2674
2675 Chromium build fix attempt. Why do we need to list these files in gyp!?
2676
2677 * JavaScriptCore.gypi:
2678
fpizlo@apple.comd5547492012-06-07 00:23:36 +000026792012-06-06 Filip Pizlo <fpizlo@apple.com>
2680
fpizlo@apple.com62336162012-06-07 01:35:59 +00002681 PredictedType should be called SpeculatedType
2682 https://bugs.webkit.org/show_bug.cgi?id=88477
2683
2684 Rubber stamped by Gavin Barraclough.
2685
2686 * CMakeLists.txt:
2687 * GNUmakefile.list.am:
2688 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2689 * JavaScriptCore.xcodeproj/project.pbxproj:
2690 * Target.pri:
2691 * bytecode/CodeBlock.cpp:
2692 (JSC::CodeBlock::shouldOptimizeNow):
2693 (JSC::CodeBlock::dumpValueProfiles):
2694 * bytecode/CodeBlock.h:
2695 (JSC::CodeBlock::valueProfilePredictionForBytecodeOffset):
2696 * bytecode/LazyOperandValueProfile.cpp:
2697 (JSC::LazyOperandValueProfileParser::prediction):
2698 * bytecode/LazyOperandValueProfile.h:
2699 (LazyOperandValueProfileParser):
2700 * bytecode/PredictedType.cpp: Removed.
2701 * bytecode/PredictedType.h: Removed.
2702 * bytecode/SpeculatedType.cpp: Copied from Source/JavaScriptCore/bytecode/PredictedType.cpp.
2703 (JSC::speculationToString):
2704 (JSC::speculationToAbbreviatedString):
2705 (JSC::speculationFromClassInfo):
2706 (JSC::speculationFromStructure):
2707 (JSC::speculationFromCell):
2708 (JSC::speculationFromValue):
2709 * bytecode/SpeculatedType.h: Copied from Source/JavaScriptCore/bytecode/PredictedType.h.
2710 (JSC):
2711 (JSC::isAnySpeculation):
2712 (JSC::isCellSpeculation):
2713 (JSC::isObjectSpeculation):
2714 (JSC::isFinalObjectSpeculation):
2715 (JSC::isFinalObjectOrOtherSpeculation):
2716 (JSC::isFixedIndexedStorageObjectSpeculation):
2717 (JSC::isStringSpeculation):
2718 (JSC::isArraySpeculation):
2719 (JSC::isFunctionSpeculation):
2720 (JSC::isInt8ArraySpeculation):
2721 (JSC::isInt16ArraySpeculation):
2722 (JSC::isInt32ArraySpeculation):
2723 (JSC::isUint8ArraySpeculation):
2724 (JSC::isUint8ClampedArraySpeculation):
2725 (JSC::isUint16ArraySpeculation):
2726 (JSC::isUint32ArraySpeculation):
2727 (JSC::isFloat32ArraySpeculation):
2728 (JSC::isFloat64ArraySpeculation):
2729 (JSC::isArgumentsSpeculation):
2730 (JSC::isActionableIntMutableArraySpeculation):
2731 (JSC::isActionableFloatMutableArraySpeculation):
2732 (JSC::isActionableTypedMutableArraySpeculation):
2733 (JSC::isActionableMutableArraySpeculation):
2734 (JSC::isActionableArraySpeculation):
2735 (JSC::isArrayOrOtherSpeculation):
2736 (JSC::isMyArgumentsSpeculation):
2737 (JSC::isInt32Speculation):
2738 (JSC::isDoubleRealSpeculation):
2739 (JSC::isDoubleSpeculation):
2740 (JSC::isNumberSpeculation):
2741 (JSC::isBooleanSpeculation):
2742 (JSC::isOtherSpeculation):
2743 (JSC::isEmptySpeculation):
2744 (JSC::mergeSpeculations):
2745 (JSC::mergeSpeculation):
2746 * bytecode/StructureSet.h:
2747 (JSC::StructureSet::speculationFromStructures):
2748 * bytecode/ValueProfile.h:
2749 (JSC::ValueProfileBase::ValueProfileBase):
2750 (JSC::ValueProfileBase::dump):
2751 (JSC::ValueProfileBase::computeUpdatedPrediction):
2752 (ValueProfileBase):
2753 * dfg/DFGAbstractState.cpp:
2754 (JSC::DFG::AbstractState::initialize):
2755 (JSC::DFG::AbstractState::execute):
2756 (JSC::DFG::AbstractState::mergeStateAtTail):
2757 * dfg/DFGAbstractState.h:
2758 (JSC::DFG::AbstractState::speculateInt32Unary):
2759 (JSC::DFG::AbstractState::speculateNumberUnary):
2760 (JSC::DFG::AbstractState::speculateBooleanUnary):
2761 (JSC::DFG::AbstractState::speculateInt32Binary):
2762 (JSC::DFG::AbstractState::speculateNumberBinary):
2763 * dfg/DFGAbstractValue.h:
2764 (JSC::DFG::StructureAbstractValue::filter):
2765 (JSC::DFG::StructureAbstractValue::speculationFromStructures):
2766 (JSC::DFG::AbstractValue::AbstractValue):
2767 (JSC::DFG::AbstractValue::clear):
2768 (JSC::DFG::AbstractValue::isClear):
2769 (JSC::DFG::AbstractValue::makeTop):
2770 (JSC::DFG::AbstractValue::clobberStructures):
2771 (JSC::DFG::AbstractValue::isTop):
2772 (JSC::DFG::AbstractValue::set):
2773 (JSC::DFG::AbstractValue::merge):
2774 (JSC::DFG::AbstractValue::filter):
2775 (JSC::DFG::AbstractValue::validateIgnoringValue):
2776 (JSC::DFG::AbstractValue::validate):
2777 (JSC::DFG::AbstractValue::checkConsistency):
2778 (JSC::DFG::AbstractValue::dump):
2779 (AbstractValue):
2780 * dfg/DFGArgumentPosition.h:
2781 (JSC::DFG::ArgumentPosition::ArgumentPosition):
2782 (JSC::DFG::ArgumentPosition::mergeArgumentAwareness):
2783 (JSC::DFG::ArgumentPosition::prediction):
2784 (ArgumentPosition):
2785 * dfg/DFGArgumentsSimplificationPhase.cpp:
2786 (JSC::DFG::ArgumentsSimplificationPhase::run):
2787 * dfg/DFGByteCodeParser.cpp:
2788 (ByteCodeParser):
2789 (JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation):
2790 (JSC::DFG::ByteCodeParser::getLocal):
2791 (JSC::DFG::ByteCodeParser::getArgument):
2792 (JSC::DFG::ByteCodeParser::addCall):
2793 (JSC::DFG::ByteCodeParser::getSpeculationWithoutOSRExit):
2794 (JSC::DFG::ByteCodeParser::getSpeculation):
2795 (InlineStackEntry):
2796 (JSC::DFG::ByteCodeParser::handleCall):
2797 (JSC::DFG::ByteCodeParser::handleIntrinsic):
2798 (JSC::DFG::ByteCodeParser::handleGetById):
2799 (JSC::DFG::ByteCodeParser::parseBlock):
2800 (JSC::DFG::ByteCodeParser::fixVariableAccessSpeculations):
2801 (JSC::DFG::ByteCodeParser::parse):
2802 * dfg/DFGCSEPhase.cpp:
2803 (JSC::DFG::CSEPhase::getIndexedPropertyStorageLoadElimination):
2804 (JSC::DFG::CSEPhase::performNodeCSE):
2805 * dfg/DFGConstantFoldingPhase.cpp:
2806 (JSC::DFG::ConstantFoldingPhase::run):
2807 * dfg/DFGFixupPhase.cpp:
2808 (JSC::DFG::FixupPhase::fixupNode):
2809 (JSC::DFG::FixupPhase::fixDoubleEdge):
2810 * dfg/DFGGraph.cpp:
2811 (JSC::DFG::Graph::nameOfVariableAccessData):
2812 (JSC::DFG::Graph::dump):
2813 (JSC::DFG::Graph::predictArgumentTypes):
2814 * dfg/DFGGraph.h:
2815 (JSC::DFG::Graph::getJSConstantSpeculation):
2816 (JSC::DFG::Graph::isPredictedNumerical):
2817 (JSC::DFG::Graph::byValIsPure):
2818 * dfg/DFGJITCompiler.h:
2819 (JSC::DFG::JITCompiler::getSpeculation):
2820 * dfg/DFGNode.h:
2821 (JSC::DFG::Node::Node):
2822 (JSC::DFG::Node::getHeapPrediction):
2823 (JSC::DFG::Node::predictHeap):
2824 (JSC::DFG::Node::prediction):
2825 (JSC::DFG::Node::predict):
2826 (JSC::DFG::Node::shouldSpeculateInteger):
2827 (JSC::DFG::Node::shouldSpeculateDouble):
2828 (JSC::DFG::Node::shouldSpeculateNumber):
2829 (JSC::DFG::Node::shouldSpeculateBoolean):
2830 (JSC::DFG::Node::shouldSpeculateFinalObject):
2831 (JSC::DFG::Node::shouldSpeculateFinalObjectOrOther):
2832 (JSC::DFG::Node::shouldSpeculateArray):
2833 (JSC::DFG::Node::shouldSpeculateArguments):
2834 (JSC::DFG::Node::shouldSpeculateInt8Array):
2835 (JSC::DFG::Node::shouldSpeculateInt16Array):
2836 (JSC::DFG::Node::shouldSpeculateInt32Array):
2837 (JSC::DFG::Node::shouldSpeculateUint8Array):
2838 (JSC::DFG::Node::shouldSpeculateUint8ClampedArray):
2839 (JSC::DFG::Node::shouldSpeculateUint16Array):
2840 (JSC::DFG::Node::shouldSpeculateUint32Array):
2841 (JSC::DFG::Node::shouldSpeculateFloat32Array):
2842 (JSC::DFG::Node::shouldSpeculateFloat64Array):
2843 (JSC::DFG::Node::shouldSpeculateArrayOrOther):
2844 (JSC::DFG::Node::shouldSpeculateObject):
2845 (JSC::DFG::Node::shouldSpeculateCell):
2846 (Node):
2847 * dfg/DFGPredictionPropagationPhase.cpp:
2848 (JSC::DFG::PredictionPropagationPhase::setPrediction):
2849 (JSC::DFG::PredictionPropagationPhase::mergePrediction):
2850 (JSC::DFG::PredictionPropagationPhase::propagate):
2851 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):
2852 * dfg/DFGSpeculativeJIT.cpp:
2853 (JSC::DFG::SpeculativeJIT::fillStorage):
2854 (JSC::DFG::SpeculativeJIT::writeBarrier):
2855 (JSC::DFG::GPRTemporary::GPRTemporary):
2856 (JSC::DFG::FPRTemporary::FPRTemporary):
2857 (JSC::DFG::SpeculativeJIT::compilePeepHoleDoubleBranch):
2858 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectEquality):
2859 (JSC::DFG::SpeculativeJIT::compilePeepHoleBranch):
2860 (JSC::DFG::SpeculativeJIT::compile):
2861 (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
2862 (JSC::DFG::SpeculativeJIT::compileGetCharCodeAt):
2863 (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
2864 (JSC::DFG::SpeculativeJIT::compileValueToInt32):
2865 (JSC::DFG::SpeculativeJIT::compileDoubleAsInt32):
2866 (JSC::DFG::SpeculativeJIT::compileInt32ToDouble):
2867 (JSC::DFG::SpeculativeJIT::compileGetTypedArrayLength):
2868 (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
2869 (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
2870 (JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
2871 (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
2872 (JSC::DFG::SpeculativeJIT::compileInstanceOf):
2873 (JSC::DFG::SpeculativeJIT::compileAdd):
2874 (JSC::DFG::SpeculativeJIT::compileArithSub):
2875 (JSC::DFG::SpeculativeJIT::compileArithNegate):
2876 (JSC::DFG::SpeculativeJIT::compileArithMul):
2877 (JSC::DFG::SpeculativeJIT::compileArithMod):
2878 (JSC::DFG::SpeculativeJIT::compare):
2879 (JSC::DFG::SpeculativeJIT::compileStrictEq):
2880 (JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage):
2881 (JSC::DFG::SpeculativeJIT::compileGetByValOnArguments):
2882 (JSC::DFG::SpeculativeJIT::compileGetArgumentsLength):
2883 (JSC::DFG::SpeculativeJIT::compileRegExpExec):
2884 * dfg/DFGSpeculativeJIT.h:
2885 (DFG):
2886 (JSC::DFG::ValueSource::forSpeculation):
2887 (SpeculativeJIT):
2888 (GPRTemporary):
2889 (FPRTemporary):
2890 (JSC::DFG::SpecDoubleOperand::SpecDoubleOperand):
2891 (JSC::DFG::SpecDoubleOperand::~SpecDoubleOperand):
2892 (JSC::DFG::SpecDoubleOperand::fpr):
2893 (JSC::DFG::SpecCellOperand::SpecCellOperand):
2894 (JSC::DFG::SpecCellOperand::~SpecCellOperand):
2895 (JSC::DFG::SpecCellOperand::gpr):
2896 (JSC::DFG::SpecBooleanOperand::SpecBooleanOperand):
2897 (JSC::DFG::SpecBooleanOperand::~SpecBooleanOperand):
2898 (JSC::DFG::SpecBooleanOperand::gpr):
2899 * dfg/DFGSpeculativeJIT32_64.cpp:
2900 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
2901 (JSC::DFG::SpeculativeJIT::fillSpecDouble):
2902 (JSC::DFG::SpeculativeJIT::fillSpecCell):
2903 (JSC::DFG::SpeculativeJIT::fillSpecBoolean):
2904 (JSC::DFG::SpeculativeJIT::compileObjectEquality):
2905 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
2906 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
2907 (JSC::DFG::SpeculativeJIT::compileDoubleCompare):
2908 (JSC::DFG::SpeculativeJIT::compileLogicalNot):
2909 (JSC::DFG::SpeculativeJIT::emitBranch):
2910 (JSC::DFG::SpeculativeJIT::compile):
2911 * dfg/DFGSpeculativeJIT64.cpp:
2912 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
2913 (JSC::DFG::SpeculativeJIT::fillSpecDouble):
2914 (JSC::DFG::SpeculativeJIT::fillSpecCell):
2915 (JSC::DFG::SpeculativeJIT::fillSpecBoolean):
2916 (JSC::DFG::SpeculativeJIT::compileObjectEquality):
2917 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
2918 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
2919 (JSC::DFG::SpeculativeJIT::compileDoubleCompare):
2920 (JSC::DFG::SpeculativeJIT::compileLogicalNot):
2921 (JSC::DFG::SpeculativeJIT::emitBranch):
2922 (JSC::DFG::SpeculativeJIT::compile):
2923 * dfg/DFGVariableAccessData.h:
2924 (JSC::DFG::VariableAccessData::VariableAccessData):
2925 (JSC::DFG::VariableAccessData::predict):
2926 (JSC::DFG::VariableAccessData::nonUnifiedPrediction):
2927 (JSC::DFG::VariableAccessData::prediction):
2928 (JSC::DFG::VariableAccessData::argumentAwarePrediction):
2929 (JSC::DFG::VariableAccessData::mergeArgumentAwarePrediction):
2930 (JSC::DFG::VariableAccessData::shouldUseDoubleFormatAccordingToVote):
2931 (JSC::DFG::VariableAccessData::makePredictionForDoubleFormat):
2932 (VariableAccessData):
2933
29342012-06-06 Filip Pizlo <fpizlo@apple.com>
2935
fpizlo@apple.com26af9b62012-06-07 00:49:34 +00002936 Global object variable accesses should not require an extra load
2937 https://bugs.webkit.org/show_bug.cgi?id=88385
2938
2939 Reviewed by Gavin Barraclough and Geoffrey Garen.
2940
2941 Previously, if you wanted to access a global variable, you'd first have
2942 to load the register array from the appropriate global object and then
2943 either load or store at an offset to the register array. This is because
2944 JSGlobalObject inherited from JSVariableObject, and JSVariableObject is
2945 designed with the pessimistic assumption that its register array may
2946 point into the call stack. This is never the case for global objects.
2947 Hence, even though the global object may add more registers at any time,
2948 it does not need to store them in a contiguous array. It can use a
2949 SegmentedVector or similar.
2950
2951 This patch refactors global objects and variable objects as follows:
2952
2953 - The functionality to track variables in an indexable array using a
2954 SymbolTable to map names to indices is moved into JSSymbolTableObject,
2955 which is now a supertype of JSVariableObject. JSVariableObject is now
2956 just a holder for a registers array and implements the registerAt()
2957 method that is left abstract in JSSymbolTableObject. Because all users
2958 of JSVariableObject know whether they are a JSStaticScopeObject,
2959 JSActivation, or JSGlobalObject, this "abstract" method is not virtual;
2960 instead the utility methods that would call registerAt() are now
2961 template functions that require you to know statically what subtype of
2962 JSSymbolTableObject you're using (JSVariableObject or something else),
2963 so that registerAt() can be statically bound.
2964
2965 - A new class is added called JSSegmentedVariableObject, which only
2966 differs from JSVariableObject in how it allocates registers. It uses a
2967 SegmentedVector instead of manually managing a pointer to a contiguous
2968 slab of registers. This changes the interface somewhat; for example
2969 with JSVariableObject if you wanted to add a register you had to do
2970 it yourself since the JSVariableObject didn't know how the registers
2971 array ought to be allocated. With JSSegmentedVariableObject you can
2972 just call addRegisters(). JSSegmentedVariableObject preserves the
2973 invariant that once you get a pointer into a register, that pointer
2974 will continue to be valid so long as the JSSegmentedVariableObject is
2975 alive. This allows the JITs and interpreters to skip the extra load.
2976
2977 - JSGlobalObject now inherits from JSSegmentedVariableObject. For now
2978 (and possibly forever) it is the only subtype of this new class.
2979
2980 - The bytecode format is changed so that get_global_var and
2981 put_global_var have a pointer to the register directly rather than
2982 having an index. A convenience method is provided in
2983 JSSegmentedVariableObject to get the index given a a pointer, which is
2984 used for assertions and debug dumps.
2985
2986 This appears to be a 1% across the board win.
2987
2988 * CMakeLists.txt:
2989 * GNUmakefile.list.am:
2990 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2991 * JavaScriptCore.xcodeproj/project.pbxproj:
2992 * Target.pri:
2993 * bytecode/CodeBlock.cpp:
2994 (JSC::CodeBlock::dump):
2995 * bytecode/Instruction.h:
2996 (Instruction):
2997 (JSC::Instruction::Instruction):
2998 * bytecompiler/BytecodeGenerator.cpp:
2999 (JSC::ResolveResult::registerPointer):
3000 (JSC):
3001 (JSC::BytecodeGenerator::BytecodeGenerator):
3002 (JSC::BytecodeGenerator::retrieveLastUnaryOp):
3003 (JSC::BytecodeGenerator::resolve):
3004 (JSC::BytecodeGenerator::resolveConstDecl):
3005 (JSC::BytecodeGenerator::emitGetStaticVar):
3006 (JSC::BytecodeGenerator::emitPutStaticVar):
3007 * bytecompiler/BytecodeGenerator.h:
3008 (ResolveResult):
3009 (BytecodeGenerator):
3010 * dfg/DFGAssemblyHelpers.h:
3011 (AssemblyHelpers):
3012 * dfg/DFGByteCodeParser.cpp:
3013 (JSC::DFG::ByteCodeParser::parseBlock):
3014 * dfg/DFGCSEPhase.cpp:
3015 (JSC::DFG::CSEPhase::globalVarLoadElimination):
3016 (JSC::DFG::CSEPhase::globalVarStoreElimination):
3017 (JSC::DFG::CSEPhase::performNodeCSE):
3018 * dfg/DFGGraph.cpp:
3019 (JSC::DFG::Graph::dump):
3020 * dfg/DFGGraph.h:
3021 (JSC::DFG::Graph::globalObjectFor):
3022 (Graph):
3023 * dfg/DFGNode.h:
3024 (JSC::DFG::Node::hasVarNumber):
3025 (Node):
3026 (JSC::DFG::Node::hasRegisterPointer):
3027 (JSC::DFG::Node::registerPointer):
3028 * dfg/DFGSpeculativeJIT32_64.cpp:
3029 (JSC::DFG::SpeculativeJIT::compile):
3030 * dfg/DFGSpeculativeJIT64.cpp:
3031 (JSC::DFG::SpeculativeJIT::compile):
3032 * heap/Heap.h:
3033 (Heap):
3034 (JSC::Heap::isWriteBarrierEnabled):
3035 (JSC):
3036 * interpreter/Interpreter.cpp:
3037 (JSC::Interpreter::execute):
3038 (JSC::Interpreter::privateExecute):
3039 * jit/JITPropertyAccess.cpp:
3040 (JSC::JIT::emit_op_get_global_var):
3041 (JSC::JIT::emit_op_put_global_var):
3042 * jit/JITPropertyAccess32_64.cpp:
3043 (JSC::JIT::emit_op_get_global_var):
3044 (JSC::JIT::emit_op_put_global_var):
3045 * llint/LowLevelInterpreter32_64.asm:
3046 * llint/LowLevelInterpreter64.asm:
3047 * runtime/JSGlobalObject.cpp:
3048 (JSC):
3049 (JSC::JSGlobalObject::put):
3050 (JSC::JSGlobalObject::putDirectVirtual):
3051 (JSC::JSGlobalObject::defineOwnProperty):
3052 (JSC::JSGlobalObject::visitChildren):
3053 (JSC::JSGlobalObject::addStaticGlobals):
3054 (JSC::JSGlobalObject::getOwnPropertySlot):
3055 (JSC::JSGlobalObject::getOwnPropertyDescriptor):
3056 * runtime/JSGlobalObject.h:
3057 (JSGlobalObject):
3058 (JSC::JSGlobalObject::JSGlobalObject):
3059 (JSC):
3060 (JSC::JSGlobalObject::hasOwnPropertyForWrite):
3061 * runtime/JSSegmentedVariableObject.cpp: Added.
3062 (JSC):
3063 (JSC::JSSegmentedVariableObject::findRegisterIndex):
3064 (JSC::JSSegmentedVariableObject::addRegisters):
3065 (JSC::JSSegmentedVariableObject::visitChildren):
3066 * runtime/JSSegmentedVariableObject.h: Added.
3067 (JSC):
3068 (JSSegmentedVariableObject):
3069 (JSC::JSSegmentedVariableObject::registerAt):
3070 (JSC::JSSegmentedVariableObject::assertRegisterIsInThisObject):
3071 (JSC::JSSegmentedVariableObject::JSSegmentedVariableObject):
3072 (JSC::JSSegmentedVariableObject::finishCreation):
3073 * runtime/JSStaticScopeObject.cpp:
3074 (JSC::JSStaticScopeObject::put):
3075 (JSC::JSStaticScopeObject::putDirectVirtual):
3076 (JSC::JSStaticScopeObject::getOwnPropertySlot):
3077 * runtime/JSSymbolTableObject.cpp: Added.
3078 (JSC):
3079 (JSC::JSSymbolTableObject::destroy):
3080 (JSC::JSSymbolTableObject::deleteProperty):
3081 (JSC::JSSymbolTableObject::getOwnPropertyNames):
3082 (JSC::JSSymbolTableObject::putDirectVirtual):
3083 (JSC::JSSymbolTableObject::isDynamicScope):
3084 * runtime/JSSymbolTableObject.h: Added.
3085 (JSC):
3086 (JSSymbolTableObject):
3087 (JSC::JSSymbolTableObject::symbolTable):
3088 (JSC::JSSymbolTableObject::JSSymbolTableObject):
3089 (JSC::JSSymbolTableObject::finishCreation):
3090 (JSC::symbolTableGet):
3091 (JSC::symbolTablePut):
3092 (JSC::symbolTablePutWithAttributes):
3093 * runtime/JSVariableObject.cpp:
3094 (JSC):
3095 * runtime/JSVariableObject.h:
3096 (JSVariableObject):
3097 (JSC::JSVariableObject::JSVariableObject):
3098 (JSC::JSVariableObject::finishCreation):
3099 (JSC):
3100 * runtime/WriteBarrier.h:
3101
31022012-06-06 Filip Pizlo <fpizlo@apple.com>
3103
fpizlo@apple.comd5547492012-06-07 00:23:36 +00003104 DFG arguments access slow path should not crash if the arguments haven't been created
3105 https://bugs.webkit.org/show_bug.cgi?id=88471
3106
3107 Reviewed by Gavin Barraclough.
3108
3109 * dfg/DFGCCallHelpers.h:
3110 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
3111 (CCallHelpers):
3112 * dfg/DFGOperations.cpp:
3113 * dfg/DFGOperations.h:
3114 * dfg/DFGSpeculativeJIT.h:
3115 (JSC::DFG::SpeculativeJIT::callOperation):
3116 * dfg/DFGSpeculativeJIT32_64.cpp:
3117 (JSC::DFG::SpeculativeJIT::compile):
3118 * dfg/DFGSpeculativeJIT64.cpp:
3119 (JSC::DFG::SpeculativeJIT::compile):
3120
msaboff@apple.com9d9eab62012-06-06 23:11:09 +000031212012-06-06 Michael Saboff <msaboff@apple.com>
3122
3123 ENH: Add Logging to GC Marking Phase
3124 https://bugs.webkit.org/show_bug.cgi?id=88364
3125
3126 Reviewed by Filip Pizlo.
3127
3128 Log GC marking to stderr or a file. The logging in controlled
3129 with the define ENABLE_OBJECT_MARK_LOGGING in wtf/Platform.h.
3130 If DATA_LOG_TO_FILE in wtf/DataLog.cpp is set to 1, output is
3131 logged to a file otherwise it is logged to stderr.
3132
3133 When logging is enabled, the GC is built single threaded since the
3134 log output from the various threads isn't buffered and output in a
3135 thread safe manner.
3136
3137 * heap/Heap.cpp:
3138 (JSC::Heap::markRoots):
3139 * heap/MarkStack.cpp:
3140 (JSC::MarkStackThreadSharedData::resetChildren):
3141 (JSC::MarkStackThreadSharedData::childVisitCount):
3142 (JSC::MarkStackThreadSharedData::markingThreadMain):
3143 (JSC::MarkStackThreadSharedData::markingThreadStartFunc):
3144 (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData):
3145 (JSC::MarkStackThreadSharedData::reset):
3146 * heap/MarkStack.h:
3147 (MarkStackThreadSharedData):
3148 (MarkStack):
3149 (JSC::MarkStack::sharedData):
3150 (JSC::MarkStack::resetChildCount):
3151 (JSC::MarkStack::childCount):
3152 (JSC::MarkStack::incrementChildCount):
3153 * runtime/JSArray.cpp:
3154 (JSC::JSArray::visitChildren):
3155 * runtime/JSCell.cpp:
3156 (JSC::JSCell::className):
3157 * runtime/JSCell.h:
3158 (JSCell):
3159 (JSC::JSCell::visitChildren):
3160 * runtime/JSString.cpp:
3161 (JSC::JSString::visitChildren):
3162 * runtime/JSString.h:
3163 (JSString):
3164 * runtime/Structure.h:
3165 (JSC::MarkStack::internalAppend):
3166
barraclough@apple.com799e44e2012-06-06 22:09:44 +000031672012-06-06 Gavin Barraclough <barraclough@apple.com>
3168
3169 Assigning to a static property should not change iteration order
3170 https://bugs.webkit.org/show_bug.cgi?id=88401
3171
3172 Reviewed by Geoff Garen.
3173
3174 A specific iteration order is not defined by the spec, but test-262 somewhat tenuously
3175 requires that it is at least stable, e.g. ch10/10.4/10.4.2/S10.4.2_A1.1_T1.js
3176
3177 Whilst it is not clear that this behavior really arises from the specification, it
3178 would seem like common sense to conform to this.
3179
3180 The problem here is that we allow properties in the structure to shadow those in the
3181 static table, and we iterate the properties in the structure first - which means that
3182 as values of existing properties are modified, their iteration order changes too.
3183
3184 The easy fix is to iterate the properties from the static table first. This has a
3185 further benefit, since it will mean that user added properties will come after those
3186 present in the static table (respected the expected insertion-order).
3187
3188 * runtime/JSObject.cpp:
3189 (JSC::JSObject::getOwnPropertyNames):
3190 - Iterate static properties first.
3191
wingo@igalia.combe8ecb92012-06-06 09:39:04 +000031922012-06-06 Andy Wingo <wingo@igalia.com>
3193
wingo@igalia.comc2fb5ba2012-06-06 18:59:35 +00003194 Ensure consistent order of evaluation in LLInt slow paths
3195 https://bugs.webkit.org/show_bug.cgi?id=88409
3196
3197 Reviewed by Geoffrey Garen.
3198
3199 * llint/LLIntSlowPaths.cpp:
3200 (slow_path_mul)
3201 (slow_path_sub)
3202 (slow_path_div)
3203 (slow_path_mod)
3204 (slow_path_lshift)
3205 (slow_path_rshift)
3206 (slow_path_urshift)
3207 (slow_path_bitand)
3208 (slow_path_bitor)
3209 (slow_path_bitxor): Avoid calling toNumber, toInt32, or toUInt32
3210 multiple times without intervening sequence points. Fixes
3211 fast/js/exception-sequencing-binops.html with GCC 4.7 on x86-64
3212 Linux, which reordered evaluation of the arguments to fmod.
3213
32142012-06-06 Andy Wingo <wingo@igalia.com>
3215
wingo@igalia.com4990fe82012-06-06 16:00:38 +00003216 [GTK] Enable the LLInt
3217 https://bugs.webkit.org/show_bug.cgi?id=88315
3218
3219 Reviewed by Filip Pizlo.
3220
3221 * GNUmakefile.am: Add rules to generate LLIntDesiredOffsets.h and
3222 LLIntAssembly.h.
3223 * GNUmakefile.list.am: Add offlineasm and llint files to the
3224 dist. Add LLInt source files to the build.
3225 * llint/LowLevelInterpreter.asm (crash): Generate a store of
3226 0xbbadbeef to a register, not to a constant. Otherwise, gas was
3227 failing to assemble result.
3228 * offlineasm/asm.rb (labelReference): Generate a
3229 SYMBOL_STRING_RELOCATION instead of a SYMBOL_STRING, so that we go
3230 through the PLT on ELF systems.
3231
32322012-06-06 Andy Wingo <wingo@igalia.com>
3233
wingo@igalia.combe8ecb92012-06-06 09:39:04 +00003234 REGRESSION (r106478): None of the Paper.js JavaScript examples work
3235 https://bugs.webkit.org/show_bug.cgi?id=87158
3236
3237 Reviewed by Michael Saboff.
3238
3239 * bytecompiler/BytecodeGenerator.cpp:
3240 (JSC::BytecodeGenerator::resolve): If we have to bail out to
3241 dynamicResolve(), only skip static scopes from the head of the
3242 scope chain. Before, we were also skipping activations with
3243 direct eval as well, which was incorrect.
3244
mitz@apple.com115e6642012-06-06 07:37:05 +000032452012-06-06 Dan Bernstein <mitz@apple.com>
3246
3247 Reverted r119567, the fix for <http://webkit.org/b/88378>, because it broke the 32-bit build.
3248
3249 * dfg/DFGSpeculativeJIT.h:
3250 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
3251 * jit/JITInlineMethods.h:
3252 (JSC::JIT::emitAllocateBasicJSObject):
3253 * llint/LowLevelInterpreter.asm:
3254 * runtime/JSGlobalData.h:
3255 (JSGlobalData):
3256 * runtime/JSGlobalThis.cpp:
3257 (JSC::JSGlobalThis::setUnwrappedObject):
3258 * runtime/JSObject.cpp:
3259 (JSC::JSObject::visitChildren):
3260 (JSC::JSObject::createInheritorID):
3261 * runtime/JSObject.h:
3262 (JSObject):
3263 (JSC::JSObject::resetInheritorID):
3264 (JSC):
3265 (JSC::JSObject::offsetOfInheritorID):
3266 (JSC::JSObject::inheritorID):
3267
yuqiang.xian@intel.come8adde62012-06-06 05:25:54 +000032682012-06-05 Yuqiang Xian <yuqiang.xian@intel.com>
3269
3270 Improve Math.round and Math.floor intrinsic
3271 https://bugs.webkit.org/show_bug.cgi?id=88314
3272
3273 Reviewed by Filip Pizlo.
3274
3275 Currently we call a native function from the JIT code to complete the
3276 "round" and "floor" operations. We could inline some fast paths
3277 especially for those positive values on the platforms where floating
3278 point truncation is supported.
3279 This brings 3% gain on Kraken, especially 32% on audio-oscillator,
3280 and slight win on SunSpider, measured on IA32.
3281
3282 * jit/ThunkGenerators.cpp:
3283 (JSC::floorThunkGenerator):
3284 (JSC):
3285 (JSC::roundThunkGenerator):
3286
barraclough@apple.comc48fc1b2012-06-06 05:08:45 +000032872012-06-05 Gavin Barraclough <barraclough@apple.com>
3288
3289 Remove JSObject::m_inheritorID
3290 https://bugs.webkit.org/show_bug.cgi?id=88378
3291
3292 Reviewed by Geoff Garen.
3293
3294 This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
3295 and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
3296 Instead use a private named value in the object's property storage.
3297
3298 * dfg/DFGSpeculativeJIT.h:
3299 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
3300 - No need m_inheritorID to initialize!
3301 * jit/JITInlineMethods.h:
3302 (JSC::JIT::emitAllocateBasicJSObject):
3303 - No need m_inheritorID to initialize!
3304 * llint/LowLevelInterpreter.asm:
3305 - No need m_inheritorID to initialize!
3306 * runtime/JSGlobalData.h:
3307 (JSGlobalData):
3308 - Added private name 'm_inheritorIDKey'.
3309 * runtime/JSGlobalThis.cpp:
3310 (JSC::JSGlobalThis::setUnwrappedObject):
3311 - resetInheritorID is now passed a JSGlobalData&.
3312 * runtime/JSObject.cpp:
3313 (JSC::JSObject::visitChildren):
3314 - No m_inheritorID to be marked.
3315 (JSC::JSObject::createInheritorID):
3316 - Store the newly created inheritorID in the property map.
3317 * runtime/JSObject.h:
3318 (JSC::JSObject::resetInheritorID):
3319 - Remove the inheritorID from property storage.
3320 (JSC::JSObject::inheritorID):
3321 - Read the inheritorID from property storage.
3322
fpizlo@apple.come7bee132012-06-05 21:32:18 +000033232012-06-05 Filip Pizlo <fpizlo@apple.com>
3324
3325 DFG CFG simplification should not attempt to deref nodes inside of an unreachable subgraph
3326 https://bugs.webkit.org/show_bug.cgi?id=88362
3327
3328 Reviewed by Gavin Barraclough.
3329
3330 * dfg/DFGCFGSimplificationPhase.cpp:
3331 (JSC::DFG::CFGSimplificationPhase::fixPhis):
3332 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
3333
mhahnenberg@apple.com47c9c532012-06-05 20:38:21 +000033342012-06-05 Mark Hahnenberg <mhahnenberg@apple.com>
3335
3336 Entry into JSC should CRASH() if the Heap is busy
3337 https://bugs.webkit.org/show_bug.cgi?id=88355
3338
3339 Reviewed by Geoffrey Garen.
3340
3341 Interpreter::execute() returns jsNull() right now if we try to enter it while
3342 the Heap is busy (e.g. with a collection), which is okay, but some code paths
3343 that call Interpreter::execute() allocate objects before checking if the Heap
3344 is busy. Attempting to execute JS code while the Heap is busy should not be
3345 allowed and should be enforced by a release-mode CRASH() to prevent vague,
3346 unhelpful backtraces later on if somebody makes a mistake. Normally, recursively
3347 executing JS code is okay, e.g. for evals, but it should not occur during a
3348 Heap allocation or collection because the Heap is not guaranteed to be in a
3349 consistent state (especially during collections). We are protected from
3350 executing JS on the same Heap concurrently on two separate threads because
3351 they must each take a JSLock first. However, we are not protected from reentrant
3352 execution of JS on the same thread because JSLock allows reentrancy. Therefore,
3353 we should fail early if we detect an entrance into JS code while the Heap is busy.
3354
3355 * heap/Heap.cpp: Changed Heap::collect so that it sets the m_operationInProgress field
3356 at the beginning of collection and then unsets it at the end so that it is set at all
3357 times throughout the duration of a collection rather than sporadically during various
3358 phases. There is no reason to unset during a collection because our collector does
3359 not currently support running additional JS between the phases of a collection.
3360 (JSC::Heap::getConservativeRegisterRoots):
3361 (JSC::Heap::markRoots):
3362 (JSC::Heap::collect):
3363 * interpreter/Interpreter.cpp:
3364 (JSC::Interpreter::execute): Crash if the Heap is busy.
3365 * runtime/Completion.cpp: Crash if the Heap is busy. We do it here before we call
3366 Interpreter::execute() because we do some allocation prior to calling execute() which
3367 could cause Heap corruption if, for example, that allocation caused a collection.
3368 (JSC::evaluate):
3369
commit-queue@webkit.org3401b2d2012-06-05 11:32:22 +000033702012-06-05 Dongwoo Im <dw.im@samsung.com>
3371
3372 Add 'isProtocolHandlerRegistered' and 'unregisterProtocolHandler'.
3373 https://bugs.webkit.org/show_bug.cgi?id=73176
3374
3375 Reviewed by Adam Barth.
3376
3377 Two more APIs are added in Custom Scheme Handler specification.
3378 http://dev.w3.org/html5/spec/Overview.html#custom-handlers
3379 One is 'isProtocolHandlerRegistered' to query whether the specific URL
3380 is registered or not.
3381 The other is 'unregisterProtocolHandler' to remove the registered URL.
3382
3383 * Configurations/FeatureDefines.xcconfig: Add a macro 'ENABLE_CUSTOM_SCHEME_HANDLER'.
3384
fpizlo@apple.com9cce18d2012-06-05 06:40:48 +000033852012-06-04 Filip Pizlo <fpizlo@apple.com>
3386
3387 DFG CFG simplification should correct the variables at the head of the predecessor block
3388 https://bugs.webkit.org/show_bug.cgi?id=88284
3389
3390 Reviewed by Geoffrey Garen.
3391
3392 * dfg/DFGCFGSimplificationPhase.cpp:
3393 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
3394
ggaren@apple.com825cc102012-06-05 03:17:15 +000033952012-06-04 Geoffrey Garen <ggaren@apple.com>
3396
3397 Unreviewed.
3398
3399 Rolled out r119364 because it's still causing crashes (when running
3400 v8-earley in release builds of DRT)
3401
3402 This time for sure!
3403
3404 * heap/Heap.cpp:
3405 (JSC::Heap::collect):
3406 * heap/MarkedBlock.cpp:
3407 (JSC::MarkedBlock::sweep):
3408 * heap/MarkedBlock.h:
3409 (JSC::MarkedBlock::resetAllocator):
3410 (JSC):
3411 * heap/MarkedSpace.cpp:
3412 (JSC::ResetAllocator::operator()):
3413 (JSC):
3414 (JSC::MarkedSpace::resetAllocators):
3415 (JSC::MarkedSpace::sweepWeakSets):
3416 * heap/MarkedSpace.h:
3417 (MarkedSpace):
3418 * heap/WeakBlock.cpp:
3419 (JSC::WeakBlock::sweep):
3420 * heap/WeakSet.cpp:
3421 (JSC::WeakSet::sweep):
3422 (JSC::WeakSet::tryFindAllocator):
3423 * heap/WeakSet.h:
3424 (JSC::WeakSet::shrink):
3425
fpizlo@apple.com9cd38a62012-06-05 00:28:49 +000034262012-06-04 Filip Pizlo <fpizlo@apple.com>
3427
3428 DFG arguments simplification should have rationalized handling of TearOffArguments
3429 https://bugs.webkit.org/show_bug.cgi?id=88206
3430
3431 Reviewed by Geoffrey Garen.
3432
3433 - Accesses to the unmodified arguments register ought to have the same effect on
3434 alias/escape analysis of arguments as accesses to the mutable arguments register.
3435
3436 - The existence of TearOffArguments should not get in the way of arguments aliasing.
3437
3438 - TearOffArguments should be eliminated if CreateArguments is eliminated.
3439
3440 * dfg/DFGArgumentsSimplificationPhase.cpp:
3441 (JSC::DFG::ArgumentsSimplificationPhase::run):
3442 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
3443
barraclough@apple.com282d26a2012-06-05 00:00:17 +000034442012-06-04 Gavin Barraclough <barraclough@apple.com>
3445
3446 Remove enabledProfilerReference
3447 https://bugs.webkit.org/show_bug.cgi?id=88258
3448
3449 Reviewed by Michael Saboff.
3450
3451 Make the enabled profiler a member of JSGlobalData, and switch code that accesses it to do so directly
3452 via the JSGlobalData, rather than holding a Profiler** reference to it. Do not pass the Profiler**
3453 reference to JIT code. This patch does not change the stack layout on entry into JIT code (passing an
3454 unused void* instead), since this is an intrusive change better handled in a separate patch.
3455
3456 * interpreter/Interpreter.cpp:
3457 (JSC::Interpreter::throwException):
3458 (JSC::Interpreter::execute):
3459 (JSC::Interpreter::executeCall):
3460 (JSC::Interpreter::executeConstruct):
3461 (JSC::Interpreter::privateExecute):
3462 * jit/JITCode.h:
3463 (JSC::JITCode::execute):
3464 - Don't pass Profiler** to JIT code.
3465 * jit/JITOpcodes.cpp:
3466 (JSC::JIT::emit_op_profile_will_call):
3467 (JSC::JIT::emit_op_profile_did_call):
3468 * jit/JITOpcodes32_64.cpp:
3469 (JSC::JIT::emit_op_profile_will_call):
3470 (JSC::JIT::emit_op_profile_did_call):
3471 * jit/JITStubs.cpp:
3472 (JSC):
3473 (JSC::ctiTrampoline):
3474 (JSC::ctiVMThrowTrampoline):
3475 (JSC::ctiOpThrowNotCaught):
3476 (JSC::JITThunks::JITThunks):
3477 (JSC::DEFINE_STUB_FUNCTION):
3478 - For ARM_THUMB2, rename ENABLE_PROFILER_REFERENCE_OFFSET to FIRST_STACK_ARGUMENT (which is how it is being used).
3479 - For MIPS, remove ENABLE_PROFILER_REFERENCE_OFFSET.
3480 * jit/JITStubs.h:
3481 (JITStackFrame):
3482 (JSC):
3483 - Renamed enabledProfilerReference to unusedX.
3484 * llint/LLIntSlowPaths.cpp:
3485 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
3486 * llint/LowLevelInterpreter.asm:
3487 * profiler/Profiler.cpp:
3488 (JSC):
3489 (JSC::Profiler::startProfiling):
3490 (JSC::Profiler::stopProfiling):
3491 * profiler/Profiler.h:
3492 (Profiler):
3493 - Removed s_sharedEnabledProfilerReference, enabledProfilerReference().
3494 * runtime/JSGlobalData.cpp:
3495 (JSC::JSGlobalData::JSGlobalData):
3496 * runtime/JSGlobalData.h:
3497 (JSC):
3498 (JSC::JSGlobalData::enabledProfiler):
3499 (JSGlobalData):
3500 - Added m_enabledProfiler, enabledProfiler().
3501 * runtime/JSGlobalObject.cpp:
3502 (JSC::JSGlobalObject::~JSGlobalObject):
3503
fpizlo@apple.com3d579cc2012-06-04 23:27:34 +000035042012-06-04 Filip Pizlo <fpizlo@apple.com>
3505
fpizlo@apple.com477ce382012-06-04 23:32:57 +00003506 get_argument_by_val should be profiled everywhere
3507 https://bugs.webkit.org/show_bug.cgi?id=88205
3508
3509 Reviewed by Geoffrey Garen.
3510
3511 * jit/JITOpcodes32_64.cpp:
3512 (JSC::JIT::emitSlow_op_get_argument_by_val):
3513 * llint/LLIntSlowPaths.cpp:
3514 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
3515
35162012-06-04 Filip Pizlo <fpizlo@apple.com>
3517
fpizlo@apple.com3d579cc2012-06-04 23:27:34 +00003518 DFG arguments simplification takes unkindly to direct accesses to the arguments register
3519 https://bugs.webkit.org/show_bug.cgi?id=88261
3520
3521 Reviewed by Geoffrey Garen.
3522
3523 Fixed arguments simplification for direct accesses to the arguments register, which may
3524 arise if CSE had not run. Fixed CSE so that it does run prior to arguments simplification,
3525 by making it a full-fledged member of the fixpoint. Fixed other issues in arguments
3526 simplification, like realizing that it needs to bail if there is a direct assignment to
3527 the arguments register, and failing to turn CreateArguments into PhantomArguments. Also
3528 fixed CSE's handling of store elimination of captured locals in the presence of a
3529 GetMyArgumentByVal (or one of its friends), and fixed CSE to correctly fixup variables at
3530 tail if the Flush it removes is the last operation on a local in a basic block.
3531
3532 * bytecode/CodeBlock.cpp:
3533 (JSC::CodeBlock::dump):
3534 * dfg/DFGArgumentsSimplificationPhase.cpp:
3535 (JSC::DFG::ArgumentsSimplificationPhase::run):
3536 (JSC::DFG::ArgumentsSimplificationPhase::isOKToOptimize):
3537 * dfg/DFGCSEPhase.cpp:
3538 (JSC::DFG::CSEPhase::run):
3539 (JSC::DFG::CSEPhase::setLocalStoreElimination):
3540 (JSC::DFG::CSEPhase::performNodeCSE):
3541 (CSEPhase):
3542 * dfg/DFGDriver.cpp:
3543 (JSC::DFG::compile):
3544
andersca@apple.comea6c6b22012-06-04 21:56:32 +000035452012-06-04 Anders Carlsson <andersca@apple.com>
3546
3547 Fix a struct/class mismatch.
3548
3549 * heap/Handle.h:
3550 (Handle):
3551
ddkilzer@apple.comba58a612012-06-04 14:55:26 +000035522012-06-04 David Kilzer <ddkilzer@apple.com>
3553
3554 BUILD FIX: FeatureDefines.xcconfig should match across projects
3555
3556 * Configurations/FeatureDefines.xcconfig:
3557 - Add missing ENABLE_LEGACY_CSS_VENDOR_PREFIXES.
3558
ggaren@apple.com02dec622012-06-03 21:16:55 +000035592012-06-02 Geoffrey Garen <ggaren@apple.com>
3560
3561 Weak pointer finalization should be lazy
3562 https://bugs.webkit.org/show_bug.cgi?id=87599
3563
3564 Reviewed by Sam Weinig.
3565
3566 This time for sure!
3567
3568 * heap/Heap.cpp:
3569 (JSC::Heap::collect): Don't sweep eagerly -- we'll sweep lazily instead.
3570
3571 * heap/MarkedBlock.cpp:
3572 (JSC::MarkedBlock::sweep): Sweep our weak set before we sweep our other
3573 destructors -- this is our last chance to run weak set finalizers before
3574 we recycle our memory.
3575
3576 * heap/MarkedBlock.h:
3577 (JSC::MarkedBlock::resetAllocator):
3578 * heap/MarkedSpace.cpp:
3579 (JSC::MarkedSpace::resetAllocators):
3580 * heap/MarkedSpace.h:
3581 (JSC::MarkedSpace::resetAllocators): Don't force allocator reset anymore.
3582 It will happen automatically when a weak set is swept. It's simpler to
3583 have only one canonical way for this to happen, and it wasn't buying
3584 us anything to do it eagerly.
3585
3586 * heap/WeakBlock.cpp:
3587 (JSC::WeakBlock::sweep): Don't short-circuit a sweep unless we know
3588 the sweep would be a no-op. If even one finalizer is pending, we need to
3589 run it, since we won't get another chance.
3590
3591 * heap/WeakSet.cpp:
3592 (JSC::WeakSet::sweep): This loop can be simpler now that
3593 WeakBlock::sweep() does what we mean.
3594
3595 Reset our allocator after a sweep because this is the optimal time to
3596 start trying to recycle old weak pointers.
3597
3598 (JSC::WeakSet::tryFindAllocator): Don't sweep when searching for an
3599 allocator because we've swept already, and forcing a new sweep would be
3600 wasteful.
3601
3602 * heap/WeakSet.h:
3603 (JSC::WeakSet::shrink): Be sure to reset our allocator after a shrink
3604 because the shrink may have removed the block the allocator was going to
3605 allocate out of.
3606
fpizlo@apple.comb80bc2a32012-06-02 22:58:48 +000036072012-06-02 Filip Pizlo <fpizlo@apple.com>
3608
fpizlo@apple.come0c200c2012-06-03 00:41:08 +00003609 If the DFG bytecode parser detects that op_method_check has gone polymorphic, it
3610 shouldn't revert all the way to GetById/GetByIdFlush
3611 https://bugs.webkit.org/show_bug.cgi?id=88176
3612
3613 Reviewed by Geoffrey Garen.
3614
3615 Refactored the code so that the op_method_check case of the parser gracefully falls
3616 through to all of the goodness of the normal op_get_by_id case.
3617
3618 * dfg/DFGByteCodeParser.cpp:
3619 (ByteCodeParser):
3620 (JSC::DFG::ByteCodeParser::handleGetById):
3621 (DFG):
3622 (JSC::DFG::ByteCodeParser::parseBlock):
3623
36242012-06-02 Filip Pizlo <fpizlo@apple.com>
3625
fpizlo@apple.comb80bc2a32012-06-02 22:58:48 +00003626 DFG CSE should be able to eliminate unnecessary flushes of arguments and captured variables
3627 https://bugs.webkit.org/show_bug.cgi?id=87929
3628
3629 Reviewed by Geoffrey Garen.
3630
3631 Slight speed-up on V8. Big win (up to 50%) on programs that inline very small functions.
3632
3633 This required a bunch of changes:
3634
3635 - The obvious change is making CSE essentially ignore whether or not the set of
3636 operations between the Flush and the SetLocal can exit, and instead focus on whether or
3637 not that set of operations can clobber the world or access local variables. This code
3638 is now refactored to return a set of flags indicating any of these events, and the CSE
3639 decides what to do based on those flags. If the set of operations is non-clobbering
3640 and non-accessing, then the Flush is turned into a Phantom on the child of the
3641 SetLocal. This expands the liveness of the relevant variable but virtually guarantees
3642 that it will be register allocated and not flushed to the stack. So, yeah, this patch
3643 is a lot of work to save a few stores to the stack.
3644
3645 - Previously, CheckArgumentsNotCreated was optimized "lazily" in that you only knew if
3646 it was a no-op if you were holding onto a CFA abstract state. But this would make the
3647 CSE act pessimistically, since it doesn't use the CFA. Hence, this patch changes the
3648 constant folding phase into something more broad; it now fixes up
3649 CheckArgumentsNotCreated nodes by turning them into phantoms if it knows that they are
3650 no-ops.
3651
3652 - Arguments simplification was previously relying on this very strange PhantomArguments
3653 node, which had two different meanings: for normal execution it meant the empty value
3654 but for OSR exit it meant that the arguments should be reified. This produces problems
3655 when set SetLocals to the captured arguments registers are CSE'd away, since we'd be
3656 triggering reification of arguments without having initialized the arguments registers
3657 to empty. The cleanest solution was to fix PhantomArguments to have one meaning:
3658 namely, arguments reification on OSR exit. Hence, this patch changes arguments
3659 simplification to change SetLocal of CreateArguments on the arguments registers to be
3660 a SetLocal of Empty.
3661
3662 - Argument value recoveries were previously derived from the value source of the
3663 arguments at the InlineStart. But that relies on all SetLocals to arguments having
3664 been flushed. It's possible that we could have elided the SetLocal to the arguments
3665 at the callsite because there were subsequent SetLocals to the arguments inside of the
3666 callee, in which case the InlineStart would get the wrong information. Hence, this
3667 patch changes argument value recovery computation to operate over the ArgumentPositions
3668 directly.
3669
3670 - But that doesn't actually work, because previously, there was no way to link an
3671 InlineStart back to the corresponding ArgumentPositions, at least not without some
3672 ugliness. So this patch instates the rule that the m_argumentPositions vector consists
3673 of disjoint subsequences such that each subsequence corresponds to an inline callsite
3674 and can be identified by its first index, and within each subsequence are the
3675 ArgumentPositions of all of the arguments ordered by argument index. This required
3676 flipping the order in which ArgumentPositions are added to the vector, and giving
3677 InlineStart an operand that indicates the start of that inline callsite's
3678 ArgumentPosition subsequence.
3679
3680 - This patch also revealed a nasty bug in the reification of arguments in inline call
3681 frames on OSR exit. Since the reification was happening after the values of virtual
3682 registers were recovered, the value recoveries of the inline arguments were wrong.
3683 Hence using operationCreateInlinedArguments is wrong. For example a value recovery
3684 might say that you have to box a double, but if we had already boxed it then boxing
3685 it a second time will result in garbage. The specific case of this bug was this patch
3686 uncovered was that now it is possible for an inline call frame to not have any valid
3687 value recoveries for any inline arguments, if the optimization elides all argument
3688 flushes, while at the same time optimizing away arguments creation. Then OSR exit
3689 would try to recover the arguments using the inline call frame, which had bogus
3690 information, and humorous crashes would ensue. This patch fixes this issue by moving
3691 arguments reification to after call frame reification, so that arguments reification
3692 can always use operationCreateArguments instead of operationCreateInlinedArguments.
3693
3694 - This patch may turn a Flush into a Phantom. That's kind of the whole point. But that
3695 broke forward speculation checks, which knew to look for a Flush prior to a SetLocal
3696 but didn't know that there could alternatively be a Phantom in place of the Flush.
3697 This patch fixes that by augmenting the forward speculation check logic.
3698
3699 - Finally, in the process of having fun with all of the above, I realized that my DFG
3700 validation was not actually running on every phase like I had originally designed it
3701 to. In fact it was only running just after bytecode parsing. I initially tried to
3702 make it run in every phase but found that this causes some tests to timeout
3703 (specifically the evil fuzzing ones), so I decided on a compromise where: (i) in
3704 release mode validation never runs, (ii) in debug mode validation will run just
3705 after parsing and just before the backend, and (iii) it's possible with a simple
3706 switch to enable validation to run on every phase.
3707
3708 Luckily all of the above issues were already covered by the 77 or so DFG-specific
3709 layout tests. Hence, this patch does not introduce any new tests despite being so
3710 meaty.
3711
3712 * dfg/DFGAbstractState.cpp:
3713 (JSC::DFG::AbstractState::execute):
3714 * dfg/DFGArgumentPosition.h:
3715 (JSC::DFG::ArgumentPosition::prediction):
3716 (JSC::DFG::ArgumentPosition::doubleFormatState):
3717 (JSC::DFG::ArgumentPosition::shouldUseDoubleFormat):
3718 (ArgumentPosition):
3719 * dfg/DFGArgumentsSimplificationPhase.cpp:
3720 (JSC::DFG::ArgumentsSimplificationPhase::run):
3721 * dfg/DFGByteCodeParser.cpp:
3722 (JSC::DFG::ByteCodeParser::handleInlining):
3723 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
3724 * dfg/DFGCSEPhase.cpp:
3725 (JSC::DFG::CSEPhase::SetLocalStoreEliminationResult::SetLocalStoreEliminationResult):
3726 (SetLocalStoreEliminationResult):
3727 (JSC::DFG::CSEPhase::setLocalStoreElimination):
3728 (JSC::DFG::CSEPhase::performNodeCSE):
3729 * dfg/DFGCommon.h:
3730 * dfg/DFGConstantFoldingPhase.cpp:
3731 (JSC::DFG::ConstantFoldingPhase::run):
3732 * dfg/DFGDriver.cpp:
3733 (JSC::DFG::compile):
3734 * dfg/DFGNode.h:
3735 (Node):
3736 (JSC::DFG::Node::hasArgumentPositionStart):
3737 (JSC::DFG::Node::argumentPositionStart):
3738 * dfg/DFGOSRExitCompiler32_64.cpp:
3739 (JSC::DFG::OSRExitCompiler::compileExit):
3740 * dfg/DFGOSRExitCompiler64.cpp:
3741 (JSC::DFG::OSRExitCompiler::compileExit):
3742 * dfg/DFGPhase.cpp:
3743 (DFG):
3744 * dfg/DFGPhase.h:
3745 (Phase):
3746 * dfg/DFGSpeculativeJIT.cpp:
3747 (JSC::DFG::SpeculativeJIT::compile):
3748 * dfg/DFGSpeculativeJIT.h:
3749 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
3750 * dfg/DFGSpeculativeJIT32_64.cpp:
3751 (JSC::DFG::SpeculativeJIT::compile):
3752 * dfg/DFGSpeculativeJIT64.cpp:
3753 (JSC::DFG::SpeculativeJIT::compile):
3754
ggaren@apple.com32eb24b2012-06-02 22:49:05 +000037552012-06-02 Geoffrey Garen <ggaren@apple.com>
3756
3757 DOM string cache should hash pointers, not characters
3758 https://bugs.webkit.org/show_bug.cgi?id=88175
3759
3760 Reviewed by Phil Pizlo and Sam Weinig.
3761
3762 * heap/Weak.h:
3763 (JSC::weakAdd):
3764 (JSC::weakRemove): Made these function templates slightly more generic
3765 to accommodate new client types.
3766
fpizlo@apple.comcc5b61b2012-06-01 21:32:45 +000037672012-06-01 Filip Pizlo <fpizlo@apple.com>
3768
fpizlo@apple.coma4754892012-06-02 00:22:31 +00003769 DFG CFA should know that PutByVal can clobber the world
3770 https://bugs.webkit.org/show_bug.cgi?id=88155
3771
3772 Reviewed by Gavin Barraclough.
3773
3774 * dfg/DFGAbstractState.cpp:
3775 (JSC::DFG::AbstractState::execute):
3776
37772012-06-01 Filip Pizlo <fpizlo@apple.com>
3778
fpizlo@apple.com8e537cd2012-06-01 23:54:36 +00003779 DFG CFA should mark basic blocks as having constants if local accesses yield constants
3780 https://bugs.webkit.org/show_bug.cgi?id=88153
3781
3782 Reviewed by Gavin Barraclough.
3783
3784 * dfg/DFGAbstractState.cpp:
3785 (JSC::DFG::AbstractState::execute):
3786
37872012-06-01 Filip Pizlo <fpizlo@apple.com>
3788
fpizlo@apple.comacc9dd22012-06-01 23:47:28 +00003789 DFG arguments simplification phase uses a node.codeOrigin after appending a node
3790 https://bugs.webkit.org/show_bug.cgi?id=88151
3791
3792 Reviewed by Geoffrey Garen.
3793
3794 The right thing to do is to save the CodeOrigin before appending to the graph.
3795
3796 * dfg/DFGArgumentsSimplificationPhase.cpp:
3797 (JSC::DFG::ArgumentsSimplificationPhase::run):
3798
37992012-06-01 Filip Pizlo <fpizlo@apple.com>
3800
fpizlo@apple.com4f337c22012-06-01 23:18:59 +00003801 DFG should not emit unnecessary speculation checks when performing an int32 to double conversion on
3802 a value that is proved to be a number, predicted to be an int32, but not proved to be an int32
3803 https://bugs.webkit.org/show_bug.cgi?id=88146
3804
3805 Reviewed by Gavin Barraclough.
3806
3807 * dfg/DFGSpeculativeJIT.cpp:
3808 (JSC::DFG::SpeculativeJIT::compileInt32ToDouble):
3809
38102012-06-01 Filip Pizlo <fpizlo@apple.com>
3811
fpizlo@apple.comafc07412012-06-01 22:44:43 +00003812 DFG constant folding search for the last local access skips the immediately previous local access
3813 https://bugs.webkit.org/show_bug.cgi?id=88141
3814
3815 Reviewed by Michael Saboff.
3816
3817 If you use a loop in the style of:
3818
3819 for (i = start; i--;)
3820
3821 then you need to remember that the first value of 'i' that the loop body will see is 'start - 1'.
3822 Hence the following is probably wrong:
3823
3824 for (i = start - 1; i--;)
3825
3826 * dfg/DFGConstantFoldingPhase.cpp:
3827 (JSC::DFG::ConstantFoldingPhase::run):
3828
38292012-06-01 Filip Pizlo <fpizlo@apple.com>
3830
fpizlo@apple.comcc5b61b2012-06-01 21:32:45 +00003831 DFG constant folding should be OK with GetLocal of captured variables having a constant
3832 https://bugs.webkit.org/show_bug.cgi?id=88137
3833
3834 Reviewed by Gavin Barraclough.
3835
3836 * dfg/DFGConstantFoldingPhase.cpp:
3837 (JSC::DFG::ConstantFoldingPhase::run):
3838
mhahnenberg@apple.com016c5782012-06-01 00:02:09 +000038392012-05-31 Mark Hahnenberg <mhahnenberg@apple.com>
3840
3841 JSGlobalObject does not mark m_privateNameStructure
3842 https://bugs.webkit.org/show_bug.cgi?id=88023
3843
3844 Rubber stamped by Gavin Barraclough.
3845
3846 * runtime/JSGlobalObject.cpp:
3847 (JSC::JSGlobalObject::visitChildren): We need to mark this so it doesn't get
3848 inadvertently garbage collected.
3849
arv@chromium.org31fddbc2012-05-31 18:00:03 +000038502012-05-31 Erik Arvidsson <arv@chromium.org>
3851
3852 Make DOM Exceptions Errors
3853 https://bugs.webkit.org/show_bug.cgi?id=85078
3854
3855 Reviewed by Oliver Hunt.
3856
3857 WebIDL mandates that exceptions should have Error.prototype on its prototype chain.
3858
3859 For JSC we have access to the Error.prototype from the binding code.
3860
3861 For V8 we set a field in the WrapperTypeInfo and when the constructor function is created we
3862 set the prototype as needed.
3863
3864 Updated test: fast/dom/DOMException/prototype-object.html
3865
3866 * JavaScriptCore.xcodeproj/project.pbxproj:
3867 * runtime/JSGlobalObject.cpp:
3868 (JSC::JSGlobalObject::reset):
3869 * runtime/JSGlobalObject.h:
3870 (JSC):
3871 (JSGlobalObject):
3872 (JSC::JSGlobalObject::errorPrototype):
3873
wingo@igalia.com8de6a8a2012-05-31 17:28:21 +000038742012-05-31 Andy Wingo <wingo@igalia.com>
3875
3876 Fix reference to unset variable in debug mode
3877 https://bugs.webkit.org/show_bug.cgi?id=87981
3878
3879 Reviewed by Geoffrey Garen.
3880
3881 * runtime/JSONObject.cpp (Stringifier::Holder::Holder):
3882 Initialize m_size in debug mode, as we check it later in an assert.
3883
mhahnenberg@apple.comeb39abc2012-05-31 03:04:00 +000038842012-05-30 Mark Hahnenberg <mhahnenberg@apple.com>
3885
3886 Heap should sweep incrementally
3887 https://bugs.webkit.org/show_bug.cgi?id=85429
3888
3889 We shouldn't have to wait for the opportunistic GC timer to fire in order
3890 to call object destructors. Instead, we should incrementally sweep some
3891 subset of the blocks requiring sweeping periodically. We tie this sweeping
3892 to a timer rather than to collections because we want to reclaim this memory
3893 even if we stop allocating. This way, our memory usage scales smoothly with
3894 actual use, regardless of whether we've recently done an opportunistic GC or not.
3895
3896 Reviewed by Geoffrey Garen.
3897
3898 * CMakeLists.txt:
3899 * GNUmakefile.list.am:
3900 * JavaScriptCore.gypi:
3901 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3902 * JavaScriptCore.xcodeproj/project.pbxproj:
3903 * Target.pri:
3904 * heap/Heap.cpp:
3905 (JSC::Heap::Heap):
3906 (JSC::Heap::collect): We no longer sweep during a full sweep. We only shrink now,
3907 which we will switch over to being done during incremental sweeping too as soon as
3908 all finalizers can be run lazily (and, by extension, incrementally).
3909 (JSC::Heap::sweeper):
3910 (JSC):
3911 * heap/Heap.h:
3912 (JSC):
3913 (Heap):
3914 * heap/IncrementalSweeper.cpp: Added.
3915 (JSC):
3916 (JSC::IncrementalSweeper::timerDidFire): The IncrementalSweeper works very similarly to
3917 GCActivityCallback. It is tied to a run-loop based timer that fires periodically based
3918 on how long the previous sweep increment took to run. The IncrementalSweeper doesn't do
3919 anything if the platform doesn't support CoreFoundation.
3920 (JSC::IncrementalSweeper::IncrementalSweeper):
3921 (JSC::IncrementalSweeper::~IncrementalSweeper):
3922 (JSC::IncrementalSweeper::create):
3923 (JSC::IncrementalSweeper::scheduleTimer):
3924 (JSC::IncrementalSweeper::cancelTimer):
3925 (JSC::IncrementalSweeper::doSweep): Iterates over the snapshot of the MarkedSpace taken
3926 during the last collection, checking to see which blocks need sweeping. If it successfully
3927 gets to the end of the blocks that need sweeping then it cancels the timer.
3928 (JSC::IncrementalSweeper::startSweeping): We take a snapshot of the Heap and store it in
3929 a Vector that the incremental sweep will iterate over. We also reset our index into this Vector.
3930 * heap/IncrementalSweeper.h: Added.
3931 (JSC):
3932 (IncrementalSweeper):
3933 * heap/MarkedBlock.h:
3934 (JSC::MarkedBlock::needsSweeping): If a block is in the Marked state it needs sweeping
3935 to be usable and to run any destructors that need to be run.
3936
paroga@webkit.orgecd0fb62012-05-31 01:38:17 +000039372012-05-30 Patrick Gansterer <paroga@webkit.org>
3938
3939 [WINCE] Fix JSString after r115516.
3940 https://bugs.webkit.org/show_bug.cgi?id=87892
3941
3942 Reviewed by Geoffrey Garen.
3943
3944 r115516 splitted JSString into two classes, with addition nested classes.
3945 Add a workaround for the WinCE compiler since it can't resolve the friend class
3946 declerations corretly and denies the access to protected members of JSString.
3947
3948 * runtime/JSString.h:
3949 (JSC::JSRopeString::RopeBuilder::append):
3950 (JSC::JSRopeString::append):
3951 (JSRopeString):
3952
oliver@apple.com3c996382012-05-30 23:47:27 +000039532012-05-30 Oliver Hunt <oliver@apple.com>
3954
3955 Really provide error information with the inspector disabled
3956 https://bugs.webkit.org/show_bug.cgi?id=87910
3957
3958 Reviewed by Filip Pizlo.
3959
3960 Don't bother checking for anything other than pre-existing error info.
3961 In the absence of complete line number information you'll only get the
3962 line a function starts on, but at least it's something.
3963
3964 * interpreter/Interpreter.cpp:
3965 (JSC::Interpreter::throwException):
3966
fpizlo@apple.com074918c2012-05-30 20:18:00 +000039672012-05-30 Filip Pizlo <fpizlo@apple.com>
3968
fpizlo@apple.com5673fe62012-05-30 23:09:45 +00003969 LLInt broken on x86-32 with JIT turned off
3970 https://bugs.webkit.org/show_bug.cgi?id=87906
3971
3972 Reviewed by Geoffrey Garen.
3973
3974 Fixed the code to not clobber registers that contain important things, like the call frame.
3975
3976 * llint/LowLevelInterpreter32_64.asm:
3977
39782012-05-30 Filip Pizlo <fpizlo@apple.com>
3979
fpizlo@apple.com074918c2012-05-30 20:18:00 +00003980 ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
3981 https://bugs.webkit.org/show_bug.cgi?id=87887
3982
fpizlo@apple.comd55e8152012-05-30 21:04:23 +00003983 Reviewed by Darin Adler.
3984
3985 Better fix - we now never call SourceProvider::asID() if SourceProvider* is 0.
3986
3987 * parser/Nodes.h:
3988 (JSC::ScopeNode::sourceID):
3989 * parser/SourceCode.h:
3990 (JSC::SourceCode::providerID):
3991 (SourceCode):
3992 * parser/SourceProvider.h:
3993 (SourceProvider):
3994 (JSC::SourceProvider::asID):
3995 * runtime/Executable.h:
3996 (JSC::ScriptExecutable::sourceID):
3997
39982012-05-30 Filip Pizlo <fpizlo@apple.com>
3999
4000 ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
4001 https://bugs.webkit.org/show_bug.cgi?id=87887
4002
fpizlo@apple.com074918c2012-05-30 20:18:00 +00004003 Reviewed by Geoffrey Garen.
4004
4005 * parser/SourceProvider.h:
4006 (JSC::SourceProvider::asID):
4007
oliver@apple.comc55314a2012-05-30 19:45:20 +000040082012-05-30 Oliver Hunt <oliver@apple.com>
4009
4010 DFG does not correctly handle exceptions caught in the LLInt
4011 https://bugs.webkit.org/show_bug.cgi?id=87885
4012
4013 Reviewed by Filip Pizlo.
4014
4015 Make the DFG use genericThrow, rather than reimplementing a small portion of it.
4016 Also make the LLInt slow paths validate that their PC is correct.
4017
4018 * dfg/DFGOperations.cpp:
4019 * llint/LLIntSlowPaths.cpp:
4020 (LLInt):
4021
fpizlo@apple.com75824e82012-05-30 17:02:49 +000040222012-05-29 Filip Pizlo <fpizlo@apple.com>
4023
4024 DFG CFA should infer types and values of captured variables
4025 https://bugs.webkit.org/show_bug.cgi?id=87813
4026
4027 Reviewed by Gavin Barraclough.
4028
4029 Slight speed-up in V8/earley-boyer (~1%).
4030
4031 * bytecode/CodeBlock.h:
4032 (JSC::CodeBlock::argumentsAreCaptured):
4033 (JSC::CodeBlock::argumentIsCaptured):
4034 (CodeBlock):
4035 * dfg/DFGAbstractState.cpp:
4036 (DFG):
4037 (JSC::DFG::AbstractState::beginBasicBlock):
4038 (JSC::DFG::AbstractState::initialize):
4039 (JSC::DFG::AbstractState::endBasicBlock):
4040 (JSC::DFG::AbstractState::execute):
4041 (JSC::DFG::AbstractState::clobberWorld):
4042 (JSC::DFG::AbstractState::clobberStructures):
4043 (JSC::DFG::AbstractState::mergeStateAtTail):
4044 (JSC::DFG::AbstractState::merge):
4045 (JSC::DFG::AbstractState::mergeToSuccessors):
4046 * dfg/DFGAbstractState.h:
4047 (JSC::DFG::AbstractState::variables):
4048 (AbstractState):
4049 * dfg/DFGSpeculativeJIT32_64.cpp:
4050 (JSC::DFG::SpeculativeJIT::compile):
4051 * dfg/DFGSpeculativeJIT64.cpp:
4052 (JSC::DFG::SpeculativeJIT::compile):
4053
paroga@webkit.orge373ab72012-05-30 16:44:03 +000040542012-05-30 Patrick Gansterer <paroga@webkit.org>
4055
4056 Unreviewed. Build fix for !ENABLE(JIT) after r117823.
4057
4058 * bytecode/CodeBlock.cpp:
4059 (JSC::CodeBlock::dump):
4060
commit-queue@webkit.org4ac40e0d2012-05-30 07:17:05 +000040612012-05-30 Sheriff Bot <webkit.review.bot@gmail.com>
4062
4063 Unreviewed, rolling out r118868.
4064 http://trac.webkit.org/changeset/118868
4065 https://bugs.webkit.org/show_bug.cgi?id=87828
4066
4067 introduced ~20 crashes on Mac and Qt bots (Requested by pizlo_
4068 on #webkit).
4069
4070 * heap/Heap.cpp:
4071 (JSC::Heap::collect):
4072 * heap/MarkedBlock.cpp:
4073 (JSC::MarkedBlock::sweep):
4074 * heap/MarkedBlock.h:
4075 (JSC::MarkedBlock::sweepWeakSet):
4076 (JSC):
4077 * heap/MarkedSpace.cpp:
4078 (JSC::SweepWeakSet::operator()):
4079 (JSC):
4080 (JSC::MarkedSpace::sweepWeakSets):
4081 * heap/MarkedSpace.h:
4082 (MarkedSpace):
4083
ggaren@apple.com15344ae2012-05-30 01:05:35 +000040842012-05-29 Geoffrey Garen <ggaren@apple.com>
4085
4086 Rolled back in r118646, now that
4087 https://bugs.webkit.org/show_bug.cgi?id=87784 is fixed.
4088
4089 http://trac.webkit.org/changeset/118646
4090 https://bugs.webkit.org/show_bug.cgi?id=87599
4091
4092 * heap/Heap.cpp:
4093 (JSC::Heap::collect):
4094 * heap/MarkedBlock.cpp:
4095 (JSC::MarkedBlock::sweep):
4096 * heap/MarkedBlock.h:
4097 (JSC):
4098 * heap/MarkedSpace.cpp:
4099 (JSC):
4100 * heap/MarkedSpace.h:
4101 (MarkedSpace):
4102
fpizlo@apple.com4c0875e2012-05-29 23:43:16 +000041032012-05-29 Filip Pizlo <fpizlo@apple.com>
4104
4105 DFG should keep captured variables alive until the (inline) return.
4106 https://bugs.webkit.org/show_bug.cgi?id=87205
4107
4108 Reviewed by Gavin Barraclough.
4109
4110 Changes the way we do flushing for captured variables and arguments. Instead of flushing
4111 each SetLocal immediately, we flush at kill points. So a SetLocal will cause a Flush of
4112 whatever was live in the variable previously, and a return will cause a Flush of all
4113 captured variables and all arguments.
4114
4115 * dfg/DFGByteCodeParser.cpp:
4116 (JSC::DFG::ByteCodeParser::setDirect):
4117 (JSC::DFG::ByteCodeParser::set):
4118 (JSC::DFG::ByteCodeParser::setLocal):
4119 (JSC::DFG::ByteCodeParser::getArgument):
4120 (JSC::DFG::ByteCodeParser::setArgument):
4121 (JSC::DFG::ByteCodeParser::findArgumentPositionForArgument):
4122 (ByteCodeParser):
4123 (JSC::DFG::ByteCodeParser::findArgumentPositionForLocal):
4124 (JSC::DFG::ByteCodeParser::findArgumentPosition):
4125 (JSC::DFG::ByteCodeParser::flush):
4126 (JSC::DFG::ByteCodeParser::flushDirect):
4127 (JSC::DFG::ByteCodeParser::flushArgumentsAndCapturedVariables):
4128 (JSC::DFG::ByteCodeParser::handleInlining):
4129 (JSC::DFG::ByteCodeParser::parseBlock):
4130 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
4131 * dfg/DFGCSEPhase.cpp:
4132 (JSC::DFG::CSEPhase::setLocalStoreElimination):
4133 (JSC::DFG::CSEPhase::performNodeCSE):
4134 * dfg/DFGSpeculativeJIT.cpp:
4135 (JSC::DFG::SpeculativeJIT::compile):
4136 * dfg/DFGSpeculativeJIT.h:
4137 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
4138
ggaren@apple.com7cc57362012-05-29 23:40:26 +000041392012-05-29 Geoffrey Garen <ggaren@apple.com>
4140
4141 WeakGCMap should be lazy-finalization-safe
4142 https://bugs.webkit.org/show_bug.cgi?id=87784
4143
4144 Reviewed by Darin Adler.
4145
4146 * runtime/WeakGCMap.h:
4147 (JSC::WeakGCMap::get): Since this is a map of raw WeakImpl pointers, and
4148 not Weak<T>, we need to verify manually that the WeakImpl is live before
4149 we return its payload.
4150
mhahnenberg@apple.com7ea7e8f2012-05-29 18:38:14 +000041512012-05-29 Mark Hahnenberg <mhahnenberg@apple.com>
4152
4153 CopiedSpace::doneCopying could start another collection
4154 https://bugs.webkit.org/show_bug.cgi?id=86538
4155
4156 Reviewed by Geoffrey Garen.
4157
4158 It's possible that if we don't have anything at the head of to-space
4159 after a collection and the BlockAllocator doesn't have any fresh blocks
4160 to give us right now we could start another collection while still in
4161 the middle of the first collection when we call CopiedSpace::addNewBlock().
4162
4163 One way to resolve this would be to have Heap::shouldCollect() check that
4164 m_operationInProgress is NoOperation. This would prevent the path in
4165 getFreshBlock() that starts the collection if we're already in the middle of one.
4166
4167 I could not come up with a test case to reproduce this crash on ToT.
4168
4169 * heap/Heap.h:
4170 (JSC::Heap::shouldCollect): We shouldn't collect if we're already in the middle
4171 of a collection, i.e. the current operation should be NoOperation.
4172
commit-queue@webkit.orgd5058402012-05-29 14:44:38 +000041732012-05-29 David Barr <davidbarr@chromium.org>
4174
4175 Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag
4176 https://bugs.webkit.org/show_bug.cgi?id=87685
4177
4178 Reviewed by Eric Seidel.
4179
4180 Add a configuration option for CSS image-resolution support, disabling it by default.
4181
4182 * Configurations/FeatureDefines.xcconfig:
4183
commit-queue@webkit.org10c0df22012-05-29 03:24:49 +000041842012-05-28 Sheriff Bot <webkit.review.bot@gmail.com>
4185
4186 Unreviewed, rolling out r118646.
4187 http://trac.webkit.org/changeset/118646
4188 https://bugs.webkit.org/show_bug.cgi?id=87691
4189
4190 broke V8 raytrace benchmark (Requested by pizlo_ on #webkit).
4191
4192 * heap/Heap.cpp:
4193 (JSC::Heap::collect):
4194 * heap/MarkedBlock.cpp:
4195 (JSC::MarkedBlock::sweep):
4196 * heap/MarkedBlock.h:
4197 (JSC::MarkedBlock::sweepWeakSet):
4198 (JSC):
4199 * heap/MarkedSpace.cpp:
4200 (JSC::SweepWeakSet::operator()):
4201 (JSC):
4202 (JSC::MarkedSpace::sweepWeakSets):
4203 * heap/MarkedSpace.h:
4204 (MarkedSpace):
4205
fpizlo@apple.com26ece8e2012-05-29 02:43:30 +000042062012-05-28 Filip Pizlo <fpizlo@apple.com>
4207
4208 DFG should not generate code for code that the CFA proves to be unreachable
4209 https://bugs.webkit.org/show_bug.cgi?id=87682
4210
4211 Reviewed by Sam Weinig.
4212
4213 This also fixes a small performance bug where CFA was not marking blocks
4214 as having constants (and hence not triggering constant folding) if the only
4215 constants were on GetLocals.
4216
4217 And fixing that bug revealed another bug: constant folding was assuming that
4218 a GetLocal must be the first access to a local in a basic block. This isn't
4219 true. The first access may be a Flush. This patch fixes that issue using the
4220 safest approach possible, since we don't need to be clever for something that
4221 only happens in one of our benchmarks.
4222
4223 * dfg/DFGAbstractState.cpp:
4224 (JSC::DFG::AbstractState::execute):
4225 * dfg/DFGConstantFoldingPhase.cpp:
4226 (JSC::DFG::ConstantFoldingPhase::run):
4227 * dfg/DFGJITCompiler.h:
4228 (JSC::DFG::JITCompiler::noticeOSREntry):
4229 * dfg/DFGSpeculativeJIT.cpp:
4230 (JSC::DFG::SpeculativeJIT::compile):
4231
carlosgc@webkit.orgb69727c2012-05-28 10:21:31 +000042322012-05-28 Carlos Garcia Campos <cgarcia@igalia.com>
4233
4234 Unreviewed. Fix make distcheck.
4235
4236 * GNUmakefile.list.am: Add missing header file.
4237
ggaren@apple.comb816d752012-05-28 04:56:01 +000042382012-05-27 Geoffrey Garen <ggaren@apple.com>
4239
4240 Weak pointer finalization should be lazy
4241 https://bugs.webkit.org/show_bug.cgi?id=87599
4242
4243 Reviewed by Darin Adler.
4244
4245 * heap/Heap.cpp:
4246 (JSC::Heap::collect): Don't force immediate finalization -- it will
4247 happen lazily.
4248
4249 * heap/MarkedBlock.cpp:
4250 (JSC::MarkedBlock::sweep): Sweep a block's weak set when sweeping the
4251 block. The weak set may not have been swept yet, and this is our last
4252 chance to run weak finalizers before we recycle the memory they reference.
4253
4254 * heap/MarkedBlock.h:
4255 * heap/MarkedSpace.cpp:
4256 (JSC::MarkedBlock::sweepWeakSets):
4257 * heap/MarkedSpace.h:
4258 (JSC::MarkedSpace::sweepWeakSets): Nixed sweepWeakSets because it's unused
4259 now.
4260
ggaren@apple.com72da8112012-05-26 22:40:46 +000042612012-05-26 Geoffrey Garen <ggaren@apple.com>
4262
4263 WebKit should be lazy-finalization-safe (esp. the DOM) v2
4264 https://bugs.webkit.org/show_bug.cgi?id=87581
4265
4266 Reviewed by Oliver Hunt.
4267
4268 * heap/MarkedBlock.cpp:
4269 (JSC::MarkedBlock::callDestructor):
4270 * heap/WeakBlock.h:
4271 * heap/WeakSetInlines.h:
4272 (JSC::WeakBlock::finalize): Since we don't guarantee destruction order,
4273 it's not valid to access GC pointers like the Structure pointer during
4274 finalization. We NULL out the structure pointer in debug builds to try
4275 to make this programming mistake more obvious.
4276
4277 * API/JSCallbackConstructor.cpp:
4278 (JSC::JSCallbackConstructor::destroy):
4279 * API/JSCallbackObject.cpp:
4280 (JSC::::destroy):
4281 (JSC::JSCallbackObjectData::finalize):
4282 * runtime/Arguments.cpp:
4283 (JSC::Arguments::destroy):
4284 * runtime/DateInstance.cpp:
4285 (JSC::DateInstance::destroy):
4286 * runtime/Error.cpp:
4287 (JSC::StrictModeTypeErrorFunction::destroy):
4288 * runtime/Executable.cpp:
4289 (JSC::ExecutableBase::destroy):
4290 (JSC::NativeExecutable::destroy):
4291 (JSC::ScriptExecutable::destroy):
4292 (JSC::EvalExecutable::destroy):
4293 (JSC::ProgramExecutable::destroy):
4294 (JSC::FunctionExecutable::destroy):
4295 * runtime/JSGlobalObject.cpp:
4296 (JSC::JSGlobalObject::destroy):
4297 * runtime/JSPropertyNameIterator.cpp:
4298 (JSC::JSPropertyNameIterator::destroy):
4299 * runtime/JSStaticScopeObject.cpp:
4300 (JSC::JSStaticScopeObject::destroy):
4301 * runtime/JSString.cpp:
4302 (JSC::JSString::destroy):
4303 * runtime/JSVariableObject.cpp:
4304 (JSC::JSVariableObject::destroy):
4305 * runtime/NameInstance.cpp:
4306 (JSC::NameInstance::destroy):
4307 * runtime/RegExp.cpp:
4308 (JSC::RegExp::destroy):
4309 * runtime/RegExpConstructor.cpp:
4310 (JSC::RegExpConstructor::destroy):
4311 * runtime/Structure.cpp:
4312 (JSC::Structure::destroy):
4313 * runtime/StructureChain.cpp:
4314 (JSC::StructureChain::destroy): Use static_cast instead of jsCast because
4315 jsCast does Structure-based validation, and our Structure is not guaranteed
4316 to be alive when we get finalized.
4317
fpizlo@apple.com7e0f6502012-05-25 22:45:57 +000043182012-05-22 Filip Pizlo <fpizlo@apple.com>
4319
fpizlo@apple.com190f5252012-05-25 23:00:26 +00004320 DFG CSE should eliminate redundant WeakJSConstants
4321 https://bugs.webkit.org/show_bug.cgi?id=87179
4322
4323 Reviewed by Gavin Barraclough.
4324
4325 Merged r118141 from dfgopt.
4326
4327 * dfg/DFGCSEPhase.cpp:
4328 (JSC::DFG::CSEPhase::weakConstantCSE):
4329 (CSEPhase):
4330 (JSC::DFG::CSEPhase::performNodeCSE):
4331 * dfg/DFGNode.h:
4332 (JSC::DFG::Node::weakConstant):
4333
43342012-05-22 Filip Pizlo <fpizlo@apple.com>
4335
fpizlo@apple.com7e0f6502012-05-25 22:45:57 +00004336 DFG CSE should do redundant store elimination
4337 https://bugs.webkit.org/show_bug.cgi?id=87161
4338
4339 Reviewed by Oliver Hunt.
4340
4341 Merge r118138 from dfgopt.
4342
4343 This patch adds redundant store elimination. For example, consider this
4344 code:
4345
4346 o.x = 42;
4347 o.x = 84;
4348
4349 If o.x is speculated to be a well-behaved field, the first assignment is
4350 unnecessary, since the second just overwrites it. We would like to
4351 eliminate the first assignment in these cases. The need for this
4352 optimization arises mostly from stores that our runtime requires. For
4353 example:
4354
4355 o = {f:1, g:2, h:3};
4356
4357 This will have four assignments to the structure for the newly created
4358 object - one assignment for the empty structure, one for {f}, one for
4359 {f, g}, and one for {f, g, h}. We would like to only have the last of
4360 those assigments in this case.
4361
4362 Intriguingly, doing so for captured variables breaks the way arguments
4363 simplification used to work. Consider that prior to either arguments
4364 simplification or store elimination we will have IR that looks like:
4365
4366 a: SetLocal(r0, Empty)
4367 b: SetLocal(r1, Empty)
4368 c: GetLocal(r0)
4369 d: CreateArguments(@c)
4370 e: SetLocal(r0, @d)
4371 f: SetLocal(r1, @d)
4372
4373 Then redundant store elimination will eliminate the stores that
4374 initialize the arguments registers to Empty, but then arguments
4375 simplification eliminates the stores that initialize the arguments to
4376 the newly created arguments - and at this point we no longer have any
4377 stores to the arguments register, leading to hilarious crashes. This
4378 patch therefore changes arguments simplification to replace
4379 CreateArguments with JSConstant(Empty) rather than eliminating the
4380 SetLocals. But this revealed bugs where arguments simplification was
4381 being overzealous, so I fixed those bugs.
4382
4383 This is a minor speed-up on V8/early and a handful of other tests.
4384
4385 * bytecode/CodeBlock.h:
4386 (JSC::CodeBlock::uncheckedActivationRegister):
4387 * dfg/DFGAbstractState.cpp:
4388 (JSC::DFG::AbstractState::execute):
4389 * dfg/DFGArgumentsSimplificationPhase.cpp:
4390 (JSC::DFG::ArgumentsSimplificationPhase::run):
4391 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
4392 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUses):
4393 (JSC::DFG::ArgumentsSimplificationPhase::observeProperArgumentsUse):
4394 * dfg/DFGCSEPhase.cpp:
4395 (JSC::DFG::CSEPhase::globalVarStoreElimination):
4396 (CSEPhase):
4397 (JSC::DFG::CSEPhase::putStructureStoreElimination):
4398 (JSC::DFG::CSEPhase::putByOffsetStoreElimination):
4399 (JSC::DFG::CSEPhase::setLocalStoreElimination):
4400 (JSC::DFG::CSEPhase::setReplacement):
4401 (JSC::DFG::CSEPhase::eliminate):
4402 (JSC::DFG::CSEPhase::performNodeCSE):
4403 * dfg/DFGGraph.h:
4404 (JSC::DFG::Graph::uncheckedActivationRegisterFor):
4405 (Graph):
4406 * dfg/DFGNode.h:
4407 (JSC::DFG::Node::isPhantomArguments):
4408 (Node):
4409 (JSC::DFG::Node::hasConstant):
4410 (JSC::DFG::Node::valueOfJSConstant):
4411 (JSC::DFG::Node::hasStructureTransitionData):
4412 * dfg/DFGNodeType.h:
4413 (DFG):
4414 * dfg/DFGPredictionPropagationPhase.cpp:
4415 (JSC::DFG::PredictionPropagationPhase::propagate):
4416 * dfg/DFGSpeculativeJIT.cpp:
4417 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
4418 * dfg/DFGSpeculativeJIT32_64.cpp:
4419 (JSC::DFG::SpeculativeJIT::compile):
4420 * dfg/DFGSpeculativeJIT64.cpp:
4421 (JSC::DFG::SpeculativeJIT::compile):
4422
fpizlo@apple.com016fd682012-05-25 20:19:55 +000044232012-05-21 Filip Pizlo <fpizlo@apple.com>
4424
4425 DFG ConvertThis should just be a CheckStructure if the structure is known
4426 https://bugs.webkit.org/show_bug.cgi?id=87057
4427
4428 Reviewed by Gavin Barraclough.
4429
4430 Merged r118021 from dfgopt.
4431
4432 This gives ValueProfile the ability to track singleton values - i.e. profiling
4433 sites that always see the same value.
4434
4435 That is then used to profile the structure in op_convert_this.
4436
4437 This is then used to optimize op_convert_this into a CheckStructure if the
4438 structure is always the same.
4439
4440 That then results in better CSE in inlined code that uses 'this', since
4441 previously we couldn't CSE accesses on 'this' from different inline call frames.
4442
4443 Also fixed a bug where we were unnecessarily flushing 'this'.
4444
4445 * bytecode/CodeBlock.cpp:
4446 (JSC::CodeBlock::dump):
4447 (JSC::CodeBlock::stronglyVisitStrongReferences):
4448 * bytecode/LazyOperandValueProfile.cpp:
4449 (JSC::CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions):
4450 * bytecode/LazyOperandValueProfile.h:
4451 (CompressedLazyOperandValueProfileHolder):
4452 * bytecode/Opcode.h:
4453 (JSC):
4454 (JSC::padOpcodeName):
4455 * bytecode/ValueProfile.h:
4456 (JSC::ValueProfileBase::ValueProfileBase):
4457 (JSC::ValueProfileBase::dump):
4458 (JSC::ValueProfileBase::computeUpdatedPrediction):
4459 (ValueProfileBase):
4460 * bytecompiler/BytecodeGenerator.cpp:
4461 (JSC::BytecodeGenerator::BytecodeGenerator):
4462 * dfg/DFGByteCodeParser.cpp:
4463 (JSC::DFG::ByteCodeParser::setArgument):
4464 (JSC::DFG::ByteCodeParser::parseBlock):
4465 * jit/JITOpcodes.cpp:
4466 (JSC::JIT::emit_op_convert_this):
4467 (JSC::JIT::emitSlow_op_convert_this):
4468 * jit/JITOpcodes32_64.cpp:
4469 (JSC::JIT::emit_op_convert_this):
4470 (JSC::JIT::emitSlow_op_convert_this):
4471 * llint/LLIntSlowPaths.cpp:
4472 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
4473 * llint/LowLevelInterpreter32_64.asm:
4474 * llint/LowLevelInterpreter64.asm:
4475 * runtime/JSValue.h:
4476 (JSValue):
4477 * runtime/Structure.h:
4478 (JSC::JSValue::structureOrUndefined):
4479 (JSC):
4480
timothy_horton@apple.com3f03ac12012-05-25 06:53:27 +000044812012-05-24 Tim Horton <timothy_horton@apple.com>
4482
4483 Add feature defines for web-facing parts of CSS Regions and Exclusions
4484 https://bugs.webkit.org/show_bug.cgi?id=87442
4485 <rdar://problem/10887709>
4486
4487 Reviewed by Dan Bernstein.
4488
4489 * Configurations/FeatureDefines.xcconfig:
4490
ggaren@apple.com9e1789f2012-05-25 06:52:00 +000044912012-05-24 Geoffrey Garen <ggaren@apple.com>
4492
4493 WebKit should be lazy-finalization-safe (esp. the DOM)
4494 https://bugs.webkit.org/show_bug.cgi?id=87456
4495
4496 Reviewed by Filip Pizlo.
4497
4498 Lazy finalization adds one twist to weak pointer use:
4499
4500 A HashMap of weak pointers may contain logically null entries.
4501 (Weak pointers behave as-if null once their payloads die.)
4502 Insertion must not assume that a pre-existing entry is
4503 necessarily valid, and iteration must not assume that all
4504 entries can be dereferenced.
4505
4506 (Previously, I thought that it also added a second twist:
4507
4508 A demand-allocated weak pointer may replace a dead payload
4509 before the payload's finalizer runs. In that case, when the
4510 payload's finalizer runs, the payload has already been
4511 overwritten, and the finalizer should not clear the payload,
4512 which now points to something new.
4513
4514 But that's not the case here, since we cancel the old payload's
4515 finalizer when we over-write it. I've added ASSERTs to verify this
4516 assumption, in case it ever changes.)
4517
4518 * API/JSClassRef.cpp:
4519 (OpaqueJSClass::prototype): No need to specify null; that's the default.
4520
4521 * API/JSWeakObjectMapRefPrivate.cpp: Use remove, since take() is gone.
4522
4523 * heap/PassWeak.h:
4524 (WeakImplAccessor::was): This is no longer a debug-only function, since
4525 it's required to reason about lazily finalized pointers.
4526
4527 * heap/Weak.h:
4528 (JSC::weakAdd):
4529 (JSC::weakRemove):
4530 (JSC::weakClear): Added these helper functions for the common idioms of
4531 what clients want to do in their weak pointer finalizers.
4532
4533 * jit/JITStubs.cpp:
4534 (JSC::JITThunks::hostFunctionStub): Use the new idioms. Otherwise, we
4535 would return NULL for a "zombie" executable weak pointer that was waiting
4536 for finalization (item (2)), and finalizing a dead executable weak pointer
4537 would potentially destroy a new, live one (item (1)).
4538
4539 * runtime/RegExpCache.cpp:
4540 (JSC::RegExpCache::lookupOrCreate):
4541 (JSC::RegExpCache::finalize): Ditto.
4542
4543 (JSC::RegExpCache::invalidateCode): Check for null while iterating. (See
4544 item (2).)
4545
4546 * runtime/Structure.cpp:
4547 (JSC::StructureTransitionTable::contains):
4548 (JSC::StructureTransitionTable::add): Use get and set instead of add and
4549 contains, since add and contains are not compatible with lazy finalization.
4550
4551 * runtime/WeakGCMap.h:
4552 (WeakGCMap):
4553 (JSC::WeakGCMap::clear):
4554 (JSC::WeakGCMap::remove): Removed a bunch of code that was incompatible with
4555 lazy finalization because I didn't feel like making it compatible, and I had
4556 no way to test it.
4557
fpizlo@apple.com0b9b37a2012-05-25 03:29:18 +000045582012-05-24 Filip Pizlo <fpizlo@apple.com>
4559
fpizlo@apple.com9d899a42012-05-25 05:41:03 +00004560 REGRESSION (r118013-r118031): Loops/Reloads under www.yahoo.com, quits after three tries with error
4561 https://bugs.webkit.org/show_bug.cgi?id=87327
4562
4563 Reviewed by Geoffrey Garen.
4564
4565 If you use AbstractValue::filter(StructureSet) to test subset relationships between TOP and a
4566 set containing >=2 elements, you're going to have a bad time.
4567
4568 That's because AbstractValue considers a set with >=2 elements to be equivalent to TOP, in order
4569 to save space and speed up convergence. So filtering has no effect in this case, which made
4570 the code think that the abstract value was proving that the structure check was unnecessary.
4571 The correct thing to do is to use isSubsetOf() on the StructureAbstractValue, which does the
4572 right thingies for TOP and >=2 elements.
4573
4574 * dfg/DFGAbstractState.cpp:
4575 (JSC::DFG::AbstractState::execute):
4576 * dfg/DFGSpeculativeJIT32_64.cpp:
4577 (JSC::DFG::SpeculativeJIT::compile):
4578 * dfg/DFGSpeculativeJIT64.cpp:
4579 (JSC::DFG::SpeculativeJIT::compile):
4580
45812012-05-24 Filip Pizlo <fpizlo@apple.com>
4582
fpizlo@apple.com0b9b37a2012-05-25 03:29:18 +00004583 new test fast/js/dfg-arguments-mixed-alias.html fails on JSVALUE32_64
4584 https://bugs.webkit.org/show_bug.cgi?id=87378
4585
4586 Reviewed by Gavin Barraclough.
4587
4588 - Captured variable tracking forgot did not consistently handle arguments, leading to OSR
4589 badness.
4590
4591 - Nodes capable of exiting were tracked in a non-monotonic way, leading to compiler errors.
4592
4593 * dfg/DFGByteCodeParser.cpp:
4594 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
4595 * dfg/DFGCSEPhase.cpp:
4596 (JSC::DFG::CSEPhase::CSEPhase):
4597 (CSEPhase):
4598 (JSC::DFG::performCSE):
4599 * dfg/DFGCSEPhase.h:
4600 (DFG):
4601 * dfg/DFGCommon.h:
4602 * dfg/DFGDriver.cpp:
4603 (JSC::DFG::compile):
4604 * dfg/DFGGraph.cpp:
4605 (JSC::DFG::Graph::resetExitStates):
4606 (DFG):
4607 * dfg/DFGGraph.h:
4608 (Graph):
4609 * dfg/DFGPhase.h:
4610 (DFG):
4611 (JSC::DFG::runPhase):
4612
ggaren@apple.com39281e22012-05-24 21:18:10 +000046132012-05-24 Geoffrey Garen <ggaren@apple.com>
4614
4615 Made WeakSet per-block instead of per-heap
4616 https://bugs.webkit.org/show_bug.cgi?id=87401
4617
4618 Reviewed by Oliver Hunt.
4619
4620 This allows us fast access to the set of all weak pointers for a block,
4621 which is a step toward lazy finalization.
4622
4623 No performance change.
4624
4625 * heap/Heap.cpp:
4626 (JSC::Heap::Heap):
4627 (JSC::Heap::lastChanceToFinalize): Removed the per-heap weak set, since
4628 it's per-block now.
4629
4630 (JSC::Heap::markRoots): Delegate weak set visiting to the marked space,
4631 since it knows how to iterate all blocks.
4632
4633 (JSC::Heap::collect): Moved the reaping outside of markRoots, since it
4634 doesn't mark anything.
4635
4636 Make sure to reset allocators after shrinking, since shrinking may
4637 deallocate the current allocator.
4638
4639 * heap/Heap.h:
4640 (Heap): No more per-heap weak set, since it's per-block now.
4641
4642 * heap/MarkedBlock.cpp:
4643 (JSC::MarkedBlock::MarkedBlock):
4644 * heap/MarkedBlock.h:
4645 (MarkedBlock):
4646 (JSC::MarkedBlock::lastChanceToFinalize): Migrated finalization logic
4647 here from the heap, so the heap doesn't need to know about our internal
4648 data structures like our weak set.
4649
4650 (JSC::MarkedBlock::heap):
4651 (JSC::MarkedBlock::weakSet):
4652 (JSC::MarkedBlock::shrink):
4653 (JSC::MarkedBlock::resetAllocator):
4654 (JSC::MarkedBlock::visitWeakSet):
4655 (JSC::MarkedBlock::reapWeakSet):
4656 (JSC::MarkedBlock::sweepWeakSet):
4657 * heap/MarkedSpace.cpp:
4658 (JSC::VisitWeakSet::VisitWeakSet):
4659 (JSC::VisitWeakSet::operator()):
4660 (VisitWeakSet):
4661 (JSC):
4662 (JSC::ReapWeakSet::operator()):
4663 (JSC::SweepWeakSet::operator()):
4664 (JSC::LastChanceToFinalize::operator()):
4665 (JSC::MarkedSpace::lastChanceToFinalize):
4666 (JSC::ResetAllocator::operator()):
4667 (JSC::MarkedSpace::resetAllocators):
4668 (JSC::MarkedSpace::visitWeakSets):
4669 (JSC::MarkedSpace::reapWeakSets):
4670 (JSC::MarkedSpace::sweepWeakSets):
4671 (JSC::Shrink::operator()):
4672 (JSC::MarkedSpace::shrink):
4673 * heap/MarkedSpace.h:
4674 (MarkedSpace): Make sure to account for our weak sets when sweeping,
4675 shrinking, etc.
4676
4677 * heap/WeakSet.cpp:
4678 (JSC):
4679 * heap/WeakSet.h:
4680 (WeakSet):
4681 (JSC::WeakSet::heap):
4682 (JSC):
4683 (JSC::WeakSet::lastChanceToFinalize):
4684 (JSC::WeakSet::visit):
4685 (JSC::WeakSet::reap):
4686 (JSC::WeakSet::shrink):
4687 (JSC::WeakSet::resetAllocator): Inlined some things since they're called
4688 once per block now instead of once per heap.
4689
4690 * heap/WeakSetInlines.h:
4691 (JSC::WeakSet::allocate): Use the per-block weak set since there is no
4692 per-heap weak set anymore.
4693
barraclough@apple.comefdbf472012-05-24 21:14:07 +000046942012-05-24 Gavin Barraclough <barraclough@apple.com>
4695
barraclough@apple.com8ca6a7a2012-05-24 21:17:38 +00004696 Fix arm build
4697
4698 Rubber stamped by Geoff Garen
4699
4700 * dfg/DFGGPRInfo.h:
4701 (GPRInfo):
4702
47032012-05-24 Gavin Barraclough <barraclough@apple.com>
4704
barraclough@apple.comefdbf472012-05-24 21:14:07 +00004705 Move cacheFlush from ExecutableAllocator to Assembler classes
4706 https://bugs.webkit.org/show_bug.cgi?id=87420
4707
4708 Reviewed by Oliver Hunt.
4709
4710 Makes more sense there, & remove a pile of #ifdefs.
4711
4712 * assembler/ARMAssembler.cpp:
4713 (JSC):
4714 (JSC::ARMAssembler::cacheFlush):
4715 * assembler/ARMAssembler.h:
4716 (ARMAssembler):
4717 (JSC::ARMAssembler::cacheFlush):
4718 * assembler/ARMv7Assembler.h:
4719 (JSC::ARMv7Assembler::relinkJump):
4720 (JSC::ARMv7Assembler::cacheFlush):
4721 (ARMv7Assembler):
4722 (JSC::ARMv7Assembler::setInt32):
4723 (JSC::ARMv7Assembler::setUInt7ForLoad):
4724 * assembler/AbstractMacroAssembler.h:
4725 (JSC::AbstractMacroAssembler::cacheFlush):
4726 * assembler/LinkBuffer.h:
4727 (JSC::LinkBuffer::performFinalization):
4728 * assembler/MIPSAssembler.h:
4729 (JSC::MIPSAssembler::relinkJump):
4730 (JSC::MIPSAssembler::relinkCall):
4731 (JSC::MIPSAssembler::repatchInt32):
4732 (JSC::MIPSAssembler::cacheFlush):
4733 (MIPSAssembler):
4734 * assembler/SH4Assembler.h:
4735 (JSC::SH4Assembler::repatchCompact):
4736 (JSC::SH4Assembler::cacheFlush):
4737 (SH4Assembler):
4738 * assembler/X86Assembler.h:
4739 (X86Assembler):
4740 (JSC::X86Assembler::cacheFlush):
4741 * jit/ExecutableAllocator.cpp:
4742 (JSC):
4743 * jit/ExecutableAllocator.h:
4744 (ExecutableAllocator):
4745
commit-queue@webkit.org2c8bcde2012-05-24 20:01:53 +000047462012-05-24 John Mellor <johnme@chromium.org>
4747
4748 Font Boosting: Add compile flag and runtime setting
4749 https://bugs.webkit.org/show_bug.cgi?id=87394
4750
4751 Reviewed by Adam Barth.
4752
4753 Add ENABLE_FONT_BOOSTING.
4754
4755 * Configurations/FeatureDefines.xcconfig:
4756
commit-queue@webkit.orgd553c622012-05-24 10:50:40 +000047572012-05-24 Allan Sandfeld Jensen <allan.jensen@nokia.com>
4758
4759 cti_vm_throw gets kicked out by gcc 4.6 -flto
4760 https://bugs.webkit.org/show_bug.cgi?id=56088
4761
4762 Reviewed by Darin Adler.
4763
4764 Add REFERENCED_FROM_ASM to functions only referenced from assembler.
4765
4766 * dfg/DFGOperations.cpp:
4767 * jit/HostCallReturnValue.h:
4768 * jit/JITStubs.h:
4769 * jit/ThunkGenerators.cpp:
4770
fpizlo@apple.com36f14462012-05-24 07:35:05 +000047712012-05-24 Filip Pizlo <fpizlo@apple.com>
4772
4773 Incorrect merge of r117542 from dfg opt branch in r118323 is leading to fast/js/dfg-arguments-osr-exit.html failing
4774 https://bugs.webkit.org/show_bug.cgi?id=87350
4775
4776 Reviewed by Maciej Stachowiak.
4777
4778 The dfgopt branch introduced the notion of a local variable being killed because it was aliased
4779 to the Arguments object as in cases like:
4780
4781 var a = arguments;
4782 return a.length;
4783
4784 This required changes to OSR exit handling - if the variable is dead but aliased to arguments, then
4785 OSR exit should reify the arguments. But meanwhile, in tip of tree we introduced special handling for
4786 dead variables on OSR exit. When the two were merged in r118323, the structure of the if/else branches
4787 ended up being such that we would treat dead arguments variables as totally dead as opposed to treating
4788 them as variables that need arguments reification.
4789
4790 This fixes the structure of the relevant if/else block so that variables that are dead-but-arguments
4791 end up being treated as reified arguments objects, while variables that are dead but not aliased to
4792 arguments are treated as tip of tree would have treated them (initialize to Undefined).
4793
4794 * dfg/DFGSpeculativeJIT.cpp:
4795 (JSC::DFG::SpeculativeJIT::compile):
4796
ossy@webkit.orgbc0d6372012-05-24 07:05:31 +000047972012-05-24 Csaba Osztrogonác <ossy@webkit.org>
4798
4799 Unreviewed 32 bit buildfix after r118325.
4800
4801 * dfg/DFGSpeculativeJIT32_64.cpp:
4802 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): Use ASSERT_UNUSED instead ASSERT.
4803
fpizlo@apple.comd96eb4e2012-05-24 06:58:52 +000048042012-05-23 Filip Pizlo <fpizlo@apple.com>
4805
fpizlo@apple.comb3ac2422012-05-24 07:00:24 +00004806 DFG operationTearOffActivation should return after handling the null activation case
4807 https://bugs.webkit.org/show_bug.cgi?id=87348
4808 <rdar://problem/11522295>
4809
4810 Reviewed by Oliver Hunt.
4811
4812 * dfg/DFGOperations.cpp:
4813
48142012-05-23 Filip Pizlo <fpizlo@apple.com>
4815
fpizlo@apple.comd96eb4e2012-05-24 06:58:52 +00004816 Unreviewed, merge the arguments fix in r118138 to get bots green.
4817
4818 * dfg/DFGArgumentsSimplificationPhase.cpp:
4819 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
4820
fpizlo@apple.comb9c94622012-05-24 05:51:05 +000048212012-05-20 Filip Pizlo <fpizlo@apple.com>
4822
fpizlo@apple.com91b2c682012-05-24 06:24:36 +00004823 DFG CFA should record if a node can OSR exit
4824 https://bugs.webkit.org/show_bug.cgi?id=86905
4825
4826 Reviewed by Oliver Hunt.
4827
4828 Merged r117931 from dfgopt.
4829
4830 Adds a NodeFlag that denotes nodes that are known to not have OSR exits.
4831 This ought to aid any backwards analyses that need to know when a
4832 backward flow merge might happen due to a side exit.
4833
4834 Also added assertions into speculationCheck() that ensure that we did not
4835 mark a node as non-exiting and then promptly compile in an exit. This
4836 helped catch some minor bugs where we were doing unnecessary speculation
4837 checks.
4838
4839 This is a perf-neutral change. The speculation checks that this removes
4840 were not on hot paths of major benchmarks.
4841
4842 * bytecode/PredictedType.h:
4843 (JSC):
4844 (JSC::isAnyPrediction):
4845 * dfg/DFGAbstractState.cpp:
4846 (JSC::DFG::AbstractState::execute):
4847 * dfg/DFGAbstractState.h:
4848 (JSC::DFG::AbstractState::speculateInt32Unary):
4849 (AbstractState):
4850 (JSC::DFG::AbstractState::speculateNumberUnary):
4851 (JSC::DFG::AbstractState::speculateBooleanUnary):
4852 (JSC::DFG::AbstractState::speculateInt32Binary):
4853 (JSC::DFG::AbstractState::speculateNumberBinary):
4854 * dfg/DFGNode.h:
4855 (JSC::DFG::Node::mergeFlags):
4856 (JSC::DFG::Node::filterFlags):
4857 (Node):
4858 (JSC::DFG::Node::setCanExit):
4859 (JSC::DFG::Node::canExit):
4860 * dfg/DFGNodeFlags.cpp:
4861 (JSC::DFG::nodeFlagsAsString):
4862 * dfg/DFGNodeFlags.h:
4863 (DFG):
4864 * dfg/DFGSpeculativeJIT.cpp:
4865 (JSC::DFG::SpeculativeJIT::SpeculativeJIT):
4866 (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
4867 (JSC::DFG::SpeculativeJIT::compileValueToInt32):
4868 * dfg/DFGSpeculativeJIT.h:
4869 (JSC::DFG::SpeculativeJIT::speculationCheck):
4870 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
4871 (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution):
4872 (SpeculativeJIT):
4873 * dfg/DFGSpeculativeJIT32_64.cpp:
4874 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
4875 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
4876 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
4877 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
4878 (JSC::DFG::SpeculativeJIT::compile):
4879 * dfg/DFGSpeculativeJIT64.cpp:
4880 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
4881 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
4882 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
4883 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
4884 (JSC::DFG::SpeculativeJIT::compile):
4885
48862012-05-20 Filip Pizlo <fpizlo@apple.com>
4887
fpizlo@apple.comb9c94622012-05-24 05:51:05 +00004888 DFG should not do unnecessary indirections when storing to objects
4889 https://bugs.webkit.org/show_bug.cgi?id=86959
4890
4891 Reviewed by Oliver Hunt.
4892
4893 Merged r117819 from dfgopt.
4894
4895 * dfg/DFGByteCodeParser.cpp:
4896 (JSC::DFG::ByteCodeParser::parseBlock):
4897 * dfg/DFGCSEPhase.cpp:
4898 (JSC::DFG::CSEPhase::getByOffsetLoadElimination):
4899 * dfg/DFGSpeculativeJIT32_64.cpp:
4900 (JSC::DFG::SpeculativeJIT::compile):
4901 * dfg/DFGSpeculativeJIT64.cpp:
4902 (JSC::DFG::SpeculativeJIT::compile):
4903
fpizlo@apple.com9a548f12012-05-24 05:33:09 +000049042012-05-17 Filip Pizlo <fpizlo@apple.com>
4905
4906 DFG should optimize aliased uses of the Arguments object of the current call frame
4907 https://bugs.webkit.org/show_bug.cgi?id=86552
4908
4909 Reviewed by Geoff Garen.
4910
4911 Merged r117542 and r117543 from dfgopt.
4912
4913 Performs must-alias and escape analysis on uses of CreateArguments, and if
4914 a variable is must-aliased to CreateArguments and does not escape, then we
4915 turn all uses of that variable into direct arguments accesses.
4916
4917 36% speed-up on V8/earley leading to a 2.3% speed-up overall in V8.
4918
4919 * bytecode/CodeBlock.h:
4920 (JSC::CodeBlock::uncheckedArgumentsRegister):
4921 * bytecode/ValueRecovery.h:
4922 (JSC::ValueRecovery::argumentsThatWereNotCreated):
4923 (ValueRecovery):
4924 (JSC::ValueRecovery::dump):
4925 * dfg/DFGAbstractState.cpp:
4926 (JSC::DFG::AbstractState::execute):
4927 * dfg/DFGAdjacencyList.h:
4928 (AdjacencyList):
4929 (JSC::DFG::AdjacencyList::removeEdgeFromBag):
4930 * dfg/DFGArgumentsSimplificationPhase.cpp:
4931 (JSC::DFG::ArgumentsSimplificationPhase::run):
4932 (ArgumentsSimplificationPhase):
4933 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
4934 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUses):
4935 (JSC::DFG::ArgumentsSimplificationPhase::observeProperArgumentsUse):
4936 (JSC::DFG::ArgumentsSimplificationPhase::isOKToOptimize):
4937 (JSC::DFG::ArgumentsSimplificationPhase::removeArgumentsReferencingPhantomChild):
4938 * dfg/DFGAssemblyHelpers.h:
4939 (JSC::DFG::AssemblyHelpers::argumentsRegisterFor):
4940 (AssemblyHelpers):
4941 * dfg/DFGByteCodeParser.cpp:
4942 (JSC::DFG::ByteCodeParser::parseBlock):
4943 * dfg/DFGCFGSimplificationPhase.cpp:
4944 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
4945 * dfg/DFGGPRInfo.h:
4946 (GPRInfo):
4947 * dfg/DFGGraph.cpp:
4948 (JSC::DFG::Graph::collectGarbage):
4949 (DFG):
4950 * dfg/DFGGraph.h:
4951 (Graph):
4952 (JSC::DFG::Graph::executableFor):
4953 (JSC::DFG::Graph::argumentsRegisterFor):
4954 (JSC::DFG::Graph::uncheckedArgumentsRegisterFor):
4955 (JSC::DFG::Graph::clobbersWorld):
4956 * dfg/DFGNode.h:
4957 (JSC::DFG::Node::hasHeapPrediction):
4958 * dfg/DFGNodeType.h:
4959 (DFG):
4960 * dfg/DFGOSRExitCompiler.cpp:
4961 * dfg/DFGOSRExitCompiler.h:
4962 (JSC::DFG::OSRExitCompiler::OSRExitCompiler):
4963 (OSRExitCompiler):
4964 * dfg/DFGOSRExitCompiler32_64.cpp:
4965 (JSC::DFG::OSRExitCompiler::compileExit):
4966 * dfg/DFGOSRExitCompiler64.cpp:
4967 (JSC::DFG::OSRExitCompiler::compileExit):
4968 * dfg/DFGOperations.cpp:
4969 * dfg/DFGPredictionPropagationPhase.cpp:
4970 (JSC::DFG::PredictionPropagationPhase::propagate):
4971 * dfg/DFGSpeculativeJIT.cpp:
4972 (JSC::DFG::ValueSource::dump):
4973 (JSC::DFG::SpeculativeJIT::compile):
4974 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
4975 * dfg/DFGSpeculativeJIT.h:
4976 * dfg/DFGSpeculativeJIT32_64.cpp:
4977 (JSC::DFG::SpeculativeJIT::compile):
4978 * dfg/DFGSpeculativeJIT64.cpp:
4979 (JSC::DFG::SpeculativeJIT::compile):
4980 * dfg/DFGVariableAccessData.h:
4981 (JSC::DFG::VariableAccessData::VariableAccessData):
4982 (JSC::DFG::VariableAccessData::mergeIsArgumentsAlias):
4983 (VariableAccessData):
4984 (JSC::DFG::VariableAccessData::isArgumentsAlias):
4985 * jit/JITOpcodes.cpp:
4986 (JSC::JIT::emitSlow_op_get_argument_by_val):
4987
fpizlo@apple.comdb7ba192012-05-24 02:28:52 +000049882012-05-23 Filip Pizlo <fpizlo@apple.com>
4989
fpizlo@apple.comae3413b2012-05-24 02:34:09 +00004990 DFGCapabilities should not try to get an arguments register from code blocks that don't have one
4991 https://bugs.webkit.org/show_bug.cgi?id=87332
4992
4993 Reviewed by Andy Estes.
4994
4995 * dfg/DFGCapabilities.h:
4996 (JSC::DFG::canInlineOpcode):
4997
49982012-05-23 Filip Pizlo <fpizlo@apple.com>
4999
fpizlo@apple.comdb7ba192012-05-24 02:28:52 +00005000 DFG should have sparse conditional constant propagation
5001 https://bugs.webkit.org/show_bug.cgi?id=86580
5002
5003 Reviewed by Oliver Hunt.
5004
5005 Merged r117370 from dfgopt.
5006
5007 This enhances CFA so that if it suspects at any point during the fixpoint that a
5008 branch will only go one way, then it only propagates in that one way.
5009
5010 This vastly increases the opportunities for CFG simplification. For example, it
5011 enables us to evaporate this loop:
5012
5013 for (var i = 0; i < 1; ++i) doThings(i);
5014
5015 As a result, it uncovered loads of bugs in the CFG simplifier. In particular:
5016
5017 - Phi fixup was assuming that all Phis worth fixing up are shouldGenerate().
5018 That's not true; we also fixup Phis that are dead.
5019
5020 - GetLocal fixup was assuming that it's only necessary to rewire links to a
5021 GetLocal, and that the GetLocal's own links don't need to be rewired. Untrue,
5022 because the GetLocal may not be rewirable (first block has no GetLocal for r42
5023 but second block does have a GetLocal), in which case it will refer to a Phi
5024 in the second block. We need it to refer to a Phi from the first block to
5025 ensure that subsequent transformations work.
5026
5027 - Tail operand fixup was ignoring the fact that Phis in successors may contain
5028 references to the children of our tail variables. Hence, successor Phi child
5029 substitution needs to use the original second block variable table as its
5030 prior, rather than trying to reconstruct the prior later (since by that point
5031 the children of the second block's tail variables will have been fixed up, so
5032 we will not know what the prior would have been).
5033
5034 * dfg/DFGAbstractState.cpp:
5035 (JSC::DFG::AbstractState::beginBasicBlock):
5036 (JSC::DFG::AbstractState::endBasicBlock):
5037 (JSC::DFG::AbstractState::reset):
5038 (JSC::DFG::AbstractState::execute):
5039 (JSC::DFG::AbstractState::mergeToSuccessors):
5040 * dfg/DFGAbstractState.h:
5041 (JSC::DFG::AbstractState::branchDirectionToString):
5042 (AbstractState):
5043 * dfg/DFGCFGSimplificationPhase.cpp:
5044 (JSC::DFG::CFGSimplificationPhase::run):
5045 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
5046 (JSC::DFG::CFGSimplificationPhase::OperandSubstitution::OperandSubstitution):
5047 (OperandSubstitution):
5048 (JSC::DFG::CFGSimplificationPhase::skipGetLocal):
5049 (JSC::DFG::CFGSimplificationPhase::recordPossibleIncomingReference):
5050 (CFGSimplificationPhase):
5051 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
5052 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
5053 * dfg/DFGGraph.h:
5054 (JSC::DFG::Graph::changeEdge):
5055
ojan@chromium.org959e4a22012-05-24 02:03:04 +000050562012-05-23 Ojan Vafai <ojan@chromium.org>
5057
5058 add back the ability to disable flexbox
5059 https://bugs.webkit.org/show_bug.cgi?id=87147
5060
5061 Reviewed by Tony Chang.
5062
5063 * Configurations/FeatureDefines.xcconfig:
5064
fpizlo@apple.com9b928722012-05-24 00:18:55 +000050652012-05-23 Filip Pizlo <fpizlo@apple.com>
5066
fpizlo@apple.com16faaea2012-05-24 01:04:55 +00005067 Unreviewed, fix Windows build.
5068
5069 * bytecode/CodeBlock.h:
5070 * dfg/DFGCapabilities.h:
5071 (JSC::DFG::canCompileOpcode):
5072 (JSC::DFG::canCompileOpcodes):
5073 * dfg/DFGCommon.h:
5074 (DFG):
5075
50762012-05-23 Filip Pizlo <fpizlo@apple.com>
5077
fpizlo@apple.com9b928722012-05-24 00:18:55 +00005078 DFG should optimize inlined uses of arguments.length and arguments[i]
5079 https://bugs.webkit.org/show_bug.cgi?id=86327
5080
5081 Reviewed by Gavin Barraclough.
5082
5083 Merged r117017 from dfgopt.
5084
5085 Turns inlined uses of arguments.length into a constant.
5086
5087 Turns inlined uses of arguments[constant] into a direct reference to the
5088 argument.
5089
5090 Big win on micro-benchmarks. Not yet a win on V8 because the hot uses of
5091 arguments.length and arguments[i] are aliased. I'll leave the aliasing
5092 optimizations to a later patch.
5093
5094 * CMakeLists.txt:
5095 * GNUmakefile.list.am:
5096 * JavaScriptCore.xcodeproj/project.pbxproj:
5097 * Target.pri:
5098 * bytecode/DFGExitProfile.h:
5099 (FrequentExitSite):
5100 (JSC::DFG::FrequentExitSite::FrequentExitSite):
5101 (JSC::DFG::QueryableExitProfile::hasExitSite):
5102 (QueryableExitProfile):
5103 * dfg/DFGAbstractState.cpp:
5104 (JSC::DFG::AbstractState::execute):
5105 * dfg/DFGArgumentsSimplificationPhase.cpp: Added.
5106 (DFG):
5107 (ArgumentsSimplificationPhase):
5108 (JSC::DFG::ArgumentsSimplificationPhase::ArgumentsSimplificationPhase):
5109 (JSC::DFG::ArgumentsSimplificationPhase::run):
5110 (JSC::DFG::performArgumentsSimplification):
5111 * dfg/DFGArgumentsSimplificationPhase.h: Added.
5112 (DFG):
5113 * dfg/DFGAssemblyHelpers.cpp:
5114 (JSC::DFG::AssemblyHelpers::executableFor):
5115 (DFG):
5116 * dfg/DFGAssemblyHelpers.h:
5117 (AssemblyHelpers):
5118 * dfg/DFGByteCodeParser.cpp:
5119 (JSC::DFG::ByteCodeParser::parseBlock):
5120 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
5121 * dfg/DFGCSEPhase.cpp:
5122 (JSC::DFG::CSEPhase::getLocalLoadElimination):
5123 (JSC::DFG::CSEPhase::performNodeCSE):
5124 * dfg/DFGDriver.cpp:
5125 (JSC::DFG::compile):
5126 * dfg/DFGGraph.h:
5127 (JSC::DFG::Graph::Graph):
5128 (JSC::DFG::Graph::executableFor):
5129 (Graph):
5130 (JSC::DFG::Graph::clobbersWorld):
5131 * dfg/DFGNode.h:
5132 (JSC::DFG::Node::convertToConstant):
5133 (JSC::DFG::Node::convertToGetLocalUnlinked):
5134 (Node):
5135 (JSC::DFG::Node::unlinkedLocal):
5136 * dfg/DFGNodeType.h:
5137 (DFG):
5138 * dfg/DFGOSRExit.cpp:
5139 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
5140 * dfg/DFGPredictionPropagationPhase.cpp:
5141 (JSC::DFG::PredictionPropagationPhase::propagate):
5142 * dfg/DFGSpeculativeJIT32_64.cpp:
5143 (JSC::DFG::SpeculativeJIT::compile):
5144 * dfg/DFGSpeculativeJIT64.cpp:
5145 (JSC::DFG::SpeculativeJIT::compile):
5146
fpizlo@apple.com5e3852d2012-05-24 00:05:21 +000051472012-05-13 Filip Pizlo <fpizlo@apple.com>
5148
5149 DFG should be able to optimize foo.apply(bar, arguments)
5150 https://bugs.webkit.org/show_bug.cgi?id=86306
5151
5152 Reviewed by Gavin Barraclough.
5153
5154 Merge r116912 from dfgopt.
5155
5156 Enables compilation of op_jneq_ptr and some forms of op_call_varargs.
5157
5158 Also includes a bunch of bug fixes that were made necessary by the increased
5159 pressure on the CFG simplifier.
5160
5161 This is a 1-2% win on V8.
5162
5163 * bytecode/CodeBlock.cpp:
5164 (JSC::CodeBlock::printCallOp):
5165 (JSC::CodeBlock::CodeBlock):
5166 (JSC::ProgramCodeBlock::canCompileWithDFGInternal):
5167 (JSC::EvalCodeBlock::canCompileWithDFGInternal):
5168 (JSC::FunctionCodeBlock::canCompileWithDFGInternal):
5169 * bytecode/CodeBlock.h:
5170 (CodeBlock):
5171 (JSC::CodeBlock::canCompileWithDFG):
5172 (JSC::CodeBlock::canCompileWithDFGState):
5173 (ProgramCodeBlock):
5174 (EvalCodeBlock):
5175 (FunctionCodeBlock):
5176 * dfg/DFGAbstractState.cpp:
5177 (JSC::DFG::AbstractState::execute):
5178 * dfg/DFGByteCodeParser.cpp:
5179 (JSC::DFG::ByteCodeParser::parseBlock):
5180 (JSC::DFG::ByteCodeParser::processPhiStack):
5181 (JSC::DFG::ByteCodeParser::parse):
5182 * dfg/DFGCFGSimplificationPhase.cpp:
5183 (JSC::DFG::CFGSimplificationPhase::run):
5184 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
5185 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
5186 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
5187 * dfg/DFGCSEPhase.cpp:
5188 (JSC::DFG::CSEPhase::getLocalLoadElimination):
5189 (CSEPhase):
5190 (JSC::DFG::CSEPhase::setReplacement):
5191 (JSC::DFG::CSEPhase::performNodeCSE):
5192 * dfg/DFGCapabilities.cpp:
5193 (JSC::DFG::debugFail):
5194 (DFG):
5195 (JSC::DFG::canHandleOpcodes):
5196 (JSC::DFG::canCompileOpcodes):
5197 (JSC::DFG::canInlineOpcodes):
5198 * dfg/DFGCapabilities.h:
5199 (JSC::DFG::canCompileOpcode):
5200 (JSC::DFG::canInlineOpcode):
5201 (DFG):
5202 (JSC::DFG::canCompileOpcodes):
5203 (JSC::DFG::canCompileEval):
5204 (JSC::DFG::canCompileProgram):
5205 (JSC::DFG::canCompileFunctionForCall):
5206 (JSC::DFG::canCompileFunctionForConstruct):
5207 * dfg/DFGCommon.h:
5208 * dfg/DFGGraph.cpp:
5209 (JSC::DFG::Graph::dump):
5210 * dfg/DFGNodeType.h:
5211 (DFG):
5212 * dfg/DFGPredictionPropagationPhase.cpp:
5213 (JSC::DFG::PredictionPropagationPhase::propagate):
5214 * dfg/DFGSpeculativeJIT32_64.cpp:
5215 (JSC::DFG::SpeculativeJIT::compile):
5216 * dfg/DFGSpeculativeJIT64.cpp:
5217 (JSC::DFG::SpeculativeJIT::emitCall):
5218 (JSC::DFG::SpeculativeJIT::compile):
5219 * dfg/DFGValidate.cpp:
5220 (Validate):
5221 (JSC::DFG::Validate::validate):
5222 (JSC::DFG::Validate::checkOperand):
5223 (JSC::DFG::Validate::reportValidationContext):
5224 * jit/JIT.cpp:
5225 (JSC::JIT::emitOptimizationCheck):
5226 (JSC::JIT::privateCompileSlowCases):
5227 (JSC::JIT::privateCompile):
5228 * jit/JIT.h:
5229 * jit/JITArithmetic.cpp:
5230 (JSC::JIT::compileBinaryArithOp):
5231 * jit/JITPropertyAccess.cpp:
5232 (JSC::JIT::privateCompilePutByIdTransition):
5233 * jit/JITPropertyAccess32_64.cpp:
5234 (JSC::JIT::privateCompilePutByIdTransition):
5235 * tools/CodeProfile.cpp:
5236 (JSC::CodeProfile::sample):
5237
ggaren@apple.com7070d422012-05-23 23:55:27 +000052382012-05-23 Geoffrey Garen <ggaren@apple.com>
5239
5240 Refactored WeakBlock to use malloc, clarify behavior
5241 https://bugs.webkit.org/show_bug.cgi?id=87318
5242
5243 Reviewed by Filip Pizlo.
5244
5245 We want to use malloc so we can make these smaller than 4KB,
5246 since an individual MarkedBlock will usually have fewer than
5247 4KB worth of weak pointers.
5248
5249 * heap/Heap.cpp:
5250 (JSC::Heap::markRoots): Renamed visitLiveWeakImpls to visit, since
5251 we no longer need to distinguish from "visitDeadWeakImpls".
5252
5253 Renamed "visitDeadWeakImpls" to "reap" because we're not actually
5254 doing any visiting -- we're just tagging things as dead.
5255
5256 * heap/WeakBlock.cpp:
5257 (JSC::WeakBlock::create):
5258 (JSC::WeakBlock::destroy):
5259 (JSC::WeakBlock::WeakBlock): Malloc!
5260
5261 (JSC::WeakBlock::visit):
5262 (JSC::WeakBlock::reap): Renamed as above.
5263
5264 * heap/WeakBlock.h:
5265 (WeakBlock): Reduced to 3KB, as explained above.
5266
5267 * heap/WeakSet.cpp:
5268 (JSC::WeakSet::visit):
5269 (JSC::WeakSet::reap):
5270 * heap/WeakSet.h:
5271 (WeakSet): Updated for renames, and to match WebKit style.
5272
fpizlo@apple.com11e2f372012-05-23 22:25:21 +000052732012-05-23 Filip Pizlo <fpizlo@apple.com>
5274
fpizlo@apple.combc96e8f2012-05-23 23:12:59 +00005275 Use after free in JSC::DFG::ByteCodeParser::processPhiStack
5276 https://bugs.webkit.org/show_bug.cgi?id=87312
5277 <rdar://problem/11518848>
5278
5279 Reviewed by Oliver Hunt.
5280
5281 * dfg/DFGByteCodeParser.cpp:
5282 (JSC::DFG::ByteCodeParser::processPhiStack):
5283 (JSC::DFG::ByteCodeParser::parse):
5284
52852012-05-23 Filip Pizlo <fpizlo@apple.com>
5286
fpizlo@apple.com11e2f372012-05-23 22:25:21 +00005287 It should be possible to make C function calls from DFG code on ARM in debug mode
5288 https://bugs.webkit.org/show_bug.cgi?id=87313
5289
5290 Reviewed by Gavin Barraclough.
5291
5292 * dfg/DFGSpeculativeJIT.h:
5293 (SpeculativeJIT):
5294
fpizlo@apple.comc6446112012-05-23 20:52:42 +000052952012-05-11 Filip Pizlo <fpizlo@apple.com>
5296
5297 DFG should be able to inline functions that use arguments reflectively
5298 https://bugs.webkit.org/show_bug.cgi?id=86132
5299
5300 Reviewed by Oliver Hunt.
5301
5302 Merged r116838 from dfgopt.
5303
5304 This turns on inlining of functions that use arguments reflectively, but it
5305 does not do any of the obvious optimizations that this exposes. I'll save that
5306 for another patch - the important thing for now is that this contains all of
5307 the plumbing necessary to make this kind of inlining sound even in bizarro
5308 cases like an inline callee escaping the arguments object to parts of the
5309 inline caller where the arguments are otherwise dead. Or even more fun cases
5310 like where you've inlined to an inline stack that is three-deep, and the
5311 function on top of the inline stack reflectively accesses the arguments of a
5312 function that is in the middle of the inline stack. Any subsequent
5313 optimizations that we do for the obvious cases of arguments usage in inline
5314 functions will have to take care not to break the baseline functionality that
5315 this patch plumbs together.
5316
5317 * bytecode/CodeBlock.cpp:
5318 (JSC::CodeBlock::printCallOp):
5319 (JSC::CodeBlock::dump):
5320 * bytecode/CodeBlock.h:
5321 * dfg/DFGAssemblyHelpers.h:
5322 (JSC::DFG::AssemblyHelpers::argumentsRegisterFor):
5323 (AssemblyHelpers):
5324 * dfg/DFGByteCodeParser.cpp:
5325 (InlineStackEntry):
5326 (JSC::DFG::ByteCodeParser::handleCall):
5327 (JSC::DFG::ByteCodeParser::handleInlining):
5328 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
5329 (JSC::DFG::ByteCodeParser::parse):
5330 * dfg/DFGCCallHelpers.h:
5331 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
5332 (CCallHelpers):
5333 * dfg/DFGCapabilities.h:
5334 (JSC::DFG::canInlineOpcode):
5335 * dfg/DFGDriver.cpp:
5336 (JSC::DFG::compile):
5337 * dfg/DFGFixupPhase.cpp:
5338 (JSC::DFG::FixupPhase::fixupNode):
5339 * dfg/DFGOperations.cpp:
5340 * dfg/DFGOperations.h:
5341 * dfg/DFGSpeculativeJIT.h:
5342 (JSC::DFG::SpeculativeJIT::callOperation):
5343 * dfg/DFGSpeculativeJIT32_64.cpp:
5344 (JSC::DFG::SpeculativeJIT::compile):
5345 * dfg/DFGSpeculativeJIT64.cpp:
5346 (JSC::DFG::SpeculativeJIT::compile):
5347 * interpreter/CallFrame.cpp:
5348 (JSC):
5349 (JSC::CallFrame::someCodeBlockForPossiblyInlinedCode):
5350 * interpreter/CallFrame.h:
5351 (ExecState):
5352 (JSC::ExecState::someCodeBlockForPossiblyInlinedCode):
5353 * interpreter/Interpreter.cpp:
5354 (JSC::Interpreter::retrieveArgumentsFromVMCode):
5355 * runtime/Arguments.cpp:
5356 (JSC::Arguments::tearOff):
5357 (JSC):
5358 (JSC::Arguments::tearOffForInlineCallFrame):
5359 * runtime/Arguments.h:
5360 (Arguments):
5361 (JSC::Arguments::create):
5362 (JSC::Arguments::finishCreation):
5363 (JSC):
5364
fpizlo@apple.comfe244b02012-05-23 20:51:21 +000053652012-05-23 Filip Pizlo <fpizlo@apple.com>
5366
5367 Every OSR exit on ARM results in a crash
5368 https://bugs.webkit.org/show_bug.cgi?id=87307
5369
5370 Reviewed by Geoffrey Garen.
5371
5372 * dfg/DFGThunks.cpp:
5373 (JSC::DFG::osrExitGenerationThunkGenerator):
5374
ggaren@apple.com96fa0e72012-05-23 20:47:46 +000053752012-05-23 Geoffrey Garen <ggaren@apple.com>
5376
5377 Refactored heap tear-down to use normal value semantics (i.e., destructors)
5378 https://bugs.webkit.org/show_bug.cgi?id=87302
5379
5380 Reviewed by Oliver Hunt.
5381
5382 This is a step toward incremental DOM finalization.
5383
5384 * heap/CopiedSpace.cpp:
5385 (JSC::CopiedSpace::~CopiedSpace):
5386 * heap/CopiedSpace.h:
5387 (CopiedSpace): Just use our destructor, instead of relying on the heap
5388 to send us a special message at a special time.
5389
5390 * heap/Heap.cpp:
5391 (JSC::Heap::Heap): Use OwnPtr for m_markListSet because this is not Sparta.
5392
5393 (JSC::Heap::~Heap): No need for delete or freeAllBlocks because normal
5394 destructors do this work automatically now.
5395
5396 (JSC::Heap::lastChanceToFinalize): Just call lastChanceToFinalize on our
5397 sub-objects, and assume it does the right thing. This improves encapsulation,
5398 so we can add items requiring finalization to our sub-objects.
5399
5400 * heap/Heap.h: Moved m_blockAllocator to get the right destruction order.
5401
5402 * heap/MarkedSpace.cpp:
5403 (Take):
5404 (JSC):
5405 (JSC::Take::Take):
5406 (JSC::Take::operator()):
5407 (JSC::Take::returnValue): Moved to the top of the file so it can be used
5408 in another function.
5409
5410 (JSC::MarkedSpace::~MarkedSpace): Delete all outstanding memory, like a good
5411 destructor should.
5412
5413 (JSC::MarkedSpace::lastChanceToFinalize): Moved some code here from the heap,
5414 since it pertains to our internal implementation details.
5415
5416 * heap/MarkedSpace.h:
5417 (MarkedSpace):
5418 * heap/WeakBlock.cpp:
5419 (JSC::WeakBlock::lastChanceToFinalize):
5420 * heap/WeakBlock.h:
5421 (WeakBlock):
5422 * heap/WeakSet.cpp:
5423 (JSC::WeakSet::lastChanceToFinalize):
5424 * heap/WeakSet.h:
5425 (WeakSet): Stop using a special freeAllBlocks() callback and just implement
5426 lastChanceToFinalize.
5427
ggaren@apple.comd6376d22012-05-23 18:29:55 +000054282011-05-22 Geoffrey Garen <ggaren@apple.com>
5429
5430 Encapsulated some calculations for whether portions of the heap are empty
5431 https://bugs.webkit.org/show_bug.cgi?id=87210
5432
5433 Reviewed by Gavin Barraclough.
5434
5435 This is a step toward incremental DOM finalization.
5436
5437 * heap/Heap.cpp:
5438 (JSC::Heap::~Heap): Explicitly call freeAllBlocks() instead of relying
5439 implicitly on all blocks thinking they're empty. In future, we may
5440 choose to tear down the heap without first setting all data structures
5441 to "empty".
5442
5443 * heap/MarkedBlock.h:
5444 (JSC::MarkedBlock::isEmpty):
5445 (JSC::MarkedBlock::gatherDirtyCells): Renamed markCountIsZero to isEmpty,
5446 in preparation for making it check for outstanding finalizers in addition
5447 to marked cells.
5448
5449 * heap/MarkedSpace.cpp:
5450 (Take):
5451 (JSC::Take::Take):
5452 (JSC::Take::operator()):
5453 (JSC::Take::returnValue):
5454 (JSC::MarkedSpace::shrink):
5455 (JSC::MarkedSpace::freeAllBlocks): Refactored the "Take" functor to support
5456 a conditional isEmpty check, so it dould be shared by shrink() and freeAllBlocks().
5457
5458 * heap/WeakBlock.cpp:
5459 (JSC::WeakBlock::WeakBlock):
5460 (JSC::WeakBlock::visitLiveWeakImpls):
5461 (JSC::WeakBlock::visitDeadWeakImpls):
5462 * heap/WeakBlock.h:
5463 (WeakBlock):
5464 (JSC::WeakBlock::isEmpty):
5465 * heap/WeakSet.cpp:
5466 (JSC::WeakSet::sweep):
5467 (JSC::WeakSet::shrink): Use isEmpty(), in preparation for changes in
5468 its implementation.
5469
vestbo@webkit.orgb1f6e922012-05-23 10:50:53 +000054702012-05-23 Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
5471
5472 [Qt] Remove references to $$QT_SOURCE_TREE
5473
5474 With a modularized Qt, it's ambigious. What we really want is qtbase,
5475 which qtcore is a proxy for (we assume it will always live in qtbase).
5476
5477 Reviewed by Tor Arne Vestbø.
5478
5479 * JavaScriptCore.pri:
5480 * Target.pri:
5481
fpizlo@apple.comb6b454cd2012-05-23 07:53:44 +000054822012-05-09 Filip Pizlo <fpizlo@apple.com>
5483
5484 DFG should allow inlining in case of certain arity mismatches
5485 https://bugs.webkit.org/show_bug.cgi?id=86059
5486
5487 Reviewed by Geoff Garen.
fpizlo@apple.comb92907c2012-05-23 07:55:12 +00005488
5489 Merge r116620 from dfgopt.
fpizlo@apple.comb6b454cd2012-05-23 07:53:44 +00005490
5491 * dfg/DFGByteCodeParser.cpp:
5492 (JSC::DFG::ByteCodeParser::handleInlining):
5493
fpizlo@apple.com6d4456e2012-05-23 03:48:52 +000054942012-05-08 Filip Pizlo <fpizlo@apple.com>
5495
fpizlo@apple.com1688cc12012-05-23 07:29:02 +00005496 DFG variable capture analysis should work even if the variables arose through inlining
5497 https://bugs.webkit.org/show_bug.cgi?id=85945
5498
5499 Reviewed by Oliver Hunt.
5500
5501 Merged r116555 from dfgopt.
5502
5503 This just changes how the DFG queries whether a variable is captured. It does not
5504 change any user-visible behavior.
5505
5506 As part of this change, I further solidified the policy that the CFA behaves in an
5507 undefined way for captured locals and queries about their values will not yield
5508 reliable results. This will likely be changed in the future, but for now it makes
5509 sense.
5510
5511 One fun part about this change is that it recognizes that the same variable may
5512 be both captured and not, at the same time, because their live interval spans
5513 inlining boundaries. This only happens in the case of arguments to functions that
5514 capture their arguments, and this change treats them with just the right touch of
5515 conservatism: they will be treated as if captured by the caller as well as the
5516 callee.
5517
5518 Finally, this also adds captured variable reasoning to the InlineCallFrame, which
5519 I thought might be useful for later tooling.
5520
5521 This is perf-neutral, since it does it does not make the DFG take advantage of this
5522 new functionality in any way. In particular, it is still the case that the DFG will
5523 not inline functions that use arguments reflectively or that create activations.
5524
5525 * bytecode/CodeBlock.h:
5526 (CodeBlock):
5527 (JSC::CodeBlock::needsActivation):
5528 (JSC::CodeBlock::argumentIsCaptured):
5529 (JSC::CodeBlock::localIsCaptured):
5530 (JSC::CodeBlock::isCaptured):
5531 * bytecode/CodeOrigin.h:
5532 (InlineCallFrame):
5533 * dfg/DFGAbstractState.cpp:
5534 (JSC::DFG::AbstractState::initialize):
5535 (JSC::DFG::AbstractState::endBasicBlock):
5536 (JSC::DFG::AbstractState::execute):
5537 (JSC::DFG::AbstractState::merge):
5538 * dfg/DFGByteCodeParser.cpp:
5539 (JSC::DFG::ByteCodeParser::newVariableAccessData):
5540 (JSC::DFG::ByteCodeParser::getLocal):
5541 (JSC::DFG::ByteCodeParser::setLocal):
5542 (JSC::DFG::ByteCodeParser::getArgument):
5543 (JSC::DFG::ByteCodeParser::setArgument):
5544 (JSC::DFG::ByteCodeParser::flushArgument):
5545 (JSC::DFG::ByteCodeParser::parseBlock):
5546 (JSC::DFG::ByteCodeParser::processPhiStack):
5547 (JSC::DFG::ByteCodeParser::fixVariableAccessPredictions):
5548 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
5549 * dfg/DFGCFGSimplificationPhase.cpp:
5550 (CFGSimplificationPhase):
5551 (JSC::DFG::CFGSimplificationPhase::keepOperandAlive):
5552 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
5553 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
5554 * dfg/DFGCommon.h:
5555 * dfg/DFGFixupPhase.cpp:
5556 (JSC::DFG::FixupPhase::fixupNode):
5557 * dfg/DFGGraph.cpp:
5558 (JSC::DFG::Graph::nameOfVariableAccessData):
5559 * dfg/DFGGraph.h:
5560 (JSC::DFG::Graph::needsActivation):
5561 (JSC::DFG::Graph::usesArguments):
5562 * dfg/DFGPredictionPropagationPhase.cpp:
5563 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):
5564 * dfg/DFGSpeculativeJIT.cpp:
5565 (JSC::DFG::SpeculativeJIT::compile):
5566 * dfg/DFGSpeculativeJIT32_64.cpp:
5567 (JSC::DFG::SpeculativeJIT::compile):
5568 * dfg/DFGSpeculativeJIT64.cpp:
5569 (JSC::DFG::SpeculativeJIT::compile):
5570 * dfg/DFGVariableAccessData.h:
5571 (JSC::DFG::VariableAccessData::VariableAccessData):
5572 (JSC::DFG::VariableAccessData::mergeIsCaptured):
5573 (VariableAccessData):
5574 (JSC::DFG::VariableAccessData::isCaptured):
5575
55762012-05-08 Filip Pizlo <fpizlo@apple.com>
5577
fpizlo@apple.com6d4456e2012-05-23 03:48:52 +00005578 DFG should support op_get_argument_by_val and op_get_arguments_length
5579 https://bugs.webkit.org/show_bug.cgi?id=85911
5580
5581 Reviewed by Oliver Hunt.
5582
5583 Merged r116467 from dfgopt.
5584
5585 This adds a simple and relatively conservative implementation of op_get_argument_by_val
5586 and op_get_arguments_length. We can optimize these later. For now it's great to have
5587 the additional coverage.
5588
5589 This patch appears to be perf-neutral.
5590
5591 * dfg/DFGAbstractState.cpp:
5592 (JSC::DFG::AbstractState::execute):
5593 * dfg/DFGAssemblyHelpers.h:
5594 (JSC::DFG::AssemblyHelpers::addressFor):
5595 (JSC::DFG::AssemblyHelpers::tagFor):
5596 (JSC::DFG::AssemblyHelpers::payloadFor):
5597 * dfg/DFGByteCodeParser.cpp:
5598 (JSC::DFG::ByteCodeParser::parseBlock):
5599 * dfg/DFGCapabilities.h:
5600 (JSC::DFG::canCompileOpcode):
5601 (JSC::DFG::canInlineOpcode):
5602 * dfg/DFGNode.h:
5603 (JSC::DFG::Node::hasHeapPrediction):
5604 * dfg/DFGNodeType.h:
5605 (DFG):
5606 * dfg/DFGOperations.cpp:
5607 * dfg/DFGOperations.h:
5608 * dfg/DFGPredictionPropagationPhase.cpp:
5609 (JSC::DFG::PredictionPropagationPhase::propagate):
5610 * dfg/DFGSpeculativeJIT.h:
5611 (JSC::DFG::SpeculativeJIT::callOperation):
5612 (SpeculativeJIT):
5613 * dfg/DFGSpeculativeJIT32_64.cpp:
5614 (JSC::DFG::SpeculativeJIT::compile):
5615 * dfg/DFGSpeculativeJIT64.cpp:
5616 (JSC::DFG::SpeculativeJIT::compile):
5617 * jit/JITOpcodes.cpp:
5618 (JSC::JIT::emit_op_get_argument_by_val):
5619 * jit/JITOpcodes32_64.cpp:
5620 (JSC::JIT::emit_op_get_argument_by_val):
5621 * llint/LowLevelInterpreter32_64.asm:
5622 * llint/LowLevelInterpreter64.asm:
5623
fpizlo@apple.com15c03c72012-05-23 02:34:13 +000056242012-05-07 Filip Pizlo <fpizlo@apple.com>
5625
5626 DFG should support op_tear_off_arguments
5627 https://bugs.webkit.org/show_bug.cgi?id=85847
5628
5629 Reviewed by Michael Saboff.
5630
5631 Merged r116378 from dfgopt.
5632
5633 * dfg/DFGAbstractState.cpp:
5634 (JSC::DFG::AbstractState::execute):
5635 * dfg/DFGByteCodeParser.cpp:
5636 (JSC::DFG::ByteCodeParser::parseBlock):
5637 * dfg/DFGCapabilities.h:
5638 (JSC::DFG::canCompileOpcode):
5639 (JSC::DFG::canInlineOpcode):
5640 * dfg/DFGNodeType.h:
5641 (DFG):
5642 * dfg/DFGOperations.cpp:
5643 * dfg/DFGOperations.h:
5644 * dfg/DFGPredictionPropagationPhase.cpp:
5645 (JSC::DFG::PredictionPropagationPhase::propagate):
5646 * dfg/DFGSpeculativeJIT.h:
5647 (SpeculativeJIT):
5648 (JSC::DFG::SpeculativeJIT::callOperation):
5649 * dfg/DFGSpeculativeJIT32_64.cpp:
5650 (JSC::DFG::SpeculativeJIT::compile):
5651 * dfg/DFGSpeculativeJIT64.cpp:
5652 (JSC::DFG::SpeculativeJIT::compile):
5653
mhahnenberg@apple.com3041bc12012-05-23 01:28:03 +000056542012-05-22 Mark Hahnenberg <mhahnenberg@apple.com>
5655
5656 CopiedSpace::contains doesn't check for oversize blocks
5657 https://bugs.webkit.org/show_bug.cgi?id=87180
5658
5659 Reviewed by Geoffrey Garen.
5660
5661 When doing a conservative scan we use CopiedSpace::contains to determine if a particular
5662 address points into the CopiedSpace. Currently contains() only checks if the address
5663 points to a block in to-space, which means that pointers to oversize blocks may not get scanned.
5664
5665 * heap/CopiedSpace.cpp:
5666 (JSC::CopiedSpace::tryAllocateOversize):
5667 (JSC::CopiedSpace::tryReallocateOversize):
5668 (JSC::CopiedSpace::doneFillingBlock):
5669 (JSC::CopiedSpace::doneCopying):
5670 * heap/CopiedSpace.h: Refactored CopiedSpace so that all blocks (oversize and to-space) are
5671 in a single hash set and bloom filter for membership testing.
5672 (CopiedSpace):
5673 * heap/CopiedSpaceInlineMethods.h:
5674 (JSC::CopiedSpace::contains): We check for the normal block first. Since the oversize blocks are
5675 only page aligned, rather than block aligned, we have to re-mask the ptr to check if it's in
5676 CopiedSpace. Also added a helper function of the same name that takes a CopiedBlock* and checks
5677 if it's in CopiedSpace so that check isn't typed out twice.
5678 (JSC):
5679 (JSC::CopiedSpace::startedCopying):
5680 (JSC::CopiedSpace::addNewBlock):
5681
ggaren@apple.coma68a6502012-05-22 23:59:51 +000056822012-05-22 Geoffrey Garen <ggaren@apple.com>
5683
5684 CopiedBlock and MarkedBlock should have proper value semantics (i.e., destructors)
5685 https://bugs.webkit.org/show_bug.cgi?id=87172
5686
5687 Reviewed by Oliver Hunt and Phil Pizlo.
5688
5689 This enables MarkedBlock to own non-trivial sub-objects that require
5690 destruction. It also fixes a FIXME about casting a CopiedBlock to a
5691 MarkedBlock at destroy time.
5692
5693 CopiedBlock and MarkedBlock now accept an allocation chunk at create
5694 time and return it at destroy time. Their client is expected to
5695 allocate, recycle, and destroy these chunks.
5696
5697 * heap/BlockAllocator.cpp:
5698 (JSC::BlockAllocator::releaseFreeBlocks):
5699 (JSC::BlockAllocator::blockFreeingThreadMain): Don't call MarkedBlock::destroy
5700 because we expect that to be called before a block is put on our free
5701 list now. Do manually deallocate our allocation chunk because that's
5702 our job now.
5703
5704 * heap/BlockAllocator.h:
5705 (BlockAllocator):
5706 (JSC::BlockAllocator::allocate): Allocate never fails now. This is a
5707 cleaner abstraction because only one object does all the VM allocation
5708 and deallocation. Caching is an implementation detail.
5709
5710 (JSC::BlockAllocator::deallocate): We take an allocation chunk argument
5711 instead of a block because we now expect the block to have been destroyed
5712 before we recycle its memory. For convenience, we still use the HeapBlock
5713 class as our linked list node. This is OK because HeapBlock is a POD type.
5714
5715 * heap/CopiedBlock.h:
5716 (CopiedBlock):
5717 (JSC::CopiedBlock::create):
5718 (JSC::CopiedBlock::destroy):
5719 (JSC::CopiedBlock::CopiedBlock): Added proper create and destroy functions,
5720 to match MarkedBlock.
5721
5722 * heap/CopiedSpace.cpp:
5723 (JSC::CopiedSpace::tryAllocateOversize):
5724 (JSC::CopiedSpace::tryReallocateOversize):
5725 (JSC::CopiedSpace::doneCopying):
5726 (JSC::CopiedSpace::getFreshBlock):
5727 (JSC::CopiedSpace::freeAllBlocks):
5728 * heap/CopiedSpaceInlineMethods.h:
5729 (JSC::CopiedSpace::recycleBlock): Make sure to call destroy before
5730 returning a block to the BlockAllocator. Otherwise, our destructors
5731 won't run. (If we get this wrong now, we'll get a compile error.)
5732
5733 * heap/HeapBlock.h:
5734 (JSC::HeapBlock::HeapBlock): const!
5735
5736 * heap/MarkedAllocator.cpp:
5737 (JSC::MarkedAllocator::allocateBlock): No need to distinguish between
5738 create and recycle -- MarkedBlock always accepts memory allocated by
5739 its client now.
5740
5741 * heap/MarkedBlock.cpp:
5742 (JSC::MarkedBlock::create): Don't allocate memory -- we assume that we're
5743 passed already-allocated memory, to clarify the responsibility for VM
5744 recycling.
5745
5746 (JSC::MarkedBlock::destroy): Do run our destructor before giving back
5747 our VM -- that is the whole point of this patch.
5748
5749 (JSC::MarkedBlock::MarkedBlock):
5750 * heap/MarkedBlock.h:
5751 (MarkedBlock):
5752 * heap/MarkedSpace.cpp: const!
5753
5754 (JSC::MarkedSpace::freeBlocks): Make sure to call destroy before
5755 returning a block to the BlockAllocator. Otherwise, our destructors
5756 won't run. (If we get this wrong now, we'll get a compile error.)
5757
simon.fraser@apple.com9bd2c702012-05-22 20:37:14 +00005758== Rolled over to ChangeLog-2012-05-22 ==