ChangeLog 481 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
2013-06-22  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: DFG shouldn't exit just because a String GetByVal went out-of-bounds
        https://bugs.webkit.org/show_bug.cgi?id=117906

        Reviewed by Mark Hahnenberg.
        
        This does the obvious thing, but also makes sure that out-of-bounds accesses
        don't fall off into a C call, but try to do the fast thing if the prototype
        chain is sane. We ought to probably do this for other array accesses in the
        future, as well, since it's so darn easy.

        * dfg/DFGAbstractState.cpp:
        (JSC::DFG::AbstractState::executeEffects):
        * dfg/DFGFixupPhase.cpp:
        (JSC::DFG::FixupPhase::fixupNode):
        * dfg/DFGOperations.cpp:
        * dfg/DFGOperations.h:
        * dfg/DFGSpeculativeJIT.cpp:
        (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
        * dfg/DFGSpeculativeJIT.h:
        (JSC::DFG::SpeculativeJIT::callOperation):
        * runtime/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::objectPrototypeIsSane):
        (JSC):
        (JSC::JSGlobalObject::arrayPrototypeChainIsSane):
        (JSC::JSGlobalObject::stringPrototypeChainIsSane):
        * runtime/JSGlobalObject.h:
        (JSGlobalObject):

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
2013-06-22  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: GC's put_by_id transition fixpoint should converge more quickly
        https://bugs.webkit.org/show_bug.cgi?id=117912

        Reviewed by Mark Hahnenberg.

        This was a rookie mistake. The GC does a classic forward data flow fixpoint. These work well so long as you
        iterate the program in program order, or at least something close to program order. Because I enjoy reverse
        loops ("while (n--) blah"), I ended up iterating in *reverse* of program order which ensured worst-case
        pathologies every single time. And unsurprisingly, this slowed down a program, namely pdfjs.

        Flipping the loops to iterate forward fixes a 90% regression in Octane/pdfjs and is otherwise neutral.

        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::propagateTransitions):

48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
2013-06-21  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: DFG should CSE MakeRope
        https://bugs.webkit.org/show_bug.cgi?id=117905

        Reviewed by Geoffrey Garen.
        
        Adds MakeRope to the CSE phase and removes the comment that says that
        we could do it but aren't doing it.
        
        Also fixed SpeculatedType dumping so that if you have a Cell type then
        it just prints "Cell" and if you just have Object then it just prints
        "Object", instead of printing the long list of types.

        * bytecode/SpeculatedType.cpp:
        (JSC::dumpSpeculation):
        * dfg/DFGCSEPhase.cpp:
        (JSC::DFG::CSEPhase::performNodeCSE):

67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
2013-06-21  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: DFG should't exit just because it GetByVal'd a big character
        https://bugs.webkit.org/show_bug.cgi?id=117899

        Reviewed by Mark Hahnenberg.
        
        Add a slow path. Also clarify handling of GetByVal in PutStructure elimination.
        Previously it would fail due to canExit() but now we can also fail because
        GetByVal(String) can allocate. Just make it so GetByVal is totally poisoned, in
        a very explicit way.

        * dfg/DFGCSEPhase.cpp:
        (JSC::DFG::CSEPhase::putStructureStoreElimination):
        * dfg/DFGOperations.cpp:
        * dfg/DFGOperations.h:
        * dfg/DFGSpeculativeJIT.cpp:
        (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
        * dfg/DFGSpeculativeJIT.h:
        (JSC::DFG::SpeculativeJIT::callOperation):
        (SpeculativeJIT):

89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
2013-06-21  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: Small strings shouldn't get GC'd
        https://bugs.webkit.org/show_bug.cgi?id=117897

        Reviewed by Mark Hahnenberg.
        
        Kill off the code needed to allocate them lazily and finalize them.

        * dfg/DFGSpeculativeJIT.cpp:
        (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
        * heap/Heap.cpp:
        (JSC::Heap::collect):
        * runtime/JSString.h:
        (JSC::jsSingleCharacterString):
        (JSC::jsSingleCharacterSubstring):
        (JSC::jsString):
        (JSC::jsSubstring8):
        (JSC::jsSubstring):
        (JSC::jsOwnedString):
        * runtime/NumberPrototype.cpp:
        (JSC::integerValueToString):
        * runtime/SmallStrings.cpp:
        (JSC):
        (JSC::SmallStrings::initializeCommonStrings):
        (JSC::SmallStrings::visitStrongReferences):
        * runtime/SmallStrings.h:
        (JSC::SmallStrings::singleCharacterString):
        (SmallStrings):

119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
2013-06-20  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: Structure should have a dump()
        https://bugs.webkit.org/show_bug.cgi?id=117859

        Reviewed by Geoffrey Garen.
        
        This is pretty cool. Anywhere we previously printed Structure pointers in dumps,
        we now print a bunch of other info as well. For example, for an object literal
        like "{f:42, g:64, h:24}", when we print the structure we'll now get:

            0x107a0af80:[Object, {f:0, g:1, h:2}, NonArray, Proto:0x107a8fff0]
        
        This also changes a bunch of places to use the dump method.

        * bytecode/StructureSet.h:
        (JSC::StructureSet::dump):
        * dfg/DFGGraph.cpp:
        (JSC::DFG::Graph::dump):
        * dfg/DFGStructureAbstractValue.h:
        (JSC::DFG::StructureAbstractValue::dump):
        * runtime/JSCJSValue.cpp:
        (JSC::JSValue::dump):
        * runtime/Structure.cpp:
        (JSC::Structure::dump):
        (JSC):
        * runtime/Structure.h:
        (Structure):

148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
2013-06-20  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: There should only be one table of SimpleJumpTables
        https://bugs.webkit.org/show_bug.cgi?id=117856

        Reviewed by Geoffrey Garen.
        
        Having multiple tables of SimpleJumpTables just means we have to duplicate a
        ton of code. This patch deduplicates all of it.

        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::dumpBytecode):
        (JSC):
        (JSC::CodeBlock::CodeBlock):
        (JSC::CodeBlock::shrinkToFit):
        * bytecode/CodeBlock.h:
        (JSC::CodeBlock::numberOfSwitchJumpTables):
        (JSC::CodeBlock::addSwitchJumpTable):
        (JSC::CodeBlock::switchJumpTable):
        (JSC::CodeBlock::clearSwitchJumpTables):
        (RareData):
        * bytecode/PreciseJumpTargets.cpp:
        (JSC):
        (JSC::computePreciseJumpTargets):
        * bytecode/UnlinkedCodeBlock.h:
        (JSC::UnlinkedCodeBlock::shrinkToFit):
        (JSC::UnlinkedCodeBlock::numberOfSwitchJumpTables):
        (JSC::UnlinkedCodeBlock::addSwitchJumpTable):
        (JSC::UnlinkedCodeBlock::switchJumpTable):
        (RareData):
        * bytecompiler/BytecodeGenerator.cpp:
        (JSC):
        (JSC::prepareJumpTableForSwitch):
        (JSC::BytecodeGenerator::endSwitch):
        * dfg/DFGByteCodeParser.cpp:
        (InlineStackEntry):
        (JSC::DFG::ByteCodeParser::parseBlock):
        (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
        * dfg/DFGJITCompiler.cpp:
        (JSC::DFG::JITCompiler::link):
        * dfg/DFGJITCompiler.h:
        (JITCompiler):
        * dfg/DFGOperations.cpp:
        * dfg/DFGSpeculativeJIT.cpp:
        (JSC::DFG::SpeculativeJIT::emitSwitchIntJump):
        (DFG):
        (JSC::DFG::SpeculativeJIT::emitSwitchImm):
        (JSC::DFG::SpeculativeJIT::emitSwitchCharStringJump):
        * dfg/DFGSpeculativeJIT.h:
        (SpeculativeJIT):
        * ftl/FTLLink.cpp:
        (JSC::FTL::link):
        * jit/JITOpcodes.cpp:
        (JSC::JIT::emit_op_switch_imm):
        (JSC::JIT::emit_op_switch_char):
        * jit/JITOpcodes32_64.cpp:
        (JSC::JIT::emit_op_switch_imm):
        (JSC::JIT::emit_op_switch_char):
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):
        * llint/LLIntSlowPaths.cpp:
        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
        * llint/LowLevelInterpreter32_64.asm:
        * llint/LowLevelInterpreter64.asm:

213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
2013-06-20  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: FTL should clear character switch jump tables
        https://bugs.webkit.org/show_bug.cgi?id=117852

        Reviewed by Sam Weinig.
        
        The FTL just uses LLVM's switch, which results in LLVM allocating its own switch
        jump tables as needed.

        * bytecode/CodeBlock.h:
        (JSC::CodeBlock::clearCharacterSwitchJumpTables):
        * ftl/FTLLink.cpp:
        (JSC::FTL::link):

228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
2013-06-20  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: FTL should support SwitchChar
        https://bugs.webkit.org/show_bug.cgi?id=117849

        Reviewed by Geoffrey Garen.
        
        This adds Switch(SwitchChar) to the FTL and also implicitly does some other things.
        SwitchChar requires calling a slow path to resolve ropes. Previously the FTL had no
        support for calling slow paths, and we avoided adding coverage that would require
        that. Well, this patch adds the ability to call slow paths and just uses that for
        resolving ropes for SwitchChar. Also SwitchChar required adding awareness of strings,
        so I did that, too.

        * bytecode/CodeBlock.h:
        (CodeBlock):
        (JSC::CodeBlock::addCodeOrigin):
        * dfg/DFGBackwardsPropagationPhase.cpp:
        (JSC::DFG::BackwardsPropagationPhase::propagate):
        * dfg/DFGGraph.cpp:
        (JSC::DFG::Graph::dump):
        * dfg/DFGNode.cpp:
        (WTF):
        (WTF::printInternal):
        * dfg/DFGNode.h:
        (WTF):
        * dfg/DFGOperations.h:
        * dfg/DFGSpeculativeJIT.h:
        (JSC::DFG::SpeculativeJIT::callOperation):
        * ftl/FTLAbbreviations.h:
        (JSC::FTL::int16Type):
        (JSC::FTL::constInt):
        * ftl/FTLAbstractHeapRepository.h:
        (FTL):
        * ftl/FTLCapabilities.cpp:
        (JSC::FTL::canCompile):
        * ftl/FTLCommonValues.cpp:
        (JSC::FTL::CommonValues::CommonValues):
        * ftl/FTLCommonValues.h:
        (CommonValues):
        * ftl/FTLIntrinsicRepository.cpp:
        (JSC::FTL::IntrinsicRepository::IntrinsicRepository):
        (FTL):
        * ftl/FTLIntrinsicRepository.h:
        (FTL):
        (IntrinsicRepository):
        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::lower):
        (JSC::FTL::LowerDFGToLLVM::transferAndCheckArguments):
        (JSC::FTL::LowerDFGToLLVM::compileJump):
        (JSC::FTL::LowerDFGToLLVM::compileBranch):
        (JSC::FTL::LowerDFGToLLVM::compileSwitch):
        (JSC::FTL::LowerDFGToLLVM::buildSwitch):
        (LowerDFGToLLVM):
        (JSC::FTL::LowerDFGToLLVM::lowString):
        (JSC::FTL::LowerDFGToLLVM::speculate):
        (JSC::FTL::LowerDFGToLLVM::isObject):
        (JSC::FTL::LowerDFGToLLVM::isNotString):
        (JSC::FTL::LowerDFGToLLVM::isString):
        (JSC::FTL::LowerDFGToLLVM::isNotObject):
        (JSC::FTL::LowerDFGToLLVM::speculateObject):
        (JSC::FTL::LowerDFGToLLVM::speculateString):
        (JSC::FTL::LowerDFGToLLVM::speculateNonNullObject):
        (JSC::FTL::LowerDFGToLLVM::vmCall):
        (JSC::FTL::LowerDFGToLLVM::callPreflight):
        (JSC::FTL::LowerDFGToLLVM::callCheck):
        (JSC::FTL::LowerDFGToLLVM::lowBlock):
        * ftl/FTLOutput.h:
        (JSC::FTL::Output::constBool):
        (JSC::FTL::Output::constInt8):
        (JSC::FTL::Output::constInt32):
        (JSC::FTL::Output::constIntPtr):
        (JSC::FTL::Output::constInt64):
        (JSC::FTL::Output::load16):
        (JSC::FTL::Output::isNull):
        (JSC::FTL::Output::notNull):
        (JSC::FTL::Output::testIsZero32):
        (JSC::FTL::Output::testNonZero32):
        (Output):
        (JSC::FTL::Output::operation):
        (JSC::FTL::Output::crash):

