JavaScriptCore:
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2009-03-02  Sam Weinig  <sam@webkit.org>
2
3         Reviewed by Mark Rowe.
4
5         Enable Geolocation (except on Tiger and Leopard).
6
7         * Configurations/JavaScriptCore.xcconfig:
8
9 2009-03-01  David Kilzer  <ddkilzer@apple.com>
10
11         <rdar://problem/6635688> Move HAVE_DTRACE check to Base.xcconfig
12
13         Reviewed by Mark Rowe.
14
15         * Configurations/Base.xcconfig: Set HAVE_DTRACE Xcode variable
16         based on PLATFORM_NAME and MAC_OS_X_VERSION_MAJOR.  Also define
17         it as a preprocessor macro by modifying
18         GCC_PREPROCESSOR_DEFINITIONS.
19         * JavaScriptCore.xcodeproj/project.pbxproj: Changed "Generate
20         DTrace header" script phase to check for HAVE_DTRACE instead of
21         MACOSX_DEPLOYMENT_TARGET.
22         * wtf/Platform.h: Removed definition of HAVE_DTRACE macro since
23         it's defined in Base.xcconfig now.
24
25 2009-03-01  Horia Olaru  <olaru@adobe.com>
26
27         By looking in grammar.y there are only a few types of statement nodes
28         on which the debugger should stop. 
29
30         Removed isBlock and isLoop virtual calls. No need to emit debug hooks in
31         the "statementListEmitCode" method as long as the necessary hooks can be
32         added in each "emitCode".
33
34         https://bugs.webkit.org/show_bug.cgi?id=21073
35
36         Reviewed by Kevin McCullough.
37
38         * parser/Nodes.cpp:
39         (JSC::ConstStatementNode::emitBytecode):
40         (JSC::statementListEmitCode):
41         (JSC::EmptyStatementNode::emitBytecode):
42         (JSC::ExprStatementNode::emitBytecode):
43         (JSC::VarStatementNode::emitBytecode):
44         (JSC::IfNode::emitBytecode):
45         (JSC::IfElseNode::emitBytecode):
46         (JSC::DoWhileNode::emitBytecode):
47         (JSC::WhileNode::emitBytecode):
48         (JSC::ForNode::emitBytecode):
49         (JSC::ForInNode::emitBytecode):
50         (JSC::ContinueNode::emitBytecode):
51         (JSC::BreakNode::emitBytecode):
52         (JSC::ReturnNode::emitBytecode):
53         (JSC::WithNode::emitBytecode):
54         (JSC::SwitchNode::emitBytecode):
55         (JSC::LabelNode::emitBytecode):
56         (JSC::ThrowNode::emitBytecode):
57         (JSC::TryNode::emitBytecode):
58         * parser/Nodes.h:
59
60 2009-02-26  Gavin Barraclough  <barraclough@apple.com>
61
62         Reviewed by Geoff Garen.
63
64         Fix bug #23614.  Switches on double precision values were incorrectly
65         truncating the scrutinee value.  E.g.:
66
67             switch (1.1) { case 1: print("FAIL"); }
68
69         Was resulting in FAIL.
70
71         * interpreter/Interpreter.cpp:
72         (JSC::Interpreter::privateExecute):
73         * jit/JITStubs.cpp:
74         (JSC::JITStubs::cti_op_switch_imm):
75
76 2009-02-26  Gavin Barraclough  <barraclough@apple.com>
77
78         Reviewed by Oliver Hunt.
79
80         Integer Immediate representation need not be canonical in x86 JIT code.
81         On x86-64 we already have loosened the requirement that the int immediate
82         representation in canonical, we should bring x86 into line.
83
84         This patch is a minor (~0.5%) improvement on sunspider & v8-tests, and
85         should reduce memory footoprint (reduces JIT code size).
86
87         * jit/JIT.cpp:
88         (JSC::JIT::compileOpStrictEq):
89         (JSC::JIT::privateCompileSlowCases):
90         * jit/JIT.h:
91         (JSC::JIT::emitJumpIfImmediateNumber):
92         (JSC::JIT::emitJumpIfNotImmediateNumber):
93         * jit/JITArithmetic.cpp:
94         (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate):
95         (JSC::JIT::compileBinaryArithOp):
96
97 2009-02-26  Carol Szabo  <carol.szabo@nokia.com>
98
99         Reviewed by Darin Adler.
100
101         https://bugs.webkit.org/show_bug.cgi?id=24099
102         ARM Compiler Warnings in pcre_exec.cpp
103
104         * pcre/pcre_exec.cpp:
105         (match):
106
107 2009-02-25  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
108
109         Reviewed by Gavin Barraclough.
110
111         Bug 24086: Regression (r40993): WebKit crashes after logging in to lists.zenbe
112         <https://bugs.webkit.org/show_bug.cgi?id=24086>
113         <rdar://problem/6625111>
114
115         The numeric sort optimization in r40993 generated bytecode for a function
116         without generating JIT code. This breaks an assumption in some parts of
117         the JIT's function calling logic that the presence of a CodeBlock implies
118         the existence of JIT code.
119
120         In order to fix this, we simply generate JIT code whenever we check whether
121         a function is a numeric sort function. This only incurs an additional cost
122         in the case when the function is a numeric sort function, in which case it
123         is not expensive to generate JIT code for it.
124
125         * runtime/ArrayPrototype.cpp:
126         (JSC::isNumericCompareFunction):
127
128 2009-02-25  Geoffrey Garen  <ggaren@apple.com>
129
130         Reviewed by Maciej Stachowiak.
131         
132         Fixed <rdar://problem/6611174> REGRESSION (r36701): Unable to select
133         messages on hotmail (24052)
134         
135         The bug was that for-in enumeration used a cached prototype chain without
136         validating that it was up-to-date.
137         
138         This led me to refactor prototype chain caching so it was easier to work
139         with and harder to get wrong.
140         
141         After a bit of inlining, this patch is performance-neutral on SunSpider
142         and the v8 benchmarks.
143
144         * interpreter/Interpreter.cpp:
145         (JSC::Interpreter::tryCachePutByID):
146         (JSC::Interpreter::tryCacheGetByID):
147         * jit/JITStubs.cpp:
148         (JSC::JITStubs::tryCachePutByID):
149         (JSC::JITStubs::tryCacheGetByID):
150         (JSC::JITStubs::cti_op_get_by_id_proto_list): Use the new refactored goodness. See
151         lines beginning with "-" and smile.
152
153         * runtime/JSGlobalObject.h:
154         (JSC::Structure::prototypeForLookup): A shout out to const.
155
156         * runtime/JSPropertyNameIterator.h:
157         (JSC::JSPropertyNameIterator::next): We can use a pointer comparison to
158         see if our cached structure chain is equal to the object's structure chain,
159         since in the case of a cache hit, we share references to the same structure
160         chain.
161
162         * runtime/Operations.h:
163         (JSC::countPrototypeChainEntriesAndCheckForProxies): Use the new refactored
164         goodness.
165
166         * runtime/PropertyNameArray.h:
167         (JSC::PropertyNameArray::PropertyNameArray):
168         (JSC::PropertyNameArray::setShouldCache):
169         (JSC::PropertyNameArray::shouldCache): Renamed "cacheable" to "shouldCache"
170         to communicate that the client is specifying a recommendation, not a
171         capability.
172         
173         * runtime/Structure.cpp:
174         (JSC::Structure::Structure): No need to initialize a RefPtr.
175         (JSC::Structure::getEnumerablePropertyNames): Moved some code into helper
176         functions.
177
178         (JSC::Structure::prototypeChain): New centralized accessor for a prototype
179         chain. Revalidates on every access, since the objects in the prototype
180         chain may have mutated.
181
182         (JSC::Structure::isValid): Helper function for revalidating a cached
183         prototype chain.
184
185         (JSC::Structure::getEnumerableNamesFromPropertyTable):
186         (JSC::Structure::getEnumerableNamesFromClassInfoTable): Factored out of
187         getEnumerablePropertyNames.
188
189         * runtime/Structure.h:
190
191         * runtime/StructureChain.cpp:
192         (JSC::StructureChain::StructureChain):
193         * runtime/StructureChain.h:
194         (JSC::StructureChain::create): No need for structureChainsAreEqual, since
195         we use pointer equality now. Refactored StructureChain to make a little
196         more sense and eliminate special cases for null prototypes.
197
198 2009-02-25  Steve Falkenburg  <sfalken@apple.com>
199
200         Use timeBeginPeriod to enable timing resolution greater than 16ms in command line jsc for Windows.
201         Allows more accurate reporting of benchmark times via command line jsc.exe. Doesn't affect WebKit's use of JavaScriptCore.
202         
203         Reviewed by Adam Roben.
204
205         * jsc.cpp:
206         (main):
207
208 2009-02-24  Geoffrey Garen  <ggaren@apple.com>
209
210         Build fix?
211
212         * GNUmakefile.am:
213
214 2009-02-24  Mark Rowe  <mrowe@apple.com>
215
216         Reviewed by Oliver Hunt.
217
218         <rdar://problem/6259220> Rename AVAILABLE_AFTER_WEBKIT_VERSION_3_1 (etc.) to match the other macros
219
220         * API/JSBasePrivate.h:
221         * API/JSContextRef.h:
222         * API/JSObjectRef.h:
223         * API/WebKitAvailability.h:
224
225 2009-02-23  Geoffrey Garen  <ggaren@apple.com>
226
227         Reviewed by Sam Weinig.
228
229         Next step in splitting JIT functionality out of the Interpreter class:
230         Moved vptr storage from Interpreter to JSGlobalData, so it could be shared
231         between Interpreter and JITStubs, and moved the *Trampoline JIT stubs
232         into the JITStubs class. Also added a VPtrSet class to encapsulate vptr
233         hacks during JSGlobalData initialization.
234         
235         SunSpider says 0.4% faster. Meh.
236
237         * JavaScriptCore.exp:
238         * JavaScriptCore.xcodeproj/project.pbxproj:
239         * interpreter/Interpreter.cpp:
240         (JSC::Interpreter::Interpreter):
241         (JSC::Interpreter::tryCacheGetByID):
242         (JSC::Interpreter::privateExecute):
243         * interpreter/Interpreter.h:
244         * jit/JIT.cpp:
245         (JSC::JIT::privateCompileMainPass):
246         (JSC::JIT::privateCompile):
247         (JSC::JIT::privateCompileCTIMachineTrampolines):
248         * jit/JIT.h:
249         (JSC::JIT::compileCTIMachineTrampolines):
250         * jit/JITCall.cpp:
251         (JSC::JIT::compileOpCall):
252         (JSC::JIT::compileOpCallSlowCase):
253         * jit/JITPropertyAccess.cpp:
254         (JSC::JIT::privateCompilePatchGetArrayLength):
255         * jit/JITStubs.cpp:
256         (JSC::JITStubs::JITStubs):
257         (JSC::JITStubs::tryCacheGetByID):
258         (JSC::JITStubs::cti_vm_dontLazyLinkCall):
259         (JSC::JITStubs::cti_op_get_by_val):
260         (JSC::JITStubs::cti_op_get_by_val_byte_array):
261         (JSC::JITStubs::cti_op_put_by_val):
262         (JSC::JITStubs::cti_op_put_by_val_array):
263         (JSC::JITStubs::cti_op_put_by_val_byte_array):
264         (JSC::JITStubs::cti_op_is_string):
265         * jit/JITStubs.h:
266         (JSC::JITStubs::ctiArrayLengthTrampoline):
267         (JSC::JITStubs::ctiStringLengthTrampoline):
268         (JSC::JITStubs::ctiVirtualCallPreLink):
269         (JSC::JITStubs::ctiVirtualCallLink):
270         (JSC::JITStubs::ctiVirtualCall):
271         * runtime/ArrayPrototype.cpp:
272         (JSC::arrayProtoFuncPop):
273         (JSC::arrayProtoFuncPush):
274         * runtime/FunctionPrototype.cpp:
275         (JSC::functionProtoFuncApply):
276         * runtime/JSArray.h:
277         (JSC::isJSArray):
278         * runtime/JSByteArray.h:
279         (JSC::asByteArray):
280         (JSC::isJSByteArray):
281         * runtime/JSCell.h:
282         * runtime/JSFunction.h:
283         * runtime/JSGlobalData.cpp:
284         (JSC::VPtrSet::VPtrSet):
285         (JSC::JSGlobalData::JSGlobalData):
286         (JSC::JSGlobalData::create):
287         (JSC::JSGlobalData::sharedInstance):
288         * runtime/JSGlobalData.h:
289         * runtime/JSString.h:
290         (JSC::isJSString):
291         * runtime/Operations.h:
292         (JSC::jsLess):
293         (JSC::jsLessEq):
294         * wrec/WREC.cpp:
295         (JSC::WREC::Generator::compileRegExp):
296
297 2009-02-23  Csaba Osztrogonac  <oszi@inf.u-szeged.hu>
298
299         Reviewed by Oliver Hunt.
300
301         Bug 23787: Allow JIT to generate SSE2 code if using GCC
302         <https://bugs.webkit.org/show_bug.cgi?id=23787>
303
304         GCC version of the cpuid check.
305
306         * jit/JITArithmetic.cpp:
307         (JSC::isSSE2Present): previous assembly code fixed.
308
309 2009-02-23  David Levin  <levin@chromium.org>
310
311         Reviewed by Alexey Proskuryakov.
312
313         Bug 24047: Need to simplify nested if's in WorkerRunLoop::runInMode
314         <https://bugs.webkit.org/show_bug.cgi?id=24047>
315
316         * wtf/MessageQueue.h:
317         (WTF::MessageQueue::infiniteTime):
318         Allows for one to call waitForMessageFilteredWithTimeout and wait forever.
319
320         (WTF::MessageQueue::alwaysTruePredicate):
321         (WTF::MessageQueue::waitForMessage):
322         Made waitForMessage call waitForMessageFilteredWithTimeout, so that there is less
323         duplicate code.
324
325         (WTF::MessageQueue::waitForMessageFilteredWithTimeout):
326
327         * wtf/ThreadingQt.cpp:
328         (WTF::ThreadCondition::timedWait):
329         * wtf/ThreadingWin.cpp:
330         (WTF::ThreadCondition::timedWait):
331         Made these two implementations consistent with the pthread and gtk implementations.
332         Currently, the time calculations would overflow when passed large values.
333
334 2009-02-23  Jeremy Moskovich  <jeremy@chromium.org>
335
336         Reviewed by Adam Roben.
337
338         https://bugs.webkit.org/show_bug.cgi?id=24096
339         PLATFORM(MAC)->PLATFORM(CF) since we want to use the CF functions in Chrome on OS X.
340
341         * wtf/CurrentTime.cpp:
342
343 2009-02-22  Geoffrey Garen  <ggaren@apple.com>
344
345         Build fix?
346
347         * GNUmakefile.am:
348
349 2009-02-22  Geoffrey Garen  <ggaren@apple.com>
350
351         Build fix.
352
353         * GNUmakefile.am:
354
355 2009-02-22  Geoffrey Garen  <ggaren@apple.com>
356
357         Reviewed by Sam Weinig.
358
359         Next step in splitting JIT functionality out of the Interpreter class:
360         Created a JITStubs class and renamed Interpreter::cti_* to JITStubs::cti_*.
361         
362         Also, moved timeout checking into its own class, located in JSGlobalData,
363         so both the Interpreter and the JIT could have access to it.
364
365         * JavaScriptCore.exp:
366         * JavaScriptCore.pri:
367         * JavaScriptCore.scons:
368         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
369         * JavaScriptCore.xcodeproj/project.pbxproj:
370         * JavaScriptCoreSources.bkl:
371         * interpreter/CallFrame.h:
372         * interpreter/Interpreter.cpp:
373         (JSC::Interpreter::Interpreter):
374         (JSC::Interpreter::privateExecute):
375         * interpreter/Interpreter.h:
376         * interpreter/Register.h:
377         * jit/JIT.cpp:
378         (JSC::):
379         (JSC::JIT::emitTimeoutCheck):
380         (JSC::JIT::privateCompileMainPass):
381         (JSC::JIT::privateCompileSlowCases):
382         (JSC::JIT::privateCompile):
383         (JSC::JIT::privateCompileCTIMachineTrampolines):
384         * jit/JIT.h:
385         * jit/JITArithmetic.cpp:
386         (JSC::JIT::compileFastArithSlow_op_lshift):
387         (JSC::JIT::compileFastArithSlow_op_rshift):
388         (JSC::JIT::compileFastArithSlow_op_bitand):
389         (JSC::JIT::compileFastArithSlow_op_mod):
390         (JSC::JIT::compileFastArith_op_mod):
391         (JSC::JIT::compileFastArithSlow_op_post_inc):
392         (JSC::JIT::compileFastArithSlow_op_post_dec):
393         (JSC::JIT::compileFastArithSlow_op_pre_inc):
394         (JSC::JIT::compileFastArithSlow_op_pre_dec):
395         (JSC::JIT::compileFastArith_op_add):
396         (JSC::JIT::compileFastArith_op_mul):
397         (JSC::JIT::compileFastArith_op_sub):
398         (JSC::JIT::compileBinaryArithOpSlowCase):
399         (JSC::JIT::compileFastArithSlow_op_add):
400         (JSC::JIT::compileFastArithSlow_op_mul):
401         * jit/JITCall.cpp:
402         (JSC::JIT::compileOpCall):
403         (JSC::JIT::compileOpCallSlowCase):
404         * jit/JITPropertyAccess.cpp:
405         (JSC::JIT::compileGetByIdHotPath):
406         (JSC::JIT::compilePutByIdHotPath):
407         (JSC::JIT::compileGetByIdSlowCase):
408         (JSC::JIT::compilePutByIdSlowCase):
409         (JSC::JIT::privateCompilePutByIdTransition):
410         (JSC::JIT::patchGetByIdSelf):
411         (JSC::JIT::patchPutByIdReplace):
412         (JSC::JIT::privateCompilePatchGetArrayLength):
413         (JSC::JIT::privateCompileGetByIdSelf):
414         (JSC::JIT::privateCompileGetByIdProto):
415         (JSC::JIT::privateCompileGetByIdChain):
416         (JSC::JIT::privateCompilePutByIdReplace):
417         * jit/JITStubs.cpp:
418         (JSC::JITStubs::tryCachePutByID):
419         (JSC::JITStubs::tryCacheGetByID):
420         (JSC::JITStubs::cti_op_convert_this):
421         (JSC::JITStubs::cti_op_end):
422         (JSC::JITStubs::cti_op_add):
423         (JSC::JITStubs::cti_op_pre_inc):
424         (JSC::JITStubs::cti_timeout_check):
425         (JSC::JITStubs::cti_register_file_check):
426         (JSC::JITStubs::cti_op_loop_if_less):
427         (JSC::JITStubs::cti_op_loop_if_lesseq):
428         (JSC::JITStubs::cti_op_new_object):
429         (JSC::JITStubs::cti_op_put_by_id_generic):
430         (JSC::JITStubs::cti_op_get_by_id_generic):
431         (JSC::JITStubs::cti_op_put_by_id):
432         (JSC::JITStubs::cti_op_put_by_id_second):
433         (JSC::JITStubs::cti_op_put_by_id_fail):
434         (JSC::JITStubs::cti_op_get_by_id):
435         (JSC::JITStubs::cti_op_get_by_id_second):
436         (JSC::JITStubs::cti_op_get_by_id_self_fail):
437         (JSC::JITStubs::cti_op_get_by_id_proto_list):
438         (JSC::JITStubs::cti_op_get_by_id_proto_list_full):
439         (JSC::JITStubs::cti_op_get_by_id_proto_fail):
440         (JSC::JITStubs::cti_op_get_by_id_array_fail):
441         (JSC::JITStubs::cti_op_get_by_id_string_fail):
442         (JSC::JITStubs::cti_op_instanceof):
443         (JSC::JITStubs::cti_op_del_by_id):
444         (JSC::JITStubs::cti_op_mul):
445         (JSC::JITStubs::cti_op_new_func):
446         (JSC::JITStubs::cti_op_call_JSFunction):
447         (JSC::JITStubs::cti_op_call_arityCheck):
448         (JSC::JITStubs::cti_vm_dontLazyLinkCall):
449         (JSC::JITStubs::cti_vm_lazyLinkCall):
450         (JSC::JITStubs::cti_op_push_activation):
451         (JSC::JITStubs::cti_op_call_NotJSFunction):
452         (JSC::JITStubs::cti_op_create_arguments):
453         (JSC::JITStubs::cti_op_create_arguments_no_params):
454         (JSC::JITStubs::cti_op_tear_off_activation):
455         (JSC::JITStubs::cti_op_tear_off_arguments):
456         (JSC::JITStubs::cti_op_profile_will_call):
457         (JSC::JITStubs::cti_op_profile_did_call):
458         (JSC::JITStubs::cti_op_ret_scopeChain):
459         (JSC::JITStubs::cti_op_new_array):
460         (JSC::JITStubs::cti_op_resolve):
461         (JSC::JITStubs::cti_op_construct_JSConstruct):
462         (JSC::JITStubs::cti_op_construct_NotJSConstruct):
463         (JSC::JITStubs::cti_op_get_by_val):
464         (JSC::JITStubs::cti_op_get_by_val_byte_array):
465         (JSC::JITStubs::cti_op_resolve_func):
466         (JSC::JITStubs::cti_op_sub):
467         (JSC::JITStubs::cti_op_put_by_val):
468         (JSC::JITStubs::cti_op_put_by_val_array):
469         (JSC::JITStubs::cti_op_put_by_val_byte_array):
470         (JSC::JITStubs::cti_op_lesseq):
471         (JSC::JITStubs::cti_op_loop_if_true):
472         (JSC::JITStubs::cti_op_negate):
473         (JSC::JITStubs::cti_op_resolve_base):
474         (JSC::JITStubs::cti_op_resolve_skip):
475         (JSC::JITStubs::cti_op_resolve_global):
476         (JSC::JITStubs::cti_op_div):
477         (JSC::JITStubs::cti_op_pre_dec):
478         (JSC::JITStubs::cti_op_jless):
479         (JSC::JITStubs::cti_op_not):
480         (JSC::JITStubs::cti_op_jtrue):
481         (JSC::JITStubs::cti_op_post_inc):
482         (JSC::JITStubs::cti_op_eq):
483         (JSC::JITStubs::cti_op_lshift):
484         (JSC::JITStubs::cti_op_bitand):
485         (JSC::JITStubs::cti_op_rshift):
486         (JSC::JITStubs::cti_op_bitnot):
487         (JSC::JITStubs::cti_op_resolve_with_base):
488         (JSC::JITStubs::cti_op_new_func_exp):
489         (JSC::JITStubs::cti_op_mod):
490         (JSC::JITStubs::cti_op_less):
491         (JSC::JITStubs::cti_op_neq):
492         (JSC::JITStubs::cti_op_post_dec):
493         (JSC::JITStubs::cti_op_urshift):
494         (JSC::JITStubs::cti_op_bitxor):
495         (JSC::JITStubs::cti_op_new_regexp):
496         (JSC::JITStubs::cti_op_bitor):
497         (JSC::JITStubs::cti_op_call_eval):
498         (JSC::JITStubs::cti_op_throw):
499         (JSC::JITStubs::cti_op_get_pnames):
500         (JSC::JITStubs::cti_op_next_pname):
501         (JSC::JITStubs::cti_op_push_scope):
502         (JSC::JITStubs::cti_op_pop_scope):
503         (JSC::JITStubs::cti_op_typeof):
504         (JSC::JITStubs::cti_op_is_undefined):
505         (JSC::JITStubs::cti_op_is_boolean):
506         (JSC::JITStubs::cti_op_is_number):
507         (JSC::JITStubs::cti_op_is_string):
508         (JSC::JITStubs::cti_op_is_object):
509         (JSC::JITStubs::cti_op_is_function):
510         (JSC::JITStubs::cti_op_stricteq):
511         (JSC::JITStubs::cti_op_nstricteq):
512         (JSC::JITStubs::cti_op_to_jsnumber):
513         (JSC::JITStubs::cti_op_in):
514         (JSC::JITStubs::cti_op_push_new_scope):
515         (JSC::JITStubs::cti_op_jmp_scopes):
516         (JSC::JITStubs::cti_op_put_by_index):
517         (JSC::JITStubs::cti_op_switch_imm):
518         (JSC::JITStubs::cti_op_switch_char):
519         (JSC::JITStubs::cti_op_switch_string):
520         (JSC::JITStubs::cti_op_del_by_val):
521         (JSC::JITStubs::cti_op_put_getter):
522         (JSC::JITStubs::cti_op_put_setter):
523         (JSC::JITStubs::cti_op_new_error):
524         (JSC::JITStubs::cti_op_debug):
525         (JSC::JITStubs::cti_vm_throw):
526         * jit/JITStubs.h:
527         (JSC::):
528         * runtime/JSFunction.h:
529         * runtime/JSGlobalData.cpp:
530         (JSC::JSGlobalData::JSGlobalData):
531         * runtime/JSGlobalData.h:
532         * runtime/JSGlobalObject.cpp:
533         * runtime/JSGlobalObject.h:
534         * runtime/TimeoutChecker.cpp: Copied from interpreter/Interpreter.cpp.
535         (JSC::TimeoutChecker::TimeoutChecker):
536         (JSC::TimeoutChecker::reset):
537         (JSC::TimeoutChecker::didTimeOut):
538         * runtime/TimeoutChecker.h: Copied from interpreter/Interpreter.h.
539         (JSC::TimeoutChecker::setTimeoutInterval):
540         (JSC::TimeoutChecker::ticksUntilNextCheck):
541         (JSC::TimeoutChecker::start):
542         (JSC::TimeoutChecker::stop):
543
544 2009-02-20  Gustavo Noronha Silva  <gns@gnome.org>
545
546         Unreviewed build fix after r41100.
547
548         * GNUmakefile.am:
549
550 2009-02-20  Oliver Hunt  <oliver@apple.com>
551
552         Reviewed by Mark Rowe.
553
554         <rdar://problem/6606660> 2==null returns true in 64bit jit
555
556         Code for op_eq_null and op_neq_null was incorrectly performing
557         a 32bit compare, which truncated the type tag from an integer
558         immediate, leading to incorrect behaviour.
559
560         * assembler/MacroAssembler.h:
561         (JSC::MacroAssembler::setPtr):
562         * assembler/MacroAssemblerX86_64.h:
563         (JSC::MacroAssemblerX86_64::setPtr):
564         * jit/JIT.cpp:
565         (JSC::JIT::privateCompileMainPass):
566
567 2009-02-19  Geoffrey Garen  <ggaren@apple.com>
568
569         Reviewed by Gavin Barraclough.
570         
571         First step in splitting JIT functionality out of the Interpreter class:
572         Created JITStubs.h/.cpp, and moved Interpreter::cti_* into JITStubs.cpp.
573         
574         Functions that the Interpreter and JITStubs share moved to Operations.h/.cpp.
575
576         * GNUmakefile.am:
577         * JavaScriptCore.pri:
578         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
579         * JavaScriptCore.xcodeproj/project.pbxproj:
580         * interpreter/Interpreter.cpp:
581         (JSC::Interpreter::resolveBase):
582         (JSC::Interpreter::checkTimeout):
583         (JSC::Interpreter::privateExecute):
584         * interpreter/Interpreter.h:
585         * jit/JITStubs.cpp: Copied from interpreter/Interpreter.cpp.
586         (JSC::Interpreter::cti_op_resolve_base):
587         * jit/JITStubs.h: Copied from interpreter/Interpreter.h.
588         * runtime/Operations.cpp:
589         (JSC::jsAddSlowCase):
590         (JSC::jsTypeStringForValue):
591         (JSC::jsIsObjectType):
592         (JSC::jsIsFunctionType):
593         * runtime/Operations.h:
594         (JSC::jsLess):
595         (JSC::jsLessEq):
596         (JSC::jsAdd):
597         (JSC::cachePrototypeChain):
598         (JSC::countPrototypeChainEntriesAndCheckForProxies):
599         (JSC::resolveBase):
600
601 2009-02-19  Gavin Barraclough  <barraclough@apple.com>
602
603         Reviewed by Oliver Hunt.
604
605         Fix for x86-64. Where the JavaScriptCore text segment lies outside
606         a 2gb range of the heap containing JIT generated code, callbacks
607         from JIT code to the stub functions in Interpreter will be incorrectly
608         linked.
609
610         No performance impact on Sunspider, 1% regression on v8-tests,
611         due to a 3% regression on richards.
612
613         * assembler/AbstractMacroAssembler.h:
614         (JSC::AbstractMacroAssembler::Call::Call):
615         (JSC::AbstractMacroAssembler::Jump::link):
616         (JSC::AbstractMacroAssembler::Jump::linkTo):
617         (JSC::AbstractMacroAssembler::CodeLocationJump::relink):
618         (JSC::AbstractMacroAssembler::CodeLocationCall::relink):
619         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction):
620         (JSC::AbstractMacroAssembler::PatchBuffer::link):
621         (JSC::AbstractMacroAssembler::PatchBuffer::linkTailRecursive):
622         (JSC::AbstractMacroAssembler::differenceBetween):
623         * assembler/MacroAssembler.h:
624         (JSC::MacroAssembler::tailRecursiveCall):
625         (JSC::MacroAssembler::makeTailRecursiveCall):
626         * assembler/MacroAssemblerX86.h:
627         (JSC::MacroAssemblerX86::call):
628         * assembler/MacroAssemblerX86Common.h:
629         * assembler/MacroAssemblerX86_64.h:
630         (JSC::MacroAssemblerX86_64::call):
631         (JSC::MacroAssemblerX86_64::moveWithPatch):
632         (JSC::MacroAssemblerX86_64::branchPtrWithPatch):
633         (JSC::MacroAssemblerX86_64::storePtrWithPatch):
634         * assembler/X86Assembler.h:
635         (JSC::X86Assembler::jmp_r):
636         (JSC::X86Assembler::linkJump):
637         (JSC::X86Assembler::patchJump):
638         (JSC::X86Assembler::patchCall):
639         (JSC::X86Assembler::linkCall):
640         (JSC::X86Assembler::patchAddress):
641         * interpreter/Interpreter.cpp:
642         (JSC::Interpreter::tryCTICachePutByID):
643         * jit/JIT.cpp:
644         (JSC::JIT::privateCompile):
645         (JSC::JIT::privateCompileCTIMachineTrampolines):
646         * jit/JIT.h:
647         * jit/JITArithmetic.cpp:
648         (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate):
649         (JSC::JIT::compileBinaryArithOp):
650         * jit/JITPropertyAccess.cpp:
651         (JSC::JIT::privateCompilePutByIdTransition):
652         (JSC::JIT::privateCompileGetByIdSelf):
653         (JSC::JIT::privateCompilePutByIdReplace):
654
655 2009-02-18  Geoffrey Garen  <ggaren@apple.com>
656
657         Reviewed by Oliver Hunt.
658         
659         Simplified .call and .apply in preparation for optimizing them. Also,
660         a little cleanup.
661
662         * runtime/FunctionPrototype.cpp:
663         (JSC::functionProtoFuncApply):
664         (JSC::functionProtoFuncCall): No need to do any specific conversion on
665         'this' -- op_convert_this will do it if necessary.
666
667         * runtime/JSImmediate.cpp:
668         (JSC::JSImmediate::toThisObject): Slightly relaxed the rules on
669         toThisObject to allow for 'undefined', which can be passed through
670         .call and .apply.
671
672 2009-02-19  David Levin  <levin@chromium.org>
673
674         Reviewed by Alexey Proskuryakov.
675
676         Bug 23976: MessageQueue needs a way to wait for a message that satisfies an arbitrary criteria.
677         <https://bugs.webkit.org/show_bug.cgi?id=23976>
678
679         * wtf/Deque.h:
680         (WTF::Deque<T>::findIf):
681         * wtf/MessageQueue.h:
682         (WTF::MessageQueue<T>::waitForMessageFiltered):
683
684 2009-02-18  David Levin  <levin@chromium.org>
685
686         Reviewed by Alexey Proskuryakov.
687
688         Bug 23974: Deque::Remove would be a useful method.
689         <https://bugs.webkit.org/show_bug.cgi?id=23974>
690
691         Add Deque::remove and DequeIteratorBase<T>::operator=.
692
693         Why was operator= added? Every concrete iterator (DequeIterator..DequeConstReverseIterator)
694         was calling DequeIteratorBase::assign(), which called Base::operator=(). Base::operator=()
695         was not implemented. This went unnoticed because the iterator copy code has been unused.
696
697         * wtf/Deque.h:
698         (WTF::Deque<T>::remove):
699         (WTF::DequeIteratorBase<T>::removeFromIteratorsList):
700         (WTF::DequeIteratorBase<T>::operator=):
701         (WTF::DequeIteratorBase<T>::~DequeIteratorBase):
702
703 2009-02-18  Gustavo Noronha Silva  <gns@gnome.org>
704
705         Reviewed by Holger Freyther.
706
707         Fix symbols.filter location, and add other missing files to the
708         autotools build, so that make dist works.
709
710         * GNUmakefile.am:
711
712 2009-02-17  Geoffrey Garen  <ggaren@apple.com>
713
714         Reviewed by Sam Weinig.
715         
716         Fixed failure in js1_5/Regress/regress-168347.js, as seen on the Oliver
717         bot.
718         
719         Technically, both behaviors are OK, but we might as well keep this test
720         passing.
721
722         * runtime/FunctionPrototype.cpp:
723         (JSC::insertSemicolonIfNeeded): No need to add a trailing semicolon
724         after a trailing '}', since '}' ends a block, indicating the end of a
725         statement.
726
727 2009-02-17  Geoffrey Garen  <ggaren@apple.com>
728
729         Build fix.
730
731         * runtime/FunctionPrototype.cpp:
732
733 2009-02-17  Oliver Hunt  <oliver@apple.com>
734
735         Reviewed by Geoff Garen.
736
737         Add assertion to guard against oversized pc relative calls.
738
739         * assembler/X86Assembler.h:
740         (JSC::X86Assembler::link):
741
742 2009-02-17  Geoffrey Garen  <ggaren@apple.com>
743
744         Reviewed by Sam Weinig.
745         
746         Fixed <rdar://problem/6595040> REGRESSION: http://www.amnestyusa.org/
747         fails to load.
748         
749         amnestyusa.org uses the Optimist JavaScript library, which adds event
750         listeners by concatenating string-ified functions. This is only sure to
751         be syntactically valid if the string-ified functions end in semicolons.
752
753         * parser/Lexer.cpp:
754         (JSC::Lexer::isWhiteSpace):
755         * parser/Lexer.h:
756         (JSC::Lexer::isWhiteSpace):
757         (JSC::Lexer::isLineTerminator): Added some helper functions for examining
758         whitespace.
759
760         * runtime/FunctionPrototype.cpp:
761         (JSC::appendSemicolonIfNeeded):
762         (JSC::functionProtoFuncToString): When string-ifying a function, insert
763         a semicolon in the last non-whitespace position, if one doesn't already exist.
764
765 2009-02-16  Oliver Hunt  <oliver@apple.com>
766
767         Reviewed by NOBODY (Build fix).
768
769         Roll out r41022 as it breaks qt and gtk builds
770
771         * jit/JITArithmetic.cpp:
772         (JSC::isSSE2Present):
773
774 2009-02-16  Sam Weinig  <sam@webkit.org>
775
776         Reviewed by Geoffrey Garen.
777
778         Fix for <rdar://problem/6468156>
779         REGRESSION (r36779): Adding link, images, flash in TinyMCE blocks entire page (21382)
780
781         No performance regression.
782
783         * runtime/Arguments.cpp:
784         (JSC::Arguments::fillArgList): Add codepath for when the "length" property has been
785         overridden.
786
787 2009-02-16  Mark Rowe  <mrowe@apple.com>
788
789         Build fix.
790
791         * wtf/FastMalloc.cpp:
792         (WTF::TCMallocStats::):
793         (WTF::TCMallocStats::FastMallocZone::FastMallocZone):
794
795 2009-02-16  Csaba Osztrogonac  <oszi@inf.u-szeged.hu>
796
797         Reviewed by Oliver Hunt.
798
799         Bug 23787: Allow JIT to generate SSE2 code if using GCC
800         <https://bugs.webkit.org/show_bug.cgi?id=23787>
801
802         GCC version of the cpuid check.
803
804         * jit/JITArithmetic.cpp:
805         (JSC::isSSE2Present): GCC assembly code added.
806         6.6% progression on x86 Linux with JIT and WREC on SunSpider if using SSE2 capable machine.
807
808 2009-02-13  Adam Treat  <adam.treat@torchmobile.com>
809
810         Reviewed by George Staikos.
811
812         https://bugs.webkit.org/show_bug.cgi?id=23960
813         Crash Fix.
814
815         Don't depend on 'initializeThreading()' to come before a call to 'isMainThread()'
816         as QtWebKit only calls 'initializeThreading()' during QWebPage construction.
817
818         A client app may well make a call to QWebSettings::iconForUrl() for instance
819         before creating a QWebPage and that call to QWebSettings triggers an
820         ASSERT(isMainThread()) deep within WebCore.
821
822         * wtf/ThreadingQt.cpp:
823         (WTF::isMainThread):
824
825 2009-02-13  Gavin Barraclough  <barraclough@apple.com>
826
827         Reviewed by Darin Adler.
828
829         Some data in the instruction stream is potentially uninitialized - fix this.
830
831         Change the OperandTypes constructor so that uninitialized memory in the int
832         is zeroed, and modify the Instruction constructor taking an Opcode so that
833         if !HAVE(COMPUTED_GOTO) (i.e. when Opcode is an enum, and is potentially only
834         a byte) it zeros the Instruction first before writing the opcode.
835
836         * bytecode/Instruction.h:
837         (JSC::Instruction::Instruction):
838         * parser/ResultType.h:
839         (JSC::OperandTypes::OperandTypes):
840
841 2009-02-13  Geoffrey Garen  <ggaren@apple.com>
842
843         Build fix for non_JIT platforms.
844
845         * bytecode/CodeBlock.h:
846         (JSC::CodeBlock::setIsNumericCompareFunction):
847         (JSC::CodeBlock::isNumericCompareFunction):
848
849 2009-02-13  Geoffrey Garen  <ggaren@apple.com>
850
851         Reviewed by Darin Adler.
852         
853         Fixed <rdar://problem/6584057> Optimize sort by JS numeric comparison
854         function not to run the comparison function
855         
856         * bytecode/CodeBlock.cpp:
857         (JSC::CodeBlock::CodeBlock):
858         * bytecode/CodeBlock.h:
859         (JSC::CodeBlock::setIsNumericCompareFunction):
860         (JSC::CodeBlock::isNumericCompareFunction): Added the ability to track
861         whether a CodeBlock performs a sort-like numeric comparison.
862
863         * bytecompiler/BytecodeGenerator.cpp:
864         (JSC::BytecodeGenerator::generate): Set the isNumericCompareFunction bit
865         after compiling.
866
867         * parser/Nodes.cpp:
868         (JSC::FunctionBodyNode::emitBytecode): Fixed a bug that caused us to
869         codegen an extra return at the end of all functions (eek!), since this
870         made it harder / weirder to detect the numeric comparison pattern in
871         bytecode.
872
873         * runtime/ArrayPrototype.cpp:
874         (JSC::arrayProtoFuncSort): Use the isNumericCompareFunction bit to do
875         a faster sort if we can.
876
877         * runtime/FunctionConstructor.cpp:
878         (JSC::extractFunctionBody):
879         (JSC::constructFunction):
880         * runtime/FunctionConstructor.h: Renamed and exported extractFunctionBody for
881         use in initializing lazyNumericCompareFunction.
882
883         * runtime/JSArray.cpp:
884         (JSC::compareNumbersForQSort):
885         (JSC::compareByStringPairForQSort):
886         (JSC::JSArray::sortNumeric):
887         (JSC::JSArray::sort):
888         * runtime/JSArray.h: Added a fast numeric sort. Renamed ArrayQSortPair
889         to be more specific since we do different kinds of qsort now.
890
891         * runtime/JSGlobalData.cpp:
892         (JSC::JSGlobalData::JSGlobalData):
893         (JSC::JSGlobalData::numericCompareFunction):
894         (JSC::JSGlobalData::ClientData::~ClientData):
895         * runtime/JSGlobalData.h: Added helper data for computing the
896         isNumericCompareFunction bit.
897
898 2009-02-13  Darin Adler  <darin@apple.com>
899
900         * Configurations/JavaScriptCore.xcconfig: Undo accidental commit of this file.
901
902 2009-02-12  Darin Adler  <darin@apple.com>
903
904         Reviewed by Oliver Hunt and Alexey Proskuryakov.
905
906         Speed up a couple string functions.
907
908         * runtime/StringPrototype.cpp:
909         (JSC::stringProtoFuncIndexOf): Added a fast path for cases where the second
910         argument is either missing or an integer.
911         (JSC::stringProtoFuncBig): Use jsNontrivialString since the string is guaranteed
912         to be 2 or more characters long.
913         (JSC::stringProtoFuncSmall): Ditto.
914         (JSC::stringProtoFuncBlink): Ditto.
915         (JSC::stringProtoFuncBold): Ditto.
916         (JSC::stringProtoFuncItalics): Ditto.
917         (JSC::stringProtoFuncStrike): Ditto.
918         (JSC::stringProtoFuncSub): Ditto.
919         (JSC::stringProtoFuncSup): Ditto.
920         (JSC::stringProtoFuncFontcolor): Ditto.
921         (JSC::stringProtoFuncFontsize): Make the fast path Sam recently added even faster
922         by avoiding all but the minimum memory allocation.
923         (JSC::stringProtoFuncAnchor): Use jsNontrivialString.
924         (JSC::stringProtoFuncLink): Added a fast path.
925
926         * runtime/UString.cpp:
927         (JSC::UString::find): Added a fast path for single-character search strings.
928
929 2009-02-13  David Levin  <levin@chromium.org>
930
931         Reviewed by Darin Adler.
932
933         Bug 23926: Race condition in callOnMainThreadAndWait
934         <https://bugs.webkit.org/show_bug.cgi?id=23926>
935
936         * wtf/MainThread.cpp:
937         Removed callOnMainThreadAndWait since it isn't used.
938
939 2009-02-13  Oliver Hunt  <oliver@apple.com>
940
941         Reviewed by Jon Honeycutt.
942
943         Math.random is really slow on windows.
944
945         Math.random calls WTF::randomNumber which is implemented as
946         the secure rand_s on windows.  Unfortunately rand_s is an order
947         of magnitude slower than arc4random.  For this reason I've
948         added "weakRandomNumber" for use by JavaScript's Math Object.
949         In the long term we should look at using our own secure PRNG
950         in place of the system, but this will do for now.
951
952         30% win on SunSpider on Windows, resolving most of the remaining
953         disparity vs. Mac.
954
955         * runtime/MathObject.cpp:
956         (JSC::MathObject::MathObject):
957         (JSC::mathProtoFuncRandom):
958         * wtf/RandomNumber.cpp:
959         (WTF::weakRandomNumber):
960         (WTF::randomNumber):
961         * wtf/RandomNumber.h:
962         * wtf/RandomNumberSeed.h:
963         (WTF::initializeWeakRandomNumberGenerator):
964
965 2009-02-12  Mark Rowe  <mrowe@apple.com>
966
967         Fix the build for other platforms.
968
969         * wtf/RandomNumber.cpp:
970         (WTF::randomNumber):
971
972 2009-02-12  Gavin Barraclough  <barraclough@apple.com>
973
974         Reviewed by Sam Weinig.
975
976         Remove (/reduce) use of hard-wired register names from the JIT.
977         Currently there is no abstraction of registers used in the JIT,
978         which has a number of negative consequences.  Hard-wiring x86
979         register names makes the JIT less portable to other platforms,
980         and prevents us from performing dynamic register allocation to
981         attempt to maintain more temporary values in machine registers.
982         (The latter will be more important on x86-64, where we have more
983         registers to make use of).
984
985         Also, remove MacroAssembler::mod32.  This was not providing a
986         useful abstraction, and was not in keeping with the rest of the
987         MacroAssembler interface, in having specific register requirements.
988
989         * assembler/MacroAssemblerX86Common.h:
990         * jit/JIT.cpp:
991         (JSC::JIT::compileOpStrictEq):
992         (JSC::JIT::emitSlowScriptCheck):
993         (JSC::JIT::privateCompileMainPass):
994         (JSC::JIT::privateCompileSlowCases):
995         (JSC::JIT::privateCompile):
996         (JSC::JIT::privateCompileCTIMachineTrampolines):
997         * jit/JIT.h:
998         * jit/JITArithmetic.cpp:
999         (JSC::JIT::compileFastArith_op_lshift):
1000         (JSC::JIT::compileFastArithSlow_op_lshift):
1001         (JSC::JIT::compileFastArith_op_rshift):
1002         (JSC::JIT::compileFastArithSlow_op_rshift):
1003         (JSC::JIT::compileFastArith_op_bitand):
1004         (JSC::JIT::compileFastArithSlow_op_bitand):
1005         (JSC::JIT::compileFastArith_op_mod):
1006         (JSC::JIT::compileFastArithSlow_op_mod):
1007         (JSC::JIT::compileFastArith_op_post_inc):
1008         (JSC::JIT::compileFastArithSlow_op_post_inc):
1009         (JSC::JIT::compileFastArith_op_post_dec):
1010         (JSC::JIT::compileFastArithSlow_op_post_dec):
1011         (JSC::JIT::compileFastArith_op_pre_inc):
1012         (JSC::JIT::compileFastArithSlow_op_pre_inc):
1013         (JSC::JIT::compileFastArith_op_pre_dec):
1014         (JSC::JIT::compileFastArithSlow_op_pre_dec):
1015         (JSC::JIT::compileFastArith_op_add):
1016         (JSC::JIT::compileFastArith_op_mul):
1017         (JSC::JIT::compileFastArith_op_sub):
1018         (JSC::JIT::compileBinaryArithOp):
1019         * jit/JITCall.cpp:
1020         (JSC::JIT::compileOpCallInitializeCallFrame):
1021         (JSC::JIT::compileOpCallSetupArgs):
1022         (JSC::JIT::compileOpCallEvalSetupArgs):
1023         (JSC::JIT::compileOpConstructSetupArgs):
1024         (JSC::JIT::compileOpCall):
1025         (JSC::JIT::compileOpCallSlowCase):
1026         * jit/JITInlineMethods.h:
1027         (JSC::JIT::emitGetVirtualRegister):
1028         (JSC::JIT::emitPutVirtualRegister):
1029         (JSC::JIT::emitNakedCall):
1030         (JSC::JIT::restoreArgumentReference):
1031         (JSC::JIT::restoreArgumentReferenceForTrampoline):
1032         * jit/JITPropertyAccess.cpp:
1033         (JSC::JIT::compileGetByIdHotPath):
1034         (JSC::JIT::compilePutByIdHotPath):
1035         (JSC::JIT::compileGetByIdSlowCase):
1036         (JSC::JIT::compilePutByIdSlowCase):
1037         (JSC::JIT::privateCompilePutByIdTransition):
1038         (JSC::JIT::privateCompilePatchGetArrayLength):
1039         (JSC::JIT::privateCompileGetByIdSelf):
1040         (JSC::JIT::privateCompileGetByIdProto):
1041         (JSC::JIT::privateCompileGetByIdSelfList):
1042         (JSC::JIT::privateCompileGetByIdProtoList):
1043         (JSC::JIT::privateCompileGetByIdChainList):
1044         (JSC::JIT::privateCompileGetByIdChain):
1045         (JSC::JIT::privateCompilePutByIdReplace):
1046
1047 2009-02-12  Horia Olaru  <olaru@adobe.com>
1048
1049         Reviewed by Oliver Hunt.
1050
1051         https://bugs.webkit.org/show_bug.cgi?id=23400
1052
1053         When throwing an exception within an eval argument string, the dst parameter was
1054         modified in the functions below and the return value for eval was altered. Changed
1055         the emitNode call in JSC::ThrowNode::emitBytecode to use a temporary register
1056         to store its results instead of dst. The JSC::FunctionCallResolveNode::emitBytecode
1057         would load the function within the dst registry, also altering the result returned
1058         by eval. Replaced it with another temporary.
1059
1060         * parser/Nodes.cpp:
1061         (JSC::FunctionCallResolveNode::emitBytecode):
1062         (JSC::ThrowNode::emitBytecode):
1063
1064 2009-02-12  Sam Weinig  <sam@webkit.org>
1065
1066         Reviewed by Geoffrey Garen.
1067
1068         Speed up String.prototype.fontsize.
1069
1070         * runtime/StringPrototype.cpp:
1071         (JSC::stringProtoFuncFontsize): Specialize for defined/commonly used values.
1072
1073 2009-02-12  Geoffrey Garen  <ggaren@apple.com>
1074
1075         Reviewed by Sam Weinig.
1076         
1077         Correctness fix.
1078
1079         * wtf/RandomNumber.cpp:
1080         (WTF::randomNumber): Divide by the maximum representable value, which
1081         is different on each platform now, to get values between 0 and 1.
1082
1083 2009-02-12  Geoffrey Garen  <ggaren@apple.com>
1084
1085         Build fix.
1086
1087         * wtf/RandomNumber.cpp:
1088         (WTF::randomNumber):
1089
1090 2009-02-12  Geoffrey Garen  <ggaren@apple.com>
1091
1092         Reviewed by Sam Weinig.
1093         
1094         Fixed <rdar://problem/6582048>.
1095
1096         * wtf/RandomNumber.cpp:
1097         (WTF::randomNumber): Make only one call to the random number generator
1098         on platforms where the generator is cryptographically secure. The value
1099         of randomness over and above cryptographically secure randomness is not
1100         clear, and it caused some performance problems.
1101
1102 2009-02-12  Adam Roben  <aroben@apple.com>
1103
1104         Fix lots of Perl warnings when building JavaScriptCoreGenerated on
1105         Windows
1106
1107         Reviewed by John Sullivan.
1108
1109         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
1110         Create the docs/ directory so that we can write bytecode.html into it.
1111         This matches what JavaScriptCore.xcodeproj does.
1112
1113 2009-02-12  Simon Hausmann  <simon.hausmann@nokia.com>
1114
1115         Rubber-stamped by Lars.
1116
1117         Re-enable the JIT in the Qt build with -fno-stack-protector on Linux.
1118
1119         * JavaScriptCore.pri:
1120
1121 2009-02-11  Dmitry Titov  <dimich@chromium.org>
1122
1123         Reviewed by Alexey Proskuryakov.
1124
1125         https://bugs.webkit.org/show_bug.cgi?id=23705
1126         Fix the UI freeze caused by Worker generating a flood of messages.
1127         Measure time we spend in executing posted work items. If too much time is spent
1128         without returning to the run loop, exit and reschedule.
1129
1130         * wtf/MainThread.h:
1131         Added initializeMainThreadPlatform() to initialize low-level mechanism for posting
1132         work items from thread to thread. This removes #ifdefs for WIN and CHROMIUM from platform-independent code.
1133
1134         * wtf/MainThread.cpp:
1135         (WTF::initializeMainThread):
1136         (WTF::dispatchFunctionsFromMainThread):
1137         Instead of dispatching all work items in the queue, dispatch them one by one
1138         and measure elapsed time. After a threshold, reschedule and quit.
1139
1140         (WTF::callOnMainThread):
1141         (WTF::callOnMainThreadAndWait):
1142         Only schedule dispatch if the queue was empty - to avoid many posted messages in the run loop queue.
1143
1144         * wtf/mac/MainThreadMac.mm:
1145         (WTF::scheduleDispatchFunctionsOnMainThread):
1146         Use static instance of the mainThreadCaller instead of allocating and releasing it each time.
1147         (WTF::initializeMainThreadPlatform):
1148         * wtf/gtk/MainThreadChromium.cpp:
1149         (WTF::initializeMainThreadPlatform):
1150         * wtf/gtk/MainThreadGtk.cpp:
1151         (WTF::initializeMainThreadPlatform):
1152         * wtf/qt/MainThreadQt.cpp:
1153         (WTF::initializeMainThreadPlatform):
1154         * wtf/win/MainThreadWin.cpp:
1155         (WTF::initializeMainThreadPlatform):
1156         * wtf/wx/MainThreadWx.cpp:
1157         (WTF::initializeMainThreadPlatform):
1158
1159 2009-02-11  Sam Weinig  <sam@webkit.org>
1160
1161         Reviewed by Gavin Barraclough.
1162
1163         Style cleanup.
1164
1165         * assembler/AbstractMacroAssembler.h:
1166         (JSC::AbstractMacroAssembler::CodeLocationCommon::CodeLocationCommon):
1167         (JSC::AbstractMacroAssembler::CodeLocationCommon::operator bool):
1168         (JSC::AbstractMacroAssembler::CodeLocationCommon::reset):
1169         (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForSwitch):
1170         (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForExceptionHandler):
1171         (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForJSR):
1172         (JSC::AbstractMacroAssembler::CodeLocationLabel::getJumpDestination):
1173         (JSC::AbstractMacroAssembler::CodeLocationJump::relink):
1174         (JSC::AbstractMacroAssembler::CodeLocationJump::CodeLocationJump):
1175         (JSC::AbstractMacroAssembler::CodeLocationCall::relink):
1176         (JSC::AbstractMacroAssembler::CodeLocationCall::calleeReturnAddressValue):
1177         (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall):
1178         (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::repatch):
1179         (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::CodeLocationDataLabel32):
1180         (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::repatch):
1181         (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::CodeLocationDataLabelPtr):
1182         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::ProcessorReturnAddress):
1183         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction):
1184         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::operator void*):
1185         (JSC::AbstractMacroAssembler::PatchBuffer::link):
1186         (JSC::::CodeLocationCommon::labelAtOffset):
1187         (JSC::::CodeLocationCommon::jumpAtOffset):
1188         (JSC::::CodeLocationCommon::callAtOffset):
1189         (JSC::::CodeLocationCommon::dataLabelPtrAtOffset):
1190         (JSC::::CodeLocationCommon::dataLabel32AtOffset):
1191
1192 2009-02-11  Sam Weinig  <sam@webkit.org>
1193
1194         Reviewed by Gavin Barraclough.
1195
1196         * assembler/AbstractMacroAssembler.h: Fix comments.
1197
1198 2009-02-11  Alexey Proskuryakov  <ap@webkit.org>
1199
1200         Trying to fix wx build.
1201
1202         * bytecode/JumpTable.h: Include "MacroAssembler.h", not <MacroAssembler.h>.
1203         * jscore.bkl: Added assembler directory to search paths.
1204
1205 2009-02-10  Gavin Barraclough  <barraclough@apple.com>
1206
1207         Build
1208         fix.
1209         (Narrow
1210         changelog
1211         for
1212         dhyatt).
1213
1214         * bytecode/Instruction.h:
1215         (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
1216         (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
1217
1218 2009-02-10  Gavin Barraclough  <barraclough@apple.com>
1219
1220         Reviewed by Oliver Hunt.
1221
1222         Reduce use of void* / reinterpret_cast in JIT repatching code,
1223         add strong types for Calls and for the various types of pointers
1224         we retain into the JIT generated instruction stream.
1225
1226         No performance impact.
1227
1228         * assembler/AbstractMacroAssembler.h:
1229         (JSC::AbstractMacroAssembler::ImmPtr::ImmPtr):
1230         (JSC::AbstractMacroAssembler::ImmPtr::asIntptr):
1231         (JSC::AbstractMacroAssembler::Imm32::Imm32):
1232         (JSC::AbstractMacroAssembler::Label::Label):
1233         (JSC::AbstractMacroAssembler::DataLabelPtr::DataLabelPtr):
1234         (JSC::AbstractMacroAssembler::Call::Call):
1235         (JSC::AbstractMacroAssembler::Call::link):
1236         (JSC::AbstractMacroAssembler::Call::linkTo):
1237         (JSC::AbstractMacroAssembler::Jump::Jump):
1238         (JSC::AbstractMacroAssembler::Jump::linkTo):
1239         (JSC::AbstractMacroAssembler::CodeLocationCommon::CodeLocationCommon):
1240         (JSC::AbstractMacroAssembler::CodeLocationCommon::operator bool):
1241         (JSC::AbstractMacroAssembler::CodeLocationCommon::reset):
1242         (JSC::AbstractMacroAssembler::CodeLocationLabel::CodeLocationLabel):
1243         (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForSwitch):
1244         (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForExceptionHandler):
1245         (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForJSR):
1246         (JSC::AbstractMacroAssembler::CodeLocationLabel::getJumpDestination):
1247         (JSC::AbstractMacroAssembler::CodeLocationJump::CodeLocationJump):
1248         (JSC::AbstractMacroAssembler::CodeLocationJump::relink):
1249         (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall):
1250         (JSC::AbstractMacroAssembler::CodeLocationCall::relink):
1251         (JSC::AbstractMacroAssembler::CodeLocationCall::calleeReturnAddressValue):
1252         (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::CodeLocationDataLabel32):
1253         (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::repatch):
1254         (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::CodeLocationDataLabelPtr):
1255         (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::repatch):
1256         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::ProcessorReturnAddress):
1257         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction):
1258         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::operator void*):
1259         (JSC::AbstractMacroAssembler::PatchBuffer::entry):
1260         (JSC::AbstractMacroAssembler::PatchBuffer::trampolineAt):
1261         (JSC::AbstractMacroAssembler::PatchBuffer::link):
1262         (JSC::AbstractMacroAssembler::PatchBuffer::linkTailRecursive):
1263         (JSC::AbstractMacroAssembler::PatchBuffer::patch):
1264         (JSC::AbstractMacroAssembler::PatchBuffer::locationOf):
1265         (JSC::AbstractMacroAssembler::PatchBuffer::returnAddressOffset):
1266         (JSC::AbstractMacroAssembler::differenceBetween):
1267         (JSC::::CodeLocationCommon::labelAtOffset):
1268         (JSC::::CodeLocationCommon::jumpAtOffset):
1269         (JSC::::CodeLocationCommon::callAtOffset):
1270         (JSC::::CodeLocationCommon::dataLabelPtrAtOffset):
1271         (JSC::::CodeLocationCommon::dataLabel32AtOffset):
1272         * assembler/MacroAssemblerX86Common.h:
1273         (JSC::MacroAssemblerX86Common::call):
1274         * assembler/X86Assembler.h:
1275         (JSC::X86Assembler::getCallReturnOffset):
1276         * bytecode/CodeBlock.h:
1277         (JSC::CallLinkInfo::CallLinkInfo):
1278         (JSC::getStructureStubInfoReturnLocation):
1279         (JSC::getCallLinkInfoReturnLocation):
1280         * bytecode/Instruction.h:
1281         (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
1282         (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
1283         * bytecode/JumpTable.h:
1284         (JSC::StringJumpTable::ctiForValue):
1285         (JSC::SimpleJumpTable::ctiForValue):
1286         * bytecode/StructureStubInfo.h:
1287         (JSC::StructureStubInfo::StructureStubInfo):
1288         * bytecompiler/BytecodeGenerator.cpp:
1289         (JSC::BytecodeGenerator::emitCatch):
1290         (JSC::prepareJumpTableForStringSwitch):
1291         * interpreter/Interpreter.cpp:
1292         (JSC::Interpreter::cti_op_get_by_id_self_fail):
1293         (JSC::getPolymorphicAccessStructureListSlot):
1294         (JSC::Interpreter::cti_op_throw):
1295         (JSC::Interpreter::cti_op_switch_imm):
1296         (JSC::Interpreter::cti_op_switch_char):
1297         (JSC::Interpreter::cti_op_switch_string):
1298         (JSC::Interpreter::cti_vm_throw):
1299         * jit/JIT.cpp:
1300         (JSC::ctiSetReturnAddress):
1301         (JSC::ctiPatchCallByReturnAddress):
1302         (JSC::JIT::privateCompile):
1303         (JSC::JIT::privateCompileCTIMachineTrampolines):
1304         * jit/JIT.h:
1305         (JSC::CallRecord::CallRecord):
1306         (JSC::JIT::compileGetByIdSelf):
1307         (JSC::JIT::compileGetByIdProto):
1308         (JSC::JIT::compileGetByIdChain):
1309         (JSC::JIT::compilePutByIdReplace):
1310         (JSC::JIT::compilePutByIdTransition):
1311         (JSC::JIT::compilePatchGetArrayLength):
1312         (JSC::JIT::emitCTICall):
1313         * jit/JITCall.cpp:
1314         (JSC::JIT::unlinkCall):
1315         (JSC::JIT::linkCall):
1316         * jit/JITInlineMethods.h:
1317         (JSC::JIT::emitNakedCall):
1318         (JSC::JIT::emitCTICall_internal):
1319         * jit/JITPropertyAccess.cpp:
1320         (JSC::JIT::compileGetByIdSlowCase):
1321         (JSC::JIT::compilePutByIdSlowCase):
1322         (JSC::JIT::privateCompilePutByIdTransition):
1323         (JSC::JIT::patchGetByIdSelf):
1324         (JSC::JIT::patchPutByIdReplace):
1325         (JSC::JIT::privateCompilePatchGetArrayLength):
1326         (JSC::JIT::privateCompileGetByIdSelf):
1327         (JSC::JIT::privateCompileGetByIdProto):
1328         (JSC::JIT::privateCompileGetByIdSelfList):
1329         (JSC::JIT::privateCompileGetByIdProtoList):
1330         (JSC::JIT::privateCompileGetByIdChainList):
1331         (JSC::JIT::privateCompileGetByIdChain):
1332         (JSC::JIT::privateCompilePutByIdReplace):
1333
1334 2009-02-10  Adam Roben  <aroben@apple.com>
1335
1336         Windows build fix after r40813
1337
1338         * JavaScriptCore.vcproj/jsc/jsc.vcproj: Added profiler/ to the include
1339         path so that Profiler.h can be found.
1340
1341 2009-02-09  Gavin Barraclough  <barraclough@apple.com>
1342
1343         Reviewed by Oliver Hunt.
1344
1345         Provide a class type for a generated block of JIT code.
1346         Also changes the return address -> bytecode index map to
1347         track the return addess as an unsigned offset into the code
1348         instead of a ptrdiff_t in terms of void**s - the latter is
1349         equal to the actual offset / sizeof(void*), making it a
1350         potentially lossy representation.
1351
1352         * JavaScriptCore.xcodeproj/project.pbxproj:
1353         * assembler/AbstractMacroAssembler.h:
1354         (JSC::AbstractMacroAssembler::PatchBuffer::returnAddressOffset):
1355         * assembler/X86Assembler.h:
1356         (JSC::X86Assembler::getCallReturnOffset):
1357         * bytecode/CodeBlock.h:
1358         (JSC::CallReturnOffsetToBytecodeIndex::CallReturnOffsetToBytecodeIndex):
1359         (JSC::getCallReturnOffset):
1360         (JSC::CodeBlock::getBytecodeIndex):
1361         (JSC::CodeBlock::jitCode):
1362         (JSC::CodeBlock::callReturnIndexVector):
1363         * interpreter/Interpreter.cpp:
1364         (JSC::Interpreter::execute):
1365         (JSC::Interpreter::cti_vm_dontLazyLinkCall):
1366         (JSC::Interpreter::cti_vm_lazyLinkCall):
1367         * jit/JIT.cpp:
1368         (JSC::JIT::privateCompile):
1369         * jit/JIT.h:
1370         (JSC::):
1371         * jit/JITCall.cpp:
1372         (JSC::JIT::linkCall):
1373         * jit/JITCode.h: Added.
1374         (JSC::):
1375         (JSC::JITCode::JITCode):
1376         (JSC::JITCode::operator bool):
1377         (JSC::JITCode::addressForCall):
1378         (JSC::JITCode::offsetOf):
1379         (JSC::JITCode::execute):
1380
1381 2009-02-09  John Grabowski  <jrg@chromium.org>
1382
1383         Reviewed by Darin Adler.
1384
1385         https://bugs.webkit.org/show_bug.cgi?id=23856
1386         Change the definition of "main thread" for Chromium on OSX.
1387         It does not match the DARWIN definition.
1388
1389         * wtf/ThreadingPthreads.cpp:
1390         (WTF::initializeThreading):
1391         (WTF::isMainThread):
1392
1393 2009-02-09  Gavin Barraclough  <barraclough@apple.com>
1394
1395         Reviewed by Oliver Hunt.
1396
1397         Minor bugfix, incorrect check meant that subtraction causing integer overflow
1398         would be missed on x86-64 JIT.
1399
1400         * jit/JITArithmetic.cpp:
1401         (JSC::JIT::compileBinaryArithOp):
1402
1403 2009-02-09  Gavin Barraclough  <barraclough@apple.com>
1404
1405         Reviewed by Oliver Hunt.
1406
1407         A more sensible register allocation for x86-64.
1408
1409         When WREC was ported to x86-64 it stuck with the same register allocation as x86.
1410         This requires registers to be reordered on entry into WREC generated code, since
1411         argument passing is different on x86-64 and x86 (regparm(3)).  This patch switches
1412         x86-64 to use a native register allocation, that does not require argument registers
1413         to be reordered.
1414
1415         * wrec/WRECGenerator.cpp:
1416         (JSC::WREC::Generator::generateEnter):
1417         (JSC::WREC::Generator::generateReturnSuccess):
1418         (JSC::WREC::Generator::generateReturnFailure):
1419         * wrec/WRECGenerator.h:
1420
1421 2009-02-05  Adam Roben  <aroben@apple.com>
1422
1423         Build fix
1424
1425         Rubberstamped by Sam Weinig.
1426
1427         * wtf/TypeTraits.h: Include Platform.h, since this header uses macros
1428         defined there.
1429
1430 2009-02-05  Dimitri Glazkov  <dglazkov@chromium.org>
1431
1432         Reviewed by Eric Seidel.
1433
1434         https://bugs.webkit.org/show_bug.cgi?id=23747
1435         Add Chromium threading-related files.
1436
1437         * wtf/MainThread.cpp: Added platform guard to initializeMainThread.
1438         * wtf/chromium/ChromiumThreading.h: Added.
1439         * wtf/chromium/MainThreadChromium.cpp: Added.
1440         (WTF::initializeMainThread):
1441         (WTF::scheduleDispatchFunctionsOnMainThread):
1442
1443 2009-02-05  David Levin  <levin@chromium.org>
1444
1445         Reviewed by Darin Adler.
1446
1447         Bug 23713: COMPILE_ASSERTS should be moved out of TypeTraits.h and into .cpp file
1448         <https://bugs.webkit.org/show_bug.cgi?id=23713>
1449
1450         * GNUmakefile.am:
1451         * JavaScriptCore.pri:
1452         * JavaScriptCore.scons:
1453         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
1454         * JavaScriptCore.xcodeproj/project.pbxproj:
1455         * JavaScriptCoreSources.bkl:
1456
1457         * wtf/HashTraits.h:
1458         Remove unnecessary header file that I missed when moving out the type traits form this file.
1459
1460         * wtf/TypeTraits.cpp: Added.
1461         (WTF::):
1462         * wtf/TypeTraits.h:
1463         Moved the compile asserts into TypeTraits.cpp file.
1464
1465 2009-02-04  Gavin Barraclough  <barraclough@apple.com>
1466
1467         Reviewed by Oliver 'the nun' Hunt.
1468
1469         Add -e switch to jsc to enable evaluation of scripts passed on the command line.
1470
1471         * jsc.cpp:
1472         (Script::Script):
1473         (runWithScripts):
1474         (printUsageStatement):
1475         (parseArguments):
1476         (jscmain):
1477
1478 2009-02-04  Gavin Barraclough  <barraclough@apple.com>
1479
1480         Rubber stamped by Sam 'Big Mac' Weinig.
1481
1482         * assembler/AbstractMacroAssembler.h: Copied from assembler/MacroAssembler.h.
1483         * assembler/MacroAssemblerX86.h: Copied from assembler/MacroAssembler.h.
1484         * assembler/MacroAssemblerX86Common.h: Copied from assembler/MacroAssembler.h.
1485         * assembler/MacroAssemblerX86_64.h: Copied from assembler/MacroAssembler.h.
1486
1487 2009-02-04  Gavin Barraclough  <barraclough@apple.com>
1488
1489         Reviewed by Sam Weinig.
1490
1491         This patch tidies up the MacroAssembler, cleaning up the code and refactoring out the
1492         platform-specific parts.  The MacroAssembler gets split up like a beef burger, with the
1493         platform-agnostic data types being the lower bun (in the form of the class AbstractMacroAssembler),
1494         the plaform-specific code generation forming a big meaty patty of methods like 'add32',
1495         'branch32', etc (MacroAssemblerX86), and finally topped off with the bun-lid of the
1496         MacroAssembler class itself, providing covenience methods such as the stack peek & poke,
1497         and backwards branch methods, all of which can be described in a platform independent
1498         way using methods from the base class.  The AbstractMacroAssembler is templated on the
1499         type of the assembler class that will be used for code generation, and the three layers
1500         are held together with the cocktail stick of inheritance.
1501
1502         The above description is a slight simplification since the MacroAssemblerX86 is actually
1503         formed from two layers (in effect giving us a kind on bacon double cheeseburger) - with the
1504         bulk of methods that are common between x86 & x86-64 implemented in MacroAssemblerX86Common,
1505         which forms a base class for MacroAssemblerX86 and MacroAssemblerX86_64 (which add the methods
1506         specific to the given platform).
1507
1508         I'm landing these changes first without splitting the classes across multiple files,
1509         I will follow up with a second patch to split up the file MacroAssembler.h.
1510
1511         * assembler/MacroAssembler.h:
1512         (JSC::AbstractMacroAssembler::):
1513         (JSC::AbstractMacroAssembler::DataLabelPtr::DataLabelPtr):
1514         (JSC::AbstractMacroAssembler::DataLabelPtr::patch):
1515         (JSC::AbstractMacroAssembler::DataLabel32::DataLabel32):
1516         (JSC::AbstractMacroAssembler::DataLabel32::patch):
1517         (JSC::AbstractMacroAssembler::Label::Label):
1518         (JSC::AbstractMacroAssembler::Jump::Jump):
1519         (JSC::AbstractMacroAssembler::Jump::link):
1520         (JSC::AbstractMacroAssembler::Jump::linkTo):
1521         (JSC::AbstractMacroAssembler::Jump::patch):
1522         (JSC::AbstractMacroAssembler::JumpList::link):
1523         (JSC::AbstractMacroAssembler::JumpList::linkTo):
1524         (JSC::AbstractMacroAssembler::PatchBuffer::link):
1525         (JSC::AbstractMacroAssembler::PatchBuffer::addressOf):
1526         (JSC::AbstractMacroAssembler::PatchBuffer::setPtr):
1527         (JSC::AbstractMacroAssembler::size):
1528         (JSC::AbstractMacroAssembler::copyCode):
1529         (JSC::AbstractMacroAssembler::label):
1530         (JSC::AbstractMacroAssembler::align):
1531         (JSC::AbstractMacroAssembler::differenceBetween):
1532         (JSC::MacroAssemblerX86Common::xor32):
1533         (JSC::MacroAssemblerX86Common::load32WithAddressOffsetPatch):
1534         (JSC::MacroAssemblerX86Common::store32WithAddressOffsetPatch):
1535         (JSC::MacroAssemblerX86Common::move):
1536         (JSC::MacroAssemblerX86Common::swap):
1537         (JSC::MacroAssemblerX86Common::signExtend32ToPtr):
1538         (JSC::MacroAssemblerX86Common::zeroExtend32ToPtr):
1539         (JSC::MacroAssemblerX86Common::branch32):
1540         (JSC::MacroAssemblerX86Common::jump):
1541         (JSC::MacroAssemblerX86_64::add32):
1542         (JSC::MacroAssemblerX86_64::sub32):
1543         (JSC::MacroAssemblerX86_64::load32):
1544         (JSC::MacroAssemblerX86_64::store32):
1545         (JSC::MacroAssemblerX86_64::addPtr):
1546         (JSC::MacroAssemblerX86_64::andPtr):
1547         (JSC::MacroAssemblerX86_64::orPtr):
1548         (JSC::MacroAssemblerX86_64::rshiftPtr):
1549         (JSC::MacroAssemblerX86_64::subPtr):
1550         (JSC::MacroAssemblerX86_64::xorPtr):
1551         (JSC::MacroAssemblerX86_64::loadPtr):
1552         (JSC::MacroAssemblerX86_64::loadPtrWithAddressOffsetPatch):
1553         (JSC::MacroAssemblerX86_64::storePtr):
1554         (JSC::MacroAssemblerX86_64::storePtrWithAddressOffsetPatch):
1555         (JSC::MacroAssemblerX86_64::branchPtr):
1556         (JSC::MacroAssemblerX86_64::branchTestPtr):
1557         (JSC::MacroAssemblerX86_64::branchAddPtr):
1558         (JSC::MacroAssemblerX86_64::branchSubPtr):
1559         (JSC::MacroAssemblerX86_64::branchPtrWithPatch):
1560         (JSC::MacroAssemblerX86_64::storePtrWithPatch):
1561         (JSC::MacroAssemblerX86::add32):
1562         (JSC::MacroAssemblerX86::sub32):
1563         (JSC::MacroAssemblerX86::load32):
1564         (JSC::MacroAssemblerX86::store32):
1565         (JSC::MacroAssemblerX86::branch32):
1566         (JSC::MacroAssemblerX86::branchPtrWithPatch):
1567         (JSC::MacroAssemblerX86::storePtrWithPatch):
1568         (JSC::MacroAssembler::pop):
1569         (JSC::MacroAssembler::peek):
1570         (JSC::MacroAssembler::poke):
1571         (JSC::MacroAssembler::branchPtr):
1572         (JSC::MacroAssembler::branch32):
1573         (JSC::MacroAssembler::branch16):
1574         (JSC::MacroAssembler::branchTestPtr):
1575         (JSC::MacroAssembler::addPtr):
1576         (JSC::MacroAssembler::andPtr):
1577         (JSC::MacroAssembler::orPtr):
1578         (JSC::MacroAssembler::rshiftPtr):
1579         (JSC::MacroAssembler::subPtr):
1580         (JSC::MacroAssembler::xorPtr):
1581         (JSC::MacroAssembler::loadPtr):
1582         (JSC::MacroAssembler::loadPtrWithAddressOffsetPatch):
1583         (JSC::MacroAssembler::storePtr):
1584         (JSC::MacroAssembler::storePtrWithAddressOffsetPatch):
1585         (JSC::MacroAssembler::branchAddPtr):
1586         (JSC::MacroAssembler::branchSubPtr):
1587         * jit/JITArithmetic.cpp:
1588         (JSC::JIT::compileBinaryArithOp):
1589
1590 2009-02-04  Alexey Proskuryakov  <ap@webkit.org>
1591
1592         Reviewed by Sam Weinig.
1593
1594         https://bugs.webkit.org/show_bug.cgi?id=23681
1595         Worker tests crash in debug builds if run --singly
1596
1597         The crash happened because worker threads continued running while debug-only static objects
1598         were already being destroyed on main thread.
1599
1600         * runtime/Structure.cpp: Create static debug-only sets in heap, so that they don't get
1601         destroyed.
1602
1603         * wtf/ThreadingPthreads.cpp: Changed assertions to conventional form.
1604
1605 2009-02-03  Gavin Barraclough  <barraclough@apple.com>
1606
1607         Reviewed by Geoff Garen.
1608
1609         https://bugs.webkit.org/show_bug.cgi?id=23715
1610
1611         Simplify MacroAssembler interface, by combining comparison methods.
1612         Seprate operations are combined as follows:
1613             jz32/jnz32/jzPtr/jnzPtr -> branchTest32/branchTestPtr,
1614             j*(Add|Mul|Sub)32/j*(Add|Mul|Sub)Ptr -> branch(Add|Mul|Sub)32/branch(Add|Mul|Sub)Ptr
1615             j*32/j*Ptr (all other two op combparisons) -> branch32/brnachPtr
1616             set*32 -> set32
1617
1618         Also, represent the Scale of BaseIndex addresses as a plain enum (0,1,2,3),
1619         instead of as multiplicands (1,2,4,8).
1620
1621         This patch singificantly reduces replication of code, and increases functionality supported
1622         by the MacroAssembler.  No performance impact.
1623
1624         * assembler/MacroAssembler.h:
1625         (JSC::MacroAssembler::):
1626         (JSC::MacroAssembler::branchPtr):
1627         (JSC::MacroAssembler::branchPtrWithPatch):
1628         (JSC::MacroAssembler::branch32):
1629         (JSC::MacroAssembler::branch16):
1630         (JSC::MacroAssembler::branchTestPtr):
1631         (JSC::MacroAssembler::branchTest32):
1632         (JSC::MacroAssembler::branchAddPtr):
1633         (JSC::MacroAssembler::branchAdd32):
1634         (JSC::MacroAssembler::branchMul32):
1635         (JSC::MacroAssembler::branchSubPtr):
1636         (JSC::MacroAssembler::branchSub32):
1637         (JSC::MacroAssembler::set32):
1638         (JSC::MacroAssembler::setTest32):
1639         * assembler/X86Assembler.h:
1640         (JSC::X86Assembler::):
1641         (JSC::X86Assembler::jccRel32):
1642         (JSC::X86Assembler::setccOpcode):
1643         (JSC::X86Assembler::cmpq_mr):
1644         (JSC::X86Assembler::setcc_r):
1645         (JSC::X86Assembler::sete_r):
1646         (JSC::X86Assembler::setne_r):
1647         (JSC::X86Assembler::jne):
1648         (JSC::X86Assembler::je):
1649         (JSC::X86Assembler::jl):
1650         (JSC::X86Assembler::jb):
1651         (JSC::X86Assembler::jle):
1652         (JSC::X86Assembler::jbe):
1653         (JSC::X86Assembler::jge):
1654         (JSC::X86Assembler::jg):
1655         (JSC::X86Assembler::ja):
1656         (JSC::X86Assembler::jae):
1657         (JSC::X86Assembler::jo):
1658         (JSC::X86Assembler::jp):
1659         (JSC::X86Assembler::js):
1660         (JSC::X86Assembler::jcc):
1661         (JSC::X86Assembler::X86InstructionFormatter::putModRmSib):
1662         * jit/JIT.cpp:
1663         (JSC::JIT::compileOpStrictEq):
1664         (JSC::JIT::emitSlowScriptCheck):
1665         (JSC::JIT::privateCompileMainPass):
1666         (JSC::JIT::privateCompileSlowCases):
1667         (JSC::JIT::privateCompile):
1668         (JSC::JIT::privateCompileCTIMachineTrampolines):
1669         * jit/JITArithmetic.cpp:
1670         (JSC::JIT::compileFastArith_op_lshift):
1671         (JSC::JIT::compileFastArith_op_mod):
1672         (JSC::JIT::compileFastArith_op_post_inc):
1673         (JSC::JIT::compileFastArith_op_post_dec):
1674         (JSC::JIT::compileFastArith_op_pre_inc):
1675         (JSC::JIT::compileFastArith_op_pre_dec):
1676         (JSC::JIT::compileBinaryArithOp):
1677         (JSC::JIT::compileFastArith_op_add):
1678         (JSC::JIT::compileFastArith_op_mul):
1679         * jit/JITCall.cpp:
1680         (JSC::JIT::compileOpCall):
1681         (JSC::JIT::compileOpCallSlowCase):
1682         * jit/JITInlineMethods.h:
1683         (JSC::JIT::checkStructure):
1684         (JSC::JIT::emitJumpIfJSCell):
1685         (JSC::JIT::emitJumpIfNotJSCell):
1686         (JSC::JIT::emitJumpIfImmediateNumber):
1687         (JSC::JIT::emitJumpIfNotImmediateNumber):
1688         (JSC::JIT::emitJumpIfImmediateInteger):
1689         (JSC::JIT::emitJumpIfNotImmediateInteger):
1690         (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
1691         * jit/JITPropertyAccess.cpp:
1692         (JSC::JIT::compileGetByIdHotPath):
1693         (JSC::JIT::compilePutByIdHotPath):
1694         (JSC::JIT::privateCompilePutByIdTransition):
1695         (JSC::JIT::privateCompilePatchGetArrayLength):
1696         (JSC::JIT::privateCompileGetByIdProto):
1697         (JSC::JIT::privateCompileGetByIdProtoList):
1698         (JSC::JIT::privateCompileGetByIdChainList):
1699         (JSC::JIT::privateCompileGetByIdChain):
1700         * runtime/RegExp.cpp:
1701         (JSC::RegExp::match):
1702         * wrec/WRECGenerator.cpp:
1703         (JSC::WREC::Generator::generateEnter):
1704         (JSC::WREC::Generator::generateIncrementIndex):
1705         (JSC::WREC::Generator::generateLoadCharacter):
1706         (JSC::WREC::Generator::generateJumpIfNotEndOfInput):
1707         (JSC::WREC::Generator::generateBackreferenceQuantifier):
1708         (JSC::WREC::Generator::generateNonGreedyQuantifier):
1709         (JSC::WREC::Generator::generateGreedyQuantifier):
1710         (JSC::WREC::Generator::generatePatternCharacterPair):
1711         (JSC::WREC::Generator::generatePatternCharacter):
1712         (JSC::WREC::Generator::generateCharacterClassInvertedRange):
1713         (JSC::WREC::Generator::generateCharacterClassInverted):
1714         (JSC::WREC::Generator::generateAssertionBOL):
1715         (JSC::WREC::Generator::generateAssertionEOL):
1716         (JSC::WREC::Generator::generateAssertionWordBoundary):
1717         (JSC::WREC::Generator::generateBackreference):
1718
1719 2009-02-03  David Hyatt  <hyatt@apple.com>
1720
1721         Fix a bug in Vector's shrinkCapacity method.  It did not properly copy elements into the inline buffer
1722         when shrinking down from a size that was greater than the inline capacity.
1723
1724         Reviewed by Maciej
1725
1726         * wtf/Vector.h:
1727         (WTF::VectorBuffer::VectorBuffer):
1728         (WTF::VectorBuffer::allocateBuffer):
1729
1730 2009-02-03  Simon Hausmann  <simon.hausmann@nokia.com>
1731
1732         Reviewed by Tor Arne Vestbø.
1733
1734         Added accessor for JSByteArray storage.
1735
1736         * runtime/JSByteArray.h:
1737         (JSC::JSByteArray::storage):
1738
1739 2009-02-03  Dmitry Titov  <dimich@chromium.org>
1740
1741         Reviewed by Alexey Proskuryakov.
1742
1743         https://bugs.webkit.org/show_bug.cgi?id=23560
1744         Implement SharedTimer on WorkerRunLoop
1745
1746         * JavaScriptCore.exp:
1747         Forgot to expose ThreadCondition::timedWait() in one of previous patches.
1748
1749 2009-02-02  Oliver Hunt  <oliver@apple.com>
1750
1751         Reviewed by Gavin Barraclough.
1752
1753         <https://bugs.webkit.org/show_bug.cgi?id=21414> REGRESSION: Regular Expressions and character classes, shorthands and ranges
1754         <rdar://problem/6543487>
1755
1756         In certain circumstances when WREC::Generator::generateCharacterClassInvertedRange invokes
1757         itself recursively, it will incorrectly emit (and thus consume) the next single character
1758         match in the current character class.  As WREC uses a binary search this out of sequence
1759         codegen could result in a character match being missed and so cause the regex to produce
1760         incorrect results.
1761
1762         * wrec/WRECGenerator.cpp:
1763         (JSC::WREC::Generator::generateCharacterClassInvertedRange):
1764
1765 2009-02-02  Darin Adler  <darin@apple.com>
1766
1767         Reviewed by Dave Hyatt.
1768
1769         Bug 23676: Speed up uses of reserveCapacity on new vectors by adding a new reserveInitialCapacity
1770         https://bugs.webkit.org/show_bug.cgi?id=23676
1771
1772         * API/JSObjectRef.cpp:
1773         (JSObjectCopyPropertyNames): Use reserveInitialCapacity.
1774         * parser/Lexer.cpp:
1775         (JSC::Lexer::Lexer): Ditto.
1776         (JSC::Lexer::clear): Ditto.
1777
1778         * wtf/Vector.h: Added reserveInitialCapacity, a more efficient version of
1779         reserveCapacity for use when the vector is brand new (still size 0 with no
1780         capacity other than the inline capacity).
1781
1782 2009-01-30  Mark Rowe  <mrowe@apple.com>
1783
1784         Rubber-stamped by Oliver Hunt.
1785
1786         <rdar://problem/6391501> Enable the JIT on Mac OS X x86_64 as it passes all tests.
1787
1788         * wtf/Platform.h:
1789
1790 2009-01-30  Oliver Hunt  <oliver@apple.com>
1791
1792         Reviewed by Mark Rowe and Sam Weinig.
1793
1794         Finally fix load() to propagate exceptions correctly.
1795
1796         * jsc.cpp:
1797         (functionLoad):
1798
1799 2009-01-30  David Levin  <levin@chromium.org>
1800
1801         Reviewed by Darin Adler.
1802
1803         https://bugs.webkit.org/show_bug.cgi?id=23618
1804         Templated worker tasks should be more error proof to use.
1805         Fix Chromium build.
1806
1807         * wtf/TypeTraits.h:
1808         (WTF::IsConvertibleToInteger::IsConvertibleToDouble):
1809         Avoid "possible loss of data" warning when using Microsoft's C++ compiler
1810         by avoiding an implicit conversion of int types to doubles.
1811
1812 2009-01-30  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
1813
1814         Reviewed by Simon Hausmann.
1815
1816         Bug 23580: GNU mode RVCT compilation support
1817         <https://bugs.webkit.org/show_bug.cgi?id=23580>
1818
1819         * pcre/pcre_exec.cpp: Use COMPILER(GCC) instead of __GNUC__.
1820         * wtf/FastMalloc.cpp: Ditto.
1821         (WTF::TCMallocStats::):
1822         * wtf/Platform.h: Don't define COMPILER(GCC) with RVCT --gnu.
1823
1824 2009-01-30  David Levin  <levin@chromium.org>
1825
1826         Reviewed by Alexey Proskuryakov.
1827
1828         Bug 23618: Templated worker tasks should be more error proof to use
1829         <https://bugs.webkit.org/show_bug.cgi?id=23618>
1830
1831         Add the type traits needed for the generic worker tasks
1832         and compile asserts for them.
1833
1834         Add a summary header to the TypeTraits.h file to explain what is in there.
1835
1836         Add a note to explain IsPod's deficiencies.
1837
1838         * wtf/TypeTraits.h:
1839
1840 2009-01-30  David Levin  <levin@chromium.org>
1841
1842         Reviewed by Alexey Proskuryakov.
1843
1844         Bug 23616: Various "template helpers" should be consolidated from isolated files in JavaScriptCore.
1845         <https://bugs.webkit.org/show_bug.cgi?id=23616>
1846
1847         * wtf/TypeTraits.h: Moved RemovePointer, IsPod, IsInteger to this file.
1848
1849         * wtf/OwnPtr.h: Use RemovePointer from TypeTraits.h.
1850         * wtf/RetainPtr.h:  Ditto.
1851
1852         * wtf/HashTraits.h: Use IsInteger from TypeTraits.h.
1853
1854         * wtf/VectorTraits.h: Use IsPod from TypeTraits.h.
1855
1856         * GNUmakefile.am:
1857         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
1858         * JavaScriptCore.xcodeproj/project.pbxproj:
1859         Added TypeTraits.h.
1860
1861 2009-01-29  Stephanie Lewis <slewis@apple.com>
1862
1863         RS by Oliver Hunt.
1864
1865         Update the order files.
1866
1867         * JavaScriptCore.order:
1868
1869 2009-01-29  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1870
1871         Reviewed by Oliver Hunt.
1872
1873         Bug 23551: Crash on page load with profiler enabled and running
1874         <https://bugs.webkit.org/show_bug.cgi?id=23551>
1875         <rdar://problem/6529521>
1876
1877         Interpreter::execute(FunctionBodyNode*, ...) calls Profiler::didExecute()
1878         with a stale CallFrame. If some part of the scope chain has already been
1879         freed, Profiler::didExecute() will crash when attempting to get the lexical
1880         global object. The fix is to make the didExecute() call use the caller's
1881         CallFrame, not the one made for the function call. In this case, the
1882         willExecute() call should also be changed to match.
1883
1884         Since this occurs in the actual inspector JS, it is difficult to reduce.
1885         I couldn't make a layout test.
1886
1887         * interpreter/Interpreter.cpp:
1888         (JSC::Interpreter::execute):
1889
1890 2009-01-28  Sam Weinig  <sam@webkit.org>
1891
1892         Reviewed by Gavin Barraclough.
1893
1894         Fix for <rdar://problem/6525537>
1895         Hang occurs when closing Installer window (iTunes, Aperture)
1896
1897         * JavaScriptCore.exp: Export JSGlobalData::sharedInstance.
1898
1899 2009-01-28  Sam Weinig  <sam@webkit.org>
1900
1901         Reviewed by Geoff Garen.
1902
1903         Initial patch by Mark Rowe.
1904
1905         <rdar://problem/6519356>
1906         REGRESSION (r36006): "out of memory" alert running dromaeo on Windows
1907
1908         Report the cost of the ArrayStorage vector more accurately/often.
1909
1910         * runtime/JSArray.cpp:
1911         (JSC::JSArray::JSArray): Report the extra cost even for a filled array
1912         because JSString using the single character optimization and immediates
1913         wont increase the cost themselves. 
1914         (JSC::JSArray::putSlowCase): Update the cost when increasing the size of
1915         the array.
1916         (JSC::JSArray::increaseVectorLength): Ditto.
1917
1918 2009-01-28  Sam Weinig  <sam@webkit.org>
1919
1920         Reviewed by Geoff Garen.
1921
1922         Fix for <rdar://problem/6129678>
1923         REGRESSION (Safari 3-4): Local variable not accessible from Dashcode console or variables view
1924
1925         Iterating the properties of activation objects accessed through the WebKit debugging
1926         APIs was broken by forced conversion of JSActivation to the global object. To fix this,
1927         we use a proxy activation object that acts more like a normal JSObject.
1928
1929         * debugger/DebuggerActivation.cpp: Added.
1930         (JSC::DebuggerActivation::DebuggerActivation):
1931         (JSC::DebuggerActivation::mark):
1932         (JSC::DebuggerActivation::className):
1933         (JSC::DebuggerActivation::getOwnPropertySlot):
1934         (JSC::DebuggerActivation::put):
1935         (JSC::DebuggerActivation::putWithAttributes):
1936         (JSC::DebuggerActivation::deleteProperty):
1937         (JSC::DebuggerActivation::getPropertyNames):
1938         (JSC::DebuggerActivation::getPropertyAttributes):
1939         (JSC::DebuggerActivation::defineGetter):
1940         (JSC::DebuggerActivation::defineSetter):
1941         (JSC::DebuggerActivation::lookupGetter):
1942         (JSC::DebuggerActivation::lookupSetter):
1943         * debugger/DebuggerActivation.h: Added.
1944         Proxy JSActivation object for Debugging.
1945
1946         * runtime/JSActivation.h:
1947         (JSC::JSActivation::isActivationObject): Added.
1948         * runtime/JSObject.h:
1949         (JSC::JSObject::isActivationObject): Added.
1950
1951 2009-01-28  David Kilzer  <ddkilzer@apple.com>
1952
1953         Bug 23490: Remove initialRefCount argument from RefCounted class
1954
1955         <https://bugs.webkit.org/show_bug.cgi?id=23490>
1956
1957         Reviewed by Darin Adler.
1958
1959         RefCountedBase now always starts with a ref count of 1, so there
1960         is no need to pass the initialRefCount into the class anymore.
1961
1962         * wtf/ByteArray.h:
1963         (WTF::ByteArray::ByteArray): Removed call to RefCounted(1).
1964         * wtf/RefCounted.h:
1965         (WTF::RefCountedBase::RefCountedBase): Changed to start with a
1966         ref count of 1.
1967         (WTF::RefCounted::RefCounted): Removed initialRefCount argument
1968         and removed call to RefCounted(1).
1969
1970 2009-01-26  Adele Peterson  <adele@apple.com>
1971
1972         Build fix.  
1973
1974         * debugger/Debugger.cpp:
1975
1976 2009-01-26  Gavin Barraclough  <barraclough@apple.com>
1977
1978         Reviewed by Darin Adler.
1979
1980         Fixes for eq null & neq null, on 64-bit JIT.
1981         https://bugs.webkit.org/show_bug.cgi?id=23559
1982
1983         This patch degrades 64-bit JIT performance on some benchmarks,
1984         due to the whole not-being-incorrect thing.
1985
1986         * jit/JIT.cpp:
1987         (JSC::JIT::privateCompileMainPass):
1988
1989 2009-01-26  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1990
1991         Reviewed by Gavin Barraclough.
1992
1993         Bug 23552: Dashcode evaluator no longer works after making ExecStates actual call frames
1994         <https://bugs.webkit.org/show_bug.cgi?id=23552>
1995         <rdar://problem/6398839>
1996
1997         * JavaScriptCore.exp:
1998         * debugger/Debugger.cpp:
1999         (JSC::evaluateInGlobalCallFrame): Added so that WebScriptCallFrame can
2000         evaluate JS starting from a global call frame.
2001         * debugger/Debugger.h:
2002
2003 2009-01-25  Mark Rowe  <mrowe@apple.com>
2004
2005         Rubber-stamped by Dan Bernstein.
2006
2007         Improve the consistency of settings in our .xcconfig files.
2008
2009         * Configurations/Base.xcconfig: Enable GCC_OBJC_CALL_CXX_CDTORS to match other projects.
2010
2011 2009-01-25  Darin Adler  <darin@apple.com>
2012
2013         Reviewed by Mark Rowe.
2014
2015         Bug 23352: Turn on more compiler warnings in the Mac build
2016         https://bugs.webkit.org/show_bug.cgi?id=23352
2017
2018         Turn on the following warnings:
2019
2020             -Wcast-qual
2021             -Wextra-tokens
2022             -Wformat=2
2023             -Winit-self
2024             -Wmissing-noreturn
2025             -Wpacked
2026             -Wrendundant-decls
2027
2028         * Configurations/Base.xcconfig: Added the new warnings. Switched to -Wextra instead of
2029         -W for clarity since we don't have to support the older versions of gcc that require the
2030         old -W syntax. Since we now use -Wformat=2, removed -Wformat-security. Also removed
2031         -Wno-format-y2k since we can have that one on now.
2032
2033 2009-01-25  Judit Jasz  <jasy@inf.u-szeged.hu>
2034
2035         Reviewed by Darin Adler.
2036         
2037         Compilation problem fixing 
2038         http://bugs.webkit.org/show_bug.cgi?id=23497
2039
2040         * jit/JITCall.cpp:
2041         (JSC::JIT::compileOpCall): Use JSValuePtr::encode.
2042
2043 2009-01-25  Darin Adler  <darin@apple.com>
2044
2045         Reviewed by Sam Weinig.
2046
2047         Bug 23352: Turn on more compiler warnings in the Mac build
2048         https://bugs.webkit.org/show_bug.cgi?id=23352
2049
2050         Fourth patch: Deal with the last few stray warnings.
2051
2052         * parser/Parser.cpp: Only declare jscyyparse if it's not already declared.
2053         This makes both separate compilation and all-in-one compilation work with the
2054         -Wredundant-decls warning.
2055
2056 2009-01-25  Darin Adler  <darin@apple.com>
2057
2058         Reviewed by Sam Weinig.
2059
2060         Bug 23352: Turn on more compiler warnings in the Mac build
2061         https://bugs.webkit.org/show_bug.cgi?id=23352
2062
2063         Third patch: Use the noreturn attribute on functions that don't
2064         return to prepare for the use of the -Wmissing-noreturn warning.
2065
2066         * jit/JITCall.cpp:
2067         (JSC::unreachable): Added NO_RETURN.
2068         * jsc.cpp:
2069         (functionQuit): Ditto.
2070         (printUsageStatement): Ditto.
2071         * wtf/AlwaysInline.h: Added definition of NO_RETURN.
2072
2073 2009-01-24  Oliver Hunt  <oliver@apple.com>
2074
2075         Reviewed by Maciej Stachowiak.
2076
2077         Force inlining of Lexer::matchPunctuator
2078
2079         2.2% win when parsing jQuery, Mootools, Prototype, etc
2080
2081         * parser/Lexer.h:
2082
2083 2009-01-23  Gavin Barraclough  <barraclough@apple.com>
2084
2085         Reviewed by Geoff Garen.
2086
2087         Fix for <rdar://problem/6126212>
2088         Ensure that callbacks out from the JSC interface are only allowed
2089         to return in reverse-chronological order to that in which they were
2090         made.  If we allow earlier callbacks to return first, then this may
2091         result in setions of the RegisterFile in use by another thread
2092         being trampled.
2093
2094         See uber-comment in JSLock.h for details.
2095
2096         * runtime/JSLock.cpp:
2097         (JSC::JSLock::DropAllLocks::DropAllLocks):
2098         (JSC::JSLock::DropAllLocks::~DropAllLocks):
2099
2100 2009-01-23  Darin Adler  <darin@apple.com>
2101
2102         Try to fix WX build.
2103
2104         * runtime/JSGlobalObjectFunctions.h: Include <wtf/unicode/Unicode.h>
2105         for the definition of UChar.
2106
2107 2009-01-23  Anders Carlsson  <andersca@apple.com>
2108
2109         * Configurations/Base.xcconfig:
2110         GCC 4.0 build fix.
2111         
2112         * runtime/JSNumberCell.h:
2113         64-bit build fix.
2114
2115 2009-01-23  Anders Carlsson  <andersca@apple.com>
2116
2117         Reviewed by Sam Weinig.
2118         
2119         Turn on -Wmissing-prototypes and fix the warnings.
2120         
2121         * API/JSClassRef.cpp:
2122         (clearReferenceToPrototype):
2123         * Configurations/Base.xcconfig:
2124         * runtime/Collector.cpp:
2125         (JSC::getPlatformThreadRegisters):
2126         * runtime/ExceptionHelpers.cpp:
2127         (JSC::createError):
2128         * runtime/JSGlobalObjectFunctions.h:
2129         * runtime/JSNumberCell.h:
2130         * runtime/UString.cpp:
2131         (JSC::initializeStaticBaseString):
2132         (JSC::createRep):
2133         * wtf/FastMalloc.cpp:
2134         * wtf/Threading.cpp:
2135
2136 2009-01-22  Mark Rowe  <mrowe@apple.com>
2137
2138         Rubber-stamped by Anders Carlsson.
2139
2140         Disable GCC_WARN_ABOUT_MISSING_PROTOTYPES temporarily.
2141
2142         Current versions of Xcode only respect it for C and Objective-C files,
2143         and our code doesn't currently compile if it is applied to C++ and
2144         Objective-C++ files.
2145
2146         * Configurations/Base.xcconfig:
2147
2148 2009-01-22  Steve Falkenburg  <sfalken@apple.com>
2149
2150         https://bugs.webkit.org/show_bug.cgi?id=23489
2151         
2152         Return currentTime() in correct units for the two early return cases.
2153
2154         Reviewed by Mark Rowe.
2155
2156         * wtf/CurrentTime.cpp:
2157         (WTF::currentTime):
2158
2159 2009-01-22  Sam Weinig  <sam@webkit.org>
2160
2161         Reviewed by Mark Rowe.
2162
2163         Fix for <rdar://problem/6439247>
2164         FastMalloc allocating an extra 4MB of meta-data on 64-bit
2165
2166         Rely on the fact that on all known x86-64 platforms only use 48 bits of
2167         address space to shrink the initial size of the PageMap from ~4MB to 120K.
2168         For 64-bit we still use a 3-level radix tree, but now each level is only 12
2169         bits wide.
2170
2171         No performance change.
2172
2173         * wtf/FastMalloc.cpp:
2174         (WTF::MapSelector): Add specialization for 64 bit that takes into account the
2175         16 bits of unused address space on x86-64.
2176
2177 2009-01-22  Beth Dakin  <bdakin@apple.com>
2178
2179         Reviewed by Sam Weinig.
2180
2181         Fix for https://bugs.webkit.org/show_bug.cgi?id=23461 LayoutTests/
2182         fast/js/numeric-conversion.html is broken, and corresponding 
2183         <rdar://problem/6514842>
2184
2185         The basic problem here is that parseInt(Infinity) should be NaN, 
2186         but we were returning 0. NaN matches Safari 3.2.1 and Firefox.
2187
2188         * runtime/JSGlobalObjectFunctions.cpp:
2189         (JSC::globalFuncParseInt):
2190
2191 2009-01-22  Oliver Hunt  <oliver@apple.com>
2192
2193         Reviewed by Geoff Garen.
2194
2195         <rdar://problem/6516853> (r39682-r39736) JSFunFuzz: crash on "(function(){({ x2: x }), })()"
2196         <https://bugs.webkit.org/show_bug.cgi?id=23479>
2197
2198         Automatic semicolon insertion was resulting in this being accepted in the initial
2199         nodeless parsing, but subsequent reparsing for code generation would fail, leading
2200         to a crash.  The solution is to ensure that reparsing a function performs parsing
2201         in the same state as the initial parse.  We do this by modifying the saved source
2202         ranges to include rather than exclude the opening and closing braces.
2203
2204         * bytecode/CodeBlock.cpp:
2205         (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): add an assertion for successful recompile
2206         * parser/Lexer.h:
2207         (JSC::Lexer::sourceCode): include rather than exclude braces.
2208         * parser/Nodes.h:
2209         (JSC::FunctionBodyNode::toSourceString):  No need to append braces anymore.
2210
2211 2009-01-22  Dmitry Titov  <dimich@chromium.org>
2212
2213         Reviewed by Alexey Proskuryakov.
2214
2215         https://bugs.webkit.org/show_bug.cgi?id=23373
2216
2217         Implement ThreadCondition::timedWait().
2218         Since we borrow the code for condition variables from other sources,
2219         I did the same for timedWait(). See comments in ThreadingWin.cpp for
2220         rationale and more info.
2221
2222         * wtf/CONTRIBUTORS.pthreads-win32: 
2223         Added. A list of Pthreads-win32 contributors mentioned in their license. The license itself
2224         is included into wtf/ThreadingWin32.cpp.
2225
2226         * wtf/Threading.h:
2227         * wtf/ThreadingWin.cpp:
2228         Additional info and Pthreads-win32 license at the beginning.
2229         (WTF::PlatformCondition::timedWait): new method, derived from Pthreads-win32.
2230         (WTF::PlatformCondition::signal): same
2231         (WTF::ThreadCondition::ThreadCondition):
2232         (WTF::ThreadCondition::~ThreadCondition):
2233         (WTF::ThreadCondition::wait): this now calls PlatformCondition::timedWait.
2234         (WTF::ThreadCondition::timedWait): same
2235         (WTF::ThreadCondition::signal): this now calls PlatformCondition::signal.
2236         (WTF::ThreadCondition::broadcast): same
2237
2238 2009-01-21  Gavin Barraclough  <barraclough@apple.com>
2239
2240         Reviewed by Oliver Hunt.
2241
2242         Fix for https://bugs.webkit.org/show_bug.cgi?id=23469.
2243
2244         We need to check all numbers in integer switches, not just those
2245         represented as integer JSImmediates.
2246
2247         * interpreter/Interpreter.cpp:
2248         (JSC::Interpreter::privateExecute):
2249         (JSC::Interpreter::cti_op_switch_imm):
2250
2251 2009-01-21  Gavin Barraclough  <barraclough@apple.com>
2252
2253         Reviewed by Geoff Garen.
2254
2255         Fix for https://bugs.webkit.org/show_bug.cgi?id=23468.
2256
2257         * interpreter/Interpreter.cpp:
2258         (JSC::Interpreter::privateExecute):
2259
2260 2009-01-21  Alexey Proskuryakov  <ap@webkit.org>
2261
2262         Suggested by Oliver Hunt. Reviewed by Oliver Hunt.
2263
2264         https://bugs.webkit.org/show_bug.cgi?id=23456
2265         Function argument names leak
2266
2267         * parser/Nodes.cpp: (JSC::FunctionBodyNode::~FunctionBodyNode): Destruct parameter names.
2268
2269 2009-01-20  Oliver Hunt  <oliver@apple.com>
2270
2271         Reviewed by NOBODY (Build fix).
2272
2273         Windows build fix
2274
2275         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2276
2277 2009-01-20  Gavin Barraclough  <barraclough@apple.com>
2278
2279         Reviewed by Mark Rowe.
2280
2281         Structure property table deleted offset maps are being leaked.
2282         Probably shouldn't be doing that.
2283
2284         https://bugs.webkit.org/show_bug.cgi?id=23442
2285
2286         * runtime/Structure.cpp:
2287         (JSC::Structure::~Structure):
2288
2289 2009-01-20  Oliver Hunt  <oliver@apple.com>
2290
2291         Reviewed by NOBODY (build fix).
2292
2293         Attempt to fix gtk build
2294
2295         * GNUmakefile.am:
2296
2297 2009-01-20  Darin Adler  <darin@apple.com>
2298
2299         * runtime/StringPrototype.cpp:
2300         (JSC::substituteBackreferences): Add back the initialization to fix the build.
2301
2302 2009-01-20  Darin Adler  <darin@apple.com>
2303
2304         Reviewed by Mark Rowe.
2305
2306         Bug 23352: Turn on more compiler warnings in the Mac build
2307         https://bugs.webkit.org/show_bug.cgi?id=23352
2308
2309         First patch: Fix some simple cases of various warnings.
2310
2311         * pcre/pcre_compile.cpp:
2312         (jsRegExpCompile): Use const_cast to change const-ness.
2313
2314         * runtime/StringPrototype.cpp:
2315         (JSC::substituteBackreferences): Remove unneeded initialization and
2316         use UChar instead of unsigned short for UTF-16 values.
2317
2318         * wtf/dtoa.cpp:
2319         (WTF::strtod): Use const_cast to change const-ness.
2320
2321 2009-01-20  Oliver Hunt  <oliver@apple.com>
2322
2323         Reviewed by NOBODY (build fix).
2324
2325         Whoops, remove runtime/ByteArray references from .pri and .scons builds, update .bkl
2326
2327         * JavaScriptCore.pri:
2328         * JavaScriptCore.scons:
2329         * JavaScriptCoreSources.bkl:
2330
2331 2009-01-20  Oliver Hunt  <oliver@apple.com>
2332
2333         RS=Dan Bernstein.
2334
2335         Move runtime/ByteArray to wtf/ByteArray
2336
2337         * GNUmakefile.am:
2338         * JavaScriptCore.exp:
2339         * JavaScriptCore.pri:
2340         * JavaScriptCore.scons:
2341         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2342         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2343         * JavaScriptCore.xcodeproj/project.pbxproj:
2344         * runtime/JSByteArray.cpp:
2345         * runtime/JSByteArray.h:
2346         * wtf/ByteArray.cpp: Renamed from JavaScriptCore/runtime/ByteArray.cpp.
2347         (WTF::ByteArray::create):
2348         * wtf/ByteArray.h: Renamed from JavaScriptCore/runtime/ByteArray.h.
2349         (WTF::ByteArray::length):
2350         (WTF::ByteArray::set):
2351         (WTF::ByteArray::get):
2352         (WTF::ByteArray::data):
2353         (WTF::ByteArray::deref):
2354         (WTF::ByteArray::ByteArray):
2355
2356 2009-01-19  Sam Weinig  <sam@webkit.org>
2357
2358         Rubber-stamped by Gavin Barraclough.
2359
2360         Remove temporary operator-> from JSValuePtr.
2361
2362         * API/JSCallbackFunction.cpp:
2363         (JSC::JSCallbackFunction::call):
2364         * API/JSCallbackObjectFunctions.h:
2365         (JSC::::call):
2366         (JSC::::toNumber):
2367         (JSC::::toString):
2368         * API/JSObjectRef.cpp:
2369         (JSObjectSetPrototype):
2370         * API/JSValueRef.cpp:
2371         (JSValueGetType):
2372         (JSValueIsUndefined):
2373         (JSValueIsNull):
2374         (JSValueIsBoolean):
2375         (JSValueIsNumber):
2376         (JSValueIsString):
2377         (JSValueIsObject):
2378         (JSValueIsObjectOfClass):
2379         (JSValueToBoolean):
2380         (JSValueToNumber):
2381         (JSValueToStringCopy):
2382         (JSValueToObject):
2383         * bytecode/CodeBlock.cpp:
2384         (JSC::valueToSourceString):
2385         (JSC::CodeBlock::mark):
2386         * bytecode/CodeBlock.h:
2387         (JSC::CodeBlock::isKnownNotImmediate):
2388         * bytecompiler/BytecodeGenerator.cpp:
2389         (JSC::BytecodeGenerator::emitEqualityOp):
2390         (JSC::keyForImmediateSwitch):
2391         * interpreter/Interpreter.cpp:
2392         (JSC::jsLess):
2393         (JSC::jsLessEq):
2394         (JSC::jsAddSlowCase):
2395         (JSC::jsAdd):
2396         (JSC::jsTypeStringForValue):
2397         (JSC::jsIsObjectType):
2398         (JSC::jsIsFunctionType):
2399         (JSC::isNotObject):
2400         (JSC::Interpreter::callEval):
2401         (JSC::Interpreter::throwException):
2402         (JSC::cachePrototypeChain):
2403         (JSC::Interpreter::tryCachePutByID):
2404         (JSC::countPrototypeChainEntriesAndCheckForProxies):
2405         (JSC::Interpreter::tryCacheGetByID):
2406         (JSC::Interpreter::privateExecute):
2407         (JSC::Interpreter::tryCTICachePutByID):
2408         (JSC::Interpreter::tryCTICacheGetByID):
2409         (JSC::Interpreter::cti_op_convert_this):
2410         (JSC::Interpreter::cti_op_add):
2411         (JSC::Interpreter::cti_op_pre_inc):
2412         (JSC::Interpreter::cti_op_put_by_id_generic):
2413         (JSC::Interpreter::cti_op_get_by_id_generic):
2414         (JSC::Interpreter::cti_op_put_by_id):
2415         (JSC::Interpreter::cti_op_put_by_id_second):
2416         (JSC::Interpreter::cti_op_put_by_id_fail):
2417         (JSC::Interpreter::cti_op_get_by_id):
2418         (JSC::Interpreter::cti_op_get_by_id_second):
2419         (JSC::Interpreter::cti_op_get_by_id_self_fail):
2420         (JSC::Interpreter::cti_op_get_by_id_proto_list):
2421         (JSC::Interpreter::cti_op_get_by_id_proto_list_full):
2422         (JSC::Interpreter::cti_op_get_by_id_proto_fail):
2423         (JSC::Interpreter::cti_op_get_by_id_array_fail):
2424         (JSC::Interpreter::cti_op_get_by_id_string_fail):
2425         (JSC::Interpreter::cti_op_instanceof):
2426         (JSC::Interpreter::cti_op_del_by_id):
2427         (JSC::Interpreter::cti_op_mul):
2428         (JSC::Interpreter::cti_op_call_JSFunction):
2429         (JSC::Interpreter::cti_op_call_NotJSFunction):
2430         (JSC::Interpreter::cti_op_construct_JSConstruct):
2431         (JSC::Interpreter::cti_op_construct_NotJSConstruct):
2432         (JSC::Interpreter::cti_op_get_by_val):
2433         (JSC::Interpreter::cti_op_get_by_val_byte_array):
2434         (JSC::Interpreter::cti_op_sub):
2435         (JSC::Interpreter::cti_op_put_by_val):
2436         (JSC::Interpreter::cti_op_put_by_val_array):
2437         (JSC::Interpreter::cti_op_put_by_val_byte_array):
2438         (JSC::Interpreter::cti_op_loop_if_true):
2439         (JSC::Interpreter::cti_op_negate):
2440         (JSC::Interpreter::cti_op_div):
2441         (JSC::Interpreter::cti_op_pre_dec):
2442         (JSC::Interpreter::cti_op_not):
2443         (JSC::Interpreter::cti_op_jtrue):
2444         (JSC::Interpreter::cti_op_post_inc):
2445         (JSC::Interpreter::cti_op_lshift):
2446         (JSC::Interpreter::cti_op_bitand):
2447         (JSC::Interpreter::cti_op_rshift):
2448         (JSC::Interpreter::cti_op_bitnot):
2449         (JSC::Interpreter::cti_op_mod):
2450         (JSC::Interpreter::cti_op_post_dec):
2451         (JSC::Interpreter::cti_op_urshift):
2452         (JSC::Interpreter::cti_op_bitxor):
2453         (JSC::Interpreter::cti_op_bitor):
2454         (JSC::Interpreter::cti_op_push_scope):
2455         (JSC::Interpreter::cti_op_is_undefined):
2456         (JSC::Interpreter::cti_op_is_boolean):
2457         (JSC::Interpreter::cti_op_is_number):
2458         (JSC::Interpreter::cti_op_to_jsnumber):
2459         (JSC::Interpreter::cti_op_in):
2460         (JSC::Interpreter::cti_op_put_by_index):
2461         (JSC::Interpreter::cti_op_switch_imm):
2462         (JSC::Interpreter::cti_op_switch_char):
2463         (JSC::Interpreter::cti_op_switch_string):
2464         (JSC::Interpreter::cti_op_del_by_val):
2465         (JSC::Interpreter::cti_op_put_getter):
2466         (JSC::Interpreter::cti_op_put_setter):
2467         (JSC::Interpreter::cti_op_new_error):
2468         * interpreter/Interpreter.h:
2469         (JSC::Interpreter::isJSArray):
2470         (JSC::Interpreter::isJSString):
2471         (JSC::Interpreter::isJSByteArray):
2472         * interpreter/Register.h:
2473         (JSC::Register::marked):
2474         (JSC::Register::mark):
2475         * jit/JITInlineMethods.h:
2476         (JSC::JIT::getConstantOperandImmediateInt):
2477         (JSC::JIT::isOperandConstantImmediateInt):
2478         * jsc.cpp:
2479         (functionPrint):
2480         (functionDebug):
2481         (functionRun):
2482         (functionLoad):
2483         (runWithScripts):
2484         (runInteractive):
2485         * parser/Nodes.cpp:
2486         (JSC::processClauseList):
2487         * profiler/ProfileGenerator.cpp:
2488         (JSC::ProfileGenerator::addParentForConsoleStart):
2489         * profiler/Profiler.cpp:
2490         (JSC::Profiler::createCallIdentifier):
2491         * runtime/ArrayConstructor.cpp:
2492         (JSC::constructArrayWithSizeQuirk):
2493         * runtime/ArrayPrototype.cpp:
2494         (JSC::arrayProtoFuncToString):
2495         (JSC::arrayProtoFuncToLocaleString):
2496         (JSC::arrayProtoFuncJoin):
2497         (JSC::arrayProtoFuncConcat):
2498         (JSC::arrayProtoFuncPop):
2499         (JSC::arrayProtoFuncPush):
2500         (JSC::arrayProtoFuncReverse):
2501         (JSC::arrayProtoFuncShift):
2502         (JSC::arrayProtoFuncSlice):
2503         (JSC::arrayProtoFuncSort):
2504         (JSC::arrayProtoFuncSplice):
2505         (JSC::arrayProtoFuncUnShift):
2506         (JSC::arrayProtoFuncFilter):
2507         (JSC::arrayProtoFuncMap):
2508         (JSC::arrayProtoFuncEvery):
2509         (JSC::arrayProtoFuncForEach):
2510         (JSC::arrayProtoFuncSome):
2511         (JSC::arrayProtoFuncIndexOf):
2512         (JSC::arrayProtoFuncLastIndexOf):
2513         * runtime/BooleanConstructor.cpp:
2514         (JSC::constructBoolean):
2515         (JSC::callBooleanConstructor):
2516         * runtime/BooleanPrototype.cpp:
2517         (JSC::booleanProtoFuncToString):
2518         (JSC::booleanProtoFuncValueOf):
2519         * runtime/Collector.cpp:
2520         (JSC::Heap::protect):
2521         (JSC::Heap::unprotect):
2522         (JSC::Heap::heap):
2523         (JSC::Heap::collect):
2524         (JSC::typeName):
2525         * runtime/Completion.cpp:
2526         (JSC::evaluate):
2527         * runtime/DateConstructor.cpp:
2528         (JSC::constructDate):
2529         (JSC::dateParse):
2530         (JSC::dateUTC):
2531         * runtime/DateInstance.h:
2532         (JSC::DateInstance::internalNumber):
2533         * runtime/DatePrototype.cpp:
2534         (JSC::formatLocaleDate):
2535         (JSC::fillStructuresUsingTimeArgs):
2536         (JSC::fillStructuresUsingDateArgs):
2537         (JSC::dateProtoFuncToString):
2538         (JSC::dateProtoFuncToUTCString):
2539         (JSC::dateProtoFuncToDateString):
2540         (JSC::dateProtoFuncToTimeString):
2541         (JSC::dateProtoFuncToLocaleString):
2542         (JSC::dateProtoFuncToLocaleDateString):
2543         (JSC::dateProtoFuncToLocaleTimeString):
2544         (JSC::dateProtoFuncGetTime):
2545         (JSC::dateProtoFuncGetFullYear):
2546         (JSC::dateProtoFuncGetUTCFullYear):
2547         (JSC::dateProtoFuncToGMTString):
2548         (JSC::dateProtoFuncGetMonth):
2549         (JSC::dateProtoFuncGetUTCMonth):
2550         (JSC::dateProtoFuncGetDate):
2551         (JSC::dateProtoFuncGetUTCDate):
2552         (JSC::dateProtoFuncGetDay):
2553         (JSC::dateProtoFuncGetUTCDay):
2554         (JSC::dateProtoFuncGetHours):
2555         (JSC::dateProtoFuncGetUTCHours):
2556         (JSC::dateProtoFuncGetMinutes):
2557         (JSC::dateProtoFuncGetUTCMinutes):
2558         (JSC::dateProtoFuncGetSeconds):
2559         (JSC::dateProtoFuncGetUTCSeconds):
2560         (JSC::dateProtoFuncGetMilliSeconds):
2561         (JSC::dateProtoFuncGetUTCMilliseconds):
2562         (JSC::dateProtoFuncGetTimezoneOffset):
2563         (JSC::dateProtoFuncSetTime):
2564         (JSC::setNewValueFromTimeArgs):
2565         (JSC::setNewValueFromDateArgs):
2566         (JSC::dateProtoFuncSetYear):
2567         (JSC::dateProtoFuncGetYear):
2568         * runtime/ErrorConstructor.cpp:
2569         (JSC::constructError):
2570         * runtime/ErrorPrototype.cpp:
2571         (JSC::errorProtoFuncToString):
2572         * runtime/ExceptionHelpers.cpp:
2573         (JSC::createError):
2574         (JSC::createErrorMessage):
2575         * runtime/FunctionConstructor.cpp:
2576         (JSC::constructFunction):
2577         * runtime/FunctionPrototype.cpp:
2578         (JSC::functionProtoFuncToString):
2579         (JSC::functionProtoFuncApply):
2580         (JSC::functionProtoFuncCall):
2581         * runtime/GetterSetter.cpp:
2582         (JSC::GetterSetter::toObject):
2583         * runtime/JSActivation.cpp:
2584         (JSC::JSActivation::getOwnPropertySlot):
2585         * runtime/JSArray.cpp:
2586         (JSC::JSArray::put):
2587         (JSC::JSArray::mark):
2588         (JSC::JSArray::sort):
2589         (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key):
2590         (JSC::JSArray::compactForSorting):
2591         * runtime/JSByteArray.h:
2592         (JSC::JSByteArray::setIndex):
2593         * runtime/JSCell.h:
2594         (JSC::asCell):
2595         * runtime/JSFunction.cpp:
2596         (JSC::JSFunction::call):
2597         (JSC::JSFunction::construct):
2598         * runtime/JSGlobalObject.cpp:
2599         (JSC::markIfNeeded):
2600         (JSC::lastInPrototypeChain):
2601         * runtime/JSGlobalObjectFunctions.cpp:
2602         (JSC::encode):
2603         (JSC::decode):
2604         (JSC::globalFuncEval):
2605         (JSC::globalFuncParseInt):
2606         (JSC::globalFuncParseFloat):
2607         (JSC::globalFuncIsNaN):
2608         (JSC::globalFuncIsFinite):
2609         (JSC::globalFuncEscape):
2610         (JSC::globalFuncUnescape):
2611         (JSC::globalFuncJSCPrint):
2612         * runtime/JSImmediate.cpp:
2613         (JSC::JSImmediate::toThisObject):
2614         (JSC::JSImmediate::toObject):
2615         (JSC::JSImmediate::prototype):
2616         (JSC::JSImmediate::toString):
2617         * runtime/JSImmediate.h:
2618         * runtime/JSObject.cpp:
2619         (JSC::JSObject::mark):
2620         (JSC::JSObject::put):
2621         (JSC::callDefaultValueFunction):
2622         (JSC::JSObject::getPrimitiveNumber):
2623         (JSC::JSObject::defineGetter):
2624         (JSC::JSObject::defineSetter):
2625         (JSC::JSObject::lookupGetter):
2626         (JSC::JSObject::lookupSetter):
2627         (JSC::JSObject::hasInstance):
2628         (JSC::JSObject::toNumber):
2629         (JSC::JSObject::toString):
2630         * runtime/JSObject.h:
2631         (JSC::JSObject::JSObject):
2632         (JSC::JSObject::inlineGetOwnPropertySlot):
2633         (JSC::JSObject::getOwnPropertySlotForWrite):
2634         (JSC::JSObject::getPropertySlot):
2635         (JSC::JSValuePtr::get):
2636         * runtime/JSPropertyNameIterator.h:
2637         (JSC::JSPropertyNameIterator::create):
2638         * runtime/JSString.cpp:
2639         (JSC::JSString::getOwnPropertySlot):
2640         * runtime/JSValue.h:
2641         * runtime/JSWrapperObject.cpp:
2642         (JSC::JSWrapperObject::mark):
2643         * runtime/JSWrapperObject.h:
2644         (JSC::JSWrapperObject::setInternalValue):
2645         * runtime/MathObject.cpp:
2646         (JSC::mathProtoFuncAbs):
2647         (JSC::mathProtoFuncACos):
2648         (JSC::mathProtoFuncASin):
2649         (JSC::mathProtoFuncATan):
2650         (JSC::mathProtoFuncATan2):
2651         (JSC::mathProtoFuncCeil):
2652         (JSC::mathProtoFuncCos):
2653         (JSC::mathProtoFuncExp):
2654         (JSC::mathProtoFuncFloor):
2655         (JSC::mathProtoFuncLog):
2656         (JSC::mathProtoFuncMax):
2657         (JSC::mathProtoFuncMin):
2658         (JSC::mathProtoFuncPow):
2659         (JSC::mathProtoFuncRound):
2660         (JSC::mathProtoFuncSin):
2661         (JSC::mathProtoFuncSqrt):
2662         (JSC::mathProtoFuncTan):
2663         * runtime/NativeErrorConstructor.cpp:
2664         (JSC::NativeErrorConstructor::NativeErrorConstructor):
2665         (JSC::NativeErrorConstructor::construct):
2666         * runtime/NumberConstructor.cpp:
2667         (JSC::constructWithNumberConstructor):
2668         (JSC::callNumberConstructor):
2669         * runtime/NumberPrototype.cpp:
2670         (JSC::numberProtoFuncToString):
2671         (JSC::numberProtoFuncToLocaleString):
2672         (JSC::numberProtoFuncValueOf):
2673         (JSC::numberProtoFuncToFixed):
2674         (JSC::numberProtoFuncToExponential):
2675         (JSC::numberProtoFuncToPrecision):
2676         * runtime/ObjectConstructor.cpp:
2677         (JSC::constructObject):
2678         * runtime/ObjectPrototype.cpp:
2679         (JSC::objectProtoFuncValueOf):
2680         (JSC::objectProtoFuncHasOwnProperty):
2681         (JSC::objectProtoFuncIsPrototypeOf):
2682         (JSC::objectProtoFuncDefineGetter):
2683         (JSC::objectProtoFuncDefineSetter):
2684         (JSC::objectProtoFuncLookupGetter):
2685         (JSC::objectProtoFuncLookupSetter):
2686         (JSC::objectProtoFuncPropertyIsEnumerable):
2687         (JSC::objectProtoFuncToLocaleString):
2688         (JSC::objectProtoFuncToString):
2689         * runtime/Operations.h:
2690         (JSC::JSValuePtr::equalSlowCaseInline):
2691         (JSC::JSValuePtr::strictEqual):
2692         (JSC::JSValuePtr::strictEqualSlowCaseInline):
2693         * runtime/Protect.h:
2694         (JSC::gcProtect):
2695         (JSC::gcUnprotect):
2696         * runtime/RegExpConstructor.cpp:
2697         (JSC::setRegExpConstructorInput):
2698         (JSC::setRegExpConstructorMultiline):
2699         (JSC::constructRegExp):
2700         * runtime/RegExpObject.cpp:
2701         (JSC::setRegExpObjectLastIndex):
2702         (JSC::RegExpObject::match):
2703         * runtime/RegExpPrototype.cpp:
2704         (JSC::regExpProtoFuncTest):
2705         (JSC::regExpProtoFuncExec):
2706         (JSC::regExpProtoFuncCompile):
2707         (JSC::regExpProtoFuncToString):
2708         * runtime/StringConstructor.cpp:
2709         (JSC::stringFromCharCodeSlowCase):
2710         (JSC::stringFromCharCode):
2711         (JSC::constructWithStringConstructor):
2712         (JSC::callStringConstructor):
2713         * runtime/StringPrototype.cpp:
2714         (JSC::stringProtoFuncReplace):
2715         (JSC::stringProtoFuncToString):
2716         (JSC::stringProtoFuncCharAt):
2717         (JSC::stringProtoFuncCharCodeAt):
2718         (JSC::stringProtoFuncConcat):
2719         (JSC::stringProtoFuncIndexOf):
2720         (JSC::stringProtoFuncLastIndexOf):
2721         (JSC::stringProtoFuncMatch):
2722         (JSC::stringProtoFuncSearch):
2723         (JSC::stringProtoFuncSlice):
2724         (JSC::stringProtoFuncSplit):
2725         (JSC::stringProtoFuncSubstr):
2726         (JSC::stringProtoFuncSubstring):
2727         (JSC::stringProtoFuncToLowerCase):
2728         (JSC::stringProtoFuncToUpperCase):
2729         (JSC::stringProtoFuncLocaleCompare):
2730         (JSC::stringProtoFuncBig):
2731         (JSC::stringProtoFuncSmall):
2732         (JSC::stringProtoFuncBlink):
2733         (JSC::stringProtoFuncBold):
2734         (JSC::stringProtoFuncFixed):
2735         (JSC::stringProtoFuncItalics):
2736         (JSC::stringProtoFuncStrike):
2737         (JSC::stringProtoFuncSub):
2738         (JSC::stringProtoFuncSup):
2739         (JSC::stringProtoFuncFontcolor):
2740         (JSC::stringProtoFuncFontsize):
2741         (JSC::stringProtoFuncAnchor):
2742         (JSC::stringProtoFuncLink):
2743         * runtime/Structure.cpp:
2744         (JSC::Structure::Structure):
2745         (JSC::Structure::getEnumerablePropertyNames):
2746         (JSC::Structure::createCachedPrototypeChain):
2747         * runtime/Structure.h:
2748         (JSC::Structure::mark):
2749         * runtime/StructureChain.cpp:
2750         (JSC::StructureChain::StructureChain):
2751
2752 2009-01-19  Darin Adler  <darin@apple.com>
2753
2754         Reviewed by Sam Weinig.
2755
2756         Bug 23409: REGRESSION: RegExp 'replace()' function improperly processes '$$'
2757         <https://bugs.webkit.org/show_bug.cgi?id=23409>
2758         <rdar://problem/6505723>
2759
2760         Test: fast/js/string-replace-3.html
2761
2762         * runtime/StringPrototype.cpp:
2763         (JSC::substituteBackreferences): Remove code that adds an extra $ -- not sure
2764         how this ever worked.
2765
2766 2009-01-16  Gavin Barraclough  <barraclough@apple.com>
2767
2768         Reviewed by Oliver Hunt.
2769
2770         On x86-64 jit, cache JSImmedate::TagMask & JSImmedate::TagTypeNumber in
2771         registers, save reloading them every time they're used.
2772
2773         Draws x86-64 jit performance close to that of i386 jit.
2774
2775         * assembler/MacroAssembler.h:
2776         (JSC::MacroAssembler::subPtr):
2777         (JSC::MacroAssembler::jnzPtr):
2778         (JSC::MacroAssembler::jzPtr):
2779         * jit/JIT.cpp:
2780         (JSC::JIT::privateCompileMainPass):
2781         * jit/JIT.h:
2782         * jit/JITArithmetic.cpp:
2783         (JSC::JIT::compileBinaryArithOpSlowCase):
2784         * jit/JITInlineMethods.h:
2785         (JSC::JIT::emitJumpIfJSCell):
2786         (JSC::JIT::emitJumpIfNotJSCell):
2787         (JSC::JIT::emitJumpIfImmediateNumber):
2788         (JSC::JIT::emitJumpIfNotImmediateNumber):
2789         (JSC::JIT::emitJumpIfImmediateInteger):
2790         (JSC::JIT::emitJumpIfNotImmediateInteger):
2791         (JSC::JIT::emitFastArithIntToImmNoCheck):
2792
2793 2009-01-16  Gavin Barraclough  <barraclough@apple.com>
2794
2795         Reviewed by Oliver Hunt.
2796
2797         Add support to x86-64 JIT for inline double precision arithmetic ops.
2798         +5/6% on x86-64, JIT enabled, sunspider.
2799
2800         * assembler/MacroAssembler.h:
2801         (JSC::MacroAssembler::addPtr):
2802         * assembler/X86Assembler.h:
2803         (JSC::X86Assembler::movq_rr):
2804         * jit/JIT.h:
2805         * jit/JITArithmetic.cpp:
2806         (JSC::JIT::compileFastArith_op_pre_inc):
2807         (JSC::JIT::compileBinaryArithOp):
2808         (JSC::JIT::compileBinaryArithOpSlowCase):
2809         (JSC::JIT::compileFastArith_op_add):
2810         (JSC::JIT::compileFastArithSlow_op_add):
2811         (JSC::JIT::compileFastArith_op_mul):
2812         (JSC::JIT::compileFastArithSlow_op_mul):
2813         (JSC::JIT::compileFastArith_op_sub):
2814         (JSC::JIT::compileFastArithSlow_op_sub):
2815         * parser/ResultType.h:
2816         (JSC::ResultType::isReusable):
2817         (JSC::ResultType::isInt32):
2818         (JSC::ResultType::definitelyIsNumber):
2819         (JSC::ResultType::mightBeNumber):
2820         (JSC::ResultType::isNotNumber):
2821         (JSC::ResultType::unknownType):
2822
2823 2009-01-16  Gavin Barraclough  <barraclough@apple.com>
2824
2825         Reviewed by Geoff Garen.
2826
2827         Fixes for SamplingTool.
2828
2829         https://bugs.webkit.org/show_bug.cgi?id=23390
2830
2831         * assembler/MacroAssembler.h:
2832         (JSC::MacroAssembler::storePtr):
2833         * bytecode/SamplingTool.cpp:
2834         (JSC::SamplingTool::run):
2835         (JSC::SamplingTool::dump):
2836         * bytecode/SamplingTool.h:
2837         (JSC::SamplingTool::encodeSample):
2838         * jit/JIT.cpp:
2839         (JSC::JIT::privateCompileMainPass):
2840         (JSC::JIT::privateCompile):
2841         * jit/JIT.h:
2842         (JSC::JIT::samplingToolTrackCodeBlock):
2843         * jit/JITCall.cpp:
2844         (JSC::JIT::compileOpCall):
2845         (JSC::JIT::compileOpCallSlowCase):
2846         * jit/JITInlineMethods.h:
2847         (JSC::JIT::emitCTICall_internal):
2848
2849 2009-01-16  Geoffrey Garen  <ggaren@apple.com>
2850
2851         Reviewed by Darin Adler.
2852         
2853         Fixed <rdar://problem/6452301> REGRESSION: Latest WebKit nightlies
2854         turn "c" into "" when stripping \\c_ character
2855
2856         * wrec/WRECParser.cpp:
2857         (JSC::WREC::Parser::consumeEscape): Mimic a Firefox quirk when parsing
2858         control escapes inside character classes.
2859
2860 2009-01-16  Adam Roben  <aroben@apple.com>
2861
2862         Windows build fix
2863
2864         * wrec/WRECParser.cpp:
2865         (JSC::WREC::Parser::parseParentheses): Removed unreachable code.
2866
2867 2009-01-15  Geoffrey Garen  <ggaren@apple.com>
2868
2869         Reviewed by Cameron Zwarich.
2870         
2871         Fixed <rdar://problem/6471394> REGRESSION (r39164): Discarding quantifier
2872         on assertion gives incorrect result (23075)
2873         
2874         https://bugs.webkit.org/show_bug.cgi?id=23075
2875
2876         * pcre/pcre_compile.cpp:
2877         (compileBranch): Throw away an assertion if it's followed by a quantifier
2878         with a 0 minimum, to match SpiderMonkey, v8, and the ECMA spec.
2879
2880         * wrec/WRECParser.cpp:
2881         (JSC::WREC::Parser::parseParentheses): Fall back on PCRE for the rare
2882         case of an assertion with a quantifier with a 0 minimum, since we
2883         don't handle quantified subexpressions yet, and in this special case,
2884         we can't just throw away the quantifier.
2885
2886 2009-01-15  Gavin Barraclough  <barraclough@apple.com>
2887
2888         Reviewed by Oliver Hunt.
2889
2890         Add support in ResultType to track that the results of bitops
2891         are always of type int32_t.
2892
2893         * parser/Nodes.cpp:
2894         (JSC::ReadModifyResolveNode::emitBytecode):
2895         (JSC::ReadModifyDotNode::emitBytecode):
2896         (JSC::ReadModifyBracketNode::emitBytecode):
2897         * parser/Nodes.h:
2898         (JSC::ExpressionNode::):
2899         (JSC::BooleanNode::):
2900         (JSC::NumberNode::):
2901         (JSC::StringNode::):
2902         (JSC::PrePostResolveNode::):
2903         (JSC::TypeOfResolveNode::):
2904         (JSC::TypeOfValueNode::):
2905         (JSC::UnaryPlusNode::):
2906         (JSC::NegateNode::):
2907         (JSC::BitwiseNotNode::):
2908         (JSC::LogicalNotNode::):
2909         (JSC::MultNode::):
2910         (JSC::DivNode::):
2911         (JSC::ModNode::):
2912         (JSC::SubNode::):
2913         (JSC::LeftShiftNode::):
2914         (JSC::RightShiftNode::):
2915         (JSC::UnsignedRightShiftNode::):
2916         (JSC::LessNode::):
2917         (JSC::GreaterNode::):
2918         (JSC::LessEqNode::):
2919         (JSC::GreaterEqNode::):
2920         (JSC::InstanceOfNode::):
2921         (JSC::EqualNode::):
2922         (JSC::NotEqualNode::):
2923         (JSC::StrictEqualNode::):
2924         (JSC::NotStrictEqualNode::):
2925         (JSC::BitAndNode::):
2926         (JSC::BitOrNode::):
2927         (JSC::BitXOrNode::):
2928         (JSC::LogicalOpNode::):
2929         * parser/ResultType.h:
2930         (JSC::ResultType::isInt32):
2931         (JSC::ResultType::isNotNumber):
2932         (JSC::ResultType::booleanType):
2933         (JSC::ResultType::numberType):
2934         (JSC::ResultType::numberTypeCanReuse):
2935         (JSC::ResultType::numberTypeCanReuseIsInt32):
2936         (JSC::ResultType::stringOrNumberTypeCanReuse):
2937         (JSC::ResultType::stringType):
2938         (JSC::ResultType::unknownType):
2939         (JSC::ResultType::forAdd):
2940         (JSC::ResultType::forBitOp):
2941         (JSC::OperandTypes::OperandTypes):
2942
2943 2009-01-15  Gavin Barraclough  <barraclough@apple.com>
2944
2945         Reviewed by Oliver Hunt.
2946
2947         Add support for integer addition, subtraction and multiplication
2948         in JIT code on x86-64.
2949
2950         * assembler/MacroAssembler.h:
2951         (JSC::MacroAssembler::mul32):
2952         (JSC::MacroAssembler::sub32):
2953         (JSC::MacroAssembler::joMul32):
2954         (JSC::MacroAssembler::joSub32):
2955         * jit/JIT.cpp:
2956         (JSC::JIT::privateCompileMainPass):
2957         (JSC::JIT::privateCompileSlowCases):
2958         * jit/JIT.h:
2959         * jit/JITArithmetic.cpp:
2960         (JSC::JIT::compileFastArith_op_add):
2961         (JSC::JIT::compileFastArithSlow_op_add):
2962         (JSC::JIT::compileFastArith_op_mul):
2963         (JSC::JIT::compileFastArithSlow_op_mul):
2964         (JSC::JIT::compileFastArith_op_sub):
2965         (JSC::JIT::compileFastArithSlow_op_sub):
2966
2967 2009-01-15  Gavin Barraclough  <barraclough@apple.com>
2968
2969         Reviewed by Geoff Garen.
2970
2971         On x86-64 allow JSImmediate to encode 64-bit double precision values.
2972         This patch only affects builds that set USE(ALTERNATE_JSIMMEDIATE).
2973         Updates the implementation of JSValuePtr:: and JSImmediate:: methods
2974         that operate on neumeric values to be be aware of the new representation.
2975         When this representation is in use, the class JSNumberCell is redundant
2976         and is compiled out.
2977
2978         The format of the new immediate representation is documented in JSImmediate.h.
2979
2980         * JavaScriptCore.exp:
2981         * assembler/MacroAssembler.h:
2982         (JSC::MacroAssembler::subPtr):
2983         * assembler/X86Assembler.h:
2984         (JSC::X86Assembler::):
2985         (JSC::X86Assembler::subq_rr):
2986         (JSC::X86Assembler::movq_rr):
2987         (JSC::X86Assembler::ucomisd_rr):
2988         (JSC::X86Assembler::X86InstructionFormatter::twoByteOp64):
2989         * interpreter/Interpreter.cpp:
2990         (JSC::Interpreter::cti_op_stricteq):
2991         (JSC::Interpreter::cti_op_nstricteq):
2992         * jit/JIT.cpp:
2993         (JSC::JIT::compileOpStrictEq):
2994         (JSC::JIT::privateCompileMainPass):
2995         (JSC::JIT::privateCompileSlowCases):
2996         * jit/JIT.h:
2997         * jit/JITArithmetic.cpp:
2998         (JSC::JIT::compileFastArith_op_lshift):
2999         (JSC::JIT::compileFastArith_op_rshift):
3000         (JSC::JIT::compileFastArith_op_bitand):
3001         (JSC::JIT::compileFastArith_op_mod):
3002         (JSC::JIT::compileFastArith_op_add):
3003         (JSC::JIT::compileFastArith_op_mul):
3004         (JSC::JIT::compileFastArith_op_post_inc):
3005         (JSC::JIT::compileFastArith_op_post_dec):
3006         (JSC::JIT::compileFastArith_op_pre_inc):
3007         (JSC::JIT::compileFastArith_op_pre_dec):
3008         (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate):
3009         (JSC::JIT::compileBinaryArithOp):
3010         * jit/JITInlineMethods.h:
3011         (JSC::JIT::emitJumpIfBothJSCells):
3012         (JSC::JIT::emitJumpIfEitherNumber):
3013         (JSC::JIT::emitJumpIfNotEitherNumber):
3014         (JSC::JIT::emitJumpIfImmediateIntegerNumber):
3015         (JSC::JIT::emitJumpIfNotImmediateIntegerNumber):
3016         (JSC::JIT::emitJumpIfNotImmediateIntegerNumbers):
3017         (JSC::JIT::emitJumpSlowCaseIfNotImmediateIntegerNumber):
3018         (JSC::JIT::emitJumpSlowCaseIfNotImmediateIntegerNumbers):
3019         (JSC::JIT::emitFastArithDeTagImmediate):
3020         (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
3021         (JSC::JIT::emitFastArithReTagImmediate):
3022         (JSC::JIT::emitFastArithIntToImmNoCheck):
3023         * runtime/JSCell.h:
3024         * runtime/JSGlobalData.cpp:
3025         (JSC::JSGlobalData::JSGlobalData):
3026         * runtime/JSImmediate.cpp:
3027         (JSC::JSImmediate::toThisObject):
3028         (JSC::JSImmediate::toObject):
3029         (JSC::JSImmediate::toString):
3030         * runtime/JSImmediate.h:
3031         (JSC::wtf_reinterpret_cast):
3032         (JSC::JSImmediate::isNumber):
3033         (JSC::JSImmediate::isIntegerNumber):
3034         (JSC::JSImmediate::isDoubleNumber):
3035         (JSC::JSImmediate::isPositiveIntegerNumber):
3036         (JSC::JSImmediate::areBothImmediateIntegerNumbers):
3037         (JSC::JSImmediate::makeInt):
3038         (JSC::JSImmediate::makeDouble):
3039         (JSC::JSImmediate::doubleValue):
3040         (JSC::doubleToBoolean):
3041         (JSC::JSImmediate::toBoolean):
3042         (JSC::JSImmediate::getTruncatedUInt32):
3043         (JSC::JSImmediate::makeOutOfIntegerRange):
3044         (JSC::JSImmediate::from):
3045         (JSC::JSImmediate::getTruncatedInt32):
3046         (JSC::JSImmediate::toDouble):
3047         (JSC::JSImmediate::getUInt32):
3048         (JSC::JSValuePtr::isInt32Fast):
3049         (JSC::JSValuePtr::isUInt32Fast):
3050         (JSC::JSValuePtr::areBothInt32Fast):
3051         (JSC::JSFastMath::canDoFastBitwiseOperations):
3052         (JSC::JSFastMath::xorImmediateNumbers):
3053         (JSC::JSFastMath::canDoFastRshift):
3054         (JSC::JSFastMath::canDoFastUrshift):
3055         (JSC::JSFastMath::rightShiftImmediateNumbers):
3056         (JSC::JSFastMath::canDoFastAdditiveOperations):
3057         (JSC::JSFastMath::addImmediateNumbers):
3058         (JSC::JSFastMath::subImmediateNumbers):
3059         * runtime/JSNumberCell.cpp:
3060         (JSC::jsNumberCell):
3061         * runtime/JSNumberCell.h:
3062         (JSC::createNumberStructure):
3063         (JSC::isNumberCell):
3064         (JSC::asNumberCell):
3065         (JSC::jsNumber):
3066         (JSC::JSValuePtr::isDoubleNumber):
3067         (JSC::JSValuePtr::getDoubleNumber):
3068         (JSC::JSValuePtr::isNumber):
3069         (JSC::JSValuePtr::uncheckedGetNumber):
3070         (JSC::jsNaN):
3071         (JSC::JSValuePtr::getNumber):
3072         (JSC::JSValuePtr::numberToInt32):
3073         (JSC::JSValuePtr::numberToUInt32):
3074         * runtime/JSValue.h:
3075         * runtime/NumberConstructor.cpp:
3076         (JSC::numberConstructorNegInfinity):
3077         (JSC::numberConstructorPosInfinity):
3078         (JSC::numberConstructorMaxValue):
3079         (JSC::numberConstructorMinValue):
3080         * runtime/NumberObject.cpp:
3081         (JSC::constructNumber):
3082         * runtime/NumberObject.h:
3083         * runtime/Operations.h:
3084         (JSC::JSValuePtr::equal):
3085         (JSC::JSValuePtr::equalSlowCaseInline):
3086         (JSC::JSValuePtr::strictEqual):
3087         (JSC::JSValuePtr::strictEqualSlowCaseInline):
3088         * wtf/Platform.h:
3089
3090 2009-01-15  Sam Weinig  <sam@webkit.org>
3091
3092         Reviewed by Geoffrey Garen.
3093
3094         <rdar://problem/6045018>
3095         REGRESSION (r34838): JavaScript objects appear to be leaked after loading google.com
3096
3097         Subtract the number of JSStrings cached in SmallStrings when calculating the
3098         number of live JSObjects.
3099
3100         * runtime/Collector.cpp:
3101         (JSC::Heap::objectCount):
3102         * runtime/SmallStrings.cpp:
3103         (JSC::SmallStrings::count):
3104         * runtime/SmallStrings.h:
3105
3106 2009-01-15  Sam Weinig  <sam@webkit.org>
3107
3108         Fix Qt build.
3109
3110         * runtime/Collector.cpp:
3111
3112 2009-01-15  Sam Weinig  <sam@webkit.org>
3113
3114         Reviewed by Gavin Barraclough.
3115
3116         Fix crash seen running fast/canvas.
3117
3118         Make sure to mark the ScopeNode and CodeBlock being created
3119         in the re-parse for exception information.
3120
3121         * bytecode/CodeBlock.cpp:
3122         (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
3123         * parser/Nodes.h:
3124         (JSC::ScopeNode::mark):
3125         * runtime/Collector.cpp:
3126         (JSC::Heap::collect):
3127         * runtime/JSGlobalData.cpp:
3128         (JSC::JSGlobalData::JSGlobalData):
3129         * runtime/JSGlobalData.h:
3130
3131 2009-01-15  Craig Schlenter  <craig.schlenter@gmail.com>
3132
3133         Reviewed by Darin Adler.
3134
3135         https://bugs.webkit.org/show_bug.cgi?id=23347
3136         Compilation of JavaScriptCore/wtf/ThreadingPthreads.cpp fails on Linux
3137
3138         * wtf/ThreadingPthreads.cpp: included limits.h as INT_MAX is defined there.
3139
3140 2009-01-15  Oliver Hunt  <oliver@apple.com>
3141
3142         Reviewed by Geoff Garen.
3143
3144         Bug 23225: REGRESSION: Assertion failure in reparseInPlace() (m_sourceElements) at sfgate.com
3145         <https://bugs.webkit.org/show_bug.cgi?id=23225> <rdar://problem/6487432>
3146
3147         Character position for open and closing brace was incorrectly referencing m_position to
3148         record their position in a source document, however this is unsafe as BOMs may lead to
3149         m_position being an arbitrary position from the real position of the current character.
3150
3151         * parser/Lexer.cpp:
3152         (JSC::Lexer::matchPunctuator):
3153
3154 2009-01-14  David Kilzer  <ddkilzer@apple.com>
3155
3156         Bug 23153: JSC build always touches JavaScriptCore/docs/bytecode.html
3157
3158         <https://bugs.webkit.org/show_bug.cgi?id=23153>
3159
3160         Reviewed by Darin Adler.
3161
3162         Instead of building bytecode.html into ${SRCROOT}/docs/bytecode.html, build it
3163         into ${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore/docs/bytecode.html.
3164
3165         Also fixes make-bytecode-docs.pl to actually generate documentation.
3166
3167         * DerivedSources.make: Changed bytecode.html to be built into local docs
3168         directory in ${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore.
3169         * JavaScriptCore.xcodeproj/project.pbxproj: Added "/docs" to the end of the
3170         "mkdir -p" command so that the docs subdirectory is automatically created.
3171         * docs/make-bytecode-docs.pl: Changed BEGIN_OPCODE to DEFINE_OPCODE so that
3172         documentation is actually generated.
3173
3174 2009-01-14  Adam Treat  <adam.treat@torchmobile.com>
3175
3176         Build fix for Qt from Dmitry Titov.
3177
3178         * wtf/ThreadingQt.cpp:
3179         (WTF::ThreadCondition::timedWait):
3180
3181 2009-01-14  Oliver Hunt  <oliver@apple.com>
3182
3183         Reviewed by Cameron Zwarich.
3184
3185         Bug 22903: REGRESSION (r36267): visiting this site reliably crashes WebKit nightly
3186
3187         EvalCodeBlock's do not reference the functions that are declared inside the eval
3188         code, this means that simply marking the EvalCodeBlock through the global object
3189         is insufficient to mark the declared functions.  This patch corrects this by
3190         explicitly marking the CodeBlocks of all the functions declared in the cached
3191         EvalNode.
3192
3193         * bytecode/CodeBlock.cpp:
3194         (JSC::CodeBlock::mark):
3195         * bytecode/CodeBlock.h:
3196         (JSC::CodeBlock::hasFunctions):
3197         * bytecode/EvalCodeCache.h:
3198         (JSC::EvalCodeCache::mark):
3199         * parser/Nodes.cpp:
3200         (JSC::ScopeNodeData::mark):
3201         (JSC::EvalNode::mark):
3202         * parser/Nodes.h:
3203
3204 2009-01-14  Dmitry Titov  <dimich@chromium.org>
3205
3206         Reviewed by Alexey Proskuryakov.
3207
3208         https://bugs.webkit.org/show_bug.cgi?id=23312
3209         Implement MessageQueue::waitForMessageTimed()
3210         Also fixed ThreadCondition::timedWait() to take absolute time, as discussed on webkit-dev.
3211         Win32 version of timedWait still has to be implemented.
3212
3213         * wtf/MessageQueue.h:
3214         (WTF::MessageQueueWaitResult: new enum for the result of MessageQueue::waitForMessageTimed.
3215         (WTF::MessageQueue::waitForMessage):
3216         (WTF::MessageQueue::waitForMessageTimed): New method.
3217         * wtf/Threading.h:
3218         * wtf/ThreadingGtk.cpp:
3219         (WTF::ThreadCondition::timedWait): changed to use absolute time instead of interval.
3220         * wtf/ThreadingNone.cpp:
3221         (WTF::ThreadCondition::timedWait): ditto.
3222         * wtf/ThreadingPthreads.cpp:
3223         (WTF::ThreadCondition::timedWait): ditto.
3224         * wtf/ThreadingQt.cpp:
3225         (WTF::ThreadCondition::timedWait): ditto.
3226         * wtf/ThreadingWin.cpp:
3227         (WTF::ThreadCondition::timedWait): ditto. The actual Win32 code is still to be implemented.
3228
3229 2009-01-14  Dean McNamee  <deanm@chromium.org>
3230
3231         Reviewed by Darin Adler and Oliver hunt.
3232
3233         Correctly match allocation functions by implementing a custom deref().
3234
3235         https://bugs.webkit.org/show_bug.cgi?id=23315
3236
3237         * runtime/ByteArray.h:
3238         (JSC::ByteArray::deref):
3239         (JSC::ByteArray::ByteArray):
3240
3241 2009-01-14  Dan Bernstein  <mitz@apple.com>
3242
3243         Reviewed by John Sullivan.
3244
3245         - update copyright
3246
3247         * Info.plist:
3248
3249 2009-01-13  Beth Dakin  <bdakin@apple.com>
3250
3251         Reviewed by Darin Adler and Oliver Hunt.
3252
3253         <rdar://problem/6489314> REGRESSION: Business widget's front side 
3254         fails to render correctly when flipping widget
3255
3256         The problem here is that parseInt was parsing NaN as 0. This patch 
3257         corrects that by parsing NaN as NaN. This matches our old behavior 
3258         and Firefox. 
3259
3260         * runtime/JSGlobalObjectFunctions.cpp:
3261         (JSC::globalFuncParseInt):
3262
3263 2009-01-13  Gavin Barraclough  <barraclough@apple.com>
3264
3265         Reviewed by Oliver Hunt.
3266
3267         Fix for: https://bugs.webkit.org/show_bug.cgi?id=23292
3268
3269         Implementation of two argument canDoFastAdditiveOperations does not correlate well with reality.
3270
3271         * runtime/JSImmediate.h:
3272         (JSC::JSFastMath::canDoFastAdditiveOperations):
3273
3274 2009-01-13  Zalan Bujtas  <zbujtas@gmail.com>
3275
3276         Reviewed by Darin Adler.
3277
3278         https://bugs.webkit.org/show_bug.cgi?id=23290
3279         Fix JSImmediate::isImmediate(src) to !src->isCell()
3280
3281         * interpreter/Interpreter.cpp:
3282         (JSC::Interpreter::privateExecute):
3283
3284 2009-01-13  Dmitry Titov  <dimich@chromium.org>
3285
3286         Reviewed by Darin Adler.
3287
3288         https://bugs.webkit.org/show_bug.cgi?id=23281
3289         Fix the Chromium Win build.
3290         Need to use PLATFORM(WIN_OS) instead of PLATFORM(WIN).
3291         Moved GTK and WX up in #if sequence because they could come with WIN_OS too,
3292         while they have their own implementation even on Windows.
3293
3294         * wtf/CurrentTime.cpp:
3295         (WTF::currentTime):
3296
3297 2009-01-12  Gavin Barraclough  <barraclough@apple.com>
3298
3299         Reviewed by Oliver Hunt.
3300
3301         Make the JSImmediate interface private.
3302
3303         All manipulation of JS values should be through the JSValuePtr class, not by using JSImmediate
3304         directly.  The key missing methods on JSValuePtr are:
3305
3306             * isCell() - check for values that are JSCell*s, and as such where asCell() may be used.
3307             * isInt32Fast() getInt32Fast() - fast check/access for integer immediates.
3308             * isUInt32Fast() getUInt32Fast() - ditto for unsigned integer immediates.
3309
3310         The JIT is allowed full access to JSImmediate, since it needs to be able to directly
3311         manipulate JSValuePtrs.  The Interpreter is provided access to perform operations directly
3312         on JSValuePtrs through the new JSFastMath interface.
3313
3314         No performance impact.
3315
3316         * API/JSCallbackObjectFunctions.h:
3317         (JSC::::toNumber):
3318         * API/JSValueRef.cpp:
3319         (JSValueIsEqual):
3320         (JSValueIsStrictEqual):
3321         * JavaScriptCore.exp:
3322         * bytecode/CodeBlock.h:
3323         (JSC::CodeBlock::isKnownNotImmediate):
3324         * bytecompiler/BytecodeGenerator.cpp:
3325         (JSC::keyForImmediateSwitch):
3326         * bytecompiler/BytecodeGenerator.h:
3327         (JSC::BytecodeGenerator::JSValueHashTraits::constructDeletedValue):
3328         (JSC::BytecodeGenerator::JSValueHashTraits::isDeletedValue):
3329         * interpreter/Interpreter.cpp:
3330         (JSC::jsLess):
3331         (JSC::jsLessEq):
3332         (JSC::jsAdd):
3333         (JSC::jsIsObjectType):
3334         (JSC::cachePrototypeChain):
3335         (JSC::Interpreter::tryCachePutByID):
3336         (JSC::Interpreter::tryCacheGetByID):
3337         (JSC::Interpreter::privateExecute):
3338         (JSC::Interpreter::tryCTICachePutByID):
3339         (JSC::Interpreter::tryCTICacheGetByID):
3340         (JSC::Interpreter::cti_op_add):
3341         (JSC::Interpreter::cti_op_get_by_id_self_fail):
3342         (JSC::Interpreter::cti_op_get_by_id_proto_list):
3343         (JSC::Interpreter::cti_op_instanceof):
3344         (JSC::Interpreter::cti_op_mul):
3345         (JSC::Interpreter::cti_op_get_by_val):
3346         (JSC::Interpreter::cti_op_get_by_val_byte_array):
3347         (JSC::Interpreter::cti_op_sub):
3348         (JSC::Interpreter::cti_op_put_by_val):
3349         (JSC::Interpreter::cti_op_put_by_val_array):
3350         (JSC::Interpreter::cti_op_put_by_val_byte_array):
3351         (JSC::Interpreter::cti_op_negate):
3352         (JSC::Interpreter::cti_op_div):
3353         (JSC::Interpreter::cti_op_eq):
3354         (JSC::Interpreter::cti_op_lshift):
3355         (JSC::Interpreter::cti_op_bitand):
3356         (JSC::Interpreter::cti_op_rshift):
3357         (JSC::Interpreter::cti_op_bitnot):
3358         (JSC::Interpreter::cti_op_neq):
3359         (JSC::Interpreter::cti_op_urshift):
3360         (JSC::Interpreter::cti_op_call_eval):
3361         (JSC::Interpreter::cti_op_throw):
3362         (JSC::Interpreter::cti_op_is_undefined):
3363         (JSC::Interpreter::cti_op_stricteq):
3364         (JSC::Interpreter::cti_op_nstricteq):
3365         (JSC::Interpreter::cti_op_switch_imm):
3366         (JSC::Interpreter::cti_vm_throw):
3367         * interpreter/Interpreter.h:
3368         (JSC::Interpreter::isJSArray):
3369         (JSC::Interpreter::isJSString):
3370         (JSC::Interpreter::isJSByteArray):
3371         * jit/JIT.cpp:
3372         (JSC::JIT::compileOpStrictEq):
3373         (JSC::JIT::privateCompileMainPass):
3374         * jit/JIT.h:
3375         (JSC::JIT::isStrictEqCaseHandledInJITCode):
3376         * jit/JITArithmetic.cpp:
3377         (JSC::JIT::compileFastArith_op_rshift):
3378         (JSC::JIT::compileFastArith_op_bitand):
3379         (JSC::JIT::compileFastArith_op_mod):
3380         * jit/JITCall.cpp:
3381         (JSC::JIT::unlinkCall):
3382         (JSC::JIT::compileOpCall):
3383         * jit/JITInlineMethods.h:
3384         (JSC::JIT::getConstantOperandImmediateInt):
3385         (JSC::JIT::isOperandConstantImmediateInt):
3386         * parser/Nodes.cpp:
3387         (JSC::processClauseList):
3388         * runtime/ArrayPrototype.cpp:
3389         (JSC::arrayProtoFuncIndexOf):
3390         (JSC::arrayProtoFuncLastIndexOf):
3391         * runtime/BooleanPrototype.cpp:
3392         (JSC::booleanProtoFuncValueOf):
3393         * runtime/Collector.cpp:
3394         (JSC::Heap::protect):
3395         (JSC::Heap::unprotect):
3396         (JSC::Heap::heap):
3397         * runtime/JSByteArray.cpp:
3398         (JSC::JSByteArray::getOwnPropertySlot):
3399         * runtime/JSByteArray.h:
3400         (JSC::JSByteArray::getIndex):
3401         * runtime/JSCell.cpp:
3402         * runtime/JSCell.h:
3403         (JSC::JSValuePtr::isNumberCell):
3404         (JSC::JSValuePtr::asCell):
3405         (JSC::JSValuePtr::isNumber):
3406         * runtime/JSGlobalObjectFunctions.cpp:
3407         (JSC::globalFuncParseInt):
3408         * runtime/JSImmediate.h:
3409         (JSC::js0):
3410         (JSC::jsImpossibleValue):
3411         (JSC::JSValuePtr::toInt32):
3412         (JSC::JSValuePtr::toUInt32):
3413         (JSC::JSValuePtr::isCell):
3414         (JSC::JSValuePtr::isInt32Fast):
3415         (JSC::JSValuePtr::getInt32Fast):
3416         (JSC::JSValuePtr::isUInt32Fast):
3417         (JSC::JSValuePtr::getUInt32Fast):
3418         (JSC::JSValuePtr::makeInt32Fast):
3419         (JSC::JSValuePtr::areBothInt32Fast):
3420         (JSC::JSFastMath::canDoFastBitwiseOperations):
3421         (JSC::JSFastMath::equal):
3422         (JSC::JSFastMath::notEqual):
3423         (JSC::JSFastMath::andImmediateNumbers):
3424         (JSC::JSFastMath::xorImmediateNumbers):
3425         (JSC::JSFastMath::orImmediateNumbers):
3426         (JSC::JSFastMath::canDoFastRshift):
3427         (JSC::JSFastMath::canDoFastUrshift):
3428         (JSC::JSFastMath::rightShiftImmediateNumbers):
3429         (JSC::JSFastMath::canDoFastAdditiveOperations):
3430         (JSC::JSFastMath::addImmediateNumbers):
3431         (JSC::JSFastMath::subImmediateNumbers):
3432         (JSC::JSFastMath::incImmediateNumber):
3433         (JSC::JSFastMath::decImmediateNumber):
3434         * runtime/JSNumberCell.h:
3435         (JSC::JSValuePtr::asNumberCell):
3436         (JSC::jsNumber):
3437         (JSC::JSValuePtr::uncheckedGetNumber):
3438         (JSC::JSNumberCell::toInt32):
3439         (JSC::JSNumberCell::toUInt32):
3440         (JSC::JSValuePtr::toJSNumber):
3441         (JSC::JSValuePtr::getNumber):
3442         (JSC::JSValuePtr::numberToInt32):
3443         (JSC::JSValuePtr::numberToUInt32):
3444         * runtime/JSObject.h:
3445         (JSC::JSValuePtr::isObject):
3446         (JSC::JSValuePtr::get):
3447         (JSC::JSValuePtr::put):
3448         * runtime/JSValue.cpp:
3449         (JSC::JSValuePtr::toInteger):
3450         (JSC::JSValuePtr::toIntegerPreserveNaN):
3451         * runtime/JSValue.h:
3452         * runtime/Operations.cpp:
3453         (JSC::JSValuePtr::equalSlowCase):
3454         (JSC::JSValuePtr::strictEqualSlowCase):
3455         * runtime/Operations.h:
3456         (JSC::JSValuePtr::equal):
3457         (JSC::JSValuePtr::equalSlowCaseInline):
3458         (JSC::JSValuePtr::strictEqual):
3459         (JSC::JSValuePtr::strictEqualSlowCaseInline):
3460         * runtime/Protect.h:
3461         (JSC::gcProtect):
3462         (JSC::gcUnprotect):
3463         * runtime/StringPrototype.cpp:
3464         (JSC::stringProtoFuncCharAt):
3465         (JSC::stringProtoFuncCharCodeAt):
3466         * runtime/Structure.cpp:
3467         (JSC::Structure::createCachedPrototypeChain):
3468
3469 2009-01-12  Kevin Ollivier  <kevino@theolliviers.com>
3470
3471         Since date time functions have moved here, now the wx port JSC
3472         needs to depend on wx.
3473
3474         * jscore.bkl:
3475
3476 2009-01-11  David Levin  <levin@chromium.org>
3477
3478         Reviewed by Darin Adler.
3479
3480         https://bugs.webkit.org/show_bug.cgi?id=23245
3481
3482         Add initializeThreading to key places in JS API to ensure that
3483         UString is properly initialized.
3484
3485         * API/JSContextRef.cpp:
3486         (JSContextGroupCreate):
3487         (JSGlobalContextCreate):
3488         * API/JSObjectRef.cpp:
3489         (JSClassCreate):
3490         * API/JSStringRef.cpp:
3491         (JSStringCreateWithCharacters):
3492         (JSStringCreateWithUTF8CString):
3493         * API/JSStringRefCF.cpp:
3494         (JSStringCreateWithCFString):
3495
3496 2009-01-11  David Levin  <levin@chromium.org>
3497
3498         Reviewed by Darin Adler.
3499
3500         https://bugs.webkit.org/show_bug.cgi?id=23175
3501
3502         Separate out BaseString information from UString::Rep and make all baseString access go through
3503         a member function, so that it may be used for something else (in the future) in the BaseString
3504         case.
3505
3506         * runtime/SmallStrings.cpp:
3507         (JSC::SmallStringsStorage::rep):
3508         (JSC::SmallStringsStorage::SmallStringsStorage):
3509         (JSC::SmallStrings::SmallStrings):
3510         (JSC::SmallStrings::mark):
3511         Adjust to account for the changes in UString and put the UString in place in
3512         SmallStringsStorage to aid in locality of reference among the UChar[] and UString::Rep's.
3513
3514         * runtime/SmallStrings.h:
3515         * runtime/UString.cpp:
3516         (JSC::initializeStaticBaseString):
3517         (JSC::initializeUString):
3518         (JSC::UString::Rep::create):
3519         (JSC::UString::Rep::destroy):
3520         (JSC::UString::Rep::checkConsistency):
3521         (JSC::expandCapacity):
3522         (JSC::UString::expandPreCapacity):
3523         (JSC::concatenate):
3524         (JSC::UString::append):
3525         (JSC::UString::operator=):
3526         * runtime/UString.h:
3527         (JSC::UString::Rep::baseIsSelf):
3528         (JSC::UString::Rep::setBaseString):
3529         (JSC::UString::Rep::baseString):
3530         (JSC::UString::Rep::):
3531         (JSC::UString::Rep::null):
3532         (JSC::UString::Rep::empty):
3533         (JSC::UString::Rep::data):
3534         (JSC::UString::cost):
3535         Separate out the items out used by base strings from those used in Rep's that only
3536         point to base strings.  (This potentially saves 24 bytes per Rep.)
3537
3538 2009-01-11  Darin Adler  <darin@apple.com>
3539
3540         Reviewed by Dan Bernstein.
3541
3542         Bug 23239: improve handling of unused arguments in JavaScriptCore
3543         https://bugs.webkit.org/show_bug.cgi?id=23239
3544
3545         * runtime/DatePrototype.cpp: Moved LocaleDateTimeFormat enum outside #if
3546         so we can use this on all platforms. Changed valueOf to share the same
3547         function with getTime, since the contents of the two are identical. Removed
3548         a FIXME since the idea isn't really specific enough or helpful enough to
3549         need to sit here in the source code.
3550         (JSC::formatLocaleDate): Changed the Mac version of this function to take
3551         the same arguments as the non-Mac version so the caller doesn't have to
3552         special-case the two platforms. Also made the formatString array be const;
3553         before the characters were, but the array was a modifiable global variable.
3554         (JSC::dateProtoFuncToLocaleString): Changed to call the new unified