1. 06 Oct, 2008 5 commits
    • mjs@apple.com's avatar
      JavaScriptCore: · 6c3268ce
      mjs@apple.com authored
      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):
      
      JavaScriptGlue:
      
      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
      
              * JSUtils.cpp:
              (KJSValueToCFTypeInternal):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      6c3268ce
    • mjs@apple.com's avatar
      2008-10-06 Maciej Stachowiak <mjs@apple.com> · d2c36fec
      mjs@apple.com authored
              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):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37333 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d2c36fec
    • hausmann@webkit.org's avatar
      2008-10-06 Ariya Hidayat <ariya.hidayat@trolltech.com> · 33791a88
      hausmann@webkit.org authored
              Reviewed by Simon.
      
              Build fix for MinGW.
      
              * platform/win/SystemTimeWin.cpp:
              * plugins/win/PluginViewWin.cpp:
              (WebCore::PluginView::invalidateRect):
      
      2008-10-06  Ariya Hidayat  <ariya.hidayat@trolltech.com>
      
              Reviewed by Simon.
      
              Build fix for MinGW.
      
              * JavaScriptCore.pri:
              * kjs/DateMath.cpp:
              (JSC::highResUpTime):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37331 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      33791a88
    • cwzwarich@webkit.org's avatar
      2008-10-05 Cameron Zwarich <zwarich@apple.com> · 08420452
      cwzwarich@webkit.org authored
              Reviewed by Oliver Hunt.
      
              Remove ScopeNode::containsClosures() now that it is unused.
      
              * kjs/nodes.h:
              (JSC::ScopeNode::containsClosures):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      08420452
    • cwzwarich@webkit.org's avatar
      2008-10-05 Cameron Zwarich <zwarich@apple.com> · a3b5f8a7
      cwzwarich@webkit.org authored
              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.
      
              JavaScriptCore:
      
              * 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:
      
              LayoutTests:
      
              * fast/js/function-dot-arguments-expected.txt:
              * fast/js/resources/function-dot-arguments.js:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a3b5f8a7
  2. 05 Oct, 2008 4 commits
    • mjs@apple.com's avatar
      2008-10-05 Maciej Stachowiak <mjs@apple.com> · 05456d94
      mjs@apple.com authored
              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.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      05456d94
    • weinig@apple.com's avatar
      2008-10-05 Sam Weinig <sam@webkit.org> · 1c52b486
      weinig@apple.com authored
              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):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1c52b486
    • cwzwarich@webkit.org's avatar
      2008-10-05 Cameron Zwarich <zwarich@apple.com> · bf16a7df
      cwzwarich@webkit.org authored
              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):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37320 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      bf16a7df
    • barraclough@apple.com's avatar
      2008-10-05 Gavin Barraclough <barraclough@apple.com> · 6bd3e165
      barraclough@apple.com authored
              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:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      6bd3e165
  3. 04 Oct, 2008 3 commits
    • weinig@apple.com's avatar
      2008-10-04 Sam Weinig <sam@webkit.org> · 6e56e4ab
      weinig@apple.com authored
              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):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      6e56e4ab
    • darin@apple.com's avatar
      JavaScriptCore: · d3f46409
      darin@apple.com authored
      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.
      
      WebKit/mac:
      
      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
      
              * WebView/WebScriptDebugger.mm:
              (WebScriptDebugger::WebScriptDebugger): Remove 0 passed for ExecState.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d3f46409
    • mjs@apple.com's avatar
      JavaScriptCore: · 8b246d6d
      mjs@apple.com authored
      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):
      
      WebCore:
      
      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
      
              Updated so toThis conversion for the split window is handled properly.
      
              * bindings/scripts/CodeGeneratorJS.pm:
      
      LayoutTests:
      
      2008-10-03  Maciej Stachowiak  <mjs@apple.com>
      
              Reviewed by Cameron Zwarich.
              
              - test case for: "this" object in methods called on primitives should be wrapper object
      
              * fast/js/primitive-method-this-expected.txt: Added.
              * fast/js/primitive-method-this.html: Added.
              * fast/js/resources/primitive-method-this.js: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37285 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      8b246d6d
  4. 03 Oct, 2008 9 commits
    • mjs@apple.com's avatar
      2008-10-03 Maciej Stachowiak <mjs@apple.com> · 43625524
      mjs@apple.com authored
              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):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      43625524
    • cwzwarich@webkit.org's avatar
      2008-10-03 Cameron Zwarich <zwarich@apple.com> · fde1c9a7
      cwzwarich@webkit.org authored
              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):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37268 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      fde1c9a7
    • darin@apple.com's avatar
      2008-10-03 Darin Adler <darin@apple.com> · 384be662
      darin@apple.com authored
              * 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.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      384be662
    • darin@apple.com's avatar
      2008-10-03 Darin Adler <darin@apple.com> · 2bfc9c81
      darin@apple.com authored
              - try to fix Windows build
      
              * kjs/ScopeChain.h: Add forward declaration of JSGlobalData.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37259 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      2bfc9c81
    • darin@apple.com's avatar
      JavaScriptCore: · 3d73fee8
      darin@apple.com authored
      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.
      
      WebCore:
      
      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.
      
              * bindings/js/JSDOMWindowBase.cpp:
              (WebCore::JSDOMWindowBase::JSDOMWindowBaseData::JSDOMWindowBaseData):
              Removed an argument now that JSGlobalObject doesn't need it any more.
              (WebCore::JSDOMWindowBase::JSDOMWindowBase): Removed the argument from
              the JSDOMWindowBaseData constructor, and added the this argument to the
              JSGlobalObject constructor. This is because a couple key bits of
              initialization moved from the data constructor to the JSGlobalObject
              constructor.
              * bindings/js/JSDOMWindowBase.h: Ditto.
      
              * bridge/qt/qt_runtime.cpp:
              (JSC::Bindings::QtRuntimeMethod::QtRuntimeMethod):
              * bridge/runtime_method.cpp:
              (JSC::RuntimeMethod::RuntimeMethod):
              Pass JSGlobalData* instead of ExecState* to the InternalFunction
              constructor.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37257 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      3d73fee8
    • cwzwarich@webkit.org's avatar
      2008-10-03 Cameron Zwarich <zwarich@apple.com> · 547efc84
      cwzwarich@webkit.org authored
              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):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      547efc84
    • darin@apple.com's avatar
      2008-10-03 Darin Adler <darin@apple.com> · d4865d5c
      darin@apple.com authored
              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.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37242 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d4865d5c
    • darin@apple.com's avatar
      2008-10-03 Darin Adler <darin@apple.com> · 8f2349d1
      darin@apple.com authored
              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.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37240 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      8f2349d1
    • mjs@apple.com's avatar
      2008-10-03 Maciej Stachowiak <mjs@apple.com> · d180f6d6
      mjs@apple.com authored
              Rubber stamped by Cameron Zwarich.
              
              - fix mistaken change of | to || which caused a big perf regression on EarleyBoyer
      
              * kjs/grammar.y:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37227 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d180f6d6
  5. 02 Oct, 2008 7 commits
    • darin@apple.com's avatar
      JavaScriptCore: · b6295d46
      darin@apple.com authored
      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.
      
      WebCore:
      
      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
      
              * bindings/js/GCController.cpp:
              (WebCore::collect): Use heap. instead of heap-> to work with the heap.
              (WebCore::GCController::gcTimerFired): Ditto.
              (WebCore::GCController::garbageCollectNow): Ditto.
              * bindings/js/JSDOMWindowShell.cpp:
              (WebCore::JSDOMWindowShell::operator new): Ditto.
              * storage/Database.cpp:
              (WebCore::Database::Database): Ditto.
      
      WebKit/mac:
      
      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
      
              * Misc/WebCoreStatistics.mm:
              (+[WebCoreStatistics javaScriptObjectsCount]): Use heap. instead of heap-> to
              work with the heap.
              (+[WebCoreStatistics javaScriptGlobalObjectsCount]): Ditto.
              (+[WebCoreStatistics javaScriptProtectedObjectsCount]): Ditto.
              (+[WebCoreStatistics javaScriptProtectedGlobalObjectsCount]): Ditto.
              (+[WebCoreStatistics javaScriptProtectedObjectTypeCounts]): Ditto.
              (+[WebCoreStatistics javaScriptReferencedObjectsCount]): Ditto.
      
      WebKit/win:
      
      2008-10-02  Darin Adler  <darin@apple.com>
      
              - https://bugs.webkit.org/show_bug.cgi?id=21321
                Bug 21321: speed up JavaScriptCore by inlining Heap in JSGlobalData
      
              * WebCoreStatistics.cpp:
              (WebCoreStatistics::javaScriptObjectsCount): Use heap. instead of heap-> to
              work with the heap.
              (WebCoreStatistics::javaScriptGlobalObjectsCount): Ditto.
              (WebCoreStatistics::javaScriptProtectedObjectsCount): Ditto.
              (WebCoreStatistics::javaScriptProtectedGlobalObjectsCount): Ditto.
              (WebCoreStatistics::javaScriptProtectedObjectTypeCounts): Ditto.
              * WebJavaScriptCollector.cpp:
              (WebJavaScriptCollector::objectCount): Ditto.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37215 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b6295d46
    • cwzwarich@webkit.org's avatar
      2008-10-02 Cameron Zwarich <zwarich@apple.com> · 7ec515a5
      cwzwarich@webkit.org authored
              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):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37213 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      7ec515a5
    • cwzwarich@webkit.org's avatar
      2008-10-02 Cameron Zwarich <zwarich@apple.com> · 659f8464
      cwzwarich@webkit.org authored
              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:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      659f8464
    • ggaren@apple.com's avatar
      2008-10-02 Geoffrey Garen <ggaren@apple.com> · c9cad7f3
      ggaren@apple.com authored
              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.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c9cad7f3
    • ap@webkit.org's avatar
      Reviewed by Darin Adler. · 03710838
      ap@webkit.org authored
              https://bugs.webkit.org/show_bug.cgi?id=21304
              Stop using a static wrapper map for WebCore JS bindings
      
              The static domObjects map was not thread safe.
      
              * dom/Document.h:
              (WebCore::Document::messagePorts): Added an accessor for JSDocument to iterate over message
              ports.
              (WebCore::Document::xmlHttpRequests): Ditto for XMLHttpRequests.
      
              * dom/Document.cpp:
              (WebCore::Document::createdXMLHttpRequest):
              (WebCore::Document::destroyedXMLHttpRequest):
              Moved XMLHttpRequest tracking from a global map to Document.
      
              * GNUmakefile.am:
              * WebCore.pro:
              * WebCore.vcproj/WebCore.vcproj:
              * WebCore.xcodeproj/project.pbxproj:
              * WebCoreSources.bkl:
              * webcore-base.bkl:
              * bindings/DOMProtect.cpp: Removed.
              * bindings/DOMProtect.h: Removed.
              Removed gcProtect(Unprotect)DOMObject - its callers do not have a JSGlobalData reference,
              so they can no longer protect bindings objects.
      
              * dom/MessagePort.cpp:
              (WebCore::CloseMessagePortTimer::CloseMessagePortTimer):
              (WebCore::CloseMessagePortTimer::fired):
              (WebCore::MessagePort::MessagePort):
              (WebCore::MessagePort::queueCloseEvent):
              (WebCore::MessagePort::setPendingActivity):
              (WebCore::MessagePort::unsetPendingActivity):
              * dom/MessagePort.h:
              (WebCore::MessagePort::hasPendingActivity):
              MessagePort now counts outstanding async events, so JSDocument::mark can decide whether
              to protect it.
      
              * xml/XMLHttpRequest.h:
              (WebCore::XMLHttpRequest::hasPendingActivity):
              * xml/XMLHttpRequest.cpp:
              (WebCore::XMLHttpRequest::XMLHttpRequest):
              (WebCore::XMLHttpRequest::~XMLHttpRequest):
              (WebCore::XMLHttpRequest::loadRequestAsynchronously):
              (WebCore::XMLHttpRequest::dropProtection):
              (WebCore::XMLHttpRequest::didFinishLoadingPreflight):
              (WebCore::XMLHttpRequest::cancelRequests):
              (WebCore::XMLHttpRequest::detachRequests):
              (WebCore::XMLHttpRequest::setPendingActivity):
              (WebCore::XMLHttpRequest::unsetPendingActivity):
              Moved XMLHttpRequest tracking from a global map to Document. 
      
              * bindings/js/JSDOMBinding.cpp:
              (WebCore::wrapperSet):
              (WebCore::DOMObjectWrapperMap::mapFor):
              (WebCore::DOMObjectWrapperMap::get):
              (WebCore::DOMObjectWrapperMap::set):
              (WebCore::DOMObjectWrapperMap::remove):
              (WebCore::getCachedDOMObjectWrapper):
              (WebCore::cacheDOMObjectWrapper):
              (WebCore::forgetDOMObject):
              (WebCore::getCachedDOMNodeWrapper):
              (WebCore::forgetDOMNode):
              (WebCore::cacheDOMNodeWrapper):
              (WebCore::markActiveObjectsForDocument):
              * bindings/js/JSDOMBinding.h:
              (WebCore::createDOMObjectWrapper):
              (WebCore::getDOMObjectWrapper):
              Wrapper map is now kept as JSGlobalData::clientData. Also changed debug-only wrapperSet
              to be per-thread (this is slower than going to JSGlobalData, but fast enough for debug).
              WebCore objects can never migrate between threads.
      
              * bindings/js/JSDocumentCustom.cpp:
              (WebCore::JSDocument::mark):
              Call markActiveObjectsForDocument() from JSDOMBinding.
      
              * bindings/js/JSCSSRuleCustom.cpp:
              (WebCore::toJS):
              * bindings/js/JSCSSValueCustom.cpp:
              (WebCore::toJS):
              * bindings/js/JSDOMWindowCustom.cpp:
              (WebCore::markDOMObjectWrapper):
              (WebCore::JSDOMWindow::mark):
              * bindings/js/JSEventCustom.cpp:
              (WebCore::toJS):
              * bindings/js/JSEventTarget.cpp:
              (WebCore::toJS):
              * bindings/js/JSHTMLCollectionCustom.cpp:
              (WebCore::toJS):
              * bindings/js/JSImageDataCustom.cpp:
              (WebCore::toJS):
              * bindings/js/JSMessageChannelCustom.cpp:
              (WebCore::JSMessageChannel::mark):
              * bindings/js/JSMessagePortCustom.cpp:
              (WebCore::JSMessagePort::mark):
              * bindings/js/JSNodeCustom.cpp:
              (WebCore::JSNode::mark):
              * bindings/js/JSSVGPathSegCustom.cpp:
              (WebCore::toJS):
              * bindings/js/JSStyleSheetCustom.cpp:
              (WebCore::toJS):
              * bindings/js/JSXMLHttpRequestCustom.cpp:
              (WebCore::JSXMLHttpRequest::mark):
              * bindings/js/JSXMLHttpRequestUploadCustom.cpp:
              (WebCore::JSXMLHttpRequestUpload::mark):
              * bindings/js/ScriptController.cpp:
              (WebCore::ScriptController::finishedWithEvent):
              * bindings/scripts/CodeGeneratorJS.pm:
              Pass a JSGlobalData reference to functions that track JS wrapper objects.
      
      JavaScriptCore:
              * 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.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37190 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      03710838
    • ggaren@apple.com's avatar
      2008-10-02 Geoffrey Garen <ggaren@apple.com> · 306b0d57
      ggaren@apple.com authored
              Not reviewed.
              
              Try to fix Qt build.
      
              * kjs/Error.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      306b0d57
    • ggaren@apple.com's avatar
      JavaScriptCore: · 69e9ccfb
      ggaren@apple.com authored
      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.
      
      JavaScriptGlue:
      
      2008-10-01  Geoffrey Garen  <ggaren@apple.com>
      
              Reviewed by Darin Adler and Cameron Zwarich.
      
              * JSRun.cpp:
              (JSRun::Evaluate):
              (JSRun::CheckSyntax): Provide a SourceCode to the Interpreter, since
              other APIs are no longer supported.
      
      WebCore:
      
      2008-10-01  Geoffrey Garen  <ggaren@apple.com>
      
              Reviewed by Darin Adler and Cameron Zwarich.
      
              Updated for JavaScriptCore API changes: use a SourceCode instead of
              broken out parameters; treat sourceId as intptr_t.
      
              * ForwardingHeaders/kjs/SourceRange.h: Copied from ForwardingHeaders/kjs/SourceProvider.h.
              * bindings/js/JSXMLHttpRequestCustom.cpp:
              (WebCore::JSXMLHttpRequest::send):
              * bindings/js/ScriptController.cpp:
              (WebCore::ScriptController::evaluate):
              * bindings/js/StringSourceProvider.h:
              (WebCore::StringSourceProvider::create):
              (WebCore::StringSourceProvider::StringSourceProvider):
      
              (WebCore::makeSource): Added a makeSource function for convenience.
      
              * bindings/objc/WebScriptObject.mm:
              (-[WebScriptObject evaluateWebScript:]):
              * bridge/NP_jsobject.cpp:
              (_NPN_Evaluate):
              * bridge/jni/jni_jsobject.mm:
              (JavaJSObject::call):
              (JavaJSObject::eval):
              (JavaJSObject::getMember):
              (JavaJSObject::setMember):
              (JavaJSObject::removeMember):
      
              * bridge/jni/jni_runtime.h:
              (JSC::Bindings::JavaString::operator UString): Replaced the explicit
              ustring() function with an implicit operator because this class already
              holds a UString::rep.
      
              * page/Console.cpp:
              (WebCore::retrieveLastCaller):
              (WebCore::Console::trace):
              * page/InspectorController.cpp:
              (WebCore::jsStringRef):
              (WebCore::InspectorController::addBreakpoint):
              (WebCore::InspectorController::removeBreakpoint):
              (WebCore::InspectorController::didParseSource):
              (WebCore::InspectorController::failedToParseSource):
              * page/InspectorController.h:
              * page/JavaScriptCallFrame.cpp:
              (WebCore::JavaScriptCallFrame::JavaScriptCallFrame):
              * page/JavaScriptCallFrame.h:
              (WebCore::JavaScriptCallFrame::create):
              (WebCore::JavaScriptCallFrame::sourceIdentifier):
              (WebCore::JavaScriptCallFrame::update):
              * page/JavaScriptDebugListener.h:
              * page/JavaScriptDebugServer.cpp:
              (WebCore::JavaScriptDebugServer::addBreakpoint):
              (WebCore::JavaScriptDebugServer::removeBreakpoint):
              (WebCore::JavaScriptDebugServer::hasBreakpoint):
              (WebCore::dispatchDidParseSource):
              (WebCore::dispatchFailedToParseSource):
              (WebCore::JavaScriptDebugServer::sourceParsed):
              (WebCore::JavaScriptDebugServer::callEvent):
              (WebCore::JavaScriptDebugServer::atStatement):
              (WebCore::JavaScriptDebugServer::returnEvent):
              (WebCore::JavaScriptDebugServer::exception):
              (WebCore::JavaScriptDebugServer::willExecuteProgram):
              (WebCore::JavaScriptDebugServer::didExecuteProgram):
              (WebCore::JavaScriptDebugServer::didReachBreakpoint):
              * page/JavaScriptDebugServer.h:
              * page/inspector/ScriptsPanel.js: Renamed internal uses of sourceId and 
              sourceIdentifier to sourceID.
      
      WebKit/mac:
      
      2008-10-01  Geoffrey Garen  <ggaren@apple.com>
      
              Reviewed by Darin Adler and Cameron Zwarich.
      
              Updated for JavaScriptCore API changes: use a SourceCode instead of
              broken out parameters; treat sourceId as intptr_t.
              
              We still treat sourceId as int in some cases because of DashCode. See
              <rdar://problem/6263293> WebScriptDebugDelegate should use intptr_t for
              sourceId, not int.
      
              * WebView/WebScriptDebugger.h:
              * WebView/WebScriptDebugger.mm:
              (toNSString):
              (WebScriptDebugger::sourceParsed):
              (WebScriptDebugger::callEvent):
              (WebScriptDebugger::atStatement):
              (WebScriptDebugger::returnEvent):
              (WebScriptDebugger::exception):
              (WebScriptDebugger::willExecuteProgram):
              (WebScriptDebugger::didExecuteProgram):
              (WebScriptDebugger::didReachBreakpoint):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37184 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      69e9ccfb
  6. 01 Oct, 2008 5 commits
    • cwzwarich@webkit.org's avatar
      2008-10-01 Cameron Zwarich <zwarich@apple.com> · 264096b3
      cwzwarich@webkit.org authored
              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):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      264096b3
    • darin@apple.com's avatar
      2008-09-30 Darin Adler <darin@apple.com> · 4447cd6e
      darin@apple.com authored
              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.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37175 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      4447cd6e
    • cwzwarich@webkit.org's avatar
      2008-10-01 Cameron Zwarich <zwarich@apple.com> · 7a82efe0
      cwzwarich@webkit.org authored
              Not reviewed.
      
              Speculative Windows build fix.
      
              * kjs/grammar.y:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37166 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      7a82efe0
    • cwzwarich@webkit.org's avatar
      2008-10-01 Cameron Zwarich <zwarich@apple.com> · d082d3f5
      cwzwarich@webkit.org authored
              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.
      
              JavaScriptCore:
      
              * 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):
      
              LayoutTests:
      
              * fast/js/arguments-expected.txt:
              * fast/js/function-dot-arguments-expected.txt:
              * fast/js/resources/arguments.js:
              * fast/js/resources/function-dot-arguments.js:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37160 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d082d3f5
    • kmccullough@apple.com's avatar
      2008-10-01 Kevin McCullough <kmccullough@apple.com> · a6e22976
      kmccullough@apple.com authored
              Rubberstamped by Geoff .
      
              Remove BreakpointCheckStatement because it's not used anymore.
              No effect on sunspider or the jsc tests.
      
              * kjs/nodes.cpp:
              * kjs/nodes.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37148 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a6e22976
  7. 30 Sep, 2008 5 commits
    • mjs@apple.com's avatar
      2008-09-30 Maciej Stachowiak <mjs@apple.com> · 895b608a
      mjs@apple.com authored
              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:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37132 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      895b608a
    • darin@apple.com's avatar
      2008-09-30 Darin Adler <darin@apple.com> · c41f8ed8
      darin@apple.com authored
              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.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37125 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c41f8ed8
    • cwzwarich@webkit.org's avatar
      2008-09-30 Cameron Zwarich <zwarich@apple.com> · ed6dff14
      cwzwarich@webkit.org authored
              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>
      
              JavaScriptCore:
      
              * VM/CodeGenerator.cpp:
              (JSC::CodeGenerator::CodeGenerator):
              * kjs/NodeInfo.h:
              * kjs/grammar.y:
      
              LayoutTests:
      
              * fast/js/arguments-expected.txt:
              * fast/js/function-dot-arguments-expected.txt: Added.
              * fast/js/function-dot-arguments.html: Added.
              * fast/js/resources/arguments.js:
              * fast/js/resources/function-dot-arguments.js: Added.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37117 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      ed6dff14
    • ggaren@apple.com's avatar
      2008-09-30 Geoffrey Garen <ggaren@apple.com> · d280d68a
      ggaren@apple.com authored
              Not reviewed.
      
              * kjs/Shell.cpp:
              (runWithScripts): Fixed indentation.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37116 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d280d68a
    • mrowe@apple.com's avatar
      Build fix. · db57abe4
      mrowe@apple.com authored
      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.
      
      Rubber-stamped by Sam Weinig.
      
      * kjs/InternalFunction.cpp:
      (JSC::InternalFunction::classInfo):
      * kjs/InternalFunction.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37103 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      db57abe4
  8. 29 Sep, 2008 2 commits
    • mjs@apple.com's avatar
      2008-09-29 Maciej Stachowiak <mjs@apple.com> · aaf4f5cb
      mjs@apple.com authored
              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:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37089 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      aaf4f5cb
    • darin@apple.com's avatar
      JavaScriptCore: · 8d35fe02
      darin@apple.com authored
      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.
      
      WebCore:
      
      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
      
              * bindings/js/JSDOMWindowBase.cpp:
              (WebCore::JSDOMWindowBase::JSDOMWindowBase): Removed globalThisValue argument
              for base class constructor.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37088 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      8d35fe02