310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
2013-06-18  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: DFG should have switch_char
        https://bugs.webkit.org/show_bug.cgi?id=117710

        Reviewed by Michael Saboff.
        
        Add op_switch_char. Most of this is fairly simple, except for the whole
        LazyJSValue thing.
        
        It's long been the case that anytime you wanted the DFG to speak of a string
        that didn't appear in the constant pool, you would have a hard time since
        the DFG isn't allowed to allocate in the GC heap. For example, if you know
        that you want to speak of a single character string, you might find that
        the one you wanted to speak of had been GC'd. Another example is if you
        wanted to add constant folding for string concatenation - something we don't
        have yet but will want eventually.
        
        I solve this by finally adding the notion of LazyJSValue. In the future I
        anticipate using this for a variety of string-related things. The idea here
        is that the DFG can either say that it already knows what the value is, or
        it can describe the value. For example, in this patch I needed to be able to
        describe single-character strings.

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::dumpBytecode):
        (JSC::CodeBlock::CodeBlock):
        * bytecode/JumpTable.h:
        * dfg/DFGBackwardsPropagationPhase.cpp:
        (JSC::DFG::BackwardsPropagationPhase::propagate):
        * dfg/DFGByteCodeParser.cpp:
        (InlineStackEntry):
        (JSC::DFG::ByteCodeParser::parseBlock):
        (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
        * dfg/DFGCFGSimplificationPhase.cpp:
        (JSC::DFG::CFGSimplificationPhase::run):
        * dfg/DFGCapabilities.cpp:
        (JSC::DFG::capabilityLevel):
        * dfg/DFGDriver.cpp:
        (JSC::DFG::compile):
        * dfg/DFGFixupPhase.cpp:
        (JSC::DFG::FixupPhase::fixupNode):
        * dfg/DFGGPRInfo.h:
        (JSC::DFG::JSValueRegs::payloadGPR):
        * dfg/DFGJITCompiler.cpp:
        (JSC::DFG::JITCompiler::jumpTable):
        (DFG):
        (JSC::DFG::JITCompiler::numberOfJumpTables):
        (JSC::DFG::JITCompiler::linkSwitches):
        (JSC::DFG::JITCompiler::link):
        * dfg/DFGJITCompiler.h:
        (JITCompiler):
        * dfg/DFGLazyJSValue.cpp: Added.
        (DFG):
        (JSC::DFG::LazyJSValue::getValue):
        (JSC::DFG::equalToSingleCharacter):
        (JSC::DFG::LazyJSValue::strictEqual):
        (JSC::DFG::LazyJSValue::dump):
        * dfg/DFGLazyJSValue.h: Added.
        (DFG):
        (LazyJSValue):
        (JSC::DFG::LazyJSValue::LazyJSValue):
        (JSC::DFG::LazyJSValue::singleCharacterString):
        (JSC::DFG::LazyJSValue::tryGetValue):
        (JSC::DFG::LazyJSValue::value):
        (JSC::DFG::LazyJSValue::character):
        (JSC::DFG::LazyJSValue::switchLookupValue):
        * dfg/DFGNode.h:
        (JSC::DFG::SwitchCase::SwitchCase):
        (SwitchCase):
        * dfg/DFGSpeculativeJIT.cpp:
        (JSC::DFG::SpeculativeJIT::emitSwitchIntJump):
        (JSC::DFG::SpeculativeJIT::emitSwitchImmIntJump):
        (DFG):
        (JSC::DFG::SpeculativeJIT::emitSwitchImm):
        (JSC::DFG::SpeculativeJIT::emitSwitchCharStringJump):
        (JSC::DFG::SpeculativeJIT::emitSwitchChar):
        (JSC::DFG::SpeculativeJIT::emitSwitch):
        * dfg/DFGSpeculativeJIT.h:
        (SpeculativeJIT):

392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
2013-06-19  Mark Hahnenberg  <mhahnenberg@apple.com>

        Refactor ObjCCallbackFunction to inherit directly from InternalFunction
        https://bugs.webkit.org/show_bug.cgi?id=117595

        Reviewed by Geoffrey Garen.

        * API/APICallbackFunction.h: Added. New struct that allows JSCallbackFunction and 
        ObjCCallbackFunction to share their host call() implementation through the magic of 
        templates.
        (JSC::APICallbackFunction::call):
        * API/JSCallbackFunction.cpp:
        (JSC::JSCallbackFunction::getCallData): Changed to get the template-ized version of 
        the host function.
        * API/JSCallbackFunction.h:
        * API/ObjCCallbackFunction.h: Now inherits directly from InternalFunction.
        * API/ObjCCallbackFunction.mm:
        (JSC::ObjCCallbackFunction::ObjCCallbackFunction):
        (JSC::ObjCCallbackFunction::getCallData): Ditto.
        * GNUmakefile.list.am: Build files!
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
        * JavaScriptCore.xcodeproj/project.pbxproj:

416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
2013-06-19  Michael Saboff  <msaboff@apple.com>

        fourthTier: Arity fixup should be done while on same stack
        https://bugs.webkit.org/show_bug.cgi?id=117102

        Reviewed by Oliver Hunt.

        Removed the fixup part of op_call_arityCheck() and op_construct_arityCheck() and moved it to
        a thunk for the JITs and as assembly for the llint.  This patch provides the plumbing needed to
        move to the C stack for JS execution.  The fixup thunk and llint code would need to be change to
        work with a stack that grows down when we do move to the C stack.
        
        Due to an issue with the offline assembler, I moved the const at the top of LowLevelInterpreter64.asm
        and LowLevelInterpreter32_64.asm to LowLevelInterpreter.asm.  The problem is that a const defined in
        one file that are used in a macro doesn't resolve the const if the macro is used in another file.  This
        seemed like the quickest path.

        * dfg/DFGJITCompiler.cpp:
        (JSC::DFG::JITCompiler::compileFunction):
        (JSC::DFG::JITCompiler::linkFunction):
        * dfg/DFGJITCompiler.h:
        (JITCompiler):
        * ftl/FTLLink.cpp:
        (JSC::FTL::link):
        * jit/JIT.cpp:
        (JSC::JIT::privateCompile):
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):
        * jit/JITStubs.h:
        * jit/ThunkGenerators.cpp:
        (JSC::arityFixup):
        * jit/ThunkGenerators.h:
        * llint/LowLevelInterpreter.asm:
        * llint/LowLevelInterpreter32_64.asm:
        * llint/LowLevelInterpreter64.asm:
        * runtime/CommonSlowPaths.cpp:
        (JSC::SLOW_PATH_DECL):
        * runtime/CommonSlowPaths.h:
        (JSC::CommonSlowPaths::arityCheckFor):

456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
2013-06-19  Michael Saboff  <msaboff@apple.com>

        FTL: arm build is broken in ToT
        https://bugs.webkit.org/show_bug.cgi?id=117800

        Unreviewed build fixes.

        * assembler/ARMv7Assembler.h:
        (ARMv7Assembler): Merge of r147941
        * jit/JITArithmetic32_64.cpp:
        (JSC::JIT::emit_op_mod): Moved variable declaration back inside #ifdef where used.

2013-06-17  Michael Saboff  <msaboff@apple.com>

        FTL: Add another temp register regT4 to JSInterfaceJIT
        https://bugs.webkit.org/show_bug.cgi?id=117719

        Reviewed by Geoffrey Garen.

        Made the dedicated bucketCounterRegister to be regT4 and then used regT4 wherever
        bucketCounterRegister had been used.  Since it is masked whenever it is used and
        we are looking for some randomness in the register anyway, we can use it without
        any issues.

        * jit/JIT.cpp:
        (JSC::JIT::privateCompile):
        * jit/JIT.h:
        (JSC::JIT::emitValueProfilingSite):
        * jit/JITCall.cpp:
        (JSC::JIT::emitPutCallResult):
        * jit/JITCall32_64.cpp:
        (JSC::JIT::emitPutCallResult):
        * jit/JITInlines.h:
        (JSC::JIT::emitValueProfilingSite):
        * jit/JITOpcodes.cpp:
        (JSC::JIT::emit_op_to_this):
        (JSC::JIT::emit_op_get_callee):
        (JSC::JIT::emit_op_get_argument_by_val):
        * jit/JITOpcodes32_64.cpp:
        (JSC::JIT::emit_op_get_callee):
        (JSC::JIT::emit_op_to_this):
        (JSC::JIT::emit_op_get_argument_by_val):
        * jit/JITPropertyAccess.cpp:
        (JSC::JIT::emit_op_get_by_val):
        (JSC::JIT::emitSlow_op_get_by_val):
        (JSC::JIT::emit_op_get_by_id):
        (JSC::JIT::emitSlow_op_get_by_id):
        (JSC::JIT::emit_op_get_from_scope):
        (JSC::JIT::emitSlow_op_get_from_scope):
        * jit/JITPropertyAccess32_64.cpp:
        (JSC::JIT::emit_op_get_by_val):
        (JSC::JIT::emitSlow_op_get_by_val):
        (JSC::JIT::emit_op_get_by_id):
        (JSC::JIT::emitSlow_op_get_by_id):
        (JSC::JIT::emit_op_get_from_scope):
        (JSC::JIT::emitSlow_op_get_from_scope):
        * jit/JITStubCall.h:
        (JSC::JITStubCall::callWithValueProfiling):
        * jit/JSInterfaceJIT.h:
        (JSInterfaceJIT):

517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550
2013-06-17  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: FTL should support Switch
        https://bugs.webkit.org/show_bug.cgi?id=117704

        Reviewed by Oliver Hunt.

        * bytecode/CodeBlock.h:
        (JSC::CodeBlock::clearImmediateSwitchJumpTables):
        * ftl/FTLAbbreviations.h:
        (JSC::FTL::buildFPToSI):
        (JSC::FTL::buildSwitch):
        (JSC::FTL::addCase):
        (FTL):
        * ftl/FTLCapabilities.cpp:
        (JSC::FTL::canCompile):
        * ftl/FTLLink.cpp:
        (JSC::FTL::link):
        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::compileNode):
        (JSC::FTL::LowerDFGToLLVM::compileSwitch):
        (LowerDFGToLLVM):
        * ftl/FTLOutput.h:
        (JSC::FTL::Output::fpToInt):
        (JSC::FTL::Output::fpToInt32):
        (Output):
        (JSC::FTL::Output::switchInstruction):
        * ftl/FTLSwitchCase.h: Added.
        (FTL):
        (SwitchCase):
        (JSC::FTL::SwitchCase::SwitchCase):
        (JSC::FTL::SwitchCase::value):
        (JSC::FTL::SwitchCase::target):

551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573
2013-06-15  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: Add CFG simplification for Switch
        https://bugs.webkit.org/show_bug.cgi?id=117677

        Reviewed by Mark Hahnenberg.
        
        This is for completeness. It only speeds up a microbenchmark at this point.
        Broadly, we want all control constructs to be known to the CFG simplifier.

        * dfg/DFGCFGSimplificationPhase.cpp:
        (JSC::DFG::CFGSimplificationPhase::run):
        (JSC::DFG::CFGSimplificationPhase::convertToJump):
        (CFGSimplificationPhase):
        (JSC::DFG::CFGSimplificationPhase::noBlocks):
        (JSC::DFG::CFGSimplificationPhase::oneBlock):
        (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
        * runtime/JSCJSValue.h:
        (JSValue):
        * runtime/JSCJSValueInlines.h:
        (JSC::JSValue::pureStrictEqual):
        (JSC):

574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
2013-06-13  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: DFG should support op_switch_imm
        https://bugs.webkit.org/show_bug.cgi?id=117559

        Reviewed by Oliver Hunt.
        
        Implement integer (i.e. immediate) switches in the DFG. Reduce the minimum
        threshold for using op_switch.
        
        Also get rid of edge code support, since we haven't used it in the year since
        I introduced it. It was supposed to allow us to break critical edges late in
        the backend, thus enabling global register allocation from an SSA-form graph.
        But we aren't doing that so I figure we should just kill the code for now. It
        would have made implementing switch harder.

        * assembler/AbstractMacroAssembler.h:
        (JSC::AbstractMacroAssembler::timesPtr):
        * assembler/MacroAssemblerCodeRef.h:
        (JSC::MacroAssemblerCodePtr::dumpWithName):
        (MacroAssemblerCodePtr):
        (JSC::MacroAssemblerCodePtr::dump):
        (MacroAssemblerCodeRef):
        (JSC::MacroAssemblerCodeRef::dump):
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::shrinkToFit):
        * bytecode/JumpTable.h:
        (SimpleJumpTable):
        (JSC::SimpleJumpTable::clear):
        * dfg/DFGAbstractState.cpp:
        (JSC::DFG::AbstractState::executeEffects):
        (JSC::DFG::AbstractState::mergeToSuccessors):
        * dfg/DFGBackwardsPropagationPhase.cpp:
        (JSC::DFG::BackwardsPropagationPhase::propagate):
        * dfg/DFGByteCodeParser.cpp:
        (InlineStackEntry):
        (JSC::DFG::ByteCodeParser::parseBlock):
        (JSC::DFG::ByteCodeParser::linkBlock):
        (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
        * dfg/DFGCapabilities.cpp:
        (JSC::DFG::capabilityLevel):
        * dfg/DFGCommon.h:
        * dfg/DFGFixupPhase.cpp:
        (JSC::DFG::FixupPhase::fixupNode):
        * dfg/DFGGraph.cpp:
        (JSC::DFG::Graph::dump):
        (JSC::DFG::Graph::determineReachability):
        * dfg/DFGGraph.h:
        (Graph):
        * dfg/DFGJITCompiler.cpp:
        (JSC::DFG::JITCompiler::JITCompiler):
        (JSC::DFG::JITCompiler::link):
        * dfg/DFGJITCompiler.h:
        (JITCompiler):
        (JSC::DFG::JITCompiler::blockHeads):
        * dfg/DFGNode.h:
        (DFG):
        (JSC::DFG::SwitchCase::SwitchCase):
        (SwitchCase):
        (SwitchData):
        (JSC::DFG::SwitchData::SwitchData):
        (Node):
        (JSC::DFG::Node::isSwitch):
        (JSC::DFG::Node::isTerminal):
        (JSC::DFG::Node::switchData):
        (JSC::DFG::Node::numSuccessors):
        (JSC::DFG::Node::successor):
        * dfg/DFGNodeType.h:
        (DFG):
        * dfg/DFGOperations.cpp:
        * dfg/DFGOperations.h:
        * dfg/DFGPredictionPropagationPhase.cpp:
        (JSC::DFG::PredictionPropagationPhase::propagate):
        * dfg/DFGSpeculativeJIT.cpp:
        (JSC::DFG::SpeculativeJIT::SpeculativeJIT):
        (JSC::DFG::SpeculativeJIT::compile):
        (JSC::DFG::SpeculativeJIT::createOSREntries):
        (JSC::DFG::SpeculativeJIT::emitSwitchImmIntJump):
        (DFG):
        (JSC::DFG::SpeculativeJIT::emitSwitchImm):
        (JSC::DFG::SpeculativeJIT::emitSwitch):
        (JSC::DFG::SpeculativeJIT::linkBranches):
        * dfg/DFGSpeculativeJIT.h:
        (JSC::DFG::SpeculativeJIT::callOperation):
        (SpeculativeJIT):
        (JSC::DFG::SpeculativeJIT::branchDouble):
        (JSC::DFG::SpeculativeJIT::branchDoubleNonZero):
        (JSC::DFG::SpeculativeJIT::branch32):
        (JSC::DFG::SpeculativeJIT::branchTest32):
        (JSC::DFG::SpeculativeJIT::branch64):
        (JSC::DFG::SpeculativeJIT::branchPtr):
        (JSC::DFG::SpeculativeJIT::branchTestPtr):
        (JSC::DFG::SpeculativeJIT::branchTest8):
        (JSC::DFG::SpeculativeJIT::jump):
        * dfg/DFGSpeculativeJIT32_64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * dfg/DFGSpeculativeJIT64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):
        * parser/Nodes.h:
        (CaseBlockNode):

