ChangeLog 346 KB
Newer Older
mjs@apple.com's avatar
mjs@apple.com committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
2008-10-06  Maciej Stachowiak  <mjs@apple.com>

        Not reviewed. Build fix.
        
        - revert toBoolean changes (r37333 and r37335); need to make WebCore work with these

        * API/JSValueRef.cpp:
        (JSValueToBoolean):
        * ChangeLog:
        * JavaScriptCore.exp:
        * VM/CodeBlock.cpp:
        (JSC::CodeBlock::dump):
        * VM/Machine.cpp:
        (JSC::Machine::privateExecute):
        (JSC::Machine::cti_op_loop_if_true):
        (JSC::Machine::cti_op_not):
        (JSC::Machine::cti_op_jtrue):
        * kjs/ArrayPrototype.cpp:
        (JSC::arrayProtoFuncFilter):
        (JSC::arrayProtoFuncEvery):
        (JSC::arrayProtoFuncSome):
        * kjs/BooleanConstructor.cpp:
        (JSC::constructBoolean):
        (JSC::callBooleanConstructor):
        * kjs/GetterSetter.h:
        * kjs/JSCell.h:
        (JSC::JSValue::toBoolean):
        * kjs/JSNumberCell.cpp:
        (JSC::JSNumberCell::toBoolean):
        * kjs/JSNumberCell.h:
        * kjs/JSObject.cpp:
        (JSC::JSObject::toBoolean):
        * kjs/JSObject.h:
        * kjs/JSString.cpp:
        (JSC::JSString::toBoolean):
        * kjs/JSString.h:
        * kjs/JSValue.h:
        * kjs/RegExpConstructor.cpp:
        (JSC::setRegExpConstructorMultiline):
        * kjs/RegExpObject.cpp:
        (JSC::RegExpObject::match):
        * kjs/RegExpPrototype.cpp:
        (JSC::regExpProtoFuncToString):

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 85 86 87 88 89 90 91 92 93 94 95 96 97 98
2008-10-06  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Sam Weinig.
        
        - optimize op_jtrue, op_loop_if_true and op_not in various ways
        https://bugs.webkit.org/show_bug.cgi?id=21404
        
        1) Make JSValue::toBoolean nonvirtual and completely inline by
        making use of the StructureID type field.
        
        2) Make JSValue::toBoolean not take an ExecState; doesn't need it.
        
        3) Make op_not, op_loop_if_true and op_jtrue not read the
        ExecState (toBoolean doesn't need it any more) and not check
        exceptions (toBoolean can't throw).

        * API/JSValueRef.cpp:
        (JSValueToBoolean):
        * JavaScriptCore.exp:
        * VM/CodeBlock.cpp:
        (JSC::CodeBlock::dump):
        * VM/Machine.cpp:
        (JSC::Machine::privateExecute):
        (JSC::Machine::cti_op_loop_if_true):
        (JSC::Machine::cti_op_not):
        (JSC::Machine::cti_op_jtrue):
        * kjs/ArrayPrototype.cpp:
        (JSC::arrayProtoFuncFilter):
        (JSC::arrayProtoFuncEvery):
        (JSC::arrayProtoFuncSome):
        * kjs/BooleanConstructor.cpp:
        (JSC::constructBoolean):
        (JSC::callBooleanConstructor):
        * kjs/GetterSetter.h:
        * kjs/JSCell.h:
        (JSC::JSValue::toBoolean):
        * kjs/JSNumberCell.cpp:
        * kjs/JSNumberCell.h:
        (JSC::JSNumberCell::toBoolean):
        * kjs/JSObject.cpp:
        * kjs/JSObject.h:
        (JSC::JSObject::toBoolean):
        (JSC::JSCell::toBoolean):
        * kjs/JSString.cpp:
        * kjs/JSString.h:
        (JSC::JSString::toBoolean):
        * kjs/JSValue.h:
        * kjs/RegExpConstructor.cpp:
        (JSC::setRegExpConstructorMultiline):
        * kjs/RegExpObject.cpp:
        (JSC::RegExpObject::match):
        * kjs/RegExpPrototype.cpp:
        (JSC::regExpProtoFuncToString):

99 100 101 102 103 104 105 106 107 108
2008-10-06  Ariya Hidayat  <ariya.hidayat@trolltech.com>

        Reviewed by Simon.

        Build fix for MinGW.

        * JavaScriptCore.pri:
        * kjs/DateMath.cpp:
        (JSC::highResUpTime):

109 110 111 112 113 114 115 116 117
2008-10-05  Cameron Zwarich  <zwarich@apple.com>

        Reviewed by Oliver Hunt.

        Remove ScopeNode::containsClosures() now that it is unused.

        * kjs/nodes.h:
        (JSC::ScopeNode::containsClosures):

118 119 120 121 122 123 124 125 126 127 128 129
2008-10-05  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Cameron Zwarich.
        
        - fix releas-only test failures caused by the fix to bug 21375

        * VM/Machine.cpp:
        (JSC::Machine::unwindCallFrame): Update ExecState while unwinding call frames;
        it now matters more to have a still-valid ExecState, since dynamicGlobalObject
        will make use of the ExecState's scope chain.
        * VM/Machine.h:

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 167 168 169 170 171 172 173
2008-10-05  Cameron Zwarich  <zwarich@apple.com>

        Reviewed by Oliver Hunt.

        Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
        <https://bugs.webkit.org/show_bug.cgi?id=21364>

        Use information from the parser to detect whether an activation is
        needed or 'arguments' is used, and emit explicit instructions to tear
        them off before op_ret. This allows a branch to be removed from op_ret
        and simplifies some other code. This does cause a small change in the
        behaviour of 'f.arguments'; it is no longer live when 'arguments' is not
        mentioned in the lexical scope of the function.

        It should now be easy to remove the OptionaCalleeActivation slot in the
        call frame, but this will be done in a later patch.

        * VM/CTI.cpp:
        (JSC::CTI::privateCompileMainPass):
        * VM/CodeBlock.cpp:
        (JSC::CodeBlock::dump):
        * VM/CodeGenerator.cpp:
        (JSC::CodeGenerator::emitReturn):
        * VM/CodeGenerator.h:
        * VM/Machine.cpp:
        (JSC::Machine::unwindCallFrame):
        (JSC::Machine::privateExecute):
        (JSC::Machine::retrieveArguments):
        (JSC::Machine::cti_op_create_arguments):
        (JSC::Machine::cti_op_tear_off_activation):
        (JSC::Machine::cti_op_tear_off_arguments):
        * VM/Machine.h:
        * VM/Opcode.h:
        * kjs/Arguments.cpp:
        (JSC::Arguments::mark):
        * kjs/Arguments.h:
        (JSC::Arguments::isTornOff):
        (JSC::Arguments::Arguments):
        (JSC::Arguments::copyRegisters):
        (JSC::JSActivation::copyRegisters):
        * kjs/JSActivation.cpp:
        (JSC::JSActivation::argumentsGetter):
        * kjs/JSActivation.h:

174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
2008-10-05  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Oliver Hunt.
        
        - fixed "REGRESSION (r37297): fast/js/deep-recursion-test takes too long and times out"
        https://bugs.webkit.org/show_bug.cgi?id=21375
        
        The problem is that dynamicGlobalObject had become O(N) in number
        of call frames, but unwinding the stack for an exception called it
        for every call frame, resulting in O(N^2) behavior for an
        exception thrown from inside deep recursion.

        Instead of doing it that way, stash the dynamic global object in JSGlobalData.
        
        * JavaScriptCore.exp:
        * VM/Machine.cpp:
        (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Helper class to temporarily
        store and later restore a dynamicGlobalObject in JSGlobalData.
        (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
        (JSC::Machine::execute): In each version, establish a DynamicGlobalObjectScope.
        For ProgramNode, always establish set new dynamicGlobalObject, for FunctionBody and Eval,
        only if none is currently set.
        * VM/Machine.h:
        * kjs/ExecState.h:
        * kjs/JSGlobalData.cpp:
        (JSC::JSGlobalData::JSGlobalData): Ininitalize new dynamicGlobalObject field to 0.
        * kjs/JSGlobalData.h:
        * kjs/JSGlobalObject.h:
        (JSC::ExecState::dynamicGlobalObject): Moved here from ExecState for benefit of inlining.
        Return lexical global object if this is a globalExec(), otherwise look in JSGlobalData
        for the one stashed there.

206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
2008-10-05  Sam Weinig  <sam@webkit.org>

        Reviewed by Maciej Stachowiak.

        Avoid an extra lookup when transitioning to an existing StructureID
        by caching the offset of property that caused the transition.

        1% win on V8 suite.  Wash on SunSpider.

        * kjs/PropertyMap.cpp:
        (JSC::PropertyMap::put):
        * kjs/PropertyMap.h:
        * kjs/StructureID.cpp:
        (JSC::StructureID::StructureID):
        (JSC::StructureID::addPropertyTransition):
        * kjs/StructureID.h:
        (JSC::StructureID::setCachedTransistionOffset):
        (JSC::StructureID::cachedTransistionOffset):

225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
2008-10-05  Cameron Zwarich  <zwarich@apple.com>

        Reviewed by Maciej Stachowiak.

        Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
        <https://bugs.webkit.org/show_bug.cgi?id=21364>

        This patch does not yet remove the branch, but it does a bit of refactoring
        so that a CodeGenerator now knows whether the associated CodeBlock will need
        a full scope before doing any code generation. This makes it possible to emit
        explicit tear-off instructions before every op_ret.

        * VM/CodeBlock.h:
        (JSC::CodeBlock::CodeBlock):
        * VM/CodeGenerator.cpp:
        (JSC::CodeGenerator::generate):
        (JSC::CodeGenerator::CodeGenerator):
        (JSC::CodeGenerator::emitPushScope):
        (JSC::CodeGenerator::emitPushNewScope):
        * kjs/nodes.h:
        (JSC::ScopeNode::needsActivation):

247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
2008-10-05  Gavin Barraclough  <barraclough@apple.com>

        Reviewed by Cameron Zwarich.

        Fix for bug #21387 - using SamplingTool with CTI.

        (1) A repatch offset offset changes due to an additional instruction to update SamplingTool state.
        (2) Fix an incusion order problem due to ExecState changes.
        (3) Change to a MACHINE_SAMPLING macro, use of exec should now be accessing global data.

        * VM/CTI.h:
        (JSC::CTI::execute):
        * VM/SamplingTool.h:
        (JSC::SamplingTool::privateExecuteReturned):
        * kjs/Shell.cpp:

263 264 265 266 267 268 269 270
2008-10-04  Mark Rowe  <mrowe@apple.com>

        Reviewed by Tim Hatcher.

        Add a 'Check For Weak VTables' build phase to catch weak vtables as early as possible.

        * JavaScriptCore.xcodeproj/project.pbxproj:

271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
2008-10-04  Sam Weinig  <sam@webkit.org>

        Reviewed by Oliver Hunt.

        Fix https://bugs.webkit.org/show_bug.cgi?id=21320
        leaks of PropertyNameArrayData seen on buildbot

        - Fix RefPtr cycle by making PropertyNameArrayData's pointer back
          to the StructureID a weak pointer.

        * kjs/PropertyNameArray.h:
        (JSC::PropertyNameArrayData::setCachedStructureID):
        (JSC::PropertyNameArrayData::cachedStructureID):
        * kjs/StructureID.cpp:
        (JSC::StructureID::getEnumerablePropertyNames):
        (JSC::StructureID::clearEnumerationCache):
        (JSC::StructureID::~StructureID):

darin@apple.com's avatar
darin@apple.com committed
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 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 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 438 439 440 441 442 443 444
2008-10-04  Darin Adler  <darin@apple.com>

        Reviewed by Cameron Zwarich.

        - https://bugs.webkit.org/show_bug.cgi?id=21295
          Bug 21295: Replace ExecState with a call frame Register pointer

        10% faster on Richards; other v8 benchmarks faster too.
        A wash on SunSpider.

        This does the minimum necessary to get the speedup. Next step in
        cleaning this up is to replace ExecState with a CallFrame class,
        and be more judicious about when to pass a call frame and when
        to pass a global data pointer, global object pointer, or perhaps
        something else entirely.

        * VM/CTI.cpp: Remove the debug-only check of the exception in
        ctiVMThrowTrampoline -- already checked in the code the trampoline
        jumps to, so not all that useful. Removed the exec argument from
        ctiTrampoline. Removed emitDebugExceptionCheck -- no longer needed.
        (JSC::CTI::emitCall): Removed code to set ExecState::m_callFrame.
        (JSC::CTI::privateCompileMainPass): Removed code in catch to extract
        the exception from ExecState::m_exception; instead, the code that
        jumps into catch will make sure the exception is already in eax.
        * VM/CTI.h: Removed exec from the ctiTrampoline. Also removed the
        non-helpful "volatile". Temporarily left ARG_exec in as a synonym
        for ARG_r; I'll change that on a future cleanup pass when introducing
        more use of the CallFrame type.
        (JSC::CTI::execute): Removed the ExecState* argument.

        * VM/ExceptionHelpers.cpp:
        (JSC::InterruptedExecutionError::InterruptedExecutionError): Take
        JSGlobalData* instead of ExecState*.
        (JSC::createInterruptedExecutionException): Ditto.
        * VM/ExceptionHelpers.h: Ditto. Also removed an unneeded include.

        * VM/Machine.cpp:
        (JSC::slideRegisterWindowForCall): Removed the exec and
        exceptionValue arguments. Changed to return 0 when there's a stack
        overflow rather than using a separate exception argument to cut
        down on memory accesses in the calling convention.
        (JSC::Machine::unwindCallFrame): Removed the exec argument when
        constructing a DebuggerCallFrame. Also removed code to set
        ExecState::m_callFrame.
        (JSC::Machine::throwException): Removed the exec argument when
        construction a DebuggerCallFrame.
        (JSC::Machine::execute): Updated to use the register instead of
        ExecState and also removed various uses of ExecState.
        (JSC::Machine::debug):
        (JSC::Machine::privateExecute): Put globalData into a local
        variable so it can be used throughout the interpreter. Changed
        the VM_CHECK_EXCEPTION to get the exception in globalData instead
        of through ExecState.
        (JSC::Machine::retrieveLastCaller): Turn exec into a registers
        pointer by calling registers() instead of by getting m_callFrame.
        (JSC::Machine::callFrame): Ditto.
        Tweaked exception macros. Made new versions for when you know
        you have an exception. Get at global exception with ARG_globalData.
        Got rid of the need to pass in the return value type.
        (JSC::Machine::cti_op_add): Update to use new version of exception
        macros.
        (JSC::Machine::cti_op_pre_inc): Ditto.
        (JSC::Machine::cti_timeout_check): Ditto.
        (JSC::Machine::cti_op_instanceof): Ditto.
        (JSC::Machine::cti_op_new_func): Ditto.
        (JSC::Machine::cti_op_call_JSFunction): Optimized by using the
        ARG values directly instead of through local variables -- this gets
        rid of code that just shuffles things around in the stack frame.
        Also get rid of ExecState and update for the new way exceptions are
        handled in slideRegisterWindowForCall.
        (JSC::Machine::cti_vm_compile): Update to make exec out of r since
        they are both the same thing now.
        (JSC::Machine::cti_op_call_NotJSFunction): Ditto.
        (JSC::Machine::cti_op_init_arguments): Ditto.
        (JSC::Machine::cti_op_resolve): Ditto.
        (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
        (JSC::Machine::cti_op_construct_NotJSConstruct): Ditto.
        (JSC::Machine::cti_op_resolve_func): Ditto.
        (JSC::Machine::cti_op_put_by_val): Ditto.
        (JSC::Machine::cti_op_put_by_val_array): Ditto.
        (JSC::Machine::cti_op_resolve_skip): Ditto.
        (JSC::Machine::cti_op_resolve_global): Ditto.
        (JSC::Machine::cti_op_post_inc): Ditto.
        (JSC::Machine::cti_op_resolve_with_base): Ditto.
        (JSC::Machine::cti_op_post_dec): Ditto.
        (JSC::Machine::cti_op_call_eval): Ditto.
        (JSC::Machine::cti_op_throw): Ditto. Also rearranged to return
        the exception value as the return value so it can be used by
        op_catch.
        (JSC::Machine::cti_op_push_scope): Ditto.
        (JSC::Machine::cti_op_in): Ditto.
        (JSC::Machine::cti_op_del_by_val): Ditto.
        (JSC::Machine::cti_vm_throw): Ditto. Also rearranged to return
        the exception value as the return value so it can be used by
        op_catch.

        * kjs/DebuggerCallFrame.cpp:
        (JSC::DebuggerCallFrame::functionName): Pass globalData.
        (JSC::DebuggerCallFrame::evaluate): Eliminated code to make a
        new ExecState.
        * kjs/DebuggerCallFrame.h: Removed ExecState argument from
        constructor.

        * kjs/ExecState.h: Eliminated all data members and made ExecState
        inherit privately from Register instead. Also added a typedef to
        the future name for this class, which is CallFrame. It's just a
        Register* that knows it's a pointer at a call frame. The new class
        can't be constructed or copied. Changed all functions to use
        the this pointer instead of m_callFrame. Changed exception-related
        functions to access an exception in JSGlobalData. Removed functions
        used by CTI to pass the return address to the throw machinery --
        this is now done directly with a global in the global data.

        * kjs/FunctionPrototype.cpp:
        (JSC::functionProtoFuncToString): Pass globalData instead of exec.

        * kjs/InternalFunction.cpp:
        (JSC::InternalFunction::name): Take globalData instead of exec.
        * kjs/InternalFunction.h: Ditto.

        * kjs/JSGlobalData.cpp: Initialize the new exception global to 0.
        * kjs/JSGlobalData.h: Declare two new globals. One for the current
        exception and another for the return address used by CTI to
        implement the throw operation.

        * kjs/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::init): Removed code to set up globalExec,
        which is now the same thing as globalCallFrame.
        (JSC::JSGlobalObject::reset): Get globalExec from our globalExec
        function so we don't have to repeat the logic twice.
        (JSC::JSGlobalObject::mark): Removed code to mark the exception;
        the exception is now stored in JSGlobalData and marked there.
        (JSC::JSGlobalObject::globalExec): Return a pointer to the end
        of the global call frame.
        * kjs/JSGlobalObject.h: Removed the globalExec data member.

        * kjs/JSObject.cpp:
        (JSC::JSObject::putDirectFunction): Pass globalData instead of exec.

        * kjs/collector.cpp:
        (JSC::Heap::collect): Mark the global exception.

        * profiler/ProfileGenerator.cpp:
        (JSC::ProfileGenerator::addParentForConsoleStart): Pass globalData
        instead of exec to createCallIdentifier.

        * profiler/Profiler.cpp:
        (JSC::Profiler::willExecute): Pass globalData instead of exec to
        createCallIdentifier.
        (JSC::Profiler::didExecute): Ditto.
        (JSC::Profiler::createCallIdentifier): Take globalData instead of
        exec.
        (JSC::createCallIdentifierFromFunctionImp): Ditto.
        * profiler/Profiler.h: Change interface to take a JSGlobalData
        instead of an ExecState.

445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466
2008-10-04  Cameron Zwarich  <zwarich@apple.com>

        Reviewed by Darin Adler.

        Bug 21369: Add opcode documentation for all undocumented opcodes
        <https://bugs.webkit.org/show_bug.cgi?id=21369>

        This patch adds opcode documentation for all undocumented opcodes, and
        it also renames op_init_arguments to op_create_arguments.

        * VM/CTI.cpp:
        (JSC::CTI::privateCompileMainPass):
        * VM/CodeBlock.cpp:
        (JSC::CodeBlock::dump):
        * VM/CodeGenerator.cpp:
        (JSC::CodeGenerator::CodeGenerator):
        * VM/Machine.cpp:
        (JSC::Machine::privateExecute):
        (JSC::Machine::cti_op_create_arguments):
        * VM/Machine.h:
        * VM/Opcode.h:

mjs@apple.com's avatar
mjs@apple.com committed
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521
2008-10-03  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Cameron Zwarich.
        
        - "this" object in methods called on primitives should be wrapper object
        https://bugs.webkit.org/show_bug.cgi?id=21362

        I changed things so that functions which use "this" do a fast
        version of toThisObject conversion if needed. Currently we miss
        the conversion entirely, at least for primitive types. Using
        TypeInfo and the primitive check, I made the fast case bail out
        pretty fast.
        
        This is inexplicably an 1.007x SunSpider speedup (and a wash on V8 benchmarks).
     
        Also renamed some opcodes for clarity:
        
        init ==> enter
        init_activation ==> enter_with_activation
        
        * VM/CTI.cpp:
        (JSC::CTI::privateCompileMainPass):
        (JSC::CTI::privateCompileSlowCases):
        * VM/CodeBlock.cpp:
        (JSC::CodeBlock::dump):
        * VM/CodeGenerator.cpp:
        (JSC::CodeGenerator::generate):
        (JSC::CodeGenerator::CodeGenerator):
        * VM/Machine.cpp:
        (JSC::Machine::privateExecute):
        (JSC::Machine::cti_op_convert_this):
        * VM/Machine.h:
        * VM/Opcode.h:
        * kjs/JSActivation.cpp:
        (JSC::JSActivation::JSActivation):
        * kjs/JSActivation.h:
        (JSC::JSActivation::createStructureID):
        * kjs/JSCell.h:
        (JSC::JSValue::needsThisConversion):
        * kjs/JSGlobalData.cpp:
        (JSC::JSGlobalData::JSGlobalData):
        * kjs/JSGlobalData.h:
        * kjs/JSNumberCell.h:
        (JSC::JSNumberCell::createStructureID):
        * kjs/JSStaticScopeObject.h:
        (JSC::JSStaticScopeObject::JSStaticScopeObject):
        (JSC::JSStaticScopeObject::createStructureID):
        * kjs/JSString.h:
        (JSC::JSString::createStructureID):
        * kjs/JSValue.h:
        * kjs/TypeInfo.h:
        (JSC::TypeInfo::needsThisConversion):
        * kjs/nodes.h:
        (JSC::ScopeNode::usesThis):

522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
2008-10-03  Cameron Zwarich  <zwarich@apple.com>

        Reviewed by Maciej Stachowiak.

        Bug 21356: The size of the RegisterFile differs depending on 32-bit / 64-bit and Debug / Release
        <https://bugs.webkit.org/show_bug.cgi?id=21356>

        The RegisterFile decreases in size (measured in terms of numbers of
        Registers) as the size of a Register increases. This causes

            js1_5/Regress/regress-159334.js

        to fail in 64-bit debug builds. This fix makes the RegisterFile on all
        platforms the same size that it is in 32-bit Release builds.

        * VM/RegisterFile.h:
        (JSC::RegisterFile::RegisterFile):

540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575
2008-10-03  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Cameron Zwarich.
        
        - Some code cleanup to how we handle code features.
        
        1) Rename FeatureInfo typedef to CodeFeatures.
        2) Rename NodeFeatureInfo template to NodeInfo.
        3) Keep CodeFeature bitmask in ScopeNode instead of trying to break it out into individual bools.
        4) Rename misleadingly named "needsClosure" method to "containsClosures", which better describes the meaning
        of ClosureFeature.
        5) Make setUsersArguments() not take an argument since it only goes one way.

        * JavaScriptCore.exp:
        * VM/CodeBlock.h:
        (JSC::CodeBlock::CodeBlock):
        * kjs/NodeInfo.h:
        * kjs/Parser.cpp:
        (JSC::Parser::didFinishParsing):
        * kjs/Parser.h:
        (JSC::Parser::parse):
        * kjs/grammar.y:
        * kjs/nodes.cpp:
        (JSC::ScopeNode::ScopeNode):
        (JSC::ProgramNode::ProgramNode):
        (JSC::ProgramNode::create):
        (JSC::EvalNode::EvalNode):
        (JSC::EvalNode::create):
        (JSC::FunctionBodyNode::FunctionBodyNode):
        (JSC::FunctionBodyNode::create):
        * kjs/nodes.h:
        (JSC::ScopeNode::usesEval):
        (JSC::ScopeNode::containsClosures):
        (JSC::ScopeNode::usesArguments):
        (JSC::ScopeNode::setUsesArguments):

