1 2008-02-29 Adam Roben <aroben@apple.com>
3 Remove unused DebuggerImp::abort and DebuggerImp::aborted
5 Reviewed by Tim and Sam.
7 * kjs/function_object.cpp:
8 (KJS::FunctionObjectImp::construct):
10 (KJS::DebuggerImp::DebuggerImp):
12 (KJS::Node::handleException):
13 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
15 2008-02-28 Eric Christopher <echristo@apple.com>
17 Reviewed by Geoffrey Garen.
19 ** TOTAL **: 1.005x as fast 2867.6ms +/- 0.4% 2853.2ms +/- 0.3% significant
21 * kjs/nodes.cpp: Tell the compiler that exceptions are unexpected (for
22 the sake of branch prediction and code organization).
24 2008-02-27 Alexey Proskuryakov <ap@webkit.org>
26 Reviewed by Sam Weinig.
28 http://bugs.webkit.org/show_bug.cgi?id=17030
29 Small buffer overflow within initialization
31 * kjs/date_object.cpp:
32 (KJS::DateObjectFuncImp::callAsFunction):
34 Remove unnecessary and incorrect memset() calls - GregorianDateTime can initialize itself.
36 2008-02-25 Sam Weinig <sam@webkit.org>
38 Reviewed by Dan Bernstein.
40 - Add a variant of remove that takes a position and a length.
43 (WTF::Vector::remove):
45 2008-02-25 Mark Mentovai <mark@moxienet.com>
47 Reviewed by Mark Rowe.
49 Enable CollectorHeapIntrospector to build by itself, as well as in an AllInOneFile build.
50 http://bugs.webkit.org/show_bug.cgi?id=17538
52 * kjs/CollectorHeapIntrospector.cpp: Provide "using" declaration for
53 WTF::RemoteMemoryReader.
54 * kjs/collector.h: Move CollectorHeap declaration here...
55 * kjs/collector.cpp: ... from here.
57 2008-02-25 Darin Adler <darin@apple.com>
61 * JavaScriptCore.exp: Sort the contents of this file.
63 2008-02-25 Adam Roben <aroben@apple.com>
68 (functionQuit): Don't add a return statement after exit(0) for MSVC.
70 2008-02-24 Sam Weinig <sam@webkit.org>
72 Reviewed by Mark Rowe.
74 http://bugs.webkit.org/show_bug.cgi?id=17529
75 Add support for reading from stdin from testkjs
78 (GlobalObject::GlobalObject): Add readline function to global object.
79 (functionReadline): Added. Reads characters from stdin until a '\n' or
80 EOF is encountered. The input is returned as a String to the caller.
82 2008-02-24 Sam Weinig <sam@webkit.org>
84 Reviewed by Mark Rowe.
86 http://bugs.webkit.org/show_bug.cgi?id=17528
90 * JavaScriptCore.xcodeproj/project.pbxproj: Make the testkjs.cpp use 4 space indentation.
92 (StopWatch::getElapsedMS):
93 (GlobalObject::className):
94 (GlobalObject::GlobalObject):
95 Rename GlobalImp to GlobalObject and setup the global functions
96 in the GlobalObject's constructor. Also, use static functions for
97 the implementation so we can use the standard PrototypeFunction
98 class and remove TestFunctionImp.
99 (functionPrint): Move print() functionality here.
100 (functionDebug): Move debug() functionality here.
101 (functionGC): Move gc() functionality here.
102 (functionVersion): Move version() functionality here.
103 (functionRun): Move run() functionality here.
104 (functionLoad): Move load() functionality here.
105 (functionQuit): Move quit() functionality here.
106 (prettyPrintScript): Fix indentation.
107 (runWithScripts): Since all the functionality of createGlobalObject is
108 now in the GlobalObject constructor, just call new here.
109 (parseArguments): Fix indentation.
111 (fillBufferWithContentsOfFile): Ditto.
113 2008-02-24 Sam Weinig <sam@webkit.org>
115 Reviewed by Oliver Hunt and Mark Rowe.
117 http://bugs.webkit.org/show_bug.cgi?id=17505
118 Add support for getting command line arguments in testkjs
120 - This slightly changes the behavior of parsing arguments by requiring
121 a '-f' before all files.
124 (createGlobalObject): Add a global property called 'arguments' which
125 contains an array with the parsed arguments as strings.
126 (runWithScripts): Pass in the arguments vector so that it can be passed
127 to the global object.
128 (parseArguments): Change parsing rules to require a '-f' before any script
129 file. After all '-f' and '-p' arguments have been parsed, the remaining
130 are added to the arguments vector and exposed to the script. If there is a
131 chance of ambiguity (the user wants to pass the string '-f' to the script),
132 the string '--' can be used separate the options from the pass through
136 2008-02-24 Dan Bernstein <mitz@apple.com>
138 Reviewed by Darin Adler.
140 - fix http://bugs.webkit.org/show_bug.cgi?id=17511
141 REGRESSION: Reproducible crash in SegmentedSubstring::SegmentedSubstring(SegmentedSubstring const&)
144 (WTF::::expandCapacityIfNeeded): Fixed the case where m_start and m_end
145 are both zero but the buffer capacity is non-zero.
146 (WTF::::prepend): Added validity checks.
148 2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
150 Rubber stamped by Darin.
152 Add separator '\' after libJavaScriptCore_la_LIBADD and cleanup
153 whitespaces introduced in the previous commit.
157 2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
159 * GNUmakefile.am: Add GLOBALDEPS for testkjs and minidom.
161 2008-02-23 Darin Adler <darin@apple.com>
165 - http://bugs.webkit.org/show_bug.cgi?id=17496
166 make Deque use a circular array; add iterators
168 * wtf/Deque.h: Wrote an all-new version of this class that uses a circular
169 buffer. Growth policy is identical to vector. Added iterators.
171 * wtf/Vector.h: Made two small refinements while using this to implement
172 Deque: Made VectorBufferBase derive from Noncopyable, which would have
173 saved me some debugging time if it had been there. Renamed Impl and
174 m_impl to Buffer and m_buffer.
176 2008-02-23 Darin Adler <darin@apple.com>
180 - http://bugs.webkit.org/show_bug.cgi?id=17067
181 eliminate attributes parameter from JSObject::put for speed/clarity
183 * API/JSCallbackObject.h: Removed attribute arguments.
184 * API/JSCallbackObjectFunctions.h:
185 (KJS::JSCallbackObject<Base>::put): Ditto.
186 * API/JSObjectRef.cpp:
187 (JSObjectSetProperty): Use initializeVariable or putDirect when necessary
188 to set attribute values.
189 * JavaScriptCore.exp: Updated.
190 * bindings/objc/objc_runtime.h: Removed attribute arguments.
191 * bindings/objc/objc_runtime.mm:
192 (ObjcFallbackObjectImp::put): Ditto.
193 * bindings/runtime_array.cpp:
194 (RuntimeArray::put): Ditto.
195 * bindings/runtime_array.h: Ditto.
196 * bindings/runtime_object.cpp:
197 (RuntimeObjectImp::put): Ditto.
198 * bindings/runtime_object.h: Ditto. Also removed canPut which was only
199 called from one place in WebCore that can use hasProperty instead.
201 * kjs/Activation.h: Removed attribute argument from put and added the new
202 initializeVariable function that's used to put variables in variable objects.
203 Also made isActivationObject a const member.
205 * kjs/JSGlobalObject.cpp:
206 (KJS::JSGlobalObject::put): Removed attribute argument.
207 (KJS::JSGlobalObject::initializeVariable): Added. Used to give variables
208 their initial values, which can include the read-only property.
209 (KJS::JSGlobalObject::reset): Removed obsolete comments about flags.
210 Removed Internal flag, which is no longer needed.
211 * kjs/JSGlobalObject.h: More of the same.
213 * kjs/JSVariableObject.h: Added pure virtual initializeVariable function.
214 (KJS::JSVariableObject::symbolTablePut): Removed checkReadOnly flag; we always
216 (KJS::JSVariableObject::symbolTableInitializeVariable): Added.
218 * kjs/array_instance.cpp:
219 (KJS::ArrayInstance::put): Removed attribute argument.
220 * kjs/array_instance.h: Ditto.
223 (KJS::FunctionImp::put): Ditto.
224 (KJS::Arguments::put): Ditto.
225 (KJS::ActivationImp::put): Ditto.
226 (KJS::ActivationImp::initializeVariable): Added.
227 * kjs/function.h: Removed attribute arguments.
229 * kjs/function_object.cpp:
230 (KJS::FunctionObjectImp::construct): Removed Internal flag.
233 (KJS::lookupPut): Removed attributes argument. Also changed to use putDirect
234 instead of calling JSObject::put.
235 (KJS::cacheGlobalObject): Ditto.
238 (KJS::ConstDeclNode::handleSlowCase): Call initializeVariable to initialize
240 (KJS::ConstDeclNode::evaluateSingle): Ditto.
241 (KJS::TryNode::execute): Use putDirect to set up the new object.
242 (KJS::FunctionBodyNode::processDeclarations): Removed Internal.
243 (KJS::ProgramNode::processDeclarations): Ditto.
244 (KJS::EvalNode::processDeclarations): Call initializeVariable to initialize
245 the variables and functions.
246 (KJS::FuncDeclNode::makeFunction): Removed Internal.
247 (KJS::FuncExprNode::evaluate): Ditto.
249 * kjs/object.cpp: Removed canPut, which was only being used in one code path,
250 not the normal high speed one.
251 (KJS::JSObject::put): Removed attribute argument. Moved the logic from
252 canPut here, in the one code ath that was still using it.
253 * kjs/object.h: Removed Internal attribute, ad canPut function. Removed the
254 attributes argument to the put function. Made isActivationObject const.
256 * kjs/regexp_object.cpp:
257 (KJS::RegExpImp::put): Removed attributes argument.
258 (KJS::RegExpImp::putValueProperty): Ditto.
259 (KJS::RegExpObjectImp::put): Ditto.
260 (KJS::RegExpObjectImp::putValueProperty): Ditto.
261 * kjs/regexp_object.h: Ditto.
263 * kjs/string_object.cpp:
264 (KJS::StringInstance::put): Removed attributes argument.
265 * kjs/string_object.h: Ditto.
267 2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
269 Not reviewed, Gtk build fix.
273 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
275 Windows build fix - move ThreadCondition implementation from WebCore to WTF.
277 * wtf/ThreadingWin.cpp:
278 (WTF::ThreadCondition::ThreadCondition):
279 (WTF::ThreadCondition::~ThreadCondition):
280 (WTF::ThreadCondition::wait):
281 (WTF::ThreadCondition::signal):
282 (WTF::ThreadCondition::broadcast):
284 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
286 Touch some files, hoping that Windows build bot will create JSC headers.
288 * kjs/AllInOneFile.cpp:
289 * kjs/array_instance.cpp:
292 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
294 Qt/Wx build fix - this file was still in a wrong namespace, too.
296 * wtf/ThreadingNone.cpp:
298 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
300 More build fixing - fix mismatched braces.
302 * JavaScriptCore.pri:
304 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
306 Wx and Gtk build fixes.
308 * JavaScriptCore.pri: Don't try to compile ThreadingPthreads.
309 * wtf/ThreadingGtk.cpp: Use a correct namespace.
311 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
315 Move basic threading support from WebCore to WTF.
317 Added mutex protection to MessageQueue::killed() for paranoia sake.
320 * JavaScriptCore.exp:
321 * JavaScriptCore.pri:
322 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
323 * JavaScriptCore.xcodeproj/project.pbxproj:
324 * JavaScriptCoreSources.bkl:
325 * wtf/Locker.h: Copied from WebCore/platform/Locker.h.
326 * wtf/MessageQueue.h: Copied from WebCore/platform/MessageQueue.h.
328 * wtf/Threading.h: Copied from WebCore/platform/Threading.h.
329 * wtf/ThreadingGtk.cpp: Copied from WebCore/platform/gtk/ThreadingGtk.cpp.
330 (WebCore::createThread):
331 * wtf/ThreadingNone.cpp: Copied from WebCore/platform/ThreadingNone.cpp.
332 * wtf/ThreadingPthreads.cpp: Copied from WebCore/platform/pthreads/ThreadingPthreads.cpp.
334 * wtf/ThreadingWin.cpp: Copied from WebCore/platform/win/ThreadingWin.cpp.
337 (WTF::Mutex::~Mutex):
339 (WTF::Mutex::tryLock):
340 (WTF::Mutex::unlock):
342 2008-02-22 Geoffrey Garen <ggaren@apple.com>
344 Reviewed by Sam Weinig.
346 Partial fix for <rdar://problem/5744037> Gmail out of memory (17455)
348 I'm removing KJS_MEM_LIMIT for the following reasons:
350 - We have a few reports of KJS_MEM_LIMIT breaking important web
351 applications, like GMail and Google Reader. (For example, if you
352 simply open 12 GMail tabs, tab #12 will hit the limit.)
354 - Firefox has no discernable JS object count limit, so any limit, even
355 a large one, is a potential compatibility problem.
357 - KJS_MEM_LIMIT does not protect against malicious memory allocation,
358 since there are many ways to maliciously allocate memory without
359 increasing the JS object count.
361 - KJS_MEM_LIMIT is already mostly broken, since it only aborts the
362 script that breaches the limit, not any subsequent scripts.
364 - We've never gotten bug reports about websites that would have
365 benefited from an unbroken KJS_MEM_LIMIT. The initial check-in of
366 KJS_MEM_LIMIT (KJS revision 80061) doesn't mention a website that
369 - Any website that brings you anywhere close to crashing due to the
370 number of live JS objects will almost certainly put up the "slow
371 script" dialog at least 20 times beforehand.
374 (KJS::Collector::collect):
377 (KJS::TryNode::execute):
379 2008-02-22 Oliver Hunt <oliver@apple.com>
381 Reviewed by Alexey P.
383 <rdar://problem/5759327> REGRESSION: while(NaN) acts like while(true)
385 Fix yet another case where we incorrectly relied on implicit double
389 (KJS::PostDecLocalVarNode::evaluateToBoolean):
391 2008-02-20 Michael Knaup <michael.knaup@mac.com>
395 Fix for Bug 16753: date set methods with no args should result in NaN (Acid3 bug)
396 The set values result in NaN now when called with no args, NaN or +/- inf values.
397 The setYear, setFullYear and setUTCFullYear methods used on NaN dates work as
398 descripted in the standard.
400 * kjs/date_object.cpp:
401 (KJS::fillStructuresUsingTimeArgs):
402 (KJS::fillStructuresUsingDateArgs):
403 (KJS::setNewValueFromTimeArgs):
404 (KJS::setNewValueFromDateArgs):
405 (KJS::dateProtoFuncSetYear):
407 2008-02-19 Anders Carlsson <andersca@apple.com>
411 Change OpaqueJSClass and RootObject to start with a ref count of 1.
413 * API/JSClassRef.cpp:
414 (OpaqueJSClass::OpaqueJSClass):
415 (OpaqueJSClass::createNoAutomaticPrototype):
416 (OpaqueJSClass::create):
418 * API/JSObjectRef.cpp:
420 * bindings/runtime_root.cpp:
421 (KJS::Bindings::RootObject::create):
422 (KJS::Bindings::RootObject::RootObject):
424 2008-02-19 Darin Adler <darin@apple.com>
426 Rubber stamped by Anders.
428 - removed explicit initialization to 1 for RefCounted; that's now the default
431 (KJS::RegExp::RegExp): Removed RefCounted initializer.
433 2008-02-19 Darin Adler <darin@apple.com>
437 - next step for http://bugs.webkit.org/show_bug.cgi?id=17257
438 start ref counts at 1 instead of 0 for speed
441 (WTF::RefCounted::RefCounted): Have refcounts default to 1. This allows us to start
442 removing the explicit initialization of RefCounted from classes and eventually we
443 can remove the ability to have the initial count of 0 entirely.
445 2008-02-18 Samuel Weinig <sam@webkit.org>
447 Reviewed by Geoff Garen.
449 Fix for http://bugs.webkit.org/show_bug.cgi?id=17419
450 Remove CompatMode from JavaScriptCore as it is never set to anything other than NativeMode
452 * kjs/JSGlobalObject.cpp:
453 (KJS::JSGlobalObject::init):
454 * kjs/JSGlobalObject.h:
455 (KJS::JSGlobalObject::setDebugger):
456 * kjs/date_object.cpp:
457 (KJS::dateProtoFuncGetYear):
459 2008-02-18 Darin Adler <darin@apple.com>
464 (WTF::toASCIIHexValue): Added.
466 2008-02-17 Darin Adler <darin@apple.com>
468 * wtf/ListHashSet.h: (WTF::swap): Removed stray return statement.
470 2008-02-15 Adam Roben <aroben@apple.com>
472 Make JavaScriptCore's FEATURE_DEFINES match WebCore's
476 * Configurations/JavaScriptCore.xcconfig:
478 2008-02-14 Stephanie Lewis <slewis@apple.com>
484 * JavaScriptCore.order:
486 2008-02-14 Geoffrey Garen <ggaren@apple.com>
488 Reviewed by Sam Weinig.
490 Fixed <rdar://problem/5737835> nee http://bugs.webkit.org/show_bug.cgi?id=17329
491 Crash in JSGlobalObject::popActivation when inserting hyperlink in Wordpress (17329)
493 Don't reset the "activations" stack in JSGlobalObject::reset, since we
494 might be executing a script during the call to reset, and the script
495 needs to safely run to completion.
497 Instead, initialize the "activations" stack when the global object is
498 created, and subsequently rely on pushing and popping during normal
499 execution to maintain the stack's state.
501 * kjs/JSGlobalObject.cpp:
502 (KJS::JSGlobalObject::init):
503 (KJS::JSGlobalObject::reset):
505 2008-02-13 Bernhard Rosenkraenzer <bero@arklinux.org>
509 - http://bugs.webkit.org/show_bug.cgi?id=17339
510 JavaScriptCore does not build with gcc 4.3
512 * kjs/interpreter.cpp: Add include of <unistd.h>, since that's where
515 2008-02-13 Oliver Hunt <oliver@apple.com>
517 Reviewed by Alexey P.
519 <rdar://problem/5737003> REGRESSION (r27747): can't browse pictures on fastcupid.com
521 When converting numeric values to booleans we need to account for NaN
524 (KJS::MultNode::evaluateToBoolean):
525 (KJS::ModNode::evaluateToBoolean):
527 2008-02-08 Samuel Weinig <sam@webkit.org>
529 Reviewed by Brady Eidson.
531 <rdar://problem/5659216> REGRESSION: PLT 0.3% slower due to r28868 (caching ClassNodeList and NamedNodeList)
533 - Tweak the statements in isASCIISpace to account for the statistical distribution of
536 .4% speedup on my machine. Stephanie's machine shows this as .3% speedup.
541 2008-02-11 Sam Weinig <sam@webkit.org>
543 Reviewed by Anders Carlsson.
546 <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
547 <rdar://problem/5735443> Crash when setting the Window objects prototype to a custom Object and then calling a method on it
549 - Expose the native Object.prototype.toString implementation so that it can be used for cross-domain
552 * JavaScriptCore.exp:
553 * kjs/object_object.cpp:
554 * kjs/object_object.h:
556 2008-02-10 Darin Adler <darin@apple.com>
558 Rubber stamped by Eric.
561 (KJS::ExecState::takeException): Added.
563 2008-02-10 Darin Adler <darin@apple.com>
567 - http://bugs.webkit.org/show_bug.cgi?id=17256
568 eliminate default ref. count of 0 in RefCounted class
571 (WTF::RefCounted::RefCounted): Remove default of 0.
573 2008-02-10 Darin Adler <darin@apple.com>
577 - http://bugs.webkit.org/show_bug.cgi?id=17256
578 Make clients of RefCounted explicitly set the count to 0.
580 * API/JSClassRef.cpp:
581 (OpaqueJSClass::OpaqueJSClass):
582 * bindings/runtime_root.cpp:
583 (KJS::Bindings::RootObject::RootObject):
585 2008-02-09 Darin Adler <darin@apple.com>
589 - http://bugs.webkit.org/show_bug.cgi?id=17256
590 Change RegExp to start its ref count at 1, not 0
592 We'll want to do this to every RefCounted class, one at a time.
595 (KJS::RegExpNode::RegExpNode): Use RegExp::create instead of new RegExp.
597 (KJS::RegExp::RegExp): Marked inline, set initial ref count to 1.
598 (KJS::RegExp::create): Added. Calls new RegExp then adopts the initial ref.
599 * kjs/regexp.h: Reformatted. Made the constructors private. Added static
600 create functions that return objects already wrapped in PassRefPtr.
601 * kjs/regexp_object.cpp:
602 (KJS::regExpProtoFuncCompile): Use RegExp::create instead of new RegExp.
603 (KJS::RegExpObjectImp::construct): Ditto.
604 * kjs/string_object.cpp:
605 (KJS::stringProtoFuncMatch): Ditto.
606 (KJS::stringProtoFuncSearch): Ditto.
608 2008-02-08 Oliver Hunt <oliver@apple.com>
612 <rdar://problem/5731773> REGRESSION (r28973): Extraneous parentheses in function.toString()
613 https://bugs.webkit.org/show_bug.cgi?id=17214
615 Make a subclass of CommaNode to provide the correct precedence for each expression in
616 a variable declaration list.
620 (KJS::VarDeclCommaNode::):
622 2008-02-08 Darin Adler <darin@apple.com>
626 - fix http://bugs.webkit.org/show_bug.cgi?id=17247
627 Labelled continue/break can fail in some cases
629 Test: fast/js/continue-break-multiple-labels.html
632 (KJS::StatementNode::pushLabel): Made this virtual.
633 (KJS::LabelNode::pushLabel): Forward pushLabel calls to the statement inside.
635 2008-02-08 Darin Adler <darin@apple.com>
639 - fix http://bugs.webkit.org/show_bug.cgi?id=15003
640 Function.prototype.constructor should not be DontDelete/ReadOnly (Acid3 bug)
642 Test: fast/js/constructor-attributes.html
644 * kjs/JSGlobalObject.cpp:
645 (KJS::JSGlobalObject::reset): Remove unwanted attributes from "constructor".
646 * kjs/function_object.cpp:
647 (KJS::FunctionObjectImp::construct): Ditto.
649 (KJS::FuncDeclNode::makeFunction): Ditto.
650 (KJS::FuncExprNode::evaluate): Ditto.
652 2008-02-06 Geoffrey Garen <ggaren@apple.com>
654 Reviewed by Oliver Hunt.
656 Added an ASSERT to catch refCount underflow, since it caused a leak in
660 (WTF::RefCounted::deref):
662 2008-02-06 Geoffrey Garen <ggaren@apple.com>
664 Reviewed by Darin Adler.
666 PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
667 slower due to r28884 (global variable symbol table optimization)
669 Tweaked RefCounted::deref() to be a little more efficient.
671 1% - 1.5% speedup on my machine. .7% speedup on Stephanie's machine.
674 (WTF::RefCounted::deref): Don't modify m_refCount if we're just going
675 to delete the object anyway. Also, use a simple == test, which might be
676 faster than <= on some hardware.
678 2008-02-06 Darin Adler <darin@apple.com>
682 - fix http://bugs.webkit.org/show_bug.cgi?id=17094
683 Array.prototype functions create length properties with DontEnum/DontDelete
685 Test results match Gecko with very few obscure exceptions that seem to be
688 Test: fast/js/array-functions-non-arrays.html
690 * kjs/array_object.cpp:
691 (KJS::arrayProtoFuncConcat): Removed DontEnum and DontDelete from the call
693 (KJS::arrayProtoFuncPop): Ditto. Also added missing call to deleteProperty,
694 which is not needed for real arrays, but is needed for non-arrays.
695 (KJS::arrayProtoFuncPush): Ditto.
696 (KJS::arrayProtoFuncShift): Ditto.
697 (KJS::arrayProtoFuncSlice): Ditto.
698 (KJS::arrayProtoFuncSort): Removed incorrect call to set length when
699 the array has no elements.
700 (KJS::arrayProtoFuncSplice): Removed DontEnum and DontDelete from the call
702 (KJS::arrayProtoFuncUnShift): Ditto. Also added a check for 0 arguments to
703 make behavior match the specification in that case.
705 (KJS::ArrayNode::evaluate): Removed DontEnum and DontDelete from the call
708 2008-02-06 Darin Adler <darin@apple.com>
712 - replace calls to put to set up properties with calls to putDirect, to
713 prepare for a future change where put won't take attributes any more,
714 and for a slight performance boost
716 * API/JSObjectRef.cpp:
717 (JSObjectMakeConstructor): Use putDirect instead of put.
718 * kjs/CommonIdentifiers.h: Removed lastIndex.
719 * kjs/JSGlobalObject.cpp:
720 (KJS::JSGlobalObject::reset): Use putDirect instead of put.
721 * kjs/array_object.cpp:
722 (KJS::arrayProtoFuncConcat): Took out extra call to get length (unused).
723 (KJS::ArrayObjectImp::ArrayObjectImp): Use putDirect instead of put.
724 * kjs/error_object.cpp:
725 (KJS::ErrorPrototype::ErrorPrototype): Use putDirect instead of put.
727 (KJS::Arguments::Arguments): Use putDirect instead of put.
728 (KJS::PrototypeFunction::PrototypeFunction): Use putDirect instead of put.
729 * kjs/function_object.cpp:
730 (KJS::FunctionObjectImp::construct): Use putDirect instead of put.
732 (KJS::FuncDeclNode::makeFunction): Use putDirect instead of put.
733 (KJS::FuncExprNode::evaluate): Use putDirect instead of put.
734 * kjs/regexp_object.cpp:
735 (KJS::regExpProtoFuncCompile): Use setLastIndex instead of put(lastIndex).
736 (KJS::RegExpImp::match): Get and set lastIndex by using m_lastIndex instead of
738 * kjs/regexp_object.h:
739 (KJS::RegExpImp::setLastIndex): Added.
740 * kjs/string_object.cpp:
741 (KJS::stringProtoFuncMatch): Use setLastIndex instead of put(lastIndex).
743 2008-02-05 Sam Weinig <sam@webkit.org>
745 Reviewed by Anders Carlsson.
747 Fix for http://bugs.webkit.org/show_bug.cgi?id=8080
748 NodeList (and other DOM lists) items are not enumeratable using for..in
750 * JavaScriptCore.exp:
752 2008-02-05 Mark Rowe <mrowe@apple.com>
754 Reviewed by Oliver Hunt.
756 Update versioning to support the mysterious future.
758 * Configurations/Version.xcconfig: Add SYSTEM_VERSION_PREFIX_1060.
760 2008-02-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
762 Reviewed by Oliver Hunt.
764 Fixes Bug 16889: REGRESSION (r29425): Canvas-based graphing calculator fails to run
765 Bug 17015: REGRESSION (r29414-29428): www.fox.com "shows" menu fails to render
766 Bug 17164: REGRESSION: JavaScript pop-up menu appears at wrong location when hovering image at http://news.chinatimes.com/
768 <http://bugs.webkit.org/show_bug.cgi?id=16889>
769 <rdar://problem/5696255>
771 <http://bugs.webkit.org/show_bug.cgi?id=17015>
773 <http://bugs.webkit.org/show_bug.cgi?id=17164>
774 <rdar://problem/5720947>
776 The ActivationImp tear-off (r29425) introduced a problem with ReadModify
777 nodes that first resolve a slot, call valueForReadModifyNode(), and then
778 store a value in the previously resolved slot. Since valueForReadModifyNode()
779 may cause a tear-off, the slot needs to be resolved again, but this was
780 not happening with the existing code.
783 (KJS::ReadModifyLocalVarNode::evaluate):
784 (KJS::ReadModifyResolveNode::evaluate):
786 2008-02-04 Cameron McCormack <cam@mcc.id.au>
788 Reviewed by Geoff Garen.
790 Remove some unneccesary UNUSED_PARAMs. Clarify ownership rule of return value of JSObjectCopyPropertyNames.
793 (JSNode_appendChild):
794 (JSNode_removeChild):
795 (JSNode_replaceChild):
796 (JSNode_getNodeType):
797 (JSNode_getFirstChild):
802 2008-02-04 Rodney Dawes <dobey@wayofthemonkey.com>
804 Reviewed by Alp Toker and Mark Rowe.
806 Fix http://bugs.webkit.org/show_bug.cgi?id=17175.
807 Bug 17175: Use of C++ compiler flags in CFLAGS
809 * GNUmakefile.am: Use global_cxxflags as well as global_cflags in CXXFLAGS.
811 2008-02-04 Alp Toker <alp@atoker.com>
813 Rubber-stamped by Mark Rowe.
815 Remove all trailing whitespace in the GTK+ port and related
820 2008-02-02 Darin Adler <darin@apple.com>
822 Reviewed by Geoff Garen.
824 PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
825 slower due to r28884 (global variable symbol table optimization)
827 Geoff's theory is that the slowdown was due to copying hash tables when
828 putting things into the back/forward cache. If that's true, then this
829 should fix the problem.
831 (According to Geoff's measurements, in a PLT that exaggerates the
832 importance of symbol table saving during cached page creation, this
833 patch is a ~3X speedup in cached page creation, and a 9% speedup overall.)
835 * JavaScriptCore.exp: Updated.
837 * kjs/JSVariableObject.cpp:
838 (KJS::JSVariableObject::saveLocalStorage): Updated for changes to SavedProperty,
839 which has been revised to avoid initializing each SavedProperty twice when building
840 the array. Store the property names too, so we don't have to store the symbol table
841 separately. Do this by iterating the symbol table instead of the local storage vector.
842 (KJS::JSVariableObject::restoreLocalStorage): Ditto. Restore the symbol table as
843 well as the local storage vector.
845 * kjs/JSVariableObject.h: Removed save/restoreSymbolTable and do that work inside
846 save/restoreLocalStorage instead. Made restoreLocalStorage a non-const member function
847 that takes a const reference to a SavedProperties object.
849 * kjs/LocalStorage.h: Changed attributes to be unsigned instead of int to match
850 other declarations of attributes elsewhere.
852 * kjs/property_map.cpp:
853 (KJS::SavedProperties::SavedProperties): Updated for data member name change.
854 (KJS::PropertyMap::save): Updated for data member name change and to use the new
855 inline init function instead of setting the fields directly. This allows us to
856 skip initializing the SavedProperty objects when first allocating the array, and
857 just do it when we're actually setting up the individual elements.
858 (KJS::PropertyMap::restore): Updated for SavedProperty changes.
860 * kjs/property_map.h: Changed SavedProperty from a struct to a class. Set it up so
861 it does not get initialized at construction time to avoid initializing twice when
862 creating an array of SavedProperty. Removed the m_ prefixes from the members of
863 the SavedProperties struct. Generally we use m_ for class members and not struct.
865 2008-02-02 Tony Chang <idealisms@gmail.com>
867 Reviewed by darin. Landed by eseidel.
869 Add #define guards for WIN32_LEAN_AND_MEAN and _CRT_RAND_S.
872 * wtf/FastMalloc.cpp:
875 2008-01-28 Sam Weinig <sam@webkit.org>
877 Rubber-stamped by Darin Adler.
879 - Fix whitespace in nodes.h/cpp and nodes2string.cpp.
881 (NOTE: Specific changed functions elided for space and clarity)
884 * kjs/nodes2string.cpp:
886 2008-01-27 Sam Weinig <sam@webkit.org>
888 Reviewed by Oliver Hunt.
890 Patch for http://bugs.webkit.org/show_bug.cgi?id=17025
891 nodes.h/cpp has been rolling around in the mud - lets hose it down
893 - Rename member variables to use the m_ prefix.
895 (NOTE: Specific changed functions elided for space and clarity)
899 * kjs/nodes2string.cpp:
901 2008-01-27 Darin Adler <darin@apple.com>
905 - fix <rdar://problem/5657450> REGRESSION: const is broken
907 Test: fast/js/const.html
909 SunSpider said this was 0.3% slower. And I saw some Shark samples in
910 JSGlobalObject::put -- not a lot but a few. We may be able to regain the
911 speed, but for now we will take that small hit for correctness sake.
913 * kjs/JSGlobalObject.cpp:
914 (KJS::JSGlobalObject::put): Pass the checkReadOnly flag in to symbolTablePut
915 instead of passing attributes.
917 * kjs/JSVariableObject.h:
918 (KJS::JSVariableObject::symbolTablePut): Removed the code to set attributes
919 here, since we only set attributes when creating a property. Added the code
920 to check read-only here, since we need that to implement const!
923 (KJS::ActivationImp::put): Pass the checkReadOnly flag in to symbolTablePut
924 instead of passing attributes.
927 (KJS::isConstant): Added.
928 (KJS::PostIncResolveNode::optimizeVariableAccess): Create a PostIncConstNode
929 if optimizing for a local variable and the variable is constant.
930 (KJS::PostDecResolveNode::optimizeVariableAccess): Ditto. But PostDecConstNode.
931 (KJS::PreIncResolveNode::optimizeVariableAccess): Ditto. But PreIncConstNode.
932 (KJS::PreDecResolveNode::optimizeVariableAccess): Ditto. But PreDecConstNode.
933 (KJS::PreIncConstNode::evaluate): Return the value + 1.
934 (KJS::PreDecConstNode::evaluate): Return the value - 1.
935 (KJS::PostIncConstNode::evaluate): Return the value converted to a number.
936 (KJS::PostDecConstNode::evaluate): Ditto.
937 (KJS::ReadModifyResolveNode::optimizeVariableAccess): Create a ReadModifyConstNode
938 if optimizing for a local variable and the variable is constant.
939 (KJS::AssignResolveNode::optimizeVariableAccess): Ditto. But AssignConstNode.
940 (KJS::ScopeNode::optimizeVariableAccess): Pass the local storage to the
941 node optimizeVariableAccess functions, since that's where we need to look to
942 figure out if a variable is constant.
943 (KJS::FunctionBodyNode::processDeclarations): Moved the call to
944 optimizeVariableAccess until after localStorage is set up.
945 (KJS::ProgramNode::processDeclarations): Ditto.
947 * kjs/nodes.h: Fixed the IsConstant and HasInitializer values. They are used
948 as flag masks, so a value of 0 will not work for IsConstant. Changed the
949 first parameter to optimizeVariableAccess to be a const reference to a symbol
950 table and added a const reference to local storage. Added classes for const
951 versions of local variable access: PostIncConstNode, PostDecConstNode,
952 PreIncConstNode, PreDecConstNode, ReadModifyConstNode, and AssignConstNode.
955 (KJS::JSObject::put): Tweaked comments a bit, and changed the checkReadOnly
956 expression to match the form used at the two other call sites.
958 2008-01-27 Darin Adler <darin@apple.com>
962 - fix http://bugs.webkit.org/show_bug.cgi?id=16498
963 ''.constructor.toString() gives [function]
965 Test: fast/js/function-names.html
967 * kjs/array_object.cpp:
968 (KJS::ArrayObjectImp::ArrayObjectImp): Use the class name as the constructor's function name.
969 * kjs/bool_object.cpp:
970 (KJS::BooleanObjectImp::BooleanObjectImp): Ditto.
971 * kjs/date_object.cpp:
972 (KJS::DateObjectImp::DateObjectImp): Ditto.
973 * kjs/error_object.cpp:
974 (KJS::ErrorPrototype::ErrorPrototype): Make the error object be an Error.
975 (KJS::ErrorObjectImp::ErrorObjectImp): Use the class name as the constructor's function name.
976 (KJS::NativeErrorPrototype::NativeErrorPrototype): Take const UString&.
977 (KJS::NativeErrorImp::NativeErrorImp): Use the prototype's name as the constructor's function
979 * kjs/error_object.h: Change ErrorPrototype to inherit from ErrorInstance. Change the
980 NativeErrorImp constructor to take a NativeErrorPrototype pointer for its prototype.
981 * kjs/function.h: Removed unneeded constructor for internal functions without names.
982 We want to avoid those!
983 * kjs/function_object.cpp:
984 (KJS::functionProtoFuncToString): Removed code that writes out just [function] for functions
985 that have no names. There's no reason to do that.
986 (KJS::FunctionObjectImp::FunctionObjectImp): Use the class name as the constructor's
988 * kjs/internal.cpp: Removed the unused constructor.
989 * kjs/number_object.cpp:
990 (KJS::fractionalPartToString): Marked static for internal linkage.
991 (KJS::exponentialPartToString): Ditto.
992 (KJS::numberProtoFuncToPrecision): Removed an unneeded else.
993 (KJS::NumberObjectImp::NumberObjectImp): Use the class name as the constructor's
995 (KJS::NumberObjectImp::getValueProperty): Tweaked formatting.
996 * kjs/object_object.cpp:
997 (KJS::ObjectObjectImp::ObjectObjectImp): Use "Object" for the function name.
998 * kjs/regexp_object.cpp:
999 (KJS::RegExpObjectImp::RegExpObjectImp): Use "RegExp" for the function name.
1000 * kjs/string_object.cpp:
1001 (KJS::StringObjectImp::StringObjectImp): Use the class name as the constructor's
1004 2008-01-26 Darin Adler <darin@apple.com>
1008 - fix http://bugs.webkit.org/show_bug.cgi?id=17027
1009 Incorrect Function.toString behaviour with read/modify/write operators performed on negative numbers
1011 Test: fast/js/function-toString-parentheses.html
1013 The problem here was that a NumberNode with a negative number in it had the wrong
1014 precedence. It's not a primary expression, it's a unary operator with a primary
1015 expression after it.
1017 Once the precedence of NumberNode was fixed, the cases from bug 17020 were also
1018 fixed without trying to treat bracket nodes like dot nodes. That wasn't needed.
1019 The reason we handle numbers before dot nodes specially is that the dot is a
1020 legal character in a number. The same is not true of a bracket. Eventually we
1021 could get smarter, and only add the parentheses when there is actual ambiguity.
1022 There is none if the string form of the number already has a dot in it, or if
1023 it's a number with a alphabetic name like infinity or NAN.
1025 * kjs/nodes.h: Renamed back from ObjectAccess to DotExpr.
1026 (KJS::NumberNode::precedence): Return PrecUnary for negative numbers, since
1027 they serialize as a unary operator, not a primary expression.
1028 * kjs/nodes2string.cpp:
1029 (KJS::SourceStream::operator<<): Clear m_numberNeedsParens if this adds
1030 parens; one set is enough.
1031 (KJS::bracketNodeStreamTo): Remove unneeded special flag here. Normal
1032 operator precedence suffices.
1033 (KJS::NewExprNode::streamTo): Ditto.
1035 2008-01-26 Oliver Hunt <oliver@apple.com>
1037 Reviewed by Maciej and Darin.
1039 Fix for http://bugs.webkit.org/show_bug.cgi?id=17020
1040 Function.toString does not parenthesise numbers for the bracket accessor
1042 It turns out that logic was there for all of the dot accessor nodes to make numbers be
1043 parenthesised properly, so it was a trivial extension to extend that to the bracket nodes.
1044 I renamed the enum type to reflect the fact that it is now used for both dot and bracket
1047 * kjs/nodes2string.cpp:
1048 (KJS::bracketNodeStreamTo):
1049 (KJS::BracketAccessorNode::streamTo):
1051 2008-01-26 Oliver Hunt <oliver@apple.com>
1055 Fix Bug 17018: Incorrect code generated from Function.toString for get/setters in object literals
1057 Don't quote getter and setter names during output, as that is simply wrong.
1059 * kjs/nodes2string.cpp:
1060 (KJS::PropertyNode::streamTo):
1062 2008-01-26 Darin Adler <darin@apple.com>
1064 Reviewed by Eric Seidel.
1066 - http://bugs.webkit.org/show_bug.cgi?id=16860
1067 a bit of cleanup after the Activation optimization
1069 * JavaScriptCore.exp: Export the GlobalExecState constructor instead of
1070 the global flavor of the ExecState constructor. It'd probably be cleaner
1071 to not export either one, but JSGlobalObject inlines the code that
1072 constructs the ExecState. If we changed that, we could remove this export.
1074 * JavaScriptCore.xcodeproj/project.pbxproj: Re-sorted a few things and
1075 put the new source files into the kjs group rather than at the top level.
1077 * kjs/ExecState.cpp:
1078 (KJS::ExecState::ExecState): Marked inline and updated for data member
1079 name changes. This is now only for use for the derived classes. Also removed
1080 code that sets the unused m_savedExec data member for the global case. That
1081 data member is only used for the other two types.
1082 (KJS::ExecState::~ExecState): Marked inline and removed all the code.
1083 The derived class destructors now inclde the appropriate code.
1084 (KJS::ExecState::lexicalGlobalObject): Removed unneeded special case for
1085 an empty scope chain. The bottom function already returns 0 for that case,
1086 so the general case code handles it fine. Also changed to use data members
1087 directly rather than calling functions.
1088 (KJS::GlobalExecState::GlobalExecState): Added. Calls through to the base
1090 (KJS::GlobalExecState::~GlobalExecState): Added.
1091 (KJS::InterpreterExecState::InterpreterExecState): Added. Moved code to
1092 manipulate activeExecStates here since we don't want to have to check for the
1093 special case of globalExec.
1094 (KJS::InterpreterExecState::~InterpreterExecState): Added.
1095 (KJS::EvalExecState::EvalExecState): Added.
1096 (KJS::EvalExecState::~EvalExecState): Added.
1097 (KJS::FunctionExecState::FunctionExecState): Added.
1098 (KJS::FunctionExecState::~FunctionExecState): Added.
1100 * kjs/ExecState.h: Tweaked the header, includes, and declarations a bit.
1101 Made ExecState inherit from Noncopyable. Reformatted some comments and
1102 made them a bit more brief. Rearranged declarations a little bit and removed
1103 unused savedExec function. Changed seenLabels function to return a reference
1104 rather than a pointer. Made constructors and destructor protected, and also
1105 did the same with all data members. Renamed m_thisVal to m_thisValue and
1106 ls to m_labelStack. Added three new derived classes for each of the
1107 types of ExecState. The primary goal here was to remove a branch from the
1108 code in the destructor, but it's also clearer than overloading the arguments
1109 to the ExecState constructor.
1111 * kjs/JSGlobalObject.cpp:
1112 (KJS::getCurrentTime): Fixed formatting.
1113 (KJS::JSGlobalObject::pushActivation): Removed parentheses that don't make
1114 the expression clearer -- other similar sites didn't have these parentheses,
1115 even the one a couple lines earlier that sets stackEntry.
1116 (KJS::JSGlobalObject::tearOffActivation): Got rid of unneeded static_cast
1117 (I think I mentioned this during patch review) and used an early exit so that
1118 the entire contents of the function aren't nested inside an if statement.
1119 Also removed the check of codeType, instead checking Activation for 0.
1120 For now, I kept the codeType check, but inside an assertion.
1122 * kjs/JSGlobalObject.h: Changed type of globalExec to GlobalExecState.
1124 (KJS::FunctionImp::callAsFunction): Changed type to FunctionExecState.
1125 (KJS::GlobalFuncImp::callAsFunction): Changed type to EvalExecState.
1126 * kjs/interpreter.cpp:
1127 (KJS::Interpreter::evaluate): Changed type to GlobalExecState.
1130 (KJS::ContinueNode::execute): Changed code since seenLabels() returns a
1131 reference now instead of a pointer.
1132 (KJS::BreakNode::execute): Ditto.
1133 (KJS::LabelNode::execute): Ditto.
1135 2008-01-26 Sam Weinig <sam@webkit.org>
1137 Reviewed by Mark Rowe.
1139 Cleanup node2string a little.
1140 - Remove some unnecessary branching.
1141 - Factor out bracket and dot streaming into static inline functions.
1144 * kjs/nodes2string.cpp:
1145 (KJS::bracketNodeStreamTo):
1146 (KJS::dotNodeStreamTo):
1147 (KJS::FunctionCallBracketNode::streamTo):
1148 (KJS::FunctionCallDotNode::streamTo):
1149 (KJS::PostIncBracketNode::streamTo):
1150 (KJS::PostDecBracketNode::streamTo):
1151 (KJS::PostIncDotNode::streamTo):
1152 (KJS::PostDecDotNode::streamTo):
1153 (KJS::DeleteBracketNode::streamTo):
1154 (KJS::DeleteDotNode::streamTo):
1155 (KJS::PreIncBracketNode::streamTo):
1156 (KJS::PreDecBracketNode::streamTo):
1157 (KJS::PreIncDotNode::streamTo):
1158 (KJS::PreDecDotNode::streamTo):
1159 (KJS::ReadModifyBracketNode::streamTo):
1160 (KJS::AssignBracketNode::streamTo):
1161 (KJS::ReadModifyDotNode::streamTo):
1162 (KJS::AssignDotNode::streamTo):
1163 (KJS::WhileNode::streamTo):
1165 2008-01-26 Mark Rowe <mrowe@apple.com>
1167 Reviewed by Darin Adler.
1169 Fix http://bugs.webkit.org/show_bug.cgi?id=17001
1170 Bug 17001: Build error with Gtk port on Mac OS X
1172 If both XP_MACOSX and XP_UNIX are defined then X11.h and Carbon.h will both be included.
1173 These provide conflicting definitions for a type named 'Cursor'. As XP_UNIX is set by
1174 the build system when targeting X11, it doesn't make sense for XP_MACOSX to also be set
1177 * bindings/npapi.h: Don't define XP_MACOSX if XP_UNIX is defined.
1179 2008-01-26 Darin Adler <darin@apple.com>
1183 - fix http://bugs.webkit.org/show_bug.cgi?id=17013
1184 JSC can't round trip certain for-loops
1186 Test: fast/js/toString-for-var-decl.html
1188 * kjs/nodes.h: Added PlaceholderTrueNode so we can put nodes into
1189 for loops without injecting the word "true" into them (nice, but not
1190 the bug fix). Fixed ForNode constructor so expr1WasVarDecl is set
1191 only when there is an expression, since it's common for the actual
1192 variable declaration to be moved by the parser.
1194 * kjs/nodes2string.cpp:
1195 (KJS::PlaceholderTrueNode::streamTo): Added. Empty.
1197 2008-01-25 Oliver Hunt <oliver@apple.com>
1201 Fix for bug 17012: REGRESSION: JSC can't round trip an object literal
1203 Add logic to ensure that object literals and function expressions get
1204 parentheses when necessary.
1207 * kjs/nodes2string.cpp:
1208 (KJS::SourceStream::operator<<):
1210 2008-01-24 Steve Falkenburg <sfalken@apple.com>
1214 * JavaScriptCore.vcproj/JavaScriptCore.sln:
1216 2008-01-24 Steve Falkenburg <sfalken@apple.com>
1220 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
1222 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
1226 Fix QDateTime to JS Date conversion.
1227 Several conversion errors (some UTC related, some month
1228 offset related) and the conversion distance for Date
1229 to DateTime conversion weights were fixed (it should never
1230 be better to convert a JS Number into a Date rather than
1233 * bindings/qt/qt_runtime.cpp:
1234 (KJS::Bindings::convertValueToQVariant):
1235 (KJS::Bindings::convertQVariantToValue):
1237 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
1241 Add support for calling QObjects.
1242 Add support for invokeDefaultMethod (via a call to
1243 a specific slot), and also allow using it as a
1244 constructor, like QtScript.
1247 * bindings/qt/qt_class.cpp:
1248 (KJS::Bindings::QtClass::fallbackObject):
1249 * bindings/qt/qt_instance.cpp:
1250 (KJS::Bindings::QtRuntimeObjectImp::construct):
1251 (KJS::Bindings::QtInstance::QtInstance):
1252 (KJS::Bindings::QtInstance::~QtInstance):
1253 (KJS::Bindings::QtInstance::implementsCall):
1254 (KJS::Bindings::QtInstance::invokeDefaultMethod):
1255 * bindings/qt/qt_instance.h:
1256 * bindings/qt/qt_runtime.cpp:
1257 (KJS::Bindings::findMethodIndex):
1258 (KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
1259 (KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
1260 * bindings/qt/qt_runtime.h:
1262 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
1266 Code style cleanups.
1267 Add spaces before/after braces in inline function.
1269 * bindings/qt/qt_instance.h:
1271 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
1275 Code style cleanups.
1276 Remove spaces and unneeded declared parameter names.
1278 * bindings/qt/qt_instance.cpp:
1279 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
1281 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
1285 Clear stale RuntimeObjectImps.
1286 Since other objects can have refs to the QtInstance,
1287 we can't rely on the QtInstance being deleted when the
1288 RuntimeObjectImp is invalidate or deleted. This
1289 could result in a stale JSObject being returned for
1292 * bindings/qt/qt_instance.cpp:
1293 (KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
1294 (KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
1295 (KJS::Bindings::QtRuntimeObjectImp::invalidate):
1296 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
1297 (KJS::Bindings::QtInstance::getRuntimeObject):
1298 * bindings/runtime.cpp:
1299 (KJS::Bindings::Instance::createRuntimeObject):
1300 * bindings/runtime.h:
1302 2008-01-23 Alp Toker <alp@atoker.com>
1304 Rubber-stamped by Mark Rowe.
1306 Remove whitespace after -I in automake include lists.
1310 2008-01-23 Michael Goddard <michael.goddard@trolltech.com>
1312 Reviewed by Lars Knoll <lars@trolltech.com>.
1314 Reworked the JavaScriptCore Qt bindings:
1316 * Add initial support for string and variant arrays, as well
1317 as sub QObjects in the JS bindings.
1319 * Don't expose fields marked as not scriptable by moc.
1321 * Add support for dynamic properties and accessing named
1322 QObject children of an object (like QtScript and older
1324 * Add support for custom toString methods.
1326 * Fine tune some bindings to be closer to QtScript.
1327 Make void functions return undefined, and empty/
1328 null QStrings return a zero length string.
1330 * Create framework for allowing more direct method calls.
1331 Since RuntimeMethod doesn't allow us to add additional
1332 methods/properties to a function, add these classes.
1333 Start prototyping object.signal.connect(...).
1335 * Add signal support to the Qt bindings.
1336 Allow connecting to signals (object.signal.connect(slot)),
1337 disconnecting, and emitting signals. Currently chooses
1338 the first signal that matches the name, so this will need
1341 * Add property names, and resolve signals closer to use.
1342 Enumerating properties now returns some of the Qt properties
1343 and signals. Slots and methods aren't quite present. Also,
1344 resolve signal connections etc. closer to the time of use, so
1345 we can do more dynamic resolution based on argument type etc.
1346 Still picks the first one with the same name, at the moment.
1348 * Make signature comparison code consistent.
1349 Use the same code for checking meta signatures in
1350 the method and fallback getters, and avoid a
1351 QByteArray construction when we can.
1353 * Fix minor memory leak, and handle pointers better.
1354 Delete the private object in the dtors, and use RefPtrs
1355 for holding Instances etc.
1357 * Handle method lookup better.
1358 Allow invocation time method lookup based on the arguments,
1359 which is closer to QtScript behaviour. Also, cache the
1360 method lists and delete them in the QtClass dtor (stops
1363 * Improve JS to Qt data type conversions.
1364 Add some support for Date & RegExp JS objects,
1365 and provide some metrics on the quality of the
1368 * A couple of fixes for autotest failures.
1369 Better support for converting lists, read/write only
1370 QMetaProperty support, modified slot search order...)
1372 * bindings/qt/qt_class.cpp:
1373 (KJS::Bindings::QtClass::QtClass):
1374 (KJS::Bindings::QtClass::~QtClass):
1375 (KJS::Bindings::QtClass::name):
1376 (KJS::Bindings::QtClass::fallbackObject):
1377 (KJS::Bindings::QtClass::methodsNamed):
1378 (KJS::Bindings::QtClass::fieldNamed):
1379 * bindings/qt/qt_class.h:
1380 * bindings/qt/qt_instance.cpp:
1381 (KJS::Bindings::QtInstance::QtInstance):
1382 (KJS::Bindings::QtInstance::~QtInstance):
1383 (KJS::Bindings::QtInstance::getRuntimeObject):
1384 (KJS::Bindings::QtInstance::getClass):
1385 (KJS::Bindings::QtInstance::implementsCall):
1386 (KJS::Bindings::QtInstance::getPropertyNames):
1387 (KJS::Bindings::QtInstance::invokeMethod):
1388 (KJS::Bindings::QtInstance::invokeDefaultMethod):
1389 (KJS::Bindings::QtInstance::stringValue):
1390 (KJS::Bindings::QtInstance::booleanValue):
1391 (KJS::Bindings::QtInstance::valueOf):
1392 (KJS::Bindings::QtField::name):
1393 (KJS::Bindings::QtField::valueFromInstance):
1394 (KJS::Bindings::QtField::setValueToInstance):
1395 * bindings/qt/qt_instance.h:
1396 (KJS::Bindings::QtInstance::getBindingLanguage):
1397 (KJS::Bindings::QtInstance::getObject):
1398 * bindings/qt/qt_runtime.cpp:
1399 (KJS::Bindings::QWKNoDebug::QWKNoDebug):
1400 (KJS::Bindings::QWKNoDebug::~QWKNoDebug):
1401 (KJS::Bindings::QWKNoDebug::operator<<):
1403 (KJS::Bindings::valueRealType):
1404 (KJS::Bindings::convertValueToQVariant):
1405 (KJS::Bindings::convertQVariantToValue):
1406 (KJS::Bindings::QtRuntimeMethod::QtRuntimeMethod):
1407 (KJS::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
1408 (KJS::Bindings::QtRuntimeMethod::codeType):
1409 (KJS::Bindings::QtRuntimeMethod::execute):
1410 (KJS::Bindings::QtRuntimeMethodData::~QtRuntimeMethodData):
1411 (KJS::Bindings::QtRuntimeMetaMethodData::~QtRuntimeMetaMethodData):
1412 (KJS::Bindings::QtRuntimeConnectionMethodData::~QtRuntimeConnectionMethodData):
1413 (KJS::Bindings::QtMethodMatchType::):
1414 (KJS::Bindings::QtMethodMatchType::QtMethodMatchType):
1415 (KJS::Bindings::QtMethodMatchType::kind):
1416 (KJS::Bindings::QtMethodMatchType::isValid):
1417 (KJS::Bindings::QtMethodMatchType::isVariant):
1418 (KJS::Bindings::QtMethodMatchType::isMetaType):
1419 (KJS::Bindings::QtMethodMatchType::isUnresolved):
1420 (KJS::Bindings::QtMethodMatchType::isMetaEnum):
1421 (KJS::Bindings::QtMethodMatchType::enumeratorIndex):
1422 (KJS::Bindings::QtMethodMatchType::variant):
1423 (KJS::Bindings::QtMethodMatchType::metaType):
1424 (KJS::Bindings::QtMethodMatchType::metaEnum):
1425 (KJS::Bindings::QtMethodMatchType::unresolved):
1426 (KJS::Bindings::QtMethodMatchType::typeId):
1427 (KJS::Bindings::QtMethodMatchType::name):
1428 (KJS::Bindings::QtMethodMatchData::QtMethodMatchData):
1429 (KJS::Bindings::QtMethodMatchData::isValid):
1430 (KJS::Bindings::QtMethodMatchData::firstUnresolvedIndex):
1431 (KJS::Bindings::indexOfMetaEnum):
1432 (KJS::Bindings::findMethodIndex):
1433 (KJS::Bindings::findSignalIndex):
1434 (KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
1435 (KJS::Bindings::QtRuntimeMetaMethod::mark):
1436 (KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
1437 (KJS::Bindings::QtRuntimeMetaMethod::getOwnPropertySlot):
1438 (KJS::Bindings::QtRuntimeMetaMethod::lengthGetter):
1439 (KJS::Bindings::QtRuntimeMetaMethod::connectGetter):
1440 (KJS::Bindings::QtRuntimeMetaMethod::disconnectGetter):
1441 (KJS::Bindings::QtRuntimeConnectionMethod::QtRuntimeConnectionMethod):
1442 (KJS::Bindings::QtRuntimeConnectionMethod::callAsFunction):
1443 (KJS::Bindings::QtRuntimeConnectionMethod::getOwnPropertySlot):
1444 (KJS::Bindings::QtRuntimeConnectionMethod::lengthGetter):
1445 (KJS::Bindings::QtConnectionObject::QtConnectionObject):
1446 (KJS::Bindings::QtConnectionObject::~QtConnectionObject):
1447 (KJS::Bindings::QtConnectionObject::metaObject):
1448 (KJS::Bindings::QtConnectionObject::qt_metacast):
1449 (KJS::Bindings::QtConnectionObject::qt_metacall):
1450 (KJS::Bindings::QtConnectionObject::execute):
1451 (KJS::Bindings::QtConnectionObject::match):
1452 (KJS::Bindings::::QtArray):
1453 (KJS::Bindings::::~QtArray):
1454 (KJS::Bindings::::rootObject):
1455 (KJS::Bindings::::setValueAt):
1456 (KJS::Bindings::::valueAt):
1457 * bindings/qt/qt_runtime.h:
1458 (KJS::Bindings::QtField::):
1459 (KJS::Bindings::QtField::QtField):
1460 (KJS::Bindings::QtField::fieldType):
1461 (KJS::Bindings::QtMethod::QtMethod):
1462 (KJS::Bindings::QtMethod::name):
1463 (KJS::Bindings::QtMethod::numParameters):
1464 (KJS::Bindings::QtArray::getLength):
1465 (KJS::Bindings::QtRuntimeMethod::d_func):
1466 (KJS::Bindings::QtRuntimeMetaMethod::d_func):
1467 (KJS::Bindings::QtRuntimeConnectionMethod::d_func):
1469 * bindings/runtime.cpp:
1470 (KJS::Bindings::Instance::createBindingForLanguageInstance):
1471 (KJS::Bindings::Instance::createRuntimeObject):
1472 (KJS::Bindings::Instance::reallyCreateRuntimeObject):
1473 * bindings/runtime.h:
1475 2008-01-22 Anders Carlsson <andersca@apple.com>
1477 Reviewed by Darin and Adam.
1479 <rdar://problem/5688975>
1480 div element on microsoft site has wrong left offset.
1482 Return true even if NPN_GetProperty returns null or undefined. This matches Firefox
1483 (and is what the Silverlight plug-in expects).
1485 * bindings/NP_jsobject.cpp:
1488 2008-01-21 Geoffrey Garen <ggaren@apple.com>
1490 Reviewed by Maciej Stachowiak.
1492 Fixed http://bugs.webkit.org/show_bug.cgi?id=16909
1493 REGRESSION: Amazon.com crash (ActivationImp)
1495 (and a bunch of other crashes)
1497 Plus, a .7% SunSpider speedup to boot.
1499 Replaced the buggy currentExec and savedExec mechanisms with an
1500 explicit ExecState stack.
1502 * kjs/collector.cpp:
1503 (KJS::Collector::collect): Explicitly mark the ExecState stack.
1505 (KJS::Collector::reportOutOfMemoryToAllExecStates): Slight change in
1506 behavior: We no longer throw an exception in any global ExecStates,
1507 since global ExecStates are more like pseudo-ExecStates, and aren't
1508 used for script execution. (It's unclear what would happen if you left
1509 an exception waiting around in a global ExecState, but it probably
1512 2008-01-21 Jan Michael Alonzo <jmalonzo@unpluggable.com>
1514 Reviewed by Alp Toker.
1516 http://bugs.webkit.org/show_bug.cgi?id=16955
1517 Get errors when cross-compile webkit-gtk
1519 * GNUmakefile.am: removed ICU_CFLAGS
1521 2008-01-18 Kevin McCullough <kmccullough@apple.com>
1527 2008-01-18 Kevin McCullough <kmccullough@apple.com>
1533 (KJS::UString::cost):
1535 2008-01-18 Kevin McCullough <kmccullough@apple.com>
1539 - Correctly report cost of appended strings to trigger GC.
1543 (KJS::UString::Rep::create):
1544 (KJS::UString::UString): Don't create unnecssary objects.
1545 (KJS::UString::cost): Report cost if necessary but also keep track of
1549 2008-01-18 Simon Hausmann <hausmann@webkit.org>
1553 Fix return type conversions from Qt slots to JS values.
1555 This also fixes fast/dom/open-and-close-by-DOM.html, which called
1556 layoutTestController.windowCount().
1558 When constructing the QVariant that holds the return type we cannot
1559 use the QVarian(Type) constuctor as that will create a null variant.
1560 We have to use the QVariant(Type, void *) constructor instead, just
1561 like in QMetaObject::read() for example.
1564 * bindings/qt/qt_instance.cpp:
1565 (KJS::Bindings::QtInstance::getRuntimeObject):
1567 2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
1569 Reviewed by Simon Hausmann <hausmann@webkit.org>.
1571 Fix compilation on Win64(2): Implemented currentThreadStackBase on X86-64 on Windows
1574 * kjs/collector.cpp:
1575 (KJS::Collector::heapAllocate):
1577 2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
1579 Reviewed by Simon Hausmann <hausmann@webkit.org>.
1581 Fix compilation on Win64(1): Define WTF_PLATFORM_X86_64 correctly on Win64.
1586 2008-01-17 Antti Koivisto <antti@apple.com>
1590 * kjs/regexp_object.cpp:
1591 (KJS::regExpProtoFuncToString):
1593 2008-01-16 Sam Weinig <sam@webkit.org>
1597 Fix for http://bugs.webkit.org/show_bug.cgi?id=16901
1598 Convert remaining JS function objects to use the new PrototypeFunction class
1600 - Moves Boolean, Function, RegExp, Number, Object and Global functions to their
1601 own static function implementations so that they can be used with the
1602 PrototypeFunction class. SunSpider says this is 1.003x as fast.
1604 * kjs/JSGlobalObject.cpp:
1605 (KJS::JSGlobalObject::reset):
1606 * kjs/array_object.h:
1607 * kjs/bool_object.cpp:
1608 (KJS::BooleanInstance::BooleanInstance):
1609 (KJS::BooleanPrototype::BooleanPrototype):
1610 (KJS::booleanProtoFuncToString):
1611 (KJS::booleanProtoFuncValueOf):
1612 (KJS::BooleanObjectImp::BooleanObjectImp):
1613 (KJS::BooleanObjectImp::implementsConstruct):
1614 (KJS::BooleanObjectImp::construct):
1615 (KJS::BooleanObjectImp::callAsFunction):
1616 * kjs/bool_object.h:
1617 (KJS::BooleanInstance::classInfo):
1618 * kjs/error_object.cpp:
1619 (KJS::ErrorPrototype::ErrorPrototype):
1620 (KJS::errorProtoFuncToString):
1621 * kjs/error_object.h:
1623 (KJS::globalFuncEval):
1624 (KJS::globalFuncParseInt):
1625 (KJS::globalFuncParseFloat):
1626 (KJS::globalFuncIsNaN):
1627 (KJS::globalFuncIsFinite):
1628 (KJS::globalFuncDecodeURI):
1629 (KJS::globalFuncDecodeURIComponent):
1630 (KJS::globalFuncEncodeURI):
1631 (KJS::globalFuncEncodeURIComponent):
1632 (KJS::globalFuncEscape):
1633 (KJS::globalFuncUnEscape):
1634 (KJS::globalFuncKJSPrint):
1635 (KJS::PrototypeFunction::PrototypeFunction):
1637 * kjs/function_object.cpp:
1638 (KJS::FunctionPrototype::FunctionPrototype):
1639 (KJS::functionProtoFuncToString):
1640 (KJS::functionProtoFuncApply):
1641 (KJS::functionProtoFuncCall):
1642 * kjs/function_object.h:
1643 * kjs/number_object.cpp:
1644 (KJS::NumberPrototype::NumberPrototype):
1645 (KJS::numberProtoFuncToString):
1646 (KJS::numberProtoFuncToLocaleString):
1647 (KJS::numberProtoFuncValueOf):
1648 (KJS::numberProtoFuncToFixed):
1649 (KJS::numberProtoFuncToExponential):
1650 (KJS::numberProtoFuncToPrecision):
1651 * kjs/number_object.h:
1652 (KJS::NumberInstance::classInfo):
1653 (KJS::NumberObjectImp::classInfo):
1654 (KJS::NumberObjectImp::):
1655 * kjs/object_object.cpp:
1656 (KJS::ObjectPrototype::ObjectPrototype):
1657 (KJS::objectProtoFuncValueOf):
1658 (KJS::objectProtoFuncHasOwnProperty):
1659 (KJS::objectProtoFuncIsPrototypeOf):
1660 (KJS::objectProtoFuncDefineGetter):
1661 (KJS::objectProtoFuncDefineSetter):
1662 (KJS::objectProtoFuncLookupGetter):
1663 (KJS::objectProtoFuncLookupSetter):
1664 (KJS::objectProtoFuncPropertyIsEnumerable):
1665 (KJS::objectProtoFuncToLocaleString):
1666 (KJS::objectProtoFuncToString):
1667 * kjs/object_object.h:
1668 * kjs/regexp_object.cpp:
1669 (KJS::RegExpPrototype::RegExpPrototype):
1670 (KJS::regExpProtoFuncTest):
1671 (KJS::regExpProtoFuncExec):
1672 (KJS::regExpProtoFuncCompile):
1673 (KJS::regExpProtoFuncToString):
1674 * kjs/regexp_object.h:
1676 2008-01-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1678 Reviewed by Maciej & Darin.
1680 Fixes Bug 16868: Gmail crash
1681 and Bug 16871: Crash when loading apple.com/startpage
1683 <http://bugs.webkit.org/show_bug.cgi?id=16868>
1684 <rdar://problem/5686108>
1686 <http://bugs.webkit.org/show_bug.cgi?id=16871>
1687 <rdar://problem/5686670>
1689 Adds ActivationImp tear-off for cross-window eval() and fixes an
1690 existing garbage collection issue exposed by the ActivationImp tear-off
1691 patch (r29425) that can occur when an ExecState's m_callingExec is
1692 different than its m_savedExec.
1694 * kjs/ExecState.cpp:
1695 (KJS::ExecState::mark):
1697 (KJS::GlobalFuncImp::callAsFunction):
1699 2008-01-16 Sam Weinig <sam@webkit.org>
1703 Clean up MathObjectImp, it needed a little scrubbing.
1705 * kjs/math_object.cpp:
1706 (KJS::MathObjectImp::MathObjectImp):
1707 (KJS::MathObjectImp::getOwnPropertySlot):
1708 (KJS::MathObjectImp::getValueProperty):
1709 (KJS::mathProtoFuncACos):
1710 (KJS::mathProtoFuncASin):
1711 (KJS::mathProtoFuncATan):
1712 (KJS::mathProtoFuncATan2):
1713 (KJS::mathProtoFuncCos):
1714 (KJS::mathProtoFuncExp):
1715 (KJS::mathProtoFuncLog):
1716 (KJS::mathProtoFuncSin):
1717 (KJS::mathProtoFuncSqrt):
1718 (KJS::mathProtoFuncTan):
1719 * kjs/math_object.h:
1720 (KJS::MathObjectImp::classInfo):
1721 (KJS::MathObjectImp::):
1723 2008-01-16 Sam Weinig <sam@webkit.org>
1725 Reviewed by Geoffrey Garen.
1727 Rename Lexer variable bol to atLineStart.
1730 (KJS::Lexer::Lexer):
1731 (KJS::Lexer::setCode):
1732 (KJS::Lexer::nextLine):
1736 2008-01-16 Sam Weinig <sam@webkit.org>
1738 Reviewed by Geoffrey Garen and Anders Carlsson.
1740 Remove uses of KJS_PURE_ECMA as we don't ever build with it defined,
1741 and we have many features that are not included in the ECMA spec.
1744 (KJS::Lexer::Lexer):
1745 (KJS::Lexer::setCode):
1746 (KJS::Lexer::nextLine):
1749 * kjs/string_object.cpp:
1750 * kjs/string_object.h:
1752 2008-01-15 Sam Weinig <sam@webkit.org>
1754 Reviewed by Geoffrey Garen.
1756 Fix <rdar://problem/5595552> r27608 introduced a 20% increase in JS binary size, 4% increase in WebCore binary size
1758 - This changes the way JS functions that use Lookup tables are handled. Instead of using
1759 one class per function, which allowed specialization of the virtual callAsFunction
1760 method, we now use one class, PrototypeFunction, which takes a pointer to a static
1761 function to use as the implementation. This significantly decreases the binary size
1762 of JavaScriptCore (about 145k on an Intel only build) while still keeping some of the
1763 speedup r27608 garnered (SunSpider says this is 1.005x as slow, which should leave some
1764 wiggle room from the original 1% speedup) and keeps the functions implementations in separate
1765 functions to help with optimizations.
1767 * JavaScriptCore.exp:
1768 * JavaScriptCore.xcodeproj/project.pbxproj:
1769 * kjs/array_object.cpp:
1770 (KJS::arrayProtoFuncToString):
1771 (KJS::arrayProtoFuncToLocaleString):
1772 (KJS::arrayProtoFuncJoin):
1773 (KJS::arrayProtoFuncConcat):
1774 (KJS::arrayProtoFuncPop):
1775 (KJS::arrayProtoFuncPush):
1776 (KJS::arrayProtoFuncReverse):
1777 (KJS::arrayProtoFuncShift):
1778 (KJS::arrayProtoFuncSlice):
1779 (KJS::arrayProtoFuncSort):
1780 (KJS::arrayProtoFuncSplice):
1781 (KJS::arrayProtoFuncUnShift):
1782 (KJS::arrayProtoFuncFilter):
1783 (KJS::arrayProtoFuncMap):
1784 (KJS::arrayProtoFuncEvery):
1785 (KJS::arrayProtoFuncForEach):
1786 (KJS::arrayProtoFuncSome):
1787 (KJS::arrayProtoFuncIndexOf):
1788 (KJS::arrayProtoFuncLastIndexOf):
1789 * kjs/array_object.h:
1790 * kjs/date_object.cpp:
1791 (KJS::DatePrototype::getOwnPropertySlot):
1792 (KJS::dateProtoFuncToString):
1793 (KJS::dateProtoFuncToUTCString):
1794 (KJS::dateProtoFuncToDateString):
1795 (KJS::dateProtoFuncToTimeString):
1796 (KJS::dateProtoFuncToLocaleString):
1797 (KJS::dateProtoFuncToLocaleDateString):
1798 (KJS::dateProtoFuncToLocaleTimeString):
1799 (KJS::dateProtoFuncValueOf):
1800 (KJS::dateProtoFuncGetTime):
1801 (KJS::dateProtoFuncGetFullYear):
1802 (KJS::dateProtoFuncGetUTCFullYear):
1803 (KJS::dateProtoFuncToGMTString):
1804 (KJS::dateProtoFuncGetMonth):
1805 (KJS::dateProtoFuncGetUTCMonth):
1806 (KJS::dateProtoFuncGetDate):
1807 (KJS::dateProtoFuncGetUTCDate):
1808 (KJS::dateProtoFuncGetDay):
1809 (KJS::dateProtoFuncGetUTCDay):
1810 (KJS::dateProtoFuncGetHours):
1811 (KJS::dateProtoFuncGetUTCHours):
1812 (KJS::dateProtoFuncGetMinutes):
1813 (KJS::dateProtoFuncGetUTCMinutes):
1814 (KJS::dateProtoFuncGetSeconds):
1815 (KJS::dateProtoFuncGetUTCSeconds):
1816 (KJS::dateProtoFuncGetMilliSeconds):
1817 (KJS::dateProtoFuncGetUTCMilliseconds):
1818 (KJS::dateProtoFuncGetTimezoneOffset):
1819 (KJS::dateProtoFuncSetTime):
1820 (KJS::dateProtoFuncSetMilliSeconds):
1821 (KJS::dateProtoFuncSetUTCMilliseconds):
1822 (KJS::dateProtoFuncSetSeconds):
1823 (KJS::dateProtoFuncSetUTCSeconds):
1824 (KJS::dateProtoFuncSetMinutes):
1825 (KJS::dateProtoFuncSetUTCMinutes):
1826 (KJS::dateProtoFuncSetHours):
1827 (KJS::dateProtoFuncSetUTCHours):
1828 (KJS::dateProtoFuncSetDate):
1829 (KJS::dateProtoFuncSetUTCDate):
1830 (KJS::dateProtoFuncSetMonth):
1831 (KJS::dateProtoFuncSetUTCMonth):
1832 (KJS::dateProtoFuncSetFullYear):
1833 (KJS::dateProtoFuncSetUTCFullYear):
1834 (KJS::dateProtoFuncSetYear):
1835 (KJS::dateProtoFuncGetYear):
1836 * kjs/date_object.h:
1838 (KJS::PrototypeFunction::PrototypeFunction):
1839 (KJS::PrototypeFunction::callAsFunction):
1843 (KJS::staticFunctionGetter):
1844 * kjs/math_object.cpp:
1845 (KJS::mathProtoFuncAbs):
1846 (KJS::mathProtoFuncACos):
1847 (KJS::mathProtoFuncASin):
1848 (KJS::mathProtoFuncATan):
1849 (KJS::mathProtoFuncATan2):
1850 (KJS::mathProtoFuncCeil):
1851 (KJS::mathProtoFuncCos):
1852 (KJS::mathProtoFuncExp):
1853 (KJS::mathProtoFuncFloor):
1854 (KJS::mathProtoFuncLog):
1855 (KJS::mathProtoFuncMax):
1856 (KJS::mathProtoFuncMin):
1857 (KJS::mathProtoFuncPow):
1858 (KJS::mathProtoFuncRandom):
1859 (KJS::mathProtoFuncRound):
1860 (KJS::mathProtoFuncSin):
1861 (KJS::mathProtoFuncSqrt):
1862 (KJS::mathProtoFuncTan):
1863 * kjs/math_object.h:
1864 * kjs/string_object.cpp:
1865 (KJS::stringProtoFuncToString):
1866 (KJS::stringProtoFuncValueOf):
1867 (KJS::stringProtoFuncCharAt):
1868 (KJS::stringProtoFuncCharCodeAt):
1869 (KJS::stringProtoFuncConcat):
1870 (KJS::stringProtoFuncIndexOf):
1871 (KJS::stringProtoFuncLastIndexOf):
1872 (KJS::stringProtoFuncMatch):
1873 (KJS::stringProtoFuncSearch):
1874 (KJS::stringProtoFuncReplace):
1875 (KJS::stringProtoFuncSlice):
1876 (KJS::stringProtoFuncSplit):
1877 (KJS::stringProtoFuncSubstr):
1878 (KJS::stringProtoFuncSubstring):
1879 (KJS::stringProtoFuncToLowerCase):
1880 (KJS::stringProtoFuncToUpperCase):
1881 (KJS::stringProtoFuncToLocaleLowerCase):
1882 (KJS::stringProtoFuncToLocaleUpperCase):
1883 (KJS::stringProtoFuncLocaleCompare):
1884 (KJS::stringProtoFuncBig):
1885 (KJS::stringProtoFuncSmall):
1886 (KJS::stringProtoFuncBlink):
1887 (KJS::stringProtoFuncBold):
1888 (KJS::stringProtoFuncFixed):
1889 (KJS::stringProtoFuncItalics):
1890 (KJS::stringProtoFuncStrike):
1891 (KJS::stringProtoFuncSub):
1892 (KJS::stringProtoFuncSup):
1893 (KJS::stringProtoFuncFontcolor):
1894 (KJS::stringProtoFuncFontsize):
1895 (KJS::stringProtoFuncAnchor):
1896 (KJS::stringProtoFuncLink):
1897 * kjs/string_object.h:
1899 2008-01-15 Geoffrey Garen <ggaren@apple.com>
1901 Reviewed by Adam Roben.
1903 Some tweaks to our headerdoc, suggested by David Gatwood on the docs
1907 * API/JSObjectRef.h:
1908 * API/JSStringRef.h:
1911 2008-01-15 Alp Toker <alp@atoker.com>
1913 Rubber-stamped by Anders.
1915 Make the HTTP backend configurable in the GTK+ port. curl is currently
1918 * wtf/Platform.h: Don't hard-code WTF_USE_CURL for GTK
1920 2008-01-15 Sam Weinig <sam@webkit.org>
1922 Reviewed by Beth Dakin.
1924 Remove unneeded variable.
1926 * kjs/string_object.cpp:
1927 (KJS::StringProtoFuncSubstr::callAsFunction):
1929 2008-01-14 Steve Falkenburg <sfalken@apple.com>
1931 Use shared vsprops for most vcproj properties.
1935 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add missing Debug_Internal config.
1936 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add missing Debug_Internal config.
1937 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
1939 2008-01-14 Adam Roben <aroben@apple.com>
1941 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
1942 some headers that were missing from the vcproj so their contents will
1943 be included in Find in Files.
1945 2008-01-14 Adam Roben <aroben@apple.com>
1947 Fix Bug 16871: Crash when loading apple.com/startpage
1949 <http://bugs.webkit.org/show_bug.cgi?id=16871>
1950 <rdar://problem/5686670>
1952 Patch written by Darin, reviewed by me.
1954 * kjs/ExecState.cpp:
1955 (KJS::ExecState::mark): Call ActivationImp::markChildren if our
1956 m_activation is on the stack. This is what ScopeChain::mark also does,
1957 but apparently in some cases it's possible for an ExecState's
1958 ActivationImp to not be in any ScopeChain.
1960 2008-01-14 Kevin McCullough <kmccullough@apple.com>
1964 -<rdar://problem/5622667> REGRESSION (Leopard-ToT): Endless loading loop
1965 trying to view techreport.com comments
1966 - We need to set values in the map, because if they are already in the
1967 map they will not be reset when we use add().
1969 * kjs/array_instance.cpp:
1970 (KJS::ArrayInstance::put):
1972 2008-01-14 Darin Adler <darin@apple.com>
1976 - re-speed-up the page load test (my StringImpl change slowed it down)
1979 (WTF::RefCounted::RefCounted): Allow derived classes to start with a reference
1980 count other than 0. Eventually everyone will want to start with a 1. This is a
1981 staged change. For now, there's a default of 0, and you can specify 1. Later,
1982 there will be no default and everyone will have to specify. And then later, there
1983 will be a default of 1. Eventually, we can take away even the option of starting
1987 (WTF::Vector::Vector): Sped up creation of non-empty vectors by removing the
1988 overhead of first constructing something empty and then calling resize.
1989 (WTF::Vector::clear): Sped up the common case of calling clear on an empty
1990 vector by adding a check for that case.
1991 (WTF::Vector::releaseBuffer): Marked this function inline and removed a branch
1992 in the case of vectors with no inline capacity (normal vectors) by leaving out
1993 the code to copy the inline buffer in that case.
1995 2008-01-14 Alexey Proskuryakov <ap@webkit.org>
1997 Reviewed by David Kilzer.
1999 http://bugs.webkit.org/show_bug.cgi?id=16787
2000 array.splice() with 1 element not working
2002 Test: fast/js/array-splice.html
2004 * kjs/array_object.cpp:
2005 (KJS::ArrayProtoFuncSplice::callAsFunction): Implement this Mozilla extension, and fix
2006 some other edge cases.
2008 2008-01-13 Steve Falkenburg <sfalken@apple.com>
2010 Share common files across projects.
2013 Debug: common.vsprops, debug.vsprops
2014 Debug_Internal: common.vsprops, debug.vsprops, debug_internal.vsprops
2015 Release: common.vsprops, release.vsprops
2017 Shared properties can go into common.vsprops, shared debug settings can go into debug.vsprops.
2018 debug_internal.vsprops will be mostly empty except for file path prefix modifiers.
2020 Reviewed by Adam Roben.
2022 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2023 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2024 * JavaScriptCore.vcproj/debug.vsprops: Removed.
2025 * JavaScriptCore.vcproj/debug_internal.vsprops: Removed.
2026 * JavaScriptCore.vcproj/release.vsprops: Removed.
2027 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2029 2008-01-13 Marius Bugge Monsen <mbm@trolltech.com>
2031 Contributions and review by Adriaan de Groot,
2032 Simon Hausmann, Eric Seidel, and Darin Adler.
2034 - http://bugs.webkit.org/show_bug.cgi?id=16590
2035 Compilation fixes for Solaris.
2038 (KJS::GregorianDateTime::GregorianDateTime): Use the WIN_OS code path
2039 for SOLARIS too, presumably because Solaris also lacks the tm_gtoff and tm_zone
2041 (KJS::GregorianDateTime::operator tm): Ditto.
2043 * kjs/collector.cpp:
2044 (KJS::currentThreadStackBase): Use thr_stksegment on Solaris.
2047 (isfinite): Implement for Solaris.
2049 (signbit): Ditto. But this one is wrong, so I added a FIXME.
2051 * wtf/Platform.h: Define PLATFORM(SOLARIS) when "sun" or "__sun" is defined.
2053 2008-01-13 Michael Goddard <michael.goddard@trolltech.com>
2055 Reviewed by Anders Carlsson.
2057 Add binding language type to Instance.
2058 Allows runtime determination of the type of an
2059 Instance, to allow safe casting. Doesn't actually
2060 add any safe casting yet, though.
2062 Add a helper function to get an Instance from a JSObject*.
2063 Given an object and the expected binding language, see if
2064 the JSObject actually wraps an Instance of the given type
2065 and return it. Otherwise return 0.
2067 Move RuntimeObjectImp creations into Instance.
2068 Make the ctor protected, and Instance a friend class, so
2069 that all creation of RuntimeObjectImps goes through
2072 Remove copy ctor/assignment operator for QtInstance.
2073 Instance itself is Noncopyable, so QtInstance doesn't
2076 Add caching for QtInstance and associated RuntimeObjectImps.
2077 Push any dealings with QtLanguage bindings into QtInstance,
2078 and cache them there, rather than in the Instance layer. Add
2079 a QtRuntimeObjectImp to help with caching.
2081 * JavaScriptCore.exp:
2082 * bindings/c/c_instance.h:
2083 * bindings/jni/jni_instance.h:
2084 * bindings/objc/objc_instance.h:
2085 * bindings/qt/qt_instance.cpp:
2086 (KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
2087 (KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
2088 (KJS::Bindings::QtRuntimeObjectImp::invalidate):
2089 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
2090 (KJS::Bindings::QtInstance::QtInstance):
2091 (KJS::Bindings::QtInstance::~QtInstance):
2092 (KJS::Bindings::QtInstance::getQtInstance):
2093 (KJS::Bindings::QtInstance::getRuntimeObject):
2094 * bindings/qt/qt_instance.h:
2095 (KJS::Bindings::QtInstance::getBindingLanguage):
2096 * bindings/runtime.cpp:
2097 (KJS::Bindings::Instance::createBindingForLanguageInstance):
2098 (KJS::Bindings::Instance::createRuntimeObject):
2099 (KJS::Bindings::Instance::getInstance):
2100 * bindings/runtime.h:
2101 * bindings/runtime_object.h:
2102 (KJS::RuntimeObjectImp::getInternalInstance):
2104 2008-01-12 Alp Toker <alp@atoker.com>
2106 Reviewed by Mark Rowe.
2108 Hide non-public symbols in GTK+/autotools release builds.
2112 2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2114 Reviewed by Mark Rowe.
2116 Fix http://bugs.webkit.org/show_bug.cgi?id=16852
2117 Fixes leaking of ActivationStackNode objects.
2119 * kjs/JSGlobalObject.cpp:
2120 (KJS::JSGlobalObject::deleteActivationStack):
2121 (KJS::JSGlobalObject::~JSGlobalObject):
2122 (KJS::JSGlobalObject::init):
2123 (KJS::JSGlobalObject::reset):
2124 * kjs/JSGlobalObject.h:
2126 2008-01-12 Darin Adler <darin@apple.com>
2128 - try to fix Qt Windows build
2130 * pcre/dftables: Remove reliance on the list form of Perl pipes.
2132 2008-01-12 Darin Adler <darin@apple.com>
2134 - try to fix Qt build
2136 * kjs/function.cpp: Added include of scope_chain_mark.h.
2137 * kjs/scope_chain_mark.h: Added multiple-include guards.
2139 2008-01-12 Mark Rowe <mrowe@apple.com>
2141 Another Windows build fix.
2145 2008-01-12 Mark Rowe <mrowe@apple.com>
2147 Attempted Windows build fix. Use struct consistently when forward-declaring
2148 ActivationStackNode and StackActivation.
2151 * kjs/JSGlobalObject.h:
2153 2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2157 Fixes a problem with the ActivationImp tear-off patch (r29425) where
2158 some of the calls to JSGlobalObject::tearOffActivation() were using
2159 the wrong test to determine whether it should leave a relic behind.
2162 (KJS::FunctionImp::argumentsGetter):
2163 (KJS::ActivationImp::getOwnPropertySlot):
2165 2008-01-11 Geoffrey Garen <ggaren@apple.com>
2167 Reviewed by Oliver Hunt.
2169 Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
2170 variable access (16644)
2172 This bug was caused by var declarations shadowing built-in properties of
2175 To match Firefox, we've decided that var declarations will never shadow
2176 built-in properties of the global object or its prototypes. We used to
2177 behave more like IE, which allows shadowing, but walking that line got
2178 us into trouble with websites that sent us down the Firefox codepath.
2180 * kjs/JSVariableObject.h:
2181 (KJS::JSVariableObject::symbolTableGet): New code to support calling
2182 hasProperty before the variable object is fully initialized (so you
2183 can call it during initialization).
2186 (KJS::ProgramNode::initializeSymbolTable): Always do a full hasProperty
2187 check when looking for duplicates, not getDirect, since it only checks
2188 the property map, and not hasOwnProperty, since it doesn't check
2190 (KJS::EvalNode::processDeclarations): ditto
2192 * kjs/property_slot.h:
2193 (KJS::PropertySlot::ungettableGetter): Best function name evar.
2195 2008-01-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2199 Optimized ActivationImp allocation, so that activation records are now
2200 first allocated on an explicitly managed stack and only heap allocated
2201 when necessary. Roughly a 5% improvement on SunSpider, and a larger
2202 improvement on benchmarks that use more function calls.
2204 * JavaScriptCore.xcodeproj/project.pbxproj:
2205 * kjs/Activation.h: Added.
2206 (KJS::ActivationImp::ActivationData::ActivationData):
2207 (KJS::ActivationImp::ActivationImp):
2208 (KJS::ActivationImp::classInfo):
2209 (KJS::ActivationImp::isActivationObject):
2210 (KJS::ActivationImp::isOnStack):
2211 (KJS::ActivationImp::d):
2212 (KJS::StackActivation::StackActivation):
2213 * kjs/ExecState.cpp:
2214 (KJS::ExecState::ExecState):
2215 (KJS::ExecState::~ExecState):
2217 (KJS::ExecState::replaceScopeChainTop):
2218 (KJS::ExecState::setActivationObject):
2219 (KJS::ExecState::setLocalStorage):
2220 * kjs/JSGlobalObject.cpp:
2221 (KJS::JSGlobalObject::reset):
2222 (KJS::JSGlobalObject::pushActivation):
2223 (KJS::JSGlobalObject::checkActivationCount):
2224 (KJS::JSGlobalObject::popActivationHelper):
2225 (KJS::JSGlobalObject::popActivation):
2226 (KJS::JSGlobalObject::tearOffActivation):
2227 * kjs/JSGlobalObject.h:
2228 * kjs/JSVariableObject.h:
2229 (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
2230 (KJS::JSVariableObject::JSVariableObject):
2232 (KJS::FunctionImp::argumentsGetter):
2233 (KJS::ActivationImp::ActivationImp):
2234 (KJS::ActivationImp::~ActivationImp):
2235 (KJS::ActivationImp::init):
2236 (KJS::ActivationImp::getOwnPropertySlot):
2237 (KJS::ActivationImp::markHelper):
2238 (KJS::ActivationImp::mark):
2239 (KJS::ActivationImp::ActivationData::ActivationData):
2240 (KJS::GlobalFuncImp::callAsFunction):
2243 (KJS::PostIncResolveNode::evaluate):
2244 (KJS::PostDecResolveNode::evaluate):
2245 (KJS::PreIncResolveNode::evaluate):
2246 (KJS::PreDecResolveNode::evaluate):
2247 (KJS::ReadModifyResolveNode::evaluate):
2248 (KJS::AssignResolveNode::evaluate):
2249 (KJS::WithNode::execute):
2250 (KJS::TryNode::execute):
2251 (KJS::FunctionBodyNode::processDeclarations):
2252 (KJS::FuncExprNode::evaluate):
2254 * kjs/scope_chain.h:
2255 (KJS::ScopeChain::replace):
2256 * kjs/scope_chain_mark.h: Added.
2257 (KJS::ScopeChain::mark):
2259 2008-01-11 Simon Hausmann <hausmann@webkit.org>
2261 Reviewed by Mark Rowe.
2263 Fix the (clean) qmake build. For generating chartables.c we don't
2264 depend on a separate input source file anymore, the dftables perl
2265 script is enough. So use that instead as value for the .input
2266 variable, to ensure that qmake also generates a rule to call dftables.
2270 2008-01-10 Geoffrey Garen <ggaren@apple.com>
2272 Reviewed by John Sullivan.
2274 Fixed some world leak reports:
2275 * <rdar://problem/5669436> PLT complains about world leak of 1 JavaScript
2276 Interpreter after running cvs-base suite
2278 * <rdar://problem/5669423> PLT complains about world leak if browser
2279 window is open when PLT starts
2281 * kjs/collector.h: Added the ability to distinguish between global
2282 objects and GC-protected global objects, since we only consider the
2283 latter to be world leaks.
2284 * kjs/collector.cpp:
2286 2008-01-11 Mark Rowe <mrowe@apple.com>
2288 Silence qmake warning about ctgen lacking input.
2290 Rubber-stamped by Alp Toker.
2294 2008-01-10 David Kilzer <ddkilzer@apple.com>
2296 dftables should be rewritten as a script
2298 <http://bugs.webkit.org/show_bug.cgi?id=16818>
2299 <rdar://problem/5681463>
2303 Rewrote the dftables utility in Perl. Attempted to switch all
2304 build systems to call the script directly instead of building
2305 a binary first. Only the Xcode build was able to be tested.
2307 * DerivedSources.make: Added pcre directory to VPATH and changed
2308 to invoke dftables directly.
2309 * GNUmakefile.am: Removed build information and changed to invoke
2311 * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed reference to
2313 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
2314 * JavaScriptCore.vcproj/dftables: Removed.
2315 * JavaScriptCore.vcproj/dftables/dftables.vcproj: Removed.
2316 * JavaScriptCore.xcodeproj/project.pbxproj: Removed dftables target.
2317 * jscore.bkl: Removed dftables executable definition.
2318 * pcre/dftables: Copied from JavaScriptCore/pcre/dftables.cpp.
2319 * pcre/dftables.cpp: Removed.
2320 * pcre/dftables.pro: Removed.
2321 * pcre/pcre.pri: Removed references to dftables.cpp and changed to
2322 invoke dftables directly.
2324 2008-01-10 Dan Bernstein <mitz@apple.com>
2326 Reviewed by Darin Adler.
2328 - fix http://bugs.webkit.org/show_bug.cgi?id=16782
2329 <rdar://problem/5675331> REGRESSION(r29266): Reproducible crash in fast/replaced/image-map.html
2331 The crash resulted from a native object (DumpRenderTree's
2332 EventSender) causing its wrapper to be invalidated (by clicking a
2333 link that replaced the document in the window) and consequently
2334 deallocated. The fix is to use RefPtrs to protect the native object
2335 from deletion by self-invalidation.
2337 * bindings/runtime_method.cpp:
2338 (RuntimeMethod::callAsFunction):
2339 * bindings/runtime_object.cpp:
2340 (RuntimeObjectImp::fallbackObjectGetter):
2341 (RuntimeObjectImp::fieldGetter):
2342 (RuntimeObjectImp::methodGetter):
2343 (RuntimeObjectImp::put):
2344 (RuntimeObjectImp::defaultValue):
2345 (RuntimeObjectImp::callAsFunction):
2347 2008-01-07 Mark Rowe <mrowe@apple.com>
2349 Reviewed by Maciej Stachowiak.
2351 Turn testIsInteger assertions into compile-time asserts and move them into HashTraits.h
2357 2008-01-07 Nikolas Zimmermann <zimmermann@kde.org>
2361 Enable SVG_FONTS by default.
2363 * Configurations/JavaScriptCore.xcconfig:
2365 2008-01-07 Darin Adler <darin@apple.com>
2367 Rubber stamped by David Kilzer.
2369 - get rid of empty fpconst.cpp
2371 * GNUmakefile.am: Remove fpconst.cpp.
2372 * JavaScriptCore.pri: Ditto.
2373 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
2374 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
2375 * JavaScriptCoreSources.bkl: Ditto.
2377 * kjs/fpconst.cpp: Removed.
2379 2008-01-07 Darin Adler <darin@apple.com>
2381 Reviewed by David Kilzer.
2383 - fix alignment problem with NaN and Inf globals
2385 * kjs/fpconst.cpp: Move the contents of this file from here back to
2386 value.cpp. The reason this was in a separate file is that the DARWIN
2387 version of this used a declaration of the globals with a different
2388 type to avoid creating "init routines". That's no longer necessary for
2389 DARWIN and was never necessary for the non-DARWIN code path.
2390 To make this patch easy to merge, I didn't actually delete this file
2391 yet. We'll do that in a separate changeset.
2393 * kjs/value.cpp: If C99's NAN and INFINITY are present, then use them,
2394 othrewise use the union trick from fpconst.cpp. I think it would be
2395 better to eliminate KJS::NaN and KJS::Inf and just use NAN and INFINITY
2396 directly or std::numeric_limits<double>::quiet_nan() and
2397 std::numeric_limits<double>::infinity(). But when I tried that, it
2398 slowed down SunSpider. Someone else could do that cleanup if they
2399 could do it without slowing down the engine.
2401 2008-01-07 Adam Roben <aroben@apple.com>
2405 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
2406 JavaScript.h to the project.
2407 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
2408 Copy JavaScript.h to WEBKITOUTPUTDIR.
2410 2008-01-07 Timothy Hatcher <timothy@apple.com>
2421 * API/JavaScriptCore.h:
2423 * JavaScriptCore.xcodeproj/project.pbxproj:
2425 2008-01-07 Alp Toker <alp@atoker.com>
2429 http://bugs.webkit.org/show_bug.cgi?id=16029
2430 JavaScriptCore.h is not suitable for platforms other than Mac OS X
2432 Introduce a new JavaScriptCore/JavaScript.h public API header. This
2433 should be used by all new portable code using the JavaScriptCore API.
2435 JavaScriptCore/JavaScriptCore.h will remain for compatibility with
2436 existing applications that depend on it including JSStringRefCF.h
2437 which isn't portable.
2439 Also add minidom to the GTK+/autotools build since we can now support
2440 it on all platforms.
2444 * API/JavaScript.h: Added.
2445 * API/JavaScriptCore.h:
2446 * ForwardingHeaders/JavaScriptCore/JavaScript.h: Added.
2448 * JavaScriptCore.xcodeproj/project.pbxproj:
2450 2008-01-06 Eric Seidel <eric@webkit.org>
2454 Abstract all DateObject.set* functions in preparation for fixing:
2455 http://bugs.webkit.org/show_bug.cgi?id=16753
2457 SunSpider had random changes here and there but was overall a wash.
2459 * kjs/date_object.cpp:
2460 (KJS::fillStructuresUsingTimeArgs):
2461 (KJS::setNewValueFromTimeArgs):
2462 (KJS::setNewValueFromDateArgs):
2463 (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
2464 (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
2465 (KJS::DateProtoFuncSetSeconds::callAsFunction):
2466 (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
2467 (KJS::DateProtoFuncSetMinutes::callAsFunction):
2468 (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
2469 (KJS::DateProtoFuncSetHours::callAsFunction):
2470 (KJS::DateProtoFuncSetUTCHours::callAsFunction):
2471 (KJS::DateProtoFuncSetDate::callAsFunction):
2472 (KJS::DateProtoFuncSetUTCDate::callAsFunction):
2473 (KJS::DateProtoFuncSetMonth::callAsFunction):
2474 (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
2475 (KJS::DateProtoFuncSetFullYear::callAsFunction):
2476 (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
2478 2008-01-06 Nikolas Zimmermann <zimmermann@kde.org>
2482 Add new helper function isArabicChar - SVG Fonts support needs it.
2484 * wtf/unicode/icu/UnicodeIcu.h:
2485 (WTF::Unicode::isArabicChar):
2486 * wtf/unicode/qt4/UnicodeQt4.h:
2487 (WTF::Unicode::isArabicChar):
2489 2008-01-06 Alp Toker <alp@atoker.com>
2491 Reviewed by Mark Rowe.
2493 Use $(EXEEXT) to account for the .exe extension in the GTK+ Windows
2494 build. (This is already done correctly in DerivedSources.make.) Issue
2495 noticed by Mikkel when building in Cygwin.
2497 Add a missing slash. This was a hack from the qmake build system that
2498 isn't necessary with autotools.
2502 2008-01-05 Darin Adler <darin@apple.com>
2504 * API/JSRetainPtr.h: One more file that needed the change below.
2506 2008-01-05 Darin Adler <darin@apple.com>
2508 * wtf/OwnPtr.h: OwnPtr needs the same fix as RefPtr below.
2510 2008-01-05 Adam Roben <aroben@apple.com>
2516 * wtf/RetainPtr.h: Use PtrType instead of T* because of the
2517 RemovePointer magic.
2519 2008-01-05 Darin Adler <darin@apple.com>
2521 Rubber stamped by Maciej Stachowiak.
2523 - cut down own PIC branches by using a pointer-to-member-data instead of a
2524 pointer-to-member-function in WTF smart pointers
2526 * wtf/OwnArrayPtr.h:
2531 Use a pointer to the m_ptr member instead of the get member.
2532 The GCC compiler generates better code for this idiom.
2534 2008-01-05 Henry Mason <hmason@mac.com>
2536 Reviewed by Maciej Stachowiak.
2538 http://bugs.webkit.org/show_bug.cgi?id=16738
2539 Bug 16738: Collector block offset could be stored as an cell offset instead of a byte offset
2541 Gives a 0.4% SunSpider boost and prettier code.
2543 * kjs/collector.cpp: Switched to cell offsets from byte offsets
2544 (KJS::Collector::heapAllocate):
2545 (KJS::Collector::sweep):
2547 2008-01-04 Mark Rowe <mrowe@apple.com>
2549 Reviewed by Maciej Stachowiak.
2551 Have the two malloc zones print useful diagnostics if their free method are unexpectedly invoked.
2552 Due to <rdar://problem/5671357> this can happen if an application attempts to free a pointer that
2553 was not allocated by any registered malloc zone on the system.
2555 * kjs/CollectorHeapIntrospector.h:
2556 * wtf/FastMalloc.cpp:
2558 2008-01-04 Alp Toker <alp@atoker.com>
2560 GTK+ autotools build fix. Terminate empty rules.
2564 2008-01-03 Simon Hausmann <hausmann@webkit.org>
2566 Reviewed by Mark Rowe.
2568 Fix compilation with gcc 4.3: limits.h is needed for INT_MAX.
2570 * pcre/pcre_exec.cpp:
2572 2008-01-03 Darin Adler <darin@apple.com>
2574 * tests/mozilla/expected.html: The fix for bug 16696 also fixed a test
2575 case, ecma_3/RegExp/perlstress-002.js, so updated results to expect
2576 that test to succeed.
2578 2008-01-02 Darin Adler <darin@apple.com>
2582 - fix http://bugs.webkit.org/show_bug.cgi?id=16696
2583 JSCRE fails fails to match Acid3 regexp
2585 Test: fast/regex/early-acid3-86.html
2587 The problem was with the cutoff point between backreferences and octal
2588 escape sequences. We need to determine the cutoff point by counting the
2589 total number of capturing brackets, which requires an extra pass through
2590 the expression when compiling it.
2592 * pcre/pcre_compile.cpp:
2593 (CompileData::CompileData): Added numCapturingBrackets. Removed some
2595 (compileBranch): Use numCapturingBrackets when calling checkEscape.
2596 (calculateCompiledPatternLength): Use numCapturingBrackets when calling
2597 checkEscape, and also store the bracket count at the end of the compile.
2598 (jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
2599 count the number of brackets and then a second time to calculate the length.
2601 2008-01-02 Darin Adler <darin@apple.com>
2605 - fix http://bugs.webkit.org/show_bug.cgi?id=16696
2606 JSCRE fails fails to match Acid3 regexp
2608 Test: fast/regex/early-acid3-86.html
2610 The problem was with the cutoff point between backreferences and octal
2611 escape sequences. We need to determine the cutoff point by counting the
2612 total number of capturing brackets, which requires an extra pass through
2613 the expression when compiling it.
2615 * pcre/pcre_compile.cpp:
2616 (CompileData::CompileData): Added numCapturingBrackets. Removed some
2618 (compileBranch): Use numCapturingBrackets when calling checkEscape.
2619 (calculateCompiledPatternLength): Use numCapturingBrackets when calling
2620 checkEscape, and also store the bracket count at the end of the compile.
2621 (jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
2622 count the number of brackets and then a second time to calculate the length.
2624 2008-01-02 David Kilzer <ddkilzer@webkit.org>
2626 Reviewed and landed by Darin.
2629 (KJS::DoWhileNode::execute): Added a missing return.
2631 2008-01-02 Darin Adler <darin@apple.com>
2633 - try to fix Qt build
2635 * wtf/unicode/qt4/UnicodeQt4.h:
2636 (WTF::Unicode::foldCase): Add some missing const.
2638 2008-01-02 Alice Liu <alice.liu@apple.com>
2640 Reviewed by Sam Weinig.
2642 need to export ASCIICType.h for use in DRT
2644 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2646 (WTF::isASCIIUpper):
2648 2008-01-02 Sam Weinig <sam@webkit.org>
2650 Reviewed by Beth Dakin.
2652 Cleanup error_object.h/cpp.
2654 * kjs/JSGlobalObject.cpp:
2655 (KJS::JSGlobalObject::reset):
2656 * kjs/error_object.cpp:
2658 (KJS::ErrorInstance::ErrorInstance):
2659 (KJS::ErrorPrototype::ErrorPrototype):
2660 (KJS::ErrorProtoFuncToString::ErrorProtoFuncToString):
2661 (KJS::ErrorProtoFuncToString::callAsFunction):
2662 (KJS::ErrorObjectImp::ErrorObjectImp):
2663 (KJS::ErrorObjectImp::implementsConstruct):
2664 (KJS::ErrorObjectImp::construct):
2665 (KJS::ErrorObjectImp::callAsFunction):
2666 (KJS::NativeErrorPrototype::NativeErrorPrototype):
2667 (KJS::NativeErrorImp::NativeErrorImp):
2668 (KJS::NativeErrorImp::implementsConstruct):
2669 (KJS::NativeErrorImp::construct):
2670 (KJS::NativeErrorImp::callAsFunction):
2671 (KJS::NativeErrorImp::mark):
2672 * kjs/error_object.h:
2673 (KJS::ErrorInstance::classInfo):
2674 (KJS::NativeErrorImp::classInfo):
2676 2008-01-02 Mark Rowe <mrowe@apple.com>
2678 Rubber-stamped by Alp Toker.
2680 * GNUmakefile.am: Add missing dependency on grammar.y.
2682 2008-01-01 Darin Adler <darin@apple.com>
2686 - fix for http://bugs.webkit.org/show_bug.cgi?id=16695
2687 JSC allows non-identifier codepoints in identifiers (affects Acid3)
2689 Test: fast/js/kde/parse.html
2692 (KJS::Lexer::lex): Added additional states to distinguish Unicode escapes at the
2693 start of identifiers from ones inside identifiers. Rejected characters that don't pass
2694 the isIdentStart and isIdentPart tests.
2695 (KJS::Lexer::convertUnicode): Removed incorrect FIXME comment.
2697 * kjs/lexer.h: Added new states to distinguish \u escapes at the start of identifiers
2698 from \u escapes inside identifiers.
2700 2008-01-01 Darin Adler <darin@apple.com>
2702 - rolled scope chain optimization out; it was breaking the world
2704 2008-01-01 Darin Adler <darin@apple.com>
2708 - http://bugs.webkit.org/show_bug.cgi?id=16685
2709 eliminate List::empty() to cut down on PIC branches
2711 Also included one other speed-up -- remove the call to reserveCapacity from
2712 FunctionBodyNode::processDeclarations in all but the most unusual cases.
2714 Together these make SunSpider 1.016x as fast.
2716 * JavaScriptCore.exp: Updated.
2717 * kjs/ExecState.cpp:
2718 (KJS::globalEmptyList): Added. Called only when creating global ExecState
2720 (KJS::ExecState::ExecState): Broke constructor up into three separate functions,
2721 for the three separate node types. Also went through each of the three and
2722 streamlined as much as possible, removing dead code. This prevents us from having
2723 to access the global in the function body version of the constructor.
2725 * kjs/ExecState.h: Added emptyList(). Replaced the constructor with a set of
2726 three that are specific to the different node types that can create new execution
2729 * kjs/array_object.cpp:
2730 (KJS::ArrayProtoFuncToLocaleString::callAsFunction): Use exec->emptyList() instead
2732 (KJS::ArrayProtoFuncConcat::callAsFunction): Ditto.
2733 (KJS::ArrayProtoFuncSlice::callAsFunction): Ditto.
2734 (KJS::ArrayProtoFuncSplice::callAsFunction): Ditto.
2735 (KJS::ArrayProtoFuncFilter::callAsFunction): Ditto.
2737 (KJS::FunctionImp::callAsFunction): Updated to call new ExecState constructor.
2738 (KJS::GlobalFuncImp::callAsFunction): Ditto (for eval).
2739 * kjs/function_object.cpp:
2740 (FunctionObjectImp::construct): Use exec->emptyList() instead of List::empty().
2742 * kjs/list.cpp: Removed List::empty.
2743 * kjs/list.h: Ditto.
2746 (KJS::ElementNode::evaluate): Use exec->emptyList() instead of List::empty().
2747 (KJS::ArrayNode::evaluate): Ditto.
2748 (KJS::ObjectLiteralNode::evaluate): Ditto.
2749 (KJS::PropertyListNode::evaluate): Ditto.
2750 (KJS::FunctionBodyNode::processDeclarations): Another speed-up. Check the capacity
2751 before calling reserveCapacity, because it doesn't get inlined the local storage
2752 vector is almost always big enough -- saving the function call overhead is a big
2754 (KJS::FuncDeclNode::makeFunction): Use exec->emptyList() instead of List::empty().
2755 (KJS::FuncExprNode::evaluate): Ditto.
2757 (KJS::tryGetAndCallProperty): Ditto.
2758 * kjs/property_slot.cpp:
2759 (KJS::PropertySlot::functionGetter): Ditto.
2760 * kjs/string_object.cpp:
2761 (KJS::StringProtoFuncSplit::callAsFunction): Ditto.
2763 2008-01-01 Darin Adler <darin@apple.com>
2767 - fix http://bugs.webkit.org/show_bug.cgi?id=16648
2768 REGRESSION (r28165): Yuku.com navigation prints "jsRegExpExecute failed with result -2"
2769 <rdar://problem/5646486> REGRESSION (r28165): Layout test fast/regex/test1 fails intermittently
2771 Fixes 34 failing test cases in the fast/regex/test1.html test.
2773 Restored the stack which prevents infinite loops for brackets that match the empty
2774 string; it had been removed as an optimization.
2776 Unfortunately, restoring this stack causes the regular expression test in SunSpider
2777 to be 1.095x as slow and the overall test to be 1.004x as slow. Maybe we can find
2778 a correct optimization to restore the speed!
2780 It's possible the original change was on the right track but just off by one.
2782 * pcre/pcre_exec.cpp: Add back eptrblock, but name it BracketChainNode.
2783 (MatchStack::pushNewFrame): Add back the logic needed here.
2784 (startNewGroup): Ditto.
2787 2008-01-01 Darin Adler <darin@apple.com>
2791 - http://bugs.webkit.org/show_bug.cgi?id=16683
2792 speed up function calls by making ScopeChain::push cheaper
2794 This gives a 1.019x speedup on SunSpider.
2796 After doing this, I realized this probably will be obsolete when the optimization
2797 to avoid creating an activation object is done. When we do that one we should check
2798 if rolling this out will speed things up, since this does add overhead at the time
2799 you copy the scope chain.
2801 * kjs/object.h: Removed the ScopeChain::release function. It was
2802 marked inline, and called in exactly one place, so moved it there.
2803 No idea why it was in this header file!
2805 * kjs/scope_chain.cpp: Removed the overload of the ScopeChain::push
2806 function that takes another ScopeChain. It was unused. I think we used
2807 it over in WebCore at one point, but not any more.
2809 * kjs/scope_chain.h: Changed ScopeChainNode into a struct rather than
2810 a class, got rid of its constructor so we can have one that's uninitialized,
2811 and moved the refCount into a derived struct, ScopeChainHeapNode. Made _node
2812 mutable so it can be changed in the moveToHeap function. Changed the copy
2813 constructor and assignment operator to call moveToHeap, since the top node
2814 can't be shared when it's embedded in another ScopeChain object. Updated
2815 functions as needed to handle the case where the first object isn't on the
2816 heap or to add casts for cases where it's guaranteed to be. Changed the push
2817 function to always put the new node into the ScopeChain object; it will get
2818 put onto the heap when needed later.
2820 2008-01-01 Geoffrey Garen <ggaren@apple.com>
2822 Reviewed by Darin Adler.
2824 Fixed slight logic error in reserveCapacity, where we would reallocate
2825 the storage buffer unnecessarily.
2828 (WTF::::reserveCapacity): No need to grow the buffer if newCapacity is
2829 equal to capacity().
2831 2008-01-01 Darin Adler <darin@apple.com>
2835 - http://bugs.webkit.org/show_bug.cgi?id=16684
2836 eliminate debugger overhead from function body execution
2838 Speeds SunSpider up 1.003x. That's a small amount, but measurable.
2840 * JavaScriptCore.exp: Updated.
2842 (KJS::Parser::parse): Create the node with a static member function named create() instead
2843 of using new explicitly.
2845 * kjs/grammar.y: Changed calls to new FunctionBodyNode to use FunctionBodyNode::create().
2848 (KJS::ProgramNode::create): Added. Calls new.
2849 (KJS::EvalNode::create): Ditto.
2850 (KJS::FunctionBodyNode::create): Ditto, but creates FunctionBodyNodeWithDebuggerHooks
2851 when a debugger is present.
2852 (KJS::FunctionBodyNode::execute): Removed debugger hooks.
2853 (KJS::FunctionBodyNodeWithDebuggerHooks::FunctionBodyNodeWithDebuggerHooks): Added.
2854 (KJS::FunctionBodyNodeWithDebuggerHooks::execute): Calls the debugger, then the code,
2855 then the debugger again.
2857 * kjs/nodes.h: Added create functions, made the constructors private and protected.
2859 2007-12-30 Eric Seidel <eric@webkit.org>
2863 More small cleanup to array_object.cpp
2865 * kjs/array_object.cpp:
2866 (KJS::ArrayProtoFuncToString::callAsFunction):
2867 (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
2868 (KJS::ArrayProtoFuncJoin::callAsFunction):
2869 (KJS::ArrayProtoFuncConcat::callAsFunction):
2870 (KJS::ArrayProtoFuncReverse::callAsFunction):
2871 (KJS::ArrayProtoFuncShift::callAsFunction):
2872 (KJS::ArrayProtoFuncSlice::callAsFunction):
2873 (KJS::ArrayProtoFuncSort::callAsFunction):
2874 (KJS::ArrayProtoFuncSplice::callAsFunction):
2875 (KJS::ArrayProtoFuncUnShift::callAsFunction):
2876 (KJS::ArrayProtoFuncFilter::callAsFunction):
2877 (KJS::ArrayProtoFuncMap::callAsFunction):
2878 (KJS::ArrayProtoFuncEvery::callAsFunction):
2880 2007-12-30 Eric Seidel <eric@webkit.org>
2884 Apply wkstyle to array_object.cpp
2886 * kjs/array_object.cpp:
2887 (KJS::ArrayPrototype::ArrayPrototype):
2888 (KJS::ArrayPrototype::getOwnPropertySlot):
2889 (KJS::ArrayProtoFuncConcat::callAsFunction):
2890 (KJS::ArrayProtoFuncPop::callAsFunction):
2891 (KJS::ArrayProtoFuncReverse::callAsFunction):
2892 (KJS::ArrayProtoFuncShift::callAsFunction):
2893 (KJS::ArrayProtoFuncSlice::callAsFunction):
2894 (KJS::ArrayProtoFuncSort::callAsFunction):
2895 (KJS::ArrayProtoFuncSplice::callAsFunction):
2896 (KJS::ArrayProtoFuncUnShift::callAsFunction):
2897 (KJS::ArrayProtoFuncFilter::callAsFunction):
2898 (KJS::ArrayProtoFuncMap::callAsFunction):
2899 (KJS::ArrayProtoFuncEvery::callAsFunction):
2900 (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
2901 (KJS::ArrayObjectImp::ArrayObjectImp):
2902 (KJS::ArrayObjectImp::implementsConstruct):
2903 (KJS::ArrayObjectImp::construct):
2904 (KJS::ArrayObjectImp::callAsFunction):
2906 2007-12-30 Eric Seidel <eric@webkit.org>
2910 Remove maxInt/minInt, replacing with std:max/min<int>()
2912 * kjs/array_object.cpp:
2913 (KJS::ArrayProtoFuncSplice::callAsFunction):
2914 * kjs/operations.cpp:
2917 2007-12-30 Eric Seidel <eric@webkit.org>
2921 Update Number.toString to properly throw exceptions.
2922 Cleanup code in Number.toString implementation.
2924 * kjs/number_object.cpp:
2925 (KJS::numberToString):
2927 (KJS::Error::create): Remove bogus debug lines.
2929 2007-12-28 Eric Seidel <eric@webkit.org>
2933 ASSERT when debugging via Drosera due to missed var lookup optimization.
2934 http://bugs.webkit.org/show_bug.cgi?id=16634
2936 No test case possible.
2939 (KJS::BreakpointCheckStatement::optimizeVariableAccess):
2942 2007-12-28 Eric Seidel <eric@webkit.org>
2946 Fix (-0).toFixed() and re-factor a little
2947 Fix (-0).toExponential() and printing of trailing 0s in toExponential
2948 Fix toPrecision(nan) handling
2949 http://bugs.webkit.org/show_bug.cgi?id=16640
2951 * kjs/number_object.cpp:
2952 (KJS::numberToFixed):
2953 (KJS::fractionalPartToString):
2954 (KJS::numberToExponential):
2955 (KJS::numberToPrecision):
2957 2007-12-28 Eric Seidel <eric@webkit.org>
2961 More changes to make number code readable
2963 * kjs/number_object.cpp:
2964 (KJS::integer_part_noexp):
2965 (KJS::numberToFixed):
2966 (KJS::numberToExponential):
2968 2007-12-28 Eric Seidel <eric@webkit.org>
2972 More small cleanups to toPrecision
2974 * kjs/number_object.cpp:
2975 (KJS::numberToPrecision):
2977 2007-12-28 Eric Seidel <eric@webkit.org>
2981 More small attempts to make number code readable
2983 * kjs/number_object.cpp:
2984 (KJS::exponentialPartToString):
2985 (KJS::numberToExponential):
2986 (KJS::numberToPrecision):
2988 2007-12-28 Eric Seidel <eric@webkit.org>
2992 Break out callAsFunction implementations into static functions
2994 * kjs/number_object.cpp:
2995 (KJS::numberToString):
2996 (KJS::numberToFixed):
2997 (KJS::numberToExponential):
2998 (KJS::numberToPrecision):
2999 (KJS::NumberProtoFunc::callAsFunction):
3001 2007-12-28 Eric Seidel <eric@webkit.org>
3005 Apply wkstyle/astyle and fix placement of *
3007 * kjs/number_object.cpp:
3009 (KJS::NumberInstance::NumberInstance):
3010 (KJS::NumberPrototype::NumberPrototype):
3011 (KJS::NumberProtoFunc::NumberProtoFunc):
3012 (KJS::integer_part_noexp):
3014 (KJS::NumberProtoFunc::callAsFunction):
3015 (KJS::NumberObjectImp::NumberObjectImp):
3016 (KJS::NumberObjectImp::getOwnPropertySlot):
3017 (KJS::NumberObjectImp::getValueProperty):
3018 (KJS::NumberObjectImp::implementsConstruct):
3019 (KJS::NumberObjectImp::construct):
3020 (KJS::NumberObjectImp::callAsFunction):
3022 (KJS::JSObject::put):
3024 2007-12-27 Eric Seidel <eric@webkit.org>
3028 ASSERT in JavaScriptCore while viewing WICD test case
3029 http://bugs.webkit.org/show_bug.cgi?id=16626
3032 (KJS::ForInNode::execute): move KJS_CHECK_EXCEPTION to proper place
3034 2007-12-26 Jan Michael Alonzo <jmalonzo@unpluggable.com>
3036 Reviewed by Alp Toker.
3038 http://bugs.webkit.org/show_bug.cgi?id=16390
3039 Use autotools or GNU make as the build system for the GTK port
3041 * GNUmakefile.am: Added.
3043 2007-12-25 Maciej Stachowiak <mjs@apple.com>
3047 - Remove unnecessary redundant check from property setting
3048 http://bugs.webkit.org/show_bug.cgi?id=16602
3050 1.3% speedup on SunSpider.
3053 (KJS::JSObject::put): Don't do canPut check when not needed; let
3054 the PropertyMap handle it.
3055 (KJS::JSObject::canPut): Don't check the static property
3056 table. lookupPut does that already.
3058 2007-12-24 Alp Toker <alp@atoker.com>
3060 Fix builds that don't use AllInOneFile.cpp following breakage
3061 introduced in r28973.
3065 2007-12-24 Maciej Stachowiak <mjs@apple.com>
3069 - Optimize variable declarations
3070 http://bugs.webkit.org/show_bug.cgi?id=16585
3072 3.5% speedup on SunSpider.
3074 var statements now result in either assignments or empty statements.
3076 This allows a couple of optimization opportunities:
3077 - No need to branch at runtime to check if there is an initializer
3078 - EmptyStatementNodes can be removed entirely (also done in this patch)
3079 - Assignment expressions get properly optimized for local variables
3081 This patch also includes some code cleanup:
3082 - Most of the old VarStatement/VarDecl logic is now only used for const declarations,
3083 thus it is renamed appropriately
3084 - AssignExprNode is gone
3086 * JavaScriptCore.exp:
3090 (KJS::SourceElements::append):
3091 (KJS::ConstDeclNode::ConstDeclNode):
3092 (KJS::ConstDeclNode::optimizeVariableAccess):
3093 (KJS::ConstDeclNode::handleSlowCase):
3094 (KJS::ConstDeclNode::evaluateSingle):
3095 (KJS::ConstDeclNode::evaluate):
3096 (KJS::ConstStatementNode::optimizeVariableAccess):
3097 (KJS::ConstStatementNode::execute):
3098 (KJS::VarStatementNode::optimizeVariableAccess):
3099 (KJS::VarStatementNode::execute):
3100 (KJS::ForInNode::ForInNode):
3101 (KJS::ForInNode::optimizeVariableAccess):
3102 (KJS::ForInNode::execute):
3103 (KJS::FunctionBodyNode::initializeSymbolTable):
3104 (KJS::ProgramNode::initializeSymbolTable):
3105 (KJS::FunctionBodyNode::processDeclarations):
3106 (KJS::ProgramNode::processDeclarations):
3107 (KJS::EvalNode::processDeclarations):
3109 (KJS::DeclarationStacks::):
3110 (KJS::StatementNode::):
3111 (KJS::ConstDeclNode::):
3112 (KJS::ConstStatementNode::):
3113 (KJS::EmptyStatementNode::):
3114 (KJS::VarStatementNode::):
3116 * kjs/nodes2string.cpp:
3117 (KJS::ConstDeclNode::streamTo):
3118 (KJS::ConstStatementNode::streamTo):
3119 (KJS::ScopeNode::streamTo):
3120 (KJS::VarStatementNode::streamTo):
3121 (KJS::ForNode::streamTo):
3122 (KJS::ForInNode::streamTo):
3124 2007-12-21 Mark Rowe <mrowe@apple.com>
3126 Reviewed by Oliver Hunt.
3128 * JavaScriptCore.exp: Remove unused symbol to prevent a weak external symbol
3129 being generated in JavaScriptCore.framework.
3131 2007-12-21 Darin Adler <darin@apple.com>
3133 Requested by Maciej.
3135 * kjs/nodes.h: Use the new NEVER_INLINE here and eliminate the old
3136 KJS_NO_INLINE. We don't want to have two, and we figured it was better
3137 to keep the one that's in WTF.
3139 2007-12-21 Darin Adler <darin@apple.com>
3143 - http://bugs.webkit.org/show_bug.cgi?id=16561
3144 remove debugger overhead from non-debugged JavaScript execution
3146 1.022x as fast on SunSpider.
3148 * JavaScriptCore.exp: Updated.
3150 * kjs/NodeInfo.h: Renamed SourceElementsStub to SourceElements,
3151 since that more accurately describes the role of this object, which
3152 is a reference-counted wrapper for a Vector.
3155 (KJS::Parser::didFinishParsing): Changed parameter type to SourceElements,
3156 and use plain assignment instead of set.
3157 * kjs/Parser.h: Changed parameter type of didFinishParsing to a
3158 SourceElements. Also changed m_sourceElements; we now use a RefPtr instead
3159 of an OwnPtr as well.
3161 * kjs/grammar.y: Got rid of all the calls to release() on SourceElements.
3162 That's now handed inside the constructors for various node types, since we now
3163 use vector swapping instead.
3166 (KJS::Node::rethrowException): Added NEVER_INLINE, because this was getting inlined
3167 and we want exception handling out of the normal code flow.
3168 (KJS::SourceElements::append): Moved here from the header. This now handles
3169 creating a BreakpointCheckStatement for each statement in the debugger case.
3170 That way we can get breakpoint handling without having it in every execute function.
3171 (KJS::BreakpointCheckStatement::BreakpointCheckStatement): Added.
3172 (KJS::BreakpointCheckStatement::execute): Added. Contains the code that was formerly
3173 in the StatementNode::hitStatement function and the KJS_BREAKPOINT macro.
3174 (KJS::BreakpointCheckStatement::streamTo): Added.
3175 (KJS::ArgumentListNode::evaluateList): Use KJS_CHECKEXCEPTIONVOID since the return
3177 (KJS::VarStatementNode::execute): Removed KJS_BREAKPOINT.
3178 (KJS::BlockNode::BlockNode): Changed parameter type to SourceElements.
3179 Changed code to use release since the class now contains a vector rather than
3181 (KJS::BlockNode::optimizeVariableAccess): Updated since member is now a vector
3182 rather than a vector pointer.
3183 (KJS::BlockNode::execute): Ditto.
3184 (KJS::ExprStatementNode::execute): Removed KJS_BREAKPOINT.
3185 (KJS::IfNode::execute): Ditto.
3186 (KJS::IfElseNode::execute): Ditto.
3187 (KJS::DoWhileNode::execute): Ditto.
3188 (KJS::WhileNode::execute): Ditto.
3189 (KJS::ContinueNode::execute): Ditto.
3190 (KJS::BreakNode::execute): Ditto.
3191 (KJS::ReturnNode::execute): Ditto.
3192 (KJS::WithNode::execute): Ditto.
3193 (KJS::CaseClauseNode::optimizeVariableAccess): Updated since member is now a vector
3194 rather than a vector pointer.
3195 (KJS::CaseClauseNode::executeStatements): Ditto.
3196 (KJS::SwitchNode::execute): Removed KJS_BREAKPOINT.
3197 (KJS::ThrowNode::execute): Ditto.
3198 (KJS::TryNode::execute): Ditto.
3199 (KJS::ScopeNode::ScopeNode): Changed parameter type to SourceElements.
3200 (KJS::ProgramNode::ProgramNode): Ditto.
3201 (KJS::EvalNode::EvalNode): Ditto.
3202 (KJS::FunctionBodyNode::FunctionBodyNode): Ditto.
3203 (KJS::ScopeNode::optimizeVariableAccess): Updated since member is now a vector
3204 rather than a vector pointer.
3206 * kjs/nodes.h: Removed hitStatement. Renamed SourceElements to StatementVector.
3207 Renamed SourceElementsStub to SourceElements and made it derive from
3208 ParserRefCounted rather than from Node, hold a vector rather than a pointer to
3209 a vector, and changed the release function to swap with another vector rather
3210 than the pointer idiom. Updated BlockNode and CaseClauseNode to hold actual
3211 vectors instead of pointers to vectors. Added BreakpointCheckStatement.
3213 * kjs/nodes2string.cpp:
3214 (KJS::statementListStreamTo): Changed to work on a vector instead of a pointer
3216 (KJS::BlockNode::streamTo): Ditto.
3217 (KJS::CaseClauseNode::streamTo): Ditto.
3219 * wtf/AlwaysInline.h: Added NEVER_INLINE.
3220 * wtf/PassRefPtr.h: Tweaked formatting. Added clear() function that matches the
3221 ones in OwnPtr and auto_ptr.
3222 * wtf/RefPtr.h: Ditto.
3224 2007-12-21 Darin Adler <darin@apple.com>
3226 - fix broken regression tests
3228 The broken tests were fast/js/do-while-expression-value.html and
3229 fast/js/while-expression-value.html.
3231 * kjs/nodes.cpp: Check in the correct version of this file. I had accidentally landed
3232 an old version of my patch for bug 16471.
3233 (KJS::statementListExecute): The logic here was backwards. Have to set the value
3234 even for non-normal execution results.
3236 2007-12-20 Alexey Proskuryakov <ap@webkit.org>
3240 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Copy npruntime_internal.h
3243 2007-12-20 Eric Seidel <eric@webkit.org>
3247 Split IfNode into IfNode and IfElseNode for speedup.
3248 http://bugs.webkit.org/show_bug.cgi?id=16470
3250 SunSpider claims this is 1.003x as fast as before.
3251 (This required running with --runs 15 to get consistent enough results to tell!)
3255 (KJS::IfNode::optimizeVariableAccess):
3256 (KJS::IfNode::execute):
3257 (KJS::IfNode::getDeclarations):
3258 (KJS::IfElseNode::optimizeVariableAccess):
3259 (KJS::IfElseNode::execute):
3260 (KJS::IfElseNode::getDeclarations):
3263 (KJS::IfElseNode::):
3264 * kjs/nodes2string.cpp:
3265 (KJS::IfNode::streamTo):
3266 (KJS::IfElseNode::streamTo):
3268 2007-12-20 Darin Adler <darin@apple.com>
3273 (WTF::operator==): Added.
3274 (WTF::operator!=): Added.
3276 2007-12-20 Geoffrey Garen <ggaren@apple.com>
3278 Reviewed by Oliver Hunt.
3280 AST optimization: Avoid NULL-checking ForNode's child nodes.
3282 0.6% speedup on SunSpider.
3284 This is a proof of concept patch that demonstrates how to optimize
3285 grammar productions with optional components, like
3287 for (optional; optional; optional) {
3291 The parser emits NULL for an optional component that is not present.
3293 Instead of checking for a NULL child at execution time, a node that
3294 expects an optional component to be present more often than not checks
3295 for a NULL child at construction time, and substitutes a viable
3296 alternative node in its place.
3298 (We'd like the parser to start emitting NULL a lot more once we teach
3299 it to emit NULL for certain no-op productions like EmptyStatement and
3300 VariableStatement, so, as a foundation, it's important for nodes with
3301 NULL optional components to be fast.)
3304 (KJS::Parser::didFinishParsing): Check for NULL SourceElements. Also,
3305 moved didFinishParsing into the .cpp file because adding a branch while
3306 it was in the header file caused a substantial and inexplicable
3307 performance regression. (Did I mention that GCC is crazy?)
3312 (KJS::BlockNode::BlockNode): Check for NULL SourceElements.
3313 (KJS::ForNode::optimizeVariableAccess): No need to check for NULL here.
3314 (KJS::ForNode::execute): No need to check for NULL here.
3316 (KJS::ForNode::): Check for NULL SourceElements. Substitute a TrueNode
3317 because it's semantically harmless, and it evaluates to boolean in an
3320 2007-12-20 Oliver Hunt <oliver@apple.com>
3324 Slight logic reordering in JSImmediate::from(double)
3326 This gives a 0.6% improvement in SunSpider.
3328 * kjs/JSImmediate.h:
3329 (KJS::JSImmediate::from):
3331 2007-12-20 Eric Seidel <eric@webkit.org>
3335 Fix major Array regression introduced by 28899.
3337 SunSpider claims this is at least 1.37x as fast as pre-regression. :)
3339 * kjs/array_instance.cpp: make Arrays fast again!
3341 2007-12-20 Eric Seidel <eric@webkit.org>
3343 Reviewed by Geoff, then re-rubber-stamped by Geoff after final search/replace and testing.
3345 Small reworking of Date code for 4% speedup on Date tests (0.2% overall)
3346 http://bugs.webkit.org/show_bug.cgi?id=16537
3348 Make msToYear human-readable
3349 Make msToDayInMonth slightly more readable and avoid recalculating msToYear
3350 Remove use of isInLeapYear to avoid calling msToYear
3351 Remove dayInYear call by changing msToDayInMonth to dayInMonthFromDayInYear
3352 Remove more duplicate calls to dayInYear and getUTCOffset for further speedup
3355 (KJS::daysFrom1970ToYear):
3357 (KJS::monthFromDayInYear):
3359 (KJS::dayInMonthFromDayInYear):
3360 (KJS::dateToDayInYear):
3361 (KJS::getDSTOffsetSimple):
3362 (KJS::getDSTOffset):
3363 (KJS::gregorianDateTimeToMS):
3364 (KJS::msToGregorianDateTime):
3366 2007-12-20 Rodney Dawes <dobey@wayofthemonkey.com>
3368 Reviewed by Darin Adler.
3370 Proxy includes of npruntime.h or npapi.h through npruntime_internal.h
3371 Include stdio.h in npapi.h for the use of FILE with XP_UNIX defined
3372 This is for building with X11, as some type and enum names conflict
3373 with #define names in X11 headers.
3374 http://bugs.webkit.org/show_bug.cgi?id=15669
3376 * JavaScriptCore.xcodeproj/project.pbxproj:
3377 * bindings/NP_jsobject.h:
3379 * bindings/npruntime.cpp:
3380 * bindings/npruntime_impl.h:
3381 * bindings/npruntime_priv.h:
3382 * bindings/npruntime_internal.h:
3383 * bindings/testbindings.cpp:
3384 * bindings/c/c_class.h:
3385 * bindings/c/c_runtime.h:
3386 * bindings/c/c_utility.h:
3388 2007-12-20 Darin Adler <darin@apple.com>
3390 - re-fix http://bugs.webkit.org/show_bug.cgi?id=16471
3391 Completions need to be smaller (or not exist at all)
3393 Same patch as last time with the test failures problem fixed.
3396 (KJS::GlobalFuncImp::callAsFunction): Make sure to check the completion
3397 type from newExec to see if the execute raised an exception.
3399 2007-12-20 Darin Adler <darin@apple.com>
3401 - roll out that last change -- it was causing test failures;
3402 I'll check it back in after fixing them
3404 2007-12-20 Darin Adler <darin@apple.com>
3408 - http://bugs.webkit.org/show_bug.cgi?id=16471
3409 Completions need to be smaller (or not exist at all)
3411 SuSpider shows 2.4% speedup.
3413 Stop using completions in the execution engine.
3414 Instead, the completion type and label target are both
3415 stored in the ExecState.
3417 * API/JSContextRef.cpp: Removed unneeded include of "completion.h".
3418 * bindings/runtime_method.cpp: Removed unused execute function.
3419 * bindings/runtime_method.h: Ditto.
3421 * kjs/ExecState.h: Added completionType, breakOrContinueTarget,
3422 setCompletionType, setNormalCompletion, setBreakCompletion,
3423 setContinueCompletion, setReturnValueCompletion, setThrowCompletion,
3424 setInterruptedCompletion, m_completionType, and m_breakOrContinueTarget.
3426 * kjs/completion.h: Removed constructor and getter for target
3427 for break and continue from Completion. This class is now only
3428 used for the public API to Interpreter and such.
3430 * kjs/date_object.h: Removed unused execute function.
3433 (KJS::FunctionImp::callAsFunction): Removed some unneeded
3434 exception processing. Updated to call the new execute function
3435 and to get the completion type from the ExecState. Merged in
3436 the execute function, which repeated some of the same logic and
3437 was called only from here.
3438 (KJS::GlobalFuncImp::callAsFunction): More of the same for eval.
3439 * kjs/function.h: Removed execute.
3441 * kjs/interpreter.cpp:
3442 (KJS::Interpreter::evaluate): Added code to convert the result of
3443 execut into a Completion.
3446 (KJS::Node::setErrorCompletion): Renamed from createErrorCompletion.
3447 Now sets the completion type in the ExecState.
3448 (KJS::Node::rethrowException): Now sets the completion type in the
3450 (KJS::StatementNode::hitStatement): Now sets the completion type in
3452 (KJS::VarStatementNode::execute): Updated to put completion type in
3453 the ExecState instead of a Completion object.
3454 (KJS::statementListExecute): Ditto. Also changed the for loop to use
3455 indices instead of iterators.
3456 (KJS::BlockNode::execute): Updated return type.
3457 (KJS::EmptyStatementNode::execute): Updated to put completion type in
3458 the ExecState instead of a Completion object.
3459 (KJS::ExprStatementNode::execute): Ditto.
3460 (KJS::IfNode::execute): Ditto.
3461 (KJS::DoWhileNode::execute): Ditto. Also streamlined the logic a little
3462 to make the normal case a little faster and moved the end outside the
3463 loop so that "break" can do a break.
3464 (KJS::WhileNode::execute): Ditto.
3465 (KJS::ForNode::execute): Ditto.
3466 (KJS::ForInNode::execute): Ditto.
3467 (KJS::ContinueNode::execute): Updated to put completion type in
3468 the ExecState instead of a Completion object.
3469 (KJS::BreakNode::execute): Ditto.
3470 (KJS::ReturnNode::execute): Ditto.
3471 (KJS::WithNode::execute): Ditto.
3472 (KJS::CaseClauseNode::executeStatements): Ditto. Also renamed to have
3473 execute in its name to reflect the fact that it's a member of the same
3474 family of functions.
3475 (KJS::CaseBlockNode::executeBlock): Ditto.
3476 (KJS::SwitchNode::execute): Ditto.
3477 (KJS::LabelNode::execute): Ditto.
3478 (KJS::ThrowNode::execute): Ditto.
3479 (KJS::TryNode::execute): Ditto.
3480 (KJS::ProgramNode::execute): Ditto.
3481 (KJS::EvalNode::execute): Ditto.
3482 (KJS::FunctionBodyNode::execute): Ditto.
3483 (KJS::FuncDeclNode::execute): Ditto.
3485 * kjs/nodes.h: Renamed setErrorCompletion to createErrorCompletion, made
3486 hitStatement protected, changed return value of execute to a JSValue,
3487 renamed evalStatements to executeStatements, and evalBlock to executeBlock.
3489 * kjs/number_object.h: Removed unused execute function.
3491 2007-12-20 Geoffrey Garen <ggaren@apple.com>
3496 (KJS::ProgramNode::processDeclarations):
3498 2007-12-20 Geoffrey Garen <ggaren@apple.com>
3500 Linux build fix: config.h has to come first.
3502 * kjs/error_object.cpp:
3504 2007-12-19 Geoffrey Garen <ggaren@apple.com>
3506 Reviewed by Oliver Hunt.
3508 Optimized global access to global variables, using a symbol table.
3510 SunSpider reports a 1.5% overall speedup, a 6.2% speedup on 3d-morph,
3511 and a whopping 33.1% speedup on bitops-bitwise-and.
3513 * API/JSCallbackObjectFunctions.h: Replaced calls to JSObject:: with
3514 calls to Base::, since JSObject is not always our base class. This
3515 was always a bug, but the bug is even more apparent after some of my
3518 (KJS::::staticFunctionGetter): Replaced use of getDirect with call to
3519 getOwnPropertySlot. Global declarations are no longer stored in the
3520 property map, so a call to getDirect is insufficient for finding
3521 override properties.
3524 * API/testapi.js: Added test for the getDirect change mentioned above.
3526 * kjs/ExecState.cpp:
3527 * kjs/ExecState.h: Dialed back the optimization to store a direct
3528 pointer to the localStorage buffer. One ExecState can grow the global
3529 object's localStorage without another ExecState's knowledge, so
3530 ExecState can't store a direct pointer to the localStorage buffer
3531 unless/until we invent a way to update all the relevant ExecStates.
3533 * kjs/JSGlobalObject.cpp: Inserted the symbol table into get and put
3535 (KJS::JSGlobalObject::reset): Reset the symbol table and local storage,
3536 too. Also, clear the property map here, removing the need for a
3539 * kjs/JSVariableObject.cpp:
3540 * kjs/JSVariableObject.h: Added support for saving localStorage and the
3541 symbol table to the back/forward cache, and restoring them.
3544 (KJS::GlobalFuncImp::callAsFunction): Renamed progNode to evalNode
3545 because it's an EvalNode, not a ProgramNode.
3548 (KJS::cacheGlobalObject): Replaced put with faster putDirect, since
3549 that's how the rest of lookup.h works. putDirect is safe here because
3550 cacheGlobalObject is only used for objects whose names are not valid
3553 * kjs/nodes.cpp: The good stuff!
3555 (KJS::EvalNode::processDeclarations): Replaced hasProperty with
3556 the new hasOwnProperty, which is slightly faster.
3558 * kjs/object.h: Nixed clearProperties because clear() does this job now.
3560 * kjs/property_map.cpp:
3561 * kjs/property_map.h: More back/forward cache support.
3564 (WTF::::grow): Added fast non-branching grow function. I used it in
3565 an earlier version of this patch, even though it's not used anymore.
3567 2007-12-09 Mark Rowe <mrowe@apple.com>
3569 Reviewed by Oliver Hunt.
3571 Build fix for non-Mac platforms. Move NodeInfo into its own header so that the YYTYPE
3572 declaration in grammar.h is able to declare members of that type.
3574 * kjs/NodeInfo.h: Added.
3575 (KJS::createNodeInfo):
3576 (KJS::mergeDeclarationLists):
3577 (KJS::appendToVarDeclarationList):
3581 2007-12-19 Oliver Hunt <oliver@apple.com>
3583 Make appendToVarDeclarationList static
3589 2007-12-18 Oliver Hunt <oliver@apple.com>
3591 Remove dead code due to removal of post-parse declaration discovery.
3595 Due to the removal of the declaration discovery pass after parsing we
3596 no longer need any of the logic used for that discovery.
3600 (KJS::VarDeclNode::VarDeclNode):
3601 (KJS::BlockNode::BlockNode):
3602 (KJS::ForInNode::ForInNode):
3603 (KJS::CaseBlockNode::CaseBlockNode):
3605 (KJS::VarStatementNode::):
3607 (KJS::DoWhileNode::):
3612 (KJS::FuncDeclNode::):
3613 (KJS::CaseClauseNode::):
3614 (KJS::ClauseListNode::):
3615 (KJS::SwitchNode::):
3617 2007-12-18 Oliver Hunt <oliver@apple.com>
3619 Replace post-parse pass to find declarations with logic in the parser itself
3623 Instead of finding declarations in a pass following the initial parsing of
3624 a program, we incorporate the logic directly into the parser. This lays
3625 the groundwork for further optimisations (such as improving performance in
3626 declaration expressions -- var x = y; -- to match that of standard assignment)
3627 in addition to providing a 0.4% performance improvement in SunSpider.
3629 * JavaScriptCore.exp:
3631 (KJS::Parser::parse):
3633 (KJS::Parser::didFinishParsing):
3634 (KJS::Parser::parse):
3637 (KJS::ParserTracked::ParserTracked):
3638 (KJS::ParserTracked::~ParserTracked):
3639 (KJS::ParserTracked::ref):
3640 (KJS::ParserTracked::deref):
3641 (KJS::ParserTracked::refcount):
3642 (KJS::ParserTracked::clearNewTrackedObjects):
3644 (KJS::ScopeNode::ScopeNode):
3645 (KJS::ProgramNode::ProgramNode):
3646 (KJS::EvalNode::EvalNode):
3647 (KJS::FunctionBodyNode::FunctionBodyNode):
3648 (KJS::FunctionBodyNode::initializeSymbolTable):
3649 (KJS::FunctionBodyNode::processDeclarations):
3651 (KJS::ParserTracked::):
3655 2007-12-18 Xan Lopez <xan@gnome.org>
3659 Fix http://bugs.webkit.org/show_bug.cgi?id=14521
3660 Bug 14521: JavaScriptCore fails to build on Linux/PPC gcc 4.1.2
3663 (TCMalloc_SpinLock::Unlock):
3665 Use less strict memory operand constraint on inline asm generation.
3666 PLATFORM(DARWIN) left unpatched due to Apple's GCC bug.
3668 Patch by David Kilzer <ddkilzer@webkit.org>
3670 2007-12-18 Mark Rowe <mrowe@apple.com>
3672 Rubber-stamped by Maciej Stachowiak.
3674 Remove outdated and non-functioning project files for the Apollo port.
3676 * JavaScriptCore.apolloproj: Removed.
3678 2007-12-18 Darin Adler <darin@apple.com>
3682 * pcre/pcre_exec.cpp:
3683 (jsRegExpExecute): Change back from false/true to 0/1 -- I probably should not have
3684 deleted MATCH_MATCH and MATCH_NOMATCH, but I'm going to leave them out.
3686 2007-12-18 Darin Adler <darin@apple.com>
3690 - fix http://bugs.webkit.org/show_bug.cgi?id=16458
3691 REGRESSION (r28164): regular expressions can now hang due to lack of a match limit
3692 <rdar://problem/5636067>
3694 Test: fast/regex/slow.html
3696 Slows down SunSpider a bit (about 1.01x); filed a bug to follow up on that:
3697 http://bugs.webkit.org/show_bug.cgi?id=16503
3699 * pcre/pcre.h: Changed name of error code to not specifically mention "recursion".
3700 * pcre/pcre_exec.cpp:
3701 (match): Replaced the depth limit, MATCH_RECURSION_LIMIT, with a total match looping
3702 limit, matchLimit. Also eliminated the constants for MATCH_MATCH and MATCH_NOMATCH,
3703 since they are just true and false (1 and 0).
3704 (jsRegExpExecute): More of the MATCH_MATCH change.
3706 2007-12-17 Darin Adler <darin@apple.com>
3708 - speculative build fix for non-gcc platforms
3710 * pcre/pcre_exec.cpp: (match): Remove unused cases from return switch.
3712 2007-12-16 Mark Rowe <mrowe@apple.com>
3714 Speculative build fix for non-Mac platforms.
3716 * pcre/pcre_compile.cpp: Include string.h for memset, memmove, etc.
3718 2007-12-16 Darin Adler <darin@apple.com>
3722 - http://bugs.webkit.org/show_bug.cgi?id=16438
3723 - removed some more unused code
3724 - changed quite a few more names to WebKit-style
3725 - moved more things out of pcre_internal.h
3726 - changed some indentation to WebKit-style
3727 - improved design of the functions for reading and writing
3728 2-byte values from the opcode stream (in pcre_internal.h)
3730 * pcre/dftables.cpp:
3731 (main): Added the kjs prefix a normal way in lieu of using macros.
3733 * pcre/pcre_compile.cpp: Moved some definitions here from pcre_internal.h.
3734 (errorText): Name changes, fewer typedefs.
3735 (checkEscape): Ditto. Changed uppercase conversion to use toASCIIUpper.
3736 (isCountedRepeat): Name change.
3737 (readRepeatCounts): Name change.
3738 (firstSignificantOpcode): Got rid of the use of OP_lengths, which is
3739 very lightly used here. Hard-coded the length of OP_BRANUMBER.
3740 (firstSignificantOpcodeSkippingAssertions): Ditto. Also changed to
3741 use the advanceToEndOfBracket function.
3742 (getOthercaseRange): Name changes.
3743 (encodeUTF8): Ditto.
3744 (compileBranch): Name changes. Removed unused after_manual_callout and
3745 the code to handle it. Removed code to handle OP_ONCE since we never
3746 emit this opcode. Changed to use advanceToEndOfBracket in more places.
3747 (compileBracket): Name changes.
3748 (branchIsAnchored): Removed code to handle OP_ONCE since we never emit
3750 (bracketIsAnchored): Name changes.
3751 (branchNeedsLineStart): More fo the same.
3752 (bracketNeedsLineStart): Ditto.
3753 (branchFindFirstAssertedCharacter): Removed OP_ONCE code.
3754 (bracketFindFirstAssertedCharacter): More of the same.
3755 (calculateCompiledPatternLengthAndFlags): Ditto.
3756 (returnError): Name changes.
3757 (jsRegExpCompile): Ditto.
3759 * pcre/pcre_exec.cpp: Moved some definitions here from pcre_internal.h.
3760 (matchRef): Updated names.
3761 Improved macros to use the do { } while(0) idiom so they expand to single
3762 statements rather than to blocks or multiple statements. And refeactored
3763 the recursive match macros.
3764 (MatchStack::pushNewFrame): Name changes.
3765 (getUTF8CharAndIncrementLength): Name changes.
3766 (match): Name changes. Removed the ONCE opcode.
3767 (jsRegExpExecute): Name changes.
3769 * pcre/pcre_internal.h: Removed quite a few unneeded includes. Rewrote
3770 quite a few comments. Removed the macros that add kjs prefixes to the
3771 functions with external linkage; instead renamed the functions. Removed
3772 the unneeded typedefs pcre_uint16, pcre_uint32, and uschar. Removed the
3773 dead and not-all-working code for LINK_SIZE values other than 2, although
3774 we aim to keep the abstraction working. Removed the OP_LENGTHS macro.
3775 (put2ByteValue): Replaces put2ByteOpcodeValueAtOffset.
3776 (get2ByteValue): Replaces get2ByteOpcodeValueAtOffset.
3777 (put2ByteValueAndAdvance): Replaces put2ByteOpcodeValueAtOffsetAndAdvance.
3778 (putLinkValueAllowZero): Replaces putOpcodeValueAtOffset; doesn't do the
3779 addition, since a comma is really no better than a plus sign. Added an
3780 assertion to catch out of range values and changed the parameter type to
3781 int rather than unsigned.
3782 (getLinkValueAllowZero): Replaces getOpcodeValueAtOffset.
3783 (putLinkValue): New function that most former callers of the
3784 putOpcodeValueAtOffset function can use; asserts the value that is
3785 being stored is non-zero and then calls putLinkValueAllowZero.
3786 (getLinkValue): Ditto.
3787 (putLinkValueAndAdvance): Replaces putOpcodeValueAtOffsetAndAdvance. No
3788 caller was using an offset, which makes sense given the advancing behavior.
3789 (putLinkValueAllowZeroAndAdvance): Ditto.
3790 (isBracketOpcode): Added. For use in an assertion.
3791 (advanceToEndOfBracket): Renamed from moveOpcodePtrPastAnyAlternateBranches,
3792 and removed comments about how it's not well designed. This function takes
3793 a pointer to the beginning of a bracket and advances to the end of the
3796 * pcre/pcre_tables.cpp: Updated names.
3797 * pcre/pcre_ucp_searchfuncs.cpp:
3798 (kjs_pcre_ucp_othercase): Ditto.
3799 * pcre/pcre_xclass.cpp:
3800 (getUTF8CharAndAdvancePointer): Ditto.
3801 (kjs_pcre_xclass): Ditto.
3802 * pcre/ucpinternal.h: Ditto.
3805 (WTF::isASCIIAlpha): Added an int overload, like the one we already have for
3807 (WTF::isASCIIAlphanumeric): Ditto.
3808 (WTF::isASCIIHexDigit): Ditto.
3809 (WTF::isASCIILower): Ditto.
3810 (WTF::isASCIISpace): Ditto.
3811 (WTF::toASCIILower): Ditto.
3812 (WTF::toASCIIUpper): Ditto.
3814 2007-12-16 Darin Adler <darin@apple.com>
3818 - fix http://bugs.webkit.org/show_bug.cgi?id=16459
3819 REGRESSION: assertion failure with regexp with \B in a case-ignoring character range
3820 <rdar://problem/5646361>
3822 The problem was that \B was not handled properly in character classes.
3824 Test: fast/js/regexp-overflow.html
3826 * pcre/pcre_compile.cpp:
3827 (check_escape): Added handling of ESC_b and ESC_B in character classes here.
3828 Allows us to get rid of the handling of \b in character classes from all the
3829 call sites that handle it separately and to handle \B properly as well.
3830 (compileBranch): Remove the ESC_b handling, since it's not needed any more.
3831 (calculateCompiledPatternLengthAndFlags): Ditto.
3833 2007-12-16 Mark Rowe <mrowe@apple.com>
3835 Reviewed by Maciej Stachowiak.
3837 Fix http://bugs.webkit.org/show_bug.cgi?id=16448
3838 Bug 16448: [GTK] Celtic Kane JavaScript performance on Array test is slow relative to Mac
3840 * kjs/array_instance.cpp:
3841 (KJS::compareByStringPairForQSort):
3842 (KJS::ArrayInstance::sort): Convert JSValue's to strings once up front and then sort the
3843 results. This avoids calling toString twice per comparison, but requires a temporary buffer
3844 so we only use this approach in cases where the array being sorted is not too large.
3846 2007-12-16 Geoffrey Garen <ggaren@apple.com>
3848 Reviewed by Darin Adler and Maciej Stachowiak.
3850 More refactoring to support global variable optimization.
3852 Changed SymbolTable to use RefPtr<UString::Rep> as its key instead of
3853 UString::Rep*. With globals, the symbol table can outlast the
3854 declaration node for any given symbol, so the symbol table needs to ref
3857 In support, specialized HashMaps with RefPtr keys to allow lookup
3858 via raw pointer, avoiding refcount churn.
3860 SunSpider reports a .6% speedup (prolly just noise).
3862 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added new file: wtf/RefPtrHashMap.h
3863 * JavaScriptCore.xcodeproj/project.pbxproj: ditto
3865 * kjs/JSVariableObject.cpp:
3866 (KJS::JSVariableObject::getPropertyNames): Symbol table keys are RefPtrs now.
3868 * kjs/SymbolTable.h: Modified key traits to match RefPtr. Added a
3869 static Rep* for null, which helps compute the deletedValue() trait.
3871 * wtf/HashMap.h: #include the RefPtr specialization so everyone can use it.
3873 * wtf/RefPtrHashMap.h: Copied from wtf/HashMap.h. Added overloaded versions
3874 of find(), contains(), get(), set(), add(), remove(), and take() that take
3875 raw pointers as keys.
3877 2007-12-16 Alexey Proskuryakov <ap@webkit.org>
3881 http://bugs.webkit.org/show_bug.cgi?id=16162
3882 Problems with float parsing on Linux (locale-dependent parsing was used).
3884 * kjs/dtoa.cpp: Removed USE_LOCALE to reduce future confusion.
3885 * kjs/lexer.cpp: (KJS::Lexer::lex): Parse with kjs_strtod, not the system one.
3887 2007-12-14 Alp Toker <alp@atoker.com>
3889 Reviewed by Mark Rowe.
3891 Enable the AllInOneFile.cpp optimization for the GTK+ port.
3893 * JavaScriptCore.pri:
3895 2007-12-14 Mark Rowe <mrowe@apple.com>
3897 Unreviewed. Remove commented out fprintf's that were for debugging purposes only.
3899 * wtf/FastMalloc.cpp:
3900 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
3902 2007-12-14 Mark Rowe <mrowe@apple.com>
3904 Reviewed by Maciej Stachowiak.
3906 Don't use the MADV_DONTNEED code path for now as it has no effect on Mac OS X and is
3907 currently untested on other platforms.
3909 * wtf/TCSystemAlloc.cpp:
3910 (TCMalloc_SystemRelease): Return after releasing memory rather than potentially falling
3911 through into another mechanism if multiple are supported.
3913 2007-12-14 Alp Toker <alp@atoker.com>
3915 Build fix for GTK+/Qt and ports that don't use AllInOneFile.cpp.
3917 Include UnusedParam.h.
3919 * wtf/TCSystemAlloc.cpp:
3921 2007-12-14 Oliver Hunt <oliver@apple.com>
3923 Reviewed by Stephanie.
3925 Fix build on windows
3927 * wtf/FastMalloc.cpp:
3928 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
3930 2007-12-14 Dan Bernstein <mitz@apple.com>
3932 - try again to fix the Windows build
3934 * wtf/TCSystemAlloc.cpp:
3935 (TCMalloc_SystemRelease):
3937 2007-12-14 Dan Bernstein <mitz@apple.com>
3939 - try to fix the Windows build
3941 * wtf/TCSystemAlloc.cpp:
3942 (TCMalloc_SystemRelease):
3944 2007-12-14 Mark Rowe <mrowe@apple.com>
3946 Reviewed by Maciej and Oliver.
3948 Add final changes to make TCMalloc release memory to the system.
3949 This results in a 0.4% regression against ToT, but this is offset
3950 against the gains made by the original TCMalloc r38 merge - in fact
3951 we retain around 0.3-0.4% progression overall.
3953 * wtf/FastMalloc.cpp:
3954 (WTF::InitSizeClasses):
3955 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
3956 * wtf/TCSystemAlloc.cpp:
3957 (TCMalloc_SystemRelease):
3959 2007-12-14 Darin Adler <darin@apple.com>
3963 - removed unnecessary includes of "Vector.h"
3966 (WTF::copyKeysToVector): Make the type of the vector be a template parameter.
3967 This allows copying keys into a vector of a base class or one with an inline capacity.
3968 (WTF::copyValuesToVector): Ditto.
3970 (WTF::copyToVector): Ditto.
3972 2007-12-14 Anders Carlsson <andersca@apple.com>
3974 Reviewed by Darin and Geoff.
3976 <rdar://problem/5619295>
3977 REGRESSION: 303-304: Embedded YouTube video fails to render- JS errors (16150) (Flash 9)
3979 Get rid of unnecessary and incorrect security checks for plug-ins accessing JavaScript objects.
3981 The way this used to work was that each NPObject that wrapped a JSObject would have a root object
3982 corresponding to the frame object (used for managing the lifecycle) and an origin root object (used for
3983 doing security checks).
3985 This would prevent a plug-in from accessing a frame's window object if it's security origin was different
3986 (some parts of the window, such as the location object, can be accessed from frames with different security
3987 origins, and those checks are being done in WebCore).
3989 Also, if a plug-in were to access a window object of a frame that later went away, it could lead to that
3990 Window JSObject being garbage collected and the NPObject pointing to freed memory.
3992 How this works now is that there is no origin root object anymore, and all NPObject wrappers that are created
3993 for a plug-in will have the root object of the containing frame of that plug-in.
3995 * bindings/NP_jsobject.cpp:
3997 Don't free the origin root object.
3999 (_NPN_CreateScriptObject):
4000 Remove the origin root object parameter.
4002 (_NPN_InvokeDefault):
4007 (_NPN_RemoveProperty):
4011 Get rid of all security checks.
4013 * bindings/NP_jsobject.h:
4014 Remove originRootObject from the JavaScriptObject struct.
4016 * bindings/c/c_utility.cpp:
4017 (KJS::Bindings::convertValueToNPVariant):
4018 Always use the root object from the ExecState.
4020 2007-12-13 Steve Falkenburg <sfalken@apple.com>
4022 Move source file generation into its own vcproj to fix build dependencies.
4026 * JavaScriptCore.vcproj/JavaScriptCore.sln:
4027 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4028 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Added.
4029 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Added.
4030 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
4032 2007-12-13 Alp Toker <alp@atoker.com>
4034 http://bugs.webkit.org/show_bug.cgi?id=16406
4035 [Gtk] JavaScriptCore needs -lpthread
4037 Build fix for Debian and any other platforms that don't implicitly
4040 Link to pthread on non-Windows platforms until this dependency is
4043 2007-12-11 Geoffrey Garen <ggaren@apple.com>
4045 Reviewed by Sam Weinig.
4047 Build fix: Note some variables that are used only for ASSERTs.
4051 (globalObject_initialize):
4052 (testInitializeFinalize):
4054 2007-12-11 Geoffrey Garen <ggaren@apple.com>
4056 Reviewed by Darin Adler.
4058 Fixed: All JS tests crash on Windows.
4060 NDEBUG wasn't defined when compiling testkjs in release builds, so the
4061 HashTable definition in HashTable.h included an extra data member.
4063 The solution was to add NDEBUG to the release testkjs configuration on
4066 For giggles, I also added other missing #defines to testkjs on Windows.
4068 * Configurations/Base.xcconfig:
4069 * Configurations/JavaScriptCore.xcconfig:
4070 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
4071 * JavaScriptCore.xcodeproj/project.pbxproj:
4075 2007-12-11 Geoffrey Garen <ggaren@apple.com>
4077 Reviewed by Darin Adler.
4079 Removed bogus ASSERT.
4081 ASSERT should only be used when we know that a code path will not be
4082 taken. This code path is taken often during the jsFunFuzz test.
4084 * pcre/pcre_exec.cpp:
4087 2007-12-11 Darin Adler <darin@apple.com>
4089 * wtf/unicode/qt4/UnicodeQt4.h: Try to fix Qt build by adding U16_IS_SINGLE.
4091 2007-12-10 Darin Adler <darin@apple.com>
4093 Reviewed by Sam Weinig.
4095 - fix http://bugs.webkit.org/show_bug.cgi?id=16379
4096 REGRESSION(r28525): Failures in http/tests/xmlhttprequest/response-encoding.html and
4097 fast/dom/xmlhttprequest-html-response-encoding.html
4098 and <rdar://problem/5640230> REGRESSION (306A4-ToT): Access violation in PCRE function
4099 find_firstassertedchar
4101 Test: fast/js/regexp-find-first-asserted.html
4103 * pcre/pcre_compile.cpp:
4104 (compileBracket): Take out unnecessary initialization of out parameters.
4105 (branchFindFirstAssertedCharacter): Added. Broke out the half of the function that handles
4107 (bracketFindFirstAssertedCharacter): Renamed from find_firstassertedchar. Also removed the
4108 options parameter -- the caller can handle the options.
4109 (jsRegExpCompile): Changed call site to call the appropriate bracket or branch version of
4110 the find_firstassertedchar function. Also put the REQ_IGNORE_CASE code here instead of
4111 passing in the options.
4113 2007-12-10 Geoffrey Garen <ggaren@apple.com>
4115 Reviewed by Sam Weinig.