ChangeLog 868 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
2013-09-07  Anders Carlsson  <andersca@apple.com>

        VectorMover should use std::move
        https://bugs.webkit.org/show_bug.cgi?id=120959

        Reviewed by Geoffrey Garen.

        Work around a bug in GCC by changing the type of the callType bitfield 
        in CallLinkInfo to be unsigned instead of CallType.

        * bytecode/CallLinkInfo.h:

13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
2013-09-07  Anders Carlsson  <andersca@apple.com>

        Get rid of FastAllocBase.h
        https://bugs.webkit.org/show_bug.cgi?id=120952

        Reviewed by Antti Koivisto.

        Include FastMalloc.h instead of FastAllocBase.h.

        * assembler/LinkBuffer.h:
        * bytecode/CodeBlock.h:
        * bytecode/StructureStubClearingWatchpoint.h:
        * dfg/DFGFinalizer.h:
        * dfg/DFGLongLivedState.h:
        * dfg/DFGSlowPathGenerator.h:
        * ftl/FTLAbstractHeap.h:
        * heap/JITStubRoutineSet.h:
        * jit/CompactJITCodeMap.h:
        * profiler/ProfilerDatabase.h:
        * profiler/ProfilerExecutionCounter.h:

34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
2013-09-06  Filip Pizlo  <fpizlo@apple.com>

        FTL should support Call/Construct in the worst way possible
        https://bugs.webkit.org/show_bug.cgi?id=120916

        Reviewed by Oliver Hunt.
        
        This adds support for Call/Construct by just calling out to C code that uses
        the JSC::call/JSC::construct runtime functions for making calls. This is slow
        and terrible, but it dramatically extends FTL coverage.
        
        Supporting calls in a meaningful way meant also supporting
        GlobalVarWatchpoint.
        
        The extension of coverage helped to find a bunch of bugs:
        
        - ObjectOrOtherUse was claimed to be supported in the FTL but speculate()
          didn't support it. That means that any node with an ObjectOrOtherUse edge
          that got DCE'd would cause the FTL to ICE.
        
        - There was a bad fall-through compileCompareStrictEq() that led to ICE.
        
        - The OSR exit reconstruction code was assuming it could do fast checks on
          node->child1() before even determining the type of node; that crashes if
          the node is HasVarArgs. Fixed by checking HasVarArgs first.
        
        - The OSR exit compiler was using the wrong peekOffset for CArgumentGetter.
          The default is 1, which assumes that you didn't push anything onto the
          stack after getting called. The OSR exit thunks push FP, so the offset
          should be 2.
        
        This passes stress tests and is probably huge performance regression if you
        --useExperimentalFTL=true. The regression will be fixed in
        https://bugs.webkit.org/show_bug.cgi?id=113621.

        * dfg/DFGOperations.cpp:
        * dfg/DFGOperations.h:
        * ftl/FTLCapabilities.cpp:
        (JSC::FTL::canCompile):
        * ftl/FTLIntrinsicRepository.h:
        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::compileNode):
        (JSC::FTL::LowerDFGToLLVM::compileGlobalVarWatchpoint):
        (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq):
        (JSC::FTL::LowerDFGToLLVM::compileCallOrConstruct):
        (JSC::FTL::LowerDFGToLLVM::speculate):
        (JSC::FTL::LowerDFGToLLVM::speculateObjectOrOther):
        (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode):
        * ftl/FTLOSRExitCompiler.cpp:
        (JSC::FTL::compileStub):

85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
2013-09-06  Filip Pizlo  <fpizlo@apple.com>

        jsc shell should destroy VM as a workaround for LLVM's exit-time destructors
        https://bugs.webkit.org/show_bug.cgi?id=120921

        Reviewed by Oliver Hunt.
        
        LLVM's exit-time destructors will fire when we exit. If there is an on-going
        FTL compile at exit, which will happen if the VM that triggered the compile
        isn't shut down, then we will crash.
        
        We should get rid of LLVM's exit-time destructors. But before we do that, we
        should just do a clean VM shutdown to suppress spurious crashes. This will
        help in expanding LLVM coverage for now.

        * jsc.cpp:
        (jscmain):

103 104 105 106 107 108 109 110 111 112
2013-09-06  Filip Pizlo  <fpizlo@apple.com>

        FTL ArithMod Int32Use doesn't check for negative zero correctly
        https://bugs.webkit.org/show_bug.cgi?id=120905

        Reviewed by Mark Hahnenberg.

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

113 114 115 116 117 118 119 120 121 122
2013-09-06  Filip Pizlo  <fpizlo@apple.com>

        FTL ArithNeg Int32Use doesn't check negative zero
        https://bugs.webkit.org/show_bug.cgi?id=120900

        Reviewed by Mark Hahnenberg.

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

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 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
2013-09-06  Anders Carlsson  <andersca@apple.com>

        Stop using fastNew/fastDelete in JavaScriptCore
        https://bugs.webkit.org/show_bug.cgi?id=120898

        Reviewed by Oliver Hunt.

        Change all the hash table members in ExecState to be OwnPtrs and use
        adoptPtr instead. Also, since none of the hash tables can be null, change their getters
        to return references and propagate the reference types wherever we know that a HashTable can't be null.

        * interpreter/CallFrame.h:
        (JSC::ExecState::arrayConstructorTable):
        (JSC::ExecState::arrayPrototypeTable):
        (JSC::ExecState::booleanPrototypeTable):
        (JSC::ExecState::dataViewTable):
        (JSC::ExecState::dateTable):
        (JSC::ExecState::dateConstructorTable):
        (JSC::ExecState::errorPrototypeTable):
        (JSC::ExecState::globalObjectTable):
        (JSC::ExecState::jsonTable):
        (JSC::ExecState::numberConstructorTable):
        (JSC::ExecState::numberPrototypeTable):
        (JSC::ExecState::objectConstructorTable):
        (JSC::ExecState::privateNamePrototypeTable):
        (JSC::ExecState::regExpTable):
        (JSC::ExecState::regExpConstructorTable):
        (JSC::ExecState::regExpPrototypeTable):
        (JSC::ExecState::stringConstructorTable):
        (JSC::ExecState::promisePrototypeTable):
        (JSC::ExecState::promiseConstructorTable):
        (JSC::ExecState::promiseResolverPrototypeTable):
        * runtime/ClassInfo.h:
        (JSC::ClassInfo::propHashTable):
        * runtime/Lookup.h:
        (JSC::getStaticPropertySlot):
        (JSC::getStaticFunctionSlot):
        (JSC::getStaticValueSlot):
        (JSC::lookupPut):
        * runtime/VM.cpp:
        (JSC::VM::VM):
        (JSC::VM::~VM):
        * runtime/VM.h:

167 168 169 170 171 172 173 174 175 176 177 178
2013-09-06  Filip Pizlo  <fpizlo@apple.com>

        Concurrent FTL causes !hasOptimizedReplacement() asserts in cti_optimize
        https://bugs.webkit.org/show_bug.cgi?id=120890

        Reviewed by Mark Hahnenberg.
        
        Don't install an FTL code block if the DFG code block has already been jettisoned.

        * dfg/DFGToFTLDeferredCompilationCallback.cpp:
        (JSC::DFG::ToFTLDeferredCompilationCallback::compilationDidComplete):

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 213 214 215 216 217 218 219 220 221 222
2013-09-06  Filip Pizlo  <fpizlo@apple.com>

        REGRESSION(149636, merged in 153145): ToThis conversion doesn't work in the DFG
        https://bugs.webkit.org/show_bug.cgi?id=120781

        Reviewed by Mark Hahnenberg.
        
        Roll this back in with a build fix.
        
        - Use some method table hacks to detect if the CheckStructure optimization is
          valid for to_this.
        
        - Introduce a FinalObjectUse and use it for ToThis->Identity conversion.
        
        This looks like it might be perf-neutral on the major benchmarks, but it
        introduces some horrible performance cliffs. For example if you add methods to
        the Array prototype, you'll get horrible performance cliffs. As in virtual calls
        to C++ every time you call a JS function even if it's inlined.
        LongSpider/3d-cube appears to hit this.

        * dfg/DFGAbstractInterpreterInlines.h:
        (JSC::DFG::::executeEffects):
        * dfg/DFGByteCodeParser.cpp:
        (JSC::DFG::ByteCodeParser::parseBlock):
        * dfg/DFGFixupPhase.cpp:
        (JSC::DFG::FixupPhase::fixupNode):
        * dfg/DFGRepatch.cpp:
        (JSC::DFG::emitPutTransitionStub):
        * dfg/DFGSafeToExecute.h:
        (JSC::DFG::SafeToExecuteEdge::operator()):
        * dfg/DFGSpeculativeJIT.cpp:
        (JSC::DFG::SpeculativeJIT::speculateFinalObject):
        (JSC::DFG::SpeculativeJIT::speculate):
        * dfg/DFGSpeculativeJIT.h:
        * dfg/DFGSpeculativeJIT32_64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * dfg/DFGSpeculativeJIT64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * dfg/DFGUseKind.cpp:
        (WTF::printInternal):
        * dfg/DFGUseKind.h:
        (JSC::DFG::typeFilterFor):
        (JSC::DFG::isCell):

223 224 225 226 227 228 229 230 231 232 233 234 235
2013-09-05  Filip Pizlo  <fpizlo@apple.com>

        Introduce a way to run benchmarks and JSRegress as stress tests with different jsc command-line options
        https://bugs.webkit.org/show_bug.cgi?id=120808

        Reviewed by Mark Hahnenberg and rubber stamped by Geoffrey Garen.
        
        Allow --useExperimentalFTL=true even if FTL isn't built since this simplifies
        testing.

        * dfg/DFGTierUpCheckInjectionPhase.cpp:
        (JSC::DFG::TierUpCheckInjectionPhase::run):

236 237 238 239 240 241
2013-09-06  Zan Dobersek  <zdobersek@igalia.com>

        Unreviewed build fix for the GTK port when building with FTL JIT enabled.

        * GNUmakefile.list.am: Add the missing files to the build.

242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
2013-09-05  Oliver Hunt  <oliver@apple.com>

        Make it simpler to introduce new data types to the global object
        https://bugs.webkit.org/show_bug.cgi?id=120801

        Reviewed by Gavin Barraclough.

        Add an iterator macro that lists all the "simple" ES types (e.g. type
        consists of instance, constructor, and prototype classes).  So that
        we don't need to have every new type litter JSGlobalObject.{cpp,h} with
        members, accessors, and manual GC visiting.

        * runtime/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::visitChildren):
        * runtime/JSGlobalObject.h:

258 259 260 261
2013-09-05  Mark Rowe  <mrowe@apple.com>
        
        Roll out r155149 since it broke the build.

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
2013-09-05  Michael Saboff  <msaboff@apple.com>

        Cleanup formatting of byte code debug output
        Source/JavaScriptCore/ChangeLog

        Rubber stamped by Filip Pizlo.

        Put the formatting of the byte code offset and operation into one common function to
        simplify and unify formatting.  Changed CodeBlock::registerName() to return
        "thist" for argument register 0, "argN" for other argument registers and "locN" for
        local registers.

        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::registerName):
        (JSC::CodeBlock::printUnaryOp):
        (JSC::CodeBlock::printBinaryOp):
        (JSC::CodeBlock::printConditionalJump):
        (JSC::CodeBlock::printGetByIdOp):
        (JSC::CodeBlock::printCallOp):
        (JSC::CodeBlock::printPutByIdOp):
        (JSC::CodeBlock::dumpBytecode):
        * bytecode/CodeBlock.h:
        (JSC::CodeBlock::printLocationAndOp):
        (JSC::CodeBlock::printLocationOpAndRegisterOperand):

287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
2013-09-05  Filip Pizlo  <fpizlo@apple.com>

        REGRESSION(149636, merged in 153145): ToThis conversion doesn't work in the DFG
        https://bugs.webkit.org/show_bug.cgi?id=120781

        Reviewed by Mark Hahnenberg.
        
        - Use some method table hacks to detect if the CheckStructure optimization is
          valid for to_this.
        
        - Introduce a FinalObjectUse and use it for ToThis->Identity conversion.
        
        This looks like it might be perf-neutral on the major benchmarks, but it
        introduces some horrible performance cliffs. For example if you add methods to
        the Array prototype, you'll get horrible performance cliffs. As in virtual calls
        to C++ every time you call a JS function even if it's inlined.
        LongSpider/3d-cube appears to hit this.

        * dfg/DFGAbstractInterpreterInlines.h:
        (JSC::DFG::::executeEffects):
        * dfg/DFGByteCodeParser.cpp:
        (JSC::DFG::ByteCodeParser::parseBlock):
        * dfg/DFGFixupPhase.cpp:
        (JSC::DFG::FixupPhase::fixupNode):
        * dfg/DFGSafeToExecute.h:
        (JSC::DFG::SafeToExecuteEdge::operator()):
        * dfg/DFGSpeculativeJIT.cpp:
        (JSC::DFG::SpeculativeJIT::speculateFinalObject):
        (JSC::DFG::SpeculativeJIT::speculate):
        * dfg/DFGSpeculativeJIT.h:
        * dfg/DFGSpeculativeJIT32_64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * dfg/DFGSpeculativeJIT64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * dfg/DFGUseKind.cpp:
        (WTF::printInternal):
        * dfg/DFGUseKind.h:
        (JSC::DFG::typeFilterFor):
        (JSC::DFG::isCell):

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
2013-09-05  Anders Carlsson  <andersca@apple.com>

        GCAssertions.h should use STL type traits and static_assert
        https://bugs.webkit.org/show_bug.cgi?id=120785

        Reviewed by Andreas Kling.

        There's no need to rely on compiler specific support to figure out if a class is trivially destructable,
        we can just use type traits from STL. Do this, fix the assert macro to use static_assert directly and
        rename it from ASSERT_HAS_TRIVIAL_DESTRUCTOR to STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE to clarify that
        it's a static assert and to match the STL nomenclature.
        
        * API/JSCallbackFunction.cpp:
        * debugger/DebuggerActivation.cpp:
        * heap/GCAssertions.h:
        * runtime/ArrayConstructor.cpp:
        * runtime/BooleanConstructor.cpp:
        * runtime/BooleanObject.cpp:
        * runtime/BooleanPrototype.cpp:
        * runtime/DateConstructor.cpp:
        * runtime/ErrorConstructor.cpp:
        * runtime/ErrorInstance.cpp:
        * runtime/ErrorPrototype.cpp:
        * runtime/ExceptionHelpers.cpp:
        * runtime/FunctionConstructor.cpp:
        * runtime/FunctionPrototype.cpp:
        * runtime/GetterSetter.cpp:
        * runtime/InternalFunction.cpp:
        * runtime/JSAPIValueWrapper.cpp:
        * runtime/JSArray.cpp:
        * runtime/JSCell.cpp:
        * runtime/JSNotAnObject.cpp:
        * runtime/JSONObject.cpp:
        * runtime/JSObject.cpp:
        * runtime/JSPromiseConstructor.cpp:
        * runtime/JSPromisePrototype.cpp:
        * runtime/JSPromiseResolverConstructor.cpp:
        * runtime/JSPromiseResolverPrototype.cpp:
        * runtime/JSProxy.cpp:
        * runtime/JSScope.cpp:
        * runtime/JSWrapperObject.cpp:
        * runtime/MathObject.cpp:
        * runtime/NameConstructor.cpp:
        * runtime/NativeErrorConstructor.cpp:
        * runtime/NumberConstructor.cpp:
        * runtime/NumberObject.cpp:
        * runtime/NumberPrototype.cpp:
        * runtime/ObjectConstructor.cpp:
        * runtime/ObjectPrototype.cpp:
        * runtime/RegExpObject.cpp:
        * runtime/StrictEvalActivation.cpp:
        * runtime/StringConstructor.cpp:
        * runtime/StringObject.cpp:
        * runtime/StringPrototype.cpp:

382 383 384 385 386 387 388
2013-09-05  Brent Fulgham  <bfulgham@apple.com>

        [Windows] Unreviewed build fix for DebugSuffix target.

        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: Don't build 64-bit assembly in 32-bit build.
        Also correct 'filters' file so that files appear in categories that match their on-disk locations.

389 390 391 392 393 394 395 396 397 398 399 400 401 402
2013-09-04  Filip Pizlo  <fpizlo@apple.com>

        jsc tests should have timeouts
        https://bugs.webkit.org/show_bug.cgi?id=120725

        Reviewed by Geoffrey Garen.
        
        Add the timeout logic directly to 'jsc' because that's easier to do than
        writing shell/perl code for it.

        * jsc.cpp:
        (timeoutThreadMain):
        (main):

403 404 405 406 407 408 409 410 411 412
2013-09-04  Filip Pizlo  <fpizlo@apple.com>

        fast/js/dfg-* tests should wait for the concurrent JIT
        https://bugs.webkit.org/show_bug.cgi?id=120723

        Reviewed by Geoffrey Garen.
        
        * runtime/TestRunnerUtils.cpp:
        (JSC::numberOfDFGCompiles): This should also handle constructors.

413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
2013-09-04  Filip Pizlo  <fpizlo@apple.com>

        run-fast-jsc should work with new-school fast/js tests that loop until the DFG tiers up
        https://bugs.webkit.org/show_bug.cgi?id=120697

        Reviewed by Mark Hahnenberg.

        * API/JSCTestRunnerUtils.cpp:
        (JSC::numberOfDFGCompiles):
        (JSC::setNeverInline):
        * CMakeLists.txt:
        * GNUmakefile.list.am:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * Target.pri:
        * jsc.cpp:
        (GlobalObject::finishCreation):
        (functionNeverInlineFunction):
        (functionNumberOfDFGCompiles):
        * runtime/TestRunnerUtils.cpp: Added.
        (JSC::getExecutable):
        (JSC::numberOfDFGCompiles):
        (JSC::setNeverInline):
        * runtime/TestRunnerUtils.h: Added.

438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 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
2013-09-04  Mark Lam  <mark.lam@apple.com>

        Renamed StackIterator to StackVisitor.
        https://bugs.webkit.org/show_bug.cgi?id=120706.

        Reviewed by Geoffrey Garen.

        Also did some minor refactoring:
        - Renamed StackIterator::iterate() to StackVisitor::visit().
        - Make StackVisitor::visit() a static method.
        - Move the instantiation of the StackVisitor instance into StackVisitor::visit()
          from CallFrame::iterate().
        - Removed StackIterator::resetIterator() and inline its body into the
          StackVisitor constructor since this is the only remaining caller of it.

        * API/JSContextRef.cpp:
        (BacktraceFunctor::operator()):
        * CMakeLists.txt:
        * GNUmakefile.list.am:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * Target.pri:
        * interpreter/CallFrame.h:
        (JSC::ExecState::iterate):
        * interpreter/Interpreter.cpp:
        (JSC::DumpRegisterFunctor::operator()):
        (JSC::unwindCallFrame):
        (JSC::getStackFrameCodeType):
        (JSC::GetStackTraceFunctor::operator()):
        (JSC::UnwindFunctor::operator()):
        * interpreter/Interpreter.h:
        * interpreter/StackIterator.cpp: Removed.
        * interpreter/StackIterator.h: Removed.
        * interpreter/StackVisitor.cpp: Copied from Source/JavaScriptCore/interpreter/StackIterator.cpp.
        (JSC::StackVisitor::StackVisitor):
        (JSC::StackVisitor::gotoNextFrame):
        (JSC::StackVisitor::readFrame):
        (JSC::StackVisitor::readNonInlinedFrame):
        (JSC::StackVisitor::readInlinedFrame):
        (JSC::StackVisitor::Frame::codeType):
        (JSC::StackVisitor::Frame::functionName):
        (JSC::StackVisitor::Frame::sourceURL):
        (JSC::StackVisitor::Frame::toString):
        (JSC::StackVisitor::Frame::arguments):
        (JSC::StackVisitor::Frame::computeLineAndColumn):
        (JSC::StackVisitor::Frame::retrieveExpressionInfo):
        (JSC::StackVisitor::Frame::setToEnd):
        (JSC::StackVisitor::Frame::print):
        (DebugPrintFrameFunctor::operator()):
        * interpreter/StackVisitor.h: Copied from Source/JavaScriptCore/interpreter/StackIterator.h.
        (JSC::StackVisitor::visit):
        * jsc.cpp:
        (FunctionJSCStackFunctor::operator()):
        * profiler/ProfileGenerator.cpp:
        (JSC::AddParentForConsoleStartFunctor::operator()):
        * runtime/JSFunction.cpp:
        (JSC::RetrieveArgumentsFunctor::operator()):
        (JSC::RetrieveCallerFunctionFunctor::operator()):
        * runtime/JSGlobalObjectFunctions.cpp:
        (JSC::GlobalFuncProtoGetterFunctor::operator()):
        (JSC::GlobalFuncProtoSetterFunctor::operator()):
        * runtime/ObjectConstructor.cpp:
        (JSC::ObjectConstructorGetPrototypeOfFunctor::operator()):

503 504 505 506 507 508 509
2013-09-04  Roger Fong  <roger_fong@apple.com>

        Unreviewed Build fix for Windows DebugSuffix configuration.

        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:

510 511 512 513 514 515 516 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 551 552
2013-09-04  Mark Lam  <mark.lam@apple.com>

        Refining the StackIterator callback interface.
        https://bugs.webkit.org/show_bug.cgi?id=120695.

        Reviewed by Geoffrey Garen.

        Introduce CallFrame::iterate() which instantiates a StackIterator and
        invoke its iterate() method with the passed in functor. The only place
        where the client code gets access to the StackIterator now is as an
        argument to the client's functor.

        * API/JSContextRef.cpp:
        (JSContextCreateBacktrace):
        * interpreter/CallFrame.cpp:
        * interpreter/CallFrame.h:
        (JSC::ExecState::iterate):
        * interpreter/Interpreter.cpp:
        (JSC::Interpreter::dumpRegisters):
        (JSC::Interpreter::getStackTrace):
        (JSC::Interpreter::unwind):
        * interpreter/StackIterator.cpp:
        (JSC::StackIterator::StackIterator):
        (DebugPrintFrameFunctor::DebugPrintFrameFunctor):
        (DebugPrintFrameFunctor::operator()):
        (debugPrintCallFrame):
        (debugPrintStack):
        * interpreter/StackIterator.h:
        (JSC::StackIterator::iterate):
        * jsc.cpp:
        (functionJSCStack):
        * profiler/ProfileGenerator.cpp:
        (JSC::ProfileGenerator::addParentForConsoleStart):
        * runtime/JSFunction.cpp:
        (JSC::retrieveArguments):
        (JSC::RetrieveCallerFunctionFunctor::operator()):
        (JSC::retrieveCallerFunction):
        * runtime/JSGlobalObjectFunctions.cpp:
        (JSC::globalFuncProtoGetter):
        (JSC::globalFuncProtoSetter):
        * runtime/ObjectConstructor.cpp:
        (JSC::objectConstructorGetPrototypeOf):

553 554 555 556 557 558 559 560 561
2013-09-04  Benjamin Poulain  <benjamin@webkit.org>

        JSGenericTypedArrayViewConstructor.h is referenced twice in the XCode project build section, causing warnings
        https://bugs.webkit.org/show_bug.cgi?id=120698

        Reviewed by Darin Adler.

        * JavaScriptCore.xcodeproj/project.pbxproj:

562 563 564 565 566 567 568 569 570 571 572 573 574 575 576
2013-09-04  Mark Hahnenberg  <mhahnenberg@apple.com>

        ASSERT in MarkedAllocator::allocateSlowCase is wrong
        https://bugs.webkit.org/show_bug.cgi?id=120639

        Reviewed by Oliver Hunt.

        ASSERT(!m_heap->shouldCollect()) is no longer true due to our use of the GC 
        deferral mechanism. We could technically be beyond our byte allocation limit, 
        but still not try to collect due to deferral. This patch amends shouldCollect() 
        to return false if GC is currently deferred.

        * heap/Heap.h:
        (JSC::Heap::shouldCollect):

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 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 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
2013-09-03  Filip Pizlo  <fpizlo@apple.com>

        The DFG should be able to tier-up and OSR enter into the FTL
        https://bugs.webkit.org/show_bug.cgi?id=112838

        Reviewed by Mark Hahnenberg.
        
        This adds the ability for the DFG to tier-up into the FTL. This works in both
        of the expected tier-up modes:
        
        Replacement: frequently called functions eventually have their entrypoint
        replaced with one that goes into FTL-compiled code. Note, this will be a
        slow-down for now since we don't yet have LLVM calling convention integration.
        
        OSR entry: code stuck in hot loops gets OSR'd into the FTL from the DFG.
        
        This means that if the DFG detects that a function is an FTL candidate, it
        inserts execution counting code similar to the kind that the baseline JIT
        would use. If you trip on a loop count in a loop header that is an OSR
        candidate (it's not an inlined loop), we do OSR; otherwise we do replacement.
        OSR almost always also implies future replacement.
        
        OSR entry into the FTL is really cool. It uses a specialized FTL compile of
        the code, where early in the DFG pipeline we replace the original root block
        with an OSR entrypoint block that jumps to the pre-header of the hot loop.
        The OSR entrypoint loads all live state at the loop pre-header using loads
        from a scratch buffer, which gets populated by the runtime's OSR entry
        preparation code (FTL::prepareOSREntry()). This approach appears to work well
        with all of our subsequent optimizations, including prediction propagation,
        CFA, and LICM. LLVM seems happy with it, too. Best of all, it works naturally
        with concurrent compilation: when we hit the tier-up trigger we spawn a
        compilation plan at the bytecode index from which we triggered; once the
        compilation finishes the next trigger will try to enter, at that bytecode
        index. If it can't - for example because the code has moved on to another
        loop - then we just try again. Loops that get hot enough for OSR entry (about
        25,000 iterations) will probably still be running when a concurrent compile
        finishes, so this doesn't appear to be a big problem.
        
        This immediately gives us a 70% speed-up on imaging-gaussian-blur. We could
        get a bigger speed-up by adding some more intelligence and tweaking LLVM to
        compile code faster. Those things will happen eventually but this is a good
        start. Probably this code will see more tuning as we get more coverage in the
        FTL JIT, but I'll worry about that in future patches.

        * CMakeLists.txt:
        * GNUmakefile.list.am:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * Target.pri:
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::CodeBlock):
        (JSC::CodeBlock::hasOptimizedReplacement):
        (JSC::CodeBlock::setOptimizationThresholdBasedOnCompilationResult):
        * bytecode/CodeBlock.h:
        * dfg/DFGAbstractInterpreterInlines.h:
        (JSC::DFG::::executeEffects):
        * dfg/DFGByteCodeParser.cpp:
        (JSC::DFG::ByteCodeParser::parseBlock):
        (JSC::DFG::ByteCodeParser::parse):
        * dfg/DFGCFGSimplificationPhase.cpp:
        (JSC::DFG::CFGSimplificationPhase::run):
        * dfg/DFGClobberize.h:
        (JSC::DFG::clobberize):
        * dfg/DFGDriver.cpp:
        (JSC::DFG::compileImpl):
        (JSC::DFG::compile):
        * dfg/DFGDriver.h:
        * dfg/DFGFixupPhase.cpp:
        (JSC::DFG::FixupPhase::fixupNode):
        * dfg/DFGGraph.cpp:
        (JSC::DFG::Graph::dump):
        (JSC::DFG::Graph::killBlockAndItsContents):
        (JSC::DFG::Graph::killUnreachableBlocks):
        * dfg/DFGGraph.h:
        * dfg/DFGInPlaceAbstractState.cpp:
        (JSC::DFG::InPlaceAbstractState::initialize):
        * dfg/DFGJITCode.cpp:
        (JSC::DFG::JITCode::reconstruct):
        (JSC::DFG::JITCode::checkIfOptimizationThresholdReached):
        (JSC::DFG::JITCode::optimizeNextInvocation):
        (JSC::DFG::JITCode::dontOptimizeAnytimeSoon):
        (JSC::DFG::JITCode::optimizeAfterWarmUp):
        (JSC::DFG::JITCode::optimizeSoon):
        (JSC::DFG::JITCode::forceOptimizationSlowPathConcurrently):
        (JSC::DFG::JITCode::setOptimizationThresholdBasedOnCompilationResult):
        * dfg/DFGJITCode.h:
        * dfg/DFGJITFinalizer.cpp:
        (JSC::DFG::JITFinalizer::finalize):
        (JSC::DFG::JITFinalizer::finalizeFunction):
        (JSC::DFG::JITFinalizer::finalizeCommon):
        * dfg/DFGLoopPreHeaderCreationPhase.cpp:
        (JSC::DFG::createPreHeader):
        (JSC::DFG::LoopPreHeaderCreationPhase::run):
        * dfg/DFGLoopPreHeaderCreationPhase.h:
        * dfg/DFGNode.h:
        (JSC::DFG::Node::hasUnlinkedLocal):
        (JSC::DFG::Node::unlinkedLocal):
        * dfg/DFGNodeType.h:
        * dfg/DFGOSREntry.cpp:
        (JSC::DFG::prepareOSREntry):
        * dfg/DFGOSREntrypointCreationPhase.cpp: Added.
        (JSC::DFG::OSREntrypointCreationPhase::OSREntrypointCreationPhase):
        (JSC::DFG::OSREntrypointCreationPhase::run):
        (JSC::DFG::performOSREntrypointCreation):
        * dfg/DFGOSREntrypointCreationPhase.h: Added.
        * dfg/DFGOperations.cpp:
        * dfg/DFGOperations.h:
        * dfg/DFGPlan.cpp:
        (JSC::DFG::Plan::Plan):
        (JSC::DFG::Plan::compileInThread):
        (JSC::DFG::Plan::compileInThreadImpl):
        * dfg/DFGPlan.h:
        * dfg/DFGPredictionInjectionPhase.cpp:
        (JSC::DFG::PredictionInjectionPhase::run):
        * dfg/DFGPredictionPropagationPhase.cpp:
        (JSC::DFG::PredictionPropagationPhase::propagate):
        * dfg/DFGSafeToExecute.h:
        (JSC::DFG::safeToExecute):
        * dfg/DFGSpeculativeJIT32_64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * dfg/DFGSpeculativeJIT64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * dfg/DFGTierUpCheckInjectionPhase.cpp: Added.
        (JSC::DFG::TierUpCheckInjectionPhase::TierUpCheckInjectionPhase):
        (JSC::DFG::TierUpCheckInjectionPhase::run):
        (JSC::DFG::performTierUpCheckInjection):
        * dfg/DFGTierUpCheckInjectionPhase.h: Added.
        * dfg/DFGToFTLDeferredCompilationCallback.cpp: Added.
        (JSC::DFG::ToFTLDeferredCompilationCallback::ToFTLDeferredCompilationCallback):
        (JSC::DFG::ToFTLDeferredCompilationCallback::~ToFTLDeferredCompilationCallback):
        (JSC::DFG::ToFTLDeferredCompilationCallback::create):
        (JSC::DFG::ToFTLDeferredCompilationCallback::compilationDidBecomeReadyAsynchronously):
        (JSC::DFG::ToFTLDeferredCompilationCallback::compilationDidComplete):
        * dfg/DFGToFTLDeferredCompilationCallback.h: Added.
        * dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp: Added.
        (JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::ToFTLForOSREntryDeferredCompilationCallback):
        (JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::~ToFTLForOSREntryDeferredCompilationCallback):
        (JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::create):
        (JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::compilationDidBecomeReadyAsynchronously):
        (JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::compilationDidComplete):
        * dfg/DFGToFTLForOSREntryDeferredCompilationCallback.h: Added.
        * dfg/DFGWorklist.cpp:
        (JSC::DFG::globalWorklist):
        * dfg/DFGWorklist.h:
        * ftl/FTLCapabilities.cpp:
        (JSC::FTL::canCompile):
        * ftl/FTLCapabilities.h:
        * ftl/FTLForOSREntryJITCode.cpp: Added.
        (JSC::FTL::ForOSREntryJITCode::ForOSREntryJITCode):
        (JSC::FTL::ForOSREntryJITCode::~ForOSREntryJITCode):
        (JSC::FTL::ForOSREntryJITCode::ftlForOSREntry):
        (JSC::FTL::ForOSREntryJITCode::initializeEntryBuffer):
        * ftl/FTLForOSREntryJITCode.h: Added.
        (JSC::FTL::ForOSREntryJITCode::entryBuffer):
        (JSC::FTL::ForOSREntryJITCode::setBytecodeIndex):
        (JSC::FTL::ForOSREntryJITCode::bytecodeIndex):
        (JSC::FTL::ForOSREntryJITCode::countEntryFailure):
        (JSC::FTL::ForOSREntryJITCode::entryFailureCount):
        * ftl/FTLJITFinalizer.cpp:
        (JSC::FTL::JITFinalizer::finalizeFunction):
        * ftl/FTLLink.cpp:
        (JSC::FTL::link):
        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::compileBlock):
        (JSC::FTL::LowerDFGToLLVM::compileNode):
        (JSC::FTL::LowerDFGToLLVM::compileExtractOSREntryLocal):
        (JSC::FTL::LowerDFGToLLVM::compileGetLocal):
        (JSC::FTL::LowerDFGToLLVM::addWeakReference):
        * ftl/FTLOSREntry.cpp: Added.
        (JSC::FTL::prepareOSREntry):
        * ftl/FTLOSREntry.h: Added.
        * ftl/FTLOutput.h:
        (JSC::FTL::Output::crashNonTerminal):
        (JSC::FTL::Output::crash):
        * ftl/FTLState.cpp:
        (JSC::FTL::State::State):
        * interpreter/Register.h:
        (JSC::Register::unboxedDouble):
        * jit/JIT.cpp:
        (JSC::JIT::emitEnterOptimizationCheck):
        * jit/JITCode.cpp:
        (JSC::JITCode::ftlForOSREntry):
        * jit/JITCode.h:
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):
        * runtime/Executable.cpp:
        (JSC::ScriptExecutable::newReplacementCodeBlockFor):
        * runtime/Options.h:
        * runtime/VM.cpp:
        (JSC::VM::ensureWorklist):
        * runtime/VM.h:

768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787
2013-09-03  Filip Pizlo  <fpizlo@apple.com>

        CodeBlock memory cost reporting should be rationalized
        https://bugs.webkit.org/show_bug.cgi?id=120615

        Reviewed by Darin Adler.
        
        Report the size of the instruction stream, and then remind the GC that we're
        using memory when we trace.
        
        This is a slight slow-down on some JSBench tests because it makes us GC a
        bit more frequently. But I think it's well worth it; if we really want those
        tests to GC less frequently then we can achieve that through other kinds of
        tuning. It's better that the GC knows that CodeBlocks do in fact use memory;
        what it does with that information is a somewhat orthogonal question.

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

788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 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 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858
2013-09-03  Mark Lam  <mark.lam@apple.com>

        Converting StackIterator to a callback interface.
        https://bugs.webkit.org/show_bug.cgi?id=120564.

        Reviewed by Filip Pizlo.

        * API/JSContextRef.cpp:
        (BacktraceFunctor::BacktraceFunctor):
        (BacktraceFunctor::operator()):
        (JSContextCreateBacktrace):
        * interpreter/CallFrame.cpp:
        * interpreter/CallFrame.h:
        * interpreter/Interpreter.cpp:
        (JSC::DumpRegisterFunctor::DumpRegisterFunctor):
        (JSC::DumpRegisterFunctor::operator()):
        (JSC::Interpreter::dumpRegisters):
        (JSC::unwindCallFrame):
        (JSC::GetStackTraceFunctor::GetStackTraceFunctor):
        (JSC::GetStackTraceFunctor::operator()):
        (JSC::Interpreter::getStackTrace):
        (JSC::Interpreter::stackTraceAsString):
        (JSC::UnwindFunctor::UnwindFunctor):
        (JSC::UnwindFunctor::operator()):
        (JSC::Interpreter::unwind):
        * interpreter/Interpreter.h:
        * interpreter/StackIterator.cpp:
        (JSC::StackIterator::numberOfFrames):
        (JSC::StackIterator::gotoFrameAtIndex):
        (JSC::StackIterator::gotoNextFrameWithFilter):
        (JSC::StackIterator::resetIterator):
        (JSC::StackIterator::Frame::print):
        (debugPrintCallFrame):
        (DebugPrintStackFunctor::operator()):
        (debugPrintStack): Added for debugging convenience.
        * interpreter/StackIterator.h:
        (JSC::StackIterator::Frame::index):
        (JSC::StackIterator::iterate):
        * jsc.cpp:
        (FunctionJSCStackFunctor::FunctionJSCStackFunctor):
        (FunctionJSCStackFunctor::operator()):
        (functionJSCStack):
        * profiler/ProfileGenerator.cpp:
        (JSC::AddParentForConsoleStartFunctor::AddParentForConsoleStartFunctor):
        (JSC::AddParentForConsoleStartFunctor::foundParent):
        (JSC::AddParentForConsoleStartFunctor::operator()):
        (JSC::ProfileGenerator::addParentForConsoleStart):
        * runtime/JSFunction.cpp:
        (JSC::RetrieveArgumentsFunctor::RetrieveArgumentsFunctor):
        (JSC::RetrieveArgumentsFunctor::result):
        (JSC::RetrieveArgumentsFunctor::operator()):
        (JSC::retrieveArguments):
        (JSC::RetrieveCallerFunctionFunctor::RetrieveCallerFunctionFunctor):
        (JSC::RetrieveCallerFunctionFunctor::result):
        (JSC::RetrieveCallerFunctionFunctor::operator()):
        (JSC::retrieveCallerFunction):
        * runtime/JSGlobalObjectFunctions.cpp:
        (JSC::GlobalFuncProtoGetterFunctor::GlobalFuncProtoGetterFunctor):
        (JSC::GlobalFuncProtoGetterFunctor::result):
        (JSC::GlobalFuncProtoGetterFunctor::operator()):
        (JSC::globalFuncProtoGetter):
        (JSC::GlobalFuncProtoSetterFunctor::GlobalFuncProtoSetterFunctor):
        (JSC::GlobalFuncProtoSetterFunctor::allowsAccess):
        (JSC::GlobalFuncProtoSetterFunctor::operator()):
        (JSC::globalFuncProtoSetter):
        * runtime/ObjectConstructor.cpp:
        (JSC::ObjectConstructorGetPrototypeOfFunctor::ObjectConstructorGetPrototypeOfFunctor):
        (JSC::ObjectConstructorGetPrototypeOfFunctor::result):
        (JSC::ObjectConstructorGetPrototypeOfFunctor::operator()):
        (JSC::objectConstructorGetPrototypeOf):

859 860 861 862 863 864 865 866 867 868 869 870 871 872
2013-09-03  Oliver Hunt  <oliver@apple.com>

        Support structured clone of Map and Set
        https://bugs.webkit.org/show_bug.cgi?id=120654

        Reviewed by Simon Fraser.

        Make xcode copy the required headers, and add appropriate export attributes

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * runtime/JSMap.h:
        * runtime/JSSet.h:
        * runtime/MapData.h:

873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888
2013-09-02  Ryosuke Niwa  <rniwa@webkit.org>

        Support the "json" responseType and JSON response entity in XHR
        https://bugs.webkit.org/show_bug.cgi?id=73648

        Reviewed by Oliver Hunt.

        Based on the patch written by Jarred Nicholls.

        Add JSC::JSONParse. This function will be used in XMLHttpRequest.response of type 'json'.

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * runtime/JSONObject.cpp:
        (JSC::JSONParse):
        * runtime/JSONObject.h:

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
2013-09-02  Filip Pizlo  <fpizlo@apple.com>

        CodeBlock::jettison() should be implicit
        https://bugs.webkit.org/show_bug.cgi?id=120567

        Reviewed by Oliver Hunt.
        
        This is a risky change from a performance standpoint, but I believe it's
        necessary. This makes all CodeBlocks get swept by GC. Nobody but the GC
        can delete CodeBlocks because the GC always holds a reference to them.
        Once a CodeBlock reaches just one reference (i.e. the one from the GC)
        then the GC will free it only if it's not on the stack.
        
        This allows me to get rid of the jettisoning logic. We need this for FTL
        tier-up. Well; we don't need it, but it will help prevent a lot of bugs.
        Previously, if you wanted to to replace one code block with another, you
        had to remember to tell the GC that the previous code block is
        "jettisoned". We would need to do this when tiering up from DFG to FTL
        and when dealing with DFG-to-FTL OSR entry code blocks. There are a lot
        of permutations here - tiering up to the FTL, OSR entering into the FTL,
        deciding that an OSR entry code block is not relevant anymore - just to
        name a few. In each of these cases we'd have to jettison the previous
        code block. It smells like a huge source of future bugs.
        
        So I made jettisoning implicit by making the GC always watch out for a
        CodeBlock being owned solely by the GC.
        
        This change is performance neutral.

        * CMakeLists.txt:
        * GNUmakefile.list.am:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * Target.pri:
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::CodeBlock):
        (JSC::CodeBlock::~CodeBlock):
        (JSC::CodeBlock::visitAggregate):
        (JSC::CodeBlock::jettison):
        * bytecode/CodeBlock.h:
        (JSC::CodeBlock::setJITCode):
        (JSC::CodeBlock::shouldImmediatelyAssumeLivenessDuringScan):
        (JSC::CodeBlockSet::mark):
        * dfg/DFGCommonData.h:
        (JSC::DFG::CommonData::CommonData):
        * heap/CodeBlockSet.cpp: Added.
        (JSC::CodeBlockSet::CodeBlockSet):
        (JSC::CodeBlockSet::~CodeBlockSet):
        (JSC::CodeBlockSet::add):
        (JSC::CodeBlockSet::clearMarks):
        (JSC::CodeBlockSet::deleteUnmarkedAndUnreferenced):
        (JSC::CodeBlockSet::traceMarked):
        * heap/CodeBlockSet.h: Added.
        * heap/ConservativeRoots.cpp:
        (JSC::ConservativeRoots::add):
        * heap/ConservativeRoots.h:
        * heap/DFGCodeBlocks.cpp: Removed.
        * heap/DFGCodeBlocks.h: Removed.
        * heap/Heap.cpp:
        (JSC::Heap::markRoots):
        (JSC::Heap::deleteAllCompiledCode):
        (JSC::Heap::deleteUnmarkedCompiledCode):
        * heap/Heap.h:
        * interpreter/JSStack.cpp:
        (JSC::JSStack::gatherConservativeRoots):
        * interpreter/JSStack.h:
        * runtime/Executable.cpp:
        (JSC::ScriptExecutable::installCode):
        * runtime/Executable.h:
        * runtime/VM.h:

960 961 962 963 964 965 966 967 968 969
2013-09-02  Darin Adler  <darin@apple.com>

        [Mac] No need for HardAutorelease, which is same as CFBridgingRelease
        https://bugs.webkit.org/show_bug.cgi?id=120569

        Reviewed by Andy Estes.

        * API/JSValue.mm:
        (valueToString): Use CFBridgingRelease.

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
2013-08-30  Filip Pizlo  <fpizlo@apple.com>

        CodeBlock refactoring broke profile dumping
        https://bugs.webkit.org/show_bug.cgi?id=120551

        Reviewed by Michael Saboff.
        
        Fix the bug, and did a big clean-up of how Executable returns CodeBlocks. A lot
        of the problems we have with code like CodeBlock::baselineVersion() is that we
        were trying *way too hard* to side-step the fact that Executable can't return a
        CodeBlock*. Previously it could only return CodeBlock&, so if it didn't have a
        CodeBlock yet, you were screwed. And if you didn't know, or weren't sure, if it
        did have a CodeBlock, you were really going to have a bad time. Also it really
        bugs me that the methods were called generatedBytecode(). In all other contexts
        if you ask for a CodeBlock, then method to call is codeBlock(). So I made all
        of those changes.

        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::baselineVersion):
        (JSC::ProgramCodeBlock::replacement):
        (JSC::EvalCodeBlock::replacement):
        (JSC::FunctionCodeBlock::replacement):
        (JSC::CodeBlock::globalObjectFor):
        * bytecode/CodeOrigin.cpp:
        (JSC::InlineCallFrame::hash):
        * dfg/DFGOperations.cpp:
        * interpreter/Interpreter.cpp:
        (JSC::Interpreter::execute):
        (JSC::Interpreter::executeCall):
        (JSC::Interpreter::executeConstruct):
        (JSC::Interpreter::prepareForRepeatCall):
        * jit/JITCode.h:
        (JSC::JITCode::isExecutableScript):
        (JSC::JITCode::isLowerTier):
        * jit/JITStubs.cpp:
        (JSC::lazyLinkFor):
        (JSC::DEFINE_STUB_FUNCTION):
        * llint/LLIntSlowPaths.cpp:
        (JSC::LLInt::traceFunctionPrologue):
        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
        (JSC::LLInt::setUpCall):
        * runtime/ArrayPrototype.cpp:
        (JSC::isNumericCompareFunction):
        * runtime/CommonSlowPaths.h:
        (JSC::CommonSlowPaths::arityCheckFor):
        * runtime/Executable.cpp:
        (JSC::ScriptExecutable::installCode):
        * runtime/Executable.h:
        (JSC::EvalExecutable::codeBlock):
        (JSC::ProgramExecutable::codeBlock):
        (JSC::FunctionExecutable::eitherCodeBlock):
        (JSC::FunctionExecutable::codeBlockForCall):
        (JSC::FunctionExecutable::codeBlockForConstruct):
        (JSC::FunctionExecutable::codeBlockFor):
        * runtime/FunctionExecutableDump.cpp:
        (JSC::FunctionExecutableDump::dump):

