1. 07 Jun, 2008 3 commits
    • ap@webkit.org's avatar
      Build fix - actually adding JSGlobalData.cpp to non-Mac builds! · d3b67376
      ap@webkit.org authored
              * GNUmakefile.am:
              * JavaScriptCore.pri:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
              * JavaScriptCoreSources.bkl:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34424 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d3b67376
    • ap@webkit.org's avatar
      Try to fix Gtk/gcc 4.3 build. · cb8bbb97
      ap@webkit.org authored
              * kjs/JSGlobalData.h: Include ustring.h instead of forward-declaring UString::Rep.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34416 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      cb8bbb97
    • ap@webkit.org's avatar
      Reviewed by Darin. · 5b30cfc2
      ap@webkit.org authored
              Combine per-thread objects into one, to make it easier to support legacy clients (for
              which they shouldn't be really per-thread).
      
              No change on SunSpider total.
      
              * JavaScriptCore.xcodeproj/project.pbxproj: Added JSGlobalData.{h,cpp}
      
              * kjs/JSGlobalData.cpp: Added.
              (KJS::JSGlobalData::JSGlobalData):
              (KJS::JSGlobalData::~JSGlobalData):
              (KJS::JSGlobalData::threadInstance):
              * kjs/JSGlobalData.h: Added.
              This class encapsulates all data that should be per-thread (or shared between legacy clients).
              It will also keep a Heap pointer, but right now, Heap (Collector) methods are all static.
      
              * kjs/identifier.h:
              (KJS::Identifier::Identifier):
              Added a constructor explicitly taking JSGlobalData to access IdentifierTable. Actually,
              all of them should, but this will be a separate patch.
      
              * kjs/identifier.cpp:
              (KJS::IdentifierTable::literalTable):
              (KJS::createIdentifierTable):
              (KJS::deleteIdentifierTable):
              (KJS::Identifier::add):
              (KJS::Identifier::addSlowCase):
              Combined IdentifierTable and LiteralIdentifierTable into a single class for simplicity.
      
              * kjs/grammar.y: kjsyyparse now takes JSGlobalData, not just a Lexer.
      
              * kjs/nodes.cpp:
              (KJS::Node::Node):
              (KJS::EvalFunctionCallNode::emitCode):
              (KJS::ScopeNode::ScopeNode):
              Changed to access Lexer and Parser via JSGlobalData::threadInstance(). This is also a
              temporary measure, they will need to use JSGlobalData explicitly.
      
              * VM/CodeGenerator.cpp:
              (KJS::CodeGenerator::CodeGenerator):
              * VM/CodeGenerator.h:
              * VM/Machine.cpp:
              (KJS::callEval):
              * kjs/CommonIdentifiers.cpp:
              (KJS::CommonIdentifiers::CommonIdentifiers):
              * kjs/CommonIdentifiers.h:
              * kjs/DebuggerCallFrame.cpp:
              (KJS::DebuggerCallFrame::evaluate):
              * kjs/ExecState.cpp:
              (KJS::ExecState::ExecState):
              * kjs/ExecState.h:
              (KJS::ExecState::globalData):
              (KJS::ExecState::identifierTable):
              (KJS::ExecState::propertyNames):
              (KJS::ExecState::emptyList):
              (KJS::ExecState::lexer):
              (KJS::ExecState::parser):
              (KJS::ExecState::arrayTable):
              (KJS::ExecState::dateTable):
              (KJS::ExecState::mathTable):
              (KJS::ExecState::numberTable):
              (KJS::ExecState::RegExpImpTable):
              (KJS::ExecState::RegExpObjectImpTable):
              (KJS::ExecState::stringTable):
              * kjs/InitializeThreading.cpp:
              (KJS::initializeThreadingOnce):
              * kjs/JSGlobalObject.cpp:
              (KJS::JSGlobalObject::init):
              * kjs/JSGlobalObject.h:
              (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
              (KJS::JSGlobalObject::head):
              (KJS::JSGlobalObject::globalData):
              * kjs/Parser.cpp:
              (KJS::Parser::parse):
              * kjs/Parser.h:
              * kjs/function.cpp:
              (KJS::FunctionImp::getParameterName):
              (KJS::IndexToNameMap::unMap):
              (KJS::globalFuncEval):
              * kjs/function_object.cpp:
              (KJS::FunctionObjectImp::construct):
              * kjs/interpreter.cpp:
              (KJS::Interpreter::checkSyntax):
              (KJS::Interpreter::evaluate):
              * kjs/lexer.cpp:
              (kjsyylex):
              * kjs/lexer.h:
              * kjs/testkjs.cpp:
              (prettyPrintScript):
              Updated for the above changes. Most of threadInstance uses here will need to be replaced with
              explicitly passed pointers to support legacy JSC clients.
      
              * JavaScriptCore.exp: Removed KJS::parser().
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34412 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      5b30cfc2
  2. 06 Jun, 2008 2 commits
  3. 05 Jun, 2008 13 commits
  4. 04 Jun, 2008 5 commits
    • weinig@apple.com's avatar
      2008-06-04 Sam Weinig <sam@webkit.org> · a963b966
      weinig@apple.com authored
              Reviewed by Maciej Stachowiak.
      
              Big cleanup of formatting and whitespace.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34372 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a963b966
    • cwzwarich@webkit.org's avatar
      2008-06-04 Cameron Zwarich <cwzwarich@uwaterloo.ca> · b7a96101
      cwzwarich@webkit.org authored
              Reviewed by Oliver.
      
              Add an option to dump statistics on executed instructions.
      
              JavaScriptCore:
      
              * VM/Machine.cpp:
              (KJS::Machine::privateExecute):
              * VM/Opcode.cpp:
              (KJS::):
              (KJS::OpcodeStats::~OpcodeStats):
              (KJS::OpcodeStats::recordInstruction):
              * VM/Opcode.h:
      
              WebKitTools:
      
              * Scripts/check-for-global-initializers:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34371 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b7a96101
    • kmccullough@apple.com's avatar
      2008-06-04 Kevin McCullough <kmccullough@apple.com> · 7a183244
      kmccullough@apple.com authored
              Reviewed by Geoff.
      
              <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
              profiler.
              - This patch removes the use of recursion for the sort functions.
      
              * JavaScriptCore.exp: Change the signatures of the functions being
              exported.
              * profiler/Profile.cpp:
              (KJS::Profile::sort): This generic function will accept any of the
              static sort functions and apply them to the whole tree.
              * profiler/Profile.h: All of the sorting functions now call the new
              sort() function.
              (KJS::Profile::sortTotalTimeDescending):
              (KJS::Profile::sortTotalTimeAscending):
              (KJS::Profile::sortSelfTimeDescending):
              (KJS::Profile::sortSelfTimeAscending):
              (KJS::Profile::sortCallsDescending):
              (KJS::Profile::sortCallsAscending):
              (KJS::Profile::sortFunctionNameDescending):
              (KJS::Profile::sortFunctionNameAscending):
              * profiler/ProfileNode.cpp:
              (KJS::ProfileNode::ProfileNode): m_head used to point to the head node
              if this was the head node.  It now points to null to make iteration easy
              (KJS::ProfileNode::willExecute): Now must check if m_head is null, this
              check used to happend in the constructor.
              (KJS::ProfileNode::stopProfiling): Again the check is slightly different
              to determine if this is the head.
              (KJS::ProfileNode::traverseNextNode): This function returns the next
              node in post order.
              (KJS::ProfileNode::sort): This generic function will sort according to
              the comparator passed in, then reset the children pointers to macth the
              new order.
              * profiler/ProfileNode.h: The sorting function were removed from the
              definition file and instead use the new generic sort() function
              (KJS::ProfileNode::totalPercent): because the head can now be empty we
              need to check here too for the head node.
              (KJS::ProfileNode::selfPercent): Ditto
              (KJS::ProfileNode::firstChild): This function is necessary for the 
              iterative algorithm in Profile.cpp.
              (KJS::ProfileNode::sortTotalTimeDescending):
              (KJS::ProfileNode::sortTotalTimeAscending):
              (KJS::ProfileNode::sortSelfTimeDescending):
              (KJS::ProfileNode::sortSelfTimeAscending):
              (KJS::ProfileNode::sortCallsDescending):
              (KJS::ProfileNode::sortCallsAscending):
              (KJS::ProfileNode::sortFunctionNameDescending):
              (KJS::ProfileNode::sortFunctionNameAscending):
              (KJS::ProfileNode::childrenBegin):
              (KJS::ProfileNode::childrenEnd):
              (KJS::ProfileNode::totalTimeDescendingComparator):
              (KJS::ProfileNode::totalTimeAscendingComparator):
              (KJS::ProfileNode::selfTimeDescendingComparator):
              (KJS::ProfileNode::selfTimeAscendingComparator):
              (KJS::ProfileNode::callsDescendingComparator):
              (KJS::ProfileNode::callsAscendingComparator):
              (KJS::ProfileNode::functionNameDescendingComparator):
              (KJS::ProfileNode::functionNameAscendingComparator):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34362 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      7a183244
    • ap@webkit.org's avatar
      Reviewed by Darin. · faaccdb1
      ap@webkit.org authored
              Fix JSClassCreate to work with old JSCore API threading model.
      
              No change on SunSpider.
      
              * API/JSClassRef.cpp: (OpaqueJSClass::OpaqueJSClass): Since JSClass is constructed without
              a context, there is no way for it to create Identifiers.
              Also, added initializeThreading(), just for good measure.
      
              * API/JSCallbackObjectFunctions.h: (KJS::::getPropertyNames): Make an Identifier out of the
              string here, because propertyNames.add() needs that.
      
              * kjs/identifier.cpp:
              * kjs/identifier.h:
              (KJS::Identifier::equal):
              * kjs/ustring.cpp:
              (KJS::equal):
              Moved equal() from identifier.h to ustring.h, because it's not really about Identifiers,
              and to make it possible to use it from StrHash.
              Include StrHash.h from ustring.h to avoid having the behavior depend on headers that happen
              to be included.
      
              * wtf/StrHash.h: Removed.
              * kjs/ustring.h: Made RefPtr<UString::Rep> use the same default hash as UString::Rep* (it
              used to default to pointer equality). Moved the whole StrHash header into ustring.h.
      
              * JavaScriptCore.exp: Export equal() for WebCore use (this StrHash is used in c_class.cpp,
              jni_class.cpp, and npruntime.cpp).
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34361 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      faaccdb1
    • ap@webkit.org's avatar
      Rubber-stamped by Darin. · 84ea6b9c
      ap@webkit.org authored
              Fix spacing in collector.{h,cpp}.
      
              * kjs/collector.cpp:
              * kjs/collector.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34360 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      84ea6b9c
  5. 03 Jun, 2008 6 commits
    • cwzwarich@webkit.org's avatar
      2008-06-03 Cameron Zwarich <cwzwarich@uwaterloo.ca> · 8fc5b38b
      cwzwarich@webkit.org authored
              Reviewed by Maciej.
      
              Build fix. The cleanup in r34355 missed a method.
      
              * kjs/nodes.cpp:
              * kjs/nodes.h:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34356 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      8fc5b38b
    • darin@apple.com's avatar
      JavaScriptCore: · 4674e190
      darin@apple.com authored
      2008-06-03  Darin Adler  <darin@apple.com>
      
              Reviewed by Geoff.
      
              - https://bugs.webkit.org/show_bug.cgi?id=19269
                speed up SunSpider by eliminating the toObject call for most get/put/delete
      
              Makes standalone SunSpider 1.025x as fast as before.
      
              The getOwnPropertySlot virtual function now takes care of the toObject call
              for get. Similarly, the put function (and later deleteProperty) does the
              same for those operations. To do this, the virtual functions were moved from
              the JSObject class to the JSCell class. Also, since the caller no longer knows
              the identity of the "original object", which is used by JavaScript-function
              based getters, changed the PropertySlot class so the original object is
              already stored in the slot when getOwnPropertySlot is called, if the caller
              intends to call getValue.
      
              This affected the old interpreter code enough that the easiest thing for me
              was to just delete it. While I am not certain the mysterious slowdown is not
              still occurring, the net change is definitely a significant speedup.
      
              * JavaScriptCore.exp: Updated.
      
              * VM/Machine.cpp: Moved the UNLIKELY macro into AlwaysInline.h.
              (KJS::resolve): Set up the originalObject in the PropertySlot before
              calling getPropertySlot. Also removed the originalObject argument from
              getValue.
              (KJS::resolve_skip): Ditto.
              (KJS::resolveBaseAndProperty): Ditto.
              (KJS::resolveBaseAndFunc): Ditto.
              (KJS::Machine::privateExecute): Removed the toObject calls from the get and
              put functions where possible, instead calling directly with JSValue and letting
              the JSValue and JSCell calls handle toObject. Same for toThisObject.
      
              * kjs/ExecState.h: Removed OldInterpreterExecState.
      
              * API/JSBase.cpp: Updated includes.
      
              * kjs/LocalStorageEntry.h: Removed contents. Later we can remove the file too.
      
              * kjs/array_instance.cpp:
              (KJS::ArrayInstance::lengthGetter): Removed originalObject argumet.
              (KJS::ArrayInstance::inlineGetOwnPropertySlot): Don't pass a base value to
              setValueSlot. Also use UNLIKELY around the "getting elements past the end of
              the array" code path; less common than successfully getting an element.
      
              * kjs/array_object.cpp:
              (KJS::getProperty): Initialize the PropertySlot with the original object.
              Don't pass the original object to the get function.
              (KJS::arrayProtoFuncFilter): Ditto.
              (KJS::arrayProtoFuncMap): Ditto.
              (KJS::arrayProtoFuncEvery): Ditto.
              (KJS::arrayProtoFuncForEach): Ditto.
              (KJS::arrayProtoFuncSome): Ditto.
      
              * kjs/function_object.cpp:
              (KJS::FunctionObjectImp::construct): Removed an obsolete comment.
      
              * kjs/grammar.y: Eliminated support for some of the node types that were
              used to optimize executing from the syntax tree.
      
              * kjs/internal.cpp:
              (KJS::StringImp::toThisObject): Added. Same as toObject.
              (KJS::NumberImp::toThisObject): Ditto.
              (KJS::GetterSetterImp::getOwnPropertySlot): Added. Not reached.
              (KJS::GetterSetterImp::put): Ditto.
              (KJS::GetterSetterImp::toThisObject): Ditto.
      
              * kjs/internal.h: Added toThisObject to NumberImp for speed.
      
              * kjs/lexer.cpp:
              (KJS::Lexer::shift): Changed shift to just do a single character, to unroll
              the loop and especially to make the one character case faster.
              (KJS::Lexer::setCode): Call shift multiple times instead of passing a number.
              (KJS::Lexer::lex): Ditto.
              (KJS::Lexer::matchPunctuator): Ditto. Also removed unneeded elses after returns.
              (KJS::Lexer::scanRegExp): Ditto.
              * kjs/lexer.h: Removed the count argument from shift.
      
              * kjs/math_object.cpp:
              (KJS::mathProtoFuncPow): Call jsNaN instead of jsNumber(NaN).
      
              * kjs/nodes.cpp: Removed some of the things needed only for the pre-SquirrelFish
              execution model.
              (KJS::ForNode::emitCode): Handle cases where some expressions are missing by
              not emitting any code at all. The old way was to emit code for "true", but
              this is an unnecessary remnant of the old way of doing things.
      
              * kjs/nodes.h: Removed some of the things needed only for the pre-SquirrelFish
              execution model.
      
              * kjs/object.cpp:
              (KJS::JSObject::fillGetterPropertySlot): Changed to only pass in the getter
              function. The old code passed in a base, but it was never used when
              actually getting the property; the toThisObject call was pointless. Also
              changed to not pass a base for setUndefined.
      
              * kjs/object.h: Added the new JSCell operations to GetterSetterImp.
              Never called.
              (KJS::JSObject::get): Initialize the object in the PropertySlot and don't
              pass it in getValue.
              (KJS::JSObject::getOwnPropertySlotForWrite): Removed the base argument
              in calls to setValueSlot.
              (KJS::JSObject::getOwnPropertySlot): Ditto.
              (KJS::JSValue::get): Added. Here because it calls through to JSObject.
              A version of JSObject::get that also handles the other types of JSValue
              by creating the appropriate wrapper. Saves the virtual call to toObject.
              (KJS::JSValue::put): Ditto.
              (KJS::JSValue::deleteProperty): Ditto.
      
              * kjs/property_slot.cpp:
              (KJS::PropertySlot::undefinedGetter): Removed the originalObject argument.
              (KJS::PropertySlot::ungettableGetter): Ditto.
              (KJS::PropertySlot::functionGetter): Ditto. Use the value in the base
              as the "this" object, which will be set to the original object by the new
              PropertySlot initialization code. Also call toThisObject. The old code did
              not do this, but needed to so we can properly handle the activation object
              like the other similar code paths.
      
              * kjs/property_slot.h:
              (KJS::PropertySlot::PropertySlot): Added a constructor that takes a base
              object. In debug builds, set the base to 0 if you don't pass one.
              (KJS::PropertySlot::getValue): Don't take or pass the originalObject.
              (KJS::PropertySlot::setValueSlot): Don't take a base object, and clear the
              base object in debug builds.
              (KJS::PropertySlot::setGetterSlot): Ditto.
              (KJS::PropertySlot::setUndefined): Ditto.
              (KJS::PropertySlot::setUngettable): Ditto.
              (KJS::PropertySlot::slotBase): Assert that a base object is present.
              This will fire if someone actually calls the get function without having
              passed in a base object and the getter needs it.
              (KJS::PropertySlot::setBase): Added. Used by the code that implements
              toObject so it can supply the original object after the fact.
              (KJS::PropertySlot::clearBase): Added. Clears the base, but is debug-only
              code because it's an error to fetch the base if you don't have a guarantee
              it was set.
      
              * API/JSCallbackObject.h:
              * API/JSCallbackObjectFunctions.h:
              (KJS::JSCallbackObject::cachedValueGetter):
              (KJS::JSCallbackObject::staticValueGetter):
              (KJS::JSCallbackObject::staticFunctionGetter):
              (KJS::JSCallbackObject::callbackGetter):
              * kjs/JSActivation.cpp:
              (KJS::JSActivation::getOwnPropertySlot):
              (KJS::JSActivation::argumentsGetter):
              * kjs/JSActivation.h:
              * kjs/JSVariableObject.h:
              (KJS::JSVariableObject::symbolTableGet):
              * kjs/array_instance.h:
              * kjs/function.cpp:
              (KJS::FunctionImp::argumentsGetter):
              (KJS::FunctionImp::callerGetter):
              (KJS::FunctionImp::lengthGetter):
              (KJS::Arguments::mappedIndexGetter):
              * kjs/function.h:
              * kjs/lookup.h:
              (KJS::staticFunctionGetter):
              (KJS::staticValueGetter):
              * kjs/string_object.cpp:
              (KJS::StringInstance::lengthGetter):
              (KJS::StringInstance::indexGetter):
              (KJS::stringInstanceNumericPropertyGetter):
              * kjs/string_object.h:
              Removed originalObject arguments from getters. Don't pass base values to
              the various PropertySlot functions that no longer take them.
      
              * kjs/value.cpp:
              (KJS::JSCell::getOwnPropertySlot): Added. Calls toObject and then sets the slot.
              This function has to always return true, because the caller can't walk the prototype
              chain. Because of that, we do a getPropertySlot, not getOwnPropertySlot, which works
              for the caller. This is private, only called by getOwnPropertySlotInternal.
              (KJS::JSCell::put): Added. Calls toObject and then put.
              (KJS::JSCell::toThisObject): Added. Calls toObject.
      
              * kjs/value.h: Added get, put, and toThisObject to both JSValue
              and JSCell. These take care of the toObject operation without an additional virtual
              function call, and so make the common "already an object" case faster.
      
              * wtf/AlwaysInline.h: Moved the UNLIKELY macro here for now. Maybe we can find a
              better place later, or rename this header.
      
      JavaScriptGlue:
      
      2008-06-03  Darin Adler  <darin@apple.com>
      
              - update for JavaScriptCore changes for https://bugs.webkit.org/show_bug.cgi?id=19269
                speed up SunSpider by eliminating the toObject call for most get/put/delete
      
              * UserObjectImp.cpp:
              (UserObjectImp::userObjectGetter): Removed originalObject argument.
              * UserObjectImp.h: Ditto.
      
      WebCore:
      
      2008-06-03  Justin Garcia  <justin.garcia@apple.com>
      
              Reviewed by John.
      
              <rdar://problem/5763082> GMail: Hang when removing indent from nested list
              <rdar://problem/5775449> In Gmail and GoogleDocs, a hang occurs when I attempt to apply a list style to a large selection of text
              <rdar://problem/5937624> 9D32: Hang in Safari. Using 100% of processor
      
              * editing/InsertListCommand.cpp:
              (WebCore::InsertListCommand::modifyRange): doApply() may operate on and remove 
              the last paragraph of the selection from the document if it's in the same list 
              item as startOfCurrentParagraph.  Return early to avoid an infinite loop and 
              because there is no more work to be done.  Added a FIXME (<rdar://problem/5983974>)
              about the incorrect endingSelection()s.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34355 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      4674e190
    • oliver@apple.com's avatar
      Bug 12983: Web Inspector break on the debugger keyword · 139b529b
      oliver@apple.com authored
      <https://bugs.webkit.org/show_bug.cgi?id=12983>
      
      Reviewed by Tim
      
      Added a DebuggerStatementNode to handle codegen, and added a new
      DidReachBreakPoint debug event (which will hopefully be useful
      if we ever move breakpoint management into JSC proper).  Also
      added didReachBreakpoint to Debugger to allow us to actually respond
      to this event.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      139b529b
    • mjs@apple.com's avatar
      2008-06-03 Maciej Stachowiak <mjs@apple.com> · c9037126
      mjs@apple.com authored
              Reviewed by Oliver.
              
              - document remaining opcodes.
      
              * VM/Machine.cpp:
              (KJS::Machine::privateExecute): Document call, call_eval,
              construct, ret and end opcodes.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c9037126
    • mjs@apple.com's avatar
      2008-06-03 Maciej Stachowiak <mjs@apple.com> · c5583c32
      mjs@apple.com authored
              Reviewed by Oliver.
      
              * VM/Machine.cpp:
              (KJS::Machine::privateExecute): Document throw and catch opcodes.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34335 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c5583c32
    • ggaren@apple.com's avatar
      JavaScriptCore: · 1e94a8fc
      ggaren@apple.com authored
      2008-06-02  Geoffrey Garen  <ggaren@apple.com>
      
              Reviewed by Alexey Proskuryakov.
      
              Removed JSObject::call, since it just called JSObject::callAsFunction.
      
              SunSpider reports no change.
      
      JavaScriptGlue:
      
      2008-06-02  Geoffrey Garen  <ggaren@apple.com>
      
              Reviewed by Alexey Proskuryakov.
      
              Removed JSObject::call, since it just called JSObject::callAsFunction.
      
              SunSpider reports no change.
      
      WebCore:
      
      2008-06-02  Geoffrey Garen  <ggaren@apple.com>
      
              Reviewed by Alexey Proskuryakov.
              
              Removed JSObject::call, since it just called JSObject::callAsFunction.
              
              SunSpider reports no change.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34334 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1e94a8fc
  6. 02 Jun, 2008 8 commits
    • ggaren@apple.com's avatar
      2008-06-02 Geoffrey Garen <ggaren@apple.com> · 873cb424
      ggaren@apple.com authored
              Reviewed by Darin Adler.
              
              A little cleanup in the CodeGenerator.
      
              * VM/CodeGenerator.cpp: A few changes here.
      
              (1) Removed remaining cases of the old hack of putting "this" into the
              symbol table; replaced with explicit tracking of m_thisRegister.
      
              (2) Made m_thisRegister behave the same for function, eval, and program
              code, removing the static programCodeThis() function.
      
              (3) Added a feature to nix a ScopeNode's declaration stacks when done
              compiling, to save memory.
      
              (4) Removed code that copied eval declarations into special vectors: we
              just use the originals in the ScopeNode now.
              
              * VM/CodeGenerator.h: Removed unneded parameters from the CodeGenerator
              constructor: we just use get that data from the ScopeNode now.
      
              * VM/Machine.cpp:
              (KJS::Machine::execute): When executing an eval node, don't iterate a
              special copy of its declarations; iterate the originals, instead.
      
              * kjs/nodes.cpp: Moved responsibility for knowing what AST data to throw
              away into the CodeGenerator. Nodes no longer call shrinkCapacity on
              their data directly.
              
              * kjs/nodes.h: Changed FunctionStack to ref its contents, so declaration
              data stays around even after we've thrown away the AST, unless we explicitly
              throw away the declaration data, too. This is useful for eval code, which
              needs to reference its declaration data at execution time. (Soon, it will
              be useful for program code, too, since program code should do the same.)
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34319 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      873cb424
    • aroben@apple.com's avatar
      Build fix for non-AllInOne builds · 5af4d9ed
      aroben@apple.com authored
              * kjs/array_object.cpp: Added a missing #include.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      5af4d9ed
    • kmccullough@apple.com's avatar
      2008-06-02 Kevin McCullough <kmccullough@apple.com> · 7434a2fb
      kmccullough@apple.com authored
              Took out accidental confilct lines I checked in.
      
              * ChangeLog:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34313 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      7434a2fb
    • kmccullough@apple.com's avatar
      2008-06-02 Kevin McCullough <kmccullough@apple.com> · 1c88d98b
      kmccullough@apple.com authored
              Reviewed by Darin.
      
              <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
              profiler
              Implement Next Sibling pointers as groundwork for removing the recursion
              limit in the profiler.
      
              * profiler/ProfileNode.cpp: Also I renamed parentNode and headNode since
              'node' is redundant.
              (KJS::ProfileNode::ProfileNode): Initialize the nextSibling.
              (KJS::ProfileNode::willExecute): If there are already children then the
              new child needs to be the nextSibling of the last child.
              (KJS::ProfileNode::didExecute):
              (KJS::ProfileNode::addChild): Ditto.
              (KJS::ProfileNode::stopProfiling):
              (KJS::ProfileNode::sortTotalTimeDescending): For all of the sorting
              algorithms once the children are sorted their nextSibling pointers need
              to be reset to reflect the new order.
              (KJS::ProfileNode::sortTotalTimeAscending):
              (KJS::ProfileNode::sortSelfTimeDescending):
              (KJS::ProfileNode::sortSelfTimeAscending):
              (KJS::ProfileNode::sortCallsDescending):
              (KJS::ProfileNode::sortCallsAscending):
              (KJS::ProfileNode::sortFunctionNameDescending):
              (KJS::ProfileNode::sortFunctionNameAscending):
              (KJS::ProfileNode::resetChildrensSiblings): This new function simply
              loops over all of the children and sets their nextSibling pointers to
              the next child in the Vector
              (KJS::ProfileNode::debugPrintData):
              * profiler/ProfileNode.h:
              (KJS::ProfileNode::parent):
              (KJS::ProfileNode::setParent):
              (KJS::ProfileNode::nextSibling):
              (KJS::ProfileNode::setNextSibling):
              (KJS::ProfileNode::totalPercent):
              (KJS::ProfileNode::selfPercent):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34310 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1c88d98b
    • ggaren@apple.com's avatar
      2008-06-02 Geoffrey Garen <ggaren@apple.com> · 1da77841
      ggaren@apple.com authored
              Reviewed by Maciej Stachowiak.
      
              Removed the recursion limit from JSObject::call, since the VM does
              recursion checking now.
      
              This should allow us to remove JSObject::call entirely, netting a small
              speedup.
      
              * kjs/object.cpp:
              (KJS::JSObject::call):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34309 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1da77841
    • ggaren@apple.com's avatar
      2008-06-02 Geoffrey Garen <ggaren@apple.com> · 4668b2f0
      ggaren@apple.com authored
              Reviewed by Adele Peterson.
      
              Added a specific affordance for avoiding stack overflow when converting
              recursive arrays to string, in preparation for removing generic stack
              overflow checking from JSObject::call.
              
              Tested by fast/js/toString-stack-overflow.html.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      4668b2f0
    • ggaren@apple.com's avatar
      2008-06-02 Geoffrey Garen <ggaren@apple.com> · 3085e4b7
      ggaren@apple.com authored
              Reviewed by Alice Liu.
              
              Refactored some hand-rolled code to call ScopeChain::globalObject instead.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34303 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      3085e4b7
    • ggaren@apple.com's avatar
      JavaScriptCore: · 38bea920
      ggaren@apple.com authored
      2008-06-02  Geoffrey Garen  <ggaren@apple.com>
      
              Reviewed by Darin Adler.
              
              Fixed ASSERT due to execution continuing after an exception is thrown
              during array sort.
      
              * kjs/array_instance.cpp:
              (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key): Don't call the
              custom comparator function if an exception has been thrown. Just return
              1 for everything, so the sort completes quickly. (The result will be
              thrown away.)
      
      LayoutTests:
      
      2008-06-02  Geoffrey Garen  <ggaren@apple.com>
      
              Reviewed by Darin Adler.
              
              Test for an exception thrown from an array sort comparator function.
      
              * fast/js/throw-from-array-sort-expected.txt: Added.
              * fast/js/throw-from-array-sort.html: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34302 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      38bea920
  7. 31 May, 2008 1 commit
    • timothy@apple.com's avatar
      Made the starting line number of scripts be 1-based throughout the engine. · 82a000d6
      timothy@apple.com authored
      JavaScriptCore:
      
      2008-05-30  Timothy Hatcher  <timothy@apple.com>
      
              Made the starting line number of scripts be 1-based throughout the engine.
              This cleans up script line numbers so they are all consistent now and fixes
              some cases where script execution was shown as off by one line in the debugger.
      
              No change in SunSpider.
      
              Reviewed by Oliver Hunt.
      
              * API/minidom.c:
              (main): Pass a line number of 1 instead of 0 to parser().parse().
              * API/testapi.c:
              (main): Ditto. And removes a FIXME and changed an assertEqualsAsNumber
              to use 1 instead of 2 for the line number.
              * VM/Machine.cpp:
              (KJS::callEval): Pass a line number of 1 instead of 0.
              (KJS::Machine::debug): Use firstLine for WillExecuteProgram instead of
              lastLine. Use lastLine for DidExecuteProgram instead of firstLine.
              * kjs/DebuggerCallFrame.cpp:
              (KJS::DebuggerCallFrame::evaluate): Pass a line number of 1 instead of
              0 to parser().parse().
              * kjs/Parser.cpp:
              (KJS::Parser::parse): ASSERT startingLineNumber is greatter than 0. Change
              the startingLineNumber to be 1 if it was less than or equal to 0. This is needed
              for release builds to maintain compatibility with the JavaScriptCore API.
              * kjs/function.cpp:
              (KJS::globalFuncEval): Pass a line number of 1 instead of 0 to parser().parse().
              * kjs/function_object.cpp:
              (FunctionObjectImp::construct): Pass a line number of 1 instead of 0 to construct().
              * kjs/lexer.cpp:
              (Lexer::setCode): Made yylineno = startingLineNumber instead of adding 1.
              * kjs/testkjs.cpp:
              (functionRun): Pass a line number of 1 instead of 0 to Interpreter::evaluate().
              (functionLoad): Ditto.
              (prettyPrintScript): Ditto.
              (runWithScripts): Ditto.
              * profiler/Profiler.cpp:
              (WebCore::createCallIdentifier): Removed a plus 1 of startingLineNumber.
      
      WebCore:
      
      2008-05-30  Timothy Hatcher  <timothy@apple.com>
      
              Made the starting line number of scripts be 1-based throughout the engine.
              This cleans up script line numbers so they are all consistent now and fixes
              some cases where script execution was shown as off by one line in the debugger.
      
              Doing this also exposed a bug where JSLazyEventListener created in XHML or SVG
              documents would always have a line number of 0. So this change fixed that bug
              to pass all the SVG and XHTML tests.
      
              All layout tests pass.
      
              Reviewed by Oliver Hunt.
      
              * bindings/js/kjs_events.cpp:
              (WebCore::JSLazyEventListener::JSLazyEventListener): Set the line number to 1
              if it was passed in as 0. This can happen when listeners are created with
              a setAttribute call from JavaScript.
              (WebCore::JSLazyEventListener::parseCode): Add a FIXME about the URL being
              incorrect when listeners are created with a setAttribute call from JavaScript.
              * bindings/js/kjs_events.h: Remove the default value for lineNumber, since no
              callers need it.
              * bindings/objc/WebScriptObject.mm:
              (-[WebScriptObject evaluateWebScript:]): Pass a line number of 1 instead of 0
              to Interpreter::evaluate().
              * bridge/NP_jsobject.cpp:
              (_NPN_Evaluate): Ditto.
              * bridge/jni/jni_jsobject.mm:
              (JavaJSObject::eval): Ditto.
              * dom/XMLTokenizer.cpp:
              (WebCore::XMLTokenizer::startElementNs): Call KJSProxy::setEventHandlerLineno()
              around the call to handleElementAttributes, so any JSLazyEventListener created
              from those attributes have line numbers.
              (WebCore::XMLTokenizer::endElementNs): Remove a minus 1 of the line number.
              (WebCore::XMLTokenizer::notifyFinished): Pass a line number of 1 instead of 0.
              (WebCore::XMLTokenizer::parseEndElement): Remove a minus 1 of the line number.
              * html/HTMLScriptElement.cpp:
              (WebCore::HTMLScriptElement::evaluateScript): Add a FIXME about the starting
              line number being incorrect in some cases when this function is called.
              * html/HTMLTokenizer.cpp:
              (WebCore::HTMLTokenizer::parseSpecial): Add a plus 1 to the line number when
              setting scriptStartLineno so it is 1-based. Same for calling setEventHandlerLineno().
              (WebCore::HTMLTokenizer::processToken): Ditto.
              * html/HTMLTokenizer.h: Change the default line number on scriptExecution() to 1 from 0.
              * loader/FrameLoader.cpp:
              (FrameLoader::executeIfJavaScriptURL): Pass a line number of 1 instead of 0 to executeScript().
      
      WebKitTools:
      
      2008-05-30  Timothy Hatcher  <timothy@apple.com>
      
              Made the starting line number of scripts be 1-based throughout the engine.
              This cleans up script line numbers so they are all consistent now.
      
              Reviewed by Oliver Hunt.
      
              * DumpRenderTree/mac/ObjCController.m:
              (runJavaScriptThread): Pass a line number of 1 instead of 0 to JSEvaluateScript.
              * DumpRenderTree/pthreads/JavaScriptThreadingPthreads.cpp:
              (runJavaScriptThread): Ditto.
              * DumpRenderTree/win/DumpRenderTree.cpp:
              (runJavaScriptThread): Ditto.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34273 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      82a000d6
  8. 30 May, 2008 2 commits
    • ap@webkit.org's avatar
      Reviewed by Darin. · c4ee7989
      ap@webkit.org authored
              https://bugs.webkit.org/show_bug.cgi?id=19180
              speed up SunSpider by optimizing immediate number cases
      
              Also fixed a JavaScriptCore regression seen on PowerPC - we didn't clip left shift
              parameter to 0...31.
      
              0.5% improvement on SunSpider overall, although a 8.5 regression on bitops-3bit-bits-in-byte.
      
              * VM/Machine.cpp:
              (KJS::Machine::privateExecute):
              Added fast paths for >>> and <<.
      
              * kjs/JSImmediate.h:
              (KJS::JSImmediate::toTruncatedUInt32): Added. Same as getTruncatedInt32, but casts the result
              to unsigned.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34265 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c4ee7989
    • ap@webkit.org's avatar
      Reviewed by Oliver Hunt. · 655b491d
      ap@webkit.org authored
              https://bugs.webkit.org/show_bug.cgi?id=19180
              speed up SunSpider by optimizing immediate number cases
      
              Also fixed three JavaScriptCore regressions seen on PowerPC - we didn't clip right shift
              parameter to 0...31.
      
              1.6% improvement on SunSpider, without significant regressions on any tests.
      
              * VM/Machine.cpp:
              (KJS::Machine::privateExecute):
              Added fast paths for >>, ==, ===, !=, !==. Changed order of memory accesses in many
              cases, making them less dependent on gcc's ability to properly assign registers. With this,
              I could move exception checks back into slow code paths, and saw less randomness in general.
      
              * kjs/JSImmediate.h:
              (KJS::JSImmediate::rightShiftImmediateNumbers):
              Added.
      
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34258 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      655b491d