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