oliver@apple.com's avatar
oliver@apple.com committed
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 1074 1075
2013-08-30  Oliver Hunt  <oliver@apple.com>

        Implement ES6 Set class
        https://bugs.webkit.org/show_bug.cgi?id=120549

        Reviewed by Filip Pizlo.

        We simply reuse the MapData type from JSMap making the
        it much simpler.

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * runtime/CommonIdentifiers.h:
        * runtime/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::reset):
        (JSC::JSGlobalObject::visitChildren):
        * runtime/JSGlobalObject.h:
        (JSC::JSGlobalObject::setStructure):
        * runtime/JSSet.cpp: Added.
        (JSC::JSSet::visitChildren):
        (JSC::JSSet::finishCreation):
        * runtime/JSSet.h: Added.
        (JSC::JSSet::createStructure):
        (JSC::JSSet::create):
        (JSC::JSSet::mapData):
        (JSC::JSSet::JSSet):
        * runtime/SetConstructor.cpp: Added.
        (JSC::SetConstructor::finishCreation):
        (JSC::callSet):
        (JSC::constructSet):
        (JSC::SetConstructor::getConstructData):
        (JSC::SetConstructor::getCallData):
        * runtime/SetConstructor.h: Added.
        (JSC::SetConstructor::create):
        (JSC::SetConstructor::createStructure):
        (JSC::SetConstructor::SetConstructor):
        * runtime/SetPrototype.cpp: Added.
        (JSC::SetPrototype::finishCreation):
        (JSC::getMapData):
        (JSC::setProtoFuncAdd):
        (JSC::setProtoFuncClear):
        (JSC::setProtoFuncDelete):
        (JSC::setProtoFuncForEach):
        (JSC::setProtoFuncHas):
        (JSC::setProtoFuncSize):
        * runtime/SetPrototype.h: Added.
        (JSC::SetPrototype::create):
        (JSC::SetPrototype::createStructure):
        (JSC::SetPrototype::SetPrototype):

1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099
2013-08-30  Oliver Hunt  <oliver@apple.com>

        Make JSValue bool conversion less dangerous
        https://bugs.webkit.org/show_bug.cgi?id=120505

        Reviewed by Darin Adler.

        Replaces JSValue::operator bool() with a operator UnspecifiedBoolType* as
        we do elsewhere.  Then fix the places where terrible type coercion was
        happening.  All of the changes made had no fundamental behavioural impact
        as they were coercion results that were ignored (returning undefined 
        after an exception).  

        * dfg/DFGOperations.cpp:
        * interpreter/CallFrame.h:
        (JSC::ExecState::hadException):
        * runtime/JSCJSValue.h:
        * runtime/JSCJSValueInlines.h:
        (JSC::JSValue::operator UnspecifiedBoolType*):
        * runtime/JSGlobalObjectFunctions.cpp:
        (JSC::globalFuncEval):
        * runtime/PropertyDescriptor.cpp:
        (JSC::PropertyDescriptor::equalTo)

1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112
2013-08-30  Chris Curtis  <chris_curtis@apple.com>

        Cleaning errorDescriptionForValue after r154839
        https://bugs.webkit.org/show_bug.cgi?id=120531
        
        Reviewed by Darin Adler.
        
        Changed the assert to ASSERT_NOT_REACHED, now that r154839 has landed. errorDescriptionForValue 
        can assert again that the parameterized JSValue is !isEmpty().
        
        * runtime/ExceptionHelpers.cpp:
        (JSC::errorDescriptionForValue):

1113 1114 1115 1116 1117 1118 1119 1120 1121
2013-08-30  Antti Koivisto  <antti@apple.com>

        Remove code behind ENABLE(DIALOG_ELEMENT)
        https://bugs.webkit.org/show_bug.cgi?id=120467

        Reviewed by Darin Adler.

        * Configurations/FeatureDefines.xcconfig:

akling@apple.com's avatar
akling@apple.com committed
1122 1123 1124 1125 1126 1127
2013-08-29  Andreas Kling  <akling@apple.com>

        De-bork Qt build.

        * Target.pri:

1128 1129 1130 1131 1132 1133 1134
2013-08-29  Ryuan Choi  <ryuan.choi@samsung.com>

        Unreviewed build fix attempt for Windows.

        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        Renamed JSMapConstructor and JSMapPrototype.

1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150
2013-08-29  Ryuan Choi  <ryuan.choi@samsung.com>

        Fix build break after r154861
        https://bugs.webkit.org/show_bug.cgi?id=120503

        Reviewed by Geoffrey Garen.

        Unreviewed build fix attempt for GTK, Qt Windows and CMake based ports.

        * CMakeLists.txt:
        * GNUmakefile.list.am:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
        * Target.pri:
        * runtime/MapData.h:
        (JSC::MapData::KeyType::KeyType):

1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166
2013-08-29  Andreas Kling  <akling@apple.com>

        CodeBlock: LLIntCallLinkInfo vector can be sized-to-fit at creation.
        <https://webkit.org/b/120487>

        Reviewed by Oliver Hunt.

        CodeBlock::m_llintCallLinkInfos never changes size after creation, so make it a Vector
        instead of a SegmentedVector. Use resizeToFit() instead of grow() since we know the
        exact amount of space needed.

        * bytecode/CodeBlock.h:
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::CodeBlock):
        (JSC::CodeBlock::shrinkToFit):

1167 1168 1169 1170 1171 1172 1173
2013-08-29  Oliver Hunt  <oliver@apple.com>

        Fix issues found by MSVC (which also happily fixes an unintentional pessimisation)

        * runtime/MapData.h:
        (JSC::MapData::KeyType::KeyType):

oliver@apple.com's avatar
oliver@apple.com committed
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
2013-08-29  Oliver Hunt  <oliver@apple.com>


        Implement ES6 Map object
        https://bugs.webkit.org/show_bug.cgi?id=120333

        Reviewed by Geoffrey Garen.

        Implement support for the ES6 Map type and related classes.

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * heap/CopyToken.h: Add a new token to track copying the backing store
        * runtime/CommonIdentifiers.h: Add new identifiers
        * runtime/JSGlobalObject.cpp:
        * runtime/JSGlobalObject.h:
            Add new structures and prototypes

        * runtime/JSMap.cpp: Added.
        * runtime/JSMap.h: Added.
            New JSMap class to represent a Map instance

        * runtime/MapConstructor.cpp: Added.
        * runtime/MapConstructor.h: Added.
            The Map constructor

        * runtime/MapData.cpp: Added.
        * runtime/MapData.h: Added.
            The most interesting data structure.  The roughly corresponds
            to the ES6 notion of MapData.  It provides the core JSValue->JSValue
            map implementation.  We implement it using 2 hashtables and a flat
            table.  Due to the different semantics of string comparisons vs.
            all others we need have one map keyed by String and the other by
            generic JSValue.  The actual table is represented more or less
            exactly as described in the ES6 draft - a single contiguous list of
            key/value pairs.  The entire map could be achieved with just this
            table, however we need the HashMaps in order to maintain O(1) lookup.

            Deleted values are simply cleared as the draft says, however the
            implementation compacts the storage on copy as long as the are no
            active iterators.

        * runtime/MapPrototype.cpp: Added.
        * runtime/MapPrototype.h: Added.
            Implement Map prototype functions

        * runtime/VM.cpp:
            Add new structures.

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 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299
2013-08-29  Filip Pizlo  <fpizlo@apple.com>

        Teach DFG::Worklist and its clients that it may be reused for different kinds of compilations
        https://bugs.webkit.org/show_bug.cgi?id=120489

        Reviewed by Geoffrey Garen.
        
        If the baseline JIT hits an OSR entry trigger into the DFG and we already have a
        DFG compilation but we've also started one or more FTL compilations, then we
        shouldn't get confused. Previously we would have gotten confused because we would
        see an in-process deferred compile (the FTL compile) and also an optimized
        replacement (the DFG code).
        
        If the baseline JIT hits an OSR entry trigger into the DFG and we previously
        did two things in this order: triggered a tier-up compilation from the DFG into
        the FTL, and then jettisoned the DFG code because it exited a bunch, then we
        shouldn't be confused by the presence of an in-process deferred compile (the FTL
        compile). Previously we would have waited for that compile to finish; but the more
        sensible thing to do is to let it complete and then invalidate it, while at the
        same time enqueueing a DFG compile to create a new, more valid, DFG code block.
        
        If the DFG JIT hits a loop OSR entry trigger (into the FTL) and it has already
        triggered an FTL compile for replacement, then it should fire off a second compile
        instead of thinking that it can wait for that one to finish. Or vice-versa. We
        need to allow for two FTL compiles to be enqueued at the same time (one for
        replacement and one for OSR entry in a loop).
        
        Then there's also the problem that DFG::compile() is almost certainly going to be
        the hook for triggering both DFG compiles and the two kinds of FTL compiles, but
        right now there is no way to tell it which one you want.
        
        This fixes these problems and removes a bunch of potential confusion by making the
        key for a compile in the DFG::Worklist be a CompilationMode (one of DFGMode,
        FTLMode, or FTLForOSREntryMode). That mode is also passed to DFG::compile().
        
        Awkwardly, this still leaves us in a no DFG->FTL tier-up situation - so
        DFG::compile() is always passed DFGMode and then it might do an FTL compile if
        possible. Fixing that is a bigger issue for a later changeset.

        * CMakeLists.txt:
        * GNUmakefile.list.am:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * Target.pri:
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::checkIfOptimizationThresholdReached):
        * dfg/DFGCompilationKey.cpp: Added.
        (JSC::DFG::CompilationKey::dump):
        * dfg/DFGCompilationKey.h: Added.
        (JSC::DFG::CompilationKey::CompilationKey):
        (JSC::DFG::CompilationKey::operator!):
        (JSC::DFG::CompilationKey::isHashTableDeletedValue):
        (JSC::DFG::CompilationKey::profiledBlock):
        (JSC::DFG::CompilationKey::mode):
        (JSC::DFG::CompilationKey::operator==):
        (JSC::DFG::CompilationKey::hash):
        (JSC::DFG::CompilationKeyHash::hash):
        (JSC::DFG::CompilationKeyHash::equal):
        * dfg/DFGCompilationMode.cpp: Added.
        (WTF::printInternal):
        * dfg/DFGCompilationMode.h: Added.
        * dfg/DFGDriver.cpp:
        (JSC::DFG::compileImpl):
        (JSC::DFG::compile):
        * dfg/DFGDriver.h:
        * dfg/DFGPlan.cpp:
        (JSC::DFG::Plan::Plan):
        (JSC::DFG::Plan::key):
        * dfg/DFGPlan.h:
        * dfg/DFGWorklist.cpp:
        (JSC::DFG::Worklist::enqueue):
        (JSC::DFG::Worklist::compilationState):
        (JSC::DFG::Worklist::completeAllReadyPlansForVM):
        (JSC::DFG::Worklist::runThread):
        * dfg/DFGWorklist.h:
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):

1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313
2013-08-29  Brent Fulgham  <bfulgham@apple.com>

        [Windows] Unreviewed build fix after r154847.
        If you are going to exclude promises, actually exclude the build components.

        * interpreter/CallFrame.h: Exclude promise declarations
        * runtime/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::reset): Exclude promise code.
        (JSC::JSGlobalObject::visitChildren): Ditto.
        * runtime/VM.cpp: Ditto.
        (JSC::VM::VM):
        (JSC::VM::~VM):
        * runtime/VM.h:

1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338
2013-08-29  Sam Weinig  <sam@webkit.org>

        Add ENABLE guards for Promises
        https://bugs.webkit.org/show_bug.cgi?id=120488

        Reviewed by Andreas Kling.

        * Configurations/FeatureDefines.xcconfig:
        * runtime/JSGlobalObject.cpp:
        * runtime/JSGlobalObject.h:
        * runtime/JSPromise.cpp:
        * runtime/JSPromise.h:
        * runtime/JSPromiseCallback.cpp:
        * runtime/JSPromiseCallback.h:
        * runtime/JSPromiseConstructor.cpp:
        * runtime/JSPromiseConstructor.h:
        * runtime/JSPromisePrototype.cpp:
        * runtime/JSPromisePrototype.h:
        * runtime/JSPromiseResolver.cpp:
        * runtime/JSPromiseResolver.h:
        * runtime/JSPromiseResolverConstructor.cpp:
        * runtime/JSPromiseResolverConstructor.h:
        * runtime/JSPromiseResolverPrototype.cpp:
        * runtime/JSPromiseResolverPrototype.h:

fpizlo@apple.com's avatar
fpizlo@apple.com committed
1339 1340 1341 1342 1343 1344 1345
2013-08-29  Filip Pizlo  <fpizlo@apple.com>

        Unreviewed, fix FTL build.

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

1346 1347 1348 1349 1350 1351 1352 1353 1354 1355
2013-08-29  Julien Brianceau  <jbriance@cisco.com>

        REGRESSION(r153222, 32-bit): NULL JSValue() seen when running peacekeeper benchmark.
        https://bugs.webkit.org/show_bug.cgi?id=120080

        Reviewed by Michael Saboff.

        * jit/JITOpcodes32_64.cpp:
        (JSC::JIT::emitSlow_op_get_argument_by_val): Revert changes introduced by r153222 in this function.

1356 1357 1358 1359 1360 1361 1362 1363
2013-08-29  Filip Pizlo  <fpizlo@apple.com>

        Kill code that became dead after http://trac.webkit.org/changeset/154833

        Rubber stamped by Oliver Hunt.

        * dfg/DFGDriver.h:

1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382
2013-08-29  Filip Pizlo  <fpizlo@apple.com>

        CodeBlock's magic for scaling tier-up thresholds should be more reusable
        https://bugs.webkit.org/show_bug.cgi?id=120486

        Reviewed by Oliver Hunt.
        
        Removed the counterValueForBlah() methods and exposed the reusable scaling logic
        as a adjustedCounterValue() method.

        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::adjustedCounterValue):
        (JSC::CodeBlock::optimizeAfterWarmUp):
        (JSC::CodeBlock::optimizeAfterLongWarmUp):
        (JSC::CodeBlock::optimizeSoon):
        * bytecode/CodeBlock.h:
        * dfg/DFGOSRExitCompilerCommon.cpp:
        (JSC::DFG::handleExitCounts):

1383 1384 1385 1386 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
2013-08-29  Filip Pizlo  <fpizlo@apple.com>

        CodeBlock::prepareForExecution() is silly
        https://bugs.webkit.org/show_bug.cgi?id=120453

        Reviewed by Oliver Hunt.
        
        Instead of saying:
        
            codeBlock->prepareForExecution(stuff, BaselineJIT, more stuff)
        
        we should just say:
        
            JIT::compile(stuff, codeBlock, more stuff);
        
        And similarly for the LLInt and DFG.
        
        This kills a bunch of code, since CodeBlock::prepareForExecution() is just a
        wrapper that uses the JITType argument to call into the appropriate execution
        engine, which is what the user wanted to do in the first place.

        * CMakeLists.txt:
        * GNUmakefile.list.am:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * Target.pri:
        * bytecode/CodeBlock.cpp:
        * bytecode/CodeBlock.h:
        * dfg/DFGDriver.cpp:
        (JSC::DFG::compileImpl):
        (JSC::DFG::compile):
        * dfg/DFGDriver.h:
        (JSC::DFG::tryCompile):
        * dfg/DFGOSRExitPreparation.cpp:
        (JSC::DFG::prepareCodeOriginForOSRExit):
        * dfg/DFGWorklist.cpp:
        (JSC::DFG::globalWorklist):
        * dfg/DFGWorklist.h:
        * jit/JIT.cpp:
        (JSC::JIT::privateCompile):
        * jit/JIT.h:
        (JSC::JIT::compile):
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):
        * llint/LLIntEntrypoint.cpp: Copied from Source/JavaScriptCore/llint/LLIntEntrypoints.cpp.
        (JSC::LLInt::setFunctionEntrypoint):
        (JSC::LLInt::setEvalEntrypoint):
        (JSC::LLInt::setProgramEntrypoint):
        (JSC::LLInt::setEntrypoint):
        * llint/LLIntEntrypoint.h: Copied from Source/JavaScriptCore/llint/LLIntEntrypoints.h.
        * llint/LLIntEntrypoints.cpp: Removed.
        * llint/LLIntEntrypoints.h: Removed.
        * llint/LLIntSlowPaths.cpp:
        (JSC::LLInt::jitCompileAndSetHeuristics):
        * runtime/Executable.cpp:
        (JSC::ScriptExecutable::prepareForExecutionImpl):

1440 1441 1442 1443 1444 1445 1446 1447 1448
2013-08-29  Mark Lam  <mark.lam@apple.com>

        Gardening: fixed broken non-DFG build.
        https://bugs.webkit.org/show_bug.cgi?id=120481.

        Not reviewed.

        * interpreter/StackIterator.h:

1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 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 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 1636
2013-08-29  Filip Pizlo  <fpizlo@apple.com>

        CodeBlock compilation and installation should be simplified and rationalized
        https://bugs.webkit.org/show_bug.cgi?id=120326

        Reviewed by Oliver Hunt.
        
        Rolling r154804 back in after fixing no-LLInt build.
        
        Previously Executable owned the code for generating JIT code; you always had
        to go through Executable. But often you also had to go through CodeBlock,
        because ScriptExecutable couldn't have virtual methods, but CodeBlock could.
        So you'd ask CodeBlock to do something, which would dispatch through a
        virtual method that would select the appropriate Executable subtype's method.
        This all meant that the same code would often be duplicated, because most of
        the work needed to compile something was identical regardless of code type.
        But then we tried to fix this, by having templatized helpers in
        ExecutionHarness.h and JITDriver.h. The result was that if you wanted to find
        out what happened when you asked for something to be compiled, you'd go on a
        wild ride that started with CodeBlock, touched upon Executable, and then
        ricocheted into either ExecutionHarness or JITDriver (likely both).
        
        Another awkwardness was that for concurrent compiles, the DFG::Worklist had
        super-special inside knowledge of what JITStubs.cpp's cti_optimize would have
        done once the compilation finished.
        
        Also, most of the DFG JIT drivers assumed that they couldn't install the
        JITCode into the CodeBlock directly - instead they would return it via a
        reference, which happened to be a reference to the JITCode pointer in
        Executable. This was super weird.
        
        Finally, there was no notion of compiling code into a special CodeBlock that
        wasn't used for handling calls into an Executable. I'd like this for FTL OSR
        entry.
        
        This patch solves these problems by reducing all of that complexity into just
        three primitives:
        
        - Executable::newCodeBlock(). This gives you a new code block, either for call
          or for construct, and either to serve as the baseline code or the optimized
          code. The new code block is then owned by the caller; Executable doesn't
          register it anywhere. The new code block has no JITCode and isn't callable,
          but it has all of the bytecode.
        
        - CodeBlock::prepareForExecution(). This takes the CodeBlock's bytecode and
          produces a JITCode, and then installs the JITCode into the CodeBlock. This
          method takes a JITType, and always compiles with that JIT. If you ask for
          JITCode::InterpreterThunk then you'll get JITCode that just points to the
          LLInt entrypoints. Once this returns, it is possible to call into the
          CodeBlock if you do so manually - but the Executable still won't know about
          it so JS calls to that Executable will still be routed to whatever CodeBlock
          is associated with the Executable.
        
        - Executable::installCode(). This takes a CodeBlock and makes it the code-for-
          entry for that Executable. This involves unlinking the Executable's last
          CodeBlock, if there was one. This also tells the GC about any effect on
          memory usage and does a bunch of weird data structure rewiring, since
          Executable caches some of CodeBlock's fields for the benefit of virtual call
          fast paths.
        
        This functionality is then wrapped around three convenience methods:
        
        - Executable::prepareForExecution(). If there is no code block for that
          Executable, then one is created (newCodeBlock()), compiled
          (CodeBlock::prepareForExecution()) and installed (installCode()).
        
        - CodeBlock::newReplacement(). Asks the Executable for a new CodeBlock that
          can serve as an optimized replacement of the current one.
        
        - CodeBlock::install(). Asks the Executable to install this code block.
        
        This patch allows me to kill *a lot* of code and to remove a lot of
        specializations for functions vs. not-functions, and a lot of places where we
        pass around JITCode references and such. ExecutionHarness and JITDriver are
        both gone. Overall this patch has more red than green.
        
        It also allows me to work on FTL OSR entry and tier-up:
        
        - FTL tier-up: this will involve DFGOperations.cpp asking the DFG::Worklist
          to do some compilation, but it will require the DFG::Worklist to do
          something different than what JITStubs.cpp would want, once the compilation
          finishes. This patch introduces a callback mechanism for that purpose.
        
        - FTL OSR entry: this will involve creating a special auto-jettisoned
          CodeBlock that is used only for FTL OSR entry. The new set of primitives
          allows for this: Executable can vend you a fresh new CodeBlock, and you can
          ask that CodeBlock to compile itself with any JIT of your choosing. Or you
          can take that CodeBlock and compile it yourself. Previously the act of
          producing a CodeBlock-for-optimization and the act of compiling code for it
          were tightly coupled; now you can separate them and you can create such
          auto-jettisoned CodeBlocks that are used for a one-shot OSR entry.

        * CMakeLists.txt:
        * GNUmakefile.list.am:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * Target.pri:
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::unlinkIncomingCalls):
        (JSC::CodeBlock::prepareForExecutionImpl):
        (JSC::CodeBlock::prepareForExecution):
        (JSC::CodeBlock::prepareForExecutionAsynchronously):
        (JSC::CodeBlock::install):
        (JSC::CodeBlock::newReplacement):
        (JSC::FunctionCodeBlock::jettisonImpl):
        * bytecode/CodeBlock.h:
        (JSC::CodeBlock::hasBaselineJITProfiling):
        * bytecode/DeferredCompilationCallback.cpp: Added.
        (JSC::DeferredCompilationCallback::DeferredCompilationCallback):
        (JSC::DeferredCompilationCallback::~DeferredCompilationCallback):
        * bytecode/DeferredCompilationCallback.h: Added.
        * dfg/DFGDriver.cpp:
        (JSC::DFG::tryCompile):
        * dfg/DFGDriver.h:
        (JSC::DFG::tryCompile):
        * dfg/DFGFailedFinalizer.cpp:
        (JSC::DFG::FailedFinalizer::finalize):
        (JSC::DFG::FailedFinalizer::finalizeFunction):
        * dfg/DFGFailedFinalizer.h:
        * dfg/DFGFinalizer.h:
        * dfg/DFGJITFinalizer.cpp:
        (JSC::DFG::JITFinalizer::finalize):
        (JSC::DFG::JITFinalizer::finalizeFunction):
        * dfg/DFGJITFinalizer.h:
        * dfg/DFGOSRExitPreparation.cpp:
        (JSC::DFG::prepareCodeOriginForOSRExit):
        * dfg/DFGOperations.cpp:
        * dfg/DFGPlan.cpp:
        (JSC::DFG::Plan::Plan):
        (JSC::DFG::Plan::compileInThreadImpl):
        (JSC::DFG::Plan::notifyReady):
        (JSC::DFG::Plan::finalizeWithoutNotifyingCallback):
        (JSC::DFG::Plan::finalizeAndNotifyCallback):
        * dfg/DFGPlan.h:
        * dfg/DFGSpeculativeJIT32_64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * dfg/DFGWorklist.cpp:
        (JSC::DFG::Worklist::completeAllReadyPlansForVM):
        (JSC::DFG::Worklist::runThread):
        * ftl/FTLJITFinalizer.cpp:
        (JSC::FTL::JITFinalizer::finalize):
        (JSC::FTL::JITFinalizer::finalizeFunction):
        * ftl/FTLJITFinalizer.h:
        * heap/Heap.h:
        (JSC::Heap::isDeferred):
        * interpreter/Interpreter.cpp:
        (JSC::Interpreter::execute):
        (JSC::Interpreter::executeCall):
        (JSC::Interpreter::executeConstruct):
        (JSC::Interpreter::prepareForRepeatCall):
        * jit/JITDriver.h: Removed.
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):
        (JSC::jitCompileFor):
        (JSC::lazyLinkFor):
        * jit/JITToDFGDeferredCompilationCallback.cpp: Added.
        (JSC::JITToDFGDeferredCompilationCallback::JITToDFGDeferredCompilationCallback):
        (JSC::JITToDFGDeferredCompilationCallback::~JITToDFGDeferredCompilationCallback):
        (JSC::JITToDFGDeferredCompilationCallback::create):
        (JSC::JITToDFGDeferredCompilationCallback::compilationDidBecomeReadyAsynchronously):
        (JSC::JITToDFGDeferredCompilationCallback::compilationDidComplete):
        * jit/JITToDFGDeferredCompilationCallback.h: Added.
        * llint/LLIntEntrypoints.cpp:
        (JSC::LLInt::setFunctionEntrypoint):
        (JSC::LLInt::setEvalEntrypoint):
        (JSC::LLInt::setProgramEntrypoint):
        * llint/LLIntEntrypoints.h:
        * llint/LLIntSlowPaths.cpp:
        (JSC::LLInt::jitCompileAndSetHeuristics):
        (JSC::LLInt::setUpCall):
        * runtime/ArrayPrototype.cpp:
        (JSC::isNumericCompareFunction):
        * runtime/CommonSlowPaths.cpp:
        * runtime/CompilationResult.cpp:
        (WTF::printInternal):
        * runtime/CompilationResult.h:
        * runtime/Executable.cpp:
        (JSC::ScriptExecutable::installCode):
        (JSC::ScriptExecutable::newCodeBlockFor):
        (JSC::ScriptExecutable::newReplacementCodeBlockFor):
        (JSC::ScriptExecutable::prepareForExecutionImpl):
        * runtime/Executable.h:
        (JSC::ExecutableBase::offsetOfJITCodeWithArityCheckFor):
        (JSC::ExecutableBase::offsetOfNumParametersFor):
        (JSC::ScriptExecutable::prepareForExecution):
        (JSC::FunctionExecutable::jettisonOptimizedCodeFor):
        * runtime/ExecutionHarness.h: Removed.

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
2013-08-29  Mark Lam  <mark.lam@apple.com>

        Change StackIterator to not require writes to the JS stack.
        https://bugs.webkit.org/show_bug.cgi?id=119657.

        Reviewed by Geoffrey Garen.

        * GNUmakefile.list.am:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * interpreter/CallFrame.h:
        - Removed references to StackIteratorPrivate.h.
        * interpreter/StackIterator.cpp:
        (JSC::StackIterator::numberOfFrames):
        (JSC::StackIterator::gotoFrameAtIndex):
        (JSC::StackIterator::gotoNextFrame):
        (JSC::StackIterator::resetIterator):
        (JSC::StackIterator::find):
        (JSC::StackIterator::readFrame):
        (JSC::StackIterator::readNonInlinedFrame):
        - Reads in the current CallFrame's data for non-inlined frames.
        (JSC::inlinedFrameOffset):
        - Convenience function to compute the inlined frame offset based on the
          CodeOrigin. If the offset is 0, then we're looking at the physical frame.
          Otherwise, it's an inlined frame.
        (JSC::StackIterator::readInlinedFrame):
        - Determines the inlined frame's caller frame. Will read in the caller
          frame if it is also an inlined frame i.e. we haven't reached the
          outer most frame yet. Otherwise, will call readNonInlinedFrame() to
          read on the outer most frame.
          This is based on the old StackIterator::Frame::logicalFrame().
        (JSC::StackIterator::updateFrame):
        - Reads the data of the caller frame of the current one. This function
          is renamed and moved from the old StackIterator::Frame::logicalCallerFrame(),
          but is now simplified because it delegates to the readInlinedFrame()
          to get the caller for inlined frames.
        (JSC::StackIterator::Frame::arguments):
        - Fixed to use the inlined frame versions of Arguments::create() and
          Arguments::tearOff() when the frame is an inlined frame.
        (JSC::StackIterator::Frame::print):
        (debugPrintCallFrame):
        (debugPrintStack):
        - Because sometimes, we want to see the whole stack while debugging.
        * interpreter/StackIterator.h:
        (JSC::StackIterator::Frame::argumentCount):
        (JSC::StackIterator::Frame::callerFrame):
        (JSC::StackIterator::Frame::callee):
        (JSC::StackIterator::Frame::scope):
        (JSC::StackIterator::Frame::codeBlock):
        (JSC::StackIterator::Frame::bytecodeOffset):
        (JSC::StackIterator::Frame::inlinedFrameInfo):
        (JSC::StackIterator::Frame::isJSFrame):
        (JSC::StackIterator::Frame::isInlinedFrame):
        (JSC::StackIterator::Frame::callFrame):
        (JSC::StackIterator::Frame::Frame):
        (JSC::StackIterator::Frame::~Frame):
        - StackIterator::Frame now caches commonly used accessed values from
          the CallFrame. It still delegates argument queries to the CallFrame.
        (JSC::StackIterator::operator*):
        (JSC::StackIterator::operator->):
        (JSC::StackIterator::operator!=):
        (JSC::StackIterator::operator++):
        (JSC::StackIterator::end):
        (JSC::StackIterator::operator==):
        * interpreter/StackIteratorPrivate.h: Removed.

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
2013-08-29  Chris Curtis  <chris_curtis@apple.com>

        VM::throwException() crashes reproducibly in testapi with !ENABLE(JIT)
        https://bugs.webkit.org/show_bug.cgi?id=120472

        Reviewed by Filip Pizlo.
        
        With the JIT disabled, interpreterThrowInCaller was attempting to throw an error, 
        but the topCallFrame was not set yet. By passing the error object into interpreterThrowInCaller
        throwException can be called when topCallFrame is set.
        * llint/LLIntSlowPaths.cpp:
        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
        * runtime/CommonSlowPaths.cpp:
        (JSC::SLOW_PATH_DECL):
        * runtime/CommonSlowPathsExceptions.cpp:
        (JSC::CommonSlowPaths::interpreterThrowInCaller):
        * runtime/CommonSlowPathsExceptions.h:

        Renamed genericThrow -> genericUnwind, because this function no longer has the ability
        to throw errors. It unwinds the stack in order to report them. 
        * dfg/DFGOperations.cpp:
        * jit/JITExceptions.cpp:
        (JSC::genericUnwind):
        (JSC::jitThrowNew):
        (JSC::jitThrow):
        * jit/JITExceptions.h:
        * llint/LLIntExceptions.cpp:
        (JSC::LLInt::doThrow):
    
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 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 1787 1788 1789 1790 1791 1792 1793 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 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
2013-08-29  Commit Queue  <commit-queue@webkit.org>

        Unreviewed, rolling out r154804.
        http://trac.webkit.org/changeset/154804
        https://bugs.webkit.org/show_bug.cgi?id=120477

        Broke Windows build (assumes LLInt features not enabled on
        this build) (Requested by bfulgham on #webkit).

        * CMakeLists.txt:
        * GNUmakefile.list.am:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * Target.pri:
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::linkIncomingCall):
        (JSC::CodeBlock::unlinkIncomingCalls):
        (JSC::CodeBlock::reoptimize):
        (JSC::ProgramCodeBlock::replacement):
        (JSC::EvalCodeBlock::replacement):
        (JSC::FunctionCodeBlock::replacement):
        (JSC::ProgramCodeBlock::compileOptimized):
        (JSC::ProgramCodeBlock::replaceWithDeferredOptimizedCode):
        (JSC::EvalCodeBlock::compileOptimized):
        (JSC::EvalCodeBlock::replaceWithDeferredOptimizedCode):
        (JSC::FunctionCodeBlock::compileOptimized):
        (JSC::FunctionCodeBlock::replaceWithDeferredOptimizedCode):
        (JSC::ProgramCodeBlock::jitCompileImpl):
        (JSC::EvalCodeBlock::jitCompileImpl):
        (JSC::FunctionCodeBlock::jitCompileImpl):
        * bytecode/CodeBlock.h:
        (JSC::CodeBlock::jitType):
        (JSC::CodeBlock::jitCompile):
        * bytecode/DeferredCompilationCallback.cpp: Removed.
        * bytecode/DeferredCompilationCallback.h: Removed.
        * dfg/DFGDriver.cpp:
        (JSC::DFG::compile):
        (JSC::DFG::tryCompile):
        (JSC::DFG::tryCompileFunction):
        (JSC::DFG::tryFinalizePlan):
        * dfg/DFGDriver.h:
        (JSC::DFG::tryCompile):
        (JSC::DFG::tryCompileFunction):
        (JSC::DFG::tryFinalizePlan):
        * dfg/DFGFailedFinalizer.cpp:
        (JSC::DFG::FailedFinalizer::finalize):
        (JSC::DFG::FailedFinalizer::finalizeFunction):
        * dfg/DFGFailedFinalizer.h:
        * dfg/DFGFinalizer.h:
        * dfg/DFGJITFinalizer.cpp:
        (JSC::DFG::JITFinalizer::finalize):
        (JSC::DFG::JITFinalizer::finalizeFunction):
        * dfg/DFGJITFinalizer.h:
        * dfg/DFGOSRExitPreparation.cpp:
        (JSC::DFG::prepareCodeOriginForOSRExit):
        * dfg/DFGOperations.cpp:
        * dfg/DFGPlan.cpp:
        (JSC::DFG::Plan::Plan):
        (JSC::DFG::Plan::compileInThreadImpl):
        (JSC::DFG::Plan::finalize):
        * dfg/DFGPlan.h:
        * dfg/DFGSpeculativeJIT32_64.cpp:
        (JSC::DFG::SpeculativeJIT::compile):
        * dfg/DFGWorklist.cpp:
        (JSC::DFG::Worklist::completeAllReadyPlansForVM):
        (JSC::DFG::Worklist::runThread):
        * ftl/FTLJITFinalizer.cpp:
        (JSC::FTL::JITFinalizer::finalize):
        (JSC::FTL::JITFinalizer::finalizeFunction):
        * ftl/FTLJITFinalizer.h:
        * heap/Heap.h:
        * interpreter/Interpreter.cpp:
        (JSC::Interpreter::execute):
        (JSC::Interpreter::executeCall):
        (JSC::Interpreter::executeConstruct):
        (JSC::Interpreter::prepareForRepeatCall):
        * jit/JITDriver.h: Added.
        (JSC::jitCompileIfAppropriateImpl):
        (JSC::jitCompileFunctionIfAppropriateImpl):
        (JSC::jitCompileIfAppropriate):
        (JSC::jitCompileFunctionIfAppropriate):
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):
        (JSC::jitCompileFor):
        (JSC::lazyLinkFor):
        * jit/JITToDFGDeferredCompilationCallback.cpp: Removed.
        * jit/JITToDFGDeferredCompilationCallback.h: Removed.
        * llint/LLIntEntrypoints.cpp:
        (JSC::LLInt::getFunctionEntrypoint):
        (JSC::LLInt::getEvalEntrypoint):
        (JSC::LLInt::getProgramEntrypoint):
        * llint/LLIntEntrypoints.h:
        (JSC::LLInt::getEntrypoint):
        * llint/LLIntSlowPaths.cpp:
        (JSC::LLInt::jitCompileAndSetHeuristics):
        (JSC::LLInt::setUpCall):
        * runtime/ArrayPrototype.cpp:
        (JSC::isNumericCompareFunction):
        * runtime/CommonSlowPaths.cpp:
        * runtime/CompilationResult.cpp:
        (WTF::printInternal):
        * runtime/CompilationResult.h:
        * runtime/Executable.cpp:
        (JSC::EvalExecutable::compileOptimized):
        (JSC::EvalExecutable::jitCompile):
        (JSC::EvalExecutable::compileInternal):
        (JSC::EvalExecutable::replaceWithDeferredOptimizedCode):
        (JSC::ProgramExecutable::compileOptimized):
        (JSC::ProgramExecutable::jitCompile):
        (JSC::ProgramExecutable::compileInternal):
        (JSC::ProgramExecutable::replaceWithDeferredOptimizedCode):
        (JSC::FunctionExecutable::compileOptimizedForCall):
        (JSC::FunctionExecutable::compileOptimizedForConstruct):
        (JSC::FunctionExecutable::jitCompileForCall):
        (JSC::FunctionExecutable::jitCompileForConstruct):
        (JSC::FunctionExecutable::produceCodeBlockFor):
        (JSC::FunctionExecutable::compileForCallInternal):
        (JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeForCall):
        (JSC::FunctionExecutable::compileForConstructInternal):
        (JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeForConstruct):
        * runtime/Executable.h:
        (JSC::ExecutableBase::offsetOfJITCodeWithArityCheckFor):
        (JSC::ExecutableBase::offsetOfNumParametersFor):
        (JSC::ExecutableBase::catchRoutineFor):
        (JSC::EvalExecutable::compile):
        (JSC::ProgramExecutable::compile):
        (JSC::FunctionExecutable::compileForCall):
        (JSC::FunctionExecutable::compileForConstruct):
        (JSC::FunctionExecutable::compileFor):
        (JSC::FunctionExecutable::compileOptimizedFor):
        (JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeFor):
        (JSC::FunctionExecutable::jitCompileFor):
        * runtime/ExecutionHarness.h: Added.
        (JSC::prepareForExecutionImpl):
        (JSC::prepareFunctionForExecutionImpl):
        (JSC::installOptimizedCode):
        (JSC::prepareForExecution):
        (JSC::prepareFunctionForExecution):
        (JSC::replaceWithDeferredOptimizedCode):

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 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 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 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 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 2046 2047 2048 2049
2013-08-28  Filip Pizlo  <fpizlo@apple.com>

        CodeBlock compilation and installation should be simplified and rationalized
        https://bugs.webkit.org/show_bug.cgi?id=120326

        Reviewed by Oliver Hunt.
        
        Previously Executable owned the code for generating JIT code; you always had
        to go through Executable. But often you also had to go through CodeBlock,
        because ScriptExecutable couldn't have virtual methods, but CodeBlock could.
        So you'd ask CodeBlock to do something, which would dispatch through a
        virtual method that would select the appropriate Executable subtype's method.
        This all meant that the same code would often be duplicated, because most of
        the work needed to compile something was identical regardless of code type.
        But then we tried to fix this, by having templatized helpers in
        ExecutionHarness.h and JITDriver.h. The result was that if you wanted to find
        out what happened when you asked for something to be compiled, you'd go on a
        wild ride that started with CodeBlock, touched upon Executable, and then
        ricocheted into either ExecutionHarness or JITDriver (likely both).
        
        Another awkwardness was that for concurrent compiles, the DFG::Worklist had
        super-special inside knowledge of what JITStubs.cpp's cti_optimize would have
        done once the compilation finished.
        
        Also, most of the DFG JIT drivers assumed that they couldn't install the
        JITCode into the CodeBlock directly - instead they would return it via a
        reference, which happened to be a reference to the JITCode pointer in
        Executable. This was super weird.
        
        Finally, there was no notion of compiling code into a special CodeBlock that
        wasn't used for handling calls into an Executable. I'd like this for FTL OSR
        entry.
        
        This patch solves these problems by reducing all of that complexity into just
        three primitives:
        
        - Executable::newCodeBlock(). This gives you a new code block, either for call
          or for construct, and either to serve as the baseline code or the optimized
          code. The new code block is then owned by the caller; Executable doesn't
          register it anywhere. The new code block has no JITCode and isn't callable,
          but it has all of the bytecode.
        
        - CodeBlock::prepareForExecution(). This takes the CodeBlock's bytecode and
          produces a JITCode, and then installs the JITCode into the CodeBlock. This
          method takes a JITType, and always compiles with that JIT. If you ask for
          JITCode::InterpreterThunk then you'll get JITCode that just points to the
          LLInt entrypoints. Once this returns, it is possible to call into the
          CodeBlock if you do so manually - but the Executable still won't know about
          it so JS calls to that Executable will still be routed to whatever CodeBlock
          is associated with the Executable.
        
        - Executable::installCode(). This takes a CodeBlock and makes it the code-for-
          entry for that Executable. This involves unlinking the Executable's last
          CodeBlock, if there was one. This also tells the GC about any effect on
          memory usage and does a bunch of weird data structure rewiring, since
          Executable caches some of CodeBlock's fields for the benefit of virtual call
          fast paths.
        
        This functionality is then wrapped around three convenience methods:
        
        - Executable::prepareForExecution(). If there is no code block for that
          Executable, then one is created (newCodeBlock()), compiled
          (CodeBlock::prepareForExecution()) and installed (installCode()).
        
        - CodeBlock::newReplacement(). Asks the Executable for a new CodeBlock that
          can serve as an optimized replacement of the current one.
        
        - CodeBlock::install(). Asks the Executable to install this code block.
        
        This patch allows me to kill *a lot* of code and to remove a lot of
        specializations for functions vs. not-functions, and a lot of places where we
        pass around JITCode references and such. ExecutionHarness and JITDriver are
        both gone. Overall this patch has more red than green.
        
        It also allows me to work on FTL OSR entry and tier-up:
        
        - FTL tier-up: this will involve DFGOperations.cpp asking the DFG::Worklist
          to do some compilation, but it will require the DFG::Worklist to do
          something different than what JITStubs.cpp would want, once the compilation
          finishes. This patch introduces a callback mechanism for that purpose.
        
        - FTL OSR entry: this will involve creating a special auto-jettisoned
          CodeBlock that is used only for FTL OSR entry. The new set of primitives
          allows for this: Executable can vend you a fresh new CodeBlock, and you can
          ask that CodeBlock to compile itself with any JIT of your choosing. Or you
          can take that CodeBlock and compile it yourself. Previously the act of
          producing a CodeBlock-for-optimization and the act of compiling code for it
          were tightly coupled; now you can separate them and you can create such
          auto-jettisoned CodeBlocks that are used for a one-shot OSR entry.

        * CMakeLists.txt:
        * GNUmakefile.list.am:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * Target.pri:
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::prepareForExecution):
        (JSC::CodeBlock::install):
        (JSC::CodeBlock::newReplacement):
        (JSC::FunctionCodeBlock::jettisonImpl):
        (JSC::CodeBlock::setOptimizationThresholdBasedOnCompilationResult):
        * bytecode/CodeBlock.h:
        (JSC::CodeBlock::hasBaselineJITProfiling):
        * bytecode/DeferredCompilationCallback.cpp: Added.
        (JSC::DeferredCompilationCallback::DeferredCompilationCallback):
        (JSC::DeferredCompilationCallback::~DeferredCompilationCallback):
        * bytecode/DeferredCompilationCallback.h: Added.
        * dfg/DFGDriver.cpp:
        (JSC::DFG::tryCompile):
        * dfg/DFGDriver.h:
        (JSC::DFG::tryCompile):
        * dfg/DFGFailedFinalizer.cpp:
        (JSC::DFG::FailedFinalizer::finalize):
        (JSC::DFG::FailedFinalizer::finalizeFunction):
        * dfg/DFGFailedFinalizer.h:
        * dfg/DFGFinalizer.h:
        * dfg/DFGJITFinalizer.cpp:
        (JSC::DFG::JITFinalizer::finalize):
        (JSC::DFG::JITFinalizer::finalizeFunction):
        * dfg/DFGJITFinalizer.h:
        * dfg/DFGOSRExitPreparation.cpp:
        (JSC::DFG::prepareCodeOriginForOSRExit):
        * dfg/DFGOperations.cpp:
        * dfg/DFGPlan.cpp:
        (JSC::DFG::Plan::Plan):
        (JSC::DFG::Plan::compileInThreadImpl):
        (JSC::DFG::Plan::finalizeWithoutNotifyingCallback):
        (JSC::DFG::Plan::finalizeAndNotifyCallback):
        * dfg/DFGPlan.h:
        * dfg/DFGWorklist.cpp:
        (JSC::DFG::Worklist::completeAllReadyPlansForVM):
        * ftl/FTLJITFinalizer.cpp:
        (JSC::FTL::JITFinalizer::finalize):
        (JSC::FTL::JITFinalizer::finalizeFunction):
        * ftl/FTLJITFinalizer.h:
        * heap/Heap.h:
        (JSC::Heap::isDeferred):
        * interpreter/Interpreter.cpp:
        (JSC::Interpreter::execute):
        (JSC::Interpreter::executeCall):
        (JSC::Interpreter::executeConstruct):
        (JSC::Interpreter::prepareForRepeatCall):
        * jit/JITDriver.h: Removed.
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):
        (JSC::jitCompileFor):
        (JSC::lazyLinkFor):
        * jit/JITToDFGDeferredCompilationCallback.cpp: Added.
        (JSC::JITToDFGDeferredCompilationCallback::JITToDFGDeferredCompilationCallback):
        (JSC::JITToDFGDeferredCompilationCallback::~JITToDFGDeferredCompilationCallback):
        (JSC::JITToDFGDeferredCompilationCallback::create):
        (JSC::JITToDFGDeferredCompilationCallback::compilationDidComplete):
        * jit/JITToDFGDeferredCompilationCallback.h: Added.
        * llint/LLIntEntrypoints.cpp:
        (JSC::LLInt::setFunctionEntrypoint):
        (JSC::LLInt::setEvalEntrypoint):
        (JSC::LLInt::setProgramEntrypoint):
        * llint/LLIntEntrypoints.h:
        * llint/LLIntSlowPaths.cpp:
        (JSC::LLInt::jitCompileAndSetHeuristics):
        (JSC::LLInt::setUpCall):
        * runtime/ArrayPrototype.cpp:
        (JSC::isNumericCompareFunction):
        * runtime/CommonSlowPaths.cpp:
        * runtime/CompilationResult.cpp:
        (WTF::printInternal):
        * runtime/CompilationResult.h:
        * runtime/Executable.cpp:
        (JSC::ScriptExecutable::installCode):
        (JSC::ScriptExecutable::newCodeBlockFor):
        (JSC::ScriptExecutable::newReplacementCodeBlockFor):
        (JSC::ScriptExecutable::prepareForExecutionImpl):
        * runtime/Executable.h:
        (JSC::ScriptExecutable::prepareForExecution):
        (JSC::FunctionExecutable::jettisonOptimizedCodeFor):
        * runtime/ExecutionHarness.h: Removed.