677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702
2013-06-15  Filip Pizlo  <fpizlo@apple.com>

        Concurrent JIT shouldn't try to recompute the CodeBlockHash as part of debug dumps, since doing so may fail if dealing with a CachedScript that doesn't have its script string handy
        https://bugs.webkit.org/show_bug.cgi?id=117676

        Reviewed by Sam Weinig.

        CodeBlock now caches m_hash, and the DFG Driver will force its computation if we're doing debug dumps of any kind.
        
        Also made sure that CodeBlock::CodeBlock initializes all of its fields; it was previously missing the
        initialization of m_capabilityLevelState.

        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::hash):
        (JSC::CodeBlock::CodeBlock):
        * bytecode/CodeBlock.h:
        (CodeBlock):
        * bytecode/CodeBlockHash.cpp:
        (JSC::CodeBlockHash::CodeBlockHash):
        * bytecode/CodeBlockHash.h:
        (CodeBlockHash):
        (JSC::CodeBlockHash::isSet):
        (JSC::CodeBlockHash::operator!):
        * dfg/DFGDriver.cpp:
        (JSC::DFG::compile):

703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803
2013-06-11  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: DFG should support op_in and it should use patching to make it fast
        https://bugs.webkit.org/show_bug.cgi?id=117385

        Reviewed by Geoffrey Garen.
        
        Implement op_in in the DFG and give it patching. The code we generate is just
        a jump on the hot path, and the slow paths generate stubs and link the jump to
        them. I didn't want to bother with patching structures and load offsets and
        the like, although I probably could have.
        
        This is a ginormous speed-up on microbenchmarks for "in", obviously.

        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::dumpAssumingJITType):
        (JSC::CodeBlock::resetStubInternal):
        (JSC::structureStubInfoLessThan):
        (JSC):
        (JSC::CodeBlock::sortStructureStubInfos):
        * bytecode/CodeBlock.h:
        (CodeBlock):
        * bytecode/StructureStubInfo.cpp:
        (JSC::StructureStubInfo::deref):
        (JSC::StructureStubInfo::visitWeakReferences):
        * bytecode/StructureStubInfo.h:
        (JSC::isInAccess):
        (JSC):
        (StructureStubInfo):
        (JSC::StructureStubInfo::initInList):
        * dfg/DFGAbstractState.cpp:
        (JSC::DFG::AbstractState::executeEffects):
        * dfg/DFGByteCodeParser.cpp:
        (JSC::DFG::ByteCodeParser::parseBlock):
        * dfg/DFGCCallHelpers.h:
        (JSC::DFG::CCallHelpers::setupResults):
        * dfg/DFGCapabilities.cpp:
        (JSC::DFG::capabilityLevel):
        * dfg/DFGFixupPhase.cpp:
        (JSC::DFG::FixupPhase::fixupNode):
        * dfg/DFGGPRInfo.h:
        (JSC::DFG::JSValueRegs::payloadOnly):
        (JSValueRegs):
        (JSC::DFG::JSValueRegs::JSValueRegs):
        (JSC::DFG::JSValueRegs::operator!):
        (JSC::DFG::JSValueSource::operator!):
        * dfg/DFGJITCompiler.cpp:
        (JSC::DFG::JITCompiler::link):
        * dfg/DFGJITCompiler.h:
        (JSC::DFG::InRecord::InRecord):
        (InRecord):
        (DFG):
        (JITCompiler):
        (JSC::DFG::JITCompiler::addIn):
        * dfg/DFGNodeType.h:
        (DFG):
        * dfg/DFGOperations.cpp:
        * dfg/DFGOperations.h:
        * dfg/DFGPredictionPropagationPhase.cpp:
        (JSC::DFG::PredictionPropagationPhase::propagate):
        * dfg/DFGRepatch.cpp:
        (JSC::DFG::tryRepatchIn):
        (DFG):
        (JSC::DFG::dfgRepatchIn):
        (JSC::DFG::dfgResetIn):
        * dfg/DFGRepatch.h:
        (DFG):
        (JSC::DFG::dfgResetIn):
        * dfg/DFGSlowPathGenerator.h:
        (JSC::DFG::CallSlowPathGenerator::CallSlowPathGenerator):
        (JSC::DFG::CallSlowPathGenerator::tearDown):
        (JSC::DFG::CallResultAndNoArgumentsSlowPathGenerator::generateInternal):
        (JSC::DFG::CallResultAndOneArgumentSlowPathGenerator::generateInternal):
        (JSC::DFG::CallResultAndTwoArgumentsSlowPathGenerator::generateInternal):
        (JSC::DFG::CallResultAndThreeArgumentsSlowPathGenerator::generateInternal):
        (JSC::DFG::CallResultAndFourArgumentsSlowPathGenerator::generateInternal):
        (JSC::DFG::CallResultAndFiveArgumentsSlowPathGenerator::generateInternal):
        * dfg/DFGSpeculativeJIT.cpp:
        (JSC::DFG::SpeculativeJIT::compileIn):
        (DFG):
        * dfg/DFGSpeculativeJIT.h:
        (JSC::DFG::extractResult):
        (DFG):
        (SpeculativeJIT):
        (JSC::DFG::SpeculativeJIT::callOperation):
        (JSC::DFG::SpeculativeJIT::appendCallWithExceptionCheckSetResult):
        (JSC::DFG::SpeculativeJIT::appendCallSetResult):
        (JSC::DFG::JSValueOperand::tagGPR):
        * dfg/DFGSpeculativeJIT32_64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * dfg/DFGSpeculativeJIT64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * runtime/JSCJSValue.cpp:
        (JSC::JSValue::dump):
        * runtime/JSString.h:
        (JSString):
        (JSC::JSString::tryGetValueImpl):
        (JSC):
        * runtime/Operations.h:
        (JSC::normalizePrototypeChainForChainAccess):

804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835
2013-06-12  Geoffrey Garen  <ggaren@apple.com>

        The Math object should not be polymorphic
        https://bugs.webkit.org/show_bug.cgi?id=117576

        Reviewed by Oliver Hunt.

        Fill in the Math object eagerly, to avoid its structure changing during
        execution. There are lots of ways to skin this cat; this one seemed
        easiest, and justified given the relative hotness of math operations.

        20% speedup on DSP-filtrr tests, small speedups on a few Kraken tests.

        * DerivedSources.make:
        * JavaScriptCore.order:
        * create_hash_table:
        * interpreter/CallFrame.h:
        (JSC::ExecState::jsonTable): Removed the Math object's static table.

        * runtime/JSObject.cpp:
        (JSC::JSObject::putDirectNativeFunctionWithoutTransition):
        * runtime/JSObject.h:
        * runtime/MathObject.cpp:
        (JSC::MathObject::finishCreation):
        * runtime/MathObject.h:
        (JSC::MathObject::create): Set up the Math object at construction time.

        * runtime/VM.cpp:
        (JSC::VM::VM):
        (JSC::VM::~VM):
        * runtime/VM.h: Removed the Math object's static table.

836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073
2013-06-09  Geoffrey Garen  <ggaren@apple.com>

        Unreviewed, rolled back in http://trac.webkit.org/changeset/151342.

        I filled in the missing return register loads, and tests
        seem to pass now.

                2013-06-07  Michael Saboff  <msaboff@apple.com>

                        fourthTier: The baseline jit and LLint should use common slow paths
                        https://bugs.webkit.org/show_bug.cgi?id=116889

2013-06-07  Filip Pizlo  <fpizlo@apple.com>

        Unreviewed, roll out http://trac.webkit.org/changeset/151342
        It broke Kraken crypto tests in debug build. That results in a pretty bad
        loss of test coverage.

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * jit/JIT.cpp:
        (JSC):
        (JSC::JIT::privateCompileMainPass):
        * jit/JIT.h:
        (JIT):
        * jit/JITArithmetic.cpp:
        (JSC::JIT::emitSlow_op_negate):
        (JSC::JIT::emitSlow_op_lshift):
        (JSC::JIT::emitSlow_op_rshift):
        (JSC::JIT::emitSlow_op_urshift):
        (JSC::JIT::emitSlow_op_bitand):
        (JSC::JIT::emitSlow_op_inc):
        (JSC::JIT::emitSlow_op_dec):
        (JSC::JIT::emitSlow_op_mod):
        (JSC::JIT::emit_op_mod):
        (JSC::JIT::compileBinaryArithOpSlowCase):
        (JSC::JIT::emit_op_add):
        (JSC::JIT::emitSlow_op_add):
        (JSC::JIT::emitSlow_op_mul):
        (JSC::JIT::emitSlow_op_div):
        (JSC::JIT::emitSlow_op_sub):
        * jit/JITArithmetic32_64.cpp:
        (JSC::JIT::emitSlow_op_negate):
        (JSC::JIT::emitSlow_op_lshift):
        (JSC::JIT::emitRightShiftSlowCase):
        (JSC::JIT::emitSlow_op_bitand):
        (JSC::JIT::emitSlow_op_bitor):
        (JSC::JIT::emitSlow_op_bitxor):
        (JSC::JIT::emitSlow_op_inc):
        (JSC::JIT::emitSlow_op_dec):
        (JSC::JIT::emit_op_add):
        (JSC::JIT::emitSlow_op_add):
        (JSC::JIT::emitSlow_op_sub):
        (JSC::JIT::emitSlow_op_mul):
        (JSC::JIT::emitSlow_op_div):
        (JSC::JIT::emit_op_mod):
        (JSC::JIT::emitSlow_op_mod):
        * jit/JITExceptions.cpp:
        (JSC):
        (JSC::genericThrow):
        * jit/JITExceptions.h:
        (ExceptionHandler):
        (JSC):
        * jit/JITOpcodes.cpp:
        (JSC::JIT::emit_op_strcat):
        (JSC::JIT::emitSlow_op_create_this):
        (JSC::JIT::emitSlow_op_to_this):
        (JSC::JIT::emitSlow_op_to_primitive):
        (JSC::JIT::emitSlow_op_not):
        (JSC::JIT::emitSlow_op_bitxor):
        (JSC::JIT::emitSlow_op_bitor):
        (JSC::JIT::emitSlow_op_stricteq):
        (JSC::JIT::emitSlow_op_nstricteq):
        (JSC::JIT::emitSlow_op_to_number):
        * jit/JITOpcodes32_64.cpp:
        (JSC::JIT::privateCompileCTINativeCall):
        (JSC::JIT::emitSlow_op_to_primitive):
        (JSC::JIT::emit_op_strcat):
        (JSC::JIT::emitSlow_op_not):
        (JSC::JIT::emitSlow_op_stricteq):
        (JSC::JIT::emitSlow_op_nstricteq):
        (JSC::JIT::emitSlow_op_to_number):
        (JSC::JIT::emit_op_create_arguments):
        (JSC::JIT::emitSlow_op_create_this):
        (JSC::JIT::emitSlow_op_to_this):
        (JSC::JIT::emitSlow_op_get_argument_by_val):
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):
        (JSC):
        * jit/JITStubs.h:
        (JSC):
        * jit/JITStubsARM.h:
        (JSC):
        * jit/JITStubsARMv7.h:
        (JSC):
        * jit/JITStubsMIPS.h:
        (JSC):
        * jit/JITStubsSH4.h:
        (JSC):
        * jit/JITStubsX86.h:
        (JSC):
        * jit/JITStubsX86_64.h:
        (JSC):
        * jit/JSInterfaceJIT.h:
        (JSInterfaceJIT):
        * jit/SlowPathCall.h: Removed.
        * jit/ThunkGenerators.cpp:
        (JSC::nativeForGenerator):
        * llint/LLIntSlowPaths.cpp:
        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
        (LLInt):
        * llint/LLIntSlowPaths.h:
        (LLInt):
        (SlowPathReturnType):
        (JSC::LLInt::encodeResult):
        (JSC::LLInt::decodeResult):
        * llint/LowLevelInterpreter.asm:
        * llint/LowLevelInterpreter.cpp:
        * llint/LowLevelInterpreter32_64.asm:
        * llint/LowLevelInterpreter64.asm:
        * runtime/CommonSlowPaths.cpp: Removed.
        * runtime/CommonSlowPaths.h:
        * runtime/JSCJSValue.h:
        (JSValue):

