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