1 2008-07-30 Alexey Proskuryakov <ap@webkit.org>
3 Reviewed by Geoff Garen.
5 Don't call JSGarbageCollect() on a released context.
7 * API/testapi.c: (main):
9 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
11 Reviewed by Geoff Garen.
13 Implement JSContextGroup APIs to make concurrent execution possible for
14 JavaScriptCore clients.
16 This changes the behavior of JSGlobalContextCreate(), so that it now uses a private context
17 group for each context, making JSlock implicit locking unnecessary.
20 * API/JSContextRef.cpp:
21 (JSContextGroupCreate):
22 (JSContextGroupRetain):
23 (JSContextGroupRelease):
24 (JSGlobalContextCreate):
25 (JSGlobalContextCreateInGroup):
26 (JSGlobalContextRelease):
28 Added new methods. JSGlobalContextCreate() calls JSGlobalContextCreateInGroup() now.
30 * API/APICast.h: (toJS): (toRef): Added converters for JSContextGroupRef.
31 * API/JSBase.cpp: (JSGarbageCollect): JSGarbageCollect(0) is now a no-op, and the passed in
32 context is actually used.
34 * API/JSBase.h: Aded a typedef for JSContextGroupRef. Updated documentation for
37 * JavaScriptCore.exp: Removed JSGlobalData::sharedInstance().
39 * kjs/JSGlobalData.cpp:
41 Removed support for JSGlobalData shared instance. JSGlobalData::isSharedInstance member
42 variable still remains, to be deleted in a followup patch.
44 * kjs/JSLock.cpp: (KJS::JSLock::JSLock): Disabled JSLock, to be deleted in a follow-up patch.
47 (KJS::Heap::markOtherThreadConservatively): Removed an assertion that referenced
48 JSGlobalData::sharedInstance.
50 * kjs/collector.h: Made Heap destructor public, so that JSContextRelease can use it.
52 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
54 Reviewed by Geoff Garen.
56 Fix a leak of ThreadRegistrar objects.
58 As the heap is usually deleted when registered threads still exist, ThreadSpecific doesn't
59 have a chance to clean up per-thread object. Switched to native pthread calls, storing a
60 plain pointer that doesn't require cleanup.
63 (KJS::PlatformThread::PlatformThread):
64 (KJS::Heap::Thread::Thread):
67 (KJS::Heap::registerThread):
68 (KJS::Heap::unregisterThread):
71 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
73 Reviewed by Sam Weinig.
75 https://bugs.webkit.org/show_bug.cgi?id=20169
76 Memory allocated with fastMalloc is freed with delete
78 * VM/JSPropertyNameIterator.cpp:
79 (KJS::JSPropertyNameIterator::invalidate): Free the array properly.
80 (KJS::JSPropertyNameIterator::~JSPropertyNameIterator): Delete the array by calling
83 2008-07-29 Mark Rowe <mrowe@apple.com>
85 Attempt to fix the Qt build.
87 * wtf/ThreadingQt.cpp: Add the extra argument to createThread.
89 2008-07-29 Adam Roben <aroben@apple.com>
91 Change Vector::find to return an index instead of an iterator
93 Indices are more natural than iterators when working with Vector.
95 Reviewed by John Sullivan.
98 (WTF::Vector::find): Changed to iterate the Vector manually and return
99 the index of the found item, rather than an iterator. When the item
100 could not be found, we return WTF::notFound.
102 2008-07-29 Adam Roben <aroben@apple.com>
106 * wtf/ThreadingWin.cpp:
107 (WTF::setThreadName): Move a misplaced assertion to here...
108 (WTF::createThread): ...from here.
110 2008-07-29 Adam Roben <aroben@apple.com>
112 Add support for setting thread names on Windows
114 These thread names make it much easier to identify particular threads
115 in Visual Studio's Threads panel.
117 WTF::createThread now takes a const char* representing the thread's
118 name. On Windows, we throw a special exception to set this string as
119 the thread's name. Other platforms do nothing with this name for now.
121 Reviewed by Anders Carlsson.
123 * JavaScriptCore.exp: Export the new version of createThread that
124 takes 3 arguments (the old one continues to be exported for backward
126 * wtf/Threading.h: Add a threadName argument to createThread.
128 * wtf/ThreadingGtk.cpp:
130 * wtf/ThreadingNone.cpp:
132 Updated for function signature change.
134 * wtf/ThreadingPthreads.cpp:
135 (WTF::createThread): Updated for function signature change. We keep
136 around the old 2-argument version of createThread for backward
139 * wtf/ThreadingWin.cpp:
140 (WTF::setThreadName): Added. This function's implementation came from
142 (WTF::initializeThreading): Set the name of the main thread.
143 (WTF::createThread): Call setThreadName. We keep around the old
144 2-argument version of createThread for backward compatibility.
146 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
148 Reviewed by Oliver Hunt.
150 Store UString::Rep::isStatic bit in identifierTable pointer instead of reportedCost for
151 slightly nicer code and a 0.5% SunSpider improvement.
153 * API/JSClassRef.cpp:
154 (OpaqueJSClass::~OpaqueJSClass):
155 (OpaqueJSClassContextData::OpaqueJSClassContextData):
156 * API/JSStringRef.cpp:
158 * kjs/PropertyNameArray.cpp:
159 (KJS::PropertyNameArray::add):
160 * kjs/identifier.cpp:
161 (KJS::IdentifierTable::~IdentifierTable):
162 (KJS::IdentifierTable::add):
163 (KJS::Identifier::addSlowCase):
164 (KJS::Identifier::remove):
166 (KJS::Identifier::add):
169 (KJS::UString::Rep::create):
170 (KJS::UString::Rep::destroy):
172 (KJS::UString::Rep::identifierTable):
173 (KJS::UString::Rep::setIdentifierTable):
174 (KJS::UString::Rep::isStatic):
175 (KJS::UString::Rep::setStatic):
176 (KJS::UString::cost):
178 2008-07-28 Geoffrey Garen <ggaren@apple.com>
180 Reviewed by Sam Weinig.
182 Renamed "ConstructTypeNative" => "ConstructTypeHost".
184 2008-07-26 Mark Rowe <mrowe@apple.com>
186 Speculative fix for the wx build.
188 * JavaScriptCoreSources.bkl: Add JSStaticScopeObject.cpp to the list of source files.
190 2008-07-25 Oliver Hunt <oliver@apple.com>
194 Whoops, forgot to save style correction.
196 * kjs/JSStaticScopeObject.h:
198 2008-07-25 Oliver Hunt <oliver@apple.com>
200 Reviewed by Cameron Zwarich.
202 Bug 19718: Named anonymous functions are slow accessing global variables
203 <https://bugs.webkit.org/show_bug.cgi?id=19718>
205 To fix this we switch over to an activation-like scope object for
206 on which we attach the function name property, and add logic to
207 prevent cross scope assignment to read only properties.
210 * JavaScriptCore.pri:
211 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
212 * JavaScriptCore.xcodeproj/project.pbxproj:
213 * VM/CodeGenerator.cpp:
214 (KJS::CodeGenerator::findScopedProperty):
215 (KJS::CodeGenerator::emitResolve):
216 * VM/CodeGenerator.h:
217 * kjs/AllInOneFile.cpp:
218 * kjs/JSStaticScopeObject.cpp: Added.
219 (KJS::JSStaticScopeObject::putWithAttributes):
220 (KJS::JSStaticScopeObject::isDynamicScope):
221 (KJS::JSStaticScopeObject::~JSStaticScopeObject):
222 (KJS::JSStaticScopeObject::getOwnPropertySlot):
223 * kjs/JSStaticScopeObject.h: Added.
224 (KJS::JSStaticScopeObject::JSStaticScopeObjectData::JSStaticScopeObjectData):
225 (KJS::JSStaticScopeObject::JSStaticScopeObject):
227 (KJS::FunctionCallResolveNode::emitCode):
228 (KJS::PostfixResolveNode::emitCode):
229 (KJS::PrefixResolveNode::emitCode):
230 (KJS::ReadModifyResolveNode::emitCode):
231 (KJS::AssignResolveNode::emitCode):
232 (KJS::FuncExprNode::makeFunction):
234 2008-07-25 kevino <kevino@theolliviers.com>
236 wx build fix for Win.
238 On wx/Win, including windows.h in Threading.h causes multiply-defined symbol errors
239 for libjpeg and wx, and also wx needs to include windows.h itself first for wx
240 includes to work right. So until we can find a better solution to this problem,
241 on wx, we work around the need to include windows.h here.
245 2008-07-25 Adam Roben <aroben@apple.com>
249 * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add API/ to the
252 2008-07-25 Simon Hausmann <hausmann@webkit.org>
254 Fix the build of jsc on Qt/Windows, make sure os-win32 is in the
255 include search path (added by WebKit.pri).
259 2008-07-25 Alexey Proskuryakov <ap@webkit.org>
261 Reviewed by Simon Hausmann.
263 Move JavaScriptCore API tests into a subdirectory of their own to avoid header name
264 conflicts and developer confusion.
266 * API/JSNode.c: Removed.
267 * API/JSNode.h: Removed.
268 * API/JSNodeList.c: Removed.
269 * API/JSNodeList.h: Removed.
270 * API/Node.c: Removed.
271 * API/Node.h: Removed.
272 * API/NodeList.c: Removed.
273 * API/NodeList.h: Removed.
274 * API/minidom.c: Removed.
275 * API/minidom.html: Removed.
276 * API/minidom.js: Removed.
277 * API/testapi.c: Removed.
278 * API/testapi.js: Removed.
280 * API/tests/JSNode.c: Copied from JavaScriptCore/API/JSNode.c.
281 * API/tests/JSNode.h: Copied from JavaScriptCore/API/JSNode.h.
282 * API/tests/JSNodeList.c: Copied from JavaScriptCore/API/JSNodeList.c.
283 * API/tests/JSNodeList.h: Copied from JavaScriptCore/API/JSNodeList.h.
284 * API/tests/Node.c: Copied from JavaScriptCore/API/Node.c.
285 * API/tests/Node.h: Copied from JavaScriptCore/API/Node.h.
286 * API/tests/NodeList.c: Copied from JavaScriptCore/API/NodeList.c.
287 * API/tests/NodeList.h: Copied from JavaScriptCore/API/NodeList.h.
288 * API/tests/minidom.c: Copied from JavaScriptCore/API/minidom.c.
289 * API/tests/minidom.html: Copied from JavaScriptCore/API/minidom.html.
290 * API/tests/minidom.js: Copied from JavaScriptCore/API/minidom.js.
291 * API/tests/testapi.c: Copied from JavaScriptCore/API/testapi.c.
292 * API/tests/testapi.js: Copied from JavaScriptCore/API/testapi.js.
294 * JavaScriptCore.vcproj/testapi/testapi.vcproj:
295 * JavaScriptCore.xcodeproj/project.pbxproj:
297 2008-07-25 Simon Hausmann <hausmann@webkit.org>
299 Prospective WX build fix, add JavaScriptCore/API to the include search
304 2008-07-25 Simon Hausmann <hausmann@webkit.org>
306 Rubber-stamped by Lars.
308 Fix the build on Windows. operator new for ArgList is implemented using fastMalloc()
309 but operator delete was not implemented. Unfortunately MSVC decides to call/reference
310 the function, so a simple implementation using fastFree() fixes the build.
313 (KJS::ArgList::operator delete):
315 2008-07-25 Simon Hausmann <hausmann@webkit.org>
317 Discussed with and rubber-stamped by Lars.
319 Fix the build system for the Qt port.
321 Recent JavaScriptCore changes require the addition of JavaScriptCore/API to the
322 include search path. With a build process that combines JavaScriptCore and
323 WebCore in one build process/Makefile the existance of
324 JavaScriptCore/API/Node.h and WebCore/dom/Node.h causes include conflicts.
326 This commit solves this by introducing a separate build of JavaScriptCore into
329 As a result of the split-up a race-condition due to broken dependencies of
330 regular source files to header files of generated sources showed up very
331 frequently when doing parallel builds (which the buildbot does). This commit at
332 the same time tries to address the dependency problem by making the
333 addExtraCompiler() function also generate a pseudo extra compiler that
334 represents the header file output, so that qmake is aware of the creation of
335 the header file for dependency calculation.
337 At the same time I removed a lot of cruft from the pro files to ease maintenance.
339 * JavaScriptCore.pri:
340 * JavaScriptCore.pro: Added.
343 2008-07-24 Geoffrey Garen <ggaren@apple.com>
345 Reviewed by Maciej Stachowiak.
347 Fixed a strict aliasing violation, which caused hash tables with floating
348 point keys not to find items that were indeed in the tables
349 (intermittently, and only in release builds, of course).
351 SunSpider reports no change.
353 This bug doesn't seem to affect any existing code, but it causes obvious
354 crashes in some new code I'm working on.
356 * wtf/HashFunctions.h:
357 (WTF::FloatHash::hash): Use a union when punning between a float / double
358 and an unsigned (bucket of bits). With strict aliasing enabled, unions
359 are the only safe way to do this kind of type punning.
361 * wtf/HashTable.h: When rehashing, ASSERT that the item we just added to
362 the table is indeed in the table. In the buggy case described above, this
365 2008-07-24 Oliver Hunt <oliver@apple.com>
367 Reviewed by Alexey Proskuryakov.
369 Bug 20142: REGRESSION(r35245): /=/ weirdness
370 <https://bugs.webkit.org/show_bug.cgi?id=20142>
372 When adding all the meta data needed for exception error messages
373 I accidentally clobbered the handling of regex beginning with /=.
377 2008-07-23 Alp Toker <alp@nuanti.com>
379 Build fix after r35293: Add API/ to the include path.
383 2008-07-23 Adam Roben <aroben@apple.com>
387 Build fix after r35293:
389 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add API/
392 Build fix after r35305:
398 Completely compile out all sampler-related code when
399 SAMPLING_TOOL_ENABLED is 0. The sampler code can't be compiled 1) on
400 non-AllInOne configurations due to circular header dependencies, and
401 2) on platforms that don't have a usleep() function, such as Windows.
403 2008-07-23 Oliver Hunt <oliver@apple.com>
405 Reviewed by Geoff Garen and Sam Weinig.
407 Improve switch performance.
409 Improve switch performance by converting to a hashmap based jump
410 table to avoid the sequence of dispatches that would otherwise be
411 needed. This results in a 9-19x performance win for string switches
412 based on ad hoc testing, and a 6x improvement for integer switch
413 statements. SunSpider reports a 1.2% progression.
416 (KJS::CodeBlock::dump):
417 (KJS::SimpleJumpTable::offsetForValue):
419 * VM/CodeGenerator.cpp:
420 (KJS::CodeGenerator::beginSwitch):
421 (KJS::prepareJumpTableForImmediateSwitch):
422 (KJS::prepareJumpTableForCharacterSwitch):
423 (KJS::prepareJumpTableForStringSwitch):
424 (KJS::CodeGenerator::endSwitch):
425 * VM/CodeGenerator.h:
427 (KJS::offsetForStringSwitch):
428 (KJS::Machine::privateExecute):
435 (KJS::processClauseList):
436 (KJS::CaseBlockNode::tryOptimisedSwitch):
437 (KJS::CaseBlockNode::emitCodeForBlock):
441 2008-07-23 Gavin Barraclough <barraclough@apple.com>
443 Reviewed by Geoff Garen.
445 Sampling tool to analyze cost of instruction execution and identify hot regions of JS code.
446 Enable Switches by setting SAMPLING_TOOL_ENABLED in Opcode.h.
448 * JavaScriptCore.exp: Export symbols for Shell.cpp.
449 * VM/Machine.cpp: Added sampling hooks.
450 * VM/Machine.h: Machine contains a pointer to a sampler, when sampling.
451 * VM/Opcode.cpp: Tool implementation.
452 * VM/Opcode.h: Tool declaration.
453 * kjs/Shell.cpp: Initialize the sampler, if enabled.
454 * kjs/nodes.cpp: Added sampling hooks.
456 2008-07-23 Gabor Loki <loki@inf.u-szeged.hu>
458 Bug 20097: [Qt] 20% Sunspider slow-down
460 <https://bugs.webkit.org/show_bug.cgi?id=20097>
462 Reviewed by Simon Hausmann.
464 * kjs/jsc.pro: Added missing NDEBUG define for release builds.
466 2008-07-23 Alexey Proskuryakov <ap@webkit.org>
468 Reviewed by Geoff Garen.
470 JSClassRef is created context-free, but gets infatuated with the first context it sees.
472 The implicit API contract is that JSClassRef can be used with any context on any thread.
473 This no longer worked, because UStrings in the class were turned into per-context
474 identifiers, and the cached JSObject prototype was tied to JSGlobalData, too.
476 * API/JSClassRef.h: Made a separate struct for context-dependent parts of OpaqueJSClass.
477 * API/JSClassRef.cpp:
478 (OpaqueJSClass::OpaqueJSClass): Updated for renames and changed member variable order.
479 (OpaqueJSClass::~OpaqueJSClass): Assert that string members are not identifiers.
480 (clearReferenceToPrototype): Update for the new reference location.
481 (OpaqueJSClassContextData::OpaqueJSClassContextData): Make a deep copy of all strings.
482 (OpaqueJSClass::contextData): Added a function that finds the per-context part of
483 OpaqueJSClass in JSGlobalData, or creates it if not found.
484 (OpaqueJSClass::className): Always make a deep copy. Callers of this function do not have
485 a way to access JSGlobalData, so a per-context copy could not be made.
486 (OpaqueJSClass::staticValues): Updated for new data location.
487 (OpaqueJSClass::staticFunctions): Ditto.
488 (OpaqueJSClass::prototype): Changed to take an internal type for consistency.
490 * kjs/JSGlobalData.cpp:
491 (KJS::JSGlobalData::JSGlobalData):
492 (KJS::JSGlobalData::~JSGlobalData):
493 * kjs/JSGlobalData.h:
494 Keep a HashMap to access per-context JSClass data given a pointr to the shared part.
496 * API/JSCallbackObjectFunctions.h:
498 (KJS::::getOwnPropertySlot):
500 (KJS::::deleteProperty):
501 (KJS::::getPropertyNames):
502 (KJS::::staticValueGetter):
503 (KJS::::staticFunctionGetter):j
504 Use function accessors instead of accessing OpaqueJSClass members directly.
506 * API/JSContextRef.cpp: (JSGlobalContextCreate): Updated for the change in
507 OpaqueJSClass::prototype() argument type.
509 * API/JSObjectRef.cpp:
510 (JSObjectMake): Updated for the change in OpaqueJSClass::prototype() argument type.
511 (JSObjectMakeConstructor): Ditto.
513 2008-07-23 Alexey Proskuryakov <ap@webkit.org>
517 * kjs/ArgList.h: (KJS::ArgList::operator new): removed an extraneous "ArgList::" inside the
520 2008-07-22 Geoffrey Garen <ggaren@apple.com>
522 Reviewed by Oliver Hunt and Sam Weinig.
524 Next step toward putting doubles in registers: Prepare the Register class
525 and its clients for registers that don't contain JSValue*s.
527 This means a few things:
529 1. Register::jsValue() clients, including ArgList clients, must now supply
530 an ExecState* when accessing an entry in an ArgList, in case the entry
531 will need to create a JSValue* on the fly.
533 2. Register clients that definitely don't want to create a JSValue* on
534 the fly now use different APIs: getJSValue() for clients that know
535 the register contains a JSValue*, and v() for clients who just want a
538 3. I had to change some headers around in order to resolve dependency
539 problems created by using a Register in the ArgList header.
541 SunSpider reports no change.
543 2008-07-22 Gavin Barraclough <barraclough@apple.com>
545 Reviewed by Alexey Proskuryakov.
547 Prevent integer overflow when reallocating storage vector for arrays.
549 Sunspider reports 1.005x as fast (no change expected).
553 2008-07-21 Mark Rowe <mrowe@apple.com>
555 Reviewed by Sam Weinig.
557 <rdar://problem/6091287> Revamp the handling of CFBundleShortVersionString to be fixed at the major component of the version number.
559 * Configurations/Version.xcconfig:
562 2008-07-21 Adam Roben <aroben@apple.com>
566 This is a convenience wrapper around std::find.
568 Reviewed by Anders Carlsson.
572 2008-07-19 Oliver Hunt <oliver@apple.com>
574 Reviewed by Cameron Zwarich.
576 Bug 20104: Exception in tables/mozilla_expected_failures/bugs/bug92868_1.html includes the equals operator in the quoted expression
577 <https://bugs.webkit.org/show_bug.cgi?id=20104>
579 To make this correct we make the dot and bracket assign nodes emit the information to indicate
580 the failure range is the dot/bracket accessor.
584 2008-07-18 Steve Falkenburg <sfalken@apple.com>
588 * kjs/JSGlobalObjectFunctions.cpp:
589 (KJS::isStrWhiteSpace):
591 2008-07-18 Steve Falkenburg <sfalken@apple.com>
596 (KJS::ThrowableExpressionData::ThrowableExpressionData):
598 2008-07-18 Oliver Hunt <oliver@apple.com>
600 Reviewed by Cameron Zwarich.
602 Bug 18774: SQUIRRELFISH: print meaningful error messages <https://bugs.webkit.org/show_bug.cgi?id=18774>
603 <rdar://problem/5769353> SQUIRRELFISH: JavaScript error messages are missing informative text
605 Add support for decent error messages in JavaScript. This patch achieves this by providing
606 ensuring the common errors and exceptions have messages that provide the text of expression
607 that trigger the exception. In addition it attaches a number of properties to the exception
608 object detailing where in the source the expression came from.
610 * JavaScriptCore.exp:
612 (KJS::CodeBlock::lineNumberForVPC):
613 (KJS::CodeBlock::expressionRangeForVPC):
614 Function to recover the expression range for an instruction
615 that triggered an exception.
617 (KJS::ExpressionRangeInfo::):
618 (KJS::CodeBlock::CodeBlock):
619 * VM/CodeGenerator.cpp:
620 (KJS::CodeGenerator::emitCall):
621 (KJS::CodeGenerator::emitCallEval):
622 Emit call needed to be modified so to place the expression range info internally,
623 as the CodeGenerator emits the arguments nodes itself, rather than the various call
625 * VM/CodeGenerator.h:
626 (KJS::CodeGenerator::emitExpressionInfo):
627 Record the expression range info.
628 * VM/ExceptionHelpers.cpp:
629 (KJS::createErrorMessage):
630 (KJS::createInvalidParamError):
631 (KJS::createUndefinedVariableError):
632 (KJS::createNotAConstructorError):
633 (KJS::createNotAFunctionError):
634 (KJS::createNotAnObjectErrorStub):
635 (KJS::createNotAnObjectError):
636 Rewrite all the code for the error messages so that they make use of the newly available
638 * VM/ExceptionHelpers.h:
640 (KJS::isNotObject): Now needs vPC and codeBlock
641 (KJS::Machine::throwException):
642 New logic to handle the NotAnObjectErrorStub and to handle the absurd "no default value" edge case
643 (KJS::Machine::privateExecute):
645 * kjs/DebuggerCallFrame.cpp:
646 (KJS::DebuggerCallFrame::evaluate):
648 (KJS::Error::create):
650 * kjs/JSGlobalObjectFunctions.cpp:
651 * kjs/JSImmediate.cpp:
652 (KJS::JSImmediate::toObject):
653 (KJS::JSImmediate::prototype):
654 My changes to the JSNotAnObject constructor needed to be handled here.
655 * kjs/JSNotAnObject.h:
656 (KJS::JSNotAnObjectErrorStub::JSNotAnObjectErrorStub):
657 (KJS::JSNotAnObjectErrorStub::isNull):
658 (KJS::JSNotAnObjectErrorStub::isNotAnObjectErrorStub):
659 Added a JSNotAnObjectErrorStub class to ease the handling of toObject failure exceptions,
660 and potentially allow even more detailed error messages in future.
663 (KJS::Parser::parse):
666 Large amounts of position propagation.
671 The lexer needed a few changes to be able to correctly track token character positions.
674 (KJS::ThrowableExpressionData::emitThrowError):
675 (KJS::StatementNode::StatementNode):
676 (KJS::ResolveNode::emitCode):
677 (KJS::BracketAccessorNode::emitCode):
678 (KJS::DotAccessorNode::emitCode):
679 (KJS::NewExprNode::emitCode):
680 (KJS::EvalFunctionCallNode::emitCode):
681 (KJS::FunctionCallValueNode::emitCode):
682 (KJS::FunctionCallResolveNode::emitCode):
683 (KJS::FunctionCallBracketNode::emitCode):
684 (KJS::FunctionCallDotNode::emitCode):
685 (KJS::PostfixResolveNode::emitCode):
686 (KJS::PostfixBracketNode::emitCode):
687 (KJS::PostfixDotNode::emitCode):
688 (KJS::DeleteResolveNode::emitCode):
689 (KJS::DeleteBracketNode::emitCode):
690 (KJS::DeleteDotNode::emitCode):
691 (KJS::PrefixResolveNode::emitCode):
692 (KJS::PrefixBracketNode::emitCode):
693 (KJS::PrefixDotNode::emitCode):
694 (KJS::ThrowableBinaryOpNode::emitCode):
695 (KJS::ReadModifyResolveNode::emitCode):
696 (KJS::AssignResolveNode::emitCode):
697 (KJS::AssignDotNode::emitCode):
698 (KJS::ReadModifyDotNode::emitCode):
699 (KJS::AssignBracketNode::emitCode):
700 (KJS::ReadModifyBracketNode::emitCode):
701 (KJS::ForInNode::ForInNode):
702 (KJS::ForInNode::emitCode):
703 (KJS::WithNode::emitCode):
704 (KJS::LabelNode::emitCode):
705 (KJS::ThrowNode::emitCode):
706 (KJS::ProgramNode::ProgramNode):
707 (KJS::ProgramNode::create):
708 (KJS::EvalNode::generateCode):
709 (KJS::FunctionBodyNode::create):
710 (KJS::FunctionBodyNode::generateCode):
711 (KJS::ProgramNode::generateCode):
712 All of these methods were handling the position information.
713 Constructors and create methods were modified to store the information.
714 All the emitCall implementations listed needed to be updated to actually
715 record the position information we have so carefully collected.
717 (KJS::ThrowableExpressionData::ThrowableExpressionData):
718 (KJS::ThrowableExpressionData::setExceptionSourceRange):
719 (KJS::ThrowableExpressionData::divot):
720 (KJS::ThrowableExpressionData::startOffset):
721 (KJS::ThrowableExpressionData::endOffset):
722 (KJS::ThrowableSubExpressionData::ThrowableSubExpressionData):
723 (KJS::ThrowableSubExpressionData::setSubexpressionInfo):
724 (KJS::ThrowablePrefixedSubExpressionData::ThrowablePrefixedSubExpressionData):
725 (KJS::ThrowablePrefixedSubExpressionData::setSubexpressionInfo):
726 ThrowableExpressionData is just a uniform mechanism for storing the position
728 (KJS::ResolveNode::):
729 (KJS::PrePostResolveNode::):
730 (KJS::ThrowableBinaryOpNode::):
733 2008-07-18 Geoffrey Garen <ggaren@apple.com>
735 Reviewed by Cameron Zwarich.
739 "CallTypeNative" => "CallTypeHost"
741 "generatedCode" => "generatedByteCode"
743 2008-07-18 Geoffrey Garen <ggaren@apple.com>
745 Reviewed by Oliver Hunt.
747 Optimized <= for immediate number cases.
749 SunSpider reports no overall change, but a 10% speedup on access-nsieve.
751 2008-07-18 Mark Rowe <mrowe@apple.com>
753 Rubber-stamped by Sam Weinig.
755 Fix some casts added in a previous build fix to match the style used
759 (KJS::Machine::initializeCallFrame):
761 (KJS::Register::Register):
763 2008-07-18 Landry Breuil <landry@openbsd.org>
765 Bug 19975: [OpenBSD] Patches to enable build of WebKit
767 <https://bugs.webkit.org/show_bug.cgi?id=19975>
769 Reviewed by David Kilzer.
771 Support for OpenBSD, mostly threading and libm tweaks.
773 * kjs/collector.cpp: #include <pthread.h>
774 (KJS::currentThreadStackBase): use pthread_stackseg_np() to get stack base
775 * kjs/config.h: OpenBSD also provides <pthread_np.h>
776 * wtf/MathExtras.h: #include <sys/types.h> and <machine/ieee.h>
777 (isfinite), (signbit): as long as we don't have those functions provide fallback implementations
778 * wtf/Platform.h: Add support for PLATFORM(OPENBSD) and PLATFORM(SPARC64) macro
780 2008-07-17 Geoffrey Garen <ggaren@apple.com>
782 Reviewed by Oliver Hunt.
784 Next step toward putting doubles in registers: Store constant pool
785 entries as registers, not JSValue*s.
787 SunSpider reports no change.
789 2008-07-17 Geoffrey Garen <ggaren@apple.com>
791 Reviewed by John Sullivan and Oliver Hunt.
793 A tiny bit of tidying in function call register allocation.
795 This patch saves one register when invoking a function expression and/or
796 a new expression that is stored in a temporary.
798 Since it's just one register, I can't make a testcase for it.
800 * VM/CodeGenerator.cpp:
801 (KJS::CodeGenerator::emitCall): No need to ref the function we're calling
802 or its base. We'd like the call frame to overlap with them, if possible.
803 op_call will read the function and its base before writing the call frame,
807 (KJS::NewExprNode::emitCode): No need to ref the function we're new-ing,
808 for the same reasons stated above.
810 (KJS::FunctionCallValueNode::emitCode): ditto
812 2008-07-17 Steve Falkenburg <sfalken@apple.com>
816 * kjs/InternalFunction.cpp:
818 2008-07-17 Sam Weinig <sam@webkit.org>
820 Roll out r35199 as it is causing failures on the PPC build.
822 2008-07-17 Geoffrey Garen <ggaren@apple.com>
824 Reviewed by David Kilzer.
826 Fixed https://bugs.webkit.org/show_bug.cgi?id=20067
827 Support function.name (Firefox extension)
829 Pretty straight-forward.
831 2008-07-17 Geoffrey Garen <ggaren@apple.com>
833 Reviewed by Oliver Hunt.
835 Fixed <rdar://problem/6081636> Functions calls use more temporary
836 registers than necessary
838 Holding a reference to the last statement result register caused each
839 successive statement to output its result to an even higher register.
841 Happily, statements don't actually need to return a result register
842 at all. I hope to make this clearer in a future cleanup patch,
843 but this change will fix the major bug for now.
846 (KJS::statementListEmitCode):
848 2008-07-17 Gavin Barraclough <barraclough@apple.com>
850 Reviewed by Sam Weinig.
852 Merge pre&post dot nodes to simplify the parse tree.
853 Sunspider results show 0.6% progression (no performance change expected).
858 * kjs/nodes2string.cpp:
860 2008-07-17 Gavin Barraclough <barraclough@apple.com>
862 Reviewed by Cameron Zwarich.
864 Merge pre&post resolve nodes to simplify the parse tree.
865 Sunspider results show no performance change.
870 * kjs/nodes2string.cpp:
872 2008-07-17 Gavin Barraclough <barraclough@apple.com>
874 Reviewed by Cameron Zwarich.
876 Merge logical nodes to simplify the parse tree.
877 Sunspider results show 0.6% progression (no performance change expected).
882 * kjs/nodes2string.cpp:
884 2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
888 Fix MinGW build (broken in r35198) and simplify getLocalTime().
893 2008-07-17 Gavin Barraclough <barraclough@apple.com>
895 Reviewed by Sam Weinig.
897 Merge pre&post bracket nodes to simplify the parse tree.
898 Sunspider results show no performance change.
903 * kjs/nodes2string.cpp:
905 2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
909 Fix the 32-bit gcc builds, conversion from "long int" to Register is
910 ambiguous. Explicitly choose the intptr_t constructor.
913 (KJS::Machine::initializeCallFrame):
915 (KJS::Register::Register):
917 2008-07-16 Mark Rowe <mrowe@apple.com>
919 Rubber-stamped by Geoff Garen.
921 Fix JavaScript in 64-bit by using a pointer-sized integer
922 type in the Register union. Also includes a rename of
923 the intType constant to IntType.
926 (KJS::Machine::initializeCallFrame):
929 (KJS::Register::Register):
931 2008-07-17 Geoffrey Garen <ggaren@apple.com>
933 Reviewed by Oliver Hunt.
935 First step toward putting doubles in registers: Turned Register into a
936 proper abstraction layer. It is no longer possible to cast a Register
937 to a JSValue*, or a Register& to a JSValue*&, or to access the union
938 inside a Register directly.
940 SunSpider reports no change.
942 In support of this change, I had to make the following mechanical changes
945 1. Clients now use explicit accessors to read data out of Registers, and
946 implicit copy constructors to write data into registers.
948 So, assignment that used to look like
956 And access that used to look like
964 2. I made generic flow control specific in opcodes that made their flow
965 control generic by treating a Register& as a JSValue*&. This had the
966 added benefit of removing some exception checking branches from immediate
969 3. I beefed up PropertySlot to support storing a Register* in a property
970 slot. For now, only JSVariableObject's symbolTableGet and symbolTablePut
971 use this functionality, but I expect more clients to use it in the future.
973 4. I changed ArgList to be a buffer of Registers, not JSValue*'s, and I
974 changed ArgList iterator clients to iterate Registers, not JSValue*'s.
976 2008-07-16 Ada Chan <adachan@apple.com>
980 * kjs/JSGlobalObject.cpp:
982 2008-07-16 Kevin McCullough <kmccullough@apple.com>
984 Reviewed by Sam and Geoff.
986 <rdar://problem/5958840> Navigating to another page while profiler is
987 attached results in slow JavaScript for all time.
989 - The UNLIKELY keeps this from being a sunspider performance regression.
991 * kjs/JSGlobalObject.cpp:
992 (KJS::JSGlobalObject::~JSGlobalObject): Stop the profiler associated
993 with this exec state.
995 2008-07-16 Sam Weinig <sam@webkit.org>
997 Reviewed by Steve Falkenburg.
999 Replace adopting UString constructor in favor of explicit
1000 static adopt method.
1002 * API/JSStringRefCF.cpp:
1003 (JSStringCreateWithCFString):
1004 * kjs/StringConstructor.cpp:
1005 (KJS::stringFromCharCode):
1006 * kjs/StringPrototype.cpp:
1007 (KJS::stringProtoFuncToLowerCase):
1008 (KJS::stringProtoFuncToUpperCase):
1009 (KJS::stringProtoFuncToLocaleLowerCase):
1010 (KJS::stringProtoFuncToLocaleUpperCase):
1012 (KJS::UString::adopt):
1014 (KJS::UString::UString):
1015 (KJS::UString::~UString):
1017 2008-07-16 Ariya Hidayat <ariya.hidayat@trolltech.com>
1021 http://trolltech.com/developer/task-tracker/index_html?method=entry&id=216179
1022 Fix potential crash (on Qt for Windows port) when performing JavaScript date
1026 (KJS::getLocalTime): For the Qt port, prefer to use Windows code, i.e.
1027 localtime_s() instead of localtime() since the latter might crash (on Windows)
1028 given a non-sensible, e.g. NaN, argument.
1030 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1032 Reviewed by Anders and Geoff.
1034 https://bugs.webkit.org/show_bug.cgi?id=20023
1035 Failed assertion in PropertyNameArray.cpp
1037 This is already tested by testapi.
1039 * API/JSObjectRef.cpp: (JSPropertyNameAccumulatorAddName): Add the string to identifier
1040 table to appease PropertyNameArray.
1042 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1046 Dereference identifiers when deleting a hash table (fixes leaks with private JSGlobalData
1049 * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::~JSGlobalData):
1050 * kjs/lookup.cpp: (KJS::HashTable::deleteTable):
1052 * kjs/lexer.cpp: (KJS::Lexer::~Lexer)
1053 HashTable cannot have a destructor, because check-for-global-initializers complains about
1054 having a global constructor then.
1056 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1060 Check pthread_key_create return value.
1062 This check was helpful when debugging a crash in run-webkit-tests --threaded that happened
1063 because JSGlobalData objects were not deleted, and we were running out of pthread keys soon.
1064 It also looks useful for production builds.
1066 * wtf/ThreadSpecific.h: (WTF::::ThreadSpecific):
1068 2008-07-15 Kevin McCullough <kmccullough@apple.com>
1072 Rename pageGroupIdentifier to profileGroup to keep mention of a
1073 pageGroup out of JavaScriptCore.
1075 * kjs/JSGlobalObject.cpp:
1076 (KJS::JSGlobalObject::init):
1077 * kjs/JSGlobalObject.h:
1078 (KJS::JSGlobalObject::setProfileGroup):
1079 (KJS::JSGlobalObject::profileGroup):
1080 * profiler/ProfileGenerator.cpp:
1081 (KJS::ProfileGenerator::create):
1082 (KJS::ProfileGenerator::ProfileGenerator):
1083 * profiler/ProfileGenerator.h:
1084 (KJS::ProfileGenerator::profileGroup):
1085 * profiler/Profiler.cpp:
1086 (KJS::Profiler::startProfiling):
1087 (KJS::dispatchFunctionToProfiles):
1088 (KJS::Profiler::willExecute):
1089 (KJS::Profiler::didExecute):
1091 2008-07-14 Mark Rowe <mrowe@apple.com>
1093 Reviewed by Sam Weinig.
1095 Fix https://bugs.webkit.org/show_bug.cgi?id=20037
1096 Bug 20037: GCC 4.2 build broken due to strict aliasing violation.
1099 (KJS::UString::Rep::computeHash): Add a version of computeHash that takes a char* and explicit length.
1101 * profiler/CallIdentifier.h:
1102 (WTF::): Use new version of computeHash that takes a char* and explicit length to avoid unsafe aliasing.
1104 2008-07-14 David Hyatt <hyatt@apple.com>
1106 Fix a crashing bug in ListHashSet's -- operator. Make sure that end() can be -- by special-casing the null
1111 * wtf/ListHashSet.h:
1112 (WTF::ListHashSetConstIterator::operator--):
1114 2008-07-14 David Hyatt <hyatt@apple.com>
1116 Buidl fix. Make sure the second insertBefore method returns a value.
1118 * wtf/ListHashSet.h:
1119 (WTF::::insertBefore):
1121 2008-07-14 Adam Roben <aroben@apple.com>
1125 * JavaScriptCore.vcproj/jsc/jsc.vcproj: Added include/pthreads to the
1128 2008-07-14 Alexey Proskuryakov <ap@webkit.org>
1130 Reviewed by Kevin McCullough.
1132 Make JSGlobalData refcounted in preparation to adding a way to create contexts that share
1135 * JavaScriptCore.exp:
1136 * kjs/JSGlobalData.cpp:
1137 (KJS::JSGlobalData::create):
1138 * kjs/JSGlobalData.h:
1139 Made contructor private, and added a static create() method. Made the class inherit from
1142 * kjs/JSGlobalObject.h:
1143 (KJS::JSGlobalObject::globalData):
1144 JSGlobalData is now owned by JSGlobalObject (except for the shared one, and the common
1145 WebCore one, which are never deleted).
1147 * kjs/Shell.cpp: (main): Create JSGlobalData with create() method.
1149 2008-07-14 Simon Hausmann <hausmann@webkit.org>
1151 Fix the single-threaded build.
1153 * kjs/JSLock.cpp: Removed undeclared registerThread() function.
1154 * kjs/collector.cpp:
1155 (KJS::Heap::registerThread): Added dummy implementation.
1157 2008-07-14 Alexey Proskuryakov <ap@webkit.org>
1159 Reviewed by Geoff Garen.
1161 Eliminate per-thread JavaScript global data instance support and make arbitrary
1162 global data/global object combinations possible.
1164 * kjs/collector.cpp:
1165 (KJS::Heap::Heap): Store a JSGlobalData pointer instead of multiple pointers to its members.
1166 This allows for going from any JS object to its associated global data, currently used in
1167 JSGlobalObject constructor to initialize its JSGlobalData pointer.
1168 (KJS::Heap::registerThread): Changed thread registration data to be per-heap. Previously,
1169 only the shared heap could be used from multiple threads, so it was the only one that needed
1170 thread registration, but now this can happen to any heap.
1171 (KJS::Heap::unregisterThread): Ditto.
1172 (KJS::Heap::markStackObjectsConservatively): Adapt for the above changes.
1173 (KJS::Heap::setGCProtectNeedsLocking): Ditto.
1174 (KJS::Heap::protect): Ditto.
1175 (KJS::Heap::unprotect): Ditto.
1176 (KJS::Heap::collect): Ditto.
1177 (KJS::Heap::globalObjectCount): Use global object list associated with the current heap,
1178 not the late per-thread one.
1179 (KJS::Heap::protectedGlobalObjectCount): Ditto.
1182 (KJS::Heap::ThreadRegistrar): Added a helper object that unregisters a thread when it is
1186 (KJS::JSLock::JSLock):
1188 (KJS::JSLock::JSLock):
1189 Don't use JSLock to implicitly register threads. I've added registerThread() calls to most
1190 places that use JSLock - we cannot guarantee absolute safety unless we always mark all
1191 threads in the process, but these implicit registration calls should cover reasonable usage
1195 (JSEvaluateScript): Explicitly register the current thread.
1196 (JSCheckScriptSyntax): Explicitly register the current thread.
1197 (JSGarbageCollect): Changed to use the passed in context. Unfortunately, this creates a race
1198 condition for clients that pass an already released context to JSGarbageCollect - but it is
1199 unlikely to create real life problems.
1200 To maintain compatibility, the shared heap is collected if NULL is passed.
1202 * API/JSContextRef.cpp:
1203 (JSGlobalContextCreate): Use a new syntax for JSGlobalObject allocation.
1204 (JSGlobalContextRetain): Register the thread.
1205 (JSContextGetGlobalObject): Register the thread.
1207 * API/JSObjectRef.cpp:
1209 (JSObjectMakeFunctionWithCallback):
1210 (JSObjectMakeConstructor):
1211 (JSObjectMakeFunction):
1212 (JSObjectHasProperty):
1213 (JSObjectGetProperty):
1214 (JSObjectSetProperty):
1215 (JSObjectGetPropertyAtIndex):
1216 (JSObjectSetPropertyAtIndex):
1217 (JSObjectDeleteProperty):
1218 (JSObjectCallAsFunction):
1219 (JSObjectCallAsConstructor):
1220 (JSObjectCopyPropertyNames):
1221 (JSPropertyNameAccumulatorAddName):
1222 * API/JSValueRef.cpp:
1224 (JSValueIsInstanceOfConstructor):
1225 (JSValueMakeNumber):
1226 (JSValueMakeString):
1228 (JSValueToStringCopy):
1232 Register the thread.
1234 * API/JSStringRef.cpp: (JSStringRelease): Changed a comment to not mention per-thread contexts.
1236 * API/JSStringRefCF.cpp: Removed an unnecessary include of JSLock.h.
1238 * JavaScriptCore.exp: Export JSGlobalData constructor/destructor, now that anyone can have
1239 their own instances. Adapt to other changes, too.
1241 * JavaScriptCore.xcodeproj/project.pbxproj: Made ThreadSpecific.h private, as it is now
1242 included by collector.h and is thus needed in other projects.
1244 * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Don't initialize per-thread
1245 global data, as it no longer exists.
1247 * kjs/JSGlobalData.cpp:
1248 (KJS::JSGlobalData::JSGlobalData):
1249 (KJS::JSGlobalData::~JSGlobalData):
1250 * kjs/JSGlobalData.h:
1251 Removed support for per-thread instance. Made constructor and destructor public.
1253 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Get to now arbitrary JSGlobalData
1255 (KJS::JSGlobalObject::operator new): Changed ot take JSGlobalDatra pointer.
1256 * kjs/JSGlobalObject.h:
1261 Changed to maintain a custom JSGlobalData pointer instead of a per-thread one.
1263 2008-07-13 Ada Chan <adachan@apple.com>
1265 Windows build fix: Add wtf/RefCountedLeakCounter to the project.
1267 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
1269 2008-07-12 Jan Michael Alonzo <jmalonzo@webkit.org>
1271 Gtk, Qt and Wx build fix: Add wtf/RefCountedLeakCounter in the
1275 * JavaScriptCore.pri:
1276 * JavaScriptCoreSources.bkl:
1278 2008-07-11 Stephanie Lewis <slewis@apple.com>
1280 Reviewed by Darin Adler and Oliver Hunt.
1282 Refactor RefCounting Leak counting code into a common class.
1284 In order to export the symbols I needed to put the debug defines inside the function names
1286 Before we had a separate channel for each Logging each Leak type. Since the leak channels were only used in one location, and only at quit for simplicity I combined them all into one leak channel.
1288 * JavaScriptCore.exp:
1289 * JavaScriptCore.xcodeproj/project.pbxproj: add new class
1290 * kjs/nodes.cpp: remove old leak counting code
1291 * wtf/RefCountedLeakCounter.cpp: Added. create a common leak counting class
1292 * wtf/RefCountedLeakCounter.h: Added.
1294 2008-07-11 David Hyatt <hyatt@apple.com>
1296 Add an insertBefore method to ListHashSet to allow for insertions in the middle of the list (rather than just
1301 * wtf/ListHashSet.h:
1302 (WTF::::insertBefore):
1303 (WTF::::insertNodeBefore):
1305 2008-07-11 Sam Weinig <sam@webkit.org>
1307 Rubber-stamped by Darin Adler.
1309 Move call function to CallData.cpp and construct to ConstructData.cpp.
1312 * JavaScriptCore.pri:
1313 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1314 * JavaScriptCore.xcodeproj/project.pbxproj:
1315 * JavaScriptCoreSources.bkl:
1316 * kjs/AllInOneFile.cpp:
1317 * kjs/CallData.cpp: Copied from kjs/JSValue.cpp.
1318 * kjs/ConstructData.cpp: Copied from kjs/JSValue.cpp.
1321 2008-07-10 Mark Rowe <mrowe@apple.com>
1323 Reviewed by Sam Weinig.
1325 Define WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST when building WebKit to ensure that no symbols end up with the weak_import attribute.
1327 * Configurations/Base.xcconfig:
1329 2008-07-10 Mark Rowe <mrowe@apple.com>
1331 Reviewed by Sam Weinig.
1333 Fix the Tiger build by omitting annotations from methods declared in categories when using old versions of GCC.
1335 * API/WebKitAvailability.h:
1337 2008-07-10 Kevin McCullough <kmccullough@apple.com>
1341 -Minor cleanup. Renamed callTree() to head() and no longer use m_head
1342 directly but instead keep it private and access via a method().
1344 * profiler/HeavyProfile.cpp:
1345 (KJS::HeavyProfile::HeavyProfile):
1346 (KJS::HeavyProfile::generateHeavyStructure):
1347 (KJS::HeavyProfile::addNode):
1348 * profiler/Profile.h:
1349 (KJS::Profile::head):
1350 * profiler/ProfileGenerator.cpp:
1351 (KJS::ProfileGenerator::ProfileGenerator):
1353 2008-07-10 Alexey Proskuryakov <ap@webkit.org>
1355 Reviewed by Mark Rowe.
1357 Eliminate CollectorHeapIntrospector.
1359 CollectorHeapIntrospector was added primarily in the hopes to improve leaks tool output,
1360 a result that it didn't deliver. Also, it helped by labeling JSC heap regions as reported by
1361 vmmap tool, but at the same time, it made them mislabeled as malloc'd ones - the correct
1362 way to label mapped regions is to use a VM tag.
1364 So, it makes more sense to remove it completely than to make it work with multiple heaps.
1366 * JavaScriptCore.exp:
1367 * JavaScriptCore.xcodeproj/project.pbxproj:
1368 * kjs/AllInOneFile.cpp:
1369 * kjs/InitializeThreading.cpp:
1370 (KJS::initializeThreading):
1371 * kjs/collector.cpp:
1373 * kjs/CollectorHeapIntrospector.cpp: Removed.
1374 * kjs/CollectorHeapIntrospector.h: Removed.
1376 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1380 <rdar://problem/5951532> JSProfiler: Implement heavy (or bottom-up)
1382 - Implemented the time and call count portionof heavy. Now all that we
1385 * profiler/CallIdentifier.h: Removed an unused constructor.
1386 * profiler/HeavyProfile.cpp:
1387 (KJS::HeavyProfile::HeavyProfile): Set the initial time of the head
1388 node so that percentages work correctly.
1389 (KJS::HeavyProfile::mergeProfiles): Sum the times and call count of
1391 * profiler/ProfileNode.cpp: Set the intital values of time and call
1392 count when copying ProfileNodes.
1393 (KJS::ProfileNode::ProfileNode):
1395 2008-07-10 Jan Michael Alonzo <jmalonzo@webkit.org>
1399 * GNUmakefile.am: Add HeavyProfile.cpp
1401 2008-07-09 Mark Rowe <mrowe@apple.com>
1403 Reviewed by Geoff Garen.
1405 Don't warn about deprecated functions in production builds.
1407 * Configurations/Base.xcconfig:
1408 * Configurations/DebugRelease.xcconfig:
1410 2008-07-09 Darin Adler <darin@apple.com>
1412 * JavaScriptCore.pri: Fix Qt build by adding HeavyProfile.cpp.
1414 2008-07-09 Kevin Ollivier <kevino@theolliviers.com>
1416 wx biuld fix. Add HeavyProfile.cpp to build files.
1418 * JavaScriptCoreSources.bkl:
1420 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1422 - Windows build fix.
1424 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1426 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1430 * profiler/HeavyProfile.cpp:
1431 (KJS::HeavyProfile::mergeProfiles):
1433 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1435 Reviewed by Geoff and Adam.
1437 <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
1438 - This is the plumbing for bottom-up, but does not include calculating
1439 time, mostly because I'm still undclear about what the end result should
1441 - This, obviously, does not include the UI to expose this in the
1444 * JavaScriptCore.xcodeproj/project.pbxproj:
1445 * profiler/CallIdentifier.h:
1446 (KJS::CallIdentifier::CallIdentifier):
1447 (WTF::): Added HashTraits for CallIdentifiers to be used by a HashMap.
1448 * profiler/HeavyProfile.cpp: Added.
1449 (KJS::HeavyProfile::HeavyProfile):
1450 (KJS::HeavyProfile::generateHeavyStructure):
1451 (KJS::HeavyProfile::addNode):
1452 (KJS::HeavyProfile::mergeProfiles):
1453 (KJS::HeavyProfile::addAncestorsAsChildren):
1454 * profiler/HeavyProfile.h: Added.
1455 (KJS::HeavyProfile::create):
1456 (KJS::HeavyProfile::heavyProfile):
1457 (KJS::HeavyProfile::treeProfile):
1458 * profiler/Profile.cpp: Removed old commented out includes.
1459 * profiler/Profile.h: The m_head is needed by the HeavyProfile so it
1460 is now protected as opposed to private.
1461 * profiler/ProfileNode.cpp:
1462 (KJS::ProfileNode::ProfileNode): Created a constructor to copy
1464 (KJS::ProfileNode::findChild): Added a null check to make HeavyProfile
1465 children finding easier and avoid a potential crasher.
1466 * profiler/ProfileNode.h: Mostly moved things around but also added some
1467 functionality needed by HeavyProfile.
1468 (KJS::ProfileNode::create):
1469 (KJS::ProfileNode::functionName):
1470 (KJS::ProfileNode::url):
1471 (KJS::ProfileNode::lineNumber):
1472 (KJS::ProfileNode::head):
1473 (KJS::ProfileNode::setHead):
1474 (KJS::ProfileNode::setNextSibling):
1475 (KJS::ProfileNode::actualTotalTime):
1476 (KJS::ProfileNode::actualSelfTime):
1477 * profiler/TreeProfile.cpp: Implemented the ability to get a
1479 (KJS::TreeProfile::heavyProfile):
1480 * profiler/TreeProfile.h:
1482 2008-07-08 Geoffrey Garen <ggaren@apple.com>
1484 Reviewed by Oliver Hunt.
1486 Added support for checking if an object has custom properties in its
1487 property map. WebCore uses this to optimize marking DOM wrappers.
1489 2008-07-08 Simon Hausmann <hausmann@webkit.org>
1491 Prospective Gtk/Wx build fixes, add ProfileGenerator.cpp to the build.
1494 * JavaScriptCoreSources.bkl:
1496 2008-07-08 Simon Hausmann <hausmann@webkit.org>
1498 Fix the Qt build, add ProfileGenerator.cpp to the build.
1500 * JavaScriptCore.pri:
1502 2008-07-07 David Kilzer <ddkilzer@apple.com>
1504 releaseFastMallocFreeMemory() should always be defined
1508 * JavaScriptCore.exp: Changed to export C++ binding for
1509 WTF::releaseFastMallocFreeMemory() instead of C binding for
1510 releaseFastMallocFreeMemory().
1511 * wtf/FastMalloc.cpp: Moved definitions of
1512 releaseFastMallocFreeMemory() to be in the WTF namespace
1513 regardless whether FORCE_SYSTEM_MALLOC is defined.
1514 * wtf/FastMalloc.h: Moved releaseFastMallocFreeMemory() from
1515 extern "C" binding to WTF::releaseFastMallocFreeMemory().
1517 2008-07-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1521 Bug 19926: URL causes crash within a minute
1522 <https://bugs.webkit.org/show_bug.cgi?id=19926>
1524 Add a check that lastGlobalObject is non-null in Machine::execute()
1525 before copying its globals to the current register file.
1527 In theory, it is possible to make a test case for this, but it will
1528 take a while to get it right.
1531 (KJS::Machine::execute):
1533 2008-07-07 Darin Adler <darin@apple.com>
1535 Rubber stamped by Adele.
1538 (KJS::Machine::privateExecute): Fix a typo in a comment.
1540 2008-07-07 Steve Falkenburg <sfalken@apple.com>
1544 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1545 * JavaScriptCore.vcproj/testapi/testapi.vcproj:
1547 2008-07-07 Kevin McCullough <kmccullough@apple.com>
1551 When the profiler is running it gathers information and creates a
1552 Profile. After it finishes the Profile can be sorted and have other
1553 data refinements run over it. Both of these were done in the same class
1554 before. Now I split the gathering operations into a new class called
1557 * JavaScriptCore.xcodeproj/project.pbxproj:
1558 * profiler/Profile.cpp: Removed code related to the gather stage of a
1560 (KJS::Profile::create):
1561 (KJS::Profile::Profile):
1562 * profiler/Profile.h: Ditto.
1563 (KJS::Profile::title):
1564 (KJS::Profile::callTree):
1565 (KJS::Profile::setHead):
1566 * profiler/ProfileGenerator.cpp: Added. This is the class that will
1567 handle the stage of creating a Profile. Once the Profile is finished
1568 being created, this class goes away.
1569 (KJS::ProfileGenerator::create):
1570 (KJS::ProfileGenerator::ProfileGenerator):
1571 (KJS::ProfileGenerator::title):
1572 (KJS::ProfileGenerator::willExecute):
1573 (KJS::ProfileGenerator::didExecute):
1574 (KJS::ProfileGenerator::stopProfiling):
1575 (KJS::ProfileGenerator::didFinishAllExecution):
1576 (KJS::ProfileGenerator::removeProfileStart):
1577 (KJS::ProfileGenerator::removeProfileEnd):
1578 * profiler/ProfileGenerator.h: Added.
1579 (KJS::ProfileGenerator::profile):
1580 (KJS::ProfileGenerator::originatingGlobalExec):
1581 (KJS::ProfileGenerator::pageGroupIdentifier):
1582 (KJS::ProfileGenerator::client):
1583 (KJS::ProfileGenerator::stoppedProfiling):
1584 * profiler/Profiler.cpp: Now operates with the ProfileGenerator instead
1586 (KJS::Profiler::startProfiling):
1587 (KJS::Profiler::stopProfiling):
1588 (KJS::Profiler::didFinishAllExecution): It is here that the Profile is
1589 handed off to its client and the Profile Generator is no longer needed.
1590 (KJS::dispatchFunctionToProfiles):
1591 (KJS::Profiler::willExecute):
1592 (KJS::Profiler::didExecute):
1593 * profiler/Profiler.h: Cleaned up the includes and subsequently the
1594 forward declarations. Also use the new ProfileGenerator.
1595 (KJS::ProfilerClient::~ProfilerClient):
1596 (KJS::Profiler::currentProfiles):
1597 * profiler/TreeProfile.cpp: Use Profile's new interface.
1598 (KJS::TreeProfile::create):
1599 (KJS::TreeProfile::TreeProfile):
1600 * profiler/TreeProfile.h:
1602 2008-07-07 Sam Weinig <sam@webkit.org>
1604 Reviewed by Cameron Zwarich.
1606 Third step in broad cleanup effort.
1608 [ File list elided ]
1610 2008-07-06 Sam Weinig <sam@webkit.org>
1612 Reviewed by Cameron Zwarich.
1614 Second step in broad cleanup effort.
1616 [ File list elided ]
1618 2008-07-05 Sam Weinig <sam@webkit.org>
1620 Reviewed by Cameron Zwarich.
1622 First step in broad cleanup effort.
1624 [ File list elided ]
1626 2008-07-05 Sam Weinig <sam@webkit.org>
1628 Rubber-stamped by Cameron Zwarich.
1630 Rename list.h/cpp to ArgList.h/cpp.
1633 * JavaScriptCore.pri:
1634 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1635 * JavaScriptCore.xcodeproj/project.pbxproj:
1636 * JavaScriptCoreSources.bkl:
1638 * kjs/AllInOneFile.cpp:
1639 * kjs/ArgList.cpp: Copied from JavaScriptCore/kjs/list.cpp.
1640 * kjs/ArgList.h: Copied from JavaScriptCore/kjs/list.h.
1641 * kjs/IndexToNameMap.cpp:
1642 * kjs/JSGlobalData.cpp:
1643 * kjs/JSGlobalData.h:
1645 * kjs/collector.cpp:
1646 * kjs/list.cpp: Removed.
1647 * kjs/list.h: Removed.
1649 2008-07-05 Sam Weinig <sam@webkit.org>
1651 Fix non-AllInOne builds again.
1653 * kjs/BooleanPrototype.cpp:
1654 * kjs/ErrorPrototype.cpp:
1655 * kjs/FunctionPrototype.cpp:
1656 * kjs/NumberPrototype.cpp:
1657 * kjs/ObjectPrototype.cpp:
1659 2008-07-05 Sam Weinig <sam@webkit.org>
1661 Fix build on case-sensitive build systems.
1663 * kjs/IndexToNameMap.cpp:
1665 2008-07-05 Sam Weinig <sam@webkit.org>
1669 * kjs/Arguments.cpp:
1670 * kjs/BooleanPrototype.cpp:
1671 * kjs/DateConstructor.cpp:
1672 * kjs/ErrorPrototype.cpp:
1673 * kjs/FunctionPrototype.cpp:
1674 * kjs/NumberPrototype.cpp:
1675 * kjs/ObjectPrototype.cpp:
1676 * kjs/RegExpPrototype.cpp:
1677 * kjs/StringConstructor.cpp:
1680 2008-07-05 Sam Weinig <sam@webkit.org>
1682 Fix non-AllInOne build.
1684 * kjs/JSGlobalObject.cpp:
1686 2008-07-05 Sam Weinig <sam@webkit.org>
1688 Rubber-stamped by Cameron Zwarich.
1690 Split Arguments, IndexToNameMap, PrototypeFunction, GlobalEvalFunction and
1691 the functions on the global object out of JSFunction.h/cpp.
1694 * JavaScriptCore.pri:
1695 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1696 * JavaScriptCore.xcodeproj/project.pbxproj:
1697 * JavaScriptCoreSources.bkl:
1699 * kjs/AllInOneFile.cpp:
1700 * kjs/Arguments.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1701 * kjs/Arguments.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1702 * kjs/GlobalEvalFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1703 * kjs/GlobalEvalFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1704 * kjs/IndexToNameMap.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1705 * kjs/IndexToNameMap.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1706 * kjs/JSActivation.cpp:
1707 * kjs/JSFunction.cpp:
1709 * kjs/JSGlobalObject.cpp:
1710 * kjs/JSGlobalObjectFunctions.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1711 * kjs/JSGlobalObjectFunctions.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1712 The functions on the global object should be in JSGlobalObject.cpp, but putting them there
1713 was a 0.5% regression.
1715 * kjs/PrototypeFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1716 * kjs/PrototypeFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1721 2008-07-04 Sam Weinig <sam@webkit.org>
1723 Really fix the mac build.
1725 * JavaScriptCore.xcodeproj/project.pbxproj:
1727 2008-07-04 Sam Weinig <sam@webkit.org>
1731 * JavaScriptCore.xcodeproj/project.pbxproj:
1733 2008-07-04 Sam Weinig <sam@webkit.org>
1735 Fix non-AllInOne builds.
1738 * kjs/GetterSetter.cpp:
1739 * kjs/JSImmediate.cpp:
1740 * kjs/operations.cpp:
1742 2008-07-04 Sam Weinig <sam@webkit.org>
1744 Rubber-stamped by Dan Bernstein.
1746 Split Error and GetterSetter out of JSObject.h.
1748 * API/JSCallbackObjectFunctions.h:
1750 * JavaScriptCore.pri:
1751 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1752 * JavaScriptCore.xcodeproj/project.pbxproj:
1753 * JavaScriptCoreSources.bkl:
1754 * kjs/AllInOneFile.cpp:
1755 * kjs/ClassInfo.h: Copied from JavaScriptCore/kjs/JSObject.h.
1756 * kjs/Error.cpp: Copied from JavaScriptCore/kjs/JSObject.cpp.
1757 * kjs/Error.h: Copied from JavaScriptCore/kjs/JSObject.h.
1758 * kjs/GetterSetter.cpp:
1759 * kjs/GetterSetter.h: Copied from JavaScriptCore/kjs/JSObject.h.
1764 2008-07-04 Simon Hausmann <hausmann@webkit.org>
1766 Fix the Wx build, added TreeProfile.cpp to the build.
1768 * JavaScriptCoreSources.bkl:
1770 2008-07-03 Mark Rowe <mrowe@apple.com>
1772 Reviewed by Oliver Hunt.
1774 Fix output path of recently-added script phase to reference the correct file.
1775 This prevents Xcode from running the script phase unnecessarily, which caused
1776 the generated header to be recreated and lead to AllInOneFile.cpp rebuilding.
1778 * JavaScriptCore.xcodeproj/project.pbxproj:
1780 2008-07-03 Mark Rowe <mrowe@apple.com>
1782 Follow-up to the 64-bit build fix. Use intptr_t rather than ssize_t as
1783 the latter is non-standard and does not exist on Windows.
1786 (KJS::JSLock::lockCount):
1787 (KJS::JSLock::lock):
1788 (KJS::JSLock::unlock):
1789 (KJS::JSLock::DropAllLocks::DropAllLocks):
1792 2008-07-02 Mark Rowe <mrowe@apple.com>
1794 Fix the 64-bit build. pthread_getspecific works with pointer-sized values,
1795 so use ssize_t rather than int to track the lock count to avoid warnings about
1796 truncating the result of pthread_getspecific.
1799 (KJS::JSLock::lockCount):
1800 (KJS::JSLock::lock):
1801 (KJS::JSLock::unlock):
1802 (KJS::JSLock::DropAllLocks::DropAllLocks):
1805 2008-07-03 Geoffrey Garen <ggaren@apple.com>
1807 Reviewed by Sam Weinig.
1809 Removed checking for the array get/put fast case from the array code.
1810 Callers who want the fast case should call getIndex and/or setIndex
1811 instead. (get_by_val and put_by_val already do this.)
1813 SunSpider reports no change overall, but a 1.4% speedup on fannkuch and
1814 a 3.6% speedup on nsieve.
1816 2008-07-03 Dan Bernstein <mitz@apple.com>
1820 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added TreeProfile.{h,cpp}.
1822 2008-07-03 Dan Bernstein <mitz@apple.com>
1824 Reviewed by Anders Carlsson.
1829 (KJS::Machine::Machine):
1831 2008-07-03 Simon Hausmann <hausmann@webkit.org>
1833 Reviewed by Alexey Proskuryakov.
1835 Fix the non-threaded build.
1837 * kjs/JSGlobalData.cpp:
1838 (KJS::JSGlobalData::threadInstanceInternal):
1840 2008-07-03 Simon Hausmann <hausmann@webkit.org>
1842 Fix the Qt build, added TreeProfile to the build.
1844 * JavaScriptCore.pri:
1846 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
1850 Don't create unnecessary JSGlobalData instances.
1852 * kjs/JSGlobalData.h:
1853 * kjs/JSGlobalData.cpp:
1854 (KJS::JSGlobalData::threadInstanceExists):
1855 (KJS::JSGlobalData::sharedInstanceExists):
1856 (KJS::JSGlobalData::threadInstance):
1857 (KJS::JSGlobalData::sharedInstance):
1858 (KJS::JSGlobalData::threadInstanceInternal):
1859 (KJS::JSGlobalData::sharedInstanceInternal):
1860 Added methods to query instance existence.
1862 * kjs/InitializeThreading.cpp:
1863 (KJS::initializeThreadingOnce):
1864 Initialize thread instance static in a new way.
1868 * kjs/collector.cpp:
1869 (KJS::Heap::collect):
1870 Check for instance existence before accessing it.
1872 2008-07-02 Geoffrey Garen <ggaren@apple.com>
1874 Reviewed by Cameron Zwarich.
1876 Fixed https://bugs.webkit.org/show_bug.cgi?id=19862
1877 REGRESSION (r34907): Gmail crashes in JavaScriptCore code while editing drafts
1879 I was never able to reproduce this issue, but Cameron could, and he says
1880 that this patch fixes it.
1882 The crash seems tied to a timer or event handler callback. In such a case,
1883 the sole reference to the global object may be in the current call frame,
1884 so we can't depend on the global object to mark the call frame area in
1887 The new GC marking rule is: the global object is not responsible for
1888 marking the whole register file -- it's just responsible for the globals
1889 section it's tied to. The heap is responsible for marking the call frame area.
1891 2008-07-02 Mark Rowe <mrowe@apple.com>
1893 Reviewed by Sam Weinig.
1895 Add the ability to trace JavaScriptCore garabge collections using dtrace.
1897 * JavaScriptCore.xcodeproj/project.pbxproj: Generate the dtrace probe header
1898 file when building on a new enough version of Mac OS X.
1899 * JavaScriptCorePrefix.h: Add our standard Mac OS X version detection macros.
1900 * kjs/Tracing.d: Declare three dtrace probes.
1901 * kjs/Tracing.h: Include the generated dtrace macros if dtrace is available,
1902 otherwise provide versions that do nothing.
1903 * kjs/collector.cpp:
1904 (KJS::Heap::collect): Fire dtrace probes when starting a collection, after the
1905 mark phase has completed, and when the collection is complete.
1906 * wtf/Platform.h: Define HAVE_DTRACE when building on a new enough version of Mac OS X.
1908 2008-07-02 Geoffrey Garen <ggaren@apple.com>
1910 Rubber stamped by Oliver Hunt.
1912 Reduced the max register file size from 8MB to 2MB.
1914 We still allow about 20,000 levels of recursion.
1916 2008-07-02 Alp Toker <alp@nuanti.com>
1918 Build fix for r34960. Add TreeProfile.cpp to build.
1922 2008-07-02 Geoffrey Garen <ggaren@apple.com>
1924 Reviewed by Oliver Hunt.
1926 Optimized a[n] get for cases when a is an array or a string. When a is
1927 an array, we optimize both get and put. When a is a string, we only
1928 optimize get, since you can't put to a string.
1930 SunSpider says 3.4% faster.
1932 2008-07-02 Kevin McCullough <kmccullough@apple.com>
1936 -Small cleanup in preparation for implementing Bottom-up.
1938 * profiler/CallIdentifier.h: Rename debug function to make it clear of
1939 its output and intention to be debug only.
1940 (KJS::CallIdentifier::operator const char* ): Implement in terms of
1942 (KJS::CallIdentifier::c_str):
1943 * profiler/ProfileNode.cpp: Impelment findChild() which will be needed
1944 by the bottom-up implementation.
1945 (KJS::ProfileNode::findChild):
1946 * profiler/ProfileNode.h: Added comments to make the collections of
1947 functions more clear.
1948 (KJS::ProfileNode::operator==):
1949 (KJS::ProfileNode::c_str):
1951 2008-07-02 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1955 Bug 19776: Number.toExponential() is incorrect for numbers between 0.1 and 1
1956 <https://bugs.webkit.org/show_bug.cgi?id=19776>
1958 Perform the sign check for the exponent on the actual exponent value,
1959 which is 1 less than the value of decimalPoint, instead of on the value
1960 of decimalPoint itself.
1962 * kjs/NumberPrototype.cpp:
1963 (KJS::exponentialPartToString):
1965 2008-07-02 Kevin McCullough <kmccullough@apple.com>
1969 <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
1970 - Subclass TreeProfile as I prepare for a HeavyProfile to be comming
1973 * JavaScriptCore.xcodeproj/project.pbxproj:
1974 * profiler/Profile.cpp: By default we create a TreeProfile.
1975 (KJS::Profile::create):
1976 * profiler/Profile.h: Changes to the Profile class to make it amenable
1977 to be inherited from.
1978 (KJS::Profile::~Profile):
1979 * profiler/TreeProfile.cpp: Added.
1980 (KJS::TreeProfile::create):
1981 (KJS::TreeProfile::TreeProfile):
1982 (KJS::TreeProfile::heavyProfile):
1983 * profiler/TreeProfile.h: Added.
1984 (KJS::TreeProfile::treeProfile):
1986 2008-07-02 Kevin McCullough <kmccullough@apple.com>
1990 Broke CallIdentifier out into its own file. I did this because it's
1991 going to grow a lot soon and I wanted this to be a separate patch.
1993 * JavaScriptCore.xcodeproj/project.pbxproj:
1994 * profiler/CallIdentifier.h: Added.
1995 (KJS::CallIdentifier::CallIdentifier):
1996 (KJS::CallIdentifier::operator==):
1997 (KJS::CallIdentifier::operator!=):
1998 (KJS::CallIdentifier::operator const char* ):
1999 (KJS::CallIdentifier::toString):
2000 * profiler/ProfileNode.h:
2002 2008-07-02 Simon Hausmann <hausmann@webkit.org>
2004 Build fix. Implemented missing functions for single-threaded build.
2007 (KJS::JSLock::JSLock):
2008 (KJS::JSLock::lock):
2009 (KJS::JSLock::unlock):
2010 (KJS::JSLock::DropAllLocks::DropAllLocks):
2012 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
2014 Another non-AllInOne build fix.
2016 * kjs/JSGlobalObject.cpp: Include JSLock.h here, too.
2018 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
2020 Non-AllInOne build fix.
2022 * kjs/interpreter.cpp: Include JSLock.h.
2024 2008-06-30 Alexey Proskuryakov <ap@webkit.org>
2028 Disable JSLock for per-thread contexts.
2030 No change on SunSpider.
2032 * kjs/JSGlobalData.h:
2033 * kjs/JSGlobalData.cpp:
2034 (KJS::JSGlobalData::JSGlobalData):
2035 (KJS::JSGlobalData::sharedInstance):
2036 Added isSharedInstance as a better way to tell whether the instance is shared (legacy).
2039 (KJS::createJSLockCount):
2040 (KJS::JSLock::lockCount):
2041 (KJS::setLockCount):
2042 (KJS::JSLock::JSLock):
2043 (KJS::JSLock::lock):
2044 (KJS::JSLock::unlock):
2045 (KJS::JSLock::currentThreadIsHoldingLock):
2046 (KJS::JSLock::DropAllLocks::DropAllLocks):
2047 (KJS::JSLock::DropAllLocks::~DropAllLocks):
2049 (KJS::JSLock::JSLock):
2050 (KJS::JSLock::~JSLock):
2051 Made JSLock and JSLock::DropAllLocks constructors take a parameter to decide whether to
2052 actually lock a mutex, or only to increment recursion count. We cannot turn it into no-op
2053 if we want to keep existing assertions working.
2054 Made recursion count per-thread, now that locks may not lock.
2057 (JSEvaluateScript): Take JSLock after casting JSContextRef to ExecState* (which doesn't need
2058 locking in any case), so that a decision whether to actually lock can be made.
2059 (JSCheckScriptSyntax): Ditto.
2060 (JSGarbageCollect): Only lock while collecting the shared heap, not the per-thread one.
2062 * API/JSObjectRef.cpp:
2063 (JSClassCreate): Don't lock, as there is no reason to.
2064 (JSClassRetain): Ditto.
2065 (JSClassRelease): Ditto.
2066 (JSPropertyNameArrayRetain): Ditto.
2067 (JSPropertyNameArrayRelease): Only lock while deleting the array, as that may touch
2069 (JSPropertyNameAccumulatorAddName): Adding a string also involves an identifier table
2070 lookup, and possibly modification.
2072 * API/JSStringRef.cpp:
2073 (JSStringCreateWithCharacters):
2074 (JSStringCreateWithUTF8CString):
2077 (JSStringGetUTF8CString):
2079 * API/JSStringRefCF.cpp:
2080 (JSStringCreateWithCFString):
2081 JSStringRef operations other than releasing do not need locking.
2083 * VM/Machine.cpp: Don't include unused JSLock.h.
2085 * kjs/CollectorHeapIntrospector.cpp: (KJS::CollectorHeapIntrospector::statistics):
2086 Don't take the lock for real, as heap introspection pauses the process anyway. It seems that
2087 the existing code could cause deadlocks.
2093 The test tool uses a per-thread context, so no real locking is required.
2096 (KJS::Heap::setGCProtectNeedsLocking): Optionally protect m_protectedValues access with a
2097 per-heap mutex. This is only needed for WebCore Database code, which violates the "no data
2098 migration between threads" by using ProtectedPtr on a background thread.
2099 (KJS::Heap::isShared): Keep a shared flag here, as well.
2102 (KJS::::ProtectedPtr):
2103 (KJS::::~ProtectedPtr):
2107 ProtectedPtr is ony used from WebCore, so it doesn't need to take JSLock. An assertion in
2108 Heap::protect/unprotect guards agains possible future unlocked uses of ProtectedPtr in JSC.
2110 * kjs/collector.cpp:
2111 (KJS::Heap::Heap): Initialize m_isShared.
2112 (KJS::Heap::~Heap): No need to lock for real during destruction, but must keep assertions
2114 (KJS::destroyRegisteredThread): Registered thread list is only accessed for shared heap,
2115 so locking is always needed here.
2116 (KJS::Heap::registerThread): Ditto.
2117 (KJS::Heap::markStackObjectsConservatively): Use m_isShared instead of comparing to a shared
2118 instance for a small speedup.
2119 (KJS::Heap::setGCProtectNeedsLocking): Create m_protectedValuesMutex. There is currently no
2120 way to undo this - and ideally, Database code will be fixed to lo longer require this quirk.
2121 (KJS::Heap::protect): Take m_protectedValuesMutex (if it exists) while accessing
2123 (KJS::Heap::unprotect): Ditto.
2124 (KJS::Heap::markProtectedObjects): Ditto.
2125 (KJS::Heap::protectedGlobalObjectCount): Ditto.
2126 (KJS::Heap::protectedObjectCount): Ditto.
2127 (KJS::Heap::protectedObjectTypeCounts): Ditto.
2131 Don't include JSLock.h, which is no longer used here. As a result, an explicit include had
2132 to be added to many files in JavaScriptGlue, WebCore and WebKit.
2134 * kjs/JSGlobalObject.cpp:
2135 (KJS::JSGlobalObject::init):
2136 * API/JSCallbackConstructor.cpp:
2137 (KJS::constructJSCallback):
2138 * API/JSCallbackFunction.cpp:
2139 (KJS::JSCallbackFunction::call):
2140 * API/JSCallbackObjectFunctions.h:
2142 (KJS::::getOwnPropertySlot):
2144 (KJS::::deleteProperty):
2146 (KJS::::hasInstance):
2148 (KJS::::getPropertyNames):
2151 (KJS::::staticValueGetter):
2152 (KJS::::callbackGetter):
2153 * API/JSContextRef.cpp:
2154 (JSGlobalContextCreate):
2155 (JSGlobalContextRetain):
2156 (JSGlobalContextRelease):
2157 * API/JSValueRef.cpp:
2159 (JSValueIsStrictEqual):
2160 (JSValueIsInstanceOfConstructor):
2161 (JSValueMakeNumber):
2162 (JSValueMakeString):
2164 (JSValueToStringCopy):
2168 * JavaScriptCore.exp:
2169 * kjs/PropertyNameArray.h:
2170 (KJS::PropertyNameArray::globalData):
2171 * kjs/interpreter.cpp:
2172 (KJS::Interpreter::checkSyntax):
2173 (KJS::Interpreter::evaluate):
2174 Pass a parameter to JSLock/JSLock::DropAllLocks to decide whether the lock needs to be taken.
2176 2008-07-01 Alexey Proskuryakov <ap@webkit.org>
2180 https://bugs.webkit.org/show_bug.cgi?id=19834
2181 Failed assertion in JavaScriptCore/VM/SegmentedVector.h:82
2183 Creating a global object with a custom prototype resets it twice (wasteful!).
2184 So, addStaticGlobals() was called twice, but JSGlobalObject::reset() didn't reset
2187 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::reset): Call setRegisterArray(0, 0).
2189 * kjs/JSVariableObject.h: Changed registerArray to OwnArrayPtr. Also, added private copy
2190 constructor and operator= to ensure that no one attempts to copy this object (for whatever
2191 reason, I couldn't make Noncopyable work).
2193 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::addStaticGlobals): Allocate registerArray
2196 * kjs/JSVariableObject.cpp:
2197 (KJS::JSVariableObject::copyRegisterArray): Allocate registerArray with new[].
2198 (KJS::JSVariableObject::setRegisterArray): Avoid hitting an assertion in OwnArrayPtr when
2199 "changing" the value from 0 to 0.
2201 2008-07-01 Geoffrey Garen <ggaren@apple.com>
2203 Reviewed by Oliver Hunt.
2205 Removed and/or reordered exception checks in array-style a[n] access.
2207 SunSpider says 1.4% faster.
2210 (KJS::Machine::privateExecute): No need to check for exceptions before
2211 calling toString, toNumber and/or get. If the call ends up being observable
2212 through toString, valueOf, or a getter, we short-circuit it there, instead.
2213 In the op_del_by_val case, I removed the incorrect comment without actually
2214 removing the code, since I didn't want to tempt the GCC fates!
2217 (KJS::callDefaultValueFunction): Added exception check to prevent
2218 toString and valueOf functions from observing execution after an exception
2219 has been thrown. This removes some of the burden of exception checking
2222 (KJS::JSObject::defaultValue): Removed redundant exception check here.
2224 * kjs/PropertySlot.cpp:
2225 (KJS::PropertySlot::functionGetter): Added exception check to prevent
2226 getter functions from observing execution after an exception has been
2227 thrown. This removes some of the burden of exception checking from the
2230 2008-07-01 Geoffrey Garen <ggaren@apple.com>
2232 Reviewed by Oliver Hunt.
2234 Optimized a[n] get and put for cases where n is an immediate unsigned
2237 SunSpider says 3.5% faster.
2239 2008-07-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2243 Bug 19844: JavaScript Switch statement modifies "this"
2244 <https://bugs.webkit.org/show_bug.cgi?id=19844>
2246 Use a temporary when generating code for switch clauses to avoid
2247 overwriting 'this' or a local variable.
2250 (KJS::CaseBlockNode::emitCodeForBlock):
2252 2008-07-01 Christian Dywan <christian@twotoasts.de>
2256 * kjs/list.cpp: Include "JSCell.h"
2258 2008-07-01 Kevin McCullough <kmccullough@apple.com>
2262 * JavaScriptCore.xcodeproj/project.pbxproj:
2264 2008-07-01 Dan Bernstein <mitz@apple.com>
2266 Reviewed by Anders Carlsson.
2268 - Mac release build fix
2270 * JavaScriptCore.exp:
2272 2008-07-01 Sam Weinig <sam@webkit.org>
2274 Try and fix mac builds.
2276 * JavaScriptCore.exp:
2278 2008-07-01 Sam Weinig <sam@webkit.org>
2280 Fix non-AllInOne builds.
2284 2008-07-01 Sam Weinig <sam@webkit.org>
2286 Reviewed by Darin Adler.
2288 Split JSCell and JSNumberCell class declarations out of JSValue.h
2291 * JavaScriptCore.pri:
2292 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2293 * JavaScriptCore.xcodeproj/project.pbxproj:
2294 * JavaScriptCoreSources.bkl:
2295 * VM/JSPropertyNameIterator.h:
2296 * kjs/AllInOneFile.cpp:
2297 * kjs/JSCell.cpp: Copied from JavaScriptCore/kjs/JSValue.cpp.
2298 * kjs/JSCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
2299 (KJS::JSValue::getJSNumber):
2300 * kjs/JSNumberCell.cpp:
2301 * kjs/JSNumberCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
2305 (KJS::jsOwnedString):
2307 (KJS::JSValue::toThisJSString):
2311 2008-07-01 Anders Carlsson <andersca@apple.com>
2315 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2316 * kjs/JSGlobalObject.h:
2317 (KJS::JSGlobalObject::addStaticGlobals):
2319 2008-07-01 Simon Hausmann <hausmann@webkit.org>
2321 Build fix, include OwnPtr.h.
2323 * kjs/RegExpConstructor.h:
2325 2008-06-30 Geoffrey Garen <ggaren@apple.com>
2327 Reviewed by Oliver Hunt.
2329 Fixed a global object leak caused by the switch to one register file.
2331 Don't unconditionally mark the register file, since that logically
2332 makes all global variables GC roots, even when their global object is
2333 no longer reachable.
2335 Instead, make the global object associated with the register file
2336 responsible for marking the register file.
2338 2008-06-30 Geoffrey Garen <ggaren@apple.com>
2340 Reviewed by Oliver Hunt.
2342 Removed the "registerBase" abstraction. Since the register file never
2343 reallocates, we can keep direct pointers into it, instead of
2344 <registerBase, offset> tuples.
2346 SunSpider says 0.8% faster.
2348 2008-06-30 Oliver Hunt <oliver@apple.com>
2350 Reviewed by NOBODY (build fix).
2352 Fix build by adding all (hopefully) the missing includes.
2354 * kjs/BooleanPrototype.cpp:
2355 * kjs/DateConstructor.cpp:
2356 * kjs/ErrorPrototype.cpp:
2357 * kjs/FunctionPrototype.cpp:
2358 * kjs/NativeErrorConstructor.cpp:
2359 * kjs/NumberPrototype.cpp:
2360 * kjs/ObjectPrototype.cpp:
2361 * kjs/RegExpConstructor.cpp:
2362 * kjs/StringConstructor.cpp:
2363 * kjs/StringPrototype.cpp:
2365 2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2369 Bug 19830: REGRESSION (r34883): Google Reader doesn't show up feed list on sidebar
2370 <https://bugs.webkit.org/show_bug.cgi?id=19830>
2372 Ensure that we do not eliminate a write to a local register when doing
2373 peephole optimizations.
2375 * VM/CodeGenerator.cpp:
2376 (KJS::CodeGenerator::emitJumpIfTrue):
2377 (KJS::CodeGenerator::emitJumpIfFalse):
2379 2008-06-30 Sam Weinig <sam@webkit.org>
2381 Rubber-stamped by Darin Alder.
2383 Split InternalFunction into its own header file.
2385 * API/JSCallbackFunction.h:
2386 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2387 * JavaScriptCore.xcodeproj/project.pbxproj:
2388 * kjs/ArrayConstructor.h:
2389 * kjs/BooleanConstructor.h:
2390 * kjs/DateConstructor.h:
2391 * kjs/ErrorConstructor.h:
2392 * kjs/FunctionConstructor.h:
2393 * kjs/FunctionPrototype.h:
2394 * kjs/InternalFunction.h: Copied from kjs/JSFunction.h.
2396 * kjs/NativeErrorConstructor.h:
2397 * kjs/NumberConstructor.h:
2398 * kjs/ObjectConstructor.h:
2399 * kjs/RegExpConstructor.h:
2400 * kjs/StringConstructor.h:
2401 * profiler/Profiler.cpp:
2403 2008-06-30 Sam Weinig <sam@webkit.org>
2405 Reviewed by Kevin McCullough.
2407 Remove empty files Instruction.cpp, LabelID.cpp, Register.cpp and RegisterID.cpp.
2410 * JavaScriptCore.pri:
2411 * JavaScriptCore.xcodeproj/project.pbxproj:
2412 * JavaScriptCoreSources.bkl:
2413 * VM/Instruction.cpp: Removed.
2414 * VM/LabelID.cpp: Removed.
2415 * VM/Register.cpp: Removed.
2416 * VM/RegisterID.cpp: Removed.
2418 2008-06-30 Sam Weinig <sam@webkit.org>
2420 Rubber-stamped (reluctantly) by Kevin McCullough.
2422 Rename date_object.h/cpp to DateInstance.h/cpp
2425 * JavaScriptCore.pri:
2426 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2427 * JavaScriptCore.xcodeproj/project.pbxproj:
2428 * JavaScriptCoreSources.bkl:
2429 * kjs/AllInOneFile.cpp:
2430 * kjs/DateConstructor.cpp:
2431 * kjs/DateInstance.cpp: Copied from kjs/date_object.cpp.
2432 * kjs/DateInstance.h: Copied from kjs/date_object.h.
2433 * kjs/DatePrototype.cpp:
2434 * kjs/DatePrototype.h:
2435 * kjs/date_object.cpp: Removed.
2436 * kjs/date_object.h: Removed.
2438 2008-06-30 Sam Weinig <sam@webkit.org>
2440 Rubber-stamped by Darin Adler.
2442 Remove internal.cpp and move its contents to there own .cpp files.
2445 * JavaScriptCore.pri:
2446 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2447 * JavaScriptCore.xcodeproj/project.pbxproj:
2448 * JavaScriptCoreSources.bkl:
2449 * kjs/AllInOneFile.cpp:
2450 * kjs/GetterSetter.cpp: Copied from kjs/internal.cpp.
2451 * kjs/InternalFunction.cpp: Copied from kjs/internal.cpp.
2452 * kjs/JSNumberCell.cpp: Copied from kjs/internal.cpp.
2453 * kjs/JSString.cpp: Copied from kjs/internal.cpp.
2455 * kjs/LabelStack.cpp: Copied from kjs/internal.cpp.
2456 * kjs/NumberConstructor.cpp:
2457 * kjs/NumberObject.cpp:
2458 (KJS::constructNumber):
2459 (KJS::constructNumberFromImmediateNumber):
2460 * kjs/internal.cpp: Removed.
2462 2008-06-30 Adam Roben <aroben@apple.com>
2464 Fix <rdar://5954749> Assertion failure due to HashTable's use of
2467 HashTable was passing &value to constructDeletedValue, which in
2468 classes like WebCore::COMPtr would cause an assertion. We now pass
2469 value by reference instead of by address so that the HashTraits
2470 implementations have more flexibility in constructing the deleted
2473 Reviewed by Ada Chan.
2475 * VM/CodeGenerator.h: Updated for changes to HashTraits.
2477 (WTF::::deleteBucket): Changed to pass bucket by reference instead of
2479 (WTF::::checkKey): Ditto.
2481 (WTF::): Updated HashTraits for HashTable change.
2483 2008-07-01 Alexey Proskuryakov <ap@webkit.org>
2485 Reviewed by Cameron Zwarich.
2487 Make RegisterFile really unmap memory on destruction.
2489 This fixes run-webkit-tests --threaded, which ran out of address space in a few seconds.
2491 * VM/RegisterFile.cpp: (KJS::RegisterFile::~RegisterFile): Unmap all the memory, not just
2494 * kjs/JSGlobalObject.h: Don't include RegisterFile.h, so that changes to it don't make
2495 half of WebCore rebuild.
2497 * VM/Machine.h: Don't forward declare RegisterFile, as RegisterFile.h is included already.
2499 * VM/RegisterFile.h: (KJS::RegisterFile::RegisterFile): Assert that the allocation succeeded.
2501 2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2503 Rubber-stamped by Oliver.
2505 Correct the documentation for op_put_by_index.
2508 (KJS::Machine::privateExecute):
2510 2008-06-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2514 Bug 19821: Merge the instruction pair (less, jfalse)
2515 <https://bugs.webkit.org/show_bug.cgi?id=19821>
2517 This is a 2.4% win on SunSpider. I needed to add an ALWAYS_INLINE
2518 intrinisc to CodeGenerator::rewindBinaryOp() to avoid a massive
2519 regression in regexp-dna.
2522 (KJS::CodeBlock::dump):
2523 * VM/CodeGenerator.cpp:
2524 (KJS::CodeGenerator::rewindBinaryOp):
2525 (KJS::CodeGenerator::emitJumpIfFalse):
2527 (KJS::Machine::privateExecute):
2532 2008-06-29 Sam Weinig <sam@webkit.org>
2534 Fix non-AllInOne builds.
2539 2008-06-29 Sam Weinig <sam@webkit.org>
2544 * kjs/DatePrototype.cpp:
2546 2008-06-29 Sam Weinig <sam@webkit.org>
2548 Rubber-stamped by Cameron Zwarich.
2550 Splits ErrorConstructor, ErrorPrototype, NativeErrorConstructor and
2551 NativeErrorPrototype out of error_object.h/cpp and renames it ErrorInstance.
2554 * JavaScriptCore.pri:
2555 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2556 * JavaScriptCore.xcodeproj/project.pbxproj:
2557 * JavaScriptCoreSources.bkl:
2558 * kjs/AllInOneFile.cpp:
2559 * kjs/ArrayConstructor.cpp:
2560 * kjs/ArrayPrototype.cpp:
2561 * kjs/BooleanPrototype.cpp:
2562 * kjs/DatePrototype.cpp:
2563 * kjs/ErrorConstructor.cpp: Copied from kjs/error_object.cpp.
2564 * kjs/ErrorConstructor.h: Copied from kjs/error_object.h.
2565 * kjs/ErrorInstance.cpp: Copied from kjs/error_object.cpp.
2566 * kjs/ErrorInstance.h: Copied from kjs/error_object.h.
2567 * kjs/ErrorPrototype.cpp: Copied from kjs/error_object.cpp.
2568 * kjs/ErrorPrototype.h: Copied from kjs/error_object.h.
2569 * kjs/JSGlobalObject.cpp:
2572 * kjs/NativeErrorConstructor.cpp: Copied from kjs/error_object.cpp.
2573 * kjs/NativeErrorConstructor.h: Copied from kjs/error_object.h.
2574 * kjs/NativeErrorPrototype.cpp: Copied from kjs/error_object.cpp.
2575 * kjs/NativeErrorPrototype.h: Copied from kjs/error_object.h.
2576 * kjs/NumberPrototype.cpp:
2577 * kjs/RegExpConstructor.cpp:
2578 * kjs/RegExpObject.cpp:
2579 * kjs/RegExpPrototype.cpp:
2580 * kjs/StringPrototype.cpp:
2581 * kjs/error_object.cpp: Removed.
2582 * kjs/error_object.h: Removed.
2585 2008-06-29 Sam Weinig <sam@webkit.org>
2587 Fix non-AllInOne build.
2589 * kjs/DateConstructor.cpp:
2593 2008-06-29 Sam Weinig <sam@webkit.org>
2595 Rubber-stamped by Oliver Hunt.
2597 Splits DateConstructor and DatePrototype out of date_object.h/cpp
2598 Moves shared Date code into DateMath.
2600 * DerivedSources.make:
2602 * JavaScriptCore.pri:
2603 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2604 * JavaScriptCore.xcodeproj/project.pbxproj:
2605 * JavaScriptCoreSources.bkl:
2606 * kjs/AllInOneFile.cpp:
2607 * kjs/DateConstructor.cpp: Copied from kjs/date_object.cpp.
2608 * kjs/DateConstructor.h: Copied from kjs/date_object.h.
2610 (KJS::ymdhmsToSeconds):
2612 (KJS::skipSpacesAndComments):
2617 (KJS::formatDateUTCVariant):
2621 * kjs/DatePrototype.cpp: Copied from kjs/date_object.cpp.
2622 * kjs/DatePrototype.h: Copied from kjs/date_object.h.
2623 * kjs/JSGlobalObject.cpp:
2625 * kjs/date_object.cpp:
2626 * kjs/date_object.h:
2629 2008-06-29 Jan Michael Alonzo <jmalonzo@webkit.org>
2631 Rubber-stamped by Cameron Zwarich
2633 Fix Gtk non-AllInOne build
2635 * GNUmakefile.am: include JSVariableObject.cpp
2636 * kjs/RegExpConstructor.cpp: include RegExpObject.h
2637 * kjs/RegExpObject.h: forward declare RegExpPrototype
2639 2008-06-28 Darin Adler <darin@apple.com>
2641 Reviewed by Sam and Cameron.
2643 - fix https://bugs.webkit.org/show_bug.cgi?id=19805
2644 Array.concat turns missing array elements into "undefined"
2646 Test: fast/js/array-holes.html
2648 * JavaScriptCore.exp: No longer export JSArray::getItem.
2650 * kjs/ArrayPrototype.cpp:
2651 (KJS::arrayProtoFuncConcat): Changed to use getProperty instead of
2652 JSArray::getItem -- need to handle properties from the prototype chain
2653 instead of ignoring them.
2655 * kjs/JSArray.cpp: Removed getItem.
2656 * kjs/JSArray.h: Ditto.
2658 2008-06-28 Darin Adler <darin@apple.com>
2660 Reviewed by Cameron.
2662 - https://bugs.webkit.org/show_bug.cgi?id=19804
2663 optimize access to arrays without "holes"
2665 SunSpider says 1.8% faster.
2668 (KJS::JSArray::JSArray): Initialize m_fastAccessCutoff when creating
2669 arrays. Also updated for new location of m_vectorLength.
2670 (KJS::JSArray::getItem): Updated for new location of m_vectorLength.
2671 (KJS::JSArray::getSlowCase): Added. Broke out the non-hot parts of
2672 getOwnPropertySlot to make the hot part faster.
2673 (KJS::JSArray::getOwnPropertySlot): Added a new faster case for
2674 indices lower than m_fastAccessCutoff. We can do theese with no
2675 additional checks or branches.
2676 (KJS::JSArray::put): Added a new faster case for indices lower than
2677 m_fastAccessCutoff. We can do theese with no additional checks or
2678 branches. Moved the maxArrayIndex handling out of this function.
2679 Added code to set m_fastAccessCutoff when the very last hole in
2680 an array is filled; this is how the cutoff gets set for most arrays.
2681 (KJS::JSArray::putSlowCase): Moved the rest of the put function logic
2682 in here, to make the hot part of the put function faster.
2683 (KJS::JSArray::deleteProperty): Added code to lower m_fastAccessCutoff
2684 when a delete makes a new hole in the array.
2685 (KJS::JSArray::getPropertyNames): Updated for new location of
2687 (KJS::JSArray::increaseVectorLength): Ditto.
2688 (KJS::JSArray::setLength): Added code to lower m_fastAccessCutoff
2689 when setLength makes the array smaller.
2690 (KJS::JSArray::mark): Updated for new location of m_vectorLength.
2691 (KJS::JSArray::sort): Ditto. Set m_fastAccessCutoff after moving
2692 all the holes to the end of the array.
2693 (KJS::JSArray::compactForSorting): Ditto.
2694 (KJS::JSArray::checkConsistency): Added consistency checks fro
2695 m_fastAccessCutoff and updated for the new location of m_vectorLength.
2697 * kjs/JSArray.h: Added declarations for slow case functions.
2698 Replaced m_vectorLength with m_fastAccessCutoff.
2700 2008-06-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2704 When executing a native call, check for an exception before writing the
2708 (KJS::Machine::privateExecute):
2710 2008-06-28 Mark Rowe <mrowe@apple.com>
2712 Build fix. Flag headers as private or public as is appropriate.
2713 These settings were accidentally removed during some project file cleanup.
2715 * JavaScriptCore.xcodeproj/project.pbxproj:
2717 2008-06-28 Sam Weinig <sam@webkit.org>
2719 Rubber-stamped by Darin Adler.
2721 Splits RegExpConstructor and RegExpPrototype out of RegExpObject.h/cpp
2723 * DerivedSources.make:
2725 * JavaScriptCore.pri:
2726 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2727 * JavaScriptCore.xcodeproj/project.pbxproj:
2728 * JavaScriptCoreSources.bkl:
2730 * kjs/AllInOneFile.cpp:
2731 * kjs/JSGlobalObject.cpp:
2732 * kjs/RegExpConstructor.cpp: Copied from kjs/RegExpObject.cpp.
2733 * kjs/RegExpConstructor.h: Copied from kjs/RegExpObject.h.
2734 * kjs/RegExpObject.cpp:
2735 * kjs/RegExpObject.h:
2736 * kjs/RegExpPrototype.cpp: Copied from kjs/RegExpObject.cpp.
2737 * kjs/RegExpPrototype.h: Copied from kjs/RegExpObject.h.
2738 * kjs/StringPrototype.cpp:
2741 2008-06-28 Sam Weinig <sam@webkit.org>
2743 Fix non-AllInOne builds.
2745 * kjs/StringConstructor.cpp:
2747 2008-06-28 Sam Weinig <sam@webkit.org>
2749 Rubber-stamped by Darin Adler.
2751 Rename string_object.h/cpp to StringObject.h/cpp and split out StringObjectThatMasqueradesAsUndefined,
2752 StringConstructor and StringPrototype.
2754 * DerivedSources.make:
2756 * JavaScriptCore.pri:
2757 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2758 * JavaScriptCore.xcodeproj/project.pbxproj:
2759 * JavaScriptCoreSources.bkl:
2760 * kjs/AllInOneFile.cpp:
2761 * kjs/JSGlobalObject.cpp:
2762 * kjs/StringConstructor.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
2763 * kjs/StringConstructor.h: Copied from JavaScriptCore/kjs/string_object.h.
2764 * kjs/StringObject.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
2765 * kjs/StringObject.h: Copied from JavaScriptCore/kjs/string_object.h.
2766 * kjs/StringObjectThatMasqueradesAsUndefined.h: Copied from JavaScriptCore/kjs/string_object.h.
2767 * kjs/StringPrototype.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
2768 * kjs/StringPrototype.h: Copied from JavaScriptCore/kjs/string_object.h.
2770 * kjs/string_object.cpp: Removed.
2771 * kjs/string_object.h: Removed.
2773 2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
2775 Gtk build fix: JSVariableObject is now part of AllInOne
2779 2008-06-28 Darin Adler <darin@apple.com>
2783 - https://bugs.webkit.org/show_bug.cgi?id=19801
2784 add a feature so we can tell what regular expressions are taking time
2786 * pcre/pcre_compile.cpp:
2787 (jsRegExpCompile): Compile in the string if REGEXP_HISTOGRAM is on.
2789 * pcre/pcre_exec.cpp:
2790 (jsRegExpExecute): Add hook to time execution.
2791 (Histogram::~Histogram): Print a sorted list of what took time.
2792 (Histogram::add): Accumulate records of what took time.
2793 (HistogramTimeLogger::~HistogramTimeLogger): Hook that calls
2794 Histogram::add at the right moment and creates the global histogram
2797 * pcre/pcre_internal.h: Define REGEXP_HISTOGRAM.
2799 * pcre/pcre_tables.cpp: Added missing include of "config.h". Not needed
2800 any more, but an omissions an earlier version of this patch detected.
2801 * pcre/pcre_ucp_searchfuncs.cpp: Ditto.
2802 * pcre/pcre_xclass.cpp: Ditto.
2804 2008-06-28 Sam Weinig <sam@webkit.org>
2806 Try and fix the Windows build again.
2808 * kjs/RegExpObject.cpp:
2809 * kjs/date_object.cpp:
2810 * kjs/error_object.cpp:
2812 2008-06-28 Sam Weinig <sam@webkit.org>
2814 Rubber-stamped by Darin Adler.
2816 Remove unused StringConstructorFunction class.
2818 * kjs/string_object.h:
2820 2008-06-28 Sam Weinig <sam@webkit.org>
2824 * kjs/ArrayPrototype.cpp:
2825 * kjs/BooleanPrototype.cpp:
2826 * kjs/BooleanPrototype.h:
2827 * kjs/FunctionPrototype.cpp:
2828 * kjs/JSImmediate.cpp:
2830 * kjs/MathObject.cpp:
2831 * kjs/NumberPrototype.cpp:
2832 * kjs/NumberPrototype.h:
2833 * kjs/ObjectConstructor.cpp:
2834 * kjs/RegExpObject.h:
2835 * kjs/error_object.h:
2836 * kjs/string_object.cpp:
2838 2008-06-28 Sam Weinig <sam@webkit.org>
2840 Rubber-stamped by Oliver Hunt.
2842 Splits FunctionConstructor out of FunctionPrototype.h/cpp
2843 Splits NumberConstructor and NumberPrototype out of NumberObject.h/cpp
2844 Rename object_object.h/cpp to ObjectPrototype.h/cpp and split out ObjectConstructor.
2846 * API/JSCallbackConstructor.cpp:
2847 * API/JSClassRef.cpp:
2848 * API/JSObjectRef.cpp:
2849 * DerivedSources.make:
2851 * JavaScriptCore.pri:
2852 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2853 * JavaScriptCore.xcodeproj/project.pbxproj:
2854 * JavaScriptCoreSources.bkl:
2856 * kjs/AllInOneFile.cpp:
2857 * kjs/ArrayConstructor.cpp:
2858 * kjs/ArrayConstructor.h:
2859 * kjs/FunctionConstructor.cpp: Copied from JavaScriptCore/kjs/FunctionPrototype.cpp.
2860 * kjs/FunctionConstructor.h: Copied from JavaScriptCore/kjs/FunctionPrototype.h.
2861 * kjs/FunctionPrototype.cpp:
2862 * kjs/FunctionPrototype.h:
2863 * kjs/JSFunction.cpp:
2864 * kjs/JSGlobalObject.cpp:
2865 * kjs/JSImmediate.cpp:
2867 * kjs/NumberConstructor.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
2868 * kjs/NumberConstructor.h: Copied from JavaScriptCore/kjs/NumberObject.h.
2869 * kjs/NumberObject.cpp:
2870 * kjs/NumberObject.h:
2871 * kjs/NumberPrototype.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
2872 * kjs/NumberPrototype.h: Copied from JavaScriptCore/kjs/NumberObject.h.
2873 * kjs/ObjectConstructor.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
2874 * kjs/ObjectConstructor.h: Copied from JavaScriptCore/kjs/object_object.h.
2875 * kjs/ObjectPrototype.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
2876 * kjs/ObjectPrototype.h: Copied from JavaScriptCore/kjs/object_object.h.
2877 * kjs/RegExpObject.h:
2879 * kjs/error_object.h:
2882 * kjs/object_object.cpp: Removed.
2883 * kjs/object_object.h: Removed.
2884 * kjs/string_object.h:
2886 2008-06-28 Darin Adler <darin@apple.com>
2890 - fix https://bugs.webkit.org/show_bug.cgi?id=19796
2891 optimize expressions with ignored results (especially post-increment)
2893 SunSpider says 0.9% faster.
2895 * VM/CodeGenerator.h:
2896 (KJS::CodeGenerator::tempDestination): Create a new temporary for
2897 ignoredResult() too, just as we would for 0.
2898 (KJS::CodeGenerator::finalDestination): Use the temporary if the
2899 register passed in is ignoredResult() too, just as we would for 0.
2900 (KJS::CodeGenerator::destinationForAssignResult): Return 0 if the
2901 passed in register is ignoredResult(), just as we would for 0.
2902 (KJS::CodeGenerator::moveToDestinationIfNeeded): Return 0 if the
2903 register passed in is ignoredResult(). What matters is that we
2904 don't want to emit a move. The return value won't be looked at.
2905 (KJS::CodeGenerator::emitNode): Allow ignoredResult() and pass it
2906 through to the node's emitCode function.
2909 (KJS::ignoredResult): Added. Special value to indicate the result of
2910 a node will be ignored and need not be put in any register.
2913 (KJS::NullNode::emitCode): Do nothing if dst == ignoredResult().
2914 (KJS::BooleanNode::emitCode): Ditto.
2915 (KJS::NumberNode::emitCode): Ditto.
2916 (KJS::StringNode::emitCode): Ditto.
2917 (KJS::RegExpNode::emitCode): Ditto.
2918 (KJS::ThisNode::emitCode): Ditto.
2919 (KJS::ResolveNode::emitCode): Do nothing if dst == ignoredResult() and
2920 the identifier resolves to a local variable.
2921 (KJS::ObjectLiteralNode::emitCode): Do nothing if dst == ignoredResult()
2922 and the object is empty.
2923 (KJS::PostIncResolveNode::emitCode): If dst == ignoredResult(), then do
2924 nothing for the local constant case, and do a pre-increment in all the
2926 (KJS::PostDecResolveNode::emitCode): Ditto.
2927 (KJS::PostIncBracketNode::emitCode): Ditto.
2928 (KJS::PostDecBracketNode::emitCode): Ditto.
2929 (KJS::PostIncDotNode::emitCode): Ditto.
2930 (KJS::PostDecDotNode::emitCode): Ditto.
2931 (KJS::DeleteValueNode::emitCode): Pass ignoredResult() when evaluating
2933 (KJS::VoidNode::emitCode): Ditto.
2934 (KJS::TypeOfResolveNode::emitCode): If dst == ignoredResult(), do nothing
2935 if the identifier resolves to a local variable, and don't bother generating
2936 a typeof opcode in the other case.
2937 (KJS::TypeOfValueNode::emitCode): Ditto.
2938 (KJS::PreIncResolveNode::emitCode): Do nothing if dst == ignoredResult() and
2939 the identifier resolves to a local constant.
2940 (KJS::PreDecResolveNode::emitCode): Ditto.
2941 (KJS::AssignResolveNode::emitCode): Turn ignoredResult() into 0 in a couple
2942 places, because we need to put the result into a register so we can assign
2943 it. At other sites this is taken care of by functions like finalDestination.
2944 (KJS::CommaNode::emitCode): Pass ignoredResult() when evaluating the first
2946 (KJS::ForNode::emitCode): Pass ignoredResult() when evaluating the first and
2948 (KJS::ForInNode::emitCode): Pass ignoredResult() when evaluating the first
2951 2008-06-28 Darin Adler <darin@apple.com>
2955 - https://bugs.webkit.org/show_bug.cgi?id=19787
2956 create most arrays from values in registers rather than with multiple put operations
2958 SunSpider says 0.8% faster.
2961 (KJS::CodeBlock::dump): Added argv and argc parameters to new_array.
2963 (KJS::Machine::privateExecute): Ditto.
2965 * VM/CodeGenerator.cpp:
2966 (KJS::CodeGenerator::emitNewArray): Added.
2967 * VM/CodeGenerator.h: Added ElementNode* argument to emitNewArray.
2970 (KJS::ArrayNode::emitCode): Pass the ElementNode to emitNewArray so it can be
2971 initialized with as many elements as possible. If the array doesn't have any
2972 holes in it, that's all that's needed. If there are holes, then emit some separate
2973 put operations for the other values in the array and for the length as needed.
2975 * kjs/nodes.h: Added some accessors to ElementNode so the code generator can
2976 iterate through elements and generate code to evaluate them. Now ArrayNode does
2977 not need to be a friend. Also took out some unused PlacementNewAdoptType
2980 2008-06-28 Darin Adler <darin@apple.com>
2984 * kjs/nodes.h: Remove obsolete PlacementNewAdopt constructors.
2985 We no longer mutate the AST in place.
2987 2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
2989 Reviewed by Oliver Hunt.
2993 * VM/Machine.cpp: include stdio.h for printf
2995 2008-06-27 Sam Weinig <sam@webkit.org>
2997 Reviewed by Oliver Hunt.
2999 Fix platforms that don't use AllInOne.cpp
3001 * kjs/BooleanConstructor.h:
3002 * kjs/BooleanPrototype.h:
3003 * kjs/FunctionPrototype.cpp:
3005 2008-06-27 Sam Weinig <sam@webkit.org>
3007 Rubber-stamped by Oliver Hunt.
3009 Splits ArrayConstructor out of ArrayPrototype.h/cpp
3010 Splits BooleanConstructor and BooleanPrototype out of BooleanObject.h/cpp
3013 * JavaScriptCore.pri:
3014 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3015 * JavaScriptCore.xcodeproj/project.pbxproj:
3016 * JavaScriptCoreSources.bkl:
3018 * kjs/AllInOneFile.cpp:
3019 * kjs/ArrayConstructor.cpp: Copied from kjs/ArrayPrototype.cpp.
3020 * kjs/ArrayConstructor.h: Copied from kjs/ArrayPrototype.h.
3021 * kjs/ArrayPrototype.cpp:
3022 * kjs/ArrayPrototype.h:
3023 * kjs/BooleanConstructor.cpp: Copied from kjs/BooleanObject.cpp.
3024 * kjs/BooleanConstructor.h: Copied from kjs/BooleanObject.h.
3025 * kjs/BooleanObject.cpp:
3026 * kjs/BooleanObject.h:
3027 * kjs/BooleanPrototype.cpp: Copied from kjs/BooleanObject.cpp.
3028 * kjs/BooleanPrototype.h: Copied from kjs/BooleanObject.h.
3029 * kjs/CommonIdentifiers.h:
3030 * kjs/FunctionPrototype.cpp:
3032 * kjs/JSGlobalObject.cpp:
3033 * kjs/JSImmediate.cpp:
3037 * kjs/string_object.cpp:
3039 2008-06-27 Oliver Hunt <oliver@apple.com>
3043 Bug 18626: SQUIRRELFISH: support the "slow script" dialog <https://bugs.webkit.org/show_bug.cgi?id=18626>
3044 <rdar://problem/5973931> Slow script dialog needs to be reimplemented for squirrelfish
3046 Adds support for the slow script dialog in squirrelfish. This requires the addition
3047 of three new op codes, op_loop, op_loop_if_true, and op_loop_if_less which have the
3048 same behaviour as their simple jump equivalents but have an additional time out check.
3050 Additional assertions were added to other jump instructions to prevent accidentally
3051 creating loops with jump types that do not support time out checks.
3053 Sunspider does not report a regression, however this appears very sensitive to code
3054 layout and hardware, so i would expect up to a 1% regression on other systems.
3056 Part of this required moving the old timeout logic from JSGlobalObject and into Machine
3057 which is the cause of a number of the larger diff blocks.
3059 * JavaScriptCore.exp:
3061 (KJS::CodeBlock::dump):
3062 * VM/CodeGenerator.cpp:
3063 (KJS::CodeGenerator::emitJumpIfTrue):
3064 (KJS::CodeGenerator::emitJumpScopes):
3065 * VM/ExceptionHelpers.cpp:
3066 (KJS::InterruptedExecutionError::isWatchdogException):
3067 (KJS::createInterruptedExecutionException):
3068 * VM/ExceptionHelpers.h:
3071 (KJS::Machine::Machine):
3072 (KJS::Machine::throwException):
3073 (KJS::Machine::resetTimeoutCheck):
3074 (KJS::getCurrentTime):
3075 (KJS::Machine::checkTimeout):
3076 (KJS::Machine::privateExecute):
3078 (KJS::Machine::setTimeoutTime):
3079 (KJS::Machine::startTimeoutCheck):
3080 (KJS::Machine::stopTimeoutCheck):
3081 (KJS::Machine::initTimeout):
3085 * kjs/JSGlobalObject.cpp:
3086 (KJS::JSGlobalObject::init):
3087 (KJS::JSGlobalObject::setTimeoutTime):
3088 (KJS::JSGlobalObject::startTimeoutCheck):
3089 * kjs/JSGlobalObject.h:
3091 * kjs/interpreter.cpp:
3092 (KJS::Interpreter::evaluate):
3094 2008-06-27 Jan Michael Alonzo <jmalonzo@webkit.org>
3096 Gtk and Qt build fix: Remove RegisterFileStack from the build
3100 * JavaScriptCore.pri:
3102 2008-06-27 Adele Peterson <adele@apple.com>
3108 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3109 * VM/RegisterFile.h:
3110 (KJS::RegisterFile::RegisterFile):
3111 * kjs/JSGlobalObject.cpp:
3112 * kjs/collector.cpp:
3114 2008-06-27 Geoffrey Garen <ggaren@apple.com>
3116 Reviewed by Oliver Hunt.
3118 One RegisterFile to rule them all!
3120 SunSpider reports a 0.2% speedup.
3122 This patch removes the RegisterFileStack abstraction and replaces it with
3123 a single register file that
3125 (a) allocates a fixed storage area, including a fixed area for global
3126 vars, so that no operation may cause the register file to reallocate
3130 (b) swaps between global storage areas when executing code in different
3133 This patch also changes the layout of the register file so that all call
3134 frames, including call frames for global code, get a header. This is
3135 required to support re-entrant global code. It also just makes things simpler.
3137 * VM/CodeGenerator.cpp:
3138 (KJS::CodeGenerator::addGlobalVar): New function. Differs from addVar in
3141 (a) global vars don't contribute to a CodeBlock's numLocals count, since
3142 global storage is fixed and allocated at startup
3146 (b) references to global vars get shifted to elide intermediate stack
3147 between "r" and the global storage area.
3150 (KJS::Machine::dumpRegisters): Updated this function to match the new
3151 register file layout, and added the ability to dump exact identifiers
3152 for the different parts of a call frame.
3154 (KJS::Machine::unwindCallFrame): Updated this function to match the new
3155 register file layout.
3157 (KJS::Machine::execute): Updated this function to initialize a call frame
3158 header for global code, and to swap global storage areas when switching
3159 to execution in a new global object.
3161 (KJS::Machine::privateExecute): Got rid of "safeForReentry" and re-reading
3162 of registerBase because the register file is always safe for reentry now,
3163 and registerBase never changes.
3165 * VM/Machine.h: Moved the call frame header enum from Machine to RegisterFile,
3166 to resolve a header dependency problem (a good sign that the enum belonged
3167 in RegisterFile all along!)
3169 * VM/RegisterFile.cpp:
3170 * VM/RegisterFile.h: Changed RegisterFile to mmap a fixed size register
3171 area. This allows us to avoid re-allocting the register file later on.
3172 Instead, we rely on the OS to allocate physical pages to the register
3175 * VM/RegisterFileStack.cpp: Removed. Tada!
3176 * VM/RegisterFileStack.h: Removed. Tada!
3178 * kjs/DebuggerCallFrame.cpp: Updated this class to match the new
3179 register file layout, greatly simplifying it in the process.
3181 * kjs/JSActivation.h:
3182 * kjs/JSActivation.cpp: Moved some of this logic up to JSVariableObject,
3183 since the global object now needs to be able to tear off its registers
3184 just like the activation object.
3186 * kjs/JSFunction.cpp: No need to fiddle with the register file anymore.
3188 * kjs/JSGlobalObject.h:
3189 * kjs/JSGlobalObject.cpp: Updated JSGlobalObject to support moving its
3190 global storage area into and out of the register file.
3192 * kjs/PropertySlot.cpp: No need to fiddle with the register file anymore.
3194 * kjs/collector.cpp: Renamed markStackObjectConservatively to
3195 markConservatively, since we don't just mark stack objects this way.
3197 Also, added code to mark the machine's register file.
3199 * kjs/config.h: Moved some platforms #defines from here...
3200 * wtf/Platform.h: ...to here, to support mmap/VirtualAlloc detection
3203 2008-06-26 Mark Rowe <mrowe@apple.com>
3205 Speculative fix for the Windows build.
3207 * kjs/JSImmediate.cpp:
3209 2008-06-26 Mark Rowe <mrowe@apple.com>
3211 Reviewed by Darin Adler and Geoff Garen.
3213 Fix the malloc zone introspection functions so that malloc_zone_statistics does not give
3214 bogus output in an application that uses JavaScriptCore.
3216 * kjs/CollectorHeapIntrospector.cpp:
3217 (KJS::CollectorHeapIntrospector::statistics): Return statistics about memory allocated by the collector.
3218 * kjs/CollectorHeapIntrospector.h:
3219 * wtf/FastMalloc.cpp: Zero out the statistics. FastMalloc doesn't track this information at present.
3220 Returning zero for all values is preferable to returning bogus data.
3222 2008-06-26 Darin Adler <darin@apple.com>
3226 - https://bugs.webkit.org/show_bug.cgi?id=19721
3227 speed up JavaScriptCore by not wrapping strings in objects just
3228 to call functions on them
3230 - optimize UString append and the replace function a bit
3232 SunSpider says 1.8% faster.
3234 * JavaScriptCore.exp: Updated.
3236 * VM/JSPropertyNameIterator.cpp: Added include of JSString.h, now needed
3237 because jsString returns a JSString*.
3240 (KJS::Machine::privateExecute): Removed the toObject call from native
3241 function calls. Also removed code to put the this value into a register.
3243 * kjs/BooleanObject.cpp:
3244 (KJS::booleanProtoFuncToString): Rewrite to handle false and true
3247 * kjs/FunctionPrototype.cpp:
3248 (KJS::constructFunction): Use single-character append rather than building
3249 a string for each character.
3250 * kjs/JSFunction.cpp:
3251 (KJS::globalFuncUnescape): Ditto.
3253 * kjs/JSImmediate.cpp:
3254 (KJS::JSImmediate::prototype): Added. Gets the appropriate prototype for
3255 use with an immediate value. To be used instead of toObject when doing a
3256 get on an immediate value.
3257 * kjs/JSImmediate.h: Added prototype.
3260 (KJS::JSObject::toString): Tweaked formatting.
3263 (KJS::JSValue::get): Use prototype instead of toObject to avoid creating
3264 an object wrapper just to search for properties. This also saves an
3265 unnecessary hash table lookup since the object wrappers themselves don't
3266 have any properties.
3268 * kjs/JSString.h: Added toThisString and toThisJSString.
3271 (KJS::JSCell::toThisString): Added.
3272 (KJS::JSCell::toThisJSString): Added.
3273 (KJS::JSCell::getJSNumber): Added.
3274 (KJS::jsString): Changed return type to JSString*.
3275 (KJS::jsOwnedString): Ditto.
3278 (KJS::JSValue::toThisString): Added.
3279 (KJS::JSValue::toThisJSString): Added.
3280 (KJS::JSValue::getJSNumber): Added.
3282 * kjs/NumberObject.cpp:
3283 (KJS::NumberObject::getJSNumber): Added.
3284 (KJS::integer_part_noexp): Append C string directly rather than first
3285 turning it into a UString.
3286 (KJS::numberProtoFuncToString): Use getJSNumber to check if the value
3287 is a number rather than isObject(&NumberObject::info). This works for
3288 immediate numbers, number cells, and NumberObject instances.
3289 (KJS::numberProtoFuncToLocaleString): Ditto.
3290 (KJS::numberProtoFuncValueOf): Ditto.
3291 (KJS::numberProtoFuncToFixed): Ditto.
3292 (KJS::numberProtoFuncToExponential): Ditto.
3293 (KJS::numberProtoFuncToPrecision): Ditto.
3294 * kjs/NumberObject.h: Added getJSNumber.
3296 * kjs/PropertySlot.cpp: Tweaked comment.
3299 (KJS::JSString::toThisString): Added.
3300 (KJS::JSString::toThisJSString): Added.
3301 (KJS::JSString::getOwnPropertySlot): Changed code that searches the
3302 prototype chain to start with the string prototype and not create a
3304 (KJS::JSNumberCell::toThisString): Added.
3305 (KJS::JSNumberCell::getJSNumber): Added.
3308 (KJS::staticFunctionGetter): Moved here, because there's no point in
3309 having a function that's only used for a function pointer be inline.
3310 (KJS::setUpStaticFunctionSlot): New function for getStaticFunctionSlot.
3313 (KJS::staticValueGetter): Don't mark this inline. It doesn't make sense
3314 to have a function that's only used for a function pointer be inline.
3315 (KJS::getStaticFunctionSlot): Changed to get properties from the parent
3316 first before doing any handling of functions. This is the fastest way
3317 to return the function once the initial setup is done.
3319 * kjs/string_object.cpp:
3320 (KJS::StringObject::getPropertyNames): Call value() instead of getString(),
3321 avoiding an unnecessary virtual function call (the call to the type()
3322 function in the implementation of the isString() function).
3323 (KJS::StringObject::toString): Added.
3324 (KJS::StringObject::toThisString): Added.
3325 (KJS::StringObject::toThisJSString): Added.
3326 (KJS::substituteBackreferences): Rewrote to use a appending algorithm
3327 instead of a the old one that tried to replace in place.
3328 (KJS::stringProtoFuncReplace): Merged this function and the replace function.
3329 Replaced the hand-rolled dynamic arrays for source ranges and replacements
3331 (KJS::stringProtoFuncToString): Handle JSString as well as StringObject.
3332 Removed the separate valueOf implementation, since it can just share this.
3333 (KJS::stringProtoFuncCharAt): Use toThisString, which handles JSString as
3334 well as StringObject, and is slightly more efficient than the old code too.
3335 (KJS::stringProtoFuncCharCodeAt): Ditto.
3336 (KJS::stringProtoFuncConcat): Ditto.
3337 (KJS::stringProtoFuncIndexOf): Ditto.
3338 (KJS::stringProtoFuncLastIndexOf): Ditto.
3339 (KJS::stringProtoFuncMatch): Ditto.
3340 (KJS::stringProtoFuncSearch): Ditto.
3341 (KJS::stringProtoFuncSlice): Ditto.
3342 (KJS::stringProtoFuncSplit): Ditto.
3343 (KJS::stringProtoFuncSubstr): Ditto.
3344 (KJS::stringProtoFuncSubstring): Ditto.
3345 (KJS::stringProtoFuncToLowerCase): Use toThisJSString.
3346 (KJS::stringProtoFuncToUpperCase): Ditto.
3347 (KJS::stringProtoFuncToLocaleLowerCase): Ditto.
3348 (KJS::stringProtoFuncToLocaleUpperCase): Ditto.
3349 (KJS::stringProtoFuncLocaleCompare): Ditto.
3350 (KJS::stringProtoFuncBig): Use toThisString.
3351 (KJS::stringProtoFuncSmall): Ditto.
3352 (KJS::stringProtoFuncBlink): Ditto.
3353 (KJS::stringProtoFuncBold): Ditto.
3354 (KJS::stringProtoFuncFixed): Ditto.
3355 (KJS::stringProtoFuncItalics): Ditto.
3356 (KJS::stringProtoFuncStrike): Ditto.
3357 (KJS::stringProtoFuncSub): Ditto.
3358 (KJS::stringProtoFuncSup): Ditto.
3359 (KJS::stringProtoFuncFontcolor): Ditto.
3360 (KJS::stringProtoFuncFontsize): Ditto.
3361 (KJS::stringProtoFuncAnchor): Ditto.
3362 (KJS::stringProtoFuncLink): Ditto.
3364 * kjs/string_object.h: Added toString, toThisString, and toThisJSString.
3367 (KJS::UString::append): Added a version that takes a character pointer and
3368 size, so we don't have to create a UString just to append to another UString.
3371 2008-06-26 Alexey Proskuryakov <ap@webkit.org>
3375 Make JSGlobalData per-thread.
3377 No change on SunSpider total.
3379 * wtf/ThreadSpecific.h: Re-enabled the actual implementation.
3381 * kjs/JSGlobalObject.cpp:
3382 (KJS::JSGlobalObject::~JSGlobalObject): Re-added a JSLock-related assertion. We'll probably
3383 want to preserve these somehow to keep legacy behavior in working condition.
3384 (KJS::JSGlobalObject::init): Initialize globalData pointer earlier, so that it is ready
3385 when updating JSGlobalObject linked list.
3387 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::head): Changed head() to be non-static, and
3388 to use JSGlobalData associated with the current object.
3390 * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Removed a no longer needed
3391 Heap::registerAsMainThread() call.
3393 * kjs/JSGlobalData.h: Removed a lying lie comment - parserObjectExtraRefCounts is not
3394 transient, and while newParserObjects may conceptually be such, there is still some node
3395 manipulation going on outside Parser::parse which touches it.
3397 * kjs/JSGlobalData.cpp:
3398 (KJS::JSGlobalData::~JSGlobalData): Delete recently added members.
3399 (KJS::JSGlobalData::sharedInstance): Actually use a separate instance.
3401 * kjs/collector.cpp:
3403 (KJS::Heap::~Heap): Added a destructor, which unconditionally deletes everything.
3404 (KJS::Heap::sweep): Removed code related to "collect on main thread only" logic.
3405 (KJS::Heap::collect): Ditto.
3406 (KJS::Heap::globalObjectCount): Explicitly use per-thread instance of JSGlobalObject linked
3407 list now that JSGlobalObject::head() is not static. Curently, WebCoreStatistics methods only
3408 work with the main thread currently anyway.
3409 (KJS::Heap::protectedGlobalObjectCount): Ditto.
3411 * kjs/collector.h: Removed code related to "collect on main thread only" logic.
3413 * JavaScriptCore.exp: Removed Heap::collectOnMainThreadOnly.
3415 2008-06-26 Alexey Proskuryakov <ap@webkit.org>
3419 https://bugs.webkit.org/show_bug.cgi?id=19767
3420 REGRESSION: Crash in sort() when visiting http://www.onnyturf.com/subway/
3422 * kjs/JSArray.cpp: (KJS::AVLTreeAbstractorForArrayCompare::set_balance_factor):
3423 Made changing balance factor from -1 to +1 work correctly.
3425 * wtf/AVLTree.h: (KJS::AVLTreeDefaultBSet::operator[]): Added an assertion that catches
3426 this slightly earlier.
3428 2008-06-25 Timothy Hatcher <timothy@apple.com>
3430 Fixes an ASSERT in the profiler when starting multiple profiles
3431 with the same name inside the same function/program.
3433 Reviewed by Kevin McCullough.
3435 * profiler/Profile.cpp:
3436 (KJS::Profile::Profile): Initialize m_stoppedCallDepth to zero.
3437 (KJS::Profile::stopProfiling): Set the current node to the parent,
3438 because we are in a call that will not get a didExecute call.
3439 (KJS::Profile::removeProfile): Increment m_stoppedCallDepth to
3440 account for didExecute not being called for profile.
3441 (KJS::Profile::willExecute): Increment m_stoppedCallDepth if stopped.
3442 (KJS::Profile::didExecute): Decrement m_stoppedCallDepth if stopped and
3443 greater than zero, and return early.
3444 * profiler/Profile.h: Added stoppedProfiling().
3445 * profiler/Profiler.cpp:
3446 (KJS::Profiler::findProfile): Removed.
3447 (KJS::Profiler::startProfiling): Don't return early for stopped profiles.
3448 (KJS::Profiler::stopProfiling): Skipp stopped profiles.
3449 (KJS::Profiler::didFinishAllExecution): Code clean-up.
3450 * profiler/Profiler.h: Removed findProfile.
3452 2008-06-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3454 Reviewed by Alexey Proskuryakov.
3456 Attempt to fix Windows debug build. The compiler gives a warning when
3457 Structured Exception Handling and destructors are used in the same
3458 function. Using manual locking and unlocking instead of constructors
3459 and destructors should fix the warning.
3464 2008-06-25 Alexey Proskuryakov <ap@webkit.org>
3466 Forgot to address a review comment about better names for tracked objects, doing it now.
3468 * kjs/JSGlobalData.cpp:
3469 (KJS::JSGlobalData::JSGlobalData):
3470 * kjs/JSGlobalData.h:
3472 (KJS::ParserRefCounted::ParserRefCounted):
3473 (KJS::ParserRefCounted::ref):
3474 (KJS::ParserRefCounted::deref):
3475 (KJS::ParserRefCounted::hasOneRef):
3476 (KJS::ParserRefCounted::deleteNewObjects):
3478 2008-06-25 Alexey Proskuryakov <ap@webkit.org>
3482 Remove more threadInstance() calls.
3484 * kjs/JSFunction.cpp:
3485 (KJS::JSFunction::getParameterName):
3486 (KJS::IndexToNameMap::unMap):
3487 (KJS::Arguments::deleteProperty):
3489 Access nullIdentifier without going to thread specific storage.
3491 * JavaScriptCore.exp:
3492 * kjs/JSGlobalData.cpp:
3493 (KJS::JSGlobalData::JSGlobalData):
3494 * kjs/JSGlobalData.h:
3496 (KJS::Parser::parse):
3498 (KJS::ParserRefCountedData::ParserRefCountedData):
3499 (KJS::Parser::parse):
3502 (KJS::ParserRefCounted::ParserRefCounted):
3503 (KJS::ParserRefCounted::ref):
3504 (KJS::ParserRefCounted::deref):
3505 (KJS::ParserRefCounted::hasOneRef):
3506 (KJS::ParserRefCounted::deleteNewObjects):
3508 (KJS::StatementNode::StatementNode):
3509 (KJS::BreakpointCheckStatement::BreakpointCheckStatement):
3510 (KJS::ConstDeclNode::ConstDeclNode):
3511 (KJS::BlockNode::BlockNode):
3512 (KJS::ForInNode::ForInNode):
3513 (KJS::ScopeNode::ScopeNode):
3514 (KJS::ProgramNode::ProgramNode):
3515 (KJS::ProgramNode::create):
3516 (KJS::EvalNode::EvalNode):
3517 (KJS::EvalNode::create):
3518 (KJS::FunctionBodyNode::FunctionBodyNode):
3519 (KJS::FunctionBodyNode::create):
3521 (KJS::ExpressionNode::):
3523 (KJS::BooleanNode::):
3524 (KJS::NumberNode::):
3525 (KJS::ImmediateNumberNode::):
3526 (KJS::StringNode::):
3527 (KJS::RegExpNode::):
3529 (KJS::ResolveNode::):