Inline immediate number version of op_mul.
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2008-09-10  Oliver Hunt  <oliver@apple.com>
2
3         Reviewed by Geoff Garen.
4
5         Inline immediate number version of op_mul.
6
7         Renamed mull_rr to imull_rr as that's what it's 
8         actually doing, and added imull_i32r for the constant
9         case immediate multiply.
10
11         1.1% improvement to SunSpider.
12
13         * VM/CTI.cpp:
14         (JSC::CTI::privateCompileMainPass):
15         (JSC::CTI::privateCompileSlowCases):
16         * masm/X86Assembler.h:
17         (JSC::X86Assembler::):
18         (JSC::X86Assembler::imull_rr):
19         (JSC::X86Assembler::imull_i32r):
20
21 2008-09-10  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
22
23         Not reviewed.
24
25         Mac build fix.
26
27         * JavaScriptCore.xcodeproj/project.pbxproj:
28
29 2008-09-09  Oliver Hunt  <oliver@apple.com>
30
31         Reviewed by Maciej Stachowiak.
32
33         Add optimised access to known properties on the global object.
34
35         Improve cross scope access to the global object by emitting
36         code to access it directly rather than by walking the scope chain.
37
38         This is a 0.8% win in SunSpider and a 1.7% win in the v8 benchmarks.
39
40         * VM/CTI.cpp:
41         (JSC::CTI::privateCompileMainPass):
42         (JSC::CTI::emitGetVariableObjectRegister):
43         (JSC::CTI::emitPutVariableObjectRegister):
44         * VM/CTI.h:
45         * VM/CodeBlock.cpp:
46         (JSC::CodeBlock::dump):
47         * VM/CodeGenerator.cpp:
48         (JSC::CodeGenerator::findScopedProperty):
49         (JSC::CodeGenerator::emitResolve):
50         (JSC::CodeGenerator::emitGetScopedVar):
51         (JSC::CodeGenerator::emitPutScopedVar):
52         * VM/CodeGenerator.h:
53         * VM/Machine.cpp:
54         (JSC::Machine::privateExecute):
55         * VM/Opcode.h:
56         * kjs/nodes.cpp:
57         (JSC::FunctionCallResolveNode::emitCode):
58         (JSC::PostfixResolveNode::emitCode):
59         (JSC::PrefixResolveNode::emitCode):
60         (JSC::ReadModifyResolveNode::emitCode):
61         (JSC::AssignResolveNode::emitCode):
62
63 2008-09-10  Maciej Stachowiak  <mjs@apple.com>
64
65         Reviewed by Oliver.
66         
67         - enable polymorphic inline caching of properties of primitives
68         
69         1.012x speedup on SunSpider.
70
71         We create special structure IDs for JSString and
72         JSNumberCell. Unlike normal structure IDs, these cannot hold the
73         true prototype. Due to JS autoboxing semantics, the prototype used
74         when looking up string or number properties depends on the lexical
75         global object of the call site, not the creation site. Thus we
76         enable StructureIDs to handle this quirk for primitives.
77         
78         Everything else should be straightforward.
79         
80         * VM/CTI.cpp:
81         (JSC::CTI::privateCompileGetByIdProto):
82         (JSC::CTI::privateCompileGetByIdChain):
83         * VM/CTI.h:
84         (JSC::CTI::compileGetByIdProto):
85         (JSC::CTI::compileGetByIdChain):
86         * VM/JSPropertyNameIterator.h:
87         (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
88         * VM/Machine.cpp:
89         (JSC::Machine::Machine):
90         (JSC::cachePrototypeChain):
91         (JSC::Machine::tryCachePutByID):
92         (JSC::Machine::tryCacheGetByID):
93         (JSC::Machine::privateExecute):
94         (JSC::Machine::tryCTICachePutByID):
95         (JSC::Machine::tryCTICacheGetByID):
96         * kjs/GetterSetter.h:
97         (JSC::GetterSetter::GetterSetter):
98         * kjs/JSCell.h:
99         * kjs/JSGlobalData.cpp:
100         (JSC::JSGlobalData::JSGlobalData):
101         * kjs/JSGlobalData.h:
102         * kjs/JSGlobalObject.h:
103         (JSC::StructureID::prototypeForLookup):
104         * kjs/JSNumberCell.h:
105         (JSC::JSNumberCell::JSNumberCell):
106         (JSC::jsNumberCell):
107         * kjs/JSObject.h:
108         (JSC::JSObject::prototype):
109         * kjs/JSString.cpp:
110         (JSC::jsString):
111         (JSC::jsSubstring):
112         (JSC::jsOwnedString):
113         * kjs/JSString.h:
114         (JSC::JSString::JSString):
115         (JSC::JSString::):
116         (JSC::jsSingleCharacterString):
117         (JSC::jsSingleCharacterSubstring):
118         (JSC::jsNontrivialString):
119         * kjs/SmallStrings.cpp:
120         (JSC::SmallStrings::createEmptyString):
121         (JSC::SmallStrings::createSingleCharacterString):
122         * kjs/StructureID.cpp:
123         (JSC::StructureID::StructureID):
124         (JSC::StructureID::addPropertyTransition):
125         (JSC::StructureID::getterSetterTransition):
126         (JSC::StructureIDChain::StructureIDChain):
127         * kjs/StructureID.h:
128         (JSC::StructureID::create):
129         (JSC::StructureID::storedPrototype):
130
131 2008-09-09  Joerg Bornemann  <joerg.bornemann@trolltech.com>
132
133         Reviewed by Sam Weinig.
134
135         https://bugs.webkit.org/show_bug.cgi?id=20746
136
137         Added WINCE platform macro.
138
139         * wtf/Platform.h:
140
141 2008-09-09  Sam Weinig  <sam@webkit.org>
142
143         Reviewed by Mark Rowe.
144
145         Remove unnecessary override of getOffset.
146
147         Sunspider reports this as a .6% progression.
148
149         * JavaScriptCore.exp:
150         * kjs/JSObject.h:
151         (JSC::JSObject::getDirectLocation):
152         (JSC::JSObject::getOwnPropertySlotForWrite):
153         (JSC::JSObject::putDirect):
154         * kjs/PropertyMap.cpp:
155         * kjs/PropertyMap.h:
156
157 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
158
159         Reviewed by Maciej Stachowiak.
160
161         Bug 20759: Remove MacroAssembler
162         <https://bugs.webkit.org/show_bug.cgi?id=20759>
163
164         Remove MacroAssembler and move its functionality to X86Assembler.
165
166         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
167         * JavaScriptCore.xcodeproj/project.pbxproj:
168         * VM/CTI.cpp:
169         (JSC::CTI::emitGetArg):
170         (JSC::CTI::emitGetPutArg):
171         (JSC::CTI::emitPutArg):
172         (JSC::CTI::emitPutCTIParam):
173         (JSC::CTI::emitGetCTIParam):
174         (JSC::CTI::emitPutToCallFrameHeader):
175         (JSC::CTI::emitGetFromCallFrameHeader):
176         (JSC::CTI::emitPutResult):
177         (JSC::CTI::emitDebugExceptionCheck):
178         (JSC::CTI::emitJumpSlowCaseIfNotImm):
179         (JSC::CTI::emitJumpSlowCaseIfNotImms):
180         (JSC::CTI::emitFastArithDeTagImmediate):
181         (JSC::CTI::emitFastArithReTagImmediate):
182         (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
183         (JSC::CTI::emitFastArithImmToInt):
184         (JSC::CTI::emitFastArithIntToImmOrSlowCase):
185         (JSC::CTI::emitFastArithIntToImmNoCheck):
186         (JSC::CTI::compileOpCall):
187         (JSC::CTI::emitSlowScriptCheck):
188         (JSC::CTI::privateCompileMainPass):
189         (JSC::CTI::privateCompileSlowCases):
190         (JSC::CTI::privateCompile):
191         (JSC::CTI::privateCompileGetByIdSelf):
192         (JSC::CTI::privateCompileGetByIdProto):
193         (JSC::CTI::privateCompileGetByIdChain):
194         (JSC::CTI::privateCompilePutByIdReplace):
195         (JSC::CTI::privateArrayLengthTrampoline):
196         (JSC::CTI::privateStringLengthTrampoline):
197         (JSC::CTI::compileRegExp):
198         * VM/CTI.h:
199         (JSC::CallRecord::CallRecord):
200         (JSC::JmpTable::JmpTable):
201         (JSC::SlowCaseEntry::SlowCaseEntry):
202         (JSC::CTI::JSRInfo::JSRInfo):
203         * masm/MacroAssembler.h: Removed.
204         * masm/MacroAssemblerWin.cpp: Removed.
205         * masm/X86Assembler.h:
206         (JSC::X86Assembler::emitConvertToFastCall):
207         (JSC::X86Assembler::emitRestoreArgumentReference):
208         * wrec/WREC.h:
209         (JSC::WRECGenerator::WRECGenerator):
210         (JSC::WRECParser::WRECParser):
211
212 2008-09-09  Sam Weinig  <sam@webkit.org>
213
214         Reviewed by Cameron Zwarich.
215
216         Don't waste the first item in the PropertyStorage.
217
218         - Fix typo (makingCount -> markingCount)
219         - Remove undefined method declaration.
220
221         No change on Sunspider.
222
223         * kjs/JSObject.cpp:
224         (JSC::JSObject::mark):
225         * kjs/PropertyMap.cpp:
226         (JSC::PropertyMap::put):
227         (JSC::PropertyMap::remove):
228         (JSC::PropertyMap::getOffset):
229         (JSC::PropertyMap::insert):
230         (JSC::PropertyMap::rehash):
231         (JSC::PropertyMap::resizePropertyStorage):
232         (JSC::PropertyMap::checkConsistency):
233         * kjs/PropertyMap.h:
234         (JSC::PropertyMap::markingCount): Fix typo.
235
236 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
237
238         Not reviewed.
239
240         Speculative Windows build fix.
241
242         * masm/MacroAssemblerWin.cpp:
243         (JSC::MacroAssembler::emitConvertToFastCall):
244         (JSC::MacroAssembler::emitRestoreArgumentReference):
245
246 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
247
248         Reviewed by Maciej Stachowiak.
249
250         Bug 20755: Create an X86 namespace for register names and other things
251         <https://bugs.webkit.org/show_bug.cgi?id=20755>
252
253         Create an X86 namespace to put X86 register names. Perhaps I will move
254         opcode names here later as well.
255
256         * VM/CTI.cpp:
257         (JSC::CTI::emitGetArg):
258         (JSC::CTI::emitGetPutArg):
259         (JSC::CTI::emitPutArg):
260         (JSC::CTI::emitPutArgConstant):
261         (JSC::CTI::emitPutCTIParam):
262         (JSC::CTI::emitGetCTIParam):
263         (JSC::CTI::emitPutToCallFrameHeader):
264         (JSC::CTI::emitGetFromCallFrameHeader):
265         (JSC::CTI::emitPutResult):
266         (JSC::CTI::emitDebugExceptionCheck):
267         (JSC::CTI::emitJumpSlowCaseIfNotImms):
268         (JSC::CTI::compileOpCall):
269         (JSC::CTI::emitSlowScriptCheck):
270         (JSC::CTI::privateCompileMainPass):
271         (JSC::CTI::privateCompileSlowCases):
272         (JSC::CTI::privateCompile):
273         (JSC::CTI::privateCompileGetByIdSelf):
274         (JSC::CTI::privateCompileGetByIdProto):
275         (JSC::CTI::privateCompileGetByIdChain):
276         (JSC::CTI::privateCompilePutByIdReplace):
277         (JSC::CTI::privateArrayLengthTrampoline):
278         (JSC::CTI::privateStringLengthTrampoline):
279         (JSC::CTI::compileRegExp):
280         * VM/CTI.h:
281         * masm/X86Assembler.h:
282         (JSC::X86::):
283         (JSC::X86Assembler::emitModRm_rm):
284         (JSC::X86Assembler::emitModRm_rm_Unchecked):
285         (JSC::X86Assembler::emitModRm_rmsib):
286         * wrec/WREC.cpp:
287         (JSC::WRECGenerator::generateNonGreedyQuantifier):
288         (JSC::WRECGenerator::generateGreedyQuantifier):
289         (JSC::WRECGenerator::generateParentheses):
290         (JSC::WRECGenerator::generateBackreference):
291         (JSC::WRECGenerator::gernerateDisjunction):
292         * wrec/WREC.h:
293
294 2008-09-09  Sam Weinig  <sam@webkit.org>
295
296         Reviewed by Geoffrey Garen.
297
298         Remove unnecessary friend declaration.
299
300         * kjs/PropertyMap.h:
301
302 2008-09-09  Sam Weinig  <sam@webkit.org>
303
304         Reviewed by Geoffrey Garen.
305
306         Replace uses of PropertyMap::get and PropertyMap::getLocation with
307         PropertyMap::getOffset.
308
309         Sunspider reports this as a .6% improvement.
310
311         * JavaScriptCore.exp:
312         * kjs/JSObject.cpp:
313         (JSC::JSObject::put):
314         (JSC::JSObject::deleteProperty):
315         (JSC::JSObject::getPropertyAttributes):
316         * kjs/JSObject.h:
317         (JSC::JSObject::getDirect):
318         (JSC::JSObject::getDirectLocation):
319         (JSC::JSObject::locationForOffset):
320         * kjs/PropertyMap.cpp:
321         (JSC::PropertyMap::remove):
322         (JSC::PropertyMap::getOffset):
323         * kjs/PropertyMap.h:
324
325 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
326
327         Reviewed by Sam Weinig.
328
329         Bug 20754: Remove emit prefix from assembler opcode methods
330         <https://bugs.webkit.org/show_bug.cgi?id=20754>
331
332         * VM/CTI.cpp:
333         (JSC::CTI::emitGetArg):
334         (JSC::CTI::emitGetPutArg):
335         (JSC::CTI::emitPutArg):
336         (JSC::CTI::emitPutArgConstant):
337         (JSC::CTI::emitPutCTIParam):
338         (JSC::CTI::emitGetCTIParam):
339         (JSC::CTI::emitPutToCallFrameHeader):
340         (JSC::CTI::emitGetFromCallFrameHeader):
341         (JSC::CTI::emitPutResult):
342         (JSC::CTI::emitDebugExceptionCheck):
343         (JSC::CTI::emitCall):
344         (JSC::CTI::emitJumpSlowCaseIfNotImm):
345         (JSC::CTI::emitJumpSlowCaseIfNotImms):
346         (JSC::CTI::emitFastArithDeTagImmediate):
347         (JSC::CTI::emitFastArithReTagImmediate):
348         (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
349         (JSC::CTI::emitFastArithImmToInt):
350         (JSC::CTI::emitFastArithIntToImmOrSlowCase):
351         (JSC::CTI::emitFastArithIntToImmNoCheck):
352         (JSC::CTI::compileOpCall):
353         (JSC::CTI::emitSlowScriptCheck):
354         (JSC::CTI::privateCompileMainPass):
355         (JSC::CTI::privateCompileSlowCases):
356         (JSC::CTI::privateCompile):
357         (JSC::CTI::privateCompileGetByIdSelf):
358         (JSC::CTI::privateCompileGetByIdProto):
359         (JSC::CTI::privateCompileGetByIdChain):
360         (JSC::CTI::privateCompilePutByIdReplace):
361         (JSC::CTI::privateArrayLengthTrampoline):
362         (JSC::CTI::privateStringLengthTrampoline):
363         (JSC::CTI::compileRegExp):
364         * masm/MacroAssemblerWin.cpp:
365         (JSC::MacroAssembler::emitConvertToFastCall):
366         (JSC::MacroAssembler::emitRestoreArgumentReference):
367         * masm/X86Assembler.h:
368         (JSC::X86Assembler::pushl_r):
369         (JSC::X86Assembler::pushl_m):
370         (JSC::X86Assembler::popl_r):
371         (JSC::X86Assembler::popl_m):
372         (JSC::X86Assembler::movl_rr):
373         (JSC::X86Assembler::addl_rr):
374         (JSC::X86Assembler::addl_i8r):
375         (JSC::X86Assembler::addl_i32r):
376         (JSC::X86Assembler::addl_mr):
377         (JSC::X86Assembler::andl_rr):
378         (JSC::X86Assembler::andl_i32r):
379         (JSC::X86Assembler::cmpl_i8r):
380         (JSC::X86Assembler::cmpl_rr):
381         (JSC::X86Assembler::cmpl_rm):
382         (JSC::X86Assembler::cmpl_i32r):
383         (JSC::X86Assembler::cmpl_i32m):
384         (JSC::X86Assembler::cmpw_rm):
385         (JSC::X86Assembler::orl_rr):
386         (JSC::X86Assembler::subl_rr):
387         (JSC::X86Assembler::subl_i8r):
388         (JSC::X86Assembler::subl_i32r):
389         (JSC::X86Assembler::subl_mr):
390         (JSC::X86Assembler::testl_i32r):
391         (JSC::X86Assembler::testl_rr):
392         (JSC::X86Assembler::xorl_i8r):
393         (JSC::X86Assembler::xorl_rr):
394         (JSC::X86Assembler::sarl_i8r):
395         (JSC::X86Assembler::sarl_CLr):
396         (JSC::X86Assembler::shl_i8r):
397         (JSC::X86Assembler::shll_CLr):
398         (JSC::X86Assembler::mull_rr):
399         (JSC::X86Assembler::idivl_r):
400         (JSC::X86Assembler::cdq):
401         (JSC::X86Assembler::movl_mr):
402         (JSC::X86Assembler::movzwl_mr):
403         (JSC::X86Assembler::movl_rm):
404         (JSC::X86Assembler::movl_i32r):
405         (JSC::X86Assembler::movl_i32m):
406         (JSC::X86Assembler::leal_mr):
407         (JSC::X86Assembler::ret):
408         (JSC::X86Assembler::jmp_r):
409         (JSC::X86Assembler::jmp_m):
410         (JSC::X86Assembler::call_r):
411         * wrec/WREC.cpp:
412         (JSC::WRECGenerator::generateBacktrack1):
413         (JSC::WRECGenerator::generateBacktrackBackreference):
414         (JSC::WRECGenerator::generateBackreferenceQuantifier):
415         (JSC::WRECGenerator::generateNonGreedyQuantifier):
416         (JSC::WRECGenerator::generateGreedyQuantifier):
417         (JSC::WRECGenerator::generatePatternCharacter):
418         (JSC::WRECGenerator::generateCharacterClassInvertedRange):
419         (JSC::WRECGenerator::generateCharacterClassInverted):
420         (JSC::WRECGenerator::generateCharacterClass):
421         (JSC::WRECGenerator::generateParentheses):
422         (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
423         (JSC::WRECGenerator::generateAssertionBOL):
424         (JSC::WRECGenerator::generateAssertionEOL):
425         (JSC::WRECGenerator::generateAssertionWordBoundary):
426         (JSC::WRECGenerator::generateBackreference):
427         (JSC::WRECGenerator::gernerateDisjunction):
428
429 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
430
431         Reviewed by Maciej Stachowiak.
432
433         Clean up the WREC code some more.
434
435         * VM/CTI.cpp:
436         (JSC::CTI::compileRegExp):
437         * wrec/WREC.cpp:
438         (JSC::getCharacterClassNewline):
439         (JSC::getCharacterClassDigits):
440         (JSC::getCharacterClassSpaces):
441         (JSC::getCharacterClassWordchar):
442         (JSC::getCharacterClassNondigits):
443         (JSC::getCharacterClassNonspaces):
444         (JSC::getCharacterClassNonwordchar):
445         (JSC::WRECGenerator::generateBacktrack1):
446         (JSC::WRECGenerator::generateBacktrackBackreference):
447         (JSC::WRECGenerator::generateBackreferenceQuantifier):
448         (JSC::WRECGenerator::generateNonGreedyQuantifier):
449         (JSC::WRECGenerator::generateGreedyQuantifier):
450         (JSC::WRECGenerator::generatePatternCharacter):
451         (JSC::WRECGenerator::generateCharacterClassInvertedRange):
452         (JSC::WRECGenerator::generateCharacterClassInverted):
453         (JSC::WRECGenerator::generateCharacterClass):
454         (JSC::WRECGenerator::generateParentheses):
455         (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
456         (JSC::WRECGenerator::generateAssertionBOL):
457         (JSC::WRECGenerator::generateAssertionEOL):
458         (JSC::WRECGenerator::generateAssertionWordBoundary):
459         (JSC::WRECGenerator::generateBackreference):
460         (JSC::WRECGenerator::gernerateDisjunction):
461         (JSC::WRECParser::parseCharacterClass):
462         (JSC::WRECParser::parseEscape):
463         (JSC::WRECParser::parseTerm):
464         * wrec/WREC.h:
465
466 2008-09-09  Mark Rowe  <mrowe@apple.com>
467
468         Build fix, rubber-stamped by Anders Carlsson.
469
470         Silence spurious build warnings about missing format attributes on functions in Assertions.cpp.
471
472         * JavaScriptCore.xcodeproj/project.pbxproj:
473
474 2008-09-09  Mark Rowe  <mrowe@apple.com>
475
476         Rubber-stamped by Oliver Hunt.
477
478         Fix builds using the "debug" variant.
479
480         This reverts r36130 and tweaks Identifier to export the same symbols for Debug
481         and Release configurations.
482
483         * Configurations/JavaScriptCore.xcconfig:
484         * DerivedSources.make:
485         * JavaScriptCore.Debug.exp: Removed.
486         * JavaScriptCore.base.exp: Removed.
487         * JavaScriptCore.exp: Added.
488         * JavaScriptCore.xcodeproj/project.pbxproj:
489         * kjs/identifier.cpp:
490         (JSC::Identifier::addSlowCase): #ifdef the call to checkSameIdentifierTable so that
491         there is no overhead in Release builds.
492         (JSC::Identifier::checkSameIdentifierTable): Add empty functions for Release builds.
493         * kjs/identifier.h:
494         (JSC::Identifier::add): #ifdef the calls to checkSameIdentifierTable so that there is
495         no overhead in Release builds, and remove the inline definitions of checkSameIdentifierTable.
496
497 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
498
499         Reviewed by Maciej Stachowiak.
500
501         Clean up WREC a bit to bring it closer to our coding style guidelines.
502
503         * wrec/WREC.cpp:
504         (JSC::):
505         (JSC::getCharacterClass_newline):
506         (JSC::getCharacterClass_d):
507         (JSC::getCharacterClass_s):
508         (JSC::getCharacterClass_w):
509         (JSC::getCharacterClass_D):
510         (JSC::getCharacterClass_S):
511         (JSC::getCharacterClass_W):
512         (JSC::CharacterClassConstructor::append):
513         (JSC::WRECGenerator::generateNonGreedyQuantifier):
514         (JSC::WRECGenerator::generateGreedyQuantifier):
515         (JSC::WRECGenerator::generateCharacterClassInverted):
516         (JSC::WRECParser::parseQuantifier):
517         (JSC::WRECParser::parsePatternCharacterQualifier):
518         (JSC::WRECParser::parseCharacterClassQuantifier):
519         (JSC::WRECParser::parseBackreferenceQuantifier):
520         * wrec/WREC.h:
521         (JSC::Quantifier::):
522         (JSC::Quantifier::Quantifier):
523
524 2008-09-09  Jungshik Shin  <jungshik.shin@gmail.com>
525
526         Reviewed by Alexey Proskuryakov.
527
528         Try MIME charset names before trying IANA names 
529         ( https://bugs.webkit.org/show_bug.cgi?id=17537 )
530
531         * wtf/StringExtras.h: (strcasecmp): Added.
532
533 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
534
535         Reviewed by Mark Rowe.
536
537         Bug 20719: REGRESSION (r36135-36244): Hangs, then crashes after several seconds
538         <https://bugs.webkit.org/show_bug.cgi?id=20719>
539         <rdar://problem/6205787>
540
541         Fix a typo in the case-insensitive matching of character patterns.
542
543         * wrec/WREC.cpp:
544         (JSC::WRECGenerator::generatePatternCharacter):
545
546 2008-09-09  Maciej Stachowiak  <mjs@apple.com>
547
548         Reviewed by Sam Weinig.
549         
550         - allow polymorphic inline cache to handle Math object functions and possibly other similar things
551         
552         1.012x speedup on SunSpider.
553
554         * kjs/MathObject.cpp:
555         (JSC::MathObject::getOwnPropertySlot):
556         * kjs/lookup.cpp:
557         (JSC::setUpStaticFunctionSlot):
558         * kjs/lookup.h:
559         (JSC::getStaticPropertySlot):
560
561 2008-09-08  Sam Weinig  <sam@webkit.org>
562
563         Reviewed by Maciej Stachowiak and Oliver Hunt.
564
565         Split storage of properties out of the PropertyMap and into the JSObject
566         to allow sharing PropertyMap on the StructureID.  In order to get this
567         function correctly, the StructureID's transition mappings were changed to
568         transition based on property name and attribute pairs, instead of just
569         property name.
570
571         - Removes the single property optimization now that the PropertyMap is shared.
572           This will be replaced by in-lining some values on the JSObject.
573
574         This is a wash on Sunspider and a 6.7% win on the v8 test suite.
575
576         * JavaScriptCore.base.exp:
577         * VM/CTI.cpp:
578         (JSC::CTI::privateCompileGetByIdSelf): Get the storage directly off the JSObject.
579         (JSC::CTI::privateCompileGetByIdProto): Ditto.
580         (JSC::CTI::privateCompileGetByIdChain): Ditto.
581         (JSC::CTI::privateCompilePutByIdReplace): Ditto.
582         * kjs/JSObject.cpp:
583         (JSC::JSObject::mark): Mark the PropertyStorage.
584         (JSC::JSObject::put): Update to get the propertyMap of the StructureID.
585         (JSC::JSObject::deleteProperty): Ditto.
586         (JSC::JSObject::defineGetter): Return early if the property is already a getter/setter.
587         (JSC::JSObject::defineSetter): Ditto.
588         (JSC::JSObject::getPropertyAttributes): Update to get the propertyMap of the StructureID
589         (JSC::JSObject::getPropertyNames): Ditto.
590         (JSC::JSObject::removeDirect): Ditto.
591         * kjs/JSObject.h: Remove PropertyMap and add PropertyStorage.
592         (JSC::JSObject::propertyStorage): return the PropertyStorage.
593         (JSC::JSObject::getDirect): Update to get the propertyMap of the StructureID.
594         (JSC::JSObject::getDirectLocation): Ditto.
595         (JSC::JSObject::offsetForLocation): Compute location directly.
596         (JSC::JSObject::hasCustomProperties): Update to get the propertyMap of the StructureID.
597         (JSC::JSObject::hasGetterSetterProperties): Ditto.
598         (JSC::JSObject::getDirectOffset): Get by indexing into PropertyStorage.
599         (JSC::JSObject::putDirectOffset): Put by indexing into PropertyStorage.
600         (JSC::JSObject::getOwnPropertySlotForWrite): Update to get the propertyMap of the StructureID.
601         (JSC::JSObject::getOwnPropertySlot): Ditto.
602         (JSC::JSObject::putDirect): Move putting into the StructureID unless the property already exists.
603         * kjs/PropertyMap.cpp: Use the propertyStorage as the storage for the JSValues.
604         (JSC::PropertyMap::checkConsistency): 
605         (JSC::PropertyMap::operator=):
606         (JSC::PropertyMap::~PropertyMap):
607         (JSC::PropertyMap::get):
608         (JSC::PropertyMap::getLocation):
609         (JSC::PropertyMap::put):
610         (JSC::PropertyMap::getOffset):
611         (JSC::PropertyMap::insert):
612         (JSC::PropertyMap::expand):
613         (JSC::PropertyMap::rehash):
614         (JSC::PropertyMap::createTable):
615         (JSC::PropertyMap::resizePropertyStorage): Resize the storage to match the size of the map
616         (JSC::PropertyMap::remove):
617         (JSC::PropertyMap::getEnumerablePropertyNames):
618         * kjs/PropertyMap.h: 
619         (JSC::PropertyMapEntry::PropertyMapEntry):
620         (JSC::PropertyMap::isEmpty):
621         (JSC::PropertyMap::size):
622         (JSC::PropertyMap::makingCount):
623         (JSC::PropertyMap::PropertyMap):
624
625         * kjs/StructureID.cpp: 
626         (JSC::StructureID::addPropertyTransition): Transitions now are based off the property name
627         and attributes. 
628         (JSC::StructureID::toDictionaryTransition): Copy the map.
629         (JSC::StructureID::changePrototypeTransition): Copy the map.
630         (JSC::StructureID::getterSetterTransition): Copy the map.
631         (JSC::StructureID::~StructureID): 
632         * kjs/StructureID.h:
633         (JSC::TransitionTableHash::hash): Custom hash for transition map.
634         (JSC::TransitionTableHash::equal): Ditto.
635         (JSC::TransitionTableHashTraits::emptyValue): Custom traits for transition map
636         (JSC::TransitionTableHashTraits::constructDeletedValue): Ditto.
637         (JSC::TransitionTableHashTraits::isDeletedValue): Ditto.
638         (JSC::StructureID::propertyMap): Added.
639
640 2008-09-08  Oliver Hunt  <oliver@apple.com>
641
642         Reviewed by Mark Rowe.
643
644         Bug 20694: Slow Script error pops up when running Dromaeo tests
645
646         Correct error in timeout logic where execution tick count would
647         be reset to incorrect value due to incorrect offset and indirection.
648         Codegen for the slow script dialog was factored out into a separate
649         method (emitSlowScriptCheck) rather than having multiple copies of
650         the same code.  Also added calls to generate slow script checks
651         for loop_if_less and loop_if_true opcodes.
652
653         * VM/CTI.cpp:
654         (JSC::CTI::emitSlowScriptCheck):
655         (JSC::CTI::privateCompileMainPass):
656         (JSC::CTI::privateCompileSlowCases):
657         * VM/CTI.h:
658
659 2008-09-08  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
660
661         Reviewed by Maciej Stachowiak.
662
663         Remove references to the removed WRECompiler class.
664
665         * VM/Machine.h:
666         * wrec/WREC.h:
667
668 2008-09-08  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
669
670         Rubber-stamped by Mark Rowe.
671
672         Fix the build with CTI enabled but WREC disabled.
673
674         * VM/CTI.cpp:
675         * VM/CTI.h:
676
677 2008-09-08  Dan Bernstein  <mitz@apple.com>
678
679         - build fix
680
681         * kjs/nodes.h:
682         (JSC::StatementNode::):
683         (JSC::BlockNode::):
684
685 2008-09-08  Kevin McCullough  <kmccullough@apple.com>
686
687         Reviewed by Geoff.
688
689        <rdar://problem/6134407> Breakpoints in for loops, while loops or
690        conditions without curly braces don't break. (19306)
691        -Statement Lists already emit debug hooks but conditionals without
692        brackets are not lists.
693
694         * kjs/nodes.cpp:
695         (KJS::IfNode::emitCode):
696         (KJS::IfElseNode::emitCode):
697         (KJS::DoWhileNode::emitCode):
698         (KJS::WhileNode::emitCode):
699         (KJS::ForNode::emitCode):
700         (KJS::ForInNode::emitCode):
701         * kjs/nodes.h:
702         (KJS::StatementNode::):
703         (KJS::BlockNode::):
704
705 2008-09-08  Maciej Stachowiak  <mjs@apple.com>
706
707         Reviewed by Anders Carlsson.
708         
709         - Cache the code generated for eval to speed up SunSpider and web sites
710         https://bugs.webkit.org/show_bug.cgi?id=20718
711         
712         1.052x on SunSpider
713         2.29x on date-format-tofte
714         
715         Lots of real sites seem to get many hits on this cache as well,
716         including GMail, Google Spreadsheets, Slate and Digg (the last of
717         these gets over 100 hits on initial page load).
718
719         * VM/CodeBlock.h:
720         (JSC::EvalCodeCache::get):
721         * VM/Machine.cpp:
722         (JSC::Machine::callEval):
723         (JSC::Machine::privateExecute):
724         (JSC::Machine::cti_op_call_eval):
725         * VM/Machine.h:
726
727 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
728
729         Reviewed by Oliver Hunt.
730
731         Bug 20711: Change KJS prefix on preprocessor macros to JSC
732         <https://bugs.webkit.org/show_bug.cgi?id=20711>
733
734         * kjs/CommonIdentifiers.cpp:
735         (JSC::CommonIdentifiers::CommonIdentifiers):
736         * kjs/CommonIdentifiers.h:
737         * kjs/PropertySlot.h:
738         (JSC::PropertySlot::getValue):
739         (JSC::PropertySlot::putValue):
740         (JSC::PropertySlot::setValueSlot):
741         (JSC::PropertySlot::setValue):
742         (JSC::PropertySlot::setRegisterSlot):
743         * kjs/lookup.h:
744         * kjs/nodes.cpp:
745         * kjs/nodes.h:
746         (JSC::Node::):
747         (JSC::ExpressionNode::):
748         (JSC::StatementNode::):
749         (JSC::NullNode::):
750         (JSC::BooleanNode::):
751         (JSC::NumberNode::):
752         (JSC::ImmediateNumberNode::):
753         (JSC::StringNode::):
754         (JSC::RegExpNode::):
755         (JSC::ThisNode::):
756         (JSC::ResolveNode::):
757         (JSC::ElementNode::):
758         (JSC::ArrayNode::):
759         (JSC::PropertyNode::):
760         (JSC::PropertyListNode::):
761         (JSC::ObjectLiteralNode::):
762         (JSC::BracketAccessorNode::):
763         (JSC::DotAccessorNode::):
764         (JSC::ArgumentListNode::):
765         (JSC::ArgumentsNode::):
766         (JSC::NewExprNode::):
767         (JSC::EvalFunctionCallNode::):
768         (JSC::FunctionCallValueNode::):
769         (JSC::FunctionCallResolveNode::):
770         (JSC::FunctionCallBracketNode::):
771         (JSC::FunctionCallDotNode::):
772         (JSC::PrePostResolveNode::):
773         (JSC::PostfixResolveNode::):
774         (JSC::PostfixBracketNode::):
775         (JSC::PostfixDotNode::):
776         (JSC::PostfixErrorNode::):
777         (JSC::DeleteResolveNode::):
778         (JSC::DeleteBracketNode::):
779         (JSC::DeleteDotNode::):
780         (JSC::DeleteValueNode::):
781         (JSC::VoidNode::):
782         (JSC::TypeOfResolveNode::):
783         (JSC::TypeOfValueNode::):
784         (JSC::PrefixResolveNode::):
785         (JSC::PrefixBracketNode::):
786         (JSC::PrefixDotNode::):
787         (JSC::PrefixErrorNode::):
788         (JSC::UnaryPlusNode::):
789         (JSC::NegateNode::):
790         (JSC::BitwiseNotNode::):
791         (JSC::LogicalNotNode::):
792         (JSC::MultNode::):
793         (JSC::DivNode::):
794         (JSC::ModNode::):
795         (JSC::AddNode::):
796         (JSC::SubNode::):
797         (JSC::LeftShiftNode::):
798         (JSC::RightShiftNode::):
799         (JSC::UnsignedRightShiftNode::):
800         (JSC::LessNode::):
801         (JSC::GreaterNode::):
802         (JSC::LessEqNode::):
803         (JSC::GreaterEqNode::):
804         (JSC::ThrowableBinaryOpNode::):
805         (JSC::InstanceOfNode::):
806         (JSC::InNode::):
807         (JSC::EqualNode::):
808         (JSC::NotEqualNode::):
809         (JSC::StrictEqualNode::):
810         (JSC::NotStrictEqualNode::):
811         (JSC::BitAndNode::):
812         (JSC::BitOrNode::):
813         (JSC::BitXOrNode::):
814         (JSC::LogicalOpNode::):
815         (JSC::ConditionalNode::):
816         (JSC::ReadModifyResolveNode::):
817         (JSC::AssignResolveNode::):
818         (JSC::ReadModifyBracketNode::):
819         (JSC::AssignBracketNode::):
820         (JSC::AssignDotNode::):
821         (JSC::ReadModifyDotNode::):
822         (JSC::AssignErrorNode::):
823         (JSC::CommaNode::):
824         (JSC::VarDeclCommaNode::):
825         (JSC::ConstDeclNode::):
826         (JSC::ConstStatementNode::):
827         (JSC::EmptyStatementNode::):
828         (JSC::DebuggerStatementNode::):
829         (JSC::ExprStatementNode::):
830         (JSC::VarStatementNode::):
831         (JSC::IfNode::):
832         (JSC::IfElseNode::):
833         (JSC::DoWhileNode::):
834         (JSC::WhileNode::):
835         (JSC::ForNode::):
836         (JSC::ContinueNode::):
837         (JSC::BreakNode::):
838         (JSC::ReturnNode::):
839         (JSC::WithNode::):
840         (JSC::LabelNode::):
841         (JSC::ThrowNode::):
842         (JSC::TryNode::):
843         (JSC::ParameterNode::):
844         (JSC::ScopeNode::):
845         (JSC::ProgramNode::):
846         (JSC::EvalNode::):
847         (JSC::FunctionBodyNode::):
848         (JSC::FuncExprNode::):
849         (JSC::FuncDeclNode::):
850         (JSC::CaseClauseNode::):
851         (JSC::ClauseListNode::):
852         (JSC::CaseBlockNode::):
853         (JSC::SwitchNode::):
854
855 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
856
857         Reviewed by Maciej Stachowiak.
858
859         Bug 20704: Replace the KJS namespace
860         <https://bugs.webkit.org/show_bug.cgi?id=20704>
861
862         Rename the KJS namespace to JSC. There are still some uses of KJS in
863         preprocessor macros and comments, but these will also be changed some
864         time in the near future.
865
866         * API/APICast.h:
867         (toJS):
868         (toRef):
869         (toGlobalRef):
870         * API/JSBase.cpp:
871         * API/JSCallbackConstructor.cpp:
872         * API/JSCallbackConstructor.h:
873         * API/JSCallbackFunction.cpp:
874         * API/JSCallbackFunction.h:
875         * API/JSCallbackObject.cpp:
876         * API/JSCallbackObject.h:
877         * API/JSCallbackObjectFunctions.h:
878         * API/JSClassRef.cpp:
879         (OpaqueJSClass::staticValues):
880         (OpaqueJSClass::staticFunctions):
881         * API/JSClassRef.h:
882         * API/JSContextRef.cpp:
883         * API/JSObjectRef.cpp:
884         * API/JSProfilerPrivate.cpp:
885         * API/JSStringRef.cpp:
886         * API/JSValueRef.cpp:
887         (JSValueGetType):
888         * API/OpaqueJSString.cpp:
889         * API/OpaqueJSString.h:
890         * JavaScriptCore.Debug.exp:
891         * JavaScriptCore.base.exp:
892         * VM/CTI.cpp:
893         (JSC::):
894         * VM/CTI.h:
895         * VM/CodeBlock.cpp:
896         * VM/CodeBlock.h:
897         * VM/CodeGenerator.cpp:
898         * VM/CodeGenerator.h:
899         * VM/ExceptionHelpers.cpp:
900         * VM/ExceptionHelpers.h:
901         * VM/Instruction.h:
902         * VM/JSPropertyNameIterator.cpp:
903         * VM/JSPropertyNameIterator.h:
904         * VM/LabelID.h:
905         * VM/Machine.cpp:
906         * VM/Machine.h:
907         * VM/Opcode.cpp:
908         * VM/Opcode.h:
909         * VM/Register.h:
910         (WTF::):
911         * VM/RegisterFile.cpp:
912         * VM/RegisterFile.h:
913         * VM/RegisterID.h:
914         (WTF::):
915         * VM/SamplingTool.cpp:
916         * VM/SamplingTool.h:
917         * VM/SegmentedVector.h:
918         * kjs/ArgList.cpp:
919         * kjs/ArgList.h:
920         * kjs/Arguments.cpp:
921         * kjs/Arguments.h:
922         * kjs/ArrayConstructor.cpp:
923         * kjs/ArrayConstructor.h:
924         * kjs/ArrayPrototype.cpp:
925         * kjs/ArrayPrototype.h:
926         * kjs/BatchedTransitionOptimizer.h:
927         * kjs/BooleanConstructor.cpp:
928         * kjs/BooleanConstructor.h:
929         * kjs/BooleanObject.cpp:
930         * kjs/BooleanObject.h:
931         * kjs/BooleanPrototype.cpp:
932         * kjs/BooleanPrototype.h:
933         * kjs/CallData.cpp:
934         * kjs/CallData.h:
935         * kjs/ClassInfo.h:
936         * kjs/CommonIdentifiers.cpp:
937         * kjs/CommonIdentifiers.h:
938         * kjs/ConstructData.cpp:
939         * kjs/ConstructData.h:
940         * kjs/DateConstructor.cpp:
941         * kjs/DateConstructor.h:
942         * kjs/DateInstance.cpp:
943         (JSC::DateInstance::msToGregorianDateTime):
944         * kjs/DateInstance.h:
945         * kjs/DateMath.cpp:
946         * kjs/DateMath.h:
947         * kjs/DatePrototype.cpp:
948         * kjs/DatePrototype.h:
949         * kjs/DebuggerCallFrame.cpp:
950         * kjs/DebuggerCallFrame.h:
951         * kjs/Error.cpp:
952         * kjs/Error.h:
953         * kjs/ErrorConstructor.cpp:
954         * kjs/ErrorConstructor.h:
955         * kjs/ErrorInstance.cpp:
956         * kjs/ErrorInstance.h:
957         * kjs/ErrorPrototype.cpp:
958         * kjs/ErrorPrototype.h:
959         * kjs/ExecState.cpp:
960         * kjs/ExecState.h:
961         * kjs/FunctionConstructor.cpp:
962         * kjs/FunctionConstructor.h:
963         * kjs/FunctionPrototype.cpp:
964         * kjs/FunctionPrototype.h:
965         * kjs/GetterSetter.cpp:
966         * kjs/GetterSetter.h:
967         * kjs/GlobalEvalFunction.cpp:
968         * kjs/GlobalEvalFunction.h:
969         * kjs/IndexToNameMap.cpp:
970         * kjs/IndexToNameMap.h:
971         * kjs/InitializeThreading.cpp:
972         * kjs/InitializeThreading.h:
973         * kjs/InternalFunction.cpp:
974         * kjs/InternalFunction.h:
975         (JSC::InternalFunction::InternalFunction):
976         * kjs/JSActivation.cpp:
977         * kjs/JSActivation.h:
978         * kjs/JSArray.cpp:
979         * kjs/JSArray.h:
980         * kjs/JSCell.cpp:
981         * kjs/JSCell.h:
982         * kjs/JSFunction.cpp:
983         * kjs/JSFunction.h:
984         (JSC::JSFunction::JSFunction):
985         * kjs/JSGlobalData.cpp:
986         (JSC::JSGlobalData::JSGlobalData):
987         * kjs/JSGlobalData.h:
988         * kjs/JSGlobalObject.cpp:
989         * kjs/JSGlobalObject.h:
990         * kjs/JSGlobalObjectFunctions.cpp:
991         * kjs/JSGlobalObjectFunctions.h:
992         * kjs/JSImmediate.cpp:
993         * kjs/JSImmediate.h:
994         * kjs/JSLock.cpp:
995         * kjs/JSLock.h:
996         * kjs/JSNotAnObject.cpp:
997         * kjs/JSNotAnObject.h:
998         * kjs/JSNumberCell.cpp:
999         * kjs/JSNumberCell.h:
1000         * kjs/JSObject.cpp:
1001         * kjs/JSObject.h:
1002         * kjs/JSStaticScopeObject.cpp:
1003         * kjs/JSStaticScopeObject.h:
1004         * kjs/JSString.cpp:
1005         * kjs/JSString.h:
1006         * kjs/JSType.h:
1007         * kjs/JSValue.cpp:
1008         * kjs/JSValue.h:
1009         * kjs/JSVariableObject.cpp:
1010         * kjs/JSVariableObject.h:
1011         * kjs/JSWrapperObject.cpp:
1012         * kjs/JSWrapperObject.h:
1013         * kjs/LabelStack.cpp:
1014         * kjs/LabelStack.h:
1015         * kjs/MathObject.cpp:
1016         * kjs/MathObject.h:
1017         * kjs/NativeErrorConstructor.cpp:
1018         * kjs/NativeErrorConstructor.h:
1019         * kjs/NativeErrorPrototype.cpp:
1020         * kjs/NativeErrorPrototype.h:
1021         * kjs/NodeInfo.h:
1022         * kjs/NumberConstructor.cpp:
1023         * kjs/NumberConstructor.h:
1024         * kjs/NumberObject.cpp:
1025         * kjs/NumberObject.h:
1026         * kjs/NumberPrototype.cpp:
1027         * kjs/NumberPrototype.h:
1028         * kjs/ObjectConstructor.cpp:
1029         * kjs/ObjectConstructor.h:
1030         * kjs/ObjectPrototype.cpp:
1031         * kjs/ObjectPrototype.h:
1032         * kjs/Parser.cpp:
1033         * kjs/Parser.h:
1034         * kjs/PropertyMap.cpp:
1035         (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger):
1036         * kjs/PropertyMap.h:
1037         * kjs/PropertyNameArray.cpp:
1038         * kjs/PropertyNameArray.h:
1039         * kjs/PropertySlot.cpp:
1040         * kjs/PropertySlot.h:
1041         * kjs/PrototypeFunction.cpp:
1042         * kjs/PrototypeFunction.h:
1043         * kjs/PutPropertySlot.h:
1044         * kjs/RegExpConstructor.cpp:
1045         * kjs/RegExpConstructor.h:
1046         * kjs/RegExpObject.cpp:
1047         * kjs/RegExpObject.h:
1048         * kjs/RegExpPrototype.cpp:
1049         * kjs/RegExpPrototype.h:
1050         * kjs/ScopeChain.cpp:
1051         * kjs/ScopeChain.h:
1052         * kjs/ScopeChainMark.h:
1053         * kjs/Shell.cpp:
1054         (jscmain):
1055         * kjs/SmallStrings.cpp:
1056         * kjs/SmallStrings.h:
1057         * kjs/SourceProvider.h:
1058         * kjs/SourceRange.h:
1059         * kjs/StringConstructor.cpp:
1060         * kjs/StringConstructor.h:
1061         * kjs/StringObject.cpp:
1062         * kjs/StringObject.h:
1063         * kjs/StringObjectThatMasqueradesAsUndefined.h:
1064         * kjs/StringPrototype.cpp:
1065         * kjs/StringPrototype.h:
1066         * kjs/StructureID.cpp:
1067         * kjs/StructureID.h:
1068         * kjs/SymbolTable.h:
1069         * kjs/collector.cpp:
1070         * kjs/collector.h:
1071         * kjs/completion.h:
1072         * kjs/create_hash_table:
1073         * kjs/debugger.cpp:
1074         * kjs/debugger.h:
1075         * kjs/dtoa.cpp:
1076         * kjs/dtoa.h:
1077         * kjs/grammar.y:
1078         * kjs/identifier.cpp:
1079         * kjs/identifier.h:
1080         (JSC::Identifier::equal):
1081         * kjs/interpreter.cpp:
1082         * kjs/interpreter.h:
1083         * kjs/lexer.cpp:
1084         (JSC::Lexer::Lexer):
1085         (JSC::Lexer::clear):
1086         (JSC::Lexer::makeIdentifier):
1087         * kjs/lexer.h:
1088         * kjs/lookup.cpp:
1089         * kjs/lookup.h:
1090         * kjs/nodes.cpp:
1091         * kjs/nodes.h:
1092         * kjs/nodes2string.cpp:
1093         * kjs/operations.cpp:
1094         * kjs/operations.h:
1095         * kjs/protect.h:
1096         * kjs/regexp.cpp:
1097         * kjs/regexp.h:
1098         * kjs/ustring.cpp:
1099         * kjs/ustring.h:
1100         (JSC::operator!=):
1101         (JSC::IdentifierRepHash::hash):
1102         (WTF::):
1103         * masm/MacroAssembler.h:
1104         * masm/MacroAssemblerWin.cpp:
1105         * masm/X86Assembler.h:
1106         * pcre/pcre_exec.cpp:
1107         * profiler/CallIdentifier.h:
1108         (WTF::):
1109         * profiler/HeavyProfile.cpp:
1110         * profiler/HeavyProfile.h:
1111         * profiler/Profile.cpp:
1112         * profiler/Profile.h:
1113         * profiler/ProfileGenerator.cpp:
1114         * profiler/ProfileGenerator.h:
1115         * profiler/ProfileNode.cpp:
1116         * profiler/ProfileNode.h:
1117         * profiler/Profiler.cpp:
1118         * profiler/Profiler.h:
1119         * profiler/TreeProfile.cpp:
1120         * profiler/TreeProfile.h:
1121         * wrec/WREC.cpp:
1122         * wrec/WREC.h:
1123         * wtf/AVLTree.h:
1124
1125 2008-09-07  Maciej Stachowiak  <mjs@apple.com>
1126
1127         Reviewed by Dan Bernstein.
1128         
1129         - rename IA32MacroAssembler class to X86Assembler
1130         
1131         We otherwise call the platform X86, and also, I don't see any macros.
1132
1133         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1134         * JavaScriptCore.xcodeproj/project.pbxproj:
1135         * masm/IA32MacroAsm.h: Removed.
1136         * masm/MacroAssembler.h:
1137         (KJS::MacroAssembler::MacroAssembler):
1138         * masm/MacroAssemblerWin.cpp:
1139         (KJS::MacroAssembler::emitRestoreArgumentReference):
1140         * masm/X86Assembler.h: Copied from masm/IA32MacroAsm.h.
1141         (KJS::X86Assembler::X86Assembler):
1142         * wrec/WREC.cpp:
1143         (KJS::WRECGenerator::generateNonGreedyQuantifier):
1144         (KJS::WRECGenerator::generateGreedyQuantifier):
1145         (KJS::WRECGenerator::generateParentheses):
1146         (KJS::WRECGenerator::generateBackreference):
1147         (KJS::WRECGenerator::gernerateDisjunction):
1148         * wrec/WREC.h:
1149
1150 2008-09-07  Cameron Zwarich  <cwzwarich@webkit.org>
1151
1152         Not reviewed.
1153
1154         Visual C++ seems to have some odd casting rules, so just convert the
1155         offending cast back to a C-style cast for now.
1156
1157         * kjs/collector.cpp:
1158         (KJS::otherThreadStackPointer):
1159
1160 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1161
1162         Reviewed by Mark Rowe.
1163
1164         Attempt to fix the Windows build by using a const_cast to cast regs.Esp
1165         to a uintptr_t instead of a reinterpret_cast.
1166
1167         * kjs/collector.cpp:
1168         (KJS::otherThreadStackPointer):
1169
1170 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1171
1172         Reviewed by Sam Weinig.
1173
1174         Remove C-style casts from kjs/collector.cpp.
1175
1176         * kjs/collector.cpp:
1177         (KJS::Heap::heapAllocate):
1178         (KJS::currentThreadStackBase):
1179         (KJS::Heap::markConservatively):
1180         (KJS::otherThreadStackPointer):
1181         (KJS::Heap::markOtherThreadConservatively):
1182         (KJS::Heap::sweep):
1183
1184 2008-09-07  Mark Rowe  <mrowe@apple.com>
1185
1186         Build fix for the debug variant.
1187
1188         * DerivedSources.make: Also use the .Debug.exp exports file when building the debug variant.
1189
1190 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1191
1192         Reviewed by Timothy Hatcher.
1193
1194         Remove C-style casts from the CTI code.
1195
1196         * VM/CTI.cpp:
1197         (KJS::CTI::emitGetArg):
1198         (KJS::CTI::emitGetPutArg):
1199         (KJS::ctiRepatchCallByReturnAddress):
1200         (KJS::CTI::compileOpCall):
1201         (KJS::CTI::privateCompileMainPass):
1202         (KJS::CTI::privateCompileGetByIdSelf):
1203         (KJS::CTI::privateCompileGetByIdProto):
1204         (KJS::CTI::privateCompileGetByIdChain):
1205         (KJS::CTI::privateCompilePutByIdReplace):
1206         (KJS::CTI::privateArrayLengthTrampoline):
1207         (KJS::CTI::privateStringLengthTrampoline):
1208
1209 === End merge of squirrelfish-extreme ===
1210
1211 2008-09-06  Gavin Barraclough  <barraclough@apple.com>
1212
1213         Reviewed by Sam Weinig. Adapted somewhat by Maciej Stachowiak.
1214         
1215         - refactor WREC to share more of the JIT infrastructure with CTI
1216
1217         * VM/CTI.cpp:
1218         (KJS::CTI::emitGetArg):
1219         (KJS::CTI::emitGetPutArg):
1220         (KJS::CTI::emitPutArg):
1221         (KJS::CTI::emitPutArgConstant):
1222         (KJS::CTI::emitPutCTIParam):
1223         (KJS::CTI::emitGetCTIParam):
1224         (KJS::CTI::emitPutToCallFrameHeader):
1225         (KJS::CTI::emitGetFromCallFrameHeader):
1226         (KJS::CTI::emitPutResult):
1227         (KJS::CTI::emitDebugExceptionCheck):
1228         (KJS::CTI::emitJumpSlowCaseIfNotImm):
1229         (KJS::CTI::emitJumpSlowCaseIfNotImms):
1230         (KJS::CTI::emitFastArithDeTagImmediate):
1231         (KJS::CTI::emitFastArithReTagImmediate):
1232         (KJS::CTI::emitFastArithPotentiallyReTagImmediate):
1233         (KJS::CTI::emitFastArithImmToInt):
1234         (KJS::CTI::emitFastArithIntToImmOrSlowCase):
1235         (KJS::CTI::emitFastArithIntToImmNoCheck):
1236         (KJS::CTI::CTI):
1237         (KJS::CTI::compileOpCall):
1238         (KJS::CTI::privateCompileMainPass):
1239         (KJS::CTI::privateCompileSlowCases):
1240         (KJS::CTI::privateCompile):
1241         (KJS::CTI::privateCompileGetByIdSelf):
1242         (KJS::CTI::privateCompileGetByIdProto):
1243         (KJS::CTI::privateCompileGetByIdChain):
1244         (KJS::CTI::privateCompilePutByIdReplace):
1245         (KJS::CTI::privateArrayLengthTrampoline):
1246         (KJS::CTI::privateStringLengthTrampoline):
1247         (KJS::CTI::compileRegExp):
1248         * VM/CTI.h:
1249         (KJS::CallRecord::CallRecord):
1250         (KJS::JmpTable::JmpTable):
1251         (KJS::SlowCaseEntry::SlowCaseEntry):
1252         (KJS::CTI::JSRInfo::JSRInfo):
1253         * kjs/regexp.cpp:
1254         (KJS::RegExp::RegExp):
1255         * wrec/WREC.cpp:
1256         (KJS::GenerateParenthesesNonGreedyFunctor::GenerateParenthesesNonGreedyFunctor):
1257         (KJS::GeneratePatternCharacterFunctor::generateAtom):
1258         (KJS::GeneratePatternCharacterFunctor::backtrack):
1259         (KJS::GenerateCharacterClassFunctor::generateAtom):
1260         (KJS::GenerateCharacterClassFunctor::backtrack):
1261         (KJS::GenerateBackreferenceFunctor::generateAtom):
1262         (KJS::GenerateBackreferenceFunctor::backtrack):
1263         (KJS::GenerateParenthesesNonGreedyFunctor::generateAtom):
1264         (KJS::GenerateParenthesesNonGreedyFunctor::backtrack):
1265         (KJS::WRECGenerate::generateBacktrack1):
1266         (KJS::WRECGenerate::generateBacktrackBackreference):
1267         (KJS::WRECGenerate::generateBackreferenceQuantifier):
1268         (KJS::WRECGenerate::generateNonGreedyQuantifier):
1269         (KJS::WRECGenerate::generateGreedyQuantifier):
1270         (KJS::WRECGenerate::generatePatternCharacter):
1271         (KJS::WRECGenerate::generateCharacterClassInvertedRange):
1272         (KJS::WRECGenerate::generateCharacterClassInverted):
1273         (KJS::WRECGenerate::generateCharacterClass):
1274         (KJS::WRECGenerate::generateParentheses):
1275         (KJS::WRECGenerate::generateParenthesesNonGreedy):
1276         (KJS::WRECGenerate::gererateParenthesesResetTrampoline):
1277         (KJS::WRECGenerate::generateAssertionBOL):
1278         (KJS::WRECGenerate::generateAssertionEOL):
1279         (KJS::WRECGenerate::generateAssertionWordBoundary):
1280         (KJS::WRECGenerate::generateBackreference):
1281         (KJS::WRECGenerate::gernerateDisjunction):
1282         (KJS::WRECGenerate::terminateDisjunction):
1283         (KJS::WRECParser::parseGreedyQuantifier):
1284         (KJS::WRECParser::parseQuantifier):
1285         (KJS::WRECParser::parsePatternCharacterQualifier):
1286         (KJS::WRECParser::parseCharacterClassQuantifier):
1287         (KJS::WRECParser::parseBackreferenceQuantifier):
1288         (KJS::WRECParser::parseParentheses):
1289         (KJS::WRECParser::parseCharacterClass):
1290         (KJS::WRECParser::parseOctalEscape):
1291         (KJS::WRECParser::parseEscape):
1292         (KJS::WRECParser::parseTerm):
1293         (KJS::WRECParser::parseDisjunction):
1294         * wrec/WREC.h:
1295         (KJS::WRECGenerate::WRECGenerate):
1296         (KJS::WRECParser::):
1297         (KJS::WRECParser::WRECParser):
1298         (KJS::WRECParser::parseAlternative):
1299         (KJS::WRECParser::isEndOfPattern):
1300
1301 2008-09-06  Oliver Hunt  <oliver@apple.com>
1302
1303         Reviewed by NOBODY (Build fix).
1304
1305         Fix the sampler build.
1306
1307         * VM/SamplingTool.h:
1308
1309 2008-09-06  Oliver Hunt  <oliver@apple.com>
1310
1311         Reviewed by Maciej Stachowiak.
1312
1313         Jump through the necessary hoops required to make MSVC cooperate with SFX
1314
1315         We now explicitly declare the calling convention on all cti_op_* cfunctions,
1316         and return int instead of bool where appropriate (despite the cdecl calling
1317         convention seems to state MSVC generates code that returns the result value
1318         through ecx).  SFX behaves slightly differently under MSVC, specifically it
1319         stores the base argument address for the cti_op_* functions in the first
1320         argument, and then does the required stack manipulation through that pointer.
1321         This is necessary as MSVC's optimisations assume they have complete control
1322         of the stack, and periodically elide our stack manipulations, or move
1323         values in unexpected ways.  MSVC also frequently produces tail calls which may
1324         clobber the first argument, so the MSVC path is slightly less efficient due
1325         to the need to restore it.
1326
1327         * JavaScriptCore.xcodeproj/project.pbxproj:
1328         * VM/CTI.cpp:
1329         (KJS::):
1330         (KJS::CTI::compileOpCall):
1331         (KJS::CTI::privateCompileMainPass):
1332         (KJS::CTI::privateCompileSlowCases):
1333         * VM/CTI.h:
1334         * VM/Machine.cpp:
1335         * VM/Machine.h:
1336         * masm/MacroAssembler.h:
1337         (KJS::MacroAssembler::emitConvertToFastCall):
1338         * masm/MacroAssemblerIA32GCC.cpp: Removed.
1339            For performance reasons we need these no-op functions to be inlined.
1340
1341         * masm/MacroAssemblerWin.cpp:
1342         (KJS::MacroAssembler::emitRestoreArgumentReference):
1343         * wtf/Platform.h:
1344
1345 2008-09-05  Geoffrey Garen  <ggaren@apple.com>
1346
1347         Reviewed by Maciej Stachowiak, or maybe the other way around.
1348         
1349         Added the ability to coalesce JITCode buffer grow operations by first
1350         growing the buffer and then executing unchecked puts to it.
1351         
1352         About a 2% speedup on date-format-tofte.
1353
1354         * VM/CTI.cpp:
1355         (KJS::CTI::compileOpCall):
1356         * masm/IA32MacroAsm.h:
1357         (KJS::JITCodeBuffer::ensureSpace):
1358         (KJS::JITCodeBuffer::putByteUnchecked):
1359         (KJS::JITCodeBuffer::putByte):
1360         (KJS::JITCodeBuffer::putShortUnchecked):
1361         (KJS::JITCodeBuffer::putShort):
1362         (KJS::JITCodeBuffer::putIntUnchecked):
1363         (KJS::JITCodeBuffer::putInt):
1364         (KJS::IA32MacroAssembler::emitTestl_i32r):
1365         (KJS::IA32MacroAssembler::emitMovl_mr):
1366         (KJS::IA32MacroAssembler::emitMovl_rm):
1367         (KJS::IA32MacroAssembler::emitMovl_i32m):
1368         (KJS::IA32MacroAssembler::emitUnlinkedJe):
1369         (KJS::IA32MacroAssembler::emitModRm_rr):
1370         (KJS::IA32MacroAssembler::emitModRm_rr_Unchecked):
1371         (KJS::IA32MacroAssembler::emitModRm_rm_Unchecked):
1372         (KJS::IA32MacroAssembler::emitModRm_rm):
1373         (KJS::IA32MacroAssembler::emitModRm_opr):
1374         (KJS::IA32MacroAssembler::emitModRm_opr_Unchecked):
1375         (KJS::IA32MacroAssembler::emitModRm_opm_Unchecked):
1376
1377 2008-09-05  Mark Rowe  <mrowe@apple.com>
1378
1379         Reviewed by Sam Weinig.
1380
1381         Disable WREC and CTI on platforms that we have not yet had a chance to test with.
1382
1383         * wtf/Platform.h:
1384
1385 2008-09-05  Geoffrey Garen  <ggaren@apple.com>
1386
1387         Reviewed by Sam Weinig.
1388         
1389         Use jo instead of a mask compare when fetching array.length and
1390         string.length. 4% speedup on array.length / string.length torture
1391         test.
1392
1393         * VM/CTI.cpp:
1394         (KJS::CTI::privateArrayLengthTrampoline):
1395         (KJS::CTI::privateStringLengthTrampoline):
1396
1397 2008-09-05  Geoffrey Garen  <ggaren@apple.com>
1398
1399         Reviewed by Sam Weinig.
1400
1401         Removed a CTI compilation pass by recording labels during bytecode
1402         generation. This is more to reduce complexity than it is to improve
1403         performance.
1404
1405         SunSpider reports no change.
1406
1407         CodeBlock now keeps a "labels" set, which holds the offsets of all the
1408         instructions that can be jumped to.
1409
1410         * VM/CTI.cpp: Nixed a pass.
1411
1412         * VM/CodeBlock.h: Added a "labels" set.
1413
1414         * VM/LabelID.h: No need for a special LableID for holding jump
1415         destinations, since the CodeBlock now knows all jump destinations.
1416
1417         * wtf/HashTraits.h: New hash traits to accomodate putting offset 0 in
1418         the set.
1419
1420         * kjs/nodes.cpp:
1421         (KJS::TryNode::emitCode): Emit a dummy label to record sret targets.
1422
1423 2008-09-05  Mark Rowe  <mrowe@apple.com>
1424
1425         Reviewed by Oliver Hunt and Gavin Barraclough.
1426
1427         Move the JITCodeBuffer onto Machine and remove the static variables.
1428
1429         * VM/CTI.cpp: Initialize m_jit with the Machine's code buffer.
1430         * VM/Machine.cpp:
1431         (KJS::Machine::Machine): Allocate a JITCodeBuffer.
1432         * VM/Machine.h:
1433         * kjs/RegExpConstructor.cpp:
1434         (KJS::constructRegExp): Pass the ExecState through.
1435         * kjs/RegExpPrototype.cpp:
1436         (KJS::regExpProtoFuncCompile): Ditto.
1437         * kjs/StringPrototype.cpp:
1438         (KJS::stringProtoFuncMatch): Ditto.
1439         (KJS::stringProtoFuncSearch): Ditto.
1440         * kjs/nodes.cpp:
1441         (KJS::RegExpNode::emitCode): Compile the pattern at code generation time
1442         so that we have access to an ExecState.
1443         * kjs/nodes.h:
1444         (KJS::RegExpNode::):
1445         * kjs/nodes2string.cpp:
1446         * kjs/regexp.cpp:
1447         (KJS::RegExp::RegExp): Pass the ExecState through.
1448         (KJS::RegExp::create): Ditto.
1449         * kjs/regexp.h:
1450         * masm/IA32MacroAsm.h:
1451         (KJS::IA32MacroAssembler::IA32MacroAssembler): Reset the JITCodeBuffer when we are
1452         constructed.
1453         * wrec/WREC.cpp:
1454         (KJS::WRECompiler::compile): Retrieve the JITCodeBuffer from the Machine.
1455         * wrec/WREC.h:
1456
1457 2008-09-05  Mark Rowe  <mrowe@apple.com>
1458
1459         Reviewed by Oliver Hunt and Gavin Barraclough.
1460
1461         Fix the build when CTI is disabled.
1462
1463         * VM/CodeBlock.cpp:
1464         (KJS::CodeBlock::~CodeBlock):
1465         * VM/CodeGenerator.cpp:
1466         (KJS::prepareJumpTableForStringSwitch):
1467         * VM/Machine.cpp:
1468         (KJS::Machine::Machine):
1469         (KJS::Machine::~Machine):
1470
1471 2008-09-05  Gavin Barraclough  <barraclough@apple.com>
1472
1473         Reviewed by Mark Rowe.
1474
1475         Fix some windows abi issues.
1476
1477         * VM/CTI.cpp:
1478         (KJS::CTI::privateCompileMainPass):
1479         (KJS::CTI::privateCompileSlowCases):
1480         * VM/CTI.h:
1481         (KJS::CallRecord::CallRecord):
1482         (KJS::):
1483         * VM/Machine.cpp:
1484         (KJS::Machine::cti_op_resolve_func):
1485         (KJS::Machine::cti_op_post_inc):
1486         (KJS::Machine::cti_op_resolve_with_base):
1487         (KJS::Machine::cti_op_post_dec):
1488         * VM/Machine.h:
1489
1490 2008-09-05  Mark Rowe  <mrowe@apple.com>
1491
1492         Reviewed by Sam Weinig.
1493
1494         Fix ecma/FunctionObjects/15.3.5.3.js after I broke it in r93.
1495
1496         * VM/Machine.cpp:
1497         (KJS::Machine::cti_op_call_NotJSFunction): Restore m_callFrame to the correct value after making the native call.
1498         (KJS::Machine::cti_op_construct_NotJSConstruct): Ditto.
1499
1500 2008-09-04  Mark Rowe  <mrowe@apple.com>
1501
1502         Reviewed by Sam Weinig.
1503
1504         Fix fast/dom/Window/console-functions.html.
1505
1506         The call frame on the ExecState was not being updated on calls into native functions.  This meant that functions
1507         such as console.log would use the line number of the last JS function on the call stack.
1508
1509         * VM/Machine.cpp:
1510         (KJS::Machine::cti_op_call_NotJSFunction): Update the ExecState's call frame before making a native function call,
1511         and restore it when the function is done.
1512         (KJS::Machine::cti_op_construct_NotJSConstruct): Ditto.
1513
1514 2008-09-05  Oliver Hunt  <oliver@apple.com>
1515
1516         Start bringing up SFX on windows.
1517
1518         Reviewed by Mark Rowe and Sam Weinig
1519
1520         Start doing the work to bring up SFX on windows.  Initially
1521         just working on WREC, as it does not make any calls so reduces
1522         the amount of code that needs to be corrected.
1523         
1524         Start abstracting the CTI JIT codegen engine.
1525
1526         * ChangeLog:
1527         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1528         * JavaScriptCore.xcodeproj/project.pbxproj:
1529         * VM/CTI.cpp:
1530         * masm/IA32MacroAsm.h:
1531         * masm/MacroAssembler.h: Added.
1532         (KJS::MacroAssembler::MacroAssembler):
1533         * masm/MacroAssemblerIA32GCC.cpp: Added.
1534         (KJS::MacroAssembler::emitConvertToFastCall):
1535         * masm/MacroAssemblerWin.cpp: Added.
1536         (KJS::MacroAssembler::emitConvertToFastCall):
1537         * wrec/WREC.cpp:
1538         (KJS::WRECompiler::parseGreedyQuantifier):
1539         (KJS::WRECompiler::parseCharacterClass):
1540         (KJS::WRECompiler::parseEscape):
1541         (KJS::WRECompiler::compilePattern):
1542         * wrec/WREC.h:
1543
1544 2008-09-04  Gavin Barraclough  <barraclough@apple.com>
1545
1546         Reviewed by Sam Weinig.
1547
1548         Support for slow scripts (timeout checking).
1549
1550         * VM/CTI.cpp:
1551         (KJS::CTI::privateCompileMainPass):
1552         (KJS::CTI::privateCompile):
1553         * VM/Machine.cpp:
1554         (KJS::slideRegisterWindowForCall):
1555         (KJS::Machine::cti_timeout_check):
1556         (KJS::Machine::cti_vm_throw):
1557
1558 2008-09-04  Sam Weinig  <sam@webkit.org>
1559
1560         Reviewed by Mark Rowe.
1561
1562         Third round of style cleanup.
1563
1564         * VM/CTI.cpp:
1565         * VM/CTI.h:
1566         * VM/CodeBlock.h:
1567         * VM/Machine.cpp:
1568         * VM/Machine.h:
1569         * kjs/ExecState.h:
1570
1571 2008-09-04  Sam Weinig  <sam@webkit.org>
1572
1573         Reviewed by Jon Honeycutt.
1574
1575         Second round of style cleanup.
1576
1577         * VM/CTI.cpp:
1578         * VM/CTI.h:
1579         * wrec/WREC.h:
1580
1581 2008-09-04  Sam Weinig  <sam@webkit.org>
1582
1583         Reviewed by Mark Rowe.
1584
1585         First round of style cleanup.
1586
1587         * VM/CTI.cpp:
1588         * VM/CTI.h:
1589         * masm/IA32MacroAsm.h:
1590         * wrec/WREC.cpp:
1591         * wrec/WREC.h:
1592
1593 2008-09-04  Geoffrey Garen  <ggaren@apple.com>
1594
1595         Reviewed by Mark Rowe.
1596         
1597         Merged http://trac.webkit.org/changeset/36081 to work with CTI.
1598
1599         * VM/Machine.cpp:
1600         (KJS::Machine::tryCtiCacheGetByID):
1601
1602 2008-09-04  Gavin Barraclough  <barraclough@apple.com>
1603
1604         Reviewed by Sam Weinig.
1605
1606         Enable profiling in CTI.
1607
1608         * VM/CTI.h:
1609         (KJS::):
1610         (KJS::CTI::execute):
1611         * VM/Machine.cpp:
1612         (KJS::Machine::cti_op_call_JSFunction):
1613         (KJS::Machine::cti_op_call_NotJSFunction):
1614         (KJS::Machine::cti_op_ret):
1615         (KJS::Machine::cti_op_construct_JSConstruct):
1616         (KJS::Machine::cti_op_construct_NotJSConstruct):
1617
1618 2008-09-04  Victor Hernandez  <vhernandez@apple.com>
1619
1620         Reviewed by Geoffrey Garen.
1621         
1622         Fixed an #if to support using WREC without CTI.
1623
1624         * kjs/regexp.cpp:
1625         (KJS::RegExp::match):
1626
1627 2008-09-04  Gavin Barraclough  <barraclough@apple.com>
1628
1629         Reviewed by Oliver Hunt.
1630
1631         The array/string length trampolines are owned by the Machine, not the codeblock that compiled them.
1632
1633         * VM/CTI.cpp:
1634         (KJS::CTI::privateArrayLengthTrampoline):
1635         (KJS::CTI::privateStringLengthTrampoline):
1636         * VM/Machine.cpp:
1637         (KJS::Machine::~Machine):
1638         * VM/Machine.h:
1639
1640 2008-09-04  Mark Rowe  <mrowe@apple.com>
1641
1642         Reviewed by Gavin Barraclough and Sam Weinig.
1643
1644         Fix a crash on launch of jsc when GuardMalloc is enabled.
1645
1646         * kjs/ScopeChain.h:
1647         (KJS::ScopeChain::ScopeChain): Initialize m_node to 0 when we have no valid scope chain.
1648         (KJS::ScopeChain::~ScopeChain): Null-check m_node before calling deref.
1649
1650 2008-09-03  Oliver Hunt  <oliver@apple.com>
1651
1652         Reviewed by Gavin Barraclough and Geoff Garen.
1653
1654         Fix inspector and fast array access so that it bounds
1655         checks correctly.
1656
1657         * VM/CTI.cpp:
1658         (KJS::CTI::privateCompile_pass2_Main):
1659         * masm/IA32MacroAsm.h:
1660         (KJS::IA32MacroAssembler::):
1661         (KJS::IA32MacroAssembler::emitUnlinkedJb):
1662         (KJS::IA32MacroAssembler::emitUnlinkedJbe):
1663
1664 2008-09-03  Mark Rowe  <mrowe@apple.com>
1665
1666         Move the assertion after the InitializeAndReturn block, as
1667         that is used even when CTI is enabled.
1668
1669         * VM/Machine.cpp:
1670         (KJS::Machine::privateExecute):
1671
1672 2008-09-03  Mark Rowe  <mrowe@apple.com>
1673
1674         Reviewed by Sam Weinig.
1675
1676         Replace calls to exit with ASSERT_WITH_MESSAGE or ASSERT_NOT_REACHED.
1677
1678         * VM/CTI.cpp:
1679         (KJS::CTI::privateCompile_pass1_Scan):
1680         (KJS::CTI::privateCompile_pass2_Main):
1681         (KJS::CTI::privateCompile_pass4_SlowCases):
1682         * VM/Machine.cpp:
1683         (KJS::Machine::privateExecute):
1684         (KJS::Machine::cti_vm_throw):
1685
1686 2008-09-03  Mark Rowe  <mrowe@apple.com>
1687
1688         Reviewed by Sam Weinig.
1689
1690         Tweak JavaScriptCore to compile on non-x86 platforms.  This is achieved
1691         by wrapping more code with ENABLE(CTI), ENABLE(WREC), and PLATFORM(X86)
1692         #if's.
1693
1694         * VM/CTI.cpp:
1695         * VM/CTI.h:
1696         * VM/CodeBlock.cpp:
1697         (KJS::CodeBlock::printStructureIDs): Use %td as the format specifier for
1698         printing a ptrdiff_t.
1699         * VM/Machine.cpp:
1700         * VM/Machine.h:
1701         * kjs/regexp.cpp:
1702         (KJS::RegExp::RegExp):
1703         (KJS::RegExp::~RegExp):
1704         (KJS::RegExp::match):
1705         * kjs/regexp.h:
1706         * masm/IA32MacroAsm.h:
1707         * wrec/WREC.cpp:
1708         * wrec/WREC.h:
1709         * wtf/Platform.h: Only enable CTI and WREC on x86.  Add an extra define to
1710         track whether any MASM-using features are enabled.
1711
1712 2008-09-03  Gavin Barraclough  <barraclough@apple.com>
1713
1714         Reviewed by Oliver Hunt.
1715
1716         Copy Geoff's array/string length optimization for CTI.
1717
1718         * VM/CTI.cpp:
1719         (KJS::CTI::privateArrayLengthTrampoline):
1720         (KJS::CTI::privateStringLengthTrampoline):
1721         * VM/CTI.h:
1722         (KJS::CTI::compileArrayLengthTrampoline):
1723         (KJS::CTI::compileStringLengthTrampoline):
1724         * VM/Machine.cpp:
1725         (KJS::Machine::Machine):
1726         (KJS::Machine::getCtiArrayLengthTrampoline):
1727         (KJS::Machine::getCtiStringLengthTrampoline):
1728         (KJS::Machine::tryCtiCacheGetByID):
1729         (KJS::Machine::cti_op_get_by_id_second):
1730         * VM/Machine.h:
1731         * kjs/JSString.h:
1732         * kjs/ustring.h:
1733
1734 2008-09-03  Gavin Barraclough  <barraclough@apple.com>
1735
1736         Reviewed by Oliver Hunt.
1737
1738         Implement fast array accesses in CTI - 2-3% progression on sunspider.
1739
1740         * VM/CTI.cpp:
1741         (KJS::CTI::emitFastArithIntToImmNoCheck):
1742         (KJS::CTI::compileOpCall):
1743         (KJS::CTI::privateCompile_pass2_Main):
1744         (KJS::CTI::privateCompile_pass4_SlowCases):
1745         * VM/CTI.h:
1746         * kjs/JSArray.h:
1747
1748 2008-09-02  Gavin Barraclough  <barraclough@apple.com>
1749
1750         Reviewed by Oliver Hunt.
1751
1752         Enable fast property access support in CTI.
1753
1754         * VM/CTI.cpp:
1755         (KJS::ctiSetReturnAddress):
1756         (KJS::ctiRepatchCallByReturnAddress):
1757         (KJS::CTI::privateCompile_pass2_Main):
1758         (KJS::CTI::privateCompile):
1759         (KJS::CTI::privateCompileGetByIdSelf):
1760         (KJS::CTI::privateCompileGetByIdProto):
1761         (KJS::CTI::privateCompileGetByIdChain):
1762         (KJS::CTI::privateCompilePutByIdReplace):
1763         * VM/CTI.h:
1764         (KJS::CTI::compileGetByIdSelf):
1765         (KJS::CTI::compileGetByIdProto):
1766         (KJS::CTI::compileGetByIdChain):
1767         (KJS::CTI::compilePutByIdReplace):
1768         * VM/CodeBlock.cpp:
1769         (KJS::CodeBlock::~CodeBlock):
1770         * VM/CodeBlock.h:
1771         * VM/Machine.cpp:
1772         (KJS::doSetReturnAddressVmThrowTrampoline):
1773         (KJS::Machine::tryCtiCachePutByID):
1774         (KJS::Machine::tryCtiCacheGetByID):
1775         (KJS::Machine::cti_op_put_by_id):
1776         (KJS::Machine::cti_op_put_by_id_second):
1777         (KJS::Machine::cti_op_put_by_id_generic):
1778         (KJS::Machine::cti_op_put_by_id_fail):
1779         (KJS::Machine::cti_op_get_by_id):
1780         (KJS::Machine::cti_op_get_by_id_second):
1781         (KJS::Machine::cti_op_get_by_id_generic):
1782         (KJS::Machine::cti_op_get_by_id_fail):
1783         (KJS::Machine::cti_op_throw):
1784         (KJS::Machine::cti_vm_throw):
1785         * VM/Machine.h:
1786         * kjs/JSCell.h:
1787         * kjs/JSObject.h:
1788         * kjs/PropertyMap.h:
1789         * kjs/StructureID.cpp:
1790         (KJS::StructureIDChain::StructureIDChain):
1791         * masm/IA32MacroAsm.h:
1792         (KJS::IA32MacroAssembler::emitCmpl_i32m):
1793         (KJS::IA32MacroAssembler::emitMovl_mr):
1794         (KJS::IA32MacroAssembler::emitMovl_rm):
1795
1796 2008-09-02  Sam Weinig  <sam@webkit.org>
1797
1798         Reviewed by Gavin Barraclough and Mark Rowe.
1799
1800         A backslash (\) at the of a RegEx should produce an error.
1801         Fixes fast/regex/test1.html.
1802
1803         * wrec/WREC.cpp:
1804         (KJS::WRECompiler::parseEscape):
1805
1806 2008-09-02  Sam Weinig  <sam@webkit.org>
1807
1808         Reviewed by Geoff Garen.
1809
1810         Link jumps for the slow case of op_loop_if_less.  Fixes acid3.
1811
1812         * VM/CTI.cpp:
1813         (KJS::CTI::privateCompile_pass4_SlowCases):
1814
1815 2008-09-01  Sam Weinig  <sam@webkit.org>
1816
1817         Rubber-stamped by Maciej Stachowiak.
1818
1819         Switch WREC on by default.
1820
1821         * wtf/Platform.h:
1822
1823 2008-09-01  Sam Weinig  <sam@webkit.org>
1824
1825         Reviewed by Mark Rowe.
1826
1827         Fix two failures in fast/regex/test1.html
1828           - \- in a character class should be treated as a literal -
1829           - A missing max quantifier needs to be treated differently than
1830             a null max quantifier.
1831
1832         * wrec/WREC.cpp:
1833         (KJS::WRECompiler::generateNonGreedyQuantifier):
1834         (KJS::WRECompiler::generateGreedyQuantifier):
1835         (KJS::WRECompiler::parseCharacterClass):
1836         * wrec/WREC.h:
1837         (KJS::Quantifier::Quantifier):
1838
1839 2008-09-01  Sam Weinig  <sam@webkit.org>
1840
1841         Reviewed by Mark Rowe.
1842
1843         Fix crash in fast/js/kde/evil-n.html
1844
1845         * kjs/regexp.cpp: Always pass a non-null offset vector to the wrec function.
1846
1847 2008-09-01  Sam Weinig  <sam@webkit.org>
1848
1849         Reviewed by Gavin Barraclough and Mark Rowe.
1850
1851         Add pattern length limit fixing one test in fast/js.
1852
1853         * wrec/WREC.cpp:
1854         (KJS::WRECompiler::compile):
1855         * wrec/WREC.h:
1856         (KJS::WRECompiler::):
1857
1858 2008-09-01  Sam Weinig  <sam@webkit.org>
1859
1860         Reviewed by Gavin Barraclough and Mark Rowe.
1861
1862         Make octal escape parsing/back-reference parsing more closely match 
1863         prior behavior fixing one test in fast/js.
1864
1865         * wrec/WREC.cpp:
1866         (KJS::WRECompiler::parseCharacterClass): 8 and 9 should be IdentityEscaped
1867         (KJS::WRECompiler::parseEscape):
1868         * wrec/WREC.h:
1869         (KJS::WRECompiler::peekDigit):
1870
1871 2008-09-01  Sam Weinig  <sam@webkit.org>
1872
1873         Reviewed by Gavin Barraclough and Mark Rowe.
1874
1875         Fix one mozilla test.
1876
1877         * wrec/WREC.cpp:
1878         (KJS::WRECompiler::generateCharacterClassInverted): Fix incorrect not
1879         ascii upper check.
1880
1881 2008-09-01  Sam Weinig  <sam@webkit.org>
1882
1883         Reviewed by Gavin Barraclough and Mark Rowe.
1884
1885         Parse octal escapes in character classes fixing one mozilla test.
1886
1887         * wrec/WREC.cpp:
1888         (KJS::WRECompiler::parseCharacterClass):
1889         (KJS::WRECompiler::parseOctalEscape):
1890         * wrec/WREC.h:
1891         (KJS::WRECompiler::consumeOctal):
1892
1893 2008-09-01  Sam Weinig  <sam@webkit.org>
1894
1895         Reviewed by Oliver Hunt.
1896
1897         Fixes two mozilla tests with WREC enabled.
1898
1899         * wrec/WREC.cpp:
1900         (KJS::CharacterClassConstructor::append): Keep the character class sorted
1901         when appending another character class.
1902
1903 2008-09-01  Sam Weinig  <sam@webkit.org>
1904
1905         Reviewed by Gavin Barraclough and Mark Rowe.
1906
1907         Fixes two mozilla tests with WREC enabled.
1908
1909         * wrec/WREC.cpp:
1910         (KJS::CharacterClassConstructor::addSortedRange): Insert the range at the correct position
1911         instead of appending it to the end.
1912
1913 2008-09-01  Gavin Barraclough  <barraclough@apple.com>
1914
1915         Reviewed by Oliver Hunt.
1916
1917         Move cross-compilation unit call into NEVER_INLINE function.
1918
1919         * VM/Machine.cpp:
1920         (KJS::doSetReturnAddressVmThrowTrampoline):
1921
1922 2008-09-01  Sam Weinig  <sam@webkit.org>
1923
1924         Reviewed by Gavin Barraclough and Geoff Garen.
1925
1926         Fix one test in fast/js.
1927
1928         * VM/Machine.cpp:
1929         (KJS::Machine::cti_op_construct_NotJSConstruct): Throw a createNotAConstructorError,
1930         instead of a createNotAFunctionError.
1931
1932 2008-08-31  Gavin Barraclough  <barraclough@apple.com>
1933
1934         Reviewed by Maciej Stachowiak.
1935         
1936         Zero-cost exception handling.  This patch takes the exception checking
1937         back of the hot path.  When an exception occurs in a Machine::cti*
1938         method, the return address to JIT code is recorded, and is then
1939         overwritten with a pointer to a trampoline routine.  When the method
1940         returns the trampoline will cause the cti_vm_throw method to be invoked.
1941
1942         cti_vm_throw uses the return address preserved above, to discover the
1943         vPC of the bytecode that raised the exception (using a map build during
1944         translation).  From the VPC of the faulting bytecode the vPC of a catch
1945         routine may be discovered (unwinding the stack where necesary), and then
1946         a bytecode address for the catch routine is looked up.  Final cti_vm_throw
1947         overwrites its return address to JIT code again, to trampoline directly
1948         to the catch routine.
1949         
1950         cti_op_throw is handled in a similar fashion.
1951
1952         * VM/CTI.cpp:
1953         (KJS::CTI::emitPutCTIParam):
1954         (KJS::CTI::emitPutToCallFrameHeader):
1955         (KJS::CTI::emitGetFromCallFrameHeader):
1956         (KJS::ctiSetReturnAddressForArgs):
1957         (KJS::CTI::emitDebugExceptionCheck):
1958         (KJS::CTI::printOpcodeOperandTypes):
1959         (KJS::CTI::emitCall):
1960         (KJS::CTI::compileOpCall):
1961         (KJS::CTI::privateCompile_pass2_Main):
1962         (KJS::CTI::privateCompile):
1963         * VM/CTI.h:
1964         (KJS::CallRecord::CallRecord):
1965         (KJS::):
1966         (KJS::CTI::execute):
1967         * VM/CodeBlock.h:
1968         * VM/Machine.cpp:
1969         (KJS::Machine::privateExecute):
1970         (KJS::Machine::cti_op_instanceof):
1971         (KJS::Machine::cti_op_call_NotJSFunction):
1972         (KJS::Machine::cti_op_resolve):
1973         (KJS::Machine::cti_op_resolve_func):
1974         (KJS::Machine::cti_op_resolve_skip):
1975         (KJS::Machine::cti_op_resolve_with_base):
1976         (KJS::Machine::cti_op_throw):
1977         (KJS::Machine::cti_op_in):
1978         (KJS::Machine::cti_vm_throw):
1979         * VM/RegisterFile.h:
1980         (KJS::RegisterFile::):
1981         * kjs/ExecState.h:
1982         (KJS::ExecState::setCtiReturnAddress):
1983         (KJS::ExecState::ctiReturnAddress):
1984         * masm/IA32MacroAsm.h:
1985         (KJS::IA32MacroAssembler::):
1986         (KJS::IA32MacroAssembler::emitPushl_m):
1987         (KJS::IA32MacroAssembler::emitPopl_m):
1988         (KJS::IA32MacroAssembler::getRelocatedAddress):
1989
1990 2008-08-31  Mark Rowe  <mrowe@apple.com>
1991
1992         Reviewed by Oliver Hunt.
1993
1994         Fall back to PCRE for any regexp containing parentheses until we correctly backtrack within them.
1995
1996         * wrec/WREC.cpp:
1997         (KJS::WRECompiler::parseParentheses):
1998         * wrec/WREC.h:
1999         (KJS::WRECompiler::):
2000
2001 2008-08-31  Mark Rowe  <mrowe@apple.com>
2002
2003         Reviewed by Oliver Hunt.
2004
2005         Fix several issues within ecma_3/RegExp/perlstress-001.js with WREC enabled.
2006
2007         * wrec/WREC.cpp:
2008         (KJS::WRECompiler::generateNonGreedyQuantifier): Compare with the maximum quantifier count rather than the minimum.
2009         (KJS::WRECompiler::generateAssertionEOL): Do a register-to-register comparison rather than immediate-to-register.
2010         (KJS::WRECompiler::parseCharacterClass): Pass through the correct inversion flag.
2011
2012 2008-08-30  Mark Rowe  <mrowe@apple.com>
2013
2014         Reviewed by Oliver Hunt.
2015
2016         Re-fix the six remaining failures in the Mozilla JavaScript tests in a manner that does not kill performance.
2017         This shows up as a 0.6% progression on SunSpider on my machine.
2018
2019         Grow the JITCodeBuffer's underlying buffer when we run out of space rather than just bailing out.
2020
2021         * VM/CodeBlock.h:
2022         (KJS::CodeBlock::~CodeBlock): Switch to using fastFree now that JITCodeBuffer::copy uses fastMalloc.
2023         * kjs/regexp.cpp: Ditto.
2024         * masm/IA32MacroAsm.h:
2025         (KJS::JITCodeBuffer::growBuffer):
2026         (KJS::JITCodeBuffer::JITCodeBuffer):
2027         (KJS::JITCodeBuffer::~JITCodeBuffer):
2028         (KJS::JITCodeBuffer::putByte):
2029         (KJS::JITCodeBuffer::putShort):
2030         (KJS::JITCodeBuffer::putInt):
2031         (KJS::JITCodeBuffer::reset):
2032         (KJS::JITCodeBuffer::copy):
2033
2034 2008-08-29  Oliver Hunt  <oliver@apple.com>
2035
2036         RS=Maciej
2037
2038         Roll out previous patch as it causes a 5% performance regression
2039
2040         * JavaScriptCore.xcodeproj/project.pbxproj:
2041         * VM/CTI.cpp:
2042         (KJS::getJCB):
2043         (KJS::CTI::privateCompile):
2044         * VM/CodeBlock.h:
2045         (KJS::CodeBlock::~CodeBlock):
2046         * masm/IA32MacroAsm.h:
2047         (KJS::JITCodeBuffer::JITCodeBuffer):
2048         (KJS::JITCodeBuffer::putByte):
2049         (KJS::JITCodeBuffer::putShort):
2050         (KJS::JITCodeBuffer::putInt):
2051         (KJS::JITCodeBuffer::getEIP):
2052         (KJS::JITCodeBuffer::start):
2053         (KJS::JITCodeBuffer::getOffset):
2054         (KJS::JITCodeBuffer::reset):
2055         (KJS::JITCodeBuffer::copy):
2056         (KJS::IA32MacroAssembler::emitModRm_rr):
2057         (KJS::IA32MacroAssembler::emitModRm_rm):
2058         (KJS::IA32MacroAssembler::emitModRm_rmsib):
2059         (KJS::IA32MacroAssembler::IA32MacroAssembler):
2060         (KJS::IA32MacroAssembler::emitInt3):
2061         (KJS::IA32MacroAssembler::emitPushl_r):
2062         (KJS::IA32MacroAssembler::emitPopl_r):
2063         (KJS::IA32MacroAssembler::emitMovl_rr):
2064         (KJS::IA32MacroAssembler::emitAddl_rr):
2065         (KJS::IA32MacroAssembler::emitAddl_i8r):
2066         (KJS::IA32MacroAssembler::emitAddl_i32r):
2067         (KJS::IA32MacroAssembler::emitAddl_mr):
2068         (KJS::IA32MacroAssembler::emitAndl_rr):
2069         (KJS::IA32MacroAssembler::emitAndl_i32r):
2070         (KJS::IA32MacroAssembler::emitCmpl_i8r):
2071         (KJS::IA32MacroAssembler::emitCmpl_rr):
2072         (KJS::IA32MacroAssembler::emitCmpl_rm):
2073         (KJS::IA32MacroAssembler::emitCmpl_i32r):
2074         (KJS::IA32MacroAssembler::emitCmpl_i32m):
2075         (KJS::IA32MacroAssembler::emitCmpw_rm):
2076         (KJS::IA32MacroAssembler::emitOrl_rr):
2077         (KJS::IA32MacroAssembler::emitOrl_i8r):
2078         (KJS::IA32MacroAssembler::emitSubl_rr):
2079         (KJS::IA32MacroAssembler::emitSubl_i8r):
2080         (KJS::IA32MacroAssembler::emitSubl_i32r):
2081         (KJS::IA32MacroAssembler::emitSubl_mr):
2082         (KJS::IA32MacroAssembler::emitTestl_i32r):
2083         (KJS::IA32MacroAssembler::emitTestl_rr):
2084         (KJS::IA32MacroAssembler::emitXorl_i8r):
2085         (KJS::IA32MacroAssembler::emitXorl_rr):
2086         (KJS::IA32MacroAssembler::emitSarl_i8r):
2087         (KJS::IA32MacroAssembler::emitSarl_CLr):
2088         (KJS::IA32MacroAssembler::emitShl_i8r):
2089         (KJS::IA32MacroAssembler::emitShll_CLr):
2090         (KJS::IA32MacroAssembler::emitMull_rr):
2091         (KJS::IA32MacroAssembler::emitIdivl_r):
2092         (KJS::IA32MacroAssembler::emitCdq):
2093         (KJS::IA32MacroAssembler::emitMovl_mr):
2094         (KJS::IA32MacroAssembler::emitMovzwl_mr):
2095         (KJS::IA32MacroAssembler::emitMovl_rm):
2096         (KJS::IA32MacroAssembler::emitMovl_i32r):
2097         (KJS::IA32MacroAssembler::emitMovl_i32m):
2098         (KJS::IA32MacroAssembler::emitLeal_mr):
2099         (KJS::IA32MacroAssembler::emitRet):
2100         (KJS::IA32MacroAssembler::emitJmpN_r):
2101         (KJS::IA32MacroAssembler::emitJmpN_m):
2102         (KJS::IA32MacroAssembler::emitCall):
2103         (KJS::IA32MacroAssembler::label):
2104         (KJS::IA32MacroAssembler::emitUnlinkedJmp):
2105         (KJS::IA32MacroAssembler::emitUnlinkedJne):
2106         (KJS::IA32MacroAssembler::emitUnlinkedJe):
2107         (KJS::IA32MacroAssembler::emitUnlinkedJl):
2108         (KJS::IA32MacroAssembler::emitUnlinkedJle):
2109         (KJS::IA32MacroAssembler::emitUnlinkedJge):
2110         (KJS::IA32MacroAssembler::emitUnlinkedJae):
2111         (KJS::IA32MacroAssembler::emitUnlinkedJo):
2112         (KJS::IA32MacroAssembler::link):
2113         * wrec/WREC.cpp:
2114         (KJS::WRECompiler::compilePattern):
2115         (KJS::WRECompiler::compile):
2116         * wrec/WREC.h:
2117
2118 2008-08-29  Mark Rowe  <mrowe@apple.com>
2119
2120         Reviewed by Oliver Hunt.
2121
2122         Have JITCodeBuffer manage a Vector containing the generated code so that it can grow
2123         as needed when generating code for a large function.  This fixes all six remaining failures
2124         in Mozilla tests in both debug and release builds.
2125
2126         * VM/CTI.cpp:
2127         (KJS::CTI::privateCompile):
2128         * VM/CodeBlock.h:
2129         (KJS::CodeBlock::~CodeBlock):
2130         * masm/IA32MacroAsm.h:
2131         (KJS::JITCodeBuffer::putByte):
2132         (KJS::JITCodeBuffer::putShort):
2133         (KJS::JITCodeBuffer::putInt):
2134         (KJS::JITCodeBuffer::getEIP):
2135         (KJS::JITCodeBuffer::start):
2136         (KJS::JITCodeBuffer::getOffset):
2137         (KJS::JITCodeBuffer::getCode):
2138         (KJS::IA32MacroAssembler::emitModRm_rr):
2139         * wrec/WREC.cpp:
2140         (KJS::WRECompiler::compilePattern):
2141         * wrec/WREC.h:
2142
2143 2008-08-29  Mark Rowe  <mrowe@apple.com>
2144
2145         Reviewed by Oliver Hunt.
2146
2147         Implement parsing of octal escapes in regular expressions.  This fixes three Mozilla tests.
2148
2149         * wrec/WREC.cpp:
2150         (KJS::WRECompiler::parseOctalEscape):
2151         (KJS::WRECompiler::parseEscape): Parse the escape sequence as an octal escape if it has a leading zero.
2152         Add a FIXME about treating invalid backreferences as octal escapes in the future.
2153         * wrec/WREC.h:
2154         (KJS::WRECompiler::consumeNumber): Multiply by 10 rather than 0 so that we handle numbers with more than
2155         one digit.
2156         * wtf/ASCIICType.h:
2157         (WTF::isASCIIOctalDigit):
2158
2159 2008-08-29  Sam Weinig  <sam@webkit.org>
2160
2161         Reviewed by Mark Rowe.
2162
2163         Pass vPC to instanceof method.  Fixes 2 mozilla tests in debug.
2164
2165         * VM/CTI.cpp:
2166         (KJS::CTI::privateCompile_pass2_Main):
2167         * VM/Machine.cpp:
2168         (KJS::Machine::cti_op_instanceof):
2169
2170 2008-08-29  Sam Weinig  <sam@webkit.org>
2171
2172         Reviewed by Mark Rowe.
2173
2174         Pass vPCs to resolve methods for correct exception creation.  Fixes
2175         17 mozilla tests in debug.
2176
2177         * VM/CTI.cpp:
2178         (KJS::CTI::privateCompile_pass2_Main):
2179         * VM/CTI.h:
2180         * VM/Machine.cpp:
2181         (KJS::Machine::cti_op_resolve):
2182         (KJS::Machine::cti_op_resolve_func):
2183         (KJS::Machine::cti_op_resolve_skip):
2184         (KJS::Machine::cti_op_resolve_with_base):
2185
2186 2008-08-29  Gavin Barraclough  <barraclough@apple.com>
2187
2188         Reviewed by Oliver Hunt.
2189
2190         Remembering to actually throw the exception passed to op throw helps.
2191         Regressions 19 -> 6.
2192
2193         * VM/Machine.cpp:
2194         (KJS::Machine::cti_op_throw):
2195         (KJS::Machine::cti_vm_throw):
2196
2197 2008-08-29  Gavin Barraclough  <barraclough@apple.com>
2198
2199         Reviewed by Sam Weinig.
2200
2201         Support for exception unwinding the stack.
2202         
2203         Once upon a time, Sam asked me for a bettr ChangeLog entry.  The return address
2204         is now preserved on entry to a JIT code function (if we preserve lazily we need
2205         restore the native return address during exception stack unwind).  This takes
2206         the number of regressions down from ~150 to 19.
2207
2208         * VM/CTI.cpp:
2209         (KJS::getJCB):
2210         (KJS::CTI::emitExceptionCheck):
2211         (KJS::CTI::compileOpCall):
2212         (KJS::CTI::privateCompile_pass2_Main):
2213         (KJS::CTI::privateCompile):
2214         * VM/CTI.h:
2215         (KJS::):
2216         * VM/Machine.cpp:
2217         (KJS::Machine::throwException):
2218         (KJS::Machine::cti_op_call_JSFunction):
2219         (KJS::Machine::cti_op_call_NotJSFunction):
2220         (KJS::Machine::cti_op_construct_JSConstruct):
2221         (KJS::Machine::cti_op_construct_NotJSConstruct):
2222         (KJS::Machine::cti_op_throw):
2223         (KJS::Machine::cti_vm_throw):
2224
2225 2008-08-29  Mark Rowe  <mrowe@apple.com>
2226
2227         Reviewed by Oliver Hunt.
2228
2229         Fix js1_2/regexp/word_boundary.js and four other Mozilla tests with WREC enabled.
2230
2231         * wrec/WREC.cpp:
2232         (KJS::WRECompiler::generateCharacterClassInvertedRange): If none of the exact matches
2233         succeeded, jump to failure.
2234         (KJS::WRECompiler::compilePattern): Restore and increment the current position stored
2235         on the stack to ensure that it will be reset to the correct position after a failed
2236         match has consumed input.
2237
2238 2008-08-29  Mark Rowe  <mrowe@apple.com>
2239
2240         Reviewed by Oliver Hunt.
2241
2242         Fix a hang in ecma_3/RegExp/15.10.2-1.js with WREC enabled.
2243         A backreference with a quantifier would get stuck in an infinite
2244         loop if the captured range was empty.
2245
2246         * wrec/WREC.cpp:
2247         (KJS::WRECompiler::generateBackreferenceQuantifier): If the captured range
2248         was empty, do not attempt to match the backreference.
2249         (KJS::WRECompiler::parseBackreferenceQuantifier):
2250         * wrec/WREC.h:
2251         (KJS::Quantifier::):
2252
2253 2008-08-28  Sam Weinig  <sam@webkit.org>
2254
2255         Reviewed by Oliver Hunt.
2256
2257         Implement op_debug.
2258
2259         * VM/CTI.cpp:
2260         (KJS::CTI::privateCompile_pass1_Scan):
2261         (KJS::CTI::privateCompile_pass2_Main):
2262         * VM/Machine.cpp:
2263         (KJS::Machine::debug):
2264         (KJS::Machine::privateExecute):
2265         (KJS::Machine::cti_op_debug):
2266         * VM/Machine.h:
2267
2268 2008-08-28  Sam Weinig  <sam@webkit.org>
2269
2270         Reviewed by Gavin Barraclough and Geoff Garen.
2271
2272         Implement op_switch_string fixing 1 mozilla test and one test in fast/js.
2273
2274         * VM/CTI.cpp:
2275         (KJS::CTI::privateCompile_pass1_Scan):
2276         (KJS::CTI::privateCompile_pass2_Main):
2277         (KJS::CTI::privateCompile):
2278         * VM/CTI.h:
2279         (KJS::SwitchRecord::):
2280         (KJS::SwitchRecord::SwitchRecord):
2281         * VM/CodeBlock.cpp:
2282         (KJS::CodeBlock::dump):
2283         * VM/CodeBlock.h:
2284         (KJS::ExpressionRangeInfo::):
2285         (KJS::StringJumpTable::offsetForValue):
2286         (KJS::StringJumpTable::ctiForValue):
2287         (KJS::SimpleJumpTable::add):
2288         (KJS::SimpleJumpTable::ctiForValue):
2289         * VM/CodeGenerator.cpp:
2290         (KJS::prepareJumpTableForStringSwitch):
2291         * VM/Machine.cpp:
2292         (KJS::Machine::privateExecute):
2293         (KJS::Machine::cti_op_switch_string):
2294         * VM/Machine.h:
2295
2296 2008-08-28  Gavin Barraclough  <barraclough@apple.com>
2297
2298         Reviewed by Oliver Hunt.
2299
2300         Do not recurse on the machine stack when executing op_call.
2301
2302         * VM/CTI.cpp:
2303         (KJS::CTI::emitGetPutArg):
2304         (KJS::CTI::emitPutArg):
2305         (KJS::CTI::emitPutArgConstant):
2306         (KJS::CTI::compileOpCall):
2307         (KJS::CTI::privateCompile_pass2_Main):
2308         (KJS::CTI::privateCompile):
2309         * VM/CTI.h:
2310         (KJS::):
2311         (KJS::CTI::compile):
2312         (KJS::CTI::execute):
2313         (KJS::CTI::):
2314         * VM/Machine.cpp:
2315         (KJS::Machine::Machine):
2316         (KJS::Machine::execute):
2317         (KJS::Machine::cti_op_call_JSFunction):
2318         (KJS::Machine::cti_op_call_NotJSFunction):
2319         (KJS::Machine::cti_op_ret):
2320         (KJS::Machine::cti_op_construct_JSConstruct):
2321         (KJS::Machine::cti_op_construct_NotJSConstruct):
2322         (KJS::Machine::cti_op_call_eval):
2323         * VM/Machine.h:
2324         * VM/Register.h:
2325         (KJS::Register::Register):
2326         * VM/RegisterFile.h:
2327         (KJS::RegisterFile::):
2328         * kjs/InternalFunction.h:
2329         (KJS::InternalFunction::InternalFunction):
2330         * kjs/JSFunction.h:
2331         (KJS::JSFunction::JSFunction):
2332         * kjs/ScopeChain.h:
2333         (KJS::ScopeChain::ScopeChain):
2334         * masm/IA32MacroAsm.h:
2335         (KJS::IA32MacroAssembler::):
2336         (KJS::IA32MacroAssembler::emitModRm_opm):
2337         (KJS::IA32MacroAssembler::emitCmpl_i32m):
2338         (KJS::IA32MacroAssembler::emitCallN_r):
2339
2340 2008-08-28  Sam Weinig  <sam@webkit.org>
2341
2342         Reviewed by Mark Rowe.
2343
2344         Exit instead of crashing in ctiUnsupported and ctiTimedOut.
2345
2346         * VM/Machine.cpp:
2347         (KJS::ctiUnsupported):
2348         (KJS::ctiTimedOut):
2349
2350 2008-08-28  Oliver Hunt  <oliver@apple.com>
2351
2352         Reviewed by Maciej Stachowiak.
2353
2354         Implement codegen for op_jsr and op_sret.
2355
2356         * VM/CTI.cpp:
2357         (KJS::CTI::privateCompile_pass1_Scan):
2358         (KJS::CTI::privateCompile_pass2_Main):
2359         (KJS::CTI::privateCompile):
2360         * VM/CTI.h:
2361         (KJS::CTI::JSRInfo::JSRInfo):
2362         * masm/IA32MacroAsm.h:
2363         (KJS::IA32MacroAssembler::emitJmpN_m):
2364         (KJS::IA32MacroAssembler::linkAbsoluteAddress):
2365
2366 2008-08-28  Gavin Barraclough  <barraclough@apple.com>
2367
2368         Reviewed by Oliver Hunt.
2369
2370         Initial support for exceptions (throw / catch must occur in same CodeBlock).
2371
2372         * VM/CTI.cpp:
2373         (KJS::CTI::emitExceptionCheck):
2374         (KJS::CTI::emitCall):
2375         (KJS::CTI::privateCompile_pass2_Main):
2376         (KJS::CTI::privateCompile_pass4_SlowCases):
2377         (KJS::CTI::privateCompile):
2378         * VM/CTI.h:
2379         * VM/CodeBlock.cpp:
2380         (KJS::CodeBlock::nativeExceptionCodeForHandlerVPC):
2381         * VM/CodeBlock.h:
2382         * VM/CodeGenerator.cpp:
2383         (KJS::CodeGenerator::emitCatch):
2384         * VM/Machine.cpp:
2385         (KJS::Machine::throwException):
2386         (KJS::Machine::privateExecute):
2387         (KJS::ctiUnsupported):
2388         (KJS::ctiTimedOut):
2389         (KJS::Machine::cti_op_add):
2390         (KJS::Machine::cti_op_pre_inc):
2391         (KJS::Machine::cti_timeout_check):
2392         (KJS::Machine::cti_op_loop_if_less):
2393         (KJS::Machine::cti_op_put_by_id):
2394         (KJS::Machine::cti_op_get_by_id):
2395         (KJS::Machine::cti_op_instanceof):
2396         (KJS::Machine::cti_op_del_by_id):
2397         (KJS::Machine::cti_op_mul):
2398         (KJS::Machine::cti_op_call):
2399         (KJS::Machine::cti_op_resolve):
2400         (KJS::Machine::cti_op_construct):
2401         (KJS::Machine::cti_op_get_by_val):
2402         (KJS::Machine::cti_op_resolve_func):
2403         (KJS::Machine::cti_op_sub):
2404         (KJS::Machine::cti_op_put_by_val):
2405         (KJS::Machine::cti_op_lesseq):
2406         (KJS::Machine::cti_op_loop_if_true):
2407         (KJS::Machine::cti_op_negate):
2408         (KJS::Machine::cti_op_resolve_skip):
2409         (KJS::Machine::cti_op_div):
2410         (KJS::Machine::cti_op_pre_dec):
2411         (KJS::Machine::cti_op_jless):
2412         (KJS::Machine::cti_op_not):
2413         (KJS::Machine::cti_op_jtrue):
2414         (KJS::Machine::cti_op_post_inc):
2415         (KJS::Machine::cti_op_eq):
2416         (KJS::Machine::cti_op_lshift):
2417         (KJS::Machine::cti_op_bitand):
2418         (KJS::Machine::cti_op_rshift):
2419         (KJS::Machine::cti_op_bitnot):
2420         (KJS::Machine::cti_op_resolve_with_base):
2421         (KJS::Machine::cti_op_mod):
2422         (KJS::Machine::cti_op_less):
2423         (KJS::Machine::cti_op_neq):
2424         (KJS::Machine::cti_op_post_dec):
2425         (KJS::Machine::cti_op_urshift):
2426         (KJS::Machine::cti_op_bitxor):
2427         (KJS::Machine::cti_op_bitor):
2428         (KJS::Machine::cti_op_call_eval):
2429         (KJS::Machine::cti_op_throw):
2430         (KJS::Machine::cti_op_push_scope):
2431         (KJS::Machine::cti_op_stricteq):
2432         (KJS::Machine::cti_op_nstricteq):
2433         (KJS::Machine::cti_op_to_jsnumber):
2434         (KJS::Machine::cti_op_in):
2435         (KJS::Machine::cti_op_del_by_val):
2436         (KJS::Machine::cti_vm_throw):
2437         * VM/Machine.h:
2438         * kjs/ExecState.h:
2439         * masm/IA32MacroAsm.h:
2440         (KJS::IA32MacroAssembler::emitCmpl_i32m):
2441
2442 2008-08-28  Mark Rowe  <mrowe@apple.com>
2443
2444         Rubber-stamped by Oliver Hunt.
2445
2446         Print debugging info to stderr so that run-webkit-tests can capture it.
2447         This makes it easy to check whether test failures are due to unimplemented
2448         op codes, missing support for exceptions, etc.
2449
2450         * VM/CTI.cpp:
2451         (KJS::CTI::privateCompile_pass1_Scan):
2452         (KJS::CTI::printOpcodeOperandTypes):
2453         (KJS::CTI::privateCompile_pass2_Main):
2454         (KJS::CTI::privateCompile_pass4_SlowCases):
2455         (KJS::CTI::privateCompile):
2456         * VM/Machine.cpp:
2457         (KJS::Machine::privateExecute):
2458         (KJS::ctiException):
2459         (KJS::ctiUnsupported):
2460         (KJS::Machine::cti_op_call):
2461         (KJS::Machine::cti_op_resolve):
2462         (KJS::Machine::cti_op_construct):
2463         (KJS::Machine::cti_op_get_by_val):
2464         (KJS::Machine::cti_op_resolve_func):
2465         (KJS::Machine::cti_op_resolve_skip):
2466         (KJS::Machine::cti_op_resolve_with_base):
2467         (KJS::Machine::cti_op_call_eval):
2468
2469 2008-08-27  Mark Rowe  <mrowe@apple.com>
2470
2471         Reviewed by Gavin Barraclough and Maciej Stachowiak.
2472
2473         Fix fast/js/bitwise-and-on-undefined.html.
2474
2475         A temporary value in the slow path of op_bitand was being stored in edx, but was
2476         being clobbered by emitGetPutArg before we used it.  To fix this, emitGetPutArg
2477         now takes a third argument that specifies the scratch register to use when loading
2478         from memory.  This allows us to avoid clobbering the temporary in op_bitand.
2479
2480         * VM/CTI.cpp:
2481         (KJS::CTI::emitGetPutArg):
2482         (KJS::CTI::privateCompile_pass2_Main):
2483         (KJS::CTI::privateCompile_pass4_SlowCases):
2484         * VM/CTI.h:
2485
2486 2008-08-27  Mark Rowe  <mrowe@apple.com>
2487
2488         Rubber-stamped by Oliver Hunt.
2489
2490         Switch CTI on by default.
2491
2492         * wtf/Platform.h:
2493
2494 2008-08-27  Mark Rowe  <mrowe@apple.com>
2495
2496         Reviewed by Oliver Hunt.
2497
2498         Fix the build of the full WebKit stack.
2499
2500         * JavaScriptCore.xcodeproj/project.pbxproj: Mark two new headers as private so they can be pulled in from WebCore.
2501         * VM/CTI.h: Fix build issues that show up when compiled with GCC 4.2 as part of WebCore.
2502         * wrec/WREC.h: Ditto.
2503
2504 2008-08-27  Mark Rowe  <mrowe@apple.com>
2505
2506         Reviewed by Sam Weinig.
2507
2508         Implement op_new_error.  Does not fix any tests as it is always followed by the unimplemented op_throw.
2509
2510         * VM/CTI.cpp:
2511         (KJS::CTI::privateCompile_pass1_Scan):
2512         (KJS::CTI::privateCompile_pass2_Main):
2513         * VM/Machine.cpp:
2514         (KJS::Machine::cti_op_new_error):
2515         * VM/Machine.h:
2516
2517 2008-08-27  Sam Weinig  <sam@webkit.org>
2518
2519         Reviewed by Gavin Barraclough and Geoff Garen.
2520
2521         Implement op_put_getter and op_put_setter.
2522
2523         * VM/CTI.cpp:
2524         (KJS::CTI::privateCompile_pass1_Scan):
2525         (KJS::CTI::privateCompile_pass2_Main):
2526         * VM/Machine.cpp:
2527         (KJS::Machine::cti_op_put_getter):
2528         (KJS::Machine::cti_op_put_setter):
2529         * VM/Machine.h:
2530
2531 2008-08-27  Sam Weinig  <sam@webkit.org>
2532
2533         Reviewed by Gavin Barraclough and Geoff Garen.
2534
2535         Implement op_del_by_val fixing 3 mozilla tests.
2536
2537         * VM/CTI.cpp:
2538         (KJS::CTI::privateCompile_pass1_Scan):
2539         (KJS::CTI::privateCompile_pass2_Main):
2540         * VM/Machine.cpp:
2541         (KJS::Machine::cti_op_del_by_val):
2542         * VM/Machine.h:
2543
2544 2008-08-27  Gavin Barraclough  <barraclough@apple.com>
2545
2546         Reviewed by Oliver Hunt.
2547
2548         Quick & dirty fix to get SamplingTool sampling op_call.
2549
2550         * VM/SamplingTool.h:
2551         (KJS::SamplingTool::callingHostFunction):
2552
2553 2008-08-27  Sam Weinig  <sam@webkit.org>
2554
2555         Reviewed by Gavin Barraclough and Geoff Garen.
2556
2557         Fix op_put_by_index.
2558
2559         * VM/CTI.cpp:
2560         (KJS::CTI::privateCompile_pass2_Main): Use emitPutArgConstant instead of emitGetPutArg
2561         for the property value.
2562         * VM/Machine.cpp:
2563         (KJS::Machine::cti_op_put_by_index): Get the property value from the correct argument.
2564
2565 2008-08-27  Sam Weinig  <sam@webkit.org>
2566
2567         Reviewed by Gavin Barraclough and Geoff Garen.
2568
2569         Implement op_switch_imm in the CTI fixing 13 mozilla tests.
2570
2571         * VM/CTI.cpp:
2572         (KJS::CTI::privateCompile_pass1_Scan):
2573         (KJS::CTI::privateCompile_pass2_Main):
2574         * VM/Machine.cpp:
2575         (KJS::Machine::cti_op_switch_imm):
2576         * VM/Machine.h:
2577
2578 2008-08-27  Gavin Barraclough  <barraclough@apple.com>
2579
2580         Reviewed by Oliver Hunt.
2581
2582         Implement op_switch_char in CTI.
2583
2584         * VM/CTI.cpp:
2585         (KJS::CTI::emitCall):
2586         (KJS::CTI::privateCompile_pass1_Scan):
2587         (KJS::CTI::privateCompile_pass2_Main):
2588         (KJS::CTI::privateCompile):
2589         * VM/CTI.h:
2590         (KJS::CallRecord::CallRecord):
2591         (KJS::SwitchRecord::SwitchRecord):
2592         * VM/CodeBlock.h:
2593         (KJS::SimpleJumpTable::SimpleJumpTable::ctiForValue):
2594         * VM/Machine.cpp:
2595         (KJS::Machine::cti_op_switch_char):
2596         * VM/Machine.h:
2597         * masm/IA32MacroAsm.h:
2598         (KJS::IA32MacroAssembler::):
2599         (KJS::IA32MacroAssembler::emitJmpN_r):
2600         (KJS::IA32MacroAssembler::getRelocatedAddress):
2601         * wtf/Platform.h:
2602
2603 2008-08-26  Sam Weinig  <sam@webkit.org>
2604
2605         Reviewed by Mark Rowe.
2606
2607         Implement op_put_by_index to fix 1 mozilla test.
2608
2609         * VM/CTI.cpp:
2610         (KJS::CTI::privateCompile_pass1_Scan):
2611         (KJS::CTI::privateCompile_pass2_Main):
2612         * VM/Machine.cpp:
2613         (KJS::Machine::cti_op_put_by_index):
2614         * VM/Machine.h:
2615
2616 2008-08-26  Gavin Barraclough  <barraclough@apple.com>
2617
2618         Reviewed by Geoff Garen.
2619
2620         More fixes from Geoff's review.
2621
2622         * VM/CTI.cpp:
2623         (KJS::CTI::emitGetArg):
2624         (KJS::CTI::emitGetPutArg):
2625         (KJS::CTI::emitPutArg):
2626         (KJS::CTI::emitPutArgConstant):
2627         (KJS::CTI::getConstantImmediateNumericArg):
2628         (KJS::CTI::emitGetCTIParam):
2629         (KJS::CTI::emitPutResult):
2630         (KJS::CTI::emitCall):
2631         (KJS::CTI::emitJumpSlowCaseIfNotImm):
2632         (KJS::CTI::emitJumpSlowCaseIfNotImms):
2633         (KJS::CTI::getDeTaggedConstantImmediate):
2634         (KJS::CTI::emitFastArithDeTagImmediate):
2635         (KJS::CTI::emitFastArithReTagImmediate):
2636         (KJS::CTI::emitFastArithPotentiallyReTagImmediate):
2637         (KJS::CTI::emitFastArithImmToInt):
2638         (KJS::CTI::emitFastArithIntToImmOrSlowCase):
2639         (KJS::CTI::privateCompile_pass2_Main):
2640         (KJS::CTI::privateCompile_pass4_SlowCases):
2641         (KJS::CTI::privateCompile):
2642         * VM/CTI.h:
2643
2644 2008-08-26  Mark Rowe  <mrowe@apple.com>
2645
2646         Reviewed by Gavin Barraclough and Geoff Garen.
2647
2648         Implement op_jmp_scopes to fix 2 Mozilla tests.
2649
2650         * VM/CTI.cpp:
2651         (KJS::CTI::privateCompile_pass1_Scan):
2652         (KJS::CTI::privateCompile_pass2_Main):
2653         * VM/Machine.cpp:
2654         (KJS::Machine::cti_op_push_new_scope): Update ExecState::m_scopeChain after calling ARG_setScopeChain.
2655         (KJS::Machine::cti_op_jmp_scopes):
2656         * VM/Machine.h:
2657
2658 2008-08-26  Gavin Barraclough  <barraclough@apple.com>
2659
2660         Reviewed by Oliver Hunt.
2661
2662         WebKit Regular Expression Compiler. (set ENABLE_WREC = 1 in Platform.h).
2663
2664         * JavaScriptCore.xcodeproj/project.pbxproj:
2665         * kjs/regexp.cpp:
2666         * kjs/regexp.h:
2667         * wrec: Added.
2668         * wrec/WREC.cpp: Added.
2669         * wrec/WREC.h: Added.
2670         * wtf/Platform.h:
2671
2672 2008-08-26  Sam Weinig  <sam@webkit.org>
2673
2674         Rubber-stamped by Oliver Hunt.
2675
2676         Remove bogus assertion.
2677
2678         * VM/Machine.cpp:
2679         (KJS::Machine::cti_op_del_by_id):
2680
2681 2008-08-26  Mark Rowe  <mrowe@apple.com>
2682
2683         Reviewed by Sam Weinig.
2684
2685         Implement op_push_new_scope and stub out op_catch.  This fixes 11 Mozilla tests.
2686
2687         * VM/CTI.cpp:
2688         (KJS::CTI::privateCompile_pass1_Scan):
2689         (KJS::CTI::privateCompile_pass2_Main):
2690         * VM/Machine.cpp:
2691         (KJS::Machine::cti_op_push_new_scope):
2692         (KJS::Machine::cti_op_catch):
2693         * VM/Machine.h:
2694
2695 2008-08-26  Mark Rowe  <mrowe@apple.com>
2696
2697         Reviewed by Sam Weinig.
2698
2699         Clean up op_resolve_base so that it shares its implementation with the bytecode interpreter.
2700
2701         * VM/Machine.cpp:
2702         (KJS::inlineResolveBase):
2703         (KJS::resolveBase):
2704
2705 2008-08-26  Oliver Hunt  <oliver@apple.com>
2706
2707         Reviewed by Sam Weinig.
2708
2709         Add codegen support for op_instanceof, fixing 15 mozilla tests.
2710
2711         * VM/CTI.cpp:
2712         (KJS::CTI::privateCompile_pass1_Scan):
2713         (KJS::CTI::privateCompile_pass2_Main):
2714         * VM/Machine.cpp:
2715         (KJS::Machine::cti_op_instanceof):
2716         (KJS::Machine::cti_op_del_by_id):
2717         * VM/Machine.h:
2718         * wtf/Platform.h:
2719
2720 2008-08-26  Gavin Barraclough  <barraclough@apple.com>
2721
2722         Reviewed by Geoff Garen.
2723
2724         Fixes for initial review comments.
2725
2726         * VM/CTI.cpp:
2727         (KJS::CTI::ctiCompileGetArg):
2728         (KJS::CTI::ctiCompileGetPutArg):
2729         (KJS::CTI::ctiCompilePutResult):
2730         (KJS::CTI::ctiCompileCall):
2731         (KJS::CTI::CTI):
2732         (KJS::CTI::privateCompile_pass1_Scan):
2733         (KJS::CTI::printOpcodeOperandTypes):
2734         (KJS::CTI::privateCompile_pass2_Main):
2735         (KJS::CTI::privateCompile_pass4_SlowCases):
2736         (KJS::CTI::privateCompile):
2737         * VM/CTI.h:
2738         * VM/Register.h:
2739         * kjs/JSValue.h:
2740
2741 2008-08-26  Sam Weinig  <sam@webkit.org>
2742
2743         Reviewed by Gavin Barraclough and Geoff Garen.
2744
2745         Fix up exception checking code.
2746
2747         * VM/Machine.cpp:
2748         (KJS::Machine::cti_op_call):
2749         (KJS::Machine::cti_op_resolve):
2750         (KJS::Machine::cti_op_construct):
2751         (KJS::Machine::cti_op_resolve_func):
2752         (KJS::Machine::cti_op_resolve_skip):
2753         (KJS::Machine::cti_op_resolve_with_base):
2754         (KJS::Machine::cti_op_call_eval):
2755
2756 2008-08-26  Sam Weinig  <sam@webkit.org>
2757
2758         Reviewed by Oliver Hunt.
2759
2760         Fix slowcase for op_post_inc and op_post_dec fixing 2 mozilla tests.
2761
2762         * VM/CTI.cpp:
2763         (KJS::CTI::privateCompile_pass4_SlowCases):
2764
2765 2008-08-26  Mark Rowe  <mrowe@apple.com>
2766
2767         Reviewed by Sam Weinig.
2768
2769         Implement op_in, fixing 8 mozilla tests.
2770
2771         * VM/CTI.cpp:
2772         (KJS::CTI::privateCompile_pass1_Scan):
2773         (KJS::CTI::privateCompile_pass2_Main):
2774         * VM/Machine.cpp:
2775         (KJS::Machine::cti_op_in):
2776         * VM/Machine.h:
2777
2778 2008-08-26  Mark Rowe  <mrowe@apple.com>
2779
2780         Rubber-stamped by Oliver Hunt.
2781
2782         Don't hardcode the size of a Register for op_new_array.  Fixes a crash
2783         seen during the Mozilla tests.
2784
2785         * VM/CTI.cpp:
2786         (KJS::CTI::privateCompile_pass2_Main):
2787
2788 2008-08-26  Sam Weinig  <sam@webkit.org>
2789
2790         Reviewed by Gavin Barraclough and Geoff Garen.
2791
2792         Add support for op_push_scope and op_pop_scope, fixing 20 mozilla tests.
2793
2794         * VM/CTI.cpp:
2795         (KJS::CTI::privateCompile_pass1_Scan):
2796         (KJS::CTI::privateCompile_pass2_Main):
2797         * VM/CTI.h:
2798         * VM/Machine.cpp:
2799         (KJS::Machine::cti_op_push_scope):
2800         (KJS::Machine::cti_op_pop_scope):
2801         * VM/Machine.h:
2802
2803 2008-08-26  Oliver Hunt  <oliver@apple.com>
2804
2805         Reviewed by Maciej Stachowiak.
2806
2807         Add codegen support for op_del_by_id, fixing 49 mozilla tests.
2808
2809         * VM/CTI.cpp:
2810         (KJS::CTI::privateCompile_pass1_Scan):
2811         (KJS::CTI::privateCompile_pass2_Main):
2812         * VM/Machine.cpp:
2813         (KJS::Machine::cti_op_del_by_id):
2814         * VM/Machine.h:
2815
2816 2008-08-26  Sam Weinig  <sam@webkit.org>
2817
2818         Reviewed by Gavin Barraclough and Geoff Garen.
2819
2820         Don't hardcode the size of a Register for op_get_scoped_var and op_put_scoped_var 
2821         fixing 513 mozilla tests in debug build.
2822
2823         * VM/CTI.cpp:
2824         (KJS::CTI::privateCompile_pass2_Main):
2825
2826 2008-08-26  Oliver Hunt  <oliver@apple.com>
2827
2828         Reviewed by Maciej Stachowiak.
2829         
2830         Added code generator support for op_loop, fixing around 60 mozilla tests.
2831
2832         * VM/CTI.cpp:
2833         (KJS::CTI::privateCompile_pass1_Scan):
2834         (KJS::CTI::privateCompile_pass2_Main):
2835
2836 2008-08-26  Mark Rowe  <mrowe@apple.com>
2837
2838         Reviewed by Sam Weinig.
2839
2840         Set -fomit-frame-pointer in the correct location.
2841
2842         * Configurations/JavaScriptCore.xcconfig:
2843         * JavaScriptCore.xcodeproj/project.pbxproj:
2844
2845 2008-08-26  Gavin Barraclough  <barraclough@apple.com>
2846
2847         Reviewed by Geoff Garen.
2848         
2849         Inital cut of CTI, Geoff's review fixes to follow.
2850
2851         * JavaScriptCore.xcodeproj/project.pbxproj:
2852         * VM/CTI.cpp: Added.
2853         (KJS::getJCB):
2854         (KJS::CTI::ctiCompileGetArg):
2855         (KJS::CTI::ctiCompileGetPutArg):
2856         (KJS::CTI::ctiCompilePutArg):
2857         (KJS::CTI::ctiCompilePutArgImm):
2858         (KJS::CTI::ctiImmediateNumericArg):
2859         (KJS::CTI::ctiCompileGetCTIParam):
2860         (KJS::CTI::ctiCompilePutResult):
2861         (KJS::CTI::ctiCompileCall):
2862         (KJS::CTI::slowCaseIfNotImm):
2863         (KJS::CTI::slowCaseIfNotImms):
2864         (KJS::CTI::ctiFastArithDeTagConstImmediate):
2865         (KJS::CTI::ctiFastArithDeTagImmediate):
2866         (KJS::CTI::ctiFastArithReTagImmediate):
2867         (KJS::CTI::ctiFastArithPotentiallyReTagImmediate):
2868         (KJS::CTI::ctiFastArithImmToInt):
2869         (KJS::CTI::ctiFastArithIntToImmOrSlowCase):
2870         (KJS::CTI::CTI):
2871         (KJS::CTI::privateCompile_pass1_Scan):
2872         (KJS::CTI::ctiCompileAdd):
2873         (KJS::CTI::ctiCompileAddImm):
2874         (KJS::CTI::ctiCompileAddImmNotInt):
2875         (KJS::CTI::TEMP_HACK_PRINT_TYPES):
2876         (KJS::CTI::privateCompile_pass2_Main):
2877         (KJS::CTI::privateCompile_pass3_Link):
2878         (KJS::CTI::privateCompile_pass4_SlowCases):
2879         (KJS::CTI::privateCompile):
2880         * VM/CTI.h: Added.
2881         (KJS::CTI2Result::CTI2Result):
2882         (KJS::CallRecord::CallRecord):
2883         (KJS::JmpTable::JmpTable):
2884         (KJS::SlowCaseEntry::SlowCaseEntry):
2885         (KJS::CTI::compile):
2886         (KJS::CTI::LabelInfo::LabelInfo):
2887         * VM/CodeBlock.h:
2888         (KJS::CodeBlock::CodeBlock):
2889         (KJS::CodeBlock::~CodeBlock):
2890         * VM/Machine.cpp:
2891         (KJS::Machine::execute):
2892         (KJS::Machine::privateExecute):
2893         (KJS::ctiException):
2894         (KJS::ctiUnsupported):
2895         (KJS::ctiTimedOut):
2896         (KJS::Machine::cti_op_end):
2897         (KJS::Machine::cti_op_add):
2898         (KJS::Machine::cti_op_pre_inc):
2899         (KJS::Machine::cti_timeout_check):
2900         (KJS::Machine::cti_op_loop_if_less):
2901         (KJS::Machine::cti_op_new_object):
2902         (KJS::Machine::cti_op_put_by_id):
2903         (KJS::Machine::cti_op_get_by_id):
2904         (KJS::Machine::cti_op_mul):
2905         (KJS::Machine::cti_op_new_func):
2906         (KJS::Machine::cti_op_call):
2907         (KJS::Machine::cti_op_ret):
2908         (KJS::Machine::cti_op_new_array):
2909         (KJS::Machine::cti_op_resolve):
2910         (KJS::Machine::cti_op_construct):
2911         (KJS::Machine::cti_op_get_by_val):
2912         (KJS::Machine::cti_op_resolve_func):
2913         (KJS::Machine::cti_op_sub):
2914         (KJS::Machine::cti_op_put_by_val):
2915         (KJS::Machine::cti_op_lesseq):
2916         (KJS::Machine::cti_op_loop_if_true):
2917         (KJS::Machine::cti_op_negate):
2918         (KJS::Machine::cti_op_resolve_base):
2919         (KJS::Machine::cti_op_resolve_skip):
2920         (KJS::Machine::cti_op_div):
2921         (KJS::Machine::cti_op_pre_dec):
2922         (KJS::Machine::cti_op_jless):
2923         (KJS::Machine::cti_op_not):
2924         (KJS::Machine::cti_op_jtrue):
2925         (KJS::Machine::cti_op_post_inc):
2926         (KJS::Machine::cti_op_eq):
2927         (KJS::Machine::cti_op_lshift):
2928         (KJS::Machine::cti_op_bitand):
2929         (KJS::Machine::cti_op_rshift):
2930         (KJS::Machine::cti_op_bitnot):
2931         (KJS::Machine::cti_op_resolve_with_base):
2932         (KJS::Machine::cti_op_new_func_exp):
2933         (KJS::Machine::cti_op_mod):
2934         (KJS::Machine::cti_op_less):
2935         (KJS::Machine::cti_op_neq):
2936         (KJS::Machine::cti_op_post_dec):
2937         (KJS::Machine::cti_op_urshift):
2938         (KJS::Machine::cti_op_bitxor):
2939         (KJS::Machine::cti_op_new_regexp):
2940         (KJS::Machine::cti_op_bitor):
2941         (KJS::Machine::cti_op_call_eval):
2942         (KJS::Machine::cti_op_throw):
2943         (KJS::Machine::cti_op_get_pnames):
2944         (KJS::Machine::cti_op_next_pname):
2945         (KJS::Machine::cti_op_typeof):
2946         (KJS::Machine::cti_op_stricteq):
2947         (KJS::Machine::cti_op_nstricteq):
2948         (KJS::Machine::cti_op_to_jsnumber):
2949         * VM/Machine.h:
2950         * VM/Register.h:
2951         (KJS::Register::jsValue):
2952         (KJS::Register::getJSValue):
2953         (KJS::Register::codeBlock):
2954         (KJS::Register::scopeChain):
2955         (KJS::Register::i):
2956         (KJS::Register::r):
2957         (KJS::Register::vPC):
2958         (KJS::Register::jsPropertyNameIterator):
2959         * VM/SamplingTool.cpp:
2960         (KJS::):
2961         (KJS::SamplingTool::run):
2962         (KJS::SamplingTool::dump):
2963         * VM/SamplingTool.h:
2964         * kjs/JSImmediate.h:
2965         (KJS::JSImmediate::zeroImmediate):
2966         (KJS::JSImmediate::oneImmediate):
2967         * kjs/JSValue.h:
2968         * kjs/JSVariableObject.h:
2969         (KJS::JSVariableObject::JSVariableObjectData::offsetOf_registers):
2970         (KJS::JSVariableObject::offsetOf_d):
2971         (KJS::JSVariableObject::offsetOf_Data_registers):
2972         * masm: Added.
2973         * masm/IA32MacroAsm.h: Added.
2974         (KJS::JITCodeBuffer::JITCodeBuffer):
2975         (KJS::JITCodeBuffer::putByte):
2976         (KJS::JITCodeBuffer::putShort):
2977         (KJS::JITCodeBuffer::putInt):
2978         (KJS::JITCodeBuffer::getEIP):
2979         (KJS::JITCodeBuffer::start):
2980         (KJS::JITCodeBuffer::getOffset):
2981         (KJS::JITCodeBuffer::reset):
2982         (KJS::JITCodeBuffer::copy):
2983         (KJS::IA32MacroAssembler::):
2984         (KJS::IA32MacroAssembler::emitModRm_rr):
2985         (KJS::IA32MacroAssembler::emitModRm_rm):
2986         (KJS::IA32MacroAssembler::emitModRm_rmsib):
2987         (KJS::IA32MacroAssembler::emitModRm_opr):
2988         (KJS::IA32MacroAssembler::emitModRm_opm):
2989         (KJS::IA32MacroAssembler::IA32MacroAssembler):
2990         (KJS::IA32MacroAssembler::emitInt3):
2991         (KJS::IA32MacroAssembler::emitPushl_r):
2992         (KJS::IA32MacroAssembler::emitPopl_r):
2993         (KJS::IA32MacroAssembler::emitMovl_rr):
2994         (KJS::IA32MacroAssembler::emitAddl_rr):
2995         (KJS::IA32MacroAssembler::emitAddl_i8r):
2996         (KJS::IA32MacroAssembler::emitAddl_i32r):
2997         (KJS::IA32MacroAssembler::emitAddl_mr):
2998         (KJS::IA32MacroAssembler::emitAndl_rr):
2999         (KJS::IA32MacroAssembler::emitAndl_i32r):
3000         (KJS::IA32MacroAssembler::emitCmpl_i8r):
3001         (KJS::IA32MacroAssembler::emitCmpl_rr):
3002         (KJS::IA32MacroAssembler::emitCmpl_rm):
3003         (KJS::IA32MacroAssembler::emitCmpl_i32r):
3004         (KJS::IA32MacroAssembler::emitCmpw_rm):
3005         (KJS::IA32MacroAssembler::emitOrl_rr):
3006         (KJS::IA32MacroAssembler::emitOrl_i8r):
3007         (KJS::IA32MacroAssembler::emitSubl_rr):
3008         (KJS::IA32MacroAssembler::emitSubl_i8r):
3009         (KJS::IA32MacroAssembler::emitSubl_i32r):
3010         (KJS::IA32MacroAssembler::emitSubl_mr):
3011         (KJS::IA32MacroAssembler::emitTestl_i32r):
3012         (KJS::IA32MacroAssembler::emitTestl_rr):
3013         (KJS::IA32MacroAssembler::emitXorl_i8r):
3014         (KJS::IA32MacroAssembler::emitXorl_rr):
3015         (KJS::IA32MacroAssembler::emitSarl_i8r):
3016         (KJS::IA32MacroAssembler::emitSarl_CLr):
3017         (KJS::IA32MacroAssembler::emitShl_i8r):
3018         (KJS::IA32MacroAssembler::emitShll_CLr):
3019         (KJS::IA32MacroAssembler::emitMull_rr):
3020         (KJS::IA32MacroAssembler::emitIdivl_r):
3021         (KJS::IA32MacroAssembler::emitCdq):
3022         (KJS::IA32MacroAssembler::emitMovl_mr):
3023         (KJS::IA32MacroAssembler::emitMovzwl_mr):
3024         (KJS::IA32MacroAssembler::emitMovl_rm):
3025         (KJS::IA32MacroAssembler::emitMovl_i32r):
3026         (KJS::IA32MacroAssembler::emitMovl_i32m):
3027         (KJS::IA32MacroAssembler::emitLeal_mr):
3028         (KJS::IA32MacroAssembler::emitRet):
3029         (KJS::IA32MacroAssembler::JmpSrc::JmpSrc):
3030         (KJS::IA32MacroAssembler::JmpDst::JmpDst):
3031         (KJS::IA32MacroAssembler::emitCall):
3032         (KJS::IA32MacroAssembler::label):
3033         (KJS::IA32MacroAssembler::emitUnlinkedJmp):
3034         (KJS::IA32MacroAssembler::emitUnlinkedJne):
3035         (KJS::IA32MacroAssembler::emitUnlinkedJe):
3036         (KJS::IA32MacroAssembler::emitUnlinkedJl):
3037         (KJS::IA32MacroAssembler::emitUnlinkedJle):
3038         (KJS::IA32MacroAssembler::emitUnlinkedJge):
3039         (KJS::IA32MacroAssembler::emitUnlinkedJae):
3040         (KJS::IA32MacroAssembler::emitUnlinkedJo):
3041         (KJS::IA32MacroAssembler::emitPredictionNotTaken):
3042         (KJS::IA32MacroAssembler::link):
3043         (KJS::IA32MacroAssembler::copy):
3044         * wtf/Platform.h:
3045
3046 2008-08-26  Oliver Hunt  <oliver@apple.com>
3047
3048         RS=Maciej.
3049
3050         Enabled -fomit-frame-pointer on Release and Production builds, add additional Profiling build config for shark, etc.
3051
3052         * JavaScriptCore.xcodeproj/project.pbxproj:
3053
3054 === Start merge of squirrelfish-extreme ===
3055
3056 2008-09-06  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3057
3058         Reviewed by Maciej Stachowiak.
3059
3060         Fix the Mac Debug build by adding symbols that are exported only in a
3061         Debug configuration.
3062
3063         * Configurations/JavaScriptCore.xcconfig:
3064         * DerivedSources.make:
3065         * JavaScriptCore.Debug.exp: Added.
3066         * JavaScriptCore.base.exp: Copied from JavaScriptCore.exp.
3067         * JavaScriptCore.exp: Removed.
3068         * JavaScriptCore.xcodeproj/project.pbxproj:
3069
3070 2008-09-05  Darin Adler  <darin@apple.com>
3071
3072         Reviewed by Cameron Zwarich.
3073
3074         - https://bugs.webkit.org/show_bug.cgi?id=20681
3075           JSPropertyNameIterator functions need to be inlined
3076
3077         1.007x as fast on SunSpider overall
3078         1.081x as fast on SunSpider math-cordic
3079
3080         * VM/JSPropertyNameIterator.cpp: Moved functions out of here.
3081         * VM/JSPropertyNameIterator.h:
3082         (KJS::JSPropertyNameIterator::JSPropertyNameIterator): Moved
3083         this into the header and marked it inline.
3084         (KJS::JSPropertyNameIterator::create): Ditto.
3085         (KJS::JSPropertyNameIterator::next): Ditto.
3086
3087 2008-09-05  Darin Adler  <darin@apple.com>
3088
3089         Reviewed by Geoffrey Garen.
3090
3091         - fix https://bugs.webkit.org/show_bug.cgi?id=20673
3092           single-character strings are churning in the Identifier table
3093
3094         1.007x as fast on SunSpider overall
3095         1.167x as fast on SunSpider string-fasta
3096
3097         * JavaScriptCore.exp: Updated.
3098         * kjs/SmallStrings.cpp:
3099         (KJS::SmallStrings::singleCharacterStringRep): Added.
3100         * kjs/SmallStrings.h: Added singleCharacterStringRep for clients that
3101         need just a UString, not a JSString.
3102         * kjs/identifier.cpp:
3103         (KJS::Identifier::add): Added special cases for single character strings
3104         so that the UString::Rep that ends up in the identifier table is the one
3105         from the single-character string optimization; otherwise we end up having
3106         to look it up in the identifier table over and over again.
3107         (KJS::Identifier::addSlowCase): Ditto.
3108         (KJS::Identifier::checkSameIdentifierTable): Made this function an empty
3109         inline in release builds so that callers don't have to put #ifndef NDEBUG
3110         at each call site.
3111         * kjs/identifier.h:
3112         (KJS::Identifier::add): Removed #ifndef NDEBUG around the calls to
3113         checkSameIdentifierTable.
3114         (KJS::Identifier::checkSameIdentifierTable): Added. Empty inline version
3115         for NDEBUG builds.
3116
3117 2008-09-05  Mark Rowe  <mrowe@apple.com>
3118
3119         Build fix.
3120
3121         * kjs/JSObject.h: Move the inline virtual destructor after a non-inline
3122         virtual function so that the symbol for the vtable is not marked as a
3123         weakly exported symbol.
3124
3125 2008-09-05  Darin Adler  <darin@apple.com>
3126
3127         Reviewed by Sam Weinig.
3128
3129         - fix https://bugs.webkit.org/show_bug.cgi?id=20671
3130           JavaScriptCore string manipulation spends too much time in memcpy
3131
3132         1.011x as fast on SunSpider overall
3133         1.028x as fast on SunSpider string tests
3134
3135         For small strings, use a loop rather than calling memcpy. The loop can
3136         be faster because there's no function call overhead, and because it can
3137         assume the pointers are aligned instead of checking that. Currently the
3138         threshold is set at 20 characters, based on some testing on one particular
3139         computer. Later we can tune this for various platforms by setting
3140         USTRING_COPY_CHARS_INLINE_CUTOFF appropriately, but it does no great harm
3141         if not perfectly tuned.
3142
3143         * kjs/ustring.cpp:
3144         (KJS::overflowIndicator): Removed bogus const.
3145         (KJS::maxUChars): Ditto.
3146         (KJS::copyChars): Added.
3147         (KJS::UString::Rep::createCopying): Call copyChars instead of memcpy.
3148         Also eliminated need for const_cast.
3149         (KJS::UString::expandPreCapacity): Ditto.
3150         (KJS::concatenate): Ditto.
3151         (KJS::UString::spliceSubstringsWithSeparators): Ditto.
3152         (KJS::UString::append): Ditto.
3153
3154 2008-09-05  Kevin McCullough  <kmccullough@apple.com>
3155
3156         Reviewed by Sam and Alexey.
3157
3158         Make the profiler work with a null exec state.  This will allow other
3159         applications start the profiler to get DTrace probes going without
3160         needing a WebView.
3161
3162         * ChangeLog:
3163         * profiler/ProfileGenerator.cpp:
3164         (KJS::ProfileGenerator::ProfileGenerator):
3165         (KJS::ProfileGenerator::willExecute):
3166         (KJS::ProfileGenerator::didExecute):
3167         * profiler/Profiler.cpp:
3168         (KJS::Profiler::startProfiling):
3169         (KJS::Profiler::stopProfiling):
3170         (KJS::dispatchFunctionToProfiles):
3171
3172 2008-09-04  Gavin Barraclough  <barraclough@apple.com>
3173
3174         Reviewed by Geoffrey Garen.
3175         
3176         Fixed an off-by-one error that would cause the StructureIDChain to
3177         be one object too short.
3178         
3179         Can't construct a test case because other factors make this not crash
3180         (yet!).
3181
3182         * kjs/StructureID.cpp:
3183         (KJS::StructureIDChain::StructureIDChain):
3184
3185 2008-09-04  Kevin Ollivier  <kevino@theolliviers.com>
3186
3187         wx build fixes.
3188
3189         * JavaScriptCoreSources.bkl:
3190
3191 2008-09-04  Mark Rowe  <mrowe@apple.com>
3192
3193         Reviewed by Eric Seidel.
3194
3195         Fix https://bugs.webkit.org/show_bug.cgi?id=20639.
3196         Bug 20639: ENABLE_DASHBOARD_SUPPORT does not need to be a FEATURE_DEFINE
3197
3198         * Configurations/JavaScriptCore.xcconfig: Remove ENABLE_DASHBOARD_SUPPORT from FEATURE_DEFINES.
3199         * wtf/Platform.h: Set ENABLE_DASHBOARD_SUPPORT for PLATFORM(MAC).
3200
3201 2008-09-04  Adele Peterson  <adele@apple.com>
3202
3203         Build fix.
3204
3205         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3206         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
3207         * JavaScriptCore.vcproj/jsc/jsc.vcproj:
3208
3209 2008-09-04  Mark Rowe  <mrowe@apple.com>
3210
3211         Mac build fix.
3212
3213         * kjs/config.h: Only check the value of HAVE_CONFIG_H if it is defined.
3214
3215 2008-09-04  Marco Barisione  <marco.barisione@collabora.co.uk>
3216
3217         Reviewed by Eric Seidel.
3218
3219         http://bugs.webkit.org/show_bug.cgi?id=20380
3220         [GTK][AUTOTOOLS] Include autotoolsconfig.h from config.h
3221
3222         * kjs/config.h: Include the configuration header generated by
3223         autotools if available.
3224
3225 2008-09-04  Tor Arne Vestbø  <tavestbo@trolltech.com>
3226
3227         Reviewed by Simon.
3228
3229         Fix the QtWebKit build to match changes in r36016
3230
3231         * JavaScriptCore.pri:
3232
3233 2008-09-04  Mark Rowe  <mrowe@apple.com>
3234
3235         Fix the 64-bit build.
3236
3237         * VM/CodeBlock.cpp:
3238         (KJS::CodeBlock::printStructureID): Store the instruction offset into an unsigned local
3239         to avoid a warning related to format specifiers.
3240         (KJS::CodeBlock::printStructureIDs): Ditto.
3241
3242 2008-09-04  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3243
3244         Rubber-stamped by Oliver Hunt.
3245
3246         Correct the spelling of 'entryIndices'.
3247
3248         * kjs/PropertyMap.cpp:
3249         (KJS::PropertyMap::get):
3250         (KJS::PropertyMap::getLocation):
3251         (KJS::PropertyMap::put):
3252         (KJS::PropertyMap::insert):
3253         (KJS::PropertyMap::remove):
3254         (KJS::PropertyMap::checkConsistency):
3255         * kjs/PropertyMap.h:
3256         (KJS::PropertyMapHashTable::entries):
3257         (KJS::PropertyMap::getOffset):
3258         (KJS::PropertyMap::putOffset):
3259         (KJS::PropertyMap::offsetForTableLocation):
3260
3261 2008-09-03  Geoffrey Garen  <ggaren@apple.com>
3262
3263         Reviewed by Cameron Zwarich.
3264         
3265         Fixed <rdar://problem/6193925> REGRESSION: Crash occurs at
3266         KJS::Machine::privateExecute() when attempting to load my Mobile Gallery
3267         (http://www.me.com/gallery/#home)
3268         
3269         also
3270         
3271         https://bugs.webkit.org/show_bug.cgi?id=20633 Crash in privateExecute
3272         @ cs.byu.edu
3273         
3274         The underlying problem was that we would cache prototype properties
3275         even if the prototype was a dictionary.
3276         
3277         The fix is to transition a prototype back from dictionary to normal
3278         status when an opcode caches access to it. (This is better than just
3279         refusing to cache, since a heavily accessed prototype is almost
3280         certainly not a true dictionary.)
3281
3282         * VM/Machine.cpp:
3283         (KJS::Machine::tryCacheGetByID):
3284         * kjs/JSObject.h:
3285
3286 2008-09-03  Eric Seidel  <eric@webkit.org>
3287
3288         Reviewed by Sam.
3289
3290         Clean up Platform.h and add PLATFORM(CHROMIUM), PLATFORM(SKIA) and USE(V8_BINDINGS)
3291
3292         * Configurations/JavaScriptCore.xcconfig: add missing ENABLE_*
3293         * wtf/ASCIICType.h: include <wtf/Assertions.h> since it depends on it.
3294         * wtf/Platform.h:
3295
3296 2008-09-03  Kevin McCullough  <kmccullough@apple.com>
3297
3298         Reviewed by Tim.
3299
3300         Remove the rest of the "zombie" code from the profiler.
3301         - There is no longer a need for the ProfilerClient callback mechanism.
3302
3303         * API/JSProfilerPrivate.cpp:
3304         (JSStartProfiling):
3305         * JavaScriptCore.exp:
3306         * profiler/HeavyProfile.h:
3307         * profiler/ProfileGenerator.cpp:
3308         (KJS::ProfileGenerator::create):
3309         (KJS::ProfileGenerator::ProfileGenerator):
3310         * profiler/ProfileGenerator.h:
3311         (KJS::ProfileGenerator::profileGroup):
3312         * profiler/Profiler.cpp:
3313         (KJS::Profiler::startProfiling):
3314         (KJS::Profiler::stopProfiling): Immediately return the profile when
3315         stopped instead of using a callback.
3316         * profiler/Profiler.h:
3317         * profiler/TreeProfile.h:
3318
3319 2008-09-03  Adele Peterson  <adele@apple.com>
3320
3321         Build fix.
3322
3323         * wtf/win/MainThreadWin.cpp:
3324
3325 2008-09-02  Kevin McCullough  <kmccullough@apple.com>
3326
3327         Reviewed by Darin and Tim.
3328
3329         Remove most of the "zombie" mode from the profiler.  Next we will need
3330         to remove the client callback mechanism in profiles.
3331
3332         - This simplifies the code, leverages the recent changes I've made in
3333         getting line numbers from SquirrelFish, and is a slight speed
3334         improvement on SunSpider.
3335         - Also the "zombie" mode was a constant source of odd edge cases and
3336         obscure bugs so it's good to remove since all of its issues may not have
3337         been found.
3338
3339         * API/JSProfilerPrivate.cpp: No need to call didFinishAllExecution() any
3340         more.
3341         (JSEndProfiling):
3342         * JavaScriptCore.exp: Export the new signature of retrieveLastCaller()
3343         * VM/Machine.cpp:
3344         (KJS::Machine::execute): No need to call didFinishAllExecution() any
3345         more.
3346         (KJS::Machine::retrieveCaller): Now operates on InternalFunctions now
3347         since the RegisterFile is no longer guaranteeded to store only
3348         JSFunctions
3349         (KJS::Machine::retrieveLastCaller): Now also retrieve the function's
3350         name
3351         (KJS::Machine::callFrame): A result of changing retrieveCaller()
3352         * VM/Machine.h:
3353         * VM/Register.h: 
3354         * kjs/JSGlobalObject.cpp:
3355         (KJS::JSGlobalObject::~JSGlobalObject):
3356         * kjs/nodes.h:
3357         * profiler/ProfileGenerator.cpp:
3358         (KJS::ProfileGenerator::create): Now pass the original exec and get the
3359         global exec and client when necessary.  We need the original exec so we
3360         can have the stack frame where profiling started.
3361         (KJS::ProfileGenerator::ProfileGenerator): ditto.
3362         (KJS::ProfileGenerator::addParentForConsoleStart): This is where the 
3363         parent to star of the profile is added, if there is one.
3364         (KJS::ProfileGenerator::willExecute): Remove uglyness!
3365         (KJS::ProfileGenerator::didExecute): Ditto!
3366         (KJS::ProfileGenerator::stopProfiling):
3367         (KJS::ProfileGenerator::removeProfileStart): Use a better way to find
3368         and remove the function we are looking for.
3369         (KJS::ProfileGenerator::removeProfileEnd): Ditto.
3370         * profiler/ProfileGenerator.h:
3371         (KJS::ProfileGenerator::client):
3372         * profiler/ProfileNode.cpp:
3373         (KJS::ProfileNode::removeChild): Add a better way to remove a child from
3374         a ProfileNode.
3375         (KJS::ProfileNode::stopProfiling):
3376         (KJS::ProfileNode::debugPrintData): Modified a debug-only diagnostic
3377         function to be sane.
3378         * profiler/ProfileNode.h:
3379         * profiler/Profiler.cpp: Change to pass the original exec state.
3380         (KJS::Profiler::startProfiling):
3381         (KJS::Profiler::stopProfiling):
3382         (KJS::Profiler::willExecute):
3383         (KJS::Profiler::didExecute):
3384         (KJS::Profiler::createCallIdentifier):
3385         * profiler/Profiler.h:
3386
3387 2008-09-01  Alexey Proskuryakov  <ap@webkit.org>
3388
3389         Reviewed by Darin Adler.
3390
3391         Implement callOnMainThreadAndWait().
3392
3393         This will be useful when a background thread needs to perform UI calls synchronously
3394         (e.g. an openDatabase() call cannot return until the user answers to a confirmation dialog).
3395
3396         * wtf/MainThread.cpp:
3397         (WTF::FunctionWithContext::FunctionWithContext): Added a ThreadCondition member. When
3398         non-zero, the condition is signalled after the function is called.
3399         (WTF::mainThreadFunctionQueueMutex): Renamed from functionQueueMutex, sinc this is no longer
3400         static. Changed to be initialized from initializeThreading() to avoid lock contention.
3401         (WTF::initializeMainThread): On non-Windows platforms, just call mainThreadFunctionQueueMutex.
3402         (WTF::dispatchFunctionsFromMainThread): Signal synchronous calls when done.
3403         (WTF::callOnMainThread): Updated for functionQueueMutex rename.
3404         (WTF::callOnMainThreadAndWait):  Added.
3405
3406         * wtf/MainThread.h: Added callOnMainThreadAndWait(); initializeMainThread() now exists on
3407         all platforms.
3408
3409         * wtf/win/MainThreadWin.cpp: (WTF::initializeMainThread): Added a callOnMainThreadAndWait()
3410         call to initialize function queue mutex.
3411
3412         * wtf/ThreadingGtk.cpp: (WTF::initializeThreading):
3413         * wtf/ThreadingPthreads.cpp: (WTF::initializeThreading):
3414         * wtf/ThreadingQt.cpp: (WTF::initializeThreading):
3415         Only initialize mainThreadIdentifier on non-Darwin platforms. It was not guaranteed to be
3416         accurate on Darwin.
3417
3418 2008-09-03  Geoffrey Garen  <ggaren@apple.com>
3419
3420         Reviewed by Darin Adler.
3421         
3422         Use isUndefinedOrNull() instead of separate checks for each in op_eq_null
3423         and op_neq_null.
3424
3425         * VM/Machine.cpp:
3426         (KJS::Machine::privateExecute):
3427
3428 2008-09-02  Csaba Osztrogonac  <oszi@inf.u-szeged.hu>
3429
3430         Reviewed by Darin Adler.
3431
3432         Bug 20296: OpcodeStats doesn't build on platforms which don't have mergesort().
3433         <https://bugs.webkit.org/show_bug.cgi?id=20296>
3434
3435         * VM/Opcode.cpp:
3436         (KJS::OpcodeStats::~OpcodeStats): mergesort() replaced with qsort()
3437
3438 2008-09-02  Geoffrey Garen  <ggaren@apple.com>
3439
3440         Reviewed by Oliver Hunt.
3441         
3442         Fast path for array.length and string.length.
3443         
3444         SunSpider says 0.5% faster.
3445
3446 2008-09-02  Geoffrey Garen  <ggaren@apple.com>
3447
3448         Reviewed by Anders Carlsson.
3449         
3450         Added optimized paths for comparing to null.
3451         
3452         SunSpider says 0.5% faster.
3453
3454 2008-09-02  Geoffrey Garen  <ggaren@apple.com>
3455
3456         Reviewed by Sam Weinig.
3457
3458         Changed jsDriver.pl to dump the exact text you would need in order to
3459         reproduce a test result. This enables a fast workflow where you copy
3460         and paste a test failure in the terminal.
3461
3462         * tests/mozilla/jsDriver.pl:
3463
3464 2008-09-02  Geoffrey Garen  <ggaren@apple.com>
3465
3466         Reviewed by Sam Weinig.
3467         
3468         Implemented the rest of Darin's review comments for the 09-01 inline
3469         caching patch.
3470         
3471         SunSpider says 0.5% faster, but that seems like noise.
3472
3473         * JavaScriptCore.xcodeproj/project.pbxproj: Put PutPropertySlot into
3474         its own file, and added BatchedTransitionOptimizer.
3475
3476         * VM/CodeBlock.cpp:
3477         (KJS::CodeBlock::~CodeBlock): Use array indexing instead of a pointer
3478         iterator.
3479
3480         * VM/CodeGenerator.cpp:
3481         (KJS::CodeGenerator::CodeGenerator): Used BatchedTransitionOptimizer to
3482         make batched put and remove for declared variables fast, without forever
3483         pessimizing the global object. Removed the old getDirect/removeDirect hack
3484         that tried to do the same in a more limited way.
3485
3486         * VM/CodeGenerator.h: Moved IdentifierRepHash to the KJS namespace since
3487         it doesn't specialize anything in WTF.
3488
3489         * VM/Machine.cpp:
3490         (KJS::Machine::Machine): Nixed the DummyConstruct tag because it was
3491         confusingly named.
3492
3493         (KJS::Machine::execute):  Used BatchedTransitionOptimizer, as above. Fixed
3494         up some comments.
3495
3496         (KJS::cachePrototypeChain): Cast to JSObject*, since it's more specific.
3497
3498         (KJS::Machine::tryCachePutByID): Use isNull() instead of comparing to
3499         jsNull(), since isNull() leaves more options open for the future.
3500         (KJS::Machine::tryCacheGetByID): ditto
3501         (KJS::Machine::privateExecute): ditto
3502
3503         * VM/SamplingTool.cpp:
3504         (KJS::SamplingTool::dump): Use C++-style cast, to match our style
3505         guidelines.
3506
3507         * kjs/BatchedTransitionOptimizer.h: Added. New class that allows host
3508         code to add a batch of properties to an object in an efficient way.
3509
3510         * kjs/JSActivation.cpp: Use isNull(), as above.
3511
3512         * kjs/JSArray.cpp: Get rid of DummyConstruct tag, as above.
3513         * kjs/JSArray.h:
3514
3515         * kjs/JSGlobalData.cpp: Nixed two unused StructureIDs.
3516         * kjs/JSGlobalData.h:
3517
3518         * kjs/JSImmediate.cpp: Use isNull(), as above.
3519
3520         * kjs/JSObject.cpp:
3521         (KJS::JSObject::mark): Moved mark tracing code elsewhere, to make this
3522         function more readable.
3523
3524         (KJS::JSObject::put): Use isNull(), as above.
3525
3526         (KJS::JSObject::createInheritorID): Return a raw pointer, since the
3527         object is owned by a data member, not necessarily the caller.
3528         * kjs/JSObject.h:
3529
3530         * kjs/JSString.cpp: Use isNull(), as above.
3531
3532         * kjs/PropertyMap.h: Updated to use PropertySlot::invalidOffset.
3533
3534         * kjs/PropertySlot.h: Changed KJS_INVALID_OFFSET to WTF::notFound
3535         because C macros are so 80's.
3536
3537         * kjs/PutPropertySlot.h: Added. Split out of PropertySlot.h. Also renamed
3538         PutPropertySlot::SlotType to PutPropertySlot::Type, and slotBase to base,
3539         since "slot" was redundant.
3540
3541         * kjs/StructureID.cpp: Added a new transition *away* from dictionary
3542         status, to support BatchedTransitionOptimizer.
3543
3544         (KJS::StructureIDChain::StructureIDChain): No need to store m_size as
3545         a data member, so keep it in a local, which might be faster.
3546         * kjs/StructureID.h:
3547
3548         * kjs/SymbolTable.h: Moved IdentifierRepHash to KJS namespace, as above.
3549         * kjs/ustring.h:
3550
3551 2008-09-02  Adam Roben  <aroben@apple.com>
3552
3553         Windows build fixes
3554
3555         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
3556         StructureID.{cpp,h} to the project. Also let VS reorder this file.
3557         * VM/CodeBlock.cpp: Include StringExtras so that snprintf will be
3558         defined on Windows.
3559
3560 2008-09-01  Sam Weinig  <sam@webkit.org>
3561
3562         Fix release build.
3563
3564         * JavaScriptCore.exp:
3565
3566 2008-09-01  Jan Michael Alonzo  <jmalonzo@webkit.org>
3567
3568         Reviewed by Oliver Hunt.
3569
3570         Gtk buildfix
3571
3572         * GNUmakefile.am:
3573         * kjs/PropertyMap.cpp: rename Identifier.h to identifier.h
3574         * kjs/StructureID.cpp: include JSObject.h
3575
3576 2008-09-01  Geoffrey Garen  <ggaren@apple.com>
3577
3578         Reviewed by Darin Adler.
3579
3580         First cut at inline caching for access to vanilla JavaScript properties.
3581         
3582         SunSpider says 4% faster. Tests heavy on dictionary-like access have
3583         regressed a bit -- we have a lot of room to improve in this area,
3584         but this patch is over-ripe as-is.
3585         
3586         JSCells now have a StructureID that uniquely identifies their layout,
3587         and holds their prototype.
3588         
3589         JSValue::put takes a PropertySlot& argument, so it can fill in details
3590         about where it put a value, for the sake of caching.
3591
3592         * VM/CodeGenerator.cpp:
3593         (KJS::CodeGenerator::CodeGenerator): Avoid calling removeDirect if we
3594         can, since it disables inline caching in the global object. This can
3595         probably improve in the future.
3596
3597         * kjs/JSGlobalObject.cpp: Nixed reset(), since it complicates caching, and
3598         wasn't really&