2013-06-07  Michael Saboff  <msaboff@apple.com>

        fourthTier: The baseline jit and LLint should use common slow paths
        https://bugs.webkit.org/show_bug.cgi?id=116889

        Reviewed by Filip Pizlo.

        Moved the llint_slow_paths that return JSValue along with several others to CommonSlowPaths.cpp.
        Eliminated the related JIT stubs.  Changes the baseline JIT to call these new common stubs.
        Added a simple slow path call class that uses argument registers or the stack instead of
        JITStackFrame.  Changes the exception mechanism for to check for an exception after making
        a slowpath call instead of returning to the handler directly form the slowpath function.

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * jit/JIT.cpp:
        (JSC::JIT::privateCompileMainPass):
        * jit/JIT.h:
        (JIT):
        * jit/JITArithmetic.cpp:
        (JSC::JIT::emitSlow_op_negate):
        (JSC::JIT::emitSlow_op_lshift):
        (JSC::JIT::emitSlow_op_rshift):
        (JSC::JIT::emitSlow_op_urshift):
        (JSC::JIT::emitSlow_op_bitand):
        (JSC::JIT::emitSlow_op_inc):
        (JSC::JIT::emitSlow_op_dec):
        (JSC::JIT::emitSlow_op_mod):
        (JSC::JIT::emit_op_mod):
        (JSC::JIT::compileBinaryArithOpSlowCase):
        (JSC::JIT::emit_op_add):
        (JSC::JIT::emitSlow_op_add):
        (JSC::JIT::emitSlow_op_mul):
        (JSC::JIT::emitSlow_op_div):
        (JSC::JIT::emitSlow_op_sub):
        * jit/JITArithmetic32_64.cpp:
        (JSC::JIT::emitSlow_op_negate):
        (JSC::JIT::emitSlow_op_lshift):
        (JSC::JIT::emitRightShiftSlowCase):
        (JSC::JIT::emitSlow_op_bitand):
        (JSC::JIT::emitSlow_op_bitor):
        (JSC::JIT::emitSlow_op_bitxor):
        (JSC::JIT::emitSlow_op_inc):
        (JSC::JIT::emitSlow_op_dec):
        (JSC::JIT::emit_op_add):
        (JSC::JIT::emitSlow_op_add):
        (JSC::JIT::emitSlow_op_sub):
        (JSC::JIT::emitSlow_op_mul):
        (JSC::JIT::emitSlow_op_div):
        (JSC::JIT::emit_op_mod):
        (JSC::JIT::emitSlow_op_mod):
        * jit/JITExceptions.cpp:
        (JSC::getExceptionLocation):
        (JSC::genericThrow):
        (JSC::jitThrowNew):
        * jit/JITExceptions.h:
        (ExceptionHandler):
        * jit/JITOpcodes.cpp:
        (JSC::JIT::emit_op_strcat):
        (JSC::JIT::emitSlow_op_create_this):
        (JSC::JIT::emitSlow_op_to_this):
        (JSC::JIT::emitSlow_op_to_primitive):
        (JSC::JIT::emitSlow_op_not):
        (JSC::JIT::emitSlow_op_bitxor):
        (JSC::JIT::emitSlow_op_bitor):
        (JSC::JIT::emitSlow_op_stricteq):
        (JSC::JIT::emitSlow_op_nstricteq):
        (JSC::JIT::emitSlow_op_to_number):
        * jit/JITOpcodes32_64.cpp:
        (JSC::JIT::privateCompileCTINativeCall):
        (JSC::JIT::emitSlow_op_to_primitive):
        (JSC::JIT::emit_op_strcat):
        (JSC::JIT::emitSlow_op_not):
        (JSC::JIT::emitSlow_op_stricteq):
        (JSC::JIT::emitSlow_op_nstricteq):
        (JSC::JIT::emitSlow_op_to_number):
        (JSC::JIT::emit_op_create_arguments):
        (JSC::JIT::emitSlow_op_create_this):
        (JSC::JIT::emitSlow_op_to_this):
        (JSC::JIT::emitSlow_op_get_argument_by_val):
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):
        (JSC::cti_vm_throw_slowpath):
        * jit/JITStubs.h:
        * jit/JITStubsARM.h:
        * jit/JITStubsARMv7.h:
        * jit/JITStubsMIPS.h:
        * jit/JITStubsSH4.h:
        * jit/JITStubsX86.h:
        * jit/JITStubsX86_64.h:
        * jit/JSInterfaceJIT.h:
        (JSInterfaceJIT):
        * jit/SlowPathCall.h: Added.
        (JITSlowPathCall):
        (JSC::JITSlowPathCall::JITSlowPathCall):
        (JSC::JITSlowPathCall::call):
        * jit/ThunkGenerators.cpp:
        (JSC::nativeForGenerator):
        * llint/LLIntSlowPaths.cpp:
        (LLInt):
        * llint/LLIntSlowPaths.h:
        (LLInt):
        * llint/LowLevelInterpreter.asm:
        * llint/LowLevelInterpreter.cpp:
        * llint/LowLevelInterpreter32_64.asm:
        * llint/LowLevelInterpreter64.asm:
        * runtime/CommonSlowPaths.cpp: Added.
        (JSC::SLOW_PATH_DECL):
        * runtime/CommonSlowPaths.h:
        (SlowPathReturnType):
        (JSC::encodeResult):
        (JSC::decodeResult):
        * runtime/JSCJSValue.h:
        (JSValue):

1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110
2013-06-11  Geoffrey Garen  <ggaren@apple.com>

        Rolled back in <http://trac.webkit.org/changeset/151363>.

        Rubber stamped by Phil Pizlo.

        The ASSERTs were due to the bytecode parser performing a
        StructureTransitionWatchpoint optimization in a case where the CFA
        wouldn't because the CFA could prove that the watchpoint would contradict
        a preceding CheckStructure.

        I fixed this by removing the bytecode parser optimization: now, we fully
        rely on CFA and constant folding to optimize structure checks when
        possible.

        I verified that there's no performance change vs doing the optimization
        in the bytecode parser. (The optimization is very simple, so this is not
        surprising.)

2013-06-10  Mark Hahnenberg  <mhahnenberg@apple.com>

        isContravenedByStructure is backwards
        https://bugs.webkit.org/show_bug.cgi?id=117366

        We should be checking if arrayModeForStructure(structure) is a 
        subset of arrayModesThatPassFiltering(), not the other way around.
        Also renamed isContravenedByStructure to better reflect what the 
        function is trying to determine.

        Rubber stamped by Filip Pizlo.

        * dfg/DFGArrayMode.h:
        (JSC::DFG::ArrayMode::structureWouldPassArrayModeFiltering):
        * dfg/DFGTypeCheckHoistingPhase.cpp:
        (JSC::DFG::TypeCheckHoistingPhase::noticeStructureCheckAccountingForArrayMode):
        (JSC::DFG::ArrayTypeCheck::isContravenedByValue):

1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128
2013-06-10  Mark Hahnenberg  <mhahnenberg@apple.com>

        isContravenedByStructure is backwards
        https://bugs.webkit.org/show_bug.cgi?id=117366

        We should be checking if arrayModeForStructure(structure) is a 
        subset of arrayModesThatPassFiltering(), not the other way around.
        Also renamed isContravenedByStructure to better reflect what the 
        function is trying to determine.

        Rubber stamped by Filip Pizlo.

        * dfg/DFGArrayMode.h:
        (JSC::DFG::ArrayMode::structureWouldPassArrayModeFiltering):
        * dfg/DFGTypeCheckHoistingPhase.cpp:
        (JSC::DFG::TypeCheckHoistingPhase::noticeStructureCheckAccountingForArrayMode):
        (JSC::DFG::ArrayTypeCheck::isContravenedByValue):

1129 1130 1131 1132 1133 1134 1135 1136 1137 1138
2013-06-11  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: Type check hoisting phase has a dead if statement
        https://bugs.webkit.org/show_bug.cgi?id=117510

        Reviewed by Geoffrey Garen.

        * dfg/DFGTypeCheckHoistingPhase.cpp:
        (JSC::DFG::TypeCheckHoistingPhase::identifyRedundantArrayChecks):

1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287
2013-06-10  Mark Lam  <mark.lam@apple.com>

        Introducing the StackIterator class.
        https://bugs.webkit.org/show_bug.cgi?id=117390.

        Reviewed by Geoffrey Garen.

        The StackIterator class is meant to unify the way we iterate the JS
        stack. It also makes it so that we don't have to copy the frame data
        into the intermediate StackFrame struct before processing it.
        Unfortunately we still can't get rid of StackFrame because it is used
        to record frame information for the Exception stack that is expected
        to persist beyond when the frames have been popped off the JS stack.

        The StackIterator will iterate over all "logical" frames (i.e. including
        inlined frames). As it iterates the JS stack, if it encounters a DFG
        frame that has inlined frames, the iterator will canonicalize the
        inlined frames before returning. Once canonicalized, the frame can be
        read like any other frame.

        The StackIterator implements a Frame class that inherits from CallFrame.
        The StackIterator::Frame serves as reader of the CallFrame that makes
        it easier to access information about the frame. The StackIterator::Frame
        only adds functions, and no additional data fields.

        * API/JSContextRef.cpp:
        (JSContextCreateBacktrace):
        * CMakeLists.txt:
        * GNUmakefile.list.am:
        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * Target.pri:
        * interpreter/CallFrame.cpp:
        (JSC::CallFrame::begin):
        (JSC::CallFrame::beginAt):
        * interpreter/CallFrame.h:
        (JSC::ExecState::setInlineCallFrame):
        (ExecState):
        (JSC::ExecState::end):
        * interpreter/Interpreter.cpp:
        (JSC::Interpreter::dumpRegisters):
        (JSC::Interpreter::unwindCallFrame):
        (JSC::Interpreter::getStackTrace):
        (JSC::Interpreter::throwException):
        (JSC::Interpreter::debug):
        * interpreter/Interpreter.h:
        (Interpreter):
        * interpreter/StackIterator.cpp: Added.
        (JSC::StackIterator::StackIterator):
        (JSC::StackIterator::beginAt):
        (JSC::StackIterator::gotoNextFrame):
        - Based on the deleted Interpreter::findFunctionCallFrameFromVMCode().
        (JSC::StackIterator::findFrameForFunction):
        - Based on the deleted Interpreter::retrieveCallerFromVMCode().
        (JSC::StackIterator::Frame::codeType):
        - Based on the deleted getStackFrameCodeType().
        (JSC::StackIterator::Frame::functionName):
        - Based on StackFrame::friendlyFunctionName().
        (JSC::StackIterator::Frame::sourceURL):
        - Based on StackFrame::friendlySourceURL().
        (JSC::StackIterator::Frame::toString):
        - Based on StackFrame::toString().
        (JSC::StackIterator::Frame::bytecodeOffset):
        (JSC::StackIterator::Frame::line):
        - Based on StackFrame::line().
        (JSC::StackIterator::Frame::column):
        - Based on StackFrame::column().
        (JSC::StackIterator::Frame::arguments):
        - Based on the deleted Interpreter::retrieveArgumentsFromVMCode().
        (JSC::StackIterator::Frame::retrieveExpressionInfo):
        - Based on StackFrame::expressionInfo().
        (JSC::StackIterator::Frame::logicalFrame):
        - Based on the now deleted CallFrame::trueCallFrame().
        (JSC::StackIterator::Frame::logicalCallerFrame):
        - Based on the now deleted CallFrame::trueCallerFrame().
        (JSC::jitTypeName):
        (JSC::printIndents):
        (JSC::printif):
        (JSC::StackIterator::Frame::print):
        (debugPrintCallFrame):
        - Prints the contents of the frame for debugging purposes.
          There are 2 versions that can be used as follows:

          1. When you have a valid StackIterator, you can print
             the current frame's content using the print instance
             method:
                 iter->print(indentLevel);

          2. When you have a CallFrame* that you want to dump from a debugger
             console, you can print its content as follows:
                 (gdb) call debugPrintCallFrame(callFrame)

          A sample of the output looks like this:

              frame 0x1510c70b0 {
                 name 'shouldBe'
                 sourceURL 'testapi.js'
                 hostFlag 0
                 isInlinedFrame 0
                 callee 0x15154efb0
                 returnPC 0x10ed0786d
                 callerFrame 0x1510c7058
                 logicalCallerFrame 0x1510c7058
                 rawLocationBits 27 0x1b
                 codeBlock 0x7fe79b037200
                    bytecodeOffset 27 0x1b / 210
                    line 46
                    column 20
                    jitType 3 <BaselineJIT> isOptimizingJIT 0
                    hasCodeOrigins 0
              }

        * interpreter/StackIterator.h: Added.
        (StackIterator::Frame):
        (JSC::StackIterator::Frame::create):
        (JSC::StackIterator::Frame::isJSFrame):
        (JSC::StackIterator::Frame::callFrame):
        * interpreter/StackIteratorPrivate.h: Added.
        (StackIterator):
        (JSC::StackIterator::operator*):
        (JSC::StackIterator::operator->):
        (JSC::StackIterator::operator==):
        (JSC::StackIterator::operator!=):
        (JSC::StackIterator::operator++):
        (JSC::StackIterator::end):
        (JSC::StackIterator::empty):
        * jsc.cpp:
        (functionJSCStack):
        * profiler/ProfileGenerator.cpp:
        (JSC::ProfileGenerator::addParentForConsoleStart):
        * profiler/ProfileNode.h:
        (ProfileNode):
        * runtime/JSFunction.cpp:
        (JSC::retrieveArguments):
        (JSC::JSFunction::argumentsGetter):
        (JSC::skipOverBoundFunctions):
        (JSC::retrieveCallerFunction):
        (JSC::JSFunction::callerGetter):
        (JSC::JSFunction::getOwnPropertyDescriptor):
        (JSC::JSFunction::defineOwnProperty):
        * runtime/JSGlobalObjectFunctions.cpp:
        (JSC::globalFuncProtoGetter):
        (JSC::globalFuncProtoSetter):
        * runtime/ObjectConstructor.cpp:
        (JSC::objectConstructorGetPrototypeOf):
        * runtime/Operations.h:

1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337
2013-06-09  Filip Pizlo  <fpizlo@apple.com>

        Marge trunk r146653.

    2013-03-22  Filip Pizlo  <fpizlo@apple.com>
    
            DFG folding of PutById to SimpleReplace should consider the specialized function case
            https://bugs.webkit.org/show_bug.cgi?id=113093
    
            Reviewed by Geoffrey Garen and Mark Hahnenberg.
    
            * bytecode/PutByIdStatus.cpp:
            (JSC::PutByIdStatus::computeFor):
    
