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