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