2013-06-09  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: DFG GetById patching shouldn't distinguish between self lists and proto lists
        https://bugs.webkit.org/show_bug.cgi?id=117377

        Reviewed by Geoffrey Garen.
        
        Previously if you did self accesses and then wanted to do a prototype access, you'd
        have a bad time: the prototype accesses would be forced to take slow path because
        the self list wouldn't allow prototype accesses. Likewise if you did prototype (or
        chain) accesses and then wanted to do a self access, similar stupidity would ensue.
        
        This fixes the stupidity.

        I believe that this was introduced way back in the days of the old interpreter,
        where distinguishing between self lists, proto lists, and chain lists was meaningful
        for interpreter performance: it meant fewer branches to evaluate those lists. Then
        it got mostly carried over to the old JIT since the old JIT was just initially an
        optimized version of the old interpreter, and then later it got carried over to the
        DFG because I didn't know any better at the time. Now I do know better and I'm
        fixing it.

        * bytecode/PolymorphicAccessStructureList.h:
        (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
        * bytecode/StructureStubInfo.h:
        (JSC::StructureStubInfo::initGetByIdSelfList):
        * dfg/DFGOperations.cpp:
        * dfg/DFGOperations.h:
        * dfg/DFGRepatch.cpp:
        (JSC::DFG::tryCacheGetByID):
        (JSC::DFG::getPolymorphicStructureList):
        (DFG):
        (JSC::DFG::patchJumpToGetByIdStub):
        (JSC::DFG::tryBuildGetByIDList):
        (JSC::DFG::dfgBuildGetByIDList):

1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386
2013-06-09  Mark Lam  <mark.lam@apple.com>

        Fix broken no-DFG build.
        https://bugs.webkit.org/show_bug.cgi?id=117381.

        Reviewed by Geoffrey Garen.

        * bytecode/CodeBlock.cpp:
        * bytecode/CodeBlock.h:
        (CodeBlock):
        (ProgramCodeBlock):
        (EvalCodeBlock):
        (FunctionCodeBlock):
        * dfg/DFGCapabilities.h:
        * dfg/DFGDriver.h:
        (JSC::DFG::tryCompile):
        (JSC::DFG::tryCompileFunction):
        * dfg/DFGJITCode.cpp:
        * dfg/DFGRepatch.h:
        (JSC::DFG::dfgResetGetByID):
        (JSC::DFG::dfgResetPutByID):
        * heap/DFGCodeBlocks.cpp:
        (JSC::DFGCodeBlocks::jettison):
        * interpreter/CallFrame.h:
        (ExecState):
        (JSC::ExecState::trueCallFrame):
        * interpreter/Interpreter.cpp:
        (JSC::getCallerInfo):
        * runtime/Executable.cpp:
        * runtime/Executable.h:
        (EvalExecutable):
        (ProgramExecutable):
        (FunctionExecutable):
        * runtime/ExecutionHarness.h:
        * runtime/VM.cpp:
        (JSC::VM::~VM):

2013-06-08  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: Recursive deadlock in DFG::ByteCodeParser
        https://bugs.webkit.org/show_bug.cgi?id=117376

        Reviewed by Mark Hahnenberg.
        
        Leave the lock early to prevent a deadlock beneath get().

        * dfg/DFGByteCodeParser.cpp:
        (JSC::DFG::ByteCodeParser::parseBlock):

1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446
2013-06-08  Mark Lam  <mark.lam@apple.com>

        Removed bogus assertion in CallFrame::setLocationAsBytecodeOffset().
        https://bugs.webkit.org/show_bug.cgi?id=117373.

        Reviewed by Oliver Hunt.

        The assertion wrongly assumes that the incoming offset argument is in
        units of bytes. This is not true. It is in units of Instruction*. Hence,
        the assertion which checks for the low 2 bits to be clear can fail.

        * interpreter/CallFrame.cpp:
        (JSC::CallFrame::setLocationAsBytecodeOffset):

2013-06-07  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: don't insert ForceOSRExits except for inadequate coverage
        https://bugs.webkit.org/show_bug.cgi?id=117363

        Reviewed by Mark Hahnenberg.
        
        Previously (in http://trac.webkit.org/changeset/151303) I made it so that we
        inserted ForceOSRExits more eagerly.  I now think it's better to have
        contradictions execute normally and exit with full OSR exit profiling.  It's
        better at catching the few cases where the DFG will end up with different
        types than the baseline engines.
        
        This simplifies a bunch of code. For example it gets rid of
        ConstantFoldingPhase::paintUnreachableCode().
        
        You can think of this as a partial roll-out of r151303, except that it uses
        the facilities introduced by that patch to give us run-time assertions that
        check the CFA's correctness: if the CFA thought that something was a
        contradiction but the code didn't exit, we'll now trap.

        * dfg/DFGAbstractState.cpp:
        (JSC::DFG::AbstractState::AbstractState):
        (JSC::DFG::AbstractState::startExecuting):
        (JSC::DFG::AbstractState::executeEffects):
        (JSC::DFG::AbstractState::execute):
        (JSC::DFG::AbstractState::filter):
        (JSC::DFG::AbstractState::filterArrayModes):
        (JSC::DFG::AbstractState::filterByValue):
        (DFG):
        * dfg/DFGAbstractState.h:
        (AbstractState):
        (JSC::DFG::AbstractState::filter):
        (JSC::DFG::AbstractState::filterArrayModes):
        (JSC::DFG::AbstractState::filterByValue):
        * dfg/DFGCFAPhase.cpp:
        (JSC::DFG::CFAPhase::performBlockCFA):
        * dfg/DFGConstantFoldingPhase.cpp:
        (JSC::DFG::ConstantFoldingPhase::run):
        (JSC::DFG::ConstantFoldingPhase::foldConstants):
        (ConstantFoldingPhase):
        * dfg/DFGSpeculativeJIT.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::compileNode):

1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462
2013-06-07  Filip Pizlo  <fpizlo@apple.com>

        Unreviewed, fix release build.

        * ftl/FTLLink.cpp:

2013-06-06  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: Reenable the DFG optimization fixpoint now that it's profitable to do so with concurrent compilation
        https://bugs.webkit.org/show_bug.cgi?id=117331

        Rubber stamped by Sam Weinig.

        * dfg/DFGPlan.cpp:
        (JSC::DFG::Plan::compileInThreadImpl):

1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590
2013-06-05  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: DFG CFA should know when it hits a contradiction
        https://bugs.webkit.org/show_bug.cgi?id=117272

        Reviewed by Oliver Hunt.
        
        This makes the DFG CFA immediately detect when it hit a contradiction. Previously
        we might not know this: for example if we did an int32 type check on a known string;
        the code would definitely always exit but the CFA would think that we wouldn't have
        even though it would have computed a BOTTOM (i.e. contradictory) value for that
        variable.
        
        This requires two other changes:
        
        - CFA must report contradictions as if they are frequent exit sites, since
          contradictory speculations will subsequently get replaced with ForceOSRExit.
          ForceOSRExit cannot itself report profiling data back to the DFG::ExitProfile. So,
          we do this on behalf of the speculation, eagerly, within the CFA. This also has
          the effect of speeding convergence somewhat. We may want to revisit this later;
          for example we might want to instead have the notion of a ForceOSRExit that knows
          the set of speculations that got folded into it.
        
        - This revealed a bug where the CFA was modeling CheckStructure on a node that had
          a known singleton m_futurePossibleStructure set somewhat differently than the
          constant folder. If the CheckStructure was checking a structure set with two or
          more structures in it, it would not filter the abstract value. But the constant
          folder would turn this into a watchpoint on the singleton structure, thereby
          filtering the value. This discrepancy meant that we wouldn't realize the
          contradiction until the backend, and the AbstractState::bail() method asserts that
          we always realize contradictions in the constant folder.

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * bytecode/CodeBlock.h:
        (JSC::CodeBlock::addFrequentExitSite):
        (JSC::CodeBlock::hasExitSite):
        (CodeBlock):
        * bytecode/DFGExitProfile.cpp:
        (JSC::DFG::ExitProfile::add):
        (JSC::DFG::ExitProfile::hasExitSite):
        (JSC::DFG::QueryableExitProfile::QueryableExitProfile):
        (JSC::DFG::QueryableExitProfile::~QueryableExitProfile):
        (DFG):
        (JSC::DFG::QueryableExitProfile::initialize):
        * bytecode/DFGExitProfile.h:
        (JSC::DFG::FrequentExitSite::FrequentExitSite):
        (ExitProfile):
        (JSC::DFG::ExitProfile::hasExitSite):
        (QueryableExitProfile):
        * bytecode/ExitKind.cpp:
        (JSC::exitKindToString):
        * dfg/DFGAbstractState.cpp:
        (JSC::DFG::AbstractState::AbstractState):
        (JSC::DFG::AbstractState::beginBasicBlock):
        (JSC::DFG::AbstractState::reset):
        (JSC::DFG::AbstractState::startExecuting):
        (JSC::DFG::AbstractState::executeEffects):
        (JSC::DFG::AbstractState::execute):
        (JSC::DFG::AbstractState::filter):
        (DFG):
        (JSC::DFG::AbstractState::filterArrayModes):
        (JSC::DFG::AbstractState::filterByValue):
        (JSC::DFG::AbstractState::bail):
        * dfg/DFGAbstractState.h:
        (AbstractState):
        (JSC::DFG::AbstractState::filter):
        (JSC::DFG::AbstractState::filterArrayModes):
        (JSC::DFG::AbstractState::filterByValue):
        (JSC::DFG::AbstractState::filterByType):
        * dfg/DFGAbstractValue.cpp:
        (JSC::DFG::AbstractValue::filter):
        (JSC::DFG::AbstractValue::filterArrayModes):
        (DFG):
        (JSC::DFG::AbstractValue::filterByValue):
        (JSC::DFG::AbstractValue::normalizeClarity):
        * dfg/DFGAbstractValue.h:
        (AbstractValue):
        * dfg/DFGByteCodeParser.cpp:
        (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
        * dfg/DFGCFAPhase.cpp:
        (JSC::DFG::CFAPhase::performBlockCFA):
        * dfg/DFGCapabilities.cpp:
        (JSC::DFG::debugFail):
        (JSC::DFG::capabilityLevel):
        * dfg/DFGConstantFoldingPhase.cpp:
        (JSC::DFG::ConstantFoldingPhase::foldConstants):
        (ConstantFoldingPhase):
        (JSC::DFG::ConstantFoldingPhase::paintUnreachableCode):
        * dfg/DFGFiltrationResult.h: Added.
        (DFG):
        * dfg/DFGFixupPhase.cpp:
        (JSC::DFG::FixupPhase::fixupNode):
        * dfg/DFGNodeType.h:
        (DFG):
        * dfg/DFGOSRExitBase.cpp:
        (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow):
        * dfg/DFGOSRExitBase.h:
        (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSite):
        * dfg/DFGPredictionPropagationPhase.cpp:
        (JSC::DFG::PredictionPropagationPhase::propagate):
        * dfg/DFGSpeculativeJIT.cpp:
        (JSC::DFG::SpeculativeJIT::backwardTypeCheck):
        (JSC::DFG::SpeculativeJIT::bail):
        (DFG):
        (JSC::DFG::SpeculativeJIT::compile):
        (JSC::DFG::SpeculativeJIT::compileToStringOnCell):
        (JSC::DFG::SpeculativeJIT::speculateStringObject):
        (JSC::DFG::SpeculativeJIT::speculateStringOrStringObject):
        * dfg/DFGSpeculativeJIT.h:
        (SpeculativeJIT):
        * dfg/DFGSpeculativeJIT32_64.cpp:
        (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
        (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
        (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
        (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
        (JSC::DFG::SpeculativeJIT::compile):
        * dfg/DFGSpeculativeJIT64.cpp:
        (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
        (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
        (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
        (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
        (JSC::DFG::SpeculativeJIT::compile):
        * ftl/FTLCapabilities.cpp:
        (JSC::FTL::canCompile):
        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::compileNode):
        (JSC::FTL::LowerDFGToLLVM::appendTypeCheck):

1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635
2013-06-07  Mark Lam  <mark.lam@apple.com>

        32-bit CallFrame::Location should use Instruction* for BytecodeLocation, not bytecodeOffset.
        https://bugs.webkit.org/show_bug.cgi?id=117327.

        Reviewed by Michael Saboff.

        - Renamed CallFrame::Location's Type to TypeTag.
        - Made the CallFrame::Location::TypeTag private, and provided type
          specific encoder functions. This reduces verbosity in client code.
        - Fixed the DFG's reifyInlinedCallFrames() on 32-bit ports to store a
          bytecode Instruction* in the CallFrame location instead of a bytecode
          offset.
        - Fixed places in JIT and FTL code which populate the CallFrame location
          (i.e. ArgumentCount tag) to use a Location encoder instead of storing
          the bytecodeOffset directly. This doesn't make any semantic difference,
          but it does assert that the stored value does not have bits where we
          would expect Location TypeTags to be.

        * dfg/DFGJITCompiler.h:
        (JSC::DFG::JITCompiler::beginCall):
        * dfg/DFGOSRExitCompilerCommon.cpp:
        (JSC::DFG::reifyInlinedCallFrames):
        * ftl/FTLLink.cpp:
        (JSC::FTL::link):
        * interpreter/CallFrame.cpp:
        (JSC::CallFrame::setLocationAsBytecodeOffset):
        * interpreter/CallFrame.h:
        (Location):
        * interpreter/CallFrameInlines.h:
        (JSC::CallFrame::Location::encodeAsBytecodeOffset):
        (JSC::CallFrame::Location::encodeAsBytecodeInstruction):
        (JSC::CallFrame::Location::encodeAsCodeOriginIndex):
        (JSC::CallFrame::Location::encodeAsInlinedCode):
        (JSC::CallFrame::Location::isBytecodeLocation):
        (JSC::CallFrame::setIsInlinedFrame):
        (JSC::CallFrame::hasLocationAsBytecodeOffset):
        (JSC::CallFrame::setLocationAsBytecodeOffset):
        * jit/JITCall.cpp:
        (JSC::JIT::compileOpCall):
        * jit/JITCall32_64.cpp:
        (JSC::JIT::compileOpCall):
        * jit/JITInlines.h:
        (JSC::JIT::updateTopCallFrame):

1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759
2013-06-06  Mark Lam  <mark.lam@apple.com>

        Encode CallFrame::Location flags in the low bits when USE(JSVALUE32_64).
        https://bugs.webkit.org/show_bug.cgi?id=117312.

        Reviewed by Michael Saboff.

        For USE(JSVALUE32_64), we store the location flags in the low 2 bits of
        the word because we need the high bits for address bits.

        * interpreter/CallFrame.cpp:
        (JSC::CallFrame::setLocationAsBytecodeOffset):
        * interpreter/CallFrame.h:
        * interpreter/CallFrameInlines.h:
        (JSC::CallFrame::Location::encode):
        (JSC::CallFrame::Location::decode):
        (JSC::CallFrame::Location::isCodeOriginIndex):
        (JSC::CallFrame::Location::isInlinedCode):

2013-06-06  Mark Lam  <mark.lam@apple.com>

        CallFrame::trueCallFrame() should populate the bytecodeOffset field
        when reifying inlined frames..
        https://bugs.webkit.org/show_bug.cgi?id=117209.

        Reviewed by Geoffrey Garen.

        When reifying an inlined frame, we fill in its CodeBlock, and
        bytecodeOffset. We also set the InlinedFrame bit in the location field.
        This is needed in order to iterate the stack correctly. Here's why:

            Let's say we have the following stack trace:
              X calls A inlines B inlines C calls D

            Based on the above scenario,
            1. D's callerFrame points to A (not C).
            2. A has a codeOriginIndex that points to C.

        When iterating the stack (from D back towards X), we will encounter A
        twice:

            t1. when trying to find C as D's caller.
                This is the time when we reify B and C using the
                codeOriginIndex in A, and return C as the caller frame of D.

            t2. when getting's the reified B's caller.
                This time, we don't run the reification process, and
                just take A as the caller frame of B.

        To discern which treatment of the DFG frame (i.e. A) we need to apply,
        we check if the callee is an inlined frame:

            If callee is NOT an inlined frame (e.g. frame D), apply treatment t1.
            If callee is an inlined frame (e.g. frame B), apply treatment t2.

        Why not just reify A by replacing its codeOriginIndex with A's
        bytecodeOffset?

        We can't do this because D's callerFrame pointer still points to A, and
        needs to remain that way because we did not deopt A. It remains a DFG
        frame which inlined B and C.

        If we replace the codeOriginIndex in A with A's bytecodeOffset, we will
        only get to iterate the stack correctly once. If we try to iterate the
        stack a second time, we will not have the information from the
        codeOriginIndex to tell us that D's caller is actually the inlined C,
        and not A.

        To recap, when reifying frames for stack iteration purposes, the DFG
        frame needs to hold on to its codeOriginIndex. This in turn means the
        DFG frame will need to be treated in 2 possible ways, and we need to
        know if a callee frame is an inlined frame in order to choose the
        correct treatment for the DFG frame.

        Other changes:
        - Simplified Interpreter::getCallerInfo().
        - Removed CodeBlock::codeOriginForReturn() and supporting code
          which is now unneeded.
        - Moved CallFrame location bit encoding from the CodeOrigin to the
          new CallFrame::Location class.
        - Explicitly tagged inlined frames. This is necessary in order to
          iterate the stack correctly as explained above.

        * bytecode/CodeBlock.cpp:
        * bytecode/CodeBlock.h:
        (JSC::CodeBlock::codeOrigins):
        (CodeBlock):
        (JSC::CodeBlock::codeOrigin):
        (RareData):
        * bytecode/CodeOrigin.h:
        (CodeOrigin):
        * dfg/DFGJITCompiler.cpp:
        (JSC::DFG::JITCompiler::link):
        * dfg/DFGJITCompiler.h:
        (JSC::DFG::JITCompiler::beginCall):
        * interpreter/CallFrame.cpp:
        (JSC::CallFrame::trueCallFrame):
        (JSC::CallFrame::trueCallerFrame):
        (JSC::CallFrame::bytecodeOffsetFromCodeOriginIndex):
        * interpreter/CallFrame.h:
        (Location):
        (ExecState):
        (JSC::ExecState::trueCallerFrame):
        (JSC::ExecState::callerFrameNoFlags):
        * interpreter/CallFrameInlines.h:
        (JSC::CallFrame::Location::encode):
        (JSC::CallFrame::Location::decode):
        (JSC::CallFrame::Location::isBytecodeOffset):
        (JSC::CallFrame::Location::isCodeOriginIndex):
        (JSC::CallFrame::Location::isInlinedFrame):
        (JSC::CallFrame::isInlinedFrame):
        (JSC::CallFrame::setIsInlinedFrame):
        (JSC::CallFrame::hasLocationAsBytecodeOffset):
        (JSC::CallFrame::hasLocationAsCodeOriginIndex):
        (JSC::CallFrame::locationAsBytecodeOffset):
        (JSC::CallFrame::setLocationAsBytecodeOffset):
        (JSC::CallFrame::locationAsCodeOriginIndex):
        * interpreter/Interpreter.cpp:
        (JSC::getCallerInfo):
        (JSC::Interpreter::getStackTrace):
        (JSC::Interpreter::findFunctionCallFrameFromVMCode):
        * runtime/Arguments.cpp:
        (JSC::Arguments::tearOff):

1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786
2013-06-05  Filip Pizlo  <fpizlo@apple.com>

        DFG CFA shouldn't filter ArrayModes with ALL_NON_ARRAY_ARRAY_MODES if the speculated type is not SpecArray
        https://bugs.webkit.org/show_bug.cgi?id=117279

        Reviewed by Mark Hahnenberg.
        
        The normalization of abstract value clarity introduced in r151229 revealed a
        long-standing bug where we filtered ArrayModes incorrectly and sometimes ended
        up with BOTTOM incorrectly.
        
        This patch fixes that bug, and cleans up a bunch of debugging infrastructure
        that I needed to resurrect to track this down.

        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::resetStubInternal):
        (JSC::CodeBlock::noticeIncomingCall):
        * dfg/DFGAbstractValue.cpp:
        (JSC::DFG::AbstractValue::filterArrayModesByType):
        * dfg/DFGCFAPhase.cpp:
        (CFAPhase):
        (JSC::DFG::CFAPhase::run):
        (JSC::DFG::CFAPhase::performBlockCFA):
        (JSC::DFG::CFAPhase::performForwardCFA):
        * runtime/Options.h:
        (JSC):

1787 1788 1789 1790 1791 1792 1793
2013-06-05  Filip Pizlo  <fpizlo@apple.com>

        Unreviewed, fix release build.

        * interpreter/Interpreter.cpp:
        * jit/JITStubs.cpp:

1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847
2013-06-05  Mark Lam  <mark.lam@apple.com>

        Disambiguate between CallFrame bytecodeOffset and codeOriginIndex.
        https://bugs.webkit.org/show_bug.cgi?id=117262.

        Reviewed by Geoffrey Garen.

        When writing to the ArgumentCount tag in CallFrame, we will set the high
        bit if the written value is a codeOriginIndex.

        * GNUmakefile.list.am:
        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * bytecode/CodeOrigin.h:
        (CodeOrigin):
        (JSC::CodeOrigin::isHandle):
        (JSC::CodeOrigin::encodeHandle):
        (JSC::CodeOrigin::decodeHandle):
        * dfg/DFGJITCompiler.h:
        (JSC::DFG::JITCompiler::beginCall):
        * dfg/DFGRepatch.cpp:
        (JSC::DFG::tryBuildGetByIDList):
        * interpreter/CallFrame.cpp:
        (JSC::CallFrame::locationAsBytecodeOffset):
        (JSC::CallFrame::setLocationAsBytecodeOffset):
        (JSC::CallFrame::currentVPC):
        (JSC::CallFrame::setCurrentVPC):
        (JSC::CallFrame::trueCallFrame):
        * interpreter/CallFrame.h:
        (ExecState):
        (JSC::ExecState::inlineCallFrame):
        * interpreter/CallFrameInlines.h: Added.
        (JSC::CallFrame::hasLocationAsBytecodeOffset):
        (JSC::CallFrame::hasLocationAsCodeOriginIndex):
        (JSC::CallFrame::locationAsRawBits):
        (JSC::CallFrame::setLocationAsRawBits):
        (JSC::CallFrame::locationAsBytecodeOffset):
        (JSC::CallFrame::setLocationAsBytecodeOffset):
        (JSC::CallFrame::locationAsCodeOriginIndex):
        * interpreter/Interpreter.cpp:
        (JSC::getBytecodeOffsetForCallFrame):
        (JSC::getCallerInfo):
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):

2013-06-05  Filip Pizlo  <fpizlo@apple.com>

        Unreviewed, fix release build.

        * interpreter/Interpreter.cpp:
        * jit/JITStubs.cpp:

1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918
2013-06-04  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: Clean up AbstractValue
        https://bugs.webkit.org/show_bug.cgi?id=117217

        Reviewed by Oliver Hunt.
        
        This started as an attempt to make it so that when AbstractValue becomes empty,
        its m_type always becomes SpecNone. I wanted this to happen naturally. That turns
        out to be basically impossible, since AbstractValue is a set that is dynamically
        computed from the intersection of several internal sets: so the value becomes
        empty when any of the sets go empty. It's OK if we're imprecise here because it's
        always safe for the AbstractValue to seem to overapproximate the set of values
        that we see. So I mostly gave up on cleaning up that aspect of AbstractValue. But
        while trying to make this happen, I encountered two bugs:
        
        - filterValueByType() ignores the case when m_type contravenes m_value. Namely,
          we might filter the AbstractValue against a SpeculatedType leading to m_value
          becoming inconsistent with the new m_type. This change fixes that case. This
          wasn't a symptomatic bug but it was a silly oversight.
        
        - filterFuturePossibleStructure() was never right. The one call to this method,
          in filter(Graph&, const StructureSet&), assumed that the previous notions of
          what structures the value could have in the future were still relevant. This
          could lead to a bug where we:
          
          1) CheckStructure(@foo, S1)
          
             Where S1 has a valid watchpoint. Now @foo's abstract value will have current
             and future structure = S1.
          
          2) Clobber the world.
          
             Now @foo's abstract value will have current structure = TOP, and future
             possible structure = S1.
          
          3) CheckStructure(@foo, S2)
          
             Now @foo's abstract value will have current structure = S2 and future
             possible structure = S1 intersect S2 = BOTTOM.
          
          Now we will think that any subsequent watchpoint on @foo is valid because the
          value is effectively BOTTOM. That would only be correct if we had actually set
          a watchpoint on S1. If we had done so, then (3) would only pass (i.e. @foo
          would only have structure S2) if S1's watchpoint fired, in which case (3)
          wouldn't have been reachable. But we didn't actually set a watchpoint on S1:
          we just observed that we *could* have set the watchpoint. Hence future possible
          structure should only be set to either the known structure at compile-time, or
          it should be the structure we just checked; in both cases it should only be set
          if the structure is watchable.
        
        Then, in addition to all of this, I changed AbstractValue's filtering methods to
        call clear() if the AbstractValue is effectively clear. This is just meant to
        simplify the recognition of truly empty AbstractValues, but doesn't actually have
        any other implications.

        * bytecode/StructureSet.h:
        (JSC::StructureSet::dump):
        * dfg/DFGAbstractValue.cpp:
        (JSC::DFG::AbstractValue::filter):
        (DFG):
        (JSC::DFG::AbstractValue::filterArrayModes):
        (JSC::DFG::AbstractValue::filterValueByType):
        (JSC::DFG::AbstractValue::filterArrayModesByType):
        (JSC::DFG::AbstractValue::shouldBeClear):
        (JSC::DFG::AbstractValue::normalizeClarity):
        (JSC::DFG::AbstractValue::checkConsistency):
        * dfg/DFGAbstractValue.h:
        (JSC::DFG::AbstractValue::isClear):
        (AbstractValue):

1919 1920 1921 1922 1923 1924 1925 1926 1927 1928
2013-06-04  Mark Lam  <mark.lam@apple.com>

        The DFG JIT should populate frame bytecodeOffsets on OSR exit.
        https://bugs.webkit.org/show_bug.cgi?id=117103.

        Reviewed by Geoffrey Garen.

        * dfg/DFGOSRExitCompilerCommon.cpp:
        (JSC::DFG::reifyInlinedCallFrames):

1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954
2013-06-03  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: all cached put_by_id transitions, even ones that weren't inlined by the DFG, should be propagated by the GC
        https://bugs.webkit.org/show_bug.cgi?id=117170

        Reviewed by Mark Hahnenberg.

        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::visitAggregate):
        (JSC::CodeBlock::propagateTransitions):
        (JSC):
        (JSC::CodeBlock::determineLiveness):
        (JSC::CodeBlock::visitWeakReferences):
        (JSC::CodeBlock::finalizeUnconditionally):
        * bytecode/CodeBlock.h:
        (CodeBlock):
        * bytecode/PolymorphicPutByIdList.h:
        (JSC):
        (PutByIdAccess):
        (PolymorphicPutByIdList):
        * bytecode/StructureStubInfo.h:
        (StructureStubInfo):
        * jit/JITCode.h:
        (JSC::JITCode::couldBeInterpreted):
        (JITCode):

1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981
2013-06-02  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: Get rid of StructureStubInfo::bytecodeIndex
        https://bugs.webkit.org/show_bug.cgi?id=117127

        Reviewed by Mark Hahnenberg.
        
        StructureStubInfo already has a CodeOrigin field, which also has a bytecodeIndex.
        It makes sense to just always use the CodeOrigin.

        * bytecode/StructureStubInfo.h:
        (StructureStubInfo):
        (JSC::getStructureStubInfoBytecodeIndex):
        * jit/JIT.cpp:
        (JSC::PropertyStubCompilationInfo::copyToStubInfo):
        * jit/JIT.h:
        (JSC::JIT::compileGetByIdProto):
        (JSC::JIT::compileGetByIdSelfList):
        (JSC::JIT::compileGetByIdProtoList):
        (JSC::JIT::compileGetByIdChainList):
        (JSC::JIT::compileGetByIdChain):
        (JSC::JIT::compilePutByIdTransition):
        * jit/JITPropertyAccess.cpp:
        (JSC::JIT::privateCompilePutByIdTransition):
        * jit/JITPropertyAccess32_64.cpp:
        (JSC::JIT::privateCompilePutByIdTransition):

1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045
2013-06-01  Filip Pizlo  <fpizlo@apple.com>

        Fix some minor issues in the DFG's profiling of heap accesses
        https://bugs.webkit.org/show_bug.cgi?id=113010

        Reviewed by Goeffrey Garen.
        
        Carefully merge r146669 from trunk. This required some fiddling since it
        wasn't a clean apply.
        
        Original changelog:

            1) If a CodeBlock gets jettisoned by GC, we should count the exit sites.
    
            2) If a CodeBlock clears a structure stub during GC, it should record this, and
            the DFG should prefer to not inline that access (i.e. treat it as if it had an
            exit site).
    
            3) If a PutById was seen by the baseline JIT, and the JIT attempted to cache it,
            but it chose not to, then assume that it will take slow path.
    
            4) If we frequently exited because of a structure check on a weak constant,
            don't try to inline that access in the future.
    
            5) Treat all exits that were counted as being frequent.
            
            81% speed-up on Octane/gbemu. Small speed-ups elsewhere, and no regressions.
    
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::finalizeUnconditionally):
        (JSC):
        (JSC::CodeBlock::resetStubDuringGCInternal):
        (JSC::CodeBlock::reoptimize):
        (JSC::CodeBlock::jettison):
        (JSC::ProgramCodeBlock::jettisonImpl):
        (JSC::EvalCodeBlock::jettisonImpl):
        (JSC::FunctionCodeBlock::jettisonImpl):
        (JSC::CodeBlock::tallyFrequentExitSites):
        * bytecode/CodeBlock.h:
        (CodeBlock):
        (JSC::CodeBlock::tallyFrequentExitSites):
        (ProgramCodeBlock):
        (EvalCodeBlock):
        (FunctionCodeBlock):
        * bytecode/GetByIdStatus.cpp:
        (JSC::GetByIdStatus::computeFor):
        * bytecode/PutByIdStatus.cpp:
        (JSC::PutByIdStatus::computeFor):
        * bytecode/StructureStubInfo.h:
        (JSC::StructureStubInfo::StructureStubInfo):
        (StructureStubInfo):
        * dfg/DFGByteCodeParser.cpp:
        (JSC::DFG::ByteCodeParser::handleGetById):
        (JSC::DFG::ByteCodeParser::parseBlock):
        * dfg/DFGOSRExitBase.cpp:
        (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow):
        * dfg/DFGOSRExitBase.h:
        (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSite):
        (OSRExitBase):
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):
        * runtime/Options.h:
        (JSC):