576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599
2008-10-03  Cameron Zwarich  <zwarich@apple.com>

        Reviewed by Maciej Stachowiak.

        Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
        <https://bugs.webkit.org/show_bug.cgi?id=21343>

        A fix was landed for this issue in r37253, and the ChangeLog assumes
        that it is a compiler bug, but it turns out that it is a subtle issue
        with mixing signed and unsigned 32-bit values in a 64-bit environment.
        In order to properly fix this bug, we should convert our signed offsets
        into the register file to use ptrdiff_t.

        This may not be the only instance of this issue, but I will land this
        fix first and look for more later.

        * VM/Machine.cpp:
        (JSC::Machine::getArgumentsData):
        * VM/Machine.h:
        * kjs/Arguments.cpp:
        (JSC::Arguments::getOwnPropertySlot):
        * kjs/Arguments.h:
        (JSC::Arguments::init):

600 601 602 603 604 605 606
2008-10-03  Darin Adler  <darin@apple.com>

        * VM/CTI.cpp: Another Windows build fix. Change the args of ctiTrampoline.

        * kjs/JSNumberCell.h: A build fix for newer versions of gcc. Added
        declarations of JSGlobalData overloads of jsNumberCell.

607 608 609 610 611 612
2008-10-03  Darin Adler  <darin@apple.com>

        - try to fix Windows build

        * kjs/ScopeChain.h: Add forward declaration of JSGlobalData.