2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 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 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 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 2237 2238 2239 2240 2241 2242 2243 2244 2245
2013-08-28  Chris Curtis  <chris_curtis@apple.com>

        https://bugs.webkit.org/show_bug.cgi?id=119548
        Refactoring Exception throws.
        
        Reviewed by Geoffrey Garen.
        
        Gardening of exception throws. The act of throwing an exception was being handled in 
        different ways depending on whether the code was running in the LLint, Baseline JIT, 
        or the DFG Jit. This made development in the vm exception and error objects difficult.
        
         * runtime/VM.cpp:
        (JSC::appendSourceToError): 
        This function moved from the interpreter into the VM. It views the developers code
        (if there is a codeBlock) to extract what was trying to be evaluated when the error
        occurred.
        
        (JSC::VM::throwException):
        This function takes in the error object and sets the following:
            1: The VM's exception stack
            2: The VM's exception 
            3: Appends extra information on the error message(via appendSourceToError)
            4: The error object's line number
            5: The error object's column number
            6: The error object's sourceURL
            7: The error object's stack trace (unless it already exists because the developer 
                created the error object). 

        (JSC::VM::getExceptionInfo):
        (JSC::VM::setExceptionInfo):
        (JSC::VM::clearException):
        (JSC::clearExceptionStack):
        * runtime/VM.h:
        (JSC::VM::exceptionOffset):
        (JSC::VM::exception):
        (JSC::VM::addressOfException):
        (JSC::VM::exceptionStack):
        VM exception and exceptionStack are now private data members.

        * interpreter/Interpreter.h:
        (JSC::ClearExceptionScope::ClearExceptionScope):
        Created this structure to temporarily clear the exception within the VM. This 
        needed to see if addition errors occur when setting the debugger as we are 
        unwinding the stack.

         * interpreter/Interpreter.cpp:
        (JSC::Interpreter::unwind): 
        Removed the code that would try to add error information if it did not exist. 
        All of this functionality has moved into the VM and all error information is set 
        at the time the error occurs. 

        The rest of these functions reference the new calling convention to throw an error.

        * API/APICallbackFunction.h:
        (JSC::APICallbackFunction::call):
        * API/JSCallbackConstructor.cpp:
        (JSC::constructJSCallback):
        * API/JSCallbackObjectFunctions.h:
        (JSC::::getOwnPropertySlot):
        (JSC::::defaultValue):
        (JSC::::put):
        (JSC::::putByIndex):
        (JSC::::deleteProperty):
        (JSC::::construct):
        (JSC::::customHasInstance):
        (JSC::::call):
        (JSC::::getStaticValue):
        (JSC::::staticFunctionGetter):
        (JSC::::callbackGetter):
        * debugger/Debugger.cpp:
        (JSC::evaluateInGlobalCallFrame):
        * debugger/DebuggerCallFrame.cpp:
        (JSC::DebuggerCallFrame::evaluate):
        * dfg/DFGAssemblyHelpers.h:
        (JSC::DFG::AssemblyHelpers::emitExceptionCheck):
        * dfg/DFGOperations.cpp:
        (JSC::DFG::operationPutByValInternal):
        * ftl/FTLLowerDFGToLLVM.cpp:
        (JSC::FTL::LowerDFGToLLVM::callCheck):
        * heap/Heap.cpp:
        (JSC::Heap::markRoots):
        * interpreter/CallFrame.h:
        (JSC::ExecState::clearException):
        (JSC::ExecState::exception):
        (JSC::ExecState::hadException):
        * interpreter/Interpreter.cpp:
        (JSC::eval):
        (JSC::loadVarargs):
        (JSC::stackTraceAsString):
        (JSC::Interpreter::execute):
        (JSC::Interpreter::executeCall):
        (JSC::Interpreter::executeConstruct):
        (JSC::Interpreter::prepareForRepeatCall):
        * interpreter/Interpreter.h:
        (JSC::ClearExceptionScope::ClearExceptionScope):
        * jit/JITCode.cpp:
        (JSC::JITCode::execute):
        * jit/JITExceptions.cpp:
        (JSC::genericThrow):
        * jit/JITOpcodes.cpp:
        (JSC::JIT::emit_op_catch):
        * jit/JITOpcodes32_64.cpp:
        (JSC::JIT::privateCompileCTINativeCall):
        (JSC::JIT::emit_op_catch):
        * jit/JITStubs.cpp:
        (JSC::returnToThrowTrampoline):
        (JSC::throwExceptionFromOpCall):
        (JSC::DEFINE_STUB_FUNCTION):
        (JSC::jitCompileFor):
        (JSC::lazyLinkFor):
        (JSC::putByVal):
        (JSC::cti_vm_handle_exception):
        * jit/SlowPathCall.h:
        (JSC::JITSlowPathCall::call):
        * jit/ThunkGenerators.cpp:
        (JSC::nativeForGenerator):
        * jsc.cpp:
        (functionRun):
        (functionLoad):
        (functionCheckSyntax):
        * llint/LLIntExceptions.cpp:
        (JSC::LLInt::doThrow):
        (JSC::LLInt::returnToThrow):
        (JSC::LLInt::callToThrow):
        * llint/LLIntSlowPaths.cpp:
        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
        * llint/LowLevelInterpreter.cpp:
        (JSC::CLoop::execute):
        * llint/LowLevelInterpreter32_64.asm:
        * llint/LowLevelInterpreter64.asm:
        * runtime/ArrayConstructor.cpp:
        (JSC::constructArrayWithSizeQuirk):
        * runtime/CommonSlowPaths.cpp:
        (JSC::SLOW_PATH_DECL):
        * runtime/CommonSlowPaths.h:
        (JSC::CommonSlowPaths::opIn):
        * runtime/CommonSlowPathsExceptions.cpp:
        (JSC::CommonSlowPaths::interpreterThrowInCaller):
        * runtime/Completion.cpp:
        (JSC::evaluate):
        * runtime/Error.cpp:
        (JSC::addErrorInfo):
        (JSC::throwTypeError):
        (JSC::throwSyntaxError):
        * runtime/Error.h:
        (JSC::throwVMError):
        * runtime/ExceptionHelpers.cpp:
        (JSC::throwOutOfMemoryError):
        (JSC::throwStackOverflowError):
        (JSC::throwTerminatedExecutionException):
        * runtime/Executable.cpp:
        (JSC::EvalExecutable::create):
        (JSC::FunctionExecutable::produceCodeBlockFor):
        * runtime/FunctionConstructor.cpp:
        (JSC::constructFunction):
        (JSC::constructFunctionSkippingEvalEnabledCheck):
        * runtime/JSArray.cpp:
        (JSC::JSArray::defineOwnProperty):
        (JSC::JSArray::put):
        (JSC::JSArray::push):
        * runtime/JSCJSValue.cpp:
        (JSC::JSValue::toObjectSlowCase):
        (JSC::JSValue::synthesizePrototype):
        (JSC::JSValue::putToPrimitive):
        * runtime/JSFunction.cpp:
        (JSC::JSFunction::defineOwnProperty):
        * runtime/JSGenericTypedArrayViewInlines.h:
        (JSC::::create):
        (JSC::::createUninitialized):
        (JSC::::validateRange):
        (JSC::::setWithSpecificType):
        * runtime/JSGlobalObjectFunctions.cpp:
        (JSC::encode):
        (JSC::decode):
        (JSC::globalFuncProtoSetter):
        * runtime/JSNameScope.cpp:
        (JSC::JSNameScope::put):
        * runtime/JSONObject.cpp:
        (JSC::Stringifier::appendStringifiedValue):
        (JSC::Walker::walk):
        * runtime/JSObject.cpp:
        (JSC::JSObject::put):
        (JSC::JSObject::defaultValue):
        (JSC::JSObject::hasInstance):
        (JSC::JSObject::defaultHasInstance):
        (JSC::JSObject::defineOwnNonIndexProperty):
        (JSC::throwTypeError):
        * runtime/ObjectConstructor.cpp:
        (JSC::toPropertyDescriptor):
        * runtime/RegExpConstructor.cpp:
        (JSC::constructRegExp):
        * runtime/StringObject.cpp:
        (JSC::StringObject::defineOwnProperty):
        * runtime/StringRecursionChecker.cpp:
        (JSC::StringRecursionChecker::throwStackOverflowError):

2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260
2013-08-28  Zan Dobersek  <zdobersek@igalia.com>

        [GTK] Add support for building JSC with FTL JIT enabled
        https://bugs.webkit.org/show_bug.cgi?id=120270

        Reviewed by Filip Pizlo.

        * GNUmakefile.am: Add LLVM_LIBS to the list of linker flags and LLVM_CFLAGS to the list of
        compiler flags for the JSC library.
        * GNUmakefile.list.am: Add the missing build targets.
        * ftl/FTLAbbreviations.h: Include the <cstring> header and use std::strlen. This avoids compilation
        failures when using the Clang compiler with the libstdc++ standard library.
        (JSC::FTL::mdKindID):
        (JSC::FTL::mdString):

2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280
2013-08-23  Andy Estes  <aestes@apple.com>

        Fix issues found by the Clang Static Analyzer
        https://bugs.webkit.org/show_bug.cgi?id=120230

        Reviewed by Darin Adler.

        * API/JSValue.mm:
        (valueToString): Don't leak every CFStringRef when in Objective-C GC.
        * API/ObjCCallbackFunction.mm:
        (JSC::ObjCCallbackFunctionImpl::~ObjCCallbackFunctionImpl): Don't
        release m_invocation's target since NSInvocation will do it for us on
        -dealloc.
        (objCCallbackFunctionForBlock): Tell NSInvocation to retain its target
        and -release our reference to the copied block.
        * API/tests/minidom.c:
        (createStringWithContentsOfFile): Free buffer before returning.
        * API/tests/testapi.c:
        (createStringWithContentsOfFile): Ditto.

2281 2282 2283 2284 2285 2286 2287
2013-08-26  Brent Fulgham  <bfulgham@apple.com>

        [Windows] Unreviewed build fix after r154629.

        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: Add missing build files.
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:

2288 2289 2290 2291 2292 2293
2013-08-26  Ryosuke Niwa  <rniwa@webkit.org>

        Windows build fix attempt after r154629.

        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:

2294 2295 2296 2297 2298 2299 2300 2301 2302 2303
2013-08-25  Mark Hahnenberg  <mhahnenberg@apple.com>

        JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage does a check on the length of the ArrayStorage after possible reallocing it
        https://bugs.webkit.org/show_bug.cgi?id=120278

        Reviewed by Geoffrey Garen.

        * runtime/JSObject.cpp:
        (JSC::JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage):

2304 2305 2306 2307 2308 2309 2310 2311
2013-08-26  Filip Pizlo  <fpizlo@apple.com>

        Fix indention of Executable.h.

        Rubber stamped by Mark Hahnenberg.

        * runtime/Executable.h:

2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335
2013-08-26  Mark Hahnenberg  <mhahnenberg@apple.com>

        Object.defineProperty should be able to create a PropertyDescriptor where m_attributes == 0
        https://bugs.webkit.org/show_bug.cgi?id=120314

        Reviewed by Darin Adler.

        Currently with the way that defineProperty works, we leave a stray low bit set in 
        PropertyDescriptor::m_attributes in the following code:

        var o = {};
        Object.defineProperty(o, 100, {writable:true, enumerable:true, configurable:true, value:"foo"});
        
        This is due to the fact that the lowest non-zero attribute (ReadOnly) is represented as 1 << 1 
        instead of 1 << 0. We then calculate the default attributes as (DontDelete << 1) - 1, which is 0xF, 
        but only the top three bits mean anything. Even in the case above, the top three bits are set 
        to 0 but the bottom bit remains set, which causes us to think m_attributes is non-zero.

        Since some of these attributes and their corresponding values are exposed in the JavaScriptCore 
        framework's public C API, it's safer to just change how we calculate the default value, which is
        where the weirdness was originating from in the first place.

        * runtime/PropertyDescriptor.cpp:

