blob: 1a44dfa1bad4afdde54ba9949d1ffe49b56a78f2 [file] [log] [blame]
commit-queue@webkit.orgb6833002012-06-19 21:06:08 +000012012-06-19 Mark Lam <mark.lam@apple.com>
2
3 CodeBlock::needsCallReturnIndices() is no longer needed.
4 https://bugs.webkit.org/show_bug.cgi?id=89490
5
6 Reviewed by Geoffrey Garen.
7
8 * bytecode/CodeBlock.h:
9 (JSC::CodeBlock::needsCallReturnIndices): removed.
10 * dfg/DFGJITCompiler.cpp:
11 (JSC::DFG::JITCompiler::link):
12 * jit/JIT.cpp:
13 (JSC::JIT::privateCompile):
14
fpizlo@apple.com861ea7b2012-06-19 20:05:06 +0000152012-06-19 Filip Pizlo <fpizlo@apple.com>
16
17 Unreviewed, try to fix Windows build.
18
19 * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd:
20
fpizlo@apple.com01c2a192012-06-19 19:42:55 +0000212012-06-17 Filip Pizlo <fpizlo@apple.com>
22
23 It should be possible to look at disassembly
24 https://bugs.webkit.org/show_bug.cgi?id=89319
25
26 Reviewed by Sam Weinig.
27
28 This imports the udis86 disassembler library. The library is placed
29 behind an abstraction in disassembler/Disassembler.h, so that we can
30 in the future use other disassemblers (for other platforms) whenever
31 appropriate. As a first step, the disassembler is being invoked for
32 DFG verbose dumps.
33
34 If we ever want to merge a new version of udis86 in the future, I've
35 made notes about changes I made to the library in
36 disassembler/udis86/differences.txt.
37
38 * CMakeLists.txt:
39 * DerivedSources.make:
40 * GNUmakefile.list.am:
41 * JavaScriptCore.pri:
42 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
43 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
44 * JavaScriptCore.xcodeproj/project.pbxproj:
45 * dfg/DFGJITCompiler.cpp:
46 (JSC::DFG::JITCompiler::compile):
47 (JSC::DFG::JITCompiler::compileFunction):
48 * disassembler: Added.
49 * disassembler/Disassembler.h: Added.
50 (JSC):
51 (JSC::tryToDisassemble):
52 * disassembler/UDis86Disassembler.cpp: Added.
53 (JSC):
54 (JSC::tryToDisassemble):
55 * disassembler/udis86: Added.
56 * disassembler/udis86/differences.txt: Added.
57 * disassembler/udis86/itab.py: Added.
58 (UdItabGenerator):
59 (UdItabGenerator.__init__):
60 (UdItabGenerator.toGroupId):
61 (UdItabGenerator.genLookupTable):
62 (UdItabGenerator.genLookupTableList):
63 (UdItabGenerator.genInsnTable):
64 (genItabH):
65 (genItabH.UD_ITAB_H):
66 (genItabC):
67 (genItab):
68 (main):
69 * disassembler/udis86/optable.xml: Added.
70 * disassembler/udis86/ud_opcode.py: Added.
71 (UdOpcodeTables):
72 (UdOpcodeTables.sizeOfTable):
73 (UdOpcodeTables.nameOfTable):
74 (UdOpcodeTables.updateTable):
75 (UdOpcodeTables.Insn):
76 (UdOpcodeTables.Insn.__init__):
77 (UdOpcodeTables.Insn.__init__.opcode):
78 (UdOpcodeTables.parse):
79 (UdOpcodeTables.addInsnDef):
80 (UdOpcodeTables.print_table):
81 (UdOpcodeTables.print_tree):
82 * disassembler/udis86/ud_optable.py: Added.
83 (UdOptableXmlParser):
84 (UdOptableXmlParser.parseDef):
85 (UdOptableXmlParser.parse):
86 (printFn):
87 (parse):
88 (main):
89 * disassembler/udis86/udis86.c: Added.
90 (ud_init):
91 (ud_disassemble):
92 (ud_set_mode):
93 (ud_set_vendor):
94 (ud_set_pc):
95 (ud):
96 (ud_insn_asm):
97 (ud_insn_off):
98 (ud_insn_hex):
99 (ud_insn_ptr):
100 (ud_insn_len):
101 * disassembler/udis86/udis86.h: Added.
102 * disassembler/udis86/udis86_decode.c: Added.
103 (eff_adr_mode):
104 (ud_lookup_mnemonic):
105 (decode_prefixes):
106 (modrm):
107 (resolve_operand_size):
108 (resolve_mnemonic):
109 (decode_a):
110 (decode_gpr):
111 (resolve_gpr64):
112 (resolve_gpr32):
113 (resolve_reg):
114 (decode_imm):
115 (decode_modrm_reg):
116 (decode_modrm_rm):
117 (decode_o):
118 (decode_operand):
119 (decode_operands):
120 (clear_insn):
121 (resolve_mode):
122 (gen_hex):
123 (decode_insn):
124 (decode_3dnow):
125 (decode_ssepfx):
126 (decode_ext):
127 (decode_opcode):
128 (ud_decode):
129 * disassembler/udis86/udis86_decode.h: Added.
130 (ud_itab_entry_operand):
131 (ud_itab_entry):
132 (ud_lookup_table_list_entry):
133 (sse_pfx_idx):
134 (mode_idx):
135 (modrm_mod_idx):
136 (vendor_idx):
137 (is_group_ptr):
138 (group_idx):
139 * disassembler/udis86/udis86_extern.h: Added.
140 * disassembler/udis86/udis86_input.c: Added.
141 (inp_buff_hook):
142 (inp_file_hook):
143 (ud):
144 (ud_set_user_opaque_data):
145 (ud_get_user_opaque_data):
146 (ud_set_input_buffer):
147 (ud_set_input_file):
148 (ud_input_skip):
149 (ud_input_end):
150 (ud_inp_next):
151 (ud_inp_back):
152 (ud_inp_peek):
153 (ud_inp_move):
154 (ud_inp_uint8):
155 (ud_inp_uint16):
156 (ud_inp_uint32):
157 (ud_inp_uint64):
158 * disassembler/udis86/udis86_input.h: Added.
159 * disassembler/udis86/udis86_itab_holder.c: Added.
160 * disassembler/udis86/udis86_syn-att.c: Added.
161 (opr_cast):
162 (gen_operand):
163 (ud_translate_att):
164 * disassembler/udis86/udis86_syn-intel.c: Added.
165 (opr_cast):
166 (gen_operand):
167 (ud_translate_intel):
168 * disassembler/udis86/udis86_syn.c: Added.
169 * disassembler/udis86/udis86_syn.h: Added.
170 (mkasm):
171 * disassembler/udis86/udis86_types.h: Added.
172 (ud_operand):
173 (ud):
174 * jit/JITCode.h:
175 (JITCode):
176 (JSC::JITCode::tryToDisassemble):
177
mhahnenberg@apple.coma7ec41b2012-06-19 19:17:31 +00001782012-06-19 Mark Hahnenberg <mhahnenberg@apple.com>
179
180 GCActivityCallback and IncrementalSweeper should share code
181 https://bugs.webkit.org/show_bug.cgi?id=89400
182
183 Reviewed by Geoffrey Garen.
184
185 A lot of functionality is duplicated between GCActivityCallback and IncrementalSweeper.
186 We should extract the common functionality out into a separate class that both of them
187 can inherit from. This refactoring will be an even greater boon when we add the ability
188 to shut these two agents down in a thread-safe fashion
189
190 * CMakeLists.txt:
191 * GNUmakefile.list.am:
192 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
193 * JavaScriptCore.xcodeproj/project.pbxproj:
194 * Target.pri:
195 * heap/Heap.cpp:
196 (JSC::Heap::Heap): Move initialization down so that the JSGlobalData has a valid Heap when
197 we're initializing the GCActivityCallback and the IncrementalSweeper.
198 * heap/Heap.h:
199 (Heap):
200 * heap/HeapTimer.cpp: Added.
201 (JSC):
202 (JSC::HeapTimer::HeapTimer): Initialize the various base class data that
203 DefaultGCActivityCallback::commonConstructor() used to do.
204 (JSC::HeapTimer::~HeapTimer): Call to invalidate().
205 (JSC::HeapTimer::synchronize): Same functionality as the old DefaultGCActivityCallback::synchronize().
206 Virtual so that non-CF subclasses can override.
207 (JSC::HeapTimer::invalidate): Tears down the runloop timer to prevent any future firing.
208 (JSC::HeapTimer::timerDidFire): Callback to pass to the timer function. Casts and calls the virtual doWork().
209 * heap/HeapTimer.h: Added. This is the class that serves as the common base class for
210 both GCActivityCallback and IncrementalSweeper. It handles setting up and tearing down run loops and synchronizing
211 across threads for its subclasses.
212 (JSC):
213 (HeapTimer):
214 * heap/IncrementalSweeper.cpp: Changes to accomodate the extraction of common functionality
215 between IncrementalSweeper and GCActivityCallback into a common ancestor.
216 (JSC):
217 (JSC::IncrementalSweeper::doWork):
218 (JSC::IncrementalSweeper::IncrementalSweeper):
219 (JSC::IncrementalSweeper::cancelTimer):
220 (JSC::IncrementalSweeper::create):
221 * heap/IncrementalSweeper.h:
222 (IncrementalSweeper):
223 * runtime/GCActivityCallback.cpp:
224 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
225 (JSC::DefaultGCActivityCallback::doWork):
226 * runtime/GCActivityCallback.h:
227 (GCActivityCallback):
228 (JSC::GCActivityCallback::willCollect):
229 (JSC::GCActivityCallback::GCActivityCallback):
230 (JSC):
231 (DefaultGCActivityCallback): Remove the platform data struct. The platform data should be kept in
232 the class itself so as to be accessible by doWork(). Most of the platform data for CF is kept in
233 HeapTimer anyways, so we only need the m_delay field now.
234 * runtime/GCActivityCallbackBlackBerry.cpp:
235 (JSC):
236 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
237 (JSC::DefaultGCActivityCallback::doWork):
238 (JSC::DefaultGCActivityCallback::didAllocate):
239 * runtime/GCActivityCallbackCF.cpp:
240 (JSC):
241 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
242 (JSC::DefaultGCActivityCallback::doWork):
243 (JSC::DefaultGCActivityCallback::scheduleTimer):
244 (JSC::DefaultGCActivityCallback::cancelTimer):
245 (JSC::DefaultGCActivityCallback::didAllocate):
246 (JSC::DefaultGCActivityCallback::willCollect):
247 (JSC::DefaultGCActivityCallback::cancel):
248
249
commit-queue@webkit.orgf5584612012-06-19 09:13:52 +00002502012-06-19 Mike West <mkwst@chromium.org>
251
252 Introduce ENABLE_CSP_NEXT configuration flag.
253 https://bugs.webkit.org/show_bug.cgi?id=89300
254
255 Reviewed by Adam Barth.
256
257 The 1.0 draft of the Content Security Policy spec is just about to
258 move to Last Call. We'll hide work on the upcoming 1.1 spec behind
259 this ENABLE flag, disabled by default.
260
261 Spec: https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html
262
263 * Configurations/FeatureDefines.xcconfig:
264
commit-queue@webkit.org3e0a1a02012-06-19 06:07:28 +00002652012-06-18 Mark Lam <mark.lam@apple.com>
266
267 Changed JSC to always record line number information so that error.stack
268 and window.onerror() can report proper line numbers.
269 https://bugs.webkit.org/show_bug.cgi?id=89410
270
271 Reviewed by Geoffrey Garen.
272
273 * bytecode/CodeBlock.cpp:
274 (JSC::CodeBlock::CodeBlock):
275 (JSC::CodeBlock::lineNumberForBytecodeOffset):
276 (JSC::CodeBlock::shrinkToFit): m_lineInfo is now available unconditionally.
277
278 * bytecode/CodeBlock.h:
279 (JSC::CodeBlock::addLineInfo):
280 (JSC::CodeBlock::hasLineInfo): Unused. Now removed.
281 (JSC::CodeBlock::needsCallReturnIndices):
282 (CodeBlock):
283 (RareData): Hoisted m_lineInfo out of m_rareData. m_lineInfo is now
284 filled in unconditionally.
285
286 * bytecompiler/BytecodeGenerator.h:
287 (JSC::BytecodeGenerator::addLineInfo):
288
aestes@apple.comf6d51392012-06-19 03:32:30 +00002892012-06-18 Andy Estes <aestes@apple.com>
290
aestes@apple.com6cc46942012-06-19 03:34:03 +0000291 Fix r120663, which didn't land the change that was reviewed.
292
2932012-06-18 Andy Estes <aestes@apple.com>
294
aestes@apple.comf6d51392012-06-19 03:32:30 +0000295 [JSC] In JSGlobalData.cpp, enableAssembler() sometimes leaks two CF objects
296 https://bugs.webkit.org/show_bug.cgi?id=89415
297
298 Reviewed by Sam Weinig.
299
300 In the case where canUseJIT was a non-NULL CFBooleanRef,
301 enableAssembler() would leak both canUseJITKey and canUseJIT by
302 returning before calling CFRelease. Fix this by using RetainPtr.
303
304 * runtime/JSGlobalData.cpp:
305 (JSC::enableAssembler):
306
ggaren@apple.com2318dbc2012-06-18 04:35:21 +00003072012-06-17 Geoffrey Garen <ggaren@apple.com>
308
309 GC copy phase spends needless cycles zero-filling blocks
310 https://bugs.webkit.org/show_bug.cgi?id=89128
311
312 Reviewed by Gavin Barraclough.
313
314 We only need to zero-fill when we're allocating memory that might not
315 get fully initialized before GC.
316
317 * heap/CopiedBlock.h:
318 (JSC::CopiedBlock::createNoZeroFill):
319 (JSC::CopiedBlock::create): Added a way to create without zero-filling.
320 This is our optimization.
321
322 (JSC::CopiedBlock::zeroFillToEnd):
323 (JSC::CopiedBlock::CopiedBlock): Split zero-filling out from creation,
324 so we can sometimes create without zero-filling.
325
326 * heap/CopiedSpace.cpp:
327 (JSC::CopiedSpace::init):
328 (JSC::CopiedSpace::tryAllocateSlowCase):
329 (JSC::CopiedSpace::doneCopying): Renamed addNewBlock to allocateBlock()
330 to clarify that the new block is always newly-allocated.
331
332 (JSC::CopiedSpace::doneFillingBlock): Make sure to zero-fill to the end
333 of a block that might be used in the future for allocation. (Most of the
334 time, this is a no-op, since we've already filled the block completely.)
335
336 (JSC::CopiedSpace::getFreshBlock): Removed this function because the
337 abstraction of "allocation must succeed" is no longer useful.
338
339 * heap/CopiedSpace.h: Updated declarations to match.
340
341 * heap/CopiedSpaceInlineMethods.h:
342 (JSC::CopiedSpace::allocateBlockForCopyingPhase): New function, which
343 knows that it can skip zero-filling.
344
345 Added tighter scoping to our lock, to improve parallelism.
346
347 (JSC::CopiedSpace::allocateBlock): Folded getFreshBlock functionality
348 into this function, for simplicity.
349
350 * heap/MarkStack.cpp:
351 (JSC::SlotVisitor::startCopying):
352 (JSC::SlotVisitor::allocateNewSpace): Use our new zero-fill-free helper
353 function for great good.
354
fpizlo@apple.com73df57b2012-06-18 01:59:18 +00003552012-06-17 Filip Pizlo <fpizlo@apple.com>
356
357 DFG should attempt to use structure watchpoints for all inlined get_by_id's and put_by_id's
358 https://bugs.webkit.org/show_bug.cgi?id=89316
359
360 Reviewed by Oliver Hunt.
361
362 * dfg/DFGByteCodeParser.cpp:
363 (JSC::DFG::ByteCodeParser::addStructureTransitionCheck):
364 (ByteCodeParser):
365 (JSC::DFG::ByteCodeParser::handleGetById):
366 (JSC::DFG::ByteCodeParser::parseBlock):
367
commit-queue@webkit.orgf8968a72012-06-15 22:24:21 +00003682012-06-15 Yong Li <yoli@rim.com>
369
370 [BlackBerry] Put platform-specific GC policy in GCActivityCallback
371 https://bugs.webkit.org/show_bug.cgi?id=89236
372
373 Reviewed by Rob Buis.
374
375 Add GCActivityCallbackBlackBerry.cpp and implement platform-specific
376 low memory GC policy there.
377
378 * PlatformBlackBerry.cmake:
379 * heap/Heap.h:
380 (JSC::Heap::isSafeToCollect): Added.
381 * runtime/GCActivityCallbackBlackBerry.cpp: Added.
382 (JSC):
383 (JSC::DefaultGCActivityCallbackPlatformData::DefaultGCActivityCallbackPlatformData):
384 (DefaultGCActivityCallbackPlatformData):
385 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
386 (JSC::DefaultGCActivityCallback::~DefaultGCActivityCallback):
387 (JSC::DefaultGCActivityCallback::didAllocate):
388 (JSC::DefaultGCActivityCallback::willCollect):
389 (JSC::DefaultGCActivityCallback::synchronize):
390 (JSC::DefaultGCActivityCallback::cancel):
391
fpizlo@apple.com666a2d52012-06-15 22:21:44 +00003922012-06-15 Filip Pizlo <fpizlo@apple.com>
393
394 DFG should be able to set watchpoints on structure transitions in the
395 method check prototype chain
396 https://bugs.webkit.org/show_bug.cgi?id=89058
397
398 Adding the same assertion to 32-bit that I added to 64-bit. This change
399 does not affect correctness but it's a good thing for assertion coverage.
400
401 * dfg/DFGSpeculativeJIT32_64.cpp:
402 (JSC::DFG::SpeculativeJIT::compile):
403
fpizlo@apple.comb75911b2012-06-13 20:53:52 +00004042012-06-13 Filip Pizlo <fpizlo@apple.com>
405
fpizlo@apple.com04e41152012-06-15 22:14:53 +0000406 DFG should be able to set watchpoints on structure transitions in the
407 method check prototype chain
408 https://bugs.webkit.org/show_bug.cgi?id=89058
409
410 Reviewed by Gavin Barraclough.
411
412 This adds the ability to set watchpoints on Structures, and then does
413 the most modest thing we can do with this ability: the DFG now sets
414 watchpoints on structure transitions in the prototype chain of method
415 checks.
416
417 This appears to be a >1% speed-up on V8.
418
419 * bytecode/PutByIdStatus.cpp:
420 (JSC::PutByIdStatus::computeFromLLInt):
421 (JSC::PutByIdStatus::computeFor):
422 * bytecode/StructureSet.h:
423 (JSC::StructureSet::containsOnly):
424 (StructureSet):
425 * bytecode/Watchpoint.cpp:
426 (JSC::WatchpointSet::WatchpointSet):
427 (JSC::InlineWatchpointSet::add):
428 (JSC):
429 (JSC::InlineWatchpointSet::inflateSlow):
430 (JSC::InlineWatchpointSet::freeFat):
431 * bytecode/Watchpoint.h:
432 (WatchpointSet):
433 (JSC):
434 (InlineWatchpointSet):
435 (JSC::InlineWatchpointSet::InlineWatchpointSet):
436 (JSC::InlineWatchpointSet::~InlineWatchpointSet):
437 (JSC::InlineWatchpointSet::hasBeenInvalidated):
438 (JSC::InlineWatchpointSet::isStillValid):
439 (JSC::InlineWatchpointSet::startWatching):
440 (JSC::InlineWatchpointSet::notifyWrite):
441 (JSC::InlineWatchpointSet::isFat):
442 (JSC::InlineWatchpointSet::fat):
443 (JSC::InlineWatchpointSet::inflate):
444 * dfg/DFGAbstractState.cpp:
445 (JSC::DFG::AbstractState::execute):
446 * dfg/DFGByteCodeParser.cpp:
447 (JSC::DFG::ByteCodeParser::addStructureTransitionCheck):
448 (ByteCodeParser):
449 (JSC::DFG::ByteCodeParser::parseBlock):
450 * dfg/DFGCSEPhase.cpp:
451 (JSC::DFG::CSEPhase::structureTransitionWatchpointElimination):
452 (CSEPhase):
453 (JSC::DFG::CSEPhase::performNodeCSE):
454 * dfg/DFGCommon.h:
455 * dfg/DFGGraph.cpp:
456 (JSC::DFG::Graph::dump):
457 * dfg/DFGGraph.h:
458 (JSC::DFG::Graph::isCellConstant):
459 * dfg/DFGJITCompiler.h:
460 (JSC::DFG::JITCompiler::addWeakReferences):
461 (JITCompiler):
462 * dfg/DFGNode.h:
463 (JSC::DFG::Node::hasStructure):
464 (Node):
465 (JSC::DFG::Node::structure):
466 * dfg/DFGNodeType.h:
467 (DFG):
468 * dfg/DFGPredictionPropagationPhase.cpp:
469 (JSC::DFG::PredictionPropagationPhase::propagate):
470 * dfg/DFGRepatch.cpp:
471 (JSC::DFG::emitPutTransitionStub):
472 * dfg/DFGSpeculativeJIT64.cpp:
473 (JSC::DFG::SpeculativeJIT::compile):
474 * jit/JITStubs.cpp:
475 (JSC::JITThunks::tryCachePutByID):
476 * llint/LLIntSlowPaths.cpp:
477 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
478 * runtime/Structure.cpp:
479 (JSC::Structure::Structure):
480 * runtime/Structure.h:
481 (JSC::Structure::transitionWatchpointSetHasBeenInvalidated):
482 (Structure):
483 (JSC::Structure::transitionWatchpointSetIsStillValid):
484 (JSC::Structure::addTransitionWatchpoint):
485 (JSC::Structure::notifyTransitionFromThisStructure):
486 (JSC::JSCell::setStructure):
487 * runtime/SymbolTable.cpp:
488 (JSC::SymbolTableEntry::attemptToWatch):
489
4902012-06-13 Filip Pizlo <fpizlo@apple.com>
491
fpizlo@apple.comb75911b2012-06-13 20:53:52 +0000492 DFG should be able to set watchpoints on global variables
493 https://bugs.webkit.org/show_bug.cgi?id=88692
494
495 Reviewed by Geoffrey Garen.
496
497 Rolling back in after fixing Windows build issues, and implementing
498 branchTest8 for the Qt port's strange assemblers.
499
500 This implements global variable constant folding by allowing the optimizing
501 compiler to set a "watchpoint" on globals that it wishes to constant fold.
502 If the watchpoint fires, then an OSR exit is forced by overwriting the
503 machine code that the optimizing compiler generated with a jump.
504
505 As such, this patch is adding quite a bit of stuff:
506
507 - Jump replacement on those hardware targets supported by the optimizing
508 JIT. It is now possible to patch in a jump instruction over any recorded
509 watchpoint label. The jump must be "local" in the sense that it must be
510 within the range of the largest jump distance supported by a one
511 instruction jump.
512
513 - WatchpointSets and Watchpoints. A Watchpoint is a doubly-linked list node
514 that records the location where a jump must be inserted and the
515 destination to which it should jump. Watchpoints can be added to a
516 WatchpointSet. The WatchpointSet can be fired all at once, which plants
517 all jumps. WatchpointSet also remembers if it had ever been invalidated,
518 which allows for monotonicity: we typically don't want to optimize using
519 watchpoints on something for which watchpoints had previously fired. The
520 act of notifying a WatchpointSet has a trivial fast path in case no
521 Watchpoints are registered (one-byte load+branch).
522
523 - SpeculativeJIT::speculationWatchpoint(). It's like speculationCheck(),
524 except that you don't have to emit branches. But, you need to know what
525 WatchpointSet to add the resulting Watchpoint to. Not everything that
526 you could write a speculationCheck() for will have a WatchpointSet that
527 would get notified if the condition you were speculating against became
528 invalid.
529
530 - SymbolTableEntry now has the ability to refer to a WatchpointSet. It can
531 do so without incurring any space overhead for those entries that don't
532 have WatchpointSets.
533
534 - The bytecode generator infers all global function variables to be
535 watchable, and makes all stores perform the WatchpointSet's write check,
536 and marks all loads as being potentially watchable (i.e. you can compile
537 them to a watchpoint and a constant).
538
539 Put together, this allows for fully sleazy inlining of calls to globally
540 declared functions. The inline prologue will no longer contain the load of
541 the function, or any checks of the function you're calling. I.e. it's
542 pretty much like the kind of inlining you would see in Java or C++.
543 Furthermore, the watchpointing functionality is built to be fairly general,
544 and should allow setting watchpoints on all sorts of interesting things
545 in the future.
546
547 The sleazy inlining means that we will now sometimes inline in code paths
548 that have never executed. Previously, to inline we would have either had
549 to have executed the call (to read the call's inline cache) or have
550 executed the method check (to read the method check's inline cache). Now,
551 we might inline when the callee is a watched global variable. This
552 revealed some humorous bugs. First, constant folding disagreed with CFA
553 over what kinds of operations can clobber (example: code path A is dead
554 but stores a String into variable X, all other code paths store 0 into
555 X, and then you do CompareEq(X, 0) - CFA will say that this is a non-
556 clobbering constant, but constant folding thought it was clobbering
557 because it saw the String prediction). Second, inlining would crash if
558 the inline callee had not been compiled. This patch fixes both bugs,
559 since otherwise run-javascriptcore-tests would report regressions.
560
561 * CMakeLists.txt:
562 * GNUmakefile.list.am:
563 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
564 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
565 * JavaScriptCore.xcodeproj/project.pbxproj:
566 * Target.pri:
567 * assembler/ARMv7Assembler.h:
568 (ARMv7Assembler):
569 (JSC::ARMv7Assembler::ARMv7Assembler):
570 (JSC::ARMv7Assembler::labelForWatchpoint):
571 (JSC::ARMv7Assembler::label):
572 (JSC::ARMv7Assembler::replaceWithJump):
573 (JSC::ARMv7Assembler::maxJumpReplacementSize):
574 * assembler/AbstractMacroAssembler.h:
575 (JSC):
576 (AbstractMacroAssembler):
577 (Label):
578 (JSC::AbstractMacroAssembler::watchpointLabel):
579 (JSC::AbstractMacroAssembler::readPointer):
580 * assembler/AssemblerBuffer.h:
581 * assembler/MacroAssemblerARM.h:
582 (JSC::MacroAssemblerARM::branchTest8):
583 (MacroAssemblerARM):
584 (JSC::MacroAssemblerARM::replaceWithJump):
585 (JSC::MacroAssemblerARM::maxJumpReplacementSize):
586 * assembler/MacroAssemblerARMv7.h:
587 (JSC::MacroAssemblerARMv7::load8Signed):
588 (JSC::MacroAssemblerARMv7::load16Signed):
589 (MacroAssemblerARMv7):
590 (JSC::MacroAssemblerARMv7::replaceWithJump):
591 (JSC::MacroAssemblerARMv7::maxJumpReplacementSize):
592 (JSC::MacroAssemblerARMv7::branchTest8):
593 (JSC::MacroAssemblerARMv7::jump):
594 (JSC::MacroAssemblerARMv7::makeBranch):
595 * assembler/MacroAssemblerMIPS.h:
596 (JSC::MacroAssemblerMIPS::branchTest8):
597 (MacroAssemblerMIPS):
598 (JSC::MacroAssemblerMIPS::replaceWithJump):
599 (JSC::MacroAssemblerMIPS::maxJumpReplacementSize):
600 * assembler/MacroAssemblerSH4.h:
601 (JSC::MacroAssemblerSH4::branchTest8):
602 (MacroAssemblerSH4):
603 (JSC::MacroAssemblerSH4::replaceWithJump):
604 (JSC::MacroAssemblerSH4::maxJumpReplacementSize):
605 * assembler/MacroAssemblerX86.h:
606 (MacroAssemblerX86):
607 (JSC::MacroAssemblerX86::branchTest8):
608 * assembler/MacroAssemblerX86Common.h:
609 (JSC::MacroAssemblerX86Common::replaceWithJump):
610 (MacroAssemblerX86Common):
611 (JSC::MacroAssemblerX86Common::maxJumpReplacementSize):
612 * assembler/MacroAssemblerX86_64.h:
613 (MacroAssemblerX86_64):
614 (JSC::MacroAssemblerX86_64::branchTest8):
615 * assembler/X86Assembler.h:
616 (JSC::X86Assembler::X86Assembler):
617 (X86Assembler):
618 (JSC::X86Assembler::cmpb_im):
619 (JSC::X86Assembler::testb_im):
620 (JSC::X86Assembler::labelForWatchpoint):
621 (JSC::X86Assembler::label):
622 (JSC::X86Assembler::replaceWithJump):
623 (JSC::X86Assembler::maxJumpReplacementSize):
624 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
625 * bytecode/CodeBlock.cpp:
626 (JSC):
627 (JSC::CodeBlock::printGetByIdCacheStatus):
628 (JSC::CodeBlock::dump):
629 * bytecode/CodeBlock.h:
630 (JSC::CodeBlock::appendOSRExit):
631 (JSC::CodeBlock::appendSpeculationRecovery):
632 (CodeBlock):
633 (JSC::CodeBlock::appendWatchpoint):
634 (JSC::CodeBlock::numberOfWatchpoints):
635 (JSC::CodeBlock::watchpoint):
636 (DFGData):
637 * bytecode/DFGExitProfile.h:
638 (JSC::DFG::exitKindToString):
639 (JSC::DFG::exitKindIsCountable):
640 * bytecode/GetByIdStatus.cpp:
641 (JSC::GetByIdStatus::computeForChain):
642 * bytecode/Instruction.h:
643 (Instruction):
644 (JSC::Instruction::Instruction):
645 * bytecode/Opcode.h:
646 (JSC):
647 (JSC::padOpcodeName):
648 * bytecode/Watchpoint.cpp: Added.
649 (JSC):
650 (JSC::Watchpoint::~Watchpoint):
651 (JSC::Watchpoint::correctLabels):
652 (JSC::Watchpoint::fire):
653 (JSC::WatchpointSet::WatchpointSet):
654 (JSC::WatchpointSet::~WatchpointSet):
655 (JSC::WatchpointSet::add):
656 (JSC::WatchpointSet::notifyWriteSlow):
657 (JSC::WatchpointSet::fireAllWatchpoints):
658 * bytecode/Watchpoint.h: Added.
659 (JSC):
660 (Watchpoint):
661 (JSC::Watchpoint::Watchpoint):
662 (JSC::Watchpoint::setDestination):
663 (WatchpointSet):
664 (JSC::WatchpointSet::isStillValid):
665 (JSC::WatchpointSet::hasBeenInvalidated):
666 (JSC::WatchpointSet::startWatching):
667 (JSC::WatchpointSet::notifyWrite):
668 (JSC::WatchpointSet::addressOfIsWatched):
669 * bytecompiler/BytecodeGenerator.cpp:
670 (JSC::ResolveResult::checkValidity):
671 (JSC::BytecodeGenerator::addGlobalVar):
672 (JSC::BytecodeGenerator::BytecodeGenerator):
673 (JSC::BytecodeGenerator::resolve):
674 (JSC::BytecodeGenerator::emitResolve):
675 (JSC::BytecodeGenerator::emitResolveWithBase):
676 (JSC::BytecodeGenerator::emitResolveWithThis):
677 (JSC::BytecodeGenerator::emitGetStaticVar):
678 (JSC::BytecodeGenerator::emitPutStaticVar):
679 * bytecompiler/BytecodeGenerator.h:
680 (BytecodeGenerator):
681 * bytecompiler/NodesCodegen.cpp:
682 (JSC::FunctionCallResolveNode::emitBytecode):
683 (JSC::PostfixResolveNode::emitBytecode):
684 (JSC::PrefixResolveNode::emitBytecode):
685 (JSC::ReadModifyResolveNode::emitBytecode):
686 (JSC::AssignResolveNode::emitBytecode):
687 (JSC::ConstDeclNode::emitCodeSingle):
688 * dfg/DFGAbstractState.cpp:
689 (JSC::DFG::AbstractState::execute):
690 (JSC::DFG::AbstractState::clobberStructures):
691 * dfg/DFGAbstractState.h:
692 (AbstractState):
693 (JSC::DFG::AbstractState::didClobber):
694 * dfg/DFGByteCodeParser.cpp:
695 (JSC::DFG::ByteCodeParser::handleInlining):
696 (JSC::DFG::ByteCodeParser::parseBlock):
697 * dfg/DFGCCallHelpers.h:
698 (CCallHelpers):
699 (JSC::DFG::CCallHelpers::setupArguments):
700 * dfg/DFGCSEPhase.cpp:
701 (JSC::DFG::CSEPhase::globalVarWatchpointElimination):
702 (CSEPhase):
703 (JSC::DFG::CSEPhase::globalVarStoreElimination):
704 (JSC::DFG::CSEPhase::performNodeCSE):
705 * dfg/DFGCapabilities.h:
706 (JSC::DFG::canCompileOpcode):
707 * dfg/DFGConstantFoldingPhase.cpp:
708 (JSC::DFG::ConstantFoldingPhase::run):
709 * dfg/DFGCorrectableJumpPoint.h:
710 (JSC::DFG::CorrectableJumpPoint::isSet):
711 (CorrectableJumpPoint):
712 * dfg/DFGJITCompiler.cpp:
713 (JSC::DFG::JITCompiler::linkOSRExits):
714 (JSC::DFG::JITCompiler::link):
715 * dfg/DFGNode.h:
716 (JSC::DFG::Node::hasIdentifierNumberForCheck):
717 (Node):
718 (JSC::DFG::Node::identifierNumberForCheck):
719 (JSC::DFG::Node::hasRegisterPointer):
720 * dfg/DFGNodeType.h:
721 (DFG):
722 * dfg/DFGOSRExit.cpp:
723 (JSC::DFG::OSRExit::OSRExit):
724 * dfg/DFGOSRExit.h:
725 (OSRExit):
726 * dfg/DFGOperations.cpp:
727 * dfg/DFGOperations.h:
728 * dfg/DFGPredictionPropagationPhase.cpp:
729 (JSC::DFG::PredictionPropagationPhase::propagate):
730 * dfg/DFGSpeculativeJIT.h:
731 (JSC::DFG::SpeculativeJIT::callOperation):
732 (JSC::DFG::SpeculativeJIT::appendCall):
733 (SpeculativeJIT):
734 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
735 * dfg/DFGSpeculativeJIT32_64.cpp:
736 (JSC::DFG::SpeculativeJIT::compile):
737 * dfg/DFGSpeculativeJIT64.cpp:
738 (JSC::DFG::SpeculativeJIT::compile):
739 * interpreter/Interpreter.cpp:
740 (JSC::Interpreter::privateExecute):
741 * jit/JIT.cpp:
742 (JSC::JIT::privateCompileMainPass):
743 (JSC::JIT::privateCompileSlowCases):
744 * jit/JIT.h:
745 * jit/JITPropertyAccess.cpp:
746 (JSC::JIT::emit_op_put_global_var_check):
747 (JSC):
748 (JSC::JIT::emitSlow_op_put_global_var_check):
749 * jit/JITPropertyAccess32_64.cpp:
750 (JSC::JIT::emit_op_put_global_var_check):
751 (JSC):
752 (JSC::JIT::emitSlow_op_put_global_var_check):
753 * jit/JITStubs.cpp:
754 (JSC::DEFINE_STUB_FUNCTION):
755 (JSC):
756 * jit/JITStubs.h:
757 * llint/LLIntSlowPaths.cpp:
758 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
759 (LLInt):
760 * llint/LLIntSlowPaths.h:
761 (LLInt):
762 * llint/LowLevelInterpreter32_64.asm:
763 * llint/LowLevelInterpreter64.asm:
764 * runtime/JSObject.cpp:
765 (JSC::JSObject::removeDirect):
766 * runtime/JSObject.h:
767 (JSObject):
768 * runtime/JSSymbolTableObject.h:
769 (JSC::symbolTableGet):
770 (JSC::symbolTablePut):
771 (JSC::symbolTablePutWithAttributes):
772 * runtime/SymbolTable.cpp: Added.
773 (JSC):
774 (JSC::SymbolTableEntry::copySlow):
775 (JSC::SymbolTableEntry::freeFatEntrySlow):
776 (JSC::SymbolTableEntry::couldBeWatched):
777 (JSC::SymbolTableEntry::attemptToWatch):
778 (JSC::SymbolTableEntry::addressOfIsWatched):
779 (JSC::SymbolTableEntry::addWatchpoint):
780 (JSC::SymbolTableEntry::notifyWriteSlow):
781 (JSC::SymbolTableEntry::inflateSlow):
782 * runtime/SymbolTable.h:
783 (JSC):
784 (SymbolTableEntry):
785 (Fast):
786 (JSC::SymbolTableEntry::Fast::Fast):
787 (JSC::SymbolTableEntry::Fast::isNull):
788 (JSC::SymbolTableEntry::Fast::getIndex):
789 (JSC::SymbolTableEntry::Fast::isReadOnly):
790 (JSC::SymbolTableEntry::Fast::getAttributes):
791 (JSC::SymbolTableEntry::Fast::isFat):
792 (JSC::SymbolTableEntry::SymbolTableEntry):
793 (JSC::SymbolTableEntry::~SymbolTableEntry):
794 (JSC::SymbolTableEntry::operator=):
795 (JSC::SymbolTableEntry::isNull):
796 (JSC::SymbolTableEntry::getIndex):
797 (JSC::SymbolTableEntry::getFast):
798 (JSC::SymbolTableEntry::getAttributes):
799 (JSC::SymbolTableEntry::isReadOnly):
800 (JSC::SymbolTableEntry::watchpointSet):
801 (JSC::SymbolTableEntry::notifyWrite):
802 (FatEntry):
803 (JSC::SymbolTableEntry::FatEntry::FatEntry):
804 (JSC::SymbolTableEntry::isFat):
805 (JSC::SymbolTableEntry::fatEntry):
806 (JSC::SymbolTableEntry::inflate):
807 (JSC::SymbolTableEntry::bits):
808 (JSC::SymbolTableEntry::freeFatEntry):
809 (JSC::SymbolTableEntry::pack):
810 (JSC::SymbolTableEntry::isValidIndex):
811
zandobersek@gmail.com88d53732012-06-13 09:38:42 +00008122012-06-13 Sheriff Bot <webkit.review.bot@gmail.com>
813
814 Unreviewed, rolling out r120172.
815 http://trac.webkit.org/changeset/120172
816 https://bugs.webkit.org/show_bug.cgi?id=88976
817
818 The patch causes compilation failures on Gtk, Qt and Apple Win
819 bots (Requested by zdobersek on #webkit).
820
821 * CMakeLists.txt:
822 * GNUmakefile.list.am:
823 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
824 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
825 * JavaScriptCore.xcodeproj/project.pbxproj:
826 * Target.pri:
827 * assembler/ARMv7Assembler.h:
828 (JSC::ARMv7Assembler::nop):
829 (JSC::ARMv7Assembler::label):
830 (JSC::ARMv7Assembler::readPointer):
831 (ARMv7Assembler):
832 * assembler/AbstractMacroAssembler.h:
833 (JSC):
834 (AbstractMacroAssembler):
835 (Label):
836 * assembler/AssemblerBuffer.h:
837 * assembler/MacroAssemblerARM.h:
838 * assembler/MacroAssemblerARMv7.h:
839 (JSC::MacroAssemblerARMv7::nop):
840 (JSC::MacroAssemblerARMv7::jump):
841 (JSC::MacroAssemblerARMv7::makeBranch):
842 * assembler/MacroAssemblerMIPS.h:
843 * assembler/MacroAssemblerSH4.h:
844 * assembler/MacroAssemblerX86.h:
845 (MacroAssemblerX86):
846 (JSC::MacroAssemblerX86::moveWithPatch):
847 * assembler/MacroAssemblerX86Common.h:
848 * assembler/MacroAssemblerX86_64.h:
849 (JSC::MacroAssemblerX86_64::branchTest8):
850 * assembler/X86Assembler.h:
851 (JSC::X86Assembler::cmpb_im):
852 (JSC::X86Assembler::codeSize):
853 (JSC::X86Assembler::label):
854 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
855 * bytecode/CodeBlock.cpp:
856 (JSC::CodeBlock::dump):
857 * bytecode/CodeBlock.h:
858 (JSC::CodeBlock::appendOSRExit):
859 (JSC::CodeBlock::appendSpeculationRecovery):
860 (DFGData):
861 * bytecode/DFGExitProfile.h:
862 (JSC::DFG::exitKindToString):
863 (JSC::DFG::exitKindIsCountable):
864 * bytecode/Instruction.h:
865 * bytecode/Opcode.h:
866 (JSC):
867 (JSC::padOpcodeName):
868 * bytecode/Watchpoint.cpp: Removed.
869 * bytecode/Watchpoint.h: Removed.
870 * bytecompiler/BytecodeGenerator.cpp:
871 (JSC::ResolveResult::checkValidity):
872 (JSC::BytecodeGenerator::addGlobalVar):
873 (JSC::BytecodeGenerator::BytecodeGenerator):
874 (JSC::BytecodeGenerator::resolve):
875 (JSC::BytecodeGenerator::emitResolve):
876 (JSC::BytecodeGenerator::emitResolveWithBase):
877 (JSC::BytecodeGenerator::emitResolveWithThis):
878 (JSC::BytecodeGenerator::emitGetStaticVar):
879 (JSC::BytecodeGenerator::emitPutStaticVar):
880 * bytecompiler/BytecodeGenerator.h:
881 (BytecodeGenerator):
882 * bytecompiler/NodesCodegen.cpp:
883 (JSC::FunctionCallResolveNode::emitBytecode):
884 (JSC::PostfixResolveNode::emitBytecode):
885 (JSC::PrefixResolveNode::emitBytecode):
886 (JSC::ReadModifyResolveNode::emitBytecode):
887 (JSC::AssignResolveNode::emitBytecode):
888 (JSC::ConstDeclNode::emitCodeSingle):
889 * dfg/DFGAbstractState.cpp:
890 (JSC::DFG::AbstractState::execute):
891 (JSC::DFG::AbstractState::clobberStructures):
892 * dfg/DFGAbstractState.h:
893 (AbstractState):
894 * dfg/DFGByteCodeParser.cpp:
895 (JSC::DFG::ByteCodeParser::handleInlining):
896 (JSC::DFG::ByteCodeParser::parseBlock):
897 * dfg/DFGCCallHelpers.h:
898 (JSC::DFG::CCallHelpers::setupArguments):
899 * dfg/DFGCSEPhase.cpp:
900 (JSC::DFG::CSEPhase::globalVarStoreElimination):
901 (JSC::DFG::CSEPhase::performNodeCSE):
902 * dfg/DFGCapabilities.h:
903 (JSC::DFG::canCompileOpcode):
904 * dfg/DFGConstantFoldingPhase.cpp:
905 (JSC::DFG::ConstantFoldingPhase::run):
906 * dfg/DFGCorrectableJumpPoint.h:
907 * dfg/DFGJITCompiler.cpp:
908 (JSC::DFG::JITCompiler::linkOSRExits):
909 (JSC::DFG::JITCompiler::link):
910 * dfg/DFGNode.h:
911 (JSC::DFG::Node::hasRegisterPointer):
912 * dfg/DFGNodeType.h:
913 (DFG):
914 * dfg/DFGOSRExit.cpp:
915 (JSC::DFG::OSRExit::OSRExit):
916 * dfg/DFGOSRExit.h:
917 (OSRExit):
918 * dfg/DFGOperations.cpp:
919 * dfg/DFGOperations.h:
920 * dfg/DFGPredictionPropagationPhase.cpp:
921 (JSC::DFG::PredictionPropagationPhase::propagate):
922 * dfg/DFGSpeculativeJIT.h:
923 (JSC::DFG::SpeculativeJIT::callOperation):
924 (JSC::DFG::SpeculativeJIT::appendCallSetResult):
925 (JSC::DFG::SpeculativeJIT::speculationCheck):
926 * dfg/DFGSpeculativeJIT32_64.cpp:
927 (JSC::DFG::SpeculativeJIT::compile):
928 * dfg/DFGSpeculativeJIT64.cpp:
929 (JSC::DFG::SpeculativeJIT::compile):
930 * jit/JIT.cpp:
931 (JSC::JIT::privateCompileMainPass):
932 (JSC::JIT::privateCompileSlowCases):
933 * jit/JIT.h:
934 * jit/JITPropertyAccess.cpp:
935 * jit/JITPropertyAccess32_64.cpp:
936 * jit/JITStubs.cpp:
937 * jit/JITStubs.h:
938 * llint/LLIntSlowPaths.cpp:
939 * llint/LLIntSlowPaths.h:
940 (LLInt):
941 * llint/LowLevelInterpreter32_64.asm:
942 * llint/LowLevelInterpreter64.asm:
943 * runtime/JSObject.cpp:
944 (JSC::JSObject::removeDirect):
945 * runtime/JSObject.h:
946 (JSObject):
947 * runtime/JSSymbolTableObject.h:
948 (JSC::symbolTableGet):
949 (JSC::symbolTablePut):
950 (JSC::symbolTablePutWithAttributes):
951 * runtime/SymbolTable.cpp: Removed.
952 * runtime/SymbolTable.h:
953 (JSC):
954 (JSC::SymbolTableEntry::isNull):
955 (JSC::SymbolTableEntry::getIndex):
956 (SymbolTableEntry):
957 (JSC::SymbolTableEntry::getAttributes):
958 (JSC::SymbolTableEntry::isReadOnly):
959 (JSC::SymbolTableEntry::pack):
960 (JSC::SymbolTableEntry::isValidIndex):
961
fpizlo@apple.com3bdd4c92012-06-13 04:56:22 +00009622012-06-12 Filip Pizlo <fpizlo@apple.com>
963
fpizlo@apple.comb6c5eeb2012-06-13 08:20:39 +0000964 DFG should be able to set watchpoints on global variables
965 https://bugs.webkit.org/show_bug.cgi?id=88692
966
967 Reviewed by Geoffrey Garen.
968
969 This implements global variable constant folding by allowing the optimizing
970 compiler to set a "watchpoint" on globals that it wishes to constant fold.
971 If the watchpoint fires, then an OSR exit is forced by overwriting the
972 machine code that the optimizing compiler generated with a jump.
973
974 As such, this patch is adding quite a bit of stuff:
975
976 - Jump replacement on those hardware targets supported by the optimizing
977 JIT. It is now possible to patch in a jump instruction over any recorded
978 watchpoint label. The jump must be "local" in the sense that it must be
979 within the range of the largest jump distance supported by a one
980 instruction jump.
981
982 - WatchpointSets and Watchpoints. A Watchpoint is a doubly-linked list node
983 that records the location where a jump must be inserted and the
984 destination to which it should jump. Watchpoints can be added to a
985 WatchpointSet. The WatchpointSet can be fired all at once, which plants
986 all jumps. WatchpointSet also remembers if it had ever been invalidated,
987 which allows for monotonicity: we typically don't want to optimize using
988 watchpoints on something for which watchpoints had previously fired. The
989 act of notifying a WatchpointSet has a trivial fast path in case no
990 Watchpoints are registered (one-byte load+branch).
991
992 - SpeculativeJIT::speculationWatchpoint(). It's like speculationCheck(),
993 except that you don't have to emit branches. But, you need to know what
994 WatchpointSet to add the resulting Watchpoint to. Not everything that
995 you could write a speculationCheck() for will have a WatchpointSet that
996 would get notified if the condition you were speculating against became
997 invalid.
998
999 - SymbolTableEntry now has the ability to refer to a WatchpointSet. It can
1000 do so without incurring any space overhead for those entries that don't
1001 have WatchpointSets.
1002
1003 - The bytecode generator infers all global function variables to be
1004 watchable, and makes all stores perform the WatchpointSet's write check,
1005 and marks all loads as being potentially watchable (i.e. you can compile
1006 them to a watchpoint and a constant).
1007
1008 Put together, this allows for fully sleazy inlining of calls to globally
1009 declared functions. The inline prologue will no longer contain the load of
1010 the function, or any checks of the function you're calling. I.e. it's
1011 pretty much like the kind of inlining you would see in Java or C++.
1012 Furthermore, the watchpointing functionality is built to be fairly general,
1013 and should allow setting watchpoints on all sorts of interesting things
1014 in the future.
1015
1016 The sleazy inlining means that we will now sometimes inline in code paths
1017 that have never executed. Previously, to inline we would have either had
1018 to have executed the call (to read the call's inline cache) or have
1019 executed the method check (to read the method check's inline cache). Now,
1020 we might inline when the callee is a watched global variable. This
1021 revealed some humorous bugs. First, constant folding disagreed with CFA
1022 over what kinds of operations can clobber (example: code path A is dead
1023 but stores a String into variable X, all other code paths store 0 into
1024 X, and then you do CompareEq(X, 0) - CFA will say that this is a non-
1025 clobbering constant, but constant folding thought it was clobbering
1026 because it saw the String prediction). Second, inlining would crash if
1027 the inline callee had not been compiled. This patch fixes both bugs,
1028 since otherwise run-javascriptcore-tests would report regressions.
1029
1030 * CMakeLists.txt:
1031 * GNUmakefile.list.am:
1032 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1033 * JavaScriptCore.xcodeproj/project.pbxproj:
1034 * Target.pri:
1035 * assembler/ARMv7Assembler.h:
1036 (ARMv7Assembler):
1037 (JSC::ARMv7Assembler::ARMv7Assembler):
1038 (JSC::ARMv7Assembler::labelForWatchpoint):
1039 (JSC::ARMv7Assembler::label):
1040 (JSC::ARMv7Assembler::replaceWithJump):
1041 (JSC::ARMv7Assembler::maxJumpReplacementSize):
1042 * assembler/AbstractMacroAssembler.h:
1043 (JSC):
1044 (AbstractMacroAssembler):
1045 (Label):
1046 (JSC::AbstractMacroAssembler::watchpointLabel):
1047 * assembler/AssemblerBuffer.h:
1048 * assembler/MacroAssemblerARM.h:
1049 (JSC::MacroAssemblerARM::replaceWithJump):
1050 (MacroAssemblerARM):
1051 (JSC::MacroAssemblerARM::maxJumpReplacementSize):
1052 * assembler/MacroAssemblerARMv7.h:
1053 (MacroAssemblerARMv7):
1054 (JSC::MacroAssemblerARMv7::replaceWithJump):
1055 (JSC::MacroAssemblerARMv7::maxJumpReplacementSize):
1056 (JSC::MacroAssemblerARMv7::branchTest8):
1057 (JSC::MacroAssemblerARMv7::jump):
1058 (JSC::MacroAssemblerARMv7::makeBranch):
1059 * assembler/MacroAssemblerMIPS.h:
1060 (JSC::MacroAssemblerMIPS::replaceWithJump):
1061 (MacroAssemblerMIPS):
1062 (JSC::MacroAssemblerMIPS::maxJumpReplacementSize):
1063 * assembler/MacroAssemblerSH4.h:
1064 (JSC::MacroAssemblerSH4::replaceWithJump):
1065 (MacroAssemblerSH4):
1066 (JSC::MacroAssemblerSH4::maxJumpReplacementSize):
1067 * assembler/MacroAssemblerX86.h:
1068 (MacroAssemblerX86):
1069 (JSC::MacroAssemblerX86::branchTest8):
1070 * assembler/MacroAssemblerX86Common.h:
1071 (JSC::MacroAssemblerX86Common::replaceWithJump):
1072 (MacroAssemblerX86Common):
1073 (JSC::MacroAssemblerX86Common::maxJumpReplacementSize):
1074 * assembler/MacroAssemblerX86_64.h:
1075 (MacroAssemblerX86_64):
1076 (JSC::MacroAssemblerX86_64::branchTest8):
1077 * assembler/X86Assembler.h:
1078 (JSC::X86Assembler::X86Assembler):
1079 (X86Assembler):
1080 (JSC::X86Assembler::cmpb_im):
1081 (JSC::X86Assembler::testb_im):
1082 (JSC::X86Assembler::labelForWatchpoint):
1083 (JSC::X86Assembler::label):
1084 (JSC::X86Assembler::replaceWithJump):
1085 (JSC::X86Assembler::maxJumpReplacementSize):
1086 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
1087 * bytecode/CodeBlock.cpp:
1088 (JSC::CodeBlock::dump):
1089 * bytecode/CodeBlock.h:
1090 (JSC::CodeBlock::appendOSRExit):
1091 (JSC::CodeBlock::appendSpeculationRecovery):
1092 (CodeBlock):
1093 (JSC::CodeBlock::appendWatchpoint):
1094 (JSC::CodeBlock::numberOfWatchpoints):
1095 (JSC::CodeBlock::watchpoint):
1096 (DFGData):
1097 * bytecode/DFGExitProfile.h:
1098 (JSC::DFG::exitKindToString):
1099 (JSC::DFG::exitKindIsCountable):
1100 * bytecode/Instruction.h:
1101 (Instruction):
1102 (JSC::Instruction::Instruction):
1103 * bytecode/Opcode.h:
1104 (JSC):
1105 (JSC::padOpcodeName):
1106 * bytecode/Watchpoint.cpp: Added.
1107 (JSC):
1108 (JSC::Watchpoint::~Watchpoint):
1109 (JSC::Watchpoint::correctLabels):
1110 (JSC::Watchpoint::fire):
1111 (JSC::WatchpointSet::WatchpointSet):
1112 (JSC::WatchpointSet::~WatchpointSet):
1113 (JSC::WatchpointSet::add):
1114 (JSC::WatchpointSet::notifyWriteSlow):
1115 (JSC::WatchpointSet::fireAllWatchpoints):
1116 * bytecode/Watchpoint.h: Added.
1117 (JSC):
1118 (Watchpoint):
1119 (JSC::Watchpoint::Watchpoint):
1120 (JSC::Watchpoint::setDestination):
1121 (WatchpointSet):
1122 (JSC::WatchpointSet::isStillValid):
1123 (JSC::WatchpointSet::hasBeenInvalidated):
1124 (JSC::WatchpointSet::startWatching):
1125 (JSC::WatchpointSet::notifyWrite):
1126 (JSC::WatchpointSet::addressOfIsWatched):
1127 * bytecompiler/BytecodeGenerator.cpp:
1128 (JSC::ResolveResult::checkValidity):
1129 (JSC::BytecodeGenerator::addGlobalVar):
1130 (JSC::BytecodeGenerator::BytecodeGenerator):
1131 (JSC::BytecodeGenerator::resolve):
1132 (JSC::BytecodeGenerator::emitResolve):
1133 (JSC::BytecodeGenerator::emitResolveWithBase):
1134 (JSC::BytecodeGenerator::emitResolveWithThis):
1135 (JSC::BytecodeGenerator::emitGetStaticVar):
1136 (JSC::BytecodeGenerator::emitPutStaticVar):
1137 * bytecompiler/BytecodeGenerator.h:
1138 (BytecodeGenerator):
1139 * bytecompiler/NodesCodegen.cpp:
1140 (JSC::FunctionCallResolveNode::emitBytecode):
1141 (JSC::PostfixResolveNode::emitBytecode):
1142 (JSC::PrefixResolveNode::emitBytecode):
1143 (JSC::ReadModifyResolveNode::emitBytecode):
1144 (JSC::AssignResolveNode::emitBytecode):
1145 (JSC::ConstDeclNode::emitCodeSingle):
1146 * dfg/DFGAbstractState.cpp:
1147 (JSC::DFG::AbstractState::execute):
1148 (JSC::DFG::AbstractState::clobberStructures):
1149 * dfg/DFGAbstractState.h:
1150 (AbstractState):
1151 (JSC::DFG::AbstractState::didClobber):
1152 * dfg/DFGByteCodeParser.cpp:
1153 (JSC::DFG::ByteCodeParser::handleInlining):
1154 (JSC::DFG::ByteCodeParser::parseBlock):
1155 * dfg/DFGCCallHelpers.h:
1156 (CCallHelpers):
1157 (JSC::DFG::CCallHelpers::setupArguments):
1158 * dfg/DFGCSEPhase.cpp:
1159 (JSC::DFG::CSEPhase::globalVarWatchpointElimination):
1160 (CSEPhase):
1161 (JSC::DFG::CSEPhase::globalVarStoreElimination):
1162 (JSC::DFG::CSEPhase::performNodeCSE):
1163 * dfg/DFGCapabilities.h:
1164 (JSC::DFG::canCompileOpcode):
1165 * dfg/DFGConstantFoldingPhase.cpp:
1166 (JSC::DFG::ConstantFoldingPhase::run):
1167 * dfg/DFGCorrectableJumpPoint.h:
1168 (JSC::DFG::CorrectableJumpPoint::isSet):
1169 (CorrectableJumpPoint):
1170 * dfg/DFGJITCompiler.cpp:
1171 (JSC::DFG::JITCompiler::linkOSRExits):
1172 (JSC::DFG::JITCompiler::link):
1173 * dfg/DFGNode.h:
1174 (JSC::DFG::Node::hasIdentifierNumberForCheck):
1175 (Node):
1176 (JSC::DFG::Node::identifierNumberForCheck):
1177 (JSC::DFG::Node::hasRegisterPointer):
1178 * dfg/DFGNodeType.h:
1179 (DFG):
1180 * dfg/DFGOSRExit.cpp:
1181 (JSC::DFG::OSRExit::OSRExit):
1182 * dfg/DFGOSRExit.h:
1183 (OSRExit):
1184 * dfg/DFGOperations.cpp:
1185 * dfg/DFGOperations.h:
1186 * dfg/DFGPredictionPropagationPhase.cpp:
1187 (JSC::DFG::PredictionPropagationPhase::propagate):
1188 * dfg/DFGSpeculativeJIT.h:
1189 (JSC::DFG::SpeculativeJIT::callOperation):
1190 (JSC::DFG::SpeculativeJIT::appendCall):
1191 (SpeculativeJIT):
1192 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
1193 * dfg/DFGSpeculativeJIT32_64.cpp:
1194 (JSC::DFG::SpeculativeJIT::compile):
1195 * dfg/DFGSpeculativeJIT64.cpp:
1196 (JSC::DFG::SpeculativeJIT::compile):
1197 * jit/JIT.cpp:
1198 (JSC::JIT::privateCompileMainPass):
1199 (JSC::JIT::privateCompileSlowCases):
1200 * jit/JIT.h:
1201 * jit/JITPropertyAccess.cpp:
1202 (JSC::JIT::emit_op_put_global_var_check):
1203 (JSC):
1204 (JSC::JIT::emitSlow_op_put_global_var_check):
1205 * jit/JITPropertyAccess32_64.cpp:
1206 (JSC::JIT::emit_op_put_global_var_check):
1207 (JSC):
1208 (JSC::JIT::emitSlow_op_put_global_var_check):
1209 * jit/JITStubs.cpp:
1210 (JSC::JITThunks::JITThunks):
1211 (JSC::DEFINE_STUB_FUNCTION):
1212 (JSC):
1213 * jit/JITStubs.h:
1214 * llint/LLIntSlowPaths.cpp:
1215 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
1216 (LLInt):
1217 * llint/LLIntSlowPaths.h:
1218 (LLInt):
1219 * llint/LowLevelInterpreter32_64.asm:
1220 * llint/LowLevelInterpreter64.asm:
1221 * runtime/JSObject.cpp:
1222 (JSC::JSObject::removeDirect):
1223 * runtime/JSObject.h:
1224 (JSObject):
1225 * runtime/JSSymbolTableObject.h:
1226 (JSC::symbolTableGet):
1227 (JSC::symbolTablePut):
1228 (JSC::symbolTablePutWithAttributes):
1229 * runtime/SymbolTable.cpp: Added.
1230 (JSC):
1231 (JSC::SymbolTableEntry::copySlow):
1232 (JSC::SymbolTableEntry::freeFatEntrySlow):
1233 (JSC::SymbolTableEntry::couldBeWatched):
1234 (JSC::SymbolTableEntry::attemptToWatch):
1235 (JSC::SymbolTableEntry::addressOfIsWatched):
1236 (JSC::SymbolTableEntry::addWatchpoint):
1237 (JSC::SymbolTableEntry::notifyWriteSlow):
1238 (JSC::SymbolTableEntry::inflateSlow):
1239 * runtime/SymbolTable.h:
1240 (JSC):
1241 (SymbolTableEntry):
1242 (Fast):
1243 (JSC::SymbolTableEntry::Fast::Fast):
1244 (JSC::SymbolTableEntry::Fast::isNull):
1245 (JSC::SymbolTableEntry::Fast::getIndex):
1246 (JSC::SymbolTableEntry::Fast::isReadOnly):
1247 (JSC::SymbolTableEntry::Fast::getAttributes):
1248 (JSC::SymbolTableEntry::Fast::isFat):
1249 (JSC::SymbolTableEntry::SymbolTableEntry):
1250 (JSC::SymbolTableEntry::~SymbolTableEntry):
1251 (JSC::SymbolTableEntry::operator=):
1252 (JSC::SymbolTableEntry::isNull):
1253 (JSC::SymbolTableEntry::getIndex):
1254 (JSC::SymbolTableEntry::getFast):
1255 (JSC::SymbolTableEntry::getAttributes):
1256 (JSC::SymbolTableEntry::isReadOnly):
1257 (JSC::SymbolTableEntry::watchpointSet):
1258 (JSC::SymbolTableEntry::notifyWrite):
1259 (FatEntry):
1260 (JSC::SymbolTableEntry::FatEntry::FatEntry):
1261 (JSC::SymbolTableEntry::isFat):
1262 (JSC::SymbolTableEntry::fatEntry):
1263 (JSC::SymbolTableEntry::inflate):
1264 (JSC::SymbolTableEntry::bits):
1265 (JSC::SymbolTableEntry::freeFatEntry):
1266 (JSC::SymbolTableEntry::pack):
1267 (JSC::SymbolTableEntry::isValidIndex):
1268
12692012-06-12 Filip Pizlo <fpizlo@apple.com>
1270
fpizlo@apple.com3bdd4c92012-06-13 04:56:22 +00001271 Unreviewed build fix for ARMv7 debug builds.
1272
1273 * jit/JITStubs.cpp:
1274 (JSC::JITThunks::JITThunks):
1275
ggaren@apple.com3c89f392012-06-13 02:50:50 +000012762012-06-12 Geoffrey Garen <ggaren@apple.com>
1277
1278 Build fix for case-sensitive file systems: use the right case.
1279
1280 * heap/ListableHandler.h:
1281
ggaren@apple.com639160c2012-06-13 02:06:50 +000012822012-06-11 Geoffrey Garen <ggaren@apple.com>
1283
1284 GC should be 1.7X faster
1285 https://bugs.webkit.org/show_bug.cgi?id=88840
1286
1287 Reviewed by Oliver Hunt.
1288
1289 I profiled, and removed anything that showed up as a concurrency
1290 bottleneck. Then, I added 3 threads to our max thread count, since we
1291 can scale up to more threads now.
1292
1293 * heap/BlockAllocator.cpp:
1294 (JSC::BlockAllocator::BlockAllocator):
1295 (JSC::BlockAllocator::~BlockAllocator):
1296 (JSC::BlockAllocator::releaseFreeBlocks):
1297 (JSC::BlockAllocator::waitForRelativeTimeWhileHoldingLock):
1298 (JSC::BlockAllocator::waitForRelativeTime):
1299 (JSC::BlockAllocator::blockFreeingThreadMain):
1300 * heap/BlockAllocator.h:
1301 (BlockAllocator):
1302 (JSC::BlockAllocator::allocate):
1303 (JSC::BlockAllocator::deallocate): Use a spin lock for the common case
1304 where we're just popping a linked list. (A pthread mutex would sleep our
1305 thread even if the lock were only contended for a microsecond.)
1306
1307 Scope the lock to avoid holding it while allocating VM, since that's a
1308 slow activity and it doesn't modify any of our data structures.
1309
1310 We still use a pthread mutex to handle our condition variable since we
1311 have to, and it's not a hot path.
1312
1313 * heap/CopiedSpace.cpp:
1314 (JSC::CopiedSpace::CopiedSpace):
1315 (JSC::CopiedSpace::doneFillingBlock):
1316 * heap/CopiedSpace.h:
1317 (JSC::CopiedSpace::CopiedSpace): Use a spin lock for the to space lock,
1318 since it just guards linked list and hash table manipulation.
1319
1320 * heap/MarkStack.cpp:
1321 (JSC::MarkStackSegmentAllocator::MarkStackSegmentAllocator):
1322 (JSC::MarkStackSegmentAllocator::allocate):
1323 (JSC::MarkStackSegmentAllocator::release):
1324 (JSC::MarkStackSegmentAllocator::shrinkReserve): Use a spin lock, since
1325 we're just managing a linked list.
1326
1327 (JSC::MarkStackArray::donateSomeCellsTo): Changed donation to be proportional
1328 to our current stack size. This fixes cases where we used to donate too
1329 much. Interestingly, donating too much was starving the donor (when it
1330 ran out of work later) *and* the recipient (since it had to wait on a
1331 long donation operation to complete before it could acquire the lock).
1332
1333 In the worst case, we're still guaranteed to donate N cells in roughly log N time.
1334
1335 This change also fixes cases where we used to donate too little, since
1336 we would always keep a fixed minimum number of cells. In the worst case,
1337 with N marking threads, would could have N large object graph roots in
1338 our stack for the duration of GC, and scale to only 1 thread.
1339
1340 It's an interesting observation that a single object in the mark stack
1341 might represent an arbitrarily large object graph -- and only the act
1342 of marking can find out.
1343
1344 (JSC::MarkStackArray::stealSomeCellsFrom): Steal in proportion to idle
1345 threads. Once again, this fixes cases where constants could cause us
1346 to steal too much or too little.
1347
1348 (JSC::SlotVisitor::donateKnownParallel): Always wake up other threads
1349 if they're idle. We can afford to do this because we're conservative
1350 about when we donate.
1351
1352 (JSC::SlotVisitor::drainFromShared):
1353 * heap/MarkStack.h:
1354 (MarkStackSegmentAllocator):
1355 (MarkStackArray):
1356 (JSC):
1357 * heap/SlotVisitor.h: Merged the "should I donate?" decision into a
1358 single function, for simplicity.
1359
1360 * runtime/Options.cpp:
1361 (minimumNumberOfScansBetweenRebalance): Reduced the delay before donation
1362 a lot. We can afford to do this because, in the common case, donation is
1363 a single branch that decides not to donate.
1364
1365 (cpusToUse): Use more CPUs now, since we scale better now.
1366
1367 * runtime/Options.h:
1368 (Options): Removed now-unused variables.
1369
fpizlo@apple.com53ef1042012-06-13 01:29:07 +000013702012-06-12 Filip Pizlo <fpizlo@apple.com>
1371
1372 REGRESSION(120121): inspector tests crash in DFG
1373 https://bugs.webkit.org/show_bug.cgi?id=88941
1374
1375 Reviewed by Geoffrey Garen.
1376
1377 The CFG simplifier has two different ways of fixing up GetLocal, Phantom, and Flush. If we've
1378 already fixed up the node one way, we shouldn't try the other way. The reason why we shouldn't
1379 is that the second way depends on the node referring to other nodes in the to-be-jettisoned
1380 block. After fixup they potentially will refer to nodes in the block being merged to.
1381
1382 * dfg/DFGCFGSimplificationPhase.cpp:
1383 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
1384 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
1385
leo.yang@torchmobile.com.cneac79cd2012-06-13 00:23:49 +000013862012-06-12 Leo Yang <leo.yang@torchmobile.com.cn>
1387
1388 Dynamic hash table in DOMObjectHashTableMap is wrong in multiple threads
1389 https://bugs.webkit.org/show_bug.cgi?id=87334
1390
1391 Reviewed by Geoffrey Garen.
1392
1393 Add a copy member function to JSC::HasTable. This function will copy all data
1394 members except for *table* which contains thread specific data that prevents
1395 up copying it. When you want to copy a JSC::HashTable that was constructed
1396 on another thread you should call JSC::HashTable::copy().
1397
1398 * runtime/Lookup.h:
1399 (JSC::HashTable::copy):
1400 (HashTable):
1401
fpizlo@apple.comdfd92802012-06-12 21:15:43 +000014022012-06-12 Filip Pizlo <fpizlo@apple.com>
1403
fpizlo@apple.com888325a2012-06-12 23:16:51 +00001404 DFG should not ASSERT if you have a double use of a variable that is not revealed to be a double
1405 until after CFG simplification
1406 https://bugs.webkit.org/show_bug.cgi?id=88927
1407 <rdar://problem/11513971>
1408
1409 Reviewed by Geoffrey Garen.
1410
1411 Speculation fixup needs to run if simplification did things, because simplification can change
1412 predictions - particularly if you had a control flow path that stored weird things into a
1413 variable, but that path got axed by the simplifier.
1414
1415 Running fixup in the fixpoint requires making it idempotent, which it previously wasn't. Only
1416 one place needed to be changed, namely the un-MustGenerate-ion of ValueToInt32.
1417
1418 * dfg/DFGDriver.cpp:
1419 (JSC::DFG::compile):
1420 * dfg/DFGFixupPhase.cpp:
1421 (JSC::DFG::FixupPhase::fixupNode):
1422
14232012-06-12 Filip Pizlo <fpizlo@apple.com>
1424
fpizlo@apple.comdfd92802012-06-12 21:15:43 +00001425 REGRESSION (r119779): Javascript TypeError: 'undefined' is not an object
1426 https://bugs.webkit.org/show_bug.cgi?id=88783
1427 <rdar://problem/11640299>
1428
1429 Reviewed by Geoffrey Garen.
1430
1431 If you don't keep alive the base of an object access over the various checks
1432 you do for the prototype chain, you're going to have a bad time.
1433
1434 * dfg/DFGByteCodeParser.cpp:
1435 (JSC::DFG::ByteCodeParser::handleGetById):
1436
commit-queue@webkit.orgce7e7ef2012-06-12 07:08:14 +000014372012-06-12 Hojong Han <hojong.han@samsung.com>
1438
1439 Property names of the built-in object cannot be retrieved
1440 after trying to delete one of its properties
1441 https://bugs.webkit.org/show_bug.cgi?id=86461
1442
1443 Reviewed by Gavin Barraclough.
1444
1445 * runtime/JSObject.cpp:
1446 (JSC::getClassPropertyNames):
1447 (JSC::JSObject::getOwnPropertyNames):
1448
gyuyoung.kim@samsung.com7a201592012-06-12 00:58:24 +000014492012-06-11 Gyuyoung Kim <gyuyoung.kim@samsung.com>
1450
1451 [CMAKE][EFL] Remove duplicated executable output path
1452 https://bugs.webkit.org/show_bug.cgi?id=88765
1453
1454 Reviewed by Daniel Bates.
1455
1456 CMake files for EFL port have redefined executable output path. However, EFL port doesn't
1457 need to define again because it is already defined in top-level CMake file.
1458
1459 * shell/CMakeLists.txt:
1460
carlosgc@webkit.orgf4fbe002012-06-11 15:31:19 +000014612012-06-11 Carlos Garcia Campos <cgarcia@igalia.com>
1462
1463 Unreviewed. Fix make distcheck issues.
1464
1465 * GNUmakefile.list.am: Remove non existent header file.
1466
paroga@webkit.org7a01e282012-06-10 12:25:57 +000014672012-06-10 Patrick Gansterer <paroga@webkit.org>
1468
paroga@webkit.orga601a8b2012-06-10 12:49:32 +00001469 Unreviewed. Build fix for !ENABLE(JIT) after r119844 and r119925.
1470
1471 * runtime/Executable.h:
1472 (ExecutableBase):
1473 (JSC::ExecutableBase::clearCodeVirtual):
1474
14752012-06-10 Patrick Gansterer <paroga@webkit.org>
1476
paroga@webkit.org7a01e282012-06-10 12:25:57 +00001477 Unreviewed. Build fix for !ENABLE(JIT) after r119844.
1478
1479 * runtime/Executable.h:
1480 (ExecutableBase):
1481 (JSC):
1482
dominicc@chromium.org2a95e332012-06-10 06:31:14 +000014832012-06-09 Dominic Cooney <dominicc@chromium.org>
1484
1485 [Chromium] Remove JavaScriptCore dependencies from gyp
1486 https://bugs.webkit.org/show_bug.cgi?id=88510
1487
1488 Reviewed by Adam Barth.
1489
1490 Chromium doesn't support JSC any more and there doesn't seem to be
1491 a strong interest in using GYP as the common build system in other
1492 ports.
1493
1494 * JavaScriptCore.gyp/JavaScriptCore.gyp: WebCore still depends on YARR interpreter.
1495 * JavaScriptCore.gypi: Only include YARR source.
1496 * gyp/JavaScriptCore.gyp: Removed.
1497 * gyp/gtk.gyp: Removed.
1498
ggaren@apple.com642da3e2012-06-09 17:34:30 +000014992012-06-09 Geoffrey Garen <ggaren@apple.com>
1500
1501 Unreviewed, rolling back in part2 of r118646.
1502
1503 This patch removes eager finalization.
1504
1505 Weak pointer finalization should be lazy
1506 https://bugs.webkit.org/show_bug.cgi?id=87599
1507
1508 Reviewed by Sam Weinig.
1509
1510 * heap/Heap.cpp:
1511 (JSC::Heap::collect): Don't finalize eagerly -- we'll do it lazily.
1512
1513 * heap/MarkedBlock.cpp:
1514 (JSC::MarkedBlock::sweep): Do sweep weak sets when sweeping a block,
1515 since we won't get another chance.
1516
1517 * heap/MarkedBlock.h:
1518 (JSC::MarkedBlock::sweepWeakSet):
1519 * heap/MarkedSpace.cpp:
1520 (MarkedSpace::WeakSetSweep):
1521 * heap/MarkedSpace.h:
1522 (JSC::MarkedSpace::sweepWeakSets): Removed now-unused code.
1523
commit-queue@webkit.org5deb7492012-06-09 09:05:22 +000015242012-06-09 Sukolsak Sakshuwong <sukolsak@google.com>
1525
1526 Add UNDO_MANAGER flag
1527 https://bugs.webkit.org/show_bug.cgi?id=87908
1528
1529 Reviewed by Tony Chang.
1530
1531 * Configurations/FeatureDefines.xcconfig:
1532
ggaren@apple.com642da3e2012-06-09 17:34:30 +000015332012-06-08 Geoffrey Garen <ggaren@apple.com>
ggaren@apple.com218a16a2012-06-08 23:57:58 +00001534
1535 Unreviewed, rolling back in part1 of r118646.
1536
1537 This patch includes everything necessary for lazy finalization, but
1538 keeps eager finalization enabled for the time being.
1539
1540 Weak pointer finalization should be lazy
1541 https://bugs.webkit.org/show_bug.cgi?id=87599
1542
1543 Reviewed by Sam Weinig.
1544
1545 * heap/MarkedBlock.cpp:
1546 * heap/MarkedBlock.h:
1547 (JSC::MarkedBlock::resetAllocator):
1548 * heap/MarkedSpace.cpp:
1549 (JSC::MarkedSpace::resetAllocators):
1550 * heap/MarkedSpace.h:
1551 (JSC::MarkedSpace::resetAllocators): Don't force allocator reset anymore.
1552 It will happen automatically when a weak set is swept. It's simpler to
1553 have only one canonical way for this to happen, and it wasn't buying
1554 us anything to do it eagerly.
1555 * heap/WeakBlock.cpp:
1556 (JSC::WeakBlock::sweep): Don't short-circuit a sweep unless we know
1557 the sweep would be a no-op. If even one finalizer is pending, we need to
1558 run it, since we won't get another chance.
1559 * heap/WeakSet.cpp:
1560 (JSC::WeakSet::sweep): This loop can be simpler now that
1561 WeakBlock::sweep() does what we mean.
1562 Reset our allocator after a sweep because this is the optimal time to
1563 start trying to recycle old weak pointers.
1564 (JSC::WeakSet::tryFindAllocator): Don't sweep when searching for an
1565 allocator because we've swept already, and forcing a new sweep would be
1566 wasteful.
1567 * heap/WeakSet.h:
1568 (JSC::WeakSet::shrink): Be sure to reset our allocator after a shrink
1569 because the shrink may have removed the block the allocator was going to
1570 allocate out of.
1571
barraclough@apple.com9dd771c2012-06-08 21:30:35 +000015722012-06-08 Gavin Barraclough <barraclough@apple.com>
1573
1574 Unreviewed roll out r119795.
1575
1576 This broke jquery/core.html
1577
1578 * dfg/DFGSpeculativeJIT.h:
1579 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
1580 * jit/JITInlineMethods.h:
1581 (JSC::JIT::emitAllocateBasicJSObject):
1582 * llint/LowLevelInterpreter.asm:
1583 * runtime/JSGlobalData.h:
1584 (JSGlobalData):
1585 * runtime/JSGlobalThis.cpp:
1586 (JSC::JSGlobalThis::setUnwrappedObject):
1587 * runtime/JSObject.cpp:
1588 (JSC::JSObject::visitChildren):
1589 (JSC::JSObject::createInheritorID):
1590 * runtime/JSObject.h:
1591 (JSObject):
1592 (JSC::JSObject::resetInheritorID):
1593 (JSC):
1594 (JSC::JSObject::offsetOfInheritorID):
1595 (JSC::JSObject::inheritorID):
1596
fpizlo@apple.com0bcbc112012-06-08 20:02:57 +000015972012-06-08 Filip Pizlo <fpizlo@apple.com>
1598
1599 PredictedType should be called SpeculatedType
1600 https://bugs.webkit.org/show_bug.cgi?id=88477
1601
1602 Unreviewed, fix a renaming goof from http://trac.webkit.org/changeset/119660.
1603 I accidentally renamed ByteCodeParser::getPrediction to
1604 ByteCodeParser::getSpeculation. That was not the intent. This changes it
1605 back.
1606
1607 * dfg/DFGByteCodeParser.cpp:
1608 (JSC::DFG::ByteCodeParser::addCall):
1609 (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
1610 (JSC::DFG::ByteCodeParser::getPrediction):
1611 (JSC::DFG::ByteCodeParser::handleCall):
1612 (JSC::DFG::ByteCodeParser::parseBlock):
1613
wingo@igalia.com332e9bf2012-06-08 19:57:40 +000016142012-06-08 Andy Wingo <wingo@igalia.com>
1615
1616 Explictly mark stubs called by JIT as being internal
1617 https://bugs.webkit.org/show_bug.cgi?id=88552
1618
1619 Reviewed by Filip Pizlo.
1620
1621 * dfg/DFGOSRExitCompiler.h:
1622 * dfg/DFGOperations.cpp:
1623 * dfg/DFGOperations.h:
1624 * jit/HostCallReturnValue.h:
1625 * jit/JITStubs.cpp:
1626 * jit/JITStubs.h:
1627 * jit/ThunkGenerators.cpp:
1628 * llint/LLIntSlowPaths.h: Mark a bunch of stubs as being
1629 WTF_INTERNAL. Change most calls to SYMBOL_STRING_RELOCATION to
1630 LOCAL_REFERENCE, or GLOBAL_REFERENCE in the case of the wrappers
1631 to truly global symbols.
1632 * offlineasm/asm.rb: Generate LOCAL_REFERENCE instead of
1633 SYMBOL_STRING_RELOCATION.
1634
fpizlo@apple.comf4a2ac32012-06-08 20:04:47 +000016352012-06-08 Geoffrey Garen <ggaren@apple.com>
1636
ggaren@apple.comd7147572012-06-08 18:17:16 +00001637 Don't rely on weak pointers for eager CodeBlock finalization
1638 https://bugs.webkit.org/show_bug.cgi?id=88465
1639
1640 Reviewed by Gavin Barraclough.
1641
1642 This is incompatible with lazy weak pointer finalization.
1643
1644 I considered just making CodeBlock finalization lazy-friendly, but it
1645 turns out that the heap is already way up in CodeBlock's business when
1646 it comes to finalization, so I decided to finish the job and move full
1647 responsibility for CodeBlock finalization into the heap.
1648
1649 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Maybe this
1650 will build.
1651
1652 * debugger/Debugger.cpp: Updated for rename.
1653
1654 * heap/Heap.cpp:
1655 (JSC::Heap::deleteAllCompiledCode): Renamed for consistency. Fixed a bug
1656 where we would not delete code for a code block that had been previously
1657 jettisoned. I don't know if this happens in practice -- I mostly did
1658 this to improve consistency with deleteUnmarkedCompiledCode.
1659
1660 (JSC::Heap::deleteUnmarkedCompiledCode): New function, responsible for
1661 eager finalization of unmarked code blocks.
1662
1663 (JSC::Heap::collect): Updated for rename. Updated to call
1664 deleteUnmarkedCompiledCode(), which takes care of jettisoned DFG code
1665 blocks too.
1666
1667 (JSC::Heap::addCompiledCode): Renamed, since this points to all code
1668 now, not just functions.
1669
1670 * heap/Heap.h:
1671 (Heap): Keep track of all user code, not just functions. This is a
1672 negligible additional overhead, since most code is function code.
1673
1674 * runtime/Executable.cpp:
1675 (JSC::*::finalize): Removed these functions, since we don't rely on
1676 weak pointer finalization anymore.
1677
1678 (JSC::FunctionExecutable::FunctionExecutable): Moved linked-list stuff
1679 into base class so all executables can be in the list.
1680
1681 (JSC::EvalExecutable::clearCode):
1682 (JSC::ProgramExecutable::clearCode):
1683 (JSC::FunctionExecutable::clearCode): All we need to do is delete our
1684 CodeBlock -- that will delete all of its internal data structures.
1685
1686 (JSC::FunctionExecutable::clearCodeIfNotCompiling): Factored out a helper
1687 function to improve clarity.
1688
1689 * runtime/Executable.h:
1690 (JSC::ExecutableBase): Moved linked-list stuff
1691 into base class so all executables can be in the list.
1692
1693 (JSC::NativeExecutable::create):
1694 (NativeExecutable):
1695 (ScriptExecutable):
1696 (JSC::ScriptExecutable::finishCreation):
1697 (JSC::EvalExecutable::create):
1698 (EvalExecutable):
1699 (JSC::ProgramExecutable::create):
1700 (ProgramExecutable):
1701 (FunctionExecutable):
1702 (JSC::FunctionExecutable::create): Don't use a finalizer -- the heap
1703 will call us back to destroy our code block.
1704
1705 (JSC::FunctionExecutable::discardCode): Renamed to clearCodeIfNotCompiling()
1706 for clarity.
1707
1708 (JSC::FunctionExecutable::isCompiling): New helper function, for clarity.
1709
1710 (JSC::ScriptExecutable::clearCodeVirtual): New helper function, since
1711 the heap needs to make polymorphic calls to clear code.
1712
1713 * runtime/JSGlobalData.cpp:
1714 (JSC::StackPreservingRecompiler::operator()):
1715 * runtime/JSGlobalObject.cpp:
1716 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Updated for
1717 renames.
1718
fpizlo@apple.comfd598b92012-06-08 01:31:21 +000017192012-06-07 Filip Pizlo <fpizlo@apple.com>
1720
1721 DFG should inline prototype chain accesses, and do the right things if the
1722 specific function optimization is available
1723 https://bugs.webkit.org/show_bug.cgi?id=88594
1724
1725 Reviewed by Gavin Barraclough.
1726
1727 Looks like a 3% win on V8.
1728
1729 * bytecode/CodeBlock.h:
1730 (JSC::Structure::prototypeForLookup):
1731 (JSC):
1732 * bytecode/GetByIdStatus.cpp:
1733 (JSC::GetByIdStatus::computeFromLLInt):
1734 (JSC):
1735 (JSC::GetByIdStatus::computeForChain):
1736 (JSC::GetByIdStatus::computeFor):
1737 * bytecode/GetByIdStatus.h:
1738 (JSC::GetByIdStatus::GetByIdStatus):
1739 (JSC::GetByIdStatus::isSimple):
1740 (JSC::GetByIdStatus::chain):
1741 (JSC::GetByIdStatus::specificValue):
1742 (GetByIdStatus):
1743 * bytecode/StructureSet.h:
1744 (StructureSet):
1745 (JSC::StructureSet::singletonStructure):
1746 * bytecode/StructureStubInfo.h:
1747 (JSC::StructureStubInfo::initGetByIdProto):
1748 (JSC::StructureStubInfo::initGetByIdChain):
1749 * dfg/DFGByteCodeParser.cpp:
1750 (JSC::DFG::ByteCodeParser::handleGetById):
1751 * dfg/DFGRepatch.cpp:
1752 (JSC::DFG::tryCacheGetByID):
1753 * jit/JITStubs.cpp:
1754 (JSC::JITThunks::tryCacheGetByID):
1755 * runtime/JSGlobalObject.h:
1756 (JSC::Structure::prototypeForLookup):
1757 (JSC):
1758 * runtime/Structure.h:
1759 (Structure):
1760
barraclough@apple.com48386932012-06-08 00:29:27 +000017612012-06-07 Gavin Barraclough <barraclough@apple.com>
1762
barraclough@apple.com64b74e02012-06-08 04:25:58 +00001763 Remove JSObject::m_inheritorID
1764 https://bugs.webkit.org/show_bug.cgi?id=88378
1765
1766 Reviewed by Geoff Garen.
1767
1768 This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
1769 and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
1770 Instead use a private named value in the object's property storage.
1771
1772 * dfg/DFGSpeculativeJIT.h:
1773 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
1774 - No need m_inheritorID to initialize!
1775 * jit/JITInlineMethods.h:
1776 (JSC::JIT::emitAllocateBasicJSObject):
1777 - No need m_inheritorID to initialize!
1778 * llint/LowLevelInterpreter.asm:
1779 - No need m_inheritorID to initialize!
1780 * runtime/JSGlobalData.h:
1781 (JSGlobalData):
1782 - Added private name 'm_inheritorIDKey'.
1783 * runtime/JSGlobalThis.cpp:
1784 (JSC::JSGlobalThis::setUnwrappedObject):
1785 - resetInheritorID is now passed a JSGlobalData&.
1786 * runtime/JSObject.cpp:
1787 (JSC::JSObject::visitChildren):
1788 - No m_inheritorID to be marked.
1789 (JSC::JSObject::createInheritorID):
1790 - Store the newly created inheritorID in the property map.
1791 * runtime/JSObject.h:
1792 (JSC::JSObject::resetInheritorID):
1793 - Remove the inheritorID from property storage.
1794 (JSC::JSObject::inheritorID):
1795 - Read the inheritorID from property storage.
1796
17972012-06-07 Gavin Barraclough <barraclough@apple.com>
1798
barraclough@apple.com48386932012-06-08 00:29:27 +00001799 Math.pow on iOS does not support denormal numbers.
1800 https://bugs.webkit.org/show_bug.cgi?id=88592
1801
1802 Reviewed by Filip Pizlo.
1803
1804 Import an implementation from fdlibm, detect cases where it is safe to use the system
1805 implementation & where we should fall back to fdlibm.
1806
1807 * runtime/MathObject.cpp:
1808 (JSC::isDenormal):
1809 (JSC::isEdgeCase):
1810 (JSC::mathPow):
1811 - On iOS, detect cases where denormal support may be required & use fdlibm in these cases.
1812 (JSC::mathProtoFuncPow):
1813 - Changed to use mathPow.
1814 (JSC::fdlibmScalbn):
1815 (JSC::fdlibmPow):
1816 - These functions imported from fdlibm; original style retained to ease future merging.
1817
paroga@webkit.orga334f732012-06-07 23:24:14 +000018182012-06-07 Patrick Gansterer <paroga@webkit.org>
1819
1820 Unreviewed. Build fix for !ENABLE(JIT) after r119441.
1821
1822 * interpreter/Interpreter.cpp:
1823 (JSC::Interpreter::privateExecute):
1824
wingo@igalia.comb8305a82012-06-07 16:05:19 +000018252012-06-07 Andy Wingo <wingo@igalia.com>
1826
1827 Unreviewed build fix after r119593.
1828
1829 * llint/LLIntOfflineAsmConfig.h (OFFLINE_ASM_GLOBAL_LABEL): Fix
1830 uses of "name" to be "label", the macro's parameter. Otherwise we
1831 serialize mentions of the literal symbol "name" into the objcode.
1832 Causes a build error using GNU ld (not gold).
1833
rniwa@webkit.org475cf8d2012-06-07 02:47:14 +000018342012-06-06 Ryosuke Niwa <rniwa@webkit.org>
1835
1836 Chromium build fix attempt. Why do we need to list these files in gyp!?
1837
1838 * JavaScriptCore.gypi:
1839
fpizlo@apple.comd5547492012-06-07 00:23:36 +000018402012-06-06 Filip Pizlo <fpizlo@apple.com>
1841
fpizlo@apple.com62336162012-06-07 01:35:59 +00001842 PredictedType should be called SpeculatedType
1843 https://bugs.webkit.org/show_bug.cgi?id=88477
1844
1845 Rubber stamped by Gavin Barraclough.
1846
1847 * CMakeLists.txt:
1848 * GNUmakefile.list.am:
1849 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1850 * JavaScriptCore.xcodeproj/project.pbxproj:
1851 * Target.pri:
1852 * bytecode/CodeBlock.cpp:
1853 (JSC::CodeBlock::shouldOptimizeNow):
1854 (JSC::CodeBlock::dumpValueProfiles):
1855 * bytecode/CodeBlock.h:
1856 (JSC::CodeBlock::valueProfilePredictionForBytecodeOffset):
1857 * bytecode/LazyOperandValueProfile.cpp:
1858 (JSC::LazyOperandValueProfileParser::prediction):
1859 * bytecode/LazyOperandValueProfile.h:
1860 (LazyOperandValueProfileParser):
1861 * bytecode/PredictedType.cpp: Removed.
1862 * bytecode/PredictedType.h: Removed.
1863 * bytecode/SpeculatedType.cpp: Copied from Source/JavaScriptCore/bytecode/PredictedType.cpp.
1864 (JSC::speculationToString):
1865 (JSC::speculationToAbbreviatedString):
1866 (JSC::speculationFromClassInfo):
1867 (JSC::speculationFromStructure):
1868 (JSC::speculationFromCell):
1869 (JSC::speculationFromValue):
1870 * bytecode/SpeculatedType.h: Copied from Source/JavaScriptCore/bytecode/PredictedType.h.
1871 (JSC):
1872 (JSC::isAnySpeculation):
1873 (JSC::isCellSpeculation):
1874 (JSC::isObjectSpeculation):
1875 (JSC::isFinalObjectSpeculation):
1876 (JSC::isFinalObjectOrOtherSpeculation):
1877 (JSC::isFixedIndexedStorageObjectSpeculation):
1878 (JSC::isStringSpeculation):
1879 (JSC::isArraySpeculation):
1880 (JSC::isFunctionSpeculation):
1881 (JSC::isInt8ArraySpeculation):
1882 (JSC::isInt16ArraySpeculation):
1883 (JSC::isInt32ArraySpeculation):
1884 (JSC::isUint8ArraySpeculation):
1885 (JSC::isUint8ClampedArraySpeculation):
1886 (JSC::isUint16ArraySpeculation):
1887 (JSC::isUint32ArraySpeculation):
1888 (JSC::isFloat32ArraySpeculation):
1889 (JSC::isFloat64ArraySpeculation):
1890 (JSC::isArgumentsSpeculation):
1891 (JSC::isActionableIntMutableArraySpeculation):
1892 (JSC::isActionableFloatMutableArraySpeculation):
1893 (JSC::isActionableTypedMutableArraySpeculation):
1894 (JSC::isActionableMutableArraySpeculation):
1895 (JSC::isActionableArraySpeculation):
1896 (JSC::isArrayOrOtherSpeculation):
1897 (JSC::isMyArgumentsSpeculation):
1898 (JSC::isInt32Speculation):
1899 (JSC::isDoubleRealSpeculation):
1900 (JSC::isDoubleSpeculation):
1901 (JSC::isNumberSpeculation):
1902 (JSC::isBooleanSpeculation):
1903 (JSC::isOtherSpeculation):
1904 (JSC::isEmptySpeculation):
1905 (JSC::mergeSpeculations):
1906 (JSC::mergeSpeculation):
1907 * bytecode/StructureSet.h:
1908 (JSC::StructureSet::speculationFromStructures):
1909 * bytecode/ValueProfile.h:
1910 (JSC::ValueProfileBase::ValueProfileBase):
1911 (JSC::ValueProfileBase::dump):
1912 (JSC::ValueProfileBase::computeUpdatedPrediction):
1913 (ValueProfileBase):
1914 * dfg/DFGAbstractState.cpp:
1915 (JSC::DFG::AbstractState::initialize):
1916 (JSC::DFG::AbstractState::execute):
1917 (JSC::DFG::AbstractState::mergeStateAtTail):
1918 * dfg/DFGAbstractState.h:
1919 (JSC::DFG::AbstractState::speculateInt32Unary):
1920 (JSC::DFG::AbstractState::speculateNumberUnary):
1921 (JSC::DFG::AbstractState::speculateBooleanUnary):
1922 (JSC::DFG::AbstractState::speculateInt32Binary):
1923 (JSC::DFG::AbstractState::speculateNumberBinary):
1924 * dfg/DFGAbstractValue.h:
1925 (JSC::DFG::StructureAbstractValue::filter):
1926 (JSC::DFG::StructureAbstractValue::speculationFromStructures):
1927 (JSC::DFG::AbstractValue::AbstractValue):
1928 (JSC::DFG::AbstractValue::clear):
1929 (JSC::DFG::AbstractValue::isClear):
1930 (JSC::DFG::AbstractValue::makeTop):
1931 (JSC::DFG::AbstractValue::clobberStructures):
1932 (JSC::DFG::AbstractValue::isTop):
1933 (JSC::DFG::AbstractValue::set):
1934 (JSC::DFG::AbstractValue::merge):
1935 (JSC::DFG::AbstractValue::filter):
1936 (JSC::DFG::AbstractValue::validateIgnoringValue):
1937 (JSC::DFG::AbstractValue::validate):
1938 (JSC::DFG::AbstractValue::checkConsistency):
1939 (JSC::DFG::AbstractValue::dump):
1940 (AbstractValue):
1941 * dfg/DFGArgumentPosition.h:
1942 (JSC::DFG::ArgumentPosition::ArgumentPosition):
1943 (JSC::DFG::ArgumentPosition::mergeArgumentAwareness):
1944 (JSC::DFG::ArgumentPosition::prediction):
1945 (ArgumentPosition):
1946 * dfg/DFGArgumentsSimplificationPhase.cpp:
1947 (JSC::DFG::ArgumentsSimplificationPhase::run):
1948 * dfg/DFGByteCodeParser.cpp:
1949 (ByteCodeParser):
1950 (JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation):
1951 (JSC::DFG::ByteCodeParser::getLocal):
1952 (JSC::DFG::ByteCodeParser::getArgument):
1953 (JSC::DFG::ByteCodeParser::addCall):
1954 (JSC::DFG::ByteCodeParser::getSpeculationWithoutOSRExit):
1955 (JSC::DFG::ByteCodeParser::getSpeculation):
1956 (InlineStackEntry):
1957 (JSC::DFG::ByteCodeParser::handleCall):
1958 (JSC::DFG::ByteCodeParser::handleIntrinsic):
1959 (JSC::DFG::ByteCodeParser::handleGetById):
1960 (JSC::DFG::ByteCodeParser::parseBlock):
1961 (JSC::DFG::ByteCodeParser::fixVariableAccessSpeculations):
1962 (JSC::DFG::ByteCodeParser::parse):
1963 * dfg/DFGCSEPhase.cpp:
1964 (JSC::DFG::CSEPhase::getIndexedPropertyStorageLoadElimination):
1965 (JSC::DFG::CSEPhase::performNodeCSE):
1966 * dfg/DFGConstantFoldingPhase.cpp:
1967 (JSC::DFG::ConstantFoldingPhase::run):
1968 * dfg/DFGFixupPhase.cpp:
1969 (JSC::DFG::FixupPhase::fixupNode):
1970 (JSC::DFG::FixupPhase::fixDoubleEdge):
1971 * dfg/DFGGraph.cpp:
1972 (JSC::DFG::Graph::nameOfVariableAccessData):
1973 (JSC::DFG::Graph::dump):
1974 (JSC::DFG::Graph::predictArgumentTypes):
1975 * dfg/DFGGraph.h:
1976 (JSC::DFG::Graph::getJSConstantSpeculation):
1977 (JSC::DFG::Graph::isPredictedNumerical):
1978 (JSC::DFG::Graph::byValIsPure):
1979 * dfg/DFGJITCompiler.h:
1980 (JSC::DFG::JITCompiler::getSpeculation):
1981 * dfg/DFGNode.h:
1982 (JSC::DFG::Node::Node):
1983 (JSC::DFG::Node::getHeapPrediction):
1984 (JSC::DFG::Node::predictHeap):
1985 (JSC::DFG::Node::prediction):
1986 (JSC::DFG::Node::predict):
1987 (JSC::DFG::Node::shouldSpeculateInteger):
1988 (JSC::DFG::Node::shouldSpeculateDouble):
1989 (JSC::DFG::Node::shouldSpeculateNumber):
1990 (JSC::DFG::Node::shouldSpeculateBoolean):
1991 (JSC::DFG::Node::shouldSpeculateFinalObject):
1992 (JSC::DFG::Node::shouldSpeculateFinalObjectOrOther):
1993 (JSC::DFG::Node::shouldSpeculateArray):
1994 (JSC::DFG::Node::shouldSpeculateArguments):
1995 (JSC::DFG::Node::shouldSpeculateInt8Array):
1996 (JSC::DFG::Node::shouldSpeculateInt16Array):
1997 (JSC::DFG::Node::shouldSpeculateInt32Array):
1998 (JSC::DFG::Node::shouldSpeculateUint8Array):
1999 (JSC::DFG::Node::shouldSpeculateUint8ClampedArray):
2000 (JSC::DFG::Node::shouldSpeculateUint16Array):
2001 (JSC::DFG::Node::shouldSpeculateUint32Array):
2002 (JSC::DFG::Node::shouldSpeculateFloat32Array):
2003 (JSC::DFG::Node::shouldSpeculateFloat64Array):
2004 (JSC::DFG::Node::shouldSpeculateArrayOrOther):
2005 (JSC::DFG::Node::shouldSpeculateObject):
2006 (JSC::DFG::Node::shouldSpeculateCell):
2007 (Node):
2008 * dfg/DFGPredictionPropagationPhase.cpp:
2009 (JSC::DFG::PredictionPropagationPhase::setPrediction):
2010 (JSC::DFG::PredictionPropagationPhase::mergePrediction):
2011 (JSC::DFG::PredictionPropagationPhase::propagate):
2012 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):
2013 * dfg/DFGSpeculativeJIT.cpp:
2014 (JSC::DFG::SpeculativeJIT::fillStorage):
2015 (JSC::DFG::SpeculativeJIT::writeBarrier):
2016 (JSC::DFG::GPRTemporary::GPRTemporary):
2017 (JSC::DFG::FPRTemporary::FPRTemporary):
2018 (JSC::DFG::SpeculativeJIT::compilePeepHoleDoubleBranch):
2019 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectEquality):
2020 (JSC::DFG::SpeculativeJIT::compilePeepHoleBranch):
2021 (JSC::DFG::SpeculativeJIT::compile):
2022 (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
2023 (JSC::DFG::SpeculativeJIT::compileGetCharCodeAt):
2024 (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
2025 (JSC::DFG::SpeculativeJIT::compileValueToInt32):
2026 (JSC::DFG::SpeculativeJIT::compileDoubleAsInt32):
2027 (JSC::DFG::SpeculativeJIT::compileInt32ToDouble):
2028 (JSC::DFG::SpeculativeJIT::compileGetTypedArrayLength):
2029 (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
2030 (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
2031 (JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
2032 (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
2033 (JSC::DFG::SpeculativeJIT::compileInstanceOf):
2034 (JSC::DFG::SpeculativeJIT::compileAdd):
2035 (JSC::DFG::SpeculativeJIT::compileArithSub):
2036 (JSC::DFG::SpeculativeJIT::compileArithNegate):
2037 (JSC::DFG::SpeculativeJIT::compileArithMul):
2038 (JSC::DFG::SpeculativeJIT::compileArithMod):
2039 (JSC::DFG::SpeculativeJIT::compare):
2040 (JSC::DFG::SpeculativeJIT::compileStrictEq):
2041 (JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage):
2042 (JSC::DFG::SpeculativeJIT::compileGetByValOnArguments):
2043 (JSC::DFG::SpeculativeJIT::compileGetArgumentsLength):
2044 (JSC::DFG::SpeculativeJIT::compileRegExpExec):
2045 * dfg/DFGSpeculativeJIT.h:
2046 (DFG):
2047 (JSC::DFG::ValueSource::forSpeculation):
2048 (SpeculativeJIT):
2049 (GPRTemporary):
2050 (FPRTemporary):
2051 (JSC::DFG::SpecDoubleOperand::SpecDoubleOperand):
2052 (JSC::DFG::SpecDoubleOperand::~SpecDoubleOperand):
2053 (JSC::DFG::SpecDoubleOperand::fpr):
2054 (JSC::DFG::SpecCellOperand::SpecCellOperand):
2055 (JSC::DFG::SpecCellOperand::~SpecCellOperand):
2056 (JSC::DFG::SpecCellOperand::gpr):
2057 (JSC::DFG::SpecBooleanOperand::SpecBooleanOperand):
2058 (JSC::DFG::SpecBooleanOperand::~SpecBooleanOperand):
2059 (JSC::DFG::SpecBooleanOperand::gpr):
2060 * dfg/DFGSpeculativeJIT32_64.cpp:
2061 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
2062 (JSC::DFG::SpeculativeJIT::fillSpecDouble):
2063 (JSC::DFG::SpeculativeJIT::fillSpecCell):
2064 (JSC::DFG::SpeculativeJIT::fillSpecBoolean):
2065 (JSC::DFG::SpeculativeJIT::compileObjectEquality):
2066 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
2067 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
2068 (JSC::DFG::SpeculativeJIT::compileDoubleCompare):
2069 (JSC::DFG::SpeculativeJIT::compileLogicalNot):
2070 (JSC::DFG::SpeculativeJIT::emitBranch):
2071 (JSC::DFG::SpeculativeJIT::compile):
2072 * dfg/DFGSpeculativeJIT64.cpp:
2073 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
2074 (JSC::DFG::SpeculativeJIT::fillSpecDouble):
2075 (JSC::DFG::SpeculativeJIT::fillSpecCell):
2076 (JSC::DFG::SpeculativeJIT::fillSpecBoolean):
2077 (JSC::DFG::SpeculativeJIT::compileObjectEquality):
2078 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
2079 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
2080 (JSC::DFG::SpeculativeJIT::compileDoubleCompare):
2081 (JSC::DFG::SpeculativeJIT::compileLogicalNot):
2082 (JSC::DFG::SpeculativeJIT::emitBranch):
2083 (JSC::DFG::SpeculativeJIT::compile):
2084 * dfg/DFGVariableAccessData.h:
2085 (JSC::DFG::VariableAccessData::VariableAccessData):
2086 (JSC::DFG::VariableAccessData::predict):
2087 (JSC::DFG::VariableAccessData::nonUnifiedPrediction):
2088 (JSC::DFG::VariableAccessData::prediction):
2089 (JSC::DFG::VariableAccessData::argumentAwarePrediction):
2090 (JSC::DFG::VariableAccessData::mergeArgumentAwarePrediction):
2091 (JSC::DFG::VariableAccessData::shouldUseDoubleFormatAccordingToVote):
2092 (JSC::DFG::VariableAccessData::makePredictionForDoubleFormat):
2093 (VariableAccessData):
2094
20952012-06-06 Filip Pizlo <fpizlo@apple.com>
2096
fpizlo@apple.com26af9b62012-06-07 00:49:34 +00002097 Global object variable accesses should not require an extra load
2098 https://bugs.webkit.org/show_bug.cgi?id=88385
2099
2100 Reviewed by Gavin Barraclough and Geoffrey Garen.
2101
2102 Previously, if you wanted to access a global variable, you'd first have
2103 to load the register array from the appropriate global object and then
2104 either load or store at an offset to the register array. This is because
2105 JSGlobalObject inherited from JSVariableObject, and JSVariableObject is
2106 designed with the pessimistic assumption that its register array may
2107 point into the call stack. This is never the case for global objects.
2108 Hence, even though the global object may add more registers at any time,
2109 it does not need to store them in a contiguous array. It can use a
2110 SegmentedVector or similar.
2111
2112 This patch refactors global objects and variable objects as follows:
2113
2114 - The functionality to track variables in an indexable array using a
2115 SymbolTable to map names to indices is moved into JSSymbolTableObject,
2116 which is now a supertype of JSVariableObject. JSVariableObject is now
2117 just a holder for a registers array and implements the registerAt()
2118 method that is left abstract in JSSymbolTableObject. Because all users
2119 of JSVariableObject know whether they are a JSStaticScopeObject,
2120 JSActivation, or JSGlobalObject, this "abstract" method is not virtual;
2121 instead the utility methods that would call registerAt() are now
2122 template functions that require you to know statically what subtype of
2123 JSSymbolTableObject you're using (JSVariableObject or something else),
2124 so that registerAt() can be statically bound.
2125
2126 - A new class is added called JSSegmentedVariableObject, which only
2127 differs from JSVariableObject in how it allocates registers. It uses a
2128 SegmentedVector instead of manually managing a pointer to a contiguous
2129 slab of registers. This changes the interface somewhat; for example
2130 with JSVariableObject if you wanted to add a register you had to do
2131 it yourself since the JSVariableObject didn't know how the registers
2132 array ought to be allocated. With JSSegmentedVariableObject you can
2133 just call addRegisters(). JSSegmentedVariableObject preserves the
2134 invariant that once you get a pointer into a register, that pointer
2135 will continue to be valid so long as the JSSegmentedVariableObject is
2136 alive. This allows the JITs and interpreters to skip the extra load.
2137
2138 - JSGlobalObject now inherits from JSSegmentedVariableObject. For now
2139 (and possibly forever) it is the only subtype of this new class.
2140
2141 - The bytecode format is changed so that get_global_var and
2142 put_global_var have a pointer to the register directly rather than
2143 having an index. A convenience method is provided in
2144 JSSegmentedVariableObject to get the index given a a pointer, which is
2145 used for assertions and debug dumps.
2146
2147 This appears to be a 1% across the board win.
2148
2149 * CMakeLists.txt:
2150 * GNUmakefile.list.am:
2151 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2152 * JavaScriptCore.xcodeproj/project.pbxproj:
2153 * Target.pri:
2154 * bytecode/CodeBlock.cpp:
2155 (JSC::CodeBlock::dump):
2156 * bytecode/Instruction.h:
2157 (Instruction):
2158 (JSC::Instruction::Instruction):
2159 * bytecompiler/BytecodeGenerator.cpp:
2160 (JSC::ResolveResult::registerPointer):
2161 (JSC):
2162 (JSC::BytecodeGenerator::BytecodeGenerator):
2163 (JSC::BytecodeGenerator::retrieveLastUnaryOp):
2164 (JSC::BytecodeGenerator::resolve):
2165 (JSC::BytecodeGenerator::resolveConstDecl):
2166 (JSC::BytecodeGenerator::emitGetStaticVar):
2167 (JSC::BytecodeGenerator::emitPutStaticVar):
2168 * bytecompiler/BytecodeGenerator.h:
2169 (ResolveResult):
2170 (BytecodeGenerator):
2171 * dfg/DFGAssemblyHelpers.h:
2172 (AssemblyHelpers):
2173 * dfg/DFGByteCodeParser.cpp:
2174 (JSC::DFG::ByteCodeParser::parseBlock):
2175 * dfg/DFGCSEPhase.cpp:
2176 (JSC::DFG::CSEPhase::globalVarLoadElimination):
2177 (JSC::DFG::CSEPhase::globalVarStoreElimination):
2178 (JSC::DFG::CSEPhase::performNodeCSE):
2179 * dfg/DFGGraph.cpp:
2180 (JSC::DFG::Graph::dump):
2181 * dfg/DFGGraph.h:
2182 (JSC::DFG::Graph::globalObjectFor):
2183 (Graph):
2184 * dfg/DFGNode.h:
2185 (JSC::DFG::Node::hasVarNumber):
2186 (Node):
2187 (JSC::DFG::Node::hasRegisterPointer):
2188 (JSC::DFG::Node::registerPointer):
2189 * dfg/DFGSpeculativeJIT32_64.cpp:
2190 (JSC::DFG::SpeculativeJIT::compile):
2191 * dfg/DFGSpeculativeJIT64.cpp:
2192 (JSC::DFG::SpeculativeJIT::compile):
2193 * heap/Heap.h:
2194 (Heap):
2195 (JSC::Heap::isWriteBarrierEnabled):
2196 (JSC):
2197 * interpreter/Interpreter.cpp:
2198 (JSC::Interpreter::execute):
2199 (JSC::Interpreter::privateExecute):
2200 * jit/JITPropertyAccess.cpp:
2201 (JSC::JIT::emit_op_get_global_var):
2202 (JSC::JIT::emit_op_put_global_var):
2203 * jit/JITPropertyAccess32_64.cpp:
2204 (JSC::JIT::emit_op_get_global_var):
2205 (JSC::JIT::emit_op_put_global_var):
2206 * llint/LowLevelInterpreter32_64.asm:
2207 * llint/LowLevelInterpreter64.asm:
2208 * runtime/JSGlobalObject.cpp:
2209 (JSC):
2210 (JSC::JSGlobalObject::put):
2211 (JSC::JSGlobalObject::putDirectVirtual):
2212 (JSC::JSGlobalObject::defineOwnProperty):
2213 (JSC::JSGlobalObject::visitChildren):
2214 (JSC::JSGlobalObject::addStaticGlobals):
2215 (JSC::JSGlobalObject::getOwnPropertySlot):
2216 (JSC::JSGlobalObject::getOwnPropertyDescriptor):
2217 * runtime/JSGlobalObject.h:
2218 (JSGlobalObject):
2219 (JSC::JSGlobalObject::JSGlobalObject):
2220 (JSC):
2221 (JSC::JSGlobalObject::hasOwnPropertyForWrite):
2222 * runtime/JSSegmentedVariableObject.cpp: Added.
2223 (JSC):
2224 (JSC::JSSegmentedVariableObject::findRegisterIndex):
2225 (JSC::JSSegmentedVariableObject::addRegisters):
2226 (JSC::JSSegmentedVariableObject::visitChildren):
2227 * runtime/JSSegmentedVariableObject.h: Added.
2228 (JSC):
2229 (JSSegmentedVariableObject):
2230 (JSC::JSSegmentedVariableObject::registerAt):
2231 (JSC::JSSegmentedVariableObject::assertRegisterIsInThisObject):
2232 (JSC::JSSegmentedVariableObject::JSSegmentedVariableObject):
2233 (JSC::JSSegmentedVariableObject::finishCreation):
2234 * runtime/JSStaticScopeObject.cpp:
2235 (JSC::JSStaticScopeObject::put):
2236 (JSC::JSStaticScopeObject::putDirectVirtual):
2237 (JSC::JSStaticScopeObject::getOwnPropertySlot):
2238 * runtime/JSSymbolTableObject.cpp: Added.
2239 (JSC):
2240 (JSC::JSSymbolTableObject::destroy):
2241 (JSC::JSSymbolTableObject::deleteProperty):
2242 (JSC::JSSymbolTableObject::getOwnPropertyNames):
2243 (JSC::JSSymbolTableObject::putDirectVirtual):
2244 (JSC::JSSymbolTableObject::isDynamicScope):
2245 * runtime/JSSymbolTableObject.h: Added.
2246 (JSC):
2247 (JSSymbolTableObject):
2248 (JSC::JSSymbolTableObject::symbolTable):
2249 (JSC::JSSymbolTableObject::JSSymbolTableObject):
2250 (JSC::JSSymbolTableObject::finishCreation):
2251 (JSC::symbolTableGet):
2252 (JSC::symbolTablePut):
2253 (JSC::symbolTablePutWithAttributes):
2254 * runtime/JSVariableObject.cpp:
2255 (JSC):
2256 * runtime/JSVariableObject.h:
2257 (JSVariableObject):
2258 (JSC::JSVariableObject::JSVariableObject):
2259 (JSC::JSVariableObject::finishCreation):
2260 (JSC):
2261 * runtime/WriteBarrier.h:
2262
22632012-06-06 Filip Pizlo <fpizlo@apple.com>
2264
fpizlo@apple.comd5547492012-06-07 00:23:36 +00002265 DFG arguments access slow path should not crash if the arguments haven't been created
2266 https://bugs.webkit.org/show_bug.cgi?id=88471
2267
2268 Reviewed by Gavin Barraclough.
2269
2270 * dfg/DFGCCallHelpers.h:
2271 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
2272 (CCallHelpers):
2273 * dfg/DFGOperations.cpp:
2274 * dfg/DFGOperations.h:
2275 * dfg/DFGSpeculativeJIT.h:
2276 (JSC::DFG::SpeculativeJIT::callOperation):
2277 * dfg/DFGSpeculativeJIT32_64.cpp:
2278 (JSC::DFG::SpeculativeJIT::compile):
2279 * dfg/DFGSpeculativeJIT64.cpp:
2280 (JSC::DFG::SpeculativeJIT::compile):
2281
msaboff@apple.com9d9eab62012-06-06 23:11:09 +000022822012-06-06 Michael Saboff <msaboff@apple.com>
2283
2284 ENH: Add Logging to GC Marking Phase
2285 https://bugs.webkit.org/show_bug.cgi?id=88364
2286
2287 Reviewed by Filip Pizlo.
2288
2289 Log GC marking to stderr or a file. The logging in controlled
2290 with the define ENABLE_OBJECT_MARK_LOGGING in wtf/Platform.h.
2291 If DATA_LOG_TO_FILE in wtf/DataLog.cpp is set to 1, output is
2292 logged to a file otherwise it is logged to stderr.
2293
2294 When logging is enabled, the GC is built single threaded since the
2295 log output from the various threads isn't buffered and output in a
2296 thread safe manner.
2297
2298 * heap/Heap.cpp:
2299 (JSC::Heap::markRoots):
2300 * heap/MarkStack.cpp:
2301 (JSC::MarkStackThreadSharedData::resetChildren):
2302 (JSC::MarkStackThreadSharedData::childVisitCount):
2303 (JSC::MarkStackThreadSharedData::markingThreadMain):
2304 (JSC::MarkStackThreadSharedData::markingThreadStartFunc):
2305 (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData):
2306 (JSC::MarkStackThreadSharedData::reset):
2307 * heap/MarkStack.h:
2308 (MarkStackThreadSharedData):
2309 (MarkStack):
2310 (JSC::MarkStack::sharedData):
2311 (JSC::MarkStack::resetChildCount):
2312 (JSC::MarkStack::childCount):
2313 (JSC::MarkStack::incrementChildCount):
2314 * runtime/JSArray.cpp:
2315 (JSC::JSArray::visitChildren):
2316 * runtime/JSCell.cpp:
2317 (JSC::JSCell::className):
2318 * runtime/JSCell.h:
2319 (JSCell):
2320 (JSC::JSCell::visitChildren):
2321 * runtime/JSString.cpp:
2322 (JSC::JSString::visitChildren):
2323 * runtime/JSString.h:
2324 (JSString):
2325 * runtime/Structure.h:
2326 (JSC::MarkStack::internalAppend):
2327
barraclough@apple.com799e44e2012-06-06 22:09:44 +000023282012-06-06 Gavin Barraclough <barraclough@apple.com>
2329
2330 Assigning to a static property should not change iteration order
2331 https://bugs.webkit.org/show_bug.cgi?id=88401
2332
2333 Reviewed by Geoff Garen.
2334
2335 A specific iteration order is not defined by the spec, but test-262 somewhat tenuously
2336 requires that it is at least stable, e.g. ch10/10.4/10.4.2/S10.4.2_A1.1_T1.js
2337
2338 Whilst it is not clear that this behavior really arises from the specification, it
2339 would seem like common sense to conform to this.
2340
2341 The problem here is that we allow properties in the structure to shadow those in the
2342 static table, and we iterate the properties in the structure first - which means that
2343 as values of existing properties are modified, their iteration order changes too.
2344
2345 The easy fix is to iterate the properties from the static table first. This has a
2346 further benefit, since it will mean that user added properties will come after those
2347 present in the static table (respected the expected insertion-order).
2348
2349 * runtime/JSObject.cpp:
2350 (JSC::JSObject::getOwnPropertyNames):
2351 - Iterate static properties first.
2352
wingo@igalia.combe8ecb92012-06-06 09:39:04 +000023532012-06-06 Andy Wingo <wingo@igalia.com>
2354
wingo@igalia.comc2fb5ba2012-06-06 18:59:35 +00002355 Ensure consistent order of evaluation in LLInt slow paths
2356 https://bugs.webkit.org/show_bug.cgi?id=88409
2357
2358 Reviewed by Geoffrey Garen.
2359
2360 * llint/LLIntSlowPaths.cpp:
2361 (slow_path_mul)
2362 (slow_path_sub)
2363 (slow_path_div)
2364 (slow_path_mod)
2365 (slow_path_lshift)
2366 (slow_path_rshift)
2367 (slow_path_urshift)
2368 (slow_path_bitand)
2369 (slow_path_bitor)
2370 (slow_path_bitxor): Avoid calling toNumber, toInt32, or toUInt32
2371 multiple times without intervening sequence points. Fixes
2372 fast/js/exception-sequencing-binops.html with GCC 4.7 on x86-64
2373 Linux, which reordered evaluation of the arguments to fmod.
2374
23752012-06-06 Andy Wingo <wingo@igalia.com>
2376
wingo@igalia.com4990fe82012-06-06 16:00:38 +00002377 [GTK] Enable the LLInt
2378 https://bugs.webkit.org/show_bug.cgi?id=88315
2379
2380 Reviewed by Filip Pizlo.
2381
2382 * GNUmakefile.am: Add rules to generate LLIntDesiredOffsets.h and
2383 LLIntAssembly.h.
2384 * GNUmakefile.list.am: Add offlineasm and llint files to the
2385 dist. Add LLInt source files to the build.
2386 * llint/LowLevelInterpreter.asm (crash): Generate a store of
2387 0xbbadbeef to a register, not to a constant. Otherwise, gas was
2388 failing to assemble result.
2389 * offlineasm/asm.rb (labelReference): Generate a
2390 SYMBOL_STRING_RELOCATION instead of a SYMBOL_STRING, so that we go
2391 through the PLT on ELF systems.
2392
23932012-06-06 Andy Wingo <wingo@igalia.com>
2394
wingo@igalia.combe8ecb92012-06-06 09:39:04 +00002395 REGRESSION (r106478): None of the Paper.js JavaScript examples work
2396 https://bugs.webkit.org/show_bug.cgi?id=87158
2397
2398 Reviewed by Michael Saboff.
2399
2400 * bytecompiler/BytecodeGenerator.cpp:
2401 (JSC::BytecodeGenerator::resolve): If we have to bail out to
2402 dynamicResolve(), only skip static scopes from the head of the
2403 scope chain. Before, we were also skipping activations with
2404 direct eval as well, which was incorrect.
2405
mitz@apple.com115e6642012-06-06 07:37:05 +000024062012-06-06 Dan Bernstein <mitz@apple.com>
2407
2408 Reverted r119567, the fix for <http://webkit.org/b/88378>, because it broke the 32-bit build.
2409
2410 * dfg/DFGSpeculativeJIT.h:
2411 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
2412 * jit/JITInlineMethods.h:
2413 (JSC::JIT::emitAllocateBasicJSObject):
2414 * llint/LowLevelInterpreter.asm:
2415 * runtime/JSGlobalData.h:
2416 (JSGlobalData):
2417 * runtime/JSGlobalThis.cpp:
2418 (JSC::JSGlobalThis::setUnwrappedObject):
2419 * runtime/JSObject.cpp:
2420 (JSC::JSObject::visitChildren):
2421 (JSC::JSObject::createInheritorID):
2422 * runtime/JSObject.h:
2423 (JSObject):
2424 (JSC::JSObject::resetInheritorID):
2425 (JSC):
2426 (JSC::JSObject::offsetOfInheritorID):
2427 (JSC::JSObject::inheritorID):
2428
yuqiang.xian@intel.come8adde62012-06-06 05:25:54 +000024292012-06-05 Yuqiang Xian <yuqiang.xian@intel.com>
2430
2431 Improve Math.round and Math.floor intrinsic
2432 https://bugs.webkit.org/show_bug.cgi?id=88314
2433
2434 Reviewed by Filip Pizlo.
2435
2436 Currently we call a native function from the JIT code to complete the
2437 "round" and "floor" operations. We could inline some fast paths
2438 especially for those positive values on the platforms where floating
2439 point truncation is supported.
2440 This brings 3% gain on Kraken, especially 32% on audio-oscillator,
2441 and slight win on SunSpider, measured on IA32.
2442
2443 * jit/ThunkGenerators.cpp:
2444 (JSC::floorThunkGenerator):
2445 (JSC):
2446 (JSC::roundThunkGenerator):
2447
barraclough@apple.comc48fc1b2012-06-06 05:08:45 +000024482012-06-05 Gavin Barraclough <barraclough@apple.com>
2449
2450 Remove JSObject::m_inheritorID
2451 https://bugs.webkit.org/show_bug.cgi?id=88378
2452
2453 Reviewed by Geoff Garen.
2454
2455 This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
2456 and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
2457 Instead use a private named value in the object's property storage.
2458
2459 * dfg/DFGSpeculativeJIT.h:
2460 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
2461 - No need m_inheritorID to initialize!
2462 * jit/JITInlineMethods.h:
2463 (JSC::JIT::emitAllocateBasicJSObject):
2464 - No need m_inheritorID to initialize!
2465 * llint/LowLevelInterpreter.asm:
2466 - No need m_inheritorID to initialize!
2467 * runtime/JSGlobalData.h:
2468 (JSGlobalData):
2469 - Added private name 'm_inheritorIDKey'.
2470 * runtime/JSGlobalThis.cpp:
2471 (JSC::JSGlobalThis::setUnwrappedObject):
2472 - resetInheritorID is now passed a JSGlobalData&.
2473 * runtime/JSObject.cpp:
2474 (JSC::JSObject::visitChildren):
2475 - No m_inheritorID to be marked.
2476 (JSC::JSObject::createInheritorID):
2477 - Store the newly created inheritorID in the property map.
2478 * runtime/JSObject.h:
2479 (JSC::JSObject::resetInheritorID):
2480 - Remove the inheritorID from property storage.
2481 (JSC::JSObject::inheritorID):
2482 - Read the inheritorID from property storage.
2483
fpizlo@apple.come7bee132012-06-05 21:32:18 +000024842012-06-05 Filip Pizlo <fpizlo@apple.com>
2485
2486 DFG CFG simplification should not attempt to deref nodes inside of an unreachable subgraph
2487 https://bugs.webkit.org/show_bug.cgi?id=88362
2488
2489 Reviewed by Gavin Barraclough.
2490
2491 * dfg/DFGCFGSimplificationPhase.cpp:
2492 (JSC::DFG::CFGSimplificationPhase::fixPhis):
2493 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
2494
mhahnenberg@apple.com47c9c532012-06-05 20:38:21 +000024952012-06-05 Mark Hahnenberg <mhahnenberg@apple.com>
2496
2497 Entry into JSC should CRASH() if the Heap is busy
2498 https://bugs.webkit.org/show_bug.cgi?id=88355
2499
2500 Reviewed by Geoffrey Garen.
2501
2502 Interpreter::execute() returns jsNull() right now if we try to enter it while
2503 the Heap is busy (e.g. with a collection), which is okay, but some code paths
2504 that call Interpreter::execute() allocate objects before checking if the Heap
2505 is busy. Attempting to execute JS code while the Heap is busy should not be
2506 allowed and should be enforced by a release-mode CRASH() to prevent vague,
2507 unhelpful backtraces later on if somebody makes a mistake. Normally, recursively
2508 executing JS code is okay, e.g. for evals, but it should not occur during a
2509 Heap allocation or collection because the Heap is not guaranteed to be in a
2510 consistent state (especially during collections). We are protected from
2511 executing JS on the same Heap concurrently on two separate threads because
2512 they must each take a JSLock first. However, we are not protected from reentrant
2513 execution of JS on the same thread because JSLock allows reentrancy. Therefore,
2514 we should fail early if we detect an entrance into JS code while the Heap is busy.
2515
2516 * heap/Heap.cpp: Changed Heap::collect so that it sets the m_operationInProgress field
2517 at the beginning of collection and then unsets it at the end so that it is set at all
2518 times throughout the duration of a collection rather than sporadically during various
2519 phases. There is no reason to unset during a collection because our collector does
2520 not currently support running additional JS between the phases of a collection.
2521 (JSC::Heap::getConservativeRegisterRoots):
2522 (JSC::Heap::markRoots):
2523 (JSC::Heap::collect):
2524 * interpreter/Interpreter.cpp:
2525 (JSC::Interpreter::execute): Crash if the Heap is busy.
2526 * runtime/Completion.cpp: Crash if the Heap is busy. We do it here before we call
2527 Interpreter::execute() because we do some allocation prior to calling execute() which
2528 could cause Heap corruption if, for example, that allocation caused a collection.
2529 (JSC::evaluate):
2530
commit-queue@webkit.org3401b2d2012-06-05 11:32:22 +000025312012-06-05 Dongwoo Im <dw.im@samsung.com>
2532
2533 Add 'isProtocolHandlerRegistered' and 'unregisterProtocolHandler'.
2534 https://bugs.webkit.org/show_bug.cgi?id=73176
2535
2536 Reviewed by Adam Barth.
2537
2538 Two more APIs are added in Custom Scheme Handler specification.
2539 http://dev.w3.org/html5/spec/Overview.html#custom-handlers
2540 One is 'isProtocolHandlerRegistered' to query whether the specific URL
2541 is registered or not.
2542 The other is 'unregisterProtocolHandler' to remove the registered URL.
2543
2544 * Configurations/FeatureDefines.xcconfig: Add a macro 'ENABLE_CUSTOM_SCHEME_HANDLER'.
2545
fpizlo@apple.com9cce18d2012-06-05 06:40:48 +000025462012-06-04 Filip Pizlo <fpizlo@apple.com>
2547
2548 DFG CFG simplification should correct the variables at the head of the predecessor block
2549 https://bugs.webkit.org/show_bug.cgi?id=88284
2550
2551 Reviewed by Geoffrey Garen.
2552
2553 * dfg/DFGCFGSimplificationPhase.cpp:
2554 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
2555
ggaren@apple.com825cc102012-06-05 03:17:15 +000025562012-06-04 Geoffrey Garen <ggaren@apple.com>
2557
2558 Unreviewed.
2559
2560 Rolled out r119364 because it's still causing crashes (when running
2561 v8-earley in release builds of DRT)
2562
2563 This time for sure!
2564
2565 * heap/Heap.cpp:
2566 (JSC::Heap::collect):
2567 * heap/MarkedBlock.cpp:
2568 (JSC::MarkedBlock::sweep):
2569 * heap/MarkedBlock.h:
2570 (JSC::MarkedBlock::resetAllocator):
2571 (JSC):
2572 * heap/MarkedSpace.cpp:
2573 (JSC::ResetAllocator::operator()):
2574 (JSC):
2575 (JSC::MarkedSpace::resetAllocators):
2576 (JSC::MarkedSpace::sweepWeakSets):
2577 * heap/MarkedSpace.h:
2578 (MarkedSpace):
2579 * heap/WeakBlock.cpp:
2580 (JSC::WeakBlock::sweep):
2581 * heap/WeakSet.cpp:
2582 (JSC::WeakSet::sweep):
2583 (JSC::WeakSet::tryFindAllocator):
2584 * heap/WeakSet.h:
2585 (JSC::WeakSet::shrink):
2586
fpizlo@apple.com9cd38a62012-06-05 00:28:49 +000025872012-06-04 Filip Pizlo <fpizlo@apple.com>
2588
2589 DFG arguments simplification should have rationalized handling of TearOffArguments
2590 https://bugs.webkit.org/show_bug.cgi?id=88206
2591
2592 Reviewed by Geoffrey Garen.
2593
2594 - Accesses to the unmodified arguments register ought to have the same effect on
2595 alias/escape analysis of arguments as accesses to the mutable arguments register.
2596
2597 - The existence of TearOffArguments should not get in the way of arguments aliasing.
2598
2599 - TearOffArguments should be eliminated if CreateArguments is eliminated.
2600
2601 * dfg/DFGArgumentsSimplificationPhase.cpp:
2602 (JSC::DFG::ArgumentsSimplificationPhase::run):
2603 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
2604
barraclough@apple.com282d26a2012-06-05 00:00:17 +000026052012-06-04 Gavin Barraclough <barraclough@apple.com>
2606
2607 Remove enabledProfilerReference
2608 https://bugs.webkit.org/show_bug.cgi?id=88258
2609
2610 Reviewed by Michael Saboff.
2611
2612 Make the enabled profiler a member of JSGlobalData, and switch code that accesses it to do so directly
2613 via the JSGlobalData, rather than holding a Profiler** reference to it. Do not pass the Profiler**
2614 reference to JIT code. This patch does not change the stack layout on entry into JIT code (passing an
2615 unused void* instead), since this is an intrusive change better handled in a separate patch.
2616
2617 * interpreter/Interpreter.cpp:
2618 (JSC::Interpreter::throwException):
2619 (JSC::Interpreter::execute):
2620 (JSC::Interpreter::executeCall):
2621 (JSC::Interpreter::executeConstruct):
2622 (JSC::Interpreter::privateExecute):
2623 * jit/JITCode.h:
2624 (JSC::JITCode::execute):
2625 - Don't pass Profiler** to JIT code.
2626 * jit/JITOpcodes.cpp:
2627 (JSC::JIT::emit_op_profile_will_call):
2628 (JSC::JIT::emit_op_profile_did_call):
2629 * jit/JITOpcodes32_64.cpp:
2630 (JSC::JIT::emit_op_profile_will_call):
2631 (JSC::JIT::emit_op_profile_did_call):
2632 * jit/JITStubs.cpp:
2633 (JSC):
2634 (JSC::ctiTrampoline):
2635 (JSC::ctiVMThrowTrampoline):
2636 (JSC::ctiOpThrowNotCaught):
2637 (JSC::JITThunks::JITThunks):
2638 (JSC::DEFINE_STUB_FUNCTION):
2639 - For ARM_THUMB2, rename ENABLE_PROFILER_REFERENCE_OFFSET to FIRST_STACK_ARGUMENT (which is how it is being used).
2640 - For MIPS, remove ENABLE_PROFILER_REFERENCE_OFFSET.
2641 * jit/JITStubs.h:
2642 (JITStackFrame):
2643 (JSC):
2644 - Renamed enabledProfilerReference to unusedX.
2645 * llint/LLIntSlowPaths.cpp:
2646 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
2647 * llint/LowLevelInterpreter.asm:
2648 * profiler/Profiler.cpp:
2649 (JSC):
2650 (JSC::Profiler::startProfiling):
2651 (JSC::Profiler::stopProfiling):
2652 * profiler/Profiler.h:
2653 (Profiler):
2654 - Removed s_sharedEnabledProfilerReference, enabledProfilerReference().
2655 * runtime/JSGlobalData.cpp:
2656 (JSC::JSGlobalData::JSGlobalData):
2657 * runtime/JSGlobalData.h:
2658 (JSC):
2659 (JSC::JSGlobalData::enabledProfiler):
2660 (JSGlobalData):
2661 - Added m_enabledProfiler, enabledProfiler().
2662 * runtime/JSGlobalObject.cpp:
2663 (JSC::JSGlobalObject::~JSGlobalObject):
2664
fpizlo@apple.com3d579cc2012-06-04 23:27:34 +000026652012-06-04 Filip Pizlo <fpizlo@apple.com>
2666
fpizlo@apple.com477ce382012-06-04 23:32:57 +00002667 get_argument_by_val should be profiled everywhere
2668 https://bugs.webkit.org/show_bug.cgi?id=88205
2669
2670 Reviewed by Geoffrey Garen.
2671
2672 * jit/JITOpcodes32_64.cpp:
2673 (JSC::JIT::emitSlow_op_get_argument_by_val):
2674 * llint/LLIntSlowPaths.cpp:
2675 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
2676
26772012-06-04 Filip Pizlo <fpizlo@apple.com>
2678
fpizlo@apple.com3d579cc2012-06-04 23:27:34 +00002679 DFG arguments simplification takes unkindly to direct accesses to the arguments register
2680 https://bugs.webkit.org/show_bug.cgi?id=88261
2681
2682 Reviewed by Geoffrey Garen.
2683
2684 Fixed arguments simplification for direct accesses to the arguments register, which may
2685 arise if CSE had not run. Fixed CSE so that it does run prior to arguments simplification,
2686 by making it a full-fledged member of the fixpoint. Fixed other issues in arguments
2687 simplification, like realizing that it needs to bail if there is a direct assignment to
2688 the arguments register, and failing to turn CreateArguments into PhantomArguments. Also
2689 fixed CSE's handling of store elimination of captured locals in the presence of a
2690 GetMyArgumentByVal (or one of its friends), and fixed CSE to correctly fixup variables at
2691 tail if the Flush it removes is the last operation on a local in a basic block.
2692
2693 * bytecode/CodeBlock.cpp:
2694 (JSC::CodeBlock::dump):
2695 * dfg/DFGArgumentsSimplificationPhase.cpp:
2696 (JSC::DFG::ArgumentsSimplificationPhase::run):
2697 (JSC::DFG::ArgumentsSimplificationPhase::isOKToOptimize):
2698 * dfg/DFGCSEPhase.cpp:
2699 (JSC::DFG::CSEPhase::run):
2700 (JSC::DFG::CSEPhase::setLocalStoreElimination):
2701 (JSC::DFG::CSEPhase::performNodeCSE):
2702 (CSEPhase):
2703 * dfg/DFGDriver.cpp:
2704 (JSC::DFG::compile):
2705
andersca@apple.comea6c6b22012-06-04 21:56:32 +000027062012-06-04 Anders Carlsson <andersca@apple.com>
2707
2708 Fix a struct/class mismatch.
2709
2710 * heap/Handle.h:
2711 (Handle):
2712
ddkilzer@apple.comba58a612012-06-04 14:55:26 +000027132012-06-04 David Kilzer <ddkilzer@apple.com>
2714
2715 BUILD FIX: FeatureDefines.xcconfig should match across projects
2716
2717 * Configurations/FeatureDefines.xcconfig:
2718 - Add missing ENABLE_LEGACY_CSS_VENDOR_PREFIXES.
2719
ggaren@apple.com02dec622012-06-03 21:16:55 +000027202012-06-02 Geoffrey Garen <ggaren@apple.com>
2721
2722 Weak pointer finalization should be lazy
2723 https://bugs.webkit.org/show_bug.cgi?id=87599
2724
2725 Reviewed by Sam Weinig.
2726
2727 This time for sure!
2728
2729 * heap/Heap.cpp:
2730 (JSC::Heap::collect): Don't sweep eagerly -- we'll sweep lazily instead.
2731
2732 * heap/MarkedBlock.cpp:
2733 (JSC::MarkedBlock::sweep): Sweep our weak set before we sweep our other
2734 destructors -- this is our last chance to run weak set finalizers before
2735 we recycle our memory.
2736
2737 * heap/MarkedBlock.h:
2738 (JSC::MarkedBlock::resetAllocator):
2739 * heap/MarkedSpace.cpp:
2740 (JSC::MarkedSpace::resetAllocators):
2741 * heap/MarkedSpace.h:
2742 (JSC::MarkedSpace::resetAllocators): Don't force allocator reset anymore.
2743 It will happen automatically when a weak set is swept. It's simpler to
2744 have only one canonical way for this to happen, and it wasn't buying
2745 us anything to do it eagerly.
2746
2747 * heap/WeakBlock.cpp:
2748 (JSC::WeakBlock::sweep): Don't short-circuit a sweep unless we know
2749 the sweep would be a no-op. If even one finalizer is pending, we need to
2750 run it, since we won't get another chance.
2751
2752 * heap/WeakSet.cpp:
2753 (JSC::WeakSet::sweep): This loop can be simpler now that
2754 WeakBlock::sweep() does what we mean.
2755
2756 Reset our allocator after a sweep because this is the optimal time to
2757 start trying to recycle old weak pointers.
2758
2759 (JSC::WeakSet::tryFindAllocator): Don't sweep when searching for an
2760 allocator because we've swept already, and forcing a new sweep would be
2761 wasteful.
2762
2763 * heap/WeakSet.h:
2764 (JSC::WeakSet::shrink): Be sure to reset our allocator after a shrink
2765 because the shrink may have removed the block the allocator was going to
2766 allocate out of.
2767
fpizlo@apple.comb80bc2a32012-06-02 22:58:48 +000027682012-06-02 Filip Pizlo <fpizlo@apple.com>
2769
fpizlo@apple.come0c200c2012-06-03 00:41:08 +00002770 If the DFG bytecode parser detects that op_method_check has gone polymorphic, it
2771 shouldn't revert all the way to GetById/GetByIdFlush
2772 https://bugs.webkit.org/show_bug.cgi?id=88176
2773
2774 Reviewed by Geoffrey Garen.
2775
2776 Refactored the code so that the op_method_check case of the parser gracefully falls
2777 through to all of the goodness of the normal op_get_by_id case.
2778
2779 * dfg/DFGByteCodeParser.cpp:
2780 (ByteCodeParser):
2781 (JSC::DFG::ByteCodeParser::handleGetById):
2782 (DFG):
2783 (JSC::DFG::ByteCodeParser::parseBlock):
2784
27852012-06-02 Filip Pizlo <fpizlo@apple.com>
2786
fpizlo@apple.comb80bc2a32012-06-02 22:58:48 +00002787 DFG CSE should be able to eliminate unnecessary flushes of arguments and captured variables
2788 https://bugs.webkit.org/show_bug.cgi?id=87929
2789
2790 Reviewed by Geoffrey Garen.
2791
2792 Slight speed-up on V8. Big win (up to 50%) on programs that inline very small functions.
2793
2794 This required a bunch of changes:
2795
2796 - The obvious change is making CSE essentially ignore whether or not the set of
2797 operations between the Flush and the SetLocal can exit, and instead focus on whether or
2798 not that set of operations can clobber the world or access local variables. This code
2799 is now refactored to return a set of flags indicating any of these events, and the CSE
2800 decides what to do based on those flags. If the set of operations is non-clobbering
2801 and non-accessing, then the Flush is turned into a Phantom on the child of the
2802 SetLocal. This expands the liveness of the relevant variable but virtually guarantees
2803 that it will be register allocated and not flushed to the stack. So, yeah, this patch
2804 is a lot of work to save a few stores to the stack.
2805
2806 - Previously, CheckArgumentsNotCreated was optimized "lazily" in that you only knew if
2807 it was a no-op if you were holding onto a CFA abstract state. But this would make the
2808 CSE act pessimistically, since it doesn't use the CFA. Hence, this patch changes the
2809 constant folding phase into something more broad; it now fixes up
2810 CheckArgumentsNotCreated nodes by turning them into phantoms if it knows that they are
2811 no-ops.
2812
2813 - Arguments simplification was previously relying on this very strange PhantomArguments
2814 node, which had two different meanings: for normal execution it meant the empty value
2815 but for OSR exit it meant that the arguments should be reified. This produces problems
2816 when set SetLocals to the captured arguments registers are CSE'd away, since we'd be
2817 triggering reification of arguments without having initialized the arguments registers
2818 to empty. The cleanest solution was to fix PhantomArguments to have one meaning:
2819 namely, arguments reification on OSR exit. Hence, this patch changes arguments
2820 simplification to change SetLocal of CreateArguments on the arguments registers to be
2821 a SetLocal of Empty.
2822
2823 - Argument value recoveries were previously derived from the value source of the
2824 arguments at the InlineStart. But that relies on all SetLocals to arguments having
2825 been flushed. It's possible that we could have elided the SetLocal to the arguments
2826 at the callsite because there were subsequent SetLocals to the arguments inside of the
2827 callee, in which case the InlineStart would get the wrong information. Hence, this
2828 patch changes argument value recovery computation to operate over the ArgumentPositions
2829 directly.
2830
2831 - But that doesn't actually work, because previously, there was no way to link an
2832 InlineStart back to the corresponding ArgumentPositions, at least not without some
2833 ugliness. So this patch instates the rule that the m_argumentPositions vector consists
2834 of disjoint subsequences such that each subsequence corresponds to an inline callsite
2835 and can be identified by its first index, and within each subsequence are the
2836 ArgumentPositions of all of the arguments ordered by argument index. This required
2837 flipping the order in which ArgumentPositions are added to the vector, and giving
2838 InlineStart an operand that indicates the start of that inline callsite's
2839 ArgumentPosition subsequence.
2840
2841 - This patch also revealed a nasty bug in the reification of arguments in inline call
2842 frames on OSR exit. Since the reification was happening after the values of virtual
2843 registers were recovered, the value recoveries of the inline arguments were wrong.
2844 Hence using operationCreateInlinedArguments is wrong. For example a value recovery
2845 might say that you have to box a double, but if we had already boxed it then boxing
2846 it a second time will result in garbage. The specific case of this bug was this patch
2847 uncovered was that now it is possible for an inline call frame to not have any valid
2848 value recoveries for any inline arguments, if the optimization elides all argument
2849 flushes, while at the same time optimizing away arguments creation. Then OSR exit
2850 would try to recover the arguments using the inline call frame, which had bogus
2851 information, and humorous crashes would ensue. This patch fixes this issue by moving
2852 arguments reification to after call frame reification, so that arguments reification
2853 can always use operationCreateArguments instead of operationCreateInlinedArguments.
2854
2855 - This patch may turn a Flush into a Phantom. That's kind of the whole point. But that
2856 broke forward speculation checks, which knew to look for a Flush prior to a SetLocal
2857 but didn't know that there could alternatively be a Phantom in place of the Flush.
2858 This patch fixes that by augmenting the forward speculation check logic.
2859
2860 - Finally, in the process of having fun with all of the above, I realized that my DFG
2861 validation was not actually running on every phase like I had originally designed it
2862 to. In fact it was only running just after bytecode parsing. I initially tried to
2863 make it run in every phase but found that this causes some tests to timeout
2864 (specifically the evil fuzzing ones), so I decided on a compromise where: (i) in
2865 release mode validation never runs, (ii) in debug mode validation will run just
2866 after parsing and just before the backend, and (iii) it's possible with a simple
2867 switch to enable validation to run on every phase.
2868
2869 Luckily all of the above issues were already covered by the 77 or so DFG-specific
2870 layout tests. Hence, this patch does not introduce any new tests despite being so
2871 meaty.
2872
2873 * dfg/DFGAbstractState.cpp:
2874 (JSC::DFG::AbstractState::execute):
2875 * dfg/DFGArgumentPosition.h:
2876 (JSC::DFG::ArgumentPosition::prediction):
2877 (JSC::DFG::ArgumentPosition::doubleFormatState):
2878 (JSC::DFG::ArgumentPosition::shouldUseDoubleFormat):
2879 (ArgumentPosition):
2880 * dfg/DFGArgumentsSimplificationPhase.cpp:
2881 (JSC::DFG::ArgumentsSimplificationPhase::run):
2882 * dfg/DFGByteCodeParser.cpp:
2883 (JSC::DFG::ByteCodeParser::handleInlining):
2884 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
2885 * dfg/DFGCSEPhase.cpp:
2886 (JSC::DFG::CSEPhase::SetLocalStoreEliminationResult::SetLocalStoreEliminationResult):
2887 (SetLocalStoreEliminationResult):
2888 (JSC::DFG::CSEPhase::setLocalStoreElimination):
2889 (JSC::DFG::CSEPhase::performNodeCSE):
2890 * dfg/DFGCommon.h:
2891 * dfg/DFGConstantFoldingPhase.cpp:
2892 (JSC::DFG::ConstantFoldingPhase::run):
2893 * dfg/DFGDriver.cpp:
2894 (JSC::DFG::compile):
2895 * dfg/DFGNode.h:
2896 (Node):
2897 (JSC::DFG::Node::hasArgumentPositionStart):
2898 (JSC::DFG::Node::argumentPositionStart):
2899 * dfg/DFGOSRExitCompiler32_64.cpp:
2900 (JSC::DFG::OSRExitCompiler::compileExit):
2901 * dfg/DFGOSRExitCompiler64.cpp:
2902 (JSC::DFG::OSRExitCompiler::compileExit):
2903 * dfg/DFGPhase.cpp:
2904 (DFG):
2905 * dfg/DFGPhase.h:
2906 (Phase):
2907 * dfg/DFGSpeculativeJIT.cpp:
2908 (JSC::DFG::SpeculativeJIT::compile):
2909 * dfg/DFGSpeculativeJIT.h:
2910 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
2911 * dfg/DFGSpeculativeJIT32_64.cpp:
2912 (JSC::DFG::SpeculativeJIT::compile):
2913 * dfg/DFGSpeculativeJIT64.cpp:
2914 (JSC::DFG::SpeculativeJIT::compile):
2915
ggaren@apple.com32eb24b2012-06-02 22:49:05 +000029162012-06-02 Geoffrey Garen <ggaren@apple.com>
2917
2918 DOM string cache should hash pointers, not characters
2919 https://bugs.webkit.org/show_bug.cgi?id=88175
2920
2921 Reviewed by Phil Pizlo and Sam Weinig.
2922
2923 * heap/Weak.h:
2924 (JSC::weakAdd):
2925 (JSC::weakRemove): Made these function templates slightly more generic
2926 to accommodate new client types.
2927
fpizlo@apple.comcc5b61b2012-06-01 21:32:45 +000029282012-06-01 Filip Pizlo <fpizlo@apple.com>
2929
fpizlo@apple.coma4754892012-06-02 00:22:31 +00002930 DFG CFA should know that PutByVal can clobber the world
2931 https://bugs.webkit.org/show_bug.cgi?id=88155
2932
2933 Reviewed by Gavin Barraclough.
2934
2935 * dfg/DFGAbstractState.cpp:
2936 (JSC::DFG::AbstractState::execute):
2937
29382012-06-01 Filip Pizlo <fpizlo@apple.com>
2939
fpizlo@apple.com8e537cd2012-06-01 23:54:36 +00002940 DFG CFA should mark basic blocks as having constants if local accesses yield constants
2941 https://bugs.webkit.org/show_bug.cgi?id=88153
2942
2943 Reviewed by Gavin Barraclough.
2944
2945 * dfg/DFGAbstractState.cpp:
2946 (JSC::DFG::AbstractState::execute):
2947
29482012-06-01 Filip Pizlo <fpizlo@apple.com>
2949
fpizlo@apple.comacc9dd22012-06-01 23:47:28 +00002950 DFG arguments simplification phase uses a node.codeOrigin after appending a node
2951 https://bugs.webkit.org/show_bug.cgi?id=88151
2952
2953 Reviewed by Geoffrey Garen.
2954
2955 The right thing to do is to save the CodeOrigin before appending to the graph.
2956
2957 * dfg/DFGArgumentsSimplificationPhase.cpp:
2958 (JSC::DFG::ArgumentsSimplificationPhase::run):
2959
29602012-06-01 Filip Pizlo <fpizlo@apple.com>
2961
fpizlo@apple.com4f337c22012-06-01 23:18:59 +00002962 DFG should not emit unnecessary speculation checks when performing an int32 to double conversion on
2963 a value that is proved to be a number, predicted to be an int32, but not proved to be an int32
2964 https://bugs.webkit.org/show_bug.cgi?id=88146
2965
2966 Reviewed by Gavin Barraclough.
2967
2968 * dfg/DFGSpeculativeJIT.cpp:
2969 (JSC::DFG::SpeculativeJIT::compileInt32ToDouble):
2970
29712012-06-01 Filip Pizlo <fpizlo@apple.com>
2972
fpizlo@apple.comafc07412012-06-01 22:44:43 +00002973 DFG constant folding search for the last local access skips the immediately previous local access
2974 https://bugs.webkit.org/show_bug.cgi?id=88141
2975
2976 Reviewed by Michael Saboff.
2977
2978 If you use a loop in the style of:
2979
2980 for (i = start; i--;)
2981
2982 then you need to remember that the first value of 'i' that the loop body will see is 'start - 1'.
2983 Hence the following is probably wrong:
2984
2985 for (i = start - 1; i--;)
2986
2987 * dfg/DFGConstantFoldingPhase.cpp:
2988 (JSC::DFG::ConstantFoldingPhase::run):
2989
29902012-06-01 Filip Pizlo <fpizlo@apple.com>
2991
fpizlo@apple.comcc5b61b2012-06-01 21:32:45 +00002992 DFG constant folding should be OK with GetLocal of captured variables having a constant
2993 https://bugs.webkit.org/show_bug.cgi?id=88137
2994
2995 Reviewed by Gavin Barraclough.
2996
2997 * dfg/DFGConstantFoldingPhase.cpp:
2998 (JSC::DFG::ConstantFoldingPhase::run):
2999
mhahnenberg@apple.com016c5782012-06-01 00:02:09 +000030002012-05-31 Mark Hahnenberg <mhahnenberg@apple.com>
3001
3002 JSGlobalObject does not mark m_privateNameStructure
3003 https://bugs.webkit.org/show_bug.cgi?id=88023
3004
3005 Rubber stamped by Gavin Barraclough.
3006
3007 * runtime/JSGlobalObject.cpp:
3008 (JSC::JSGlobalObject::visitChildren): We need to mark this so it doesn't get
3009 inadvertently garbage collected.
3010
arv@chromium.org31fddbc2012-05-31 18:00:03 +000030112012-05-31 Erik Arvidsson <arv@chromium.org>
3012
3013 Make DOM Exceptions Errors
3014 https://bugs.webkit.org/show_bug.cgi?id=85078
3015
3016 Reviewed by Oliver Hunt.
3017
3018 WebIDL mandates that exceptions should have Error.prototype on its prototype chain.
3019
3020 For JSC we have access to the Error.prototype from the binding code.
3021
3022 For V8 we set a field in the WrapperTypeInfo and when the constructor function is created we
3023 set the prototype as needed.
3024
3025 Updated test: fast/dom/DOMException/prototype-object.html
3026
3027 * JavaScriptCore.xcodeproj/project.pbxproj:
3028 * runtime/JSGlobalObject.cpp:
3029 (JSC::JSGlobalObject::reset):
3030 * runtime/JSGlobalObject.h:
3031 (JSC):
3032 (JSGlobalObject):
3033 (JSC::JSGlobalObject::errorPrototype):
3034
wingo@igalia.com8de6a8a2012-05-31 17:28:21 +000030352012-05-31 Andy Wingo <wingo@igalia.com>
3036
3037 Fix reference to unset variable in debug mode
3038 https://bugs.webkit.org/show_bug.cgi?id=87981
3039
3040 Reviewed by Geoffrey Garen.
3041
3042 * runtime/JSONObject.cpp (Stringifier::Holder::Holder):
3043 Initialize m_size in debug mode, as we check it later in an assert.
3044
mhahnenberg@apple.comeb39abc2012-05-31 03:04:00 +000030452012-05-30 Mark Hahnenberg <mhahnenberg@apple.com>
3046
3047 Heap should sweep incrementally
3048 https://bugs.webkit.org/show_bug.cgi?id=85429
3049
3050 We shouldn't have to wait for the opportunistic GC timer to fire in order
3051 to call object destructors. Instead, we should incrementally sweep some
3052 subset of the blocks requiring sweeping periodically. We tie this sweeping
3053 to a timer rather than to collections because we want to reclaim this memory
3054 even if we stop allocating. This way, our memory usage scales smoothly with
3055 actual use, regardless of whether we've recently done an opportunistic GC or not.
3056
3057 Reviewed by Geoffrey Garen.
3058
3059 * CMakeLists.txt:
3060 * GNUmakefile.list.am:
3061 * JavaScriptCore.gypi:
3062 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3063 * JavaScriptCore.xcodeproj/project.pbxproj:
3064 * Target.pri:
3065 * heap/Heap.cpp:
3066 (JSC::Heap::Heap):
3067 (JSC::Heap::collect): We no longer sweep during a full sweep. We only shrink now,
3068 which we will switch over to being done during incremental sweeping too as soon as
3069 all finalizers can be run lazily (and, by extension, incrementally).
3070 (JSC::Heap::sweeper):
3071 (JSC):
3072 * heap/Heap.h:
3073 (JSC):
3074 (Heap):
3075 * heap/IncrementalSweeper.cpp: Added.
3076 (JSC):
3077 (JSC::IncrementalSweeper::timerDidFire): The IncrementalSweeper works very similarly to
3078 GCActivityCallback. It is tied to a run-loop based timer that fires periodically based
3079 on how long the previous sweep increment took to run. The IncrementalSweeper doesn't do
3080 anything if the platform doesn't support CoreFoundation.
3081 (JSC::IncrementalSweeper::IncrementalSweeper):
3082 (JSC::IncrementalSweeper::~IncrementalSweeper):
3083 (JSC::IncrementalSweeper::create):
3084 (JSC::IncrementalSweeper::scheduleTimer):
3085 (JSC::IncrementalSweeper::cancelTimer):
3086 (JSC::IncrementalSweeper::doSweep): Iterates over the snapshot of the MarkedSpace taken
3087 during the last collection, checking to see which blocks need sweeping. If it successfully
3088 gets to the end of the blocks that need sweeping then it cancels the timer.
3089 (JSC::IncrementalSweeper::startSweeping): We take a snapshot of the Heap and store it in
3090 a Vector that the incremental sweep will iterate over. We also reset our index into this Vector.
3091 * heap/IncrementalSweeper.h: Added.
3092 (JSC):
3093 (IncrementalSweeper):
3094 * heap/MarkedBlock.h:
3095 (JSC::MarkedBlock::needsSweeping): If a block is in the Marked state it needs sweeping
3096 to be usable and to run any destructors that need to be run.
3097
paroga@webkit.orgecd0fb62012-05-31 01:38:17 +000030982012-05-30 Patrick Gansterer <paroga@webkit.org>
3099
3100 [WINCE] Fix JSString after r115516.
3101 https://bugs.webkit.org/show_bug.cgi?id=87892
3102
3103 Reviewed by Geoffrey Garen.
3104
3105 r115516 splitted JSString into two classes, with addition nested classes.
3106 Add a workaround for the WinCE compiler since it can't resolve the friend class
3107 declerations corretly and denies the access to protected members of JSString.
3108
3109 * runtime/JSString.h:
3110 (JSC::JSRopeString::RopeBuilder::append):
3111 (JSC::JSRopeString::append):
3112 (JSRopeString):
3113
oliver@apple.com3c996382012-05-30 23:47:27 +000031142012-05-30 Oliver Hunt <oliver@apple.com>
3115
3116 Really provide error information with the inspector disabled
3117 https://bugs.webkit.org/show_bug.cgi?id=87910
3118
3119 Reviewed by Filip Pizlo.
3120
3121 Don't bother checking for anything other than pre-existing error info.
3122 In the absence of complete line number information you'll only get the
3123 line a function starts on, but at least it's something.
3124
3125 * interpreter/Interpreter.cpp:
3126 (JSC::Interpreter::throwException):
3127
fpizlo@apple.com074918c2012-05-30 20:18:00 +000031282012-05-30 Filip Pizlo <fpizlo@apple.com>
3129
fpizlo@apple.com5673fe62012-05-30 23:09:45 +00003130 LLInt broken on x86-32 with JIT turned off
3131 https://bugs.webkit.org/show_bug.cgi?id=87906
3132
3133 Reviewed by Geoffrey Garen.
3134
3135 Fixed the code to not clobber registers that contain important things, like the call frame.
3136
3137 * llint/LowLevelInterpreter32_64.asm:
3138
31392012-05-30 Filip Pizlo <fpizlo@apple.com>
3140
fpizlo@apple.com074918c2012-05-30 20:18:00 +00003141 ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
3142 https://bugs.webkit.org/show_bug.cgi?id=87887
3143
fpizlo@apple.comd55e8152012-05-30 21:04:23 +00003144 Reviewed by Darin Adler.
3145
3146 Better fix - we now never call SourceProvider::asID() if SourceProvider* is 0.
3147
3148 * parser/Nodes.h:
3149 (JSC::ScopeNode::sourceID):
3150 * parser/SourceCode.h:
3151 (JSC::SourceCode::providerID):
3152 (SourceCode):
3153 * parser/SourceProvider.h:
3154 (SourceProvider):
3155 (JSC::SourceProvider::asID):
3156 * runtime/Executable.h:
3157 (JSC::ScriptExecutable::sourceID):
3158
31592012-05-30 Filip Pizlo <fpizlo@apple.com>
3160
3161 ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
3162 https://bugs.webkit.org/show_bug.cgi?id=87887
3163
fpizlo@apple.com074918c2012-05-30 20:18:00 +00003164 Reviewed by Geoffrey Garen.
3165
3166 * parser/SourceProvider.h:
3167 (JSC::SourceProvider::asID):
3168
oliver@apple.comc55314a2012-05-30 19:45:20 +000031692012-05-30 Oliver Hunt <oliver@apple.com>
3170
3171 DFG does not correctly handle exceptions caught in the LLInt
3172 https://bugs.webkit.org/show_bug.cgi?id=87885
3173
3174 Reviewed by Filip Pizlo.
3175
3176 Make the DFG use genericThrow, rather than reimplementing a small portion of it.
3177 Also make the LLInt slow paths validate that their PC is correct.
3178
3179 * dfg/DFGOperations.cpp:
3180 * llint/LLIntSlowPaths.cpp:
3181 (LLInt):
3182
fpizlo@apple.com75824e82012-05-30 17:02:49 +000031832012-05-29 Filip Pizlo <fpizlo@apple.com>
3184
3185 DFG CFA should infer types and values of captured variables
3186 https://bugs.webkit.org/show_bug.cgi?id=87813
3187
3188 Reviewed by Gavin Barraclough.
3189
3190 Slight speed-up in V8/earley-boyer (~1%).
3191
3192 * bytecode/CodeBlock.h:
3193 (JSC::CodeBlock::argumentsAreCaptured):
3194 (JSC::CodeBlock::argumentIsCaptured):
3195 (CodeBlock):
3196 * dfg/DFGAbstractState.cpp:
3197 (DFG):
3198 (JSC::DFG::AbstractState::beginBasicBlock):
3199 (JSC::DFG::AbstractState::initialize):
3200 (JSC::DFG::AbstractState::endBasicBlock):
3201 (JSC::DFG::AbstractState::execute):
3202 (JSC::DFG::AbstractState::clobberWorld):
3203 (JSC::DFG::AbstractState::clobberStructures):
3204 (JSC::DFG::AbstractState::mergeStateAtTail):
3205 (JSC::DFG::AbstractState::merge):
3206 (JSC::DFG::AbstractState::mergeToSuccessors):
3207 * dfg/DFGAbstractState.h:
3208 (JSC::DFG::AbstractState::variables):
3209 (AbstractState):
3210 * dfg/DFGSpeculativeJIT32_64.cpp:
3211 (JSC::DFG::SpeculativeJIT::compile):
3212 * dfg/DFGSpeculativeJIT64.cpp:
3213 (JSC::DFG::SpeculativeJIT::compile):
3214
paroga@webkit.orge373ab72012-05-30 16:44:03 +000032152012-05-30 Patrick Gansterer <paroga@webkit.org>
3216
3217 Unreviewed. Build fix for !ENABLE(JIT) after r117823.
3218
3219 * bytecode/CodeBlock.cpp:
3220 (JSC::CodeBlock::dump):
3221
commit-queue@webkit.org4ac40e0d2012-05-30 07:17:05 +000032222012-05-30 Sheriff Bot <webkit.review.bot@gmail.com>
3223
3224 Unreviewed, rolling out r118868.
3225 http://trac.webkit.org/changeset/118868
3226 https://bugs.webkit.org/show_bug.cgi?id=87828
3227
3228 introduced ~20 crashes on Mac and Qt bots (Requested by pizlo_
3229 on #webkit).
3230
3231 * heap/Heap.cpp:
3232 (JSC::Heap::collect):
3233 * heap/MarkedBlock.cpp:
3234 (JSC::MarkedBlock::sweep):
3235 * heap/MarkedBlock.h:
3236 (JSC::MarkedBlock::sweepWeakSet):
3237 (JSC):
3238 * heap/MarkedSpace.cpp:
3239 (JSC::SweepWeakSet::operator()):
3240 (JSC):
3241 (JSC::MarkedSpace::sweepWeakSets):
3242 * heap/MarkedSpace.h:
3243 (MarkedSpace):
3244
ggaren@apple.com15344ae2012-05-30 01:05:35 +000032452012-05-29 Geoffrey Garen <ggaren@apple.com>
3246
3247 Rolled back in r118646, now that
3248 https://bugs.webkit.org/show_bug.cgi?id=87784 is fixed.
3249
3250 http://trac.webkit.org/changeset/118646
3251 https://bugs.webkit.org/show_bug.cgi?id=87599
3252
3253 * heap/Heap.cpp:
3254 (JSC::Heap::collect):
3255 * heap/MarkedBlock.cpp:
3256 (JSC::MarkedBlock::sweep):
3257 * heap/MarkedBlock.h:
3258 (JSC):
3259 * heap/MarkedSpace.cpp:
3260 (JSC):
3261 * heap/MarkedSpace.h:
3262 (MarkedSpace):
3263
fpizlo@apple.com4c0875e2012-05-29 23:43:16 +000032642012-05-29 Filip Pizlo <fpizlo@apple.com>
3265
3266 DFG should keep captured variables alive until the (inline) return.
3267 https://bugs.webkit.org/show_bug.cgi?id=87205
3268
3269 Reviewed by Gavin Barraclough.
3270
3271 Changes the way we do flushing for captured variables and arguments. Instead of flushing
3272 each SetLocal immediately, we flush at kill points. So a SetLocal will cause a Flush of
3273 whatever was live in the variable previously, and a return will cause a Flush of all
3274 captured variables and all arguments.
3275
3276 * dfg/DFGByteCodeParser.cpp:
3277 (JSC::DFG::ByteCodeParser::setDirect):
3278 (JSC::DFG::ByteCodeParser::set):
3279 (JSC::DFG::ByteCodeParser::setLocal):
3280 (JSC::DFG::ByteCodeParser::getArgument):
3281 (JSC::DFG::ByteCodeParser::setArgument):
3282 (JSC::DFG::ByteCodeParser::findArgumentPositionForArgument):
3283 (ByteCodeParser):
3284 (JSC::DFG::ByteCodeParser::findArgumentPositionForLocal):
3285 (JSC::DFG::ByteCodeParser::findArgumentPosition):
3286 (JSC::DFG::ByteCodeParser::flush):
3287 (JSC::DFG::ByteCodeParser::flushDirect):
3288 (JSC::DFG::ByteCodeParser::flushArgumentsAndCapturedVariables):
3289 (JSC::DFG::ByteCodeParser::handleInlining):
3290 (JSC::DFG::ByteCodeParser::parseBlock):
3291 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
3292 * dfg/DFGCSEPhase.cpp:
3293 (JSC::DFG::CSEPhase::setLocalStoreElimination):
3294 (JSC::DFG::CSEPhase::performNodeCSE):
3295 * dfg/DFGSpeculativeJIT.cpp:
3296 (JSC::DFG::SpeculativeJIT::compile):
3297 * dfg/DFGSpeculativeJIT.h:
3298 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
3299
ggaren@apple.com7cc57362012-05-29 23:40:26 +000033002012-05-29 Geoffrey Garen <ggaren@apple.com>
3301
3302 WeakGCMap should be lazy-finalization-safe
3303 https://bugs.webkit.org/show_bug.cgi?id=87784
3304
3305 Reviewed by Darin Adler.
3306
3307 * runtime/WeakGCMap.h:
3308 (JSC::WeakGCMap::get): Since this is a map of raw WeakImpl pointers, and
3309 not Weak<T>, we need to verify manually that the WeakImpl is live before
3310 we return its payload.
3311
mhahnenberg@apple.com7ea7e8f2012-05-29 18:38:14 +000033122012-05-29 Mark Hahnenberg <mhahnenberg@apple.com>
3313
3314 CopiedSpace::doneCopying could start another collection
3315 https://bugs.webkit.org/show_bug.cgi?id=86538
3316
3317 Reviewed by Geoffrey Garen.
3318
3319 It's possible that if we don't have anything at the head of to-space
3320 after a collection and the BlockAllocator doesn't have any fresh blocks
3321 to give us right now we could start another collection while still in
3322 the middle of the first collection when we call CopiedSpace::addNewBlock().
3323
3324 One way to resolve this would be to have Heap::shouldCollect() check that
3325 m_operationInProgress is NoOperation. This would prevent the path in
3326 getFreshBlock() that starts the collection if we're already in the middle of one.
3327
3328 I could not come up with a test case to reproduce this crash on ToT.
3329
3330 * heap/Heap.h:
3331 (JSC::Heap::shouldCollect): We shouldn't collect if we're already in the middle
3332 of a collection, i.e. the current operation should be NoOperation.
3333
commit-queue@webkit.orgd5058402012-05-29 14:44:38 +000033342012-05-29 David Barr <davidbarr@chromium.org>
3335
3336 Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag
3337 https://bugs.webkit.org/show_bug.cgi?id=87685
3338
3339 Reviewed by Eric Seidel.
3340
3341 Add a configuration option for CSS image-resolution support, disabling it by default.
3342
3343 * Configurations/FeatureDefines.xcconfig:
3344
commit-queue@webkit.org10c0df22012-05-29 03:24:49 +000033452012-05-28 Sheriff Bot <webkit.review.bot@gmail.com>
3346
3347 Unreviewed, rolling out r118646.
3348 http://trac.webkit.org/changeset/118646
3349 https://bugs.webkit.org/show_bug.cgi?id=87691
3350
3351 broke V8 raytrace benchmark (Requested by pizlo_ on #webkit).
3352
3353 * heap/Heap.cpp:
3354 (JSC::Heap::collect):
3355 * heap/MarkedBlock.cpp:
3356 (JSC::MarkedBlock::sweep):
3357 * heap/MarkedBlock.h:
3358 (JSC::MarkedBlock::sweepWeakSet):
3359 (JSC):
3360 * heap/MarkedSpace.cpp:
3361 (JSC::SweepWeakSet::operator()):
3362 (JSC):
3363 (JSC::MarkedSpace::sweepWeakSets):
3364 * heap/MarkedSpace.h:
3365 (MarkedSpace):
3366
fpizlo@apple.com26ece8e2012-05-29 02:43:30 +000033672012-05-28 Filip Pizlo <fpizlo@apple.com>
3368
3369 DFG should not generate code for code that the CFA proves to be unreachable
3370 https://bugs.webkit.org/show_bug.cgi?id=87682
3371
3372 Reviewed by Sam Weinig.
3373
3374 This also fixes a small performance bug where CFA was not marking blocks
3375 as having constants (and hence not triggering constant folding) if the only
3376 constants were on GetLocals.
3377
3378 And fixing that bug revealed another bug: constant folding was assuming that
3379 a GetLocal must be the first access to a local in a basic block. This isn't
3380 true. The first access may be a Flush. This patch fixes that issue using the
3381 safest approach possible, since we don't need to be clever for something that
3382 only happens in one of our benchmarks.
3383
3384 * dfg/DFGAbstractState.cpp:
3385 (JSC::DFG::AbstractState::execute):
3386 * dfg/DFGConstantFoldingPhase.cpp:
3387 (JSC::DFG::ConstantFoldingPhase::run):
3388 * dfg/DFGJITCompiler.h:
3389 (JSC::DFG::JITCompiler::noticeOSREntry):
3390 * dfg/DFGSpeculativeJIT.cpp:
3391 (JSC::DFG::SpeculativeJIT::compile):
3392
carlosgc@webkit.orgb69727c2012-05-28 10:21:31 +000033932012-05-28 Carlos Garcia Campos <cgarcia@igalia.com>
3394
3395 Unreviewed. Fix make distcheck.
3396
3397 * GNUmakefile.list.am: Add missing header file.
3398
ggaren@apple.comb816d752012-05-28 04:56:01 +000033992012-05-27 Geoffrey Garen <ggaren@apple.com>
3400
3401 Weak pointer finalization should be lazy
3402 https://bugs.webkit.org/show_bug.cgi?id=87599
3403
3404 Reviewed by Darin Adler.
3405
3406 * heap/Heap.cpp:
3407 (JSC::Heap::collect): Don't force immediate finalization -- it will
3408 happen lazily.
3409
3410 * heap/MarkedBlock.cpp:
3411 (JSC::MarkedBlock::sweep): Sweep a block's weak set when sweeping the
3412 block. The weak set may not have been swept yet, and this is our last
3413 chance to run weak finalizers before we recycle the memory they reference.
3414
3415 * heap/MarkedBlock.h:
3416 * heap/MarkedSpace.cpp:
3417 (JSC::MarkedBlock::sweepWeakSets):
3418 * heap/MarkedSpace.h:
3419 (JSC::MarkedSpace::sweepWeakSets): Nixed sweepWeakSets because it's unused
3420 now.
3421
ggaren@apple.com72da8112012-05-26 22:40:46 +000034222012-05-26 Geoffrey Garen <ggaren@apple.com>
3423
3424 WebKit should be lazy-finalization-safe (esp. the DOM) v2
3425 https://bugs.webkit.org/show_bug.cgi?id=87581
3426
3427 Reviewed by Oliver Hunt.
3428
3429 * heap/MarkedBlock.cpp:
3430 (JSC::MarkedBlock::callDestructor):
3431 * heap/WeakBlock.h:
3432 * heap/WeakSetInlines.h:
3433 (JSC::WeakBlock::finalize): Since we don't guarantee destruction order,
3434 it's not valid to access GC pointers like the Structure pointer during
3435 finalization. We NULL out the structure pointer in debug builds to try
3436 to make this programming mistake more obvious.
3437
3438 * API/JSCallbackConstructor.cpp:
3439 (JSC::JSCallbackConstructor::destroy):
3440 * API/JSCallbackObject.cpp:
3441 (JSC::::destroy):
3442 (JSC::JSCallbackObjectData::finalize):
3443 * runtime/Arguments.cpp:
3444 (JSC::Arguments::destroy):
3445 * runtime/DateInstance.cpp:
3446 (JSC::DateInstance::destroy):
3447 * runtime/Error.cpp:
3448 (JSC::StrictModeTypeErrorFunction::destroy):
3449 * runtime/Executable.cpp:
3450 (JSC::ExecutableBase::destroy):
3451 (JSC::NativeExecutable::destroy):
3452 (JSC::ScriptExecutable::destroy):
3453 (JSC::EvalExecutable::destroy):
3454 (JSC::ProgramExecutable::destroy):
3455 (JSC::FunctionExecutable::destroy):
3456 * runtime/JSGlobalObject.cpp:
3457 (JSC::JSGlobalObject::destroy):
3458 * runtime/JSPropertyNameIterator.cpp:
3459 (JSC::JSPropertyNameIterator::destroy):
3460 * runtime/JSStaticScopeObject.cpp:
3461 (JSC::JSStaticScopeObject::destroy):
3462 * runtime/JSString.cpp:
3463 (JSC::JSString::destroy):
3464 * runtime/JSVariableObject.cpp:
3465 (JSC::JSVariableObject::destroy):
3466 * runtime/NameInstance.cpp:
3467 (JSC::NameInstance::destroy):
3468 * runtime/RegExp.cpp:
3469 (JSC::RegExp::destroy):
3470 * runtime/RegExpConstructor.cpp:
3471 (JSC::RegExpConstructor::destroy):
3472 * runtime/Structure.cpp:
3473 (JSC::Structure::destroy):
3474 * runtime/StructureChain.cpp:
3475 (JSC::StructureChain::destroy): Use static_cast instead of jsCast because
3476 jsCast does Structure-based validation, and our Structure is not guaranteed
3477 to be alive when we get finalized.
3478
fpizlo@apple.com7e0f6502012-05-25 22:45:57 +000034792012-05-22 Filip Pizlo <fpizlo@apple.com>
3480
fpizlo@apple.com190f5252012-05-25 23:00:26 +00003481 DFG CSE should eliminate redundant WeakJSConstants
3482 https://bugs.webkit.org/show_bug.cgi?id=87179
3483
3484 Reviewed by Gavin Barraclough.
3485
3486 Merged r118141 from dfgopt.
3487
3488 * dfg/DFGCSEPhase.cpp:
3489 (JSC::DFG::CSEPhase::weakConstantCSE):
3490 (CSEPhase):
3491 (JSC::DFG::CSEPhase::performNodeCSE):
3492 * dfg/DFGNode.h:
3493 (JSC::DFG::Node::weakConstant):
3494
34952012-05-22 Filip Pizlo <fpizlo@apple.com>
3496
fpizlo@apple.com7e0f6502012-05-25 22:45:57 +00003497 DFG CSE should do redundant store elimination
3498 https://bugs.webkit.org/show_bug.cgi?id=87161
3499
3500 Reviewed by Oliver Hunt.
3501
3502 Merge r118138 from dfgopt.
3503
3504 This patch adds redundant store elimination. For example, consider this
3505 code:
3506
3507 o.x = 42;
3508 o.x = 84;
3509
3510 If o.x is speculated to be a well-behaved field, the first assignment is
3511 unnecessary, since the second just overwrites it. We would like to
3512 eliminate the first assignment in these cases. The need for this
3513 optimization arises mostly from stores that our runtime requires. For
3514 example:
3515
3516 o = {f:1, g:2, h:3};
3517
3518 This will have four assignments to the structure for the newly created
3519 object - one assignment for the empty structure, one for {f}, one for
3520 {f, g}, and one for {f, g, h}. We would like to only have the last of
3521 those assigments in this case.
3522
3523 Intriguingly, doing so for captured variables breaks the way arguments
3524 simplification used to work. Consider that prior to either arguments
3525 simplification or store elimination we will have IR that looks like:
3526
3527 a: SetLocal(r0, Empty)
3528 b: SetLocal(r1, Empty)
3529 c: GetLocal(r0)
3530 d: CreateArguments(@c)
3531 e: SetLocal(r0, @d)
3532 f: SetLocal(r1, @d)
3533
3534 Then redundant store elimination will eliminate the stores that
3535 initialize the arguments registers to Empty, but then arguments
3536 simplification eliminates the stores that initialize the arguments to
3537 the newly created arguments - and at this point we no longer have any
3538 stores to the arguments register, leading to hilarious crashes. This
3539 patch therefore changes arguments simplification to replace
3540 CreateArguments with JSConstant(Empty) rather than eliminating the
3541 SetLocals. But this revealed bugs where arguments simplification was
3542 being overzealous, so I fixed those bugs.
3543
3544 This is a minor speed-up on V8/early and a handful of other tests.
3545
3546 * bytecode/CodeBlock.h:
3547 (JSC::CodeBlock::uncheckedActivationRegister):
3548 * dfg/DFGAbstractState.cpp:
3549 (JSC::DFG::AbstractState::execute):
3550 * dfg/DFGArgumentsSimplificationPhase.cpp:
3551 (JSC::DFG::ArgumentsSimplificationPhase::run):
3552 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
3553 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUses):
3554 (JSC::DFG::ArgumentsSimplificationPhase::observeProperArgumentsUse):
3555 * dfg/DFGCSEPhase.cpp:
3556 (JSC::DFG::CSEPhase::globalVarStoreElimination):
3557 (CSEPhase):
3558 (JSC::DFG::CSEPhase::putStructureStoreElimination):
3559 (JSC::DFG::CSEPhase::putByOffsetStoreElimination):
3560 (JSC::DFG::CSEPhase::setLocalStoreElimination):
3561 (JSC::DFG::CSEPhase::setReplacement):
3562 (JSC::DFG::CSEPhase::eliminate):
3563 (JSC::DFG::CSEPhase::performNodeCSE):
3564 * dfg/DFGGraph.h:
3565 (JSC::DFG::Graph::uncheckedActivationRegisterFor):
3566 (Graph):
3567 * dfg/DFGNode.h:
3568 (JSC::DFG::Node::isPhantomArguments):
3569 (Node):
3570 (JSC::DFG::Node::hasConstant):
3571 (JSC::DFG::Node::valueOfJSConstant):
3572 (JSC::DFG::Node::hasStructureTransitionData):
3573 * dfg/DFGNodeType.h:
3574 (DFG):
3575 * dfg/DFGPredictionPropagationPhase.cpp:
3576 (JSC::DFG::PredictionPropagationPhase::propagate):
3577 * dfg/DFGSpeculativeJIT.cpp:
3578 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
3579 * dfg/DFGSpeculativeJIT32_64.cpp:
3580 (JSC::DFG::SpeculativeJIT::compile):
3581 * dfg/DFGSpeculativeJIT64.cpp:
3582 (JSC::DFG::SpeculativeJIT::compile):
3583
fpizlo@apple.com016fd682012-05-25 20:19:55 +000035842012-05-21 Filip Pizlo <fpizlo@apple.com>
3585
3586 DFG ConvertThis should just be a CheckStructure if the structure is known
3587 https://bugs.webkit.org/show_bug.cgi?id=87057
3588
3589 Reviewed by Gavin Barraclough.
3590
3591 Merged r118021 from dfgopt.
3592
3593 This gives ValueProfile the ability to track singleton values - i.e. profiling
3594 sites that always see the same value.
3595
3596 That is then used to profile the structure in op_convert_this.
3597
3598 This is then used to optimize op_convert_this into a CheckStructure if the
3599 structure is always the same.
3600
3601 That then results in better CSE in inlined code that uses 'this', since
3602 previously we couldn't CSE accesses on 'this' from different inline call frames.
3603
3604 Also fixed a bug where we were unnecessarily flushing 'this'.
3605
3606 * bytecode/CodeBlock.cpp:
3607 (JSC::CodeBlock::dump):
3608 (JSC::CodeBlock::stronglyVisitStrongReferences):
3609 * bytecode/LazyOperandValueProfile.cpp:
3610 (JSC::CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions):
3611 * bytecode/LazyOperandValueProfile.h:
3612 (CompressedLazyOperandValueProfileHolder):
3613 * bytecode/Opcode.h:
3614 (JSC):
3615 (JSC::padOpcodeName):
3616 * bytecode/ValueProfile.h:
3617 (JSC::ValueProfileBase::ValueProfileBase):
3618 (JSC::ValueProfileBase::dump):
3619 (JSC::ValueProfileBase::computeUpdatedPrediction):
3620 (ValueProfileBase):
3621 * bytecompiler/BytecodeGenerator.cpp:
3622 (JSC::BytecodeGenerator::BytecodeGenerator):
3623 * dfg/DFGByteCodeParser.cpp:
3624 (JSC::DFG::ByteCodeParser::setArgument):
3625 (JSC::DFG::ByteCodeParser::parseBlock):
3626 * jit/JITOpcodes.cpp:
3627 (JSC::JIT::emit_op_convert_this):
3628 (JSC::JIT::emitSlow_op_convert_this):
3629 * jit/JITOpcodes32_64.cpp:
3630 (JSC::JIT::emit_op_convert_this):
3631 (JSC::JIT::emitSlow_op_convert_this):
3632 * llint/LLIntSlowPaths.cpp:
3633 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
3634 * llint/LowLevelInterpreter32_64.asm:
3635 * llint/LowLevelInterpreter64.asm:
3636 * runtime/JSValue.h:
3637 (JSValue):
3638 * runtime/Structure.h:
3639 (JSC::JSValue::structureOrUndefined):
3640 (JSC):
3641
timothy_horton@apple.com3f03ac12012-05-25 06:53:27 +000036422012-05-24 Tim Horton <timothy_horton@apple.com>
3643
3644 Add feature defines for web-facing parts of CSS Regions and Exclusions
3645 https://bugs.webkit.org/show_bug.cgi?id=87442
3646 <rdar://problem/10887709>
3647
3648 Reviewed by Dan Bernstein.
3649
3650 * Configurations/FeatureDefines.xcconfig:
3651
ggaren@apple.com9e1789f2012-05-25 06:52:00 +000036522012-05-24 Geoffrey Garen <ggaren@apple.com>
3653
3654 WebKit should be lazy-finalization-safe (esp. the DOM)
3655 https://bugs.webkit.org/show_bug.cgi?id=87456
3656
3657 Reviewed by Filip Pizlo.
3658
3659 Lazy finalization adds one twist to weak pointer use:
3660
3661 A HashMap of weak pointers may contain logically null entries.
3662 (Weak pointers behave as-if null once their payloads die.)
3663 Insertion must not assume that a pre-existing entry is
3664 necessarily valid, and iteration must not assume that all
3665 entries can be dereferenced.
3666
3667 (Previously, I thought that it also added a second twist:
3668
3669 A demand-allocated weak pointer may replace a dead payload
3670 before the payload's finalizer runs. In that case, when the
3671 payload's finalizer runs, the payload has already been
3672 overwritten, and the finalizer should not clear the payload,
3673 which now points to something new.
3674
3675 But that's not the case here, since we cancel the old payload's
3676 finalizer when we over-write it. I've added ASSERTs to verify this
3677 assumption, in case it ever changes.)
3678
3679 * API/JSClassRef.cpp:
3680 (OpaqueJSClass::prototype): No need to specify null; that's the default.
3681
3682 * API/JSWeakObjectMapRefPrivate.cpp: Use remove, since take() is gone.
3683
3684 * heap/PassWeak.h:
3685 (WeakImplAccessor::was): This is no longer a debug-only function, since
3686 it's required to reason about lazily finalized pointers.
3687
3688 * heap/Weak.h:
3689 (JSC::weakAdd):
3690 (JSC::weakRemove):
3691 (JSC::weakClear): Added these helper functions for the common idioms of
3692 what clients want to do in their weak pointer finalizers.
3693
3694 * jit/JITStubs.cpp:
3695 (JSC::JITThunks::hostFunctionStub): Use the new idioms. Otherwise, we
3696 would return NULL for a "zombie" executable weak pointer that was waiting
3697 for finalization (item (2)), and finalizing a dead executable weak pointer
3698 would potentially destroy a new, live one (item (1)).
3699
3700 * runtime/RegExpCache.cpp:
3701 (JSC::RegExpCache::lookupOrCreate):
3702 (JSC::RegExpCache::finalize): Ditto.
3703
3704 (JSC::RegExpCache::invalidateCode): Check for null while iterating. (See
3705 item (2).)
3706
3707 * runtime/Structure.cpp:
3708 (JSC::StructureTransitionTable::contains):
3709 (JSC::StructureTransitionTable::add): Use get and set instead of add and
3710 contains, since add and contains are not compatible with lazy finalization.
3711
3712 * runtime/WeakGCMap.h:
3713 (WeakGCMap):
3714 (JSC::WeakGCMap::clear):
3715 (JSC::WeakGCMap::remove): Removed a bunch of code that was incompatible with
3716 lazy finalization because I didn't feel like making it compatible, and I had
3717 no way to test it.
3718
fpizlo@apple.com0b9b37a2012-05-25 03:29:18 +000037192012-05-24 Filip Pizlo <fpizlo@apple.com>
3720
fpizlo@apple.com9d899a42012-05-25 05:41:03 +00003721 REGRESSION (r118013-r118031): Loops/Reloads under www.yahoo.com, quits after three tries with error
3722 https://bugs.webkit.org/show_bug.cgi?id=87327
3723
3724 Reviewed by Geoffrey Garen.
3725
3726 If you use AbstractValue::filter(StructureSet) to test subset relationships between TOP and a
3727 set containing >=2 elements, you're going to have a bad time.
3728
3729 That's because AbstractValue considers a set with >=2 elements to be equivalent to TOP, in order
3730 to save space and speed up convergence. So filtering has no effect in this case, which made
3731 the code think that the abstract value was proving that the structure check was unnecessary.
3732 The correct thing to do is to use isSubsetOf() on the StructureAbstractValue, which does the
3733 right thingies for TOP and >=2 elements.
3734
3735 * dfg/DFGAbstractState.cpp:
3736 (JSC::DFG::AbstractState::execute):
3737 * dfg/DFGSpeculativeJIT32_64.cpp:
3738 (JSC::DFG::SpeculativeJIT::compile):
3739 * dfg/DFGSpeculativeJIT64.cpp:
3740 (JSC::DFG::SpeculativeJIT::compile):
3741
37422012-05-24 Filip Pizlo <fpizlo@apple.com>
3743
fpizlo@apple.com0b9b37a2012-05-25 03:29:18 +00003744 new test fast/js/dfg-arguments-mixed-alias.html fails on JSVALUE32_64
3745 https://bugs.webkit.org/show_bug.cgi?id=87378
3746
3747 Reviewed by Gavin Barraclough.
3748
3749 - Captured variable tracking forgot did not consistently handle arguments, leading to OSR
3750 badness.
3751
3752 - Nodes capable of exiting were tracked in a non-monotonic way, leading to compiler errors.
3753
3754 * dfg/DFGByteCodeParser.cpp:
3755 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
3756 * dfg/DFGCSEPhase.cpp:
3757 (JSC::DFG::CSEPhase::CSEPhase):
3758 (CSEPhase):
3759 (JSC::DFG::performCSE):
3760 * dfg/DFGCSEPhase.h:
3761 (DFG):
3762 * dfg/DFGCommon.h:
3763 * dfg/DFGDriver.cpp:
3764 (JSC::DFG::compile):
3765 * dfg/DFGGraph.cpp:
3766 (JSC::DFG::Graph::resetExitStates):
3767 (DFG):
3768 * dfg/DFGGraph.h:
3769 (Graph):
3770 * dfg/DFGPhase.h:
3771 (DFG):
3772 (JSC::DFG::runPhase):
3773
ggaren@apple.com39281e22012-05-24 21:18:10 +000037742012-05-24 Geoffrey Garen <ggaren@apple.com>
3775
3776 Made WeakSet per-block instead of per-heap
3777 https://bugs.webkit.org/show_bug.cgi?id=87401
3778
3779 Reviewed by Oliver Hunt.
3780
3781 This allows us fast access to the set of all weak pointers for a block,
3782 which is a step toward lazy finalization.
3783
3784 No performance change.
3785
3786 * heap/Heap.cpp:
3787 (JSC::Heap::Heap):
3788 (JSC::Heap::lastChanceToFinalize): Removed the per-heap weak set, since
3789 it's per-block now.
3790
3791 (JSC::Heap::markRoots): Delegate weak set visiting to the marked space,
3792 since it knows how to iterate all blocks.
3793
3794 (JSC::Heap::collect): Moved the reaping outside of markRoots, since it
3795 doesn't mark anything.
3796
3797 Make sure to reset allocators after shrinking, since shrinking may
3798 deallocate the current allocator.
3799
3800 * heap/Heap.h:
3801 (Heap): No more per-heap weak set, since it's per-block now.
3802
3803 * heap/MarkedBlock.cpp:
3804 (JSC::MarkedBlock::MarkedBlock):
3805 * heap/MarkedBlock.h:
3806 (MarkedBlock):
3807 (JSC::MarkedBlock::lastChanceToFinalize): Migrated finalization logic
3808 here from the heap, so the heap doesn't need to know about our internal
3809 data structures like our weak set.
3810
3811 (JSC::MarkedBlock::heap):
3812 (JSC::MarkedBlock::weakSet):
3813 (JSC::MarkedBlock::shrink):
3814 (JSC::MarkedBlock::resetAllocator):
3815 (JSC::MarkedBlock::visitWeakSet):
3816 (JSC::MarkedBlock::reapWeakSet):
3817 (JSC::MarkedBlock::sweepWeakSet):
3818 * heap/MarkedSpace.cpp:
3819 (JSC::VisitWeakSet::VisitWeakSet):
3820 (JSC::VisitWeakSet::operator()):
3821 (VisitWeakSet):
3822 (JSC):
3823 (JSC::ReapWeakSet::operator()):
3824 (JSC::SweepWeakSet::operator()):
3825 (JSC::LastChanceToFinalize::operator()):
3826 (JSC::MarkedSpace::lastChanceToFinalize):
3827 (JSC::ResetAllocator::operator()):
3828 (JSC::MarkedSpace::resetAllocators):
3829 (JSC::MarkedSpace::visitWeakSets):
3830 (JSC::MarkedSpace::reapWeakSets):
3831 (JSC::MarkedSpace::sweepWeakSets):
3832 (JSC::Shrink::operator()):
3833 (JSC::MarkedSpace::shrink):
3834 * heap/MarkedSpace.h:
3835 (MarkedSpace): Make sure to account for our weak sets when sweeping,
3836 shrinking, etc.
3837
3838 * heap/WeakSet.cpp:
3839 (JSC):
3840 * heap/WeakSet.h:
3841 (WeakSet):
3842 (JSC::WeakSet::heap):
3843 (JSC):
3844 (JSC::WeakSet::lastChanceToFinalize):
3845 (JSC::WeakSet::visit):
3846 (JSC::WeakSet::reap):
3847 (JSC::WeakSet::shrink):
3848 (JSC::WeakSet::resetAllocator): Inlined some things since they're called
3849 once per block now instead of once per heap.
3850
3851 * heap/WeakSetInlines.h:
3852 (JSC::WeakSet::allocate): Use the per-block weak set since there is no
3853 per-heap weak set anymore.
3854
barraclough@apple.comefdbf472012-05-24 21:14:07 +000038552012-05-24 Gavin Barraclough <barraclough@apple.com>
3856
barraclough@apple.com8ca6a7a2012-05-24 21:17:38 +00003857 Fix arm build
3858
3859 Rubber stamped by Geoff Garen
3860
3861 * dfg/DFGGPRInfo.h:
3862 (GPRInfo):
3863
38642012-05-24 Gavin Barraclough <barraclough@apple.com>
3865
barraclough@apple.comefdbf472012-05-24 21:14:07 +00003866 Move cacheFlush from ExecutableAllocator to Assembler classes
3867 https://bugs.webkit.org/show_bug.cgi?id=87420
3868
3869 Reviewed by Oliver Hunt.
3870
3871 Makes more sense there, & remove a pile of #ifdefs.
3872
3873 * assembler/ARMAssembler.cpp:
3874 (JSC):
3875 (JSC::ARMAssembler::cacheFlush):
3876 * assembler/ARMAssembler.h:
3877 (ARMAssembler):
3878 (JSC::ARMAssembler::cacheFlush):
3879 * assembler/ARMv7Assembler.h:
3880 (JSC::ARMv7Assembler::relinkJump):
3881 (JSC::ARMv7Assembler::cacheFlush):
3882 (ARMv7Assembler):
3883 (JSC::ARMv7Assembler::setInt32):
3884 (JSC::ARMv7Assembler::setUInt7ForLoad):
3885 * assembler/AbstractMacroAssembler.h:
3886 (JSC::AbstractMacroAssembler::cacheFlush):
3887 * assembler/LinkBuffer.h:
3888 (JSC::LinkBuffer::performFinalization):
3889 * assembler/MIPSAssembler.h:
3890 (JSC::MIPSAssembler::relinkJump):
3891 (JSC::MIPSAssembler::relinkCall):
3892 (JSC::MIPSAssembler::repatchInt32):
3893 (JSC::MIPSAssembler::cacheFlush):
3894 (MIPSAssembler):
3895 * assembler/SH4Assembler.h:
3896 (JSC::SH4Assembler::repatchCompact):
3897 (JSC::SH4Assembler::cacheFlush):
3898 (SH4Assembler):
3899 * assembler/X86Assembler.h:
3900 (X86Assembler):
3901 (JSC::X86Assembler::cacheFlush):
3902 * jit/ExecutableAllocator.cpp:
3903 (JSC):
3904 * jit/ExecutableAllocator.h:
3905 (ExecutableAllocator):
3906
commit-queue@webkit.org2c8bcde2012-05-24 20:01:53 +000039072012-05-24 John Mellor <johnme@chromium.org>
3908
3909 Font Boosting: Add compile flag and runtime setting
3910 https://bugs.webkit.org/show_bug.cgi?id=87394
3911
3912 Reviewed by Adam Barth.
3913
3914 Add ENABLE_FONT_BOOSTING.
3915
3916 * Configurations/FeatureDefines.xcconfig:
3917
commit-queue@webkit.orgd553c622012-05-24 10:50:40 +000039182012-05-24 Allan Sandfeld Jensen <allan.jensen@nokia.com>
3919
3920 cti_vm_throw gets kicked out by gcc 4.6 -flto
3921 https://bugs.webkit.org/show_bug.cgi?id=56088
3922
3923 Reviewed by Darin Adler.
3924
3925 Add REFERENCED_FROM_ASM to functions only referenced from assembler.
3926
3927 * dfg/DFGOperations.cpp:
3928 * jit/HostCallReturnValue.h:
3929 * jit/JITStubs.h:
3930 * jit/ThunkGenerators.cpp:
3931
fpizlo@apple.com36f14462012-05-24 07:35:05 +000039322012-05-24 Filip Pizlo <fpizlo@apple.com>
3933
3934 Incorrect merge of r117542 from dfg opt branch in r118323 is leading to fast/js/dfg-arguments-osr-exit.html failing
3935 https://bugs.webkit.org/show_bug.cgi?id=87350
3936
3937 Reviewed by Maciej Stachowiak.
3938
3939 The dfgopt branch introduced the notion of a local variable being killed because it was aliased
3940 to the Arguments object as in cases like:
3941
3942 var a = arguments;
3943 return a.length;
3944
3945 This required changes to OSR exit handling - if the variable is dead but aliased to arguments, then
3946 OSR exit should reify the arguments. But meanwhile, in tip of tree we introduced special handling for
3947 dead variables on OSR exit. When the two were merged in r118323, the structure of the if/else branches
3948 ended up being such that we would treat dead arguments variables as totally dead as opposed to treating
3949 them as variables that need arguments reification.
3950
3951 This fixes the structure of the relevant if/else block so that variables that are dead-but-arguments
3952 end up being treated as reified arguments objects, while variables that are dead but not aliased to
3953 arguments are treated as tip of tree would have treated them (initialize to Undefined).
3954
3955 * dfg/DFGSpeculativeJIT.cpp:
3956 (JSC::DFG::SpeculativeJIT::compile):
3957
ossy@webkit.orgbc0d6372012-05-24 07:05:31 +000039582012-05-24 Csaba Osztrogonác <ossy@webkit.org>
3959
3960 Unreviewed 32 bit buildfix after r118325.
3961
3962 * dfg/DFGSpeculativeJIT32_64.cpp:
3963 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): Use ASSERT_UNUSED instead ASSERT.
3964
fpizlo@apple.comd96eb4e2012-05-24 06:58:52 +000039652012-05-23 Filip Pizlo <fpizlo@apple.com>
3966
fpizlo@apple.comb3ac2422012-05-24 07:00:24 +00003967 DFG operationTearOffActivation should return after handling the null activation case
3968 https://bugs.webkit.org/show_bug.cgi?id=87348
3969 <rdar://problem/11522295>
3970
3971 Reviewed by Oliver Hunt.
3972
3973 * dfg/DFGOperations.cpp:
3974
39752012-05-23 Filip Pizlo <fpizlo@apple.com>
3976
fpizlo@apple.comd96eb4e2012-05-24 06:58:52 +00003977 Unreviewed, merge the arguments fix in r118138 to get bots green.
3978
3979 * dfg/DFGArgumentsSimplificationPhase.cpp:
3980 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
3981
fpizlo@apple.comb9c94622012-05-24 05:51:05 +000039822012-05-20 Filip Pizlo <fpizlo@apple.com>
3983
fpizlo@apple.com91b2c682012-05-24 06:24:36 +00003984 DFG CFA should record if a node can OSR exit
3985 https://bugs.webkit.org/show_bug.cgi?id=86905
3986
3987 Reviewed by Oliver Hunt.
3988
3989 Merged r117931 from dfgopt.
3990
3991 Adds a NodeFlag that denotes nodes that are known to not have OSR exits.
3992 This ought to aid any backwards analyses that need to know when a
3993 backward flow merge might happen due to a side exit.
3994
3995 Also added assertions into speculationCheck() that ensure that we did not
3996 mark a node as non-exiting and then promptly compile in an exit. This
3997 helped catch some minor bugs where we were doing unnecessary speculation
3998 checks.
3999
4000 This is a perf-neutral change. The speculation checks that this removes
4001 were not on hot paths of major benchmarks.
4002
4003 * bytecode/PredictedType.h:
4004 (JSC):
4005 (JSC::isAnyPrediction):
4006 * dfg/DFGAbstractState.cpp:
4007 (JSC::DFG::AbstractState::execute):
4008 * dfg/DFGAbstractState.h:
4009 (JSC::DFG::AbstractState::speculateInt32Unary):
4010 (AbstractState):
4011 (JSC::DFG::AbstractState::speculateNumberUnary):
4012 (JSC::DFG::AbstractState::speculateBooleanUnary):
4013 (JSC::DFG::AbstractState::speculateInt32Binary):
4014 (JSC::DFG::AbstractState::speculateNumberBinary):
4015 * dfg/DFGNode.h:
4016 (JSC::DFG::Node::mergeFlags):
4017 (JSC::DFG::Node::filterFlags):
4018 (Node):
4019 (JSC::DFG::Node::setCanExit):
4020 (JSC::DFG::Node::canExit):
4021 * dfg/DFGNodeFlags.cpp:
4022 (JSC::DFG::nodeFlagsAsString):
4023 * dfg/DFGNodeFlags.h:
4024 (DFG):
4025 * dfg/DFGSpeculativeJIT.cpp:
4026 (JSC::DFG::SpeculativeJIT::SpeculativeJIT):
4027 (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
4028 (JSC::DFG::SpeculativeJIT::compileValueToInt32):
4029 * dfg/DFGSpeculativeJIT.h:
4030 (JSC::DFG::SpeculativeJIT::speculationCheck):
4031 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
4032 (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution):
4033 (SpeculativeJIT):
4034 * dfg/DFGSpeculativeJIT32_64.cpp:
4035 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
4036 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
4037 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
4038 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
4039 (JSC::DFG::SpeculativeJIT::compile):
4040 * dfg/DFGSpeculativeJIT64.cpp:
4041 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
4042 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
4043 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
4044 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
4045 (JSC::DFG::SpeculativeJIT::compile):
4046
40472012-05-20 Filip Pizlo <fpizlo@apple.com>
4048
fpizlo@apple.comb9c94622012-05-24 05:51:05 +00004049 DFG should not do unnecessary indirections when storing to objects
4050 https://bugs.webkit.org/show_bug.cgi?id=86959
4051
4052 Reviewed by Oliver Hunt.
4053
4054 Merged r117819 from dfgopt.
4055
4056 * dfg/DFGByteCodeParser.cpp:
4057 (JSC::DFG::ByteCodeParser::parseBlock):
4058 * dfg/DFGCSEPhase.cpp:
4059 (JSC::DFG::CSEPhase::getByOffsetLoadElimination):
4060 * dfg/DFGSpeculativeJIT32_64.cpp:
4061 (JSC::DFG::SpeculativeJIT::compile):
4062 * dfg/DFGSpeculativeJIT64.cpp:
4063 (JSC::DFG::SpeculativeJIT::compile):
4064
fpizlo@apple.com9a548f12012-05-24 05:33:09 +000040652012-05-17 Filip Pizlo <fpizlo@apple.com>
4066
4067 DFG should optimize aliased uses of the Arguments object of the current call frame
4068 https://bugs.webkit.org/show_bug.cgi?id=86552
4069
4070 Reviewed by Geoff Garen.
4071
4072 Merged r117542 and r117543 from dfgopt.
4073
4074 Performs must-alias and escape analysis on uses of CreateArguments, and if
4075 a variable is must-aliased to CreateArguments and does not escape, then we
4076 turn all uses of that variable into direct arguments accesses.
4077
4078 36% speed-up on V8/earley leading to a 2.3% speed-up overall in V8.
4079
4080 * bytecode/CodeBlock.h:
4081 (JSC::CodeBlock::uncheckedArgumentsRegister):
4082 * bytecode/ValueRecovery.h:
4083 (JSC::ValueRecovery::argumentsThatWereNotCreated):
4084 (ValueRecovery):
4085 (JSC::ValueRecovery::dump):
4086 * dfg/DFGAbstractState.cpp:
4087 (JSC::DFG::AbstractState::execute):
4088 * dfg/DFGAdjacencyList.h:
4089 (AdjacencyList):
4090 (JSC::DFG::AdjacencyList::removeEdgeFromBag):
4091 * dfg/DFGArgumentsSimplificationPhase.cpp:
4092 (JSC::DFG::ArgumentsSimplificationPhase::run):
4093 (ArgumentsSimplificationPhase):
4094 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
4095 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUses):
4096 (JSC::DFG::ArgumentsSimplificationPhase::observeProperArgumentsUse):
4097 (JSC::DFG::ArgumentsSimplificationPhase::isOKToOptimize):
4098 (JSC::DFG::ArgumentsSimplificationPhase::removeArgumentsReferencingPhantomChild):
4099 * dfg/DFGAssemblyHelpers.h:
4100 (JSC::DFG::AssemblyHelpers::argumentsRegisterFor):
4101 (AssemblyHelpers):
4102 * dfg/DFGByteCodeParser.cpp:
4103 (JSC::DFG::ByteCodeParser::parseBlock):
4104 * dfg/DFGCFGSimplificationPhase.cpp:
4105 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
4106 * dfg/DFGGPRInfo.h:
4107 (GPRInfo):
4108 * dfg/DFGGraph.cpp:
4109 (JSC::DFG::Graph::collectGarbage):
4110 (DFG):
4111 * dfg/DFGGraph.h:
4112 (Graph):
4113 (JSC::DFG::Graph::executableFor):
4114 (JSC::DFG::Graph::argumentsRegisterFor):
4115 (JSC::DFG::Graph::uncheckedArgumentsRegisterFor):
4116 (JSC::DFG::Graph::clobbersWorld):
4117 * dfg/DFGNode.h:
4118 (JSC::DFG::Node::hasHeapPrediction):
4119 * dfg/DFGNodeType.h:
4120 (DFG):
4121 * dfg/DFGOSRExitCompiler.cpp:
4122 * dfg/DFGOSRExitCompiler.h:
4123 (JSC::DFG::OSRExitCompiler::OSRExitCompiler):
4124 (OSRExitCompiler):
4125 * dfg/DFGOSRExitCompiler32_64.cpp:
4126 (JSC::DFG::OSRExitCompiler::compileExit):
4127 * dfg/DFGOSRExitCompiler64.cpp:
4128 (JSC::DFG::OSRExitCompiler::compileExit):
4129 * dfg/DFGOperations.cpp:
4130 * dfg/DFGPredictionPropagationPhase.cpp:
4131 (JSC::DFG::PredictionPropagationPhase::propagate):
4132 * dfg/DFGSpeculativeJIT.cpp:
4133 (JSC::DFG::ValueSource::dump):
4134 (JSC::DFG::SpeculativeJIT::compile):
4135 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
4136 * dfg/DFGSpeculativeJIT.h:
4137 * dfg/DFGSpeculativeJIT32_64.cpp:
4138 (JSC::DFG::SpeculativeJIT::compile):
4139 * dfg/DFGSpeculativeJIT64.cpp:
4140 (JSC::DFG::SpeculativeJIT::compile):
4141 * dfg/DFGVariableAccessData.h:
4142 (JSC::DFG::VariableAccessData::VariableAccessData):
4143 (JSC::DFG::VariableAccessData::mergeIsArgumentsAlias):
4144 (VariableAccessData):
4145 (JSC::DFG::VariableAccessData::isArgumentsAlias):
4146 * jit/JITOpcodes.cpp:
4147 (JSC::JIT::emitSlow_op_get_argument_by_val):
4148
fpizlo@apple.comdb7ba192012-05-24 02:28:52 +000041492012-05-23 Filip Pizlo <fpizlo@apple.com>
4150
fpizlo@apple.comae3413b2012-05-24 02:34:09 +00004151 DFGCapabilities should not try to get an arguments register from code blocks that don't have one
4152 https://bugs.webkit.org/show_bug.cgi?id=87332
4153
4154 Reviewed by Andy Estes.
4155
4156 * dfg/DFGCapabilities.h:
4157 (JSC::DFG::canInlineOpcode):
4158
41592012-05-23 Filip Pizlo <fpizlo@apple.com>
4160
fpizlo@apple.comdb7ba192012-05-24 02:28:52 +00004161 DFG should have sparse conditional constant propagation
4162 https://bugs.webkit.org/show_bug.cgi?id=86580
4163
4164 Reviewed by Oliver Hunt.
4165
4166 Merged r117370 from dfgopt.
4167
4168 This enhances CFA so that if it suspects at any point during the fixpoint that a
4169 branch will only go one way, then it only propagates in that one way.
4170
4171 This vastly increases the opportunities for CFG simplification. For example, it
4172 enables us to evaporate this loop:
4173
4174 for (var i = 0; i < 1; ++i) doThings(i);
4175
4176 As a result, it uncovered loads of bugs in the CFG simplifier. In particular:
4177
4178 - Phi fixup was assuming that all Phis worth fixing up are shouldGenerate().
4179 That's not true; we also fixup Phis that are dead.
4180
4181 - GetLocal fixup was assuming that it's only necessary to rewire links to a
4182 GetLocal, and that the GetLocal's own links don't need to be rewired. Untrue,
4183 because the GetLocal may not be rewirable (first block has no GetLocal for r42
4184 but second block does have a GetLocal), in which case it will refer to a Phi
4185 in the second block. We need it to refer to a Phi from the first block to
4186 ensure that subsequent transformations work.
4187
4188 - Tail operand fixup was ignoring the fact that Phis in successors may contain
4189 references to the children of our tail variables. Hence, successor Phi child
4190 substitution needs to use the original second block variable table as its
4191 prior, rather than trying to reconstruct the prior later (since by that point
4192 the children of the second block's tail variables will have been fixed up, so
4193 we will not know what the prior would have been).
4194
4195 * dfg/DFGAbstractState.cpp:
4196 (JSC::DFG::AbstractState::beginBasicBlock):
4197 (JSC::DFG::AbstractState::endBasicBlock):
4198 (JSC::DFG::AbstractState::reset):
4199 (JSC::DFG::AbstractState::execute):
4200 (JSC::DFG::AbstractState::mergeToSuccessors):
4201 * dfg/DFGAbstractState.h:
4202 (JSC::DFG::AbstractState::branchDirectionToString):
4203 (AbstractState):
4204 * dfg/DFGCFGSimplificationPhase.cpp:
4205 (JSC::DFG::CFGSimplificationPhase::run):
4206 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
4207 (JSC::DFG::CFGSimplificationPhase::OperandSubstitution::OperandSubstitution):
4208 (OperandSubstitution):
4209 (JSC::DFG::CFGSimplificationPhase::skipGetLocal):
4210 (JSC::DFG::CFGSimplificationPhase::recordPossibleIncomingReference):
4211 (CFGSimplificationPhase):
4212 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
4213 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
4214 * dfg/DFGGraph.h:
4215 (JSC::DFG::Graph::changeEdge):
4216
ojan@chromium.org959e4a22012-05-24 02:03:04 +000042172012-05-23 Ojan Vafai <ojan@chromium.org>
4218
4219 add back the ability to disable flexbox
4220 https://bugs.webkit.org/show_bug.cgi?id=87147
4221
4222 Reviewed by Tony Chang.
4223
4224 * Configurations/FeatureDefines.xcconfig:
4225
fpizlo@apple.com9b928722012-05-24 00:18:55 +000042262012-05-23 Filip Pizlo <fpizlo@apple.com>
4227
fpizlo@apple.com16faaea2012-05-24 01:04:55 +00004228 Unreviewed, fix Windows build.
4229
4230 * bytecode/CodeBlock.h:
4231 * dfg/DFGCapabilities.h:
4232 (JSC::DFG::canCompileOpcode):
4233 (JSC::DFG::canCompileOpcodes):
4234 * dfg/DFGCommon.h:
4235 (DFG):
4236
42372012-05-23 Filip Pizlo <fpizlo@apple.com>
4238
fpizlo@apple.com9b928722012-05-24 00:18:55 +00004239 DFG should optimize inlined uses of arguments.length and arguments[i]
4240 https://bugs.webkit.org/show_bug.cgi?id=86327
4241
4242 Reviewed by Gavin Barraclough.
4243
4244 Merged r117017 from dfgopt.
4245
4246 Turns inlined uses of arguments.length into a constant.
4247
4248 Turns inlined uses of arguments[constant] into a direct reference to the
4249 argument.
4250
4251 Big win on micro-benchmarks. Not yet a win on V8 because the hot uses of
4252 arguments.length and arguments[i] are aliased. I'll leave the aliasing
4253 optimizations to a later patch.
4254
4255 * CMakeLists.txt:
4256 * GNUmakefile.list.am:
4257 * JavaScriptCore.xcodeproj/project.pbxproj:
4258 * Target.pri:
4259 * bytecode/DFGExitProfile.h:
4260 (FrequentExitSite):
4261 (JSC::DFG::FrequentExitSite::FrequentExitSite):
4262 (JSC::DFG::QueryableExitProfile::hasExitSite):
4263 (QueryableExitProfile):
4264 * dfg/DFGAbstractState.cpp:
4265 (JSC::DFG::AbstractState::execute):
4266 * dfg/DFGArgumentsSimplificationPhase.cpp: Added.
4267 (DFG):
4268 (ArgumentsSimplificationPhase):
4269 (JSC::DFG::ArgumentsSimplificationPhase::ArgumentsSimplificationPhase):
4270 (JSC::DFG::ArgumentsSimplificationPhase::run):
4271 (JSC::DFG::performArgumentsSimplification):
4272 * dfg/DFGArgumentsSimplificationPhase.h: Added.
4273 (DFG):
4274 * dfg/DFGAssemblyHelpers.cpp:
4275 (JSC::DFG::AssemblyHelpers::executableFor):
4276 (DFG):
4277 * dfg/DFGAssemblyHelpers.h:
4278 (AssemblyHelpers):
4279 * dfg/DFGByteCodeParser.cpp:
4280 (JSC::DFG::ByteCodeParser::parseBlock):
4281 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
4282 * dfg/DFGCSEPhase.cpp:
4283 (JSC::DFG::CSEPhase::getLocalLoadElimination):
4284 (JSC::DFG::CSEPhase::performNodeCSE):
4285 * dfg/DFGDriver.cpp:
4286 (JSC::DFG::compile):
4287 * dfg/DFGGraph.h:
4288 (JSC::DFG::Graph::Graph):
4289 (JSC::DFG::Graph::executableFor):
4290 (Graph):
4291 (JSC::DFG::Graph::clobbersWorld):
4292 * dfg/DFGNode.h:
4293 (JSC::DFG::Node::convertToConstant):
4294 (JSC::DFG::Node::convertToGetLocalUnlinked):
4295 (Node):
4296 (JSC::DFG::Node::unlinkedLocal):
4297 * dfg/DFGNodeType.h:
4298 (DFG):
4299 * dfg/DFGOSRExit.cpp:
4300 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
4301 * dfg/DFGPredictionPropagationPhase.cpp:
4302 (JSC::DFG::PredictionPropagationPhase::propagate):
4303 * dfg/DFGSpeculativeJIT32_64.cpp:
4304 (JSC::DFG::SpeculativeJIT::compile):
4305 * dfg/DFGSpeculativeJIT64.cpp:
4306 (JSC::DFG::SpeculativeJIT::compile):
4307
fpizlo@apple.com5e3852d2012-05-24 00:05:21 +000043082012-05-13 Filip Pizlo <fpizlo@apple.com>
4309
4310 DFG should be able to optimize foo.apply(bar, arguments)
4311 https://bugs.webkit.org/show_bug.cgi?id=86306
4312
4313 Reviewed by Gavin Barraclough.
4314
4315 Merge r116912 from dfgopt.
4316
4317 Enables compilation of op_jneq_ptr and some forms of op_call_varargs.
4318
4319 Also includes a bunch of bug fixes that were made necessary by the increased
4320 pressure on the CFG simplifier.
4321
4322 This is a 1-2% win on V8.
4323
4324 * bytecode/CodeBlock.cpp:
4325 (JSC::CodeBlock::printCallOp):
4326 (JSC::CodeBlock::CodeBlock):
4327 (JSC::ProgramCodeBlock::canCompileWithDFGInternal):
4328 (JSC::EvalCodeBlock::canCompileWithDFGInternal):
4329 (JSC::FunctionCodeBlock::canCompileWithDFGInternal):
4330 * bytecode/CodeBlock.h:
4331 (CodeBlock):
4332 (JSC::CodeBlock::canCompileWithDFG):
4333 (JSC::CodeBlock::canCompileWithDFGState):
4334 (ProgramCodeBlock):
4335 (EvalCodeBlock):
4336 (FunctionCodeBlock):
4337 * dfg/DFGAbstractState.cpp:
4338 (JSC::DFG::AbstractState::execute):
4339 * dfg/DFGByteCodeParser.cpp:
4340 (JSC::DFG::ByteCodeParser::parseBlock):
4341 (JSC::DFG::ByteCodeParser::processPhiStack):
4342 (JSC::DFG::ByteCodeParser::parse):
4343 * dfg/DFGCFGSimplificationPhase.cpp:
4344 (JSC::DFG::CFGSimplificationPhase::run):
4345 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
4346 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
4347 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
4348 * dfg/DFGCSEPhase.cpp:
4349 (JSC::DFG::CSEPhase::getLocalLoadElimination):
4350 (CSEPhase):
4351 (JSC::DFG::CSEPhase::setReplacement):
4352 (JSC::DFG::CSEPhase::performNodeCSE):
4353 * dfg/DFGCapabilities.cpp:
4354 (JSC::DFG::debugFail):
4355 (DFG):
4356 (JSC::DFG::canHandleOpcodes):
4357 (JSC::DFG::canCompileOpcodes):
4358 (JSC::DFG::canInlineOpcodes):
4359 * dfg/DFGCapabilities.h:
4360 (JSC::DFG::canCompileOpcode):
4361 (JSC::DFG::canInlineOpcode):
4362 (DFG):
4363 (JSC::DFG::canCompileOpcodes):
4364 (JSC::DFG::canCompileEval):
4365 (JSC::DFG::canCompileProgram):
4366 (JSC::DFG::canCompileFunctionForCall):
4367 (JSC::DFG::canCompileFunctionForConstruct):
4368 * dfg/DFGCommon.h:
4369 * dfg/DFGGraph.cpp:
4370 (JSC::DFG::Graph::dump):
4371 * dfg/DFGNodeType.h:
4372 (DFG):
4373 * dfg/DFGPredictionPropagationPhase.cpp:
4374 (JSC::DFG::PredictionPropagationPhase::propagate):
4375 * dfg/DFGSpeculativeJIT32_64.cpp:
4376 (JSC::DFG::SpeculativeJIT::compile):
4377 * dfg/DFGSpeculativeJIT64.cpp:
4378 (JSC::DFG::SpeculativeJIT::emitCall):
4379 (JSC::DFG::SpeculativeJIT::compile):
4380 * dfg/DFGValidate.cpp:
4381 (Validate):
4382 (JSC::DFG::Validate::validate):
4383 (JSC::DFG::Validate::checkOperand):
4384 (JSC::DFG::Validate::reportValidationContext):
4385 * jit/JIT.cpp:
4386 (JSC::JIT::emitOptimizationCheck):
4387 (JSC::JIT::privateCompileSlowCases):
4388 (JSC::JIT::privateCompile):
4389 * jit/JIT.h:
4390 * jit/JITArithmetic.cpp:
4391 (JSC::JIT::compileBinaryArithOp):
4392 * jit/JITPropertyAccess.cpp:
4393 (JSC::JIT::privateCompilePutByIdTransition):
4394 * jit/JITPropertyAccess32_64.cpp:
4395 (JSC::JIT::privateCompilePutByIdTransition):
4396 * tools/CodeProfile.cpp:
4397 (JSC::CodeProfile::sample):
4398
ggaren@apple.com7070d422012-05-23 23:55:27 +000043992012-05-23 Geoffrey Garen <ggaren@apple.com>
4400
4401 Refactored WeakBlock to use malloc, clarify behavior
4402 https://bugs.webkit.org/show_bug.cgi?id=87318
4403
4404 Reviewed by Filip Pizlo.
4405
4406 We want to use malloc so we can make these smaller than 4KB,
4407 since an individual MarkedBlock will usually have fewer than
4408 4KB worth of weak pointers.
4409
4410 * heap/Heap.cpp:
4411 (JSC::Heap::markRoots): Renamed visitLiveWeakImpls to visit, since
4412 we no longer need to distinguish from "visitDeadWeakImpls".
4413
4414 Renamed "visitDeadWeakImpls" to "reap" because we're not actually
4415 doing any visiting -- we're just tagging things as dead.
4416
4417 * heap/WeakBlock.cpp:
4418 (JSC::WeakBlock::create):
4419 (JSC::WeakBlock::destroy):
4420 (JSC::WeakBlock::WeakBlock): Malloc!
4421
4422 (JSC::WeakBlock::visit):
4423 (JSC::WeakBlock::reap): Renamed as above.
4424
4425 * heap/WeakBlock.h:
4426 (WeakBlock): Reduced to 3KB, as explained above.
4427
4428 * heap/WeakSet.cpp:
4429 (JSC::WeakSet::visit):
4430 (JSC::WeakSet::reap):
4431 * heap/WeakSet.h:
4432 (WeakSet): Updated for renames, and to match WebKit style.
4433
fpizlo@apple.com11e2f372012-05-23 22:25:21 +000044342012-05-23 Filip Pizlo <fpizlo@apple.com>
4435
fpizlo@apple.combc96e8f2012-05-23 23:12:59 +00004436 Use after free in JSC::DFG::ByteCodeParser::processPhiStack
4437 https://bugs.webkit.org/show_bug.cgi?id=87312
4438 <rdar://problem/11518848>
4439
4440 Reviewed by Oliver Hunt.
4441
4442 * dfg/DFGByteCodeParser.cpp:
4443 (JSC::DFG::ByteCodeParser::processPhiStack):
4444 (JSC::DFG::ByteCodeParser::parse):
4445
44462012-05-23 Filip Pizlo <fpizlo@apple.com>
4447
fpizlo@apple.com11e2f372012-05-23 22:25:21 +00004448 It should be possible to make C function calls from DFG code on ARM in debug mode
4449 https://bugs.webkit.org/show_bug.cgi?id=87313
4450
4451 Reviewed by Gavin Barraclough.
4452
4453 * dfg/DFGSpeculativeJIT.h:
4454 (SpeculativeJIT):
4455
fpizlo@apple.comc6446112012-05-23 20:52:42 +000044562012-05-11 Filip Pizlo <fpizlo@apple.com>
4457
4458 DFG should be able to inline functions that use arguments reflectively
4459 https://bugs.webkit.org/show_bug.cgi?id=86132
4460
4461 Reviewed by Oliver Hunt.
4462
4463 Merged r116838 from dfgopt.
4464
4465 This turns on inlining of functions that use arguments reflectively, but it
4466 does not do any of the obvious optimizations that this exposes. I'll save that
4467 for another patch - the important thing for now is that this contains all of
4468 the plumbing necessary to make this kind of inlining sound even in bizarro
4469 cases like an inline callee escaping the arguments object to parts of the
4470 inline caller where the arguments are otherwise dead. Or even more fun cases
4471 like where you've inlined to an inline stack that is three-deep, and the
4472 function on top of the inline stack reflectively accesses the arguments of a
4473 function that is in the middle of the inline stack. Any subsequent
4474 optimizations that we do for the obvious cases of arguments usage in inline
4475 functions will have to take care not to break the baseline functionality that
4476 this patch plumbs together.
4477
4478 * bytecode/CodeBlock.cpp:
4479 (JSC::CodeBlock::printCallOp):
4480 (JSC::CodeBlock::dump):
4481 * bytecode/CodeBlock.h:
4482 * dfg/DFGAssemblyHelpers.h:
4483 (JSC::DFG::AssemblyHelpers::argumentsRegisterFor):
4484 (AssemblyHelpers):
4485 * dfg/DFGByteCodeParser.cpp:
4486 (InlineStackEntry):
4487 (JSC::DFG::ByteCodeParser::handleCall):
4488 (JSC::DFG::ByteCodeParser::handleInlining):
4489 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
4490 (JSC::DFG::ByteCodeParser::parse):
4491 * dfg/DFGCCallHelpers.h:
4492 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
4493 (CCallHelpers):
4494 * dfg/DFGCapabilities.h:
4495 (JSC::DFG::canInlineOpcode):
4496 * dfg/DFGDriver.cpp:
4497 (JSC::DFG::compile):
4498 * dfg/DFGFixupPhase.cpp:
4499 (JSC::DFG::FixupPhase::fixupNode):
4500 * dfg/DFGOperations.cpp:
4501 * dfg/DFGOperations.h:
4502 * dfg/DFGSpeculativeJIT.h:
4503 (JSC::DFG::SpeculativeJIT::callOperation):
4504 * dfg/DFGSpeculativeJIT32_64.cpp:
4505 (JSC::DFG::SpeculativeJIT::compile):
4506 * dfg/DFGSpeculativeJIT64.cpp:
4507 (JSC::DFG::SpeculativeJIT::compile):
4508 * interpreter/CallFrame.cpp:
4509 (JSC):
4510 (JSC::CallFrame::someCodeBlockForPossiblyInlinedCode):
4511 * interpreter/CallFrame.h:
4512 (ExecState):
4513 (JSC::ExecState::someCodeBlockForPossiblyInlinedCode):
4514 * interpreter/Interpreter.cpp:
4515 (JSC::Interpreter::retrieveArgumentsFromVMCode):
4516 * runtime/Arguments.cpp:
4517 (JSC::Arguments::tearOff):
4518 (JSC):
4519 (JSC::Arguments::tearOffForInlineCallFrame):
4520 * runtime/Arguments.h:
4521 (Arguments):
4522 (JSC::Arguments::create):
4523 (JSC::Arguments::finishCreation):
4524 (JSC):
4525
fpizlo@apple.comfe244b02012-05-23 20:51:21 +000045262012-05-23 Filip Pizlo <fpizlo@apple.com>
4527
4528 Every OSR exit on ARM results in a crash
4529 https://bugs.webkit.org/show_bug.cgi?id=87307
4530
4531 Reviewed by Geoffrey Garen.
4532
4533 * dfg/DFGThunks.cpp:
4534 (JSC::DFG::osrExitGenerationThunkGenerator):
4535
ggaren@apple.com96fa0e72012-05-23 20:47:46 +000045362012-05-23 Geoffrey Garen <ggaren@apple.com>
4537
4538 Refactored heap tear-down to use normal value semantics (i.e., destructors)
4539 https://bugs.webkit.org/show_bug.cgi?id=87302
4540
4541 Reviewed by Oliver Hunt.
4542
4543 This is a step toward incremental DOM finalization.
4544
4545 * heap/CopiedSpace.cpp:
4546 (JSC::CopiedSpace::~CopiedSpace):
4547 * heap/CopiedSpace.h:
4548 (CopiedSpace): Just use our destructor, instead of relying on the heap
4549 to send us a special message at a special time.
4550
4551 * heap/Heap.cpp:
4552 (JSC::Heap::Heap): Use OwnPtr for m_markListSet because this is not Sparta.
4553
4554 (JSC::Heap::~Heap): No need for delete or freeAllBlocks because normal
4555 destructors do this work automatically now.
4556
4557 (JSC::Heap::lastChanceToFinalize): Just call lastChanceToFinalize on our
4558 sub-objects, and assume it does the right thing. This improves encapsulation,
4559 so we can add items requiring finalization to our sub-objects.
4560
4561 * heap/Heap.h: Moved m_blockAllocator to get the right destruction order.
4562
4563 * heap/MarkedSpace.cpp:
4564 (Take):
4565 (JSC):
4566 (JSC::Take::Take):
4567 (JSC::Take::operator()):
4568 (JSC::Take::returnValue): Moved to the top of the file so it can be used
4569 in another function.
4570
4571 (JSC::MarkedSpace::~MarkedSpace): Delete all outstanding memory, like a good
4572 destructor should.
4573
4574 (JSC::MarkedSpace::lastChanceToFinalize): Moved some code here from the heap,
4575 since it pertains to our internal implementation details.
4576
4577 * heap/MarkedSpace.h:
4578 (MarkedSpace):
4579 * heap/WeakBlock.cpp:
4580 (JSC::WeakBlock::lastChanceToFinalize):
4581 * heap/WeakBlock.h:
4582 (WeakBlock):
4583 * heap/WeakSet.cpp:
4584 (JSC::WeakSet::lastChanceToFinalize):
4585 * heap/WeakSet.h:
4586 (WeakSet): Stop using a special freeAllBlocks() callback and just implement
4587 lastChanceToFinalize.
4588
ggaren@apple.comd6376d22012-05-23 18:29:55 +000045892011-05-22 Geoffrey Garen <ggaren@apple.com>
4590
4591 Encapsulated some calculations for whether portions of the heap are empty
4592 https://bugs.webkit.org/show_bug.cgi?id=87210
4593
4594 Reviewed by Gavin Barraclough.
4595
4596 This is a step toward incremental DOM finalization.
4597
4598 * heap/Heap.cpp:
4599 (JSC::Heap::~Heap): Explicitly call freeAllBlocks() instead of relying
4600 implicitly on all blocks thinking they're empty. In future, we may
4601 choose to tear down the heap without first setting all data structures
4602 to "empty".
4603
4604 * heap/MarkedBlock.h:
4605 (JSC::MarkedBlock::isEmpty):
4606 (JSC::MarkedBlock::gatherDirtyCells): Renamed markCountIsZero to isEmpty,
4607 in preparation for making it check for outstanding finalizers in addition
4608 to marked cells.
4609
4610 * heap/MarkedSpace.cpp:
4611 (Take):
4612 (JSC::Take::Take):
4613 (JSC::Take::operator()):
4614 (JSC::Take::returnValue):
4615 (JSC::MarkedSpace::shrink):
4616 (JSC::MarkedSpace::freeAllBlocks): Refactored the "Take" functor to support
4617 a conditional isEmpty check, so it dould be shared by shrink() and freeAllBlocks().
4618
4619 * heap/WeakBlock.cpp:
4620 (JSC::WeakBlock::WeakBlock):
4621 (JSC::WeakBlock::visitLiveWeakImpls):
4622 (JSC::WeakBlock::visitDeadWeakImpls):
4623 * heap/WeakBlock.h:
4624 (WeakBlock):
4625 (JSC::WeakBlock::isEmpty):
4626 * heap/WeakSet.cpp:
4627 (JSC::WeakSet::sweep):
4628 (JSC::WeakSet::shrink): Use isEmpty(), in preparation for changes in
4629 its implementation.
4630
vestbo@webkit.orgb1f6e922012-05-23 10:50:53 +000046312012-05-23 Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
4632
4633 [Qt] Remove references to $$QT_SOURCE_TREE
4634
4635 With a modularized Qt, it's ambigious. What we really want is qtbase,
4636 which qtcore is a proxy for (we assume it will always live in qtbase).
4637
4638 Reviewed by Tor Arne Vestbø.
4639
4640 * JavaScriptCore.pri:
4641 * Target.pri:
4642
fpizlo@apple.comb6b454cd2012-05-23 07:53:44 +000046432012-05-09 Filip Pizlo <fpizlo@apple.com>
4644
4645 DFG should allow inlining in case of certain arity mismatches
4646 https://bugs.webkit.org/show_bug.cgi?id=86059
4647
4648 Reviewed by Geoff Garen.
fpizlo@apple.comb92907c2012-05-23 07:55:12 +00004649
4650 Merge r116620 from dfgopt.
fpizlo@apple.comb6b454cd2012-05-23 07:53:44 +00004651
4652 * dfg/DFGByteCodeParser.cpp:
4653 (JSC::DFG::ByteCodeParser::handleInlining):
4654
fpizlo@apple.com6d4456e2012-05-23 03:48:52 +000046552012-05-08 Filip Pizlo <fpizlo@apple.com>
4656
fpizlo@apple.com1688cc12012-05-23 07:29:02 +00004657 DFG variable capture analysis should work even if the variables arose through inlining
4658 https://bugs.webkit.org/show_bug.cgi?id=85945
4659
4660 Reviewed by Oliver Hunt.
4661
4662 Merged r116555 from dfgopt.
4663
4664 This just changes how the DFG queries whether a variable is captured. It does not
4665 change any user-visible behavior.
4666
4667 As part of this change, I further solidified the policy that the CFA behaves in an
4668 undefined way for captured locals and queries about their values will not yield
4669 reliable results. This will likely be changed in the future, but for now it makes
4670 sense.
4671
4672 One fun part about this change is that it recognizes that the same variable may
4673 be both captured and not, at the same time, because their live interval spans
4674 inlining boundaries. This only happens in the case of arguments to functions that
4675 capture their arguments, and this change treats them with just the right touch of
4676 conservatism: they will be treated as if captured by the caller as well as the
4677 callee.
4678
4679 Finally, this also adds captured variable reasoning to the InlineCallFrame, which
4680 I thought might be useful for later tooling.
4681
4682 This is perf-neutral, since it does it does not make the DFG take advantage of this
4683 new functionality in any way. In particular, it is still the case that the DFG will
4684 not inline functions that use arguments reflectively or that create activations.
4685
4686 * bytecode/CodeBlock.h:
4687 (CodeBlock):
4688 (JSC::CodeBlock::needsActivation):
4689 (JSC::CodeBlock::argumentIsCaptured):
4690 (JSC::CodeBlock::localIsCaptured):
4691 (JSC::CodeBlock::isCaptured):
4692 * bytecode/CodeOrigin.h:
4693 (InlineCallFrame):
4694 * dfg/DFGAbstractState.cpp:
4695 (JSC::DFG::AbstractState::initialize):
4696 (JSC::DFG::AbstractState::endBasicBlock):
4697 (JSC::DFG::AbstractState::execute):
4698 (JSC::DFG::AbstractState::merge):
4699 * dfg/DFGByteCodeParser.cpp:
4700 (JSC::DFG::ByteCodeParser::newVariableAccessData):
4701 (JSC::DFG::ByteCodeParser::getLocal):
4702 (JSC::DFG::ByteCodeParser::setLocal):
4703 (JSC::DFG::ByteCodeParser::getArgument):
4704 (JSC::DFG::ByteCodeParser::setArgument):
4705 (JSC::DFG::ByteCodeParser::flushArgument):
4706 (JSC::DFG::ByteCodeParser::parseBlock):
4707 (JSC::DFG::ByteCodeParser::processPhiStack):
4708 (JSC::DFG::ByteCodeParser::fixVariableAccessPredictions):
4709 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
4710 * dfg/DFGCFGSimplificationPhase.cpp:
4711 (CFGSimplificationPhase):
4712 (JSC::DFG::CFGSimplificationPhase::keepOperandAlive):
4713 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
4714 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
4715 * dfg/DFGCommon.h:
4716 * dfg/DFGFixupPhase.cpp:
4717 (JSC::DFG::FixupPhase::fixupNode):
4718 * dfg/DFGGraph.cpp:
4719 (JSC::DFG::Graph::nameOfVariableAccessData):
4720 * dfg/DFGGraph.h:
4721 (JSC::DFG::Graph::needsActivation):
4722 (JSC::DFG::Graph::usesArguments):
4723 * dfg/DFGPredictionPropagationPhase.cpp:
4724 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):
4725 * dfg/DFGSpeculativeJIT.cpp:
4726 (JSC::DFG::SpeculativeJIT::compile):
4727 * dfg/DFGSpeculativeJIT32_64.cpp:
4728 (JSC::DFG::SpeculativeJIT::compile):
4729 * dfg/DFGSpeculativeJIT64.cpp:
4730 (JSC::DFG::SpeculativeJIT::compile):
4731 * dfg/DFGVariableAccessData.h:
4732 (JSC::DFG::VariableAccessData::VariableAccessData):
4733 (JSC::DFG::VariableAccessData::mergeIsCaptured):
4734 (VariableAccessData):
4735 (JSC::DFG::VariableAccessData::isCaptured):
4736
47372012-05-08 Filip Pizlo <fpizlo@apple.com>
4738
fpizlo@apple.com6d4456e2012-05-23 03:48:52 +00004739 DFG should support op_get_argument_by_val and op_get_arguments_length
4740 https://bugs.webkit.org/show_bug.cgi?id=85911
4741
4742 Reviewed by Oliver Hunt.
4743
4744 Merged r116467 from dfgopt.
4745
4746 This adds a simple and relatively conservative implementation of op_get_argument_by_val
4747 and op_get_arguments_length. We can optimize these later. For now it's great to have
4748 the additional coverage.
4749
4750 This patch appears to be perf-neutral.
4751
4752 * dfg/DFGAbstractState.cpp:
4753 (JSC::DFG::AbstractState::execute):
4754 * dfg/DFGAssemblyHelpers.h:
4755 (JSC::DFG::AssemblyHelpers::addressFor):
4756 (JSC::DFG::AssemblyHelpers::tagFor):
4757 (JSC::DFG::AssemblyHelpers::payloadFor):
4758 * dfg/DFGByteCodeParser.cpp:
4759 (JSC::DFG::ByteCodeParser::parseBlock):
4760 * dfg/DFGCapabilities.h:
4761 (JSC::DFG::canCompileOpcode):
4762 (JSC::DFG::canInlineOpcode):
4763 * dfg/DFGNode.h:
4764 (JSC::DFG::Node::hasHeapPrediction):
4765 * dfg/DFGNodeType.h:
4766 (DFG):
4767 * dfg/DFGOperations.cpp:
4768 * dfg/DFGOperations.h:
4769 * dfg/DFGPredictionPropagationPhase.cpp:
4770 (JSC::DFG::PredictionPropagationPhase::propagate):
4771 * dfg/DFGSpeculativeJIT.h:
4772 (JSC::DFG::SpeculativeJIT::callOperation):
4773 (SpeculativeJIT):
4774 * dfg/DFGSpeculativeJIT32_64.cpp:
4775 (JSC::DFG::SpeculativeJIT::compile):
4776 * dfg/DFGSpeculativeJIT64.cpp:
4777 (JSC::DFG::SpeculativeJIT::compile):
4778 * jit/JITOpcodes.cpp:
4779 (JSC::JIT::emit_op_get_argument_by_val):
4780 * jit/JITOpcodes32_64.cpp:
4781 (JSC::JIT::emit_op_get_argument_by_val):
4782 * llint/LowLevelInterpreter32_64.asm:
4783 * llint/LowLevelInterpreter64.asm:
4784
fpizlo@apple.com15c03c72012-05-23 02:34:13 +000047852012-05-07 Filip Pizlo <fpizlo@apple.com>
4786
4787 DFG should support op_tear_off_arguments
4788 https://bugs.webkit.org/show_bug.cgi?id=85847
4789
4790 Reviewed by Michael Saboff.
4791
4792 Merged r116378 from dfgopt.
4793
4794 * dfg/DFGAbstractState.cpp:
4795 (JSC::DFG::AbstractState::execute):
4796 * dfg/DFGByteCodeParser.cpp:
4797 (JSC::DFG::ByteCodeParser::parseBlock):
4798 * dfg/DFGCapabilities.h:
4799 (JSC::DFG::canCompileOpcode):
4800 (JSC::DFG::canInlineOpcode):
4801 * dfg/DFGNodeType.h:
4802 (DFG):
4803 * dfg/DFGOperations.cpp:
4804 * dfg/DFGOperations.h:
4805 * dfg/DFGPredictionPropagationPhase.cpp:
4806 (JSC::DFG::PredictionPropagationPhase::propagate):
4807 * dfg/DFGSpeculativeJIT.h:
4808 (SpeculativeJIT):
4809 (JSC::DFG::SpeculativeJIT::callOperation):
4810 * dfg/DFGSpeculativeJIT32_64.cpp:
4811 (JSC::DFG::SpeculativeJIT::compile):
4812 * dfg/DFGSpeculativeJIT64.cpp:
4813 (JSC::DFG::SpeculativeJIT::compile):
4814
mhahnenberg@apple.com3041bc12012-05-23 01:28:03 +000048152012-05-22 Mark Hahnenberg <mhahnenberg@apple.com>
4816
4817 CopiedSpace::contains doesn't check for oversize blocks
4818 https://bugs.webkit.org/show_bug.cgi?id=87180
4819
4820 Reviewed by Geoffrey Garen.
4821
4822 When doing a conservative scan we use CopiedSpace::contains to determine if a particular
4823 address points into the CopiedSpace. Currently contains() only checks if the address
4824 points to a block in to-space, which means that pointers to oversize blocks may not get scanned.
4825
4826 * heap/CopiedSpace.cpp:
4827 (JSC::CopiedSpace::tryAllocateOversize):
4828 (JSC::CopiedSpace::tryReallocateOversize):
4829 (JSC::CopiedSpace::doneFillingBlock):
4830 (JSC::CopiedSpace::doneCopying):
4831 * heap/CopiedSpace.h: Refactored CopiedSpace so that all blocks (oversize and to-space) are
4832 in a single hash set and bloom filter for membership testing.
4833 (CopiedSpace):
4834 * heap/CopiedSpaceInlineMethods.h:
4835 (JSC::CopiedSpace::contains): We check for the normal block first. Since the oversize blocks are
4836 only page aligned, rather than block aligned, we have to re-mask the ptr to check if it's in
4837 CopiedSpace. Also added a helper function of the same name that takes a CopiedBlock* and checks
4838 if it's in CopiedSpace so that check isn't typed out twice.
4839 (JSC):
4840 (JSC::CopiedSpace::startedCopying):
4841 (JSC::CopiedSpace::addNewBlock):
4842
ggaren@apple.coma68a6502012-05-22 23:59:51 +000048432012-05-22 Geoffrey Garen <ggaren@apple.com>
4844
4845 CopiedBlock and MarkedBlock should have proper value semantics (i.e., destructors)
4846 https://bugs.webkit.org/show_bug.cgi?id=87172
4847
4848 Reviewed by Oliver Hunt and Phil Pizlo.
4849
4850 This enables MarkedBlock to own non-trivial sub-objects that require
4851 destruction. It also fixes a FIXME about casting a CopiedBlock to a
4852 MarkedBlock at destroy time.
4853
4854 CopiedBlock and MarkedBlock now accept an allocation chunk at create
4855 time and return it at destroy time. Their client is expected to
4856 allocate, recycle, and destroy these chunks.
4857
4858 * heap/BlockAllocator.cpp:
4859 (JSC::BlockAllocator::releaseFreeBlocks):
4860 (JSC::BlockAllocator::blockFreeingThreadMain): Don't call MarkedBlock::destroy
4861 because we expect that to be called before a block is put on our free
4862 list now. Do manually deallocate our allocation chunk because that's
4863 our job now.
4864
4865 * heap/BlockAllocator.h:
4866 (BlockAllocator):
4867 (JSC::BlockAllocator::allocate): Allocate never fails now. This is a
4868 cleaner abstraction because only one object does all the VM allocation
4869 and deallocation. Caching is an implementation detail.
4870
4871 (JSC::BlockAllocator::deallocate): We take an allocation chunk argument
4872 instead of a block because we now expect the block to have been destroyed
4873 before we recycle its memory. For convenience, we still use the HeapBlock
4874 class as our linked list node. This is OK because HeapBlock is a POD type.
4875
4876 * heap/CopiedBlock.h:
4877 (CopiedBlock):
4878 (JSC::CopiedBlock::create):
4879 (JSC::CopiedBlock::destroy):
4880 (JSC::CopiedBlock::CopiedBlock): Added proper create and destroy functions,
4881 to match MarkedBlock.
4882
4883 * heap/CopiedSpace.cpp:
4884 (JSC::CopiedSpace::tryAllocateOversize):
4885 (JSC::CopiedSpace::tryReallocateOversize):
4886 (JSC::CopiedSpace::doneCopying):
4887 (JSC::CopiedSpace::getFreshBlock):
4888 (JSC::CopiedSpace::freeAllBlocks):
4889 * heap/CopiedSpaceInlineMethods.h:
4890 (JSC::CopiedSpace::recycleBlock): Make sure to call destroy before
4891 returning a block to the BlockAllocator. Otherwise, our destructors
4892 won't run. (If we get this wrong now, we'll get a compile error.)
4893
4894 * heap/HeapBlock.h:
4895 (JSC::HeapBlock::HeapBlock): const!
4896
4897 * heap/MarkedAllocator.cpp:
4898 (JSC::MarkedAllocator::allocateBlock): No need to distinguish between
4899 create and recycle -- MarkedBlock always accepts memory allocated by
4900 its client now.
4901
4902 * heap/MarkedBlock.cpp:
4903 (JSC::MarkedBlock::create): Don't allocate memory -- we assume that we're
4904 passed already-allocated memory, to clarify the responsibility for VM
4905 recycling.
4906
4907 (JSC::MarkedBlock::destroy): Do run our destructor before giving back
4908 our VM -- that is the whole point of this patch.
4909
4910 (JSC::MarkedBlock::MarkedBlock):
4911 * heap/MarkedBlock.h:
4912 (MarkedBlock):
4913 * heap/MarkedSpace.cpp: const!
4914
4915 (JSC::MarkedSpace::freeBlocks): Make sure to call destroy before
4916 returning a block to the BlockAllocator. Otherwise, our destructors
4917 won't run. (If we get this wrong now, we'll get a compile error.)
4918
simon.fraser@apple.com9bd2c702012-05-22 20:37:14 +00004919== Rolled over to ChangeLog-2012-05-22 ==