darin@apple.com's avatar
darin@apple.com committed
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 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802
2008-10-03  Darin Adler  <darin@apple.com>

        Reviewed by Geoff Garen.

        - next step of https://bugs.webkit.org/show_bug.cgi?id=21295
          Turn ExecState into a call frame pointer.

        Remove m_globalObject and m_globalData from ExecState.

        SunSpider says this is a wash (slightly faster but not statistically
        significant); which is good enough since it's a preparation step and
        not supposed to be a spedup.

        * API/JSCallbackFunction.cpp:
        (JSC::JSCallbackFunction::JSCallbackFunction):
        * kjs/ArrayConstructor.cpp:
        (JSC::ArrayConstructor::ArrayConstructor):
        * kjs/BooleanConstructor.cpp:
        (JSC::BooleanConstructor::BooleanConstructor):
        * kjs/DateConstructor.cpp:
        (JSC::DateConstructor::DateConstructor):
        * kjs/ErrorConstructor.cpp:
        (JSC::ErrorConstructor::ErrorConstructor):
        * kjs/FunctionPrototype.cpp:
        (JSC::FunctionPrototype::FunctionPrototype):
        * kjs/JSFunction.cpp:
        (JSC::JSFunction::JSFunction):
        * kjs/NativeErrorConstructor.cpp:
        (JSC::NativeErrorConstructor::NativeErrorConstructor):
        * kjs/NumberConstructor.cpp:
        (JSC::NumberConstructor::NumberConstructor):
        * kjs/ObjectConstructor.cpp:
        (JSC::ObjectConstructor::ObjectConstructor):
        * kjs/PrototypeFunction.cpp:
        (JSC::PrototypeFunction::PrototypeFunction):
        * kjs/RegExpConstructor.cpp:
        (JSC::RegExpConstructor::RegExpConstructor):
        * kjs/StringConstructor.cpp:
        (JSC::StringConstructor::StringConstructor):
        Pass JSGlobalData* instead of ExecState* to the InternalFunction
        constructor.

        * API/OpaqueJSString.cpp: Added now-needed include.

        * JavaScriptCore.exp: Updated.

        * VM/CTI.cpp:
        (JSC::CTI::emitSlowScriptCheck): Changed to use ARGS_globalData
        instead of ARGS_exec.

        * VM/CTI.h: Added a new argument to the CTI, the global data pointer.
        While it's possible to get to the global data pointer using the
        ExecState pointer, it's slow enough that it's better to just keep
        it around in the CTI arguments.

        * VM/CodeBlock.h: Moved the CodeType enum here from ExecState.h.

        * VM/Machine.cpp:
        (JSC::Machine::execute): Pass fewer arguments when constructing
        ExecState, and pass the global data pointer when invoking CTI.
        (JSC::Machine::firstCallFrame): Added. Used to get the dynamic global
        object, which is in the scope chain of the first call frame.
        (JSC::Machine::cti_op_add): Use globalData instead of exec when
        possible, to keep fast cases fast, since it's now more expensive to
        get to it through the exec pointer.
        (JSC::Machine::cti_timeout_check): Ditto.
        (JSC::Machine::cti_op_put_by_id_second): Ditto.
        (JSC::Machine::cti_op_get_by_id_second): Ditto.
        (JSC::Machine::cti_op_mul): Ditto.
        (JSC::Machine::cti_vm_compile): Ditto.
        (JSC::Machine::cti_op_get_by_val): Ditto.
        (JSC::Machine::cti_op_sub): Ditto.
        (JSC::Machine::cti_op_put_by_val): Ditto.
        (JSC::Machine::cti_op_put_by_val_array): Ditto.
        (JSC::Machine::cti_op_negate): Ditto.
        (JSC::Machine::cti_op_div): Ditto.
        (JSC::Machine::cti_op_pre_dec): Ditto.
        (JSC::Machine::cti_op_post_inc): Ditto.
        (JSC::Machine::cti_op_lshift): Ditto.
        (JSC::Machine::cti_op_bitand): Ditto.
        (JSC::Machine::cti_op_rshift): Ditto.
        (JSC::Machine::cti_op_bitnot): Ditto.
        (JSC::Machine::cti_op_mod): Ditto.
        (JSC::Machine::cti_op_post_dec): Ditto.
        (JSC::Machine::cti_op_urshift): Ditto.
        (JSC::Machine::cti_op_bitxor): Ditto.
        (JSC::Machine::cti_op_bitor): Ditto.
        (JSC::Machine::cti_op_call_eval): Ditto.
        (JSC::Machine::cti_op_throw): Ditto.
        (JSC::Machine::cti_op_is_string): Ditto.
        (JSC::Machine::cti_op_debug): Ditto.
        (JSC::Machine::cti_vm_throw): Ditto.

        * VM/Machine.h: Added firstCallFrame.

        * kjs/DebuggerCallFrame.cpp:
        (JSC::DebuggerCallFrame::evaluate): Pass fewer arguments when
        constructing ExecState.

        * kjs/ExecState.cpp: Deleted contents. Later we'll remove the
        file altogether.

        * kjs/ExecState.h: Removed m_globalObject and m_globalData.
        Moved CodeType into another header.
        (JSC::ExecState::ExecState): Take only a single argument, a
        call frame pointer.
        (JSC::ExecState::dynamicGlobalObject): Get the object from
        the first call frame since it's no longer stored.
        (JSC::ExecState::globalData): Get the global data from the
        scope chain, since we no longer store a pointer to it here.
        (JSC::ExecState::identifierTable): Ditto.
        (JSC::ExecState::propertyNames): Ditto.
        (JSC::ExecState::emptyList): Ditto.
        (JSC::ExecState::lexer): Ditto.
        (JSC::ExecState::parser): Ditto.
        (JSC::ExecState::machine): Ditto.
        (JSC::ExecState::arrayTable): Ditto.
        (JSC::ExecState::dateTable): Ditto.
        (JSC::ExecState::mathTable): Ditto.
        (JSC::ExecState::numberTable): Ditto.
        (JSC::ExecState::regExpTable): Ditto.
        (JSC::ExecState::regExpConstructorTable): Ditto.
        (JSC::ExecState::stringTable): Ditto.
        (JSC::ExecState::heap): Ditto.

        * kjs/FunctionConstructor.cpp:
        (JSC::FunctionConstructor::FunctionConstructor): Pass
        JSGlobalData* instead of ExecState* to the InternalFunction
        constructor.
        (JSC::constructFunction): Pass the global data pointer when
        constructing a new scope chain.

        * kjs/InternalFunction.cpp:
        (JSC::InternalFunction::InternalFunction): Take a JSGlobalData*
        instead of an ExecState*. Later we can change more places to
        work this way -- it's more efficient to take the type you need
        since the caller might already have it.
        * kjs/InternalFunction.h: Ditto.

        * kjs/JSCell.h:
        (JSC::JSCell::operator new): Added an overload that takes a
        JSGlobalData* so you can construct without an ExecState*.

        * kjs/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::init): Moved creation of the global scope
        chain in here, since it now requires a pointer to the global data.
        Moved the initialization of the call frame in here since it requires
        the global scope chain node. Removed the extra argument to ExecState
        when creating the global ExecState*.
        * kjs/JSGlobalObject.h: Removed initialization of globalScopeChain
        and the call frame from the JSGlobalObjectData constructor. Added
        a thisValue argument to the init function.

        * kjs/JSNumberCell.cpp: Added versions of jsNumberCell that take
        JSGlobalData* rather than ExecState*.
        * kjs/JSNumberCell.h:
        (JSC::JSNumberCell::operator new): Added a version that takes
        JSGlobalData*.
        (JSC::JSNumberCell::JSNumberCell): Ditto.
        (JSC::jsNumber): Ditto.
        * kjs/JSString.cpp:
        (JSC::jsString): Ditto.
        (JSC::jsSubstring): Ditto.
        (JSC::jsOwnedString): Ditto.
        * kjs/JSString.h:
        (JSC::JSString::JSString): Changed to take JSGlobalData*.
        (JSC::jsEmptyString): Added a version that takes JSGlobalData*.
        (JSC::jsSingleCharacterString): Ditto.
        (JSC::jsSingleCharacterSubstring): Ditto.
        (JSC::jsNontrivialString): Ditto.
        (JSC::JSString::getIndex): Ditto.
        (JSC::jsString): Ditto.
        (JSC::jsSubstring): Ditto.
        (JSC::jsOwnedString): Ditto.

        * kjs/ScopeChain.h: Added a globalData pointer to each node.
        (JSC::ScopeChainNode::ScopeChainNode): Initialize the globalData
        pointer.
        (JSC::ScopeChainNode::push): Set the global data pointer in the
        new node.
        (JSC::ScopeChain::ScopeChain): Take a globalData argument.

        * kjs/SmallStrings.cpp:
        (JSC::SmallStrings::createEmptyString): Take JSGlobalData* instead of
        ExecState*.
        (JSC::SmallStrings::createSingleCharacterString): Ditto.
        * kjs/SmallStrings.h:
        (JSC::SmallStrings::emptyString): Ditto.
        (JSC::SmallStrings::singleCharacterString): Ditto.

803 804 805 806 807 808 809 810 811 812 813 814 815 816
2008-10-03  Cameron Zwarich  <zwarich@apple.com>

        Reviewed by Geoff Garen.

        Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
        <https://bugs.webkit.org/show_bug.cgi?id=21343>

        Add a workaround for a bug in GCC, which affects GCC 4.0, GCC 4.2, and
        llvm-gcc 4.2. I put it in an #ifdef because it was a slight regression
        on SunSpider in 32-bit, although that might be entirely random.

        * kjs/Arguments.cpp:
        (JSC::Arguments::getOwnPropertySlot):

817 818 819 820 821 822 823
2008-10-03  Darin Adler  <darin@apple.com>

        Rubber stamped by Alexey Proskuryakov.

        * kjs/Shell.cpp: (main): Don't delete JSGlobalData. Later, we need to change
        this tool to use public JavaScriptCore API instead.

824 825 826 827 828 829 830 831 832 833 834
2008-10-03  Darin Adler  <darin@apple.com>

        Suggested by Alexey Proskuryakov.

        * kjs/JSGlobalData.cpp:
        (JSC::JSGlobalData::~JSGlobalData): Remove call to heap.destroy() because
        it's too late to ref the JSGlobalData object once it's already being
        destroyed. In practice this is not a problem because WebCore's JSGlobalData
        is never destroyed and JSGlobalContextRelease takes care of calling
        heap.destroy() in advance.

835 836 837 838 839 840 841 842 843 844 845 846 847
2008-10-02  Oliver Hunt  <oliver@apple.com>

        Reviewed by Maciej Stachowiak.

        Replace SSE3 check with an SSE2 check, and implement SSE2 check on windows.

        5.6% win on SunSpider on windows.

        * VM/CTI.cpp:
        (JSC::isSSE2Present):
        (JSC::CTI::compileBinaryArithOp):
        (JSC::CTI::compileBinaryArithOpSlowCase):

848 849 850 851 852 853 854 855
2008-10-03  Maciej Stachowiak  <mjs@apple.com>

        Rubber stamped by Cameron Zwarich.
        
        - fix mistaken change of | to || which caused a big perf regression on EarleyBoyer

        * kjs/grammar.y:

darin@apple.com's avatar
darin@apple.com committed
856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918
2008-10-02  Darin Adler  <darin@apple.com>

        Reviewed by Geoff Garen.

        - https://bugs.webkit.org/show_bug.cgi?id=21321
          Bug 21321: speed up JavaScriptCore by inlining Heap in JSGlobalData

        1.019x as fast on SunSpider.

        * API/JSBase.cpp:
        (JSEvaluateScript): Use heap. instead of heap-> to work with the heap.
        (JSCheckScriptSyntax): Ditto.
        (JSGarbageCollect): Ditto.
        (JSReportExtraMemoryCost): Ditto.
        * API/JSContextRef.cpp:
        (JSGlobalContextRetain): Ditto.
        (JSGlobalContextRelease): Destroy the heap with the destroy function instead
        of the delete operator.
        (JSContextGetGlobalObject): Use heap. instead of heap-> to work with the heap.
        * API/JSObjectRef.cpp:
        (JSObjectMake): Use heap. instead of heap-> to work with the heap.
        (JSObjectMakeFunctionWithCallback): Ditto.
        (JSObjectMakeConstructor): Ditto.
        (JSObjectMakeFunction): Ditto.
        (JSObjectMakeArray): Ditto.
        (JSObjectMakeDate): Ditto.
        (JSObjectMakeError): Ditto.
        (JSObjectMakeRegExp): Ditto.
        (JSObjectHasProperty): Ditto.
        (JSObjectGetProperty): Ditto.
        (JSObjectSetProperty): Ditto.
        (JSObjectGetPropertyAtIndex): Ditto.
        (JSObjectSetPropertyAtIndex): Ditto.
        (JSObjectDeleteProperty): Ditto.
        (JSObjectCallAsFunction): Ditto.
        (JSObjectCallAsConstructor): Ditto.
        (JSObjectCopyPropertyNames): Ditto.
        (JSPropertyNameAccumulatorAddName): Ditto.
        * API/JSValueRef.cpp:
        (JSValueIsEqual): Ditto.
        (JSValueIsInstanceOfConstructor): Ditto.
        (JSValueMakeNumber): Ditto.
        (JSValueMakeString): Ditto.
        (JSValueToNumber): Ditto.
        (JSValueToStringCopy): Ditto.
        (JSValueToObject): Ditto.
        (JSValueProtect): Ditto.
        (JSValueUnprotect): Ditto.

        * kjs/ExecState.h:
        (JSC::ExecState::heap): Update to use the & operator.

        * kjs/JSGlobalData.cpp:
        (JSC::JSGlobalData::JSGlobalData): Update to initialize a heap member
        instead of calling new to make a heap.
        (JSC::JSGlobalData::~JSGlobalData): Destroy the heap with the destroy
        function instead of the delete operator.
        * kjs/JSGlobalData.h: Change from Heap* to a Heap.
        * kjs/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::mark): Use the & operator here.
        (JSC::JSGlobalObject::operator new): Use heap. instead of heap-> to work
        with the heap.

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
2008-10-02  Cameron Zwarich  <zwarich@apple.com>

        Reviewed by Geoff Garen.

        Bug 21317: Replace RegisterFile size and capacity information with Register pointers
        <https://bugs.webkit.org/show_bug.cgi?id=21317>

        This is a 2.3% speedup on the V8 DeltaBlue benchmark, a 3.3% speedup on
        the V8 Raytrace benchmark, and a 1.0% speedup on SunSpider.

        * VM/Machine.cpp:
        (JSC::slideRegisterWindowForCall):
        (JSC::Machine::callEval):
        (JSC::Machine::execute):
        (JSC::Machine::privateExecute):
        (JSC::Machine::cti_op_call_JSFunction):
        (JSC::Machine::cti_op_construct_JSConstruct):
        * VM/RegisterFile.cpp:
        (JSC::RegisterFile::~RegisterFile):
        * VM/RegisterFile.h:
        (JSC::RegisterFile::RegisterFile):
        (JSC::RegisterFile::start):
        (JSC::RegisterFile::end):
        (JSC::RegisterFile::size):
        (JSC::RegisterFile::shrink):
        (JSC::RegisterFile::grow):
        (JSC::RegisterFile::lastGlobal):
        (JSC::RegisterFile::markGlobals):
        (JSC::RegisterFile::markCallFrames):
        * kjs/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::copyGlobalsTo):

951 952 953 954 955 956 957 958 959 960 961
2008-10-02  Cameron Zwarich  <zwarich@apple.com>

        Rubber-stamped by Darin Adler.

        Change bitwise operations introduced in r37166 to boolean operations. We
        only use bitwise operations over boolean operations for increasing
        performance in extremely hot code, but that does not apply to anything
        in the parser.

        * kjs/grammar.y:

barraclough@apple.com's avatar
barraclough@apple.com committed
962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981
2008-10-02  Gavin Barraclough  <barraclough@apple.com>

        Reviewed by Darin Adler.

        Fix for bug #21232 - should reset m_isPendingDash on flush,
        and should allow '\-' as beginning or end of a range (though
        not to specifiy a range itself).

        * ChangeLog:
        * wrec/CharacterClassConstructor.cpp:
        (JSC::CharacterClassConstructor::put):
        (JSC::CharacterClassConstructor::flush):
        * wrec/CharacterClassConstructor.h:
        (JSC::CharacterClassConstructor::flushBeforeEscapedHyphen):
        * wrec/WREC.cpp:
        (JSC::WRECGenerator::generateDisjunction):
        (JSC::WRECParser::parseCharacterClass):
        (JSC::WRECParser::parseDisjunction):
        * wrec/WREC.h:

982 983 984 985 986 987 988 989 990 991
2008-10-02  Darin Adler  <darin@apple.com>

        Reviewed by Sam Weinig.

        - remove the "static" from declarations in a header file, since we
          don't want them to have internal linkage

        * VM/Machine.h: Remove the static keyword from the constant and the
        three inline functions that Geoff just moved here.

992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010
2008-10-02  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Sam Weinig.
        
        Fixed https://bugs.webkit.org/show_bug.cgi?id=21283.
        Profiler Crashes When Started

        * VM/Machine.cpp:
        * VM/Machine.h:
        (JSC::makeHostCallFramePointer):
        (JSC::isHostCallFrame):
        (JSC::stripHostCallFrameBit): Moved some things to the header so
        JSGlobalObject could use them.

        * kjs/JSGlobalObject.h:
        (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Call the
        new makeHostCallFramePointer API, since 0 no longer indicates a host
        call frame.

ap@webkit.org's avatar
ap@webkit.org committed
1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027
2008-10-02  Alexey Proskuryakov  <ap@webkit.org>

        Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=21304
        Stop using a static wrapper map for WebCore JS bindings

        * kjs/JSGlobalData.cpp:
        (JSC::JSGlobalData::JSGlobalData):
        (JSC::JSGlobalData::~JSGlobalData):
        (JSC::JSGlobalData::ClientData::~ClientData):
        * kjs/JSGlobalData.h:
        Added a client data member to JSGlobalData. WebCore will use it to store bindings-related
        global data.

        * JavaScriptCore.exp: Export virtual ClientData destructor.

1028 1029 1030 1031 1032 1033 1034 1035
2008-10-02  Geoffrey Garen  <ggaren@apple.com>

        Not reviewed.
        
        Try to fix Qt build.

        * kjs/Error.h:

ggaren@apple.com's avatar
ggaren@apple.com committed
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 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178
2008-10-01  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Darin Adler and Cameron Zwarich.

        Preliminary step toward dynamic recompilation: Standardized and
        simplified the parsing interface.
        
        The main goal in this patch is to make it easy to ask for a duplicate
        compilation, and get back a duplicate result -- same source URL, same
        debugger / profiler ID, same toString behavior, etc.
        
        The basic unit of compilation and evaluation is now SourceCode, which
        encompasses a SourceProvider, a range in that provider, and a starting
        line number.

        A SourceProvider now encompasses a source URL, and *is* a source ID,
        since a pointer is a unique identifier.

        * API/JSBase.cpp:
        (JSEvaluateScript):
        (JSCheckScriptSyntax): Provide a SourceCode to the Interpreter, since
        other APIs are no longer supported.
        
        * VM/CodeBlock.h:
        (JSC::EvalCodeCache::get): Provide a SourceCode to the Interpreter, since
        other APIs are no longer supported.
        (JSC::CodeBlock::CodeBlock): ASSERT something that used to be ASSERTed
        by our caller -- this is a better bottleneck.

        * VM/CodeGenerator.cpp:
        (JSC::CodeGenerator::CodeGenerator): Updated for the fact that
        FunctionBodyNode's parameters are no longer a WTF::Vector.

        * kjs/Arguments.cpp:
        (JSC::Arguments::Arguments): ditto

        * kjs/DebuggerCallFrame.cpp:
        (JSC::DebuggerCallFrame::evaluate): Provide a SourceCode to the Parser,
        since other APIs are no longer supported.

        * kjs/FunctionConstructor.cpp:
        (JSC::constructFunction): Provide a SourceCode to the Parser, since
        other APIs are no longer supported. Adopt FunctionBodyNode's new
        "finishParsing" API.

        * kjs/JSFunction.cpp:
        (JSC::JSFunction::lengthGetter):
        (JSC::JSFunction::getParameterName): Updated for the fact that
        FunctionBodyNode's parameters are no longer a wtf::Vector.

        * kjs/JSFunction.h: Nixed some cruft.

        * kjs/JSGlobalObjectFunctions.cpp:
        (JSC::globalFuncEval): Provide a SourceCode to the Parser, since
        other APIs are no longer supported. 

        * kjs/Parser.cpp:
        (JSC::Parser::parse): Require a SourceCode argument, instead of a bunch
        of broken out parameters. Stop tracking sourceId as an integer, since we
        use the SourceProvider pointer for this now. Don't clamp the
        startingLineNumber, since SourceCode does that now.

        * kjs/Parser.h:
        (JSC::Parser::parse): Standardized the parsing interface to require a
        SourceCode.

        * kjs/Shell.cpp:
        (functionRun):
        (functionLoad):
        (prettyPrintScript):
        (runWithScripts):
        (runInteractive): Provide a SourceCode to the Interpreter, since
        other APIs are no longer supported.

        * kjs/SourceProvider.h:
        (JSC::SourceProvider::SourceProvider):
        (JSC::SourceProvider::url):
        (JSC::SourceProvider::asId):
        (JSC::UStringSourceProvider::create):
        (JSC::UStringSourceProvider::UStringSourceProvider): Added new
        responsibilities described above.

        * kjs/SourceRange.h:
        (JSC::SourceCode::SourceCode):
        (JSC::SourceCode::toString):
        (JSC::SourceCode::provider):
        (JSC::SourceCode::firstLine):
        (JSC::SourceCode::data):
        (JSC::SourceCode::length): Added new responsibilities described above.
        Renamed SourceRange to SourceCode, based on review feedback. Added
        a makeSource function for convenience.

        * kjs/debugger.h: Provide a SourceCode to the client, since other APIs
        are no longer supported.

        * kjs/grammar.y: Provide startingLineNumber when creating a SourceCode.

        * kjs/debugger.h: Treat sourceId as intptr_t to avoid loss of precision
        on 64bit platforms.

        * kjs/interpreter.cpp:
        (JSC::Interpreter::checkSyntax):
        (JSC::Interpreter::evaluate):
        * kjs/interpreter.h: Require a SourceCode instead of broken out arguments.

        * kjs/lexer.cpp:
        (JSC::Lexer::setCode):
        * kjs/lexer.h:
        (JSC::Lexer::sourceRange): Fold together the SourceProvider and line number
        into a SourceCode. Fixed a bug where the Lexer would accidentally keep
        alive the last SourceProvider forever.

        * kjs/nodes.cpp:
        (JSC::ScopeNode::ScopeNode):
        (JSC::ProgramNode::ProgramNode):
        (JSC::ProgramNode::create):
        (JSC::EvalNode::EvalNode):
        (JSC::EvalNode::generateCode):
        (JSC::EvalNode::create):
        (JSC::FunctionBodyNode::FunctionBodyNode):
        (JSC::FunctionBodyNode::finishParsing):
        (JSC::FunctionBodyNode::create):
        (JSC::FunctionBodyNode::generateCode):
        (JSC::ProgramNode::generateCode):
        (JSC::FunctionBodyNode::paramString):
        * kjs/nodes.h:
        (JSC::ScopeNode::):
        (JSC::ScopeNode::sourceId):
        (JSC::FunctionBodyNode::):
        (JSC::FunctionBodyNode::parameterCount):
        (JSC::FuncExprNode::):
        (JSC::FuncDeclNode::): Store a SourceCode in all ScopeNodes, since
        SourceCode is now responsible for tracking URL, ID, etc. Streamlined
        some ad hoc FunctionBodyNode fixups into a "finishParsing" function, to
        help make clear what you need to do in order to finish parsing a
        FunctionBodyNode.

        * wtf/Vector.h:
        (WTF::::releaseBuffer): Don't ASSERT that releaseBuffer() is only called
        when buffer is not 0, since FunctionBodyNode is more than happy
        to get back a 0 buffer, and other functions like RefPtr::release() allow
        for 0, too.

1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197
2008-10-01  Cameron Zwarich  <zwarich@apple.com>

        Reviewed by Maciej Stachowiak.

        Bug 21289: REGRESSION (r37160): Inspector crashes on load
        <https://bugs.webkit.org/show_bug.cgi?id=21289>

        The code in Arguments::mark() in r37160 was wrong. It marks indices in
        d->registers, but that makes no sense (they are local variables, not
        arguments). It should mark those indices in d->registerArray instead.

        This patch also changes Arguments::copyRegisters() to use d->numParameters
        instead of recomputing it.

        * kjs/Arguments.cpp:
        (JSC::Arguments::mark):
        * kjs/Arguments.h:
        (JSC::Arguments::copyRegisters):

1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235
2008-09-30  Darin Adler  <darin@apple.com>

        Reviewed by Eric Seidel.

        - https://bugs.webkit.org/show_bug.cgi?id=21214
          work on getting rid of ExecState

        Eliminate some unneeded uses of dynamicGlobalObject.

        * API/JSClassRef.cpp:
        (OpaqueJSClass::contextData): Changed to use a map in the global data instead
        of on the global object. Also fixed to use only a single hash table lookup.

        * API/JSObjectRef.cpp:
        (JSObjectMakeConstructor): Use lexicalGlobalObject rather than dynamicGlobalObject
        to get the object prototype.

        * kjs/ArrayPrototype.cpp:
        (JSC::arrayProtoFuncToString): Use arrayVisitedElements set in global data rather
        than in the global object.
        (JSC::arrayProtoFuncToLocaleString): Ditto.
        (JSC::arrayProtoFuncJoin): Ditto.

        * kjs/JSGlobalData.cpp:
        (JSC::JSGlobalData::JSGlobalData): Don't initialize opaqueJSClassData, since
        it's no longer a pointer.
        (JSC::JSGlobalData::~JSGlobalData): We still need to delete all the values, but
        we don't need to delete the map since it's no longer a pointer.

        * kjs/JSGlobalData.h: Made opaqueJSClassData a map instead of a pointer to a map.
        Also added arrayVisitedElements.

        * kjs/JSGlobalObject.h: Removed arrayVisitedElements.

        * kjs/Shell.cpp:
        (functionRun): Use lexicalGlobalObject instead of dynamicGlobalObject.
        (functionLoad): Ditto.

1236 1237 1238 1239 1240 1241 1242 1243
2008-10-01  Cameron Zwarich  <zwarich@apple.com>

        Not reviewed.

        Speculative Windows build fix.

        * kjs/grammar.y:

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 1300 1301 1302 1303 1304 1305
2008-10-01  Cameron Zwarich  <zwarich@apple.com>

        Reviewed by Darin Adler.

        Bug 21123: using "arguments" in a function should not force creation of an activation object
        <https://bugs.webkit.org/show_bug.cgi?id=21123>

        Make the 'arguments' object not require a JSActivation. We store the
        'arguments' object in the OptionalCalleeArguments call frame slot. We
        need to be able to get the original 'arguments' object to tear it off
        when returning from a function, but 'arguments' may be assigned to in a
        number of ways.

        Therefore, we use the OptionalCalleeArguments slot when we want to get
        the original activation or we know that 'arguments' was not assigned a
        different value. When 'arguments' may have been assigned a new value,
        we use a new local variable that is initialized with 'arguments'. Since
        a function parameter named 'arguments' may overwrite the value of
        'arguments', we also need to be careful to look up 'arguments' in the
        symbol table, so we get the parameter named 'arguments' instead of the
        local variable that we have added for holding the 'arguments' object.

        This is a 19.1% win on the V8 Raytrace benchmark using the SunSpider
        harness, and a 20.7% win using the V8 harness. This amounts to a 6.5%
        total speedup on the V8 benchmark suite using the V8 harness.

        * VM/CTI.cpp:
        (JSC::CTI::privateCompileMainPass):
        * VM/CodeBlock.h:
        * VM/CodeGenerator.cpp:
        (JSC::CodeGenerator::CodeGenerator):
        * VM/Machine.cpp:
        (JSC::Machine::unwindCallFrame):
        (JSC::Machine::privateExecute):
        (JSC::Machine::retrieveArguments):
        (JSC::Machine::cti_op_init_arguments):
        (JSC::Machine::cti_op_ret_activation_arguments):
        * VM/Machine.h:
        * VM/RegisterFile.h:
        (JSC::RegisterFile::):
        * kjs/Arguments.cpp:
        (JSC::Arguments::mark):
        (JSC::Arguments::fillArgList):
        (JSC::Arguments::getOwnPropertySlot):
        (JSC::Arguments::put):
        * kjs/Arguments.h:
        (JSC::Arguments::setRegisters):
        (JSC::Arguments::init):
        (JSC::Arguments::Arguments):
        (JSC::Arguments::copyRegisters):
        (JSC::JSActivation::copyRegisters):
        * kjs/JSActivation.cpp:
        (JSC::JSActivation::argumentsGetter):
        * kjs/JSActivation.h:
        (JSC::JSActivation::JSActivationData::JSActivationData):
        * kjs/grammar.y:
        * kjs/nodes.h:
        (JSC::ScopeNode::setUsesArguments):
        * masm/X86Assembler.h:
        (JSC::X86Assembler::):
        (JSC::X86Assembler::orl_mr):

1306 1307
2008-10-01  Kevin McCullough  <kmccullough@apple.com>

1308
        Rubberstamped by Geoff Garen.
1309 1310 1311 1312 1313 1314 1315

        Remove BreakpointCheckStatement because it's not used anymore.
        No effect on sunspider or the jsc tests.

        * kjs/nodes.cpp:
        * kjs/nodes.h:

1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341
2008-09-30  Oliver Hunt  <oliver@apple.com>

        Reviewed by Geoff Garen.

        Improve performance of CTI on windows.

        Currently on platforms where the compiler doesn't allow us to safely
        index relative to the address of a parameter we need to actually
        provide a pointer to CTI runtime call arguments.  This patch improves
        performance in this case by making the CTI logic for restoring this
        parameter much less conservative by only resetting it before we actually
        make a call, rather than between each and every SF bytecode we generate
        code for.

        This results in a 3.6% progression on the v8 benchmark when compiled with MSVC.

        * VM/CTI.cpp:
        (JSC::CTI::emitCall):
        (JSC::CTI::compileOpCall):
        (JSC::CTI::privateCompileMainPass):
        (JSC::CTI::privateCompileSlowCases):
        (JSC::CTI::privateCompilePutByIdTransition):
        * VM/CTI.h:
        * masm/X86Assembler.h:
        * wtf/Platform.h:

1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354
2008-09-30  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Oliver Hunt.

        - track uses of "this", "with" and "catch" in the parser
        
        Knowing this up front will be useful for future optimizations.
        
        Perf and correctness remain the same.
        
        * kjs/NodeInfo.h:
        * kjs/grammar.y:

1355 1356 1357 1358 1359 1360 1361 1362 1363
2008-09-30  Sam Weinig  <sam@webkit.org>

        Reviewed by Mark Rowe.

        Add WebKitAvailability macros for JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError,
        and JSObjectMakeRegExp

        * API/JSObjectRef.h:

1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394
2008-09-30  Darin Adler  <darin@apple.com>

        Reviewed by Geoff Garen.

        - https://bugs.webkit.org/show_bug.cgi?id=21214
          work on getting rid of ExecState

        Replaced the m_prev field of ExecState with a bit in the
        call frame pointer to indicate "host" call frames.

        * VM/Machine.cpp:
        (JSC::makeHostCallFramePointer): Added. Sets low bit.
        (JSC::isHostCallFrame): Added. Checks low bit.
        (JSC::stripHostCallFrameBit): Added. Clears low bit.
        (JSC::Machine::unwindCallFrame): Replaced null check that was
        formerly used to detect host call frames with an isHostCallFrame check.
        (JSC::Machine::execute): Pass in a host call frame pointer rather than
        always passing 0 when starting execution from the host. This allows us
        to follow the entire call frame pointer chain when desired, or to stop
        at the host calls when that's desired.
        (JSC::Machine::privateExecute): Replaced null check that was
        formerly used to detect host call frames with an isHostCallFrame check.
        (JSC::Machine::retrieveCaller): Ditto.
        (JSC::Machine::retrieveLastCaller): Ditto.
        (JSC::Machine::callFrame): Removed the code to walk up m_prev pointers
        and replaced it with code that uses the caller pointer and uses the
        stripHostCallFrameBit function.

        * kjs/ExecState.cpp: Removed m_prev.
        * kjs/ExecState.h: Ditto.

1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409
2008-09-30  Cameron Zwarich  <zwarich@apple.com>

        Reviewed by Geoff Garen.

        Move all detection of 'arguments' in a lexical scope to the parser, in
        preparation for fixing

        Bug 21123: using "arguments" in a function should not force creation of an activation object
        <https://bugs.webkit.org/show_bug.cgi?id=21123>

        * VM/CodeGenerator.cpp:
        (JSC::CodeGenerator::CodeGenerator):
        * kjs/NodeInfo.h:
        * kjs/grammar.y:

1410 1411 1412 1413 1414 1415 1416
2008-09-30  Geoffrey Garen  <ggaren@apple.com>

        Not reviewed.

        * kjs/Shell.cpp:
        (runWithScripts): Fixed indentation.

mrowe@apple.com's avatar
mrowe@apple.com committed
1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428
2008-09-30  Mark Rowe  <mrowe@apple.com>

        Rubber-stamped by Sam Weinig.

        Build fix.  Move InternalFunction::classInfo implementation into the .cpp
        file to prevent the vtable for InternalFunction being generated as a weak symbol.
        Has no effect on SunSpider.

        * kjs/InternalFunction.cpp:
        (JSC::InternalFunction::classInfo):
        * kjs/InternalFunction.h:

1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462
2008-09-29  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin Adler.
        
        - optimize appending a number to a string
        https://bugs.webkit.org/show_bug.cgi?id=21203
        
        It's pretty common in real-world code (and on some of the v8
        benchmarks) to append a number to a string, so I made this one of
        the fast cases, and also added support to UString to do it
        directly without allocating a temporary UString.
        
        ~1% speedup on v8 benchmark.

        * VM/Machine.cpp:
        (JSC::jsAddSlowCase): Make this NEVER_INLINE because somehow otherwise
        the change is a regression.
        (JSC::jsAdd): Handle number + string special case.
        (JSC::Machine::cti_op_add): Integrate much of the logic of jsAdd to
        avoid exception check in the str + str, num + num and str + num cases.
        * kjs/ustring.cpp:
        (JSC::expandedSize): Make this a non-member function, since it needs to be 
        called in non-member functions but not outside this file.
        (JSC::expandCapacity): Ditto.
        (JSC::UString::expandCapacity): Call the non-member version. 
        (JSC::createRep): Helper to make a rep from a char*.
        (JSC::UString::UString): Use above helper.
        (JSC::concatenate): Guts of concatenating constructor for cases where first
        item is a UString::Rep, and second is a UChar* and length, or a char*.
        (JSC::UString::append): Implement for cases where first item is a UString::Rep,
        and second is an int or double. Sadly duplicates logic of UString::from(int)
        and UString::from(double).
        * kjs/ustring.h:

darin@apple.com's avatar
darin@apple.com committed
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
2008-09-29  Darin Adler  <darin@apple.com>

        Reviewed by Sam Weinig.

        - https://bugs.webkit.org/show_bug.cgi?id=21214
          work on getting rid of ExecState

        * JavaScriptCore.exp: Updated since JSGlobalObject::init
        no longer takes a parameter.

        * VM/Machine.cpp:
        (JSC::Machine::execute): Removed m_registerFile argument
        for ExecState constructors.

        * kjs/DebuggerCallFrame.cpp:
        (JSC::DebuggerCallFrame::evaluate): Removed globalThisValue
        argument for ExecState constructor.

        * kjs/ExecState.cpp:
        (JSC::ExecState::ExecState): Removed globalThisValue and
        registerFile arguments to constructors.

        * kjs/ExecState.h: Removed m_globalThisValue and
        m_registerFile data members.

        * kjs/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::init): Removed globalThisValue
        argument for ExecState constructor.

        * kjs/JSGlobalObject.h:
        (JSC::JSGlobalObject::JSGlobalObject): Got rid of parameter
        for the init function.

1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510
2008-09-29  Geoffrey Garen  <ggaren@apple.com>

        Rubber-stamped by Cameron Zwarich.
        
        Fixed https://bugs.webkit.org/show_bug.cgi?id=21225
        Machine::retrieveLastCaller should check for a NULL codeBlock
        
        In order to crash, you would need to call retrieveCaller in a situation
        where you had two host call frames in a row in the register file. I
        don't know how to make that happen, or if it's even possible, so I don't
        have a test case -- but better safe than sorry!

        * VM/Machine.cpp:
        (JSC::Machine::retrieveLastCaller):

ggaren@apple.com's avatar
ggaren@apple.com committed
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
2008-09-29  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Cameron Zwarich.
        
        Store the callee ScopeChain, not the caller ScopeChain, in the call frame
        header. Nix the "scopeChain" local variable and ExecState::m_scopeChain, and
        access the callee ScopeChain through the call frame header instead.

        Profit: call + return are simpler, because they don't have to update the
        "scopeChain" local variable, or ExecState::m_scopeChain.
        
        Because CTI keeps "r" in a register, reading the callee ScopeChain relative
        to "r" can be very fast, in any cases we care to optimize.

        0% speedup on empty function call benchmark. (5.5% speedup in bytecode.)
        0% speedup on SunSpider. (7.5% speedup on controlflow-recursive.)
        2% speedup on SunSpider --v8.
        2% speedup on v8 benchmark.

        * VM/CTI.cpp: Changed scope chain access to read the scope chain from
        the call frame header. Sped up op_ret by changing it not to fuss with
        the "scopeChain" local variable or ExecState::m_scopeChain.

        * VM/CTI.h: Updated CTI trampolines not to take a ScopeChainNode*
        argument, since that's stored in the call frame header now.

        * VM/Machine.cpp: Access "scopeChain" and "codeBlock" through new helper
        functions that read from the call frame header. Updated functions operating
        on ExecState::m_callFrame to account for / take advantage of the fact that
        Exec:m_callFrame is now never NULL.
        
        Fixed a bug in op_construct, where it would use the caller's default
        object prototype, rather than the callee's, when constructing a new object.

        * VM/Machine.h: Made some helper functions available. Removed
        ScopeChainNode* arguments to a lot of functions, since the ScopeChainNode*
        is now stored in the call frame header.

        * VM/RegisterFile.h: Renamed "CallerScopeChain" to "ScopeChain", since
        that's what it is now.

        * kjs/DebuggerCallFrame.cpp: Updated for change to ExecState signature.

        * kjs/ExecState.cpp:
        * kjs/ExecState.h: Nixed ExecState::m_callFrame, along with the unused
        isGlobalObject function.

        * kjs/JSGlobalObject.cpp:
        * kjs/JSGlobalObject.h: Gave the global object a fake call frame in
        which to store the global scope chain, since our code now assumes that
        it can always read the scope chain out of the ExecState's call frame.

1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580
2008-09-29  Cameron Zwarich  <cwzwarich@uwaterloo.ca>

        Reviewed by Sam Weinig.

        Remove the isActivationObject() virtual method on JSObject and use
        StructureID information instead. This should be slightly faster, but
        isActivationObject() is only used in assertions and unwinding the stack
        for exceptions.

        * VM/Machine.cpp:
        (JSC::depth):
        (JSC::Machine::unwindCallFrame):
        (JSC::Machine::privateExecute):
        (JSC::Machine::cti_op_ret_activation):
        * kjs/JSActivation.cpp:
        * kjs/JSActivation.h:
        * kjs/JSObject.h:

1581 1582 1583 1584 1585 1586 1587 1588
2008-09-29  Peter Gal  <galpeter@inf.u-szeged.hu>

        Reviewed and tweaked by Darin Adler.

        Fix build for non-all-in-one platforms.

        * kjs/StringPrototype.cpp: Added missing ASCIICType.h include.

1589 1590
2008-09-29  Bradley T. Hughes  <bradley.hughes@nokia.com>

1591
        Reviewed by Simon Hausmann.
1592 1593 1594 1595 1596 1597 1598

        Fix compilation with icpc

        * wtf/HashSet.h:
        (WTF::::find):
        (WTF::::contains):

1599 1600
2008-09-29  Thiago Macieira  <thiago.macieira@nokia.com>

1601
        Reviewed by Simon Hausmann.
1602 1603 1604 1605 1606 1607 1608 1609

        Changed copyright from Trolltech ASA to Nokia.
        
        Nokia acquired Trolltech ASA, assets were transferred on September 26th 2008.
        

        * wtf/qt/MainThreadQt.cpp:

1610 1611
2008-09-29  Simon Hausmann  <hausmann@webkit.org>

1612
        Reviewed by Lars Knoll.
1613 1614 1615 1616 1617 1618

        Don't accidentially install libJavaScriptCore.a for the build inside
        Qt.

        * JavaScriptCore.pro:

1619 1620 1621 1622 1623 1624 1625 1626 1627 1628
2008-09-28  Cameron Zwarich  <cwzwarich@uwaterloo.ca>

        Reviewed by Maciej Stachowiak.

        Bug 21200: Allow direct access to 'arguments' without using op_resolve
        <https://bugs.webkit.org/show_bug.cgi?id=21200>

        Allow fast access to the 'arguments' object by adding an extra slot to
        the callframe to store it.

1629 1630
        This is a 3.0% speedup on the V8 Raytrace benchmark.

1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674
        * JavaScriptCore.exp:
        * VM/CTI.cpp:
        (JSC::CTI::privateCompileMainPass):
        * VM/CodeBlock.cpp:
        (JSC::CodeBlock::dump):
        * VM/CodeGenerator.cpp:
        (JSC::CodeGenerator::CodeGenerator):
        (JSC::CodeGenerator::registerFor):
        * VM/CodeGenerator.h:
        (JSC::CodeGenerator::registerFor):
        * VM/Machine.cpp:
        (JSC::Machine::initializeCallFrame):
        (JSC::Machine::dumpRegisters):
        (JSC::Machine::privateExecute):
        (JSC::Machine::retrieveArguments):
        (JSC::Machine::cti_op_call_JSFunction):
        (JSC::Machine::cti_op_create_arguments):
        (JSC::Machine::cti_op_construct_JSConstruct):
        * VM/Machine.h:
        * VM/Opcode.h:
        * VM/RegisterFile.h:
        (JSC::RegisterFile::):
        * kjs/JSActivation.cpp:
        (JSC::JSActivation::mark):
        (JSC::JSActivation::argumentsGetter):
        * kjs/JSActivation.h:
        (JSC::JSActivation::JSActivationData::JSActivationData):
        * kjs/NodeInfo.h:
        * kjs/Parser.cpp:
        (JSC::Parser::didFinishParsing):
        * kjs/Parser.h:
        (JSC::Parser::parse):
        * kjs/grammar.y:
        * kjs/nodes.cpp:
        (JSC::ScopeNode::ScopeNode):
        (JSC::ProgramNode::ProgramNode):
        (JSC::ProgramNode::create):
        (JSC::EvalNode::EvalNode):
        (JSC::EvalNode::create):
        (JSC::FunctionBodyNode::FunctionBodyNode):
        (JSC::FunctionBodyNode::create):
        * kjs/nodes.h:
        (JSC::ScopeNode::usesArguments):

1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691
2008-09-28  Mark Rowe  <mrowe@apple.com>

        Reviewed by Sam Weinig.

        Add an ASCII fast-path to toLowerCase and toUpperCase.

        The fast path speeds up the common case of an ASCII-only string by up to 60% while adding a less than 5% penalty
        to the less common non-ASCII case.

        This also removes stringProtoFuncToLocaleLowerCase and stringProtoFuncToLocaleUpperCase, which were identical
        to the non-locale variants of the functions.  toLocaleLowerCase and toLocaleUpperCase now use the non-locale
        variants of the functions directly.

        * kjs/StringPrototype.cpp:
        (JSC::stringProtoFuncToLowerCase):
        (JSC::stringProtoFuncToUpperCase):

1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704
2008-09-28  Mark Rowe  <mrowe@apple.com>

        Reviewed by Cameron Zwarich.

        Speed up parseInt and parseFloat.

        Repeatedly indexing into a UString is slow, so retrieve a pointer into the underlying buffer once up front
        and use that instead.  This is a 7% win on a parseInt/parseFloat micro-benchmark.

        * kjs/JSGlobalObjectFunctions.cpp:
        (JSC::parseInt):
        (JSC::parseFloat):

1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717
2008-09-28  Simon Hausmann  <hausmann@webkit.org>

        Reviewed by David Hyatt.

        In Qt's initializeThreading re-use an existing thread identifier for the main
        thread if it exists.

        currentThread() implicitly creates new identifiers and it could be that
        it is called before initializeThreading().

        * wtf/ThreadingQt.cpp:
        (WTF::initializeThreading):

1718 1719 1720 1721 1722 1723 1724 1725
2008-09-27  Keishi Hattori  <casey.hattori@gmail.com>

        Added Machine::retrieveCaller to the export list.

        Reviewed by Kevin McCullough and Tim Hatcher.

        * JavaScriptCore.exp: Added Machine::retrieveCaller.

1726 1727 1728 1729 1730 1731 1732
2008-09-27  Anders Carlsson  <andersca@apple.com>

        Fix build.

        * VM/CTI.cpp:
        (JSC::):

1733 1734 1735 1736
2008-09-27  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Cameron Zwarich.
        
ggaren@apple.com's avatar
ggaren@apple.com committed
1737 1738
        https://bugs.webkit.org/show_bug.cgi?id=21175

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
        Store the callee CodeBlock, not the caller CodeBlock, in the call frame
        header. Nix the "codeBlock" local variable, and access the callee
        CodeBlock through the call frame header instead.
        
        Profit: call + return are simpler, because they don't have to update the
        "codeBlock" local variable.
        
        Because CTI keeps "r" in a register, reading the callee CodeBlock relative
        to "r" can be very fast, in any cases we care to optimize. Presently,
        no such cases seem important.
        
        Also, stop writing "dst" to the call frame header. CTI doesn't use it.
        
        21.6% speedup on empty function call benchmark.
        3.8% speedup on SunSpider --v8.
        2.1% speedup on v8 benchmark.
        0.7% speedup on SunSpider (6% speedup on controlflow-recursive).
        
        Small regression in bytecode, because currently every op_ret reads the
        callee CodeBlock to check needsFullScopeChain, and bytecode does not
        keep "r" in a register. On-balance, this is probably OK, since CTI is
        our high-performance execution model. Also, this should go away once
        we make needsFullScopeChain statically determinable at parse time.

        * VM/CTI.cpp:
        (JSC::CTI::compileOpCall): The speedup!
        (JSC::CTI::privateCompileSlowCases): ditto

        * VM/CTI.h:
        (JSC::): Fixed up magic trampoline constants to account for the nixed
        "codeBlock" argument.
        (JSC::CTI::execute): Changed trampoline function not to take a "codeBlock"
        argument, since codeBlock is now stored in the call frame header.
        
        * VM/Machine.cpp: Read the callee CodeBlock from the register file. Use
        a NULL CallerRegisters in the call frame header to signal a built-in
        caller, since CodeBlock is now never NULL.

        * VM/Machine.h: Made some stand-alone functions Machine member functions
        so they could call the private codeBlock() accessor in the Register
        class, of which Machine is a friend. Renamed "CallerCodeBlock" to
        "CodeBlock", since it's no longer the caller's CodeBlock.

        * VM/RegisterFile.h: Marked some methods const to accommodate a 
        const RegisterFile* being passed around in Machine.cpp.

1785 1786 1787 1788 1789 1790 1791 1792 1793
2008-09-26  Jan Michael Alonzo  <jmalonzo@webkit.org>

        Gtk build fix. Not reviewed.

        Narrow-down the target of the JavaScriptCore .lut.h generator so
        it won't try to create the WebCore .lut.hs.

        * GNUmakefile.am:

pewtermoose@webkit.org's avatar
pewtermoose@webkit.org committed
1794 1795 1796 1797 1798 1799 1800 1801
2008-09-26  Matt Lilek  <webkit@mattlilek.com>

        Reviewed by Tim Hatcher.

        Update FEATURE_DEFINES after ENABLE_CROSS_DOCUMENT_MESSAGING was removed.

        * Configurations/JavaScriptCore.xcconfig:

1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812
2008-09-26  Cameron Zwarich  <cwzwarich@uwaterloo.ca>

        Rubber-stamped by Anders Carlson.

        Change the name 'sc' to 'scopeChainNode' in a few places.

        * kjs/nodes.cpp:
        (JSC::EvalNode::generateCode):
        (JSC::FunctionBodyNode::generateCode):
        (JSC::ProgramNode::generateCode):

weinig@apple.com's avatar
weinig@apple.com committed
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 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893
2008-09-26  Sam Weinig  <sam@webkit.org>

        Reviewed by Darin Adler.

        Patch for https://bugs.webkit.org/show_bug.cgi?id=21152
        Speedup static property get/put

        Convert getting/setting static property values to use static functions
        instead of storing an integer and switching in getValueProperty/putValueProperty.

        * kjs/JSObject.cpp:
        (JSC::JSObject::deleteProperty):
        (JSC::JSObject::getPropertyAttributes):
        * kjs/MathObject.cpp:
        (JSC::MathObject::getOwnPropertySlot):
        * kjs/NumberConstructor.cpp:
        (JSC::numberConstructorNaNValue):
        (JSC::numberConstructorNegInfinity):
        (JSC::numberConstructorPosInfinity):
        (JSC::numberConstructorMaxValue):
        (JSC::numberConstructorMinValue):
        * kjs/PropertySlot.h:
        (JSC::PropertySlot::):
        * kjs/RegExpConstructor.cpp:
        (JSC::regExpConstructorDollar1):
        (JSC::regExpConstructorDollar2):
        (JSC::regExpConstructorDollar3):
        (JSC::regExpConstructorDollar4):
        (JSC::regExpConstructorDollar5):
        (JSC::regExpConstructorDollar6):
        (JSC::regExpConstructorDollar7):
        (JSC::regExpConstructorDollar8):
        (JSC::regExpConstructorDollar9):
        (JSC::regExpConstructorInput):
        (JSC::regExpConstructorMultiline):
        (JSC::regExpConstructorLastMatch):
        (JSC::regExpConstructorLastParen):
        (JSC::regExpConstructorLeftContext):
        (JSC::regExpConstructorRightContext):
        (JSC::setRegExpConstructorInput):
        (JSC::setRegExpConstructorMultiline):
        (JSC::RegExpConstructor::setInput):
        (JSC::RegExpConstructor::setMultiline):
        (JSC::RegExpConstructor::multiline):
        * kjs/RegExpConstructor.h:
        * kjs/RegExpObject.cpp:
        (JSC::regExpObjectGlobal):
        (JSC::regExpObjectIgnoreCase):
        (JSC::regExpObjectMultiline):
        (JSC::regExpObjectSource):
        (JSC::regExpObjectLastIndex):
        (JSC::setRegExpObjectLastIndex):
        * kjs/RegExpObject.h:
        (JSC::RegExpObject::setLastIndex):
        (JSC::RegExpObject::lastIndex):
        (JSC::RegExpObject::RegExpObjectData::RegExpObjectData):
        * kjs/StructureID.cpp:
        (JSC::StructureID::getEnumerablePropertyNames):
        * kjs/create_hash_table:
        * kjs/lexer.cpp:
        (JSC::Lexer::lex):
        * kjs/lookup.cpp:
        (JSC::HashTable::createTable):
        (JSC::HashTable::deleteTable):
        (JSC::setUpStaticFunctionSlot):
        * kjs/lookup.h:
        (JSC::HashEntry::initialize):
        (JSC::HashEntry::setKey):
        (JSC::HashEntry::key):
        (JSC::HashEntry::attributes):
        (JSC::HashEntry::function):
        (JSC::HashEntry::functionLength):
        (JSC::HashEntry::propertyGetter):
        (JSC::HashEntry::propertyPutter):
        (JSC::HashEntry::lexerValue):
        (JSC::HashEntry::):
        (JSC::HashTable::entry):
        (JSC::getStaticPropertySlot):
        (JSC::getStaticValueSlot):
        (JSC::lookupPut):

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
2008-09-26  Gavin Barraclough  <barraclough@apple.com>

        Reviewed by Maciej Stachowiak & Oliver Hunt.

        Add support for reusing temporary JSNumberCells.  This change is based on the observation
        that if the result of certain operations is a JSNumberCell and is consumed by a subsequent
        operation that would produce a JSNumberCell, we can reuse the object rather than allocating
        a fresh one.  E.g. given the expression ((a * b) * c), we can statically determine that
        (a * b) will have a numeric result (or else it will have thrown an exception), so the result
        will either be a JSNumberCell or a JSImmediate.

        This patch changes three areas of JSC:
            * The AST now tracks type information about the result of each node.
            * This information is consumed in bytecode compilation, and certain bytecode operations
              now carry the statically determined type information about their operands.
            * CTI uses the information in a number of fashions:
                * Where an operand to certain arithmetic operations is reusable, it will plant code
                  to try to perform the operation in JIT code & reuse the cell, where appropriate.
                * Where it can be statically determined that an operand can only be numeric (typically
                  the result of another arithmetic operation) the code will not redundantly check that
                  the JSCell is a JSNumberCell.
                * Where either of the operands to an add are non-numeric do not plant an optimized
                  arithmetic code path, just call straight out to the C function.

        +6% Sunspider (10% progression on 3D, 16% progression on math, 60% progression on access-nbody),
        +1% v8-tests (improvements in raytrace & crypto)

        * VM/CTI.cpp: Add optimized code generation with reuse of temporary JSNumberCells.
        * VM/CTI.h:
        * kjs/JSNumberCell.h:
        * masm/X86Assembler.h:

        * VM/CodeBlock.cpp: Add type information to specific bytecodes.
        * VM/CodeGenerator.cpp:
        * VM/CodeGenerator.h:
        * VM/Machine.cpp:

        * kjs/nodes.cpp: Track static type information for nodes.
        * kjs/nodes.h:
        * kjs/ResultDescriptor.h: (Added)
        * JavaScriptCore.xcodeproj/project.pbxproj:

1936 1937 1938 1939 1940 1941 1942 1943 1944
2008-09-26  Yichao Yin  <yichao.yin@torchmobile.com.cn>

        Reviewed by George Staikos, Maciej Stachowiak.

        Add utility functions needed for upcoming WML code.

        * wtf/ASCIICType.h:
        (WTF::isASCIIPrintable):

1945 1946 1947 1948 1949 1950 1951
2008-09-26  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Darin Adler.
        
        Reverted the part of r36614 that used static data because static data
        is not thread-safe.

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
2008-09-26  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Maciej Stachowiak.
        
        Removed dynamic check for whether the callee needs an activation object.
        Replaced with callee code to create the activation object.

        0.5% speedup on SunSpider.
        No change on v8 benchmark. (Might be a speedup, but it's in range of the
        variance.)

        0.7% speedup on v8 benchmark in bytecode.
        1.3% speedup on empty call benchmark in bytecode.

        * VM/CTI.cpp:
        (JSC::CTI::privateCompileMainPass): Added support for op_init_activation,
        the new opcode that specifies that the callee's initialization should
        create an activation object.
        (JSC::CTI::privateCompile): Removed previous code that did a similar
        thing in an ad-hoc way.

        * VM/CodeBlock.cpp:
        (JSC::CodeBlock::dump): Added a case for dumping op_init_activation.

        * VM/CodeGenerator.cpp:
        (JSC::CodeGenerator::generate): Added fixup code to change op_init to
        op_init_activation if necessary. (With a better parser, we would know
        which to use from the beginning.)

        * VM/Instruction.h:
        (JSC::Instruction::Instruction):
        (WTF::): Faster traits for the instruction vector. An earlier version
        of this patch relied on inserting at the beginning of the vector, and
        depended on this change for speed.

        * VM/Machine.cpp:
        (JSC::Machine::execute): Removed clients of setScopeChain, the old
        abstraction for dynamically checking for whether an activation object
        needed to be created.
        (JSC::Machine::privateExecute): ditto

        (JSC::Machine::cti_op_push_activation): Renamed this function from
        cti_vm_updateScopeChain, and made it faster by removing the call to 
        setScopeChain.
        * VM/Machine.h:

        * VM/Opcode.h: Declared op_init_activation.

2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015
2008-09-24  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Maciej Stachowiak.
        
        Move most of the return code back into the callee, now that the callee
        doesn't have to calculate anything dynamically.
        
        11.5% speedup on empty function call benchmark.
        
        SunSpider says 0.3% faster. SunSpider --v8 says no change.

        * VM/CTI.cpp:
        (JSC::CTI::compileOpCall):
        (JSC::CTI::privateCompileMainPass):
        (JSC::CTI::privateCompileSlowCases):

weinig@apple.com's avatar
weinig@apple.com committed
2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026
2008-09-24  Sam Weinig  <sam@webkit.org>

        Reviewed by Maciej Stachowiak.

        Remove staticFunctionGetter.  There is only one remaining user of
        staticFunctionGetter and it can be converted to use setUpStaticFunctionSlot.

        * JavaScriptCore.exp:
        * kjs/lookup.cpp:
        * kjs/lookup.h:

2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048
2008-09-24  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Oliver Hunt.
        
        - inline JIT fast case of op_neq
        - remove extra level of function call indirection from slow cases of eq and neq
        
        1% speedup on Richards

        * VM/CTI.cpp:
        (JSC::CTI::privateCompileMainPass):
        (JSC::CTI::privateCompileSlowCases):
        * VM/Machine.cpp:
        (JSC::Machine::privateExecute):
        (JSC::Machine::cti_op_eq):
        (JSC::Machine::cti_op_neq):
        * kjs/operations.cpp:
        (JSC::equal):
        (JSC::equalSlowCase):
        * kjs/operations.h:
        (JSC::equalSlowCaseInline):

weinig@apple.com's avatar
weinig@apple.com committed
2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062
2008-09-24  Sam Weinig  <sam@webkit.org>

        Reviewed by Darin Adler.

        Fix for https://bugs.webkit.org/show_bug.cgi?id=21080
        <rdar://problem/6243534>
        Crash below Function.apply when using a runtime array as the argument list

        Test: plugins/bindings-array-apply-crash.html

        * kjs/FunctionPrototype.cpp:
        (JSC::functionProtoFuncApply): Revert to the slow case if the object inherits from 
        JSArray (via ClassInfo) but is not a JSArray.

2063 2064 2065 2066 2067 2068 2069
2008-09-24  Kevin McCullough  <kmccullough@apple.com>

        Style change.

        * kjs/nodes.cpp:
        (JSC::statementListEmitCode):

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
2008-09-24  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by Geoff.

        Bug 21031: Breakpoints in the condition of loops only breaks the first
        time
        - Now when setting breakpoints in the condition of a loop (for, while,
        for in, and do while) will successfully break each time throught the
        loop.
        - For 'for' loops we need a little more complicated behavior that cannot
        be accomplished without some more significant changes:
        https://bugs.webkit.org/show_bug.cgi?id=21073

        * kjs/nodes.cpp:
        (JSC::statementListEmitCode): We don't want to blindly emit a debug hook
        at the first line of loops, instead let the loop emit the debug hooks.
        (JSC::DoWhileNode::emitCode):
        (JSC::WhileNode::emitCode):
        (JSC::ForNode::emitCode):
        (JSC::ForInNode::emitCode):
        * kjs/nodes.h:
        (JSC::StatementNode::):
        (JSC::DoWhileNode::):
        (JSC::WhileNode::):
        (JSC::ForInNode::):

