2008-06-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2008-06-17  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2
3         Reviewed by Oliver.
4
5         Reduce code duplication in emitReadModifyAssignment().
6
7         * kjs/nodes.cpp:
8         (KJS::emitReadModifyAssignment):
9
10 2008-06-17  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
11
12         Reviewed by Oliver.
13
14         Sort includes alphabetically.
15
16         * kjs/nodes.cpp:
17
18 2008-06-16  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
19
20         Reviewed by Maciej.
21
22         Bug 19596: LEAK: Gmail leaks SegmentedVector<RegisterID>
23         <https://bugs.webkit.org/show_bug.cgi?id=19596>
24
25         When growing SegmentedVector, we start adding segments at the position
26         of the last segment, overwriting it. The destructor frees allocated
27         segments starting at the segment of index 1, because the segment of
28         index 0 is assumed to be the initial inline segment. This causes a leak
29         of the segment that is referenced by index 0. Modifying grow() so that
30         it starts adding segments at the position after the last segment fixes
31         the leak.
32
33         Since the initial segment is a special case in the lookup code, this
34         bug never manifested itself via incorrect results.
35
36         * VM/SegmentedVector.h:
37         (KJS::SegmentedVector::grow):
38
39 2008-06-16  Maciej Stachowiak  <mjs@apple.com>
40
41         Reviewed by Alexey.
42         
43         - removed nearly unused types.h and LocalStorageEntry.h headers
44
45         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
46         * JavaScriptCore.xcodeproj/project.pbxproj:
47         * kjs/ExecState.h:
48         * kjs/LocalStorageEntry.h: Removed.
49         * kjs/RegExpObject.cpp:
50         * kjs/error_object.cpp:
51         * kjs/grammar.y:
52         * kjs/nodes.cpp:
53         * kjs/types.h: Removed.
54
55 2008-06-16  Alp Toker  <alp@nuanti.com>
56
57         Rubber-stamped by Geoff.
58
59         Change c++ to c in minidom and testapi emacs mode line comments.
60
61         * API/Node.h:
62         * API/NodeList.c:
63         * API/NodeList.h:
64         * API/testapi.c:
65
66 2008-06-16  Alexey Proskuryakov  <ap@webkit.org>
67
68         Trying to fix Windows build.
69
70         * kjs/PropertyNameArray.h:
71         * kjs/identifier.cpp:
72         Include ExecState.h
73
74 2008-06-16  Geoffrey Garen  <ggaren@apple.com>
75
76         Reviewed by Oliver Hunt.
77         
78         Slight cleanup to the SymbolTableEntry class.
79         
80         Renamed isEmpty to isNull, since we usually use "empty" to mean "holds
81         the valid, empty value", and "null" to mean "holds no value".
82         
83         Changed an "== 0" to a "!", to match our style guidelines.
84         
85         Added some ASSERTs to verify the (possibly questionable) assumption that
86         all register indexes will have their high two bits set. Also clarified a
87         comment to make that assumption clear.
88
89 2008-06-16  Alexey Proskuryakov  <ap@webkit.org>
90
91         Reviewed by Darin.
92
93         Initialize functionQueueMutex in a safe manner.
94
95         * wtf/MainThread.cpp:
96         (WTF::functionQueueMutex): Made it an AtomicallyInitializedStatic.
97
98         (WTF::dispatchFunctionsFromMainThread):
99         (WTF::setMainThreadCallbacksPaused):
100         Assert that the current thread is main, meaning that the callbacksPaused static can be
101         accessed.
102
103 2008-06-16  Alexey Proskuryakov  <ap@webkit.org>
104
105         Reviewed by Geoff Garen.
106
107         Make Identifier construction use an explicitly passed IdentifierTable.
108
109         No change on SunSpider total.
110
111         * API/JSCallbackObjectFunctions.h:
112         (KJS::::getOwnPropertySlot):
113         (KJS::::put):
114         (KJS::::deleteProperty):
115         (KJS::::getPropertyNames):
116         * API/JSObjectRef.cpp:
117         (JSObjectMakeFunctionWithCallback):
118         (JSObjectMakeFunction):
119         (JSObjectHasProperty):
120         (JSObjectGetProperty):
121         (JSObjectSetProperty):
122         (JSObjectDeleteProperty):
123         (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
124         (JSObjectCopyPropertyNames):
125         * JavaScriptCore.exp:
126         * VM/CodeGenerator.cpp:
127         (KJS::CodeGenerator::CodeGenerator):
128         (KJS::CodeGenerator::registerForLocal):
129         (KJS::CodeGenerator::isLocal):
130         (KJS::CodeGenerator::addConstant):
131         (KJS::CodeGenerator::findScopedProperty):
132         * VM/CodeGenerator.h:
133         (KJS::CodeGenerator::globalData):
134         (KJS::CodeGenerator::propertyNames):
135         * VM/JSPropertyNameIterator.cpp:
136         (KJS::JSPropertyNameIterator::create):
137         * VM/Machine.cpp:
138         (KJS::Machine::throwException):
139         (KJS::Machine::privateExecute):
140         * kjs/ArrayPrototype.cpp:
141         (KJS::ArrayConstructor::ArrayConstructor):
142         * kjs/BooleanObject.cpp:
143         (KJS::BooleanConstructor::BooleanConstructor):
144         * kjs/FunctionPrototype.cpp:
145         (KJS::FunctionConstructor::FunctionConstructor):
146         (KJS::FunctionConstructor::construct):
147         * kjs/JSArray.cpp:
148         (KJS::JSArray::inlineGetOwnPropertySlot):
149         (KJS::JSArray::put):
150         (KJS::JSArray::deleteProperty):
151         (KJS::JSArray::getPropertyNames):
152         * kjs/JSFunction.cpp:
153         (KJS::Arguments::Arguments):
154         * kjs/JSGlobalData.cpp:
155         (KJS::JSGlobalData::JSGlobalData):
156         * kjs/JSGlobalObject.cpp:
157         (KJS::JSGlobalObject::reset):
158         * kjs/JSObject.cpp:
159         (KJS::JSObject::getOwnPropertySlot):
160         (KJS::JSObject::put):
161         (KJS::JSObject::putWithAttributes):
162         (KJS::JSObject::deleteProperty):
163         (KJS::JSObject::findPropertyHashEntry):
164         (KJS::JSObject::getPropertyNames):
165         (KJS::Error::create):
166         * kjs/JSVariableObject.cpp:
167         (KJS::JSVariableObject::getPropertyNames):
168         * kjs/NumberObject.cpp:
169         (KJS::NumberConstructor::NumberConstructor):
170         * kjs/PropertyNameArray.cpp:
171         (KJS::PropertyNameArray::add):
172         * kjs/PropertyNameArray.h:
173         (KJS::PropertyNameArray::PropertyNameArray):
174         (KJS::PropertyNameArray::addKnownUnique):
175         * kjs/PropertySlot.h:
176         (KJS::PropertySlot::getValue):
177         * kjs/RegExpObject.cpp:
178         (KJS::RegExpConstructor::RegExpConstructor):
179         * kjs/ScopeChain.cpp:
180         (KJS::ScopeChainNode::print):
181         * kjs/Shell.cpp:
182         (GlobalObject::GlobalObject):
183         * kjs/date_object.cpp:
184         (KJS::DateConstructor::DateConstructor):
185         * kjs/error_object.cpp:
186         (KJS::ErrorConstructor::ErrorConstructor):
187         (KJS::NativeErrorConstructor::NativeErrorConstructor):
188         * kjs/grammar.y:
189         * kjs/identifier.cpp:
190         (KJS::Identifier::add):
191         (KJS::Identifier::addSlowCase):
192         * kjs/identifier.h:
193         (KJS::Identifier::Identifier):
194         (KJS::Identifier::from):
195         (KJS::Identifier::equal):
196         (KJS::Identifier::add):
197         (KJS::operator==):
198         (KJS::operator!=):
199         * kjs/internal.cpp:
200         (KJS::JSString::getOwnPropertySlot):
201         * kjs/lexer.cpp:
202         (KJS::Lexer::Lexer):
203         (KJS::Lexer::lex):
204         (KJS::Lexer::makeIdentifier):
205         * kjs/lexer.h:
206         * kjs/lookup.cpp:
207         (KJS::HashTable::createTable):
208         * kjs/lookup.h:
209         (KJS::HashTable::initializeIfNeeded):
210         (KJS::HashTable::entry):
211         (KJS::getStaticPropertySlot):
212         (KJS::getStaticFunctionSlot):
213         (KJS::getStaticValueSlot):
214         (KJS::lookupPut):
215         * kjs/object_object.cpp:
216         (KJS::objectProtoFuncHasOwnProperty):
217         (KJS::objectProtoFuncDefineGetter):
218         (KJS::objectProtoFuncDefineSetter):
219         (KJS::objectProtoFuncLookupGetter):
220         (KJS::objectProtoFuncLookupSetter):
221         (KJS::objectProtoFuncPropertyIsEnumerable):
222         (KJS::ObjectConstructor::ObjectConstructor):
223         * kjs/string_object.cpp:
224         (KJS::StringObject::getOwnPropertySlot):
225         (KJS::StringObject::getPropertyNames):
226         (KJS::StringConstructor::StringConstructor):
227         Just pass ExecState or JSGlobalData everywhere. Identifier construction is now always
228         explicit.
229
230         * kjs/nodes.cpp: (KJS::RegExpNode::emitCode): Here, Identifier was created from a non-literal
231         char*, which was incorrect, as that uses the pointer value as a key.
232
233 2008-06-16  Thiago Macieira  <tjmaciei@trolltech.com>
234
235         Reviewed by Darin.
236
237         https://bugs.webkit.org/show_bug.cgi?id=19577
238
239         Fix compilation in C++ environments where C99 headers are not present
240
241         The stdbool.h header is a C99 feature, defining the "_Bool" type as well as the
242         "true" and "false" constants. But it's completely unnecessary in C++ as the
243         language already defines the "bool" type and its two values.
244
245         * API/JSBase.h:
246         * API/JSContextRef.h:
247         * API/JSObjectRef.h:
248         * API/JSStringRef.h:
249         * API/JSValueRef.h:
250
251 2008-06-16  Kevin McCullough  <kmccullough@apple.com>
252
253         Reviewed by John.
254
255         <rdar://problem/6012509> JSProfiler: %s are incorrect if you exclude a
256         top level node like (idle)
257
258         * profiler/Profile.cpp:
259         (KJS::Profile::focus):
260         (KJS::Profile::exclude): Subtract the selfTime from the totalTime of the
261         head since its self time will only be non-zero when one of its children
262         were excluded. Since the head's totalTime is used to calculate %s when
263         its totalTime is the same as the sum of all its visible childrens' times
264         their %s will sum to 100%.
265
266 2008-06-16  Kevin McCullough  <kmccullough@apple.com>
267
268         Reviewed by Sam Weinig.
269
270         <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the profiler.
271
272         * profiler/Profile.cpp:
273         (KJS::Profile::willExecute):
274
275 2008-06-16  Kevin McCullough  <kmccullough@apple.com>
276
277         Reviewed by Sam.
278
279         <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
280         profiler.
281         - Remove the last of the uses of recursion in the profiler.
282
283         * JavaScriptCore.exp: Export the new function's signature.
284         * profiler/Profile.cpp: 
285         (KJS::calculateVisibleTotalTime): Added a new static method for
286         recalculating the visibleTotalTime of methods after focus has changed
287         which are visible.
288         (KJS::stopProfiling): 
289         (KJS::Profile::focus): Implemented focus without recursion.
290         * profiler/Profile.h: Moved implementation into the definition file.
291         * profiler/ProfileNode.cpp:
292         (KJS::ProfileNode::traverseNextNodePreOrder): Added an argument for
293         whether or not to process the children nodes, this allows focus to skip
294         sub trees which have been set as not visible.
295         (KJS::ProfileNode::calculateVisibleTotalTime): This function set's a
296         node's total visible time to the sum of its self time and its children's
297         total times.
298         (KJS::ProfileNode::focus): Implemented focus without recursion.
299         * profiler/ProfileNode.h:
300         (KJS::CallIdentifier::operator!= ):
301         (KJS::ProfileNode::setActualTotalTime): Expanded setting the total time
302         so that focus could modify only the visible total time.
303         (KJS::ProfileNode::setVisibleTotalTime):
304
305 2008-06-16  Christian Dywan  <christian@twotoasts.de>
306
307         Reviewed by Sam.
308
309         https://bugs.webkit.org/show_bug.cgi?id=19552
310         JavaScriptCore headers use C++ style comments
311
312         Replace all C++ style comments with C style multiline
313         comments and remove all "mode" lines.
314
315         * API/JSBase.h:
316         * API/JSClassRef.h:
317         * API/JSContextRef.h:
318         * API/JSObjectRef.h:
319         * API/JSStringRef.h:
320         * API/JSStringRefBSTR.h:
321         * API/JSStringRefCF.h:
322         * API/JSValueRef.h:
323         * API/JavaScript.h:
324         * API/JavaScriptCore.h:
325
326 2008-06-16  Christian Dywan  <christian@twotoasts.de>
327
328         Reviewed by Sam.
329
330         https://bugs.webkit.org/show_bug.cgi?id=19557
331         (JavaScriptCore) minidom uses C++ style comments
332
333         Use only C style comments in minidom sources
334
335         * API/JSNode.c:
336         (JSNode_appendChild):
337         (JSNode_removeChild):
338         * API/JSNode.h:
339         * API/JSNodeList.c:
340         (JSNodeList_getProperty):
341         * API/JSNodeList.h:
342         * API/Node.c:
343         * API/Node.h:
344         * API/NodeList.c:
345         (NodeList_new):
346         (NodeList_item):
347         * API/NodeList.h:
348         * API/minidom.c:
349         (createStringWithContentsOfFile):
350         * wtf/Assertions.h:
351         * wtf/UnusedParam.h:
352
353 2008-06-16  Adriaan de Groot  <groot@kde.org>
354
355         Reviewed by Simon.
356
357         Fix compilation on Solaris
358
359         On some systems, munmap takes a char* instead of a void* (contrary to POSIX and
360         Single Unix Specification). Since you can always convert from char* to void*
361         but not vice-versa, do the casting to char*.
362
363         * kjs/collector.cpp:
364         (KJS::allocateBlock):
365         (KJS::freeBlock):
366
367 2008-06-16  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
368
369         Reviewed by Maciej.
370
371         Make a UnaryOpNode class to reduce boilerplate code for UnaryPlusNode,
372         NegateNode, BitwiseNotNode, and LogicalNotNode.
373
374         * VM/CodeGenerator.h:
375         (KJS::CodeGenerator::emitToJSNumber):
376         * kjs/nodes.cpp:
377         (KJS::UnaryOpNode::emitCode):
378         * kjs/nodes.h:
379         (KJS::UnaryOpNode::UnaryOpNode):
380         (KJS::UnaryPlusNode::):
381         (KJS::NegateNode::):
382         (KJS::NegateNode::precedence):
383         (KJS::BitwiseNotNode::):
384         (KJS::BitwiseNotNode::precedence):
385         (KJS::LogicalNotNode::):
386         (KJS::LogicalNotNode::precedence):
387
388 2008-06-16  Jan Michael Alonzo  <jmalonzo@webkit.org>
389
390         Gtk build fix
391
392         * GNUmakefile.am:
393
394 2008-06-15  Darin Adler  <darin@apple.com>
395
396         - rename KJS::List to KJS::ArgList
397
398         * API/JSCallbackConstructor.cpp:
399         (KJS::JSCallbackConstructor::construct):
400         * API/JSCallbackConstructor.h:
401         * API/JSCallbackFunction.cpp:
402         (KJS::JSCallbackFunction::callAsFunction):
403         * API/JSCallbackFunction.h:
404         * API/JSCallbackObject.h:
405         * API/JSCallbackObjectFunctions.h:
406         (KJS::::construct):
407         (KJS::::callAsFunction):
408         * API/JSObjectRef.cpp:
409         (JSObjectMakeFunction):
410         (JSObjectCallAsFunction):
411         (JSObjectCallAsConstructor):
412         * JavaScriptCore.exp:
413         * VM/Machine.cpp:
414         (KJS::Machine::execute):
415         (KJS::Machine::privateExecute):
416         * VM/Machine.h:
417         * kjs/ArrayPrototype.cpp:
418         (KJS::arrayProtoFuncToString):
419         (KJS::arrayProtoFuncToLocaleString):
420         (KJS::arrayProtoFuncJoin):
421         (KJS::arrayProtoFuncConcat):
422         (KJS::arrayProtoFuncPop):
423         (KJS::arrayProtoFuncPush):
424         (KJS::arrayProtoFuncReverse):
425         (KJS::arrayProtoFuncShift):
426         (KJS::arrayProtoFuncSlice):
427         (KJS::arrayProtoFuncSort):
428         (KJS::arrayProtoFuncSplice):
429         (KJS::arrayProtoFuncUnShift):
430         (KJS::arrayProtoFuncFilter):
431         (KJS::arrayProtoFuncMap):
432         (KJS::arrayProtoFuncEvery):
433         (KJS::arrayProtoFuncForEach):
434         (KJS::arrayProtoFuncSome):
435         (KJS::arrayProtoFuncIndexOf):
436         (KJS::arrayProtoFuncLastIndexOf):
437         (KJS::ArrayConstructor::construct):
438         (KJS::ArrayConstructor::callAsFunction):
439         * kjs/ArrayPrototype.h:
440         * kjs/BooleanObject.cpp:
441         (KJS::booleanProtoFuncToString):
442         (KJS::booleanProtoFuncValueOf):
443         (KJS::BooleanConstructor::construct):
444         (KJS::BooleanConstructor::callAsFunction):
445         * kjs/BooleanObject.h:
446         * kjs/CommonIdentifiers.h:
447         * kjs/ExecState.h:
448         (KJS::ExecState::emptyList):
449         * kjs/FunctionPrototype.cpp:
450         (KJS::FunctionPrototype::callAsFunction):
451         (KJS::functionProtoFuncToString):
452         (KJS::functionProtoFuncApply):
453         (KJS::functionProtoFuncCall):
454         (KJS::FunctionConstructor::construct):
455         (KJS::FunctionConstructor::callAsFunction):
456         * kjs/FunctionPrototype.h:
457         * kjs/JSActivation.cpp:
458         (KJS::JSActivation::createArgumentsObject):
459         * kjs/JSArray.cpp:
460         (KJS::JSArray::JSArray):
461         (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
462         * kjs/JSArray.h:
463         * kjs/JSFunction.cpp:
464         (KJS::JSFunction::callAsFunction):
465         (KJS::JSFunction::construct):
466         (KJS::IndexToNameMap::IndexToNameMap):
467         (KJS::Arguments::Arguments):
468         (KJS::encode):
469         (KJS::decode):
470         (KJS::globalFuncEval):
471         (KJS::globalFuncParseInt):
472         (KJS::globalFuncParseFloat):
473         (KJS::globalFuncIsNaN):
474         (KJS::globalFuncIsFinite):
475         (KJS::globalFuncDecodeURI):
476         (KJS::globalFuncDecodeURIComponent):
477         (KJS::globalFuncEncodeURI):
478         (KJS::globalFuncEncodeURIComponent):
479         (KJS::globalFuncEscape):
480         (KJS::globalFuncUnescape):
481         (KJS::globalFuncKJSPrint):
482         (KJS::PrototypeFunction::callAsFunction):
483         (KJS::PrototypeReflexiveFunction::callAsFunction):
484         * kjs/JSFunction.h:
485         * kjs/JSGlobalData.h:
486         * kjs/JSImmediate.cpp:
487         (KJS::JSImmediate::toObject):
488         * kjs/JSNotAnObject.cpp:
489         (KJS::JSNotAnObject::construct):
490         (KJS::JSNotAnObject::callAsFunction):
491         * kjs/JSNotAnObject.h:
492         * kjs/JSObject.cpp:
493         (KJS::JSObject::put):
494         (KJS::JSObject::construct):
495         (KJS::JSObject::callAsFunction):
496         (KJS::Error::create):
497         * kjs/JSObject.h:
498         * kjs/MathObject.cpp:
499         (KJS::mathProtoFuncAbs):
500         (KJS::mathProtoFuncACos):
501         (KJS::mathProtoFuncASin):
502         (KJS::mathProtoFuncATan):
503         (KJS::mathProtoFuncATan2):
504         (KJS::mathProtoFuncCeil):
505         (KJS::mathProtoFuncCos):
506         (KJS::mathProtoFuncExp):
507         (KJS::mathProtoFuncFloor):
508         (KJS::mathProtoFuncLog):
509         (KJS::mathProtoFuncMax):
510         (KJS::mathProtoFuncMin):
511         (KJS::mathProtoFuncPow):
512         (KJS::mathProtoFuncRandom):
513         (KJS::mathProtoFuncRound):
514         (KJS::mathProtoFuncSin):
515         (KJS::mathProtoFuncSqrt):
516         (KJS::mathProtoFuncTan):
517         * kjs/MathObject.h:
518         * kjs/NumberObject.cpp:
519         (KJS::numberProtoFuncToString):
520         (KJS::numberProtoFuncToLocaleString):
521         (KJS::numberProtoFuncValueOf):
522         (KJS::numberProtoFuncToFixed):
523         (KJS::numberProtoFuncToExponential):
524         (KJS::numberProtoFuncToPrecision):
525         (KJS::NumberConstructor::construct):
526         (KJS::NumberConstructor::callAsFunction):
527         * kjs/NumberObject.h:
528         * kjs/RegExpObject.cpp:
529         (KJS::regExpProtoFuncTest):
530         (KJS::regExpProtoFuncExec):
531         (KJS::regExpProtoFuncCompile):
532         (KJS::regExpProtoFuncToString):
533         (KJS::RegExpObject::match):
534         (KJS::RegExpObject::test):
535         (KJS::RegExpObject::exec):
536         (KJS::RegExpObject::callAsFunction):
537         (KJS::RegExpConstructor::construct):
538         (KJS::RegExpConstructor::callAsFunction):
539         * kjs/RegExpObject.h:
540         * kjs/Shell.cpp:
541         (functionPrint):
542         (functionDebug):
543         (functionGC):
544         (functionVersion):
545         (functionRun):
546         (functionLoad):
547         (functionReadline):
548         (functionQuit):
549         * kjs/collector.cpp:
550         (KJS::Collector::collect):
551         * kjs/collector.h:
552         (KJS::Collector::markListSet):
553         * kjs/date_object.cpp:
554         (KJS::formatLocaleDate):
555         (KJS::fillStructuresUsingTimeArgs):
556         (KJS::fillStructuresUsingDateArgs):
557         (KJS::DateConstructor::construct):
558         (KJS::DateConstructor::callAsFunction):
559         (KJS::DateFunction::callAsFunction):
560         (KJS::dateProtoFuncToString):
561         (KJS::dateProtoFuncToUTCString):
562         (KJS::dateProtoFuncToDateString):
563         (KJS::dateProtoFuncToTimeString):
564         (KJS::dateProtoFuncToLocaleString):
565         (KJS::dateProtoFuncToLocaleDateString):
566         (KJS::dateProtoFuncToLocaleTimeString):
567         (KJS::dateProtoFuncValueOf):
568         (KJS::dateProtoFuncGetTime):
569         (KJS::dateProtoFuncGetFullYear):
570         (KJS::dateProtoFuncGetUTCFullYear):
571         (KJS::dateProtoFuncToGMTString):
572         (KJS::dateProtoFuncGetMonth):
573         (KJS::dateProtoFuncGetUTCMonth):
574         (KJS::dateProtoFuncGetDate):
575         (KJS::dateProtoFuncGetUTCDate):
576         (KJS::dateProtoFuncGetDay):
577         (KJS::dateProtoFuncGetUTCDay):
578         (KJS::dateProtoFuncGetHours):
579         (KJS::dateProtoFuncGetUTCHours):
580         (KJS::dateProtoFuncGetMinutes):
581         (KJS::dateProtoFuncGetUTCMinutes):
582         (KJS::dateProtoFuncGetSeconds):
583         (KJS::dateProtoFuncGetUTCSeconds):
584         (KJS::dateProtoFuncGetMilliSeconds):
585         (KJS::dateProtoFuncGetUTCMilliseconds):
586         (KJS::dateProtoFuncGetTimezoneOffset):
587         (KJS::dateProtoFuncSetTime):
588         (KJS::setNewValueFromTimeArgs):
589         (KJS::setNewValueFromDateArgs):
590         (KJS::dateProtoFuncSetMilliSeconds):
591         (KJS::dateProtoFuncSetUTCMilliseconds):
592         (KJS::dateProtoFuncSetSeconds):
593         (KJS::dateProtoFuncSetUTCSeconds):
594         (KJS::dateProtoFuncSetMinutes):
595         (KJS::dateProtoFuncSetUTCMinutes):
596         (KJS::dateProtoFuncSetHours):
597         (KJS::dateProtoFuncSetUTCHours):
598         (KJS::dateProtoFuncSetDate):
599         (KJS::dateProtoFuncSetUTCDate):
600         (KJS::dateProtoFuncSetMonth):
601         (KJS::dateProtoFuncSetUTCMonth):
602         (KJS::dateProtoFuncSetFullYear):
603         (KJS::dateProtoFuncSetUTCFullYear):
604         (KJS::dateProtoFuncSetYear):
605         (KJS::dateProtoFuncGetYear):
606         * kjs/date_object.h:
607         * kjs/debugger.h:
608         * kjs/error_object.cpp:
609         (KJS::errorProtoFuncToString):
610         (KJS::ErrorConstructor::construct):
611         (KJS::ErrorConstructor::callAsFunction):
612         (KJS::NativeErrorConstructor::construct):
613         (KJS::NativeErrorConstructor::callAsFunction):
614         * kjs/error_object.h:
615         * kjs/internal.cpp:
616         (KJS::JSNumberCell::toObject):
617         (KJS::JSNumberCell::toThisObject):
618         * kjs/list.cpp:
619         (KJS::ArgList::getSlice):
620         (KJS::ArgList::markLists):
621         (KJS::ArgList::slowAppend):
622         * kjs/list.h:
623         (KJS::ArgList::ArgList):
624         (KJS::ArgList::~ArgList):
625         * kjs/object_object.cpp:
626         (KJS::objectProtoFuncValueOf):
627         (KJS::objectProtoFuncHasOwnProperty):
628         (KJS::objectProtoFuncIsPrototypeOf):
629         (KJS::objectProtoFuncDefineGetter):
630         (KJS::objectProtoFuncDefineSetter):
631         (KJS::objectProtoFuncLookupGetter):
632         (KJS::objectProtoFuncLookupSetter):
633         (KJS::objectProtoFuncPropertyIsEnumerable):
634         (KJS::objectProtoFuncToLocaleString):
635         (KJS::objectProtoFuncToString):
636         (KJS::ObjectConstructor::construct):
637         (KJS::ObjectConstructor::callAsFunction):
638         * kjs/object_object.h:
639         * kjs/string_object.cpp:
640         (KJS::replace):
641         (KJS::stringProtoFuncToString):
642         (KJS::stringProtoFuncValueOf):
643         (KJS::stringProtoFuncCharAt):
644         (KJS::stringProtoFuncCharCodeAt):
645         (KJS::stringProtoFuncConcat):
646         (KJS::stringProtoFuncIndexOf):
647         (KJS::stringProtoFuncLastIndexOf):
648         (KJS::stringProtoFuncMatch):
649         (KJS::stringProtoFuncSearch):
650         (KJS::stringProtoFuncReplace):
651         (KJS::stringProtoFuncSlice):
652         (KJS::stringProtoFuncSplit):
653         (KJS::stringProtoFuncSubstr):
654         (KJS::stringProtoFuncSubstring):
655         (KJS::stringProtoFuncToLowerCase):
656         (KJS::stringProtoFuncToUpperCase):
657         (KJS::stringProtoFuncToLocaleLowerCase):
658         (KJS::stringProtoFuncToLocaleUpperCase):
659         (KJS::stringProtoFuncLocaleCompare):
660         (KJS::stringProtoFuncBig):
661         (KJS::stringProtoFuncSmall):
662         (KJS::stringProtoFuncBlink):
663         (KJS::stringProtoFuncBold):
664         (KJS::stringProtoFuncFixed):
665         (KJS::stringProtoFuncItalics):
666         (KJS::stringProtoFuncStrike):
667         (KJS::stringProtoFuncSub):
668         (KJS::stringProtoFuncSup):
669         (KJS::stringProtoFuncFontcolor):
670         (KJS::stringProtoFuncFontsize):
671         (KJS::stringProtoFuncAnchor):
672         (KJS::stringProtoFuncLink):
673         (KJS::StringConstructor::construct):
674         (KJS::StringConstructor::callAsFunction):
675         (KJS::StringConstructorFunction::callAsFunction):
676         * kjs/string_object.h:
677
678 2008-06-15  Darin Adler  <darin@apple.com>
679
680         - new names for more JavaScriptCore files
681
682         * API/JSCallbackFunction.cpp:
683         * API/JSObjectRef.cpp:
684         * DerivedSources.make:
685         * GNUmakefile.am:
686         * JavaScriptCore.exp:
687         * JavaScriptCore.pri:
688         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
689         * JavaScriptCore.xcodeproj/project.pbxproj:
690         * JavaScriptCoreSources.bkl:
691         * VM/Machine.cpp:
692         * kjs/AllInOneFile.cpp:
693         * kjs/ArrayPrototype.cpp: Copied from JavaScriptCore/kjs/array_object.cpp.
694         * kjs/ArrayPrototype.h: Copied from JavaScriptCore/kjs/array_object.h.
695         * kjs/BooleanObject.cpp: Copied from JavaScriptCore/kjs/bool_object.cpp.
696         * kjs/BooleanObject.h: Copied from JavaScriptCore/kjs/bool_object.h.
697         * kjs/ExecState.cpp:
698         * kjs/ExecState.h:
699         * kjs/FunctionPrototype.cpp: Copied from JavaScriptCore/kjs/function_object.cpp.
700         * kjs/FunctionPrototype.h: Copied from JavaScriptCore/kjs/function_object.h.
701         * kjs/JSArray.cpp: Copied from JavaScriptCore/kjs/array_instance.cpp.
702         * kjs/JSArray.h: Copied from JavaScriptCore/kjs/array_instance.h.
703         * kjs/JSFunction.cpp:
704         * kjs/JSFunction.h:
705         * kjs/JSGlobalObject.cpp:
706         * kjs/JSImmediate.cpp:
707         * kjs/JSObject.h:
708         * kjs/JSString.h:
709         * kjs/JSValue.h:
710         * kjs/JSVariableObject.cpp:
711         * kjs/MathObject.cpp: Copied from JavaScriptCore/kjs/math_object.cpp.
712         * kjs/MathObject.h: Copied from JavaScriptCore/kjs/math_object.h.
713         * kjs/NumberObject.cpp: Copied from JavaScriptCore/kjs/number_object.cpp.
714         * kjs/NumberObject.h: Copied from JavaScriptCore/kjs/number_object.h.
715         * kjs/PropertyMap.cpp: Copied from JavaScriptCore/kjs/property_map.cpp.
716         * kjs/PropertyMap.h: Copied from JavaScriptCore/kjs/property_map.h.
717         * kjs/PropertySlot.cpp: Copied from JavaScriptCore/kjs/property_slot.cpp.
718         * kjs/PropertySlot.h: Copied from JavaScriptCore/kjs/property_slot.h.
719         * kjs/RegExpObject.cpp: Copied from JavaScriptCore/kjs/regexp_object.cpp.
720         * kjs/RegExpObject.h: Copied from JavaScriptCore/kjs/regexp_object.h.
721         * kjs/ScopeChain.cpp: Copied from JavaScriptCore/kjs/scope_chain.cpp.
722         * kjs/ScopeChain.h: Copied from JavaScriptCore/kjs/scope_chain.h.
723         * kjs/ScopeChainMark.h: Copied from JavaScriptCore/kjs/scope_chain_mark.h.
724         * kjs/Shell.cpp:
725         * kjs/array_instance.cpp: Removed.
726         * kjs/array_instance.h: Removed.
727         * kjs/array_object.cpp: Removed.
728         * kjs/array_object.h: Removed.
729         * kjs/bool_object.cpp: Removed.
730         * kjs/bool_object.h: Removed.
731         * kjs/error_object.h:
732         * kjs/function_object.cpp: Removed.
733         * kjs/function_object.h: Removed.
734         * kjs/internal.cpp:
735         * kjs/math_object.cpp: Removed.
736         * kjs/math_object.h: Removed.
737         * kjs/nodes.cpp:
738         * kjs/number_object.cpp: Removed.
739         * kjs/number_object.h: Removed.
740         * kjs/object_object.cpp:
741         * kjs/property_map.cpp: Removed.
742         * kjs/property_map.h: Removed.
743         * kjs/property_slot.cpp: Removed.
744         * kjs/property_slot.h: Removed.
745         * kjs/regexp_object.cpp: Removed.
746         * kjs/regexp_object.h: Removed.
747         * kjs/scope_chain.cpp: Removed.
748         * kjs/scope_chain.h: Removed.
749         * kjs/scope_chain_mark.h: Removed.
750         * kjs/string_object.cpp:
751         * kjs/string_object.h:
752
753 2008-06-15  Darin Adler  <darin@apple.com>
754
755         - new names for a few key JavaScriptCore files
756
757         * API/JSBase.cpp:
758         * API/JSCallbackConstructor.h:
759         * API/JSCallbackFunction.cpp:
760         * API/JSCallbackFunction.h:
761         * API/JSCallbackObject.h:
762         * API/JSCallbackObjectFunctions.h:
763         * API/JSClassRef.h:
764         * API/JSContextRef.cpp:
765         * API/JSObjectRef.cpp:
766         * API/JSStringRef.cpp:
767         * API/JSStringRefCF.cpp:
768         * API/JSValueRef.cpp:
769         * GNUmakefile.am:
770         * JavaScriptCore.pri:
771         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
772         * JavaScriptCore.xcodeproj/project.pbxproj:
773         * JavaScriptCoreSources.bkl:
774         * VM/CodeBlock.cpp:
775         * VM/CodeGenerator.cpp:
776         * VM/ExceptionHelpers.cpp:
777         * VM/ExceptionHelpers.h:
778         * VM/JSPropertyNameIterator.cpp:
779         * VM/JSPropertyNameIterator.h:
780         * VM/Machine.cpp:
781         * kjs/AllInOneFile.cpp:
782         * kjs/DateMath.cpp:
783         * kjs/DebuggerCallFrame.cpp:
784         * kjs/ExecState.cpp:
785         * kjs/JSActivation.cpp:
786         * kjs/JSFunction.cpp: Copied from JavaScriptCore/kjs/function.cpp.
787         * kjs/JSFunction.h: Copied from JavaScriptCore/kjs/function.h.
788         * kjs/JSImmediate.cpp:
789         * kjs/JSNotAnObject.h:
790         * kjs/JSObject.cpp: Copied from JavaScriptCore/kjs/object.cpp.
791         * kjs/JSObject.h: Copied from JavaScriptCore/kjs/object.h.
792         * kjs/JSString.h: Copied from JavaScriptCore/kjs/internal.h.
793         * kjs/JSValue.cpp: Copied from JavaScriptCore/kjs/value.cpp.
794         * kjs/JSValue.h: Copied from JavaScriptCore/kjs/value.h.
795         * kjs/JSVariableObject.h:
796         * kjs/JSWrapperObject.h:
797         * kjs/Shell.cpp:
798         * kjs/SymbolTable.h:
799         * kjs/array_instance.h:
800         * kjs/collector.cpp:
801         * kjs/date_object.cpp:
802         * kjs/date_object.h:
803         * kjs/error_object.cpp:
804         * kjs/function.cpp: Removed.
805         * kjs/function.h: Removed.
806         * kjs/function_object.cpp:
807         * kjs/function_object.h:
808         * kjs/grammar.y:
809         * kjs/internal.cpp:
810         * kjs/internal.h: Removed.
811         * kjs/lexer.cpp:
812         * kjs/list.h:
813         * kjs/lookup.h:
814         * kjs/nodes.h:
815         * kjs/object.cpp: Removed.
816         * kjs/object.h: Removed.
817         * kjs/object_object.h:
818         * kjs/operations.cpp:
819         * kjs/property_map.cpp:
820         * kjs/property_slot.cpp:
821         * kjs/property_slot.h:
822         * kjs/protect.h:
823         * kjs/regexp_object.cpp:
824         * kjs/scope_chain.cpp:
825         * kjs/string_object.h:
826         * kjs/ustring.cpp:
827         * kjs/value.cpp: Removed.
828         * kjs/value.h: Removed.
829         * profiler/Profile.cpp:
830         * profiler/Profiler.cpp:
831
832 2008-06-15  Darin Adler  <darin@apple.com>
833
834         Rubber stamped by Sam.
835
836         - cut down on confusing uses of "Object" and "Imp" in
837           JavaScriptCore class names
838
839         * API/JSCallbackFunction.cpp:
840         (KJS::JSCallbackFunction::JSCallbackFunction):
841         * API/JSCallbackFunction.h:
842         * VM/Machine.cpp:
843         (KJS::Machine::privateExecute):
844         * kjs/ExecState.h:
845         (KJS::ExecState::regExpTable):
846         (KJS::ExecState::regExpConstructorTable):
847         * kjs/JSGlobalData.cpp:
848         (KJS::JSGlobalData::JSGlobalData):
849         (KJS::JSGlobalData::~JSGlobalData):
850         * kjs/JSGlobalData.h:
851         * kjs/JSGlobalObject.cpp:
852         (KJS::JSGlobalObject::reset):
853         * kjs/JSGlobalObject.h:
854         (KJS::JSGlobalObject::objectConstructor):
855         (KJS::JSGlobalObject::functionConstructor):
856         (KJS::JSGlobalObject::arrayConstructor):
857         (KJS::JSGlobalObject::booleanConstructor):
858         (KJS::JSGlobalObject::stringConstructor):
859         (KJS::JSGlobalObject::numberConstructor):
860         (KJS::JSGlobalObject::dateConstructor):
861         (KJS::JSGlobalObject::regExpConstructor):
862         (KJS::JSGlobalObject::errorConstructor):
863         (KJS::JSGlobalObject::evalErrorConstructor):
864         (KJS::JSGlobalObject::rangeErrorConstructor):
865         (KJS::JSGlobalObject::referenceErrorConstructor):
866         (KJS::JSGlobalObject::syntaxErrorConstructor):
867         (KJS::JSGlobalObject::typeErrorConstructor):
868         (KJS::JSGlobalObject::URIErrorConstructor):
869         * kjs/array_object.cpp:
870         (KJS::ArrayConstructor::ArrayConstructor):
871         (KJS::ArrayConstructor::getConstructData):
872         (KJS::ArrayConstructor::construct):
873         (KJS::ArrayConstructor::callAsFunction):
874         * kjs/array_object.h:
875         * kjs/bool_object.cpp:
876         (KJS::BooleanObject::BooleanObject):
877         (KJS::BooleanPrototype::BooleanPrototype):
878         (KJS::booleanProtoFuncToString):
879         (KJS::booleanProtoFuncValueOf):
880         (KJS::BooleanConstructor::BooleanConstructor):
881         (KJS::BooleanConstructor::getConstructData):
882         (KJS::BooleanConstructor::construct):
883         (KJS::BooleanConstructor::callAsFunction):
884         * kjs/bool_object.h:
885         * kjs/date_object.cpp:
886         (KJS::DatePrototype::DatePrototype):
887         (KJS::DateConstructor::DateConstructor):
888         (KJS::DateConstructor::getConstructData):
889         (KJS::DateConstructor::construct):
890         (KJS::DateConstructor::callAsFunction):
891         (KJS::DateFunction::DateFunction):
892         (KJS::DateFunction::callAsFunction):
893         * kjs/date_object.h:
894         * kjs/error_object.cpp:
895         (KJS::ErrorPrototype::ErrorPrototype):
896         (KJS::ErrorConstructor::ErrorConstructor):
897         (KJS::ErrorConstructor::getConstructData):
898         (KJS::ErrorConstructor::construct):
899         (KJS::ErrorConstructor::callAsFunction):
900         (KJS::NativeErrorConstructor::NativeErrorConstructor):
901         (KJS::NativeErrorConstructor::getConstructData):
902         (KJS::NativeErrorConstructor::construct):
903         (KJS::NativeErrorConstructor::callAsFunction):
904         (KJS::NativeErrorConstructor::mark):
905         * kjs/error_object.h:
906         * kjs/function.cpp:
907         (KJS::JSFunction::JSFunction):
908         (KJS::JSFunction::mark):
909         (KJS::JSFunction::getOwnPropertySlot):
910         (KJS::JSFunction::put):
911         (KJS::JSFunction::deleteProperty):
912         (KJS::PrototypeFunction::PrototypeFunction):
913         (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
914         (KJS::PrototypeReflexiveFunction::mark):
915         * kjs/function.h:
916         * kjs/function_object.cpp:
917         (KJS::functionProtoFuncToString):
918         (KJS::FunctionConstructor::FunctionConstructor):
919         (KJS::FunctionConstructor::getConstructData):
920         (KJS::FunctionConstructor::construct):
921         (KJS::FunctionConstructor::callAsFunction):
922         * kjs/function_object.h:
923         * kjs/internal.cpp:
924         (KJS::StringObject::create):
925         (KJS::JSString::toObject):
926         (KJS::JSString::toThisObject):
927         (KJS::JSString::getOwnPropertySlot):
928         (KJS::InternalFunction::InternalFunction):
929         (KJS::InternalFunction::getCallData):
930         (KJS::InternalFunction::implementsHasInstance):
931         * kjs/math_object.cpp:
932         (KJS::MathObject::MathObject):
933         (KJS::MathObject::getOwnPropertySlot):
934         (KJS::MathObject::getValueProperty):
935         * kjs/math_object.h:
936         * kjs/number_object.cpp:
937         (KJS::NumberObject::NumberObject):
938         (KJS::NumberPrototype::NumberPrototype):
939         (KJS::numberProtoFuncToString):
940         (KJS::numberProtoFuncToLocaleString):
941         (KJS::numberProtoFuncValueOf):
942         (KJS::numberProtoFuncToFixed):
943         (KJS::numberProtoFuncToExponential):
944         (KJS::numberProtoFuncToPrecision):
945         (KJS::NumberConstructor::NumberConstructor):
946         (KJS::NumberConstructor::getOwnPropertySlot):
947         (KJS::NumberConstructor::getValueProperty):
948         (KJS::NumberConstructor::getConstructData):
949         (KJS::NumberConstructor::construct):
950         (KJS::NumberConstructor::callAsFunction):
951         * kjs/number_object.h:
952         * kjs/object.cpp:
953         (KJS::JSObject::putDirectFunction):
954         * kjs/object.h:
955         * kjs/object_object.cpp:
956         (KJS::ObjectConstructor::ObjectConstructor):
957         (KJS::ObjectConstructor::getConstructData):
958         (KJS::ObjectConstructor::construct):
959         (KJS::ObjectConstructor::callAsFunction):
960         * kjs/object_object.h:
961         * kjs/regexp.cpp:
962         (KJS::RegExp::RegExp):
963         * kjs/regexp_object.cpp:
964         (KJS::regExpProtoFuncTest):
965         (KJS::regExpProtoFuncExec):
966         (KJS::regExpProtoFuncCompile):
967         (KJS::regExpProtoFuncToString):
968         (KJS::RegExpObject::RegExpObject):
969         (KJS::RegExpObject::~RegExpObject):
970         (KJS::RegExpObject::getOwnPropertySlot):
971         (KJS::RegExpObject::getValueProperty):
972         (KJS::RegExpObject::put):
973         (KJS::RegExpObject::putValueProperty):
974         (KJS::RegExpObject::match):
975         (KJS::RegExpObject::test):
976         (KJS::RegExpObject::exec):
977         (KJS::RegExpObject::getCallData):
978         (KJS::RegExpObject::callAsFunction):
979         (KJS::RegExpConstructorPrivate::RegExpConstructorPrivate):
980         (KJS::RegExpConstructor::RegExpConstructor):
981         (KJS::RegExpConstructor::performMatch):
982         (KJS::RegExpMatchesArray::RegExpMatchesArray):
983         (KJS::RegExpMatchesArray::~RegExpMatchesArray):
984         (KJS::RegExpMatchesArray::fillArrayInstance):
985         (KJS::RegExpConstructor::arrayOfMatches):
986         (KJS::RegExpConstructor::getBackref):
987         (KJS::RegExpConstructor::getLastParen):
988         (KJS::RegExpConstructor::getLeftContext):
989         (KJS::RegExpConstructor::getRightContext):
990         (KJS::RegExpConstructor::getOwnPropertySlot):
991         (KJS::RegExpConstructor::getValueProperty):
992         (KJS::RegExpConstructor::put):
993         (KJS::RegExpConstructor::putValueProperty):
994         (KJS::RegExpConstructor::getConstructData):
995         (KJS::RegExpConstructor::construct):
996         (KJS::RegExpConstructor::callAsFunction):
997         (KJS::RegExpConstructor::input):
998         * kjs/regexp_object.h:
999         * kjs/string_object.cpp:
1000         (KJS::StringObject::StringObject):
1001         (KJS::StringObject::getOwnPropertySlot):
1002         (KJS::StringObject::put):
1003         (KJS::StringObject::deleteProperty):
1004         (KJS::StringObject::getPropertyNames):
1005         (KJS::StringPrototype::StringPrototype):
1006         (KJS::StringPrototype::getOwnPropertySlot):
1007         (KJS::replace):
1008         (KJS::stringProtoFuncToString):
1009         (KJS::stringProtoFuncValueOf):
1010         (KJS::stringProtoFuncCharAt):
1011         (KJS::stringProtoFuncCharCodeAt):
1012         (KJS::stringProtoFuncConcat):
1013         (KJS::stringProtoFuncIndexOf):
1014         (KJS::stringProtoFuncLastIndexOf):
1015         (KJS::stringProtoFuncMatch):
1016         (KJS::stringProtoFuncSearch):
1017         (KJS::stringProtoFuncReplace):
1018         (KJS::stringProtoFuncSlice):
1019         (KJS::stringProtoFuncSplit):
1020         (KJS::stringProtoFuncSubstr):
1021         (KJS::stringProtoFuncSubstring):
1022         (KJS::stringProtoFuncToLowerCase):
1023         (KJS::stringProtoFuncToUpperCase):
1024         (KJS::stringProtoFuncToLocaleLowerCase):
1025         (KJS::stringProtoFuncToLocaleUpperCase):
1026         (KJS::stringProtoFuncLocaleCompare):
1027         (KJS::stringProtoFuncBig):
1028         (KJS::stringProtoFuncSmall):
1029         (KJS::stringProtoFuncBlink):
1030         (KJS::stringProtoFuncBold):
1031         (KJS::stringProtoFuncFixed):
1032         (KJS::stringProtoFuncItalics):
1033         (KJS::stringProtoFuncStrike):
1034         (KJS::stringProtoFuncSub):
1035         (KJS::stringProtoFuncSup):
1036         (KJS::stringProtoFuncFontcolor):
1037         (KJS::stringProtoFuncFontsize):
1038         (KJS::stringProtoFuncAnchor):
1039         (KJS::stringProtoFuncLink):
1040         (KJS::StringConstructor::StringConstructor):
1041         (KJS::StringConstructor::getConstructData):
1042         (KJS::StringConstructor::construct):
1043         (KJS::StringConstructor::callAsFunction):
1044         (KJS::StringConstructorFunction::StringConstructorFunction):
1045         (KJS::StringConstructorFunction::callAsFunction):
1046         * kjs/string_object.h:
1047         (KJS::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
1048         * profiler/Profiler.cpp:
1049         (KJS::createCallIdentifier):
1050
1051 2008-06-15  Darin Adler  <darin@apple.com>
1052
1053         Rubber stamped by Sam.
1054
1055         - use JS prefix and simpler names for basic JavaScriptCore types,
1056           to complement JSValue and JSObject
1057
1058         * JavaScriptCore.exp:
1059         * VM/Machine.cpp:
1060         (KJS::jsLess):
1061         (KJS::jsLessEq):
1062         (KJS::jsAdd):
1063         (KJS::callEval):
1064         (KJS::Machine::execute):
1065         (KJS::Machine::retrieveArguments):
1066         (KJS::Machine::retrieveCaller):
1067         (KJS::Machine::getCallFrame):
1068         (KJS::Machine::getFunctionAndArguments):
1069         * VM/Machine.h:
1070         * VM/Register.h:
1071         * kjs/DebuggerCallFrame.cpp:
1072         (KJS::DebuggerCallFrame::functionName):
1073         * kjs/ExecState.h:
1074         * kjs/JSActivation.cpp:
1075         (KJS::JSActivation::createArgumentsObject):
1076         * kjs/array_instance.cpp:
1077         (KJS::JSArray::checkConsistency):
1078         (KJS::JSArray::JSArray):
1079         (KJS::JSArray::~JSArray):
1080         (KJS::JSArray::getItem):
1081         (KJS::JSArray::lengthGetter):
1082         (KJS::JSArray::inlineGetOwnPropertySlot):
1083         (KJS::JSArray::getOwnPropertySlot):
1084         (KJS::JSArray::put):
1085         (KJS::JSArray::deleteProperty):
1086         (KJS::JSArray::getPropertyNames):
1087         (KJS::JSArray::increaseVectorLength):
1088         (KJS::JSArray::setLength):
1089         (KJS::JSArray::mark):
1090         (KJS::JSArray::sort):
1091         (KJS::JSArray::compactForSorting):
1092         (KJS::JSArray::lazyCreationData):
1093         (KJS::JSArray::setLazyCreationData):
1094         * kjs/array_instance.h:
1095         * kjs/array_object.cpp:
1096         (KJS::ArrayPrototype::ArrayPrototype):
1097         (KJS::ArrayPrototype::getOwnPropertySlot):
1098         (KJS::arrayProtoFuncToString):
1099         (KJS::arrayProtoFuncToLocaleString):
1100         (KJS::arrayProtoFuncConcat):
1101         (KJS::arrayProtoFuncSort):
1102         (KJS::ArrayObjectImp::construct):
1103         * kjs/array_object.h:
1104         * kjs/completion.h:
1105         * kjs/function.cpp:
1106         (KJS::JSFunction::JSFunction):
1107         (KJS::JSFunction::mark):
1108         (KJS::JSFunction::getCallData):
1109         (KJS::JSFunction::callAsFunction):
1110         (KJS::JSFunction::argumentsGetter):
1111         (KJS::JSFunction::callerGetter):
1112         (KJS::JSFunction::lengthGetter):
1113         (KJS::JSFunction::getOwnPropertySlot):
1114         (KJS::JSFunction::put):
1115         (KJS::JSFunction::deleteProperty):
1116         (KJS::JSFunction::getParameterName):
1117         (KJS::JSFunction::getConstructData):
1118         (KJS::JSFunction::construct):
1119         (KJS::IndexToNameMap::IndexToNameMap):
1120         (KJS::Arguments::Arguments):
1121         * kjs/function.h:
1122         * kjs/function_object.cpp:
1123         (KJS::functionProtoFuncToString):
1124         (KJS::functionProtoFuncApply):
1125         (KJS::FunctionObjectImp::construct):
1126         * kjs/internal.cpp:
1127         (KJS::JSString::toPrimitive):
1128         (KJS::JSString::getPrimitiveNumber):
1129         (KJS::JSString::toBoolean):
1130         (KJS::JSString::toNumber):
1131         (KJS::JSString::toString):
1132         (KJS::StringInstance::create):
1133         (KJS::JSString::toObject):
1134         (KJS::JSString::toThisObject):
1135         (KJS::JSString::lengthGetter):
1136         (KJS::JSString::indexGetter):
1137         (KJS::JSString::indexNumericPropertyGetter):
1138         (KJS::JSString::getOwnPropertySlot):
1139         (KJS::JSNumberCell::type):
1140         (KJS::JSNumberCell::toPrimitive):
1141         (KJS::JSNumberCell::getPrimitiveNumber):
1142         (KJS::JSNumberCell::toBoolean):
1143         (KJS::JSNumberCell::toNumber):
1144         (KJS::JSNumberCell::toString):
1145         (KJS::JSNumberCell::toObject):
1146         (KJS::JSNumberCell::toThisObject):
1147         (KJS::JSNumberCell::getUInt32):
1148         (KJS::JSNumberCell::getTruncatedInt32):
1149         (KJS::JSNumberCell::getTruncatedUInt32):
1150         (KJS::GetterSetter::mark):
1151         (KJS::GetterSetter::toPrimitive):
1152         (KJS::GetterSetter::getPrimitiveNumber):
1153         (KJS::GetterSetter::toBoolean):
1154         (KJS::GetterSetter::toNumber):
1155         (KJS::GetterSetter::toString):
1156         (KJS::GetterSetter::toObject):
1157         (KJS::GetterSetter::getOwnPropertySlot):
1158         (KJS::GetterSetter::put):
1159         (KJS::GetterSetter::toThisObject):
1160         * kjs/internal.h:
1161         (KJS::JSString::JSString):
1162         (KJS::JSString::getStringPropertySlot):
1163         * kjs/nodes.cpp:
1164         (KJS::FuncDeclNode::makeFunction):
1165         (KJS::FuncExprNode::makeFunction):
1166         * kjs/nodes.h:
1167         * kjs/object.cpp:
1168         (KJS::JSObject::put):
1169         (KJS::JSObject::deleteProperty):
1170         (KJS::JSObject::defineGetter):
1171         (KJS::JSObject::defineSetter):
1172         (KJS::JSObject::lookupGetter):
1173         (KJS::JSObject::lookupSetter):
1174         (KJS::JSObject::fillGetterPropertySlot):
1175         * kjs/object.h:
1176         (KJS::GetterSetter::GetterSetter):
1177         * kjs/operations.cpp:
1178         (KJS::equal):
1179         (KJS::strictEqual):
1180         * kjs/property_map.cpp:
1181         (KJS::PropertyMap::containsGettersOrSetters):
1182         * kjs/regexp_object.cpp:
1183         (KJS::RegExpMatchesArray::getOwnPropertySlot):
1184         (KJS::RegExpMatchesArray::put):
1185         (KJS::RegExpMatchesArray::deleteProperty):
1186         (KJS::RegExpMatchesArray::getPropertyNames):
1187         (KJS::RegExpMatchesArray::RegExpMatchesArray):
1188         (KJS::RegExpMatchesArray::fillArrayInstance):
1189         * kjs/string_object.cpp:
1190         (KJS::StringInstance::StringInstance):
1191         (KJS::replace):
1192         (KJS::stringProtoFuncReplace):
1193         (KJS::stringProtoFuncToLowerCase):
1194         (KJS::stringProtoFuncToUpperCase):
1195         (KJS::stringProtoFuncToLocaleLowerCase):
1196         (KJS::stringProtoFuncToLocaleUpperCase):
1197         * kjs/string_object.h:
1198         (KJS::StringInstance::internalValue):
1199         * kjs/value.cpp:
1200         (KJS::JSCell::getNumber):
1201         (KJS::JSCell::getString):
1202         (KJS::JSCell::getObject):
1203         (KJS::jsString):
1204         (KJS::jsOwnedString):
1205         * kjs/value.h:
1206         (KJS::JSNumberCell::JSNumberCell):
1207         (KJS::jsNumberCell):
1208         (KJS::JSValue::uncheckedGetNumber):
1209         * profiler/Profiler.cpp:
1210         (KJS::createCallIdentifier):
1211         (KJS::createCallIdentifierFromFunctionImp):
1212
1213 2008-06-15  Maciej Stachowiak  <mjs@apple.com>
1214
1215         Reviewed by Alexey.
1216         
1217         - add emitUnaryOp, emitNullaryOp and emitUnaryOpNoDst; use them
1218         
1219         This removes some boilerplate code and also reduces the number of
1220         places that will need to be changed to do on-demand emit of
1221         loads (and thus support k operands).
1222
1223         * VM/CodeGenerator.cpp:
1224         (KJS::CodeGenerator::emitUnaryOp):
1225         (KJS::CodeGenerator::emitNullaryOp):
1226         (KJS::CodeGenerator::emitUnaryOpNoDst):
1227         (KJS::CodeGenerator::emitPushScope):
1228         * VM/CodeGenerator.h:
1229         (KJS::CodeGenerator::emitNewObject):
1230         (KJS::CodeGenerator::emitNewArray):
1231         (KJS::CodeGenerator::emitNot):
1232         (KJS::CodeGenerator::emitBitNot):
1233         (KJS::CodeGenerator::emitToJSNumber):
1234         (KJS::CodeGenerator::emitNegate):
1235         (KJS::CodeGenerator::emitInstanceOf):
1236         (KJS::CodeGenerator::emitTypeOf):
1237         (KJS::CodeGenerator::emitIn):
1238         (KJS::CodeGenerator::emitReturn):
1239         (KJS::CodeGenerator::emitEnd):
1240         (KJS::CodeGenerator::emitGetPropertyNames):
1241
1242 2008-06-15  Alp Toker  <alp@nuanti.com>
1243
1244         Rubber-stamped by Maciej.
1245
1246         Install 'jsc' application by default.
1247
1248         * GNUmakefile.am:
1249
1250 2008-06-15  Maciej Stachowiak  <mjs@apple.com>
1251
1252         Reviewed by Oliver.
1253         
1254         - rename testkjs to jsc
1255
1256         * GNUmakefile.am:
1257         * JavaScriptCore.vcproj/JavaScriptCore.sln:
1258         * JavaScriptCore.vcproj/jsc: Added.
1259         * JavaScriptCore.vcproj/jsc/jsc.vcproj: Copied from JavaScriptCore.vcproj/testkjs/testkjs.vcproj.
1260         * JavaScriptCore.vcproj/testkjs: Removed.
1261         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Removed.
1262         * JavaScriptCore.xcodeproj/project.pbxproj:
1263         * jscore.bkl:
1264         * kjs/Shell.cpp: Copied from kjs/testkjs.cpp.
1265         (main):
1266         (printUsageStatement):
1267         (jscmain):
1268         * kjs/jsc.pro: Copied from kjs/testkjs.pro.
1269         * kjs/testkjs.cpp: Removed.
1270         * kjs/testkjs.pro: Removed.
1271         * tests/mozilla/expected.html:
1272         * tests/mozilla/js1_2/Array/tostring_1.js:
1273         * tests/mozilla/js1_2/Array/tostring_2.js:
1274         * tests/mozilla/jsDriver.pl:
1275
1276 2008-06-15  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1277
1278         Reviewed by Maciej.
1279
1280         Mac build fix.
1281
1282         * JavaScriptCore.xcodeproj/project.pbxproj:
1283         * kjs/nodes.h:
1284
1285 2008-06-15  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1286
1287         Reviewed by Maciej.
1288
1289         Change the spelling of PrecMultiplicitave to PrecMultiplicative.
1290
1291         * kjs/nodes.h:
1292         (KJS::MultNode::precedence):
1293         (KJS::DivNode::precedence):
1294         (KJS::ModNode::precedence):
1295
1296 2008-06-15  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1297
1298         Reviewed by Maciej.
1299
1300         Remove unused preprocessor macros related to exceptions in the old
1301         interpreter.
1302
1303         * kjs/nodes.cpp:
1304
1305 2008-06-15  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1306
1307         Reviewed by Maciej.
1308
1309         Bug 19484: More instructions needs to use temporary registers
1310         <https://bugs.webkit.org/show_bug.cgi?id=19484>
1311
1312         Fix codegen for all binary operations so that temporaries are used if
1313         necessary. This was done by making BinaryOpNode and ReverseBinaryOpNode
1314         subclasses of ExpressionNode, and eliminating the custom emitCode()
1315         methods for the individual node classes.
1316
1317         This only adds 3 new instructions to SunSpider code, and there is no
1318         difference in SunSpider execution time.
1319
1320         * VM/CodeGenerator.cpp:
1321         (KJS::CodeGenerator::emitBitNot):
1322         (KJS::CodeGenerator::emitBinaryOp):
1323         * VM/CodeGenerator.h:
1324         * kjs/grammar.y:
1325         * kjs/nodes.cpp:
1326         (KJS::PreIncResolveNode::emitCode):
1327         (KJS::PreDecResolveNode::emitCode):
1328         (KJS::BinaryOpNode::emitCode):
1329         (KJS::ReverseBinaryOpNode::emitCode):
1330         (KJS::emitReadModifyAssignment):
1331         (KJS::CaseBlockNode::emitCodeForBlock):
1332         * kjs/nodes.h:
1333         (KJS::BinaryOpNode::BinaryOpNode):
1334         (KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
1335         (KJS::MultNode::):
1336         (KJS::DivNode::):
1337         (KJS::DivNode::precedence):
1338         (KJS::ModNode::):
1339         (KJS::ModNode::precedence):
1340         (KJS::AddNode::):
1341         (KJS::AddNode::precedence):
1342         (KJS::SubNode::):
1343         (KJS::SubNode::precedence):
1344         (KJS::LeftShiftNode::):
1345         (KJS::LeftShiftNode::precedence):
1346         (KJS::RightShiftNode::):
1347         (KJS::RightShiftNode::precedence):
1348         (KJS::UnsignedRightShiftNode::):
1349         (KJS::UnsignedRightShiftNode::precedence):
1350         (KJS::LessNode::):
1351         (KJS::LessNode::precedence):
1352         (KJS::GreaterNode::):
1353         (KJS::GreaterNode::precedence):
1354         (KJS::LessEqNode::):
1355         (KJS::LessEqNode::precedence):
1356         (KJS::GreaterEqNode::):
1357         (KJS::GreaterEqNode::precedence):
1358         (KJS::InstanceOfNode::):
1359         (KJS::InstanceOfNode::precedence):
1360         (KJS::InNode::):
1361         (KJS::InNode::precedence):
1362         (KJS::EqualNode::):
1363         (KJS::EqualNode::precedence):
1364         (KJS::NotEqualNode::):
1365         (KJS::NotEqualNode::precedence):
1366         (KJS::StrictEqualNode::):
1367         (KJS::StrictEqualNode::precedence):
1368         (KJS::NotStrictEqualNode::):
1369         (KJS::NotStrictEqualNode::precedence):
1370         (KJS::BitAndNode::):
1371         (KJS::BitAndNode::precedence):
1372         (KJS::BitOrNode::):
1373         (KJS::BitOrNode::precedence):
1374         (KJS::BitXOrNode::):
1375         (KJS::BitXOrNode::precedence):
1376         * kjs/nodes2string.cpp:
1377         (KJS::LessNode::streamTo):
1378         (KJS::GreaterNode::streamTo):
1379         (KJS::LessEqNode::streamTo):
1380         (KJS::GreaterEqNode::streamTo):
1381         (KJS::InstanceOfNode::streamTo):
1382         (KJS::InNode::streamTo):
1383         (KJS::EqualNode::streamTo):
1384         (KJS::NotEqualNode::streamTo):
1385         (KJS::StrictEqualNode::streamTo):
1386         (KJS::NotStrictEqualNode::streamTo):
1387         (KJS::BitAndNode::streamTo):
1388         (KJS::BitXOrNode::streamTo):
1389         (KJS::BitOrNode::streamTo):
1390
1391 2008-06-14  Darin Adler  <darin@apple.com>
1392
1393         Rubber stamped by Sam.
1394
1395         - rename a bunch of local symbols within the regular expression code to
1396           follow our usual coding style, and do a few other name tweaks
1397
1398         * pcre/pcre_compile.cpp:
1399         (CompileData::CompileData):
1400         (checkEscape):
1401         (readRepeatCounts):
1402         (compileBranch):
1403         (compileBracket):
1404         (calculateCompiledPatternLength):
1405         (returnError):
1406         (jsRegExpCompile):
1407         * pcre/pcre_exec.cpp:
1408         (MatchStack::MatchStack):
1409         (MatchStack::canUseStackBufferForNextFrame):
1410         (MatchStack::popCurrentFrame):
1411         (match):
1412         (tryFirstByteOptimization):
1413         (tryRequiredByteOptimization):
1414         (jsRegExpExecute):
1415         * pcre/pcre_internal.h:
1416
1417 2008-06-14  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1418
1419         Reviewed by Darin.
1420
1421         Remove redundant uses of get().
1422
1423         * kjs/nodes.cpp:
1424         (KJS::BracketAccessorNode::emitCode):
1425         (KJS::AddNode::emitCode):
1426         (KJS::SubNode::emitCode):
1427         (KJS::ReadModifyResolveNode::emitCode):
1428         (KJS::AssignDotNode::emitCode):
1429         (KJS::ReadModifyDotNode::emitCode):
1430         (KJS::AssignBracketNode::emitCode):
1431         (KJS::ReadModifyBracketNode::emitCode):
1432
1433 2008-06-14  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1434
1435         Reviewed by Maciej.
1436
1437         Make code generation not use a temporary for the left-hand side of an
1438         expression if the right-hand side is a local variable.
1439
1440         * VM/CodeGenerator.cpp:
1441         (KJS::CodeGenerator::isLocal):
1442         * VM/CodeGenerator.h:
1443         (KJS::CodeGenerator::leftHandSideNeedsCopy):
1444         (KJS::CodeGenerator::emitNodeForLeftHandSide):
1445         * kjs/nodes.cpp:
1446         (KJS::ResolveNode::isPure):
1447         (KJS::BracketAccessorNode::emitCode):
1448         (KJS::AddNode::emitCode):
1449         (KJS::SubNode::emitCode):
1450         (KJS::ReadModifyResolveNode::emitCode):
1451         (KJS::AssignDotNode::emitCode):
1452         (KJS::ReadModifyDotNode::emitCode):
1453         (KJS::AssignBracketNode::emitCode):
1454         (KJS::ReadModifyBracketNode::emitCode):
1455         * kjs/nodes.h:
1456         (KJS::ExpressionNode::):
1457         (KJS::BooleanNode::):
1458         (KJS::NumberNode::):
1459         (KJS::StringNode::):
1460
1461 2008-06-14  Darin Adler  <darin@apple.com>
1462
1463         Reviewed by Sam.
1464
1465         - more of https://bugs.webkit.org/show_bug.cgi?id=17257
1466           start ref counts at 1 instead of 0 for speed
1467
1468         * kjs/nodes.cpp:
1469         (KJS::ParserRefCounted::hasOneRef): Added. Replaces refcount.
1470         * kjs/nodes.h: Replaced refcount with hasOneRef.
1471
1472         * wtf/ListRefPtr.h:
1473         (WTF::ListRefPtr::~ListRefPtr): Changed to use hasOneRef instead of
1474         refcount, so this class can be used with the RefCounted template.
1475
1476         * wtf/RefCounted.h:
1477         (WTF::RefCounted::hasOneRef): Made const, since there's no reason for
1478         it to be non-const.
1479
1480 2008-06-14  Maciej Stachowiak  <mjs@apple.com>
1481
1482         Reviewed by Oliver.
1483         
1484         - initialize local vars as side effect of call instead of in bytecode
1485         1.004x speedup on SunSpider.
1486
1487         This removes just the dispatch overhead for these loads - in the
1488         future, dead store elimination might be able to eliminate them
1489         entirely.
1490         
1491         * VM/CodeGenerator.cpp:
1492         (KJS::CodeGenerator::CodeGenerator): For function blocks, don't
1493         emit loads of undefined for var initialization.
1494         * VM/Machine.cpp:
1495         (KJS::slideRegisterWindowForCall): Instead, initialize locals
1496         as part of the call.
1497
1498 2008-06-14  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1499
1500         Reviewed by Oliver.
1501
1502         Remove helper functions in the parser that are no longer needed.
1503
1504         * kjs/grammar.y:
1505
1506 2008-06-14  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1507
1508         Reviewed by Oliver.
1509
1510         Bug 19484: More instructions needs to use temporary registers
1511         <https://bugs.webkit.org/show_bug.cgi?id=19484>
1512
1513         Make code generation for AddNode and SubNode use temporaries when
1514         necessary.
1515
1516         * kjs/grammar.y:
1517         * kjs/nodes.cpp:
1518         (KJS::AddNode::emitCode):
1519         (KJS::SubNode::emitCode):
1520         * kjs/nodes.h:
1521         (KJS::AddNode::):
1522         (KJS::SubNode::):
1523
1524 2008-06-13  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1525
1526         Reviewed by Maciej.
1527
1528         Combine TrueNode and FalseNode to make BooleanNode, and remove the
1529         unused class PlaceholderTrueNode.
1530
1531         * kjs/grammar.y:
1532         * kjs/nodes.cpp:
1533         (KJS::BooleanNode::emitCode):
1534         * kjs/nodes.h:
1535         (KJS::BooleanNode::):
1536         (KJS::BooleanNode::precedence):
1537         * kjs/nodes2string.cpp:
1538         (KJS::BooleanNode::streamTo):
1539
1540 2008-06-13  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1541
1542         Reviewed by Maciej.
1543
1544         Eliminate the use of temporaries to store the left hand side of an
1545         expression when the right hand side is a constant. This slightly
1546         improves the generated bytecode for a few SunSpider tests, but it is
1547         mostly in preparation for fixing
1548
1549         Bug 19484: More instructions needs to use temporary registers
1550         <https://bugs.webkit.org/show_bug.cgi?id=19484>
1551
1552         * VM/CodeGenerator.h:
1553         (KJS::CodeGenerator::leftHandSideNeedsCopy):
1554         (KJS::CodeGenerator::emitNodeForLeftHandSide):
1555         * kjs/nodes.cpp:
1556         (KJS::BracketAccessorNode::emitCode):
1557         (KJS::ReadModifyResolveNode::emitCode):
1558         (KJS::AssignDotNode::emitCode):
1559         (KJS::ReadModifyDotNode::emitCode):
1560         (KJS::AssignBracketNode::emitCode):
1561         (KJS::ReadModifyBracketNode::emitCode):
1562         * kjs/nodes.h:
1563         (KJS::ExpressionNode::):
1564         (KJS::FalseNode::):
1565         (KJS::TrueNode::):
1566         (KJS::NumberNode::):
1567         (KJS::StringNode::):
1568
1569 2008-06-13  Maciej Stachowiak  <mjs@apple.com>
1570
1571         Reviewed by Oliver.
1572         
1573         - prettify opcode stats output
1574         
1575         I changed things to be a bit more aligned, also there is a new
1576         section listing most common opcodes and most common sequences that
1577         include them.
1578
1579         * VM/Opcode.cpp:
1580         (KJS::OpcodeStats::~OpcodeStats):
1581         * VM/Opcode.h:
1582
1583 2008-06-13  Kevin McCullough  <kmccullough@apple.com>
1584
1585         Reviewed by Geoff.
1586
1587         <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
1588         profiler.
1589         - Remove recursion from exclude().  This leaves only focus() to fix.
1590
1591         * JavaScriptCore.exp: Change the signatures of the exported functions.
1592         * profiler/Profile.cpp:
1593         (KJS::Profile::forEach): I added a traverseNextNodePreOrder() function
1594         and so needed to distinguish the other function by labeling it
1595         traverseNextNodePostOrder().
1596         (KJS::Profile::exclude): All new exclude that iteratively walks the tree
1597         * profiler/Profile.h:
1598         (KJS::Profile::focus): Add a null check for m_head.
1599         * profiler/ProfileNode.cpp:
1600         (KJS::ProfileNode::traverseNextNodePostOrder): Renamed
1601         (KJS::ProfileNode::traverseNextNodePreOrder): Walks the tree in pre-
1602         order, where the parent is processed before the children.
1603         (KJS::ProfileNode::setTreeVisible): Iterate over the sub-tree and set
1604         all of the nodes visible value.  This changes another function that used
1605         recursion.
1606         (KJS::ProfileNode::exclude): Remove recursion from this function.
1607         Because we now check for m_visible and we are walking the tree in pre-
1608         order we do not need to check if an excluded node is in an excluded
1609         sub-tree.
1610         * profiler/ProfileNode.h: Added specific selfTime functions to
1611         facilitate exclude().
1612         (KJS::ProfileNode::setSelfTime):
1613         (KJS::ProfileNode::setActualSelfTime):
1614         (KJS::ProfileNode::setVisibleSelfTime):
1615
1616 2008-06-12  Darin Adler  <darin@apple.com>
1617
1618         Reviewed by Maciej.
1619
1620         - https://bugs.webkit.org/show_bug.cgi?id=19434
1621           speed up SunSpider by avoiding some string boxing
1622
1623         Speeds up SunSpider by 1.1%.
1624
1625         Optimized code path for getting built-in properties from strings -- avoid
1626         boxing with a string object in that case. We can make further changes to avoid
1627         even more boxing, but this change alone is a win.
1628
1629         * API/JSCallbackObjectFunctions.h:
1630         (KJS::JSCallbackObject::staticValueGetter): Use isObject instead of inherits
1631         in asssert, since the type of slotBase() is now JSValue, not JSObject.
1632         (KJS::JSCallbackObject::staticFunctionGetter): Ditto.
1633         (KJS::JSCallbackObject::callbackGetter): Ditto.
1634
1635         * kjs/internal.cpp:
1636         (KJS::StringImp::getPrimitiveNumber): Updated for change of data member name.
1637         (KJS::StringImp::toBoolean): Ditto.
1638         (KJS::StringImp::toNumber): Ditto.
1639         (KJS::StringImp::toString): Ditto.
1640         (KJS::StringInstance::create): Added; avoids a bit of cut and paste code.
1641         (KJS::StringImp::toObject): Use StringInstance::create.
1642         (KJS::StringImp::toThisObject): Ditto.
1643         (KJS::StringImp::lengthGetter): Added. Replaces the getter that used to live in
1644         the StringInstance class.
1645         (KJS::StringImp::indexGetter): Ditto.
1646         (KJS::StringImp::indexNumericPropertyGetter): Ditto.
1647         (KJS::StringImp::getOwnPropertySlot): Added. Deals with built in properties of
1648         the string class without creating a StringInstance.
1649
1650         * kjs/internal.h:
1651         (KJS::StringImp::getStringPropertySlot): Added. To be used by both the string
1652         and string object getOwnPropertySlot function.
1653
1654         * kjs/lookup.h:
1655         (KJS::staticFunctionGetter): Updated since slotBase() is now a JSValue rather
1656         than a JSObject.
1657
1658         * kjs/object.h: Removed PropertySlot::slotBase() function, which can now move
1659         back into property_slot.h where it belongs since it doesn't have to cast to
1660         JSObject*.
1661
1662         * kjs/property_slot.cpp:
1663         (KJS::PropertySlot::functionGetter): Updated since slot.slotBase() is now a JSValue*
1664         instead of JSObject*. setGetterSlot still guarantees the base is a JSObject*.
1665         * kjs/property_slot.h:
1666         (KJS::PropertySlot::PropertySlot): Changed base to JSValue* intead of JSCell*.
1667         (KJS::PropertySlot::setStaticEntry): Ditto.
1668         (KJS::PropertySlot::setCustom): Ditto.
1669         (KJS::PropertySlot::setCustomIndex): Ditto.
1670         (KJS::PropertySlot::setCustomNumeric): Ditto.
1671         (KJS::PropertySlot::slotBase): Moved inline here since it no longer involves a
1672         downcast to JSObject*.
1673         (KJS::PropertySlot::setBase): Changed to JSValue*.
1674
1675         * kjs/string_object.cpp:
1676         (KJS::StringInstance::getOwnPropertySlot): Changed to use getStringPropertySlot
1677         instead of coding the properties here. This allows sharing the code with StringImp.
1678
1679         * kjs/string_object.h: Removed inlineGetOwnPropertySlot, lengthGetter, and indexGetter.
1680         Made one of the constructors protected.
1681
1682         * kjs/value.h: Made getOwnPropertySlot private in the JSCell class -- this is better
1683         since it's not the real JSObject getOwnPropertySlot semantic and most callers shouldn't
1684         use it.
1685
1686 2008-06-12  Alexey Proskuryakov  <ap@webkit.org>
1687
1688         Reviewed by Maciej.
1689
1690         Preparation to making JavaScript heap per-thread.
1691
1692         * kjs/collector.cpp:
1693         (KJS::Collector::collect):
1694         * kjs/collector.h:
1695         (KJS::Collector::markListSet):
1696         The collector now holds the list of protected lists itself, to be made per-instance.
1697
1698         * kjs/list.h: Changed to hold a pointer to a mark set this list is in, if any.
1699         (KJS::List::List): Explicitly initialize m_size with zero, as m_vector.size() is
1700         guaranteed to be such anyway.
1701         (KJS::List::append): Changed the fast case to only be executed as long as inline buffer
1702         is used, because otherwise, we now do more expensive checks.
1703
1704         * kjs/list.cpp:
1705         (KJS::List::markLists): Renamed from markProtectedListsSlowCase, made it take the list set
1706         as a parameter.
1707         (KJS::List::slowAppend): If a non-immediate value is appended, the list needs to be added
1708         to an appropriate Heap's protected list. For now, a static Collector::markListSet() is
1709         used, but the code is layed out in preparation to making the switch to multiple heaps.
1710
1711         * JavaScriptCore.exp: Updated export list.
1712
1713 2008-06-12  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1714
1715         Reviewed by Maciej.
1716
1717         Bug 19510: CodeBlock::needsFullScopeChain not always set for global code
1718         <https://bugs.webkit.org/show_bug.cgi?id=19510>
1719
1720         This fixes the symptoms by using CodeGenerator::m_codeType to determine
1721         when to use temporaries instead of CodeBlock::needsFullScopeChain, but
1722         it does not fix the problem itself.
1723
1724         * VM/CodeGenerator.h:
1725         (KJS::CodeGenerator::leftHandSideNeedsCopy):
1726
1727 2008-06-11  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1728
1729         Reviewed by Maciej.
1730
1731         Bug 19498: REGRESSION (r34497): crash while loading GMail
1732         <https://bugs.webkit.org/show_bug.cgi?id=19498>
1733
1734         * VM/CodeGenerator.cpp:
1735         (KJS::CodeGenerator::emitJumpIfTrueMayCombine):
1736         (KJS::CodeGenerator::emitJumpIfTrue):
1737         * VM/CodeGenerator.h:
1738         * kjs/nodes.cpp:
1739         (KJS::DoWhileNode::emitCode):
1740         (KJS::WhileNode::emitCode):
1741         (KJS::ForNode::emitCode):
1742         (KJS::CaseBlockNode::emitCodeForBlock):
1743
1744 2008-06-11  Darin Adler  <darin@apple.com>
1745
1746         Reviewed by Maciej.
1747
1748         - a little bit of cleanup and prep for some upcoming optimizations
1749
1750         * JavaScriptCore.exp: Re-sorted this file (with sort command line tool).
1751         * VM/CodeBlock.cpp:
1752         (KJS::CodeBlock::dump): Fixed printf to avoid warnings -- to use %lu we
1753         need to make sure the type is unsigned long.
1754         * kjs/object.cpp:
1755         (KJS::Error::create): Eliminated unused error names array, and also put
1756         the strings into the code since there was already a switch statment.
1757         This also avoids having to contemplate a hypothetical access past the
1758         end of the array.
1759         * kjs/object.h: Got rid of errorNames.
1760         * kjs/property_slot.cpp: Deleted unused ungettableGetter.
1761         * kjs/property_slot.h: Ditto.
1762         * wtf/AlwaysInline.h: Added LIKELY alongside UNLIKELY.
1763
1764 2008-06-11  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1765
1766         Reviewed by Darin.
1767
1768         Bug 19457: Create fused opcodes for tests and conditional jumps
1769         <https://bugs.webkit.org/show_bug.cgi?id=19457>
1770
1771         Add a new jless instruction, and modify the code generator to emit it
1772         instead of the pair (less, jtrue).
1773
1774         Gives a 3.6% improvement on SunSpider.
1775
1776         * VM/CodeBlock.cpp:
1777         (KJS::CodeBlock::dump):
1778         * VM/CodeGenerator.cpp:
1779         (KJS::CodeGenerator::CodeGenerator):
1780         (KJS::CodeGenerator::emitOpcode):
1781         (KJS::CodeGenerator::retrieveLastBinaryOp):
1782         (KJS::CodeGenerator::rewindBinaryOp):
1783         (KJS::CodeGenerator::emitJump):
1784         (KJS::CodeGenerator::emitJumpIfTrue):
1785         (KJS::CodeGenerator::emitJumpIfFalse):
1786         (KJS::CodeGenerator::emitMove):
1787         (KJS::CodeGenerator::emitNot):
1788         (KJS::CodeGenerator::emitEqual):
1789         (KJS::CodeGenerator::emitNotEqual):
1790         (KJS::CodeGenerator::emitStrictEqual):
1791         (KJS::CodeGenerator::emitNotStrictEqual):
1792         (KJS::CodeGenerator::emitLess):
1793         (KJS::CodeGenerator::emitLessEq):
1794         (KJS::CodeGenerator::emitPreInc):
1795         (KJS::CodeGenerator::emitPreDec):
1796         (KJS::CodeGenerator::emitPostInc):
1797         (KJS::CodeGenerator::emitPostDec):
1798         (KJS::CodeGenerator::emitToJSNumber):
1799         (KJS::CodeGenerator::emitNegate):
1800         (KJS::CodeGenerator::emitAdd):
1801         (KJS::CodeGenerator::emitMul):
1802         (KJS::CodeGenerator::emitDiv):
1803         (KJS::CodeGenerator::emitMod):
1804         (KJS::CodeGenerator::emitSub):
1805         (KJS::CodeGenerator::emitLeftShift):
1806         (KJS::CodeGenerator::emitRightShift):
1807         (KJS::CodeGenerator::emitUnsignedRightShift):
1808         (KJS::CodeGenerator::emitBitAnd):
1809         (KJS::CodeGenerator::emitBitXOr):
1810         (KJS::CodeGenerator::emitBitOr):
1811         (KJS::CodeGenerator::emitBitNot):
1812         (KJS::CodeGenerator::emitInstanceOf):
1813         (KJS::CodeGenerator::emitTypeOf):
1814         (KJS::CodeGenerator::emitIn):
1815         (KJS::CodeGenerator::emitLoad):
1816         (KJS::CodeGenerator::emitNewObject):
1817         (KJS::CodeGenerator::emitNewArray):
1818         (KJS::CodeGenerator::emitResolve):
1819         (KJS::CodeGenerator::emitGetScopedVar):
1820         (KJS::CodeGenerator::emitPutScopedVar):
1821         (KJS::CodeGenerator::emitResolveBase):
1822         (KJS::CodeGenerator::emitResolveWithBase):
1823         (KJS::CodeGenerator::emitResolveFunction):
1824         (KJS::CodeGenerator::emitGetById):
1825         (KJS::CodeGenerator::emitPutById):
1826         (KJS::CodeGenerator::emitPutGetter):
1827         (KJS::CodeGenerator::emitPutSetter):
1828         (KJS::CodeGenerator::emitDeleteById):
1829         (KJS::CodeGenerator::emitGetByVal):
1830         (KJS::CodeGenerator::emitPutByVal):
1831         (KJS::CodeGenerator::emitDeleteByVal):
1832         (KJS::CodeGenerator::emitPutByIndex):
1833         (KJS::CodeGenerator::emitNewFunction):
1834         (KJS::CodeGenerator::emitNewRegExp):
1835         (KJS::CodeGenerator::emitNewFunctionExpression):
1836         (KJS::CodeGenerator::emitCall):
1837         (KJS::CodeGenerator::emitReturn):
1838         (KJS::CodeGenerator::emitEnd):
1839         (KJS::CodeGenerator::emitConstruct):
1840         (KJS::CodeGenerator::emitPushScope):
1841         (KJS::CodeGenerator::emitPopScope):
1842         (KJS::CodeGenerator::emitDebugHook):
1843         (KJS::CodeGenerator::emitComplexJumpScopes):
1844         (KJS::CodeGenerator::emitJumpScopes):
1845         (KJS::CodeGenerator::emitNextPropertyName):
1846         (KJS::CodeGenerator::emitGetPropertyNames):
1847         (KJS::CodeGenerator::emitCatch):
1848         (KJS::CodeGenerator::emitThrow):
1849         (KJS::CodeGenerator::emitNewError):
1850         (KJS::CodeGenerator::emitJumpSubroutine):
1851         (KJS::CodeGenerator::emitSubroutineReturn):
1852         * VM/CodeGenerator.h:
1853         * VM/Machine.cpp:
1854         (KJS::Machine::privateExecute):
1855         * VM/Opcode.cpp:
1856         * VM/Opcode.h:
1857
1858 2008-06-11  Darin Adler  <darin@apple.com>
1859
1860         Reviewed by Alexey.
1861
1862         - fix https://bugs.webkit.org/show_bug.cgi?id=19442
1863           JavaScript array implementation doesn't maintain m_numValuesInVector when sorting
1864
1865         * kjs/array_instance.cpp:
1866         (KJS::ArrayInstance::checkConsistency): Added. Empty inline version for when
1867         consistency checks are turned off.
1868         (KJS::ArrayInstance::ArrayInstance): Check consistency after construction.
1869         (KJS::ArrayInstance::~ArrayInstance): Check consistency before destruction.
1870         (KJS::ArrayInstance::put): Check consistency before and after.
1871         (KJS::ArrayInstance::deleteProperty): Ditto.
1872         (KJS::ArrayInstance::setLength): Ditto.
1873         (KJS::compareByStringPairForQSort): Use typedef for clarity.
1874         (KJS::ArrayInstance::sort): Check consistency before and after. Also broke the loop
1875         to set up sorting into two separate passes. Added FIXMEs about various exception
1876         safety issues. Added code to set m_numValuesInVector after sorting.
1877         (KJS::ArrayInstance::compactForSorting): Ditto.
1878
1879         * kjs/array_instance.h: Added a definition of an enum for the types of consistency
1880         check and a declaration of the consistency checking function.
1881
1882 2008-06-10  Kevin Ollivier  <kevino@theolliviers.com>
1883
1884         wx build fix. Link against libedit on Mac since HAVE(READLINE) is defined there.
1885
1886         * jscore.bkl:
1887
1888 2008-06-10  Alexey Proskuryakov  <ap@webkit.org>
1889
1890         Reviewed by Darin.
1891
1892         https://bugs.webkit.org/show_bug.cgi?id=16503
1893         match limit takes at least 13% of the time on the SunSpider regexp-dna test
1894
1895         Make the limit test slightly more efficient. It is not clear how much of a win it is,
1896         as the improvement on regexp-dna varies from 2.3% to 0.6% depending on what revision I
1897         apply the patch to. Today, the win on regexp-dna was minimal, but the total win was whopping
1898         0.5%, due to random code generation changes.
1899
1900         * pcre/pcre_exec.cpp: (match): Avoid loading a constant on each iteration.
1901
1902 2008-06-09  Alp Toker  <alp@nuanti.com>
1903
1904         gcc3/autotools build fix. Add explicit -O2 -fno-strict-aliasing to
1905         each of the tools since these are no longer set globally.
1906
1907         * GNUmakefile.am:
1908
1909 2008-06-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1910
1911         Reviewed by Sam.
1912
1913         Add an include for readline/history.h to fix the build for Darwin users
1914         with the GNU readline library installed. Also, clean up the style of
1915         the HAVE(READLINE) check.
1916
1917         * kjs/testkjs.cpp:
1918         (runInteractive):
1919
1920 2008-06-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1921
1922         Reviewed by Darin.
1923
1924         Bug 17531: Add interactive mode to testkjs
1925         <https://bugs.webkit.org/show_bug.cgi?id=17531>
1926
1927         This is a cleaned up version of Sam's earlier patch to add an
1928         interactive mode to testkjs.
1929
1930         Readline support is only enabled on Darwin platforms for now, but
1931         other ports can enable it by defining HAVE_READLINE in kjs/config.h.
1932
1933         * JavaScriptCore.xcodeproj/project.pbxproj:
1934         * kjs/config.h:
1935         * kjs/testkjs.cpp:
1936         (Options::Options):
1937         (runWithScripts):
1938         (runInteractive):
1939         (printUsageStatement):
1940         (parseArguments):
1941         (kjsmain):
1942
1943 2008-06-08  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1944
1945         Reviewed by Darin.
1946
1947         Bug 19346: REGRESSION: Mootools 1.2 Class inheritance broken in post-SquirrelFish merge
1948         <https://bugs.webkit.org/show_bug.cgi?id=19346>
1949
1950         A check for whether a function's caller is eval code accidentally included
1951         the case where the caller's caller is native code. Add a CodeType field to
1952         CodeBlock and use this for the eval caller test instead.
1953
1954         * VM/CodeBlock.h:
1955         (KJS::CodeBlock::CodeBlock):
1956         (KJS::ProgramCodeBlock::ProgramCodeBlock):
1957         (KJS::EvalCodeBlock::EvalCodeBlock):
1958         * VM/Machine.cpp:
1959         (KJS::getCallerFunctionOffset):
1960         * kjs/nodes.cpp:
1961         (KJS::FunctionBodyNode::generateCode):
1962         (KJS::ProgramNode::generateCode):
1963
1964 2008-06-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1965
1966         Reviewed by Dan Bernstein.
1967
1968         Bug 17928: testkjs shouldn't require "-f"
1969         <https://bugs.webkit.org/show_bug.cgi?id=17928>
1970
1971         * kjs/testkjs.cpp:
1972         (printUsageStatement):
1973         (parseArguments):
1974
1975 2008-06-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1976
1977         Reviewed by Eric.
1978
1979         Bug 17548: JavaScriptCore print(a, b) differs from Spidermonkey Behavior
1980         <https://bugs.webkit.org/show_bug.cgi?id=17548>
1981
1982         * kjs/testkjs.cpp:
1983         (functionPrint):
1984
1985 2008-06-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1986
1987         Reviewed by Sam.
1988
1989         Bug 17547: JavaScriptCore print() differs from Spidermonkey Behavior
1990         <https://bugs.webkit.org/show_bug.cgi?id=17547>
1991
1992         * kjs/testkjs.cpp:
1993         (functionPrint):
1994
1995 2008-06-07  Alexey Proskuryakov  <ap@webkit.org>
1996
1997         More build fixes.
1998
1999         * kjs/JSGlobalData.cpp: Fixed an included file name for case-sensitive file systems, fixed
2000         JSGlobalData::threadInstance() for non-multithreaded builds.
2001
2002 2008-06-07  Alexey Proskuryakov  <ap@webkit.org>
2003
2004         Build fix - actually adding JSGlobalData.cpp to non-Mac builds!
2005
2006         * GNUmakefile.am:
2007         * JavaScriptCore.pri:
2008         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2009         * JavaScriptCoreSources.bkl:
2010
2011 2008-06-07  Alexey Proskuryakov  <ap@webkit.org>
2012
2013         Try to fix Gtk/gcc 4.3 build.
2014
2015         * kjs/JSGlobalData.h: Include ustring.h instead of forward-declaring UString::Rep.
2016
2017 2008-06-06  Alexey Proskuryakov  <ap@webkit.org>
2018
2019         Reviewed by Darin.
2020
2021         Combine per-thread objects into one, to make it easier to support legacy clients (for
2022         which they shouldn't be really per-thread).
2023
2024         No change on SunSpider total.
2025
2026         * JavaScriptCore.xcodeproj/project.pbxproj: Added JSGlobalData.{h,cpp}
2027
2028         * kjs/JSGlobalData.cpp: Added.
2029         (KJS::JSGlobalData::JSGlobalData):
2030         (KJS::JSGlobalData::~JSGlobalData):
2031         (KJS::JSGlobalData::threadInstance):
2032         * kjs/JSGlobalData.h: Added.
2033         This class encapsulates all data that should be per-thread (or shared between legacy clients).
2034         It will also keep a Heap pointer, but right now, Heap (Collector) methods are all static.
2035
2036         * kjs/identifier.h:
2037         (KJS::Identifier::Identifier):
2038         Added a constructor explicitly taking JSGlobalData to access IdentifierTable. Actually,
2039         all of them should, but this will be a separate patch.
2040
2041         * kjs/identifier.cpp:
2042         (KJS::IdentifierTable::literalTable):
2043         (KJS::createIdentifierTable):
2044         (KJS::deleteIdentifierTable):
2045         (KJS::Identifier::add):
2046         (KJS::Identifier::addSlowCase):
2047         Combined IdentifierTable and LiteralIdentifierTable into a single class for simplicity.
2048
2049         * kjs/grammar.y: kjsyyparse now takes JSGlobalData, not just a Lexer.
2050
2051         * kjs/nodes.cpp:
2052         (KJS::Node::Node):
2053         (KJS::EvalFunctionCallNode::emitCode):
2054         (KJS::ScopeNode::ScopeNode):
2055         Changed to access Lexer and Parser via JSGlobalData::threadInstance(). This is also a
2056         temporary measure, they will need to use JSGlobalData explicitly.
2057
2058         * VM/CodeGenerator.cpp:
2059         (KJS::CodeGenerator::CodeGenerator):
2060         * VM/CodeGenerator.h:
2061         * VM/Machine.cpp:
2062         (KJS::callEval):
2063         * kjs/CommonIdentifiers.cpp:
2064         (KJS::CommonIdentifiers::CommonIdentifiers):
2065         * kjs/CommonIdentifiers.h:
2066         * kjs/DebuggerCallFrame.cpp:
2067         (KJS::DebuggerCallFrame::evaluate):
2068         * kjs/ExecState.cpp:
2069         (KJS::ExecState::ExecState):
2070         * kjs/ExecState.h:
2071         (KJS::ExecState::globalData):
2072         (KJS::ExecState::identifierTable):
2073         (KJS::ExecState::propertyNames):
2074         (KJS::ExecState::emptyList):
2075         (KJS::ExecState::lexer):
2076         (KJS::ExecState::parser):
2077         (KJS::ExecState::arrayTable):
2078         (KJS::ExecState::dateTable):
2079         (KJS::ExecState::mathTable):
2080         (KJS::ExecState::numberTable):
2081         (KJS::ExecState::RegExpImpTable):
2082         (KJS::ExecState::RegExpObjectImpTable):
2083         (KJS::ExecState::stringTable):
2084         * kjs/InitializeThreading.cpp:
2085         (KJS::initializeThreadingOnce):
2086         * kjs/JSGlobalObject.cpp:
2087         (KJS::JSGlobalObject::init):
2088         * kjs/JSGlobalObject.h:
2089         (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
2090         (KJS::JSGlobalObject::head):
2091         (KJS::JSGlobalObject::globalData):
2092         * kjs/Parser.cpp:
2093         (KJS::Parser::parse):
2094         * kjs/Parser.h:
2095         * kjs/function.cpp:
2096         (KJS::FunctionImp::getParameterName):
2097         (KJS::IndexToNameMap::unMap):
2098         (KJS::globalFuncEval):
2099         * kjs/function_object.cpp:
2100         (KJS::FunctionObjectImp::construct):
2101         * kjs/interpreter.cpp:
2102         (KJS::Interpreter::checkSyntax):
2103         (KJS::Interpreter::evaluate):
2104         * kjs/lexer.cpp:
2105         (kjsyylex):
2106         * kjs/lexer.h:
2107         * kjs/testkjs.cpp:
2108         (prettyPrintScript):
2109         Updated for the above changes. Most of threadInstance uses here will need to be replaced with
2110         explicitly passed pointers to support legacy JSC clients.
2111
2112         * JavaScriptCore.exp: Removed KJS::parser().
2113
2114 2008-06-06  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2115
2116         Reviewed by Oliver.
2117
2118         Bug 19424: Add support for logging opcode pair counts
2119         <https://bugs.webkit.org/show_bug.cgi?id=19424>
2120
2121         * VM/Machine.cpp:
2122         (KJS::Machine::privateExecute):
2123         * VM/Opcode.cpp:
2124         (KJS::OpcodeStats::OpcodeStats):
2125         (KJS::compareOpcodeIndices):
2126         (KJS::compareOpcodePairIndices):
2127         (KJS::OpcodeStats::~OpcodeStats):
2128         (KJS::OpcodeStats::recordInstruction):
2129         (KJS::OpcodeStats::resetLastInstruction):
2130         * VM/Opcode.h:
2131
2132 2008-06-06  Kevin McCullough  <kmccullough@apple.com>
2133
2134         Reviewed by Adam.
2135
2136         <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
2137         profiler.
2138         - Change the remaining functions that do not take arguments, from using
2139         recursion to using iteration.
2140
2141         * JavaScriptCore.exp:
2142         * profiler/Profile.cpp:
2143         (KJS::stopProfiling):
2144         (KJS::restoreAll):
2145         (KJS::Profile::stopProfiling): Use foreach instead of recursion.
2146         (KJS::Profile::restoreAll): Ditto.
2147         * profiler/Profile.h:
2148         * profiler/ProfileNode.cpp: Remove recursion.
2149         (KJS::ProfileNode::stopProfiling):
2150         (KJS::ProfileNode::restore):
2151         * profiler/ProfileNode.h:
2152
2153 2008-06-05  Oliver Hunt  <oliver@apple.com>
2154
2155         Reviewed by Alexey.
2156
2157         Fix Greater and GreaterEq nodes to emit code for the left
2158         and right sub-expressions in the correct order.
2159
2160         * kjs/nodes.cpp:
2161         (KJS::GreaterNode::emitCode):
2162         (KJS::GreaterEqNode::emitCode):
2163
2164 2008-06-05  Antti Koivisto  <antti@apple.com>
2165
2166         Reviewed by Alp Toker.
2167         
2168         Fix whitespaces.
2169
2170         * kjs/collector.cpp:
2171         (KJS::getPlatformThreadRegisters):
2172
2173 2008-06-05  Antti Koivisto  <antti@apple.com>
2174
2175         Reviewed by Darin.
2176         
2177         Support compiling JavaScriptCore for ARM.
2178
2179         * kjs/collector.cpp:
2180         (KJS::getPlatformThreadRegisters):
2181         (KJS::otherThreadStackPointer):
2182
2183 2008-06-05  Kevin McCullough  <kmccullough@apple.com>
2184
2185         Reviewed by Jon.
2186
2187         - Name changes.
2188
2189         * JavaScriptCore.exp:
2190         * profiler/Profile.cpp:
2191         (KJS::Profile::Profile):
2192         (KJS::Profile::stopProfiling):
2193         (KJS::Profile::didExecute):
2194         (KJS::Profile::forEach):
2195         (KJS::Profile::debugPrintData):
2196         (KJS::Profile::debugPrintDataSampleStyle):
2197         * profiler/Profile.h:
2198         (KJS::Profile::callTree):
2199         (KJS::Profile::totalTime):
2200         (KJS::Profile::sortTotalTimeDescending):
2201         (KJS::Profile::sortTotalTimeAscending):
2202         (KJS::Profile::sortSelfTimeDescending):
2203         (KJS::Profile::sortSelfTimeAscending):
2204         (KJS::Profile::sortCallsDescending):
2205         (KJS::Profile::sortCallsAscending):
2206         (KJS::Profile::sortFunctionNameDescending):
2207         (KJS::Profile::sortFunctionNameAscending):
2208         (KJS::Profile::focus):
2209         (KJS::Profile::exclude):
2210         (KJS::Profile::restoreAll):
2211
2212 2008-06-05  Geoffrey Garen  <ggaren@apple.com>
2213
2214         Reviewed by Stephanie Lewis.
2215
2216         Added the -fno-move-loop-invariants flag to the pcre_exec.cpp build, to
2217         tell GCC not to perform loop invariant motion, since GCC's loop
2218         invariant motion doesn't do very well with computed goto code.
2219         
2220         SunSpider reports no change.
2221
2222 2008-06-05  Geoffrey Garen  <ggaren@apple.com>
2223
2224         Reviewed by Stephanie Lewis.
2225         
2226         Added the -fno-tree-pre flag to the Machine.cpp build, to tell GCC not
2227         to perform Partial Redundancy Elimination (PRE) on trees in Machine.cpp,
2228         since GCC's PRE doesn't do very well with computed goto code.
2229         
2230         SunSpider reports a .7% speedup.
2231         
2232 2008-06-05  Geoffrey Garen  <ggaren@apple.com>
2233
2234         Reviewed by Stephanie Lewis (or maybe the other way around).
2235         
2236         Minor change to PCRE to help out certain compilers.
2237         
2238         SunSpider reports no change, maybe a small speedup.
2239
2240         * pcre/pcre_exec.cpp:
2241         (match): Use instructionPtr++ a little less, to avoid confusing the
2242         optimizer.
2243
2244 2008-06-05  Alexey Proskuryakov  <ap@webkit.org>
2245
2246         Re-landing an independent part of a previously rolled out threading patch.
2247
2248         * wtf/ThreadSpecific.h: Make sure to initialize POD thread-specific varaibles, too
2249         (replaced "new T" with "new T()").
2250
2251 2008-06-05  Maciej Stachowiak  <mjs@apple.com>
2252
2253         Reviewed by Hyatt.
2254         
2255         - force inlining of a template function that only has one call site per specialization
2256         1.3% speedup on SunSpider
2257
2258         * kjs/collector.cpp:
2259         (KJS::Collector::heapAllocate): This template function is only
2260         called from allocate() and allocateNumber() (once per
2261         specialization) and the extra call overhead for GC allocation
2262         shows up, so force inlining.
2263
2264 2008-06-05  Maciej Stachowiak  <mjs@apple.com>
2265
2266         Reviewed by Alexey and Oliver.
2267         
2268         - remove profiler fetch hack
2269         I measure an 0.5% progression from this, others show a wash. It seems not needed any more.
2270
2271         * VM/Machine.cpp:
2272         (KJS::Machine::privateExecute):
2273
2274 2008-06-05  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2275
2276         Reviewed by Maciej.
2277
2278         Bug 19400: subscript operator does not protect base when necessary
2279         <https://bugs.webkit.org/show_bug.cgi?id=19400>
2280
2281         Use a temporary for the base in BracketAccessorNode if the subscript
2282         might possibly modify it.
2283
2284         * kjs/grammar.y:
2285         * kjs/nodes.cpp:
2286         (KJS::BracketAccessorNode::emitCode):
2287         * kjs/nodes.h:
2288         (KJS::BracketAccessorNode::):
2289
2290 2008-06-04  Sam Weinig  <sam@webkit.org>
2291
2292         Reviewed by Maciej Stachowiak.
2293
2294         Big cleanup of formatting and whitespace.
2295
2296 2008-06-04  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2297
2298         Reviewed by Oliver.
2299
2300         Add an option to dump statistics on executed instructions.
2301
2302         * VM/Machine.cpp:
2303         (KJS::Machine::privateExecute):
2304         * VM/Opcode.cpp:
2305         (KJS::OpcodeStats::~OpcodeStats):
2306         (KJS::OpcodeStats::recordInstruction):
2307         * VM/Opcode.h:
2308
2309 2008-06-04  Kevin McCullough  <kmccullough@apple.com>
2310
2311         Reviewed by Geoff.
2312
2313         <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
2314         profiler.
2315         - This patch removes the use of recursion for the sort functions.
2316
2317         * JavaScriptCore.exp: Change the signatures of the functions being
2318         exported.
2319         * profiler/Profile.cpp:
2320         (KJS::Profile::sort): This generic function will accept any of the
2321         static sort functions and apply them to the whole tree.
2322         * profiler/Profile.h: All of the sorting functions now call the new
2323         sort() function.
2324         (KJS::Profile::sortTotalTimeDescending):
2325         (KJS::Profile::sortTotalTimeAscending):
2326         (KJS::Profile::sortSelfTimeDescending):
2327         (KJS::Profile::sortSelfTimeAscending):
2328         (KJS::Profile::sortCallsDescending):
2329         (KJS::Profile::sortCallsAscending):
2330         (KJS::Profile::sortFunctionNameDescending):
2331         (KJS::Profile::sortFunctionNameAscending):
2332         * profiler/ProfileNode.cpp:
2333         (KJS::ProfileNode::ProfileNode): m_head used to point to the head node
2334         if this was the head node.  It now points to null to make iteration easy
2335         (KJS::ProfileNode::willExecute): Now must check if m_head is null, this
2336         check used to happend in the constructor.
2337         (KJS::ProfileNode::stopProfiling): Again the check is slightly different
2338         to determine if this is the head.
2339         (KJS::ProfileNode::traverseNextNode): This function returns the next
2340         node in post order.
2341         (KJS::ProfileNode::sort): This generic function will sort according to
2342         the comparator passed in, then reset the children pointers to macth the
2343         new order.
2344         * profiler/ProfileNode.h: The sorting function were removed from the
2345         definition file and instead use the new generic sort() function
2346         (KJS::ProfileNode::totalPercent): because the head can now be empty we
2347         need to check here too for the head node.
2348         (KJS::ProfileNode::selfPercent): Ditto
2349         (KJS::ProfileNode::firstChild): This function is necessary for the 
2350         iterative algorithm in Profile.cpp.
2351         (KJS::ProfileNode::sortTotalTimeDescending):
2352         (KJS::ProfileNode::sortTotalTimeAscending):
2353         (KJS::ProfileNode::sortSelfTimeDescending):
2354         (KJS::ProfileNode::sortSelfTimeAscending):
2355         (KJS::ProfileNode::sortCallsDescending):
2356         (KJS::ProfileNode::sortCallsAscending):
2357         (KJS::ProfileNode::sortFunctionNameDescending):
2358         (KJS::ProfileNode::sortFunctionNameAscending):
2359         (KJS::ProfileNode::childrenBegin):
2360         (KJS::ProfileNode::childrenEnd):
2361         (KJS::ProfileNode::totalTimeDescendingComparator):
2362         (KJS::ProfileNode::totalTimeAscendingComparator):
2363         (KJS::ProfileNode::selfTimeDescendingComparator):
2364         (KJS::ProfileNode::selfTimeAscendingComparator):
2365         (KJS::ProfileNode::callsDescendingComparator):
2366         (KJS::ProfileNode::callsAscendingComparator):
2367         (KJS::ProfileNode::functionNameDescendingComparator):
2368         (KJS::ProfileNode::functionNameAscendingComparator):
2369
2370 2008-06-04  Alexey Proskuryakov  <ap@webkit.org>
2371
2372         Reviewed by Darin.
2373
2374         Fix JSClassCreate to work with old JSCore API threading model.
2375
2376         No change on SunSpider.
2377
2378         * API/JSClassRef.cpp: (OpaqueJSClass::OpaqueJSClass): Since JSClass is constructed without
2379         a context, there is no way for it to create Identifiers.
2380         Also, added initializeThreading(), just for good measure.
2381
2382         * API/JSCallbackObjectFunctions.h: (KJS::::getPropertyNames): Make an Identifier out of the
2383         string here, because propertyNames.add() needs that.
2384
2385         * kjs/identifier.cpp:
2386         * kjs/identifier.h:
2387         (KJS::Identifier::equal):
2388         * kjs/ustring.cpp:
2389         (KJS::equal):
2390         Moved equal() from identifier.h to ustring.h, because it's not really about Identifiers,
2391         and to make it possible to use it from StrHash.
2392         Include StrHash.h from ustring.h to avoid having the behavior depend on headers that happen
2393         to be included.
2394
2395         * wtf/StrHash.h: Removed.
2396         * kjs/ustring.h: Made RefPtr<UString::Rep> use the same default hash as UString::Rep* (it
2397         used to default to pointer equality). Moved the whole StrHash header into ustring.h.
2398
2399         * JavaScriptCore.exp: Export equal() for WebCore use (this StrHash is used in c_class.cpp,
2400         jni_class.cpp, and npruntime.cpp).
2401
2402 2008-06-04  Alexey Proskuryakov  <ap@webkit.org>
2403
2404         Rubber-stamped by Darin.
2405
2406         Fix spacing in collector.{h,cpp}.
2407
2408         * kjs/collector.cpp:
2409         * kjs/collector.h:
2410
2411 2008-06-03  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2412
2413         Reviewed by Maciej.
2414
2415         Build fix. The cleanup in r34355 missed a method.
2416
2417         * kjs/nodes.cpp:
2418         * kjs/nodes.h:
2419
2420 2008-06-03  Darin Adler  <darin@apple.com>
2421
2422         Reviewed by Geoff.
2423
2424         - https://bugs.webkit.org/show_bug.cgi?id=19269
2425           speed up SunSpider by eliminating the toObject call for most get/put/delete
2426
2427         Makes standalone SunSpider 1.025x as fast as before.
2428
2429         The getOwnPropertySlot virtual function now takes care of the toObject call
2430         for get. Similarly, the put function (and later deleteProperty) does the
2431         same for those operations. To do this, the virtual functions were moved from
2432         the JSObject class to the JSCell class. Also, since the caller no longer knows
2433         the identity of the "original object", which is used by JavaScript-function
2434         based getters, changed the PropertySlot class so the original object is
2435         already stored in the slot when getOwnPropertySlot is called, if the caller
2436         intends to call getValue.
2437
2438         This affected the old interpreter code enough that the easiest thing for me
2439         was to just delete it. While I am not certain the mysterious slowdown is not
2440         still occurring, the net change is definitely a significant speedup.
2441
2442         * JavaScriptCore.exp: Updated.
2443
2444         * VM/Machine.cpp: Moved the UNLIKELY macro into AlwaysInline.h.
2445         (KJS::resolve): Set up the originalObject in the PropertySlot before
2446         calling getPropertySlot. Also removed the originalObject argument from
2447         getValue.
2448         (KJS::resolve_skip): Ditto.
2449         (KJS::resolveBaseAndProperty): Ditto.
2450         (KJS::resolveBaseAndFunc): Ditto.
2451         (KJS::Machine::privateExecute): Removed the toObject calls from the get and
2452         put functions where possible, instead calling directly with JSValue and letting
2453         the JSValue and JSCell calls handle toObject. Same for toThisObject.
2454
2455         * kjs/ExecState.h: Removed OldInterpreterExecState.
2456
2457         * API/JSBase.cpp: Updated includes.
2458
2459         * kjs/LocalStorageEntry.h: Removed contents. Later we can remove the file too.
2460
2461         * kjs/array_instance.cpp:
2462         (KJS::ArrayInstance::lengthGetter): Removed originalObject argumet.
2463         (KJS::ArrayInstance::inlineGetOwnPropertySlot): Don't pass a base value to
2464         setValueSlot. Also use UNLIKELY around the "getting elements past the end of
2465         the array" code path; less common than successfully getting an element.
2466
2467         * kjs/array_object.cpp:
2468         (KJS::getProperty): Initialize the PropertySlot with the original object.
2469         Don't pass the original object to the get function.
2470         (KJS::arrayProtoFuncFilter): Ditto.
2471         (KJS::arrayProtoFuncMap): Ditto.
2472         (KJS::arrayProtoFuncEvery): Ditto.
2473         (KJS::arrayProtoFuncForEach): Ditto.
2474         (KJS::arrayProtoFuncSome): Ditto.
2475
2476         * kjs/function_object.cpp:
2477         (KJS::FunctionObjectImp::construct): Removed an obsolete comment.
2478
2479         * kjs/grammar.y: Eliminated support for some of the node types that were
2480         used to optimize executing from the syntax tree.
2481
2482         * kjs/internal.cpp:
2483         (KJS::StringImp::toThisObject): Added. Same as toObject.
2484         (KJS::NumberImp::toThisObject): Ditto.
2485         (KJS::GetterSetterImp::getOwnPropertySlot): Added. Not reached.
2486         (KJS::GetterSetterImp::put): Ditto.
2487         (KJS::GetterSetterImp::toThisObject): Ditto.
2488
2489         * kjs/internal.h: Added toThisObject to NumberImp for speed.
2490
2491         * kjs/lexer.cpp:
2492         (KJS::Lexer::shift): Changed shift to just do a single character, to unroll
2493         the loop and especially to make the one character case faster.
2494         (KJS::Lexer::setCode): Call shift multiple times instead of passing a number.
2495         (KJS::Lexer::lex): Ditto.
2496         (KJS::Lexer::matchPunctuator): Ditto. Also removed unneeded elses after returns.
2497         (KJS::Lexer::scanRegExp): Ditto.
2498         * kjs/lexer.h: Removed the count argument from shift.
2499
2500         * kjs/math_object.cpp:
2501         (KJS::mathProtoFuncPow): Call jsNaN instead of jsNumber(NaN).
2502
2503         * kjs/nodes.cpp: Removed some of the things needed only for the pre-SquirrelFish
2504         execution model.
2505         (KJS::ForNode::emitCode): Handle cases where some expressions are missing by
2506         not emitting any code at all. The old way was to emit code for "true", but
2507         this is an unnecessary remnant of the old way of doing things.
2508
2509         * kjs/nodes.h: Removed some of the things needed only for the pre-SquirrelFish
2510         execution model.
2511
2512         * kjs/object.cpp:
2513         (KJS::JSObject::fillGetterPropertySlot): Changed to only pass in the getter
2514         function. The old code passed in a base, but it was never used when
2515         actually getting the property; the toThisObject call was pointless. Also
2516         changed to not pass a base for setUndefined.
2517
2518         * kjs/object.h: Added the new JSCell operations to GetterSetterImp.
2519         Never called.
2520         (KJS::JSObject::get): Initialize the object in the PropertySlot and don't
2521         pass it in getValue.
2522         (KJS::JSObject::getOwnPropertySlotForWrite): Removed the base argument
2523         in calls to setValueSlot.
2524         (KJS::JSObject::getOwnPropertySlot): Ditto.
2525         (KJS::JSValue::get): Added. Here because it calls through to JSObject.
2526         A version of JSObject::get that also handles the other types of JSValue
2527         by creating the appropriate wrapper. Saves the virtual call to toObject.
2528         (KJS::JSValue::put): Ditto.
2529         (KJS::JSValue::deleteProperty): Ditto.
2530
2531         * kjs/property_slot.cpp:
2532         (KJS::PropertySlot::undefinedGetter): Removed the originalObject argument.
2533         (KJS::PropertySlot::ungettableGetter): Ditto.
2534         (KJS::PropertySlot::functionGetter): Ditto. Use the value in the base
2535         as the "this" object, which will be set to the original object by the new
2536         PropertySlot initialization code. Also call toThisObject. The old code did
2537         not do this, but needed to so we can properly handle the activation object
2538         like the other similar code paths.
2539
2540         * kjs/property_slot.h:
2541         (KJS::PropertySlot::PropertySlot): Added a constructor that takes a base
2542         object. In debug builds, set the base to 0 if you don't pass one.
2543         (KJS::PropertySlot::getValue): Don't take or pass the originalObject.
2544         (KJS::PropertySlot::setValueSlot): Don't take a base object, and clear the
2545         base object in debug builds.
2546         (KJS::PropertySlot::setGetterSlot): Ditto.
2547         (KJS::PropertySlot::setUndefined): Ditto.
2548         (KJS::PropertySlot::setUngettable): Ditto.
2549         (KJS::PropertySlot::slotBase): Assert that a base object is present.
2550         This will fire if someone actually calls the get function without having
2551         passed in a base object and the getter needs it.
2552         (KJS::PropertySlot::setBase): Added. Used by the code that implements
2553         toObject so it can supply the original object after the fact.
2554         (KJS::PropertySlot::clearBase): Added. Clears the base, but is debug-only
2555         code because it's an error to fetch the base if you don't have a guarantee
2556         it was set.
2557
2558         * API/JSCallbackObject.h:
2559         * API/JSCallbackObjectFunctions.h:
2560         (KJS::JSCallbackObject::cachedValueGetter):
2561         (KJS::JSCallbackObject::staticValueGetter):
2562         (KJS::JSCallbackObject::staticFunctionGetter):
2563         (KJS::JSCallbackObject::callbackGetter):
2564         * kjs/JSActivation.cpp:
2565         (KJS::JSActivation::getOwnPropertySlot):
2566         (KJS::JSActivation::argumentsGetter):
2567         * kjs/JSActivation.h:
2568         * kjs/JSVariableObject.h:
2569         (KJS::JSVariableObject::symbolTableGet):
2570         * kjs/array_instance.h:
2571         * kjs/function.cpp:
2572         (KJS::FunctionImp::argumentsGetter):
2573         (KJS::FunctionImp::callerGetter):
2574         (KJS::FunctionImp::lengthGetter):
2575         (KJS::Arguments::mappedIndexGetter):
2576         * kjs/function.h:
2577         * kjs/lookup.h:
2578         (KJS::staticFunctionGetter):
2579         (KJS::staticValueGetter):
2580         * kjs/string_object.cpp:
2581         (KJS::StringInstance::lengthGetter):
2582         (KJS::StringInstance::indexGetter):
2583         (KJS::stringInstanceNumericPropertyGetter):
2584         * kjs/string_object.h:
2585         Removed originalObject arguments from getters. Don't pass base values to
2586         the various PropertySlot functions that no longer take them.
2587
2588         * kjs/value.cpp:
2589         (KJS::JSCell::getOwnPropertySlot): Added. Calls toObject and then sets the slot.
2590         This function has to always return true, because the caller can't walk the prototype
2591         chain. Because of that, we do a getPropertySlot, not getOwnPropertySlot, which works
2592         for the caller. This is private, only called by getOwnPropertySlotInternal.
2593         (KJS::JSCell::put): Added. Calls toObject and then put.
2594         (KJS::JSCell::toThisObject): Added. Calls toObject.
2595
2596         * kjs/value.h: Added get, put, and toThisObject to both JSValue
2597         and JSCell. These take care of the toObject operation without an additional virtual
2598         function call, and so make the common "already an object" case faster.
2599
2600         * wtf/AlwaysInline.h: Moved the UNLIKELY macro here for now. Maybe we can find a
2601         better place later, or rename this header.
2602
2603 2008-06-03  Oliver Hunt  <oliver@apple.com>
2604
2605         Reviewed by Tim.
2606
2607         Bug 12983: Web Inspector break on the debugger keyword
2608         <https://bugs.webkit.org/show_bug.cgi?id=12983>
2609
2610         Added a DebuggerStatementNode to handle codegen, and added a new
2611         DidReachBreakPoint debug event (which will hopefully be useful
2612         if we ever move breakpoint management into JSC proper).  Also
2613         added didReachBreakpoint to Debugger to allow us to actually respond
2614         to this event.
2615
2616         * VM/CodeBlock.cpp:
2617         (KJS::debugHookName):
2618         * VM/Machine.cpp:
2619         (KJS::Machine::debug):
2620         * VM/Machine.h:
2621         * kjs/debugger.h:
2622         * kjs/grammar.y:
2623         * kjs/nodes.cpp:
2624         (KJS::DebuggerStatementNode::emitCode):
2625         (KJS::DebuggerStatementNode::execute):
2626         * kjs/nodes.h:
2627         (KJS::DebuggerStatementNode::):
2628         * kjs/nodes2string.cpp:
2629         (KJS::DebuggerStatementNode::streamTo):
2630
2631 2008-06-03  Maciej Stachowiak  <mjs@apple.com>
2632
2633         Reviewed by Oliver.
2634         
2635         - document remaining opcodes.
2636
2637         * VM/Machine.cpp:
2638         (KJS::Machine::privateExecute): Document call, call_eval,
2639         construct, ret and end opcodes.
2640
2641 2008-06-03  Maciej Stachowiak  <mjs@apple.com>
2642
2643         Reviewed by Oliver.
2644
2645         * VM/Machine.cpp:
2646         (KJS::Machine::privateExecute): Document throw and catch opcodes.
2647
2648 2008-06-02  Geoffrey Garen  <ggaren@apple.com>
2649
2650         Reviewed by Alexey Proskuryakov.
2651
2652         Removed JSObject::call, since it just called JSObject::callAsFunction.
2653
2654         SunSpider reports no change.
2655
2656 2008-06-02  Geoffrey Garen  <ggaren@apple.com>
2657
2658         Reviewed by Darin Adler.
2659         
2660         A little cleanup in the CodeGenerator.
2661
2662         * VM/CodeGenerator.cpp: A few changes here.
2663
2664         (1) Removed remaining cases of the old hack of putting "this" into the
2665         symbol table; replaced with explicit tracking of m_thisRegister.
2666
2667         (2) Made m_thisRegister behave the same for function, eval, and program
2668         code, removing the static programCodeThis() function.
2669
2670         (3) Added a feature to nix a ScopeNode's declaration stacks when done
2671         compiling, to save memory.
2672
2673         (4) Removed code that copied eval declarations into special vectors: we
2674         just use the originals in the ScopeNode now.
2675         
2676         * VM/CodeGenerator.h: Removed unneded parameters from the CodeGenerator
2677         constructor: we just use get that data from the ScopeNode now.
2678
2679         * VM/Machine.cpp:
2680         (KJS::Machine::execute): When executing an eval node, don't iterate a
2681         special copy of its declarations; iterate the originals, instead.
2682
2683         * kjs/nodes.cpp: Moved responsibility for knowing what AST data to throw
2684         away into the CodeGenerator. Nodes no longer call shrinkCapacity on
2685         their data directly.
2686         
2687         * kjs/nodes.h: Changed FunctionStack to ref its contents, so declaration
2688         data stays around even after we've thrown away the AST, unless we explicitly
2689         throw away the declaration data, too. This is useful for eval code, which
2690         needs to reference its declaration data at execution time. (Soon, it will
2691         be useful for program code, too, since program code should do the same.)
2692
2693 2008-06-02  Adam Roben  <aroben@apple.com>
2694
2695         Build fix for non-AllInOne builds
2696
2697         * kjs/array_object.cpp: Added a missing #include.
2698
2699 2008-06-02  Kevin McCullough  <kmccullough@apple.com>
2700
2701         Took out accidental confilct lines I checked in.
2702
2703         * ChangeLog:
2704
2705 2008-06-02  Kevin McCullough  <kmccullough@apple.com>
2706
2707         Reviewed by Darin.
2708
2709         <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
2710         profiler
2711         Implement Next Sibling pointers as groundwork for removing the recursion
2712         limit in the profiler.
2713
2714         * profiler/ProfileNode.cpp: Also I renamed parentNode and headNode since
2715         'node' is redundant.
2716         (KJS::ProfileNode::ProfileNode): Initialize the nextSibling.
2717         (KJS::ProfileNode::willExecute): If there are already children then the
2718         new child needs to be the nextSibling of the last child.
2719         (KJS::ProfileNode::didExecute):
2720         (KJS::ProfileNode::addChild): Ditto.
2721         (KJS::ProfileNode::stopProfiling):
2722         (KJS::ProfileNode::sortTotalTimeDescending): For all of the sorting
2723         algorithms once the children are sorted their nextSibling pointers need
2724         to be reset to reflect the new order.
2725         (KJS::ProfileNode::sortTotalTimeAscending):
2726         (KJS::ProfileNode::sortSelfTimeDescending):
2727         (KJS::ProfileNode::sortSelfTimeAscending):
2728         (KJS::ProfileNode::sortCallsDescending):
2729         (KJS::ProfileNode::sortCallsAscending):
2730         (KJS::ProfileNode::sortFunctionNameDescending):
2731         (KJS::ProfileNode::sortFunctionNameAscending):
2732         (KJS::ProfileNode::resetChildrensSiblings): This new function simply
2733         loops over all of the children and sets their nextSibling pointers to
2734         the next child in the Vector
2735         (KJS::ProfileNode::debugPrintData):
2736         * profiler/ProfileNode.h:
2737         (KJS::ProfileNode::parent):
2738         (KJS::ProfileNode::setParent):
2739         (KJS::ProfileNode::nextSibling):
2740         (KJS::ProfileNode::setNextSibling):
2741         (KJS::ProfileNode::totalPercent):
2742         (KJS::ProfileNode::selfPercent):
2743
2744 2008-06-02  Geoffrey Garen  <ggaren@apple.com>
2745
2746         Reviewed by Maciej Stachowiak.
2747
2748         Removed the recursion limit from JSObject::call, since the VM does
2749         recursion checking now.
2750
2751         This should allow us to remove JSObject::call entirely, netting a small
2752         speedup.
2753
2754         * kjs/object.cpp:
2755         (KJS::JSObject::call):
2756
2757 2008-06-02  Geoffrey Garen  <ggaren@apple.com>
2758
2759         Reviewed by Adele Peterson.
2760
2761         Added a specific affordance for avoiding stack overflow when converting
2762         recursive arrays to string, in preparation for removing generic stack
2763         overflow checking from JSObject::call.
2764         
2765         Tested by fast/js/toString-stack-overflow.html.
2766
2767 2008-06-02  Geoffrey Garen  <ggaren@apple.com>
2768
2769         Reviewed by Alice Liu.
2770         
2771         Refactored some hand-rolled code to call ScopeChain::globalObject instead.
2772
2773 2008-06-02  Geoffrey Garen  <ggaren@apple.com>
2774
2775         Reviewed by Darin Adler.
2776         
2777         Fixed ASSERT due to execution continuing after an exception is thrown
2778         during array sort.
2779
2780         * kjs/array_instance.cpp:
2781         (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key): Don't call the
2782         custom comparator function if an exception has been thrown. Just return
2783         1 for everything, so the sort completes quickly. (The result will be
2784         thrown away.)
2785
2786 2008-05-30  Timothy Hatcher  <timothy@apple.com>
2787
2788         Made the starting line number of scripts be 1-based throughout the engine.
2789         This cleans up script line numbers so they are all consistent now and fixes
2790         some cases where script execution was shown as off by one line in the debugger.
2791
2792         No change in SunSpider.
2793
2794         Reviewed by Oliver Hunt.
2795
2796         * API/minidom.c:
2797         (main): Pass a line number of 1 instead of 0 to parser().parse().
2798         * API/testapi.c:
2799         (main): Ditto. And removes a FIXME and changed an assertEqualsAsNumber
2800         to use 1 instead of 2 for the line number.
2801         * VM/Machine.cpp:
2802         (KJS::callEval): Pass a line number of 1 instead of 0.
2803         (KJS::Machine::debug): Use firstLine for WillExecuteProgram instead of
2804         lastLine. Use lastLine for DidExecuteProgram instead of firstLine.
2805         * kjs/DebuggerCallFrame.cpp:
2806         (KJS::DebuggerCallFrame::evaluate): Pass a line number of 1 instead of
2807         0 to parser().parse().
2808         * kjs/Parser.cpp:
2809         (KJS::Parser::parse): ASSERT startingLineNumber is greatter than 0. Change
2810         the startingLineNumber to be 1 if it was less than or equal to 0. This is needed
2811         for release builds to maintain compatibility with the JavaScriptCore API.
2812         * kjs/function.cpp:
2813         (KJS::globalFuncEval): Pass a line number of 1 instead of 0 to parser().parse().
2814         * kjs/function_object.cpp:
2815         (FunctionObjectImp::construct): Pass a line number of 1 instead of 0 to construct().
2816         * kjs/lexer.cpp:
2817         (Lexer::setCode): Made yylineno = startingLineNumber instead of adding 1.
2818         * kjs/testkjs.cpp:
2819         (functionRun): Pass a line number of 1 instead of 0 to Interpreter::evaluate().
2820         (functionLoad): Ditto.
2821         (prettyPrintScript): Ditto.
2822         (runWithScripts): Ditto.
2823         * profiler/Profiler.cpp:
2824         (WebCore::createCallIdentifier): Removed a plus 1 of startingLineNumber.
2825
2826 2008-05-30  Alexey Proskuryakov  <ap@webkit.org>
2827
2828         Reviewed by Darin.
2829
2830         https://bugs.webkit.org/show_bug.cgi?id=19180
2831         speed up SunSpider by optimizing immediate number cases
2832
2833         Also fixed a JavaScriptCore regression seen on PowerPC - we didn't clip left shift
2834         parameter to 0...31.
2835
2836         0.5% improvement on SunSpider overall, although a 8.5 regression on bitops-3bit-bits-in-byte.
2837
2838         * VM/Machine.cpp:
2839         (KJS::Machine::privateExecute):
2840
2841         * kjs/JSImmediate.h:
2842         (KJS::JSImmediate::toTruncatedUInt32): Added. Same as getTruncatedInt32, but casts the result
2843         to unsigned.
2844
2845 2008-05-30  Alexey Proskuryakov  <ap@webkit.org>
2846
2847         Reviewed by Oliver Hunt.
2848
2849         https://bugs.webkit.org/show_bug.cgi?id=19180
2850         speed up SunSpider by optimizing immediate number cases
2851
2852         Also fixed two JavaScriptCore regressions seen on PowerPC - we didn't clip right shift
2853         parameter to 0...31.
2854
2855         1.6% improvement on SunSpider, without significant regressions on any tests.
2856
2857         * VM/Machine.cpp:
2858         (KJS::Machine::privateExecute):
2859         Added fast paths for >>, ==, ===, !=, !==. Changed order of memory accesses in many
2860         cases, making them less dependent on gcc's ability to properly assign registers. With this,
2861         I could move exception checks back into slow code paths, and saw less randomness in general.
2862
2863         * kjs/JSImmediate.h:
2864         (KJS::JSImmediate::rightShiftImmediateNumbers):
2865         Added.
2866
2867 2008-05-29  Maciej Stachowiak  <mjs@apple.com>
2868
2869         Reviewed by Oliver.
2870
2871         - fixed <rdar://problem/5972943> REGRESSION(r33979): Flash clips do not play on cnn.com
2872         
2873         Finally blocks could clobber registers that had to remain live
2874         until they returned. This patch takes a conservative approach and
2875         makes sure that finally blocks do not reuse any registers that
2876         were previously allocated for the function. In the future this
2877         could probably be tightened up to be less profligate with the
2878         register allocation.
2879         
2880         * VM/CodeGenerator.cpp:
2881         (KJS::CodeGenerator::highestUsedRegister):
2882         * VM/CodeGenerator.h:
2883         * kjs/nodes.cpp:
2884         (KJS::TryNode::emitCode):
2885
2886 2008-05-29  Steve Falkenburg  <sfalken@apple.com>
2887
2888         Build fix.
2889
2890         * kjs/array_instance.cpp:
2891
2892 2008-05-29  Alexey Proskuryakov  <ap@webkit.org>
2893
2894         Reviewed by Darin.
2895
2896         https://bugs.webkit.org/show_bug.cgi?id=19294
2897         <rdar://problem/5969062> A crash when iterating over a sparse array backwards.
2898
2899         * kjs/array_instance.cpp: Turned sparseArrayCutoff into a macro, so that using max() on it
2900         doesn't cause a PIC branch.
2901         (KJS::ArrayInstance::increaseVectorLength): Added a comment about this function not
2902         preserving class invariants.
2903         (KJS::ArrayInstance::put): Update m_storage after reallocation. Move values that fit to
2904         the vector from the map in all code paths.
2905
2906 2008-05-29  Thiago Macieira  <tjmaciei@trolltech.com>
2907
2908         Reviewed by Simon.
2909
2910         Fix compilation in Solaris with Sun CC
2911
2912         Lots of WebKit code uses C99 functions that, strict as it
2913         is, the Solaris system doesn't provide in C++. So we must define them
2914         for both GCC and the Sun CC.
2915
2916         * wtf/MathExtras.h:
2917
2918 2008-05-28  Oliver Hunt  <oliver@apple.com>
2919
2920         Reviewed by Anders.
2921
2922         Fix codegen for assignment being used as a function.
2923
2924         FunctionCallValueNode::emitCode failed to account for the
2925         potential of the function expression to allocate arbitrary
2926         registers.
2927
2928         * kjs/nodes.cpp:
2929         (KJS::FunctionCallValueNode::emitCode):
2930
2931 2008-05-27  Geoffrey Garen  <ggaren@apple.com>
2932
2933         Reviewed by Tim Hatcher.
2934
2935         Fixed https://bugs.webkit.org/show_bug.cgi?id=19183
2936         REGRESSION (r33979): Crash in DebuggerCallFrame::functionName when
2937         clicking button in returnEvent-crash.html
2938
2939         Added two new debugger hooks, willExecuteProgram and didExecuteProgram,
2940         along with code to generate them, code to invoke them when unwinding
2941         due to an exception, and code to dump them.
2942         
2943         SunSpider reports no change.
2944
2945         * VM/CodeBlock.cpp:
2946         (KJS::debugHookName): I had to mark this function NEVER_INLINE to avoid
2947         a .4% performance regression. The mind boggles.
2948
2949 2008-05-28  Adam Roben  <aroben@apple.com>
2950
2951         Fix JavaScriptCore tests on OS X
2952
2953         We were quoting the path to testkjs too late, after it had already
2954         been combined with spaces and other options.
2955
2956         * tests/mozilla/jsDriver.pl:
2957         (top level): Move path quoting from here...
2958         (sub get_kjs_engine_command): ...to here.
2959
2960 2008-05-28  Anders Carlsson  <andersca@apple.com>
2961
2962         Reviewed by Oliver.
2963
2964         <rdar://problem/5968071> "const f" crashes in JavaScriptCore
2965         
2966         Make sure to null check the initializer.
2967         
2968         * kjs/nodes.cpp:
2969         (KJS::ConstDeclNode::emitCodeSingle):
2970
2971 2008-05-28  Adam Roben  <aroben@apple.com>
2972
2973         Make run-javascriptcore-tests work with a space in the path to testkjs
2974
2975         Reviewed by Alexey Proskuryakov.
2976
2977         * tests/mozilla/jsDriver.pl: Quote the path to the engine so that
2978         spaces will be interpreted correctly.
2979
2980 2008-05-28  Alexey Proskuryakov  <ap@webkit.org>
2981
2982         Fixed a misguiding comment - my measurement for negative numbers only included cases
2983         where both operands were negative, which is not very interesting.
2984
2985         * VM/Machine.cpp:
2986
2987 2008-05-28  Alexey Proskuryakov  <ap@webkit.org>
2988
2989         Reviewed by Maciej.
2990
2991         Based on a patch by Oliver Hunt.
2992
2993         https://bugs.webkit.org/show_bug.cgi?id=19180
2994         speed up SunSpider by optimizing immediate number cases
2995
2996         1.4% speedup on SunSpider.
2997
2998         * VM/Machine.cpp:
2999         (KJS::Machine::privateExecute):
3000         * kjs/JSImmediate.h:
3001         (KJS::JSImmediate::incImmediateNumber):
3002         (KJS::JSImmediate::decImmediateNumber):
3003         Added fast paths for ++ and --.
3004
3005         (KJS::JSImmediate::canDoFastAdditiveOperations): Corrected a comment.
3006
3007 2008-05-28  Alexey Proskuryakov  <ap@webkit.org>
3008
3009         Reviewed by Darin.
3010
3011         https://bugs.webkit.org/show_bug.cgi?id=19180
3012         speed up SunSpider by optimizing immediate number cases
3013
3014         2% speedup overall, maximum 10% on controlflow-recursive and bitops-3bit-bits-in-byte,
3015         but a 4% regression on bitops-bits-in-byte and bitops-bitwise-and.
3016
3017         * kjs/JSImmediate.h:
3018         (KJS::JSImmediate::canDoFastAdditiveOperations):
3019         (KJS::JSImmediate::addImmediateNumbers):
3020         (KJS::JSImmediate::subImmediateNumbers):
3021         Added fast cases that work with positive values less than 2^30.
3022
3023         * VM/Machine.cpp:
3024         (KJS::Machine::privateExecute): Use the above operations. Also updated SunSpider frequencies
3025         with my results (looks like tag values have changed, not sure what caused the minor variation
3026         in actual frequencies).
3027
3028 2008-05-27  Adam Roben  <aroben@apple.com>
3029
3030         Windows build fix
3031
3032         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
3033         Remove code that appended Cygwin's /bin directory to PATH.
3034         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
3035         Prepend Cygwin's /bin directory to PATH. We prepend instead of append
3036         so that Cygwin's utilities will win out over Win32 versions of the
3037         same utilities (particularly perl). We do the prepend here instead of
3038         in the Makefile because nmake doesn't seem to like prepending to PATH
3039         inside the Makefile. This also matches the way WebCoreGenerated works.
3040
3041 2008-05-27  Adam Roben  <aroben@apple.com>
3042
3043         Roll out r34163
3044
3045         A better fix is on the way.
3046
3047         * DerivedSources.make:
3048         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
3049
3050 2008-05-27  Adam Roben  <aroben@apple.com>
3051
3052         Windows build fix
3053
3054         * DerivedSources.make: Don't generate the bytecode docs if
3055         OMIT_BYTECODE_DOCS is set to 1.
3056         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Set
3057         OMIT_BYTECODE_DOCS for production builds.
3058
3059 2008-05-27  Anders Carlsson  <andersca@apple.com>
3060
3061         Reviewed by Geoff and Maciej.
3062
3063         <rdar://problem/5806428> 
3064         https://bugs.webkit.org/show_bug.cgi?id=17925
3065         Crash in KJS::JSObject::put after setting this.__proto__
3066
3067         Set slotIsWriteable to false for __proto__, we want setting __proto__ to go through JSObject::put instead.
3068         
3069         * kjs/object.h:
3070         (KJS::JSObject::getOwnPropertySlotForWrite):
3071
3072 2008-05-27  Kevin Ollivier  <kevino@theolliviers.com>
3073
3074         wx build fixes to catch up with SquirrelFish, etc.
3075
3076         * JavaScriptCoreSources.bkl:
3077         * jscore.bkl:
3078         * wtf/Platform.h:
3079
3080 2008-05-27  Darin Adler  <darin@apple.com>
3081
3082         Reviewed by Tim Hatcher.
3083
3084         - https://bugs.webkit.org/show_bug.cgi?id=19180
3085           speed up SunSpider by optimizing immediate number cases
3086
3087         Add immediate number cases for the &, |, and ^ operators.
3088         Makes standalone SunSpider 1.010x faster.
3089
3090         * VM/Machine.cpp:
3091         (KJS::Machine::privateExecute): Add areBothImmediateNumbers special cases
3092         for the &, |, and ^ operators.
3093
3094         * kjs/JSImmediate.h:
3095         (KJS::JSImmediate::xorImmediateNumbers): Added.
3096         (KJS::JSImmediate::orImmediateNumbers): Added.
3097
3098 2008-05-26  Stephanie Lewis  <slewis@apple.com>
3099
3100         Windows build fix. 
3101
3102         * kjs/testkjs.cpp:
3103
3104 2008-05-26  Maciej Stachowiak  <mjs@apple.com>
3105
3106         Reviewed by Anders.
3107         
3108         - make addStaticGlobals protected instead of private so subclasses can use it
3109
3110         * JavaScriptCore.exp:
3111         * kjs/JSGlobalObject.h:
3112
3113 2008-05-26  Geoffrey Garen  <ggaren@apple.com>
3114
3115         Reviewed by Darin Adler.
3116         
3117         Fixed <rdar://problem/5960859> After an eval of a non-string or a syntax
3118         error, all profile stack frames are incorrect
3119         
3120         SunSpider reports a .3% speedup, possibly because eval of a string is a
3121         little more efficient now.
3122
3123         * VM/Machine.cpp:
3124         (KJS::callEval): Make sure to call didExecute when returning early. I
3125         simplified this function to remove one early return, making the job
3126         of adding special code to early returns easier.
3127
3128         (KJS::Machine::execute): Use the new function ExecState when notifying
3129         the profiler. (This doesn't change behavior now, but it might prevent
3130         subtle errors in the future.)
3131
3132 2008-05-23  Tor Arne Vestbø  <tavestbo@trolltech.com>
3133
3134         Reviewed by Simon.
3135
3136         Fixed toLower and toUpper implementations to allow being called
3137         with a null result pointer and resultLength, to determine the
3138         number of characters needed for the case conversion.
3139
3140         * wtf/unicode/qt4/UnicodeQt4.h:
3141         (WTF::Unicode::toLower):
3142         (WTF::Unicode::toUpper):
3143
3144 2008-05-25  Alexey Proskuryakov  <ap@webkit.org>
3145
3146         Fixing a typo in the previous commit made as a last minute change.
3147
3148         * kjs/regexp_object.cpp:
3149
3150 2008-05-24  Alexey Proskuryakov  <ap@webkit.org>
3151
3152         Reviewed by Darin.
3153
3154         Changed regular expression matching result array to be lazily filled, because many callers
3155         only care about it being non-null.
3156
3157         2% improvement on Acid3 test 26.
3158
3159         * kjs/array_instance.cpp: Added a void* member to ArrayStorage for ArrayInstance subclasses
3160         to use.
3161         * kjs/array_instance.h:
3162         (KJS::ArrayInstance::lazyCreationData):
3163         (KJS::ArrayInstance::setLazyCreationData):
3164         Added methods to access it from subclasses.
3165
3166         * kjs/regexp_object.cpp:
3167         (KJS::RegExpMatchesArray::RegExpMatchesArray):
3168         (KJS::RegExpMatchesArray::getOwnPropertySlot):
3169         (KJS::RegExpMatchesArray::put):
3170         (KJS::RegExpMatchesArray::deleteProperty):
3171         (KJS::RegExpMatchesArray::getPropertyNames):
3172         (KJS::RegExpMatchesArray::fillArrayInstanceIfNeeded):
3173         (KJS::RegExpMatchesArray::~RegExpMatchesArray):
3174         (KJS::RegExpObjectImp::arrayOfMatches):
3175         RegExpMatchesArray is a subclass of ArrayInstance that isn't filled until
3176         accessed for the first time.
3177
3178 2008-05-24  Alp Toker  <alp@nuanti.com>
3179
3180         Win32/gcc build fix. Remove MSVC assumption.
3181
3182         * wtf/TCSpinLock.h:
3183         (TCMalloc_SlowLock):
3184
3185 2008-05-24  Oleg Finkelshteyn <olegfink@gmail.com>
3186
3187         Rubber-stamped, tweaked and landed by Alexey.
3188
3189         Build fix for gcc 4.3.
3190
3191         * JavaScriptCore/kjs/testkjs.cpp:
3192         * JavaScriptCore/VM/CodeBlock.cpp:
3193         Add missing standard includes.
3194
3195 2008-05-23  Anders Carlsson  <andersca@apple.com>
3196
3197         Reviewed by Geoff.
3198
3199         <rdar://problem/5959886> REGRESSION: Assertion failure in JSImmediate::toString when loading GMail (19217)
3200         
3201         Change List to store a JSValue*** pointer + an offset instead of a JSValue** pointer to protect against the case where 
3202         a register file changes while a list object points to its buffer.
3203         
3204         * VM/Machine.cpp:
3205         (KJS::Machine::privateExecute):
3206         * kjs/JSActivation.cpp:
3207         (KJS::JSActivation::createArgumentsObject):
3208         * kjs/list.cpp:
3209         (KJS::List::getSlice):
3210         * kjs/list.h:
3211         (KJS::List::List):
3212         (KJS::List::at):
3213         (KJS::List::append):
3214         (KJS::List::begin):
3215         (KJS::List::end):
3216         (KJS::List::buffer):
3217
3218 2008-05-23  Kevin McCullough  <kmccullough@apple.com>
3219
3220         Reviewed by Sam.
3221
3222         <rdar://problem/5960012> JSProfiler: Stack overflow if recursion is
3223         too deep.
3224         -Use a simple depth limit to restrict too deep of recursion.
3225
3226         * profiler/Profile.cpp:
3227         (KJS::Profile::willExecute):
3228         (KJS::Profile::didExecute):
3229         * profiler/Profile.h:
3230
3231 2008-05-23  Geoffrey Garen  <ggaren@apple.com>
3232
3233         Rolling back in r34085, with performance resolved.
3234         
3235         Apparently, passing the eval function to callEval gave GCC a hernia.
3236
3237         Reviewed by Darin Adler, Kevin McCullough, and Oliver Hunt.
3238         
3239         Fixed <rdar://problem/5959447> Crashes and incorrect reporting in the
3240         JavaScript profiler
3241
3242         * VM/Machine.cpp:
3243         (KJS::Machine::unwindCallFrame): Fixed incorrect reporting / a crash
3244         when unwinding from inside eval and/or program code: detect the
3245         difference, and do the right thing. Also, be sure to notify the profiler
3246         *before* deref'ing the scope chain, since the profiler uses the scope chain.
3247
3248         (KJS::Machine::execute): Fixed incorrect reporting / crash when calling
3249         a JS function re-entrently: Machine::execute(FunctionBodyNode*...)
3250         should not invoke the didExecute hook, because op_ret already does that.
3251         Also, use the new function's ExecState when calling out to the profiler.
3252         (Not important now, but could have become a subtle bug later.)
3253
3254         (KJS::Machine::privateExecute): Fixed a hard to reproduce crash when
3255         profiling JS functions: notify the profiler *before* deref'ing the scope
3256         chain, since the profiler uses the scope chain.
3257
3258         * kjs/object.cpp:
3259         (KJS::JSObject::call): Removed these hooks, because they are now unnecessary.
3260
3261         * profiler/Profile.cpp: Added a comment to explain a subtlety that only
3262         Kevin and I understood previously. (Now, the whole world can understand!)
3263
3264         * profiler/Profiler.cpp:
3265         (KJS::shouldExcludeFunction): Don't exclude .call and .apply. That was
3266         a hack to fix bugs that no longer exist.
3267
3268         Finally, sped things up a little bit by changing the "Is the profiler
3269         running?" check into an ASSERT, since we only call into the profiler
3270         when it's running:
3271
3272         (KJS::Profiler::willExecute):
3273         (KJS::Profiler::didExecute):
3274
3275 2008-05-23  Geoffrey Garen  <ggaren@apple.com>
3276
3277         Reviewed by Oliver Hunt.
3278
3279         - fixed <rdar://problem/5957662> REGRESSION(r33943-r33980): Can't send email , attach file or save as draft from hotmail.com
3280         
3281         SunSpider reports no change.
3282         
3283         This is a reworking of r34073, which I rolled out because it caused
3284         lots of crashes.
3285
3286         * VM/CodeGenerator.cpp:
3287         (KJS::CodeGenerator::CodeGenerator): Use removeDirect to nix old
3288         properties whose names collide with new functions. (Don't use putWithAttributes
3289         because that tries to write to the register file, which hasn't grown to
3290         fit this program yet.)
3291
3292 2008-05-23  Darin Adler  <darin@apple.com>
3293
3294         Reviewed by Mark Rowe.
3295
3296         As allocateNumber is used via jsNumberCell outside of JavaScriptCore,
3297         we need to provide a non-inlined version of it to avoid creating a
3298         weak external symbol.
3299
3300         * JavaScriptCore.exp:
3301         * kjs/AllInOneFile.cpp:
3302         * kjs/collector.cpp:
3303         (KJS::Collector::allocate):
3304         (KJS::Collector::allocateNumber):
3305         * kjs/collector.h:
3306         (KJS::Collector::allocate):
3307         (KJS::Collector::inlineAllocateNumber):
3308         * kjs/value.h:
3309         (KJS::NumberImp::operator new):
3310
3311 2008-05-23  Geoffrey Garen  <ggaren@apple.com>
3312
3313         Rolled out r34073 because it caused lots of layout test crashes.
3314
3315 2008-05-23  Geoffrey Garen  <ggaren@apple.com>
3316
3317         Rolled out r34085 because it measured as a 7.6% performance regression.
3318
3319 2008-05-23  Adam Roben  <aroben@apple.com>
3320
3321         Windows build fix
3322
3323         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add the
3324         profiler directory to the include path.
3325
3326 2008-05-23  Oliver Hunt  <oliver@apple.com>
3327
3328         Reviewed by Anders.
3329
3330         SQUIRRELFISH: JavaScript error messages are missing informative text
3331
3332         Partial fix.
3333         Tidy up error messages, makes a couple of them provide slightly more info.
3334         Inexplicably leads to a 1% SunSpider Progression.
3335
3336         * VM/ExceptionHelpers.cpp:
3337         (KJS::createError):
3338         (KJS::createInvalidParamError):
3339         (KJS::createNotAConstructorError):
3340         (KJS::createNotAFunctionError):
3341         * VM/ExceptionHelpers.h:
3342         * VM/Machine.cpp:
3343         (KJS::isNotObject):
3344
3345 2008-05-23  Oliver Hunt  <oliver@apple.com>
3346
3347         Reviewed by Tim H.
3348
3349         Fix call stack reported by profiler when entering event handlers.
3350
3351         JSObject::call was arbitrarily notifying the profiler when it was
3352         called, even if it was JS code, which notifies the profile on entry
3353         in any case.
3354
3355         * kjs/object.cpp:
3356         (KJS::JSObject::call):
3357
3358 2008-05-16  Alp Toker  <alp@nuanti.com>
3359
3360         Build fix for gcc 3. Default constructor required in ExecState,
3361         used by OldInterpreterExecState.
3362
3363         * kjs/ExecState.h:
3364         (KJS::ExecState::ExecState):
3365
3366 2008-05-23  Mark Rowe  <mrowe@apple.com>
3367
3368         Reviewed by Oliver Hunt.
3369
3370         Fix <rdar://problem/5954997> global-recursion-on-full-stack.html crashes under guardmalloc.
3371
3372         Growing the register file with uncheckedGrow from within Machine::execute is not safe as the
3373         register file may be too close to its maximum size to grow successfully.  By using grow,
3374         checking the result and throwing a stack overflow error we can avoid crashing.
3375
3376         * VM/Machine.cpp:
3377         (KJS::Machine::execute):
3378         * VM/RegisterFile.h: Remove the now-unused uncheckedGrow.
3379
3380 2008-05-23  Oliver Hunt  <oliver@apple.com>
3381
3382         RS=Kevin McCullough
3383
3384         Remove JAVASCRIPT_PROFILER define
3385
3386         * VM/Machine.cpp:
3387         (KJS::callEval):
3388         (KJS::Machine::unwindCallFrame):
3389         (KJS::Machine::execute):
3390         (KJS::Machine::privateExecute):
3391         * kjs/config.h:
3392         * kjs/object.cpp:
3393         (KJS::JSObject::call):
3394
3395 2008-05-23  Oliver Hunt  <oliver@apple.com>
3396
3397        <rdar://problem/5951561> Turn on JavaScript Profiler
3398
3399         Reviewed by Kevin McCullough.
3400
3401         Flipped the switch on the profiler, rearranged how we
3402         signal the the profiler is active so that calls aren't
3403         needed in the general case.
3404         
3405         Also fixed the entry point for Machine::execute(FunctionBodyNode..)
3406         to correctly indicate function exit.
3407
3408         Results in a 0.7-1.0% regression in SunSpider :-(
3409
3410         * VM/Machine.cpp:
3411         (KJS::callEval):
3412         (KJS::Machine::unwindCallFrame):
3413         (KJS::Machine::execute):
3414         (KJS::Machine::privateExecute):
3415         * kjs/config.h:
3416         * profiler/Profiler.cpp:
3417         (KJS::Profiler::profiler):
3418         (KJS::Profiler::startProfiling):
3419         (KJS::Profiler::stopProfiling):
3420         * profiler/Profiler.h:
3421         (KJS::Profiler::enabledProfilerReference):
3422
3423 2008-05-23  Simon Hausmann  <hausmann@webkit.org>
3424
3425         Fix the Qt build by adding profiler/ to the include search path.
3426
3427         * JavaScriptCore.pri:
3428
3429 2008-05-22  Kevin McCullough  <kmccullough@apple.com>
3430
3431         Reviewed by Adam.
3432
3433         Fix a bug in the profiler where time in the current function is given to
3434         (idle).
3435
3436         * profiler/Profile.cpp:
3437         (KJS::Profile::didExecute): Set the start time and then call didExecute
3438         to calculate the time spent in this function.
3439         * profiler/ProfileNode.cpp: Remove confusing calculations that are no
3440         longer necessary.
3441         (KJS::ProfileNode::insertNode):
3442         * profiler/ProfileNode.h: Expose access to the start time to allow the
3443         simpler time calculations above.
3444         (KJS::ProfileNode::startTime):
3445         (KJS::ProfileNode::setStartTime):
3446
3447 2008-05-22  Adam Roben  <aroben@apple.com>
3448
3449         Show "(Function object)" instead of "(JSInpectorCallbackWrapper
3450         object)" in profiles
3451
3452         Reviewed by Kevin McCullough.
3453
3454         * profiler/Profiler.cpp:
3455         (KJS::createCallIdentifier): Use JSObject::className instead of
3456         getting the class name from the ClassInfo directly. JSObject
3457         subclasses can override className to provide a custom class name, and
3458         it seems like we should honor that.
3459
3460 2008-05-22  Timothy Hatcher  <timothy@apple.com>
3461
3462         Added Profile::restoreAll and added ProfileNode::restoreAll
3463         to the export file.
3464
3465         Reviewed by Adam Roben.
3466
3467         * JavaScriptCore.exp:
3468         * profiler/Profile.h:
3469
3470 2008-05-22  Alp Toker  <alp@nuanti.com>
3471
3472         GTK+ build fix. Add JavaScriptCore/profiler to include path.
3473
3474         * GNUmakefile.am:
3475
3476 2008-05-22  Adam Roben  <aroben@apple.com>
3477
3478         Implement sub-millisecond profiling on Windows
3479
3480         Reviewed by Kevin McCullough.
3481
3482         * profiler/ProfileNode.cpp:
3483         (KJS::getCount): Added. On Windows, we use QueryPerformanceCounter. On
3484         other platforms, we use getCurrentUTCTimeWithMicroseconds.
3485         (KJS::ProfileNode::endAndRecordCall): Use getCount instead of
3486         getCurrentUTCTimeWithMicroseconds.
3487         (KJS::ProfileNode::startTimer): Ditto.
3488
3489 2008-05-22  Adam Roben  <aroben@apple.com>
3490
3491         Fix a profiler assertion when calling a NodeList as a function
3492
3493         Reviewed by Kevin McCullough.
3494
3495         * profiler/Profiler.cpp:
3496         (KJS::createCallIdentifier): Don't assert when a non-function object
3497         is called as a function. Instead, build up a CallIdentifier using the
3498         object's class name.
3499
3500 2008-05-22  Kevin McCullough  <kmccullough@apple.com>
3501
3502         Reviewed by Darin.
3503
3504         <rdar://problem/5951529> JSProfiler: Allow the profiler to "Exclude" a
3505         profile node.
3506         -Implement 'exclude'; where the excluded node attributes its time to its
3507         parent's self time.
3508
3509         * JavaScriptCore.exp: Export the exclude function.
3510         * profiler/Profile.h: 
3511         (KJS::Profile::exclude):
3512         * profiler/ProfileNode.cpp: 
3513         (KJS::ProfileNode::setTreeVisible): New function that allows a change in
3514         visiblitiy to be propogated to all the children of a node.
3515         (KJS::ProfileNode::exclude): If the node matches the callIdentifier then
3516         set the visiblity of this node and all of its children to false and
3517         attribute it's total time to it's caller's self time.
3518         * profiler/ProfileNode.h:
3519
3520 2008-05-22  Mark Rowe  <mrowe@apple.com>
3521
3522         Reviewed by Oliver Hunt.
3523
3524         Fix access to static global variables in Windows release builds.
3525
3526         * kjs/JSGlobalObject.h: Don't store a reference to an Identifier
3527         in GlobalPropertyInfo as the Identifier is likely to be a temporary
3528         and therefore may be destroyed before the GlobalPropertyInfo.
3529
3530 2008-05-22  Kevin McCullough  <kmccullough@apple.com>
3531
3532         Build fix.
3533
3534         * VM/Machine.cpp:
3535         (KJS::callEval):
3536
3537 2008-05-22  Kevin McCullough  <kmccullough@apple.com>
3538