weinig@apple.com's avatar
weinig@apple.com committed
2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 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
2013-08-24  Sam Weinig  <sam@webkit.org>

        Add support for Promises
        https://bugs.webkit.org/show_bug.cgi?id=120260

        Reviewed by Darin Adler.

        Add an initial implementation of Promises - http://dom.spec.whatwg.org/#promises.
        - Despite Promises being defined in the DOM, the implementation is being put in JSC
          in preparation for the Promises eventually being defined in ECMAScript.

        * CMakeLists.txt:
        * DerivedSources.make:
        * DerivedSources.pri:
        * GNUmakefile.list.am:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * Target.pri:
        Add new files.

        * jsc.cpp:
        Update jsc's GlobalObjectMethodTable to stub out the new QueueTaskToEventLoop callback. This mean's
        you can't quite use Promises with with the command line tool yet.
    
        * interpreter/CallFrame.h:
        (JSC::ExecState::promisePrototypeTable):
        (JSC::ExecState::promiseConstructorTable):
        (JSC::ExecState::promiseResolverPrototypeTable):
        * runtime/VM.cpp:
        (JSC::VM::VM):
        (JSC::VM::~VM):
        * runtime/VM.h:
        Add supporting code for the new static lookup tables.

        * runtime/CommonIdentifiers.h:
        Add 3 new identifiers, "Promise", "PromiseResolver", and "then".

        * runtime/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::reset):
        (JSC::JSGlobalObject::visitChildren):
        Add supporting code Promise and PromiseResolver's constructors and structures.

        * runtime/JSGlobalObject.h:
        (JSC::TaskContext::~TaskContext):
        Add a new callback to the GlobalObjectMethodTable to post a task on the embedder's runloop.

        (JSC::JSGlobalObject::promisePrototype):
        (JSC::JSGlobalObject::promiseResolverPrototype):
        (JSC::JSGlobalObject::promiseStructure):
        (JSC::JSGlobalObject::promiseResolverStructure):
        (JSC::JSGlobalObject::promiseCallbackStructure):
        (JSC::JSGlobalObject::promiseWrapperCallbackStructure):
        Add supporting code Promise and PromiseResolver's constructors and structures.

        * runtime/JSPromise.cpp: Added.
        * runtime/JSPromise.h: Added.
        * runtime/JSPromiseCallback.cpp: Added.
        * runtime/JSPromiseCallback.h: Added.
        * runtime/JSPromiseConstructor.cpp: Added.
        * runtime/JSPromiseConstructor.h: Added.
        * runtime/JSPromisePrototype.cpp: Added.
        * runtime/JSPromisePrototype.h: Added.
        * runtime/JSPromiseResolver.cpp: Added.
        * runtime/JSPromiseResolver.h: Added.
        * runtime/JSPromiseResolverConstructor.cpp: Added.
        * runtime/JSPromiseResolverConstructor.h: Added.
        * runtime/JSPromiseResolverPrototype.cpp: Added.
        * runtime/JSPromiseResolverPrototype.h: Added.
        Add Promise implementation.

2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416
2013-08-26  Zan Dobersek  <zdobersek@igalia.com>

        Plenty of -Wcast-align warnings in KeywordLookup.h
        https://bugs.webkit.org/show_bug.cgi?id=120316

        Reviewed by Darin Adler.

        * KeywordLookupGenerator.py: Use reinterpret_cast instead of a C-style cast when casting
        the character pointers to types of larger size. This avoids spewing lots of warnings
        in the KeywordLookup.h header when compiling with the -Wcast-align option.

2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430
2013-08-26  Gavin Barraclough  <barraclough@apple.com>

        RegExpMatchesArray should not call [[put]]
        https://bugs.webkit.org/show_bug.cgi?id=120317

        Reviewed by Oliver Hunt.

        This will call accessors on the JSObject/JSArray prototypes - so adding an accessor or read-only
        property called index or input to either of these prototypes will result in broken behavior.

        * runtime/RegExpMatchesArray.cpp:
        (JSC::RegExpMatchesArray::reifyAllProperties):
            - put -> putDirect

2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 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 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503
2013-08-24  Filip Pizlo  <fpizlo@apple.com>

        FloatTypedArrayAdaptor::toJSValue should almost certainly not use jsNumber() since that attempts int conversions
        https://bugs.webkit.org/show_bug.cgi?id=120228

        Reviewed by Oliver Hunt.
        
        It turns out that there were three problems:
        
        - Using jsNumber() meant that we were converting doubles to integers and then
          possibly back again whenever doing a set() between floating point arrays.
        
        - Slow-path accesses to double typed arrays were slower than necessary because
          of the to-int conversion attempt.
        
        - The use of JSValue as an intermediate for converting between differen types
          in typedArray.set() resulted in worse code than I had previously expected.
        
        This patch solves the problem by using template double-dispatch to ensure that
        that C++ compiler sees the simplest possible combination of casts between any
        combination of typed array types, while still preserving JS and typed array
        conversion semantics. Conversions are done as follows:
        
            SourceAdaptor::convertTo<TargetAdaptor>(value)
        
        Internally, convertTo() calls one of three possible methods on TargetAdaptor,
        with one method for each of int32_t, uint32_t, and double. This means that the
        C++ compiler will at worst see a widening cast to one of those types followed
        by a narrowing conversion (not necessarily a cast - may have clamping or the
        JS toInt32() function).
        
        This change doesn't just affect typedArray.set(); it also affects slow-path
        accesses to typed arrays as well. This patch also adds a bunch of new test
        coverage.
        
        This change is a ~50% speed-up on typedArray.set() involving floating point
        types.

        * GNUmakefile.list.am:
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * runtime/GenericTypedArrayView.h:
        (JSC::GenericTypedArrayView::set):
        * runtime/JSDataViewPrototype.cpp:
        (JSC::setData):
        * runtime/JSGenericTypedArrayView.h:
        (JSC::JSGenericTypedArrayView::setIndexQuicklyToDouble):
        (JSC::JSGenericTypedArrayView::setIndexQuickly):
        * runtime/JSGenericTypedArrayViewInlines.h:
        (JSC::::setWithSpecificType):
        (JSC::::set):
        * runtime/ToNativeFromValue.h: Added.
        (JSC::toNativeFromValue):
        * runtime/TypedArrayAdaptors.h:
        (JSC::IntegralTypedArrayAdaptor::toJSValue):
        (JSC::IntegralTypedArrayAdaptor::toDouble):
        (JSC::IntegralTypedArrayAdaptor::toNativeFromInt32):
        (JSC::IntegralTypedArrayAdaptor::toNativeFromUint32):
        (JSC::IntegralTypedArrayAdaptor::toNativeFromDouble):
        (JSC::IntegralTypedArrayAdaptor::convertTo):
        (JSC::FloatTypedArrayAdaptor::toJSValue):
        (JSC::FloatTypedArrayAdaptor::toDouble):
        (JSC::FloatTypedArrayAdaptor::toNativeFromInt32):
        (JSC::FloatTypedArrayAdaptor::toNativeFromUint32):
        (JSC::FloatTypedArrayAdaptor::toNativeFromDouble):
        (JSC::FloatTypedArrayAdaptor::convertTo):
        (JSC::Uint8ClampedAdaptor::toJSValue):
        (JSC::Uint8ClampedAdaptor::toDouble):
        (JSC::Uint8ClampedAdaptor::toNativeFromInt32):
        (JSC::Uint8ClampedAdaptor::toNativeFromUint32):
        (JSC::Uint8ClampedAdaptor::toNativeFromDouble):
        (JSC::Uint8ClampedAdaptor::convertTo):

2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514
2013-08-24  Dan Bernstein  <mitz@apple.com>

        [mac] link against libz in a more civilized manner
        https://bugs.webkit.org/show_bug.cgi?id=120258

        Reviewed by Darin Adler.

        * Configurations/JavaScriptCore.xcconfig: Removed “-lz” from OTHER_LDFLAGS_BASE.
        * JavaScriptCore.xcodeproj/project.pbxproj: Added libz.dylib to the JavaScriptCore target’s
        Link Binary With Libraries build phase.

2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533
2013-08-23  Laszlo Papp  <lpapp@kde.org>

        Failure building with python3
        https://bugs.webkit.org/show_bug.cgi?id=106645

        Reviewed by Benjamin Poulain.

        Use print functions instead of python statements to be compatible with python 3.X and 2.7 as well.
        Archlinux has been using python3 and that is what causes issues while packaging QtWebKit along with Qt5.

        * disassembler/udis86/itab.py:
        (UdItabGenerator.genInsnTable):
        * disassembler/udis86/ud_opcode.py:
        (UdOpcodeTables.print_table):
        * disassembler/udis86/ud_optable.py:
        (UdOptableXmlParser.parseDef):
        (UdOptableXmlParser.parse):
        (printFn):

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 2559
2013-08-23  Filip Pizlo  <fpizlo@apple.com>

        Incorrect TypedArray#set behavior
        https://bugs.webkit.org/show_bug.cgi?id=83818

        Reviewed by Oliver Hunt and Mark Hahnenberg.
        
        This was so much fun! typedArray.set() is like a memmove on steroids, and I'm
        not smart enough to figure out optimal versions for *all* of the cases. But I
        did come up with optimal implementations for most of the cases, and I wrote
        spec-literal code (i.e. copy via a transfer buffer) for the cases I'm not smart
        enough to write optimal code for.

        * runtime/JSArrayBufferView.h:
        (JSC::JSArrayBufferView::hasArrayBuffer):
        * runtime/JSArrayBufferViewInlines.h:
        (JSC::JSArrayBufferView::buffer):
        (JSC::JSArrayBufferView::existingBufferInButterfly):
        (JSC::JSArrayBufferView::neuter):
        (JSC::JSArrayBufferView::byteOffset):
        * runtime/JSGenericTypedArrayView.h:
        * runtime/JSGenericTypedArrayViewInlines.h:
        (JSC::::setWithSpecificType):
        (JSC::::set):
        (JSC::::existingBuffer):

2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575
2013-08-23  Alex Christensen  <achristensen@apple.com>

        Re-separating Win32 and Win64 builds.
        https://bugs.webkit.org/show_bug.cgi?id=120178

        Reviewed by Brent Fulgham.

        * JavaScriptCore.vcxproj/JavaScriptCoreGenerated.make:
        * JavaScriptCore.vcxproj/LLInt/LLIntAssembly/LLIntAssembly.make:
        * JavaScriptCore.vcxproj/LLInt/LLIntDesiredOffsets/LLIntDesiredOffsets.make:
        Pass PlatformArchitecture as a command line parameter to bash scripts.
        * JavaScriptCore.vcxproj/LLInt/LLIntAssembly/build-LLIntAssembly.sh:
        * JavaScriptCore.vcxproj/LLInt/LLIntDesiredOffsets/build-LLIntDesiredOffsets.sh:
        * JavaScriptCore.vcxproj/build-generated-files.sh:
        Use PlatformArchitecture from command line to determine which object directory to use (obj32 or obj64).

2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589
2013-08-22  Filip Pizlo  <fpizlo@apple.com>

        build-jsc --ftl-jit should work
        https://bugs.webkit.org/show_bug.cgi?id=120194

        Reviewed by Oliver Hunt.

        * Configurations/Base.xcconfig: CPPFLAGS should include FEATURE_DEFINES
        * Configurations/JSC.xcconfig: The 'jsc' tool includes headers where field layout may depend on FEATURE_DEFINES
        * Configurations/ToolExecutable.xcconfig: All other tools include headers where field layout may depend on FEATURE_DEFINES
        * ftl/FTLLowerDFGToLLVM.cpp: Build fix
        (JSC::FTL::LowerDFGToLLVM::compilePutStructure):
        (JSC::FTL::LowerDFGToLLVM::compilePhantomPutStructure):

oliver@apple.com's avatar
oliver@apple.com committed
2590 2591 2592 2593 2594 2595
2013-08-23  Oliver Hunt  <oliver@apple.com>

        Re-sort xcode project file

        * JavaScriptCore.xcodeproj/project.pbxproj:

2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610
2013-08-23  Oliver Hunt  <oliver@apple.com>

        Support in memory compression of rarely used data
        https://bugs.webkit.org/show_bug.cgi?id=120143

        Reviewed by Gavin Barraclough.

        Include zlib in LD_FLAGS and make UnlinkedCodeBlock make use of CompressibleVector.  This saves ~200k on google maps.

        * Configurations/JavaScriptCore.xcconfig:
        * bytecode/UnlinkedCodeBlock.cpp:
        (JSC::UnlinkedCodeBlock::expressionRangeForBytecodeOffset):
        (JSC::UnlinkedCodeBlock::addExpressionInfo):
        * bytecode/UnlinkedCodeBlock.h:

2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646
2013-08-22  Mark Hahnenberg  <mhahnenberg@apple.com>

        JSObject and JSArray code shouldn't have to tiptoe around garbage collection
        https://bugs.webkit.org/show_bug.cgi?id=120179

        Reviewed by Geoffrey Garen.

        There are many places in the code for JSObject and JSArray where they are manipulating their 
        Butterfly/Structure, e.g. after expanding their out-of-line backing storage via allocating. Within 
        these places there are certain "critical sections" where a GC would be disastrous. Gen GC looks 
        like it will make this dance even more intricate. To make everybody's lives easier we should use 
        the DeferGC mechanism in these functions to make these GC critical sections both obvious in the 
        code and trivially safe. Deferring collections will usually only last marginally longer, thus we 
        should not incur any additional overhead.

        * heap/Heap.h:
        * runtime/JSArray.cpp:
        (JSC::JSArray::unshiftCountSlowCase):
        * runtime/JSObject.cpp:
        (JSC::JSObject::enterDictionaryIndexingModeWhenArrayStorageAlreadyExists):
        (JSC::JSObject::createInitialUndecided):
        (JSC::JSObject::createInitialInt32):
        (JSC::JSObject::createInitialDouble):
        (JSC::JSObject::createInitialContiguous):
        (JSC::JSObject::createArrayStorage):
        (JSC::JSObject::convertUndecidedToArrayStorage):
        (JSC::JSObject::convertInt32ToArrayStorage):
        (JSC::JSObject::convertDoubleToArrayStorage):
        (JSC::JSObject::convertContiguousToArrayStorage):
        (JSC::JSObject::increaseVectorLength):
        (JSC::JSObject::ensureLengthSlow):
        * runtime/JSObject.h:
        (JSC::JSObject::putDirectInternal):
        (JSC::JSObject::setStructureAndReallocateStorageIfNecessary):
        (JSC::JSObject::putDirectWithoutTransition):

2647 2648 2649 2650 2651 2652 2653 2654 2655 2656
2013-08-22  Filip Pizlo  <fpizlo@apple.com>

        Update LLVM binary drops and scripts to the latest version from SVN