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