1 2008-07-31 Alexey Proskuryakov <ap@webkit.org>
3 Rubber-stamped by Oliver Hunt.
5 Fix the Mac project to not display "test/" as part of file name for tests.
7 * JavaScriptCore.xcodeproj/project.pbxproj:
9 2008-07-31 Eric Seidel <eric@webkit.org>
11 Reviewed by Alexey Proskuryakov.
13 Rename USE(MULTIPLE_THREADS) to ENABLE(JSC_MULTIPLE_THREADS)
14 to better match the use/enable pattern (and better describe
15 the usage of the feature in question.)
17 I also fixed a couple other ENABLE_ macros to be pre-processor
18 definition override-able to match the rest of the ENABLE_ macros
19 since it seems to be our convention that build systems can set
20 ENABLE_ macros in Makefiles.
22 * kjs/InitializeThreading.cpp:
23 (KJS::initializeThreadingOnce):
24 * kjs/JSGlobalData.cpp:
25 (KJS::JSGlobalData::JSGlobalData):
26 (KJS::JSGlobalData::~JSGlobalData):
32 (KJS::Heap::markStackObjectsConservatively):
41 * wtf/RefCountedLeakCounter.cpp:
43 2008-07-30 Eric Seidel <eric@webkit.org>
45 Reviewed by Mark Rowe.
47 Try to clean up our usage of USE(MULTIPLE_THREADS) vs. USE(PTHREADS) a little.
48 It looks like JSC assumes that if MULTIPLE_THREADS is defined, then pthreads will always be available
49 I'm not sure that's always the case for gtk, certainly not for Windows. We should eventually go back
50 and fix wtf/Threading.h to cover all these cases some day.
56 2008-07-30 Eric Seidel <eric@webkit.org>
60 MSVC warns when structs are called classes or vice versa.
61 Make all the source refer to JSGlobalData as a class.
63 * kjs/CommonIdentifiers.h:
68 2008-07-30 Alexey Proskuryakov <ap@webkit.org>
70 Reviewed by Geoff Garen.
72 Add consistency checks to UString to document and enforce its design.
75 (KJS::UString::Rep::create):
76 (KJS::UString::Rep::destroy):
77 (KJS::UString::Rep::checkConsistency):
78 (KJS::UString::expandCapacity):
79 (KJS::UString::expandPreCapacity):
80 (KJS::UString::UString):
81 (KJS::UString::spliceSubstringsWithSeparators):
82 (KJS::UString::append):
84 (KJS::UString::Rep::checkConsistency):
86 2008-07-30 Gavin Barraclough <barraclough@apple.com>
88 Reviewed by Geoff Garen.
90 Fixes for Windows and non-AllInOne file build with SamplingTool, plus review fixes.
92 * GNUmakefile.am: Adding SamplingTool.cpp to build.
93 * JavaScriptCore.exp: Export hooks to init & control SamplingTool.
94 * JavaScriptCore.pri: Adding SamplingTool.cpp to build.
95 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Adding SamplingTool.cpp to build.
96 * JavaScriptCore.xcodeproj/project.pbxproj: Adding SamplingTool.cpp to build.
97 * JavaScriptCoreSources.bkl: Adding SamplingTool.cpp to build.
98 * VM/Machine.cpp: MACHINE_SAMPLING_callingNativeFunction renamed MACHINE_SAMPLING_callingHostFunction
100 * VM/Opcode.cpp: SamplingTool moved to SamplingTool.cpp/.h, opcodeNames generated from FOR_EACH_OPCODE_ID.
102 * VM/SamplingTool.cpp: Added .cpp/.h for SamplingTool.
104 * kjs/Shell.cpp: Switched SAMPLING_TOOL_ENABLED to ENABLE_SAMPLING_TOOL.
105 * wtf/Platform.h: Added ENABLE_SAMPLING_TOOL config option.
106 * kjs/nodes.cpp: Header include to fix non-AllInOne builds.
108 2008-07-30 Ariya Hidayat <ariya.hidayat@trolltech.com>
110 Reviewed by Alexey Proskuryakov.
112 Fix compilation without multi-threading support.
117 2008-07-30 Anders Carlsson <andersca@apple.com>
119 Add WebKitAvailability.h forwarding header.
121 * ForwardingHeaders/JavaScriptCore/WebKitAvailability.h: Added.
123 2008-07-30 Anders Carlsson <andersca@apple.com>
127 * API/WebKitAvailability.h:
129 2008-07-30 Anders Carlsson <andersca@apple.com>
131 * API/WebKitAvailability.h:
132 Fix Windows (and other non-Mac builds).
134 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
135 Add WebKitAvailability.h to the project.
137 2008-07-30 Anders Carlsson <andersca@apple.com>
139 One step closer towards fixing the Windows build.
141 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
142 Make sure to copy WebKitAvailability.h
144 2008-07-29 Gavin Barraclough <barraclough@apple.com>
146 Reviewed by Geoff Garen.
148 Bug 20209: Atomize constant strings
149 <https://bugs.webkit.org/show_bug.cgi?id=20209>
151 Prevents significant performance degradation seen when a script contains multiple
152 identical strings that are used as keys to identify properties on objects.
154 No performance change on SunSpider.
156 * kjs/nodes.cpp: Atomize constant strings.
158 2008-07-30 Oliver Hunt <oliver@apple.com>
160 Reviewed by Alexey Proskuryakov.
162 <rdar://problem/6111648> JavaScript exceptions fail if the scope chain includes the global object
164 In an attempt to remove the branch I just added to KJS::depth I
165 used the existence of a Variable Object at a point in the scope
166 chain as an indicator of function or global scope activation.
167 However this assumption results in incorrect behaviour if the
168 global object is injected into the scope chain with 'with'.
173 2008-07-30 Alexey Proskuryakov <ap@webkit.org>
175 Reviewed by Geoff Garen.
177 Don't call JSGarbageCollect() on a released context.
179 * API/testapi.c: (main):
181 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
183 Reviewed by Geoff Garen.
185 Implement JSContextGroup APIs to make concurrent execution possible for
186 JavaScriptCore clients.
188 This changes the behavior of JSGlobalContextCreate(), so that it now uses a private context
189 group for each context, making JSlock implicit locking unnecessary.
191 * API/JSContextRef.h:
192 * API/JSContextRef.cpp:
193 (JSContextGroupCreate):
194 (JSContextGroupRetain):
195 (JSContextGroupRelease):
196 (JSGlobalContextCreate):
197 (JSGlobalContextCreateInGroup):
198 (JSGlobalContextRelease):
200 Added new methods. JSGlobalContextCreate() calls JSGlobalContextCreateInGroup() now.
202 * API/APICast.h: (toJS): (toRef): Added converters for JSContextGroupRef.
203 * API/JSBase.cpp: (JSGarbageCollect): JSGarbageCollect(0) is now a no-op, and the passed in
204 context is actually used.
206 * API/JSBase.h: Aded a typedef for JSContextGroupRef. Updated documentation for
209 * JavaScriptCore.exp: Removed JSGlobalData::sharedInstance().
211 * kjs/JSGlobalData.cpp:
212 * kjs/JSGlobalData.h:
213 Removed support for JSGlobalData shared instance. JSGlobalData::isSharedInstance member
214 variable still remains, to be deleted in a followup patch.
216 * kjs/JSLock.cpp: (KJS::JSLock::JSLock): Disabled JSLock, to be deleted in a follow-up patch.
219 (KJS::Heap::markOtherThreadConservatively): Removed an assertion that referenced
220 JSGlobalData::sharedInstance.
222 * kjs/collector.h: Made Heap destructor public, so that JSContextRelease can use it.
224 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
226 Reviewed by Geoff Garen.
228 Fix a leak of ThreadRegistrar objects.
230 As the heap is usually deleted when registered threads still exist, ThreadSpecific doesn't
231 have a chance to clean up per-thread object. Switched to native pthread calls, storing a
232 plain pointer that doesn't require cleanup.
235 (KJS::PlatformThread::PlatformThread):
236 (KJS::Heap::Thread::Thread):
239 (KJS::Heap::registerThread):
240 (KJS::Heap::unregisterThread):
243 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
245 Reviewed by Sam Weinig.
247 https://bugs.webkit.org/show_bug.cgi?id=20169
248 Memory allocated with fastMalloc is freed with delete
250 * VM/JSPropertyNameIterator.cpp:
251 (KJS::JSPropertyNameIterator::invalidate): Free the array properly.
252 (KJS::JSPropertyNameIterator::~JSPropertyNameIterator): Delete the array by calling
255 2008-07-29 Mark Rowe <mrowe@apple.com>
257 Attempt to fix the Qt build.
259 * wtf/ThreadingQt.cpp: Add the extra argument to createThread.
261 2008-07-29 Adam Roben <aroben@apple.com>
263 Change Vector::find to return an index instead of an iterator
265 Indices are more natural than iterators when working with Vector.
267 Reviewed by John Sullivan.
270 (WTF::Vector::find): Changed to iterate the Vector manually and return
271 the index of the found item, rather than an iterator. When the item
272 could not be found, we return WTF::notFound.
274 2008-07-29 Adam Roben <aroben@apple.com>
278 * wtf/ThreadingWin.cpp:
279 (WTF::setThreadName): Move a misplaced assertion to here...
280 (WTF::createThread): ...from here.
282 2008-07-29 Adam Roben <aroben@apple.com>
284 Add support for setting thread names on Windows
286 These thread names make it much easier to identify particular threads
287 in Visual Studio's Threads panel.
289 WTF::createThread now takes a const char* representing the thread's
290 name. On Windows, we throw a special exception to set this string as
291 the thread's name. Other platforms do nothing with this name for now.
293 Reviewed by Anders Carlsson.
295 * JavaScriptCore.exp: Export the new version of createThread that
296 takes 3 arguments (the old one continues to be exported for backward
298 * wtf/Threading.h: Add a threadName argument to createThread.
300 * wtf/ThreadingGtk.cpp:
302 * wtf/ThreadingNone.cpp:
304 Updated for function signature change.
306 * wtf/ThreadingPthreads.cpp:
307 (WTF::createThread): Updated for function signature change. We keep
308 around the old 2-argument version of createThread for backward
311 * wtf/ThreadingWin.cpp:
312 (WTF::setThreadName): Added. This function's implementation came from
314 (WTF::initializeThreading): Set the name of the main thread.
315 (WTF::createThread): Call setThreadName. We keep around the old
316 2-argument version of createThread for backward compatibility.
318 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
320 Reviewed by Oliver Hunt.
322 Store UString::Rep::isStatic bit in identifierTable pointer instead of reportedCost for
323 slightly nicer code and a 0.5% SunSpider improvement.
325 * API/JSClassRef.cpp:
326 (OpaqueJSClass::~OpaqueJSClass):
327 (OpaqueJSClassContextData::OpaqueJSClassContextData):
328 * API/JSStringRef.cpp:
330 * kjs/PropertyNameArray.cpp:
331 (KJS::PropertyNameArray::add):
332 * kjs/identifier.cpp:
333 (KJS::IdentifierTable::~IdentifierTable):
334 (KJS::IdentifierTable::add):
335 (KJS::Identifier::addSlowCase):
336 (KJS::Identifier::remove):
338 (KJS::Identifier::add):
341 (KJS::UString::Rep::create):
342 (KJS::UString::Rep::destroy):
344 (KJS::UString::Rep::identifierTable):
345 (KJS::UString::Rep::setIdentifierTable):
346 (KJS::UString::Rep::isStatic):
347 (KJS::UString::Rep::setStatic):
348 (KJS::UString::cost):
350 2008-07-28 Geoffrey Garen <ggaren@apple.com>
352 Reviewed by Sam Weinig.
354 Renamed "ConstructTypeNative" => "ConstructTypeHost".
356 2008-07-26 Mark Rowe <mrowe@apple.com>
358 Speculative fix for the wx build.
360 * JavaScriptCoreSources.bkl: Add JSStaticScopeObject.cpp to the list of source files.
362 2008-07-25 Oliver Hunt <oliver@apple.com>
366 Whoops, forgot to save style correction.
368 * kjs/JSStaticScopeObject.h:
370 2008-07-25 Oliver Hunt <oliver@apple.com>
372 Reviewed by Cameron Zwarich.
374 Bug 19718: Named anonymous functions are slow accessing global variables
375 <https://bugs.webkit.org/show_bug.cgi?id=19718>
377 To fix this we switch over to an activation-like scope object for
378 on which we attach the function name property, and add logic to
379 prevent cross scope assignment to read only properties.
382 * JavaScriptCore.pri:
383 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
384 * JavaScriptCore.xcodeproj/project.pbxproj:
385 * VM/CodeGenerator.cpp:
386 (KJS::CodeGenerator::findScopedProperty):
387 (KJS::CodeGenerator::emitResolve):
388 * VM/CodeGenerator.h:
389 * kjs/AllInOneFile.cpp:
390 * kjs/JSStaticScopeObject.cpp: Added.
391 (KJS::JSStaticScopeObject::putWithAttributes):
392 (KJS::JSStaticScopeObject::isDynamicScope):
393 (KJS::JSStaticScopeObject::~JSStaticScopeObject):
394 (KJS::JSStaticScopeObject::getOwnPropertySlot):
395 * kjs/JSStaticScopeObject.h: Added.
396 (KJS::JSStaticScopeObject::JSStaticScopeObjectData::JSStaticScopeObjectData):
397 (KJS::JSStaticScopeObject::JSStaticScopeObject):
399 (KJS::FunctionCallResolveNode::emitCode):
400 (KJS::PostfixResolveNode::emitCode):
401 (KJS::PrefixResolveNode::emitCode):
402 (KJS::ReadModifyResolveNode::emitCode):
403 (KJS::AssignResolveNode::emitCode):
404 (KJS::FuncExprNode::makeFunction):
406 2008-07-25 kevino <kevino@theolliviers.com>
408 wx build fix for Win.
410 On wx/Win, including windows.h in Threading.h causes multiply-defined symbol errors
411 for libjpeg and wx, and also wx needs to include windows.h itself first for wx
412 includes to work right. So until we can find a better solution to this problem,
413 on wx, we work around the need to include windows.h here.
417 2008-07-25 Adam Roben <aroben@apple.com>
421 * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add API/ to the
424 2008-07-25 Simon Hausmann <hausmann@webkit.org>
426 Fix the build of jsc on Qt/Windows, make sure os-win32 is in the
427 include search path (added by WebKit.pri).
431 2008-07-25 Alexey Proskuryakov <ap@webkit.org>
433 Reviewed by Simon Hausmann.
435 Move JavaScriptCore API tests into a subdirectory of their own to avoid header name
436 conflicts and developer confusion.
438 * API/JSNode.c: Removed.
439 * API/JSNode.h: Removed.
440 * API/JSNodeList.c: Removed.
441 * API/JSNodeList.h: Removed.
442 * API/Node.c: Removed.
443 * API/Node.h: Removed.
444 * API/NodeList.c: Removed.
445 * API/NodeList.h: Removed.
446 * API/minidom.c: Removed.
447 * API/minidom.html: Removed.
448 * API/minidom.js: Removed.
449 * API/testapi.c: Removed.
450 * API/testapi.js: Removed.
452 * API/tests/JSNode.c: Copied from JavaScriptCore/API/JSNode.c.
453 * API/tests/JSNode.h: Copied from JavaScriptCore/API/JSNode.h.
454 * API/tests/JSNodeList.c: Copied from JavaScriptCore/API/JSNodeList.c.
455 * API/tests/JSNodeList.h: Copied from JavaScriptCore/API/JSNodeList.h.
456 * API/tests/Node.c: Copied from JavaScriptCore/API/Node.c.
457 * API/tests/Node.h: Copied from JavaScriptCore/API/Node.h.
458 * API/tests/NodeList.c: Copied from JavaScriptCore/API/NodeList.c.
459 * API/tests/NodeList.h: Copied from JavaScriptCore/API/NodeList.h.
460 * API/tests/minidom.c: Copied from JavaScriptCore/API/minidom.c.
461 * API/tests/minidom.html: Copied from JavaScriptCore/API/minidom.html.
462 * API/tests/minidom.js: Copied from JavaScriptCore/API/minidom.js.
463 * API/tests/testapi.c: Copied from JavaScriptCore/API/testapi.c.
464 * API/tests/testapi.js: Copied from JavaScriptCore/API/testapi.js.
466 * JavaScriptCore.vcproj/testapi/testapi.vcproj:
467 * JavaScriptCore.xcodeproj/project.pbxproj:
469 2008-07-25 Simon Hausmann <hausmann@webkit.org>
471 Prospective WX build fix, add JavaScriptCore/API to the include search
476 2008-07-25 Simon Hausmann <hausmann@webkit.org>
478 Rubber-stamped by Lars.
480 Fix the build on Windows. operator new for ArgList is implemented using fastMalloc()
481 but operator delete was not implemented. Unfortunately MSVC decides to call/reference
482 the function, so a simple implementation using fastFree() fixes the build.
485 (KJS::ArgList::operator delete):
487 2008-07-25 Simon Hausmann <hausmann@webkit.org>
489 Discussed with and rubber-stamped by Lars.
491 Fix the build system for the Qt port.
493 Recent JavaScriptCore changes require the addition of JavaScriptCore/API to the
494 include search path. With a build process that combines JavaScriptCore and
495 WebCore in one build process/Makefile the existance of
496 JavaScriptCore/API/Node.h and WebCore/dom/Node.h causes include conflicts.
498 This commit solves this by introducing a separate build of JavaScriptCore into
501 As a result of the split-up a race-condition due to broken dependencies of
502 regular source files to header files of generated sources showed up very
503 frequently when doing parallel builds (which the buildbot does). This commit at
504 the same time tries to address the dependency problem by making the
505 addExtraCompiler() function also generate a pseudo extra compiler that
506 represents the header file output, so that qmake is aware of the creation of
507 the header file for dependency calculation.
509 At the same time I removed a lot of cruft from the pro files to ease maintenance.
511 * JavaScriptCore.pri:
512 * JavaScriptCore.pro: Added.
515 2008-07-24 Geoffrey Garen <ggaren@apple.com>
517 Reviewed by Maciej Stachowiak.
519 Fixed a strict aliasing violation, which caused hash tables with floating
520 point keys not to find items that were indeed in the tables
521 (intermittently, and only in release builds, of course).
523 SunSpider reports no change.
525 This bug doesn't seem to affect any existing code, but it causes obvious
526 crashes in some new code I'm working on.
528 * wtf/HashFunctions.h:
529 (WTF::FloatHash::hash): Use a union when punning between a float / double
530 and an unsigned (bucket of bits). With strict aliasing enabled, unions
531 are the only safe way to do this kind of type punning.
533 * wtf/HashTable.h: When rehashing, ASSERT that the item we just added to
534 the table is indeed in the table. In the buggy case described above, this
537 2008-07-24 Oliver Hunt <oliver@apple.com>
539 Reviewed by Alexey Proskuryakov.
541 Bug 20142: REGRESSION(r35245): /=/ weirdness
542 <https://bugs.webkit.org/show_bug.cgi?id=20142>
544 When adding all the meta data needed for exception error messages
545 I accidentally clobbered the handling of regex beginning with /=.
549 2008-07-23 Alp Toker <alp@nuanti.com>
551 Build fix after r35293: Add API/ to the include path.
555 2008-07-23 Adam Roben <aroben@apple.com>
559 Build fix after r35293:
561 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add API/
564 Build fix after r35305:
570 Completely compile out all sampler-related code when
571 SAMPLING_TOOL_ENABLED is 0. The sampler code can't be compiled 1) on
572 non-AllInOne configurations due to circular header dependencies, and
573 2) on platforms that don't have a usleep() function, such as Windows.
575 2008-07-23 Oliver Hunt <oliver@apple.com>
577 Reviewed by Geoff Garen and Sam Weinig.
579 Improve switch performance.
581 Improve switch performance by converting to a hashmap based jump
582 table to avoid the sequence of dispatches that would otherwise be
583 needed. This results in a 9-19x performance win for string switches
584 based on ad hoc testing, and a 6x improvement for integer switch
585 statements. SunSpider reports a 1.2% progression.
588 (KJS::CodeBlock::dump):
589 (KJS::SimpleJumpTable::offsetForValue):
591 * VM/CodeGenerator.cpp:
592 (KJS::CodeGenerator::beginSwitch):
593 (KJS::prepareJumpTableForImmediateSwitch):
594 (KJS::prepareJumpTableForCharacterSwitch):
595 (KJS::prepareJumpTableForStringSwitch):
596 (KJS::CodeGenerator::endSwitch):
597 * VM/CodeGenerator.h:
599 (KJS::offsetForStringSwitch):
600 (KJS::Machine::privateExecute):
607 (KJS::processClauseList):
608 (KJS::CaseBlockNode::tryOptimisedSwitch):
609 (KJS::CaseBlockNode::emitCodeForBlock):
613 2008-07-23 Gavin Barraclough <barraclough@apple.com>
615 Reviewed by Geoff Garen.
617 Sampling tool to analyze cost of instruction execution and identify hot regions of JS code.
618 Enable Switches by setting SAMPLING_TOOL_ENABLED in Opcode.h.
620 * JavaScriptCore.exp: Export symbols for Shell.cpp.
621 * VM/Machine.cpp: Added sampling hooks.
622 * VM/Machine.h: Machine contains a pointer to a sampler, when sampling.
623 * VM/Opcode.cpp: Tool implementation.
624 * VM/Opcode.h: Tool declaration.
625 * kjs/Shell.cpp: Initialize the sampler, if enabled.
626 * kjs/nodes.cpp: Added sampling hooks.
628 2008-07-23 Gabor Loki <loki@inf.u-szeged.hu>
630 Bug 20097: [Qt] 20% Sunspider slow-down
632 <https://bugs.webkit.org/show_bug.cgi?id=20097>
634 Reviewed by Simon Hausmann.
636 * kjs/jsc.pro: Added missing NDEBUG define for release builds.
638 2008-07-23 Alexey Proskuryakov <ap@webkit.org>
640 Reviewed by Geoff Garen.
642 JSClassRef is created context-free, but gets infatuated with the first context it sees.
644 The implicit API contract is that JSClassRef can be used with any context on any thread.
645 This no longer worked, because UStrings in the class were turned into per-context
646 identifiers, and the cached JSObject prototype was tied to JSGlobalData, too.
648 * API/JSClassRef.h: Made a separate struct for context-dependent parts of OpaqueJSClass.
649 * API/JSClassRef.cpp:
650 (OpaqueJSClass::OpaqueJSClass): Updated for renames and changed member variable order.
651 (OpaqueJSClass::~OpaqueJSClass): Assert that string members are not identifiers.
652 (clearReferenceToPrototype): Update for the new reference location.
653 (OpaqueJSClassContextData::OpaqueJSClassContextData): Make a deep copy of all strings.
654 (OpaqueJSClass::contextData): Added a function that finds the per-context part of
655 OpaqueJSClass in JSGlobalData, or creates it if not found.
656 (OpaqueJSClass::className): Always make a deep copy. Callers of this function do not have
657 a way to access JSGlobalData, so a per-context copy could not be made.
658 (OpaqueJSClass::staticValues): Updated for new data location.
659 (OpaqueJSClass::staticFunctions): Ditto.
660 (OpaqueJSClass::prototype): Changed to take an internal type for consistency.
662 * kjs/JSGlobalData.cpp:
663 (KJS::JSGlobalData::JSGlobalData):
664 (KJS::JSGlobalData::~JSGlobalData):
665 * kjs/JSGlobalData.h:
666 Keep a HashMap to access per-context JSClass data given a pointr to the shared part.
668 * API/JSCallbackObjectFunctions.h:
670 (KJS::::getOwnPropertySlot):
672 (KJS::::deleteProperty):
673 (KJS::::getPropertyNames):
674 (KJS::::staticValueGetter):
675 (KJS::::staticFunctionGetter):j
676 Use function accessors instead of accessing OpaqueJSClass members directly.
678 * API/JSContextRef.cpp: (JSGlobalContextCreate): Updated for the change in
679 OpaqueJSClass::prototype() argument type.
681 * API/JSObjectRef.cpp:
682 (JSObjectMake): Updated for the change in OpaqueJSClass::prototype() argument type.
683 (JSObjectMakeConstructor): Ditto.
685 2008-07-23 Alexey Proskuryakov <ap@webkit.org>
689 * kjs/ArgList.h: (KJS::ArgList::operator new): removed an extraneous "ArgList::" inside the
692 2008-07-22 Geoffrey Garen <ggaren@apple.com>
694 Reviewed by Oliver Hunt and Sam Weinig.
696 Next step toward putting doubles in registers: Prepare the Register class
697 and its clients for registers that don't contain JSValue*s.
699 This means a few things:
701 1. Register::jsValue() clients, including ArgList clients, must now supply
702 an ExecState* when accessing an entry in an ArgList, in case the entry
703 will need to create a JSValue* on the fly.
705 2. Register clients that definitely don't want to create a JSValue* on
706 the fly now use different APIs: getJSValue() for clients that know
707 the register contains a JSValue*, and v() for clients who just want a
710 3. I had to change some headers around in order to resolve dependency
711 problems created by using a Register in the ArgList header.
713 SunSpider reports no change.
715 2008-07-22 Gavin Barraclough <barraclough@apple.com>
717 Reviewed by Alexey Proskuryakov.
719 Prevent integer overflow when reallocating storage vector for arrays.
721 Sunspider reports 1.005x as fast (no change expected).
725 2008-07-21 Mark Rowe <mrowe@apple.com>
727 Reviewed by Sam Weinig.
729 <rdar://problem/6091287> Revamp the handling of CFBundleShortVersionString to be fixed at the major component of the version number.
731 * Configurations/Version.xcconfig:
734 2008-07-21 Adam Roben <aroben@apple.com>
738 This is a convenience wrapper around std::find.
740 Reviewed by Anders Carlsson.
744 2008-07-19 Oliver Hunt <oliver@apple.com>
746 Reviewed by Cameron Zwarich.
748 Bug 20104: Exception in tables/mozilla_expected_failures/bugs/bug92868_1.html includes the equals operator in the quoted expression
749 <https://bugs.webkit.org/show_bug.cgi?id=20104>
751 To make this correct we make the dot and bracket assign nodes emit the information to indicate
752 the failure range is the dot/bracket accessor.
756 2008-07-18 Steve Falkenburg <sfalken@apple.com>
760 * kjs/JSGlobalObjectFunctions.cpp:
761 (KJS::isStrWhiteSpace):
763 2008-07-18 Steve Falkenburg <sfalken@apple.com>
768 (KJS::ThrowableExpressionData::ThrowableExpressionData):
770 2008-07-18 Oliver Hunt <oliver@apple.com>
772 Reviewed by Cameron Zwarich.
774 Bug 18774: SQUIRRELFISH: print meaningful error messages <https://bugs.webkit.org/show_bug.cgi?id=18774>
775 <rdar://problem/5769353> SQUIRRELFISH: JavaScript error messages are missing informative text
777 Add support for decent error messages in JavaScript. This patch achieves this by providing
778 ensuring the common errors and exceptions have messages that provide the text of expression
779 that trigger the exception. In addition it attaches a number of properties to the exception
780 object detailing where in the source the expression came from.
782 * JavaScriptCore.exp:
784 (KJS::CodeBlock::lineNumberForVPC):
785 (KJS::CodeBlock::expressionRangeForVPC):
786 Function to recover the expression range for an instruction
787 that triggered an exception.
789 (KJS::ExpressionRangeInfo::):
790 (KJS::CodeBlock::CodeBlock):
791 * VM/CodeGenerator.cpp:
792 (KJS::CodeGenerator::emitCall):
793 (KJS::CodeGenerator::emitCallEval):
794 Emit call needed to be modified so to place the expression range info internally,
795 as the CodeGenerator emits the arguments nodes itself, rather than the various call
797 * VM/CodeGenerator.h:
798 (KJS::CodeGenerator::emitExpressionInfo):
799 Record the expression range info.
800 * VM/ExceptionHelpers.cpp:
801 (KJS::createErrorMessage):
802 (KJS::createInvalidParamError):
803 (KJS::createUndefinedVariableError):
804 (KJS::createNotAConstructorError):
805 (KJS::createNotAFunctionError):
806 (KJS::createNotAnObjectErrorStub):
807 (KJS::createNotAnObjectError):
808 Rewrite all the code for the error messages so that they make use of the newly available
810 * VM/ExceptionHelpers.h:
812 (KJS::isNotObject): Now needs vPC and codeBlock
813 (KJS::Machine::throwException):
814 New logic to handle the NotAnObjectErrorStub and to handle the absurd "no default value" edge case
815 (KJS::Machine::privateExecute):
817 * kjs/DebuggerCallFrame.cpp:
818 (KJS::DebuggerCallFrame::evaluate):
820 (KJS::Error::create):
822 * kjs/JSGlobalObjectFunctions.cpp:
823 * kjs/JSImmediate.cpp:
824 (KJS::JSImmediate::toObject):
825 (KJS::JSImmediate::prototype):
826 My changes to the JSNotAnObject constructor needed to be handled here.
827 * kjs/JSNotAnObject.h:
828 (KJS::JSNotAnObjectErrorStub::JSNotAnObjectErrorStub):
829 (KJS::JSNotAnObjectErrorStub::isNull):
830 (KJS::JSNotAnObjectErrorStub::isNotAnObjectErrorStub):
831 Added a JSNotAnObjectErrorStub class to ease the handling of toObject failure exceptions,
832 and potentially allow even more detailed error messages in future.
835 (KJS::Parser::parse):
838 Large amounts of position propagation.
843 The lexer needed a few changes to be able to correctly track token character positions.
846 (KJS::ThrowableExpressionData::emitThrowError):
847 (KJS::StatementNode::StatementNode):
848 (KJS::ResolveNode::emitCode):
849 (KJS::BracketAccessorNode::emitCode):
850 (KJS::DotAccessorNode::emitCode):
851 (KJS::NewExprNode::emitCode):
852 (KJS::EvalFunctionCallNode::emitCode):
853 (KJS::FunctionCallValueNode::emitCode):
854 (KJS::FunctionCallResolveNode::emitCode):
855 (KJS::FunctionCallBracketNode::emitCode):
856 (KJS::FunctionCallDotNode::emitCode):
857 (KJS::PostfixResolveNode::emitCode):
858 (KJS::PostfixBracketNode::emitCode):
859 (KJS::PostfixDotNode::emitCode):
860 (KJS::DeleteResolveNode::emitCode):
861 (KJS::DeleteBracketNode::emitCode):
862 (KJS::DeleteDotNode::emitCode):
863 (KJS::PrefixResolveNode::emitCode):
864 (KJS::PrefixBracketNode::emitCode):
865 (KJS::PrefixDotNode::emitCode):
866 (KJS::ThrowableBinaryOpNode::emitCode):
867 (KJS::ReadModifyResolveNode::emitCode):
868 (KJS::AssignResolveNode::emitCode):
869 (KJS::AssignDotNode::emitCode):
870 (KJS::ReadModifyDotNode::emitCode):
871 (KJS::AssignBracketNode::emitCode):
872 (KJS::ReadModifyBracketNode::emitCode):
873 (KJS::ForInNode::ForInNode):
874 (KJS::ForInNode::emitCode):
875 (KJS::WithNode::emitCode):
876 (KJS::LabelNode::emitCode):
877 (KJS::ThrowNode::emitCode):
878 (KJS::ProgramNode::ProgramNode):
879 (KJS::ProgramNode::create):
880 (KJS::EvalNode::generateCode):
881 (KJS::FunctionBodyNode::create):
882 (KJS::FunctionBodyNode::generateCode):
883 (KJS::ProgramNode::generateCode):
884 All of these methods were handling the position information.
885 Constructors and create methods were modified to store the information.
886 All the emitCall implementations listed needed to be updated to actually
887 record the position information we have so carefully collected.
889 (KJS::ThrowableExpressionData::ThrowableExpressionData):
890 (KJS::ThrowableExpressionData::setExceptionSourceRange):
891 (KJS::ThrowableExpressionData::divot):
892 (KJS::ThrowableExpressionData::startOffset):
893 (KJS::ThrowableExpressionData::endOffset):
894 (KJS::ThrowableSubExpressionData::ThrowableSubExpressionData):
895 (KJS::ThrowableSubExpressionData::setSubexpressionInfo):
896 (KJS::ThrowablePrefixedSubExpressionData::ThrowablePrefixedSubExpressionData):
897 (KJS::ThrowablePrefixedSubExpressionData::setSubexpressionInfo):
898 ThrowableExpressionData is just a uniform mechanism for storing the position
900 (KJS::ResolveNode::):
901 (KJS::PrePostResolveNode::):
902 (KJS::ThrowableBinaryOpNode::):
905 2008-07-18 Geoffrey Garen <ggaren@apple.com>
907 Reviewed by Cameron Zwarich.
911 "CallTypeNative" => "CallTypeHost"
913 "generatedCode" => "generatedByteCode"
915 2008-07-18 Geoffrey Garen <ggaren@apple.com>
917 Reviewed by Oliver Hunt.
919 Optimized <= for immediate number cases.
921 SunSpider reports no overall change, but a 10% speedup on access-nsieve.
923 2008-07-18 Mark Rowe <mrowe@apple.com>
925 Rubber-stamped by Sam Weinig.
927 Fix some casts added in a previous build fix to match the style used
931 (KJS::Machine::initializeCallFrame):
933 (KJS::Register::Register):
935 2008-07-18 Landry Breuil <landry@openbsd.org>
937 Bug 19975: [OpenBSD] Patches to enable build of WebKit
939 <https://bugs.webkit.org/show_bug.cgi?id=19975>
941 Reviewed by David Kilzer.
943 Support for OpenBSD, mostly threading and libm tweaks.
945 * kjs/collector.cpp: #include <pthread.h>
946 (KJS::currentThreadStackBase): use pthread_stackseg_np() to get stack base
947 * kjs/config.h: OpenBSD also provides <pthread_np.h>
948 * wtf/MathExtras.h: #include <sys/types.h> and <machine/ieee.h>
949 (isfinite), (signbit): as long as we don't have those functions provide fallback implementations
950 * wtf/Platform.h: Add support for PLATFORM(OPENBSD) and PLATFORM(SPARC64) macro
952 2008-07-17 Geoffrey Garen <ggaren@apple.com>
954 Reviewed by Oliver Hunt.
956 Next step toward putting doubles in registers: Store constant pool
957 entries as registers, not JSValue*s.
959 SunSpider reports no change.
961 2008-07-17 Geoffrey Garen <ggaren@apple.com>
963 Reviewed by John Sullivan and Oliver Hunt.
965 A tiny bit of tidying in function call register allocation.
967 This patch saves one register when invoking a function expression and/or
968 a new expression that is stored in a temporary.
970 Since it's just one register, I can't make a testcase for it.
972 * VM/CodeGenerator.cpp:
973 (KJS::CodeGenerator::emitCall): No need to ref the function we're calling
974 or its base. We'd like the call frame to overlap with them, if possible.
975 op_call will read the function and its base before writing the call frame,
979 (KJS::NewExprNode::emitCode): No need to ref the function we're new-ing,
980 for the same reasons stated above.
982 (KJS::FunctionCallValueNode::emitCode): ditto
984 2008-07-17 Steve Falkenburg <sfalken@apple.com>
988 * kjs/InternalFunction.cpp:
990 2008-07-17 Sam Weinig <sam@webkit.org>
992 Roll out r35199 as it is causing failures on the PPC build.
994 2008-07-17 Geoffrey Garen <ggaren@apple.com>
996 Reviewed by David Kilzer.
998 Fixed https://bugs.webkit.org/show_bug.cgi?id=20067
999 Support function.name (Firefox extension)
1001 Pretty straight-forward.
1003 2008-07-17 Geoffrey Garen <ggaren@apple.com>
1005 Reviewed by Oliver Hunt.
1007 Fixed <rdar://problem/6081636> Functions calls use more temporary
1008 registers than necessary
1010 Holding a reference to the last statement result register caused each
1011 successive statement to output its result to an even higher register.
1013 Happily, statements don't actually need to return a result register
1014 at all. I hope to make this clearer in a future cleanup patch,
1015 but this change will fix the major bug for now.
1018 (KJS::statementListEmitCode):
1020 2008-07-17 Gavin Barraclough <barraclough@apple.com>
1022 Reviewed by Sam Weinig.
1024 Merge pre&post dot nodes to simplify the parse tree.
1025 Sunspider results show 0.6% progression (no performance change expected).
1030 * kjs/nodes2string.cpp:
1032 2008-07-17 Gavin Barraclough <barraclough@apple.com>
1034 Reviewed by Cameron Zwarich.
1036 Merge pre&post resolve nodes to simplify the parse tree.
1037 Sunspider results show no performance change.
1042 * kjs/nodes2string.cpp:
1044 2008-07-17 Gavin Barraclough <barraclough@apple.com>
1046 Reviewed by Cameron Zwarich.
1048 Merge logical nodes to simplify the parse tree.
1049 Sunspider results show 0.6% progression (no performance change expected).
1054 * kjs/nodes2string.cpp:
1056 2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
1060 Fix MinGW build (broken in r35198) and simplify getLocalTime().
1063 (KJS::getLocalTime):
1065 2008-07-17 Gavin Barraclough <barraclough@apple.com>
1067 Reviewed by Sam Weinig.
1069 Merge pre&post bracket nodes to simplify the parse tree.
1070 Sunspider results show no performance change.
1075 * kjs/nodes2string.cpp:
1077 2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
1081 Fix the 32-bit gcc builds, conversion from "long int" to Register is
1082 ambiguous. Explicitly choose the intptr_t constructor.
1085 (KJS::Machine::initializeCallFrame):
1087 (KJS::Register::Register):
1089 2008-07-16 Mark Rowe <mrowe@apple.com>
1091 Rubber-stamped by Geoff Garen.
1093 Fix JavaScript in 64-bit by using a pointer-sized integer
1094 type in the Register union. Also includes a rename of
1095 the intType constant to IntType.
1098 (KJS::Machine::initializeCallFrame):
1101 (KJS::Register::Register):
1103 2008-07-17 Geoffrey Garen <ggaren@apple.com>
1105 Reviewed by Oliver Hunt.
1107 First step toward putting doubles in registers: Turned Register into a
1108 proper abstraction layer. It is no longer possible to cast a Register
1109 to a JSValue*, or a Register& to a JSValue*&, or to access the union
1110 inside a Register directly.
1112 SunSpider reports no change.
1114 In support of this change, I had to make the following mechanical changes
1117 1. Clients now use explicit accessors to read data out of Registers, and
1118 implicit copy constructors to write data into registers.
1120 So, assignment that used to look like
1128 And access that used to look like
1136 2. I made generic flow control specific in opcodes that made their flow
1137 control generic by treating a Register& as a JSValue*&. This had the
1138 added benefit of removing some exception checking branches from immediate
1141 3. I beefed up PropertySlot to support storing a Register* in a property
1142 slot. For now, only JSVariableObject's symbolTableGet and symbolTablePut
1143 use this functionality, but I expect more clients to use it in the future.
1145 4. I changed ArgList to be a buffer of Registers, not JSValue*'s, and I
1146 changed ArgList iterator clients to iterate Registers, not JSValue*'s.
1148 2008-07-16 Ada Chan <adachan@apple.com>
1152 * kjs/JSGlobalObject.cpp:
1154 2008-07-16 Kevin McCullough <kmccullough@apple.com>
1156 Reviewed by Sam and Geoff.
1158 <rdar://problem/5958840> Navigating to another page while profiler is
1159 attached results in slow JavaScript for all time.
1161 - The UNLIKELY keeps this from being a sunspider performance regression.
1163 * kjs/JSGlobalObject.cpp:
1164 (KJS::JSGlobalObject::~JSGlobalObject): Stop the profiler associated
1165 with this exec state.
1167 2008-07-16 Sam Weinig <sam@webkit.org>
1169 Reviewed by Steve Falkenburg.
1171 Replace adopting UString constructor in favor of explicit
1172 static adopt method.
1174 * API/JSStringRefCF.cpp:
1175 (JSStringCreateWithCFString):
1176 * kjs/StringConstructor.cpp:
1177 (KJS::stringFromCharCode):
1178 * kjs/StringPrototype.cpp:
1179 (KJS::stringProtoFuncToLowerCase):
1180 (KJS::stringProtoFuncToUpperCase):
1181 (KJS::stringProtoFuncToLocaleLowerCase):
1182 (KJS::stringProtoFuncToLocaleUpperCase):
1184 (KJS::UString::adopt):
1186 (KJS::UString::UString):
1187 (KJS::UString::~UString):
1189 2008-07-16 Ariya Hidayat <ariya.hidayat@trolltech.com>
1193 http://trolltech.com/developer/task-tracker/index_html?method=entry&id=216179
1194 Fix potential crash (on Qt for Windows port) when performing JavaScript date
1198 (KJS::getLocalTime): For the Qt port, prefer to use Windows code, i.e.
1199 localtime_s() instead of localtime() since the latter might crash (on Windows)
1200 given a non-sensible, e.g. NaN, argument.
1202 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1204 Reviewed by Anders and Geoff.
1206 https://bugs.webkit.org/show_bug.cgi?id=20023
1207 Failed assertion in PropertyNameArray.cpp
1209 This is already tested by testapi.
1211 * API/JSObjectRef.cpp: (JSPropertyNameAccumulatorAddName): Add the string to identifier
1212 table to appease PropertyNameArray.
1214 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1218 Dereference identifiers when deleting a hash table (fixes leaks with private JSGlobalData
1221 * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::~JSGlobalData):
1222 * kjs/lookup.cpp: (KJS::HashTable::deleteTable):
1224 * kjs/lexer.cpp: (KJS::Lexer::~Lexer)
1225 HashTable cannot have a destructor, because check-for-global-initializers complains about
1226 having a global constructor then.
1228 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1232 Check pthread_key_create return value.
1234 This check was helpful when debugging a crash in run-webkit-tests --threaded that happened
1235 because JSGlobalData objects were not deleted, and we were running out of pthread keys soon.
1236 It also looks useful for production builds.
1238 * wtf/ThreadSpecific.h: (WTF::::ThreadSpecific):
1240 2008-07-15 Kevin McCullough <kmccullough@apple.com>
1244 Rename pageGroupIdentifier to profileGroup to keep mention of a
1245 pageGroup out of JavaScriptCore.
1247 * kjs/JSGlobalObject.cpp:
1248 (KJS::JSGlobalObject::init):
1249 * kjs/JSGlobalObject.h:
1250 (KJS::JSGlobalObject::setProfileGroup):
1251 (KJS::JSGlobalObject::profileGroup):
1252 * profiler/ProfileGenerator.cpp:
1253 (KJS::ProfileGenerator::create):
1254 (KJS::ProfileGenerator::ProfileGenerator):
1255 * profiler/ProfileGenerator.h:
1256 (KJS::ProfileGenerator::profileGroup):
1257 * profiler/Profiler.cpp:
1258 (KJS::Profiler::startProfiling):
1259 (KJS::dispatchFunctionToProfiles):
1260 (KJS::Profiler::willExecute):
1261 (KJS::Profiler::didExecute):
1263 2008-07-14 Mark Rowe <mrowe@apple.com>
1265 Reviewed by Sam Weinig.
1267 Fix https://bugs.webkit.org/show_bug.cgi?id=20037
1268 Bug 20037: GCC 4.2 build broken due to strict aliasing violation.
1271 (KJS::UString::Rep::computeHash): Add a version of computeHash that takes a char* and explicit length.
1273 * profiler/CallIdentifier.h:
1274 (WTF::): Use new version of computeHash that takes a char* and explicit length to avoid unsafe aliasing.
1276 2008-07-14 David Hyatt <hyatt@apple.com>
1278 Fix a crashing bug in ListHashSet's -- operator. Make sure that end() can be -- by special-casing the null
1283 * wtf/ListHashSet.h:
1284 (WTF::ListHashSetConstIterator::operator--):
1286 2008-07-14 David Hyatt <hyatt@apple.com>
1288 Buidl fix. Make sure the second insertBefore method returns a value.
1290 * wtf/ListHashSet.h:
1291 (WTF::::insertBefore):
1293 2008-07-14 Adam Roben <aroben@apple.com>
1297 * JavaScriptCore.vcproj/jsc/jsc.vcproj: Added include/pthreads to the
1300 2008-07-14 Alexey Proskuryakov <ap@webkit.org>
1302 Reviewed by Kevin McCullough.
1304 Make JSGlobalData refcounted in preparation to adding a way to create contexts that share
1307 * JavaScriptCore.exp:
1308 * kjs/JSGlobalData.cpp:
1309 (KJS::JSGlobalData::create):
1310 * kjs/JSGlobalData.h:
1311 Made contructor private, and added a static create() method. Made the class inherit from
1314 * kjs/JSGlobalObject.h:
1315 (KJS::JSGlobalObject::globalData):
1316 JSGlobalData is now owned by JSGlobalObject (except for the shared one, and the common
1317 WebCore one, which are never deleted).
1319 * kjs/Shell.cpp: (main): Create JSGlobalData with create() method.
1321 2008-07-14 Simon Hausmann <hausmann@webkit.org>
1323 Fix the single-threaded build.
1325 * kjs/JSLock.cpp: Removed undeclared registerThread() function.
1326 * kjs/collector.cpp:
1327 (KJS::Heap::registerThread): Added dummy implementation.
1329 2008-07-14 Alexey Proskuryakov <ap@webkit.org>
1331 Reviewed by Geoff Garen.
1333 Eliminate per-thread JavaScript global data instance support and make arbitrary
1334 global data/global object combinations possible.
1336 * kjs/collector.cpp:
1337 (KJS::Heap::Heap): Store a JSGlobalData pointer instead of multiple pointers to its members.
1338 This allows for going from any JS object to its associated global data, currently used in
1339 JSGlobalObject constructor to initialize its JSGlobalData pointer.
1340 (KJS::Heap::registerThread): Changed thread registration data to be per-heap. Previously,
1341 only the shared heap could be used from multiple threads, so it was the only one that needed
1342 thread registration, but now this can happen to any heap.
1343 (KJS::Heap::unregisterThread): Ditto.
1344 (KJS::Heap::markStackObjectsConservatively): Adapt for the above changes.
1345 (KJS::Heap::setGCProtectNeedsLocking): Ditto.
1346 (KJS::Heap::protect): Ditto.
1347 (KJS::Heap::unprotect): Ditto.
1348 (KJS::Heap::collect): Ditto.
1349 (KJS::Heap::globalObjectCount): Use global object list associated with the current heap,
1350 not the late per-thread one.
1351 (KJS::Heap::protectedGlobalObjectCount): Ditto.
1354 (KJS::Heap::ThreadRegistrar): Added a helper object that unregisters a thread when it is
1358 (KJS::JSLock::JSLock):
1360 (KJS::JSLock::JSLock):
1361 Don't use JSLock to implicitly register threads. I've added registerThread() calls to most
1362 places that use JSLock - we cannot guarantee absolute safety unless we always mark all
1363 threads in the process, but these implicit registration calls should cover reasonable usage
1367 (JSEvaluateScript): Explicitly register the current thread.
1368 (JSCheckScriptSyntax): Explicitly register the current thread.
1369 (JSGarbageCollect): Changed to use the passed in context. Unfortunately, this creates a race
1370 condition for clients that pass an already released context to JSGarbageCollect - but it is
1371 unlikely to create real life problems.
1372 To maintain compatibility, the shared heap is collected if NULL is passed.
1374 * API/JSContextRef.cpp:
1375 (JSGlobalContextCreate): Use a new syntax for JSGlobalObject allocation.
1376 (JSGlobalContextRetain): Register the thread.
1377 (JSContextGetGlobalObject): Register the thread.
1379 * API/JSObjectRef.cpp:
1381 (JSObjectMakeFunctionWithCallback):
1382 (JSObjectMakeConstructor):
1383 (JSObjectMakeFunction):
1384 (JSObjectHasProperty):
1385 (JSObjectGetProperty):
1386 (JSObjectSetProperty):
1387 (JSObjectGetPropertyAtIndex):
1388 (JSObjectSetPropertyAtIndex):
1389 (JSObjectDeleteProperty):
1390 (JSObjectCallAsFunction):
1391 (JSObjectCallAsConstructor):
1392 (JSObjectCopyPropertyNames):
1393 (JSPropertyNameAccumulatorAddName):
1394 * API/JSValueRef.cpp:
1396 (JSValueIsInstanceOfConstructor):
1397 (JSValueMakeNumber):
1398 (JSValueMakeString):
1400 (JSValueToStringCopy):
1404 Register the thread.
1406 * API/JSStringRef.cpp: (JSStringRelease): Changed a comment to not mention per-thread contexts.
1408 * API/JSStringRefCF.cpp: Removed an unnecessary include of JSLock.h.
1410 * JavaScriptCore.exp: Export JSGlobalData constructor/destructor, now that anyone can have
1411 their own instances. Adapt to other changes, too.
1413 * JavaScriptCore.xcodeproj/project.pbxproj: Made ThreadSpecific.h private, as it is now
1414 included by collector.h and is thus needed in other projects.
1416 * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Don't initialize per-thread
1417 global data, as it no longer exists.
1419 * kjs/JSGlobalData.cpp:
1420 (KJS::JSGlobalData::JSGlobalData):
1421 (KJS::JSGlobalData::~JSGlobalData):
1422 * kjs/JSGlobalData.h:
1423 Removed support for per-thread instance. Made constructor and destructor public.
1425 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Get to now arbitrary JSGlobalData
1427 (KJS::JSGlobalObject::operator new): Changed ot take JSGlobalDatra pointer.
1428 * kjs/JSGlobalObject.h:
1433 Changed to maintain a custom JSGlobalData pointer instead of a per-thread one.
1435 2008-07-13 Ada Chan <adachan@apple.com>
1437 Windows build fix: Add wtf/RefCountedLeakCounter to the project.
1439 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
1441 2008-07-12 Jan Michael Alonzo <jmalonzo@webkit.org>
1443 Gtk, Qt and Wx build fix: Add wtf/RefCountedLeakCounter in the
1447 * JavaScriptCore.pri:
1448 * JavaScriptCoreSources.bkl:
1450 2008-07-11 Stephanie Lewis <slewis@apple.com>
1452 Reviewed by Darin Adler and Oliver Hunt.
1454 Refactor RefCounting Leak counting code into a common class.
1456 In order to export the symbols I needed to put the debug defines inside the function names
1458 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.
1460 * JavaScriptCore.exp:
1461 * JavaScriptCore.xcodeproj/project.pbxproj: add new class
1462 * kjs/nodes.cpp: remove old leak counting code
1463 * wtf/RefCountedLeakCounter.cpp: Added. create a common leak counting class
1464 * wtf/RefCountedLeakCounter.h: Added.
1466 2008-07-11 David Hyatt <hyatt@apple.com>
1468 Add an insertBefore method to ListHashSet to allow for insertions in the middle of the list (rather than just
1473 * wtf/ListHashSet.h:
1474 (WTF::::insertBefore):
1475 (WTF::::insertNodeBefore):
1477 2008-07-11 Sam Weinig <sam@webkit.org>
1479 Rubber-stamped by Darin Adler.
1481 Move call function to CallData.cpp and construct to ConstructData.cpp.
1484 * JavaScriptCore.pri:
1485 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1486 * JavaScriptCore.xcodeproj/project.pbxproj:
1487 * JavaScriptCoreSources.bkl:
1488 * kjs/AllInOneFile.cpp:
1489 * kjs/CallData.cpp: Copied from kjs/JSValue.cpp.
1490 * kjs/ConstructData.cpp: Copied from kjs/JSValue.cpp.
1493 2008-07-10 Mark Rowe <mrowe@apple.com>
1495 Reviewed by Sam Weinig.
1497 Define WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST when building WebKit to ensure that no symbols end up with the weak_import attribute.
1499 * Configurations/Base.xcconfig:
1501 2008-07-10 Mark Rowe <mrowe@apple.com>
1503 Reviewed by Sam Weinig.
1505 Fix the Tiger build by omitting annotations from methods declared in categories when using old versions of GCC.
1507 * API/WebKitAvailability.h:
1509 2008-07-10 Kevin McCullough <kmccullough@apple.com>
1513 -Minor cleanup. Renamed callTree() to head() and no longer use m_head
1514 directly but instead keep it private and access via a method().
1516 * profiler/HeavyProfile.cpp:
1517 (KJS::HeavyProfile::HeavyProfile):
1518 (KJS::HeavyProfile::generateHeavyStructure):
1519 (KJS::HeavyProfile::addNode):
1520 * profiler/Profile.h:
1521 (KJS::Profile::head):
1522 * profiler/ProfileGenerator.cpp:
1523 (KJS::ProfileGenerator::ProfileGenerator):
1525 2008-07-10 Alexey Proskuryakov <ap@webkit.org>
1527 Reviewed by Mark Rowe.
1529 Eliminate CollectorHeapIntrospector.
1531 CollectorHeapIntrospector was added primarily in the hopes to improve leaks tool output,
1532 a result that it didn't deliver. Also, it helped by labeling JSC heap regions as reported by
1533 vmmap tool, but at the same time, it made them mislabeled as malloc'd ones - the correct
1534 way to label mapped regions is to use a VM tag.
1536 So, it makes more sense to remove it completely than to make it work with multiple heaps.
1538 * JavaScriptCore.exp:
1539 * JavaScriptCore.xcodeproj/project.pbxproj:
1540 * kjs/AllInOneFile.cpp:
1541 * kjs/InitializeThreading.cpp:
1542 (KJS::initializeThreading):
1543 * kjs/collector.cpp:
1545 * kjs/CollectorHeapIntrospector.cpp: Removed.
1546 * kjs/CollectorHeapIntrospector.h: Removed.
1548 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1552 <rdar://problem/5951532> JSProfiler: Implement heavy (or bottom-up)
1554 - Implemented the time and call count portionof heavy. Now all that we
1557 * profiler/CallIdentifier.h: Removed an unused constructor.
1558 * profiler/HeavyProfile.cpp:
1559 (KJS::HeavyProfile::HeavyProfile): Set the initial time of the head
1560 node so that percentages work correctly.
1561 (KJS::HeavyProfile::mergeProfiles): Sum the times and call count of
1563 * profiler/ProfileNode.cpp: Set the intital values of time and call
1564 count when copying ProfileNodes.
1565 (KJS::ProfileNode::ProfileNode):
1567 2008-07-10 Jan Michael Alonzo <jmalonzo@webkit.org>
1571 * GNUmakefile.am: Add HeavyProfile.cpp
1573 2008-07-09 Mark Rowe <mrowe@apple.com>
1575 Reviewed by Geoff Garen.
1577 Don't warn about deprecated functions in production builds.
1579 * Configurations/Base.xcconfig:
1580 * Configurations/DebugRelease.xcconfig:
1582 2008-07-09 Darin Adler <darin@apple.com>
1584 * JavaScriptCore.pri: Fix Qt build by adding HeavyProfile.cpp.
1586 2008-07-09 Kevin Ollivier <kevino@theolliviers.com>
1588 wx biuld fix. Add HeavyProfile.cpp to build files.
1590 * JavaScriptCoreSources.bkl:
1592 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1594 - Windows build fix.
1596 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1598 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1602 * profiler/HeavyProfile.cpp:
1603 (KJS::HeavyProfile::mergeProfiles):
1605 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1607 Reviewed by Geoff and Adam.
1609 <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
1610 - This is the plumbing for bottom-up, but does not include calculating
1611 time, mostly because I'm still undclear about what the end result should
1613 - This, obviously, does not include the UI to expose this in the
1616 * JavaScriptCore.xcodeproj/project.pbxproj:
1617 * profiler/CallIdentifier.h:
1618 (KJS::CallIdentifier::CallIdentifier):
1619 (WTF::): Added HashTraits for CallIdentifiers to be used by a HashMap.
1620 * profiler/HeavyProfile.cpp: Added.
1621 (KJS::HeavyProfile::HeavyProfile):
1622 (KJS::HeavyProfile::generateHeavyStructure):
1623 (KJS::HeavyProfile::addNode):
1624 (KJS::HeavyProfile::mergeProfiles):
1625 (KJS::HeavyProfile::addAncestorsAsChildren):
1626 * profiler/HeavyProfile.h: Added.
1627 (KJS::HeavyProfile::create):
1628 (KJS::HeavyProfile::heavyProfile):
1629 (KJS::HeavyProfile::treeProfile):
1630 * profiler/Profile.cpp: Removed old commented out includes.
1631 * profiler/Profile.h: The m_head is needed by the HeavyProfile so it
1632 is now protected as opposed to private.
1633 * profiler/ProfileNode.cpp:
1634 (KJS::ProfileNode::ProfileNode): Created a constructor to copy
1636 (KJS::ProfileNode::findChild): Added a null check to make HeavyProfile
1637 children finding easier and avoid a potential crasher.
1638 * profiler/ProfileNode.h: Mostly moved things around but also added some
1639 functionality needed by HeavyProfile.
1640 (KJS::ProfileNode::create):
1641 (KJS::ProfileNode::functionName):
1642 (KJS::ProfileNode::url):
1643 (KJS::ProfileNode::lineNumber):
1644 (KJS::ProfileNode::head):
1645 (KJS::ProfileNode::setHead):
1646 (KJS::ProfileNode::setNextSibling):
1647 (KJS::ProfileNode::actualTotalTime):
1648 (KJS::ProfileNode::actualSelfTime):
1649 * profiler/TreeProfile.cpp: Implemented the ability to get a
1651 (KJS::TreeProfile::heavyProfile):
1652 * profiler/TreeProfile.h:
1654 2008-07-08 Geoffrey Garen <ggaren@apple.com>
1656 Reviewed by Oliver Hunt.
1658 Added support for checking if an object has custom properties in its
1659 property map. WebCore uses this to optimize marking DOM wrappers.
1661 2008-07-08 Simon Hausmann <hausmann@webkit.org>
1663 Prospective Gtk/Wx build fixes, add ProfileGenerator.cpp to the build.
1666 * JavaScriptCoreSources.bkl:
1668 2008-07-08 Simon Hausmann <hausmann@webkit.org>
1670 Fix the Qt build, add ProfileGenerator.cpp to the build.
1672 * JavaScriptCore.pri:
1674 2008-07-07 David Kilzer <ddkilzer@apple.com>
1676 releaseFastMallocFreeMemory() should always be defined
1680 * JavaScriptCore.exp: Changed to export C++ binding for
1681 WTF::releaseFastMallocFreeMemory() instead of C binding for
1682 releaseFastMallocFreeMemory().
1683 * wtf/FastMalloc.cpp: Moved definitions of
1684 releaseFastMallocFreeMemory() to be in the WTF namespace
1685 regardless whether FORCE_SYSTEM_MALLOC is defined.
1686 * wtf/FastMalloc.h: Moved releaseFastMallocFreeMemory() from
1687 extern "C" binding to WTF::releaseFastMallocFreeMemory().
1689 2008-07-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1693 Bug 19926: URL causes crash within a minute
1694 <https://bugs.webkit.org/show_bug.cgi?id=19926>
1696 Add a check that lastGlobalObject is non-null in Machine::execute()
1697 before copying its globals to the current register file.
1699 In theory, it is possible to make a test case for this, but it will
1700 take a while to get it right.
1703 (KJS::Machine::execute):
1705 2008-07-07 Darin Adler <darin@apple.com>
1707 Rubber stamped by Adele.
1710 (KJS::Machine::privateExecute): Fix a typo in a comment.
1712 2008-07-07 Steve Falkenburg <sfalken@apple.com>
1716 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1717 * JavaScriptCore.vcproj/testapi/testapi.vcproj:
1719 2008-07-07 Kevin McCullough <kmccullough@apple.com>
1723 When the profiler is running it gathers information and creates a
1724 Profile. After it finishes the Profile can be sorted and have other
1725 data refinements run over it. Both of these were done in the same class
1726 before. Now I split the gathering operations into a new class called
1729 * JavaScriptCore.xcodeproj/project.pbxproj:
1730 * profiler/Profile.cpp: Removed code related to the gather stage of a
1732 (KJS::Profile::create):
1733 (KJS::Profile::Profile):
1734 * profiler/Profile.h: Ditto.
1735 (KJS::Profile::title):
1736 (KJS::Profile::callTree):
1737 (KJS::Profile::setHead):
1738 * profiler/ProfileGenerator.cpp: Added. This is the class that will
1739 handle the stage of creating a Profile. Once the Profile is finished
1740 being created, this class goes away.
1741 (KJS::ProfileGenerator::create):
1742 (KJS::ProfileGenerator::ProfileGenerator):
1743 (KJS::ProfileGenerator::title):
1744 (KJS::ProfileGenerator::willExecute):
1745 (KJS::ProfileGenerator::didExecute):
1746 (KJS::ProfileGenerator::stopProfiling):
1747 (KJS::ProfileGenerator::didFinishAllExecution):
1748 (KJS::ProfileGenerator::removeProfileStart):
1749 (KJS::ProfileGenerator::removeProfileEnd):
1750 * profiler/ProfileGenerator.h: Added.
1751 (KJS::ProfileGenerator::profile):
1752 (KJS::ProfileGenerator::originatingGlobalExec):
1753 (KJS::ProfileGenerator::pageGroupIdentifier):
1754 (KJS::ProfileGenerator::client):
1755 (KJS::ProfileGenerator::stoppedProfiling):
1756 * profiler/Profiler.cpp: Now operates with the ProfileGenerator instead
1758 (KJS::Profiler::startProfiling):
1759 (KJS::Profiler::stopProfiling):
1760 (KJS::Profiler::didFinishAllExecution): It is here that the Profile is
1761 handed off to its client and the Profile Generator is no longer needed.
1762 (KJS::dispatchFunctionToProfiles):
1763 (KJS::Profiler::willExecute):
1764 (KJS::Profiler::didExecute):
1765 * profiler/Profiler.h: Cleaned up the includes and subsequently the
1766 forward declarations. Also use the new ProfileGenerator.
1767 (KJS::ProfilerClient::~ProfilerClient):
1768 (KJS::Profiler::currentProfiles):
1769 * profiler/TreeProfile.cpp: Use Profile's new interface.
1770 (KJS::TreeProfile::create):
1771 (KJS::TreeProfile::TreeProfile):
1772 * profiler/TreeProfile.h:
1774 2008-07-07 Sam Weinig <sam@webkit.org>
1776 Reviewed by Cameron Zwarich.
1778 Third step in broad cleanup effort.
1780 [ File list elided ]
1782 2008-07-06 Sam Weinig <sam@webkit.org>
1784 Reviewed by Cameron Zwarich.
1786 Second step in broad cleanup effort.
1788 [ File list elided ]
1790 2008-07-05 Sam Weinig <sam@webkit.org>
1792 Reviewed by Cameron Zwarich.
1794 First step in broad cleanup effort.
1796 [ File list elided ]
1798 2008-07-05 Sam Weinig <sam@webkit.org>
1800 Rubber-stamped by Cameron Zwarich.
1802 Rename list.h/cpp to ArgList.h/cpp.
1805 * JavaScriptCore.pri:
1806 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1807 * JavaScriptCore.xcodeproj/project.pbxproj:
1808 * JavaScriptCoreSources.bkl:
1810 * kjs/AllInOneFile.cpp:
1811 * kjs/ArgList.cpp: Copied from JavaScriptCore/kjs/list.cpp.
1812 * kjs/ArgList.h: Copied from JavaScriptCore/kjs/list.h.
1813 * kjs/IndexToNameMap.cpp:
1814 * kjs/JSGlobalData.cpp:
1815 * kjs/JSGlobalData.h:
1817 * kjs/collector.cpp:
1818 * kjs/list.cpp: Removed.
1819 * kjs/list.h: Removed.
1821 2008-07-05 Sam Weinig <sam@webkit.org>
1823 Fix non-AllInOne builds again.
1825 * kjs/BooleanPrototype.cpp:
1826 * kjs/ErrorPrototype.cpp:
1827 * kjs/FunctionPrototype.cpp:
1828 * kjs/NumberPrototype.cpp:
1829 * kjs/ObjectPrototype.cpp:
1831 2008-07-05 Sam Weinig <sam@webkit.org>
1833 Fix build on case-sensitive build systems.
1835 * kjs/IndexToNameMap.cpp:
1837 2008-07-05 Sam Weinig <sam@webkit.org>
1841 * kjs/Arguments.cpp:
1842 * kjs/BooleanPrototype.cpp:
1843 * kjs/DateConstructor.cpp:
1844 * kjs/ErrorPrototype.cpp:
1845 * kjs/FunctionPrototype.cpp:
1846 * kjs/NumberPrototype.cpp:
1847 * kjs/ObjectPrototype.cpp:
1848 * kjs/RegExpPrototype.cpp:
1849 * kjs/StringConstructor.cpp:
1852 2008-07-05 Sam Weinig <sam@webkit.org>
1854 Fix non-AllInOne build.
1856 * kjs/JSGlobalObject.cpp:
1858 2008-07-05 Sam Weinig <sam@webkit.org>
1860 Rubber-stamped by Cameron Zwarich.
1862 Split Arguments, IndexToNameMap, PrototypeFunction, GlobalEvalFunction and
1863 the functions on the global object out of JSFunction.h/cpp.
1866 * JavaScriptCore.pri:
1867 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1868 * JavaScriptCore.xcodeproj/project.pbxproj:
1869 * JavaScriptCoreSources.bkl:
1871 * kjs/AllInOneFile.cpp:
1872 * kjs/Arguments.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1873 * kjs/Arguments.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1874 * kjs/GlobalEvalFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1875 * kjs/GlobalEvalFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1876 * kjs/IndexToNameMap.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1877 * kjs/IndexToNameMap.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1878 * kjs/JSActivation.cpp:
1879 * kjs/JSFunction.cpp:
1881 * kjs/JSGlobalObject.cpp:
1882 * kjs/JSGlobalObjectFunctions.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1883 * kjs/JSGlobalObjectFunctions.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1884 The functions on the global object should be in JSGlobalObject.cpp, but putting them there
1885 was a 0.5% regression.
1887 * kjs/PrototypeFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1888 * kjs/PrototypeFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1893 2008-07-04 Sam Weinig <sam@webkit.org>
1895 Really fix the mac build.
1897 * JavaScriptCore.xcodeproj/project.pbxproj:
1899 2008-07-04 Sam Weinig <sam@webkit.org>
1903 * JavaScriptCore.xcodeproj/project.pbxproj:
1905 2008-07-04 Sam Weinig <sam@webkit.org>
1907 Fix non-AllInOne builds.
1910 * kjs/GetterSetter.cpp:
1911 * kjs/JSImmediate.cpp:
1912 * kjs/operations.cpp:
1914 2008-07-04 Sam Weinig <sam@webkit.org>
1916 Rubber-stamped by Dan Bernstein.
1918 Split Error and GetterSetter out of JSObject.h.
1920 * API/JSCallbackObjectFunctions.h:
1922 * JavaScriptCore.pri:
1923 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1924 * JavaScriptCore.xcodeproj/project.pbxproj:
1925 * JavaScriptCoreSources.bkl:
1926 * kjs/AllInOneFile.cpp:
1927 * kjs/ClassInfo.h: Copied from JavaScriptCore/kjs/JSObject.h.
1928 * kjs/Error.cpp: Copied from JavaScriptCore/kjs/JSObject.cpp.
1929 * kjs/Error.h: Copied from JavaScriptCore/kjs/JSObject.h.
1930 * kjs/GetterSetter.cpp:
1931 * kjs/GetterSetter.h: Copied from JavaScriptCore/kjs/JSObject.h.
1936 2008-07-04 Simon Hausmann <hausmann@webkit.org>
1938 Fix the Wx build, added TreeProfile.cpp to the build.
1940 * JavaScriptCoreSources.bkl:
1942 2008-07-03 Mark Rowe <mrowe@apple.com>
1944 Reviewed by Oliver Hunt.
1946 Fix output path of recently-added script phase to reference the correct file.
1947 This prevents Xcode from running the script phase unnecessarily, which caused
1948 the generated header to be recreated and lead to AllInOneFile.cpp rebuilding.
1950 * JavaScriptCore.xcodeproj/project.pbxproj:
1952 2008-07-03 Mark Rowe <mrowe@apple.com>
1954 Follow-up to the 64-bit build fix. Use intptr_t rather than ssize_t as
1955 the latter is non-standard and does not exist on Windows.
1958 (KJS::JSLock::lockCount):
1959 (KJS::JSLock::lock):
1960 (KJS::JSLock::unlock):
1961 (KJS::JSLock::DropAllLocks::DropAllLocks):
1964 2008-07-02 Mark Rowe <mrowe@apple.com>
1966 Fix the 64-bit build. pthread_getspecific works with pointer-sized values,
1967 so use ssize_t rather than int to track the lock count to avoid warnings about
1968 truncating the result of pthread_getspecific.
1971 (KJS::JSLock::lockCount):
1972 (KJS::JSLock::lock):
1973 (KJS::JSLock::unlock):
1974 (KJS::JSLock::DropAllLocks::DropAllLocks):
1977 2008-07-03 Geoffrey Garen <ggaren@apple.com>
1979 Reviewed by Sam Weinig.
1981 Removed checking for the array get/put fast case from the array code.
1982 Callers who want the fast case should call getIndex and/or setIndex
1983 instead. (get_by_val and put_by_val already do this.)
1985 SunSpider reports no change overall, but a 1.4% speedup on fannkuch and
1986 a 3.6% speedup on nsieve.
1988 2008-07-03 Dan Bernstein <mitz@apple.com>
1992 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added TreeProfile.{h,cpp}.
1994 2008-07-03 Dan Bernstein <mitz@apple.com>
1996 Reviewed by Anders Carlsson.
2001 (KJS::Machine::Machine):
2003 2008-07-03 Simon Hausmann <hausmann@webkit.org>
2005 Reviewed by Alexey Proskuryakov.
2007 Fix the non-threaded build.
2009 * kjs/JSGlobalData.cpp:
2010 (KJS::JSGlobalData::threadInstanceInternal):
2012 2008-07-03 Simon Hausmann <hausmann@webkit.org>
2014 Fix the Qt build, added TreeProfile to the build.
2016 * JavaScriptCore.pri:
2018 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
2022 Don't create unnecessary JSGlobalData instances.
2024 * kjs/JSGlobalData.h:
2025 * kjs/JSGlobalData.cpp:
2026 (KJS::JSGlobalData::threadInstanceExists):
2027 (KJS::JSGlobalData::sharedInstanceExists):
2028 (KJS::JSGlobalData::threadInstance):
2029 (KJS::JSGlobalData::sharedInstance):
2030 (KJS::JSGlobalData::threadInstanceInternal):
2031 (KJS::JSGlobalData::sharedInstanceInternal):
2032 Added methods to query instance existence.
2034 * kjs/InitializeThreading.cpp:
2035 (KJS::initializeThreadingOnce):
2036 Initialize thread instance static in a new way.
2040 * kjs/collector.cpp:
2041 (KJS::Heap::collect):
2042 Check for instance existence before accessing it.
2044 2008-07-02 Geoffrey Garen <ggaren@apple.com>
2046 Reviewed by Cameron Zwarich.
2048 Fixed https://bugs.webkit.org/show_bug.cgi?id=19862
2049 REGRESSION (r34907): Gmail crashes in JavaScriptCore code while editing drafts
2051 I was never able to reproduce this issue, but Cameron could, and he says
2052 that this patch fixes it.
2054 The crash seems tied to a timer or event handler callback. In such a case,
2055 the sole reference to the global object may be in the current call frame,
2056 so we can't depend on the global object to mark the call frame area in
2059 The new GC marking rule is: the global object is not responsible for
2060 marking the whole register file -- it's just responsible for the globals
2061 section it's tied to. The heap is responsible for marking the call frame area.
2063 2008-07-02 Mark Rowe <mrowe@apple.com>
2065 Reviewed by Sam Weinig.
2067 Add the ability to trace JavaScriptCore garabge collections using dtrace.
2069 * JavaScriptCore.xcodeproj/project.pbxproj: Generate the dtrace probe header
2070 file when building on a new enough version of Mac OS X.
2071 * JavaScriptCorePrefix.h: Add our standard Mac OS X version detection macros.
2072 * kjs/Tracing.d: Declare three dtrace probes.
2073 * kjs/Tracing.h: Include the generated dtrace macros if dtrace is available,
2074 otherwise provide versions that do nothing.
2075 * kjs/collector.cpp:
2076 (KJS::Heap::collect): Fire dtrace probes when starting a collection, after the
2077 mark phase has completed, and when the collection is complete.
2078 * wtf/Platform.h: Define HAVE_DTRACE when building on a new enough version of Mac OS X.
2080 2008-07-02 Geoffrey Garen <ggaren@apple.com>
2082 Rubber stamped by Oliver Hunt.
2084 Reduced the max register file size from 8MB to 2MB.
2086 We still allow about 20,000 levels of recursion.
2088 2008-07-02 Alp Toker <alp@nuanti.com>
2090 Build fix for r34960. Add TreeProfile.cpp to build.
2094 2008-07-02 Geoffrey Garen <ggaren@apple.com>
2096 Reviewed by Oliver Hunt.
2098 Optimized a[n] get for cases when a is an array or a string. When a is
2099 an array, we optimize both get and put. When a is a string, we only
2100 optimize get, since you can't put to a string.
2102 SunSpider says 3.4% faster.
2104 2008-07-02 Kevin McCullough <kmccullough@apple.com>
2108 -Small cleanup in preparation for implementing Bottom-up.
2110 * profiler/CallIdentifier.h: Rename debug function to make it clear of
2111 its output and intention to be debug only.
2112 (KJS::CallIdentifier::operator const char* ): Implement in terms of
2114 (KJS::CallIdentifier::c_str):
2115 * profiler/ProfileNode.cpp: Impelment findChild() which will be needed
2116 by the bottom-up implementation.
2117 (KJS::ProfileNode::findChild):
2118 * profiler/ProfileNode.h: Added comments to make the collections of
2119 functions more clear.
2120 (KJS::ProfileNode::operator==):
2121 (KJS::ProfileNode::c_str):
2123 2008-07-02 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2127 Bug 19776: Number.toExponential() is incorrect for numbers between 0.1 and 1
2128 <https://bugs.webkit.org/show_bug.cgi?id=19776>
2130 Perform the sign check for the exponent on the actual exponent value,
2131 which is 1 less than the value of decimalPoint, instead of on the value
2132 of decimalPoint itself.
2134 * kjs/NumberPrototype.cpp:
2135 (KJS::exponentialPartToString):
2137 2008-07-02 Kevin McCullough <kmccullough@apple.com>
2141 <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
2142 - Subclass TreeProfile as I prepare for a HeavyProfile to be comming
2145 * JavaScriptCore.xcodeproj/project.pbxproj:
2146 * profiler/Profile.cpp: By default we create a TreeProfile.
2147 (KJS::Profile::create):
2148 * profiler/Profile.h: Changes to the Profile class to make it amenable
2149 to be inherited from.
2150 (KJS::Profile::~Profile):
2151 * profiler/TreeProfile.cpp: Added.
2152 (KJS::TreeProfile::create):
2153 (KJS::TreeProfile::TreeProfile):
2154 (KJS::TreeProfile::heavyProfile):
2155 * profiler/TreeProfile.h: Added.
2156 (KJS::TreeProfile::treeProfile):
2158 2008-07-02 Kevin McCullough <kmccullough@apple.com>
2162 Broke CallIdentifier out into its own file. I did this because it's
2163 going to grow a lot soon and I wanted this to be a separate patch.
2165 * JavaScriptCore.xcodeproj/project.pbxproj:
2166 * profiler/CallIdentifier.h: Added.
2167 (KJS::CallIdentifier::CallIdentifier):
2168 (KJS::CallIdentifier::operator==):
2169 (KJS::CallIdentifier::operator!=):
2170 (KJS::CallIdentifier::operator const char* ):
2171 (KJS::CallIdentifier::toString):
2172 * profiler/ProfileNode.h:
2174 2008-07-02 Simon Hausmann <hausmann@webkit.org>
2176 Build fix. Implemented missing functions for single-threaded build.
2179 (KJS::JSLock::JSLock):
2180 (KJS::JSLock::lock):
2181 (KJS::JSLock::unlock):
2182 (KJS::JSLock::DropAllLocks::DropAllLocks):
2184 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
2186 Another non-AllInOne build fix.
2188 * kjs/JSGlobalObject.cpp: Include JSLock.h here, too.
2190 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
2192 Non-AllInOne build fix.
2194 * kjs/interpreter.cpp: Include JSLock.h.
2196 2008-06-30 Alexey Proskuryakov <ap@webkit.org>
2200 Disable JSLock for per-thread contexts.
2202 No change on SunSpider.
2204 * kjs/JSGlobalData.h:
2205 * kjs/JSGlobalData.cpp:
2206 (KJS::JSGlobalData::JSGlobalData):
2207 (KJS::JSGlobalData::sharedInstance):
2208 Added isSharedInstance as a better way to tell whether the instance is shared (legacy).
2211 (KJS::createJSLockCount):
2212 (KJS::JSLock::lockCount):
2213 (KJS::setLockCount):
2214 (KJS::JSLock::JSLock):
2215 (KJS::JSLock::lock):
2216 (KJS::JSLock::unlock):
2217 (KJS::JSLock::currentThreadIsHoldingLock):
2218 (KJS::JSLock::DropAllLocks::DropAllLocks):
2219 (KJS::JSLock::DropAllLocks::~DropAllLocks):
2221 (KJS::JSLock::JSLock):
2222 (KJS::JSLock::~JSLock):
2223 Made JSLock and JSLock::DropAllLocks constructors take a parameter to decide whether to
2224 actually lock a mutex, or only to increment recursion count. We cannot turn it into no-op
2225 if we want to keep existing assertions working.
2226 Made recursion count per-thread, now that locks may not lock.
2229 (JSEvaluateScript): Take JSLock after casting JSContextRef to ExecState* (which doesn't need
2230 locking in any case), so that a decision whether to actually lock can be made.
2231 (JSCheckScriptSyntax): Ditto.
2232 (JSGarbageCollect): Only lock while collecting the shared heap, not the per-thread one.
2234 * API/JSObjectRef.cpp:
2235 (JSClassCreate): Don't lock, as there is no reason to.
2236 (JSClassRetain): Ditto.
2237 (JSClassRelease): Ditto.
2238 (JSPropertyNameArrayRetain): Ditto.
2239 (JSPropertyNameArrayRelease): Only lock while deleting the array, as that may touch
2241 (JSPropertyNameAccumulatorAddName): Adding a string also involves an identifier table
2242 lookup, and possibly modification.
2244 * API/JSStringRef.cpp:
2245 (JSStringCreateWithCharacters):
2246 (JSStringCreateWithUTF8CString):
2249 (JSStringGetUTF8CString):
2251 * API/JSStringRefCF.cpp:
2252 (JSStringCreateWithCFString):
2253 JSStringRef operations other than releasing do not need locking.
2255 * VM/Machine.cpp: Don't include unused JSLock.h.
2257 * kjs/CollectorHeapIntrospector.cpp: (KJS::CollectorHeapIntrospector::statistics):
2258 Don't take the lock for real, as heap introspection pauses the process anyway. It seems that
2259 the existing code could cause deadlocks.
2265 The test tool uses a per-thread context, so no real locking is required.
2268 (KJS::Heap::setGCProtectNeedsLocking): Optionally protect m_protectedValues access with a
2269 per-heap mutex. This is only needed for WebCore Database code, which violates the "no data
2270 migration between threads" by using ProtectedPtr on a background thread.
2271 (KJS::Heap::isShared): Keep a shared flag here, as well.
2274 (KJS::::ProtectedPtr):
2275 (KJS::::~ProtectedPtr):
2279 ProtectedPtr is ony used from WebCore, so it doesn't need to take JSLock. An assertion in
2280 Heap::protect/unprotect guards agains possible future unlocked uses of ProtectedPtr in JSC.
2282 * kjs/collector.cpp:
2283 (KJS::Heap::Heap): Initialize m_isShared.
2284 (KJS::Heap::~Heap): No need to lock for real during destruction, but must keep assertions
2286 (KJS::destroyRegisteredThread): Registered thread list is only accessed for shared heap,
2287 so locking is always needed here.
2288 (KJS::Heap::registerThread): Ditto.
2289 (KJS::Heap::markStackObjectsConservatively): Use m_isShared instead of comparing to a shared
2290 instance for a small speedup.
2291 (KJS::Heap::setGCProtectNeedsLocking): Create m_protectedValuesMutex. There is currently no
2292 way to undo this - and ideally, Database code will be fixed to lo longer require this quirk.
2293 (KJS::Heap::protect): Take m_protectedValuesMutex (if it exists) while accessing
2295 (KJS::Heap::unprotect): Ditto.
2296 (KJS::Heap::markProtectedObjects): Ditto.
2297 (KJS::Heap::protectedGlobalObjectCount): Ditto.
2298 (KJS::Heap::protectedObjectCount): Ditto.
2299 (KJS::Heap::protectedObjectTypeCounts): Ditto.
2303 Don't include JSLock.h, which is no longer used here. As a result, an explicit include had
2304 to be added to many files in JavaScriptGlue, WebCore and WebKit.
2306 * kjs/JSGlobalObject.cpp:
2307 (KJS::JSGlobalObject::init):
2308 * API/JSCallbackConstructor.cpp:
2309 (KJS::constructJSCallback):
2310 * API/JSCallbackFunction.cpp:
2311 (KJS::JSCallbackFunction::call):
2312 * API/JSCallbackObjectFunctions.h:
2314 (KJS::::getOwnPropertySlot):
2316 (KJS::::deleteProperty):
2318 (KJS::::hasInstance):
2320 (KJS::::getPropertyNames):
2323 (KJS::::staticValueGetter):
2324 (KJS::::callbackGetter):
2325 * API/JSContextRef.cpp:
2326 (JSGlobalContextCreate):
2327 (JSGlobalContextRetain):
2328 (JSGlobalContextRelease):
2329 * API/JSValueRef.cpp:
2331 (JSValueIsStrictEqual):
2332 (JSValueIsInstanceOfConstructor):
2333 (JSValueMakeNumber):
2334 (JSValueMakeString):
2336 (JSValueToStringCopy):
2340 * JavaScriptCore.exp:
2341 * kjs/PropertyNameArray.h:
2342 (KJS::PropertyNameArray::globalData):
2343 * kjs/interpreter.cpp:
2344 (KJS::Interpreter::checkSyntax):
2345 (KJS::Interpreter::evaluate):
2346 Pass a parameter to JSLock/JSLock::DropAllLocks to decide whether the lock needs to be taken.
2348 2008-07-01 Alexey Proskuryakov <ap@webkit.org>
2352 https://bugs.webkit.org/show_bug.cgi?id=19834
2353 Failed assertion in JavaScriptCore/VM/SegmentedVector.h:82
2355 Creating a global object with a custom prototype resets it twice (wasteful!).
2356 So, addStaticGlobals() was called twice, but JSGlobalObject::reset() didn't reset
2359 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::reset): Call setRegisterArray(0, 0).
2361 * kjs/JSVariableObject.h: Changed registerArray to OwnArrayPtr. Also, added private copy
2362 constructor and operator= to ensure that no one attempts to copy this object (for whatever
2363 reason, I couldn't make Noncopyable work).
2365 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::addStaticGlobals): Allocate registerArray
2368 * kjs/JSVariableObject.cpp:
2369 (KJS::JSVariableObject::copyRegisterArray): Allocate registerArray with new[].
2370 (KJS::JSVariableObject::setRegisterArray): Avoid hitting an assertion in OwnArrayPtr when
2371 "changing" the value from 0 to 0.
2373 2008-07-01 Geoffrey Garen <ggaren@apple.com>
2375 Reviewed by Oliver Hunt.
2377 Removed and/or reordered exception checks in array-style a[n] access.
2379 SunSpider says 1.4% faster.
2382 (KJS::Machine::privateExecute): No need to check for exceptions before
2383 calling toString, toNumber and/or get. If the call ends up being observable
2384 through toString, valueOf, or a getter, we short-circuit it there, instead.
2385 In the op_del_by_val case, I removed the incorrect comment without actually
2386 removing the code, since I didn't want to tempt the GCC fates!
2389 (KJS::callDefaultValueFunction): Added exception check to prevent
2390 toString and valueOf functions from observing execution after an exception
2391 has been thrown. This removes some of the burden of exception checking
2394 (KJS::JSObject::defaultValue): Removed redundant exception check here.
2396 * kjs/PropertySlot.cpp:
2397 (KJS::PropertySlot::functionGetter): Added exception check to prevent
2398 getter functions from observing execution after an exception has been
2399 thrown. This removes some of the burden of exception checking from the
2402 2008-07-01 Geoffrey Garen <ggaren@apple.com>
2404 Reviewed by Oliver Hunt.
2406 Optimized a[n] get and put for cases where n is an immediate unsigned
2409 SunSpider says 3.5% faster.
2411 2008-07-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2415 Bug 19844: JavaScript Switch statement modifies "this"
2416 <https://bugs.webkit.org/show_bug.cgi?id=19844>
2418 Use a temporary when generating code for switch clauses to avoid
2419 overwriting 'this' or a local variable.
2422 (KJS::CaseBlockNode::emitCodeForBlock):
2424 2008-07-01 Christian Dywan <christian@twotoasts.de>
2428 * kjs/list.cpp: Include "JSCell.h"
2430 2008-07-01 Kevin McCullough <kmccullough@apple.com>
2434 * JavaScriptCore.xcodeproj/project.pbxproj:
2436 2008-07-01 Dan Bernstein <mitz@apple.com>
2438 Reviewed by Anders Carlsson.
2440 - Mac release build fix
2442 * JavaScriptCore.exp:
2444 2008-07-01 Sam Weinig <sam@webkit.org>
2446 Try and fix mac builds.
2448 * JavaScriptCore.exp:
2450 2008-07-01 Sam Weinig <sam@webkit.org>
2452 Fix non-AllInOne builds.
2456 2008-07-01 Sam Weinig <sam@webkit.org>
2458 Reviewed by Darin Adler.
2460 Split JSCell and JSNumberCell class declarations out of JSValue.h
2463 * JavaScriptCore.pri:
2464 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2465 * JavaScriptCore.xcodeproj/project.pbxproj:
2466 * JavaScriptCoreSources.bkl:
2467 * VM/JSPropertyNameIterator.h:
2468 * kjs/AllInOneFile.cpp:
2469 * kjs/JSCell.cpp: Copied from JavaScriptCore/kjs/JSValue.cpp.
2470 * kjs/JSCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
2471 (KJS::JSValue::getJSNumber):
2472 * kjs/JSNumberCell.cpp:
2473 * kjs/JSNumberCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
2477 (KJS::jsOwnedString):
2479 (KJS::JSValue::toThisJSString):
2483 2008-07-01 Anders Carlsson <andersca@apple.com>
2487 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2488 * kjs/JSGlobalObject.h:
2489 (KJS::JSGlobalObject::addStaticGlobals):
2491 2008-07-01 Simon Hausmann <hausmann@webkit.org>
2493 Build fix, include OwnPtr.h.
2495 * kjs/RegExpConstructor.h:
2497 2008-06-30 Geoffrey Garen <ggaren@apple.com>
2499 Reviewed by Oliver Hunt.
2501 Fixed a global object leak caused by the switch to one register file.
2503 Don't unconditionally mark the register file, since that logically
2504 makes all global variables GC roots, even when their global object is
2505 no longer reachable.
2507 Instead, make the global object associated with the register file
2508 responsible for marking the register file.
2510 2008-06-30 Geoffrey Garen <ggaren@apple.com>
2512 Reviewed by Oliver Hunt.
2514 Removed the "registerBase" abstraction. Since the register file never
2515 reallocates, we can keep direct pointers into it, instead of
2516 <registerBase, offset> tuples.
2518 SunSpider says 0.8% faster.
2520 2008-06-30 Oliver Hunt <oliver@apple.com>
2522 Reviewed by NOBODY (build fix).
2524 Fix build by adding all (hopefully) the missing includes.
2526 * kjs/BooleanPrototype.cpp:
2527 * kjs/DateConstructor.cpp:
2528 * kjs/ErrorPrototype.cpp:
2529 * kjs/FunctionPrototype.cpp:
2530 * kjs/NativeErrorConstructor.cpp:
2531 * kjs/NumberPrototype.cpp:
2532 * kjs/ObjectPrototype.cpp:
2533 * kjs/RegExpConstructor.cpp:
2534 * kjs/StringConstructor.cpp:
2535 * kjs/StringPrototype.cpp:
2537 2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2541 Bug 19830: REGRESSION (r34883): Google Reader doesn't show up feed list on sidebar
2542 <https://bugs.webkit.org/show_bug.cgi?id=19830>
2544 Ensure that we do not eliminate a write to a local register when doing
2545 peephole optimizations.
2547 * VM/CodeGenerator.cpp:
2548 (KJS::CodeGenerator::emitJumpIfTrue):
2549 (KJS::CodeGenerator::emitJumpIfFalse):
2551 2008-06-30 Sam Weinig <sam@webkit.org>
2553 Rubber-stamped by Darin Alder.
2555 Split InternalFunction into its own header file.
2557 * API/JSCallbackFunction.h:
2558 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2559 * JavaScriptCore.xcodeproj/project.pbxproj:
2560 * kjs/ArrayConstructor.h:
2561 * kjs/BooleanConstructor.h:
2562 * kjs/DateConstructor.h:
2563 * kjs/ErrorConstructor.h:
2564 * kjs/FunctionConstructor.h:
2565 * kjs/FunctionPrototype.h:
2566 * kjs/InternalFunction.h: Copied from kjs/JSFunction.h.
2568 * kjs/NativeErrorConstructor.h:
2569 * kjs/NumberConstructor.h:
2570 * kjs/ObjectConstructor.h:
2571 * kjs/RegExpConstructor.h:
2572 * kjs/StringConstructor.h:
2573 * profiler/Profiler.cpp:
2575 2008-06-30 Sam Weinig <sam@webkit.org>
2577 Reviewed by Kevin McCullough.
2579 Remove empty files Instruction.cpp, LabelID.cpp, Register.cpp and RegisterID.cpp.
2582 * JavaScriptCore.pri:
2583 * JavaScriptCore.xcodeproj/project.pbxproj:
2584 * JavaScriptCoreSources.bkl:
2585 * VM/Instruction.cpp: Removed.
2586 * VM/LabelID.cpp: Removed.
2587 * VM/Register.cpp: Removed.
2588 * VM/RegisterID.cpp: Removed.
2590 2008-06-30 Sam Weinig <sam@webkit.org>
2592 Rubber-stamped (reluctantly) by Kevin McCullough.
2594 Rename date_object.h/cpp to DateInstance.h/cpp
2597 * JavaScriptCore.pri:
2598 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2599 * JavaScriptCore.xcodeproj/project.pbxproj:
2600 * JavaScriptCoreSources.bkl:
2601 * kjs/AllInOneFile.cpp:
2602 * kjs/DateConstructor.cpp:
2603 * kjs/DateInstance.cpp: Copied from kjs/date_object.cpp.
2604 * kjs/DateInstance.h: Copied from kjs/date_object.h.
2605 * kjs/DatePrototype.cpp:
2606 * kjs/DatePrototype.h:
2607 * kjs/date_object.cpp: Removed.
2608 * kjs/date_object.h: Removed.
2610 2008-06-30 Sam Weinig <sam@webkit.org>
2612 Rubber-stamped by Darin Adler.
2614 Remove internal.cpp and move its contents to there own .cpp files.
2617 * JavaScriptCore.pri:
2618 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2619 * JavaScriptCore.xcodeproj/project.pbxproj:
2620 * JavaScriptCoreSources.bkl:
2621 * kjs/AllInOneFile.cpp:
2622 * kjs/GetterSetter.cpp: Copied from kjs/internal.cpp.
2623 * kjs/InternalFunction.cpp: Copied from kjs/internal.cpp.
2624 * kjs/JSNumberCell.cpp: Copied from kjs/internal.cpp.
2625 * kjs/JSString.cpp: Copied from kjs/internal.cpp.
2627 * kjs/LabelStack.cpp: Copied from kjs/internal.cpp.
2628 * kjs/NumberConstructor.cpp:
2629 * kjs/NumberObject.cpp:
2630 (KJS::constructNumber):
2631 (KJS::constructNumberFromImmediateNumber):
2632 * kjs/internal.cpp: Removed.
2634 2008-06-30 Adam Roben <aroben@apple.com>
2636 Fix <rdar://5954749> Assertion failure due to HashTable's use of
2639 HashTable was passing &value to constructDeletedValue, which in
2640 classes like WebCore::COMPtr would cause an assertion. We now pass
2641 value by reference instead of by address so that the HashTraits
2642 implementations have more flexibility in constructing the deleted
2645 Reviewed by Ada Chan.
2647 * VM/CodeGenerator.h: Updated for changes to HashTraits.
2649 (WTF::::deleteBucket): Changed to pass bucket by reference instead of
2651 (WTF::::checkKey): Ditto.
2653 (WTF::): Updated HashTraits for HashTable change.
2655 2008-07-01 Alexey Proskuryakov <ap@webkit.org>
2657 Reviewed by Cameron Zwarich.
2659 Make RegisterFile really unmap memory on destruction.
2661 This fixes run-webkit-tests --threaded, which ran out of address space in a few seconds.
2663 * VM/RegisterFile.cpp: (KJS::RegisterFile::~RegisterFile): Unmap all the memory, not just
2666 * kjs/JSGlobalObject.h: Don't include RegisterFile.h, so that changes to it don't make
2667 half of WebCore rebuild.
2669 * VM/Machine.h: Don't forward declare RegisterFile, as RegisterFile.h is included already.
2671 * VM/RegisterFile.h: (KJS::RegisterFile::RegisterFile): Assert that the allocation succeeded.
2673 2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2675 Rubber-stamped by Oliver.
2677 Correct the documentation for op_put_by_index.
2680 (KJS::Machine::privateExecute):
2682 2008-06-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2686 Bug 19821: Merge the instruction pair (less, jfalse)
2687 <https://bugs.webkit.org/show_bug.cgi?id=19821>
2689 This is a 2.4% win on SunSpider. I needed to add an ALWAYS_INLINE
2690 intrinisc to CodeGenerator::rewindBinaryOp() to avoid a massive
2691 regression in regexp-dna.
2694 (KJS::CodeBlock::dump):
2695 * VM/CodeGenerator.cpp:
2696 (KJS::CodeGenerator::rewindBinaryOp):
2697 (KJS::CodeGenerator::emitJumpIfFalse):
2699 (KJS::Machine::privateExecute):
2704 2008-06-29 Sam Weinig <sam@webkit.org>
2706 Fix non-AllInOne builds.
2711 2008-06-29 Sam Weinig <sam@webkit.org>
2716 * kjs/DatePrototype.cpp:
2718 2008-06-29 Sam Weinig <sam@webkit.org>
2720 Rubber-stamped by Cameron Zwarich.
2722 Splits ErrorConstructor, ErrorPrototype, NativeErrorConstructor and
2723 NativeErrorPrototype out of error_object.h/cpp and renames it ErrorInstance.
2726 * JavaScriptCore.pri:
2727 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2728 * JavaScriptCore.xcodeproj/project.pbxproj:
2729 * JavaScriptCoreSources.bkl:
2730 * kjs/AllInOneFile.cpp:
2731 * kjs/ArrayConstructor.cpp:
2732 * kjs/ArrayPrototype.cpp:
2733 * kjs/BooleanPrototype.cpp:
2734 * kjs/DatePrototype.cpp:
2735 * kjs/ErrorConstructor.cpp: Copied from kjs/error_object.cpp.
2736 * kjs/ErrorConstructor.h: Copied from kjs/error_object.h.
2737 * kjs/ErrorInstance.cpp: Copied from kjs/error_object.cpp.
2738 * kjs/ErrorInstance.h: Copied from kjs/error_object.h.
2739 * kjs/ErrorPrototype.cpp: Copied from kjs/error_object.cpp.
2740 * kjs/ErrorPrototype.h: Copied from kjs/error_object.h.
2741 * kjs/JSGlobalObject.cpp:
2744 * kjs/NativeErrorConstructor.cpp: Copied from kjs/error_object.cpp.
2745 * kjs/NativeErrorConstructor.h: Copied from kjs/error_object.h.
2746 * kjs/NativeErrorPrototype.cpp: Copied from kjs/error_object.cpp.
2747 * kjs/NativeErrorPrototype.h: Copied from kjs/error_object.h.
2748 * kjs/NumberPrototype.cpp:
2749 * kjs/RegExpConstructor.cpp:
2750 * kjs/RegExpObject.cpp:
2751 * kjs/RegExpPrototype.cpp:
2752 * kjs/StringPrototype.cpp:
2753 * kjs/error_object.cpp: Removed.
2754 * kjs/error_object.h: Removed.
2757 2008-06-29 Sam Weinig <sam@webkit.org>
2759 Fix non-AllInOne build.
2761 * kjs/DateConstructor.cpp:
2765 2008-06-29 Sam Weinig <sam@webkit.org>
2767 Rubber-stamped by Oliver Hunt.
2769 Splits DateConstructor and DatePrototype out of date_object.h/cpp
2770 Moves shared Date code into DateMath.
2772 * DerivedSources.make:
2774 * JavaScriptCore.pri:
2775 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2776 * JavaScriptCore.xcodeproj/project.pbxproj:
2777 * JavaScriptCoreSources.bkl:
2778 * kjs/AllInOneFile.cpp:
2779 * kjs/DateConstructor.cpp: Copied from kjs/date_object.cpp.
2780 * kjs/DateConstructor.h: Copied from kjs/date_object.h.
2782 (KJS::ymdhmsToSeconds):
2784 (KJS::skipSpacesAndComments):
2789 (KJS::formatDateUTCVariant):
2793 * kjs/DatePrototype.cpp: Copied from kjs/date_object.cpp.
2794 * kjs/DatePrototype.h: Copied from kjs/date_object.h.
2795 * kjs/JSGlobalObject.cpp:
2797 * kjs/date_object.cpp:
2798 * kjs/date_object.h:
2801 2008-06-29 Jan Michael Alonzo <jmalonzo@webkit.org>
2803 Rubber-stamped by Cameron Zwarich
2805 Fix Gtk non-AllInOne build
2807 * GNUmakefile.am: include JSVariableObject.cpp
2808 * kjs/RegExpConstructor.cpp: include RegExpObject.h
2809 * kjs/RegExpObject.h: forward declare RegExpPrototype
2811 2008-06-28 Darin Adler <darin@apple.com>
2813 Reviewed by Sam and Cameron.
2815 - fix https://bugs.webkit.org/show_bug.cgi?id=19805
2816 Array.concat turns missing array elements into "undefined"
2818 Test: fast/js/array-holes.html
2820 * JavaScriptCore.exp: No longer export JSArray::getItem.
2822 * kjs/ArrayPrototype.cpp:
2823 (KJS::arrayProtoFuncConcat): Changed to use getProperty instead of
2824 JSArray::getItem -- need to handle properties from the prototype chain
2825 instead of ignoring them.
2827 * kjs/JSArray.cpp: Removed getItem.
2828 * kjs/JSArray.h: Ditto.
2830 2008-06-28 Darin Adler <darin@apple.com>
2832 Reviewed by Cameron.
2834 - https://bugs.webkit.org/show_bug.cgi?id=19804
2835 optimize access to arrays without "holes"
2837 SunSpider says 1.8% faster.
2840 (KJS::JSArray::JSArray): Initialize m_fastAccessCutoff when creating
2841 arrays. Also updated for new location of m_vectorLength.
2842 (KJS::JSArray::getItem): Updated for new location of m_vectorLength.
2843 (KJS::JSArray::getSlowCase): Added. Broke out the non-hot parts of
2844 getOwnPropertySlot to make the hot part faster.
2845 (KJS::JSArray::getOwnPropertySlot): Added a new faster case for
2846 indices lower than m_fastAccessCutoff. We can do theese with no
2847 additional checks or branches.
2848 (KJS::JSArray::put): Added a new faster case for indices lower than
2849 m_fastAccessCutoff. We can do theese with no additional checks or
2850 branches. Moved the maxArrayIndex handling out of this function.
2851 Added code to set m_fastAccessCutoff when the very last hole in
2852 an array is filled; this is how the cutoff gets set for most arrays.
2853 (KJS::JSArray::putSlowCase): Moved the rest of the put function logic
2854 in here, to make the hot part of the put function faster.
2855 (KJS::JSArray::deleteProperty): Added code to lower m_fastAccessCutoff
2856 when a delete makes a new hole in the array.
2857 (KJS::JSArray::getPropertyNames): Updated for new location of
2859 (KJS::JSArray::increaseVectorLength): Ditto.
2860 (KJS::JSArray::setLength): Added code to lower m_fastAccessCutoff
2861 when setLength makes the array smaller.
2862 (KJS::JSArray::mark): Updated for new location of m_vectorLength.
2863 (KJS::JSArray::sort): Ditto. Set m_fastAccessCutoff after moving
2864 all the holes to the end of the array.
2865 (KJS::JSArray::compactForSorting): Ditto.
2866 (KJS::JSArray::checkConsistency): Added consistency checks fro
2867 m_fastAccessCutoff and updated for the new location of m_vectorLength.
2869 * kjs/JSArray.h: Added declarations for slow case functions.
2870 Replaced m_vectorLength with m_fastAccessCutoff.
2872 2008-06-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2876 When executing a native call, check for an exception before writing the
2880 (KJS::Machine::privateExecute):
2882 2008-06-28 Mark Rowe <mrowe@apple.com>
2884 Build fix. Flag headers as private or public as is appropriate.
2885 These settings were accidentally removed during some project file cleanup.
2887 * JavaScriptCore.xcodeproj/project.pbxproj:
2889 2008-06-28 Sam Weinig <sam@webkit.org>
2891 Rubber-stamped by Darin Adler.
2893 Splits RegExpConstructor and RegExpPrototype out of RegExpObject.h/cpp
2895 * DerivedSources.make:
2897 * JavaScriptCore.pri:
2898 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2899 * JavaScriptCore.xcodeproj/project.pbxproj:
2900 * JavaScriptCoreSources.bkl:
2902 * kjs/AllInOneFile.cpp:
2903 * kjs/JSGlobalObject.cpp:
2904 * kjs/RegExpConstructor.cpp: Copied from kjs/RegExpObject.cpp.
2905 * kjs/RegExpConstructor.h: Copied from kjs/RegExpObject.h.
2906 * kjs/RegExpObject.cpp:
2907 * kjs/RegExpObject.h:
2908 * kjs/RegExpPrototype.cpp: Copied from kjs/RegExpObject.cpp.
2909 * kjs/RegExpPrototype.h: Copied from kjs/RegExpObject.h.
2910 * kjs/StringPrototype.cpp:
2913 2008-06-28 Sam Weinig <sam@webkit.org>
2915 Fix non-AllInOne builds.
2917 * kjs/StringConstructor.cpp:
2919 2008-06-28 Sam Weinig <sam@webkit.org>
2921 Rubber-stamped by Darin Adler.
2923 Rename string_object.h/cpp to StringObject.h/cpp and split out StringObjectThatMasqueradesAsUndefined,
2924 StringConstructor and StringPrototype.
2926 * DerivedSources.make:
2928 * JavaScriptCore.pri:
2929 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2930 * JavaScriptCore.xcodeproj/project.pbxproj:
2931 * JavaScriptCoreSources.bkl:
2932 * kjs/AllInOneFile.cpp:
2933 * kjs/JSGlobalObject.cpp:
2934 * kjs/StringConstructor.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
2935 * kjs/StringConstructor.h: Copied from JavaScriptCore/kjs/string_object.h.
2936 * kjs/StringObject.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
2937 * kjs/StringObject.h: Copied from JavaScriptCore/kjs/string_object.h.
2938 * kjs/StringObjectThatMasqueradesAsUndefined.h: Copied from JavaScriptCore/kjs/string_object.h.
2939 * kjs/StringPrototype.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
2940 * kjs/StringPrototype.h: Copied from JavaScriptCore/kjs/string_object.h.
2942 * kjs/string_object.cpp: Removed.
2943 * kjs/string_object.h: Removed.
2945 2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
2947 Gtk build fix: JSVariableObject is now part of AllInOne
2951 2008-06-28 Darin Adler <darin@apple.com>
2955 - https://bugs.webkit.org/show_bug.cgi?id=19801
2956 add a feature so we can tell what regular expressions are taking time
2958 * pcre/pcre_compile.cpp:
2959 (jsRegExpCompile): Compile in the string if REGEXP_HISTOGRAM is on.
2961 * pcre/pcre_exec.cpp:
2962 (jsRegExpExecute): Add hook to time execution.
2963 (Histogram::~Histogram): Print a sorted list of what took time.
2964 (Histogram::add): Accumulate records of what took time.
2965 (HistogramTimeLogger::~HistogramTimeLogger): Hook that calls
2966 Histogram::add at the right moment and creates the global histogram
2969 * pcre/pcre_internal.h: Define REGEXP_HISTOGRAM.
2971 * pcre/pcre_tables.cpp: Added missing include of "config.h". Not needed
2972 any more, but an omissions an earlier version of this patch detected.
2973 * pcre/pcre_ucp_searchfuncs.cpp: Ditto.
2974 * pcre/pcre_xclass.cpp: Ditto.
2976 2008-06-28 Sam Weinig <sam@webkit.org>
2978 Try and fix the Windows build again.
2980 * kjs/RegExpObject.cpp:
2981 * kjs/date_object.cpp:
2982 * kjs/error_object.cpp:
2984 2008-06-28 Sam Weinig <sam@webkit.org>
2986 Rubber-stamped by Darin Adler.
2988 Remove unused StringConstructorFunction class.
2990 * kjs/string_object.h:
2992 2008-06-28 Sam Weinig <sam@webkit.org>
2996 * kjs/ArrayPrototype.cpp:
2997 * kjs/BooleanPrototype.cpp:
2998 * kjs/BooleanPrototype.h:
2999 * kjs/FunctionPrototype.cpp:
3000 * kjs/JSImmediate.cpp:
3002 * kjs/MathObject.cpp:
3003 * kjs/NumberPrototype.cpp:
3004 * kjs/NumberPrototype.h:
3005 * kjs/ObjectConstructor.cpp:
3006 * kjs/RegExpObject.h:
3007 * kjs/error_object.h:
3008 * kjs/string_object.cpp:
3010 2008-06-28 Sam Weinig <sam@webkit.org>
3012 Rubber-stamped by Oliver Hunt.
3014 Splits FunctionConstructor out of FunctionPrototype.h/cpp
3015 Splits NumberConstructor and NumberPrototype out of NumberObject.h/cpp
3016 Rename object_object.h/cpp to ObjectPrototype.h/cpp and split out ObjectConstructor.
3018 * API/JSCallbackConstructor.cpp:
3019 * API/JSClassRef.cpp:
3020 * API/JSObjectRef.cpp:
3021 * DerivedSources.make:
3023 * JavaScriptCore.pri:
3024 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3025 * JavaScriptCore.xcodeproj/project.pbxproj:
3026 * JavaScriptCoreSources.bkl:
3028 * kjs/AllInOneFile.cpp:
3029 * kjs/ArrayConstructor.cpp:
3030 * kjs/ArrayConstructor.h:
3031 * kjs/FunctionConstructor.cpp: Copied from JavaScriptCore/kjs/FunctionPrototype.cpp.
3032 * kjs/FunctionConstructor.h: Copied from JavaScriptCore/kjs/FunctionPrototype.h.
3033 * kjs/FunctionPrototype.cpp:
3034 * kjs/FunctionPrototype.h:
3035 * kjs/JSFunction.cpp:
3036 * kjs/JSGlobalObject.cpp:
3037 * kjs/JSImmediate.cpp:
3039 * kjs/NumberConstructor.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
3040 * kjs/NumberConstructor.h: Copied from JavaScriptCore/kjs/NumberObject.h.
3041 * kjs/NumberObject.cpp:
3042 * kjs/NumberObject.h:
3043 * kjs/NumberPrototype.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
3044 * kjs/NumberPrototype.h: Copied from JavaScriptCore/kjs/NumberObject.h.
3045 * kjs/ObjectConstructor.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
3046 * kjs/ObjectConstructor.h: Copied from JavaScriptCore/kjs/object_object.h.
3047 * kjs/ObjectPrototype.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
3048 * kjs/ObjectPrototype.h: Copied from JavaScriptCore/kjs/object_object.h.
3049 * kjs/RegExpObject.h:
3051 * kjs/error_object.h:
3054 * kjs/object_object.cpp: Removed.
3055 * kjs/object_object.h: Removed.
3056 * kjs/string_object.h:
3058 2008-06-28 Darin Adler <darin@apple.com>
3062 - fix https://bugs.webkit.org/show_bug.cgi?id=19796
3063 optimize expressions with ignored results (especially post-increment)
3065 SunSpider says 0.9% faster.
3067 * VM/CodeGenerator.h:
3068 (KJS::CodeGenerator::tempDestination): Create a new temporary for
3069 ignoredResult() too, just as we would for 0.
3070 (KJS::CodeGenerator::finalDestination): Use the temporary if the
3071 register passed in is ignoredResult() too, just as we would for 0.
3072 (KJS::CodeGenerator::destinationForAssignResult): Return 0 if the
3073 passed in register is ignoredResult(), just as we would for 0.
3074 (KJS::CodeGenerator::moveToDestinationIfNeeded): Return 0 if the
3075 register passed in is ignoredResult(). What matters is that we
3076 don't want to emit a move. The return value won't be looked at.
3077 (KJS::CodeGenerator::emitNode): Allow ignoredResult() and pass it
3078 through to the node's emitCode function.
3081 (KJS::ignoredResult): Added. Special value to indicate the result of
3082 a node will be ignored and need not be put in any register.
3085 (KJS::NullNode::emitCode): Do nothing if dst == ignoredResult().
3086 (KJS::BooleanNode::emitCode): Ditto.
3087 (KJS::NumberNode::emitCode): Ditto.
3088 (KJS::StringNode::emitCode): Ditto.
3089 (KJS::RegExpNode::emitCode): Ditto.
3090 (KJS::ThisNode::emitCode): Ditto.
3091 (KJS::ResolveNode::emitCode): Do nothing if dst == ignoredResult() and
3092 the identifier resolves to a local variable.
3093 (KJS::ObjectLiteralNode::emitCode): Do nothing if dst == ignoredResult()
3094 and the object is empty.
3095 (KJS::PostIncResolveNode::emitCode): If dst == ignoredResult(), then do
3096 nothing for the local constant case, and do a pre-increment in all the
3098 (KJS::PostDecResolveNode::emitCode): Ditto.
3099 (KJS::PostIncBracketNode::emitCode): Ditto.
3100 (KJS::PostDecBracketNode::emitCode): Ditto.
3101 (KJS::PostIncDotNode::emitCode): Ditto.
3102 (KJS::PostDecDotNode::emitCode): Ditto.
3103 (KJS::DeleteValueNode::emitCode): Pass ignoredResult() when evaluating
3105 (KJS::VoidNode::emitCode): Ditto.
3106 (KJS::TypeOfResolveNode::emitCode): If dst == ignoredResult(), do nothing
3107 if the identifier resolves to a local variable, and don't bother generating
3108 a typeof opcode in the other case.
3109 (KJS::TypeOfValueNode::emitCode): Ditto.
3110 (KJS::PreIncResolveNode::emitCode): Do nothing if dst == ignoredResult() and
3111 the identifier resolves to a local constant.
3112 (KJS::PreDecResolveNode::emitCode): Ditto.
3113 (KJS::AssignResolveNode::emitCode): Turn ignoredResult() into 0 in a couple
3114 places, because we need to put the result into a register so we can assign
3115 it. At other sites this is taken care of by functions like finalDestination.
3116 (KJS::CommaNode::emitCode): Pass ignoredResult() when evaluating the first
3118 (KJS::ForNode::emitCode): Pass ignoredResult() when evaluating the first and
3120 (KJS::ForInNode::emitCode): Pass ignoredResult() when evaluating the first
3123 2008-06-28 Darin Adler <darin@apple.com>
3127 - https://bugs.webkit.org/show_bug.cgi?id=19787
3128 create most arrays from values in registers rather than with multiple put operations
3130 SunSpider says 0.8% faster.
3133 (KJS::CodeBlock::dump): Added argv and argc parameters to new_array.
3135 (KJS::Machine::privateExecute): Ditto.
3137 * VM/CodeGenerator.cpp:
3138 (KJS::CodeGenerator::emitNewArray): Added.
3139 * VM/CodeGenerator.h: Added ElementNode* argument to emitNewArray.
3142 (KJS::ArrayNode::emitCode): Pass the ElementNode to emitNewArray so it can be
3143 initialized with as many elements as possible. If the array doesn't have any
3144 holes in it, that's all that's needed. If there are holes, then emit some separate
3145 put operations for the other values in the array and for the length as needed.
3147 * kjs/nodes.h: Added some accessors to ElementNode so the code generator can
3148 iterate through elements and generate code to evaluate them. Now ArrayNode does
3149 not need to be a friend. Also took out some unused PlacementNewAdoptType
3152 2008-06-28 Darin Adler <darin@apple.com>
3156 * kjs/nodes.h: Remove obsolete PlacementNewAdopt constructors.
3157 We no longer mutate the AST in place.
3159 2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
3161 Reviewed by Oliver Hunt.
3165 * VM/Machine.cpp: include stdio.h for printf
3167 2008-06-27 Sam Weinig <sam@webkit.org>
3169 Reviewed by Oliver Hunt.
3171 Fix platforms that don't use AllInOne.cpp
3173 * kjs/BooleanConstructor.h:
3174 * kjs/BooleanPrototype.h:
3175 * kjs/FunctionPrototype.cpp:
3177 2008-06-27 Sam Weinig <sam@webkit.org>
3179 Rubber-stamped by Oliver Hunt.
3181 Splits ArrayConstructor out of ArrayPrototype.h/cpp
3182 Splits BooleanConstructor and BooleanPrototype out of BooleanObject.h/cpp
3185 * JavaScriptCore.pri:
3186 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3187 * JavaScriptCore.xcodeproj/project.pbxproj:
3188 * JavaScriptCoreSources.bkl:
3190 * kjs/AllInOneFile.cpp:
3191 * kjs/ArrayConstructor.cpp: Copied from kjs/ArrayPrototype.cpp.
3192 * kjs/ArrayConstructor.h: Copied from kjs/ArrayPrototype.h.
3193 * kjs/ArrayPrototype.cpp:
3194 * kjs/ArrayPrototype.h:
3195 * kjs/BooleanConstructor.cpp: Copied from kjs/BooleanObject.cpp.
3196 * kjs/BooleanConstructor.h: Copied from kjs/BooleanObject.h.
3197 * kjs/BooleanObject.cpp:
3198 * kjs/BooleanObject.h:
3199 * kjs/BooleanPrototype.cpp: Copied from kjs/BooleanObject.cpp.
3200 * kjs/BooleanPrototype.h: Copied from kjs/BooleanObject.h.
3201 * kjs/CommonIdentifiers.h:
3202 * kjs/FunctionPrototype.cpp:
3204 * kjs/JSGlobalObject.cpp:
3205 * kjs/JSImmediate.cpp:
3209 * kjs/string_object.cpp:
3211 2008-06-27 Oliver Hunt <oliver@apple.com>
3215 Bug 18626: SQUIRRELFISH: support the "slow script" dialog <https://bugs.webkit.org/show_bug.cgi?id=18626>
3216 <rdar://problem/5973931> Slow script dialog needs to be reimplemented for squirrelfish
3218 Adds support for the slow script dialog in squirrelfish. This requires the addition
3219 of three new op codes, op_loop, op_loop_if_true, and op_loop_if_less which have the
3220 same behaviour as their simple jump equivalents but have an additional time out check.
3222 Additional assertions were added to other jump instructions to prevent accidentally
3223 creating loops with jump types that do not support time out checks.
3225 Sunspider does not report a regression, however this appears very sensitive to code
3226 layout and hardware, so i would expect up to a 1% regression on other systems.
3228 Part of this required moving the old timeout logic from JSGlobalObject and into Machine
3229 which is the cause of a number of the larger diff blocks.
3231 * JavaScriptCore.exp:
3233 (KJS::CodeBlock::dump):
3234 * VM/CodeGenerator.cpp:
3235 (KJS::CodeGenerator::emitJumpIfTrue):
3236 (KJS::CodeGenerator::emitJumpScopes):
3237 * VM/ExceptionHelpers.cpp:
3238 (KJS::InterruptedExecutionError::isWatchdogException):
3239 (KJS::createInterruptedExecutionException):
3240 * VM/ExceptionHelpers.h:
3243 (KJS::Machine::Machine):
3244 (KJS::Machine::throwException):
3245 (KJS::Machine::resetTimeoutCheck):
3246 (KJS::getCurrentTime):
3247 (KJS::Machine::checkTimeout):
3248 (KJS::Machine::privateExecute):
3250 (KJS::Machine::setTimeoutTime):
3251 (KJS::Machine::startTimeoutCheck):
3252 (KJS::Machine::stopTimeoutCheck):
3253 (KJS::Machine::initTimeout):
3257 * kjs/JSGlobalObject.cpp:
3258 (KJS::JSGlobalObject::init):
3259 (KJS::JSGlobalObject::setTimeoutTime):
3260 (KJS::JSGlobalObject::startTimeoutCheck):
3261 * kjs/JSGlobalObject.h:
3263 * kjs/interpreter.cpp:
3264 (KJS::Interpreter::evaluate):
3266 2008-06-27 Jan Michael Alonzo <jmalonzo@webkit.org>
3268 Gtk and Qt build fix: Remove RegisterFileStack from the build
3272 * JavaScriptCore.pri:
3274 2008-06-27 Adele Peterson <adele@apple.com>
3280 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3281 * VM/RegisterFile.h:
3282 (KJS::RegisterFile::RegisterFile):
3283 * kjs/JSGlobalObject.cpp:
3284 * kjs/collector.cpp:
3286 2008-06-27 Geoffrey Garen <ggaren@apple.com>
3288 Reviewed by Oliver Hunt.
3290 One RegisterFile to rule them all!
3292 SunSpider reports a 0.2% speedup.
3294 This patch removes the RegisterFileStack abstraction and replaces it with
3295 a single register file that
3297 (a) allocates a fixed storage area, including a fixed area for global
3298 vars, so that no operation may cause the register file to reallocate
3302 (b) swaps between global storage areas when executing code in different
3305 This patch also changes the layout of the register file so that all call
3306 frames, including call frames for global code, get a header. This is
3307 required to support re-entrant global code. It also just makes things simpler.
3309 * VM/CodeGenerator.cpp:
3310 (KJS::CodeGenerator::addGlobalVar): New function. Differs from addVar in
3313 (a) global vars don't contribute to a CodeBlock's numLocals count, since
3314 global storage is fixed and allocated at startup
3318 (b) references to global vars get shifted to elide intermediate stack
3319 between "r" and the global storage area.
3322 (KJS::Machine::dumpRegisters): Updated this function to match the new
3323 register file layout, and added the ability to dump exact identifiers
3324 for the different parts of a call frame.
3326 (KJS::Machine::unwindCallFrame): Updated this function to match the new
3327 register file layout.
3329 (KJS::Machine::execute): Updated this function to initialize a call frame
3330 header for global code, and to swap global storage areas when switching
3331 to execution in a new global object.
3333 (KJS::Machine::privateExecute): Got rid of "safeForReentry" and re-reading
3334 of registerBase because the register file is always safe for reentry now,
3335 and registerBase never changes.
3337 * VM/Machine.h: Moved the call frame header enum from Machine to RegisterFile,
3338 to resolve a header dependency problem (a good sign that the enum belonged
3339 in RegisterFile all along!)
3341 * VM/RegisterFile.cpp:
3342 * VM/RegisterFile.h: Changed RegisterFile to mmap a fixed size register
3343 area. This allows us to avoid re-allocting the register file later on.
3344 Instead, we rely on the OS to allocate physical pages to the register
3347 * VM/RegisterFileStack.cpp: Removed. Tada!
3348 * VM/RegisterFileStack.h: Removed. Tada!
3350 * kjs/DebuggerCallFrame.cpp: Updated this class to match the new
3351 register file layout, greatly simplifying it in the process.
3353 * kjs/JSActivation.h:
3354 * kjs/JSActivation.cpp: Moved some of this logic up to JSVariableObject,
3355 since the global object now needs to be able to tear off its registers
3356 just like the activation object.
3358 * kjs/JSFunction.cpp: No need to fiddle with the register file anymore.
3360 * kjs/JSGlobalObject.h:
3361 * kjs/JSGlobalObject.cpp: Updated JSGlobalObject to support moving its
3362 global storage area into and out of the register file.
3364 * kjs/PropertySlot.cpp: No need to fiddle with the register file anymore.
3366 * kjs/collector.cpp: Renamed markStackObjectConservatively to
3367 markConservatively, since we don't just mark stack objects this way.
3369 Also, added code to mark the machine's register file.
3371 * kjs/config.h: Moved some platforms #defines from here...
3372 * wtf/Platform.h: ...to here, to support mmap/VirtualAlloc detection
3375 2008-06-26 Mark Rowe <mrowe@apple.com>
3377 Speculative fix for the Windows build.
3379 * kjs/JSImmediate.cpp:
3381 2008-06-26 Mark Rowe <mrowe@apple.com>
3383 Reviewed by Darin Adler and Geoff Garen.
3385 Fix the malloc zone introspection functions so that malloc_zone_statistics does not give
3386 bogus output in an application that uses JavaScriptCore.
3388 * kjs/CollectorHeapIntrospector.cpp:
3389 (KJS::CollectorHeapIntrospector::statistics): Return statistics about memory allocated by the collector.
3390 * kjs/CollectorHeapIntrospector.h:
3391 * wtf/FastMalloc.cpp: Zero out the statistics. FastMalloc doesn't track this information at present.
3392 Returning zero for all values is preferable to returning bogus data.
3394 2008-06-26 Darin Adler <darin@apple.com>
3398 - https://bugs.webkit.org/show_bug.cgi?id=19721
3399 speed up JavaScriptCore by not wrapping strings in objects just
3400 to call functions on them
3402 - optimize UString append and the replace function a bit
3404 SunSpider says 1.8% faster.
3406 * JavaScriptCore.exp: Updated.
3408 * VM/JSPropertyNameIterator.cpp: Added include of JSString.h, now needed
3409 because jsString returns a JSString*.
3412 (KJS::Machine::privateExecute): Removed the toObject call from native
3413 function calls. Also removed code to put the this value into a register.
3415 * kjs/BooleanObject.cpp:
3416 (KJS::booleanProtoFuncToString): Rewrite to handle false and true
3419 * kjs/FunctionPrototype.cpp:
3420 (KJS::constructFunction): Use single-character append rather than building
3421 a string for each character.
3422 * kjs/JSFunction.cpp:
3423 (KJS::globalFuncUnescape): Ditto.
3425 * kjs/JSImmediate.cpp:
3426 (KJS::JSImmediate::prototype): Added. Gets the appropriate prototype for
3427 use with an immediate value. To be used instead of toObject when doing a
3428 get on an immediate value.
3429 * kjs/JSImmediate.h: Added prototype.
3432 (KJS::JSObject::toString): Tweaked formatting.
3435 (KJS::JSValue::get): Use prototype instead of toObject to avoid creating
3436 an object wrapper just to search for properties. This also saves an
3437 unnecessary hash table lookup since the object wrappers themselves don't
3438 have any properties.
3440 * kjs/JSString.h: Added toThisString and toThisJSString.
3443 (KJS::JSCell::toThisString): Added.
3444 (KJS::JSCell::toThisJSString): Added.
3445 (KJS::JSCell::getJSNumber): Added.
3446 (KJS::jsString): Changed return type to JSString*.
3447 (KJS::jsOwnedString): Ditto.
3450 (KJS::JSValue::toThisString): Added.
3451 (KJS::JSValue::toThisJSString): Added.
3452 (KJS::JSValue::getJSNumber): Added.
3454 * kjs/NumberObject.cpp:
3455 (KJS::NumberObject::getJSNumber): Added.
3456 (KJS::integer_part_noexp): Append C string directly rather than first
3457 turning it into a UString.
3458 (KJS::numberProtoFuncToString): Use getJSNumber to check if the value
3459 is a number rather than isObject(&NumberObject::info). This works for
3460 immediate numbers, number cells, and NumberObject instances.
3461 (KJS::numberProtoFuncToLocaleString): Ditto.
3462 (KJS::numberProtoFuncValueOf): Ditto.
3463 (KJS::numberProtoFuncToFixed): Ditto.
3464 (KJS::numberProtoFuncToExponential): Ditto.
3465 (KJS::numberProtoFuncToPrecision): Ditto.
3466 * kjs/NumberObject.h: Added getJSNumber.
3468 * kjs/PropertySlot.cpp: Tweaked comment.
3471 (KJS::JSString::toThisString): Added.
3472 (KJS::JSString::toThisJSString): Added.
3473 (KJS::JSString::getOwnPropertySlot): Changed code that searches the
3474 prototype chain to start with the string prototype and not create a
3476 (KJS::JSNumberCell::toThisString): Added.
3477 (KJS::JSNumberCell::getJSNumber): Added.
3480 (KJS::staticFunctionGetter): Moved here, because there's no point in
3481 having a function that's only used for a function pointer be inline.
3482 (KJS::setUpStaticFunctionSlot): New function for getStaticFunctionSlot.
3485 (KJS::staticValueGetter): Don't mark this inline. It doesn't make sense
3486 to have a function that's only used for a function pointer be inline.
3487 (KJS::getStaticFunctionSlot): Changed to get properties from the parent
3488 first before doing any handling of functions. This is the fastest way
3489 to return the function once the initial setup is done.
3491 * kjs/string_object.cpp:
3492 (KJS::StringObject::getPropertyNames): Call value() instead of getString(),
3493 avoiding an unnecessary virtual function call (the call to the type()
3494 function in the implementation of the isString() function).
3495 (KJS::StringObject::toString): Added.
3496 (KJS::StringObject::toThisString): Added.
3497 (KJS::StringObject::toThisJSString): Added.
3498 (KJS::substituteBackreferences): Rewrote to use a appending algorithm
3499 instead of a the old one that tried to replace in place.
3500 (KJS::stringProtoFuncReplace): Merged this function and the replace function.
3501 Replaced the hand-rolled dynamic arrays for source ranges and replacements
3503 (KJS::stringProtoFuncToString): Handle JSString as well as StringObject.
3504 Removed the separate valueOf implementation, since it can just share this.
3505 (KJS::stringProtoFuncCharAt): Use toThisString, which handles JSString as
3506 well as StringObject, and is slightly more efficient than the old code too.
3507 (KJS::stringProtoFuncCharCodeAt): Ditto.
3508 (KJS::stringProtoFuncConcat): Ditto.
3509 (KJS::stringProtoFuncIndexOf): Ditto.
3510 (KJS::stringProtoFuncLastIndexOf): Ditto.
3511 (KJS::stringProtoFuncMatch): Ditto.
3512 (KJS::stringProtoFuncSearch): Ditto.
3513 (KJS::stringProtoFuncSlice): Ditto.
3514 (KJS::stringProtoFuncSplit): Ditto.
3515 (KJS::stringProtoFuncSubstr): Ditto.
3516 (KJS::stringProtoFuncSubstring): Ditto.
3517 (KJS::stringProtoFuncToLowerCase): Use toThisJSString.
3518 (KJS::stringProtoFuncToUpperCase): Ditto.
3519 (KJS::stringProtoFuncToLocaleLowerCase): Ditto.
3520 (KJS::stringProtoFuncToLocaleUpperCase): Ditto.
3521 (KJS::stringProtoFuncLocaleCompare): Ditto.
3522 (KJS::stringProtoFuncBig): Use toThisString.
3523 (KJS::stringProtoFuncSmall): Ditto.
3524 (KJS::stringProtoFuncBlink): Ditto.
3525 (KJS::stringProtoFuncBold): Ditto.
3526 (KJS::stringProtoFuncFixed): Ditto.
3527 (KJS::stringProtoFuncItalics): Ditto.
3528 (KJS::stringProtoFuncStrike): Ditto.
3529 (KJS::stringProtoFuncSub): Ditto.
3530 (KJS::stringProtoFuncSup): Ditto.
3531 (KJS::stringProtoFuncFontcolor): Ditto.