1 2008-07-30 Eric Seidel <eric@webkit.org>
5 MSVC warns when structs are called classes or vice versa.
6 Make all the source refer to JSGlobalData as a class.
8 * kjs/CommonIdentifiers.h:
13 2008-07-30 Alexey Proskuryakov <ap@webkit.org>
15 Reviewed by Geoff Garen.
17 Add consistency checks to UString to document and enforce its design.
20 (KJS::UString::Rep::create):
21 (KJS::UString::Rep::destroy):
22 (KJS::UString::Rep::checkConsistency):
23 (KJS::UString::expandCapacity):
24 (KJS::UString::expandPreCapacity):
25 (KJS::UString::UString):
26 (KJS::UString::spliceSubstringsWithSeparators):
27 (KJS::UString::append):
29 (KJS::UString::Rep::checkConsistency):
31 2008-07-30 Gavin Barraclough <barraclough@apple.com>
33 Reviewed by Geoff Garen.
35 Fixes for Windows and non-AllInOne file build with SamplingTool, plus review fixes.
37 * GNUmakefile.am: Adding SamplingTool.cpp to build.
38 * JavaScriptCore.exp: Export hooks to init & control SamplingTool.
39 * JavaScriptCore.pri: Adding SamplingTool.cpp to build.
40 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Adding SamplingTool.cpp to build.
41 * JavaScriptCore.xcodeproj/project.pbxproj: Adding SamplingTool.cpp to build.
42 * JavaScriptCoreSources.bkl: Adding SamplingTool.cpp to build.
43 * VM/Machine.cpp: MACHINE_SAMPLING_callingNativeFunction renamed MACHINE_SAMPLING_callingHostFunction
45 * VM/Opcode.cpp: SamplingTool moved to SamplingTool.cpp/.h, opcodeNames generated from FOR_EACH_OPCODE_ID.
47 * VM/SamplingTool.cpp: Added .cpp/.h for SamplingTool.
49 * kjs/Shell.cpp: Switched SAMPLING_TOOL_ENABLED to ENABLE_SAMPLING_TOOL.
50 * wtf/Platform.h: Added ENABLE_SAMPLING_TOOL config option.
51 * kjs/nodes.cpp: Header include to fix non-AllInOne builds.
53 2008-07-30 Ariya Hidayat <ariya.hidayat@trolltech.com>
55 Reviewed by Alexey Proskuryakov.
57 Fix compilation without multi-threading support.
62 2008-07-30 Anders Carlsson <andersca@apple.com>
64 Add WebKitAvailability.h forwarding header.
66 * ForwardingHeaders/JavaScriptCore/WebKitAvailability.h: Added.
68 2008-07-30 Anders Carlsson <andersca@apple.com>
72 * API/WebKitAvailability.h:
74 2008-07-30 Anders Carlsson <andersca@apple.com>
76 * API/WebKitAvailability.h:
77 Fix Windows (and other non-Mac builds).
79 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
80 Add WebKitAvailability.h to the project.
82 2008-07-30 Anders Carlsson <andersca@apple.com>
84 One step closer towards fixing the Windows build.
86 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
87 Make sure to copy WebKitAvailability.h
89 2008-07-29 Gavin Barraclough <barraclough@apple.com>
91 Reviewed by Geoff Garen.
93 Bug 20209: Atomize constant strings
94 <https://bugs.webkit.org/show_bug.cgi?id=20209>
96 Prevents significant performance degradation seen when a script contains multiple
97 identical strings that are used as keys to identify properties on objects.
99 No performance change on SunSpider.
101 * kjs/nodes.cpp: Atomize constant strings.
103 2008-07-30 Oliver Hunt <oliver@apple.com>
105 Reviewed by Alexey Proskuryakov.
107 <rdar://problem/6111648> JavaScript exceptions fail if the scope chain includes the global object
109 In an attempt to remove the branch I just added to KJS::depth I
110 used the existence of a Variable Object at a point in the scope
111 chain as an indicator of function or global scope activation.
112 However this assumption results in incorrect behaviour if the
113 global object is injected into the scope chain with 'with'.
118 2008-07-30 Alexey Proskuryakov <ap@webkit.org>
120 Reviewed by Geoff Garen.
122 Don't call JSGarbageCollect() on a released context.
124 * API/testapi.c: (main):
126 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
128 Reviewed by Geoff Garen.
130 Implement JSContextGroup APIs to make concurrent execution possible for
131 JavaScriptCore clients.
133 This changes the behavior of JSGlobalContextCreate(), so that it now uses a private context
134 group for each context, making JSlock implicit locking unnecessary.
136 * API/JSContextRef.h:
137 * API/JSContextRef.cpp:
138 (JSContextGroupCreate):
139 (JSContextGroupRetain):
140 (JSContextGroupRelease):
141 (JSGlobalContextCreate):
142 (JSGlobalContextCreateInGroup):
143 (JSGlobalContextRelease):
145 Added new methods. JSGlobalContextCreate() calls JSGlobalContextCreateInGroup() now.
147 * API/APICast.h: (toJS): (toRef): Added converters for JSContextGroupRef.
148 * API/JSBase.cpp: (JSGarbageCollect): JSGarbageCollect(0) is now a no-op, and the passed in
149 context is actually used.
151 * API/JSBase.h: Aded a typedef for JSContextGroupRef. Updated documentation for
154 * JavaScriptCore.exp: Removed JSGlobalData::sharedInstance().
156 * kjs/JSGlobalData.cpp:
157 * kjs/JSGlobalData.h:
158 Removed support for JSGlobalData shared instance. JSGlobalData::isSharedInstance member
159 variable still remains, to be deleted in a followup patch.
161 * kjs/JSLock.cpp: (KJS::JSLock::JSLock): Disabled JSLock, to be deleted in a follow-up patch.
164 (KJS::Heap::markOtherThreadConservatively): Removed an assertion that referenced
165 JSGlobalData::sharedInstance.
167 * kjs/collector.h: Made Heap destructor public, so that JSContextRelease can use it.
169 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
171 Reviewed by Geoff Garen.
173 Fix a leak of ThreadRegistrar objects.
175 As the heap is usually deleted when registered threads still exist, ThreadSpecific doesn't
176 have a chance to clean up per-thread object. Switched to native pthread calls, storing a
177 plain pointer that doesn't require cleanup.
180 (KJS::PlatformThread::PlatformThread):
181 (KJS::Heap::Thread::Thread):
184 (KJS::Heap::registerThread):
185 (KJS::Heap::unregisterThread):
188 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
190 Reviewed by Sam Weinig.
192 https://bugs.webkit.org/show_bug.cgi?id=20169
193 Memory allocated with fastMalloc is freed with delete
195 * VM/JSPropertyNameIterator.cpp:
196 (KJS::JSPropertyNameIterator::invalidate): Free the array properly.
197 (KJS::JSPropertyNameIterator::~JSPropertyNameIterator): Delete the array by calling
200 2008-07-29 Mark Rowe <mrowe@apple.com>
202 Attempt to fix the Qt build.
204 * wtf/ThreadingQt.cpp: Add the extra argument to createThread.
206 2008-07-29 Adam Roben <aroben@apple.com>
208 Change Vector::find to return an index instead of an iterator
210 Indices are more natural than iterators when working with Vector.
212 Reviewed by John Sullivan.
215 (WTF::Vector::find): Changed to iterate the Vector manually and return
216 the index of the found item, rather than an iterator. When the item
217 could not be found, we return WTF::notFound.
219 2008-07-29 Adam Roben <aroben@apple.com>
223 * wtf/ThreadingWin.cpp:
224 (WTF::setThreadName): Move a misplaced assertion to here...
225 (WTF::createThread): ...from here.
227 2008-07-29 Adam Roben <aroben@apple.com>
229 Add support for setting thread names on Windows
231 These thread names make it much easier to identify particular threads
232 in Visual Studio's Threads panel.
234 WTF::createThread now takes a const char* representing the thread's
235 name. On Windows, we throw a special exception to set this string as
236 the thread's name. Other platforms do nothing with this name for now.
238 Reviewed by Anders Carlsson.
240 * JavaScriptCore.exp: Export the new version of createThread that
241 takes 3 arguments (the old one continues to be exported for backward
243 * wtf/Threading.h: Add a threadName argument to createThread.
245 * wtf/ThreadingGtk.cpp:
247 * wtf/ThreadingNone.cpp:
249 Updated for function signature change.
251 * wtf/ThreadingPthreads.cpp:
252 (WTF::createThread): Updated for function signature change. We keep
253 around the old 2-argument version of createThread for backward
256 * wtf/ThreadingWin.cpp:
257 (WTF::setThreadName): Added. This function's implementation came from
259 (WTF::initializeThreading): Set the name of the main thread.
260 (WTF::createThread): Call setThreadName. We keep around the old
261 2-argument version of createThread for backward compatibility.
263 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
265 Reviewed by Oliver Hunt.
267 Store UString::Rep::isStatic bit in identifierTable pointer instead of reportedCost for
268 slightly nicer code and a 0.5% SunSpider improvement.
270 * API/JSClassRef.cpp:
271 (OpaqueJSClass::~OpaqueJSClass):
272 (OpaqueJSClassContextData::OpaqueJSClassContextData):
273 * API/JSStringRef.cpp:
275 * kjs/PropertyNameArray.cpp:
276 (KJS::PropertyNameArray::add):
277 * kjs/identifier.cpp:
278 (KJS::IdentifierTable::~IdentifierTable):
279 (KJS::IdentifierTable::add):
280 (KJS::Identifier::addSlowCase):
281 (KJS::Identifier::remove):
283 (KJS::Identifier::add):
286 (KJS::UString::Rep::create):
287 (KJS::UString::Rep::destroy):
289 (KJS::UString::Rep::identifierTable):
290 (KJS::UString::Rep::setIdentifierTable):
291 (KJS::UString::Rep::isStatic):
292 (KJS::UString::Rep::setStatic):
293 (KJS::UString::cost):
295 2008-07-28 Geoffrey Garen <ggaren@apple.com>
297 Reviewed by Sam Weinig.
299 Renamed "ConstructTypeNative" => "ConstructTypeHost".
301 2008-07-26 Mark Rowe <mrowe@apple.com>
303 Speculative fix for the wx build.
305 * JavaScriptCoreSources.bkl: Add JSStaticScopeObject.cpp to the list of source files.
307 2008-07-25 Oliver Hunt <oliver@apple.com>
311 Whoops, forgot to save style correction.
313 * kjs/JSStaticScopeObject.h:
315 2008-07-25 Oliver Hunt <oliver@apple.com>
317 Reviewed by Cameron Zwarich.
319 Bug 19718: Named anonymous functions are slow accessing global variables
320 <https://bugs.webkit.org/show_bug.cgi?id=19718>
322 To fix this we switch over to an activation-like scope object for
323 on which we attach the function name property, and add logic to
324 prevent cross scope assignment to read only properties.
327 * JavaScriptCore.pri:
328 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
329 * JavaScriptCore.xcodeproj/project.pbxproj:
330 * VM/CodeGenerator.cpp:
331 (KJS::CodeGenerator::findScopedProperty):
332 (KJS::CodeGenerator::emitResolve):
333 * VM/CodeGenerator.h:
334 * kjs/AllInOneFile.cpp:
335 * kjs/JSStaticScopeObject.cpp: Added.
336 (KJS::JSStaticScopeObject::putWithAttributes):
337 (KJS::JSStaticScopeObject::isDynamicScope):
338 (KJS::JSStaticScopeObject::~JSStaticScopeObject):
339 (KJS::JSStaticScopeObject::getOwnPropertySlot):
340 * kjs/JSStaticScopeObject.h: Added.
341 (KJS::JSStaticScopeObject::JSStaticScopeObjectData::JSStaticScopeObjectData):
342 (KJS::JSStaticScopeObject::JSStaticScopeObject):
344 (KJS::FunctionCallResolveNode::emitCode):
345 (KJS::PostfixResolveNode::emitCode):
346 (KJS::PrefixResolveNode::emitCode):
347 (KJS::ReadModifyResolveNode::emitCode):
348 (KJS::AssignResolveNode::emitCode):
349 (KJS::FuncExprNode::makeFunction):
351 2008-07-25 kevino <kevino@theolliviers.com>
353 wx build fix for Win.
355 On wx/Win, including windows.h in Threading.h causes multiply-defined symbol errors
356 for libjpeg and wx, and also wx needs to include windows.h itself first for wx
357 includes to work right. So until we can find a better solution to this problem,
358 on wx, we work around the need to include windows.h here.
362 2008-07-25 Adam Roben <aroben@apple.com>
366 * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add API/ to the
369 2008-07-25 Simon Hausmann <hausmann@webkit.org>
371 Fix the build of jsc on Qt/Windows, make sure os-win32 is in the
372 include search path (added by WebKit.pri).
376 2008-07-25 Alexey Proskuryakov <ap@webkit.org>
378 Reviewed by Simon Hausmann.
380 Move JavaScriptCore API tests into a subdirectory of their own to avoid header name
381 conflicts and developer confusion.
383 * API/JSNode.c: Removed.
384 * API/JSNode.h: Removed.
385 * API/JSNodeList.c: Removed.
386 * API/JSNodeList.h: Removed.
387 * API/Node.c: Removed.
388 * API/Node.h: Removed.
389 * API/NodeList.c: Removed.
390 * API/NodeList.h: Removed.
391 * API/minidom.c: Removed.
392 * API/minidom.html: Removed.
393 * API/minidom.js: Removed.
394 * API/testapi.c: Removed.
395 * API/testapi.js: Removed.
397 * API/tests/JSNode.c: Copied from JavaScriptCore/API/JSNode.c.
398 * API/tests/JSNode.h: Copied from JavaScriptCore/API/JSNode.h.
399 * API/tests/JSNodeList.c: Copied from JavaScriptCore/API/JSNodeList.c.
400 * API/tests/JSNodeList.h: Copied from JavaScriptCore/API/JSNodeList.h.
401 * API/tests/Node.c: Copied from JavaScriptCore/API/Node.c.
402 * API/tests/Node.h: Copied from JavaScriptCore/API/Node.h.
403 * API/tests/NodeList.c: Copied from JavaScriptCore/API/NodeList.c.
404 * API/tests/NodeList.h: Copied from JavaScriptCore/API/NodeList.h.
405 * API/tests/minidom.c: Copied from JavaScriptCore/API/minidom.c.
406 * API/tests/minidom.html: Copied from JavaScriptCore/API/minidom.html.
407 * API/tests/minidom.js: Copied from JavaScriptCore/API/minidom.js.
408 * API/tests/testapi.c: Copied from JavaScriptCore/API/testapi.c.
409 * API/tests/testapi.js: Copied from JavaScriptCore/API/testapi.js.
411 * JavaScriptCore.vcproj/testapi/testapi.vcproj:
412 * JavaScriptCore.xcodeproj/project.pbxproj:
414 2008-07-25 Simon Hausmann <hausmann@webkit.org>
416 Prospective WX build fix, add JavaScriptCore/API to the include search
421 2008-07-25 Simon Hausmann <hausmann@webkit.org>
423 Rubber-stamped by Lars.
425 Fix the build on Windows. operator new for ArgList is implemented using fastMalloc()
426 but operator delete was not implemented. Unfortunately MSVC decides to call/reference
427 the function, so a simple implementation using fastFree() fixes the build.
430 (KJS::ArgList::operator delete):
432 2008-07-25 Simon Hausmann <hausmann@webkit.org>
434 Discussed with and rubber-stamped by Lars.
436 Fix the build system for the Qt port.
438 Recent JavaScriptCore changes require the addition of JavaScriptCore/API to the
439 include search path. With a build process that combines JavaScriptCore and
440 WebCore in one build process/Makefile the existance of
441 JavaScriptCore/API/Node.h and WebCore/dom/Node.h causes include conflicts.
443 This commit solves this by introducing a separate build of JavaScriptCore into
446 As a result of the split-up a race-condition due to broken dependencies of
447 regular source files to header files of generated sources showed up very
448 frequently when doing parallel builds (which the buildbot does). This commit at
449 the same time tries to address the dependency problem by making the
450 addExtraCompiler() function also generate a pseudo extra compiler that
451 represents the header file output, so that qmake is aware of the creation of
452 the header file for dependency calculation.
454 At the same time I removed a lot of cruft from the pro files to ease maintenance.
456 * JavaScriptCore.pri:
457 * JavaScriptCore.pro: Added.
460 2008-07-24 Geoffrey Garen <ggaren@apple.com>
462 Reviewed by Maciej Stachowiak.
464 Fixed a strict aliasing violation, which caused hash tables with floating
465 point keys not to find items that were indeed in the tables
466 (intermittently, and only in release builds, of course).
468 SunSpider reports no change.
470 This bug doesn't seem to affect any existing code, but it causes obvious
471 crashes in some new code I'm working on.
473 * wtf/HashFunctions.h:
474 (WTF::FloatHash::hash): Use a union when punning between a float / double
475 and an unsigned (bucket of bits). With strict aliasing enabled, unions
476 are the only safe way to do this kind of type punning.
478 * wtf/HashTable.h: When rehashing, ASSERT that the item we just added to
479 the table is indeed in the table. In the buggy case described above, this
482 2008-07-24 Oliver Hunt <oliver@apple.com>
484 Reviewed by Alexey Proskuryakov.
486 Bug 20142: REGRESSION(r35245): /=/ weirdness
487 <https://bugs.webkit.org/show_bug.cgi?id=20142>
489 When adding all the meta data needed for exception error messages
490 I accidentally clobbered the handling of regex beginning with /=.
494 2008-07-23 Alp Toker <alp@nuanti.com>
496 Build fix after r35293: Add API/ to the include path.
500 2008-07-23 Adam Roben <aroben@apple.com>
504 Build fix after r35293:
506 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add API/
509 Build fix after r35305:
515 Completely compile out all sampler-related code when
516 SAMPLING_TOOL_ENABLED is 0. The sampler code can't be compiled 1) on
517 non-AllInOne configurations due to circular header dependencies, and
518 2) on platforms that don't have a usleep() function, such as Windows.
520 2008-07-23 Oliver Hunt <oliver@apple.com>
522 Reviewed by Geoff Garen and Sam Weinig.
524 Improve switch performance.
526 Improve switch performance by converting to a hashmap based jump
527 table to avoid the sequence of dispatches that would otherwise be
528 needed. This results in a 9-19x performance win for string switches
529 based on ad hoc testing, and a 6x improvement for integer switch
530 statements. SunSpider reports a 1.2% progression.
533 (KJS::CodeBlock::dump):
534 (KJS::SimpleJumpTable::offsetForValue):
536 * VM/CodeGenerator.cpp:
537 (KJS::CodeGenerator::beginSwitch):
538 (KJS::prepareJumpTableForImmediateSwitch):
539 (KJS::prepareJumpTableForCharacterSwitch):
540 (KJS::prepareJumpTableForStringSwitch):
541 (KJS::CodeGenerator::endSwitch):
542 * VM/CodeGenerator.h:
544 (KJS::offsetForStringSwitch):
545 (KJS::Machine::privateExecute):
552 (KJS::processClauseList):
553 (KJS::CaseBlockNode::tryOptimisedSwitch):
554 (KJS::CaseBlockNode::emitCodeForBlock):
558 2008-07-23 Gavin Barraclough <barraclough@apple.com>
560 Reviewed by Geoff Garen.
562 Sampling tool to analyze cost of instruction execution and identify hot regions of JS code.
563 Enable Switches by setting SAMPLING_TOOL_ENABLED in Opcode.h.
565 * JavaScriptCore.exp: Export symbols for Shell.cpp.
566 * VM/Machine.cpp: Added sampling hooks.
567 * VM/Machine.h: Machine contains a pointer to a sampler, when sampling.
568 * VM/Opcode.cpp: Tool implementation.
569 * VM/Opcode.h: Tool declaration.
570 * kjs/Shell.cpp: Initialize the sampler, if enabled.
571 * kjs/nodes.cpp: Added sampling hooks.
573 2008-07-23 Gabor Loki <loki@inf.u-szeged.hu>
575 Bug 20097: [Qt] 20% Sunspider slow-down
577 <https://bugs.webkit.org/show_bug.cgi?id=20097>
579 Reviewed by Simon Hausmann.
581 * kjs/jsc.pro: Added missing NDEBUG define for release builds.
583 2008-07-23 Alexey Proskuryakov <ap@webkit.org>
585 Reviewed by Geoff Garen.
587 JSClassRef is created context-free, but gets infatuated with the first context it sees.
589 The implicit API contract is that JSClassRef can be used with any context on any thread.
590 This no longer worked, because UStrings in the class were turned into per-context
591 identifiers, and the cached JSObject prototype was tied to JSGlobalData, too.
593 * API/JSClassRef.h: Made a separate struct for context-dependent parts of OpaqueJSClass.
594 * API/JSClassRef.cpp:
595 (OpaqueJSClass::OpaqueJSClass): Updated for renames and changed member variable order.
596 (OpaqueJSClass::~OpaqueJSClass): Assert that string members are not identifiers.
597 (clearReferenceToPrototype): Update for the new reference location.
598 (OpaqueJSClassContextData::OpaqueJSClassContextData): Make a deep copy of all strings.
599 (OpaqueJSClass::contextData): Added a function that finds the per-context part of
600 OpaqueJSClass in JSGlobalData, or creates it if not found.
601 (OpaqueJSClass::className): Always make a deep copy. Callers of this function do not have
602 a way to access JSGlobalData, so a per-context copy could not be made.
603 (OpaqueJSClass::staticValues): Updated for new data location.
604 (OpaqueJSClass::staticFunctions): Ditto.
605 (OpaqueJSClass::prototype): Changed to take an internal type for consistency.
607 * kjs/JSGlobalData.cpp:
608 (KJS::JSGlobalData::JSGlobalData):
609 (KJS::JSGlobalData::~JSGlobalData):
610 * kjs/JSGlobalData.h:
611 Keep a HashMap to access per-context JSClass data given a pointr to the shared part.
613 * API/JSCallbackObjectFunctions.h:
615 (KJS::::getOwnPropertySlot):
617 (KJS::::deleteProperty):
618 (KJS::::getPropertyNames):
619 (KJS::::staticValueGetter):
620 (KJS::::staticFunctionGetter):j
621 Use function accessors instead of accessing OpaqueJSClass members directly.
623 * API/JSContextRef.cpp: (JSGlobalContextCreate): Updated for the change in
624 OpaqueJSClass::prototype() argument type.
626 * API/JSObjectRef.cpp:
627 (JSObjectMake): Updated for the change in OpaqueJSClass::prototype() argument type.
628 (JSObjectMakeConstructor): Ditto.
630 2008-07-23 Alexey Proskuryakov <ap@webkit.org>
634 * kjs/ArgList.h: (KJS::ArgList::operator new): removed an extraneous "ArgList::" inside the
637 2008-07-22 Geoffrey Garen <ggaren@apple.com>
639 Reviewed by Oliver Hunt and Sam Weinig.
641 Next step toward putting doubles in registers: Prepare the Register class
642 and its clients for registers that don't contain JSValue*s.
644 This means a few things:
646 1. Register::jsValue() clients, including ArgList clients, must now supply
647 an ExecState* when accessing an entry in an ArgList, in case the entry
648 will need to create a JSValue* on the fly.
650 2. Register clients that definitely don't want to create a JSValue* on
651 the fly now use different APIs: getJSValue() for clients that know
652 the register contains a JSValue*, and v() for clients who just want a
655 3. I had to change some headers around in order to resolve dependency
656 problems created by using a Register in the ArgList header.
658 SunSpider reports no change.
660 2008-07-22 Gavin Barraclough <barraclough@apple.com>
662 Reviewed by Alexey Proskuryakov.
664 Prevent integer overflow when reallocating storage vector for arrays.
666 Sunspider reports 1.005x as fast (no change expected).
670 2008-07-21 Mark Rowe <mrowe@apple.com>
672 Reviewed by Sam Weinig.
674 <rdar://problem/6091287> Revamp the handling of CFBundleShortVersionString to be fixed at the major component of the version number.
676 * Configurations/Version.xcconfig:
679 2008-07-21 Adam Roben <aroben@apple.com>
683 This is a convenience wrapper around std::find.
685 Reviewed by Anders Carlsson.
689 2008-07-19 Oliver Hunt <oliver@apple.com>
691 Reviewed by Cameron Zwarich.
693 Bug 20104: Exception in tables/mozilla_expected_failures/bugs/bug92868_1.html includes the equals operator in the quoted expression
694 <https://bugs.webkit.org/show_bug.cgi?id=20104>
696 To make this correct we make the dot and bracket assign nodes emit the information to indicate
697 the failure range is the dot/bracket accessor.
701 2008-07-18 Steve Falkenburg <sfalken@apple.com>
705 * kjs/JSGlobalObjectFunctions.cpp:
706 (KJS::isStrWhiteSpace):
708 2008-07-18 Steve Falkenburg <sfalken@apple.com>
713 (KJS::ThrowableExpressionData::ThrowableExpressionData):
715 2008-07-18 Oliver Hunt <oliver@apple.com>
717 Reviewed by Cameron Zwarich.
719 Bug 18774: SQUIRRELFISH: print meaningful error messages <https://bugs.webkit.org/show_bug.cgi?id=18774>
720 <rdar://problem/5769353> SQUIRRELFISH: JavaScript error messages are missing informative text
722 Add support for decent error messages in JavaScript. This patch achieves this by providing
723 ensuring the common errors and exceptions have messages that provide the text of expression
724 that trigger the exception. In addition it attaches a number of properties to the exception
725 object detailing where in the source the expression came from.
727 * JavaScriptCore.exp:
729 (KJS::CodeBlock::lineNumberForVPC):
730 (KJS::CodeBlock::expressionRangeForVPC):
731 Function to recover the expression range for an instruction
732 that triggered an exception.
734 (KJS::ExpressionRangeInfo::):
735 (KJS::CodeBlock::CodeBlock):
736 * VM/CodeGenerator.cpp:
737 (KJS::CodeGenerator::emitCall):
738 (KJS::CodeGenerator::emitCallEval):
739 Emit call needed to be modified so to place the expression range info internally,
740 as the CodeGenerator emits the arguments nodes itself, rather than the various call
742 * VM/CodeGenerator.h:
743 (KJS::CodeGenerator::emitExpressionInfo):
744 Record the expression range info.
745 * VM/ExceptionHelpers.cpp:
746 (KJS::createErrorMessage):
747 (KJS::createInvalidParamError):
748 (KJS::createUndefinedVariableError):
749 (KJS::createNotAConstructorError):
750 (KJS::createNotAFunctionError):
751 (KJS::createNotAnObjectErrorStub):
752 (KJS::createNotAnObjectError):
753 Rewrite all the code for the error messages so that they make use of the newly available
755 * VM/ExceptionHelpers.h:
757 (KJS::isNotObject): Now needs vPC and codeBlock
758 (KJS::Machine::throwException):
759 New logic to handle the NotAnObjectErrorStub and to handle the absurd "no default value" edge case
760 (KJS::Machine::privateExecute):
762 * kjs/DebuggerCallFrame.cpp:
763 (KJS::DebuggerCallFrame::evaluate):
765 (KJS::Error::create):
767 * kjs/JSGlobalObjectFunctions.cpp:
768 * kjs/JSImmediate.cpp:
769 (KJS::JSImmediate::toObject):
770 (KJS::JSImmediate::prototype):
771 My changes to the JSNotAnObject constructor needed to be handled here.
772 * kjs/JSNotAnObject.h:
773 (KJS::JSNotAnObjectErrorStub::JSNotAnObjectErrorStub):
774 (KJS::JSNotAnObjectErrorStub::isNull):
775 (KJS::JSNotAnObjectErrorStub::isNotAnObjectErrorStub):
776 Added a JSNotAnObjectErrorStub class to ease the handling of toObject failure exceptions,
777 and potentially allow even more detailed error messages in future.
780 (KJS::Parser::parse):
783 Large amounts of position propagation.
788 The lexer needed a few changes to be able to correctly track token character positions.
791 (KJS::ThrowableExpressionData::emitThrowError):
792 (KJS::StatementNode::StatementNode):
793 (KJS::ResolveNode::emitCode):
794 (KJS::BracketAccessorNode::emitCode):
795 (KJS::DotAccessorNode::emitCode):
796 (KJS::NewExprNode::emitCode):
797 (KJS::EvalFunctionCallNode::emitCode):
798 (KJS::FunctionCallValueNode::emitCode):
799 (KJS::FunctionCallResolveNode::emitCode):
800 (KJS::FunctionCallBracketNode::emitCode):
801 (KJS::FunctionCallDotNode::emitCode):
802 (KJS::PostfixResolveNode::emitCode):
803 (KJS::PostfixBracketNode::emitCode):
804 (KJS::PostfixDotNode::emitCode):
805 (KJS::DeleteResolveNode::emitCode):
806 (KJS::DeleteBracketNode::emitCode):
807 (KJS::DeleteDotNode::emitCode):
808 (KJS::PrefixResolveNode::emitCode):
809 (KJS::PrefixBracketNode::emitCode):
810 (KJS::PrefixDotNode::emitCode):
811 (KJS::ThrowableBinaryOpNode::emitCode):
812 (KJS::ReadModifyResolveNode::emitCode):
813 (KJS::AssignResolveNode::emitCode):
814 (KJS::AssignDotNode::emitCode):
815 (KJS::ReadModifyDotNode::emitCode):
816 (KJS::AssignBracketNode::emitCode):
817 (KJS::ReadModifyBracketNode::emitCode):
818 (KJS::ForInNode::ForInNode):
819 (KJS::ForInNode::emitCode):
820 (KJS::WithNode::emitCode):
821 (KJS::LabelNode::emitCode):
822 (KJS::ThrowNode::emitCode):
823 (KJS::ProgramNode::ProgramNode):
824 (KJS::ProgramNode::create):
825 (KJS::EvalNode::generateCode):
826 (KJS::FunctionBodyNode::create):
827 (KJS::FunctionBodyNode::generateCode):
828 (KJS::ProgramNode::generateCode):
829 All of these methods were handling the position information.
830 Constructors and create methods were modified to store the information.
831 All the emitCall implementations listed needed to be updated to actually
832 record the position information we have so carefully collected.
834 (KJS::ThrowableExpressionData::ThrowableExpressionData):
835 (KJS::ThrowableExpressionData::setExceptionSourceRange):
836 (KJS::ThrowableExpressionData::divot):
837 (KJS::ThrowableExpressionData::startOffset):
838 (KJS::ThrowableExpressionData::endOffset):
839 (KJS::ThrowableSubExpressionData::ThrowableSubExpressionData):
840 (KJS::ThrowableSubExpressionData::setSubexpressionInfo):
841 (KJS::ThrowablePrefixedSubExpressionData::ThrowablePrefixedSubExpressionData):
842 (KJS::ThrowablePrefixedSubExpressionData::setSubexpressionInfo):
843 ThrowableExpressionData is just a uniform mechanism for storing the position
845 (KJS::ResolveNode::):
846 (KJS::PrePostResolveNode::):
847 (KJS::ThrowableBinaryOpNode::):
850 2008-07-18 Geoffrey Garen <ggaren@apple.com>
852 Reviewed by Cameron Zwarich.
856 "CallTypeNative" => "CallTypeHost"
858 "generatedCode" => "generatedByteCode"
860 2008-07-18 Geoffrey Garen <ggaren@apple.com>
862 Reviewed by Oliver Hunt.
864 Optimized <= for immediate number cases.
866 SunSpider reports no overall change, but a 10% speedup on access-nsieve.
868 2008-07-18 Mark Rowe <mrowe@apple.com>
870 Rubber-stamped by Sam Weinig.
872 Fix some casts added in a previous build fix to match the style used
876 (KJS::Machine::initializeCallFrame):
878 (KJS::Register::Register):
880 2008-07-18 Landry Breuil <landry@openbsd.org>
882 Bug 19975: [OpenBSD] Patches to enable build of WebKit
884 <https://bugs.webkit.org/show_bug.cgi?id=19975>
886 Reviewed by David Kilzer.
888 Support for OpenBSD, mostly threading and libm tweaks.
890 * kjs/collector.cpp: #include <pthread.h>
891 (KJS::currentThreadStackBase): use pthread_stackseg_np() to get stack base
892 * kjs/config.h: OpenBSD also provides <pthread_np.h>
893 * wtf/MathExtras.h: #include <sys/types.h> and <machine/ieee.h>
894 (isfinite), (signbit): as long as we don't have those functions provide fallback implementations
895 * wtf/Platform.h: Add support for PLATFORM(OPENBSD) and PLATFORM(SPARC64) macro
897 2008-07-17 Geoffrey Garen <ggaren@apple.com>
899 Reviewed by Oliver Hunt.
901 Next step toward putting doubles in registers: Store constant pool
902 entries as registers, not JSValue*s.
904 SunSpider reports no change.
906 2008-07-17 Geoffrey Garen <ggaren@apple.com>
908 Reviewed by John Sullivan and Oliver Hunt.
910 A tiny bit of tidying in function call register allocation.
912 This patch saves one register when invoking a function expression and/or
913 a new expression that is stored in a temporary.
915 Since it's just one register, I can't make a testcase for it.
917 * VM/CodeGenerator.cpp:
918 (KJS::CodeGenerator::emitCall): No need to ref the function we're calling
919 or its base. We'd like the call frame to overlap with them, if possible.
920 op_call will read the function and its base before writing the call frame,
924 (KJS::NewExprNode::emitCode): No need to ref the function we're new-ing,
925 for the same reasons stated above.
927 (KJS::FunctionCallValueNode::emitCode): ditto
929 2008-07-17 Steve Falkenburg <sfalken@apple.com>
933 * kjs/InternalFunction.cpp:
935 2008-07-17 Sam Weinig <sam@webkit.org>
937 Roll out r35199 as it is causing failures on the PPC build.
939 2008-07-17 Geoffrey Garen <ggaren@apple.com>
941 Reviewed by David Kilzer.
943 Fixed https://bugs.webkit.org/show_bug.cgi?id=20067
944 Support function.name (Firefox extension)
946 Pretty straight-forward.
948 2008-07-17 Geoffrey Garen <ggaren@apple.com>
950 Reviewed by Oliver Hunt.
952 Fixed <rdar://problem/6081636> Functions calls use more temporary
953 registers than necessary
955 Holding a reference to the last statement result register caused each
956 successive statement to output its result to an even higher register.
958 Happily, statements don't actually need to return a result register
959 at all. I hope to make this clearer in a future cleanup patch,
960 but this change will fix the major bug for now.
963 (KJS::statementListEmitCode):
965 2008-07-17 Gavin Barraclough <barraclough@apple.com>
967 Reviewed by Sam Weinig.
969 Merge pre&post dot nodes to simplify the parse tree.
970 Sunspider results show 0.6% progression (no performance change expected).
975 * kjs/nodes2string.cpp:
977 2008-07-17 Gavin Barraclough <barraclough@apple.com>
979 Reviewed by Cameron Zwarich.
981 Merge pre&post resolve nodes to simplify the parse tree.
982 Sunspider results show no performance change.
987 * kjs/nodes2string.cpp:
989 2008-07-17 Gavin Barraclough <barraclough@apple.com>
991 Reviewed by Cameron Zwarich.
993 Merge logical nodes to simplify the parse tree.
994 Sunspider results show 0.6% progression (no performance change expected).
999 * kjs/nodes2string.cpp:
1001 2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
1005 Fix MinGW build (broken in r35198) and simplify getLocalTime().
1008 (KJS::getLocalTime):
1010 2008-07-17 Gavin Barraclough <barraclough@apple.com>
1012 Reviewed by Sam Weinig.
1014 Merge pre&post bracket nodes to simplify the parse tree.
1015 Sunspider results show no performance change.
1020 * kjs/nodes2string.cpp:
1022 2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
1026 Fix the 32-bit gcc builds, conversion from "long int" to Register is
1027 ambiguous. Explicitly choose the intptr_t constructor.
1030 (KJS::Machine::initializeCallFrame):
1032 (KJS::Register::Register):
1034 2008-07-16 Mark Rowe <mrowe@apple.com>
1036 Rubber-stamped by Geoff Garen.
1038 Fix JavaScript in 64-bit by using a pointer-sized integer
1039 type in the Register union. Also includes a rename of
1040 the intType constant to IntType.
1043 (KJS::Machine::initializeCallFrame):
1046 (KJS::Register::Register):
1048 2008-07-17 Geoffrey Garen <ggaren@apple.com>
1050 Reviewed by Oliver Hunt.
1052 First step toward putting doubles in registers: Turned Register into a
1053 proper abstraction layer. It is no longer possible to cast a Register
1054 to a JSValue*, or a Register& to a JSValue*&, or to access the union
1055 inside a Register directly.
1057 SunSpider reports no change.
1059 In support of this change, I had to make the following mechanical changes
1062 1. Clients now use explicit accessors to read data out of Registers, and
1063 implicit copy constructors to write data into registers.
1065 So, assignment that used to look like
1073 And access that used to look like
1081 2. I made generic flow control specific in opcodes that made their flow
1082 control generic by treating a Register& as a JSValue*&. This had the
1083 added benefit of removing some exception checking branches from immediate
1086 3. I beefed up PropertySlot to support storing a Register* in a property
1087 slot. For now, only JSVariableObject's symbolTableGet and symbolTablePut
1088 use this functionality, but I expect more clients to use it in the future.
1090 4. I changed ArgList to be a buffer of Registers, not JSValue*'s, and I
1091 changed ArgList iterator clients to iterate Registers, not JSValue*'s.
1093 2008-07-16 Ada Chan <adachan@apple.com>
1097 * kjs/JSGlobalObject.cpp:
1099 2008-07-16 Kevin McCullough <kmccullough@apple.com>
1101 Reviewed by Sam and Geoff.
1103 <rdar://problem/5958840> Navigating to another page while profiler is
1104 attached results in slow JavaScript for all time.
1106 - The UNLIKELY keeps this from being a sunspider performance regression.
1108 * kjs/JSGlobalObject.cpp:
1109 (KJS::JSGlobalObject::~JSGlobalObject): Stop the profiler associated
1110 with this exec state.
1112 2008-07-16 Sam Weinig <sam@webkit.org>
1114 Reviewed by Steve Falkenburg.
1116 Replace adopting UString constructor in favor of explicit
1117 static adopt method.
1119 * API/JSStringRefCF.cpp:
1120 (JSStringCreateWithCFString):
1121 * kjs/StringConstructor.cpp:
1122 (KJS::stringFromCharCode):
1123 * kjs/StringPrototype.cpp:
1124 (KJS::stringProtoFuncToLowerCase):
1125 (KJS::stringProtoFuncToUpperCase):
1126 (KJS::stringProtoFuncToLocaleLowerCase):
1127 (KJS::stringProtoFuncToLocaleUpperCase):
1129 (KJS::UString::adopt):
1131 (KJS::UString::UString):
1132 (KJS::UString::~UString):
1134 2008-07-16 Ariya Hidayat <ariya.hidayat@trolltech.com>
1138 http://trolltech.com/developer/task-tracker/index_html?method=entry&id=216179
1139 Fix potential crash (on Qt for Windows port) when performing JavaScript date
1143 (KJS::getLocalTime): For the Qt port, prefer to use Windows code, i.e.
1144 localtime_s() instead of localtime() since the latter might crash (on Windows)
1145 given a non-sensible, e.g. NaN, argument.
1147 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1149 Reviewed by Anders and Geoff.
1151 https://bugs.webkit.org/show_bug.cgi?id=20023
1152 Failed assertion in PropertyNameArray.cpp
1154 This is already tested by testapi.
1156 * API/JSObjectRef.cpp: (JSPropertyNameAccumulatorAddName): Add the string to identifier
1157 table to appease PropertyNameArray.
1159 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1163 Dereference identifiers when deleting a hash table (fixes leaks with private JSGlobalData
1166 * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::~JSGlobalData):
1167 * kjs/lookup.cpp: (KJS::HashTable::deleteTable):
1169 * kjs/lexer.cpp: (KJS::Lexer::~Lexer)
1170 HashTable cannot have a destructor, because check-for-global-initializers complains about
1171 having a global constructor then.
1173 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1177 Check pthread_key_create return value.
1179 This check was helpful when debugging a crash in run-webkit-tests --threaded that happened
1180 because JSGlobalData objects were not deleted, and we were running out of pthread keys soon.
1181 It also looks useful for production builds.
1183 * wtf/ThreadSpecific.h: (WTF::::ThreadSpecific):
1185 2008-07-15 Kevin McCullough <kmccullough@apple.com>
1189 Rename pageGroupIdentifier to profileGroup to keep mention of a
1190 pageGroup out of JavaScriptCore.
1192 * kjs/JSGlobalObject.cpp:
1193 (KJS::JSGlobalObject::init):
1194 * kjs/JSGlobalObject.h:
1195 (KJS::JSGlobalObject::setProfileGroup):
1196 (KJS::JSGlobalObject::profileGroup):
1197 * profiler/ProfileGenerator.cpp:
1198 (KJS::ProfileGenerator::create):
1199 (KJS::ProfileGenerator::ProfileGenerator):
1200 * profiler/ProfileGenerator.h:
1201 (KJS::ProfileGenerator::profileGroup):
1202 * profiler/Profiler.cpp:
1203 (KJS::Profiler::startProfiling):
1204 (KJS::dispatchFunctionToProfiles):
1205 (KJS::Profiler::willExecute):
1206 (KJS::Profiler::didExecute):
1208 2008-07-14 Mark Rowe <mrowe@apple.com>
1210 Reviewed by Sam Weinig.
1212 Fix https://bugs.webkit.org/show_bug.cgi?id=20037
1213 Bug 20037: GCC 4.2 build broken due to strict aliasing violation.
1216 (KJS::UString::Rep::computeHash): Add a version of computeHash that takes a char* and explicit length.
1218 * profiler/CallIdentifier.h:
1219 (WTF::): Use new version of computeHash that takes a char* and explicit length to avoid unsafe aliasing.
1221 2008-07-14 David Hyatt <hyatt@apple.com>
1223 Fix a crashing bug in ListHashSet's -- operator. Make sure that end() can be -- by special-casing the null
1228 * wtf/ListHashSet.h:
1229 (WTF::ListHashSetConstIterator::operator--):
1231 2008-07-14 David Hyatt <hyatt@apple.com>
1233 Buidl fix. Make sure the second insertBefore method returns a value.
1235 * wtf/ListHashSet.h:
1236 (WTF::::insertBefore):
1238 2008-07-14 Adam Roben <aroben@apple.com>
1242 * JavaScriptCore.vcproj/jsc/jsc.vcproj: Added include/pthreads to the
1245 2008-07-14 Alexey Proskuryakov <ap@webkit.org>
1247 Reviewed by Kevin McCullough.
1249 Make JSGlobalData refcounted in preparation to adding a way to create contexts that share
1252 * JavaScriptCore.exp:
1253 * kjs/JSGlobalData.cpp:
1254 (KJS::JSGlobalData::create):
1255 * kjs/JSGlobalData.h:
1256 Made contructor private, and added a static create() method. Made the class inherit from
1259 * kjs/JSGlobalObject.h:
1260 (KJS::JSGlobalObject::globalData):
1261 JSGlobalData is now owned by JSGlobalObject (except for the shared one, and the common
1262 WebCore one, which are never deleted).
1264 * kjs/Shell.cpp: (main): Create JSGlobalData with create() method.
1266 2008-07-14 Simon Hausmann <hausmann@webkit.org>
1268 Fix the single-threaded build.
1270 * kjs/JSLock.cpp: Removed undeclared registerThread() function.
1271 * kjs/collector.cpp:
1272 (KJS::Heap::registerThread): Added dummy implementation.
1274 2008-07-14 Alexey Proskuryakov <ap@webkit.org>
1276 Reviewed by Geoff Garen.
1278 Eliminate per-thread JavaScript global data instance support and make arbitrary
1279 global data/global object combinations possible.
1281 * kjs/collector.cpp:
1282 (KJS::Heap::Heap): Store a JSGlobalData pointer instead of multiple pointers to its members.
1283 This allows for going from any JS object to its associated global data, currently used in
1284 JSGlobalObject constructor to initialize its JSGlobalData pointer.
1285 (KJS::Heap::registerThread): Changed thread registration data to be per-heap. Previously,
1286 only the shared heap could be used from multiple threads, so it was the only one that needed
1287 thread registration, but now this can happen to any heap.
1288 (KJS::Heap::unregisterThread): Ditto.
1289 (KJS::Heap::markStackObjectsConservatively): Adapt for the above changes.
1290 (KJS::Heap::setGCProtectNeedsLocking): Ditto.
1291 (KJS::Heap::protect): Ditto.
1292 (KJS::Heap::unprotect): Ditto.
1293 (KJS::Heap::collect): Ditto.
1294 (KJS::Heap::globalObjectCount): Use global object list associated with the current heap,
1295 not the late per-thread one.
1296 (KJS::Heap::protectedGlobalObjectCount): Ditto.
1299 (KJS::Heap::ThreadRegistrar): Added a helper object that unregisters a thread when it is
1303 (KJS::JSLock::JSLock):
1305 (KJS::JSLock::JSLock):
1306 Don't use JSLock to implicitly register threads. I've added registerThread() calls to most
1307 places that use JSLock - we cannot guarantee absolute safety unless we always mark all
1308 threads in the process, but these implicit registration calls should cover reasonable usage
1312 (JSEvaluateScript): Explicitly register the current thread.
1313 (JSCheckScriptSyntax): Explicitly register the current thread.
1314 (JSGarbageCollect): Changed to use the passed in context. Unfortunately, this creates a race
1315 condition for clients that pass an already released context to JSGarbageCollect - but it is
1316 unlikely to create real life problems.
1317 To maintain compatibility, the shared heap is collected if NULL is passed.
1319 * API/JSContextRef.cpp:
1320 (JSGlobalContextCreate): Use a new syntax for JSGlobalObject allocation.
1321 (JSGlobalContextRetain): Register the thread.
1322 (JSContextGetGlobalObject): Register the thread.
1324 * API/JSObjectRef.cpp:
1326 (JSObjectMakeFunctionWithCallback):
1327 (JSObjectMakeConstructor):
1328 (JSObjectMakeFunction):
1329 (JSObjectHasProperty):
1330 (JSObjectGetProperty):
1331 (JSObjectSetProperty):
1332 (JSObjectGetPropertyAtIndex):
1333 (JSObjectSetPropertyAtIndex):
1334 (JSObjectDeleteProperty):
1335 (JSObjectCallAsFunction):
1336 (JSObjectCallAsConstructor):
1337 (JSObjectCopyPropertyNames):
1338 (JSPropertyNameAccumulatorAddName):
1339 * API/JSValueRef.cpp:
1341 (JSValueIsInstanceOfConstructor):
1342 (JSValueMakeNumber):
1343 (JSValueMakeString):
1345 (JSValueToStringCopy):
1349 Register the thread.
1351 * API/JSStringRef.cpp: (JSStringRelease): Changed a comment to not mention per-thread contexts.
1353 * API/JSStringRefCF.cpp: Removed an unnecessary include of JSLock.h.
1355 * JavaScriptCore.exp: Export JSGlobalData constructor/destructor, now that anyone can have
1356 their own instances. Adapt to other changes, too.
1358 * JavaScriptCore.xcodeproj/project.pbxproj: Made ThreadSpecific.h private, as it is now
1359 included by collector.h and is thus needed in other projects.
1361 * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Don't initialize per-thread
1362 global data, as it no longer exists.
1364 * kjs/JSGlobalData.cpp:
1365 (KJS::JSGlobalData::JSGlobalData):
1366 (KJS::JSGlobalData::~JSGlobalData):
1367 * kjs/JSGlobalData.h:
1368 Removed support for per-thread instance. Made constructor and destructor public.
1370 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Get to now arbitrary JSGlobalData
1372 (KJS::JSGlobalObject::operator new): Changed ot take JSGlobalDatra pointer.
1373 * kjs/JSGlobalObject.h:
1378 Changed to maintain a custom JSGlobalData pointer instead of a per-thread one.
1380 2008-07-13 Ada Chan <adachan@apple.com>
1382 Windows build fix: Add wtf/RefCountedLeakCounter to the project.
1384 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
1386 2008-07-12 Jan Michael Alonzo <jmalonzo@webkit.org>
1388 Gtk, Qt and Wx build fix: Add wtf/RefCountedLeakCounter in the
1392 * JavaScriptCore.pri:
1393 * JavaScriptCoreSources.bkl:
1395 2008-07-11 Stephanie Lewis <slewis@apple.com>
1397 Reviewed by Darin Adler and Oliver Hunt.
1399 Refactor RefCounting Leak counting code into a common class.
1401 In order to export the symbols I needed to put the debug defines inside the function names
1403 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.
1405 * JavaScriptCore.exp:
1406 * JavaScriptCore.xcodeproj/project.pbxproj: add new class
1407 * kjs/nodes.cpp: remove old leak counting code
1408 * wtf/RefCountedLeakCounter.cpp: Added. create a common leak counting class
1409 * wtf/RefCountedLeakCounter.h: Added.
1411 2008-07-11 David Hyatt <hyatt@apple.com>
1413 Add an insertBefore method to ListHashSet to allow for insertions in the middle of the list (rather than just
1418 * wtf/ListHashSet.h:
1419 (WTF::::insertBefore):
1420 (WTF::::insertNodeBefore):
1422 2008-07-11 Sam Weinig <sam@webkit.org>
1424 Rubber-stamped by Darin Adler.
1426 Move call function to CallData.cpp and construct to ConstructData.cpp.
1429 * JavaScriptCore.pri:
1430 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1431 * JavaScriptCore.xcodeproj/project.pbxproj:
1432 * JavaScriptCoreSources.bkl:
1433 * kjs/AllInOneFile.cpp:
1434 * kjs/CallData.cpp: Copied from kjs/JSValue.cpp.
1435 * kjs/ConstructData.cpp: Copied from kjs/JSValue.cpp.
1438 2008-07-10 Mark Rowe <mrowe@apple.com>
1440 Reviewed by Sam Weinig.
1442 Define WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST when building WebKit to ensure that no symbols end up with the weak_import attribute.
1444 * Configurations/Base.xcconfig:
1446 2008-07-10 Mark Rowe <mrowe@apple.com>
1448 Reviewed by Sam Weinig.
1450 Fix the Tiger build by omitting annotations from methods declared in categories when using old versions of GCC.
1452 * API/WebKitAvailability.h:
1454 2008-07-10 Kevin McCullough <kmccullough@apple.com>
1458 -Minor cleanup. Renamed callTree() to head() and no longer use m_head
1459 directly but instead keep it private and access via a method().
1461 * profiler/HeavyProfile.cpp:
1462 (KJS::HeavyProfile::HeavyProfile):
1463 (KJS::HeavyProfile::generateHeavyStructure):
1464 (KJS::HeavyProfile::addNode):
1465 * profiler/Profile.h:
1466 (KJS::Profile::head):
1467 * profiler/ProfileGenerator.cpp:
1468 (KJS::ProfileGenerator::ProfileGenerator):
1470 2008-07-10 Alexey Proskuryakov <ap@webkit.org>
1472 Reviewed by Mark Rowe.
1474 Eliminate CollectorHeapIntrospector.
1476 CollectorHeapIntrospector was added primarily in the hopes to improve leaks tool output,
1477 a result that it didn't deliver. Also, it helped by labeling JSC heap regions as reported by
1478 vmmap tool, but at the same time, it made them mislabeled as malloc'd ones - the correct
1479 way to label mapped regions is to use a VM tag.
1481 So, it makes more sense to remove it completely than to make it work with multiple heaps.
1483 * JavaScriptCore.exp:
1484 * JavaScriptCore.xcodeproj/project.pbxproj:
1485 * kjs/AllInOneFile.cpp:
1486 * kjs/InitializeThreading.cpp:
1487 (KJS::initializeThreading):
1488 * kjs/collector.cpp:
1490 * kjs/CollectorHeapIntrospector.cpp: Removed.
1491 * kjs/CollectorHeapIntrospector.h: Removed.
1493 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1497 <rdar://problem/5951532> JSProfiler: Implement heavy (or bottom-up)
1499 - Implemented the time and call count portionof heavy. Now all that we
1502 * profiler/CallIdentifier.h: Removed an unused constructor.
1503 * profiler/HeavyProfile.cpp:
1504 (KJS::HeavyProfile::HeavyProfile): Set the initial time of the head
1505 node so that percentages work correctly.
1506 (KJS::HeavyProfile::mergeProfiles): Sum the times and call count of
1508 * profiler/ProfileNode.cpp: Set the intital values of time and call
1509 count when copying ProfileNodes.
1510 (KJS::ProfileNode::ProfileNode):
1512 2008-07-10 Jan Michael Alonzo <jmalonzo@webkit.org>
1516 * GNUmakefile.am: Add HeavyProfile.cpp
1518 2008-07-09 Mark Rowe <mrowe@apple.com>
1520 Reviewed by Geoff Garen.
1522 Don't warn about deprecated functions in production builds.
1524 * Configurations/Base.xcconfig:
1525 * Configurations/DebugRelease.xcconfig:
1527 2008-07-09 Darin Adler <darin@apple.com>
1529 * JavaScriptCore.pri: Fix Qt build by adding HeavyProfile.cpp.
1531 2008-07-09 Kevin Ollivier <kevino@theolliviers.com>
1533 wx biuld fix. Add HeavyProfile.cpp to build files.
1535 * JavaScriptCoreSources.bkl:
1537 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1539 - Windows build fix.
1541 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1543 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1547 * profiler/HeavyProfile.cpp:
1548 (KJS::HeavyProfile::mergeProfiles):
1550 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1552 Reviewed by Geoff and Adam.
1554 <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
1555 - This is the plumbing for bottom-up, but does not include calculating
1556 time, mostly because I'm still undclear about what the end result should
1558 - This, obviously, does not include the UI to expose this in the
1561 * JavaScriptCore.xcodeproj/project.pbxproj:
1562 * profiler/CallIdentifier.h:
1563 (KJS::CallIdentifier::CallIdentifier):
1564 (WTF::): Added HashTraits for CallIdentifiers to be used by a HashMap.
1565 * profiler/HeavyProfile.cpp: Added.
1566 (KJS::HeavyProfile::HeavyProfile):
1567 (KJS::HeavyProfile::generateHeavyStructure):
1568 (KJS::HeavyProfile::addNode):
1569 (KJS::HeavyProfile::mergeProfiles):
1570 (KJS::HeavyProfile::addAncestorsAsChildren):
1571 * profiler/HeavyProfile.h: Added.
1572 (KJS::HeavyProfile::create):
1573 (KJS::HeavyProfile::heavyProfile):
1574 (KJS::HeavyProfile::treeProfile):
1575 * profiler/Profile.cpp: Removed old commented out includes.
1576 * profiler/Profile.h: The m_head is needed by the HeavyProfile so it
1577 is now protected as opposed to private.
1578 * profiler/ProfileNode.cpp:
1579 (KJS::ProfileNode::ProfileNode): Created a constructor to copy
1581 (KJS::ProfileNode::findChild): Added a null check to make HeavyProfile
1582 children finding easier and avoid a potential crasher.
1583 * profiler/ProfileNode.h: Mostly moved things around but also added some
1584 functionality needed by HeavyProfile.
1585 (KJS::ProfileNode::create):
1586 (KJS::ProfileNode::functionName):
1587 (KJS::ProfileNode::url):
1588 (KJS::ProfileNode::lineNumber):
1589 (KJS::ProfileNode::head):
1590 (KJS::ProfileNode::setHead):
1591 (KJS::ProfileNode::setNextSibling):
1592 (KJS::ProfileNode::actualTotalTime):
1593 (KJS::ProfileNode::actualSelfTime):
1594 * profiler/TreeProfile.cpp: Implemented the ability to get a
1596 (KJS::TreeProfile::heavyProfile):
1597 * profiler/TreeProfile.h:
1599 2008-07-08 Geoffrey Garen <ggaren@apple.com>
1601 Reviewed by Oliver Hunt.
1603 Added support for checking if an object has custom properties in its
1604 property map. WebCore uses this to optimize marking DOM wrappers.
1606 2008-07-08 Simon Hausmann <hausmann@webkit.org>
1608 Prospective Gtk/Wx build fixes, add ProfileGenerator.cpp to the build.
1611 * JavaScriptCoreSources.bkl:
1613 2008-07-08 Simon Hausmann <hausmann@webkit.org>
1615 Fix the Qt build, add ProfileGenerator.cpp to the build.
1617 * JavaScriptCore.pri:
1619 2008-07-07 David Kilzer <ddkilzer@apple.com>
1621 releaseFastMallocFreeMemory() should always be defined
1625 * JavaScriptCore.exp: Changed to export C++ binding for
1626 WTF::releaseFastMallocFreeMemory() instead of C binding for
1627 releaseFastMallocFreeMemory().
1628 * wtf/FastMalloc.cpp: Moved definitions of
1629 releaseFastMallocFreeMemory() to be in the WTF namespace
1630 regardless whether FORCE_SYSTEM_MALLOC is defined.
1631 * wtf/FastMalloc.h: Moved releaseFastMallocFreeMemory() from
1632 extern "C" binding to WTF::releaseFastMallocFreeMemory().
1634 2008-07-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1638 Bug 19926: URL causes crash within a minute
1639 <https://bugs.webkit.org/show_bug.cgi?id=19926>
1641 Add a check that lastGlobalObject is non-null in Machine::execute()
1642 before copying its globals to the current register file.
1644 In theory, it is possible to make a test case for this, but it will
1645 take a while to get it right.
1648 (KJS::Machine::execute):
1650 2008-07-07 Darin Adler <darin@apple.com>
1652 Rubber stamped by Adele.
1655 (KJS::Machine::privateExecute): Fix a typo in a comment.
1657 2008-07-07 Steve Falkenburg <sfalken@apple.com>
1661 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1662 * JavaScriptCore.vcproj/testapi/testapi.vcproj:
1664 2008-07-07 Kevin McCullough <kmccullough@apple.com>
1668 When the profiler is running it gathers information and creates a
1669 Profile. After it finishes the Profile can be sorted and have other
1670 data refinements run over it. Both of these were done in the same class
1671 before. Now I split the gathering operations into a new class called
1674 * JavaScriptCore.xcodeproj/project.pbxproj:
1675 * profiler/Profile.cpp: Removed code related to the gather stage of a
1677 (KJS::Profile::create):
1678 (KJS::Profile::Profile):
1679 * profiler/Profile.h: Ditto.
1680 (KJS::Profile::title):
1681 (KJS::Profile::callTree):
1682 (KJS::Profile::setHead):
1683 * profiler/ProfileGenerator.cpp: Added. This is the class that will
1684 handle the stage of creating a Profile. Once the Profile is finished
1685 being created, this class goes away.
1686 (KJS::ProfileGenerator::create):
1687 (KJS::ProfileGenerator::ProfileGenerator):
1688 (KJS::ProfileGenerator::title):
1689 (KJS::ProfileGenerator::willExecute):
1690 (KJS::ProfileGenerator::didExecute):
1691 (KJS::ProfileGenerator::stopProfiling):
1692 (KJS::ProfileGenerator::didFinishAllExecution):
1693 (KJS::ProfileGenerator::removeProfileStart):
1694 (KJS::ProfileGenerator::removeProfileEnd):
1695 * profiler/ProfileGenerator.h: Added.
1696 (KJS::ProfileGenerator::profile):
1697 (KJS::ProfileGenerator::originatingGlobalExec):
1698 (KJS::ProfileGenerator::pageGroupIdentifier):
1699 (KJS::ProfileGenerator::client):
1700 (KJS::ProfileGenerator::stoppedProfiling):
1701 * profiler/Profiler.cpp: Now operates with the ProfileGenerator instead
1703 (KJS::Profiler::startProfiling):
1704 (KJS::Profiler::stopProfiling):
1705 (KJS::Profiler::didFinishAllExecution): It is here that the Profile is
1706 handed off to its client and the Profile Generator is no longer needed.
1707 (KJS::dispatchFunctionToProfiles):
1708 (KJS::Profiler::willExecute):
1709 (KJS::Profiler::didExecute):
1710 * profiler/Profiler.h: Cleaned up the includes and subsequently the
1711 forward declarations. Also use the new ProfileGenerator.
1712 (KJS::ProfilerClient::~ProfilerClient):
1713 (KJS::Profiler::currentProfiles):
1714 * profiler/TreeProfile.cpp: Use Profile's new interface.
1715 (KJS::TreeProfile::create):
1716 (KJS::TreeProfile::TreeProfile):
1717 * profiler/TreeProfile.h:
1719 2008-07-07 Sam Weinig <sam@webkit.org>
1721 Reviewed by Cameron Zwarich.
1723 Third step in broad cleanup effort.
1725 [ File list elided ]
1727 2008-07-06 Sam Weinig <sam@webkit.org>
1729 Reviewed by Cameron Zwarich.
1731 Second step in broad cleanup effort.
1733 [ File list elided ]
1735 2008-07-05 Sam Weinig <sam@webkit.org>
1737 Reviewed by Cameron Zwarich.
1739 First step in broad cleanup effort.
1741 [ File list elided ]
1743 2008-07-05 Sam Weinig <sam@webkit.org>
1745 Rubber-stamped by Cameron Zwarich.
1747 Rename list.h/cpp to ArgList.h/cpp.
1750 * JavaScriptCore.pri:
1751 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1752 * JavaScriptCore.xcodeproj/project.pbxproj:
1753 * JavaScriptCoreSources.bkl:
1755 * kjs/AllInOneFile.cpp:
1756 * kjs/ArgList.cpp: Copied from JavaScriptCore/kjs/list.cpp.
1757 * kjs/ArgList.h: Copied from JavaScriptCore/kjs/list.h.
1758 * kjs/IndexToNameMap.cpp:
1759 * kjs/JSGlobalData.cpp:
1760 * kjs/JSGlobalData.h:
1762 * kjs/collector.cpp:
1763 * kjs/list.cpp: Removed.
1764 * kjs/list.h: Removed.
1766 2008-07-05 Sam Weinig <sam@webkit.org>
1768 Fix non-AllInOne builds again.
1770 * kjs/BooleanPrototype.cpp:
1771 * kjs/ErrorPrototype.cpp:
1772 * kjs/FunctionPrototype.cpp:
1773 * kjs/NumberPrototype.cpp:
1774 * kjs/ObjectPrototype.cpp:
1776 2008-07-05 Sam Weinig <sam@webkit.org>
1778 Fix build on case-sensitive build systems.
1780 * kjs/IndexToNameMap.cpp:
1782 2008-07-05 Sam Weinig <sam@webkit.org>
1786 * kjs/Arguments.cpp:
1787 * kjs/BooleanPrototype.cpp:
1788 * kjs/DateConstructor.cpp:
1789 * kjs/ErrorPrototype.cpp:
1790 * kjs/FunctionPrototype.cpp:
1791 * kjs/NumberPrototype.cpp:
1792 * kjs/ObjectPrototype.cpp:
1793 * kjs/RegExpPrototype.cpp:
1794 * kjs/StringConstructor.cpp:
1797 2008-07-05 Sam Weinig <sam@webkit.org>
1799 Fix non-AllInOne build.
1801 * kjs/JSGlobalObject.cpp:
1803 2008-07-05 Sam Weinig <sam@webkit.org>
1805 Rubber-stamped by Cameron Zwarich.
1807 Split Arguments, IndexToNameMap, PrototypeFunction, GlobalEvalFunction and
1808 the functions on the global object out of JSFunction.h/cpp.
1811 * JavaScriptCore.pri:
1812 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1813 * JavaScriptCore.xcodeproj/project.pbxproj:
1814 * JavaScriptCoreSources.bkl:
1816 * kjs/AllInOneFile.cpp:
1817 * kjs/Arguments.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1818 * kjs/Arguments.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1819 * kjs/GlobalEvalFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1820 * kjs/GlobalEvalFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1821 * kjs/IndexToNameMap.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1822 * kjs/IndexToNameMap.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1823 * kjs/JSActivation.cpp:
1824 * kjs/JSFunction.cpp:
1826 * kjs/JSGlobalObject.cpp:
1827 * kjs/JSGlobalObjectFunctions.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1828 * kjs/JSGlobalObjectFunctions.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1829 The functions on the global object should be in JSGlobalObject.cpp, but putting them there
1830 was a 0.5% regression.
1832 * kjs/PrototypeFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
1833 * kjs/PrototypeFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
1838 2008-07-04 Sam Weinig <sam@webkit.org>
1840 Really fix the mac build.
1842 * JavaScriptCore.xcodeproj/project.pbxproj:
1844 2008-07-04 Sam Weinig <sam@webkit.org>
1848 * JavaScriptCore.xcodeproj/project.pbxproj:
1850 2008-07-04 Sam Weinig <sam@webkit.org>
1852 Fix non-AllInOne builds.
1855 * kjs/GetterSetter.cpp:
1856 * kjs/JSImmediate.cpp:
1857 * kjs/operations.cpp:
1859 2008-07-04 Sam Weinig <sam@webkit.org>
1861 Rubber-stamped by Dan Bernstein.
1863 Split Error and GetterSetter out of JSObject.h.
1865 * API/JSCallbackObjectFunctions.h:
1867 * JavaScriptCore.pri:
1868 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1869 * JavaScriptCore.xcodeproj/project.pbxproj:
1870 * JavaScriptCoreSources.bkl:
1871 * kjs/AllInOneFile.cpp:
1872 * kjs/ClassInfo.h: Copied from JavaScriptCore/kjs/JSObject.h.
1873 * kjs/Error.cpp: Copied from JavaScriptCore/kjs/JSObject.cpp.
1874 * kjs/Error.h: Copied from JavaScriptCore/kjs/JSObject.h.
1875 * kjs/GetterSetter.cpp:
1876 * kjs/GetterSetter.h: Copied from JavaScriptCore/kjs/JSObject.h.
1881 2008-07-04 Simon Hausmann <hausmann@webkit.org>
1883 Fix the Wx build, added TreeProfile.cpp to the build.
1885 * JavaScriptCoreSources.bkl:
1887 2008-07-03 Mark Rowe <mrowe@apple.com>
1889 Reviewed by Oliver Hunt.
1891 Fix output path of recently-added script phase to reference the correct file.
1892 This prevents Xcode from running the script phase unnecessarily, which caused
1893 the generated header to be recreated and lead to AllInOneFile.cpp rebuilding.
1895 * JavaScriptCore.xcodeproj/project.pbxproj:
1897 2008-07-03 Mark Rowe <mrowe@apple.com>
1899 Follow-up to the 64-bit build fix. Use intptr_t rather than ssize_t as
1900 the latter is non-standard and does not exist on Windows.
1903 (KJS::JSLock::lockCount):
1904 (KJS::JSLock::lock):
1905 (KJS::JSLock::unlock):
1906 (KJS::JSLock::DropAllLocks::DropAllLocks):
1909 2008-07-02 Mark Rowe <mrowe@apple.com>
1911 Fix the 64-bit build. pthread_getspecific works with pointer-sized values,
1912 so use ssize_t rather than int to track the lock count to avoid warnings about
1913 truncating the result of pthread_getspecific.
1916 (KJS::JSLock::lockCount):
1917 (KJS::JSLock::lock):
1918 (KJS::JSLock::unlock):
1919 (KJS::JSLock::DropAllLocks::DropAllLocks):
1922 2008-07-03 Geoffrey Garen <ggaren@apple.com>
1924 Reviewed by Sam Weinig.
1926 Removed checking for the array get/put fast case from the array code.
1927 Callers who want the fast case should call getIndex and/or setIndex
1928 instead. (get_by_val and put_by_val already do this.)
1930 SunSpider reports no change overall, but a 1.4% speedup on fannkuch and
1931 a 3.6% speedup on nsieve.
1933 2008-07-03 Dan Bernstein <mitz@apple.com>
1937 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added TreeProfile.{h,cpp}.
1939 2008-07-03 Dan Bernstein <mitz@apple.com>
1941 Reviewed by Anders Carlsson.
1946 (KJS::Machine::Machine):
1948 2008-07-03 Simon Hausmann <hausmann@webkit.org>
1950 Reviewed by Alexey Proskuryakov.
1952 Fix the non-threaded build.
1954 * kjs/JSGlobalData.cpp:
1955 (KJS::JSGlobalData::threadInstanceInternal):
1957 2008-07-03 Simon Hausmann <hausmann@webkit.org>
1959 Fix the Qt build, added TreeProfile to the build.
1961 * JavaScriptCore.pri:
1963 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
1967 Don't create unnecessary JSGlobalData instances.
1969 * kjs/JSGlobalData.h:
1970 * kjs/JSGlobalData.cpp:
1971 (KJS::JSGlobalData::threadInstanceExists):
1972 (KJS::JSGlobalData::sharedInstanceExists):
1973 (KJS::JSGlobalData::threadInstance):
1974 (KJS::JSGlobalData::sharedInstance):
1975 (KJS::JSGlobalData::threadInstanceInternal):
1976 (KJS::JSGlobalData::sharedInstanceInternal):
1977 Added methods to query instance existence.
1979 * kjs/InitializeThreading.cpp:
1980 (KJS::initializeThreadingOnce):
1981 Initialize thread instance static in a new way.
1985 * kjs/collector.cpp:
1986 (KJS::Heap::collect):
1987 Check for instance existence before accessing it.
1989 2008-07-02 Geoffrey Garen <ggaren@apple.com>
1991 Reviewed by Cameron Zwarich.
1993 Fixed https://bugs.webkit.org/show_bug.cgi?id=19862
1994 REGRESSION (r34907): Gmail crashes in JavaScriptCore code while editing drafts
1996 I was never able to reproduce this issue, but Cameron could, and he says
1997 that this patch fixes it.
1999 The crash seems tied to a timer or event handler callback. In such a case,
2000 the sole reference to the global object may be in the current call frame,
2001 so we can't depend on the global object to mark the call frame area in
2004 The new GC marking rule is: the global object is not responsible for
2005 marking the whole register file -- it's just responsible for the globals
2006 section it's tied to. The heap is responsible for marking the call frame area.
2008 2008-07-02 Mark Rowe <mrowe@apple.com>
2010 Reviewed by Sam Weinig.
2012 Add the ability to trace JavaScriptCore garabge collections using dtrace.
2014 * JavaScriptCore.xcodeproj/project.pbxproj: Generate the dtrace probe header
2015 file when building on a new enough version of Mac OS X.
2016 * JavaScriptCorePrefix.h: Add our standard Mac OS X version detection macros.
2017 * kjs/Tracing.d: Declare three dtrace probes.
2018 * kjs/Tracing.h: Include the generated dtrace macros if dtrace is available,
2019 otherwise provide versions that do nothing.
2020 * kjs/collector.cpp:
2021 (KJS::Heap::collect): Fire dtrace probes when starting a collection, after the
2022 mark phase has completed, and when the collection is complete.
2023 * wtf/Platform.h: Define HAVE_DTRACE when building on a new enough version of Mac OS X.
2025 2008-07-02 Geoffrey Garen <ggaren@apple.com>
2027 Rubber stamped by Oliver Hunt.
2029 Reduced the max register file size from 8MB to 2MB.
2031 We still allow about 20,000 levels of recursion.
2033 2008-07-02 Alp Toker <alp@nuanti.com>
2035 Build fix for r34960. Add TreeProfile.cpp to build.
2039 2008-07-02 Geoffrey Garen <ggaren@apple.com>
2041 Reviewed by Oliver Hunt.
2043 Optimized a[n] get for cases when a is an array or a string. When a is
2044 an array, we optimize both get and put. When a is a string, we only
2045 optimize get, since you can't put to a string.
2047 SunSpider says 3.4% faster.
2049 2008-07-02 Kevin McCullough <kmccullough@apple.com>
2053 -Small cleanup in preparation for implementing Bottom-up.
2055 * profiler/CallIdentifier.h: Rename debug function to make it clear of
2056 its output and intention to be debug only.
2057 (KJS::CallIdentifier::operator const char* ): Implement in terms of
2059 (KJS::CallIdentifier::c_str):
2060 * profiler/ProfileNode.cpp: Impelment findChild() which will be needed
2061 by the bottom-up implementation.
2062 (KJS::ProfileNode::findChild):
2063 * profiler/ProfileNode.h: Added comments to make the collections of
2064 functions more clear.
2065 (KJS::ProfileNode::operator==):
2066 (KJS::ProfileNode::c_str):
2068 2008-07-02 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2072 Bug 19776: Number.toExponential() is incorrect for numbers between 0.1 and 1
2073 <https://bugs.webkit.org/show_bug.cgi?id=19776>
2075 Perform the sign check for the exponent on the actual exponent value,
2076 which is 1 less than the value of decimalPoint, instead of on the value
2077 of decimalPoint itself.
2079 * kjs/NumberPrototype.cpp:
2080 (KJS::exponentialPartToString):
2082 2008-07-02 Kevin McCullough <kmccullough@apple.com>
2086 <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
2087 - Subclass TreeProfile as I prepare for a HeavyProfile to be comming
2090 * JavaScriptCore.xcodeproj/project.pbxproj:
2091 * profiler/Profile.cpp: By default we create a TreeProfile.
2092 (KJS::Profile::create):
2093 * profiler/Profile.h: Changes to the Profile class to make it amenable
2094 to be inherited from.
2095 (KJS::Profile::~Profile):
2096 * profiler/TreeProfile.cpp: Added.
2097 (KJS::TreeProfile::create):
2098 (KJS::TreeProfile::TreeProfile):
2099 (KJS::TreeProfile::heavyProfile):
2100 * profiler/TreeProfile.h: Added.
2101 (KJS::TreeProfile::treeProfile):
2103 2008-07-02 Kevin McCullough <kmccullough@apple.com>
2107 Broke CallIdentifier out into its own file. I did this because it's
2108 going to grow a lot soon and I wanted this to be a separate patch.
2110 * JavaScriptCore.xcodeproj/project.pbxproj:
2111 * profiler/CallIdentifier.h: Added.
2112 (KJS::CallIdentifier::CallIdentifier):
2113 (KJS::CallIdentifier::operator==):
2114 (KJS::CallIdentifier::operator!=):
2115 (KJS::CallIdentifier::operator const char* ):
2116 (KJS::CallIdentifier::toString):
2117 * profiler/ProfileNode.h:
2119 2008-07-02 Simon Hausmann <hausmann@webkit.org>
2121 Build fix. Implemented missing functions for single-threaded build.
2124 (KJS::JSLock::JSLock):
2125 (KJS::JSLock::lock):
2126 (KJS::JSLock::unlock):
2127 (KJS::JSLock::DropAllLocks::DropAllLocks):
2129 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
2131 Another non-AllInOne build fix.
2133 * kjs/JSGlobalObject.cpp: Include JSLock.h here, too.
2135 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
2137 Non-AllInOne build fix.
2139 * kjs/interpreter.cpp: Include JSLock.h.
2141 2008-06-30 Alexey Proskuryakov <ap@webkit.org>
2145 Disable JSLock for per-thread contexts.
2147 No change on SunSpider.
2149 * kjs/JSGlobalData.h:
2150 * kjs/JSGlobalData.cpp:
2151 (KJS::JSGlobalData::JSGlobalData):
2152 (KJS::JSGlobalData::sharedInstance):
2153 Added isSharedInstance as a better way to tell whether the instance is shared (legacy).
2156 (KJS::createJSLockCount):
2157 (KJS::JSLock::lockCount):
2158 (KJS::setLockCount):
2159 (KJS::JSLock::JSLock):
2160 (KJS::JSLock::lock):
2161 (KJS::JSLock::unlock):
2162 (KJS::JSLock::currentThreadIsHoldingLock):
2163 (KJS::JSLock::DropAllLocks::DropAllLocks):
2164 (KJS::JSLock::DropAllLocks::~DropAllLocks):
2166 (KJS::JSLock::JSLock):
2167 (KJS::JSLock::~JSLock):
2168 Made JSLock and JSLock::DropAllLocks constructors take a parameter to decide whether to
2169 actually lock a mutex, or only to increment recursion count. We cannot turn it into no-op
2170 if we want to keep existing assertions working.
2171 Made recursion count per-thread, now that locks may not lock.
2174 (JSEvaluateScript): Take JSLock after casting JSContextRef to ExecState* (which doesn't need
2175 locking in any case), so that a decision whether to actually lock can be made.
2176 (JSCheckScriptSyntax): Ditto.
2177 (JSGarbageCollect): Only lock while collecting the shared heap, not the per-thread one.
2179 * API/JSObjectRef.cpp:
2180 (JSClassCreate): Don't lock, as there is no reason to.
2181 (JSClassRetain): Ditto.
2182 (JSClassRelease): Ditto.
2183 (JSPropertyNameArrayRetain): Ditto.
2184 (JSPropertyNameArrayRelease): Only lock while deleting the array, as that may touch
2186 (JSPropertyNameAccumulatorAddName): Adding a string also involves an identifier table
2187 lookup, and possibly modification.
2189 * API/JSStringRef.cpp:
2190 (JSStringCreateWithCharacters):
2191 (JSStringCreateWithUTF8CString):
2194 (JSStringGetUTF8CString):
2196 * API/JSStringRefCF.cpp:
2197 (JSStringCreateWithCFString):
2198 JSStringRef operations other than releasing do not need locking.
2200 * VM/Machine.cpp: Don't include unused JSLock.h.
2202 * kjs/CollectorHeapIntrospector.cpp: (KJS::CollectorHeapIntrospector::statistics):
2203 Don't take the lock for real, as heap introspection pauses the process anyway. It seems that
2204 the existing code could cause deadlocks.
2210 The test tool uses a per-thread context, so no real locking is required.
2213 (KJS::Heap::setGCProtectNeedsLocking): Optionally protect m_protectedValues access with a
2214 per-heap mutex. This is only needed for WebCore Database code, which violates the "no data
2215 migration between threads" by using ProtectedPtr on a background thread.
2216 (KJS::Heap::isShared): Keep a shared flag here, as well.
2219 (KJS::::ProtectedPtr):
2220 (KJS::::~ProtectedPtr):
2224 ProtectedPtr is ony used from WebCore, so it doesn't need to take JSLock. An assertion in
2225 Heap::protect/unprotect guards agains possible future unlocked uses of ProtectedPtr in JSC.
2227 * kjs/collector.cpp:
2228 (KJS::Heap::Heap): Initialize m_isShared.
2229 (KJS::Heap::~Heap): No need to lock for real during destruction, but must keep assertions
2231 (KJS::destroyRegisteredThread): Registered thread list is only accessed for shared heap,
2232 so locking is always needed here.
2233 (KJS::Heap::registerThread): Ditto.
2234 (KJS::Heap::markStackObjectsConservatively): Use m_isShared instead of comparing to a shared
2235 instance for a small speedup.
2236 (KJS::Heap::setGCProtectNeedsLocking): Create m_protectedValuesMutex. There is currently no
2237 way to undo this - and ideally, Database code will be fixed to lo longer require this quirk.
2238 (KJS::Heap::protect): Take m_protectedValuesMutex (if it exists) while accessing
2240 (KJS::Heap::unprotect): Ditto.
2241 (KJS::Heap::markProtectedObjects): Ditto.
2242 (KJS::Heap::protectedGlobalObjectCount): Ditto.
2243 (KJS::Heap::protectedObjectCount): Ditto.
2244 (KJS::Heap::protectedObjectTypeCounts): Ditto.
2248 Don't include JSLock.h, which is no longer used here. As a result, an explicit include had
2249 to be added to many files in JavaScriptGlue, WebCore and WebKit.
2251 * kjs/JSGlobalObject.cpp:
2252 (KJS::JSGlobalObject::init):
2253 * API/JSCallbackConstructor.cpp:
2254 (KJS::constructJSCallback):
2255 * API/JSCallbackFunction.cpp:
2256 (KJS::JSCallbackFunction::call):
2257 * API/JSCallbackObjectFunctions.h:
2259 (KJS::::getOwnPropertySlot):
2261 (KJS::::deleteProperty):
2263 (KJS::::hasInstance):
2265 (KJS::::getPropertyNames):
2268 (KJS::::staticValueGetter):
2269 (KJS::::callbackGetter):
2270 * API/JSContextRef.cpp:
2271 (JSGlobalContextCreate):
2272 (JSGlobalContextRetain):
2273 (JSGlobalContextRelease):
2274 * API/JSValueRef.cpp:
2276 (JSValueIsStrictEqual):
2277 (JSValueIsInstanceOfConstructor):
2278 (JSValueMakeNumber):
2279 (JSValueMakeString):
2281 (JSValueToStringCopy):
2285 * JavaScriptCore.exp:
2286 * kjs/PropertyNameArray.h:
2287 (KJS::PropertyNameArray::globalData):
2288 * kjs/interpreter.cpp:
2289 (KJS::Interpreter::checkSyntax):
2290 (KJS::Interpreter::evaluate):
2291 Pass a parameter to JSLock/JSLock::DropAllLocks to decide whether the lock needs to be taken.
2293 2008-07-01 Alexey Proskuryakov <ap@webkit.org>
2297 https://bugs.webkit.org/show_bug.cgi?id=19834
2298 Failed assertion in JavaScriptCore/VM/SegmentedVector.h:82
2300 Creating a global object with a custom prototype resets it twice (wasteful!).
2301 So, addStaticGlobals() was called twice, but JSGlobalObject::reset() didn't reset
2304 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::reset): Call setRegisterArray(0, 0).
2306 * kjs/JSVariableObject.h: Changed registerArray to OwnArrayPtr. Also, added private copy
2307 constructor and operator= to ensure that no one attempts to copy this object (for whatever
2308 reason, I couldn't make Noncopyable work).
2310 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::addStaticGlobals): Allocate registerArray
2313 * kjs/JSVariableObject.cpp:
2314 (KJS::JSVariableObject::copyRegisterArray): Allocate registerArray with new[].
2315 (KJS::JSVariableObject::setRegisterArray): Avoid hitting an assertion in OwnArrayPtr when
2316 "changing" the value from 0 to 0.
2318 2008-07-01 Geoffrey Garen <ggaren@apple.com>
2320 Reviewed by Oliver Hunt.
2322 Removed and/or reordered exception checks in array-style a[n] access.
2324 SunSpider says 1.4% faster.
2327 (KJS::Machine::privateExecute): No need to check for exceptions before
2328 calling toString, toNumber and/or get. If the call ends up being observable
2329 through toString, valueOf, or a getter, we short-circuit it there, instead.
2330 In the op_del_by_val case, I removed the incorrect comment without actually
2331 removing the code, since I didn't want to tempt the GCC fates!
2334 (KJS::callDefaultValueFunction): Added exception check to prevent
2335 toString and valueOf functions from observing execution after an exception
2336 has been thrown. This removes some of the burden of exception checking
2339 (KJS::JSObject::defaultValue): Removed redundant exception check here.
2341 * kjs/PropertySlot.cpp:
2342 (KJS::PropertySlot::functionGetter): Added exception check to prevent
2343 getter functions from observing execution after an exception has been
2344 thrown. This removes some of the burden of exception checking from the
2347 2008-07-01 Geoffrey Garen <ggaren@apple.com>
2349 Reviewed by Oliver Hunt.
2351 Optimized a[n] get and put for cases where n is an immediate unsigned
2354 SunSpider says 3.5% faster.
2356 2008-07-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2360 Bug 19844: JavaScript Switch statement modifies "this"
2361 <https://bugs.webkit.org/show_bug.cgi?id=19844>
2363 Use a temporary when generating code for switch clauses to avoid
2364 overwriting 'this' or a local variable.
2367 (KJS::CaseBlockNode::emitCodeForBlock):
2369 2008-07-01 Christian Dywan <christian@twotoasts.de>
2373 * kjs/list.cpp: Include "JSCell.h"
2375 2008-07-01 Kevin McCullough <kmccullough@apple.com>
2379 * JavaScriptCore.xcodeproj/project.pbxproj:
2381 2008-07-01 Dan Bernstein <mitz@apple.com>
2383 Reviewed by Anders Carlsson.
2385 - Mac release build fix
2387 * JavaScriptCore.exp:
2389 2008-07-01 Sam Weinig <sam@webkit.org>
2391 Try and fix mac builds.
2393 * JavaScriptCore.exp:
2395 2008-07-01 Sam Weinig <sam@webkit.org>
2397 Fix non-AllInOne builds.
2401 2008-07-01 Sam Weinig <sam@webkit.org>
2403 Reviewed by Darin Adler.
2405 Split JSCell and JSNumberCell class declarations out of JSValue.h
2408 * JavaScriptCore.pri:
2409 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2410 * JavaScriptCore.xcodeproj/project.pbxproj:
2411 * JavaScriptCoreSources.bkl:
2412 * VM/JSPropertyNameIterator.h:
2413 * kjs/AllInOneFile.cpp:
2414 * kjs/JSCell.cpp: Copied from JavaScriptCore/kjs/JSValue.cpp.
2415 * kjs/JSCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
2416 (KJS::JSValue::getJSNumber):
2417 * kjs/JSNumberCell.cpp:
2418 * kjs/JSNumberCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
2422 (KJS::jsOwnedString):
2424 (KJS::JSValue::toThisJSString):
2428 2008-07-01 Anders Carlsson <andersca@apple.com>
2432 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2433 * kjs/JSGlobalObject.h:
2434 (KJS::JSGlobalObject::addStaticGlobals):
2436 2008-07-01 Simon Hausmann <hausmann@webkit.org>
2438 Build fix, include OwnPtr.h.
2440 * kjs/RegExpConstructor.h:
2442 2008-06-30 Geoffrey Garen <ggaren@apple.com>
2444 Reviewed by Oliver Hunt.
2446 Fixed a global object leak caused by the switch to one register file.
2448 Don't unconditionally mark the register file, since that logically
2449 makes all global variables GC roots, even when their global object is
2450 no longer reachable.
2452 Instead, make the global object associated with the register file
2453 responsible for marking the register file.
2455 2008-06-30 Geoffrey Garen <ggaren@apple.com>
2457 Reviewed by Oliver Hunt.
2459 Removed the "registerBase" abstraction. Since the register file never
2460 reallocates, we can keep direct pointers into it, instead of
2461 <registerBase, offset> tuples.
2463 SunSpider says 0.8% faster.
2465 2008-06-30 Oliver Hunt <oliver@apple.com>
2467 Reviewed by NOBODY (build fix).
2469 Fix build by adding all (hopefully) the missing includes.
2471 * kjs/BooleanPrototype.cpp:
2472 * kjs/DateConstructor.cpp:
2473 * kjs/ErrorPrototype.cpp:
2474 * kjs/FunctionPrototype.cpp:
2475 * kjs/NativeErrorConstructor.cpp:
2476 * kjs/NumberPrototype.cpp:
2477 * kjs/ObjectPrototype.cpp:
2478 * kjs/RegExpConstructor.cpp:
2479 * kjs/StringConstructor.cpp:
2480 * kjs/StringPrototype.cpp:
2482 2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2486 Bug 19830: REGRESSION (r34883): Google Reader doesn't show up feed list on sidebar
2487 <https://bugs.webkit.org/show_bug.cgi?id=19830>
2489 Ensure that we do not eliminate a write to a local register when doing
2490 peephole optimizations.
2492 * VM/CodeGenerator.cpp:
2493 (KJS::CodeGenerator::emitJumpIfTrue):
2494 (KJS::CodeGenerator::emitJumpIfFalse):
2496 2008-06-30 Sam Weinig <sam@webkit.org>
2498 Rubber-stamped by Darin Alder.
2500 Split InternalFunction into its own header file.
2502 * API/JSCallbackFunction.h:
2503 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2504 * JavaScriptCore.xcodeproj/project.pbxproj:
2505 * kjs/ArrayConstructor.h:
2506 * kjs/BooleanConstructor.h:
2507 * kjs/DateConstructor.h:
2508 * kjs/ErrorConstructor.h:
2509 * kjs/FunctionConstructor.h:
2510 * kjs/FunctionPrototype.h:
2511 * kjs/InternalFunction.h: Copied from kjs/JSFunction.h.
2513 * kjs/NativeErrorConstructor.h:
2514 * kjs/NumberConstructor.h:
2515 * kjs/ObjectConstructor.h:
2516 * kjs/RegExpConstructor.h:
2517 * kjs/StringConstructor.h:
2518 * profiler/Profiler.cpp:
2520 2008-06-30 Sam Weinig <sam@webkit.org>
2522 Reviewed by Kevin McCullough.
2524 Remove empty files Instruction.cpp, LabelID.cpp, Register.cpp and RegisterID.cpp.
2527 * JavaScriptCore.pri:
2528 * JavaScriptCore.xcodeproj/project.pbxproj:
2529 * JavaScriptCoreSources.bkl:
2530 * VM/Instruction.cpp: Removed.
2531 * VM/LabelID.cpp: Removed.
2532 * VM/Register.cpp: Removed.
2533 * VM/RegisterID.cpp: Removed.
2535 2008-06-30 Sam Weinig <sam@webkit.org>
2537 Rubber-stamped (reluctantly) by Kevin McCullough.
2539 Rename date_object.h/cpp to DateInstance.h/cpp
2542 * JavaScriptCore.pri:
2543 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2544 * JavaScriptCore.xcodeproj/project.pbxproj:
2545 * JavaScriptCoreSources.bkl:
2546 * kjs/AllInOneFile.cpp:
2547 * kjs/DateConstructor.cpp:
2548 * kjs/DateInstance.cpp: Copied from kjs/date_object.cpp.
2549 * kjs/DateInstance.h: Copied from kjs/date_object.h.
2550 * kjs/DatePrototype.cpp:
2551 * kjs/DatePrototype.h:
2552 * kjs/date_object.cpp: Removed.
2553 * kjs/date_object.h: Removed.
2555 2008-06-30 Sam Weinig <sam@webkit.org>
2557 Rubber-stamped by Darin Adler.
2559 Remove internal.cpp and move its contents to there own .cpp files.
2562 * JavaScriptCore.pri:
2563 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2564 * JavaScriptCore.xcodeproj/project.pbxproj:
2565 * JavaScriptCoreSources.bkl:
2566 * kjs/AllInOneFile.cpp:
2567 * kjs/GetterSetter.cpp: Copied from kjs/internal.cpp.
2568 * kjs/InternalFunction.cpp: Copied from kjs/internal.cpp.
2569 * kjs/JSNumberCell.cpp: Copied from kjs/internal.cpp.
2570 * kjs/JSString.cpp: Copied from kjs/internal.cpp.
2572 * kjs/LabelStack.cpp: Copied from kjs/internal.cpp.
2573 * kjs/NumberConstructor.cpp:
2574 * kjs/NumberObject.cpp:
2575 (KJS::constructNumber):
2576 (KJS::constructNumberFromImmediateNumber):
2577 * kjs/internal.cpp: Removed.
2579 2008-06-30 Adam Roben <aroben@apple.com>
2581 Fix <rdar://5954749> Assertion failure due to HashTable's use of
2584 HashTable was passing &value to constructDeletedValue, which in
2585 classes like WebCore::COMPtr would cause an assertion. We now pass
2586 value by reference instead of by address so that the HashTraits
2587 implementations have more flexibility in constructing the deleted
2590 Reviewed by Ada Chan.
2592 * VM/CodeGenerator.h: Updated for changes to HashTraits.
2594 (WTF::::deleteBucket): Changed to pass bucket by reference instead of
2596 (WTF::::checkKey): Ditto.
2598 (WTF::): Updated HashTraits for HashTable change.
2600 2008-07-01 Alexey Proskuryakov <ap@webkit.org>
2602 Reviewed by Cameron Zwarich.
2604 Make RegisterFile really unmap memory on destruction.
2606 This fixes run-webkit-tests --threaded, which ran out of address space in a few seconds.
2608 * VM/RegisterFile.cpp: (KJS::RegisterFile::~RegisterFile): Unmap all the memory, not just
2611 * kjs/JSGlobalObject.h: Don't include RegisterFile.h, so that changes to it don't make
2612 half of WebCore rebuild.
2614 * VM/Machine.h: Don't forward declare RegisterFile, as RegisterFile.h is included already.
2616 * VM/RegisterFile.h: (KJS::RegisterFile::RegisterFile): Assert that the allocation succeeded.
2618 2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2620 Rubber-stamped by Oliver.
2622 Correct the documentation for op_put_by_index.
2625 (KJS::Machine::privateExecute):
2627 2008-06-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2631 Bug 19821: Merge the instruction pair (less, jfalse)
2632 <https://bugs.webkit.org/show_bug.cgi?id=19821>
2634 This is a 2.4% win on SunSpider. I needed to add an ALWAYS_INLINE
2635 intrinisc to CodeGenerator::rewindBinaryOp() to avoid a massive
2636 regression in regexp-dna.
2639 (KJS::CodeBlock::dump):
2640 * VM/CodeGenerator.cpp:
2641 (KJS::CodeGenerator::rewindBinaryOp):
2642 (KJS::CodeGenerator::emitJumpIfFalse):
2644 (KJS::Machine::privateExecute):
2649 2008-06-29 Sam Weinig <sam@webkit.org>
2651 Fix non-AllInOne builds.
2656 2008-06-29 Sam Weinig <sam@webkit.org>
2661 * kjs/DatePrototype.cpp:
2663 2008-06-29 Sam Weinig <sam@webkit.org>
2665 Rubber-stamped by Cameron Zwarich.
2667 Splits ErrorConstructor, ErrorPrototype, NativeErrorConstructor and
2668 NativeErrorPrototype out of error_object.h/cpp and renames it ErrorInstance.
2671 * JavaScriptCore.pri:
2672 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2673 * JavaScriptCore.xcodeproj/project.pbxproj:
2674 * JavaScriptCoreSources.bkl:
2675 * kjs/AllInOneFile.cpp:
2676 * kjs/ArrayConstructor.cpp:
2677 * kjs/ArrayPrototype.cpp:
2678 * kjs/BooleanPrototype.cpp:
2679 * kjs/DatePrototype.cpp:
2680 * kjs/ErrorConstructor.cpp: Copied from kjs/error_object.cpp.
2681 * kjs/ErrorConstructor.h: Copied from kjs/error_object.h.
2682 * kjs/ErrorInstance.cpp: Copied from kjs/error_object.cpp.
2683 * kjs/ErrorInstance.h: Copied from kjs/error_object.h.
2684 * kjs/ErrorPrototype.cpp: Copied from kjs/error_object.cpp.
2685 * kjs/ErrorPrototype.h: Copied from kjs/error_object.h.
2686 * kjs/JSGlobalObject.cpp:
2689 * kjs/NativeErrorConstructor.cpp: Copied from kjs/error_object.cpp.
2690 * kjs/NativeErrorConstructor.h: Copied from kjs/error_object.h.
2691 * kjs/NativeErrorPrototype.cpp: Copied from kjs/error_object.cpp.
2692 * kjs/NativeErrorPrototype.h: Copied from kjs/error_object.h.
2693 * kjs/NumberPrototype.cpp:
2694 * kjs/RegExpConstructor.cpp:
2695 * kjs/RegExpObject.cpp:
2696 * kjs/RegExpPrototype.cpp:
2697 * kjs/StringPrototype.cpp:
2698 * kjs/error_object.cpp: Removed.
2699 * kjs/error_object.h: Removed.
2702 2008-06-29 Sam Weinig <sam@webkit.org>
2704 Fix non-AllInOne build.
2706 * kjs/DateConstructor.cpp:
2710 2008-06-29 Sam Weinig <sam@webkit.org>
2712 Rubber-stamped by Oliver Hunt.
2714 Splits DateConstructor and DatePrototype out of date_object.h/cpp
2715 Moves shared Date code into DateMath.
2717 * DerivedSources.make:
2719 * JavaScriptCore.pri:
2720 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2721 * JavaScriptCore.xcodeproj/project.pbxproj:
2722 * JavaScriptCoreSources.bkl:
2723 * kjs/AllInOneFile.cpp:
2724 * kjs/DateConstructor.cpp: Copied from kjs/date_object.cpp.
2725 * kjs/DateConstructor.h: Copied from kjs/date_object.h.
2727 (KJS::ymdhmsToSeconds):
2729 (KJS::skipSpacesAndComments):
2734 (KJS::formatDateUTCVariant):
2738 * kjs/DatePrototype.cpp: Copied from kjs/date_object.cpp.
2739 * kjs/DatePrototype.h: Copied from kjs/date_object.h.
2740 * kjs/JSGlobalObject.cpp:
2742 * kjs/date_object.cpp:
2743 * kjs/date_object.h:
2746 2008-06-29 Jan Michael Alonzo <jmalonzo@webkit.org>
2748 Rubber-stamped by Cameron Zwarich
2750 Fix Gtk non-AllInOne build
2752 * GNUmakefile.am: include JSVariableObject.cpp
2753 * kjs/RegExpConstructor.cpp: include RegExpObject.h
2754 * kjs/RegExpObject.h: forward declare RegExpPrototype
2756 2008-06-28 Darin Adler <darin@apple.com>
2758 Reviewed by Sam and Cameron.
2760 - fix https://bugs.webkit.org/show_bug.cgi?id=19805
2761 Array.concat turns missing array elements into "undefined"
2763 Test: fast/js/array-holes.html
2765 * JavaScriptCore.exp: No longer export JSArray::getItem.
2767 * kjs/ArrayPrototype.cpp:
2768 (KJS::arrayProtoFuncConcat): Changed to use getProperty instead of
2769 JSArray::getItem -- need to handle properties from the prototype chain
2770 instead of ignoring them.
2772 * kjs/JSArray.cpp: Removed getItem.
2773 * kjs/JSArray.h: Ditto.
2775 2008-06-28 Darin Adler <darin@apple.com>
2777 Reviewed by Cameron.
2779 - https://bugs.webkit.org/show_bug.cgi?id=19804
2780 optimize access to arrays without "holes"
2782 SunSpider says 1.8% faster.
2785 (KJS::JSArray::JSArray): Initialize m_fastAccessCutoff when creating
2786 arrays. Also updated for new location of m_vectorLength.
2787 (KJS::JSArray::getItem): Updated for new location of m_vectorLength.
2788 (KJS::JSArray::getSlowCase): Added. Broke out the non-hot parts of
2789 getOwnPropertySlot to make the hot part faster.
2790 (KJS::JSArray::getOwnPropertySlot): Added a new faster case for
2791 indices lower than m_fastAccessCutoff. We can do theese with no
2792 additional checks or branches.
2793 (KJS::JSArray::put): Added a new faster case for indices lower than
2794 m_fastAccessCutoff. We can do theese with no additional checks or
2795 branches. Moved the maxArrayIndex handling out of this function.
2796 Added code to set m_fastAccessCutoff when the very last hole in
2797 an array is filled; this is how the cutoff gets set for most arrays.
2798 (KJS::JSArray::putSlowCase): Moved the rest of the put function logic
2799 in here, to make the hot part of the put function faster.
2800 (KJS::JSArray::deleteProperty): Added code to lower m_fastAccessCutoff
2801 when a delete makes a new hole in the array.
2802 (KJS::JSArray::getPropertyNames): Updated for new location of
2804 (KJS::JSArray::increaseVectorLength): Ditto.
2805 (KJS::JSArray::setLength): Added code to lower m_fastAccessCutoff
2806 when setLength makes the array smaller.
2807 (KJS::JSArray::mark): Updated for new location of m_vectorLength.
2808 (KJS::JSArray::sort): Ditto. Set m_fastAccessCutoff after moving
2809 all the holes to the end of the array.
2810 (KJS::JSArray::compactForSorting): Ditto.
2811 (KJS::JSArray::checkConsistency): Added consistency checks fro
2812 m_fastAccessCutoff and updated for the new location of m_vectorLength.
2814 * kjs/JSArray.h: Added declarations for slow case functions.
2815 Replaced m_vectorLength with m_fastAccessCutoff.
2817 2008-06-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2821 When executing a native call, check for an exception before writing the
2825 (KJS::Machine::privateExecute):
2827 2008-06-28 Mark Rowe <mrowe@apple.com>
2829 Build fix. Flag headers as private or public as is appropriate.
2830 These settings were accidentally removed during some project file cleanup.
2832 * JavaScriptCore.xcodeproj/project.pbxproj:
2834 2008-06-28 Sam Weinig <sam@webkit.org>
2836 Rubber-stamped by Darin Adler.
2838 Splits RegExpConstructor and RegExpPrototype out of RegExpObject.h/cpp
2840 * DerivedSources.make:
2842 * JavaScriptCore.pri:
2843 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2844 * JavaScriptCore.xcodeproj/project.pbxproj:
2845 * JavaScriptCoreSources.bkl:
2847 * kjs/AllInOneFile.cpp:
2848 * kjs/JSGlobalObject.cpp:
2849 * kjs/RegExpConstructor.cpp: Copied from kjs/RegExpObject.cpp.
2850 * kjs/RegExpConstructor.h: Copied from kjs/RegExpObject.h.
2851 * kjs/RegExpObject.cpp:
2852 * kjs/RegExpObject.h:
2853 * kjs/RegExpPrototype.cpp: Copied from kjs/RegExpObject.cpp.
2854 * kjs/RegExpPrototype.h: Copied from kjs/RegExpObject.h.
2855 * kjs/StringPrototype.cpp:
2858 2008-06-28 Sam Weinig <sam@webkit.org>
2860 Fix non-AllInOne builds.
2862 * kjs/StringConstructor.cpp:
2864 2008-06-28 Sam Weinig <sam@webkit.org>
2866 Rubber-stamped by Darin Adler.
2868 Rename string_object.h/cpp to StringObject.h/cpp and split out StringObjectThatMasqueradesAsUndefined,
2869 StringConstructor and StringPrototype.
2871 * DerivedSources.make:
2873 * JavaScriptCore.pri:
2874 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2875 * JavaScriptCore.xcodeproj/project.pbxproj:
2876 * JavaScriptCoreSources.bkl:
2877 * kjs/AllInOneFile.cpp:
2878 * kjs/JSGlobalObject.cpp:
2879 * kjs/StringConstructor.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
2880 * kjs/StringConstructor.h: Copied from JavaScriptCore/kjs/string_object.h.
2881 * kjs/StringObject.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
2882 * kjs/StringObject.h: Copied from JavaScriptCore/kjs/string_object.h.
2883 * kjs/StringObjectThatMasqueradesAsUndefined.h: Copied from JavaScriptCore/kjs/string_object.h.
2884 * kjs/StringPrototype.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
2885 * kjs/StringPrototype.h: Copied from JavaScriptCore/kjs/string_object.h.
2887 * kjs/string_object.cpp: Removed.
2888 * kjs/string_object.h: Removed.
2890 2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
2892 Gtk build fix: JSVariableObject is now part of AllInOne
2896 2008-06-28 Darin Adler <darin@apple.com>
2900 - https://bugs.webkit.org/show_bug.cgi?id=19801
2901 add a feature so we can tell what regular expressions are taking time
2903 * pcre/pcre_compile.cpp:
2904 (jsRegExpCompile): Compile in the string if REGEXP_HISTOGRAM is on.
2906 * pcre/pcre_exec.cpp:
2907 (jsRegExpExecute): Add hook to time execution.
2908 (Histogram::~Histogram): Print a sorted list of what took time.
2909 (Histogram::add): Accumulate records of what took time.
2910 (HistogramTimeLogger::~HistogramTimeLogger): Hook that calls
2911 Histogram::add at the right moment and creates the global histogram
2914 * pcre/pcre_internal.h: Define REGEXP_HISTOGRAM.
2916 * pcre/pcre_tables.cpp: Added missing include of "config.h". Not needed
2917 any more, but an omissions an earlier version of this patch detected.
2918 * pcre/pcre_ucp_searchfuncs.cpp: Ditto.
2919 * pcre/pcre_xclass.cpp: Ditto.
2921 2008-06-28 Sam Weinig <sam@webkit.org>
2923 Try and fix the Windows build again.
2925 * kjs/RegExpObject.cpp:
2926 * kjs/date_object.cpp:
2927 * kjs/error_object.cpp:
2929 2008-06-28 Sam Weinig <sam@webkit.org>
2931 Rubber-stamped by Darin Adler.
2933 Remove unused StringConstructorFunction class.
2935 * kjs/string_object.h:
2937 2008-06-28 Sam Weinig <sam@webkit.org>
2941 * kjs/ArrayPrototype.cpp:
2942 * kjs/BooleanPrototype.cpp:
2943 * kjs/BooleanPrototype.h:
2944 * kjs/FunctionPrototype.cpp:
2945 * kjs/JSImmediate.cpp:
2947 * kjs/MathObject.cpp:
2948 * kjs/NumberPrototype.cpp:
2949 * kjs/NumberPrototype.h:
2950 * kjs/ObjectConstructor.cpp:
2951 * kjs/RegExpObject.h:
2952 * kjs/error_object.h:
2953 * kjs/string_object.cpp:
2955 2008-06-28 Sam Weinig <sam@webkit.org>
2957 Rubber-stamped by Oliver Hunt.
2959 Splits FunctionConstructor out of FunctionPrototype.h/cpp
2960 Splits NumberConstructor and NumberPrototype out of NumberObject.h/cpp
2961 Rename object_object.h/cpp to ObjectPrototype.h/cpp and split out ObjectConstructor.
2963 * API/JSCallbackConstructor.cpp:
2964 * API/JSClassRef.cpp:
2965 * API/JSObjectRef.cpp:
2966 * DerivedSources.make:
2968 * JavaScriptCore.pri:
2969 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2970 * JavaScriptCore.xcodeproj/project.pbxproj:
2971 * JavaScriptCoreSources.bkl:
2973 * kjs/AllInOneFile.cpp:
2974 * kjs/ArrayConstructor.cpp:
2975 * kjs/ArrayConstructor.h:
2976 * kjs/FunctionConstructor.cpp: Copied from JavaScriptCore/kjs/FunctionPrototype.cpp.
2977 * kjs/FunctionConstructor.h: Copied from JavaScriptCore/kjs/FunctionPrototype.h.
2978 * kjs/FunctionPrototype.cpp:
2979 * kjs/FunctionPrototype.h:
2980 * kjs/JSFunction.cpp:
2981 * kjs/JSGlobalObject.cpp:
2982 * kjs/JSImmediate.cpp:
2984 * kjs/NumberConstructor.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
2985 * kjs/NumberConstructor.h: Copied from JavaScriptCore/kjs/NumberObject.h.
2986 * kjs/NumberObject.cpp:
2987 * kjs/NumberObject.h:
2988 * kjs/NumberPrototype.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
2989 * kjs/NumberPrototype.h: Copied from JavaScriptCore/kjs/NumberObject.h.
2990 * kjs/ObjectConstructor.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
2991 * kjs/ObjectConstructor.h: Copied from JavaScriptCore/kjs/object_object.h.
2992 * kjs/ObjectPrototype.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
2993 * kjs/ObjectPrototype.h: Copied from JavaScriptCore/kjs/object_object.h.
2994 * kjs/RegExpObject.h:
2996 * kjs/error_object.h:
2999 * kjs/object_object.cpp: Removed.
3000 * kjs/object_object.h: Removed.
3001 * kjs/string_object.h:
3003 2008-06-28 Darin Adler <darin@apple.com>
3007 - fix https://bugs.webkit.org/show_bug.cgi?id=19796
3008 optimize expressions with ignored results (especially post-increment)
3010 SunSpider says 0.9% faster.
3012 * VM/CodeGenerator.h:
3013 (KJS::CodeGenerator::tempDestination): Create a new temporary for
3014 ignoredResult() too, just as we would for 0.
3015 (KJS::CodeGenerator::finalDestination): Use the temporary if the
3016 register passed in is ignoredResult() too, just as we would for 0.
3017 (KJS::CodeGenerator::destinationForAssignResult): Return 0 if the
3018 passed in register is ignoredResult(), just as we would for 0.
3019 (KJS::CodeGenerator::moveToDestinationIfNeeded): Return 0 if the
3020 register passed in is ignoredResult(). What matters is that we
3021 don't want to emit a move. The return value won't be looked at.
3022 (KJS::CodeGenerator::emitNode): Allow ignoredResult() and pass it
3023 through to the node's emitCode function.
3026 (KJS::ignoredResult): Added. Special value to indicate the result of
3027 a node will be ignored and need not be put in any register.
3030 (KJS::NullNode::emitCode): Do nothing if dst == ignoredResult().
3031 (KJS::BooleanNode::emitCode): Ditto.
3032 (KJS::NumberNode::emitCode): Ditto.
3033 (KJS::StringNode::emitCode): Ditto.
3034 (KJS::RegExpNode::emitCode): Ditto.
3035 (KJS::ThisNode::emitCode): Ditto.
3036 (KJS::ResolveNode::emitCode): Do nothing if dst == ignoredResult() and
3037 the identifier resolves to a local variable.
3038 (KJS::ObjectLiteralNode::emitCode): Do nothing if dst == ignoredResult()
3039 and the object is empty.
3040 (KJS::PostIncResolveNode::emitCode): If dst == ignoredResult(), then do
3041 nothing for the local constant case, and do a pre-increment in all the
3043 (KJS::PostDecResolveNode::emitCode): Ditto.
3044 (KJS::PostIncBracketNode::emitCode): Ditto.
3045 (KJS::PostDecBracketNode::emitCode): Ditto.
3046 (KJS::PostIncDotNode::emitCode): Ditto.
3047 (KJS::PostDecDotNode::emitCode): Ditto.
3048 (KJS::DeleteValueNode::emitCode): Pass ignoredResult() when evaluating
3050 (KJS::VoidNode::emitCode): Ditto.
3051 (KJS::TypeOfResolveNode::emitCode): If dst == ignoredResult(), do nothing
3052 if the identifier resolves to a local variable, and don't bother generating
3053 a typeof opcode in the other case.
3054 (KJS::TypeOfValueNode::emitCode): Ditto.
3055 (KJS::PreIncResolveNode::emitCode): Do nothing if dst == ignoredResult() and
3056 the identifier resolves to a local constant.
3057 (KJS::PreDecResolveNode::emitCode): Ditto.
3058 (KJS::AssignResolveNode::emitCode): Turn ignoredResult() into 0 in a couple
3059 places, because we need to put the result into a register so we can assign
3060 it. At other sites this is taken care of by functions like finalDestination.
3061 (KJS::CommaNode::emitCode): Pass ignoredResult() when evaluating the first
3063 (KJS::ForNode::emitCode): Pass ignoredResult() when evaluating the first and
3065 (KJS::ForInNode::emitCode): Pass ignoredResult() when evaluating the first
3068 2008-06-28 Darin Adler <darin@apple.com>
3072 - https://bugs.webkit.org/show_bug.cgi?id=19787
3073 create most arrays from values in registers rather than with multiple put operations
3075 SunSpider says 0.8% faster.
3078 (KJS::CodeBlock::dump): Added argv and argc parameters to new_array.
3080 (KJS::Machine::privateExecute): Ditto.
3082 * VM/CodeGenerator.cpp:
3083 (KJS::CodeGenerator::emitNewArray): Added.
3084 * VM/CodeGenerator.h: Added ElementNode* argument to emitNewArray.
3087 (KJS::ArrayNode::emitCode): Pass the ElementNode to emitNewArray so it can be
3088 initialized with as many elements as possible. If the array doesn't have any
3089 holes in it, that's all that's needed. If there are holes, then emit some separate
3090 put operations for the other values in the array and for the length as needed.
3092 * kjs/nodes.h: Added some accessors to ElementNode so the code generator can
3093 iterate through elements and generate code to evaluate them. Now ArrayNode does
3094 not need to be a friend. Also took out some unused PlacementNewAdoptType
3097 2008-06-28 Darin Adler <darin@apple.com>
3101 * kjs/nodes.h: Remove obsolete PlacementNewAdopt constructors.
3102 We no longer mutate the AST in place.
3104 2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
3106 Reviewed by Oliver Hunt.
3110 * VM/Machine.cpp: include stdio.h for printf
3112 2008-06-27 Sam Weinig <sam@webkit.org>
3114 Reviewed by Oliver Hunt.
3116 Fix platforms that don't use AllInOne.cpp
3118 * kjs/BooleanConstructor.h:
3119 * kjs/BooleanPrototype.h:
3120 * kjs/FunctionPrototype.cpp:
3122 2008-06-27 Sam Weinig <sam@webkit.org>
3124 Rubber-stamped by Oliver Hunt.
3126 Splits ArrayConstructor out of ArrayPrototype.h/cpp
3127 Splits BooleanConstructor and BooleanPrototype out of BooleanObject.h/cpp
3130 * JavaScriptCore.pri:
3131 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3132 * JavaScriptCore.xcodeproj/project.pbxproj:
3133 * JavaScriptCoreSources.bkl:
3135 * kjs/AllInOneFile.cpp:
3136 * kjs/ArrayConstructor.cpp: Copied from kjs/ArrayPrototype.cpp.
3137 * kjs/ArrayConstructor.h: Copied from kjs/ArrayPrototype.h.
3138 * kjs/ArrayPrototype.cpp:
3139 * kjs/ArrayPrototype.h:
3140 * kjs/BooleanConstructor.cpp: Copied from kjs/BooleanObject.cpp.
3141 * kjs/BooleanConstructor.h: Copied from kjs/BooleanObject.h.
3142 * kjs/BooleanObject.cpp:
3143 * kjs/BooleanObject.h:
3144 * kjs/BooleanPrototype.cpp: Copied from kjs/BooleanObject.cpp.
3145 * kjs/BooleanPrototype.h: Copied from kjs/BooleanObject.h.
3146 * kjs/CommonIdentifiers.h:
3147 * kjs/FunctionPrototype.cpp:
3149 * kjs/JSGlobalObject.cpp:
3150 * kjs/JSImmediate.cpp:
3154 * kjs/string_object.cpp:
3156 2008-06-27 Oliver Hunt <oliver@apple.com>
3160 Bug 18626: SQUIRRELFISH: support the "slow script" dialog <https://bugs.webkit.org/show_bug.cgi?id=18626>
3161 <rdar://problem/5973931> Slow script dialog needs to be reimplemented for squirrelfish
3163 Adds support for the slow script dialog in squirrelfish. This requires the addition
3164 of three new op codes, op_loop, op_loop_if_true, and op_loop_if_less which have the
3165 same behaviour as their simple jump equivalents but have an additional time out check.
3167 Additional assertions were added to other jump instructions to prevent accidentally
3168 creating loops with jump types that do not support time out checks.
3170 Sunspider does not report a regression, however this appears very sensitive to code
3171 layout and hardware, so i would expect up to a 1% regression on other systems.
3173 Part of this required moving the old timeout logic from JSGlobalObject and into Machine
3174 which is the cause of a number of the larger diff blocks.
3176 * JavaScriptCore.exp:
3178 (KJS::CodeBlock::dump):
3179 * VM/CodeGenerator.cpp:
3180 (KJS::CodeGenerator::emitJumpIfTrue):
3181 (KJS::CodeGenerator::emitJumpScopes):
3182 * VM/ExceptionHelpers.cpp:
3183 (KJS::InterruptedExecutionError::isWatchdogException):
3184 (KJS::createInterruptedExecutionException):
3185 * VM/ExceptionHelpers.h:
3188 (KJS::Machine::Machine):
3189 (KJS::Machine::throwException):
3190 (KJS::Machine::resetTimeoutCheck):
3191 (KJS::getCurrentTime):
3192 (KJS::Machine::checkTimeout):
3193 (KJS::Machine::privateExecute):
3195 (KJS::Machine::setTimeoutTime):
3196 (KJS::Machine::startTimeoutCheck):
3197 (KJS::Machine::stopTimeoutCheck):
3198 (KJS::Machine::initTimeout):
3202 * kjs/JSGlobalObject.cpp:
3203 (KJS::JSGlobalObject::init):
3204 (KJS::JSGlobalObject::setTimeoutTime):
3205 (KJS::JSGlobalObject::startTimeoutCheck):
3206 * kjs/JSGlobalObject.h:
3208 * kjs/interpreter.cpp:
3209 (KJS::Interpreter::evaluate):
3211 2008-06-27 Jan Michael Alonzo <jmalonzo@webkit.org>
3213 Gtk and Qt build fix: Remove RegisterFileStack from the build
3217 * JavaScriptCore.pri:
3219 2008-06-27 Adele Peterson <adele@apple.com>
3225 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3226 * VM/RegisterFile.h:
3227 (KJS::RegisterFile::RegisterFile):
3228 * kjs/JSGlobalObject.cpp:
3229 * kjs/collector.cpp:
3231 2008-06-27 Geoffrey Garen <ggaren@apple.com>
3233 Reviewed by Oliver Hunt.
3235 One RegisterFile to rule them all!
3237 SunSpider reports a 0.2% speedup.
3239 This patch removes the RegisterFileStack abstraction and replaces it with
3240 a single register file that
3242 (a) allocates a fixed storage area, including a fixed area for global
3243 vars, so that no operation may cause the register file to reallocate
3247 (b) swaps between global storage areas when executing code in different
3250 This patch also changes the layout of the register file so that all call
3251 frames, including call frames for global code, get a header. This is
3252 required to support re-entrant global code. It also just makes things simpler.
3254 * VM/CodeGenerator.cpp:
3255 (KJS::CodeGenerator::addGlobalVar): New function. Differs from addVar in
3258 (a) global vars don't contribute to a CodeBlock's numLocals count, since
3259 global storage is fixed and allocated at startup
3263 (b) references to global vars get shifted to elide intermediate stack
3264 between "r" and the global storage area.
3267 (KJS::Machine::dumpRegisters): Updated this function to match the new
3268 register file layout, and added the ability to dump exact identifiers
3269 for the different parts of a call frame.
3271 (KJS::Machine::unwindCallFrame): Updated this function to match the new
3272 register file layout.
3274 (KJS::Machine::execute): Updated this function to initialize a call frame
3275 header for global code, and to swap global storage areas when switching
3276 to execution in a new global object.
3278 (KJS::Machine::privateExecute): Got rid of "safeForReentry" and re-reading
3279 of registerBase because the register file is always safe for reentry now,
3280 and registerBase never changes.
3282 * VM/Machine.h: Moved the call frame header enum from Machine to RegisterFile,
3283 to resolve a header dependency problem (a good sign that the enum belonged
3284 in RegisterFile all along!)
3286 * VM/RegisterFile.cpp:
3287 * VM/RegisterFile.h: Changed RegisterFile to mmap a fixed size register
3288 area. This allows us to avoid re-allocting the register file later on.
3289 Instead, we rely on the OS to allocate physical pages to the register
3292 * VM/RegisterFileStack.cpp: Removed. Tada!
3293 * VM/RegisterFileStack.h: Removed. Tada!
3295 * kjs/DebuggerCallFrame.cpp: Updated this class to match the new
3296 register file layout, greatly simplifying it in the process.
3298 * kjs/JSActivation.h:
3299 * kjs/JSActivation.cpp: Moved some of this logic up to JSVariableObject,
3300 since the global object now needs to be able to tear off its registers
3301 just like the activation object.
3303 * kjs/JSFunction.cpp: No need to fiddle with the register file anymore.
3305 * kjs/JSGlobalObject.h:
3306 * kjs/JSGlobalObject.cpp: Updated JSGlobalObject to support moving its
3307 global storage area into and out of the register file.
3309 * kjs/PropertySlot.cpp: No need to fiddle with the register file anymore.
3311 * kjs/collector.cpp: Renamed markStackObjectConservatively to
3312 markConservatively, since we don't just mark stack objects this way.
3314 Also, added code to mark the machine's register file.
3316 * kjs/config.h: Moved some platforms #defines from here...
3317 * wtf/Platform.h: ...to here, to support mmap/VirtualAlloc detection
3320 2008-06-26 Mark Rowe <mrowe@apple.com>
3322 Speculative fix for the Windows build.
3324 * kjs/JSImmediate.cpp:
3326 2008-06-26 Mark Rowe <mrowe@apple.com>
3328 Reviewed by Darin Adler and Geoff Garen.
3330 Fix the malloc zone introspection functions so that malloc_zone_statistics does not give
3331 bogus output in an application that uses JavaScriptCore.
3333 * kjs/CollectorHeapIntrospector.cpp:
3334 (KJS::CollectorHeapIntrospector::statistics): Return statistics about memory allocated by the collector.
3335 * kjs/CollectorHeapIntrospector.h:
3336 * wtf/FastMalloc.cpp: Zero out the statistics. FastMalloc doesn't track this information at present.
3337 Returning zero for all values is preferable to returning bogus data.
3339 2008-06-26 Darin Adler <darin@apple.com>
3343 - https://bugs.webkit.org/show_bug.cgi?id=19721
3344 speed up JavaScriptCore by not wrapping strings in objects just
3345 to call functions on them
3347 - optimize UString append and the replace function a bit
3349 SunSpider says 1.8% faster.
3351 * JavaScriptCore.exp: Updated.
3353 * VM/JSPropertyNameIterator.cpp: Added include of JSString.h, now needed
3354 because jsString returns a JSString*.
3357 (KJS::Machine::privateExecute): Removed the toObject call from native
3358 function calls. Also removed code to put the this value into a register.
3360 * kjs/BooleanObject.cpp:
3361 (KJS::booleanProtoFuncToString): Rewrite to handle false and true
3364 * kjs/FunctionPrototype.cpp:
3365 (KJS::constructFunction): Use single-character append rather than building
3366 a string for each character.
3367 * kjs/JSFunction.cpp:
3368 (KJS::globalFuncUnescape): Ditto.
3370 * kjs/JSImmediate.cpp:
3371 (KJS::JSImmediate::prototype): Added. Gets the appropriate prototype for
3372 use with an immediate value. To be used instead of toObject when doing a
3373 get on an immediate value.
3374 * kjs/JSImmediate.h: Added prototype.
3377 (KJS::JSObject::toString): Tweaked formatting.
3380 (KJS::JSValue::get): Use prototype instead of toObject to avoid creating
3381 an object wrapper just to search for properties. This also saves an
3382 unnecessary hash table lookup since the object wrappers themselves don't
3383 have any properties.
3385 * kjs/JSString.h: Added toThisString and toThisJSString.
3388 (KJS::JSCell::toThisString): Added.
3389 (KJS::JSCell::toThisJSString): Added.
3390 (KJS::JSCell::getJSNumber): Added.
3391 (KJS::jsString): Changed return type to JSString*.
3392 (KJS::jsOwnedString): Ditto.
3395 (KJS::JSValue::toThisString): Added.
3396 (KJS::JSValue::toThisJSString): Added.
3397 (KJS::JSValue::getJSNumber): Added.
3399 * kjs/NumberObject.cpp:
3400 (KJS::NumberObject::getJSNumber): Added.
3401 (KJS::integer_part_noexp): Append C string directly rather than first
3402 turning it into a UString.
3403 (KJS::numberProtoFuncToString): Use getJSNumber to check if the value
3404 is a number rather than isObject(&NumberObject::info). This works for
3405 immediate numbers, number cells, and NumberObject instances.
3406 (KJS::numberProtoFuncToLocaleString): Ditto.
3407 (KJS::numberProtoFuncValueOf): Ditto.
3408 (KJS::numberProtoFuncToFixed): Ditto.
3409 (KJS::numberProtoFuncToExponential): Ditto.
3410 (KJS::numberProtoFuncToPrecision): Ditto.
3411 * kjs/NumberObject.h: Added getJSNumber.
3413 * kjs/PropertySlot.cpp: Tweaked comment.
3416 (KJS::JSString::toThisString): Added.
3417 (KJS::JSString::toThisJSString): Added.
3418 (KJS::JSString::getOwnPropertySlot): Changed code that searches the
3419 prototype chain to start with the string prototype and not create a
3421 (KJS::JSNumberCell::toThisString): Added.
3422 (KJS::JSNumberCell::getJSNumber): Added.
3425 (KJS::staticFunctionGetter): Moved here, because there's no point in
3426 having a function that's only used for a function pointer be inline.
3427 (KJS::setUpStaticFunctionSlot): New function for getStaticFunctionSlot.
3430 (KJS::staticValueGetter): Don't mark this inline. It doesn't make sense
3431 to have a function that's only used for a function pointer be inline.
3432 (KJS::getStaticFunctionSlot): Changed to get properties from the parent
3433 first before doing any handling of functions. This is the fastest way
3434 to return the function once the initial setup is done.
3436 * kjs/string_object.cpp:
3437 (KJS::StringObject::getPropertyNames): Call value() instead of getString(),
3438 avoiding an unnecessary virtual function call (the call to the type()
3439 function in the implementation of the isString() function).
3440 (KJS::StringObject::toString): Added.
3441 (KJS::StringObject::toThisString): Added.
3442 (KJS::StringObject::toThisJSString): Added.
3443 (KJS::substituteBackreferences): Rewrote to use a appending algorithm
3444 instead of a the old one that tried to replace in place.
3445 (KJS::stringProtoFuncReplace): Merged this function and the replace function.
3446 Replaced the hand-rolled dynamic arrays for source ranges and replacements
3448 (KJS::stringProtoFuncToString): Handle JSString as well as StringObject.
3449 Removed the separate valueOf implementation, since it can just share this.
3450 (KJS::stringProtoFuncCharAt): Use toThisString, which handles JSString as
3451 well as StringObject, and is slightly more efficient than the old code too.
3452 (KJS::stringProtoFuncCharCodeAt): Ditto.
3453 (KJS::stringProtoFuncConcat): Ditto.
3454 (KJS::stringProtoFuncIndexOf): Ditto.
3455 (KJS::stringProtoFuncLastIndexOf): Ditto.
3456 (KJS::stringProtoFuncMatch): Ditto.
3457 (KJS::stringProtoFuncSearch): Ditto.
3458 (KJS::stringProtoFuncSlice): Ditto.
3459 (KJS::stringProtoFuncSplit): Ditto.
3460 (KJS::stringProtoFuncSubstr): Ditto.
3461 (KJS::stringProtoFuncSubstring): Ditto.
3462 (KJS::stringProtoFuncToLowerCase): Use toThisJSString.
3463 (KJS::stringProtoFuncToUpperCase): Ditto.
3464 (KJS::stringProtoFuncToLocaleLowerCase): Ditto.
3465 (KJS::stringProtoFuncToLocaleUpperCase): Ditto.
3466 (KJS::stringProtoFuncLocaleCompare): Ditto.
3467 (KJS::stringProtoFuncBig): Use toThisString.
3468 (KJS::stringProtoFuncSmall): Ditto.
3469 (KJS::stringProtoFuncBlink): Ditto.
3470 (KJS::stringProtoFuncBold): Ditto.
3471 (KJS::stringProtoFuncFixed): Ditto.
3472 (KJS::stringProtoFuncItalics): Ditto.
3473 (KJS::stringProtoFuncStrike): Ditto.
3474 (KJS::stringProtoFuncSub): Ditto.
3475 (KJS::stringProtoFuncSup): Ditto.
3476 (KJS::stringProtoFuncFontcolor): Ditto.
3477 (KJS::stringProtoFuncFontsize): Ditto.
3478 (KJS::stringProtoFuncAnchor): Ditto.
3479 (KJS::stringProtoFuncLink): Ditto.
3481 * kjs/string_object.h: Added toString, toThisString, and toThisJSString.
3484 (KJS::UString::append): Added a version that takes a character pointer and
3485 size, so we don't have to create a UString just to append to another UString.
3488 2008-06-26 Alexey Proskuryakov <ap@webkit.org>
3492 Make JSGlobalData per-thread.
3494 No change on SunSpider total.
3496 * wtf/ThreadSpecific.h: Re-enabled the actual implementation.
3498 * kjs/JSGlobalObject.cpp:
3499 (KJS::JSGlobalObject::~JSGlobalObject): Re-added a JSLock-related assertion. We'll probably
3500 want to preserve these somehow to keep legacy behavior in working condition.
3501 (KJS::JSGlobalObject::init): Initialize globalData pointer earlier, so that it is ready
3502 when updating JSGlobalObject linked list.
3504 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::head): Changed head() to be non-static, and
3505 to use JSGlobalData associated with the current object.
3507 * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Removed a no longer needed
3508 Heap::registerAsMainThread() call.
3510 * kjs/JSGlobalData.h: Removed a lying lie comment - parserObjectExtraRefCounts is not
3511 transient, and while newParserObjects may conceptually be such, there is still some node
3512 manipulation going on outside Parser::parse which touches it.
3514 * kjs/JSGlobalData.cpp:
3515 (KJS::JSGlobalData::~JSGlobalData): Delete recently added members.
3516 (KJS::JSGlobalData::sharedInstance): Actually use a separate instance.
3518 * kjs/collector.cpp:
3520 (KJS::Heap::~Heap): Added a destructor, which unconditionally deletes everything.
3521 (KJS::Heap::sweep): Removed code related to "collect on main thread only" logic.
3522 (KJS::Heap::collect): Ditto.
3523 (KJS::Heap::globalObjectCount): Explicitly use per-thread instance of JSGlobalObject linked
3524 list now that JSGlobalObject::head() is not static. Curently, WebCoreStatistics methods only
3525 work with the main thread currently anyway.
3526 (KJS::Heap::protectedGlobalObjectCount): Ditto.
3528 * kjs/collector.h: Removed code related to "collect on main thread only" logic.