1 2012-09-11 Mark Hahnenberg <mhahnenberg@apple.com>
3 IncrementalSweeper should not sweep/free Zapped blocks
4 https://bugs.webkit.org/show_bug.cgi?id=96464
6 Reviewed by Filip Pizlo.
8 This is not beneficial in terms of performance because there isn't any way a block can emerge
9 in the Zapped state from a call to Heap::collect() unless we run an eager sweep on it, in which
10 case we've already run all the destructors we possibly can. This also causes bugs since we don't
11 take zapped-ness into account when determining whether or not a block is empty to free it. The
12 incremental sweeper can then accidentally free blocks that it thinks are empty but are in fact
13 zapped with still-live objects in them.
16 (JSC::MarkedBlock::needsSweeping): It is only valid to sweep a block if it is in the Marked state.
18 2013-03-11 Oliver Hunt <oliver@apple.com>
20 Make SegmentedVector Noncopyable
21 https://bugs.webkit.org/show_bug.cgi?id=112059
23 Reviewed by Geoffrey Garen.
25 Copying a SegmentedVector is very expensive, and really shouldn't
26 be necessary. So I've taken the one place where we currently copy
27 and replaced it with a regular Vector, and replaced the address
28 dependent logic with a indexing ref instead.
30 * bytecompiler/BytecodeGenerator.cpp:
31 (JSC::BytecodeGenerator::newLabelScope):
32 (JSC::BytecodeGenerator::emitComplexJumpScopes):
33 * bytecompiler/BytecodeGenerator.h:
35 * bytecompiler/LabelScope.h:
37 (JSC::LabelScopePtr::LabelScopePtr):
39 (JSC::LabelScopePtr::operator=):
40 (JSC::LabelScopePtr::~LabelScopePtr):
41 (JSC::LabelScopePtr::operator*):
42 (JSC::LabelScopePtr::operator->):
43 * bytecompiler/NodesCodegen.cpp:
44 (JSC::DoWhileNode::emitBytecode):
45 (JSC::WhileNode::emitBytecode):
46 (JSC::ForNode::emitBytecode):
47 (JSC::ForInNode::emitBytecode):
48 (JSC::SwitchNode::emitBytecode):
49 (JSC::LabelNode::emitBytecode):
51 2012-11-20 Yong Li <yoli@rim.com>
53 [ARMv7] Neither linkCall() nor linkPointer() should flush code.
54 https://bugs.webkit.org/show_bug.cgi?id=99213
56 Reviewed by George Staikos.
58 LinkBuffer doesn't need to flush code during linking. It will
59 eventually flush the whole executable. Fixing this gives >%5
60 sunspider boost (on QNX).
62 Also make replaceWithLoad() and replaceWithAddressComputation() flush
65 * assembler/ARMv7Assembler.h:
66 (JSC::ARMv7Assembler::linkCall):
67 (JSC::ARMv7Assembler::linkPointer):
68 (JSC::ARMv7Assembler::relinkCall):
69 (JSC::ARMv7Assembler::repatchInt32):
70 (JSC::ARMv7Assembler::repatchPointer):
71 (JSC::ARMv7Assembler::replaceWithLoad): Flush only after it did write.
72 (JSC::ARMv7Assembler::replaceWithAddressComputation): Flush only after it did write.
73 (JSC::ARMv7Assembler::setInt32):
74 (JSC::ARMv7Assembler::setPointer):
76 2012-08-30 Byungwoo Lee <bw80.lee@samsung.com>
78 Build warning : -Wsign-compare on DFGByteCodeParser.cpp.
79 https://bugs.webkit.org/show_bug.cgi?id=95418
81 Reviewed by Filip Pizlo.
83 There is a build warning '-Wsign-compare' on
84 findArgumentPositionForLocal() in DFGByteCodeParser.cpp.
86 For removing this warning, casting statement is added explicitly.
88 * dfg/DFGByteCodeParser.cpp:
89 (JSC::DFG::ByteCodeParser::findArgumentPositionForLocal):
90 (JSC::DFG::ByteCodeParser::findArgumentPosition):
92 2012-11-13 Cosmin Truta <ctruta@rim.com>
94 Uninitialized fields in class JSLock
95 https://bugs.webkit.org/show_bug.cgi?id=101695
97 Reviewed by Mark Hahnenberg.
99 Initialize JSLock::m_ownerThread and JSLock::m_lockDropDepth.
101 * runtime/JSLock.cpp:
102 (JSC::JSLock::JSLock):
104 2012-09-17 Filip Pizlo <fpizlo@apple.com>
106 Unreviewed, fix a broken assertion in offlineasm.
108 * offlineasm/armv7.rb:
109 * offlineasm/backends.rb:
111 2012-09-10 Thiago Marcos P. Santos <thiago.santos@intel.com>
113 [CMake][EFL] Enable the LLInt
114 https://bugs.webkit.org/show_bug.cgi?id=92682
116 Reviewed by Csaba Osztrogonác.
118 Generate the headers needed by LLint when LLint is enabled.
122 2012-09-09 Mark Lam <mark.lam@apple.com>
124 Fixed a few llint C++ interpreter bugs.
125 https://bugs.webkit.org/show_bug.cgi?id=96127.
127 Reviewed by Geoffrey Garen.
129 * llint/LLIntCLoop.h:
130 CLoop::execute()'s bootstrapOpcodeId does not need a default
131 value. There is no case when this function is called without
132 that parameter being specified.
133 * llint/LowLevelInterpreter.asm:
134 Moved the dispatchAfterCall() call to where it is needed.
135 For the C_LOOP back-end, it generates unreachable code.
136 * llint/LowLevelInterpreter.cpp:
137 #include <wtf/Assertions.h> because LLIntAssembly.h needs it.
139 Fixed bug in SIGN_BIT32() macro.
140 Placate a MSVC warning for t0, and t1 being uninitialized.
141 (JSC::CLoop::execute):
142 The bootstrapOpcodeId arg should always be specified.
143 MSVC doesn't like UNUSED_PARAM() for labels. Switch to using
144 the new UNUSED_LABEL() macro.
145 * offlineasm/cloop.rb:
146 * offlineasm/generate_offset_extractor.rb:
147 Resolved a compiler warning found via MSVC.
149 2012-09-07 Sheriff Bot <webkit.review.bot@gmail.com>
151 Unreviewed, rolling out r127938.
152 http://trac.webkit.org/changeset/127938
153 https://bugs.webkit.org/show_bug.cgi?id=96166
155 It broke the build (Requested by smfr on #webkit).
157 * llint/LowLevelInterpreter.cpp:
159 (JSC::CLoop::execute):
160 * offlineasm/cloop.rb:
162 2012-09-07 Mark Lam <mark.lam@apple.com>
164 Fix a llint C++ interpreter bugs.
165 https://bugs.webkit.org/show_bug.cgi?id=96127.
167 Reviewed by Filip Pizlo.
169 * llint/LowLevelInterpreter.cpp:
171 (JSC::CLoop::execute):
172 * offlineasm/cloop.rb:
174 2012-09-01 Mark Lam <mark.lam@apple.com>
176 LLInt C loop backend.
177 https://bugs.webkit.org/show_bug.cgi?id=91052.
179 Reviewed by Filip Pizlo.
181 * JavaScriptCore.xcodeproj/project.pbxproj:
182 * bytecode/CodeBlock.cpp:
183 (JSC::CodeBlock::dump):
184 (JSC::CodeBlock::bytecodeOffset):
185 * interpreter/Interpreter.cpp:
186 (JSC::Interpreter::execute):
187 (JSC::Interpreter::executeCall):
188 (JSC::Interpreter::executeConstruct):
190 * interpreter/Interpreter.h:
194 * llint/LLIntCLoop.cpp: Added.
197 (JSC::LLInt::CLoop::initialize):
198 (JSC::LLInt::CLoop::catchRoutineFor):
199 (JSC::LLInt::CLoop::hostCodeEntryFor):
200 (JSC::LLInt::CLoop::jsCodeEntryWithArityCheckFor):
201 (JSC::LLInt::CLoop::jsCodeEntryFor):
202 * llint/LLIntCLoop.h: Added.
206 * llint/LLIntData.cpp:
207 (JSC::LLInt::initialize):
210 * llint/LLIntOfflineAsmConfig.h:
211 * llint/LLIntOpcode.h:
212 * llint/LLIntThunks.cpp:
214 * llint/LowLevelInterpreter.asm:
215 * llint/LowLevelInterpreter.cpp:
217 (JSC::LLInt::Ints2Double):
219 (JSC::CLoop::execute):
220 * llint/LowLevelInterpreter.h:
222 * llint/LowLevelInterpreter32_64.asm:
223 * llint/LowLevelInterpreter64.asm:
225 * offlineasm/backends.rb:
226 * offlineasm/cloop.rb: Added.
227 * offlineasm/instructions.rb:
228 * runtime/Executable.h:
230 (JSC::ExecutableBase::hostCodeEntryFor):
231 (JSC::ExecutableBase::jsCodeEntryFor):
232 (JSC::ExecutableBase::jsCodeWithArityCheckEntryFor):
233 (JSC::ExecutableBase::catchRoutineFor):
239 * runtime/JSValueInlineMethods.h:
241 (JSC::JSValue::JSValue):
242 * runtime/Options.cpp:
243 (JSC::Options::initialize):
245 2012-08-31 Mark Lam <mark.lam@apple.com>
247 Refactor LLInt and supporting code in preparation for the C Loop backend.
248 https://bugs.webkit.org/show_bug.cgi?id=95531.
250 Reviewed by Filip Pizlo.
252 * bytecode/GetByIdStatus.cpp:
253 (JSC::GetByIdStatus::computeFromLLInt):
254 * bytecode/PutByIdStatus.cpp:
255 (JSC::PutByIdStatus::computeFromLLInt):
256 * jit/JITExceptions.cpp:
257 (JSC::genericThrow): Use ExecutableBase::catchRoutineFor() to fetch
258 fetch the catch routine for a thrown exception. This will allow
259 us to redefine that for the C loop later, and still keep this
261 * llint/LLIntOfflineAsmConfig.h: Moved ASM macros to
262 LowLevelInterpreter.cpp which is the only place they are used. This
263 will make it more convenient to redefine them for the C loop later.
264 * llint/LLIntSlowPaths.cpp:
265 (JSC::LLInt::setUpCall): Use ExecutableBase's hostCodeEntry()
266 jsCodeEntryFor(), and jsCodeWithArityCheckEntryFor() for computing
267 the entry points to functions being called.
268 * llint/LLIntSlowPaths.h:
269 (SlowPathReturnType):
270 (JSC::LLInt::encodeResult):
272 (JSC::LLInt::decodeResult): Added. Needed by LLInt C Loop later.
273 * llint/LowLevelInterpreter.asm:
274 * llint/LowLevelInterpreter.cpp:
275 * llint/LowLevelInterpreter32_64.asm:
276 * llint/LowLevelInterpreter64.asm:
277 * offlineasm/asm.rb: Disambiguate between opcodes and other labels.
278 * offlineasm/config.rb:
279 * runtime/Executable.h:
280 (JSC::ExecutableBase::hostCodeEntryFor): Added.
282 (JSC::ExecutableBase::jsCodeEntryFor): Added.
283 (JSC::ExecutableBase::jsCodeWithArityCheckEntryFor): Added.
284 (JSC::ExecutableBase::catchRoutineFor): Added.
285 * runtime/JSValueInlineMethods.h:
288 2012-08-30 Mark Lam <mark.lam@apple.com>
290 Render unto #ifdef's that which belong to them.
291 https://bugs.webkit.org/show_bug.cgi?id=95482.
293 Reviewed by Filip Pizlo.
295 Refining / disambiguating between #ifdefs and adding some. For
296 example, ENABLE(JIT) is conflated with ENABLE(LLINT) in some places.
297 Also, we need to add ENABLE(COMPUTED_GOTO_OPCODES) to indicate that we
298 want interpreted opcodes to use COMPUTED GOTOs apart from ENABLE(LLINT)
299 and ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER). Also cleaned up #ifdefs
300 in certain places which were previously incorrect.
302 * bytecode/CodeBlock.cpp:
304 (JSC::CodeBlock::bytecodeOffset):
305 * bytecode/CodeBlock.h:
308 (JSC::padOpcodeName):
310 * dfg/DFGOperations.cpp:
311 * interpreter/AbstractPC.cpp:
312 (JSC::AbstractPC::AbstractPC):
313 * interpreter/CallFrame.h:
315 * interpreter/Interpreter.cpp:
316 (JSC::Interpreter::~Interpreter):
317 (JSC::Interpreter::initialize):
318 (JSC::Interpreter::isOpcode):
319 (JSC::Interpreter::unwindCallFrame):
320 (JSC::getLineNumberForCallFrame):
321 (JSC::getCallerInfo):
322 (JSC::Interpreter::execute):
323 (JSC::Interpreter::executeCall):
324 (JSC::Interpreter::executeConstruct):
325 (JSC::Interpreter::privateExecute):
326 * interpreter/Interpreter.h:
327 (JSC::Interpreter::getOpcode):
328 (JSC::Interpreter::getOpcodeID):
330 * jit/HostCallReturnValue.h:
333 * jit/JITExceptions.cpp:
334 * jit/JITExceptions.h:
335 * jit/JSInterfaceJIT.h:
337 (JSC::LLInt::getOpcode):
338 * llint/LLIntEntrypoints.cpp:
339 (JSC::LLInt::getFunctionEntrypoint):
340 (JSC::LLInt::getEvalEntrypoint):
341 (JSC::LLInt::getProgramEntrypoint):
342 * llint/LLIntOffsetsExtractor.cpp:
343 (JSC::LLIntOffsetsExtractor::dummy):
344 * llint/LLIntSlowPaths.cpp:
346 * runtime/JSGlobalData.cpp:
349 2012-08-23 Christophe Dumez <christophe.dumez@intel.com>
351 Serialization of JavaScript values does not appear to respect new HTML5 Structured Clone semantics
352 https://bugs.webkit.org/show_bug.cgi?id=65292
354 Reviewed by Oliver Hunt.
356 Add function to construct a StringObject from a JSValue.
357 Similar functions already exist for NumberObject and
358 BooleanObject for example.
360 Export several symbols so address linking errors in
363 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
364 * runtime/BooleanObject.h:
366 * runtime/NumberObject.h:
369 * runtime/StringObject.cpp:
370 (JSC::constructString):
372 * runtime/StringObject.h:
375 2012-08-30 Mark Lam <mark.lam@apple.com>
377 Fix broken classic intrpreter build.
378 https://bugs.webkit.org/show_bug.cgi?id=95484.
380 Reviewed by Filip Pizlo.
382 * interpreter/Interpreter.cpp:
383 (JSC::Interpreter::privateExecute):
385 2012-08-29 Mark Lam <mark.lam@apple.com>
387 Refactoring LLInt::Data.
388 https://bugs.webkit.org/show_bug.cgi?id=95316.
390 Reviewed by Geoff Garen.
392 This change allows its opcodeMap to be easily queried from any function
393 without needing to go through a GlobalData object. It also introduces
394 the LLInt::getCodePtr() methods that will be used by the LLInt C loop
395 later to redefine how llint symbols (opcodes and trampoline glue
396 labels) get resolved.
398 * assembler/MacroAssemblerCodeRef.h:
399 (MacroAssemblerCodePtr):
400 (JSC::MacroAssemblerCodePtr::createLLIntCodePtr):
401 (MacroAssemblerCodeRef):
402 (JSC::MacroAssemblerCodeRef::createLLIntCodeRef):
403 * bytecode/CodeBlock.cpp:
404 (JSC::CodeBlock::adjustPCIfAtCallSite):
405 (JSC::CodeBlock::bytecodeOffset):
407 Remove the 'const' to simplify things and avoid having to do
408 additional casts and #ifdefs in many places.
409 * bytecode/ResolveGlobalStatus.cpp:
410 (JSC::computeForLLInt):
411 * bytecompiler/BytecodeGenerator.cpp:
412 (JSC::BytecodeGenerator::generate):
413 * interpreter/Interpreter.cpp:
414 (JSC::Interpreter::initialize):
415 * interpreter/Interpreter.h:
417 * jit/JITExceptions.cpp:
419 * llint/LLIntData.cpp:
421 (JSC::LLInt::initialize):
426 (JSC::LLInt::exceptionInstructions):
427 (JSC::LLInt::opcodeMap):
428 (JSC::LLInt::getOpcode):
429 (JSC::LLInt::getCodePtr):
430 (JSC::LLInt::Data::performAssertions):
431 * llint/LLIntExceptions.cpp:
432 (JSC::LLInt::returnToThrowForThrownException):
433 (JSC::LLInt::returnToThrow):
434 (JSC::LLInt::callToThrow):
435 * llint/LLIntSlowPaths.cpp:
436 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
437 (JSC::LLInt::handleHostCall):
438 * runtime/InitializeThreading.cpp:
439 (JSC::initializeThreadingOnce): Initialize the singleton LLInt data.
440 * runtime/JSGlobalData.cpp:
441 (JSC::JSGlobalData::JSGlobalData):
442 * runtime/JSGlobalData.h:
443 (JSGlobalData): Removed the now unneeded LLInt::Data instance in
448 2012-08-24 Filip Pizlo <fpizlo@apple.com>
450 Finally inlining should correctly track the catch context
451 https://bugs.webkit.org/show_bug.cgi?id=94986
452 <rdar://problem/11753784>
454 Reviewed by Sam Weinig.
456 This fixes two behaviors:
458 1) Throwing from a finally block. Previously, we would seem to reenter the finally
459 block - though only once.
461 2) Executing a finally block from some nested context, for example due to a
462 'continue', 'break', or 'return' in the try. This would execute the finally
463 block in the context of of the try block, which could lead to either scope depth
464 mismatches or reexecutions of the finally block on throw, similarly to (1) but
465 for different reasons.
467 * bytecompiler/BytecodeGenerator.cpp:
469 (JSC::BytecodeGenerator::pushFinallyContext):
470 (JSC::BytecodeGenerator::emitComplexJumpScopes):
471 (JSC::BytecodeGenerator::pushTry):
472 (JSC::BytecodeGenerator::popTryAndEmitCatch):
473 * bytecompiler/BytecodeGenerator.h:
480 * bytecompiler/NodesCodegen.cpp:
481 (JSC::TryNode::emitBytecode):
483 2012-08-28 Mark Lam <mark.lam@apple.com>
485 Adding support for adding LLInt opcode extensions. This will be needed
486 by the LLInt C loop interpreter later.
487 https://bugs.webkit.org/show_bug.cgi?id=95277.
489 Reviewed by Geoffrey Garen.
491 * JavaScriptCore.xcodeproj/project.pbxproj:
493 * llint/LLIntOpcode.h: Added.
494 * llint/LowLevelInterpreter.h:
496 2012-08-28 Filip Pizlo <fpizlo@apple.com>
498 LLInt should not rely on ordering of global labels
499 https://bugs.webkit.org/show_bug.cgi?id=95221
501 Reviewed by Oliver Hunt.
503 * llint/LowLevelInterpreter.asm:
504 * llint/LowLevelInterpreter32_64.asm:
505 * llint/LowLevelInterpreter64.asm:
507 2012-08-20 Mark Lam <mark.lam@apple.com>
509 Fix broken non-JIT build.
510 https://bugs.webkit.org/show_bug.cgi?id=94564.
512 Reviewed by Filip Pizlo.
514 Added some UNUSED_PARAM() macros to make the compiler happy.
516 * runtime/Executable.cpp:
517 (JSC::EvalExecutable::compileInternal):
518 (JSC::ProgramExecutable::compileInternal):
519 (JSC::FunctionExecutable::compileForCallInternal):
520 (JSC::FunctionExecutable::compileForConstructInternal):
522 2012-08-20 Mark Lam <mark.lam@apple.com>
524 Fixed erroneous line number for LLint frame when throwing exceptions.
525 https://bugs.webkit.org/show_bug.cgi?id=94051.
527 Reviewed by Filip Pizlo.
529 For LLInt frames, before throwing an exception, adjust the PC from the
530 return PC back to the call PC if we are indeed at a call site.
532 * bytecode/CodeBlock.cpp:
533 (JSC::CodeBlock::adjustPCIfAtCallSite):
535 (JSC::CodeBlock::bytecodeOffset):
536 * bytecode/CodeBlock.h:
538 * llint/LLIntExceptions.cpp:
539 (JSC::LLInt::fixupPCforExceptionIfNeeded):
541 (JSC::LLInt::interpreterThrowInCaller):
542 (JSC::LLInt::returnToThrow):
543 (JSC::LLInt::callToThrow):
545 2012-08-03 Filip Pizlo <fpizlo@apple.com>
547 Crashes in dfgBuildPutByIdList when clicking on just about anything on Google Maps
548 https://bugs.webkit.org/show_bug.cgi?id=92691
550 Reviewed by Mark Hahnenberg.
552 The state of the stubs was changing after we determined the type (by virtue of the slow path
553 function that was called), since the get or put (in this case put) could cause arbitrary
554 side effects. Perhaps a full-blown fix would be to eliminate our reliance of the slow path
555 function to determine what to do, but an easier fix for now is to have the slow path give up
556 if its assumptions were invalidated by a side effect.
558 * dfg/DFGOperations.cpp:
560 (JSC::DEFINE_STUB_FUNCTION):
562 2012-08-03 Filip Pizlo <fpizlo@apple.com>
564 DFG handling of get_by_id should always inject a ForceOSRExit node if there is no prediction
565 https://bugs.webkit.org/show_bug.cgi?id=93162
567 Reviewed by Mark Hahnenberg.
569 This simplifies the DFG IR by ensuring that all nodes that use value profiles will be preceded
570 by a ForceOSRExit if the value profile had no data.
572 * dfg/DFGByteCodeParser.cpp:
573 (JSC::DFG::ByteCodeParser::parseBlock):
575 2012-08-03 Filip Pizlo <fpizlo@apple.com>
577 DFG::StructureCheckHoistingPhase keeps a Node& around for too long
578 https://bugs.webkit.org/show_bug.cgi?id=93157
580 Reviewed by Mark Hahnenberg.
582 * dfg/DFGStructureCheckHoistingPhase.cpp:
583 (JSC::DFG::StructureCheckHoistingPhase::run):
585 2012-08-02 Filip Pizlo <fpizlo@apple.com>
587 ASSERTION FAILED: at(m_compileIndex).canExit() || m_isCheckingArgumentTypes
588 https://bugs.webkit.org/show_bug.cgi?id=91074
590 Reviewed by Mark Hahnenberg.
592 Fixes a bug where the speculative JIT was performing an unnecessary speculation that the
593 CFA had proven shouldn't be performed, leading to asserts that a node should not have
594 exit sites. This is a debug-only assert with no release symptom - we were just emitting
595 a check that was not reachable.
597 Also found, and fixed, a bug where structure check hoisting was slightly confusing the
598 CFA by inserting GetLocal's into the graph. CSE would clean the GetLocal's up, which
599 would make the backend happy - but the CFA would produce subtly wrong results.
601 * bytecode/SpeculatedType.h:
602 (JSC::isOtherOrEmptySpeculation):
607 (JSC::DFG::Graph::dump):
608 * dfg/DFGSpeculativeJIT64.cpp:
609 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
610 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
612 2012-08-02 Filip Pizlo <fpizlo@apple.com>
614 Unreviewed, build fix for DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE).
616 * dfg/DFGStructureCheckHoistingPhase.cpp:
617 (JSC::DFG::StructureCheckHoistingPhase::run):
619 2012-08-01 Mark Hahnenberg <mhahnenberg@apple.com>
621 Remove all uses of ClassInfo for JSStrings in JIT code
622 https://bugs.webkit.org/show_bug.cgi?id=92935
624 Reviewed by Geoffrey Garen.
626 This is the first step in removing our dependence on in-object ClassInfo pointers
627 in JIT code. Most of the changes are to check the Structure, which is unique for
630 * bytecode/SpeculatedType.cpp:
631 (JSC::speculationFromClassInfo):
632 (JSC::speculationFromStructure): Changed to check the TypeInfo in the Structure
633 since there wasn't a JSGlobalData immediately available to grab the JSString
635 * dfg/DFGSpeculativeJIT.cpp:
636 (JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage):
637 * dfg/DFGSpeculativeJIT32_64.cpp:
638 (JSC::DFG::SpeculativeJIT::compile):
639 * dfg/DFGSpeculativeJIT64.cpp:
640 (JSC::DFG::SpeculativeJIT::compile):
641 * jit/JITInlineMethods.h:
642 (JSC::JIT::emitLoadCharacterString):
643 * jit/JITOpcodes.cpp:
644 (JSC::JIT::privateCompileCTIMachineTrampolines):
645 (JSC::JIT::emit_op_to_primitive):
646 (JSC::JIT::emit_op_convert_this):
647 * jit/JITOpcodes32_64.cpp:
648 (JSC::JIT::privateCompileCTIMachineTrampolines):
649 (JSC::JIT::emit_op_to_primitive):
650 (JSC::JIT::emitSlow_op_eq):
651 (JSC::JIT::emitSlow_op_neq):
652 (JSC::JIT::compileOpStrictEq):
653 (JSC::JIT::emit_op_convert_this):
654 * jit/JITPropertyAccess.cpp:
655 (JSC::JIT::stringGetByValStubGenerator):
656 (JSC::JIT::emitSlow_op_get_by_val):
657 * jit/JITPropertyAccess32_64.cpp:
658 (JSC::JIT::stringGetByValStubGenerator):
659 (JSC::JIT::emitSlow_op_get_by_val):
660 * jit/SpecializedThunkJIT.h:
661 (JSC::SpecializedThunkJIT::loadJSStringArgument):
662 * jit/ThunkGenerators.cpp:
663 (JSC::stringCharLoad):
664 (JSC::charCodeAtThunkGenerator):
665 (JSC::charAtThunkGenerator):
667 2012-08-02 Filip Pizlo <fpizlo@apple.com>
669 Unreviewed, missed a style goof in the previous patch: "NodeIndex nodeIndex"
670 in a method signature is painfully redundant.
672 * dfg/DFGSpeculativeJIT.h:
675 2012-08-02 Filip Pizlo <fpizlo@apple.com>
677 DFGSpeculativeJIT.h has too many inline method bodies
678 https://bugs.webkit.org/show_bug.cgi?id=92957
680 Reviewed by Antti Koivisto.
682 * dfg/DFGSpeculativeJIT.cpp:
683 (JSC::DFG::SpeculativeJIT::speculationCheck):
685 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
686 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
687 (JSC::DFG::SpeculativeJIT::speculationCheckWithConditionalDirection):
688 (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution):
689 (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecutionWithConditionalDirection):
690 * dfg/DFGSpeculativeJIT.h:
693 2012-08-01 Filip Pizlo <fpizlo@apple.com>
695 DFG should hoist structure checks
696 https://bugs.webkit.org/show_bug.cgi?id=92696
698 Reviewed by Gavin Barraclough.
700 This hoists structure checks in the same way that we would hoist array checks, but with added
701 complexity to cope with the fact that the structure of an object may change. This is handled
702 by performing a side effects analysis over the region in which the respective variable is
703 live. If a structure clobbering side effect may happen then we either hoist the structure
704 checks and fall back on structure transition watchpoints (if the watchpoint set is still
705 valid), or we avoid hoisting altogether.
707 Doing this required teaching the CFA that we may have an expectation that an object has a
708 particular structure even after structure clobbering happens, in the sense that structure
709 proofs that were cobbered can be revived using watchpoints. CFA must know about this so that
710 OSR entry may know about it, since we cannot allow entry to happen if the variable has a
711 clobbered structure proof, will have a watchpoint to revive the proof, and the variable in
712 the baseline JIT has a completely unrelated structure.
714 This is mostly performance neutral.
717 * GNUmakefile.list.am:
718 * JavaScriptCore.xcodeproj/project.pbxproj:
720 * bytecode/ValueRecovery.h:
721 (JSC::ValueRecovery::isSet):
722 (JSC::ValueRecovery::operator!):
724 * dfg/DFGAbstractState.cpp:
725 (JSC::DFG::AbstractState::execute):
726 (JSC::DFG::AbstractState::clobberWorld):
728 (JSC::DFG::AbstractState::clobberCapturedVars):
729 * dfg/DFGAbstractState.h:
731 * dfg/DFGAbstractValue.h:
732 (JSC::DFG::AbstractValue::clear):
733 (JSC::DFG::AbstractValue::isClear):
734 (JSC::DFG::AbstractValue::makeTop):
735 (JSC::DFG::AbstractValue::isTop):
736 (JSC::DFG::AbstractValue::set):
737 (JSC::DFG::AbstractValue::operator==):
738 (JSC::DFG::AbstractValue::merge):
739 (JSC::DFG::AbstractValue::filter):
740 (JSC::DFG::AbstractValue::validate):
741 (JSC::DFG::AbstractValue::validateForEntry):
743 (JSC::DFG::AbstractValue::checkConsistency):
744 (JSC::DFG::AbstractValue::dump):
745 * dfg/DFGByteCodeParser.cpp:
746 (JSC::DFG::ByteCodeParser::setLocal):
747 (JSC::DFG::ByteCodeParser::getArgument):
748 (JSC::DFG::ByteCodeParser::setArgument):
749 (JSC::DFG::ByteCodeParser::parseBlock):
750 (JSC::DFG::ByteCodeParser::fixVariableAccessSpeculations):
751 * dfg/DFGCSEPhase.cpp:
752 (JSC::DFG::CSEPhase::checkStructureLoadElimination):
753 (JSC::DFG::CSEPhase::structureTransitionWatchpointElimination):
754 (JSC::DFG::CSEPhase::putStructureStoreElimination):
755 (JSC::DFG::CSEPhase::getLocalLoadElimination):
756 (JSC::DFG::CSEPhase::performNodeCSE):
760 (JSC::DFG::Graph::dump):
762 (JSC::DFG::Graph::vote):
765 (JSC::DFG::Node::convertToStructureTransitionWatchpoint):
767 (JSC::DFG::Node::hasStructureSet):
770 * dfg/DFGOSREntry.cpp:
771 (JSC::DFG::prepareOSREntry):
772 * dfg/DFGPredictionPropagationPhase.cpp:
773 (JSC::DFG::PredictionPropagationPhase::propagate):
774 (PredictionPropagationPhase):
775 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):
776 * dfg/DFGSpeculativeJIT.h:
778 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
779 (JSC::DFG::SpeculativeJIT::speculationCheckWithConditionalDirection):
780 (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecutionWithConditionalDirection):
781 (JSC::DFG::SpeculateCellOperand::SpeculateCellOperand):
782 (JSC::DFG::SpeculateCellOperand::gpr):
783 (SpeculateCellOperand):
784 * dfg/DFGSpeculativeJIT32_64.cpp:
785 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
786 (JSC::DFG::SpeculativeJIT::compile):
787 * dfg/DFGSpeculativeJIT64.cpp:
788 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
789 (JSC::DFG::SpeculativeJIT::compile):
790 * dfg/DFGStructureCheckHoistingPhase.cpp: Added.
792 (StructureCheckHoistingPhase):
793 (JSC::DFG::StructureCheckHoistingPhase::StructureCheckHoistingPhase):
794 (JSC::DFG::StructureCheckHoistingPhase::run):
795 (JSC::DFG::StructureCheckHoistingPhase::noticeStructureCheck):
796 (JSC::DFG::StructureCheckHoistingPhase::noticeClobber):
797 (JSC::DFG::StructureCheckHoistingPhase::clobber):
799 (JSC::DFG::StructureCheckHoistingPhase::CheckData::CheckData):
800 (JSC::DFG::performStructureCheckHoisting):
801 * dfg/DFGStructureCheckHoistingPhase.h: Added.
803 * dfg/DFGVariableAccessData.h:
804 (VariableAccessData):
805 (JSC::DFG::VariableAccessData::VariableAccessData):
806 (JSC::DFG::VariableAccessData::mergeStructureCheckHoistingFailed):
807 (JSC::DFG::VariableAccessData::structureCheckHoistingFailed):
808 (JSC::DFG::VariableAccessData::clearVotes):
809 (JSC::DFG::VariableAccessData::vote):
810 (JSC::DFG::VariableAccessData::voteRatio):
811 (JSC::DFG::VariableAccessData::shouldUseDoubleFormatAccordingToVote):
815 2012-08-01 Filip Pizlo <fpizlo@apple.com>
817 DFG should distinguish between PutByVal's that clobber the world and ones that don't
818 https://bugs.webkit.org/show_bug.cgi?id=92923
820 Reviewed by Mark Hahnenberg.
822 This is performance-neutral. I also confirmed that it's neutral if we make the
823 clobbering variant (PutByValSafe) clobber all knowledge of what is an array,
824 which should feed nicely into work on removing uses of ClassInfo.
826 * bytecode/DFGExitProfile.h:
827 * dfg/DFGAbstractState.cpp:
828 (JSC::DFG::AbstractState::execute):
829 * dfg/DFGByteCodeParser.cpp:
830 (JSC::DFG::ByteCodeParser::parseBlock):
831 * dfg/DFGCSEPhase.cpp:
832 (JSC::DFG::CSEPhase::getByValLoadElimination):
833 (JSC::DFG::CSEPhase::checkStructureLoadElimination):
834 (JSC::DFG::CSEPhase::structureTransitionWatchpointElimination):
835 (JSC::DFG::CSEPhase::getByOffsetLoadElimination):
836 (JSC::DFG::CSEPhase::putByOffsetStoreElimination):
837 (JSC::DFG::CSEPhase::getPropertyStorageLoadElimination):
838 (JSC::DFG::CSEPhase::getIndexedPropertyStorageLoadElimination):
839 (JSC::DFG::CSEPhase::performNodeCSE):
840 * dfg/DFGFixupPhase.cpp:
841 (JSC::DFG::FixupPhase::fixupNode):
843 (JSC::DFG::Graph::byValIsPure):
844 (JSC::DFG::Graph::clobbersWorld):
847 * dfg/DFGPredictionPropagationPhase.cpp:
848 (JSC::DFG::PredictionPropagationPhase::propagate):
849 * dfg/DFGSpeculativeJIT32_64.cpp:
850 (JSC::DFG::SpeculativeJIT::compile):
851 * dfg/DFGSpeculativeJIT64.cpp:
852 (JSC::DFG::SpeculativeJIT::compile):
854 2012-08-01 Mark Hahnenberg <mhahnenberg@apple.com>
856 C++ code should get ClassInfo from the Structure
857 https://bugs.webkit.org/show_bug.cgi?id=92892
859 Reviewed by Geoffrey Garen.
861 In our march to remove ClassInfo from our JSCell object headers, we can switch
862 C++ code over to grabbing the ClassInfo from the Structure since it is finally
863 safe to do so now that Structure access is safe during finalization/destruction.
864 The remaining JIT code changes can be done in a separate patch.
866 * heap/MarkedBlock.cpp:
867 (JSC::MarkedBlock::callDestructor): We don't want to clear the Structure any more
868 since the Structure should still be valid at this point.
869 * heap/WeakSetInlines.h:
870 (JSC::WeakBlock::finalize): Ditto.
873 * runtime/Structure.h:
874 (JSC::JSCell::classInfo): Move JSCell's classInfo() to Structure.h so it can be
875 inline. Use a different method of getting the JSCell's Structure based on
876 whether we're in GC_VALIDATION mode or not, since always using get() will cause
877 infinite recursion in GC_VALIDATION mode.
880 2012-07-31 Mark Hahnenberg <mhahnenberg@apple.com>
882 MarkedBlock::sweep() should sweep another block if it can't sweep a Structure block
883 https://bugs.webkit.org/show_bug.cgi?id=92819
885 Reviewed by Geoffrey Garen.
887 If we are forced to allocate a new block for Structures because we are unable to safely
888 sweep our pre-existing Structure blocks, we should sweep another random block so that we
889 can start sweeping Structure blocks sooner.
891 * heap/IncrementalSweeper.cpp:
892 (JSC::IncrementalSweeper::doSweep): Change to use sweepNextBlock.
894 (JSC::IncrementalSweeper::sweepNextBlock):
895 * heap/IncrementalSweeper.h:
896 (IncrementalSweeper):
897 * heap/MarkedAllocator.cpp:
898 (JSC::MarkedAllocator::tryAllocateHelper): When we can't safely sweep
899 our Structure blocks, call sweepNextBlock instead.
901 2012-07-31 Sam Weinig <sam@webkit.org>
903 Fix the Windows build.
905 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
907 2012-07-31 Geoffrey Garen <ggaren@apple.com>
909 Maybe fix the GCC build.
912 (HeapBlock): Accommodate incorrect parsing in GCC.
914 2012-07-31 Geoffrey Garen <ggaren@apple.com>
916 Maybe break the Windows build.
918 Reviewed by Anders Carlsson.
920 Formally objected to by Sam Weinig.
923 (HeapBlock): Try to slightly improve this because we don't want Windows to control our lives.
925 2012-07-30 Mark Hahnenberg <mhahnenberg@apple.com>
927 Structures should be swept after all other objects
928 https://bugs.webkit.org/show_bug.cgi?id=92679
930 Reviewed by Filip Pizlo.
932 In order to get rid of ClassInfo from our objects, we need to be able to safely get the
933 ClassInfo during the destruction of objects. We'd like to get the ClassInfo out of the
934 Structure, but currently it is not safe to do so because the order of destruction of objects
935 is not guaranteed to sweep objects before their corresponding Structure. We can fix this by
936 sweeping Structures after everything else.
939 (JSC::Heap::isSafeToSweepStructures): Add a function that checks if it is safe to sweep Structures.
940 If the Heap's IncrementalSweeper member is null, that means we're shutting down this VM and it is
941 safe to sweep structures since we'll always do Structures last anyways due to the ordering of
942 MarkedSpace::forEachBlock.
944 (JSC::Heap::didStartVMShutdown): Add this intermediate function to the Heap that ~JSGlobalData now
945 calls rather than calling the two HeapTimer objects individually. This allows the Heap to null out
946 these pointers after it has invalidated them to prevent accidental use-after-free in the sweep()
947 calls during lastChanceToFinalize().
952 * heap/IncrementalSweeper.cpp:
953 (JSC::IncrementalSweeper::structuresCanBeSwept): Determines if it is currently safe to sweep Structures.
954 This decision is based on whether we have gotten to the end of the vector of blocks that need sweeping
957 (JSC::IncrementalSweeper::doSweep): We add a second pass over the vector to sweep Structures after we
958 make our first pass. We now null out the slots as we sweep them so that we can quickly find the
959 Structures during the second pass.
960 (JSC::IncrementalSweeper::startSweeping): Initialize our new Structure sweeping index.
961 (JSC::IncrementalSweeper::willFinishSweeping): Callback that is called by MarkedSpace::sweep to notify
962 the IncrementalSweeper that we are going to sweep all of the remaining blocks in the Heap so it can
963 assume that everything is taken care of in the correct order. Since MarkedSpace::forEachBlock
964 iterates over the Structure blocks after all other blocks, the ordering property for sweeping Structures holds.
965 (JSC::IncrementalSweeper::IncrementalSweeper): Initialize Structure sweeping index.
966 * heap/IncrementalSweeper.h: Add declarations for new stuff.
967 (IncrementalSweeper):
968 * heap/MarkedAllocator.cpp:
969 (JSC::MarkedAllocator::tryAllocateHelper): We now check if the current block only contains structures and
970 if so and it isn't safe to sweep Structures according to the Heap, we just return early instead of doing
971 the normal lazy sweep. If this proves to be too much of a waste in the future we can add an extra clause that
972 will sweep some number of other blocks in place of the current block to mitigate the cost of the floating
974 (JSC::MarkedAllocator::addBlock):
975 * heap/MarkedAllocator.h:
976 (JSC::MarkedAllocator::zapFreeList): When we zap the free list in the MarkedAllocator, the current block is no
977 longer valid to allocate from, so we set the current block to null.
978 * heap/MarkedBlock.cpp:
979 (JSC::MarkedBlock::sweepHelper): Added a couple assertions to make sure that we weren't trying to sweep Structures
981 * heap/MarkedSpace.cpp:
982 (JSC::MarkedSpace::sweep): Notify the IncrementalSweeper that the MarkedSpace will finish all currently remaining sweeping.
984 * heap/MarkedSpace.h:
986 * runtime/JSGlobalData.cpp:
987 (JSC::JSGlobalData::~JSGlobalData): Call the new Heap::didStartVMShutdown.
989 2012-07-31 Geoffrey Garen <ggaren@apple.com>
991 Fix all the other builds I just broke. Maybe fix the Windows build.
996 2012-07-31 Geoffrey Garen <ggaren@apple.com>
998 Maybe fix the Windows build.
1003 2012-07-31 Geoffrey Garen <ggaren@apple.com>
1005 Maybe fix the Windows build.
1010 2012-07-31 Geoffrey Garen <ggaren@apple.com>
1012 Removed some public data and casting from the Heap
1013 https://bugs.webkit.org/show_bug.cgi?id=92777
1015 Reviewed by Oliver Hunt.
1017 * heap/BlockAllocator.cpp:
1018 (JSC::BlockAllocator::releaseFreeBlocks):
1019 (JSC::BlockAllocator::blockFreeingThreadMain): Use the DeadBlock class
1020 since HeapBlock is a template, and not a class, now. Call destroy()
1021 instead of monkeying around with DeadBlock's internal data because
1022 encapsulation is good.
1024 * heap/BlockAllocator.h:
1025 (DeadBlock): Added a class to represent a dead block, since HeapBlock is
1026 a template now, and can't be instantiated directly.
1028 (JSC::DeadBlock::DeadBlock):
1029 (JSC::DeadBlock::create):
1031 (JSC::BlockAllocator::allocate):
1032 (JSC::BlockAllocator::deallocate): Use the DeadBlock class because
1033 encapsulation is good.
1035 * heap/CopiedBlock.h:
1036 (CopiedBlock::destroy): No need for a destroy() function, since we
1039 (JSC::CopiedBlock::CopiedBlock):
1040 (JSC::CopiedBlock::payloadEnd):
1041 (JSC::CopiedBlock::capacity): Updated for some encapsulation inside
1044 * heap/CopiedSpace.cpp:
1045 (JSC::CopiedSpace::~CopiedSpace):
1046 (JSC::CopiedSpace::doneCopying):
1047 (JSC::CopiedSpace::size):
1048 (JSC::CopiedSpace::capacity):
1049 (JSC::isBlockListPagedOut): Removed a bunch of casting. This is no longer
1050 necessary, now that our list and its nodes have the right type.
1052 * heap/CopiedSpace.h: Use the right type in our data structures because
1053 it improves clarity.
1055 * heap/CopiedSpaceInlineMethods.h:
1056 (JSC::CopiedSpace::startedCopying): Use swap to avoid duplicating it.
1059 (HeapBlock): Made this a class template so we can return the right type
1060 in linked list operations. Made our data private because encapsulation
1063 (JSC::HeapBlock::destroy): Since we know our type, we can also eliminate
1064 duplicate destroy() functions in our subclasses.
1066 (JSC::HeapBlock::allocation): Added an accessor so we can hide our data.
1067 By using const, this accessor prevents clients from accidentally deleting
1070 * heap/MarkedAllocator.cpp:
1071 (JSC::MarkedAllocator::isPagedOut):
1072 (JSC::MarkedAllocator::tryAllocateHelper):
1073 (JSC::MarkedAllocator::removeBlock): Removed a bunch of casting. This is
1074 no longer necessary, now that our list and its nodes have the right type.
1076 * heap/MarkedAllocator.h:
1078 (JSC::MarkedAllocator::reset):
1079 (JSC::MarkedAllocator::forEachBlock): Use the right type, do less casting.
1081 * heap/MarkedBlock.cpp:
1082 (JSC::MarkedBlock::destroy): Removed this function because our parent
1083 class provides it for us now.
1085 (JSC::MarkedBlock::MarkedBlock):
1086 * heap/MarkedBlock.h:
1088 (JSC::MarkedBlock::capacity): Updated for encapsulation.
1090 2012-07-31 Filip Pizlo <fpizlo@apple.com>
1092 DFG OSR exit profiling has unusual oversights
1093 https://bugs.webkit.org/show_bug.cgi?id=92728
1095 Reviewed by Geoffrey Garen.
1097 * dfg/DFGOSRExit.cpp:
1098 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
1099 * dfg/DFGSpeculativeJIT.h:
1100 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
1101 * dfg/DFGSpeculativeJIT32_64.cpp:
1102 (JSC::DFG::SpeculativeJIT::compile):
1103 * dfg/DFGSpeculativeJIT64.cpp:
1104 (JSC::DFG::SpeculativeJIT::compile):
1106 2012-07-31 Chao-ying Fu <fu@mips.com>
1108 Add MIPS add32 function
1109 https://bugs.webkit.org/show_bug.cgi?id=91522
1111 Reviewed by Oliver Hunt.
1113 Add isCompactPtrAlignedAddressOffset.
1114 Add a new version of add32 that accepts AbsoluteAddress as inputs.
1116 * assembler/MacroAssemblerMIPS.h:
1117 (JSC::MacroAssemblerMIPS::isCompactPtrAlignedAddressOffset): New.
1118 (MacroAssemblerMIPS):
1119 (JSC::MacroAssemblerMIPS::add32): Support AbsoluteAddress as inputs.
1121 2012-07-30 Sheriff Bot <webkit.review.bot@gmail.com>
1123 Unreviewed, rolling out r124123.
1124 http://trac.webkit.org/changeset/124123
1125 https://bugs.webkit.org/show_bug.cgi?id=92700
1127 ASSERT crashes terminate webkit Layout tests (Requested by
1128 msaboff on #webkit).
1133 * heap/IncrementalSweeper.cpp:
1134 (JSC::IncrementalSweeper::doSweep):
1135 (JSC::IncrementalSweeper::startSweeping):
1136 (JSC::IncrementalSweeper::IncrementalSweeper):
1138 * heap/IncrementalSweeper.h:
1139 (IncrementalSweeper):
1140 * heap/MarkedAllocator.cpp:
1141 (JSC::MarkedAllocator::tryAllocateHelper):
1142 (JSC::MarkedAllocator::addBlock):
1143 * heap/MarkedAllocator.h:
1144 (JSC::MarkedAllocator::zapFreeList):
1145 * heap/MarkedBlock.cpp:
1146 (JSC::MarkedBlock::sweepHelper):
1147 * heap/MarkedSpace.cpp:
1148 * heap/MarkedSpace.h:
1149 (JSC::MarkedSpace::sweep):
1151 * runtime/JSGlobalData.cpp:
1152 (JSC::JSGlobalData::~JSGlobalData):
1154 2012-07-30 Mark Hahnenberg <mhahnenberg@apple.com>
1156 Structures should be swept after all other objects
1157 https://bugs.webkit.org/show_bug.cgi?id=92679
1159 Reviewed by Filip Pizlo.
1161 In order to get rid of ClassInfo from our objects, we need to be able to safely get the
1162 ClassInfo during the destruction of objects. We'd like to get the ClassInfo out of the
1163 Structure, but currently it is not safe to do so because the order of destruction of objects
1164 is not guaranteed to sweep objects before their corresponding Structure. We can fix this by
1165 sweeping Structures after everything else.
1168 (JSC::Heap::isSafeToSweepStructures): Add a function that checks if it is safe to sweep Structures.
1169 If the Heap's IncrementalSweeper member is null, that means we're shutting down this VM and it is
1170 safe to sweep structures since we'll always do Structures last anyways due to the ordering of
1171 MarkedSpace::forEachBlock.
1173 (JSC::Heap::didStartVMShutdown): Add this intermediate function to the Heap that ~JSGlobalData now
1174 calls rather than calling the two HeapTimer objects individually. This allows the Heap to null out
1175 these pointers after it has invalidated them to prevent accidental use-after-free in the sweep()
1176 calls during lastChanceToFinalize().
1181 * heap/IncrementalSweeper.cpp:
1182 (JSC::IncrementalSweeper::structuresCanBeSwept): Determines if it is currently safe to sweep Structures.
1183 This decision is based on whether we have gotten to the end of the vector of blocks that need sweeping
1186 (JSC::IncrementalSweeper::doSweep): We add a second pass over the vector to sweep Structures after we
1187 make our first pass. We now null out the slots as we sweep them so that we can quickly find the
1188 Structures during the second pass.
1189 (JSC::IncrementalSweeper::startSweeping): Initialize our new Structure sweeping index.
1190 (JSC::IncrementalSweeper::willFinishSweeping): Callback that is called by MarkedSpace::sweep to notify
1191 the IncrementalSweeper that we are going to sweep all of the remaining blocks in the Heap so it can
1192 assume that everything is taken care of in the correct order. Since MarkedSpace::forEachBlock
1193 iterates over the Structure blocks after all other blocks, the ordering property for sweeping Structures holds.
1194 (JSC::IncrementalSweeper::IncrementalSweeper): Initialize Structure sweeping index.
1195 * heap/IncrementalSweeper.h: Add declarations for new stuff.
1196 (IncrementalSweeper):
1197 * heap/MarkedAllocator.cpp:
1198 (JSC::MarkedAllocator::tryAllocateHelper): We now check if the current block only contains structures and
1199 if so and it isn't safe to sweep Structures according to the Heap, we just return early instead of doing
1200 the normal lazy sweep. If this proves to be too much of a waste in the future we can add an extra clause that
1201 will sweep some number of other blocks in place of the current block to mitigate the cost of the floating
1203 (JSC::MarkedAllocator::addBlock):
1204 * heap/MarkedAllocator.h:
1205 (JSC::MarkedAllocator::zapFreeList): When we zap the free list in the MarkedAllocator, the current block is no
1206 longer valid to allocate from, so we set the current block to null.
1207 * heap/MarkedBlock.cpp:
1208 (JSC::MarkedBlock::sweepHelper): Added a couple assertions to make sure that we weren't trying to sweep Structures
1210 * heap/MarkedSpace.cpp:
1211 (JSC::MarkedSpace::sweep): Notify the IncrementalSweeper that the MarkedSpace will finish all currently remaining sweeping.
1213 * heap/MarkedSpace.h:
1215 * runtime/JSGlobalData.cpp:
1216 (JSC::JSGlobalData::~JSGlobalData): Call the new Heap::didStartVMShutdown.
1218 2012-07-29 Filip Pizlo <fpizlo@apple.com>
1220 PropertyNameArray::m_shouldCache is only assigned and never used
1221 https://bugs.webkit.org/show_bug.cgi?id=92598
1223 Reviewed by Dan Bernstein.
1225 * runtime/PropertyNameArray.h:
1226 (JSC::PropertyNameArray::PropertyNameArray):
1227 (PropertyNameArray):
1229 2012-07-29 Rik Cabanier <cabanier@adobe.com>
1231 Add ENABLE_CSS_COMPOSITING flag
1232 https://bugs.webkit.org/show_bug.cgi?id=92553
1234 Reviewed by Dirk Schulze.
1236 Adds compiler flag CSS_COMPOSITING to build systems to enable CSS blending and compositing. See spec https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html
1238 * Configurations/FeatureDefines.xcconfig:
1240 2012-07-27 Mark Hahnenberg <mhahnenberg@apple.com>
1242 Split functionality of MarkedAllocator::m_currentBlock
1243 https://bugs.webkit.org/show_bug.cgi?id=92550
1245 Reviewed by Filip Pizlo.
1247 MarkedAllocator::m_currentBlock serves two purposes right now; it indicates the block that is currently
1248 being used for allocation and the beginning of the list of blocks that need to be swept. We should split
1249 these two functionalities into two separate fields.
1251 * heap/MarkedAllocator.cpp:
1252 (JSC::MarkedAllocator::tryAllocateHelper): Use m_blocksToSweep instead of m_currentBlock as the
1253 initializer/reference of the loop. Only change m_currentBlock when we know what the result will be.
1254 (JSC::MarkedAllocator::addBlock): When we add a new block we know that both m_blocksToSweep and
1255 m_currentBlock are null. In order to preserve the invariant that m_currentBlock <= m_blocksToSweep,
1256 we assign both of them to point to the new block.
1257 (JSC::MarkedAllocator::removeBlock): We need a separate check to see if the block we're removing is
1258 m_blocksToSweep and if so, advance it to the next block in the list.
1259 * heap/MarkedAllocator.h:
1260 (MarkedAllocator): Initialize m_blocksToSweep.
1261 (JSC::MarkedAllocator::MarkedAllocator):
1262 (JSC::MarkedAllocator::reset): We set m_blocksToSweep to be the head of our list. This function is called
1263 at the end of a collection, so all of the blocks in our allocator need to be swept. We need to sweep a
1264 block before we can start allocating, so m_currentBlock is set to null. We also set the freeList to
1265 the empty FreeList to emphasize the fact that we can't start allocating until we do some sweeping.
1267 2012-07-27 Mark Hahnenberg <mhahnenberg@apple.com>
1269 Increase inline storage for JSFinalObjects by one
1270 https://bugs.webkit.org/show_bug.cgi?id=92526
1272 Reviewed by Geoffrey Garen.
1274 Now that we've removed the inheritorID from objects, we can increase our inline storage for JSFinalObjects on
1275 64-bit platforms by 1.
1277 * llint/LowLevelInterpreter.asm: Change the constant.
1278 * runtime/PropertyOffset.h: Change the constant.
1281 2012-07-27 Jer Noble <jer.noble@apple.com>
1283 Support a rational time class for use by media elements.
1284 https://bugs.webkit.org/show_bug.cgi?id=88787
1286 Re-export WTF::MediaTime from JavaScriptCore.
1288 Reviewed by Eric Carlson.
1290 * JavaScriptCore.order:
1291 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
1293 2012-07-26 Filip Pizlo <fpizlo@apple.com>
1295 JSObject::reallocateStorageIfNecessary is neither used nor defined
1296 https://bugs.webkit.org/show_bug.cgi?id=92417
1298 Reviewed by Mark Rowe.
1300 * runtime/JSObject.h:
1303 2012-07-26 Mark Hahnenberg <mhahnenberg@apple.com>
1305 Allocate Structures in a separate part of the Heap
1306 https://bugs.webkit.org/show_bug.cgi?id=92420
1308 Reviewed by Filip Pizlo.
1310 To fix our issue with destruction/finalization of Structures before their objects, we can move Structures to a separate
1311 part of the Heap that will be swept after all other objects. This first patch will just be separating Structures
1312 out into their own separate MarkedAllocator. Everything else will behave identically.
1314 * heap/Heap.h: New function to allocate Structures in the Heap.
1317 (JSC::Heap::allocateStructure):
1318 * heap/MarkedAllocator.cpp: Pass whether or not we're allocated Structures to the MarkedBlock.
1319 (JSC::MarkedAllocator::allocateBlock):
1320 * heap/MarkedAllocator.h: Add tracking for whether or not we're allocating only Structures.
1321 (JSC::MarkedAllocator::onlyContainsStructures):
1323 (JSC::MarkedAllocator::MarkedAllocator):
1324 (JSC::MarkedAllocator::init):
1325 * heap/MarkedBlock.cpp: Add tracking for whether or not we're allocating only Structures. We need this to be able to
1326 distinguish the various MarkedBlock types in MarkedSpace::allocatorFor(MarkedBlock*).
1327 (JSC::MarkedBlock::create):
1328 (JSC::MarkedBlock::MarkedBlock):
1329 * heap/MarkedBlock.h:
1331 (JSC::MarkedBlock::onlyContainsStructures):
1333 * heap/MarkedSpace.cpp: Include the new Structure allocator in all the places that all the other allocators are used/modified.
1334 (JSC::MarkedSpace::MarkedSpace):
1335 (JSC::MarkedSpace::resetAllocators):
1336 (JSC::MarkedSpace::canonicalizeCellLivenessData):
1337 (JSC::MarkedSpace::isPagedOut):
1338 * heap/MarkedSpace.h: Add new MarkedAllocator just for Structures.
1340 (JSC::MarkedSpace::allocatorFor):
1341 (JSC::MarkedSpace::allocateStructure):
1343 (JSC::MarkedSpace::forEachBlock):
1344 * runtime/Structure.h: Move all of the functions that call allocateCell<Structure> down below the explicit template specialization
1345 for allocateCell<Structure>. The new inline specialization for allocateCell directly calls the allocateStructure() function in the
1350 (JSC::Structure::create):
1351 (JSC::Structure::createStructure):
1353 2012-07-26 Filip Pizlo <fpizlo@apple.com>
1355 JSArray has methods that are neither used nor defined
1356 https://bugs.webkit.org/show_bug.cgi?id=92416
1358 Reviewed by Simon Fraser.
1360 * runtime/JSArray.h:
1363 2012-07-26 Zoltan Herczeg <zherczeg@webkit.org>
1365 [Qt][ARM]ARMAssembler needs buildfix afert r123417
1366 https://bugs.webkit.org/show_bug.cgi?id=92086
1368 Reviewed by Csaba Osztrogonác.
1370 The ARM implementation of this should be optimized code path
1371 is covered by a non-optimized code path. This patch fixes this,
1372 and adds a new function which returns with the offset range.
1374 * assembler/ARMAssembler.h:
1375 (JSC::ARMAssembler::readPointer):
1377 (JSC::ARMAssembler::repatchInt32):
1378 (JSC::ARMAssembler::repatchCompact):
1379 * assembler/MacroAssemblerARM.h:
1380 (MacroAssemblerARM):
1381 (JSC::MacroAssemblerARM::isCompactPtrAlignedAddressOffset):
1382 (JSC::MacroAssemblerARM::load32WithCompactAddressOffsetPatch):
1384 2012-07-25 Mark Hahnenberg <mhahnenberg@apple.com>
1386 Build fix for 32-bit after r123682
1388 * runtime/JSObject.h: Need to pad out JSObjects on 32-bit so that they're the correct size since
1389 we only removed one 4-byte word and we need to be 8-byte aligned.
1392 2012-07-25 Filip Pizlo <fpizlo@apple.com>
1394 JSC GC object copying APIs should allow for greater flexibility
1395 https://bugs.webkit.org/show_bug.cgi?id=92316
1397 Reviewed by Mark Hahnenberg.
1399 It's now the case that visitChildren() methods can directly pin and allocate in new space during copying.
1400 They can also do the copying and marking themselves. This new API is only used for JSObjects for now.
1402 * JavaScriptCore.xcodeproj/project.pbxproj:
1403 * heap/MarkStack.cpp:
1404 (JSC::SlotVisitor::allocateNewSpaceSlow):
1405 (JSC::SlotVisitor::allocateNewSpaceOrPin):
1407 (JSC::SlotVisitor::copyAndAppend):
1410 (JSC::MarkStack::appendUnbarrieredValue):
1412 * heap/SlotVisitor.h:
1413 * heap/SlotVisitorInlineMethods.h: Added.
1415 (JSC::SlotVisitor::checkIfShouldCopyAndPinOtherwise):
1416 (JSC::SlotVisitor::allocateNewSpace):
1417 * runtime/JSObject.cpp:
1418 (JSC::JSObject::visitOutOfLineStorage):
1420 (JSC::JSObject::visitChildren):
1421 (JSC::JSFinalObject::visitChildren):
1422 * runtime/JSObject.h:
1425 2012-07-25 Mark Hahnenberg <mhahnenberg@apple.com>
1427 Remove JSObject::m_inheritorID
1428 https://bugs.webkit.org/show_bug.cgi?id=88378
1430 Reviewed by Filip Pizlo.
1432 This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
1433 and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
1434 Instead use a private named value in the object's property storage.
1436 * dfg/DFGSpeculativeJIT.h:
1437 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject): No need m_inheritorID to initialize!
1438 * jit/JITInlineMethods.h:
1439 (JSC::JIT::emitAllocateBasicJSObject): No need m_inheritorID to initialize!
1440 * llint/LowLevelInterpreter.asm: No need m_inheritorID to initialize!
1441 * runtime/JSGlobalData.h:
1442 (JSGlobalData): Added private name 'm_inheritorIDKey'.
1443 * runtime/JSGlobalThis.cpp:
1444 (JSC::JSGlobalThis::setUnwrappedObject): resetInheritorID is now passed a JSGlobalData&.
1445 * runtime/JSObject.cpp:
1446 (JSC::JSObject::visitChildren): No m_inheritorID to be marked.
1447 (JSC::JSFinalObject::visitChildren): No m_inheritorID to be marked.
1448 (JSC::JSObject::createInheritorID): Store the newly created inheritorID in the property map. Make sure
1449 it's got the DontEnum attribute!!
1450 * runtime/JSObject.h:
1452 (JSC::JSObject::resetInheritorID): Remove the inheritorID from property storage.
1454 (JSC::JSObject::inheritorID): Read the inheritorID from property storage.
1456 2012-07-25 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
1458 Create a specialized pair for use in HashMap iterators
1459 https://bugs.webkit.org/show_bug.cgi?id=92137
1461 Reviewed by Ryosuke Niwa.
1463 Update a couple of sites that relied on the fact that "contents" of iterators were
1466 * profiler/Profile.cpp:
1467 (JSC): This code kept a vector of the pairs that were the "contents" of the iterators. This
1468 is changed to use a KeyValuePair. We make use HashCount's ValueType (which represents only
1469 the key) to get the proper key parameter for KeyValuePair.
1470 * tools/ProfileTreeNode.h:
1471 (ProfileTreeNode): Use HashMap::ValueType to declare the type of the contents of the hash
1472 instead of declaring it manually. This will make use of the new KeyValuePair.
1474 2012-07-25 Patrick Gansterer <paroga@webkit.org>
1476 REGRESSION(r123505): Date.getYear() returns the same as Date.getFullYear()
1477 https://bugs.webkit.org/show_bug.cgi?id=92218
1479 Reviewed by Csaba Osztrogonác.
1481 * runtime/DatePrototype.cpp:
1482 (JSC::dateProtoFuncGetYear): Added the missing offset of 1900 to the return value.
1484 2012-07-24 Filip Pizlo <fpizlo@apple.com>
1486 REGRESSION(r123417): It made tests assert/crash on 32 bit
1487 https://bugs.webkit.org/show_bug.cgi?id=92088
1489 Reviewed by Mark Hahnenberg.
1491 The pointer arithmetic was wrong, because negative numbers are hard to think about.
1493 * dfg/DFGRepatch.cpp:
1494 (JSC::DFG::emitPutTransitionStub):
1495 * dfg/DFGSpeculativeJIT.cpp:
1496 (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):
1498 2012-07-24 Patrick Gansterer <paroga@webkit.org>
1500 Store the full year in GregorianDateTime
1501 https://bugs.webkit.org/show_bug.cgi?id=92067
1503 Reviewed by Geoffrey Garen.
1505 Use the full year instead of the offset from year 1900
1506 for the year member variable of GregorianDateTime.
1508 * runtime/DateConstructor.cpp:
1509 (JSC::constructDate):
1511 * runtime/DateConversion.cpp:
1513 (JSC::formatDateUTCVariant):
1514 * runtime/DatePrototype.cpp:
1515 (JSC::formatLocaleDate):
1516 (JSC::fillStructuresUsingDateArgs):
1517 (JSC::dateProtoFuncToISOString):
1518 (JSC::dateProtoFuncGetFullYear):
1519 (JSC::dateProtoFuncGetUTCFullYear):
1520 (JSC::dateProtoFuncSetYear):
1521 * runtime/JSDateMath.cpp:
1522 (JSC::gregorianDateTimeToMS):
1523 (JSC::msToGregorianDateTime):
1525 2012-07-24 Patrick Gansterer <paroga@webkit.org>
1527 [WIN] Build fix after r123417.
1529 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
1531 2012-07-23 Patrick Gansterer <paroga@webkit.org>
1533 Move GregorianDateTime from JSC to WTF namespace
1534 https://bugs.webkit.org/show_bug.cgi?id=91948
1536 Reviewed by Geoffrey Garen.
1538 Moving GregorianDateTime into the WTF namespace allows us to us to
1539 use it in WebCore too. The new class has the same behaviour as the
1540 old struct. Only the unused timeZone member has been removed.
1542 * runtime/DateConstructor.cpp:
1543 * runtime/DateConversion.cpp:
1544 * runtime/DateConversion.h:
1545 * runtime/DateInstance.h:
1546 * runtime/DatePrototype.cpp:
1547 * runtime/JSDateMath.cpp:
1548 * runtime/JSDateMath.h:
1550 2012-07-23 Filip Pizlo <fpizlo@apple.com>
1552 Property storage should grow in reverse address direction, to support butterflies
1553 https://bugs.webkit.org/show_bug.cgi?id=91788
1555 Reviewed by Geoffrey Garen.
1557 Changes property storage to grow to the left, and changes the property storage pointer to point
1558 one 8-byte word (i.e. JSValue) to the right of the first value in the storage.
1560 Also improved debug support somewhat, by adding a describe() function to the jsc command-line,
1561 and a slow mode of object access in LLInt.
1563 * assembler/ARMv7Assembler.h:
1564 (JSC::ARMv7Assembler::repatchCompact):
1565 * assembler/MacroAssemblerARMv7.h:
1566 (MacroAssemblerARMv7):
1567 (JSC::MacroAssemblerARMv7::isCompactPtrAlignedAddressOffset):
1568 (JSC::MacroAssemblerARMv7::load32WithCompactAddressOffsetPatch):
1569 * assembler/MacroAssemblerX86Common.h:
1570 (JSC::MacroAssemblerX86Common::isCompactPtrAlignedAddressOffset):
1571 (JSC::MacroAssemblerX86Common::repatchCompact):
1572 * assembler/X86Assembler.h:
1573 (JSC::X86Assembler::repatchCompact):
1574 * bytecode/CodeBlock.cpp:
1575 (JSC::dumpStructure):
1576 * bytecode/GetByIdStatus.h:
1577 (JSC::GetByIdStatus::GetByIdStatus):
1578 * dfg/DFGOperations.cpp:
1579 * dfg/DFGOperations.h:
1580 * dfg/DFGRepatch.cpp:
1581 (JSC::DFG::tryCacheGetByID):
1582 (JSC::DFG::emitPutTransitionStub):
1583 * dfg/DFGSpeculativeJIT.cpp:
1584 (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage):
1585 (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):
1586 * dfg/DFGSpeculativeJIT.h:
1587 (JSC::DFG::SpeculativeJIT::callOperation):
1588 * dfg/DFGSpeculativeJIT32_64.cpp:
1589 (JSC::DFG::SpeculativeJIT::compile):
1590 * dfg/DFGSpeculativeJIT64.cpp:
1591 (JSC::DFG::SpeculativeJIT::compile):
1592 * heap/ConservativeRoots.cpp:
1593 (JSC::ConservativeRoots::genericAddPointer):
1594 * heap/CopiedSpace.h:
1596 * heap/CopiedSpaceInlineMethods.h:
1597 (JSC::CopiedSpace::pinIfNecessary):
1599 * jit/JITPropertyAccess.cpp:
1600 (JSC::JIT::compileGetDirectOffset):
1601 * jit/JITPropertyAccess32_64.cpp:
1602 (JSC::JIT::compileGetDirectOffset):
1604 (JSC::JITThunks::tryCacheGetByID):
1606 (GlobalObject::finishCreation):
1608 * llint/LLIntCommon.h:
1609 * llint/LLIntSlowPaths.cpp:
1610 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
1611 * llint/LowLevelInterpreter32_64.asm:
1612 * llint/LowLevelInterpreter64.asm:
1613 * runtime/JSObject.cpp:
1614 (JSC::JSObject::visitChildren):
1615 (JSC::JSFinalObject::visitChildren):
1616 (JSC::JSObject::growOutOfLineStorage):
1617 * runtime/JSObject.h:
1618 (JSC::JSObject::getDirectLocation):
1619 (JSC::JSObject::offsetForLocation):
1620 * runtime/JSValue.h:
1622 * runtime/PropertyOffset.h:
1623 (JSC::offsetInOutOfLineStorage):
1625 2012-07-23 Filip Pizlo <fpizlo@apple.com>
1627 DFG is too aggressive in performing the specific value optimization on loads
1628 https://bugs.webkit.org/show_bug.cgi?id=92034
1630 Reviewed by Mark Hahnenberg.
1632 This ensures that we don't do optimizations based on a structure having a specific
1633 value, if there is no way to detect that the value is despecified. This is the
1634 case for dictionaries, since despecifying a value in a dictionary does not lead to
1635 a transition and so cannot be caught by either structure checks or structure
1636 transition watchpoints.
1638 * bytecode/GetByIdStatus.cpp:
1639 (JSC::GetByIdStatus::computeFromLLInt):
1640 (JSC::GetByIdStatus::computeForChain):
1641 (JSC::GetByIdStatus::computeFor):
1642 * bytecode/ResolveGlobalStatus.cpp:
1643 (JSC::computeForStructure):
1645 2012-07-23 Filip Pizlo <fpizlo@apple.com>
1647 REGRESSION(r123169): It made fast/js/dfg-inline-arguments-use-from-uninlined-code.html fail on 32 bit platforms
1648 https://bugs.webkit.org/show_bug.cgi?id=92002
1650 Reviewed by Mark Hahnenberg.
1652 In the process of changing the nature of local variable typing, I forgot to modify one of the places where
1653 we glue the DFG's notion of variable prediction to the runtime's notion of variable tagging.
1655 * dfg/DFGSpeculativeJIT.cpp:
1656 (JSC::DFG::SpeculativeJIT::compile):
1658 2012-07-23 Simon Fraser <simon.fraser@apple.com>
1660 Part 2 of: Implement sticky positioning
1661 https://bugs.webkit.org/show_bug.cgi?id=90046
1663 Reviewed by Ojan Vafai.
1665 Turn on ENABLE_CSS_STICKY_POSITION.
1667 * Configurations/FeatureDefines.xcconfig:
1669 2012-07-23 Patrick Gansterer <paroga@webkit.org>
1671 Move JSC::parseDate() from DateConversion to JSDateMath
1672 https://bugs.webkit.org/show_bug.cgi?id=91982
1674 Reviewed by Geoffrey Garen.
1676 Moveing this function into the other files removes the dependency
1677 on JSC spcific classes in DateConversion.{cpp|h}.
1679 * runtime/DateConversion.cpp:
1680 * runtime/DateConversion.h:
1682 * runtime/JSDateMath.cpp:
1685 * runtime/JSDateMath.h:
1688 2012-07-23 Simon Fraser <simon.fraser@apple.com>
1690 Part 1 of: Implement sticky positioning
1691 https://bugs.webkit.org/show_bug.cgi?id=90046
1693 Reviewed by Ojan Vafai.
1695 Add ENABLE_CSS_STICKY_POSITION, defaulting to off initially.
1697 Sort the ENABLE_CSS lines in the file. Make sure all the flags
1698 are in FEATURE_DEFINES.
1700 * Configurations/FeatureDefines.xcconfig:
1702 2012-07-23 Yong Li <yoli@rim.com>
1704 [BlackBerry] Implement GCActivityCallback with platform timer
1705 https://bugs.webkit.org/show_bug.cgi?id=90175
1707 Reviewed by Rob Buis.
1709 Use JSLock when performing GC to avoid assertions.
1711 * runtime/GCActivityCallbackBlackBerry.cpp:
1712 (JSC::DefaultGCActivityCallback::doWork):
1714 2012-07-23 Kent Tamura <tkent@chromium.org>
1716 Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively
1717 https://bugs.webkit.org/show_bug.cgi?id=91941
1719 Reviewed by Kentaro Hara.
1721 A flag name for an elmement should be ENABLE_*_ELEMENT.
1723 * Configurations/FeatureDefines.xcconfig:
1725 2012-07-22 Kent Tamura <tkent@chromium.org>
1727 Rename ENABLE_DETAILS to ENABLE_DETAILS_ELEMENT
1728 https://bugs.webkit.org/show_bug.cgi?id=91928
1730 Reviewed by Kentaro Hara.
1732 A flag name for an elmement should be ENABLE_*_ELEMENT.
1734 * Configurations/FeatureDefines.xcconfig:
1736 2012-07-21 Patrick Gansterer <paroga@webkit.org>
1738 [WIN] Use GetDateFormat and GetTimeFormat instead of strftime
1739 https://bugs.webkit.org/show_bug.cgi?id=83436
1741 Reviewed by Brent Fulgham.
1743 The MS CRT implementation of strftime calls the same two functions.
1744 Using them directly avoids the overhead of parsing the format string and removes
1745 the dependency on strftime() for WinCE where this function does not exist.
1747 * runtime/DatePrototype.cpp:
1748 (JSC::formatLocaleDate):
1750 2012-07-20 Kent Tamura <tkent@chromium.org>
1752 Rename ENABLE_DATALIST to ENABLE_DATALIST_ELEMENT
1753 https://bugs.webkit.org/show_bug.cgi?id=91846
1755 Reviewed by Kentaro Hara.
1757 A flag name for an elmement should be ENABLE_*_ELEMENT.
1759 * Configurations/FeatureDefines.xcconfig:
1761 2012-07-20 Han Shen <shenhan@google.com>
1763 [Chromium] Compilation fails under gcc 4.7
1764 https://bugs.webkit.org/show_bug.cgi?id=90227
1766 Reviewed by Tony Chang.
1768 Disable warnings about c++0x compatibility in gcc newer than 4.6.
1770 * JavaScriptCore.gyp/JavaScriptCore.gyp:
1772 2012-07-18 Filip Pizlo <fpizlo@apple.com>
1774 DFG cell checks should be hoisted
1775 https://bugs.webkit.org/show_bug.cgi?id=91717
1777 Reviewed by Geoffrey Garen.
1779 The DFG has always had the policy of hoisting array and integer checks to
1780 the point of variable assignment. Eventually, we added doubles and booleans
1781 to the mix. But cells should really be part of this as well, particularly
1782 for 32-bit where accessing a known-type variable is dramatically cheaper
1783 than accessing a variable whose types is only predicted but otherwise
1786 This appears to be a definite speed-up for V8 on 32-bit, a possible speed-up
1787 for Kraken, and a possible slow-down for V8 on 64-bit (around 0.2% if at
1788 all). Any slow-downs can, and should, be addressed by making the hoisting
1789 logic cognizant of variables that are never used in a manner that requires
1790 type checks, and by sinking argument checks to the point(s) of first use.
1792 To make this work I had to change some OSR machinery, and special-case the
1793 type predictions of the 'this' argument for constructors. OSR exit normally
1794 assumes that arguments are boxed, which happens to be true because the
1795 type prediction used for check hoisting is LUB'd with the type of the
1796 argument that was passed in - so either the arguments are always stored to
1797 with the full tag+payload, or if only the payload is stored then the tag
1798 matches whatever the caller would have set. But not so with the 'this'
1799 argument for constructors, which is not initialized by the caller. We
1800 could make this more precise by having argument types for OSR be inferred
1801 using similar machinery to other locals, but I figured that for this patch
1802 I should use the surgical fix.
1804 * assembler/MacroAssemblerX86_64.h:
1805 (JSC::MacroAssemblerX86_64::branchTestPtr):
1806 (MacroAssemblerX86_64):
1807 * assembler/X86Assembler.h:
1808 (JSC::X86Assembler::testq_rm):
1810 * dfg/DFGAbstractState.cpp:
1811 (JSC::DFG::AbstractState::initialize):
1812 (JSC::DFG::AbstractState::execute):
1813 * dfg/DFGDriver.cpp:
1814 (JSC::DFG::compile):
1816 (JSC::DFG::Graph::isCreatedThisArgument):
1818 * dfg/DFGSpeculativeJIT.cpp:
1819 (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
1820 * dfg/DFGSpeculativeJIT32_64.cpp:
1821 (JSC::DFG::SpeculativeJIT::compile):
1822 * dfg/DFGSpeculativeJIT64.cpp:
1823 (JSC::DFG::SpeculativeJIT::compile):
1824 * dfg/DFGValueSource.h:
1825 (JSC::DFG::ValueSource::forSpeculation):
1827 2012-07-19 Filip Pizlo <fpizlo@apple.com>
1829 Fast path of storage resize should be removed from property storage reallocation, since it is only useful for arrays
1830 https://bugs.webkit.org/show_bug.cgi?id=91796
1832 Reviewed by Geoffrey Garen.
1834 * dfg/DFGRepatch.cpp:
1835 (JSC::DFG::emitPutTransitionStub):
1836 * dfg/DFGSpeculativeJIT.cpp:
1837 (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):
1838 * runtime/JSObject.cpp:
1839 (JSC::JSObject::growOutOfLineStorage):
1841 2012-07-19 Mark Lam <mark.lam@apple.com>
1843 Bug fixes and enhancements for OfflineASM annotation system.
1844 https://bugs.webkit.org/show_bug.cgi?id=91690
1846 Reviewed by Filip Pizlo.
1848 * offlineasm/armv7.rb: added default handling of Instruction lower().
1849 * offlineasm/asm.rb: added more support for annotations and more pretty printing.
1850 * offlineasm/ast.rb: added more support for annotations.
1851 * offlineasm/config.rb: added $preferredCommentStartColumn, simplified $enableInstrAnnotations.
1852 * offlineasm/parser.rb: added more support for annotations.
1853 * offlineasm/transform.rb: added more support for annotations.
1854 * offlineasm/x86.rb: added default handling of Instruction lower().
1856 2012-07-19 Patrick Gansterer <paroga@webkit.org>
1858 [WIN] Fix compilation of JSGlobalData.h with ENABLE(DFG_JIT)
1859 https://bugs.webkit.org/show_bug.cgi?id=91243
1861 Reviewed by Geoffrey Garen.
1863 Disable MSVC warning 4200 "zero-sized array in struct/union" for JSC::ScratchBuffer.
1865 * runtime/JSGlobalData.h:
1868 2012-07-19 Mark Lam <mark.lam@apple.com>
1870 Fixed broken ENABLE_JIT=0 build.
1871 https://bugs.webkit.org/show_bug.cgi?id=91725
1873 Reviewed by Oliver Hunt.
1875 * bytecode/Watchpoint.cpp:
1876 * heap/JITStubRoutineSet.h:
1878 (JITStubRoutineSet):
1879 (JSC::JITStubRoutineSet::JITStubRoutineSet):
1880 (JSC::JITStubRoutineSet::~JITStubRoutineSet):
1881 (JSC::JITStubRoutineSet::add):
1882 (JSC::JITStubRoutineSet::clearMarks):
1883 (JSC::JITStubRoutineSet::mark):
1884 (JSC::JITStubRoutineSet::deleteUnmarkedJettisonedStubRoutines):
1885 (JSC::JITStubRoutineSet::traceMarkedStubRoutines):
1887 2012-07-19 Kristóf Kosztyó <kkristof@inf.u-szeged.hu>
1889 [Qt] Unreviewed buildfix after r123042.
1891 * interpreter/Interpreter.cpp:
1892 (JSC::Interpreter::dumpRegisters):
1894 2012-07-18 Filip Pizlo <fpizlo@apple.com>
1896 DFG should emit inline code for property storage (re)allocation
1897 https://bugs.webkit.org/show_bug.cgi?id=91597
1899 Reviewed by Oliver Hunt.
1901 This adds two new ops to the DFG IR: AllocatePropertyStorage and
1902 ReallocatePropertyStorage. It enables these to interact properly with
1903 CSE so that a GetPropertyStorage on something for which we have
1904 obviously done a (Re)AllocatePropertyStorage will result in the
1905 GetPropertyStorage being eliminated. Other than that, the code
1906 emitted for these ops is identical to the code we were emitting in
1907 the corresponding PutById stub.
1909 * dfg/DFGAbstractState.cpp:
1910 (JSC::DFG::AbstractState::execute):
1911 * dfg/DFGByteCodeParser.cpp:
1912 (JSC::DFG::ByteCodeParser::parseBlock):
1913 * dfg/DFGCSEPhase.cpp:
1914 (JSC::DFG::CSEPhase::putStructureStoreElimination):
1915 (JSC::DFG::CSEPhase::getPropertyStorageLoadElimination):
1917 (JSC::DFG::Node::hasStructureTransitionData):
1918 * dfg/DFGNodeType.h:
1920 * dfg/DFGOperations.cpp:
1921 * dfg/DFGOperations.h:
1922 * dfg/DFGPredictionPropagationPhase.cpp:
1923 (JSC::DFG::PredictionPropagationPhase::propagate):
1924 * dfg/DFGSpeculativeJIT.cpp:
1925 (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage):
1927 (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):
1928 * dfg/DFGSpeculativeJIT.h:
1929 (JSC::DFG::SpeculativeJIT::callOperation):
1931 * dfg/DFGSpeculativeJIT32_64.cpp:
1932 (JSC::DFG::SpeculativeJIT::compile):
1933 * dfg/DFGSpeculativeJIT64.cpp:
1934 (JSC::DFG::SpeculativeJIT::compile):
1935 * runtime/Structure.cpp:
1936 (JSC::nextOutOfLineStorageCapacity):
1937 * runtime/Structure.h:
1940 2012-07-16 Oliver Hunt <oliver@apple.com>
1942 dumpCallFrame is broken in ToT
1943 https://bugs.webkit.org/show_bug.cgi?id=91444
1945 Reviewed by Gavin Barraclough.
1947 Various changes have been made to the SF calling convention, but
1948 dumpCallFrame has not been updated to reflect these changes.
1949 That resulted in both bogus information, as well as numerous
1950 assertions of sadness.
1952 This patch makes dumpCallFrame actually work again and adds the
1953 wonderful feature of telling you the name of the variable that a
1954 register reflects, or what value it contains.
1956 * bytecode/CodeBlock.cpp:
1957 (JSC::CodeBlock::nameForRegister):
1958 A really innefficient mechanism for finding the name of a local register.
1959 This should only ever be used by debug code so this should be okay.
1960 * bytecode/CodeBlock.h:
1962 * bytecompiler/BytecodeGenerator.cpp:
1963 (JSC::BytecodeGenerator::generate):
1964 Debug builds no longer throw away a functions symbol table, this allows
1965 us to actually perform a register# to name mapping
1966 * dfg/DFGJITCompiler.cpp:
1967 (JSC::DFG::JITCompiler::link):
1968 We weren't propogating the bytecode offset here leading to assertions
1969 in debug builds when dumping bytecode of DFG compiled code.
1970 * interpreter/Interpreter.cpp:
1972 (JSC::Interpreter::dumpRegisters):
1973 Rework to actually be correct.
1974 (JSC::getCallerInfo):
1975 Return the byteocde offset as well now, given we have to determine it
1977 (JSC::Interpreter::getStackTrace):
1978 (JSC::Interpreter::retrieveCallerFromVMCode):
1979 * interpreter/Interpreter.h:
1982 (GlobalObject::finishCreation):
1983 (functionDumpCallFrame):
1984 Give debug builds of JSC a method for calling dumpCallFrame so we can
1985 inspect a callframe without requiring us to break in a debugger.
1987 2012-07-18 Filip Pizlo <fpizlo@apple.com>
1989 DFG 32-bit PutById transition stub storage reallocation case copies the first pointer of each JSValue instead of the whole JSValue
1990 https://bugs.webkit.org/show_bug.cgi?id=91599
1992 Reviewed by Geoffrey Garen.
1994 * dfg/DFGRepatch.cpp:
1995 (JSC::DFG::emitPutTransitionStub):
1997 2012-07-17 Filip Pizlo <fpizlo@apple.com>
1999 DFG 32-bit PutById transition stub passes the payload/tag arguments to a DFG operation in the wrong order
2000 https://bugs.webkit.org/show_bug.cgi?id=91576
2002 Reviewed by Gavin Barraclough.
2004 * dfg/DFGRepatch.cpp:
2005 (JSC::DFG::emitPutTransitionStub):
2007 2012-07-17 Filip Pizlo <fpizlo@apple.com>
2009 [Qt] REGRESSION(r122768, r122771): They broke jquery/data.html and inspector/elements/edit-dom-actions.html
2010 https://bugs.webkit.org/show_bug.cgi?id=91476
2012 Reviewed by Mark Hahnenberg.
2014 The 32-bit repatching code was not correctly adapted to the new world where there may not always
2015 be an available scratch register. Fixed it by ensuring that the scratch register we select does
2016 not overlap with the value tag.
2018 * dfg/DFGRepatch.cpp:
2019 (JSC::DFG::generateProtoChainAccessStub):
2020 (JSC::DFG::tryCacheGetByID):
2021 (JSC::DFG::tryBuildGetByIDList):
2022 (JSC::DFG::emitPutReplaceStub):
2024 2012-07-17 Gabor Rapcsanyi <rgabor@webkit.org>
2026 Unreviewed buildfix from Zoltan Herczeg after 122768.
2028 * dfg/DFGCCallHelpers.h:
2029 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
2032 2012-07-17 David Barr <davidbarr@chromium.org>
2034 Introduce ENABLE_CSS_IMAGE_ORIENTATION compile flag
2035 https://bugs.webkit.org/show_bug.cgi?id=89055
2037 Reviewed by Kent Tamura.
2039 The css3-images module is at candidate recommendation.
2040 http://www.w3.org/TR/2012/CR-css3-images-20120417/#the-image-orientation
2042 Add a configuration option for CSS image-orientation support, disabling it by default.
2044 * Configurations/FeatureDefines.xcconfig:
2046 2012-07-16 Filip Pizlo <fpizlo@apple.com>
2048 Unreviewed, roll out 122790 because it broke the Windows build. I'm not
2049 sure what to do with exported symbols that are predicated on NDEBUG.
2051 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
2052 * bytecode/CodeBlock.cpp:
2054 * bytecode/CodeBlock.h:
2056 * bytecompiler/BytecodeGenerator.cpp:
2057 (JSC::BytecodeGenerator::generate):
2058 * dfg/DFGJITCompiler.cpp:
2059 (JSC::DFG::JITCompiler::link):
2060 * interpreter/Interpreter.cpp:
2062 (JSC::Interpreter::dumpRegisters):
2063 (JSC::getCallerInfo):
2064 (JSC::Interpreter::getStackTrace):
2065 (JSC::Interpreter::retrieveCallerFromVMCode):
2066 * interpreter/Interpreter.h:
2069 (GlobalObject::finishCreation):
2071 2012-07-16 Oliver Hunt <oliver@apple.com>
2073 dumpCallFrame is broken in ToT
2074 https://bugs.webkit.org/show_bug.cgi?id=91444
2076 Reviewed by Gavin Barraclough.
2078 Various changes have been made to the SF calling convention, but
2079 dumpCallFrame has not been updated to reflect these changes.
2080 That resulted in both bogus information, as well as numerous
2081 assertions of sadness.
2083 This patch makes dumpCallFrame actually work again and adds the
2084 wonderful feature of telling you the name of the variable that a
2085 register reflects, or what value it contains.
2087 * bytecode/CodeBlock.cpp:
2088 (JSC::CodeBlock::nameForRegister):
2089 A really innefficient mechanism for finding the name of a local register.
2090 This should only ever be used by debug code so this should be okay.
2091 * bytecode/CodeBlock.h:
2093 * bytecompiler/BytecodeGenerator.cpp:
2094 (JSC::BytecodeGenerator::generate):
2095 Debug builds no longer throw away a functions symbol table, this allows
2096 us to actually perform a register# to name mapping
2097 * dfg/DFGJITCompiler.cpp:
2098 (JSC::DFG::JITCompiler::link):
2099 We weren't propogating the bytecode offset here leading to assertions
2100 in debug builds when dumping bytecode of DFG compiled code.
2101 * interpreter/Interpreter.cpp:
2103 (JSC::Interpreter::dumpRegisters):
2104 Rework to actually be correct.
2105 (JSC::getCallerInfo):
2106 Return the byteocde offset as well now, given we have to determine it
2108 (JSC::Interpreter::getStackTrace):
2109 (JSC::Interpreter::retrieveCallerFromVMCode):
2110 * interpreter/Interpreter.h:
2113 (GlobalObject::finishCreation):
2114 (functionDumpCallFrame):
2115 Give debug builds of JSC a method for calling dumpCallFrame so we can
2116 inspect a callframe without requiring us to break in a debugger.
2118 2012-07-16 Filip Pizlo <fpizlo@apple.com>
2120 Unreviewed, adding forgotten files.
2122 * dfg/DFGRegisterSet.h: Added.
2125 (JSC::DFG::RegisterSet::RegisterSet):
2126 (JSC::DFG::RegisterSet::asPOD):
2127 (JSC::DFG::RegisterSet::copyInfo):
2128 (JSC::DFG::RegisterSet::set):
2129 (JSC::DFG::RegisterSet::setGPRByIndex):
2130 (JSC::DFG::RegisterSet::clear):
2131 (JSC::DFG::RegisterSet::get):
2132 (JSC::DFG::RegisterSet::getGPRByIndex):
2133 (JSC::DFG::RegisterSet::getFreeGPR):
2134 (JSC::DFG::RegisterSet::setFPRByIndex):
2135 (JSC::DFG::RegisterSet::getFPRByIndex):
2136 (JSC::DFG::RegisterSet::setByIndex):
2137 (JSC::DFG::RegisterSet::getByIndex):
2138 (JSC::DFG::RegisterSet::numberOfSetGPRs):
2139 (JSC::DFG::RegisterSet::numberOfSetFPRs):
2140 (JSC::DFG::RegisterSet::numberOfSetRegisters):
2141 (JSC::DFG::RegisterSet::setBit):
2142 (JSC::DFG::RegisterSet::clearBit):
2143 (JSC::DFG::RegisterSet::getBit):
2144 * dfg/DFGScratchRegisterAllocator.h: Added.
2146 (ScratchRegisterAllocator):
2147 (JSC::DFG::ScratchRegisterAllocator::ScratchRegisterAllocator):
2148 (JSC::DFG::ScratchRegisterAllocator::lock):
2149 (JSC::DFG::ScratchRegisterAllocator::allocateScratch):
2150 (JSC::DFG::ScratchRegisterAllocator::allocateScratchGPR):
2151 (JSC::DFG::ScratchRegisterAllocator::allocateScratchFPR):
2152 (JSC::DFG::ScratchRegisterAllocator::didReuseRegisters):
2153 (JSC::DFG::ScratchRegisterAllocator::preserveReusedRegistersByPushing):
2154 (JSC::DFG::ScratchRegisterAllocator::restoreReusedRegistersByPopping):
2155 (JSC::DFG::ScratchRegisterAllocator::desiredScratchBufferSize):
2156 (JSC::DFG::ScratchRegisterAllocator::preserveUsedRegistersToScratchBuffer):
2157 (JSC::DFG::ScratchRegisterAllocator::restoreUsedRegistersFromScratchBuffer):
2159 2012-07-15 Filip Pizlo <fpizlo@apple.com>
2161 DFG PutById transition should handle storage allocation, and inline it
2162 https://bugs.webkit.org/show_bug.cgi?id=91337
2164 Reviewed by Oliver Hunt.
2166 This enables the patching of DFG PutById to handle the out-of-line storage
2167 allocation case. Furthermore, it inlines out-of-line storage allocation (and
2168 reallocation) into the generated stubs.
2170 To do this, this patch adds the ability to store the relevant register
2171 allocation state (i.e. the set of in-use registers) in the structure stub
2172 info so that the stub generation code can more flexibly select scratch
2173 registers: sometimes it needs none, sometimes one - or sometimes up to
2174 three. Moreover, to make the stub generation register allocation simple and
2175 maintainable, this patch introduces a reusable scratch register allocator
2176 class. This register allocator understands that some registers are in use by
2177 the main path code and so must be spilled as necessary, other registers are
2178 locked for use in the stub itself and so cannot even be spilled, while still
2179 others may be allocated for scratch purposes. A scratch register that is
2180 used must be spilled. If a register is locked, it cannot be used as a
2181 scratch register. If a register is used, it can be used as a scratch
2182 register so long as it is spilled.
2184 This is a sub-1% speed-up on V8 and neutral elsewhere.
2186 * GNUmakefile.list.am:
2187 * JavaScriptCore.xcodeproj/project.pbxproj:
2188 * assembler/MacroAssemblerCodeRef.h:
2190 (JSC::FunctionPtr::FunctionPtr):
2191 * bytecode/StructureStubInfo.h:
2192 * dfg/DFGCCallHelpers.h:
2193 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
2196 * dfg/DFGJITCompiler.cpp:
2197 (JSC::DFG::JITCompiler::link):
2198 * dfg/DFGJITCompiler.h:
2199 (JSC::DFG::PropertyAccessRecord::PropertyAccessRecord):
2200 (PropertyAccessRecord):
2201 * dfg/DFGOperations.cpp:
2202 * dfg/DFGOperations.h:
2203 * dfg/DFGRegisterBank.h:
2204 (JSC::DFG::RegisterBank::isInUse):
2206 * dfg/DFGRegisterSet.h: Added.
2209 (JSC::DFG::RegisterSet::RegisterSet):
2210 (JSC::DFG::RegisterSet::asPOD):
2211 (JSC::DFG::RegisterSet::copyInfo):
2212 (JSC::DFG::RegisterSet::set):
2213 (JSC::DFG::RegisterSet::setGPRByIndex):
2214 (JSC::DFG::RegisterSet::clear):
2215 (JSC::DFG::RegisterSet::get):
2216 (JSC::DFG::RegisterSet::getGPRByIndex):
2217 (JSC::DFG::RegisterSet::getFreeGPR):
2218 (JSC::DFG::RegisterSet::setFPRByIndex):
2219 (JSC::DFG::RegisterSet::getFPRByIndex):
2220 (JSC::DFG::RegisterSet::setByIndex):
2221 (JSC::DFG::RegisterSet::getByIndex):
2222 (JSC::DFG::RegisterSet::numberOfSetGPRs):
2223 (JSC::DFG::RegisterSet::numberOfSetFPRs):
2224 (JSC::DFG::RegisterSet::numberOfSetRegisters):
2225 (JSC::DFG::RegisterSet::setBit):
2226 (JSC::DFG::RegisterSet::clearBit):
2227 (JSC::DFG::RegisterSet::getBit):
2228 * dfg/DFGRepatch.cpp:
2229 (JSC::DFG::generateProtoChainAccessStub):
2230 (JSC::DFG::tryCacheGetByID):
2231 (JSC::DFG::tryBuildGetByIDList):
2232 (JSC::DFG::emitPutReplaceStub):
2233 (JSC::DFG::emitPutTransitionStub):
2234 (JSC::DFG::tryCachePutByID):
2235 (JSC::DFG::tryBuildPutByIdList):
2236 * dfg/DFGScratchRegisterAllocator.h: Added.
2238 (ScratchRegisterAllocator):
2239 (JSC::DFG::ScratchRegisterAllocator::ScratchRegisterAllocator):
2240 (JSC::DFG::ScratchRegisterAllocator::lock):
2241 (JSC::DFG::ScratchRegisterAllocator::allocateScratch):
2242 (JSC::DFG::ScratchRegisterAllocator::allocateScratchGPR):
2243 (JSC::DFG::ScratchRegisterAllocator::allocateScratchFPR):
2244 (JSC::DFG::ScratchRegisterAllocator::didReuseRegisters):
2245 (JSC::DFG::ScratchRegisterAllocator::preserveReusedRegistersByPushing):
2246 (JSC::DFG::ScratchRegisterAllocator::restoreReusedRegistersByPopping):
2247 (JSC::DFG::ScratchRegisterAllocator::desiredScratchBufferSize):
2248 (JSC::DFG::ScratchRegisterAllocator::preserveUsedRegistersToScratchBuffer):
2249 (JSC::DFG::ScratchRegisterAllocator::restoreUsedRegistersFromScratchBuffer):
2250 * dfg/DFGSpeculativeJIT.h:
2252 (JSC::DFG::SpeculativeJIT::usedRegisters):
2253 * dfg/DFGSpeculativeJIT32_64.cpp:
2254 (JSC::DFG::SpeculativeJIT::cachedGetById):
2255 (JSC::DFG::SpeculativeJIT::cachedPutById):
2256 (JSC::DFG::SpeculativeJIT::compile):
2257 * dfg/DFGSpeculativeJIT64.cpp:
2258 (JSC::DFG::SpeculativeJIT::cachedGetById):
2259 (JSC::DFG::SpeculativeJIT::cachedPutById):
2260 (JSC::DFG::SpeculativeJIT::compile):
2261 * heap/CopiedAllocator.h:
2263 (JSC::CopiedAllocator::fastPathShouldSucceed):
2266 2012-07-16 Patrick Gansterer <paroga@webkit.org>
2268 Add dfg switch to create_jit_stubs script
2269 https://bugs.webkit.org/show_bug.cgi?id=91256
2271 Reviewed by Geoffrey Garen.
2273 * create_jit_stubs: Add a switch to enable or disable the generation of
2274 stub functions in #if ENABLE(DFG_JIT) conditions.
2276 2012-07-16 Gabor Rapcsanyi <rgabor@webkit.org>
2278 Unreviewed buildfix after r122729. Typo fix.
2280 * assembler/MacroAssemblerARM.h:
2281 (JSC::MacroAssemblerARM::add32):
2283 2012-07-16 Gabor Rapcsanyi <rgabor@webkit.org>
2285 Unreviewed buildfix from Zoltan Herczeg after r122677.
2286 Implement missing add32 function to MacroAssemblerARM.
2288 * assembler/MacroAssemblerARM.h:
2289 (JSC::MacroAssemblerARM::add32):
2290 (MacroAssemblerARM):
2292 2012-07-14 Filip Pizlo <fpizlo@apple.com>
2294 DFG PutByVal opcodes should accept more than 3 operands
2295 https://bugs.webkit.org/show_bug.cgi?id=91332
2297 Reviewed by Oliver Hunt.
2299 Turned PutByVal/PutByValAlias into var-arg nodes, so that we can give them
2300 4 or more operands in the future.
2302 * dfg/DFGAbstractState.cpp:
2303 (JSC::DFG::AbstractState::execute):
2304 * dfg/DFGByteCodeParser.cpp:
2305 (JSC::DFG::ByteCodeParser::parseBlock):
2306 * dfg/DFGCSEPhase.cpp:
2307 (JSC::DFG::CSEPhase::getByValLoadElimination):
2308 (JSC::DFG::CSEPhase::getIndexedPropertyStorageLoadElimination):
2309 (JSC::DFG::CSEPhase::performNodeCSE):
2310 * dfg/DFGFixupPhase.cpp:
2311 (JSC::DFG::FixupPhase::fixupNode):
2312 (JSC::DFG::FixupPhase::fixDoubleEdge):
2314 (JSC::DFG::Graph::byValIsPure):
2315 (JSC::DFG::Graph::varArgNumChildren):
2317 (JSC::DFG::Graph::numChildren):
2318 (JSC::DFG::Graph::varArgChild):
2319 (JSC::DFG::Graph::child):
2320 * dfg/DFGNodeType.h:
2322 * dfg/DFGPredictionPropagationPhase.cpp:
2323 (JSC::DFG::PredictionPropagationPhase::propagate):
2324 * dfg/DFGSpeculativeJIT.cpp:
2325 (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
2326 (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
2327 * dfg/DFGSpeculativeJIT32_64.cpp:
2328 (JSC::DFG::SpeculativeJIT::compile):
2329 * dfg/DFGSpeculativeJIT64.cpp:
2330 (JSC::DFG::SpeculativeJIT::compile):
2332 2012-07-14 Filip Pizlo <fpizlo@apple.com>
2334 Rationalize and optimize storage allocation
2335 https://bugs.webkit.org/show_bug.cgi?id=91303
2337 Reviewed by Oliver Hunt.
2339 This implements a backwards bump allocator for copied space storage
2340 allocation, shown in pseudo-code below:
2342 pointer bump(size) {
2343 pointer tmp = allocator->remaining;
2347 allocator->remaining = tmp;
2348 return allocator->payloadEnd - tmp - size;
2351 The advantage of this allocator is that it:
2353 - Only requires one comparison in the common case where size is known to
2354 not be huge, and this comparison can be done by checking the sign bit
2357 - Can be implemented even when only one register is available. This
2358 register is reused for both temporary storage during allocation and
2361 - Preserves the behavior that memory in a block is filled in from lowest
2362 address to highest address, which allows for a cheap reallocation fast
2365 - Is resilient against the block used for allocation being the last one
2366 in virtual memory, thereby otherwise leading to the risk of overflow
2367 in the bump pointer, despite only doing one branch.
2369 In order to implement this allocator using the smallest possible chunk
2370 of code, I refactored the copied space code so that all of the allocation
2371 logic is in CopiedAllocator, and all of the state is in either
2372 CopiedBlock or CopiedAllocator. This should make changing the allocation
2373 fast path easier in the future.
2375 In order to do this, I needed to add some new assembler support,
2376 particularly for various forms of add(address, register) and negPtr().
2378 This is performance neutral. The purpose of this change is to facilitate
2379 further inlining of storage allocation without having to reserve
2380 additional registers or emit too much code.
2382 * assembler/MacroAssembler.h:
2383 (JSC::MacroAssembler::addPtr):
2385 (JSC::MacroAssembler::negPtr):
2386 * assembler/MacroAssemblerARMv7.h:
2387 (MacroAssemblerARMv7):
2388 (JSC::MacroAssemblerARMv7::add32):
2389 * assembler/MacroAssemblerX86.h:
2390 (JSC::MacroAssemblerX86::add32):
2391 (MacroAssemblerX86):
2392 * assembler/MacroAssemblerX86_64.h:
2393 (MacroAssemblerX86_64):
2394 (JSC::MacroAssemblerX86_64::addPtr):
2395 (JSC::MacroAssemblerX86_64::negPtr):
2396 * assembler/X86Assembler.h:
2398 (JSC::X86Assembler::addl_mr):
2399 (JSC::X86Assembler::addq_mr):
2400 (JSC::X86Assembler::negq_r):
2401 * heap/CopiedAllocator.h:
2403 (JSC::CopiedAllocator::isValid):
2404 (JSC::CopiedAllocator::CopiedAllocator):
2405 (JSC::CopiedAllocator::tryAllocate):
2407 (JSC::CopiedAllocator::tryReallocate):
2408 (JSC::CopiedAllocator::forceAllocate):
2409 (JSC::CopiedAllocator::resetCurrentBlock):
2410 (JSC::CopiedAllocator::setCurrentBlock):
2411 (JSC::CopiedAllocator::currentCapacity):
2412 * heap/CopiedBlock.h:
2414 (JSC::CopiedBlock::create):
2415 (JSC::CopiedBlock::zeroFillWilderness):
2416 (JSC::CopiedBlock::CopiedBlock):
2417 (JSC::CopiedBlock::payloadEnd):
2419 (JSC::CopiedBlock::payloadCapacity):
2420 (JSC::CopiedBlock::data):
2421 (JSC::CopiedBlock::dataEnd):
2422 (JSC::CopiedBlock::dataSize):
2423 (JSC::CopiedBlock::wilderness):
2424 (JSC::CopiedBlock::wildernessEnd):
2425 (JSC::CopiedBlock::wildernessSize):
2426 (JSC::CopiedBlock::size):
2427 * heap/CopiedSpace.cpp:
2428 (JSC::CopiedSpace::tryAllocateSlowCase):
2429 (JSC::CopiedSpace::tryAllocateOversize):
2430 (JSC::CopiedSpace::tryReallocate):
2431 (JSC::CopiedSpace::doneFillingBlock):
2432 (JSC::CopiedSpace::doneCopying):
2433 * heap/CopiedSpace.h:
2435 * heap/CopiedSpaceInlineMethods.h:
2436 (JSC::CopiedSpace::startedCopying):
2437 (JSC::CopiedSpace::allocateBlockForCopyingPhase):
2438 (JSC::CopiedSpace::allocateBlock):
2439 (JSC::CopiedSpace::tryAllocate):
2441 * heap/MarkStack.cpp:
2442 (JSC::SlotVisitor::startCopying):
2443 (JSC::SlotVisitor::allocateNewSpace):
2444 (JSC::SlotVisitor::doneCopying):
2445 * heap/SlotVisitor.h:
2446 (JSC::SlotVisitor::SlotVisitor):
2448 * jit/JITInlineMethods.h:
2449 (JSC::JIT::emitAllocateBasicStorage):
2450 (JSC::JIT::emitAllocateJSArray):
2452 2012-07-13 Mark Lam <mark.lam@apple.com>
2454 OfflineASM Pretty printing and commenting enhancements.
2455 https://bugs.webkit.org/show_bug.cgi?id=91281
2457 Reviewed by Filip Pizlo.
2459 Added some minor pretty printing in the OfflineASM.
2460 Also added infrastruture for adding multiple types of comments and
2461 annotations with the ability to enable/disable them in the generated
2464 * GNUmakefile.list.am: add new file config.rb.
2465 * llint/LLIntOfflineAsmConfig.h:
2466 Added OFFLINE_ASM_BEGIN, OFFLINE_ASM_END, and OFFLINE_ASM_LOCAL_LABEL macros.
2467 This will allow us to redefine these for other backends later.
2468 * llint/LowLevelInterpreter32_64.asm:
2469 Add a small example of instruction annotations for now.
2470 * llint/LowLevelInterpreter64.asm:
2471 Add a small example of instruction annotations for now.
2472 * offlineasm/armv7.rb: Added handling of annotations.
2473 * offlineasm/asm.rb:
2474 Added machinery to dump the new comments and annotations.
2475 Also added some indentations to make the output a little prettier.
2476 * offlineasm/ast.rb: Added annotation field in class Instruction.
2477 * offlineasm/backends.rb:
2478 * offlineasm/config.rb: Added.
2479 Currently only contains commenting options. This file is meant to be
2480 a centralized place for build config values much like config.h for
2482 * offlineasm/generate_offset_extractor.rb:
2483 * offlineasm/instructions.rb:
2484 * offlineasm/offsets.rb:
2485 * offlineasm/opt.rb:
2486 * offlineasm/parser.rb: Parse and record annotations.
2487 * offlineasm/registers.rb:
2488 * offlineasm/self_hash.rb:
2489 * offlineasm/settings.rb:
2490 * offlineasm/transform.rb:
2491 * offlineasm/x86.rb: Added handling of annotations.
2493 2012-07-13 Filip Pizlo <fpizlo@apple.com>
2495 ASSERTION FAILED: use.useKind() != DoubleUse
2496 https://bugs.webkit.org/show_bug.cgi?id=91082
2498 Reviewed by Geoffrey Garen.
2500 The implementation of Branch() was unwisely relying on register allocation state
2501 to decide what speculations to perform. That's never correct.
2503 * dfg/DFGSpeculativeJIT32_64.cpp:
2504 (JSC::DFG::SpeculativeJIT::compile):
2505 * dfg/DFGSpeculativeJIT64.cpp:
2506 (JSC::DFG::SpeculativeJIT::compile):
2508 2012-07-13 Sheriff Bot <webkit.review.bot@gmail.com>
2510 Unreviewed, rolling out r122640.
2511 http://trac.webkit.org/changeset/122640
2512 https://bugs.webkit.org/show_bug.cgi?id=91298
2514 LLInt apparently does not expect to mark these (Requested by
2517 * bytecode/CodeBlock.cpp:
2518 (JSC::CodeBlock::visitStructures):
2519 (JSC::CodeBlock::stronglyVisitStrongReferences):
2521 2012-07-13 Oliver Hunt <oliver@apple.com>
2523 LLInt fails to mark structures stored in the bytecode
2524 https://bugs.webkit.org/show_bug.cgi?id=91296
2526 Reviewed by Geoffrey Garen.
2528 LLInt stores structures in the bytecode, so we need to visit the appropriate
2529 instructions as we would if we were running in the classic interpreter.
2530 This requires adding additional checks for the LLInt specific opcodes, and
2531 the lint specific variants of operand ordering.
2533 * bytecode/CodeBlock.cpp:
2534 (JSC::CodeBlock::visitStructures):
2535 (JSC::CodeBlock::stronglyVisitStrongReferences):
2537 2012-07-13 Yong Li <yoli@rim.com>
2539 [BlackBerry] Implement GCActivityCallback with platform timer
2540 https://bugs.webkit.org/show_bug.cgi?id=90175
2542 Reviewed by Rob Buis.
2544 Implement GCActivityCallback and HeapTimer for BlackBerry port.
2546 * heap/HeapTimer.cpp:
2548 (JSC::HeapTimer::HeapTimer):
2549 (JSC::HeapTimer::~HeapTimer):
2550 (JSC::HeapTimer::timerDidFire):
2551 (JSC::HeapTimer::synchronize):
2552 (JSC::HeapTimer::invalidate):
2553 (JSC::HeapTimer::didStartVMShutdown):
2556 * runtime/GCActivityCallbackBlackBerry.cpp:
2558 (JSC::DefaultGCActivityCallback::doWork):
2559 (JSC::DefaultGCActivityCallback::didAllocate):
2560 (JSC::DefaultGCActivityCallback::willCollect):
2561 (JSC::DefaultGCActivityCallback::cancel):
2563 2012-07-13 Patrick Gansterer <paroga@webkit.org>
2565 [WIN] Fix compilation of DFGRepatch.cpp
2566 https://bugs.webkit.org/show_bug.cgi?id=91241
2568 Reviewed by Geoffrey Garen.
2570 Use intptr_t instead of uintptr_t when calling CodeLocationCommon::dataLabelPtrAtOffset(int)
2571 to fix MSVC "unary minus operator applied to unsigned type, result still unsigned" warning.
2573 * dfg/DFGRepatch.cpp:
2574 (JSC::DFG::dfgResetGetByID):
2575 (JSC::DFG::dfgResetPutByID):
2577 2012-07-13 Patrick Gansterer <paroga@webkit.org>
2579 Fix ARM_TRADITIONAL JIT for COMPILER(MSVC) and COMPILER(RVCT) after r121885
2580 https://bugs.webkit.org/show_bug.cgi?id=91238
2582 Reviewed by Zoltan Herczeg.
2584 r121885 changed the assembler instruction only for COMPILER(GCC).
2585 Use the same instructions for the other compilers too.
2588 (JSC::ctiTrampoline):
2589 (JSC::ctiTrampolineEnd):
2590 (JSC::ctiVMThrowTrampoline):
2592 2012-07-12 Filip Pizlo <fpizlo@apple.com>
2594 DFG property access stubs should use structure transition watchpoints
2595 https://bugs.webkit.org/show_bug.cgi?id=91135
2597 Reviewed by Geoffrey Garen.
2599 This adds a Watchpoint subclass that will clear a structure stub (i.e.
2600 a property access stub) when fired. The DFG stub generation code now
2601 uses this optimization.
2604 * GNUmakefile.list.am:
2605 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2606 * JavaScriptCore.xcodeproj/project.pbxproj:
2608 * bytecode/CodeBlock.cpp:
2610 (JSC::CodeBlock::finalizeUnconditionally):
2611 (JSC::CodeBlock::resetStub):
2612 (JSC::CodeBlock::resetStubInternal):
2613 * bytecode/CodeBlock.h:
2616 * bytecode/StructureStubClearingWatchpoint.cpp: Added.
2618 (JSC::StructureStubClearingWatchpoint::~StructureStubClearingWatchpoint):
2619 (JSC::StructureStubClearingWatchpoint::push):
2620 (JSC::StructureStubClearingWatchpoint::fireInternal):
2621 (JSC::WatchpointsOnStructureStubInfo::~WatchpointsOnStructureStubInfo):
2622 (JSC::WatchpointsOnStructureStubInfo::addWatchpoint):
2623 (JSC::WatchpointsOnStructureStubInfo::ensureReferenceAndAddWatchpoint):
2624 * bytecode/StructureStubClearingWatchpoint.h: Added.
2626 (StructureStubClearingWatchpoint):
2627 (JSC::StructureStubClearingWatchpoint::StructureStubClearingWatchpoint):
2628 (WatchpointsOnStructureStubInfo):
2629 (JSC::WatchpointsOnStructureStubInfo::WatchpointsOnStructureStubInfo):
2630 (JSC::WatchpointsOnStructureStubInfo::codeBlock):
2631 (JSC::WatchpointsOnStructureStubInfo::stubInfo):
2632 * bytecode/StructureStubInfo.h:
2633 (JSC::StructureStubInfo::reset):
2634 (JSC::StructureStubInfo::addWatchpoint):
2635 (StructureStubInfo):
2636 * dfg/DFGRepatch.cpp:
2637 (JSC::DFG::addStructureTransitionCheck):
2639 (JSC::DFG::generateProtoChainAccessStub):
2640 (JSC::DFG::emitPutTransitionStub):
2641 * jit/JumpReplacementWatchpoint.h:
2643 2012-07-12 Filip Pizlo <fpizlo@apple.com>
2645 DFG CFA may get overzealous in loops that have code that must exit
2646 https://bugs.webkit.org/show_bug.cgi?id=91188
2648 Reviewed by Gavin Barraclough.
2650 Ensure that if the CFA assumes that an operation must exit, then it will always exit
2651 no matter what happens after. That's necessary to preserve soundness.
2653 Remove a broken fixup done by the DFG simplifier, where it was trying to say that the
2654 variable-at-head was the first access in the second block in the merge, if the first
2655 block did not read the variable. That's totally wrong, if the first block was in fact
2656 doing a phantom read. I removed that fixup and instead hardened the rest of the
2659 * dfg/DFGAbstractState.cpp:
2660 (JSC::DFG::AbstractState::endBasicBlock):
2661 * dfg/DFGBasicBlock.h:
2662 (JSC::DFG::BasicBlock::BasicBlock):
2664 * dfg/DFGCFAPhase.cpp:
2665 (JSC::DFG::CFAPhase::performBlockCFA):
2666 * dfg/DFGCFGSimplificationPhase.cpp:
2667 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
2668 * dfg/DFGConstantFoldingPhase.cpp:
2669 (JSC::DFG::ConstantFoldingPhase::ConstantFoldingPhase):
2670 (JSC::DFG::ConstantFoldingPhase::run):
2671 (ConstantFoldingPhase):
2672 (JSC::DFG::ConstantFoldingPhase::foldConstants):
2673 (JSC::DFG::ConstantFoldingPhase::paintUnreachableCode):
2674 * dfg/DFGVariableEventStream.cpp:
2675 (JSC::DFG::VariableEventStream::reconstruct):
2677 2012-07-12 Allan Sandfeld Jensen <allan.jensen@nokia.com>
2679 [Qt] Implement MemoryUsageSupport
2680 https://bugs.webkit.org/show_bug.cgi?id=91094
2682 Reviewed by Adam Barth.
2684 Compile in MemoryStatistics so we can make use of the interface.
2688 2012-07-12 Csaba Osztrogonác <ossy@webkit.org>
2690 Remove dead code after r122392.
2691 https://bugs.webkit.org/show_bug.cgi?id=91049
2693 Reviewed by Filip Pizlo.
2695 * dfg/DFGSpeculativeJIT64.cpp:
2696 (JSC::DFG::SpeculativeJIT::emitCall):
2698 2012-07-11 Adenilson Cavalcanti <cavalcantii@gmail.com>
2700 Build fix + remove dead code
2701 https://bugs.webkit.org/show_bug.cgi?id=91039
2703 Reviewed by Filip Pizlo.
2705 An unused variable was breaking compilation (thanks to warnings being treated as errors).
2707 * dfg/DFGSpeculativeJIT32_64.cpp:
2708 (JSC::DFG::SpeculativeJIT::emitCall):
2710 2012-07-11 Mark Rowe <mrowe@apple.com>
2712 <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions.
2714 Reviewed by Dan Bernstein.
2716 The deployment target is already set to the version that we're targeting, and it's that setting
2717 which determines which functionality from the SDK is available to us.
2719 * Configurations/Base.xcconfig:
2721 2012-07-11 Filip Pizlo <fpizlo@apple.com>
2723 DFG should have fast virtual calls
2724 https://bugs.webkit.org/show_bug.cgi?id=90924
2726 Reviewed by Gavin Barraclough.
2728 Implements virtual call support in the style of the old JIT, with the
2729 caveat that we still use the same slow path for both InternalFunction
2730 calls and JSFunction calls. Also rationalized the way that our
2731 CodeOrigin indices tie into exception checks (previously it was a
2732 strange one-to-one mapping with fairly limited assertions; now it's a
2733 one-to-many mapping for CodeOrigins to exception checks, respectively).
2734 I also took the opportunity to clean up
2735 CallLinkInfo::callReturnLocation, which previously was either a Call or
2736 a NearCall. Now it's just a NearCall. As well, exceptions during slow
2737 path call resolution are now handled by returning an exception throwing
2738 thunk rather than returning null. And finally, I made a few things
2739 public that were previously private-with-lots-of-friends, because I
2740 truly despise the thought of listing each thunk generating function as
2741 a friend of JSValue and friends.
2743 * bytecode/CallLinkInfo.cpp:
2744 (JSC::CallLinkInfo::unlink):
2745 * bytecode/CallLinkInfo.h:
2747 * bytecode/CodeOrigin.h:
2748 (JSC::CodeOrigin::CodeOrigin):
2749 (JSC::CodeOrigin::isSet):
2750 * dfg/DFGAssemblyHelpers.h:
2751 (JSC::DFG::AssemblyHelpers::AssemblyHelpers):
2752 * dfg/DFGCCallHelpers.h:
2753 (JSC::DFG::CCallHelpers::CCallHelpers):
2756 * dfg/DFGJITCompiler.cpp:
2757 (JSC::DFG::JITCompiler::link):
2758 (JSC::DFG::JITCompiler::compileFunction):
2759 * dfg/DFGJITCompiler.h:
2760 (JSC::DFG::CallBeginToken::CallBeginToken):
2761 (JSC::DFG::CallBeginToken::~CallBeginToken):
2763 (JSC::DFG::CallBeginToken::set):
2764 (JSC::DFG::CallBeginToken::registerWithExceptionCheck):
2765 (JSC::DFG::CallBeginToken::codeOrigin):
2766 (JSC::DFG::CallExceptionRecord::CallExceptionRecord):
2767 (CallExceptionRecord):
2768 (JSC::DFG::JITCompiler::currentCodeOriginIndex):
2770 (JSC::DFG::JITCompiler::beginCall):
2771 (JSC::DFG::JITCompiler::notifyCall):
2772 (JSC::DFG::JITCompiler::prepareForExceptionCheck):
2773 (JSC::DFG::JITCompiler::addExceptionCheck):
2774 (JSC::DFG::JITCompiler::addFastExceptionCheck):
2775 * dfg/DFGOperations.cpp:
2776 * dfg/DFGRepatch.cpp:
2777 (JSC::DFG::dfgLinkFor):
2778 * dfg/DFGSpeculativeJIT.h:
2779 (JSC::DFG::SpeculativeJIT::appendCallWithExceptionCheck):
2780 * dfg/DFGSpeculativeJIT32_64.cpp:
2781 (JSC::DFG::SpeculativeJIT::emitCall):
2782 * dfg/DFGSpeculativeJIT64.cpp:
2783 (JSC::DFG::SpeculativeJIT::emitCall):
2784 * dfg/DFGThunks.cpp:
2785 (JSC::DFG::emitPointerValidation):
2787 (JSC::DFG::throwExceptionFromCallSlowPathGenerator):
2788 (JSC::DFG::slowPathFor):
2789 (JSC::DFG::linkForThunkGenerator):
2790 (JSC::DFG::linkCallThunkGenerator):
2791 (JSC::DFG::linkConstructThunkGenerator):
2792 (JSC::DFG::virtualForThunkGenerator):
2793 (JSC::DFG::virtualCallThunkGenerator):
2794 (JSC::DFG::virtualConstructThunkGenerator):
2798 (JSC::JIT::privateCompile):
2799 (JSC::JIT::linkFor):
2800 * runtime/Executable.h:
2802 (JSC::ExecutableBase::offsetOfJITCodeFor):
2803 (JSC::ExecutableBase::offsetOfNumParametersFor):
2804 * runtime/JSValue.h:
2807 2012-07-11 Filip Pizlo <fpizlo@apple.com>
2809 Accidentally used the wrong license (3-clause instead of 2-clause) in some
2810 files I just committed.
2812 Rubber stamped by Oliver Hunt.
2814 * bytecode/Watchpoint.cpp:
2815 * bytecode/Watchpoint.h:
2816 * jit/JumpReplacementWatchpoint.cpp:
2817 * jit/JumpReplacementWatchpoint.h:
2819 2012-07-11 Filip Pizlo <fpizlo@apple.com>
2821 Watchpoints and jump replacement should be decoupled
2822 https://bugs.webkit.org/show_bug.cgi?id=91016
2824 Reviewed by Oliver Hunt.
2827 * GNUmakefile.list.am:
2828 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2829 * JavaScriptCore.xcodeproj/project.pbxproj:
2831 * assembler/AbstractMacroAssembler.h:
2834 * bytecode/CodeBlock.h:
2835 (JSC::CodeBlock::appendWatchpoint):
2836 (JSC::CodeBlock::watchpoint):
2838 * bytecode/Watchpoint.cpp:
2840 * bytecode/Watchpoint.h:
2841 (JSC::Watchpoint::Watchpoint):
2843 (JSC::Watchpoint::fire):
2844 * dfg/DFGSpeculativeJIT.h:
2845 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
2846 * jit/JumpReplacementWatchpoint.cpp: Added.
2848 (JSC::JumpReplacementWatchpoint::correctLabels):
2849 (JSC::JumpReplacementWatchpoint::fireInternal):
2850 * jit/JumpReplacementWatchpoint.h: Added.
2852 (JumpReplacementWatchpoint):
2853 (JSC::JumpReplacementWatchpoint::JumpReplacementWatchpoint):
2854 (JSC::JumpReplacementWatchpoint::setDestination):
2856 2012-07-11 Kevin Ollivier <kevino@theolliviers.com>
2858 [wx] Unreviewed build fix. Don't try to build udis86_itab.c since it's included by
2863 2012-07-11 Chao-ying Fu <fu@mips.com>
2865 Add MIPS convertibleLoadPtr and other functions
2866 https://bugs.webkit.org/show_bug.cgi?id=90714
2868 Reviewed by Oliver Hunt.
2870 * assembler/MIPSAssembler.h:
2871 (JSC::MIPSAssembler::labelIgnoringWatchpoints):
2873 (JSC::MIPSAssembler::replaceWithLoad):
2874 (JSC::MIPSAssembler::replaceWithAddressComputation):
2875 * assembler/MacroAssemblerMIPS.h:
2876 (JSC::MacroAssemblerMIPS::convertibleLoadPtr):
2877 (MacroAssemblerMIPS):
2879 2012-07-11 Anders Carlsson <andersca@apple.com>
2881 Add -Wtautological-compare and -Wsign-compare warning flags
2882 https://bugs.webkit.org/show_bug.cgi?id=90994
2884 Reviewed by Mark Rowe.
2886 * Configurations/Base.xcconfig:
2888 2012-07-11 Benjamin Poulain <bpoulain@apple.com>
2890 Simplify the copying of JSC ARMv7's LinkRecord
2891 https://bugs.webkit.org/show_bug.cgi?id=90930
2893 Reviewed by Filip Pizlo.
2895 The class LinkRecord is used by value everywhere in ARMv7Assembler. The compiler uses
2896 memmove() to move the objects.
2898 The problem is memmove() is overkill for this object, moving the value can be done with
2899 3 load-store. This patch adds an operator= to the class doing more efficient copying.
2900 This reduces the link time by 19%.
2902 * assembler/ARMv7Assembler.h:
2903 (JSC::ARMv7Assembler::LinkRecord::LinkRecord):
2904 (JSC::ARMv7Assembler::LinkRecord::operator=):
2905 (JSC::ARMv7Assembler::LinkRecord::from):
2906 (JSC::ARMv7Assembler::LinkRecord::setFrom):
2907 (JSC::ARMv7Assembler::LinkRecord::to):
2908 (JSC::ARMv7Assembler::LinkRecord::type):
2909 (JSC::ARMv7Assembler::LinkRecord::linkType):
2910 (JSC::ARMv7Assembler::LinkRecord::setLinkType):
2911 (JSC::ARMv7Assembler::LinkRecord::condition):
2913 2012-07-11 Andy Wingo <wingo@igalia.com>
2915 jsc: Parse options before creating global data
2916 https://bugs.webkit.org/show_bug.cgi?id=90975
2918 Reviewed by Filip Pizlo.
2920 This patch moves the options parsing in "jsc" before the creation
2921 of the JSGlobalData, so that --useJIT=no has a chance to take
2925 (CommandLine::parseArguments): Refactor to be a class, and take
2926 argc and argv as constructor arguments.
2927 (jscmain): Move arg parsing before JSGlobalData creation.
2929 2012-07-10 Filip Pizlo <fpizlo@apple.com>
2931 REGRESSION(r122166): It made 170 tests crash on 32 bit platforms
2932 https://bugs.webkit.org/show_bug.cgi?id=90852
2934 Reviewed by Zoltan Herczeg.
2936 If we can't use the range filter, we should still make sure that the
2937 address is remotely sane, otherwise the hashtables will assert.
2939 * jit/JITStubRoutine.h:
2940 (JSC::JITStubRoutine::passesFilter):
2942 2012-07-10 Filip Pizlo <fpizlo@apple.com>
2944 DFG recompilation heuristics should be based on count, not rate
2945 https://bugs.webkit.org/show_bug.cgi?id=90146
2947 Reviewed by Oliver Hunt.
2949 Rolling r121511 back in after fixing the DFG's interpretation of op_div
2950 profiling, with Gavin's rubber stamp.
2952 This removes a bunch of code that was previously trying to prevent spurious
2953 reoptimizations if a large enough majority of executions of a code block did
2954 not result in OSR exit. It turns out that this code was purely harmful. This
2955 patch removes all of that logic and replaces it with a dead-simple
2956 heuristic: if you exit more than N times (where N is an exponential function
2957 of the number of times the code block has already been recompiled) then we
2960 This appears to be a broad ~1% win on many benchmarks large and small.
2962 * bytecode/CodeBlock.cpp:
2963 (JSC::CodeBlock::CodeBlock):
2964 * bytecode/CodeBlock.h:
2965 (JSC::CodeBlock::couldTakeSpecialFastCase):
2967 (JSC::CodeBlock::osrExitCounter):
2968 (JSC::CodeBlock::countOSRExit):
2969 (JSC::CodeBlock::addressOfOSRExitCounter):
2970 (JSC::CodeBlock::offsetOfOSRExitCounter):
2971 (JSC::CodeBlock::adjustedExitCountThreshold):
2972 (JSC::CodeBlock::exitCountThresholdForReoptimization):
2973 (JSC::CodeBlock::exitCountThresholdForReoptimizationFromLoop):
2974 (JSC::CodeBlock::shouldReoptimizeNow):
2975 (JSC::CodeBlock::shouldReoptimizeFromLoopNow):
2976 * bytecode/ExecutionCounter.cpp:
2977 (JSC::ExecutionCounter::setThreshold):
2978 * bytecode/ExecutionCounter.h:
2980 (JSC::ExecutionCounter::clippedThreshold):
2981 * dfg/DFGByteCodeParser.cpp:
2982 (JSC::DFG::ByteCodeParser::makeDivSafe):
2983 * dfg/DFGJITCompiler.cpp:
2984 (JSC::DFG::JITCompiler::compileBody):
2985 * dfg/DFGOSRExit.cpp:
2986 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
2987 * dfg/DFGOSRExitCompiler.cpp:
2988 (JSC::DFG::OSRExitCompiler::handleExitCounts):
2989 * dfg/DFGOperations.cpp:
2991 (JSC::DEFINE_STUB_FUNCTION):
2992 * runtime/Options.h:
2995 2012-07-09 Matt Falkenhagen <falken@chromium.org>
2997 Add ENABLE_DIALOG_ELEMENT and skeleton files
2998 https://bugs.webkit.org/show_bug.cgi?id=90521
3000 Reviewed by Kent Tamura.
3002 * Configurations/FeatureDefines.xcconfig:
3004 2012-07-09 Filip Pizlo <fpizlo@apple.com>
3006 Unreviewed, roll out http://trac.webkit.org/changeset/121511
3007 It made in-browser V8v7 10% slower.
3009 * bytecode/CodeBlock.cpp:
3010 (JSC::CodeBlock::CodeBlock):
3011 * bytecode/CodeBlock.h:
3013 (JSC::CodeBlock::countSpeculationSuccess):
3014 (JSC::CodeBlock::countSpeculationFailure):
3015 (JSC::CodeBlock::speculativeSuccessCounter):
3016 (JSC::CodeBlock::speculativeFailCounter):
3017 (JSC::CodeBlock::forcedOSRExitCounter):
3018 (JSC::CodeBlock::addressOfSpeculativeSuccessCounter):
3019 (JSC::CodeBlock::addressOfSpeculativeFailCounter):
3020 (JSC::CodeBlock::addressOfForcedOSRExitCounter):
3021 (JSC::CodeBlock::offsetOfSpeculativeSuccessCounter):
3022 (JSC::CodeBlock::offsetOfSpeculativeFailCounter):
3023 (JSC::CodeBlock::offsetOfForcedOSRExitCounter):
3024 (JSC::CodeBlock::largeFailCountThreshold):
3025 (JSC::CodeBlock::largeFailCountThresholdForLoop):
3026 (JSC::CodeBlock::shouldReoptimizeNow):
3027 (JSC::CodeBlock::shouldReoptimizeFromLoopNow):
3028 * bytecode/ExecutionCounter.cpp:
3029 (JSC::ExecutionCounter::setThreshold):
3030 * bytecode/ExecutionCounter.h:
3032 * dfg/DFGJITCompiler.cpp:
3033 (JSC::DFG::JITCompiler::compileBody):
3034 * dfg/DFGOSRExit.cpp:
3035 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
3036 * dfg/DFGOSRExitCompiler.cpp:
3037 (JSC::DFG::OSRExitCompiler::handleExitCounts):
3038 * dfg/DFGOperations.cpp:
3040 (JSC::DEFINE_STUB_FUNCTION):
3041 * runtime/Options.h:
3044 2012-07-09 Filip Pizlo <fpizlo@apple.com>
3046 DFG may get stuck in an infinite fix point if it constant folds a mispredicted node
3047 https://bugs.webkit.org/show_bug.cgi?id=90829
3048 <rdar://problem/11823843>
3050 Reviewed by Oliver Hunt.
3052 If a node is shown to have been mispredicted during CFA, then don't allow constant
3053 folding to make the graph even more degenerate. Instead, pull back on constant folding
3054 and allow the normal OSR machinery to fix our profiling so that a future recompilation
3055 doesn't see the same mistake.
3057 * dfg/DFGAbstractState.cpp:
3058 (JSC::DFG::AbstractState::execute):
3059 * dfg/DFGAbstractState.h:
3060 (JSC::DFG::AbstractState::trySetConstant):
3063 (JSC::DFG::Phase::name):
3065 (JSC::DFG::runAndLog):
3067 (JSC::DFG::runPhase):
3069 2012-07-09 Filip Pizlo <fpizlo@apple.com>
3071 It should be possible to jettison JIT stub routines even if they are currently running
3072 https://bugs.webkit.org/show_bug.cgi?id=90731
3074 Reviewed by Gavin Barraclough.
3076 This gives the GC awareness of all JIT-generated stubs for inline caches. That
3077 means that if you want to delete a JIT-generated stub, you don't have to worry
3078 about whether or not it is currently running: if there is a chance that it might
3079 be, the GC will kindly defer deletion until non-running-ness is proved.
3082 * GNUmakefile.list.am:
3083 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3084 * JavaScriptCore.xcodeproj/project.pbxproj:
3086 * bytecode/Instruction.h:
3088 (PolymorphicStubInfo):
3089 (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
3090 (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
3091 * bytecode/PolymorphicPutByIdList.cpp:
3092 (JSC::PutByIdAccess::fromStructureStubInfo):
3093 * bytecode/PolymorphicPutByIdList.h:
3094 (JSC::PutByIdAccess::transition):
3095 (JSC::PutByIdAccess::replace):
3096 (JSC::PutByIdAccess::stubRoutine):
3098 (JSC::PolymorphicPutByIdList::currentSlowPathTarget):
3099 * bytecode/StructureStubInfo.h:
3100 (JSC::StructureStubInfo::reset):
3101 * dfg/DFGRepatch.cpp:
3102 (JSC::DFG::generateProtoChainAccessStub):
3103 (JSC::DFG::tryCacheGetByID):
3104 (JSC::DFG::tryBuildGetByIDList):
3105 (JSC::DFG::tryBuildGetByIDProtoList):
3106 (JSC::DFG::emitPutReplaceStub):
3107 (JSC::DFG::emitPutTransitionStub):
3108 (JSC::DFG::tryCachePutByID):
3109 (JSC::DFG::tryBuildPutByIdList):
3110 * heap/ConservativeRoots.cpp:
3113 (JSC::DummyMarkHook::mark):
3114 (JSC::ConservativeRoots::add):
3115 (CompositeMarkHook):
3116 (JSC::CompositeMarkHook::CompositeMarkHook):
3117 (JSC::CompositeMarkHook::mark):
3118 * heap/ConservativeRoots.h:
3120 (ConservativeRoots):
3122 (JSC::Heap::markRoots):
3123 (JSC::Heap::deleteUnmarkedCompiledCode):
3127 * heap/JITStubRoutineSet.cpp: Added.
3129 (JSC::JITStubRoutineSet::JITStubRoutineSet):
3130 (JSC::JITStubRoutineSet::~JITStubRoutineSet):
3131 (JSC::JITStubRoutineSet::add):
3132 (JSC::JITStubRoutineSet::clearMarks):
3133 (JSC::JITStubRoutineSet::markSlow):
3134 (JSC::JITStubRoutineSet::deleteUnmarkedJettisonedStubRoutines):
3135 (JSC::JITStubRoutineSet::traceMarkedStubRoutines):
3136 * heap/JITStubRoutineSet.h: Added.
3138 (JITStubRoutineSet):
3139 (JSC::JITStubRoutineSet::mark):
3140 * heap/MachineStackMarker.h:
3142 * interpreter/RegisterFile.cpp:
3143 (JSC::RegisterFile::gatherConservativeRoots):
3144 * interpreter/RegisterFile.h:
3146 * jit/ExecutableAllocator.cpp:
3147 (JSC::DemandExecutableAllocator::DemandExecutableAllocator):
3148 * jit/ExecutableAllocator.h:
3150 * jit/ExecutableAllocatorFixedVMPool.cpp:
3152 (JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator):
3153 * jit/GCAwareJITStubRoutine.cpp: Added.
3155 (JSC::GCAwareJITStubRoutine::GCAwareJITStubRoutine):
3156 (JSC::GCAwareJITStubRoutine::~GCAwareJITStubRoutine):
3157 (JSC::GCAwareJITStubRoutine::observeZeroRefCount):
3158 (JSC::GCAwareJITStubRoutine::deleteFromGC):
3159 (JSC::GCAwareJITStubRoutine::markRequiredObjectsInternal):
3160 (JSC::MarkingGCAwareJITStubRoutineWithOneObject::MarkingGCAwareJITStubRoutineWithOneObject):
3161 (JSC::MarkingGCAwareJITStubRoutineWithOneObject::~MarkingGCAwareJITStubRoutineWithOneObject):
3162 (JSC::MarkingGCAwareJITStubRoutineWithOneObject::markRequiredObjectsInternal):
3163 (JSC::createJITStubRoutine):
3164 * jit/GCAwareJITStubRoutine.h: Added.
3166 (GCAwareJITStubRoutine):
3167 (JSC::GCAwareJITStubRoutine::markRequiredObjects):
3168 (MarkingGCAwareJITStubRoutineWithOneObject):
3169 * jit/JITPropertyAccess.cpp:
3170 (JSC::JIT::privateCompilePutByIdTransition):
3171 (JSC::JIT::privateCompilePatchGetArrayLength):
3172 (JSC::JIT::privateCompileGetByIdProto):
3173 (JSC::JIT::privateCompileGetByIdSelfList):
3174 (JSC::JIT::privateCompileGetByIdProtoList):
3175 (JSC::JIT::privateCompileGetByIdChainList):
3176 (JSC::JIT::privateCompileGetByIdChain):
3177 * jit/JITPropertyAccess32_64.cpp:
3178 (JSC::JIT::privateCompilePutByIdTransition):
3179 (JSC::JIT::privateCompilePatchGetArrayLength):
3180 (JSC::JIT::privateCompileGetByIdProto):
3181 (JSC::JIT::privateCompileGetByIdSelfList):
3182 (JSC::JIT::privateCompileGetByIdProtoList):
3183 (JSC::JIT::privateCompileGetByIdChainList):
3184 (JSC::JIT::privateCompileGetByIdChain):
3185 * jit/JITStubRoutine.cpp: Added.
3187 (JSC::JITStubRoutine::~JITStubRoutine):
3188 (JSC::JITStubRoutine::observeZeroRefCount):
3189 * jit/JITStubRoutine.h: Added.
3192 (JSC::JITStubRoutine::JITStubRoutine):
3193 (JSC::JITStubRoutine::createSelfManagedRoutine):
3194 (JSC::JITStubRoutine::code):
3195 (JSC::JITStubRoutine::asCodePtr):
3196 (JSC::JITStubRoutine::ref):
3197 (JSC::JITStubRoutine::deref):
3198 (JSC::JITStubRoutine::startAddress):
3199 (JSC::JITStubRoutine::endAddress):
3200 (JSC::JITStubRoutine::addressStep):
3201 (JSC::JITStubRoutine::canPerformRangeFilter):
3202 (JSC::JITStubRoutine::filteringStartAddress):
3203 (JSC::JITStubRoutine::filteringExtentSize):
3204 (JSC::JITStubRoutine::passesFilter):
3206 (JSC::DEFINE_STUB_FUNCTION):
3207 (JSC::getPolymorphicAccessStructureListSlot):
3209 2012-07-09 Sheriff Bot <webkit.review.bot@gmail.com>
3211 Unreviewed, rolling out r122107.
3212 http://trac.webkit.org/changeset/122107
3213 https://bugs.webkit.org/show_bug.cgi?id=90794
3215 Build failure on Mac debug bots (Requested by falken_ on
3218 * Configurations/FeatureDefines.xcconfig:
3220 2012-07-09 Matt Falkenhagen <falken@chromium.org>
3222 Add ENABLE_DIALOG_ELEMENT and skeleton files
3223 https://bugs.webkit.org/show_bug.cgi?id=90521
3225 Reviewed by Kent Tamura.
3227 * Configurations/FeatureDefines.xcconfig:
3229 2012-07-08 Ryosuke Niwa <rniwa@webkit.org>
3231 gcc build fix after r121925.
3233 * runtime/JSObject.h:
3234 (JSC::JSFinalObject::finishCreation):
3236 2012-07-08 Zoltan Herczeg <zherczeg@webkit.org>
3238 [Qt][ARM] Implementing missing macro assembler instructions after r121925
3239 https://bugs.webkit.org/show_bug.cgi?id=90657
3241 Reviewed by Csaba Osztrogonác.
3243 Implementing convertibleLoadPtr, replaceWithLoad and
3244 replaceWithAddressComputation.
3246 * assembler/ARMAssembler.h:
3247 (JSC::ARMAssembler::replaceWithLoad):
3249 (JSC::ARMAssembler::replaceWithAddressComputation):
3250 * assembler/MacroAssemblerARM.h:
3251 (JSC::MacroAssemblerARM::convertibleLoadPtr):
3252 (MacroAssemblerARM):
3254 2012-07-06 Filip Pizlo <fpizlo@apple.com>
3256 WebKit Version 5.1.7 (6534.57.2, r121935): Double-click no longer works on OpenStreetMap
3257 https://bugs.webkit.org/show_bug.cgi?id=90703
3259 Reviewed by Michael Saboff.
3261 It turns out that in my object model refactoring, I managed to fix get_by_pname in all
3262 execution engines except 64-bit baseline JIT.
3264 * jit/JITPropertyAccess.cpp:
3265 (JSC::JIT::emit_op_get_by_pname):
3267 2012-07-06 Pravin D <pravind.2k4@gmail.com>
3269 Build Error on Qt Linux build
3270 https://bugs.webkit.org/show_bug.cgi?id=90699
3272 Reviewed by Laszlo Gombos.
3274 * parser/Parser.cpp:
3275 (JSC::::parseForStatement):
3276 Removed unused boolean variable as this was causing build error on Qt Linux.
3278 2012-07-06 Nuno Lopes <nlopes@apple.com>
3280 Fix build with recent clang.
3281 https://bugs.webkit.org/show_bug.cgi?id=90634
3283 Reviewed by Oliver Hunt.
3285 * jit/SpecializedThunkJIT.h:
3286 (JSC::SpecializedThunkJIT::SpecializedThunkJIT):
3287 (SpecializedThunkJIT):
3288 * jit/ThunkGenerators.cpp:
3289 (JSC::charCodeAtThunkGenerator):
3290 (JSC::charAtThunkGenerator):
3291 (JSC::fromCharCodeThunkGenerator):
3292 (JSC::sqrtThunkGenerator):
3293 (JSC::floorThunkGenerator):
3294 (JSC::ceilThunkGenerator):
3295 (JSC::roundThunkGenerator):
3296 (JSC::expThunkGenerator):
3297 (JSC::logThunkGenerator):
3298 (JSC::absThunkGenerator):
3299 (JSC::powThunkGenerator):
3300 * parser/ASTBuilder.h:
3301 (JSC::ASTBuilder::createAssignResolve):
3302 (JSC::ASTBuilder::createForLoop):
3303 (JSC::ASTBuilder::createForInLoop):
3304 (JSC::ASTBuilder::makeAssignNode):
3305 (JSC::ASTBuilder::makePrefixNode):
3306 (JSC::ASTBuilder::makePostfixNode):
3307 * parser/NodeConstructors.h:
3308 (JSC::PostfixErrorNode::PostfixErrorNode):
3309 (JSC::PrefixErrorNode::PrefixErrorNode):
3310 (JSC::AssignResolveNode::AssignResolveNode):
3311 (JSC::AssignErrorNode::AssignErrorNode):
3312 (JSC::ForNode::ForNode):
3313 (JSC::ForInNode::ForInNode):
3315 (FunctionCallResolveNode):
3318 (ReadModifyResolveNode):
3319 (AssignResolveNode):
3323 * parser/Parser.cpp:
3324 (JSC::::parseVarDeclarationList):
3325 (JSC::::parseForStatement):
3326 * parser/SyntaxChecker.h:
3327 (JSC::SyntaxChecker::createAssignResolve):
3328 (JSC::SyntaxChecker::createForLoop):
3330 2012-07-06 Zoltan Herczeg <zherczeg@webkit.org>
3332 [Qt][ARM] REGRESSION(r121885): It broke 30 jsc tests, 500+ layout tests
3333 https://bugs.webkit.org/show_bug.cgi?id=90656
3335 Reviewed by Csaba Osztrogonác.
3339 * assembler/MacroAssemblerARM.cpp:
3340 (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords):
3341 Rename getOp2Byte() -> getOp2Half()
3342 * assembler/MacroAssemblerARMv7.h:
3343 (JSC::MacroAssemblerARMv7::convertibleLoadPtr):
3344 Add a necessary space.
3347 Revert INLINE_ARM_FUNCTION macro.
3349 2012-07-05 Filip Pizlo <fpizlo@apple.com>
3351 REGRESSION(r121925): It broke 5 sputnik tests on x86 platforms
3352 https://bugs.webkit.org/show_bug.cgi?id=90658
3354 Reviewed by Zoltan Herczeg.
3356 Under the new object model, out-of-line property accesses such as those
3357 in ResolveGlobal must account for the fact that the offset to the Kth
3358 property is represented by K + inlineStorageCapacity. Hence, the property
3359 loads in ResolveGlobal must have an additional -inlineStorageCapacity *
3360 sizeof(JSValue) offset.
3362 * dfg/DFGSpeculativeJIT32_64.cpp:
3363 (JSC::DFG::SpeculativeJIT::compile):
3365 2012-07-05 Csaba Osztrogonác <ossy@webkit.org>
3367 [Qt] Unreviewed 64 bit buildfix after r121925.
3369 * bytecode/PutByIdStatus.cpp:
3370 (JSC::PutByIdStatus::computeFromLLInt):
3372 2012-07-05 Michael Saboff <msaboff@apple.com>
3374 JSString::tryHashConstLock() fails to get exclusive lock
3375 https://bugs.webkit.org/show_bug.cgi?id=90639
3377 Reviewed by Oliver Hunt.
3379 Added check that the string is already locked even before compare and swap.
3381 * heap/MarkStack.cpp:
3382 (JSC::JSString::tryHashConstLock):
3384 2012-07-04 Filip Pizlo <fpizlo@apple.com>
3386 Inline property storage should not be wasted when it is exhausted
3387 https://bugs.webkit.org/show_bug.cgi?id=90347
3389 Reviewed by Gavin Barraclough.
3391 Previously, if we switched an object from using inline storage to out-of-line
3392 storage, we would abandon the inline storage. This would have two main implications:
3393 (i) all accesses to the object, even for properties that were previously in inline
3394 storage, must now take an extra indirection; and (ii) we waste a non-trivial amount
3395 of space since we must allocate additional out-of-line storage to hold properties
3396 that would have fit in the inline storage. There's also the copying cost when
3397 switching to out-of-line storage - we must copy all inline properties into ouf-of-line
3400 This patch changes the way that object property storage works so that we can use both
3401 inline and out-of-line storage concurrently. This is accomplished by introducing a
3402 new notion of property offset. This PropertyOffset is a 32-bit signed integer and it
3405 offset == -1: invalid offset, indicating a property that does not exist.
3407 0 <= offset <= inlineStorageCapacity: offset into inline storage.
3409 inlineStorageCapacity < offset: offset into out-of-line storage.
3411 Because non-final objects don't have inline storage, the only valid PropertyOffsets
3412 for those objects' properties are -1 or > inlineStorageCapacity.
3414 This now means that the decision to use inline or out-of-line storage for an access is
3415 made based on the offset, rather than the structure. It also means that any access
3416 where the offset is a variable must have an extra branch, unless the type of the
3417 object is also known (if it's known to be a non-final object then we can just assert
3418 that the offset is >= inlineStorageCapacity).
3420 This looks like a big Kraken speed-up and a slight V8 speed-up.
3422 * GNUmakefile.list.am:
3423 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
3424 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3425 * JavaScriptCore.xcodeproj/project.pbxproj:
3426 * assembler/ARMv7Assembler.h:
3428 (JSC::ARMv7Assembler::ldrWide8BitImmediate):
3429 (JSC::ARMv7Assembler::replaceWithLoad):
3430 (JSC::ARMv7Assembler::replaceWithAddressComputation):
3431 * assembler/AbstractMacroAssembler.h:
3432 (AbstractMacroAssembler):
3433 (ConvertibleLoadLabel):
3434 (JSC::AbstractMacroAssembler::ConvertibleLoadLabel::ConvertibleLoadLabel):
3435 (JSC::AbstractMacroAssembler::ConvertibleLoadLabel::isSet):
3436 (JSC::AbstractMacroAssembler::labelIgnoringWatchpoints):
3437 (JSC::AbstractMacroAssembler::replaceWithLoad):
3438 (JSC::AbstractMacroAssembler::replaceWithAddressComputation):
3439 * assembler/CodeLocation.h:
3441 (CodeLocationCommon):
3442 (CodeLocationConvertibleLoad):
3443 (JSC::CodeLocationConvertibleLoad::CodeLocationConvertibleLoad):
3444 (JSC::CodeLocationCommon::convertibleLoadAtOffset):
3445 * assembler/LinkBuffer.cpp:
3446 (JSC::LinkBuffer::finalizeCodeWithDisassembly):
3447 * assembler/LinkBuffer.h:
3449 (JSC::LinkBuffer::locationOf):
3450 * assembler/MacroAssemblerARMv7.h:
3451 (MacroAssemblerARMv7):
3452 (JSC::MacroAssemblerARMv7::convertibleLoadPtr):
3453 * assembler/MacroAssemblerX86.h:
3454 (JSC::MacroAssemblerX86::convertibleLoadPtr):
3455 (MacroAssemblerX86):
3456 * assembler/MacroAssemblerX86_64.h:
3457 (JSC::MacroAssemblerX86_64::convertibleLoadPtr):
3458 (MacroAssemblerX86_64):
3459 * assembler/RepatchBuffer.h:
3461 (JSC::RepatchBuffer::replaceWithLoad):
3462 (JSC::RepatchBuffer::replaceWithAddressComputation):
3463 (JSC::RepatchBuffer::setLoadInstructionIsActive):
3464 * assembler/X86Assembler.h:
3465 (JSC::X86Assembler::replaceWithLoad):
3467 (JSC::X86Assembler::replaceWithAddressComputation):
3468 * bytecode/CodeBlock.cpp:
3469 (JSC::CodeBlock::printGetByIdOp):
3470 (JSC::CodeBlock::dump):
3471 (JSC::CodeBlock::finalizeUnconditionally):
3472 * bytecode/GetByIdStatus.cpp:
3473 (JSC::GetByIdStatus::computeFromLLInt):
3474 (JSC::GetByIdStatus::computeForChain):
3475 (JSC::GetByIdStatus::computeFor):
3476 * bytecode/GetByIdStatus.h:
3477 (JSC::GetByIdStatus::GetByIdStatus):
3478 (JSC::GetByIdStatus::offset):
3480 * bytecode/Opcode.h:
3482 (JSC::padOpcodeName):
3483 * bytecode/PutByIdStatus.cpp:
3484 (JSC::PutByIdStatus::computeFromLLInt):
3485 (JSC::PutByIdStatus::computeFor):
3486 * bytecode/PutByIdStatus.h:
3487 (JSC::PutByIdStatus::PutByIdStatus):
3488 (JSC::PutByIdStatus::offset):
3490 * bytecode/ResolveGlobalStatus.cpp:
3492 (JSC::computeForStructure):
3493 * bytecode/ResolveGlobalStatus.h:
3494 (JSC::ResolveGlobalStatus::ResolveGlobalStatus):
3495 (JSC::ResolveGlobalStatus::offset):
3496 (ResolveGlobalStatus):
3497 * bytecode/StructureSet.h:
3499 * bytecode/StructureStubInfo.h:
3500 * dfg/DFGByteCodeParser.cpp:
3502 (JSC::DFG::ByteCodeParser::handleGetByOffset):
3503 (JSC::DFG::ByteCodeParser::handleGetById):
3504 (JSC::DFG::ByteCodeParser::parseBlock):
3505 * dfg/DFGCapabilities.h:
3506 (JSC::DFG::canCompileOpcode):
3507 * dfg/DFGJITCompiler.cpp:
3508 (JSC::DFG::JITCompiler::link):
3509 * dfg/DFGJITCompiler.h:
3510 (JSC::DFG::PropertyAccessRecord::PropertyAccessRecord):
3511 (PropertyAccessRecord):
3512 * dfg/DFGRepatch.cpp:
3513 (JSC::DFG::dfgRepatchByIdSelfAccess):
3514 (JSC::DFG::generateProtoChainAccessStub):
3515 (JSC::DFG::tryCacheGetByID):
3516 (JSC::DFG::tryBuildGetByIDList):
3517 (JSC::DFG::tryBuildGetByIDProtoList):
3518 (JSC::DFG::emitPutReplaceStub):
3519 (JSC::DFG::emitPutTransitionStub):
3520 (JSC::DFG::tryCachePutByID):
3521 (JSC::DFG::tryBuildPutByIdList):
3522 * dfg/DFGSpeculativeJIT.h:
3523 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
3524 * dfg/DFGSpeculativeJIT32_64.cpp:
3525 (JSC::DFG::SpeculativeJIT::cachedGetById):
3526 (JSC::DFG::SpeculativeJIT::cachedPutById):
3527 (JSC::DFG::SpeculativeJIT::compile):
3528 * dfg/DFGSpeculativeJIT64.cpp:
3529 (JSC::DFG::SpeculativeJIT::cachedGetById):
3530 (JSC::DFG::SpeculativeJIT::cachedPutById):
3531 (JSC::DFG::SpeculativeJIT::compile):
3532 * heap/MarkStack.cpp:
3533 (JSC::visitChildren):
3534 * interpreter/Interpreter.cpp:
3535 (JSC::Interpreter::tryCacheGetByID):
3536 (JSC::Interpreter::privateExecute):
3538 (JSC::JIT::privateCompileMainPass):
3539 (JSC::JIT::privateCompileSlowCases):
3540 (JSC::PropertyStubCompilationInfo::copyToStubInfo):
3542 (JSC::PropertyStubCompilationInfo::PropertyStubCompilationInfo):
3543 (JSC::JIT::compileGetByIdProto):
3544 (JSC::JIT::compileGetByIdSelfList):
3545 (JSC::JIT::compileGetByIdProtoList):
3546 (JSC::JIT::compileGetByIdChainList):
3547 (JSC::JIT::compileGetByIdChain):
3548 (JSC::JIT::compilePutByIdTransition):
3550 * jit/JITInlineMethods.h:
3551 (JSC::JIT::emitAllocateBasicJSObject):
3552 * jit/JITOpcodes.cpp:
3553 (JSC::JIT::emit_op_resolve_global):
3554 * jit/JITOpcodes32_64.cpp:
3555 (JSC::JIT::emit_op_resolve_global):
3556 * jit/JITPropertyAccess.cpp:
3557 (JSC::JIT::compileGetDirectOffset):
3558 (JSC::JIT::emit_op_method_check):
3559 (JSC::JIT::compileGetByIdHotPath):
3560 (JSC::JIT::emit_op_put_by_id):
3561 (JSC::JIT::compilePutDirectOffset):
3562 (JSC::JIT::privateCompilePutByIdTransition):
3563 (JSC::JIT::patchGetByIdSelf):
3564 (JSC::JIT::patchPutByIdReplace):
3565 (JSC::JIT::privateCompileGetByIdProto):
3566 (JSC::JIT::privateCompileGetByIdSelfList):
3567 (JSC::JIT::privateCompileGetByIdProtoList):
3568 (JSC::JIT::privateCompileGetByIdChainList):
3569 (JSC::JIT::privateCompileGetByIdChain):
3570 * jit/JITPropertyAccess32_64.cpp:
3571 (JSC::JIT::emit_op_method_check):
3572 (JSC::JIT::compileGetByIdHotPath):
3573 (JSC::JIT::emit_op_put_by_id):
3574 (JSC::JIT::compilePutDirectOffset):
3575 (JSC::JIT::compileGetDirectOffset):
3576 (JSC::JIT::privateCompilePutByIdTransition):
3577 (JSC::JIT::patchGetByIdSelf):
3578 (JSC::JIT::patchPutByIdReplace):
3579 (JSC::JIT::privateCompileGetByIdProto):
3580 (JSC::JIT::privateCompileGetByIdSelfList):
3581 (JSC::JIT::privateCompileGetByIdProtoList):
3582 (JSC::JIT::privateCompileGetByIdChainList):
3583 (JSC::JIT::privateCompileGetByIdChain):
3584 (JSC::JIT::emit_op_get_by_pname):
3586 (JSC::JITThunks::tryCacheGetByID):
3587 (JSC::DEFINE_STUB_FUNCTION):
3588 * llint/LLIntSlowPaths.cpp:
3589 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
3590 * llint/LowLevelInterpreter.asm:
3591 * llint/LowLevelInterpreter32_64.asm:
3592 * llint/LowLevelInterpreter64.asm:
3593 * offlineasm/x86.rb:
3594 * runtime/JSGlobalObject.h:
3596 (JSC::JSGlobalObject::functionNameOffset):
3597 * runtime/JSObject.cpp:
3598 (JSC::JSObject::visitChildren):
3600 (JSC::JSFinalObject::visitChildren):
3601 (JSC::JSObject::put):
3602 (JSC::JSObject::deleteProperty):
3603 (JSC::JSObject::getPropertySpecificValue):
3604 (JSC::JSObject::removeDirect):
3605 (JSC::JSObject::growOutOfLineStorage):
3606 (JSC::JSObject::getOwnPropertyDescriptor):
3607 * runtime/JSObject.h:
3609 (JSC::JSObject::getDirect):
3610 (JSC::JSObject::getDirectLocation):
3611 (JSC::JSObject::hasInlineStorage):
3612 (JSC::JSObject::inlineStorageUnsafe):
3613 (JSC::JSObject::inlineStorage):
3614 (JSC::JSObject::outOfLineStorage):
3615 (JSC::JSObject::locationForOffset):
3616 (JSC::JSObject::offsetForLocation):
3617 (JSC::JSObject::getDirectOffset):
3618 (JSC::JSObject::putDirectOffset):
3619 (JSC::JSObject::putUndefinedAtDirectOffset):
3620 (JSC::JSObject::addressOfOutOfLineStorage):
3621 (JSC::JSObject::finishCreation):
3622 (JSC::JSNonFinalObject::JSNonFinalObject):
3623 (JSC::JSNonFinalObject::finishCreation):
3625 (JSC::JSFinalObject::finishCreation):
3626 (JSC::JSFinalObject::JSFinalObject):
3627 (JSC::JSObject::offsetOfOutOfLineStorage):
3628 (JSC::JSObject::setOutOfLineStorage):
3629 (JSC::JSObject::JSObject):
3631 (JSC::JSCell::fastGetOwnProperty):
3632 (JSC::JSObject::putDirectInternal):
3633 (JSC::JSObject::setStructureAndReallocateStorageIfNecessary):
3634 (JSC::JSObject::putDirectWithoutTransition):
3635 (JSC::offsetRelativeToPatchedStorage):
3636 (JSC::indexRelativeToBase):
3637 (JSC::offsetRelativeToBase):
3638 * runtime/JSPropertyNameIterator.cpp:
3639 (JSC::JSPropertyNameIterator::create):
3640 * runtime/JSPropertyNameIterator.h:
3641 (JSPropertyNameIterator):
3642 (JSC::JSPropertyNameIterator::getOffset):
3643 (JSC::JSPropertyNameIterator::finishCreation):
3644 * runtime/JSValue.cpp:
3645 (JSC::JSValue::putToPrimitive):
3646 * runtime/Operations.h:
3647 (JSC::normalizePrototypeChain):
3648 * runtime/Options.cpp:
3650 (JSC::Options::initialize):
3651 * runtime/PropertyMapHashTable.h:
3653 (JSC::PropertyMapEntry::PropertyMapEntry):
3655 (JSC::PropertyTable::PropertyTable):
3656 (JSC::PropertyTable::getDeletedOffset):
3657 (JSC::PropertyTable::addDeletedOffset):
3658 (JSC::PropertyTable::nextOffset):
3660 (JSC::PropertyTable::sizeInMemory):
3661 * runtime/PropertyOffset.h: Added.
3664 (JSC::validateOffset):
3665 (JSC::isValidOffset):
3666 (JSC::isInlineOffset):
3667 (JSC::isOutOfLineOffset):
3668 (JSC::offsetInInlineStorage):
3669 (JSC::offsetInOutOfLineStorage):
3670 (JSC::offsetInRespectiveStorage):
3671 (JSC::numberOfOutOfLineSlotsForLastOffset):
3672 (JSC::numberOfSlotsForLastOffset):
3673 (JSC::nextPropertyOffsetFor):
3674 (JSC::firstPropertyOffsetFor):
3675 * runtime/PropertySlot.h:
3676 (JSC::PropertySlot::cachedOffset):
3677 (JSC::PropertySlot::setValue):
3678 (JSC::PropertySlot::setCacheableGetterSlot):
3679 (JSC::PropertySlot::clearOffset):
3680 * runtime/PutPropertySlot.h:
3681 (JSC::PutPropertySlot::setExistingProperty):
3682 (JSC::PutPropertySlot::setNewProperty):
3683 (JSC::PutPropertySlot::cachedOffset):
3685 * runtime/Structure.cpp:
3686 (JSC::Structure::Structure):
3687 (JSC::Structure::materializePropertyMap):
3688 (JSC::nextOutOfLineStorageCapacity):
3689 (JSC::Structure::growOutOfLineCapacity):
3690 (JSC::Structure::suggestedNewOutOfLineStorageCapacity):
3691 (JSC::Structure::addPropertyTransitionToExistingStructure):
3692 (JSC::Structure::addPropertyTransition):
3693 (JSC::Structure::removePropertyTransition):
3694 (JSC::Structure::flattenDictionaryStructure):
3695 (JSC::Structure::addPropertyWithoutTransition):
3696 (JSC::Structure::removePropertyWithoutTransition):
3697 (JSC::Structure::copyPropertyTableForPinning):
3698 (JSC::Structure::get):
3699 (JSC::Structure::putSpecificValue):
3700 (JSC::Structure::remove):
3701 * runtime/Structure.h:
3703 (JSC::Structure::putWillGrowOutOfLineStorage):
3704 (JSC::Structure::previousID):
3705 (JSC::Structure::outOfLineCapacity):
3706 (JSC::Structure::outOfLineSizeForKnownFinalObject):
3707 (JSC::Structure::outOfLineSizeForKnownNonFinalObject):
3708 (JSC::Structure::outOfLineSize):
3709 (JSC::Structure::hasInlineStorage):
3710 (JSC::Structure::inlineCapacity):
3711 (JSC::Structure::inlineSizeForKnownFinalObject):
3712 (JSC::Structure::inlineSize):
3713 (JSC::Structure::totalStorageSize):
3714 (JSC::Structure::totalStorageCapacity):
3715 (JSC::Structure::firstValidOffset):
3716 (JSC::Structure::lastValidOffset):
3717 (JSC::Structure::isValidOffset):
3718 (JSC::Structure::isEmpty):
3719 (JSC::Structure::transitionCount):
3720 (JSC::Structure::get):
3722 2012-07-05 Oliver Hunt <oliver@apple.com>
3724 JSObjectCallAsFunction should thisConvert the provided thisObject
3725 https://bugs.webkit.org/show_bug.cgi?id=90628
3727 Reviewed by Gavin Barraclough.
3729 Perform this conversion on the provided this object.
3731 * API/JSObjectRef.cpp:
3732 (JSObjectCallAsFunction):
3734 2012-07-05 Zoltan Herczeg <zherczeg@webkit.org>
3736 [Qt] Unreviewed buildfix after r121886. Typo fix.
3738 * assembler/MacroAssemblerARM.cpp:
3739 (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords):
3741 2012-07-05 Zoltan Herczeg <zherczeg@webkit.org>
3743 Port DFG JIT to traditional ARM
3744 https://bugs.webkit.org/show_bug.cgi?id=90198
3746 Reviewed by Filip Pizlo.
3748 This patch contains the macro assembler part of the
3749 DFG JIT support on ARM systems with fixed 32 bit instruction
3750 width. A large amount of old code was refactored, and the ARMv4
3751 or lower support is removed from the macro assembler.
3753 Sunspider is improved by 8%, and V8 is 92%.
3755 * assembler/ARMAssembler.cpp:
3756 (JSC::ARMAssembler::dataTransfer32):
3757 (JSC::ARMAssembler::baseIndexTransfer32):
3759 (JSC::ARMAssembler::dataTransfer16):
3760 (JSC::ARMAssembler::baseIndexTransfer16):
3761 (JSC::ARMAssembler::dataTransferFloat):
3762 (JSC::ARMAssembler::baseIndexTransferFloat):
3763 (JSC::ARMAssembler::executableCopy):
3764 * assembler/ARMAssembler.h:
3765 (JSC::ARMAssembler::ARMAssembler):
3766 (JSC::ARMAssembler::emitInst):
3767 (JSC::ARMAssembler::vmov_f64_r):
3769 (JSC::ARMAssembler::vabs_f64_r):
3770 (JSC::ARMAssembler::vneg_f64_r):
3771 (JSC::ARMAssembler::ldr_imm):
3772 (JSC::ARMAssembler::ldr_un_imm):
3773 (JSC::ARMAssembler::dtr_u):
3774 (JSC::ARMAssembler::dtr_ur):
3775 (JSC::ARMAssembler::dtr_d):
3776 (JSC::ARMAssembler::dtr_dr):
3777 (JSC::ARMAssembler::dtrh_u):
3778 (JSC::ARMAssembler::dtrh_ur):
3779 (JSC::ARMAssembler::dtrh_d):
3780 (JSC::ARMAssembler::dtrh_dr):
3781 (JSC::ARMAssembler::fdtr_u):
3782 (JSC::ARMAssembler::fdtr_d):
3783 (JSC::ARMAssembler::push_r):
3784 (JSC::ARMAssembler::pop_r):
3785 (JSC::ARMAssembler::poke_r):
3786 (JSC::ARMAssembler::peek_r):
3787 (JSC::ARMAssembler::vmov_vfp64_r):
3788 (JSC::ARMAssembler::vmov_arm64_r):
3789 (JSC::ARMAssembler::vmov_vfp32_r):
3790 (JSC::ARMAssembler::vmov_arm32_r):
3791 (JSC::ARMAssembler::vcvt_u32_f64_r):
3792 (JSC::ARMAssembler::vcvt_f64_f32_r):
3793 (JSC::ARMAssembler::vcvt_f32_f64_r):
3794 (JSC::ARMAssembler::clz_r):
3795 (JSC::ARMAssembler::bkpt):
3796 (JSC::ARMAssembler::bx):
3797 (JSC::ARMAssembler::blx):
3798 (JSC::ARMAssembler::labelIgnoringWatchpoints):
3799 (JSC::ARMAssembler::labelForWatchpoint):
3800 (JSC::ARMAssembler::label):
3801 (JSC::ARMAssembler::getLdrImmAddress):
3802 (JSC::ARMAssembler::replaceWithJump):
3803 (JSC::ARMAssembler::maxJumpReplacementSize):
3804 (JSC::ARMAssembler::getOp2Byte):
3805 (JSC::ARMAssembler::getOp2Half):
3806 (JSC::ARMAssembler::RM):
3807 (JSC::ARMAssembler::RS):
3808 (JSC::ARMAssembler::RD):
3809 (JSC::ARMAssembler::RN):
3810 * assembler/AssemblerBufferWithConstantPool.h:
3811 (JSC::AssemblerBufferWithConstantPool::ensureSpaceForAnyInstruction):
3812 * assembler/MacroAssemblerARM.cpp:
3813 (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords):
3814 * assembler/MacroAssemblerARM.h:
3815 (JSC::MacroAssemblerARM::add32):
3816 (MacroAssemblerARM):
3817 (JSC::MacroAssemblerARM::and32):
3818 (JSC::MacroAssemblerARM::lshift32):
3819 (JSC::MacroAssemblerARM::mul32):
3820 (JSC::MacroAssemblerARM::neg32):
3821 (JSC::MacroAssemblerARM::rshift32):
3822 (JSC::MacroAssemblerARM::urshift32):
3823 (JSC::MacroAssemblerARM::xor32):
3824 (JSC::MacroAssemblerARM::load8):
3825 (JSC::MacroAssemblerARM::load8Signed):
3826 (JSC::MacroAssemblerARM::load16):
3827 (JSC::MacroAssemblerARM::load16Signed):
3828 (JSC::MacroAssemblerARM::load32):
3829 (JSC::MacroAssemblerARM::load32WithAddressOffsetPatch):
3830 (JSC::MacroAssemblerARM::store32WithAddressOffsetPatch):
3831 (JSC::MacroAssemblerARM::store8):
3832 (JSC::MacroAssemblerARM::store16):
3833 (JSC::MacroAssemblerARM::store32):
3834 (JSC::MacroAssemblerARM::move):
3835 (JSC::MacroAssemblerARM::jump):
3836 (JSC::MacroAssemblerARM::branchAdd32):
3837 (JSC::MacroAssemblerARM::mull32):
3838 (JSC::MacroAssemblerARM::branchMul32):
3839 (JSC::MacroAssemblerARM::nearCall):
3840 (JSC::MacroAssemblerARM::compare32):
3841 (JSC::MacroAssemblerARM::test32):
3842 (JSC::MacroAssemblerARM::sub32):
3843 (JSC::MacroAssemblerARM::call):
3844 (JSC::MacroAssemblerARM::loadFloat):
3845 (JSC::MacroAssemblerARM::loadDouble):
3846 (JSC::MacroAssemblerARM::storeFloat):
3847 (JSC::MacroAssemblerARM::storeDouble):
3848 (JSC::MacroAssemblerARM::moveDouble):
3849 (JSC::MacroAssemblerARM::addDouble):
3850 (JSC::MacroAssemblerARM::divDouble):
3851 (JSC::MacroAssemblerARM::subDouble):
3852 (JSC::MacroAssemblerARM::mulDouble):
3853 (JSC::MacroAssemblerARM::absDouble):
3854 (JSC::MacroAssemblerARM::negateDouble):
3855 (JSC::MacroAssemblerARM::convertInt32ToDouble):
3856 (JSC::MacroAssemblerARM::convertFloatToDouble):
3857 (JSC::MacroAssemblerARM::convertDoubleToFloat):
3858 (JSC::MacroAssemblerARM::branchTruncateDoubleToInt32):
3859 (JSC::MacroAssemblerARM::branchTruncateDoubleToUint32):
3860 (JSC::MacroAssemblerARM::truncateDoubleToInt32):
3861 (JSC::MacroAssemblerARM::truncateDoubleToUint32):
3862 (JSC::MacroAssemblerARM::branchConvertDoubleToInt32):
3863 (JSC::MacroAssemblerARM::branchDoubleNonZero):
3864 (JSC::MacroAssemblerARM::branchDoubleZeroOrNaN):
3865 (JSC::MacroAssemblerARM::invert):
3866 (JSC::MacroAssemblerARM::replaceWithJump):
3867 (JSC::MacroAssemblerARM::maxJumpReplacementSize):
3868 (JSC::MacroAssemblerARM::call32):
3869 * assembler/SH4Assembler.h:
3870 (JSC::SH4Assembler::label):
3871 * dfg/DFGAssemblyHelpers.h:
3872 (JSC::DFG::AssemblyHelpers::debugCall):
3873 (JSC::DFG::AssemblyHelpers::boxDouble):
3874 (JSC::DFG::AssemblyHelpers::unboxDouble):
3875 * dfg/DFGCCallHelpers.h:
3877 (JSC::DFG::CCallHelpers::setupArguments):
3883 * dfg/DFGOperations.cpp:
3885 * dfg/DFGSpeculativeJIT.h:
3887 (JSC::DFG::SpeculativeJIT::appendCallWithExceptionCheckSetResult):
3888 (JSC::DFG::SpeculativeJIT::appendCallSetResult):
3893 * jit/JSInterfaceJIT.h:
3896 2012-07-04 Anthony Scian <ascian@rim.com>
3898 Web Inspector [JSC]: Implement ScriptCallStack::stackTrace
3899 https://bugs.webkit.org/show_bug.cgi?id=40118
3901 Reviewed by Yong Li.
3903 Added member functions to expose function name, urlString, and line #.
3904 Refactored toString to make use of these member functions to reduce
3905 duplicated code for future maintenance.
3907 Manually tested refactoring of toString by tracing thrown exceptions.
3909 * interpreter/Interpreter.h:
3910 (JSC::StackFrame::toString):
3911 (JSC::StackFrame::friendlySourceURL):
3912 (JSC::StackFrame::friendlyFunctionName):
3913 (JSC::StackFrame::friendlyLineNumber):
3915 2012-07-04 Andy Wingo <wingo@igalia.com>
3917 [GTK] Enable parallel GC
3918 https://bugs.webkit.org/show_bug.cgi?id=90568
3920 Reviewed by Martin Robinson.
3922 * runtime/Options.cpp: Include <algorithm.h> for std::min.
3924 2012-07-04 John Mellor <johnme@chromium.org>
3926 Text Autosizing: Add compile flag and runtime setting
3927 https://bugs.webkit.org/show_bug.cgi?id=87394
3929 This patch renames Font Boosting to Text Autosizing.
3931 Reviewed by Adam Barth.
3933 * Configurations/FeatureDefines.xcconfig:
3935 2012-07-03 Michael Saboff <msaboff@apple.com>
3937 Enh: Hash Const JSString in Backing Stores to Save Memory
3938 https://bugs.webkit.org/show_bug.cgi?id=86024
3940 Reviewed by Oliver Hunt.
3942 During garbage collection, each marking thread keeps a HashMap of
3943 strings. While visiting via MarkStack::copyAndAppend(), we check to
3944 see if the string we are visiting is already in the HashMap. If not
3945 we add it. If so, we change the reference to the current string we're
3946 visiting to the prior string.
3948 To reduce the performance impact of this change, two throttles have
3949 ben added. 1) We only try hash consting if a significant number of new
3950 strings have been created since the last hash const. Currently this is
3951 set at 100 strings. 2) If a string is unique at the end of a marking
3952 it will not be checked during further GC phases. In some cases this
3953 won't catch all duplicates, but we are trying to catch the growth of
3957 (JSC::Heap::markRoots):
3958 * heap/MarkStack.cpp:
3959 (JSC::MarkStackThreadSharedData::resetChildren):
3960 (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData):
3961 (JSC::MarkStackThreadSharedData::reset):
3962 (JSC::MarkStack::setup): Check to see if enough strings have been created
3964 (JSC::MarkStack::reset): Added call to clear m_uniqueStrings.
3965 (JSC::JSString::tryHashConstLock): New method to lock JSString for
3967 (JSC::JSString::releaseHashConstLock): New unlock method.
3968 (JSC::JSString::shouldTryHashConst): Set of checks to see if we should
3969 try to hash const the string.
3970 (JSC::MarkStack::internalAppend): New method that performs the hash consting.
3971 (JSC::SlotVisitor::copyAndAppend): Changed to call the new hash
3972 consting internalAppend().
3974 (MarkStackThreadSharedData):
3976 * runtime/JSGlobalData.cpp:
3977 (JSC::JSGlobalData::JSGlobalData):
3978 * runtime/JSGlobalData.h:
3980 (JSC::JSGlobalData::haveEnoughNewStringsToHashConst):
3981 (JSC::JSGlobalData::resetNewStringsSinceLastHashConst):
3982 * runtime/JSString.h:
3983 (JSString): Changed from using bool flags to using an unsigned
3984 m_flags field. This works better with the weakCompareAndSwap in
3985 JSString::tryHashConstLock(). Changed the 8bitness setting and
3986 checking to use new accessors.
3987 (JSC::JSString::JSString):
3988 (JSC::JSString::finishCreation):
3989 (JSC::JSString::is8Bit): Updated for new m_flags.
3990 (JSC::JSString::setIs8Bit): New setter.
3991 New hash const flags accessors:
3992 (JSC::JSString::isHashConstSingleton):
3993 (JSC::JSString::clearHashConstSingleton):
3994 (JSC::JSString::setHashConstSingleton):
3995 (JSC::JSRopeString::finishCreation):
3996 (JSC::JSRopeString::append):
3998 2012-07-03 Tony Chang <tony@chromium.org>
4000 [chromium] Unreviewed, update .gitignore to handle VS2010 files.
4002 * JavaScriptCore.gyp/.gitignore:
4004 2012-07-03 Mark Lam <mark.lam@apple.com>
4006 Add ability to symbolically set and dump JSC VM options.
4007 See comments in runtime/Options.h for details on how the options work.
4008 https://bugs.webkit.org/show_bug.cgi?id=90420
4010 Reviewed by Filip Pizlo.
4012 * assembler/LinkBuffer.cpp:
4013 (JSC::LinkBuffer::finalizeCodeWithDisassembly):
4014 * assembler/LinkBuffer.h:
4016 * bytecode/CodeBlock.cpp:
4017 (JSC::CodeBlock::shouldOptimizeNow):
4018 * bytecode/CodeBlock.h:
4019 (JSC::CodeBlock::likelyToTakeSlowCase):
4020 (JSC::CodeBlock::couldTakeSlowCase):
4021 (JSC::CodeBlock::likelyToTakeSpecialFastCase):
4022 (JSC::CodeBlock::likelyToTakeDeepestSlowCase):
4023 (JSC::CodeBlock::likelyToTakeAnySlowCase):
4024 (JSC::CodeBlock::jitAfterWarmUp):
4025 (JSC::CodeBlock::jitSoon):
4026 (JSC::CodeBlock::reoptimizationRetryCounter):
4027 (JSC::CodeBlock::countReoptimization):
4028 (JSC::CodeBlock::counterValueForOptimizeAfterWarmUp):
4029 (JSC::CodeBlock::counterValueForOptimizeAfterLongWarmUp):
4030 (JSC::CodeBlock::optimizeSoon):
4031 (JSC::CodeBlock::exitCountThresholdForReoptimization):
4032 (JSC::CodeBlock::exitCountThresholdForReoptimizationFromLoop):
4033 * bytecode/ExecutionCounter.h:
4034 (JSC::ExecutionCounter::clippedThreshold):
4035 * dfg/DFGByteCodeParser.cpp:
4036 (JSC::DFG::ByteCodeParser::handleInlining):
4037 * dfg/DFGCapabilities.h:
4038 (JSC::DFG::mightCompileEval):
4039 (JSC::DFG::mightCompileProgram):
4040 (JSC::DFG::mightCompileFunctionForCall):
4041 (JSC::DFG::mightCompileFunctionForConstruct):
4042 (JSC::DFG::mightInlineFunctionForCall):
4043 (JSC::DFG::mightInlineFunctionForConstruct):
4045 (JSC::DFG::shouldShowDisassembly):
4046 * dfg/DFGDriver.cpp:
4047 (JSC::DFG::compile):
4048 * dfg/DFGOSRExit.cpp:
4049 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
4050 * dfg/DFGVariableAccessData.h:
4051 (JSC::DFG::VariableAccessData::shouldUseDoubleFormatAccordingToVote):
4052 * heap/MarkStack.cpp:
4053 (JSC::MarkStackSegmentAllocator::allocate):
4054 (JSC::MarkStackSegmentAllocator::shrinkReserve):
4055 (JSC::MarkStackArray::MarkStackArray):
4056 (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData):
4057 (JSC::SlotVisitor::donateKnownParallel):
4058 (JSC::SlotVisitor::drain):
4059 (JSC::SlotVisitor::drainFromShared):
4061 (JSC::MarkStack::mergeOpaqueRootsIfProfitable):
4062 (JSC::MarkStack::addOpaqueRoot):
4063 * heap/SlotVisitor.h:
4064 (JSC::SlotVisitor::donate):
4066 (JSC::JIT::emitOptimizationCheck):
4068 (printUsageStatement):
4070 * runtime/InitializeThreading.cpp:
4071 (JSC::initializeThreadingOnce):
4072 * runtime/JSGlobalData.cpp:
4073 (JSC::enableAssembler):
4074 * runtime/JSGlobalObject.cpp:
4075 (JSC::JSGlobalObject::JSGlobalObject):
4076 * runtime/Options.cpp:
4078 (JSC::overrideOptionWithHeuristic):
4079 (JSC::Options::initialize):
4080 (JSC::Options::setOption):
4081 (JSC::Options::dumpAllOptions):
4082 (JSC::Options::dumpOption):
4083 * runtime/Options.h:
4088 2012-07-03 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> Joel Dillon <joel.dillon@codethink.co.uk>
4090 [Qt][Win] Fix broken QtWebKit5.lib linking
4091 https://bugs.webkit.org/show_bug.cgi?id=88321
4093 Reviewed by Kenneth Rohde Christiansen.
4095 The goal is to have different ports build systems define STATICALLY_LINKED_WITH_WTF
4096 when building JavaScriptCore, if both are packaged in the same DLL, instead
4097 of relying on the code to handle this.
4098 The effects of BUILDING_* and STATICALLY_LINKED_WITH_* are currently the same
4099 except for a check in Source/JavaScriptCore/config.h.
4101 Keeping the old way for the WX port as requested by the port's contributors.
4102 For non-Windows ports there is no difference between IMPORT and EXPORT, no
4106 JS symbols shouldn't be included by WTF objects anymore. Remove the export when BUILDING_WTF.
4107 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
4108 Make sure that JavaScriptCore uses import symbols of WTF for the Win port.
4109 * runtime/JSExportMacros.h:
4111 2012-07-02 Filip Pizlo <fpizlo@apple.com>
4113 DFG OSR exit value recoveries should be computed lazily
4114 https://bugs.webkit.org/show_bug.cgi?id=82155
4116 Reviewed by Gavin Barraclough.
4118 This change aims to reduce one aspect of DFG compile times: the fact
4119 that we currently compute the value recoveries for each local and
4120 argument on every speculation check. We compile many speculation checks,
4121 so this can add up quick. The strategy that this change takes is to
4122 have the DFG save just enough information about how the compiler is
4123 choosing to represent state, that the DFG::OSRExitCompiler can reify
4124 the value recoveries lazily.
4126 This appears to be an 0.3% SunSpider speed-up and is neutral elsewhere.
4128 I also took the opportunity to fix the sampling regions profiler (it
4129 was missing an export macro) and to put in more sampling regions in
4130 the DFG (which are disabled so long as ENABLE(SAMPLING_REGIONS) is
4134 * GNUmakefile.list.am:
4135 * JavaScriptCore.xcodeproj/project.pbxproj:
4137 * bytecode/CodeBlock.cpp:
4139 (JSC::CodeBlock::shrinkDFGDataToFit):
4140 * bytecode/CodeBlock.h:
4142 (JSC::CodeBlock::minifiedDFG):
4143 (JSC::CodeBlock::variableEventStream):
4145 * bytecode/Operands.h:
4146 (JSC::Operands::hasOperand):
4148 (JSC::Operands::size):
4149 (JSC::Operands::at):
4150 (JSC::Operands::operator[]):
4151 (JSC::Operands::isArgument):
4152 (JSC::Operands::isVariable):
4153 (JSC::Operands::argumentForIndex):
4154 (JSC::Operands::variableForIndex):
4155 (JSC::Operands::operandForIndex):
4157 (JSC::dumpOperands):
4158 * bytecode/SamplingTool.h:
4160 * dfg/DFGByteCodeParser.cpp:
4162 * dfg/DFGCFAPhase.cpp:
4163 (JSC::DFG::performCFA):
4164 * dfg/DFGCSEPhase.cpp:
4165 (JSC::DFG::performCSE):
4166 * dfg/DFGFixupPhase.cpp:
4167 (JSC::DFG::performFixup):
4168 * dfg/DFGGenerationInfo.h:
4169 (JSC::DFG::GenerationInfo::GenerationInfo):
4170 (JSC::DFG::GenerationInfo::initConstant):
4171 (JSC::DFG::GenerationInfo::initInteger):
4172 (JSC::DFG::GenerationInfo::initJSValue):
4173 (JSC::DFG::GenerationInfo::initCell):
4174 (JSC::DFG::GenerationInfo::initBoolean):
4175 (JSC::DFG::GenerationInfo::initDouble):
4176 (JSC::DFG::GenerationInfo::initStorage):
4178 (JSC::DFG::GenerationInfo::noticeOSRBirth):
4179 (JSC::DFG::GenerationInfo::use):
4180 (JSC::DFG::GenerationInfo::spill):
4181 (JSC::DFG::GenerationInfo::setSpilled):
4182 (JSC::DFG::GenerationInfo::fillJSValue):
4183 (JSC::DFG::GenerationInfo::fillCell):
4184 (JSC::DFG::GenerationInfo::fillInteger):
4185 (JSC::DFG::GenerationInfo::fillBoolean):
4186 (JSC::DFG::GenerationInfo::fillDouble):
4187 (JSC::DFG::GenerationInfo::fillStorage):
4188 (JSC::DFG::GenerationInfo::appendFill):
4189 (JSC::DFG::GenerationInfo::appendSpill):
4190 * dfg/DFGJITCompiler.cpp:
4191 (JSC::DFG::JITCompiler::link):
4192 (JSC::DFG::JITCompiler::compile):
4193 (JSC::DFG::JITCompiler::compileFunction):
4194 * dfg/DFGMinifiedGraph.h: Added.
4197 (JSC::DFG::MinifiedGraph::MinifiedGraph):
4198 (JSC::DFG::MinifiedGraph::at):
4199 (JSC::DFG::MinifiedGraph::append):
4200 (JSC::DFG::MinifiedGraph::prepareAndShrink):
4201 (JSC::DFG::MinifiedGraph::setOriginalGraphSize):
4202 (JSC::DFG::MinifiedGraph::originalGraphSize):
4203 * dfg/DFGMinifiedNode.cpp: Added.
4205 (JSC::DFG::MinifiedNode::fromNode):
4206 * dfg/DFGMinifiedNode.h: Added.
4208 (JSC::DFG::belongsInMinifiedGraph):
4210 (JSC::DFG::MinifiedNode::MinifiedNode):
4211 (JSC::DFG::MinifiedNode::index):
4212 (JSC::DFG::MinifiedNode::op):
4213 (JSC::DFG::MinifiedNode::hasChild1):
4214 (JSC::DFG::MinifiedNode::child1):
4215 (JSC::DFG::MinifiedNode::hasConstant):
4216 (JSC::DFG::MinifiedNode::hasConstantNumber):
4217 (JSC::DFG::MinifiedNode::constantNumber):
4218 (JSC::DFG::MinifiedNode::hasWeakConstant):
4219 (JSC::DFG::MinifiedNode::weakConstant):
4220 (JSC::DFG::MinifiedNode::getIndex):
4221 (JSC::DFG::MinifiedNode::compareByNodeIndex):
4222 (JSC::DFG::MinifiedNode::hasChild):
4225 * dfg/DFGOSRExit.cpp:
4226 (JSC::DFG::OSRExit::OSRExit):
4229 * dfg/DFGOSRExitCompiler.cpp:
4230 * dfg/DFGOSRExitCompiler.h:
4232 * dfg/DFGOSRExitCompiler32_64.cpp:
4233 (JSC::DFG::OSRExitCompiler::compileExit):
4234 * dfg/DFGOSRExitCompiler64.cpp:
4235 (JSC::DFG::OSRExitCompiler::compileExit):
4236 * dfg/DFGPredictionPropagationPhase.cpp:
4237 (JSC::DFG::performPredictionPropagation):
4238 * dfg/DFGRedundantPhiEliminationPhase.cpp:
4239 (JSC::DFG::performRedundantPhiElimination):
4240 * dfg/DFGSpeculativeJIT.cpp:
4241 (JSC::DFG::SpeculativeJIT::SpeculativeJIT):
4243 (JSC::DFG::SpeculativeJIT::fillStorage):
4244 (JSC::DFG::SpeculativeJIT::noticeOSRBirth):
4245 (JSC::DFG::SpeculativeJIT::compileMovHint):
4246 (JSC::DFG::SpeculativeJIT::compile):
4247 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
4248 * dfg/DFGSpeculativeJIT.h:
4250 (JSC::DFG::SpeculativeJIT::use):
4252 (JSC::DFG::SpeculativeJIT::spill):
4253 (JSC::DFG::SpeculativeJIT::speculationCheck):
4254 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
4255 (JSC::DFG::SpeculativeJIT::recordSetLocal):
4256 * dfg/DFGSpeculativeJIT32_64.cpp:
4257 (JSC::DFG::SpeculativeJIT::fillInteger):
4258 (JSC::DFG::SpeculativeJIT::fillDouble):
4259 (JSC::DFG::SpeculativeJIT::fillJSValue):
4260 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
4261 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
4262 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
4263 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
4264 (JSC::DFG::SpeculativeJIT::compile):
4265 * dfg/DFGSpeculativeJIT64.cpp:
4266 (JSC::DFG::SpeculativeJIT::fillInteger):
4267 (JSC::DFG::SpeculativeJIT::fillDouble):
4268 (JSC::DFG::SpeculativeJIT::fillJSValue):
4269 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
4270 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
4271 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
4272 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
4273 (JSC::DFG::SpeculativeJIT::compile):
4274 * dfg/DFGValueRecoveryOverride.h: Added.
4276 (ValueRecoveryOverride):
4277 (JSC::DFG::ValueRecoveryOverride::ValueRecoveryOverride):
4278 * dfg/DFGValueSource.cpp: Added.
4280 (JSC::DFG::ValueSource::dump):
4281 * dfg/DFGValueSource.h: Added.
4283 (JSC::DFG::dataFormatToValueSourceKind):
4284 (JSC::DFG::valueSourceKindToDataFormat):
4285 (JSC::DFG::isInRegisterFile):
4287 (JSC::DFG::ValueSource::ValueSource):
4288 (JSC::DFG::ValueSource::forPrediction):
4289 (JSC::DFG::ValueSource::forDataFormat):
4290 (JSC::DFG::ValueSource::isSet):
4291 (JSC::DFG::ValueSource::kind):
4292 (JSC::DFG::ValueSource::isInRegisterFile):
4293 (JSC::DFG::ValueSource::dataFormat):
4294 (JSC::DFG::ValueSource::valueRecovery):
4295 (JSC::DFG::ValueSource::nodeIndex):
4296 (JSC::DFG::ValueSource::nodeIndexFromKind):
4297 (JSC::DFG::ValueSource::kindFromNodeIndex):
4298 * dfg/DFGVariableEvent.cpp: Added.
4300 (JSC::DFG::VariableEvent::dump):
4301 (JSC::DFG::VariableEvent::dumpFillInfo):
4302 (JSC::DFG::VariableEvent::dumpSpillInfo):
4303 * dfg/DFGVariableEvent.h: Added.
4306 (JSC::DFG::VariableEvent::VariableEvent):
4307 (JSC::DFG::VariableEvent::reset):
4308 (JSC::DFG::VariableEvent::fillGPR):
4309 (JSC::DFG::VariableEvent::fillPair):
4310 (JSC::DFG::VariableEvent::fillFPR):
4311 (JSC::DFG::VariableEvent::spill):
4312 (JSC::DFG::VariableEvent::death):
4313 (JSC::DFG::VariableEvent::setLocal):
4314 (JSC::DFG::VariableEvent::movHint):
4315 (JSC::DFG::VariableEvent::kind):
4316 (JSC::DFG::VariableEvent::nodeIndex):
4317 (JSC::DFG::VariableEvent::dataFormat):
4318 (JSC::DFG::VariableEvent::gpr):
4319 (JSC::DFG::VariableEvent::tagGPR):
4320 (JSC::DFG::VariableEvent::payloadGPR):
4321 (JSC::DFG::VariableEvent::fpr):
4322 (JSC::DFG::VariableEvent::virtualRegister):
4323 (JSC::DFG::VariableEvent::operand):
4324 (JSC::DFG::VariableEvent::variableRepresentation):
4325 * dfg/DFGVariableEventStream.cpp: Added.
4327 (JSC::DFG::VariableEventStream::logEvent):
4328 (MinifiedGenerationInfo):
4329 (JSC::DFG::MinifiedGenerationInfo::MinifiedGenerationInfo):
4330 (JSC::DFG::MinifiedGenerationInfo::update):
4331 (JSC::DFG::VariableEventStream::reconstruct):
4332 * dfg/DFGVariableEventStream.h: Added.
4334 (VariableEventStream):
4335 (JSC::DFG::VariableEventStream::appendAndLog):
4336 * dfg/DFGVirtualRegisterAllocationPhase.cpp:
4337 (JSC::DFG::performVirtualRegisterAllocation):
4339 2012-07-02 Filip Pizlo <fpizlo@apple.com>
4341 DFG::ArgumentsSimplificationPhase should assert that the PhantomArguments nodes it creates are not shouldGenerate()
4342 https://bugs.webkit.org/show_bug.cgi?id=90407
4344 Reviewed by Mark Hahnenberg.
4346 * dfg/DFGArgumentsSimplificationPhase.cpp:
4347 (JSC::DFG::ArgumentsSimplificationPhase::run):
4349 2012-07-02 Gavin Barraclough <barraclough@apple.com>
4351 Array.prototype.pop should throw if property is not configurable
4352 https://bugs.webkit.org/show_bug.cgi?id=75788
4354 Rubber Stamped by Oliver Hunt.
4356 No real bug here any more, but the error we throw sometimes has a misleading message.
4358 * runtime/JSArray.cpp:
4359 (JSC::JSArray::pop):
4361 2012-06-29 Filip Pizlo <fpizlo@apple.com>
4363 JSObject wastes too much memory on unused property slots
4364 https://bugs.webkit.org/show_bug.cgi?id=90255
4366 Reviewed by Mark Hahnenberg.
4368 Rolling back in after applying a simple fix: it appears that
4369 JSObject::setStructureAndReallocateStorageIfNecessary() was allocating more
4370 property storage than necessary. Fixing this appears to resolve the crash.
4372 This does a few things:
4374 - JSNonFinalObject no longer has inline property storage.
4376 - Initial out-of-line property storage size is 4 slots for JSNonFinalObject,
4377 or 2x the inline storage for JSFinalObject.
4379 - Property storage is only reallocated if it needs to be. Previously, we
4380 would reallocate the property storage on any transition where the original
4381 structure said shouldGrowProperyStorage(), but this led to spurious
4382 reallocations when doing transitionless property adds and there are
4383 deleted property slots available. That in turn led to crashes, because we
4384 would switch to out-of-line storage even if the capacity matched the
4385 criteria for inline storage.
4387 - Inline JSFunction allocation is killed off because we don't have a good
4388 way of inlining property storage allocation. This didn't hurt performance.
4389 Killing off code is better than fixing it if that code wasn't doing any
4392 This looks like a 1% progression on V8.
4394 * interpreter/Interpreter.cpp:
4395 (JSC::Interpreter::privateExecute):
4397 (JSC::JIT::privateCompileSlowCases):
4399 * jit/JITInlineMethods.h:
4400 (JSC::JIT::emitAllocateBasicJSObject):
4402 * jit/JITOpcodes.cpp:
4403 (JSC::JIT::emit_op_new_func):
4405 (JSC::JIT::emit_op_new_func_exp):
4406 * runtime/JSFunction.cpp:
4407 (JSC::JSFunction::finishCreation):
4408 * runtime/JSObject.h:
4409 (JSC::JSObject::isUsingInlineStorage):
4411 (JSC::JSObject::finishCreation):
4413 (JSC::JSNonFinalObject::hasInlineStorage):
4415 (JSC::JSNonFinalObject::JSNonFinalObject):
4416 (JSC::JSNonFinalObject::finishCreation):
4417 (JSC::JSFinalObject::hasInlineStorage):
4418 (JSC::JSFinalObject::finishCreation):
4419 (JSC::JSObject::offsetOfInlineStorage):
4420 (JSC::JSObject::setPropertyStorage):
4421 (JSC::Structure::inlineStorageCapacity):
4422 (JSC::Structure::isUsingInlineStorage):
4423 (JSC::JSObject::putDirectInternal):
4424 (JSC::JSObject::setStructureAndReallocateStorageIfNecessary):
4425 (JSC::JSObject::putDirectWithoutTransition):
4426 * runtime/Structure.cpp:
4427 (JSC::Structure::Structure):
4428 (JSC::nextPropertyStorageCapacity):
4430 (JSC::Structure::growPropertyStorageCapacity):
4431 (JSC::Structure::suggestedNewPropertyStorageSize):
4432 * runtime/Structure.h:
4433 (JSC::Structure::putWillGrowPropertyStorage):
4436 2012-06-29 Filip Pizlo <fpizlo@apple.com>
4438 Webkit crashes in DFG on Google Docs when creating a new document
4439 https://bugs.webkit.org/show_bug.cgi?id=90209
4441 Reviewed by Gavin Barraclough.
4443 Don't attempt to short-circuit Phantom(GetLocal) if the GetLocal is for a
4446 * dfg/DFGCFGSimplificationPhase.cpp:
4447 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
4449 2012-06-30 Zan Dobersek <zandobersek@gmail.com>
4451 Unreviewed, rolling out r121605.
4452 http://trac.webkit.org/changeset/121605
4453 https://bugs.webkit.org/show_bug.cgi?id=90336
4455 Changes caused flaky crashes in sputnik/Unicode tests on Apple
4456 WK1 and GTK Linux builders
4458 * interpreter/Interpreter.cpp:
4459 (JSC::Interpreter::privateExecute):
4461 (JSC::JIT::privateCompileSlowCases):
4463 * jit/JITInlineMethods.h:
4464 (JSC::JIT::emitAllocateBasicJSObject):
4465 (JSC::JIT::emitAllocateJSFinalObject):
4467 (JSC::JIT::emitAllocateJSFunction):
4468 * jit/JITOpcodes.cpp:
4469 (JSC::JIT::emit_op_new_func):
4470 (JSC::JIT::emitSlow_op_new_func):
4472 (JSC::JIT::emit_op_new_func_exp):
4473 (JSC::JIT::emitSlow_op_new_func_exp):
4474 * runtime/JSFunction.cpp:
4475 (JSC::JSFunction::finishCreation):
4476 * runtime/JSObject.h:
4477 (JSC::JSObject::isUsingInlineStorage):
4479 (JSC::JSObject::finishCreation):
4482 (JSC::JSNonFinalObject::JSNonFinalObject):
4483 (JSC::JSNonFinalObject::finishCreation):
4485 (JSC::JSFinalObject::finishCreation):
4486 (JSC::JSObject::offsetOfInlineStorage):
4487 (JSC::JSObject::setPropertyStorage):
4488 (JSC::Structure::isUsingInlineStorage):
4489 (JSC::JSObject::putDirectInternal):
4490 (JSC::JSObject::putDirectWithoutTransition):
4491 (JSC::JSObject::transitionTo):
4492 * runtime/Structure.cpp:
4493 (JSC::Structure::Structure):
4495 (JSC::Structure::growPropertyStorageCapacity):
4496 (JSC::Structure::suggestedNewPropertyStorageSize):
4497 * runtime/Structure.h:
4498 (JSC::Structure::shouldGrowPropertyStorage):
4499 (JSC::Structure::propertyStorageSize):
4501 2012-06-29 Mark Hahnenberg <mhahnenberg@apple.com>
4503 Remove warning about protected values when the Heap is being destroyed
4504 https://bugs.webkit.org/show_bug.cgi?id=90302
4506 Reviewed by Geoffrey Garen.
4508 Having to do book-keeping about whether values allocated from a certain
4509 VM are or are not protected makes the JSC API much more difficult to use
4510 correctly. Clients should be able to throw an entire VM away and not have
4511 to worry about unprotecting all of the values that they protected earlier.
4514 (JSC::Heap::lastChanceToFinalize):
4516 2012-06-29 Filip Pizlo <fpizlo@apple.com>
4518 JSObject wastes too much memory on unused property slots
4519 https://bugs.webkit.org/show_bug.cgi?id=90255
4521 Reviewed by Mark Hahnenberg.
4523 This does a few things:
4525 - JSNonFinalObject no longer has inline property storage.
4527 - Initial out-of-line property storage size is 4 slots for JSNonFinalObject,
4528 or 2x the inline storage for JSFinalObject.
4530 - Property storage is only reallocated if it needs to be. Previously, we
4531 would reallocate the property storage on any transition where the original
4532 structure said shouldGrowProperyStorage(), but this led to spurious
4533 reallocations when doing transitionless property adds and there are
4534 deleted property slots available. That in turn led to crashes, because we
4535 would switch to out-of-line storage even if the capacity matched the
4536 criteria for inline storage.
4538 - Inline JSFunction allocation is killed off because we don't have a good
4539 way of inlining property storage allocation. This didn't hurt performance.
4540 Killing off code is better than fixing it if that code wasn't doing any
4543 This looks like a 1% progression on V8.
4545 * interpreter/Interpreter.cpp:
4546 (JSC::Interpreter::privateExecute):
4548 (JSC::JIT::privateCompileSlowCases):
4550 * jit/JITInlineMethods.h:
4551 (JSC::JIT::emitAllocateBasicJSObject):
4553 * jit/JITOpcodes.cpp:
4554 (JSC::JIT::emit_op_new_func):
4556 (JSC::JIT::emit_op_new_func_exp):
4557 * runtime/JSFunction.cpp:
4558 (JSC::JSFunction::finishCreation):
4559 * runtime/JSObject.h:
4560 (JSC::JSObject::isUsingInlineStorage):
4562 (JSC::JSObject::finishCreation):
4564 (JSC::JSNonFinalObject::hasInlineStorage):
4566 (JSC::JSNonFinalObject::JSNonFinalObject):
4567 (JSC::JSNonFinalObject::finishCreation):
4568 (JSC::JSFinalObject::hasInlineStorage):
4569 (JSC::JSFinalObject::finishCreation):
4570 (JSC::JSObject::offsetOfInlineStorage):
4571 (JSC::JSObject::setPropertyStorage):
4572 (JSC::Structure::inlineStorageCapacity):
4573 (JSC::Structure::isUsingInlineStorage):
4574 (JSC::JSObject::putDirectInternal):
4575 (JSC::JSObject::setStructureAndReallocateStorageIfNecessary):
4576 (JSC::JSObject::putDirectWithoutTransition):
4577 * runtime/Structure.cpp:
4578 (JSC::Structure::Structure):
4579 (JSC::nextPropertyStorageCapacity):
4581 (JSC::Structure::growPropertyStorageCapacity):
4582 (JSC::Structure::suggestedNewPropertyStorageSize):
4583 * runtime/Structure.h:
4584 (JSC::Structure::putWillGrowPropertyStorage):
4587 2012-06-28 Filip Pizlo <fpizlo@apple.com>
4589 DFG recompilation heuristics should be based on count, not rate
4590 https://bugs.webkit.org/show_bug.cgi?id=90146
4592 Reviewed by Oliver Hunt.
4594 This removes a bunch of code that was previously trying to prevent spurious
4595 reoptimizations if a large enough majority of executions of a code block did
4596 not result in OSR exit. It turns out that this code was purely harmful. This
4597 patch removes all of that logic and replaces it with a dead-simple
4598 heuristic: if you exit more than N times (where N is an exponential function
4599 of the number of times the code block has already been recompiled) then we
4602 This appears to be a broad ~1% win on many benchmarks large and small.
4604 * bytecode/CodeBlock.cpp:
4605 (JSC::CodeBlock::CodeBlock):
4606 * bytecode/CodeBlock.h:
4607 (JSC::CodeBlock::osrExitCounter):
4608 (JSC::CodeBlock::countOSRExit):
4610 (JSC::CodeBlock::addressOfOSRExitCounter):
4611 (JSC::CodeBlock::offsetOfOSRExitCounter):
4612 (JSC::CodeBlock::adjustedExitCountThreshold):
4613 (JSC::CodeBlock::exitCountThresholdForReoptimization):
4614 (JSC::CodeBlock::exitCountThresholdForReoptimizationFromLoop):
4615 (JSC::CodeBlock::shouldReoptimizeNow):
4616 (JSC::CodeBlock::shouldReoptimizeFromLoopNow):
4617 * bytecode/ExecutionCounter.cpp:
4618 (JSC::ExecutionCounter::setThreshold):
4619 * bytecode/ExecutionCounter.h:
4621 (JSC::ExecutionCounter::clippedThreshold):
4622 * dfg/DFGJITCompiler.cpp:
4623 (JSC::DFG::JITCompiler::compileBody):
4624 * dfg/DFGOSRExit.cpp:
4625 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
4626 * dfg/DFGOSRExitCompiler.cpp:
4627 (JSC::DFG::OSRExitCompiler::handleExitCounts):
4628 * dfg/DFGOperations.cpp:
4630 (JSC::DEFINE_STUB_FUNCTION):
4631 * runtime/Options.cpp:
4633 (JSC::Options::initializeOptions):
4634 * runtime/Options.h:
4637 2012-06-28 Mark Lam <mark.lam@apple.com>
4639 Adding a commenting utility to record BytecodeGenerator comments
4640 with opcodes that are emitted. Presently, the comments can only
4641 be constant strings. Adding comments for opcodes is optional.
4642 If a comment is added, the comment will be printed following the
4643 opcode when CodeBlock::dump() is called.
4645 This utility is disabled by default, and is only meant for VM
4646 development purposes. It should not be enabled for product builds.
4648 To enable this utility, set ENABLE_BYTECODE_COMMENTS in CodeBlock.h
4651 https://bugs.webkit.org/show_bug.cgi?id=90095
4653 Reviewed by Geoffrey Garen.
4655 * GNUmakefile.list.am:
4656 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4657 * JavaScriptCore.xcodeproj/project.pbxproj:
4658 * bytecode/CodeBlock.cpp:
4659 (JSC::CodeBlock::dumpBytecodeCommentAndNewLine): Dumps the comment.
4661 (JSC::CodeBlock::printUnaryOp): Add comment dumps.
4662 (JSC::CodeBlock::printBinaryOp): Add comment dumps.
4663 (JSC::CodeBlock::printConditionalJump): Add comment dumps.
4664 (JSC::CodeBlock::printCallOp): Add comment dumps.
4665 (JSC::CodeBlock::printPutByIdOp): Add comment dumps.
4666 (JSC::CodeBlock::dump): Add comment dumps.
4667 (JSC::CodeBlock::CodeBlock):
4668 (JSC::CodeBlock::commentForBytecodeOffset):
4669 Finds the comment for an opcode if available.
4670 (JSC::CodeBlock::dumpBytecodeComments):
4671 For debugging whether comments are collected.
4672 It is not being called anywhere.
4673 * bytecode/CodeBlock.h:
4675 (JSC::CodeBlock::bytecodeComments):
4676 * bytecode/Comment.h: Added.
4679 * bytecompiler/BytecodeGenerator.cpp:
4680 (JSC::BytecodeGenerator::BytecodeGenerator):
4681 (JSC::BytecodeGenerator::emitOpcode): Calls emitComment().
4683 (JSC::BytecodeGenerator::emitComment): Adds comment to CodeBlock.
4684 (JSC::BytecodeGenerator::prependComment):
4685 Registers a comment for emitComemnt() to use later.
4686 * bytecompiler/BytecodeGenerator.h:
4687 (BytecodeGenerator):
4688 (JSC::BytecodeGenerator::emitComment):
4689 (JSC::BytecodeGenerator::prependComment):
4690 These are inlined versions of these functions that nullify them
4691 when ENABLE_BYTECODE_COMMENTS is 0.
4692 (JSC::BytecodeGenerator::comments):
4694 2012-06-28 Oliver Hunt <oliver@apple.com>
4696 32bit DFG incorrectly claims an fpr is fillable even if it has not been proven double
4697 https://bugs.webkit.org/show_bug.cgi?id=90127
4699 Reviewed by Filip Pizlo.
4701 The 32-bit version of fillSpeculateDouble doesn't handle Number->fpr loads
4702 correctly. This patch fixes this by killing the fill info in the GenerationInfo
4703 when the spillFormat doesn't guarantee the value is a double.
4705 * dfg/DFGSpeculativeJIT32_64.cpp:
4706 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
4708 2012-06-28 Kent Tamura <tkent@chromium.org>
4710 Classify form control states by their owner forms
4711 https://bugs.webkit.org/show_bug.cgi?id=89950
4713 Reviewed by Hajime Morita.
4715 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
4716 Expose WTF::StringBuilder::canShrink()
4718 2012-06-27 Michael Saboff <msaboff@apple.com>
4720 [Win] jscore-tests flakey
4721 https://bugs.webkit.org/show_bug.cgi?id=88118
4723 Reviewed by Jessie Berlin.
4725 jsDriver.pl on windows intermittently doesn't get the returned value from jsc,
4726 instead it gets 126. Added a new option to jsc (-x) which prints the exit
4727 code before exiting. jsDriver.pl uses this option on Windows and parses the
4728 exit code output for the exit code, removing it before comparing the actual
4729 and expected outputs. Filed a follow on "FIXME" defect:
4730 [WIN] Intermittent failure for jsc return value to propagate through jsDriver.pl
4731 https://bugs.webkit.org/show_bug.cgi?id=90119
4734 (CommandLine::CommandLine):
4736 (printUsageStatement):
4739 * tests/mozilla/jsDriver.pl:
4742 2012-06-27 Sheriff Bot <webkit.review.bot@gmail.com>
4744 Unreviewed, rolling out r121359.
4745 http://trac.webkit.org/changeset/121359
4746 https://bugs.webkit.org/show_bug.cgi?id=90115
4748 Broke many inspector tests (Requested by jpfau on #webkit).
4750 * interpreter/Interpreter.h:
4751 (JSC::StackFrame::toString):
4753 2012-06-27 Filip Pizlo <fpizlo@apple.com>
4755 Javascript SHA-512 gives wrong hash on second and subsequent runs unless Web Inspector Javascript Debugging is on
4756 https://bugs.webkit.org/show_bug.cgi?id=90053
4757 <rdar://problem/11764613>
4759 Reviewed by Mark Hahnenberg.
4761 The problem is that the code was assuming that the recovery should be Undefined if the source of
4762 the SetLocal was !shouldGenerate(). But that's wrong, since the DFG optimizer may skip around a
4763 UInt32ToNumber node (hence making it !shouldGenerate()) and keep the source of that node alive.
4764 In that case we should base the recovery on the source of the UInt32ToNumber. The logic for this
4765 was already in place but the fast check for !shouldGenerate() broke it.
4767 * dfg/DFGSpeculativeJIT.cpp:
4768 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
4770 2012-06-27 Filip Pizlo <fpizlo@apple.com>
4772 DFG disassembly should be easier to read
4773 https://bugs.webkit.org/show_bug.cgi?id=90106
4775 Reviewed by Mark Hahnenberg.
4779 - Options::showDFGDisassembly now shows OSR exit disassembly as well.
4781 - Phi node dumping doesn't attempt to do line wrapping since it just made the dump harder
4784 - DFG graph disassembly view shows a few additional node types that turn out to be
4785 essential for understanding OSR exits.
4787 Put together, these changes reinforce the philosophy that anything needed for computing
4788 OSR exit is just as important as the machine code itself. Of course, we still don't take
4789 that philosophy to its full extreme - for example Phantom nodes are not dumped. We may
4790 revisit that in the future.
4792 * assembler/LinkBuffer.cpp:
4793 (JSC::LinkBuffer::finalizeCodeWithDisassembly):
4794 * assembler/LinkBuffer.h:
4796 * dfg/DFGDisassembler.cpp:
4797 (JSC::DFG::Disassembler::dump):
4799 (JSC::DFG::Graph::dumpBlockHeader):
4801 (JSC::DFG::Node::willHaveCodeGenOrOSR):
4802 * dfg/DFGOSRExitCompiler.cpp:
4804 (JSC::JIT::privateCompile):
4806 2012-06-25 Mark Hahnenberg <mhahnenberg@apple.com>
4808 JSLock should be per-JSGlobalData
4809 https://bugs.webkit.org/show_bug.cgi?id=89123
4811 Reviewed by Geoffrey Garen.
4814 (APIEntryShimWithoutLock):
4815 (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): Added an extra parameter to the constructor to
4816 determine whether we should ref the JSGlobalData or not. We want to ref all the time except for in the
4817 HeapTimer class because timerDidFire could run after somebody has started to tear down that particular
4818 JSGlobalData, so we wouldn't want to resurrect the ref count of that JSGlobalData from 0 back to 1 after
4819 its destruction has begun.
4820 (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
4821 (JSC::APIEntryShim::APIEntryShim):
4823 (JSC::APIEntryShim::~APIEntryShim):
4824 (JSC::APIEntryShim::init): Factored out common initialization code for the various APIEntryShim constructors.
4825 Also moved the timeoutChecker stop and start here because we need to start after we've grabbed the API lock
4826 and before we've released it, which can only done in APIEntryShim.
4827 (JSC::APICallbackShim::~APICallbackShim): We no longer need to synchronize here.
4828 * API/JSContextRef.cpp:
4829 (JSGlobalContextCreate):
4830 (JSGlobalContextCreateInGroup):
4831 (JSGlobalContextRelease):
4832 (JSContextCreateBacktrace):
4833 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
4834 * heap/CopiedSpace.cpp:
4835 (JSC::CopiedSpace::tryAllocateSlowCase):
4837 (JSC::Heap::protect):
4838 (JSC::Heap::unprotect):
4839 (JSC::Heap::collect):
4840 (JSC::Heap::setActivityCallback):
4841 (JSC::Heap::activityCallback):
4842 (JSC::Heap::sweeper):
4843 * heap/Heap.h: Changed m_activityCallback and m_sweeper to be raw pointers rather than OwnPtrs because they
4844 are now responsible for their own lifetime. Also changed the order of declaration of the GCActivityCallback
4845 and the IncrementalSweeper to make sure they're the last things that get initialized during construction to
4846 prevent any issues with uninitialized memory in the JSGlobalData/Heap they might care about.
4848 * heap/HeapTimer.cpp: Refactored to allow for thread-safe operation and shutdown.
4849 (JSC::HeapTimer::~HeapTimer):
4850 (JSC::HeapTimer::invalidate):
4852 (JSC::HeapTimer::didStartVMShutdown): Called at the beginning of ~JSGlobalData. If we're on the same thread
4853 that the HeapTimer is running on, we kill the HeapTimer ourselves. If not, then we set some state in the
4854 HeapTimer and schedule it to fire immediately so that it can notice and kill itself.
4855 (JSC::HeapTimer::timerDidFire): We grab our mutex and check our JSGlobalData pointer. If it has been zero-ed
4856 out, then we know the VM has started to shutdown and we should kill ourselves. Otherwise, grab the APIEntryShim,
4857 but without ref-ing the JSGlobalData (we don't want to bring the JSGlobalData's ref-count from 0 to 1) in case
4858 we were interrupted between releasing our mutex and trying to grab the APILock.
4861 * heap/IncrementalSweeper.cpp:
4862 (JSC::IncrementalSweeper::doWork): We no longer need the API shim here since HeapTimer::timerDidFire handles
4864 (JSC::IncrementalSweeper::create):
4865 * heap/IncrementalSweeper.h:
4866 (IncrementalSweeper):
4867 * heap/MarkedAllocator.cpp:
4868 (JSC::MarkedAllocator::allocateSlowCase):
4869 * heap/WeakBlock.cpp:
4870 (JSC::WeakBlock::reap):
4873 (functionReleaseExecutableMemory):
4875 * runtime/Completion.cpp:
4878 * runtime/GCActivityCallback.h:
4879 (DefaultGCActivityCallback):
4880 (JSC::DefaultGCActivityCallback::create):
4881 * runtime/JSGlobalData.cpp:
4882 (JSC::JSGlobalData::JSGlobalData):
4883 (JSC::JSGlobalData::~JSGlobalData): Signals to the two HeapTimers (GCActivityCallback and IncrementalSweeper)
4884 that the VM has started shutting down. It then waits until the HeapTimer is done with whatever activity
4885 it needs to do before continuing with any further destruction. Also asserts that we do not currently hold the
4886 APILock because this could potentially cause deadlock when we try to signal to the HeapTimers using their mutexes.
4887 (JSC::JSGlobalData::sharedInstance): Protect the initialization for the shared instance with the GlobalJSLock.
4888 (JSC::JSGlobalData::sharedInstanceInternal):
4889 * runtime/JSGlobalData.h: Change to be ThreadSafeRefCounted so that we don't have to worry about refing and
4890 de-refing JSGlobalDatas on separate threads since we don't do it that often anyways.
4892 (JSC::JSGlobalData::apiLock):
4893 * runtime/JSGlobalObject.cpp:
4894 (JSC::JSGlobalObject::~JSGlobalObject):
4895 (JSC::JSGlobalObject::init):
4896 * runtime/JSLock.cpp:
4898 (JSC::GlobalJSLock::GlobalJSLock): For accessing the shared instance.
4899 (JSC::GlobalJSLock::~GlobalJSLock):
4900 (JSC::JSLockHolder::JSLockHolder): MutexLocker for JSLock. Also refs the JSGlobalData to keep it alive so that
4901 it can successfully unlock it later without it disappearing from underneath it.
4902 (JSC::JSLockHolder::~JSLockHolder):
4903 (JSC::JSLock::JSLock):
4904 (JSC::JSLock::~JSLock):
4905 (JSC::JSLock::lock): Uses the spin lock for guarding the lock count and owner thread fields. Uses the mutex for
4906 actually waiting for long periods.
4907 (JSC::JSLock::unlock):
4908 (JSC::JSLock::currentThreadIsHoldingLock):
4909 (JSC::JSLock::dropAllLocks):
4910 (JSC::JSLock::dropAllLocksUnconditionally):
4911 (JSC::JSLock::grabAllLocks):
4912 (JSC::JSLock::DropAllLocks::DropAllLocks):
4913 (JSC::JSLock::DropAllLocks::~DropAllLocks):
4920 * runtime/WeakGCMap.h:
4921 (JSC::WeakGCMap::set):
4925 2012-06-27 Filip Pizlo <fpizlo@apple.com>
4927 x86 disassembler confuses immediates with addresses
4928 https://bugs.webkit.org/show_bug.cgi?id=90099
4930 Reviewed by Mark Hahnenberg.
4932 Prepend "$" to immediates to disambiguate between immediates and addresses. This is in
4933 accordance with the gas and AT&T syntax.
4935 * disassembler/udis86/udis86_syn-att.c:
4938 2012-06-27 Filip Pizlo <fpizlo@apple.com>
4940 Add a comment clarifying Options::showDisassembly versus Options::showDFGDisassembly.
4942 Rubber stamped by Mark Hahnenberg.
4944 * runtime/Options.cpp:
4945 (JSC::Options::initializeOptions):
4947 2012-06-27 Anthony Scian <ascian@rim.com>
4949 Web Inspector [JSC]: Implement ScriptCallStack::stackTrace
4950 https://bugs.webkit.org/show_bug.cgi?id=40118
4952 Reviewed by Yong Li.
4954 Added member functions to expose function name, urlString, and line #.
4955 Refactored toString to make use of these member functions to reduce
4956 duplicated code for future maintenance.
4958 Manually tested refactoring of toString by tracing thrown exceptions.
4960 * interpreter/Interpreter.h:
4962 (JSC::StackFrame::toString):
4963 (JSC::StackFrame::friendlySourceURL):
4964 (JSC::StackFrame::friendlyFunctionName):
4965 (JSC::StackFrame::friendlyLineNumber):
4967 2012-06-27 Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
4969 [Qt] Remove redundant c++11 warning suppression code
4971 This is already handled in default_post.
4973 Reviewed by Tor Arne Vestbø.
4977 2012-06-26 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
4979 [Qt] Add missing heades to HEADERS
4981 For JavaScriptCore there aren't any Qt specific files, so we include all
4982 headers for easy editing in Qt Creator.
4984 Reviewed by Simon Hausmann.
4988 2012-06-26 Dominic Cooney <dominicc@chromium.org>
4990 [Chromium] Remove unused build scripts and empty folders for JavaScriptCore w/ gyp
4991 https://bugs.webkit.org/show_bug.cgi?id=90029
4993 Reviewed by Adam Barth.
4996 * gyp/generate-derived-sources.sh: Removed.
4997 * gyp/generate-dtrace-header.sh: Removed.
4998 * gyp/run-if-exists.sh: Removed.
4999 * gyp/update-info-plist.sh: Removed.
5001 2012-06-26 Geoffrey Garen <ggaren@apple.com>
5003 Reduced (but did not eliminate) use of "berzerker GC"
5004 https://bugs.webkit.org/show_bug.cgi?id=89237
5006 Reviewed by Gavin Barraclough.
5010 This part turns off "berzerker GC" and turns on incremental shrinking.
5012 * heap/IncrementalSweeper.cpp:
5013 (JSC::IncrementalSweeper::doSweep): Free or shrink after sweeping to
5014 maintain the behavior we used to get from the occasional berzerker GC,
5015 which would run all finalizers and then free or shrink all blocks
5018 * heap/MarkedBlock.h:
5019 (JSC::MarkedBlock::needsSweeping): Sweep zapped blocks, too. It's always
5020 safe to sweep a zapped block (that's the point of zapping), and it's
5021 sometimes profitable. For example, consider this case: Block A does some
5022 allocation (transitioning Block A from Marked to FreeListed), then GC
5023 happens (transitioning Block A to Zapped), then all objects in Block A
5024 are free, then the incremental sweeper visits Block A. If we skipped
5025 Zapped blocks, we'd skip Block A, even though it would be profitable to
5026 run its destructors and free its memory.
5028 * runtime/GCActivityCallback.cpp:
5029 (JSC::DefaultGCActivityCallback::doWork): Don't sweep eagerly; we'll do
5032 2012-06-26 Filip Pizlo <fpizlo@apple.com>
5034 DFG PutByValAlias is too aggressive
5035 https://bugs.webkit.org/show_bug.cgi?id=90026
5036 <rdar://problem/11751830>
5038 Reviewed by Gavin Barraclough.
5040 For CSE on normal arrays, we now treat PutByVal as impure. This does not appear to affect
5041 performance by much.
5043 For CSE on typed arrays, we fix PutByValAlias by making GetByVal speculate that the access
5044 is within bounds. This also has the effect of making our out-of-bounds handling consistent
5047 * dfg/DFGCSEPhase.cpp:
5048 (JSC::DFG::CSEPhase::performNodeCSE):
5050 (JSC::DFG::Graph::byValIsPure):
5051 (JSC::DFG::Graph::clobbersWorld):
5052 * dfg/DFGNodeType.h:
5054 * dfg/DFGSpeculativeJIT.cpp:
5055 (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
5056 (JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
5058 2012-06-26 Yong Li <yoli@rim.com>
5060 [BlackBerry] Add JSC statistics into about:memory
5061 https://bugs.webkit.org/show_bug.cgi?id=89779
5063 Reviewed by Rob Buis.
5065 Fix non-JIT build on BlackBerry broken by r121196.
5067 * runtime/MemoryStatistics.cpp:
5068 (JSC::globalMemoryStatistics):
5070 2012-06-25 Filip Pizlo <fpizlo@apple.com>
5072 DFG::operationNewArray is unnecessarily slow, and may use the wrong array
5073 prototype when inlined
5074 https://bugs.webkit.org/show_bug.cgi?id=89821
5076 Reviewed by Geoffrey Garen.
5078 Fixes all array allocations to use the right structure, and hence the right prototype. Adds
5079 inlining of new Array(...) with a non-zero number of arguments. Optimizes allocations of
5082 * dfg/DFGAbstractState.cpp:
5083 (JSC::DFG::AbstractState::execute):
5084 * dfg/DFGByteCodeParser.cpp:
5085 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
5086 * dfg/DFGCCallHelpers.h:
5087 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
5089 * dfg/DFGNodeType.h:
5091 * dfg/DFGOperations.cpp:
5092 * dfg/DFGOperations.h:
5093 * dfg/DFGPredictionPropagationPhase.cpp:
5094 (JSC::DFG::PredictionPropagationPhase::propagate):
5095 * dfg/DFGSpeculativeJIT.h:
5096 (JSC::DFG::SpeculativeJIT::callOperation):
5097 * dfg/DFGSpeculativeJIT32_64.cpp:
5098 (JSC::DFG::SpeculativeJIT::compile):
5099 * dfg/DFGSpeculativeJIT64.cpp:
5100 (JSC::DFG::SpeculativeJIT::compile):
5101 * runtime/JSArray.h:
5103 (JSC::constructArray):
5104 * runtime/JSGlobalObject.h:
5106 (JSC::constructArray):
5108 2012-06-26 Filip Pizlo <fpizlo@apple.com>
5110 New fast/js/dfg-store-unexpected-value-into-argument-and-osr-exit.html fails on 32 bit
5111 https://bugs.webkit.org/show_bug.cgi?id=89953
5113 Reviewed by Zoltan Herczeg.
5115 DFG 32-bit JIT was confused about the difference between a predicted type and a
5116 proven type. This is easy to get confused about, since a local that is predicted int32
5117 almost always means that the local must be an int32 since speculations are hoisted to
5118 stores to locals. But that is less likely to be the case for arguments, where there is
5119 an additional least-upper-bounding step: any store to an argument with a weird type
5120 may force the argument to be any type.
5122 This patch basically duplicates the functionality in DFGSpeculativeJIT64.cpp for
5123 GetLocal: the decision of whether to load a local as an int32 (or as an array, or as
5124 a boolean) is made based on the AbstractValue::m_type, which is a type proof, rather
5125 than the VariableAccessData::prediction(), which is a predicted type.
5127 * dfg/DFGSpeculativeJIT32_64.cpp:
5128 (JSC::DFG::SpeculativeJIT::compile):
5130 2012-06-25 Filip Pizlo <fpizlo@apple.com>
5132 JSC should try to make profiling deterministic because otherwise reproducing failures is
5134 https://bugs.webkit.org/show_bug.cgi?id=89940
5136 Rubber stamped by Gavin Barraclough.
5138 This rolls out the part of http://trac.webkit.org/changeset/121215 that introduced randomness
5139 into the system. Now, instead of randomizing the tier-up threshold, we always set it to an
5140 artificially low (and statically predetermined!) value. This gives most of the benefit of
5141 threshold randomization without actually making the system behave completely differently on
5144 * bytecode/ExecutionCounter.cpp:
5145 (JSC::ExecutionCounter::setThreshold):
5146 * runtime/Options.cpp:
5148 (JSC::Options::initializeOptions):
5149 * runtime/Options.h:
5152 2012-06-22 Filip Pizlo <fpizlo@apple.com>
5154 Value profiling should use tier-up threshold randomization to get more coverage
5155 https://bugs.webkit.org/show_bug.cgi?id=89802
5157 Reviewed by Gavin Barraclough.
5159 This patch causes both LLInt and Baseline JIT code to take the OSR slow path several
5160 times before actually doing OSR. If we take the OSR slow path before the execution
5161 count threshold is reached, then we just call CodeBlock::updateAllPredictions() to
5162 compute the current latest least-upper-bound SpecType of all values seen in each
5165 * bytecode/CodeBlock.cpp:
5166 (JSC::CodeBlock::stronglyVisitStrongReferences):
5167 (JSC::CodeBlock::updateAllPredictionsAndCountLiveness):
5169 (JSC::CodeBlock::updateAllPredictions):
5170 (JSC::CodeBlock::shouldOptimizeNow):
5171 * bytecode/CodeBlock.h:
5172 (JSC::CodeBlock::llintExecuteCounter):
5173 (JSC::CodeBlock::jitExecuteCounter):
5175 (JSC::CodeBlock::updateAllPredictions):
5176 * bytecode/ExecutionCounter.cpp:
5177 (JSC::ExecutionCounter::setThreshold):
5178 (JSC::ExecutionCounter::status):
5180 * bytecode/ExecutionCounter.h:
5181 (JSC::ExecutionCounter::count):
5183 * dfg/DFGAbstractState.cpp:
5184 (JSC::DFG::AbstractState::execute):
5185 * dfg/DFGOperations.cpp:
5186 * dfg/DFGSpeculativeJIT.cpp:
5187 (JSC::DFG::SpeculativeJIT::compile):
5189 (JSC::DEFINE_STUB_FUNCTION):
5190 * llint/LLIntSlowPaths.cpp:
5191 (JSC::LLInt::jitCompileAndSetHeuristics):
5192 (JSC::LLInt::entryOSR):
5193 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
5194 * runtime/JSGlobalObject.cpp:
5195 (JSC::JSGlobalObject::JSGlobalObject):
5197 * runtime/JSGlobalObject.h:
5199 (JSC::JSGlobalObject::weakRandomInteger):
5200 * runtime/Options.cpp:
5202 (JSC::Options::initializeOptions):
5203 * runtime/Options.h:
5205 * runtime/WeakRandom.h:
5207 (JSC::WeakRandom::seedUnsafe):
5209 2012-06-25 Yong Li <yoli@rim.com>
5211 [BlackBerry] Add JSC statistics into about:memory
5212 https://bugs.webkit.org/show_bug.cgi?id=89779
5214 Reviewed by Rob Buis.
5216 Add MemoryStatistics.cpp into build, and fill JITBytes for BlackBerry port.
5218 * PlatformBlackBerry.cmake:
5219 * runtime/MemoryStatistics.cpp:
5220 (JSC::globalMemoryStatistics):
5222 2012-06-23 Sheriff Bot <webkit.review.bot@gmail.com>
5224 Unreviewed, rolling out r121058.
5225 http://trac.webkit.org/changeset/121058
5226 https://bugs.webkit.org/show_bug.cgi?id=89809
5228 Patch causes plugins tests to crash in GTK debug builds
5229 (Requested by zdobersek on #webkit).
5232 (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
5233 (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
5234 (APIEntryShimWithoutLock):
5235 (JSC::APIEntryShim::APIEntryShim):
5237 (JSC::APICallbackShim::~APICallbackShim):
5238 * API/JSContextRef.cpp:
5239 (JSGlobalContextCreate):
5240 (JSGlobalContextCreateInGroup):
5241 (JSGlobalContextRelease):
5242 (JSContextCreateBacktrace):
5243 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
5244 * heap/CopiedSpace.cpp:
5245 (JSC::CopiedSpace::tryAllocateSlowCase):
5247 (JSC::Heap::protect):
5248 (JSC::Heap::unprotect):
5249 (JSC::Heap::collect):
5250 (JSC::Heap::setActivityCallback):
5251 (JSC::Heap::activityCallback):
5252 (JSC::Heap::sweeper):
5255 * heap/HeapTimer.cpp:
5256 (JSC::HeapTimer::~HeapTimer):
5257 (JSC::HeapTimer::invalidate):
5258 (JSC::HeapTimer::timerDidFire):
5262 * heap/IncrementalSweeper.cpp:
5263 (JSC::IncrementalSweeper::doWork):
5264 (JSC::IncrementalSweeper::create):
5265 * heap/IncrementalSweeper.h:
5266 (IncrementalSweeper):
5267 * heap/MarkedAllocator.cpp:
5268 (JSC::MarkedAllocator::allocateSlowCase):
5269 * heap/WeakBlock.cpp:
5270 (JSC::WeakBlock::reap):
5273 (functionReleaseExecutableMemory):
5275 * runtime/Completion.cpp:
5278 * runtime/GCActivityCallback.h:
5279 (DefaultGCActivityCallback):
5280 (JSC::DefaultGCActivityCallback::create):
5281 * runtime/JSGlobalData.cpp:
5282 (JSC::JSGlobalData::JSGlobalData):
5283 (JSC::JSGlobalData::~JSGlobalData):
5284 (JSC::JSGlobalData::sharedInstance):
5285 (JSC::JSGlobalData::sharedInstanceInternal):
5286 * runtime/JSGlobalData.h:
5288 * runtime/JSGlobalObject.cpp:
5289 (JSC::JSGlobalObject::~JSGlobalObject):
5290 (JSC::JSGlobalObject::init):
5291 * runtime/JSLock.cpp:
5293 (JSC::createJSLockCount):
5294 (JSC::JSLock::lockCount):
5295 (JSC::setLockCount):
5296 (JSC::JSLock::JSLock):
5297 (JSC::JSLock::lock):
5298 (JSC::JSLock::unlock):
5299 (JSC::JSLock::currentThreadIsHoldingLock):
5300 (JSC::JSLock::DropAllLocks::DropAllLocks):
5301 (JSC::JSLock::DropAllLocks::~DropAllLocks):
5305 (JSC::JSLock::JSLock):
5306 (JSC::JSLock::~JSLock):
5308 * runtime/WeakGCMap.h:
5309 (JSC::WeakGCMap::set):
5313 2012-06-22 Alexandru Chiculita <achicu@adobe.com>
5315 [CSS Shaders] Re-enable the CSS Shaders compile time flag on Safari Mac
5316 https://bugs.webkit.org/show_bug.cgi?id=89781
5318 Reviewed by Dean Jackson.
5320 Added ENABLE_CSS_SHADERS flag as enabled by default on Safari for Mac.
5322 * Configurations/FeatureDefines.xcconfig:
5324 2012-06-22 Filip Pizlo <fpizlo@apple.com>
5326 DFG tier-up should happen in prologues, not epilogues
5327 https://bugs.webkit.org/show_bug.cgi?id=89752
5329 Reviewed by Geoffrey Garen.
5331 This change has two outcomes:
5333 1) Slightly reduces the likelihood that a function will be optimized both
5334 standalone and via inlining. Previously, if you had a call sequence like foo()
5335 calls bar() exactly once, and nobody else calls bar(), then bar() would get
5336 optimized first (because it returns first) and then foo() gets optimized. If foo()
5337 can inline bar() then that means that bar() gets optimized twice. But now, if we
5338 optimize in prologues, then foo() will be optimized first. If it inlines bar(),
5339 that means that there will no longer be any calls to bar().
5341 2) It lets us kill some code in JITStubs. Epilogue tier-up was very different from
5342 loop tier-up, since epilogue tier-up should not attempt OSR. But prologue tier-up
5343 requires OSR (albeit really easy OSR since it's the top of the compilation unit),
5344 so it becomes just like loop tier-up. As a result, we now have one optimization
5345 hook (cti_optimize) instead of two (cti_optimize_from_loop and
5346 cti_optimize_from_ret).
5348 As a consequence of not having an optimization check in epilogues, the OSR exit
5349 code must now trigger reoptimization itself instead of just signaling the epilogue
5352 This also adds the ability to count the number of DFG compilations, which was
5353 useful for debugging this patch and might be useful for other things in the future.
5355 * bytecode/CodeBlock.cpp:
5356 (JSC::CodeBlock::reoptimize):
5358 * bytecode/CodeBlock.h:
5360 * dfg/DFGByteCodeParser.cpp:
5361 (JSC::DFG::ByteCodeParser::parseCodeBlock):
5362 * dfg/DFGDriver.cpp:
5364 (JSC::DFG::getNumCompilations):
5365 (JSC::DFG::compile):
5368 * dfg/DFGOSRExitCompiler.cpp:
5369 (JSC::DFG::OSRExitCompiler::handleExitCounts):
5370 * dfg/DFGOperations.cpp:
5371 * dfg/DFGOperations.h:
5373 (JSC::JIT::emitOptimizationCheck):
5375 * jit/JITCall32_64.cpp:
5376 (JSC::JIT::emit_op_ret):
5377 (JSC::JIT::emit_op_ret_object_or_this):
5378 * jit/JITOpcodes.cpp:
5379 (JSC::JIT::emit_op_ret):
5380 (JSC::JIT::emit_op_ret_object_or_this):
5381 (JSC::JIT::emit_op_enter):
5382 * jit/JITOpcodes32_64.cpp:
5383 (JSC::JIT::emit_op_enter):
5385 (JSC::DEFINE_STUB_FUNCTION):
5388 2012-06-20 Mark Hahnenberg <mhahnenberg@apple.com>
5390 JSLock should be per-JSGlobalData
5391 https://bugs.webkit.org/show_bug.cgi?id=89123
5393 Reviewed by Gavin Barraclough.
5395 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
5397 (APIEntryShimWithoutLock):
5398 (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): Added an extra parameter to the constructor to
5399 determine whether we should ref the JSGlobalData or not. We want to ref all the time except for in the
5400 HeapTimer class because timerDidFire could run after somebody has started to tear down that particular
5401 JSGlobalData, so we wouldn't want to resurrect the ref count of that JSGlobalData from 0 back to 1 after
5402 its destruction has begun.
5403 (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock): Now derefs if it also refed.
5404 (JSC::APIEntryShim::APIEntryShim):
5406 (JSC::APIEntryShim::~APIEntryShim):
5407 (JSC::APIEntryShim::init): Factored out common initialization code for the various APIEntryShim constructors.
5408 Also moved the timeoutChecker stop and start here because we need to start after we've grabbed the API lock
5409 and before we've released it, which can only done in APIEntryShim.
5410 (JSC::APICallbackShim::~APICallbackShim): We no longer need to synchronize here.
5411 * API/JSContextRef.cpp:
5412 (JSGlobalContextCreate):
5413 (JSGlobalContextCreateInGroup):
5414 (JSGlobalContextRelease):
5415 (JSContextCreateBacktrace):
5416 * heap/CopiedSpace.cpp:
5417 (JSC::CopiedSpace::tryAllocateSlowCase):
5419 (JSC::Heap::protect):
5420 (JSC::Heap::unprotect):
5421 (JSC::Heap::collect):
5422 (JSC::Heap::setActivityCallback):
5423 (JSC::Heap::activityCallback):
5424 (JSC::Heap::sweeper):
5425 * heap/Heap.h: Changed m_activityCallback and m_sweeper to be raw pointers rather than OwnPtrs because they
5426 are now responsible for their own lifetime. Also changed the order of declaration of the GCActivityCallback
5427 and the IncrementalSweeper to make sure they're the last things that get initialized during construction to
5428 prevent any issues with uninitialized memory in the JSGlobalData/Heap they might care about.
5430 * heap/HeapTimer.cpp: Refactored to allow for thread-safe operation and shutdown.
5431 (JSC::HeapTimer::~HeapTimer):
5432 (JSC::HeapTimer::invalidate):
5434 (JSC::HeapTimer::didStartVMShutdown): Called at the beginning of ~JSGlobalData. If we're on the same thread
5435 that the HeapTimer is running on, we kill the HeapTimer ourselves. If not, then we set some state in the
5436 HeapTimer and schedule it to fire immediately so that it can notice and kill itself.
5437 (JSC::HeapTimer::timerDidFire): We grab our mutex and check our JSGlobalData pointer. If it has been zero-ed
5438 out, then we know the VM has started to shutdown and we should kill ourselves. Otherwise, grab the APIEntryShim,
5439 but without ref-ing the JSGlobalData (we don't want to bring the JSGlobalData's ref-count from 0 to 1) in case
5440 we were interrupted between releasing our mutex and trying to grab the APILock.
5443 * heap/IncrementalSweeper.cpp:
5444 (JSC::IncrementalSweeper::doWork): We no longer need the API shim here since HeapTimer::timerDidFire handles
5446 (JSC::IncrementalSweeper::create):
5447 * heap/IncrementalSweeper.h:
5448 (IncrementalSweeper):
5449 * heap/MarkedAllocator.cpp:
5450 (JSC::MarkedAllocator::allocateSlowCase):
5451 * heap/WeakBlock.cpp:
5452 (JSC::WeakBlock::reap):
5455 (functionReleaseExecutableMemory):
5457 * runtime/Completion.cpp:
5460 * runtime/GCActivityCallback.h:
5461 (DefaultGCActivityCallback):
5462 (JSC::DefaultGCActivityCallback::create):
5463 * runtime/JSGlobalData.cpp:
5464 (JSC::JSGlobalData::JSGlobalData):
5465 (JSC::JSGlobalData::~JSGlobalData): Signals to the two HeapTimers (GCActivityCallback and IncrementalSweeper)
5466 that the VM has started shutting down. It then waits until the HeapTimer is done with whatever activity
5467 it needs to do before continuing with any further destruction. Also asserts that we do not currently hold the
5468 APILock because this could potentially cause deadlock when we try to signal to the HeapTimers using their mutexes.
5469 (JSC::JSGlobalData::sharedInstance): Protect the initialization for the shared instance with the GlobalJSLock.
5470 (JSC::JSGlobalData::sharedInstanceInternal):
5471 * runtime/JSGlobalData.h: Change to be ThreadSafeRefCounted so that we don't have to worry about refing and
5472 de-refing JSGlobalDatas on separate threads since we don't do it that often anyways.
5474 (JSC::JSGlobalData::apiLock):
5475 * runtime/JSGlobalObject.cpp:
5476 (JSC::JSGlobalObject::~JSGlobalObject):
5477 (JSC::JSGlobalObject::init):
5478 * runtime/JSLock.cpp:
5480 (JSC::GlobalJSLock::GlobalJSLock): For accessing the shared instance.
5481 (JSC::GlobalJSLock::~GlobalJSLock):
5482 (JSC::JSLockHolder::JSLockHolder): MutexLocker for JSLock. Also refs the JSGlobalData to keep it alive so that
5483 it can successfully unlock it later without it disappearing from underneath it.
5484 (JSC::JSLockHolder::~JSLockHolder):
5485 (JSC::JSLock::JSLock):
5486 (JSC::JSLock::~JSLock):
5487 (JSC::JSLock::lock): Uses the spin lock for guarding the lock count and owner thread fields. Uses the mutex for
5488 actually waiting for long periods.
5489 (JSC::JSLock::unlock):
5490 (JSC::JSLock::currentThreadIsHoldingLock):
5491 (JSC::JSLock::dropAllLocks):
5492 (JSC::JSLock::dropAllLocksUnconditionally):
5493 (JSC::JSLock::grabAllLocks):
5494 (JSC::JSLock::DropAllLocks::DropAllLocks):
5495 (JSC::JSLock::DropAllLocks::~DropAllLocks):
5502 * runtime/WeakGCMap.h:
5503 (JSC::WeakGCMap::set):
5507 2012-06-22 Peter Beverloo <peter@chromium.org>
5509 [Chromium] Disable c++0x compatibility warnings in JavaScriptCore.gyp when building for Android
5510 https://bugs.webkit.org/show_bug.cgi?id=88853
5512 Reviewed by Steve Block.
5514 The Android exclusions were necessary to fix a gyp generation error, as
5515 the gcc_version variable wasn't being defined for Android. Remove these
5516 exceptions when Chromium is able to define the gcc_version variable.
5518 * JavaScriptCore.gyp/JavaScriptCore.gyp:
5520 2012-06-21 Filip Pizlo <fpizlo@apple.com>
5522 op_resolve_global should not prevent DFG inlining
5523 https://bugs.webkit.org/show_bug.cgi?id=89726
5525 Reviewed by Gavin Barraclough.
5527 * bytecode/CodeBlock.cpp:
5528 (JSC::CodeBlock::CodeBlock):
5529 (JSC::CodeBlock::shrinkToFit):
5530 * bytecode/GlobalResolveInfo.h:
5531 (JSC::GlobalResolveInfo::GlobalResolveInfo):
5532 (GlobalResolveInfo):
5533 * dfg/DFGByteCodeParser.cpp:
5534 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
5535 * dfg/DFGCapabilities.h:
5536 (JSC::DFG::canInlineOpcode):
5537 * dfg/DFGOperations.cpp:
5538 * dfg/DFGOperations.h:
5539 * dfg/DFGSpeculativeJIT.h:
5540 (JSC::DFG::SpeculativeJIT::callOperation):
5541 * dfg/DFGSpeculativeJIT32_64.cpp:
5542 (JSC::DFG::SpeculativeJIT::compile):
5543 * dfg/DFGSpeculativeJIT64.cpp:
5544 (JSC::DFG::SpeculativeJIT::compile):
5546 2012-06-20 Filip Pizlo <fpizlo@apple.com>
5548 DFG should inline 'new Array()'
5549 https://bugs.webkit.org/show_bug.cgi?id=89632
5551 Reviewed by Geoffrey Garen.
5553 This adds support for treating InternalFunction like intrinsics. The code
5554 to do so is actually quite clean, so I don't feel bad about perpetuating
5555 the InternalFunction vs. JSFunction-with-NativeExecutable dichotomy.
5557 Currently this newfound power is only used to inline 'new Array()'.
5559 * dfg/DFGByteCodeParser.cpp:
5561 (JSC::DFG::ByteCodeParser::handleCall):
5562 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
5565 (JSC::DFG::Graph::isInternalFunctionConstant):
5566 (JSC::DFG::Graph::valueOfInternalFunctionConstant):
5568 2012-06-21 Mark Hahnenberg <mhahnenberg@apple.com>
5570 Adding copyrights to new files.
5572 * heap/HeapTimer.cpp:
5574 * heap/IncrementalSweeper.cpp:
5575 * heap/IncrementalSweeper.h:
5577 2012-06-21 Arnaud Renevier <arno@renevier.net>
5579 make sure headers are included only once per file
5580 https://bugs.webkit.org/show_bug.cgi?id=88922
5582 Reviewed by Alexey Proskuryakov.
5584 * bytecode/CodeBlock.h:
5585 * heap/MachineStackMarker.cpp:
5586 * runtime/JSVariableObject.h:
5588 2012-06-21 Ryuan Choi <ryuan.choi@gmail.com>
5590 [EFL][WK2] Make WebKit2/Efl headers and resources installable.
5591 https://bugs.webkit.org/show_bug.cgi?id=88207
5593 Reviewed by Chang Shu.
5595 * shell/CMakeLists.txt: Use ${EXEC_INSTALL_DIR} instead of hardcoding "bin"
5597 2012-06-20 Geoffrey Garen <ggaren@apple.com>
5599 Reduced (but did not eliminate) use of "berzerker GC"
5600 https://bugs.webkit.org/show_bug.cgi?id=89237
5602 Reviewed by Gavin Barraclough.
5606 This patch turned out to be crashy, so I'm landing the non-crashy bits
5609 This part is pre-requisite refactoring. I didn't actually turn off
5610 "berzerker GC" or turn on incremental shrinking.
5612 * heap/MarkedAllocator.cpp:
5613 (JSC::MarkedAllocator::removeBlock): Make sure to clear the free list when
5614 we throw away the block we're currently allocating out of. Otherwise, we'll
5615 allocate out of a stale free list.
5617 * heap/MarkedSpace.cpp:
5619 (JSC::Free::operator()):
5620 (JSC::Free::returnValue): Refactored this functor to use a shared helper
5621 function, so we can share our implementation with the incremental sweeper.
5623 Also changed to freeing individual blocks immediately instead of linking
5624 them into a list for later freeing. This makes the programming interface
5625 simpler, and it's slightly more efficient to boot.
5627 (JSC::MarkedSpace::~MarkedSpace): Updated for rename.
5629 (JSC::MarkedSpace::freeBlock):
5630 (JSC::MarkedSpace::freeOrShrinkBlock): New helper functions to share behavior
5631 with the incremental sweeper.
5633 (JSC::MarkedSpace::shrink): Updated for new functor behavior.
5635 * heap/MarkedSpace.h: Statically typed languages are awesome.
5637 2012-06-20 Filip Pizlo <fpizlo@apple.com>
5639 DFG should optimize ResolveGlobal
5640 https://bugs.webkit.org/show_bug.cgi?id=89617
5642 Reviewed by Oliver Hunt.
5644 This adds inlining of ResolveGlobal accesses that are known monomorphic. It also
5645 adds the specific function optimization to ResolveGlobal, when it is inlined. And,
5646 it makes internal functions act like specific functions, since that will be the
5647 most common use-case of this optimization.
5649 This is only a slighy speed-up (sub 1%), since we don't yet do the obvious thing
5650 with this optimization, which is to completely inline common "globally resolved"
5651 function and constructor calls, like "new Array()".
5654 * GNUmakefile.list.am:
5655 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
5656 * JavaScriptCore.xcodeproj/project.pbxproj:
5658 * bytecode/CodeBlock.cpp:
5659 (JSC::CodeBlock::globalResolveInfoForBytecodeOffset):
5660 * bytecode/CodeBlock.h:
5662 (JSC::CodeBlock::numberOfGlobalResolveInfos):
5663 * bytecode/GlobalResolveInfo.h:
5664 (JSC::getGlobalResolveInfoBytecodeOffset):
5666 * bytecode/ResolveGlobalStatus.cpp: Added.
5668 (JSC::computeForStructure):
5669 (JSC::computeForLLInt):
5670 (JSC::ResolveGlobalStatus::computeFor):
5671 * bytecode/ResolveGlobalStatus.h: Added.
5673 (ResolveGlobalStatus):
5674 (JSC::ResolveGlobalStatus::ResolveGlobalStatus):
5675 (JSC::ResolveGlobalStatus::state):
5676 (JSC::ResolveGlobalStatus::isSet):
5677 (JSC::ResolveGlobalStatus::operator!):
5678 (JSC::ResolveGlobalStatus::isSimple):
5679 (JSC::ResolveGlobalStatus::takesSlowPath):
5680 (JSC::ResolveGlobalStatus::structure):
5681 (JSC::ResolveGlobalStatus::offset):
5682 (JSC::ResolveGlobalStatus::specificValue):
5683 * dfg/DFGByteCodeParser.cpp:
5685 (JSC::DFG::ByteCodeParser::handleGetByOffset):
5687 (JSC::DFG::ByteCodeParser::handleGetById):
5688 (JSC::DFG::ByteCodeParser::parseBlock):
5689 * runtime/JSObject.cpp:
5690 (JSC::getCallableObjectSlow):
5692 (JSC::JSObject::put):
5693 (JSC::JSObject::putDirectVirtual):
5694 (JSC::JSObject::putDirectAccessor):
5695 * runtime/JSObject.h:
5697 (JSC::getCallableObject):
5698 (JSC::JSObject::putOwnDataProperty):
5699 (JSC::JSObject::putDirect):
5700 (JSC::JSObject::putDirectWithoutTransition):
5702 2012-06-20 Filip Pizlo <fpizlo@apple.com>
5704 Functions on global objects should be specializable
5705 https://bugs.webkit.org/show_bug.cgi?id=89615
5707 Reviewed by Oliver Hunt.
5709 I tested to see if this brought back the bug in https://bugs.webkit.org/show_bug.cgi?id=33343,
5710 and it didn't. Bug 33343 was the reason why we disabled global object function specialization
5711 to begin with. So I'm guessing this is safe.
5713 * runtime/JSGlobalObject.cpp:
5714 (JSC::JSGlobalObject::init):
5716 2012-06-20 Filip Pizlo <fpizlo@apple.com>
5718 build-webkit failure due to illegal 32-bit integer constants in code
5719 generated by offlineasm
5720 https://bugs.webkit.org/show_bug.cgi?id=89347
5722 Reviewed by Geoffrey Garen.
5724 The offending constants are the magic numbers used by offlineasm to find
5725 offsets in the generated machine code. Added code to turn them into what
5726 the C++ compiler will believe to be valid 32-bit values.
5728 * offlineasm/offsets.rb:
5730 2012-06-19 Geoffrey Garen <ggaren@apple.com>
5732 Made the incremental sweeper more aggressive
5733 https://bugs.webkit.org/show_bug.cgi?id=89527
5735 Reviewed by Oliver Hunt.
5737 This is a pre-requisite to getting rid of "berzerker GC" because we need
5738 the sweeper to reclaim memory in a timely fashion, or we'll see a memory
5739 footprint regression.
5741 * heap/IncrementalSweeper.h:
5742 * heap/IncrementalSweeper.cpp:
5743 (JSC::IncrementalSweeper::scheduleTimer): Since the time slice is predictable,
5744 no need to use a data member to record it.
5746 (JSC::IncrementalSweeper::doSweep): Sweep as many blocks as we can in a
5747 small time slice. This is better than sweeping only one block per timer
5748 fire because that strategy has a heavy timer overhead, and artificially
5749 delays memory reclamation.
5751 2012-06-20 Filip Pizlo <fpizlo@apple.com>
5753 DFG should be able to print disassembly interleaved with the IR
5754 https://bugs.webkit.org/show_bug.cgi?id=89551
5756 Reviewed by Geoffrey Garen.
5758 This change also removes running Dominators unconditionally on every DFG
5759 compile. Dominators are designed to be computed on-demand, and currently
5760 the only demand is graph dumps.
5763 * GNUmakefile.list.am:
5764 * JavaScriptCore.xcodeproj/project.pbxproj:
5766 * assembler/ARMv7Assembler.h:
5767 (JSC::ARMv7Assembler::labelIgnoringWatchpoints):
5769 * assembler/AbstractMacroAssembler.h:
5770 (AbstractMacroAssembler):
5771 (JSC::AbstractMacroAssembler::labelIgnoringWatchpoints):
5772 * assembler/X86Assembler.h:
5774 (JSC::X86Assembler::labelIgnoringWatchpoints):
5776 (JSC::DFG::shouldShowDisassembly):
5778 * dfg/DFGDisassembler.cpp: Added.
5780 (JSC::DFG::Disassembler::Disassembler):
5781 (JSC::DFG::Disassembler::dump):
5782 (JSC::DFG::Disassembler::dumpDisassembly):
5783 * dfg/DFGDisassembler.h: Added.
5786 (JSC::DFG::Disassembler::setStartOfCode):
5787 (JSC::DFG::Disassembler::setForBlock):
5788 (JSC::DFG::Disassembler::setForNode):
5789 (JSC::DFG::Disassembler::setEndOfMainPath):
5790 (JSC::DFG::Disassembler::setEndOfCode):
5791 * dfg/DFGDriver.cpp:
5792 (JSC::DFG::compile):
5794 (JSC::DFG::Graph::dumpCodeOrigin):
5795 (JSC::DFG::Graph::amountOfNodeWhiteSpace):
5797 (JSC::DFG::Graph::printNodeWhiteSpace):
5798 (JSC::DFG::Graph::dump):
5799 (JSC::DFG::Graph::dumpBlockHeader):
5801 * dfg/DFGJITCompiler.cpp:
5802 (JSC::DFG::JITCompiler::JITCompiler):
5804 (JSC::DFG::JITCompiler::compile):
5805 (JSC::DFG::JITCompiler::compileFunction):
5806 * dfg/DFGJITCompiler.h:
5808 (JSC::DFG::JITCompiler::setStartOfCode):
5809 (JSC::DFG::JITCompiler::setForBlock):
5810 (JSC::DFG::JITCompiler::setForNode):
5811 (JSC::DFG::JITCompiler::setEndOfMainPath):
5812 (JSC::DFG::JITCompiler::setEndOfCode):
5815 (JSC::DFG::Node::willHaveCodeGen):
5816 * dfg/DFGNodeFlags.cpp:
5817 (JSC::DFG::nodeFlagsAsString):
5818 * dfg/DFGSpeculativeJIT.cpp:
5819 (JSC::DFG::SpeculativeJIT::compile):
5820 * dfg/DFGSpeculativeJIT.h:
5822 * runtime/Options.cpp:
5824 (JSC::Options::initializeOptions):
5825 * runtime/Options.h:
5828 2012-06-19 Filip Pizlo <fpizlo@apple.com>
5830 JSC should be able to show disassembly for all generated JIT code
5831 https://bugs.webkit.org/show_bug.cgi?id=89536
5833 Reviewed by Gavin Barraclough.
5835 Now instead of doing linkBuffer.finalizeCode(), you do
5836 FINALIZE_CODE(linkBuffer, (... explanation ...)). FINALIZE_CODE() then
5837 prints your explanation and the disassembled code, if
5838 Options::showDisassembly is set to true.
5841 * GNUmakefile.list.am:
5842 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
5843 * JavaScriptCore.xcodeproj/project.pbxproj:
5845 * assembler/LinkBuffer.cpp: Added.
5847 (JSC::LinkBuffer::finalizeCodeWithoutDisassembly):
5848 (JSC::LinkBuffer::finalizeCodeWithDisassembly):
5849 (JSC::LinkBuffer::linkCode):
5850 (JSC::LinkBuffer::performFinalization):
5851 (JSC::LinkBuffer::dumpLinkStatistics):
5852 (JSC::LinkBuffer::dumpCode):
5853 * assembler/LinkBuffer.h:
5856 * assembler/MacroAssemblerCodeRef.h:
5857 (JSC::MacroAssemblerCodeRef::tryToDisassemble):
5858 (MacroAssemblerCodeRef):
5859 * dfg/DFGJITCompiler.cpp:
5860 (JSC::DFG::JITCompiler::compile):
5861 (JSC::DFG::JITCompiler::compileFunction):
5862 * dfg/DFGOSRExitCompiler.cpp:
5863 * dfg/DFGRepatch.cpp:
5864 (JSC::DFG::generateProtoChainAccessStub):
5865 (JSC::DFG::tryCacheGetByID):
5866 (JSC::DFG::tryBuildGetByIDList):
5867 (JSC::DFG::emitPutReplaceStub):
5868 (JSC::DFG::emitPutTransitionStub):
5869 * dfg/DFGThunks.cpp:
5870 (JSC::DFG::osrExitGenerationThunkGenerator):
5871 * disassembler/Disassembler.h:
5873 (JSC::tryToDisassemble):
5874 * disassembler/UDis86Disassembler.cpp:
5875 (JSC::tryToDisassemble):
5877 (JSC::JIT::privateCompile):
5879 (JSC::JITCode::tryToDisassemble):
5880 * jit/JITOpcodes.cpp:
5881 (JSC::JIT::privateCompileCTIMachineTrampolines):
5882 * jit/JITOpcodes32_64.cpp:
5883 (JSC::JIT::privateCompileCTIMachineTrampolines):
5884 (JSC::JIT::privateCompileCTINativeCall):
5885 * jit/JITPropertyAccess.cpp:
5886 (JSC::JIT::stringGetByValStubGenerator):
5887 (JSC::JIT::privateCompilePutByIdTransition):
5888 (JSC::JIT::privateCompilePatchGetArrayLength):
5889 (JSC::JIT::privateCompileGetByIdProto):
5890 (JSC::JIT::privateCompileGetByIdSelfList):
5891 (JSC::JIT::privateCompileGetByIdProtoList):
5892 (JSC::JIT::privateCompileGetByIdChainList):
5893 (JSC::JIT::privateCompileGetByIdChain):
5894 * jit/JITPropertyAccess32_64.cpp:
5895 (JSC::JIT::stringGetByValStubGenerator):
5896 (JSC::JIT::privateCompilePutByIdTransition):
5897 (JSC::JIT::privateCompilePatchGetArrayLength):
5898 (JSC::JIT::privateCompileGetByIdProto):
5899 (JSC::JIT::privateCompileGetByIdSelfList):
5900 (JSC::JIT::privateCompileGetByIdProtoList):
5901 (JSC::JIT::privateCompileGetByIdChainList):
5902 (JSC::JIT::privateCompileGetByIdChain):
5903 * jit/SpecializedThunkJIT.h:
5904 (JSC::SpecializedThunkJIT::finalize):
5905 * jit/ThunkGenerators.cpp:
5906 (JSC::charCodeAtThunkGenerator):
5907 (JSC::charAtThunkGenerator):
5908 (JSC::fromCharCodeThunkGenerator):
5909 (JSC::sqrtThunkGenerator):
5910 (JSC::floorThunkGenerator):
5911 (JSC::ceilThunkGenerator):
5912 (JSC::roundThunkGenerator):
5913 (JSC::expThunkGenerator):
5914 (JSC::logThunkGenerator):
5915 (JSC::absThunkGenerator):
5916 (JSC::powThunkGenerator):
5917 * llint/LLIntThunks.cpp:
5918 (JSC::LLInt::generateThunkWithJumpTo):
5919 (JSC::LLInt::functionForCallEntryThunkGenerator):
5920 (JSC::LLInt::functionForConstructEntryThunkGenerator):
5921 (JSC::LLInt::functionForCallArityCheckThunkGenerator):
5922 (JSC::LLInt::functionForConstructArityCheckThunkGenerator):
5923 (JSC::LLInt::evalEntryThunkGenerator):
5924 (JSC::LLInt::programEntryThunkGenerator):
5925 * runtime/Options.cpp:
5927 (JSC::Options::initializeOptions):
5928 * runtime/Options.h:
5931 (JSC::Yarr::YarrGenerator::compile):
5933 2012-06-19 Mark Hahnenberg <mhahnenberg@apple.com>
5935 [Qt][Mac] REGRESSION(r120742): It broke the build
5936 https://bugs.webkit.org/show_bug.cgi?id=89516
5938 Reviewed by Geoffrey Garen.
5940 Removing GCActivityCallbackCF.cpp because it doesn't mesh well with cross-platform
5941 code on Darwin (e.g. Qt). We now use plain ol' vanilla ifdefs to handle platforms
5942 without CF support. These if-defs will probably disappear in the future when we
5943 use cross-platform timers in HeapTimer.
5945 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
5946 * JavaScriptCore.xcodeproj/project.pbxproj:
5947 * runtime/GCActivityCallback.cpp:
5949 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
5950 (JSC::DefaultGCActivityCallback::doWork):
5951 (JSC::DefaultGCActivityCallback::scheduleTimer):
5952 (JSC::DefaultGCActivityCallback::cancelTimer):
5953 (JSC::DefaultGCActivityCallback::didAllocate):
5954 (JSC::DefaultGCActivityCallback::willCollect):
5955 (JSC::DefaultGCActivityCallback::cancel):
5956 * runtime/GCActivityCallbackCF.cpp: Removed.
5958 2012-06-19 Filip Pizlo <fpizlo@apple.com>
5960 DFG CFA forgets to notify subsequent phases of found constants if it proves LogicalNot to be a constant
5961 https://bugs.webkit.org/show_bug.cgi?id=89511
5962 <rdar://problem/11700089>
5964 Reviewed by Geoffrey Garen.
5966 * dfg/DFGAbstractState.cpp:
5967 (JSC::DFG::AbstractState::execute):
5969 2012-06-19 Mark Lam <mark.lam@apple.com>
5971 CodeBlock::needsCallReturnIndices() is no longer needed.
5972 https://bugs.webkit.org/show_bug.cgi?id=89490
5974 Reviewed by Geoffrey Garen.
5976 * bytecode/CodeBlock.h:
5977 (JSC::CodeBlock::needsCallReturnIndices): removed.
5978 * dfg/DFGJITCompiler.cpp:
5979 (JSC::DFG::JITCompiler::link):
5981 (JSC::JIT::privateCompile):
5983 2012-06-19 Filip Pizlo <fpizlo@apple.com>
5985 Unreviewed, try to fix Windows build.
5987 * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd:
5989 2012-06-17 Filip Pizlo <fpizlo@apple.com>
5991 It should be possible to look at disassembly
5992 https://bugs.webkit.org/show_bug.cgi?id=89319
5994 Reviewed by Sam Weinig.
5996 This imports the udis86 disassembler library. The library is placed
5997 behind an abstraction in disassembler/Disassembler.h, so that we can
5998 in the future use other disassemblers (for other platforms) whenever
5999 appropriate. As a first step, the disassembler is being invoked for
6002 If we ever want to merge a new version of udis86 in the future, I've
6003 made notes about changes I made to the library in
6004 disassembler/udis86/differences.txt.
6007 * DerivedSources.make:
6008 * GNUmakefile.list.am:
6009 * JavaScriptCore.pri:
6010 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6011 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
6012 * JavaScriptCore.xcodeproj/project.pbxproj:
6013 * dfg/DFGJITCompiler.cpp:
6014 (JSC::DFG::JITCompiler::compile):
6015 (JSC::DFG::JITCompiler::compileFunction):
6016 * disassembler: Added.
6017 * disassembler/Disassembler.h: Added.
6019 (JSC::tryToDisassemble):
6020 * disassembler/UDis86Disassembler.cpp: Added.
6022 (JSC::tryToDisassemble):
6023 * disassembler/udis86: Added.
6024 * disassembler/udis86/differences.txt: Added.
6025 * disassembler/udis86/itab.py: Added.
6027 (UdItabGenerator.__init__):
6028 (UdItabGenerator.toGroupId):
6029 (UdItabGenerator.genLookupTable):
6030 (UdItabGenerator.genLookupTableList):
6031 (UdItabGenerator.genInsnTable):
6033 (genItabH.UD_ITAB_H):
6037 * disassembler/udis86/optable.xml: Added.
6038 * disassembler/udis86/ud_opcode.py: Added.
6040 (UdOpcodeTables.sizeOfTable):
6041 (UdOpcodeTables.nameOfTable):
6042 (UdOpcodeTables.updateTable):
6043 (UdOpcodeTables.Insn):
6044 (UdOpcodeTables.Insn.__init__):
6045 (UdOpcodeTables.Insn.__init__.opcode):
6046 (UdOpcodeTables.parse):
6047 (UdOpcodeTables.addInsnDef):
6048 (UdOpcodeTables.print_table):
6049 (UdOpcodeTables.print_tree):
6050 * disassembler/udis86/ud_optable.py: Added.
6051 (UdOptableXmlParser):
6052 (UdOptableXmlParser.parseDef):
6053 (UdOptableXmlParser.parse):
6057 * disassembler/udis86/udis86.c: Added.
6069 * disassembler/udis86/udis86.h: Added.
6070 * disassembler/udis86/udis86_decode.c: Added.
6072 (ud_lookup_mnemonic):
6075 (resolve_operand_size):
6097 * disassembler/udis86/udis86_decode.h: Added.
6098 (ud_itab_entry_operand):
6100 (ud_lookup_table_list_entry):
6107 * disassembler/udis86/udis86_extern.h: Added.
6108 * disassembler/udis86/udis86_input.c: Added.
6112 (ud_set_user_opaque_data):
6113 (ud_get_user_opaque_data):
6114 (ud_set_input_buffer):
6115 (ud_set_input_file):
6126 * disassembler/udis86/udis86_input.h: Added.
6127 * disassembler/udis86/udis86_itab_holder.c: Added.
6128 * disassembler/udis86/udis86_syn-att.c: Added.
6132 * disassembler/udis86/udis86_syn-intel.c: Added.
6135 (ud_translate_intel):
6136 * disassembler/udis86/udis86_syn.c: Added.
6137 * disassembler/udis86/udis86_syn.h: Added.
6139 * disassembler/udis86/udis86_types.h: Added.
6144 (JSC::JITCode::tryToDisassemble):
6146 2012-06-19 Mark Hahnenberg <mhahnenberg@apple.com>
6148 GCActivityCallback and IncrementalSweeper should share code
6149 https://bugs.webkit.org/show_bug.cgi?id=89400
6151 Reviewed by Geoffrey Garen.
6153 A lot of functionality is duplicated between GCActivityCallback and IncrementalSweeper.
6154 We should extract the common functionality out into a separate class that both of them
6155 can inherit from. This refactoring will be an even greater boon when we add the ability
6156 to shut these two agents down in a thread-safe fashion
6159 * GNUmakefile.list.am:
6160 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6161 * JavaScriptCore.xcodeproj/project.pbxproj:
6164 (JSC::Heap::Heap): Move initialization down so that the JSGlobalData has a valid Heap when
6165 we're initializing the GCActivityCallback and the IncrementalSweeper.
6168 * heap/HeapTimer.cpp: Added.
6170 (JSC::HeapTimer::HeapTimer): Initialize the various base class data that
6171 DefaultGCActivityCallback::commonConstructor() used to do.
6172 (JSC::HeapTimer::~HeapTimer): Call to invalidate().
6173 (JSC::HeapTimer::synchronize): Same functionality as the old DefaultGCActivityCallback::synchronize().
6174 Virtual so that non-CF subclasses can override.
6175 (JSC::HeapTimer::invalidate): Tears down the runloop timer to prevent any future firing.
6176 (JSC::HeapTimer::timerDidFire): Callback to pass to the timer function. Casts and calls the virtual doWork().
6177 * heap/HeapTimer.h: Added. This is the class that serves as the common base class for
6178 both GCActivityCallback and IncrementalSweeper. It handles setting up and tearing down run loops and synchronizing
6179 across threads for its subclasses.
6182 * heap/IncrementalSweeper.cpp: Changes to accomodate the extraction of common functionality
6183 between IncrementalSweeper and GCActivityCallback into a common ancestor.
6185 (JSC::IncrementalSweeper::doWork):
6186 (JSC::IncrementalSweeper::IncrementalSweeper):
6187 (JSC::IncrementalSweeper::cancelTimer):
6188 (JSC::IncrementalSweeper::create):
6189 * heap/IncrementalSweeper.h:
6190 (IncrementalSweeper):
6191 * runtime/GCActivityCallback.cpp:
6192 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
6193 (JSC::DefaultGCActivityCallback::doWork):
6194 * runtime/GCActivityCallback.h:
6195 (GCActivityCallback):
6196 (JSC::GCActivityCallback::willCollect):
6197 (JSC::GCActivityCallback::GCActivityCallback):
6199 (DefaultGCActivityCallback): Remove the platform data struct. The platform data should be kept in
6200 the class itself so as to be accessible by doWork(). Most of the platform data for CF is kept in
6201 HeapTimer anyways, so we only need the m_delay field now.
6202 * runtime/GCActivityCallbackBlackBerry.cpp:
6204 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
6205 (JSC::DefaultGCActivityCallback::doWork):
6206 (JSC::DefaultGCActivityCallback::didAllocate):
6207 * runtime/GCActivityCallbackCF.cpp:
6209 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
6210 (JSC::DefaultGCActivityCallback::doWork):
6211 (JSC::DefaultGCActivityCallback::scheduleTimer):
6212 (JSC::DefaultGCActivityCallback::cancelTimer):
6213 (JSC::DefaultGCActivityCallback::didAllocate):
6214 (JSC::DefaultGCActivityCallback::willCollect):
6215 (JSC::DefaultGCActivityCallback::cancel):
6218 2012-06-19 Mike West <mkwst@chromium.org>
6220 Introduce ENABLE_CSP_NEXT configuration flag.
6221 https://bugs.webkit.org/show_bug.cgi?id=89300
6223 Reviewed by Adam Barth.
6225 The 1.0 draft of the Content Security Policy spec is just about to
6226 move to Last Call. We'll hide work on the upcoming 1.1 spec behind
6227 this ENABLE flag, disabled by default.
6229 Spec: https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html
6231 * Configurations/FeatureDefines.xcconfig:
6233 2012-06-18 Mark Lam <mark.lam@apple.com>
6235 Changed JSC to always record line number information so that error.stack
6236 and window.onerror() can report proper line numbers.
6237 https://bugs.webkit.org/show_bug.cgi?id=89410
6239 Reviewed by Geoffrey Garen.
6241 * bytecode/CodeBlock.cpp:
6242 (JSC::CodeBlock::CodeBlock):
6243 (JSC::CodeBlock::lineNumberForBytecodeOffset):
6244 (JSC::CodeBlock::shrinkToFit): m_lineInfo is now available unconditionally.
6246 * bytecode/CodeBlock.h:
6247 (JSC::CodeBlock::addLineInfo):
6248 (JSC::CodeBlock::hasLineInfo): Unused. Now removed.
6249 (JSC::CodeBlock::needsCallReturnIndices):
6251 (RareData): Hoisted m_lineInfo out of m_rareData. m_lineInfo is now
6252 filled in unconditionally.
6254 * bytecompiler/BytecodeGenerator.h:
6255 (JSC::BytecodeGenerator::addLineInfo):
6257 2012-06-18 Andy Estes <aestes@apple.com>
6259 Fix r120663, which didn't land the change that was reviewed.
6261 2012-06-18 Andy Estes <aestes@apple.com>
6263 [JSC] In JSGlobalData.cpp, enableAssembler() sometimes leaks two CF objects
6264 https://bugs.webkit.org/show_bug.cgi?id=89415
6266 Reviewed by Sam Weinig.
6268 In the case where canUseJIT was a non-NULL CFBooleanRef,
6269 enableAssembler() would leak both canUseJITKey and canUseJIT by
6270 returning before calling CFRelease. Fix this by using RetainPtr.
6272 * runtime/JSGlobalData.cpp:
6273 (JSC::enableAssembler):
6275 2012-06-17 Geoffrey Garen <ggaren@apple.com>
6277 GC copy phase spends needless cycles zero-filling blocks
6278 https://bugs.webkit.org/show_bug.cgi?id=89128
6280 Reviewed by Gavin Barraclough.
6282 We only need to zero-fill when we're allocating memory that might not
6283 get fully initialized before GC.
6285 * heap/CopiedBlock.h:
6286 (JSC::CopiedBlock::createNoZeroFill):
6287 (JSC::CopiedBlock::create): Added a way to create without zero-filling.
6288 This is our optimization.
6290 (JSC::CopiedBlock::zeroFillToEnd):
6291 (JSC::CopiedBlock::CopiedBlock): Split zero-filling out from creation,
6292 so we can sometimes create without zero-filling.
6294 * heap/CopiedSpace.cpp:
6295 (JSC::CopiedSpace::init):
6296 (JSC::CopiedSpace::tryAllocateSlowCase):
6297 (JSC::CopiedSpace::doneCopying): Renamed addNewBlock to allocateBlock()
6298 to clarify that the new block is always newly-allocated.
6300 (JSC::CopiedSpace::doneFillingBlock): Make sure to zero-fill to the end
6301 of a block that might be used in the future for allocation. (Most of the
6302 time, this is a no-op, since we've already filled the block completely.)
6304 (JSC::CopiedSpace::getFreshBlock): Removed this function because the
6305 abstraction of "allocation must succeed" is no longer useful.
6307 * heap/CopiedSpace.h: Updated declarations to match.
6309 * heap/CopiedSpaceInlineMethods.h:
6310 (JSC::CopiedSpace::allocateBlockForCopyingPhase): New function, which
6311 knows that it can skip zero-filling.
6313 Added tighter scoping to our lock, to improve parallelism.
6315 (JSC::CopiedSpace::allocateBlock): Folded getFreshBlock functionality
6316 into this function, for simplicity.
6318 * heap/MarkStack.cpp:
6319 (JSC::SlotVisitor::startCopying):
6320 (JSC::SlotVisitor::allocateNewSpace): Use our new zero-fill-free helper
6321 function for great good.
6323 2012-06-17 Filip Pizlo <fpizlo@apple.com>
6325 DFG should attempt to use structure watchpoints for all inlined get_by_id's and put_by_id's
6326 https://bugs.webkit.org/show_bug.cgi?id=89316
6328 Reviewed by Oliver Hunt.
6330 * dfg/DFGByteCodeParser.cpp:
6331 (JSC::DFG::ByteCodeParser::addStructureTransitionCheck):
6333 (JSC::DFG::ByteCodeParser::handleGetById):
6334 (JSC::DFG::ByteCodeParser::parseBlock):
6336 2012-06-15 Yong Li <yoli@rim.com>
6338 [BlackBerry] Put platform-specific GC policy in GCActivityCallback
6339 https://bugs.webkit.org/show_bug.cgi?id=89236
6341 Reviewed by Rob Buis.
6343 Add GCActivityCallbackBlackBerry.cpp and implement platform-specific
6344 low memory GC policy there.
6346 * PlatformBlackBerry.cmake:
6348 (JSC::Heap::isSafeToCollect): Added.
6349 * runtime/GCActivityCallbackBlackBerry.cpp: Added.
6351 (JSC::DefaultGCActivityCallbackPlatformData::DefaultGCActivityCallbackPlatformData):
6352 (DefaultGCActivityCallbackPlatformData):
6353 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
6354 (JSC::DefaultGCActivityCallback::~DefaultGCActivityCallback):
6355 (JSC::DefaultGCActivityCallback::didAllocate):
6356 (JSC::DefaultGCActivityCallback::willCollect):
6357 (JSC::DefaultGCActivityCallback::synchronize):
6358 (JSC::DefaultGCActivityCallback::cancel):
6360 2012-06-15 Filip Pizlo <fpizlo@apple.com>
6362 DFG should be able to set watchpoints on structure transitions in the
6363 method check prototype chain
6364 https://bugs.webkit.org/show_bug.cgi?id=89058
6366 Adding the same assertion to 32-bit that I added to 64-bit. This change
6367 does not affect correctness but it's a good thing for assertion coverage.
6369 * dfg/DFGSpeculativeJIT32_64.cpp:
6370 (JSC::DFG::SpeculativeJIT::compile):
6372 2012-06-13 Filip Pizlo <fpizlo@apple.com>
6374 DFG should be able to set watchpoints on structure transitions in the
6375 method check prototype chain
6376 https://bugs.webkit.org/show_bug.cgi?id=89058
6378 Reviewed by Gavin Barraclough.
6380 This adds the ability to set watchpoints on Structures, and then does
6381 the most modest thing we can do with this ability: the DFG now sets
6382 watchpoints on structure transitions in the prototype chain of method
6385 This appears to be a >1% speed-up on V8.
6387 * bytecode/PutByIdStatus.cpp:
6388 (JSC::PutByIdStatus::computeFromLLInt):
6389 (JSC::PutByIdStatus::computeFor):
6390 * bytecode/StructureSet.h:
6391 (JSC::StructureSet::containsOnly):
6393 * bytecode/Watchpoint.cpp:
6394 (JSC::WatchpointSet::WatchpointSet):
6395 (JSC::InlineWatchpointSet::add):
6397 (JSC::InlineWatchpointSet::inflateSlow):
6398 (JSC::InlineWatchpointSet::freeFat):
6399 * bytecode/Watchpoint.h:
6402 (InlineWatchpointSet):
6403 (JSC::InlineWatchpointSet::InlineWatchpointSet):
6404 (JSC::InlineWatchpointSet::~InlineWatchpointSet):
6405 (JSC::InlineWatchpointSet::hasBeenInvalidated):
6406 (JSC::InlineWatchpointSet::isStillValid):
6407 (JSC::InlineWatchpointSet::startWatching):
6408 (JSC::InlineWatchpointSet::notifyWrite):
6409 (JSC::InlineWatchpointSet::isFat):
6410 (JSC::InlineWatchpointSet::fat):
6411 (JSC::InlineWatchpointSet::inflate):
6412 * dfg/DFGAbstractState.cpp:
6413 (JSC::DFG::AbstractState::execute):
6414 * dfg/DFGByteCodeParser.cpp:
6415 (JSC::DFG::ByteCodeParser::addStructureTransitionCheck):
6417 (JSC::DFG::ByteCodeParser::parseBlock):
6418 * dfg/DFGCSEPhase.cpp:
6419 (JSC::DFG::CSEPhase::structureTransitionWatchpointElimination):
6421 (JSC::DFG::CSEPhase::performNodeCSE):
6424 (JSC::DFG::Graph::dump):
6426 (JSC::DFG::Graph::isCellConstant):
6427 * dfg/DFGJITCompiler.h:
6428 (JSC::DFG::JITCompiler::addWeakReferences):
6431 (JSC::DFG::Node::hasStructure):
6433 (JSC::DFG::Node::structure):
6434 * dfg/DFGNodeType.h:
6436 * dfg/DFGPredictionPropagationPhase.cpp:
6437 (JSC::DFG::PredictionPropagationPhase::propagate):
6438 * dfg/DFGRepatch.cpp:
6439 (JSC::DFG::emitPutTransitionStub):
6440 * dfg/DFGSpeculativeJIT64.cpp:
6441 (JSC::DFG::SpeculativeJIT::compile):
6443 (JSC::JITThunks::tryCachePutByID):
6444 * llint/LLIntSlowPaths.cpp:
6445 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
6446 * runtime/Structure.cpp:
6447 (JSC::Structure::Structure):
6448 * runtime/Structure.h:
6449 (JSC::Structure::transitionWatchpointSetHasBeenInvalidated):
6451 (JSC::Structure::transitionWatchpointSetIsStillValid):
6452 (JSC::Structure::addTransitionWatchpoint):
6453 (JSC::Structure::notifyTransitionFromThisStructure):
6454 (JSC::JSCell::setStructure):
6455 * runtime/SymbolTable.cpp:
6456 (JSC::SymbolTableEntry::attemptToWatch):
6458 2012-06-13 Filip Pizlo <fpizlo@apple.com>
6460 DFG should be able to set watchpoints on global variables
6461 https://bugs.webkit.org/show_bug.cgi?id=88692
6463 Reviewed by Geoffrey Garen.
6465 Rolling back in after fixing Windows build issues, and implementing
6466 branchTest8 for the Qt port's strange assemblers.
6468 This implements global variable constant folding by allowing the optimizing
6469 compiler to set a "watchpoint" on globals that it wishes to constant fold.
6470 If the watchpoint fires, then an OSR exit is forced by overwriting the
6471 machine code that the optimizing compiler generated with a jump.
6473 As such, this patch is adding quite a bit of stuff:
6475 - Jump replacement on those hardware targets supported by the optimizing
6476 JIT. It is now possible to patch in a jump instruction over any recorded
6477 watchpoint label. The jump must be "local" in the sense that it must be
6478 within the range of the largest jump distance supported by a one
6481 - WatchpointSets and Watchpoints. A Watchpoint is a doubly-linked list node
6482 that records the location where a jump must be inserted and the
6483 destination to which it should jump. Watchpoints can be added to a
6484 WatchpointSet. The WatchpointSet can be fired all at once, which plants
6485 all jumps. WatchpointSet also remembers if it had ever been invalidated,
6486 which allows for monotonicity: we typically don't want to optimize using
6487 watchpoints on something for which watchpoints had previously fired. The
6488 act of notifying a WatchpointSet has a trivial fast path in case no
6489 Watchpoints are registered (one-byte load+branch).
6491 - SpeculativeJIT::speculationWatchpoint(). It's like speculationCheck(),
6492 except that you don't have to emit branches. But, you need to know what
6493 WatchpointSet to add the resulting Watchpoint to. Not everything that
6494 you could write a speculationCheck() for will have a WatchpointSet that
6495 would get notified if the condition you were speculating against became
6498 - SymbolTableEntry now has the ability to refer to a WatchpointSet. It can
6499 do so without incurring any space overhead for those entries that don't
6500 have WatchpointSets.
6502 - The bytecode generator infers all global function variables to be
6503 watchable, and makes all stores perform the WatchpointSet's write check,
6504 and marks all loads as being potentially watchable (i.e. you can compile
6505 them to a watchpoint and a constant).
6507 Put together, this allows for fully sleazy inlining of calls to globally
6508 declared functions. The inline prologue will no longer contain the load of
6509 the function, or any checks of the function you're calling. I.e. it's
6510 pretty much like the kind of inlining you would see in Java or C++.
6511 Furthermore, the watchpointing functionality is built to be fairly general,
6512 and should allow setting watchpoints on all sorts of interesting things
6515 The sleazy inlining means that we will now sometimes inline in code paths
6516 that have never executed. Previously, to inline we would have either had
6517 to have executed the call (to read the call's inline cache) or have
6518 executed the method check (to read the method check's inline cache). Now,
6519 we might inline when the callee is a watched global variable. This
6520 revealed some humorous bugs. First, constant folding disagreed with CFA
6521 over what kinds of operations can clobber (example: code path A is dead
6522 but stores a String into variable X, all other code paths store 0 into
6523 X, and then you do CompareEq(X, 0) - CFA will say that this is a non-
6524 clobbering constant, but constant folding thought it was clobbering
6525 because it saw the String prediction). Second, inlining would crash if
6526 the inline callee had not been compiled. This patch fixes both bugs,
6527 since otherwise run-javascriptcore-tests would report regressions.
6530 * GNUmakefile.list.am:
6531 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
6532 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6533 * JavaScriptCore.xcodeproj/project.pbxproj:
6535 * assembler/ARMv7Assembler.h:
6537 (JSC::ARMv7Assembler::ARMv7Assembler):
6538 (JSC::ARMv7Assembler::labelForWatchpoint):
6539 (JSC::ARMv7Assembler::label):
6540 (JSC::ARMv7Assembler::replaceWithJump):
6541 (JSC::ARMv7Assembler::maxJumpReplacementSize):
6542 * assembler/AbstractMacroAssembler.h:
6544 (AbstractMacroAssembler):
6546 (JSC::AbstractMacroAssembler::watchpointLabel):
6547 (JSC::AbstractMacroAssembler::readPointer):
6548 * assembler/AssemblerBuffer.h:
6549 * assembler/MacroAssemblerARM.h:
6550 (JSC::MacroAssemblerARM::branchTest8):
6551 (MacroAssemblerARM):
6552 (JSC::MacroAssemblerARM::replaceWithJump):
6553 (JSC::MacroAssemblerARM::maxJumpReplacementSize):
6554 * assembler/MacroAssemblerARMv7.h:
6555 (JSC::MacroAssemblerARMv7::load8Signed):
6556 (JSC::MacroAssemblerARMv7::load16Signed):
6557 (MacroAssemblerARMv7):
6558 (JSC::MacroAssemblerARMv7::replaceWithJump):
6559 (JSC::MacroAssemblerARMv7::maxJumpReplacementSize):
6560 (JSC::MacroAssemblerARMv7::branchTest8):
6561 (JSC::MacroAssemblerARMv7::jump):
6562 (JSC::MacroAssemblerARMv7::makeBranch):
6563 * assembler/MacroAssemblerMIPS.h:
6564 (JSC::MacroAssemblerMIPS::branchTest8):
6565 (MacroAssemblerMIPS):
6566 (JSC::MacroAssemblerMIPS::replaceWithJump):
6567 (JSC::MacroAssemblerMIPS::maxJumpReplacementSize):
6568 * assembler/MacroAssemblerSH4.h:
6569 (JSC::MacroAssemblerSH4::branchTest8):
6570 (MacroAssemblerSH4):
6571 (JSC::MacroAssemblerSH4::replaceWithJump):
6572 (JSC::MacroAssemblerSH4::maxJumpReplacementSize):
6573 * assembler/MacroAssemblerX86.h:
6574 (MacroAssemblerX86):
6575 (JSC::MacroAssemblerX86::branchTest8):
6576 * assembler/MacroAssemblerX86Common.h:
6577 (JSC::MacroAssemblerX86Common::replaceWithJump):
6578 (MacroAssemblerX86Common):
6579 (JSC::MacroAssemblerX86Common::maxJumpReplacementSize):
6580 * assembler/MacroAssemblerX86_64.h:
6581 (MacroAssemblerX86_64):
6582 (JSC::MacroAssemblerX86_64::branchTest8):
6583 * assembler/X86Assembler.h:
6584 (JSC::X86Assembler::X86Assembler):
6586 (JSC::X86Assembler::cmpb_im):
6587 (JSC::X86Assembler::testb_im):
6588 (JSC::X86Assembler::labelForWatchpoint):
6589 (JSC::X86Assembler::label):
6590 (JSC::X86Assembler::replaceWithJump):
6591 (JSC::X86Assembler::maxJumpReplacementSize):
6592 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
6593 * bytecode/CodeBlock.cpp:
6595 (JSC::CodeBlock::printGetByIdCacheStatus):
6596 (JSC::CodeBlock::dump):
6597 * bytecode/CodeBlock.h:
6598 (JSC::CodeBlock::appendOSRExit):
6599 (JSC::CodeBlock::appendSpeculationRecovery):
6601 (JSC::CodeBlock::appendWatchpoint):
6602 (JSC::CodeBlock::numberOfWatchpoints):
6603 (JSC::CodeBlock::watchpoint):
6605 * bytecode/DFGExitProfile.h:
6606 (JSC::DFG::exitKindToString):
6607 (JSC::DFG::exitKindIsCountable):
6608 * bytecode/GetByIdStatus.cpp:
6609 (JSC::GetByIdStatus::computeForChain):
6610 * bytecode/Instruction.h:
6612 (JSC::Instruction::Instruction):
6613 * bytecode/Opcode.h:
6615 (JSC::padOpcodeName):
6616 * bytecode/Watchpoint.cpp: Added.
6618 (JSC::Watchpoint::~Watchpoint):
6619 (JSC::Watchpoint::correctLabels):
6620 (JSC::Watchpoint::fire):
6621 (JSC::WatchpointSet::WatchpointSet):
6622 (JSC::WatchpointSet::~WatchpointSet):
6623 (JSC::WatchpointSet::add):
6624 (JSC::WatchpointSet::notifyWriteSlow):
6625 (JSC::WatchpointSet::fireAllWatchpoints):
6626 * bytecode/Watchpoint.h: Added.
6629 (JSC::Watchpoint::Watchpoint):
6630 (JSC::Watchpoint::setDestination):
6632 (JSC::WatchpointSet::isStillValid):
6633 (JSC::WatchpointSet::hasBeenInvalidated):
6634 (JSC::WatchpointSet::startWatching):
6635 (JSC::WatchpointSet::notifyWrite):
6636 (JSC::WatchpointSet::addressOfIsWatched):
6637 * bytecompiler/BytecodeGenerator.cpp:
6638 (JSC::ResolveResult::checkValidity):
6639 (JSC::BytecodeGenerator::addGlobalVar):
6640 (JSC::BytecodeGenerator::BytecodeGenerator):
6641 (JSC::BytecodeGenerator::resolve):
6642 (JSC::BytecodeGenerator::emitResolve):
6643 (JSC::BytecodeGenerator::emitResolveWithBase):
6644 (JSC::BytecodeGenerator::emitResolveWithThis):
6645 (JSC::BytecodeGenerator::emitGetStaticVar):
6646 (JSC::BytecodeGenerator::emitPutStaticVar):
6647 * bytecompiler/BytecodeGenerator.h:
6648 (BytecodeGenerator):
6649 * bytecompiler/NodesCodegen.cpp:
6650 (JSC::FunctionCallResolveNode::emitBytecode):
6651 (JSC::PostfixResolveNode::emitBytecode):
6652 (JSC::PrefixResolveNode::emitBytecode):
6653 (JSC::ReadModifyResolveNode::emitBytecode):
6654 (JSC::AssignResolveNode::emitBytecode):
6655 (JSC::ConstDeclNode::emitCodeSingle):
6656 * dfg/DFGAbstractState.cpp:
6657 (JSC::DFG::AbstractState::execute):
6658 (JSC::DFG::AbstractState::clobberStructures):
6659 * dfg/DFGAbstractState.h:
6661 (JSC::DFG::AbstractState::didClobber):
6662 * dfg/DFGByteCodeParser.cpp:
6663 (JSC::DFG::ByteCodeParser::handleInlining):
6664 (JSC::DFG::ByteCodeParser::parseBlock):
6665 * dfg/DFGCCallHelpers.h:
6667 (JSC::DFG::CCallHelpers::setupArguments):
6668 * dfg/DFGCSEPhase.cpp:
6669 (JSC::DFG::CSEPhase::globalVarWatchpointElimination):
6671 (JSC::DFG::CSEPhase::globalVarStoreElimination):
6672 (JSC::DFG::CSEPhase::performNodeCSE):
6673 * dfg/DFGCapabilities.h:
6674 (JSC::DFG::canCompileOpcode):
6675 * dfg/DFGConstantFoldingPhase.cpp:
6676 (JSC::DFG::ConstantFoldingPhase::run):
6677 * dfg/DFGCorrectableJumpPoint.h:
6678 (JSC::DFG::CorrectableJumpPoint::isSet):
6679 (CorrectableJumpPoint):
6680 * dfg/DFGJITCompiler.cpp:
6681 (JSC::DFG::JITCompiler::linkOSRExits):
6682 (JSC::DFG::JITCompiler::link):
6684 (JSC::DFG::Node::hasIdentifierNumberForCheck):
6686 (JSC::DFG::Node::identifierNumberForCheck):
6687 (JSC::DFG::Node::hasRegisterPointer):
6688 * dfg/DFGNodeType.h:
6690 * dfg/DFGOSRExit.cpp:
6691 (JSC::DFG::OSRExit::OSRExit):
6694 * dfg/DFGOperations.cpp:
6695 * dfg/DFGOperations.h:
6696 * dfg/DFGPredictionPropagationPhase.cpp:
6697 (JSC::DFG::PredictionPropagationPhase::propagate):
6698 * dfg/DFGSpeculativeJIT.h:
6699 (JSC::DFG::SpeculativeJIT::callOperation):
6700 (JSC::DFG::SpeculativeJIT::appendCall):
6702 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
6703 * dfg/DFGSpeculativeJIT32_64.cpp:
6704 (JSC::DFG::SpeculativeJIT::compile):
6705 * dfg/DFGSpeculativeJIT64.cpp:
6706 (JSC::DFG::SpeculativeJIT::compile):
6707 * interpreter/Interpreter.cpp:
6708 (JSC::Interpreter::privateExecute):
6710 (JSC::JIT::privateCompileMainPass):
6711 (JSC::JIT::privateCompileSlowCases):
6713 * jit/JITPropertyAccess.cpp:
6714 (JSC::JIT::emit_op_put_global_var_check):
6716 (JSC::JIT::emitSlow_op_put_global_var_check):
6717 * jit/JITPropertyAccess32_64.cpp:
6718 (JSC::JIT::emit_op_put_global_var_check):
6720 (JSC::JIT::emitSlow_op_put_global_var_check):
6722 (JSC::DEFINE_STUB_FUNCTION):
6725 * llint/LLIntSlowPaths.cpp:
6726 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
6728 * llint/LLIntSlowPaths.h:
6730 * llint/LowLevelInterpreter32_64.asm:
6731 * llint/LowLevelInterpreter64.asm:
6732 * runtime/JSObject.cpp:
6733 (JSC::JSObject::removeDirect):
6734 * runtime/JSObject.h:
6736 * runtime/JSSymbolTableObject.h:
6737 (JSC::symbolTableGet):
6738 (JSC::symbolTablePut):
6739 (JSC::symbolTablePutWithAttributes):
6740 * runtime/SymbolTable.cpp: Added.
6742 (JSC::SymbolTableEntry::copySlow):
6743 (JSC::SymbolTableEntry::freeFatEntrySlow):
6744 (JSC::SymbolTableEntry::couldBeWatched):
6745 (JSC::SymbolTableEntry::attemptToWatch):
6746 (JSC::SymbolTableEntry::addressOfIsWatched):
6747 (JSC::SymbolTableEntry::addWatchpoint):
6748 (JSC::SymbolTableEntry::notifyWriteSlow):
6749 (JSC::SymbolTableEntry::inflateSlow):
6750 * runtime/SymbolTable.h:
6754 (JSC::SymbolTableEntry::Fast::Fast):
6755 (JSC::SymbolTableEntry::Fast::isNull):
6756 (JSC::SymbolTableEntry::Fast::getIndex):
6757 (JSC::SymbolTableEntry::Fast::isReadOnly):
6758 (JSC::SymbolTableEntry::Fast::getAttributes):
6759 (JSC::SymbolTableEntry::Fast::isFat):
6760 (JSC::SymbolTableEntry::SymbolTableEntry):
6761 (JSC::SymbolTableEntry::~SymbolTableEntry):
6762 (JSC::SymbolTableEntry::operator=):
6763 (JSC::SymbolTableEntry::isNull):
6764 (JSC::SymbolTableEntry::getIndex):
6765 (JSC::SymbolTableEntry::getFast):
6766 (JSC::SymbolTableEntry::getAttributes):
6767 (JSC::SymbolTableEntry::isReadOnly):
6768 (JSC::SymbolTableEntry::watchpointSet):
6769 (JSC::SymbolTableEntry::notifyWrite):
6771 (JSC::SymbolTableEntry::FatEntry::FatEntry):
6772 (JSC::SymbolTableEntry::isFat):
6773 (JSC::SymbolTableEntry::fatEntry):
6774 (JSC::SymbolTableEntry::inflate):
6775 (JSC::SymbolTableEntry::bits):
6776 (JSC::SymbolTableEntry::freeFatEntry):
6777 (JSC::SymbolTableEntry::pack):
6778 (JSC::SymbolTableEntry::isValidIndex):
6780 2012-06-13 Sheriff Bot <webkit.review.bot@gmail.com>
6782 Unreviewed, rolling out r120172.
6783 http://trac.webkit.org/changeset/120172
6784 https://bugs.webkit.org/show_bug.cgi?id=88976
6786 The patch causes compilation failures on Gtk, Qt and Apple Win
6787 bots (Requested by zdobersek on #webkit).
6790 * GNUmakefile.list.am:
6791 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
6792 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6793 * JavaScriptCore.xcodeproj/project.pbxproj:
6795 * assembler/ARMv7Assembler.h:
6796 (JSC::ARMv7Assembler::nop):
6797 (JSC::ARMv7Assembler::label):
6798 (JSC::ARMv7Assembler::readPointer):
6800 * assembler/AbstractMacroAssembler.h:
6802 (AbstractMacroAssembler):
6804 * assembler/AssemblerBuffer.h:
6805 * assembler/MacroAssemblerARM.h:
6806 * assembler/MacroAssemblerARMv7.h:
6807 (JSC::MacroAssemblerARMv7::nop):
6808 (JSC::MacroAssemblerARMv7::jump):
6809 (JSC::MacroAssemblerARMv7::makeBranch):
6810 * assembler/MacroAssemblerMIPS.h:
6811 * assembler/MacroAssemblerSH4.h:
6812 * assembler/MacroAssemblerX86.h:
6813 (MacroAssemblerX86):
6814 (JSC::MacroAssemblerX86::moveWithPatch):
6815 * assembler/MacroAssemblerX86Common.h:
6816 * assembler/MacroAssemblerX86_64.h:
6817 (JSC::MacroAssemblerX86_64::branchTest8):
6818 * assembler/X86Assembler.h:
6819 (JSC::X86Assembler::cmpb_im):
6820 (JSC::X86Assembler::codeSize):
6821 (JSC::X86Assembler::label):
6822 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
6823 * bytecode/CodeBlock.cpp:
6824 (JSC::CodeBlock::dump):
6825 * bytecode/CodeBlock.h:
6826 (JSC::CodeBlock::appendOSRExit):
6827 (JSC::CodeBlock::appendSpeculationRecovery):
6829 * bytecode/DFGExitProfile.h:
6830 (JSC::DFG::exitKindToString):
6831 (JSC::DFG::exitKindIsCountable):
6832 * bytecode/Instruction.h:
6833 * bytecode/Opcode.h:
6835 (JSC::padOpcodeName):
6836 * bytecode/Watchpoint.cpp: Removed.
6837 * bytecode/Watchpoint.h: Removed.
6838 * bytecompiler/BytecodeGenerator.cpp:
6839 (JSC::ResolveResult::checkValidity):
6840 (JSC::BytecodeGenerator::addGlobalVar):
6841 (JSC::BytecodeGenerator::BytecodeGenerator):
6842 (JSC::BytecodeGenerator::resolve):
6843 (JSC::BytecodeGenerator::emitResolve):
6844 (JSC::BytecodeGenerator::emitResolveWithBase):
6845 (JSC::BytecodeGenerator::emitResolveWithThis):
6846 (JSC::BytecodeGenerator::emitGetStaticVar):
6847 (JSC::BytecodeGenerator::emitPutStaticVar):
6848 * bytecompiler/BytecodeGenerator.h:
6849 (BytecodeGenerator):
6850 * bytecompiler/NodesCodegen.cpp:
6851 (JSC::FunctionCallResolveNode::emitBytecode):
6852 (JSC::PostfixResolveNode::emitBytecode):
6853 (JSC::PrefixResolveNode::emitBytecode):
6854 (JSC::ReadModifyResolveNode::emitBytecode):
6855 (JSC::AssignResolveNode::emitBytecode):
6856 (JSC::ConstDeclNode::emitCodeSingle):
6857 * dfg/DFGAbstractState.cpp:
6858 (JSC::DFG::AbstractState::execute):
6859 (JSC::DFG::AbstractState::clobberStructures):
6860 * dfg/DFGAbstractState.h:
6862 * dfg/DFGByteCodeParser.cpp:
6863 (JSC::DFG::ByteCodeParser::handleInlining):
6864 (JSC::DFG::ByteCodeParser::parseBlock):
6865 * dfg/DFGCCallHelpers.h:
6866 (JSC::DFG::CCallHelpers::setupArguments):
6867 * dfg/DFGCSEPhase.cpp:
6868 (JSC::DFG::CSEPhase::globalVarStoreElimination):
6869 (JSC::DFG::CSEPhase::performNodeCSE):
6870 * dfg/DFGCapabilities.h:
6871 (JSC::DFG::canCompileOpcode):
6872 * dfg/DFGConstantFoldingPhase.cpp:
6873 (JSC::DFG::ConstantFoldingPhase::run):
6874 * dfg/DFGCorrectableJumpPoint.h:
6875 * dfg/DFGJITCompiler.cpp:
6876 (JSC::DFG::JITCompiler::linkOSRExits):
6877 (JSC::DFG::JITCompiler::link):
6879 (JSC::DFG::Node::hasRegisterPointer):
6880 * dfg/DFGNodeType.h:
6882 * dfg/DFGOSRExit.cpp:
6883 (JSC::DFG::OSRExit::OSRExit):
6886 * dfg/DFGOperations.cpp:
6887 * dfg/DFGOperations.h:
6888 * dfg/DFGPredictionPropagationPhase.cpp:
6889 (JSC::DFG::PredictionPropagationPhase::propagate):
6890 * dfg/DFGSpeculativeJIT.h:
6891 (JSC::DFG::SpeculativeJIT::callOperation):
6892 (JSC::DFG::SpeculativeJIT::appendCallSetResult):
6893 (JSC::DFG::SpeculativeJIT::speculationCheck):
6894 * dfg/DFGSpeculativeJIT32_64.cpp:
6895 (JSC::DFG::SpeculativeJIT::compile):
6896 * dfg/DFGSpeculativeJIT64.cpp:
6897 (JSC::DFG::SpeculativeJIT::compile):
6899 (JSC::JIT::privateCompileMainPass):
6900 (JSC::JIT::privateCompileSlowCases):
6902 * jit/JITPropertyAccess.cpp:
6903 * jit/JITPropertyAccess32_64.cpp:
6906 * llint/LLIntSlowPaths.cpp:
6907 * llint/LLIntSlowPaths.h:
6909 * llint/LowLevelInterpreter32_64.asm:
6910 * llint/LowLevelInterpreter64.asm:
6911 * runtime/JSObject.cpp:
6912 (JSC::JSObject::removeDirect):
6913 * runtime/JSObject.h:
6915 * runtime/JSSymbolTableObject.h:
6916 (JSC::symbolTableGet):
6917 (JSC::symbolTablePut):
6918 (JSC::symbolTablePutWithAttributes):
6919 * runtime/SymbolTable.cpp: Removed.
6920 * runtime/SymbolTable.h:
6922 (JSC::SymbolTableEntry::isNull):
6923 (JSC::SymbolTableEntry::getIndex):
6925 (JSC::SymbolTableEntry::getAttributes):
6926 (JSC::SymbolTableEntry::isReadOnly):
6927 (JSC::SymbolTableEntry::pack):
6928 (JSC::SymbolTableEntry::isValidIndex):
6930 2012-06-12 Filip Pizlo <fpizlo@apple.com>
6932 DFG should be able to set watchpoints on global variables
6933 https://bugs.webkit.org/show_bug.cgi?id=88692
6935 Reviewed by Geoffrey Garen.
6937 This implements global variable constant folding by allowing the optimizing
6938 compiler to set a "watchpoint" on globals that it wishes to constant fold.
6939 If the watchpoint fires, then an OSR exit is forced by overwriting the
6940 machine code that the optimizing compiler generated with a jump.
6942 As such, this patch is adding quite a bit of stuff:
6944 - Jump replacement on those hardware targets supported by the optimizing
6945 JIT. It is now possible to patch in a jump instruction over any recorded
6946 watchpoint label. The jump must be "local" in the sense that it must be
6947 within the range of the largest jump distance supported by a one
6950 - WatchpointSets and Watchpoints. A Watchpoint is a doubly-linked list node
6951 that records the location where a jump must be inserted and the
6952 destination to which it should jump. Watchpoints can be added to a
6953 WatchpointSet. The WatchpointSet can be fired all at once, which plants
6954 all jumps. WatchpointSet also remembers if it had ever been invalidated,
6955 which allows for monotonicity: we typically don't want to optimize using
6956 watchpoints on something for which watchpoints had previously fired. The
6957 act of notifying a WatchpointSet has a trivial fast path in case no
6958 Watchpoints are registered (one-byte load+branch).
6960 - SpeculativeJIT::speculationWatchpoint(). It's like speculationCheck(),
6961 except that you don't have to emit branches. But, you need to know what
6962 WatchpointSet to add the resulting Watchpoint to. Not everything that
6963 you could write a speculationCheck() for will have a WatchpointSet that
6964 would get notified if the condition you were speculating against became
6967 - SymbolTableEntry now has the ability to refer to a WatchpointSet. It can
6968 do so without incurring any space overhead for those entries that don't
6969 have WatchpointSets.
6971 - The bytecode generator infers all global function variables to be
6972 watchable, and makes all stores perform the WatchpointSet's write check,
6973 and marks all loads as being potentially watchable (i.e. you can compile
6974 them to a watchpoint and a constant).
6976 Put together, this allows for fully sleazy inlining of calls to globally
6977 declared functions. The inline prologue will no longer contain the load of
6978 the function, or any checks of the function you're calling. I.e. it's
6979 pretty much like the kind of inlining you would see in Java or C++.
6980 Furthermore, the watchpointing functionality is built to be fairly general,
6981 and should allow setting watchpoints on all sorts of interesting things
6984 The sleazy inlining means that we will now sometimes inline in code paths
6985 that have never executed. Previously, to inline we would have either had
6986 to have executed the call (to read the call's inline cache) or have
6987 executed the method check (to read the method check's inline cache). Now,
6988 we might inline when the callee is a watched global variable. This
6989 revealed some humorous bugs. First, constant folding disagreed with CFA
6990 over what kinds of operations can clobber (example: code path A is dead
6991 but stores a String into variable X, all other code paths store 0 into
6992 X, and then you do CompareEq(X, 0) - CFA will say that this is a non-
6993 clobbering constant, but constant folding thought it was clobbering
6994 because it saw the String prediction). Second, inlining would crash if
6995 the inline callee had not been compiled. This patch fixes both bugs,
6996 since otherwise run-javascriptcore-tests would report regressions.
6999 * GNUmakefile.list.am:
7000 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7001 * JavaScriptCore.xcodeproj/project.pbxproj:
7003 * assembler/ARMv7Assembler.h:
7005 (JSC::ARMv7Assembler::ARMv7Assembler):
7006 (JSC::ARMv7Assembler::labelForWatchpoint):
7007 (JSC::ARMv7Assembler::label):
7008 (JSC::ARMv7Assembler::replaceWithJump):
7009 (JSC::ARMv7Assembler::maxJumpReplacementSize):
7010 * assembler/AbstractMacroAssembler.h:
7012 (AbstractMacroAssembler):
7014 (JSC::AbstractMacroAssembler::watchpointLabel):
7015 * assembler/AssemblerBuffer.h:
7016 * assembler/MacroAssemblerARM.h:
7017 (JSC::MacroAssemblerARM::replaceWithJump):
7018 (MacroAssemblerARM):
7019 (JSC::MacroAssemblerARM::maxJumpReplacementSize):
7020 * assembler/MacroAssemblerARMv7.h:
7021 (MacroAssemblerARMv7):
7022 (JSC::MacroAssemblerARMv7::replaceWithJump):
7023 (JSC::MacroAssemblerARMv7::maxJumpReplacementSize):
7024 (JSC::MacroAssemblerARMv7::branchTest8):
7025 (JSC::MacroAssemblerARMv7::jump):
7026 (JSC::MacroAssemblerARMv7::makeBranch):
7027 * assembler/MacroAssemblerMIPS.h:
7028 (JSC::MacroAssemblerMIPS::replaceWithJump):
7029 (MacroAssemblerMIPS):
7030 (JSC::MacroAssemblerMIPS::maxJumpReplacementSize):
7031 * assembler/MacroAssemblerSH4.h:
7032 (JSC::MacroAssemblerSH4::replaceWithJump):
7033 (MacroAssemblerSH4):
7034 (JSC::MacroAssemblerSH4::maxJumpReplacementSize):
7035 * assembler/MacroAssemblerX86.h:
7036 (MacroAssemblerX86):
7037 (JSC::MacroAssemblerX86::branchTest8):
7038 * assembler/MacroAssemblerX86Common.h:
7039 (JSC::MacroAssemblerX86Common::replaceWithJump):
7040 (MacroAssemblerX86Common):
7041 (JSC::MacroAssemblerX86Common::maxJumpReplacementSize):
7042 * assembler/MacroAssemblerX86_64.h:
7043 (MacroAssemblerX86_64):
7044 (JSC::MacroAssemblerX86_64::branchTest8):
7045 * assembler/X86Assembler.h:
7046 (JSC::X86Assembler::X86Assembler):
7048 (JSC::X86Assembler::cmpb_im):
7049 (JSC::X86Assembler::testb_im):
7050 (JSC::X86Assembler::labelForWatchpoint):
7051 (JSC::X86Assembler::label):
7052 (JSC::X86Assembler::replaceWithJump):
7053 (JSC::X86Assembler::maxJumpReplacementSize):
7054 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
7055 * bytecode/CodeBlock.cpp:
7056 (JSC::CodeBlock::dump):
7057 * bytecode/CodeBlock.h:
7058 (JSC::CodeBlock::appendOSRExit):
7059 (JSC::CodeBlock::appendSpeculationRecovery):
7061 (JSC::CodeBlock::appendWatchpoint):
7062 (JSC::CodeBlock::numberOfWatchpoints):
7063 (JSC::CodeBlock::watchpoint):
7065 * bytecode/DFGExitProfile.h:
7066 (JSC::DFG::exitKindToString):
7067 (JSC::DFG::exitKindIsCountable):
7068 * bytecode/Instruction.h:
7070 (JSC::Instruction::Instruction):
7071 * bytecode/Opcode.h:
7073 (JSC::padOpcodeName):
7074 * bytecode/Watchpoint.cpp: Added.
7076 (JSC::Watchpoint::~Watchpoint):
7077 (JSC::Watchpoint::correctLabels):
7078 (JSC::Watchpoint::fire):
7079 (JSC::WatchpointSet::WatchpointSet):
7080 (JSC::WatchpointSet::~WatchpointSet):
7081 (JSC::WatchpointSet::add):
7082 (JSC::WatchpointSet::notifyWriteSlow):
7083 (JSC::WatchpointSet::fireAllWatchpoints):
7084 * bytecode/Watchpoint.h: Added.
7087 (JSC::Watchpoint::Watchpoint):
7088 (JSC::Watchpoint::setDestination):
7090 (JSC::WatchpointSet::isStillValid):
7091 (JSC::WatchpointSet::hasBeenInvalidated):
7092 (JSC::WatchpointSet::startWatching):
7093 (JSC::WatchpointSet::notifyWrite):
7094 (JSC::WatchpointSet::addressOfIsWatched):
7095 * bytecompiler/BytecodeGenerator.cpp:
7096 (JSC::ResolveResult::checkValidity):
7097 (JSC::BytecodeGenerator::addGlobalVar):
7098 (JSC::BytecodeGenerator::BytecodeGenerator):
7099 (JSC::BytecodeGenerator::resolve):
7100 (JSC::BytecodeGenerator::emitResolve):
7101 (JSC::BytecodeGenerator::emitResolveWithBase):
7102 (JSC::BytecodeGenerator::emitResolveWithThis):
7103 (JSC::BytecodeGenerator::emitGetStaticVar):
7104 (JSC::BytecodeGenerator::emitPutStaticVar):
7105 * bytecompiler/BytecodeGenerator.h:
7106 (BytecodeGenerator):
7107 * bytecompiler/NodesCodegen.cpp:
7108 (JSC::FunctionCallResolveNode::emitBytecode):
7109 (JSC::PostfixResolveNode::emitBytecode):
7110 (JSC::PrefixResolveNode::emitBytecode):
7111 (JSC::ReadModifyResolveNode::emitBytecode):
7112 (JSC::AssignResolveNode::emitBytecode):
7113 (JSC::ConstDeclNode::emitCodeSingle):
7114 * dfg/DFGAbstractState.cpp:
7115 (JSC::DFG::AbstractState::execute):
7116 (JSC::DFG::AbstractState::clobberStructures):
7117 * dfg/DFGAbstractState.h:
7119 (JSC::DFG::AbstractState::didClobber):
7120 * dfg/DFGByteCodeParser.cpp:
7121 (JSC::DFG::ByteCodeParser::handleInlining):
7122 (JSC::DFG::ByteCodeParser::parseBlock):
7123 * dfg/DFGCCallHelpers.h:
7125 (JSC::DFG::CCallHelpers::setupArguments):
7126 * dfg/DFGCSEPhase.cpp:
7127 (JSC::DFG::CSEPhase::globalVarWatchpointElimination):
7129 (JSC::DFG::CSEPhase::globalVarStoreElimination):
7130 (JSC::DFG::CSEPhase::performNodeCSE):
7131 * dfg/DFGCapabilities.h:
7132 (JSC::DFG::canCompileOpcode):
7133 * dfg/DFGConstantFoldingPhase.cpp:
7134 (JSC::DFG::ConstantFoldingPhase::run):
7135 * dfg/DFGCorrectableJumpPoint.h:
7136 (JSC::DFG::CorrectableJumpPoint::isSet):
7137 (CorrectableJumpPoint):
7138 * dfg/DFGJITCompiler.cpp:
7139 (JSC::DFG::JITCompiler::linkOSRExits):
7140 (JSC::DFG::JITCompiler::link):
7142 (JSC::DFG::Node::hasIdentifierNumberForCheck):
7144 (JSC::DFG::Node::identifierNumberForCheck):
7145 (JSC::DFG::Node::hasRegisterPointer):
7146 * dfg/DFGNodeType.h:
7148 * dfg/DFGOSRExit.cpp:
7149 (JSC::DFG::OSRExit::OSRExit):
7152 * dfg/DFGOperations.cpp:
7153 * dfg/DFGOperations.h:
7154 * dfg/DFGPredictionPropagationPhase.cpp:
7155 (JSC::DFG::PredictionPropagationPhase::propagate):
7156 * dfg/DFGSpeculativeJIT.h:
7157 (JSC::DFG::SpeculativeJIT::callOperation):
7158 (JSC::DFG::SpeculativeJIT::appendCall):
7160 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
7161 * dfg/DFGSpeculativeJIT32_64.cpp:
7162 (JSC::DFG::SpeculativeJIT::compile):
7163 * dfg/DFGSpeculativeJIT64.cpp:
7164 (JSC::DFG::SpeculativeJIT::compile):
7166 (JSC::JIT::privateCompileMainPass):
7167 (JSC::JIT::privateCompileSlowCases):
7169 * jit/JITPropertyAccess.cpp:
7170 (JSC::JIT::emit_op_put_global_var_check):
7172 (JSC::JIT::emitSlow_op_put_global_var_check):
7173 * jit/JITPropertyAccess32_64.cpp:
7174 (JSC::JIT::emit_op_put_global_var_check):
7176 (JSC::JIT::emitSlow_op_put_global_var_check):
7178 (JSC::JITThunks::JITThunks):
7179 (JSC::DEFINE_STUB_FUNCTION):
7182 * llint/LLIntSlowPaths.cpp:
7183 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
7185 * llint/LLIntSlowPaths.h:
7187 * llint/LowLevelInterpreter32_64.asm:
7188 * llint/LowLevelInterpreter64.asm:
7189 * runtime/JSObject.cpp:
7190 (JSC::JSObject::removeDirect):
7191 * runtime/JSObject.h:
7193 * runtime/JSSymbolTableObject.h:
7194 (JSC::symbolTableGet):
7195 (JSC::symbolTablePut):
7196 (JSC::symbolTablePutWithAttributes):
7197 * runtime/SymbolTable.cpp: Added.
7199 (JSC::SymbolTableEntry::copySlow):
7200 (JSC::SymbolTableEntry::freeFatEntrySlow):
7201 (JSC::SymbolTableEntry::couldBeWatched):
7202 (JSC::SymbolTableEntry::attemptToWatch):
7203 (JSC::SymbolTableEntry::addressOfIsWatched):
7204 (JSC::SymbolTableEntry::addWatchpoint):
7205 (JSC::SymbolTableEntry::notifyWriteSlow):
7206 (JSC::SymbolTableEntry::inflateSlow):
7207 * runtime/SymbolTable.h:
7211 (JSC::SymbolTableEntry::Fast::Fast):
7212 (JSC::SymbolTableEntry::Fast::isNull):
7213 (JSC::SymbolTableEntry::Fast::getIndex):
7214 (JSC::SymbolTableEntry::Fast::isReadOnly):
7215 (JSC::SymbolTableEntry::Fast::getAttributes):
7216 (JSC::SymbolTableEntry::Fast::isFat):
7217 (JSC::SymbolTableEntry::SymbolTableEntry):
7218 (JSC::SymbolTableEntry::~SymbolTableEntry):
7219 (JSC::SymbolTableEntry::operator=):
7220 (JSC::SymbolTableEntry::isNull):
7221 (JSC::SymbolTableEntry::getIndex):
7222 (JSC::SymbolTableEntry::getFast):
7223 (JSC::SymbolTableEntry::getAttributes):
7224 (JSC::SymbolTableEntry::isReadOnly):
7225 (JSC::SymbolTableEntry::watchpointSet):
7226 (JSC::SymbolTableEntry::notifyWrite):
7228 (JSC::SymbolTableEntry::FatEntry::FatEntry):
7229 (JSC::SymbolTableEntry::isFat):
7230 (JSC::SymbolTableEntry::fatEntry):
7231 (JSC::SymbolTableEntry::inflate):
7232 (JSC::SymbolTableEntry::bits):
7233 (JSC::SymbolTableEntry::freeFatEntry):
7234 (JSC::SymbolTableEntry::pack):
7235 (JSC::SymbolTableEntry::isValidIndex):
7237 2012-06-12 Filip Pizlo <fpizlo@apple.com>
7239 Unreviewed build fix for ARMv7 debug builds.
7242 (JSC::JITThunks::JITThunks):
7244 2012-06-12 Geoffrey Garen <ggaren@apple.com>
7246 Build fix for case-sensitive file systems: use the right case.
7248 * heap/ListableHandler.h:
7250 2012-06-11 Geoffrey Garen <ggaren@apple.com>
7252 GC should be 1.7X faster
7253 https://bugs.webkit.org/show_bug.cgi?id=88840
7255 Reviewed by Oliver Hunt.
7257 I profiled, and removed anything that showed up as a concurrency
7258 bottleneck. Then, I added 3 threads to our max thread count, since we
7259 can scale up to more threads now.
7261 * heap/BlockAllocator.cpp:
7262 (JSC::BlockAllocator::BlockAllocator):
7263 (JSC::BlockAllocator::~BlockAllocator):
7264 (JSC::BlockAllocator::releaseFreeBlocks):
7265 (JSC::BlockAllocator::waitForRelativeTimeWhileHoldingLock):
7266 (JSC::BlockAllocator::waitForRelativeTime):
7267 (JSC::BlockAllocator::blockFreeingThreadMain):
7268 * heap/BlockAllocator.h:
7270 (JSC::BlockAllocator::allocate):
7271 (JSC::BlockAllocator::deallocate): Use a spin lock for the common case
7272 where we're just popping a linked list. (A pthread mutex would sleep our
7273 thread even if the lock were only contended for a microsecond.)
7275 Scope the lock to avoid holding it while allocating VM, since that's a
7276 slow activity and it doesn't modify any of our data structures.
7278 We still use a pthread mutex to handle our condition variable since we
7279 have to, and it's not a hot path.
7281 * heap/CopiedSpace.cpp:
7282 (JSC::CopiedSpace::CopiedSpace):
7283 (JSC::CopiedSpace::doneFillingBlock):
7284 * heap/CopiedSpace.h:
7285 (JSC::CopiedSpace::CopiedSpace): Use a spin lock for the to space lock,
7286 since it just guards linked list and hash table manipulation.
7288 * heap/MarkStack.cpp:
7289 (JSC::MarkStackSegmentAllocator::MarkStackSegmentAllocator):
7290 (JSC::MarkStackSegmentAllocator::allocate):
7291 (JSC::MarkStackSegmentAllocator::release):
7292 (JSC::MarkStackSegmentAllocator::shrinkReserve): Use a spin lock, since
7293 we're just managing a linked list.
7295 (JSC::MarkStackArray::donateSomeCellsTo): Changed donation to be proportional
7296 to our current stack size. This fixes cases where we used to donate too
7297 much. Interestingly, donating too much was starving the donor (when it
7298 ran out of work later) *and* the recipient (since it had to wait on a
7299 long donation operation to complete before it could acquire the lock).
7301 In the worst case, we're still guaranteed to donate N cells in roughly log N time.
7303 This change also fixes cases where we used to donate too little, since
7304 we would always keep a fixed minimum number of cells. In the worst case,
7305 with N marking threads, would could have N large object graph roots in
7306 our stack for the duration of GC, and scale to only 1 thread.
7308 It's an interesting observation that a single object in the mark stack
7309 might represent an arbitrarily large object graph -- and only the act
7310 of marking can find out.
7312 (JSC::MarkStackArray::stealSomeCellsFrom): Steal in proportion to idle
7313 threads. Once again, this fixes cases where constants could cause us
7314 to steal too much or too little.
7316 (JSC::SlotVisitor::donateKnownParallel): Always wake up other threads
7317 if they're idle. We can afford to do this because we're conservative
7318 about when we donate.
7320 (JSC::SlotVisitor::drainFromShared):
7322 (MarkStackSegmentAllocator):
7325 * heap/SlotVisitor.h: Merged the "should I donate?" decision into a
7326 single function, for simplicity.
7328 * runtime/Options.cpp:
7329 (minimumNumberOfScansBetweenRebalance): Reduced the delay before donation
7330 a lot. We can afford to do this because, in the common case, donation is
7331 a single branch that decides not to donate.
7333 (cpusToUse): Use more CPUs now, since we scale better now.
7335 * runtime/Options.h:
7336 (Options): Removed now-unused variables.
7338 2012-06-12 Filip Pizlo <fpizlo@apple.com>
7340 REGRESSION(120121): inspector tests crash in DFG
7341 https://bugs.webkit.org/show_bug.cgi?id=88941
7343 Reviewed by Geoffrey Garen.
7345 The CFG simplifier has two different ways of fixing up GetLocal, Phantom, and Flush. If we've
7346 already fixed up the node one way, we shouldn't try the other way. The reason why we shouldn't
7347 is that the second way depends on the node referring to other nodes in the to-be-jettisoned
7348 block. After fixup they potentially will refer to nodes in the block being merged to.
7350 * dfg/DFGCFGSimplificationPhase.cpp:
7351 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
7352 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
7354 2012-06-12 Leo Yang <leo.yang@torchmobile.com.cn>
7356 Dynamic hash table in DOMObjectHashTableMap is wrong in multiple threads
7357 https://bugs.webkit.org/show_bug.cgi?id=87334
7359 Reviewed by Geoffrey Garen.
7361 Add a copy member function to JSC::HasTable. This function will copy all data
7362 members except for *table* which contains thread specific data that prevents
7363 up copying it. When you want to copy a JSC::HashTable that was constructed
7364 on another thread you should call JSC::HashTable::copy().
7367 (JSC::HashTable::copy):
7370 2012-06-12 Filip Pizlo <fpizlo@apple.com>
7372 DFG should not ASSERT if you have a double use of a variable that is not revealed to be a double
7373 until after CFG simplification
7374 https://bugs.webkit.org/show_bug.cgi?id=88927
7375 <rdar://problem/11513971>
7377 Reviewed by Geoffrey Garen.
7379 Speculation fixup needs to run if simplification did things, because simplification can change
7380 predictions - particularly if you had a control flow path that stored weird things into a
7381 variable, but that path got axed by the simplifier.
7383 Running fixup in the fixpoint requires making it idempotent, which it previously wasn't. Only
7384 one place needed to be changed, namely the un-MustGenerate-ion of ValueToInt32.
7386 * dfg/DFGDriver.cpp:
7387 (JSC::DFG::compile):
7388 * dfg/DFGFixupPhase.cpp:
7389 (JSC::DFG::FixupPhase::fixupNode):
7391 2012-06-12 Filip Pizlo <fpizlo@apple.com>
7393 REGRESSION (r119779): Javascript TypeError: 'undefined' is not an object
7394 https://bugs.webkit.org/show_bug.cgi?id=88783
7395 <rdar://problem/11640299>
7397 Reviewed by Geoffrey Garen.
7399 If you don't keep alive the base of an object access over the various checks
7400 you do for the prototype chain, you're going to have a bad time.
7402 * dfg/DFGByteCodeParser.cpp:
7403 (JSC::DFG::ByteCodeParser::handleGetById):
7405 2012-06-12 Hojong Han <hojong.han@samsung.com>
7407 Property names of the built-in object cannot be retrieved
7408 after trying to delete one of its properties
7409 https://bugs.webkit.org/show_bug.cgi?id=86461
7411 Reviewed by Gavin Barraclough.
7413 * runtime/JSObject.cpp:
7414 (JSC::getClassPropertyNames):
7415 (JSC::JSObject::getOwnPropertyNames):
7417 2012-06-11 Gyuyoung Kim <gyuyoung.kim@samsung.com>
7419 [CMAKE][EFL] Remove duplicated executable output path
7420 https://bugs.webkit.org/show_bug.cgi?id=88765
7422 Reviewed by Daniel Bates.
7424 CMake files for EFL port have redefined executable output path. However, EFL port doesn't
7425 need to define again because it is already defined in top-level CMake file.
7427 * shell/CMakeLists.txt:
7429 2012-06-11 Carlos Garcia Campos <cgarcia@igalia.com>
7431 Unreviewed. Fix make distcheck issues.
7433 * GNUmakefile.list.am: Remove non existent header file.
7435 2012-06-10 Patrick Gansterer <paroga@webkit.org>
7437 Unreviewed. Build fix for !ENABLE(JIT) after r119844 and r119925.
7439 * runtime/Executable.h:
7441 (JSC::ExecutableBase::clearCodeVirtual):
7443 2012-06-10 Patrick Gansterer <paroga@webkit.org>
7445 Unreviewed. Build fix for !ENABLE(JIT) after r119844.
7447 * runtime/Executable.h:
7451 2012-06-09 Dominic Cooney <dominicc@chromium.org>
7453 [Chromium] Remove JavaScriptCore dependencies from gyp
7454 https://bugs.webkit.org/show_bug.cgi?id=88510
7456 Reviewed by Adam Barth.
7458 Chromium doesn't support JSC any more and there doesn't seem to be
7459 a strong interest in using GYP as the common build system in other
7462 * JavaScriptCore.gyp/JavaScriptCore.gyp: WebCore still depends on YARR interpreter.
7463 * JavaScriptCore.gypi: Only include YARR source.
7464 * gyp/JavaScriptCore.gyp: Removed.
7465 * gyp/gtk.gyp: Removed.
7467 2012-06-09 Geoffrey Garen <ggaren@apple.com>
7469 Unreviewed, rolling back in part2 of r118646.
7471 This patch removes eager finalization.
7473 Weak pointer finalization should be lazy
7474 https://bugs.webkit.org/show_bug.cgi?id=87599
7476 Reviewed by Sam Weinig.
7479 (JSC::Heap::collect): Don't finalize eagerly -- we'll do it lazily.
7481 * heap/MarkedBlock.cpp:
7482 (JSC::MarkedBlock::sweep): Do sweep weak sets when sweeping a block,
7483 since we won't get another chance.
7485 * heap/MarkedBlock.h:
7486 (JSC::MarkedBlock::sweepWeakSet):
7487 * heap/MarkedSpace.cpp:
7488 (MarkedSpace::WeakSetSweep):
7489 * heap/MarkedSpace.h:
7490 (JSC::MarkedSpace::sweepWeakSets): Removed now-unused code.
7492 2012-06-09 Sukolsak Sakshuwong <sukolsak@google.com>
7494 Add UNDO_MANAGER flag
7495 https://bugs.webkit.org/show_bug.cgi?id=87908
7497 Reviewed by Tony Chang.
7499 * Configurations/FeatureDefines.xcconfig:
7501 2012-06-08 Geoffrey Garen <ggaren@apple.com>
7503 Unreviewed, rolling back in part1 of r118646.
7505 This patch includes everything necessary for lazy finalization, but
7506 keeps eager finalization enabled for the time being.
7508 Weak pointer finalization should be lazy
7509 https://bugs.webkit.org/show_bug.cgi?id=87599
7511 Reviewed by Sam Weinig.
7513 * heap/MarkedBlock.cpp:
7514 * heap/MarkedBlock.h:
7515 (JSC::MarkedBlock::resetAllocator):
7516 * heap/MarkedSpace.cpp:
7517 (JSC::MarkedSpace::resetAllocators):
7518 * heap/MarkedSpace.h:
7519 (JSC::MarkedSpace::resetAllocators): Don't force allocator reset anymore.
7520 It will happen automatically when a weak set is swept. It's simpler to
7521 have only one canonical way for this to happen, and it wasn't buying
7522 us anything to do it eagerly.
7523 * heap/WeakBlock.cpp:
7524 (JSC::WeakBlock::sweep): Don't short-circuit a sweep unless we know
7525 the sweep would be a no-op. If even one finalizer is pending, we need to
7526 run it, since we won't get another chance.
7528 (JSC::WeakSet::sweep): This loop can be simpler now that
7529 WeakBlock::sweep() does what we mean.
7530 Reset our allocator after a sweep because this is the optimal time to
7531 start trying to recycle old weak pointers.
7532 (JSC::WeakSet::tryFindAllocator): Don't sweep when searching for an
7533 allocator because we've swept already, and forcing a new sweep would be
7536 (JSC::WeakSet::shrink): Be sure to reset our allocator after a shrink
7537 because the shrink may have removed the block the allocator was going to
7540 2012-06-08 Gavin Barraclough <barraclough@apple.com>
7542 Unreviewed roll out r119795.
7544 This broke jquery/core.html
7546 * dfg/DFGSpeculativeJIT.h:
7547 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
7548 * jit/JITInlineMethods.h:
7549 (JSC::JIT::emitAllocateBasicJSObject):
7550 * llint/LowLevelInterpreter.asm:
7551 * runtime/JSGlobalData.h:
7553 * runtime/JSGlobalThis.cpp:
7554 (JSC::JSGlobalThis::setUnwrappedObject):
7555 * runtime/JSObject.cpp:
7556 (JSC::JSObject::visitChildren):
7557 (JSC::JSObject::createInheritorID):
7558 * runtime/JSObject.h:
7560 (JSC::JSObject::resetInheritorID):
7562 (JSC::JSObject::offsetOfInheritorID):
7563 (JSC::JSObject::inheritorID):
7565 2012-06-08 Filip Pizlo <fpizlo@apple.com>
7567 PredictedType should be called SpeculatedType
7568 https://bugs.webkit.org/show_bug.cgi?id=88477
7570 Unreviewed, fix a renaming goof from http://trac.webkit.org/changeset/119660.
7571 I accidentally renamed ByteCodeParser::getPrediction to
7572 ByteCodeParser::getSpeculation. That was not the intent. This changes it
7575 * dfg/DFGByteCodeParser.cpp:
7576 (JSC::DFG::ByteCodeParser::addCall):
7577 (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
7578 (JSC::DFG::ByteCodeParser::getPrediction):
7579 (JSC::DFG::ByteCodeParser::handleCall):
7580 (JSC::DFG::ByteCodeParser::parseBlock):
7582 2012-06-08 Andy Wingo <wingo@igalia.com>
7584 Explictly mark stubs called by JIT as being internal
7585 https://bugs.webkit.org/show_bug.cgi?id=88552
7587 Reviewed by Filip Pizlo.
7589 * dfg/DFGOSRExitCompiler.h:
7590 * dfg/DFGOperations.cpp:
7591 * dfg/DFGOperations.h:
7592 * jit/HostCallReturnValue.h:
7595 * jit/ThunkGenerators.cpp:
7596 * llint/LLIntSlowPaths.h: Mark a bunch of stubs as being
7597 WTF_INTERNAL. Change most calls to SYMBOL_STRING_RELOCATION to
7598 LOCAL_REFERENCE, or GLOBAL_REFERENCE in the case of the wrappers
7599 to truly global symbols.
7600 * offlineasm/asm.rb: Generate LOCAL_REFERENCE instead of
7601 SYMBOL_STRING_RELOCATION.
7603 2012-06-08 Geoffrey Garen <ggaren@apple.com>
7605 Don't rely on weak pointers for eager CodeBlock finalization
7606 https://bugs.webkit.org/show_bug.cgi?id=88465
7608 Reviewed by Gavin Barraclough.
7610 This is incompatible with lazy weak pointer finalization.
7612 I considered just making CodeBlock finalization lazy-friendly, but it
7613 turns out that the heap is already way up in CodeBlock's business when
7614 it comes to finalization, so I decided to finish the job and move full
7615 responsibility for CodeBlock finalization into the heap.
7617 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Maybe this
7620 * debugger/Debugger.cpp: Updated for rename.
7623 (JSC::Heap::deleteAllCompiledCode): Renamed for consistency. Fixed a bug
7624 where we would not delete code for a code block that had been previously
7625 jettisoned. I don't know if this happens in practice -- I mostly did
7626 this to improve consistency with deleteUnmarkedCompiledCode.
7628 (JSC::Heap::deleteUnmarkedCompiledCode): New function, responsible for
7629 eager finalization of unmarked code blocks.
7631 (JSC::Heap::collect): Updated for rename. Updated to call
7632 deleteUnmarkedCompiledCode(), which takes care of jettisoned DFG code
7635 (JSC::Heap::addCompiledCode): Renamed, since this points to all code
7636 now, not just functions.
7639 (Heap): Keep track of all user code, not just functions. This is a
7640 negligible additional overhead, since most code is function code.
7642 * runtime/Executable.cpp:
7643 (JSC::*::finalize): Removed these functions, since we don't rely on
7644 weak pointer finalization anymore.
7646 (JSC::FunctionExecutable::FunctionExecutable): Moved linked-list stuff
7647 into base class so all executables can be in the list.
7649 (JSC::EvalExecutable::clearCode):
7650 (JSC::ProgramExecutable::clearCode):
7651 (JSC::FunctionExecutable::clearCode): All we need to do is delete our
7652 CodeBlock -- that will delete all of its internal data structures.
7654 (JSC::FunctionExecutable::clearCodeIfNotCompiling): Factored out a helper
7655 function to improve clarity.
7657 * runtime/Executable.h:
7658 (JSC::ExecutableBase): Moved linked-list stuff
7659 into base class so all executables can be in the list.
7661 (JSC::NativeExecutable::create):
7664 (JSC::ScriptExecutable::finishCreation):
7665 (JSC::EvalExecutable::create):
7667 (JSC::ProgramExecutable::create):
7668 (ProgramExecutable):
7669 (FunctionExecutable):
7670 (JSC::FunctionExecutable::create): Don't use a finalizer -- the heap
7671 will call us back to destroy our code block.
7673 (JSC::FunctionExecutable::discardCode): Renamed to clearCodeIfNotCompiling()
7676 (JSC::FunctionExecutable::isCompiling): New helper function, for clarity.
7678 (JSC::ScriptExecutable::clearCodeVirtual): New helper function, since
7679 the heap needs to make polymorphic calls to clear code.
7681 * runtime/JSGlobalData.cpp:
7682 (JSC::StackPreservingRecompiler::operator()):
7683 * runtime/JSGlobalObject.cpp:
7684 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Updated for
7687 2012-06-07 Filip Pizlo <fpizlo@apple.com>
7689 DFG should inline prototype chain accesses, and do the right things if the
7690 specific function optimization is available
7691 https://bugs.webkit.org/show_bug.cgi?id=88594
7693 Reviewed by Gavin Barraclough.
7695 Looks like a 3% win on V8.
7697 * bytecode/CodeBlock.h:
7698 (JSC::Structure::prototypeForLookup):
7700 * bytecode/GetByIdStatus.cpp:
7701 (JSC::GetByIdStatus::computeFromLLInt):
7703 (JSC::GetByIdStatus::computeForChain):
7704 (JSC::GetByIdStatus::computeFor):
7705 * bytecode/GetByIdStatus.h:
7706 (JSC::GetByIdStatus::GetByIdStatus):
7707 (JSC::GetByIdStatus::isSimple):
7708 (JSC::GetByIdStatus::chain):
7709 (JSC::GetByIdStatus::specificValue):
7711 * bytecode/StructureSet.h:
7713 (JSC::StructureSet::singletonStructure):
7714 * bytecode/StructureStubInfo.h:
7715 (JSC::StructureStubInfo::initGetByIdProto):
7716 (JSC::StructureStubInfo::initGetByIdChain):
7717 * dfg/DFGByteCodeParser.cpp:
7718 (JSC::DFG::ByteCodeParser::handleGetById):
7719 * dfg/DFGRepatch.cpp:
7720 (JSC::DFG::tryCacheGetByID):
7722 (JSC::JITThunks::tryCacheGetByID):
7723 * runtime/JSGlobalObject.h:
7724 (JSC::Structure::prototypeForLookup):
7726 * runtime/Structure.h:
7729 2012-06-07 Gavin Barraclough <barraclough@apple.com>
7731 Remove JSObject::m_inheritorID
7732 https://bugs.webkit.org/show_bug.cgi?id=88378
7734 Reviewed by Geoff Garen.
7736 This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
7737 and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
7738 Instead use a private named value in the object's property storage.
7740 * dfg/DFGSpeculativeJIT.h:
7741 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
7742 - No need m_inheritorID to initialize!
7743 * jit/JITInlineMethods.h:
7744 (JSC::JIT::emitAllocateBasicJSObject):
7745 - No need m_inheritorID to initialize!
7746 * llint/LowLevelInterpreter.asm:
7747 - No need m_inheritorID to initialize!
7748 * runtime/JSGlobalData.h:
7750 - Added private name 'm_inheritorIDKey'.
7751 * runtime/JSGlobalThis.cpp:
7752 (JSC::JSGlobalThis::setUnwrappedObject):
7753 - resetInheritorID is now passed a JSGlobalData&.
7754 * runtime/JSObject.cpp:
7755 (JSC::JSObject::visitChildren):
7756 - No m_inheritorID to be marked.
7757 (JSC::JSObject::createInheritorID):
7758 - Store the newly created inheritorID in the property map.
7759 * runtime/JSObject.h:
7760 (JSC::JSObject::resetInheritorID):
7761 - Remove the inheritorID from property storage.
7762 (JSC::JSObject::inheritorID):
7763 - Read the inheritorID from property storage.
7765 2012-06-07 Gavin Barraclough <barraclough@apple.com>
7767 Math.pow on iOS does not support denormal numbers.
7768 https://bugs.webkit.org/show_bug.cgi?id=88592
7770 Reviewed by Filip Pizlo.
7772 Import an implementation from fdlibm, detect cases where it is safe to use the system
7773 implementation & where we should fall back to fdlibm.
7775 * runtime/MathObject.cpp:
7779 - On iOS, detect cases where denormal support may be required & use fdlibm in these cases.
7780 (JSC::mathProtoFuncPow):
7781 - Changed to use mathPow.
7782 (JSC::fdlibmScalbn):
7784 - These functions imported from fdlibm; original style retained to ease future merging.
7786 2012-06-07 Patrick Gansterer <paroga@webkit.org>
7788 Unreviewed. Build fix for !ENABLE(JIT) after r119441.
7790 * interpreter/Interpreter.cpp:
7791 (JSC::Interpreter::privateExecute):
7793 2012-06-07 Andy Wingo <wingo@igalia.com>
7795 Unreviewed build fix after r119593.
7797 * llint/LLIntOfflineAsmConfig.h (OFFLINE_ASM_GLOBAL_LABEL): Fix
7798 uses of "name" to be "label", the macro's parameter. Otherwise we
7799 serialize mentions of the literal symbol "name" into the objcode.
7800 Causes a build error using GNU ld (not gold).
7802 2012-06-06 Ryosuke Niwa <rniwa@webkit.org>
7804 Chromium build fix attempt. Why do we need to list these files in gyp!?
7806 * JavaScriptCore.gypi:
7808 2012-06-06 Filip Pizlo <fpizlo@apple.com>
7810 PredictedType should be called SpeculatedType
7811 https://bugs.webkit.org/show_bug.cgi?id=88477
7813 Rubber stamped by Gavin Barraclough.
7816 * GNUmakefile.list.am:
7817 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7818 * JavaScriptCore.xcodeproj/project.pbxproj:
7820 * bytecode/CodeBlock.cpp:
7821 (JSC::CodeBlock::shouldOptimizeNow):
7822 (JSC::CodeBlock::dumpValueProfiles):
7823 * bytecode/CodeBlock.h:
7824 (JSC::CodeBlock::valueProfilePredictionForBytecodeOffset):
7825 * bytecode/LazyOperandValueProfile.cpp:
7826 (JSC::LazyOperandValueProfileParser::prediction):
7827 * bytecode/LazyOperandValueProfile.h:
7828 (LazyOperandValueProfileParser):
7829 * bytecode/PredictedType.cpp: Removed.
7830 * bytecode/PredictedType.h: Removed.
7831 * bytecode/SpeculatedType.cpp: Copied from Source/JavaScriptCore/bytecode/PredictedType.cpp.
7832 (JSC::speculationToString):
7833 (JSC::speculationToAbbreviatedString):
7834 (JSC::speculationFromClassInfo):
7835 (JSC::speculationFromStructure):
7836 (JSC::speculationFromCell):
7837 (JSC::speculationFromValue):
7838 * bytecode/SpeculatedType.h: Copied from Source/JavaScriptCore/bytecode/PredictedType.h.
7840 (JSC::isAnySpeculation):
7841 (JSC::isCellSpeculation):
7842 (JSC::isObjectSpeculation):
7843 (JSC::isFinalObjectSpeculation):
7844 (JSC::isFinalObjectOrOtherSpeculation):
7845 (JSC::isFixedIndexedStorageObjectSpeculation):
7846 (JSC::isStringSpeculation):
7847 (JSC::isArraySpeculation):
7848 (JSC::isFunctionSpeculation):
7849 (JSC::isInt8ArraySpeculation):
7850 (JSC::isInt16ArraySpeculation):
7851 (JSC::isInt32ArraySpeculation):
7852 (JSC::isUint8ArraySpeculation):
7853 (JSC::isUint8ClampedArraySpeculation):
7854 (JSC::isUint16ArraySpeculation):
7855 (JSC::isUint32ArraySpeculation):
7856 (JSC::isFloat32ArraySpeculation):
7857 (JSC::isFloat64ArraySpeculation):
7858 (JSC::isArgumentsSpeculation):
7859 (JSC::isActionableIntMutableArraySpeculation):
7860 (JSC::isActionableFloatMutableArraySpeculation):
7861 (JSC::isActionableTypedMutableArraySpeculation):
7862 (JSC::isActionableMutableArraySpeculation):
7863 (JSC::isActionableArraySpeculation):
7864 (JSC::isArrayOrOtherSpeculation):
7865 (JSC::isMyArgumentsSpeculation):
7866 (JSC::isInt32Speculation):
7867 (JSC::isDoubleRealSpeculation):
7868 (JSC::isDoubleSpeculation):
7869 (JSC::isNumberSpeculation):
7870 (JSC::isBooleanSpeculation):
7871 (JSC::isOtherSpeculation):
7872 (JSC::isEmptySpeculation):
7873 (JSC::mergeSpeculations):
7874 (JSC::mergeSpeculation):
7875 * bytecode/StructureSet.h:
7876 (JSC::StructureSet::speculationFromStructures):
7877 * bytecode/ValueProfile.h:
7878 (JSC::ValueProfileBase::ValueProfileBase):
7879 (JSC::ValueProfileBase::dump):
7880 (JSC::ValueProfileBase::computeUpdatedPrediction):
7882 * dfg/DFGAbstractState.cpp:
7883 (JSC::DFG::AbstractState::initialize):
7884 (JSC::DFG::AbstractState::execute):
7885 (JSC::DFG::AbstractState::mergeStateAtTail):
7886 * dfg/DFGAbstractState.h:
7887 (JSC::DFG::AbstractState::speculateInt32Unary):
7888 (JSC::DFG::AbstractState::speculateNumberUnary):
7889 (JSC::DFG::AbstractState::speculateBooleanUnary):
7890 (JSC::DFG::AbstractState::speculateInt32Binary):
7891 (JSC::DFG::AbstractState::speculateNumberBinary):
7892 * dfg/DFGAbstractValue.h:
7893 (JSC::DFG::StructureAbstractValue::filter):
7894 (JSC::DFG::StructureAbstractValue::speculationFromStructures):
7895 (JSC::DFG::AbstractValue::AbstractValue):
7896 (JSC::DFG::AbstractValue::clear):
7897 (JSC::DFG::AbstractValue::isClear):
7898 (JSC::DFG::AbstractValue::makeTop):
7899 (JSC::DFG::AbstractValue::clobberStructures):
7900 (JSC::DFG::AbstractValue::isTop):
7901 (JSC::DFG::AbstractValue::set):
7902 (JSC::DFG::AbstractValue::merge):
7903 (JSC::DFG::AbstractValue::filter):
7904 (JSC::DFG::AbstractValue::validateIgnoringValue):
7905 (JSC::DFG::AbstractValue::validate):
7906 (JSC::DFG::AbstractValue::checkConsistency):
7907 (JSC::DFG::AbstractValue::dump):
7909 * dfg/DFGArgumentPosition.h:
7910 (JSC::DFG::ArgumentPosition::ArgumentPosition):
7911 (JSC::DFG::ArgumentPosition::mergeArgumentAwareness):
7912 (JSC::DFG::ArgumentPosition::prediction):
7914 * dfg/DFGArgumentsSimplificationPhase.cpp:
7915 (JSC::DFG::ArgumentsSimplificationPhase::run):
7916 * dfg/DFGByteCodeParser.cpp:
7918 (JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation):
7919 (JSC::DFG::ByteCodeParser::getLocal):
7920 (JSC::DFG::ByteCodeParser::getArgument):
7921 (JSC::DFG::ByteCodeParser::addCall):
7922 (JSC::DFG::ByteCodeParser::getSpeculationWithoutOSRExit):
7923 (JSC::DFG::ByteCodeParser::getSpeculation):
7925 (JSC::DFG::ByteCodeParser::handleCall):
7926 (JSC::DFG::ByteCodeParser::handleIntrinsic):
7927 (JSC::DFG::ByteCodeParser::handleGetById):
7928 (JSC::DFG::ByteCodeParser::parseBlock):
7929 (JSC::DFG::ByteCodeParser::fixVariableAccessSpeculations):
7930 (JSC::DFG::ByteCodeParser::parse):
7931 * dfg/DFGCSEPhase.cpp:
7932 (JSC::DFG::CSEPhase::getIndexedPropertyStorageLoadElimination):
7933 (JSC::DFG::CSEPhase::performNodeCSE):
7934 * dfg/DFGConstantFoldingPhase.cpp:
7935 (JSC::DFG::ConstantFoldingPhase::run):
7936 * dfg/DFGFixupPhase.cpp:
7937 (JSC::DFG::FixupPhase::fixupNode):
7938 (JSC::DFG::FixupPhase::fixDoubleEdge):
7940 (JSC::DFG::Graph::nameOfVariableAccessData):
7941 (JSC::DFG::Graph::dump):
7942 (JSC::DFG::Graph::predictArgumentTypes):
7944 (JSC::DFG::Graph::getJSConstantSpeculation):
7945 (JSC::DFG::Graph::isPredictedNumerical):
7946 (JSC::DFG::Graph::byValIsPure):
7947 * dfg/DFGJITCompiler.h:
7948 (JSC::DFG::JITCompiler::getSpeculation):
7950 (JSC::DFG::Node::Node):
7951 (JSC::DFG::Node::getHeapPrediction):
7952 (JSC::DFG::Node::predictHeap):
7953 (JSC::DFG::Node::prediction):
7954 (JSC::DFG::Node::predict):
7955 (JSC::DFG::Node::shouldSpeculateInteger):
7956 (JSC::DFG::Node::shouldSpeculateDouble):
7957 (JSC::DFG::Node::shouldSpeculateNumber):
7958 (JSC::DFG::Node::shouldSpeculateBoolean):
7959 (JSC::DFG::Node::shouldSpeculateFinalObject):
7960 (JSC::DFG::Node::shouldSpeculateFinalObjectOrOther):
7961 (JSC::DFG::Node::shouldSpeculateArray):
7962 (JSC::DFG::Node::shouldSpeculateArguments):
7963 (JSC::DFG::Node::shouldSpeculateInt8Array):
7964 (JSC::DFG::Node::shouldSpeculateInt16Array):
7965 (JSC::DFG::Node::shouldSpeculateInt32Array):
7966 (JSC::DFG::Node::shouldSpeculateUint8Array):
7967 (JSC::DFG::Node::shouldSpeculateUint8ClampedArray):
7968 (JSC::DFG::Node::shouldSpeculateUint16Array):
7969 (JSC::DFG::Node::shouldSpeculateUint32Array):
7970 (JSC::DFG::Node::shouldSpeculateFloat32Array):
7971 (JSC::DFG::Node::shouldSpeculateFloat64Array):
7972 (JSC::DFG::Node::shouldSpeculateArrayOrOther):
7973 (JSC::DFG::Node::shouldSpeculateObject):
7974 (JSC::DFG::Node::shouldSpeculateCell):
7976 * dfg/DFGPredictionPropagationPhase.cpp:
7977 (JSC::DFG::PredictionPropagationPhase::setPrediction):
7978 (JSC::DFG::PredictionPropagationPhase::mergePrediction):
7979 (JSC::DFG::PredictionPropagationPhase::propagate):
7980 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):
7981 * dfg/DFGSpeculativeJIT.cpp:
7982 (JSC::DFG::SpeculativeJIT::fillStorage):
7983 (JSC::DFG::SpeculativeJIT::writeBarrier):
7984 (JSC::DFG::GPRTemporary::GPRTemporary):
7985 (JSC::DFG::FPRTemporary::FPRTemporary):
7986 (JSC::DFG::SpeculativeJIT::compilePeepHoleDoubleBranch):
7987 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectEquality):
7988 (JSC::DFG::SpeculativeJIT::compilePeepHoleBranch):
7989 (JSC::DFG::SpeculativeJIT::compile):
7990 (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
7991 (JSC::DFG::SpeculativeJIT::compileGetCharCodeAt):
7992 (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
7993 (JSC::DFG::SpeculativeJIT::compileValueToInt32):
7994 (JSC::DFG::SpeculativeJIT::compileDoubleAsInt32):
7995 (JSC::DFG::SpeculativeJIT::compileInt32ToDouble):
7996 (JSC::DFG::SpeculativeJIT::compileGetTypedArrayLength):
7997 (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
7998 (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
7999 (JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
8000 (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
8001 (JSC::DFG::SpeculativeJIT::compileInstanceOf):
8002 (JSC::DFG::SpeculativeJIT::compileAdd):
8003 (JSC::DFG::SpeculativeJIT::compileArithSub):
8004 (JSC::DFG::SpeculativeJIT::compileArithNegate):
8005 (JSC::DFG::SpeculativeJIT::compileArithMul):
8006 (JSC::DFG::SpeculativeJIT::compileArithMod):
8007 (JSC::DFG::SpeculativeJIT::compare):
8008 (JSC::DFG::SpeculativeJIT::compileStrictEq):
8009 (JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage):
8010 (JSC::DFG::SpeculativeJIT::compileGetByValOnArguments):
8011 (JSC::DFG::SpeculativeJIT::compileGetArgumentsLength):
8012 (JSC::DFG::SpeculativeJIT::compileRegExpExec):
8013 * dfg/DFGSpeculativeJIT.h:
8015 (JSC::DFG::ValueSource::forSpeculation):
8019 (JSC::DFG::SpecDoubleOperand::SpecDoubleOperand):
8020 (JSC::DFG::SpecDoubleOperand::~SpecDoubleOperand):
8021 (JSC::DFG::SpecDoubleOperand::fpr):
8022 (JSC::DFG::SpecCellOperand::SpecCellOperand):
8023 (JSC::DFG::SpecCellOperand::~SpecCellOperand):
8024 (JSC::DFG::SpecCellOperand::gpr):
8025 (JSC::DFG::SpecBooleanOperand::SpecBooleanOperand):
8026 (JSC::DFG::SpecBooleanOperand::~SpecBooleanOperand):
8027 (JSC::DFG::SpecBooleanOperand::gpr):
8028 * dfg/DFGSpeculativeJIT32_64.cpp:
8029 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
8030 (JSC::DFG::SpeculativeJIT::fillSpecDouble):
8031 (JSC::DFG::SpeculativeJIT::fillSpecCell):
8032 (JSC::DFG::SpeculativeJIT::fillSpecBoolean):
8033 (JSC::DFG::SpeculativeJIT::compileObjectEquality):
8034 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
8035 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
8036 (JSC::DFG::SpeculativeJIT::compileDoubleCompare):
8037 (JSC::DFG::SpeculativeJIT::compileLogicalNot):
8038 (JSC::DFG::SpeculativeJIT::emitBranch):
8039 (JSC::DFG::SpeculativeJIT::compile):
8040 * dfg/DFGSpeculativeJIT64.cpp:
8041 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
8042 (JSC::DFG::SpeculativeJIT::fillSpecDouble):
8043 (JSC::DFG::SpeculativeJIT::fillSpecCell):
8044 (JSC::DFG::SpeculativeJIT::fillSpecBoolean):
8045 (JSC::DFG::SpeculativeJIT::compileObjectEquality):
8046 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
8047 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
8048 (JSC::DFG::SpeculativeJIT::compileDoubleCompare):
8049 (JSC::DFG::SpeculativeJIT::compileLogicalNot):
8050 (JSC::DFG::SpeculativeJIT::emitBranch):
8051 (JSC::DFG::SpeculativeJIT::compile):
8052 * dfg/DFGVariableAccessData.h:
8053 (JSC::DFG::VariableAccessData::VariableAccessData):
8054 (JSC::DFG::VariableAccessData::predict):
8055 (JSC::DFG::VariableAccessData::nonUnifiedPrediction):
8056 (JSC::DFG::VariableAccessData::prediction):
8057 (JSC::DFG::VariableAccessData::argumentAwarePrediction):
8058 (JSC::DFG::VariableAccessData::mergeArgumentAwarePrediction):
8059 (JSC::DFG::VariableAccessData::shouldUseDoubleFormatAccordingToVote):
8060 (JSC::DFG::VariableAccessData::makePredictionForDoubleFormat):
8061 (VariableAccessData):
8063 2012-06-06 Filip Pizlo <fpizlo@apple.com>
8065 Global object variable accesses should not require an extra load
8066 https://bugs.webkit.org/show_bug.cgi?id=88385
8068 Reviewed by Gavin Barraclough and Geoffrey Garen.
8070 Previously, if you wanted to access a global variable, you'd first have
8071 to load the register array from the appropriate global object and then
8072 either load or store at an offset to the register array. This is because
8073 JSGlobalObject inherited from JSVariableObject, and JSVariableObject is
8074 designed with the pessimistic assumption that its register array may
8075 point into the call stack. This is never the case for global objects.
8076 Hence, even though the global object may add more registers at any time,
8077 it does not need to store them in a contiguous array. It can use a
8078 SegmentedVector or similar.
8080 This patch refactors global objects and variable objects as follows:
8082 - The functionality to track variables in an indexable array using a
8083 SymbolTable to map names to indices is moved into JSSymbolTableObject,
8084 which is now a supertype of JSVariableObject. JSVariableObject is now
8085 just a holder for a registers array and implements the registerAt()
8086 method that is left abstract in JSSymbolTableObject. Because all users
8087 of JSVariableObject know whether they are a JSStaticScopeObject,
8088 JSActivation, or JSGlobalObject, this "abstract" method is not virtual;
8089 instead the utility methods that would call registerAt() are now
8090 template functions that require you to know statically what subtype of
8091 JSSymbolTableObject you're using (JSVariableObject or something else),
8092 so that registerAt() can be statically bound.
8094 - A new class is added called JSSegmentedVariableObject, which only
8095 differs from JSVariableObject in how it allocates registers. It uses a
8096 SegmentedVector instead of manually managing a pointer to a contiguous
8097 slab of registers. This changes the interface somewhat; for example
8098 with JSVariableObject if you wanted to add a register you had to do
8099 it yourself since the JSVariableObject didn't know how the registers
8100 array ought to be allocated. With JSSegmentedVariableObject you can
8101 just call addRegisters(). JSSegmentedVariableObject preserves the
8102 invariant that once you get a pointer into a register, that pointer
8103 will continue to be valid so long as the JSSegmentedVariableObject is
8104 alive. This allows the JITs and interpreters to skip the extra load.
8106 - JSGlobalObject now inherits from JSSegmentedVariableObject. For now
8107 (and possibly forever) it is the only subtype of this new class.
8109 - The bytecode format is changed so that get_global_var and
8110 put_global_var have a pointer to the register directly rather than
8111 having an index. A convenience method is provided in
8112 JSSegmentedVariableObject to get the index given a a pointer, which is
8113 used for assertions and debug dumps.
8115 This appears to be a 1% across the board win.
8118 * GNUmakefile.list.am:
8119 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
8120 * JavaScriptCore.xcodeproj/project.pbxproj:
8122 * bytecode/CodeBlock.cpp:
8123 (JSC::CodeBlock::dump):
8124 * bytecode/Instruction.h:
8126 (JSC::Instruction::Instruction):
8127 * bytecompiler/BytecodeGenerator.cpp:
8128 (JSC::ResolveResult::registerPointer):
8130 (JSC::BytecodeGenerator::BytecodeGenerator):
8131 (JSC::BytecodeGenerator::retrieveLastUnaryOp):
8132 (JSC::BytecodeGenerator::resolve):
8133 (JSC::BytecodeGenerator::resolveConstDecl):
8134 (JSC::BytecodeGenerator::emitGetStaticVar):
8135 (JSC::BytecodeGenerator::emitPutStaticVar):
8136 * bytecompiler/BytecodeGenerator.h:
8138 (BytecodeGenerator):
8139 * dfg/DFGAssemblyHelpers.h:
8141 * dfg/DFGByteCodeParser.cpp:
8142 (JSC::DFG::ByteCodeParser::parseBlock):
8143 * dfg/DFGCSEPhase.cpp:
8144 (JSC::DFG::CSEPhase::globalVarLoadElimination):
8145 (JSC::DFG::CSEPhase::globalVarStoreElimination):
8146 (JSC::DFG::CSEPhase::performNodeCSE):
8148 (JSC::DFG::Graph::dump):
8150 (JSC::DFG::Graph::globalObjectFor):
8153 (JSC::DFG::Node::hasVarNumber):
8155 (JSC::DFG::Node::hasRegisterPointer):
8156 (JSC::DFG::Node::registerPointer):
8157 * dfg/DFGSpeculativeJIT32_64.cpp:
8158 (JSC::DFG::SpeculativeJIT::compile):
8159 * dfg/DFGSpeculativeJIT64.cpp:
8160 (JSC::DFG::SpeculativeJIT::compile):
8163 (JSC::Heap::isWriteBarrierEnabled):
8165 * interpreter/Interpreter.cpp:
8166 (JSC::Interpreter::execute):
8167 (JSC::Interpreter::privateExecute):
8168 * jit/JITPropertyAccess.cpp:
8169 (JSC::JIT::emit_op_get_global_var):
8170 (JSC::JIT::emit_op_put_global_var):
8171 * jit/JITPropertyAccess32_64.cpp:
8172 (JSC::JIT::emit_op_get_global_var):
8173 (JSC::JIT::emit_op_put_global_var):
8174 * llint/LowLevelInterpreter32_64.asm:
8175 * llint/LowLevelInterpreter64.asm:
8176 * runtime/JSGlobalObject.cpp:
8178 (JSC::JSGlobalObject::put):
8179 (JSC::JSGlobalObject::putDirectVirtual):
8180 (JSC::JSGlobalObject::defineOwnProperty):
8181 (JSC::JSGlobalObject::visitChildren):
8182 (JSC::JSGlobalObject::addStaticGlobals):
8183 (JSC::JSGlobalObject::getOwnPropertySlot):
8184 (JSC::JSGlobalObject::getOwnPropertyDescriptor):
8185 * runtime/JSGlobalObject.h:
8187 (JSC::JSGlobalObject::JSGlobalObject):
8189 (JSC::JSGlobalObject::hasOwnPropertyForWrite):
8190 * runtime/JSSegmentedVariableObject.cpp: Added.
8192 (JSC::JSSegmentedVariableObject::findRegisterIndex):
8193 (JSC::JSSegmentedVariableObject::addRegisters):
8194 (JSC::JSSegmentedVariableObject::visitChildren):
8195 * runtime/JSSegmentedVariableObject.h: Added.
8197 (JSSegmentedVariableObject):
8198 (JSC::JSSegmentedVariableObject::registerAt):
8199 (JSC::JSSegmentedVariableObject::assertRegisterIsInThisObject):
8200 (JSC::JSSegmentedVariableObject::JSSegmentedVariableObject):
8201 (JSC::JSSegmentedVariableObject::finishCreation):
8202 * runtime/JSStaticScopeObject.cpp:
8203 (JSC::JSStaticScopeObject::put):
8204 (JSC::JSStaticScopeObject::putDirectVirtual):
8205 (JSC::JSStaticScopeObject::getOwnPropertySlot):
8206 * runtime/JSSymbolTableObject.cpp: Added.
8208 (JSC::JSSymbolTableObject::destroy):
8209 (JSC::JSSymbolTableObject::deleteProperty):
8210 (JSC::JSSymbolTableObject::getOwnPropertyNames):
8211 (JSC::JSSymbolTableObject::putDirectVirtual):
8212 (JSC::JSSymbolTableObject::isDynamicScope):
8213 * runtime/JSSymbolTableObject.h: Added.
8215 (JSSymbolTableObject):
8216 (JSC::JSSymbolTableObject::symbolTable):
8217 (JSC::JSSymbolTableObject::JSSymbolTableObject):
8218 (JSC::JSSymbolTableObject::finishCreation):
8219 (JSC::symbolTableGet):
8220 (JSC::symbolTablePut):
8221 (JSC::symbolTablePutWithAttributes):
8222 * runtime/JSVariableObject.cpp:
8224 * runtime/JSVariableObject.h:
8226 (JSC::JSVariableObject::JSVariableObject):
8227 (JSC::JSVariableObject::finishCreation):
8229 * runtime/WriteBarrier.h:
8231 2012-06-06 Filip Pizlo <fpizlo@apple.com>
8233 DFG arguments access slow path should not crash if the arguments haven't been created
8234 https://bugs.webkit.org/show_bug.cgi?id=88471
8236 Reviewed by Gavin Barraclough.
8238 * dfg/DFGCCallHelpers.h:
8239 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
8241 * dfg/DFGOperations.cpp:
8242 * dfg/DFGOperations.h:
8243 * dfg/DFGSpeculativeJIT.h:
8244 (JSC::DFG::SpeculativeJIT::callOperation):
8245 * dfg/DFGSpeculativeJIT32_64.cpp:
8246 (JSC::DFG::SpeculativeJIT::compile):
8247 * dfg/DFGSpeculativeJIT64.cpp:
8248 (JSC::DFG::SpeculativeJIT::compile):
8250 2012-06-06 Michael Saboff <msaboff@apple.com>
8252 ENH: Add Logging to GC Marking Phase
8253 https://bugs.webkit.org/show_bug.cgi?id=88364
8255 Reviewed by Filip Pizlo.
8257 Log GC marking to stderr or a file. The logging in controlled
8258 with the define ENABLE_OBJECT_MARK_LOGGING in wtf/Platform.h.
8259 If DATA_LOG_TO_FILE in wtf/DataLog.cpp is set to 1, output is
8260 logged to a file otherwise it is logged to stderr.
8262 When logging is enabled, the GC is built single threaded since the
8263 log output from the various threads isn't buffered and output in a
8267 (JSC::Heap::markRoots):
8268 * heap/MarkStack.cpp:
8269 (JSC::MarkStackThreadSharedData::resetChildren):
8270 (JSC::MarkStackThreadSharedData::childVisitCount):
8271 (JSC::MarkStackThreadSharedData::markingThreadMain):
8272 (JSC::MarkStackThreadSharedData::markingThreadStartFunc):
8273 (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData):
8274 (JSC::MarkStackThreadSharedData::reset):
8276 (MarkStackThreadSharedData):
8278 (JSC::MarkStack::sharedData):
8279 (JSC::MarkStack::resetChildCount):
8280 (JSC::MarkStack::childCount):
8281 (JSC::MarkStack::incrementChildCount):
8282 * runtime/JSArray.cpp:
8283 (JSC::JSArray::visitChildren):
8284 * runtime/JSCell.cpp:
8285 (JSC::JSCell::className):
8288 (JSC::JSCell::visitChildren):
8289 * runtime/JSString.cpp:
8290 (JSC::JSString::visitChildren):
8291 * runtime/JSString.h:
8293 * runtime/Structure.h:
8294 (JSC::MarkStack::internalAppend):
8296 2012-06-06 Gavin Barraclough <barraclough@apple.com>
8298 Assigning to a static property should not change iteration order
8299 https://bugs.webkit.org/show_bug.cgi?id=88401
8301 Reviewed by Geoff Garen.
8303 A specific iteration order is not defined by the spec, but test-262 somewhat tenuously
8304 requires that it is at least stable, e.g. ch10/10.4/10.4.2/S10.4.2_A1.1_T1.js
8306 Whilst it is not clear that this behavior really arises from the specification, it
8307 would seem like common sense to conform to this.
8309 The problem here is that we allow properties in the structure to shadow those in the
8310 static table, and we iterate the properties in the structure first - which means that
8311 as values of existing properties are modified, their iteration order changes too.
8313 The easy fix is to iterate the properties from the static table first. This has a
8314 further benefit, since it will mean that user added properties will come after those
8315 present in the static table (respected the expected insertion-order).
8317 * runtime/JSObject.cpp:
8318 (JSC::JSObject::getOwnPropertyNames):
8319 - Iterate static properties first.
8321 2012-06-06 Andy Wingo <wingo@igalia.com>
8323 Ensure consistent order of evaluation in LLInt slow paths
8324 https://bugs.webkit.org/show_bug.cgi?id=88409
8326 Reviewed by Geoffrey Garen.
8328 * llint/LLIntSlowPaths.cpp:
8338 (slow_path_bitxor): Avoid calling toNumber, toInt32, or toUInt32
8339 multiple times without intervening sequence points. Fixes
8340 fast/js/exception-sequencing-binops.html with GCC 4.7 on x86-64
8341 Linux, which reordered evaluation of the arguments to fmod.
8343 2012-06-06 Andy Wingo <wingo@igalia.com>
8345 [GTK] Enable the LLInt
8346 https://bugs.webkit.org/show_bug.cgi?id=88315
8348 Reviewed by Filip Pizlo.
8350 * GNUmakefile.am: Add rules to generate LLIntDesiredOffsets.h and
8352 * GNUmakefile.list.am: Add offlineasm and llint files to the
8353 dist. Add LLInt source files to the build.
8354 * llint/LowLevelInterpreter.asm (crash): Generate a store of
8355 0xbbadbeef to a register, not to a constant. Otherwise, gas was
8356 failing to assemble result.
8357 * offlineasm/asm.rb (labelReference): Generate a
8358 SYMBOL_STRING_RELOCATION instead of a SYMBOL_STRING, so that we go
8359 through the PLT on ELF systems.
8361 2012-06-06 Andy Wingo <wingo@igalia.com>
8363 REGRESSION (r106478): None of the Paper.js JavaScript examples work
8364 https://bugs.webkit.org/show_bug.cgi?id=87158
8366 Reviewed by Michael Saboff.
8368 * bytecompiler/BytecodeGenerator.cpp:
8369 (JSC::BytecodeGenerator::resolve): If we have to bail out to
8370 dynamicResolve(), only skip static scopes from the head of the
8371 scope chain. Before, we were also skipping activations with
8372 direct eval as well, which was incorrect.
8374 2012-06-06 Dan Bernstein <mitz@apple.com>
8376 Reverted r119567, the fix for <http://webkit.org/b/88378>, because it broke the 32-bit build.
8378 * dfg/DFGSpeculativeJIT.h:
8379 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
8380 * jit/JITInlineMethods.h:
8381 (JSC::JIT::emitAllocateBasicJSObject):
8382 * llint/LowLevelInterpreter.asm:
8383 * runtime/JSGlobalData.h:
8385 * runtime/JSGlobalThis.cpp:
8386 (JSC::JSGlobalThis::setUnwrappedObject):
8387 * runtime/JSObject.cpp:
8388 (JSC::JSObject::visitChildren):
8389 (JSC::JSObject::createInheritorID):
8390 * runtime/JSObject.h:
8392 (JSC::JSObject::resetInheritorID):
8394 (JSC::JSObject::offsetOfInheritorID):
8395 (JSC::JSObject::inheritorID):
8397 2012-06-05 Yuqiang Xian <yuqiang.xian@intel.com>
8399 Improve Math.round and Math.floor intrinsic
8400 https://bugs.webkit.org/show_bug.cgi?id=88314
8402 Reviewed by Filip Pizlo.
8404 Currently we call a native function from the JIT code to complete the
8405 "round" and "floor" operations. We could inline some fast paths
8406 especially for those positive values on the platforms where floating
8407 point truncation is supported.
8408 This brings 3% gain on Kraken, especially 32% on audio-oscillator,
8409 and slight win on SunSpider, measured on IA32.
8411 * jit/ThunkGenerators.cpp:
8412 (JSC::floorThunkGenerator):
8414 (JSC::roundThunkGenerator):
8416 2012-06-05 Gavin Barraclough <barraclough@apple.com>
8418 Remove JSObject::m_inheritorID
8419 https://bugs.webkit.org/show_bug.cgi?id=88378
8421 Reviewed by Geoff Garen.
8423 This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
8424 and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
8425 Instead use a private named value in the object's property storage.
8427 * dfg/DFGSpeculativeJIT.h:
8428 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
8429 - No need m_inheritorID to initialize!
8430 * jit/JITInlineMethods.h:
8431 (JSC::JIT::emitAllocateBasicJSObject):
8432 - No need m_inheritorID to initialize!
8433 * llint/LowLevelInterpreter.asm:
8434 - No need m_inheritorID to initialize!
8435 * runtime/JSGlobalData.h:
8437 - Added private name 'm_inheritorIDKey'.
8438 * runtime/JSGlobalThis.cpp:
8439 (JSC::JSGlobalThis::setUnwrappedObject):
8440 - resetInheritorID is now passed a JSGlobalData&.
8441 * runtime/JSObject.cpp:
8442 (JSC::JSObject::visitChildren):
8443 - No m_inheritorID to be marked.
8444 (JSC::JSObject::createInheritorID):
8445 - Store the newly created inheritorID in the property map.
8446 * runtime/JSObject.h:
8447 (JSC::JSObject::resetInheritorID):
8448 - Remove the inheritorID from property storage.
8449 (JSC::JSObject::inheritorID):
8450 - Read the inheritorID from property storage.
8452 2012-06-05 Filip Pizlo <fpizlo@apple.com>
8454 DFG CFG simplification should not attempt to deref nodes inside of an unreachable subgraph
8455 https://bugs.webkit.org/show_bug.cgi?id=88362
8457 Reviewed by Gavin Barraclough.
8459 * dfg/DFGCFGSimplificationPhase.cpp:
8460 (JSC::DFG::CFGSimplificationPhase::fixPhis):
8461 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
8463 2012-06-05 Mark Hahnenberg <mhahnenberg@apple.com>
8465 Entry into JSC should CRASH() if the Heap is busy
8466 https://bugs.webkit.org/show_bug.cgi?id=88355
8468 Reviewed by Geoffrey Garen.
8470 Interpreter::execute() returns jsNull() right now if we try to enter it while
8471 the Heap is busy (e.g. with a collection), which is okay, but some code paths
8472 that call Interpreter::execute() allocate objects before checking if the Heap
8473 is busy. Attempting to execute JS code while the Heap is busy should not be
8474 allowed and should be enforced by a release-mode CRASH() to prevent vague,
8475 unhelpful backtraces later on if somebody makes a mistake. Normally, recursively
8476 executing JS code is okay, e.g. for evals, but it should not occur during a
8477 Heap allocation or collection because the Heap is not guaranteed to be in a
8478 consistent state (especially during collections). We are protected from
8479 executing JS on the same Heap concurrently on two separate threads because
8480 they must each take a JSLock first. However, we are not protected from reentrant
8481 execution of JS on the same thread because JSLock allows reentrancy. Therefore,
8482 we should fail early if we detect an entrance into JS code while the Heap is busy.
8484 * heap/Heap.cpp: Changed Heap::collect so that it sets the m_operationInProgress field
8485 at the beginning of collection and then unsets it at the end so that it is set at all
8486 times throughout the duration of a collection rather than sporadically during various
8487 phases. There is no reason to unset during a collection because our collector does
8488 not currently support running additional JS between the phases of a collection.
8489 (JSC::Heap::getConservativeRegisterRoots):
8490 (JSC::Heap::markRoots):
8491 (JSC::Heap::collect):
8492 * interpreter/Interpreter.cpp:
8493 (JSC::Interpreter::execute): Crash if the Heap is busy.
8494 * runtime/Completion.cpp: Crash if the Heap is busy. We do it here before we call
8495 Interpreter::execute() because we do some allocation prior to calling execute() which
8496 could cause Heap corruption if, for example, that allocation caused a collection.
8499 2012-06-05 Dongwoo Im <dw.im@samsung.com>
8501 Add 'isProtocolHandlerRegistered' and 'unregisterProtocolHandler'.
8502 https://bugs.webkit.org/show_bug.cgi?id=73176
8504 Reviewed by Adam Barth.
8506 Two more APIs are added in Custom Scheme Handler specification.
8507 http://dev.w3.org/html5/spec/Overview.html#custom-handlers
8508 One is 'isProtocolHandlerRegistered' to query whether the specific URL
8509 is registered or not.
8510 The other is 'unregisterProtocolHandler' to remove the registered URL.
8512 * Configurations/FeatureDefines.xcconfig: Add a macro 'ENABLE_CUSTOM_SCHEME_HANDLER'.
8514 2012-06-04 Filip Pizlo <fpizlo@apple.com>
8516 DFG CFG simplification should correct the variables at the head of the predecessor block
8517 https://bugs.webkit.org/show_bug.cgi?id=88284
8519 Reviewed by Geoffrey Garen.
8521 * dfg/DFGCFGSimplificationPhase.cpp:
8522 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
8524 2012-06-04 Geoffrey Garen <ggaren@apple.com>
8528 Rolled out r119364 because it's still causing crashes (when running
8529 v8-earley in release builds of DRT)
8534 (JSC::Heap::collect):
8535 * heap/MarkedBlock.cpp:
8536 (JSC::MarkedBlock::sweep):
8537 * heap/MarkedBlock.h:
8538 (JSC::MarkedBlock::resetAllocator):
8540 * heap/MarkedSpace.cpp:
8541 (JSC::ResetAllocator::operator()):
8543 (JSC::MarkedSpace::resetAllocators):
8544 (JSC::MarkedSpace::sweepWeakSets):
8545 * heap/MarkedSpace.h:
8547 * heap/WeakBlock.cpp:
8548 (JSC::WeakBlock::sweep):
8550 (JSC::WeakSet::sweep):
8551 (JSC::WeakSet::tryFindAllocator):
8553 (JSC::WeakSet::shrink):
8555 2012-06-04 Filip Pizlo <fpizlo@apple.com>
8557 DFG arguments simplification should have rationalized handling of TearOffArguments
8558 https://bugs.webkit.org/show_bug.cgi?id=88206
8560 Reviewed by Geoffrey Garen.
8562 - Accesses to the unmodified arguments register ought to have the same effect on
8563 alias/escape analysis of arguments as accesses to the mutable arguments register.
8565 - The existence of TearOffArguments should not get in the way of arguments aliasing.
8567 - TearOffArguments should be eliminated if CreateArguments is eliminated.
8569 * dfg/DFGArgumentsSimplificationPhase.cpp:
8570 (JSC::DFG::ArgumentsSimplificationPhase::run):
8571 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
8573 2012-06-04 Gavin Barraclough <barraclough@apple.com>
8575 Remove enabledProfilerReference
8576 https://bugs.webkit.org/show_bug.cgi?id=88258
8578 Reviewed by Michael Saboff.
8580 Make the enabled profiler a member of JSGlobalData, and switch code that accesses it to do so directly
8581 via the JSGlobalData, rather than holding a Profiler** reference to it. Do not pass the Profiler**
8582 reference to JIT code. This patch does not change the stack layout on entry into JIT code (passing an
8583 unused void* instead), since this is an intrusive change better handled in a separate patch.
8585 * interpreter/Interpreter.cpp:
8586 (JSC::Interpreter::throwException):
8587 (JSC::Interpreter::execute):
8588 (JSC::Interpreter::executeCall):
8589 (JSC::Interpreter::executeConstruct):
8590 (JSC::Interpreter::privateExecute):
8592 (JSC::JITCode::execute):
8593 - Don't pass Profiler** to JIT code.
8594 * jit/JITOpcodes.cpp:
8595 (JSC::JIT::emit_op_profile_will_call):
8596 (JSC::JIT::emit_op_profile_did_call):
8597 * jit/JITOpcodes32_64.cpp:
8598 (JSC::JIT::emit_op_profile_will_call):
8599 (JSC::JIT::emit_op_profile_did_call):
8602 (JSC::ctiTrampoline):
8603 (JSC::ctiVMThrowTrampoline):
8604 (JSC::ctiOpThrowNotCaught):
8605 (JSC::JITThunks::JITThunks):
8606 (JSC::DEFINE_STUB_FUNCTION):
8607 - For ARM_THUMB2, rename ENABLE_PROFILER_REFERENCE_OFFSET to FIRST_STACK_ARGUMENT (which is how it is being used).
8608 - For MIPS, remove ENABLE_PROFILER_REFERENCE_OFFSET.
8612 - Renamed enabledProfilerReference to unusedX.
8613 * llint/LLIntSlowPaths.cpp:
8614 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
8615 * llint/LowLevelInterpreter.asm:
8616 * profiler/Profiler.cpp:
8618 (JSC::Profiler::startProfiling):
8619 (JSC::Profiler::stopProfiling):
8620 * profiler/Profiler.h:
8622 - Removed s_sharedEnabledProfilerReference, enabledProfilerReference().
8623 * runtime/JSGlobalData.cpp:
8624 (JSC::JSGlobalData::JSGlobalData):
8625 * runtime/JSGlobalData.h:
8627 (JSC::JSGlobalData::enabledProfiler):
8629 - Added m_enabledProfiler, enabledProfiler().
8630 * runtime/JSGlobalObject.cpp:
8631 (JSC::JSGlobalObject::~JSGlobalObject):
8633 2012-06-04 Filip Pizlo <fpizlo@apple.com>
8635 get_argument_by_val should be profiled everywhere
8636 https://bugs.webkit.org/show_bug.cgi?id=88205
8638 Reviewed by Geoffrey Garen.
8640 * jit/JITOpcodes32_64.cpp:
8641 (JSC::JIT::emitSlow_op_get_argument_by_val):
8642 * llint/LLIntSlowPaths.cpp:
8643 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
8645 2012-06-04 Filip Pizlo <fpizlo@apple.com>
8647 DFG arguments simplification takes unkindly to direct accesses to the arguments register
8648 https://bugs.webkit.org/show_bug.cgi?id=88261
8650 Reviewed by Geoffrey Garen.
8652 Fixed arguments simplification for direct accesses to the arguments register, which may
8653 arise if CSE had not run. Fixed CSE so that it does run prior to arguments simplification,
8654 by making it a full-fledged member of the fixpoint. Fixed other issues in arguments
8655 simplification, like realizing that it needs to bail if there is a direct assignment to
8656 the arguments register, and failing to turn CreateArguments into PhantomArguments. Also
8657 fixed CSE's handling of store elimination of captured locals in the presence of a
8658 GetMyArgumentByVal (or one of its friends), and fixed CSE to correctly fixup variables at
8659 tail if the Flush it removes is the last operation on a local in a basic block.
8661 * bytecode/CodeBlock.cpp:
8662 (JSC::CodeBlock::dump):
8663 * dfg/DFGArgumentsSimplificationPhase.cpp:
8664 (JSC::DFG::ArgumentsSimplificationPhase::run):
8665 (JSC::DFG::ArgumentsSimplificationPhase::isOKToOptimize):
8666 * dfg/DFGCSEPhase.cpp:
8667 (JSC::DFG::CSEPhase::run):
8668 (JSC::DFG::CSEPhase::setLocalStoreElimination):
8669 (JSC::DFG::CSEPhase::performNodeCSE):
8671 * dfg/DFGDriver.cpp:
8672 (JSC::DFG::compile):
8674 2012-06-04 Anders Carlsson <andersca@apple.com>
8676 Fix a struct/class mismatch.
8681 2012-06-04 David Kilzer <ddkilzer@apple.com>
8683 BUILD FIX: FeatureDefines.xcconfig should match across projects
8685 * Configurations/FeatureDefines.xcconfig:
8686 - Add missing ENABLE_LEGACY_CSS_VENDOR_PREFIXES.
8688 2012-06-02 Geoffrey Garen <ggaren@apple.com>
8690 Weak pointer finalization should be lazy
8691 https://bugs.webkit.org/show_bug.cgi?id=87599
8693 Reviewed by Sam Weinig.
8698 (JSC::Heap::collect): Don't sweep eagerly -- we'll sweep lazily instead.
8700 * heap/MarkedBlock.cpp:
8701 (JSC::MarkedBlock::sweep): Sweep our weak set before we sweep our other
8702 destructors -- this is our last chance to run weak set finalizers before
8703 we recycle our memory.
8705 * heap/MarkedBlock.h:
8706 (JSC::MarkedBlock::resetAllocator):
8707 * heap/MarkedSpace.cpp:
8708 (JSC::MarkedSpace::resetAllocators):
8709 * heap/MarkedSpace.h:
8710 (JSC::MarkedSpace::resetAllocators): Don't force allocator reset anymore.
8711 It will happen automatically when a weak set is swept. It's simpler to
8712 have only one canonical way for this to happen, and it wasn't buying
8713 us anything to do it eagerly.
8715 * heap/WeakBlock.cpp:
8716 (JSC::WeakBlock::sweep): Don't short-circuit a sweep unless we know
8717 the sweep would be a no-op. If even one finalizer is pending, we need to
8718 run it, since we won't get another chance.
8721 (JSC::WeakSet::sweep): This loop can be simpler now that
8722 WeakBlock::sweep() does what we mean.
8724 Reset our allocator after a sweep because this is the optimal time to
8725 start trying to recycle old weak pointers.
8727 (JSC::WeakSet::tryFindAllocator): Don't sweep when searching for an
8728 allocator because we've swept already, and forcing a new sweep would be
8732 (JSC::WeakSet::shrink): Be sure to reset our allocator after a shrink
8733 because the shrink may have removed the block the allocator was going to
8736 2012-06-02 Filip Pizlo <fpizlo@apple.com>
8738 If the DFG bytecode parser detects that op_method_check has gone polymorphic, it
8739 shouldn't revert all the way to GetById/GetByIdFlush
8740 https://bugs.webkit.org/show_bug.cgi?id=88176
8742 Reviewed by Geoffrey Garen.
8744 Refactored the code so that the op_method_check case of the parser gracefully falls
8745 through to all of the goodness of the normal op_get_by_id case.
8747 * dfg/DFGByteCodeParser.cpp:
8749 (JSC::DFG::ByteCodeParser::handleGetById):
8751 (JSC::DFG::ByteCodeParser::parseBlock):
8753 2012-06-02 Filip Pizlo <fpizlo@apple.com>
8755 DFG CSE should be able to eliminate unnecessary flushes of arguments and captured variables
8756 https://bugs.webkit.org/show_bug.cgi?id=87929
8758 Reviewed by Geoffrey Garen.
8760 Slight speed-up on V8. Big win (up to 50%) on programs that inline very small functions.
8762 This required a bunch of changes:
8764 - The obvious change is making CSE essentially ignore whether or not the set of
8765 operations between the Flush and the SetLocal can exit, and instead focus on whether or
8766 not that set of operations can clobber the world or access local variables. This code
8767 is now refactored to return a set of flags indicating any of these events, and the CSE
8768 decides what to do based on those flags. If the set of operations is non-clobbering
8769 and non-accessing, then the Flush is turned into a Phantom on the child of the
8770 SetLocal. This expands the liveness of the relevant variable but virtually guarantees
8771 that it will be register allocated and not flushed to the stack. So, yeah, this patch
8772 is a lot of work to save a few stores to the stack.
8774 - Previously, CheckArgumentsNotCreated was optimized "lazily" in that you only knew if
8775 it was a no-op if you were holding onto a CFA abstract state. But this would make the
8776 CSE act pessimistically, since it doesn't use the CFA. Hence, this patch changes the
8777 constant folding phase into something more broad; it now fixes up
8778 CheckArgumentsNotCreated nodes by turning them into phantoms if it knows that they are
8781 - Arguments simplification was previously relying on this very strange PhantomArguments
8782 node, which had two different meanings: for normal execution it meant the empty value
8783 but for OSR exit it meant that the arguments should be reified. This produces problems
8784 when set SetLocals to the captured arguments registers are CSE'd away, since we'd be
8785 triggering reification of arguments without having initialized the arguments registers
8786 to empty. The cleanest solution was to fix PhantomArguments to have one meaning:
8787 namely, arguments reification on OSR exit. Hence, this patch changes arguments
8788 simplification to change SetLocal of CreateArguments on the arguments registers to be
8789 a SetLocal of Empty.
8791 - Argument value recoveries were previously derived from the value source of the
8792 arguments at the InlineStart. But that relies on all SetLocals to arguments having
8793 been flushed. It's possible that we could have elided the SetLocal to the arguments
8794 at the callsite because there were subsequent SetLocals to the arguments inside of the
8795 callee, in which case the InlineStart would get the wrong information. Hence, this
8796 patch changes argument value recovery computation to operate over the ArgumentPositions
8799 - But that doesn't actually work, because previously, there was no way to link an
8800 InlineStart back to the corresponding ArgumentPositions, at least not without some
8801 ugliness. So this patch instates the rule that the m_argumentPositions vector consists
8802 of disjoint subsequences such that each subsequence corresponds to an inline callsite
8803 and can be identified by its first index, and within each subsequence are the
8804 ArgumentPositions of all of the arguments ordered by argument index. This required
8805 flipping the order in which ArgumentPositions are added to the vector, and giving
8806 InlineStart an operand that indicates the start of that inline callsite's
8807 ArgumentPosition subsequence.
8809 - This patch also revealed a nasty bug in the reification of arguments in inline call
8810 frames on OSR exit. Since the reification was happening after the values of virtual
8811 registers were recovered, the value recoveries of the inline arguments were wrong.
8812 Hence using operationCreateInlinedArguments is wrong. For example a value recovery
8813 might say that you have to box a double, but if we had already boxed it then boxing
8814 it a second time will result in garbage. The specific case of this bug was this patch
8815 uncovered was that now it is possible for an inline call frame to not have any valid
8816 value recoveries for any inline arguments, if the optimization elides all argument
8817 flushes, while at the same time optimizing away arguments creation. Then OSR exit
8818 would try to recover the arguments using the inline call frame, which had bogus
8819 information, and humorous crashes would ensue. This patch fixes this issue by moving
8820 arguments reification to after call frame reification, so that arguments reification
8821 can always use operationCreateArguments instead of operationCreateInlinedArguments.
8823 - This patch may turn a Flush into a Phantom. That's kind of the whole point. But that
8824 broke forward speculation checks, which knew to look for a Flush prior to a SetLocal
8825 but didn't know that there could alternatively be a Phantom in place of the Flush.
8826 This patch fixes that by augmenting the forward speculation check logic.
8828 - Finally, in the process of having fun with all of the above, I realized that my DFG
8829 validation was not actually running on every phase like I had originally designed it
8830 to. In fact it was only running just after bytecode parsing. I initially tried to
8831 make it run in every phase but found that this causes some tests to timeout
8832 (specifically the evil fuzzing ones), so I decided on a compromise where: (i) in
8833 release mode validation never runs, (ii) in debug mode validation will run just
8834 after parsing and just before the backend, and (iii) it's possible with a simple
8835 switch to enable validation to run on every phase.
8837 Luckily all of the above issues were already covered by the 77 or so DFG-specific
8838 layout tests. Hence, this patch does not introduce any new tests despite being so
8841 * dfg/DFGAbstractState.cpp:
8842 (JSC::DFG::AbstractState::execute):
8843 * dfg/DFGArgumentPosition.h:
8844 (JSC::DFG::ArgumentPosition::prediction):
8845 (JSC::DFG::ArgumentPosition::doubleFormatState):
8846 (JSC::DFG::ArgumentPosition::shouldUseDoubleFormat):
8848 * dfg/DFGArgumentsSimplificationPhase.cpp:
8849 (JSC::DFG::ArgumentsSimplificationPhase::run):
8850 * dfg/DFGByteCodeParser.cpp:
8851 (JSC::DFG::ByteCodeParser::handleInlining):
8852 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
8853 * dfg/DFGCSEPhase.cpp:
8854 (JSC::DFG::CSEPhase::SetLocalStoreEliminationResult::SetLocalStoreEliminationResult):
8855 (SetLocalStoreEliminationResult):
8856 (JSC::DFG::CSEPhase::setLocalStoreElimination):
8857 (JSC::DFG::CSEPhase::performNodeCSE):
8859 * dfg/DFGConstantFoldingPhase.cpp:
8860 (JSC::DFG::ConstantFoldingPhase::run):
8861 * dfg/DFGDriver.cpp:
8862 (JSC::DFG::compile):
8865 (JSC::DFG::Node::hasArgumentPositionStart):
8866 (JSC::DFG::Node::argumentPositionStart):
8867 * dfg/DFGOSRExitCompiler32_64.cpp:
8868 (JSC::DFG::OSRExitCompiler::compileExit):
8869 * dfg/DFGOSRExitCompiler64.cpp:
8870 (JSC::DFG::OSRExitCompiler::compileExit):
8875 * dfg/DFGSpeculativeJIT.cpp:
8876 (JSC::DFG::SpeculativeJIT::compile):
8877 * dfg/DFGSpeculativeJIT.h:
8878 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
8879 * dfg/DFGSpeculativeJIT32_64.cpp:
8880 (JSC::DFG::SpeculativeJIT::compile):
8881 * dfg/DFGSpeculativeJIT64.cpp:
8882 (JSC::DFG::SpeculativeJIT::compile):
8884 2012-06-02 Geoffrey Garen <ggaren@apple.com>
8886 DOM string cache should hash pointers, not characters
8887 https://bugs.webkit.org/show_bug.cgi?id=88175
8889 Reviewed by Phil Pizlo and Sam Weinig.
8893 (JSC::weakRemove): Made these function templates slightly more generic
8894 to accommodate new client types.
8896 2012-06-01 Filip Pizlo <fpizlo@apple.com>
8898 DFG CFA should know that PutByVal can clobber the world
8899 https://bugs.webkit.org/show_bug.cgi?id=88155
8901 Reviewed by Gavin Barraclough.
8903 * dfg/DFGAbstractState.cpp:
8904 (JSC::DFG::AbstractState::execute):
8906 2012-06-01 Filip Pizlo <fpizlo@apple.com>
8908 DFG CFA should mark basic blocks as having constants if local accesses yield constants
8909 https://bugs.webkit.org/show_bug.cgi?id=88153
8911 Reviewed by Gavin Barraclough.
8913 * dfg/DFGAbstractState.cpp:
8914 (JSC::DFG::AbstractState::execute):
8916 2012-06-01 Filip Pizlo <fpizlo@apple.com>
8918 DFG arguments simplification phase uses a node.codeOrigin after appending a node
8919 https://bugs.webkit.org/show_bug.cgi?id=88151
8921 Reviewed by Geoffrey Garen.
8923 The right thing to do is to save the CodeOrigin before appending to the graph.
8925 * dfg/DFGArgumentsSimplificationPhase.cpp:
8926 (JSC::DFG::ArgumentsSimplificationPhase::run):
8928 2012-06-01 Filip Pizlo <fpizlo@apple.com>
8930 DFG should not emit unnecessary speculation checks when performing an int32 to double conversion on
8931 a value that is proved to be a number, predicted to be an int32, but not proved to be an int32
8932 https://bugs.webkit.org/show_bug.cgi?id=88146
8934 Reviewed by Gavin Barraclough.
8936 * dfg/DFGSpeculativeJIT.cpp:
8937 (JSC::DFG::SpeculativeJIT::compileInt32ToDouble):
8939 2012-06-01 Filip Pizlo <fpizlo@apple.com>
8941 DFG constant folding search for the last local access skips the immediately previous local access
8942 https://bugs.webkit.org/show_bug.cgi?id=88141
8944 Reviewed by Michael Saboff.
8946 If you use a loop in the style of:
8948 for (i = start; i--;)
8950 then you need to remember that the first value of 'i' that the loop body will see is 'start - 1'.
8951 Hence the following is probably wrong:
8953 for (i = start - 1; i--;)
8955 * dfg/DFGConstantFoldingPhase.cpp:
8956 (JSC::DFG::ConstantFoldingPhase::run):
8958 2012-06-01 Filip Pizlo <fpizlo@apple.com>
8960 DFG constant folding should be OK with GetLocal of captured variables having a constant
8961 https://bugs.webkit.org/show_bug.cgi?id=88137
8963 Reviewed by Gavin Barraclough.
8965 * dfg/DFGConstantFoldingPhase.cpp:
8966 (JSC::DFG::ConstantFoldingPhase::run):
8968 2012-05-31 Mark Hahnenberg <mhahnenberg@apple.com>
8970 JSGlobalObject does not mark m_privateNameStructure
8971 https://bugs.webkit.org/show_bug.cgi?id=88023
8973 Rubber stamped by Gavin Barraclough.
8975 * runtime/JSGlobalObject.cpp:
8976 (JSC::JSGlobalObject::visitChildren): We need to mark this so it doesn't get
8977 inadvertently garbage collected.
8979 2012-05-31 Erik Arvidsson <arv@chromium.org>
8981 Make DOM Exceptions Errors
8982 https://bugs.webkit.org/show_bug.cgi?id=85078
8984 Reviewed by Oliver Hunt.
8986 WebIDL mandates that exceptions should have Error.prototype on its prototype chain.
8988 For JSC we have access to the Error.prototype from the binding code.
8990 For V8 we set a field in the WrapperTypeInfo and when the constructor function is created we
8991 set the prototype as needed.
8993 Updated test: fast/dom/DOMException/prototype-object.html
8995 * JavaScriptCore.xcodeproj/project.pbxproj:
8996 * runtime/JSGlobalObject.cpp:
8997 (JSC::JSGlobalObject::reset):
8998 * runtime/JSGlobalObject.h:
9001 (JSC::JSGlobalObject::errorPrototype):
9003 2012-05-31 Andy Wingo <wingo@igalia.com>
9005 Fix reference to unset variable in debug mode
9006 https://bugs.webkit.org/show_bug.cgi?id=87981
9008 Reviewed by Geoffrey Garen.
9010 * runtime/JSONObject.cpp (Stringifier::Holder::Holder):
9011 Initialize m_size in debug mode, as we check it later in an assert.
9013 2012-05-30 Mark Hahnenberg <mhahnenberg@apple.com>
9015 Heap should sweep incrementally
9016 https://bugs.webkit.org/show_bug.cgi?id=85429
9018 We shouldn't have to wait for the opportunistic GC timer to fire in order
9019 to call object destructors. Instead, we should incrementally sweep some
9020 subset of the blocks requiring sweeping periodically. We tie this sweeping
9021 to a timer rather than to collections because we want to reclaim this memory
9022 even if we stop allocating. This way, our memory usage scales smoothly with
9023 actual use, regardless of whether we've recently done an opportunistic GC or not.
9025 Reviewed by Geoffrey Garen.
9028 * GNUmakefile.list.am:
9029 * JavaScriptCore.gypi:
9030 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
9031 * JavaScriptCore.xcodeproj/project.pbxproj:
9035 (JSC::Heap::collect): We no longer sweep during a full sweep. We only shrink now,
9036 which we will switch over to being done during incremental sweeping too as soon as
9037 all finalizers can be run lazily (and, by extension, incrementally).
9038 (JSC::Heap::sweeper):
9043 * heap/IncrementalSweeper.cpp: Added.
9045 (JSC::IncrementalSweeper::timerDidFire): The IncrementalSweeper works very similarly to
9046 GCActivityCallback. It is tied to a run-loop based timer that fires periodically based
9047 on how long the previous sweep increment took to run. The IncrementalSweeper doesn't do
9048 anything if the platform doesn't support CoreFoundation.
9049 (JSC::IncrementalSweeper::IncrementalSweeper):
9050 (JSC::IncrementalSweeper::~IncrementalSweeper):
9051 (JSC::IncrementalSweeper::create):
9052 (JSC::IncrementalSweeper::scheduleTimer):
9053 (JSC::IncrementalSweeper::cancelTimer):
9054 (JSC::IncrementalSweeper::doSweep): Iterates over the snapshot of the MarkedSpace taken
9055 during the last collection, checking to see which blocks need sweeping. If it successfully
9056 gets to the end of the blocks that need sweeping then it cancels the timer.
9057 (JSC::IncrementalSweeper::startSweeping): We take a snapshot of the Heap and store it in
9058 a Vector that the incremental sweep will iterate over. We also reset our index into this Vector.
9059 * heap/IncrementalSweeper.h: Added.
9061 (IncrementalSweeper):
9062 * heap/MarkedBlock.h:
9063 (JSC::MarkedBlock::needsSweeping): If a block is in the Marked state it needs sweeping
9064 to be usable and to run any destructors that need to be run.
9066 2012-05-30 Patrick Gansterer <paroga@webkit.org>
9068 [WINCE] Fix JSString after r115516.
9069 https://bugs.webkit.org/show_bug.cgi?id=87892
9071 Reviewed by Geoffrey Garen.
9073 r115516 splitted JSString into two classes, with addition nested classes.
9074 Add a workaround for the WinCE compiler since it can't resolve the friend class
9075 declerations corretly and denies the access to protected members of JSString.
9077 * runtime/JSString.h:
9078 (JSC::JSRopeString::RopeBuilder::append):
9079 (JSC::JSRopeString::append):
9082 2012-05-30 Oliver Hunt <oliver@apple.com>
9084 Really provide error information with the inspector disabled
9085 https://bugs.webkit.org/show_bug.cgi?id=87910
9087 Reviewed by Filip Pizlo.
9089 Don't bother checking for anything other than pre-existing error info.
9090 In the absence of complete line number information you'll only get the
9091 line a function starts on, but at least it's something.
9093 * interpreter/Interpreter.cpp:
9094 (JSC::Interpreter::throwException):
9096 2012-05-30 Filip Pizlo <fpizlo@apple.com>
9098 LLInt broken on x86-32 with JIT turned off
9099 https://bugs.webkit.org/show_bug.cgi?id=87906
9101 Reviewed by Geoffrey Garen.
9103 Fixed the code to not clobber registers that contain important things, like the call frame.
9105 * llint/LowLevelInterpreter32_64.asm:
9107 2012-05-30 Filip Pizlo <fpizlo@apple.com>
9109 ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
9110 https://bugs.webkit.org/show_bug.cgi?id=87887
9112 Reviewed by Darin Adler.
9114 Better fix - we now never call SourceProvider::asID() if SourceProvider* is 0.
9117 (JSC::ScopeNode::sourceID):
9118 * parser/SourceCode.h:
9119 (JSC::SourceCode::providerID):
9121 * parser/SourceProvider.h:
9123 (JSC::SourceProvider::asID):
9124 * runtime/Executable.h:
9125 (JSC::ScriptExecutable::sourceID):
9127 2012-05-30 Filip Pizlo <fpizlo@apple.com>
9129 ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
9130 https://bugs.webkit.org/show_bug.cgi?id=87887
9132 Reviewed by Geoffrey Garen.
9134 * parser/SourceProvider.h:
9135 (JSC::SourceProvider::asID):
9137 2012-05-30 Oliver Hunt <oliver@apple.com>
9139 DFG does not correctly handle exceptions caught in the LLInt
9140 https://bugs.webkit.org/show_bug.cgi?id=87885
9142 Reviewed by Filip Pizlo.
9144 Make the DFG use genericThrow, rather than reimplementing a small portion of it.
9145 Also make the LLInt slow paths validate that their PC is correct.
9147 * dfg/DFGOperations.cpp:
9148 * llint/LLIntSlowPaths.cpp:
9151 2012-05-29 Filip Pizlo <fpizlo@apple.com>
9153 DFG CFA should infer types and values of captured variables
9154 https://bugs.webkit.org/show_bug.cgi?id=87813
9156 Reviewed by Gavin Barraclough.
9158 Slight speed-up in V8/earley-boyer (~1%).
9160 * bytecode/CodeBlock.h:
9161 (JSC::CodeBlock::argumentsAreCaptured):
9162 (JSC::CodeBlock::argumentIsCaptured):
9164 * dfg/DFGAbstractState.cpp:
9166 (JSC::DFG::AbstractState::beginBasicBlock):
9167 (JSC::DFG::AbstractState::initialize):
9168 (JSC::DFG::AbstractState::endBasicBlock):
9169 (JSC::DFG::AbstractState::execute):
9170 (JSC::DFG::AbstractState::clobberWorld):
9171 (JSC::DFG::AbstractState::clobberStructures):
9172 (JSC::DFG::AbstractState::mergeStateAtTail):
9173 (JSC::DFG::AbstractState::merge):
9174 (JSC::DFG::AbstractState::mergeToSuccessors):
9175 * dfg/DFGAbstractState.h:
9176 (JSC::DFG::AbstractState::variables):
9178 * dfg/DFGSpeculativeJIT32_64.cpp:
9179 (JSC::DFG::SpeculativeJIT::compile):
9180 * dfg/DFGSpeculativeJIT64.cpp:
9181 (JSC::DFG::SpeculativeJIT::compile):
9183 2012-05-30 Patrick Gansterer <paroga@webkit.org>
9185 Unreviewed. Build fix for !ENABLE(JIT) after r117823.
9187 * bytecode/CodeBlock.cpp:
9188 (JSC::CodeBlock::dump):
9190 2012-05-30 Sheriff Bot <webkit.review.bot@gmail.com>
9192 Unreviewed, rolling out r118868.
9193 http://trac.webkit.org/changeset/118868
9194 https://bugs.webkit.org/show_bug.cgi?id=87828
9196 introduced ~20 crashes on Mac and Qt bots (Requested by pizlo_
9200 (JSC::Heap::collect):
9201 * heap/MarkedBlock.cpp:
9202 (JSC::MarkedBlock::sweep):
9203 * heap/MarkedBlock.h:
9204 (JSC::MarkedBlock::sweepWeakSet):
9206 * heap/MarkedSpace.cpp:
9207 (JSC::SweepWeakSet::operator()):
9209 (JSC::MarkedSpace::sweepWeakSets):
9210 * heap/MarkedSpace.h:
9213 2012-05-29 Geoffrey Garen <ggaren@apple.com>
9215 Rolled back in r118646, now that
9216 https://bugs.webkit.org/show_bug.cgi?id=87784 is fixed.
9218 http://trac.webkit.org/changeset/118646
9219 https://bugs.webkit.org/show_bug.cgi?id=87599
9222 (JSC::Heap::collect):
9223 * heap/MarkedBlock.cpp:
9224 (JSC::MarkedBlock::sweep):
9225 * heap/MarkedBlock.h:
9227 * heap/MarkedSpace.cpp:
9229 * heap/MarkedSpace.h:
9232 2012-05-29 Filip Pizlo <fpizlo@apple.com>
9234 DFG should keep captured variables alive until the (inline) return.
9235 https://bugs.webkit.org/show_bug.cgi?id=87205
9237 Reviewed by Gavin Barraclough.
9239 Changes the way we do flushing for captured variables and arguments. Instead of flushing
9240 each SetLocal immediately, we flush at kill points. So a SetLocal will cause a Flush of
9241 whatever was live in the variable previously, and a return will cause a Flush of all
9242 captured variables and all arguments.
9244 * dfg/DFGByteCodeParser.cpp:
9245 (JSC::DFG::ByteCodeParser::setDirect):
9246 (JSC::DFG::ByteCodeParser::set):
9247 (JSC::DFG::ByteCodeParser::setLocal):
9248 (JSC::DFG::ByteCodeParser::getArgument):
9249 (JSC::DFG::ByteCodeParser::setArgument):
9250 (JSC::DFG::ByteCodeParser::findArgumentPositionForArgument):
9252 (JSC::DFG::ByteCodeParser::findArgumentPositionForLocal):
9253 (JSC::DFG::ByteCodeParser::findArgumentPosition):
9254 (JSC::DFG::ByteCodeParser::flush):
9255 (JSC::DFG::ByteCodeParser::flushDirect):
9256 (JSC::DFG::ByteCodeParser::flushArgumentsAndCapturedVariables):
9257 (JSC::DFG::ByteCodeParser::handleInlining):
9258 (JSC::DFG::ByteCodeParser::parseBlock):
9259 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
9260 * dfg/DFGCSEPhase.cpp:
9261 (JSC::DFG::CSEPhase::setLocalStoreElimination):
9262 (JSC::DFG::CSEPhase::performNodeCSE):
9263 * dfg/DFGSpeculativeJIT.cpp:
9264 (JSC::DFG::SpeculativeJIT::compile):
9265 * dfg/DFGSpeculativeJIT.h:
9266 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
9268 2012-05-29 Geoffrey Garen <ggaren@apple.com>
9270 WeakGCMap should be lazy-finalization-safe
9271 https://bugs.webkit.org/show_bug.cgi?id=87784
9273 Reviewed by Darin Adler.
9275 * runtime/WeakGCMap.h:
9276 (JSC::WeakGCMap::get): Since this is a map of raw WeakImpl pointers, and
9277 not Weak<T>, we need to verify manually that the WeakImpl is live before
9278 we return its payload.
9280 2012-05-29 Mark Hahnenberg <mhahnenberg@apple.com>
9282 CopiedSpace::doneCopying could start another collection
9283 https://bugs.webkit.org/show_bug.cgi?id=86538
9285 Reviewed by Geoffrey Garen.
9287 It's possible that if we don't have anything at the head of to-space
9288 after a collection and the BlockAllocator doesn't have any fresh blocks
9289 to give us right now we could start another collection while still in
9290 the middle of the first collection when we call CopiedSpace::addNewBlock().
9292 One way to resolve this would be to have Heap::shouldCollect() check that
9293 m_operationInProgress is NoOperation. This would prevent the path in
9294 getFreshBlock() that starts the collection if we're already in the middle of one.
9296 I could not come up with a test case to reproduce this crash on ToT.
9299 (JSC::Heap::shouldCollect): We shouldn't collect if we're already in the middle
9300 of a collection, i.e. the current operation should be NoOperation.
9302 2012-05-29 David Barr <davidbarr@chromium.org>
9304 Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag
9305 https://bugs.webkit.org/show_bug.cgi?id=87685
9307 Reviewed by Eric Seidel.
9309 Add a configuration option for CSS image-resolution support, disabling it by default.
9311 * Configurations/FeatureDefines.xcconfig:
9313 2012-05-28 Sheriff Bot <webkit.review.bot@gmail.com>
9315 Unreviewed, rolling out r118646.
9316 http://trac.webkit.org/changeset/118646
9317 https://bugs.webkit.org/show_bug.cgi?id=87691
9319 broke V8 raytrace benchmark (Requested by pizlo_ on #webkit).
9322 (JSC::Heap::collect):
9323 * heap/MarkedBlock.cpp:
9324 (JSC::MarkedBlock::sweep):
9325 * heap/MarkedBlock.h:
9326 (JSC::MarkedBlock::sweepWeakSet):
9328 * heap/MarkedSpace.cpp:
9329 (JSC::SweepWeakSet::operator()):
9331 (JSC::MarkedSpace::sweepWeakSets):
9332 * heap/MarkedSpace.h:
9335 2012-05-28 Filip Pizlo <fpizlo@apple.com>
9337 DFG should not generate code for code that the CFA proves to be unreachable
9338 https://bugs.webkit.org/show_bug.cgi?id=87682
9340 Reviewed by Sam Weinig.
9342 This also fixes a small performance bug where CFA was not marking blocks
9343 as having constants (and hence not triggering constant folding) if the only
9344 constants were on GetLocals.
9346 And fixing that bug revealed another bug: constant folding was assuming that
9347 a GetLocal must be the first access to a local in a basic block. This isn't
9348 true. The first access may be a Flush. This patch fixes that issue using the
9349 safest approach possible, since we don't need to be clever for something that
9350 only happens in one of our benchmarks.
9352 * dfg/DFGAbstractState.cpp:
9353 (JSC::DFG::AbstractState::execute):
9354 * dfg/DFGConstantFoldingPhase.cpp:
9355 (JSC::DFG::ConstantFoldingPhase::run):
9356 * dfg/DFGJITCompiler.h:
9357 (JSC::DFG::JITCompiler::noticeOSREntry):
9358 * dfg/DFGSpeculativeJIT.cpp:
9359 (JSC::DFG::SpeculativeJIT::compile):
9361 2012-05-28 Carlos Garcia Campos <cgarcia@igalia.com>
9363 Unreviewed. Fix make distcheck.
9365 * GNUmakefile.list.am: Add missing header file.
9367 2012-05-27 Geoffrey Garen <ggaren@apple.com>
9369 Weak pointer finalization should be lazy
9370 https://bugs.webkit.org/show_bug.cgi?id=87599
9372 Reviewed by Darin Adler.
9375 (JSC::Heap::collect): Don't force immediate finalization -- it will
9378 * heap/MarkedBlock.cpp:
9379 (JSC::MarkedBlock::sweep): Sweep a block's weak set when sweeping the
9380 block. The weak set may not have been swept yet, and this is our last
9381 chance to run weak finalizers before we recycle the memory they reference.
9383 * heap/MarkedBlock.h:
9384 * heap/MarkedSpace.cpp:
9385 (JSC::MarkedBlock::sweepWeakSets):
9386 * heap/MarkedSpace.h:
9387 (JSC::MarkedSpace::sweepWeakSets): Nixed sweepWeakSets because it's unused
9390 2012-05-26 Geoffrey Garen <ggaren@apple.com>
9392 WebKit should be lazy-finalization-safe (esp. the DOM) v2
9393 https://bugs.webkit.org/show_bug.cgi?id=87581
9395 Reviewed by Oliver Hunt.
9397 * heap/MarkedBlock.cpp:
9398 (JSC::MarkedBlock::callDestructor):
9400 * heap/WeakSetInlines.h:
9401 (JSC::WeakBlock::finalize): Since we don't guarantee destruction order,
9402 it's not valid to access GC pointers like the Structure pointer during
9403 finalization. We NULL out the structure pointer in debug builds to try
9404 to make this programming mistake more obvious.
9406 * API/JSCallbackConstructor.cpp:
9407 (JSC::JSCallbackConstructor::destroy):
9408 * API/JSCallbackObject.cpp:
9410 (JSC::JSCallbackObjectData::finalize):
9411 * runtime/Arguments.cpp:
9412 (JSC::Arguments::destroy):
9413 * runtime/DateInstance.cpp:
9414 (JSC::DateInstance::destroy):
9415 * runtime/Error.cpp:
9416 (JSC::StrictModeTypeErrorFunction::destroy):
9417 * runtime/Executable.cpp:
9418 (JSC::ExecutableBase::destroy):
9419 (JSC::NativeExecutable::destroy):
9420 (JSC::ScriptExecutable::destroy):
9421 (JSC::EvalExecutable::destroy):
9422 (JSC::ProgramExecutable::destroy):
9423 (JSC::FunctionExecutable::destroy):
9424 * runtime/JSGlobalObject.cpp:
9425 (JSC::JSGlobalObject::destroy):
9426 * runtime/JSPropertyNameIterator.cpp:
9427 (JSC::JSPropertyNameIterator::destroy):
9428 * runtime/JSStaticScopeObject.cpp:
9429 (JSC::JSStaticScopeObject::destroy):
9430 * runtime/JSString.cpp:
9431 (JSC::JSString::destroy):
9432 * runtime/JSVariableObject.cpp:
9433 (JSC::JSVariableObject::destroy):
9434 * runtime/NameInstance.cpp:
9435 (JSC::NameInstance::destroy):
9436 * runtime/RegExp.cpp:
9437 (JSC::RegExp::destroy):
9438 * runtime/RegExpConstructor.cpp:
9439 (JSC::RegExpConstructor::destroy):
9440 * runtime/Structure.cpp:
9441 (JSC::Structure::destroy):
9442 * runtime/StructureChain.cpp:
9443 (JSC::StructureChain::destroy): Use static_cast instead of jsCast because
9444 jsCast does Structure-based validation, and our Structure is not guaranteed
9445 to be alive when we get finalized.
9447 2012-05-22 Filip Pizlo <fpizlo@apple.com>
9449 DFG CSE should eliminate redundant WeakJSConstants
9450 https://bugs.webkit.org/show_bug.cgi?id=87179
9452 Reviewed by Gavin Barraclough.
9454 Merged r118141 from dfgopt.
9456 * dfg/DFGCSEPhase.cpp:
9457 (JSC::DFG::CSEPhase::weakConstantCSE):
9459 (JSC::DFG::CSEPhase::performNodeCSE):
9461 (JSC::DFG::Node::weakConstant):
9463 2012-05-22 Filip Pizlo <fpizlo@apple.com>
9465 DFG CSE should do redundant store elimination
9466 https://bugs.webkit.org/show_bug.cgi?id=87161
9468 Reviewed by Oliver Hunt.
9470 Merge r118138 from dfgopt.
9472 This patch adds redundant store elimination. For example, consider this
9478 If o.x is speculated to be a well-behaved field, the first assignment is
9479 unnecessary, since the second just overwrites it. We would like to
9480 eliminate the first assignment in these cases. The need for this
9481 optimization arises mostly from stores that our runtime requires. For
9484 o = {f:1, g:2, h:3};
9486 This will have four assignments to the structure for the newly created
9487 object - one assignment for the empty structure, one for {f}, one for
9488 {f, g}, and one for {f, g, h}. We would like to only have the last of
9489 those assigments in this case.
9491 Intriguingly, doing so for captured variables breaks the way arguments
9492 simplification used to work. Consider that prior to either arguments
9493 simplification or store elimination we will have IR that looks like:
9495 a: SetLocal(r0, Empty)
9496 b: SetLocal(r1, Empty)
9498 d: CreateArguments(@c)
9502 Then redundant store elimination will eliminate the stores that
9503 initialize the arguments registers to Empty, but then arguments
9504 simplification eliminates the stores that initialize the arguments to
9505 the newly created arguments - and at this point we no longer have any
9506 stores to the arguments register, leading to hilarious crashes. This
9507 patch therefore changes arguments simplification to replace
9508 CreateArguments with JSConstant(Empty) rather than eliminating the
9509 SetLocals. But this revealed bugs where arguments simplification was
9510 being overzealous, so I fixed those bugs.
9512 This is a minor speed-up on V8/early and a handful of other tests.
9514 * bytecode/CodeBlock.h:
9515 (JSC::CodeBlock::uncheckedActivationRegister):
9516 * dfg/DFGAbstractState.cpp:
9517 (JSC::DFG::AbstractState::execute):
9518 * dfg/DFGArgumentsSimplificationPhase.cpp:
9519 (JSC::DFG::ArgumentsSimplificationPhase::run):
9520 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
9521 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUses):
9522 (JSC::DFG::ArgumentsSimplificationPhase::observeProperArgumentsUse):
9523 * dfg/DFGCSEPhase.cpp:
9524 (JSC::DFG::CSEPhase::globalVarStoreElimination):
9526 (JSC::DFG::CSEPhase::putStructureStoreElimination):
9527 (JSC::DFG::CSEPhase::putByOffsetStoreElimination):
9528 (JSC::DFG::CSEPhase::setLocalStoreElimination):
9529 (JSC::DFG::CSEPhase::setReplacement):
9530 (JSC::DFG::CSEPhase::eliminate):
9531 (JSC::DFG::CSEPhase::performNodeCSE):
9533 (JSC::DFG::Graph::uncheckedActivationRegisterFor):
9536 (JSC::DFG::Node::isPhantomArguments):
9538 (JSC::DFG::Node::hasConstant):
9539 (JSC::DFG::Node::valueOfJSConstant):
9540 (JSC::DFG::Node::hasStructureTransitionData):
9541 * dfg/DFGNodeType.h:
9543 * dfg/DFGPredictionPropagationPhase.cpp:
9544 (JSC::DFG::PredictionPropagationPhase::propagate):
9545 * dfg/DFGSpeculativeJIT.cpp:
9546 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
9547 * dfg/DFGSpeculativeJIT32_64.cpp:
9548 (JSC::DFG::SpeculativeJIT::compile):
9549 * dfg/DFGSpeculativeJIT64.cpp:
9550 (JSC::DFG::SpeculativeJIT::compile):
9552 2012-05-21 Filip Pizlo <fpizlo@apple.com>
9554 DFG ConvertThis should just be a CheckStructure if the structure is known
9555 https://bugs.webkit.org/show_bug.cgi?id=87057
9557 Reviewed by Gavin Barraclough.
9559 Merged r118021 from dfgopt.
9561 This gives ValueProfile the ability to track singleton values - i.e. profiling
9562 sites that always see the same value.
9564 That is then used to profile the structure in op_convert_this.
9566 This is then used to optimize op_convert_this into a CheckStructure if the
9567 structure is always the same.
9569 That then results in better CSE in inlined code that uses 'this', since
9570 previously we couldn't CSE accesses on 'this' from different inline call frames.
9572 Also fixed a bug where we were unnecessarily flushing 'this'.
9574 * bytecode/CodeBlock.cpp:
9575 (JSC::CodeBlock::dump):
9576 (JSC::CodeBlock::stronglyVisitStrongReferences):
9577 * bytecode/LazyOperandValueProfile.cpp:
9578 (JSC::CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions):
9579 * bytecode/LazyOperandValueProfile.h:
9580 (CompressedLazyOperandValueProfileHolder):
9581 * bytecode/Opcode.h:
9583 (JSC::padOpcodeName):
9584 * bytecode/ValueProfile.h:
9585 (JSC::ValueProfileBase::ValueProfileBase):
9586 (JSC::ValueProfileBase::dump):
9587 (JSC::ValueProfileBase::computeUpdatedPrediction):
9589 * bytecompiler/BytecodeGenerator.cpp:
9590 (JSC::BytecodeGenerator::BytecodeGenerator):
9591 * dfg/DFGByteCodeParser.cpp:
9592 (JSC::DFG::ByteCodeParser::setArgument):
9593 (JSC::DFG::ByteCodeParser::parseBlock):
9594 * jit/JITOpcodes.cpp:
9595 (JSC::JIT::emit_op_convert_this):
9596 (JSC::JIT::emitSlow_op_convert_this):
9597 * jit/JITOpcodes32_64.cpp:
9598 (JSC::JIT::emit_op_convert_this):
9599 (JSC::JIT::emitSlow_op_convert_this):
9600 * llint/LLIntSlowPaths.cpp:
9601 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
9602 * llint/LowLevelInterpreter32_64.asm:
9603 * llint/LowLevelInterpreter64.asm:
9604 * runtime/JSValue.h:
9606 * runtime/Structure.h:
9607 (JSC::JSValue::structureOrUndefined):
9610 2012-05-24 Tim Horton <timothy_horton@apple.com>
9612 Add feature defines for web-facing parts of CSS Regions and Exclusions
9613 https://bugs.webkit.org/show_bug.cgi?id=87442
9614 <rdar://problem/10887709>
9616 Reviewed by Dan Bernstein.
9618 * Configurations/FeatureDefines.xcconfig:
9620 2012-05-24 Geoffrey Garen <ggaren@apple.com>
9622 WebKit should be lazy-finalization-safe (esp. the DOM)
9623 https://bugs.webkit.org/show_bug.cgi?id=87456
9625 Reviewed by Filip Pizlo.
9627 Lazy finalization adds one twist to weak pointer use:
9629 A HashMap of weak pointers may contain logically null entries.
9630 (Weak pointers behave as-if null once their payloads die.)
9631 Insertion must not assume that a pre-existing entry is
9632 necessarily valid, and iteration must not assume that all
9633 entries can be dereferenced.
9635 (Previously, I thought that it also added a second twist:
9637 A demand-allocated weak pointer may replace a dead payload
9638 before the payload's finalizer runs. In that case, when the
9639 payload's finalizer runs, the payload has already been
9640 overwritten, and the finalizer should not clear the payload,
9641 which now points to something new.
9643 But that's not the case here, since we cancel the old payload's
9644 finalizer when we over-write it. I've added ASSERTs to verify this
9645 assumption, in case it ever changes.)
9647 * API/JSClassRef.cpp:
9648 (OpaqueJSClass::prototype): No need to specify null; that's the default.
9650 * API/JSWeakObjectMapRefPrivate.cpp: Use remove, since take() is gone.
9653 (WeakImplAccessor::was): This is no longer a debug-only function, since
9654 it's required to reason about lazily finalized pointers.
9659 (JSC::weakClear): Added these helper functions for the common idioms of
9660 what clients want to do in their weak pointer finalizers.
9663 (JSC::JITThunks::hostFunctionStub): Use the new idioms. Otherwise, we
9664 would return NULL for a "zombie" executable weak pointer that was waiting
9665 for finalization (item (2)), and finalizing a dead executable weak pointer
9666 would potentially destroy a new, live one (item (1)).
9668 * runtime/RegExpCache.cpp:
9669 (JSC::RegExpCache::lookupOrCreate):
9670 (JSC::RegExpCache::finalize): Ditto.
9672 (JSC::RegExpCache::invalidateCode): Check for null while iterating. (See
9675 * runtime/Structure.cpp:
9676 (JSC::StructureTransitionTable::contains):
9677 (JSC::StructureTransitionTable::add): Use get and set instead of add and
9678 contains, since add and contains are not compatible with lazy finalization.
9680 * runtime/WeakGCMap.h:
9682 (JSC::WeakGCMap::clear):
9683 (JSC::WeakGCMap::remove): Removed a bunch of code that was incompatible with
9684 lazy finalization because I didn't feel like making it compatible, and I had
9687 2012-05-24 Filip Pizlo <fpizlo@apple.com>
9689 REGRESSION (r118013-r118031): Loops/Reloads under www.yahoo.com, quits after three tries with error
9690 https://bugs.webkit.org/show_bug.cgi?id=87327
9692 Reviewed by Geoffrey Garen.
9694 If you use AbstractValue::filter(StructureSet) to test subset relationships between TOP and a
9695 set containing >=2 elements, you're going to have a bad time.
9697 That's because AbstractValue considers a set with >=2 elements to be equivalent to TOP, in order
9698 to save space and speed up convergence. So filtering has no effect in this case, which made
9699 the code think that the abstract value was proving that the structure check was unnecessary.
9700 The correct thing to do is to use isSubsetOf() on the StructureAbstractValue, which does the
9701 right thingies for TOP and >=2 elements.
9703 * dfg/DFGAbstractState.cpp:
9704 (JSC::DFG::AbstractState::execute):
9705 * dfg/DFGSpeculativeJIT32_64.cpp:
9706 (JSC::DFG::SpeculativeJIT::compile):
9707 * dfg/DFGSpeculativeJIT64.cpp:
9708 (JSC::DFG::SpeculativeJIT::compile):
9710 2012-05-24 Filip Pizlo <fpizlo@apple.com>
9712 new test fast/js/dfg-arguments-mixed-alias.html fails on JSVALUE32_64
9713 https://bugs.webkit.org/show_bug.cgi?id=87378
9715 Reviewed by Gavin Barraclough.
9717 - Captured variable tracking forgot did not consistently handle arguments, leading to OSR
9720 - Nodes capable of exiting were tracked in a non-monotonic way, leading to compiler errors.
9722 * dfg/DFGByteCodeParser.cpp:
9723 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
9724 * dfg/DFGCSEPhase.cpp:
9725 (JSC::DFG::CSEPhase::CSEPhase):
9727 (JSC::DFG::performCSE):
9728 * dfg/DFGCSEPhase.h:
9731 * dfg/DFGDriver.cpp:
9732 (JSC::DFG::compile):
9734 (JSC::DFG::Graph::resetExitStates):
9740 (JSC::DFG::runPhase):
9742 2012-05-24 Geoffrey Garen <ggaren@apple.com>
9744 Made WeakSet per-block instead of per-heap
9745 https://bugs.webkit.org/show_bug.cgi?id=87401
9747 Reviewed by Oliver Hunt.
9749 This allows us fast access to the set of all weak pointers for a block,
9750 which is a step toward lazy finalization.
9752 No performance change.
9756 (JSC::Heap::lastChanceToFinalize): Removed the per-heap weak set, since
9759 (JSC::Heap::markRoots): Delegate weak set visiting to the marked space,
9760 since it knows how to iterate all blocks.
9762 (JSC::Heap::collect): Moved the reaping outside of markRoots, since it
9763 doesn't mark anything.
9765 Make sure to reset allocators after shrinking, since shrinking may
9766 deallocate the current allocator.
9769 (Heap): No more per-heap weak set, since it's per-block now.
9771 * heap/MarkedBlock.cpp:
9772 (JSC::MarkedBlock::MarkedBlock):
9773 * heap/MarkedBlock.h:
9775 (JSC::MarkedBlock::lastChanceToFinalize): Migrated finalization logic
9776 here from the heap, so the heap doesn't need to know about our internal
9777 data structures like our weak set.
9779 (JSC::MarkedBlock::heap):
9780 (JSC::MarkedBlock::weakSet):
9781 (JSC::MarkedBlock::shrink):
9782 (JSC::MarkedBlock::resetAllocator):
9783 (JSC::MarkedBlock::visitWeakSet):
9784 (JSC::MarkedBlock::reapWeakSet):
9785 (JSC::MarkedBlock::sweepWeakSet):
9786 * heap/MarkedSpace.cpp:
9787 (JSC::VisitWeakSet::VisitWeakSet):
9788 (JSC::VisitWeakSet::operator()):
9791 (JSC::ReapWeakSet::operator()):
9792 (JSC::SweepWeakSet::operator()):
9793 (JSC::LastChanceToFinalize::operator()):
9794 (JSC::MarkedSpace::lastChanceToFinalize):
9795 (JSC::ResetAllocator::operator()):
9796 (JSC::MarkedSpace::resetAllocators):
9797 (JSC::MarkedSpace::visitWeakSets):
9798 (JSC::MarkedSpace::reapWeakSets):
9799 (JSC::MarkedSpace::sweepWeakSets):
9800 (JSC::Shrink::operator()):
9801 (JSC::MarkedSpace::shrink):
9802 * heap/MarkedSpace.h:
9803 (MarkedSpace): Make sure to account for our weak sets when sweeping,
9810 (JSC::WeakSet::heap):
9812 (JSC::WeakSet::lastChanceToFinalize):
9813 (JSC::WeakSet::visit):
9814 (JSC::WeakSet::reap):
9815 (JSC::WeakSet::shrink):
9816 (JSC::WeakSet::resetAllocator): Inlined some things since they're called
9817 once per block now instead of once per heap.
9819 * heap/WeakSetInlines.h:
9820 (JSC::WeakSet::allocate): Use the per-block weak set since there is no
9821 per-heap weak set anymore.
9823 2012-05-24 Gavin Barraclough <barraclough@apple.com>
9827 Rubber stamped by Geoff Garen
9832 2012-05-24 Gavin Barraclough <barraclough@apple.com>
9834 Move cacheFlush from ExecutableAllocator to Assembler classes
9835 https://bugs.webkit.org/show_bug.cgi?id=87420
9837 Reviewed by Oliver Hunt.
9839 Makes more sense there, & remove a pile of #ifdefs.
9841 * assembler/ARMAssembler.cpp:
9843 (JSC::ARMAssembler::cacheFlush):
9844 * assembler/ARMAssembler.h:
9846 (JSC::ARMAssembler::cacheFlush):
9847 * assembler/ARMv7Assembler.h:
9848 (JSC::ARMv7Assembler::relinkJump):
9849 (JSC::ARMv7Assembler::cacheFlush):
9851 (JSC::ARMv7Assembler::setInt32):
9852 (JSC::ARMv7Assembler::setUInt7ForLoad):
9853 * assembler/AbstractMacroAssembler.h:
9854 (JSC::AbstractMacroAssembler::cacheFlush):
9855 * assembler/LinkBuffer.h:
9856 (JSC::LinkBuffer::performFinalization):
9857 * assembler/MIPSAssembler.h:
9858 (JSC::MIPSAssembler::relinkJump):
9859 (JSC::MIPSAssembler::relinkCall):
9860 (JSC::MIPSAssembler::repatchInt32):
9861 (JSC::MIPSAssembler::cacheFlush):
9863 * assembler/SH4Assembler.h:
9864 (JSC::SH4Assembler::repatchCompact):
9865 (JSC::SH4Assembler::cacheFlush):
9867 * assembler/X86Assembler.h:
9869 (JSC::X86Assembler::cacheFlush):
9870 * jit/ExecutableAllocator.cpp:
9872 * jit/ExecutableAllocator.h:
9873 (ExecutableAllocator):
9875 2012-05-24 John Mellor <johnme@chromium.org>
9877 Font Boosting: Add compile flag and runtime setting
9878 https://bugs.webkit.org/show_bug.cgi?id=87394
9880 Reviewed by Adam Barth.
9882 Add ENABLE_FONT_BOOSTING.
9884 * Configurations/FeatureDefines.xcconfig:
9886 2012-05-24 Allan Sandfeld Jensen <allan.jensen@nokia.com>
9888 cti_vm_throw gets kicked out by gcc 4.6 -flto
9889 https://bugs.webkit.org/show_bug.cgi?id=56088
9891 Reviewed by Darin Adler.
9893 Add REFERENCED_FROM_ASM to functions only referenced from assembler.
9895 * dfg/DFGOperations.cpp:
9896 * jit/HostCallReturnValue.h:
9898 * jit/ThunkGenerators.cpp:
9900 2012-05-24 Filip Pizlo <fpizlo@apple.com>
9902 Incorrect merge of r117542 from dfg opt branch in r118323 is leading to fast/js/dfg-arguments-osr-exit.html failing
9903 https://bugs.webkit.org/show_bug.cgi?id=87350
9905 Reviewed by Maciej Stachowiak.
9907 The dfgopt branch introduced the notion of a local variable being killed because it was aliased
9908 to the Arguments object as in cases like:
9913 This required changes to OSR exit handling - if the variable is dead but aliased to arguments, then
9914 OSR exit should reify the arguments. But meanwhile, in tip of tree we introduced special handling for
9915 dead variables on OSR exit. When the two were merged in r118323, the structure of the if/else branches
9916 ended up being such that we would treat dead arguments variables as totally dead as opposed to treating
9917 them as variables that need arguments reification.
9919 This fixes the structure of the relevant if/else block so that variables that are dead-but-arguments
9920 end up being treated as reified arguments objects, while variables that are dead but not aliased to
9921 arguments are treated as tip of tree would have treated them (initialize to Undefined).
9923 * dfg/DFGSpeculativeJIT.cpp:
9924 (JSC::DFG::SpeculativeJIT::compile):
9926 2012-05-24 Csaba Osztrogonác <ossy@webkit.org>
9928 Unreviewed 32 bit buildfix after r118325.
9930 * dfg/DFGSpeculativeJIT32_64.cpp:
9931 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): Use ASSERT_UNUSED instead ASSERT.
9933 2012-05-23 Filip Pizlo <fpizlo@apple.com>
9935 DFG operationTearOffActivation should return after handling the null activation case
9936 https://bugs.webkit.org/show_bug.cgi?id=87348
9937 <rdar://problem/11522295>
9939 Reviewed by Oliver Hunt.
9941 * dfg/DFGOperations.cpp:
9943 2012-05-23 Filip Pizlo <fpizlo@apple.com>
9945 Unreviewed, merge the arguments fix in r118138 to get bots green.
9947 * dfg/DFGArgumentsSimplificationPhase.cpp:
9948 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
9950 2012-05-20 Filip Pizlo <fpizlo@apple.com>
9952 DFG CFA should record if a node can OSR exit
9953 https://bugs.webkit.org/show_bug.cgi?id=86905
9955 Reviewed by Oliver Hunt.
9957 Merged r117931 from dfgopt.
9959 Adds a NodeFlag that denotes nodes that are known to not have OSR exits.
9960 This ought to aid any backwards analyses that need to know when a
9961 backward flow merge might happen due to a side exit.
9963 Also added assertions into speculationCheck() that ensure that we did not
9964 mark a node as non-exiting and then promptly compile in an exit. This
9965 helped catch some minor bugs where we were doing unnecessary speculation
9968 This is a perf-neutral change. The speculation checks that this removes
9969 were not on hot paths of major benchmarks.
9971 * bytecode/PredictedType.h:
9973 (JSC::isAnyPrediction):
9974 * dfg/DFGAbstractState.cpp:
9975 (JSC::DFG::AbstractState::execute):
9976 * dfg/DFGAbstractState.h:
9977 (JSC::DFG::AbstractState::speculateInt32Unary):
9979 (JSC::DFG::AbstractState::speculateNumberUnary):
9980 (JSC::DFG::AbstractState::speculateBooleanUnary):
9981 (JSC::DFG::AbstractState::speculateInt32Binary):
9982 (JSC::DFG::AbstractState::speculateNumberBinary):
9984 (JSC::DFG::Node::mergeFlags):
9985 (JSC::DFG::Node::filterFlags):
9987 (JSC::DFG::Node::setCanExit):
9988 (JSC::DFG::Node::canExit):
9989 * dfg/DFGNodeFlags.cpp:
9990 (JSC::DFG::nodeFlagsAsString):
9991 * dfg/DFGNodeFlags.h:
9993 * dfg/DFGSpeculativeJIT.cpp:
9994 (JSC::DFG::SpeculativeJIT::SpeculativeJIT):
9995 (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
9996 (JSC::DFG::SpeculativeJIT::compileValueToInt32):
9997 * dfg/DFGSpeculativeJIT.h:
9998 (JSC::DFG::SpeculativeJIT::speculationCheck):
9999 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
10000 (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution):
10002 * dfg/DFGSpeculativeJIT32_64.cpp:
10003 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
10004 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
10005 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
10006 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
10007 (JSC::DFG::SpeculativeJIT::compile):
10008 * dfg/DFGSpeculativeJIT64.cpp:
10009 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
10010 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
10011 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
10012 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
10013 (JSC::DFG::SpeculativeJIT::compile):
10015 2012-05-20 Filip Pizlo <fpizlo@apple.com>
10017 DFG should not do unnecessary indirections when storing to objects
10018 https://bugs.webkit.org/show_bug.cgi?id=86959
10020 Reviewed by Oliver Hunt.
10022 Merged r117819 from dfgopt.
10024 * dfg/DFGByteCodeParser.cpp:
10025 (JSC::DFG::ByteCodeParser::parseBlock):
10026 * dfg/DFGCSEPhase.cpp:
10027 (JSC::DFG::CSEPhase::getByOffsetLoadElimination):
10028 * dfg/DFGSpeculativeJIT32_64.cpp:
10029 (JSC::DFG::SpeculativeJIT::compile):
10030 * dfg/DFGSpeculativeJIT64.cpp:
10031 (JSC::DFG::SpeculativeJIT::compile):
10033 2012-05-17 Filip Pizlo <fpizlo@apple.com>
10035 DFG should optimize aliased uses of the Arguments object of the current call frame
10036 https://bugs.webkit.org/show_bug.cgi?id=86552
10038 Reviewed by Geoff Garen.
10040 Merged r117542 and r117543 from dfgopt.
10042 Performs must-alias and escape analysis on uses of CreateArguments, and if
10043 a variable is must-aliased to CreateArguments and does not escape, then we
10044 turn all uses of that variable into direct arguments accesses.
10046 36% speed-up on V8/earley leading to a 2.3% speed-up overall in V8.
10048 * bytecode/CodeBlock.h:
10049 (JSC::CodeBlock::uncheckedArgumentsRegister):
10050 * bytecode/ValueRecovery.h:
10051 (JSC::ValueRecovery::argumentsThatWereNotCreated):
10053 (JSC::ValueRecovery::dump):
10054 * dfg/DFGAbstractState.cpp:
10055 (JSC::DFG::AbstractState::execute):
10056 * dfg/DFGAdjacencyList.h:
10058 (JSC::DFG::AdjacencyList::removeEdgeFromBag):
10059 * dfg/DFGArgumentsSimplificationPhase.cpp:
10060 (JSC::DFG::ArgumentsSimplificationPhase::run):
10061 (ArgumentsSimplificationPhase):
10062 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
10063 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUses):
10064 (JSC::DFG::ArgumentsSimplificationPhase::observeProperArgumentsUse):
10065 (JSC::DFG::ArgumentsSimplificationPhase::isOKToOptimize):
10066 (JSC::DFG::ArgumentsSimplificationPhase::removeArgumentsReferencingPhantomChild):
10067 * dfg/DFGAssemblyHelpers.h:
10068 (JSC::DFG::AssemblyHelpers::argumentsRegisterFor):
10070 * dfg/DFGByteCodeParser.cpp:
10071 (JSC::DFG::ByteCodeParser::parseBlock):
10072 * dfg/DFGCFGSimplificationPhase.cpp:
10073 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
10074 * dfg/DFGGPRInfo.h:
10076 * dfg/DFGGraph.cpp:
10077 (JSC::DFG::Graph::collectGarbage):
10081 (JSC::DFG::Graph::executableFor):
10082 (JSC::DFG::Graph::argumentsRegisterFor):
10083 (JSC::DFG::Graph::uncheckedArgumentsRegisterFor):
10084 (JSC::DFG::Graph::clobbersWorld):
10086 (JSC::DFG::Node::hasHeapPrediction):
10087 * dfg/DFGNodeType.h:
10089 * dfg/DFGOSRExitCompiler.cpp:
10090 * dfg/DFGOSRExitCompiler.h:
10091 (JSC::DFG::OSRExitCompiler::OSRExitCompiler):
10093 * dfg/DFGOSRExitCompiler32_64.cpp:
10094 (JSC::DFG::OSRExitCompiler::compileExit):
10095 * dfg/DFGOSRExitCompiler64.cpp:
10096 (JSC::DFG::OSRExitCompiler::compileExit):
10097 * dfg/DFGOperations.cpp:
10098 * dfg/DFGPredictionPropagationPhase.cpp:
10099 (JSC::DFG::PredictionPropagationPhase::propagate):
10100 * dfg/DFGSpeculativeJIT.cpp:
10101 (JSC::DFG::ValueSource::dump):
10102 (JSC::DFG::SpeculativeJIT::compile):
10103 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
10104 * dfg/DFGSpeculativeJIT.h:
10105 * dfg/DFGSpeculativeJIT32_64.cpp:
10106 (JSC::DFG::SpeculativeJIT::compile):
10107 * dfg/DFGSpeculativeJIT64.cpp:
10108 (JSC::DFG::SpeculativeJIT::compile):
10109 * dfg/DFGVariableAccessData.h:
10110 (JSC::DFG::VariableAccessData::VariableAccessData):
10111 (JSC::DFG::VariableAccessData::mergeIsArgumentsAlias):
10112 (VariableAccessData):
10113 (JSC::DFG::VariableAccessData::isArgumentsAlias):
10114 * jit/JITOpcodes.cpp:
10115 (JSC::JIT::emitSlow_op_get_argument_by_val):
10117 2012-05-23 Filip Pizlo <fpizlo@apple.com>
10119 DFGCapabilities should not try to get an arguments register from code blocks that don't have one
10120 https://bugs.webkit.org/show_bug.cgi?id=87332
10122 Reviewed by Andy Estes.
10124 * dfg/DFGCapabilities.h:
10125 (JSC::DFG::canInlineOpcode):
10127 2012-05-23 Filip Pizlo <fpizlo@apple.com>
10129 DFG should have sparse conditional constant propagation
10130 https://bugs.webkit.org/show_bug.cgi?id=86580
10132 Reviewed by Oliver Hunt.
10134 Merged r117370 from dfgopt.
10136 This enhances CFA so that if it suspects at any point during the fixpoint that a
10137 branch will only go one way, then it only propagates in that one way.
10139 This vastly increases the opportunities for CFG simplification. For example, it
10140 enables us to evaporate this loop:
10142 for (var i = 0; i < 1; ++i) doThings(i);
10144 As a result, it uncovered loads of bugs in the CFG simplifier. In particular:
10146 - Phi fixup was assuming that all Phis worth fixing up are shouldGenerate().
10147 That's not true; we also fixup Phis that are dead.
10149 - GetLocal fixup was assuming that it's only necessary to rewire links to a
10150 GetLocal, and that the GetLocal's own links don't need to be rewired. Untrue,
10151 because the GetLocal may not be rewirable (first block has no GetLocal for r42
10152 but second block does have a GetLocal), in which case it will refer to a Phi
10153 in the second block. We need it to refer to a Phi from the first block to
10154 ensure that subsequent transformations work.
10156 - Tail operand fixup was ignoring the fact that Phis in successors may contain
10157 references to the children of our tail variables. Hence, successor Phi child
10158 substitution needs to use the original second block variable table as its
10159 prior, rather than trying to reconstruct the prior later (since by that point
10160 the children of the second block's tail variables will have been fixed up, so
10161 we will not know what the prior would have been).
10163 * dfg/DFGAbstractState.cpp:
10164 (JSC::DFG::AbstractState::beginBasicBlock):
10165 (JSC::DFG::AbstractState::endBasicBlock):
10166 (JSC::DFG::AbstractState::reset):
10167 (JSC::DFG::AbstractState::execute):
10168 (JSC::DFG::AbstractState::mergeToSuccessors):
10169 * dfg/DFGAbstractState.h:
10170 (JSC::DFG::AbstractState::branchDirectionToString):
10172 * dfg/DFGCFGSimplificationPhase.cpp:
10173 (JSC::DFG::CFGSimplificationPhase::run):
10174 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
10175 (JSC::DFG::CFGSimplificationPhase::OperandSubstitution::OperandSubstitution):
10176 (OperandSubstitution):
10177 (JSC::DFG::CFGSimplificationPhase::skipGetLocal):
10178 (JSC::DFG::CFGSimplificationPhase::recordPossibleIncomingReference):
10179 (CFGSimplificationPhase):
10180 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
10181 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
10183 (JSC::DFG::Graph::changeEdge):
10185 2012-05-23 Ojan Vafai <ojan@chromium.org>
10187 add back the ability to disable flexbox
10188 https://bugs.webkit.org/show_bug.cgi?id=87147
10190 Reviewed by Tony Chang.
10192 * Configurations/FeatureDefines.xcconfig:
10194 2012-05-23 Filip Pizlo <fpizlo@apple.com>
10196 Unreviewed, fix Windows build.
10198 * bytecode/CodeBlock.h:
10199 * dfg/DFGCapabilities.h:
10200 (JSC::DFG::canCompileOpcode):
10201 (JSC::DFG::canCompileOpcodes):
10205 2012-05-23 Filip Pizlo <fpizlo@apple.com>
10207 DFG should optimize inlined uses of arguments.length and arguments[i]
10208 https://bugs.webkit.org/show_bug.cgi?id=86327
10210 Reviewed by Gavin Barraclough.
10212 Merged r117017 from dfgopt.
10214 Turns inlined uses of arguments.length into a constant.
10216 Turns inlined uses of arguments[constant] into a direct reference to the
10219 Big win on micro-benchmarks. Not yet a win on V8 because the hot uses of
10220 arguments.length and arguments[i] are aliased. I'll leave the aliasing
10221 optimizations to a later patch.
10224 * GNUmakefile.list.am:
10225 * JavaScriptCore.xcodeproj/project.pbxproj:
10227 * bytecode/DFGExitProfile.h:
10228 (FrequentExitSite):
10229 (JSC::DFG::FrequentExitSite::FrequentExitSite):
10230 (JSC::DFG::QueryableExitProfile::hasExitSite):
10231 (QueryableExitProfile):
10232 * dfg/DFGAbstractState.cpp:
10233 (JSC::DFG::AbstractState::execute):
10234 * dfg/DFGArgumentsSimplificationPhase.cpp: Added.
10236 (ArgumentsSimplificationPhase):
10237 (JSC::DFG::ArgumentsSimplificationPhase::ArgumentsSimplificationPhase):
10238 (JSC::DFG::ArgumentsSimplificationPhase::run):
10239 (JSC::DFG::performArgumentsSimplification):
10240 * dfg/DFGArgumentsSimplificationPhase.h: Added.
10242 * dfg/DFGAssemblyHelpers.cpp:
10243 (JSC::DFG::AssemblyHelpers::executableFor):
10245 * dfg/DFGAssemblyHelpers.h:
10247 * dfg/DFGByteCodeParser.cpp:
10248 (JSC::DFG::ByteCodeParser::parseBlock):
10249 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
10250 * dfg/DFGCSEPhase.cpp:
10251 (JSC::DFG::CSEPhase::getLocalLoadElimination):
10252 (JSC::DFG::CSEPhase::performNodeCSE):
10253 * dfg/DFGDriver.cpp:
10254 (JSC::DFG::compile):
10256 (JSC::DFG::Graph::Graph):
10257 (JSC::DFG::Graph::executableFor):
10259 (JSC::DFG::Graph::clobbersWorld):
10261 (JSC::DFG::Node::convertToConstant):
10262 (JSC::DFG::Node::convertToGetLocalUnlinked):
10264 (JSC::DFG::Node::unlinkedLocal):
10265 * dfg/DFGNodeType.h:
10267 * dfg/DFGOSRExit.cpp:
10268 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
10269 * dfg/DFGPredictionPropagationPhase.cpp:
10270 (JSC::DFG::PredictionPropagationPhase::propagate):
10271 * dfg/DFGSpeculativeJIT32_64.cpp:
10272 (JSC::DFG::SpeculativeJIT::compile):
10273 * dfg/DFGSpeculativeJIT64.cpp:
10274 (JSC::DFG::SpeculativeJIT::compile):
10276 2012-05-13 Filip Pizlo <fpizlo@apple.com>
10278 DFG should be able to optimize foo.apply(bar, arguments)
10279 https://bugs.webkit.org/show_bug.cgi?id=86306
10281 Reviewed by Gavin Barraclough.
10283 Merge r116912 from dfgopt.
10285 Enables compilation of op_jneq_ptr and some forms of op_call_varargs.
10287 Also includes a bunch of bug fixes that were made necessary by the increased
10288 pressure on the CFG simplifier.
10290 This is a 1-2% win on V8.
10292 * bytecode/CodeBlock.cpp:
10293 (JSC::CodeBlock::printCallOp):
10294 (JSC::CodeBlock::CodeBlock):
10295 (JSC::ProgramCodeBlock::canCompileWithDFGInternal):
10296 (JSC::EvalCodeBlock::canCompileWithDFGInternal):
10297 (JSC::FunctionCodeBlock::canCompileWithDFGInternal):
10298 * bytecode/CodeBlock.h:
10300 (JSC::CodeBlock::canCompileWithDFG):
10301 (JSC::CodeBlock::canCompileWithDFGState):
10302 (ProgramCodeBlock):
10304 (FunctionCodeBlock):
10305 * dfg/DFGAbstractState.cpp:
10306 (JSC::DFG::AbstractState::execute):
10307 * dfg/DFGByteCodeParser.cpp:
10308 (JSC::DFG::ByteCodeParser::parseBlock):
10309 (JSC::DFG::ByteCodeParser::processPhiStack):
10310 (JSC::DFG::ByteCodeParser::parse):
10311 * dfg/DFGCFGSimplificationPhase.cpp:
10312 (JSC::DFG::CFGSimplificationPhase::run):
10313 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
10314 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
10315 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
10316 * dfg/DFGCSEPhase.cpp:
10317 (JSC::DFG::CSEPhase::getLocalLoadElimination):
10319 (JSC::DFG::CSEPhase::setReplacement):
10320 (JSC::DFG::CSEPhase::performNodeCSE):
10321 * dfg/DFGCapabilities.cpp:
10322 (JSC::DFG::debugFail):
10324 (JSC::DFG::canHandleOpcodes):
10325 (JSC::DFG::canCompileOpcodes):
10326 (JSC::DFG::canInlineOpcodes):
10327 * dfg/DFGCapabilities.h:
10328 (JSC::DFG::canCompileOpcode):
10329 (JSC::DFG::canInlineOpcode):
10331 (JSC::DFG::canCompileOpcodes):
10332 (JSC::DFG::canCompileEval):
10333 (JSC::DFG::canCompileProgram):
10334 (JSC::DFG::canCompileFunctionForCall):
10335 (JSC::DFG::canCompileFunctionForConstruct):
10337 * dfg/DFGGraph.cpp:
10338 (JSC::DFG::Graph::dump):
10339 * dfg/DFGNodeType.h:
10341 * dfg/DFGPredictionPropagationPhase.cpp:
10342 (JSC::DFG::PredictionPropagationPhase::propagate):
10343 * dfg/DFGSpeculativeJIT32_64.cpp:
10344 (JSC::DFG::SpeculativeJIT::compile):
10345 * dfg/DFGSpeculativeJIT64.cpp:
10346 (JSC::DFG::SpeculativeJIT::emitCall):
10347 (JSC::DFG::SpeculativeJIT::compile):
10348 * dfg/DFGValidate.cpp:
10350 (JSC::DFG::Validate::validate):
10351 (JSC::DFG::Validate::checkOperand):
10352 (JSC::DFG::Validate::reportValidationContext):
10354 (JSC::JIT::emitOptimizationCheck):
10355 (JSC::JIT::privateCompileSlowCases):
10356 (JSC::JIT::privateCompile):
10358 * jit/JITArithmetic.cpp:
10359 (JSC::JIT::compileBinaryArithOp):
10360 * jit/JITPropertyAccess.cpp:
10361 (JSC::JIT::privateCompilePutByIdTransition):
10362 * jit/JITPropertyAccess32_64.cpp:
10363 (JSC::JIT::privateCompilePutByIdTransition):
10364 * tools/CodeProfile.cpp:
10365 (JSC::CodeProfile::sample):
10367 2012-05-23 Geoffrey Garen <ggaren@apple.com>
10369 Refactored WeakBlock to use malloc, clarify behavior
10370 https://bugs.webkit.org/show_bug.cgi?id=87318
10372 Reviewed by Filip Pizlo.
10374 We want to use malloc so we can make these smaller than 4KB,
10375 since an individual MarkedBlock will usually have fewer than
10376 4KB worth of weak pointers.
10379 (JSC::Heap::markRoots): Renamed visitLiveWeakImpls to visit, since
10380 we no longer need to distinguish from "visitDeadWeakImpls".
10382 Renamed "visitDeadWeakImpls" to "reap" because we're not actually
10383 doing any visiting -- we're just tagging things as dead.
10385 * heap/WeakBlock.cpp:
10386 (JSC::WeakBlock::create):
10387 (JSC::WeakBlock::destroy):
10388 (JSC::WeakBlock::WeakBlock): Malloc!
10390 (JSC::WeakBlock::visit):
10391 (JSC::WeakBlock::reap): Renamed as above.
10393 * heap/WeakBlock.h:
10394 (WeakBlock): Reduced to 3KB, as explained above.
10396 * heap/WeakSet.cpp:
10397 (JSC::WeakSet::visit):
10398 (JSC::WeakSet::reap):
10400 (WeakSet): Updated for renames, and to match WebKit style.
10402 2012-05-23 Filip Pizlo <fpizlo@apple.com>
10404 Use after free in JSC::DFG::ByteCodeParser::processPhiStack
10405 https://bugs.webkit.org/show_bug.cgi?id=87312
10406 <rdar://problem/11518848>
10408 Reviewed by Oliver Hunt.
10410 * dfg/DFGByteCodeParser.cpp:
10411 (JSC::DFG::ByteCodeParser::processPhiStack):
10412 (JSC::DFG::ByteCodeParser::parse):
10414 2012-05-23 Filip Pizlo <fpizlo@apple.com>
10416 It should be possible to make C function calls from DFG code on ARM in debug mode
10417 https://bugs.webkit.org/show_bug.cgi?id=87313
10419 Reviewed by Gavin Barraclough.
10421 * dfg/DFGSpeculativeJIT.h:
10424 2012-05-11 Filip Pizlo <fpizlo@apple.com>
10426 DFG should be able to inline functions that use arguments reflectively
10427 https://bugs.webkit.org/show_bug.cgi?id=86132
10429 Reviewed by Oliver Hunt.
10431 Merged r116838 from dfgopt.
10433 This turns on inlining of functions that use arguments reflectively, but it
10434 does not do any of the obvious optimizations that this exposes. I'll save that
10435 for another patch - the important thing for now is that this contains all of
10436 the plumbing necessary to make this kind of inlining sound even in bizarro
10437 cases like an inline callee escaping the arguments object to parts of the
10438 inline caller where the arguments are otherwise dead. Or even more fun cases
10439 like where you've inlined to an inline stack that is three-deep, and the
10440 function on top of the inline stack reflectively accesses the arguments of a
10441 function that is in the middle of the inline stack. Any subsequent
10442 optimizations that we do for the obvious cases of arguments usage in inline
10443 functions will have to take care not to break the baseline functionality that
10444 this patch plumbs together.
10446 * bytecode/CodeBlock.cpp:
10447 (JSC::CodeBlock::printCallOp):
10448 (JSC::CodeBlock::dump):
10449 * bytecode/CodeBlock.h:
10450 * dfg/DFGAssemblyHelpers.h:
10451 (JSC::DFG::AssemblyHelpers::argumentsRegisterFor):
10453 * dfg/DFGByteCodeParser.cpp:
10454 (InlineStackEntry):
10455 (JSC::DFG::ByteCodeParser::handleCall):
10456 (JSC::DFG::ByteCodeParser::handleInlining):
10457 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
10458 (JSC::DFG::ByteCodeParser::parse):
10459 * dfg/DFGCCallHelpers.h:
10460 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
10462 * dfg/DFGCapabilities.h:
10463 (JSC::DFG::canInlineOpcode):
10464 * dfg/DFGDriver.cpp:
10465 (JSC::DFG::compile):
10466 * dfg/DFGFixupPhase.cpp:
10467 (JSC::DFG::FixupPhase::fixupNode):
10468 * dfg/DFGOperations.cpp:
10469 * dfg/DFGOperations.h:
10470 * dfg/DFGSpeculativeJIT.h:
10471 (JSC::DFG::SpeculativeJIT::callOperation):
10472 * dfg/DFGSpeculativeJIT32_64.cpp:
10473 (JSC::DFG::SpeculativeJIT::compile):
10474 * dfg/DFGSpeculativeJIT64.cpp:
10475 (JSC::DFG::SpeculativeJIT::compile):
10476 * interpreter/CallFrame.cpp:
10478 (JSC::CallFrame::someCodeBlockForPossiblyInlinedCode):
10479 * interpreter/CallFrame.h:
10481 (JSC::ExecState::someCodeBlockForPossiblyInlinedCode):
10482 * interpreter/Interpreter.cpp:
10483 (JSC::Interpreter::retrieveArgumentsFromVMCode):
10484 * runtime/Arguments.cpp:
10485 (JSC::Arguments::tearOff):
10487 (JSC::Arguments::tearOffForInlineCallFrame):
10488 * runtime/Arguments.h:
10490 (JSC::Arguments::create):
10491 (JSC::Arguments::finishCreation):
10494 2012-05-23 Filip Pizlo <fpizlo@apple.com>
10496 Every OSR exit on ARM results in a crash
10497 https://bugs.webkit.org/show_bug.cgi?id=87307
10499 Reviewed by Geoffrey Garen.
10501 * dfg/DFGThunks.cpp:
10502 (JSC::DFG::osrExitGenerationThunkGenerator):
10504 2012-05-23 Geoffrey Garen <ggaren@apple.com>
10506 Refactored heap tear-down to use normal value semantics (i.e., destructors)
10507 https://bugs.webkit.org/show_bug.cgi?id=87302
10509 Reviewed by Oliver Hunt.
10511 This is a step toward incremental DOM finalization.
10513 * heap/CopiedSpace.cpp:
10514 (JSC::CopiedSpace::~CopiedSpace):
10515 * heap/CopiedSpace.h:
10516 (CopiedSpace): Just use our destructor, instead of relying on the heap
10517 to send us a special message at a special time.
10520 (JSC::Heap::Heap): Use OwnPtr for m_markListSet because this is not Sparta.
10522 (JSC::Heap::~Heap): No need for delete or freeAllBlocks because normal
10523 destructors do this work automatically now.
10525 (JSC::Heap::lastChanceToFinalize): Just call lastChanceToFinalize on our
10526 sub-objects, and assume it does the right thing. This improves encapsulation,
10527 so we can add items requiring finalization to our sub-objects.
10529 * heap/Heap.h: Moved m_blockAllocator to get the right destruction order.
10531 * heap/MarkedSpace.cpp:
10535 (JSC::Take::operator()):
10536 (JSC::Take::returnValue): Moved to the top of the file so it can be used
10537 in another function.
10539 (JSC::MarkedSpace::~MarkedSpace): Delete all outstanding memory, like a good
10542 (JSC::MarkedSpace::lastChanceToFinalize): Moved some code here from the heap,
10543 since it pertains to our internal implementation details.
10545 * heap/MarkedSpace.h:
10547 * heap/WeakBlock.cpp:
10548 (JSC::WeakBlock::lastChanceToFinalize):
10549 * heap/WeakBlock.h:
10551 * heap/WeakSet.cpp:
10552 (JSC::WeakSet::lastChanceToFinalize):
10554 (WeakSet): Stop using a special freeAllBlocks() callback and just implement
10555 lastChanceToFinalize.
10557 2011-05-22 Geoffrey Garen <ggaren@apple.com>
10559 Encapsulated some calculations for whether portions of the heap are empty
10560 https://bugs.webkit.org/show_bug.cgi?id=87210
10562 Reviewed by Gavin Barraclough.
10564 This is a step toward incremental DOM finalization.
10567 (JSC::Heap::~Heap): Explicitly call freeAllBlocks() instead of relying
10568 implicitly on all blocks thinking they're empty. In future, we may
10569 choose to tear down the heap without first setting all data structures
10572 * heap/MarkedBlock.h:
10573 (JSC::MarkedBlock::isEmpty):
10574 (JSC::MarkedBlock::gatherDirtyCells): Renamed markCountIsZero to isEmpty,
10575 in preparation for making it check for outstanding finalizers in addition
10578 * heap/MarkedSpace.cpp:
10581 (JSC::Take::operator()):
10582 (JSC::Take::returnValue):
10583 (JSC::MarkedSpace::shrink):
10584 (JSC::MarkedSpace::freeAllBlocks): Refactored the "Take" functor to support
10585 a conditional isEmpty check, so it dould be shared by shrink() and freeAllBlocks().
10587 * heap/WeakBlock.cpp:
10588 (JSC::WeakBlock::WeakBlock):
10589 (JSC::WeakBlock::visitLiveWeakImpls):
10590 (JSC::WeakBlock::visitDeadWeakImpls):
10591 * heap/WeakBlock.h:
10593 (JSC::WeakBlock::isEmpty):
10594 * heap/WeakSet.cpp:
10595 (JSC::WeakSet::sweep):
10596 (JSC::WeakSet::shrink): Use isEmpty(), in preparation for changes in
10597 its implementation.
10599 2012-05-23 Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
10601 [Qt] Remove references to $$QT_SOURCE_TREE
10603 With a modularized Qt, it's ambigious. What we really want is qtbase,
10604 which qtcore is a proxy for (we assume it will always live in qtbase).
10606 Reviewed by Tor Arne Vestbø.
10608 * JavaScriptCore.pri:
10611 2012-05-09 Filip Pizlo <fpizlo@apple.com>
10613 DFG should allow inlining in case of certain arity mismatches
10614 https://bugs.webkit.org/show_bug.cgi?id=86059
10616 Reviewed by Geoff Garen.
10618 Merge r116620 from dfgopt.
10620 * dfg/DFGByteCodeParser.cpp:
10621 (JSC::DFG::ByteCodeParser::handleInlining):
10623 2012-05-08 Filip Pizlo <fpizlo@apple.com>
10625 DFG variable capture analysis should work even if the variables arose through inlining
10626 https://bugs.webkit.org/show_bug.cgi?id=85945
10628 Reviewed by Oliver Hunt.
10630 Merged r116555 from dfgopt.
10632 This just changes how the DFG queries whether a variable is captured. It does not
10633 change any user-visible behavior.
10635 As part of this change, I further solidified the policy that the CFA behaves in an
10636 undefined way for captured locals and queries about their values will not yield
10637 reliable results. This will likely be changed in the future, but for now it makes
10640 One fun part about this change is that it recognizes that the same variable may
10641 be both captured and not, at the same time, because their live interval spans
10642 inlining boundaries. This only happens in the case of arguments to functions that
10643 capture their arguments, and this change treats them with just the right touch of
10644 conservatism: they will be treated as if captured by the caller as well as the
10647 Finally, this also adds captured variable reasoning to the InlineCallFrame, which
10648 I thought might be useful for later tooling.
10650 This is perf-neutral, since it does it does not make the DFG take advantage of this
10651 new functionality in any way. In particular, it is still the case that the DFG will
10652 not inline functions that use arguments reflectively or that create activations.
10654 * bytecode/CodeBlock.h:
10656 (JSC::CodeBlock::needsActivation):
10657 (JSC::CodeBlock::argumentIsCaptured):
10658 (JSC::CodeBlock::localIsCaptured):
10659 (JSC::CodeBlock::isCaptured):
10660 * bytecode/CodeOrigin.h:
10662 * dfg/DFGAbstractState.cpp:
10663 (JSC::DFG::AbstractState::initialize):
10664 (JSC::DFG::AbstractState::endBasicBlock):
10665 (JSC::DFG::AbstractState::execute):
10666 (JSC::DFG::AbstractState::merge):
10667 * dfg/DFGByteCodeParser.cpp:
10668 (JSC::DFG::ByteCodeParser::newVariableAccessData):
10669 (JSC::DFG::ByteCodeParser::getLocal):
10670 (JSC::DFG::ByteCodeParser::setLocal):
10671 (JSC::DFG::ByteCodeParser::getArgument):
10672 (JSC::DFG::ByteCodeParser::setArgument):
10673 (JSC::DFG::ByteCodeParser::flushArgument):
10674 (JSC::DFG::ByteCodeParser::parseBlock):
10675 (JSC::DFG::ByteCodeParser::processPhiStack):
10676 (JSC::DFG::ByteCodeParser::fixVariableAccessPredictions):
10677 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
10678 * dfg/DFGCFGSimplificationPhase.cpp:
10679 (CFGSimplificationPhase):
10680 (JSC::DFG::CFGSimplificationPhase::keepOperandAlive):
10681 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
10682 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
10684 * dfg/DFGFixupPhase.cpp:
10685 (JSC::DFG::FixupPhase::fixupNode):
10686 * dfg/DFGGraph.cpp:
10687 (JSC::DFG::Graph::nameOfVariableAccessData):
10689 (JSC::DFG::Graph::needsActivation):
10690 (JSC::DFG::Graph::usesArguments):
10691 * dfg/DFGPredictionPropagationPhase.cpp:
10692 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):
10693 * dfg/DFGSpeculativeJIT.cpp:
10694 (JSC::DFG::SpeculativeJIT::compile):
10695 * dfg/DFGSpeculativeJIT32_64.cpp:
10696 (JSC::DFG::SpeculativeJIT::compile):
10697 * dfg/DFGSpeculativeJIT64.cpp:
10698 (JSC::DFG::SpeculativeJIT::compile):
10699 * dfg/DFGVariableAccessData.h:
10700 (JSC::DFG::VariableAccessData::VariableAccessData):
10701 (JSC::DFG::VariableAccessData::mergeIsCaptured):
10702 (VariableAccessData):
10703 (JSC::DFG::VariableAccessData::isCaptured):
10705 2012-05-08 Filip Pizlo <fpizlo@apple.com>
10707 DFG should support op_get_argument_by_val and op_get_arguments_length
10708 https://bugs.webkit.org/show_bug.cgi?id=85911
10710 Reviewed by Oliver Hunt.
10712 Merged r116467 from dfgopt.
10714 This adds a simple and relatively conservative implementation of op_get_argument_by_val
10715 and op_get_arguments_length. We can optimize these later. For now it's great to have
10716 the additional coverage.
10718 This patch appears to be perf-neutral.
10720 * dfg/DFGAbstractState.cpp:
10721 (JSC::DFG::AbstractState::execute):
10722 * dfg/DFGAssemblyHelpers.h:
10723 (JSC::DFG::AssemblyHelpers::addressFor):
10724 (JSC::DFG::AssemblyHelpers::tagFor):
10725 (JSC::DFG::AssemblyHelpers::payloadFor):
10726 * dfg/DFGByteCodeParser.cpp:
10727 (JSC::DFG::ByteCodeParser::parseBlock):
10728 * dfg/DFGCapabilities.h:
10729 (JSC::DFG::canCompileOpcode):
10730 (JSC::DFG::canInlineOpcode):
10732 (JSC::DFG::Node::hasHeapPrediction):
10733 * dfg/DFGNodeType.h:
10735 * dfg/DFGOperations.cpp:
10736 * dfg/DFGOperations.h:
10737 * dfg/DFGPredictionPropagationPhase.cpp:
10738 (JSC::DFG::PredictionPropagationPhase::propagate):
10739 * dfg/DFGSpeculativeJIT.h:
10740 (JSC::DFG::SpeculativeJIT::callOperation):
10742 * dfg/DFGSpeculativeJIT32_64.cpp:
10743 (JSC::DFG::SpeculativeJIT::compile):
10744 * dfg/DFGSpeculativeJIT64.cpp:
10745 (JSC::DFG::SpeculativeJIT::compile):
10746 * jit/JITOpcodes.cpp:
10747 (JSC::JIT::emit_op_get_argument_by_val):
10748 * jit/JITOpcodes32_64.cpp:
10749 (JSC::JIT::emit_op_get_argument_by_val):
10750 * llint/LowLevelInterpreter32_64.asm:
10751 * llint/LowLevelInterpreter64.asm:
10753 2012-05-07 Filip Pizlo <fpizlo@apple.com>
10755 DFG should support op_tear_off_arguments
10756 https://bugs.webkit.org/show_bug.cgi?id=85847
10758 Reviewed by Michael Saboff.
10760 Merged r116378 from dfgopt.
10762 * dfg/DFGAbstractState.cpp:
10763 (JSC::DFG::AbstractState::execute):
10764 * dfg/DFGByteCodeParser.cpp:
10765 (JSC::DFG::ByteCodeParser::parseBlock):
10766 * dfg/DFGCapabilities.h:
10767 (JSC::DFG::canCompileOpcode):
10768 (JSC::DFG::canInlineOpcode):
10769 * dfg/DFGNodeType.h:
10771 * dfg/DFGOperations.cpp:
10772 * dfg/DFGOperations.h:
10773 * dfg/DFGPredictionPropagationPhase.cpp:
10774 (JSC::DFG::PredictionPropagationPhase::propagate):
10775 * dfg/DFGSpeculativeJIT.h:
10777 (JSC::DFG::SpeculativeJIT::callOperation):
10778 * dfg/DFGSpeculativeJIT32_64.cpp:
10779 (JSC::DFG::SpeculativeJIT::compile):
10780 * dfg/DFGSpeculativeJIT64.cpp:
10781 (JSC::DFG::SpeculativeJIT::compile):
10783 2012-05-22 Mark Hahnenberg <mhahnenberg@apple.com>
10785 CopiedSpace::contains doesn't check for oversize blocks
10786 https://bugs.webkit.org/show_bug.cgi?id=87180
10788 Reviewed by Geoffrey Garen.
10790 When doing a conservative scan we use CopiedSpace::contains to determine if a particular
10791 address points into the CopiedSpace. Currently contains() only checks if the address
10792 points to a block in to-space, which means that pointers to oversize blocks may not get scanned.
10794 * heap/CopiedSpace.cpp:
10795 (JSC::CopiedSpace::tryAllocateOversize):
10796 (JSC::CopiedSpace::tryReallocateOversize):
10797 (JSC::CopiedSpace::doneFillingBlock):
10798 (JSC::CopiedSpace::doneCopying):
10799 * heap/CopiedSpace.h: Refactored CopiedSpace so that all blocks (oversize and to-space) are
10800 in a single hash set and bloom filter for membership testing.
10802 * heap/CopiedSpaceInlineMethods.h:
10803 (JSC::CopiedSpace::contains): We check for the normal block first. Since the oversize blocks are
10804 only page aligned, rather than block aligned, we have to re-mask the ptr to check if it's in
10805 CopiedSpace. Also added a helper function of the same name that takes a CopiedBlock* and checks
10806 if it's in CopiedSpace so that check isn't typed out twice.
10808 (JSC::CopiedSpace::startedCopying):
10809 (JSC::CopiedSpace::addNewBlock):
10811 2012-05-22 Geoffrey Garen <ggaren@apple.com>
10813 CopiedBlock and MarkedBlock should have proper value semantics (i.e., destructors)
10814 https://bugs.webkit.org/show_bug.cgi?id=87172
10816 Reviewed by Oliver Hunt and Phil Pizlo.
10818 This enables MarkedBlock to own non-trivial sub-objects that require
10819 destruction. It also fixes a FIXME about casting a CopiedBlock to a
10820 MarkedBlock at destroy time.
10822 CopiedBlock and MarkedBlock now accept an allocation chunk at create
10823 time and return it at destroy time. Their client is expected to
10824 allocate, recycle, and destroy these chunks.
10826 * heap/BlockAllocator.cpp:
10827 (JSC::BlockAllocator::releaseFreeBlocks):
10828 (JSC::BlockAllocator::blockFreeingThreadMain): Don't call MarkedBlock::destroy
10829 because we expect that to be called before a block is put on our free
10830 list now. Do manually deallocate our allocation chunk because that's
10833 * heap/BlockAllocator.h:
10835 (JSC::BlockAllocator::allocate): Allocate never fails now. This is a
10836 cleaner abstraction because only one object does all the VM allocation
10837 and deallocation. Caching is an implementation detail.
10839 (JSC::BlockAllocator::deallocate): We take an allocation chunk argument
10840 instead of a block because we now expect the block to have been destroyed
10841 before we recycle its memory. For convenience, we still use the HeapBlock
10842 class as our linked list node. This is OK because HeapBlock is a POD type.
10844 * heap/CopiedBlock.h:
10846 (JSC::CopiedBlock::create):
10847 (JSC::CopiedBlock::destroy):
10848 (JSC::CopiedBlock::CopiedBlock): Added proper create and destroy functions,
10849 to match MarkedBlock.
10851 * heap/CopiedSpace.cpp:
10852 (JSC::CopiedSpace::tryAllocateOversize):
10853 (JSC::CopiedSpace::tryReallocateOversize):
10854 (JSC::CopiedSpace::doneCopying):
10855 (JSC::CopiedSpace::getFreshBlock):
10856 (JSC::CopiedSpace::freeAllBlocks):
10857 * heap/CopiedSpaceInlineMethods.h:
10858 (JSC::CopiedSpace::recycleBlock): Make sure to call destroy before
10859 returning a block to the BlockAllocator. Otherwise, our destructors
10860 won't run. (If we get this wrong now, we'll get a compile error.)
10862 * heap/HeapBlock.h:
10863 (JSC::HeapBlock::HeapBlock): const!
10865 * heap/MarkedAllocator.cpp:
10866 (JSC::MarkedAllocator::allocateBlock): No need to distinguish between
10867 create and recycle -- MarkedBlock always accepts memory allocated by
10870 * heap/MarkedBlock.cpp:
10871 (JSC::MarkedBlock::create): Don't allocate memory -- we assume that we're
10872 passed already-allocated memory, to clarify the responsibility for VM
10875 (JSC::MarkedBlock::destroy): Do run our destructor before giving back
10876 our VM -- that is the whole point of this patch.
10878 (JSC::MarkedBlock::MarkedBlock):
10879 * heap/MarkedBlock.h:
10881 * heap/MarkedSpace.cpp: const!
10883 (JSC::MarkedSpace::freeBlocks): Make sure to call destroy before
10884 returning a block to the BlockAllocator. Otherwise, our destructors
10885 won't run. (If we get this wrong now, we'll get a compile error.)
10887 == Rolled over to ChangeLog-2012-05-22 ==