1 2008-02-20 Michael Knaup <michael.knaup@mac.com>
5 Fix for Bug 16753: date set methods with no args should result in NaN (Acid3 bug)
6 The set values result in NaN now when called with no args, NaN or +/- inf values.
7 The setYear, setFullYear and setUTCFullYear methods used on NaN dates work as
8 descripted in the standard.
10 * kjs/date_object.cpp:
11 (KJS::fillStructuresUsingTimeArgs):
12 (KJS::fillStructuresUsingDateArgs):
13 (KJS::setNewValueFromTimeArgs):
14 (KJS::setNewValueFromDateArgs):
15 (KJS::dateProtoFuncSetYear):
17 2008-02-19 Anders Carlsson <andersca@apple.com>
21 Change OpaqueJSClass and RootObject to start with a ref count of 1.
24 (OpaqueJSClass::OpaqueJSClass):
25 (OpaqueJSClass::createNoAutomaticPrototype):
26 (OpaqueJSClass::create):
28 * API/JSObjectRef.cpp:
30 * bindings/runtime_root.cpp:
31 (KJS::Bindings::RootObject::create):
32 (KJS::Bindings::RootObject::RootObject):
34 2008-02-19 Darin Adler <darin@apple.com>
36 Rubber stamped by Anders.
38 - removed explicit initialization to 1 for RefCounted; that's now the default
41 (KJS::RegExp::RegExp): Removed RefCounted initializer.
43 2008-02-19 Darin Adler <darin@apple.com>
47 - next step for http://bugs.webkit.org/show_bug.cgi?id=17257
48 start ref counts at 1 instead of 0 for speed
51 (WTF::RefCounted::RefCounted): Have refcounts default to 1. This allows us to start
52 removing the explicit initialization of RefCounted from classes and eventually we
53 can remove the ability to have the initial count of 0 entirely.
55 2008-02-18 Samuel Weinig <sam@webkit.org>
57 Reviewed by Geoff Garen.
59 Fix for http://bugs.webkit.org/show_bug.cgi?id=17419
60 Remove CompatMode from JavaScriptCore as it is never set to anything other than NativeMode
62 * kjs/JSGlobalObject.cpp:
63 (KJS::JSGlobalObject::init):
64 * kjs/JSGlobalObject.h:
65 (KJS::JSGlobalObject::setDebugger):
66 * kjs/date_object.cpp:
67 (KJS::dateProtoFuncGetYear):
69 2008-02-18 Darin Adler <darin@apple.com>
74 (WTF::toASCIIHexValue): Added.
76 2008-02-17 Darin Adler <darin@apple.com>
78 * wtf/ListHashSet.h: (WTF::swap): Removed stray return statement.
80 2008-02-15 Adam Roben <aroben@apple.com>
82 Make JavaScriptCore's FEATURE_DEFINES match WebCore's
86 * Configurations/JavaScriptCore.xcconfig:
88 2008-02-14 Stephanie Lewis <slewis@apple.com>
94 * JavaScriptCore.order:
96 2008-02-14 Geoffrey Garen <ggaren@apple.com>
98 Reviewed by Sam Weinig.
100 Fixed <rdar://problem/5737835> nee http://bugs.webkit.org/show_bug.cgi?id=17329
101 Crash in JSGlobalObject::popActivation when inserting hyperlink in Wordpress (17329)
103 Don't reset the "activations" stack in JSGlobalObject::reset, since we
104 might be executing a script during the call to reset, and the script
105 needs to safely run to completion.
107 Instead, initialize the "activations" stack when the global object is
108 created, and subsequently rely on pushing and popping during normal
109 execution to maintain the stack's state.
111 * kjs/JSGlobalObject.cpp:
112 (KJS::JSGlobalObject::init):
113 (KJS::JSGlobalObject::reset):
115 2008-02-13 Bernhard Rosenkraenzer <bero@arklinux.org>
119 - http://bugs.webkit.org/show_bug.cgi?id=17339
120 JavaScriptCore does not build with gcc 4.3
122 * kjs/interpreter.cpp: Add include of <unistd.h>, since that's where
125 2008-02-13 Oliver Hunt <oliver@apple.com>
127 Reviewed by Alexey P.
129 <rdar://problem/5737003> REGRESSION (r27747): can't browse pictures on fastcupid.com
131 When converting numeric values to booleans we need to account for NaN
134 (KJS::MultNode::evaluateToBoolean):
135 (KJS::ModNode::evaluateToBoolean):
137 2008-02-08 Samuel Weinig <sam@webkit.org>
139 Reviewed by Brady Eidson.
141 <rdar://problem/5659216> REGRESSION: PLT 0.3% slower due to r28868 (caching ClassNodeList and NamedNodeList)
143 - Tweak the statements in isASCIISpace to account for the statistical distribution of
146 .4% speedup on my machine. Stephanie's machine shows this as .3% speedup.
151 2008-02-11 Sam Weinig <sam@webkit.org>
153 Reviewed by Anders Carlsson.
156 <rdar://problem/5735497> Match Firefox's cross-domain model more accurately by return the built-in version of functions even if they have been overridden
157 <rdar://problem/5735443> Crash when setting the Window objects prototype to a custom Object and then calling a method on it
159 - Expose the native Object.prototype.toString implementation so that it can be used for cross-domain
162 * JavaScriptCore.exp:
163 * kjs/object_object.cpp:
164 * kjs/object_object.h:
166 2008-02-10 Darin Adler <darin@apple.com>
168 Rubber stamped by Eric.
171 (KJS::ExecState::takeException): Added.
173 2008-02-10 Darin Adler <darin@apple.com>
177 - http://bugs.webkit.org/show_bug.cgi?id=17256
178 eliminate default ref. count of 0 in RefCounted class
181 (WTF::RefCounted::RefCounted): Remove default of 0.
183 2008-02-10 Darin Adler <darin@apple.com>
187 - http://bugs.webkit.org/show_bug.cgi?id=17256
188 Make clients of RefCounted explicitly set the count to 0.
190 * API/JSClassRef.cpp:
191 (OpaqueJSClass::OpaqueJSClass):
192 * bindings/runtime_root.cpp:
193 (KJS::Bindings::RootObject::RootObject):
195 2008-02-09 Darin Adler <darin@apple.com>
199 - http://bugs.webkit.org/show_bug.cgi?id=17256
200 Change RegExp to start its ref count at 1, not 0
202 We'll want to do this to every RefCounted class, one at a time.
205 (KJS::RegExpNode::RegExpNode): Use RegExp::create instead of new RegExp.
207 (KJS::RegExp::RegExp): Marked inline, set initial ref count to 1.
208 (KJS::RegExp::create): Added. Calls new RegExp then adopts the initial ref.
209 * kjs/regexp.h: Reformatted. Made the constructors private. Added static
210 create functions that return objects already wrapped in PassRefPtr.
211 * kjs/regexp_object.cpp:
212 (KJS::regExpProtoFuncCompile): Use RegExp::create instead of new RegExp.
213 (KJS::RegExpObjectImp::construct): Ditto.
214 * kjs/string_object.cpp:
215 (KJS::stringProtoFuncMatch): Ditto.
216 (KJS::stringProtoFuncSearch): Ditto.
218 2008-02-08 Oliver Hunt <oliver@apple.com>
222 <rdar://problem/5731773> REGRESSION (r28973): Extraneous parentheses in function.toString()
223 https://bugs.webkit.org/show_bug.cgi?id=17214
225 Make a subclass of CommaNode to provide the correct precedence for each expression in
226 a variable declaration list.
230 (KJS::VarDeclCommaNode::):
232 2008-02-08 Darin Adler <darin@apple.com>
236 - fix http://bugs.webkit.org/show_bug.cgi?id=17247
237 Labelled continue/break can fail in some cases
239 Test: fast/js/continue-break-multiple-labels.html
242 (KJS::StatementNode::pushLabel): Made this virtual.
243 (KJS::LabelNode::pushLabel): Forward pushLabel calls to the statement inside.
245 2008-02-08 Darin Adler <darin@apple.com>
249 - fix http://bugs.webkit.org/show_bug.cgi?id=15003
250 Function.prototype.constructor should not be DontDelete/ReadOnly (Acid3 bug)
252 Test: fast/js/constructor-attributes.html
254 * kjs/JSGlobalObject.cpp:
255 (KJS::JSGlobalObject::reset): Remove unwanted attributes from "constructor".
256 * kjs/function_object.cpp:
257 (KJS::FunctionObjectImp::construct): Ditto.
259 (KJS::FuncDeclNode::makeFunction): Ditto.
260 (KJS::FuncExprNode::evaluate): Ditto.
262 2008-02-06 Geoffrey Garen <ggaren@apple.com>
264 Reviewed by Oliver Hunt.
266 Added an ASSERT to catch refCount underflow, since it caused a leak in
270 (WTF::RefCounted::deref):
272 2008-02-06 Geoffrey Garen <ggaren@apple.com>
274 Reviewed by Darin Adler.
276 PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
277 slower due to r28884 (global variable symbol table optimization)
279 Tweaked RefCounted::deref() to be a little more efficient.
281 1% - 1.5% speedup on my machine. .7% speedup on Stephanie's machine.
284 (WTF::RefCounted::deref): Don't modify m_refCount if we're just going
285 to delete the object anyway. Also, use a simple == test, which might be
286 faster than <= on some hardware.
288 2008-02-06 Darin Adler <darin@apple.com>
292 - fix http://bugs.webkit.org/show_bug.cgi?id=17094
293 Array.prototype functions create length properties with DontEnum/DontDelete
295 Test results match Gecko with very few obscure exceptions that seem to be
298 Test: fast/js/array-functions-non-arrays.html
300 * kjs/array_object.cpp:
301 (KJS::arrayProtoFuncConcat): Removed DontEnum and DontDelete from the call
303 (KJS::arrayProtoFuncPop): Ditto. Also added missing call to deleteProperty,
304 which is not needed for real arrays, but is needed for non-arrays.
305 (KJS::arrayProtoFuncPush): Ditto.
306 (KJS::arrayProtoFuncShift): Ditto.
307 (KJS::arrayProtoFuncSlice): Ditto.
308 (KJS::arrayProtoFuncSort): Removed incorrect call to set length when
309 the array has no elements.
310 (KJS::arrayProtoFuncSplice): Removed DontEnum and DontDelete from the call
312 (KJS::arrayProtoFuncUnShift): Ditto. Also added a check for 0 arguments to
313 make behavior match the specification in that case.
315 (KJS::ArrayNode::evaluate): Removed DontEnum and DontDelete from the call
318 2008-02-06 Darin Adler <darin@apple.com>
322 - replace calls to put to set up properties with calls to putDirect, to
323 prepare for a future change where put won't take attributes any more,
324 and for a slight performance boost
326 * API/JSObjectRef.cpp:
327 (JSObjectMakeConstructor): Use putDirect instead of put.
328 * kjs/CommonIdentifiers.h: Removed lastIndex.
329 * kjs/JSGlobalObject.cpp:
330 (KJS::JSGlobalObject::reset): Use putDirect instead of put.
331 * kjs/array_object.cpp:
332 (KJS::arrayProtoFuncConcat): Took out extra call to get length (unused).
333 (KJS::ArrayObjectImp::ArrayObjectImp): Use putDirect instead of put.
334 * kjs/error_object.cpp:
335 (KJS::ErrorPrototype::ErrorPrototype): Use putDirect instead of put.
337 (KJS::Arguments::Arguments): Use putDirect instead of put.
338 (KJS::PrototypeFunction::PrototypeFunction): Use putDirect instead of put.
339 * kjs/function_object.cpp:
340 (KJS::FunctionObjectImp::construct): Use putDirect instead of put.
342 (KJS::FuncDeclNode::makeFunction): Use putDirect instead of put.
343 (KJS::FuncExprNode::evaluate): Use putDirect instead of put.
344 * kjs/regexp_object.cpp:
345 (KJS::regExpProtoFuncCompile): Use setLastIndex instead of put(lastIndex).
346 (KJS::RegExpImp::match): Get and set lastIndex by using m_lastIndex instead of
348 * kjs/regexp_object.h:
349 (KJS::RegExpImp::setLastIndex): Added.
350 * kjs/string_object.cpp:
351 (KJS::stringProtoFuncMatch): Use setLastIndex instead of put(lastIndex).
353 2008-02-05 Sam Weinig <sam@webkit.org>
355 Reviewed by Anders Carlsson.
357 Fix for http://bugs.webkit.org/show_bug.cgi?id=8080
358 NodeList (and other DOM lists) items are not enumeratable using for..in
360 * JavaScriptCore.exp:
362 2008-02-05 Mark Rowe <mrowe@apple.com>
364 Reviewed by Oliver Hunt.
366 Update versioning to support the mysterious future.
368 * Configurations/Version.xcconfig: Add SYSTEM_VERSION_PREFIX_1060.
370 2008-02-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
372 Reviewed by Oliver Hunt.
374 Fixes Bug 16889: REGRESSION (r29425): Canvas-based graphing calculator fails to run
375 Bug 17015: REGRESSION (r29414-29428): www.fox.com "shows" menu fails to render
376 Bug 17164: REGRESSION: JavaScript pop-up menu appears at wrong location when hovering image at http://news.chinatimes.com/
378 <http://bugs.webkit.org/show_bug.cgi?id=16889>
379 <rdar://problem/5696255>
381 <http://bugs.webkit.org/show_bug.cgi?id=17015>
383 <http://bugs.webkit.org/show_bug.cgi?id=17164>
384 <rdar://problem/5720947>
386 The ActivationImp tear-off (r29425) introduced a problem with ReadModify
387 nodes that first resolve a slot, call valueForReadModifyNode(), and then
388 store a value in the previously resolved slot. Since valueForReadModifyNode()
389 may cause a tear-off, the slot needs to be resolved again, but this was
390 not happening with the existing code.
393 (KJS::ReadModifyLocalVarNode::evaluate):
394 (KJS::ReadModifyResolveNode::evaluate):
396 2008-02-04 Cameron McCormack <cam@mcc.id.au>
398 Reviewed by Geoff Garen.
400 Remove some unneccesary UNUSED_PARAMs. Clarify ownership rule of return value of JSObjectCopyPropertyNames.
403 (JSNode_appendChild):
404 (JSNode_removeChild):
405 (JSNode_replaceChild):
406 (JSNode_getNodeType):
407 (JSNode_getFirstChild):
412 2008-02-04 Rodney Dawes <dobey@wayofthemonkey.com>
414 Reviewed by Alp Toker and Mark Rowe.
416 Fix http://bugs.webkit.org/show_bug.cgi?id=17175.
417 Bug 17175: Use of C++ compiler flags in CFLAGS
419 * GNUmakefile.am: Use global_cxxflags as well as global_cflags in CXXFLAGS.
421 2008-02-04 Alp Toker <alp@atoker.com>
423 Rubber-stamped by Mark Rowe.
425 Remove all trailing whitespace in the GTK+ port and related
430 2008-02-02 Darin Adler <darin@apple.com>
432 Reviewed by Geoff Garen.
434 PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
435 slower due to r28884 (global variable symbol table optimization)
437 Geoff's theory is that the slowdown was due to copying hash tables when
438 putting things into the back/forward cache. If that's true, then this
439 should fix the problem.
441 (According to Geoff's measurements, in a PLT that exaggerates the
442 importance of symbol table saving during cached page creation, this
443 patch is a ~3X speedup in cached page creation, and a 9% speedup overall.)
445 * JavaScriptCore.exp: Updated.
447 * kjs/JSVariableObject.cpp:
448 (KJS::JSVariableObject::saveLocalStorage): Updated for changes to SavedProperty,
449 which has been revised to avoid initializing each SavedProperty twice when building
450 the array. Store the property names too, so we don't have to store the symbol table
451 separately. Do this by iterating the symbol table instead of the local storage vector.
452 (KJS::JSVariableObject::restoreLocalStorage): Ditto. Restore the symbol table as
453 well as the local storage vector.
455 * kjs/JSVariableObject.h: Removed save/restoreSymbolTable and do that work inside
456 save/restoreLocalStorage instead. Made restoreLocalStorage a non-const member function
457 that takes a const reference to a SavedProperties object.
459 * kjs/LocalStorage.h: Changed attributes to be unsigned instead of int to match
460 other declarations of attributes elsewhere.
462 * kjs/property_map.cpp:
463 (KJS::SavedProperties::SavedProperties): Updated for data member name change.
464 (KJS::PropertyMap::save): Updated for data member name change and to use the new
465 inline init function instead of setting the fields directly. This allows us to
466 skip initializing the SavedProperty objects when first allocating the array, and
467 just do it when we're actually setting up the individual elements.
468 (KJS::PropertyMap::restore): Updated for SavedProperty changes.
470 * kjs/property_map.h: Changed SavedProperty from a struct to a class. Set it up so
471 it does not get initialized at construction time to avoid initializing twice when
472 creating an array of SavedProperty. Removed the m_ prefixes from the members of
473 the SavedProperties struct. Generally we use m_ for class members and not struct.
475 2008-02-02 Tony Chang <idealisms@gmail.com>
477 Reviewed by darin. Landed by eseidel.
479 Add #define guards for WIN32_LEAN_AND_MEAN and _CRT_RAND_S.
482 * wtf/FastMalloc.cpp:
485 2008-01-28 Sam Weinig <sam@webkit.org>
487 Rubber-stamped by Darin Adler.
489 - Fix whitespace in nodes.h/cpp and nodes2string.cpp.
491 (NOTE: Specific changed functions elided for space and clarity)
494 * kjs/nodes2string.cpp:
496 2008-01-27 Sam Weinig <sam@webkit.org>
498 Reviewed by Oliver Hunt.
500 Patch for http://bugs.webkit.org/show_bug.cgi?id=17025
501 nodes.h/cpp has been rolling around in the mud - lets hose it down
503 - Rename member variables to use the m_ prefix.
505 (NOTE: Specific changed functions elided for space and clarity)
509 * kjs/nodes2string.cpp:
511 2008-01-27 Darin Adler <darin@apple.com>
515 - fix <rdar://problem/5657450> REGRESSION: const is broken
517 Test: fast/js/const.html
519 SunSpider said this was 0.3% slower. And I saw some Shark samples in
520 JSGlobalObject::put -- not a lot but a few. We may be able to regain the
521 speed, but for now we will take that small hit for correctness sake.
523 * kjs/JSGlobalObject.cpp:
524 (KJS::JSGlobalObject::put): Pass the checkReadOnly flag in to symbolTablePut
525 instead of passing attributes.
527 * kjs/JSVariableObject.h:
528 (KJS::JSVariableObject::symbolTablePut): Removed the code to set attributes
529 here, since we only set attributes when creating a property. Added the code
530 to check read-only here, since we need that to implement const!
533 (KJS::ActivationImp::put): Pass the checkReadOnly flag in to symbolTablePut
534 instead of passing attributes.
537 (KJS::isConstant): Added.
538 (KJS::PostIncResolveNode::optimizeVariableAccess): Create a PostIncConstNode
539 if optimizing for a local variable and the variable is constant.
540 (KJS::PostDecResolveNode::optimizeVariableAccess): Ditto. But PostDecConstNode.
541 (KJS::PreIncResolveNode::optimizeVariableAccess): Ditto. But PreIncConstNode.
542 (KJS::PreDecResolveNode::optimizeVariableAccess): Ditto. But PreDecConstNode.
543 (KJS::PreIncConstNode::evaluate): Return the value + 1.
544 (KJS::PreDecConstNode::evaluate): Return the value - 1.
545 (KJS::PostIncConstNode::evaluate): Return the value converted to a number.
546 (KJS::PostDecConstNode::evaluate): Ditto.
547 (KJS::ReadModifyResolveNode::optimizeVariableAccess): Create a ReadModifyConstNode
548 if optimizing for a local variable and the variable is constant.
549 (KJS::AssignResolveNode::optimizeVariableAccess): Ditto. But AssignConstNode.
550 (KJS::ScopeNode::optimizeVariableAccess): Pass the local storage to the
551 node optimizeVariableAccess functions, since that's where we need to look to
552 figure out if a variable is constant.
553 (KJS::FunctionBodyNode::processDeclarations): Moved the call to
554 optimizeVariableAccess until after localStorage is set up.
555 (KJS::ProgramNode::processDeclarations): Ditto.
557 * kjs/nodes.h: Fixed the IsConstant and HasInitializer values. They are used
558 as flag masks, so a value of 0 will not work for IsConstant. Changed the
559 first parameter to optimizeVariableAccess to be a const reference to a symbol
560 table and added a const reference to local storage. Added classes for const
561 versions of local variable access: PostIncConstNode, PostDecConstNode,
562 PreIncConstNode, PreDecConstNode, ReadModifyConstNode, and AssignConstNode.
565 (KJS::JSObject::put): Tweaked comments a bit, and changed the checkReadOnly
566 expression to match the form used at the two other call sites.
568 2008-01-27 Darin Adler <darin@apple.com>
572 - fix http://bugs.webkit.org/show_bug.cgi?id=16498
573 ''.constructor.toString() gives [function]
575 Test: fast/js/function-names.html
577 * kjs/array_object.cpp:
578 (KJS::ArrayObjectImp::ArrayObjectImp): Use the class name as the constructor's function name.
579 * kjs/bool_object.cpp:
580 (KJS::BooleanObjectImp::BooleanObjectImp): Ditto.
581 * kjs/date_object.cpp:
582 (KJS::DateObjectImp::DateObjectImp): Ditto.
583 * kjs/error_object.cpp:
584 (KJS::ErrorPrototype::ErrorPrototype): Make the error object be an Error.
585 (KJS::ErrorObjectImp::ErrorObjectImp): Use the class name as the constructor's function name.
586 (KJS::NativeErrorPrototype::NativeErrorPrototype): Take const UString&.
587 (KJS::NativeErrorImp::NativeErrorImp): Use the prototype's name as the constructor's function
589 * kjs/error_object.h: Change ErrorPrototype to inherit from ErrorInstance. Change the
590 NativeErrorImp constructor to take a NativeErrorPrototype pointer for its prototype.
591 * kjs/function.h: Removed unneeded constructor for internal functions without names.
592 We want to avoid those!
593 * kjs/function_object.cpp:
594 (KJS::functionProtoFuncToString): Removed code that writes out just [function] for functions
595 that have no names. There's no reason to do that.
596 (KJS::FunctionObjectImp::FunctionObjectImp): Use the class name as the constructor's
598 * kjs/internal.cpp: Removed the unused constructor.
599 * kjs/number_object.cpp:
600 (KJS::fractionalPartToString): Marked static for internal linkage.
601 (KJS::exponentialPartToString): Ditto.
602 (KJS::numberProtoFuncToPrecision): Removed an unneeded else.
603 (KJS::NumberObjectImp::NumberObjectImp): Use the class name as the constructor's
605 (KJS::NumberObjectImp::getValueProperty): Tweaked formatting.
606 * kjs/object_object.cpp:
607 (KJS::ObjectObjectImp::ObjectObjectImp): Use "Object" for the function name.
608 * kjs/regexp_object.cpp:
609 (KJS::RegExpObjectImp::RegExpObjectImp): Use "RegExp" for the function name.
610 * kjs/string_object.cpp:
611 (KJS::StringObjectImp::StringObjectImp): Use the class name as the constructor's
614 2008-01-26 Darin Adler <darin@apple.com>
618 - fix http://bugs.webkit.org/show_bug.cgi?id=17027
619 Incorrect Function.toString behaviour with read/modify/write operators performed on negative numbers
621 Test: fast/js/function-toString-parentheses.html
623 The problem here was that a NumberNode with a negative number in it had the wrong
624 precedence. It's not a primary expression, it's a unary operator with a primary
627 Once the precedence of NumberNode was fixed, the cases from bug 17020 were also
628 fixed without trying to treat bracket nodes like dot nodes. That wasn't needed.
629 The reason we handle numbers before dot nodes specially is that the dot is a
630 legal character in a number. The same is not true of a bracket. Eventually we
631 could get smarter, and only add the parentheses when there is actual ambiguity.
632 There is none if the string form of the number already has a dot in it, or if
633 it's a number with a alphabetic name like infinity or NAN.
635 * kjs/nodes.h: Renamed back from ObjectAccess to DotExpr.
636 (KJS::NumberNode::precedence): Return PrecUnary for negative numbers, since
637 they serialize as a unary operator, not a primary expression.
638 * kjs/nodes2string.cpp:
639 (KJS::SourceStream::operator<<): Clear m_numberNeedsParens if this adds
640 parens; one set is enough.
641 (KJS::bracketNodeStreamTo): Remove unneeded special flag here. Normal
642 operator precedence suffices.
643 (KJS::NewExprNode::streamTo): Ditto.
645 2008-01-26 Oliver Hunt <oliver@apple.com>
647 Reviewed by Maciej and Darin.
649 Fix for http://bugs.webkit.org/show_bug.cgi?id=17020
650 Function.toString does not parenthesise numbers for the bracket accessor
652 It turns out that logic was there for all of the dot accessor nodes to make numbers be
653 parenthesised properly, so it was a trivial extension to extend that to the bracket nodes.
654 I renamed the enum type to reflect the fact that it is now used for both dot and bracket
657 * kjs/nodes2string.cpp:
658 (KJS::bracketNodeStreamTo):
659 (KJS::BracketAccessorNode::streamTo):
661 2008-01-26 Oliver Hunt <oliver@apple.com>
665 Fix Bug 17018: Incorrect code generated from Function.toString for get/setters in object literals
667 Don't quote getter and setter names during output, as that is simply wrong.
669 * kjs/nodes2string.cpp:
670 (KJS::PropertyNode::streamTo):
672 2008-01-26 Darin Adler <darin@apple.com>
674 Reviewed by Eric Seidel.
676 - http://bugs.webkit.org/show_bug.cgi?id=16860
677 a bit of cleanup after the Activation optimization
679 * JavaScriptCore.exp: Export the GlobalExecState constructor instead of
680 the global flavor of the ExecState constructor. It'd probably be cleaner
681 to not export either one, but JSGlobalObject inlines the code that
682 constructs the ExecState. If we changed that, we could remove this export.
684 * JavaScriptCore.xcodeproj/project.pbxproj: Re-sorted a few things and
685 put the new source files into the kjs group rather than at the top level.
688 (KJS::ExecState::ExecState): Marked inline and updated for data member
689 name changes. This is now only for use for the derived classes. Also removed
690 code that sets the unused m_savedExec data member for the global case. That
691 data member is only used for the other two types.
692 (KJS::ExecState::~ExecState): Marked inline and removed all the code.
693 The derived class destructors now inclde the appropriate code.
694 (KJS::ExecState::lexicalGlobalObject): Removed unneeded special case for
695 an empty scope chain. The bottom function already returns 0 for that case,
696 so the general case code handles it fine. Also changed to use data members
697 directly rather than calling functions.
698 (KJS::GlobalExecState::GlobalExecState): Added. Calls through to the base
700 (KJS::GlobalExecState::~GlobalExecState): Added.
701 (KJS::InterpreterExecState::InterpreterExecState): Added. Moved code to
702 manipulate activeExecStates here since we don't want to have to check for the
703 special case of globalExec.
704 (KJS::InterpreterExecState::~InterpreterExecState): Added.
705 (KJS::EvalExecState::EvalExecState): Added.
706 (KJS::EvalExecState::~EvalExecState): Added.
707 (KJS::FunctionExecState::FunctionExecState): Added.
708 (KJS::FunctionExecState::~FunctionExecState): Added.
710 * kjs/ExecState.h: Tweaked the header, includes, and declarations a bit.
711 Made ExecState inherit from Noncopyable. Reformatted some comments and
712 made them a bit more brief. Rearranged declarations a little bit and removed
713 unused savedExec function. Changed seenLabels function to return a reference
714 rather than a pointer. Made constructors and destructor protected, and also
715 did the same with all data members. Renamed m_thisVal to m_thisValue and
716 ls to m_labelStack. Added three new derived classes for each of the
717 types of ExecState. The primary goal here was to remove a branch from the
718 code in the destructor, but it's also clearer than overloading the arguments
719 to the ExecState constructor.
721 * kjs/JSGlobalObject.cpp:
722 (KJS::getCurrentTime): Fixed formatting.
723 (KJS::JSGlobalObject::pushActivation): Removed parentheses that don't make
724 the expression clearer -- other similar sites didn't have these parentheses,
725 even the one a couple lines earlier that sets stackEntry.
726 (KJS::JSGlobalObject::tearOffActivation): Got rid of unneeded static_cast
727 (I think I mentioned this during patch review) and used an early exit so that
728 the entire contents of the function aren't nested inside an if statement.
729 Also removed the check of codeType, instead checking Activation for 0.
730 For now, I kept the codeType check, but inside an assertion.
732 * kjs/JSGlobalObject.h: Changed type of globalExec to GlobalExecState.
734 (KJS::FunctionImp::callAsFunction): Changed type to FunctionExecState.
735 (KJS::GlobalFuncImp::callAsFunction): Changed type to EvalExecState.
736 * kjs/interpreter.cpp:
737 (KJS::Interpreter::evaluate): Changed type to GlobalExecState.
740 (KJS::ContinueNode::execute): Changed code since seenLabels() returns a
741 reference now instead of a pointer.
742 (KJS::BreakNode::execute): Ditto.
743 (KJS::LabelNode::execute): Ditto.
745 2008-01-26 Sam Weinig <sam@webkit.org>
747 Reviewed by Mark Rowe.
749 Cleanup node2string a little.
750 - Remove some unnecessary branching.
751 - Factor out bracket and dot streaming into static inline functions.
754 * kjs/nodes2string.cpp:
755 (KJS::bracketNodeStreamTo):
756 (KJS::dotNodeStreamTo):
757 (KJS::FunctionCallBracketNode::streamTo):
758 (KJS::FunctionCallDotNode::streamTo):
759 (KJS::PostIncBracketNode::streamTo):
760 (KJS::PostDecBracketNode::streamTo):
761 (KJS::PostIncDotNode::streamTo):
762 (KJS::PostDecDotNode::streamTo):
763 (KJS::DeleteBracketNode::streamTo):
764 (KJS::DeleteDotNode::streamTo):
765 (KJS::PreIncBracketNode::streamTo):
766 (KJS::PreDecBracketNode::streamTo):
767 (KJS::PreIncDotNode::streamTo):
768 (KJS::PreDecDotNode::streamTo):
769 (KJS::ReadModifyBracketNode::streamTo):
770 (KJS::AssignBracketNode::streamTo):
771 (KJS::ReadModifyDotNode::streamTo):
772 (KJS::AssignDotNode::streamTo):
773 (KJS::WhileNode::streamTo):
775 2008-01-26 Mark Rowe <mrowe@apple.com>
777 Reviewed by Darin Adler.
779 Fix http://bugs.webkit.org/show_bug.cgi?id=17001
780 Bug 17001: Build error with Gtk port on Mac OS X
782 If both XP_MACOSX and XP_UNIX are defined then X11.h and Carbon.h will both be included.
783 These provide conflicting definitions for a type named 'Cursor'. As XP_UNIX is set by
784 the build system when targeting X11, it doesn't make sense for XP_MACOSX to also be set
787 * bindings/npapi.h: Don't define XP_MACOSX if XP_UNIX is defined.
789 2008-01-26 Darin Adler <darin@apple.com>
793 - fix http://bugs.webkit.org/show_bug.cgi?id=17013
794 JSC can't round trip certain for-loops
796 Test: fast/js/toString-for-var-decl.html
798 * kjs/nodes.h: Added PlaceholderTrueNode so we can put nodes into
799 for loops without injecting the word "true" into them (nice, but not
800 the bug fix). Fixed ForNode constructor so expr1WasVarDecl is set
801 only when there is an expression, since it's common for the actual
802 variable declaration to be moved by the parser.
804 * kjs/nodes2string.cpp:
805 (KJS::PlaceholderTrueNode::streamTo): Added. Empty.
807 2008-01-25 Oliver Hunt <oliver@apple.com>
811 Fix for bug 17012: REGRESSION: JSC can't round trip an object literal
813 Add logic to ensure that object literals and function expressions get
814 parentheses when necessary.
817 * kjs/nodes2string.cpp:
818 (KJS::SourceStream::operator<<):
820 2008-01-24 Steve Falkenburg <sfalken@apple.com>
824 * JavaScriptCore.vcproj/JavaScriptCore.sln:
826 2008-01-24 Steve Falkenburg <sfalken@apple.com>
830 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
832 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
836 Fix QDateTime to JS Date conversion.
837 Several conversion errors (some UTC related, some month
838 offset related) and the conversion distance for Date
839 to DateTime conversion weights were fixed (it should never
840 be better to convert a JS Number into a Date rather than
843 * bindings/qt/qt_runtime.cpp:
844 (KJS::Bindings::convertValueToQVariant):
845 (KJS::Bindings::convertQVariantToValue):
847 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
851 Add support for calling QObjects.
852 Add support for invokeDefaultMethod (via a call to
853 a specific slot), and also allow using it as a
854 constructor, like QtScript.
857 * bindings/qt/qt_class.cpp:
858 (KJS::Bindings::QtClass::fallbackObject):
859 * bindings/qt/qt_instance.cpp:
860 (KJS::Bindings::QtRuntimeObjectImp::construct):
861 (KJS::Bindings::QtInstance::QtInstance):
862 (KJS::Bindings::QtInstance::~QtInstance):
863 (KJS::Bindings::QtInstance::implementsCall):
864 (KJS::Bindings::QtInstance::invokeDefaultMethod):
865 * bindings/qt/qt_instance.h:
866 * bindings/qt/qt_runtime.cpp:
867 (KJS::Bindings::findMethodIndex):
868 (KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
869 (KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
870 * bindings/qt/qt_runtime.h:
872 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
877 Add spaces before/after braces in inline function.
879 * bindings/qt/qt_instance.h:
881 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
886 Remove spaces and unneeded declared parameter names.
888 * bindings/qt/qt_instance.cpp:
889 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
891 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
895 Clear stale RuntimeObjectImps.
896 Since other objects can have refs to the QtInstance,
897 we can't rely on the QtInstance being deleted when the
898 RuntimeObjectImp is invalidate or deleted. This
899 could result in a stale JSObject being returned for
902 * bindings/qt/qt_instance.cpp:
903 (KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
904 (KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
905 (KJS::Bindings::QtRuntimeObjectImp::invalidate):
906 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
907 (KJS::Bindings::QtInstance::getRuntimeObject):
908 * bindings/runtime.cpp:
909 (KJS::Bindings::Instance::createRuntimeObject):
910 * bindings/runtime.h:
912 2008-01-23 Alp Toker <alp@atoker.com>
914 Rubber-stamped by Mark Rowe.
916 Remove whitespace after -I in automake include lists.
920 2008-01-23 Michael Goddard <michael.goddard@trolltech.com>
922 Reviewed by Lars Knoll <lars@trolltech.com>.
924 Reworked the JavaScriptCore Qt bindings:
926 * Add initial support for string and variant arrays, as well
927 as sub QObjects in the JS bindings.
929 * Don't expose fields marked as not scriptable by moc.
931 * Add support for dynamic properties and accessing named
932 QObject children of an object (like QtScript and older
934 * Add support for custom toString methods.
936 * Fine tune some bindings to be closer to QtScript.
937 Make void functions return undefined, and empty/
938 null QStrings return a zero length string.
940 * Create framework for allowing more direct method calls.
941 Since RuntimeMethod doesn't allow us to add additional
942 methods/properties to a function, add these classes.
943 Start prototyping object.signal.connect(...).
945 * Add signal support to the Qt bindings.
946 Allow connecting to signals (object.signal.connect(slot)),
947 disconnecting, and emitting signals. Currently chooses
948 the first signal that matches the name, so this will need
951 * Add property names, and resolve signals closer to use.
952 Enumerating properties now returns some of the Qt properties
953 and signals. Slots and methods aren't quite present. Also,
954 resolve signal connections etc. closer to the time of use, so
955 we can do more dynamic resolution based on argument type etc.
956 Still picks the first one with the same name, at the moment.
958 * Make signature comparison code consistent.
959 Use the same code for checking meta signatures in
960 the method and fallback getters, and avoid a
961 QByteArray construction when we can.
963 * Fix minor memory leak, and handle pointers better.
964 Delete the private object in the dtors, and use RefPtrs
965 for holding Instances etc.
967 * Handle method lookup better.
968 Allow invocation time method lookup based on the arguments,
969 which is closer to QtScript behaviour. Also, cache the
970 method lists and delete them in the QtClass dtor (stops
973 * Improve JS to Qt data type conversions.
974 Add some support for Date & RegExp JS objects,
975 and provide some metrics on the quality of the
978 * A couple of fixes for autotest failures.
979 Better support for converting lists, read/write only
980 QMetaProperty support, modified slot search order...)
982 * bindings/qt/qt_class.cpp:
983 (KJS::Bindings::QtClass::QtClass):
984 (KJS::Bindings::QtClass::~QtClass):
985 (KJS::Bindings::QtClass::name):
986 (KJS::Bindings::QtClass::fallbackObject):
987 (KJS::Bindings::QtClass::methodsNamed):
988 (KJS::Bindings::QtClass::fieldNamed):
989 * bindings/qt/qt_class.h:
990 * bindings/qt/qt_instance.cpp:
991 (KJS::Bindings::QtInstance::QtInstance):
992 (KJS::Bindings::QtInstance::~QtInstance):
993 (KJS::Bindings::QtInstance::getRuntimeObject):
994 (KJS::Bindings::QtInstance::getClass):
995 (KJS::Bindings::QtInstance::implementsCall):
996 (KJS::Bindings::QtInstance::getPropertyNames):
997 (KJS::Bindings::QtInstance::invokeMethod):
998 (KJS::Bindings::QtInstance::invokeDefaultMethod):
999 (KJS::Bindings::QtInstance::stringValue):
1000 (KJS::Bindings::QtInstance::booleanValue):
1001 (KJS::Bindings::QtInstance::valueOf):
1002 (KJS::Bindings::QtField::name):
1003 (KJS::Bindings::QtField::valueFromInstance):
1004 (KJS::Bindings::QtField::setValueToInstance):
1005 * bindings/qt/qt_instance.h:
1006 (KJS::Bindings::QtInstance::getBindingLanguage):
1007 (KJS::Bindings::QtInstance::getObject):
1008 * bindings/qt/qt_runtime.cpp:
1009 (KJS::Bindings::QWKNoDebug::QWKNoDebug):
1010 (KJS::Bindings::QWKNoDebug::~QWKNoDebug):
1011 (KJS::Bindings::QWKNoDebug::operator<<):
1013 (KJS::Bindings::valueRealType):
1014 (KJS::Bindings::convertValueToQVariant):
1015 (KJS::Bindings::convertQVariantToValue):
1016 (KJS::Bindings::QtRuntimeMethod::QtRuntimeMethod):
1017 (KJS::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
1018 (KJS::Bindings::QtRuntimeMethod::codeType):
1019 (KJS::Bindings::QtRuntimeMethod::execute):
1020 (KJS::Bindings::QtRuntimeMethodData::~QtRuntimeMethodData):
1021 (KJS::Bindings::QtRuntimeMetaMethodData::~QtRuntimeMetaMethodData):
1022 (KJS::Bindings::QtRuntimeConnectionMethodData::~QtRuntimeConnectionMethodData):
1023 (KJS::Bindings::QtMethodMatchType::):
1024 (KJS::Bindings::QtMethodMatchType::QtMethodMatchType):
1025 (KJS::Bindings::QtMethodMatchType::kind):
1026 (KJS::Bindings::QtMethodMatchType::isValid):
1027 (KJS::Bindings::QtMethodMatchType::isVariant):
1028 (KJS::Bindings::QtMethodMatchType::isMetaType):
1029 (KJS::Bindings::QtMethodMatchType::isUnresolved):
1030 (KJS::Bindings::QtMethodMatchType::isMetaEnum):
1031 (KJS::Bindings::QtMethodMatchType::enumeratorIndex):
1032 (KJS::Bindings::QtMethodMatchType::variant):
1033 (KJS::Bindings::QtMethodMatchType::metaType):
1034 (KJS::Bindings::QtMethodMatchType::metaEnum):
1035 (KJS::Bindings::QtMethodMatchType::unresolved):
1036 (KJS::Bindings::QtMethodMatchType::typeId):
1037 (KJS::Bindings::QtMethodMatchType::name):
1038 (KJS::Bindings::QtMethodMatchData::QtMethodMatchData):
1039 (KJS::Bindings::QtMethodMatchData::isValid):
1040 (KJS::Bindings::QtMethodMatchData::firstUnresolvedIndex):
1041 (KJS::Bindings::indexOfMetaEnum):
1042 (KJS::Bindings::findMethodIndex):
1043 (KJS::Bindings::findSignalIndex):
1044 (KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
1045 (KJS::Bindings::QtRuntimeMetaMethod::mark):
1046 (KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
1047 (KJS::Bindings::QtRuntimeMetaMethod::getOwnPropertySlot):
1048 (KJS::Bindings::QtRuntimeMetaMethod::lengthGetter):
1049 (KJS::Bindings::QtRuntimeMetaMethod::connectGetter):
1050 (KJS::Bindings::QtRuntimeMetaMethod::disconnectGetter):
1051 (KJS::Bindings::QtRuntimeConnectionMethod::QtRuntimeConnectionMethod):
1052 (KJS::Bindings::QtRuntimeConnectionMethod::callAsFunction):
1053 (KJS::Bindings::QtRuntimeConnectionMethod::getOwnPropertySlot):
1054 (KJS::Bindings::QtRuntimeConnectionMethod::lengthGetter):
1055 (KJS::Bindings::QtConnectionObject::QtConnectionObject):
1056 (KJS::Bindings::QtConnectionObject::~QtConnectionObject):
1057 (KJS::Bindings::QtConnectionObject::metaObject):
1058 (KJS::Bindings::QtConnectionObject::qt_metacast):
1059 (KJS::Bindings::QtConnectionObject::qt_metacall):
1060 (KJS::Bindings::QtConnectionObject::execute):
1061 (KJS::Bindings::QtConnectionObject::match):
1062 (KJS::Bindings::::QtArray):
1063 (KJS::Bindings::::~QtArray):
1064 (KJS::Bindings::::rootObject):
1065 (KJS::Bindings::::setValueAt):
1066 (KJS::Bindings::::valueAt):
1067 * bindings/qt/qt_runtime.h:
1068 (KJS::Bindings::QtField::):
1069 (KJS::Bindings::QtField::QtField):
1070 (KJS::Bindings::QtField::fieldType):
1071 (KJS::Bindings::QtMethod::QtMethod):
1072 (KJS::Bindings::QtMethod::name):
1073 (KJS::Bindings::QtMethod::numParameters):
1074 (KJS::Bindings::QtArray::getLength):
1075 (KJS::Bindings::QtRuntimeMethod::d_func):
1076 (KJS::Bindings::QtRuntimeMetaMethod::d_func):
1077 (KJS::Bindings::QtRuntimeConnectionMethod::d_func):
1079 * bindings/runtime.cpp:
1080 (KJS::Bindings::Instance::createBindingForLanguageInstance):
1081 (KJS::Bindings::Instance::createRuntimeObject):
1082 (KJS::Bindings::Instance::reallyCreateRuntimeObject):
1083 * bindings/runtime.h:
1085 2008-01-22 Anders Carlsson <andersca@apple.com>
1087 Reviewed by Darin and Adam.
1089 <rdar://problem/5688975>
1090 div element on microsoft site has wrong left offset.
1092 Return true even if NPN_GetProperty returns null or undefined. This matches Firefox
1093 (and is what the Silverlight plug-in expects).
1095 * bindings/NP_jsobject.cpp:
1098 2008-01-21 Geoffrey Garen <ggaren@apple.com>
1100 Reviewed by Maciej Stachowiak.
1102 Fixed http://bugs.webkit.org/show_bug.cgi?id=16909
1103 REGRESSION: Amazon.com crash (ActivationImp)
1105 (and a bunch of other crashes)
1107 Plus, a .7% SunSpider speedup to boot.
1109 Replaced the buggy currentExec and savedExec mechanisms with an
1110 explicit ExecState stack.
1112 * kjs/collector.cpp:
1113 (KJS::Collector::collect): Explicitly mark the ExecState stack.
1115 (KJS::Collector::reportOutOfMemoryToAllExecStates): Slight change in
1116 behavior: We no longer throw an exception in any global ExecStates,
1117 since global ExecStates are more like pseudo-ExecStates, and aren't
1118 used for script execution. (It's unclear what would happen if you left
1119 an exception waiting around in a global ExecState, but it probably
1122 2008-01-21 Jan Michael Alonzo <jmalonzo@unpluggable.com>
1124 Reviewed by Alp Toker.
1126 http://bugs.webkit.org/show_bug.cgi?id=16955
1127 Get errors when cross-compile webkit-gtk
1129 * GNUmakefile.am: removed ICU_CFLAGS
1131 2008-01-18 Kevin McCullough <kmccullough@apple.com>
1137 2008-01-18 Kevin McCullough <kmccullough@apple.com>
1143 (KJS::UString::cost):
1145 2008-01-18 Kevin McCullough <kmccullough@apple.com>
1149 - Correctly report cost of appended strings to trigger GC.
1153 (KJS::UString::Rep::create):
1154 (KJS::UString::UString): Don't create unnecssary objects.
1155 (KJS::UString::cost): Report cost if necessary but also keep track of
1159 2008-01-18 Simon Hausmann <hausmann@webkit.org>
1163 Fix return type conversions from Qt slots to JS values.
1165 This also fixes fast/dom/open-and-close-by-DOM.html, which called
1166 layoutTestController.windowCount().
1168 When constructing the QVariant that holds the return type we cannot
1169 use the QVarian(Type) constuctor as that will create a null variant.
1170 We have to use the QVariant(Type, void *) constructor instead, just
1171 like in QMetaObject::read() for example.
1174 * bindings/qt/qt_instance.cpp:
1175 (KJS::Bindings::QtInstance::getRuntimeObject):
1177 2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
1179 Reviewed by Simon Hausmann <hausmann@webkit.org>.
1181 Fix compilation on Win64(2): Implemented currentThreadStackBase on X86-64 on Windows
1184 * kjs/collector.cpp:
1185 (KJS::Collector::heapAllocate):
1187 2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
1189 Reviewed by Simon Hausmann <hausmann@webkit.org>.
1191 Fix compilation on Win64(1): Define WTF_PLATFORM_X86_64 correctly on Win64.
1196 2008-01-17 Antti Koivisto <antti@apple.com>
1200 * kjs/regexp_object.cpp:
1201 (KJS::regExpProtoFuncToString):
1203 2008-01-16 Sam Weinig <sam@webkit.org>
1207 Fix for http://bugs.webkit.org/show_bug.cgi?id=16901
1208 Convert remaining JS function objects to use the new PrototypeFunction class
1210 - Moves Boolean, Function, RegExp, Number, Object and Global functions to their
1211 own static function implementations so that they can be used with the
1212 PrototypeFunction class. SunSpider says this is 1.003x as fast.
1214 * kjs/JSGlobalObject.cpp:
1215 (KJS::JSGlobalObject::reset):
1216 * kjs/array_object.h:
1217 * kjs/bool_object.cpp:
1218 (KJS::BooleanInstance::BooleanInstance):
1219 (KJS::BooleanPrototype::BooleanPrototype):
1220 (KJS::booleanProtoFuncToString):
1221 (KJS::booleanProtoFuncValueOf):
1222 (KJS::BooleanObjectImp::BooleanObjectImp):
1223 (KJS::BooleanObjectImp::implementsConstruct):
1224 (KJS::BooleanObjectImp::construct):
1225 (KJS::BooleanObjectImp::callAsFunction):
1226 * kjs/bool_object.h:
1227 (KJS::BooleanInstance::classInfo):
1228 * kjs/error_object.cpp:
1229 (KJS::ErrorPrototype::ErrorPrototype):
1230 (KJS::errorProtoFuncToString):
1231 * kjs/error_object.h:
1233 (KJS::globalFuncEval):
1234 (KJS::globalFuncParseInt):
1235 (KJS::globalFuncParseFloat):
1236 (KJS::globalFuncIsNaN):
1237 (KJS::globalFuncIsFinite):
1238 (KJS::globalFuncDecodeURI):
1239 (KJS::globalFuncDecodeURIComponent):
1240 (KJS::globalFuncEncodeURI):
1241 (KJS::globalFuncEncodeURIComponent):
1242 (KJS::globalFuncEscape):
1243 (KJS::globalFuncUnEscape):
1244 (KJS::globalFuncKJSPrint):
1245 (KJS::PrototypeFunction::PrototypeFunction):
1247 * kjs/function_object.cpp:
1248 (KJS::FunctionPrototype::FunctionPrototype):
1249 (KJS::functionProtoFuncToString):
1250 (KJS::functionProtoFuncApply):
1251 (KJS::functionProtoFuncCall):
1252 * kjs/function_object.h:
1253 * kjs/number_object.cpp:
1254 (KJS::NumberPrototype::NumberPrototype):
1255 (KJS::numberProtoFuncToString):
1256 (KJS::numberProtoFuncToLocaleString):
1257 (KJS::numberProtoFuncValueOf):
1258 (KJS::numberProtoFuncToFixed):
1259 (KJS::numberProtoFuncToExponential):
1260 (KJS::numberProtoFuncToPrecision):
1261 * kjs/number_object.h:
1262 (KJS::NumberInstance::classInfo):
1263 (KJS::NumberObjectImp::classInfo):
1264 (KJS::NumberObjectImp::):
1265 * kjs/object_object.cpp:
1266 (KJS::ObjectPrototype::ObjectPrototype):
1267 (KJS::objectProtoFuncValueOf):
1268 (KJS::objectProtoFuncHasOwnProperty):
1269 (KJS::objectProtoFuncIsPrototypeOf):
1270 (KJS::objectProtoFuncDefineGetter):
1271 (KJS::objectProtoFuncDefineSetter):
1272 (KJS::objectProtoFuncLookupGetter):
1273 (KJS::objectProtoFuncLookupSetter):
1274 (KJS::objectProtoFuncPropertyIsEnumerable):
1275 (KJS::objectProtoFuncToLocaleString):
1276 (KJS::objectProtoFuncToString):
1277 * kjs/object_object.h:
1278 * kjs/regexp_object.cpp:
1279 (KJS::RegExpPrototype::RegExpPrototype):
1280 (KJS::regExpProtoFuncTest):
1281 (KJS::regExpProtoFuncExec):
1282 (KJS::regExpProtoFuncCompile):
1283 (KJS::regExpProtoFuncToString):
1284 * kjs/regexp_object.h:
1286 2008-01-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1288 Reviewed by Maciej & Darin.
1290 Fixes Bug 16868: Gmail crash
1291 and Bug 16871: Crash when loading apple.com/startpage
1293 <http://bugs.webkit.org/show_bug.cgi?id=16868>
1294 <rdar://problem/5686108>
1296 <http://bugs.webkit.org/show_bug.cgi?id=16871>
1297 <rdar://problem/5686670>
1299 Adds ActivationImp tear-off for cross-window eval() and fixes an
1300 existing garbage collection issue exposed by the ActivationImp tear-off
1301 patch (r29425) that can occur when an ExecState's m_callingExec is
1302 different than its m_savedExec.
1304 * kjs/ExecState.cpp:
1305 (KJS::ExecState::mark):
1307 (KJS::GlobalFuncImp::callAsFunction):
1309 2008-01-16 Sam Weinig <sam@webkit.org>
1313 Clean up MathObjectImp, it needed a little scrubbing.
1315 * kjs/math_object.cpp:
1316 (KJS::MathObjectImp::MathObjectImp):
1317 (KJS::MathObjectImp::getOwnPropertySlot):
1318 (KJS::MathObjectImp::getValueProperty):
1319 (KJS::mathProtoFuncACos):
1320 (KJS::mathProtoFuncASin):
1321 (KJS::mathProtoFuncATan):
1322 (KJS::mathProtoFuncATan2):
1323 (KJS::mathProtoFuncCos):
1324 (KJS::mathProtoFuncExp):
1325 (KJS::mathProtoFuncLog):
1326 (KJS::mathProtoFuncSin):
1327 (KJS::mathProtoFuncSqrt):
1328 (KJS::mathProtoFuncTan):
1329 * kjs/math_object.h:
1330 (KJS::MathObjectImp::classInfo):
1331 (KJS::MathObjectImp::):
1333 2008-01-16 Sam Weinig <sam@webkit.org>
1335 Reviewed by Geoffrey Garen.
1337 Rename Lexer variable bol to atLineStart.
1340 (KJS::Lexer::Lexer):
1341 (KJS::Lexer::setCode):
1342 (KJS::Lexer::nextLine):
1346 2008-01-16 Sam Weinig <sam@webkit.org>
1348 Reviewed by Geoffrey Garen and Anders Carlsson.
1350 Remove uses of KJS_PURE_ECMA as we don't ever build with it defined,
1351 and we have many features that are not included in the ECMA spec.
1354 (KJS::Lexer::Lexer):
1355 (KJS::Lexer::setCode):
1356 (KJS::Lexer::nextLine):
1359 * kjs/string_object.cpp:
1360 * kjs/string_object.h:
1362 2008-01-15 Sam Weinig <sam@webkit.org>
1364 Reviewed by Geoffrey Garen.
1366 Fix <rdar://problem/5595552> r27608 introduced a 20% increase in JS binary size, 4% increase in WebCore binary size
1368 - This changes the way JS functions that use Lookup tables are handled. Instead of using
1369 one class per function, which allowed specialization of the virtual callAsFunction
1370 method, we now use one class, PrototypeFunction, which takes a pointer to a static
1371 function to use as the implementation. This significantly decreases the binary size
1372 of JavaScriptCore (about 145k on an Intel only build) while still keeping some of the
1373 speedup r27608 garnered (SunSpider says this is 1.005x as slow, which should leave some
1374 wiggle room from the original 1% speedup) and keeps the functions implementations in separate
1375 functions to help with optimizations.
1377 * JavaScriptCore.exp:
1378 * JavaScriptCore.xcodeproj/project.pbxproj:
1379 * kjs/array_object.cpp:
1380 (KJS::arrayProtoFuncToString):
1381 (KJS::arrayProtoFuncToLocaleString):
1382 (KJS::arrayProtoFuncJoin):
1383 (KJS::arrayProtoFuncConcat):
1384 (KJS::arrayProtoFuncPop):
1385 (KJS::arrayProtoFuncPush):
1386 (KJS::arrayProtoFuncReverse):
1387 (KJS::arrayProtoFuncShift):
1388 (KJS::arrayProtoFuncSlice):
1389 (KJS::arrayProtoFuncSort):
1390 (KJS::arrayProtoFuncSplice):
1391 (KJS::arrayProtoFuncUnShift):
1392 (KJS::arrayProtoFuncFilter):
1393 (KJS::arrayProtoFuncMap):
1394 (KJS::arrayProtoFuncEvery):
1395 (KJS::arrayProtoFuncForEach):
1396 (KJS::arrayProtoFuncSome):
1397 (KJS::arrayProtoFuncIndexOf):
1398 (KJS::arrayProtoFuncLastIndexOf):
1399 * kjs/array_object.h:
1400 * kjs/date_object.cpp:
1401 (KJS::DatePrototype::getOwnPropertySlot):
1402 (KJS::dateProtoFuncToString):
1403 (KJS::dateProtoFuncToUTCString):
1404 (KJS::dateProtoFuncToDateString):
1405 (KJS::dateProtoFuncToTimeString):
1406 (KJS::dateProtoFuncToLocaleString):
1407 (KJS::dateProtoFuncToLocaleDateString):
1408 (KJS::dateProtoFuncToLocaleTimeString):
1409 (KJS::dateProtoFuncValueOf):
1410 (KJS::dateProtoFuncGetTime):
1411 (KJS::dateProtoFuncGetFullYear):
1412 (KJS::dateProtoFuncGetUTCFullYear):
1413 (KJS::dateProtoFuncToGMTString):
1414 (KJS::dateProtoFuncGetMonth):
1415 (KJS::dateProtoFuncGetUTCMonth):
1416 (KJS::dateProtoFuncGetDate):
1417 (KJS::dateProtoFuncGetUTCDate):
1418 (KJS::dateProtoFuncGetDay):
1419 (KJS::dateProtoFuncGetUTCDay):
1420 (KJS::dateProtoFuncGetHours):
1421 (KJS::dateProtoFuncGetUTCHours):
1422 (KJS::dateProtoFuncGetMinutes):
1423 (KJS::dateProtoFuncGetUTCMinutes):
1424 (KJS::dateProtoFuncGetSeconds):
1425 (KJS::dateProtoFuncGetUTCSeconds):
1426 (KJS::dateProtoFuncGetMilliSeconds):
1427 (KJS::dateProtoFuncGetUTCMilliseconds):
1428 (KJS::dateProtoFuncGetTimezoneOffset):
1429 (KJS::dateProtoFuncSetTime):
1430 (KJS::dateProtoFuncSetMilliSeconds):
1431 (KJS::dateProtoFuncSetUTCMilliseconds):
1432 (KJS::dateProtoFuncSetSeconds):
1433 (KJS::dateProtoFuncSetUTCSeconds):
1434 (KJS::dateProtoFuncSetMinutes):
1435 (KJS::dateProtoFuncSetUTCMinutes):
1436 (KJS::dateProtoFuncSetHours):
1437 (KJS::dateProtoFuncSetUTCHours):
1438 (KJS::dateProtoFuncSetDate):
1439 (KJS::dateProtoFuncSetUTCDate):
1440 (KJS::dateProtoFuncSetMonth):
1441 (KJS::dateProtoFuncSetUTCMonth):
1442 (KJS::dateProtoFuncSetFullYear):
1443 (KJS::dateProtoFuncSetUTCFullYear):
1444 (KJS::dateProtoFuncSetYear):
1445 (KJS::dateProtoFuncGetYear):
1446 * kjs/date_object.h:
1448 (KJS::PrototypeFunction::PrototypeFunction):
1449 (KJS::PrototypeFunction::callAsFunction):
1453 (KJS::staticFunctionGetter):
1454 * kjs/math_object.cpp:
1455 (KJS::mathProtoFuncAbs):
1456 (KJS::mathProtoFuncACos):
1457 (KJS::mathProtoFuncASin):
1458 (KJS::mathProtoFuncATan):
1459 (KJS::mathProtoFuncATan2):
1460 (KJS::mathProtoFuncCeil):
1461 (KJS::mathProtoFuncCos):
1462 (KJS::mathProtoFuncExp):
1463 (KJS::mathProtoFuncFloor):
1464 (KJS::mathProtoFuncLog):
1465 (KJS::mathProtoFuncMax):
1466 (KJS::mathProtoFuncMin):
1467 (KJS::mathProtoFuncPow):
1468 (KJS::mathProtoFuncRandom):
1469 (KJS::mathProtoFuncRound):
1470 (KJS::mathProtoFuncSin):
1471 (KJS::mathProtoFuncSqrt):
1472 (KJS::mathProtoFuncTan):
1473 * kjs/math_object.h:
1474 * kjs/string_object.cpp:
1475 (KJS::stringProtoFuncToString):
1476 (KJS::stringProtoFuncValueOf):
1477 (KJS::stringProtoFuncCharAt):
1478 (KJS::stringProtoFuncCharCodeAt):
1479 (KJS::stringProtoFuncConcat):
1480 (KJS::stringProtoFuncIndexOf):
1481 (KJS::stringProtoFuncLastIndexOf):
1482 (KJS::stringProtoFuncMatch):
1483 (KJS::stringProtoFuncSearch):
1484 (KJS::stringProtoFuncReplace):
1485 (KJS::stringProtoFuncSlice):
1486 (KJS::stringProtoFuncSplit):
1487 (KJS::stringProtoFuncSubstr):
1488 (KJS::stringProtoFuncSubstring):
1489 (KJS::stringProtoFuncToLowerCase):
1490 (KJS::stringProtoFuncToUpperCase):
1491 (KJS::stringProtoFuncToLocaleLowerCase):
1492 (KJS::stringProtoFuncToLocaleUpperCase):
1493 (KJS::stringProtoFuncLocaleCompare):
1494 (KJS::stringProtoFuncBig):
1495 (KJS::stringProtoFuncSmall):
1496 (KJS::stringProtoFuncBlink):
1497 (KJS::stringProtoFuncBold):
1498 (KJS::stringProtoFuncFixed):
1499 (KJS::stringProtoFuncItalics):
1500 (KJS::stringProtoFuncStrike):
1501 (KJS::stringProtoFuncSub):
1502 (KJS::stringProtoFuncSup):
1503 (KJS::stringProtoFuncFontcolor):
1504 (KJS::stringProtoFuncFontsize):
1505 (KJS::stringProtoFuncAnchor):
1506 (KJS::stringProtoFuncLink):
1507 * kjs/string_object.h:
1509 2008-01-15 Geoffrey Garen <ggaren@apple.com>
1511 Reviewed by Adam Roben.
1513 Some tweaks to our headerdoc, suggested by David Gatwood on the docs
1517 * API/JSObjectRef.h:
1518 * API/JSStringRef.h:
1521 2008-01-15 Alp Toker <alp@atoker.com>
1523 Rubber-stamped by Anders.
1525 Make the HTTP backend configurable in the GTK+ port. curl is currently
1528 * wtf/Platform.h: Don't hard-code WTF_USE_CURL for GTK
1530 2008-01-15 Sam Weinig <sam@webkit.org>
1532 Reviewed by Beth Dakin.
1534 Remove unneeded variable.
1536 * kjs/string_object.cpp:
1537 (KJS::StringProtoFuncSubstr::callAsFunction):
1539 2008-01-14 Steve Falkenburg <sfalken@apple.com>
1541 Use shared vsprops for most vcproj properties.
1545 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add missing Debug_Internal config.
1546 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add missing Debug_Internal config.
1547 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
1549 2008-01-14 Adam Roben <aroben@apple.com>
1551 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
1552 some headers that were missing from the vcproj so their contents will
1553 be included in Find in Files.
1555 2008-01-14 Adam Roben <aroben@apple.com>
1557 Fix Bug 16871: Crash when loading apple.com/startpage
1559 <http://bugs.webkit.org/show_bug.cgi?id=16871>
1560 <rdar://problem/5686670>
1562 Patch written by Darin, reviewed by me.
1564 * kjs/ExecState.cpp:
1565 (KJS::ExecState::mark): Call ActivationImp::markChildren if our
1566 m_activation is on the stack. This is what ScopeChain::mark also does,
1567 but apparently in some cases it's possible for an ExecState's
1568 ActivationImp to not be in any ScopeChain.
1570 2008-01-14 Kevin McCullough <kmccullough@apple.com>
1574 -<rdar://problem/5622667> REGRESSION (Leopard-ToT): Endless loading loop
1575 trying to view techreport.com comments
1576 - We need to set values in the map, because if they are already in the
1577 map they will not be reset when we use add().
1579 * kjs/array_instance.cpp:
1580 (KJS::ArrayInstance::put):
1582 2008-01-14 Darin Adler <darin@apple.com>
1586 - re-speed-up the page load test (my StringImpl change slowed it down)
1589 (WTF::RefCounted::RefCounted): Allow derived classes to start with a reference
1590 count other than 0. Eventually everyone will want to start with a 1. This is a
1591 staged change. For now, there's a default of 0, and you can specify 1. Later,
1592 there will be no default and everyone will have to specify. And then later, there
1593 will be a default of 1. Eventually, we can take away even the option of starting
1597 (WTF::Vector::Vector): Sped up creation of non-empty vectors by removing the
1598 overhead of first constructing something empty and then calling resize.
1599 (WTF::Vector::clear): Sped up the common case of calling clear on an empty
1600 vector by adding a check for that case.
1601 (WTF::Vector::releaseBuffer): Marked this function inline and removed a branch
1602 in the case of vectors with no inline capacity (normal vectors) by leaving out
1603 the code to copy the inline buffer in that case.
1605 2008-01-14 Alexey Proskuryakov <ap@webkit.org>
1607 Reviewed by David Kilzer.
1609 http://bugs.webkit.org/show_bug.cgi?id=16787
1610 array.splice() with 1 element not working
1612 Test: fast/js/array-splice.html
1614 * kjs/array_object.cpp:
1615 (KJS::ArrayProtoFuncSplice::callAsFunction): Implement this Mozilla extension, and fix
1616 some other edge cases.
1618 2008-01-13 Steve Falkenburg <sfalken@apple.com>
1620 Share common files across projects.
1623 Debug: common.vsprops, debug.vsprops
1624 Debug_Internal: common.vsprops, debug.vsprops, debug_internal.vsprops
1625 Release: common.vsprops, release.vsprops
1627 Shared properties can go into common.vsprops, shared debug settings can go into debug.vsprops.
1628 debug_internal.vsprops will be mostly empty except for file path prefix modifiers.
1630 Reviewed by Adam Roben.
1632 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1633 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
1634 * JavaScriptCore.vcproj/debug.vsprops: Removed.
1635 * JavaScriptCore.vcproj/debug_internal.vsprops: Removed.
1636 * JavaScriptCore.vcproj/release.vsprops: Removed.
1637 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
1639 2008-01-13 Marius Bugge Monsen <mbm@trolltech.com>
1641 Contributions and review by Adriaan de Groot,
1642 Simon Hausmann, Eric Seidel, and Darin Adler.
1644 - http://bugs.webkit.org/show_bug.cgi?id=16590
1645 Compilation fixes for Solaris.
1648 (KJS::GregorianDateTime::GregorianDateTime): Use the WIN_OS code path
1649 for SOLARIS too, presumably because Solaris also lacks the tm_gtoff and tm_zone
1651 (KJS::GregorianDateTime::operator tm): Ditto.
1653 * kjs/collector.cpp:
1654 (KJS::currentThreadStackBase): Use thr_stksegment on Solaris.
1657 (isfinite): Implement for Solaris.
1659 (signbit): Ditto. But this one is wrong, so I added a FIXME.
1661 * wtf/Platform.h: Define PLATFORM(SOLARIS) when "sun" or "__sun" is defined.
1663 2008-01-13 Michael Goddard <michael.goddard@trolltech.com>
1665 Reviewed by Anders Carlsson.
1667 Add binding language type to Instance.
1668 Allows runtime determination of the type of an
1669 Instance, to allow safe casting. Doesn't actually
1670 add any safe casting yet, though.
1672 Add a helper function to get an Instance from a JSObject*.
1673 Given an object and the expected binding language, see if
1674 the JSObject actually wraps an Instance of the given type
1675 and return it. Otherwise return 0.
1677 Move RuntimeObjectImp creations into Instance.
1678 Make the ctor protected, and Instance a friend class, so
1679 that all creation of RuntimeObjectImps goes through
1682 Remove copy ctor/assignment operator for QtInstance.
1683 Instance itself is Noncopyable, so QtInstance doesn't
1686 Add caching for QtInstance and associated RuntimeObjectImps.
1687 Push any dealings with QtLanguage bindings into QtInstance,
1688 and cache them there, rather than in the Instance layer. Add
1689 a QtRuntimeObjectImp to help with caching.
1691 * JavaScriptCore.exp:
1692 * bindings/c/c_instance.h:
1693 * bindings/jni/jni_instance.h:
1694 * bindings/objc/objc_instance.h:
1695 * bindings/qt/qt_instance.cpp:
1696 (KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
1697 (KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
1698 (KJS::Bindings::QtRuntimeObjectImp::invalidate):
1699 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
1700 (KJS::Bindings::QtInstance::QtInstance):
1701 (KJS::Bindings::QtInstance::~QtInstance):
1702 (KJS::Bindings::QtInstance::getQtInstance):
1703 (KJS::Bindings::QtInstance::getRuntimeObject):
1704 * bindings/qt/qt_instance.h:
1705 (KJS::Bindings::QtInstance::getBindingLanguage):
1706 * bindings/runtime.cpp:
1707 (KJS::Bindings::Instance::createBindingForLanguageInstance):
1708 (KJS::Bindings::Instance::createRuntimeObject):
1709 (KJS::Bindings::Instance::getInstance):
1710 * bindings/runtime.h:
1711 * bindings/runtime_object.h:
1712 (KJS::RuntimeObjectImp::getInternalInstance):
1714 2008-01-12 Alp Toker <alp@atoker.com>
1716 Reviewed by Mark Rowe.
1718 Hide non-public symbols in GTK+/autotools release builds.
1722 2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1724 Reviewed by Mark Rowe.
1726 Fix http://bugs.webkit.org/show_bug.cgi?id=16852
1727 Fixes leaking of ActivationStackNode objects.
1729 * kjs/JSGlobalObject.cpp:
1730 (KJS::JSGlobalObject::deleteActivationStack):
1731 (KJS::JSGlobalObject::~JSGlobalObject):
1732 (KJS::JSGlobalObject::init):
1733 (KJS::JSGlobalObject::reset):
1734 * kjs/JSGlobalObject.h:
1736 2008-01-12 Darin Adler <darin@apple.com>
1738 - try to fix Qt Windows build
1740 * pcre/dftables: Remove reliance on the list form of Perl pipes.
1742 2008-01-12 Darin Adler <darin@apple.com>
1744 - try to fix Qt build
1746 * kjs/function.cpp: Added include of scope_chain_mark.h.
1747 * kjs/scope_chain_mark.h: Added multiple-include guards.
1749 2008-01-12 Mark Rowe <mrowe@apple.com>
1751 Another Windows build fix.
1755 2008-01-12 Mark Rowe <mrowe@apple.com>
1757 Attempted Windows build fix. Use struct consistently when forward-declaring
1758 ActivationStackNode and StackActivation.
1761 * kjs/JSGlobalObject.h:
1763 2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1767 Fixes a problem with the ActivationImp tear-off patch (r29425) where
1768 some of the calls to JSGlobalObject::tearOffActivation() were using
1769 the wrong test to determine whether it should leave a relic behind.
1772 (KJS::FunctionImp::argumentsGetter):
1773 (KJS::ActivationImp::getOwnPropertySlot):
1775 2008-01-11 Geoffrey Garen <ggaren@apple.com>
1777 Reviewed by Oliver Hunt.
1779 Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
1780 variable access (16644)
1782 This bug was caused by var declarations shadowing built-in properties of
1785 To match Firefox, we've decided that var declarations will never shadow
1786 built-in properties of the global object or its prototypes. We used to
1787 behave more like IE, which allows shadowing, but walking that line got
1788 us into trouble with websites that sent us down the Firefox codepath.
1790 * kjs/JSVariableObject.h:
1791 (KJS::JSVariableObject::symbolTableGet): New code to support calling
1792 hasProperty before the variable object is fully initialized (so you
1793 can call it during initialization).
1796 (KJS::ProgramNode::initializeSymbolTable): Always do a full hasProperty
1797 check when looking for duplicates, not getDirect, since it only checks
1798 the property map, and not hasOwnProperty, since it doesn't check
1800 (KJS::EvalNode::processDeclarations): ditto
1802 * kjs/property_slot.h:
1803 (KJS::PropertySlot::ungettableGetter): Best function name evar.
1805 2008-01-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1809 Optimized ActivationImp allocation, so that activation records are now
1810 first allocated on an explicitly managed stack and only heap allocated
1811 when necessary. Roughly a 5% improvement on SunSpider, and a larger
1812 improvement on benchmarks that use more function calls.
1814 * JavaScriptCore.xcodeproj/project.pbxproj:
1815 * kjs/Activation.h: Added.
1816 (KJS::ActivationImp::ActivationData::ActivationData):
1817 (KJS::ActivationImp::ActivationImp):
1818 (KJS::ActivationImp::classInfo):
1819 (KJS::ActivationImp::isActivationObject):
1820 (KJS::ActivationImp::isOnStack):
1821 (KJS::ActivationImp::d):
1822 (KJS::StackActivation::StackActivation):
1823 * kjs/ExecState.cpp:
1824 (KJS::ExecState::ExecState):
1825 (KJS::ExecState::~ExecState):
1827 (KJS::ExecState::replaceScopeChainTop):
1828 (KJS::ExecState::setActivationObject):
1829 (KJS::ExecState::setLocalStorage):
1830 * kjs/JSGlobalObject.cpp:
1831 (KJS::JSGlobalObject::reset):
1832 (KJS::JSGlobalObject::pushActivation):
1833 (KJS::JSGlobalObject::checkActivationCount):
1834 (KJS::JSGlobalObject::popActivationHelper):
1835 (KJS::JSGlobalObject::popActivation):
1836 (KJS::JSGlobalObject::tearOffActivation):
1837 * kjs/JSGlobalObject.h:
1838 * kjs/JSVariableObject.h:
1839 (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
1840 (KJS::JSVariableObject::JSVariableObject):
1842 (KJS::FunctionImp::argumentsGetter):
1843 (KJS::ActivationImp::ActivationImp):
1844 (KJS::ActivationImp::~ActivationImp):
1845 (KJS::ActivationImp::init):
1846 (KJS::ActivationImp::getOwnPropertySlot):
1847 (KJS::ActivationImp::markHelper):
1848 (KJS::ActivationImp::mark):
1849 (KJS::ActivationImp::ActivationData::ActivationData):
1850 (KJS::GlobalFuncImp::callAsFunction):
1853 (KJS::PostIncResolveNode::evaluate):
1854 (KJS::PostDecResolveNode::evaluate):
1855 (KJS::PreIncResolveNode::evaluate):
1856 (KJS::PreDecResolveNode::evaluate):
1857 (KJS::ReadModifyResolveNode::evaluate):
1858 (KJS::AssignResolveNode::evaluate):
1859 (KJS::WithNode::execute):
1860 (KJS::TryNode::execute):
1861 (KJS::FunctionBodyNode::processDeclarations):
1862 (KJS::FuncExprNode::evaluate):
1864 * kjs/scope_chain.h:
1865 (KJS::ScopeChain::replace):
1866 * kjs/scope_chain_mark.h: Added.
1867 (KJS::ScopeChain::mark):
1869 2008-01-11 Simon Hausmann <hausmann@webkit.org>
1871 Reviewed by Mark Rowe.
1873 Fix the (clean) qmake build. For generating chartables.c we don't
1874 depend on a separate input source file anymore, the dftables perl
1875 script is enough. So use that instead as value for the .input
1876 variable, to ensure that qmake also generates a rule to call dftables.
1880 2008-01-10 Geoffrey Garen <ggaren@apple.com>
1882 Reviewed by John Sullivan.
1884 Fixed some world leak reports:
1885 * <rdar://problem/5669436> PLT complains about world leak of 1 JavaScript
1886 Interpreter after running cvs-base suite
1888 * <rdar://problem/5669423> PLT complains about world leak if browser
1889 window is open when PLT starts
1891 * kjs/collector.h: Added the ability to distinguish between global
1892 objects and GC-protected global objects, since we only consider the
1893 latter to be world leaks.
1894 * kjs/collector.cpp:
1896 2008-01-11 Mark Rowe <mrowe@apple.com>
1898 Silence qmake warning about ctgen lacking input.
1900 Rubber-stamped by Alp Toker.
1904 2008-01-10 David Kilzer <ddkilzer@apple.com>
1906 dftables should be rewritten as a script
1908 <http://bugs.webkit.org/show_bug.cgi?id=16818>
1909 <rdar://problem/5681463>
1913 Rewrote the dftables utility in Perl. Attempted to switch all
1914 build systems to call the script directly instead of building
1915 a binary first. Only the Xcode build was able to be tested.
1917 * DerivedSources.make: Added pcre directory to VPATH and changed
1918 to invoke dftables directly.
1919 * GNUmakefile.am: Removed build information and changed to invoke
1921 * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed reference to
1923 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
1924 * JavaScriptCore.vcproj/dftables: Removed.
1925 * JavaScriptCore.vcproj/dftables/dftables.vcproj: Removed.
1926 * JavaScriptCore.xcodeproj/project.pbxproj: Removed dftables target.
1927 * jscore.bkl: Removed dftables executable definition.
1928 * pcre/dftables: Copied from JavaScriptCore/pcre/dftables.cpp.
1929 * pcre/dftables.cpp: Removed.
1930 * pcre/dftables.pro: Removed.
1931 * pcre/pcre.pri: Removed references to dftables.cpp and changed to
1932 invoke dftables directly.
1934 2008-01-10 Dan Bernstein <mitz@apple.com>
1936 Reviewed by Darin Adler.
1938 - fix http://bugs.webkit.org/show_bug.cgi?id=16782
1939 <rdar://problem/5675331> REGRESSION(r29266): Reproducible crash in fast/replaced/image-map.html
1941 The crash resulted from a native object (DumpRenderTree's
1942 EventSender) causing its wrapper to be invalidated (by clicking a
1943 link that replaced the document in the window) and consequently
1944 deallocated. The fix is to use RefPtrs to protect the native object
1945 from deletion by self-invalidation.
1947 * bindings/runtime_method.cpp:
1948 (RuntimeMethod::callAsFunction):
1949 * bindings/runtime_object.cpp:
1950 (RuntimeObjectImp::fallbackObjectGetter):
1951 (RuntimeObjectImp::fieldGetter):
1952 (RuntimeObjectImp::methodGetter):
1953 (RuntimeObjectImp::put):
1954 (RuntimeObjectImp::defaultValue):
1955 (RuntimeObjectImp::callAsFunction):
1957 2008-01-07 Mark Rowe <mrowe@apple.com>
1959 Reviewed by Maciej Stachowiak.
1961 Turn testIsInteger assertions into compile-time asserts and move them into HashTraits.h
1967 2008-01-07 Nikolas Zimmermann <zimmermann@kde.org>
1971 Enable SVG_FONTS by default.
1973 * Configurations/JavaScriptCore.xcconfig:
1975 2008-01-07 Darin Adler <darin@apple.com>
1977 Rubber stamped by David Kilzer.
1979 - get rid of empty fpconst.cpp
1981 * GNUmakefile.am: Remove fpconst.cpp.
1982 * JavaScriptCore.pri: Ditto.
1983 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
1984 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
1985 * JavaScriptCoreSources.bkl: Ditto.
1987 * kjs/fpconst.cpp: Removed.
1989 2008-01-07 Darin Adler <darin@apple.com>
1991 Reviewed by David Kilzer.
1993 - fix alignment problem with NaN and Inf globals
1995 * kjs/fpconst.cpp: Move the contents of this file from here back to
1996 value.cpp. The reason this was in a separate file is that the DARWIN
1997 version of this used a declaration of the globals with a different
1998 type to avoid creating "init routines". That's no longer necessary for
1999 DARWIN and was never necessary for the non-DARWIN code path.
2000 To make this patch easy to merge, I didn't actually delete this file
2001 yet. We'll do that in a separate changeset.
2003 * kjs/value.cpp: If C99's NAN and INFINITY are present, then use them,
2004 othrewise use the union trick from fpconst.cpp. I think it would be
2005 better to eliminate KJS::NaN and KJS::Inf and just use NAN and INFINITY
2006 directly or std::numeric_limits<double>::quiet_nan() and
2007 std::numeric_limits<double>::infinity(). But when I tried that, it
2008 slowed down SunSpider. Someone else could do that cleanup if they
2009 could do it without slowing down the engine.
2011 2008-01-07 Adam Roben <aroben@apple.com>
2015 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
2016 JavaScript.h to the project.
2017 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
2018 Copy JavaScript.h to WEBKITOUTPUTDIR.
2020 2008-01-07 Timothy Hatcher <timothy@apple.com>
2031 * API/JavaScriptCore.h:
2033 * JavaScriptCore.xcodeproj/project.pbxproj:
2035 2008-01-07 Alp Toker <alp@atoker.com>
2039 http://bugs.webkit.org/show_bug.cgi?id=16029
2040 JavaScriptCore.h is not suitable for platforms other than Mac OS X
2042 Introduce a new JavaScriptCore/JavaScript.h public API header. This
2043 should be used by all new portable code using the JavaScriptCore API.
2045 JavaScriptCore/JavaScriptCore.h will remain for compatibility with
2046 existing applications that depend on it including JSStringRefCF.h
2047 which isn't portable.
2049 Also add minidom to the GTK+/autotools build since we can now support
2050 it on all platforms.
2054 * API/JavaScript.h: Added.
2055 * API/JavaScriptCore.h:
2056 * ForwardingHeaders/JavaScriptCore/JavaScript.h: Added.
2058 * JavaScriptCore.xcodeproj/project.pbxproj:
2060 2008-01-06 Eric Seidel <eric@webkit.org>
2064 Abstract all DateObject.set* functions in preparation for fixing:
2065 http://bugs.webkit.org/show_bug.cgi?id=16753
2067 SunSpider had random changes here and there but was overall a wash.
2069 * kjs/date_object.cpp:
2070 (KJS::fillStructuresUsingTimeArgs):
2071 (KJS::setNewValueFromTimeArgs):
2072 (KJS::setNewValueFromDateArgs):
2073 (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
2074 (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
2075 (KJS::DateProtoFuncSetSeconds::callAsFunction):
2076 (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
2077 (KJS::DateProtoFuncSetMinutes::callAsFunction):
2078 (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
2079 (KJS::DateProtoFuncSetHours::callAsFunction):
2080 (KJS::DateProtoFuncSetUTCHours::callAsFunction):
2081 (KJS::DateProtoFuncSetDate::callAsFunction):
2082 (KJS::DateProtoFuncSetUTCDate::callAsFunction):
2083 (KJS::DateProtoFuncSetMonth::callAsFunction):
2084 (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
2085 (KJS::DateProtoFuncSetFullYear::callAsFunction):
2086 (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
2088 2008-01-06 Nikolas Zimmermann <zimmermann@kde.org>
2092 Add new helper function isArabicChar - SVG Fonts support needs it.
2094 * wtf/unicode/icu/UnicodeIcu.h:
2095 (WTF::Unicode::isArabicChar):
2096 * wtf/unicode/qt4/UnicodeQt4.h:
2097 (WTF::Unicode::isArabicChar):
2099 2008-01-06 Alp Toker <alp@atoker.com>
2101 Reviewed by Mark Rowe.
2103 Use $(EXEEXT) to account for the .exe extension in the GTK+ Windows
2104 build. (This is already done correctly in DerivedSources.make.) Issue
2105 noticed by Mikkel when building in Cygwin.
2107 Add a missing slash. This was a hack from the qmake build system that
2108 isn't necessary with autotools.
2112 2008-01-05 Darin Adler <darin@apple.com>
2114 * API/JSRetainPtr.h: One more file that needed the change below.
2116 2008-01-05 Darin Adler <darin@apple.com>
2118 * wtf/OwnPtr.h: OwnPtr needs the same fix as RefPtr below.
2120 2008-01-05 Adam Roben <aroben@apple.com>
2126 * wtf/RetainPtr.h: Use PtrType instead of T* because of the
2127 RemovePointer magic.
2129 2008-01-05 Darin Adler <darin@apple.com>
2131 Rubber stamped by Maciej Stachowiak.
2133 - cut down own PIC branches by using a pointer-to-member-data instead of a
2134 pointer-to-member-function in WTF smart pointers
2136 * wtf/OwnArrayPtr.h:
2141 Use a pointer to the m_ptr member instead of the get member.
2142 The GCC compiler generates better code for this idiom.
2144 2008-01-05 Henry Mason <hmason@mac.com>
2146 Reviewed by Maciej Stachowiak.
2148 http://bugs.webkit.org/show_bug.cgi?id=16738
2149 Bug 16738: Collector block offset could be stored as an cell offset instead of a byte offset
2151 Gives a 0.4% SunSpider boost and prettier code.
2153 * kjs/collector.cpp: Switched to cell offsets from byte offsets
2154 (KJS::Collector::heapAllocate):
2155 (KJS::Collector::sweep):
2157 2008-01-04 Mark Rowe <mrowe@apple.com>
2159 Reviewed by Maciej Stachowiak.
2161 Have the two malloc zones print useful diagnostics if their free method are unexpectedly invoked.
2162 Due to <rdar://problem/5671357> this can happen if an application attempts to free a pointer that
2163 was not allocated by any registered malloc zone on the system.
2165 * kjs/CollectorHeapIntrospector.h:
2166 * wtf/FastMalloc.cpp:
2168 2008-01-04 Alp Toker <alp@atoker.com>
2170 GTK+ autotools build fix. Terminate empty rules.
2174 2008-01-03 Simon Hausmann <hausmann@webkit.org>
2176 Reviewed by Mark Rowe.
2178 Fix compilation with gcc 4.3: limits.h is needed for INT_MAX.
2180 * pcre/pcre_exec.cpp:
2182 2008-01-03 Darin Adler <darin@apple.com>
2184 * tests/mozilla/expected.html: The fix for bug 16696 also fixed a test
2185 case, ecma_3/RegExp/perlstress-002.js, so updated results to expect
2186 that test to succeed.
2188 2008-01-02 Darin Adler <darin@apple.com>
2192 - fix http://bugs.webkit.org/show_bug.cgi?id=16696
2193 JSCRE fails fails to match Acid3 regexp
2195 Test: fast/regex/early-acid3-86.html
2197 The problem was with the cutoff point between backreferences and octal
2198 escape sequences. We need to determine the cutoff point by counting the
2199 total number of capturing brackets, which requires an extra pass through
2200 the expression when compiling it.
2202 * pcre/pcre_compile.cpp:
2203 (CompileData::CompileData): Added numCapturingBrackets. Removed some
2205 (compileBranch): Use numCapturingBrackets when calling checkEscape.
2206 (calculateCompiledPatternLength): Use numCapturingBrackets when calling
2207 checkEscape, and also store the bracket count at the end of the compile.
2208 (jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
2209 count the number of brackets and then a second time to calculate the length.
2211 2008-01-02 Darin Adler <darin@apple.com>
2215 - fix http://bugs.webkit.org/show_bug.cgi?id=16696
2216 JSCRE fails fails to match Acid3 regexp
2218 Test: fast/regex/early-acid3-86.html
2220 The problem was with the cutoff point between backreferences and octal
2221 escape sequences. We need to determine the cutoff point by counting the
2222 total number of capturing brackets, which requires an extra pass through
2223 the expression when compiling it.
2225 * pcre/pcre_compile.cpp:
2226 (CompileData::CompileData): Added numCapturingBrackets. Removed some
2228 (compileBranch): Use numCapturingBrackets when calling checkEscape.
2229 (calculateCompiledPatternLength): Use numCapturingBrackets when calling
2230 checkEscape, and also store the bracket count at the end of the compile.
2231 (jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
2232 count the number of brackets and then a second time to calculate the length.
2234 2008-01-02 David Kilzer <ddkilzer@webkit.org>
2236 Reviewed and landed by Darin.
2239 (KJS::DoWhileNode::execute): Added a missing return.
2241 2008-01-02 Darin Adler <darin@apple.com>
2243 - try to fix Qt build
2245 * wtf/unicode/qt4/UnicodeQt4.h:
2246 (WTF::Unicode::foldCase): Add some missing const.
2248 2008-01-02 Alice Liu <alice.liu@apple.com>
2250 Reviewed by Sam Weinig.
2252 need to export ASCIICType.h for use in DRT
2254 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2256 (WTF::isASCIIUpper):
2258 2008-01-02 Sam Weinig <sam@webkit.org>
2260 Reviewed by Beth Dakin.
2262 Cleanup error_object.h/cpp.
2264 * kjs/JSGlobalObject.cpp:
2265 (KJS::JSGlobalObject::reset):
2266 * kjs/error_object.cpp:
2268 (KJS::ErrorInstance::ErrorInstance):
2269 (KJS::ErrorPrototype::ErrorPrototype):
2270 (KJS::ErrorProtoFuncToString::ErrorProtoFuncToString):
2271 (KJS::ErrorProtoFuncToString::callAsFunction):
2272 (KJS::ErrorObjectImp::ErrorObjectImp):
2273 (KJS::ErrorObjectImp::implementsConstruct):
2274 (KJS::ErrorObjectImp::construct):
2275 (KJS::ErrorObjectImp::callAsFunction):
2276 (KJS::NativeErrorPrototype::NativeErrorPrototype):
2277 (KJS::NativeErrorImp::NativeErrorImp):
2278 (KJS::NativeErrorImp::implementsConstruct):
2279 (KJS::NativeErrorImp::construct):
2280 (KJS::NativeErrorImp::callAsFunction):
2281 (KJS::NativeErrorImp::mark):
2282 * kjs/error_object.h:
2283 (KJS::ErrorInstance::classInfo):
2284 (KJS::NativeErrorImp::classInfo):
2286 2008-01-02 Mark Rowe <mrowe@apple.com>
2288 Rubber-stamped by Alp Toker.
2290 * GNUmakefile.am: Add missing dependency on grammar.y.
2292 2008-01-01 Darin Adler <darin@apple.com>
2296 - fix for http://bugs.webkit.org/show_bug.cgi?id=16695
2297 JSC allows non-identifier codepoints in identifiers (affects Acid3)
2299 Test: fast/js/kde/parse.html
2302 (KJS::Lexer::lex): Added additional states to distinguish Unicode escapes at the
2303 start of identifiers from ones inside identifiers. Rejected characters that don't pass
2304 the isIdentStart and isIdentPart tests.
2305 (KJS::Lexer::convertUnicode): Removed incorrect FIXME comment.
2307 * kjs/lexer.h: Added new states to distinguish \u escapes at the start of identifiers
2308 from \u escapes inside identifiers.
2310 2008-01-01 Darin Adler <darin@apple.com>
2312 - rolled scope chain optimization out; it was breaking the world
2314 2008-01-01 Darin Adler <darin@apple.com>
2318 - http://bugs.webkit.org/show_bug.cgi?id=16685
2319 eliminate List::empty() to cut down on PIC branches
2321 Also included one other speed-up -- remove the call to reserveCapacity from
2322 FunctionBodyNode::processDeclarations in all but the most unusual cases.
2324 Together these make SunSpider 1.016x as fast.
2326 * JavaScriptCore.exp: Updated.
2327 * kjs/ExecState.cpp:
2328 (KJS::globalEmptyList): Added. Called only when creating global ExecState
2330 (KJS::ExecState::ExecState): Broke constructor up into three separate functions,
2331 for the three separate node types. Also went through each of the three and
2332 streamlined as much as possible, removing dead code. This prevents us from having
2333 to access the global in the function body version of the constructor.
2335 * kjs/ExecState.h: Added emptyList(). Replaced the constructor with a set of
2336 three that are specific to the different node types that can create new execution
2339 * kjs/array_object.cpp:
2340 (KJS::ArrayProtoFuncToLocaleString::callAsFunction): Use exec->emptyList() instead
2342 (KJS::ArrayProtoFuncConcat::callAsFunction): Ditto.
2343 (KJS::ArrayProtoFuncSlice::callAsFunction): Ditto.
2344 (KJS::ArrayProtoFuncSplice::callAsFunction): Ditto.
2345 (KJS::ArrayProtoFuncFilter::callAsFunction): Ditto.
2347 (KJS::FunctionImp::callAsFunction): Updated to call new ExecState constructor.
2348 (KJS::GlobalFuncImp::callAsFunction): Ditto (for eval).
2349 * kjs/function_object.cpp:
2350 (FunctionObjectImp::construct): Use exec->emptyList() instead of List::empty().
2352 * kjs/list.cpp: Removed List::empty.
2353 * kjs/list.h: Ditto.
2356 (KJS::ElementNode::evaluate): Use exec->emptyList() instead of List::empty().
2357 (KJS::ArrayNode::evaluate): Ditto.
2358 (KJS::ObjectLiteralNode::evaluate): Ditto.
2359 (KJS::PropertyListNode::evaluate): Ditto.
2360 (KJS::FunctionBodyNode::processDeclarations): Another speed-up. Check the capacity
2361 before calling reserveCapacity, because it doesn't get inlined the local storage
2362 vector is almost always big enough -- saving the function call overhead is a big
2364 (KJS::FuncDeclNode::makeFunction): Use exec->emptyList() instead of List::empty().
2365 (KJS::FuncExprNode::evaluate): Ditto.
2367 (KJS::tryGetAndCallProperty): Ditto.
2368 * kjs/property_slot.cpp:
2369 (KJS::PropertySlot::functionGetter): Ditto.
2370 * kjs/string_object.cpp:
2371 (KJS::StringProtoFuncSplit::callAsFunction): Ditto.
2373 2008-01-01 Darin Adler <darin@apple.com>
2377 - fix http://bugs.webkit.org/show_bug.cgi?id=16648
2378 REGRESSION (r28165): Yuku.com navigation prints "jsRegExpExecute failed with result -2"
2379 <rdar://problem/5646486> REGRESSION (r28165): Layout test fast/regex/test1 fails intermittently
2381 Fixes 34 failing test cases in the fast/regex/test1.html test.
2383 Restored the stack which prevents infinite loops for brackets that match the empty
2384 string; it had been removed as an optimization.
2386 Unfortunately, restoring this stack causes the regular expression test in SunSpider
2387 to be 1.095x as slow and the overall test to be 1.004x as slow. Maybe we can find
2388 a correct optimization to restore the speed!
2390 It's possible the original change was on the right track but just off by one.
2392 * pcre/pcre_exec.cpp: Add back eptrblock, but name it BracketChainNode.
2393 (MatchStack::pushNewFrame): Add back the logic needed here.
2394 (startNewGroup): Ditto.
2397 2008-01-01 Darin Adler <darin@apple.com>
2401 - http://bugs.webkit.org/show_bug.cgi?id=16683
2402 speed up function calls by making ScopeChain::push cheaper
2404 This gives a 1.019x speedup on SunSpider.
2406 After doing this, I realized this probably will be obsolete when the optimization
2407 to avoid creating an activation object is done. When we do that one we should check
2408 if rolling this out will speed things up, since this does add overhead at the time
2409 you copy the scope chain.
2411 * kjs/object.h: Removed the ScopeChain::release function. It was
2412 marked inline, and called in exactly one place, so moved it there.
2413 No idea why it was in this header file!
2415 * kjs/scope_chain.cpp: Removed the overload of the ScopeChain::push
2416 function that takes another ScopeChain. It was unused. I think we used
2417 it over in WebCore at one point, but not any more.
2419 * kjs/scope_chain.h: Changed ScopeChainNode into a struct rather than
2420 a class, got rid of its constructor so we can have one that's uninitialized,
2421 and moved the refCount into a derived struct, ScopeChainHeapNode. Made _node
2422 mutable so it can be changed in the moveToHeap function. Changed the copy
2423 constructor and assignment operator to call moveToHeap, since the top node
2424 can't be shared when it's embedded in another ScopeChain object. Updated
2425 functions as needed to handle the case where the first object isn't on the
2426 heap or to add casts for cases where it's guaranteed to be. Changed the push
2427 function to always put the new node into the ScopeChain object; it will get
2428 put onto the heap when needed later.
2430 2008-01-01 Geoffrey Garen <ggaren@apple.com>
2432 Reviewed by Darin Adler.
2434 Fixed slight logic error in reserveCapacity, where we would reallocate
2435 the storage buffer unnecessarily.
2438 (WTF::::reserveCapacity): No need to grow the buffer if newCapacity is
2439 equal to capacity().
2441 2008-01-01 Darin Adler <darin@apple.com>
2445 - http://bugs.webkit.org/show_bug.cgi?id=16684
2446 eliminate debugger overhead from function body execution
2448 Speeds SunSpider up 1.003x. That's a small amount, but measurable.
2450 * JavaScriptCore.exp: Updated.
2452 (KJS::Parser::parse): Create the node with a static member function named create() instead
2453 of using new explicitly.
2455 * kjs/grammar.y: Changed calls to new FunctionBodyNode to use FunctionBodyNode::create().
2458 (KJS::ProgramNode::create): Added. Calls new.
2459 (KJS::EvalNode::create): Ditto.
2460 (KJS::FunctionBodyNode::create): Ditto, but creates FunctionBodyNodeWithDebuggerHooks
2461 when a debugger is present.
2462 (KJS::FunctionBodyNode::execute): Removed debugger hooks.
2463 (KJS::FunctionBodyNodeWithDebuggerHooks::FunctionBodyNodeWithDebuggerHooks): Added.
2464 (KJS::FunctionBodyNodeWithDebuggerHooks::execute): Calls the debugger, then the code,
2465 then the debugger again.
2467 * kjs/nodes.h: Added create functions, made the constructors private and protected.
2469 2007-12-30 Eric Seidel <eric@webkit.org>
2473 More small cleanup to array_object.cpp
2475 * kjs/array_object.cpp:
2476 (KJS::ArrayProtoFuncToString::callAsFunction):
2477 (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
2478 (KJS::ArrayProtoFuncJoin::callAsFunction):
2479 (KJS::ArrayProtoFuncConcat::callAsFunction):
2480 (KJS::ArrayProtoFuncReverse::callAsFunction):
2481 (KJS::ArrayProtoFuncShift::callAsFunction):
2482 (KJS::ArrayProtoFuncSlice::callAsFunction):
2483 (KJS::ArrayProtoFuncSort::callAsFunction):
2484 (KJS::ArrayProtoFuncSplice::callAsFunction):
2485 (KJS::ArrayProtoFuncUnShift::callAsFunction):
2486 (KJS::ArrayProtoFuncFilter::callAsFunction):
2487 (KJS::ArrayProtoFuncMap::callAsFunction):
2488 (KJS::ArrayProtoFuncEvery::callAsFunction):
2490 2007-12-30 Eric Seidel <eric@webkit.org>
2494 Apply wkstyle to array_object.cpp
2496 * kjs/array_object.cpp:
2497 (KJS::ArrayPrototype::ArrayPrototype):
2498 (KJS::ArrayPrototype::getOwnPropertySlot):
2499 (KJS::ArrayProtoFuncConcat::callAsFunction):
2500 (KJS::ArrayProtoFuncPop::callAsFunction):
2501 (KJS::ArrayProtoFuncReverse::callAsFunction):
2502 (KJS::ArrayProtoFuncShift::callAsFunction):
2503 (KJS::ArrayProtoFuncSlice::callAsFunction):
2504 (KJS::ArrayProtoFuncSort::callAsFunction):
2505 (KJS::ArrayProtoFuncSplice::callAsFunction):
2506 (KJS::ArrayProtoFuncUnShift::callAsFunction):
2507 (KJS::ArrayProtoFuncFilter::callAsFunction):
2508 (KJS::ArrayProtoFuncMap::callAsFunction):
2509 (KJS::ArrayProtoFuncEvery::callAsFunction):
2510 (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
2511 (KJS::ArrayObjectImp::ArrayObjectImp):
2512 (KJS::ArrayObjectImp::implementsConstruct):
2513 (KJS::ArrayObjectImp::construct):
2514 (KJS::ArrayObjectImp::callAsFunction):
2516 2007-12-30 Eric Seidel <eric@webkit.org>
2520 Remove maxInt/minInt, replacing with std:max/min<int>()
2522 * kjs/array_object.cpp:
2523 (KJS::ArrayProtoFuncSplice::callAsFunction):
2524 * kjs/operations.cpp:
2527 2007-12-30 Eric Seidel <eric@webkit.org>
2531 Update Number.toString to properly throw exceptions.
2532 Cleanup code in Number.toString implementation.
2534 * kjs/number_object.cpp:
2535 (KJS::numberToString):
2537 (KJS::Error::create): Remove bogus debug lines.
2539 2007-12-28 Eric Seidel <eric@webkit.org>
2543 ASSERT when debugging via Drosera due to missed var lookup optimization.
2544 http://bugs.webkit.org/show_bug.cgi?id=16634
2546 No test case possible.
2549 (KJS::BreakpointCheckStatement::optimizeVariableAccess):
2552 2007-12-28 Eric Seidel <eric@webkit.org>
2556 Fix (-0).toFixed() and re-factor a little
2557 Fix (-0).toExponential() and printing of trailing 0s in toExponential
2558 Fix toPrecision(nan) handling
2559 http://bugs.webkit.org/show_bug.cgi?id=16640
2561 * kjs/number_object.cpp:
2562 (KJS::numberToFixed):
2563 (KJS::fractionalPartToString):
2564 (KJS::numberToExponential):
2565 (KJS::numberToPrecision):
2567 2007-12-28 Eric Seidel <eric@webkit.org>
2571 More changes to make number code readable
2573 * kjs/number_object.cpp:
2574 (KJS::integer_part_noexp):
2575 (KJS::numberToFixed):
2576 (KJS::numberToExponential):
2578 2007-12-28 Eric Seidel <eric@webkit.org>
2582 More small cleanups to toPrecision
2584 * kjs/number_object.cpp:
2585 (KJS::numberToPrecision):
2587 2007-12-28 Eric Seidel <eric@webkit.org>
2591 More small attempts to make number code readable
2593 * kjs/number_object.cpp:
2594 (KJS::exponentialPartToString):
2595 (KJS::numberToExponential):
2596 (KJS::numberToPrecision):
2598 2007-12-28 Eric Seidel <eric@webkit.org>
2602 Break out callAsFunction implementations into static functions
2604 * kjs/number_object.cpp:
2605 (KJS::numberToString):
2606 (KJS::numberToFixed):
2607 (KJS::numberToExponential):
2608 (KJS::numberToPrecision):
2609 (KJS::NumberProtoFunc::callAsFunction):
2611 2007-12-28 Eric Seidel <eric@webkit.org>
2615 Apply wkstyle/astyle and fix placement of *
2617 * kjs/number_object.cpp:
2619 (KJS::NumberInstance::NumberInstance):
2620 (KJS::NumberPrototype::NumberPrototype):
2621 (KJS::NumberProtoFunc::NumberProtoFunc):
2622 (KJS::integer_part_noexp):
2624 (KJS::NumberProtoFunc::callAsFunction):
2625 (KJS::NumberObjectImp::NumberObjectImp):
2626 (KJS::NumberObjectImp::getOwnPropertySlot):
2627 (KJS::NumberObjectImp::getValueProperty):
2628 (KJS::NumberObjectImp::implementsConstruct):
2629 (KJS::NumberObjectImp::construct):
2630 (KJS::NumberObjectImp::callAsFunction):
2632 (KJS::JSObject::put):
2634 2007-12-27 Eric Seidel <eric@webkit.org>
2638 ASSERT in JavaScriptCore while viewing WICD test case
2639 http://bugs.webkit.org/show_bug.cgi?id=16626
2642 (KJS::ForInNode::execute): move KJS_CHECK_EXCEPTION to proper place
2644 2007-12-26 Jan Michael Alonzo <jmalonzo@unpluggable.com>
2646 Reviewed by Alp Toker.
2648 http://bugs.webkit.org/show_bug.cgi?id=16390
2649 Use autotools or GNU make as the build system for the GTK port
2651 * GNUmakefile.am: Added.
2653 2007-12-25 Maciej Stachowiak <mjs@apple.com>
2657 - Remove unnecessary redundant check from property setting
2658 http://bugs.webkit.org/show_bug.cgi?id=16602
2660 1.3% speedup on SunSpider.
2663 (KJS::JSObject::put): Don't do canPut check when not needed; let
2664 the PropertyMap handle it.
2665 (KJS::JSObject::canPut): Don't check the static property
2666 table. lookupPut does that already.
2668 2007-12-24 Alp Toker <alp@atoker.com>
2670 Fix builds that don't use AllInOneFile.cpp following breakage
2671 introduced in r28973.
2675 2007-12-24 Maciej Stachowiak <mjs@apple.com>
2679 - Optimize variable declarations
2680 http://bugs.webkit.org/show_bug.cgi?id=16585
2682 3.5% speedup on SunSpider.
2684 var statements now result in either assignments or empty statements.
2686 This allows a couple of optimization opportunities:
2687 - No need to branch at runtime to check if there is an initializer
2688 - EmptyStatementNodes can be removed entirely (also done in this patch)
2689 - Assignment expressions get properly optimized for local variables
2691 This patch also includes some code cleanup:
2692 - Most of the old VarStatement/VarDecl logic is now only used for const declarations,
2693 thus it is renamed appropriately
2694 - AssignExprNode is gone
2696 * JavaScriptCore.exp:
2700 (KJS::SourceElements::append):
2701 (KJS::ConstDeclNode::ConstDeclNode):
2702 (KJS::ConstDeclNode::optimizeVariableAccess):
2703 (KJS::ConstDeclNode::handleSlowCase):
2704 (KJS::ConstDeclNode::evaluateSingle):
2705 (KJS::ConstDeclNode::evaluate):
2706 (KJS::ConstStatementNode::optimizeVariableAccess):
2707 (KJS::ConstStatementNode::execute):
2708 (KJS::VarStatementNode::optimizeVariableAccess):
2709 (KJS::VarStatementNode::execute):
2710 (KJS::ForInNode::ForInNode):
2711 (KJS::ForInNode::optimizeVariableAccess):
2712 (KJS::ForInNode::execute):
2713 (KJS::FunctionBodyNode::initializeSymbolTable):
2714 (KJS::ProgramNode::initializeSymbolTable):
2715 (KJS::FunctionBodyNode::processDeclarations):
2716 (KJS::ProgramNode::processDeclarations):
2717 (KJS::EvalNode::processDeclarations):
2719 (KJS::DeclarationStacks::):
2720 (KJS::StatementNode::):
2721 (KJS::ConstDeclNode::):
2722 (KJS::ConstStatementNode::):
2723 (KJS::EmptyStatementNode::):
2724 (KJS::VarStatementNode::):
2726 * kjs/nodes2string.cpp:
2727 (KJS::ConstDeclNode::streamTo):
2728 (KJS::ConstStatementNode::streamTo):
2729 (KJS::ScopeNode::streamTo):
2730 (KJS::VarStatementNode::streamTo):
2731 (KJS::ForNode::streamTo):
2732 (KJS::ForInNode::streamTo):
2734 2007-12-21 Mark Rowe <mrowe@apple.com>
2736 Reviewed by Oliver Hunt.
2738 * JavaScriptCore.exp: Remove unused symbol to prevent a weak external symbol
2739 being generated in JavaScriptCore.framework.
2741 2007-12-21 Darin Adler <darin@apple.com>
2743 Requested by Maciej.
2745 * kjs/nodes.h: Use the new NEVER_INLINE here and eliminate the old
2746 KJS_NO_INLINE. We don't want to have two, and we figured it was better
2747 to keep the one that's in WTF.
2749 2007-12-21 Darin Adler <darin@apple.com>
2753 - http://bugs.webkit.org/show_bug.cgi?id=16561
2754 remove debugger overhead from non-debugged JavaScript execution
2756 1.022x as fast on SunSpider.
2758 * JavaScriptCore.exp: Updated.
2760 * kjs/NodeInfo.h: Renamed SourceElementsStub to SourceElements,
2761 since that more accurately describes the role of this object, which
2762 is a reference-counted wrapper for a Vector.
2765 (KJS::Parser::didFinishParsing): Changed parameter type to SourceElements,
2766 and use plain assignment instead of set.
2767 * kjs/Parser.h: Changed parameter type of didFinishParsing to a
2768 SourceElements. Also changed m_sourceElements; we now use a RefPtr instead
2769 of an OwnPtr as well.
2771 * kjs/grammar.y: Got rid of all the calls to release() on SourceElements.
2772 That's now handed inside the constructors for various node types, since we now
2773 use vector swapping instead.
2776 (KJS::Node::rethrowException): Added NEVER_INLINE, because this was getting inlined
2777 and we want exception handling out of the normal code flow.
2778 (KJS::SourceElements::append): Moved here from the header. This now handles
2779 creating a BreakpointCheckStatement for each statement in the debugger case.
2780 That way we can get breakpoint handling without having it in every execute function.
2781 (KJS::BreakpointCheckStatement::BreakpointCheckStatement): Added.
2782 (KJS::BreakpointCheckStatement::execute): Added. Contains the code that was formerly
2783 in the StatementNode::hitStatement function and the KJS_BREAKPOINT macro.
2784 (KJS::BreakpointCheckStatement::streamTo): Added.
2785 (KJS::ArgumentListNode::evaluateList): Use KJS_CHECKEXCEPTIONVOID since the return
2787 (KJS::VarStatementNode::execute): Removed KJS_BREAKPOINT.
2788 (KJS::BlockNode::BlockNode): Changed parameter type to SourceElements.
2789 Changed code to use release since the class now contains a vector rather than
2791 (KJS::BlockNode::optimizeVariableAccess): Updated since member is now a vector
2792 rather than a vector pointer.
2793 (KJS::BlockNode::execute): Ditto.
2794 (KJS::ExprStatementNode::execute): Removed KJS_BREAKPOINT.
2795 (KJS::IfNode::execute): Ditto.
2796 (KJS::IfElseNode::execute): Ditto.
2797 (KJS::DoWhileNode::execute): Ditto.
2798 (KJS::WhileNode::execute): Ditto.
2799 (KJS::ContinueNode::execute): Ditto.
2800 (KJS::BreakNode::execute): Ditto.
2801 (KJS::ReturnNode::execute): Ditto.
2802 (KJS::WithNode::execute): Ditto.
2803 (KJS::CaseClauseNode::optimizeVariableAccess): Updated since member is now a vector
2804 rather than a vector pointer.
2805 (KJS::CaseClauseNode::executeStatements): Ditto.
2806 (KJS::SwitchNode::execute): Removed KJS_BREAKPOINT.
2807 (KJS::ThrowNode::execute): Ditto.
2808 (KJS::TryNode::execute): Ditto.
2809 (KJS::ScopeNode::ScopeNode): Changed parameter type to SourceElements.
2810 (KJS::ProgramNode::ProgramNode): Ditto.
2811 (KJS::EvalNode::EvalNode): Ditto.
2812 (KJS::FunctionBodyNode::FunctionBodyNode): Ditto.
2813 (KJS::ScopeNode::optimizeVariableAccess): Updated since member is now a vector
2814 rather than a vector pointer.
2816 * kjs/nodes.h: Removed hitStatement. Renamed SourceElements to StatementVector.
2817 Renamed SourceElementsStub to SourceElements and made it derive from
2818 ParserRefCounted rather than from Node, hold a vector rather than a pointer to
2819 a vector, and changed the release function to swap with another vector rather
2820 than the pointer idiom. Updated BlockNode and CaseClauseNode to hold actual
2821 vectors instead of pointers to vectors. Added BreakpointCheckStatement.
2823 * kjs/nodes2string.cpp:
2824 (KJS::statementListStreamTo): Changed to work on a vector instead of a pointer
2826 (KJS::BlockNode::streamTo): Ditto.
2827 (KJS::CaseClauseNode::streamTo): Ditto.
2829 * wtf/AlwaysInline.h: Added NEVER_INLINE.
2830 * wtf/PassRefPtr.h: Tweaked formatting. Added clear() function that matches the
2831 ones in OwnPtr and auto_ptr.
2832 * wtf/RefPtr.h: Ditto.
2834 2007-12-21 Darin Adler <darin@apple.com>
2836 - fix broken regression tests
2838 The broken tests were fast/js/do-while-expression-value.html and
2839 fast/js/while-expression-value.html.
2841 * kjs/nodes.cpp: Check in the correct version of this file. I had accidentally landed
2842 an old version of my patch for bug 16471.
2843 (KJS::statementListExecute): The logic here was backwards. Have to set the value
2844 even for non-normal execution results.
2846 2007-12-20 Alexey Proskuryakov <ap@webkit.org>
2850 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Copy npruntime_internal.h
2853 2007-12-20 Eric Seidel <eric@webkit.org>
2857 Split IfNode into IfNode and IfElseNode for speedup.
2858 http://bugs.webkit.org/show_bug.cgi?id=16470
2860 SunSpider claims this is 1.003x as fast as before.
2861 (This required running with --runs 15 to get consistent enough results to tell!)
2865 (KJS::IfNode::optimizeVariableAccess):
2866 (KJS::IfNode::execute):
2867 (KJS::IfNode::getDeclarations):
2868 (KJS::IfElseNode::optimizeVariableAccess):
2869 (KJS::IfElseNode::execute):
2870 (KJS::IfElseNode::getDeclarations):
2873 (KJS::IfElseNode::):
2874 * kjs/nodes2string.cpp:
2875 (KJS::IfNode::streamTo):
2876 (KJS::IfElseNode::streamTo):
2878 2007-12-20 Darin Adler <darin@apple.com>
2883 (WTF::operator==): Added.
2884 (WTF::operator!=): Added.
2886 2007-12-20 Geoffrey Garen <ggaren@apple.com>
2888 Reviewed by Oliver Hunt.
2890 AST optimization: Avoid NULL-checking ForNode's child nodes.
2892 0.6% speedup on SunSpider.
2894 This is a proof of concept patch that demonstrates how to optimize
2895 grammar productions with optional components, like
2897 for (optional; optional; optional) {
2901 The parser emits NULL for an optional component that is not present.
2903 Instead of checking for a NULL child at execution time, a node that
2904 expects an optional component to be present more often than not checks
2905 for a NULL child at construction time, and substitutes a viable
2906 alternative node in its place.
2908 (We'd like the parser to start emitting NULL a lot more once we teach
2909 it to emit NULL for certain no-op productions like EmptyStatement and
2910 VariableStatement, so, as a foundation, it's important for nodes with
2911 NULL optional components to be fast.)
2914 (KJS::Parser::didFinishParsing): Check for NULL SourceElements. Also,
2915 moved didFinishParsing into the .cpp file because adding a branch while
2916 it was in the header file caused a substantial and inexplicable
2917 performance regression. (Did I mention that GCC is crazy?)
2922 (KJS::BlockNode::BlockNode): Check for NULL SourceElements.
2923 (KJS::ForNode::optimizeVariableAccess): No need to check for NULL here.
2924 (KJS::ForNode::execute): No need to check for NULL here.
2926 (KJS::ForNode::): Check for NULL SourceElements. Substitute a TrueNode
2927 because it's semantically harmless, and it evaluates to boolean in an
2930 2007-12-20 Oliver Hunt <oliver@apple.com>
2934 Slight logic reordering in JSImmediate::from(double)
2936 This gives a 0.6% improvement in SunSpider.
2938 * kjs/JSImmediate.h:
2939 (KJS::JSImmediate::from):
2941 2007-12-20 Eric Seidel <eric@webkit.org>
2945 Fix major Array regression introduced by 28899.
2947 SunSpider claims this is at least 1.37x as fast as pre-regression. :)
2949 * kjs/array_instance.cpp: make Arrays fast again!
2951 2007-12-20 Eric Seidel <eric@webkit.org>
2953 Reviewed by Geoff, then re-rubber-stamped by Geoff after final search/replace and testing.
2955 Small reworking of Date code for 4% speedup on Date tests (0.2% overall)
2956 http://bugs.webkit.org/show_bug.cgi?id=16537
2958 Make msToYear human-readable
2959 Make msToDayInMonth slightly more readable and avoid recalculating msToYear
2960 Remove use of isInLeapYear to avoid calling msToYear
2961 Remove dayInYear call by changing msToDayInMonth to dayInMonthFromDayInYear
2962 Remove more duplicate calls to dayInYear and getUTCOffset for further speedup
2965 (KJS::daysFrom1970ToYear):
2967 (KJS::monthFromDayInYear):
2969 (KJS::dayInMonthFromDayInYear):
2970 (KJS::dateToDayInYear):
2971 (KJS::getDSTOffsetSimple):
2972 (KJS::getDSTOffset):
2973 (KJS::gregorianDateTimeToMS):
2974 (KJS::msToGregorianDateTime):
2976 2007-12-20 Rodney Dawes <dobey@wayofthemonkey.com>
2978 Reviewed by Darin Adler.
2980 Proxy includes of npruntime.h or npapi.h through npruntime_internal.h
2981 Include stdio.h in npapi.h for the use of FILE with XP_UNIX defined
2982 This is for building with X11, as some type and enum names conflict
2983 with #define names in X11 headers.
2984 http://bugs.webkit.org/show_bug.cgi?id=15669
2986 * JavaScriptCore.xcodeproj/project.pbxproj:
2987 * bindings/NP_jsobject.h:
2989 * bindings/npruntime.cpp:
2990 * bindings/npruntime_impl.h:
2991 * bindings/npruntime_priv.h:
2992 * bindings/npruntime_internal.h:
2993 * bindings/testbindings.cpp:
2994 * bindings/c/c_class.h:
2995 * bindings/c/c_runtime.h:
2996 * bindings/c/c_utility.h:
2998 2007-12-20 Darin Adler <darin@apple.com>
3000 - re-fix http://bugs.webkit.org/show_bug.cgi?id=16471
3001 Completions need to be smaller (or not exist at all)
3003 Same patch as last time with the test failures problem fixed.
3006 (KJS::GlobalFuncImp::callAsFunction): Make sure to check the completion
3007 type from newExec to see if the execute raised an exception.
3009 2007-12-20 Darin Adler <darin@apple.com>
3011 - roll out that last change -- it was causing test failures;
3012 I'll check it back in after fixing them
3014 2007-12-20 Darin Adler <darin@apple.com>
3018 - http://bugs.webkit.org/show_bug.cgi?id=16471
3019 Completions need to be smaller (or not exist at all)
3021 SuSpider shows 2.4% speedup.
3023 Stop using completions in the execution engine.
3024 Instead, the completion type and label target are both
3025 stored in the ExecState.
3027 * API/JSContextRef.cpp: Removed unneeded include of "completion.h".
3028 * bindings/runtime_method.cpp: Removed unused execute function.
3029 * bindings/runtime_method.h: Ditto.
3031 * kjs/ExecState.h: Added completionType, breakOrContinueTarget,
3032 setCompletionType, setNormalCompletion, setBreakCompletion,
3033 setContinueCompletion, setReturnValueCompletion, setThrowCompletion,
3034 setInterruptedCompletion, m_completionType, and m_breakOrContinueTarget.
3036 * kjs/completion.h: Removed constructor and getter for target
3037 for break and continue from Completion. This class is now only
3038 used for the public API to Interpreter and such.
3040 * kjs/date_object.h: Removed unused execute function.
3043 (KJS::FunctionImp::callAsFunction): Removed some unneeded
3044 exception processing. Updated to call the new execute function
3045 and to get the completion type from the ExecState. Merged in
3046 the execute function, which repeated some of the same logic and
3047 was called only from here.
3048 (KJS::GlobalFuncImp::callAsFunction): More of the same for eval.
3049 * kjs/function.h: Removed execute.
3051 * kjs/interpreter.cpp:
3052 (KJS::Interpreter::evaluate): Added code to convert the result of
3053 execut into a Completion.
3056 (KJS::Node::setErrorCompletion): Renamed from createErrorCompletion.
3057 Now sets the completion type in the ExecState.
3058 (KJS::Node::rethrowException): Now sets the completion type in the
3060 (KJS::StatementNode::hitStatement): Now sets the completion type in
3062 (KJS::VarStatementNode::execute): Updated to put completion type in
3063 the ExecState instead of a Completion object.
3064 (KJS::statementListExecute): Ditto. Also changed the for loop to use
3065 indices instead of iterators.
3066 (KJS::BlockNode::execute): Updated return type.
3067 (KJS::EmptyStatementNode::execute): Updated to put completion type in
3068 the ExecState instead of a Completion object.
3069 (KJS::ExprStatementNode::execute): Ditto.
3070 (KJS::IfNode::execute): Ditto.
3071 (KJS::DoWhileNode::execute): Ditto. Also streamlined the logic a little
3072 to make the normal case a little faster and moved the end outside the
3073 loop so that "break" can do a break.
3074 (KJS::WhileNode::execute): Ditto.
3075 (KJS::ForNode::execute): Ditto.
3076 (KJS::ForInNode::execute): Ditto.
3077 (KJS::ContinueNode::execute): Updated to put completion type in
3078 the ExecState instead of a Completion object.
3079 (KJS::BreakNode::execute): Ditto.
3080 (KJS::ReturnNode::execute): Ditto.
3081 (KJS::WithNode::execute): Ditto.
3082 (KJS::CaseClauseNode::executeStatements): Ditto. Also renamed to have
3083 execute in its name to reflect the fact that it's a member of the same
3084 family of functions.
3085 (KJS::CaseBlockNode::executeBlock): Ditto.
3086 (KJS::SwitchNode::execute): Ditto.
3087 (KJS::LabelNode::execute): Ditto.
3088 (KJS::ThrowNode::execute): Ditto.
3089 (KJS::TryNode::execute): Ditto.
3090 (KJS::ProgramNode::execute): Ditto.
3091 (KJS::EvalNode::execute): Ditto.
3092 (KJS::FunctionBodyNode::execute): Ditto.
3093 (KJS::FuncDeclNode::execute): Ditto.
3095 * kjs/nodes.h: Renamed setErrorCompletion to createErrorCompletion, made
3096 hitStatement protected, changed return value of execute to a JSValue,
3097 renamed evalStatements to executeStatements, and evalBlock to executeBlock.
3099 * kjs/number_object.h: Removed unused execute function.
3101 2007-12-20 Geoffrey Garen <ggaren@apple.com>
3106 (KJS::ProgramNode::processDeclarations):
3108 2007-12-20 Geoffrey Garen <ggaren@apple.com>
3110 Linux build fix: config.h has to come first.
3112 * kjs/error_object.cpp:
3114 2007-12-19 Geoffrey Garen <ggaren@apple.com>
3116 Reviewed by Oliver Hunt.
3118 Optimized global access to global variables, using a symbol table.
3120 SunSpider reports a 1.5% overall speedup, a 6.2% speedup on 3d-morph,
3121 and a whopping 33.1% speedup on bitops-bitwise-and.
3123 * API/JSCallbackObjectFunctions.h: Replaced calls to JSObject:: with
3124 calls to Base::, since JSObject is not always our base class. This
3125 was always a bug, but the bug is even more apparent after some of my
3128 (KJS::::staticFunctionGetter): Replaced use of getDirect with call to
3129 getOwnPropertySlot. Global declarations are no longer stored in the
3130 property map, so a call to getDirect is insufficient for finding
3131 override properties.
3134 * API/testapi.js: Added test for the getDirect change mentioned above.
3136 * kjs/ExecState.cpp:
3137 * kjs/ExecState.h: Dialed back the optimization to store a direct
3138 pointer to the localStorage buffer. One ExecState can grow the global
3139 object's localStorage without another ExecState's knowledge, so
3140 ExecState can't store a direct pointer to the localStorage buffer
3141 unless/until we invent a way to update all the relevant ExecStates.
3143 * kjs/JSGlobalObject.cpp: Inserted the symbol table into get and put
3145 (KJS::JSGlobalObject::reset): Reset the symbol table and local storage,
3146 too. Also, clear the property map here, removing the need for a
3149 * kjs/JSVariableObject.cpp:
3150 * kjs/JSVariableObject.h: Added support for saving localStorage and the
3151 symbol table to the back/forward cache, and restoring them.
3154 (KJS::GlobalFuncImp::callAsFunction): Renamed progNode to evalNode
3155 because it's an EvalNode, not a ProgramNode.
3158 (KJS::cacheGlobalObject): Replaced put with faster putDirect, since
3159 that's how the rest of lookup.h works. putDirect is safe here because
3160 cacheGlobalObject is only used for objects whose names are not valid
3163 * kjs/nodes.cpp: The good stuff!
3165 (KJS::EvalNode::processDeclarations): Replaced hasProperty with
3166 the new hasOwnProperty, which is slightly faster.
3168 * kjs/object.h: Nixed clearProperties because clear() does this job now.
3170 * kjs/property_map.cpp:
3171 * kjs/property_map.h: More back/forward cache support.
3174 (WTF::::grow): Added fast non-branching grow function. I used it in
3175 an earlier version of this patch, even though it's not used anymore.
3177 2007-12-09 Mark Rowe <mrowe@apple.com>
3179 Reviewed by Oliver Hunt.
3181 Build fix for non-Mac platforms. Move NodeInfo into its own header so that the YYTYPE
3182 declaration in grammar.h is able to declare members of that type.
3184 * kjs/NodeInfo.h: Added.
3185 (KJS::createNodeInfo):
3186 (KJS::mergeDeclarationLists):
3187 (KJS::appendToVarDeclarationList):
3191 2007-12-19 Oliver Hunt <oliver@apple.com>
3193 Make appendToVarDeclarationList static
3199 2007-12-18 Oliver Hunt <oliver@apple.com>
3201 Remove dead code due to removal of post-parse declaration discovery.
3205 Due to the removal of the declaration discovery pass after parsing we
3206 no longer need any of the logic used for that discovery.
3210 (KJS::VarDeclNode::VarDeclNode):
3211 (KJS::BlockNode::BlockNode):
3212 (KJS::ForInNode::ForInNode):
3213 (KJS::CaseBlockNode::CaseBlockNode):
3215 (KJS::VarStatementNode::):
3217 (KJS::DoWhileNode::):
3222 (KJS::FuncDeclNode::):
3223 (KJS::CaseClauseNode::):
3224 (KJS::ClauseListNode::):
3225 (KJS::SwitchNode::):
3227 2007-12-18 Oliver Hunt <oliver@apple.com>
3229 Replace post-parse pass to find declarations with logic in the parser itself
3233 Instead of finding declarations in a pass following the initial parsing of
3234 a program, we incorporate the logic directly into the parser. This lays
3235 the groundwork for further optimisations (such as improving performance in
3236 declaration expressions -- var x = y; -- to match that of standard assignment)
3237 in addition to providing a 0.4% performance improvement in SunSpider.
3239 * JavaScriptCore.exp:
3241 (KJS::Parser::parse):
3243 (KJS::Parser::didFinishParsing):
3244 (KJS::Parser::parse):
3247 (KJS::ParserTracked::ParserTracked):
3248 (KJS::ParserTracked::~ParserTracked):
3249 (KJS::ParserTracked::ref):
3250 (KJS::ParserTracked::deref):
3251 (KJS::ParserTracked::refcount):
3252 (KJS::ParserTracked::clearNewTrackedObjects):
3254 (KJS::ScopeNode::ScopeNode):
3255 (KJS::ProgramNode::ProgramNode):
3256 (KJS::EvalNode::EvalNode):
3257 (KJS::FunctionBodyNode::FunctionBodyNode):
3258 (KJS::FunctionBodyNode::initializeSymbolTable):
3259 (KJS::FunctionBodyNode::processDeclarations):
3261 (KJS::ParserTracked::):
3265 2007-12-18 Xan Lopez <xan@gnome.org>
3269 Fix http://bugs.webkit.org/show_bug.cgi?id=14521
3270 Bug 14521: JavaScriptCore fails to build on Linux/PPC gcc 4.1.2
3273 (TCMalloc_SpinLock::Unlock):
3275 Use less strict memory operand constraint on inline asm generation.
3276 PLATFORM(DARWIN) left unpatched due to Apple's GCC bug.
3278 Patch by David Kilzer <ddkilzer@webkit.org>
3280 2007-12-18 Mark Rowe <mrowe@apple.com>
3282 Rubber-stamped by Maciej Stachowiak.
3284 Remove outdated and non-functioning project files for the Apollo port.
3286 * JavaScriptCore.apolloproj: Removed.
3288 2007-12-18 Darin Adler <darin@apple.com>
3292 * pcre/pcre_exec.cpp:
3293 (jsRegExpExecute): Change back from false/true to 0/1 -- I probably should not have
3294 deleted MATCH_MATCH and MATCH_NOMATCH, but I'm going to leave them out.
3296 2007-12-18 Darin Adler <darin@apple.com>
3300 - fix http://bugs.webkit.org/show_bug.cgi?id=16458
3301 REGRESSION (r28164): regular expressions can now hang due to lack of a match limit
3302 <rdar://problem/5636067>
3304 Test: fast/regex/slow.html
3306 Slows down SunSpider a bit (about 1.01x); filed a bug to follow up on that:
3307 http://bugs.webkit.org/show_bug.cgi?id=16503
3309 * pcre/pcre.h: Changed name of error code to not specifically mention "recursion".
3310 * pcre/pcre_exec.cpp:
3311 (match): Replaced the depth limit, MATCH_RECURSION_LIMIT, with a total match looping
3312 limit, matchLimit. Also eliminated the constants for MATCH_MATCH and MATCH_NOMATCH,
3313 since they are just true and false (1 and 0).
3314 (jsRegExpExecute): More of the MATCH_MATCH change.
3316 2007-12-17 Darin Adler <darin@apple.com>
3318 - speculative build fix for non-gcc platforms
3320 * pcre/pcre_exec.cpp: (match): Remove unused cases from return switch.
3322 2007-12-16 Mark Rowe <mrowe@apple.com>
3324 Speculative build fix for non-Mac platforms.
3326 * pcre/pcre_compile.cpp: Include string.h for memset, memmove, etc.
3328 2007-12-16 Darin Adler <darin@apple.com>
3332 - http://bugs.webkit.org/show_bug.cgi?id=16438
3333 - removed some more unused code
3334 - changed quite a few more names to WebKit-style
3335 - moved more things out of pcre_internal.h
3336 - changed some indentation to WebKit-style
3337 - improved design of the functions for reading and writing
3338 2-byte values from the opcode stream (in pcre_internal.h)
3340 * pcre/dftables.cpp:
3341 (main): Added the kjs prefix a normal way in lieu of using macros.
3343 * pcre/pcre_compile.cpp: Moved some definitions here from pcre_internal.h.
3344 (errorText): Name changes, fewer typedefs.
3345 (checkEscape): Ditto. Changed uppercase conversion to use toASCIIUpper.
3346 (isCountedRepeat): Name change.
3347 (readRepeatCounts): Name change.
3348 (firstSignificantOpcode): Got rid of the use of OP_lengths, which is
3349 very lightly used here. Hard-coded the length of OP_BRANUMBER.
3350 (firstSignificantOpcodeSkippingAssertions): Ditto. Also changed to
3351 use the advanceToEndOfBracket function.
3352 (getOthercaseRange): Name changes.
3353 (encodeUTF8): Ditto.
3354 (compileBranch): Name changes. Removed unused after_manual_callout and
3355 the code to handle it. Removed code to handle OP_ONCE since we never
3356 emit this opcode. Changed to use advanceToEndOfBracket in more places.
3357 (compileBracket): Name changes.
3358 (branchIsAnchored): Removed code to handle OP_ONCE since we never emit
3360 (bracketIsAnchored): Name changes.
3361 (branchNeedsLineStart): More fo the same.
3362 (bracketNeedsLineStart): Ditto.
3363 (branchFindFirstAssertedCharacter): Removed OP_ONCE code.
3364 (bracketFindFirstAssertedCharacter): More of the same.
3365 (calculateCompiledPatternLengthAndFlags): Ditto.
3366 (returnError): Name changes.
3367 (jsRegExpCompile): Ditto.
3369 * pcre/pcre_exec.cpp: Moved some definitions here from pcre_internal.h.
3370 (matchRef): Updated names.
3371 Improved macros to use the do { } while(0) idiom so they expand to single
3372 statements rather than to blocks or multiple statements. And refeactored
3373 the recursive match macros.
3374 (MatchStack::pushNewFrame): Name changes.
3375 (getUTF8CharAndIncrementLength): Name changes.
3376 (match): Name changes. Removed the ONCE opcode.
3377 (jsRegExpExecute): Name changes.
3379 * pcre/pcre_internal.h: Removed quite a few unneeded includes. Rewrote
3380 quite a few comments. Removed the macros that add kjs prefixes to the
3381 functions with external linkage; instead renamed the functions. Removed
3382 the unneeded typedefs pcre_uint16, pcre_uint32, and uschar. Removed the
3383 dead and not-all-working code for LINK_SIZE values other than 2, although
3384 we aim to keep the abstraction working. Removed the OP_LENGTHS macro.
3385 (put2ByteValue): Replaces put2ByteOpcodeValueAtOffset.
3386 (get2ByteValue): Replaces get2ByteOpcodeValueAtOffset.
3387 (put2ByteValueAndAdvance): Replaces put2ByteOpcodeValueAtOffsetAndAdvance.
3388 (putLinkValueAllowZero): Replaces putOpcodeValueAtOffset; doesn't do the
3389 addition, since a comma is really no better than a plus sign. Added an
3390 assertion to catch out of range values and changed the parameter type to
3391 int rather than unsigned.
3392 (getLinkValueAllowZero): Replaces getOpcodeValueAtOffset.
3393 (putLinkValue): New function that most former callers of the
3394 putOpcodeValueAtOffset function can use; asserts the value that is
3395 being stored is non-zero and then calls putLinkValueAllowZero.
3396 (getLinkValue): Ditto.
3397 (putLinkValueAndAdvance): Replaces putOpcodeValueAtOffsetAndAdvance. No
3398 caller was using an offset, which makes sense given the advancing behavior.
3399 (putLinkValueAllowZeroAndAdvance): Ditto.
3400 (isBracketOpcode): Added. For use in an assertion.
3401 (advanceToEndOfBracket): Renamed from moveOpcodePtrPastAnyAlternateBranches,
3402 and removed comments about how it's not well designed. This function takes
3403 a pointer to the beginning of a bracket and advances to the end of the
3406 * pcre/pcre_tables.cpp: Updated names.
3407 * pcre/pcre_ucp_searchfuncs.cpp:
3408 (kjs_pcre_ucp_othercase): Ditto.
3409 * pcre/pcre_xclass.cpp:
3410 (getUTF8CharAndAdvancePointer): Ditto.
3411 (kjs_pcre_xclass): Ditto.
3412 * pcre/ucpinternal.h: Ditto.
3415 (WTF::isASCIIAlpha): Added an int overload, like the one we already have for
3417 (WTF::isASCIIAlphanumeric): Ditto.
3418 (WTF::isASCIIHexDigit): Ditto.
3419 (WTF::isASCIILower): Ditto.
3420 (WTF::isASCIISpace): Ditto.
3421 (WTF::toASCIILower): Ditto.
3422 (WTF::toASCIIUpper): Ditto.
3424 2007-12-16 Darin Adler <darin@apple.com>
3428 - fix http://bugs.webkit.org/show_bug.cgi?id=16459
3429 REGRESSION: assertion failure with regexp with \B in a case-ignoring character range
3430 <rdar://problem/5646361>
3432 The problem was that \B was not handled properly in character classes.
3434 Test: fast/js/regexp-overflow.html
3436 * pcre/pcre_compile.cpp:
3437 (check_escape): Added handling of ESC_b and ESC_B in character classes here.
3438 Allows us to get rid of the handling of \b in character classes from all the
3439 call sites that handle it separately and to handle \B properly as well.
3440 (compileBranch): Remove the ESC_b handling, since it's not needed any more.
3441 (calculateCompiledPatternLengthAndFlags): Ditto.
3443 2007-12-16 Mark Rowe <mrowe@apple.com>
3445 Reviewed by Maciej Stachowiak.
3447 Fix http://bugs.webkit.org/show_bug.cgi?id=16448
3448 Bug 16448: [GTK] Celtic Kane JavaScript performance on Array test is slow relative to Mac
3450 * kjs/array_instance.cpp:
3451 (KJS::compareByStringPairForQSort):
3452 (KJS::ArrayInstance::sort): Convert JSValue's to strings once up front and then sort the
3453 results. This avoids calling toString twice per comparison, but requires a temporary buffer
3454 so we only use this approach in cases where the array being sorted is not too large.
3456 2007-12-16 Geoffrey Garen <ggaren@apple.com>
3458 Reviewed by Darin Adler and Maciej Stachowiak.
3460 More refactoring to support global variable optimization.
3462 Changed SymbolTable to use RefPtr<UString::Rep> as its key instead of
3463 UString::Rep*. With globals, the symbol table can outlast the
3464 declaration node for any given symbol, so the symbol table needs to ref
3467 In support, specialized HashMaps with RefPtr keys to allow lookup
3468 via raw pointer, avoiding refcount churn.
3470 SunSpider reports a .6% speedup (prolly just noise).
3472 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added new file: wtf/RefPtrHashMap.h
3473 * JavaScriptCore.xcodeproj/project.pbxproj: ditto
3475 * kjs/JSVariableObject.cpp:
3476 (KJS::JSVariableObject::getPropertyNames): Symbol table keys are RefPtrs now.
3478 * kjs/SymbolTable.h: Modified key traits to match RefPtr. Added a
3479 static Rep* for null, which helps compute the deletedValue() trait.
3481 * wtf/HashMap.h: #include the RefPtr specialization so everyone can use it.
3483 * wtf/RefPtrHashMap.h: Copied from wtf/HashMap.h. Added overloaded versions
3484 of find(), contains(), get(), set(), add(), remove(), and take() that take
3485 raw pointers as keys.
3487 2007-12-16 Alexey Proskuryakov <ap@webkit.org>
3491 http://bugs.webkit.org/show_bug.cgi?id=16162
3492 Problems with float parsing on Linux (locale-dependent parsing was used).
3494 * kjs/dtoa.cpp: Removed USE_LOCALE to reduce future confusion.
3495 * kjs/lexer.cpp: (KJS::Lexer::lex): Parse with kjs_strtod, not the system one.
3497 2007-12-14 Alp Toker <alp@atoker.com>
3499 Reviewed by Mark Rowe.
3501 Enable the AllInOneFile.cpp optimization for the GTK+ port.
3503 * JavaScriptCore.pri: