e268b3951a7d46fbf26261a9c5416b90a32a8eb1
[WebKit.git] / JavaScriptCore / ChangeLog
1 2008-09-24  Jan Michael Alonzo  <jmalonzo@webkit.org>
2
3         Reviewed by Alp Toker.
4
5         https://bugs.webkit.org/show_bug.cgi?id=20992
6         Build fails on GTK+ Mac OS
7
8         * wtf/ThreadingGtk.cpp: Remove platform ifdef as suggested by
9           Richard Hult.
10         (WTF::initializeThreading):
11
12 2008-09-23  Oliver Hunt  <oliver@apple.com>
13
14         Reviewed by Maciej Stachowiak.
15
16         Bug 19968: Slow Script at www.huffingtonpost.com
17         <https://bugs.webkit.org/show_bug.cgi?id=19968>
18
19         Finally found the cause of this accursed issue.  It is triggered
20         by synchronous creation of a new global object from JS.  The new
21         global object resets the timer state in this execution group's
22         Machine, taking timerCheckCount to 0.  Then when JS returns the
23         timerCheckCount is decremented making it non-zero.  The next time
24         we execute JS we will start the timeout counter, however the non-zero
25         timeoutCheckCount means we don't reset the timer information. This
26         means that the timeout check is now checking the cumulative time
27         since the creation of the global object rather than the time since
28         JS was last entered.  At this point the slow script dialog is guaranteed
29         to eventually be displayed incorrectly unless a page is loaded
30         asynchronously (which will reset everything into a sane state).
31
32         The fix for this is rather trivial -- the JSGlobalObject constructor
33         should not be resetting the machine timer state.
34
35         * VM/Machine.cpp:
36         (JSC::Machine::Machine):
37           Now that we can't rely on the GlobalObject initialising the timeout
38           state, we do it in the Machine constructor.
39
40         * VM/Machine.h:
41         (JSC::Machine::stopTimeoutCheck):
42           Add assertions to guard against this happening.
43
44         * kjs/JSGlobalObject.cpp:
45         (JSC::JSGlobalObject::init):
46           Don't reset the timeout state.
47
48 2008-09-23  Geoffrey Garen  <ggaren@apple.com>
49
50         Reviewed by Oliver Hunt.
51         
52         Fixed https://bugs.webkit.org/show_bug.cgi?id=21038 | <rdar://problem/6240812>
53         Uncaught exceptions in regex replace callbacks crash webkit
54         
55         This was a combination of two problems:
56         
57         (1) the replace function would continue execution after an exception
58         had been thrown.
59         
60         (2) In some cases, the Machine would return 0 in the case of an exception,
61         despite the fact that a few clients dereference the Machine's return
62         value without first checking for an exception.
63         
64         * VM/Machine.cpp:
65         (JSC::Machine::execute):
66         
67         ^ Return jsNull() instead of 0 in the case of an exception, since some
68         clients depend on using our return value.
69         
70         ^ ASSERT that execution does not continue after an exception has been
71         thrown, to help catch problems like this in the future.
72
73         * kjs/StringPrototype.cpp:
74         (JSC::stringProtoFuncReplace):
75         
76         ^ Stop execution if an exception has been thrown.
77
78 2008-09-23  Geoffrey Garen  <ggaren@apple.com>
79
80         Try to fix the windows build.
81
82         * VM/CTI.cpp:
83         (JSC::CTI::compileOpCall):
84         (JSC::CTI::privateCompileMainPass):
85
86 2008-09-23  Alp Toker  <alp@nuanti.com>
87
88         Build fix.
89
90         * VM/CTI.h:
91
92 2008-09-23  Geoffrey Garen  <ggaren@apple.com>
93
94         Reviewed by Darin Adler.
95
96         * wtf/Platform.h: Removed duplicate #if.
97
98 2008-09-23  Geoffrey Garen  <ggaren@apple.com>
99
100         Reviewed by Darin Adler.
101         
102         Changed the layout of the call frame from
103         
104         { header, parameters, locals | constants, temporaries }
105         
106         to
107         
108         { parameters, header | locals, constants, temporaries }
109         
110         This simplifies function entry+exit, and enables a number of future
111         optimizations.
112         
113         13.5% speedup on empty call benchmark for bytecode; 23.6% speedup on
114         empty call benchmark for CTI.
115         
116         SunSpider says no change. SunSpider --v8 says 1% faster.
117
118         * VM/CTI.cpp:
119         
120         Added a bit of abstraction for calculating whether a register is a
121         constant, since this patch changes that calculation:
122         (JSC::CTI::isConstant):
123         (JSC::CTI::getConstant):
124         (JSC::CTI::emitGetArg):
125         (JSC::CTI::emitGetPutArg):
126         (JSC::CTI::getConstantImmediateNumericArg):
127
128         Updated for changes to callframe header location:
129         (JSC::CTI::emitPutToCallFrameHeader):
130         (JSC::CTI::emitGetFromCallFrameHeader):
131         (JSC::CTI::printOpcodeOperandTypes):
132         
133         Renamed to spite Oliver:
134         (JSC::CTI::emitInitRegister):
135         
136         Added an abstraction for emitting a call through a register, so that
137         calls through registers generate exception info, too:
138         (JSC::CTI::emitCall):
139
140         Updated to match the new callframe header layout, and to support calls
141         through registers, which have no destination address:
142         (JSC::CTI::compileOpCall):
143         (JSC::CTI::privateCompileMainPass):
144         (JSC::CTI::privateCompileSlowCases):
145         (JSC::CTI::privateCompile):
146
147         * VM/CTI.h:
148
149         More of the above:
150         (JSC::CallRecord::CallRecord):
151
152         * VM/CodeBlock.cpp:
153
154         Updated for new register layout:
155         (JSC::registerName):
156         (JSC::CodeBlock::dump):
157
158         * VM/CodeBlock.h:
159         
160         Updated CodeBlock to track slightly different information about the
161         register frame, and tweaked the style of an ASSERT_NOT_REACHED.
162         (JSC::CodeBlock::CodeBlock):
163         (JSC::CodeBlock::getStubInfo):
164
165         * VM/CodeGenerator.cpp:
166         
167         Added some abstraction around constant register allocation, since this
168         patch changes it, changed codegen to account for the new callframe
169         layout, and added abstraction around register fetching code
170         that used to assume that all local registers lived at negative indices,
171         since vars now live at positive indices:
172         (JSC::CodeGenerator::generate):
173         (JSC::CodeGenerator::addVar):
174         (JSC::CodeGenerator::addGlobalVar):
175         (JSC::CodeGenerator::allocateConstants):
176         (JSC::CodeGenerator::CodeGenerator):
177         (JSC::CodeGenerator::addParameter):
178         (JSC::CodeGenerator::registerFor):
179         (JSC::CodeGenerator::constRegisterFor):
180         (JSC::CodeGenerator::newRegister):
181         (JSC::CodeGenerator::newTemporary):
182         (JSC::CodeGenerator::highestUsedRegister):
183         (JSC::CodeGenerator::addConstant):
184         
185         ASSERT that our caller referenced the registers it passed to us.
186         Otherwise, we might overwrite them with parameters:
187         (JSC::CodeGenerator::emitCall):
188         (JSC::CodeGenerator::emitConstruct):
189
190         * VM/CodeGenerator.h:
191         
192         Added some abstraction for getting a RegisterID for a given index,
193         since the rules are a little weird:
194         (JSC::CodeGenerator::registerFor):
195
196         * VM/Machine.cpp:
197
198         Utility function to transform a machine return PC to a virtual machine
199         return VPC, for the sake of stack unwinding, since both PCs are stored
200         in the same location now:
201         (JSC::vPCForPC):
202
203         Tweaked to account for new call frame:
204         (JSC::Machine::initializeCallFrame):
205         
206         Tweaked to account for registerOffset supplied by caller:
207         (JSC::slideRegisterWindowForCall):
208
209         Tweaked to account for new register layout:
210         (JSC::scopeChainForCall):
211         (JSC::Machine::callEval):
212         (JSC::Machine::dumpRegisters):
213         (JSC::Machine::unwindCallFrame):
214         (JSC::Machine::execute):
215
216         Changed op_call and op_construct to implement the new calling convention:
217         (JSC::Machine::privateExecute):
218
219         Tweaked to account for the new register layout:
220         (JSC::Machine::retrieveArguments):
221         (JSC::Machine::retrieveCaller):
222         (JSC::Machine::retrieveLastCaller):
223         (JSC::Machine::callFrame):
224         (JSC::Machine::getArgumentsData):
225
226         Changed CTI call helpers to implement the new calling convention:
227         (JSC::Machine::cti_op_call_JSFunction):
228         (JSC::Machine::cti_op_call_NotJSFunction):
229         (JSC::Machine::cti_op_ret_activation):
230         (JSC::Machine::cti_op_ret_profiler):
231         (JSC::Machine::cti_op_construct_JSConstruct):
232         (JSC::Machine::cti_op_construct_NotJSConstruct):
233         (JSC::Machine::cti_op_call_eval):
234
235         * VM/Machine.h:
236
237         * VM/Opcode.h:
238         
239         Renamed op_initialise_locals to op_init, because this opcode
240         doesn't initialize all locals, and it doesn't initialize only locals.
241         Also, to spite Oliver.
242         
243         * VM/RegisterFile.h:
244         
245         New call frame enumeration values:
246         (JSC::RegisterFile::):
247
248         Simplified the calculation of whether a RegisterID is a temporary,
249         since we can no longer assume that all positive non-constant registers
250         are temporaries:
251         * VM/RegisterID.h:
252         (JSC::RegisterID::RegisterID):
253         (JSC::RegisterID::setTemporary):
254         (JSC::RegisterID::isTemporary):
255
256         Renamed firstArgumentIndex to firstParameterIndex because the assumption
257         that this variable pertained to the actual arguments supplied by the
258         caller caused me to write some buggy code:
259         * kjs/Arguments.cpp:
260         (JSC::ArgumentsData::ArgumentsData):
261         (JSC::Arguments::Arguments):
262         (JSC::Arguments::fillArgList):
263         (JSC::Arguments::getOwnPropertySlot):
264         (JSC::Arguments::put):
265
266         Updated for new call frame layout:
267         * kjs/DebuggerCallFrame.cpp:
268         (JSC::DebuggerCallFrame::functionName):
269         (JSC::DebuggerCallFrame::type):
270         * kjs/DebuggerCallFrame.h:
271
272         Changed the activation object to account for the fact that a call frame
273         header now sits between parameters and local variables. This change
274         requires all variable objects to do their own marking, since they
275         now use their register storage differently:
276         * kjs/JSActivation.cpp:
277         (JSC::JSActivation::mark):
278         (JSC::JSActivation::copyRegisters):
279         (JSC::JSActivation::createArgumentsObject):
280         * kjs/JSActivation.h:
281
282         Updated global object to use the new interfaces required by the change
283         to JSActivation above:
284         * kjs/JSGlobalObject.cpp:
285         (JSC::JSGlobalObject::reset):
286         (JSC::JSGlobalObject::mark):
287         (JSC::JSGlobalObject::copyGlobalsFrom):
288         (JSC::JSGlobalObject::copyGlobalsTo):
289         * kjs/JSGlobalObject.h:
290         (JSC::JSGlobalObject::addStaticGlobals):
291
292         Updated static scope object to use the new interfaces required by the 
293         change to JSActivation above:
294         * kjs/JSStaticScopeObject.cpp:
295         (JSC::JSStaticScopeObject::mark):
296         (JSC::JSStaticScopeObject::~JSStaticScopeObject):
297         * kjs/JSStaticScopeObject.h:
298         (JSC::JSStaticScopeObject::JSStaticScopeObject):
299         (JSC::JSStaticScopeObject::d):
300
301         Updated variable object to use the new interfaces required by the 
302         change to JSActivation above:
303         * kjs/JSVariableObject.cpp:
304         (JSC::JSVariableObject::copyRegisterArray):
305         (JSC::JSVariableObject::setRegisters):
306         * kjs/JSVariableObject.h:
307
308         Changed the bit twiddling in symbol table not to assume that all indices
309         are negative, since they can be positive now:
310         * kjs/SymbolTable.h:
311         (JSC::SymbolTableEntry::SymbolTableEntry):
312         (JSC::SymbolTableEntry::isNull):
313         (JSC::SymbolTableEntry::getIndex):
314         (JSC::SymbolTableEntry::getAttributes):
315         (JSC::SymbolTableEntry::setAttributes):
316         (JSC::SymbolTableEntry::isReadOnly):
317         (JSC::SymbolTableEntry::pack):
318         (JSC::SymbolTableEntry::isValidIndex):
319
320         Changed call and construct nodes to ref their functions and/or bases,
321         so that emitCall/emitConstruct doesn't overwrite them with parameters.
322         Also, updated for rename to registerFor:
323         * kjs/nodes.cpp:
324         (JSC::ResolveNode::emitCode):
325         (JSC::NewExprNode::emitCode):
326         (JSC::EvalFunctionCallNode::emitCode):
327         (JSC::FunctionCallValueNode::emitCode):
328         (JSC::FunctionCallResolveNode::emitCode):
329         (JSC::FunctionCallBracketNode::emitCode):
330         (JSC::FunctionCallDotNode::emitCode):
331         (JSC::PostfixResolveNode::emitCode):
332         (JSC::DeleteResolveNode::emitCode):
333         (JSC::TypeOfResolveNode::emitCode):
334         (JSC::PrefixResolveNode::emitCode):
335         (JSC::ReadModifyResolveNode::emitCode):
336         (JSC::AssignResolveNode::emitCode):
337         (JSC::ConstDeclNode::emitCodeSingle):
338         (JSC::ForInNode::emitCode):
339
340         Added abstraction for getting exception info out of a call through a
341         register:
342         * masm/X86Assembler.h:
343         (JSC::X86Assembler::emitCall):
344         
345         Removed duplicate #if:
346         * wtf/Platform.h:
347
348 2008-09-23  Kevin McCullough  <kmccullough@apple.com>
349
350         Reviewed by Darin.
351
352         Bug 21030: The JS debugger breaks on the do of a do-while not the while
353         (where the conditional statement is)
354         https://bugs.webkit.org/show_bug.cgi?id=21030
355         Now the statementListEmitCode detects if a do-while node is being
356         emited and emits the debug hook on the last line instead of the first.
357
358         This change had no effect on sunspider.
359
360         * kjs/nodes.cpp:
361         (JSC::statementListEmitCode):
362         * kjs/nodes.h:
363         (JSC::StatementNode::isDoWhile):
364         (JSC::DoWhileNode::isDoWhile):
365
366 2008-09-23  Maciej Stachowiak  <mjs@apple.com>
367
368         Reviewed by Camron Zwarich.
369
370         - inline the fast case of instanceof
371         https://bugs.webkit.org/show_bug.cgi?id=20818
372
373         ~2% speedup on EarleyBoyer test.
374         
375         * VM/CTI.cpp:
376         (JSC::CTI::privateCompileMainPass):
377         (JSC::CTI::privateCompileSlowCases):
378         * VM/Machine.cpp:
379         (JSC::Machine::cti_op_instanceof):
380
381 2008-09-23  Maciej Stachowiak  <mjs@apple.com>
382
383         Reviewed by Cameron Zwarich.
384         
385         - add forgotten slow case logic for !==
386
387         * VM/CTI.cpp:
388         (JSC::CTI::privateCompileSlowCases):
389
390 2008-09-23  Maciej Stachowiak  <mjs@apple.com>
391
392         Reviewed by Cameron Zwarich.
393
394         - inline the fast cases of !==, same as for ===
395         
396         2.9% speedup on EarleyBoyer benchmark
397
398         * VM/CTI.cpp:
399         (JSC::CTI::compileOpStrictEq): Factored stricteq codegen into this function,
400         and parameterized so it can do the reverse version as well.
401         (JSC::CTI::privateCompileMainPass): Use the above for stricteq and nstricteq.
402         * VM/CTI.h:
403         (JSC::CTI::): Declare above stuff.
404         * VM/Machine.cpp:
405         (JSC::Machine::cti_op_nstricteq): Removed fast cases, now handled inline.
406
407 2008-09-23  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
408
409         Reviewed by Oliver Hunt.
410
411         Bug 20989: Aguments constructor should put 'callee' and 'length' properties in a more efficient way
412         <https://bugs.webkit.org/show_bug.cgi?id=20989>
413
414         Make special cases for the 'callee' and 'length' properties in the
415         Arguments object.
416
417         This is somewhere between a 7.8% speedup and a 10% speedup on the V8
418         Raytrace benchmark, depending on whether it is run alone or with the
419         other V8 benchmarks.
420
421         * kjs/Arguments.cpp:
422         (JSC::ArgumentsData::ArgumentsData):
423         (JSC::Arguments::Arguments):
424         (JSC::Arguments::mark):
425         (JSC::Arguments::getOwnPropertySlot):
426         (JSC::Arguments::put):
427         (JSC::Arguments::deleteProperty):
428
429 2008-09-23  Maciej Stachowiak  <mjs@apple.com>
430
431         Reviewed by Darin.
432
433         - speed up instanceof some more
434         https://bugs.webkit.org/show_bug.cgi?id=20818
435         
436         ~2% speedup on EarleyBoyer
437
438         The idea here is to record in the StructureID whether the class
439         needs a special hasInstance or if it can use the normal logic from
440         JSObject. 
441         
442         Based on this I inlined the real work directly into
443         cti_op_instanceof and put the fastest checks up front and the
444         error handling at the end (so it should be fairly straightforward
445         to split off the beginning to be inlined if desired).
446
447         I only did this for CTI, not the bytecode interpreter.
448         
449         * API/JSCallbackObject.h:
450         (JSC::JSCallbackObject::createStructureID):
451         * ChangeLog:
452         * VM/Machine.cpp:
453         (JSC::Machine::cti_op_instanceof):
454         * kjs/JSImmediate.h:
455         (JSC::JSImmediate::isAnyImmediate):
456         * kjs/TypeInfo.h:
457         (JSC::TypeInfo::overridesHasInstance):
458         (JSC::TypeInfo::flags):
459
460 2008-09-22  Darin Adler  <darin@apple.com>
461
462         Reviewed by Sam Weinig.
463
464         - https://bugs.webkit.org/show_bug.cgi?id=21019
465           make FunctionBodyNode::ref/deref fast
466
467         Speeds up v8-raytrace by 7.2%.
468
469         * kjs/nodes.cpp:
470         (JSC::FunctionBodyNode::FunctionBodyNode): Initialize m_refCount to 0.
471         * kjs/nodes.h:
472         (JSC::FunctionBodyNode::ref): Call base class ref once, and thereafter use
473         m_refCount.
474         (JSC::FunctionBodyNode::deref): Ditto, but the deref side.
475
476 2008-09-22  Darin Adler  <darin@apple.com>
477
478         Pointed out by Sam Weinig.
479
480         * kjs/Arguments.cpp:
481         (JSC::Arguments::fillArgList): Fix bad copy and paste. Oops!
482
483 2008-09-22  Darin Adler  <darin@apple.com>
484
485         Reviewed by Cameron Zwarich.
486
487         - https://bugs.webkit.org/show_bug.cgi?id=20983
488           ArgumentsData should have some room to allocate some extra arguments inline
489
490         Speeds up v8-raytrace by 5%.
491
492         * kjs/Arguments.cpp:
493         (JSC::ArgumentsData::ArgumentsData): Use a fixed buffer if there are 4 or fewer
494         extra arguments.
495         (JSC::Arguments::Arguments): Use a fixed buffer if there are 4 or fewer
496         extra arguments.
497         (JSC::Arguments::~Arguments): Delete the buffer if necessary.
498         (JSC::Arguments::mark): Update since extraArguments are now Register.
499         (JSC::Arguments::fillArgList): Added special case for the only case that's
500         actually used in the practice, when there are no parameters. There are some
501         other special cases in there too, but that's the only one that matters.
502         (JSC::Arguments::getOwnPropertySlot): Updated to use setValueSlot since there's
503         no operation to get you at the JSValue* inside a Register as a "slot".
504
505 2008-09-22  Sam Weinig  <sam@webkit.org>
506
507         Reviewed by Maciej Stachowiak.
508
509         Patch for https://bugs.webkit.org/show_bug.cgi?id=21014
510         Speed up for..in by using StructureID to avoid calls to hasProperty
511
512         Speeds up fasta by 8%.
513
514         * VM/JSPropertyNameIterator.cpp:
515         (JSC::JSPropertyNameIterator::invalidate):
516         * VM/JSPropertyNameIterator.h:
517         (JSC::JSPropertyNameIterator::next):
518         * kjs/PropertyNameArray.h:
519         (JSC::PropertyNameArrayData::begin):
520         (JSC::PropertyNameArrayData::end):
521         (JSC::PropertyNameArrayData::setCachedStructureID):
522         (JSC::PropertyNameArrayData::cachedStructureID):
523         * kjs/StructureID.cpp:
524         (JSC::StructureID::getEnumerablePropertyNames):
525         (JSC::structureIDChainsAreEqual):
526         * kjs/StructureID.h:
527
528 2008-09-22  Kelvin Sherlock  <ksherlock@gmail.com>
529
530         Updated and tweaked by Sam Weinig.
531
532         Reviewed by Geoffrey Garen.
533
534         Bug 20020: Proposed enhancement to JavaScriptCore API
535         <https://bugs.webkit.org/show_bug.cgi?id=20020>
536
537         Add JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError, and JSObjectMakeRegExp
538         functions to create JavaScript Array, Date, Error, and RegExp objects, respectively.
539
540         * API/JSObjectRef.cpp: The functions
541         * API/JSObjectRef.h: Function prototype and documentation
542         * JavaScriptCore.exp: Added functions to exported function list
543         * API/tests/testapi.c: Added basic functionality tests.
544
545         * kjs/DateConstructor.cpp:
546         Replaced static JSObject* constructDate(ExecState* exec, JSObject*, const ArgList& args)
547         with JSObject* constructDate(ExecState* exec, const ArgList& args).
548         Added static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args) function
549
550         * kjs/DateConstructor.h:
551         added prototype for JSObject* constructDate(ExecState* exec, const ArgList& args)
552
553         * kjs/ErrorConstructor.cpp:
554         removed static qualifier from ErrorInstance* constructError(ExecState* exec, const ArgList& args)
555
556         * kjs/ErrorConstructor.h:
557         added prototype for ErrorInstance* constructError(ExecState* exec, const ArgList& args)
558
559         * kjs/RegExpConstructor.cpp:
560         removed static qualifier from JSObject* constructRegExp(ExecState* exec, const ArgList& args)
561
562         * kjs/RegExpConstructor.h:
563         added prototype for JSObject* constructRegExp(ExecState* exec, const ArgList& args)
564
565 2008-09-22  Matt Lilek  <webkit@mattlilek.com>
566
567         Not reviewed, Windows build fix.
568
569         * kjs/Arguments.cpp:
570         * kjs/FunctionPrototype.cpp:
571
572 2008-09-22  Sam Weinig  <sam@webkit.org>
573
574         Reviewed by Darin Adler.
575
576         Patch for https://bugs.webkit.org/show_bug.cgi?id=20982
577         Speed up the apply method of functions by special-casing array and 'arguments' objects
578
579         1% speedup on v8-raytrace.
580
581         Test: fast/js/function-apply.html
582
583         * kjs/Arguments.cpp:
584         (JSC::Arguments::fillArgList):
585         * kjs/Arguments.h:
586         * kjs/FunctionPrototype.cpp:
587         (JSC::functionProtoFuncApply):
588         * kjs/JSArray.cpp:
589         (JSC::JSArray::fillArgList):
590         * kjs/JSArray.h:
591
592 2008-09-22  Darin Adler  <darin@apple.com>
593
594         Reviewed by Sam Weinig.
595
596         - https://bugs.webkit.org/show_bug.cgi?id=20993
597           Array.push/pop need optimized cases for JSArray
598
599         3% or so speedup on DeltaBlue benchmark.
600
601         * kjs/ArrayPrototype.cpp:
602         (JSC::arrayProtoFuncPop): Call JSArray::pop when appropriate.
603         (JSC::arrayProtoFuncPush): Call JSArray::push when appropriate.
604
605         * kjs/JSArray.cpp:
606         (JSC::JSArray::putSlowCase): Set m_fastAccessCutoff when appropriate, getting
607         us into the fast code path.
608         (JSC::JSArray::pop): Added.
609         (JSC::JSArray::push): Added.
610         * kjs/JSArray.h: Added push and pop.
611
612         * kjs/operations.cpp:
613         (JSC::throwOutOfMemoryError): Don't inline this. Helps us avoid PIC branches.
614
615 2008-09-22  Maciej Stachowiak  <mjs@apple.com>
616
617         Reviewed by Cameron Zwarich.
618         
619         - speed up instanceof operator by replacing implementsHasInstance method with a TypeInfo flag
620
621         Partial work towards <https://bugs.webkit.org/show_bug.cgi?id=20818>
622         
623         2.2% speedup on EarleyBoyer benchmark.
624
625         * API/JSCallbackConstructor.cpp:
626         * API/JSCallbackConstructor.h:
627         (JSC::JSCallbackConstructor::createStructureID):
628         * API/JSCallbackFunction.cpp:
629         * API/JSCallbackFunction.h:
630         (JSC::JSCallbackFunction::createStructureID):
631         * API/JSCallbackObject.h:
632         (JSC::JSCallbackObject::createStructureID):
633         * API/JSCallbackObjectFunctions.h:
634         (JSC::::hasInstance):
635         * API/JSValueRef.cpp:
636         (JSValueIsInstanceOfConstructor):
637         * JavaScriptCore.exp:
638         * VM/Machine.cpp:
639         (JSC::Machine::privateExecute):
640         (JSC::Machine::cti_op_instanceof):
641         * kjs/InternalFunction.cpp:
642         * kjs/InternalFunction.h:
643         (JSC::InternalFunction::createStructureID):
644         * kjs/JSObject.cpp:
645         * kjs/JSObject.h:
646         * kjs/TypeInfo.h:
647         (JSC::TypeInfo::implementsHasInstance):
648
649 2008-09-22  Maciej Stachowiak  <mjs@apple.com>
650
651         Reviewed by Dave Hyatt.
652         
653         Based on initial work by Darin Adler.
654         
655         - replace masqueradesAsUndefined virtual method with a flag in TypeInfo
656         - use this to JIT inline code for eq_null and neq_null
657         https://bugs.webkit.org/show_bug.cgi?id=20823
658
659         0.5% speedup on SunSpider
660         ~4% speedup on Richards benchmark
661         
662         * VM/CTI.cpp:
663         (JSC::CTI::privateCompileMainPass):
664         * VM/Machine.cpp:
665         (JSC::jsTypeStringForValue):
666         (JSC::jsIsObjectType):
667         (JSC::Machine::privateExecute):
668         (JSC::Machine::cti_op_is_undefined):
669         * VM/Machine.h:
670         * kjs/JSCell.h:
671         * kjs/JSValue.h:
672         * kjs/StringObjectThatMasqueradesAsUndefined.h:
673         (JSC::StringObjectThatMasqueradesAsUndefined::create):
674         (JSC::StringObjectThatMasqueradesAsUndefined::createStructureID):
675         * kjs/StructureID.h:
676         (JSC::StructureID::mutableTypeInfo):
677         * kjs/TypeInfo.h:
678         (JSC::TypeInfo::TypeInfo):
679         (JSC::TypeInfo::masqueradesAsUndefined):
680         * kjs/operations.cpp:
681         (JSC::equal):
682         * masm/X86Assembler.h:
683         (JSC::X86Assembler::):
684         (JSC::X86Assembler::setne_r):
685         (JSC::X86Assembler::setnz_r):
686         (JSC::X86Assembler::testl_i32m):
687
688 2008-09-22  Tor Arne Vestbø  <tavestbo@trolltech.com>
689
690         Reviewed by Simon.
691
692         Initialize QCoreApplication in kjs binary/Shell.cpp
693         
694         This allows us to use QCoreApplication::instance() to
695         get the main thread in ThreadingQt.cpp
696
697         * kjs/Shell.cpp:
698         (main):
699         * wtf/ThreadingQt.cpp:
700         (WTF::initializeThreading):
701
702 2008-09-21  Darin Adler  <darin@apple.com>
703
704         - blind attempt to fix non-all-in-one builds
705
706         * kjs/JSGlobalObject.cpp: Added includes of Arguments.h and RegExpObject.h.
707
708 2008-09-21  Darin Adler  <darin@apple.com>
709
710         - fix debug build
711
712         * kjs/StructureID.cpp:
713         (JSC::StructureID::addPropertyTransition): Use typeInfo().type() instead of m_type.
714         (JSC::StructureID::createCachedPrototypeChain): Ditto.
715
716 2008-09-21  Maciej Stachowiak  <mjs@apple.com>
717
718         Reviewed by Darin Adler.
719         
720         - introduce a TypeInfo class, for holding per-type (in the C++ class sense) date in StructureID
721         https://bugs.webkit.org/show_bug.cgi?id=20981
722
723         * JavaScriptCore.exp:
724         * JavaScriptCore.xcodeproj/project.pbxproj:
725         * VM/CTI.cpp:
726         (JSC::CTI::privateCompileMainPass):
727         (JSC::CTI::privateCompilePutByIdTransition):
728         * VM/Machine.cpp:
729         (JSC::jsIsObjectType):
730         (JSC::Machine::Machine):
731         * kjs/AllInOneFile.cpp:
732         * kjs/JSCell.h:
733         (JSC::JSCell::isObject):
734         (JSC::JSCell::isString):
735         * kjs/JSGlobalData.cpp:
736         (JSC::JSGlobalData::JSGlobalData):
737         * kjs/JSGlobalObject.cpp:
738         (JSC::JSGlobalObject::reset):
739         * kjs/JSGlobalObject.h:
740         (JSC::StructureID::prototypeForLookup):
741         * kjs/JSNumberCell.h:
742         (JSC::JSNumberCell::createStructureID):
743         * kjs/JSObject.cpp:
744         (JSC::JSObject::createInheritorID):
745         * kjs/JSObject.h:
746         (JSC::JSObject::createStructureID):
747         * kjs/JSString.h:
748         (JSC::JSString::createStructureID):
749         * kjs/NativeErrorConstructor.cpp:
750         (JSC::NativeErrorConstructor::NativeErrorConstructor):
751         * kjs/RegExpConstructor.cpp:
752         * kjs/RegExpMatchesArray.h: Added.
753         (JSC::RegExpMatchesArray::getOwnPropertySlot):
754         (JSC::RegExpMatchesArray::put):
755         (JSC::RegExpMatchesArray::deleteProperty):
756         (JSC::RegExpMatchesArray::getPropertyNames):
757         * kjs/StructureID.cpp:
758         (JSC::StructureID::StructureID):
759         (JSC::StructureID::addPropertyTransition):
760         (JSC::StructureID::toDictionaryTransition):
761         (JSC::StructureID::changePrototypeTransition):
762         (JSC::StructureID::getterSetterTransition):
763         * kjs/StructureID.h:
764         (JSC::StructureID::create):
765         (JSC::StructureID::typeInfo):
766         * kjs/TypeInfo.h: Added.
767         (JSC::TypeInfo::TypeInfo):
768         (JSC::TypeInfo::type):
769
770 2008-09-21  Darin Adler  <darin@apple.com>
771
772         Reviewed by Cameron Zwarich.
773
774         - fix crash logging into Gmail due to recent Arguments change
775
776         * kjs/Arguments.cpp:
777         (JSC::Arguments::Arguments): Fix window where mark() function could
778         see d->extraArguments with uninitialized contents.
779         (JSC::Arguments::mark): Check d->extraArguments for 0 to handle two
780         cases: 1) Inside the constructor before it's initialized.
781         2) numArguments <= numParameters.
782
783 2008-09-21  Darin Adler  <darin@apple.com>
784
785         - fix loose end from the "duplicate constant values" patch
786
787         * VM/CodeGenerator.cpp:
788         (JSC::CodeGenerator::emitLoad): Add a special case for values the
789         hash table can't handle.
790
791 2008-09-21  Mark Rowe  <mrowe@apple.com>
792
793         Fix the non-AllInOneFile build.
794
795         * kjs/Arguments.cpp: Add missing #include.
796
797 2008-09-21  Darin Adler  <darin@apple.com>
798
799         Reviewed by Cameron Zwarich and Mark Rowe.
800
801         - fix test failure caused by my recent IndexToNameMap patch
802
803         * kjs/Arguments.cpp:
804         (JSC::Arguments::deleteProperty): Added the accidentally-omitted
805         check of the boolean result from toArrayIndex.
806
807 2008-09-21  Darin Adler  <darin@apple.com>
808
809         Reviewed by Maciej Stachowiak.
810
811         - https://bugs.webkit.org/show_bug.cgi?id=20975
812           inline immediate-number case of ==
813
814         * VM/CTI.h: Renamed emitJumpSlowCaseIfNotImm to
815         emitJumpSlowCaseIfNotImmNum, since the old name was incorrect.
816
817         * VM/CTI.cpp: Updated for new name.
818         (JSC::CTI::privateCompileMainPass): Added op_eq.
819         (JSC::CTI::privateCompileSlowCases): Added op_eq.
820
821         * VM/Machine.cpp:
822         (JSC::Machine::cti_op_eq): Removed fast case, since it's now
823         compiled.
824
825 2008-09-21  Peter Gal  <galpter@inf.u-szeged.hu>
826
827         Reviewed by Tim Hatcher and Eric Seidel.
828
829         Fix the QT/Linux JavaScriptCore segmentation fault.
830         https://bugs.webkit.org/show_bug.cgi?id=20914
831
832         * wtf/ThreadingQt.cpp:
833         (WTF::initializeThreading): Use currentThread() if
834         platform is not a MAC (like in pre 36541 revisions)
835
836 2008-09-21  Darin Adler  <darin@apple.com>
837
838         Reviewed by Sam Weinig.
839
840         * kjs/debugger.h: Removed some unneeded includes and declarations.
841
842 2008-09-21  Darin Adler  <darin@apple.com>
843
844         Reviewed by Sam Weinig.
845
846         - https://bugs.webkit.org/show_bug.cgi?id=20972
847           speed up Arguments further by eliminating the IndexToNameMap
848
849         No change on SunSpider. 1.29x as fast on V8 Raytrace.
850
851         * kjs/Arguments.cpp: Moved ArgumentsData in here. Eliminated the
852         indexToNameMap and hadDeletes data members. Changed extraArguments into
853         an OwnArrayPtr and added deletedArguments, another OwnArrayPtr.
854         Replaced numExtraArguments with numParameters, since that's what's
855         used more directly in hot code paths.
856         (JSC::Arguments::Arguments): Pass in argument count instead of ArgList.
857         Initialize ArgumentsData the new way.
858         (JSC::Arguments::mark): Updated.
859         (JSC::Arguments::getOwnPropertySlot): Overload for the integer form so
860         we don't have to convert integers to identifiers just to get an argument.
861         Integrated the deleted case with the fast case.
862         (JSC::Arguments::put): Ditto.
863         (JSC::Arguments::deleteProperty): Ditto.
864
865         * kjs/Arguments.h: Minimized includes. Made everything private. Added
866         overloads for the integral property name case. Eliminated mappedIndexSetter.
867         Moved ArgumentsData into the .cpp file.
868
869         * kjs/IndexToNameMap.cpp: Emptied out and prepared for deletion.
870         * kjs/IndexToNameMap.h: Ditto.
871
872         * kjs/JSActivation.cpp:
873         (JSC::JSActivation::createArgumentsObject): Elminated ArgList.
874
875         * GNUmakefile.am:
876         * JavaScriptCore.pri:
877         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
878         * JavaScriptCore.xcodeproj/project.pbxproj:
879         * JavaScriptCoreSources.bkl:
880         * kjs/AllInOneFile.cpp:
881         Removed IndexToNameMap.
882
883 2008-09-21  Darin Adler  <darin@apple.com>
884
885         * VM/CodeGenerator.cpp:
886         (JSC::CodeGenerator::emitLoad): One more tweak: Wrote this in a slightly
887         clearer style.
888
889 2008-09-21  Judit Jasz  <jasy@inf.u-szeged.hu>
890
891         Reviewed and tweaked by Darin Adler.
892
893         - https://bugs.webkit.org/show_bug.cgi?id=20645
894           Elminate duplicate constant values in CodeBlocks.
895
896         Seems to be a wash on SunSpider.
897
898         * VM/CodeGenerator.cpp:
899         (JSC::CodeGenerator::emitLoad): Use m_numberMap and m_stringMap to guarantee
900         we emit the same JSValue* for identical numbers and strings.
901         * VM/CodeGenerator.h: Added overload of emitLoad for const Identifier&.
902         Add NumberMap and IdentifierStringMap types and m_numberMap and m_stringMap.
903         * kjs/nodes.cpp:
904         (JSC::StringNode::emitCode): Call the new emitLoad and let it do the
905         JSString creation.
906
907 2008-09-21  Paul Pedriana  <webkit@pedriana.com>
908
909         Reviewed and tweaked by Darin Adler.
910
911         - https://bugs.webkit.org/show_bug.cgi?id=16925
912           Fixed lack of Vector buffer alignment for both GCC and MSVC.
913           Since there's no portable way to do this, for now we don't support
914           other compilers.
915
916         * wtf/Vector.h: Added WTF_ALIGH_ON, WTF_ALIGNED, AlignedBufferChar, and AlignedBuffer.
917         Use AlignedBuffer insteadof an array of char in VectorBuffer.
918
919 2008-09-21  Gabor Loki  <loki@inf.u-szeged.hu>
920
921         Reviewed by Darin Adler.
922
923         - https://bugs.webkit.org/show_bug.cgi?id=19408
924           Add lightweight constant folding to the parser for *, /, + (only for numbers), <<, >>, ~ operators.
925
926         1.008x as fast on SunSpider.
927
928         * kjs/grammar.y:
929         (makeNegateNode): Fold if expression is a number > 0.
930         (makeBitwiseNotNode): Fold if expression is a number.
931         (makeMultNode): Fold if expressions are both numbers.
932         (makeDivNode): Fold if expressions are both numbers.
933         (makeAddNode): Fold if expressions are both numbers.
934         (makeLeftShiftNode): Fold if expressions are both numbers.
935         (makeRightShiftNode): Fold if expressions are both numbers.
936
937 2008-09-21  Maciej Stachowiak  <mjs@apple.com>
938
939         Reviewed by Oliver.
940         
941         - speed up === operator by generating inline machine code for the fast paths
942         https://bugs.webkit.org/show_bug.cgi?id=20820
943
944         * VM/CTI.cpp:
945         (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumber):
946         (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumbers):
947         (JSC::CTI::emitJumpSlowCaseIfNotImmediates):
948         (JSC::CTI::emitTagAsBoolImmediate):
949         (JSC::CTI::privateCompileMainPass):
950         (JSC::CTI::privateCompileSlowCases):
951         * VM/CTI.h:
952         * VM/Machine.cpp:
953         (JSC::Machine::cti_op_stricteq):
954         * masm/X86Assembler.h:
955         (JSC::X86Assembler::):
956         (JSC::X86Assembler::sete_r):
957         (JSC::X86Assembler::setz_r):
958         (JSC::X86Assembler::movzbl_rr):
959         (JSC::X86Assembler::emitUnlinkedJnz):
960
961 2008-09-21  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
962
963         Reviewed by Maciej Stachowiak.
964
965         Free memory allocated for extra arguments in the destructor of the
966         Arguments object.
967
968         * kjs/Arguments.cpp:
969         (JSC::Arguments::~Arguments):
970         * kjs/Arguments.h:
971
972 2008-09-21  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
973
974         Reviewed by Maciej Stachowiak.
975
976         Bug 20815: 'arguments' object creation is non-optimal
977         <https://bugs.webkit.org/show_bug.cgi?id=20815>
978
979         Fix our inefficient way of creating the arguments object by only
980         creating named properties for each of the arguments after a use of the
981         'delete' statement. This patch also speeds up access to the 'arguments'
982         object slightly, but it still does not use the array fast path for
983         indexed access that exists for many opcodes.
984
985         This is about a 20% improvement on the V8 Raytrace benchmark, and a 1.5%
986         improvement on the Earley-Boyer benchmark, which gives a 4% improvement
987         overall.
988
989         * kjs/Arguments.cpp:
990         (JSC::Arguments::Arguments):
991         (JSC::Arguments::mark):
992         (JSC::Arguments::getOwnPropertySlot):
993         (JSC::Arguments::put):
994         (JSC::Arguments::deleteProperty):
995         * kjs/Arguments.h:
996         (JSC::Arguments::ArgumentsData::ArgumentsData):
997         * kjs/IndexToNameMap.h:
998         (JSC::IndexToNameMap::size):
999         * kjs/JSActivation.cpp:
1000         (JSC::JSActivation::createArgumentsObject):
1001         * kjs/JSActivation.h:
1002         (JSC::JSActivation::uncheckedSymbolTableGet):
1003         (JSC::JSActivation::uncheckedSymbolTableGetValue):
1004         (JSC::JSActivation::uncheckedSymbolTablePut):
1005         * kjs/JSFunction.h:
1006         (JSC::JSFunction::numParameters):
1007
1008 2008-09-20  Darin Adler  <darin@apple.com>
1009
1010         Reviewed by Mark Rowe.
1011
1012         - fix crash seen on buildbot
1013
1014         * kjs/JSGlobalObject.cpp:
1015         (JSC::JSGlobalObject::mark): Add back mark of arrayPrototype,
1016         deleted by accident in my recent check-in.
1017
1018 2008-09-20  Maciej Stachowiak  <mjs@apple.com>
1019
1020         Not reviewed, build fix.
1021         
1022         - speculative fix for non-AllInOne builds
1023
1024         * kjs/operations.h:
1025
1026 2008-09-20  Maciej Stachowiak  <mjs@apple.com>
1027
1028         Reviewed by Darin Adler.
1029         
1030         - assorted optimizations to === and !== operators
1031         (work towards <https://bugs.webkit.org/show_bug.cgi?id=20820>)
1032         
1033         2.5% speedup on earley-boyer test
1034
1035         * VM/Machine.cpp:
1036         (JSC::Machine::cti_op_stricteq): Use inline version of
1037         strictEqualSlowCase; remove unneeded exception check.
1038         (JSC::Machine::cti_op_nstricteq): ditto
1039         * kjs/operations.cpp:
1040         (JSC::strictEqual): Use strictEqualSlowCaseInline
1041         (JSC::strictEqualSlowCase): ditto
1042         * kjs/operations.h:
1043         (JSC::strictEqualSlowCaseInline): Version of strictEqualSlowCase that can be inlined,
1044         since the extra function call indirection is a lose for CTI.
1045
1046 2008-09-20  Darin Adler  <darin@apple.com>
1047
1048         Reviewed by Maciej Stachowiak.
1049
1050         - finish https://bugs.webkit.org/show_bug.cgi?id=20858
1051           make each distinct C++ class get a distinct JSC::Structure
1052
1053         This also includes some optimizations that make the change an overall
1054         small speedup. Without those it was a bit of a slowdown.
1055
1056         * API/JSCallbackConstructor.cpp:
1057         (JSC::JSCallbackConstructor::JSCallbackConstructor): Take a structure.
1058         * API/JSCallbackConstructor.h: Ditto.
1059         * API/JSCallbackFunction.cpp:
1060         (JSC::JSCallbackFunction::JSCallbackFunction): Pass a structure.
1061         * API/JSCallbackObject.h: Take a structure.
1062         * API/JSCallbackObjectFunctions.h:
1063         (JSC::JSCallbackObject::JSCallbackObject): Ditto.
1064
1065         * API/JSClassRef.cpp:
1066         (OpaqueJSClass::prototype): Pass in a structure. Call setPrototype
1067         if there's a custom prototype involved.
1068         * API/JSObjectRef.cpp:
1069         (JSObjectMake): Ditto.
1070         (JSObjectMakeConstructor): Pass in a structure.
1071
1072         * JavaScriptCore.exp: Updated.
1073
1074         * VM/Machine.cpp:
1075         (JSC::jsLess): Added a special case for when both arguments are strings.
1076         This avoids converting both strings to with UString::toDouble.
1077         (JSC::jsLessEq): Ditto.
1078         (JSC::Machine::privateExecute): Pass in a structure.
1079         (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
1080         (JSC::Machine::cti_op_new_regexp): Ditto.
1081         (JSC::Machine::cti_op_is_string): Ditto.
1082         * VM/Machine.h: Made isJSString public so it can be used in the CTI.
1083
1084         * kjs/Arguments.cpp:
1085         (JSC::Arguments::Arguments): Pass in a structure.
1086
1087         * kjs/JSCell.h: Mark constructor explicit.
1088
1089         * kjs/JSGlobalObject.cpp:
1090         (JSC::markIfNeeded): Added an overload for marking structures.
1091         (JSC::JSGlobalObject::reset): Eliminate code to set data members to
1092         zero. We now do that in the constructor, and we no longer use this
1093         anywhere except in the constructor. Added code to create structures.
1094         Pass structures rather than prototypes when creating objects.
1095         (JSC::JSGlobalObject::mark): Mark the structures.
1096
1097         * kjs/JSGlobalObject.h: Removed unneeded class declarations.
1098         Added initializers for raw pointers in JSGlobalObjectData so
1099         everything starts with a 0. Added structure data and accessor
1100         functions.
1101
1102         * kjs/JSImmediate.cpp:
1103         (JSC::JSImmediate::nonInlineNaN): Added.
1104         * kjs/JSImmediate.h:
1105         (JSC::JSImmediate::toDouble): Rewrote to avoid PIC branches.
1106
1107         * kjs/JSNumberCell.cpp:
1108         (JSC::jsNumberCell): Made non-inline to avoid PIC branches
1109         in functions that call this one.
1110         (JSC::jsNaN): Ditto.
1111         * kjs/JSNumberCell.h: Ditto.
1112
1113         * kjs/JSObject.h: Removed constructor that takes a prototype.
1114         All callers now pass structures.
1115
1116         * kjs/ArrayConstructor.cpp:
1117         (JSC::ArrayConstructor::ArrayConstructor):
1118         (JSC::constructArrayWithSizeQuirk):
1119         * kjs/ArrayConstructor.h:
1120         * kjs/ArrayPrototype.cpp:
1121         (JSC::ArrayPrototype::ArrayPrototype):
1122         * kjs/ArrayPrototype.h:
1123         * kjs/BooleanConstructor.cpp:
1124         (JSC::BooleanConstructor::BooleanConstructor):
1125         (JSC::constructBoolean):
1126         (JSC::constructBooleanFromImmediateBoolean):
1127         * kjs/BooleanConstructor.h:
1128         * kjs/BooleanObject.cpp:
1129         (JSC::BooleanObject::BooleanObject):
1130         * kjs/BooleanObject.h:
1131         * kjs/BooleanPrototype.cpp:
1132         (JSC::BooleanPrototype::BooleanPrototype):
1133         * kjs/BooleanPrototype.h:
1134         * kjs/DateConstructor.cpp:
1135         (JSC::DateConstructor::DateConstructor):
1136         (JSC::constructDate):
1137         * kjs/DateConstructor.h:
1138         * kjs/DateInstance.cpp:
1139         (JSC::DateInstance::DateInstance):
1140         * kjs/DateInstance.h:
1141         * kjs/DatePrototype.cpp:
1142         (JSC::DatePrototype::DatePrototype):
1143         * kjs/DatePrototype.h:
1144         * kjs/ErrorConstructor.cpp:
1145         (JSC::ErrorConstructor::ErrorConstructor):
1146         (JSC::constructError):
1147         * kjs/ErrorConstructor.h:
1148         * kjs/ErrorInstance.cpp:
1149         (JSC::ErrorInstance::ErrorInstance):
1150         * kjs/ErrorInstance.h:
1151         * kjs/ErrorPrototype.cpp:
1152         (JSC::ErrorPrototype::ErrorPrototype):
1153         * kjs/ErrorPrototype.h:
1154         * kjs/FunctionConstructor.cpp:
1155         (JSC::FunctionConstructor::FunctionConstructor):
1156         * kjs/FunctionConstructor.h:
1157         * kjs/FunctionPrototype.cpp:
1158         (JSC::FunctionPrototype::FunctionPrototype):
1159         (JSC::FunctionPrototype::addFunctionProperties):
1160         * kjs/FunctionPrototype.h:
1161         * kjs/GlobalEvalFunction.cpp:
1162         (JSC::GlobalEvalFunction::GlobalEvalFunction):
1163         * kjs/GlobalEvalFunction.h:
1164         * kjs/InternalFunction.cpp:
1165         (JSC::InternalFunction::InternalFunction):
1166         * kjs/InternalFunction.h:
1167         (JSC::InternalFunction::InternalFunction):
1168         * kjs/JSArray.cpp:
1169         (JSC::JSArray::JSArray):
1170         (JSC::constructEmptyArray):
1171         (JSC::constructArray):
1172         * kjs/JSArray.h:
1173         * kjs/JSFunction.cpp:
1174         (JSC::JSFunction::JSFunction):
1175         (JSC::JSFunction::construct):
1176         * kjs/JSObject.cpp:
1177         (JSC::constructEmptyObject):
1178         * kjs/JSString.cpp:
1179         (JSC::StringObject::create):
1180         * kjs/JSWrapperObject.h:
1181         * kjs/MathObject.cpp:
1182         (JSC::MathObject::MathObject):
1183         * kjs/MathObject.h:
1184         * kjs/NativeErrorConstructor.cpp:
1185         (JSC::NativeErrorConstructor::NativeErrorConstructor):
1186         (JSC::NativeErrorConstructor::construct):
1187         * kjs/NativeErrorConstructor.h:
1188         * kjs/NativeErrorPrototype.cpp:
1189         (JSC::NativeErrorPrototype::NativeErrorPrototype):
1190         * kjs/NativeErrorPrototype.h:
1191         * kjs/NumberConstructor.cpp:
1192         (JSC::NumberConstructor::NumberConstructor):
1193         (JSC::constructWithNumberConstructor):
1194         * kjs/NumberConstructor.h:
1195         * kjs/NumberObject.cpp:
1196         (JSC::NumberObject::NumberObject):
1197         (JSC::constructNumber):
1198         (JSC::constructNumberFromImmediateNumber):
1199         * kjs/NumberObject.h:
1200         * kjs/NumberPrototype.cpp:
1201         (JSC::NumberPrototype::NumberPrototype):
1202         * kjs/NumberPrototype.h:
1203         * kjs/ObjectConstructor.cpp:
1204         (JSC::ObjectConstructor::ObjectConstructor):
1205         (JSC::constructObject):
1206         * kjs/ObjectConstructor.h:
1207         * kjs/ObjectPrototype.cpp:
1208         (JSC::ObjectPrototype::ObjectPrototype):
1209         * kjs/ObjectPrototype.h:
1210         * kjs/PrototypeFunction.cpp:
1211         (JSC::PrototypeFunction::PrototypeFunction):
1212         * kjs/PrototypeFunction.h:
1213         * kjs/RegExpConstructor.cpp:
1214         (JSC::RegExpConstructor::RegExpConstructor):
1215         (JSC::RegExpMatchesArray::RegExpMatchesArray):
1216         (JSC::constructRegExp):
1217         * kjs/RegExpConstructor.h:
1218         * kjs/RegExpObject.cpp:
1219         (JSC::RegExpObject::RegExpObject):
1220         * kjs/RegExpObject.h:
1221         * kjs/RegExpPrototype.cpp:
1222         (JSC::RegExpPrototype::RegExpPrototype):
1223         * kjs/RegExpPrototype.h:
1224         * kjs/Shell.cpp:
1225         (GlobalObject::GlobalObject):
1226         * kjs/StringConstructor.cpp:
1227         (JSC::StringConstructor::StringConstructor):
1228         (JSC::constructWithStringConstructor):
1229         * kjs/StringConstructor.h:
1230         * kjs/StringObject.cpp:
1231         (JSC::StringObject::StringObject):
1232         * kjs/StringObject.h:
1233         * kjs/StringObjectThatMasqueradesAsUndefined.h:
1234         (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
1235         * kjs/StringPrototype.cpp:
1236         (JSC::StringPrototype::StringPrototype):
1237         * kjs/StringPrototype.h:
1238         Take and pass structures.
1239
1240 2008-09-19  Alp Toker  <alp@nuanti.com>
1241
1242         Build fix for the 'gold' linker and recent binutils. New behaviour
1243         requires that we link to used libraries explicitly.
1244
1245         * GNUmakefile.am:
1246
1247 2008-09-19  Sam Weinig  <sam@webkit.org>
1248
1249         Roll r36694 back in.  It did not cause the crash.
1250
1251         * JavaScriptCore.exp:
1252         * VM/JSPropertyNameIterator.cpp:
1253         (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
1254         (JSC::JSPropertyNameIterator::invalidate):
1255         * VM/JSPropertyNameIterator.h:
1256         (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
1257         (JSC::JSPropertyNameIterator::create):
1258         * kjs/JSObject.cpp:
1259         (JSC::JSObject::getPropertyNames):
1260         * kjs/PropertyMap.cpp:
1261         (JSC::PropertyMap::getEnumerablePropertyNames):
1262         * kjs/PropertyMap.h:
1263         * kjs/PropertyNameArray.cpp:
1264         (JSC::PropertyNameArray::add):
1265         * kjs/PropertyNameArray.h:
1266         (JSC::PropertyNameArrayData::create):
1267         (JSC::PropertyNameArrayData::propertyNameVector):
1268         (JSC::PropertyNameArrayData::setCachedPrototypeChain):
1269         (JSC::PropertyNameArrayData::cachedPrototypeChain):
1270         (JSC::PropertyNameArrayData::begin):
1271         (JSC::PropertyNameArrayData::end):
1272         (JSC::PropertyNameArrayData::PropertyNameArrayData):
1273         (JSC::PropertyNameArray::PropertyNameArray):
1274         (JSC::PropertyNameArray::addKnownUnique):
1275         (JSC::PropertyNameArray::size):
1276         (JSC::PropertyNameArray::operator[]):
1277         (JSC::PropertyNameArray::begin):
1278         (JSC::PropertyNameArray::end):
1279         (JSC::PropertyNameArray::setData):
1280         (JSC::PropertyNameArray::data):
1281         (JSC::PropertyNameArray::releaseData):
1282         * kjs/StructureID.cpp:
1283         (JSC::structureIDChainsAreEqual):
1284         (JSC::StructureID::getEnumerablePropertyNames):
1285         (JSC::StructureID::clearEnumerationCache):
1286         (JSC::StructureID::createCachedPrototypeChain):
1287         * kjs/StructureID.h:
1288
1289 2008-09-19  Sam Weinig  <sam@webkit.org>
1290
1291         Roll out r36694.
1292
1293         * JavaScriptCore.exp:
1294         * VM/JSPropertyNameIterator.cpp:
1295         (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
1296         (JSC::JSPropertyNameIterator::invalidate):
1297         * VM/JSPropertyNameIterator.h:
1298         (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
1299         (JSC::JSPropertyNameIterator::create):
1300         * kjs/JSObject.cpp:
1301         (JSC::JSObject::getPropertyNames):
1302         * kjs/PropertyMap.cpp:
1303         (JSC::PropertyMap::getEnumerablePropertyNames):
1304         * kjs/PropertyMap.h:
1305         * kjs/PropertyNameArray.cpp:
1306         (JSC::PropertyNameArray::add):
1307         * kjs/PropertyNameArray.h:
1308         (JSC::PropertyNameArray::PropertyNameArray):
1309         (JSC::PropertyNameArray::addKnownUnique):
1310         (JSC::PropertyNameArray::begin):
1311         (JSC::PropertyNameArray::end):
1312         (JSC::PropertyNameArray::size):
1313         (JSC::PropertyNameArray::operator[]):
1314         (JSC::PropertyNameArray::releaseIdentifiers):
1315         * kjs/StructureID.cpp:
1316         (JSC::StructureID::getEnumerablePropertyNames):
1317         * kjs/StructureID.h:
1318         (JSC::StructureID::clearEnumerationCache):
1319
1320 2008-09-19  Oliver Hunt  <oliver@apple.com>
1321
1322         Reviewed by Maciej Stachowiak.
1323
1324         Improve peformance of local variable initialisation.
1325
1326         Pull local and constant initialisation out of slideRegisterWindowForCall
1327         and into its own opcode.  This allows the JIT to generate the initialisation
1328         code for a function directly into the instruction stream and so avoids a few
1329         branches on function entry.
1330
1331         Results a 1% progression in SunSpider, particularly in a number of the bitop
1332         tests where the called functions are very fast. 
1333
1334         * VM/CTI.cpp:
1335         (JSC::CTI::emitInitialiseRegister):
1336         (JSC::CTI::privateCompileMainPass):
1337         * VM/CTI.h:
1338         * VM/CodeBlock.cpp:
1339         (JSC::CodeBlock::dump):
1340         * VM/CodeGenerator.cpp:
1341         (JSC::CodeGenerator::CodeGenerator):
1342         * VM/Machine.cpp:
1343         (JSC::slideRegisterWindowForCall):
1344         (JSC::Machine::privateExecute):
1345         * VM/Opcode.h:
1346
1347 2008-09-19  Sam Weinig  <sam@webkit.org>
1348
1349         Reviewed by Darin Adler.
1350
1351         Patch for https://bugs.webkit.org/show_bug.cgi?id=20928
1352         Speed up JS property enumeration by caching entire PropertyNameArray
1353
1354         1.3% speedup on Sunspider, 30% on string-fasta.
1355
1356         * JavaScriptCore.exp:
1357         * VM/JSPropertyNameIterator.cpp:
1358         (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
1359         (JSC::JSPropertyNameIterator::invalidate):
1360         * VM/JSPropertyNameIterator.h:
1361         (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
1362         (JSC::JSPropertyNameIterator::create):
1363         * kjs/JSObject.cpp:
1364         (JSC::JSObject::getPropertyNames):
1365         * kjs/PropertyMap.cpp:
1366         (JSC::PropertyMap::getEnumerablePropertyNames):
1367         * kjs/PropertyMap.h:
1368         * kjs/PropertyNameArray.cpp:
1369         (JSC::PropertyNameArray::add):
1370         * kjs/PropertyNameArray.h:
1371         (JSC::PropertyNameArrayData::create):
1372         (JSC::PropertyNameArrayData::propertyNameVector):
1373         (JSC::PropertyNameArrayData::setCachedPrototypeChain):
1374         (JSC::PropertyNameArrayData::cachedPrototypeChain):
1375         (JSC::PropertyNameArrayData::begin):
1376         (JSC::PropertyNameArrayData::end):
1377         (JSC::PropertyNameArrayData::PropertyNameArrayData):
1378         (JSC::PropertyNameArray::PropertyNameArray):
1379         (JSC::PropertyNameArray::addKnownUnique):
1380         (JSC::PropertyNameArray::size):
1381         (JSC::PropertyNameArray::operator[]):
1382         (JSC::PropertyNameArray::begin):
1383         (JSC::PropertyNameArray::end):
1384         (JSC::PropertyNameArray::setData):
1385         (JSC::PropertyNameArray::data):
1386         (JSC::PropertyNameArray::releaseData):
1387         * kjs/ScopeChain.cpp:
1388         (JSC::ScopeChainNode::print):
1389         * kjs/StructureID.cpp:
1390         (JSC::structureIDChainsAreEqual):
1391         (JSC::StructureID::getEnumerablePropertyNames):
1392         (JSC::StructureID::clearEnumerationCache):
1393         (JSC::StructureID::createCachedPrototypeChain):
1394         * kjs/StructureID.h:
1395
1396 2008-09-19  Holger Hans Peter Freyther  <zecke@selfish.org>
1397
1398         Reviewed by Maciej Stachowiak.
1399
1400         Fix a mismatched new[]/delete in JSObject::allocatePropertyStorage
1401
1402         * kjs/JSObject.cpp:
1403         (JSC::JSObject::allocatePropertyStorage): Spotted by valgrind.
1404
1405 2008-09-19  Darin Adler  <darin@apple.com>
1406
1407         Reviewed by Sam Weinig.
1408
1409         - part 2 of https://bugs.webkit.org/show_bug.cgi?id=20858
1410           make each distinct C++ class get a distinct JSC::Structure
1411
1412         * JavaScriptCore.exp: Exported constructEmptyObject for use in WebCore.
1413
1414         * kjs/JSGlobalObject.h: Changed the protected constructor to take a
1415         structure instead of a prototype.
1416
1417         * kjs/JSVariableObject.h: Removed constructor that takes a prototype.
1418
1419 2008-09-19  Julien Chaffraix  <jchaffraix@pleyo.com>
1420
1421         Reviewed by Alexey Proskuryakov.
1422
1423         Use the template hoisting technique on the RefCounted class. This reduces the code bloat due to
1424         non-template methods' code been copied for each instance of the template.
1425         The patch splits RefCounted between a base class that holds non-template methods and attributes
1426         and the template RefCounted class that keeps the same functionnality.
1427
1428         On my Linux with gcc 4.3 for the Gtk port, this is:
1429         - a ~600KB save on libwebkit.so in release.
1430         - a ~1.6MB save on libwebkit.so in debug.
1431
1432         It is a wash on Sunspider and a small win on Dromaeo (not sure it is relevant).
1433         On the whole, it should be a small win as we reduce the compiled code size and the only
1434         new function call should be inlined by the compiler.
1435
1436         * wtf/RefCounted.h:
1437         (WTF::RefCountedBase::ref): Copied from RefCounted.
1438         (WTF::RefCountedBase::hasOneRef): Ditto.
1439         (WTF::RefCountedBase::refCount): Ditto.
1440         (WTF::RefCountedBase::RefCountedBase): Ditto.
1441         (WTF::RefCountedBase::~RefCountedBase): Ditto.
1442         (WTF::RefCountedBase::derefBase): Tweaked from the RefCounted version to remove
1443         template section.
1444         (WTF::RefCounted::RefCounted):
1445         (WTF::RefCounted::deref): Small wrapper around RefCountedBase::derefBase().
1446         (WTF::RefCounted::~RefCounted): Keep private destructor.
1447
1448 2008-09-18  Darin Adler  <darin@apple.com>
1449
1450         Reviewed by Maciej Stachowiak.
1451
1452         - part 1 of https://bugs.webkit.org/show_bug.cgi?id=20858
1453           make each distinct C++ class get a distinct JSC::Structure
1454
1455         * kjs/lookup.h: Removed things here that were used only in WebCore:
1456         cacheGlobalObject, JSC_DEFINE_PROTOTYPE, JSC_DEFINE_PROTOTYPE_WITH_PROTOTYPE,
1457         and JSC_IMPLEMENT_PROTOTYPE.
1458
1459 2008-09-18  Darin Adler  <darin@apple.com>
1460
1461         Reviewed by Maciej Stachowiak.
1462
1463         - https://bugs.webkit.org/show_bug.cgi?id=20927
1464           simplify/streamline the code to turn strings into identifiers while parsing
1465
1466         * kjs/grammar.y: Get rid of string from the union, and use ident for STRING as
1467         well as for IDENT.
1468
1469         * kjs/lexer.cpp:
1470         (JSC::Lexer::lex): Use makeIdentifier instead of makeUString for String.
1471         * kjs/lexer.h: Remove makeUString.
1472
1473         * kjs/nodes.h: Changed StringNode to hold an Identifier instead of UString.
1474
1475         * VM/CodeGenerator.cpp:
1476         (JSC::keyForCharacterSwitch): Updated since StringNode now holds an Identifier.
1477         (JSC::prepareJumpTableForStringSwitch): Ditto.
1478         * kjs/nodes.cpp:
1479         (JSC::StringNode::emitCode): Ditto. The comment from here is now in the lexer.
1480         (JSC::processClauseList): Ditto.
1481         * kjs/nodes2string.cpp:
1482         (JSC::StringNode::streamTo): Ditto.
1483
1484 2008-09-18  Sam Weinig  <sam@webkit.org>
1485
1486         Fix style.
1487
1488         * VM/Instruction.h:
1489         (JSC::Instruction::Instruction):
1490
1491 2008-09-18  Oliver Hunt  <oliver@apple.com>
1492
1493         Reviewed by Maciej Stachowiak.
1494
1495         Bug 20911: REGRESSION(r36480?): Reproducible assertion failure below derefStructureIDs 64-bit JavaScriptCore
1496         <https://bugs.webkit.org/show_bug.cgi?id=20911>
1497
1498         The problem was simply caused by the int constructor for Instruction
1499         failing to initialise the full struct in 64bit builds.
1500
1501         * VM/Instruction.h:
1502         (JSC::Instruction::Instruction):
1503
1504 2008-09-18  Darin Adler  <darin@apple.com>
1505
1506         - fix release build
1507
1508         * wtf/RefCountedLeakCounter.cpp: Removed stray "static".
1509
1510 2008-09-18  Darin Adler  <darin@apple.com>
1511
1512         Reviewed by Sam Weinig.
1513
1514         * kjs/JSGlobalObject.h: Tiny style guideline tweak.
1515
1516 2008-09-18  Darin Adler  <darin@apple.com>
1517
1518         Reviewed by Sam Weinig.
1519
1520         - fix https://bugs.webkit.org/show_bug.cgi?id=20925
1521           LEAK messages appear every time I quit
1522
1523         * JavaScriptCore.exp: Updated, and also added an export
1524         needed for future WebCore use of JSC::StructureID.
1525
1526         * wtf/RefCountedLeakCounter.cpp:
1527         (WTF::RefCountedLeakCounter::suppressMessages): Added.
1528         (WTF::RefCountedLeakCounter::cancelMessageSuppression): Added.
1529         (WTF::RefCountedLeakCounter::RefCountedLeakCounter): Tweaked a bit.
1530         (WTF::RefCountedLeakCounter::~RefCountedLeakCounter): Added code to
1531         log the reason there was no leak checking done.
1532         (WTF::RefCountedLeakCounter::increment): Tweaked a bit.
1533         (WTF::RefCountedLeakCounter::decrement): Ditto.
1534
1535         * wtf/RefCountedLeakCounter.h: Replaced setLogLeakMessages with two
1536         new functions, suppressMessages and cancelMessageSuppression. Also
1537         added m_ prefixes to the data member names.
1538
1539 2008-09-18  Holger Hans Peter Freyther  <zecke@selfish.org>
1540
1541         Reviewed by Mark Rowe.
1542
1543         https://bugs.webkit.org/show_bug.cgi?id=20437
1544
1545         Add a proper #define to define which XML Parser implementation to use. Client
1546         code can use #if USE(QXMLSTREAM) to decide if the Qt XML StreamReader
1547         implementation is going to be used.
1548
1549         * wtf/Platform.h:
1550
1551 2008-09-18  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1552
1553         Reviewed by Maciej Stachowiak.
1554
1555         Make a Unicode non-breaking space count as a whitespace character in
1556         PCRE. This change was already made in WREC, and it fixes one of the
1557         Mozilla JS tests. Since it is now fixed in PCRE as well, we can check
1558         in a new set of expected test results.
1559
1560         * pcre/pcre_internal.h:
1561         (isSpaceChar):
1562         * tests/mozilla/expected.html:
1563
1564 2008-09-18  Stephanie Lewis  <slewis@apple.com>
1565
1566         Reviewed by Mark Rowe and Maciej Stachowiak.
1567
1568         add an option use arch to specify which architecture to run.
1569
1570         * tests/mozilla/jsDriver.pl:
1571
1572 2008-09-17  Oliver Hunt  <oliver@apple.com>
1573
1574         Correctly restore argument reference prior to SFX runtime calls.
1575         
1576         Reviewed by Steve Falkenburg.
1577
1578         * VM/CTI.cpp:
1579         (JSC::CTI::privateCompileSlowCases):
1580         (JSC::CTI::privateCompile):
1581
1582 2008-09-17  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1583
1584         Reviewed by Maciej Stachowiak.
1585
1586         Bug 20876: REGRESSION (r36417, r36427): fast/js/exception-expression-offset.html fails
1587         <https://bugs.webkit.org/show_bug.cgi?id=20876>
1588
1589         r36417 and r36427 caused an get_by_id opcode to be emitted before the
1590         instanceof and construct opcodes, in order to enable inline caching of
1591         the prototype property. Unfortunately, this regressed some tests dealing
1592         with exceptions thrown by 'instanceof' and the 'new' operator. We fix
1593         these problems by detecting whether an "is not an object" exception is
1594         thrown before op_instanceof or op_construct, and emit the proper
1595         exception in those cases.
1596
1597         * VM/CodeGenerator.cpp:
1598         (JSC::CodeGenerator::emitConstruct):
1599         * VM/CodeGenerator.h:
1600         * VM/ExceptionHelpers.cpp:
1601         (JSC::createInvalidParamError):
1602         (JSC::createNotAConstructorError):
1603         (JSC::createNotAnObjectError):
1604         * VM/ExceptionHelpers.h:
1605         * VM/Machine.cpp:
1606         (JSC::Machine::getOpcode):
1607         (JSC::Machine::privateExecute):
1608         * VM/Machine.h:
1609         * kjs/nodes.cpp:
1610         (JSC::NewExprNode::emitCode):
1611         (JSC::InstanceOfNode::emitCode):
1612
1613 2008-09-17  Gavin Barraclough  <barraclough@apple.com>
1614
1615         Reviewed by Oliver Hunt.
1616
1617         JIT generation cti_op_construct_verify.
1618         
1619         Quarter to half percent progression on v8-tests.
1620         Roughly not change on SunSpider (possible minor progression).
1621
1622         * VM/CTI.cpp:
1623         (JSC::CTI::privateCompileMainPass):
1624         * VM/Machine.cpp:
1625         * VM/Machine.h:
1626
1627 2008-09-15  Steve Falkenburg  <sfalken@apple.com>
1628
1629         Improve timer accuracy for JavaScript Date object on Windows.
1630         
1631         Use a combination of ftime and QueryPerformanceCounter.
1632         ftime returns the information we want, but doesn't have sufficient resolution.
1633         QueryPerformanceCounter has high resolution, but is only usable to measure time intervals.
1634         To combine them, we call ftime and QueryPerformanceCounter initially. Later calls will use
1635         QueryPerformanceCounter by itself, adding the delta to the saved ftime.  We re-sync to
1636         correct for drift if the low-res and high-res elapsed time between calls differs by more
1637         than twice the low-resolution timer resolution.
1638         
1639         QueryPerformanceCounter may be inaccurate due to a problems with:
1640         - some PCI bridge chipsets (http://support.microsoft.com/kb/274323)
1641         - BIOS bugs (http://support.microsoft.com/kb/895980/)
1642         - BIOS/HAL bugs on multiprocessor/multicore systems (http://msdn.microsoft.com/en-us/library/ms644904.aspx)
1643         
1644         Reviewed by Darin Adler.
1645
1646         * kjs/DateMath.cpp:
1647         (JSC::highResUpTime):
1648         (JSC::lowResUTCTime):
1649         (JSC::qpcAvailable):
1650         (JSC::getCurrentUTCTimeWithMicroseconds):
1651
1652 2008-09-17  Gavin Barraclough  <barraclough@apple.com>
1653
1654         Reviewed by Geoff Garen.
1655
1656         Implement JIT generation of CallFrame initialization, for op_call.
1657
1658         1% sunspider 2.5% v8-tests.
1659
1660         * VM/CTI.cpp:
1661         (JSC::CTI::compileOpCall):
1662         * VM/Machine.cpp:
1663         (JSC::Machine::cti_op_call_JSFunction):
1664         (JSC::Machine::cti_op_call_NotJSFunction):
1665
1666 2008-09-17  Gavin Barraclough  <barraclough@apple.com>
1667
1668         Reviewed by Geoff Garen.
1669
1670         Optimizations for op_call in CTI.  Move check for (ctiCode == 0) into JIT code,
1671         move copying of scopeChain for CodeBlocks that needFullScopeChain into head of
1672         functions, instead of checking prior to making the call.
1673
1674         3% on v8-tests (4% on richards, 6% in delta-blue)
1675
1676         * VM/CTI.cpp:
1677         (JSC::CTI::compileOpCall):
1678         (JSC::CTI::privateCompileSlowCases):
1679         (JSC::CTI::privateCompile):
1680         * VM/Machine.cpp:
1681         (JSC::Machine::execute):
1682         (JSC::Machine::cti_op_call_JSFunction):
1683         (JSC::Machine::cti_vm_compile):
1684         (JSC::Machine::cti_vm_updateScopeChain):
1685         (JSC::Machine::cti_op_construct_JSConstruct):
1686         * VM/Machine.h:
1687
1688 2008-09-17  Tor Arne Vestbø  <tavestbo@trolltech.com>
1689
1690         Fix the QtWebKit/Mac build
1691
1692         * wtf/ThreadingQt.cpp:
1693         (WTF::initializeThreading): use QCoreApplication to get the main thread
1694
1695 2008-09-16  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1696
1697         Reviewed by Maciej Stachowiak.
1698
1699         Bug 20857: REGRESSION (r36427): ASSERTION FAILED: m_refCount >= 0 in RegisterID::deref()
1700         <https://bugs.webkit.org/show_bug.cgi?id=20857>
1701
1702         Fix a problem stemming from the slightly unsafe behaviour of the
1703         CodeGenerator::finalDestination() method by putting the "func" argument
1704         of the emitConstruct() method in a RefPtr in its caller. Also, add an
1705         assertion guaranteeing that this is always the case.
1706
1707         CodeGenerator::finalDestination() is still incorrect and can cause
1708         problems with a different allocator; see bug 20340 for more details.
1709
1710         * VM/CodeGenerator.cpp:
1711         (JSC::CodeGenerator::emitConstruct):
1712         * kjs/nodes.cpp:
1713         (JSC::NewExprNode::emitCode):
1714
1715 2008-09-16  Alice Liu  <alice.liu@apple.com>
1716
1717         build fix.
1718
1719         * VM/CTI.cpp:
1720         (JSC::CTI::privateCompileMainPass):
1721
1722 2008-09-16  Gavin Barraclough  <barraclough@apple.com>
1723
1724         Reviewed by Geoff Garen.
1725
1726         CTI code generation for op_ret.  The majority of the work
1727         (updating variables on the stack & on exec) can be performed
1728         directly in generated code.
1729
1730         We still need to check, & to call out to C-code to handle
1731         activation records, profiling, and full scope chains.
1732
1733         +1.5% Sunspider, +5/6% v8 tests.
1734
1735         * VM/CTI.cpp:
1736         (JSC::CTI::emitPutCTIParam):
1737         (JSC::CTI::compileOpCall):
1738         (JSC::CTI::privateCompileMainPass):
1739         * VM/CTI.h:
1740         * VM/Machine.cpp:
1741         (JSC::Machine::cti_op_ret_activation):
1742         (JSC::Machine::cti_op_ret_profiler):
1743         (JSC::Machine::cti_op_ret_scopeChain):
1744         * VM/Machine.h:
1745
1746 2008-09-16  Dimitri Glazkov  <dglazkov@chromium.org>
1747
1748         Fix the Windows build.
1749
1750         Add some extra parentheses to stop MSVC from complaining so much.
1751
1752         * VM/Machine.cpp:
1753         (JSC::Machine::privateExecute):
1754         (JSC::Machine::cti_op_stricteq):
1755         (JSC::Machine::cti_op_nstricteq):
1756         * kjs/operations.cpp:
1757         (JSC::strictEqual):
1758
1759 2008-09-15  Maciej Stachowiak  <mjs@apple.com>
1760
1761         Reviewed by Cameron Zwarich.
1762         
1763         - speed up the === and !== operators by choosing the fast cases better
1764         
1765         No effect on SunSpider but speeds up the V8 EarlyBoyer benchmark about 4%.
1766
1767         * VM/Machine.cpp:
1768         (JSC::Machine::privateExecute):
1769         (JSC::Machine::cti_op_stricteq):
1770         (JSC::Machine::cti_op_nstricteq):
1771         * kjs/JSImmediate.h:
1772         (JSC::JSImmediate::areBothImmediate):
1773         * kjs/operations.cpp:
1774         (JSC::strictEqual):
1775         (JSC::strictEqualSlowCase):
1776         * kjs/operations.h:
1777
1778 2008-09-15  Oliver Hunt  <oliver@apple.com>
1779
1780         RS=Sam Weinig.
1781
1782         Coding style cleanup.
1783
1784         * VM/Machine.cpp:
1785         (JSC::Machine::privateExecute):
1786
1787 2008-09-15  Oliver Hunt  <oliver@apple.com>
1788
1789         Reviewed by Cameron Zwarich.
1790
1791         Bug 20874: op_resolve does not do any form of caching
1792         <https://bugs.webkit.org/show_bug.cgi?id=20874>
1793
1794         This patch adds an op_resolve_global opcode to handle (and cache)
1795         property lookup we can statically determine must occur on the global
1796         object (if at all).
1797
1798         3% progression on sunspider, 3.2x improvement to bitops-bitwise-and, and
1799         10% in math-partial-sums
1800
1801         * VM/CTI.cpp:
1802         (JSC::CTI::privateCompileMainPass):
1803         * VM/CTI.h:
1804         * VM/CodeBlock.cpp:
1805         (JSC::CodeBlock::dump):
1806         * VM/CodeGenerator.cpp:
1807         (JSC::CodeGenerator::findScopedProperty):
1808         (JSC::CodeGenerator::emitResolve):
1809         * VM/Machine.cpp:
1810         (JSC::resolveGlobal):
1811         (JSC::Machine::privateExecute):
1812         (JSC::Machine::cti_op_resolve_global):
1813         * VM/Machine.h:
1814         * VM/Opcode.h:
1815
1816 2008-09-15  Sam Weinig  <sam@webkit.org>
1817
1818         Roll out r36462.  It broke document.all.
1819
1820         * VM/CTI.cpp:
1821         (JSC::CTI::privateCompileMainPass):
1822         (JSC::CTI::privateCompileSlowCases):
1823         * VM/CTI.h:
1824         * VM/Machine.cpp:
1825         (JSC::Machine::Machine):
1826         (JSC::Machine::cti_op_eq_null):
1827         (JSC::Machine::cti_op_neq_null):
1828         * VM/Machine.h:
1829         (JSC::Machine::isJSString):
1830         * kjs/JSCell.h:
1831         * kjs/JSWrapperObject.h:
1832         * kjs/StringObject.h:
1833         * kjs/StringObjectThatMasqueradesAsUndefined.h:
1834
1835 2008-09-15  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1836
1837         Reviewed by Maciej Stachowiak.
1838
1839         Bug 20863: ASSERTION FAILED: addressOffset < instructions.size() in CodeBlock::getHandlerForVPC
1840         <https://bugs.webkit.org/show_bug.cgi?id=20863>
1841
1842         r36427 changed the number of arguments to op_construct without changing
1843         the argument index for the vPC in the call to initializeCallFrame() in
1844         the CTI case. This caused a JSC test failure. Correcting the argument
1845         index fixes the test failure.
1846
1847         * VM/Machine.cpp:
1848         (JSC::Machine::cti_op_construct_JSConstruct):
1849
1850 2008-09-15  Mark Rowe  <mrowe@apple.com>
1851
1852         Fix GCC 4.2 build.
1853
1854         * VM/CTI.h:
1855
1856 2008-09-15  Geoffrey Garen  <ggaren@apple.com>
1857
1858         Reviewed by Maciej Stachowiak.
1859         
1860         Fixed a typo in op_get_by_id_chain that caused it to miss every time
1861         in the interpreter.
1862         
1863         Also, a little cleanup.
1864
1865         * VM/Machine.cpp:
1866         (JSC::Machine::privateExecute): Set up baseObject before entering the
1867         loop, so we compare against the right values.
1868
1869 2008-09-15  Geoffrey Garen  <ggaren@apple.com>
1870
1871         Reviewed by Sam Weinig.
1872         
1873         Removed the CalledAsConstructor flag from the call frame header. Now,
1874         we use an explicit opcode at the call site to fix up constructor results.
1875
1876         SunSpider says 0.4% faster.
1877         
1878         cti_op_construct_verify is an out-of-line function call for now, but we
1879         can fix that once StructureID holds type information like isObject.
1880
1881         * VM/CTI.cpp:
1882         (JSC::CTI::privateCompileMainPass): Codegen for the new opcode.
1883
1884         * VM/CodeBlock.cpp:
1885         (JSC::CodeBlock::dump):
1886
1887         * VM/CodeGenerator.cpp: Codegen for the new opcode. Also...
1888         (JSC::CodeGenerator::emitCall): ... don't test for known non-zero value.
1889         (JSC::CodeGenerator::emitConstruct): ... ditto.
1890
1891         * VM/Machine.cpp: No more CalledAsConstructor
1892         (JSC::Machine::privateExecute): Implementation for the new opcode.
1893         (JSC::Machine::cti_op_ret): The speedup: no need to check whether we were
1894         called as a constructor.
1895         (JSC::Machine::cti_op_construct_verify): Implementation for the new opcode.
1896         * VM/Machine.h:
1897
1898         * VM/Opcode.h: Declare new opcode.
1899
1900         * VM/RegisterFile.h:
1901         (JSC::RegisterFile::): No more CalledAsConstructor
1902
1903 2008-09-15  Gavin Barraclough  <barraclough@apple.com>
1904
1905         Reviewed by Geoff Garen.
1906
1907         Inline code generation of eq_null/neq_null for CTI.  Uses vptr checking for
1908         StringObjectsThatAreMasqueradingAsBeingUndefined.  In the long run, the
1909         masquerading may be handled differently (through the StructureIDs - see bug
1910         #20823).
1911
1912         >1% on v8-tests.
1913
1914         * VM/CTI.cpp:
1915         (JSC::CTI::emitJumpSlowCaseIfIsJSCell):
1916         (JSC::CTI::privateCompileMainPass):
1917         (JSC::CTI::privateCompileSlowCases):
1918         * VM/CTI.h:
1919         * VM/Machine.cpp:
1920         (JSC::Machine::Machine):
1921         (JSC::Machine::cti_op_eq_null):
1922         (JSC::Machine::cti_op_neq_null):
1923         * VM/Machine.h:
1924         (JSC::Machine::doesMasqueradesAsUndefined):
1925         * kjs/JSWrapperObject.h:
1926         (JSC::JSWrapperObject::):
1927         (JSC::JSWrapperObject::JSWrapperObject):
1928         * kjs/StringObject.h:
1929         (JSC::StringObject::StringObject):
1930         * kjs/StringObjectThatMasqueradesAsUndefined.h:
1931         (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
1932
1933 2008-09-15  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1934
1935         Rubber-stamped by Oliver Hunt.
1936
1937         r36427 broke CodeBlock::dump() by changing the number of arguments to
1938         op_construct without changing the code that prints it. This patch fixes
1939         it by printing the additional argument.
1940
1941         * JavaScriptCore.xcodeproj/project.pbxproj:
1942         * VM/CodeBlock.cpp:
1943         (JSC::CodeBlock::dump):
1944
1945 2008-09-15  Adam Roben  <aroben@apple.com>
1946
1947         Build fix
1948
1949         * kjs/StructureID.cpp: Removed a stray semicolon.
1950
1951 2008-09-15  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1952
1953         Reviewed by Maciej Stachowiak.
1954
1955         Fix a crash in fast/js/exception-expression-offset.html caused by not
1956         updating all mentions of the length of op_construct in r36427.
1957
1958         * VM/Machine.cpp:
1959         (JSC::Machine::cti_op_construct_NotJSConstruct):
1960
1961 2008-09-15  Maciej Stachowiak  <mjs@apple.com>
1962
1963         Reviewed by Cameron Zwarich.
1964         
1965         - fix layout test failure introduced by fix for 20849
1966         
1967         (The failing test was fast/js/delete-then-put.html)
1968
1969         * kjs/JSObject.cpp:
1970         (JSC::JSObject::removeDirect): Clear enumeration cache
1971         in the dictionary case.
1972         * kjs/JSObject.h:
1973         (JSC::JSObject::putDirect): Ditto.
1974         * kjs/StructureID.h:
1975         (JSC::StructureID::clearEnumerationCache): Inline to handle the
1976         clear.
1977
1978 2008-09-15  Maciej Stachowiak  <mjs@apple.com>
1979
1980         Reviewed by Cameron Zwarich.
1981         
1982         - fix JSC test failures introduced by fix for 20849
1983
1984         * kjs/PropertyMap.cpp:
1985         (JSC::PropertyMap::getEnumerablePropertyNames): Use the correct count.
1986
1987 2008-09-15  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1988
1989         Reviewed by Maciej Stachowiak.
1990
1991         Bug 20851: REGRESSION (r36410): fast/js/kde/GlobalObject.html fails
1992         <https://bugs.webkit.org/show_bug.cgi?id=20851>
1993
1994         r36410 introduced an optimization for parseInt() that is incorrect when
1995         its argument is larger than the range of a 32-bit integer. If the
1996         argument is a number that is not an immediate integer, then the correct
1997         behaviour is to return the floor of its value, unless it is an infinite
1998         value, in which case the correct behaviour is to return 0.
1999
2000         * kjs/JSGlobalObjectFunctions.cpp:
2001         (JSC::globalFuncParseInt):
2002
2003 2008-09-15  Sam Weinig  <sam@webkit.org>
2004
2005         Reviewed by Maciej Stachowiak.
2006
2007         Patch for https://bugs.webkit.org/show_bug.cgi?id=20849
2008         Cache property names for getEnumerablePropertyNames in the StructureID.
2009
2010         ~0.5% speedup on Sunspider overall (9.7% speedup on string-fasta).  ~1% speedup
2011         on the v8 test suite.
2012
2013         * kjs/JSObject.cpp:
2014         (JSC::JSObject::getPropertyNames):
2015         * kjs/PropertyMap.cpp:
2016         (JSC::PropertyMap::getEnumerablePropertyNames):
2017         * kjs/PropertyMap.h:
2018         * kjs/StructureID.cpp:
2019         (JSC::StructureID::StructureID):
2020         (JSC::StructureID::getEnumerablePropertyNames):
2021         * kjs/StructureID.h:
2022
2023 2008-09-14  Maciej Stachowiak  <mjs@apple.com>
2024
2025         Reviewed by Cameron Zwarich.
2026         
2027         - speed up JS construction by extracting "prototype" lookup so PIC applies.
2028         
2029         ~0.5% speedup on SunSpider
2030         Speeds up some of the V8 tests as well, most notably earley-boyer.
2031
2032         * VM/CTI.cpp:
2033         (JSC::CTI::compileOpCall): Account for extra arg for prototype.
2034         (JSC::CTI::privateCompileMainPass): Account for increased size of op_construct.
2035         * VM/CodeGenerator.cpp:
2036         (JSC::CodeGenerator::emitConstruct): Emit separate lookup to get prototype property.
2037         * VM/Machine.cpp:
2038         (JSC::Machine::privateExecute): Expect prototype arg in op_construct.
2039         (JSC::Machine::cti_op_construct_JSConstruct): ditto
2040         (JSC::Machine::cti_op_construct_NotJSConstruct): ditto
2041
2042 2008-09-10  Alexey Proskuryakov  <ap@webkit.org>
2043
2044         Reviewed by Eric Seidel.
2045
2046         Add a protected destructor for RefCounted.
2047
2048         It is wrong to call its destructor directly, because (1) this should be taken care of by
2049         deref(), and (2) many classes that use RefCounted have non-virtual destructors.
2050
2051         No change in behavior.
2052
2053         * wtf/RefCounted.h: (WTF::RefCounted::~RefCounted):
2054
2055 2008-09-14  Gavin Barraclough  <barraclough@apple.com>
2056
2057         Reviewed by Sam Weinig.
2058
2059         Accelerated property accesses.
2060
2061         Inline more of the array access code into the JIT code for get/put_by_val.
2062         Accelerate get/put_by_id by speculatively inlining a disable direct access
2063         into the hot path of the code, and repatch this with the correct StructureID
2064         and property map offset once these are known.  In the case of accesses to the
2065         prototype and reading the array-length a trampoline is genertaed, and the
2066         branch to the slow-case is relinked to jump to this.
2067
2068         By repatching, we mean rewriting the x86 instruction stream.  Instructions are
2069         only modified in a simple fasion - altering immediate operands, memory access
2070         deisplacements, and branch offsets.
2071         
2072         For regular get_by_id/put_by_id accesses to an object, a StructureID in an
2073         instruction's immediate operant is updateded, and a memory access operation's
2074         displacement is updated to access the correct field on the object.  In the case
2075         of more complex accesses (array length and get_by_id_prototype) the offset on
2076         the branch to slow-case is updated, to now jump to a trampoline.
2077
2078         +2.8% sunspider, +13% v8-tests
2079
2080         * VM/CTI.cpp:
2081         (JSC::CTI::emitCall):
2082         (JSC::CTI::emitJumpSlowCaseIfNotJSCell):
2083         (JSC::CTI::CTI):
2084         (JSC::CTI::privateCompileMainPass):
2085         (JSC::CTI::privateCompileSlowCases):
2086         (JSC::CTI::privateCompile):
2087         (JSC::CTI::privateCompileGetByIdSelf):
2088         (JSC::CTI::privateCompileGetByIdProto):
2089         (JSC::CTI::privateCompileGetByIdChain):
2090         (JSC::CTI::privateCompilePutByIdReplace):
2091         (JSC::CTI::privateCompilePutByIdTransition):
2092         (JSC::CTI::privateCompileArrayLengthTrampoline):
2093         (JSC::CTI::privateCompileStringLengthTrampoline):
2094         (JSC::CTI::patchGetByIdSelf):
2095         (JSC::CTI::patchPutByIdReplace):
2096         (JSC::CTI::privateCompilePatchGetArrayLength):
2097         (JSC::CTI::privateCompilePatchGetStringLength):
2098         * VM/CTI.h:
2099         (JSC::CTI::compileGetByIdSelf):
2100         (JSC::CTI::compileGetByIdProto):
2101         (JSC::CTI::compileGetByIdChain):
2102         (JSC::CTI::compilePutByIdReplace):
2103         (JSC::CTI::compilePutByIdTransition):
2104         (JSC::CTI::compileArrayLengthTrampoline):
2105         (JSC::CTI::compileStringLengthTrampoline):
2106         (JSC::CTI::compilePatchGetArrayLength):
2107         (JSC::CTI::compilePatchGetStringLength):
2108         * VM/CodeBlock.cpp:
2109         (JSC::CodeBlock::dump):
2110         (JSC::CodeBlock::~CodeBlock):
2111         * VM/CodeBlock.h:
2112         (JSC::StructureStubInfo::StructureStubInfo):
2113         (JSC::CodeBlock::getStubInfo):
2114         * VM/Machine.cpp:
2115         (JSC::Machine::tryCTICachePutByID):
2116         (JSC::Machine::tryCTICacheGetByID):
2117         (JSC::Machine::cti_op_put_by_val_array):
2118         * VM/Machine.h:
2119         * masm/X86Assembler.h:
2120         (JSC::X86Assembler::):
2121         (JSC::X86Assembler::cmpl_i8m):
2122         (JSC::X86Assembler::emitUnlinkedJa):
2123         (JSC::X86Assembler::getRelocatedAddress):
2124         (JSC::X86Assembler::getDifferenceBetweenLabels):
2125         (JSC::X86Assembler::emitModRm_opmsib):
2126
2127 2008-09-14  Maciej Stachowiak  <mjs@apple.com>
2128
2129         Reviewed by Cameron Zwarich.
2130         
2131         - split the "prototype" lookup for hasInstance into opcode stream so it can be cached
2132         
2133         ~5% speedup on v8 earley-boyer test
2134
2135         * API/JSCallbackObject.h: Add a parameter for the pre-looked-up prototype.
2136         * API/JSCallbackObjectFunctions.h:
2137         (JSC::::hasInstance): Ditto.
2138         * API/JSValueRef.cpp:
2139         (JSValueIsInstanceOfConstructor): Look up and pass in prototype.
2140         * JavaScriptCore.exp:
2141         * VM/CTI.cpp:
2142         (JSC::CTI::privateCompileMainPass): Pass along prototype.
2143         * VM/CodeBlock.cpp:
2144         (JSC::CodeBlock::dump): Print third arg.
2145         * VM/CodeGenerator.cpp:
2146         (JSC::CodeGenerator::emitInstanceOf): Implement this, now that there
2147         is a third argument.
2148         * VM/CodeGenerator.h:
2149         * VM/Machine.cpp:
2150         (JSC::Machine::privateExecute): Pass along the prototype.
2151         (JSC::Machine::cti_op_instanceof): ditto
2152         * kjs/JSObject.cpp:
2153         (JSC::JSObject::hasInstance): Expect to get a pre-looked-up prototype.
2154         * kjs/JSObject.h:
2155         * kjs/nodes.cpp:
2156         (JSC::InstanceOfNode::emitCode): Emit a get_by_id of the prototype
2157         property and pass that register to instanceof.
2158         * kjs/nodes.h:
2159
2160 2008-09-14  Gavin Barraclough  <barraclough@apple.com>
2161
2162         Reviewed by Sam Weinig.
2163
2164         Remove unnecessary virtual function call from cti_op_call_JSFunction -
2165         ~5% on richards, ~2.5% on v8-tests, ~0.5% on sunspider.
2166
2167         * VM/Machine.cpp:
2168         (JSC::Machine::cti_op_call_JSFunction):
2169
2170 2008-09-14  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2171
2172         Reviewed by Maciej Stachowiak.
2173
2174         Bug 20827: the 'typeof' operator is slow
2175         <https://bugs.webkit.org/show_bug.cgi?id=20827>
2176
2177         Optimize the 'typeof' operator when its result is compared to a constant
2178         string.
2179
2180         This is a 5.5% speedup on the V8 Earley-Boyer test.
2181
2182         * VM/CTI.cpp:
2183         (JSC::CTI::privateCompileMainPass):
2184         * VM/CodeBlock.cpp:
2185         (JSC::CodeBlock::dump):
2186         * VM/CodeGenerator.cpp:
2187         (JSC::CodeGenerator::emitEqualityOp):
2188         * VM/CodeGenerator.h:
2189         * VM/Machine.cpp:
2190         (JSC::jsIsObjectType):
2191         (JSC::jsIsFunctionType):
2192         (JSC::Machine::privateExecute):
2193         (JSC::Machine::cti_op_is_undefined):
2194         (JSC::Machine::cti_op_is_boolean):
2195         (JSC::Machine::cti_op_is_number):
2196         (JSC::Machine::cti_op_is_string):
2197         (JSC::Machine::cti_op_is_object):
2198         (JSC::Machine::cti_op_is_function):
2199         * VM/Machine.h:
2200         * VM/Opcode.h:
2201         * kjs/nodes.cpp:
2202         (JSC::BinaryOpNode::emitCode):
2203         (JSC::EqualNode::emitCode):
2204         (JSC::StrictEqualNode::emitCode):
2205         * kjs/nodes.h:
2206
2207 2008-09-14  Sam Weinig  <sam@webkit.org>
2208
2209         Reviewed by Cameron Zwarich.
2210
2211         Patch for https://bugs.webkit.org/show_bug.cgi?id=20844
2212         Speed up parseInt for numbers
2213
2214         Sunspider reports this as 1.029x as fast overall and 1.37x as fast on string-unpack-code.
2215         No change on the v8 suite.
2216
2217         * kjs/JSGlobalObjectFunctions.cpp:
2218         (JSC::globalFuncParseInt): Don't convert numbers to strings just to
2219         convert them back to numbers.
2220
2221 2008-09-14  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2222
2223         Reviewed by Oliver Hunt.
2224
2225         Bug 20816: op_lesseq should be optimized
2226         <https://bugs.webkit.org/show_bug.cgi?id=20816>
2227
2228         Add a loop_if_lesseq opcode that is similar to the loop_if_less opcode.
2229
2230         This is a 9.4% speedup on the V8 Crypto benchmark.
2231
2232         * VM/CTI.cpp:
2233         (JSC::CTI::privateCompileMainPass):
2234         (JSC::CTI::privateCompileSlowCases):
2235         * VM/CodeBlock.cpp:
2236         (JSC::CodeBlock::dump):
2237         * VM/CodeGenerator.cpp:
2238         (JSC::CodeGenerator::emitJumpIfTrue):
2239         * VM/Machine.cpp:
2240         (JSC::Machine::privateExecute):
2241         (JSC::Machine::cti_op_loop_if_lesseq):
2242         * VM/Machine.h:
2243         * VM/Opcode.h:
2244
2245 2008-09-14  Sam Weinig  <sam@webkit.org>
2246
2247         Reviewed by Cameron Zwarich.
2248
2249         Cleanup Sampling code.
2250
2251         * VM/CTI.cpp:
2252         (JSC::CTI::emitCall):
2253         (JSC::CTI::privateCompileMainPass):
2254         * VM/CTI.h:
2255         (JSC::CTI::execute):
2256         * VM/SamplingTool.cpp:
2257         (JSC::):
2258         (JSC::SamplingTool::run):
2259         (JSC::SamplingTool::dump):
2260         * VM/SamplingTool.h:
2261         (JSC::SamplingTool::callingHostFunction):
2262
2263 2008-09-13  Oliver Hunt  <oliver@apple.com>
2264
2265         Reviewed by Cameron Zwarich.
2266
2267         Bug 20821: Cache property transitions to speed up object initialization
2268         https://bugs.webkit.org/show_bug.cgi?id=20821
2269
2270         Implement a transition cache to improve the performance of new properties
2271         being added to objects.  This is extremely beneficial in constructors and
2272         shows up as a 34% improvement on access-binary-trees in SunSpider (0.8%
2273         overall)
2274
2275         * VM/CTI.cpp:
2276         (JSC::CTI::privateCompileMainPass):
2277         (JSC::):
2278         (JSC::transitionWillNeedStorageRealloc):
2279         (JSC::CTI::privateCompilePutByIdTransition):
2280         * VM/CTI.h:
2281         (JSC::CTI::compilePutByIdTransition):
2282         * VM/CodeBlock.cpp:
2283         (JSC::printPutByIdOp):
2284         (JSC::CodeBlock::printStructureIDs):
2285         (JSC::CodeBlock::dump):
2286         (JSC::CodeBlock::derefStructureIDs):
2287         (JSC::CodeBlock::refStructureIDs):
2288         * VM/CodeGenerator.cpp:
2289         (JSC::CodeGenerator::emitPutById):
2290         * VM/Machine.cpp:
2291         (JSC::cachePrototypeChain):
2292         (JSC::Machine::tryCachePutByID):
2293         (JSC::Machine::tryCacheGetByID):
2294         (JSC::Machine::privateExecute):
2295         (JSC::Machine::tryCTICachePutByID):
2296         (JSC::Machine::tryCTICacheGetByID):
2297         * VM/Machine.h:
2298         * VM/Opcode.h:
2299         * kjs/JSObject.h:
2300         (JSC::JSObject::putDirect):
2301         (JSC::JSObject::transitionTo):
2302         * kjs/PutPropertySlot.h:
2303         (JSC::PutPropertySlot::PutPropertySlot):
2304         (JSC::PutPropertySlot::wasTransition):
2305         (JSC::PutPropertySlot::setWasTransition):
2306         * kjs/StructureID.cpp:
2307         (JSC::StructureID::transitionTo):
2308         (JSC::StructureIDChain::StructureIDChain):
2309         * kjs/StructureID.h:
2310         (JSC::StructureID::previousID):
2311         (JSC::StructureID::setCachedPrototypeChain):
2312         (JSC::StructureID::cachedPrototypeChain):
2313         (JSC::StructureID::propertyMap):
2314         * masm/X86Assembler.h:
2315         (JSC::X86Assembler::addl_i8m):
2316         (JSC::X86Assembler::subl_i8m):
2317
2318 2008-09-12  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2319
2320         Reviewed by Maciej Stachowiak.
2321
2322         Bug 20819: JSValue::isObject() is slow
2323         <https://bugs.webkit.org/show_bug.cgi?id=20819>
2324
2325         Optimize JSCell::isObject() and JSCell::isString() by making them
2326         non-virtual calls that rely on the StructureID type information.
2327
2328         This is a 0.7% speedup on SunSpider and a 1.0% speedup on the V8
2329         benchmark suite.
2330
2331         * JavaScriptCore.exp:
2332         * kjs/JSCell.cpp:
2333         * kjs/JSCell.h:
2334         (JSC::JSCell::isObject):
2335         (JSC::JSCell::isString):
2336         * kjs/JSObject.cpp:
2337         * kjs/JSObject.h:
2338         * kjs/JSString.cpp:
2339         * kjs/JSString.h:
2340         (JSC::JSString::JSString):
2341         * kjs/StructureID.h:
2342         (JSC::StructureID::type):
2343
2344 2008-09-11  Stephanie Lewis  <slewis@apple.com>
2345
2346         Reviewed by Oliver Hunt.
2347
2348         Turn off PGO Optimization on CTI.cpp -> <rdar://problem/6207709>.  Fixes
2349         crash on CNN and on Dromaeo.
2350         Fix Missing close tag in vcproj. 
2351
2352         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2353
2354 2008-09-11  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2355
2356         Not reviewed.
2357
2358         Correct an SVN problem with the last commit and actually add the new
2359         files.
2360
2361         * wrec/CharacterClassConstructor.cpp: Added.
2362         (JSC::):
2363         (JSC::getCharacterClassNewline):
2364         (JSC::getCharacterClassDigits):
2365         (JSC::getCharacterClassSpaces):
2366         (JSC::getCharacterClassWordchar):
2367         (JSC::getCharacterClassNondigits):
2368         (JSC::getCharacterClassNonspaces):
2369         (JSC::getCharacterClassNonwordchar):
2370         (JSC::CharacterClassConstructor::addSorted):
2371         (JSC::CharacterClassConstructor::addSortedRange):
2372         (JSC::CharacterClassConstructor::put):
2373         (JSC::CharacterClassConstructor::flush):
2374         (JSC::CharacterClassConstructor::append):
2375         * wrec/CharacterClassConstructor.h: Added.
2376         (JSC::CharacterClassConstructor::CharacterClassConstructor):
2377         (JSC::CharacterClassConstructor::isUpsideDown):
2378         (JSC::CharacterClassConstructor::charClass):
2379
2380 2008-09-11  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2381
2382         Reviewed by Maciej Stachowiak.
2383
2384         Bug 20788: Split CharacterClassConstructor into its own file
2385         <https://bugs.webkit.org/show_bug.cgi?id=20788>
2386
2387         Split CharacterClassConstructor into its own file and clean up some
2388         style issues.
2389
2390         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2391         * JavaScriptCore.xcodeproj/project.pbxproj:
2392         * wrec/CharacterClassConstructor.cpp: Added.
2393         (JSC::):
2394         (JSC::getCharacterClassNewline):
2395         (JSC::getCharacterClassDigits):
2396         (JSC::getCharacterClassSpaces):
2397         (JSC::getCharacterClassWordchar):
2398         (JSC::getCharacterClassNondigits):
2399         (JSC::getCharacterClassNonspaces):
2400         (JSC::getCharacterClassNonwordchar):
2401         (JSC::CharacterClassConstructor::addSorted):
2402         (JSC::CharacterClassConstructor::addSortedRange):
2403         (JSC::CharacterClassConstructor::put):
2404         (JSC::CharacterClassConstructor::flush):
2405         (JSC::CharacterClassConstructor::append):
2406         * wrec/CharacterClassConstructor.h: Added.
2407         (JSC::CharacterClassConstructor::CharacterClassConstructor):
2408         (JSC::CharacterClassConstructor::isUpsideDown):
2409         (JSC::CharacterClassConstructor::charClass):
2410         * wrec/WREC.cpp:
2411         (JSC::WRECParser::parseCharacterClass):
2412
2413 2008-09-10  Simon Hausmann  <hausmann@webkit.org>
2414
2415         Not reviewed but trivial one-liner for yet unused macro.
2416
2417         Changed PLATFORM(WINCE) to PLATFORM(WIN_CE) as requested by Mark.
2418
2419         (part of https://bugs.webkit.org/show_bug.cgi?id=20746)
2420
2421         * wtf/Platform.h:
2422
2423 2008-09-10  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2424
2425         Rubber-stamped by Oliver Hunt.
2426
2427         Fix a typo by renaming the overloaded orl_rr that takes an immediate to
2428         orl_i32r.
2429
2430         * VM/CTI.cpp:
2431         (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
2432         * masm/X86Assembler.h:
2433         (JSC::X86Assembler::orl_i32r):
2434         * wrec/WREC.cpp:
2435         (JSC::WRECGenerator::generatePatternCharacter):
2436         (JSC::WRECGenerator::generateCharacterClassInverted):
2437
2438 2008-09-10  Sam Weinig  <sam@webkit.org>
2439
2440         Reviewed by Geoff Garen.
2441
2442         Add inline property storage for JSObject.
2443
2444         1.2% progression on Sunspider. .5% progression on the v8 test suite.
2445
2446         * JavaScriptCore.exp:
2447         * VM/CTI.cpp:
2448         (JSC::CTI::privateCompileGetByIdProto):
2449         (JSC::CTI::privateCompileGetByIdChain):
2450         * kjs/JSObject.cpp:
2451         (JSC::JSObject::mark): There is no reason to check storageSize now that
2452         we start from 0.
2453         (JSC::JSObject::allocatePropertyStorage): Allocates/reallocates heap storage.
2454         * kjs/JSObject.h:
2455         (JSC::JSObject::offsetForLocation): m_propertyStorage is not an OwnArrayPtr
2456         now so there is no reason to .get()
2457         (JSC::JSObject::usingInlineStorage):
2458         (JSC::JSObject::JSObject): Start with m_propertyStorage pointing to the
2459         inline storage.
2460         (JSC::JSObject::~JSObject): Free the heap storage if not using the inline
2461         storage.
2462         (JSC::JSObject::putDirect): Switch to the heap storage only when we know
2463         we know that we are about to add a property that will overflow the inline
2464         storage.
2465         * kjs/PropertyMap.cpp:
2466         (JSC::PropertyMap::createTable): Don't allocate the propertyStorage, that is
2467         now handled by JSObject.
2468         (JSC::PropertyMap::rehash): PropertyStorage is not a OwnArrayPtr anymore.
2469         * kjs/PropertyMap.h:
2470         (JSC::PropertyMap::storageSize): Rename from markingCount.
2471         * kjs/StructureID.cpp:
2472         (JSC::StructureID::addPropertyTransition): Don't resize the property storage
2473         if we are using inline storage.
2474         * kjs/StructureID.h:
2475
2476 2008-09-10  Oliver Hunt  <oliver@apple.com>
2477
2478         Reviewed by Geoff Garen.
2479
2480         Inline immediate number version of op_mul.
2481
2482         Renamed mull_rr to imull_rr as that's what it's 
2483         actually doing, and added imull_i32r for the constant
2484         case immediate multiply.
2485
2486         1.1% improvement to SunSpider.
2487
2488         * VM/CTI.cpp:
2489         (JSC::CTI::privateCompileMainPass):
2490         (JSC::CTI::privateCompileSlowCases):
2491         * masm/X86Assembler.h:
2492         (JSC::X86Assembler::):
2493         (JSC::X86Assembler::imull_rr):
2494         (JSC::X86Assembler::imull_i32r):
2495
2496 2008-09-10  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2497
2498         Not reviewed.
2499
2500         Mac build fix.
2501
2502         * JavaScriptCore.xcodeproj/project.pbxproj:
2503
2504 2008-09-09  Oliver Hunt  <oliver@apple.com>
2505
2506         Reviewed by Maciej Stachowiak.
2507
2508         Add optimised access to known properties on the global object.
2509
2510         Improve cross scope access to the global object by emitting
2511         code to access it directly rather than by walking the scope chain.
2512
2513         This is a 0.8% win in SunSpider and a 1.7% win in the v8 benchmarks.
2514
2515         * VM/CTI.cpp:
2516         (JSC::CTI::privateCompileMainPass):
2517         (JSC::CTI::emitGetVariableObjectRegister):
2518         (JSC::CTI::emitPutVariableObjectRegister):
2519         * VM/CTI.h:
2520         * VM/CodeBlock.cpp:
2521         (JSC::CodeBlock::dump):
2522         * VM/CodeGenerator.cpp:
2523         (JSC::CodeGenerator::findScopedProperty):
2524         (JSC::CodeGenerator::emitResolve):
2525         (JSC::CodeGenerator::emitGetScopedVar):
2526         (JSC::CodeGenerator::emitPutScopedVar):
2527         * VM/CodeGenerator.h:
2528         * VM/Machine.cpp:
2529         (JSC::Machine::privateExecute):
2530         * VM/Opcode.h:
2531         * kjs/nodes.cpp:
2532         (JSC::FunctionCallResolveNode::emitCode):
2533         (JSC::PostfixResolveNode::emitCode):
2534         (JSC::PrefixResolveNode::emitCode):
2535         (JSC::ReadModifyResolveNode::emitCode):
2536         (JSC::AssignResolveNode::emitCode):
2537
2538 2008-09-10  Maciej Stachowiak  <mjs@apple.com>
2539
2540         Reviewed by Oliver.
2541         
2542         - enable polymorphic inline caching of properties of primitives
2543         
2544         1.012x speedup on SunSpider.
2545
2546         We create special structure IDs for JSString and
2547         JSNumberCell. Unlike normal structure IDs, these cannot hold the
2548         true prototype. Due to JS autoboxing semantics, the prototype used
2549         when looking up string or number properties depends on the lexical
2550         global object of the call site, not the creation site. Thus we
2551         enable StructureIDs to handle this quirk for primitives.
2552         
2553         Everything else should be straightforward.
2554         
2555         * VM/CTI.cpp:
2556         (JSC::CTI::privateCompileGetByIdProto):
2557         (JSC::CTI::privateCompileGetByIdChain):
2558         * VM/CTI.h:
2559         (JSC::CTI::compileGetByIdProto):
2560         (JSC::CTI::compileGetByIdChain):
2561         * VM/JSPropertyNameIterator.h:
2562         (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
2563         * VM/Machine.cpp:
2564         (JSC::Machine::Machine):
2565         (JSC::cachePrototypeChain):
2566         (JSC::Machine::tryCachePutByID):
2567         (JSC::Machine::tryCacheGetByID):
2568         (JSC::Machine::privateExecute):
2569         (JSC::Machine::tryCTICachePutByID):
2570         (JSC::Machine::tryCTICacheGetByID):
2571         * kjs/GetterSetter.h:
2572         (JSC::GetterSetter::GetterSetter):
2573         * kjs/JSCell.h:
2574         * kjs/JSGlobalData.cpp:
2575         (JSC::JSGlobalData::JSGlobalData):
2576         * kjs/JSGlobalData.h:
2577         * kjs/JSGlobalObject.h:
2578         (JSC::StructureID::prototypeForLookup):
2579         * kjs/JSNumberCell.h:
2580         (JSC::JSNumberCell::JSNumberCell):
2581         (JSC::jsNumberCell):
2582         * kjs/JSObject.h:
2583         (JSC::JSObject::prototype):
2584         * kjs/JSString.cpp:
2585         (JSC::jsString):
2586         (JSC::jsSubstring):
2587         (JSC::jsOwnedString):
2588         * kjs/JSString.h:
2589         (JSC::JSString::JSString):
2590         (JSC::JSString::):
2591         (JSC::jsSingleCharacterString):
2592         (JSC::jsSingleCharacterSubstring):
2593         (JSC::jsNontrivialString):
2594         * kjs/SmallStrings.cpp:
2595         (JSC::SmallStrings::createEmptyString):
2596         (JSC::SmallStrings::createSingleCharacterString):
2597         * kjs/StructureID.cpp:
2598         (JSC::StructureID::StructureID):
2599         (JSC::StructureID::addPropertyTransition):
2600         (JSC::StructureID::getterSetterTransition):
2601         (JSC::StructureIDChain::StructureIDChain):
2602         * kjs/StructureID.h:
2603         (JSC::StructureID::create):
2604         (JSC::StructureID::storedPrototype):
2605
2606 2008-09-09  Joerg Bornemann  <joerg.bornemann@trolltech.com>
2607
2608         Reviewed by Sam Weinig.
2609
2610         https://bugs.webkit.org/show_bug.cgi?id=20746
2611
2612         Added WINCE platform macro.
2613
2614         * wtf/Platform.h:
2615
2616 2008-09-09  Sam Weinig  <sam@webkit.org>
2617
2618         Reviewed by Mark Rowe.
2619
2620         Remove unnecessary override of getOffset.
2621
2622         Sunspider reports this as a .6% progression.
2623
2624         * JavaScriptCore.exp:
2625         * kjs/JSObject.h:
2626         (JSC::JSObject::getDirectLocation):
2627         (JSC::JSObject::getOwnPropertySlotForWrite):
2628         (JSC::JSObject::putDirect):
2629         * kjs/PropertyMap.cpp:
2630         * kjs/PropertyMap.h:
2631
2632 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2633
2634         Reviewed by Maciej Stachowiak.
2635
2636         Bug 20759: Remove MacroAssembler
2637         <https://bugs.webkit.org/show_bug.cgi?id=20759>
2638
2639         Remove MacroAssembler and move its functionality to X86Assembler.
2640
2641         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2642         * JavaScriptCore.xcodeproj/project.pbxproj:
2643         * VM/CTI.cpp:
2644         (JSC::CTI::emitGetArg):
2645         (JSC::CTI::emitGetPutArg):
2646         (JSC::CTI::emitPutArg):
2647         (JSC::CTI::emitPutCTIParam):
2648         (JSC::CTI::emitGetCTIParam):
2649         (JSC::CTI::emitPutToCallFrameHeader):
2650         (JSC::CTI::emitGetFromCallFrameHeader):
2651         (JSC::CTI::emitPutResult):
2652         (JSC::CTI::emitDebugExceptionCheck):
2653         (JSC::CTI::emitJumpSlowCaseIfNotImm):
2654         (JSC::CTI::emitJumpSlowCaseIfNotImms):
2655         (JSC::CTI::emitFastArithDeTagImmediate):
2656         (JSC::CTI::emitFastArithReTagImmediate):
2657         (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
2658         (JSC::CTI::emitFastArithImmToInt):
2659         (JSC::CTI::emitFastArithIntToImmOrSlowCase):
2660         (JSC::CTI::emitFastArithIntToImmNoCheck):
2661         (JSC::CTI::compileOpCall):
2662         (JSC::CTI::emitSlowScriptCheck):
2663         (JSC::CTI::privateCompileMainPass):
2664         (JSC::CTI::privateCompileSlowCases):
2665         (JSC::CTI::privateCompile):
2666         (JSC::CTI::privateCompileGetByIdSelf):
2667         (JSC::CTI::privateCompileGetByIdProto):
2668         (JSC::CTI::privateCompileGetByIdChain):
2669         (JSC::CTI::privateCompilePutByIdReplace):
2670         (JSC::CTI::privateArrayLengthTrampoline):
2671         (JSC::CTI::privateStringLengthTrampoline):
2672         (JSC::CTI::compileRegExp):
2673         * VM/CTI.h:
2674         (JSC::CallRecord::CallRecord):
2675         (JSC::JmpTable::JmpTable):
2676         (JSC::SlowCaseEntry::SlowCaseEntry):
2677         (JSC::CTI::JSRInfo::JSRInfo):
2678         * masm/MacroAssembler.h: Removed.
2679         * masm/MacroAssemblerWin.cpp: Removed.
2680         * masm/X86Assembler.h:
2681         (JSC::X86Assembler::emitConvertToFastCall):
2682         (JSC::X86Assembler::emitRestoreArgumentReference):
2683         * wrec/WREC.h:
2684         (JSC::WRECGenerator::WRECGenerator):
2685         (JSC::WRECParser::WRECParser):
2686
2687 2008-09-09  Sam Weinig  <sam@webkit.org>
2688
2689         Reviewed by Cameron Zwarich.
2690
2691         Don't waste the first item in the PropertyStorage.
2692
2693         - Fix typo (makingCount -> markingCount)
2694         - Remove undefined method declaration.
2695
2696         No change on Sunspider.
2697
2698         * kjs/JSObject.cpp:
2699         (JSC::JSObject::mark):
2700         * kjs/PropertyMap.cpp:
2701         (JSC::PropertyMap::put):
2702         (JSC::PropertyMap::remove):
2703         (JSC::PropertyMap::getOffset):
2704         (JSC::PropertyMap::insert):
2705         (JSC::PropertyMap::rehash):
2706         (JSC::PropertyMap::resizePropertyStorage):
2707         (JSC::PropertyMap::checkConsistency):
2708         * kjs/PropertyMap.h:
2709         (JSC::PropertyMap::markingCount): Fix typo.
2710
2711 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2712
2713         Not reviewed.
2714
2715         Speculative Windows build fix.
2716
2717         * masm/MacroAssemblerWin.cpp:
2718         (JSC::MacroAssembler::emitConvertToFastCall):
2719         (JSC::MacroAssembler::emitRestoreArgumentReference):
2720
2721 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2722
2723         Reviewed by Maciej Stachowiak.
2724
2725         Bug 20755: Create an X86 namespace for register names and other things
2726         <https://bugs.webkit.org/show_bug.cgi?id=20755>
2727
2728         Create an X86 namespace to put X86 register names. Perhaps I will move
2729         opcode names here later as well.
2730
2731         * VM/CTI.cpp:
2732         (JSC::CTI::emitGetArg):
2733         (JSC::CTI::emitGetPutArg):
2734         (JSC::CTI::emitPutArg):
2735         (JSC::CTI::emitPutArgConstant):
2736         (JSC::CTI::emitPutCTIParam):
2737         (JSC::CTI::emitGetCTIParam):
2738         (JSC::CTI::emitPutToCallFrameHeader):
2739         (JSC::CTI::emitGetFromCallFrameHeader):
2740         (JSC::CTI::emitPutResult):
2741         (JSC::CTI::emitDebugExceptionCheck):
2742         (JSC::CTI::emitJumpSlowCaseIfNotImms):
2743         (JSC::CTI::compileOpCall):
2744         (JSC::CTI::emitSlowScriptCheck):
2745         (JSC::CTI::privateCompileMainPass):
2746         (JSC::CTI::privateCompileSlowCases):
2747         (JSC::CTI::privateCompile):
2748         (JSC::CTI::privateCompileGetByIdSelf):
2749         (JSC::CTI::privateCompileGetByIdProto):
2750         (JSC::CTI::privateCompileGetByIdChain):
2751         (JSC::CTI::privateCompilePutByIdReplace):
2752         (JSC::CTI::privateArrayLengthTrampoline):
2753         (JSC::CTI::privateStringLengthTrampoline):
2754         (JSC::CTI::compileRegExp):
2755         * VM/CTI.h:
2756         * masm/X86Assembler.h:
2757         (JSC::X86::):
2758         (JSC::X86Assembler::emitModRm_rm):
2759         (JSC::X86Assembler::emitModRm_rm_Unchecked):
2760         (JSC::X86Assembler::emitModRm_rmsib):
2761         * wrec/WREC.cpp:
2762         (JSC::WRECGenerator::generateNonGreedyQuantifier):
2763         (JSC::WRECGenerator::generateGreedyQuantifier):
2764         (JSC::WRECGenerator::generateParentheses):
2765         (JSC::WRECGenerator::generateBackreference):
2766         (JSC::WRECGenerator::gernerateDisjunction):
2767         * wrec/WREC.h:
2768
2769 2008-09-09  Sam Weinig  <sam@webkit.org>
2770
2771         Reviewed by Geoffrey Garen.
2772
2773         Remove unnecessary friend declaration.
2774
2775         * kjs/PropertyMap.h:
2776
2777 2008-09-09  Sam Weinig  <sam@webkit.org>
2778
2779         Reviewed by Geoffrey Garen.
2780
2781         Replace uses of PropertyMap::get and PropertyMap::getLocation with
2782         PropertyMap::getOffset.
2783
2784         Sunspider reports this as a .6% improvement.
2785
2786         * JavaScriptCore.exp:
2787         * kjs/JSObject.cpp:
2788         (JSC::JSObject::put):
2789         (JSC::JSObject::deleteProperty):
2790         (JSC::JSObject::getPropertyAttributes):
2791         * kjs/JSObject.h:
2792         (JSC::JSObject::getDirect):
2793         (JSC::JSObject::getDirectLocation):
2794         (JSC::JSObject::locationForOffset):
2795         * kjs/PropertyMap.cpp:
2796         (JSC::PropertyMap::remove):
2797         (JSC::PropertyMap::getOffset):
2798         * kjs/PropertyMap.h:
2799
2800 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2801
2802         Reviewed by Sam Weinig.
2803
2804         Bug 20754: Remove emit prefix from assembler opcode methods
2805         <https://bugs.webkit.org/show_bug.cgi?id=20754>
2806
2807         * VM/CTI.cpp:
2808         (JSC::CTI::emitGetArg):
2809         (JSC::CTI::emitGetPutArg):
2810         (JSC::CTI::emitPutArg):
2811         (JSC::CTI::emitPutArgConstant):
2812         (JSC::CTI::emitPutCTIParam):
2813         (JSC::CTI::emitGetCTIParam):
2814         (JSC::CTI::emitPutToCallFrameHeader):
2815         (JSC::CTI::emitGetFromCallFrameHeader):
2816         (JSC::CTI::emitPutResult):
2817         (JSC::CTI::emitDebugExceptionCheck):
2818         (JSC::CTI::emitCall):
2819         (JSC::CTI::emitJumpSlowCaseIfNotImm):
2820         (JSC::CTI::emitJumpSlowCaseIfNotImms):
2821         (JSC::CTI::emitFastArithDeTagImmediate):
2822         (JSC::CTI::emitFastArithReTagImmediate):
2823         (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
2824         (JSC::CTI::emitFastArithImmToInt):
2825         (JSC::CTI::emitFastArithIntToImmOrSlowCase):
2826         (JSC::CTI::emitFastArithIntToImmNoCheck):
2827         (JSC::CTI::compileOpCall):
2828         (JSC::CTI::emitSlowScriptCheck):
2829         (JSC::CTI::privateCompileMainPass):
2830         (JSC::CTI::privateCompileSlowCases):
2831         (JSC::CTI::privateCompile):
2832         (JSC::CTI::privateCompileGetByIdSelf):
2833         (JSC::CTI::privateCompileGetByIdProto):
2834         (JSC::CTI::privateCompileGetByIdChain):
2835         (JSC::CTI::privateCompilePutByIdReplace):
2836         (JSC::CTI::privateArrayLengthTrampoline):
2837         (JSC::CTI::privateStringLengthTrampoline):
2838         (JSC::CTI::compileRegExp):
2839         * masm/MacroAssemblerWin.cpp:
2840         (JSC::MacroAssembler::emitConvertToFastCall):
2841         (JSC::MacroAssembler::emitRestoreArgumentReference):
2842         * masm/X86Assembler.h:
2843         (JSC::X86Assembler::pushl_r):
2844         (JSC::X86Assembler::pushl_m):
2845         (JSC::X86Assembler::popl_r):
2846         (JSC::X86Assembler::popl_m):
2847         (JSC::X86Assembler::movl_rr):
2848         (JSC::X86Assembler::addl_rr):
2849         (JSC::X86Assembler::addl_i8r):
2850         (JSC::X86Assembler::addl_i32r):
2851         (JSC::X86Assembler::addl_mr):
2852         (JSC::X86Assembler::andl_rr):
2853         (JSC::X86Assembler::andl_i32r):
2854         (JSC::X86Assembler::cmpl_i8r):
2855         (JSC::X86Assembler::cmpl_rr):
2856         (JSC::X86Assembler::cmpl_rm):
2857         (JSC::X86Assembler::cmpl_i32r):
2858         (JSC::X86Assembler::cmpl_i32m):
2859         (JSC::X86Assembler::cmpw_rm):
2860         (JSC::X86Assembler::orl_rr):
2861         (JSC::X86Assembler::subl_rr):
2862         (JSC::X86Assembler::subl_i8r):
2863         (JSC::X86Assembler::subl_i32r):
2864         (JSC::X86Assembler::subl_mr):
2865         (JSC::X86Assembler::testl_i32r):
2866         (JSC::X86Assembler::testl_rr):
2867         (JSC::X86Assembler::xorl_i8r):
2868         (JSC::X86Assembler::xorl_rr):
2869         (JSC::X86Assembler::sarl_i8r):
2870         (JSC::X86Assembler::sarl_CLr):
2871         (JSC::X86Assembler::shl_i8r):
2872         (JSC::X86Assembler::shll_CLr):
2873         (JSC::X86Assembler::mull_rr):
2874         (JSC::X86Assembler::idivl_r):
2875         (JSC::X86Assembler::cdq):
2876         (JSC::X86Assembler::movl_mr):
2877         (JSC::X86Assembler::movzwl_mr):
2878         (JSC::X86Assembler::movl_rm):
2879         (JSC::X86Assembler::movl_i32r):
2880         (JSC::X86Assembler::movl_i32m):
2881         (JSC::X86Assembler::leal_mr):
2882         (JSC::X86Assembler::ret):
2883         (JSC::X86Assembler::jmp_r):
2884         (JSC::X86Assembler::jmp_m):
2885         (JSC::X86Assembler::call_r):
2886         * wrec/WREC.cpp:
2887         (JSC::WRECGenerator::generateBacktrack1):
2888         (JSC::WRECGenerator::generateBacktrackBackreference):
2889         (JSC::WRECGenerator::generateBackreferenceQuantifier):
2890         (JSC::WRECGenerator::generateNonGreedyQuantifier):
2891         (JSC::WRECGenerator::generateGreedyQuantifier):
2892         (JSC::WRECGenerator::generatePatternCharacter):
2893         (JSC::WRECGenerator::generateCharacterClassInvertedRange):
2894         (JSC::WRECGenerator::generateCharacterClassInverted):
2895         (JSC::WRECGenerator::generateCharacterClass):
2896         (JSC::WRECGenerator::generateParentheses):
2897         (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
2898         (JSC::WRECGenerator::generateAssertionBOL):
2899         (JSC::WRECGenerator::generateAssertionEOL):
2900         (JSC::WRECGenerator::generateAssertionWordBoundary):
2901         (JSC::WRECGenerator::generateBackreference):
2902         (JSC::WRECGenerator::gernerateDisjunction):
2903
2904 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2905
2906         Reviewed by Maciej Stachowiak.
2907
2908         Clean up the WREC code some more.
2909
2910         * VM/CTI.cpp:
2911         (JSC::CTI::compileRegExp):
2912         * wrec/WREC.cpp:
2913         (JSC::getCharacterClassNewline):
2914         (JSC::getCharacterClassDigits):
2915         (JSC::getCharacterClassSpaces):
2916         (JSC::getCharacterClassWordchar):
2917         (JSC::getCharacterClassNondigits):
2918         (JSC::getCharacterClassNonspaces):
2919         (JSC::getCharacterClassNonwordchar):
2920         (JSC::WRECGenerator::generateBacktrack1):
2921         (JSC::WRECGenerator::generateBacktrackBackreference):
2922         (JSC::WRECGenerator::generateBackreferenceQuantifier):
2923         (JSC::WRECGenerator::generateNonGreedyQuantifier):
2924         (JSC::WRECGenerator::generateGreedyQuantifier):
2925         (JSC::WRECGenerator::generatePatternCharacter):
2926         (JSC::WRECGenerator::generateCharacterClassInvertedRange):
2927         (JSC::WRECGenerator::generateCharacterClassInverted):
2928         (JSC::WRECGenerator::generateCharacterClass):
2929         (JSC::WRECGenerator::generateParentheses):
2930         (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
2931         (JSC::WRECGenerator::generateAssertionBOL):
2932         (JSC::WRECGenerator::generateAssertionEOL):
2933         (JSC::WRECGenerator::generateAssertionWordBoundary):
2934         (JSC::WRECGenerator::generateBackreference):
2935         (JSC::WRECGenerator::gernerateDisjunction):
2936         (JSC::WRECParser::parseCharacterClass):
2937         (JSC::WRECParser::parseEscape):
2938         (JSC::WRECParser::parseTerm):
2939         * wrec/WREC.h:
2940
2941 2008-09-09  Mark Rowe  <mrowe@apple.com>
2942
2943         Build fix, rubber-stamped by Anders Carlsson.
2944
2945         Silence spurious build warnings about missing format attributes on functions in Assertions.cpp.
2946
2947         * JavaScriptCore.xcodeproj/project.pbxproj:
2948
2949 2008-09-09  Mark Rowe  <mrowe@apple.com>
2950
2951         Rubber-stamped by Oliver Hunt.
2952
2953         Fix builds using the "debug" variant.
2954
2955         This reverts r36130 and tweaks Identifier to export the same symbols for Debug
2956         and Release configurations.
2957
2958         * Configurations/JavaScriptCore.xcconfig:
2959         * DerivedSources.make:
2960         * JavaScriptCore.Debug.exp: Removed.
2961         * JavaScriptCore.base.exp: Removed.
2962         * JavaScriptCore.exp: Added.
2963         * JavaScriptCore.xcodeproj/project.pbxproj:
2964         * kjs/identifier.cpp:
2965         (JSC::Identifier::addSlowCase): #ifdef the call to checkSameIdentifierTable so that
2966         there is no overhead in Release builds.
2967         (JSC::Identifier::checkSameIdentifierTable): Add empty functions for Release builds.
2968         * kjs/identifier.h:
2969         (JSC::Identifier::add): #ifdef the calls to checkSameIdentifierTable so that there is
2970         no overhead in Release builds, and remove the inline definitions of checkSameIdentifierTable.
2971
2972 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2973
2974         Reviewed by Maciej Stachowiak.
2975
2976         Clean up WREC a bit to bring it closer to our coding style guidelines.
2977
2978         * wrec/WREC.cpp:
2979         (JSC::):
2980         (JSC::getCharacterClass_newline):
2981         (JSC::getCharacterClass_d):
2982         (JSC::getCharacterClass_s):
2983         (JSC::getCharacterClass_w):
2984         (JSC::getCharacterClass_D):
2985         (JSC::getCharacterClass_S):
2986         (JSC::getCharacterClass_W):
2987         (JSC::CharacterClassConstructor::append):
2988         (JSC::WRECGenerator::generateNonGreedyQuantifier):
2989         (JSC::WRECGenerator::generateGreedyQuantifier):
2990         (JSC::WRECGenerator::generateCharacterClassInverted):
2991         (JSC::WRECParser::parseQuantifier):
2992         (JSC::WRECParser::parsePatternCharacterQualifier):
2993         (JSC::WRECParser::parseCharacterClassQuantifier):
2994         (JSC::WRECParser::parseBackreferenceQuantifier):
2995         * wrec/WREC.h:
2996         (JSC::Quantifier::):
2997         (JSC::Quantifier::Quantifier):
2998
2999 2008-09-09  Jungshik Shin  <jungshik.shin@gmail.com>
3000
3001         Reviewed by Alexey Proskuryakov.
3002
3003         Try MIME charset names before trying IANA names 
3004         ( https://bugs.webkit.org/show_bug.cgi?id=17537 )
3005
3006         * wtf/StringExtras.h: (strcasecmp): Added.
3007
3008 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3009
3010         Reviewed by Mark Rowe.
3011
3012         Bug 20719: REGRESSION (r36135-36244): Hangs, then crashes after several seconds
3013         <https://bugs.webkit.org/show_bug.cgi?id=20719>
3014         <rdar://problem/6205787>
3015
3016         Fix a typo in the case-insensitive matching of character patterns.
3017
3018         * wrec/WREC.cpp:
3019         (JSC::WRECGenerator::generatePatternCharacter):
3020
3021 2008-09-09  Maciej Stachowiak  <mjs@apple.com>
3022
3023         Reviewed by Sam Weinig.
3024         
3025         - allow polymorphic inline cache to handle Math object functions and possibly other similar things
3026         
3027         1.012x speedup on SunSpider.
3028
3029         * kjs/MathObject.cpp:
3030         (JSC::MathObject::getOwnPropertySlot):
3031         * kjs/lookup.cpp:
3032         (JSC::setUpStaticFunctionSlot):
3033         * kjs/lookup.h:
3034         (JSC::getStaticPropertySlot):
3035
3036 2008-09-08  Sam Weinig  <sam@webkit.org>
3037
3038         Reviewed by Maciej Stachowiak and Oliver Hunt.
3039
3040         Split storage of properties out of the PropertyMap and into the JSObject
3041         to allow sharing PropertyMap on the StructureID.  In order to get this
3042         function correctly, the StructureID's transition mappings were changed to
3043         transition based on property name and attribute pairs, instead of just
3044         property name.
3045
3046         - Removes the single property optimization now that the PropertyMap is shared.
3047           This will be replaced by in-lining some values on the JSObject.
3048
3049         This is a wash on Sunspider and a 6.7% win on the v8 test suite.
3050
3051         * JavaScriptCore.base.exp:
3052         * VM/CTI.cpp:
3053         (JSC::CTI::privateCompileGetByIdSelf): Get the storage directly off the JSObject.
3054         (JSC::CTI::privateCompileGetByIdProto): Ditto.
3055         (JSC::CTI::privateCompileGetByIdChain): Ditto.
3056         (JSC::CTI::privateCompilePutByIdReplace): Ditto.
3057         * kjs/JSObject.cpp:
3058         (JSC::JSObject::mark): Mark the PropertyStorage.
3059         (JSC::JSObject::put): Update to get the propertyMap of the StructureID.
3060         (JSC::JSObject::deleteProperty): Ditto.
3061         (JSC::JSObject::defineGetter): Return early if the property is already a getter/setter.
3062         (JSC::JSObject::defineSetter): Ditto.
3063         (JSC::JSObject::getPropertyAttributes): Update to get the propertyMap of the StructureID
3064         (JSC::JSObject::getPropertyNames): Ditto.
3065         (JSC::JSObject::removeDirect): Ditto.
3066         * kjs/JSObject.h: Remove PropertyMap and add PropertyStorage.
3067         (JSC::JSObject::propertyStorage): return the PropertyStorage.
3068         (JSC::JSObject::getDirect): Update to get the propertyMap of the StructureID.
3069         (JSC::JSObject::getDirectLocation): Ditto.
3070         (JSC::JSObject::offsetForLocation): Compute location directly.
3071         (JSC::JSObject::hasCustomProperties): Update to get the propertyMap of the StructureID.
3072         (JSC::JSObject::hasGetterSetterProperties): Ditto.
3073         (JSC::JSObject::getDirectOffset): Get by indexing into PropertyStorage.
3074         (JSC::JSObject::putDirectOffset): Put by indexing into PropertyStorage.
3075         (JSC::JSObject::getOwnPropertySlotForWrite): Update to get the propertyMap of the StructureID.
3076         (JSC::JSObject::getOwnPropertySlot): Ditto.
3077         (JSC::JSObject::putDirect): Move putting into the StructureID unless the property already exists.
3078         * kjs/PropertyMap.cpp: Use the propertyStorage as the storage for the JSValues.
3079         (JSC::PropertyMap::checkConsistency): 
3080         (JSC::PropertyMap::operator=):
3081         (JSC::PropertyMap::~PropertyMap):
3082         (JSC::PropertyMap::get):
3083         (JSC::PropertyMap::getLocation):
3084         (JSC::PropertyMap::put):
3085         (JSC::PropertyMap::getOffset):
3086         (JSC::PropertyMap::insert):
3087         (JSC::PropertyMap::expand):
3088         (JSC::PropertyMap::rehash):
3089         (JSC::PropertyMap::createTable):
3090         (JSC::PropertyMap::resizePropertyStorage): Resize the storage to match the size of the map
3091         (JSC::PropertyMap::remove):
3092         (JSC::PropertyMap::getEnumerablePropertyNames):
3093         * kjs/PropertyMap.h: 
3094         (JSC::PropertyMapEntry::PropertyMapEntry):
3095         (JSC::PropertyMap::isEmpty):
3096         (JSC::PropertyMap::size):
3097         (JSC::PropertyMap::makingCount):
3098         (JSC::PropertyMap::PropertyMap):
3099
3100         * kjs/StructureID.cpp: 
3101         (JSC::StructureID::addPropertyTransition): Transitions now are based off the property name
3102         and attributes. 
3103         (JSC::StructureID::toDictionaryTransition): Copy the map.
3104         (JSC::StructureID::changePrototypeTransition): Copy the map.
3105         (JSC::StructureID::getterSetterTransition): Copy the map.
3106         (JSC::StructureID::~StructureID): 
3107         * kjs/StructureID.h:
3108         (JSC::TransitionTableHash::hash): Custom hash for transition map.
3109         (JSC::TransitionTableHash::equal): Ditto.
3110         (JSC::TransitionTableHashTraits::emptyValue): Custom traits for transition map
3111         (JSC::TransitionTableHashTraits::constructDeletedValue): Ditto.
3112         (JSC::TransitionTableHashTraits::isDeletedValue): Ditto.
3113         (JSC::StructureID::propertyMap): Added.
3114
3115 2008-09-08  Oliver Hunt  <oliver@apple.com>
3116
3117         Reviewed by Mark Rowe.
3118
3119         Bug 20694: Slow Script error pops up when running Dromaeo tests
3120
3121         Correct error in timeout logic where execution tick count would
3122         be reset to incorrect value due to incorrect offset and indirection.
3123         Codegen for the slow script dialog was factored out into a separate
3124         method (emitSlowScriptCheck) rather than having multiple copies of
3125         the same code.  Also added calls to generate slow script checks
3126         for loop_if_less and loop_if_true opcodes.
3127
3128         * VM/CTI.cpp:
3129         (JSC::CTI::emitSlowScriptCheck):
3130         (JSC::CTI::privateCompileMainPass):
3131         (JSC::CTI::privateCompileSlowCases):
3132         * VM/CTI.h:
3133
3134 2008-09-08  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3135
3136         Reviewed by Maciej Stachowiak.
3137
3138         Remove references to the removed WRECompiler class.
3139
3140         * VM/Machine.h:
3141         * wrec/WREC.h:
3142
3143 2008-09-08  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3144
3145         Rubber-stamped by Mark Rowe.
3146
3147         Fix the build with CTI enabled but WREC disabled.
3148
3149         * VM/CTI.cpp:
3150         * VM/CTI.h:
3151
3152 2008-09-08  Dan Bernstein  <mitz@apple.com>
3153
3154         - build fix
3155
3156         * kjs/nodes.h:
3157         (JSC::StatementNode::):
3158         (JSC::BlockNode::):
3159
3160 2008-09-08  Kevin McCullough  <kmccullough@apple.com>
3161
3162         Reviewed by Geoff.
3163
3164        <rdar://problem/6134407> Breakpoints in for loops, while loops or
3165        conditions without curly braces don't break. (19306)
3166        -Statement Lists already emit debug hooks but conditionals without
3167        brackets are not lists.
3168
3169         * kjs/nodes.cpp:
3170         (KJS::IfNode::emitCode):
3171         (KJS::IfElseNode::emitCode):
3172         (KJS::DoWhileNode::emitCode):
3173         (KJS::WhileNode::emitCode):
3174         (KJS::ForNode::emitCode):
3175         (KJS::ForInNode::emitCode):
3176         * kjs/nodes.h:
3177         (KJS::StatementNode::):
3178         (KJS::BlockNode::):
3179
3180 2008-09-08  Maciej Stachowiak  <mjs@apple.com>
3181
3182         Reviewed by Anders Carlsson.
3183         
3184         - Cache the code generated for eval to speed up SunSpider and web sites
3185         https://bugs.webkit.org/show_bug.cgi?id=20718
3186         
3187         1.052x on SunSpider
3188         2.29x on date-format-tofte
3189         
3190         Lots of real sites seem to get many hits on this cache as well,
3191         including GMail, Google Spreadsheets, Slate and Digg (the last of
3192         these gets over 100 hits on initial page load).
3193
3194         * VM/CodeBlock.h:
3195         (JSC::EvalCodeCache::get):
3196         * VM/Machine.cpp:
3197         (JSC::Machine::callEval):
3198         (JSC::Machine::privateExecute):
3199         (JSC::Machine::cti_op_call_eval):
3200         * VM/Machine.h:
3201
3202 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3203
3204         Reviewed by Oliver Hunt.
3205
3206         Bug 20711: Change KJS prefix on preprocessor macros to JSC
3207         <https://bugs.webkit.org/show_bug.cgi?id=20711>
3208
3209         * kjs/CommonIdentifiers.cpp:
3210         (JSC::CommonIdentifiers::CommonIdentifiers):
3211         * kjs/CommonIdentifiers.h:
3212         * kjs/PropertySlot.h:
3213         (JSC::PropertySlot::getValue):
3214         (JSC::PropertySlot::putValue):
3215         (JSC::PropertySlot::setValueSlot):
3216         (JSC::PropertySlot::setValue):
3217         (JSC::PropertySlot::setRegisterSlot):
3218         * kjs/lookup.h:
3219         * kjs/nodes.cpp:
3220         * kjs/nodes.h:
3221         (JSC::Node::):
3222         (JSC::ExpressionNode::):
3223         (JSC::StatementNode::):
3224         (JSC::NullNode::):
3225         (JSC::BooleanNode::):
3226         (JSC::NumberNode::):
3227         (JSC::ImmediateNumberNode::):
3228         (JSC::StringNode::):
3229         (JSC::RegExpNode::):
3230         (JSC::ThisNode::):
3231         (JSC::ResolveNode::):
3232         (JSC::ElementNode::):
3233         (JSC::ArrayNode::):
3234         (JSC::PropertyNode::):
3235         (JSC::PropertyListNode::):
3236         (JSC::ObjectLiteralNode::):
3237         (JSC::BracketAccessorNode::):
3238         (JSC::DotAccessorNode::):
3239         (JSC::ArgumentListNode::):
3240         (JSC::ArgumentsNode::):
3241         (JSC::NewExprNode::):
3242         (JSC::EvalFunctionCallNode::):
3243         (JSC::FunctionCallValueNode::):
3244         (JSC::FunctionCallResolveNode::):
3245         (JSC::FunctionCallBracketNode::):
3246         (JSC::FunctionCallDotNode::):
3247         (JSC::PrePostResolveNode::):
3248         (JSC::PostfixResolveNode::):
3249         (JSC::PostfixBracketNode::):
3250         (JSC::PostfixDotNode::):
3251         (JSC::PostfixErrorNode::):
3252         (JSC::DeleteResolveNode::):
3253         (JSC::DeleteBracketNode::):
3254         (JSC::DeleteDotNode::):
3255         (JSC::DeleteValueNode::):
3256         (JSC::VoidNode::):
3257         (JSC::TypeOfResolveNode::):
3258         (JSC::TypeOfValueNode::):
3259         (JSC::PrefixResolveNode::):
3260         (JSC::PrefixBracketNode::):
3261         (JSC::PrefixDotNode::):
3262         (JSC::PrefixErrorNode::):
3263         (JSC::UnaryPlusNode::):
3264         (JSC::NegateNode::):
3265         (JSC::BitwiseNotNode::):
3266         (JSC::LogicalNotNode::):
3267         (JSC::MultNode::):
3268         (JSC::DivNode::):
3269         (JSC::ModNode::):
3270         (JSC::AddNode::):
3271         (JSC::SubNode::):
3272         (JSC::LeftShiftNode::):
3273         (JSC::RightShiftNode::):
3274         (JSC::UnsignedRightShiftNode::):
3275         (JSC::LessNode::):
3276         (JSC::GreaterNode::):
3277         (JSC::LessEqNode::):
3278         (JSC::GreaterEqNode::):
3279         (JSC::ThrowableBinaryOpNode::):
3280         (JSC::InstanceOfNode::):
3281         (JSC::InNode::):
3282         (JSC::EqualNode::):
3283         (JSC::NotEqualNode::):
3284         (JSC::StrictEqualNode::):
3285         (JSC::NotStrictEqualNode::):
3286         (JSC::BitAndNode::):
3287         (JSC::BitOrNode::):
3288         (JSC::BitXOrNode::):
3289         (JSC::LogicalOpNode::):
3290         (JSC::ConditionalNode::):
3291         (JSC::ReadModifyResolveNode::):
3292         (JSC::AssignResolveNode::):
3293         (JSC::ReadModifyBracketNode::):
3294         (JSC::AssignBracketNode::):
3295         (JSC::AssignDotNode::):
3296         (JSC::ReadModifyDotNode::):
3297         (JSC::AssignErrorNode::):
3298         (JSC::CommaNode::):
3299         (JSC::VarDeclCommaNode::):
3300         (JSC::ConstDeclNode::):
3301         (JSC::ConstStatementNode::):
3302         (JSC::EmptyStatementNode::):
3303         (JSC::DebuggerStatementNode::):
3304         (JSC::ExprStatementNode::):
3305         (JSC::VarStatementNode::):
3306         (JSC::IfNode::):
3307         (JSC::IfElseNode::):
3308         (JSC::DoWhileNode::):
3309         (JSC::WhileNode::):
3310         (JSC::ForNode::):
3311         (JSC::ContinueNode::):
3312         (JSC::BreakNode::):
3313         (JSC::ReturnNode::):
3314         (JSC::WithNode::):
3315         (JSC::LabelNode::):
3316         (JSC::ThrowNode::):
3317         (JSC::TryNode::):
3318         (JSC::ParameterNode::):
3319         (JSC::ScopeNode::):
3320         (JSC::ProgramNode::):
3321         (JSC::EvalNode::):
3322         (JSC::FunctionBodyNode::):
3323         (JSC::FuncExprNode::):
3324         (JSC::FuncDeclNode::):
3325         (JSC::CaseClauseNode::):
3326         (JSC::ClauseListNode::):
3327         (JSC::CaseBlockNode::):
3328         (JSC::SwitchNode::):
3329
3330 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3331
3332         Reviewed by Maciej Stachowiak.
3333
3334         Bug 20704: Replace the KJS namespace
3335         <https://bugs.webkit.org/show_bug.cgi?id=20704>
3336
3337         Rename the KJS namespace to JSC. There are still some uses of KJS in
3338         preprocessor macros and comments, but these will also be changed some
3339         time in the near future.
3340
3341         * API/APICast.h:
3342         (toJS):
3343         (toRef):
3344         (toGlobalRef):
3345         * API/JSBase.cpp:
3346         * API/JSCallbackConstructor.cpp:
3347         * API/JSCallbackConstructor.h:
3348         * API/JSCallbackFunction.cpp:
3349         * API/JSCallbackFunction.h:
3350         * API/JSCallbackObject.cpp:
3351         * API/JSCallbackObject.h:
3352         * API/JSCallbackObjectFunctions.h:
3353         * API/JSClassRef.cpp:
3354         (OpaqueJSClass::staticValues):
3355         (OpaqueJSClass::staticFunctions):
3356         * API/JSClassRef.h:
3357         * API/JSContextRef.cpp:
3358         * API/JSObjectRef.cpp:
3359         * API/JSProfilerPrivate.cpp:
3360         * API/JSStringRef.cpp:
3361         * API/JSValueRef.cpp:
3362         (JSValueGetType):
3363         * API/OpaqueJSString.cpp:
3364         * API/OpaqueJSString.h:
3365         * JavaScriptCore.Debug.exp:
3366         * JavaScriptCore.base.exp:
3367         * VM/CTI.cpp:
3368         (JSC::):
3369         * VM/CTI.h:
3370         * VM/CodeBlock.cpp:
3371         * VM/CodeBlock.h:
3372         * VM/CodeGenerator.cpp:
3373         * VM/CodeGenerator.h:
3374         * VM/ExceptionHelpers.cpp:
3375         * VM/ExceptionHelpers.h:
3376         * VM/Instruction.h:
3377         * VM/JSPropertyNameIterator.cpp:
3378         * VM/JSPropertyNameIterator.h:
3379         * VM/LabelID.h:
3380         * VM/Machine.cpp:
3381         * VM/Machine.h:
3382         * VM/Opcode.cpp:
3383         * VM/Opcode.h:
3384         * VM/Register.h:
3385         (WTF::):
3386         * VM/RegisterFile.cpp:
3387         * VM/RegisterFile.h:
3388         * VM/RegisterID.h:
3389         (WTF::):
3390         * VM/SamplingTool.cpp:
3391         * VM/SamplingTool.h:
3392         * VM/SegmentedVector.h:
3393         * kjs/ArgList.cpp:
3394         * kjs/ArgList.h:
3395         * kjs/Arguments.cpp:
3396         * kjs/Arguments.h:
3397         * kjs/ArrayConstructor.cpp:
3398         * kjs/ArrayConstructor.h:
3399         * kjs/ArrayPrototype.cpp:
3400         * kjs/ArrayPrototype.h:
3401         * kjs/BatchedTransitionOptimizer.h:
3402         * kjs/BooleanConstructor.cpp:
3403         * kjs/BooleanConstructor.h:
3404         * kjs/BooleanObject.cpp:
3405         * kjs/BooleanObject.h:
3406         * kjs/BooleanPrototype.cpp:
3407         * kjs/BooleanPrototype.h:
3408         * kjs/CallData.cpp:
3409         * kjs/CallData.h:
3410         * kjs/ClassInfo.h:
3411         * kjs/CommonIdentifiers.cpp:
3412         * kjs/CommonIdentifiers.h:
3413         * kjs/ConstructData.cpp:
3414         * kjs/ConstructData.h:
3415         * kjs/DateConstructor.cpp:
3416         * kjs/DateConstructor.h:
3417         * kjs/DateInstance.cpp:
3418         (JSC::DateInstance::msToGregorianDateTime):
3419         * kjs/DateInstance.h:
3420         * kjs/DateMath.cpp:
3421         * kjs/DateMath.h:
3422         * kjs/DatePrototype.cpp:
3423         * kjs/DatePrototype.h:
3424         * kjs/DebuggerCallFrame.cpp:
3425         * kjs/DebuggerCallFrame.h:
3426         * kjs/Error.cpp:
3427         * kjs/Error.h:
3428         * kjs/ErrorConstructor.cpp:
3429         * kjs/ErrorConstructor.h:
3430         * kjs/ErrorInstance.cpp:
3431         * kjs/ErrorInstance.h:
3432         * kjs/ErrorPrototype.cpp:
3433         * kjs/ErrorPrototype.h:
3434         * kjs/ExecState.cpp:
3435         * kjs/ExecState.h:
3436         * kjs/FunctionConstructor.cpp:
3437         * kjs/FunctionConstructor.h:
3438         * kjs/FunctionPrototype.cpp:
3439         * kjs/FunctionPrototype.h:
3440         * kjs/GetterSetter.cpp:
3441         * kjs/GetterSetter.h:
3442         * kjs/GlobalEvalFunction.cpp:
3443         * kjs/GlobalEvalFunction.h:
3444         * kjs/IndexToNameMap.cpp:
3445         * kjs/IndexToNameMap.h:
3446         * kjs/InitializeThreading.cpp:
3447         * kjs/InitializeThreading.h:
3448         * kjs/InternalFunction.cpp:
3449         * kjs/InternalFunction.h:
3450         (JSC::InternalFunction::InternalFunction):
3451         * kjs/JSActivation.cpp:
3452         * kjs/JSActivation.h:
3453         * kjs/JSArray.cpp:
3454         * kjs/JSArray.h:
3455         * kjs/JSCell.cpp:
3456         * kjs/JSCell.h:
3457         * kjs/JSFunction.cpp:
3458         * kjs/JSFunction.h:
3459         (JSC::JSFunction::JSFunction):
3460         * kjs/JSGlobalData.cpp:
3461         (JSC::JSGlobalData::JSGlobalData):
3462         * kjs/JSGlobalData.h:
3463         * kjs/JSGlobalObject.cpp:
3464         * kjs/JSGlobalObject.h:
3465         * kjs/JSGlobalObjectFunctions.cpp:
3466         * kjs/JSGlobalObjectFunctions.h:
3467         * kjs/JSImmediate.cpp:
3468         * kjs/JSImmediate.h:
3469         * kjs/JSLock.cpp:
3470         * kjs/JSLock.h:
3471         * kjs/JSNotAnObject.cpp:
3472         * kjs/JSNotAnObject.h:
3473         * kjs/JSNumberCell.cpp:
3474         * kjs/JSNumberCell.h:
3475         * kjs/JSObject.cpp:
3476         * kjs/JSObject.h:
3477         * kjs/JSStaticScopeObject.cpp:
3478         * kjs/JSStaticScopeObject.h:
3479         * kjs/JSString.cpp:
3480         * kjs/JSString.h:
3481         * kjs/JSType.h:
3482         * kjs/JSValue.cpp:
3483         * kjs/JSValue.h:
3484         * kjs/JSVariableObject.cpp:
3485         * kjs/JSVariableObject.h:
3486         * kjs/JSWrapperObject.cpp:
3487         * kjs/JSWrapperObject.h:
3488         * kjs/LabelStack.cpp:
3489         * kjs/LabelStack.h:
3490         * kjs/MathObject.cpp:
3491         * kjs/MathObject.h:
3492         * kjs/NativeErrorConstructor.cpp:
3493         * kjs/NativeErrorConstructor.h:
3494         * kjs/NativeErrorPrototype.cpp:
3495         * kjs/NativeErrorPrototype.h:
3496         * kjs/NodeInfo.h:
3497         * kjs/NumberConstructor.cpp:
3498         * kjs/NumberConstructor.h:
3499         * kjs/NumberObject.cpp:
3500         * kjs/NumberObject.h:
3501         * kjs/NumberPrototype.cpp:
3502         * kjs/NumberPrototype.h:
3503         * kjs/ObjectConstructor.cpp:
3504         * kjs/ObjectConstructor.h:
3505         * kjs/ObjectPrototype.cpp:
3506         * kjs/ObjectPrototype.h:
3507         * kjs/Parser.cpp:
3508         * kjs/Parser.h:
3509         * kjs/PropertyMap.cpp:
3510         (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger):
3511         * kjs/PropertyMap.h:
3512         * kjs/PropertyNameArray.cpp:
3513         * kjs/PropertyNameArray.h:
3514         * kjs/PropertySlot.cpp:
3515         * kjs/PropertySlot.h:
3516         * kjs/PrototypeFunction.cpp:
3517         * kjs/PrototypeFunction.h:
3518         * kjs/PutPropertySlot.h:
3519         * kjs/RegExpConstructor.cpp:
3520         * kjs/RegExpConstructor.h:
3521         * kjs/RegExpObject.cpp:
3522         * kjs/RegExpObject.h:
3523         * kjs/RegExpPrototype.cpp:
3524         * kjs/RegExpPrototype.h:
3525         * kjs/ScopeChain.cpp:
3526         * kjs/ScopeChain.h:
3527         * kjs/ScopeChainMark.h:
3528         * kjs/Shell.cpp:
3529         (jscmain):
3530         * kjs/SmallStrings.cpp:
3531         * kjs/SmallStrings.h:
3532         * kjs/SourceProvider.h:
3533         * kjs/SourceRange.h:
3534         * kjs/StringConstructor.cpp:
3535         * kjs/StringConstructor.h:
3536         * kjs/StringObject.cpp:
3537         * kjs/StringObject.h:
3538         * kjs/StringObjectThatMasqueradesAsUndefined.h:
3539         * kjs/StringPrototype.cpp:
3540         * kjs/StringPrototype.h:
3541         * kjs/StructureID.cpp:
3542         * kjs/StructureID.h:
3543         * kjs/SymbolTable.h:
3544         * kjs/collector.cpp:
3545         * kjs/collector.h:
3546         * kjs/completion.h:
3547         * kjs/create_hash_table:
3548         * kjs/debugger.cpp:
3549         * kjs/debugger.h:
3550         * kjs/dtoa.cpp:
3551         * kjs/dtoa.h:
3552         * kjs/grammar.y:
3553         * kjs/identifier.cpp:
3554         * kjs/identifier.h:
3555         (JSC::Identifier::equal):
3556         * kjs/interpreter.cpp:
3557         * kjs/interpreter.h:
3558         * kjs/lexer.cpp:
3559         (JSC::Lexer::Lexer):
3560         (JSC::Lexer::clear):
3561         (JSC::Lexer::makeIdentifier):
3562         * kjs/lexer.h:
3563         * kjs/lookup.cpp:
3564         * kjs/lookup.h:
3565         * kjs/nodes.cpp:
3566         * kjs/nodes.h:
3567         * kjs/nodes2string.cpp:
3568         * kjs/operations.cpp:
3569         * kjs/operations.h:
3570         * kjs/protect.h:
3571         * kjs/regexp.cpp:
3572         * kjs/regexp.h:
3573         * kjs/ustring.cpp:
3574         * kjs/ustring.h:
3575         (JSC::operator!=):
3576         (JSC::IdentifierRepHash::hash):
3577         (WTF::):
3578         * masm/MacroAssembler.h:
3579         * masm/MacroAssemblerWin.cpp:
3580         * masm/X86Assembler.h:
3581         * pcre/pcre_exec.cpp:
3582         * profiler/CallIdentifier.h:
3583         (WTF::):
3584         * profiler/HeavyProfile.cpp:
3585         * profiler/HeavyProfile.h:
3586         * profiler/Profile.cpp:
3587         * profiler/Profile.h:
3588         * profiler/ProfileGenerator.cpp:
3589         * profiler/ProfileGenerator.h:
3590         * profiler/ProfileNode.cpp:
3591         * profiler/ProfileNode.h:
3592         * profiler/Profiler.cpp:
3593         * profiler/Profiler.h:
3594         * profiler/TreeProfile.cpp:
3595         * profiler/TreeProfile.h:
3596         * wrec/WREC.cpp:
3597         * wrec/WREC.h:
3598         * wtf/AVLTree.h:
3599
3600 2008-09-07  Maciej Stachowiak  <mjs@apple.com>
3601
3602         Reviewed by Dan Bernstein.
3603         
3604         - rename IA32MacroAssembler class to X86Assembler
3605         
3606         We otherwise call the platform X86, and also, I don't see any macros.
3607
3608         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3609         * JavaScriptCore.xcodeproj/project.pbxproj:
3610         * masm/IA32MacroAsm.h: Removed.
3611         * masm/MacroAssembler.h:
3612         (KJS::MacroAssembler::MacroAssembler):
3613         * masm/MacroAssemblerWin.cpp:
3614         (KJS::MacroAssembler::emitRestoreArgumentReference):
3615         * masm/X86Assembler.h: Copied from masm/IA32MacroAsm.h.
3616         (KJS::X86Assembler::X86Assembler):
3617         * wrec/WREC.cpp:
3618         (KJS::WRECGenerator::generateNonGreedyQuantifier):
3619         (KJS::WRECGenerator::generateGreedyQuantifier):
3620         (KJS::WRECGenerator::generateParentheses):
3621         (KJS::WRECGenerator::generateBackreference):
3622         (KJS::WRECGenerator::gernerateDisjunction):
3623         * wrec/WREC.h:
3624
3625 2008-09-07  Cameron Zwarich  <cwzwarich@webkit.org>
3626
3627         Not reviewed.
3628
3629         Visual C++ seems to have some odd casting rules, so just convert the
3630         offending cast back to a C-style cast for now.
3631
3632         * kjs/collector.cpp:
3633         (KJS::otherThreadStackPointer):
3634
3635 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3636
3637         Reviewed by Mark Rowe.
3638
3639         Attempt to fix the Windows build by using a const_cast to cast regs.Esp
3640         to a uintptr_t instead of a reinterpret_cast.
3641
3642         * kjs/collector.cpp:
3643         (KJS::otherThreadStackPointer):
3644
3645 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3646
3647         Reviewed by Sam Weinig.
3648
3649         Remove C-style casts from kjs/collector.cpp.
3650
3651         * kjs/collector.cpp:
3652         (KJS::Heap::heapAllocate):
3653         (KJS::currentThreadStackBase):
3654         (KJS::Heap::markConservatively):
3655         (KJS::otherThreadStackPointer):
3656         (KJS::Heap::markOtherThreadConservatively):
3657         (KJS::Heap::sweep):
3658
3659 2008-09-07  Mark Rowe  <mrowe@apple.com>
3660
3661         Build fix for the debug variant.
3662
3663         * DerivedSources.make: Also use the .Debug.exp exports file when building the debug variant.
3664
3665 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3666
3667         Reviewed by Timothy Hatcher.
3668
3669         Remove C-style casts from the CTI code.
3670
3671         * VM/CTI.cpp:
3672         (KJS::CTI::emitGetArg):
3673         (KJS::CTI::emitGetPutArg):
3674         (KJS::ctiRepatchCallByReturnAddress):
3675         (KJS::CTI::compileOpCall):
3676         (KJS::CTI::privateCompileMainPass):
3677         (KJS::CTI::privateCompileGetByIdSelf):
3678         (KJS::CTI::privateCompileGetByIdProto):
3679         (KJS::CTI::privateCompileGetByIdChain):
3680         (KJS::CTI::privateCompilePutByIdReplace):
3681         (KJS::CTI::privateArrayLengthTrampoline):
3682         (KJS::CTI::privateStringLengthTrampoline):
3683
3684 === End merge of squirrelfish-extreme ===
3685
3686 2008-09-06  Gavin Barraclough  <barraclough@apple.com>
3687
3688         Reviewed by Sam Weinig. Adapted somewhat by Maciej Stachowiak.
3689         
3690         - refactor WREC to share more of the JIT infrastructure with CTI
3691
3692         * VM/CTI.cpp:
3693         (KJS::CTI::emitGetArg):
3694         (KJS::CTI::emitGetPutArg):
3695         (KJS::CTI::emitPutArg):
3696         (KJS::CTI::emitPutArgConstant):
3697         (KJS::CTI::emitPutCTIParam):
3698         (KJS::CTI::emitGetCTIParam):
3699         (KJS::CTI::emitPutToCallFrameHeader):
3700         (KJS::CTI::emitGetFromCallFrameHeader):
3701         (KJS::CTI::emitPutResult):
3702         (KJS::CTI::emitDebugExceptionCheck):
3703         (KJS::CTI::emitJumpSlowCaseIfNotImm):
3704         (KJS::CTI::emitJumpSlowCaseIfNotImms):
3705         (KJS::CTI::emitFastArithDeTagImmediate):
3706         (KJS::CTI::emitFastArithReTagImmediate):
3707         (KJS::CTI::emitFastArithPotentiallyReTagImmediate):
3708         (KJS::CTI::emitFastArithImmToInt):
3709         (KJS::CTI::emitFastArithIntToImmOrSlowCase):
3710         (KJS::CTI::emitFastArithIntToImmNoCheck):
3711         (KJS::CTI::CTI):
3712         (KJS::CTI::compileOpCall):
3713         (KJS::CTI::privateCompileMainPass):
3714         (KJS::CTI::privateCompileSlowCases):
3715         (KJS::CTI::privateCompile):
3716         (KJS::CTI::privateCompileGetByIdSelf):
3717         (KJS::CTI::privateCompileGetByIdProto):
3718         (KJS::CTI::privateCompileGetByIdChain):
3719         (KJS::CTI::privateCompilePutByIdReplace):
3720         (KJS::CTI::privateArrayLengthTrampoline):
3721         (KJS::CTI::privateStringLengthTrampoline):
3722         (KJS::CTI::compileRegExp):
3723         * VM/CTI.h:
3724         (KJS::CallRecord::CallRecord):
3725         (KJS::JmpTable::JmpTable):
3726         (KJS::SlowCaseEntry::SlowCaseEntry):
3727         (KJS::CTI::JSRInfo::JSRInfo):
3728         * kjs/regexp.cpp:
3729         (KJS::RegExp::RegExp):
3730         * wrec/WREC.cpp:
3731         (KJS::GenerateParenthesesNonGreedyFunctor::GenerateParenthesesNonGreedyFunctor):
3732         (KJS::GeneratePatternCharacterFunctor::generateAtom):
3733         (KJS::GeneratePatternCharacterFunctor::backtrack):
3734         (KJS::GenerateCharacterClassFunctor::generateAtom):
3735         (KJS::GenerateCharacterClassFunctor::backtrack):
3736         (KJS::GenerateBackreferenceFunctor::generateAtom):
3737         (KJS::GenerateBackreferenceFunctor::backtrack):
3738         (KJS::GenerateParenthesesNonGreedyFunctor::generateAtom):
3739         (KJS::GenerateParenthesesNonGreedyFunctor::backtrack):
3740         (KJS::WRECGenerate::generateBacktrack1):
3741         (KJS::WRECGenerate::generateBacktrackBackreference):
3742         (KJS::WRECGenerate::generateBackreferenceQuantifier):
3743         (KJS::WRECGenerate::generateNonGreedyQuantifier):
3744         (KJS::WRECGenerate::generateGreedyQuantifier):
3745         (KJS::WRECGenerate::generatePatternCharacter):
3746         (KJS::WRECGenerate::generateCharacterClassInvertedRange):
3747         (KJS::WRECGenerate::generateCharacterClassInverted):
3748         (KJS::WRECGenerate::generateCharacterClass):
3749         (KJS::WRECGenerate::generateParentheses):
3750         (KJS::WRECGenerate::generateParenthesesNonGreedy):
3751         (KJS::WRECGenerate::gererateParenthesesResetTrampoline):
3752         (KJS::WRECGenerate::generateAssertionBOL):
3753         (KJS::WRECGenerate::generateAssertionEOL):
3754         (KJS::WRECGenerate::generateAssertionWordBoundary):
3755         (KJS::WRECGenerate::generateBackreference):
3756         (KJS::WRECGenerate::gernerateDisjunction):
3757         (KJS::WRECGenerate::terminateDisjunction):
3758         (KJS::WRECParser::parseGreedyQuantifier):
3759         (KJS::WRECParser::parseQuantifier):
3760         (KJS::WRECParser::parsePatternCharacterQualifier):
3761         (KJS::WRECParser::parseCharacterClassQuantifier):
3762         (KJS::WRECParser::parseBackreferenceQuantifier):
3763         (KJS::WRECParser::parseParentheses):
3764         (KJS::WRECParser::parseCharacterClass):
3765         (KJS::WRECParser::parseOctalEscape):
3766         (KJS::WRECParser::parseEscape):
3767         (KJS::WRECParser::parseTerm):
3768         (KJS::WRECParser::parseDisjunction):
3769         * wrec/WREC.h:
3770         (KJS::WRECGenerate::WRECGenerate):
3771         (KJS::WRECParser::):
3772         (KJS::WRECParser::WRECParser):
3773         (KJS::WRECParser::parseAlternative):
3774         (KJS::WRECParser::isEndOfPattern):
3775
3776 2008-09-06  Oliver Hunt  <oliver@apple.com>
3777
3778         Reviewed by NOBODY (Build fix).
3779
3780         Fix the sampler build.
3781
3782         * VM/SamplingTool.h:
3783
3784 2008-09-06  Oliver Hunt  <oliver@apple.com>
3785
3786         Reviewed by Maciej Stachowiak.
3787
3788         Jump through the necessary hoops required to make MSVC cooperate with SFX
3789
3790         We now explicitly declare the calling convention on all cti_op_* cfunctions,
3791         and return int instead of bool where appropriate (despite the cdecl calling
3792         convention seems to state MSVC generates code that returns the result value
3793         through ecx).  SFX behaves slightly differently under MSVC, specifically it
3794         stores the base argument address for the cti_op_* functions in the first
3795         argument, and then does the required stack manipulation through that pointer.
3796         This is necessary as MSVC's optimisations assume they have complete control
3797         of the stack, and periodically elide our stack manipulations, or move
3798         values in unexpected ways.  MSVC also frequently produces tail calls which may
3799         clobber the first argument, so the MSVC path is slightly less efficient due
3800         to the need to restore it.
3801
3802         * JavaScriptCore.xcodeproj/project.pbxproj:
3803         * VM/CTI.cpp:
3804         (KJS::):
3805         (KJS::CTI::compileOpCall):
3806         (KJS::CTI::privateCompileMainPass):
3807         (KJS::CTI::privateCompileSlowCases):
3808         * VM/CTI.h:
3809         * VM/Machine.cpp:
3810         * VM/Machine.h:
3811         * masm/MacroAssembler.h:
3812         (KJS::MacroAssembler::emitConvertToFastCall):
3813         * masm/MacroAssemblerIA32GCC.cpp: Removed.
3814            For performance reasons we need these no-op functions to be inlined.
3815
3816         * masm/MacroAssemblerWin.cpp:
3817         (KJS::MacroAssembler::emitRestoreArgumentReference):
3818         * wtf/Platform.h:
3819
3820 2008-09-05  Geoffrey Garen  <ggaren@apple.com>
3821
3822         Reviewed by Maciej Stachowiak, or maybe the other way around.
3823         
3824         Added the ability to coalesce JITCode buffer grow operations by first
3825         growing the buffer and then executing unchecked puts to it.
3826         
3827         About a 2% speedup on date-format-tofte.
3828
3829         * VM/CTI.cpp:
3830         (KJS::CTI::compileOpCall):
3831         * masm/IA32MacroAsm.h:
3832         (KJS::JITCodeBuffer::ensureSpace):
3833         (KJS::JITCodeBuffer::putByteUnchecked):
3834         (KJS::JITCodeBuffer::putByte):
3835         (KJS::JITCodeBuffer::putShortUnchecked):
3836         (KJS::JITCodeBuffer::putShort):
3837         (KJS::JITCodeBuffer::putIntUnchecked):
3838         (KJS::JITCodeBuffer::putInt):
3839         (KJS::IA32MacroAssembler::emitTestl_i32r):
3840         (KJS::IA32MacroAssembler::emitMovl_mr):
3841         (KJS::IA32MacroAssembler::emitMovl_rm):
3842         (KJS::IA32MacroAssembler::emitMovl_i32m):
3843         (KJS::IA32MacroAssembler::emitUnlinkedJe):
3844         (KJS::IA32MacroAssembler::emitModRm_rr):
3845         (KJS::IA32MacroAssembler::emitModRm_rr_Unchecked):
3846         (KJS::IA32MacroAssembler::emitModRm_rm_Unchecked):
3847         (KJS::IA32MacroAssembler::emitModRm_rm):
3848         (KJS::IA32MacroAssembler::emitModRm_opr):
3849         (KJS::IA32MacroAssembler::emitModRm_opr_Unchecked):
3850         (KJS::IA32MacroAssembler::emitModRm_opm_Unchecked):
3851
3852 2008-09-05  Mark Rowe  <mrowe@apple.com>
3853
3854         Reviewed by Sam Weinig.
3855
3856         Disable WREC and CTI on platforms that we have not yet had a chance to test with.
3857
3858         * wtf/Platform.h:
3859
3860 2008-09-05  Geoffrey Garen  <ggaren@apple.com>
3861
3862         Reviewed by Sam Weinig.
3863         
3864         Use jo instead of a mask compare when fetching array.length and
3865         string.length. 4% speedup on array.length / string.length torture
3866         test.
3867
3868         * VM/CTI.cpp:
3869         (KJS::CTI::privateArrayLengthTrampoline):
3870         (KJS::CTI::privateStringLengthTrampoline):
3871
3872 2008-09-05  Geoffrey Garen  <ggaren@apple.com>
3873
3874         Reviewed by Sam Weinig.
3875
3876         Removed a CTI compilation pass by recording labels during bytecode
3877         generation. This is more to reduce complexity than it is to improve
3878         performance.
3879
3880         SunSpider reports no change.
3881
3882         CodeBlock now keeps a "labels" set, which holds the offsets of all the
3883         instructions that can be jumped to.
3884
3885         * VM/CTI.cpp: Nixed a pass.
3886
3887         * VM/CodeBlock.h: Added a "labels" set.
3888
3889         * VM/LabelID.h: No need for a special LableID for holding jump
3890         destinations, since the CodeBlock now knows all jump destinations.
3891
3892         * wtf/HashTraits.h: New hash traits to accomodate putting offset 0 in
3893         the set.
3894
3895         * kjs/nodes.cpp:
3896         (KJS::TryNode::emitCode): Emit a dummy label to record sret targets.
3897
3898 2008-09-05  Mark Rowe  <mrowe@apple.com>
3899
3900         Reviewed by Oliver Hunt and Gavin Barraclough.
3901
3902         Move the JITCodeBuffer onto Machine and remove the static variables.
3903
3904         * VM/CTI.cpp: Initialize m_jit with the Machine's code buffer.
3905         * VM/Machine.cpp:
3906         (KJS::Machine::Machine): Allocate a JITCodeBuffer.
3907         * VM/Machine.h:
3908         * kjs/RegExpConstructor.cpp:
3909         (KJS::constructRegExp): Pass the ExecState through.
3910         * kjs/RegExpPrototype.cpp:
3911         (KJS::regExpProtoFuncCompile): Ditto.
3912         * kjs/StringPrototype.cpp:
3913         (KJS::stringProtoFuncMatch): Ditto.
3914         (KJS::stringProtoFuncSearch): Ditto.
3915         * kjs/nodes.cpp:
3916         (KJS::RegExpNode::emitCode): Compile the pattern at code generation time
3917         so that we have access to an ExecState.
3918         * kjs/nodes.h:
3919         (KJS::RegExpNode::):
3920         * kjs/nodes2string.cpp:
3921         * kjs/regexp.cpp:
3922         (KJS::RegExp::RegExp): Pass the ExecState through.
3923         (KJS::RegExp::create): Ditto.
3924         * kjs/regexp.h:
3925         * masm/IA32MacroAsm.h:
3926         (KJS::IA32MacroAssembler::IA32MacroAssembler): Reset the JITCodeBuffer when we are
3927         constructed.
3928         * wrec/WREC.cpp:
3929         (KJS::WRECompiler::compile): Retrieve the JITCodeBuffer from the Machine.
3930         * wrec/WREC.h:
3931
3932 2008-09-05  Mark Rowe  <mrowe@apple.com>
3933
3934         Reviewed by Oliver Hunt and Gavin Barraclough.
3935
3936         Fix the build when CTI is disabled.
3937
3938         * VM/CodeBlock.cpp:
3939         (KJS::CodeBlock::~CodeBlock):
3940         * VM/CodeGenerator.cpp:
3941         (KJS::prepareJumpTableForStringSwitch):
3942         * VM/Machine.cpp:
3943         (KJS::Machine::Machine):
3944         (KJS::Machine::~Machine):
3945
3946 2008-09-05  Gavin Barraclough  <barraclough@apple.com>
3947
3948         Reviewed by Mark Rowe.
3949
3950         Fix some windows abi issues.
3951
3952         * VM/CTI.cpp:
3953         (KJS::CTI::privateCompileMainPass):
3954         (KJS::CTI::privateCompileSlowCases):
3955         * VM/CTI.h:
3956         (KJS::CallRecord::CallRecord):
3957         (KJS::):
3958         * VM/Machine.cpp:
3959         (KJS::Machine::cti_op_resolve_func):
3960         (KJS::Machine::cti_op_post_inc):
3961         (KJS::Machine::cti_op_resolve_with_base):
3962         (KJS::Machine::cti_op_post_dec):
3963         * VM/Machine.h:
3964
3965 2008-09-05  Mark Rowe  <mrowe@apple.com>
3966
3967         Reviewed by Sam Weinig.
3968
3969         Fix ecma/FunctionObjects/15.3.5.3.js after I broke it in r93.
3970
3971         * VM/Machine.cpp:
3972         (KJS::Machine::cti_op_call_NotJSFunction): Restore m_callFrame to the correct value after making the native call.
3973         (KJS::Machine::cti_op_construct_NotJSConstruct): Ditto.
3974
3975 2008-09-04  Mark Rowe  <mrowe@apple.com>
3976
3977         Reviewed by Sam Weinig.
3978
3979         Fix fast/dom/Window/console-functions.html.
3980
3981         The call frame on the ExecState was not being updated on calls into native functions.  This meant that functions
3982         such as console.log would use the line number of the last JS function on the call stack.
3983
3984         * VM/Machine.cpp:
3985         (KJS::Machine::cti_op_call_NotJSFunction): Update the ExecState's call frame before making a native function call,
3986         and restore it when the function is done.
3987         (KJS::Machine::cti_op_construct_NotJSConstruct): Ditto.
3988
3989 2008-09-05  Oliver Hunt  <oliver@apple.com>
3990
3991         Start bringing up SFX on windows.
3992
3993         Reviewed by Mark Rowe and Sam Weinig
3994
3995         Start doing the work to bring up SFX on windows.  Initially
3996         just working on WREC, as it does not make any calls so reduces
3997         the amount of code that needs to be corrected.
3998         
3999         Start abstracting the CTI JIT codegen engine.
4000
4001         * ChangeLog:
4002         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4003         * JavaScriptCore.xcodeproj/project.pbxproj:
4004         * VM/CTI.cpp:
4005         * masm/IA32MacroAsm.h:
4006         * masm/MacroAssembler.h: Added.
4007         (KJS::MacroAssembler::MacroAssembler):
4008         * masm/MacroAssemblerIA32GCC.cpp: Added.
4009         (KJS::MacroAssembler::emitConvertToFastCall):
4010         * masm/MacroAssemblerWin.cpp: Added.
4011         (KJS::MacroAssembler::emitConvertToFastCall):
4012         * wrec/WREC.cpp:
4013         (KJS::WRECompiler::parseGreedyQuantifier):
4014         (KJS::WRECompiler::parseCharacterClass):
4015         (KJS::WRECompiler::parseEscape):
4016         (KJS::WRECompiler::compilePattern):
4017         * wrec/WREC.h:
4018
4019 2008-09-04  Gavin Barraclough  <barraclough@apple.com>
4020
4021         Reviewed by Sam Weinig.
4022
4023         Support for slow scripts (timeout checking).
4024
4025         * VM/CTI.cpp:
4026         (KJS::CTI::privateCompileMainPass):
4027         (KJS::CTI::privateCompile):
4028         * VM/Machine.cpp:
4029         (KJS::slideRegisterWindowForCall):
4030         (KJS::Machine::cti_timeout_check):
4031         (KJS::Machine::cti_vm_throw):
4032
4033 2008-09-04  Sam Weinig  <sam@webkit.org>
4034
4035         Reviewed by Mark Rowe.
4036
4037         Third round of style cleanup.
4038
4039         * VM/CTI.cpp:
4040         * VM/CTI.h:
4041         * VM/CodeBlock.h:
4042         * VM/Machine.cpp:
4043         * VM/Machine.h:
4044         * kjs/ExecState.h:
4045
4046 2008-09-04  Sam Weinig  <sam@webkit.org>
4047
4048         Reviewed by Jon Honeycutt.
4049
4050         Second round of style cleanup.
4051
4052         * VM/CTI.cpp:
4053         * VM/CTI.h:
4054         * wrec/WREC.h:
4055
4056 2008-09-04  Sam Weinig  <sam@webkit.org>
4057
4058         Reviewed by Mark Rowe.
4059
4060         First round of style cleanup.
4061
4062         * VM/CTI.cpp:
4063         * VM/CTI.h:
4064         * masm/IA32MacroAsm.h:
4065         * wrec/WREC.cpp:
4066         * wrec/WREC.h:
4067
4068 2008-09-04  Geoffrey Garen  <ggaren@apple.com>
4069
4070         Reviewed by Mark Rowe.
4071         
4072         Merged http://trac.webkit.org/changeset/36081 to work with CTI.
4073
4074         * VM/Machine.cpp:
4075         (KJS::Machine::tryCtiCacheGetByID):
4076
4077 2008-09-04  Gavin Barraclough  <barraclough@apple.com>
4078
4079         Reviewed by Sam Weinig.
4080
4081         Enable profiling in CTI.
4082
4083         * VM/CTI.h:
4084         (KJS::):
4085         (KJS::CTI::execute):
4086         * VM/Machine.cpp:
4087         (KJS::Machine::cti_op_call_JSFunction):
4088         (KJS::Machine::cti_op_call_NotJSFunction):
4089         (KJS::Machine::cti_op_ret):
4090         (KJS::Machine::cti_op_construct_JSConstruct):
4091         (KJS::Machine::cti_op_construct_NotJSConstruct):
4092
4093 2008-09-04  Victor Hernandez  <vhernandez@apple.com>
4094
4095         Reviewed by Geoffrey Garen.
4096         
4097         Fixed an #if to support using WREC without CTI.
4098
4099         * kjs/regexp.cpp:
4100         (KJS::RegExp::match):
4101
4102 2008-09-04  Gavin Barraclough  <barraclough@apple.com>
4103
4104         Reviewed by Oliver Hunt.
4105
4106         The array/string length trampolines are owned by the Machine, not the codeblock that compiled them.
4107
4108         * VM/CTI.cpp:
4109         (KJS::CTI::privateArrayLengthTrampoline):
4110         (KJS::CTI::privateStringLengthTrampoline):
4111         * VM/Machine.cpp:
4112         (KJS::Machine::~Machine):
4113         * VM/Machine.h:
4114
4115 2008-09-04  Mark Rowe  <mrowe@apple.com>
4116
4117         Reviewed by Gavin Barraclough and Sam Weinig.
4118
4119         Fix a crash on launch of jsc when GuardMalloc is enabled.
4120
4121         * kjs/ScopeChain.h:
4122         (KJS::ScopeChain::ScopeChain): Initialize m_node to 0 when we have no valid scope chain.
4123         (KJS::ScopeChain::~ScopeChain): Null-check m_node before calling deref.
4124
4125 2008-09-03  Oliver Hunt  <oliver@apple.com>
4126
4127         Reviewed by Gavin Barraclough and Geoff Garen.
4128
4129         Fix inspector and fast array access so that it bounds
4130         checks correctly.
4131
4132         * VM/CTI.cpp:
4133         (KJS::CTI::privateCompile_pass2_Main):
4134         * masm/IA32MacroAsm.h:
4135         (KJS::IA32MacroAssembler::):
4136         (KJS::IA32MacroAssembler::emitUnlinkedJb):
4137         (KJS::IA32MacroAssembler::emitUnlinkedJbe):
4138
4139 2008-09-03  Mark Rowe  <mrowe@apple.com>
4140
4141         Move the assertion after the InitializeAndReturn block, as
4142         that is used even when CTI is enabled.
4143
4144         * VM/Machine.cpp:
4145         (KJS::Machine::privateExecute):
4146
4147 2008-09-03  Mark Rowe  <mrowe@apple.com>
4148
4149         Reviewed by Sam Weinig.
4150
4151         Replace calls to exit with ASSERT_WITH_MESSAGE or ASSERT_NOT_REACHED.
4152
4153         * VM/CTI.cpp:
4154         (KJS::CTI::privateCompile_pass1_Scan):
4155         (KJS::CTI::privateCompile_pass2_Main):
4156         (KJS::CTI::privateCompile_pass4_SlowCases):
4157         * VM/Machine.cpp:
4158         (KJS::Machine::privateExecute):
4159         (KJS::Machine::cti_vm_throw):
4160
4161 2008-09-03  Mark Rowe  <mrowe@apple.com>
4162
4163         Reviewed by Sam Weinig.
4164
4165         Tweak JavaScriptCore to compile on non-x86 platforms.  This is achieved
4166         by wrapping more code with ENABLE(CTI), ENABLE(WREC), and PLATFORM(X86)
4167         #if's.
4168
4169         * VM/CTI.cpp:
4170         * VM/CTI.h:
4171         * VM/CodeBlock.cpp:
4172         (KJS::CodeBlock::printStructureIDs): Use %td as the format specifier for
4173         printing a ptrdiff_t.
4174         * VM/Machine.cpp:
4175         * VM/Machine.h:
4176         * kjs/regexp.cpp:
4177         (KJS::RegExp::RegExp):
4178         (KJS::RegExp::~RegExp):
4179         (KJS::RegExp::match):
4180         * kjs/regexp.h:
4181         * masm/IA32MacroAsm.h:
4182         * wrec/WREC.cpp:
4183         * wrec/WREC.h:
4184         * wtf/Platform.h: Only enable CTI and WREC on x86.  Add an extra define to
4185         track whether any MASM-using features are enabled.
4186
4187 2008-09-03  Gavin Barraclough  <barraclough@apple.com>
4188
4189         Reviewed by Oliver Hunt.
4190
4191         Copy Geoff's array/string length optimization for CTI.
4192
4193         * VM/CTI.cpp:
4194         (KJS::CTI::privateArrayLengthTrampoline):
4195         (KJS::CTI::privateStringLengthTrampoline):
4196         * VM/CTI.h:
4197         (KJS::CTI::compileArrayLengthTrampoline):
4198         (KJS::CTI::compileStringLengthTrampoline):
4199         * VM/Machine.cpp:
4200         (KJS::Machine::Machine):
4201         (KJS::Machine::getCtiArrayLengthTrampoline):
4202         (KJS::Machine::getCtiStringLengthTrampoline):
4203         (KJS::Machine::tryCtiCacheGetByID):
4204         (KJS::Machine::cti_op_get_by_id_second):
4205         * VM/Machine.h:
4206         * kjs/JSString.h:
4207         * kjs/ustring.h:
4208
4209 2008-09-03  Gavin Barraclough  <barraclough@apple.com>
4210
4211         Reviewed by Oliver Hunt.
4212
4213         Implement fast array accesses in CTI - 2-3% progression on sunspider.
4214
4215         * VM/CTI.cpp:
4216         (KJS::CTI::emitFastArithIntToImmNoCheck):
4217         (KJS::CTI::compileOpCall):
4218         (KJS::CTI::privateCompile_pass2_Main):
4219         (KJS::CTI::privateCompile_pass4_SlowCases):
4220         * VM/CTI.h:
4221         * kjs/JSArray.h:
4222
4223 2008-09-02  Gavin Barraclough  <barraclough@apple.com>
4224
4225         Reviewed by Oliver Hunt.
4226
4227         Enable fast property access support in CTI.
4228
4229         * VM/CTI.cpp:
4230         (KJS::ctiSetReturnAddress):
4231         (KJS::ctiRepatchCallByReturnAddress):
4232         (KJS::CTI::privateCompile_pass2_Main):
4233         (KJS::CTI::privateCompile):
4234         (KJS::CTI::privateCompileGetByIdSelf):
4235         (KJS::CTI::privateCompileGetByIdProto):
4236         (KJS::CTI::privateCompileGetByIdChain):
4237         (KJS::CTI::privateCompilePutByIdReplace):
4238         * VM/CTI.h:
4239         (KJS::CTI::compileGetByIdSelf):
4240         (KJS::CTI::compileGetByIdProto):
4241         (KJS::CTI::compileGetByIdChain):
4242         (KJS::CTI::compilePutByIdReplace):
4243         * VM/CodeBlock.cpp:
4244         (KJS::CodeBlock::~CodeBlock):
4245         * VM/CodeBlock.h:
4246         * VM/Machine.cpp:
4247         (KJS::doSetReturnAddressVmThrowTrampoline):
4248         (KJS::Machine::tryCtiCachePutByID):
4249         (KJS::Machine::tryCtiCacheGetByID):
4250         (KJS::Machine::cti_op_put_by_id):
4251         (KJS::Machine::cti_op_put_by_id_second):
4252         (KJS::Machine::cti_op_put_by_id_generic):
4253         (KJS::Machine::cti_op_put_by_id_fail):
4254         (KJS::Machine::cti_op_get_by_id):
4255         (KJS::Machine::cti_op_get_by_id_second):
4256         (KJS::Machine::cti_op_get_by_id_generic):
4257         (KJS::Machine::cti_op_get_by_id_fail):
4258         (KJS::Machine::cti_op_throw):
4259         (KJS::Machine::cti_vm_throw):
4260         * VM/Machine.h:
4261         * kjs/JSCell.h:
4262         * kjs/JSObject.h:
4263         * kjs/PropertyMap.h:
4264         * kjs/StructureID.cpp:
4265         (KJS::StructureIDChain::StructureIDChain):
4266         * masm/IA32MacroAsm.h:
4267         (KJS::IA32MacroAssembler::emitCmpl_i32m):
4268         (KJS::IA32MacroAssembler::emitMovl_mr):
4269         (KJS::IA32MacroAssembler::emitMovl_rm):
4270
4271 2008-09-02  Sam Weinig  <sam@webkit.org>
4272
4273         Reviewed by Gavin Barraclough and Mark Rowe.
4274
4275         A backslash (\) at the of a RegEx should produce an error.
4276         Fixes fast/regex/test1.html.
4277
4278         * wrec/WREC.cpp:
4279         (KJS::WRECompiler::parseEscape):
4280
4281 2008-09-02  Sam Weinig  <sam@webkit.org>
4282
4283         Reviewed by Geoff Garen.
4284
4285         Link jumps for the slow case of op_loop_if_less.  Fixes acid3.
4286
4287         * VM/CTI.cpp:
4288         (KJS::CTI::privateCompile_pass4_SlowCases):
4289
4290 2008-09-01  Sam Weinig  <sam@webkit.org>
4291
4292         Rubber-stamped by Maciej Stachowiak.
4293
4294         Switch WREC on by default.
4295
4296         * wtf/Platform.h:
4297
4298 2008-09-01  Sam Weinig  <sam@webkit.org>
4299
4300         Reviewed by Mark Rowe.
4301
4302         Fix two failures in fast/regex/test1.html
4303           - \- in a character class should be treated as a literal -
4304           - A missing max quantifier needs to be treated differently than
4305             a null max quantifier.
4306
4307         * wrec/WREC.cpp:
4308         (KJS::WRECompiler::generateNonGreedyQuantifier):
4309         (KJS::WRECompiler::generateGreedyQuantifier):
4310         (KJS::WRECompiler::parseCharacterClass):
4311         * wrec/WREC.h:
4312         (KJS::Quantifier::Quantifier):
4313