2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109
2008-09-24  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Darin Adler.
        
        Fixed <rdar://problem/5605532> Need a SPI for telling JS the size of
        the objects it retains

        * API/tests/testapi.c: Test the new SPI a little.

        * API/JSSPI.cpp: Add the new SPI.
        * API/JSSPI.h: Add the new SPI.
        * JavaScriptCore.exp: Add the new SPI.
        * JavaScriptCore.xcodeproj/project.pbxproj: Add the new SPI.

2110 2111 2112 2113 2114 2115
2008-09-24  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Darin Adler.

        * API/JSBase.h: Filled in some missing function names.

2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126
2008-09-24  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Cameron Zwarich.
        
        Fixed https://bugs.webkit.org/show_bug.cgi?id=21057
        Crash in RegisterID::deref() running fast/canvas/canvas-putImageData.html

        * VM/CodeGenerator.h: Changed declaration order to ensure the
        m_lastConstant, which is a RefPtr that points into m_calleeRegisters,
        has its destructor called before the destructor for m_calleeRegisters.

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
2008-09-24  Darin Adler  <darin@apple.com>

        Reviewed by Sam Weinig.

        - https://bugs.webkit.org/show_bug.cgi?id=21047
          speed up ret_activation with inlining

        About 1% on v8-raytrace.

        * JavaScriptCore.exp: Removed JSVariableObject::setRegisters.

        * kjs/JSActivation.cpp: Moved copyRegisters to the header to make it inline.
        * kjs/JSActivation.h:
        (JSC::JSActivation::copyRegisters): Moved here. Also removed the registerArraySize
        argument to setRegisters, since the object doesn't need to store the number of
        registers.

        * kjs/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::reset): Removed unnecessary clearing left over from when we
        used this on objects that weren't brand new. These days, this function is really
        just part of the constructor.

        * kjs/JSGlobalObject.h: Added registerArraySize to JSGlobalObjectData, since
        JSVariableObjectData no longer needs it. Added a setRegisters override here
        that handles storing the size.

        * kjs/JSStaticScopeObject.h: Removed code to set registerArraySize, since it
        no longer exists.

        * kjs/JSVariableObject.cpp: Moved copyRegisterArray and setRegisters to the
        header to make them inline.
        * kjs/JSVariableObject.h: Removed registerArraySize from JSVariableObjectData,
        since it was only used for the global object.
        (JSC::JSVariableObject::copyRegisterArray): Moved here ot make it inline.
        (JSC::JSVariableObject::setRegisters): Moved here to make it inline. Also
        removed the code to set registerArraySize and changed an if statement into
        an assert to save an unnnecessary branch.

2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178
2008-09-24  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Oliver Hunt.
        
        - inline PropertyMap::getOffset to speed up polymorphic lookups
        
        ~1.5% speedup on v8 benchmark
        no effect on SunSpider

        * JavaScriptCore.exp:
        * kjs/PropertyMap.cpp:
        * kjs/PropertyMap.h:
        (JSC::PropertyMap::getOffset):

2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189
2008-09-24  Jan Michael Alonzo  <jmalonzo@webkit.org>

        Reviewed by Alp Toker.

        https://bugs.webkit.org/show_bug.cgi?id=20992
        Build fails on GTK+ Mac OS

        * wtf/ThreadingGtk.cpp: Remove platform ifdef as suggested by
          Richard Hult.
        (WTF::initializeThreading):

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
2008-09-23  Oliver Hunt  <oliver@apple.com>

        Reviewed by Maciej Stachowiak.

        Bug 19968: Slow Script at www.huffingtonpost.com
        <https://bugs.webkit.org/show_bug.cgi?id=19968>

        Finally found the cause of this accursed issue.  It is triggered
        by synchronous creation of a new global object from JS.  The new
        global object resets the timer state in this execution group's
        Machine, taking timerCheckCount to 0.  Then when JS returns the
        timerCheckCount is decremented making it non-zero.  The next time
        we execute JS we will start the timeout counter, however the non-zero
        timeoutCheckCount means we don't reset the timer information. This
        means that the timeout check is now checking the cumulative time
        since the creation of the global object rather than the time since
        JS was last entered.  At this point the slow script dialog is guaranteed
        to eventually be displayed incorrectly unless a page is loaded
        asynchronously (which will reset everything into a sane state).

        The fix for this is rather trivial -- the JSGlobalObject constructor
        should not be resetting the machine timer state.

        * VM/Machine.cpp:
        (JSC::Machine::Machine):
          Now that we can't rely on the GlobalObject initialising the timeout
          state, we do it in the Machine constructor.

        * VM/Machine.h:
        (JSC::Machine::stopTimeoutCheck):
          Add assertions to guard against this happening.

        * kjs/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::init):
          Don't reset the timeout state.

ggaren@apple.com's avatar
ggaren@apple.com committed
2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255
2008-09-23  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Oliver Hunt.
        
        Fixed https://bugs.webkit.org/show_bug.cgi?id=21038 | <rdar://problem/6240812>
        Uncaught exceptions in regex replace callbacks crash webkit
        
        This was a combination of two problems:
        
        (1) the replace function would continue execution after an exception
        had been thrown.
        
        (2) In some cases, the Machine would return 0 in the case of an exception,
        despite the fact that a few clients dereference the Machine's return
        value without first checking for an exception.
        
        * VM/Machine.cpp:
        (JSC::Machine::execute):
        
        ^ Return jsNull() instead of 0 in the case of an exception, since some
        clients depend on using our return value.
        
        ^ ASSERT that execution does not continue after an exception has been
        thrown, to help catch problems like this in the future.

        * kjs/StringPrototype.cpp:
        (JSC::stringProtoFuncReplace):
        
        ^ Stop execution if an exception has been thrown.

2256 2257 2258 2259 2260 2261 2262 2263
2008-09-23  Geoffrey Garen  <ggaren@apple.com>

        Try to fix the windows build.

        * VM/CTI.cpp:
        (JSC::CTI::compileOpCall):
        (JSC::CTI::privateCompileMainPass):

2264 2265 2266 2267 2268 2269
2008-09-23  Alp Toker  <alp@nuanti.com>

        Build fix.

        * VM/CTI.h:

2270 2271 2272 2273 2274 2275
2008-09-23  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Darin Adler.

        * wtf/Platform.h: Removed duplicate #if.

2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293
2008-09-23  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Darin Adler.
        
        Changed the layout of the call frame from
        
        { header, parameters, locals | constants, temporaries }
        
        to
        
        { parameters, header | locals, constants, temporaries }
        
        This simplifies function entry+exit, and enables a number of future
        optimizations.
        
        13.5% speedup on empty call benchmark for bytecode; 23.6% speedup on
        empty call benchmark for CTI.
        
2294
        SunSpider says no change. SunSpider --v8 says 1% faster.
2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 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 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 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 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525

        * VM/CTI.cpp:
        
        Added a bit of abstraction for calculating whether a register is a
        constant, since this patch changes that calculation:
        (JSC::CTI::isConstant):
        (JSC::CTI::getConstant):
        (JSC::CTI::emitGetArg):
        (JSC::CTI::emitGetPutArg):
        (JSC::CTI::getConstantImmediateNumericArg):

        Updated for changes to callframe header location:
        (JSC::CTI::emitPutToCallFrameHeader):
        (JSC::CTI::emitGetFromCallFrameHeader):
        (JSC::CTI::printOpcodeOperandTypes):
        
        Renamed to spite Oliver:
        (JSC::CTI::emitInitRegister):
        
        Added an abstraction for emitting a call through a register, so that
        calls through registers generate exception info, too:
        (JSC::CTI::emitCall):

        Updated to match the new callframe header layout, and to support calls
        through registers, which have no destination address:
        (JSC::CTI::compileOpCall):
        (JSC::CTI::privateCompileMainPass):
        (JSC::CTI::privateCompileSlowCases):
        (JSC::CTI::privateCompile):

        * VM/CTI.h:

        More of the above:
        (JSC::CallRecord::CallRecord):

        * VM/CodeBlock.cpp:

        Updated for new register layout:
        (JSC::registerName):
        (JSC::CodeBlock::dump):

        * VM/CodeBlock.h:
        
        Updated CodeBlock to track slightly different information about the
        register frame, and tweaked the style of an ASSERT_NOT_REACHED.
        (JSC::CodeBlock::CodeBlock):
        (JSC::CodeBlock::getStubInfo):

        * VM/CodeGenerator.cpp:
        
        Added some abstraction around constant register allocation, since this
        patch changes it, changed codegen to account for the new callframe
        layout, and added abstraction around register fetching code
        that used to assume that all local registers lived at negative indices,
        since vars now live at positive indices:
        (JSC::CodeGenerator::generate):
        (JSC::CodeGenerator::addVar):
        (JSC::CodeGenerator::addGlobalVar):
        (JSC::CodeGenerator::allocateConstants):
        (JSC::CodeGenerator::CodeGenerator):
        (JSC::CodeGenerator::addParameter):
        (JSC::CodeGenerator::registerFor):
        (JSC::CodeGenerator::constRegisterFor):
        (JSC::CodeGenerator::newRegister):
        (JSC::CodeGenerator::newTemporary):
        (JSC::CodeGenerator::highestUsedRegister):
        (JSC::CodeGenerator::addConstant):
        
        ASSERT that our caller referenced the registers it passed to us.
        Otherwise, we might overwrite them with parameters:
        (JSC::CodeGenerator::emitCall):
        (JSC::CodeGenerator::emitConstruct):

        * VM/CodeGenerator.h:
        
        Added some abstraction for getting a RegisterID for a given index,
        since the rules are a little weird:
        (JSC::CodeGenerator::registerFor):

        * VM/Machine.cpp:

        Utility function to transform a machine return PC to a virtual machine
        return VPC, for the sake of stack unwinding, since both PCs are stored
        in the same location now:
        (JSC::vPCForPC):

        Tweaked to account for new call frame:
        (JSC::Machine::initializeCallFrame):
        
        Tweaked to account for registerOffset supplied by caller:
        (JSC::slideRegisterWindowForCall):

        Tweaked to account for new register layout:
        (JSC::scopeChainForCall):
        (JSC::Machine::callEval):
        (JSC::Machine::dumpRegisters):
        (JSC::Machine::unwindCallFrame):
        (JSC::Machine::execute):

        Changed op_call and op_construct to implement the new calling convention:
        (JSC::Machine::privateExecute):

        Tweaked to account for the new register layout:
        (JSC::Machine::retrieveArguments):
        (JSC::Machine::retrieveCaller):
        (JSC::Machine::retrieveLastCaller):
        (JSC::Machine::callFrame):
        (JSC::Machine::getArgumentsData):

        Changed CTI call helpers to implement the new calling convention:
        (JSC::Machine::cti_op_call_JSFunction):
        (JSC::Machine::cti_op_call_NotJSFunction):
        (JSC::Machine::cti_op_ret_activation):
        (JSC::Machine::cti_op_ret_profiler):
        (JSC::Machine::cti_op_construct_JSConstruct):
        (JSC::Machine::cti_op_construct_NotJSConstruct):
        (JSC::Machine::cti_op_call_eval):

        * VM/Machine.h:

        * VM/Opcode.h:
        
        Renamed op_initialise_locals to op_init, because this opcode
        doesn't initialize all locals, and it doesn't initialize only locals.
        Also, to spite Oliver.
        
        * VM/RegisterFile.h:
        
        New call frame enumeration values:
        (JSC::RegisterFile::):

        Simplified the calculation of whether a RegisterID is a temporary,
        since we can no longer assume that all positive non-constant registers
        are temporaries:
        * VM/RegisterID.h:
        (JSC::RegisterID::RegisterID):
        (JSC::RegisterID::setTemporary):
        (JSC::RegisterID::isTemporary):

        Renamed firstArgumentIndex to firstParameterIndex because the assumption
        that this variable pertained to the actual arguments supplied by the
        caller caused me to write some buggy code:
        * kjs/Arguments.cpp:
        (JSC::ArgumentsData::ArgumentsData):
        (JSC::Arguments::Arguments):
        (JSC::Arguments::fillArgList):
        (JSC::Arguments::getOwnPropertySlot):
        (JSC::Arguments::put):