2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060
2013-05-31  Filip Pizlo  <fpizlo@apple.com>

        Remove CodeOrigin::valueProfileOffset since it was only needed for op_call_put_result.

        Rubber stamped by Mark Hahnenberg.

        * bytecode/CodeOrigin.h:
        (CodeOrigin):
        (JSC::CodeOrigin::CodeOrigin):
        (JSC::CodeOrigin::isSet):
        * dfg/DFGByteCodeParser.cpp:
        (JSC::DFG::ByteCodeParser::currentCodeOrigin):
        * dfg/DFGGraph.h:
        (JSC::DFG::Graph::valueProfileFor):

2061 2062 2063 2064 2065 2066 2067 2068 2069
2013-05-31  Filip Pizlo  <fpizlo@apple.com>

        Remove finalDestinationOrIgnored since it isn't called anymore.

        Rubber stamped by Mark Hahnenberg.

        * bytecompiler/BytecodeGenerator.h:
        (BytecodeGenerator):

2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179
2013-05-31  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: get rid of op_call_put_result
        https://bugs.webkit.org/show_bug.cgi?id=117047

        Reviewed by Gavin Barraclough.
        
        op_call_put_result is an oddball. Its semantics are that it takes the return
        value of a call instruction, which is set aside in regT0/regT1, and places them
        into some stack slot. This is weird since there is an implicit contract with the
        preceding bytecode instruction, and it's even weirder since it means that it
        doesn't make sense to jump to it; for example OSR exit from the preceding call
        instruction must make sure to jump over the op_call_put_result.
        
        So this patch gets rid of op_call_put_result:
        
        - In bytecode, all calls return a value and we always allocate a temporary for
          that value even if it isn't used.
        
        - The LLInt does the return value saving as part of dispatchAfterCall().
        
        - The JIT and DFG do the return value saving as part of normal code generation.
          The DFG already did the right thing.
        
        - DFG->JIT OSR exit in the case of inlining will make the return PC's point at
          the CallLinkInfo::callReturnLocation, rather than the machine PC associated
          with the op_call_put_result instruction.
        
        - Tons of code gets removed. The DFG had to track whether or not a call had a
          return value in a bunch of places. It had to track the fact that we would
          exit to after the op_call_put_result. It was a mess. That mess is now gone.

        * bytecode/CallLinkStatus.cpp:
        (JSC::CallLinkStatus::computeFromLLInt):
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::printCallOp):
        (JSC::CodeBlock::dumpArrayProfiling):
        (JSC::CodeBlock::dumpBytecode):
        (JSC::CodeBlock::CodeBlock):
        * bytecode/CodeBlock.h:
        * bytecode/Opcode.h:
        (JSC):
        (JSC::padOpcodeName):
        * bytecompiler/BytecodeGenerator.cpp:
        (JSC::BytecodeGenerator::emitCall):
        (JSC::BytecodeGenerator::emitCallVarargs):
        (JSC::BytecodeGenerator::emitConstruct):
        * bytecompiler/NodesCodegen.cpp:
        (JSC::NewExprNode::emitBytecode):
        (JSC::FunctionCallValueNode::emitBytecode):
        (JSC::FunctionCallResolveNode::emitBytecode):
        (JSC::FunctionCallBracketNode::emitBytecode):
        (JSC::FunctionCallDotNode::emitBytecode):
        (JSC::CallFunctionCallDotNode::emitBytecode):
        (JSC::ApplyFunctionCallDotNode::emitBytecode):
        * dfg/DFGByteCodeParser.cpp:
        (JSC::DFG::ByteCodeParser::ByteCodeParser):
        (ByteCodeParser):
        (JSC::DFG::ByteCodeParser::currentCodeOrigin):
        (JSC::DFG::ByteCodeParser::addCall):
        (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
        (JSC::DFG::ByteCodeParser::getPrediction):
        (JSC::DFG::ByteCodeParser::handleCall):
        (JSC::DFG::ByteCodeParser::handleInlining):
        (JSC::DFG::ByteCodeParser::handleMinMax):
        (JSC::DFG::ByteCodeParser::handleIntrinsic):
        (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
        (JSC::DFG::ByteCodeParser::parseBlock):
        * dfg/DFGCapabilities.cpp:
        (JSC::DFG::capabilityLevel):
        * dfg/DFGOSRExitCompiler.cpp:
        * dfg/DFGOSRExitCompilerCommon.cpp:
        (JSC::DFG::reifyInlinedCallFrames):
        * jit/JIT.cpp:
        (JSC::JIT::privateCompileMainPass):
        * jit/JIT.h:
        (JIT):
        * jit/JITCall.cpp:
        (JSC::JIT::emitPutCallResult):
        (JSC::JIT::compileLoadVarargs):
        (JSC::JIT::compileCallEval):
        (JSC::JIT::compileCallEvalSlowCase):
        (JSC::JIT::compileOpCall):
        (JSC::JIT::compileOpCallSlowCase):
        (JSC::JIT::emit_op_call):
        (JSC):
        (JSC::JIT::emit_op_call_eval):
        (JSC::JIT::emit_op_call_varargs):
        (JSC::JIT::emit_op_construct):
        (JSC::JIT::emitSlow_op_call):
        (JSC::JIT::emitSlow_op_call_eval):
        (JSC::JIT::emitSlow_op_call_varargs):
        (JSC::JIT::emitSlow_op_construct):
        * jit/JITCall32_64.cpp:
        (JSC::JIT::emitPutCallResult):
        (JSC::JIT::compileLoadVarargs):
        (JSC::JIT::compileCallEval):
        (JSC::JIT::compileCallEvalSlowCase):
        (JSC::JIT::compileOpCall):
        (JSC::JIT::compileOpCallSlowCase):
        * jit/JITOpcodes.cpp:
        (JSC):
        * llint/LLIntSlowPaths.cpp:
        (JSC::LLInt::genericCall):
        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
        * llint/LowLevelInterpreter.cpp:
        (JSC::CLoop::execute):
        * llint/LowLevelInterpreter32_64.asm:
        * llint/LowLevelInterpreter64.asm:

2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210
2013-05-30  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: LLInt shouldn't store an offset call PC during op_call-like calls
        https://bugs.webkit.org/show_bug.cgi?id=117048

        Reviewed by Mark Hahnenberg.
        
        This just makes everything consistent in the LLInt: anytime any op calls out,
        it stores its PC and never the next op's PC.
        
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::dumpBytecode):
        (JSC::CodeBlock::linkIncomingCall):
        (JSC::CodeBlock::bytecodeOffset):
        * bytecode/CodeBlock.h:
        * bytecode/Opcode.h:
        (JSC::padOpcodeName):
        * bytecompiler/BytecodeGenerator.cpp:
        (JSC::BytecodeGenerator::emitCallVarargs):
        * llint/LLIntExceptions.cpp:
        (JSC::LLInt::interpreterThrowInCaller):
        (JSC::LLInt::returnToThrow):
        (JSC::LLInt::callToThrow):
        * llint/LLIntSlowPaths.cpp:
        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
        * llint/LowLevelInterpreter.asm:
        * llint/LowLevelInterpreter.cpp:
        (JSC::CLoop::execute):
        * llint/LowLevelInterpreter32_64.asm:
        * llint/LowLevelInterpreter64.asm:

2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236
2013-05-28  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: FTL should support ArithAbs
        https://bugs.webkit.org/show_bug.cgi?id=116890

        Reviewed by Oliver Hunt.
        
        Implements ArithAbs in the FTL, and cleans up the DFG implementation. The
        DFG implementation was previously doing zero extensions manually when it
        is probably better to just use StrictInt32Operand instead.

        * dfg/DFGSpeculativeJIT32_64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * dfg/DFGSpeculativeJIT64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * ftl/FTLCapabilities.cpp:
        (JSC::FTL::canCompile):
        * ftl/FTLIntrinsicRepository.h:
        (FTL):
        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::compileNode):
        (JSC::FTL::LowerDFGToLLVM::compileArithAbs):
        (LowerDFGToLLVM):
        * ftl/FTLOutput.h:
        (JSC::FTL::Output::doubleAbs):

