2009-05-20 Xan Lopez <xlopez@igalia.com>
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2009-05-20  Xan Lopez  <xlopez@igalia.com>
2
3         Reviewed by Eric Seidel.
4
5         Fix GTK debug build.
6
7         The function dumpDisjunction, compiled with debug enabled, uses
8         printf, which needs stdio.h to be included.
9
10         * yarr/RegexInterpreter.cpp:
11
12 2009-05-20  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
13
14         Reviewed by George Staikos.
15
16         BUG 25843: [Qt] Remove qt-port build flag
17         <https://bugs.webkit.org/show_bug.cgi?id=25843>
18
19         * JavaScriptCore.pro:
20
21
22 2009-05-19  Geoffrey Garen  <ggaren@apple.com>
23
24         Windows build fix.
25
26         * interpreter/RegisterFile.cpp:
27         (JSC::RegisterFile::releaseExcessCapacity): Copy-paste typo.
28
29 2009-05-19  Geoffrey Garen  <ggaren@apple.com>
30
31         Reviewed by Sam Weinig.
32         
33         Fixed <rdar://problem/6885680> CrashTracer: [USER] 1 crash in Install
34         Mac OS X at <unknown binary> • 0x9274241c
35         
36         (Original patch by Joe Sokol and Ronnie Misra.)
37         
38         SunSpider says 1.004x faster.
39
40         * interpreter/RegisterFile.cpp:
41         (JSC::RegisterFile::releaseExcessCapacity): Instead of doing complicated
42         math that sometimes used to overflow, just release the full range of the
43         register file.
44
45         * interpreter/RegisterFile.h:
46         (JSC::isPageAligned):
47         (JSC::RegisterFile::RegisterFile): Added ASSERTs to verify that it's
48         safe to release the full range of the register file.
49
50         (JSC::RegisterFile::shrink): No need to releaseExcessCapacity() if the
51         new end is not smaller than the old end. (Also, doing so used to cause
52         numeric overflow, unmapping basically the whole process from memory.)
53
54 2009-05-19  Oliver Hunt  <oliver@apple.com>
55
56         RS=Mark Rowe.
57
58         <rdar://problem/6888393> REGRESSION: Start Debugging JavaScript crashes browser (nightly builds only?)
59         <https://bugs.webkit.org/show_bug.cgi?id=25717>
60
61         Remove JSC_FAST_CALL as it wasn't gaining us anything, and was
62         resulting in weird bugs in the nightly builds.
63
64         * parser/Nodes.cpp:
65         * parser/Nodes.h:
66         (JSC::ExpressionNode::isNumber):
67         (JSC::ExpressionNode::isString):
68         (JSC::ExpressionNode::isNull):
69         (JSC::ExpressionNode::isPure):
70         (JSC::ExpressionNode::isLocation):
71         (JSC::ExpressionNode::isResolveNode):
72         (JSC::ExpressionNode::isBracketAccessorNode):
73         (JSC::ExpressionNode::isDotAccessorNode):
74         (JSC::ExpressionNode::isFuncExprNode):
75         (JSC::ExpressionNode::isSimpleArray):
76         (JSC::ExpressionNode::isAdd):
77         (JSC::ExpressionNode::resultDescriptor):
78         (JSC::StatementNode::firstLine):
79         (JSC::StatementNode::lastLine):
80         (JSC::StatementNode::isEmptyStatement):
81         (JSC::StatementNode::isReturnNode):
82         (JSC::StatementNode::isExprStatement):
83         (JSC::StatementNode::isBlock):
84         (JSC::NullNode::isNull):
85         (JSC::BooleanNode::isPure):
86         (JSC::NumberNode::value):
87         (JSC::NumberNode::setValue):
88         (JSC::NumberNode::isNumber):
89         (JSC::NumberNode::isPure):
90         (JSC::StringNode::isPure):
91         (JSC::StringNode::isString):
92         (JSC::ResolveNode::identifier):
93         (JSC::ResolveNode::isLocation):
94         (JSC::ResolveNode::isResolveNode):
95         (JSC::BracketAccessorNode::isLocation):
96         (JSC::BracketAccessorNode::isBracketAccessorNode):
97         (JSC::DotAccessorNode::base):
98         (JSC::DotAccessorNode::identifier):
99         (JSC::DotAccessorNode::isLocation):
100         (JSC::DotAccessorNode::isDotAccessorNode):
101         (JSC::TypeOfResolveNode::identifier):
102         (JSC::AddNode::isAdd):
103         (JSC::BlockNode::isBlock):
104         (JSC::EmptyStatementNode::isEmptyStatement):
105         (JSC::ExprStatementNode::isExprStatement):
106         (JSC::ReturnNode::isReturnNode):
107         (JSC::ScopeNode::sourceURL):
108         (JSC::ProgramNode::bytecode):
109         (JSC::EvalNode::bytecode):
110         (JSC::FunctionBodyNode::parameters):
111         (JSC::FunctionBodyNode::toSourceString):
112         (JSC::FunctionBodyNode::bytecode):
113         (JSC::FuncExprNode::isFuncExprNode):
114
115 2009-05-19  Maciej Stachowiak  <mjs@apple.com>
116
117         Reviewed by Gavin Barraclough.
118         
119         - speed up string comparison, especially for short strings
120         
121         ~1% on SunSpider
122
123         * JavaScriptCore.exp:
124         * runtime/UString.cpp:
125         * runtime/UString.h:
126         (JSC::operator==): Inline UString's operator==, since it is called from
127         hot places in the runtime. Also, specialize 2-char strings in a similar way to
128         1-char, since we're taking the hit of a switch anyway.
129
130 2009-05-18  Maciej Stachowiak  <mjs@apple.com>
131
132         Reviewed by Gavin Barraclough.
133         
134         - for polymorphic prototype lookups, increase the number of slots from 4 to 8
135         
136         ~4% faster on v8 raytrace benchmark
137
138         * bytecode/Instruction.h:
139
140 2009-05-18  Maciej Stachowiak  <mjs@apple.com>
141
142         Reviewed by Oliver Hunt.
143         
144         - tighten up the code for the load_varargs stub
145         
146         ~1-2% on v8-raytrace
147         
148         * jit/JITStubs.cpp:
149         (JSC::JITStubs::cti_op_load_varargs): Hoist some loop invariants that
150         the compiler didn't feel like hoisting for us. Remove unneeded exception check.
151
152 2009-05-18  Maciej Stachowiak  <mjs@apple.com>
153
154         Reviewed by Geoff Garen.
155
156         - Improve code generation for access to prototype properties
157         
158         ~0.4% speedup on SunSpider.
159         
160         Based on a suggestion from Geoff Garen.
161
162         * jit/JIT.h:
163         * jit/JITPropertyAccess.cpp:
164         (JSC::JIT::compileGetDirectOffset):
165         (JSC::JIT::privateCompileGetByIdProto):
166         (JSC::JIT::privateCompileGetByIdProtoList):
167         (JSC::JIT::privateCompileGetByIdChainList):
168         (JSC::JIT::privateCompileGetByIdChain):
169
170 2009-05-18  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
171
172         Reviewed by Gavin Barraclough.
173
174         Enable YARR, and disable WREC for GTK+.
175
176         * GNUmakefile.am:
177         * yarr/RegexParser.h:
178
179 2009-05-18  Jan Michael Alonzo  <jmalonzo@webkit.org>
180
181          Reviewed by Xan Lopez.
182
183          [Gtk] Various autotools build refactoring and fixes
184          https://bugs.webkit.org/show_bug.cgi?id=25286
185
186          Add -no-install and -no-fast-install to programs and tests that we
187          don't install. Also remove -O2 since this is already handled at
188          configure time.
189
190          * GNUmakefile.am:
191
192 2009-05-17  Jan Michael Alonzo  <jmalonzo@webkit.org>
193
194         Reviewed by Xan Lopez.
195
196         [Gtk] Various autotools build refactoring and fixes
197         https://bugs.webkit.org/show_bug.cgi?id=25286
198
199         Add JavaScriptCore/ to JSC include path only since it's not
200         required when building WebCore.
201
202         * GNUmakefile.am:
203
204 2009-05-17  Steve Falkenburg  <sfalken@apple.com>
205
206         Windows build fix
207
208         * JavaScriptCore.vcproj/JavaScriptCore.make:
209         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
210
211 2009-05-15  Gavin Barraclough  <barraclough@apple.com>
212
213         Reviewed by Oliver Hunt.
214
215         Looking like MSVC doesn't like static variables in inline methods?
216         Make the state of the SSE2 check a static variable on the class
217         MacroAssemblerX86Common as a speculative build fix for Windows.
218
219         * assembler/MacroAssemblerX86Common.h:
220         (JSC::MacroAssemblerX86Common::convertInt32ToDouble):
221         (JSC::MacroAssemblerX86Common::branchDouble):
222         (JSC::MacroAssemblerX86Common::branchTruncateDoubleToInt32):
223         (JSC::MacroAssemblerX86Common::isSSE2Present):
224         (JSC::MacroAssemblerX86Common::):
225         * jit/JIT.cpp:
226
227 2009-05-15  Adam Roben  <aroben@apple.com>
228
229         Add some assembler headers to JavaScriptCore.vcproj
230
231         This is just a convenience for Windows developers.
232
233         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
234
235 2009-05-15  Gavin Barraclough  <barraclough@apple.com>
236
237         Reviewed by Oliver Hunt.
238
239         Add FP support to the MacroAssembler, port JITArithmetic over to make use of this. Also add
240         API to determine whether FP support is available 'MacroAssembler::supportsFloatingPoint()',
241         FP is presently only supported on SSE2 platforms, not x87.  On platforms where a suitable
242         hardware FPU is not available 'supportsFloatingPoint()' may simply return false, and all
243         other methods ASSERT_NOT_REACHED().
244
245         * assembler/AbstractMacroAssembler.h:
246         * assembler/MacroAssemblerX86.h:
247         (JSC::MacroAssemblerX86::MacroAssemblerX86):
248         (JSC::MacroAssemblerX86::branch32):
249         (JSC::MacroAssemblerX86::branchPtrWithPatch):
250         (JSC::MacroAssemblerX86::supportsFloatingPoint):
251         * assembler/MacroAssemblerX86Common.h:
252         (JSC::MacroAssemblerX86Common::):
253         (JSC::MacroAssemblerX86Common::loadDouble):
254         (JSC::MacroAssemblerX86Common::storeDouble):
255         (JSC::MacroAssemblerX86Common::addDouble):
256         (JSC::MacroAssemblerX86Common::subDouble):
257         (JSC::MacroAssemblerX86Common::mulDouble):
258         (JSC::MacroAssemblerX86Common::convertInt32ToDouble):
259         (JSC::MacroAssemblerX86Common::branchDouble):
260         (JSC::MacroAssemblerX86Common::branchTruncateDoubleToInt32):
261         (JSC::MacroAssemblerX86Common::branch32):
262         (JSC::MacroAssemblerX86Common::branch16):
263         (JSC::MacroAssemblerX86Common::branchTest32):
264         (JSC::MacroAssemblerX86Common::branchAdd32):
265         (JSC::MacroAssemblerX86Common::branchMul32):
266         (JSC::MacroAssemblerX86Common::branchSub32):
267         (JSC::MacroAssemblerX86Common::set32):
268         (JSC::MacroAssemblerX86Common::setTest32):
269         (JSC::MacroAssemblerX86Common::x86Condition):
270         (JSC::MacroAssemblerX86Common::isSSE2Present):
271         * assembler/MacroAssemblerX86_64.h:
272         (JSC::MacroAssemblerX86_64::movePtrToDouble):
273         (JSC::MacroAssemblerX86_64::moveDoubleToPtr):
274         (JSC::MacroAssemblerX86_64::setPtr):
275         (JSC::MacroAssemblerX86_64::branchPtr):
276         (JSC::MacroAssemblerX86_64::branchTestPtr):
277         (JSC::MacroAssemblerX86_64::branchAddPtr):
278         (JSC::MacroAssemblerX86_64::branchSubPtr):
279         (JSC::MacroAssemblerX86_64::supportsFloatingPoint):
280         * assembler/X86Assembler.h:
281         * jit/JIT.cpp:
282         (JSC::JIT::JIT):
283         * jit/JIT.h:
284         * jit/JITArithmetic.cpp:
285         (JSC::JIT::emit_op_rshift):
286         (JSC::JIT::emitSlow_op_rshift):
287         (JSC::JIT::emitSlow_op_jnless):
288         (JSC::JIT::emitSlow_op_jnlesseq):
289         (JSC::JIT::compileBinaryArithOp):
290         (JSC::JIT::compileBinaryArithOpSlowCase):
291         (JSC::JIT::emit_op_add):
292         (JSC::JIT::emitSlow_op_add):
293         (JSC::JIT::emit_op_mul):
294         (JSC::JIT::emitSlow_op_mul):
295         * jit/JITPropertyAccess.cpp:
296         (JSC::JIT::privateCompilePutByIdTransition):
297
298 2009-05-15  Francisco Tolmasky  <francisco@280north.com>
299
300         BUG 25467: JavaScript debugger should use function.displayName as the function's name in the call stack
301         <https://bugs.webkit.org/show_bug.cgi?id=25467>
302         
303         Reviewed by Adam Roben.
304
305         * JavaScriptCore.exp: Added calculatedFunctionName
306         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Added calculatedFunctionName
307         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Added calculatedFunctionName
308         * debugger/DebuggerCallFrame.cpp: Added calculatedFunctionName to match existing one in ProfileNode.
309         (JSC::DebuggerCallFrame::calculatedFunctionName):
310         * debugger/DebuggerCallFrame.h: Added calculatedFunctionName to match existing one in ProfileNode.
311
312 2009-05-14  Gavin Barraclough  <barraclough@apple.com>
313
314         Build fix, not reviewed.
315
316         Quick fixes for JIT builds with OPTIMIZE flags disabled.
317
318         * jit/JITCall.cpp:
319         (JSC::JIT::compileOpCall):
320         (JSC::JIT::compileOpCallSlowCase):
321         * jit/JITPropertyAccess.cpp:
322         (JSC::JIT::compilePutByIdHotPath):
323
324 2009-05-14  Steve Falkenburg  <sfalken@apple.com>
325
326         Back out incorrect Windows build fix
327
328         * JavaScriptCore.vcproj/JavaScriptCore.make:
329         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
330
331 2009-05-14  Steve Falkenburg  <sfalken@apple.com>
332
333         Windows build fix
334
335         * JavaScriptCore.vcproj/JavaScriptCore.make:
336         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
337
338 2009-05-14  Adam Roben  <aroben@apple.com>
339
340         Windows jsc build fix
341
342         r43648 modified jsc.vcproj's post-build event not to try to copy files
343         that aren't present. Then r43661 mistakenly un-did that modification.
344         This patch restores the modification from r43648, but puts the code in
345         jscCommon.vsprops (where it should have been added in r43648).
346
347         * JavaScriptCore.vcproj/jsc/jsc.vcproj: Restored empty
348         VCPostBuildEventTool tags.
349         * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Modified the post-build
350         event command line to match the one in jsc.vcproj from r43648.
351
352 2009-05-14  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
353
354         Reviewed by Darin Adler.
355
356         https://bugs.webkit.org/show_bug.cgi?id=25325
357
358         Make sure pthread_self() is declared before it gets called in Collector.cpp
359
360         * runtime/Collector.cpp: Include pthread.h in most Unix-like platforms
361         (not just for OPENBSD)
362
363 2009-05-14  Mark Rowe  <mrowe@apple.com>
364
365         Reviewed by Oliver Hunt.
366
367         Fix <https://bugs.webkit.org/show_bug.cgi?id=25785>.
368         Bug 25785: Segfault in mark when using JSObjectMakeConstructor
369
370         * API/JSObjectRef.cpp:
371         (JSObjectMakeConstructor): OpaqueJSClass::prototype can return 0.  We need to use the default object prototype when it does.
372         * API/tests/testapi.c:
373         (main): Add a test case.
374         * runtime/JSObject.h:
375         (JSC::JSObject::putDirect): Add a clearer assertion for a null value.  The assertion on the next line does catch this,
376         but the cause of the failure is not clear from the assertion itself.
377
378 2009-05-14  Mark Rowe  <mrowe@apple.com>
379
380         Rubber-stamped by Darin Adler.
381
382         <rdar://problem/6681868> When building with Xcode 3.1.3 should be using gcc 4.2
383
384         The meaning of XCODE_VERSION_ACTUAL is more sensible in newer versions of Xcode.
385         Update our logic to select the compiler version to use the more appropriate XCODE_VERSION_MINOR
386         if the version of Xcode supports it, and fall back to XCODE_VERSION_ACTUAL if not.
387
388         * Configurations/Base.xcconfig:
389
390 2009-05-14  Gavin Barraclough  <barraclough@apple.com>
391
392         Reviewed by Geoff Garen.
393
394         Checking register file bounds should be a ptr comparison (m_end is a Register*).
395         Also, the compare should be unsigned, pointers don'ts go negative.
396
397         * jit/JIT.cpp:
398         (JSC::JIT::privateCompile):
399
400 2009-05-13  Gavin Barraclough  <barraclough@apple.com>
401
402         Reviewed by Oliver Hunt.
403
404         Fix <rdar://problem/6882919> REGRESSION: page at Metroauto site crashes in cti_op_loop_if_less (25730)
405
406         op_loop_if_less (imm < op) was loading op into regT1, but in the slow path spills regT0.
407         This leads to bad happen.
408
409         * jit/JITOpcodes.cpp:
410         (JSC::JIT::emit_op_loop_if_less):
411         (JSC::JIT::emitSlow_op_loop_if_less):
412
413 2009-05-13  Dmitry Titov  <dimich@chromium.org>
414
415         Rubber-stamped by Mark Rowe.
416
417         https://bugs.webkit.org/show_bug.cgi?id=25746
418         Revert http://trac.webkit.org/changeset/43507 which caused crash in PPC nightlies with Safari 4.
419
420         * JavaScriptCore.exp:
421         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
422         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
423         * bytecode/SamplingTool.cpp:
424         (JSC::SamplingThread::start):
425         (JSC::SamplingThread::stop):
426         * bytecode/SamplingTool.h:
427         * wtf/CrossThreadRefCounted.h:
428         (WTF::CrossThreadRefCounted::CrossThreadRefCounted):
429         (WTF::::ref):
430         (WTF::::deref):
431         * wtf/Threading.h:
432         * wtf/ThreadingNone.cpp:
433         * wtf/ThreadingPthreads.cpp:
434         (WTF::threadMapMutex):
435         (WTF::initializeThreading):
436         (WTF::threadMap):
437         (WTF::identifierByPthreadHandle):
438         (WTF::establishIdentifierForPthreadHandle):
439         (WTF::pthreadHandleForIdentifier):
440         (WTF::clearPthreadHandleForIdentifier):
441         (WTF::createThreadInternal):
442         (WTF::waitForThreadCompletion):
443         (WTF::detachThread):
444         (WTF::currentThread):
445         * wtf/ThreadingWin.cpp:
446         (WTF::threadMapMutex):
447         (WTF::initializeThreading):
448         (WTF::threadMap):
449         (WTF::storeThreadHandleByIdentifier):
450         (WTF::threadHandleForIdentifier):
451         (WTF::clearThreadHandleForIdentifier):
452         (WTF::createThreadInternal):
453         (WTF::waitForThreadCompletion):
454         (WTF::detachThread):
455         (WTF::currentThread):
456         * wtf/gtk/ThreadingGtk.cpp:
457         (WTF::threadMapMutex):
458         (WTF::initializeThreading):
459         (WTF::threadMap):
460         (WTF::identifierByGthreadHandle):
461         (WTF::establishIdentifierForThread):
462         (WTF::threadForIdentifier):
463         (WTF::clearThreadForIdentifier):
464         (WTF::createThreadInternal):
465         (WTF::waitForThreadCompletion):
466         (WTF::currentThread):
467         * wtf/qt/ThreadingQt.cpp:
468         (WTF::threadMapMutex):
469         (WTF::threadMap):
470         (WTF::identifierByQthreadHandle):
471         (WTF::establishIdentifierForThread):
472         (WTF::clearThreadForIdentifier):
473         (WTF::threadForIdentifier):
474         (WTF::initializeThreading):
475         (WTF::createThreadInternal):
476         (WTF::waitForThreadCompletion):
477         (WTF::currentThread):
478
479 2009-05-13  Darin Adler  <darin@apple.com>
480
481         Revert the parser arena change. It was a slowdown, not a speedup.
482         Better luck next time (I'll break it up into pieces).
483
484 2009-05-13  Darin Adler  <darin@apple.com>
485
486         Tiger build fix.
487
488         * parser/Grammar.y: Add back empty code blocks, needed by older
489         versions of bison on certain rules.
490
491 2009-05-13  Steve Falkenburg  <sfalken@apple.com>
492
493         Windows build fix.
494
495         * JavaScriptCore.vcproj/jsc/jsc.vcproj:
496
497 2009-05-13  Adam Roben  <aroben@apple.com>
498
499         Windows build fixes after r43642
500
501         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
502         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
503         Updated.
504
505         * debugger/Debugger.cpp:
506         * runtime/ArrayConstructor.cpp:
507         * runtime/JSArray.cpp:
508         * runtime/RegExp.cpp:
509         * runtime/RegExpConstructor.cpp:
510         * runtime/RegExpPrototype.cpp:
511         * runtime/StringPrototype.cpp:
512         Added missing #includes.
513
514 2009-05-13  Darin Adler  <darin@apple.com>
515
516         Reviewed by Cameron Zwarich.
517
518         Bug 25674: syntax tree nodes should use arena allocation
519         https://bugs.webkit.org/show_bug.cgi?id=25674
520
521         Step 3: Add some actual arena allocation. About 1% SunSpider speedup.
522
523         * JavaScriptCore.exp: Updated.
524
525         * bytecompiler/BytecodeGenerator.cpp:
526         (JSC::BytecodeGenerator::BytecodeGenerator): Updated since VarStack
527         contains const Identifier* now.
528         (JSC::BytecodeGenerator::emitPushNewScope): Updated to take a const
529         Identifier&.
530         * bytecompiler/BytecodeGenerator.h: Ditto
531
532         * bytecompiler/SegmentedVector.h: Added isEmpty.
533
534         * debugger/Debugger.cpp:
535         (JSC::Debugger::recompileAllJSFunctions): Moved this function here from
536         WebCore so WebCore doesn't need the details of FunctionBodyNode.
537         * debugger/Debugger.h: Ditto.
538
539         * interpreter/Interpreter.cpp:
540         (JSC::Interpreter::execute): Updated since VarStack contains const
541         Identifier* now.
542
543         * jit/JITStubs.cpp:
544         (JSC::JITStubs::cti_vm_lazyLinkCall): Call isHostFunction on the body
545         rather than on the function object, since we can't easily have inlined
546         access to the FunctionBodyNode in JSFunction.h since WebCore needs
547         access to that header.
548         (JSC::JITStubs::cti_op_construct_JSConstruct): Ditto.
549         * profiler/Profiler.cpp:
550         (JSC::Profiler::createCallIdentifier): Ditto.
551
552         * parser/Grammar.y: Use JSGlobalData* to pass the global data pointer
553         around whenever possible instead of using void*. Changed
554         SET_EXCEPTION_LOCATION from a macro to an inline function. Marked
555         the structure-creating functions inline. Changed the VarStack to use
556         identifier pointers instead of actual identifiers. This takes
557         advantage of the fact that all identifier pointers come from the
558         arena and avoids reference count churn. Changed Identifier* to
559         const Identifier* to make sure we don't modify any by accident.
560         Used identifiers for regular expression strings too, using the new
561         scanRegExp that has out parameters instead of the old one that relied
562         on side effects in the Lexer. Move the creation of numeric identifiers
563         out of this file and into the PropertyNode constructor.
564
565         * parser/Lexer.cpp:
566         (JSC::Lexer::setCode): Pass in ParserArena, used for identifiers.
567         (JSC::Lexer::makeIdentifier): Changed return type to const Identifier*
568         and changed to call ParserArena.
569         (JSC::Lexer::scanRegExp): Added out arguments that are const Identifier*
570         as well as a prefix character argument so we can handle the /= case
571         without a string append.
572         (JSC::Lexer::skipRegExp): Added. Skips a regular expression without
573         allocating Identifier objects.
574         (JSC::Lexer::clear): Removed the code to manage m_identifiers, m_pattern,
575         and m_flags, and added code to set m_arena to 0.
576         * parser/Lexer.h: Updated for changes above.
577
578         * parser/NodeConstructors.h:
579         (JSC::ParserArenaFreeable::operator new): Added. Calls allocateFreeable
580         on the arena.
581         (JSC::ParserArenaDeletable::operator new): Changed to call the
582         allocateDeletable function on the arena instead of deleteWithArena.
583         (JSC::RegExpNode::RegExpNode): Changed arguments to Identifier instead
584         of UString since these come from the parser which makes identifiers.
585         (JSC::PropertyNode::PropertyNode): Added new constructor that makes
586         numeric identifiers. Some day we might want to optimize this for
587         integers so it doesn't create a string for each one.
588         (JSC::ContinueNode::ContinueNode): Initialize m_ident to nullIdentifier
589         since it's now a const Identifier& so it can't be left uninitialized.
590         (JSC::BreakNode::BreakNode): Ditto.
591         (JSC::CaseClauseNode::CaseClauseNode): Updated to use SourceElements*
592         to keep track of the statements rather than a separate statement vector.
593         (JSC::BlockNode::BlockNode): Ditto.
594         (JSC::ForInNode::ForInNode): Initialize m_ident to nullIdentifier.
595
596         * parser/Nodes.cpp: Moved the comment explaining emitBytecode in here.
597         It seemed strangely out of place in the header.
598         (JSC::ThrowableExpressionData::emitThrowError): Added an overload for
599         UString as well as Identifier.
600         (JSC::SourceElements::singleStatement): Added.
601         (JSC::SourceElements::lastStatement): Added.
602         (JSC::RegExpNode::emitBytecode): Updated since the pattern and flags
603         are now Identifier instead of UString. Also changed the throwError code
604         to use the substitution mechanism instead of doing a string append.
605         (JSC::SourceElements::emitBytecode): Added. Replaces the old
606         statementListEmitCode function, since we now keep the SourceElements
607         objects around.
608         (JSC::BlockNode::lastStatement): Added.
609         (JSC::BlockNode::emitBytecode): Changed to use emitBytecode instead of
610         statementListEmitCode.
611         (JSC::CaseClauseNode::emitBytecode): Added.
612         (JSC::CaseBlockNode::emitBytecodeForBlock): Changed to use emitBytecode
613         instead of statementListEmitCode.
614         (JSC::ScopeNodeData::ScopeNodeData): Changed to store the
615         SourceElements* instead of using releaseContentsIntoVector.
616         (JSC::ScopeNode::emitStatementsBytecode): Added.
617         (JSC::ScopeNode::singleStatement): Added.
618         (JSC::ProgramNode::emitBytecode): Call emitStatementsBytecode instead
619         of statementListEmitCode.
620         (JSC::EvalNode::emitBytecode): Ditto.
621         (JSC::EvalNode::generateBytecode): Removed code to clear the children
622         vector. This optimization is no longer possible since everything is in
623         a single arena.
624         (JSC::FunctionBodyNode::emitBytecode): Call emitStatementsBytecode
625         insetad of statementListEmitCode and check for the return node using
626         the new functions.
627
628         * parser/Nodes.h: Changed VarStack to store const Identifier* instead
629         of Identifier and rely on the arena to control lifetime. Added a new
630         ParserArenaFreeable class. Made ParserArenaDeletable inherit from
631         FastAllocBase instead of having its own operator new. Base the Node
632         class on ParserArenaFreeable. Changed the various Node classes
633         to use const Identifier& instead of Identifier to avoid the need to
634         call their destructors and allow them to function as "freeable" in the
635         arena. Removed extraneous JSC_FAST_CALL on definitions of inline functions.
636         Changed ElementNode, PropertyNode, ArgumentsNode, ParameterNode,
637         CaseClauseNode, ClauseListNode, and CaseBlockNode to use ParserArenaFreeable
638         as a base class since they do not descend from Node. Eliminated the
639         StatementVector type and instead have various classes use SourceElements*
640         instead of StatementVector. This prevents those classes from having th
641         use ParserArenaDeletable to make sure the vector destructor is called.
642
643         * parser/Parser.cpp:
644         (JSC::Parser::parse): Pass the arena to the lexer.
645
646         * parser/Parser.h: Added an include of ParserArena.h, which is no longer
647         included by Nodes.h.
648
649         * parser/ParserArena.cpp:
650         (JSC::ParserArena::ParserArena): Added. Initializes the new members,
651         m_freeableMemory, m_freeablePoolEnd, and m_identifiers.
652         (JSC::ParserArena::freeablePool): Added. Computes the pool pointer,
653         since we store only the current pointer and the end of pool pointer.
654         (JSC::ParserArena::deallocateObjects): Added. Contains the common
655         memory-deallocation logic used by both the destructor and the
656         reset function.
657         (JSC::ParserArena::~ParserArena): Changed to call deallocateObjects.
658         (JSC::ParserArena::reset): Ditto. Also added code to zero out the
659         new structures, and switched to use clear() instead of shrink(0) since
660         we don't really reuse arenas.
661         (JSC::ParserArena::makeNumericIdentifier): Added.
662         (JSC::ParserArena::allocateFreeablePool): Added. Used when the pool
663         is empty.
664         (JSC::ParserArena::isEmpty): Added. No longer inline, which is fine
665         since this is used only for assertions at the moment.
666
667         * parser/ParserArena.h: Added an actual arena of "freeable" objects,
668         ones that don't need destructors to be called. Also added the segmented
669         vector of identifiers that used to be in the Lexer.
670
671         * runtime/FunctionConstructor.cpp:
672         (JSC::extractFunctionBody): Use singleStatement function rather than
673         getting at a StatementVector.
674
675         * runtime/FunctionPrototype.cpp:
676         (JSC::functionProtoFuncToString): Call isHostFunction on the body
677         rather than the function object.
678
679         * runtime/JSFunction.cpp:
680         (JSC::JSFunction::JSFunction): Moved the structure version of this in
681         here from the header. It's not hot enough that it needs to be inlined.
682         (JSC::JSFunction::isHostFunction): Moved this in here from the header.
683         It's now a helper to be used only within the class.
684         (JSC::JSFunction::setBody): Moved this in here. It's not hot enough that
685         it needs to be inlined, and we want to be able to compile the header
686         without the definition of FunctionBodyNode.
687
688         * runtime/JSFunction.h: Eliminated the include of "Nodes.h". This was
689         exposing too much JavaScriptCore dependency to WebCore. Because of this
690         change and some changes made to WebCore, we could now export a lot fewer
691         headers from JavaScriptCore, but I have not done that yet in this check-in.
692         Made a couple functions non-inline. Removes some isHostFunction() assertions.
693         
694         * wtf/FastAllocBase.h: Added the conventional using statements we use in
695         WTF so we can use identifiers from the WTF namespace without explicit
696         namespace qualification or namespace directive. This is the usual WTF style,
697         although it's unconventional in the C++ world. We use the namespace primarily
698         for link-time disambiguation, not compile-time.
699
700         * wtf/FastMalloc.cpp: Fixed an incorrect comment.
701
702 2009-05-13  Xan Lopez  <xlopez@igalia.com>
703
704         Unreviewed build fix: add JITStubCall.h to files list.
705
706         * GNUmakefile.am:
707
708 2009-05-13  Ariya Hidayat  <ariya.hidayat@nokia.com>
709
710         Unreviewed build fix, as suggested by Yael Aharon <yael.aharon@nokia.com>.
711
712         * wtf/qt/ThreadingQt.cpp:
713         (WTF::waitForThreadCompletion): renamed IsValid to isValid.
714
715 2009-05-13  Jan Michael Alonzo  <jmalonzo@webkit.org>
716
717         Revert r43562 - [Gtk] WTF_USE_JSC is already defined in
718         WebCore/config.h.
719
720         * wtf/Platform.h:
721
722 2009-05-12  Gavin Barraclough  <barraclough@apple.com>
723
724         Reviewed by Oliver Hunt.
725
726         Add SamplingCounter tool to provide a simple mechanism for counting events in JSC
727         (enabled using ENABLE(SAMPLING_COUNTERS)).  To count events within a single function
728         use the class 'SamplingCounter', where the counter may be incremented from multiple
729         functions 'GlobalSamplingCounter' may be convenient; all other counters (stack or
730         heap allocated, rather than statically declared) should use the DeletableSamplingCounter.
731         Further description of these classes is provided alongside their definition in 
732         SamplingTool.h.
733
734         Counters may be incremented from c++ by calling the 'count()' method on the counter,
735         or may be incremented by JIT code by using the 'emitCount()' method within the JIT.
736
737         This patch also fixes CODEBLOCK_SAMPLING, which was missing a null pointer check.
738
739         * JavaScriptCore.exp:
740         * assembler/MacroAssemblerX86.h:
741         (JSC::MacroAssemblerX86::addWithCarry32):
742         (JSC::MacroAssemblerX86::and32):
743         (JSC::MacroAssemblerX86::or32):
744         * assembler/MacroAssemblerX86Common.h:
745         (JSC::MacroAssemblerX86Common::and32):
746         (JSC::MacroAssemblerX86Common::or32):
747         * assembler/MacroAssemblerX86_64.h:
748         (JSC::MacroAssemblerX86_64::and32):
749         (JSC::MacroAssemblerX86_64::or32):
750         (JSC::MacroAssemblerX86_64::addPtr):
751         * assembler/X86Assembler.h:
752         (JSC::X86Assembler::):
753         (JSC::X86Assembler::adcl_im):
754         (JSC::X86Assembler::addq_im):
755         (JSC::X86Assembler::andl_im):
756         (JSC::X86Assembler::orl_im):
757         * bytecode/SamplingTool.cpp:
758         (JSC::AbstractSamplingCounter::dump):
759         * bytecode/SamplingTool.h:
760         (JSC::AbstractSamplingCounter::count):
761         (JSC::GlobalSamplingCounter::name):
762         (JSC::SamplingCounter::SamplingCounter):
763         * jit/JIT.h:
764         * jit/JITCall.cpp:
765         (JSC::):
766         * jit/JITInlineMethods.h:
767         (JSC::JIT::setSamplingFlag):
768         (JSC::JIT::clearSamplingFlag):
769         (JSC::JIT::emitCount):
770         * jsc.cpp:
771         (runWithScripts):
772         * parser/Nodes.cpp:
773         (JSC::ScopeNode::ScopeNode):
774         * wtf/Platform.h:
775
776 2009-05-13  Steve Falkenburg  <sfalken@apple.com>
777
778         Windows build fix.
779
780         * JavaScriptCore.vcproj/JavaScriptCore.make:
781
782 2009-05-12  Steve Falkenburg  <sfalken@apple.com>
783
784         Windows build fix.
785
786         * JavaScriptCore.vcproj/JavaScriptCore.make:
787
788 2009-05-12  Oliver Hunt  <oliver@apple.com>
789
790         Reviewed by Gavin Barraclough.
791
792         <rdar://problem/6881457> Crash occurs at JSC::Interpreter::execute() when loading http://www.sears.com
793
794         We created the arguments objects before an op_push_scope but not
795         before op_push_new_scope, this meant a null arguments object could
796         be resolved inside catch blocks.
797
798         * bytecompiler/BytecodeGenerator.cpp:
799         (JSC::BytecodeGenerator::emitPushNewScope):
800
801 2009-05-12  Oliver Hunt  <oliver@apple.com>
802
803         Reviewed by Gavin Barraclough.
804
805         <rdar://problem/6879881> Crash occurs at JSC::JSActivation::mark() when loading http://www.monster.com; http://www.cnet.com
806         <https://bugs.webkit.org/show_bug.cgi?id=25736> Crash loading www.google.dk/ig (and other igoogle's as well)
807
808         Following on from the lazy arguments creation patch, it's now
809         possible for an activation to to have a null register in the callframe
810         so we can't just blindly mark the local registers in an activation,
811         and must null check first instead.
812
813         * API/tests/testapi.c:
814         (functionGC):
815         * API/tests/testapi.js:
816         (bludgeonArguments.return.g):
817         (bludgeonArguments):
818         * runtime/JSActivation.cpp:
819         (JSC::JSActivation::mark):
820
821 2009-05-12  Gavin Barraclough  <barraclough@apple.com>
822
823         Rubber stamped by Geoff Garen.
824
825         WTF_USE_CTI_REPATCH_PIC is no longer used, remove.
826
827         * jit/JIT.h:
828         * jit/JITStubCall.h:
829
830 2009-05-12  Gavin Barraclough  <barraclough@apple.com>
831
832         Reviewed by Maciej Stachowiak.
833
834         We've run into some problems where changing the size of the class JIT leads to
835         performance fluctuations.  Try forcing alignment in an attempt to stabalize this.
836
837         * jit/JIT.h:
838
839 2009-05-12  Kevin Ollivier  <kevino@theolliviers.com>
840
841         wx build fix. Add ParserArena.cpp to the build.
842
843         * JavaScriptCoreSources.bkl:
844
845 2009-05-12  Oliver Hunt  <oliver@apple.com>
846
847         Reviewed by Geoff Garen.
848
849         Unsigned underflow on 64bit cannot be treated as a negative number
850
851         This code included some placeswhere we deliberately create negative offsets
852         from unsigned values, on 32bit this is "safe", but in 64bit builds much
853         badness occurs. Solution is to use signed types as nature intended.
854
855         * jit/JITStubs.cpp:
856         (JSC::JITStubs::cti_op_load_varargs):
857
858 2009-05-12  Jan Michael Alonzo  <jmalonzo@webkit.org>
859
860         Reviewed by Holger Freyther.
861
862         [Gtk] Various autotools build refactoring and fixes
863         https://bugs.webkit.org/show_bug.cgi?id=25286
864
865         Define WTF_USE_JSC for the Gtk port.
866
867         * wtf/Platform.h:
868
869 2009-05-12  Maciej Stachowiak  <mjs@apple.com>
870
871         Reviewed by Oliver Hunt.
872         
873         - allow all of strictEqual to be inlined into cti_op_stricteq once again
874         
875         We had this optimization once but accidentally lost it at some point.
876
877         * runtime/Operations.h:
878         (JSC::JSValue::strictEqualSlowCaseInline):
879         (JSC::JSValue::strictEqual):
880
881 2009-05-12  Gavin Barraclough  <barraclough@apple.com>
882
883         Reviewed by Oliver Hunt.
884
885         instanceof should throw if the constructor being tested does not implement
886         'HasInstance" (i.e. is a function).  Instead we were returning false.
887
888         * interpreter/Interpreter.cpp:
889         (JSC::isInvalidParamForIn):
890         (JSC::isInvalidParamForInstanceOf):
891         (JSC::Interpreter::privateExecute):
892         * jit/JITStubs.cpp:
893         (JSC::JITStubs::cti_op_instanceof):
894         * tests/mozilla/ecma_2/instanceof/instanceof-003.js:
895             Fix broken test case.
896         * tests/mozilla/ecma_2/instanceof/regress-7635.js:
897             Remove broken test case (was an exact duplicate of a test in instanceof-003.js).
898
899 2009-05-12  Oliver Hunt  <oliver@apple.com>
900
901         Reviewed by Gavin Barraclough.
902
903         Improve function call forwarding performance
904
905         Make creation of the Arguments object occur lazily, so it
906         is not necessarily created for every function that references
907         it.  Then add logic to Function.apply to allow it to avoid
908         allocating the Arguments object at all.  Helps a lot with
909         the function forwarding/binding logic in jQuery, Prototype,
910         and numerous other JS libraries.
911
912         * bytecode/CodeBlock.cpp:
913         (JSC::CodeBlock::dump):
914         * bytecode/Opcode.h:
915         * bytecompiler/BytecodeGenerator.cpp:
916         (JSC::BytecodeGenerator::BytecodeGenerator):
917         (JSC::BytecodeGenerator::registerFor):
918         (JSC::BytecodeGenerator::willResolveToArguments):
919         (JSC::BytecodeGenerator::uncheckedRegisterForArguments):
920         (JSC::BytecodeGenerator::createArgumentsIfNecessary):
921         (JSC::BytecodeGenerator::emitCallEval):
922         (JSC::BytecodeGenerator::emitPushScope):
923         * bytecompiler/BytecodeGenerator.h:
924         * interpreter/Interpreter.cpp:
925         (JSC::Interpreter::privateExecute):
926         (JSC::Interpreter::retrieveArguments):
927         * jit/JIT.cpp:
928         (JSC::JIT::privateCompileMainPass):
929         * jit/JIT.h:
930         * jit/JITOpcodes.cpp:
931         (JSC::JIT::emit_op_create_arguments):
932         (JSC::JIT::emit_op_init_arguments):
933         * jit/JITStubs.cpp:
934         (JSC::JITStubs::cti_op_tear_off_arguments):
935         (JSC::JITStubs::cti_op_load_varargs):
936         * parser/Nodes.cpp:
937         (JSC::ApplyFunctionCallDotNode::emitBytecode):
938
939 2009-05-11  Gavin Barraclough  <barraclough@apple.com>
940
941         Reviewed by Oliver Hunt.
942
943         Enable use of SamplingFlags directly from JIT code.
944
945         * bytecode/SamplingTool.h:
946         * jit/JIT.h:
947         (JSC::JIT::sampleCodeBlock):
948         (JSC::JIT::sampleInstruction):
949         * jit/JITInlineMethods.h:
950         (JSC::JIT::setSamplingFlag):
951         (JSC::JIT::clearSamplingFlag):
952
953 2009-05-11  Gavin Barraclough  <barraclough@apple.com>
954
955         Reviewed by Cameron Zwarich.
956
957         Implement JIT generation for instanceof for non-objects (always returns false).
958         Also fixes the sequencing of the prototype and value isObject checks, to no match the spec.
959
960         0.5% progression on v8 tests overall, due to 3.5% on early-boyer.
961
962         * jit/JIT.cpp:
963         (JSC::JIT::privateCompileMainPass):
964         (JSC::JIT::privateCompileSlowCases):
965         * runtime/JSObject.cpp:
966         (JSC::JSObject::hasInstance):
967         * runtime/TypeInfo.h:
968         (JSC::TypeInfo::TypeInfo):
969
970 2009-05-11  Geoffrey Garen  <ggaren@apple.com>
971
972         Reviewed by Sam Weinig.
973         
974         A little more JIT refactoring.
975         
976         Rearranged code to more clearly indicate what's conditionally compiled
977         and why. Now, all shared code is at the top of our JIT files, and all
978         #if'd code is at the bottom. #if'd code is delineated by large comments.
979         
980         Moved functions that relate to the JIT but don't explicitly do codegen
981         into JIT.cpp. Refactored SSE2 check to store its result as a data member
982         in the JIT.
983
984         * jit/JIT.cpp:
985         (JSC::isSSE2Present):
986         (JSC::JIT::JIT):
987         (JSC::JIT::unlinkCall):
988         (JSC::JIT::linkCall):
989         * jit/JIT.h:
990         (JSC::JIT::isSSE2Present):
991         * jit/JITArithmetic.cpp:
992         (JSC::JIT::emit_op_mod):
993         (JSC::JIT::emitSlow_op_mod):
994         * jit/JITCall.cpp:
995         (JSC::JIT::compileOpCallVarargs):
996         (JSC::JIT::compileOpCallVarargsSlowCase):
997
998 2009-05-11  Holger Hans Peter Freyther  <zecke@selfish.org>
999
1000         Build fix.
1001
1002         * JavaScriptCore.pri: Build the new JITOpcodes.cpp
1003
1004 2009-05-11  Sam Weinig  <sam@webkit.org>
1005
1006         Reviewed by Geoffrey Garen.
1007
1008         More re-factoring of JIT code generation.  Use a macro to
1009         forward the main switch-statement cases to the helper functions.
1010
1011         * jit/JIT.cpp:
1012         (JSC::JIT::privateCompileMainPass):
1013         (JSC::JIT::privateCompileSlowCases):
1014
1015 2009-05-11  Sam Weinig  <sam@webkit.org>
1016
1017         Reviewed by Geoffrey Garen.
1018
1019         More re-factoring of JIT code generation to move opcode generation
1020         to helper functions outside the main switch-statement and gave those
1021         helper functions standardized names. This patch covers the remaining
1022         slow cases.
1023
1024         * jit/JIT.cpp:
1025         * jit/JIT.h:
1026         * jit/JITOpcodes.cpp:
1027
1028 2009-05-11  Geoffrey Garen  <ggaren@apple.com>
1029
1030         Build fix.
1031
1032         * GNUmakefile.am: Added JITOpcodes.cpp and JITStubCall.h to the project.
1033
1034 2009-05-11  Geoffrey Garen  <ggaren@apple.com>
1035
1036         Build fix.
1037
1038         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
1039         JITOpcodes.cpp and JITStubCall.h to the project.
1040
1041 2009-05-11  Geoffrey Garen  <ggaren@apple.com>
1042
1043         Reviewed by Sam Weinig.
1044         
1045         Some JIT refactoring.
1046         
1047         Moved JITStubCall* into its own header.
1048         
1049         Modified JITStubCall to ASSERT that its return value is handled correctly.
1050         Also, replaced function template with explicit instantiations to resolve
1051         some confusion.
1052         
1053         Replaced all uses of emit{Get,Put}CTIArgument with explicit peeks, pokes,
1054         and calls to killLastResultRegister().
1055
1056         * JavaScriptCore.xcodeproj/project.pbxproj:
1057         * jit/JIT.cpp:
1058         (JSC::JIT::privateCompileMainPass):
1059         (JSC::JIT::privateCompile):
1060         * jit/JIT.h:
1061         * jit/JITArithmetic.cpp:
1062         * jit/JITCall.cpp:
1063         * jit/JITInlineMethods.h:
1064         (JSC::JIT::restoreArgumentReference):
1065         * jit/JITPropertyAccess.cpp:
1066         * jit/JITStubCall.h: Copied from jit/JIT.h.
1067         (JSC::JITStubCall::JITStubCall):
1068         (JSC::JITStubCall::addArgument):
1069         (JSC::JITStubCall::call):
1070         (JSC::JITStubCall::):
1071
1072 2009-05-11  Sam Weinig  <sam@webkit.org>
1073
1074         Reviewed by Geoffrey Garen.
1075
1076         Start re-factoring JIT code generation to move opcode generation
1077         to helper functions outside the main switch-statement and gave those
1078         helper functions standardized names.  This patch only covers the main
1079         pass and all the arithmetic opcodes in the slow path.
1080
1081         * JavaScriptCore.xcodeproj/project.pbxproj:
1082         * jit/JIT.cpp:
1083         (JSC::JIT::privateCompileMainPass):
1084         (JSC::JIT::privateCompileSlowCases):
1085         * jit/JIT.h:
1086         * jit/JITArithmetic.cpp:
1087         * jit/JITOpcodes.cpp: Copied from jit/JIT.cpp.
1088         * jit/JITPropertyAccess.cpp:
1089
1090 2009-05-11  Steve Falkenburg  <sfalken@apple.com>
1091
1092         Re-add experimental PGO configs.
1093         
1094         Reviewed by Adam Roben.
1095
1096         * JavaScriptCore.vcproj/JavaScriptCore.make:
1097         * JavaScriptCore.vcproj/JavaScriptCore.sln:
1098         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1099         * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
1100         * JavaScriptCore.vcproj/jsc/jsc.vcproj:
1101
1102 2009-05-11  Sam Weinig  <sam@webkit.org>
1103
1104         Reviewed by Geoffrey "1" Garen.
1105
1106         Rip out the !USE(CTI_REPATCH_PIC) code.  It was untested and unused.
1107
1108         * jit/JIT.h:
1109         (JSC::JIT::compileGetByIdChainList):
1110         (JSC::JIT::compileGetByIdChain):
1111         (JSC::JIT::compileCTIMachineTrampolines):
1112         * jit/JITPropertyAccess.cpp:
1113         (JSC::JIT::privateCompileGetByIdProto):
1114         (JSC::JIT::privateCompileGetByIdChainList):
1115         (JSC::JIT::privateCompileGetByIdChain):
1116         * jit/JITStubs.cpp:
1117         (JSC::JITStubs::tryCachePutByID):
1118         (JSC::JITStubs::tryCacheGetByID):
1119
1120 2009-05-11  Dmitry Titov  <dimich@chromium.org>
1121
1122         GTK build fix - the deprecated waitForThreadCompletion is not needed on GTK.
1123
1124         * wtf/ThreadingPthreads.cpp: used #ifdef PLATFORM(DARWIN) around waitForThreadCompletion().
1125
1126 2009-05-11  Adam Roben  <aroben@apple.com>
1127
1128         Build fix for newer versions of GCC
1129
1130         * wtf/ThreadingPthreads.cpp: Added a declaration of
1131         waitForThreadCompletion before its definition to silence a warning.
1132
1133 2009-05-11  Dmitry Titov  <dimich@chromium.org>
1134
1135         Reviewed by Alexey Proskuryakov and Adam Roben.
1136
1137         https://bugs.webkit.org/show_bug.cgi?id=25348
1138         Change WTF::ThreadIdentifier to be an actual (but wrapped) thread id, remove ThreadMap.
1139
1140         * wtf/Threading.h:
1141         (WTF::ThreadIdentifier::ThreadIdentifier):
1142         (WTF::ThreadIdentifier::isValid):
1143         (WTF::ThreadIdentifier::invalidate):
1144         (WTF::ThreadIdentifier::platformId):
1145         ThreadIdentifier is now a class, containing a PlatformThreadIdentifier and
1146         methods that are used across the code on thread ids: construction, comparisons,
1147         check for 'valid' state etc. '0' is used as invalid id, which happens to just work
1148         with all platform-specific thread id implementations.
1149
1150         All the following files repeatedly reflect the new ThreadIdentifier for each platform.
1151         We remove ThreadMap and threadMapMutex from all of them, remove the functions that
1152         populated/searched/cleared the map and add platform-specific comparison operators
1153         for ThreadIdentifier.
1154
1155         There are specific temporary workarounds for Safari 4 beta on OSX and Win32 since the
1156         public build uses WTF threading functions with old type of ThreadingIdentifier.
1157         The next time Safari 4 is rebuilt, it will 'automatically' pick up the new type and new
1158         functions so the deprecated ones can be removed.
1159
1160         * wtf/gtk/ThreadingGtk.cpp:
1161         (WTF::ThreadIdentifier::operator==):
1162         (WTF::ThreadIdentifier::operator!=):
1163         (WTF::initializeThreading):
1164         (WTF::createThreadInternal):
1165         (WTF::waitForThreadCompletion):
1166         (WTF::currentThread):
1167
1168         * wtf/ThreadingNone.cpp:
1169         (WTF::ThreadIdentifier::operator==):
1170         (WTF::ThreadIdentifier::operator!=):
1171
1172         * wtf/ThreadingPthreads.cpp:
1173         (WTF::ThreadIdentifier::operator==):
1174         (WTF::ThreadIdentifier::operator!=):
1175         (WTF::initializeThreading):
1176         (WTF::createThreadInternal):
1177         (WTF::waitForThreadCompletion):
1178         (WTF::detachThread):
1179         (WTF::currentThread):
1180         (WTF::waitForThreadCompletion): This is a workaround for Safari 4 beta on Mac.
1181         Safari 4 is linked against old definition of ThreadIdentifier so it treats it as uint32_t.
1182         This 'old' variant of waitForThreadCompletion takes uint32_t and has the old decorated name, so Safari can
1183         load it from JavaScriptCore library. The other functions (CurrentThread() etc) happen to match their previous
1184         decorated names and, while they return pthread_t now, it is a pointer which round-trips through a uint32_t.
1185         This function will be removed as soon as Safari 4 will release next public build.
1186
1187         * wtf/qt/ThreadingQt.cpp:
1188         (WTF::ThreadIdentifier::operator==):
1189         (WTF::ThreadIdentifier::operator!=):
1190         (WTF::initializeThreading):
1191         (WTF::createThreadInternal):
1192         (WTF::waitForThreadCompletion):
1193         (WTF::currentThread):
1194
1195         * wtf/ThreadingWin.cpp:
1196         (WTF::ThreadIdentifier::operator==):
1197         (WTF::ThreadIdentifier::operator!=):
1198         (WTF::initializeThreading):
1199         (WTF::createThreadInternal): All the platforms (except Windows) used a sequential
1200         counter as a thread ID and mapped it into platform ID. Windows was using native thread
1201         id and mapped it into thread handle. Since we can always obtain a thread handle
1202         by thread id, createThread now closes the handle.
1203         (WTF::waitForThreadCompletion): obtains another one using OpenThread(id) API. If can not obtain a handle,
1204         it means the thread already exited.
1205         (WTF::detachThread):
1206         (WTF::currentThread):
1207         (WTF::detachThreadDeprecated): old function, renamed (for Win Safari 4 beta which uses it for now).
1208         (WTF::waitForThreadCompletionDeprecated): same.
1209         (WTF::currentThreadDeprecated): same.
1210         (WTF::createThreadDeprecated): same.
1211
1212         * bytecode/SamplingTool.h:
1213         * bytecode/SamplingTool.cpp: Use DEFINE_STATIC_LOCAL for a static ThreadIdentifier variable, to avoid static constructor.
1214
1215         * JavaScriptCore.exp: export lists - updated decorated names of the WTF threading functions
1216         since they now take a different type as a parameter.
1217         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: ditto for Windows, plus added "deprecated" functions
1218         that take old parameter type - turns out public beta of Safari 4 uses those, so they need to be kept along for a while.
1219         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: ditto.
1220
1221 2009-05-11  Darin Adler  <darin@apple.com>
1222
1223         Reviewed by Oliver Hunt.
1224
1225         Bug 25560: REGRESSION (r34821): "string value".__proto__ gets the wrong object.
1226         https://bugs.webkit.org/show_bug.cgi?id=25560
1227         rdar://problem/6861069
1228
1229         I missed this case back a year ago when I sped up handling
1230         of JavaScript wrappers. Easy to fix.
1231
1232         * runtime/JSObject.h:
1233         (JSC::JSValue::get): Return the prototype itself if the property name
1234         is __proto__.
1235         * runtime/JSString.cpp:
1236         (JSC::JSString::getOwnPropertySlot): Ditto.
1237
1238 2009-05-09  Oliver Hunt  <oliver@apple.com>
1239
1240         Reviewed by Maciej Stachowiak.
1241
1242         Rename emitGetFromCallFrameHeader to emitGetFromCallFrameHeaderPtr
1243
1244         * jit/JIT.cpp:
1245         (JSC::JIT::privateCompileMainPass):
1246         (JSC::JIT::privateCompileCTIMachineTrampolines):
1247         * jit/JIT.h:
1248         * jit/JITInlineMethods.h:
1249         (JSC::JIT::emitGetFromCallFrameHeaderPtr):
1250         (JSC::JIT::emitGetFromCallFrameHeader32):
1251
1252 2009-05-11  Holger Hans Peter Freyther  <zecke@selfish.org>
1253
1254         Unreviewed build fix. Build ParserAreana.cpp for Qt
1255
1256         * JavaScriptCore.pri:
1257
1258 2009-05-11  Norbert Leser  <norbert.leser@nokia.com>
1259
1260         Reviewed by Darin Adler.
1261
1262         https://bugs.webkit.org/show_bug.cgi?id=24536
1263
1264         Symbian compilers cannot resolve WTF::PassRefPtr<JSC::Profile>
1265         unless Profile.h is included.
1266
1267         * profiler/ProfileGenerator.h:
1268
1269 2009-05-11  Csaba Osztrogonac  <oszi@inf.u-szeged.hu>
1270
1271         Reviewed by Holger Freyther.
1272
1273         https://bugs.webkit.org/show_bug.cgi?id=24284
1274
1275         * JavaScriptCore.pri: coding style modified
1276         * jsc.pro: duplicated values removed from INCLUDEPATH, DEFINES
1277
1278 2009-05-11  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
1279
1280         Reviewed by NOBODY (build fix).
1281
1282         Also add ParserArena, in addition to AllInOne, for release builds,
1283         since adding it to AllInOne breaks Mac.
1284
1285         * GNUmakefile.am:
1286
1287 2009-05-11  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
1288
1289         Unreviewed build fix. Adding ParserArena to the autotools build.
1290
1291         * GNUmakefile.am:
1292
1293 2009-05-11  Adam Roben  <aroben@apple.com>
1294
1295         More Windows build fixes after r43479
1296
1297         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
1298         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
1299         Export ParserArena::reset.
1300
1301 2009-05-11  Adam Roben  <aroben@apple.com>
1302
1303         Windows build fixes after r43479
1304
1305         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
1306         ParserArena to the project.
1307
1308         * parser/NodeConstructors.h: Added a missing include.
1309         (JSC::ParserArenaDeletable::operator new): Marked these as inline.
1310
1311 2009-05-10  Maciej Stachowiak  <mjs@apple.com>
1312
1313         Reviewed by Geoff Garen.
1314         
1315         - fixed REGRESSION(r43432): Many JavaScriptCore tests crash in 64-bit
1316         https://bugs.webkit.org/show_bug.cgi?id=25680
1317
1318         Accound for the 64-bit instruction prefix when rewriting mov to lea on 64-bit.
1319         
1320         * jit/JIT.h:
1321         * jit/JITPropertyAccess.cpp:
1322         (JSC::JIT::patchGetByIdSelf):
1323         (JSC::JIT::patchPutByIdReplace):
1324
1325 2009-05-10  Darin Adler  <darin@apple.com>
1326
1327         Reviewed by Cameron Zwarich.
1328
1329         Bug 25674: syntax tree nodes should use arena allocation
1330         https://bugs.webkit.org/show_bug.cgi?id=25674
1331
1332         Part two: Remove reference counting from most nodes.
1333
1334         * JavaScriptCore.exp: Updated.
1335
1336         * JavaScriptCore.xcodeproj/project.pbxproj: Added ParserArena.h and .cpp.
1337
1338         * parser/Grammar.y: Replaced uses of ParserRefCountedData with uses of
1339         ParserArenaData. Took out now-nonfunctional code that tries to manually
1340         release declaration list. Changed the new calls that create FuncDeclNode
1341         and FuncExprNode so that they use the proper version of operator new for
1342         the reference-counted idiom, not the deletion idiom.
1343
1344         * parser/NodeConstructors.h:
1345         (JSC::ParserArenaDeletable::operator new): Added.
1346         (JSC::ParserArenaRefCounted::ParserArenaRefCounted): Added.
1347         (JSC::Node::Node): Removed ParserRefCounted initializer.
1348         (JSC::ElementNode::ElementNode): Ditto.
1349         (JSC::PropertyNode::PropertyNode): Ditto.
1350         (JSC::ArgumentsNode::ArgumentsNode): Ditto.
1351         (JSC::SourceElements::SourceElements): Ditto.
1352         (JSC::ParameterNode::ParameterNode): Ditto.
1353         (JSC::FuncExprNode::FuncExprNode): Added ParserArenaRefCounted initializer.
1354         (JSC::FuncDeclNode::FuncDeclNode): Ditto.
1355         (JSC::CaseClauseNode::CaseClauseNode): Removed ParserRefCounted initializer.
1356         (JSC::ClauseListNode::ClauseListNode): Ditto.
1357         (JSC::CaseBlockNode::CaseBlockNode): Ditto.
1358
1359         * parser/NodeInfo.h: Replaced uses of ParserRefCountedData with uses of
1360         ParserArenaData.
1361
1362         * parser/Nodes.cpp:
1363         (JSC::ScopeNode::ScopeNode): Added ParserArenaRefCounted initializer.
1364         (JSC::ProgramNode::create): Use the proper version of operator new for
1365         the reference-counted idiom, not the deletion idiom. Use the arena
1366         contains function instead of the vecctor find function.
1367         (JSC::EvalNode::create): Use the proper version of operator new for
1368         the reference-counted idiom, not the deletion idiom. Use the arena
1369         reset function instead of the vector shrink function.
1370         (JSC::FunctionBodyNode::createNativeThunk): Use the proper version
1371         of operator new for the reference-counted idiom, not the deletion idiom.
1372         (JSC::FunctionBodyNode::create): More of the same.
1373
1374         * parser/Nodes.h: Added ParserArenaDeletable and ParserArenaRefCounted
1375         to replace ParserRefCounted. Fixed inheritance so only the classes that
1376         need reference counting inherit from ParserArenaRefCounted.
1377
1378         * parser/Parser.cpp:
1379         (JSC::Parser::parse): Set m_sourceElements to 0 since it now starts
1380         uninitialized. Just set it to 0 again in the failure case, since it's
1381         now just a raw pointer, not an owning one.
1382         (JSC::Parser::reparseInPlace): Removed now-unneeded get() function.
1383         (JSC::Parser::didFinishParsing): Replaced uses of ParserRefCountedData
1384         with uses of ParserArenaData.
1385
1386         * parser/Parser.h: Less RefPtr, more arena.
1387
1388         * parser/ParserArena.cpp: Added.
1389         * parser/ParserArena.h: Added.
1390
1391         * runtime/JSGlobalData.cpp:
1392         (JSC::JSGlobalData::~JSGlobalData): Removed arena-related code, since it's
1393         now in the Parser.
1394         (JSC::JSGlobalData::createLeaked): Removed unneeded #ifndef.
1395         (JSC::JSGlobalData::createNativeThunk): Tweaked #if a bit.
1396
1397         * runtime/JSGlobalData.h: Removed parserArena, which is now in Parser.
1398
1399         * wtf/RefCounted.h: Added deletionHasBegun function, for use in
1400         assertions to catch deletion not done by the deref function.
1401
1402 2009-05-10  David Kilzer  <ddkilzer@apple.com>
1403
1404         Part 2: Try to fix the Windows build by adding a symbol which is really just a re-mangling of a changed method signature
1405
1406         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
1407         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
1408
1409 2009-05-10  David Kilzer  <ddkilzer@apple.com>
1410
1411         Try to fix the Windows build by removing an unknown symbol
1412
1413         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
1414         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
1415
1416 2009-05-10  David Kilzer  <ddkilzer@apple.com>
1417
1418         Touch Nodes.cpp to try to fix Windows build
1419
1420         * parser/Nodes.cpp: Removed whitespace.
1421
1422 2009-05-10  Darin Adler  <darin@apple.com>
1423
1424         Reviewed by Maciej Stachowiak.
1425
1426         Quick fix for failures seen on buildbot. Maciej plans a better fix later.
1427
1428         * wtf/dtoa.cpp: Change the hardcoded number of 32-bit words in a BigInt
1429         from 32 to 64. Parsing "1e500", for example, requires more than 32 words.
1430
1431 2009-05-10  Darin Adler  <darin@apple.com>
1432
1433         Reviewed by Sam Weinig.
1434
1435         Bug 25674: syntax tree nodes should use arena allocation
1436         Part one: Change lifetimes so we won't have to use reference
1437         counting so much, but don't eliminate the reference counts
1438         entirely yet.
1439
1440         * JavaScriptCore.exp: Updated.
1441
1442         * bytecompiler/BytecodeGenerator.cpp:
1443         (JSC::BytecodeGenerator::BytecodeGenerator): Update for use of raw pointers
1444         instead of RefPtr.
1445         (JSC::BytecodeGenerator::emitCall): Ditto.
1446         (JSC::BytecodeGenerator::emitConstruct): Ditto.
1447
1448         * parser/Grammar.y: Update node creating code to use new (JSGlobalData*)
1449         instead of the plain new. At the moment this is just a hook for future
1450         arena allocation; it's inline and JSGlobalData* is not used.
1451
1452         * parser/NodeConstructors.h: Updated for name change of parserObjects to
1453         parserArena. Also added explicit initialization for raw pointers that used
1454         to be RefPtr. Also removed some uses of get() that aren't needed now that
1455         the pointers are raw pointers. Also eliminated m_parameter from FuncExprNode
1456         and FuncDeclNode. Also changed node-creating code to use new (JSGlobalData*)
1457         as above.
1458
1459         * parser/Nodes.cpp: Eliminated NodeReleaser and all use of it.
1460         (JSC::ParserRefCounted::ParserRefCounted): Updated for name change of
1461         parserObjects to parserArena.
1462         (JSC::SourceElements::append): Use raw pointers.
1463         (JSC::ArrayNode::emitBytecode): Ditto.
1464         (JSC::ArrayNode::isSimpleArray): Ditto.
1465         (JSC::ArrayNode::toArgumentList): Ditto.
1466         (JSC::ObjectLiteralNode::emitBytecode): Ditto.
1467         (JSC::PropertyListNode::emitBytecode): Ditto.
1468         (JSC::BracketAccessorNode::emitBytecode): Ditto.
1469         (JSC::DotAccessorNode::emitBytecode): Ditto.
1470         (JSC::ArgumentListNode::emitBytecode): Ditto.
1471         (JSC::NewExprNode::emitBytecode): Ditto.
1472         (JSC::EvalFunctionCallNode::emitBytecode): Ditto.
1473         (JSC::FunctionCallValueNode::emitBytecode): Ditto.
1474         (JSC::FunctionCallResolveNode::emitBytecode): Ditto.
1475         (JSC::FunctionCallBracketNode::emitBytecode): Ditto.
1476         (JSC::FunctionCallDotNode::emitBytecode): Ditto.
1477         (JSC::CallFunctionCallDotNode::emitBytecode): Ditto.
1478         (JSC::ApplyFunctionCallDotNode::emitBytecode): Ditto.
1479         (JSC::PostfixBracketNode::emitBytecode): Ditto.
1480         (JSC::PostfixDotNode::emitBytecode): Ditto.
1481         (JSC::DeleteBracketNode::emitBytecode): Ditto.
1482         (JSC::DeleteDotNode::emitBytecode): Ditto.
1483         (JSC::DeleteValueNode::emitBytecode): Ditto.
1484         (JSC::VoidNode::emitBytecode): Ditto.
1485         (JSC::TypeOfValueNode::emitBytecode): Ditto.
1486         (JSC::PrefixBracketNode::emitBytecode): Ditto.
1487         (JSC::PrefixDotNode::emitBytecode): Ditto.
1488         (JSC::UnaryOpNode::emitBytecode): Ditto.
1489         (JSC::BinaryOpNode::emitStrcat): Ditto.
1490         (JSC::BinaryOpNode::emitBytecode): Ditto.
1491         (JSC::EqualNode::emitBytecode): Ditto.
1492         (JSC::StrictEqualNode::emitBytecode): Ditto.
1493         (JSC::ReverseBinaryOpNode::emitBytecode): Ditto.
1494         (JSC::ThrowableBinaryOpNode::emitBytecode): Ditto.
1495         (JSC::InstanceOfNode::emitBytecode): Ditto.
1496         (JSC::LogicalOpNode::emitBytecode): Ditto.
1497         (JSC::ConditionalNode::emitBytecode): Ditto.
1498         (JSC::ReadModifyResolveNode::emitBytecode): Ditto.
1499         (JSC::AssignResolveNode::emitBytecode): Ditto.
1500         (JSC::AssignDotNode::emitBytecode): Ditto.
1501         (JSC::ReadModifyDotNode::emitBytecode): Ditto.
1502         (JSC::AssignBracketNode::emitBytecode): Ditto.
1503         (JSC::ReadModifyBracketNode::emitBytecode): Ditto.
1504         (JSC::CommaNode::emitBytecode): Ditto.
1505         (JSC::ConstDeclNode::emitCodeSingle): Ditto.
1506         (JSC::ConstDeclNode::emitBytecode): Ditto.
1507         (JSC::ConstStatementNode::emitBytecode): Ditto.
1508         (JSC::statementListEmitCode): Ditto.
1509         (JSC::BlockNode::emitBytecode): Ditto.
1510         (JSC::ExprStatementNode::emitBytecode): Ditto.
1511         (JSC::VarStatementNode::emitBytecode): Ditto.
1512         (JSC::IfNode::emitBytecode): Ditto.
1513         (JSC::IfElseNode::emitBytecode): Ditto.
1514         (JSC::DoWhileNode::emitBytecode): Ditto.
1515         (JSC::WhileNode::emitBytecode): Ditto.
1516         (JSC::ForNode::emitBytecode): Ditto.
1517         (JSC::ForInNode::emitBytecode): Ditto.
1518         (JSC::ReturnNode::emitBytecode): Ditto.
1519         (JSC::WithNode::emitBytecode): Ditto.
1520         (JSC::CaseBlockNode::tryOptimizedSwitch): Ditto.
1521         (JSC::CaseBlockNode::emitBytecodeForBlock): Ditto.
1522         (JSC::SwitchNode::emitBytecode): Ditto.
1523         (JSC::LabelNode::emitBytecode): Ditto.
1524         (JSC::ThrowNode::emitBytecode): Ditto.
1525         (JSC::TryNode::emitBytecode): Ditto.
1526         (JSC::ScopeNodeData::ScopeNodeData): Use swap to transfer ownership
1527         of the arena, varStack and functionStack.
1528         (JSC::ScopeNode::ScopeNode): Pass in the arena when creating the
1529         ScopeNodeData.
1530         (JSC::ProgramNode::ProgramNode): Made this inline since it's used
1531         in only one place.
1532         (JSC::ProgramNode::create): Changed this to return a PassRefPtr since
1533         we plan to have the scope nodes be outside the arena, so they will need
1534         some kind of ownership transfer (maybe auto_ptr instead of PassRefPtr
1535         in the future, though). Remove the node from the newly-created arena to
1536         avoid a circular reference. Later we'll keep the node out of the arena
1537         by using a different operator new, but for now it's the ParserRefCounted
1538         constructor that puts the node into the arena, and there's no way to
1539         bypass that.
1540         (JSC::EvalNode::EvalNode): Ditto.
1541         (JSC::EvalNode::create): Ditto.
1542         (JSC::FunctionBodyNode::FunctionBodyNode): Ditto.
1543         (JSC::FunctionBodyNode::createNativeThunk): Moved the code that
1544         reseets the arena here instead of the caller.
1545         (JSC::FunctionBodyNode::create): Same change as the other create
1546         functions above.
1547         (JSC::FunctionBodyNode::emitBytecode): Use raw pointers.
1548
1549         * parser/Nodes.h: Removed NodeReleaser. Changed FunctionStack to
1550         use raw pointers. Removed the releaseNodes function. Added an override
1551         of operator new that takes a JSGlobalData* to prepare for future arena use.
1552         Use raw pointers instead of RefPtr everywhere possible.
1553
1554         * parser/Parser.cpp:
1555         (JSC::Parser::reparseInPlace): Pass the arena in.
1556
1557         * parser/Parser.h:
1558         (JSC::Parser::parse): Updated for name change of parserObjects to parserArena.
1559         (JSC::Parser::reparse): Ditto.
1560         * runtime/FunctionConstructor.cpp:
1561         (JSC::extractFunctionBody): Ditto.
1562         * runtime/JSGlobalData.cpp:
1563         (JSC::JSGlobalData::~JSGlobalData): Ditto.
1564         (JSC::JSGlobalData::createNativeThunk): Moved arena manipulation into the
1565         FunctionBodyNode::createNativeThunk function.
1566
1567         * runtime/JSGlobalData.h: Tweaked formatting and renamed parserObjects to
1568         parserArena.
1569
1570         * wtf/NotFound.h: Added the usual "using WTF" to this header to match the
1571         rest of WTF.
1572
1573 2009-05-10  Dimitri Glazkov  <dglazkov@chromium.org>
1574
1575         Reviewed by Geoffrey Garen.
1576
1577         https://bugs.webkit.org/show_bug.cgi?id=25670
1578         Remove no longer valid chunk of code from dtoa.
1579
1580         * wtf/dtoa.cpp:
1581         (WTF::dtoa): Removed invalid code.
1582
1583 2009-05-10  Alexey Proskuryakov  <ap@webkit.org>
1584
1585         Reviewed by Geoff Garen.
1586
1587         "Class const *" is the same as "const Class*", use the latter syntax consistently.
1588
1589         See <http://www.parashift.com/c++-faq-lite/const-correctness.html#faq-18.9>.
1590
1591         * pcre/pcre_compile.cpp:
1592         (calculateCompiledPatternLength):
1593         * runtime/JSObject.h:
1594         (JSC::JSObject::offsetForLocation):
1595         (JSC::JSObject::locationForOffset):
1596
1597 2009-05-10  Maciej Stachowiak  <mjs@apple.com>
1598
1599         Reviewed by Alexey Proskuryakov.
1600         
1601         - speedup dtoa/strtod
1602         
1603         Added a bunch of inlining, and replaced malloc with stack allocation.
1604         
1605         0.5% SunSpider speedup (7% on string-tagcloud).
1606
1607         * runtime/NumberPrototype.cpp:
1608         (JSC::integerPartNoExp):
1609         (JSC::numberProtoFuncToExponential):
1610         * runtime/UString.cpp:
1611         (JSC::concatenate):
1612         (JSC::UString::from):
1613         * wtf/dtoa.cpp:
1614         (WTF::BigInt::BigInt):
1615         (WTF::BigInt::operator=):
1616         (WTF::Balloc):
1617         (WTF::Bfree):
1618         (WTF::multadd):
1619         (WTF::s2b):
1620         (WTF::i2b):
1621         (WTF::mult):
1622         (WTF::pow5mult):
1623         (WTF::lshift):
1624         (WTF::cmp):
1625         (WTF::diff):
1626         (WTF::b2d):
1627         (WTF::d2b):
1628         (WTF::ratio):
1629         (WTF::strtod):
1630         (WTF::quorem):
1631         (WTF::freedtoa):
1632         (WTF::dtoa):
1633         * wtf/dtoa.h:
1634
1635 2009-05-09  Mike Hommey  <glandium@debian.org>
1636
1637         Reviewed by Geoffrey Garen. Landed by Jan Alonzo.
1638
1639         Enable JIT on x86-64 gtk+
1640         https://bugs.webkit.org/show_bug.cgi?id=24724
1641
1642         * GNUmakefile.am:
1643
1644 2009-05-09  Geoffrey Garen  <ggaren@apple.com>
1645
1646         Reviewed by Cameron Zwarich.
1647         
1648         Removed the last non-call-related manually managed JIT stub call.
1649
1650         * jit/JITArithmetic.cpp:
1651         (JSC::JIT::compileFastArithSlow_op_rshift): Fully use the JITStubCall
1652         abstraction, instead of emitPutJITStubArg.
1653
1654 2009-05-09  Sebastian Andrzej Siewior  <sebastian@breakpoint.cc>
1655
1656         Reviewed by Gustavo Noronha.
1657
1658         https://bugs.webkit.org/show_bug.cgi?id=25653
1659         PLATFORM(X86_64) inherits ia64
1660
1661         __ia64__ is defined by gcc in an IA64 arch and has completely
1662         nothing in common with X86-64 exept both are from Intel and have
1663         an 64bit address space. That's it. Since code seems to expect x86
1664         here, ia64 has to go.
1665
1666         * wtf/Platform.h:
1667
1668 2009-05-09  Gustavo Noronha Silva  <gns@gnome.org>
1669
1670         Suggested by Geoffrey Garen.
1671
1672         Assume SSE2 is present on X86-64 and on MAC X86-32. This fixes a
1673         build breakage on non-Mac X86-64 when JIT is enabled.
1674
1675         * jit/JITArithmetic.cpp:
1676
1677 2009-05-09  Gustavo Noronha Silva  <gns@gnome.org>
1678
1679         Build fix, adding missing files to make dist.
1680
1681         * GNUmakefile.am:
1682
1683 2009-05-09  Geoffrey Garen  <ggaren@apple.com>
1684
1685         Windows build fix.
1686
1687         * assembler/X86Assembler.h:
1688         (JSC::X86Assembler::patchLoadToLEA):
1689
1690 2009-05-09  Geoffrey Garen  <ggaren@apple.com>
1691
1692         Windows build fix.
1693
1694         * assembler/X86Assembler.h:
1695         (JSC::X86Assembler::patchLoadToLEA):
1696
1697 2009-05-09  Maciej Stachowiak  <mjs@apple.com>
1698
1699         Reviewed by Gavin Barraclough.
1700         
1701         Original patch by John McCall. Updated by Cameron Zwarich. Further refined by me.
1702         
1703         - Assorted speedups to property access
1704         
1705         ~.3%-1% speedup on SunSpider
1706         
1707         1) When we know from the structure ID that an object is using inline storage, plant direct
1708         loads and stores against it; no need to indirect through storage pointer.
1709         
1710         2) Also because of the above, union the property storage pointer with the first inline property
1711         slot and add an extra inline property slot.
1712
1713         * assembler/AbstractMacroAssembler.h:
1714         (JSC::AbstractMacroAssembler::CodeLocationInstruction::CodeLocationInstruction):
1715         (JSC::AbstractMacroAssembler::CodeLocationInstruction::patchLoadToLEA):
1716         (JSC::::CodeLocationCommon::instructionAtOffset):
1717         * assembler/MacroAssembler.h:
1718         (JSC::MacroAssembler::storePtr):
1719         * assembler/MacroAssemblerX86.h:
1720         (JSC::MacroAssemblerX86::store32):
1721         * assembler/MacroAssemblerX86_64.h:
1722         (JSC::MacroAssemblerX86_64::storePtr):
1723         * assembler/X86Assembler.h:
1724         (JSC::X86Assembler::movq_EAXm):
1725         (JSC::X86Assembler::movl_rm):
1726         (JSC::X86Assembler::patchLoadToLEA):
1727         * jit/JIT.cpp:
1728         (JSC::JIT::privateCompileMainPass):
1729         * jit/JIT.h:
1730         * jit/JITPropertyAccess.cpp:
1731         (JSC::JIT::compileGetByIdHotPath):
1732         (JSC::JIT::compilePutByIdHotPath):
1733         (JSC::JIT::compilePutDirectOffset):
1734         (JSC::JIT::compileGetDirectOffset):
1735         (JSC::JIT::privateCompilePutByIdTransition):
1736         (JSC::JIT::patchGetByIdSelf):
1737         (JSC::JIT::patchPutByIdReplace):
1738         (JSC::JIT::privateCompileGetByIdSelf):
1739         (JSC::JIT::privateCompileGetByIdProto):
1740         (JSC::JIT::privateCompileGetByIdSelfList):
1741         (JSC::JIT::privateCompileGetByIdProtoList):
1742         (JSC::JIT::privateCompileGetByIdChainList):
1743         (JSC::JIT::privateCompileGetByIdChain):
1744         (JSC::JIT::privateCompilePutByIdReplace):
1745         * runtime/JSObject.cpp:
1746         (JSC::JSObject::mark):
1747         (JSC::JSObject::removeDirect):
1748         * runtime/JSObject.h:
1749         (JSC::JSObject::propertyStorage):
1750         (JSC::JSObject::getDirect):
1751         (JSC::JSObject::getOffset):
1752         (JSC::JSObject::offsetForLocation):
1753         (JSC::JSObject::locationForOffset):
1754         (JSC::JSObject::getDirectOffset):
1755         (JSC::JSObject::putDirectOffset):
1756         (JSC::JSObject::isUsingInlineStorage):
1757         (JSC::JSObject::):
1758         (JSC::JSObject::JSObject):
1759         (JSC::JSObject::~JSObject):
1760         (JSC::Structure::isUsingInlineStorage):
1761         (JSC::JSObject::putDirect):
1762         (JSC::JSObject::putDirectWithoutTransition):
1763         (JSC::JSObject::allocatePropertyStorageInline):
1764         * runtime/Structure.h:
1765
1766 2009-05-09  Geoffrey Garen  <ggaren@apple.com>
1767
1768         Reviewed by Gavin Barraclough.
1769
1770         Changed all our JIT stubs so that they return a maximum of 1 JS value or
1771         two non-JS pointers, and do all other value returning through out
1772         parameters, in preparation for 64bit JS values on a 32bit system.
1773
1774         Stubs that used to return two JSValues now return one JSValue and take
1775         and out parameter specifying where in the register array the second
1776         value should go.
1777         
1778         SunSpider reports no change.
1779
1780         * jit/JIT.cpp:
1781         (JSC::JIT::privateCompileMainPass):
1782         * jit/JITArithmetic.cpp:
1783         (JSC::JIT::compileFastArithSlow_op_post_inc):
1784         (JSC::JIT::compileFastArithSlow_op_post_dec):
1785         * jit/JITStubs.cpp:
1786         (JSC::JITStubs::cti_op_call_arityCheck):
1787         (JSC::JITStubs::cti_op_resolve_func):
1788         (JSC::JITStubs::cti_op_post_inc):
1789         (JSC::JITStubs::cti_op_resolve_with_base):
1790         (JSC::JITStubs::cti_op_post_dec):
1791         * jit/JITStubs.h:
1792         (JSC::):
1793
1794 2009-05-08  Geoffrey Garen  <ggaren@apple.com>
1795
1796         Reviewed by Cameron Zwarich.
1797         
1798         Fixed <rdar://problem/6634956> CrashTracer: [REGRESSION] >400 crashes
1799         in Safari at com.apple.JavaScriptCore • JSC::BytecodeGenerator::emitComplexJumpScopes + 468
1800         https://bugs.webkit.org/show_bug.cgi?id=25658
1801
1802         * bytecompiler/BytecodeGenerator.cpp:
1803         (JSC::BytecodeGenerator::emitComplexJumpScopes): Guard the whole loop
1804         with a bounds check. The old loop logic would decrement and read topScope
1805         without a bounds check, which could cause crashes on page boundaries.
1806
1807 2009-05-08  Jan Michael Alonzo  <jmalonzo@webkit.org>
1808
1809         Reviewed by NOBODY (BuildFix).
1810
1811         Gtk fix: add LiteralParser to the build script per r43424.
1812
1813         Add LiteralParser to the Qt and Wx build scripts too.
1814
1815         * GNUmakefile.am:
1816         * JavaScriptCore.pri:
1817         * JavaScriptCoreSources.bkl:
1818
1819 2009-05-08  Oliver Hunt  <oliver@apple.com>
1820
1821         Reviewed by Gavin Barraclough and Darin Adler.
1822
1823         Add a limited literal parser for eval to handle object and array literals fired at eval
1824
1825         This is a simplified parser and lexer that we can throw at strings passed to eval
1826         in case a site is using eval to parse JSON (eg. json2.js).  The lexer is intentionally
1827         limited (in effect it's whitelisting a limited "common" subset of the JSON grammar)
1828         as this decreases the likelihood of us wating time attempting to parse any significant
1829         amount of non-JSON content.
1830
1831         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1832         * JavaScriptCore.xcodeproj/project.pbxproj:
1833         * interpreter/Interpreter.cpp:
1834         (JSC::Interpreter::callEval):
1835         * runtime/JSGlobalObjectFunctions.cpp:
1836         (JSC::globalFuncEval):
1837         * runtime/LiteralParser.cpp: Added.
1838         (JSC::isStringCharacter):
1839         (JSC::LiteralParser::Lexer::lex):
1840         (JSC::LiteralParser::Lexer::lexString):
1841         (JSC::LiteralParser::Lexer::lexNumber):
1842         (JSC::LiteralParser::parseStatement):
1843         (JSC::LiteralParser::parseExpression):
1844         (JSC::LiteralParser::parseArray):
1845         (JSC::LiteralParser::parseObject):
1846         (JSC::LiteralParser::StackGuard::StackGuard):
1847         (JSC::LiteralParser::StackGuard::~StackGuard):
1848         (JSC::LiteralParser::StackGuard::isSafe):
1849         * runtime/LiteralParser.h: Added.
1850         (JSC::LiteralParser::LiteralParser):
1851         (JSC::LiteralParser::attemptJSONParse):
1852         (JSC::LiteralParser::):
1853         (JSC::LiteralParser::Lexer::Lexer):
1854         (JSC::LiteralParser::Lexer::next):
1855         (JSC::LiteralParser::Lexer::currentToken):
1856         (JSC::LiteralParser::abortParse):
1857
1858 2009-05-08  Geoffrey Garen  <ggaren@apple.com>
1859
1860         Not reviewed.
1861         
1862         Restored a Mozilla JS test I accidentally gutted.
1863
1864         * tests/mozilla/ecma/Array/15.4.4.2.js:
1865         (getTestCases):
1866         (test):
1867
1868 2009-05-08  Geoffrey Garen  <ggaren@apple.com>
1869
1870         Reviewed by Gavin Barraclough.
1871         
1872         More abstraction for JITStub calls from JITed code.
1873         
1874         Added a JITStubCall class that automatically handles things like assigning
1875         arguments to different stack slots and storing return values. Deployed
1876         the class in about a billion places. A bunch more places remain to be
1877         fixed up, but this is a good stopping point for now.
1878
1879         * jit/JIT.cpp:
1880         (JSC::JIT::emitTimeoutCheck):
1881         (JSC::JIT::privateCompileMainPass):
1882         (JSC::JIT::privateCompileSlowCases):
1883         (JSC::JIT::privateCompile):
1884         * jit/JIT.h:
1885         (JSC::JIT::JSRInfo::JSRInfo):
1886         (JSC::JITStubCall::JITStubCall):
1887         (JSC::JITStubCall::addArgument):
1888         (JSC::JITStubCall::call):
1889         (JSC::JITStubCall::):
1890         (JSC::CallEvalJITStub::CallEvalJITStub):
1891         * jit/JITArithmetic.cpp:
1892         (JSC::JIT::compileFastArithSlow_op_lshift):
1893         (JSC::JIT::compileFastArithSlow_op_rshift):
1894         (JSC::JIT::compileFastArithSlow_op_jnless):
1895         (JSC::JIT::compileFastArithSlow_op_bitand):
1896         (JSC::JIT::compileFastArithSlow_op_mod):
1897         (JSC::JIT::compileFastArith_op_mod):
1898         (JSC::JIT::compileFastArithSlow_op_post_inc):
1899         (JSC::JIT::compileFastArithSlow_op_post_dec):
1900         (JSC::JIT::compileFastArithSlow_op_pre_inc):
1901         (JSC::JIT::compileFastArithSlow_op_pre_dec):
1902         (JSC::JIT::compileFastArith_op_add):
1903         (JSC::JIT::compileFastArith_op_mul):
1904         (JSC::JIT::compileFastArith_op_sub):
1905         (JSC::JIT::compileBinaryArithOpSlowCase):
1906         (JSC::JIT::compileFastArithSlow_op_add):
1907         (JSC::JIT::compileFastArithSlow_op_mul):
1908         * jit/JITCall.cpp:
1909         (JSC::JIT::compileOpCall):
1910         (JSC::):
1911         * jit/JITPropertyAccess.cpp:
1912         (JSC::JIT::compileGetByIdHotPath):
1913         (JSC::JIT::compilePutByIdHotPath):
1914         (JSC::JIT::compileGetByIdSlowCase):
1915         (JSC::JIT::compilePutByIdSlowCase):
1916         * jit/JITStubs.cpp:
1917         (JSC::JITStubs::cti_op_resolve_func):
1918         (JSC::JITStubs::cti_op_resolve_with_base):
1919
1920 2009-05-08  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1921
1922         Reviewed by Maciej Stachowiak.
1923
1924         Add a new opcode jnlesseq, and optimize its compilation in the JIT using
1925         techniques similar to what were used to optimize jnless in r43363.
1926
1927         This gives a 0.7% speedup on SunSpider, particularly on the tests 3d-cube,
1928         control-flow-recursive, date-format-xparb, and string-base64.
1929
1930         * bytecode/CodeBlock.cpp:
1931         (JSC::CodeBlock::dump): Add support for dumping op_jnlesseq.
1932         * bytecode/Opcode.h: Add op_jnlesseq to the list of opcodes.
1933         * bytecompiler/BytecodeGenerator.cpp:
1934         (JSC::BytecodeGenerator::emitJumpIfFalse): Add a peephole optimization
1935         for op_jnlesseq when emitting lesseq followed by a jump.
1936         * interpreter/Interpreter.cpp:
1937         (JSC::Interpreter::privateExecute): Add case for op_jnlesseq.
1938         * jit/JIT.cpp:
1939         (JSC::JIT::privateCompileMainPass): Add case for op_jnlesseq.
1940         (JSC::JIT::privateCompileSlowCases): Add case for op_jnlesseq.
1941         * jit/JIT.h:
1942         * jit/JITArithmetic.cpp:
1943         (JSC::JIT::compileFastArith_op_jnlesseq): Added.
1944         (JSC::JIT::compileFastArithSlow_op_jnlesseq): Added.
1945         * jit/JITStubs.cpp:
1946         (JSC::JITStubs::cti_op_jlesseq): Added.
1947         * jit/JITStubs.h:
1948
1949 2009-05-08  Maciej Stachowiak  <mjs@apple.com>
1950
1951         Reviewed by Cameron Zwarich.
1952         
1953         - fix test failures on 64-bit
1954
1955         * jit/JITArithmetic.cpp:
1956         (JSC::JIT::compileFastArithSlow_op_jnless): Avoid accidentaly treating an
1957         immediate int as an immediate float in the 64-bit value representation.
1958
1959 2009-05-08  Gavin Barraclough  <barraclough@apple.com>
1960
1961         Rubber stamped by Oliver Hunt.
1962
1963         Removing an empty constructor and an uncalled, empty function seems to be a
1964         pretty solid 1% regeression on my machine, so I'm going to put them back.
1965         Um.  Yeah, this this pretty pointles and makes no sense at all.  I officially
1966         lose the will to live in 3... 2...
1967
1968         * bytecode/SamplingTool.cpp:
1969         (JSC::SamplingTool::notifyOfScope):
1970         * bytecode/SamplingTool.h:
1971         (JSC::SamplingTool::~SamplingTool):
1972
1973 2009-05-08  Gavin Barraclough  <barraclough@apple.com>
1974
1975         Reviewed by Oliver "I see lots of ifdefs" Hunt.
1976
1977         Fix (kinda) for sampling tool breakage.  The codeblock sampling tool has become
1978         b0rked due to recent changes in native function calling.  The initialization of
1979         a ScopeNode appears to now occur before the sampling tool (or possibly the
1980         interpreter has been brought into existence, wihich leads to crashyness).
1981
1982         This patch doesn't fix the problem.  The crash occurs when tracking a Scope, but
1983         we shouldn't need to track scopes when we're just sampling opcodes, not
1984         codeblocks.  Not retaining Scopes when just opcode sampling will reduce sampling
1985         overhead reducing any instrumentation skew, which is a good thing.  As a side
1986         benefit this patch also gets the opcode sampling going again, albeit in a bit of
1987         a lame way.  Will come back later with a proper fix from codeblock sampling. 
1988
1989         * JavaScriptCore.exp:
1990         * bytecode/SamplingTool.cpp:
1991         (JSC::compareLineCountInfoSampling):
1992         (JSC::SamplingTool::dump):
1993         * bytecode/SamplingTool.h:
1994         (JSC::SamplingTool::SamplingTool):
1995         * parser/Nodes.cpp:
1996         (JSC::ScopeNode::ScopeNode):
1997
1998 2009-05-07  Mark Rowe  <mrowe@apple.com>
1999
2000         Rubber-stamped by Oliver Hunt.
2001
2002         Fix <https://bugs.webkit.org/show_bug.cgi?id=25640>.
2003         Bug 25640: Crash on quit in r43384 nightly build on Leopard w/ Safari 4 beta installed
2004         
2005         Roll out r43366 as it removed symbols that Safari 4 Beta uses.
2006
2007         * JavaScriptCore.exp:
2008         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
2009         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
2010         * bytecode/SamplingTool.cpp:
2011         (JSC::SamplingThread::start):
2012         (JSC::SamplingThread::stop):
2013         * bytecode/SamplingTool.h:
2014         * wtf/CrossThreadRefCounted.h:
2015         (WTF::CrossThreadRefCounted::CrossThreadRefCounted):
2016         (WTF::::ref):
2017         (WTF::::deref):
2018         * wtf/Threading.h:
2019         * wtf/ThreadingNone.cpp:
2020         * wtf/ThreadingPthreads.cpp:
2021         (WTF::threadMapMutex):
2022         (WTF::initializeThreading):
2023         (WTF::threadMap):
2024         (WTF::identifierByPthreadHandle):
2025         (WTF::establishIdentifierForPthreadHandle):
2026         (WTF::pthreadHandleForIdentifier):
2027         (WTF::clearPthreadHandleForIdentifier):
2028         (WTF::createThreadInternal):
2029         (WTF::waitForThreadCompletion):
2030         (WTF::detachThread):
2031         (WTF::currentThread):
2032         * wtf/ThreadingWin.cpp:
2033         (WTF::threadMapMutex):
2034         (WTF::initializeThreading):
2035         (WTF::threadMap):
2036         (WTF::storeThreadHandleByIdentifier):
2037         (WTF::threadHandleForIdentifier):
2038         (WTF::clearThreadHandleForIdentifier):
2039         (WTF::createThreadInternal):
2040         (WTF::waitForThreadCompletion):
2041         (WTF::detachThread):
2042         (WTF::currentThread):
2043         * wtf/gtk/ThreadingGtk.cpp:
2044         (WTF::threadMapMutex):
2045         (WTF::initializeThreading):
2046         (WTF::threadMap):
2047         (WTF::identifierByGthreadHandle):
2048         (WTF::establishIdentifierForThread):
2049         (WTF::threadForIdentifier):
2050         (WTF::clearThreadForIdentifier):
2051         (WTF::createThreadInternal):
2052         (WTF::waitForThreadCompletion):
2053         (WTF::currentThread):
2054         * wtf/qt/ThreadingQt.cpp:
2055         (WTF::threadMapMutex):
2056         (WTF::threadMap):
2057         (WTF::identifierByQthreadHandle):
2058         (WTF::establishIdentifierForThread):
2059         (WTF::clearThreadForIdentifier):
2060         (WTF::threadForIdentifier):
2061         (WTF::initializeThreading):
2062         (WTF::createThreadInternal):
2063         (WTF::waitForThreadCompletion):
2064         (WTF::currentThread):
2065
2066 2009-05-07  Gustavo Noronha Silva  <gns@gnome.org>
2067
2068         Suggested by Oliver Hunt.
2069
2070         Also check for Linux for the special-cased calling convention.
2071
2072         * jit/JIT.cpp:
2073         (JSC::JIT::privateCompileCTIMachineTrampolines):
2074         * wtf/Platform.h:
2075
2076 2009-05-07  Gavin Barraclough  <barraclough@apple.com>
2077
2078         Reviewed by Maciej Stachowiak.
2079
2080         Previously, when appending to an existing string and growing the underlying buffer,
2081         we would actually allocate 110% of the required size in order to give us some space
2082         to expand into.  Now we treat strings differently based on their size:
2083
2084         Small Strings (up to 4 pages):
2085         Expand the allocation size to 112.5% of the amount requested.  This is largely sicking
2086         to our previous policy, however 112.5% is cheaper to calculate.
2087
2088         Medium Strings (up to 128 pages):
2089         For pages covering multiple pages over-allocation is less of a concern - any unused
2090         space will not be paged in if it is not used, so this is purely a VM overhead.  For
2091         these strings allocate 2x the requested size.
2092
2093         Large Strings (to infinity and beyond!):
2094         Revert to our 112.5% policy - probably best to limit the amount of unused VM we allow
2095         any individual string be responsible for.
2096
2097         Additionally, round small allocations up to a multiple of 16 bytes, and medium and
2098         large allocations up to a multiple of page size.
2099
2100         ~1.5% progression on Sunspider, due to 5% improvement on tagcloud & 15% on validate.
2101
2102         * runtime/UString.cpp:
2103         (JSC::expandedSize):
2104
2105 2009-05-07  Geoffrey Garen  <ggaren@apple.com>
2106
2107         Reviewed by Cameron Zwarich.
2108         
2109         Fixed a minor sequencing error introduced by recent Parser speedups.
2110
2111         * runtime/JSGlobalData.cpp:
2112         (JSC::JSGlobalData::createNativeThunk): Missed a spot in my last patch.
2113
2114 2009-05-07  Geoffrey Garen  <ggaren@apple.com>
2115
2116         Not reviewed.
2117
2118         * wtf/Platform.h: Reverted an accidental (and performance-catastrophic)
2119         change.
2120
2121 2009-05-07  Geoffrey Garen  <ggaren@apple.com>
2122
2123         Reviewed by Cameron Zwarich.
2124         
2125         Fixed a minor sequencing error introduced by recent Parser speedups.
2126
2127         * parser/Parser.cpp:
2128         (JSC::Parser::reparseInPlace): Missed a spot in my last patch.
2129
2130 2009-05-07  Geoffrey Garen  <ggaren@apple.com>
2131
2132         Reviewed by Cameron Zwarich.
2133         
2134         Fixed a minor sequencing error introduced by recent Parser speedups.
2135
2136         * parser/Parser.cpp:
2137         (JSC::Parser::parse):
2138         * parser/Parser.h:
2139         (JSC::Parser::parse):
2140         (JSC::Parser::reparse): Shrink the parsedObjects vector after allocating
2141         the root node, to avoid leaving a stray node in the vector, since that's
2142         a slight memory leak, and it causes problems during JSGlobalData teardown.
2143
2144         * runtime/JSGlobalData.cpp:
2145         (JSC::JSGlobalData::~JSGlobalData): ASSERT that we're not being torn
2146         down while we think we're still parsing, since that would cause lots of
2147         bad memory references during our destruction.
2148
2149 2009-05-07  Geoffrey Garen  <ggaren@apple.com>
2150
2151         Reviewed by Cameron Zwarich.
2152         
2153         Replaced two more macros with references to the JITStackFrame structure.
2154
2155         * jit/JIT.cpp:
2156         (JSC::JIT::privateCompileMainPass):
2157         * jit/JITInlineMethods.h:
2158         (JSC::JIT::restoreArgumentReference):
2159         * jit/JITStubs.cpp:
2160         (JSC::):
2161         * jit/JITStubs.h:
2162
2163 2009-05-07  Oliver Hunt  <oliver@apple.com>
2164
2165         Reviewed by Gavin Barraclough.
2166
2167         Improve native call performance
2168
2169         Fix the windows build by adding calling convention declarations everywhere,
2170         chose fastcall as that seemed most sensible given we were having to declare
2171         the convention explicitly.  In addition switched to fastcall on mac in the
2172         deluded belief that documented fastcall behavior on windows would match 
2173         actual its actual behavior.
2174
2175         * API/JSCallbackFunction.h:
2176         * API/JSCallbackObject.h:
2177         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
2178         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
2179         * interpreter/CallFrame.h:
2180         (JSC::ExecState::argumentCount):
2181         * jit/JIT.cpp:
2182         (JSC::JIT::privateCompileCTIMachineTrampolines):
2183         * jsc.cpp:
2184         (functionPrint):
2185         (functionDebug):
2186         (functionGC):
2187         (functionVersion):
2188         (functionRun):
2189         (functionLoad):
2190         (functionSetSamplingFlags):
2191         (functionClearSamplingFlags):
2192         (functionReadline):
2193         (functionQuit):
2194         * runtime/ArrayConstructor.cpp:
2195         (JSC::callArrayConstructor):
2196         * runtime/ArrayPrototype.cpp:
2197         (JSC::arrayProtoFuncToString):
2198         (JSC::arrayProtoFuncToLocaleString):
2199         (JSC::arrayProtoFuncJoin):
2200         (JSC::arrayProtoFuncConcat):
2201         (JSC::arrayProtoFuncPop):
2202         (JSC::arrayProtoFuncPush):
2203         (JSC::arrayProtoFuncReverse):
2204         (JSC::arrayProtoFuncShift):
2205         (JSC::arrayProtoFuncSlice):
2206         (JSC::arrayProtoFuncSort):
2207         (JSC::arrayProtoFuncSplice):
2208         (JSC::arrayProtoFuncUnShift):
2209         (JSC::arrayProtoFuncFilter):
2210         (JSC::arrayProtoFuncMap):
2211         (JSC::arrayProtoFuncEvery):
2212         (JSC::arrayProtoFuncForEach):
2213         (JSC::arrayProtoFuncSome):
2214         (JSC::arrayProtoFuncReduce):
2215         (JSC::arrayProtoFuncReduceRight):
2216         (JSC::arrayProtoFuncIndexOf):
2217         (JSC::arrayProtoFuncLastIndexOf):
2218         * runtime/BooleanConstructor.cpp:
2219         (JSC::callBooleanConstructor):
2220         * runtime/BooleanPrototype.cpp:
2221         (JSC::booleanProtoFuncToString):
2222         (JSC::booleanProtoFuncValueOf):
2223         * runtime/CallData.h:
2224         * runtime/DateConstructor.cpp:
2225         (JSC::callDate):
2226         (JSC::dateParse):
2227         (JSC::dateNow):
2228         (JSC::dateUTC):
2229         * runtime/DatePrototype.cpp:
2230         (JSC::dateProtoFuncToString):
2231         (JSC::dateProtoFuncToUTCString):
2232         (JSC::dateProtoFuncToDateString):
2233         (JSC::dateProtoFuncToTimeString):
2234         (JSC::dateProtoFuncToLocaleString):
2235         (JSC::dateProtoFuncToLocaleDateString):
2236         (JSC::dateProtoFuncToLocaleTimeString):
2237         (JSC::dateProtoFuncGetTime):
2238         (JSC::dateProtoFuncGetFullYear):
2239         (JSC::dateProtoFuncGetUTCFullYear):
2240         (JSC::dateProtoFuncToGMTString):
2241         (JSC::dateProtoFuncGetMonth):
2242         (JSC::dateProtoFuncGetUTCMonth):
2243         (JSC::dateProtoFuncGetDate):
2244         (JSC::dateProtoFuncGetUTCDate):
2245         (JSC::dateProtoFuncGetDay):
2246         (JSC::dateProtoFuncGetUTCDay):
2247         (JSC::dateProtoFuncGetHours):
2248         (JSC::dateProtoFuncGetUTCHours):
2249         (JSC::dateProtoFuncGetMinutes):
2250         (JSC::dateProtoFuncGetUTCMinutes):
2251         (JSC::dateProtoFuncGetSeconds):
2252         (JSC::dateProtoFuncGetUTCSeconds):
2253         (JSC::dateProtoFuncGetMilliSeconds):
2254         (JSC::dateProtoFuncGetUTCMilliseconds):
2255         (JSC::dateProtoFuncGetTimezoneOffset):
2256         (JSC::dateProtoFuncSetTime):
2257         (JSC::dateProtoFuncSetMilliSeconds):
2258         (JSC::dateProtoFuncSetUTCMilliseconds):
2259         (JSC::dateProtoFuncSetSeconds):
2260         (JSC::dateProtoFuncSetUTCSeconds):
2261         (JSC::dateProtoFuncSetMinutes):
2262         (JSC::dateProtoFuncSetUTCMinutes):
2263         (JSC::dateProtoFuncSetHours):
2264         (JSC::dateProtoFuncSetUTCHours):
2265         (JSC::dateProtoFuncSetDate):
2266         (JSC::dateProtoFuncSetUTCDate):
2267         (JSC::dateProtoFuncSetMonth):
2268         (JSC::dateProtoFuncSetUTCMonth):
2269         (JSC::dateProtoFuncSetFullYear):
2270         (JSC::dateProtoFuncSetUTCFullYear):
2271         (JSC::dateProtoFuncSetYear):
2272         (JSC::dateProtoFuncGetYear):
2273         * runtime/ErrorConstructor.cpp:
2274         (JSC::callErrorConstructor):
2275         * runtime/ErrorPrototype.cpp:
2276         (JSC::errorProtoFuncToString):
2277         * runtime/FunctionConstructor.cpp:
2278         (JSC::callFunctionConstructor):
2279         * runtime/FunctionPrototype.cpp:
2280         (JSC::callFunctionPrototype):
2281         (JSC::functionProtoFuncToString):
2282         (JSC::functionProtoFuncApply):
2283         (JSC::functionProtoFuncCall):
2284         * runtime/JSFunction.h:
2285         (JSC::JSFunction::nativeFunction):
2286         (JSC::JSFunction::setScopeChain):
2287         * runtime/JSGlobalObjectFunctions.cpp:
2288         (JSC::globalFuncEval):
2289         (JSC::globalFuncParseInt):
2290         (JSC::globalFuncParseFloat):
2291         (JSC::globalFuncIsNaN):
2292         (JSC::globalFuncIsFinite):
2293         (JSC::globalFuncDecodeURI):
2294         (JSC::globalFuncDecodeURIComponent):
2295         (JSC::globalFuncEncodeURI):
2296         (JSC::globalFuncEncodeURIComponent):
2297         (JSC::globalFuncEscape):
2298         (JSC::globalFuncUnescape):
2299         (JSC::globalFuncJSCPrint):
2300         * runtime/JSGlobalObjectFunctions.h:
2301         * runtime/MathObject.cpp:
2302         (JSC::mathProtoFuncAbs):
2303         (JSC::mathProtoFuncACos):
2304         (JSC::mathProtoFuncASin):
2305         (JSC::mathProtoFuncATan):
2306         (JSC::mathProtoFuncATan2):
2307         (JSC::mathProtoFuncCeil):
2308         (JSC::mathProtoFuncCos):
2309         (JSC::mathProtoFuncExp):
2310         (JSC::mathProtoFuncFloor):
2311         (JSC::mathProtoFuncLog):
2312         (JSC::mathProtoFuncMax):
2313         (JSC::mathProtoFuncMin):
2314         (JSC::mathProtoFuncPow):
2315         (JSC::mathProtoFuncRandom):
2316         (JSC::mathProtoFuncRound):
2317         (JSC::mathProtoFuncSin):
2318         (JSC::mathProtoFuncSqrt):
2319         (JSC::mathProtoFuncTan):
2320         * runtime/NativeErrorConstructor.cpp:
2321         (JSC::callNativeErrorConstructor):
2322         * runtime/NativeFunctionWrapper.h:
2323         * runtime/NumberConstructor.cpp:
2324         (JSC::callNumberConstructor):
2325         * runtime/NumberPrototype.cpp:
2326         (JSC::numberProtoFuncToString):
2327         (JSC::numberProtoFuncToLocaleString):
2328         (JSC::numberProtoFuncValueOf):
2329         (JSC::numberProtoFuncToFixed):
2330         (JSC::numberProtoFuncToExponential):
2331         (JSC::numberProtoFuncToPrecision):
2332         * runtime/ObjectConstructor.cpp:
2333         (JSC::callObjectConstructor):
2334         * runtime/ObjectPrototype.cpp:
2335         (JSC::objectProtoFuncValueOf):
2336         (JSC::objectProtoFuncHasOwnProperty):
2337         (JSC::objectProtoFuncIsPrototypeOf):
2338         (JSC::objectProtoFuncDefineGetter):
2339         (JSC::objectProtoFuncDefineSetter):
2340         (JSC::objectProtoFuncLookupGetter):
2341         (JSC::objectProtoFuncLookupSetter):
2342         (JSC::objectProtoFuncPropertyIsEnumerable):
2343         (JSC::objectProtoFuncToLocaleString):
2344         (JSC::objectProtoFuncToString):
2345         * runtime/ObjectPrototype.h:
2346         * runtime/RegExpConstructor.cpp:
2347         (JSC::callRegExpConstructor):
2348         * runtime/RegExpObject.cpp:
2349         (JSC::callRegExpObject):
2350         * runtime/RegExpPrototype.cpp:
2351         (JSC::regExpProtoFuncTest):
2352         (JSC::regExpProtoFuncExec):
2353         (JSC::regExpProtoFuncCompile):
2354         (JSC::regExpProtoFuncToString):
2355         * runtime/StringConstructor.cpp:
2356         (JSC::stringFromCharCode):
2357         (JSC::callStringConstructor):
2358         * runtime/StringPrototype.cpp:
2359         (JSC::stringProtoFuncReplace):
2360         (JSC::stringProtoFuncToString):
2361         (JSC::stringProtoFuncCharAt):
2362         (JSC::stringProtoFuncCharCodeAt):
2363         (JSC::stringProtoFuncConcat):
2364         (JSC::stringProtoFuncIndexOf):
2365         (JSC::stringProtoFuncLastIndexOf):
2366         (JSC::stringProtoFuncMatch):
2367         (JSC::stringProtoFuncSearch):
2368         (JSC::stringProtoFuncSlice):
2369         (JSC::stringProtoFuncSplit):
2370         (JSC::stringProtoFuncSubstr):
2371         (JSC::stringProtoFuncSubstring):
2372         (JSC::stringProtoFuncToLowerCase):
2373         (JSC::stringProtoFuncToUpperCase):
2374         (JSC::stringProtoFuncLocaleCompare):
2375         (JSC::stringProtoFuncBig):
2376         (JSC::stringProtoFuncSmall):
2377         (JSC::stringProtoFuncBlink):
2378         (JSC::stringProtoFuncBold):
2379         (JSC::stringProtoFuncFixed):
2380         (JSC::stringProtoFuncItalics):
2381         (JSC::stringProtoFuncStrike):
2382         (JSC::stringProtoFuncSub):
2383         (JSC::stringProtoFuncSup):
2384         (JSC::stringProtoFuncFontcolor):
2385         (JSC::stringProtoFuncFontsize):
2386         (JSC::stringProtoFuncAnchor):
2387         (JSC::stringProtoFuncLink):
2388         * wtf/Platform.h:
2389
2390 2009-05-07  Geoffrey Garen  <ggaren@apple.com>
2391
2392         Not reviewed.
2393         
2394         Rolled out a portion of r43352 because it broke 64bit.
2395
2396         * jit/JITStubs.h:
2397
2398 2009-05-07  Kevin Ollivier  <kevino@theolliviers.com>
2399
2400         Build fix for functions reaturning ThreadIdentifier.
2401
2402         * wtf/ThreadingNone.cpp:
2403         (WTF::createThreadInternal):
2404         (WTF::currentThread):
2405
2406 2009-05-07  Maciej Stachowiak  <mjs@apple.com>
2407
2408         Reviewed by John Honeycutt.
2409         
2410         - enable optimization case im the last patch that I accidentally had disabled.
2411
2412         * jit/JITArithmetic.cpp:
2413         (JSC::JIT::compileFastArithSlow_op_jnless):
2414
2415 2009-05-07  Dmitry Titov  <dimich@chromium.org>
2416
2417         Attempt to fix Win build.
2418
2419         * jit/JITArithmetic.cpp:
2420         (JSC::JIT::compileFastArithSlow_op_jnless):
2421
2422 2009-05-07  Dmitry Titov  <dimich@chromium.org>
2423
2424         Reviewed by Alexey Proskuryakov and Adam Roben.
2425
2426         https://bugs.webkit.org/show_bug.cgi?id=25348
2427         Change WTF::ThreadIdentifier to be an actual (but wrapped) thread id, remove ThreadMap.
2428
2429         * wtf/Threading.h:
2430         (WTF::ThreadIdentifier::ThreadIdentifier):
2431         (WTF::ThreadIdentifier::isValid):
2432         (WTF::ThreadIdentifier::invalidate):
2433         (WTF::ThreadIdentifier::platformId):
2434         ThreadIdentifier is now a class, containing a PlatformThreadIdentifier and
2435         methods that are used across the code on thread ids: construction, comparisons,
2436         check for 'valid' state etc. '0' is used as invalid id, which happens to just work
2437         with all platform-specific thread id implementations.
2438
2439         All the following files repeatedly reflect the new ThreadIdentifier for each platform.
2440         We remove ThreadMap and threadMapMutex from all of them, remove the functions that
2441         populated/searched/cleared the map and add platform-specific comparison operators
2442         for ThreadIdentifier.
2443
2444         * wtf/gtk/ThreadingGtk.cpp:
2445         (WTF::ThreadIdentifier::operator==):
2446         (WTF::ThreadIdentifier::operator!=):
2447         (WTF::initializeThreading):
2448         (WTF::createThreadInternal):
2449         (WTF::waitForThreadCompletion):
2450         (WTF::currentThread):
2451
2452         * wtf/ThreadingNone.cpp:
2453         (WTF::ThreadIdentifier::operator==):
2454         (WTF::ThreadIdentifier::operator!=):
2455
2456         * wtf/ThreadingPthreads.cpp:
2457         (WTF::ThreadIdentifier::operator==):
2458         (WTF::ThreadIdentifier::operator!=):
2459         (WTF::initializeThreading):
2460         (WTF::createThreadInternal):
2461         (WTF::waitForThreadCompletion):
2462         (WTF::detachThread):
2463         (WTF::currentThread):
2464
2465         * wtf/qt/ThreadingQt.cpp:
2466         (WTF::ThreadIdentifier::operator==):
2467         (WTF::ThreadIdentifier::operator!=):
2468         (WTF::initializeThreading):
2469         (WTF::createThreadInternal):
2470         (WTF::waitForThreadCompletion):
2471         (WTF::currentThread):
2472
2473         * wtf/ThreadingWin.cpp:
2474         (WTF::ThreadIdentifier::operator==):
2475         (WTF::ThreadIdentifier::operator!=):
2476         (WTF::initializeThreading):
2477         (WTF::createThreadInternal): All the platforms (except Windows) used a sequential
2478         counter as a thread ID and mapped it into platform ID. Windows was using native thread
2479         id and mapped it into thread handle. Since we can always obtain a thread handle
2480         by thread id, createThread now closes the handle.
2481         (WTF::waitForThreadCompletion): obtains another one using OpenThread(id) API. If can not obtain a handle,
2482         it means the thread already exited.
2483         (WTF::detachThread):
2484         (WTF::currentThread):
2485         (WTF::detachThreadDeprecated): old function, renamed (for Win Safari 4 beta which uses it for now).
2486         (WTF::waitForThreadCompletionDeprecated): same.
2487         (WTF::currentThreadDeprecated): same.
2488         (WTF::createThreadDeprecated): same.
2489
2490         * bytecode/SamplingTool.h:
2491         * bytecode/SamplingTool.cpp: Use DEFINE_STATIC_LOCAL for a static ThreadIdentifier variable, to avoid static constructor.
2492
2493         * JavaScriptCore.exp: export lists - updated the WTF threading functions decorated names
2494         since they now take a different type as a parameter.
2495         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: ditto for Windows, plus added "deprecated" functions
2496         that take old parameter type - turns out public beta of Safari 4 uses those, so they need to be kept along for a while.
2497         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: ditto.
2498
2499 2009-05-07  Maciej Stachowiak  <mjs@apple.com>
2500
2501         Reviewed by Sam Weinig.
2502         
2503         - optimize various cases of branch-fused less
2504         
2505         1% speedup on SunSpider overall
2506         13% speedup on math-cordic
2507
2508         * jit/JIT.cpp:
2509         (JSC::JIT::privateCompileMainPass):
2510         op_loop_if_less: Optimize case of constant as first operand, just as case of constant as
2511         second operand.
2512         op_jnless: Factored out into compileFastArith_op_jnless.
2513         (JSC::JIT::privateCompileSlowCases):
2514         op_jnless: Factored out into compileFastArithSlow_op_jnless.
2515         * jit/JIT.h:
2516         * jit/JITArithmetic.cpp:
2517         (JSC::JIT::compileFastArith_op_jnless): Factored out from main compile loop.
2518         - Generate inline code for comparison of constant immediate int as first operand to another
2519         immediate int, as for loop_if_less
2520
2521         (JSC::JIT::compileFastArithSlow_op_jnless):
2522         - Generate inline code for comparing two floating point numbers.
2523         - Generate code for both cases of comparing a floating point number to a constant immediate 
2524         int.
2525         * bytecode/CodeBlock.cpp:
2526         (JSC::CodeBlock::dump): Fix dumping of op_jnless (tangentially related bugfix).
2527
2528 2009-05-07  Geoffrey Garen  <ggaren@apple.com>
2529
2530         Reviewed by Sam Weinig.
2531         
2532         Added the return address of a stub function to the JITStackFrame abstraction.
2533
2534         * jit/JIT.cpp:
2535         * jit/JIT.h:
2536         * jit/JITStubs.cpp:
2537         (JSC::):
2538         (JSC::StackHack::StackHack):
2539         (JSC::StackHack::~StackHack):
2540         (JSC::returnToThrowTrampoline):
2541         (JSC::JITStubs::cti_op_convert_this):
2542         (JSC::JITStubs::cti_op_end):
2543         (JSC::JITStubs::cti_op_add):
2544         (JSC::JITStubs::cti_op_pre_inc):
2545         (JSC::JITStubs::cti_timeout_check):
2546         (JSC::JITStubs::cti_register_file_check):
2547         (JSC::JITStubs::cti_op_loop_if_less):
2548         (JSC::JITStubs::cti_op_loop_if_lesseq):
2549         (JSC::JITStubs::cti_op_new_object):
2550         (JSC::JITStubs::cti_op_put_by_id_generic):
2551         (JSC::JITStubs::cti_op_get_by_id_generic):
2552         (JSC::JITStubs::cti_op_put_by_id):
2553         (JSC::JITStubs::cti_op_put_by_id_second):
2554         (JSC::JITStubs::cti_op_put_by_id_fail):
2555         (JSC::JITStubs::cti_op_get_by_id):
2556         (JSC::JITStubs::cti_op_get_by_id_second):
2557         (JSC::JITStubs::cti_op_get_by_id_self_fail):
2558         (JSC::JITStubs::cti_op_get_by_id_proto_list):
2559         (JSC::JITStubs::cti_op_get_by_id_proto_list_full):
2560         (JSC::JITStubs::cti_op_get_by_id_proto_fail):
2561         (JSC::JITStubs::cti_op_get_by_id_array_fail):
2562         (JSC::JITStubs::cti_op_get_by_id_string_fail):
2563         (JSC::JITStubs::cti_op_instanceof):
2564         (JSC::JITStubs::cti_op_del_by_id):
2565         (JSC::JITStubs::cti_op_mul):
2566         (JSC::JITStubs::cti_op_new_func):
2567         (JSC::JITStubs::cti_op_call_JSFunction):
2568         (JSC::JITStubs::cti_op_call_arityCheck):
2569         (JSC::JITStubs::cti_vm_dontLazyLinkCall):
2570         (JSC::JITStubs::cti_vm_lazyLinkCall):
2571         (JSC::JITStubs::cti_op_push_activation):
2572         (JSC::JITStubs::cti_op_call_NotJSFunction):
2573         (JSC::JITStubs::cti_op_create_arguments):
2574         (JSC::JITStubs::cti_op_create_arguments_no_params):
2575         (JSC::JITStubs::cti_op_tear_off_activation):
2576         (JSC::JITStubs::cti_op_tear_off_arguments):
2577         (JSC::JITStubs::cti_op_profile_will_call):
2578         (JSC::JITStubs::cti_op_profile_did_call):
2579         (JSC::JITStubs::cti_op_ret_scopeChain):
2580         (JSC::JITStubs::cti_op_new_array):
2581         (JSC::JITStubs::cti_op_resolve):
2582         (JSC::JITStubs::cti_op_construct_JSConstruct):
2583         (JSC::JITStubs::cti_op_construct_NotJSConstruct):
2584         (JSC::JITStubs::cti_op_get_by_val):
2585         (JSC::JITStubs::cti_op_get_by_val_string):
2586         (JSC::JITStubs::cti_op_get_by_val_byte_array):
2587         (JSC::JITStubs::cti_op_resolve_func):
2588         (JSC::JITStubs::cti_op_sub):
2589         (JSC::JITStubs::cti_op_put_by_val):
2590         (JSC::JITStubs::cti_op_put_by_val_array):
2591         (JSC::JITStubs::cti_op_put_by_val_byte_array):
2592         (JSC::JITStubs::cti_op_lesseq):
2593         (JSC::JITStubs::cti_op_loop_if_true):
2594         (JSC::JITStubs::cti_op_load_varargs):
2595         (JSC::JITStubs::cti_op_negate):
2596         (JSC::JITStubs::cti_op_resolve_base):
2597         (JSC::JITStubs::cti_op_resolve_skip):
2598         (JSC::JITStubs::cti_op_resolve_global):
2599         (JSC::JITStubs::cti_op_div):
2600         (JSC::JITStubs::cti_op_pre_dec):
2601         (JSC::JITStubs::cti_op_jless):
2602         (JSC::JITStubs::cti_op_not):
2603         (JSC::JITStubs::cti_op_jtrue):
2604         (JSC::JITStubs::cti_op_post_inc):
2605         (JSC::JITStubs::cti_op_eq):
2606         (JSC::JITStubs::cti_op_lshift):
2607         (JSC::JITStubs::cti_op_bitand):
2608         (JSC::JITStubs::cti_op_rshift):
2609         (JSC::JITStubs::cti_op_bitnot):
2610         (JSC::JITStubs::cti_op_resolve_with_base):
2611         (JSC::JITStubs::cti_op_new_func_exp):
2612         (JSC::JITStubs::cti_op_mod):
2613         (JSC::JITStubs::cti_op_less):
2614         (JSC::JITStubs::cti_op_neq):
2615         (JSC::JITStubs::cti_op_post_dec):
2616         (JSC::JITStubs::cti_op_urshift):
2617         (JSC::JITStubs::cti_op_bitxor):
2618         (JSC::JITStubs::cti_op_new_regexp):
2619         (JSC::JITStubs::cti_op_bitor):
2620         (JSC::JITStubs::cti_op_call_eval):
2621         (JSC::JITStubs::cti_op_throw):
2622         (JSC::JITStubs::cti_op_get_pnames):
2623         (JSC::JITStubs::cti_op_next_pname):
2624         (JSC::JITStubs::cti_op_push_scope):
2625         (JSC::JITStubs::cti_op_pop_scope):
2626         (JSC::JITStubs::cti_op_typeof):
2627         (JSC::JITStubs::cti_op_is_undefined):
2628         (JSC::JITStubs::cti_op_is_boolean):
2629         (JSC::JITStubs::cti_op_is_number):
2630         (JSC::JITStubs::cti_op_is_string):
2631         (JSC::JITStubs::cti_op_is_object):
2632         (JSC::JITStubs::cti_op_is_function):
2633         (JSC::JITStubs::cti_op_stricteq):
2634         (JSC::JITStubs::cti_op_to_primitive):
2635         (JSC::JITStubs::cti_op_strcat):
2636         (JSC::JITStubs::cti_op_nstricteq):
2637         (JSC::JITStubs::cti_op_to_jsnumber):
2638         (JSC::JITStubs::cti_op_in):
2639         (JSC::JITStubs::cti_op_push_new_scope):
2640         (JSC::JITStubs::cti_op_jmp_scopes):
2641         (JSC::JITStubs::cti_op_put_by_index):
2642         (JSC::JITStubs::cti_op_switch_imm):
2643         (JSC::JITStubs::cti_op_switch_char):
2644         (JSC::JITStubs::cti_op_switch_string):
2645         (JSC::JITStubs::cti_op_del_by_val):
2646         (JSC::JITStubs::cti_op_put_getter):
2647         (JSC::JITStubs::cti_op_put_setter):
2648         (JSC::JITStubs::cti_op_new_error):
2649         (JSC::JITStubs::cti_op_debug):
2650         (JSC::JITStubs::cti_vm_throw):
2651         * jit/JITStubs.h:
2652         (JSC::JITStackFrame::returnAddressSlot):
2653
2654 2009-05-07  Darin Adler  <darin@apple.com>
2655
2656         Reviewed by Geoff Garen.
2657
2658         * parser/Lexer.cpp:
2659         (JSC::Lexer::lex): Fix missing braces. This would make us always
2660         take the slower case for string parsing and Visual Studio correctly
2661         noticed unreachable code.
2662
2663 2009-05-07  Darin Adler  <darin@apple.com>
2664
2665         Reviewed by Sam Weinig.
2666
2667         Bug 25589: goto instead of state machine in lexer
2668         https://bugs.webkit.org/show_bug.cgi?id=25589
2669
2670         SunSpider is 0.8% faster.
2671
2672         * parser/Lexer.cpp:
2673         (JSC::Lexer::currentCharacter): Added.
2674         (JSC::Lexer::currentOffset): Changed to call currentCharacter for clarity.
2675         (JSC::Lexer::setCode): Removed code to set now-obsolete m_skipLineEnd.
2676         (JSC::Lexer::shiftLineTerminator): Added. Handles line numbers and the
2677         two-character line terminators.
2678         (JSC::Lexer::makeIdentifier): Changed to take characters and length rather
2679         than a vector, since we now make these directly out of the source buffer
2680         when possible.
2681         (JSC::Lexer::lastTokenWasRestrKeyword): Added.
2682         (JSC::isNonASCIIIdentStart): Broke out the non-inline part.
2683         (JSC::isIdentStart): Moved here.
2684         (JSC::isNonASCIIIdentPart): Broke out the non-inline part.
2685         (JSC::isIdentPart): Moved here.
2686         (JSC::singleEscape): Moved here, and removed some unneeded cases.
2687         (JSC::Lexer::record8): Moved here.
2688         (JSC::Lexer::record16): Moved here.
2689         (JSC::Lexer::lex): Rewrote this whole function to use goto and not use
2690         a state machine. Got rid of most of the local variables. Also rolled the
2691         matchPunctuator function in here.
2692         (JSC::Lexer::scanRegExp): Changed to use the new version of isLineTerminator.
2693         Clear m_buffer16 after using it instead of before.
2694
2695         * parser/Lexer.h: Removed State enum, setDone function, nextLine function,
2696         lookupKeywordFunction, one of the isLineTerminator functions, m_done data member,
2697         m_skipLineEnd data member, and m_state data member. Added shiftLineTerminator
2698         function, currentCharacter function, and changed the arguments to the makeIdentifier
2699         function. Removed one branch from the isLineTerminator function.
2700
2701         * runtime/StringPrototype.cpp:
2702         (JSC::stringProtoFuncReplace): Streamlined the case where we don't replace anything.
2703
2704 2009-05-07  Geoffrey Garen  <ggaren@apple.com>
2705
2706         Reviewed by Gavin Barraclough.
2707
2708         Removed a few more special constants, and replaced them with uses of
2709         the JITStackFrame struct.
2710
2711         Removed one of the two possible definitions of VoidPtrPair. The Mac
2712         definition was more elegant, but SunSpider doesn't think it's any
2713         faster, and it's net less elegant to have two ways of doing things.
2714
2715         * jit/JIT.cpp:
2716         (JSC::JIT::privateCompileMainPass):
2717         (JSC::JIT::privateCompile):
2718         * jit/JITStubs.h:
2719         (JSC::):
2720
2721 2009-05-07  Darin Adler  <darin@apple.com>
2722
2723         * runtime/ScopeChain.h:
2724         (JSC::ScopeChainNode::~ScopeChainNode): Tweak formatting.
2725
2726 2009-05-07  Simon Hausmann  <simon.hausmann@nokia.com>
2727
2728         Reviewed by Tor Arne Vestbø.
2729
2730         Fix the build thread stack base determination build on Symbian,
2731         by moving the code block before PLATFORM(UNIX), which is also
2732         enabled on Symbian builds.
2733
2734         * runtime/Collector.cpp:
2735         (JSC::currentThreadStackBase):
2736
2737 2009-05-07  Oliver Hunt  <oliver@apple.com>
2738
2739         Reviewed by Gavin Barraclough.
2740
2741         Fix crash due to incorrectly using an invalid scopechain 
2742
2743         stringProtoFuncReplace was checking for an exception on a CachedCall
2744         by asking for the cached callframes exception.  Unfortunately this
2745         could crash in certain circumstances as CachedCall does not guarantee
2746         a valid callframe following a call.  Even more unfortunately the check
2747         was entirely unnecessary as there is only a single exception slot per
2748         global data, so it was already checked via the initial exec->hadException()
2749         check.
2750
2751         To make bugs like this more obvious, i've added a debug only destructor
2752         to ScopeChainNode that 0's all of its fields.  This exposed a crash in
2753         the standard javascriptcore tests.
2754
2755         * runtime/ScopeChain.h:
2756         (JSC::ScopeChainNode::~ScopeChainNode):
2757         (JSC::ScopeChain::~ScopeChain):
2758         * runtime/StringPrototype.cpp:
2759         (JSC::stringProtoFuncReplace):
2760
2761 2009-05-07  Gavin Barraclough  <barraclough@apple.com>
2762
2763         Reviewed by Geoff Garen.
2764
2765         Enable op_strcat across += assignments.  This patch allows the lhs of a read/modify node
2766         to be included within the concatenation operation, and also modifies the implementation
2767         of the concatenation to attempt to reuse and cat onto the leftmost string, rather than
2768         always allocating a new empty output string to copy into (as was previously the behaviour).
2769
2770         ~0.5% progression, due to a 3%-3.5% progression on the string tests (particularly validate).
2771
2772         * parser/Nodes.cpp:
2773         (JSC::BinaryOpNode::emitStrcat):
2774         (JSC::emitReadModifyAssignment):
2775         (JSC::ReadModifyResolveNode::emitBytecode):
2776         (JSC::ReadModifyDotNode::emitBytecode):
2777         (JSC::ReadModifyBracketNode::emitBytecode):
2778         * parser/Nodes.h:
2779         * runtime/Operations.h:
2780         (JSC::concatenateStrings):
2781         * runtime/UString.cpp:
2782         (JSC::UString::reserveCapacity):
2783         * runtime/UString.h:
2784
2785 2009-05-07  Simon Hausmann  <simon.hausmann@nokia.com>
2786
2787         Reviewed by Oliver Hunt.
2788
2789         Fix the build on Windows without JIT: interpreter/RegisterFile.h needs
2790         roundUpAllocationSize, which is protected by #if ENABLED(ASSEMBLER).
2791         Moved the #ifdef down and always offer the function.
2792
2793         * jit/ExecutableAllocator.h:
2794
2795 2009-05-06  Geoffrey Garen  <ggaren@apple.com>
2796
2797         Reviewed by Gavin "++" Barraclough.
2798         
2799         Added some abstraction around the JIT stub calling convention by creating
2800         a struct to represent the persistent stack frame JIT code shares with
2801         JIT stubs.
2802         
2803         SunSpider reports no change.
2804
2805         * jit/JIT.h:
2806         * jit/JITStubs.cpp:
2807         (JSC::JITStubs::cti_op_convert_this):
2808         (JSC::JITStubs::cti_op_end):
2809         (JSC::JITStubs::cti_op_add):
2810         (JSC::JITStubs::cti_op_pre_inc):
2811         (JSC::JITStubs::cti_timeout_check):
2812         (JSC::JITStubs::cti_register_file_check):
2813         (JSC::JITStubs::cti_op_loop_if_less):
2814         (JSC::JITStubs::cti_op_loop_if_lesseq):
2815         (JSC::JITStubs::cti_op_new_object):
2816         (JSC::JITStubs::cti_op_put_by_id_generic):
2817         (JSC::JITStubs::cti_op_get_by_id_generic):
2818         (JSC::JITStubs::cti_op_put_by_id):
2819         (JSC::JITStubs::cti_op_put_by_id_second):
2820         (JSC::JITStubs::cti_op_put_by_id_fail):
2821         (JSC::JITStubs::cti_op_get_by_id):
2822         (JSC::JITStubs::cti_op_get_by_id_second):
2823         (JSC::JITStubs::cti_op_get_by_id_self_fail):
2824         (JSC::JITStubs::cti_op_get_by_id_proto_list):
2825         (JSC::JITStubs::cti_op_get_by_id_proto_list_full):
2826         (JSC::JITStubs::cti_op_get_by_id_proto_fail):
2827         (JSC::JITStubs::cti_op_get_by_id_array_fail):
2828         (JSC::JITStubs::cti_op_get_by_id_string_fail):
2829         (JSC::JITStubs::cti_op_instanceof):
2830         (JSC::JITStubs::cti_op_del_by_id):
2831         (JSC::JITStubs::cti_op_mul):
2832         (JSC::JITStubs::cti_op_new_func):
2833         (JSC::JITStubs::cti_op_call_JSFunction):
2834         (JSC::JITStubs::cti_op_call_arityCheck):
2835         (JSC::JITStubs::cti_vm_dontLazyLinkCall):
2836         (JSC::JITStubs::cti_vm_lazyLinkCall):
2837         (JSC::JITStubs::cti_op_push_activation):
2838         (JSC::JITStubs::cti_op_call_NotJSFunction):
2839         (JSC::JITStubs::cti_op_create_arguments):
2840         (JSC::JITStubs::cti_op_create_arguments_no_params):
2841         (JSC::JITStubs::cti_op_tear_off_activation):
2842         (JSC::JITStubs::cti_op_tear_off_arguments):
2843         (JSC::JITStubs::cti_op_profile_will_call):
2844         (JSC::JITStubs::cti_op_profile_did_call):
2845         (JSC::JITStubs::cti_op_ret_scopeChain):
2846         (JSC::JITStubs::cti_op_new_array):
2847         (JSC::JITStubs::cti_op_resolve):
2848         (JSC::JITStubs::cti_op_construct_JSConstruct):
2849         (JSC::JITStubs::cti_op_construct_NotJSConstruct):
2850         (JSC::JITStubs::cti_op_get_by_val):
2851         (JSC::JITStubs::cti_op_get_by_val_string):
2852         (JSC::JITStubs::cti_op_get_by_val_byte_array):
2853         (JSC::JITStubs::cti_op_resolve_func):
2854         (JSC::JITStubs::cti_op_sub):
2855         (JSC::JITStubs::cti_op_put_by_val):
2856         (JSC::JITStubs::cti_op_put_by_val_array):
2857         (JSC::JITStubs::cti_op_put_by_val_byte_array):
2858         (JSC::JITStubs::cti_op_lesseq):
2859         (JSC::JITStubs::cti_op_loop_if_true):
2860         (JSC::JITStubs::cti_op_load_varargs):
2861         (JSC::JITStubs::cti_op_negate):
2862         (JSC::JITStubs::cti_op_resolve_base):
2863         (JSC::JITStubs::cti_op_resolve_skip):
2864         (JSC::JITStubs::cti_op_resolve_global):
2865         (JSC::JITStubs::cti_op_div):
2866         (JSC::JITStubs::cti_op_pre_dec):
2867         (JSC::JITStubs::cti_op_jless):
2868         (JSC::JITStubs::cti_op_not):
2869         (JSC::JITStubs::cti_op_jtrue):
2870         (JSC::JITStubs::cti_op_post_inc):
2871         (JSC::JITStubs::cti_op_eq):
2872         (JSC::JITStubs::cti_op_lshift):
2873         (JSC::JITStubs::cti_op_bitand):
2874         (JSC::JITStubs::cti_op_rshift):
2875         (JSC::JITStubs::cti_op_bitnot):
2876         (JSC::JITStubs::cti_op_resolve_with_base):
2877         (JSC::JITStubs::cti_op_new_func_exp):
2878         (JSC::JITStubs::cti_op_mod):
2879         (JSC::JITStubs::cti_op_less):
2880         (JSC::JITStubs::cti_op_neq):
2881         (JSC::JITStubs::cti_op_post_dec):
2882         (JSC::JITStubs::cti_op_urshift):
2883         (JSC::JITStubs::cti_op_bitxor):
2884         (JSC::JITStubs::cti_op_new_regexp):
2885         (JSC::JITStubs::cti_op_bitor):
2886         (JSC::JITStubs::cti_op_call_eval):
2887         (JSC::JITStubs::cti_op_throw):
2888         (JSC::JITStubs::cti_op_get_pnames):
2889         (JSC::JITStubs::cti_op_next_pname):
2890         (JSC::JITStubs::cti_op_push_scope):
2891         (JSC::JITStubs::cti_op_pop_scope):
2892         (JSC::JITStubs::cti_op_typeof):
2893         (JSC::JITStubs::cti_op_is_undefined):
2894         (JSC::JITStubs::cti_op_is_boolean):
2895         (JSC::JITStubs::cti_op_is_number):
2896         (JSC::JITStubs::cti_op_is_string):
2897         (JSC::JITStubs::cti_op_is_object):
2898         (JSC::JITStubs::cti_op_is_function):
2899         (JSC::JITStubs::cti_op_stricteq):
2900         (JSC::JITStubs::cti_op_to_primitive):
2901         (JSC::JITStubs::cti_op_strcat):
2902         (JSC::JITStubs::cti_op_nstricteq):
2903         (JSC::JITStubs::cti_op_to_jsnumber):
2904         (JSC::JITStubs::cti_op_in):
2905         (JSC::JITStubs::cti_op_push_new_scope):
2906         (JSC::JITStubs::cti_op_jmp_scopes):
2907         (JSC::JITStubs::cti_op_put_by_index):
2908         (JSC::JITStubs::cti_op_switch_imm):
2909         (JSC::JITStubs::cti_op_switch_char):
2910         (JSC::JITStubs::cti_op_switch_string):
2911         (JSC::JITStubs::cti_op_del_by_val):
2912         (JSC::JITStubs::cti_op_put_getter):
2913         (JSC::JITStubs::cti_op_put_setter):
2914         (JSC::JITStubs::cti_op_new_error):
2915         (JSC::JITStubs::cti_op_debug):
2916         (JSC::JITStubs::cti_vm_throw):
2917         * jit/JITStubs.h:
2918         (JSC::):
2919
2920 2009-05-06  Gavin Barraclough  <barraclough@apple.com>
2921
2922         Reviewed by Maciej Stachowiak & Darin Adler.
2923
2924         Improve string concatenation (as coded in JS as a sequence of adds).
2925
2926         Detect patterns corresponding to string concatenation, and change the bytecode
2927         generation to emit a new op_strcat instruction.  By handling the full set of
2928         additions within a single function we do not need allocate JSString wrappers
2929         for intermediate results, and we can calculate the size of the output string
2930         prior to allocating storage, in order to prevent reallocation of the buffer.
2931
2932         1.5%-2% progression on Sunspider, largely due to a 30% progression on date-format-xparb.
2933
2934         * bytecode/CodeBlock.cpp:
2935         (JSC::CodeBlock::dump):
2936             Add new opcodes.
2937         * bytecode/Opcode.h:
2938             Add new opcodes.
2939         * bytecompiler/BytecodeGenerator.cpp:
2940         (JSC::BytecodeGenerator::emitStrcat):
2941         (JSC::BytecodeGenerator::emitToPrimitive):
2942             Add generation of new opcodes.
2943         * bytecompiler/BytecodeGenerator.h:
2944             Add generation of new opcodes.
2945         * interpreter/Interpreter.cpp:
2946         (JSC::Interpreter::privateExecute):
2947             Add implmentation of new opcodes.
2948         * jit/JIT.cpp:
2949         (JSC::JIT::privateCompileMainPass):
2950         (JSC::JIT::privateCompileSlowCases):
2951             Add implmentation of new opcodes.
2952         * jit/JITStubs.cpp:
2953         (JSC::JITStubs::cti_op_to_primitive):
2954         (JSC::JITStubs::cti_op_strcat):
2955             Add implmentation of new opcodes.
2956         * jit/JITStubs.h:
2957             Add implmentation of new opcodes.
2958         * parser/Nodes.cpp:
2959         (JSC::BinaryOpNode::emitStrcat):
2960         (JSC::BinaryOpNode::emitBytecode):
2961         (JSC::ReadModifyResolveNode::emitBytecode):
2962             Add generation of new opcodes.
2963         * parser/Nodes.h:
2964         (JSC::ExpressionNode::):
2965         (JSC::AddNode::):
2966             Add methods to allow identification of add nodes.
2967         * parser/ResultType.h:
2968         (JSC::ResultType::definitelyIsString):
2969         (JSC::ResultType::forAdd):
2970             Fix error in detection of adds that will produce string results.
2971         * runtime/Operations.h:
2972         (JSC::concatenateStrings):
2973             Add implmentation of new opcodes.
2974         * runtime/UString.cpp:
2975         (JSC::UString::appendNumeric):
2976             Add methods to append numbers to an existing string.
2977         * runtime/UString.h:
2978         (JSC::UString::Rep::createEmptyBuffer):
2979         (JSC::UString::BaseString::BaseString):
2980             Add support for creating an empty string with a non-zero capacity available in the BaseString.
2981
2982 2009-05-06  Darin Adler  <darin@apple.com>
2983
2984         Reviewed by Sam Weinig.
2985
2986         Made RefCounted::m_refCount private.
2987
2988         * runtime/Structure.h: Removed addressOfCount.
2989         * wtf/RefCounted.h: Made m_refCount private.
2990         Added addressOfCount.
2991
2992 2009-05-06  Darin Adler  <darin@apple.com>
2993
2994         Fixed assertion seen a lot!
2995
2996         * parser/Nodes.cpp:
2997         (JSC::FunctionBodyNode::~FunctionBodyNode): Removed now-bogus assertion.
2998
2999 2009-05-06  Darin Adler  <darin@apple.com>
3000
3001         Working with Sam Weinig.
3002
3003         Redo parse tree constructor optimization without breaking the Windows
3004         build the way I did yesterday. The previous try broke the build by adding
3005         an include of Lexer.h and all its dependencies that had to work outside
3006         the JavaScriptCore project.
3007
3008         * GNUmakefile.am: Added NodeConstructors.h.
3009         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
3010
3011         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
3012         Removed byteocde directory -- we no longer are trying to include Lexer.h
3013         outside JavaScriptCore.
3014
3015         * JavaScriptCore.xcodeproj/project.pbxproj: Change SegmentedVector.h
3016         and Lexer.h back to internal files. Added NodeConstructors.h.
3017
3018         * parser/Grammar.y: Added include of NodeConstructors.h.
3019         Changed use of ConstDeclNode to use public functions.
3020
3021         * parser/NodeConstructors.h: Copied from parser/Nodes.h.
3022         Just contains the inlined constructors now.
3023
3024         * parser/Nodes.cpp: Added include of NodeConstructors.h.
3025         Moved node constructors into the header.
3026         (JSC::FunctionBodyNode::FunctionBodyNode): Removed m_refCount
3027         initialization.
3028
3029         * parser/Nodes.h: Removed all the constructor definitions, and also
3030         removed the JSC_FAST_CALL from them since these are all inlined, so the
3031         calling convention is irrelevant. Made more things private. Used a data
3032         member for operator opcodes instead of a virtual function. Removed the
3033         special FunctionBodyNode::ref/deref functions since the default functions
3034         are now just as fast.
3035
3036         * runtime/FunctionConstructor.cpp:
3037         (JSC::extractFunctionBody): Fixed types here so we don't typecast until
3038         after we do type checking.
3039
3040 2009-05-06  Simon Hausmann  <simon.hausmann@nokia.com>
3041
3042         Reviewed by Ariya Hidayat.
3043
3044         Fix the Qt build on Windows.
3045
3046         * JavaScriptCore.pri: Define BUILDING_JavaScriptCore/WTF to get the meaning
3047         of the JS_EXPORTDATA macros correct
3048
3049 2009-05-06  Simon Hausmann  <simon.hausmann@nokia.com>
3050
3051         Reviewed by Ariya Hidayat.
3052
3053         Enable the JIT for the Qt build on Windows.
3054
3055         * JavaScriptCore.pri:
3056
3057 2009-05-06  Simon Hausmann  <simon.hausmann@nokia.com>
3058
3059         Reviewed by Tor Arne Vestbø.
3060
3061         Tweak JavaScriptCore.pri for being able to override the generated sources dir for the
3062         generated_files target.
3063
3064         * JavaScriptCore.pri:
3065
3066 2009-05-06  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
3067
3068         Reviewed by Simon Hausmann.
3069
3070         Build QtWebKit as a framework on Mac
3071
3072         This implies both debug and release build by default, unless
3073         one of the --debug or --release config options are passed to
3074         the build-webkit script.
3075
3076         Frameworks can be disabled by passing CONFIG+=webkit_no_framework
3077         to the build-webkit script.
3078
3079         To be able to build both debug and release targets in parallel
3080         we have to use separate output directories for the generated
3081         sources, which is not optimal, but required to avoid race conditions.
3082
3083         An optimization would be to only require this spit-up on Mac.
3084
3085         * JavaScriptCore.pri:
3086         * JavaScriptCore.pro:
3087         * jsc.pro:
3088
3089 2009-05-06  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
3090
3091         Reviewed by Simon Hausmann.
3092
3093         [Qt] Use $$GENERATED_SOURCES_DIR as output when running bison
3094
3095         A couple of the generators left the bison output file in the source
3096         tree, and then moved it into $$GENERATED_SOURCES_DIR, which did not
3097         work well when building release and debug configurations in parallel.
3098
3099         * JavaScriptCore.pri:
3100
3101 2009-05-05  Geoffrey Garen  <ggaren@apple.com>
3102
3103         Reviewed by Maciej Stachowiak.
3104         
3105         Simplified a bit of codegen.
3106
3107         * jit/JIT.cpp:
3108         (JSC::JIT::privateCompileMainPass):
3109
3110 2009-05-05  Geoffrey Garen  <ggaren@apple.com>
3111
3112         Reviewed by Cameron Zwarich.
3113         
3114         Moved all the JIT stub related code into one place.
3115
3116         * jit/JIT.cpp:
3117         * jit/JIT.h:
3118         * jit/JITCode.h:
3119         * jit/JITStubs.cpp:
3120         (JSC::):
3121         * jit/JITStubs.h:
3122
3123 2009-05-05  Sam Weinig  <sam@webkit.org>
3124
3125         Try to fix Windows build.
3126
3127         Move Node constructor to the .cpp file.
3128
3129         * parser/Nodes.cpp: 
3130         * parser/Nodes.h:
3131
3132 2009-05-05  Darin Adler  <darin@apple.com>
3133
3134         Try to fix Windows build.
3135
3136         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
3137         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
3138
3139         Try to fix Mac build.
3140
3141         * JavaScriptCore.xcodeproj/project.pbxproj: Made SegmentedVector.h private.
3142
3143 2009-05-05  Darin Adler  <darin@apple.com>
3144
3145         Try to fix Mac build.
3146
3147         * JavaScriptCore.xcodeproj/project.pbxproj: Made Lexer.h private.
3148
3149 2009-05-05  Darin Adler  <darin@apple.com>
3150
3151         Reviewed by Sam Weinig.
3152
3153         Bug 25569: make ParserRefCounted use conventional reference counting
3154         https://bugs.webkit.org/show_bug.cgi?id=25569
3155
3156         SunSpider speedup of about 1.6%.
3157
3158         * JavaScriptCore.exp: Updated.
3159
3160         * parser/Nodes.cpp:
3161         (JSC::NodeReleaser::releaseAllNodes): ALWAYS_INLINE.
3162         (JSC::NodeReleaser::adopt): Ditto.
3163         (JSC::ParserRefCounted::ParserRefCounted): Removed most of the code.
3164         Add the object to a Vector<RefPtr> that gets cleared after parsing.
3165         (JSC::ParserRefCounted::~ParserRefCounted): Removed most of the code.
3166
3167         * parser/Nodes.h: Made ParserRefCounted inherit from RefCounted and
3168         made inline versions of the constructor and destructor. Made the
3169         Node constructor inline.
3170
3171         * parser/Parser.cpp:
3172         (JSC::Parser::parse): Call globalData->parserObjects.shrink(0) after
3173         parsing, where it used to call ParserRefCounted::deleteNewObjects.
3174
3175         * runtime/JSGlobalData.cpp:
3176         (JSC::JSGlobalData::JSGlobalData): Eliminated code to manage the
3177         newParserObjects and parserObjectExtraRefCounts.
3178         (JSC::JSGlobalData::~JSGlobalData): Ditto.
3179
3180         * runtime/JSGlobalData.h: Replaced the HashSet and HashCountedSet
3181         with a Vector.
3182
3183         * wtf/PassRefPtr.h:
3184         (WTF::PassRefPtr::~PassRefPtr): The most common thing to do with a
3185         PassRefPtr in hot code is to pass it and then destroy it once it's
3186         set to zero. Help the optimizer by telling it that's true.
3187
3188 2009-05-05  Xan Lopez  <xlopez@igalia.com> and Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
3189
3190         Reviewed by Oliver Hunt.
3191
3192         Disable the NativeFunctionWrapper for all non-Mac ports for now,
3193         as it is also crashing on Linux/x86.
3194
3195         * runtime/NativeFunctionWrapper.h:
3196
3197 2009-05-05  Steve Falkenburg  <sfalken@apple.com>
3198
3199         Fix build.
3200
3201         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
3202         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
3203
3204 2009-05-05  Oliver Hunt  <oliver@apple.com>
3205
3206         Reviewed by Maciej Stachowiak.
3207
3208         Expose toThisObject for the DOM Window
3209
3210         * JavaScriptCore.exp:
3211
3212 2009-05-05  Oliver Hunt  <oliver@apple.com>
3213
3214         Reviewed by NOBODY (Make windows go again until i work out the
3215         accursed calling convention).
3216
3217         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3218         * jit/JIT.cpp:
3219         * runtime/NativeFunctionWrapper.h:
3220
3221 2009-05-05  Oliver Hunt  <oliver@apple.com>
3222
3223         Reviewed by NOBODY (Fix windows debug builds).
3224
3225         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
3226
3227 2009-05-05  Oliver Hunt  <oliver@apple.com>
3228
3229         Reviewed by NOBODY (Hopefully the last fix).
3230
3231         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
3232
3233 2009-05-05  Oliver Hunt  <oliver@apple.com>
3234
3235         Reviewed by NOBODY (Fix the build fix caused by a different build fix).
3236
3237         * parser/Nodes.cpp:
3238         * parser/Nodes.h:
3239
3240 2009-05-05  Oliver Hunt  <oliver@apple.com>
3241
3242         Reviewed by NOBODY (No idea how my changes could have broken these).
3243
3244         * runtime/DatePrototype.cpp:
3245         * runtime/RegExpObject.cpp:
3246
3247 2009-05-05  Oliver Hunt  <oliver@apple.com>
3248
3249         Reviewed by NOBODY (Why should i expect msvc to list all the errors in a file?).
3250
3251         * parser/Nodes.cpp:
3252
3253 2009-05-05  Oliver Hunt  <oliver@apple.com>
3254
3255         Reviewed by NOBODY (Fix warning, and another missing include).
3256
3257         * jit/JIT.cpp:
3258         * parser/Nodes.h:
3259
3260 2009-05-05  Oliver Hunt  <oliver@apple.com>
3261
3262         Reviewed by NOBODY (More build fixes).
3263
3264         * runtime/ErrorPrototype.cpp:
3265         * runtime/JSGlobalObject.cpp:
3266         * runtime/NumberPrototype.cpp:
3267         * runtime/ObjectPrototype.cpp:
3268         * runtime/StringConstructor.cpp:
3269
3270 2009-05-05  Oliver Hunt  <oliver@apple.com>
3271
3272         Reviewed by NOBODY (Will the fixes never end?).
3273
3274         * runtime/FunctionPrototype.h:
3275         * runtime/Lookup.cpp:
3276
3277 2009-05-05  Oliver Hunt  <oliver@apple.com>
3278
3279         Reviewed by NOBODY (More build fixes).
3280
3281         * jit/JIT.cpp:
3282
3283 2009-05-05  Oliver Hunt  <oliver@apple.com>
3284
3285         Reviewed by NOBODY (More build fixing).
3286
3287         * runtime/CallData.h:
3288
3289 2009-05-05  Oliver Hunt  <oliver@apple.com>
3290
3291         Reviewed by NOBODY (Build fix).
3292
3293         * runtime/ArrayConstructor.cpp:
3294         * runtime/BooleanPrototype.cpp:
3295         * runtime/DateConstructor.cpp:
3296         * runtime/Error.cpp:
3297         * runtime/ObjectConstructor.cpp:
3298         * runtime/RegExpPrototype.cpp:
3299
3300 2009-05-05  Oliver Hunt  <oliver@apple.com>
3301
3302         Reviewed by NOBODY (Buildfix).
3303
3304         Add missing file
3305
3306         * runtime/NativeFunctionWrapper.h: Copied from JavaScriptCore/jit/ExecutableAllocator.cpp.
3307
3308 2009-05-05  Oliver Hunt  <oliver@apple.com>
3309
3310         Reviewed by Gavin Barraclough.
3311
3312         Bug 25559: Improve native function call performance
3313         <https://bugs.webkit.org/show_bug.cgi?id=25559>
3314
3315         In order to cache calls to native functions we now make the standard
3316         prototype functions use a small assembly thunk that converts the JS
3317         calling convention into the native calling convention.  As this is
3318         only beneficial in the JIT we use the NativeFunctionWrapper typedef
3319         to alternate between PrototypeFunction and JSFunction to keep the
3320         code sane.  This change from PrototypeFunction to NativeFunctionWrapper
3321         is the bulk of this patch.
3322
3323         * JavaScriptCore.exp:
3324         * JavaScriptCore.xcodeproj/project.pbxproj:
3325         * assembler/MacroAssemblerX86Common.h:
3326         (JSC::MacroAssemblerX86Common::call):
3327         * assembler/MacroAssemblerX86_64.h:
3328         (JSC::MacroAssemblerX86_64::addPtr):
3329         * assembler/X86Assembler.h:
3330         (JSC::X86Assembler::leaq_mr):
3331         (JSC::X86Assembler::call_m):
3332         * interpreter/Interpreter.cpp:
3333         (JSC::Interpreter::execute):
3334         (JSC::Interpreter::prepareForRepeatCall):
3335         * jit/JIT.cpp:
3336         (JSC::JIT::privateCompileCTIMachineTrampolines):
3337         * jit/JIT.h:
3338         (JSC::JIT::compileCTIMachineTrampolines):
3339         * jit/JITCall.cpp:
3340         (JSC::JIT::linkCall):
3341         (JSC::JIT::compileOpCallInitializeCallFrame):
3342         (JSC::JIT::compileOpCall):
3343         * jit/JITCode.h:
3344         (JSC::JITCode::operator bool):
3345         * jit/JITInlineMethods.h:
3346         (JSC::JIT::emitGetFromCallFrameHeader):
3347         (JSC::JIT::emitGetFromCallFrameHeader32):
3348         * jit/JITStubs.cpp:
3349         (JSC::JITStubs::JITStubs):
3350         (JSC::JITStubs::cti_op_call_JSFunction):
3351         (JSC::JITStubs::cti_vm_dontLazyLinkCall):
3352         (JSC::JITStubs::cti_vm_lazyLinkCall):
3353         (JSC::JITStubs::cti_op_construct_JSConstruct):
3354         * jit/JITStubs.h:
3355         (JSC::JITStubs::ctiNativeCallThunk):
3356         * jsc.cpp:
3357         (GlobalObject::GlobalObject):
3358         * parser/Nodes.cpp:
3359         (JSC::FunctionBodyNode::FunctionBodyNode):
3360         (JSC::FunctionBodyNode::createNativeThunk):
3361         (JSC::FunctionBodyNode::generateJITCode):
3362         * parser/Nodes.h:
3363         (JSC::FunctionBodyNode::):
3364         (JSC::FunctionBodyNode::generatedJITCode):
3365         (JSC::FunctionBodyNode::jitCode):
3366         * profiler/Profiler.cpp:
3367         (JSC::Profiler::createCallIdentifier):
3368         * runtime/ArgList.h:
3369         * runtime/ArrayPrototype.cpp:
3370         (JSC::isNumericCompareFunction):
3371         * runtime/BooleanPrototype.cpp:
3372         (JSC::BooleanPrototype::BooleanPrototype):
3373         * runtime/DateConstructor.cpp:
3374         (JSC::DateConstructor::DateConstructor):
3375         * runtime/ErrorPrototype.cpp:
3376         (JSC::ErrorPrototype::ErrorPrototype):
3377         * runtime/FunctionPrototype.cpp:
3378         (JSC::FunctionPrototype::addFunctionProperties):
3379         (JSC::functionProtoFuncToString):
3380         * runtime/FunctionPrototype.h:
3381         * runtime/JSFunction.cpp:
3382         (JSC::JSFunction::JSFunction):
3383         (JSC::JSFunction::~JSFunction):
3384         (JSC::JSFunction::mark):
3385         (JSC::JSFunction::getCallData):
3386         (JSC::JSFunction::call):
3387         (JSC::JSFunction::argumentsGetter):
3388         (JSC::JSFunction::callerGetter):
3389         (JSC::JSFunction::lengthGetter):
3390         (JSC::JSFunction::getOwnPropertySlot):
3391         (JSC::JSFunction::put):
3392         (JSC::JSFunction::deleteProperty):
3393         (JSC::JSFunction::getConstructData):
3394         (JSC::JSFunction::construct):
3395         * runtime/JSFunction.h:
3396         (JSC::JSFunction::JSFunction):
3397         (JSC::JSFunction::setScope):
3398         (JSC::JSFunction::scope):
3399         (JSC::JSFunction::isHostFunction):
3400         (JSC::JSFunction::scopeChain):
3401         (JSC::JSFunction::clearScopeChain):
3402         (JSC::JSFunction::setScopeChain):
3403         (JSC::JSFunction::nativeFunction):
3404         (JSC::JSFunction::setNativeFunction):
3405         * runtime/JSGlobalData.cpp:
3406         (JSC::JSGlobalData::~JSGlobalData):
3407         (JSC::JSGlobalData::createNativeThunk):
3408         * runtime/JSGlobalData.h:
3409         (JSC::JSGlobalData::nativeFunctionThunk):
3410         * runtime/JSGlobalObject.cpp:
3411         (JSC::JSGlobalObject::reset):
3412         * runtime/JSGlobalObject.h:
3413         * runtime/Lookup.cpp:
3414         (JSC::setUpStaticFunctionSlot):
3415         * runtime/Lookup.h:
3416         * runtime/NumberPrototype.cpp:
3417         (JSC::NumberPrototype::NumberPrototype):
3418         * runtime/ObjectPrototype.cpp:
3419         (JSC::ObjectPrototype::ObjectPrototype):
3420         * runtime/RegExpPrototype.cpp:
3421         (JSC::RegExpPrototype::RegExpPrototype):
3422         * runtime/StringConstructor.cpp:
3423         (JSC::StringConstructor::StringConstructor):
3424
3425 2009-05-05  Gavin Barraclough  <barraclough@apple.com>
3426
3427         Reviewed by Oliver Hunt.
3428
3429         For convenience, let the sampling flags tool clear multiple flags at once.
3430
3431         * jsc.cpp:
3432         (GlobalObject::GlobalObject):
3433         (functionSetSamplingFlags):
3434         (functionClearSamplingFlags):
3435
3436 2009-05-04  Maciej Stachowiak  <mjs@apple.com>
3437
3438         Rubber stamped by Gavin.
3439
3440         - inline Vector::resize for a ~1.5% speedup on string-tagcloud
3441
3442         * wtf/Vector.h:
3443         (WTF::Vector::resize): Inline
3444
3445 2009-05-03  Steve Falkenburg  <sfalken@apple.com>
3446
3447         Windows build fix.
3448
3449         * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
3450
3451 2009-05-03  Mark Rowe  <mrowe@apple.com>
3452
3453         Fix the 64-bit build.
3454
3455         * API/APICast.h:
3456         (toJS):
3457         (toRef):
3458         * runtime/JSNumberCell.cpp:
3459         (JSC::jsAPIMangledNumber):
3460         * runtime/JSNumberCell.h:
3461
3462 2009-05-02  Sam Weinig  <sam@webkit.org>
3463
3464         Roll JSC API number marshaling back in one last time (I hope).
3465
3466 2009-05-03  Sam Weinig  <sam@webkit.org>
3467
3468         Roll JSC API number marshaling back out. It still breaks windows.
3469
3470 2009-05-03  Sam Weinig  <sam@webkit.org>
3471
3472         Roll JSC API number marshaling back in.
3473
3474 2009-05-02  Darin Adler  <darin@apple.com>
3475
3476         Reviewed by Maciej Stachowiak.
3477
3478         Bug 25519: streamline lexer by handling BOMs differently
3479         https://bugs.webkit.org/show_bug.cgi?id=25519
3480
3481         Roughly 1% faster SunSpider.
3482
3483         * parser/Grammar.y: Tweak formatting a bit.
3484
3485         * parser/Lexer.cpp:
3486         (JSC::Lexer::Lexer): Remove unnnecessary initialization of data members
3487         that are set up by setCode.
3488         (JSC::Lexer::currentOffset): Added. Used where the old code would look at
3489         m_currentOffset.
3490         (JSC::Lexer::shift1): Replaces the old shift function. No longer does anything
3491         to handle BOM characters.
3492         (JSC::Lexer::shift2): Ditto.
3493         (JSC::Lexer::shift3): Ditto.
3494         (JSC::Lexer::shift4): Ditto.
3495         (JSC::Lexer::setCode): Updated for name change from yylineno to m_line.
3496         Removed now-unused m_eatNextIdentifier, m_stackToken, and m_restrKeyword.
3497         Replaced m_skipLF and m_skipCR with m_skipLineEnd. Replaced the old
3498         m_length with m_codeEnd and m_currentOffset with m_codeStart. Added code
3499         to scan for a BOM character and call copyCodeWithoutBOMs() if we find any.
3500         (JSC::Lexer::copyCodeWithoutBOMs): Added.
3501         (JSC::Lexer::nextLine): Updated for name change from yylineno to m_line.
3502         (JSC::Lexer::makeIdentifier): Moved up higher in the file.
3503         (JSC::Lexer::matchPunctuator): Moved up higher in the file and changed to
3504         use a switch statement instead of just if statements.
3505         (JSC::Lexer::isLineTerminator): Moved up higher in the file and changed to
3506         have fewer branches.
3507         (JSC::Lexer::lastTokenWasRestrKeyword): Added. This replaces the old
3508         m_restrKeyword boolean.
3509         (JSC::Lexer::isIdentStart): Moved up higher in the file. Changed to use
3510         fewer branches in the ASCII but not identifier case.
3511         (JSC::Lexer::isIdentPart): Ditto.
3512         (JSC::Lexer::singleEscape): Moved up higher in the file.
3513         (JSC::Lexer::convertOctal): Moved up higher in the file.
3514         (JSC::Lexer::convertHex): Moved up higher in the file. Changed to use
3515         toASCIIHexValue instead of rolling our own here.
3516         (JSC::Lexer::convertUnicode): Ditto.