2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294
2013-05-28  Mark Lam  <mark.lam@apple.com>

        Misc JIT probe enhacements.
        https://bugs.webkit.org/show_bug.cgi?id=116586.

        Reviewed by Michael Saboff.

        1. Added JIT probe support for ARMv7 and traditional ARM.
           Built and tested on ARMv7. ARM version not tested nor built. 
        2. Fix the following bugs in the X86 and X86_64 probes:
           a. Cannot assume that the stack pointer is already aligned when
              we push args for the probe. Instead, we ensure the stack
              alignment at runtime when we set up the probe call.
              This is now done in the ctiMasmProbeTrampoline.
           b. On return, the user probe function may have altered the stack
              pointer value to be restored. Previously, if the sp restore value
              points to some of the other register restore values in the
              ProbeContext record, we will fail to return from the probe having
              those user specified value as we're expected to do.
              This is now fixed.
        3. Rearranged the X86/X86_64 registers order to organize them like gdb
           expects on X86_64.
        4. We also now preserve the condition code registers.

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * assembler/ARMAssembler.h:
        * assembler/ARMv7Assembler.h:
        (ARMRegisters):
        * assembler/MacroAssemblerARM.cpp:
        (JSC::isVFPPresent):
        (JSC::MacroAssemblerARM::ProbeContext::dumpCPURegisters):
        (JSC::MacroAssemblerARM::ProbeContext::dump):
        (JSC::MacroAssemblerARM::probe):
        * assembler/MacroAssemblerARM.h:
        (MacroAssemblerARM):
        (CPUState):
        (ProbeContext):
        (JSC::MacroAssemblerARM::trustedImm32FromPtr):
        * assembler/MacroAssemblerARMv7.h:
        (MacroAssemblerARMv7):
        (CPUState):
        (ProbeContext):
        (JSC::MacroAssemblerARMv7::trustedImm32FromPtr):
        * assembler/MacroAssemblerX86.h:
        (MacroAssemblerX86):
        (JSC::MacroAssemblerX86::probe):
        * assembler/MacroAssemblerX86Common.cpp:
        (JSC::MacroAssemblerX86Common::ProbeContext::dumpCPURegisters):
        * assembler/MacroAssemblerX86_64.h:
        (JSC::MacroAssemblerX86_64::probe):
        * assembler/X86Assembler.h:
        * config.h:
        * jit/JITStubsARM.h:
        * jit/JITStubsARMv7.h:
        * jit/JITStubsX86.h:
        * jit/JITStubsX86Common.h:
        * jit/JITStubsX86_64.h:

2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307
2013-05-28  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: FTL should call masqueradesAsUndefinedWatchpointIfIsStillValid() in all of the places where it currently calls masqueradesAsUndefinedWatchpointIsStillValid()
        https://bugs.webkit.org/show_bug.cgi?id=116892

        Reviewed by Oliver Hunt.
        
        All of those places mean to plant the watchpoint if it's still valid.

        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::equalNullOrUndefined):
        (JSC::FTL::LowerDFGToLLVM::speculateNonNullObject):

2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321
2013-05-28  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: FTL should support ArithMin/ArithMax
        https://bugs.webkit.org/show_bug.cgi?id=116885

        Reviewed by Oliver Hunt.

        * ftl/FTLCapabilities.cpp:
        (JSC::FTL::canCompile):
        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::compileNode):
        (LowerDFGToLLVM):
        (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax):

2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348
2013-05-28  Filip Pizlo  <fpizlo@apple.com>

        testRunner should have a way of disabling inlining of functions
        https://bugs.webkit.org/show_bug.cgi?id=116875

        Reviewed by Mark Hahnenberg.

        * API/JSCTestRunnerUtils.cpp:
        (JSC::getExecutable):
        (JSC):
        (JSC::numberOfDFGCompiles):
        (JSC::setNeverInline):
        * API/JSCTestRunnerUtils.h:
        (JSC):
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::dumpAssumingJITType):
        * dfg/DFGCapabilities.cpp:
        (JSC::DFG::mightInlineFunctionForCall):
        (JSC::DFG::mightInlineFunctionForClosureCall):
        (JSC::DFG::mightInlineFunctionForConstruct):
        * runtime/Executable.h:
        (JSC::ScriptExecutable::ScriptExecutable):
        (ScriptExecutable):
        (JSC::ScriptExecutable::setNeverInline):
        (JSC::ScriptExecutable::neverInline):
        (JSC::ScriptExecutable::isInliningCandidate):

2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366
2013-05-27  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: FTL should support ArithMod
        https://bugs.webkit.org/show_bug.cgi?id=116792

        Reviewed by Oliver Hunt.

        * ftl/FTLAbbreviations.h:
        (JSC::FTL::buildFRem):
        * ftl/FTLCapabilities.cpp:
        (JSC::FTL::canCompile):
        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::compileNode):
        (JSC::FTL::LowerDFGToLLVM::compileArithMod):
        (LowerDFGToLLVM):
        * ftl/FTLOutput.h:
        (JSC::FTL::Output::doubleRem):

2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441
2013-05-27  Filip Pizlo  <fpizlo@apple.com>

        It should be possible to record heap operations (both FastMalloc and JSC GC)
        https://bugs.webkit.org/show_bug.cgi?id=116848

        Reviewed by Mark Hahnenberg.
        
        Record GC heap operations if ENABLE(ALLOCATION_LOGGING).

        * API/JSManagedValue.mm:
        * dfg/DFGOperations.cpp:
        * heap/Heap.cpp:
        (JSC::Heap::collect):
        * heap/Heap.h:
        (Heap):
        (JSC::Heap::allocateWithNormalDestructor):
        (JSC::Heap::allocateWithImmortalStructureDestructor):
        (JSC::Heap::allocateWithoutDestructor):
        (JSC::Heap::tryAllocateStorage):
        (JSC::Heap::tryReallocateStorage):
        (JSC):
        (JSC::Heap::ascribeOwner):
        * heap/SlotVisitor.cpp:
        (JSC::SlotVisitor::append):
        (JSC::SlotVisitor::internalAppend):
        * heap/SlotVisitor.h:
        (SlotVisitor):
        * heap/SlotVisitorInlines.h:
        (JSC::SlotVisitor::append):
        (JSC::SlotVisitor::appendUnbarrieredPointer):
        (JSC::SlotVisitor::appendUnbarrieredValue):
        (JSC::SlotVisitor::appendUnbarrieredWeak):
        (JSC::SlotVisitor::internalAppend):
        (JSC):
        (JSC::SlotVisitor::appendValues):
        * jit/JITWriteBarrier.h:
        (JSC::SlotVisitor::append):
        * llint/LLIntCommon.h:
        * runtime/Butterfly.h:
        (Butterfly):
        * runtime/ButterflyInlines.h:
        (JSC::Butterfly::createUninitialized):
        (JSC::Butterfly::create):
        (JSC::Butterfly::growPropertyStorage):
        (JSC::Butterfly::createOrGrowArrayRight):
        (JSC):
        (JSC::Butterfly::growArrayRight):
        (JSC::Butterfly::resizeArray):
        * runtime/JSArray.cpp:
        (JSC::createArrayButterflyInDictionaryIndexingMode):
        (JSC::JSArray::unshiftCountSlowCase):
        * runtime/JSArray.h:
        (JSC::createContiguousArrayButterfly):
        (JSC::createArrayButterfly):
        (JSC):
        (JSC::JSArray::create):
        (JSC::JSArray::tryCreateUninitialized):
        * runtime/JSObject.cpp:
        (JSC::JSObject::enterDictionaryIndexingModeWhenArrayStorageAlreadyExists):
        (JSC::JSObject::createInitialIndexedStorage):
        (JSC::JSObject::createArrayStorage):
        (JSC::JSObject::constructConvertedArrayStorageWithoutCopyingElements):
        (JSC::JSObject::increaseVectorLength):
        (JSC::JSObject::ensureLengthSlow):
        (JSC::JSObject::growOutOfLineStorage):
        * runtime/JSObject.h:
        (JSC::JSObject::JSObject):
        * runtime/Operations.h:
        * runtime/RegExpMatchesArray.cpp:
        (JSC::RegExpMatchesArray::create):
        * runtime/StructureInlines.h:
        (JSC):
        * runtime/WriteBarrier.h:
        (JSC):

2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472
2013-05-27  Filip Pizlo  <fpizlo@apple.com>

        testRunner should be able to tell you if a function is DFG compiled
        https://bugs.webkit.org/show_bug.cgi?id=116847

        Reviewed by Mark Hahnenberg.

        * API/JSCTestRunnerUtils.cpp: Added.
        (JSC):
        (JSC::numberOfDFGCompiles):
        * API/JSCTestRunnerUtils.h: Added.
        (JSC):
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::numberOfDFGCompiles):
        (JSC):
        * bytecode/CodeBlock.h:
        (CodeBlock):
        * dfg/DFGWorklist.cpp:
        (JSC::DFG::Worklist::runThread):
        * runtime/Executable.h:
        (JSC):
        * runtime/JSFunctionInlines.h: Added.
        (JSC):
        (JSC::JSFunction::JSFunction):
        (JSC::JSFunction::jsExecutable):
        (JSC::JSFunction::isHostFunction):
        (JSC::JSFunction::nativeFunction):
        (JSC::JSFunction::nativeConstructor):
        * runtime/Operations.h:

2473 2474 2475 2476 2477 2478 2479 2480 2481 2482
2013-05-27  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: DFG ArithMod should have the !nodeUsedAsNumber optimizations that ArithDiv has
        https://bugs.webkit.org/show_bug.cgi?id=116841

        Reviewed by Mark Hahnenberg.

        * dfg/DFGSpeculativeJIT.cpp:
        (JSC::DFG::SpeculativeJIT::compileArithMod):

2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533
2013-05-26  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: clean up ArithDiv/ArithMod in the DFG
        https://bugs.webkit.org/show_bug.cgi?id=116793

        Reviewed by Mark Hahnenberg.
        
        This makes ArithDiv and ArithMod behave similarly, and moves both of their
        implementations entirely into DFGSpeculativeJIT.cpp into methods named like
        the ones for ArithSub/ArithMul.
        
        Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that
        ArithDiv used for platforms that don't support integer division. Previously
        ArithMod had its own int-to-double and double-to-int conversions for this
        purpose.
        
        As well, this gets rid of confusing methods like compileSoftModulo() (which
        did no such thing, there wasn't anything "soft" about it) and 
        compileIntegerArithDivForX86() (which is accurately named but we don't use
        the platform-specific method convention anywhere else).
        
        Finally, this takes the optimized power-of-two modulo operation that was
        previously only for ARMv7s, and makes it available for all platforms. Well,
        sort of: I actually rewrote it to do what latest LLVM appears to do, which
        is a crazy straight-line power-of-2 modulo based on a combination of shifts,
        ands, additions, and subtractions. I can kind of understand it well enough
        to see that it complies with both C and JS power-of-2 modulo semantics. I've
        also confirmed that it does by testing (hence the corresponding improvements
        to one of the division tests). But, I don't claim to know exactly how this
        code works other than to observe that it is super leet.
        
        Overall, this patch has the effect of killing some code (no more hackish
        int-to-double conversions in ArithMod), making some optimization work on
        more platforms, and making the compiler less confusing by doing more things
        with the same idiom.

        * dfg/DFGAbstractState.cpp:
        (JSC::DFG::AbstractState::executeEffects):
        * dfg/DFGFixupPhase.cpp:
        (JSC::DFG::FixupPhase::fixupNode):
        * dfg/DFGSpeculativeJIT.cpp:
        (DFG):
        (JSC::DFG::SpeculativeJIT::compileArithDiv):
        (JSC::DFG::SpeculativeJIT::compileArithMod):
        * dfg/DFGSpeculativeJIT.h:
        (SpeculativeJIT):
        * dfg/DFGSpeculativeJIT32_64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * dfg/DFGSpeculativeJIT64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):

2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558
2013-05-25  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: cti_optimize shouldn't allow GCs to get in the way of it seeing the state of its CodeBlock
        https://bugs.webkit.org/show_bug.cgi?id=116748

        Reviewed by Geoffrey Garen.
        
        This fixes the following race: an optimized version of our code block could be installed
        by the GC just as we return from completeAllReadyPlansForVM(), leading us to believe
        that the code block isn't ready yet even though it is. Currently this triggers a
        RELEASE_ASSERT. We could remove that assertion, but then this case would lead to the
        code in question entering into optimizeAfterWarmUp mode. That seems pretty wasteful.
        
        Fix the bug, and hopefully close the door on these bugs for a while, by wrapping
        cti_optimize in a DeferGC. There is little downside to doing so since the only
        "allocations" in cti_optimize are the ones where we inform the GC about extra memory
        usage.
        
        I had a more comprehensive solution (see the bug, "work in progress" patch) but that
        one involved adding *more* raciness to cti_optimize. I decided that was a less good
        approach once I came to appreciate the simplicity of just using DeferGC.

        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):

2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585
2013-05-25  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: FTL should support ArithDiv
        https://bugs.webkit.org/show_bug.cgi?id=116771

        Reviewed by Oliver Hunt.

        * ftl/FTLAbbreviations.h:
        (JSC::FTL::buildDiv):
        (JSC::FTL::buildRem):
        (JSC::FTL::buildFDiv):
        * ftl/FTLCapabilities.cpp:
        (JSC::FTL::canCompile):
        * ftl/FTLCommonValues.cpp:
        (JSC::FTL::CommonValues::CommonValues):
        * ftl/FTLCommonValues.h:
        (CommonValues):
        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::compileNode):
        (JSC::FTL::LowerDFGToLLVM::compileArithMul):
        (JSC::FTL::LowerDFGToLLVM::compileArithDiv):
        (LowerDFGToLLVM):
        * ftl/FTLOutput.h:
        (JSC::FTL::Output::div):
        (JSC::FTL::Output::rem):
        (JSC::FTL::Output::doubleDiv):

2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611
2013-05-25  Mark Lam  <mark.lam@apple.com>

        Remove Interpreter::retrieveLastCaller().
        https://bugs.webkit.org/show_bug.cgi?id=116753.

        Reviewed by Geoffrey Garen.

        This is part of the refactoring effort to get rid of functions walking
        the JS stack in their own way.

        * API/JSContextRef.cpp:
        (JSContextCreateBacktrace):
        * interpreter/CallFrame.cpp:
        * interpreter/Interpreter.cpp:
        (JSC::Interpreter::Interpreter):
        (JSC::Interpreter::getStackTrace):
        (JSC::Interpreter::addStackTraceIfNecessary):
        * interpreter/Interpreter.h:
        (StackFrame):
        (JSC::StackFrame::StackFrame):
        (Interpreter):
        * jsc.cpp:
        (functionJSCStack):
        * profiler/ProfileGenerator.cpp:
        (JSC::ProfileGenerator::addParentForConsoleStart):

2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631
2013-05-24  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: FTL boolify should support ObjectOrOtherUse
        https://bugs.webkit.org/show_bug.cgi?id=116741

        Reviewed by Geoffrey Garen.
        
        Just reusing what was already there in equalNullOrUndefined(). Note that we will
        sometimes generate some redundant IR - like having some spurious bitNot's in
        places - but it's safe to assume that LLVM will simplify those, and that it won't
        be the longest pole in the tent for compile times.

        * ftl/FTLCapabilities.cpp:
        (JSC::FTL::canCompile):
        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant):
        (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant):
        (JSC::FTL::LowerDFGToLLVM::boolify):
        (JSC::FTL::LowerDFGToLLVM::equalNullOrUndefined):

2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649
2013-05-24  Filip Pizlo  <fpizlo@apple.com>

        fourthTier: FTL should support LogicalNot and Branch on Int32 and Number
        https://bugs.webkit.org/show_bug.cgi?id=116739

        Reviewed by Gavin Barraclough.

        * ftl/FTLCapabilities.cpp:
        (JSC::FTL::canCompile):
        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::compileLogicalNot):
        (JSC::FTL::LowerDFGToLLVM::compileBranch):
        (JSC::FTL::LowerDFGToLLVM::boolify):
        (LowerDFGToLLVM):
        * ftl/FTLOutput.h:
        (JSC::FTL::Output::isZero32):
        (JSC::FTL::Output::notZero32):

2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711