]> git.saurik.com Git - apple/javascriptcore.git/blob - ChangeLog-2008-08-10
JavaScriptCore-7600.1.4.16.1.tar.gz
[apple/javascriptcore.git] / ChangeLog-2008-08-10
1 2008-08-10 Jan Michael Alonzo <jmalonzo@webkit.org>
2
3 Reviewed (and updated) by Alp Toker.
4
5 https://bugs.webkit.org/show_bug.cgi?id=16620
6 [GTK] Autotools make dist and make check support
7
8 Get make dist working.
9
10 Note that not all possible configurations have been tested yet.
11
12 * GNUmakefile.am:
13
14 2008-08-09 Alexey Proskuryakov <ap@webkit.org>
15
16 Reviewed by Sam Weinig.
17
18 Added same heap debug checks to more code paths.
19
20 * kjs/JSActivation.cpp:
21 (KJS::JSActivation::put):
22 (KJS::JSActivation::putWithAttributes):
23 * kjs/JSGlobalObject.cpp:
24 (KJS::JSGlobalObject::putWithAttributes):
25 * kjs/JSObject.h:
26 (KJS::JSObject::putDirect):
27 * kjs/JSVariableObject.h:
28 (KJS::JSVariableObject::symbolTablePut):
29 (KJS::JSVariableObject::symbolTablePutWithAttributes):
30
31 2008-08-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
32
33 Reviewed by Maciej.
34
35 Fix some style issues in the sampling tool.
36
37 * VM/SamplingTool.cpp:
38 (KJS::sleepForMicroseconds):
39 (KJS::SamplingTool::dump):
40
41 2008-08-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
42
43 Reviewed by Oliver.
44
45 Revision 35651, despite being a rather trivial change, introduced a
46 large regression on the regexp-dna SunSpider test. This regression
47 stemmed from an increase in the size of CodeBlock::dump(). There is
48 no reason for this method (and several related methods) to be compiled
49 in non-debug builds with the sampling tool disabled. This patch
50 conditionally compiles them, reversing the regression on SunSpider.
51
52 * JavaScriptCore.exp:
53 * VM/CodeBlock.cpp:
54 * VM/CodeBlock.h:
55 * VM/Machine.cpp:
56
57 2008-08-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
58
59 Reviewed by Oliver.
60
61 Bug 20330: JSCore crash loading any filehurricane media page
62 <https://bugs.webkit.org/show_bug.cgi?id=20330>
63
64 Fix a typo in the constant loading patch. Also, add a case for
65 op_unexpected_load to CodeBlock::dump().
66
67 * VM/CodeBlock.cpp:
68 (KJS::CodeBlock::dump):
69 * VM/CodeGenerator.cpp:
70 (KJS::CodeGenerator::addUnexpectedConstant):
71
72 2008-08-08 Matt Lilek <webkit@mattlilek.com>
73
74 Not reviewed, build fix.
75
76 * JavaScriptCore.exp:
77
78 2008-08-08 Oliver Hunt <oliver@apple.com>
79
80 Reviewed by Cameron Zwarich.
81
82 Improve performance of arithmetic operators
83
84 Added a fast (non-virtual) mechanism to determine if a non-immediate JSValue*
85 is a JSNumberCell. We then use this to allow improved specialisation in many
86 arithmetic operators. SunSpider reports a 2.5% progression overall, with greater
87 than 10% progressions on a number of arithmetic heavy tests.
88
89 * VM/Machine.cpp:
90 (KJS::fastIsNumber):
91 (KJS::fastToInt32):
92 (KJS::fastToUInt32):
93 (KJS::jsLess):
94 (KJS::jsLessEq):
95 (KJS::jsAdd):
96 (KJS::Machine::privateExecute):
97 * kjs/JSNumberCell.h:
98 (KJS::JSNumberCell::fastToInt32):
99 (KJS::JSNumberCell::fastToUInt32):
100 * kjs/collector.cpp:
101 (KJS::allocateBlock):
102 (KJS::Heap::heapAllocate):
103 * kjs/collector.h:
104 (KJS::Heap::fastIsNumber):
105
106 2008-08-06 Adam Roben <aroben@apple.com>
107
108 Try to fix the Windows build bots
109
110 * API/JSBase.cpp: Touch this to force JSC to rebuild and re-copy the
111 WTF headers.
112
113 2008-08-06 Tor Arne Vestbø <tavestbo@trolltech.com>
114
115 Revert change 35595.
116
117 * wtf/RetainPtr.h:
118
119 2008-08-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
120
121 Fix non-Mac build.
122
123 * wtf/RetainPtr.h: CoreFoundation only for PLATFORM(MAC)
124
125 2008-08-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
126
127 Fix non-Mac build.
128
129 * wtf/RetainPtr.h: CoreFoundation only for PLATFORM(MAC)
130
131 2008-08-06 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
132
133 Reviewed by Darin. Landed by Cameron.
134
135 Bug 20272: typo in JavaScriptCore
136 <https://bugs.webkit.org/show_bug.cgi?id=20272>
137
138 Correct the documentation for op_not. (typo)
139 Fix #undef. (typo)
140
141 * VM/Machine.cpp:
142 (KJS::Machine::privateExecute):
143
144 2008-08-06 Cameron Zwarich <cwzwarich@webkit.org>
145
146 Reviewed by Maciej.
147
148 Bug 20286: Load constants all at once instead of using op_load
149 <https://bugs.webkit.org/show_bug.cgi?id=20286>
150
151 Load constants all at once into temporary registers instead of using
152 individual instances of op_load.
153
154 This is a 2.6% speedup on SunSpider.
155
156 * JavaScriptCore.exp:
157 * VM/CodeBlock.cpp:
158 (KJS::CodeBlock::dump):
159 (KJS::CodeBlock::mark):
160 * VM/CodeBlock.h:
161 * VM/CodeGenerator.cpp:
162 (KJS::CodeGenerator::CodeGenerator):
163 (KJS::CodeGenerator::newTemporary):
164 (KJS::CodeGenerator::addConstant):
165 (KJS::CodeGenerator::addUnexpectedConstant):
166 (KJS::CodeGenerator::emitLoad):
167 (KJS::CodeGenerator::emitUnexpectedLoad):
168 (KJS::CodeGenerator::emitNewError):
169 * VM/CodeGenerator.h:
170 * VM/Machine.cpp:
171 (KJS::slideRegisterWindowForCall):
172 (KJS::Machine::unwindCallFrame):
173 (KJS::Machine::throwException):
174 (KJS::Machine::execute):
175 (KJS::Machine::privateExecute):
176 * VM/Machine.h:
177 * VM/Opcode.h:
178 * VM/RegisterID.h:
179 (KJS::RegisterID::RegisterID):
180 (KJS::RegisterID::makeConstant):
181 (KJS::RegisterID::isTemporary):
182 * kjs/NodeInfo.h:
183 * kjs/Parser.cpp:
184 (KJS::Parser::didFinishParsing):
185 * kjs/Parser.h:
186 (KJS::Parser::parse):
187 * kjs/grammar.y:
188 * kjs/nodes.cpp:
189 (KJS::NullNode::emitCode):
190 (KJS::BooleanNode::emitCode):
191 (KJS::NumberNode::emitCode):
192 (KJS::StringNode::emitCode):
193 (KJS::ArrayNode::emitCode):
194 (KJS::DeleteResolveNode::emitCode):
195 (KJS::DeleteValueNode::emitCode):
196 (KJS::VoidNode::emitCode):
197 (KJS::ConstDeclNode::emitCodeSingle):
198 (KJS::ReturnNode::emitCode):
199 (KJS::ScopeNode::ScopeNode):
200 (KJS::ProgramNode::ProgramNode):
201 (KJS::ProgramNode::create):
202 (KJS::EvalNode::EvalNode):
203 (KJS::EvalNode::create):
204 (KJS::FunctionBodyNode::FunctionBodyNode):
205 (KJS::FunctionBodyNode::create):
206 (KJS::FunctionBodyNode::emitCode):
207 * kjs/nodes.h:
208 (KJS::ScopeNode::neededConstants):
209
210 2008-08-05 Maciej Stachowiak <mjs@apple.com>
211
212 Reviewed by Cameron.
213
214 - add fast path for immediates to % operator, as we have for many other math ops
215
216 This fixes handling for a 0 divisor relative to the last patch. Only an 0.2% speedup on SunSpider but
217 still a 1.4x win on Oliver's prime test.
218
219 * VM/Machine.cpp:
220 (KJS::Machine::privateExecute):
221
222 2008-08-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
223
224 Reviewed by Darin.
225
226 Bug 20293: Crash in JavaScript codegen for eval("const a;")
227 <https://bugs.webkit.org/show_bug.cgi?id=20293>
228
229 Correctly handle constant declarations in eval code with no initializer.
230
231 * kjs/nodes.cpp:
232 (KJS::ConstDeclNode::emitCodeSingle):
233
234 2008-08-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
235
236 Reviewed by Oliver.
237
238 Roll out r35555 because of correctness issues.
239
240 * VM/Machine.cpp:
241 (KJS::Machine::privateExecute):
242
243 2008-08-05 Maciej Stachowiak <mjs@apple.com>
244
245 Reviewed by Geoff.
246
247 - add fast path for immediates to % operator, as we have for many other math ops
248
249 0.6% speedup on SunSpider. 1.4x speedup on a prime testing torture test that Oliver whipped up.
250
251 * VM/Machine.cpp:
252 (KJS::Machine::privateExecute):
253
254 2008-07-31 Oliver Hunt <oliver@apple.com>
255
256 Reviewed by Cameron Zwarich.
257
258 Bug 19359: JavaScriptCore behaves differently from FF2/3 and IE when handling context in catch statement
259 <https://bugs.webkit.org/show_bug.cgi?id=19359>
260
261 Make our catch behave like Firefox and IE, we do this by using a StaticScopeObject
262 instead of a generic JSObject for the scope node. We still don't make use of the
263 fact that we have a static scope inside the catch block, so the internal performance
264 of the catch block is not improved, even though technically it would be possible to
265 do so.
266
267 * VM/CodeBlock.cpp:
268 (KJS::CodeBlock::dump):
269 * VM/CodeGenerator.cpp:
270 (KJS::CodeGenerator::emitPushNewScope):
271 * VM/CodeGenerator.h:
272 * VM/Machine.cpp:
273 (KJS::createExceptionScope):
274 (KJS::Machine::privateExecute):
275 * VM/Machine.h:
276 * VM/Opcode.h:
277 * kjs/JSStaticScopeObject.cpp:
278 (KJS::JSStaticScopeObject::toThisObject):
279 (KJS::JSStaticScopeObject::put):
280 * kjs/JSStaticScopeObject.h:
281 * kjs/nodes.cpp:
282 (KJS::TryNode::emitCode):
283
284 2008-08-02 Rob Gowin <robg@gowin.net>
285
286 Reviewed by Eric Seidel.
287
288 Added JavaScriptCore/API/WebKitAvailability to list of files in
289 javascriptcore_h_api.
290
291 * GNUmakefile.am:
292
293 2008-08-01 Alexey Proskuryakov <ap@webkit.org>
294
295 Rubber-stamped by Maciej.
296
297 Remove JSGlobalData::DataInstance. It was only needed when we had per-thread JSGlobalData
298 instances.
299
300 * kjs/JSGlobalData.h:
301
302 2008-07-31 Kevin Ollivier <kevino@theolliviers.com>
303
304 Second attempt at Windows/wx build fix. Instead of avoiding inclusion of windows.h,
305 use defines, etc. to avoid conflicts in each affected file. Also, change PLATFORM(WIN)
306 to PLATFORM(WIN_OS) so that other ports using Windows headers get the right impls.
307
308 * VM/SamplingTool.cpp:
309 * wtf/Threading.h:
310
311 2008-07-31 Anders Carlsson <andersca@apple.com>
312
313 Reviewed by Adam.
314
315 Fix Windows build.
316
317 * kjs/collector.h:
318 * wtf/FastMalloc.cpp:
319
320 2008-07-31 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
321
322 Reviewed by Simon.
323
324 Bug 20170: [Qt] missing namespace defines in JavaScriptCore.pro
325 <https://bugs.webkit.org/show_bug.cgi?id=20170>
326
327 * JavaScriptCore.pro: Added missing define.
328
329 2008-07-31 Alexey Proskuryakov <ap@webkit.org>
330
331 Rubber-stamped by Maciej.
332
333 Eliminate JSLock (it was already disabled, removing the stub implementaion and all
334 call sites now).
335
336 * API/JSBase.cpp:
337 (JSEvaluateScript):
338 (JSCheckScriptSyntax):
339 (JSGarbageCollect):
340 * API/JSCallbackConstructor.cpp:
341 (KJS::constructJSCallback):
342 * API/JSCallbackFunction.cpp:
343 (KJS::JSCallbackFunction::call):
344 * API/JSCallbackObjectFunctions.h:
345 (KJS::::init):
346 (KJS::::getOwnPropertySlot):
347 (KJS::::put):
348 (KJS::::deleteProperty):
349 (KJS::::construct):
350 (KJS::::hasInstance):
351 (KJS::::call):
352 (KJS::::getPropertyNames):
353 (KJS::::toNumber):
354 (KJS::::toString):
355 (KJS::::staticValueGetter):
356 (KJS::::callbackGetter):
357 * API/JSContextRef.cpp:
358 (JSGlobalContextCreateInGroup):
359 (JSGlobalContextRetain):
360 (JSGlobalContextRelease):
361 * API/JSObjectRef.cpp:
362 (JSObjectMake):
363 (JSObjectMakeFunctionWithCallback):
364 (JSObjectMakeConstructor):
365 (JSObjectMakeFunction):
366 (JSObjectHasProperty):
367 (JSObjectGetProperty):
368 (JSObjectSetProperty):
369 (JSObjectGetPropertyAtIndex):
370 (JSObjectSetPropertyAtIndex):
371 (JSObjectDeleteProperty):
372 (JSObjectCallAsFunction):
373 (JSObjectCallAsConstructor):
374 (JSObjectCopyPropertyNames):
375 (JSPropertyNameArrayRelease):
376 (JSPropertyNameAccumulatorAddName):
377 * API/JSStringRef.cpp:
378 (JSStringRelease):
379 * API/JSValueRef.cpp:
380 (JSValueIsEqual):
381 (JSValueIsInstanceOfConstructor):
382 (JSValueMakeNumber):
383 (JSValueMakeString):
384 (JSValueToNumber):
385 (JSValueToStringCopy):
386 (JSValueToObject):
387 (JSValueProtect):
388 (JSValueUnprotect):
389 * ForwardingHeaders/JavaScriptCore/JSLock.h: Removed.
390 * GNUmakefile.am:
391 * JavaScriptCore.exp:
392 * JavaScriptCore.order:
393 * JavaScriptCore.pri:
394 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
395 * JavaScriptCore.xcodeproj/project.pbxproj:
396 * JavaScriptCoreSources.bkl:
397 * kjs/AllInOneFile.cpp:
398 * kjs/JSGlobalData.cpp:
399 (KJS::JSGlobalData::JSGlobalData):
400 * kjs/JSGlobalData.h:
401 * kjs/JSGlobalObject.cpp:
402 (KJS::JSGlobalObject::~JSGlobalObject):
403 (KJS::JSGlobalObject::init):
404 * kjs/JSLock.cpp: Removed.
405 * kjs/JSLock.h: Removed.
406 * kjs/Shell.cpp:
407 (functionGC):
408 (jscmain):
409 * kjs/collector.cpp:
410 (KJS::Heap::~Heap):
411 (KJS::Heap::heapAllocate):
412 (KJS::Heap::setGCProtectNeedsLocking):
413 (KJS::Heap::protect):
414 (KJS::Heap::unprotect):
415 (KJS::Heap::collect):
416 * kjs/identifier.cpp:
417 * kjs/interpreter.cpp:
418 (KJS::Interpreter::checkSyntax):
419 (KJS::Interpreter::evaluate):
420
421 2008-07-31 Alexey Proskuryakov <ap@webkit.org>
422
423 Rubber-stamped by Oliver Hunt.
424
425 Fix the Mac project to not display "test/" as part of file name for tests.
426
427 * JavaScriptCore.xcodeproj/project.pbxproj:
428
429 2008-07-31 Eric Seidel <eric@webkit.org>
430
431 Reviewed by Alexey Proskuryakov.
432
433 Rename USE(MULTIPLE_THREADS) to ENABLE(JSC_MULTIPLE_THREADS)
434 to better match the use/enable pattern (and better describe
435 the usage of the feature in question.)
436
437 I also fixed a couple other ENABLE_ macros to be pre-processor
438 definition override-able to match the rest of the ENABLE_ macros
439 since it seems to be our convention that build systems can set
440 ENABLE_ macros in Makefiles.
441
442 * kjs/InitializeThreading.cpp:
443 (KJS::initializeThreadingOnce):
444 * kjs/JSGlobalData.cpp:
445 (KJS::JSGlobalData::JSGlobalData):
446 (KJS::JSGlobalData::~JSGlobalData):
447 * kjs/MathObject.cpp:
448 * kjs/collector.cpp:
449 (KJS::Heap::Heap):
450 (KJS::Heap::~Heap):
451 (KJS::allocateBlock):
452 (KJS::Heap::markStackObjectsConservatively):
453 * kjs/collector.h:
454 * kjs/dtoa.cpp:
455 (KJS::pow5mult):
456 (KJS::rv_alloc):
457 (KJS::freedtoa):
458 (KJS::dtoa):
459 * wtf/FastMalloc.cpp:
460 * wtf/Platform.h:
461 * wtf/RefCountedLeakCounter.cpp:
462
463 2008-07-30 Eric Seidel <eric@webkit.org>
464
465 Reviewed by Mark Rowe.
466
467 Try to clean up our usage of USE(MULTIPLE_THREADS) vs. USE(PTHREADS) a little.
468 It looks like JSC assumes that if MULTIPLE_THREADS is defined, then pthreads will always be available
469 I'm not sure that's always the case for gtk, certainly not for Windows. We should eventually go back
470 and fix wtf/Threading.h to cover all these cases some day.
471
472 * kjs/JSLock.cpp:
473 * kjs/collector.h:
474 * wtf/Platform.h:
475
476 2008-07-30 Eric Seidel <eric@webkit.org>
477
478 Reviewed by Oliver.
479
480 MSVC warns when structs are called classes or vice versa.
481 Make all the source refer to JSGlobalData as a class.
482
483 * kjs/CommonIdentifiers.h:
484 * kjs/JSGlobalData.h:
485 * kjs/Parser.h:
486 * kjs/lexer.h:
487
488 2008-07-30 Alexey Proskuryakov <ap@webkit.org>
489
490 Reviewed by Geoff Garen.
491
492 Add consistency checks to UString to document and enforce its design.
493
494 * kjs/ustring.cpp:
495 (KJS::UString::Rep::create):
496 (KJS::UString::Rep::destroy):
497 (KJS::UString::Rep::checkConsistency):
498 (KJS::UString::expandCapacity):
499 (KJS::UString::expandPreCapacity):
500 (KJS::UString::UString):
501 (KJS::UString::spliceSubstringsWithSeparators):
502 (KJS::UString::append):
503 * kjs/ustring.h:
504 (KJS::UString::Rep::checkConsistency):
505
506 2008-07-30 Gavin Barraclough <barraclough@apple.com>
507
508 Reviewed by Geoff Garen.
509
510 Fixes for Windows and non-AllInOne file build with SamplingTool, plus review fixes.
511
512 * GNUmakefile.am: Adding SamplingTool.cpp to build.
513 * JavaScriptCore.exp: Export hooks to init & control SamplingTool.
514 * JavaScriptCore.pri: Adding SamplingTool.cpp to build.
515 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Adding SamplingTool.cpp to build.
516 * JavaScriptCore.xcodeproj/project.pbxproj: Adding SamplingTool.cpp to build.
517 * JavaScriptCoreSources.bkl: Adding SamplingTool.cpp to build.
518 * VM/Machine.cpp: MACHINE_SAMPLING_callingNativeFunction renamed MACHINE_SAMPLING_callingHostFunction
519 * VM/Machine.h:
520 * VM/Opcode.cpp: SamplingTool moved to SamplingTool.cpp/.h, opcodeNames generated from FOR_EACH_OPCODE_ID.
521 * VM/Opcode.h:
522 * VM/SamplingTool.cpp: Added .cpp/.h for SamplingTool.
523 * VM/SamplingTool.h:
524 * kjs/Shell.cpp: Switched SAMPLING_TOOL_ENABLED to ENABLE_SAMPLING_TOOL.
525 * wtf/Platform.h: Added ENABLE_SAMPLING_TOOL config option.
526 * kjs/nodes.cpp: Header include to fix non-AllInOne builds.
527
528 2008-07-30 Ariya Hidayat <ariya.hidayat@trolltech.com>
529
530 Reviewed by Alexey Proskuryakov.
531
532 Fix compilation without multi-threading support.
533
534 * kjs/collector.cpp:
535 (KJS::Heap::Heap):
536
537 2008-07-30 Anders Carlsson <andersca@apple.com>
538
539 Add WebKitAvailability.h forwarding header.
540
541 * ForwardingHeaders/JavaScriptCore/WebKitAvailability.h: Added.
542
543 2008-07-30 Anders Carlsson <andersca@apple.com>
544
545 Fix the else.
546
547 * API/WebKitAvailability.h:
548
549 2008-07-30 Anders Carlsson <andersca@apple.com>
550
551 * API/WebKitAvailability.h:
552 Fix Windows (and other non-Mac builds).
553
554 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
555 Add WebKitAvailability.h to the project.
556
557 2008-07-30 Anders Carlsson <andersca@apple.com>
558
559 One step closer towards fixing the Windows build.
560
561 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
562 Make sure to copy WebKitAvailability.h
563
564 2008-07-29 Gavin Barraclough <barraclough@apple.com>
565
566 Reviewed by Geoff Garen.
567
568 Bug 20209: Atomize constant strings
569 <https://bugs.webkit.org/show_bug.cgi?id=20209>
570
571 Prevents significant performance degradation seen when a script contains multiple
572 identical strings that are used as keys to identify properties on objects.
573
574 No performance change on SunSpider.
575
576 * kjs/nodes.cpp: Atomize constant strings.
577
578 2008-07-30 Oliver Hunt <oliver@apple.com>
579
580 Reviewed by Alexey Proskuryakov.
581
582 <rdar://problem/6111648> JavaScript exceptions fail if the scope chain includes the global object
583
584 In an attempt to remove the branch I just added to KJS::depth I
585 used the existence of a Variable Object at a point in the scope
586 chain as an indicator of function or global scope activation.
587 However this assumption results in incorrect behaviour if the
588 global object is injected into the scope chain with 'with'.
589
590 * VM/Machine.cpp:
591 (KJS::depth):
592
593 2008-07-30 Alexey Proskuryakov <ap@webkit.org>
594
595 Reviewed by Geoff Garen.
596
597 Don't call JSGarbageCollect() on a released context.
598
599 * API/testapi.c: (main):
600
601 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
602
603 Reviewed by Geoff Garen.
604
605 Implement JSContextGroup APIs to make concurrent execution possible for
606 JavaScriptCore clients.
607
608 This changes the behavior of JSGlobalContextCreate(), so that it now uses a private context
609 group for each context, making JSlock implicit locking unnecessary.
610
611 * API/JSContextRef.h:
612 * API/JSContextRef.cpp:
613 (JSContextGroupCreate):
614 (JSContextGroupRetain):
615 (JSContextGroupRelease):
616 (JSGlobalContextCreate):
617 (JSGlobalContextCreateInGroup):
618 (JSGlobalContextRelease):
619 (JSContextGetGroup):
620 Added new methods. JSGlobalContextCreate() calls JSGlobalContextCreateInGroup() now.
621
622 * API/APICast.h: (toJS): (toRef): Added converters for JSContextGroupRef.
623 * API/JSBase.cpp: (JSGarbageCollect): JSGarbageCollect(0) is now a no-op, and the passed in
624 context is actually used.
625
626 * API/JSBase.h: Aded a typedef for JSContextGroupRef. Updated documentation for
627 JSGarbageCollect().
628
629 * JavaScriptCore.exp: Removed JSGlobalData::sharedInstance().
630
631 * kjs/JSGlobalData.cpp:
632 * kjs/JSGlobalData.h:
633 Removed support for JSGlobalData shared instance. JSGlobalData::isSharedInstance member
634 variable still remains, to be deleted in a followup patch.
635
636 * kjs/JSLock.cpp: (KJS::JSLock::JSLock): Disabled JSLock, to be deleted in a follow-up patch.
637
638 * kjs/collector.cpp:
639 (KJS::Heap::markOtherThreadConservatively): Removed an assertion that referenced
640 JSGlobalData::sharedInstance.
641
642 * kjs/collector.h: Made Heap destructor public, so that JSContextRelease can use it.
643
644 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
645
646 Reviewed by Geoff Garen.
647
648 Fix a leak of ThreadRegistrar objects.
649
650 As the heap is usually deleted when registered threads still exist, ThreadSpecific doesn't
651 have a chance to clean up per-thread object. Switched to native pthread calls, storing a
652 plain pointer that doesn't require cleanup.
653
654 * kjs/collector.cpp:
655 (KJS::PlatformThread::PlatformThread):
656 (KJS::Heap::Thread::Thread):
657 (KJS::Heap::Heap):
658 (KJS::Heap::~Heap):
659 (KJS::Heap::registerThread):
660 (KJS::Heap::unregisterThread):
661 * kjs/collector.h:
662
663 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
664
665 Reviewed by Sam Weinig.
666
667 https://bugs.webkit.org/show_bug.cgi?id=20169
668 Memory allocated with fastMalloc is freed with delete
669
670 * VM/JSPropertyNameIterator.cpp:
671 (KJS::JSPropertyNameIterator::invalidate): Free the array properly.
672 (KJS::JSPropertyNameIterator::~JSPropertyNameIterator): Delete the array by calling
673 invalidate().
674
675 2008-07-29 Mark Rowe <mrowe@apple.com>
676
677 Attempt to fix the Qt build.
678
679 * wtf/ThreadingQt.cpp: Add the extra argument to createThread.
680
681 2008-07-29 Adam Roben <aroben@apple.com>
682
683 Change Vector::find to return an index instead of an iterator
684
685 Indices are more natural than iterators when working with Vector.
686
687 Reviewed by John Sullivan.
688
689 * wtf/Vector.h:
690 (WTF::Vector::find): Changed to iterate the Vector manually and return
691 the index of the found item, rather than an iterator. When the item
692 could not be found, we return WTF::notFound.
693
694 2008-07-29 Adam Roben <aroben@apple.com>
695
696 Windows build fix
697
698 * wtf/ThreadingWin.cpp:
699 (WTF::setThreadName): Move a misplaced assertion to here...
700 (WTF::createThread): ...from here.
701
702 2008-07-29 Adam Roben <aroben@apple.com>
703
704 Add support for setting thread names on Windows
705
706 These thread names make it much easier to identify particular threads
707 in Visual Studio's Threads panel.
708
709 WTF::createThread now takes a const char* representing the thread's
710 name. On Windows, we throw a special exception to set this string as
711 the thread's name. Other platforms do nothing with this name for now.
712
713 Reviewed by Anders Carlsson.
714
715 * JavaScriptCore.exp: Export the new version of createThread that
716 takes 3 arguments (the old one continues to be exported for backward
717 compatibility).
718 * wtf/Threading.h: Add a threadName argument to createThread.
719
720 * wtf/ThreadingGtk.cpp:
721 (WTF::createThread):
722 * wtf/ThreadingNone.cpp:
723 (WTF::createThread):
724 Updated for function signature change.
725
726 * wtf/ThreadingPthreads.cpp:
727 (WTF::createThread): Updated for function signature change. We keep
728 around the old 2-argument version of createThread for backward
729 compatibility.
730
731 * wtf/ThreadingWin.cpp:
732 (WTF::setThreadName): Added. This function's implementation came from
733 MSDN.
734 (WTF::initializeThreading): Set the name of the main thread.
735 (WTF::createThread): Call setThreadName. We keep around the old
736 2-argument version of createThread for backward compatibility.
737
738 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
739
740 Reviewed by Oliver Hunt.
741
742 Store UString::Rep::isStatic bit in identifierTable pointer instead of reportedCost for
743 slightly nicer code and a 0.5% SunSpider improvement.
744
745 * API/JSClassRef.cpp:
746 (OpaqueJSClass::~OpaqueJSClass):
747 (OpaqueJSClassContextData::OpaqueJSClassContextData):
748 * API/JSStringRef.cpp:
749 (JSStringRelease):
750 * kjs/PropertyNameArray.cpp:
751 (KJS::PropertyNameArray::add):
752 * kjs/identifier.cpp:
753 (KJS::IdentifierTable::~IdentifierTable):
754 (KJS::IdentifierTable::add):
755 (KJS::Identifier::addSlowCase):
756 (KJS::Identifier::remove):
757 * kjs/identifier.h:
758 (KJS::Identifier::add):
759 * kjs/ustring.cpp:
760 (KJS::):
761 (KJS::UString::Rep::create):
762 (KJS::UString::Rep::destroy):
763 * kjs/ustring.h:
764 (KJS::UString::Rep::identifierTable):
765 (KJS::UString::Rep::setIdentifierTable):
766 (KJS::UString::Rep::isStatic):
767 (KJS::UString::Rep::setStatic):
768 (KJS::UString::cost):
769
770 2008-07-28 Geoffrey Garen <ggaren@apple.com>
771
772 Reviewed by Sam Weinig.
773
774 Renamed "ConstructTypeNative" => "ConstructTypeHost".
775
776 2008-07-26 Mark Rowe <mrowe@apple.com>
777
778 Speculative fix for the wx build.
779
780 * JavaScriptCoreSources.bkl: Add JSStaticScopeObject.cpp to the list of source files.
781
782 2008-07-25 Oliver Hunt <oliver@apple.com>
783
784 RS=Cameron Zwarich.
785
786 Whoops, forgot to save style correction.
787
788 * kjs/JSStaticScopeObject.h:
789
790 2008-07-25 Oliver Hunt <oliver@apple.com>
791
792 Reviewed by Cameron Zwarich.
793
794 Bug 19718: Named anonymous functions are slow accessing global variables
795 <https://bugs.webkit.org/show_bug.cgi?id=19718>
796
797 To fix this we switch over to an activation-like scope object for
798 on which we attach the function name property, and add logic to
799 prevent cross scope assignment to read only properties.
800
801 * GNUmakefile.am:
802 * JavaScriptCore.pri:
803 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
804 * JavaScriptCore.xcodeproj/project.pbxproj:
805 * VM/CodeGenerator.cpp:
806 (KJS::CodeGenerator::findScopedProperty):
807 (KJS::CodeGenerator::emitResolve):
808 * VM/CodeGenerator.h:
809 * kjs/AllInOneFile.cpp:
810 * kjs/JSStaticScopeObject.cpp: Added.
811 (KJS::JSStaticScopeObject::putWithAttributes):
812 (KJS::JSStaticScopeObject::isDynamicScope):
813 (KJS::JSStaticScopeObject::~JSStaticScopeObject):
814 (KJS::JSStaticScopeObject::getOwnPropertySlot):
815 * kjs/JSStaticScopeObject.h: Added.
816 (KJS::JSStaticScopeObject::JSStaticScopeObjectData::JSStaticScopeObjectData):
817 (KJS::JSStaticScopeObject::JSStaticScopeObject):
818 * kjs/nodes.cpp:
819 (KJS::FunctionCallResolveNode::emitCode):
820 (KJS::PostfixResolveNode::emitCode):
821 (KJS::PrefixResolveNode::emitCode):
822 (KJS::ReadModifyResolveNode::emitCode):
823 (KJS::AssignResolveNode::emitCode):
824 (KJS::FuncExprNode::makeFunction):
825
826 2008-07-25 kevino <kevino@theolliviers.com>
827
828 wx build fix for Win.
829
830 On wx/Win, including windows.h in Threading.h causes multiply-defined symbol errors
831 for libjpeg and wx, and also wx needs to include windows.h itself first for wx
832 includes to work right. So until we can find a better solution to this problem,
833 on wx, we work around the need to include windows.h here.
834
835 * wtf/Threading.h:
836
837 2008-07-25 Adam Roben <aroben@apple.com>
838
839 Windows build fix
840
841 * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add API/ to the
842 include path.
843
844 2008-07-25 Simon Hausmann <hausmann@webkit.org>
845
846 Fix the build of jsc on Qt/Windows, make sure os-win32 is in the
847 include search path (added by WebKit.pri).
848
849 * kjs/jsc.pro:
850
851 2008-07-25 Alexey Proskuryakov <ap@webkit.org>
852
853 Reviewed by Simon Hausmann.
854
855 Move JavaScriptCore API tests into a subdirectory of their own to avoid header name
856 conflicts and developer confusion.
857
858 * API/JSNode.c: Removed.
859 * API/JSNode.h: Removed.
860 * API/JSNodeList.c: Removed.
861 * API/JSNodeList.h: Removed.
862 * API/Node.c: Removed.
863 * API/Node.h: Removed.
864 * API/NodeList.c: Removed.
865 * API/NodeList.h: Removed.
866 * API/minidom.c: Removed.
867 * API/minidom.html: Removed.
868 * API/minidom.js: Removed.
869 * API/testapi.c: Removed.
870 * API/testapi.js: Removed.
871 * API/tests: Added.
872 * API/tests/JSNode.c: Copied from JavaScriptCore/API/JSNode.c.
873 * API/tests/JSNode.h: Copied from JavaScriptCore/API/JSNode.h.
874 * API/tests/JSNodeList.c: Copied from JavaScriptCore/API/JSNodeList.c.
875 * API/tests/JSNodeList.h: Copied from JavaScriptCore/API/JSNodeList.h.
876 * API/tests/Node.c: Copied from JavaScriptCore/API/Node.c.
877 * API/tests/Node.h: Copied from JavaScriptCore/API/Node.h.
878 * API/tests/NodeList.c: Copied from JavaScriptCore/API/NodeList.c.
879 * API/tests/NodeList.h: Copied from JavaScriptCore/API/NodeList.h.
880 * API/tests/minidom.c: Copied from JavaScriptCore/API/minidom.c.
881 * API/tests/minidom.html: Copied from JavaScriptCore/API/minidom.html.
882 * API/tests/minidom.js: Copied from JavaScriptCore/API/minidom.js.
883 * API/tests/testapi.c: Copied from JavaScriptCore/API/testapi.c.
884 * API/tests/testapi.js: Copied from JavaScriptCore/API/testapi.js.
885 * GNUmakefile.am:
886 * JavaScriptCore.vcproj/testapi/testapi.vcproj:
887 * JavaScriptCore.xcodeproj/project.pbxproj:
888
889 2008-07-25 Simon Hausmann <hausmann@webkit.org>
890
891 Prospective WX build fix, add JavaScriptCore/API to the include search
892 path.
893
894 * jscore.bkl:
895
896 2008-07-25 Simon Hausmann <hausmann@webkit.org>
897
898 Rubber-stamped by Lars.
899
900 Fix the build on Windows. operator new for ArgList is implemented using fastMalloc()
901 but operator delete was not implemented. Unfortunately MSVC decides to call/reference
902 the function, so a simple implementation using fastFree() fixes the build.
903
904 * kjs/ArgList.h:
905 (KJS::ArgList::operator delete):
906
907 2008-07-25 Simon Hausmann <hausmann@webkit.org>
908
909 Discussed with and rubber-stamped by Lars.
910
911 Fix the build system for the Qt port.
912
913 Recent JavaScriptCore changes require the addition of JavaScriptCore/API to the
914 include search path. With a build process that combines JavaScriptCore and
915 WebCore in one build process/Makefile the existance of
916 JavaScriptCore/API/Node.h and WebCore/dom/Node.h causes include conflicts.
917
918 This commit solves this by introducing a separate build of JavaScriptCore into
919 a static library.
920
921 As a result of the split-up a race-condition due to broken dependencies of
922 regular source files to header files of generated sources showed up very
923 frequently when doing parallel builds (which the buildbot does). This commit at
924 the same time tries to address the dependency problem by making the
925 addExtraCompiler() function also generate a pseudo extra compiler that
926 represents the header file output, so that qmake is aware of the creation of
927 the header file for dependency calculation.
928
929 At the same time I removed a lot of cruft from the pro files to ease maintenance.
930
931 * JavaScriptCore.pri:
932 * JavaScriptCore.pro: Added.
933 * kjs/jsc.pro:
934
935 2008-07-24 Geoffrey Garen <ggaren@apple.com>
936
937 Reviewed by Maciej Stachowiak.
938
939 Fixed a strict aliasing violation, which caused hash tables with floating
940 point keys not to find items that were indeed in the tables
941 (intermittently, and only in release builds, of course).
942
943 SunSpider reports no change.
944
945 This bug doesn't seem to affect any existing code, but it causes obvious
946 crashes in some new code I'm working on.
947
948 * wtf/HashFunctions.h:
949 (WTF::FloatHash::hash): Use a union when punning between a float / double
950 and an unsigned (bucket of bits). With strict aliasing enabled, unions
951 are the only safe way to do this kind of type punning.
952
953 * wtf/HashTable.h: When rehashing, ASSERT that the item we just added to
954 the table is indeed in the table. In the buggy case described above, this
955 ASSERT fires.
956
957 2008-07-24 Oliver Hunt <oliver@apple.com>
958
959 Reviewed by Alexey Proskuryakov.
960
961 Bug 20142: REGRESSION(r35245): /=/ weirdness
962 <https://bugs.webkit.org/show_bug.cgi?id=20142>
963
964 When adding all the meta data needed for exception error messages
965 I accidentally clobbered the handling of regex beginning with /=.
966
967 * kjs/grammar.y:
968
969 2008-07-23 Alp Toker <alp@nuanti.com>
970
971 Build fix after r35293: Add API/ to the include path.
972
973 * GNUmakefile.am:
974
975 2008-07-23 Adam Roben <aroben@apple.com>
976
977 Windows build fixes
978
979 Build fix after r35293:
980
981 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add API/
982 to the include path.
983
984 Build fix after r35305:
985
986 * VM/Machine.cpp:
987 * VM/Machine.h:
988 * VM/Opcode.cpp:
989 * VM/Opcode.h:
990 Completely compile out all sampler-related code when
991 SAMPLING_TOOL_ENABLED is 0. The sampler code can't be compiled 1) on
992 non-AllInOne configurations due to circular header dependencies, and
993 2) on platforms that don't have a usleep() function, such as Windows.
994
995 2008-07-23 Oliver Hunt <oliver@apple.com>
996
997 Reviewed by Geoff Garen and Sam Weinig.
998
999 Improve switch performance.
1000
1001 Improve switch performance by converting to a hashmap based jump
1002 table to avoid the sequence of dispatches that would otherwise be
1003 needed. This results in a 9-19x performance win for string switches
1004 based on ad hoc testing, and a 6x improvement for integer switch
1005 statements. SunSpider reports a 1.2% progression.
1006
1007 * VM/CodeBlock.cpp:
1008 (KJS::CodeBlock::dump):
1009 (KJS::SimpleJumpTable::offsetForValue):
1010 * VM/CodeBlock.h:
1011 * VM/CodeGenerator.cpp:
1012 (KJS::CodeGenerator::beginSwitch):
1013 (KJS::prepareJumpTableForImmediateSwitch):
1014 (KJS::prepareJumpTableForCharacterSwitch):
1015 (KJS::prepareJumpTableForStringSwitch):
1016 (KJS::CodeGenerator::endSwitch):
1017 * VM/CodeGenerator.h:
1018 * VM/Machine.cpp:
1019 (KJS::offsetForStringSwitch):
1020 (KJS::Machine::privateExecute):
1021 * VM/Opcode.cpp:
1022 (KJS::):
1023 * VM/Opcode.h:
1024 * kjs/JSImmediate.h:
1025 * kjs/nodes.cpp:
1026 (KJS::):
1027 (KJS::processClauseList):
1028 (KJS::CaseBlockNode::tryOptimisedSwitch):
1029 (KJS::CaseBlockNode::emitCodeForBlock):
1030 * kjs/nodes.h:
1031 (KJS::SwitchInfo::):
1032
1033 2008-07-23 Gavin Barraclough <barraclough@apple.com>
1034
1035 Reviewed by Geoff Garen.
1036
1037 Sampling tool to analyze cost of instruction execution and identify hot regions of JS code.
1038 Enable Switches by setting SAMPLING_TOOL_ENABLED in Opcode.h.
1039
1040 * JavaScriptCore.exp: Export symbols for Shell.cpp.
1041 * VM/Machine.cpp: Added sampling hooks.
1042 * VM/Machine.h: Machine contains a pointer to a sampler, when sampling.
1043 * VM/Opcode.cpp: Tool implementation.
1044 * VM/Opcode.h: Tool declaration.
1045 * kjs/Shell.cpp: Initialize the sampler, if enabled.
1046 * kjs/nodes.cpp: Added sampling hooks.
1047
1048 2008-07-23 Gabor Loki <loki@inf.u-szeged.hu>
1049
1050 Bug 20097: [Qt] 20% Sunspider slow-down
1051
1052 <https://bugs.webkit.org/show_bug.cgi?id=20097>
1053
1054 Reviewed by Simon Hausmann.
1055
1056 * kjs/jsc.pro: Added missing NDEBUG define for release builds.
1057
1058 2008-07-23 Alexey Proskuryakov <ap@webkit.org>
1059
1060 Reviewed by Geoff Garen.
1061
1062 JSClassRef is created context-free, but gets infatuated with the first context it sees.
1063
1064 The implicit API contract is that JSClassRef can be used with any context on any thread.
1065 This no longer worked, because UStrings in the class were turned into per-context
1066 identifiers, and the cached JSObject prototype was tied to JSGlobalData, too.
1067
1068 * API/JSClassRef.h: Made a separate struct for context-dependent parts of OpaqueJSClass.
1069 * API/JSClassRef.cpp:
1070 (OpaqueJSClass::OpaqueJSClass): Updated for renames and changed member variable order.
1071 (OpaqueJSClass::~OpaqueJSClass): Assert that string members are not identifiers.
1072 (clearReferenceToPrototype): Update for the new reference location.
1073 (OpaqueJSClassContextData::OpaqueJSClassContextData): Make a deep copy of all strings.
1074 (OpaqueJSClass::contextData): Added a function that finds the per-context part of
1075 OpaqueJSClass in JSGlobalData, or creates it if not found.
1076 (OpaqueJSClass::className): Always make a deep copy. Callers of this function do not have
1077 a way to access JSGlobalData, so a per-context copy could not be made.
1078 (OpaqueJSClass::staticValues): Updated for new data location.
1079 (OpaqueJSClass::staticFunctions): Ditto.
1080 (OpaqueJSClass::prototype): Changed to take an internal type for consistency.
1081
1082 * kjs/JSGlobalData.cpp:
1083 (KJS::JSGlobalData::JSGlobalData):
1084 (KJS::JSGlobalData::~JSGlobalData):
1085 * kjs/JSGlobalData.h:
1086 Keep a HashMap to access per-context JSClass data given a pointr to the shared part.
1087
1088 * API/JSCallbackObjectFunctions.h:
1089 (KJS::::className):
1090 (KJS::::getOwnPropertySlot):
1091 (KJS::::put):
1092 (KJS::::deleteProperty):
1093 (KJS::::getPropertyNames):
1094 (KJS::::staticValueGetter):
1095 (KJS::::staticFunctionGetter):j
1096 Use function accessors instead of accessing OpaqueJSClass members directly.
1097
1098 * API/JSContextRef.cpp: (JSGlobalContextCreate): Updated for the change in
1099 OpaqueJSClass::prototype() argument type.
1100
1101 * API/JSObjectRef.cpp:
1102 (JSObjectMake): Updated for the change in OpaqueJSClass::prototype() argument type.
1103 (JSObjectMakeConstructor): Ditto.
1104
1105 2008-07-23 Alexey Proskuryakov <ap@webkit.org>
1106
1107 Build fix.
1108
1109 * kjs/ArgList.h: (KJS::ArgList::operator new): removed an extraneous "ArgList::" inside the
1110 class definition.
1111
1112 2008-07-22 Geoffrey Garen <ggaren@apple.com>
1113
1114 Reviewed by Oliver Hunt and Sam Weinig.
1115
1116 Next step toward putting doubles in registers: Prepare the Register class
1117 and its clients for registers that don't contain JSValue*s.
1118
1119 This means a few things:
1120
1121 1. Register::jsValue() clients, including ArgList clients, must now supply
1122 an ExecState* when accessing an entry in an ArgList, in case the entry
1123 will need to create a JSValue* on the fly.
1124
1125 2. Register clients that definitely don't want to create a JSValue* on
1126 the fly now use different APIs: getJSValue() for clients that know
1127 the register contains a JSValue*, and v() for clients who just want a
1128 void*.
1129
1130 3. I had to change some headers around in order to resolve dependency
1131 problems created by using a Register in the ArgList header.
1132
1133 SunSpider reports no change.
1134
1135 2008-07-22 Gavin Barraclough <barraclough@apple.com>
1136
1137 Reviewed by Alexey Proskuryakov.
1138
1139 Prevent integer overflow when reallocating storage vector for arrays.
1140
1141 Sunspider reports 1.005x as fast (no change expected).
1142
1143 * kjs/JSArray.cpp:
1144
1145 2008-07-21 Mark Rowe <mrowe@apple.com>
1146
1147 Reviewed by Sam Weinig.
1148
1149 <rdar://problem/6091287> Revamp the handling of CFBundleShortVersionString to be fixed at the major component of the version number.
1150
1151 * Configurations/Version.xcconfig:
1152 * Info.plist:
1153
1154 2008-07-21 Adam Roben <aroben@apple.com>
1155
1156 Add Vector::find
1157
1158 This is a convenience wrapper around std::find.
1159
1160 Reviewed by Anders Carlsson.
1161
1162 * wtf/Vector.h:
1163
1164 2008-07-19 Oliver Hunt <oliver@apple.com>
1165
1166 Reviewed by Cameron Zwarich.
1167
1168 Bug 20104: Exception in tables/mozilla_expected_failures/bugs/bug92868_1.html includes the equals operator in the quoted expression
1169 <https://bugs.webkit.org/show_bug.cgi?id=20104>
1170
1171 To make this correct we make the dot and bracket assign nodes emit the information to indicate
1172 the failure range is the dot/bracket accessor.
1173
1174 * kjs/grammar.y:
1175
1176 2008-07-18 Steve Falkenburg <sfalken@apple.com>
1177
1178 Windows build fix.
1179
1180 * kjs/JSGlobalObjectFunctions.cpp:
1181 (KJS::isStrWhiteSpace):
1182
1183 2008-07-18 Steve Falkenburg <sfalken@apple.com>
1184
1185 Windows build fix.
1186
1187 * kjs/nodes.h:
1188 (KJS::ThrowableExpressionData::ThrowableExpressionData):
1189
1190 2008-07-18 Oliver Hunt <oliver@apple.com>
1191
1192 Reviewed by Cameron Zwarich.
1193
1194 Bug 18774: SQUIRRELFISH: print meaningful error messages <https://bugs.webkit.org/show_bug.cgi?id=18774>
1195 <rdar://problem/5769353> SQUIRRELFISH: JavaScript error messages are missing informative text
1196
1197 Add support for decent error messages in JavaScript. This patch achieves this by providing
1198 ensuring the common errors and exceptions have messages that provide the text of expression
1199 that trigger the exception. In addition it attaches a number of properties to the exception
1200 object detailing where in the source the expression came from.
1201
1202 * JavaScriptCore.exp:
1203 * VM/CodeBlock.cpp:
1204 (KJS::CodeBlock::lineNumberForVPC):
1205 (KJS::CodeBlock::expressionRangeForVPC):
1206 Function to recover the expression range for an instruction
1207 that triggered an exception.
1208 * VM/CodeBlock.h:
1209 (KJS::ExpressionRangeInfo::):
1210 (KJS::CodeBlock::CodeBlock):
1211 * VM/CodeGenerator.cpp:
1212 (KJS::CodeGenerator::emitCall):
1213 (KJS::CodeGenerator::emitCallEval):
1214 Emit call needed to be modified so to place the expression range info internally,
1215 as the CodeGenerator emits the arguments nodes itself, rather than the various call
1216 nodes.
1217 * VM/CodeGenerator.h:
1218 (KJS::CodeGenerator::emitExpressionInfo):
1219 Record the expression range info.
1220 * VM/ExceptionHelpers.cpp:
1221 (KJS::createErrorMessage):
1222 (KJS::createInvalidParamError):
1223 (KJS::createUndefinedVariableError):
1224 (KJS::createNotAConstructorError):
1225 (KJS::createNotAFunctionError):
1226 (KJS::createNotAnObjectErrorStub):
1227 (KJS::createNotAnObjectError):
1228 Rewrite all the code for the error messages so that they make use of the newly available
1229 information.
1230 * VM/ExceptionHelpers.h:
1231 * VM/Machine.cpp:
1232 (KJS::isNotObject): Now needs vPC and codeBlock
1233 (KJS::Machine::throwException):
1234 New logic to handle the NotAnObjectErrorStub and to handle the absurd "no default value" edge case
1235 (KJS::Machine::privateExecute):
1236 * VM/Machine.h:
1237 * kjs/DebuggerCallFrame.cpp:
1238 (KJS::DebuggerCallFrame::evaluate):
1239 * kjs/Error.cpp:
1240 (KJS::Error::create):
1241 * kjs/Error.h:
1242 * kjs/JSGlobalObjectFunctions.cpp:
1243 * kjs/JSImmediate.cpp:
1244 (KJS::JSImmediate::toObject):
1245 (KJS::JSImmediate::prototype):
1246 My changes to the JSNotAnObject constructor needed to be handled here.
1247 * kjs/JSNotAnObject.h:
1248 (KJS::JSNotAnObjectErrorStub::JSNotAnObjectErrorStub):
1249 (KJS::JSNotAnObjectErrorStub::isNull):
1250 (KJS::JSNotAnObjectErrorStub::isNotAnObjectErrorStub):
1251 Added a JSNotAnObjectErrorStub class to ease the handling of toObject failure exceptions,
1252 and potentially allow even more detailed error messages in future.
1253 * kjs/JSObject.h:
1254 * kjs/Parser.h:
1255 (KJS::Parser::parse):
1256 * kjs/SourceRange.h:
1257 * kjs/grammar.y:
1258 Large amounts of position propagation.
1259 * kjs/lexer.cpp:
1260 (KJS::Lexer::Lexer):
1261 (KJS::Lexer::shift):
1262 (KJS::Lexer::lex):
1263 The lexer needed a few changes to be able to correctly track token character positions.
1264 * kjs/lexer.h:
1265 * kjs/nodes.cpp:
1266 (KJS::ThrowableExpressionData::emitThrowError):
1267 (KJS::StatementNode::StatementNode):
1268 (KJS::ResolveNode::emitCode):
1269 (KJS::BracketAccessorNode::emitCode):
1270 (KJS::DotAccessorNode::emitCode):
1271 (KJS::NewExprNode::emitCode):
1272 (KJS::EvalFunctionCallNode::emitCode):
1273 (KJS::FunctionCallValueNode::emitCode):
1274 (KJS::FunctionCallResolveNode::emitCode):
1275 (KJS::FunctionCallBracketNode::emitCode):
1276 (KJS::FunctionCallDotNode::emitCode):
1277 (KJS::PostfixResolveNode::emitCode):
1278 (KJS::PostfixBracketNode::emitCode):
1279 (KJS::PostfixDotNode::emitCode):
1280 (KJS::DeleteResolveNode::emitCode):
1281 (KJS::DeleteBracketNode::emitCode):
1282 (KJS::DeleteDotNode::emitCode):
1283 (KJS::PrefixResolveNode::emitCode):
1284 (KJS::PrefixBracketNode::emitCode):
1285 (KJS::PrefixDotNode::emitCode):
1286 (KJS::ThrowableBinaryOpNode::emitCode):
1287 (KJS::ReadModifyResolveNode::emitCode):
1288 (KJS::AssignResolveNode::emitCode):
1289 (KJS::AssignDotNode::emitCode):
1290 (KJS::ReadModifyDotNode::emitCode):
1291 (KJS::AssignBracketNode::emitCode):
1292 (KJS::ReadModifyBracketNode::emitCode):
1293 (KJS::ForInNode::ForInNode):
1294 (KJS::ForInNode::emitCode):
1295 (KJS::WithNode::emitCode):
1296 (KJS::LabelNode::emitCode):
1297 (KJS::ThrowNode::emitCode):
1298 (KJS::ProgramNode::ProgramNode):
1299 (KJS::ProgramNode::create):
1300 (KJS::EvalNode::generateCode):
1301 (KJS::FunctionBodyNode::create):
1302 (KJS::FunctionBodyNode::generateCode):
1303 (KJS::ProgramNode::generateCode):
1304 All of these methods were handling the position information.
1305 Constructors and create methods were modified to store the information.
1306 All the emitCall implementations listed needed to be updated to actually
1307 record the position information we have so carefully collected.
1308 * kjs/nodes.h:
1309 (KJS::ThrowableExpressionData::ThrowableExpressionData):
1310 (KJS::ThrowableExpressionData::setExceptionSourceRange):
1311 (KJS::ThrowableExpressionData::divot):
1312 (KJS::ThrowableExpressionData::startOffset):
1313 (KJS::ThrowableExpressionData::endOffset):
1314 (KJS::ThrowableSubExpressionData::ThrowableSubExpressionData):
1315 (KJS::ThrowableSubExpressionData::setSubexpressionInfo):
1316 (KJS::ThrowablePrefixedSubExpressionData::ThrowablePrefixedSubExpressionData):
1317 (KJS::ThrowablePrefixedSubExpressionData::setSubexpressionInfo):
1318 ThrowableExpressionData is just a uniform mechanism for storing the position
1319 information.
1320 (KJS::ResolveNode::):
1321 (KJS::PrePostResolveNode::):
1322 (KJS::ThrowableBinaryOpNode::):
1323 (KJS::WithNode::):
1324
1325 2008-07-18 Geoffrey Garen <ggaren@apple.com>
1326
1327 Reviewed by Cameron Zwarich.
1328
1329 Three renames:
1330
1331 "CallTypeNative" => "CallTypeHost"
1332 "code" => "byteCode"
1333 "generatedCode" => "generatedByteCode"
1334
1335 2008-07-18 Geoffrey Garen <ggaren@apple.com>
1336
1337 Reviewed by Oliver Hunt.
1338
1339 Optimized <= for immediate number cases.
1340
1341 SunSpider reports no overall change, but a 10% speedup on access-nsieve.
1342
1343 2008-07-18 Mark Rowe <mrowe@apple.com>
1344
1345 Rubber-stamped by Sam Weinig.
1346
1347 Fix some casts added in a previous build fix to match the style used
1348 throughout WebKit.
1349
1350 * VM/Machine.cpp:
1351 (KJS::Machine::initializeCallFrame):
1352 * VM/Register.h:
1353 (KJS::Register::Register):
1354
1355 2008-07-18 Landry Breuil <landry@openbsd.org>
1356
1357 Bug 19975: [OpenBSD] Patches to enable build of WebKit
1358
1359 <https://bugs.webkit.org/show_bug.cgi?id=19975>
1360
1361 Reviewed by David Kilzer.
1362
1363 Support for OpenBSD, mostly threading and libm tweaks.
1364
1365 * kjs/collector.cpp: #include <pthread.h>
1366 (KJS::currentThreadStackBase): use pthread_stackseg_np() to get stack base
1367 * kjs/config.h: OpenBSD also provides <pthread_np.h>
1368 * wtf/MathExtras.h: #include <sys/types.h> and <machine/ieee.h>
1369 (isfinite), (signbit): as long as we don't have those functions provide fallback implementations
1370 * wtf/Platform.h: Add support for PLATFORM(OPENBSD) and PLATFORM(SPARC64) macro
1371
1372 2008-07-17 Geoffrey Garen <ggaren@apple.com>
1373
1374 Reviewed by Oliver Hunt.
1375
1376 Next step toward putting doubles in registers: Store constant pool
1377 entries as registers, not JSValue*s.
1378
1379 SunSpider reports no change.
1380
1381 2008-07-17 Geoffrey Garen <ggaren@apple.com>
1382
1383 Reviewed by John Sullivan and Oliver Hunt.
1384
1385 A tiny bit of tidying in function call register allocation.
1386
1387 This patch saves one register when invoking a function expression and/or
1388 a new expression that is stored in a temporary.
1389
1390 Since it's just one register, I can't make a testcase for it.
1391
1392 * VM/CodeGenerator.cpp:
1393 (KJS::CodeGenerator::emitCall): No need to ref the function we're calling
1394 or its base. We'd like the call frame to overlap with them, if possible.
1395 op_call will read the function and its base before writing the call frame,
1396 so this is safe.
1397
1398 * kjs/nodes.cpp:
1399 (KJS::NewExprNode::emitCode): No need to ref the function we're new-ing,
1400 for the same reasons stated above.
1401
1402 (KJS::FunctionCallValueNode::emitCode): ditto
1403
1404 2008-07-17 Steve Falkenburg <sfalken@apple.com>
1405
1406 Build fix.
1407
1408 * kjs/InternalFunction.cpp:
1409
1410 2008-07-17 Sam Weinig <sam@webkit.org>
1411
1412 Roll out r35199 as it is causing failures on the PPC build.
1413
1414 2008-07-17 Geoffrey Garen <ggaren@apple.com>
1415
1416 Reviewed by David Kilzer.
1417
1418 Fixed https://bugs.webkit.org/show_bug.cgi?id=20067
1419 Support function.name (Firefox extension)
1420
1421 Pretty straight-forward.
1422
1423 2008-07-17 Geoffrey Garen <ggaren@apple.com>
1424
1425 Reviewed by Oliver Hunt.
1426
1427 Fixed <rdar://problem/6081636> Functions calls use more temporary
1428 registers than necessary
1429
1430 Holding a reference to the last statement result register caused each
1431 successive statement to output its result to an even higher register.
1432
1433 Happily, statements don't actually need to return a result register
1434 at all. I hope to make this clearer in a future cleanup patch,
1435 but this change will fix the major bug for now.
1436
1437 * kjs/nodes.cpp:
1438 (KJS::statementListEmitCode):
1439
1440 2008-07-17 Gavin Barraclough <barraclough@apple.com>
1441
1442 Reviewed by Sam Weinig.
1443
1444 Merge pre&post dot nodes to simplify the parse tree.
1445 Sunspider results show 0.6% progression (no performance change expected).
1446
1447 * kjs/grammar.y:
1448 * kjs/nodes.cpp:
1449 * kjs/nodes.h:
1450 * kjs/nodes2string.cpp:
1451
1452 2008-07-17 Gavin Barraclough <barraclough@apple.com>
1453
1454 Reviewed by Cameron Zwarich.
1455
1456 Merge pre&post resolve nodes to simplify the parse tree.
1457 Sunspider results show no performance change.
1458
1459 * kjs/grammar.y:
1460 * kjs/nodes.cpp:
1461 * kjs/nodes.h:
1462 * kjs/nodes2string.cpp:
1463
1464 2008-07-17 Gavin Barraclough <barraclough@apple.com>
1465
1466 Reviewed by Cameron Zwarich.
1467
1468 Merge logical nodes to simplify the parse tree.
1469 Sunspider results show 0.6% progression (no performance change expected).
1470
1471 * kjs/grammar.y:
1472 * kjs/nodes.cpp:
1473 * kjs/nodes.h:
1474 * kjs/nodes2string.cpp:
1475
1476 2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
1477
1478 Reviewed by Simon.
1479
1480 Fix MinGW build (broken in r35198) and simplify getLocalTime().
1481
1482 * kjs/DateMath.cpp:
1483 (KJS::getLocalTime):
1484
1485 2008-07-17 Gavin Barraclough <barraclough@apple.com>
1486
1487 Reviewed by Sam Weinig.
1488
1489 Merge pre&post bracket nodes to simplify the parse tree.
1490 Sunspider results show no performance change.
1491
1492 * kjs/grammar.y:
1493 * kjs/nodes.cpp:
1494 * kjs/nodes.h:
1495 * kjs/nodes2string.cpp:
1496
1497 2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
1498
1499 Reviewed by Simon.
1500
1501 Fix the 32-bit gcc builds, conversion from "long int" to Register is
1502 ambiguous. Explicitly choose the intptr_t constructor.
1503
1504 * VM/Machine.cpp:
1505 (KJS::Machine::initializeCallFrame):
1506 * VM/Register.h:
1507 (KJS::Register::Register):
1508
1509 2008-07-16 Mark Rowe <mrowe@apple.com>
1510
1511 Rubber-stamped by Geoff Garen.
1512
1513 Fix JavaScript in 64-bit by using a pointer-sized integer
1514 type in the Register union. Also includes a rename of
1515 the intType constant to IntType.
1516
1517 * VM/Machine.cpp:
1518 (KJS::Machine::initializeCallFrame):
1519 * VM/Register.h:
1520 (KJS::Register::):
1521 (KJS::Register::Register):
1522
1523 2008-07-17 Geoffrey Garen <ggaren@apple.com>
1524
1525 Reviewed by Oliver Hunt.
1526
1527 First step toward putting doubles in registers: Turned Register into a
1528 proper abstraction layer. It is no longer possible to cast a Register
1529 to a JSValue*, or a Register& to a JSValue*&, or to access the union
1530 inside a Register directly.
1531
1532 SunSpider reports no change.
1533
1534 In support of this change, I had to make the following mechanical changes
1535 in a lot of places:
1536
1537 1. Clients now use explicit accessors to read data out of Registers, and
1538 implicit copy constructors to write data into registers.
1539
1540 So, assignment that used to look like
1541
1542 x.u.jsValue = y;
1543
1544 now looks like
1545
1546 x = y;
1547
1548 And access that used to look like
1549
1550 x = y.u.jsValue;
1551
1552 now looks like
1553
1554 x = y.jsValue();
1555
1556 2. I made generic flow control specific in opcodes that made their flow
1557 control generic by treating a Register& as a JSValue*&. This had the
1558 added benefit of removing some exception checking branches from immediate
1559 number code.
1560
1561 3. I beefed up PropertySlot to support storing a Register* in a property
1562 slot. For now, only JSVariableObject's symbolTableGet and symbolTablePut
1563 use this functionality, but I expect more clients to use it in the future.
1564
1565 4. I changed ArgList to be a buffer of Registers, not JSValue*'s, and I
1566 changed ArgList iterator clients to iterate Registers, not JSValue*'s.
1567
1568 2008-07-16 Ada Chan <adachan@apple.com>
1569
1570 Fixed build.
1571
1572 * kjs/JSGlobalObject.cpp:
1573
1574 2008-07-16 Kevin McCullough <kmccullough@apple.com>
1575
1576 Reviewed by Sam and Geoff.
1577
1578 <rdar://problem/5958840> Navigating to another page while profiler is
1579 attached results in slow JavaScript for all time.
1580
1581 - The UNLIKELY keeps this from being a sunspider performance regression.
1582
1583 * kjs/JSGlobalObject.cpp:
1584 (KJS::JSGlobalObject::~JSGlobalObject): Stop the profiler associated
1585 with this exec state.
1586
1587 2008-07-16 Sam Weinig <sam@webkit.org>
1588
1589 Reviewed by Steve Falkenburg.
1590
1591 Replace adopting UString constructor in favor of explicit
1592 static adopt method.
1593
1594 * API/JSStringRefCF.cpp:
1595 (JSStringCreateWithCFString):
1596 * kjs/StringConstructor.cpp:
1597 (KJS::stringFromCharCode):
1598 * kjs/StringPrototype.cpp:
1599 (KJS::stringProtoFuncToLowerCase):
1600 (KJS::stringProtoFuncToUpperCase):
1601 (KJS::stringProtoFuncToLocaleLowerCase):
1602 (KJS::stringProtoFuncToLocaleUpperCase):
1603 * kjs/ustring.cpp:
1604 (KJS::UString::adopt):
1605 * kjs/ustring.h:
1606 (KJS::UString::UString):
1607 (KJS::UString::~UString):
1608
1609 2008-07-16 Ariya Hidayat <ariya.hidayat@trolltech.com>
1610
1611 Reviewed by Simon.
1612
1613 http://trolltech.com/developer/task-tracker/index_html?method=entry&id=216179
1614 Fix potential crash (on Qt for Windows port) when performing JavaScript date
1615 conversion.
1616
1617 * kjs/DateMath.cpp:
1618 (KJS::getLocalTime): For the Qt port, prefer to use Windows code, i.e.
1619 localtime_s() instead of localtime() since the latter might crash (on Windows)
1620 given a non-sensible, e.g. NaN, argument.
1621
1622 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1623
1624 Reviewed by Anders and Geoff.
1625
1626 https://bugs.webkit.org/show_bug.cgi?id=20023
1627 Failed assertion in PropertyNameArray.cpp
1628
1629 This is already tested by testapi.
1630
1631 * API/JSObjectRef.cpp: (JSPropertyNameAccumulatorAddName): Add the string to identifier
1632 table to appease PropertyNameArray.
1633
1634 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1635
1636 Reviewed by Geoff.
1637
1638 Dereference identifiers when deleting a hash table (fixes leaks with private JSGlobalData
1639 objects).
1640
1641 * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::~JSGlobalData):
1642 * kjs/lookup.cpp: (KJS::HashTable::deleteTable):
1643 * kjs/lookup.h:
1644 * kjs/lexer.cpp: (KJS::Lexer::~Lexer)
1645 HashTable cannot have a destructor, because check-for-global-initializers complains about
1646 having a global constructor then.
1647
1648 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1649
1650 Reviewed by Geoff.
1651
1652 Check pthread_key_create return value.
1653
1654 This check was helpful when debugging a crash in run-webkit-tests --threaded that happened
1655 because JSGlobalData objects were not deleted, and we were running out of pthread keys soon.
1656 It also looks useful for production builds.
1657
1658 * wtf/ThreadSpecific.h: (WTF::::ThreadSpecific):
1659
1660 2008-07-15 Kevin McCullough <kmccullough@apple.com>
1661
1662 Reviewed by Geoff.
1663
1664 Rename pageGroupIdentifier to profileGroup to keep mention of a
1665 pageGroup out of JavaScriptCore.
1666
1667 * kjs/JSGlobalObject.cpp:
1668 (KJS::JSGlobalObject::init):
1669 * kjs/JSGlobalObject.h:
1670 (KJS::JSGlobalObject::setProfileGroup):
1671 (KJS::JSGlobalObject::profileGroup):
1672 * profiler/ProfileGenerator.cpp:
1673 (KJS::ProfileGenerator::create):
1674 (KJS::ProfileGenerator::ProfileGenerator):
1675 * profiler/ProfileGenerator.h:
1676 (KJS::ProfileGenerator::profileGroup):
1677 * profiler/Profiler.cpp:
1678 (KJS::Profiler::startProfiling):
1679 (KJS::dispatchFunctionToProfiles):
1680 (KJS::Profiler::willExecute):
1681 (KJS::Profiler::didExecute):
1682
1683 2008-07-14 Mark Rowe <mrowe@apple.com>
1684
1685 Reviewed by Sam Weinig.
1686
1687 Fix https://bugs.webkit.org/show_bug.cgi?id=20037
1688 Bug 20037: GCC 4.2 build broken due to strict aliasing violation.
1689
1690 * kjs/ustring.cpp:
1691 (KJS::UString::Rep::computeHash): Add a version of computeHash that takes a char* and explicit length.
1692 * kjs/ustring.h:
1693 * profiler/CallIdentifier.h:
1694 (WTF::): Use new version of computeHash that takes a char* and explicit length to avoid unsafe aliasing.
1695
1696 2008-07-14 David Hyatt <hyatt@apple.com>
1697
1698 Fix a crashing bug in ListHashSet's -- operator. Make sure that end() can be -- by special-casing the null
1699 position.
1700
1701 Reviewed by Maciej
1702
1703 * wtf/ListHashSet.h:
1704 (WTF::ListHashSetConstIterator::operator--):
1705
1706 2008-07-14 David Hyatt <hyatt@apple.com>
1707
1708 Buidl fix. Make sure the second insertBefore method returns a value.
1709
1710 * wtf/ListHashSet.h:
1711 (WTF::::insertBefore):
1712
1713 2008-07-14 Adam Roben <aroben@apple.com>
1714
1715 Windows build fix
1716
1717 * JavaScriptCore.vcproj/jsc/jsc.vcproj: Added include/pthreads to the
1718 include path.
1719
1720 2008-07-14 Alexey Proskuryakov <ap@webkit.org>
1721
1722 Reviewed by Kevin McCullough.
1723
1724 Make JSGlobalData refcounted in preparation to adding a way to create contexts that share
1725 global data.
1726
1727 * JavaScriptCore.exp:
1728 * kjs/JSGlobalData.cpp:
1729 (KJS::JSGlobalData::create):
1730 * kjs/JSGlobalData.h:
1731 Made contructor private, and added a static create() method. Made the class inherit from
1732 RefCounted.
1733
1734 * kjs/JSGlobalObject.h:
1735 (KJS::JSGlobalObject::globalData):
1736 JSGlobalData is now owned by JSGlobalObject (except for the shared one, and the common
1737 WebCore one, which are never deleted).
1738
1739 * kjs/Shell.cpp: (main): Create JSGlobalData with create() method.
1740
1741 2008-07-14 Simon Hausmann <hausmann@webkit.org>
1742
1743 Fix the single-threaded build.
1744
1745 * kjs/JSLock.cpp: Removed undeclared registerThread() function.
1746 * kjs/collector.cpp:
1747 (KJS::Heap::registerThread): Added dummy implementation.
1748
1749 2008-07-14 Alexey Proskuryakov <ap@webkit.org>
1750
1751 Reviewed by Geoff Garen.
1752
1753 Eliminate per-thread JavaScript global data instance support and make arbitrary
1754 global data/global object combinations possible.
1755
1756 * kjs/collector.cpp:
1757 (KJS::Heap::Heap): Store a JSGlobalData pointer instead of multiple pointers to its members.
1758 This allows for going from any JS object to its associated global data, currently used in
1759 JSGlobalObject constructor to initialize its JSGlobalData pointer.
1760 (KJS::Heap::registerThread): Changed thread registration data to be per-heap. Previously,
1761 only the shared heap could be used from multiple threads, so it was the only one that needed
1762 thread registration, but now this can happen to any heap.
1763 (KJS::Heap::unregisterThread): Ditto.
1764 (KJS::Heap::markStackObjectsConservatively): Adapt for the above changes.
1765 (KJS::Heap::setGCProtectNeedsLocking): Ditto.
1766 (KJS::Heap::protect): Ditto.
1767 (KJS::Heap::unprotect): Ditto.
1768 (KJS::Heap::collect): Ditto.
1769 (KJS::Heap::globalObjectCount): Use global object list associated with the current heap,
1770 not the late per-thread one.
1771 (KJS::Heap::protectedGlobalObjectCount): Ditto.
1772
1773 * kjs/collector.h:
1774 (KJS::Heap::ThreadRegistrar): Added a helper object that unregisters a thread when it is
1775 destroyed.
1776
1777 * kjs/JSLock.cpp:
1778 (KJS::JSLock::JSLock):
1779 * kjs/JSLock.h:
1780 (KJS::JSLock::JSLock):
1781 Don't use JSLock to implicitly register threads. I've added registerThread() calls to most
1782 places that use JSLock - we cannot guarantee absolute safety unless we always mark all
1783 threads in the process, but these implicit registration calls should cover reasonable usage
1784 scenarios, I hope.
1785
1786 * API/JSBase.cpp:
1787 (JSEvaluateScript): Explicitly register the current thread.
1788 (JSCheckScriptSyntax): Explicitly register the current thread.
1789 (JSGarbageCollect): Changed to use the passed in context. Unfortunately, this creates a race
1790 condition for clients that pass an already released context to JSGarbageCollect - but it is
1791 unlikely to create real life problems.
1792 To maintain compatibility, the shared heap is collected if NULL is passed.
1793
1794 * API/JSContextRef.cpp:
1795 (JSGlobalContextCreate): Use a new syntax for JSGlobalObject allocation.
1796 (JSGlobalContextRetain): Register the thread.
1797 (JSContextGetGlobalObject): Register the thread.
1798
1799 * API/JSObjectRef.cpp:
1800 (JSObjectMake):
1801 (JSObjectMakeFunctionWithCallback):
1802 (JSObjectMakeConstructor):
1803 (JSObjectMakeFunction):
1804 (JSObjectHasProperty):
1805 (JSObjectGetProperty):
1806 (JSObjectSetProperty):
1807 (JSObjectGetPropertyAtIndex):
1808 (JSObjectSetPropertyAtIndex):
1809 (JSObjectDeleteProperty):
1810 (JSObjectCallAsFunction):
1811 (JSObjectCallAsConstructor):
1812 (JSObjectCopyPropertyNames):
1813 (JSPropertyNameAccumulatorAddName):
1814 * API/JSValueRef.cpp:
1815 (JSValueIsEqual):
1816 (JSValueIsInstanceOfConstructor):
1817 (JSValueMakeNumber):
1818 (JSValueMakeString):
1819 (JSValueToNumber):
1820 (JSValueToStringCopy):
1821 (JSValueToObject):
1822 (JSValueProtect):
1823 (JSValueUnprotect):
1824 Register the thread.
1825
1826 * API/JSStringRef.cpp: (JSStringRelease): Changed a comment to not mention per-thread contexts.
1827
1828 * API/JSStringRefCF.cpp: Removed an unnecessary include of JSLock.h.
1829
1830 * JavaScriptCore.exp: Export JSGlobalData constructor/destructor, now that anyone can have
1831 their own instances. Adapt to other changes, too.
1832
1833 * JavaScriptCore.xcodeproj/project.pbxproj: Made ThreadSpecific.h private, as it is now
1834 included by collector.h and is thus needed in other projects.
1835
1836 * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Don't initialize per-thread
1837 global data, as it no longer exists.
1838
1839 * kjs/JSGlobalData.cpp:
1840 (KJS::JSGlobalData::JSGlobalData):
1841 (KJS::JSGlobalData::~JSGlobalData):
1842 * kjs/JSGlobalData.h:
1843 Removed support for per-thread instance. Made constructor and destructor public.
1844
1845 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Get to now arbitrary JSGlobalData
1846 via the heap.
1847 (KJS::JSGlobalObject::operator new): Changed ot take JSGlobalDatra pointer.
1848 * kjs/JSGlobalObject.h:
1849
1850 * kjs/Shell.cpp:
1851 (main):
1852 (jscmain):
1853 Changed to maintain a custom JSGlobalData pointer instead of a per-thread one.
1854
1855 2008-07-13 Ada Chan <adachan@apple.com>
1856
1857 Windows build fix: Add wtf/RefCountedLeakCounter to the project.
1858
1859 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
1860
1861 2008-07-12 Jan Michael Alonzo <jmalonzo@webkit.org>
1862
1863 Gtk, Qt and Wx build fix: Add wtf/RefCountedLeakCounter in the
1864 build scripts
1865
1866 * GNUmakefile.am:
1867 * JavaScriptCore.pri:
1868 * JavaScriptCoreSources.bkl:
1869
1870 2008-07-11 Stephanie Lewis <slewis@apple.com>
1871
1872 Reviewed by Darin Adler and Oliver Hunt.
1873
1874 Refactor RefCounting Leak counting code into a common class.
1875
1876 In order to export the symbols I needed to put the debug defines inside the function names
1877
1878 Before we had a separate channel for each Logging each Leak type. Since the leak channels were only used in one location, and only at quit for simplicity I combined them all into one leak channel.
1879
1880 * JavaScriptCore.exp:
1881 * JavaScriptCore.xcodeproj/project.pbxproj: add new class
1882 * kjs/nodes.cpp: remove old leak counting code
1883 * wtf/RefCountedLeakCounter.cpp: Added. create a common leak counting class
1884 * wtf/RefCountedLeakCounter.h: Added.
1885
1886 2008-07-11 David Hyatt <hyatt@apple.com>
1887
1888 Add an insertBefore method to ListHashSet to allow for insertions in the middle of the list (rather than just
1889 at the end).
1890
1891 Reviewed by Anders
1892
1893 * wtf/ListHashSet.h:
1894 (WTF::::insertBefore):
1895 (WTF::::insertNodeBefore):
1896
1897 2008-07-11 Sam Weinig <sam@webkit.org>
1898
1899 Rubber-stamped by Darin Adler.
1900
1901 Move call function to CallData.cpp and construct to ConstructData.cpp.
1902
1903 * GNUmakefile.am:
1904 * JavaScriptCore.pri:
1905 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1906 * JavaScriptCore.xcodeproj/project.pbxproj:
1907 * JavaScriptCoreSources.bkl:
1908 * kjs/AllInOneFile.cpp:
1909 * kjs/CallData.cpp: Copied from kjs/JSValue.cpp.
1910 * kjs/ConstructData.cpp: Copied from kjs/JSValue.cpp.
1911 * kjs/JSValue.cpp:
1912
1913 2008-07-10 Mark Rowe <mrowe@apple.com>
1914
1915 Reviewed by Sam Weinig.
1916
1917 Define WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST when building WebKit to ensure that no symbols end up with the weak_import attribute.
1918
1919 * Configurations/Base.xcconfig:
1920
1921 2008-07-10 Mark Rowe <mrowe@apple.com>
1922
1923 Reviewed by Sam Weinig.
1924
1925 Fix the Tiger build by omitting annotations from methods declared in categories when using old versions of GCC.
1926
1927 * API/WebKitAvailability.h:
1928
1929 2008-07-10 Kevin McCullough <kmccullough@apple.com>
1930
1931 Reviewed by Darin.
1932
1933 -Minor cleanup. Renamed callTree() to head() and no longer use m_head
1934 directly but instead keep it private and access via a method().
1935
1936 * profiler/HeavyProfile.cpp:
1937 (KJS::HeavyProfile::HeavyProfile):
1938 (KJS::HeavyProfile::generateHeavyStructure):
1939 (KJS::HeavyProfile::addNode):
1940 * profiler/Profile.h:
1941 (KJS::Profile::head):
1942 * profiler/ProfileGenerator.cpp:
1943 (KJS::ProfileGenerator::ProfileGenerator):
1944
1945 2008-07-10 Alexey Proskuryakov <ap@webkit.org>
1946
1947 Reviewed by Mark Rowe.
1948
1949 Eliminate CollectorHeapIntrospector.
1950
1951 CollectorHeapIntrospector was added primarily in the hopes to improve leaks tool output,
1952 a result that it didn't deliver. Also, it helped by labeling JSC heap regions as reported by
1953 vmmap tool, but at the same time, it made them mislabeled as malloc'd ones - the correct
1954 way to label mapped regions is to use a VM tag.
1955
1956 So, it makes more sense to remove it completely than to make it work with multiple heaps.
1957
1958 * JavaScriptCore.exp:
1959 * JavaScriptCore.xcodeproj/project.pbxproj:
1960 * kjs/AllInOneFile.cpp:
1961 * kjs/InitializeThreading.cpp:
1962 (KJS::initializeThreading):
1963 * kjs/collector.cpp:
1964 * kjs/collector.h:
1965 * kjs/CollectorHeapIntrospector.cpp: Removed.
1966 * kjs/CollectorHeapIntrospector.h: Removed.
1967
1968 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1969
1970 Reviewed by Darin.
1971
1972 <rdar://problem/5951532> JSProfiler: Implement heavy (or bottom-up)
1973 view (19228)
1974 - Implemented the time and call count portionof heavy. Now all that we
1975 need is some UI.
1976
1977 * profiler/CallIdentifier.h: Removed an unused constructor.
1978 * profiler/HeavyProfile.cpp:
1979 (KJS::HeavyProfile::HeavyProfile): Set the initial time of the head
1980 node so that percentages work correctly.
1981 (KJS::HeavyProfile::mergeProfiles): Sum the times and call count of
1982 nodes being merged.
1983 * profiler/ProfileNode.cpp: Set the intital values of time and call
1984 count when copying ProfileNodes.
1985 (KJS::ProfileNode::ProfileNode):
1986
1987 2008-07-10 Jan Michael Alonzo <jmalonzo@webkit.org>
1988
1989 Gtk build fix.
1990
1991 * GNUmakefile.am: Add HeavyProfile.cpp
1992
1993 2008-07-09 Mark Rowe <mrowe@apple.com>
1994
1995 Reviewed by Geoff Garen.
1996
1997 Don't warn about deprecated functions in production builds.
1998
1999 * Configurations/Base.xcconfig:
2000 * Configurations/DebugRelease.xcconfig:
2001
2002 2008-07-09 Darin Adler <darin@apple.com>
2003
2004 * JavaScriptCore.pri: Fix Qt build by adding HeavyProfile.cpp.
2005
2006 2008-07-09 Kevin Ollivier <kevino@theolliviers.com>
2007
2008 wx biuld fix. Add HeavyProfile.cpp to build files.
2009
2010 * JavaScriptCoreSources.bkl:
2011
2012 2008-07-09 Kevin McCullough <kmccullough@apple.com>
2013
2014 - Windows build fix.
2015
2016 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2017
2018 2008-07-09 Kevin McCullough <kmccullough@apple.com>
2019
2020 - Build fix.
2021
2022 * profiler/HeavyProfile.cpp:
2023 (KJS::HeavyProfile::mergeProfiles):
2024
2025 2008-07-09 Kevin McCullough <kmccullough@apple.com>
2026
2027 Reviewed by Geoff and Adam.
2028
2029 <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
2030 - This is the plumbing for bottom-up, but does not include calculating
2031 time, mostly because I'm still undclear about what the end result should
2032 look like.
2033 - This, obviously, does not include the UI to expose this in the
2034 inspector yet.
2035
2036 * JavaScriptCore.xcodeproj/project.pbxproj:
2037 * profiler/CallIdentifier.h:
2038 (KJS::CallIdentifier::CallIdentifier):
2039 (WTF::): Added HashTraits for CallIdentifiers to be used by a HashMap.
2040 * profiler/HeavyProfile.cpp: Added.
2041 (KJS::HeavyProfile::HeavyProfile):
2042 (KJS::HeavyProfile::generateHeavyStructure):
2043 (KJS::HeavyProfile::addNode):
2044 (KJS::HeavyProfile::mergeProfiles):
2045 (KJS::HeavyProfile::addAncestorsAsChildren):
2046 * profiler/HeavyProfile.h: Added.
2047 (KJS::HeavyProfile::create):
2048 (KJS::HeavyProfile::heavyProfile):
2049 (KJS::HeavyProfile::treeProfile):
2050 * profiler/Profile.cpp: Removed old commented out includes.
2051 * profiler/Profile.h: The m_head is needed by the HeavyProfile so it
2052 is now protected as opposed to private.
2053 * profiler/ProfileNode.cpp:
2054 (KJS::ProfileNode::ProfileNode): Created a constructor to copy
2055 ProfileNodes.
2056 (KJS::ProfileNode::findChild): Added a null check to make HeavyProfile
2057 children finding easier and avoid a potential crasher.
2058 * profiler/ProfileNode.h: Mostly moved things around but also added some
2059 functionality needed by HeavyProfile.
2060 (KJS::ProfileNode::create):
2061 (KJS::ProfileNode::functionName):
2062 (KJS::ProfileNode::url):
2063 (KJS::ProfileNode::lineNumber):
2064 (KJS::ProfileNode::head):
2065 (KJS::ProfileNode::setHead):
2066 (KJS::ProfileNode::setNextSibling):
2067 (KJS::ProfileNode::actualTotalTime):
2068 (KJS::ProfileNode::actualSelfTime):
2069 * profiler/TreeProfile.cpp: Implemented the ability to get a
2070 HeavyProfile.
2071 (KJS::TreeProfile::heavyProfile):
2072 * profiler/TreeProfile.h:
2073
2074 2008-07-08 Geoffrey Garen <ggaren@apple.com>
2075
2076 Reviewed by Oliver Hunt.
2077
2078 Added support for checking if an object has custom properties in its
2079 property map. WebCore uses this to optimize marking DOM wrappers.
2080
2081 2008-07-08 Simon Hausmann <hausmann@webkit.org>
2082
2083 Prospective Gtk/Wx build fixes, add ProfileGenerator.cpp to the build.
2084
2085 * GNUmakefile.am:
2086 * JavaScriptCoreSources.bkl:
2087
2088 2008-07-08 Simon Hausmann <hausmann@webkit.org>
2089
2090 Fix the Qt build, add ProfileGenerator.cpp to the build.
2091
2092 * JavaScriptCore.pri:
2093
2094 2008-07-07 David Kilzer <ddkilzer@apple.com>
2095
2096 releaseFastMallocFreeMemory() should always be defined
2097
2098 Reviewed by Darin.
2099
2100 * JavaScriptCore.exp: Changed to export C++ binding for
2101 WTF::releaseFastMallocFreeMemory() instead of C binding for
2102 releaseFastMallocFreeMemory().
2103 * wtf/FastMalloc.cpp: Moved definitions of
2104 releaseFastMallocFreeMemory() to be in the WTF namespace
2105 regardless whether FORCE_SYSTEM_MALLOC is defined.
2106 * wtf/FastMalloc.h: Moved releaseFastMallocFreeMemory() from
2107 extern "C" binding to WTF::releaseFastMallocFreeMemory().
2108
2109 2008-07-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2110
2111 Reviewed by Geoff.
2112
2113 Bug 19926: URL causes crash within a minute
2114 <https://bugs.webkit.org/show_bug.cgi?id=19926>
2115
2116 Add a check that lastGlobalObject is non-null in Machine::execute()
2117 before copying its globals to the current register file.
2118
2119 In theory, it is possible to make a test case for this, but it will
2120 take a while to get it right.
2121
2122 * VM/Machine.cpp:
2123 (KJS::Machine::execute):
2124
2125 2008-07-07 Darin Adler <darin@apple.com>
2126
2127 Rubber stamped by Adele.
2128
2129 * VM/Machine.cpp:
2130 (KJS::Machine::privateExecute): Fix a typo in a comment.
2131
2132 2008-07-07 Steve Falkenburg <sfalken@apple.com>
2133
2134 Build fixes.
2135
2136 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2137 * JavaScriptCore.vcproj/testapi/testapi.vcproj:
2138
2139 2008-07-07 Kevin McCullough <kmccullough@apple.com>
2140
2141 Reviewed by Darin.
2142
2143 When the profiler is running it gathers information and creates a
2144 Profile. After it finishes the Profile can be sorted and have other
2145 data refinements run over it. Both of these were done in the same class
2146 before. Now I split the gathering operations into a new class called
2147 ProfileGenerator.
2148
2149 * JavaScriptCore.xcodeproj/project.pbxproj:
2150 * profiler/Profile.cpp: Removed code related to the gather stage of a
2151 Profile's creation.
2152 (KJS::Profile::create):
2153 (KJS::Profile::Profile):
2154 * profiler/Profile.h: Ditto.
2155 (KJS::Profile::title):
2156 (KJS::Profile::callTree):
2157 (KJS::Profile::setHead):
2158 * profiler/ProfileGenerator.cpp: Added. This is the class that will
2159 handle the stage of creating a Profile. Once the Profile is finished
2160 being created, this class goes away.
2161 (KJS::ProfileGenerator::create):
2162 (KJS::ProfileGenerator::ProfileGenerator):
2163 (KJS::ProfileGenerator::title):
2164 (KJS::ProfileGenerator::willExecute):
2165 (KJS::ProfileGenerator::didExecute):
2166 (KJS::ProfileGenerator::stopProfiling):
2167 (KJS::ProfileGenerator::didFinishAllExecution):
2168 (KJS::ProfileGenerator::removeProfileStart):
2169 (KJS::ProfileGenerator::removeProfileEnd):
2170 * profiler/ProfileGenerator.h: Added.
2171 (KJS::ProfileGenerator::profile):
2172 (KJS::ProfileGenerator::originatingGlobalExec):
2173 (KJS::ProfileGenerator::pageGroupIdentifier):
2174 (KJS::ProfileGenerator::client):
2175 (KJS::ProfileGenerator::stoppedProfiling):
2176 * profiler/Profiler.cpp: Now operates with the ProfileGenerator instead
2177 of the Profile.
2178 (KJS::Profiler::startProfiling):
2179 (KJS::Profiler::stopProfiling):
2180 (KJS::Profiler::didFinishAllExecution): It is here that the Profile is
2181 handed off to its client and the Profile Generator is no longer needed.
2182 (KJS::dispatchFunctionToProfiles):
2183 (KJS::Profiler::willExecute):
2184 (KJS::Profiler::didExecute):
2185 * profiler/Profiler.h: Cleaned up the includes and subsequently the
2186 forward declarations. Also use the new ProfileGenerator.
2187 (KJS::ProfilerClient::~ProfilerClient):
2188 (KJS::Profiler::currentProfiles):
2189 * profiler/TreeProfile.cpp: Use Profile's new interface.
2190 (KJS::TreeProfile::create):
2191 (KJS::TreeProfile::TreeProfile):
2192 * profiler/TreeProfile.h:
2193
2194 2008-07-07 Sam Weinig <sam@webkit.org>
2195
2196 Reviewed by Cameron Zwarich.
2197
2198 Third step in broad cleanup effort.
2199
2200 [ File list elided ]
2201
2202 2008-07-06 Sam Weinig <sam@webkit.org>
2203
2204 Reviewed by Cameron Zwarich.
2205
2206 Second step in broad cleanup effort.
2207
2208 [ File list elided ]
2209
2210 2008-07-05 Sam Weinig <sam@webkit.org>
2211
2212 Reviewed by Cameron Zwarich.
2213
2214 First step in broad cleanup effort.
2215
2216 [ File list elided ]
2217
2218 2008-07-05 Sam Weinig <sam@webkit.org>
2219
2220 Rubber-stamped by Cameron Zwarich.
2221
2222 Rename list.h/cpp to ArgList.h/cpp.
2223
2224 * GNUmakefile.am:
2225 * JavaScriptCore.pri:
2226 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2227 * JavaScriptCore.xcodeproj/project.pbxproj:
2228 * JavaScriptCoreSources.bkl:
2229 * VM/Machine.h:
2230 * kjs/AllInOneFile.cpp:
2231 * kjs/ArgList.cpp: Copied from JavaScriptCore/kjs/list.cpp.
2232 * kjs/ArgList.h: Copied from JavaScriptCore/kjs/list.h.
2233 * kjs/IndexToNameMap.cpp:
2234 * kjs/JSGlobalData.cpp:
2235 * kjs/JSGlobalData.h:
2236 * kjs/JSObject.h:
2237 * kjs/collector.cpp:
2238 * kjs/list.cpp: Removed.
2239 * kjs/list.h: Removed.
2240
2241 2008-07-05 Sam Weinig <sam@webkit.org>
2242
2243 Fix non-AllInOne builds again.
2244
2245 * kjs/BooleanPrototype.cpp:
2246 * kjs/ErrorPrototype.cpp:
2247 * kjs/FunctionPrototype.cpp:
2248 * kjs/NumberPrototype.cpp:
2249 * kjs/ObjectPrototype.cpp:
2250
2251 2008-07-05 Sam Weinig <sam@webkit.org>
2252
2253 Fix build on case-sensitive build systems.
2254
2255 * kjs/IndexToNameMap.cpp:
2256
2257 2008-07-05 Sam Weinig <sam@webkit.org>
2258
2259 Fix build.
2260
2261 * kjs/Arguments.cpp:
2262 * kjs/BooleanPrototype.cpp:
2263 * kjs/DateConstructor.cpp:
2264 * kjs/ErrorPrototype.cpp:
2265 * kjs/FunctionPrototype.cpp:
2266 * kjs/NumberPrototype.cpp:
2267 * kjs/ObjectPrototype.cpp:
2268 * kjs/RegExpPrototype.cpp:
2269 * kjs/StringConstructor.cpp:
2270 * kjs/lookup.cpp:
2271
2272 2008-07-05 Sam Weinig <sam@webkit.org>
2273
2274 Fix non-AllInOne build.
2275
2276 * kjs/JSGlobalObject.cpp:
2277
2278 2008-07-05 Sam Weinig <sam@webkit.org>
2279
2280 Rubber-stamped by Cameron Zwarich.
2281
2282 Split Arguments, IndexToNameMap, PrototypeFunction, GlobalEvalFunction and
2283 the functions on the global object out of JSFunction.h/cpp.
2284
2285 * GNUmakefile.am:
2286 * JavaScriptCore.pri:
2287 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2288 * JavaScriptCore.xcodeproj/project.pbxproj:
2289 * JavaScriptCoreSources.bkl:
2290 * VM/Machine.cpp:
2291 * kjs/AllInOneFile.cpp:
2292 * kjs/Arguments.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
2293 * kjs/Arguments.h: Copied from JavaScriptCore/kjs/JSFunction.h.
2294 * kjs/GlobalEvalFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
2295 * kjs/GlobalEvalFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
2296 * kjs/IndexToNameMap.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
2297 * kjs/IndexToNameMap.h: Copied from JavaScriptCore/kjs/JSFunction.h.
2298 * kjs/JSActivation.cpp:
2299 * kjs/JSFunction.cpp:
2300 * kjs/JSFunction.h:
2301 * kjs/JSGlobalObject.cpp:
2302 * kjs/JSGlobalObjectFunctions.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
2303 * kjs/JSGlobalObjectFunctions.h: Copied from JavaScriptCore/kjs/JSFunction.h.
2304 The functions on the global object should be in JSGlobalObject.cpp, but putting them there
2305 was a 0.5% regression.
2306
2307 * kjs/PrototypeFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
2308 * kjs/PrototypeFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
2309 * kjs/Shell.cpp:
2310 * kjs/lexer.cpp:
2311 * kjs/ustring.cpp:
2312
2313 2008-07-04 Sam Weinig <sam@webkit.org>
2314
2315 Really fix the mac build.
2316
2317 * JavaScriptCore.xcodeproj/project.pbxproj:
2318
2319 2008-07-04 Sam Weinig <sam@webkit.org>
2320
2321 Fix mac build.
2322
2323 * JavaScriptCore.xcodeproj/project.pbxproj:
2324
2325 2008-07-04 Sam Weinig <sam@webkit.org>
2326
2327 Fix non-AllInOne builds.
2328
2329 * kjs/Error.cpp:
2330 * kjs/GetterSetter.cpp:
2331 * kjs/JSImmediate.cpp:
2332 * kjs/operations.cpp:
2333
2334 2008-07-04 Sam Weinig <sam@webkit.org>
2335
2336 Rubber-stamped by Dan Bernstein.
2337
2338 Split Error and GetterSetter out of JSObject.h.
2339
2340 * API/JSCallbackObjectFunctions.h:
2341 * GNUmakefile.am:
2342 * JavaScriptCore.pri:
2343 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2344 * JavaScriptCore.xcodeproj/project.pbxproj:
2345 * JavaScriptCoreSources.bkl:
2346 * kjs/AllInOneFile.cpp:
2347 * kjs/ClassInfo.h: Copied from JavaScriptCore/kjs/JSObject.h.
2348 * kjs/Error.cpp: Copied from JavaScriptCore/kjs/JSObject.cpp.
2349 * kjs/Error.h: Copied from JavaScriptCore/kjs/JSObject.h.
2350 * kjs/GetterSetter.cpp:
2351 * kjs/GetterSetter.h: Copied from JavaScriptCore/kjs/JSObject.h.
2352 * kjs/JSObject.cpp:
2353 * kjs/JSObject.h:
2354 * kjs/nodes.h:
2355
2356 2008-07-04 Simon Hausmann <hausmann@webkit.org>
2357
2358 Fix the Wx build, added TreeProfile.cpp to the build.
2359
2360 * JavaScriptCoreSources.bkl:
2361
2362 2008-07-03 Mark Rowe <mrowe@apple.com>
2363
2364 Reviewed by Oliver Hunt.
2365
2366 Fix output path of recently-added script phase to reference the correct file.
2367 This prevents Xcode from running the script phase unnecessarily, which caused
2368 the generated header to be recreated and lead to AllInOneFile.cpp rebuilding.
2369
2370 * JavaScriptCore.xcodeproj/project.pbxproj:
2371
2372 2008-07-03 Mark Rowe <mrowe@apple.com>
2373
2374 Follow-up to the 64-bit build fix. Use intptr_t rather than ssize_t as
2375 the latter is non-standard and does not exist on Windows.
2376
2377 * kjs/JSLock.cpp:
2378 (KJS::JSLock::lockCount):
2379 (KJS::JSLock::lock):
2380 (KJS::JSLock::unlock):
2381 (KJS::JSLock::DropAllLocks::DropAllLocks):
2382 * kjs/JSLock.h:
2383
2384 2008-07-02 Mark Rowe <mrowe@apple.com>
2385
2386 Fix the 64-bit build. pthread_getspecific works with pointer-sized values,
2387 so use ssize_t rather than int to track the lock count to avoid warnings about
2388 truncating the result of pthread_getspecific.
2389
2390 * kjs/JSLock.cpp:
2391 (KJS::JSLock::lockCount):
2392 (KJS::JSLock::lock):
2393 (KJS::JSLock::unlock):
2394 (KJS::JSLock::DropAllLocks::DropAllLocks):
2395 * kjs/JSLock.h:
2396
2397 2008-07-03 Geoffrey Garen <ggaren@apple.com>
2398
2399 Reviewed by Sam Weinig.
2400
2401 Removed checking for the array get/put fast case from the array code.
2402 Callers who want the fast case should call getIndex and/or setIndex
2403 instead. (get_by_val and put_by_val already do this.)
2404
2405 SunSpider reports no change overall, but a 1.4% speedup on fannkuch and
2406 a 3.6% speedup on nsieve.
2407
2408 2008-07-03 Dan Bernstein <mitz@apple.com>
2409
2410 - Windows build fix
2411
2412 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added TreeProfile.{h,cpp}.
2413
2414 2008-07-03 Dan Bernstein <mitz@apple.com>
2415
2416 Reviewed by Anders Carlsson.
2417
2418 - Windows build fix
2419
2420 * VM/Machine.cpp:
2421 (KJS::Machine::Machine):
2422
2423 2008-07-03 Simon Hausmann <hausmann@webkit.org>
2424
2425 Reviewed by Alexey Proskuryakov.
2426
2427 Fix the non-threaded build.
2428
2429 * kjs/JSGlobalData.cpp:
2430 (KJS::JSGlobalData::threadInstanceInternal):
2431
2432 2008-07-03 Simon Hausmann <hausmann@webkit.org>
2433
2434 Fix the Qt build, added TreeProfile to the build.
2435
2436 * JavaScriptCore.pri:
2437
2438 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
2439
2440 Reviewed by Geoff.
2441
2442 Don't create unnecessary JSGlobalData instances.
2443
2444 * kjs/JSGlobalData.h:
2445 * kjs/JSGlobalData.cpp:
2446 (KJS::JSGlobalData::threadInstanceExists):
2447 (KJS::JSGlobalData::sharedInstanceExists):
2448 (KJS::JSGlobalData::threadInstance):
2449 (KJS::JSGlobalData::sharedInstance):
2450 (KJS::JSGlobalData::threadInstanceInternal):
2451 (KJS::JSGlobalData::sharedInstanceInternal):
2452 Added methods to query instance existence.
2453
2454 * kjs/InitializeThreading.cpp:
2455 (KJS::initializeThreadingOnce):
2456 Initialize thread instance static in a new way.
2457
2458 * API/JSBase.cpp:
2459 (JSGarbageCollect):
2460 * kjs/collector.cpp:
2461 (KJS::Heap::collect):
2462 Check for instance existence before accessing it.
2463
2464 2008-07-02 Geoffrey Garen <ggaren@apple.com>
2465
2466 Reviewed by Cameron Zwarich.
2467
2468 Fixed https://bugs.webkit.org/show_bug.cgi?id=19862
2469 REGRESSION (r34907): Gmail crashes in JavaScriptCore code while editing drafts
2470
2471 I was never able to reproduce this issue, but Cameron could, and he says
2472 that this patch fixes it.
2473
2474 The crash seems tied to a timer or event handler callback. In such a case,
2475 the sole reference to the global object may be in the current call frame,
2476 so we can't depend on the global object to mark the call frame area in
2477 the register file.
2478
2479 The new GC marking rule is: the global object is not responsible for
2480 marking the whole register file -- it's just responsible for the globals
2481 section it's tied to. The heap is responsible for marking the call frame area.
2482
2483 2008-07-02 Mark Rowe <mrowe@apple.com>
2484
2485 Reviewed by Sam Weinig.
2486
2487 Add the ability to trace JavaScriptCore garabge collections using dtrace.
2488
2489 * JavaScriptCore.xcodeproj/project.pbxproj: Generate the dtrace probe header
2490 file when building on a new enough version of Mac OS X.
2491 * JavaScriptCorePrefix.h: Add our standard Mac OS X version detection macros.
2492 * kjs/Tracing.d: Declare three dtrace probes.
2493 * kjs/Tracing.h: Include the generated dtrace macros if dtrace is available,
2494 otherwise provide versions that do nothing.
2495 * kjs/collector.cpp:
2496 (KJS::Heap::collect): Fire dtrace probes when starting a collection, after the
2497 mark phase has completed, and when the collection is complete.
2498 * wtf/Platform.h: Define HAVE_DTRACE when building on a new enough version of Mac OS X.
2499
2500 2008-07-02 Geoffrey Garen <ggaren@apple.com>
2501
2502 Rubber stamped by Oliver Hunt.
2503
2504 Reduced the max register file size from 8MB to 2MB.
2505
2506 We still allow about 20,000 levels of recursion.
2507
2508 2008-07-02 Alp Toker <alp@nuanti.com>
2509
2510 Build fix for r34960. Add TreeProfile.cpp to build.
2511
2512 * GNUmakefile.am:
2513
2514 2008-07-02 Geoffrey Garen <ggaren@apple.com>
2515
2516 Reviewed by Oliver Hunt.
2517
2518 Optimized a[n] get for cases when a is an array or a string. When a is
2519 an array, we optimize both get and put. When a is a string, we only
2520 optimize get, since you can't put to a string.
2521
2522 SunSpider says 3.4% faster.
2523
2524 2008-07-02 Kevin McCullough <kmccullough@apple.com>
2525
2526 Reviewed by Darin.
2527
2528 -Small cleanup in preparation for implementing Bottom-up.
2529
2530 * profiler/CallIdentifier.h: Rename debug function to make it clear of
2531 its output and intention to be debug only.
2532 (KJS::CallIdentifier::operator const char* ): Implement in terms of
2533 c_str.
2534 (KJS::CallIdentifier::c_str):
2535 * profiler/ProfileNode.cpp: Impelment findChild() which will be needed
2536 by the bottom-up implementation.
2537 (KJS::ProfileNode::findChild):
2538 * profiler/ProfileNode.h: Added comments to make the collections of
2539 functions more clear.
2540 (KJS::ProfileNode::operator==):
2541 (KJS::ProfileNode::c_str):
2542
2543 2008-07-02 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2544
2545 Reviewed by Darin.
2546
2547 Bug 19776: Number.toExponential() is incorrect for numbers between 0.1 and 1
2548 <https://bugs.webkit.org/show_bug.cgi?id=19776>
2549
2550 Perform the sign check for the exponent on the actual exponent value,
2551 which is 1 less than the value of decimalPoint, instead of on the value
2552 of decimalPoint itself.
2553
2554 * kjs/NumberPrototype.cpp:
2555 (KJS::exponentialPartToString):
2556
2557 2008-07-02 Kevin McCullough <kmccullough@apple.com>
2558
2559 Reviewed by Darin.
2560
2561 <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
2562 - Subclass TreeProfile as I prepare for a HeavyProfile to be comming
2563 later.
2564
2565 * JavaScriptCore.xcodeproj/project.pbxproj:
2566 * profiler/Profile.cpp: By default we create a TreeProfile.
2567 (KJS::Profile::create):
2568 * profiler/Profile.h: Changes to the Profile class to make it amenable
2569 to be inherited from.
2570 (KJS::Profile::~Profile):
2571 * profiler/TreeProfile.cpp: Added.
2572 (KJS::TreeProfile::create):
2573 (KJS::TreeProfile::TreeProfile):
2574 (KJS::TreeProfile::heavyProfile):
2575 * profiler/TreeProfile.h: Added.
2576 (KJS::TreeProfile::treeProfile):
2577
2578 2008-07-02 Kevin McCullough <kmccullough@apple.com>
2579
2580 Reviewed by Dan.
2581
2582 Broke CallIdentifier out into its own file. I did this because it's
2583 going to grow a lot soon and I wanted this to be a separate patch.
2584
2585 * JavaScriptCore.xcodeproj/project.pbxproj:
2586 * profiler/CallIdentifier.h: Added.
2587 (KJS::CallIdentifier::CallIdentifier):
2588 (KJS::CallIdentifier::operator==):
2589 (KJS::CallIdentifier::operator!=):
2590 (KJS::CallIdentifier::operator const char* ):
2591 (KJS::CallIdentifier::toString):
2592 * profiler/ProfileNode.h:
2593
2594 2008-07-02 Simon Hausmann <hausmann@webkit.org>
2595
2596 Build fix. Implemented missing functions for single-threaded build.
2597
2598 * kjs/JSLock.cpp:
2599 (KJS::JSLock::JSLock):
2600 (KJS::JSLock::lock):
2601 (KJS::JSLock::unlock):
2602 (KJS::JSLock::DropAllLocks::DropAllLocks):
2603
2604 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
2605
2606 Another non-AllInOne build fix.
2607
2608 * kjs/JSGlobalObject.cpp: Include JSLock.h here, too.
2609
2610 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
2611
2612 Non-AllInOne build fix.
2613
2614 * kjs/interpreter.cpp: Include JSLock.h.
2615
2616 2008-06-30 Alexey Proskuryakov <ap@webkit.org>
2617
2618 Reviewed by Darin.
2619
2620 Disable JSLock for per-thread contexts.
2621
2622 No change on SunSpider.
2623
2624 * kjs/JSGlobalData.h:
2625 * kjs/JSGlobalData.cpp:
2626 (KJS::JSGlobalData::JSGlobalData):
2627 (KJS::JSGlobalData::sharedInstance):
2628 Added isSharedInstance as a better way to tell whether the instance is shared (legacy).
2629
2630 * kjs/JSLock.cpp:
2631 (KJS::createJSLockCount):
2632 (KJS::JSLock::lockCount):
2633 (KJS::setLockCount):
2634 (KJS::JSLock::JSLock):
2635 (KJS::JSLock::lock):
2636 (KJS::JSLock::unlock):
2637 (KJS::JSLock::currentThreadIsHoldingLock):
2638 (KJS::JSLock::DropAllLocks::DropAllLocks):
2639 (KJS::JSLock::DropAllLocks::~DropAllLocks):
2640 * kjs/JSLock.h:
2641 (KJS::JSLock::JSLock):
2642 (KJS::JSLock::~JSLock):
2643 Made JSLock and JSLock::DropAllLocks constructors take a parameter to decide whether to
2644 actually lock a mutex, or only to increment recursion count. We cannot turn it into no-op
2645 if we want to keep existing assertions working.
2646 Made recursion count per-thread, now that locks may not lock.
2647
2648 * API/JSBase.cpp:
2649 (JSEvaluateScript): Take JSLock after casting JSContextRef to ExecState* (which doesn't need
2650 locking in any case), so that a decision whether to actually lock can be made.
2651 (JSCheckScriptSyntax): Ditto.
2652 (JSGarbageCollect): Only lock while collecting the shared heap, not the per-thread one.
2653
2654 * API/JSObjectRef.cpp:
2655 (JSClassCreate): Don't lock, as there is no reason to.
2656 (JSClassRetain): Ditto.
2657 (JSClassRelease): Ditto.
2658 (JSPropertyNameArrayRetain): Ditto.
2659 (JSPropertyNameArrayRelease): Only lock while deleting the array, as that may touch
2660 identifier table.
2661 (JSPropertyNameAccumulatorAddName): Adding a string also involves an identifier table
2662 lookup, and possibly modification.
2663
2664 * API/JSStringRef.cpp:
2665 (JSStringCreateWithCharacters):
2666 (JSStringCreateWithUTF8CString):
2667 (JSStringRetain):
2668 (JSStringRelease):
2669 (JSStringGetUTF8CString):
2670 (JSStringIsEqual):
2671 * API/JSStringRefCF.cpp:
2672 (JSStringCreateWithCFString):
2673 JSStringRef operations other than releasing do not need locking.
2674
2675 * VM/Machine.cpp: Don't include unused JSLock.h.
2676
2677 * kjs/CollectorHeapIntrospector.cpp: (KJS::CollectorHeapIntrospector::statistics):
2678 Don't take the lock for real, as heap introspection pauses the process anyway. It seems that
2679 the existing code could cause deadlocks.
2680
2681 * kjs/Shell.cpp:
2682 (functionGC):
2683 (main):
2684 (jscmain):
2685 The test tool uses a per-thread context, so no real locking is required.
2686
2687 * kjs/collector.h:
2688 (KJS::Heap::setGCProtectNeedsLocking): Optionally protect m_protectedValues access with a
2689 per-heap mutex. This is only needed for WebCore Database code, which violates the "no data
2690 migration between threads" by using ProtectedPtr on a background thread.
2691 (KJS::Heap::isShared): Keep a shared flag here, as well.
2692
2693 * kjs/protect.h:
2694 (KJS::::ProtectedPtr):
2695 (KJS::::~ProtectedPtr):
2696 (KJS::::operator):
2697 (KJS::operator==):
2698 (KJS::operator!=):
2699 ProtectedPtr is ony used from WebCore, so it doesn't need to take JSLock. An assertion in
2700 Heap::protect/unprotect guards agains possible future unlocked uses of ProtectedPtr in JSC.
2701
2702 * kjs/collector.cpp:
2703 (KJS::Heap::Heap): Initialize m_isShared.
2704 (KJS::Heap::~Heap): No need to lock for real during destruction, but must keep assertions
2705 in sweep() working.
2706 (KJS::destroyRegisteredThread): Registered thread list is only accessed for shared heap,
2707 so locking is always needed here.
2708 (KJS::Heap::registerThread): Ditto.
2709 (KJS::Heap::markStackObjectsConservatively): Use m_isShared instead of comparing to a shared
2710 instance for a small speedup.
2711 (KJS::Heap::setGCProtectNeedsLocking): Create m_protectedValuesMutex. There is currently no
2712 way to undo this - and ideally, Database code will be fixed to lo longer require this quirk.
2713 (KJS::Heap::protect): Take m_protectedValuesMutex (if it exists) while accessing
2714 m_protectedValues.
2715 (KJS::Heap::unprotect): Ditto.
2716 (KJS::Heap::markProtectedObjects): Ditto.
2717 (KJS::Heap::protectedGlobalObjectCount): Ditto.
2718 (KJS::Heap::protectedObjectCount): Ditto.
2719 (KJS::Heap::protectedObjectTypeCounts): Ditto.
2720
2721 * kjs/ustring.cpp:
2722 * kjs/ustring.h:
2723 Don't include JSLock.h, which is no longer used here. As a result, an explicit include had
2724 to be added to many files in JavaScriptGlue, WebCore and WebKit.
2725
2726 * kjs/JSGlobalObject.cpp:
2727 (KJS::JSGlobalObject::init):
2728 * API/JSCallbackConstructor.cpp:
2729 (KJS::constructJSCallback):
2730 * API/JSCallbackFunction.cpp:
2731 (KJS::JSCallbackFunction::call):
2732 * API/JSCallbackObjectFunctions.h:
2733 (KJS::::init):
2734 (KJS::::getOwnPropertySlot):
2735 (KJS::::put):
2736 (KJS::::deleteProperty):
2737 (KJS::::construct):
2738 (KJS::::hasInstance):
2739 (KJS::::call):
2740 (KJS::::getPropertyNames):
2741 (KJS::::toNumber):
2742 (KJS::::toString):
2743 (KJS::::staticValueGetter):
2744 (KJS::::callbackGetter):
2745 * API/JSContextRef.cpp:
2746 (JSGlobalContextCreate):
2747 (JSGlobalContextRetain):
2748 (JSGlobalContextRelease):
2749 * API/JSValueRef.cpp:
2750 (JSValueIsEqual):
2751 (JSValueIsStrictEqual):
2752 (JSValueIsInstanceOfConstructor):
2753 (JSValueMakeNumber):
2754 (JSValueMakeString):
2755 (JSValueToNumber):
2756 (JSValueToStringCopy):
2757 (JSValueToObject):
2758 (JSValueProtect):
2759 (JSValueUnprotect):
2760 * JavaScriptCore.exp:
2761 * kjs/PropertyNameArray.h:
2762 (KJS::PropertyNameArray::globalData):
2763 * kjs/interpreter.cpp:
2764 (KJS::Interpreter::checkSyntax):
2765 (KJS::Interpreter::evaluate):
2766 Pass a parameter to JSLock/JSLock::DropAllLocks to decide whether the lock needs to be taken.
2767
2768 2008-07-01 Alexey Proskuryakov <ap@webkit.org>
2769
2770 Reviewed by Darin.
2771
2772 https://bugs.webkit.org/show_bug.cgi?id=19834
2773 Failed assertion in JavaScriptCore/VM/SegmentedVector.h:82
2774
2775 Creating a global object with a custom prototype resets it twice (wasteful!).
2776 So, addStaticGlobals() was called twice, but JSGlobalObject::reset() didn't reset
2777 the register array.
2778
2779 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::reset): Call setRegisterArray(0, 0).
2780
2781 * kjs/JSVariableObject.h: Changed registerArray to OwnArrayPtr. Also, added private copy
2782 constructor and operator= to ensure that no one attempts to copy this object (for whatever
2783 reason, I couldn't make Noncopyable work).
2784
2785 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::addStaticGlobals): Allocate registerArray
2786 with new[].
2787
2788 * kjs/JSVariableObject.cpp:
2789 (KJS::JSVariableObject::copyRegisterArray): Allocate registerArray with new[].
2790 (KJS::JSVariableObject::setRegisterArray): Avoid hitting an assertion in OwnArrayPtr when
2791 "changing" the value from 0 to 0.
2792
2793 2008-07-01 Geoffrey Garen <ggaren@apple.com>
2794
2795 Reviewed by Oliver Hunt.
2796
2797 Removed and/or reordered exception checks in array-style a[n] access.
2798
2799 SunSpider says 1.4% faster.
2800
2801 * VM/Machine.cpp:
2802 (KJS::Machine::privateExecute): No need to check for exceptions before
2803 calling toString, toNumber and/or get. If the call ends up being observable
2804 through toString, valueOf, or a getter, we short-circuit it there, instead.
2805 In the op_del_by_val case, I removed the incorrect comment without actually
2806 removing the code, since I didn't want to tempt the GCC fates!
2807
2808 * kjs/JSObject.cpp:
2809 (KJS::callDefaultValueFunction): Added exception check to prevent
2810 toString and valueOf functions from observing execution after an exception
2811 has been thrown. This removes some of the burden of exception checking
2812 from the machine.
2813
2814 (KJS::JSObject::defaultValue): Removed redundant exception check here.
2815
2816 * kjs/PropertySlot.cpp:
2817 (KJS::PropertySlot::functionGetter): Added exception check to prevent
2818 getter functions from observing execution after an exception has been
2819 thrown. This removes some of the burden of exception checking from the
2820 machine.
2821
2822 2008-07-01 Geoffrey Garen <ggaren@apple.com>
2823
2824 Reviewed by Oliver Hunt.
2825
2826 Optimized a[n] get and put for cases where n is an immediate unsigned
2827 value.
2828
2829 SunSpider says 3.5% faster.
2830
2831 2008-07-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2832
2833 Reviewed by Darin.
2834
2835 Bug 19844: JavaScript Switch statement modifies "this"
2836 <https://bugs.webkit.org/show_bug.cgi?id=19844>
2837
2838 Use a temporary when generating code for switch clauses to avoid
2839 overwriting 'this' or a local variable.
2840
2841 * kjs/nodes.cpp:
2842 (KJS::CaseBlockNode::emitCodeForBlock):
2843
2844 2008-07-01 Christian Dywan <christian@twotoasts.de>
2845
2846 Gtk+ build fix.
2847
2848 * kjs/list.cpp: Include "JSCell.h"
2849
2850 2008-07-01 Kevin McCullough <kmccullough@apple.com>
2851
2852 Build fix.
2853
2854 * JavaScriptCore.xcodeproj/project.pbxproj:
2855
2856 2008-07-01 Dan Bernstein <mitz@apple.com>
2857
2858 Reviewed by Anders Carlsson.
2859
2860 - Mac release build fix
2861
2862 * JavaScriptCore.exp:
2863
2864 2008-07-01 Sam Weinig <sam@webkit.org>
2865
2866 Try and fix mac builds.
2867
2868 * JavaScriptCore.exp:
2869
2870 2008-07-01 Sam Weinig <sam@webkit.org>
2871
2872 Fix non-AllInOne builds.
2873
2874 * kjs/DateMath.cpp:
2875
2876 2008-07-01 Sam Weinig <sam@webkit.org>
2877
2878 Reviewed by Darin Adler.
2879
2880 Split JSCell and JSNumberCell class declarations out of JSValue.h
2881
2882 * GNUmakefile.am:
2883 * JavaScriptCore.pri:
2884 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2885 * JavaScriptCore.xcodeproj/project.pbxproj:
2886 * JavaScriptCoreSources.bkl:
2887 * VM/JSPropertyNameIterator.h:
2888 * kjs/AllInOneFile.cpp:
2889 * kjs/JSCell.cpp: Copied from JavaScriptCore/kjs/JSValue.cpp.
2890 * kjs/JSCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
2891 (KJS::JSValue::getJSNumber):
2892 * kjs/JSNumberCell.cpp:
2893 * kjs/JSNumberCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
2894 * kjs/JSObject.h:
2895 * kjs/JSString.cpp:
2896 (KJS::jsString):
2897 (KJS::jsOwnedString):
2898 * kjs/JSString.h:
2899 (KJS::JSValue::toThisJSString):
2900 * kjs/JSValue.cpp:
2901 * kjs/JSValue.h:
2902
2903 2008-07-01 Anders Carlsson <andersca@apple.com>
2904
2905 Build fixes.
2906
2907 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2908 * kjs/JSGlobalObject.h:
2909 (KJS::JSGlobalObject::addStaticGlobals):
2910
2911 2008-07-01 Simon Hausmann <hausmann@webkit.org>
2912
2913 Build fix, include OwnPtr.h.
2914
2915 * kjs/RegExpConstructor.h:
2916
2917 2008-06-30 Geoffrey Garen <ggaren@apple.com>
2918
2919 Reviewed by Oliver Hunt.
2920
2921 Fixed a global object leak caused by the switch to one register file.
2922
2923 Don't unconditionally mark the register file, since that logically
2924 makes all global variables GC roots, even when their global object is
2925 no longer reachable.
2926
2927 Instead, make the global object associated with the register file
2928 responsible for marking the register file.
2929
2930 2008-06-30 Geoffrey Garen <ggaren@apple.com>
2931
2932 Reviewed by Oliver Hunt.
2933
2934 Removed the "registerBase" abstraction. Since the register file never
2935 reallocates, we can keep direct pointers into it, instead of
2936 <registerBase, offset> tuples.
2937
2938 SunSpider says 0.8% faster.
2939
2940 2008-06-30 Oliver Hunt <oliver@apple.com>
2941
2942 Reviewed by NOBODY (build fix).
2943
2944 Fix build by adding all (hopefully) the missing includes.
2945
2946 * kjs/BooleanPrototype.cpp:
2947 * kjs/DateConstructor.cpp:
2948 * kjs/ErrorPrototype.cpp:
2949 * kjs/FunctionPrototype.cpp:
2950 * kjs/NativeErrorConstructor.cpp:
2951 * kjs/NumberPrototype.cpp:
2952 * kjs/ObjectPrototype.cpp:
2953 * kjs/RegExpConstructor.cpp:
2954 * kjs/StringConstructor.cpp:
2955 * kjs/StringPrototype.cpp:
2956
2957 2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2958
2959 Reviewed by Oliver.
2960
2961 Bug 19830: REGRESSION (r34883): Google Reader doesn't show up feed list on sidebar
2962 <https://bugs.webkit.org/show_bug.cgi?id=19830>
2963
2964 Ensure that we do not eliminate a write to a local register when doing
2965 peephole optimizations.
2966
2967 * VM/CodeGenerator.cpp:
2968 (KJS::CodeGenerator::emitJumpIfTrue):
2969 (KJS::CodeGenerator::emitJumpIfFalse):
2970
2971 2008-06-30 Sam Weinig <sam@webkit.org>
2972
2973 Rubber-stamped by Darin Alder.
2974
2975 Split InternalFunction into its own header file.
2976
2977 * API/JSCallbackFunction.h:
2978 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2979 * JavaScriptCore.xcodeproj/project.pbxproj:
2980 * kjs/ArrayConstructor.h:
2981 * kjs/BooleanConstructor.h:
2982 * kjs/DateConstructor.h:
2983 * kjs/ErrorConstructor.h:
2984 * kjs/FunctionConstructor.h:
2985 * kjs/FunctionPrototype.h:
2986 * kjs/InternalFunction.h: Copied from kjs/JSFunction.h.
2987 * kjs/JSFunction.h:
2988 * kjs/NativeErrorConstructor.h:
2989 * kjs/NumberConstructor.h:
2990 * kjs/ObjectConstructor.h:
2991 * kjs/RegExpConstructor.h:
2992 * kjs/StringConstructor.h:
2993 * profiler/Profiler.cpp:
2994
2995 2008-06-30 Sam Weinig <sam@webkit.org>
2996
2997 Reviewed by Kevin McCullough.
2998
2999 Remove empty files Instruction.cpp, LabelID.cpp, Register.cpp and RegisterID.cpp.
3000
3001 * GNUmakefile.am:
3002 * JavaScriptCore.pri:
3003 * JavaScriptCore.xcodeproj/project.pbxproj:
3004 * JavaScriptCoreSources.bkl:
3005 * VM/Instruction.cpp: Removed.
3006 * VM/LabelID.cpp: Removed.
3007 * VM/Register.cpp: Removed.
3008 * VM/RegisterID.cpp: Removed.
3009
3010 2008-06-30 Sam Weinig <sam@webkit.org>
3011
3012 Rubber-stamped (reluctantly) by Kevin McCullough.
3013
3014 Rename date_object.h/cpp to DateInstance.h/cpp
3015
3016 * GNUmakefile.am:
3017 * JavaScriptCore.pri:
3018 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3019 * JavaScriptCore.xcodeproj/project.pbxproj:
3020 * JavaScriptCoreSources.bkl:
3021 * kjs/AllInOneFile.cpp:
3022 * kjs/DateConstructor.cpp:
3023 * kjs/DateInstance.cpp: Copied from kjs/date_object.cpp.
3024 * kjs/DateInstance.h: Copied from kjs/date_object.h.
3025 * kjs/DatePrototype.cpp:
3026 * kjs/DatePrototype.h:
3027 * kjs/date_object.cpp: Removed.
3028 * kjs/date_object.h: Removed.
3029
3030 2008-06-30 Sam Weinig <sam@webkit.org>
3031
3032 Rubber-stamped by Darin Adler.
3033
3034 Remove internal.cpp and move its contents to there own .cpp files.
3035
3036 * GNUmakefile.am:
3037 * JavaScriptCore.pri:
3038 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3039 * JavaScriptCore.xcodeproj/project.pbxproj:
3040 * JavaScriptCoreSources.bkl:
3041 * kjs/AllInOneFile.cpp:
3042 * kjs/GetterSetter.cpp: Copied from kjs/internal.cpp.
3043 * kjs/InternalFunction.cpp: Copied from kjs/internal.cpp.
3044 * kjs/JSNumberCell.cpp: Copied from kjs/internal.cpp.
3045 * kjs/JSString.cpp: Copied from kjs/internal.cpp.
3046 * kjs/JSString.h:
3047 * kjs/LabelStack.cpp: Copied from kjs/internal.cpp.
3048 * kjs/NumberConstructor.cpp:
3049 * kjs/NumberObject.cpp:
3050 (KJS::constructNumber):
3051 (KJS::constructNumberFromImmediateNumber):
3052 * kjs/internal.cpp: Removed.
3053
3054 2008-06-30 Adam Roben <aroben@apple.com>
3055
3056 Fix <rdar://5954749> Assertion failure due to HashTable's use of
3057 operator&
3058
3059 HashTable was passing &value to constructDeletedValue, which in
3060 classes like WebCore::COMPtr would cause an assertion. We now pass
3061 value by reference instead of by address so that the HashTraits
3062 implementations have more flexibility in constructing the deleted
3063 value.
3064
3065 Reviewed by Ada Chan.
3066
3067 * VM/CodeGenerator.h: Updated for changes to HashTraits.
3068 * wtf/HashTable.h:
3069 (WTF::::deleteBucket): Changed to pass bucket by reference instead of
3070 by address.
3071 (WTF::::checkKey): Ditto.
3072 * wtf/HashTraits.h:
3073 (WTF::): Updated HashTraits for HashTable change.
3074
3075 2008-07-01 Alexey Proskuryakov <ap@webkit.org>
3076
3077 Reviewed by Cameron Zwarich.
3078
3079 Make RegisterFile really unmap memory on destruction.
3080
3081 This fixes run-webkit-tests --threaded, which ran out of address space in a few seconds.
3082
3083 * VM/RegisterFile.cpp: (KJS::RegisterFile::~RegisterFile): Unmap all the memory, not just
3084 1/4 of it.
3085
3086 * kjs/JSGlobalObject.h: Don't include RegisterFile.h, so that changes to it don't make
3087 half of WebCore rebuild.
3088
3089 * VM/Machine.h: Don't forward declare RegisterFile, as RegisterFile.h is included already.
3090
3091 * VM/RegisterFile.h: (KJS::RegisterFile::RegisterFile): Assert that the allocation succeeded.
3092
3093 2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3094
3095 Rubber-stamped by Oliver.
3096
3097 Correct the documentation for op_put_by_index.
3098
3099 * VM/Machine.cpp:
3100 (KJS::Machine::privateExecute):
3101
3102 2008-06-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3103
3104 Reviewed by Oliver.
3105
3106 Bug 19821: Merge the instruction pair (less, jfalse)
3107 <https://bugs.webkit.org/show_bug.cgi?id=19821>
3108
3109 This is a 2.4% win on SunSpider. I needed to add an ALWAYS_INLINE
3110 intrinisc to CodeGenerator::rewindBinaryOp() to avoid a massive
3111 regression in regexp-dna.
3112
3113 * VM/CodeBlock.cpp:
3114 (KJS::CodeBlock::dump):
3115 * VM/CodeGenerator.cpp:
3116 (KJS::CodeGenerator::rewindBinaryOp):
3117 (KJS::CodeGenerator::emitJumpIfFalse):
3118 * VM/Machine.cpp:
3119 (KJS::Machine::privateExecute):
3120 * VM/Opcode.cpp:
3121 (KJS::):
3122 * VM/Opcode.h:
3123
3124 2008-06-29 Sam Weinig <sam@webkit.org>
3125
3126 Fix non-AllInOne builds.
3127
3128 * kjs/JSObject.cpp:
3129 * kjs/JSValue.cpp:
3130
3131 2008-06-29 Sam Weinig <sam@webkit.org>
3132
3133 Build fix for Qt.
3134
3135 * kjs/DateMath.cpp:
3136 * kjs/DatePrototype.cpp:
3137
3138 2008-06-29 Sam Weinig <sam@webkit.org>
3139
3140 Rubber-stamped by Cameron Zwarich.
3141
3142 Splits ErrorConstructor, ErrorPrototype, NativeErrorConstructor and
3143 NativeErrorPrototype out of error_object.h/cpp and renames it ErrorInstance.
3144
3145 * GNUmakefile.am:
3146 * JavaScriptCore.pri:
3147 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3148 * JavaScriptCore.xcodeproj/project.pbxproj:
3149 * JavaScriptCoreSources.bkl:
3150 * kjs/AllInOneFile.cpp:
3151 * kjs/ArrayConstructor.cpp:
3152 * kjs/ArrayPrototype.cpp:
3153 * kjs/BooleanPrototype.cpp:
3154 * kjs/DatePrototype.cpp:
3155 * kjs/ErrorConstructor.cpp: Copied from kjs/error_object.cpp.
3156 * kjs/ErrorConstructor.h: Copied from kjs/error_object.h.
3157 * kjs/ErrorInstance.cpp: Copied from kjs/error_object.cpp.
3158 * kjs/ErrorInstance.h: Copied from kjs/error_object.h.
3159 * kjs/ErrorPrototype.cpp: Copied from kjs/error_object.cpp.
3160 * kjs/ErrorPrototype.h: Copied from kjs/error_object.h.
3161 * kjs/JSGlobalObject.cpp:
3162 * kjs/JSObject.cpp:
3163 * kjs/JSValue.cpp:
3164 * kjs/NativeErrorConstructor.cpp: Copied from kjs/error_object.cpp.
3165 * kjs/NativeErrorConstructor.h: Copied from kjs/error_object.h.
3166 * kjs/NativeErrorPrototype.cpp: Copied from kjs/error_object.cpp.
3167 * kjs/NativeErrorPrototype.h: Copied from kjs/error_object.h.
3168 * kjs/NumberPrototype.cpp:
3169 * kjs/RegExpConstructor.cpp:
3170 * kjs/RegExpObject.cpp:
3171 * kjs/RegExpPrototype.cpp:
3172 * kjs/StringPrototype.cpp:
3173 * kjs/error_object.cpp: Removed.
3174 * kjs/error_object.h: Removed.
3175 * kjs/internal.cpp:
3176
3177 2008-06-29 Sam Weinig <sam@webkit.org>
3178
3179 Fix non-AllInOne build.
3180
3181 * kjs/DateConstructor.cpp:
3182 * kjs/DateMath.cpp:
3183 * kjs/JSObject.cpp:
3184
3185 2008-06-29 Sam Weinig <sam@webkit.org>
3186
3187 Rubber-stamped by Oliver Hunt.
3188
3189 Splits DateConstructor and DatePrototype out of date_object.h/cpp
3190 Moves shared Date code into DateMath.
3191
3192 * DerivedSources.make:
3193 * GNUmakefile.am:
3194 * JavaScriptCore.pri:
3195 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3196 * JavaScriptCore.xcodeproj/project.pbxproj:
3197 * JavaScriptCoreSources.bkl:
3198 * kjs/AllInOneFile.cpp:
3199 * kjs/DateConstructor.cpp: Copied from kjs/date_object.cpp.
3200 * kjs/DateConstructor.h: Copied from kjs/date_object.h.
3201 * kjs/DateMath.cpp:
3202 (KJS::ymdhmsToSeconds):
3203 (KJS::):
3204 (KJS::skipSpacesAndComments):
3205 (KJS::findMonth):
3206 (KJS::parseDate):
3207 (KJS::timeClip):
3208 (KJS::formatDate):
3209 (KJS::formatDateUTCVariant):
3210 (KJS::formatTime):
3211 * kjs/DateMath.h:
3212 (KJS::gmtoffset):
3213 * kjs/DatePrototype.cpp: Copied from kjs/date_object.cpp.
3214 * kjs/DatePrototype.h: Copied from kjs/date_object.h.
3215 * kjs/JSGlobalObject.cpp:
3216 * kjs/JSObject.cpp:
3217 * kjs/date_object.cpp:
3218 * kjs/date_object.h:
3219 * kjs/internal.cpp:
3220
3221 2008-06-29 Jan Michael Alonzo <jmalonzo@webkit.org>
3222
3223 Rubber-stamped by Cameron Zwarich
3224
3225 Fix Gtk non-AllInOne build
3226
3227 * GNUmakefile.am: include JSVariableObject.cpp
3228 * kjs/RegExpConstructor.cpp: include RegExpObject.h
3229 * kjs/RegExpObject.h: forward declare RegExpPrototype
3230
3231 2008-06-28 Darin Adler <darin@apple.com>
3232
3233 Reviewed by Sam and Cameron.
3234
3235 - fix https://bugs.webkit.org/show_bug.cgi?id=19805
3236 Array.concat turns missing array elements into "undefined"
3237
3238 Test: fast/js/array-holes.html
3239
3240 * JavaScriptCore.exp: No longer export JSArray::getItem.
3241
3242 * kjs/ArrayPrototype.cpp:
3243 (KJS::arrayProtoFuncConcat): Changed to use getProperty instead of
3244 JSArray::getItem -- need to handle properties from the prototype chain
3245 instead of ignoring them.
3246
3247 * kjs/JSArray.cpp: Removed getItem.
3248 * kjs/JSArray.h: Ditto.
3249
3250 2008-06-28 Darin Adler <darin@apple.com>
3251
3252 Reviewed by Cameron.
3253
3254 - https://bugs.webkit.org/show_bug.cgi?id=19804
3255 optimize access to arrays without "holes"
3256
3257 SunSpider says 1.8% faster.
3258
3259 * kjs/JSArray.cpp:
3260 (KJS::JSArray::JSArray): Initialize m_fastAccessCutoff when creating
3261 arrays. Also updated for new location of m_vectorLength.
3262 (KJS::JSArray::getItem): Updated for new location of m_vectorLength.
3263 (KJS::JSArray::getSlowCase): Added. Broke out the non-hot parts of
3264 getOwnPropertySlot to make the hot part faster.
3265 (KJS::JSArray::getOwnPropertySlot): Added a new faster case for
3266 indices lower than m_fastAccessCutoff. We can do theese with no
3267 additional checks or branches.
3268 (KJS::JSArray::put): Added a new faster case for indices lower than
3269 m_fastAccessCutoff. We can do theese with no additional checks or
3270 branches. Moved the maxArrayIndex handling out of this function.
3271 Added code to set m_fastAccessCutoff when the very last hole in
3272 an array is filled; this is how the cutoff gets set for most arrays.
3273 (KJS::JSArray::putSlowCase): Moved the rest of the put function logic
3274 in here, to make the hot part of the put function faster.
3275 (KJS::JSArray::deleteProperty): Added code to lower m_fastAccessCutoff
3276 when a delete makes a new hole in the array.
3277 (KJS::JSArray::getPropertyNames): Updated for new location of
3278 m_vectorLength.
3279 (KJS::JSArray::increaseVectorLength): Ditto.
3280 (KJS::JSArray::setLength): Added code to lower m_fastAccessCutoff
3281 when setLength makes the array smaller.
3282 (KJS::JSArray::mark): Updated for new location of m_vectorLength.
3283 (KJS::JSArray::sort): Ditto. Set m_fastAccessCutoff after moving
3284 all the holes to the end of the array.
3285 (KJS::JSArray::compactForSorting): Ditto.
3286 (KJS::JSArray::checkConsistency): Added consistency checks fro
3287 m_fastAccessCutoff and updated for the new location of m_vectorLength.
3288
3289 * kjs/JSArray.h: Added declarations for slow case functions.
3290 Replaced m_vectorLength with m_fastAccessCutoff.
3291
3292 2008-06-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3293
3294 Reviewed by Sam.
3295
3296 When executing a native call, check for an exception before writing the
3297 return value.
3298
3299 * VM/Machine.cpp:
3300 (KJS::Machine::privateExecute):
3301
3302 2008-06-28 Mark Rowe <mrowe@apple.com>
3303
3304 Build fix. Flag headers as private or public as is appropriate.
3305 These settings were accidentally removed during some project file cleanup.
3306
3307 * JavaScriptCore.xcodeproj/project.pbxproj:
3308
3309 2008-06-28 Sam Weinig <sam@webkit.org>
3310
3311 Rubber-stamped by Darin Adler.
3312
3313 Splits RegExpConstructor and RegExpPrototype out of RegExpObject.h/cpp
3314
3315 * DerivedSources.make:
3316 * GNUmakefile.am:
3317 * JavaScriptCore.pri:
3318 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3319 * JavaScriptCore.xcodeproj/project.pbxproj:
3320 * JavaScriptCoreSources.bkl:
3321 * VM/Machine.cpp:
3322 * kjs/AllInOneFile.cpp:
3323 * kjs/JSGlobalObject.cpp:
3324 * kjs/RegExpConstructor.cpp: Copied from kjs/RegExpObject.cpp.
3325 * kjs/RegExpConstructor.h: Copied from kjs/RegExpObject.h.
3326 * kjs/RegExpObject.cpp:
3327 * kjs/RegExpObject.h:
3328 * kjs/RegExpPrototype.cpp: Copied from kjs/RegExpObject.cpp.
3329 * kjs/RegExpPrototype.h: Copied from kjs/RegExpObject.h.
3330 * kjs/StringPrototype.cpp:
3331 * kjs/internal.cpp:
3332
3333 2008-06-28 Sam Weinig <sam@webkit.org>
3334
3335 Fix non-AllInOne builds.
3336
3337 * kjs/StringConstructor.cpp:
3338
3339 2008-06-28 Sam Weinig <sam@webkit.org>
3340
3341 Rubber-stamped by Darin Adler.
3342
3343 Rename string_object.h/cpp to StringObject.h/cpp and split out StringObjectThatMasqueradesAsUndefined,
3344 StringConstructor and StringPrototype.
3345
3346 * DerivedSources.make:
3347 * GNUmakefile.am:
3348 * JavaScriptCore.pri:
3349 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3350 * JavaScriptCore.xcodeproj/project.pbxproj:
3351 * JavaScriptCoreSources.bkl:
3352 * kjs/AllInOneFile.cpp:
3353 * kjs/JSGlobalObject.cpp:
3354 * kjs/StringConstructor.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
3355 * kjs/StringConstructor.h: Copied from JavaScriptCore/kjs/string_object.h.
3356 * kjs/StringObject.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
3357 * kjs/StringObject.h: Copied from JavaScriptCore/kjs/string_object.h.
3358 * kjs/StringObjectThatMasqueradesAsUndefined.h: Copied from JavaScriptCore/kjs/string_object.h.
3359 * kjs/StringPrototype.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
3360 * kjs/StringPrototype.h: Copied from JavaScriptCore/kjs/string_object.h.
3361 * kjs/internal.cpp:
3362 * kjs/string_object.cpp: Removed.
3363 * kjs/string_object.h: Removed.
3364
3365 2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
3366
3367 Gtk build fix: JSVariableObject is now part of AllInOne
3368
3369 * GNUmakefile.am:
3370
3371 2008-06-28 Darin Adler <darin@apple.com>
3372
3373 Reviewed by Oliver.
3374
3375 - https://bugs.webkit.org/show_bug.cgi?id=19801
3376 add a feature so we can tell what regular expressions are taking time
3377
3378 * pcre/pcre_compile.cpp:
3379 (jsRegExpCompile): Compile in the string if REGEXP_HISTOGRAM is on.
3380
3381 * pcre/pcre_exec.cpp:
3382 (jsRegExpExecute): Add hook to time execution.
3383 (Histogram::~Histogram): Print a sorted list of what took time.
3384 (Histogram::add): Accumulate records of what took time.
3385 (HistogramTimeLogger::~HistogramTimeLogger): Hook that calls
3386 Histogram::add at the right moment and creates the global histogram
3387 object.
3388
3389 * pcre/pcre_internal.h: Define REGEXP_HISTOGRAM.
3390
3391 * pcre/pcre_tables.cpp: Added missing include of "config.h". Not needed
3392 any more, but an omissions an earlier version of this patch detected.
3393 * pcre/pcre_ucp_searchfuncs.cpp: Ditto.
3394 * pcre/pcre_xclass.cpp: Ditto.
3395
3396 2008-06-28 Sam Weinig <sam@webkit.org>
3397
3398 Try and fix the Windows build again.
3399
3400 * kjs/RegExpObject.cpp:
3401 * kjs/date_object.cpp:
3402 * kjs/error_object.cpp:
3403
3404 2008-06-28 Sam Weinig <sam@webkit.org>
3405
3406 Rubber-stamped by Darin Adler.
3407
3408 Remove unused StringConstructorFunction class.
3409
3410 * kjs/string_object.h:
3411
3412 2008-06-28 Sam Weinig <sam@webkit.org>
3413
3414 Fix windows build.
3415
3416 * kjs/ArrayPrototype.cpp:
3417 * kjs/BooleanPrototype.cpp:
3418 * kjs/BooleanPrototype.h:
3419 * kjs/FunctionPrototype.cpp:
3420 * kjs/JSImmediate.cpp:
3421 * kjs/JSObject.cpp:
3422 * kjs/MathObject.cpp:
3423 * kjs/NumberPrototype.cpp:
3424 * kjs/NumberPrototype.h:
3425 * kjs/ObjectConstructor.cpp:
3426 * kjs/RegExpObject.h:
3427 * kjs/error_object.h:
3428 * kjs/string_object.cpp:
3429
3430 2008-06-28 Sam Weinig <sam@webkit.org>
3431
3432 Rubber-stamped by Oliver Hunt.
3433
3434 Splits FunctionConstructor out of FunctionPrototype.h/cpp
3435 Splits NumberConstructor and NumberPrototype out of NumberObject.h/cpp
3436 Rename object_object.h/cpp to ObjectPrototype.h/cpp and split out ObjectConstructor.
3437
3438 * API/JSCallbackConstructor.cpp:
3439 * API/JSClassRef.cpp:
3440 * API/JSObjectRef.cpp:
3441 * DerivedSources.make:
3442 * GNUmakefile.am:
3443 * JavaScriptCore.pri:
3444 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3445 * JavaScriptCore.xcodeproj/project.pbxproj:
3446 * JavaScriptCoreSources.bkl:
3447 * VM/Machine.cpp:
3448 * kjs/AllInOneFile.cpp:
3449 * kjs/ArrayConstructor.cpp:
3450 * kjs/ArrayConstructor.h:
3451 * kjs/FunctionConstructor.cpp: Copied from JavaScriptCore/kjs/FunctionPrototype.cpp.
3452 * kjs/FunctionConstructor.h: Copied from JavaScriptCore/kjs/FunctionPrototype.h.
3453 * kjs/FunctionPrototype.cpp:
3454 * kjs/FunctionPrototype.h:
3455 * kjs/JSFunction.cpp:
3456 * kjs/JSGlobalObject.cpp:
3457 * kjs/JSImmediate.cpp:
3458 * kjs/MathObject.h:
3459 * kjs/NumberConstructor.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
3460 * kjs/NumberConstructor.h: Copied from JavaScriptCore/kjs/NumberObject.h.
3461 * kjs/NumberObject.cpp:
3462 * kjs/NumberObject.h:
3463 * kjs/NumberPrototype.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
3464 * kjs/NumberPrototype.h: Copied from JavaScriptCore/kjs/NumberObject.h.
3465 * kjs/ObjectConstructor.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
3466 * kjs/ObjectConstructor.h: Copied from JavaScriptCore/kjs/object_object.h.
3467 * kjs/ObjectPrototype.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
3468 * kjs/ObjectPrototype.h: Copied from JavaScriptCore/kjs/object_object.h.
3469 * kjs/RegExpObject.h:
3470 * kjs/Shell.cpp:
3471 * kjs/error_object.h:
3472 * kjs/internal.cpp:
3473 * kjs/nodes.cpp:
3474 * kjs/object_object.cpp: Removed.
3475 * kjs/object_object.h: Removed.
3476 * kjs/string_object.h:
3477
3478 2008-06-28 Darin Adler <darin@apple.com>
3479
3480 Reviewed by Oliver.
3481
3482 - fix https://bugs.webkit.org/show_bug.cgi?id=19796
3483 optimize expressions with ignored results (especially post-increment)
3484
3485 SunSpider says 0.9% faster.
3486
3487 * VM/CodeGenerator.h:
3488 (KJS::CodeGenerator::tempDestination): Create a new temporary for
3489 ignoredResult() too, just as we would for 0.
3490 (KJS::CodeGenerator::finalDestination): Use the temporary if the
3491 register passed in is ignoredResult() too, just as we would for 0.
3492 (KJS::CodeGenerator::destinationForAssignResult): Return 0 if the
3493 passed in register is ignoredResult(), just as we would for 0.
3494 (KJS::CodeGenerator::moveToDestinationIfNeeded): Return 0 if the
3495 register passed in is ignoredResult(). What matters is that we
3496 don't want to emit a move. The return value won't be looked at.
3497 (KJS::CodeGenerator::emitNode): Allow ignoredResult() and pass it
3498 through to the node's emitCode function.
3499
3500 * VM/RegisterID.h:
3501 (KJS::ignoredResult): Added. Special value to indicate the result of
3502 a node will be ignored and need not be put in any register.
3503
3504 * kjs/nodes.cpp:
3505 (KJS::NullNode::emitCode): Do nothing if dst == ignoredResult().
3506 (KJS::BooleanNode::emitCode): Ditto.
3507 (KJS::NumberNode::emitCode): Ditto.
3508 (KJS::StringNode::emitCode): Ditto.
3509 (KJS::RegExpNode::emitCode): Ditto.
3510 (KJS::ThisNode::emitCode): Ditto.
3511 (KJS::ResolveNode::emitCode): Do nothing if dst == ignoredResult() and
3512 the identifier resolves to a local variable.
3513 (KJS::ObjectLiteralNode::emitCode): Do nothing if dst == ignoredResult()
3514 and the object is empty.
3515 (KJS::PostIncResolveNode::emitCode): If dst == ignoredResult(), then do
3516 nothing for the local constant case, and do a pre-increment in all the
3517 other cases.
3518 (KJS::PostDecResolveNode::emitCode): Ditto.
3519 (KJS::PostIncBracketNode::emitCode): Ditto.
3520 (KJS::PostDecBracketNode::emitCode): Ditto.
3521 (KJS::PostIncDotNode::emitCode): Ditto.
3522 (KJS::PostDecDotNode::emitCode): Ditto.
3523 (KJS::DeleteValueNode::emitCode): Pass ignoredResult() when evaluating
3524 the expression.
3525 (KJS::VoidNode::emitCode): Ditto.
3526 (KJS::TypeOfResolveNode::emitCode): If dst == ignoredResult(), do nothing
3527 if the identifier resolves to a local variable, and don't bother generating
3528 a typeof opcode in the other case.
3529 (KJS::TypeOfValueNode::emitCode): Ditto.
3530 (KJS::PreIncResolveNode::emitCode): Do nothing if dst == ignoredResult() and
3531 the identifier resolves to a local constant.
3532 (KJS::PreDecResolveNode::emitCode): Ditto.
3533 (KJS::AssignResolveNode::emitCode): Turn ignoredResult() into 0 in a couple
3534 places, because we need to put the result into a register so we can assign
3535 it. At other sites this is taken care of by functions like finalDestination.
3536 (KJS::CommaNode::emitCode): Pass ignoredResult() when evaluating the first
3537 expression.
3538 (KJS::ForNode::emitCode): Pass ignoredResult() when evaluating the first and
3539 third expressions.
3540 (KJS::ForInNode::emitCode): Pass ignoredResult() when evaluating the first
3541 expression.
3542
3543 2008-06-28 Darin Adler <darin@apple.com>
3544
3545 Reviewed by Oliver.
3546
3547 - https://bugs.webkit.org/show_bug.cgi?id=19787
3548 create most arrays from values in registers rather than with multiple put operations
3549
3550 SunSpider says 0.8% faster.
3551
3552 * VM/CodeBlock.cpp:
3553 (KJS::CodeBlock::dump): Added argv and argc parameters to new_array.
3554 * VM/Machine.cpp:
3555 (KJS::Machine::privateExecute): Ditto.
3556
3557 * VM/CodeGenerator.cpp:
3558 (KJS::CodeGenerator::emitNewArray): Added.
3559 * VM/CodeGenerator.h: Added ElementNode* argument to emitNewArray.
3560
3561 * kjs/nodes.cpp:
3562 (KJS::ArrayNode::emitCode): Pass the ElementNode to emitNewArray so it can be
3563 initialized with as many elements as possible. If the array doesn't have any
3564 holes in it, that's all that's needed. If there are holes, then emit some separate
3565 put operations for the other values in the array and for the length as needed.
3566
3567 * kjs/nodes.h: Added some accessors to ElementNode so the code generator can
3568 iterate through elements and generate code to evaluate them. Now ArrayNode does
3569 not need to be a friend. Also took out some unused PlacementNewAdoptType
3570 constructors.
3571
3572 2008-06-28 Darin Adler <darin@apple.com>
3573
3574 Reviewed by Oliver.
3575
3576 * kjs/nodes.h: Remove obsolete PlacementNewAdopt constructors.
3577 We no longer mutate the AST in place.
3578
3579 2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
3580
3581 Reviewed by Oliver Hunt.
3582
3583 Build fix
3584
3585 * VM/Machine.cpp: include stdio.h for printf
3586
3587 2008-06-27 Sam Weinig <sam@webkit.org>
3588
3589 Reviewed by Oliver Hunt.
3590
3591 Fix platforms that don't use AllInOne.cpp
3592
3593 * kjs/BooleanConstructor.h:
3594 * kjs/BooleanPrototype.h:
3595 * kjs/FunctionPrototype.cpp:
3596
3597 2008-06-27 Sam Weinig <sam@webkit.org>
3598
3599 Rubber-stamped by Oliver Hunt.
3600
3601 Splits ArrayConstructor out of ArrayPrototype.h/cpp
3602 Splits BooleanConstructor and BooleanPrototype out of BooleanObject.h/cpp
3603
3604 * GNUmakefile.am:
3605 * JavaScriptCore.pri:
3606 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3607 * JavaScriptCore.xcodeproj/project.pbxproj:
3608 * JavaScriptCoreSources.bkl:
3609 * VM/Machine.cpp:
3610 * kjs/AllInOneFile.cpp:
3611 * kjs/ArrayConstructor.cpp: Copied from kjs/ArrayPrototype.cpp.
3612 * kjs/ArrayConstructor.h: Copied from kjs/ArrayPrototype.h.
3613 * kjs/ArrayPrototype.cpp:
3614 * kjs/ArrayPrototype.h:
3615 * kjs/BooleanConstructor.cpp: Copied from kjs/BooleanObject.cpp.
3616 * kjs/BooleanConstructor.h: Copied from kjs/BooleanObject.h.
3617 * kjs/BooleanObject.cpp:
3618 * kjs/BooleanObject.h:
3619 * kjs/BooleanPrototype.cpp: Copied from kjs/BooleanObject.cpp.
3620 * kjs/BooleanPrototype.h: Copied from kjs/BooleanObject.h.
3621 * kjs/CommonIdentifiers.h:
3622 * kjs/FunctionPrototype.cpp:
3623 * kjs/JSArray.cpp:
3624 * kjs/JSGlobalObject.cpp:
3625 * kjs/JSImmediate.cpp:
3626 * kjs/Shell.cpp:
3627 * kjs/internal.cpp:
3628 * kjs/nodes.cpp:
3629 * kjs/string_object.cpp:
3630
3631 2008-06-27 Oliver Hunt <oliver@apple.com>
3632
3633 Reviewed by Sam.
3634
3635 Bug 18626: SQUIRRELFISH: support the "slow script" dialog <https://bugs.webkit.org/show_bug.cgi?id=18626>
3636 <rdar://problem/5973931> Slow script dialog needs to be reimplemented for squirrelfish
3637
3638 Adds support for the slow script dialog in squirrelfish. This requires the addition
3639 of three new op codes, op_loop, op_loop_if_true, and op_loop_if_less which have the
3640 same behaviour as their simple jump equivalents but have an additional time out check.
3641
3642 Additional assertions were added to other jump instructions to prevent accidentally
3643 creating loops with jump types that do not support time out checks.
3644
3645 Sunspider does not report a regression, however this appears very sensitive to code
3646 layout and hardware, so i would expect up to a 1% regression on other systems.
3647
3648 Part of this required moving the old timeout logic from JSGlobalObject and into Machine
3649 which is the cause of a number of the larger diff blocks.
3650
3651 * JavaScriptCore.exp:
3652 * VM/CodeBlock.cpp:
3653 (KJS::CodeBlock::dump):
3654 * VM/CodeGenerator.cpp:
3655 (KJS::CodeGenerator::emitJumpIfTrue):
3656 (KJS::CodeGenerator::emitJumpScopes):
3657 * VM/ExceptionHelpers.cpp:
3658 (KJS::InterruptedExecutionError::isWatchdogException):
3659 (KJS::createInterruptedExecutionException):
3660 * VM/ExceptionHelpers.h:
3661 * VM/LabelID.h:
3662 * VM/Machine.cpp:
3663 (KJS::Machine::Machine):
3664 (KJS::Machine::throwException):
3665 (KJS::Machine::resetTimeoutCheck):
3666 (KJS::getCurrentTime):
3667 (KJS::Machine::checkTimeout):
3668 (KJS::Machine::privateExecute):
3669 * VM/Machine.h:
3670 (KJS::Machine::setTimeoutTime):
3671 (KJS::Machine::startTimeoutCheck):
3672 (KJS::Machine::stopTimeoutCheck):
3673 (KJS::Machine::initTimeout):
3674 * VM/Opcode.cpp:
3675 (KJS::):
3676 * VM/Opcode.h:
3677 * kjs/JSGlobalObject.cpp:
3678 (KJS::JSGlobalObject::init):
3679 (KJS::JSGlobalObject::setTimeoutTime):
3680 (KJS::JSGlobalObject::startTimeoutCheck):
3681 * kjs/JSGlobalObject.h:
3682 * kjs/JSObject.h:
3683 * kjs/interpreter.cpp:
3684 (KJS::Interpreter::evaluate):
3685
3686 2008-06-27 Jan Michael Alonzo <jmalonzo@webkit.org>
3687
3688 Gtk and Qt build fix: Remove RegisterFileStack from the build
3689 scripts.
3690
3691 * GNUmakefile.am:
3692 * JavaScriptCore.pri:
3693
3694 2008-06-27 Adele Peterson <adele@apple.com>
3695
3696 Reviewed by Geoff.
3697
3698 Build fixes.
3699
3700 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3701 * VM/RegisterFile.h:
3702 (KJS::RegisterFile::RegisterFile):
3703 * kjs/JSGlobalObject.cpp:
3704 * kjs/collector.cpp:
3705
3706 2008-06-27 Geoffrey Garen <ggaren@apple.com>
3707
3708 Reviewed by Oliver Hunt.
3709
3710 One RegisterFile to rule them all!
3711
3712 SunSpider reports a 0.2% speedup.
3713
3714 This patch removes the RegisterFileStack abstraction and replaces it with
3715 a single register file that
3716
3717 (a) allocates a fixed storage area, including a fixed area for global
3718 vars, so that no operation may cause the register file to reallocate
3719
3720 and
3721
3722 (b) swaps between global storage areas when executing code in different
3723 global objects.
3724
3725 This patch also changes the layout of the register file so that all call
3726 frames, including call frames for global code, get a header. This is
3727 required to support re-entrant global code. It also just makes things simpler.
3728
3729 * VM/CodeGenerator.cpp:
3730 (KJS::CodeGenerator::addGlobalVar): New function. Differs from addVar in
3731 that
3732
3733 (a) global vars don't contribute to a CodeBlock's numLocals count, since
3734 global storage is fixed and allocated at startup
3735
3736 and
3737
3738 (b) references to global vars get shifted to elide intermediate stack
3739 between "r" and the global storage area.
3740
3741 * VM/Machine.cpp:
3742 (KJS::Machine::dumpRegisters): Updated this function to match the new
3743 register file layout, and added the ability to dump exact identifiers
3744 for the different parts of a call frame.
3745
3746 (KJS::Machine::unwindCallFrame): Updated this function to match the new
3747 register file layout.
3748
3749 (KJS::Machine::execute): Updated this function to initialize a call frame
3750 header for global code, and to swap global storage areas when switching
3751 to execution in a new global object.
3752
3753 (KJS::Machine::privateExecute): Got rid of "safeForReentry" and re-reading
3754 of registerBase because the register file is always safe for reentry now,
3755 and registerBase never changes.
3756
3757 * VM/Machine.h: Moved the call frame header enum from Machine to RegisterFile,
3758 to resolve a header dependency problem (a good sign that the enum belonged
3759 in RegisterFile all along!)
3760
3761 * VM/RegisterFile.cpp:
3762 * VM/RegisterFile.h: Changed RegisterFile to mmap a fixed size register
3763 area. This allows us to avoid re-allocting the register file later on.
3764 Instead, we rely on the OS to allocate physical pages to the register
3765 file as necessary.
3766
3767 * VM/RegisterFileStack.cpp: Removed. Tada!
3768 * VM/RegisterFileStack.h: Removed. Tada!
3769
3770 * kjs/DebuggerCallFrame.cpp: Updated this class to match the new
3771 register file layout, greatly simplifying it in the process.
3772
3773 * kjs/JSActivation.h:
3774 * kjs/JSActivation.cpp: Moved some of this logic up to JSVariableObject,
3775 since the global object now needs to be able to tear off its registers
3776 just like the activation object.
3777
3778 * kjs/JSFunction.cpp: No need to fiddle with the register file anymore.
3779
3780 * kjs/JSGlobalObject.h:
3781 * kjs/JSGlobalObject.cpp: Updated JSGlobalObject to support moving its
3782 global storage area into and out of the register file.
3783
3784 * kjs/PropertySlot.cpp: No need to fiddle with the register file anymore.
3785
3786 * kjs/collector.cpp: Renamed markStackObjectConservatively to
3787 markConservatively, since we don't just mark stack objects this way.
3788
3789 Also, added code to mark the machine's register file.
3790
3791 * kjs/config.h: Moved some platforms #defines from here...
3792 * wtf/Platform.h: ...to here, to support mmap/VirtualAlloc detection
3793 in RegisterFile.h.
3794
3795 2008-06-26 Mark Rowe <mrowe@apple.com>
3796
3797 Speculative fix for the Windows build.
3798
3799 * kjs/JSImmediate.cpp:
3800
3801 2008-06-26 Mark Rowe <mrowe@apple.com>
3802
3803 Reviewed by Darin Adler and Geoff Garen.
3804
3805 Fix the malloc zone introspection functions so that malloc_zone_statistics does not give
3806 bogus output in an application that uses JavaScriptCore.
3807
3808 * kjs/CollectorHeapIntrospector.cpp:
3809 (KJS::CollectorHeapIntrospector::statistics): Return statistics about memory allocated by the collector.
3810 * kjs/CollectorHeapIntrospector.h:
3811 * wtf/FastMalloc.cpp: Zero out the statistics. FastMalloc doesn't track this information at present.
3812 Returning zero for all values is preferable to returning bogus data.
3813
3814 2008-06-26 Darin Adler <darin@apple.com>
3815
3816 Reviewed by Geoff.
3817
3818 - https://bugs.webkit.org/show_bug.cgi?id=19721
3819 speed up JavaScriptCore by not wrapping strings in objects just
3820 to call functions on them
3821
3822 - optimize UString append and the replace function a bit
3823
3824 SunSpider says 1.8% faster.
3825
3826 * JavaScriptCore.exp: Updated.
3827
3828 * VM/JSPropertyNameIterator.cpp: Added include of JSString.h, now needed
3829 because jsString returns a JSString*.
3830
3831 * VM/Machine.cpp:
3832 (KJS::Machine::privateExecute): Removed the toObject call from native
3833 function calls. Also removed code to put the this value into a register.
3834
3835 * kjs/BooleanObject.cpp:
3836 (KJS::booleanProtoFuncToString): Rewrite to handle false and true
3837 separately.
3838
3839 * kjs/FunctionPrototype.cpp:
3840 (KJS::constructFunction): Use single-character append rather than building
3841 a string for each character.
3842 * kjs/JSFunction.cpp:
3843 (KJS::globalFuncUnescape): Ditto.
3844
3845 * kjs/JSImmediate.cpp:
3846 (KJS::JSImmediate::prototype): Added. Gets the appropriate prototype for
3847 use with an immediate value. To be used instead of toObject when doing a
3848 get on an immediate value.
3849 * kjs/JSImmediate.h: Added prototype.
3850
3851 * kjs/JSObject.cpp:
3852 (KJS::JSObject::toString): Tweaked formatting.
3853
3854 * kjs/JSObject.h:
3855 (KJS::JSValue::get): Use prototype instead of toObject to avoid creating
3856 an object wrapper just to search for properties. This also saves an
3857 unnecessary hash table lookup since the object wrappers themselves don't
3858 have any properties.
3859
3860 * kjs/JSString.h: Added toThisString and toThisJSString.
3861
3862 * kjs/JSValue.cpp:
3863 (KJS::JSCell::toThisString): Added.
3864 (KJS::JSCell::toThisJSString): Added.
3865 (KJS::JSCell::getJSNumber): Added.
3866 (KJS::jsString): Changed return type to JSString*.
3867 (KJS::jsOwnedString): Ditto.
3868
3869 * kjs/JSValue.h:
3870 (KJS::JSValue::toThisString): Added.
3871 (KJS::JSValue::toThisJSString): Added.
3872 (KJS::JSValue::getJSNumber): Added.
3873
3874 * kjs/NumberObject.cpp:
3875 (KJS::NumberObject::getJSNumber): Added.
3876 (KJS::integer_part_noexp): Append C string directly rather than first
3877 turning it into a UString.
3878 (KJS::numberProtoFuncToString): Use getJSNumber to check if the value
3879 is a number rather than isObject(&NumberObject::info). This works for
3880 immediate numbers, number cells, and NumberObject instances.
3881 (KJS::numberProtoFuncToLocaleString): Ditto.
3882 (KJS::numberProtoFuncValueOf): Ditto.
3883 (KJS::numberProtoFuncToFixed): Ditto.
3884 (KJS::numberProtoFuncToExponential): Ditto.
3885 (KJS::numberProtoFuncToPrecision): Ditto.
3886 * kjs/NumberObject.h: Added getJSNumber.
3887
3888 * kjs/PropertySlot.cpp: Tweaked comment.
3889
3890 * kjs/internal.cpp:
3891 (KJS::JSString::toThisString): Added.
3892 (KJS::JSString::toThisJSString): Added.
3893 (KJS::JSString::getOwnPropertySlot): Changed code that searches the
3894 prototype chain to start with the string prototype and not create a
3895 string object.
3896 (KJS::JSNumberCell::toThisString): Added.
3897 (KJS::JSNumberCell::getJSNumber): Added.
3898
3899 * kjs/lookup.cpp:
3900 (KJS::staticFunctionGetter): Moved here, because there's no point in
3901 having a function that's only used for a function pointer be inline.
3902 (KJS::setUpStaticFunctionSlot): New function for getStaticFunctionSlot.
3903
3904 * kjs/lookup.h:
3905 (KJS::staticValueGetter): Don't mark this inline. It doesn't make sense
3906 to have a function that's only used for a function pointer be inline.
3907 (KJS::getStaticFunctionSlot): Changed to get properties from the parent
3908 first before doing any handling of functions. This is the fastest way
3909 to return the function once the initial setup is done.
3910
3911 * kjs/string_object.cpp:
3912 (KJS::StringObject::getPropertyNames): Call value() instead of getString(),
3913 avoiding an unnecessary virtual function call (the call to the type()
3914 function in the implementation of the isString() function).
3915 (KJS::StringObject::toString): Added.
3916 (KJS::StringObject::toThisString): Added.
3917 (KJS::StringObject::toThisJSString): Added.
3918 (KJS::substituteBackreferences): Rewrote to use a appending algorithm
3919 instead of a the old one that tried to replace in place.
3920 (KJS::stringProtoFuncReplace): Merged this function and the replace function.
3921 Replaced the hand-rolled dynamic arrays for source ranges and replacements
3922 with Vector.
3923 (KJS::stringProtoFuncToString): Handle JSString as well as StringObject.
3924 Removed the separate valueOf implementation, since it can just share this.
3925 (KJS::stringProtoFuncCharAt): Use toThisString, which handles JSString as
3926 well as StringObject, and is slightly more efficient than the old code too.
3927 (KJS::stringProtoFuncCharCodeAt): Ditto.
3928 (KJS::stringProtoFuncConcat): Ditto.
3929 (KJS::stringProtoFuncIndexOf): Ditto.
3930 (KJS::stringProtoFuncLastIndexOf): Ditto.
3931 (KJS::stringProtoFuncMatch): Ditto.
3932 (KJS::stringProtoFuncSearch): Ditto.
3933 (KJS::stringProtoFuncSlice): Ditto.
3934 (KJS::stringProtoFuncSplit): Ditto.
3935 (KJS::stringProtoFuncSubstr): Ditto.
3936 (KJS::stringProtoFuncSubstring): Ditto.
3937 (KJS::stringProtoFuncToLowerCase): Use toThisJSString.
3938 (KJS::stringProtoFuncToUpperCase): Ditto.
3939 (KJS::stringProtoFuncToLocaleLowerCase): Ditto.
3940 (KJS::stringProtoFuncToLocaleUpperCase): Ditto.
3941 (KJS::stringProtoFuncLocaleCompare): Ditto.
3942 (KJS::stringProtoFuncBig): Use toThisString.
3943 (KJS::stringProtoFuncSmall): Ditto.
3944 (KJS::stringProtoFuncBlink): Ditto.
3945 (KJS::stringProtoFuncBold): Ditto.
3946 (KJS::stringProtoFuncFixed): Ditto.
3947 (KJS::stringProtoFuncItalics): Ditto.
3948 (KJS::stringProtoFuncStrike): Ditto.
3949 (KJS::stringProtoFuncSub): Ditto.
3950 (KJS::stringProtoFuncSup): Ditto.
3951 (KJS::stringProtoFuncFontcolor): Ditto.
3952 (KJS::stringProtoFuncFontsize): Ditto.
3953 (KJS::stringProtoFuncAnchor): Ditto.
3954 (KJS::stringProtoFuncLink): Ditto.
3955
3956 * kjs/string_object.h: Added toString, toThisString, and toThisJSString.
3957
3958 * kjs/ustring.cpp:
3959 (KJS::UString::append): Added a version that takes a character pointer and
3960 size, so we don't have to create a UString just to append to another UString.
3961 * kjs/ustring.h:
3962
3963 2008-06-26 Alexey Proskuryakov <ap@webkit.org>
3964
3965 Reviewed by Maciej.
3966
3967 Make JSGlobalData per-thread.
3968
3969 No change on SunSpider total.
3970
3971 * wtf/ThreadSpecific.h: Re-enabled the actual implementation.
3972
3973 * kjs/JSGlobalObject.cpp:
3974 (KJS::JSGlobalObject::~JSGlobalObject): Re-added a JSLock-related assertion. We'll probably
3975 want to preserve these somehow to keep legacy behavior in working condition.
3976 (KJS::JSGlobalObject::init): Initialize globalData pointer earlier, so that it is ready
3977 when updating JSGlobalObject linked list.
3978
3979 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::head): Changed head() to be non-static, and
3980 to use JSGlobalData associated with the current object.
3981
3982 * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Removed a no longer needed
3983 Heap::registerAsMainThread() call.
3984
3985 * kjs/JSGlobalData.h: Removed a lying lie comment - parserObjectExtraRefCounts is not
3986 transient, and while newParserObjects may conceptually be such, there is still some node
3987 manipulation going on outside Parser::parse which touches it.
3988
3989 * kjs/JSGlobalData.cpp:
3990 (KJS::JSGlobalData::~JSGlobalData): Delete recently added members.
3991 (KJS::JSGlobalData::sharedInstance): Actually use a separate instance.
3992
3993 * kjs/collector.cpp:
3994 (KJS::Heap::Heap):
3995 (KJS::Heap::~Heap): Added a destructor, which unconditionally deletes everything.
3996 (KJS::Heap::sweep): Removed code related to "collect on main thread only" logic.
3997 (KJS::Heap::collect): Ditto.
3998 (KJS::Heap::globalObjectCount): Explicitly use per-thread instance of JSGlobalObject linked
3999 list now that JSGlobalObject::head() is not static. Curently, WebCoreStatistics methods only
4000 work with the main thread currently anyway.
4001 (KJS::Heap::protectedGlobalObjectCount): Ditto.
4002
4003 * kjs/collector.h: Removed code related to "collect on main thread only" logic.
4004
4005 * JavaScriptCore.exp: Removed Heap::collectOnMainThreadOnly.
4006
4007 2008-06-26 Alexey Proskuryakov <ap@webkit.org>
4008
4009 Reviewed by Darin.
4010
4011 https://bugs.webkit.org/show_bug.cgi?id=19767
4012 REGRESSION: Crash in sort() when visiting http://www.onnyturf.com/subway/
4013
4014 * kjs/JSArray.cpp: (KJS::AVLTreeAbstractorForArrayCompare::set_balance_factor):
4015 Made changing balance factor from -1 to +1 work correctly.
4016
4017 * wtf/AVLTree.h: (KJS::AVLTreeDefaultBSet::operator[]): Added an assertion that catches
4018 this slightly earlier.
4019
4020 2008-06-25 Timothy Hatcher <timothy@apple.com>
4021
4022 Fixes an ASSERT in the profiler when starting multiple profiles
4023 with the same name inside the same function/program.
4024
4025 Reviewed by Kevin McCullough.
4026
4027 * profiler/Profile.cpp:
4028 (KJS::Profile::Profile): Initialize m_stoppedCallDepth to zero.
4029 (KJS::Profile::stopProfiling): Set the current node to the parent,
4030 because we are in a call that will not get a didExecute call.
4031 (KJS::Profile::removeProfile): Increment m_stoppedCallDepth to
4032 account for didExecute not being called for profile.
4033 (KJS::Profile::willExecute): Increment m_stoppedCallDepth if stopped.
4034 (KJS::Profile::didExecute): Decrement m_stoppedCallDepth if stopped and
4035 greater than zero, and return early.
4036 * profiler/Profile.h: Added stoppedProfiling().
4037 * profiler/Profiler.cpp:
4038 (KJS::Profiler::findProfile): Removed.
4039 (KJS::Profiler::startProfiling): Don't return early for stopped profiles.
4040 (KJS::Profiler::stopProfiling): Skipp stopped profiles.
4041 (KJS::Profiler::didFinishAllExecution): Code clean-up.
4042 * profiler/Profiler.h: Removed findProfile.
4043
4044 2008-06-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4045
4046 Reviewed by Alexey Proskuryakov.
4047
4048 Attempt to fix Windows debug build. The compiler gives a warning when
4049 Structured Exception Handling and destructors are used in the same
4050 function. Using manual locking and unlocking instead of constructors
4051 and destructors should fix the warning.
4052
4053 * kjs/Shell.cpp:
4054 (main):
4055
4056 2008-06-25 Alexey Proskuryakov <ap@webkit.org>
4057
4058 Forgot to address a review comment about better names for tracked objects, doing it now.
4059
4060 * kjs/JSGlobalData.cpp:
4061 (KJS::JSGlobalData::JSGlobalData):
4062 * kjs/JSGlobalData.h:
4063 * kjs/nodes.cpp:
4064 (KJS::ParserRefCounted::ParserRefCounted):
4065 (KJS::ParserRefCounted::ref):
4066 (KJS::ParserRefCounted::deref):
4067 (KJS::ParserRefCounted::hasOneRef):
4068 (KJS::ParserRefCounted::deleteNewObjects):
4069
4070 2008-06-25 Alexey Proskuryakov <ap@webkit.org>
4071
4072 Reviewed by Geoff.
4073
4074 Remove more threadInstance() calls.
4075
4076 * kjs/JSFunction.cpp:
4077 (KJS::JSFunction::getParameterName):
4078 (KJS::IndexToNameMap::unMap):
4079 (KJS::Arguments::deleteProperty):
4080 * kjs/JSFunction.h:
4081 Access nullIdentifier without going to thread specific storage.
4082
4083 * JavaScriptCore.exp:
4084 * kjs/JSGlobalData.cpp:
4085 (KJS::JSGlobalData::JSGlobalData):
4086 * kjs/JSGlobalData.h:
4087 * kjs/Parser.cpp:
4088 (KJS::Parser::parse):
4089 * kjs/Parser.h:
4090 (KJS::ParserRefCountedData::ParserRefCountedData):
4091 (KJS::Parser::parse):
4092 * kjs/grammar.y:
4093 * kjs/nodes.cpp:
4094 (KJS::ParserRefCounted::ParserRefCounted):
4095 (KJS::ParserRefCounted::ref):
4096 (KJS::ParserRefCounted::deref):
4097 (KJS::ParserRefCounted::hasOneRef):
4098 (KJS::ParserRefCounted::deleteNewObjects):
4099 (KJS::Node::Node):
4100 (KJS::StatementNode::StatementNode):
4101 (KJS::BreakpointCheckStatement::BreakpointCheckStatement):
4102 (KJS::ConstDeclNode::ConstDeclNode):
4103 (KJS::BlockNode::BlockNode):
4104 (KJS::ForInNode::ForInNode):
4105 (KJS::ScopeNode::ScopeNode):
4106 (KJS::ProgramNode::ProgramNode):
4107 (KJS::ProgramNode::create):
4108 (KJS::EvalNode::EvalNode):
4109 (KJS::EvalNode::create):
4110 (KJS::FunctionBodyNode::FunctionBodyNode):
4111 (KJS::FunctionBodyNode::create):
4112 * kjs/nodes.h:
4113 (KJS::ExpressionNode::):
4114 (KJS::NullNode::):
4115 (KJS::BooleanNode::):
4116 (KJS::NumberNode::):
4117 (KJS::ImmediateNumberNode::):
4118 (KJS::StringNode::):
4119 (KJS::RegExpNode::):
4120 (KJS::ThisNode::):
4121 (KJS::ResolveNode::):
4122 (KJS::ElementNode::):
4123 (KJS::ArrayNode::):
4124 (KJS::PropertyNode::):
4125 (KJS::PropertyListNode::):
4126 (KJS::ObjectLiteralNode::):
4127 (KJS::BracketAccessorNode::):
4128 (KJS::DotAccessorNode::):
4129 (KJS::ArgumentListNode::):
4130 (KJS::ArgumentsNode::):
4131 (KJS::NewExprNode::):
4132 (KJS::EvalFunctionCallNode::):
4133 (KJS::FunctionCallValueNode::):
4134 (KJS::FunctionCallResolveNode::):
4135 (KJS::FunctionCallBracketNode::):
4136 (KJS::FunctionCallDotNode::):
4137 (KJS::PrePostResolveNode::):
4138 (KJS::PostIncResolveNode::):
4139 (KJS::PostDecResolveNode::):
4140 (KJS::PostfixBracketNode::):
4141 (KJS::PostIncBracketNode::):
4142 (KJS::PostDecBracketNode::):
4143 (KJS::PostfixDotNode::):
4144 (KJS::PostIncDotNode::):
4145 (KJS::PostDecDotNode::):
4146 (KJS::PostfixErrorNode::):
4147 (KJS::DeleteResolveNode::):
4148 (KJS::DeleteBracketNode::):
4149 (KJS::DeleteDotNode::):
4150 (KJS::DeleteValueNode::):
4151 (KJS::VoidNode::):
4152 (KJS::TypeOfResolveNode::):
4153 (KJS::TypeOfValueNode::):
4154 (KJS::PreIncResolveNode::):
4155 (KJS::PreDecResolveNode::):
4156 (KJS::PrefixBracketNode::):
4157 (KJS::PreIncBracketNode::):
4158 (KJS::PreDecBracketNode::):
4159 (KJS::PrefixDotNode::):
4160 (KJS::PreIncDotNode::):
4161 (KJS::PreDecDotNode::):
4162 (KJS::PrefixErrorNode::):
4163 (KJS::UnaryOpNode::UnaryOpNode):
4164 (KJS::UnaryPlusNode::):
4165 (KJS::NegateNode::):
4166 (KJS::BitwiseNotNode::):
4167 (KJS::LogicalNotNode::):
4168 (KJS::BinaryOpNode::BinaryOpNode):
4169 (KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
4170 (KJS::MultNode::):
4171 (KJS::DivNode::):
4172 (KJS::ModNode::):
4173 (KJS::AddNode::):
4174 (KJS::SubNode::):
4175 (KJS::LeftShiftNode::):
4176 (KJS::RightShiftNode::):
4177 (KJS::UnsignedRightShiftNode::):
4178 (KJS::LessNode::):
4179 (KJS::GreaterNode::):
4180 (KJS::LessEqNode::):
4181 (KJS::GreaterEqNode::):
4182 (KJS::InstanceOfNode::):
4183 (KJS::InNode::):
4184 (KJS::EqualNode::):
4185 (KJS::NotEqualNode::):
4186 (KJS::StrictEqualNode::):
4187 (KJS::NotStrictEqualNode::):
4188 (KJS::BitAndNode::):
4189 (KJS::BitOrNode::):
4190 (KJS::BitXOrNode::):
4191 (KJS::LogicalAndNode::):
4192 (KJS::LogicalOrNode::):
4193 (KJS::ConditionalNode::):
4194 (KJS::ReadModifyResolveNode::):
4195 (KJS::AssignResolveNode::):
4196 (KJS::ReadModifyBracketNode::):
4197 (KJS::AssignBracketNode::):
4198 (KJS::AssignDotNode::):
4199 (KJS::ReadModifyDotNode::):
4200 (KJS::AssignErrorNode::):
4201 (KJS::CommaNode::):
4202 (KJS::VarDeclCommaNode::):
4203 (KJS::ConstStatementNode::):
4204 (KJS::SourceElements::SourceElements):
4205 (KJS::EmptyStatementNode::):
4206 (KJS::DebuggerStatementNode::):
4207 (KJS::ExprStatementNode::):
4208 (KJS::VarStatementNode::):
4209 (KJS::IfNode::):
4210 (KJS::IfElseNode::):
4211 (KJS::DoWhileNode::):
4212 (KJS::WhileNode::):
4213 (KJS::ForNode::):
4214 (KJS::ContinueNode::):
4215 (KJS::BreakNode::):
4216 (KJS::ReturnNode::):
4217 (KJS::WithNode::):
4218 (KJS::LabelNode::):
4219 (KJS::ThrowNode::):
4220 (KJS::TryNode::):
4221 (KJS::ParameterNode::):
4222 (KJS::FuncExprNode::):
4223 (KJS::FuncDeclNode::):
4224 (KJS::CaseClauseNode::):
4225 (KJS::ClauseListNode::):
4226 (KJS::CaseBlockNode::):
4227 (KJS::SwitchNode::):
4228 Changed ParserRefCounted to hold a JSGlobalData pointer, and used it to replace
4229 threadInstance calls.
4230
4231 2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4232
4233 Reviewed by Alexey Proskuryakov.
4234
4235 Make the JavaScript shell collect the heap from main() instead of
4236 jscmain() to suppress leak messages in debug builds.
4237
4238 * kjs/Shell.cpp:
4239 (main):
4240 (jscmain):
4241
4242 2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4243
4244 Reviewed by Maciej.
4245
4246 Make the conversion of the pair (less, jtrue) to jless use register
4247 reference counting information for safety instead of requiring callers
4248 to decide whether it is safe.
4249
4250 No changes on SunSpider codegen.
4251
4252 * VM/CodeGenerator.cpp:
4253 (KJS::CodeGenerator::emitJumpIfTrue):
4254 * VM/CodeGenerator.h:
4255 * kjs/nodes.cpp:
4256 (KJS::DoWhileNode::emitCode):
4257 (KJS::WhileNode::emitCode):
4258 (KJS::ForNode::emitCode):
4259 (KJS::CaseBlockNode::emitCodeForBlock):
4260
4261 2008-06-24 Kevin McCullough <kmccullough@apple.com>
4262
4263 Reviewed by Tim.
4264
4265 <rdar://problem/6031594> JSProfiler: Profiler goes into an infinite
4266 loop sometimes.
4267 <rdar://problem/6031603> JSProfiler: Profiler asserts in debug and
4268 give the wrong times in release
4269
4270 Fixed two issues found by Tim in the same test.
4271
4272 * profiler/Profile.cpp:
4273 (KJS::Profile::removeProfileStart): No longer take profile's time from
4274 all ancestors, but instead attribute it to its parent. Also add an
4275 Assert to ensure we only delete the child we mean to.
4276 (KJS::Profile::removeProfileEnd): Ditto for profileEnd.
4277 (KJS::Profile::didExecute): Cleaned up the execution order and correctly
4278 attribute all of the parent's time to the new node.
4279 * profiler/ProfileNode.cpp: If this node does not have a startTime it
4280 should not get a giant total time, but instead be 0.
4281 (KJS::ProfileNode::endAndRecordCall):
4282 * profiler/ProfileNode.h:
4283 (KJS::ProfileNode::removeChild): Should reset the sibling pointers since
4284 one of them has been removed.
4285
4286 2008-06-24 Darin Adler <darin@apple.com>
4287
4288 Reviewed by Cameron.
4289
4290 - fix https://bugs.webkit.org/show_bug.cgi?id=19739
4291 REGRESSION: fast/js/property-getters-and-setters.html fails
4292
4293 * kjs/JSObject.cpp:
4294 (KJS::JSObject::put): Remove an untested optimization I checked in by accident.
4295 The two loops up the prototype chain both need to start from this; instead the
4296 second loop was starting where the first loop left off.
4297
4298 2008-06-24 Steve Falkenburg <sfalken@apple.com>
4299
4300 Build fix.
4301
4302 * kjs/nodes.cpp:
4303
4304 2008-06-24 Joerg Bornemann <joerg.bornemann@trolltech.com>
4305
4306 Reviewed by Simon.
4307
4308 For the Qt build on Windows don't depend on the presence of GNU CPP
4309 but use MSVC's preprocessor instead.
4310 dftables accepts a --preprocessor option which is set in pcre.pri for MSVC platforms.
4311
4312 * pcre/dftables: Added support for specifying the preprocessor command
4313 to use via --preprocessor, similar to
4314 WebCore/bindings/scripts/generate-bindings.pl.
4315 * pcre/pcre.pri: Pass --preprocessor='cl /e' to dftables, or more
4316 generally speaking QMAKE_CC /E for the win32-msvc buildspecs.
4317
4318 2008-06-24 Simon Hausmann <hausmann@webkit.org>
4319
4320 Fix the Qt build, added missing include.
4321
4322 * kjs/PropertySlot.cpp:
4323
4324 2008-06-24 Alexey Proskuryakov <ap@webkit.org>
4325
4326 Reviewed by Cameron Zwarich.
4327
4328 Make ParserRefCountedCounter actually perform a leak check.
4329
4330 * kjs/nodes.cpp:
4331 (KJS::ParserRefCountedCounter::~ParserRefCountedCounter): Check for leaks in destructor,
4332 not in constructor.
4333 (KJS::ParserRefCountedCounter::increment):
4334 (KJS::ParserRefCountedCounter::decrement):
4335 (KJS::ParserRefCounted::ParserRefCounted):
4336 (KJS::ParserRefCounted::~ParserRefCounted):
4337 While at it, also made counting thread-safe.
4338
4339 2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4340
4341 Reviewed by Oliver.
4342
4343 Bug 19730: REGRESSION (r34497): Text in alerts in "Leisure suit Larry" is not wrapped
4344 <https://bugs.webkit.org/show_bug.cgi?id=19730>
4345
4346 Do not convert the pair (less, jtrue) to jless when jtrue is a jump
4347 target. An example of this is when the condition of a while loop is a
4348 LogicalOrNode.
4349
4350 * VM/CodeGenerator.cpp:
4351 (KJS::CodeGenerator::emitLabel):
4352
4353 2008-06-20 Ariya Hidayat <ariya.hidayat@trolltech.com>
4354
4355 Reviewed by Adam Roben.
4356
4357 Fix compile with MinGW.
4358
4359 * kjs/Shell.cpp:
4360 * wtf/Threading.h:
4361 (WTF::atomicIncrement):
4362 (WTF::atomicDecrement):
4363
4364 2008-06-23 Mark Rowe <mrowe@apple.com>
4365
4366 Reviewed by Oliver Hunt.
4367
4368 Prepration for returning memory to the OS on Windows. Track whether a portion of a span of memory was returned to the OS.
4369 If it was, ask that it be recommitted before returning it to the application as an allocated region.
4370
4371 * wtf/FastMalloc.cpp:
4372 (WTF::TCMalloc_PageHeap::New): If the span was decommitted, ask that it be recommitted before returning it.
4373 (WTF::TCMalloc_PageHeap::AllocLarge): Ditto.
4374 (WTF::TCMalloc_PageHeap::Carve): When splitting a span, ensure that the decommitted state propogates to the two new spans.
4375 (WTF::TCMalloc_PageHeap::Delete): When merging a span, ensure that the resulting span is marked as decommitted if any of the
4376 spans being merged were marked as decommitted.
4377 (WTF::TCMalloc_PageHeap::IncrementalScavenge): Mark as decommitted after releasing the span.
4378 (WTF::TCMalloc_Central_FreeList::FetchFromSpans): Add an assertion to catch a decommitted span being returned to the application
4379 without first being recommitted.
4380 (WTF::TCMalloc_Central_FreeList::Populate): Ditto.
4381 * wtf/TCSystemAlloc.cpp: Stub out TCMalloc_SystemCommit.
4382 * wtf/TCSystemAlloc.h:
4383
4384 2008-06-23 Mark Rowe <mrowe@apple.com>
4385
4386 Reviewed by Sam Weinig.
4387
4388 Remove the sample member of Span when NO_TCMALLOC_SAMPLES is defined.
4389
4390 * wtf/FastMalloc.cpp:
4391 (WTF::TCMalloc_PageHeap::Delete): Only update Span::sample if NO_TCMALLOC_SAMPLES is not defined.
4392 (WTF::TCMallocStats::do_free): Ditto.
4393
4394 2008-06-23 Darin Adler <darin@apple.com>
4395
4396 Reviewed by Geoff.
4397
4398 - work toward https://bugs.webkit.org/show_bug.cgi?id=19721
4399
4400 More preparation toward making functions work on primitive types without
4401 creating wrapper objects. No speedup this time, but prepares for a future
4402 speedup without slowing things down.
4403
4404 SunSpider reports no change.
4405
4406 - Eliminated the implementsCall, callAsFunction and construct virtual
4407 functions from JSObject. Instead, the CallData and ConstructData for
4408 a native function includes a function pointer that the caller can use
4409 directly. Changed all call sites to use CallData and ConstructData.
4410
4411 - Changed the "this" argument to native functions to be a JSValue rather
4412 than a JSObject. This prepares us for passing primitives into these
4413 functions. The conversion to an object now must be done inside the
4414 function. Critically, if it's a function that can be called on a DOM
4415 window object, then we have to be sure to call toThisObject on the
4416 argument before we use it for anything even if it's already an object.
4417
4418 - Eliminated the practice of using constructor objects in the global
4419 object to make objects of the various basic types. Since these
4420 constructors can't be replaced by script, there's no reason to involve
4421 a constructor object at all. Added functions to do the construction
4422 directly.
4423
4424 - Made some more class members private and protected, including virtual
4425 function overrides. This can catch code using unnecessarily slow virtual
4426 function code paths when the type of an object is known statically. If we
4427 later find a new reason use the members outside the class it's easy to
4428 make them public again.
4429
4430 - Moved the declarations of the native implementations for functions out
4431 of header files. These can have internal linkage and be declared inside
4432 the source file.
4433
4434 - Changed PrototypeFunction to take function pointers with the right
4435 arguments to be put directly into CallData. This eliminates the
4436 need to have a separate PrototypeReflexiveFunction, and reveals that the
4437 real purpose of that class included something else specific to eval --
4438 storage of a cached global object. So renamed PrototypeReflexiveFunction
4439 to GlobalEvalFunction.
4440
4441 * API/JSCallbackConstructor.cpp:
4442 (KJS::constructJSCallback):
4443 (KJS::JSCallbackConstructor::getConstructData):
4444 * API/JSCallbackConstructor.h:
4445 * API/JSCallbackFunction.cpp:
4446 (KJS::JSCallbackFunction::implementsHasInstance):
4447 (KJS::JSCallbackFunction::call):
4448 (KJS::JSCallbackFunction::getCallData):
4449 * API/JSCallbackFunction.h:
4450 (KJS::JSCallbackFunction::classInfo):
4451 * API/JSCallbackObject.h:
4452 (KJS::JSCallbackObject::classRef):
4453 (KJS::JSCallbackObject::classInfo):
4454 * API/JSCallbackObjectFunctions.h:
4455 (KJS::::getConstructData):
4456 (KJS::::construct):
4457 (KJS::::getCallData):
4458 (KJS::::call):
4459 * API/JSObjectRef.cpp:
4460 (JSObjectMakeFunction):
4461 (JSObjectIsFunction):
4462 (JSObjectCallAsFunction):
4463 (JSObjectCallAsConstructor):
4464 * JavaScriptCore.exp:
4465 * VM/Machine.cpp:
4466 (KJS::jsTypeStringForValue):
4467 (KJS::Machine::privateExecute):
4468 * kjs/ArrayPrototype.cpp:
4469 (KJS::arrayProtoFuncToString):
4470 (KJS::arrayProtoFuncToLocaleString):
4471 (KJS::arrayProtoFuncJoin):
4472 (KJS::arrayProtoFuncConcat):
4473 (KJS::arrayProtoFuncPop):
4474 (KJS::arrayProtoFuncPush):
4475 (KJS::arrayProtoFuncReverse):
4476 (KJS::arrayProtoFuncShift):
4477 (KJS::arrayProtoFuncSlice):
4478 (KJS::arrayProtoFuncSort):
4479 (KJS::arrayProtoFuncSplice):
4480 (KJS::arrayProtoFuncUnShift):
4481 (KJS::arrayProtoFuncFilter):
4482 (KJS::arrayProtoFuncMap):
4483 (KJS::arrayProtoFuncEvery):
4484 (KJS::arrayProtoFuncForEach):
4485 (KJS::arrayProtoFuncSome):
4486 (KJS::arrayProtoFuncIndexOf):
4487 (KJS::arrayProtoFuncLastIndexOf):
4488 (KJS::ArrayConstructor::ArrayConstructor):
4489 (KJS::constructArrayWithSizeQuirk):
4490 (KJS::constructWithArrayConstructor):
4491 (KJS::ArrayConstructor::getConstructData):
4492 (KJS::callArrayConstructor):
4493 (KJS::ArrayConstructor::getCallData):
4494 * kjs/ArrayPrototype.h:
4495 * kjs/BooleanObject.cpp:
4496 (KJS::booleanProtoFuncToString):
4497 (KJS::booleanProtoFuncValueOf):
4498 (KJS::constructBoolean):
4499 (KJS::constructWithBooleanConstructor):
4500 (KJS::BooleanConstructor::getConstructData):
4501 (KJS::callBooleanConstructor):
4502 (KJS::BooleanConstructor::getCallData):
4503 (KJS::constructBooleanFromImmediateBoolean):
4504 * kjs/BooleanObject.h:
4505 * kjs/CallData.h:
4506 (KJS::):
4507 * kjs/ConstructData.h:
4508 (KJS::):
4509 * kjs/FunctionPrototype.cpp:
4510 (KJS::callFunctionPrototype):
4511 (KJS::FunctionPrototype::getCallData):
4512 (KJS::functionProtoFuncToString):
4513 (KJS::functionProtoFuncApply):
4514 (KJS::functionProtoFuncCall):
4515 (KJS::constructWithFunctionConstructor):
4516 (KJS::FunctionConstructor::getConstructData):
4517 (KJS::callFunctionConstructor):
4518 (KJS::FunctionConstructor::getCallData):
4519 (KJS::constructFunction):
4520 * kjs/FunctionPrototype.h:
4521 * kjs/JSArray.cpp:
4522 (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
4523 (KJS::JSArray::sort):
4524 (KJS::constructEmptyArray):
4525 (KJS::constructArray):
4526 * kjs/JSArray.h:
4527 (KJS::JSArray::classInfo):
4528 * kjs/JSFunction.cpp:
4529 (KJS::JSFunction::call):
4530 (KJS::globalFuncEval):
4531 (KJS::globalFuncParseInt):
4532 (KJS::globalFuncParseFloat):
4533 (KJS::globalFuncIsNaN):
4534 (KJS::globalFuncIsFinite):
4535 (KJS::globalFuncDecodeURI):
4536 (KJS::globalFuncDecodeURIComponent):
4537 (KJS::globalFuncEncodeURI):
4538 (KJS::globalFuncEncodeURIComponent):
4539 (KJS::globalFuncEscape):
4540 (KJS::globalFuncUnescape):
4541 (KJS::globalFuncKJSPrint):
4542 (KJS::PrototypeFunction::PrototypeFunction):
4543 (KJS::PrototypeFunction::getCallData):
4544 (KJS::GlobalEvalFunction::GlobalEvalFunction):
4545 (KJS::GlobalEvalFunction::mark):
4546 * kjs/JSFunction.h:
4547 (KJS::InternalFunction::classInfo):
4548 (KJS::InternalFunction::functionName):
4549 (KJS::JSFunction::classInfo):
4550 (KJS::GlobalEvalFunction::cachedGlobalObject):
4551 * kjs/JSGlobalObject.cpp:
4552 (KJS::JSGlobalObject::reset):
4553 (KJS::JSGlobalObject::mark):
4554 * kjs/JSGlobalObject.h:
4555 (KJS::JSGlobalObject::JSGlobalObject):
4556 (KJS::JSGlobalObject::evalFunction):
4557 * kjs/JSImmediate.cpp:
4558 (KJS::JSImmediate::toObject):
4559 * kjs/JSNotAnObject.cpp:
4560 * kjs/JSNotAnObject.h:
4561 * kjs/JSObject.cpp:
4562 (KJS::JSObject::put):
4563 (KJS::callDefaultValueFunction):
4564 (KJS::JSObject::defaultValue):
4565 (KJS::JSObject::lookupGetter):
4566 (KJS::JSObject::lookupSetter):
4567 (KJS::JSObject::hasInstance):
4568 (KJS::JSObject::fillGetterPropertySlot):
4569 (KJS::Error::create):
4570 (KJS::constructEmptyObject):
4571 * kjs/JSObject.h:
4572 (KJS::GetterSetter::GetterSetter):
4573 (KJS::GetterSetter::getter):
4574 (KJS::GetterSetter::setGetter):
4575 (KJS::GetterSetter::setter):
4576 (KJS::GetterSetter::setSetter):
4577 * kjs/JSValue.cpp:
4578 (KJS::JSCell::deleteProperty):
4579 (KJS::call):
4580 (KJS::construct):
4581 * kjs/JSValue.h:
4582 * kjs/MathObject.cpp:
4583 (KJS::mathProtoFuncAbs):
4584 (KJS::mathProtoFuncACos):
4585 (KJS::mathProtoFuncASin):
4586 (KJS::mathProtoFuncATan):
4587 (KJS::mathProtoFuncATan2):
4588 (KJS::mathProtoFuncCeil):
4589 (KJS::mathProtoFuncCos):
4590 (KJS::mathProtoFuncExp):
4591 (KJS::mathProtoFuncFloor):
4592 (KJS::mathProtoFuncLog):
4593 (KJS::mathProtoFuncMax):
4594 (KJS::mathProtoFuncMin):
4595 (KJS::mathProtoFuncPow):
4596 (KJS::mathProtoFuncRandom):
4597 (KJS::mathProtoFuncRound):
4598 (KJS::mathProtoFuncSin):
4599 (KJS::mathProtoFuncSqrt):
4600 (KJS::mathProtoFuncTan):
4601 * kjs/MathObject.h:
4602 * kjs/NumberObject.cpp:
4603 (KJS::numberProtoFuncToString):
4604 (KJS::numberProtoFuncToLocaleString):
4605 (KJS::numberProtoFuncValueOf):
4606 (KJS::numberProtoFuncToFixed):
4607 (KJS::numberProtoFuncToExponential):
4608 (KJS::numberProtoFuncToPrecision):
4609 (KJS::NumberConstructor::NumberConstructor):
4610 (KJS::constructWithNumberConstructor):
4611 (KJS::NumberConstructor::getConstructData):
4612 (KJS::callNumberConstructor):
4613 (KJS::NumberConstructor::getCallData):
4614 (KJS::constructNumber):
4615 (KJS::constructNumberFromImmediateNumber):
4616 * kjs/NumberObject.h:
4617 (KJS::NumberObject::classInfo):
4618 (KJS::NumberConstructor::classInfo):
4619 * kjs/PropertySlot.cpp:
4620 (KJS::PropertySlot::functionGetter):
4621 * kjs/RegExpObject.cpp:
4622 (KJS::regExpProtoFuncTest):
4623 (KJS::regExpProtoFuncExec):
4624 (KJS::regExpProtoFuncCompile):
4625 (KJS::regExpProtoFuncToString):
4626 (KJS::callRegExpObject):
4627 (KJS::RegExpObject::getCallData):
4628 (KJS::constructRegExp):
4629 (KJS::constructWithRegExpConstructor):
4630 (KJS::RegExpConstructor::getConstructData):
4631 (KJS::callRegExpConstructor):
4632 (KJS::RegExpConstructor::getCallData):
4633 * kjs/RegExpObject.h:
4634 (KJS::RegExpConstructor::classInfo):
4635 * kjs/Shell.cpp:
4636 (GlobalObject::GlobalObject):
4637 (functionPrint):
4638 (functionDebug):
4639 (functionGC):
4640 (functionVersion):
4641 (functionRun):
4642 (functionLoad):
4643 (functionReadline):
4644 (functionQuit):
4645 * kjs/date_object.cpp:
4646 (KJS::gmtoffset):
4647 (KJS::formatLocaleDate):
4648 (KJS::fillStructuresUsingDateArgs):
4649 (KJS::DateInstance::getTime):
4650 (KJS::DateInstance::getUTCTime):
4651 (KJS::DateConstructor::DateConstructor):
4652 (KJS::constructDate):
4653 (KJS::DateConstructor::getConstructData):
4654 (KJS::callDate):
4655 (KJS::DateConstructor::getCallData):
4656 (KJS::dateParse):
4657 (KJS::dateNow):
4658 (KJS::dateUTC):
4659 (KJS::dateProtoFuncToString):
4660 (KJS::dateProtoFuncToUTCString):
4661 (KJS::dateProtoFuncToDateString):
4662 (KJS::dateProtoFuncToTimeString):
4663 (KJS::dateProtoFuncToLocaleString):
4664 (KJS::dateProtoFuncToLocaleDateString):
4665 (KJS::dateProtoFuncToLocaleTimeString):
4666 (KJS::dateProtoFuncValueOf):
4667 (KJS::dateProtoFuncGetTime):
4668 (KJS::dateProtoFuncGetFullYear):
4669 (KJS::dateProtoFuncGetUTCFullYear):
4670 (KJS::dateProtoFuncToGMTString):
4671 (KJS::dateProtoFuncGetMonth):
4672 (KJS::dateProtoFuncGetUTCMonth):
4673 (KJS::dateProtoFuncGetDate):
4674 (KJS::dateProtoFuncGetUTCDate):
4675 (KJS::dateProtoFuncGetDay):
4676 (KJS::dateProtoFuncGetUTCDay):
4677 (KJS::dateProtoFuncGetHours):
4678 (KJS::dateProtoFuncGetUTCHours):
4679 (KJS::dateProtoFuncGetMinutes):
4680 (KJS::dateProtoFuncGetUTCMinutes):
4681 (KJS::dateProtoFuncGetSeconds):
4682 (KJS::dateProtoFuncGetUTCSeconds):
4683 (KJS::dateProtoFuncGetMilliSeconds):
4684 (KJS::dateProtoFuncGetUTCMilliseconds):
4685 (KJS::dateProtoFuncGetTimezoneOffset):
4686 (KJS::dateProtoFuncSetTime):
4687 (KJS::setNewValueFromTimeArgs):
4688 (KJS::setNewValueFromDateArgs):
4689 (KJS::dateProtoFuncSetMilliSeconds):
4690 (KJS::dateProtoFuncSetUTCMilliseconds):
4691 (KJS::dateProtoFuncSetSeconds):
4692 (KJS::dateProtoFuncSetUTCSeconds):
4693 (KJS::dateProtoFuncSetMinutes):
4694 (KJS::dateProtoFuncSetUTCMinutes):
4695 (KJS::dateProtoFuncSetHours):
4696 (KJS::dateProtoFuncSetUTCHours):
4697 (KJS::dateProtoFuncSetDate):
4698 (KJS::dateProtoFuncSetUTCDate):
4699 (KJS::dateProtoFuncSetMonth):
4700 (KJS::dateProtoFuncSetUTCMonth):
4701 (KJS::dateProtoFuncSetFullYear):
4702 (KJS::dateProtoFuncSetUTCFullYear):
4703 (KJS::dateProtoFuncSetYear):
4704 (KJS::dateProtoFuncGetYear):
4705 * kjs/date_object.h:
4706 (KJS::DateInstance::internalNumber):
4707 (KJS::DateInstance::classInfo):
4708 * kjs/error_object.cpp:
4709 (KJS::errorProtoFuncToString):
4710 (KJS::constructError):
4711 (KJS::constructWithErrorConstructor):
4712 (KJS::ErrorConstructor::getConstructData):
4713 (KJS::callErrorConstructor):
4714 (KJS::ErrorConstructor::getCallData):
4715 (KJS::NativeErrorConstructor::construct):
4716 (KJS::constructWithNativeErrorConstructor):
4717 (KJS::NativeErrorConstructor::getConstructData):
4718 (KJS::callNativeErrorConstructor):
4719 (KJS::NativeErrorConstructor::getCallData):
4720 * kjs/error_object.h:
4721 (KJS::NativeErrorConstructor::classInfo):
4722 * kjs/internal.cpp:
4723 (KJS::JSNumberCell::toObject):
4724 (KJS::JSNumberCell::toThisObject):
4725 (KJS::GetterSetter::mark):
4726 (KJS::GetterSetter::toPrimitive):
4727 (KJS::GetterSetter::toBoolean):
4728 (KJS::GetterSetter::toNumber):
4729 (KJS::GetterSetter::toString):
4730 (KJS::GetterSetter::toObject):
4731 (KJS::InternalFunction::InternalFunction):
4732 (KJS::InternalFunction::implementsHasInstance):
4733 * kjs/lookup.h:
4734 (KJS::HashEntry::):
4735 * kjs/nodes.cpp:
4736 (KJS::FuncDeclNode::makeFunction):
4737 (KJS::FuncExprNode::makeFunction):
4738 * kjs/object_object.cpp:
4739 (KJS::objectProtoFuncValueOf):
4740 (KJS::objectProtoFuncHasOwnProperty):
4741 (KJS::objectProtoFuncIsPrototypeOf):
4742 (KJS::objectProtoFuncDefineGetter):
4743 (KJS::objectProtoFuncDefineSetter):
4744 (KJS::objectProtoFuncLookupGetter):
4745 (KJS::objectProtoFuncLookupSetter):
4746 (KJS::objectProtoFuncPropertyIsEnumerable):
4747 (KJS::objectProtoFuncToLocaleString):
4748 (KJS::objectProtoFuncToString):
4749 (KJS::ObjectConstructor::ObjectConstructor):
4750 (KJS::constructObject):
4751 (KJS::constructWithObjectConstructor):
4752 (KJS::ObjectConstructor::getConstructData):
4753 (KJS::callObjectConstructor):
4754 (KJS::ObjectConstructor::getCallData):
4755 * kjs/object_object.h:
4756 * kjs/string_object.cpp:
4757 (KJS::replace):
4758 (KJS::stringProtoFuncToString):
4759 (KJS::stringProtoFuncValueOf):
4760 (KJS::stringProtoFuncCharAt):
4761 (KJS::stringProtoFuncCharCodeAt):
4762 (KJS::stringProtoFuncConcat):
4763 (KJS::stringProtoFuncIndexOf):
4764 (KJS::stringProtoFuncLastIndexOf):
4765 (KJS::stringProtoFuncMatch):
4766 (KJS::stringProtoFuncSearch):
4767 (KJS::stringProtoFuncReplace):
4768 (KJS::stringProtoFuncSlice):
4769 (KJS::stringProtoFuncSplit):
4770 (KJS::stringProtoFuncSubstr):
4771 (KJS::stringProtoFuncSubstring):
4772 (KJS::stringProtoFuncToLowerCase):
4773 (KJS::stringProtoFuncToUpperCase):
4774 (KJS::stringProtoFuncToLocaleLowerCase):
4775 (KJS::stringProtoFuncToLocaleUpperCase):
4776 (KJS::stringProtoFuncLocaleCompare):
4777 (KJS::stringProtoFuncBig):
4778 (KJS::stringProtoFuncSmall):
4779 (KJS::stringProtoFuncBlink):
4780 (KJS::stringProtoFuncBold):
4781 (KJS::stringProtoFuncFixed):
4782 (KJS::stringProtoFuncItalics):
4783 (KJS::stringProtoFuncStrike):
4784 (KJS::stringProtoFuncSub):
4785 (KJS::stringProtoFuncSup):
4786 (KJS::stringProtoFuncFontcolor):
4787 (KJS::stringProtoFuncFontsize):
4788 (KJS::stringProtoFuncAnchor):
4789 (KJS::stringProtoFuncLink):
4790 (KJS::stringFromCharCode):
4791 (KJS::StringConstructor::StringConstructor):
4792 (KJS::constructWithStringConstructor):
4793 (KJS::StringConstructor::getConstructData):
4794 (KJS::callStringConstructor):
4795 (KJS::StringConstructor::getCallData):
4796 * kjs/string_object.h:
4797
4798 2008-06-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4799
4800 Reviewed by Oliver.
4801
4802 Bug 19716: REGRESSION (SquirrelFish): Reproducible crash after entering a username at mint.com
4803 <https://bugs.webkit.org/show_bug.cgi?id=19716>
4804
4805 When unwinding callframes for exceptions, check whether the callframe
4806 was created by a reentrant native call to JavaScript after tearing off
4807 the local variables instead of before.
4808
4809 * VM/Machine.cpp:
4810 (KJS::Machine::unwindCallFrame):
4811
4812 2008-06-23 Mark Rowe <mrowe@apple.com>
4813
4814 Reviewed by Oliver Hunt.
4815
4816 Get testapi passing again in a debug build.
4817
4818 * API/testapi.c:
4819 (main): Update the expected output of calling JSValueMakeString on a function object.
4820
4821 2008-06-21 Mark Rowe <mrowe@apple.com>
4822
4823 Reviewed by Sam Weinig.
4824
4825 Print a blank line when exiting the jsc interactive mode to ensure that the shell
4826 prompt will start on a new line.
4827
4828 * kjs/Shell.cpp:
4829 (runInteractive):
4830
4831 2008-06-21 Mark Rowe <mrowe@apple.com>
4832
4833 Rubber-stamped by Sam Weinig.
4834
4835 Tweak the paths of the items in the "tests" group to clean things up a little.
4836
4837 * JavaScriptCore.xcodeproj/project.pbxproj:
4838
4839 2008-06-21 Mark Rowe <mrowe@apple.com>
4840
4841 Rubber-stamped by Sam Weinig.
4842
4843 Fix jsc to link against libedit.dylib rather than libedit.2.dylib.
4844
4845 * JavaScriptCore.xcodeproj/project.pbxproj:
4846
4847 2008-06-21 Mark Rowe <mrowe@apple.com>
4848
4849 Reviewed by Sam Weinig.
4850
4851 Copy the JavaScriptCore shell (jsc) into JavaScriptCore.framework so that it will
4852 be included in nightly builds.
4853 https://bugs.webkit.org/show_bug.cgi?id=19691
4854
4855 * JavaScriptCore.xcodeproj/project.pbxproj:
4856
4857 2008-06-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4858
4859 Reviewed by Mark Rowe.
4860
4861 Fix the build for non-Mac Darwin platforms by disabling their support
4862 for readline in the JavaScript shell.
4863
4864 * kjs/config.h:
4865
4866 2008-06-20 Timothy Hatcher <timothy@apple.com>
4867
4868 Use member function pointers for the Profile::forEach function.
4869 Eliminating a few static functions and simplified things a little.
4870
4871 Reviewed by Alexey Proskuryakov.
4872
4873 * JavaScriptCore.exp: Change the symbol for forEach.
4874 * profiler/Profile.cpp:
4875 (KJS::Profile::forEach): Use a member function pointer.
4876 * profiler/Profile.h:
4877 (KJS::Profile::sortTotalTimeDescending): Pass a function pointer.
4878 (KJS::Profile::sortTotalTimeAscending): Ditto.
4879 (KJS::Profile::sortSelfTimeDescending): Ditto.
4880 (KJS::Profile::sortSelfTimeAscending): Ditto.
4881 (KJS::Profile::sortCallsDescending): Ditto.
4882 * profiler/ProfileNode.h:
4883 (KJS::ProfileNode::sortTotalTimeDescending): No longer static.
4884 (KJS::ProfileNode::sortTotalTimeAscending): Ditto.
4885 (KJS::ProfileNode::sortSelfTimeDescending): Ditto.
4886 (KJS::ProfileNode::sortSelfTimeAscending): Ditto.
4887 (KJS::ProfileNode::sortCallsDescending): Ditto.
4888
4889 2008-06-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4890
4891 Reviewed by Oliver.
4892
4893 Remove unused destructors.
4894
4895 * kjs/nodes.cpp:
4896 * kjs/nodes.h:
4897
4898 2008-06-20 Timothy Hatcher <timothy@apple.com>
4899
4900 Fixed an ASSERT(m_actualSelfTime <= m_actualTotalTime) when starting
4901 and stopping a profile from the Develop menu. Also prevents
4902 inserting an incorrect parent node as the new head after profiling
4903 is stopped from the Develop menu.
4904
4905 Reviewed by Dan Bernstein.
4906
4907 * profiler/Profile.cpp:
4908 (KJS::Profile::stopProfiling): If the current node is already the head
4909 then there is no more need to record future nodes in didExecute.
4910 (KJS::Profile::didExecute): Move the code of setupCurrentNodeAsStopped
4911 into here since this was the only caller. When setting the total time
4912 keep any current total time while adding the self time of the head.
4913 (KJS::Profile::setupCurrentNodeAsStopped): Removed.
4914 * profiler/Profile.h: Removed setupCurrentNodeAsStopped.
4915
4916 2008-06-20 Kevin Ollivier <kevino@theolliviers.com>
4917
4918 !USE(MULTIPLE_THREADS) on Darwin build fix
4919
4920 * kjs/InitializeThreading.cpp:
4921 (KJS::initializeThreading):
4922 * kjs/collector.h:
4923
4924 2008-06-20 Kevin McCullough <kmccullough@apple.com>
4925
4926 -Leopard Build Fix.
4927
4928 * profiler/Profile.cpp:
4929 (KJS::Profile::removeProfileStart):
4930 (KJS::Profile::removeProfileEnd):
4931
4932 2008-06-20 Kevin McCullough <kmccullough@apple.com>
4933
4934 Just giving credit.
4935
4936 * ChangeLog:
4937
4938 2008-06-20 Kevin McCullough <kmccullough@apple.com>
4939
4940 Reviewed by Tim and Dan.
4941
4942 <rdar://problem/6024846> JSProfiler: ASSERT hit in Profiler.
4943 - Because InspectorController can call startProfiling() and
4944 stopProfiling() we cannot assert that console.profile() and
4945 console.profileEnd() will be in the profile tree.
4946
4947 * profiler/Profile.cpp:
4948 (KJS::Profile::removeProfileStart):
4949 (KJS::Profile::removeProfileEnd):
4950
4951 2008-06-20 Kevin McCullough <kmccullough@apple.com>
4952
4953 Reviewed by Tim.
4954
4955 <rdar://problem/5958770> JSProfiler: Time incorrectly given to (idle)
4956 if profiling is started and finished within the same function. (19230)
4957 - Now we profile one more stack frame up from the last frame to allocate
4958 the time spent in it, if it exists.
4959
4960 * JavaScriptCore.exp:
4961 * VM/Machine.cpp: We need to let the profiler know when the JS program
4962 has finished since that is what will actually stop the profiler instead
4963 of just calling stopProfiling().
4964 (KJS::Machine::execute):
4965 * profiler/Profile.cpp:
4966 (KJS::Profile::create): Moved from Profile.h since it was getting pretty
4967 long.
4968 (KJS::Profile::Profile): We now have a client, which is a listener who
4969 we will return this profile to, once it has actually finished.
4970 (KJS::Profile::stopProfiling): Instead of fully stopping the profiler
4971 here, we set the flag and keep it profiling in the background.
4972 (KJS::Profile::didFinishAllExecution): This is where the profiler
4973 actually finishes and creates the (idle) node if one should be made.
4974 (KJS::Profile::removeProfileStart): Don't use m_currentNode since it is
4975 needed by the profiler as it runs silently in the background.
4976 (KJS::Profile::removeProfileEnd): Ditto.
4977 (KJS::Profile::willExecute): Don't profile new functions if we have
4978 stopped profiling.
4979 (KJS::Profile::didExecute): Only record one more return as all the
4980 remaining time will be attributed to that function.
4981 (KJS::Profile::setupCurrentNodeAsStopped): Sets the current node's time.
4982 * profiler/Profile.h: Added functions and variables for the above
4983 changes.
4984 (KJS::Profile::client):
4985 * profiler/ProfileNode.h:
4986 (KJS::CallIdentifier::toString): Debug method.
4987 * profiler/Profiler.cpp: Added support for the ProfilerClient.
4988 (KJS::Profiler::startProfiling):
4989 (KJS::Profiler::stopProfiling): No longer return sthe profile.
4990 (KJS::Profiler::didFinishAllExecution): Now returns the profile to the
4991 client instead of stopProfiling.
4992 * profiler/Profiler.h:
4993 (KJS::ProfilerClient::~ProfilerClient): Clients will implement this
4994 interface.
4995
4996 2008-06-19 Ariya Hidayat <ariya.hidayat@trolltech.com>
4997
4998 Reviewed by Simon.
4999
5000 Surpress compiler warning (int vs unsigned comparison).
5001
5002 * wtf/unicode/qt4/UnicodeQt4.h:
5003 (WTF::Unicode::toLower):
5004
5005 2008-06-19 Ariya Hidayat <ariya.hidayat@trolltech.com>
5006
5007 Reviewed by Timothy Hatcher.
5008
5009 Introduce compiler define for MinGW, to have COMPILER(MINGW).
5010
5011 * wtf/Platform.h:
5012
5013 2008-06-19 Alexey Proskuryakov <ap@webkit.org>
5014
5015 Reviewed by Geoff.
5016
5017 Make Machine per-JSGlobalData.
5018
5019 * VM/CodeBlock.cpp:
5020 (KJS::CodeBlock::dump):
5021 * VM/CodeGenerator.cpp:
5022 (KJS::CodeGenerator::emitOpcode):
5023 * VM/Machine.cpp:
5024 (KJS::callEval):
5025 (KJS::Machine::unwindCallFrame):
5026 (KJS::Machine::throwException):
5027 (KJS::Machine::execute):
5028 (KJS::Machine::debug):
5029 * VM/Machine.h:
5030 * kjs/DebuggerCallFrame.cpp:
5031 (KJS::DebuggerCallFrame::evaluate):
5032 * kjs/DebuggerCallFrame.h:
5033 (KJS::DebuggerCallFrame::DebuggerCallFrame):
5034 * kjs/ExecState.cpp:
5035 (KJS::ExecState::ExecState):
5036 * kjs/ExecState.h:
5037 (KJS::ExecState::machine):
5038 * kjs/JSFunction.cpp:
5039 (KJS::JSFunction::callAsFunction):
5040 (KJS::JSFunction::argumentsGetter):
5041 (KJS::JSFunction::callerGetter):
5042 (KJS::JSFunction::construct):
5043 (KJS::globalFuncEval):
5044 * kjs/JSGlobalData.cpp:
5045 (KJS::JSGlobalData::JSGlobalData):
5046 * kjs/JSGlobalData.h:
5047 * kjs/interpreter.cpp:
5048 (KJS::Interpreter::evaluate):
5049
5050 2008-06-19 Alp Toker <alp@nuanti.com>
5051
5052 GTK+/autotools build fix. JSGlobalObject.cpp in now in
5053 AllInOneFile.cpp and shouldn't be built separately.
5054
5055 * GNUmakefile.am:
5056
5057 2008-06-19 Alexey Proskuryakov <ap@webkit.org>
5058
5059 Reviewed by Darin.
5060
5061 Get rid of some threadInstance calls.
5062
5063 * kjs/JSGlobalObject.cpp:
5064 (KJS::JSGlobalObject::init):
5065 * kjs/Parser.cpp:
5066 (KJS::Parser::parse):
5067 * kjs/Shell.cpp:
5068 (jscmain):
5069
5070 2008-06-19 Alexey Proskuryakov <ap@webkit.org>
5071
5072 Reviewed by Sam.
5073
5074 Fix an assertion failure at startup.
5075
5076 * kjs/JSObject.h: (KJS::JSObject::JSObject): Allow jsNull prototype in an assertion (I had
5077 it fixed in a wrong copy of the file, so I wasn't getting the failure).
5078
5079 2008-06-19 Alexey Proskuryakov <ap@webkit.org>
5080
5081 Build fix.
5082
5083 * kjs/collector.cpp:
5084 (KJS::Heap::Heap):
5085 (KJS::allocateBlock):
5086 * kjs/collector.h:
5087 No, #if PLATFORM(UNIX) was not right. I've just moved the unsafe initialization back for now,
5088 as the platforms that use that code path do not use multiple threads yet.
5089
5090 2008-06-19 Alexey Proskuryakov <ap@webkit.org>
5091
5092 Windows and Qt build fixes.
5093
5094 * kjs/collector.h:
5095 * kjs/collector.cpp:
5096 (KJS::Heap::Heap):
5097 Wrapped m_pagesize in #if PLATFORM(UNIX), which should better match the sequence of #elifs
5098 in allocateBlock(). Changed MIN_ARRAY_SIZE to be explicitly size_t, as this type is different
5099 on different platforms.
5100
5101 2008-06-17 Alexey Proskuryakov <ap@webkit.org>
5102
5103 Reviewed by Darin.
5104
5105 Prepare JavaScript heap for being per-thread.
5106
5107 * kjs/ExecState.h: Shuffle includes, making it possible to include ExecState.h in JSValue.h.
5108 (KJS::ExecState::heap): Added an accessor.
5109
5110 * API/JSBase.cpp: (JSGarbageCollect): Collect both shared and per-thread heaps.
5111
5112 * API/JSContextRef.cpp: (JSGlobalContextCreate): When allocating JSGlobalObject, indicate
5113 that it belongs to a shared heap.
5114
5115 * JavaScriptCore.xcodeproj/project.pbxproj:
5116 * kjs/AllInOneFile.cpp:
5117 Moved JSGlobalObject.cpp to AllInOneFile, as a build fix for inlineAllocate magic.
5118
5119 * VM/CodeGenerator.h: (KJS::CodeGenerator::globalExec): Added an accessor (working via
5120 m_scopeChain).
5121
5122 * VM/RegisterFile.h:
5123 (KJS::RegisterFile::mark):
5124 * VM/RegisterFileStack.h:
5125 (KJS::RegisterFileStack::mark):
5126 Made these pseudo-mark functions take Heap*.
5127
5128 * kjs/InitializeThreading.cpp:
5129 (KJS::initializeThreading): Initialize heap introspector.
5130
5131 * kjs/JSGlobalData.h: Added Heap to the structure.
5132
5133 * kjs/JSGlobalData.cpp:
5134 (KJS::JSGlobalData::JSGlobalData): Initialize Heap.
5135 (KJS::JSGlobalData::sharedInstance): Added a method to access shared global data instance
5136 for legacy clients.
5137
5138 * kjs/JSGlobalObject.cpp:
5139 (KJS::JSGlobalObject::~JSGlobalObject): Changed to work with per-thread head; fixed list
5140 maintenance logic.
5141 (KJS::JSGlobalObject::init): Changed to work with per-thread head.
5142 (KJS::JSGlobalObject::put): Assert that a cross-heap operation is not being attempted.
5143 (KJS::JSGlobalObject::reset): Pass ExecState* where now required.
5144 (KJS::JSGlobalObject::mark): Pass the current heap to RegisterFileStack::mark.
5145 (KJS::JSGlobalObject::operator new): Overload operator new to use per-thread or shared heap.
5146 * kjs/JSGlobalObject.h: Removed static s_head member.
5147
5148 * kjs/PropertyMap.h: (KJS::PropertyMap::PropertyMap): Removed unused SavedProperty.
5149
5150 * kjs/collector.h: Turned Collector into an actual object with its own data, renamed to Heap.
5151 (KJS::Heap::initializeHeapIntrospector): Added.
5152 (KJS::Heap::heap): Added a method to determine which heap a JSValue is in, if any.
5153 (KJS::Heap::allocate): Made non-static.
5154 (KJS::Heap::inlineAllocateNumber): Ditto.
5155 (KJS::Heap::markListSet): Ditto.
5156 (KJS::Heap::cellBlock): Ditto.
5157 (KJS::Heap::cellOffset): Ditto.
5158 (KJS::Heap::isCellMarked): Ditto.
5159 (KJS::Heap::markCell): Ditto.
5160 (KJS::Heap::reportExtraMemoryCost): Ditto.
5161 (KJS::CollectorBlock): Added a back-reference to Heap for Heap::heap() method.
5162 (KJS::SmallCellCollectorBlock): Ditto.
5163
5164 * kjs/collector.cpp: Changed MIN_ARRAY_SIZE to a #define to avoid a PIC branch. Removed
5165 main thread related machinery.
5166 (KJS::Heap::Heap): Initialize the newly added data members.
5167 (KJS::allocateBlock): Marked NEVER_INLINE, as this is a rare case that uses a PIC branch.
5168 Moved static pagesize to the class to make it safely initialized.
5169 (KJS::Heap::heapAllocate): Initialize heap back reference after a new block is allocated.
5170 (KJS::Heap::registerThread): Removed introspector initialization, as it is now performed
5171 in InitializeThreading.cpp.
5172 (KJS::Heap::markOtherThreadConservatively): Assert that the "other thread" case only occurs
5173 for legacy clients using a shared heap.
5174 (KJS::Heap::markStackObjectsConservatively): Moved fastMallocForbid/Allow down here, since
5175 it doesn't need to be forbidden during other GC phases.
5176
5177 * kjs/JSImmediate.h:
5178 (KJS::jsUndefined):
5179 (KJS::jsNull):
5180 (KJS::jsBoolean):
5181 Moved from JSvalue.h, to make these usable in files that cannot include JSValue.h (such
5182 as list.h).
5183
5184 * API/JSCallbackObjectFunctions.h:
5185 (KJS::::staticFunctionGetter):
5186 * API/JSClassRef.cpp:
5187 (OpaqueJSClass::prototype):
5188 * API/JSObjectRef.cpp:
5189 (JSObjectMake):
5190 (JSObjectMakeFunctionWithCallback):
5191 (JSObjectMakeConstructor):
5192 (JSObjectMakeFunction):
5193 * API/JSValueRef.cpp:
5194 (JSValueMakeNumber):
5195 (JSValueMakeString):
5196 * JavaScriptCore.exp:
5197 * VM/CodeGenerator.cpp:
5198 (KJS::CodeGenerator::emitLoad):
5199 * VM/JSPropertyNameIterator.cpp:
5200 (KJS::JSPropertyNameIterator::create):
5201 (KJS::JSPropertyNameIterator::next):
5202 * VM/Machine.cpp:
5203 (KJS::jsAddSlowCase):
5204 (KJS::jsAdd):
5205 (KJS::jsTypeStringForValue):
5206 (KJS::scopeChainForCall):
5207 (KJS::Machine::throwException):
5208 (KJS::Machine::execute):
5209 (KJS::Machine::privateExecute):
5210 (KJS::Machine::retrieveArguments):
5211 * kjs/ArrayPrototype.cpp:
5212 (KJS::arrayProtoFuncToString):
5213 (KJS::arrayProtoFuncToLocaleString):
5214 (KJS::arrayProtoFuncJoin):
5215 (KJS::arrayProtoFuncConcat):
5216 (KJS::arrayProtoFuncPop):
5217 (KJS::arrayProtoFuncPush):
5218 (KJS::arrayProtoFuncShift):
5219 (KJS::arrayProtoFuncSlice):
5220 (KJS::arrayProtoFuncSplice):
5221 (KJS::arrayProtoFuncUnShift):
5222 (KJS::arrayProtoFuncFilter):
5223 (KJS::arrayProtoFuncMap):
5224 (KJS::arrayProtoFuncEvery):
5225 (KJS::arrayProtoFuncForEach):
5226 (KJS::arrayProtoFuncSome):
5227 (KJS::arrayProtoFuncIndexOf):
5228 (KJS::arrayProtoFuncLastIndexOf):
5229 (KJS::ArrayConstructor::ArrayConstructor):
5230 (KJS::ArrayConstructor::construct):
5231 (KJS::ArrayConstructor::callAsFunction):
5232 * kjs/BooleanObject.cpp:
5233 (KJS::BooleanPrototype::BooleanPrototype):
5234 (KJS::booleanProtoFuncToString):
5235 (KJS::BooleanConstructor::BooleanConstructor):
5236 (KJS::BooleanConstructor::construct):
5237 * kjs/FunctionPrototype.cpp:
5238 (KJS::FunctionPrototype::FunctionPrototype):
5239 (KJS::functionProtoFuncToString):
5240 (KJS::FunctionConstructor::FunctionConstructor):
5241 (KJS::FunctionConstructor::construct):
5242 * kjs/JSActivation.cpp:
5243 (KJS::JSActivation::createArgumentsObject):
5244 * kjs/JSArray.cpp:
5245 (KJS::JSArray::JSArray):
5246 (KJS::JSArray::lengthGetter):
5247 * kjs/JSFunction.cpp:
5248 (KJS::JSFunction::lengthGetter):
5249 (KJS::JSFunction::construct):
5250 (KJS::Arguments::Arguments):
5251 (KJS::encode):
5252 (KJS::decode):
5253 (KJS::globalFuncParseInt):
5254 (KJS::globalFuncParseFloat):
5255 (KJS::globalFuncEscape):
5256 (KJS::globalFuncUnescape):
5257 (KJS::PrototypeFunction::PrototypeFunction):
5258 (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
5259 * kjs/JSImmediate.cpp:
5260 (KJS::JSImmediate::toObject):
5261 * kjs/JSLock.cpp:
5262 (KJS::JSLock::registerThread):
5263 * kjs/JSObject.cpp:
5264 (KJS::JSObject::put):
5265 (KJS::JSObject::defineGetter):
5266 (KJS::JSObject::defineSetter):
5267 (KJS::Error::create):
5268 * kjs/JSObject.h:
5269 (KJS::JSObject::putDirect):
5270 * kjs/JSString.h:
5271 (KJS::JSString::JSString):
5272 * kjs/JSValue.cpp:
5273 (KJS::JSCell::operator new):
5274 (KJS::jsString):
5275 (KJS::jsOwnedString):
5276 * kjs/JSValue.h:
5277 (KJS::JSNumberCell::operator new):
5278 (KJS::jsNumberCell):
5279 (KJS::jsNaN):
5280 (KJS::jsNumber):
5281 (KJS::JSCell::marked):
5282 (KJS::JSCell::mark):
5283 (KJS::JSValue::toJSNumber):
5284 * kjs/MathObject.cpp:
5285 (KJS::MathObject::getValueProperty):
5286 (KJS::mathProtoFuncAbs):
5287 (KJS::mathProtoFuncACos):
5288 (KJS::mathProtoFuncASin):
5289 (KJS::mathProtoFuncATan):
5290 (KJS::mathProtoFuncATan2):
5291 (KJS::mathProtoFuncCeil):
5292 (KJS::mathProtoFuncCos):
5293 (KJS::mathProtoFuncExp):
5294 (KJS::mathProtoFuncFloor):
5295 (KJS::mathProtoFuncLog):
5296 (KJS::mathProtoFuncMax):
5297 (KJS::mathProtoFuncMin):
5298 (KJS::mathProtoFuncPow):
5299 (KJS::mathProtoFuncRandom):
5300 (KJS::mathProtoFuncRound):
5301 (KJS::mathProtoFuncSin):
5302 (KJS::mathProtoFuncSqrt):
5303 (KJS::mathProtoFuncTan):
5304 * kjs/NumberObject.cpp:
5305 (KJS::NumberPrototype::NumberPrototype):
5306 (KJS::numberProtoFuncToString):
5307 (KJS::numberProtoFuncToLocaleString):
5308 (KJS::numberProtoFuncToFixed):
5309 (KJS::numberProtoFuncToExponential):
5310 (KJS::numberProtoFuncToPrecision):
5311 (KJS::NumberConstructor::NumberConstructor):
5312 (KJS::NumberConstructor::getValueProperty):
5313 (KJS::NumberConstructor::construct):
5314 (KJS::NumberConstructor::callAsFunction):
5315 * kjs/RegExpObject.cpp:
5316 (KJS::RegExpPrototype::RegExpPrototype):
5317 (KJS::regExpProtoFuncToString):
5318 (KJS::RegExpObject::getValueProperty):
5319 (KJS::RegExpConstructor::RegExpConstructor):
5320 (KJS::RegExpMatchesArray::fillArrayInstance):
5321 (KJS::RegExpConstructor::arrayOfMatches):
5322 (KJS::RegExpConstructor::getBackref):
5323 (KJS::RegExpConstructor::getLastParen):
5324 (KJS::RegExpConstructor::getLeftContext):
5325 (KJS::RegExpConstructor::getRightContext):
5326 (KJS::RegExpConstructor::getValueProperty):
5327 (KJS::RegExpConstructor::construct):
5328 * kjs/RegExpObject.h:
5329 * kjs/Shell.cpp:
5330 (GlobalObject::GlobalObject):
5331 (functionGC):
5332 (functionRun):
5333 (functionReadline):
5334 (jscmain):
5335 * kjs/date_object.cpp:
5336 (KJS::formatLocaleDate):
5337 (KJS::DatePrototype::DatePrototype):
5338 (KJS::DateConstructor::DateConstructor):
5339 (KJS::DateConstructor::construct):
5340 (KJS::DateConstructor::callAsFunction):
5341 (KJS::DateFunction::DateFunction):
5342 (KJS::DateFunction::callAsFunction):
5343 (KJS::dateProtoFuncToString):
5344 (KJS::dateProtoFuncToUTCString):
5345 (KJS::dateProtoFuncToDateString):
5346 (KJS::dateProtoFuncToTimeString):
5347 (KJS::dateProtoFuncToLocaleString):
5348 (KJS::dateProtoFuncToLocaleDateString):
5349 (KJS::dateProtoFuncToLocaleTimeString):
5350 (KJS::dateProtoFuncValueOf):
5351 (KJS::dateProtoFuncGetTime):
5352 (KJS::dateProtoFuncGetFullYear):
5353 (KJS::dateProtoFuncGetUTCFullYear):
5354 (KJS::dateProtoFuncToGMTString):
5355 (KJS::dateProtoFuncGetMonth):
5356 (KJS::dateProtoFuncGetUTCMonth):
5357 (KJS::dateProtoFuncGetDate):
5358 (KJS::dateProtoFuncGetUTCDate):
5359 (KJS::dateProtoFuncGetDay):
5360 (KJS::dateProtoFuncGetUTCDay):
5361 (KJS::dateProtoFuncGetHours):
5362 (KJS::dateProtoFuncGetUTCHours):
5363 (KJS::dateProtoFuncGetMinutes):
5364 (KJS::dateProtoFuncGetUTCMinutes):
5365 (KJS::dateProtoFuncGetSeconds):
5366 (KJS::dateProtoFuncGetUTCSeconds):
5367 (KJS::dateProtoFuncGetMilliSeconds):
5368 (KJS::dateProtoFuncGetUTCMilliseconds):
5369 (KJS::dateProtoFuncGetTimezoneOffset):
5370 (KJS::dateProtoFuncSetTime):
5371 (KJS::setNewValueFromTimeArgs):
5372 (KJS::setNewValueFromDateArgs):
5373 (KJS::dateProtoFuncSetYear):
5374 (KJS::dateProtoFuncGetYear):
5375 * kjs/error_object.cpp:
5376 (KJS::ErrorPrototype::ErrorPrototype):
5377 (KJS::errorProtoFuncToString):
5378 (KJS::ErrorConstructor::ErrorConstructor):
5379 (KJS::ErrorConstructor::construct):
5380 (KJS::NativeErrorPrototype::NativeErrorPrototype):
5381 (KJS::NativeErrorConstructor::NativeErrorConstructor):
5382 (KJS::NativeErrorConstructor::construct):
5383 * kjs/identifier.h:
5384 * kjs/internal.cpp:
5385 (KJS::StringObject::create):
5386 (KJS::JSString::lengthGetter):
5387 (KJS::JSString::indexGetter):
5388 (KJS::JSString::indexNumericPropertyGetter):
5389 * kjs/interpreter.cpp:
5390 * kjs/list.cpp:
5391 (KJS::ArgList::slowAppend):
5392 * kjs/list.h:
5393 * kjs/lookup.h:
5394 (KJS::staticFunctionGetter):
5395 (KJS::cacheGlobalObject):
5396 * kjs/nodes.cpp:
5397 (KJS::Node::emitThrowError):
5398 (KJS::StringNode::emitCode):
5399 (KJS::ArrayNode::emitCode):
5400 (KJS::FuncDeclNode::makeFunction):
5401 (KJS::FuncExprNode::makeFunction):
5402 * kjs/nodes.h:
5403 * kjs/object_object.cpp:
5404 (KJS::ObjectPrototype::ObjectPrototype):
5405 (KJS::objectProtoFuncToLocaleString):
5406 (KJS::objectProtoFuncToString):
5407 (KJS::ObjectConstructor::ObjectConstructor):
5408 (KJS::ObjectConstructor::construct):
5409 * kjs/protect.h:
5410 (KJS::gcProtect):
5411 (KJS::gcUnprotect):
5412 * kjs/string_object.cpp:
5413 (KJS::StringObject::StringObject):
5414 (KJS::StringPrototype::StringPrototype):
5415 (KJS::replace):
5416 (KJS::stringProtoFuncCharAt):
5417 (KJS::stringProtoFuncCharCodeAt):
5418 (KJS::stringProtoFuncConcat):
5419 (KJS::stringProtoFuncIndexOf):
5420 (KJS::stringProtoFuncLastIndexOf):
5421 (KJS::stringProtoFuncMatch):
5422 (KJS::stringProtoFuncSearch):
5423 (KJS::stringProtoFuncReplace):
5424 (KJS::stringProtoFuncSlice):
5425 (KJS::stringProtoFuncSplit):
5426 (KJS::stringProtoFuncSubstr):
5427 (KJS::stringProtoFuncSubstring):
5428 (KJS::stringProtoFuncToLowerCase):
5429 (KJS::stringProtoFuncToUpperCase):
5430 (KJS::stringProtoFuncToLocaleLowerCase):
5431 (KJS::stringProtoFuncToLocaleUpperCase):
5432 (KJS::stringProtoFuncLocaleCompare):
5433 (KJS::stringProtoFuncBig):
5434 (KJS::stringProtoFuncSmall):
5435 (KJS::stringProtoFuncBlink):
5436 (KJS::stringProtoFuncBold):
5437 (KJS::stringProtoFuncFixed):
5438 (KJS::stringProtoFuncItalics):
5439 (KJS::stringProtoFuncStrike):
5440 (KJS::stringProtoFuncSub):
5441 (KJS::stringProtoFuncSup):
5442 (KJS::stringProtoFuncFontcolor):
5443 (KJS::stringProtoFuncFontsize):
5444 (KJS::stringProtoFuncAnchor):
5445 (KJS::stringProtoFuncLink):
5446 (KJS::StringConstructor::StringConstructor):
5447 (KJS::StringConstructor::construct):
5448 (KJS::StringConstructor::callAsFunction):
5449 (KJS::StringConstructorFunction::StringConstructorFunction):
5450 (KJS::StringConstructorFunction::callAsFunction):
5451 * kjs/string_object.h:
5452 (KJS::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
5453 * kjs/ustring.h:
5454 Updated for the above changes.
5455
5456 2008-06-17 Timothy Hatcher <timothy@apple.com>
5457
5458 Added a type to DebuggerCallFrame so the under interface can
5459 distinguish anonymous functions and program call frames.
5460
5461 https://bugs.webkit.org/show_bug.cgi?id=19585
5462
5463 Reviewed by Geoff Garen.
5464
5465 * JavaScriptCore.exp: Export the DebuggerCallFrame::type symbol.
5466 * kjs/DebuggerCallFrame.cpp:
5467 (KJS::DebuggerCallFrame::type): Added.
5468 * kjs/DebuggerCallFrame.h:
5469
5470 2008-06-17 Eric Seidel <eric@webkit.org>
5471
5472 Reviewed by Tim H.
5473
5474 Remove bogus ASSERT which tripped every time for those who use PAC files.
5475
5476 * kjs/Parser.cpp:
5477 (KJS::Parser::parse):
5478
5479 2008-06-17 Kevin McCullough <kmccullough@apple.com>
5480
5481 Reviewed by Geoff.
5482
5483 <rdar://problem/5951534> JSProfiler: Don't profile console.profile()
5484 or console.profileEnd()
5485
5486 * profiler/Profile.cpp:
5487 (KJS::Profile::stopProfiling): Moved the creation of the (idle) node to
5488 the Profile (not ProfileNode). This makes sense since the Profile
5489 should be the one to modify the profile tree. Also each stopProfiling()
5490 does not need to check if it's the head node anymore. Also fixed an
5491 oddity where I was using willExecute to create the node.
5492 (KJS::Profile::removeProfileStart): Removes the call to console.profile
5493 that started this profile.
5494 (KJS::Profile::removeProfileEnd): Removes the call to console.profileEnd
5495 that ended this profile.
5496 * profiler/Profile.h:
5497 * profiler/ProfileNode.cpp: Moved the creation of the (idle) node to
5498 the Profile object.
5499 (KJS::ProfileNode::stopProfiling):
5500 * profiler/ProfileNode.h: Added some helper functions and whitespace to
5501 facilitate readability and the removal of profile() and profileEnd()
5502 from the Profile tree.
5503 (KJS::CallIdentifier::operator const char* ):
5504 (KJS::ProfileNode::firstChild):
5505 (KJS::ProfileNode::lastChild):
5506 (KJS::ProfileNode::removeChild):
5507 (KJS::ProfileNode::toString):
5508
5509 2008-06-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
5510
5511 Rubber stamped by Adam Roben.
5512
5513 Include JSGlobalObject.h to fix the build.
5514
5515 * kjs/ScopeChain.cpp:
5516
5517 2008-06-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
5518
5519 Reviewed by Oliver.
5520
5521 Reduce code duplication in emitReadModifyAssignment().
5522
5523 * kjs/nodes.cpp:
5524 (KJS::emitReadModifyAssignment):
5525
5526 2008-06-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
5527
5528 Reviewed by Oliver.
5529
5530 Sort includes alphabetically.
5531
5532 * kjs/nodes.cpp:
5533
5534 2008-06-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
5535
5536 Reviewed by Maciej.
5537
5538 Bug 19596: LEAK: Gmail leaks SegmentedVector<RegisterID>
5539 <https://bugs.webkit.org/show_bug.cgi?id=19596>
5540
5541 When growing SegmentedVector, we start adding segments at the position
5542 of the last segment, overwriting it. The destructor frees allocated
5543 segments starting at the segment of index 1, because the segment of
5544 index 0 is assumed to be the initial inline segment. This causes a leak
5545 of the segment that is referenced by index 0. Modifying grow() so that
5546 it starts adding segments at the position after the last segment fixes
5547 the leak.
5548
5549 Since the initial segment is a special case in the lookup code, this
5550 bug never manifested itself via incorrect results.
5551
5552 * VM/SegmentedVector.h:
5553 (KJS::SegmentedVector::grow):
5554
5555 2008-06-16 Maciej Stachowiak <mjs@apple.com>
5556
5557 Reviewed by Alexey.
5558
5559 - removed nearly unused types.h and LocalStorageEntry.h headers
5560
5561 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
5562 * JavaScriptCore.xcodeproj/project.pbxproj:
5563 * kjs/ExecState.h:
5564 * kjs/LocalStorageEntry.h: Removed.
5565 * kjs/RegExpObject.cpp:
5566 * kjs/error_object.cpp:
5567 * kjs/grammar.y:
5568 * kjs/nodes.cpp:
5569 * kjs/types.h: Removed.
5570
5571 2008-06-16 Alp Toker <alp@nuanti.com>
5572
5573 Rubber-stamped by Geoff.
5574
5575 Change c++ to c in minidom and testapi emacs mode line comments.
5576
5577 * API/Node.h:
5578 * API/NodeList.c:
5579 * API/NodeList.h:
5580 * API/testapi.c:
5581
5582 2008-06-16 Alexey Proskuryakov <ap@webkit.org>
5583
5584 Trying to fix Windows build.
5585
5586 * kjs/PropertyNameArray.h:
5587 * kjs/identifier.cpp:
5588 Include ExecState.h
5589
5590 2008-06-16 Geoffrey Garen <ggaren@apple.com>
5591
5592 Reviewed by Oliver Hunt.
5593
5594 Slight cleanup to the SymbolTableEntry class.
5595
5596 Renamed isEmpty to isNull, since we usually use "empty" to mean "holds
5597 the valid, empty value", and "null" to mean "holds no value".
5598
5599 Changed an "== 0" to a "!", to match our style guidelines.
5600
5601 Added some ASSERTs to verify the (possibly questionable) assumption that
5602 all register indexes will have their high two bits set. Also clarified a
5603 comment to make that assumption clear.
5604
5605 2008-06-16 Alexey Proskuryakov <ap@webkit.org>
5606
5607 Reviewed by Darin.
5608
5609 Initialize functionQueueMutex in a safe manner.
5610
5611 * wtf/MainThread.cpp:
5612 (WTF::functionQueueMutex): Made it an AtomicallyInitializedStatic.
5613
5614 (WTF::dispatchFunctionsFromMainThread):
5615 (WTF::setMainThreadCallbacksPaused):
5616 Assert that the current thread is main, meaning that the callbacksPaused static can be
5617 accessed.
5618
5619 2008-06-16 Alexey Proskuryakov <ap@webkit.org>
5620
5621 Reviewed by Geoff Garen.
5622
5623 Make Identifier construction use an explicitly passed IdentifierTable.
5624
5625 No change on SunSpider total.
5626
5627 * API/JSCallbackObjectFunctions.h:
5628 (KJS::::getOwnPropertySlot):
5629 (KJS::::put):
5630 (KJS::::deleteProperty):
5631 (KJS::::getPropertyNames):
5632 * API/JSObjectRef.cpp:
5633 (JSObjectMakeFunctionWithCallback):
5634 (JSObjectMakeFunction):
5635 (JSObjectHasProperty):
5636 (JSObjectGetProperty):
5637 (JSObjectSetProperty):
5638 (JSObjectDeleteProperty):
5639 (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
5640 (JSObjectCopyPropertyNames):
5641 * JavaScriptCore.exp:
5642 * VM/CodeGenerator.cpp:
5643 (KJS::CodeGenerator::CodeGenerator):
5644 (KJS::CodeGenerator::registerForLocal):
5645 (KJS::CodeGenerator::isLocal):
5646 (KJS::CodeGenerator::addConstant):
5647 (KJS::CodeGenerator::findScopedProperty):
5648 * VM/CodeGenerator.h:
5649 (KJS::CodeGenerator::globalData):
5650 (KJS::CodeGenerator::propertyNames):
5651 * VM/JSPropertyNameIterator.cpp:
5652 (KJS::JSPropertyNameIterator::create):
5653 * VM/Machine.cpp:
5654 (KJS::Machine::throwException):
5655 (KJS::Machine::privateExecute):
5656 * kjs/ArrayPrototype.cpp:
5657 (KJS::ArrayConstructor::ArrayConstructor):
5658 * kjs/BooleanObject.cpp:
5659 (KJS::BooleanConstructor::BooleanConstructor):
5660 * kjs/FunctionPrototype.cpp:
5661 (KJS::FunctionConstructor::FunctionConstructor):
5662 (KJS::FunctionConstructor::construct):
5663 * kjs/JSArray.cpp:
5664 (KJS::JSArray::inlineGetOwnPropertySlot):
5665 (KJS::JSArray::put):
5666 (KJS::JSArray::deleteProperty):
5667 (KJS::JSArray::getPropertyNames):
5668 * kjs/JSFunction.cpp:
5669 (KJS::Arguments::Arguments):
5670 * kjs/JSGlobalData.cpp:
5671 (KJS::JSGlobalData::JSGlobalData):
5672 * kjs/JSGlobalObject.cpp:
5673 (KJS::JSGlobalObject::reset):
5674 * kjs/JSObject.cpp:
5675 (KJS::JSObject::getOwnPropertySlot):
5676 (KJS::JSObject::put):
5677 (KJS::JSObject::putWithAttributes):
5678 (KJS::JSObject::deleteProperty):
5679 (KJS::JSObject::findPropertyHashEntry):
5680 (KJS::JSObject::getPropertyNames):
5681 (KJS::Error::create):
5682 * kjs/JSVariableObject.cpp:
5683 (KJS::JSVariableObject::getPropertyNames):
5684 * kjs/NumberObject.cpp:
5685 (KJS::NumberConstructor::NumberConstructor):
5686 * kjs/PropertyNameArray.cpp:
5687 (KJS::PropertyNameArray::add):
5688 * kjs/PropertyNameArray.h:
5689 (KJS::PropertyNameArray::PropertyNameArray):
5690 (KJS::PropertyNameArray::addKnownUnique):
5691 * kjs/PropertySlot.h:
5692 (KJS::PropertySlot::getValue):
5693 * kjs/RegExpObject.cpp:
5694 (KJS::RegExpConstructor::RegExpConstructor):
5695 * kjs/ScopeChain.cpp:
5696 (KJS::ScopeChainNode::print):
5697 * kjs/Shell.cpp:
5698 (GlobalObject::GlobalObject):
5699 * kjs/date_object.cpp:
5700 (KJS::DateConstructor::DateConstructor):
5701 * kjs/error_object.cpp:
5702 (KJS::ErrorConstructor::ErrorConstructor):
5703 (KJS::NativeErrorConstructor::NativeErrorConstructor):
5704 * kjs/grammar.y:
5705 * kjs/identifier.cpp:
5706 (KJS::Identifier::add):
5707 (KJS::Identifier::addSlowCase):
5708 * kjs/identifier.h:
5709 (KJS::Identifier::Identifier):
5710 (KJS::Identifier::from):
5711 (KJS::Identifier::equal):
5712 (KJS::Identifier::add):
5713 (KJS::operator==):
5714 (KJS::operator!=):
5715 * kjs/internal.cpp:
5716 (KJS::JSString::getOwnPropertySlot):
5717 * kjs/lexer.cpp:
5718 (KJS::Lexer::Lexer):
5719 (KJS::Lexer::lex):
5720 (KJS::Lexer::makeIdentifier):
5721 * kjs/lexer.h:
5722 * kjs/lookup.cpp:
5723 (KJS::HashTable::createTable):
5724 * kjs/lookup.h:
5725 (KJS::HashTable::initializeIfNeeded):
5726 (KJS::HashTable::entry):
5727 (KJS::getStaticPropertySlot):
5728 (KJS::getStaticFunctionSlot):
5729 (KJS::getStaticValueSlot):
5730 (KJS::lookupPut):
5731 * kjs/object_object.cpp:
5732 (KJS::objectProtoFuncHasOwnProperty):
5733 (KJS::objectProtoFuncDefineGetter):
5734 (KJS::objectProtoFuncDefineSetter):
5735 (KJS::objectProtoFuncLookupGetter):
5736 (KJS::objectProtoFuncLookupSetter):
5737 (KJS::objectProtoFuncPropertyIsEnumerable):
5738 (KJS::ObjectConstructor::ObjectConstructor):
5739 * kjs/string_object.cpp:
5740 (KJS::StringObject::getOwnPropertySlot):
5741 (KJS::StringObject::getPropertyNames):
5742 (KJS::StringConstructor::StringConstructor):
5743 Just pass ExecState or JSGlobalData everywhere. Identifier construction is now always
5744 explicit.
5745
5746 * kjs/nodes.cpp: (KJS::RegExpNode::emitCode): Here, Identifier was created from a non-literal
5747 char*, which was incorrect, as that uses the pointer value as a key.
5748
5749 2008-06-16 Thiago Macieira <tjmaciei@trolltech.com>
5750
5751 Reviewed by Darin.
5752
5753 https://bugs.webkit.org/show_bug.cgi?id=19577
5754
5755 Fix compilation in C++ environments where C99 headers are not present
5756
5757 The stdbool.h header is a C99 feature, defining the "_Bool" type as well as the
5758 "true" and "false" constants. But it's completely unnecessary in C++ as the
5759 language already defines the "bool" type and its two values.
5760
5761 * API/JSBase.h:
5762 * API/JSContextRef.h:
5763 * API/JSObjectRef.h:
5764 * API/JSStringRef.h:
5765 * API/JSValueRef.h:
5766
5767 2008-06-16 Kevin McCullough <kmccullough@apple.com>
5768
5769 Reviewed by John.
5770
5771 <rdar://problem/6012509> JSProfiler: %s are incorrect if you exclude a
5772 top level node like (idle)
5773
5774 * profiler/Profile.cpp:
5775 (KJS::Profile::focus):
5776 (KJS::Profile::exclude): Subtract the selfTime from the totalTime of the
5777 head since its self time will only be non-zero when one of its children
5778 were excluded. Since the head's totalTime is used to calculate %s when
5779 its totalTime is the same as the sum of all its visible childrens' times
5780 their %s will sum to 100%.
5781
5782 2008-06-16 Kevin McCullough <kmccullough@apple.com>
5783
5784 Reviewed by Sam Weinig.
5785
5786 <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the profiler.
5787
5788 * profiler/Profile.cpp:
5789 (KJS::Profile::willExecute):
5790
5791 2008-06-16 Kevin McCullough <kmccullough@apple.com>
5792
5793 Reviewed by Sam.
5794
5795 <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
5796 profiler.
5797 - Remove the last of the uses of recursion in the profiler.
5798
5799 * JavaScriptCore.exp: Export the new function's signature.
5800 * profiler/Profile.cpp:
5801 (KJS::calculateVisibleTotalTime): Added a new static method for
5802 recalculating the visibleTotalTime of methods after focus has changed
5803 which are visible.
5804 (KJS::stopProfiling):
5805 (KJS::Profile::focus): Implemented focus without recursion.
5806 * profiler/Profile.h: Moved implementation into the definition file.
5807 * profiler/ProfileNode.cpp:
5808 (KJS::ProfileNode::traverseNextNodePreOrder): Added an argument for
5809 whether or not to process the children nodes, this allows focus to skip
5810 sub trees which have been set as not visible.
5811 (KJS::ProfileNode::calculateVisibleTotalTime): This function set's a
5812 node's total visible time to the sum of its self time and its children's
5813 total times.
5814 (KJS::ProfileNode::focus): Implemented focus without recursion.
5815 * profiler/ProfileNode.h:
5816 (KJS::CallIdentifier::operator!= ):
5817 (KJS::ProfileNode::setActualTotalTime): Expanded setting the total time
5818 so that focus could modify only the visible total time.
5819 (KJS::ProfileNode::setVisibleTotalTime):
5820
5821 2008-06-16 Christian Dywan <christian@twotoasts.de>
5822
5823 Reviewed by Sam.
5824
5825 https://bugs.webkit.org/show_bug.cgi?id=19552
5826 JavaScriptCore headers use C++ style comments
5827
5828 Replace all C++ style comments with C style multiline
5829 comments and remove all "mode" lines.
5830
5831 * API/JSBase.h:
5832 * API/JSClassRef.h:
5833 * API/JSContextRef.h:
5834 * API/JSObjectRef.h:
5835 * API/JSStringRef.h:
5836 * API/JSStringRefBSTR.h:
5837 * API/JSStringRefCF.h:
5838 * API/JSValueRef.h:
5839 * API/JavaScript.h:
5840 * API/JavaScriptCore.h:
5841
5842 2008-06-16 Christian Dywan <christian@twotoasts.de>
5843
5844 Reviewed by Sam.
5845
5846 https://bugs.webkit.org/show_bug.cgi?id=19557
5847 (JavaScriptCore) minidom uses C++ style comments
5848
5849 Use only C style comments in minidom sources
5850
5851 * API/JSNode.c:
5852 (JSNode_appendChild):
5853 (JSNode_removeChild):
5854 * API/JSNode.h:
5855 * API/JSNodeList.c:
5856 (JSNodeList_getProperty):
5857 * API/JSNodeList.h:
5858 * API/Node.c:
5859 * API/Node.h:
5860 * API/NodeList.c:
5861 (NodeList_new):
5862 (NodeList_item):
5863 * API/NodeList.h:
5864 * API/minidom.c:
5865 (createStringWithContentsOfFile):
5866 * wtf/Assertions.h:
5867 * wtf/UnusedParam.h:
5868
5869 2008-06-16 Adriaan de Groot <groot@kde.org>
5870
5871 Reviewed by Simon.
5872
5873 Fix compilation on Solaris
5874
5875 On some systems, munmap takes a char* instead of a void* (contrary to POSIX and
5876 Single Unix Specification). Since you can always convert from char* to void*
5877 but not vice-versa, do the casting to char*.
5878
5879 * kjs/collector.cpp:
5880 (KJS::allocateBlock):
5881 (KJS::freeBlock):
5882
5883 2008-06-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
5884
5885 Reviewed by Maciej.
5886
5887 Make a UnaryOpNode class to reduce boilerplate code for UnaryPlusNode,
5888 NegateNode, BitwiseNotNode, and LogicalNotNode.
5889
5890 * VM/CodeGenerator.h:
5891 (KJS::CodeGenerator::emitToJSNumber):
5892 * kjs/nodes.cpp:
5893 (KJS::UnaryOpNode::emitCode):
5894 * kjs/nodes.h:
5895 (KJS::UnaryOpNode::UnaryOpNode):
5896 (KJS::UnaryPlusNode::):
5897 (KJS::NegateNode::):
5898 (KJS::NegateNode::precedence):
5899 (KJS::BitwiseNotNode::):
5900 (KJS::BitwiseNotNode::precedence):
5901 (KJS::LogicalNotNode::):
5902 (KJS::LogicalNotNode::precedence):
5903
5904 2008-06-16 Jan Michael Alonzo <jmalonzo@webkit.org>
5905
5906 Gtk build fix
5907
5908 * GNUmakefile.am:
5909
5910 2008-06-15 Darin Adler <darin@apple.com>
5911
5912 - rename KJS::List to KJS::ArgList
5913
5914 * API/JSCallbackConstructor.cpp:
5915 (KJS::JSCallbackConstructor::construct):
5916 * API/JSCallbackConstructor.h:
5917 * API/JSCallbackFunction.cpp:
5918 (KJS::JSCallbackFunction::callAsFunction):
5919 * API/JSCallbackFunction.h:
5920 * API/JSCallbackObject.h:
5921 * API/JSCallbackObjectFunctions.h:
5922 (KJS::::construct):
5923 (KJS::::callAsFunction):
5924 * API/JSObjectRef.cpp:
5925 (JSObjectMakeFunction):
5926 (JSObjectCallAsFunction):
5927 (JSObjectCallAsConstructor):
5928 * JavaScriptCore.exp:
5929 * VM/Machine.cpp:
5930 (KJS::Machine::execute):
5931 (KJS::Machine::privateExecute):
5932 * VM/Machine.h:
5933 * kjs/ArrayPrototype.cpp:
5934 (KJS::arrayProtoFuncToString):
5935 (KJS::arrayProtoFuncToLocaleString):
5936 (KJS::arrayProtoFuncJoin):
5937 (KJS::arrayProtoFuncConcat):
5938 (KJS::arrayProtoFuncPop):
5939 (KJS::arrayProtoFuncPush):
5940 (KJS::arrayProtoFuncReverse):
5941 (KJS::arrayProtoFuncShift):
5942 (KJS::arrayProtoFuncSlice):
5943 (KJS::arrayProtoFuncSort):
5944 (KJS::arrayProtoFuncSplice):
5945 (KJS::arrayProtoFuncUnShift):
5946 (KJS::arrayProtoFuncFilter):
5947 (KJS::arrayProtoFuncMap):
5948 (KJS::arrayProtoFuncEvery):
5949 (KJS::arrayProtoFuncForEach):
5950 (KJS::arrayProtoFuncSome):
5951 (KJS::arrayProtoFuncIndexOf):
5952 (KJS::arrayProtoFuncLastIndexOf):
5953 (KJS::ArrayConstructor::construct):
5954 (KJS::ArrayConstructor::callAsFunction):
5955 * kjs/ArrayPrototype.h:
5956 * kjs/BooleanObject.cpp:
5957 (KJS::booleanProtoFuncToString):
5958 (KJS::booleanProtoFuncValueOf):
5959 (KJS::BooleanConstructor::construct):
5960 (KJS::BooleanConstructor::callAsFunction):
5961 * kjs/BooleanObject.h:
5962 * kjs/CommonIdentifiers.h:
5963 * kjs/ExecState.h:
5964 (KJS::ExecState::emptyList):
5965 * kjs/FunctionPrototype.cpp:
5966 (KJS::FunctionPrototype::callAsFunction):
5967 (KJS::functionProtoFuncToString):
5968 (KJS::functionProtoFuncApply):
5969 (KJS::functionProtoFuncCall):
5970 (KJS::FunctionConstructor::construct):
5971 (KJS::FunctionConstructor::callAsFunction):
5972 * kjs/FunctionPrototype.h:
5973 * kjs/JSActivation.cpp:
5974 (KJS::JSActivation::createArgumentsObject):
5975 * kjs/JSArray.cpp:
5976 (KJS::JSArray::JSArray):
5977 (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
5978 * kjs/JSArray.h:
5979 * kjs/JSFunction.cpp:
5980 (KJS::JSFunction::callAsFunction):
5981 (KJS::JSFunction::construct):
5982 (KJS::IndexToNameMap::IndexToNameMap):
5983 (KJS::Arguments::Arguments):
5984 (KJS::encode):
5985 (KJS::decode):
5986 (KJS::globalFuncEval):
5987 (KJS::globalFuncParseInt):
5988 (KJS::globalFuncParseFloat):
5989 (KJS::globalFuncIsNaN):
5990 (KJS::globalFuncIsFinite):
5991 (KJS::globalFuncDecodeURI):
5992 (KJS::globalFuncDecodeURIComponent):
5993 (KJS::globalFuncEncodeURI):
5994 (KJS::globalFuncEncodeURIComponent):
5995 (KJS::globalFuncEscape):
5996 (KJS::globalFuncUnescape):
5997 (KJS::globalFuncKJSPrint):
5998 (KJS::PrototypeFunction::callAsFunction):
5999 (KJS::PrototypeReflexiveFunction::callAsFunction):
6000 * kjs/JSFunction.h:
6001 * kjs/JSGlobalData.h:
6002 * kjs/JSImmediate.cpp:
6003 (KJS::JSImmediate::toObject):
6004 * kjs/JSNotAnObject.cpp:
6005 (KJS::JSNotAnObject::construct):
6006 (KJS::JSNotAnObject::callAsFunction):
6007 * kjs/JSNotAnObject.h:
6008 * kjs/JSObject.cpp:
6009 (KJS::JSObject::put):
6010 (KJS::JSObject::construct):
6011 (KJS::JSObject::callAsFunction):
6012 (KJS::Error::create):
6013 * kjs/JSObject.h:
6014 * kjs/MathObject.cpp:
6015 (KJS::mathProtoFuncAbs):
6016 (KJS::mathProtoFuncACos):
6017 (KJS::mathProtoFuncASin):
6018 (KJS::mathProtoFuncATan):
6019 (KJS::mathProtoFuncATan2):
6020 (KJS::mathProtoFuncCeil):
6021 (KJS::mathProtoFuncCos):
6022 (KJS::mathProtoFuncExp):
6023 (KJS::mathProtoFuncFloor):
6024 (KJS::mathProtoFuncLog):
6025 (KJS::mathProtoFuncMax):
6026 (KJS::mathProtoFuncMin):
6027 (KJS::mathProtoFuncPow):
6028 (KJS::mathProtoFuncRandom):
6029 (KJS::mathProtoFuncRound):
6030 (KJS::mathProtoFuncSin):
6031 (KJS::mathProtoFuncSqrt):
6032 (KJS::mathProtoFuncTan):
6033 * kjs/MathObject.h:
6034 * kjs/NumberObject.cpp:
6035 (KJS::numberProtoFuncToString):
6036 (KJS::numberProtoFuncToLocaleString):
6037 (KJS::numberProtoFuncValueOf):
6038 (KJS::numberProtoFuncToFixed):
6039 (KJS::numberProtoFuncToExponential):
6040 (KJS::numberProtoFuncToPrecision):
6041 (KJS::NumberConstructor::construct):
6042 (KJS::NumberConstructor::callAsFunction):
6043 * kjs/NumberObject.h:
6044 * kjs/RegExpObject.cpp:
6045 (KJS::regExpProtoFuncTest):
6046 (KJS::regExpProtoFuncExec):
6047 (KJS::regExpProtoFuncCompile):
6048 (KJS::regExpProtoFuncToString):
6049 (KJS::RegExpObject::match):
6050 (KJS::RegExpObject::test):
6051 (KJS::RegExpObject::exec):
6052 (KJS::RegExpObject::callAsFunction):
6053 (KJS::RegExpConstructor::construct):
6054 (KJS::RegExpConstructor::callAsFunction):
6055 * kjs/RegExpObject.h:
6056 * kjs/Shell.cpp:
6057 (functionPrint):
6058 (functionDebug):
6059 (functionGC):
6060 (functionVersion):
6061 (functionRun):
6062 (functionLoad):
6063 (functionReadline):
6064 (functionQuit):
6065 * kjs/collector.cpp:
6066 (KJS::Collector::collect):
6067 * kjs/collector.h:
6068 (KJS::Collector::markListSet):
6069 * kjs/date_object.cpp:
6070 (KJS::formatLocaleDate):
6071 (KJS::fillStructuresUsingTimeArgs):
6072 (KJS::fillStructuresUsingDateArgs):
6073 (KJS::DateConstructor::construct):
6074 (KJS::DateConstructor::callAsFunction):
6075 (KJS::DateFunction::callAsFunction):
6076 (KJS::dateProtoFuncToString):
6077 (KJS::dateProtoFuncToUTCString):
6078 (KJS::dateProtoFuncToDateString):
6079 (KJS::dateProtoFuncToTimeString):
6080 (KJS::dateProtoFuncToLocaleString):
6081 (KJS::dateProtoFuncToLocaleDateString):
6082 (KJS::dateProtoFuncToLocaleTimeString):
6083 (KJS::dateProtoFuncValueOf):
6084 (KJS::dateProtoFuncGetTime):
6085 (KJS::dateProtoFuncGetFullYear):
6086 (KJS::dateProtoFuncGetUTCFullYear):
6087 (KJS::dateProtoFuncToGMTString):
6088 (KJS::dateProtoFuncGetMonth):
6089 (KJS::dateProtoFuncGetUTCMonth):
6090 (KJS::dateProtoFuncGetDate):
6091 (KJS::dateProtoFuncGetUTCDate):
6092 (KJS::dateProtoFuncGetDay):
6093 (KJS::dateProtoFuncGetUTCDay):
6094 (KJS::dateProtoFuncGetHours):
6095 (KJS::dateProtoFuncGetUTCHours):
6096 (KJS::dateProtoFuncGetMinutes):
6097 (KJS::dateProtoFuncGetUTCMinutes):
6098 (KJS::dateProtoFuncGetSeconds):
6099 (KJS::dateProtoFuncGetUTCSeconds):
6100 (KJS::dateProtoFuncGetMilliSeconds):
6101 (KJS::dateProtoFuncGetUTCMilliseconds):
6102 (KJS::dateProtoFuncGetTimezoneOffset):
6103 (KJS::dateProtoFuncSetTime):
6104 (KJS::setNewValueFromTimeArgs):
6105 (KJS::setNewValueFromDateArgs):
6106 (KJS::dateProtoFuncSetMilliSeconds):
6107 (KJS::dateProtoFuncSetUTCMilliseconds):
6108 (KJS::dateProtoFuncSetSeconds):
6109 (KJS::dateProtoFuncSetUTCSeconds):
6110 (KJS::dateProtoFuncSetMinutes):
6111 (KJS::dateProtoFuncSetUTCMinutes):
6112 (KJS::dateProtoFuncSetHours):
6113 (KJS::dateProtoFuncSetUTCHours):
6114 (KJS::dateProtoFuncSetDate):
6115 (KJS::dateProtoFuncSetUTCDate):
6116 (KJS::dateProtoFuncSetMonth):
6117 (KJS::dateProtoFuncSetUTCMonth):
6118 (KJS::dateProtoFuncSetFullYear):
6119 (KJS::dateProtoFuncSetUTCFullYear):
6120 (KJS::dateProtoFuncSetYear):
6121 (KJS::dateProtoFuncGetYear):
6122 * kjs/date_object.h:
6123 * kjs/debugger.h:
6124 * kjs/error_object.cpp:
6125 (KJS::errorProtoFuncToString):
6126 (KJS::ErrorConstructor::construct):
6127 (KJS::ErrorConstructor::callAsFunction):
6128 (KJS::NativeErrorConstructor::construct):
6129 (KJS::NativeErrorConstructor::callAsFunction):
6130 * kjs/error_object.h:
6131 * kjs/internal.cpp:
6132 (KJS::JSNumberCell::toObject):
6133 (KJS::JSNumberCell::toThisObject):
6134 * kjs/list.cpp:
6135 (KJS::ArgList::getSlice):
6136 (KJS::ArgList::markLists):
6137 (KJS::ArgList::slowAppend):
6138 * kjs/list.h:
6139 (KJS::ArgList::ArgList):
6140 (KJS::ArgList::~ArgList):
6141 * kjs/object_object.cpp:
6142 (KJS::objectProtoFuncValueOf):
6143 (KJS::objectProtoFuncHasOwnProperty):
6144 (KJS::objectProtoFuncIsPrototypeOf):
6145 (KJS::objectProtoFuncDefineGetter):
6146 (KJS::objectProtoFuncDefineSetter):
6147 (KJS::objectProtoFuncLookupGetter):
6148 (KJS::objectProtoFuncLookupSetter):
6149 (KJS::objectProtoFuncPropertyIsEnumerable):
6150 (KJS::objectProtoFuncToLocaleString):
6151 (KJS::objectProtoFuncToString):
6152 (KJS::ObjectConstructor::construct):
6153 (KJS::ObjectConstructor::callAsFunction):
6154 * kjs/object_object.h:
6155 * kjs/string_object.cpp:
6156 (KJS::replace):
6157 (KJS::stringProtoFuncToString):
6158 (KJS::stringProtoFuncValueOf):
6159 (KJS::stringProtoFuncCharAt):
6160 (KJS::stringProtoFuncCharCodeAt):
6161 (KJS::stringProtoFuncConcat):
6162 (KJS::stringProtoFuncIndexOf):
6163 (KJS::stringProtoFuncLastIndexOf):
6164 (KJS::stringProtoFuncMatch):
6165 (KJS::stringProtoFuncSearch):
6166 (KJS::stringProtoFuncReplace):
6167 (KJS::stringProtoFuncSlice):
6168 (KJS::stringProtoFuncSplit):
6169 (KJS::stringProtoFuncSubstr):
6170 (KJS::stringProtoFuncSubstring):
6171 (KJS::stringProtoFuncToLowerCase):
6172 (KJS::stringProtoFuncToUpperCase):
6173 (KJS::stringProtoFuncToLocaleLowerCase):
6174 (KJS::stringProtoFuncToLocaleUpperCase):
6175 (KJS::stringProtoFuncLocaleCompare):
6176 (KJS::stringProtoFuncBig):
6177 (KJS::stringProtoFuncSmall):
6178 (KJS::stringProtoFuncBlink):
6179 (KJS::stringProtoFuncBold):
6180 (KJS::stringProtoFuncFixed):
6181 (KJS::stringProtoFuncItalics):
6182 (KJS::stringProtoFuncStrike):
6183 (KJS::stringProtoFuncSub):
6184 (KJS::stringProtoFuncSup):
6185 (KJS::stringProtoFuncFontcolor):
6186 (KJS::stringProtoFuncFontsize):
6187 (KJS::stringProtoFuncAnchor):
6188 (KJS::stringProtoFuncLink):
6189 (KJS::StringConstructor::construct):
6190 (KJS::StringConstructor::callAsFunction):
6191 (KJS::StringConstructorFunction::callAsFunction):
6192 * kjs/string_object.h:
6193
6194 2008-06-15 Darin Adler <darin@apple.com>
6195
6196 - new names for more JavaScriptCore files
6197
6198 * API/JSCallbackFunction.cpp:
6199 * API/JSObjectRef.cpp:
6200 * DerivedSources.make:
6201 * GNUmakefile.am:
6202 * JavaScriptCore.exp:
6203 * JavaScriptCore.pri:
6204 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6205 * JavaScriptCore.xcodeproj/project.pbxproj:
6206 * JavaScriptCoreSources.bkl:
6207 * VM/Machine.cpp:
6208 * kjs/AllInOneFile.cpp:
6209 * kjs/ArrayPrototype.cpp: Copied from JavaScriptCore/kjs/array_object.cpp.
6210 * kjs/ArrayPrototype.h: Copied from JavaScriptCore/kjs/array_object.h.
6211 * kjs/BooleanObject.cpp: Copied from JavaScriptCore/kjs/bool_object.cpp.
6212 * kjs/BooleanObject.h: Copied from JavaScriptCore/kjs/bool_object.h.
6213 * kjs/ExecState.cpp:
6214 * kjs/ExecState.h:
6215 * kjs/FunctionPrototype.cpp: Copied from JavaScriptCore/kjs/function_object.cpp.
6216 * kjs/FunctionPrototype.h: Copied from JavaScriptCore/kjs/function_object.h.
6217 * kjs/JSArray.cpp: Copied from JavaScriptCore/kjs/array_instance.cpp.
6218 * kjs/JSArray.h: Copied from JavaScriptCore/kjs/array_instance.h.
6219 * kjs/JSFunction.cpp:
6220 * kjs/JSFunction.h:
6221 * kjs/JSGlobalObject.cpp:
6222 * kjs/JSImmediate.cpp:
6223 * kjs/JSObject.h:
6224 * kjs/JSString.h:
6225 * kjs/JSValue.h:
6226 * kjs/JSVariableObject.cpp:
6227 * kjs/MathObject.cpp: Copied from JavaScriptCore/kjs/math_object.cpp.
6228 * kjs/MathObject.h: Copied from JavaScriptCore/kjs/math_object.h.
6229 * kjs/NumberObject.cpp: Copied from JavaScriptCore/kjs/number_object.cpp.
6230 * kjs/NumberObject.h: Copied from JavaScriptCore/kjs/number_object.h.
6231 * kjs/PropertyMap.cpp: Copied from JavaScriptCore/kjs/property_map.cpp.
6232 * kjs/PropertyMap.h: Copied from JavaScriptCore/kjs/property_map.h.
6233 * kjs/PropertySlot.cpp: Copied from JavaScriptCore/kjs/property_slot.cpp.
6234 * kjs/PropertySlot.h: Copied from JavaScriptCore/kjs/property_slot.h.
6235 * kjs/RegExpObject.cpp: Copied from JavaScriptCore/kjs/regexp_object.cpp.
6236 * kjs/RegExpObject.h: Copied from JavaScriptCore/kjs/regexp_object.h.
6237 * kjs/ScopeChain.cpp: Copied from JavaScriptCore/kjs/scope_chain.cpp.
6238 * kjs/ScopeChain.h: Copied from JavaScriptCore/kjs/scope_chain.h.
6239 * kjs/ScopeChainMark.h: Copied from JavaScriptCore/kjs/scope_chain_mark.h.
6240 * kjs/Shell.cpp:
6241 * kjs/array_instance.cpp: Removed.
6242 * kjs/array_instance.h: Removed.
6243 * kjs/array_object.cpp: Removed.
6244 * kjs/array_object.h: Removed.
6245 * kjs/bool_object.cpp: Removed.
6246 * kjs/bool_object.h: Removed.
6247 * kjs/error_object.h:
6248 * kjs/function_object.cpp: Removed.
6249 * kjs/function_object.h: Removed.
6250 * kjs/internal.cpp:
6251 * kjs/math_object.cpp: Removed.
6252 * kjs/math_object.h: Removed.
6253 * kjs/nodes.cpp:
6254 * kjs/number_object.cpp: Removed.
6255 * kjs/number_object.h: Removed.
6256 * kjs/object_object.cpp:
6257 * kjs/property_map.cpp: Removed.
6258 * kjs/property_map.h: Removed.
6259 * kjs/property_slot.cpp: Removed.
6260 * kjs/property_slot.h: Removed.
6261 * kjs/regexp_object.cpp: Removed.
6262 * kjs/regexp_object.h: Removed.
6263 * kjs/scope_chain.cpp: Removed.
6264 * kjs/scope_chain.h: Removed.
6265 * kjs/scope_chain_mark.h: Removed.
6266 * kjs/string_object.cpp:
6267 * kjs/string_object.h:
6268
6269 2008-06-15 Darin Adler <darin@apple.com>
6270
6271 - new names for a few key JavaScriptCore files
6272
6273 * API/JSBase.cpp:
6274 * API/JSCallbackConstructor.h:
6275 * API/JSCallbackFunction.cpp:
6276 * API/JSCallbackFunction.h:
6277 * API/JSCallbackObject.h:
6278 * API/JSCallbackObjectFunctions.h:
6279 * API/JSClassRef.h:
6280 * API/JSContextRef.cpp:
6281 * API/JSObjectRef.cpp:
6282 * API/JSStringRef.cpp:
6283 * API/JSStringRefCF.cpp:
6284 * API/JSValueRef.cpp:
6285 * GNUmakefile.am:
6286 * JavaScriptCore.pri:
6287 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6288 * JavaScriptCore.xcodeproj/project.pbxproj:
6289 * JavaScriptCoreSources.bkl:
6290 * VM/CodeBlock.cpp:
6291 * VM/CodeGenerator.cpp:
6292 * VM/ExceptionHelpers.cpp:
6293 * VM/ExceptionHelpers.h:
6294 * VM/JSPropertyNameIterator.cpp:
6295 * VM/JSPropertyNameIterator.h:
6296 * VM/Machine.cpp:
6297 * kjs/AllInOneFile.cpp:
6298 * kjs/DateMath.cpp:
6299 * kjs/DebuggerCallFrame.cpp:
6300 * kjs/ExecState.cpp:
6301 * kjs/JSActivation.cpp:
6302 * kjs/JSFunction.cpp: Copied from JavaScriptCore/kjs/function.cpp.
6303 * kjs/JSFunction.h: Copied from JavaScriptCore/kjs/function.h.
6304 * kjs/JSImmediate.cpp:
6305 * kjs/JSNotAnObject.h:
6306 * kjs/JSObject.cpp: Copied from JavaScriptCore/kjs/object.cpp.
6307 * kjs/JSObject.h: Copied from JavaScriptCore/kjs/object.h.
6308 * kjs/JSString.h: Copied from JavaScriptCore/kjs/internal.h.
6309 * kjs/JSValue.cpp: Copied from JavaScriptCore/kjs/value.cpp.
6310 * kjs/JSValue.h: Copied from JavaScriptCore/kjs/value.h.
6311 * kjs/JSVariableObject.h:
6312 * kjs/JSWrapperObject.h:
6313 * kjs/Shell.cpp:
6314 * kjs/SymbolTable.h:
6315 * kjs/array_instance.h:
6316 * kjs/collector.cpp:
6317 * kjs/date_object.cpp:
6318 * kjs/date_object.h:
6319 * kjs/error_object.cpp:
6320 * kjs/function.cpp: Removed.
6321 * kjs/function.h: Removed.
6322 * kjs/function_object.cpp:
6323 * kjs/function_object.h:
6324 * kjs/grammar.y:
6325 * kjs/internal.cpp:
6326 * kjs/internal.h: Removed.
6327 * kjs/lexer.cpp:
6328 * kjs/list.h:
6329 * kjs/lookup.h:
6330 * kjs/nodes.h:
6331 * kjs/object.cpp: Removed.
6332 * kjs/object.h: Removed.
6333 * kjs/object_object.h:
6334 * kjs/operations.cpp:
6335 * kjs/property_map.cpp:
6336 * kjs/property_slot.cpp:
6337 * kjs/property_slot.h:
6338 * kjs/protect.h:
6339 * kjs/regexp_object.cpp:
6340 * kjs/scope_chain.cpp:
6341 * kjs/string_object.h:
6342 * kjs/ustring.cpp:
6343 * kjs/value.cpp: Removed.
6344 * kjs/value.h: Removed.
6345 * profiler/Profile.cpp:
6346 * profiler/Profiler.cpp:
6347
6348 2008-06-15 Darin Adler <darin@apple.com>
6349
6350 Rubber stamped by Sam.
6351
6352 - cut down on confusing uses of "Object" and "Imp" in
6353 JavaScriptCore class names
6354
6355 * API/JSCallbackFunction.cpp:
6356 (KJS::JSCallbackFunction::JSCallbackFunction):
6357 * API/JSCallbackFunction.h:
6358 * VM/Machine.cpp:
6359 (KJS::Machine::privateExecute):
6360 * kjs/ExecState.h:
6361 (KJS::ExecState::regExpTable):
6362 (KJS::ExecState::regExpConstructorTable):
6363 * kjs/JSGlobalData.cpp:
6364 (KJS::JSGlobalData::JSGlobalData):
6365 (KJS::JSGlobalData::~JSGlobalData):
6366 * kjs/JSGlobalData.h:
6367 * kjs/JSGlobalObject.cpp:
6368 (KJS::JSGlobalObject::reset):
6369 * kjs/JSGlobalObject.h:
6370 (KJS::JSGlobalObject::objectConstructor):
6371 (KJS::JSGlobalObject::functionConstructor):
6372 (KJS::JSGlobalObject::arrayConstructor):
6373 (KJS::JSGlobalObject::booleanConstructor):
6374 (KJS::JSGlobalObject::stringConstructor):
6375 (KJS::JSGlobalObject::numberConstructor):
6376 (KJS::JSGlobalObject::dateConstructor):
6377 (KJS::JSGlobalObject::regExpConstructor):
6378 (KJS::JSGlobalObject::errorConstructor):
6379 (KJS::JSGlobalObject::evalErrorConstructor):
6380 (KJS::JSGlobalObject::rangeErrorConstructor):
6381 (KJS::JSGlobalObject::referenceErrorConstructor):
6382 (KJS::JSGlobalObject::syntaxErrorConstructor):
6383 (KJS::JSGlobalObject::typeErrorConstructor):
6384 (KJS::JSGlobalObject::URIErrorConstructor):
6385 * kjs/array_object.cpp:
6386 (KJS::ArrayConstructor::ArrayConstructor):
6387 (KJS::ArrayConstructor::getConstructData):
6388 (KJS::ArrayConstructor::construct):
6389 (KJS::ArrayConstructor::callAsFunction):
6390 * kjs/array_object.h:
6391 * kjs/bool_object.cpp:
6392 (KJS::BooleanObject::BooleanObject):
6393 (KJS::BooleanPrototype::BooleanPrototype):
6394 (KJS::booleanProtoFuncToString):
6395 (KJS::booleanProtoFuncValueOf):
6396 (KJS::BooleanConstructor::BooleanConstructor):
6397 (KJS::BooleanConstructor::getConstructData):
6398 (KJS::BooleanConstructor::construct):
6399 (KJS::BooleanConstructor::callAsFunction):
6400 * kjs/bool_object.h:
6401 * kjs/date_object.cpp:
6402 (KJS::DatePrototype::DatePrototype):
6403 (KJS::DateConstructor::DateConstructor):
6404 (KJS::DateConstructor::getConstructData):
6405 (KJS::DateConstructor::construct):
6406 (KJS::DateConstructor::callAsFunction):
6407 (KJS::DateFunction::DateFunction):
6408 (KJS::DateFunction::callAsFunction):
6409 * kjs/date_object.h:
6410 * kjs/error_object.cpp:
6411 (KJS::ErrorPrototype::ErrorPrototype):
6412 (KJS::ErrorConstructor::ErrorConstructor):
6413 (KJS::ErrorConstructor::getConstructData):
6414 (KJS::ErrorConstructor::construct):
6415 (KJS::ErrorConstructor::callAsFunction):
6416 (KJS::NativeErrorConstructor::NativeErrorConstructor):
6417 (KJS::NativeErrorConstructor::getConstructData):
6418 (KJS::NativeErrorConstructor::construct):
6419 (KJS::NativeErrorConstructor::callAsFunction):
6420 (KJS::NativeErrorConstructor::mark):
6421 * kjs/error_object.h:
6422 * kjs/function.cpp:
6423 (KJS::JSFunction::JSFunction):
6424 (KJS::JSFunction::mark):
6425 (KJS::JSFunction::getOwnPropertySlot):
6426 (KJS::JSFunction::put):
6427 (KJS::JSFunction::deleteProperty):
6428 (KJS::PrototypeFunction::PrototypeFunction):
6429 (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
6430 (KJS::PrototypeReflexiveFunction::mark):
6431 * kjs/function.h:
6432 * kjs/function_object.cpp:
6433 (KJS::functionProtoFuncToString):
6434 (KJS::FunctionConstructor::FunctionConstructor):
6435 (KJS::FunctionConstructor::getConstructData):
6436 (KJS::FunctionConstructor::construct):
6437 (KJS::FunctionConstructor::callAsFunction):
6438 * kjs/function_object.h:
6439 * kjs/internal.cpp:
6440 (KJS::StringObject::create):
6441 (KJS::JSString::toObject):
6442 (KJS::JSString::toThisObject):
6443 (KJS::JSString::getOwnPropertySlot):
6444 (KJS::InternalFunction::InternalFunction):
6445 (KJS::InternalFunction::getCallData):
6446 (KJS::InternalFunction::implementsHasInstance):
6447 * kjs/math_object.cpp:
6448 (KJS::MathObject::MathObject):
6449 (KJS::MathObject::getOwnPropertySlot):
6450 (KJS::MathObject::getValueProperty):
6451 * kjs/math_object.h:
6452 * kjs/number_object.cpp:
6453 (KJS::NumberObject::NumberObject):
6454 (KJS::NumberPrototype::NumberPrototype):
6455 (KJS::numberProtoFuncToString):
6456 (KJS::numberProtoFuncToLocaleString):
6457 (KJS::numberProtoFuncValueOf):
6458 (KJS::numberProtoFuncToFixed):
6459 (KJS::numberProtoFuncToExponential):
6460 (KJS::numberProtoFuncToPrecision):
6461 (KJS::NumberConstructor::NumberConstructor):
6462 (KJS::NumberConstructor::getOwnPropertySlot):
6463 (KJS::NumberConstructor::getValueProperty):
6464 (KJS::NumberConstructor::getConstructData):
6465 (KJS::NumberConstructor::construct):
6466 (KJS::NumberConstructor::callAsFunction):
6467 * kjs/number_object.h:
6468 * kjs/object.cpp:
6469 (KJS::JSObject::putDirectFunction):
6470 * kjs/object.h:
6471 * kjs/object_object.cpp:
6472 (KJS::ObjectConstructor::ObjectConstructor):
6473 (KJS::ObjectConstructor::getConstructData):
6474 (KJS::ObjectConstructor::construct):
6475 (KJS::ObjectConstructor::callAsFunction):
6476 * kjs/object_object.h:
6477 * kjs/regexp.cpp:
6478 (KJS::RegExp::RegExp):
6479 * kjs/regexp_object.cpp:
6480 (KJS::regExpProtoFuncTest):
6481 (KJS::regExpProtoFuncExec):
6482 (KJS::regExpProtoFuncCompile):
6483 (KJS::regExpProtoFuncToString):
6484 (KJS::RegExpObject::RegExpObject):
6485 (KJS::RegExpObject::~RegExpObject):
6486 (KJS::RegExpObject::getOwnPropertySlot):
6487 (KJS::RegExpObject::getValueProperty):
6488 (KJS::RegExpObject::put):
6489 (KJS::RegExpObject::putValueProperty):
6490 (KJS::RegExpObject::match):
6491 (KJS::RegExpObject::test):
6492 (KJS::RegExpObject::exec):
6493 (KJS::RegExpObject::getCallData):
6494 (KJS::RegExpObject::callAsFunction):
6495 (KJS::RegExpConstructorPrivate::RegExpConstructorPrivate):
6496 (KJS::RegExpConstructor::RegExpConstructor):
6497 (KJS::RegExpConstructor::performMatch):
6498 (KJS::RegExpMatchesArray::RegExpMatchesArray):
6499 (KJS::RegExpMatchesArray::~RegExpMatchesArray):
6500 (KJS::RegExpMatchesArray::fillArrayInstance):
6501 (KJS::RegExpConstructor::arrayOfMatches):
6502 (KJS::RegExpConstructor::getBackref):
6503 (KJS::RegExpConstructor::getLastParen):
6504 (KJS::RegExpConstructor::getLeftContext):
6505 (KJS::RegExpConstructor::getRightContext):
6506 (KJS::RegExpConstructor::getOwnPropertySlot):
6507 (KJS::RegExpConstructor::getValueProperty):
6508 (KJS::RegExpConstructor::put):
6509 (KJS::RegExpConstructor::putValueProperty):
6510 (KJS::RegExpConstructor::getConstructData):
6511 (KJS::RegExpConstructor::construct):
6512 (KJS::RegExpConstructor::callAsFunction):
6513 (KJS::RegExpConstructor::input):
6514 * kjs/regexp_object.h:
6515 * kjs/string_object.cpp:
6516 (KJS::StringObject::StringObject):
6517 (KJS::StringObject::getOwnPropertySlot):
6518 (KJS::StringObject::put):
6519 (KJS::StringObject::deleteProperty):
6520 (KJS::StringObject::getPropertyNames):
6521 (KJS::StringPrototype::StringPrototype):
6522 (KJS::StringPrototype::getOwnPropertySlot):
6523 (KJS::replace):
6524 (KJS::stringProtoFuncToString):
6525 (KJS::stringProtoFuncValueOf):
6526 (KJS::stringProtoFuncCharAt):
6527 (KJS::stringProtoFuncCharCodeAt):
6528 (KJS::stringProtoFuncConcat):
6529 (KJS::stringProtoFuncIndexOf):
6530 (KJS::stringProtoFuncLastIndexOf):
6531 (KJS::stringProtoFuncMatch):
6532 (KJS::stringProtoFuncSearch):
6533 (KJS::stringProtoFuncReplace):
6534 (KJS::stringProtoFuncSlice):
6535 (KJS::stringProtoFuncSplit):
6536 (KJS::stringProtoFuncSubstr):
6537 (KJS::stringProtoFuncSubstring):
6538 (KJS::stringProtoFuncToLowerCase):
6539 (KJS::stringProtoFuncToUpperCase):
6540 (KJS::stringProtoFuncToLocaleLowerCase):
6541 (KJS::stringProtoFuncToLocaleUpperCase):
6542 (KJS::stringProtoFuncLocaleCompare):
6543 (KJS::stringProtoFuncBig):
6544 (KJS::stringProtoFuncSmall):
6545 (KJS::stringProtoFuncBlink):
6546 (KJS::stringProtoFuncBold):
6547 (KJS::stringProtoFuncFixed):
6548 (KJS::stringProtoFuncItalics):
6549 (KJS::stringProtoFuncStrike):
6550 (KJS::stringProtoFuncSub):
6551 (KJS::stringProtoFuncSup):
6552 (KJS::stringProtoFuncFontcolor):
6553 (KJS::stringProtoFuncFontsize):
6554 (KJS::stringProtoFuncAnchor):
6555 (KJS::stringProtoFuncLink):
6556 (KJS::StringConstructor::StringConstructor):
6557 (KJS::StringConstructor::getConstructData):
6558 (KJS::StringConstructor::construct):
6559 (KJS::StringConstructor::callAsFunction):
6560 (KJS::StringConstructorFunction::StringConstructorFunction):
6561 (KJS::StringConstructorFunction::callAsFunction):
6562 * kjs/string_object.h:
6563 (KJS::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
6564 * profiler/Profiler.cpp:
6565 (KJS::createCallIdentifier):
6566
6567 2008-06-15 Darin Adler <darin@apple.com>
6568
6569 Rubber stamped by Sam.
6570
6571 - use JS prefix and simpler names for basic JavaScriptCore types,
6572 to complement JSValue and JSObject
6573
6574 * JavaScriptCore.exp:
6575 * VM/Machine.cpp:
6576 (KJS::jsLess):
6577 (KJS::jsLessEq):
6578 (KJS::jsAdd):
6579 (KJS::callEval):
6580 (KJS::Machine::execute):
6581 (KJS::Machine::retrieveArguments):
6582 (KJS::Machine::retrieveCaller):
6583 (KJS::Machine::getCallFrame):
6584 (KJS::Machine::getFunctionAndArguments):
6585 * VM/Machine.h:
6586 * VM/Register.h:
6587 * kjs/DebuggerCallFrame.cpp:
6588 (KJS::DebuggerCallFrame::functionName):
6589 * kjs/ExecState.h:
6590 * kjs/JSActivation.cpp:
6591 (KJS::JSActivation::createArgumentsObject):
6592 * kjs/array_instance.cpp:
6593 (KJS::JSArray::checkConsistency):
6594 (KJS::JSArray::JSArray):
6595 (KJS::JSArray::~JSArray):
6596 (KJS::JSArray::getItem):
6597 (KJS::JSArray::lengthGetter):
6598 (KJS::JSArray::inlineGetOwnPropertySlot):
6599 (KJS::JSArray::getOwnPropertySlot):
6600 (KJS::JSArray::put):
6601 (KJS::JSArray::deleteProperty):
6602 (KJS::JSArray::getPropertyNames):
6603 (KJS::JSArray::increaseVectorLength):
6604 (KJS::JSArray::setLength):
6605 (KJS::JSArray::mark):
6606 (KJS::JSArray::sort):
6607 (KJS::JSArray::compactForSorting):
6608 (KJS::JSArray::lazyCreationData):
6609 (KJS::JSArray::setLazyCreationData):
6610 * kjs/array_instance.h:
6611 * kjs/array_object.cpp:
6612 (KJS::ArrayPrototype::ArrayPrototype):
6613 (KJS::ArrayPrototype::getOwnPropertySlot):
6614 (KJS::arrayProtoFuncToString):
6615 (KJS::arrayProtoFuncToLocaleString):
6616 (KJS::arrayProtoFuncConcat):
6617 (KJS::arrayProtoFuncSort):
6618 (KJS::ArrayObjectImp::construct):
6619 * kjs/array_object.h:
6620 * kjs/completion.h:
6621 * kjs/function.cpp:
6622 (KJS::JSFunction::JSFunction):
6623 (KJS::JSFunction::mark):
6624 (KJS::JSFunction::getCallData):
6625 (KJS::JSFunction::callAsFunction):
6626 (KJS::JSFunction::argumentsGetter):
6627 (KJS::JSFunction::callerGetter):
6628 (KJS::JSFunction::lengthGetter):
6629 (KJS::JSFunction::getOwnPropertySlot):
6630 (KJS::JSFunction::put):
6631 (KJS::JSFunction::deleteProperty):
6632 (KJS::JSFunction::getParameterName):
6633 (KJS::JSFunction::getConstructData):
6634 (KJS::JSFunction::construct):
6635 (KJS::IndexToNameMap::IndexToNameMap):
6636 (KJS::Arguments::Arguments):
6637 * kjs/function.h:
6638 * kjs/function_object.cpp:
6639 (KJS::functionProtoFuncToString):
6640 (KJS::functionProtoFuncApply):
6641 (KJS::FunctionObjectImp::construct):
6642 * kjs/internal.cpp:
6643 (KJS::JSString::toPrimitive):
6644 (KJS::JSString::getPrimitiveNumber):
6645 (KJS::JSString::toBoolean):
6646 (KJS::JSString::toNumber):
6647 (KJS::JSString::toString):
6648 (KJS::StringInstance::create):
6649 (KJS::JSString::toObject):
6650 (KJS::JSString::toThisObject):
6651 (KJS::JSString::lengthGetter):
6652 (KJS::JSString::indexGetter):
6653 (KJS::JSString::indexNumericPropertyGetter):
6654 (KJS::JSString::getOwnPropertySlot):
6655 (KJS::JSNumberCell::type):
6656 (KJS::JSNumberCell::toPrimitive):
6657 (KJS::JSNumberCell::getPrimitiveNumber):
6658 (KJS::JSNumberCell::toBoolean):
6659 (KJS::JSNumberCell::toNumber):
6660 (KJS::JSNumberCell::toString):
6661 (KJS::JSNumberCell::toObject):
6662 (KJS::JSNumberCell::toThisObject):
6663 (KJS::JSNumberCell::getUInt32):
6664 (KJS::JSNumberCell::getTruncatedInt32):
6665 (KJS::JSNumberCell::getTruncatedUInt32):
6666 (KJS::GetterSetter::mark):
6667 (KJS::GetterSetter::toPrimitive):
6668 (KJS::GetterSetter::getPrimitiveNumber):
6669 (KJS::GetterSetter::toBoolean):
6670 (KJS::GetterSetter::toNumber):
6671 (KJS::GetterSetter::toString):
6672 (KJS::GetterSetter::toObject):
6673 (KJS::GetterSetter::getOwnPropertySlot):
6674 (KJS::GetterSetter::put):
6675 (KJS::GetterSetter::toThisObject):
6676 * kjs/internal.h:
6677 (KJS::JSString::JSString):
6678 (KJS::JSString::getStringPropertySlot):
6679 * kjs/nodes.cpp:
6680 (KJS::FuncDeclNode::makeFunction):
6681 (KJS::FuncExprNode::makeFunction):
6682 * kjs/nodes.h:
6683 * kjs/object.cpp:
6684 (KJS::JSObject::put):
6685 (KJS::JSObject::deleteProperty):
6686 (KJS::JSObject::defineGetter):
6687 (KJS::JSObject::defineSetter):
6688 (KJS::JSObject::lookupGetter):
6689 (KJS::JSObject::lookupSetter):
6690 (KJS::JSObject::fillGetterPropertySlot):
6691 * kjs/object.h:
6692 (KJS::GetterSetter::GetterSetter):
6693 * kjs/operations.cpp:
6694 (KJS::equal):
6695 (KJS::strictEqual):
6696 * kjs/property_map.cpp:
6697 (KJS::PropertyMap::containsGettersOrSetters):
6698 * kjs/regexp_object.cpp:
6699 (KJS::RegExpMatchesArray::getOwnPropertySlot):
6700 (KJS::RegExpMatchesArray::put):
6701 (KJS::RegExpMatchesArray::deleteProperty):
6702 (KJS::RegExpMatchesArray::getPropertyNames):
6703 (KJS::RegExpMatchesArray::RegExpMatchesArray):
6704 (KJS::RegExpMatchesArray::fillArrayInstance):
6705 * kjs/string_object.cpp:
6706 (KJS::StringInstance::StringInstance):
6707 (KJS::replace):
6708 (KJS::stringProtoFuncReplace):
6709 (KJS::stringProtoFuncToLowerCase):
6710 (KJS::stringProtoFuncToUpperCase):
6711 (KJS::stringProtoFuncToLocaleLowerCase):
6712 (KJS::stringProtoFuncToLocaleUpperCase):
6713 * kjs/string_object.h:
6714 (KJS::StringInstance::internalValue):
6715 * kjs/value.cpp:
6716 (KJS::JSCell::getNumber):
6717 (KJS::JSCell::getString):
6718 (KJS::JSCell::getObject):
6719 (KJS::jsString):
6720 (KJS::jsOwnedString):
6721 * kjs/value.h:
6722 (KJS::JSNumberCell::JSNumberCell):
6723 (KJS::jsNumberCell):
6724 (KJS::JSValue::uncheckedGetNumber):
6725 * profiler/Profiler.cpp:
6726 (KJS::createCallIdentifier):
6727 (KJS::createCallIdentifierFromFunctionImp):
6728
6729 2008-06-15 Maciej Stachowiak <mjs@apple.com>
6730
6731 Reviewed by Alexey.
6732
6733 - add emitUnaryOp, emitNullaryOp and emitUnaryOpNoDst; use them
6734
6735 This removes some boilerplate code and also reduces the number of
6736 places that will need to be changed to do on-demand emit of
6737 loads (and thus support k operands).
6738
6739 * VM/CodeGenerator.cpp:
6740 (KJS::CodeGenerator::emitUnaryOp):
6741 (KJS::CodeGenerator::emitNullaryOp):
6742 (KJS::CodeGenerator::emitUnaryOpNoDst):
6743 (KJS::CodeGenerator::emitPushScope):
6744 * VM/CodeGenerator.h:
6745 (KJS::CodeGenerator::emitNewObject):
6746 (KJS::CodeGenerator::emitNewArray):
6747 (KJS::CodeGenerator::emitNot):
6748 (KJS::CodeGenerator::emitBitNot):
6749 (KJS::CodeGenerator::emitToJSNumber):
6750 (KJS::CodeGenerator::emitNegate):
6751 (KJS::CodeGenerator::emitInstanceOf):
6752 (KJS::CodeGenerator::emitTypeOf):
6753 (KJS::CodeGenerator::emitIn):
6754 (KJS::CodeGenerator::emitReturn):
6755 (KJS::CodeGenerator::emitEnd):
6756 (KJS::CodeGenerator::emitGetPropertyNames):
6757
6758 2008-06-15 Alp Toker <alp@nuanti.com>
6759
6760 Rubber-stamped by Maciej.
6761
6762 Install 'jsc' application by default.
6763
6764 * GNUmakefile.am:
6765
6766 2008-06-15 Maciej Stachowiak <mjs@apple.com>
6767
6768 Reviewed by Oliver.
6769
6770 - rename testkjs to jsc
6771
6772 * GNUmakefile.am:
6773 * JavaScriptCore.vcproj/JavaScriptCore.sln:
6774 * JavaScriptCore.vcproj/jsc: Added.
6775 * JavaScriptCore.vcproj/jsc/jsc.vcproj: Copied from JavaScriptCore.vcproj/testkjs/testkjs.vcproj.
6776 * JavaScriptCore.vcproj/testkjs: Removed.
6777 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Removed.
6778 * JavaScriptCore.xcodeproj/project.pbxproj:
6779 * jscore.bkl:
6780 * kjs/Shell.cpp: Copied from kjs/testkjs.cpp.
6781 (main):
6782 (printUsageStatement):
6783 (jscmain):
6784 * kjs/jsc.pro: Copied from kjs/testkjs.pro.
6785 * kjs/testkjs.cpp: Removed.
6786 * kjs/testkjs.pro: Removed.
6787 * tests/mozilla/expected.html:
6788 * tests/mozilla/js1_2/Array/tostring_1.js:
6789 * tests/mozilla/js1_2/Array/tostring_2.js:
6790 * tests/mozilla/jsDriver.pl:
6791
6792 2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
6793
6794 Reviewed by Maciej.
6795
6796 Mac build fix.
6797
6798 * JavaScriptCore.xcodeproj/project.pbxproj:
6799 * kjs/nodes.h:
6800
6801 2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
6802
6803 Reviewed by Maciej.
6804
6805 Change the spelling of PrecMultiplicitave to PrecMultiplicative.
6806
6807 * kjs/nodes.h:
6808 (KJS::MultNode::precedence):
6809 (KJS::DivNode::precedence):
6810 (KJS::ModNode::precedence):
6811
6812 2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
6813
6814 Reviewed by Maciej.
6815
6816 Remove unused preprocessor macros related to exceptions in the old
6817 interpreter.
6818
6819 * kjs/nodes.cpp:
6820
6821 2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
6822
6823 Reviewed by Maciej.
6824
6825 Bug 19484: More instructions needs to use temporary registers
6826 <https://bugs.webkit.org/show_bug.cgi?id=19484>
6827
6828 Fix codegen for all binary operations so that temporaries are used if
6829 necessary. This was done by making BinaryOpNode and ReverseBinaryOpNode
6830 subclasses of ExpressionNode, and eliminating the custom emitCode()
6831 methods for the individual node classes.
6832
6833 This only adds 3 new instructions to SunSpider code, and there is no
6834 difference in SunSpider execution time.
6835
6836 * VM/CodeGenerator.cpp:
6837 (KJS::CodeGenerator::emitBitNot):
6838 (KJS::CodeGenerator::emitBinaryOp):
6839 * VM/CodeGenerator.h:
6840 * kjs/grammar.y:
6841 * kjs/nodes.cpp:
6842 (KJS::PreIncResolveNode::emitCode):
6843 (KJS::PreDecResolveNode::emitCode):
6844 (KJS::BinaryOpNode::emitCode):
6845 (KJS::ReverseBinaryOpNode::emitCode):
6846 (KJS::emitReadModifyAssignment):
6847 (KJS::CaseBlockNode::emitCodeForBlock):
6848 * kjs/nodes.h:
6849 (KJS::BinaryOpNode::BinaryOpNode):
6850 (KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
6851 (KJS::MultNode::):
6852 (KJS::DivNode::):
6853 (KJS::DivNode::precedence):
6854 (KJS::ModNode::):
6855 (KJS::ModNode::precedence):
6856 (KJS::AddNode::):
6857 (KJS::AddNode::precedence):
6858 (KJS::SubNode::):
6859 (KJS::SubNode::precedence):
6860 (KJS::LeftShiftNode::):
6861 (KJS::LeftShiftNode::precedence):
6862 (KJS::RightShiftNode::):
6863 (KJS::RightShiftNode::precedence):
6864 (KJS::UnsignedRightShiftNode::):
6865 (KJS::UnsignedRightShiftNode::precedence):
6866 (KJS::LessNode::):
6867 (KJS::LessNode::precedence):
6868 (KJS::GreaterNode::):
6869 (KJS::GreaterNode::precedence):
6870 (KJS::LessEqNode::):
6871 (KJS::LessEqNode::precedence):
6872 (KJS::GreaterEqNode::):
6873 (KJS::GreaterEqNode::precedence):
6874 (KJS::InstanceOfNode::):
6875 (KJS::InstanceOfNode::precedence):
6876 (KJS::InNode::):
6877 (KJS::InNode::precedence):
6878 (KJS::EqualNode::):
6879 (KJS::EqualNode::precedence):
6880 (KJS::NotEqualNode::):
6881 (KJS::NotEqualNode::precedence):
6882 (KJS::StrictEqualNode::):
6883 (KJS::StrictEqualNode::precedence):
6884 (KJS::NotStrictEqualNode::):
6885 (KJS::NotStrictEqualNode::precedence):
6886 (KJS::BitAndNode::):
6887 (KJS::BitAndNode::precedence):
6888 (KJS::BitOrNode::):
6889 (KJS::BitOrNode::precedence):
6890 (KJS::BitXOrNode::):
6891 (KJS::BitXOrNode::precedence):
6892 * kjs/nodes2string.cpp:
6893 (KJS::LessNode::streamTo):
6894 (KJS::GreaterNode::streamTo):
6895 (KJS::LessEqNode::streamTo):
6896 (KJS::GreaterEqNode::streamTo):
6897 (KJS::InstanceOfNode::streamTo):
6898 (KJS::InNode::streamTo):
6899 (KJS::EqualNode::streamTo):
6900 (KJS::NotEqualNode::streamTo):
6901 (KJS::StrictEqualNode::streamTo):
6902 (KJS::NotStrictEqualNode::streamTo):
6903 (KJS::BitAndNode::streamTo):
6904 (KJS::BitXOrNode::streamTo):
6905 (KJS::BitOrNode::streamTo):
6906
6907 2008-06-14 Darin Adler <darin@apple.com>
6908
6909 Rubber stamped by Sam.
6910
6911 - rename a bunch of local symbols within the regular expression code to
6912 follow our usual coding style, and do a few other name tweaks
6913
6914 * pcre/pcre_compile.cpp:
6915 (CompileData::CompileData):
6916 (checkEscape):
6917 (readRepeatCounts):
6918 (compileBranch):
6919 (compileBracket):
6920 (calculateCompiledPatternLength):
6921 (returnError):
6922 (jsRegExpCompile):
6923 * pcre/pcre_exec.cpp:
6924 (MatchStack::MatchStack):
6925 (MatchStack::canUseStackBufferForNextFrame):
6926 (MatchStack::popCurrentFrame):
6927 (match):
6928 (tryFirstByteOptimization):
6929 (tryRequiredByteOptimization):
6930 (jsRegExpExecute):
6931 * pcre/pcre_internal.h:
6932
6933 2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
6934
6935 Reviewed by Darin.
6936
6937 Remove redundant uses of get().
6938
6939 * kjs/nodes.cpp:
6940 (KJS::BracketAccessorNode::emitCode):
6941 (KJS::AddNode::emitCode):
6942 (KJS::SubNode::emitCode):
6943 (KJS::ReadModifyResolveNode::emitCode):
6944 (KJS::AssignDotNode::emitCode):
6945 (KJS::ReadModifyDotNode::emitCode):
6946 (KJS::AssignBracketNode::emitCode):
6947 (KJS::ReadModifyBracketNode::emitCode):
6948
6949 2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
6950
6951 Reviewed by Maciej.
6952
6953 Make code generation not use a temporary for the left-hand side of an
6954 expression if the right-hand side is a local variable.
6955
6956 * VM/CodeGenerator.cpp:
6957 (KJS::CodeGenerator::isLocal):
6958 * VM/CodeGenerator.h:
6959 (KJS::CodeGenerator::leftHandSideNeedsCopy):
6960 (KJS::CodeGenerator::emitNodeForLeftHandSide):
6961 * kjs/nodes.cpp:
6962 (KJS::ResolveNode::isPure):
6963 (KJS::BracketAccessorNode::emitCode):
6964 (KJS::AddNode::emitCode):
6965 (KJS::SubNode::emitCode):
6966 (KJS::ReadModifyResolveNode::emitCode):
6967 (KJS::AssignDotNode::emitCode):
6968 (KJS::ReadModifyDotNode::emitCode):
6969 (KJS::AssignBracketNode::emitCode):
6970 (KJS::ReadModifyBracketNode::emitCode):
6971 * kjs/nodes.h:
6972 (KJS::ExpressionNode::):
6973 (KJS::BooleanNode::):
6974 (KJS::NumberNode::):
6975 (KJS::StringNode::):
6976
6977 2008-06-14 Darin Adler <darin@apple.com>
6978
6979 Reviewed by Sam.
6980
6981 - more of https://bugs.webkit.org/show_bug.cgi?id=17257
6982 start ref counts at 1 instead of 0 for speed
6983
6984 * kjs/nodes.cpp:
6985 (KJS::ParserRefCounted::hasOneRef): Added. Replaces refcount.
6986 * kjs/nodes.h: Replaced refcount with hasOneRef.
6987
6988 * wtf/ListRefPtr.h:
6989 (WTF::ListRefPtr::~ListRefPtr): Changed to use hasOneRef instead of
6990 refcount, so this class can be used with the RefCounted template.
6991
6992 * wtf/RefCounted.h:
6993 (WTF::RefCounted::hasOneRef): Made const, since there's no reason for
6994 it to be non-const.
6995
6996 2008-06-14 Maciej Stachowiak <mjs@apple.com>
6997
6998 Reviewed by Oliver.
6999
7000 - initialize local vars as side effect of call instead of in bytecode
7001 1.004x speedup on SunSpider.
7002
7003 This removes just the dispatch overhead for these loads - in the
7004 future, dead store elimination might be able to eliminate them
7005 entirely.
7006
7007 * VM/CodeGenerator.cpp:
7008 (KJS::CodeGenerator::CodeGenerator): For function blocks, don't
7009 emit loads of undefined for var initialization.
7010 * VM/Machine.cpp:
7011 (KJS::slideRegisterWindowForCall): Instead, initialize locals
7012 as part of the call.
7013
7014 2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7015
7016 Reviewed by Oliver.
7017
7018 Remove helper functions in the parser that are no longer needed.
7019
7020 * kjs/grammar.y:
7021
7022 2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7023
7024 Reviewed by Oliver.
7025
7026 Bug 19484: More instructions needs to use temporary registers
7027 <https://bugs.webkit.org/show_bug.cgi?id=19484>
7028
7029 Make code generation for AddNode and SubNode use temporaries when
7030 necessary.
7031
7032 * kjs/grammar.y:
7033 * kjs/nodes.cpp:
7034 (KJS::AddNode::emitCode):
7035 (KJS::SubNode::emitCode):
7036 * kjs/nodes.h:
7037 (KJS::AddNode::):
7038 (KJS::SubNode::):
7039
7040 2008-06-13 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7041
7042 Reviewed by Maciej.
7043
7044 Combine TrueNode and FalseNode to make BooleanNode, and remove the
7045 unused class PlaceholderTrueNode.
7046
7047 * kjs/grammar.y:
7048 * kjs/nodes.cpp:
7049 (KJS::BooleanNode::emitCode):
7050 * kjs/nodes.h:
7051 (KJS::BooleanNode::):
7052 (KJS::BooleanNode::precedence):
7053 * kjs/nodes2string.cpp:
7054 (KJS::BooleanNode::streamTo):
7055
7056 2008-06-13 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7057
7058 Reviewed by Maciej.
7059
7060 Eliminate the use of temporaries to store the left hand side of an
7061 expression when the right hand side is a constant. This slightly
7062 improves the generated bytecode for a few SunSpider tests, but it is
7063 mostly in preparation for fixing
7064
7065 Bug 19484: More instructions needs to use temporary registers
7066 <https://bugs.webkit.org/show_bug.cgi?id=19484>
7067
7068 * VM/CodeGenerator.h:
7069 (KJS::CodeGenerator::leftHandSideNeedsCopy):
7070 (KJS::CodeGenerator::emitNodeForLeftHandSide):
7071 * kjs/nodes.cpp:
7072 (KJS::BracketAccessorNode::emitCode):
7073 (KJS::ReadModifyResolveNode::emitCode):
7074 (KJS::AssignDotNode::emitCode):
7075 (KJS::ReadModifyDotNode::emitCode):
7076 (KJS::AssignBracketNode::emitCode):
7077 (KJS::ReadModifyBracketNode::emitCode):
7078 * kjs/nodes.h:
7079 (KJS::ExpressionNode::):
7080 (KJS::FalseNode::):
7081 (KJS::TrueNode::):
7082 (KJS::NumberNode::):
7083 (KJS::StringNode::):
7084
7085 2008-06-13 Maciej Stachowiak <mjs@apple.com>
7086
7087 Reviewed by Oliver.
7088
7089 - prettify opcode stats output
7090
7091 I changed things to be a bit more aligned, also there is a new
7092 section listing most common opcodes and most common sequences that
7093 include them.
7094
7095 * VM/Opcode.cpp:
7096 (KJS::OpcodeStats::~OpcodeStats):
7097 * VM/Opcode.h:
7098
7099 2008-06-13 Kevin McCullough <kmccullough@apple.com>
7100
7101 Reviewed by Geoff.
7102
7103 <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
7104 profiler.
7105 - Remove recursion from exclude(). This leaves only focus() to fix.
7106
7107 * JavaScriptCore.exp: Change the signatures of the exported functions.
7108 * profiler/Profile.cpp:
7109 (KJS::Profile::forEach): I added a traverseNextNodePreOrder() function
7110 and so needed to distinguish the other function by labeling it
7111 traverseNextNodePostOrder().
7112 (KJS::Profile::exclude): All new exclude that iteratively walks the tree
7113 * profiler/Profile.h:
7114 (KJS::Profile::focus): Add a null check for m_head.
7115 * profiler/ProfileNode.cpp:
7116 (KJS::ProfileNode::traverseNextNodePostOrder): Renamed
7117 (KJS::ProfileNode::traverseNextNodePreOrder): Walks the tree in pre-
7118 order, where the parent is processed before the children.
7119 (KJS::ProfileNode::setTreeVisible): Iterate over the sub-tree and set
7120 all of the nodes visible value. This changes another function that used
7121 recursion.
7122 (KJS::ProfileNode::exclude): Remove recursion from this function.
7123 Because we now check for m_visible and we are walking the tree in pre-
7124 order we do not need to check if an excluded node is in an excluded
7125 sub-tree.
7126 * profiler/ProfileNode.h: Added specific selfTime functions to
7127 facilitate exclude().
7128 (KJS::ProfileNode::setSelfTime):
7129 (KJS::ProfileNode::setActualSelfTime):
7130 (KJS::ProfileNode::setVisibleSelfTime):
7131
7132 2008-06-12 Darin Adler <darin@apple.com>
7133
7134 Reviewed by Maciej.
7135
7136 - https://bugs.webkit.org/show_bug.cgi?id=19434
7137 speed up SunSpider by avoiding some string boxing
7138
7139 Speeds up SunSpider by 1.1%.
7140
7141 Optimized code path for getting built-in properties from strings -- avoid
7142 boxing with a string object in that case. We can make further changes to avoid
7143 even more boxing, but this change alone is a win.
7144
7145 * API/JSCallbackObjectFunctions.h:
7146 (KJS::JSCallbackObject::staticValueGetter): Use isObject instead of inherits
7147 in asssert, since the type of slotBase() is now JSValue, not JSObject.
7148 (KJS::JSCallbackObject::staticFunctionGetter): Ditto.
7149 (KJS::JSCallbackObject::callbackGetter): Ditto.
7150
7151 * kjs/internal.cpp:
7152 (KJS::StringImp::getPrimitiveNumber): Updated for change of data member name.
7153 (KJS::StringImp::toBoolean): Ditto.
7154 (KJS::StringImp::toNumber): Ditto.
7155 (KJS::StringImp::toString): Ditto.
7156 (KJS::StringInstance::create): Added; avoids a bit of cut and paste code.
7157 (KJS::StringImp::toObject): Use StringInstance::create.
7158 (KJS::StringImp::toThisObject): Ditto.
7159 (KJS::StringImp::lengthGetter): Added. Replaces the getter that used to live in
7160 the StringInstance class.
7161 (KJS::StringImp::indexGetter): Ditto.
7162 (KJS::StringImp::indexNumericPropertyGetter): Ditto.
7163 (KJS::StringImp::getOwnPropertySlot): Added. Deals with built in properties of
7164 the string class without creating a StringInstance.
7165
7166 * kjs/internal.h:
7167 (KJS::StringImp::getStringPropertySlot): Added. To be used by both the string
7168 and string object getOwnPropertySlot function.
7169
7170 * kjs/lookup.h:
7171 (KJS::staticFunctionGetter): Updated since slotBase() is now a JSValue rather
7172 than a JSObject.
7173
7174 * kjs/object.h: Removed PropertySlot::slotBase() function, which can now move
7175 back into property_slot.h where it belongs since it doesn't have to cast to
7176 JSObject*.
7177
7178 * kjs/property_slot.cpp:
7179 (KJS::PropertySlot::functionGetter): Updated since slot.slotBase() is now a JSValue*
7180 instead of JSObject*. setGetterSlot still guarantees the base is a JSObject*.
7181 * kjs/property_slot.h:
7182 (KJS::PropertySlot::PropertySlot): Changed base to JSValue* intead of JSCell*.
7183 (KJS::PropertySlot::setStaticEntry): Ditto.
7184 (KJS::PropertySlot::setCustom): Ditto.
7185 (KJS::PropertySlot::setCustomIndex): Ditto.
7186 (KJS::PropertySlot::setCustomNumeric): Ditto.
7187 (KJS::PropertySlot::slotBase): Moved inline here since it no longer involves a
7188 downcast to JSObject*.
7189 (KJS::PropertySlot::setBase): Changed to JSValue*.
7190
7191 * kjs/string_object.cpp:
7192 (KJS::StringInstance::getOwnPropertySlot): Changed to use getStringPropertySlot
7193 instead of coding the properties here. This allows sharing the code with StringImp.
7194
7195 * kjs/string_object.h: Removed inlineGetOwnPropertySlot, lengthGetter, and indexGetter.
7196 Made one of the constructors protected.
7197
7198 * kjs/value.h: Made getOwnPropertySlot private in the JSCell class -- this is better
7199 since it's not the real JSObject getOwnPropertySlot semantic and most callers shouldn't
7200 use it.
7201
7202 2008-06-12 Alexey Proskuryakov <ap@webkit.org>
7203
7204 Reviewed by Maciej.
7205
7206 Preparation to making JavaScript heap per-thread.
7207
7208 * kjs/collector.cpp:
7209 (KJS::Collector::collect):
7210 * kjs/collector.h:
7211 (KJS::Collector::markListSet):
7212 The collector now holds the list of protected lists itself, to be made per-instance.
7213
7214 * kjs/list.h: Changed to hold a pointer to a mark set this list is in, if any.
7215 (KJS::List::List): Explicitly initialize m_size with zero, as m_vector.size() is
7216 guaranteed to be such anyway.
7217 (KJS::List::append): Changed the fast case to only be executed as long as inline buffer
7218 is used, because otherwise, we now do more expensive checks.
7219
7220 * kjs/list.cpp:
7221 (KJS::List::markLists): Renamed from markProtectedListsSlowCase, made it take the list set
7222 as a parameter.
7223 (KJS::List::slowAppend): If a non-immediate value is appended, the list needs to be added
7224 to an appropriate Heap's protected list. For now, a static Collector::markListSet() is
7225 used, but the code is layed out in preparation to making the switch to multiple heaps.
7226
7227 * JavaScriptCore.exp: Updated export list.
7228
7229 2008-06-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7230
7231 Reviewed by Maciej.
7232
7233 Bug 19510: CodeBlock::needsFullScopeChain not always set for global code
7234 <https://bugs.webkit.org/show_bug.cgi?id=19510>
7235
7236 This fixes the symptoms by using CodeGenerator::m_codeType to determine
7237 when to use temporaries instead of CodeBlock::needsFullScopeChain, but
7238 it does not fix the problem itself.
7239
7240 * VM/CodeGenerator.h:
7241 (KJS::CodeGenerator::leftHandSideNeedsCopy):
7242
7243 2008-06-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7244
7245 Reviewed by Maciej.
7246
7247 Bug 19498: REGRESSION (r34497): crash while loading GMail
7248 <https://bugs.webkit.org/show_bug.cgi?id=19498>
7249
7250 * VM/CodeGenerator.cpp:
7251 (KJS::CodeGenerator::emitJumpIfTrueMayCombine):
7252 (KJS::CodeGenerator::emitJumpIfTrue):
7253 * VM/CodeGenerator.h:
7254 * kjs/nodes.cpp:
7255 (KJS::DoWhileNode::emitCode):
7256 (KJS::WhileNode::emitCode):
7257 (KJS::ForNode::emitCode):
7258 (KJS::CaseBlockNode::emitCodeForBlock):
7259
7260 2008-06-11 Darin Adler <darin@apple.com>
7261
7262 Reviewed by Maciej.
7263
7264 - a little bit of cleanup and prep for some upcoming optimizations
7265
7266 * JavaScriptCore.exp: Re-sorted this file (with sort command line tool).
7267 * VM/CodeBlock.cpp:
7268 (KJS::CodeBlock::dump): Fixed printf to avoid warnings -- to use %lu we
7269 need to make sure the type is unsigned long.
7270 * kjs/object.cpp:
7271 (KJS::Error::create): Eliminated unused error names array, and also put
7272 the strings into the code since there was already a switch statment.
7273 This also avoids having to contemplate a hypothetical access past the
7274 end of the array.
7275 * kjs/object.h: Got rid of errorNames.
7276 * kjs/property_slot.cpp: Deleted unused ungettableGetter.
7277 * kjs/property_slot.h: Ditto.
7278 * wtf/AlwaysInline.h: Added LIKELY alongside UNLIKELY.
7279
7280 2008-06-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7281
7282 Reviewed by Darin.
7283
7284 Bug 19457: Create fused opcodes for tests and conditional jumps
7285 <https://bugs.webkit.org/show_bug.cgi?id=19457>
7286
7287 Add a new jless instruction, and modify the code generator to emit it
7288 instead of the pair (less, jtrue).
7289
7290 Gives a 3.6% improvement on SunSpider.
7291
7292 * VM/CodeBlock.cpp:
7293 (KJS::CodeBlock::dump):
7294 * VM/CodeGenerator.cpp:
7295 (KJS::CodeGenerator::CodeGenerator):
7296 (KJS::CodeGenerator::emitOpcode):
7297 (KJS::CodeGenerator::retrieveLastBinaryOp):
7298 (KJS::CodeGenerator::rewindBinaryOp):
7299 (KJS::CodeGenerator::emitJump):
7300 (KJS::CodeGenerator::emitJumpIfTrue):
7301 (KJS::CodeGenerator::emitJumpIfFalse):
7302 (KJS::CodeGenerator::emitMove):
7303 (KJS::CodeGenerator::emitNot):
7304 (KJS::CodeGenerator::emitEqual):
7305 (KJS::CodeGenerator::emitNotEqual):
7306 (KJS::CodeGenerator::emitStrictEqual):
7307 (KJS::CodeGenerator::emitNotStrictEqual):
7308 (KJS::CodeGenerator::emitLess):
7309 (KJS::CodeGenerator::emitLessEq):
7310 (KJS::CodeGenerator::emitPreInc):
7311 (KJS::CodeGenerator::emitPreDec):
7312 (KJS::CodeGenerator::emitPostInc):
7313 (KJS::CodeGenerator::emitPostDec):
7314 (KJS::CodeGenerator::emitToJSNumber):
7315 (KJS::CodeGenerator::emitNegate):
7316 (KJS::CodeGenerator::emitAdd):
7317 (KJS::CodeGenerator::emitMul):
7318 (KJS::CodeGenerator::emitDiv):
7319 (KJS::CodeGenerator::emitMod):
7320 (KJS::CodeGenerator::emitSub):
7321 (KJS::CodeGenerator::emitLeftShift):
7322 (KJS::CodeGenerator::emitRightShift):
7323 (KJS::CodeGenerator::emitUnsignedRightShift):
7324 (KJS::CodeGenerator::emitBitAnd):
7325 (KJS::CodeGenerator::emitBitXOr):
7326 (KJS::CodeGenerator::emitBitOr):
7327 (KJS::CodeGenerator::emitBitNot):
7328 (KJS::CodeGenerator::emitInstanceOf):
7329 (KJS::CodeGenerator::emitTypeOf):
7330 (KJS::CodeGenerator::emitIn):
7331 (KJS::CodeGenerator::emitLoad):
7332 (KJS::CodeGenerator::emitNewObject):
7333 (KJS::CodeGenerator::emitNewArray):
7334 (KJS::CodeGenerator::emitResolve):
7335 (KJS::CodeGenerator::emitGetScopedVar):
7336 (KJS::CodeGenerator::emitPutScopedVar):
7337 (KJS::CodeGenerator::emitResolveBase):
7338 (KJS::CodeGenerator::emitResolveWithBase):
7339 (KJS::CodeGenerator::emitResolveFunction):
7340 (KJS::CodeGenerator::emitGetById):
7341 (KJS::CodeGenerator::emitPutById):
7342 (KJS::CodeGenerator::emitPutGetter):
7343 (KJS::CodeGenerator::emitPutSetter):
7344 (KJS::CodeGenerator::emitDeleteById):
7345 (KJS::CodeGenerator::emitGetByVal):
7346 (KJS::CodeGenerator::emitPutByVal):
7347 (KJS::CodeGenerator::emitDeleteByVal):
7348 (KJS::CodeGenerator::emitPutByIndex):
7349 (KJS::CodeGenerator::emitNewFunction):
7350 (KJS::CodeGenerator::emitNewRegExp):
7351 (KJS::CodeGenerator::emitNewFunctionExpression):
7352 (KJS::CodeGenerator::emitCall):
7353 (KJS::CodeGenerator::emitReturn):
7354 (KJS::CodeGenerator::emitEnd):
7355 (KJS::CodeGenerator::emitConstruct):
7356 (KJS::CodeGenerator::emitPushScope):
7357 (KJS::CodeGenerator::emitPopScope):
7358 (KJS::CodeGenerator::emitDebugHook):
7359 (KJS::CodeGenerator::emitComplexJumpScopes):
7360 (KJS::CodeGenerator::emitJumpScopes):
7361 (KJS::CodeGenerator::emitNextPropertyName):
7362 (KJS::CodeGenerator::emitGetPropertyNames):
7363 (KJS::CodeGenerator::emitCatch):
7364 (KJS::CodeGenerator::emitThrow):
7365 (KJS::CodeGenerator::emitNewError):
7366 (KJS::CodeGenerator::emitJumpSubroutine):
7367 (KJS::CodeGenerator::emitSubroutineReturn):
7368 * VM/CodeGenerator.h:
7369 * VM/Machine.cpp:
7370 (KJS::Machine::privateExecute):
7371 * VM/Opcode.cpp:
7372 * VM/Opcode.h:
7373
7374 2008-06-11 Darin Adler <darin@apple.com>
7375
7376 Reviewed by Alexey.
7377
7378 - fix https://bugs.webkit.org/show_bug.cgi?id=19442
7379 JavaScript array implementation doesn't maintain m_numValuesInVector when sorting
7380
7381 * kjs/array_instance.cpp:
7382 (KJS::ArrayInstance::checkConsistency): Added. Empty inline version for when
7383 consistency checks are turned off.
7384 (KJS::ArrayInstance::ArrayInstance): Check consistency after construction.
7385 (KJS::ArrayInstance::~ArrayInstance): Check consistency before destruction.
7386 (KJS::ArrayInstance::put): Check consistency before and after.
7387 (KJS::ArrayInstance::deleteProperty): Ditto.
7388 (KJS::ArrayInstance::setLength): Ditto.
7389 (KJS::compareByStringPairForQSort): Use typedef for clarity.
7390 (KJS::ArrayInstance::sort): Check consistency before and after. Also broke the loop
7391 to set up sorting into two separate passes. Added FIXMEs about various exception
7392 safety issues. Added code to set m_numValuesInVector after sorting.
7393 (KJS::ArrayInstance::compactForSorting): Ditto.
7394
7395 * kjs/array_instance.h: Added a definition of an enum for the types of consistency
7396 check and a declaration of the consistency checking function.
7397
7398 2008-06-10 Kevin Ollivier <kevino@theolliviers.com>
7399
7400 wx build fix. Link against libedit on Mac since HAVE(READLINE) is defined there.
7401
7402 * jscore.bkl:
7403
7404 2008-06-10 Alexey Proskuryakov <ap@webkit.org>
7405
7406 Reviewed by Darin.
7407
7408 https://bugs.webkit.org/show_bug.cgi?id=16503
7409 match limit takes at least 13% of the time on the SunSpider regexp-dna test
7410
7411 Make the limit test slightly more efficient. It is not clear how much of a win it is,
7412 as the improvement on regexp-dna varies from 2.3% to 0.6% depending on what revision I
7413 apply the patch to. Today, the win on regexp-dna was minimal, but the total win was whopping
7414 0.5%, due to random code generation changes.
7415
7416 * pcre/pcre_exec.cpp: (match): Avoid loading a constant on each iteration.
7417
7418 2008-06-09 Alp Toker <alp@nuanti.com>
7419
7420 gcc3/autotools build fix. Add explicit -O2 -fno-strict-aliasing to
7421 each of the tools since these are no longer set globally.
7422
7423 * GNUmakefile.am:
7424
7425 2008-06-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7426
7427 Reviewed by Sam.
7428
7429 Add an include for readline/history.h to fix the build for Darwin users
7430 with the GNU readline library installed. Also, clean up the style of
7431 the HAVE(READLINE) check.
7432
7433 * kjs/testkjs.cpp:
7434 (runInteractive):
7435
7436 2008-06-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7437
7438 Reviewed by Darin.
7439
7440 Bug 17531: Add interactive mode to testkjs
7441 <https://bugs.webkit.org/show_bug.cgi?id=17531>
7442
7443 This is a cleaned up version of Sam's earlier patch to add an
7444 interactive mode to testkjs.
7445
7446 Readline support is only enabled on Darwin platforms for now, but
7447 other ports can enable it by defining HAVE_READLINE in kjs/config.h.
7448
7449 * JavaScriptCore.xcodeproj/project.pbxproj:
7450 * kjs/config.h:
7451 * kjs/testkjs.cpp:
7452 (Options::Options):
7453 (runWithScripts):
7454 (runInteractive):
7455 (printUsageStatement):
7456 (parseArguments):
7457 (kjsmain):
7458
7459 2008-06-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7460
7461 Reviewed by Darin.
7462
7463 Bug 19346: REGRESSION: Mootools 1.2 Class inheritance broken in post-SquirrelFish merge
7464 <https://bugs.webkit.org/show_bug.cgi?id=19346>
7465
7466 A check for whether a function's caller is eval code accidentally included
7467 the case where the caller's caller is native code. Add a CodeType field to
7468 CodeBlock and use this for the eval caller test instead.
7469
7470 * VM/CodeBlock.h:
7471 (KJS::CodeBlock::CodeBlock):
7472 (KJS::ProgramCodeBlock::ProgramCodeBlock):
7473 (KJS::EvalCodeBlock::EvalCodeBlock):
7474 * VM/Machine.cpp:
7475 (KJS::getCallerFunctionOffset):
7476 * kjs/nodes.cpp:
7477 (KJS::FunctionBodyNode::generateCode):
7478 (KJS::ProgramNode::generateCode):
7479
7480 2008-06-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7481
7482 Reviewed by Dan Bernstein.
7483
7484 Bug 17928: testkjs shouldn't require "-f"
7485 <https://bugs.webkit.org/show_bug.cgi?id=17928>
7486
7487 * kjs/testkjs.cpp:
7488 (printUsageStatement):
7489 (parseArguments):
7490
7491 2008-06-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7492
7493 Reviewed by Eric.
7494
7495 Bug 17548: JavaScriptCore print(a, b) differs from Spidermonkey Behavior
7496 <https://bugs.webkit.org/show_bug.cgi?id=17548>
7497
7498 * kjs/testkjs.cpp:
7499 (functionPrint):
7500
7501 2008-06-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7502
7503 Reviewed by Sam.
7504
7505 Bug 17547: JavaScriptCore print() differs from Spidermonkey Behavior
7506 <https://bugs.webkit.org/show_bug.cgi?id=17547>
7507
7508 * kjs/testkjs.cpp:
7509 (functionPrint):
7510
7511 2008-06-07 Alexey Proskuryakov <ap@webkit.org>
7512
7513 More build fixes.
7514
7515 * kjs/JSGlobalData.cpp: Fixed an included file name for case-sensitive file systems, fixed
7516 JSGlobalData::threadInstance() for non-multithreaded builds.
7517
7518 2008-06-07 Alexey Proskuryakov <ap@webkit.org>
7519
7520 Build fix - actually adding JSGlobalData.cpp to non-Mac builds!
7521
7522 * GNUmakefile.am:
7523 * JavaScriptCore.pri:
7524 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7525 * JavaScriptCoreSources.bkl:
7526
7527 2008-06-07 Alexey Proskuryakov <ap@webkit.org>
7528
7529 Try to fix Gtk/gcc 4.3 build.
7530
7531 * kjs/JSGlobalData.h: Include ustring.h instead of forward-declaring UString::Rep.
7532
7533 2008-06-06 Alexey Proskuryakov <ap@webkit.org>
7534
7535 Reviewed by Darin.
7536
7537 Combine per-thread objects into one, to make it easier to support legacy clients (for
7538 which they shouldn't be really per-thread).
7539
7540 No change on SunSpider total.
7541
7542 * JavaScriptCore.xcodeproj/project.pbxproj: Added JSGlobalData.{h,cpp}
7543
7544 * kjs/JSGlobalData.cpp: Added.
7545 (KJS::JSGlobalData::JSGlobalData):
7546 (KJS::JSGlobalData::~JSGlobalData):
7547 (KJS::JSGlobalData::threadInstance):
7548 * kjs/JSGlobalData.h: Added.
7549 This class encapsulates all data that should be per-thread (or shared between legacy clients).
7550 It will also keep a Heap pointer, but right now, Heap (Collector) methods are all static.
7551
7552 * kjs/identifier.h:
7553 (KJS::Identifier::Identifier):
7554 Added a constructor explicitly taking JSGlobalData to access IdentifierTable. Actually,
7555 all of them should, but this will be a separate patch.
7556
7557 * kjs/identifier.cpp:
7558 (KJS::IdentifierTable::literalTable):
7559 (KJS::createIdentifierTable):
7560 (KJS::deleteIdentifierTable):
7561 (KJS::Identifier::add):
7562 (KJS::Identifier::addSlowCase):
7563 Combined IdentifierTable and LiteralIdentifierTable into a single class for simplicity.
7564
7565 * kjs/grammar.y: kjsyyparse now takes JSGlobalData, not just a Lexer.
7566
7567 * kjs/nodes.cpp:
7568 (KJS::Node::Node):
7569 (KJS::EvalFunctionCallNode::emitCode):
7570 (KJS::ScopeNode::ScopeNode):
7571 Changed to access Lexer and Parser via JSGlobalData::threadInstance(). This is also a
7572 temporary measure, they will need to use JSGlobalData explicitly.
7573
7574 * VM/CodeGenerator.cpp:
7575 (KJS::CodeGenerator::CodeGenerator):
7576 * VM/CodeGenerator.h:
7577 * VM/Machine.cpp:
7578 (KJS::callEval):
7579 * kjs/CommonIdentifiers.cpp:
7580 (KJS::CommonIdentifiers::CommonIdentifiers):
7581 * kjs/CommonIdentifiers.h:
7582 * kjs/DebuggerCallFrame.cpp:
7583 (KJS::DebuggerCallFrame::evaluate):
7584 * kjs/ExecState.cpp:
7585 (KJS::ExecState::ExecState):
7586 * kjs/ExecState.h:
7587 (KJS::ExecState::globalData):
7588 (KJS::ExecState::identifierTable):
7589 (KJS::ExecState::propertyNames):
7590 (KJS::ExecState::emptyList):
7591 (KJS::ExecState::lexer):
7592 (KJS::ExecState::parser):
7593 (KJS::ExecState::arrayTable):
7594 (KJS::ExecState::dateTable):
7595 (KJS::ExecState::mathTable):
7596 (KJS::ExecState::numberTable):
7597 (KJS::ExecState::RegExpImpTable):
7598 (KJS::ExecState::RegExpObjectImpTable):
7599 (KJS::ExecState::stringTable):
7600 * kjs/InitializeThreading.cpp:
7601 (KJS::initializeThreadingOnce):
7602 * kjs/JSGlobalObject.cpp:
7603 (KJS::JSGlobalObject::init):
7604 * kjs/JSGlobalObject.h:
7605 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
7606 (KJS::JSGlobalObject::head):
7607 (KJS::JSGlobalObject::globalData):
7608 * kjs/Parser.cpp:
7609 (KJS::Parser::parse):
7610 * kjs/Parser.h:
7611 * kjs/function.cpp:
7612 (KJS::FunctionImp::getParameterName):
7613 (KJS::IndexToNameMap::unMap):
7614 (KJS::globalFuncEval):
7615 * kjs/function_object.cpp:
7616 (KJS::FunctionObjectImp::construct):
7617 * kjs/interpreter.cpp:
7618 (KJS::Interpreter::checkSyntax):
7619 (KJS::Interpreter::evaluate):
7620 * kjs/lexer.cpp:
7621 (kjsyylex):
7622 * kjs/lexer.h:
7623 * kjs/testkjs.cpp:
7624 (prettyPrintScript):
7625 Updated for the above changes. Most of threadInstance uses here will need to be replaced with
7626 explicitly passed pointers to support legacy JSC clients.
7627
7628 * JavaScriptCore.exp: Removed KJS::parser().
7629
7630 2008-06-06 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7631
7632 Reviewed by Oliver.
7633
7634 Bug 19424: Add support for logging opcode pair counts
7635 <https://bugs.webkit.org/show_bug.cgi?id=19424>
7636
7637 * VM/Machine.cpp:
7638 (KJS::Machine::privateExecute):
7639 * VM/Opcode.cpp:
7640 (KJS::OpcodeStats::OpcodeStats):
7641 (KJS::compareOpcodeIndices):
7642 (KJS::compareOpcodePairIndices):
7643 (KJS::OpcodeStats::~OpcodeStats):
7644 (KJS::OpcodeStats::recordInstruction):
7645 (KJS::OpcodeStats::resetLastInstruction):
7646 * VM/Opcode.h:
7647
7648 2008-06-06 Kevin McCullough <kmccullough@apple.com>
7649
7650 Reviewed by Adam.
7651
7652 <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
7653 profiler.
7654 - Change the remaining functions that do not take arguments, from using
7655 recursion to using iteration.
7656
7657 * JavaScriptCore.exp:
7658 * profiler/Profile.cpp:
7659 (KJS::stopProfiling):
7660 (KJS::restoreAll):
7661 (KJS::Profile::stopProfiling): Use foreach instead of recursion.
7662 (KJS::Profile::restoreAll): Ditto.
7663 * profiler/Profile.h:
7664 * profiler/ProfileNode.cpp: Remove recursion.
7665 (KJS::ProfileNode::stopProfiling):
7666 (KJS::ProfileNode::restore):
7667 * profiler/ProfileNode.h:
7668
7669 2008-06-05 Oliver Hunt <oliver@apple.com>
7670
7671 Reviewed by Alexey.
7672
7673 Fix Greater and GreaterEq nodes to emit code for the left
7674 and right sub-expressions in the correct order.
7675
7676 * kjs/nodes.cpp:
7677 (KJS::GreaterNode::emitCode):
7678 (KJS::GreaterEqNode::emitCode):
7679
7680 2008-06-05 Antti Koivisto <antti@apple.com>
7681
7682 Reviewed by Alp Toker.
7683
7684 Fix whitespaces.
7685
7686 * kjs/collector.cpp:
7687 (KJS::getPlatformThreadRegisters):
7688
7689 2008-06-05 Antti Koivisto <antti@apple.com>
7690
7691 Reviewed by Darin.
7692
7693 Support compiling JavaScriptCore for ARM.
7694
7695 * kjs/collector.cpp:
7696 (KJS::getPlatformThreadRegisters):
7697 (KJS::otherThreadStackPointer):
7698
7699 2008-06-05 Kevin McCullough <kmccullough@apple.com>
7700
7701 Reviewed by Jon.
7702
7703 - Name changes.
7704
7705 * JavaScriptCore.exp:
7706 * profiler/Profile.cpp:
7707 (KJS::Profile::Profile):
7708 (KJS::Profile::stopProfiling):
7709 (KJS::Profile::didExecute):
7710 (KJS::Profile::forEach):
7711 (KJS::Profile::debugPrintData):
7712 (KJS::Profile::debugPrintDataSampleStyle):
7713 * profiler/Profile.h:
7714 (KJS::Profile::callTree):
7715 (KJS::Profile::totalTime):
7716 (KJS::Profile::sortTotalTimeDescending):
7717 (KJS::Profile::sortTotalTimeAscending):
7718 (KJS::Profile::sortSelfTimeDescending):
7719 (KJS::Profile::sortSelfTimeAscending):
7720 (KJS::Profile::sortCallsDescending):
7721 (KJS::Profile::sortCallsAscending):
7722 (KJS::Profile::sortFunctionNameDescending):
7723 (KJS::Profile::sortFunctionNameAscending):
7724 (KJS::Profile::focus):
7725 (KJS::Profile::exclude):
7726 (KJS::Profile::restoreAll):
7727
7728 2008-06-05 Geoffrey Garen <ggaren@apple.com>
7729
7730 Reviewed by Stephanie Lewis.
7731
7732 Added the -fno-move-loop-invariants flag to the pcre_exec.cpp build, to
7733 tell GCC not to perform loop invariant motion, since GCC's loop
7734 invariant motion doesn't do very well with computed goto code.
7735
7736 SunSpider reports no change.
7737
7738 2008-06-05 Geoffrey Garen <ggaren@apple.com>
7739
7740 Reviewed by Stephanie Lewis.
7741
7742 Added the -fno-tree-pre flag to the Machine.cpp build, to tell GCC not
7743 to perform Partial Redundancy Elimination (PRE) on trees in Machine.cpp,
7744 since GCC's PRE doesn't do very well with computed goto code.
7745
7746 SunSpider reports a .7% speedup.
7747
7748 2008-06-05 Geoffrey Garen <ggaren@apple.com>
7749
7750 Reviewed by Stephanie Lewis (or maybe the other way around).
7751
7752 Minor change to PCRE to help out certain compilers.
7753
7754 SunSpider reports no change, maybe a small speedup.
7755
7756 * pcre/pcre_exec.cpp:
7757 (match): Use instructionPtr++ a little less, to avoid confusing the
7758 optimizer.
7759
7760 2008-06-05 Alexey Proskuryakov <ap@webkit.org>
7761
7762 Re-landing an independent part of a previously rolled out threading patch.
7763
7764 * wtf/ThreadSpecific.h: Make sure to initialize POD thread-specific varaibles, too
7765 (replaced "new T" with "new T()").
7766
7767 2008-06-05 Maciej Stachowiak <mjs@apple.com>
7768
7769 Reviewed by Hyatt.
7770
7771 - force inlining of a template function that only has one call site per specialization
7772 1.3% speedup on SunSpider
7773
7774 * kjs/collector.cpp:
7775 (KJS::Collector::heapAllocate): This template function is only
7776 called from allocate() and allocateNumber() (once per
7777 specialization) and the extra call overhead for GC allocation
7778 shows up, so force inlining.
7779
7780 2008-06-05 Maciej Stachowiak <mjs@apple.com>
7781
7782 Reviewed by Alexey and Oliver.
7783
7784 - remove profiler fetch hack
7785 I measure an 0.5% progression from this, others show a wash. It seems not needed any more.
7786
7787 * VM/Machine.cpp:
7788 (KJS::Machine::privateExecute):
7789
7790 2008-06-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7791
7792 Reviewed by Maciej.
7793
7794 Bug 19400: subscript operator does not protect base when necessary
7795 <https://bugs.webkit.org/show_bug.cgi?id=19400>
7796
7797 Use a temporary for the base in BracketAccessorNode if the subscript
7798 might possibly modify it.
7799
7800 * kjs/grammar.y:
7801 * kjs/nodes.cpp:
7802 (KJS::BracketAccessorNode::emitCode):
7803 * kjs/nodes.h:
7804 (KJS::BracketAccessorNode::):
7805
7806 2008-06-04 Sam Weinig <sam@webkit.org>
7807
7808 Reviewed by Maciej Stachowiak.
7809
7810 Big cleanup of formatting and whitespace.
7811
7812 2008-06-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7813
7814 Reviewed by Oliver.
7815
7816 Add an option to dump statistics on executed instructions.
7817
7818 * VM/Machine.cpp:
7819 (KJS::Machine::privateExecute):
7820 * VM/Opcode.cpp:
7821 (KJS::OpcodeStats::~OpcodeStats):
7822 (KJS::OpcodeStats::recordInstruction):
7823 * VM/Opcode.h:
7824
7825 2008-06-04 Kevin McCullough <kmccullough@apple.com>
7826
7827 Reviewed by Geoff.
7828
7829 <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
7830 profiler.
7831 - This patch removes the use of recursion for the sort functions.
7832
7833 * JavaScriptCore.exp: Change the signatures of the functions being
7834 exported.
7835 * profiler/Profile.cpp:
7836 (KJS::Profile::sort): This generic function will accept any of the
7837 static sort functions and apply them to the whole tree.
7838 * profiler/Profile.h: All of the sorting functions now call the new
7839 sort() function.
7840 (KJS::Profile::sortTotalTimeDescending):
7841 (KJS::Profile::sortTotalTimeAscending):
7842 (KJS::Profile::sortSelfTimeDescending):
7843 (KJS::Profile::sortSelfTimeAscending):
7844 (KJS::Profile::sortCallsDescending):
7845 (KJS::Profile::sortCallsAscending):
7846 (KJS::Profile::sortFunctionNameDescending):
7847 (KJS::Profile::sortFunctionNameAscending):
7848 * profiler/ProfileNode.cpp:
7849 (KJS::ProfileNode::ProfileNode): m_head used to point to the head node
7850 if this was the head node. It now points to null to make iteration easy
7851 (KJS::ProfileNode::willExecute): Now must check if m_head is null, this
7852 check used to happend in the constructor.
7853 (KJS::ProfileNode::stopProfiling): Again the check is slightly different
7854 to determine if this is the head.
7855 (KJS::ProfileNode::traverseNextNode): This function returns the next
7856 node in post order.
7857 (KJS::ProfileNode::sort): This generic function will sort according to
7858 the comparator passed in, then reset the children pointers to macth the
7859 new order.
7860 * profiler/ProfileNode.h: The sorting function were removed from the
7861 definition file and instead use the new generic sort() function
7862 (KJS::ProfileNode::totalPercent): because the head can now be empty we
7863 need to check here too for the head node.
7864 (KJS::ProfileNode::selfPercent): Ditto
7865 (KJS::ProfileNode::firstChild): This function is necessary for the
7866 iterative algorithm in Profile.cpp.
7867 (KJS::ProfileNode::sortTotalTimeDescending):
7868 (KJS::ProfileNode::sortTotalTimeAscending):
7869 (KJS::ProfileNode::sortSelfTimeDescending):
7870 (KJS::ProfileNode::sortSelfTimeAscending):
7871 (KJS::ProfileNode::sortCallsDescending):
7872 (KJS::ProfileNode::sortCallsAscending):
7873 (KJS::ProfileNode::sortFunctionNameDescending):
7874 (KJS::ProfileNode::sortFunctionNameAscending):
7875 (KJS::ProfileNode::childrenBegin):
7876 (KJS::ProfileNode::childrenEnd):
7877 (KJS::ProfileNode::totalTimeDescendingComparator):
7878 (KJS::ProfileNode::totalTimeAscendingComparator):
7879 (KJS::ProfileNode::selfTimeDescendingComparator):
7880 (KJS::ProfileNode::selfTimeAscendingComparator):
7881 (KJS::ProfileNode::callsDescendingComparator):
7882 (KJS::ProfileNode::callsAscendingComparator):
7883 (KJS::ProfileNode::functionNameDescendingComparator):
7884 (KJS::ProfileNode::functionNameAscendingComparator):
7885
7886 2008-06-04 Alexey Proskuryakov <ap@webkit.org>
7887
7888 Reviewed by Darin.
7889
7890 Fix JSClassCreate to work with old JSCore API threading model.
7891
7892 No change on SunSpider.
7893
7894 * API/JSClassRef.cpp: (OpaqueJSClass::OpaqueJSClass): Since JSClass is constructed without
7895 a context, there is no way for it to create Identifiers.
7896 Also, added initializeThreading(), just for good measure.
7897
7898 * API/JSCallbackObjectFunctions.h: (KJS::::getPropertyNames): Make an Identifier out of the
7899 string here, because propertyNames.add() needs that.
7900
7901 * kjs/identifier.cpp:
7902 * kjs/identifier.h:
7903 (KJS::Identifier::equal):
7904 * kjs/ustring.cpp:
7905 (KJS::equal):
7906 Moved equal() from identifier.h to ustring.h, because it's not really about Identifiers,
7907 and to make it possible to use it from StrHash.
7908 Include StrHash.h from ustring.h to avoid having the behavior depend on headers that happen
7909 to be included.
7910
7911 * wtf/StrHash.h: Removed.
7912 * kjs/ustring.h: Made RefPtr<UString::Rep> use the same default hash as UString::Rep* (it
7913 used to default to pointer equality). Moved the whole StrHash header into ustring.h.
7914
7915 * JavaScriptCore.exp: Export equal() for WebCore use (this StrHash is used in c_class.cpp,
7916 jni_class.cpp, and npruntime.cpp).
7917
7918 2008-06-04 Alexey Proskuryakov <ap@webkit.org>
7919
7920 Rubber-stamped by Darin.
7921
7922 Fix spacing in collector.{h,cpp}.
7923
7924 * kjs/collector.cpp:
7925 * kjs/collector.h:
7926
7927 2008-06-03 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7928
7929 Reviewed by Maciej.
7930
7931 Build fix. The cleanup in r34355 missed a method.
7932
7933 * kjs/nodes.cpp:
7934 * kjs/nodes.h:
7935
7936 2008-06-03 Darin Adler <darin@apple.com>
7937
7938 Reviewed by Geoff.
7939
7940 - https://bugs.webkit.org/show_bug.cgi?id=19269
7941 speed up SunSpider by eliminating the toObject call for most get/put/delete
7942
7943 Makes standalone SunSpider 1.025x as fast as before.
7944
7945 The getOwnPropertySlot virtual function now takes care of the toObject call
7946 for get. Similarly, the put function (and later deleteProperty) does the
7947 same for those operations. To do this, the virtual functions were moved from
7948 the JSObject class to the JSCell class. Also, since the caller no longer knows
7949 the identity of the "original object", which is used by JavaScript-function
7950 based getters, changed the PropertySlot class so the original object is
7951 already stored in the slot when getOwnPropertySlot is called, if the caller
7952 intends to call getValue.
7953
7954 This affected the old interpreter code enough that the easiest thing for me
7955 was to just delete it. While I am not certain the mysterious slowdown is not
7956 still occurring, the net change is definitely a significant speedup.
7957
7958 * JavaScriptCore.exp: Updated.
7959
7960 * VM/Machine.cpp: Moved the UNLIKELY macro into AlwaysInline.h.
7961 (KJS::resolve): Set up the originalObject in the PropertySlot before
7962 calling getPropertySlot. Also removed the originalObject argument from
7963 getValue.
7964 (KJS::resolve_skip): Ditto.
7965 (KJS::resolveBaseAndProperty): Ditto.
7966 (KJS::resolveBaseAndFunc): Ditto.
7967 (KJS::Machine::privateExecute): Removed the toObject calls from the get and
7968 put functions where possible, instead calling directly with JSValue and letting
7969 the JSValue and JSCell calls handle toObject. Same for toThisObject.
7970
7971 * kjs/ExecState.h: Removed OldInterpreterExecState.
7972
7973 * API/JSBase.cpp: Updated includes.
7974
7975 * kjs/LocalStorageEntry.h: Removed contents. Later we can remove the file too.
7976
7977 * kjs/array_instance.cpp:
7978 (KJS::ArrayInstance::lengthGetter): Removed originalObject argumet.
7979 (KJS::ArrayInstance::inlineGetOwnPropertySlot): Don't pass a base value to
7980 setValueSlot. Also use UNLIKELY around the "getting elements past the end of
7981 the array" code path; less common than successfully getting an element.
7982
7983 * kjs/array_object.cpp:
7984 (KJS::getProperty): Initialize the PropertySlot with the original object.
7985 Don't pass the original object to the get function.
7986 (KJS::arrayProtoFuncFilter): Ditto.
7987 (KJS::arrayProtoFuncMap): Ditto.
7988 (KJS::arrayProtoFuncEvery): Ditto.
7989 (KJS::arrayProtoFuncForEach): Ditto.
7990 (KJS::arrayProtoFuncSome): Ditto.
7991
7992 * kjs/function_object.cpp:
7993 (KJS::FunctionObjectImp::construct): Removed an obsolete comment.
7994
7995 * kjs/grammar.y: Eliminated support for some of the node types that were
7996 used to optimize executing from the syntax tree.
7997
7998 * kjs/internal.cpp:
7999 (KJS::StringImp::toThisObject): Added. Same as toObject.
8000 (KJS::NumberImp::toThisObject): Ditto.
8001 (KJS::GetterSetterImp::getOwnPropertySlot): Added. Not reached.
8002 (KJS::GetterSetterImp::put): Ditto.
8003 (KJS::GetterSetterImp::toThisObject): Ditto.
8004
8005 * kjs/internal.h: Added toThisObject to NumberImp for speed.
8006
8007 * kjs/lexer.cpp:
8008 (KJS::Lexer::shift): Changed shift to just do a single character, to unroll
8009 the loop and especially to make the one character case faster.
8010 (KJS::Lexer::setCode): Call shift multiple times instead of passing a number.
8011 (KJS::Lexer::lex): Ditto.
8012 (KJS::Lexer::matchPunctuator): Ditto. Also removed unneeded elses after returns.
8013 (KJS::Lexer::scanRegExp): Ditto.
8014 * kjs/lexer.h: Removed the count argument from shift.
8015
8016 * kjs/math_object.cpp:
8017 (KJS::mathProtoFuncPow): Call jsNaN instead of jsNumber(NaN).
8018
8019 * kjs/nodes.cpp: Removed some of the things needed only for the pre-SquirrelFish
8020 execution model.
8021 (KJS::ForNode::emitCode): Handle cases where some expressions are missing by
8022 not emitting any code at all. The old way was to emit code for "true", but
8023 this is an unnecessary remnant of the old way of doing things.
8024
8025 * kjs/nodes.h: Removed some of the things needed only for the pre-SquirrelFish
8026 execution model.
8027
8028 * kjs/object.cpp:
8029 (KJS::JSObject::fillGetterPropertySlot): Changed to only pass in the getter
8030 function. The old code passed in a base, but it was never used when
8031 actually getting the property; the toThisObject call was pointless. Also
8032 changed to not pass a base for setUndefined.
8033
8034 * kjs/object.h: Added the new JSCell operations to GetterSetterImp.
8035 Never called.
8036 (KJS::JSObject::get): Initialize the object in the PropertySlot and don't
8037 pass it in getValue.
8038 (KJS::JSObject::getOwnPropertySlotForWrite): Removed the base argument
8039 in calls to setValueSlot.
8040 (KJS::JSObject::getOwnPropertySlot): Ditto.
8041 (KJS::JSValue::get): Added. Here because it calls through to JSObject.
8042 A version of JSObject::get that also handles the other types of JSValue
8043 by creating the appropriate wrapper. Saves the virtual call to toObject.
8044 (KJS::JSValue::put): Ditto.
8045 (KJS::JSValue::deleteProperty): Ditto.
8046
8047 * kjs/property_slot.cpp:
8048 (KJS::PropertySlot::undefinedGetter): Removed the originalObject argument.
8049 (KJS::PropertySlot::ungettableGetter): Ditto.
8050 (KJS::PropertySlot::functionGetter): Ditto. Use the value in the base
8051 as the "this" object, which will be set to the original object by the new
8052 PropertySlot initialization code. Also call toThisObject. The old code did
8053 not do this, but needed to so we can properly handle the activation object
8054 like the other similar code paths.
8055
8056 * kjs/property_slot.h:
8057 (KJS::PropertySlot::PropertySlot): Added a constructor that takes a base
8058 object. In debug builds, set the base to 0 if you don't pass one.
8059 (KJS::PropertySlot::getValue): Don't take or pass the originalObject.
8060 (KJS::PropertySlot::setValueSlot): Don't take a base object, and clear the
8061 base object in debug builds.
8062 (KJS::PropertySlot::setGetterSlot): Ditto.
8063 (KJS::PropertySlot::setUndefined): Ditto.
8064 (KJS::PropertySlot::setUngettable): Ditto.
8065 (KJS::PropertySlot::slotBase): Assert that a base object is present.
8066 This will fire if someone actually calls the get function without having
8067 passed in a base object and the getter needs it.
8068 (KJS::PropertySlot::setBase): Added. Used by the code that implements
8069 toObject so it can supply the original object after the fact.
8070 (KJS::PropertySlot::clearBase): Added. Clears the base, but is debug-only
8071 code because it's an error to fetch the base if you don't have a guarantee
8072 it was set.
8073
8074 * API/JSCallbackObject.h:
8075 * API/JSCallbackObjectFunctions.h:
8076 (KJS::JSCallbackObject::cachedValueGetter):
8077 (KJS::JSCallbackObject::staticValueGetter):
8078 (KJS::JSCallbackObject::staticFunctionGetter):
8079 (KJS::JSCallbackObject::callbackGetter):
8080 * kjs/JSActivation.cpp:
8081 (KJS::JSActivation::getOwnPropertySlot):
8082 (KJS::JSActivation::argumentsGetter):
8083 * kjs/JSActivation.h:
8084 * kjs/JSVariableObject.h:
8085 (KJS::JSVariableObject::symbolTableGet):
8086 * kjs/array_instance.h:
8087 * kjs/function.cpp:
8088 (KJS::FunctionImp::argumentsGetter):
8089 (KJS::FunctionImp::callerGetter):
8090 (KJS::FunctionImp::lengthGetter):
8091 (KJS::Arguments::mappedIndexGetter):
8092 * kjs/function.h:
8093 * kjs/lookup.h:
8094 (KJS::staticFunctionGetter):
8095 (KJS::staticValueGetter):
8096 * kjs/string_object.cpp:
8097 (KJS::StringInstance::lengthGetter):
8098 (KJS::StringInstance::indexGetter):
8099 (KJS::stringInstanceNumericPropertyGetter):
8100 * kjs/string_object.h:
8101 Removed originalObject arguments from getters. Don't pass base values to
8102 the various PropertySlot functions that no longer take them.
8103
8104 * kjs/value.cpp:
8105 (KJS::JSCell::getOwnPropertySlot): Added. Calls toObject and then sets the slot.
8106 This function has to always return true, because the caller can't walk the prototype
8107 chain. Because of that, we do a getPropertySlot, not getOwnPropertySlot, which works
8108 for the caller. This is private, only called by getOwnPropertySlotInternal.
8109 (KJS::JSCell::put): Added. Calls toObject and then put.
8110 (KJS::JSCell::toThisObject): Added. Calls toObject.
8111
8112 * kjs/value.h: Added get, put, and toThisObject to both JSValue
8113 and JSCell. These take care of the toObject operation without an additional virtual
8114 function call, and so make the common "already an object" case faster.
8115
8116 * wtf/AlwaysInline.h: Moved the UNLIKELY macro here for now. Maybe we can find a
8117 better place later, or rename this header.
8118
8119 2008-06-03 Oliver Hunt <oliver@apple.com>
8120
8121 Reviewed by Tim.
8122
8123 Bug 12983: Web Inspector break on the debugger keyword
8124 <https://bugs.webkit.org/show_bug.cgi?id=12983>
8125
8126 Added a DebuggerStatementNode to handle codegen, and added a new
8127 DidReachBreakPoint debug event (which will hopefully be useful
8128 if we ever move breakpoint management into JSC proper). Also
8129 added didReachBreakpoint to Debugger to allow us to actually respond
8130 to this event.
8131
8132 * VM/CodeBlock.cpp:
8133 (KJS::debugHookName):
8134 * VM/Machine.cpp:
8135 (KJS::Machine::debug):
8136 * VM/Machine.h:
8137 * kjs/debugger.h:
8138 * kjs/grammar.y:
8139 * kjs/nodes.cpp:
8140 (KJS::DebuggerStatementNode::emitCode):
8141 (KJS::DebuggerStatementNode::execute):
8142 * kjs/nodes.h:
8143 (KJS::DebuggerStatementNode::):
8144 * kjs/nodes2string.cpp:
8145 (KJS::DebuggerStatementNode::streamTo):
8146
8147 2008-06-03 Maciej Stachowiak <mjs@apple.com>
8148
8149 Reviewed by Oliver.
8150
8151 - document remaining opcodes.
8152
8153 * VM/Machine.cpp:
8154 (KJS::Machine::privateExecute): Document call, call_eval,
8155 construct, ret and end opcodes.
8156
8157 2008-06-03 Maciej Stachowiak <mjs@apple.com>
8158
8159 Reviewed by Oliver.
8160
8161 * VM/Machine.cpp:
8162 (KJS::Machine::privateExecute): Document throw and catch opcodes.
8163
8164 2008-06-02 Geoffrey Garen <ggaren@apple.com>
8165
8166 Reviewed by Alexey Proskuryakov.
8167
8168 Removed JSObject::call, since it just called JSObject::callAsFunction.
8169
8170 SunSpider reports no change.
8171
8172 2008-06-02 Geoffrey Garen <ggaren@apple.com>
8173
8174 Reviewed by Darin Adler.
8175
8176 A little cleanup in the CodeGenerator.
8177
8178 * VM/CodeGenerator.cpp: A few changes here.
8179
8180 (1) Removed remaining cases of the old hack of putting "this" into the
8181 symbol table; replaced with explicit tracking of m_thisRegister.
8182
8183 (2) Made m_thisRegister behave the same for function, eval, and program
8184 code, removing the static programCodeThis() function.
8185
8186 (3) Added a feature to nix a ScopeNode's declaration stacks when done
8187 compiling, to save memory.
8188
8189 (4) Removed code that copied eval declarations into special vectors: we
8190 just use the originals in the ScopeNode now.
8191
8192 * VM/CodeGenerator.h: Removed unneded parameters from the CodeGenerator
8193 constructor: we just use get that data from the ScopeNode now.
8194
8195 * VM/Machine.cpp:
8196 (KJS::Machine::execute): When executing an eval node, don't iterate a
8197 special copy of its declarations; iterate the originals, instead.
8198
8199 * kjs/nodes.cpp: Moved responsibility for knowing what AST data to throw
8200 away into the CodeGenerator. Nodes no longer call shrinkCapacity on
8201 their data directly.
8202
8203 * kjs/nodes.h: Changed FunctionStack to ref its contents, so declaration
8204 data stays around even after we've thrown away the AST, unless we explicitly
8205 throw away the declaration data, too. This is useful for eval code, which
8206 needs to reference its declaration data at execution time. (Soon, it will
8207 be useful for program code, too, since program code should do the same.)
8208
8209 2008-06-02 Adam Roben <aroben@apple.com>
8210
8211 Build fix for non-AllInOne builds
8212
8213 * kjs/array_object.cpp: Added a missing #include.
8214
8215 2008-06-02 Kevin McCullough <kmccullough@apple.com>
8216
8217 Took out accidental confilct lines I checked in.
8218
8219 * ChangeLog:
8220
8221 2008-06-02 Kevin McCullough <kmccullough@apple.com>
8222
8223 Reviewed by Darin.
8224
8225 <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
8226 profiler
8227 Implement Next Sibling pointers as groundwork for removing the recursion
8228 limit in the profiler.
8229
8230 * profiler/ProfileNode.cpp: Also I renamed parentNode and headNode since
8231 'node' is redundant.
8232 (KJS::ProfileNode::ProfileNode): Initialize the nextSibling.
8233 (KJS::ProfileNode::willExecute): If there are already children then the
8234 new child needs to be the nextSibling of the last child.
8235 (KJS::ProfileNode::didExecute):
8236 (KJS::ProfileNode::addChild): Ditto.
8237 (KJS::ProfileNode::stopProfiling):
8238 (KJS::ProfileNode::sortTotalTimeDescending): For all of the sorting
8239 algorithms once the children are sorted their nextSibling pointers need
8240 to be reset to reflect the new order.
8241 (KJS::ProfileNode::sortTotalTimeAscending):
8242 (KJS::ProfileNode::sortSelfTimeDescending):
8243 (KJS::ProfileNode::sortSelfTimeAscending):
8244 (KJS::ProfileNode::sortCallsDescending):
8245 (KJS::ProfileNode::sortCallsAscending):
8246 (KJS::ProfileNode::sortFunctionNameDescending):
8247 (KJS::ProfileNode::sortFunctionNameAscending):
8248 (KJS::ProfileNode::resetChildrensSiblings): This new function simply
8249 loops over all of the children and sets their nextSibling pointers to
8250 the next child in the Vector
8251 (KJS::ProfileNode::debugPrintData):
8252 * profiler/ProfileNode.h:
8253 (KJS::ProfileNode::parent):
8254 (KJS::ProfileNode::setParent):
8255 (KJS::ProfileNode::nextSibling):
8256 (KJS::ProfileNode::setNextSibling):
8257 (KJS::ProfileNode::totalPercent):
8258 (KJS::ProfileNode::selfPercent):
8259
8260 2008-06-02 Geoffrey Garen <ggaren@apple.com>
8261
8262 Reviewed by Maciej Stachowiak.
8263
8264 Removed the recursion limit from JSObject::call, since the VM does
8265 recursion checking now.
8266
8267 This should allow us to remove JSObject::call entirely, netting a small
8268 speedup.
8269
8270 * kjs/object.cpp:
8271 (KJS::JSObject::call):
8272
8273 2008-06-02 Geoffrey Garen <ggaren@apple.com>
8274
8275 Reviewed by Adele Peterson.
8276
8277 Added a specific affordance for avoiding stack overflow when converting
8278 recursive arrays to string, in preparation for removing generic stack
8279 overflow checking from JSObject::call.
8280
8281 Tested by fast/js/toString-stack-overflow.html.
8282
8283 2008-06-02 Geoffrey Garen <ggaren@apple.com>
8284
8285 Reviewed by Alice Liu.
8286
8287 Refactored some hand-rolled code to call ScopeChain::globalObject instead.
8288
8289 2008-06-02 Geoffrey Garen <ggaren@apple.com>
8290
8291 Reviewed by Darin Adler.
8292
8293 Fixed ASSERT due to execution continuing after an exception is thrown
8294 during array sort.
8295
8296 * kjs/array_instance.cpp:
8297 (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key): Don't call the
8298 custom comparator function if an exception has been thrown. Just return
8299 1 for everything, so the sort completes quickly. (The result will be
8300 thrown away.)
8301
8302 2008-05-30 Timothy Hatcher <timothy@apple.com>
8303
8304 Made the starting line number of scripts be 1-based throughout the engine.
8305 This cleans up script line numbers so they are all consistent now and fixes
8306 some cases where script execution was shown as off by one line in the debugger.
8307
8308 No change in SunSpider.
8309
8310 Reviewed by Oliver Hunt.
8311
8312 * API/minidom.c:
8313 (main): Pass a line number of 1 instead of 0 to parser().parse().
8314 * API/testapi.c:
8315 (main): Ditto. And removes a FIXME and changed an assertEqualsAsNumber
8316 to use 1 instead of 2 for the line number.
8317 * VM/Machine.cpp:
8318 (KJS::callEval): Pass a line number of 1 instead of 0.
8319 (KJS::Machine::debug): Use firstLine for WillExecuteProgram instead of
8320 lastLine. Use lastLine for DidExecuteProgram instead of firstLine.
8321 * kjs/DebuggerCallFrame.cpp:
8322 (KJS::DebuggerCallFrame::evaluate): Pass a line number of 1 instead of
8323 0 to parser().parse().
8324 * kjs/Parser.cpp:
8325 (KJS::Parser::parse): ASSERT startingLineNumber is greatter than 0. Change
8326 the startingLineNumber to be 1 if it was less than or equal to 0. This is needed
8327 for release builds to maintain compatibility with the JavaScriptCore API.
8328 * kjs/function.cpp:
8329 (KJS::globalFuncEval): Pass a line number of 1 instead of 0 to parser().parse().
8330 * kjs/function_object.cpp:
8331 (FunctionObjectImp::construct): Pass a line number of 1 instead of 0 to construct().
8332 * kjs/lexer.cpp:
8333 (Lexer::setCode): Made yylineno = startingLineNumber instead of adding 1.
8334 * kjs/testkjs.cpp:
8335 (functionRun): Pass a line number of 1 instead of 0 to Interpreter::evaluate().
8336 (functionLoad): Ditto.
8337 (prettyPrintScript): Ditto.
8338 (runWithScripts): Ditto.
8339 * profiler/Profiler.cpp:
8340 (WebCore::createCallIdentifier): Removed a plus 1 of startingLineNumber.
8341
8342 2008-05-30 Alexey Proskuryakov <ap@webkit.org>
8343
8344 Reviewed by Darin.
8345
8346 https://bugs.webkit.org/show_bug.cgi?id=19180
8347 speed up SunSpider by optimizing immediate number cases
8348
8349 Also fixed a JavaScriptCore regression seen on PowerPC - we didn't clip left shift
8350 parameter to 0...31.
8351
8352 0.5% improvement on SunSpider overall, although a 8.5 regression on bitops-3bit-bits-in-byte.
8353
8354 * VM/Machine.cpp:
8355 (KJS::Machine::privateExecute):
8356
8357 * kjs/JSImmediate.h:
8358 (KJS::JSImmediate::toTruncatedUInt32): Added. Same as getTruncatedInt32, but casts the result
8359 to unsigned.
8360
8361 2008-05-30 Alexey Proskuryakov <ap@webkit.org>
8362
8363 Reviewed by Oliver Hunt.
8364
8365 https://bugs.webkit.org/show_bug.cgi?id=19180
8366 speed up SunSpider by optimizing immediate number cases
8367
8368 Also fixed two JavaScriptCore regressions seen on PowerPC - we didn't clip right shift
8369 parameter to 0...31.
8370
8371 1.6% improvement on SunSpider, without significant regressions on any tests.
8372
8373 * VM/Machine.cpp:
8374 (KJS::Machine::privateExecute):
8375 Added fast paths for >>, ==, ===, !=, !==. Changed order of memory accesses in many
8376 cases, making them less dependent on gcc's ability to properly assign registers. With this,
8377 I could move exception checks back into slow code paths, and saw less randomness in general.
8378
8379 * kjs/JSImmediate.h:
8380 (KJS::JSImmediate::rightShiftImmediateNumbers):
8381 Added.
8382
8383 2008-05-29 Maciej Stachowiak <mjs@apple.com>
8384
8385 Reviewed by Oliver.
8386
8387 - fixed <rdar://problem/5972943> REGRESSION(r33979): Flash clips do not play on cnn.com
8388
8389 Finally blocks could clobber registers that had to remain live
8390 until they returned. This patch takes a conservative approach and
8391 makes sure that finally blocks do not reuse any registers that
8392 were previously allocated for the function. In the future this
8393 could probably be tightened up to be less profligate with the
8394 register allocation.
8395
8396 * VM/CodeGenerator.cpp:
8397 (KJS::CodeGenerator::highestUsedRegister):
8398 * VM/CodeGenerator.h:
8399 * kjs/nodes.cpp:
8400 (KJS::TryNode::emitCode):
8401
8402 2008-05-29 Steve Falkenburg <sfalken@apple.com>
8403
8404 Build fix.
8405
8406 * kjs/array_instance.cpp:
8407
8408 2008-05-29 Alexey Proskuryakov <ap@webkit.org>
8409
8410 Reviewed by Darin.
8411
8412 https://bugs.webkit.org/show_bug.cgi?id=19294
8413 <rdar://problem/5969062> A crash when iterating over a sparse array backwards.
8414
8415 * kjs/array_instance.cpp: Turned sparseArrayCutoff into a macro, so that using max() on it
8416 doesn't cause a PIC branch.
8417 (KJS::ArrayInstance::increaseVectorLength): Added a comment about this function not
8418 preserving class invariants.
8419 (KJS::ArrayInstance::put): Update m_storage after reallocation. Move values that fit to
8420 the vector from the map in all code paths.
8421
8422 2008-05-29 Thiago Macieira <tjmaciei@trolltech.com>
8423
8424 Reviewed by Simon.
8425
8426 Fix compilation in Solaris with Sun CC
8427
8428 Lots of WebKit code uses C99 functions that, strict as it
8429 is, the Solaris system doesn't provide in C++. So we must define them
8430 for both GCC and the Sun CC.
8431
8432 * wtf/MathExtras.h:
8433
8434 2008-05-28 Oliver Hunt <oliver@apple.com>
8435
8436 Reviewed by Anders.
8437
8438 Fix codegen for assignment being used as a function.
8439
8440 FunctionCallValueNode::emitCode failed to account for the
8441 potential of the function expression to allocate arbitrary
8442 registers.
8443
8444 * kjs/nodes.cpp:
8445 (KJS::FunctionCallValueNode::emitCode):
8446
8447 2008-05-27 Geoffrey Garen <ggaren@apple.com>
8448
8449 Reviewed by Tim Hatcher.
8450
8451 Fixed https://bugs.webkit.org/show_bug.cgi?id=19183
8452 REGRESSION (r33979): Crash in DebuggerCallFrame::functionName when
8453 clicking button in returnEvent-crash.html
8454
8455 Added two new debugger hooks, willExecuteProgram and didExecuteProgram,
8456 along with code to generate them, code to invoke them when unwinding
8457 due to an exception, and code to dump them.
8458
8459 SunSpider reports no change.
8460
8461 * VM/CodeBlock.cpp:
8462 (KJS::debugHookName): I had to mark this function NEVER_INLINE to avoid
8463 a .4% performance regression. The mind boggles.
8464
8465 2008-05-28 Adam Roben <aroben@apple.com>
8466
8467 Fix JavaScriptCore tests on OS X
8468
8469 We were quoting the path to testkjs too late, after it had already
8470 been combined with spaces and other options.
8471
8472 * tests/mozilla/jsDriver.pl:
8473 (top level): Move path quoting from here...
8474 (sub get_kjs_engine_command): ...to here.
8475
8476 2008-05-28 Anders Carlsson <andersca@apple.com>
8477
8478 Reviewed by Oliver.
8479
8480 <rdar://problem/5968071> "const f" crashes in JavaScriptCore
8481
8482 Make sure to null check the initializer.
8483
8484 * kjs/nodes.cpp:
8485 (KJS::ConstDeclNode::emitCodeSingle):
8486
8487 2008-05-28 Adam Roben <aroben@apple.com>
8488
8489 Make run-javascriptcore-tests work with a space in the path to testkjs
8490
8491 Reviewed by Alexey Proskuryakov.
8492
8493 * tests/mozilla/jsDriver.pl: Quote the path to the engine so that
8494 spaces will be interpreted correctly.
8495
8496 2008-05-28 Alexey Proskuryakov <ap@webkit.org>
8497
8498 Fixed a misguiding comment - my measurement for negative numbers only included cases
8499 where both operands were negative, which is not very interesting.
8500
8501 * VM/Machine.cpp:
8502
8503 2008-05-28 Alexey Proskuryakov <ap@webkit.org>
8504
8505 Reviewed by Maciej.
8506
8507 Based on a patch by Oliver Hunt.
8508
8509 https://bugs.webkit.org/show_bug.cgi?id=19180
8510 speed up SunSpider by optimizing immediate number cases
8511
8512 1.4% speedup on SunSpider.
8513
8514 * VM/Machine.cpp:
8515 (KJS::Machine::privateExecute):
8516 * kjs/JSImmediate.h:
8517 (KJS::JSImmediate::incImmediateNumber):
8518 (KJS::JSImmediate::decImmediateNumber):
8519 Added fast paths for ++ and --.
8520
8521 (KJS::JSImmediate::canDoFastAdditiveOperations): Corrected a comment.
8522
8523 2008-05-28 Alexey Proskuryakov <ap@webkit.org>
8524
8525 Reviewed by Darin.
8526
8527 https://bugs.webkit.org/show_bug.cgi?id=19180
8528 speed up SunSpider by optimizing immediate number cases
8529
8530 2% speedup overall, maximum 10% on controlflow-recursive and bitops-3bit-bits-in-byte,
8531 but a 4% regression on bitops-bits-in-byte and bitops-bitwise-and.
8532
8533 * kjs/JSImmediate.h:
8534 (KJS::JSImmediate::canDoFastAdditiveOperations):
8535 (KJS::JSImmediate::addImmediateNumbers):
8536 (KJS::JSImmediate::subImmediateNumbers):
8537 Added fast cases that work with positive values less than 2^30.
8538
8539 * VM/Machine.cpp:
8540 (KJS::Machine::privateExecute): Use the above operations. Also updated SunSpider frequencies
8541 with my results (looks like tag values have changed, not sure what caused the minor variation
8542 in actual frequencies).
8543
8544 2008-05-27 Adam Roben <aroben@apple.com>
8545
8546 Windows build fix
8547
8548 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
8549 Remove code that appended Cygwin's /bin directory to PATH.
8550 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
8551 Prepend Cygwin's /bin directory to PATH. We prepend instead of append
8552 so that Cygwin's utilities will win out over Win32 versions of the
8553 same utilities (particularly perl). We do the prepend here instead of
8554 in the Makefile because nmake doesn't seem to like prepending to PATH
8555 inside the Makefile. This also matches the way WebCoreGenerated works.
8556
8557 2008-05-27 Adam Roben <aroben@apple.com>
8558
8559 Roll out r34163
8560
8561 A better fix is on the way.
8562
8563 * DerivedSources.make:
8564 * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
8565
8566 2008-05-27 Adam Roben <aroben@apple.com>
8567
8568 Windows build fix
8569
8570 * DerivedSources.make: Don't generate the bytecode docs if
8571 OMIT_BYTECODE_DOCS is set to 1.
8572 * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Set
8573 OMIT_BYTECODE_DOCS for production builds.
8574
8575 2008-05-27 Anders Carlsson <andersca@apple.com>
8576
8577 Reviewed by Geoff and Maciej.
8578
8579 <rdar://problem/5806428>
8580 https://bugs.webkit.org/show_bug.cgi?id=17925
8581 Crash in KJS::JSObject::put after setting this.__proto__
8582
8583 Set slotIsWriteable to false for __proto__, we want setting __proto__ to go through JSObject::put instead.
8584
8585 * kjs/object.h:
8586 (KJS::JSObject::getOwnPropertySlotForWrite):
8587
8588 2008-05-27 Kevin Ollivier <kevino@theolliviers.com>
8589
8590 wx build fixes to catch up with SquirrelFish, etc.
8591
8592 * JavaScriptCoreSources.bkl:
8593 * jscore.bkl:
8594 * wtf/Platform.h:
8595
8596 2008-05-27 Darin Adler <darin@apple.com>
8597
8598 Reviewed by Tim Hatcher.
8599
8600 - https://bugs.webkit.org/show_bug.cgi?id=19180
8601 speed up SunSpider by optimizing immediate number cases
8602
8603 Add immediate number cases for the &, |, and ^ operators.
8604 Makes standalone SunSpider 1.010x faster.
8605
8606 * VM/Machine.cpp:
8607 (KJS::Machine::privateExecute): Add areBothImmediateNumbers special cases
8608 for the &, |, and ^ operators.
8609
8610 * kjs/JSImmediate.h:
8611 (KJS::JSImmediate::xorImmediateNumbers): Added.
8612 (KJS::JSImmediate::orImmediateNumbers): Added.
8613
8614 2008-05-26 Stephanie Lewis <slewis@apple.com>
8615
8616 Windows build fix.
8617
8618 * kjs/testkjs.cpp:
8619
8620 2008-05-26 Maciej Stachowiak <mjs@apple.com>
8621
8622 Reviewed by Anders.
8623
8624 - make addStaticGlobals protected instead of private so subclasses can use it
8625
8626 * JavaScriptCore.exp:
8627 * kjs/JSGlobalObject.h:
8628
8629 2008-05-26 Geoffrey Garen <ggaren@apple.com>
8630
8631 Reviewed by Darin Adler.
8632
8633 Fixed <rdar://problem/5960859> After an eval of a non-string or a syntax
8634 error, all profile stack frames are incorrect
8635
8636 SunSpider reports a .3% speedup, possibly because eval of a string is a
8637 little more efficient now.
8638
8639 * VM/Machine.cpp:
8640 (KJS::callEval): Make sure to call didExecute when returning early. I
8641 simplified this function to remove one early return, making the job
8642 of adding special code to early returns easier.
8643
8644 (KJS::Machine::execute): Use the new function ExecState when notifying
8645 the profiler. (This doesn't change behavior now, but it might prevent
8646 subtle errors in the future.)
8647
8648 2008-05-23 Tor Arne Vestbø <tavestbo@trolltech.com>
8649
8650 Reviewed by Simon.
8651
8652 Fixed toLower and toUpper implementations to allow being called
8653 with a null result pointer and resultLength, to determine the
8654 number of characters needed for the case conversion.
8655
8656 * wtf/unicode/qt4/UnicodeQt4.h:
8657 (WTF::Unicode::toLower):
8658 (WTF::Unicode::toUpper):
8659
8660 2008-05-25 Alexey Proskuryakov <ap@webkit.org>
8661
8662 Fixing a typo in the previous commit made as a last minute change.
8663
8664 * kjs/regexp_object.cpp:
8665
8666 2008-05-24 Alexey Proskuryakov <ap@webkit.org>
8667
8668 Reviewed by Darin.
8669
8670 Changed regular expression matching result array to be lazily filled, because many callers
8671 only care about it being non-null.
8672
8673 2% improvement on Acid3 test 26.
8674
8675 * kjs/array_instance.cpp: Added a void* member to ArrayStorage for ArrayInstance subclasses
8676 to use.
8677 * kjs/array_instance.h:
8678 (KJS::ArrayInstance::lazyCreationData):
8679 (KJS::ArrayInstance::setLazyCreationData):
8680 Added methods to access it from subclasses.
8681
8682 * kjs/regexp_object.cpp:
8683 (KJS::RegExpMatchesArray::RegExpMatchesArray):
8684 (KJS::RegExpMatchesArray::getOwnPropertySlot):
8685 (KJS::RegExpMatchesArray::put):
8686 (KJS::RegExpMatchesArray::deleteProperty):
8687 (KJS::RegExpMatchesArray::getPropertyNames):
8688 (KJS::RegExpMatchesArray::fillArrayInstanceIfNeeded):
8689 (KJS::RegExpMatchesArray::~RegExpMatchesArray):
8690 (KJS::RegExpObjectImp::arrayOfMatches):
8691 RegExpMatchesArray is a subclass of ArrayInstance that isn't filled until
8692 accessed for the first time.
8693
8694 2008-05-24 Alp Toker <alp@nuanti.com>
8695
8696 Win32/gcc build fix. Remove MSVC assumption.
8697
8698 * wtf/TCSpinLock.h:
8699 (TCMalloc_SlowLock):
8700
8701 2008-05-24 Oleg Finkelshteyn <olegfink@gmail.com>
8702
8703 Rubber-stamped, tweaked and landed by Alexey.
8704
8705 Build fix for gcc 4.3.
8706
8707 * JavaScriptCore/kjs/testkjs.cpp:
8708 * JavaScriptCore/VM/CodeBlock.cpp:
8709 Add missing standard includes.
8710
8711 2008-05-23 Anders Carlsson <andersca@apple.com>
8712
8713 Reviewed by Geoff.
8714
8715 <rdar://problem/5959886> REGRESSION: Assertion failure in JSImmediate::toString when loading GMail (19217)
8716
8717 Change List to store a JSValue*** pointer + an offset instead of a JSValue** pointer to protect against the case where
8718 a register file changes while a list object points to its buffer.
8719
8720 * VM/Machine.cpp:
8721 (KJS::Machine::privateExecute):
8722 * kjs/JSActivation.cpp:
8723 (KJS::JSActivation::createArgumentsObject):
8724 * kjs/list.cpp:
8725 (KJS::List::getSlice):
8726 * kjs/list.h:
8727 (KJS::List::List):
8728 (KJS::List::at):
8729 (KJS::List::append):
8730 (KJS::List::begin):
8731 (KJS::List::end):
8732 (KJS::List::buffer):
8733
8734 2008-05-23 Kevin McCullough <kmccullough@apple.com>
8735
8736 Reviewed by Sam.
8737
8738 <rdar://problem/5960012> JSProfiler: Stack overflow if recursion is
8739 too deep.
8740 -Use a simple depth limit to restrict too deep of recursion.
8741
8742 * profiler/Profile.cpp:
8743 (KJS::Profile::willExecute):
8744 (KJS::Profile::didExecute):
8745 * profiler/Profile.h:
8746
8747 2008-05-23 Geoffrey Garen <ggaren@apple.com>
8748
8749 Rolling back in r34085, with performance resolved.
8750
8751 Apparently, passing the eval function to callEval gave GCC a hernia.
8752
8753 Reviewed by Darin Adler, Kevin McCullough, and Oliver Hunt.
8754
8755 Fixed <rdar://problem/5959447> Crashes and incorrect reporting in the
8756 JavaScript profiler
8757
8758 * VM/Machine.cpp:
8759 (KJS::Machine::unwindCallFrame): Fixed incorrect reporting / a crash
8760 when unwinding from inside eval and/or program code: detect the
8761 difference, and do the right thing. Also, be sure to notify the profiler
8762 *before* deref'ing the scope chain, since the profiler uses the scope chain.
8763
8764 (KJS::Machine::execute): Fixed incorrect reporting / crash when calling
8765 a JS function re-entrently: Machine::execute(FunctionBodyNode*...)
8766 should not invoke the didExecute hook, because op_ret already does that.
8767 Also, use the new function's ExecState when calling out to the profiler.
8768 (Not important now, but could have become a subtle bug later.)
8769
8770 (KJS::Machine::privateExecute): Fixed a hard to reproduce crash when
8771 profiling JS functions: notify the profiler *before* deref'ing the scope
8772 chain, since the profiler uses the scope chain.
8773
8774 * kjs/object.cpp:
8775 (KJS::JSObject::call): Removed these hooks, because they are now unnecessary.
8776
8777 * profiler/Profile.cpp: Added a comment to explain a subtlety that only
8778 Kevin and I understood previously. (Now, the whole world can understand!)
8779
8780 * profiler/Profiler.cpp:
8781 (KJS::shouldExcludeFunction): Don't exclude .call and .apply. That was
8782 a hack to fix bugs that no longer exist.
8783
8784 Finally, sped things up a little bit by changing the "Is the profiler
8785 running?" check into an ASSERT, since we only call into the profiler
8786 when it's running:
8787
8788 (KJS::Profiler::willExecute):
8789 (KJS::Profiler::didExecute):
8790
8791 2008-05-23 Geoffrey Garen <ggaren@apple.com>
8792
8793 Reviewed by Oliver Hunt.
8794
8795 - fixed <rdar://problem/5957662> REGRESSION(r33943-r33980): Can't send email , attach file or save as draft from hotmail.com
8796
8797 SunSpider reports no change.
8798
8799 This is a reworking of r34073, which I rolled out because it caused
8800 lots of crashes.
8801
8802 * VM/CodeGenerator.cpp:
8803 (KJS::CodeGenerator::CodeGenerator): Use removeDirect to nix old
8804 properties whose names collide with new functions. (Don't use putWithAttributes
8805 because that tries to write to the register file, which hasn't grown to
8806 fit this program yet.)
8807
8808 2008-05-23 Darin Adler <darin@apple.com>
8809
8810 Reviewed by Mark Rowe.
8811
8812 As allocateNumber is used via jsNumberCell outside of JavaScriptCore,
8813 we need to provide a non-inlined version of it to avoid creating a
8814 weak external symbol.
8815
8816 * JavaScriptCore.exp:
8817 * kjs/AllInOneFile.cpp:
8818 * kjs/collector.cpp:
8819 (KJS::Collector::allocate):
8820 (KJS::Collector::allocateNumber):
8821 * kjs/collector.h:
8822 (KJS::Collector::allocate):
8823 (KJS::Collector::inlineAllocateNumber):
8824 * kjs/value.h:
8825 (KJS::NumberImp::operator new):
8826
8827 2008-05-23 Geoffrey Garen <ggaren@apple.com>
8828
8829 Rolled out r34073 because it caused lots of layout test crashes.
8830
8831 2008-05-23 Geoffrey Garen <ggaren@apple.com>
8832
8833 Rolled out r34085 because it measured as a 7.6% performance regression.
8834
8835 2008-05-23 Adam Roben <aroben@apple.com>
8836
8837 Windows build fix
8838
8839 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add the
8840 profiler directory to the include path.
8841
8842 2008-05-23 Oliver Hunt <oliver@apple.com>
8843
8844 Reviewed by Anders.
8845
8846 SQUIRRELFISH: JavaScript error messages are missing informative text
8847
8848 Partial fix.
8849 Tidy up error messages, makes a couple of them provide slightly more info.
8850 Inexplicably leads to a 1% SunSpider Progression.
8851
8852 * VM/ExceptionHelpers.cpp:
8853 (KJS::createError):
8854 (KJS::createInvalidParamError):
8855 (KJS::createNotAConstructorError):
8856 (KJS::createNotAFunctionError):
8857 * VM/ExceptionHelpers.h:
8858 * VM/Machine.cpp:
8859 (KJS::isNotObject):
8860
8861 2008-05-23 Oliver Hunt <oliver@apple.com>
8862
8863 Reviewed by Tim H.
8864
8865 Fix call stack reported by profiler when entering event handlers.
8866
8867 JSObject::call was arbitrarily notifying the profiler when it was
8868 called, even if it was JS code, which notifies the profile on entry
8869 in any case.
8870
8871 * kjs/object.cpp:
8872 (KJS::JSObject::call):
8873
8874 2008-05-16 Alp Toker <alp@nuanti.com>
8875
8876 Build fix for gcc 3. Default constructor required in ExecState,
8877 used by OldInterpreterExecState.
8878
8879 * kjs/ExecState.h:
8880 (KJS::ExecState::ExecState):
8881
8882 2008-05-23 Mark Rowe <mrowe@apple.com>
8883
8884 Reviewed by Oliver Hunt.
8885
8886 Fix <rdar://problem/5954997> global-recursion-on-full-stack.html crashes under guardmalloc.
8887
8888 Growing the register file with uncheckedGrow from within Machine::execute is not safe as the
8889 register file may be too close to its maximum size to grow successfully. By using grow,
8890 checking the result and throwing a stack overflow error we can avoid crashing.
8891
8892 * VM/Machine.cpp:
8893 (KJS::Machine::execute):
8894 * VM/RegisterFile.h: Remove the now-unused uncheckedGrow.
8895
8896 2008-05-23 Oliver Hunt <oliver@apple.com>
8897
8898 RS=Kevin McCullough
8899
8900 Remove JAVASCRIPT_PROFILER define
8901
8902 * VM/Machine.cpp:
8903 (KJS::callEval):
8904 (KJS::Machine::unwindCallFrame):
8905 (KJS::Machine::execute):
8906 (KJS::Machine::privateExecute):
8907 * kjs/config.h:
8908 * kjs/object.cpp:
8909 (KJS::JSObject::call):
8910
8911 2008-05-23 Oliver Hunt <oliver@apple.com>
8912
8913 <rdar://problem/5951561> Turn on JavaScript Profiler
8914
8915 Reviewed by Kevin McCullough.
8916
8917 Flipped the switch on the profiler, rearranged how we
8918 signal the the profiler is active so that calls aren't
8919 needed in the general case.
8920
8921 Also fixed the entry point for Machine::execute(FunctionBodyNode..)
8922 to correctly indicate function exit.
8923
8924 Results in a 0.7-1.0% regression in SunSpider :-(
8925
8926 * VM/Machine.cpp:
8927 (KJS::callEval):
8928 (KJS::Machine::unwindCallFrame):
8929 (KJS::Machine::execute):
8930 (KJS::Machine::privateExecute):
8931 * kjs/config.h:
8932 * profiler/Profiler.cpp:
8933 (KJS::Profiler::profiler):
8934 (KJS::Profiler::startProfiling):
8935 (KJS::Profiler::stopProfiling):
8936 * profiler/Profiler.h:
8937 (KJS::Profiler::enabledProfilerReference):
8938
8939 2008-05-23 Simon Hausmann <hausmann@webkit.org>
8940
8941 Fix the Qt build by adding profiler/ to the include search path.
8942
8943 * JavaScriptCore.pri:
8944
8945 2008-05-22 Kevin McCullough <kmccullough@apple.com>
8946
8947 Reviewed by Adam.
8948
8949 Fix a bug in the profiler where time in the current function is given to
8950 (idle).
8951
8952 * profiler/Profile.cpp:
8953 (KJS::Profile::didExecute): Set the start time and then call didExecute
8954 to calculate the time spent in this function.
8955 * profiler/ProfileNode.cpp: Remove confusing calculations that are no
8956 longer necessary.
8957 (KJS::ProfileNode::insertNode):
8958 * profiler/ProfileNode.h: Expose access to the start time to allow the
8959 simpler time calculations above.
8960 (KJS::ProfileNode::startTime):
8961 (KJS::ProfileNode::setStartTime):
8962
8963 2008-05-22 Adam Roben <aroben@apple.com>
8964
8965 Show "(Function object)" instead of "(JSInpectorCallbackWrapper
8966 object)" in profiles
8967
8968 Reviewed by Kevin McCullough.
8969
8970 * profiler/Profiler.cpp:
8971 (KJS::createCallIdentifier): Use JSObject::className instead of
8972 getting the class name from the ClassInfo directly. JSObject
8973 subclasses can override className to provide a custom class name, and
8974 it seems like we should honor that.
8975
8976 2008-05-22 Timothy Hatcher <timothy@apple.com>
8977
8978 Added Profile::restoreAll and added ProfileNode::restoreAll
8979 to the export file.
8980
8981 Reviewed by Adam Roben.
8982
8983 * JavaScriptCore.exp:
8984 * profiler/Profile.h:
8985
8986 2008-05-22 Alp Toker <alp@nuanti.com>
8987
8988 GTK+ build fix. Add JavaScriptCore/profiler to include path.
8989
8990 * GNUmakefile.am:
8991
8992 2008-05-22 Adam Roben <aroben@apple.com>
8993
8994 Implement sub-millisecond profiling on Windows
8995
8996 Reviewed by Kevin McCullough.
8997
8998 * profiler/ProfileNode.cpp:
8999 (KJS::getCount): Added. On Windows, we use QueryPerformanceCounter. On
9000 other platforms, we use getCurrentUTCTimeWithMicroseconds.
9001 (KJS::ProfileNode::endAndRecordCall): Use getCount instead of
9002 getCurrentUTCTimeWithMicroseconds.
9003 (KJS::ProfileNode::startTimer): Ditto.
9004
9005 2008-05-22 Adam Roben <aroben@apple.com>
9006
9007 Fix a profiler assertion when calling a NodeList as a function
9008
9009 Reviewed by Kevin McCullough.
9010
9011 * profiler/Profiler.cpp:
9012 (KJS::createCallIdentifier): Don't assert when a non-function object
9013 is called as a function. Instead, build up a CallIdentifier using the
9014 object's class name.
9015
9016 2008-05-22 Kevin McCullough <kmccullough@apple.com>
9017
9018 Reviewed by Darin.
9019
9020 <rdar://problem/5951529> JSProfiler: Allow the profiler to "Exclude" a
9021 profile node.
9022 -Implement 'exclude'; where the excluded node attributes its time to its
9023 parent's self time.
9024
9025 * JavaScriptCore.exp: Export the exclude function.
9026 * profiler/Profile.h:
9027 (KJS::Profile::exclude):
9028 * profiler/ProfileNode.cpp:
9029 (KJS::ProfileNode::setTreeVisible): New function that allows a change in
9030 visiblitiy to be propogated to all the children of a node.
9031 (KJS::ProfileNode::exclude): If the node matches the callIdentifier then
9032 set the visiblity of this node and all of its children to false and
9033 attribute it's total time to it's caller's self time.
9034 * profiler/ProfileNode.h:
9035
9036 2008-05-22 Mark Rowe <mrowe@apple.com>
9037
9038 Reviewed by Oliver Hunt.
9039
9040 Fix access to static global variables in Windows release builds.
9041
9042 * kjs/JSGlobalObject.h: Don't store a reference to an Identifier
9043 in GlobalPropertyInfo as the Identifier is likely to be a temporary
9044 and therefore may be destroyed before the GlobalPropertyInfo.
9045
9046 2008-05-22 Kevin McCullough <kmccullough@apple.com>
9047
9048 Build fix.
9049
9050 * VM/Machine.cpp:
9051 (KJS::callEval):
9052
9053 2008-05-22 Kevin McCullough <kmccullough@apple.com>
9054
9055 Reviewed by Sam.
9056
9057 <rdar://problem/5951561> Turn on JavaScript Profiler
9058 Get basic JS profiling working.
9059 Even with this patch the profiler will not be compiled in because we do
9060 not know the extend, if any, of the performance regression it would cause
9061 when it is not in use. However with these changes, if the profiler were
9062 on, it would not crash and show good profiling data.
9063
9064 * VM/Machine.cpp: Instrument the calls sites that are needed for profiling.
9065 (KJS::callEval):
9066 (KJS::Machine::unwindCallFrame):
9067 (KJS::Machine::execute):
9068 (KJS::Machine::privateExecute):
9069 * kjs/function.cpp: Ditto.
9070 (KJS::globalFuncEval):
9071 * kjs/interpreter.cpp: Ditto.
9072 (KJS::Interpreter::evaluate):
9073 * profiler/Profile.cpp:
9074 (KJS::Profile::willExecute):
9075 (KJS::Profile::didExecute): Because we do not get a good context when
9076 startProfiling is called it is possible that m_currentNode will be at the
9077 top of the known stack when a didExecute() is called. What we then do is
9078 create a new node that represents the function being exited and insert
9079 it between the head and the currently known children, since they should
9080 be children of this new node.
9081 * profiler/ProfileNode.cpp:
9082 (KJS::ProfileNode::ProfileNode):
9083 (KJS::ProfileNode::willExecute): Rename the add function for consistency.
9084 (KJS::ProfileNode::addChild): Appends the child to this node but also
9085 sets the parent pointer of the children to this node.
9086 (KJS::ProfileNode::insertNode): Insert a node between this node and its
9087 children. Also set the time for the new node since it is now exiting
9088 and we don't really know when it started.
9089 (KJS::ProfileNode::stopProfiling):
9090 (KJS::ProfileNode::startTimer):
9091 * profiler/ProfileNode.h:
9092 (KJS::CallIdentifier::toString): Added for debugging.
9093 (KJS::ProfileNode::setParent):
9094 (KJS::ProfileNode::setSelfTime): Fixed an old bug where we set the
9095 visibleTotalTime not the visibleSelfTime.
9096 (KJS::ProfileNode::children):
9097 (KJS::ProfileNode::toString): Added for debugging.
9098 * profiler/Profiler.cpp: remove unecessary calls.
9099 (KJS::Profiler::startProfiling):
9100
9101 2008-05-22 Sam Weinig <sam@webkit.org>
9102
9103 Reviewed by Oliver Hunt.
9104
9105 Rename register arguments for op_call, op_call_eval, op_end, and op_construct
9106 to document what they are for.
9107
9108 * VM/CodeGenerator.cpp:
9109 (KJS::CodeGenerator::emitCall):
9110 (KJS::CodeGenerator::emitCallEval):
9111 (KJS::CodeGenerator::emitEnd):
9112 (KJS::CodeGenerator::emitConstruct):
9113 * VM/CodeGenerator.h:
9114 * VM/Machine.cpp:
9115 (KJS::Machine::privateExecute):
9116
9117 2008-05-22 Oliver Hunt <oliver@apple.com>
9118
9119 Reviewed by Darin.
9120
9121 Bug 19116: SquirrelFish shouldn't regress on variable lookups
9122 <https://bugs.webkit.org/show_bug.cgi?id=19116>
9123
9124 Last of the multiscope look up optimisations. This is a wash overall on SunSpider
9125 but is a factor of 5-10 improvement in multiscope read/write/modify (eg. ++, --, +=,
9126 ... applied to any non-local var).
9127
9128 * kjs/nodes.cpp:
9129 (KJS::PostIncResolveNode::emitCode):
9130 (KJS::PostDecResolveNode::emitCode):
9131 (KJS::PreIncResolveNode::emitCode):
9132 (KJS::PreDecResolveNode::emitCode):
9133 (KJS::ReadModifyResolveNode::emitCode):
9134
9135 2008-05-22 David Kilzer <ddkilzer@apple.com>
9136
9137 <rdar://problem/5954233> Add method to release free memory from FastMalloc
9138
9139 Patch suggested by Mark Rowe. Rubber-stamped by Maciej.
9140
9141 * JavaScriptCore.exp: Export _releaseFastMallocFreeMemory.
9142 * wtf/FastMalloc.cpp:
9143 (WTF::TCMallocStats::): Added releaseFastMallocFreeMemory() for both
9144 system malloc and FastMalloc code paths.
9145 * wtf/FastMalloc.h: Define releaseFastMallocFreeMemory().
9146
9147 2008-05-22 Oliver Hunt <oliver@apple.com>
9148
9149 RS=Maciej.
9150
9151 Roll out r34020 as it causes recursion tests to fail.
9152
9153 * kjs/object.cpp:
9154 (KJS::JSObject::call):
9155
9156 2008-05-22 Oliver Hunt <oliver@apple.com>
9157
9158 Reviewed by Mark.
9159
9160 Don't leak the SymbolTable when compiling eval code.
9161
9162 * kjs/nodes.cpp:
9163 (KJS::EvalNode::generateCode):
9164
9165 2008-05-22 Simon Hausmann <hausmann@webkit.org>
9166
9167 Reviewed by Oliver.
9168
9169 Qt build fix.
9170
9171 * JavaScriptCore.pri: Added DebuggerCallFrame to the build.
9172 * VM/LabelID.h: Include limits.h for UINT_MAX.
9173 * wtf/VectorTraits.h: Include memory for std::auto_ptr.
9174
9175 2008-05-22 Geoffrey Garen <ggaren@apple.com>
9176
9177 Reviewed by Adam Roben.
9178
9179 Removed the old recursion guard mechanism, since squirrelfish has its
9180 own mechanism. Also removed some old JS call tracing code, since we
9181 have other ways to do that, too.
9182
9183 SunSpider reports no change.
9184
9185 * kjs/object.cpp:
9186 (KJS::JSObject::call):
9187
9188 2008-05-22 Maciej Stachowiak <mjs@apple.com>
9189
9190 Reviewed by Oliver.
9191
9192 - fixed <rdar://problem/5954979> crash on celtic kane JS benchmark
9193
9194 * kjs/nodes.cpp:
9195 (KJS::WithNode::emitCode):
9196 (KJS::TryNode::emitCode):
9197
9198 2008-05-21 Kevin McCullough <kmccullough@apple.com>
9199
9200 Reviewed by Maciej and Geoff.
9201
9202 <rdar://problem/5951561> Turn on JavaScript Profiler
9203 -As part of the effort to turn on the profiler it would be helpful if it
9204 did not need ExecStates to represent the stack location of the currently
9205 executing statement.
9206 -We now create each node as necessary with a reference to the current
9207 node and each node knows its parent so that the tree can be made without
9208 the entire stack.
9209
9210 * profiler/Profile.cpp:
9211 (KJS::Profile::Profile): The current node starts at the head.
9212 (KJS::Profile::stopProfiling): The current node is cleared when profiling
9213 stops.
9214 (KJS::Profile::willExecute): The current node either adds a new child or
9215 starts and returns a reference to an already existing child if the call
9216 ID that is requested already exists.
9217 (KJS::Profile::didExecute): The current node finishes and returns its
9218 parent.
9219 * profiler/Profile.h: Use a single callIdentifier instead of a vector
9220 since we no longer use the whole stack.
9221 * profiler/ProfileNode.cpp: Now profile nodes keep a reference to their
9222 parent.
9223 (KJS::ProfileNode::ProfileNode): Initialize the parent.
9224 (KJS::ProfileNode::didExecute): Record the time and return the parent.
9225 (KJS::ProfileNode::addOrStartChild): If the given callIdentifier is
9226 already a child, start it and return it, otherwise create a new one and
9227 return that.
9228 (KJS::ProfileNode::stopProfiling): Same logic, just use the new function.
9229 * profiler/ProfileNode.h: Utilize the parent.
9230 (KJS::ProfileNode::create):
9231 (KJS::ProfileNode::parent):
9232 * profiler/Profiler.cpp:
9233 (KJS::Profiler::startProfiling): Here is the only place where the
9234 ExecState is used to figure out where in the stack the profiler is
9235 currently profiling.
9236 (KJS::dispatchFunctionToProfiles): Only send one CallIdentifier instead
9237 of a vector of them.
9238 (KJS::Profiler::willExecute): Ditto.
9239 (KJS::Profiler::didExecute): Ditto.
9240 (KJS::createCallIdentifier): Create only one CallIdentifier.
9241 (KJS::createCallIdentifierFromFunctionImp): Ditto.
9242 * profiler/Profiler.h:
9243
9244 2008-05-21 Darin Adler <darin@apple.com>
9245
9246 Reviewed by Maciej.
9247
9248 - https://bugs.webkit.org/show_bug.cgi?id=19180
9249 speed up the < operator for the case when both values are integers
9250
9251 Makes standalone SunSpider 1.022x faster.
9252
9253 * VM/Machine.cpp:
9254 (KJS::jsLess): Add a special case for when both are numbers that fit in a JSImmediate.
9255
9256 2008-05-21 Maciej Stachowiak <mjs@apple.com>
9257
9258 Reviewed by Oliver and Sam.
9259
9260 - fixed <rdar://problem/5815631> REGRESSION (r31239): Multiscope optimisation of function calls results in incorrect this value (breaks tvtv.de)
9261
9262 Track global this value in the scope chain so we can retrieve it
9263 efficiently but it follows lexical scope properly.
9264
9265 * kjs/ExecState.h:
9266 (KJS::ExecState::globalThisValue):
9267 * kjs/JSGlobalObject.h:
9268 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
9269 * kjs/function_object.cpp:
9270 (KJS::FunctionObjectImp::construct):
9271 * kjs/scope_chain.h:
9272 (KJS::ScopeChainNode::ScopeChainNode):
9273 (KJS::ScopeChainNode::globalThisObject):
9274 (KJS::ScopeChainNode::push):
9275 (KJS::ScopeChain::ScopeChain):
9276
9277 2008-05-21 Kevin McCullough <kmccullough@apple.com>
9278
9279 Sadness :(
9280
9281 * kjs/config.h:
9282
9283 2008-05-21 Kevin McCullough <kmccullough@apple.com>
9284
9285 Reviewed by Maciej.
9286
9287 <rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
9288 profile node.
9289 - This patch updatest the times of the visible nodes correctly, but to do
9290 so, some of the design of the ProfileNode changed.
9291
9292 * JavaScriptCore.exp: export focus' symbol.
9293 * profiler/Profile.cpp: ProfileNodes now take a reference to the head of
9294 the profile tree to get up-to-date accurate total profile time.
9295 (KJS::Profile::Profile): Pass 0 for the head node.
9296 (KJS::Profile::stopProfiling): stopProfiling no longer needs the time
9297 passed into it, since it can get it from the head and it does not need to
9298 be told it is the head because it can figure it out on it's own.
9299 (KJS::Profile::willExecute): Set the head node for each created node.
9300 * profiler/Profile.h:
9301 (KJS::Profile::focus): Instead of taking a CallIdentifier that the caller
9302 would have to create, now focus() takes a ProfileNode that they should
9303 already have a reference to and focus() can extract the CallIdentifier
9304 from it.
9305 * profiler/ProfileNode.cpp: Create actual and visible versions fo the
9306 total and self times for focus and exclude. Also add a head node
9307 reference so that nodes can get information from their head.
9308 (KJS::ProfileNode::ProfileNode):
9309 (KJS::ProfileNode::stopProfiling): Rename the total and self time
9310 variables and set the visual ones to the actual ones, so that without any
9311 changes to the visual versions of these variables, their times will match
9312 the actual times.
9313 (KJS::ProfileNode::focus): Now focus() has a bool to force it's children
9314 to be visible if this node is visible. If this node does not match the
9315 CallIdentifier being focused then the visibleTotalTime is only updated if
9316 one or more of it's children is the CallIdentifier being focused.
9317 (KJS::ProfileNode::restoreAll): Restores all variables with respect to
9318 the visible data in the ProfileNode.
9319 (KJS::ProfileNode::endAndRecordCall): Name change.
9320 (KJS::ProfileNode::debugPrintData): Dump the new variables.
9321 (KJS::ProfileNode::debugPrintDataSampleStyle): Name change.
9322 * profiler/ProfileNode.h: Use the new variables and reference to the head
9323 node.
9324 (KJS::ProfileNode::create):
9325 (KJS::ProfileNode::totalTime):
9326 (KJS::ProfileNode::setTotalTime):
9327 (KJS::ProfileNode::selfTime):
9328 (KJS::ProfileNode::setSelfTime):
9329 (KJS::ProfileNode::totalPercent):
9330 (KJS::ProfileNode::selfPercent):
9331 (KJS::ProfileNode::setVisible):
9332
9333 2008-05-21 Alp Toker <alp@nuanti.com>
9334
9335 GTK+/UNIX testkjs build fix. Include signal.h.
9336
9337 * kjs/testkjs.cpp:
9338
9339 2008-05-21 Oliver Hunt <oliver@apple.com>
9340
9341 Yet more windows build fixes
9342
9343 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
9344
9345 2008-05-21 Oliver Hunt <oliver@apple.com>
9346
9347 Yet more windows build fixes
9348
9349 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
9350
9351 2008-05-21 Alp Toker <alp@nuanti.com>
9352
9353 GTK+ build fix. Add DebuggerCallFrame.cpp and take AllInOneFile.cpp
9354 changes into account.
9355
9356 * GNUmakefile.am:
9357
9358 2008-05-21 Oliver Hunt <oliver@apple.com>
9359
9360 Add DebuggerCallFrame.{h,cpp} to the project file
9361
9362 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
9363
9364 2008-05-21 Alp Toker <alp@nuanti.com>
9365
9366 GTK+ port build fixes following squirrelfish merge r33979.
9367
9368 * GNUmakefile.am:
9369
9370 2008-05-21 Maciej Stachowiak <mjs@apple.com>
9371
9372 Reviewed by Darin.
9373
9374 - save a hash lookup wne writing to global properties
9375 0.3% speedup on SunSpider, 7% on bitops-bitwise-and
9376
9377 * VM/Machine.cpp:
9378 (KJS::resolveBase): Check for being a the end of the scope chain
9379 before hash lookup.
9380
9381 2008-05-21 Alp Toker <alp@nuanti.com>
9382
9383 Rubber-stamped by Maciej.
9384
9385 Replace non-standard #pragma marks with comments to avoid compiler
9386 warnings.
9387
9388 * profiler/ProfileNode.cpp:
9389
9390 2008-05-21 Geoffrey Garen <ggaren@apple.com>
9391
9392 Reviewed by Mark Rowe.
9393
9394 Fix layout test failure in fast/dom/getter-on-window-object2 introduced in r33961.
9395
9396 * JavaScriptCore.exp:
9397 * kjs/JSGlobalObject.cpp:
9398 (KJS::JSGlobalObject::defineGetter):
9399 (KJS::JSGlobalObject::defineSetter):
9400 * kjs/JSGlobalObject.h:
9401
9402 === End merge of squirrelfish ===
9403
9404 2008-05-21 Geoffrey Garen <ggaren@apple.com>
9405
9406 Reviewed by Tim Hatcher.
9407
9408 Merged with trunk WebCore's new debugger.
9409
9410 * kjs/DebuggerCallFrame.cpp:
9411 (KJS::DebuggerCallFrame::evaluate): Changed this function to separate
9412 the exception value from the return value. The WebKit debugger treats
9413 them as one, but the WebCore debugger doesn't.
9414
9415 * kjs/DebuggerCallFrame.h:
9416 (KJS::DebuggerCallFrame::dynamicGlobalObject): Added a new accessor for
9417 the dynamic global object, since the debugger doesn't want the lexical
9418 global object.
9419
9420 2008-05-21 Oliver Hunt <oliver@apple.com>
9421
9422 Reviewed by Maciej.
9423
9424 Bug 19116: SquirrelFish shouldn't regress on variable lookups
9425 <https://bugs.webkit.org/show_bug.cgi?id=19116>
9426
9427 Optimise cross scope assignment, 0.4% progression in sunspider.
9428
9429 * VM/CodeBlock.cpp:
9430 (KJS::CodeBlock::dump):
9431 * VM/CodeGenerator.cpp:
9432 (KJS::CodeGenerator::emitPutScopedVar):
9433 * VM/CodeGenerator.h:
9434 * VM/Machine.cpp:
9435 (KJS::Machine::privateExecute):
9436 * VM/Opcode.h:
9437 * kjs/nodes.cpp:
9438 (KJS::AssignResolveNode::emitCode):
9439
9440 2008-05-21 Maciej Stachowiak <mjs@apple.com>
9441
9442 Reviewed by Oliver.
9443
9444 - check property map before symbol table in JSGlobalObject::getOwnPropertySlot
9445 0.5% speedup on SunSpider
9446
9447 * kjs/JSGlobalObject.h:
9448 (KJS::JSGlobalObject::getOwnPropertySlot): Check property map before symbol table
9449 because symbol table access is likely to have been optimized.
9450
9451 2008-05-21 Oliver Hunt <oliver@apple.com>
9452
9453 Reviewed by Maciej.
9454
9455 Bug 19116: SquirrelFish shouldn't regress on variable lookups
9456 <https://bugs.webkit.org/show_bug.cgi?id=19116>
9457
9458 Optimise multiscope lookup of statically resolvable function calls.
9459 SunSpider reports a 1.5% improvement, including 37% on
9460 controlflow-recursive for some reason :D
9461
9462 * VM/CodeBlock.cpp:
9463 (KJS::CodeBlock::dump):
9464 * VM/CodeGenerator.cpp:
9465 (KJS::CodeGenerator::emitResolve):
9466 * VM/CodeGenerator.h:
9467 * kjs/nodes.cpp:
9468 (KJS::FunctionCallResolveNode::emitCode):
9469
9470 2008-05-21 Maciej Stachowiak <mjs@apple.com>
9471
9472 Reviewed by Oliver.
9473
9474 - give JSGlobalObject a special version of getOwnPropertySlot that tells you if the slot is directly writable
9475 (WebCore change using this is a 2.6% speedup on in-browser SunSpider).
9476
9477 * JavaScriptCore.exp:
9478 * kjs/JSGlobalObject.h:
9479 (KJS::JSGlobalObject::getOwnPropertySlot):
9480 * kjs/JSVariableObject.h:
9481 (KJS::JSVariableObject::symbolTableGet):
9482 * kjs/object.h:
9483 (KJS::JSObject::getDirectLocation):
9484 (KJS::JSObject::getOwnPropertySlotForWrite):
9485 * kjs/property_map.cpp:
9486 (KJS::PropertyMap::getLocation):
9487 * kjs/property_map.h:
9488 * kjs/property_slot.h:
9489 (KJS::PropertySlot::putValue):
9490
9491 2008-05-20 Oliver Hunt <oliver@apple.com>
9492
9493 Reviewed by Maciej.
9494
9495 Bug 19116: SquirrelFish shouldn't regress on variable lookups
9496 <https://bugs.webkit.org/show_bug.cgi?id=19116>
9497
9498 This restores multiscope optimisation to simple resolve, producing
9499 a 2.6% progression in SunSpider. Have verified that none of the
9500 sites broken by the multiscope optimisation in trunk were effected
9501 by this change.
9502
9503 * VM/CodeBlock.cpp:
9504 (KJS::CodeBlock::dump):
9505 * VM/CodeBlock.h:
9506 (KJS::CodeBlock::CodeBlock):
9507 * VM/CodeGenerator.cpp:
9508 (KJS::CodeGenerator::findScopedProperty):
9509 (KJS::CodeGenerator::emitResolve):
9510 * VM/CodeGenerator.h:
9511 * VM/Machine.cpp:
9512 (KJS::resolve_n):
9513 (KJS::Machine::privateExecute):
9514 * VM/Opcode.h:
9515 * kjs/JSVariableObject.h:
9516
9517 2008-05-20 Oliver Hunt <oliver@apple.com>
9518
9519 Fixerate the windows build.
9520
9521 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
9522 * VM/CodeGenerator.cpp:
9523 * VM/RegisterFile.h:
9524 * kjs/JSGlobalObject.h:
9525 * kjs/Parser.cpp:
9526 * kjs/interpreter.h:
9527
9528 2008-05-20 Oliver Hunt <oliver@apple.com>
9529
9530 Reviewed by Geoff.
9531
9532 Bug 19110: SquirrelFish: Google Maps - no maps
9533 <https://bugs.webkit.org/show_bug.cgi?id=19110>
9534
9535 Correct a comedy of errors present in my original patch to "fix"
9536 exceptions occurring midway through pre and post increment. This
9537 solution is cleaner than the original, doesn't need the additional
9538 opcodes, and as an added benefit does not break Google Maps.
9539
9540 Sunspider reports a 0.4% progression.
9541
9542 * VM/CodeBlock.cpp:
9543 (KJS::CodeBlock::dump):
9544 * VM/CodeGenerator.cpp:
9545 * VM/CodeGenerator.h:
9546 * VM/Machine.cpp:
9547 (KJS::Machine::privateExecute):
9548 * VM/Opcode.h:
9549 * kjs/nodes.cpp:
9550 (KJS::PreIncResolveNode::emitCode):
9551 (KJS::PreDecResolveNode::emitCode):
9552 (KJS::PreIncBracketNode::emitCode):
9553 (KJS::PreDecBracketNode::emitCode):
9554 (KJS::PreIncDotNode::emitCode):
9555 (KJS::PreDecDotNode::emitCode):
9556
9557 2008-05-20 Maciej Stachowiak <mjs@apple.com>
9558
9559 Reviewed by Oliver.
9560
9561 - inline JSGlobalObject::getOwnPropertySlot
9562 1% improvement on in-browser SunSpider (a wash command-line)
9563
9564 * kjs/JSGlobalObject.cpp:
9565 * kjs/JSGlobalObject.h:
9566 (KJS::JSGlobalObject::getOwnPropertySlot):
9567
9568 2008-05-18 Oliver Hunt <oliver@apple.com>
9569
9570 Reviewed by Maciej.
9571
9572 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
9573 <https://bugs.webkit.org/show_bug.cgi?id=18752>
9574
9575 Handle exceptions thrown by toString conversion in subscript operators,
9576 this should basically complete exception handling in SquirrelFish.
9577
9578 Sunspider reports no regression.
9579
9580 * VM/Machine.cpp:
9581 (KJS::Machine::privateExecute):
9582
9583 2008-05-17 Geoffrey Garen <ggaren@apple.com>
9584
9585 Reviewed by Oliver Hunt.
9586
9587 [Reapplying patch with previously missing files from r33553 -- Oliver]
9588
9589 Behold: debugging.
9590
9591 SunSpider reports no change.
9592
9593 * JavaScriptCore.xcodeproj/project.pbxproj: Added DebuggerCallFrame.h/.cpp,
9594 and created a debugger folder.
9595
9596 * VM/CodeGenerator.cpp:
9597 (KJS::CodeGenerator::generate): If the debugger is attached, always
9598 generate full scope chains for its sake.
9599
9600 * VM/Machine.cpp:
9601 (KJS::Machine::unwindCallFrame): Notify the debugger when unwinding
9602 due to an exception, so it doesn't keep stale call frames around.
9603
9604 (KJS::Machine::execute): Set Callee to 0 in eval frames, so the
9605 debugger can distinguish them from function call frames.
9606
9607 (KJS::Machine::debug): Simplified this function, since the debugger
9608 doesn't actually need all the information we used to provide.
9609
9610 (KJS::Machine::privateExecute): Treat debugging hooks like other function
9611 calls, so the code we hook into (the debugger UI) can be optimized.
9612
9613 * kjs/debugger.cpp: Nixed these default callback implementations and
9614 made the callbacks pure virtual instead, so the compiler could tell me
9615 if I made a mistake in one of the subclasses.
9616
9617 * kjs/debugger.h: Removed a bunch of irrelevent data from the debugger
9618 callbacks. Changed from passing an ExecState* to passing a
9619 DebuggerCallFrame*, since an ExecState* doesn't contain sufficient
9620 information anymore.
9621
9622 * kjs/function.cpp:
9623 (KJS::globalFuncEval): Easiest bug fix evar!
9624
9625 [Previously missing files from r33553]
9626 * kjs/DebuggerCallFrame.cpp: Copied from JavaScriptCore/profiler/FunctionCallProfile.h.
9627 (KJS::DebuggerCallFrame::functionName):
9628 (KJS::DebuggerCallFrame::thisObject):
9629 (KJS::DebuggerCallFrame::evaluateScript):
9630 * kjs/DebuggerCallFrame.h: Copied from JavaScriptCore/VM/Register.h.
9631 (KJS::DebuggerCallFrame::DebuggerCallFrame):
9632 (KJS::DebuggerCallFrame::scopeChain):
9633 (KJS::DebuggerCallFrame::exception):
9634
9635 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
9636
9637 Reviewed by Oliver.
9638
9639 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
9640 <https://bugs.webkit.org/show_bug.cgi?id=18991>
9641
9642 Fix the last remaining blocking cases of this bug.
9643
9644 * kjs/grammar.y:
9645 * kjs/nodes.cpp:
9646 (KJS::ReadModifyResolveNode::emitCode):
9647
9648 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
9649
9650 Reviewed by Oliver.
9651
9652 Partial fix for:
9653
9654 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
9655 <https://bugs.webkit.org/show_bug.cgi?id=18991>
9656
9657 Ensure that the code generated for assignments uses temporaries whenever
9658 necessary. This patch covers the vast majority of situations, but there
9659 are still a few left.
9660
9661 This patch also adds some missing cases to CodeBlock::dump().
9662
9663 * VM/CodeBlock.cpp:
9664 (KJS::CodeBlock::dump):
9665 * VM/CodeGenerator.h:
9666 (KJS::CodeGenerator::destinationForAssignResult):
9667 (KJS::CodeGenerator::leftHandSideNeedsCopy):
9668 (KJS::CodeGenerator::emitNodeForLeftHandSide):
9669 * kjs/NodeInfo.h:
9670 * kjs/grammar.y:
9671 * kjs/nodes.cpp:
9672 (KJS::AssignDotNode::emitCode):
9673 (KJS::ReadModifyDotNode::emitCode):
9674 (KJS::AssignBracketNode::emitCode):
9675 (KJS::ReadModifyBracketNode::emitCode):
9676 (KJS::ForInNode::ForInNode):
9677 * kjs/nodes.h:
9678 (KJS::ReadModifyResolveNode::):
9679 (KJS::AssignResolveNode::):
9680 (KJS::ReadModifyBracketNode::):
9681 (KJS::AssignBracketNode::):
9682 (KJS::AssignDotNode::):
9683 (KJS::ReadModifyDotNode::):
9684
9685 2008-05-17 Oliver Hunt <oliver@apple.com>
9686
9687 Reviewed by Maciej.
9688
9689 Bug 19106: SquirrelFish: Activation is not marked correctly
9690 <https://bugs.webkit.org/show_bug.cgi?id=19106>
9691
9692 We can't rely on the symbol table for a count of the number of globals
9693 we need to mark as that misses duplicate parameters and 'this'. Now we
9694 use the actual local register count from the codeBlock.
9695
9696 * kjs/JSActivation.cpp:
9697 (KJS::JSActivation::mark):
9698
9699 2008-05-16 Oliver Hunt <oliver@apple.com>
9700
9701 Reviewed by Geoff.
9702
9703 Bug 19076: SquirrelFish: RegisterFile can be corrupted if implictly reenter global scope with no declared vars
9704 <https://bugs.webkit.org/show_bug.cgi?id=19076>
9705
9706 Don't delay allocation of initial global RegisterFile, as we can't guarantee we will be able
9707 to allocate the global 'this' register safely at any point after initialisation of the Global
9708 Object.
9709
9710 Unfortunately this initial allocation caused a regression of 0.2-0.3%, however this patch adds
9711 support for the static slot optimisation for the global Math object which brings it to a 0.3%
9712 progression.
9713
9714 * VM/CodeGenerator.cpp:
9715 (KJS::CodeGenerator::programCodeThis):
9716 (KJS::CodeGenerator::CodeGenerator):
9717 (KJS::CodeGenerator::addParameter):
9718 * VM/CodeGenerator.h:
9719 * VM/Machine.cpp:
9720 (KJS::Machine::execute):
9721 * kjs/ExecState.h:
9722 * kjs/JSGlobalObject.cpp:
9723 (KJS::JSGlobalObject::reset):
9724 * kjs/JSGlobalObject.h:
9725 (KJS::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
9726 (KJS::JSGlobalObject::addStaticGlobals):
9727 * kjs/nodes.cpp:
9728
9729 2008-05-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
9730
9731 Reviewed by Oliver Hunt.
9732
9733 Bug 19098: SquirrelFish: Ref'd temporaries can be clobbered
9734 <https://bugs.webkit.org/show_bug.cgi?id=19098>
9735
9736 When doing code generation for a statement list, increase the reference
9737 count on a register that might eventually be returned, so that it doesn't
9738 get clobbered by a request for a new temporary.
9739
9740 * kjs/nodes.cpp:
9741 (KJS::statementListEmitCode):
9742
9743 2008-05-16 Maciej Stachowiak <mjs@apple.com>
9744
9745 Reviewed by Oliver.
9746
9747 - fixed Bug 19044: SquirrelFish: Bogus values enter evaluation when closing over scope with parameter and var with same name
9748 https://bugs.webkit.org/show_bug.cgi?id=19044
9749
9750 * kjs/JSActivation.cpp:
9751 (KJS::JSActivation::copyRegisters): Use numLocals from the code
9752 block rather than the size of the symbol table for the number of
9753 registers to copy, to account for duplicate parameters and vars
9754 with the same name as parameters (we still have potentially
9755 suboptimal codegen in that we allocate a local register for the
9756 var in the latter case but it is never used).
9757
9758 2008-05-15 Geoffrey Garen <ggaren@apple.com>
9759
9760 Not reviewed.
9761
9762 We regret to inform you that your program is crashing because you were
9763 stupid.
9764
9765 * VM/Machine.cpp:
9766 (KJS::Machine::privateExecute): Math is hard.
9767
9768 2008-05-14 Geoffrey Garen <ggaren@apple.com>
9769
9770 Reviewed by Oliver Hunt.
9771
9772 A little more debugger action: filled in op_debug. All debugger control
9773 flow works now, but variable inspection and backtraces still don't.
9774
9775 SunSpider reports no change.
9776
9777 * VM/CodeGenerator.cpp: Changed op_debug to accept line number parameters.
9778
9779 * VM/Machine.cpp:
9780 (KJS::Machine::getFunctionAndArguments): Moved op_debug into a
9781 NEVER_INLINE function to avoid a stunning 10% performance regression.
9782 Also factored out a common function for retrieving the function and
9783 arguments from a call frame.
9784
9785 * kjs/JSActivation.cpp:
9786 (KJS::JSActivation::createArgumentsObject): Use the new factored out
9787 function mentioned above.
9788
9789 * kjs/Parser.cpp:
9790 (KJS::Parser::parse): Increment m_sourceId before assigning it, so the
9791 sourceId we send to the debugger matches the sourceId recorded in the
9792 node.
9793
9794 * kjs/nodes.cpp: Emit debugging hooks.
9795
9796 2008-05-14 Oliver Hunt <oliver@apple.com>
9797
9798 Reviewed by Maciej.
9799
9800 Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
9801 <https://bugs.webkit.org/show_bug.cgi?id=19024>
9802
9803 This fixes a number of issues. The most important is that we now check every register
9804 file for tainting rather than just looking for function register files as that was
9805 insufficient. Additionally guarded against implicit re-entry into Eval code.
9806
9807 Also added a few additional assertions to reduce the amout of time between something
9808 going wrong and us seeing the error.
9809
9810 * VM/Machine.cpp:
9811 (KJS::Machine::execute):
9812 (KJS::Machine::privateExecute):
9813 * VM/RegisterFile.cpp:
9814 (KJS::RegisterFile::growBuffer):
9815 (KJS::RegisterFile::addGlobalSlots):
9816 * VM/RegisterFileStack.cpp:
9817 (KJS::RegisterFileStack::pushGlobalRegisterFile):
9818 (KJS::RegisterFileStack::pushFunctionRegisterFile):
9819 * VM/RegisterFileStack.h:
9820 (KJS::RegisterFileStack::inImplicitCall):
9821
9822 2008-05-14 Geoffrey Garen <ggaren@apple.com>
9823
9824 Reviewed by Oliver Hunt.
9825
9826 A little more debugger action: emit opcodes for debugger hooks. Right
9827 now, the opcode implementation is just a stub.
9828
9829 SunSpider reports no change.
9830
9831 Some example codegen for "function f() { 1; }":
9832
9833 [ 0] dbg DidEnterCallFrame
9834 [ 2] dbg WillExecuteStatement
9835 [ 4] load tr0, 1(@k0)
9836 [ 7] load tr0, undefined(@k1)
9837 [ 10] dbg WillLeaveCallFrame
9838 [ 12] ret tr0
9839
9840 2008-05-14 Oliver Hunt <oliver@apple.com>
9841
9842 Reviewed by Geoff.
9843
9844 Bug 19025: SQUIRRELFISH: malformed syntax in onload handler causes crash
9845 <https://bugs.webkit.org/show_bug.cgi?id=19025>
9846
9847 Simple fix -- move the use of functionBodyNode to after the null check.
9848
9849 * kjs/function_object.cpp:
9850 (KJS::FunctionObjectImp::construct):
9851
9852 2008-05-13 Geoffrey Garen <ggaren@apple.com>
9853
9854 Reviewed by Oliver Hunt.
9855
9856 Fixed a codegen crash with run-time parse errors.
9857
9858 SunSpider reports no change.
9859
9860 emitThrowError needs to return the temporary holding the error, not dst,
9861 since dst may be NULL. In fact, emitThrowError shouldn't take a dst
9862 parameter at all, since exceptions should not modify the destination
9863 register.
9864
9865 2008-05-13 Oliver Hunt <oliver@apple.com>
9866
9867 Reviewed by Geoff.
9868
9869 Bug 19027: SquirrelFish: Incorrect codegen for pre-increment
9870 <https://bugs.webkit.org/show_bug.cgi?id=19027>
9871
9872 This fixes the codegen issues for the pre-inc/decrement operators
9873 to prevent incorrectly clobbering the destination in the event of
9874 an exception.
9875
9876 * VM/CodeBlock.cpp:
9877 (KJS::CodeBlock::dump):
9878 * VM/CodeGenerator.cpp:
9879 (KJS::CodeGenerator::emitPreInc):
9880 (KJS::CodeGenerator::emitPreDec):
9881 * VM/CodeGenerator.h:
9882 * VM/Machine.cpp:
9883 (KJS::Machine::privateExecute):
9884 * VM/Opcode.h:
9885 * kjs/nodes.cpp:
9886 (KJS::PreIncResolveNode::emitCode):
9887 (KJS::PreDecResolveNode::emitCode):
9888 (KJS::PreIncBracketNode::emitCode):
9889 (KJS::PreDecBracketNode::emitCode):
9890 (KJS::PreIncDotNode::emitCode):
9891 (KJS::PreDecDotNode::emitCode):
9892
9893 2008-05-13 Geoffrey Garen <ggaren@apple.com>
9894
9895 Reviewed by Oliver Hunt.
9896
9897 A little more debugger action: supply a real line number, sourceId,
9898 and sourceURL in op_new_error.
9899
9900 SunSpider reports a .2% speedup. Not sure what that's about.
9901
9902 * VM/Machine.cpp:
9903 (KJS::Machine::privateExecute): Use the new good stuff in op_new_error.
9904
9905 * kjs/nodes.cpp:
9906 (KJS::RegExpNode::emitCode): Use the shared emitThrowError instead of
9907 rolling our own.
9908
9909 2008-05-13 Geoffrey Garen <ggaren@apple.com>
9910
9911 Reviewed by Oliver Hunt.
9912
9913 A little more debugger action: implemented the exception callback.
9914
9915 SunSpider reports a .2% speedup. Not sure what that's about.
9916
9917 * VM/CodeBlock.h: A little refactoring here. Store a pointer to our
9918 owner ScopeNode so we can retrieve data from it. This allows us to
9919 stop storing copies of the data ourselves. Also, store a "this" register
9920 instead of a code type, since we were only using the code type to
9921 calculate the "this" register.
9922
9923 * VM/CodeGenerator.cpp:
9924 (KJS::CodeGenerator::generate): Calculate the "this" register mentioned
9925 above. Also, take care of removing "this" from the symbol table after
9926 codegen is done, since relying on the timing of a destructor for correct
9927 behavior is not so good.
9928
9929 * VM/Machine.cpp:
9930 (KJS::Machine::throwException): Invoke the debugger's exception callback.
9931 (KJS::Machine::privateExecute): Use the "this" register mentioned above.
9932
9933 2008-05-13 Geoffrey Garen <ggaren@apple.com>
9934
9935 Reviewed by Oliver Hunt.
9936
9937 Removed some unused exception machinery.
9938
9939 SunSpider reports a .3% speedup.
9940
9941 * API/JSCallbackObject.h:
9942 * API/JSCallbackObjectFunctions.h:
9943 * JavaScriptCore.exp:
9944 * VM/Machine.cpp:
9945 (KJS::Machine::privateExecute):
9946 * kjs/internal.cpp:
9947 * kjs/object.cpp:
9948 * kjs/object.h:
9949 * kjs/value.h:
9950
9951 2008-05-13 Geoffrey Garen <ggaren@apple.com>
9952
9953 Reviewed by Oliver Hunt.
9954
9955 A little more debugger action.
9956
9957 * kjs/debugger.cpp:
9958 * kjs/debugger.h: Removed debuggersPresent because it was unused.
9959 Replaced AttachedGlobalObject linked list with a HashSet because HashSet
9960 is faster and simpler. Changed all functions to return void instead of
9961 bool, because no clients ever return false, and we don't want to support
9962 it.
9963
9964 * kjs/nodes.cpp: Did some up-keep to avoid build bustage.
9965 (KJS::Node::handleException):
9966 (KJS::BreakpointCheckStatement::execute):
9967 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
9968
9969 2008-05-13 Oliver Hunt <oliver@apple.com>
9970
9971 Reviewed by Darin.
9972
9973 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
9974 <https://bugs.webkit.org/show_bug.cgi?id=18752>
9975
9976 Replace old attempt at "branchless" exceptions as the extra information
9977 being passed made gcc an unhappy compiler, replacing these custom toNumber
9978 calls with ordinary toNumber logic (by relying on toNumber now preventing
9979 side effects after an exception has been thrown) provided sufficient leeway
9980 to add the additional checks for the remaining unchecked cases.
9981
9982 This leaves only toString conversions in certain contexts as possibly
9983 misbehaving.
9984
9985 * VM/Machine.cpp:
9986 (KJS::jsAdd):
9987 (KJS::resolve):
9988 (KJS::resolveBaseAndProperty):
9989 (KJS::resolveBaseAndFunc):
9990 (KJS::Machine::privateExecute):
9991 * VM/Opcode.h:
9992 * kjs/value.h:
9993 (KJS::JSValue::safeGetNumber):
9994
9995 2008-05-13 Geoffrey Garen <ggaren@apple.com>
9996
9997 Reviewed by Oliver Hunt.
9998
9999 First steps toward supporting the debugger API: support the sourceParsed
10000 callback; plus some minor fixups.
10001
10002 SunSpider reports no regression.
10003
10004 * VM/CodeGenerator.h: Removed a misleading comment.
10005
10006 * kjs/Parser.h: Changed the parser to take an ExecState*, so it can
10007 implement the sourceParsed callback -- that way, we only have to
10008 implement the callback in one place.
10009
10010 * kjs/debugger.cpp: Nixed DebuggerImp, because its sole purpose in life
10011 was to demonstrate the misapplication of design patterns.
10012
10013 * kjs/debugger.h: Changed sourceParsed to take a SourceProvider, to
10014 reduce copying, and not to return a value, because pausing execution
10015 after parsing is complicated, and no clients needed that ability, anyway.
10016
10017 * kjs/grammar.y: Make sure never to pass a NULL SourceElements* to
10018 didFinishParsing -- that simplifies some code down the road.
10019
10020 * kjs/nodes.cpp: Don't generate special AST nodes just because the
10021 debugger is attached -- that's a relic of the old AST execution model,
10022 and those nodes haven't been maintained.
10023
10024 2008-05-13 Oliver Hunt <oliver@apple.com>
10025
10026 Reviewed by Geoff.
10027
10028 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
10029 <https://bugs.webkit.org/show_bug.cgi?id=18752>
10030
10031 First step: prevent incorrect evaluation of valueOf/toString conversion
10032 in right hand side of expression after earlier conversion throws.
10033
10034 * API/JSCallbackObjectFunctions.h:
10035 (KJS::::toNumber):
10036 * kjs/object.cpp:
10037 (KJS::JSObject::defaultValue):
10038
10039 2008-05-12 Oliver Hunt <oliver@apple.com>
10040
10041 Reviewed by Geoff.
10042
10043 Bug 18934: SQUIRRELFISH: ASSERT @ nytimes.com due to RegisterFile being clobbered
10044 <https://bugs.webkit.org/show_bug.cgi?id=18934>
10045
10046 Unfortunately we cannot create new statically optimised globals if there are any
10047 tainted RegisterFiles on the RegisterFileStack. To handle this we re-introduce
10048 (in a slightly cleaner form) the inImplicitCall concept to the RegisterFileStack.
10049
10050 * VM/Machine.cpp:
10051 (KJS::Machine::execute):
10052 * VM/RegisterFileStack.cpp:
10053 (KJS::RegisterFileStack::pushFunctionRegisterFile):
10054 * VM/RegisterFileStack.h:
10055
10056 2008-05-12 Geoffrey Garen <ggaren@apple.com>
10057
10058 Reviewed by Maciej Stachowiak.
10059
10060 Introduced support for function.caller.
10061
10062 Improved support for walking interesting scopes for function introspection.
10063
10064 This fixes all remaining layout tests not blocked by rebasing to trunk.
10065
10066 SunSpider reports no change.
10067
10068 * VM/Machine.cpp:
10069 (KJS::Machine::dumpRegisters): Fixed a spacing issue.
10070
10071 2008-05-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
10072
10073 Reviewed by Oliver.
10074
10075 Bug 18961: SQUIRRELFISH: Gmail doesn't load
10076 <https://bugs.webkit.org/show_bug.cgi?id=18961>
10077
10078 Fix codegen for logical nodes so that they don't use their destination
10079 as a temporary.
10080
10081 * kjs/nodes.cpp:
10082 (KJS::LogicalAndNode::emitCode):
10083 (KJS::LogicalOrNode::emitCode):
10084
10085 2008-05-10 Maciej Stachowiak <mjs@apple.com>
10086
10087 Reviewed by Oliver.
10088
10089 - JavaScriptCore part of fix for: "SQUIRRELFISH: function toString broken after calling"
10090 https://bugs.webkit.org/show_bug.cgi?id=18869
10091
10092 Three layout tests are fixed:
10093 fast/js/toString-elision-trailing-comma.html
10094 fast/js/toString-prefix-postfix-preserve-parens.html
10095 fast/js/kde/lval-exceptions.html
10096
10097 Functions now save a shared subrange of the original source used
10098 to make them (so in the common case this adds no storage above the
10099 memory cache).
10100
10101 * kjs/SourceProvider.h: Added.
10102 (KJS::SourceProvider): New abstract base class for classes that provide on-demand access
10103 to the source for a JavaScript program. This allows function objects to have access to their
10104 original source without copying.
10105 (KJS::UStringSourceProvider): SourceProvider subclass backed by a KJS::UString.
10106 (KJS::UStringSourceProvider::create):
10107 (KJS::UStringSourceProvider::getRange):
10108 (KJS::UStringSourceProvider::data):
10109 (KJS::UStringSourceProvider::length):
10110 (KJS::UStringSourceProvider::UStringSourceProvider):
10111 * kjs/SourceRange.h: Added.
10112 (KJS::SourceRange::SourceRange): Class that holds a SourceProvider and a character range into
10113 the source, to encapsulate on-demand access to the source of a function.
10114 (KJS::SourceRange::toString):
10115 * VM/Machine.cpp:
10116 (KJS::eval): Pass a UStringSourceProvider to the parser.
10117 * kjs/Parser.cpp:
10118 (KJS::Parser::parse): Take a SourceProvider and pass it on to the lexer.
10119 * kjs/Parser.h:
10120 (KJS::Parser::parse): Take a SourceProvider.
10121 * kjs/lexer.cpp:
10122 (KJS::Lexer::setCode): Take a SourceProvider; keep it around, and
10123 use it to get the raw buffer and length.
10124 * kjs/lexer.h:
10125 (KJS::Lexer::sourceRange): Convenience function to get a source
10126 range based on the lexer's source provieder, and char offsets
10127 right before and after the desired range.
10128 * kjs/function.cpp:
10129 (KJS::globalFuncEval): Pass a UStringSourceProvider to the parser.
10130 * kjs/function_object.cpp:
10131 (KJS::functionProtoFuncToString): Use toSourceString to get the source.
10132 (KJS::FunctionObjectImp::construct): Give the parser a UStringSourceProvider.
10133 * kjs/grammar.y: When parsing a function declaration, function
10134 expression, or getter or setter, tell the function body about its
10135 SourceRange.
10136 * kjs/interpreter.cpp:
10137 (KJS::Interpreter::checkSyntax): Pass a SourceProvider to the parser.
10138 (KJS::Interpreter::evaluate): Pass a SourceProvider to the parser.
10139 * kjs/interpreter.h:
10140 * kjs/nodes.h:
10141 (KJS::FunctionBodyNode::setSource): Establish a SourceRange for this function.
10142 (KJS::FunctionBodyNode::toSourceString): Get the source string out
10143 of the SourceRange.
10144 (KJS::FuncExprNode::): Take a SourceRange and set it on the body.
10145 (KJS::FuncDeclNode::): ditto
10146 * kjs/testkjs.cpp:
10147 (prettyPrintScript): Use a SourceProvider appropriately.
10148 * JavaScriptCore.exp: Export new symbols.
10149 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add new files.
10150 * JavaScriptCore.xcodeproj/project.pbxproj: Add new files.
10151
10152 2008-05-09 Oliver Hunt <oliver@apple.com>
10153
10154 Reviewed by Maciej.
10155
10156 Bring back RegisterFile tainting in order to correctly handle
10157 natively implemented getters and setters that re-enter JavaScript
10158
10159 * VM/Machine.cpp:
10160 (KJS::Machine::privateExecute):
10161 * VM/RegisterFile.h:
10162 * kjs/function.cpp:
10163 (KJS::FunctionImp::callAsFunction):
10164 * kjs/object.cpp:
10165 (KJS::JSObject::put):
10166 (KJS::tryGetAndCallProperty):
10167 * kjs/property_slot.cpp:
10168 (KJS::PropertySlot::functionGetter):
10169
10170 2008-05-09 Maciej Stachowiak <mjs@apple.com>
10171
10172 Reviewed by Oliver.
10173
10174 - track character offsets of open and close braces, in preparation for saving function source
10175
10176 I verified that there is no performance regression from this change.
10177
10178 * kjs/grammar.y:
10179 * kjs/lexer.cpp:
10180 (KJS::Lexer::lex):
10181 (KJS::Lexer::matchPunctuator):
10182 * kjs/lexer.h:
10183
10184 2008-05-09 Oliver Hunt <oliver@apple.com>
10185
10186 Debug build fix
10187
10188 * kjs/JSGlobalObject.cpp:
10189 (KJS::JSGlobalObject::restoreLocalStorage):
10190
10191 2008-05-09 Oliver Hunt <oliver@apple.com>
10192
10193 Reviewed by Geoff.
10194
10195 Build fixes for SquirrelFish on windows.
10196
10197 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
10198 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
10199 * VM/Register.h:
10200 * kjs/JSGlobalObject.cpp:
10201 (KJS::JSGlobalObject::restoreLocalStorage):
10202 * kjs/collector.cpp:
10203 (KJS::Collector::allocate):
10204 (KJS::Collector::allocateNumber):
10205 * kjs/collector.h:
10206 (KJS::Collector::allocate):
10207 (KJS::Collector::allocateNumber):
10208 * kjs/property_slot.cpp:
10209
10210 2008-05-08 Maciej Stachowiak <mjs@apple.com>
10211
10212 Reviewed by Geoff.
10213
10214 - fix activation tearoff in the case where functions are called with too many arguments
10215
10216 Fixes:
10217 fast/canvas/patternfill-repeat.html
10218 fast/dom/SelectorAPI/bug-17313.html
10219
10220 * VM/Machine.cpp:
10221 (KJS::slideRegisterWindowForCall):
10222 (KJS::scopeChainForCall):
10223 (KJS::Machine::execute):
10224 (KJS::Machine::privateExecute):
10225
10226 2008-05-08 Geoffrey Garen <ggaren@apple.com>
10227
10228 Reviewed by Oliver Hunt.
10229
10230 Fixed failure in fast/canvas/canvas-pattern-behaviour.html.
10231
10232 SunSpider reports a small speedup. Not sure what that's about.
10233
10234 * VM/CodeBlock.cpp:
10235 (KJS::CodeBlock::dump): Fixed op_call_eval to dump as "op_call_eval".
10236 This helped me while debugging.
10237
10238 * VM/Machine.cpp:
10239 (KJS::Machine::unwindCallFrame): When looking for an activation to tear
10240 off, don't use the scope chain. Inside eval, the scope chain doesn't
10241 belong to us; it belongs to our calling function.
10242
10243 Also, don't use the needsFullScopeChain flag to decide whether to tear
10244 off the activation. "function.arguments" can create an activation
10245 for a function whose needsFullScopeChain flag is set to false.
10246
10247 2008-05-08 Maciej Stachowiak <mjs@apple.com>
10248
10249 Reviewed by Oliver.
10250
10251 - fix function.call for calls of more than 8 arguments
10252
10253 Fixes svg/carto.net/button.svg
10254
10255 * kjs/list.cpp:
10256 (KJS::List::getSlice): properly set up the m_buffer of the target list.
10257
10258 2008-05-08 Maciej Stachowiak <mjs@apple.com>
10259
10260 Reviewed by Oliver.
10261
10262 - don't return a null RegisterID from RegExpNode in the exception case, since the caller may need a real register
10263
10264 Fixes:
10265 - fast/regex/early-acid3-86.html
10266 - http/tests/misc/acid3.html
10267
10268 * kjs/nodes.cpp:
10269 (KJS::RegExpNode::emitCode):
10270
10271 2008-05-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
10272
10273 Reviewed by Oliver.
10274
10275 Fix a performance regression caused by the introduction of property
10276 attributes to SymbolTable in r32859 by encoding the attributes and the
10277 register index into a single field of SymbolTableEntry.
10278
10279 This leaves Node::optimizeVariableAccess() definitely broken, although
10280 it was probably not entirely correct in SquirrelFish before this change.
10281
10282 * VM/CodeBlock.h:
10283 (KJS::missingThisObjectMarker):
10284 * VM/CodeGenerator.cpp:
10285 (KJS::CodeGenerator::addVar):
10286 (KJS::CodeGenerator::CodeGenerator):
10287 (KJS::CodeGenerator::registerForLocal):
10288 (KJS::CodeGenerator::registerForLocalConstInit):
10289 (KJS::CodeGenerator::isLocalConstant):
10290 (KJS::CodeGenerator::addConstant):
10291 (KJS::CodeGenerator::emitCall):
10292 * VM/CodeGenerator.h:
10293 (KJS::CodeGenerator::IdentifierMapIndexHashTraits::emptyValue):
10294 * VM/Machine.cpp:
10295 (KJS::Machine::privateExecute):
10296 * kjs/JSGlobalObject.cpp:
10297 (KJS::JSGlobalObject::saveLocalStorage):
10298 * kjs/JSVariableObject.cpp:
10299 (KJS::JSVariableObject::getPropertyNames):
10300 (KJS::JSVariableObject::getPropertyAttributes):
10301 * kjs/JSVariableObject.h:
10302 (KJS::JSVariableObject::symbolTableGet):
10303 (KJS::JSVariableObject::symbolTablePut):
10304 (KJS::JSVariableObject::symbolTablePutWithAttributes):
10305 * kjs/SymbolTable.h:
10306 (KJS::SymbolTableEntry::SymbolTableEntry):
10307 (KJS::SymbolTableEntry::isEmpty):
10308 (KJS::SymbolTableEntry::getIndex):
10309 (KJS::SymbolTableEntry::getAttributes):
10310 (KJS::SymbolTableEntry::setAttributes):
10311 (KJS::SymbolTableEntry::isReadOnly):
10312 * kjs/nodes.cpp:
10313 (KJS::getSymbolTableEntry):
10314 (KJS::PostIncResolveNode::optimizeVariableAccess):
10315 (KJS::PostDecResolveNode::optimizeVariableAccess):
10316 (KJS::DeleteResolveNode::optimizeVariableAccess):
10317 (KJS::TypeOfResolveNode::optimizeVariableAccess):
10318 (KJS::PreIncResolveNode::optimizeVariableAccess):
10319 (KJS::PreDecResolveNode::optimizeVariableAccess):
10320 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
10321 (KJS::AssignResolveNode::optimizeVariableAccess):
10322 (KJS::ProgramNode::initializeSymbolTable):
10323
10324 2008-05-06 Maciej Stachowiak <mjs@apple.com>
10325
10326 Rubber stamped by Oliver.
10327
10328 - add missing ! in an assert that I failed to reverse
10329
10330 * VM/CodeGenerator.cpp:
10331 (KJS::CodeGenerator::CodeGenerator):
10332
10333 2008-05-06 Maciej Stachowiak <mjs@apple.com>
10334
10335 Reviewed by Oliver.
10336
10337 - fixed "SQUIRRELFISH: window.this shows up as a property, but it shouldn't"
10338 https://bugs.webkit.org/show_bug.cgi?id=18868
10339
10340 The basic approach is to have "this" only be present in the symbol
10341 table at compile time, not runtime.
10342
10343 * VM/CodeGenerator.cpp:
10344 (KJS::CodeGenerator::~CodeGenerator): Remove "this" from symbol table.
10345 (KJS::CodeGenerator::CodeGenerator): Add "this" back when re-using
10346 a symbol table.
10347 * VM/CodeGenerator.h:
10348 * VM/Machine.cpp:
10349 (KJS::Machine::execute): Don't assert that "this" is in the symbol table.
10350
10351 2008-05-06 Geoffrey Garen <ggaren@apple.com>
10352
10353 Reviewed by Oliver Hunt.
10354
10355 Trivial support for function.arguments: Currently, we only support
10356 function.arguments from within the scope of function.
10357
10358 This fixes the remaining Mozilla JS test failures.
10359
10360 SunSpider reports no change.
10361
10362 * JavaScriptCore.exp:
10363
10364 * VM/Machine.cpp:
10365 (KJS::Machine::privateExecute): Separated scope chain deref from
10366 activation register copying: since it is now possible for client code
10367 to create an activation on behalf of a function that otherwise wouldn't
10368 need one, having an activation no longer necessarily means that you need
10369 to deref the scope chain.
10370
10371 (KJS::Machine::getCallFrame): For now, this function only examines the
10372 current scope. Walking parent scopes requires some refactoring in the
10373 way we track execution stacks.
10374
10375 * kjs/ExecState.cpp:
10376 (KJS::ExecState::ExecState): We use a negative call frame offset to
10377 indicate that a given scope is not a function call scope.
10378
10379 2008-05-05 Oliver Hunt <oliver@apple.com>
10380
10381 Reviewed by Geoff.
10382
10383 Fix call frame set up for native -> JS function calls.
10384
10385 * VM/Machine.cpp:
10386 (KJS::Machine::execute):
10387
10388 2008-05-05 Geoffrey Garen <ggaren@apple.com>
10389
10390 Reviewed by Maciej Stachowiak.
10391
10392 Fixed ecma_3/Object/8.6.2.6-001.js, and similar bugs.
10393
10394 SunSpider reports a .4% speedup. Not sure what that's about.
10395
10396 * VM/Machine.cpp:
10397 (KJS::Machine::privateExecute): Check for exception return from equal,
10398 since toPrimitive can throw.
10399
10400 * kjs/operations.cpp:
10401 (KJS::strictEqual): In response to an error I made in an earlier version
10402 of this patch, I changed strictEqual to make clear the fact that it
10403 performs no conversions and can't throw, making it slightly more efficient
10404 in the process.
10405
10406 2008-05-05 Maciej Stachowiak <mjs@apple.com>
10407
10408 Reviewed by Oliver.
10409
10410 - fix some dumb mistakes in my last patch
10411
10412 * VM/CodeGenerator.cpp:
10413 (KJS::CodeGenerator::emitPushScope):
10414 (KJS::CodeGenerator::emitGetPropertyNames):
10415 * VM/Machine.cpp:
10416 (KJS::Machine::privateExecute):
10417
10418 2008-05-05 Maciej Stachowiak <mjs@apple.com>
10419
10420 Reviewed by Oliver.
10421
10422 - document opcodes relating to jumps, scopes, and property name iteration
10423
10424 Documented jmp, jtrue, false, push_scope, pop_scope, get_pnames,
10425 next_pname and jmp_scopes.
10426
10427 * VM/CodeGenerator.cpp:
10428 (KJS::CodeGenerator::emitJump):
10429 (KJS::CodeGenerator::emitJumpIfTrue):
10430 (KJS::CodeGenerator::emitJumpIfFalse):
10431 (KJS::CodeGenerator::emitPushScope):
10432 (KJS::CodeGenerator::emitNextPropertyName):
10433 (KJS::CodeGenerator::emitGetPropertyNames):
10434 * VM/CodeGenerator.h:
10435 * VM/Machine.cpp:
10436 (KJS::Machine::privateExecute):
10437 * kjs/nodes.cpp:
10438 (KJS::LogicalAndNode::emitCode):
10439 (KJS::LogicalOrNode::emitCode):
10440 (KJS::ConditionalNode::emitCode):
10441 (KJS::IfNode::emitCode):
10442 (KJS::IfElseNode::emitCode):
10443 (KJS::DoWhileNode::emitCode):
10444 (KJS::WhileNode::emitCode):
10445 (KJS::ForNode::emitCode):
10446 (KJS::ForInNode::emitCode):
10447 (KJS::WithNode::emitCode):
10448
10449 2008-05-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
10450
10451 Reviewed by Oliver.
10452
10453 Bug 18749: SQUIRRELFISH: const support is broken
10454 <https://bugs.webkit.org/show_bug.cgi?id=18749>
10455
10456 Adds support for const during code generation.
10457
10458 Fixes 2 layout tests.
10459
10460 * ChangeLog:
10461 * VM/CodeGenerator.cpp:
10462 (KJS::CodeGenerator::addVar):
10463 (KJS::CodeGenerator::CodeGenerator):
10464 (KJS::CodeGenerator::isLocalConstant):
10465 * VM/CodeGenerator.h:
10466 (KJS::CodeGenerator::addVar):
10467 * kjs/nodes.cpp:
10468 (KJS::PostIncResolveNode::emitCode):
10469 (KJS::PostDecResolveNode::emitCode):
10470 (KJS::PreIncResolveNode::emitCode):
10471 (KJS::PreDecResolveNode::emitCode):
10472 (KJS::ReadModifyResolveNode::emitCode):
10473 (KJS::AssignResolveNode::emitCode):
10474
10475 2008-05-04 Maciej Stachowiak <mjs@apple.com>
10476
10477 Reviewed by Geoff.
10478
10479 - document some more opcodes (and fix argument names)
10480
10481 Added docs for eq, neq, stricteq, nstriceq, less and lesseq.
10482
10483 * VM/CodeGenerator.cpp:
10484 (KJS::CodeGenerator::emitEqual):
10485 (KJS::CodeGenerator::emitNotEqual):
10486 (KJS::CodeGenerator::emitStrictEqual):
10487 (KJS::CodeGenerator::emitNotStrictEqual):
10488 (KJS::CodeGenerator::emitLess):
10489 (KJS::CodeGenerator::emitLessEq):
10490 * VM/CodeGenerator.h:
10491 * VM/Machine.cpp:
10492 (KJS::Machine::privateExecute):
10493 * kjs/nodes.cpp:
10494 (KJS::LessNode::emitCode):
10495 (KJS::GreaterNode::emitCode):
10496 (KJS::LessEqNode::emitCode):
10497 (KJS::GreaterEqNode::emitCode):
10498 (KJS::EqualNode::emitCode):
10499 (KJS::NotEqualNode::emitCode):
10500 (KJS::StrictEqualNode::emitCode):
10501 (KJS::NotStrictEqualNode::emitCode):
10502 (KJS::CaseBlockNode::emitCodeForBlock):
10503
10504 2008-05-04 Geoffrey Garen <ggaren@apple.com>
10505
10506 Reviewed by Maciej Stachowiak.
10507
10508 More scaffolding for f.arguments.
10509
10510 Track the offset of the last call frame in the ExecState, so we can
10511 produce a backtrace at any time.
10512
10513 Also, record numLocals, the sum of numVars + numParameters, in each code
10514 block, to make updates to the ExecState a little cheaper than they
10515 would be otherwise.
10516
10517 We now use numLocals in a bunch of places where we used to calculate
10518 numVars + numParameters or -numVars - numParameters.
10519
10520 Reports are mixed, but all in all, this seems to be a wash on SunSpider.
10521
10522 2008-05-04 Oliver Hunt <oliver@apple.com>
10523
10524 Reviewed by Geoff.
10525
10526 Whoops, correctly handle properties that don't exist in the
10527 symbol table.
10528
10529 * kjs/JSVariableObject.h:
10530 (KJS::JSVariableObject::symbolTablePutWithAttributes):
10531
10532 2008-05-04 Oliver Hunt <oliver@apple.com>
10533
10534 Reviewed by Geoff.
10535
10536 Add attribute information to SymbolTable as ground work for
10537 various DontEnum and ReadOnly issues.
10538
10539 * VM/CodeGenerator.cpp:
10540 (KJS::CodeGenerator::addVar):
10541 (KJS::CodeGenerator::CodeGenerator):
10542 (KJS::CodeGenerator::registerForLocal):
10543 (KJS::CodeGenerator::registerForLocalConstInit):
10544 (KJS::CodeGenerator::addConstant):
10545 * VM/Machine.cpp:
10546 (KJS::Machine::execute):
10547 * kjs/JSGlobalObject.cpp:
10548 (KJS::JSGlobalObject::saveLocalStorage):
10549 * kjs/JSVariableObject.cpp:
10550 (KJS::JSVariableObject::getPropertyNames):
10551 (KJS::JSVariableObject::getPropertyAttributes):
10552 * kjs/JSVariableObject.h:
10553 (KJS::JSVariableObject::symbolTablePut):
10554 (KJS::JSVariableObject::symbolTablePutWithAttributes):
10555 * kjs/SymbolTable.h:
10556 (KJS::SymbolTableEntry::SymbolTableEntry):
10557 (KJS::SymbolTableIndexHashTraits::emptyValue):
10558 * kjs/nodes.cpp:
10559 (KJS::getSymbolTableEntry):
10560 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
10561 (KJS::AssignResolveNode::optimizeVariableAccess):
10562 (KJS::ProgramNode::initializeSymbolTable):
10563
10564 2008-05-04 Geoffrey Garen <ggaren@apple.com>
10565
10566 Reviewed by Oliver Hunt.
10567
10568 More scaffolding for f.arguments.
10569
10570 Store the register file associated with an ExecState in the ExecState.
10571
10572 SunSpider reports no change.
10573
10574 * kjs/JSGlobalObject.h:
10575 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Moved
10576 registerFileStack above globalExec, so it gets initialized first.
10577 Removed remnants of old activation scheme.
10578
10579 2008-05-04 Maciej Stachowiak <mjs@apple.com>
10580
10581 Rubber stamped by Oliver.
10582
10583 - renamed a few opcodes and fixed assembly formatting to accomodate the longest opcode
10584
10585 equal --> eq
10586 nequal --> neq
10587 resolve_base_and_property --> resolve_with_base
10588 resolve_base_and_func --> resolve_func
10589 get_prop_id --> get_by_id
10590 put_prop_id --> put_by_id
10591 delete_prop_id --> del_by_id
10592 get_prop_val --> get_by_val
10593 put_prop_val --> put_by_val
10594 delete_prop_val --> del_by_val
10595 put_prop_index --> put_by_index
10596
10597 * VM/CodeBlock.cpp:
10598 (KJS::printUnaryOp):
10599 (KJS::printBinaryOp):
10600 (KJS::printConditionalJump):
10601 (KJS::CodeBlock::dump):
10602 * VM/CodeGenerator.cpp:
10603 (KJS::CodeGenerator::emitEqual):
10604 (KJS::CodeGenerator::emitNotEqual):
10605 (KJS::CodeGenerator::emitResolveWithBase):
10606 (KJS::CodeGenerator::emitResolveFunction):
10607 (KJS::CodeGenerator::emitGetById):
10608 (KJS::CodeGenerator::emitPutById):
10609 (KJS::CodeGenerator::emitDeleteById):
10610 (KJS::CodeGenerator::emitGetByVal):
10611 (KJS::CodeGenerator::emitPutByVal):
10612 (KJS::CodeGenerator::emitDeleteByVal):
10613 (KJS::CodeGenerator::emitPutByIndex):
10614 * VM/CodeGenerator.h:
10615 * VM/Machine.cpp:
10616 (KJS::Machine::privateExecute):
10617 * VM/Opcode.h:
10618 * kjs/nodes.cpp:
10619 (KJS::ArrayNode::emitCode):
10620 (KJS::PropertyListNode::emitCode):
10621 (KJS::BracketAccessorNode::emitCode):
10622 (KJS::DotAccessorNode::emitCode):
10623 (KJS::EvalFunctionCallNode::emitCode):
10624 (KJS::FunctionCallResolveNode::emitCode):
10625 (KJS::FunctionCallBracketNode::emitCode):
10626 (KJS::FunctionCallDotNode::emitCode):
10627 (KJS::PostIncResolveNode::emitCode):
10628 (KJS::PostDecResolveNode::emitCode):
10629 (KJS::PostIncBracketNode::emitCode):
10630 (KJS::PostDecBracketNode::emitCode):
10631 (KJS::PostIncDotNode::emitCode):
10632 (KJS::PostDecDotNode::emitCode):
10633 (KJS::DeleteResolveNode::emitCode):
10634 (KJS::DeleteBracketNode::emitCode):
10635 (KJS::DeleteDotNode::emitCode):
10636 (KJS::TypeOfResolveNode::emitCode):
10637 (KJS::PreIncResolveNode::emitCode):
10638 (KJS::PreDecResolveNode::emitCode):
10639 (KJS::PreIncBracketNode::emitCode):
10640 (KJS::PreDecBracketNode::emitCode):
10641 (KJS::PreIncDotNode::emitCode):
10642 (KJS::PreDecDotNode::emitCode):
10643 (KJS::ReadModifyResolveNode::emitCode):
10644 (KJS::AssignResolveNode::emitCode):
10645 (KJS::AssignDotNode::emitCode):
10646 (KJS::ReadModifyDotNode::emitCode):
10647 (KJS::AssignBracketNode::emitCode):
10648 (KJS::ReadModifyBracketNode::emitCode):
10649 (KJS::ConstDeclNode::emitCodeSingle):
10650 (KJS::ForInNode::emitCode):
10651 (KJS::TryNode::emitCode):
10652
10653 2008-05-04 Oliver Hunt <oliver@apple.com>
10654
10655 Reviewed by Maciej.
10656
10657 Fix assertion when accessing arguments object with too many arguments provided
10658
10659 The arguments constructor was assuming that the register offset given for argv
10660 was an absolute offset into the registerfile, rather than the offset from the
10661 frame. This patches corrects that issue.
10662
10663 * kjs/JSActivation.cpp:
10664 (KJS::JSActivation::createArgumentsObject):
10665
10666 2008-05-04 Geoffrey Garen <ggaren@apple.com>
10667
10668 Rubber stamped by Sam Weinig.
10669
10670 Cleaned up Machine.cpp according to our style guidelines: moved static
10671 data to the top of the file; moved stand-alone functions below that;
10672 moved the Machine constructor above other Machine member functions.
10673
10674 2008-05-03 Maciej Stachowiak <mjs@apple.com>
10675
10676 Reviewed by Sam.
10677
10678 - fix accidental breakage from last patch
10679
10680 * VM/Machine.cpp:
10681 (KJS::Machine::privateExecute):
10682
10683 2008-05-03 Maciej Stachowiak <mjs@apple.com>
10684
10685 Reviewed by Geoff.
10686
10687 - a bunch more opcode documentation and corresponding parameter name fixes
10688
10689 I renamed a few opcodes:
10690
10691 type_of --> typeof (that's what the JS operator is named)
10692 instance_of --> instanceof (ditto)
10693 create_error --> new_error (for consistency with other new_* opcodes)
10694
10695 I documented the following opcodes:
10696
10697 - load
10698 - new_object
10699 - new_array
10700 - new_regexp
10701 - mov
10702 - pre_inc
10703 - pre_dec
10704 - post_inc
10705 - post_dec
10706 - to_jsnumber
10707 - negate
10708 - bitnot
10709 - not
10710 - instanceof
10711 - typeof
10712 - in
10713 - new_func
10714 - new_funcexp
10715 - new_error
10716
10717 I also fixed formatting on some existing opcode docs.
10718
10719 * VM/CodeBlock.cpp:
10720 (KJS::CodeBlock::dump):
10721 * VM/CodeGenerator.cpp:
10722 (KJS::CodeGenerator::emitMove):
10723 (KJS::CodeGenerator::emitNot):
10724 (KJS::CodeGenerator::emitPreInc):
10725 (KJS::CodeGenerator::emitPreDec):
10726 (KJS::CodeGenerator::emitPostInc):
10727 (KJS::CodeGenerator::emitPostDec):
10728 (KJS::CodeGenerator::emitToJSNumber):
10729 (KJS::CodeGenerator::emitNegate):
10730 (KJS::CodeGenerator::emitBitNot):
10731 (KJS::CodeGenerator::emitInstanceOf):
10732 (KJS::CodeGenerator::emitTypeOf):
10733 (KJS::CodeGenerator::emitIn):
10734 (KJS::CodeGenerator::emitLoad):
10735 (KJS::CodeGenerator::emitNewObject):
10736 (KJS::CodeGenerator::emitNewArray):
10737 (KJS::CodeGenerator::emitNewRegExp):
10738 (KJS::CodeGenerator::emitNewError):
10739 * VM/CodeGenerator.h:
10740 (KJS::CodeGenerator::scopeDepth):
10741 (KJS::CodeGenerator::addVar):
10742 * VM/Machine.cpp:
10743 (KJS::Machine::privateExecute):
10744 * VM/Opcode.h:
10745 * kjs/nodes.cpp:
10746 (KJS::Node::emitThrowError):
10747 (KJS::RegExpNode::emitCode):
10748 (KJS::TypeOfValueNode::emitCode):
10749 (KJS::UnaryPlusNode::emitCode):
10750 (KJS::NegateNode::emitCode):
10751 (KJS::BitwiseNotNode::emitCode):
10752 (KJS::LogicalNotNode::emitCode):
10753 (KJS::InstanceOfNode::emitCode):
10754 (KJS::InNode::emitCode):
10755
10756 2008-05-03 Maciej Stachowiak <mjs@apple.com>
10757
10758 Reviewed by Geoff and Sam.
10759
10760 - generate HTML bytecode docs at build time
10761
10762 * DerivedSources.make:
10763 * docs: Added.
10764 * docs/make-bytecode-docs.pl: Added.
10765
10766 2008-05-03 Geoffrey Garen <ggaren@apple.com>
10767
10768 Reviewed by Sam Weinig.
10769
10770 Update ExecState::m_scopeChain when switching scope chains inside the
10771 machine.
10772
10773 This fixes uses of lexicalGlobalObject, such as, in a subframe
10774
10775 alert(top.makeArray() instanceof Array ? "FAIL" : "PASS");
10776
10777 and a bunch of the security failures listed in
10778 https://bugs.webkit.org/show_bug.cgi?id=18870. (Those tests still fail,
10779 seemingly because of regressions in exception messages).
10780
10781 SunSpider reports no change.
10782
10783 * VM/Machine.cpp: Factored out scope chain updating into a common
10784 function that takes care to update ExecState::m_scopeChain, too.
10785
10786 * kjs/ExecState.h: I made Machine a friend of ExecState so that Machine
10787 could update ExecState::m_scopeChain, even though that value is
10788 read-only for everyone else.
10789
10790 * kjs/JSGlobalObject.h:
10791 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Changed
10792 this client to be a little friendlier to ExecState's internal
10793 storage type for scope chain data.
10794
10795 2008-05-03 Geoffrey Garen <ggaren@apple.com>
10796
10797 Reviewed by Sam Weinig.
10798
10799 Fixed https://bugs.webkit.org/show_bug.cgi?id=18876
10800 Squirrelfish: ScopeChainNode leak in op_jmp_scopes.
10801
10802 SunSpider reports no change.
10803
10804 * VM/Machine.cpp:
10805 (KJS::Machine::privateExecute): Don't construct a ScopeChain object,
10806 since the direct threaded interpreter will goto across its destructor.
10807
10808 2008-05-03 Geoffrey Garen <ggaren@apple.com>
10809
10810 Reviewed by Oliver Hunt.
10811
10812 A bit more efficient fix than r32832: Don't copy globals into function
10813 register files; instead, have the RegisterFileStack track only the base
10814 of the last *global* register file, so the global object's register
10815 references stay good.
10816
10817 SunSpider reports a .3% speedup. Not sure what that's about.
10818
10819 2008-05-03 Oliver Hunt <oliver@apple.com>
10820
10821 Reviewed by Maciej.
10822
10823 Bug 18864: SquirrelFish: Support getter and setter definition in object literals
10824 <https://bugs.webkit.org/show_bug.cgi?id=18864>
10825
10826 Add new opcodes to allow us to add getters and setters to an object. These are
10827 only used by the codegen for object literals.
10828
10829 * VM/CodeGenerator.cpp:
10830 (KJS::CodeGenerator::emitPutGetter):
10831 (KJS::CodeGenerator::emitPutSetter):
10832 * VM/CodeGenerator.h:
10833 * VM/Machine.cpp:
10834 (KJS::Machine::privateExecute):
10835 * VM/Opcode.h:
10836 * kjs/nodes.cpp:
10837 (KJS::PropertyListNode::emitCode):
10838
10839 2008-05-02 Maciej Stachowiak <mjs@apple.com>
10840
10841 Reviewed by Oliver.
10842
10843 - properly copy globals into and out of implicit call register
10844 files, otherwise they will fail at global lookup
10845
10846 Fixes fast/js/array-tostring-and-join.html layout test.
10847
10848 * VM/RegisterFileStack.cpp:
10849 (KJS::RegisterFileStack::pushGlobalRegisterFile):
10850 (KJS::RegisterFileStack::popGlobalRegisterFile):
10851 (KJS::RegisterFileStack::pushFunctionRegisterFile):
10852 (KJS::RegisterFileStack::popFunctionRegisterFile):
10853
10854 2008-05-02 Geoffrey Garen <ggaren@apple.com>
10855
10856 Reviewed by Oliver Hunt.
10857
10858 Fixed https://bugs.webkit.org/show_bug.cgi?id=18822
10859 SQUIRRELFISH: incorrect eval used in some cases
10860
10861 Changed all code inside the machine to fetch the lexical global object
10862 directly from the scope chain, instead of from the ExecState.
10863
10864 Clients who fetch the lexical global object through the ExecState
10865 still don't work.
10866
10867 SunSpider reports no change.
10868
10869 * VM/Machine.cpp:
10870 (KJS::Machine::privateExecute): Fetch the lexical global object from
10871 the scope chain.
10872
10873 * kjs/ExecState.h:
10874 (KJS::ExecState::ExecState::lexicalGlobalObject): Moved the logic for
10875 this function into ScopeChainNode, but kept this function around to
10876 support existing clients.
10877
10878 2008-05-02 Geoffrey Garen <ggaren@apple.com>
10879
10880 Rubber stamped by Oliver Hunt.
10881
10882 Removed ExecState.cpp from AllInOneFile.cpp, for a .2% speedup.
10883
10884 * JavaScriptCore.xcodeproj/project.pbxproj:
10885 * kjs/AllInOneFile.cpp:
10886
10887 2008-05-01 Oliver Hunt <oliver@apple.com>
10888
10889 Reviewed by Geoff and Maciej.
10890
10891 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
10892 <https://bugs.webkit.org/show_bug.cgi?id=18827>
10893
10894 Remove safe/unsafe RegisterFile concept, and instead just add additional
10895 logic to ensure we always push/pop RegisterFiles when executing getters
10896 and setters, similar to the logic for valueOf and toString.
10897
10898 * VM/Machine.cpp:
10899 (KJS::Machine::privateExecute):
10900 * VM/RegisterFile.h:
10901 * kjs/function.cpp:
10902 (KJS::FunctionImp::callAsFunction):
10903 * kjs/object.cpp:
10904 (KJS::JSObject::put):
10905 * kjs/property_slot.cpp:
10906 (KJS::PropertySlot::functionGetter):
10907
10908 2008-05-01 Oliver Hunt <oliver@apple.com>
10909
10910 RS=Geoff
10911
10912 Rename unsafeForReentry to safeForReentry to avoid double negatives.
10913
10914 * VM/Machine.cpp:
10915 (KJS::Machine::privateExecute):
10916 * VM/RegisterFile.h:
10917 * kjs/function.cpp:
10918 (KJS::FunctionImp::callAsFunction):
10919
10920 2008-05-01 Oliver Hunt <oliver@apple.com>
10921
10922 Reviewed by Maciej.
10923
10924 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
10925 <https://bugs.webkit.org/show_bug.cgi?id=18827>
10926
10927 This patch makes getters and setters work. It does this by
10928 tracking whether the RegisterFile is "safe", that is whether
10929 the interpreter is in a state that in which it can handle
10930 the RegisterFile being reallocated.
10931
10932 * VM/Machine.cpp:
10933 (KJS::resolve):
10934 (KJS::Machine::privateExecute):
10935 * VM/RegisterFile.h:
10936 * kjs/function.cpp:
10937 (KJS::FunctionImp::callAsFunction):
10938
10939 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10940
10941 Release build fix: Always compile in "isGlobalObject", since it's
10942 listed in our .exp file.
10943
10944 * kjs/ExecState.cpp:
10945 (KJS::ExecState::isGlobalObject):
10946 * kjs/ExecState.h:
10947
10948 2008-04-30 Oliver Hunt <oliver@apple.com>
10949
10950 Reviewed by Maciej.
10951
10952 Minor code restructuring to prepare for getters and setters,
10953 also helps exception semantics a bit.
10954
10955 * VM/Machine.cpp:
10956 (KJS::Machine::privateExecute):
10957
10958 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10959
10960 Fixed tyop.
10961
10962 * kjs/ExecState.h:
10963
10964 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10965
10966 Debug build fix: export a missing symbol.
10967
10968 * JavaScriptCore.exp:
10969
10970 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10971
10972 Reviewed by Oliver Hunt.
10973
10974 A little more ExecState refactoring: Now, only the global object creates
10975 an ExecState.
10976
10977 Also inlined ExecState::lexicalGlobalObject().
10978
10979 SunSpider reports no change.
10980
10981 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10982
10983 WebCore build fix: forward-declare ScopeChain.
10984
10985 * kjs/interpreter.h:
10986
10987 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10988
10989 Build fix for JavaScriptGlue: export a missing symbol.
10990
10991 * JavaScriptCore.exp:
10992
10993 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10994
10995 Reviewed by Oliver Hunt.
10996
10997 Removed a lot of unused bits from ExecState, moving them into
10998 OldInterpreterExecState, the fake scaffolding class.
10999
11000 The clutter was making it hard to see the forest from the trees.
11001
11002 .4% SunSpider speedup, probably because ExecState::lexicalGlobalObject()
11003 is faster now.
11004
11005 2008-04-29 Oliver Hunt <oliver@apple.com>
11006
11007 Reviewed by Maciej.
11008
11009 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
11010 <https://bugs.webkit.org/show_bug.cgi?id=18643>
11011
11012 Prevent static slot optimisation for new variables and functions in
11013 globally re-entrant code called from an an implicit function call.
11014
11015 This is necessary to prevent us from needing to resize the global
11016 slot portion of the root RegisterFile during an implicit (and hence
11017 unguarded) function call.
11018
11019 * VM/CodeGenerator.cpp:
11020 (KJS::CodeGenerator::CodeGenerator):
11021 * VM/CodeGenerator.h:
11022 * VM/Machine.cpp:
11023 (KJS::Machine::execute):
11024 * VM/RegisterFile.h:
11025 * VM/RegisterFileStack.cpp:
11026 (KJS::RegisterFileStack::pushGlobalRegisterFile):
11027 (KJS::RegisterFileStack::popGlobalRegisterFile):
11028 (KJS::RegisterFileStack::pushFunctionRegisterFile):
11029 (KJS::RegisterFileStack::popFunctionRegisterFile):
11030 * VM/RegisterFileStack.h:
11031 (KJS::RegisterFileStack::inImplicitFunctionCall):
11032 (KJS::RegisterFileStack::lastGlobal):
11033 * kjs/nodes.cpp:
11034 (KJS::ProgramNode::generateCode):
11035 * kjs/nodes.h:
11036 (KJS::ProgramNode::):
11037
11038 2008-04-29 Geoffrey Garen <ggaren@apple.com>
11039
11040 Reviewed by Oliver Hunt.
11041
11042 In nested program code, don't propogate "this" back to the parent
11043 register file. ("this" should remain constant in the parent register
11044 file, regardless of the scripts it invokes.)
11045
11046 * VM/RegisterFile.cpp:
11047 (KJS::RegisterFile::copyGlobals):
11048
11049 2008-04-28 Oliver Hunt <oliver@apple.com>
11050
11051 Reviewed by Geoff.
11052
11053 Restore base pointer when popping a global RegisterFile
11054
11055 * VM/RegisterFileStack.cpp:
11056 (KJS::RegisterFileStack::popGlobalRegisterFile):
11057
11058 2008-04-28 Oliver Hunt <oliver@apple.com>
11059
11060 Reviewed by Geoff.
11061
11062 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
11063 <https://bugs.webkit.org/show_bug.cgi?id=18643>
11064
11065 Partial fix. This results in all implicit calls to toString or valueOf
11066 executing in a separate RegisterFile, so ensuring that the the pointers
11067 in the triggering interpreter don't get trashed. This still leaves the
11068 task of preventing new global re-entry from toString and valueOf from
11069 clobbering the RegisterFile.
11070
11071 * VM/Machine.cpp:
11072 (KJS::Machine::execute):
11073 * VM/RegisterFileStack.cpp:
11074 (KJS::RegisterFileStack::pushFunctionRegisterFile):
11075 (KJS::RegisterFileStack::popFunctionRegisterFile):
11076 * VM/RegisterFileStack.h:
11077 * kjs/object.cpp:
11078 (KJS::tryGetAndCallProperty):
11079
11080 2008-04-28 Geoffrey Garen <ggaren@apple.com>
11081
11082 Reviewed by Maciej Stachowiak.
11083
11084 Simplified activation object a bit: No need to store the callee
11085 in the activation object -- we can pull it out of the call frame
11086 when needed, instead.
11087
11088 SunSpider reports no change.
11089
11090 2008-04-28 Geoffrey Garen <ggaren@apple.com>
11091
11092 Reviewed by Maciej Stachowiak.
11093
11094 RS by Oliver Hunt on moving JSArguments.cpp out of AllInOneFile.cpp.
11095
11096 Substantially more handling of "arguments": "arguments" works fully
11097 now, but "f.arguments" still doesn't work.
11098
11099 Fixes 10 regression tests.
11100
11101 SunSpider reports no regression.
11102
11103 * kjs/JSActivation.cpp:
11104 (KJS::JSActivation::createArgumentsObject): Reconstruct an arguments
11105 List to pass to the arguments object constructor.
11106
11107 * JavaScriptCore.xcodeproj/project.pbxproj:
11108 * kjs/AllInOneFile.cpp: Removed JSActivation.cpp from AllInOneFile.cpp
11109 because that seems to make GCC happy. (Previously, I had added
11110 JSActivation.cpp to AllInOneFile.cpp because *that* seemed to make GCC
11111 happy. So it goes.)
11112
11113 2008-04-28 Geoffrey Garen <ggaren@apple.com>
11114
11115 Reviewed by Maciej Stachowiak.
11116
11117 Groundwork for more handling of "arguments". I'm not checking in the
11118 actual handling of "arguments" yet, because it still needs a little
11119 fiddling to avoid a performance regression.
11120
11121 SunSpider reports no change.
11122
11123 * VM/Machine.cpp:
11124 (KJS::initializeCallFrame): Put argc in the register file, so the
11125 arguments object can find it later, to determine arguments.length.
11126
11127 * kjs/nodes.h:
11128 (KJS::FunctionBodyNode::): Added a special code accessor for when you
11129 know the code has already been generated, and you don't have a scopeChain
11130 to supply for potential code generation. (This is the case when the
11131 activation object creates the arguments object.)
11132
11133 2008-04-28 Oliver Hunt <oliver@apple.com>
11134
11135 Reviewed by Geoff.
11136
11137 Replace unsafe use of auto_ptr in Vector with manual memory
11138 management.
11139
11140 * VM/RegisterFileStack.cpp:
11141 (KJS::RegisterFileStack::~RegisterFileStack):
11142 (KJS::RegisterFileStack::popRegisterFile):
11143 * VM/RegisterFileStack.h:
11144
11145 2008-04-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11146
11147 Reviewed by Maciej.
11148
11149 Bug 18746: SQUIRRELFISH: indirect eval used when direct eval should be used
11150 <https://bugs.webkit.org/show_bug.cgi?id=18746>
11151
11152 Change the base to the correct value of the 'this' object after the direct
11153 eval test instead of before.
11154
11155 Fixes 5 layout tests.
11156
11157 * VM/Machine.cpp:
11158 (KJS::Machine::privateExecute):
11159 * kjs/nodes.cpp:
11160 (KJS::EvalFunctionCallNode::emitCode):
11161
11162 2008-04-26 Maciej Stachowiak <mjs@apple.com>
11163
11164 Reviewed by Oliver.
11165
11166 - document all property getting, setting and deleting opcodes
11167
11168 (And fix function parameter names to match corresponding opcode parameter names.)
11169
11170 * VM/CodeGenerator.cpp:
11171 (KJS::CodeGenerator::emitResolve):
11172 (KJS::CodeGenerator::emitResolveBase):
11173 (KJS::CodeGenerator::emitResolveBaseAndProperty):
11174 (KJS::CodeGenerator::emitResolveBaseAndFunc):
11175 (KJS::CodeGenerator::emitGetPropId):
11176 (KJS::CodeGenerator::emitPutPropId):
11177 (KJS::CodeGenerator::emitDeletePropId):
11178 (KJS::CodeGenerator::emitPutPropVal):
11179 * VM/CodeGenerator.h:
11180 * VM/Machine.cpp:
11181 (KJS::resolve):
11182 (KJS::resolveBase):
11183 (KJS::resolveBaseAndProperty):
11184 (KJS::resolveBaseAndFunc):
11185 (KJS::Machine::privateExecute):
11186 * kjs/nodes.cpp:
11187 (KJS::ResolveNode::emitCode):
11188 (KJS::ArrayNode::emitCode):
11189 (KJS::PropertyListNode::emitCode):
11190 (KJS::BracketAccessorNode::emitCode):
11191 (KJS::EvalFunctionCallNode::emitCode):
11192 (KJS::FunctionCallResolveNode::emitCode):
11193 (KJS::FunctionCallBracketNode::emitCode):
11194 (KJS::PostIncResolveNode::emitCode):
11195 (KJS::PostDecResolveNode::emitCode):
11196 (KJS::PostIncBracketNode::emitCode):
11197 (KJS::PostDecBracketNode::emitCode):
11198 (KJS::PostIncDotNode::emitCode):
11199 (KJS::PostDecDotNode::emitCode):
11200 (KJS::DeleteResolveNode::emitCode):
11201 (KJS::TypeOfResolveNode::emitCode):
11202 (KJS::PreIncResolveNode::emitCode):
11203 (KJS::PreDecResolveNode::emitCode):
11204 (KJS::PreIncBracketNode::emitCode):
11205 (KJS::PreDecBracketNode::emitCode):
11206 (KJS::AssignResolveNode::emitCode):
11207 (KJS::AssignDotNode::emitCode):
11208 (KJS::ReadModifyDotNode::emitCode):
11209 (KJS::AssignBracketNode::emitCode):
11210 (KJS::ReadModifyBracketNode::emitCode):
11211 (KJS::ConstDeclNode::emitCodeSingle):
11212
11213 2008-04-26 Oliver Hunt <oliver@apple.com>
11214
11215 Reviewed by Maciej.
11216
11217 Bug 18628: SQUIRRELFISH: need to support recursion limit
11218 <https://bugs.webkit.org/show_bug.cgi?id=18628>
11219
11220 Basically completes recursion limiting. There is still some
11221 tuning we may want to do to make things better in the face of
11222 very bad code, but certainly nothing worse than anything already
11223 possible in trunk.
11224
11225 Also fixes a WebKit test by fixing the exception text :D
11226
11227 * JavaScriptCore.exp:
11228 * VM/ExceptionHelpers.cpp:
11229 * VM/Machine.cpp:
11230 (KJS::Machine::execute):
11231 * VM/RegisterFile.cpp:
11232 (KJS::RegisterFile::growBuffer):
11233 (KJS::RegisterFile::addGlobalSlots):
11234 * VM/RegisterFile.h:
11235 (KJS::RegisterFile::grow):
11236 (KJS::RegisterFile::uncheckedGrow):
11237 * VM/RegisterFileStack.cpp:
11238 (KJS::RegisterFileStack::pushRegisterFile):
11239 * VM/RegisterFileStack.h:
11240
11241 2008-04-25 Oliver Hunt <oliver@apple.com>
11242
11243 Reviewed by Geoff.
11244
11245 Bug 18628: SQUIRRELFISH: need to support recursion limit
11246 <https://bugs.webkit.org/show_bug.cgi?id=18628>
11247
11248 Put a limit on the level of reentry recursion. 128 levels of re-entrant recursion
11249 seems reasonable as it is greater than the old eval limit, and a long way short of
11250 the reentry depth needed to overflow the stack.
11251
11252 * VM/Machine.cpp:
11253 (KJS::Machine::execute):
11254 * VM/Machine.h:
11255
11256 2008-04-25 Geoffrey Garen <ggaren@apple.com>
11257
11258 Reviewed by Sam Weinig.
11259
11260 A tiny bit of cleanup to the regexp code.
11261
11262 Removed some static_cast.
11263
11264 Removed createRegExpImp because it's no longer used.
11265
11266 2008-04-25 Oliver Hunt <oliver@apple.com>
11267
11268 Reviewed by Maciej.
11269
11270 Bug 18736: SQUIRRELFISH: switch statements with no default have incorrect codegen
11271 <https://bugs.webkit.org/show_bug.cgi?id=18736>
11272
11273 Ensure the "default" target is correct in the absence of an explicit default handler.
11274
11275 * kjs/nodes.cpp:
11276 (KJS::CaseBlockNode::emitCodeForBlock):
11277
11278 2008-04-25 Oliver Hunt <oliver@apple.com>
11279
11280 Reviewed by Maciej.
11281
11282 Bug 18628: SQUIRRELFISH: need to support recursion limit
11283 <https://bugs.webkit.org/show_bug.cgi?id=18628>
11284
11285 More bounds checking.
11286
11287 * VM/Machine.cpp:
11288 (KJS::Machine::execute):
11289 * VM/RegisterFile.cpp:
11290 (KJS::RegisterFile::growBuffer):
11291 * VM/RegisterFile.h:
11292
11293 2008-04-25 Maciej Stachowiak <mjs@apple.com>
11294
11295 Reviewed by Oliver.
11296
11297 - fix signal catching magic
11298
11299 The signal handlers are restored to _exit but are only set when
11300 running under run-javascriptcore-tests. fprintf from a signal
11301 handler is not safe.
11302
11303 * kjs/testkjs.cpp:
11304 (main):
11305 (parseArguments):
11306 * tests/mozilla/jsDriver.pl:
11307
11308 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11309
11310 Reviewed by Maciej.
11311
11312 Bug 18732: SQUIRRELFISH: exceptions thrown by native constructors are ignored
11313 <https://bugs.webkit.org/show_bug.cgi?id=18732>
11314
11315 Fixes another regression test.
11316
11317 * VM/Machine.cpp:
11318 (KJS::Machine::privateExecute):
11319
11320 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11321
11322 Reviewed by Maciej.
11323
11324 Bug 18728: SQUIRRELFISH: invalid regular expression constants should throw exceptions
11325 <https://bugs.webkit.org/show_bug.cgi?id=18728>
11326
11327 Fixes another regression test.
11328
11329 * kjs/nodes.cpp:
11330 (KJS::RegExpNode::emitCode):
11331
11332 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11333
11334 Reviewed by Geoffrey Garen.
11335
11336 Bug 18735: SQUIRRELFISH: closures are sometimes given an incorrect 'this' value when called
11337 <https://bugs.webkit.org/show_bug.cgi?id=18735>
11338
11339 The overloaded toThisObject method was not copied over to JSActivation.
11340
11341 Fixes two regression tests.
11342
11343 * kjs/JSActivation.cpp:
11344 (KJS::JSActivation::toThisObject):
11345 * kjs/JSActivation.h:
11346
11347 2008-04-24 Geoffrey Garen <ggaren@apple.com>
11348
11349 Reviewed by Oliver Hunt.
11350
11351 Added support for arguments.callee.
11352
11353 2008-04-24 Oliver Hunt <oliver@apple.com>
11354
11355 Reviewed by Maciej.
11356
11357 Bug 18628: SQUIRRELFISH: need to support recursion limit
11358 <https://bugs.webkit.org/show_bug.cgi?id=18628>
11359
11360 Partial fix -- this gets us some of the required bounds checking, but not
11361 complete coverage. But it does manage to do them without regressing :D
11362
11363 * VM/ExceptionHelpers.cpp:
11364 (KJS::createError):
11365 (KJS::createStackOverflowError):
11366 * VM/ExceptionHelpers.h:
11367 * VM/Machine.cpp:
11368 (KJS::slideRegisterWindowForCall):
11369 (KJS::Machine::execute):
11370 (KJS::Machine::privateExecute):
11371 * VM/RegisterFile.cpp:
11372 * VM/RegisterFile.h:
11373 (KJS::RegisterFile::):
11374 (KJS::RegisterFile::RegisterFile):
11375 (KJS::RegisterFile::grow):
11376
11377 2008-04-24 Geoffrey Garen <ggaren@apple.com>
11378
11379 Reviewed by Oliver Hunt.
11380
11381 A tiny bit more handling of "arguments": create a real, but mostly
11382 hollow, arguments object.
11383
11384 Fixes 2 regression tests.
11385
11386 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11387
11388 Reviewed by Oliver.
11389
11390 Bug 18717: SQUIRRELFISH: eval returns the wrong value for a variable declaration statement
11391 <https://bugs.webkit.org/show_bug.cgi?id=18717>
11392
11393 Fixes a regression test, but exposes the failure of another due to the
11394 lack of getters and setters.
11395
11396 * kjs/nodes.cpp:
11397 (KJS::ConstDeclNode::emitCodeSingle):
11398 (KJS::ConstDeclNode::emitCode):
11399 (KJS::ConstStatementNode::emitCode):
11400 (KJS::VarStatementNode::emitCode):
11401 * kjs/nodes.h:
11402
11403 2008-04-24 Geoffrey Garen <ggaren@apple.com>
11404
11405 Reviewed by Sam Weinig.
11406
11407 Print a CRASH statement when crashing, so test failures are not a
11408 mystery.
11409
11410 * kjs/testkjs.cpp:
11411 (handleCrash):
11412 (main):
11413
11414 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11415
11416 Reviewed by Geoffrey Garen.
11417
11418 Bug 18716: SQUIRRELFISH: typeof should return undefined for an undefined variable reference
11419 <https://bugs.webkit.org/show_bug.cgi?id=18716>
11420
11421 This fixes 2 more regression tests.
11422
11423 * kjs/nodes.cpp:
11424 (KJS::TypeOfResolveNode::emitCode):
11425
11426 2008-04-24 Geoffrey Garen <ggaren@apple.com>
11427
11428 Reviewed by Sam Weinig.
11429
11430 Put the callee in the call frame.
11431
11432 Necessary in order to support "arguments" and "arguments.callee".
11433
11434 Also fixes a latent GC bug, where an executing function could be
11435 subject to GC if the register holding it were overwritten. Here's
11436 an example that would have caused problems:
11437
11438 function f()
11439 {
11440 // Flood the machine stack to eliminate any old pointers to f.
11441 g.call({});
11442
11443 // Overwrite f in the register file.
11444 f = 1;
11445
11446 // Force a GC.
11447 for (var i = 0; i < 5000; ++i) {
11448 ({});
11449 }
11450
11451 // Welcome to crash-ville.
11452 }
11453
11454 function g()
11455 {
11456 }
11457
11458 f();
11459
11460 * VM/Machine.h: Changed the order of arguments to
11461 execute(FunctionBodyNode*...) to match the other execute functions.
11462 * kjs/function.cpp: Updated to match new argument requirements from
11463 execute(FunctionBodyNode*...). Renamed newObj to thisObj to match the
11464 rest of JavaScriptCore.
11465
11466 SunSpider reports no change.
11467
11468 2008-04-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11469
11470 Reviewed by Maciej.
11471
11472 Bug 18707: SQUIRRELFISH: eval always performs toString() on its argument
11473 <https://bugs.webkit.org/show_bug.cgi?id=18707>
11474
11475 This fixes 4 more regression tests.
11476
11477 * VM/Machine.cpp:
11478 (KJS::eval):
11479
11480 2008-04-23 Maciej Stachowiak <mjs@apple.com>
11481
11482 Reviewed by Oliver.
11483
11484 - fix logic bug in SegmentedVector::grow which would sometimes fail to resize a segment when needed
11485
11486 Fixes 3 JSC tests.
11487
11488 * VM/SegmentedVector.h:
11489 (KJS::SegmentedVector::grow):
11490
11491 2008-04-23 Geoffrey Garen <ggaren@apple.com>
11492
11493 Reviewed by Maciej Stachowiak.
11494
11495 Degenerate handling of "arguments" as a property of the activation
11496 object. Currently, we just return a vanilla object.
11497
11498 SunSpider reports no change.
11499
11500 Fixes:
11501
11502 ecma_3/Function/regress-94506.js.
11503
11504 Reveals to have been secretly broken:
11505
11506 ecma_3/Function/15.3.4.3-1.js
11507 ecma_3/Function/15.3.4.4-1.js
11508
11509 These tests were passing incorrectly. testkjs creates a global array
11510 named "arguments" to hold command-line arguments. That array was
11511 tricking these tests into thinking that an arguments object with length
11512 0 had been created. Since our new vanilla object shadows the global
11513 property named arguments, that object no longer fools these tests into
11514 passing.
11515
11516 Net change: +1 failing test.
11517
11518 * kjs/AllInOneFile.cpp: Had to put JSActivation.cpp into AllInOneFile.cpp
11519 to solve a surprising 8.6% regression in bitops-3bit-bits-in-byte.
11520
11521 2008-04-23 Maciej Stachowiak <mjs@apple.com>
11522
11523 Reviewed by Oliver.
11524
11525 - save and restore callFrame
11526
11527 * VM/Machine.cpp:
11528 (KJS::slideRegisterWindowForCall):
11529 (KJS::Machine::execute):
11530 (KJS::Machine::privateExecute):
11531 * kjs/testkjs.cpp:
11532 (main):
11533
11534 2008-04-23 Geoffrey Garen <ggaren@apple.com>
11535
11536 Reviewed by Maciej Stachowiak.
11537
11538 Fixed scopes for named function expressions.
11539
11540 Fixes one regression test.
11541
11542 Two changes here:
11543
11544 (1) The function's name is supposed to have attributes DontDelete,
11545 ReadOnly, regardless of the type of code executing.
11546
11547 (2) Push the name object on the function's scope chain, rather than
11548 the ExecState's scope chain because, well, that's where it belongs.
11549
11550 2008-04-23 Geoffrey Garen <ggaren@apple.com>
11551
11552 Reviewed by Oliver Hunt.
11553
11554 Inlined JSObject::putDirect, for a .4% SunSpider speedup.
11555
11556 I did this as a first step toward removing nodes.cpp from
11557 AllInOneFile.cpp, but I'm putting that larger project aside for now.
11558
11559 2008-04-23 Maciej Stachowiak <mjs@apple.com>
11560
11561 Rubber stamped by Geoff.
11562
11563 - add OldInterpreterExecState class and use it in dead code
11564
11565 This will allow removing things from the real ExecState class
11566 without having to figure out how to remove all this code without
11567 getting a perf regression.
11568
11569 * kjs/nodes.cpp:
11570 (KJS::ExpressionNode::evaluateToNumber):
11571 (KJS::ExpressionNode::evaluateToBoolean):
11572 (KJS::ExpressionNode::evaluateToInt32):
11573 (KJS::ExpressionNode::evaluateToUInt32):
11574 (KJS::Node::setErrorCompletion):
11575 (KJS::Node::throwError):
11576 (KJS::Node::throwUndefinedVariableError):
11577 (KJS::Node::handleException):
11578 (KJS::Node::rethrowException):
11579 (KJS::BreakpointCheckStatement::execute):
11580 (KJS::BreakpointCheckStatement::optimizeVariableAccess):
11581 (KJS::NullNode::evaluate):
11582 (KJS::FalseNode::evaluate):
11583 (KJS::TrueNode::evaluate):
11584 (KJS::NumberNode::evaluate):
11585 (KJS::NumberNode::evaluateToNumber):
11586 (KJS::NumberNode::evaluateToBoolean):
11587 (KJS::NumberNode::evaluateToInt32):
11588 (KJS::NumberNode::evaluateToUInt32):
11589 (KJS::ImmediateNumberNode::evaluate):
11590 (KJS::ImmediateNumberNode::evaluateToInt32):
11591 (KJS::ImmediateNumberNode::evaluateToUInt32):
11592 (KJS::StringNode::evaluate):
11593 (KJS::StringNode::evaluateToNumber):
11594 (KJS::StringNode::evaluateToBoolean):
11595 (KJS::RegExpNode::evaluate):
11596 (KJS::ThisNode::evaluate):
11597 (KJS::ResolveNode::inlineEvaluate):
11598 (KJS::ResolveNode::evaluate):
11599 (KJS::ResolveNode::evaluateToNumber):
11600 (KJS::ResolveNode::evaluateToBoolean):
11601 (KJS::ResolveNode::evaluateToInt32):
11602 (KJS::ResolveNode::evaluateToUInt32):
11603 (KJS::getSymbolTableEntry):
11604 (KJS::ResolveNode::optimizeVariableAccess):
11605 (KJS::LocalVarAccessNode::inlineEvaluate):
11606 (KJS::LocalVarAccessNode::evaluate):
11607 (KJS::LocalVarAccessNode::evaluateToNumber):
11608 (KJS::LocalVarAccessNode::evaluateToBoolean):
11609 (KJS::LocalVarAccessNode::evaluateToInt32):
11610 (KJS::LocalVarAccessNode::evaluateToUInt32):
11611 (KJS::getNonLocalSymbol):
11612 (KJS::ScopedVarAccessNode::inlineEvaluate):
11613 (KJS::ScopedVarAccessNode::evaluate):
11614 (KJS::ScopedVarAccessNode::evaluateToNumber):
11615 (KJS::ScopedVarAccessNode::evaluateToBoolean):
11616 (KJS::ScopedVarAccessNode::evaluateToInt32):
11617 (KJS::ScopedVarAccessNode::evaluateToUInt32):
11618 (KJS::NonLocalVarAccessNode::inlineEvaluate):
11619 (KJS::NonLocalVarAccessNode::evaluate):
11620 (KJS::NonLocalVarAccessNode::evaluateToNumber):
11621 (KJS::NonLocalVarAccessNode::evaluateToBoolean):
11622 (KJS::NonLocalVarAccessNode::evaluateToInt32):
11623 (KJS::NonLocalVarAccessNode::evaluateToUInt32):
11624 (KJS::ElementNode::optimizeVariableAccess):
11625 (KJS::ElementNode::evaluate):
11626 (KJS::ArrayNode::optimizeVariableAccess):
11627 (KJS::ArrayNode::evaluate):
11628 (KJS::ObjectLiteralNode::optimizeVariableAccess):
11629 (KJS::ObjectLiteralNode::evaluate):
11630 (KJS::PropertyListNode::optimizeVariableAccess):
11631 (KJS::PropertyListNode::evaluate):
11632 (KJS::PropertyNode::optimizeVariableAccess):
11633 (KJS::PropertyNode::evaluate):
11634 (KJS::BracketAccessorNode::optimizeVariableAccess):
11635 (KJS::BracketAccessorNode::inlineEvaluate):
11636 (KJS::BracketAccessorNode::evaluate):
11637 (KJS::BracketAccessorNode::evaluateToNumber):
11638 (KJS::BracketAccessorNode::evaluateToBoolean):
11639 (KJS::BracketAccessorNode::evaluateToInt32):
11640 (KJS::BracketAccessorNode::evaluateToUInt32):
11641 (KJS::DotAccessorNode::optimizeVariableAccess):
11642 (KJS::DotAccessorNode::inlineEvaluate):
11643 (KJS::DotAccessorNode::evaluate):
11644 (KJS::DotAccessorNode::evaluateToNumber):
11645 (KJS::DotAccessorNode::evaluateToBoolean):
11646 (KJS::DotAccessorNode::evaluateToInt32):
11647 (KJS::DotAccessorNode::evaluateToUInt32):
11648 (KJS::ArgumentListNode::optimizeVariableAccess):
11649 (KJS::ArgumentListNode::evaluateList):
11650 (KJS::ArgumentsNode::optimizeVariableAccess):
11651 (KJS::NewExprNode::optimizeVariableAccess):
11652 (KJS::NewExprNode::inlineEvaluate):
11653 (KJS::NewExprNode::evaluate):
11654 (KJS::NewExprNode::evaluateToNumber):
11655 (KJS::NewExprNode::evaluateToBoolean):
11656 (KJS::NewExprNode::evaluateToInt32):
11657 (KJS::NewExprNode::evaluateToUInt32):
11658 (KJS::ExpressionNode::resolveAndCall):
11659 (KJS::EvalFunctionCallNode::optimizeVariableAccess):
11660 (KJS::EvalFunctionCallNode::evaluate):
11661 (KJS::FunctionCallValueNode::optimizeVariableAccess):
11662 (KJS::FunctionCallValueNode::evaluate):
11663 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
11664 (KJS::FunctionCallResolveNode::inlineEvaluate):
11665 (KJS::FunctionCallResolveNode::evaluate):
11666 (KJS::FunctionCallResolveNode::evaluateToNumber):
11667 (KJS::FunctionCallResolveNode::evaluateToBoolean):
11668 (KJS::FunctionCallResolveNode::evaluateToInt32):
11669 (KJS::FunctionCallResolveNode::evaluateToUInt32):
11670 (KJS::LocalVarFunctionCallNode::inlineEvaluate):
11671 (KJS::LocalVarFunctionCallNode::evaluate):
11672 (KJS::LocalVarFunctionCallNode::evaluateToNumber):
11673 (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
11674 (KJS::LocalVarFunctionCallNode::evaluateToInt32):
11675 (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
11676 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
11677 (KJS::ScopedVarFunctionCallNode::evaluate):
11678 (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
11679 (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
11680 (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
11681 (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
11682 (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
11683 (KJS::NonLocalVarFunctionCallNode::evaluate):
11684 (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
11685 (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
11686 (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
11687 (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
11688 (KJS::FunctionCallBracketNode::optimizeVariableAccess):
11689 (KJS::FunctionCallBracketNode::evaluate):
11690 (KJS::FunctionCallDotNode::optimizeVariableAccess):
11691 (KJS::FunctionCallDotNode::inlineEvaluate):
11692 (KJS::FunctionCallDotNode::evaluate):
11693 (KJS::FunctionCallDotNode::evaluateToNumber):
11694 (KJS::FunctionCallDotNode::evaluateToBoolean):
11695 (KJS::FunctionCallDotNode::evaluateToInt32):
11696 (KJS::FunctionCallDotNode::evaluateToUInt32):
11697 (KJS::PostIncResolveNode::optimizeVariableAccess):
11698 (KJS::PostIncResolveNode::evaluate):
11699 (KJS::PostIncLocalVarNode::evaluate):
11700 (KJS::PostDecResolveNode::optimizeVariableAccess):
11701 (KJS::PostDecResolveNode::evaluate):
11702 (KJS::PostDecLocalVarNode::evaluate):
11703 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
11704 (KJS::PostDecLocalVarNode::evaluateToNumber):
11705 (KJS::PostDecLocalVarNode::evaluateToBoolean):
11706 (KJS::PostDecLocalVarNode::evaluateToInt32):
11707 (KJS::PostDecLocalVarNode::evaluateToUInt32):
11708 (KJS::PostfixBracketNode::optimizeVariableAccess):
11709 (KJS::PostIncBracketNode::evaluate):
11710 (KJS::PostDecBracketNode::evaluate):
11711 (KJS::PostfixDotNode::optimizeVariableAccess):
11712 (KJS::PostIncDotNode::evaluate):
11713 (KJS::PostDecDotNode::evaluate):
11714 (KJS::PostfixErrorNode::evaluate):
11715 (KJS::DeleteResolveNode::optimizeVariableAccess):
11716 (KJS::DeleteResolveNode::evaluate):
11717 (KJS::LocalVarDeleteNode::evaluate):
11718 (KJS::DeleteBracketNode::optimizeVariableAccess):
11719 (KJS::DeleteBracketNode::evaluate):
11720 (KJS::DeleteDotNode::optimizeVariableAccess):
11721 (KJS::DeleteDotNode::evaluate):
11722 (KJS::DeleteValueNode::optimizeVariableAccess):
11723 (KJS::DeleteValueNode::evaluate):
11724 (KJS::VoidNode::optimizeVariableAccess):
11725 (KJS::VoidNode::evaluate):
11726 (KJS::TypeOfValueNode::optimizeVariableAccess):
11727 (KJS::TypeOfResolveNode::optimizeVariableAccess):
11728 (KJS::LocalVarTypeOfNode::evaluate):
11729 (KJS::TypeOfResolveNode::evaluate):
11730 (KJS::TypeOfValueNode::evaluate):
11731 (KJS::PreIncResolveNode::optimizeVariableAccess):
11732 (KJS::PreIncLocalVarNode::evaluate):
11733 (KJS::PreIncResolveNode::evaluate):
11734 (KJS::PreDecResolveNode::optimizeVariableAccess):
11735 (KJS::PreDecLocalVarNode::evaluate):
11736 (KJS::PreDecResolveNode::evaluate):
11737 (KJS::PreIncConstNode::evaluate):
11738 (KJS::PreDecConstNode::evaluate):
11739 (KJS::PostIncConstNode::evaluate):
11740 (KJS::PostDecConstNode::evaluate):
11741 (KJS::PrefixBracketNode::optimizeVariableAccess):
11742 (KJS::PreIncBracketNode::evaluate):
11743 (KJS::PreDecBracketNode::evaluate):
11744 (KJS::PrefixDotNode::optimizeVariableAccess):
11745 (KJS::PreIncDotNode::evaluate):
11746 (KJS::PreDecDotNode::evaluate):
11747 (KJS::PrefixErrorNode::evaluate):
11748 (KJS::UnaryPlusNode::optimizeVariableAccess):
11749 (KJS::UnaryPlusNode::evaluate):
11750 (KJS::UnaryPlusNode::evaluateToBoolean):
11751 (KJS::UnaryPlusNode::evaluateToNumber):
11752 (KJS::UnaryPlusNode::evaluateToInt32):
11753 (KJS::UnaryPlusNode::evaluateToUInt32):
11754 (KJS::NegateNode::optimizeVariableAccess):
11755 (KJS::NegateNode::evaluate):
11756 (KJS::NegateNode::evaluateToNumber):
11757 (KJS::BitwiseNotNode::optimizeVariableAccess):
11758 (KJS::BitwiseNotNode::inlineEvaluateToInt32):
11759 (KJS::BitwiseNotNode::evaluate):
11760 (KJS::BitwiseNotNode::evaluateToNumber):
11761 (KJS::BitwiseNotNode::evaluateToBoolean):
11762 (KJS::BitwiseNotNode::evaluateToInt32):
11763 (KJS::BitwiseNotNode::evaluateToUInt32):
11764 (KJS::LogicalNotNode::optimizeVariableAccess):
11765 (KJS::LogicalNotNode::evaluate):
11766 (KJS::LogicalNotNode::evaluateToBoolean):
11767 (KJS::MultNode::optimizeVariableAccess):
11768 (KJS::MultNode::inlineEvaluateToNumber):
11769 (KJS::MultNode::evaluate):
11770 (KJS::MultNode::evaluateToNumber):
11771 (KJS::MultNode::evaluateToBoolean):
11772 (KJS::MultNode::evaluateToInt32):
11773 (KJS::MultNode::evaluateToUInt32):
11774 (KJS::DivNode::optimizeVariableAccess):
11775 (KJS::DivNode::inlineEvaluateToNumber):
11776 (KJS::DivNode::evaluate):
11777 (KJS::DivNode::evaluateToNumber):
11778 (KJS::DivNode::evaluateToInt32):
11779 (KJS::DivNode::evaluateToUInt32):
11780 (KJS::ModNode::optimizeVariableAccess):
11781 (KJS::ModNode::inlineEvaluateToNumber):
11782 (KJS::ModNode::evaluate):
11783 (KJS::ModNode::evaluateToNumber):
11784 (KJS::ModNode::evaluateToBoolean):
11785 (KJS::ModNode::evaluateToInt32):
11786 (KJS::ModNode::evaluateToUInt32):
11787 (KJS::throwOutOfMemoryErrorToNumber):
11788 (KJS::addSlowCase):
11789 (KJS::addSlowCaseToNumber):
11790 (KJS::add):
11791 (KJS::addToNumber):
11792 (KJS::AddNode::optimizeVariableAccess):
11793 (KJS::AddNode::evaluate):
11794 (KJS::AddNode::inlineEvaluateToNumber):
11795 (KJS::AddNode::evaluateToNumber):
11796 (KJS::AddNode::evaluateToInt32):
11797 (KJS::AddNode::evaluateToUInt32):
11798 (KJS::AddNumbersNode::inlineEvaluateToNumber):
11799 (KJS::AddNumbersNode::evaluate):
11800 (KJS::AddNumbersNode::evaluateToNumber):
11801 (KJS::AddNumbersNode::evaluateToInt32):
11802 (KJS::AddNumbersNode::evaluateToUInt32):
11803 (KJS::AddStringsNode::evaluate):
11804 (KJS::AddStringLeftNode::evaluate):
11805 (KJS::AddStringRightNode::evaluate):
11806 (KJS::SubNode::optimizeVariableAccess):
11807 (KJS::SubNode::inlineEvaluateToNumber):
11808 (KJS::SubNode::evaluate):
11809 (KJS::SubNode::evaluateToNumber):
11810 (KJS::SubNode::evaluateToInt32):
11811 (KJS::SubNode::evaluateToUInt32):
11812 (KJS::LeftShiftNode::optimizeVariableAccess):
11813 (KJS::LeftShiftNode::inlineEvaluateToInt32):
11814 (KJS::LeftShiftNode::evaluate):
11815 (KJS::LeftShiftNode::evaluateToNumber):
11816 (KJS::LeftShiftNode::evaluateToInt32):
11817 (KJS::LeftShiftNode::evaluateToUInt32):
11818 (KJS::RightShiftNode::optimizeVariableAccess):
11819 (KJS::RightShiftNode::inlineEvaluateToInt32):
11820 (KJS::RightShiftNode::evaluate):
11821 (KJS::RightShiftNode::evaluateToNumber):
11822 (KJS::RightShiftNode::evaluateToInt32):
11823 (KJS::RightShiftNode::evaluateToUInt32):
11824 (KJS::UnsignedRightShiftNode::optimizeVariableAccess):
11825 (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
11826 (KJS::UnsignedRightShiftNode::evaluate):
11827 (KJS::UnsignedRightShiftNode::evaluateToNumber):
11828 (KJS::UnsignedRightShiftNode::evaluateToInt32):
11829 (KJS::UnsignedRightShiftNode::evaluateToUInt32):
11830 (KJS::lessThan):
11831 (KJS::lessThanEq):
11832 (KJS::LessNode::optimizeVariableAccess):
11833 (KJS::LessNode::inlineEvaluateToBoolean):
11834 (KJS::LessNode::evaluate):
11835 (KJS::LessNode::evaluateToBoolean):
11836 (KJS::LessNumbersNode::inlineEvaluateToBoolean):
11837 (KJS::LessNumbersNode::evaluate):
11838 (KJS::LessNumbersNode::evaluateToBoolean):
11839 (KJS::LessStringsNode::inlineEvaluateToBoolean):
11840 (KJS::LessStringsNode::evaluate):
11841 (KJS::LessStringsNode::evaluateToBoolean):
11842 (KJS::GreaterNode::optimizeVariableAccess):
11843 (KJS::GreaterNode::inlineEvaluateToBoolean):
11844 (KJS::GreaterNode::evaluate):
11845 (KJS::GreaterNode::evaluateToBoolean):
11846 (KJS::LessEqNode::optimizeVariableAccess):
11847 (KJS::LessEqNode::inlineEvaluateToBoolean):
11848 (KJS::LessEqNode::evaluate):
11849 (KJS::LessEqNode::evaluateToBoolean):
11850 (KJS::GreaterEqNode::optimizeVariableAccess):
11851 (KJS::GreaterEqNode::inlineEvaluateToBoolean):
11852 (KJS::GreaterEqNode::evaluate):
11853 (KJS::GreaterEqNode::evaluateToBoolean):
11854 (KJS::InstanceOfNode::optimizeVariableAccess):
11855 (KJS::InstanceOfNode::evaluate):
11856 (KJS::InstanceOfNode::evaluateToBoolean):
11857 (KJS::InNode::optimizeVariableAccess):
11858 (KJS::InNode::evaluate):
11859 (KJS::InNode::evaluateToBoolean):
11860 (KJS::EqualNode::optimizeVariableAccess):
11861 (KJS::EqualNode::inlineEvaluateToBoolean):
11862 (KJS::EqualNode::evaluate):
11863 (KJS::EqualNode::evaluateToBoolean):
11864 (KJS::NotEqualNode::optimizeVariableAccess):
11865 (KJS::NotEqualNode::inlineEvaluateToBoolean):
11866 (KJS::NotEqualNode::evaluate):
11867 (KJS::NotEqualNode::evaluateToBoolean):
11868 (KJS::StrictEqualNode::optimizeVariableAccess):
11869 (KJS::StrictEqualNode::inlineEvaluateToBoolean):
11870 (KJS::StrictEqualNode::evaluate):
11871 (KJS::StrictEqualNode::evaluateToBoolean):
11872 (KJS::NotStrictEqualNode::optimizeVariableAccess):
11873 (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
11874 (KJS::NotStrictEqualNode::evaluate):
11875 (KJS::NotStrictEqualNode::evaluateToBoolean):
11876 (KJS::BitAndNode::optimizeVariableAccess):
11877 (KJS::BitAndNode::evaluate):
11878 (KJS::BitAndNode::inlineEvaluateToInt32):
11879 (KJS::BitAndNode::evaluateToNumber):
11880 (KJS::BitAndNode::evaluateToBoolean):
11881 (KJS::BitAndNode::evaluateToInt32):
11882 (KJS::BitAndNode::evaluateToUInt32):
11883 (KJS::BitXOrNode::optimizeVariableAccess):
11884 (KJS::BitXOrNode::inlineEvaluateToInt32):
11885 (KJS::BitXOrNode::evaluate):
11886 (KJS::BitXOrNode::evaluateToNumber):
11887 (KJS::BitXOrNode::evaluateToBoolean):
11888 (KJS::BitXOrNode::evaluateToInt32):
11889 (KJS::BitXOrNode::evaluateToUInt32):
11890 (KJS::BitOrNode::optimizeVariableAccess):
11891 (KJS::BitOrNode::inlineEvaluateToInt32):
11892 (KJS::BitOrNode::evaluate):
11893 (KJS::BitOrNode::evaluateToNumber):
11894 (KJS::BitOrNode::evaluateToBoolean):
11895 (KJS::BitOrNode::evaluateToInt32):
11896 (KJS::BitOrNode::evaluateToUInt32):
11897 (KJS::LogicalAndNode::optimizeVariableAccess):
11898 (KJS::LogicalAndNode::evaluate):
11899 (KJS::LogicalAndNode::evaluateToBoolean):
11900 (KJS::LogicalOrNode::optimizeVariableAccess):
11901 (KJS::LogicalOrNode::evaluate):
11902 (KJS::LogicalOrNode::evaluateToBoolean):
11903 (KJS::ConditionalNode::optimizeVariableAccess):
11904 (KJS::ConditionalNode::evaluate):
11905 (KJS::ConditionalNode::evaluateToBoolean):
11906 (KJS::ConditionalNode::evaluateToNumber):
11907 (KJS::ConditionalNode::evaluateToInt32):
11908 (KJS::ConditionalNode::evaluateToUInt32):
11909 (KJS::valueForReadModifyAssignment):
11910 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
11911 (KJS::AssignResolveNode::optimizeVariableAccess):
11912 (KJS::ReadModifyLocalVarNode::evaluate):
11913 (KJS::AssignLocalVarNode::evaluate):
11914 (KJS::ReadModifyConstNode::evaluate):
11915 (KJS::AssignConstNode::evaluate):
11916 (KJS::ReadModifyResolveNode::evaluate):
11917 (KJS::AssignResolveNode::evaluate):
11918 (KJS::AssignDotNode::optimizeVariableAccess):
11919 (KJS::AssignDotNode::evaluate):
11920 (KJS::ReadModifyDotNode::optimizeVariableAccess):
11921 (KJS::ReadModifyDotNode::evaluate):
11922 (KJS::AssignErrorNode::evaluate):
11923 (KJS::AssignBracketNode::optimizeVariableAccess):
11924 (KJS::AssignBracketNode::evaluate):
11925 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
11926 (KJS::ReadModifyBracketNode::evaluate):
11927 (KJS::CommaNode::optimizeVariableAccess):
11928 (KJS::CommaNode::evaluate):
11929 (KJS::ConstDeclNode::optimizeVariableAccess):
11930 (KJS::ConstDeclNode::handleSlowCase):
11931 (KJS::ConstDeclNode::evaluateSingle):
11932 (KJS::ConstDeclNode::evaluate):
11933 (KJS::ConstStatementNode::optimizeVariableAccess):
11934 (KJS::ConstStatementNode::execute):
11935 (KJS::statementListExecute):
11936 (KJS::BlockNode::optimizeVariableAccess):
11937 (KJS::BlockNode::execute):
11938 (KJS::EmptyStatementNode::execute):
11939 (KJS::ExprStatementNode::optimizeVariableAccess):
11940 (KJS::ExprStatementNode::execute):
11941 (KJS::VarStatementNode::optimizeVariableAccess):
11942 (KJS::VarStatementNode::execute):
11943 (KJS::IfNode::optimizeVariableAccess):
11944 (KJS::IfNode::execute):
11945 (KJS::IfElseNode::optimizeVariableAccess):
11946 (KJS::IfElseNode::execute):
11947 (KJS::DoWhileNode::optimizeVariableAccess):
11948 (KJS::DoWhileNode::execute):
11949 (KJS::WhileNode::optimizeVariableAccess):
11950 (KJS::WhileNode::execute):
11951 (KJS::ForNode::optimizeVariableAccess):
11952 (KJS::ForNode::execute):
11953 (KJS::ForInNode::optimizeVariableAccess):
11954 (KJS::ForInNode::execute):
11955 (KJS::ContinueNode::execute):
11956 (KJS::BreakNode::execute):
11957 (KJS::ReturnNode::optimizeVariableAccess):
11958 (KJS::ReturnNode::execute):
11959 (KJS::WithNode::optimizeVariableAccess):
11960 (KJS::WithNode::execute):
11961 (KJS::CaseClauseNode::optimizeVariableAccess):
11962 (KJS::CaseClauseNode::evaluate):
11963 (KJS::CaseClauseNode::executeStatements):
11964 (KJS::ClauseListNode::optimizeVariableAccess):
11965 (KJS::CaseBlockNode::optimizeVariableAccess):
11966 (KJS::CaseBlockNode::executeBlock):
11967 (KJS::SwitchNode::optimizeVariableAccess):
11968 (KJS::SwitchNode::execute):
11969 (KJS::LabelNode::optimizeVariableAccess):
11970 (KJS::LabelNode::execute):
11971 (KJS::ThrowNode::optimizeVariableAccess):
11972 (KJS::ThrowNode::execute):
11973 (KJS::TryNode::optimizeVariableAccess):
11974 (KJS::TryNode::execute):
11975 (KJS::ProgramNode::initializeSymbolTable):
11976 (KJS::ScopeNode::optimizeVariableAccess):
11977 (KJS::ProgramNode::processDeclarations):
11978 (KJS::EvalNode::processDeclarations):
11979 (KJS::ProgramNode::execute):
11980 (KJS::EvalNode::execute):
11981 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
11982 (KJS::FuncDeclNode::execute):
11983 (KJS::FuncExprNode::evaluate):
11984 * kjs/nodes.h:
11985 (KJS::Node::):
11986 (KJS::FalseNode::):
11987 (KJS::TrueNode::):
11988 (KJS::ArgumentsNode::):
11989
11990 2008-04-23 Oliver Hunt <oliver@apple.com>
11991
11992 Reviewed by Geoff.
11993
11994 Bug 18672: SQUIRRELFISH: codegen fails with a large number of temporaries
11995 <https://bugs.webkit.org/show_bug.cgi?id=18672>
11996
11997 Add a SegmentedVector type, which provides a Vector<T> which maintains
11998 existing memory locations during resize. This allows dynamically sizing
11999 local, temporary and label "vectors" in CodeGenerator.
12000
12001 * JavaScriptCore.xcodeproj/project.pbxproj:
12002 * VM/CodeGenerator.cpp:
12003 (KJS::CodeGenerator::addVar):
12004 (KJS::CodeGenerator::CodeGenerator):
12005 (KJS::CodeGenerator::newTemporary):
12006 (KJS::CodeGenerator::newLabel):
12007 * VM/CodeGenerator.h:
12008 * VM/SegmentedVector.h: Added.
12009 (KJS::SegmentedVector::SegmentedVector):
12010 (KJS::SegmentedVector::~SegmentedVector):
12011 (KJS::SegmentedVector::last):
12012 (KJS::SegmentedVector::append):
12013 (KJS::SegmentedVector::removeLast):
12014 (KJS::SegmentedVector::size):
12015 (KJS::SegmentedVector::operator[]):
12016 (KJS::SegmentedVector::resize):
12017 (KJS::SegmentedVector::shrink):
12018 (KJS::SegmentedVector::grow):
12019
12020 2008-04-23 Geoffrey Garen <ggaren@apple.com>
12021
12022 Reviewed by Maciej Stachowiak.
12023
12024 A little refactoring in preparation for supporting 'arguments'.
12025
12026 Fixes 2 regression tests.
12027
12028 SunSpider reports no change.
12029
12030 We now check the activation register, instead of the codeBlock, to
12031 determine whether we need to tear off the activation. This is to support
12032 "f.arguments", which will create an activation/arguments pair for f,
12033 even though the needsFullScopeChain flag is false for f's codeBlock.
12034
12035 The test fixes resulted from calling initializeCallFrame for re-entrant
12036 function code, instead of initializing (not enough) parts of the call
12037 frame by hand.
12038
12039 2008-04-22 Maciej Stachowiak <mjs@apple.com>
12040
12041 Reviewed by Sam.
12042
12043 - propagate the "this" value properly to local eval
12044
12045 (fixes a measly one regression test)
12046
12047 * VM/CodeBlock.h:
12048 (KJS::CodeBlock::CodeBlock):
12049 (KJS::ProgramCodeBlock::ProgramCodeBlock):
12050 (KJS::EvalCodeBlock::EvalCodeBlock):
12051 * VM/Machine.cpp:
12052 (KJS::Machine::privateExecute):
12053
12054 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
12055
12056 Reviewed by Maciej.
12057
12058 Add support for function declarations in eval code.
12059
12060 (this fixes 12 more regression tests)
12061
12062 * VM/CodeBlock.h:
12063 * VM/CodeGenerator.cpp:
12064 (KJS::CodeGenerator::CodeGenerator):
12065 * VM/CodeGenerator.h:
12066 * VM/Machine.cpp:
12067 (KJS::Machine::execute):
12068 * kjs/nodes.cpp:
12069 (KJS::EvalNode::generateCode):
12070
12071 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
12072
12073 Reviewed by Oliver.
12074
12075 Implement LabelNode.
12076
12077 * VM/CodeGenerator.cpp:
12078 (KJS::CodeGenerator::pushJumpContext):
12079 (KJS::CodeGenerator::jumpContextForContinue):
12080 (KJS::CodeGenerator::jumpContextForBreak):
12081 * VM/CodeGenerator.h:
12082 * kjs/nodes.cpp:
12083 (KJS::DoWhileNode::emitCode):
12084 (KJS::WhileNode::emitCode):
12085 (KJS::ForNode::emitCode):
12086 (KJS::ForInNode::emitCode):
12087 (KJS::ContinueNode::emitCode):
12088 (KJS::BreakNode::emitCode):
12089 (KJS::SwitchNode::emitCode):
12090 (KJS::LabelNode::emitCode):
12091
12092 2008-04-22 Geoffrey Garen <ggaren@apple.com>
12093
12094 Reviewed by Oliver Hunt.
12095
12096 Fixed crash when unwinding from exceptions inside eval.
12097
12098 * VM/Machine.cpp:
12099 (KJS::Machine::unwindCallFrame): Don't assume that the top of the
12100 current call frame's scope chain is an activation: it can be the global
12101 object, instead.
12102
12103 2008-04-22 Maciej Stachowiak <mjs@apple.com>
12104
12105 Reviewed by Geoff.
12106
12107 * kjs/testkjs.cpp:
12108 (main): Convert signals to exit codes, so that crashing tests are
12109 detected as regression test failures.
12110
12111 2008-04-22 Geoffrey Garen <ggaren@apple.com>
12112
12113 Reviewed by Oliver Hunt and Maciej Stachowiak.
12114
12115 Renamed "needsActivation" to "needsFullScopeChain" because lying will
12116 make hair grow on the backs of your hands.
12117
12118 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12119
12120 Reviewed by Maciej Stachowiak.
12121
12122 Fixed ScopeChainNode lifetime problems:
12123
12124 (1) In "with" and "catch" scopes, we would construct a ScopeChain
12125 object and then jump across its destructor, leaking the ScopeChainNode
12126 we had pushed.
12127
12128 (2) In global and eval scopes, we would fail to initially ref
12129 "scopeChain", causing us to overrelease it later. Now that we ref
12130 "scopeChain" properly, we also need to deref it when the script
12131 terminates.
12132
12133 SunSpider reports a .2% regression, but an earlier round of ScopeChain
12134 refactoring was a .4% speedup, so there.
12135
12136 2008-04-22 Maciej Stachowiak <mjs@apple.com>
12137
12138 Reviewed by Alexey.
12139
12140 - use global object instead of null for "this" on unqualified calls
12141
12142 This fixes 10 more JSC test regressions.
12143
12144 * VM/Machine.cpp:
12145 (KJS::Machine::privateExecute):
12146
12147 2008-04-22 Maciej Stachowiak <mjs@apple.com>
12148
12149 Reviewed by Oliver.
12150
12151 - throw proper exceptions for objects that don't implement call or construct
12152
12153 This fixes 21 more JSC test regressions. It is also seemingly an
12154 0.5% progression.
12155
12156 * VM/ExceptionHelpers.cpp:
12157 (KJS::createNotAnObjectError):
12158 (KJS::createNotAConstructorError):
12159 (KJS::createNotAFunctionError):
12160 * VM/ExceptionHelpers.h:
12161 * VM/Machine.cpp:
12162 (KJS::Machine::privateExecute):
12163
12164 2008-04-21 Oliver Hunt <oliver@apple.com>
12165
12166 Reviewed by Geoff.
12167
12168 Implement emitCode for ConstDeclNode.
12169
12170 This fixes the crash (assertion) in js1_5/Scope/scope-001.js
12171
12172 * VM/CodeGenerator.cpp:
12173 (KJS::CodeGenerator::registerForLocalConstInit):
12174 * VM/CodeGenerator.h:
12175 * kjs/nodes.cpp:
12176 (KJS::AssignResolveNode::emitCode):
12177 (KJS::ConstDeclNode::emitCodeSingle):
12178 (KJS::ConstDeclNode::emitCode):
12179 (KJS::ConstStatementNode::emitCode):
12180 * kjs/nodes.h:
12181
12182 2008-04-21 Maciej Stachowiak <mjs@apple.com>
12183
12184 Reviewed by Sam.
12185
12186 - add some support for the split window object
12187
12188 This fixes many layout tests.
12189
12190 * VM/Machine.cpp:
12191 (KJS::resolveBaseAndFunc): Use toThisObject() to ensure we get the
12192 wrapper global, if one exists, as the "this" object.
12193 * kjs/function.cpp:
12194 (KJS::globalFuncEval): Use toGlobalObject() to handle the wrapper
12195 case properly.
12196
12197 2008-04-21 Maciej Stachowiak <mjs@apple.com>
12198
12199 Reviewed by Oliver.
12200
12201 - restore ScopeChain::operator= to avoid crash on many layout tests
12202
12203 Otherwise, FunctionImp::setScope would cause a reference
12204 underflow. I implemented using the copy construct and swap idiom.
12205
12206 * kjs/scope_chain.h:
12207 (KJS::ScopeChain::swap):
12208 (KJS::ScopeChain::operator=):
12209
12210 2008-04-21 Oliver Hunt <oliver@apple.com>
12211
12212 Reviewed by Geoff.
12213
12214 Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
12215 <https://bugs.webkit.org/show_bug.cgi?id=18649>
12216
12217 Allocate a callframe for eval() and initialise with a null codeBlock to
12218 indicate native code. This prevents the unwinder from clobbering the
12219 register stack.
12220
12221 * VM/Machine.cpp:
12222 (KJS::Machine::execute):
12223
12224 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12225
12226 Reviewed by Sam Weinig.
12227
12228 Removed ScopeChain::push(ScopeChain&) because it was unused. Moved
12229 ScopeChain::print to ScopeChainNode.
12230
12231 ScopeChain is now nothing more than a resource-handling wrapper around
12232 ScopeChainNode.
12233
12234 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
12235
12236 Reviewed by Maciej.
12237
12238 Bug 18671: SquirrelFish: continue inside switch fails
12239 <https://bugs.webkit.org/show_bug.cgi?id=18671>
12240
12241 * VM/CodeGenerator.cpp:
12242 (KJS::CodeGenerator::jumpContextForLabel):
12243 * VM/CodeGenerator.h:
12244 * kjs/nodes.cpp:
12245 (KJS::ContinueNode::emitCode):
12246
12247 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12248
12249 Reviewed by Sam Weinig.
12250
12251 Moved push(JSObject*) and pop() from ScopeChain to ScopeChainNode,
12252 rearranging scope_chain.h a bit.
12253
12254 SunSpider reports no change.
12255
12256 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12257
12258 Reviewed by Sam Weinig.
12259
12260 Moved bottom() from ScopeChain to ScopeChainNode, simplifying it based
12261 on the knowledge that the ScopeChain is never empty.
12262
12263 SunSpider reports no change.
12264
12265 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12266
12267 Reviewed by Oliver Hunt.
12268
12269 Moved begin() and end() from ScopeChain to ScopeChainNode.
12270
12271 Also marked a few methods "const".
12272
12273 SunSpider reports no change.
12274
12275 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12276
12277 Reviewed by Maciej Stachowiak.
12278
12279 Turned ScopeChain::depth into a stand-alone function, and simplified it
12280 a bit.
12281
12282 I also moved ScopeChain::depth to Machine.cpp because it doesn't report
12283 the true depth of the ScopeChain -- just the Machine's perspective of
12284 its depth within a given call frame.
12285
12286 SunSpider reports no change.
12287
12288 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12289
12290 Reviewed by Maciej Stachowiak.
12291
12292 Removed indirection in ScopeChain::ref / ScopeChain::deref.
12293
12294 SunSpider reports no change.
12295
12296 * kjs/scope_chain.h:
12297 (KJS::ScopeChain::ScopeChain):
12298 (KJS::ScopeChain::~ScopeChain):
12299 (KJS::ScopeChain::clear):
12300
12301 2008-04-21 Oliver Hunt <oliver@apple.com>
12302
12303 Fix debug build
12304
12305 * kjs/nodes.cpp:
12306 (KJS::ConstDeclNode::evaluateSingle):
12307
12308 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
12309
12310 Reviewed by Oliver.
12311
12312 Bug 18664: SQUIRRELFISH: correctly throw a SyntaxError when parsing of eval code fails
12313 <https://bugs.webkit.org/show_bug.cgi?id=18664>
12314
12315 Correctly throw a SyntaxError when parsing of eval code fails.
12316
12317 * VM/Machine.cpp:
12318 (KJS::eval):
12319
12320 2008-04-21 Oliver Hunt <oliver@apple.com>
12321
12322 Reviewed by Geoff.
12323
12324 Partial fix for Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
12325
12326 Make sure we correct the register state before jumping to vm_throw.
12327
12328 * VM/Machine.cpp:
12329 (KJS::Machine::privateExecute):
12330
12331 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12332
12333 Reviewed by Maciej Stachowiak.
12334
12335 Simplified ScopeChain ref/deref.
12336
12337 SunSpider reports a .4% speedup.
12338
12339 * kjs/scope_chain.h:
12340 (KJS::ScopeChainNode::ref): Removed this function because it was nonsense.
12341 ScopeChainNodes are initialized with a refCount of 1, so the loop was
12342 guaranteed to iterate exactly once.
12343
12344 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12345
12346 Reviewed by Maciej Stachowiak.
12347
12348 Removed support for empty ScopeChains.
12349
12350 SunSpider reports no change.
12351
12352 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12353
12354 Reviewed by Maciej Stachowiak.
12355
12356 Removed some completely unused ScopeChain member functions.
12357
12358 SunSpider reports no change.
12359
12360 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12361
12362 Reviewed by Maciej Stachowiak.
12363
12364 Avoid creating unnecessary ScopeChain objects, to reduce refcount churn.
12365
12366 SunSpider reports no change.
12367
12368 2008-04-21 Maciej Stachowiak <mjs@apple.com>
12369
12370 Rubber stamped by Alexey.
12371
12372 Add some braces.x
12373
12374 * kjs/testkjs.cpp:
12375 (runWithScripts):
12376
12377 2008-04-21 Maciej Stachowiak <mjs@apple.com>
12378
12379 Reviewed by Oliver.
12380
12381 - only print "End:" output when -d flag is passed.
12382
12383 This fixes half of our failing JSC regression tests.
12384
12385 * kjs/testkjs.cpp:
12386 (runWithScripts):
12387
12388 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
12389
12390 Reviewed by Maciej.
12391
12392 Add support for variable declarations in eval code.
12393
12394 * VM/CodeBlock.h:
12395 (KJS::EvalCodeBlock::EvalCodeBlock):
12396 * VM/CodeGenerator.cpp:
12397 (KJS::CodeGenerator::CodeGenerator):
12398 * VM/CodeGenerator.h:
12399 * VM/Machine.cpp:
12400 (KJS::Machine::execute):
12401 * VM/Machine.h:
12402 * kjs/function.cpp:
12403 (KJS::globalFuncEval):
12404 * kjs/nodes.cpp:
12405 (KJS::EvalNode::generateCode):
12406 * kjs/nodes.h:
12407 (KJS::EvalNode::):
12408
12409 2008-04-20 Oliver Hunt <oliver@apple.com>
12410
12411 Reviewed by Maciej.
12412
12413 Throw exceptions for invalid continue, break, and return statements.
12414
12415 Simple refactoring and extension of Cameron's AssignErrorNode, etc patch
12416
12417 * VM/CodeGenerator.cpp:
12418 (KJS::CodeGenerator::CodeGenerator):
12419 (KJS::CodeGenerator::pushJumpContext):
12420 (KJS::CodeGenerator::popJumpContext):
12421 (KJS::CodeGenerator::jumpContextForLabel):
12422 * VM/CodeGenerator.h:
12423 * kjs/nodes.cpp:
12424 (KJS::Node::emitThrowError):
12425 (KJS::ContinueNode::emitCode):
12426 (KJS::BreakNode::emitCode):
12427 (KJS::ReturnNode::emitCode):
12428 * kjs/nodes.h:
12429
12430 2008-04-20 Geoffrey Garen <ggaren@apple.com>
12431
12432 Reviewed by Oliver Hunt.
12433
12434 Removed Machine.cpp from AllInOneFile.cpp, and manually inlined a few
12435 things that used to be inlined automatically.
12436
12437 1.9% speedup on SunSpider.
12438
12439 My hope is that we'll face fewer surprises in Machine.cpp codegen, now
12440 that GCC is making fewer decisions. The speedup seems to confirm that.
12441
12442 2008-04-20 Oliver Hunt <oliver@apple.com>
12443
12444 Reviewed by Maciej.
12445
12446 Bug 18642: Iterator context may get placed into the return register, leading to much badness
12447 <https://bugs.webkit.org/show_bug.cgi?id=18642>
12448
12449 To prevent incorrectly reusing what will become the result register for
12450 eval and global code execution, we need to request and ref the destination
12451 in advance of codegen. Unfortunately this may lead to unnecessary copying,
12452 although in future we can probably limit this. Curiously SunSpider shows
12453 a progression in a number of tests, although it comes out as a wash overall.
12454
12455 * kjs/nodes.cpp:
12456 (KJS::EvalNode::emitCode):
12457 (KJS::ProgramNode::emitCode):
12458
12459 2008-04-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
12460
12461 Reviewed by Maciej.
12462
12463 Add support for AssignErrorNode, PrefixErrorNode, and PostfixErrorNode.
12464
12465 * VM/CodeBlock.cpp:
12466 (KJS::CodeBlock::dump):
12467 * VM/CodeGenerator.cpp:
12468 (KJS::CodeGenerator::emitCreateError):
12469 * VM/CodeGenerator.h:
12470 * VM/Machine.cpp:
12471 (KJS::Machine::privateExecute):
12472 * VM/Opcode.h:
12473 * kjs/nodes.cpp:
12474 (KJS::PostfixErrorNode::emitCode):
12475 (KJS::PrefixErrorNode::emitCode):
12476 (KJS::AssignErrorNode::emitCode):
12477 * kjs/nodes.h:
12478
12479 2008-04-20 Oliver Hunt <oliver@apple.com>
12480
12481 Reviewed by Geoff and Mark.
12482
12483 Provide line number information in exceptions
12484
12485 Simple patch, adds line number information metadata to CodeBlock
12486 and a simple method to get the line number responsible for a given
12487 Instruction*.
12488
12489 * VM/CodeBlock.cpp:
12490 (KJS::CodeBlock::lineNumberForVPC):
12491 * VM/CodeBlock.h:
12492 * VM/CodeGenerator.h:
12493 (KJS::CodeGenerator::emitNode):
12494 * VM/Machine.cpp:
12495 (KJS::Machine::throwException):
12496
12497 2008-04-20 Oliver Hunt <oliver@apple.com>
12498
12499 Reviewed by Maciej.
12500
12501 Provide "sourceURL" in exceptions
12502
12503 * VM/CodeBlock.h:
12504 * VM/Machine.cpp:
12505 (KJS::Machine::throwException):
12506 * kjs/nodes.cpp:
12507 (KJS::EvalNode::generateCode):
12508 (KJS::ProgramNode::generateCode):
12509
12510 2008-04-19 Oliver Hunt <oliver@apple.com>
12511
12512 Reviewed by Maciej.
12513
12514 Don't call emitCode directly on subnodes, instead use CodeGenerator::emitNode
12515
12516 This patch just a preparation for tracking line numbers.
12517
12518 * kjs/nodes.cpp:
12519 (KJS::ObjectLiteralNode::emitCode):
12520 (KJS::PropertyListNode::emitCode):
12521 (KJS::ArgumentListNode::emitCode):
12522 (KJS::TryNode::emitCode):
12523
12524 2008-04-19 Oliver Hunt <oliver@apple.com>
12525
12526 Reviewed by Maciej.
12527
12528 Bug 18619: Support continue, break, and return in try .. finally blocks
12529 <https://bugs.webkit.org/show_bug.cgi?id=18619>
12530
12531 This patch replaces the current partial finally support (which uses code
12532 duplication to achieve what it does) with a subroutine based approach.
12533 This has a number of advantages over code duplication:
12534 * Reduced code size
12535 * Simplified exception handling as the finaliser code only exists in
12536 one place, so no "magic" is needed to get the correct handler for a
12537 finaliser.
12538 * When we support instruction to line number mapping we won't need to
12539 worry about the dramatic code movement caused by duplication
12540
12541 On the downside it is necessary to add two new opcodes, op_jsr and op_sret
12542 to enter and exit the finaliser subroutines, happily SunSpider reports
12543 a performance progression (gcc amazes me) and ubench reports a wash.
12544
12545 While jsr and sret provide a mechanism that allows us to enter and exit
12546 any arbitrary finaliser we need to, it was still necessary to increase
12547 the amount of information tracked when entering and exiting both finaliser
12548 scopes and dynamic scopes ("with"). This means "scopeDepth" is now
12549 the combination of "finaliserDepth" and "dynamicScopeDepth". We also
12550 now use a scopeContextStack to ensure that we pop scopes and execute
12551 finalisers in the correct order. This increases the cost of "with" nodes
12552 during codegen, but it should not be significant enough to effect real
12553 world performance and greatly simplifies codegen for return, break and
12554 continue when interacting with finalisers.
12555
12556 * VM/CodeBlock.cpp:
12557 (KJS::CodeBlock::dump):
12558 Pretty printing of jsr/sret opcodes
12559
12560 * VM/CodeGenerator.cpp:
12561 (KJS::CodeGenerator::CodeGenerator):
12562 (KJS::CodeGenerator::emitPushScope):
12563 (KJS::CodeGenerator::emitPopScope):
12564 Dynamic scopes need to be tracked on the scopeContextStack now
12565
12566 (KJS::CodeGenerator::pushFinallyContext):
12567 (KJS::CodeGenerator::popFinallyContext):
12568 Handle entry and exit from code regions with finalisers. This is
12569 needed solely to support return, continue and break inside finaliser
12570 regions.
12571
12572 (KJS::CodeGenerator::emitComplexJumpScopes):
12573 Helper function for emitJumpScopes to handle the complex codegen
12574 needed to handle return, continue and break inside a finaliser region
12575
12576 (KJS::CodeGenerator::emitJumpScopes):
12577 Updated to be aware of finalisers, if a cross-scope jump occurs inside
12578 a finaliser we hand off codegen to emitComplexJumpScopes, otherwise
12579 we can handle the normal (trivial) case with a single instruction.
12580
12581 (KJS::CodeGenerator::emitJumpSubroutine):
12582 (KJS::CodeGenerator::emitSubroutineReturn):
12583 Trivial opcode emitter functions.
12584
12585 * VM/CodeGenerator.h:
12586 (KJS::CodeGenerator::scopeDepth):
12587 * VM/Machine.cpp:
12588 (KJS::Machine::privateExecute):
12589 Implement op_jsr and op_sret.
12590
12591 * VM/Opcode.h:
12592 Ad op_jsr and op_sret
12593
12594 * kjs/nodes.cpp:
12595 (KJS::TryNode::emitCode):
12596 Fix codegen for new finaliser model.
12597
12598 2008-04-17 Mark Rowe <mrowe@apple.com>
12599
12600 Rubber-stamped by Oliver Hunt.
12601
12602 Remove unnecessary files from testkjs, testapi and minidom targets.
12603
12604 * JavaScriptCore.xcodeproj/project.pbxproj:
12605
12606 2008-04-17 Geoffrey Garen <ggaren@apple.com>
12607
12608 Reviewed by Oliver Hunt.
12609
12610 Fixed ASSERT seen during run-sunspider of a debug build.
12611
12612 * VM/CodeGenerator.h: Made the default codegen buffers bigger. SunSpider
12613 runs all tests in one global environment, so you end up with more than
12614 128 locals. This is just a stop-gap until we code up a real
12615 solution to arbitrary symbol and label limits.
12616
12617 2008-04-17 Geoffrey Garen <ggaren@apple.com>
12618
12619 Reviewed by Oliver Hunt.
12620
12621 Fixed a bug in exception unwinding, where we wouldn't deref the scope
12622 chain in global scope, so we would leak ScopeChainNodes when exceptions
12623 were thrown inside "with" and "catch" scopes.
12624
12625 Also did some cleanup of the unwinding code along the way.
12626
12627 Scope chain reference counting is still wrong in a few ways. I thought
12628 I would fix this portion of it first.
12629
12630 run-sunspider shows no change.
12631
12632 * VM/Machine.cpp:
12633 (KJS::Machine::unwindCallFrame):
12634 (KJS::Machine::throwException):
12635 (KJS::Machine::privateExecute):
12636 * VM/Machine.h:
12637
12638 2008-04-17 Oliver Hunt <oliver@apple.com>
12639
12640 Reviewed by Maciej.
12641
12642 Add more exception checking to toNumber conversions
12643
12644 This corrects op_pre_dec, op_negate, op_mod and op_sub.
12645
12646 * VM/Machine.cpp:
12647 (KJS::Machine::privateExecute):
12648
12649 2008-04-17 Geoffrey Garen <ggaren@apple.com> and Cameron Zwarich <cwzwarich@uwaterloo.ca>
12650
12651 Reviewed by Oliver Hunt.
12652
12653 Behold: eval.
12654
12655 Introduced a new opcode: op_call_eval. In the normal case, it performs
12656 an eval. In the case where eval has been overridden in some way, it
12657 performs a function call.
12658
12659 * VM/CodeGenerator.h: Added a feature so the code generator knows not
12660 to optimized locals in eval code.
12661
12662 2008-04-17 Geoffrey Garen <ggaren@apple.com>
12663
12664 Reviewed by Sam Weinig.
12665
12666 Added some ASSERTs to document codegen failures in
12667 run-javascriptcore-tests.
12668
12669 For all tests, program-level codegen now either succeeds, or fails with
12670 an ASSERT.
12671
12672 * VM/CodeGenerator.cpp:
12673 (KJS::CodeGenerator::addVar):
12674 (KJS::CodeGenerator::CodeGenerator):
12675 (KJS::CodeGenerator::newTemporary):
12676 (KJS::CodeGenerator::newLabel):
12677
12678 2008-04-17 Geoffrey Garen <ggaren@apple.com>
12679
12680 Reviewed by Maciej Stachowiak.
12681
12682 Fixed another case of a dst register being an unreferenced temporary
12683 (caused an ASSERT when running the full sunspider suite).
12684
12685 * kjs/nodes.cpp:
12686 (KJS::CaseBlockNode::emitCodeForBlock):
12687
12688 2008-04-16 Maciej Stachowiak <mjs@apple.com>
12689
12690 Reviewed by Geoff.
12691
12692 - add documentation (and meaningful parameter names) for arithmetic and bitwise binary ops
12693
12694 * VM/CodeBlock.cpp:
12695 (KJS::CodeBlock::dump):
12696 * VM/CodeGenerator.cpp:
12697 (KJS::CodeGenerator::emitMul):
12698 (KJS::CodeGenerator::emitDiv):
12699 (KJS::CodeGenerator::emitMod):
12700 (KJS::CodeGenerator::emitSub):
12701 (KJS::CodeGenerator::emitLeftShift):
12702 (KJS::CodeGenerator::emitRightShift):
12703 (KJS::CodeGenerator::emitUnsignedRightShift):
12704 (KJS::CodeGenerator::emitBitAnd):
12705 (KJS::CodeGenerator::emitBitXOr):
12706 (KJS::CodeGenerator::emitBitOr):
12707 * VM/CodeGenerator.h:
12708 * VM/Machine.cpp:
12709 (KJS::Machine::privateExecute):
12710 * VM/Opcode.h:
12711 * kjs/nodes.cpp:
12712 (KJS::MultNode::emitCode):
12713 (KJS::DivNode::emitCode):
12714 (KJS::ModNode::emitCode):
12715 (KJS::SubNode::emitCode):
12716 (KJS::LeftShiftNode::emitCode):
12717 (KJS::RightShiftNode::emitCode):
12718 (KJS::UnsignedRightShiftNode::emitCode):
12719 (KJS::BitAndNode::emitCode):
12720 (KJS::BitXOrNode::emitCode):
12721 (KJS::BitOrNode::emitCode):
12722 (KJS::emitReadModifyAssignment):
12723 (KJS::ReadModifyResolveNode::emitCode):
12724
12725 2008-04-16 Oliver Hunt <oliver@apple.com>
12726
12727 Reviewed by Geoff.
12728
12729 Exception checks for toNumber in op_pre_inc
12730
12731 This is somewhat more convoluted than the simple hadException checks
12732 we currently use. Instead we use special toNumber conversions that
12733 select between the exception and ordinary vPC. This allows us to
12734 remove any branches in the common case (incrementing a number).
12735
12736 * API/JSCallbackObject.h:
12737 * API/JSCallbackObjectFunctions.h:
12738 (KJS::::toNumber):
12739 * ChangeLog:
12740 * JavaScriptCore.exp:
12741 * JavaScriptCore.xcodeproj/project.pbxproj:
12742 * VM/JSPropertyNameIterator.cpp:
12743 (KJS::JSPropertyNameIterator::toNumber):
12744 * VM/JSPropertyNameIterator.h:
12745 * VM/Machine.cpp:
12746 (KJS::Machine::privateExecute):
12747 * VM/Opcode.h:
12748 * kjs/ExecState.cpp:
12749 (KJS::ExecState::ExecState):
12750 * kjs/ExecState.h:
12751 * kjs/JSNotAnObject.cpp:
12752 (KJS::JSNotAnObject::toNumber):
12753 * kjs/JSNotAnObject.h:
12754 * kjs/internal.cpp:
12755 (KJS::StringImp::toNumber):
12756 (KJS::NumberImp::toNumber):
12757 (KJS::GetterSetterImp::toNumber):
12758 * kjs/internal.h:
12759 * kjs/object.cpp:
12760 (KJS::JSObject::toNumber):
12761 * kjs/object.h:
12762 * kjs/value.h:
12763 (KJS::JSValue::toNumber):
12764
12765 2008-04-16 Maciej Stachowiak <mjs@apple.com>
12766
12767 Reviewed by Geoff.
12768
12769 - ensure that activations are kept in a register to protect them from GC
12770
12771 Also renamed OptionalCalleeScopeChain constant to OptionalCalleeActivation, since
12772 that is what is now kept there, and there is no more need to keep the scope chain in
12773 the register file.
12774
12775 * VM/Machine.cpp:
12776 (KJS::initializeCallFrame):
12777 (KJS::scopeChainForCall):
12778 * VM/Machine.h:
12779 (KJS::Machine::):
12780
12781 2008-04-16 Geoffrey Garen <ggaren@apple.com>
12782
12783 Reviewed by Oliver Hunt.
12784
12785 Made "this" work in program code / global scope.
12786
12787 The machine can initialize "this" prior to execution because it knows
12788 that, for program code, "this" is always stored in lr1.
12789
12790 * VM/Machine.cpp:
12791 (KJS::Machine::execute):
12792 * VM/Machine.h:
12793 (KJS::Machine::):
12794 * kjs/interpreter.cpp:
12795 (KJS::Interpreter::evaluate):
12796
12797 2008-04-16 Geoffrey Garen <ggaren@apple.com>
12798
12799 Reviewed by Oliver Hunt.
12800
12801 Fixed a codegen bug when returning from inside a dynamic scope (a with
12802 or catch block): we need to pop any dynamic scope(s) that have been
12803 added so op_ret can find the activation object at the top of the scope
12804 chain.
12805
12806 * kjs/nodes.cpp:
12807 (KJS::ReturnNode::emitCode): If we're returning from inside a dynamic
12808 scope, emit a jmp_scopes to take care of popping any dynamic scope(s)
12809 and then branching to the return instruction.
12810
12811 2008-04-16 Maciej Stachowiak <mjs@apple.com>
12812
12813 Reviewed by Geoff.
12814
12815 - document the add and get_prop_id opcodes
12816
12817 In addition to adding documentation in comments, I changed
12818 references to register IDs or indices relating to these opcodes to
12819 have meaningful names instead of r0 r1 r2.
12820
12821 * VM/CodeGenerator.cpp:
12822 (KJS::CodeGenerator::emitAdd):
12823 * VM/CodeGenerator.h:
12824 * VM/Machine.cpp:
12825 (KJS::Machine::privateExecute):
12826 * kjs/nodes.cpp:
12827 (KJS::DotAccessorNode::emitCode):
12828 (KJS::FunctionCallDotNode::emitCode):
12829 (KJS::PostIncDotNode::emitCode):
12830 (KJS::PostDecDotNode::emitCode):
12831 (KJS::PreIncDotNode::emitCode):
12832 (KJS::PreDecDotNode::emitCode):
12833 (KJS::AddNode::emitCode):
12834 (KJS::ReadModifyDotNode::emitCode):
12835
12836 2008-04-15 Geoffrey Garen <ggaren@apple.com>
12837
12838 Reviewed by Oliver Hunt and Maciej Stachowiak.
12839
12840 Fixed a codegen bug in with and switch, and added an ASSERT to
12841 make sure it doesn't happen again.
12842
12843 emitCode() assumes that dst, if non-zero, is either referenced or
12844 non-temporary (i.e., it assumes that newTemporary() will return a
12845 register not equal to dst). Certain callers to emitCode() weren't
12846 guaranteeing that to be so, so temporary register values were being
12847 overwritten.
12848
12849 * VM/CodeGenerator.h:
12850 (KJS::CodeGenerator::emitNode): ASSERT that dst is referenced or non-temporary.
12851
12852 * kjs/nodes.cpp:
12853 (KJS::CommaNode::emitCode): Reference the dst we pass.
12854
12855 (KJS::WithNode::emitCode): No need to pass an explicit dst register.
12856
12857 (KJS::CaseBlockNode::emitCodeForBlock): No need to pass an explicit dst register.
12858 (KJS::SwitchNode::emitCode): No need to pass an explicit dst register.
12859
12860 * kjs/nodes.h: Made dst the last parameter to emitCodeForBlock, to match
12861 emitCode.
12862
12863 2008-04-15 Oliver Hunt <oliver@apple.com>
12864
12865 Reviewed by Maciej.
12866
12867 Bug 18526: Throw exceptions when resolve fails for op_resolve_base_and_func.
12868 <https://bugs.webkit.org/show_bug.cgi?id=18526>
12869
12870 Very simple fix, sunspider shows a 0.7% progression, ubench shows a 0.4% regression.
12871
12872 * VM/Machine.cpp:
12873 (KJS::resolveBaseAndFunc):
12874 (KJS::Machine::privateExecute):
12875
12876 2008-04-15 Maciej Stachowiak <mjs@apple.com>
12877
12878 Reviewed by Oliver.
12879
12880 - fix incorrect result on 3d-raytrace test
12881
12882 Oliver found and tracked down this bug, I just typed in the fix.
12883
12884 * VM/Machine.cpp:
12885 (KJS::slideRegisterWindowForCall): When setting omitted parameters to undefined,
12886 account for the space for local variables.
12887
12888 2008-04-15 Maciej Stachowiak <mjs@apple.com>
12889
12890 Reviewed by Oliver.
12891
12892 - fix codegen handling of dst registers
12893
12894 1.006x speedup (not sure why).
12895
12896 Most emitCode functions take an optional "dst" parameter that says
12897 where the output of the instruction should be written. I made some
12898 functions for convenient handling of the dst register:
12899
12900 * VM/CodeGenerator.h:
12901 (KJS::CodeGenerator::tempDestination): Takes the dst register. Returns it if
12902 it is not null and is a temporary, otherwise allocates a new temporary. This is
12903 intended for cases where an intermediate value might be written into the dst
12904
12905 (KJS::CodeGenerator::finalDestination): Takes the dst register and an optional
12906 register that was used as a temp destination. Picks the right thing for the final
12907 output. Intended to be used as the output register for the instruction that generates
12908 the final value of a particular node.
12909
12910 (KJS::CodeGenerator::moveToDestinationIfNeeded): Takes dst and a
12911 RegisterID; moves from the register to dst if dst is defined and
12912 different from the register. This is intended for cases where the
12913 result of a node is already in a specific register (likely a
12914 local), and so no code needs to be generated unless a specific
12915 destination has been requested, in which case a move is needed.
12916
12917 I also applied these methods throughout emitCode functions. In
12918 some cases this was just cleanup, in other cases I fixed actual
12919 codegen bugs. Below I have given specific comments for the cases
12920 where I believe I fixed a codegen bug, or improved quality of codegen.
12921
12922 * kjs/nodes.cpp:
12923 (KJS::NullNode::emitCode):
12924 (KJS::FalseNode::emitCode):
12925 (KJS::TrueNode::emitCode):
12926 (KJS::NumberNode::emitCode):
12927 (KJS::StringNode::emitCode):
12928 (KJS::RegExpNode::emitCode):
12929 (KJS::ThisNode::emitCode): Now avoids emitting a mov when dst is
12930 the same as the this register (the unlikely case of "this = this");
12931 (KJS::ResolveNode::emitCode): Now avoids emitting a mov when dst
12932 is the same as the local regiester, in the local var case (the
12933 unlikely case of "x = x");
12934 (KJS::ArrayNode::emitCode): Fixed a codegen bug where array
12935 literal element expressions may have observed an intermediate
12936 value of constructing the array.
12937 (KJS::ObjectLiteralNode::emitCode):
12938 (KJS::PropertyListNode::emitCode): Fixed a codegen bug where object literal
12939 property definition expressions may have obesrved an intermediate value of
12940 constructing the object.
12941 (KJS::BracketAccessorNode::emitCode):
12942 (KJS::DotAccessorNode::emitCode):
12943 (KJS::NewExprNode::emitCode):
12944 (KJS::FunctionCallValueNode::emitCode):
12945 (KJS::FunctionCallBracketNode::emitCode):
12946 (KJS::FunctionCallDotNode::emitCode):
12947 (KJS::PostIncResolveNode::emitCode):
12948 (KJS::PostDecResolveNode::emitCode):
12949 (KJS::PostIncBracketNode::emitCode):
12950 (KJS::PostDecBracketNode::emitCode):
12951 (KJS::PostIncDotNode::emitCode):
12952 (KJS::PostDecDotNode::emitCode):
12953 (KJS::DeleteResolveNode::emitCode):
12954 (KJS::DeleteBracketNode::emitCode):
12955 (KJS::DeleteDotNode::emitCode):
12956 (KJS::DeleteValueNode::emitCode):
12957 (KJS::VoidNode::emitCode):
12958 (KJS::TypeOfResolveNode::emitCode):
12959 (KJS::TypeOfValueNode::emitCode):
12960 (KJS::PreIncResolveNode::emitCode): Fixed a codegen bug where the final
12961 value would not be output to the dst register in the local var case.
12962 (KJS::PreDecResolveNode::emitCode): Fixed a codegen bug where the final
12963 value would not be output to the dst register in the local var case.
12964 (KJS::PreIncBracketNode::emitCode):
12965 (KJS::PreDecBracketNode::emitCode):
12966 (KJS::PreIncDotNode::emitCode):
12967 (KJS::PreDecDotNode::emitCode):
12968 (KJS::UnaryPlusNode::emitCode):
12969 (KJS::NegateNode::emitCode):
12970 (KJS::BitwiseNotNode::emitCode):
12971 (KJS::LogicalNotNode::emitCode):
12972 (KJS::MultNode::emitCode):
12973 (KJS::DivNode::emitCode):
12974 (KJS::ModNode::emitCode):
12975 (KJS::AddNode::emitCode):
12976 (KJS::SubNode::emitCode):
12977 (KJS::LeftShiftNode::emitCode):
12978 (KJS::RightShiftNode::emitCode):
12979 (KJS::UnsignedRightShiftNode::emitCode):
12980 (KJS::LessNode::emitCode):
12981 (KJS::GreaterNode::emitCode):
12982 (KJS::LessEqNode::emitCode):
12983 (KJS::GreaterEqNode::emitCode):
12984 (KJS::InstanceOfNode::emitCode):
12985 (KJS::InNode::emitCode):
12986 (KJS::EqualNode::emitCode):
12987 (KJS::NotEqualNode::emitCode):
12988 (KJS::StrictEqualNode::emitCode):
12989 (KJS::NotStrictEqualNode::emitCode):
12990 (KJS::BitAndNode::emitCode):
12991 (KJS::BitXOrNode::emitCode):
12992 (KJS::BitOrNode::emitCode):
12993 (KJS::LogicalAndNode::emitCode):
12994 (KJS::LogicalOrNode::emitCode):
12995 (KJS::ConditionalNode::emitCode):
12996 (KJS::emitReadModifyAssignment): Allow an out argument separate from the operands,
12997 needed for fixes below.
12998 (KJS::ReadModifyResolveNode::emitCode): Fixed a codegen bug where the right side of
12999 the expression may observe an intermediate value.
13000 (KJS::AssignResolveNode::emitCode): Fixed a codegen bug where the right side of the
13001 expression may observe an intermediate value.
13002 (KJS::ReadModifyDotNode::emitCode): Fixed a codegen bug where the right side of the
13003 expression may observe an intermediate value.
13004 (KJS::ReadModifyBracketNode::emitCode): Fixed a codegen bug where the right side of the
13005 expression may observe an intermediate value.
13006 (KJS::CommaNode::emitCode): Avoid writing temporary value to dst register.
13007 (KJS::ReturnNode::emitCode): Void return should return undefined, not null.
13008 (KJS::FuncExprNode::emitCode):
13009
13010 2008-04-15 Maciej Stachowiak <mjs@apple.com>
13011
13012 Reviewed by Geoff.
13013
13014 - fix huge performance regression (from trunk) in string-unpack-code
13015
13016 This restores string-unpack-code performance to parity with
13017 trunk (2.27x speedup relative to previous SquirrelFish)
13018
13019 * VM/Machine.cpp:
13020 (KJS::Machine::execute): Shrink register file after call to avoid
13021 growing repeatedly.
13022
13023 2008-04-15 Geoffrey Garen <ggaren@apple.com>
13024
13025 Reviewed by Sam Weinig.
13026
13027 Fixed dumpCallFrame to match our new convention of passing around a
13028 ScopeChainNode* instead of a ScopeChain*.
13029
13030 * JavaScriptCore.exp:
13031 * VM/Machine.cpp:
13032 (KJS::Machine::dumpCallFrame):
13033 * VM/Machine.h:
13034
13035 2008-04-15 Oliver Hunt <oliver@apple.com>
13036
13037 Reviewed by Maciej.
13038
13039 Bug 18436: Need to throw exception on read/modify/write or similar resolve for nonexistent property
13040 <https://bugs.webkit.org/show_bug.cgi?id=18436>
13041
13042 Add op_resolve_base_and_property for read/modify/write operations,
13043 this adds a "superinstruction" to resolve the base and value of a
13044 property simultaneously. Just using resolveBase and resolve results
13045 in an 5% regression in ubench, 30% in loop-empty-resolve (which is
13046 expected). 1.3% progression in sunspider, 2.1% in ubench, with a
13047 21% gain in loop-empty-resolve. The only outlier is function-missing-args
13048 which gets a 3% regression that I could never resolve.
13049
13050 * VM/CodeBlock.cpp:
13051 (KJS::CodeBlock::dump):
13052 * VM/CodeGenerator.cpp:
13053 (KJS::CodeGenerator::emitResolveBaseAndProperty):
13054 * VM/CodeGenerator.h:
13055 * VM/Machine.cpp:
13056 (KJS::resolveBaseAndProperty):
13057 (KJS::Machine::privateExecute):
13058 * VM/Opcode.h:
13059 * kjs/nodes.cpp:
13060 (KJS::PostIncResolveNode::emitCode):
13061 (KJS::PostDecResolveNode::emitCode):
13062 (KJS::PreIncResolveNode::emitCode):
13063 (KJS::PreDecResolveNode::emitCode):
13064 (KJS::ReadModifyResolveNode::emitCode):
13065
13066 2008-04-15 Maciej Stachowiak <mjs@apple.com>
13067
13068 Reviewed by Oliver.
13069
13070 - fixed "SquirrelFish crashes due to bad scope chain on some SunSpider tests"
13071 https://bugs.webkit.org/show_bug.cgi?id=18508
13072
13073 3d-raytrace and string-unpack-code now run.
13074
13075 The basic approach is to pass around ScopeChainNode* instead of
13076 ScopeChain*, which in addition to not becoming suddenly an invalid
13077 pointer also saves an indirection.
13078
13079 This is an 0.4% speedup on SunSpider --squirrelfish (1.8% on --ubench)
13080
13081 * VM/Machine.cpp:
13082 (KJS::resolve):
13083 (KJS::resolveBase):
13084 (KJS::resolveBaseAndFunc):
13085 (KJS::initializeCallFrame):
13086 (KJS::scopeChainForCall):
13087 (KJS::Machine::unwindCallFrame):
13088 (KJS::Machine::throwException):
13089 (KJS::Machine::execute):
13090 (KJS::Machine::privateExecute):
13091 * VM/Machine.h:
13092 * VM/Register.h:
13093 (KJS::Register::):
13094 * kjs/nodes.cpp:
13095 (KJS::EvalNode::generateCode):
13096 (KJS::FunctionBodyNode::generateCode):
13097 (KJS::ProgramNode::generateCode):
13098 (KJS::ProgramNode::processDeclarations):
13099 (KJS::EvalNode::processDeclarations):
13100 (KJS::FuncDeclNode::makeFunction):
13101 (KJS::FuncExprNode::makeFunction):
13102 * kjs/nodes.h:
13103 (KJS::ProgramNode::):
13104 (KJS::EvalNode::):
13105 (KJS::FunctionBodyNode::):
13106 * kjs/object.h:
13107 * kjs/scope_chain.h:
13108 (KJS::ScopeChainNode::ScopeChainNode):
13109 (KJS::ScopeChainNode::deref):
13110 (KJS::ScopeChainIterator::ScopeChainIterator):
13111 (KJS::ScopeChainIterator::operator*):
13112 (KJS::ScopeChainIterator::operator->):
13113 (KJS::ScopeChain::ScopeChain):
13114 (KJS::ScopeChain::node):
13115 (KJS::ScopeChain::deref):
13116 (KJS::ScopeChain::ref):
13117 (KJS::ScopeChainNode::ref):
13118 (KJS::ScopeChainNode::release):
13119 (KJS::ScopeChainNode::begin):
13120 (KJS::ScopeChainNode::end):
13121
13122 2008-04-14 Geoffrey Garen <ggaren@apple.com>
13123
13124 Reviewed by Oliver Hunt.
13125
13126 Fixed crash when accessing registers in a torn-off activation object.
13127
13128 * kjs/JSActivation.cpp:
13129 (KJS::JSActivation::copyRegisters): Update our registerOffset after
13130 copying our registers, since our offset should now be relative to
13131 our private register array, not the shared register file.
13132
13133 2008-04-14 Maciej Stachowiak <mjs@apple.com>
13134
13135 Reviewed by Oliver.
13136
13137 - fix a codegen flaw that makes some tests run way too fast or way too slow
13138
13139 The basic problem was that FunctionCallResolveNode results in
13140 codegen which can incorrectly write an intermediate value into the
13141 dst register even when that is a local. I added convenience
13142 functions to CodeGenerator for getting this right, but for now I
13143 only fixed FunctionCallResolve.
13144
13145 * VM/CodeGenerator.h:
13146 (KJS::CodeGenerator::tempDestination):
13147 (KJS::CodeGenerator::):
13148 * kjs/nodes.cpp:
13149 (KJS::FunctionCallResolveNode::emitCode):
13150
13151 2008-04-14 Gabor Loki <loki@inf.u-szeged.hu>
13152
13153 Reviewed and slightly tweaked by Geoffrey Garen.
13154
13155 Bug 18489: Squirrelfish doesn't build on linux
13156 <https://bugs.webkit.org/show_bug.cgi?id=18489>
13157
13158 * JavaScriptCore.pri: Add VM into include path and its files into
13159 source set
13160 * VM/JSPropertyNameIterator.cpp: Fix include name
13161 * VM/Machine.cpp: Add UNLIKELY macro for GCC
13162 * VM/Machine.h: Add missing includes
13163 * VM/RegisterFile.cpp: Add missing include
13164 * kjs/testkjs.pro: Add VM into include path
13165
13166 2008-04-14 Geoffrey Garen <ggaren@apple.com>
13167
13168 Reviewed by Sam Weinig.
13169
13170 Restored OwnPtr in some places where I had removed it previously. We
13171 can have an OwnPtr to an undefined class in a header as long as the
13172 class's destructor isn't in the header.
13173
13174 2008-04-14 Geoffrey Garen <ggaren@apple.com>
13175
13176 Reviewed by Sam Weinig.
13177
13178 Fixed access to "this" inside dynamic scopes.
13179
13180 * VM/CodeGenerator.cpp:
13181 (KJS::CodeGenerator::registerForLocal): Always return a register for
13182 "this", even if we're not optimizing access to other locals. Because
13183 "this" is a keyword, it's always in a register and always accessible.
13184
13185 * VM/CodeGenerator.h:
13186 (KJS::CodeGenerator::shouldOptimizeLocals): Factored out a function
13187 for determining whether we should optimize access to locals, since
13188 eval will need to make this test a little more complicated.
13189
13190 2008-04-14 Maciej Stachowiak <mjs@apple.com>
13191
13192 Reviewed by Adam.
13193
13194 - fix crash when running SunSpider full harness
13195
13196 When growing the register file's buffer to make space for new globals,
13197 make sure to copy accounting for the fact that the new space is logically
13198 at the beginning of the buffer in this case, instead of at the end as when
13199 growing for a new call frame.
13200
13201 * VM/RegisterFile.cpp:
13202 (KJS::RegisterFile::newBuffer):
13203 (KJS::RegisterFile::growBuffer):
13204 (KJS::RegisterFile::addGlobalSlots):
13205 * VM/RegisterFile.h:
13206
13207 2008-04-11 Geoffrey Garen <ggaren@apple.com>
13208
13209 Reviewed by Sam Weinig.
13210
13211 Mark constant pools for global and eval code (collectively known as
13212 "program code"). (Constant pools for function code are already marked by
13213 their functions.)
13214
13215 The global object is responsible for marking program code constant
13216 pools. Code blocks add themselves to the mark set at creation time, and
13217 remove themselves from the mark set at destruction time.
13218
13219 sunspider --squirrelfish reports a 1% speedup, perhaps because
13220 generateCode() is now non-virtual.
13221
13222 * kjs/nodes.cpp: I had to use manual init and delete in this file
13223 because putting an OwnPtr into the header would have created a circular
13224 header dependency.
13225
13226 2008-04-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
13227
13228 Reviewed by Maciej.
13229
13230 Bug 18231: Improve support for function call nodes in SquirrelFish
13231 <https://bugs.webkit.org/show_bug.cgi?id=18231>
13232
13233 Use correct value of 'this' for function calls.
13234
13235 * VM/CodeBlock.cpp:
13236 (KJS::CodeBlock::dump):
13237 * VM/CodeGenerator.cpp:
13238 (KJS::CodeGenerator::emitResolveBaseAndFunc):
13239 * VM/CodeGenerator.h:
13240 * VM/Machine.cpp:
13241 (KJS::resolveBaseAndFunc):
13242 (KJS::Machine::privateExecute):
13243 * VM/Opcode.h:
13244 * kjs/nodes.cpp:
13245 (KJS::FunctionCallResolveNode::emitCode):
13246
13247 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13248
13249 This time for sure.
13250
13251 * kjs/interpreter.cpp:
13252 (KJS::Interpreter::evaluate):
13253
13254 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13255
13256 Reviewed by Sam Weinig.
13257
13258 Fixed Interpreter::execute to honor the new model for returning non-NULL
13259 values when an exception is thrown.
13260
13261 * kjs/interpreter.cpp:
13262 (KJS::Interpreter::evaluate):
13263
13264 2008-04-10 Oliver Hunt <oliver@apple.com>
13265
13266 Reviewed by Geoff.
13267
13268 Fix SquirrelFish interpreter to pass internal exceptions back to
13269 native code correctly.
13270
13271 * JavaScriptCore.xcodeproj/project.pbxproj:
13272 * VM/Machine.cpp:
13273 (KJS::Machine::privateExecute):
13274
13275 2008-04-10 Sam Weinig <sam@webkit.org>
13276
13277 Reviewed by Geoffrey Garen.
13278
13279 Replace the use of getCallData in op_construct with the new
13280 getConstructData function that replaces implementsConstruct.
13281
13282 * API/JSCallbackConstructor.cpp:
13283 (KJS::JSCallbackConstructor::getConstructData):
13284 * API/JSCallbackConstructor.h:
13285 * API/JSCallbackObject.h:
13286 * API/JSCallbackObjectFunctions.h:
13287 (KJS::::getConstructData):
13288 (KJS::::construct):
13289 * API/JSObjectRef.cpp:
13290 (JSObjectIsConstructor):
13291 * JavaScriptCore.exp:
13292 * JavaScriptCore.xcodeproj/project.pbxproj:
13293 * VM/Machine.cpp:
13294 (KJS::Machine::privateExecute):
13295 * kjs/CallData.h:
13296 * kjs/ConstructData.h: Copied from JavaScriptCore/kjs/CallData.h.
13297 * kjs/array_object.cpp:
13298 (KJS::ArrayObjectImp::getConstructData):
13299 * kjs/array_object.h:
13300 * kjs/bool_object.cpp:
13301 (KJS::BooleanObjectImp::getConstructData):
13302 * kjs/bool_object.h:
13303 * kjs/date_object.cpp:
13304 (KJS::DateObjectImp::getConstructData):
13305 * kjs/date_object.h:
13306 * kjs/error_object.cpp:
13307 (KJS::ErrorObjectImp::getConstructData):
13308 (KJS::NativeErrorImp::getConstructData):
13309 * kjs/error_object.h:
13310 * kjs/function.cpp:
13311 (KJS::FunctionImp::getCallData):
13312 (KJS::FunctionImp::getConstructData):
13313 (KJS::FunctionImp::construct):
13314 * kjs/function.h:
13315 * kjs/function_object.cpp:
13316 (KJS::FunctionObjectImp::getConstructData):
13317 * kjs/function_object.h:
13318 * kjs/nodes.cpp:
13319 (KJS::NewExprNode::inlineEvaluate):
13320 * kjs/number_object.cpp:
13321 (KJS::NumberObjectImp::getConstructData):
13322 * kjs/number_object.h:
13323 * kjs/object.cpp:
13324 * kjs/object.h:
13325 * kjs/object_object.cpp:
13326 (KJS::ObjectObjectImp::getConstructData):
13327 * kjs/object_object.h:
13328 * kjs/regexp_object.cpp:
13329 (KJS::RegExpObjectImp::getConstructData):
13330 * kjs/regexp_object.h:
13331 * kjs/string_object.cpp:
13332 (KJS::StringObjectImp::getConstructData):
13333 * kjs/string_object.h:
13334 * kjs/value.cpp:
13335 (KJS::JSCell::getConstructData):
13336 * kjs/value.h:
13337 (KJS::JSValue::getConstructData):
13338
13339 2008-04-10 Oliver Hunt <oliver@apple.com>
13340
13341 Reviewed by Geoff.
13342
13343 Bug 18420: SquirrelFish: need to throw Reference and Type errors
13344 when attempting invalid operations on JSValues
13345
13346 Add validation and exception checks to SquirrelFish so that the
13347 correct exceptions are thrown for undefined variables, type errors
13348 and toObject failure. Also handle exceptions thrown by native
13349 function calls.
13350
13351 * JavaScriptCore.xcodeproj/project.pbxproj:
13352 * VM/ExceptionHelpers.cpp: Added.
13353 (KJS::substitute):
13354 (KJS::createError):
13355 (KJS::createUndefinedVariableError):
13356 * VM/ExceptionHelpers.h: Added.
13357 Helper functions
13358 * VM/Machine.cpp:
13359 (KJS::resolve):
13360 Modified to signal failure
13361 (KJS::isNotObject):
13362 Wrapper for JSValue::isObject and exception creation (these need
13363 to be merged, lest GCC go off the deep end)
13364 (KJS::Machine::privateExecute):
13365 Adding the many exception and validity checks.
13366
13367 * kjs/JSNotAnObject.cpp: Added.
13368 Stub object used to reduce the need for multiple exception checks
13369 when toObject fails.
13370 (KJS::JSNotAnObject::toPrimitive):
13371 (KJS::JSNotAnObject::getPrimitiveNumber):
13372 (KJS::JSNotAnObject::toBoolean):
13373 (KJS::JSNotAnObject::toNumber):
13374 (KJS::JSNotAnObject::toString):
13375 (KJS::JSNotAnObject::toObject):
13376 (KJS::JSNotAnObject::mark):
13377 (KJS::JSNotAnObject::getOwnPropertySlot):
13378 (KJS::JSNotAnObject::put):
13379 (KJS::JSNotAnObject::deleteProperty):
13380 (KJS::JSNotAnObject::defaultValue):
13381 (KJS::JSNotAnObject::construct):
13382 (KJS::JSNotAnObject::callAsFunction):
13383 (KJS::JSNotAnObject::getPropertyNames):
13384 * kjs/JSNotAnObject.h: Added.
13385 (KJS::JSNotAnObject::JSNotAnObject):
13386 * kjs/JSImmediate.cpp:
13387 (KJS::JSImmediate::toObject):
13388 modified to create an JSNotAnObject rather than throwing an exception
13389 directly.
13390
13391 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13392
13393 Reviewed by Oliver Hunt.
13394
13395 Pass a function body node its function's scope chain, rather than the
13396 current execution context's scope chain, when compiling it.
13397
13398 This doesn't matter yet, but it will once we start using the scope
13399 chain during compilation.
13400
13401 sunspider --squirrelfish notes a tiny speedup.
13402
13403 * VM/Machine.cpp:
13404 (KJS::Machine::privateExecute):
13405
13406 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13407
13408 Reviewed by Oliver Hunt.
13409
13410 Fix two bugs when throwing exceptions from re-entrant JS calls:
13411
13412 (1) Don't shrink the register file to 0, since our caller may still
13413 be using it.
13414
13415 (2) In case of exception, return jsNull() instead of 0 because,
13416 surprisingly, some JavaScriptCore clients rely on a function's return
13417 value being safe to operate on even if the function threw an exception.
13418
13419 Also:
13420
13421 - Changed FunctionImp::callAsFunction to honor the new semantics of
13422 exceptions not returning 0.
13423
13424 - Renamed "handlerPC" to "handlerVPC" to match other uses of "VPC".
13425
13426 - Renamed "exceptionData" to "exceptionValue", because "data" seemed to
13427 imply something more than just a JSValue.
13428
13429 - Merged prepareException into throwException, since throwException was
13430 its only caller, and it seemed weird that throwException didn't take
13431 an exception as an argument.
13432
13433 sunspider --squirrelfish does not seem to complain on my machine, but it
13434 complains a little (.6%) on Oliver's.
13435
13436 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13437
13438 Reviewed by Maciej Stachowiak.
13439
13440 Fixed op_construct for CallTypeNative to reacquire "r" before setting
13441 its return value, since registerBase can theoretically change during the
13442 execution of arbitrary code. (Not sure if any native constructors
13443 actually make this possible.)
13444
13445 sunspider --squirrelfish does not seem to complain.
13446
13447 * VM/Machine.cpp:
13448 (KJS::Machine::privateExecute):
13449
13450 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13451
13452 Reviewed by Oliver Hunt and Sam Weinig.
13453
13454 Re-entrant execution of function code (global code -> built-in function
13455 -> JS function):
13456
13457 Miraculously, sunspider --squirrelfish does not seem to complain.
13458
13459 A re-entrant function call is the same as a normal function call with
13460 one exception: the re-entrant call leaves everything except for
13461 CallerCodeBlock in the call frame header uninitialized, since the call
13462 doesn't need to return to JS code. (It sets CallerCodeBlock to 0, to
13463 indicate that the call shouldn't return to JS code.)
13464
13465 Also fixed a few issues along the way:
13466
13467 - Fixed two bugs in the read-write List implementation that caused
13468 m_size and m_buffer to go stale.
13469
13470 - Changed native call code to update "r" *before* setting the return
13471 value, since the call may in turn call JS code, which changes the value
13472 of "r".
13473
13474 - Migrated initialization of "r" outside of Machine::privateExecute,
13475 because global code and function code initialize "r" differently.
13476
13477 - Migrated a codegen warning from Machine::privateExecute to the wiki.
13478
13479 - Removed unnecessary "r" parameter from slideRegisterWindowForCall
13480
13481 * VM/Machine.cpp:
13482 (KJS::slideRegisterWindowForCall):
13483 (KJS::scopeChainForCall):
13484 (KJS::Machine::execute):
13485 (KJS::Machine::privateExecute):
13486 * VM/Machine.h:
13487 * kjs/function.cpp:
13488 (KJS::FunctionImp::callAsFunction):
13489 * kjs/list.cpp:
13490 (KJS::List::getSlice):
13491 * kjs/list.h:
13492 (KJS::List::clear):
13493
13494 2008-04-10 Maciej Stachowiak <mjs@apple.com>
13495
13496 Reviewed by Oliver.
13497
13498 - fix problem with code generation for return with no argument
13499
13500 3d-cube now runs
13501
13502 * kjs/nodes.cpp:
13503 (KJS::ReturnNode::emitCode):
13504
13505 2008-04-10 Maciej Stachowiak <mjs@apple.com>
13506
13507 Reviewed by Oliver.
13508
13509 - Implement support for JS constructors
13510
13511 access-binary-trees and access-nbody now run.
13512
13513 Inexplicably a 1% speedup.
13514
13515 * VM/Machine.cpp:
13516 (KJS::initializeCallFrame):
13517 (KJS::Machine::privateExecute):
13518 * VM/Machine.h:
13519 (KJS::Machine::):
13520
13521 2008-04-10 Maciej Stachowiak <mjs@apple.com>
13522
13523 Reviewed by Oliver.
13524
13525 - More code cleanup in preparation for JS constructors
13526
13527 Factor the remaining interesting parts of JS function calls into
13528 slideRegisterWindowForCall and scopeChainForCall.
13529
13530 * VM/Machine.cpp:
13531 (KJS::slideRegisterWindowForCall):
13532 (KJS::scopeChainForCall):
13533 (KJS::Machine::privateExecute):
13534
13535 2008-04-10 Maciej Stachowiak <mjs@apple.com>
13536
13537 Reviewed by Geoff.
13538
13539 - Code cleanup in preparation for JS constructors
13540
13541 - Renamed returnInfo to callFrame.
13542 - Made an enum which defines what goes where in the call frame.
13543 - Factored out initializeCallFrame function from op_call
13544
13545 * VM/CodeGenerator.cpp:
13546 (KJS::CodeGenerator::emitCall):
13547 (KJS::CodeGenerator::emitConstruct):
13548 * VM/Machine.cpp:
13549 (KJS::Machine::dumpRegisters):
13550 (KJS::initializeCallFrame):
13551 (KJS::Machine::unwindCallFrame):
13552 (KJS::Machine::execute):
13553 (KJS::Machine::privateExecute):
13554 * VM/Machine.h:
13555 (KJS::Machine::):
13556
13557 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13558
13559 Reviewed by Oliver Hunt.
13560
13561 Fixed two bugs in register allocation for function calls:
13562
13563 (1) op_call used to allocate codeBlock->numVars too many registers for
13564 each call frame, due to duplicated math. Fixing this revealed...
13565
13566 (2) By unconditionally calling resize(), op_call used to truncate the
13567 register file when calling a function whose registers fit wholly within
13568 the register file already allocated by its caller.
13569
13570 sunspider --squirrelfish reports no regression.
13571
13572 I also threw in a little extra formatting to dumpCallFrame, because it
13573 helped me debug these issues.
13574
13575 * VM/Machine.cpp:
13576 (KJS::Machine::dumpRegisters):
13577 (KJS::Machine::execute):
13578 (KJS::Machine::privateExecute):
13579 * VM/RegisterFile.h:
13580 (KJS::RegisterFile::shrink):
13581 (KJS::RegisterFile::grow):
13582 * VM/RegisterFileStack.cpp:
13583 (KJS::RegisterFileStack::popRegisterFile):
13584
13585 2008-04-09 Geoffrey Garen <ggaren@apple.com>
13586
13587 Reviewed by Oliver Hunt.
13588
13589 Next step toward re-entrant execution of function code (global code ->
13590 built-in function -> JS function):
13591
13592 Made op_ret return from Machine::privateExecute if its calling codeBlock
13593 is NULL.
13594
13595 I'm checking this in by itself to demonstrate that a more clever
13596 mechanism is not necessary for performance.
13597
13598 sunspider --squirrelfish reports no regression.
13599
13600 * ChangeLog:
13601 * VM/Machine.cpp:
13602 (KJS::Machine::execute):
13603 (KJS::Machine::privateExecute):
13604
13605 2008-04-09 Geoffrey Garen <ggaren@apple.com>
13606
13607 Reviewed by Maciej Stachowiak.
13608
13609 Next step toward re-entrant execution of function code (global code ->
13610 built-in function -> JS function):
13611
13612 Made Machine::execute return a value.
13613
13614 Sketched out some code for Machine::execute for functions -- still
13615 doesn't work yet, though.
13616
13617 sunspider --squirrelfish reports no regression.
13618
13619 * VM/Machine.cpp:
13620 (KJS::Machine::execute):
13621 (KJS::Machine::privateExecute):
13622 * VM/Machine.h:
13623 * kjs/interpreter.cpp:
13624 (KJS::Interpreter::evaluate):
13625 * kjs/testkjs.cpp:
13626 (runWithScripts):
13627
13628 2008-04-09 Geoffrey Garen <ggaren@apple.com>
13629
13630 Reviewed by Sam Weinig.
13631
13632 First step toward re-entrant execution of function code (global code ->
13633 built-in function -> JS function):
13634
13635 Tiny bit of refactoring in the Machine class.
13636
13637 sunspider --squirrelfish reports no regression.
13638
13639 * VM/Machine.cpp:
13640 (KJS::Machine::dumpRegisters):
13641 (KJS::Machine::unwindCallFrame):
13642 (KJS::Machine::execute):
13643 (KJS::Machine::privateExecute):
13644 * VM/Machine.h:
13645 (KJS::Machine::isGlobalCallFrame):
13646 * kjs/interpreter.cpp:
13647 (KJS::Interpreter::evaluate):
13648
13649 2008-04-08 Geoffrey Garen <ggaren@apple.com>
13650
13651 Reviewed by Oliver Hunt.
13652
13653 Support for re-entrant execution of global code (global code -> built-in
13654 function -> global code).
13655
13656 Keep a stack of register files instead of just one. Globals propogate
13657 between register files as the register files enter and exit the stack.
13658
13659 An activation still uses its own register file's base as its
13660 registerBase, but the global object uses the register file *stack*'s
13661 registerBase, which updates dynamically to match the register file at
13662 the top of the stack.
13663
13664 sunspider --squirrelfish reports no regression.
13665
13666 2008-04-08 Maciej Stachowiak <mjs@apple.com>
13667
13668 Reviewed by Geoff.
13669
13670 - initial preparatory work for JS constructors
13671
13672 1) Allocate registers for the returnInfo block and "this" value when generating code for
13673 op_construct. These are not used yet, but the JS branch of op_construct will use them.
13674
13675 2) Adjust argc and argv appropriately for native constructor calls.
13676
13677 3) Assign return value in a more straightforward way in op_ret since this is actually
13678 a bit faster (and makes up for the allocation of extra registers above).
13679
13680 * VM/CodeGenerator.cpp:
13681 (KJS::CodeGenerator::emitConstruct):
13682 * VM/Machine.cpp:
13683 (KJS::Machine::privateExecute):
13684
13685 2008-04-07 Geoffrey Garen <ggaren@apple.com>
13686
13687 Reviewed by Maciej Stachowiak.
13688
13689 Fixed crashing SunSpider tests.
13690
13691 Let's just pretend this never happened, bokay?
13692
13693 * VM/CodeGenerator.cpp:
13694 (KJS::CodeGenerator::CodeGenerator):
13695 * VM/CodeGenerator.h:
13696 * VM/RegisterFile.cpp:
13697 (KJS::RegisterFile::addGlobals):
13698
13699 2008-04-07 Geoffrey Garen <ggaren@apple.com>
13700
13701 Reviewed by Oliver Hunt.
13702
13703 Restored dumping of generated code as a command-line switch:
13704 run-testkjs -d will do it.
13705
13706 2008-04-07 Geoffrey Garen <ggaren@apple.com>
13707
13708 Reviewed by Oliver Hunt.
13709
13710 Next step toward supporting re-entrant evaluation: Moved register file
13711 maintenance code into a proper "RegisterFile" class.
13712
13713 There's a subtle change to the register file's internal layout: for
13714 global code / the global object, registerOffset is always 0 now. In
13715 other words, all register counting starts at 0, not 0 + (number of
13716 global variables). The helps simplify accounting when the number of
13717 global variables changes.
13718
13719 2008-04-07 Oliver Hunt <oliver@apple.com>
13720
13721 Reviewed by Geoff.
13722
13723 Bug 18338: Support exceptions in SquirrelFish <http://bugs.webkit.org/show_bug.cgi?id=18338>
13724
13725 Initial support for exceptions in SquirrelFish, only supports finalisers in the
13726 simple cases (eg. exceptions and non-goto/return across finaliser boundaries).
13727 This doesn't add the required exception checks to existing code, it merely adds
13728 support for throw, catch, and the required stack unwinding.
13729
13730 * VM/CodeBlock.cpp:
13731 (KJS::CodeBlock::dump):
13732 (KJS::CodeBlock::getHandlerForVPC):
13733 * VM/CodeBlock.h:
13734 * VM/CodeGenerator.cpp:
13735 (KJS::CodeGenerator::emitCatch):
13736 (KJS::CodeGenerator::emitThrow):
13737 * VM/CodeGenerator.h:
13738 * VM/JSPropertyNameIterator.cpp:
13739 (KJS::JSPropertyNameIterator::create):
13740 * VM/Machine.cpp:
13741 (KJS::prepareException):
13742 (KJS::Machine::unwindCallFrame):
13743 (KJS::Machine::throwException):
13744 (KJS::Machine::privateExecute):
13745 * VM/Machine.h:
13746 * VM/Opcode.h:
13747 * kjs/nodes.cpp:
13748 (KJS::ThrowNode::emitCode):
13749 (KJS::TryNode::emitCode):
13750 * kjs/nodes.h:
13751 * kjs/scope_chain.cpp:
13752 (KJS::ScopeChain::depth):
13753 * kjs/scope_chain.h:
13754
13755 2008-04-06 Geoffrey Garen <ggaren@apple.com>
13756
13757 Reviewed by Oliver Hunt.
13758
13759 First step toward supporting re-entrant evaluation: Switch register
13760 clients from using "registers", a pointer to a register vector, to
13761 "registerBase", an indirect pointer to the logical first entry in the
13762 register file. (The logical first entry is the first entry that is not
13763 a global variable).
13764
13765 With a vector, offsets into the register file remain good when the
13766 underlying buffer reallocates, but they go bad when the logical
13767 first entry moves. (The logical first entry moves when new global
13768 variables get added to the beginning of the register file.) With an
13769 indirect pointer to the logical first entry, offsets will remain good
13770 regardless.
13771
13772 1.4% speedup on sunspider --squirrelfish. I suspect this is due to
13773 reduced allocation when creating closures, and reduced indirection
13774 through the register vector.
13775
13776 * wtf/Vector.h: Added an accessor for an indirect pointer to the vector's
13777 buffer, which we currently use (incorrectly) for registerBase. This is
13778 temporary scaffolding to allow us to change client code without
13779 changing behavior.
13780
13781 2008-04-06 Sam Weinig <sam@webkit.org>
13782
13783 Reviewed by Oliver Hunt.
13784
13785 Implement codegen for ReadModifyDotNode.
13786
13787 * kjs/nodes.cpp:
13788 (KJS::ReadModifyDotNode::emitCode):
13789 * kjs/nodes.h:
13790
13791 2008-04-06 Sam Weinig <sam@webkit.org>
13792
13793 Reviewed by Oliver Hunt.
13794
13795 Fix codegen for PostIncDotNode and implement codegen for PostIncBracketNode,
13796 PostDecBracketNode and PostDecDotNode.
13797
13798 * kjs/nodes.cpp:
13799 (KJS::PostIncBracketNode::emitCode):
13800 (KJS::PostDecBracketNode::emitCode):
13801 (KJS::PostIncDotNode::emitCode):
13802 (KJS::PostDecDotNode::emitCode):
13803 * kjs/nodes.h:
13804
13805 2008-04-06 Sam Weinig <sam@webkit.org>
13806
13807 Reviewed by Geoffrey Garen.
13808
13809 Implement codegen for PreDecResolveNode, PreIncBracketNode, PreDecBracketNode,
13810 PreIncDotNode and PreDecDotNode. This required adding one new op code, op_pre_dec.
13811
13812 * VM/CodeBlock.cpp:
13813 (KJS::CodeBlock::dump):
13814 * VM/CodeGenerator.cpp:
13815 (KJS::CodeGenerator::emitPreDec):
13816 * VM/CodeGenerator.h:
13817 * VM/Machine.cpp:
13818 (KJS::Machine::privateExecute):
13819 * VM/Opcode.h:
13820 * kjs/nodes.cpp:
13821 (KJS::PreDecResolveNode::emitCode):
13822 (KJS::PreIncBracketNode::emitCode):
13823 (KJS::PreDecBracketNode::emitCode):
13824 (KJS::PreIncDotNode::emitCode):
13825 (KJS::PreDecDotNode::emitCode):
13826 * kjs/nodes.h:
13827
13828 2008-04-06 Geoffrey Garen <ggaren@apple.com>
13829
13830 Reviewed by Sam Weinig.
13831
13832 Improved register dumping, plus a liberal smattering of "const". Here's
13833 what the new format looks like:
13834
13835 (gdb) call (void)dumpCallFrame(codeBlock, scopeChain, registers->begin(), r)
13836 4 instructions; 48 bytes at 0x509210; 3 locals (2 parameters); 1 temporaries
13837
13838 [ 0] load lr1, undefined(@k0)
13839 [ 3] load lr1, 2(@k1)
13840 [ 6] add tr0, lr2, lr1
13841 [ 10] ret tr0
13842
13843 Constants:
13844 k0 = undefined
13845 k1 = 2
13846
13847 Register frame:
13848
13849 ----------------------------------------
13850 use | address | value
13851 ----------------------------------------
13852 [return info] | 0x80ac08 | 0x5081c0
13853 [return info] | 0x80ac0c | 0x508e90
13854 [return info] | 0x80ac10 | 0x504acc
13855 [return info] | 0x80ac14 | 0x2
13856 [return info] | 0x80ac18 | 0x0
13857 [return info] | 0x80ac1c | 0x7
13858 [return info] | 0x80ac20 | 0x0
13859 ----------------------------------------
13860 [param] | 0x80ac24 | 0x1
13861 [param] | 0x80ac28 | 0x7
13862 [var] | 0x80ac2c | 0xb
13863 [temp] | 0x80ac30 | 0xf
13864
13865 2008-04-06 Geoffrey Garen <ggaren@apple.com>
13866
13867 Reviewed by Sam Weinig.
13868
13869 Support for evaluating multiple scripts in the same global environment.
13870 (Still don't support re-entrant evaluation yet.)
13871
13872 The main changes here are:
13873
13874 (1) Obey the ECMA 10.1.3 rules regarding how to resolve collisions when
13875 a given symbol is declared more than once. (This patch fixes the same
13876 issue for function code, too.)
13877
13878 (2) In the case of var and/or function collisions, reuse the existing
13879 storage slot. For global code, this is required for previously
13880 generated instructions to continue to work. For function code, it's
13881 more of a "nice to have": it makes register layout in the case of
13882 collisions easier to understand, and has the added benefit of saving
13883 memory.
13884
13885 (3) Allocate slots in the CodeGenerator's m_locals vector in parallel
13886 to register indexes in the symbol table. This ensures that, given an
13887 index in the symbol table, we can find the corresponding RegisterID
13888 without hashing, which speeds up codegen.
13889
13890 I moved responsibility for emitting var and function initialization
13891 instructions into the CodeGenerator, because bookkeeping in cases where
13892 var, function, and/or parameter names collide requires a lot of
13893 internal knowledge about the CodeGenerator.
13894
13895 * VM/CodeGenerator.cpp:
13896 (KJS::CodeGenerator::addVar): Removed responsibility for checking whether
13897 a var declaration overwrites "arguments", because the check is
13898 inappropriate for global code, which may not have a pre-existing
13899 "arguments" symbol in scope. Also changed this function to return a
13900 boolean indicating whether addVar actually created a new RegisterID,
13901 or just reused an old one.
13902
13903 (KJS::CodeGenerator::CodeGenerator): Split out the constructors for
13904 function code and global code, since they're quite different now.
13905
13906 (KJS::CodeGenerator::registerForLocal): This function does its job
13907 without any hashing now.
13908
13909 * VM/Machine.cpp: Move old globals and update "r" before executing a
13910 new script. That way, old globals stay at a constant offset from "r",
13911 and previously optimized code still works.
13912
13913 * VM/RegisterID.h: Added the ability to allocate a RegisterID before
13914 initializing its index field. We use this for parameters now.
13915
13916 * kjs/JSVariableObject.h:
13917 (KJS::JSVariableObject::symbolTableGet): Changed the ungettable getter
13918 ASSERT to account for the fact that symbol indexes are all negative.
13919
13920 2008-04-05 Sam Weinig <sam@webkit.org>
13921
13922 Reviewed by Geoffrey Garen.
13923
13924 Implement codegen for InNode.
13925
13926 * VM/CodeBlock.cpp:
13927 (KJS::CodeBlock::dump):
13928 * VM/CodeGenerator.cpp:
13929 (KJS::CodeGenerator::emitIn):
13930 * VM/CodeGenerator.h:
13931 * VM/Machine.cpp:
13932 (KJS::Machine::privateExecute):
13933 * VM/Opcode.h:
13934 * kjs/nodes.cpp:
13935 (KJS::InNode::emitCode):
13936 * kjs/nodes.h:
13937
13938 2008-04-05 Sam Weinig <sam@webkit.org>
13939
13940 Reviewed by Oliver Hunt.
13941
13942 - Implement codegen for DeleteResolveNode, DeleteBracketNode, DeleteDotNode and DeleteValueNode.
13943
13944 * VM/CodeBlock.cpp:
13945 (KJS::CodeBlock::dump):
13946 * VM/CodeGenerator.cpp:
13947 (KJS::CodeGenerator::emitGetPropId):
13948 (KJS::CodeGenerator::emitPutPropId):
13949 (KJS::CodeGenerator::emitDeletePropId):
13950 (KJS::CodeGenerator::emitDeletePropVal):
13951 (KJS::CodeGenerator::emitPutPropIndex):
13952 * VM/CodeGenerator.h:
13953 * VM/Machine.cpp:
13954 (KJS::Machine::privateExecute):
13955 * VM/Opcode.h:
13956 * kjs/nodes.cpp:
13957 (KJS::DeleteResolveNode::emitCode):
13958 (KJS::DeleteBracketNode::emitCode):
13959 (KJS::DeleteDotNode::emitCode):
13960 (KJS::DeleteValueNode::emitCode):
13961 * kjs/nodes.h:
13962
13963 2008-04-04 Sam Weinig <sam@webkit.org>
13964
13965 Reviewed by Oliver Hunt.
13966
13967 - Implement codegen for Switch statements.
13968
13969 * VM/CodeGenerator.cpp:
13970 (KJS::CodeGenerator::pushJumpContext):
13971 (KJS::CodeGenerator::popJumpContext):
13972 (KJS::CodeGenerator::jumpContextForLabel):
13973 * VM/CodeGenerator.h:
13974 Rename LoopContext to JumpContext now that it used of Switch statements in addition
13975 to loops.
13976
13977 * kjs/nodes.cpp:
13978 (KJS::DoWhileNode::emitCode):
13979 (KJS::WhileNode::emitCode):
13980 (KJS::ForNode::emitCode):
13981 (KJS::ForInNode::emitCode):
13982 (KJS::ContinueNode::emitCode):
13983 (KJS::BreakNode::emitCode):
13984 (KJS::CaseBlockNode::emitCodeForBlock):
13985 (KJS::SwitchNode::emitCode):
13986 * kjs/nodes.h:
13987 (KJS::CaseClauseNode::expr):
13988 (KJS::CaseClauseNode::children):
13989 (KJS::CaseBlockNode::):
13990
13991 2008-04-03 Maciej Stachowiak <mjs@apple.com>
13992
13993 Reviewed by Sam.
13994
13995 - fix crash in codegen from new nodes
13996
13997 * VM/CodeGenerator.cpp:
13998 (KJS::CodeGenerator::emitConstruct):
13999 * kjs/nodes.h:
14000
14001 2008-04-03 Maciej Stachowiak <mjs@apple.com>
14002
14003 Reviewed by Geoff.
14004
14005 * kjs/nodes.cpp:
14006 (KJS::ReadModifyResolveNode::emitCode):
14007 (KJS::ReadModifyBracketNode::emitCode):
14008 * kjs/nodes.h:
14009
14010 2008-04-02 Maciej Stachowiak <mjs@apple.com>
14011
14012 Reviewed by Geoff.
14013
14014 - take a shot at marking constant pools for global and eval code
14015
14016 Geoff says this won't really work in all cases but is an ok stopgap.
14017
14018 * kjs/JSGlobalObject.cpp:
14019 (KJS::JSGlobalObject::mark):
14020
14021 2008-04-02 Maciej Stachowiak <mjs@apple.com>
14022
14023 Reviewed by Geoff.
14024
14025 - fix 2x perf regression in 3d-morph
14026
14027 * VM/Machine.cpp:
14028 (KJS::Machine::privateExecute): If we subbed in null for the global object,
14029 don't toObject it, since that will throw an exception (very slowly).
14030
14031 2008-04-02 Maciej Stachowiak <mjs@apple.com>
14032
14033 Rubber stamped by Geoff
14034
14035 - fix Release build
14036
14037 * kjs/nodes.cpp:
14038 (KJS::getNonLocalSymbol):
14039
14040 2008-04-02 Geoffrey Garen <ggaren@apple.com>
14041
14042 Reviewed by Oliver Hunt.
14043
14044 Removed the last vestiges of LocalStorage from JSVariableObject and
14045 JSGlobalObject.
14046
14047 * kjs/JSGlobalObject.cpp:
14048 (KJS::JSGlobalObject::saveLocalStorage): Save and restore from/to
14049 registers. Use stub isReadOnly and isDontEnum methods for now, until
14050 we really implement attributes in the symbol table.
14051 (KJS::JSGlobalObject::restoreLocalStorage):
14052 (KJS::JSGlobalObject::reset):
14053
14054 * kjs/JSVariableObject.cpp:
14055 (KJS::JSVariableObject::getPropertyNames): Use stub isDontEnum method
14056 for now, as above.
14057 (KJS::JSVariableObject::getPropertyAttributes): ditto
14058
14059 * kjs/JSVariableObject.h: Removed LocalStorage from JSVariableObjectData.
14060 Removed mark method, because subclasses implement different strategies for
14061 marking registers.
14062 (KJS::JSVariableObject::isReadOnly): Stub method
14063 (KJS::JSVariableObject::isDontEnum): ditto
14064
14065 Changed the code below to ASSERT_NOT_REACHED() and return 0, since it
14066 can no longer retrieve LocalStorage from the ExecState. (Eventually,
14067 we'll just remove this code and all its friends, but that's a task for
14068 later.)
14069
14070 * kjs/ExecState.cpp:
14071 (KJS::ExecState::ExecState):
14072 * kjs/function.cpp:
14073 (KJS::ActivationImp::markChildren):
14074 * kjs/function.h:
14075 * kjs/nodes.cpp:
14076 (KJS::getNonLocalSymbol):
14077 (KJS::ScopeNode::optimizeVariableAccess):
14078 (KJS::ProgramNode::processDeclarations):
14079
14080 2008-04-01 Geoffrey Garen <ggaren@apple.com>
14081
14082 Reviewed by Maciej Stachowiak.
14083
14084 Got globals?
14085
14086 To get things working, I had to roll out
14087 http://trac.webkit.org/projects/webkit/changeset/31226 for the time
14088 being.
14089
14090 * VM/CodeBlock.h: Removed obsolete function.
14091
14092 * VM/Machine.cpp:
14093 (KJS::Machine::privateExecute): For the sake of re-entrancy, we track
14094 and restore the global object's old rOffset value. (No way to test this
14095 yet, but I think it will work.)
14096
14097 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14098
14099 Reviewed by Geoff.
14100
14101 - mark the constant pool (at least for function code blocks)
14102
14103 * VM/CodeBlock.cpp:
14104 (KJS::CodeBlock::mark):
14105 * VM/CodeBlock.h:
14106 * kjs/function.cpp:
14107 (KJS::FunctionImp::mark):
14108 * kjs/nodes.cpp:
14109 (KJS::ScopeNode::mark):
14110 * kjs/nodes.h:
14111 (KJS::FuncExprNode::body):
14112 (KJS::FuncDeclNode::body):
14113
14114 2008-04-01 Geoffrey Garen <ggaren@apple.com>
14115
14116 Reviewed by Beth Dakin.
14117
14118 Cleaned up a few loose ends.
14119
14120 * JavaScriptCore.exp: Export dumpRegisters, so it's visible to gdb even
14121 if we don't explicitly call it in the source text.
14122
14123 * VM/Machine.cpp:
14124 (KJS::Machine::privateExecute): No need to call dumpRegisters anymore,
14125 since that was just a hack for gdb's sake.
14126
14127 * kjs/JSActivation.h: Removed obsolete comment.
14128
14129 * VM/CodeGenerator.cpp: Added ASSERTs to verify that the localCount
14130 we're given matches the number of locals actually allocated.
14131
14132 * VM/CodeGenerator.h:
14133 (KJS::CodeGenerator::CodeGenerator): Changed "localCount" to include
14134 the parameter count, since we're using the word "local" to mean
14135 parameter, var, function, or "this". Renamed "m_nextLocal" to
14136 "m_nextVar", since "m_nextLocal" doesn't contrast well with
14137 "m_nextParameter".
14138
14139 Also moved tracking of implicit "this" parameter from here...
14140
14141 * kjs/nodes.cpp:
14142 (KJS::FunctionBodyNode::generateCode): ... to here
14143 (KJS::ProgramNode::generateCode): ... and here
14144
14145 * VM/CodeBlock.cpp:
14146 (KJS::CodeBlock::dump): Added missing "\n".
14147
14148 2008-04-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14149
14150 Reviewed by Oliver.
14151
14152 Bug 18274: ResolveNode::emitCode() doesn't make a new temporary when dst
14153 is 0, leading to incorrect codegen
14154 <http://bugs.webkit.org/show_bug.cgi?id=18274>
14155
14156 * kjs/nodes.cpp:
14157 (KJS::FunctionCallBracketNode::emitCode):
14158 (KJS::FunctionCallDotNode::emitCode):
14159
14160 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14161
14162 Reviewed by Oliver.
14163
14164 - fix bug in for..in codegen (gotta use ident, not m_ident)
14165
14166 * kjs/nodes.cpp:
14167 (KJS::ForInNode::emitCode):
14168
14169 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14170
14171 Reviewed by Oliver.
14172
14173 - Add suport for regexp literals
14174
14175 * VM/CodeBlock.cpp:
14176 (KJS::regexpToSourceString):
14177 (KJS::regexpName):
14178 (KJS::CodeBlock::dump):
14179 * VM/CodeBlock.h:
14180 * VM/CodeGenerator.cpp:
14181 (KJS::CodeGenerator::addRegExp):
14182 (KJS::CodeGenerator::emitNewRegExp):
14183 * VM/CodeGenerator.h:
14184 * VM/Machine.cpp:
14185 (KJS::Machine::privateExecute):
14186 * VM/Opcode.h:
14187 * kjs/nodes.cpp:
14188 (KJS::RegExpNode::emitCode):
14189 * kjs/nodes.h:
14190
14191 2008-04-01 Oliver Hunt <oliver@apple.com>
14192
14193 Reviewed by Geoff
14194
14195 Add support for for..in nodes
14196
14197 Added two new opcodes to get_pnames and next_pname to handle iterating
14198 over the set of properties on an object. This iterator is explicitly
14199 invalidated and the property name array is released on standard exit
14200 from the loop, otherwise we rely on GC to do the clean up for us.
14201
14202 * JavaScriptCore.xcodeproj/project.pbxproj:
14203 * VM/CodeBlock.cpp:
14204 (KJS::CodeBlock::dump):
14205 * VM/CodeGenerator.cpp:
14206 (KJS::CodeGenerator::emitNextPropertyName):
14207 (KJS::CodeGenerator::emitGetPropertyNames):
14208 * VM/CodeGenerator.h:
14209 * VM/JSPropertyNameIterator.cpp: Added.
14210 (KJS::JSPropertyNameIterator::JSPropertyNameIterator):
14211 (KJS::JSPropertyNameIterator::type):
14212 (KJS::JSPropertyNameIterator::toPrimitive):
14213 (KJS::JSPropertyNameIterator::getPrimitiveNumber):
14214 (KJS::JSPropertyNameIterator::toBoolean):
14215 (KJS::JSPropertyNameIterator::toNumber):
14216 (KJS::JSPropertyNameIterator::toString):
14217 (KJS::JSPropertyNameIterator::toObject):
14218 (KJS::JSPropertyNameIterator::mark):
14219 (KJS::JSPropertyNameIterator::next):
14220 (KJS::JSPropertyNameIterator::invalidate):
14221 (KJS::JSPropertyNameIterator::~JSPropertyNameIterator):
14222 (KJS::JSPropertyNameIterator::create):
14223 * VM/JSPropertyNameIterator.h: Added.
14224 * VM/Machine.cpp:
14225 (KJS::Machine::privateExecute):
14226 * VM/Opcode.h:
14227 * VM/Register.h:
14228 (KJS::Register::):
14229 * kjs/PropertyNameArray.h:
14230 * kjs/nodes.cpp:
14231 (KJS::ForInNode::emitCode):
14232 * kjs/nodes.h:
14233 * kjs/value.h:
14234
14235 2008-04-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14236
14237 Reviewed by Maciej.
14238
14239 Change CodeGenerator::emitCall() so it increments the reference count of
14240 registers passed to it, and change its callers so they don't needlessly
14241 increment the reference count of the registers they are passing.
14242
14243 * VM/CodeGenerator.cpp:
14244 (KJS::CodeGenerator::emitCall):
14245 * kjs/nodes.cpp:
14246 (KJS::FunctionCallResolveNode::emitCode):
14247 (KJS::FunctionCallDotNode::emitCode):
14248
14249 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14250
14251 Reviewed by Oliver.
14252
14253 - generate call for PostIncDotNode
14254
14255 * kjs/nodes.cpp:
14256 (KJS::PostIncDotNode::emitCode):
14257 * kjs/nodes.h:
14258
14259 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14260
14261 Build fix.
14262
14263 - fix build (not sure how this ever worked?)
14264
14265 * kjs/nodes.cpp:
14266 (KJS::FunctionCallBracketNode::emitCode):
14267
14268 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14269
14270 Reviewed by Geoff.
14271
14272 - generate code for FunctionCallBracketNode
14273
14274 * kjs/nodes.cpp:
14275 (KJS::FunctionCallBracketNode::emitCode):
14276 * kjs/nodes.h:
14277
14278 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14279
14280 Reviewed by Geoff.
14281
14282 - Fix two crashing SunSpider tests
14283
14284 * VM/Machine.cpp:
14285 (KJS::Machine::privateExecute): set up 'this' properly for native calls.
14286 * kjs/list.h:
14287 (KJS::List::List): Fix intialization of buffer and size from
14288 vector, the initialization order was wrong.
14289
14290 2008-04-01 Geoffrey Garen <ggaren@apple.com>
14291
14292 Build fix: marked ASSERT-only variables as UNUSED_PARAMs.
14293
14294 * VM/Machine.cpp:
14295 (KJS::Machine::privateExecute):
14296 * kjs/JSVariableObject.h:
14297 (KJS::JSVariableObject::symbolTableInitializeVariable):
14298
14299 2008-04-01 Geoffrey Garen <ggaren@apple.com>
14300
14301 Reviewed by Oliver Hunt.
14302
14303 Next step toward global code: Moved get, put, and initializeVariable
14304 functionality up into JSVariableObject, and changed JSActivation to
14305 rely on it.
14306
14307 * kjs/JSActivation.cpp:
14308 (KJS::JSActivation::JSActivation):
14309 (KJS::JSActivation::getOwnPropertySlot):
14310 (KJS::JSActivation::put):
14311 (KJS::JSActivation::initializeVariable):
14312 * kjs/JSVariableObject.h:
14313 (KJS::JSVariableObject::valueAt):
14314 (KJS::JSVariableObject::isReadOnly):
14315 (KJS::JSVariableObject::symbolTableGet):
14316 (KJS::JSVariableObject::symbolTablePut):
14317 (KJS::JSVariableObject::symbolTableInitializeVariable):
14318
14319 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14320
14321 Reviewed by Sam.
14322
14323 - fix HashTable assertion on some SunSpider tests
14324
14325 Don't use -1 as the deleted value for JSValue*-keyed hashtables,
14326 since it is a valid value (it's the immediate for -1).
14327
14328 * VM/CodeGenerator.h:
14329 (KJS::CodeGenerator::JSValueHashTraits::emptyValue):
14330 (KJS::CodeGenerator::JSValueHashTraits::deletedValue):
14331 * kjs/JSImmediate.h:
14332 (KJS::JSImmediate::impossibleValue):
14333
14334 2008-04-01 Sam Weinig <sam@webkit.org>
14335
14336 Reviewed by Maciej Stachowiak.
14337
14338 Add support for calling Native constructors like new Array().
14339
14340 * VM/CodeBlock.cpp:
14341 (KJS::CodeBlock::dump):
14342 * VM/CodeGenerator.cpp:
14343 (KJS::CodeGenerator::emitConstruct):
14344 * VM/CodeGenerator.h:
14345 * VM/Machine.cpp:
14346 (KJS::Machine::privateExecute):
14347 * VM/Opcode.h:
14348 * kjs/nodes.cpp:
14349 (KJS::NewExprNode::emitCode):
14350 * kjs/nodes.h:
14351
14352 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14353
14354 Reviewed by Sam.
14355
14356 - add some missing toOpbject calls to avoid crashing when calling methods on primitives
14357
14358 * VM/Machine.cpp:
14359 (KJS::Machine::privateExecute):
14360
14361 2008-04-01 Geoffrey Garen <ggaren@apple.com>
14362
14363 Reviewed by Oliver Hunt.
14364
14365 Changed Machine::dumpRegisters to take a pointer instead of a reference,
14366 so gdb understands how to call it.
14367
14368 * VM/Machine.cpp:
14369 (KJS::Machine::dumpRegisters):
14370 (KJS::Machine::privateExecute):
14371 * VM/Machine.h:
14372
14373 2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14374
14375 Reviewed by Maciej.
14376
14377 Fix CodeGenerator::addConstant() so it uses the functionExpressions
14378 counter for function expressions, not the functions counter.
14379
14380 * VM/CodeGenerator.cpp:
14381 (KJS::CodeGenerator::addConstant):
14382
14383 2008-03-31 Sam Weinig <sam@webkit.org>
14384
14385 Reviewed by Geoffrey Garen.
14386
14387 Add emitCode support for TypeOfResolveNode and TypeOfValueNode.
14388 Added new opcode op_type_of to handle them.
14389
14390 * VM/CodeBlock.cpp:
14391 (KJS::CodeBlock::dump):
14392 * VM/CodeGenerator.cpp:
14393 (KJS::CodeGenerator::emitNot):
14394 (KJS::CodeGenerator::emitInstanceOf):
14395 (KJS::CodeGenerator::emitTypeOf):
14396 * VM/CodeGenerator.h:
14397 * VM/Machine.cpp:
14398 (KJS::jsTypeStringForValue):
14399 (KJS::Machine::privateExecute):
14400 * VM/Opcode.h:
14401 * kjs/nodes.cpp:
14402 (KJS::TypeOfResolveNode::emitCode):
14403 (KJS::TypeOfValueNode::emitCode):
14404 * kjs/nodes.h:
14405
14406 2008-03-31 Sam Weinig <sam@webkit.org>
14407
14408 Reviewed by Oliver Hunt.
14409
14410 Fix non-computed goto version of isOpcode. op_end is a valid opcode.
14411
14412 * VM/Machine.cpp:
14413 (KJS::Machine::isOpcode):
14414
14415 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14416
14417 Reviewed by Maciej Stachowiak.
14418
14419 Added op_post_dec.
14420
14421 2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14422
14423 Reviewed by Geoffrey Garen.
14424
14425 Add support for FunctionCallDotNode.
14426
14427 * kjs/nodes.cpp:
14428 (KJS::FunctionCallDotNode::emitCode):
14429 * kjs/nodes.h:
14430
14431 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14432
14433 Reviewed by Beth Dakin.
14434
14435 Next step toward global code: Removed more obsolete API, moved
14436 saveLocalStorage and restoreLocalStorage to JSGlobalObject subclass,
14437 since it's only intended for use there.
14438
14439 * ChangeLog:
14440 * JavaScriptCore.exp:
14441 * kjs/Activation.h:
14442 * kjs/JSGlobalObject.cpp:
14443 (KJS::JSGlobalObject::saveLocalStorage):
14444 (KJS::JSGlobalObject::restoreLocalStorage):
14445 * kjs/JSGlobalObject.h:
14446 * kjs/JSVariableObject.cpp:
14447 * kjs/JSVariableObject.h:
14448 (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
14449 * kjs/function.cpp:
14450 (KJS::ActivationImp::ActivationImp):
14451
14452 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14453
14454 Reviewed by Beth Dakin.
14455
14456 Next step toward global code: subclass JSActivation + JSActivationData
14457 from JSVariableObject + JSVariableObjectData.
14458
14459 JSActivation now relies on JSVariableObject for access to registers and
14460 symbol table, and for some delete functionality, but not for anything
14461 else yet.
14462
14463 (KJS::JSActivation::mark): Cleaned up the style here a little bit.
14464
14465 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14466
14467 Reviewed by Beth Dakin.
14468
14469 Next step toward global code: store "rOffset" in JSVariableObjectData.
14470
14471 * kjs/JSGlobalObject.h:
14472 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
14473 * kjs/JSVariableObject.h:
14474 (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
14475
14476 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14477
14478 Reviewed by Maciej Stachowiak.
14479
14480 Next steps toward global code:
14481
14482 * Moved access to the register file into JSVariableObject.
14483
14484 * Added more ASSERTs to indicate obsolete APIs there are just hanging
14485 around to stave off build failures.
14486
14487 * kjs/JSGlobalObject.h:
14488 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
14489 * kjs/JSVariableObject.h:
14490 (KJS::JSVariableObject::registers):
14491 (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
14492 (KJS::JSVariableObject::JSVariableObject):
14493
14494 2008-03-31 Sam Weinig <sam@webkit.org>
14495
14496 Reviewed by Oliver. Tweaked somewhat by Maciej.
14497
14498 - implement codegen for ReadModifyResolveNode
14499
14500 * kjs/nodes.cpp:
14501 (KJS::emitReadModifyAssignment):
14502 (KJS::ReadModifyResolveNode::emitCode):
14503 * kjs/nodes.h:
14504
14505 2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14506
14507 Reviewed by Geoff.
14508
14509 Fix the build -- r31492 removed activation tear-off, but r31493 used it.
14510
14511 * kjs/nodes.cpp:
14512 (KJS::FuncExprNode::makeFunction):
14513
14514 2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14515
14516 Reviewed by Maciej.
14517
14518 Add support for FuncExprNode to SquirrelFish.
14519
14520 * VM/CodeBlock.cpp:
14521 (KJS::CodeBlock::dump):
14522 * VM/CodeBlock.h:
14523 * VM/CodeGenerator.cpp:
14524 (KJS::CodeGenerator::addConstant):
14525 (KJS::CodeGenerator::emitNewFunctionExpression):
14526 * VM/CodeGenerator.h:
14527 * VM/Machine.cpp:
14528 (KJS::Machine::privateExecute):
14529 * VM/Opcode.h:
14530 * kjs/nodes.cpp:
14531 (KJS::FuncExprNode::emitCode):
14532 (KJS::FuncExprNode::makeFunction):
14533 * kjs/nodes.h:
14534
14535 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14536
14537 Reviewed by Maciej Stachowiak.
14538
14539 First step toward global code: removed some obsolete JSGlobalObject
14540 APIs, changing clients to ASSERT_NOT_REACHED.
14541
14542 Activation tear-off and scope chain pushing is obsolete because we
14543 statically detect whether an activation + scope node is required.
14544
14545 The variableObject() and activationObject() accessors are obsolete
14546 because they haven't been maintained, and they're mostly used by
14547 node evaluation code, anyway.
14548
14549 The localStorage() accessor is obsolete because everything is in
14550 registers now, and it's mostly used by node evaluation code, anyway.
14551
14552 2008-03-31 Maciej Stachowiak <mjs@apple.com>
14553
14554 Reviewed by Darin.
14555
14556 - implement codegen for bracket accessor and bracket assign
14557
14558 * VM/CodeBlock.cpp:
14559 (KJS::CodeBlock::dump):
14560 * VM/CodeGenerator.cpp:
14561 (KJS::CodeGenerator::emitGetPropVal):
14562 (KJS::CodeGenerator::emitPutPropVal):
14563 * VM/CodeGenerator.h:
14564 * VM/Machine.cpp:
14565 (KJS::Machine::privateExecute):
14566 * VM/Opcode.h:
14567 * kjs/nodes.cpp:
14568 (KJS::BracketAccessorNode::emitCode):
14569 (KJS::AssignBracketNode::emitCode):
14570 * kjs/nodes.h:
14571
14572 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14573
14574 Not reviewed.
14575
14576 Removed FIXME that I just fixed.
14577
14578 Added ASSERT to cover an error previously only covered by a FIXME.
14579
14580 * kjs/JSActivation.cpp:
14581 (KJS::JSActivation::getOwnPropertySlot):
14582
14583 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14584
14585 Not reviewed.
14586
14587 Fixed indentation inside op_call. (I had left this code badly indented
14588 to make the behavior-changing diff clearer.)
14589
14590 * VM/Machine.cpp:
14591 (KJS::Machine::privateExecute):
14592
14593 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14594
14595 Reviewed by Sam Weinig.
14596
14597 Fixed up logging of jump instructions to follow the following style:
14598
14599 jump offset(->absoluteTarget)
14600
14601 * VM/CodeBlock.cpp:
14602 (KJS::CodeBlock::dump):
14603
14604 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14605
14606 Reviewed by Sam Weinig.
14607
14608 Changed the SymbolTable API to use int instead of size_t. It has been
14609 using int internally for a while now (since squirrelfish symbols can
14610 have negative indices).
14611
14612 2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14613
14614 Reviewed by Maciej.
14615
14616 Add support for FunctionCallValueNode.
14617
14618 * kjs/nodes.cpp:
14619 (KJS::FunctionCallValueNode::emitCode):
14620 * kjs/nodes.h:
14621
14622 2008-03-31 Maciej Stachowiak <mjs@apple.com>
14623
14624 Reviewed by Oliver.
14625
14626 1) Implemented array literals
14627
14628 2) Renamed op_object_get and op_object_put to op_get_prop_id and
14629 op_put_prop_id in preparation for new variants.
14630
14631 * VM/CodeBlock.cpp:
14632 (KJS::CodeBlock::dump):
14633 * VM/CodeGenerator.cpp:
14634 (KJS::CodeGenerator::emitNewArray):
14635 (KJS::CodeGenerator::emitGetPropId):
14636 (KJS::CodeGenerator::emitPutPropId):
14637 (KJS::CodeGenerator::emitPutPropIndex):
14638 * VM/CodeGenerator.h:
14639 (KJS::CodeGenerator::CodeGenerator):
14640 (KJS::CodeGenerator::propertyNames):
14641 * VM/Machine.cpp:
14642 (KJS::Machine::privateExecute):
14643 * VM/Opcode.h:
14644 * kjs/nodes.cpp:
14645 (KJS::ArrayNode::emitCode):
14646 (KJS::PropertyListNode::emitCode):
14647 (KJS::DotAccessorNode::emitCode):
14648 (KJS::PostIncResolveNode::emitCode):
14649 (KJS::PreIncResolveNode::emitCode):
14650 (KJS::AssignResolveNode::emitCode):
14651 (KJS::AssignDotNode::emitCode):
14652 * kjs/nodes.h:
14653
14654 2008-03-30 Geoffrey Garen <ggaren@apple.com>
14655
14656 Reviewed by Oliver Hunt.
14657
14658 Implemented native function calls. (Re-entering from native code back
14659 to JS doesn't work yet, though.)
14660
14661 0.2% speedup overall, due to some inlining tweaks. 3.6% regression on
14662 function-empty.js, since we're making a new virtual call and taking a
14663 new branch inside every op_call.
14664
14665 I adjusted the JavaScriptCore calling convention to minimize overhead,
14666 like so:
14667
14668 The machine calls a single virtual function, "getCallData", to get all
14669 the data it needs for a function call. Native code still uses the old
14670 "isObject()" check followed by an "implementsCall()" check, which
14671 aliases to "getCallData". (We can optimize native code to use getCallData
14672 at our leisure.)
14673
14674 To supply a list of arguments, the machine calls a new List constructor
14675 that just takes a pointer and a length, without copying. Native code
14676 still appends to the list one argument at a time. (We can optimize
14677 native code to use the new List constructor at our leisure.)
14678
14679 * VM/Machine.cpp:
14680 (KJS::Machine::privateExecute): Changed resize() call to grow() call,
14681 to encourage the compiler to inline the Vector code.
14682
14683 * kjs/CallData.h: Added.
14684 (KJS::): CallData is a union because eventually native calls will stuff
14685 a function pointer into it, to eliminate the callAsFunction virtual call.
14686
14687 * kjs/function.cpp:
14688 (KJS::FunctionImp::callAsFunction): Changed this to an ASSERT since
14689 it's not implemented yet.
14690
14691 * kjs/list.h: Made the List class two-faced, to support the old way and
14692 the new way during this transition phase: lists can be made read-only
14693 with just a pointer and a legnth, or you can append to them one item
14694 at a time.
14695
14696 * kjs/value.h:
14697 (KJS::jsUndefined): Marked this function ALWAYS_INLINE for the benefit
14698 of a certain compiler that doesn't know what's best for it.
14699
14700 2008-03-30 Maciej Stachowiak <mjs@apple.com>
14701
14702 Reviewed by Oliver.
14703
14704 Dump code that codegen can't handle yet, so it's easier to prioritize missing nodes.
14705
14706 * kjs/nodes.h:
14707 (KJS::Node::emitCode):
14708
14709 2008-03-30 Maciej Stachowiak <mjs@apple.com>
14710
14711 Reviewed by Oliver.
14712
14713 Improve dumping of bytecode and fix coding style accordingly.
14714
14715 Registers are printed as lr1 for locals, tr1 for temp registers. Identifiers print as
14716 foobar(@id0) and constants print as "foo"(@k1) or 312.4(@k2) or the like. Constant and
14717 identifier tables are dumped for reference.
14718
14719 * VM/CodeBlock.cpp:
14720 (KJS::escapeQuotes):
14721 (KJS::valueToSourceString):
14722 (KJS::registerName):
14723 (KJS::constantName):
14724 (KJS::idName):
14725 (KJS::printUnaryOp):
14726 (KJS::printBinaryOp):
14727 (KJS::CodeBlock::dump):
14728 * VM/Machine.cpp:
14729 (KJS::resolve):
14730 (KJS::resolveBase):
14731 (KJS::Machine::privateExecute):
14732
14733 2008-03-30 Maciej Stachowiak <mjs@apple.com>
14734
14735 Reviewed by Oliver.
14736
14737 Implement StringNode and VoidNode (both pretty trivial).
14738
14739 * kjs/nodes.cpp:
14740 (KJS::StringNode::emitCode):
14741 (KJS::VoidNode::emitCode):
14742 * kjs/nodes.h:
14743
14744 2008-03-30 Maciej Stachowiak <mjs@apple.com>
14745
14746 Reviewed by Sam.
14747
14748 Implement CommaNode.
14749
14750 * kjs/nodes.cpp:
14751 (KJS::CommaNode::emitCode):
14752 * kjs/nodes.h:
14753
14754 2008-03-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14755
14756 Reviewed by Maciej.
14757
14758 Adds support for dot notation and object literals.
14759
14760 * VM/CodeBlock.cpp:
14761 (KJS::CodeBlock::dump):
14762 * VM/CodeGenerator.cpp:
14763 (KJS::CodeGenerator::emitNewObject):
14764 * VM/CodeGenerator.h:
14765 * VM/Machine.cpp:
14766 (KJS::Machine::privateExecute):
14767 * VM/Opcode.h:
14768 * kjs/nodes.cpp:
14769 (KJS::ObjectLiteralNode::emitCode):
14770 (KJS::PropertyListNode::emitCode):
14771 (KJS::DotAccessorNode::emitCode):
14772 (KJS::AssignDotNode::emitCode):
14773 * kjs/nodes.h:
14774
14775 2008-03-29 Geoffrey Garen <ggaren@apple.com>
14776
14777 Reviewed by Maciej Stachowiak.
14778
14779 Mark the register file.
14780
14781 It's a conservative mark for now, but once registers are typed, we can
14782 do an exact mark.
14783
14784 1.4% regression regardless of whether we actually do the marking.
14785 GCC is is worth every penny.
14786
14787 * VM/Machine.cpp:
14788 (KJS::Machine::privateExecute): Most of the changes here are just for
14789 the fact that "registers" is a pointer now.
14790
14791 * kjs/JSGlobalObject.cpp: The global object owns the register file now.
14792
14793 2008-03-28 Oliver Hunt <oliver@apple.com>
14794
14795 Reviewed by Maciej.
14796
14797 Bug 18204: SquirrelFish: continue/break do not correctly handle scope popping
14798 <http://bugs.webkit.org/show_bug.cgi?id=18204>
14799
14800 We now track the scope depth as part of a loop context, and add an
14801 extra instruction op_jump_scopes that is used to perform a jump across
14802 dynamic scope boundaries.
14803
14804 * VM/CodeBlock.cpp:
14805 (KJS::CodeBlock::dump):
14806 * VM/CodeGenerator.cpp:
14807 (KJS::CodeGenerator::emitJumpScopes):
14808 * VM/CodeGenerator.h:
14809 * VM/Machine.cpp:
14810 (KJS::Machine::privateExecute):
14811 * VM/Opcode.h:
14812 * kjs/nodes.cpp:
14813 (KJS::ContinueNode::emitCode):
14814 (KJS::BreakNode::emitCode):
14815
14816 2008-03-28 Sam Weinig <sam@webkit.org>
14817
14818 Reviewed by Geoffrey Garen.
14819
14820 Add emitCode support for ConditionalNode.
14821
14822 * kjs/nodes.cpp:
14823 (KJS::ConditionalNode::emitCode):
14824 * kjs/nodes.h:
14825
14826 2008-03-28 Geoffrey Garen <ggaren@apple.com>
14827
14828 Reviewed by Oliver Hunt.
14829
14830 Responding to feedback, added some comments, fixed up a few names, and
14831 clarified that "locals" always means all local variables, functions,
14832 and parameters.
14833
14834 2008-03-28 Geoffrey Garen <ggaren@apple.com>
14835
14836 Reviewed by Oliver Hunt.
14837
14838 Added support for "this".
14839
14840 Supply an implicit "this" value as the first argument to every function.
14841 Alias the "this" keyword to that argument.
14842
14843 1% regression overall, 2.5% regression on empty function calls. Seems
14844 like a reasonable cost for now, since we're doing more work.
14845 (Eventually, we might decide to create a version of op_call specialized
14846 for a known null "this" value.)
14847
14848 * VM/CodeBlock.cpp:
14849 (KJS::CodeBlock::dump):
14850 * VM/CodeGenerator.cpp:
14851 (KJS::CodeGenerator::emitCall):
14852 * VM/CodeGenerator.h:
14853 (KJS::CodeGenerator::CodeGenerator):
14854 * VM/Machine.cpp:
14855 (KJS::Machine::privateExecute):
14856 * kjs/CommonIdentifiers.cpp:
14857 (KJS::CommonIdentifiers::CommonIdentifiers):
14858 * kjs/CommonIdentifiers.h:
14859 * kjs/nodes.cpp:
14860 (KJS::ThisNode::emitCode):
14861 (KJS::FunctionCallResolveNode::emitCode):
14862 * kjs/nodes.h:
14863
14864 2008-03-28 Oliver Hunt <oliver@apple.com>
14865
14866 Reviewed by Geoff.
14867
14868 Bug 18192: Squirrelfish needs support for break and continue
14869 <http://bugs.webkit.org/show_bug.cgi?id=18192>
14870
14871 Added a loop context stack to the code generator to provide the
14872 correct jump labels for continue and goto. Added logic to the
14873 currently implemented loop constructs to manage entry and exit
14874 from the loop contexts. Finally, implemented codegen for break
14875 and continue (and a pass through for LabelNode)
14876
14877 * VM/CodeGenerator.cpp:
14878 (KJS::CodeGenerator::pushLoopContext):
14879 (KJS::CodeGenerator::popLoopContext):
14880 (KJS::CodeGenerator::loopContextForIdentifier):
14881 (KJS::CodeGenerator::labelForContinue):
14882 (KJS::CodeGenerator::labelForBreak):
14883 * VM/CodeGenerator.h:
14884 * kjs/nodes.cpp:
14885 (KJS::DoWhileNode::emitCode):
14886 (KJS::WhileNode::emitCode):
14887 (KJS::ForNode::emitCode):
14888 (KJS::ContinueNode::emitCode):
14889 (KJS::BreakNode::emitCode):
14890 (KJS::LabelNode::emitCode):
14891 * kjs/nodes.h:
14892
14893 2008-03-27 Sam Weinig <sam@webkit.org>
14894
14895 Reviewed by Geoffrey Garen.
14896
14897 Add emitCode support for UnaryPlusNode, NegateNode, BitwiseNotNode and LogicalNotNode.
14898
14899 * VM/CodeBlock.cpp:
14900 (KJS::printUnaryOp):
14901 (KJS::CodeBlock::dump):
14902 * VM/CodeGenerator.cpp:
14903 (KJS::CodeGenerator::emitToJSNumber):
14904 (KJS::CodeGenerator::emitNegate):
14905 (KJS::CodeGenerator::emitBitNot):
14906 (KJS::CodeGenerator::emitNot):
14907 * VM/CodeGenerator.h:
14908 * VM/Machine.cpp:
14909 (KJS::Machine::privateExecute):
14910 * VM/Opcode.h:
14911 * kjs/nodes.cpp:
14912 (KJS::UnaryPlusNode::emitCode):
14913 (KJS::NegateNode::emitCode):
14914 (KJS::BitwiseNotNode::emitCode):
14915 (KJS::LogicalNotNode::emitCode):
14916 * kjs/nodes.h:
14917
14918 2008-03-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14919
14920 Reviewed by Maciej Stachowiak.
14921
14922 Add support for LogicalAndNode and LogicalOrNode.
14923
14924 * kjs/nodes.cpp:
14925 (KJS::LogicalAndNode::emitCode):
14926 (KJS::LogicalOrNode::emitCode):
14927 * kjs/nodes.h:
14928
14929 2008-03-27 Sam Weinig <sam@webkit.org>
14930
14931 Clean up code and debug output.
14932
14933 * VM/CodeBlock.cpp:
14934 (KJS::CodeBlock::dump):
14935 * VM/Machine.cpp:
14936 (KJS::Machine::privateExecute):
14937
14938 2008-03-27 Geoffrey Garen <ggaren@apple.com>
14939
14940 Moved an ASSERT to a more logical place.
14941
14942 * VM/Machine.cpp:
14943 (KJS::Machine::privateExecute):
14944
14945 2008-03-27 Sam Weinig <sam@webkit.org>
14946
14947 Reviewed by Oliver Hunt.
14948
14949 Add emitCode support for InstanceOfNode.
14950
14951 * VM/CodeBlock.cpp:
14952 (KJS::CodeBlock::dump):
14953 * VM/CodeGenerator.cpp:
14954 (KJS::CodeGenerator::emitInstanceOf):
14955 * VM/CodeGenerator.h:
14956 * VM/Machine.cpp:
14957 (KJS::Machine::privateExecute):
14958 * VM/Opcode.h:
14959 * kjs/nodes.cpp:
14960 (KJS::InstanceOfNode::emitCode):
14961 * kjs/nodes.h:
14962
14963 2008-03-27 Oliver Hunt <oliver@apple.com>
14964
14965 Reviewed by Maciej.
14966
14967 Bug 18142: squirrelfish needs to support dynamic scoping/with
14968 <http://bugs.webkit.org/show_bug.cgi?id=18142>
14969
14970 Add support for dynamic scoping and add code to handle 'with'
14971 statements.
14972
14973 * VM/CodeBlock.cpp:
14974 (KJS::CodeBlock::dump):
14975 * VM/CodeBlock.h:
14976 (KJS::CodeBlock::CodeBlock):
14977 * VM/CodeGenerator.cpp:
14978 (KJS::CodeGenerator::getRegister):
14979 (KJS::CodeGenerator::emitPushScope):
14980 (KJS::CodeGenerator::emitPopScope):
14981 * VM/CodeGenerator.h:
14982 (KJS::CodeGenerator::CodeGenerator):
14983 * VM/Machine.cpp:
14984 (KJS::Machine::privateExecute):
14985 * VM/Opcode.h:
14986 * kjs/nodes.cpp:
14987 (KJS::WithNode::emitCode):
14988 * kjs/nodes.h:
14989
14990 2008-03-27 Sam Weinig <sam@webkit.org>
14991
14992 Reviewed by Geoffrey Garen.
14993
14994 Add emitCode support for NullNode, FalseNode, TrueNode, IfNode, IfElseNode, DoWhileNode and WhileNode
14995
14996 * VM/CodeBlock.cpp:
14997 (KJS::CodeBlock::dump): Dump op_jfalse opcode.
14998 * VM/CodeGenerator.cpp:
14999 (KJS::CodeGenerator::emitJumpIfFalse): Identical to emitJumpIfTrue except it emits the op_jfalse opcode.
15000 (KJS::CodeGenerator::emitLoad): Add and emitLoad override for booleans.
15001 * VM/CodeGenerator.h:
15002 * VM/Machine.cpp:
15003 (KJS::Machine::privateExecute): Adds execution of op_jfalse. It is identical to op_jtrue, except the
15004 the condition is reversed.
15005 * VM/Opcode.h: Add op_jfalse.
15006 * kjs/nodes.cpp:
15007 (KJS::NullNode::emitCode): Added.
15008 (KJS::FalseNode::emitCode): Added.
15009 (KJS::TrueNode::emitCode): Added.
15010 (KJS::IfNode::emitCode): Added.
15011 (KJS::IfElseNode::emitCode): Added.
15012 (KJS::DoWhileNode::emitCode): Added.
15013 (KJS::WhileNode::emitCode): Added.
15014 * kjs/nodes.h:
15015
15016 2008-03-26 Geoffrey Garen <ggaren@apple.com>
15017
15018 Nixed an unused List.
15019
15020 The calm before my stormy war against the List class.
15021
15022 * kjs/function_object.cpp:
15023 (KJS::FunctionObjectImp::construct):
15024
15025 2008-03-26 Cameron Zwarich <cwzwarich@uwaterloo.ca>
15026
15027 Reviewed by Geoffrey Garen.
15028
15029 Adds support for EqualNode, NotEqualNode, StrictEqualNode, NotStrictEqualNode,
15030 LessEqNode, GreaterNode, GreaterEqNode, MultNode, DivNode, ModNode, SubNode,
15031 LeftShiftNode, RightShiftNode, UnsignedRightShiftNode, BitAndNode, BitXOrNode,
15032 and BitOrNode.
15033
15034 * VM/CodeBlock.cpp:
15035 (KJS::CodeBlock::dump):
15036 * VM/CodeGenerator.cpp:
15037 (KJS::CodeGenerator::emitEqual):
15038 (KJS::CodeGenerator::emitNotEqual):
15039 (KJS::CodeGenerator::emitStrictEqual):
15040 (KJS::CodeGenerator::emitNotStrictEqual):
15041 (KJS::CodeGenerator::emitLessEq):
15042 (KJS::CodeGenerator::emitMult):
15043 (KJS::CodeGenerator::emitDiv):
15044 (KJS::CodeGenerator::emitMod):
15045 (KJS::CodeGenerator::emitSub):
15046 (KJS::CodeGenerator::emitLeftShift):
15047 (KJS::CodeGenerator::emitRightShift):
15048 (KJS::CodeGenerator::emitUnsignedRightShift):
15049 (KJS::CodeGenerator::emitBitAnd):
15050 (KJS::CodeGenerator::emitBitXOr):
15051 (KJS::CodeGenerator::emitBitOr):
15052 * VM/CodeGenerator.h:
15053 * VM/Machine.cpp:
15054 (KJS::jsLessEq):
15055 (KJS::Machine::privateExecute):
15056 * VM/Opcode.h:
15057 * kjs/nodes.cpp:
15058 (KJS::MultNode::emitCode):
15059 (KJS::DivNode::emitCode):
15060 (KJS::ModNode::emitCode):
15061 (KJS::SubNode::emitCode):
15062 (KJS::LeftShiftNode::emitCode):
15063 (KJS::RightShiftNode::emitCode):
15064 (KJS::UnsignedRightShiftNode::emitCode):
15065 (KJS::GreaterNode::emitCode):
15066 (KJS::LessEqNode::emitCode):
15067 (KJS::GreaterEqNode::emitCode):
15068 (KJS::EqualNode::emitCode):
15069 (KJS::NotEqualNode::emitCode):
15070 (KJS::StrictEqualNode::emitCode):
15071 (KJS::NotStrictEqualNode::emitCode):
15072 (KJS::BitAndNode::emitCode):
15073 (KJS::BitXOrNode::emitCode):
15074 (KJS::BitOrNode::emitCode):
15075 * kjs/nodes.h:
15076
15077 2008-03-26 Geoffrey Garen <ggaren@apple.com>
15078
15079 Reviewed by Oliver Hunt.
15080
15081 Only print debug dumps in debug builds.
15082
15083 * VM/CodeGenerator.cpp:
15084 (KJS::CodeGenerator::generate):
15085 * VM/Machine.cpp:
15086 (KJS::Machine::privateExecute):
15087
15088 2008-03-26 Geoffrey Garen <ggaren@apple.com>
15089
15090 Reviewed by Oliver Hunt.
15091
15092 Moved a few files around in the XCode project.
15093
15094 * JavaScriptCore.xcodeproj/project.pbxproj:
15095
15096 2008-03-26 Geoffrey Garen <ggaren@apple.com>
15097
15098 Reviewed by Oliver Hunt.
15099
15100 Made closures work.
15101
15102 An activation object aliases to the register file until its associated
15103 function returns, at which point it copies the registers for locals and
15104 parameters into an independent storage buffer.
15105
15106 2008-03-24 Geoffrey Garen <ggaren@apple.com>
15107
15108 Reviewed by Oliver Hunt.
15109
15110 Fixed recent 25% regression on simple for loop test. GCC seems to be
15111 very finicky about the code that gets inlined into
15112 Machine::privateExecute.
15113
15114 Everything in this patch is simply the result of experiment.
15115
15116 The resolve and resolve_base opcodes do not seem to have gotten slower
15117 from this change.
15118
15119 * VM/Machine.cpp:
15120 (KJS::resolve):
15121 (KJS::resolveBase):
15122 (KJS::Machine::privateExecute):
15123 * kjs/nodes.h:
15124
15125 2008-03-24 Oliver Hunt <oliver@apple.com>
15126
15127 Reviewed by Geoff Garen.
15128
15129 Bug 18059: squirrelfish needs to compile on platforms without computed goto
15130 <http://bugs.webkit.org/show_bug.cgi?id=18059>
15131
15132 "Standard" macro style support for conditionalising the use of computed goto.
15133
15134 * JavaScriptCore.xcodeproj/project.pbxproj:
15135 * VM/Machine.cpp:
15136 (KJS::Machine::isOpcode):
15137 (KJS::Machine::privateExecute):
15138 * VM/Machine.h:
15139 (KJS::Machine::getOpcode):
15140 (KJS::Machine::getOpcodeID):
15141 * VM/Opcode.h:
15142 * wtf/Platform.h:
15143
15144 2008-03-24 Geoffrey Garen <ggaren@apple.com>
15145
15146 Moved my notes from nodes.h to the wiki.
15147
15148 * kjs/nodes.h:
15149
15150 2008-03-24 Geoffrey Garen <ggaren@apple.com>
15151
15152 SquirrelFish lives.
15153
15154 Initial check-in of the code I've been carrying around. Lots of stuff
15155 doesn't work. Plus a bunch of empty files.
15156
15157 === Start merge of squirrelfish ===
15158
15159 2008-05-21 Darin Adler <darin@apple.com>
15160
15161 - try to fix the Windows build
15162
15163 * profiler/Profiler.cpp:
15164 (KJS::Profiler::stopProfiling): Use ptrdiff_t instead of the less-common but incredibly
15165 similar ssize_t type.
15166 * wtf/AVLTree.h:
15167 (KJS::AVLTree::search): Added a typename for a dependent name that's a type.
15168
15169 2008-05-21 Darin Adler <darin@apple.com>
15170
15171 Reviewed by Anders.
15172
15173 - fix <rdar://problem/5952721> bug in JavaScript arguments object property lookup
15174
15175 Test: fast/js/arguments-bad-index.html
15176
15177 * kjs/function.cpp:
15178 (KJS::IndexToNameMap::IndexToNameMap): Use unsigned instead of int.
15179 (KJS::IndexToNameMap::isMapped): Use unsigned instead of int, and also use the
15180 strict version of the numeric conversion function, since we don't want to allow
15181 trailing junk.
15182 (KJS::IndexToNameMap::unMap): Ditto.
15183 (KJS::IndexToNameMap::operator[]): Ditto.
15184 * kjs/function.h: Changed IndexToNameMap::size type from int to unsigned.
15185
15186 2008-05-21 Timothy Hatcher <timothy@apple.com>
15187
15188 Change the Profiler to allow multiple profiles to be running at
15189 the same time. This can happen when you have nested console.profile()
15190 calls. This required two changes. First, the Profiler needed to keep a
15191 Vector of current profiles, instead of one. Second, a Profile needs
15192 to keep track of the global ExecState it started in and the page group
15193 identifier it is tracking.
15194
15195 The stopProfiling call now takes the same arguments as startProfiling.
15196 This makes sure the correct profile is stopped. Passing a null UString
15197 as the title will stop the last profile for the matching ExecState.
15198
15199 <rdar://problem/5951559> Multiple pages profiling can interfere with each other
15200
15201 Reviewed by Kevin McCullough.
15202
15203 * JavaScriptCore.exp: Added new exports. Removed old symbols.
15204 * profiler/Profile.cpp:
15205 (KJS::Profile::Profile): New constructor arguments for the
15206 originatingGlobalExec and pageGroupIdentifier.
15207 (KJS::Profile::stopProfiling): Set the m_originatingGlobalExec to null.
15208 * profiler/Profile.h:
15209 (KJS::Profile::create): Additional arguments.
15210 (KJS::Profile::originatingGlobalExec): Return m_originatingGlobalExec.
15211 (KJS::Profile::pageGroupIdentifier): Return m_pageGroupIdentifier.
15212 * profiler/Profiler.cpp:
15213 (KJS::Profiler::findProfile): Added. Finds a Profile that matches
15214 the ExecState and title.
15215 (KJS::Profiler::startProfiling): Return early if there is already
15216 a Profile with the ExecState and title. If not, create a new profile
15217 and append it to m_currentProfiles.
15218 (KJS::Profiler::stopProfiling): Loops through m_currentProfiles
15219 and find the one matching the ExecState and title. If one is found
15220 call stopProfiling and return the Profile after removing it
15221 from m_currentProfiles.
15222 (KJS::dispatchFunctionToProfiles): Helper inline function to loop through
15223 m_currentProfiles and call a Profile function.
15224 (KJS::Profiler::willExecute): Call dispatchFunctionToProfiles.
15225 (KJS::Profiler::didExecute): Ditto.
15226 * profiler/Profiler.h:
15227
15228 2008-05-21 Alexey Proskuryakov <ap@webkit.org>
15229
15230 Reviewed by Darin.
15231
15232 <rdar://problem/5908520> REGRESSION (3.1.1-r33033): Crash in WebKit when opening or
15233 refreshing page on people.com
15234
15235 The problem was that STL algorithms do not work with non-conformant comparators, and the
15236 site used sort(function() { return 0.5 - Math.random(); } to randomly shuffle an array.
15237
15238 https://bugs.webkit.org/show_bug.cgi?id=18687
15239 REGRESSION(r32220): ecma/Array/15.4.4.5-3.js test now fails in GMT(BST)
15240
15241 Besides relying on sort stability, this test was just broken, and kept failing with the
15242 new stable sort.
15243
15244 Tests: fast/js/sort-randomly.html
15245 fast/js/sort-stability.html
15246 fast/js/comparefn-sort-stability.html
15247
15248 * kjs/avl_tree.h: Added an AVL tree implementation.
15249
15250 * JavaScriptCore.xcodeproj/project.pbxproj:
15251 * wtf/AVLTree.h: Added.
15252 Added an AVL tree implementation.
15253
15254 * kjs/array_instance.cpp:
15255 (KJS::ArrayInstance::increaseVectorLength):
15256 (KJS::ArrayInstance::sort):
15257 (KJS::AVLTreeAbstractorForArrayCompare::get_less):
15258 (KJS::AVLTreeAbstractorForArrayCompare::set_less):
15259 (KJS::AVLTreeAbstractorForArrayCompare::get_greater):
15260 (KJS::AVLTreeAbstractorForArrayCompare::set_greater):
15261 (KJS::AVLTreeAbstractorForArrayCompare::get_balance_factor):
15262 (KJS::AVLTreeAbstractorForArrayCompare::set_balance_factor):
15263 (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
15264 (KJS::AVLTreeAbstractorForArrayCompare::compare_key_node):
15265 (KJS::AVLTreeAbstractorForArrayCompare::compare_node_node):
15266 (KJS::AVLTreeAbstractorForArrayCompare::null):
15267 (KJS::ArrayInstance::compactForSorting):
15268
15269 * kjs/array_instance.h: increaseVectorLength() now returns a bool to indicate whether it was
15270 successful.
15271
15272 * wtf/Vector.h:
15273 (WTF::Vector::Vector):
15274 (WTF::::operator=):
15275 (WTF::::fill):
15276 Make these methods fail instead of crash when allocation fails, matching resize() and
15277 reserveCapacity(), which already had this behavior. Callers need to check for null buffer
15278 after making any Vector call that can try to allocate.
15279
15280 * tests/mozilla/ecma/Array/15.4.4.5-3.js: Fixed the test to use a consistent sort function,
15281 as suggested in comments to a Mozilla bug filed about it (I'll keep tracking the bug to see
15282 what the final resolution is).
15283
15284 2008-05-20 Kevin McCullough <kmccullough@apple.com>
15285
15286 Reviewed by Tim.
15287
15288 <rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
15289 profile node.
15290 - Implements focus by adding the idea of a profileNode being visible and
15291 adding the ability to reset all of the visible flags.
15292
15293 * profiler/Profile.h:
15294 (KJS::Profile::focus):
15295 * profiler/ProfileNode.cpp:
15296 (KJS::ProfileNode::ProfileNode): Initialize the visible flag.
15297 (KJS::ProfileNode::setTreeVisible): Set the visibility of this node and
15298 all of its descendents.
15299 (KJS::ProfileNode::focus): Determine if this node should be visible when
15300 focusing, if the functionName matches this node's function name or if any
15301 of this node's children are visible.
15302 (KJS::ProfileNode::restoreAll): Restore all nodes' visible flag.
15303 (KJS::ProfileNode::debugPrintData):
15304 * profiler/ProfileNode.h:
15305 (KJS::ProfileNode::visible):
15306 (KJS::ProfileNode::setVisible):
15307
15308 2008-05-20 Timothy Hatcher <timothy@apple.com>
15309
15310 Fixes a couple performance issues with the profiler. Also fixes
15311 a regression where some nodes wouldn't be added to the tree.
15312
15313 Reviewed by Kevin McCullough.
15314
15315 * profiler/ProfileNode.cpp:
15316 (KJS::ProfileNode::addChild): Compare callIdentifier instead
15317 of functionName.
15318 * profiler/ProfileNode.h:
15319 (CallIdentifier.operator==): Compare the CallIdentifiers in
15320 an order that fails sooner for non-matches.
15321 (CallIdentifier.callIdentifier): Return the CallIdentifier by
15322 reference to prevent making a new copy each time.
15323
15324 2008-05-20 Kevin McCullough <kmccullough@apple.com>
15325
15326 Reviewed by Darin.
15327
15328 <rdar://problem/5950796> JSProfiler: dump functions are in the code
15329 Removed dump and logging functions from the Release version of the code
15330 and renamed them to be obviously for debugging only.
15331
15332 * JavaScriptCore.exp:
15333 * profiler/Profile.cpp:
15334 (KJS::Profile::debugPrintData):
15335 (KJS::Profile::debugPrintDataSampleStyle):
15336 * profiler/Profile.h:
15337 * profiler/ProfileNode.cpp:
15338 (KJS::ProfileNode::debugPrintData):
15339 (KJS::ProfileNode::debugPrintDataSampleStyle):
15340 * profiler/ProfileNode.h:
15341 * profiler/Profiler.cpp:
15342 * profiler/Profiler.h:
15343
15344 2008-05-20 Kevin McCullough <kmccullough@apple.com>
15345
15346 Reviewed by Adam.
15347
15348 <rdar://problem/5950538> JSProfiler: Keep track of non-JS execution time
15349 We now have an extra node that represents the excess non-JS time.
15350 - Also changed "SCRIPT" and "anonymous function" to be more consistent
15351 with the debugger.
15352
15353 * profiler/ProfileNode.cpp:
15354 (KJS::ProfileNode::stopProfiling): If this ProfileNode is the head node
15355 create a new child that has the excess execution time.
15356 (KJS::ProfileNode::calculatePercentages): Moved calculation of the
15357 percentages into a function since it's called from multiple places.
15358 * profiler/ProfileNode.h: Add the newly needed functions used above.
15359 (KJS::ProfileNode::setTotalTime):
15360 (KJS::ProfileNode::setSelfTime):
15361 (KJS::ProfileNode::setNumberOfCalls):
15362 * profiler/Profiler.cpp: renamed "SCRIPT" and "anonymous function" to be
15363 consistent with the debugger and use constants that can be localized
15364 more easily.
15365 (KJS::getCallIdentifiers):
15366 (KJS::getCallIdentifierFromFunctionImp):
15367
15368 2008-05-20 Kevin McCullough <kmccullough@apple.com>
15369
15370 Reviewed by Tim.
15371
15372 <rdar://problem/5770054> JavaScript profiler (10928)
15373 Removed only profiler-internal use of currentProfile since that concept
15374 is changing.
15375
15376 * profiler/Profile.h: Now stopProfiling takes a time and bool as
15377 arguments. The time is used to calculate %s from and the bool tells
15378 if this node is the head node and should be the one calculating the time.
15379 (KJS::Profile::stopProfiling):
15380 * profiler/ProfileNode.cpp: Ditto.
15381 (KJS::ProfileNode::stopProfiling):
15382 * profiler/ProfileNode.h: Ditto.
15383
15384 2008-05-20 Kevin McCullough <kmccullough@apple.com>
15385
15386 Accidentally turned on the profiler.
15387
15388 * kjs/config.h:
15389
15390
15391 2008-05-20 Kevin McCullough <kmccullough@apple.com>
15392
15393 Reviewed by Tim.
15394
15395 <rdar://problem/5770054> JavaScript profiler (10928)
15396 Split function name into 3 parts so that the Web Inspector can link it to
15397 the resource location from whence it came.
15398
15399 * kjs/ustring.cpp: Implemented operator> for UStrings
15400 (KJS::operator>):
15401 * kjs/ustring.h:
15402 * profiler/Profile.cpp:
15403 (KJS::Profile::Profile): Initialize all 3 values.
15404 (KJS::Profile::willExecute): Use CallIdentifier struct.
15405 (KJS::Profile::didExecute): Ditto.
15406 * profiler/Profile.h: Ditto and remove unused function.
15407 * profiler/ProfileNode.cpp:
15408 (KJS::ProfileNode::ProfileNode): Use CallIdentifier struct.
15409 (KJS::ProfileNode::willExecute): Ditto and fix an issue where we
15410 restarted the m_startTime even though it was already started.
15411 (KJS::ProfileNode::didExecute): Ditto.
15412 (KJS::ProfileNode::findChild): Ditto.
15413 (KJS::functionNameDescendingComparator): Ditto and use new comparator.
15414 (KJS::functionNameAscendingComparator): Ditto.
15415 (KJS::ProfileNode::printDataInspectorStyle): Use CallIdentifier struct.
15416 (KJS::ProfileNode::printDataSampleStyle): Ditto.
15417 * profiler/ProfileNode.h:
15418 (KJS::CallIdentifier::CallIdentifier): Describe the CallIdentifier struct
15419 (KJS::CallIdentifier::operator== ):
15420 (KJS::ProfileNode::create): Use the CallIdentifier struct.
15421 (KJS::ProfileNode::callIdentifier):
15422 (KJS::ProfileNode::functionName): Now only return the function name, not
15423 the url and line number too.
15424 (KJS::ProfileNode::url):
15425 (KJS::ProfileNode::lineNumber):
15426 * profiler/Profiler.cpp: Use the CallIdentifier struct.
15427 (KJS::Profiler::startProfiling):
15428 (KJS::Profiler::willExecute):
15429 (KJS::Profiler::didExecute):
15430 (KJS::getCallIdentifiers):
15431 (KJS::getCallIdentifierFromFunctionImp):
15432
15433 2008-05-20 Timothy Hatcher <timothy@apple.com>
15434
15435 Rename sortFileName{Ascending,Descending} to
15436 sortFunctionName{Ascending,Descending}.
15437
15438 Reviewed by Kevin McCullough.
15439
15440 * JavaScriptCore.exp:
15441 * kjs/config.h:
15442 * profiler/Profile.h:
15443 * profiler/ProfileNode.cpp:
15444 (KJS::functionNameDescendingComparator):
15445 (KJS::ProfileNode::sortFunctionNameDescending):
15446 (KJS::functionNameAscendingComparator):
15447 (KJS::ProfileNode::sortFunctionNameAscending):
15448 * profiler/ProfileNode.h:
15449
15450 2008-05-19 Timothy Hatcher <timothy@apple.com>
15451
15452 Make the profiler use higher than millisecond resolution time-stamps.
15453
15454 Reviewed by Kevin McCullough.
15455
15456 * kjs/DateMath.cpp:
15457 (KJS::getCurrentUTCTime): Call getCurrentUTCTimeWithMicroseconds and
15458 floor the result.
15459 (KJS::getCurrentUTCTimeWithMicroseconds): Copied from the previous
15460 implementation of getCurrentUTCTime without the floor call.
15461 * kjs/DateMath.h: Addded getCurrentUTCTimeWithMicroseconds.
15462 * profiler/ProfileNode.cpp:
15463 (KJS::ProfileNode::ProfileNode): Use getCurrentUTCTimeWithMicroseconds.
15464
15465 2008-05-19 Timothy Hatcher <timothy@apple.com>
15466
15467 Fixes a bug in the profiler where call and apply would show up
15468 and double the time spent in a function. We don't want to show call
15469 and apply at all in the profiles. This change excludes them.
15470
15471 Reviewed by Kevin McCullough.
15472
15473 * profiler/ProfileNode.cpp:
15474 (KJS::ProfileNode::stopProfiling): Remove a second for loop and
15475 calculate self time in the existing loop.
15476 * profiler/Profiler.cpp:
15477 (KJS::shouldExcludeFunction): Helper inline function that returns
15478 true in the current function in an InternalFunctionImp and it is
15479 has the functionName call or apply.
15480 (KJS::Profiler::willExecute): Call shouldExcludeFunction and return
15481 early if if returns true.
15482 (KJS::Profiler::didExecute): Ditto.
15483
15484 2008-05-19 Kevin McCullough <kmccullough@apple.com>
15485
15486 Reviewed by Tim.
15487
15488 <rdar://problem/5770054> JavaScript profiler (10928)
15489 - Implement sorting by function name.
15490
15491 * JavaScriptCore.exp:
15492 * profiler/Profile.h:
15493 (KJS::Profile::sortFileNameDescending):
15494 (KJS::Profile::sortFileNameAscending):
15495 * profiler/ProfileNode.cpp:
15496 (KJS::fileNameDescendingComparator):
15497 (KJS::ProfileNode::sortFileNameDescending):
15498 (KJS::fileNameAscendingComparator):
15499 (KJS::ProfileNode::sortFileNameAscending):
15500 * profiler/ProfileNode.h:
15501
15502 2008-05-19 Kevin McCullough <kmccullough@apple.com>
15503
15504 Reviewed by Adam.
15505
15506 <rdar://problem/5770054> JavaScript profiler (10928)
15507 - Pass the exec state to profiler when calling startProfiling so that if
15508 profiling is started within an execution context that location is
15509 recorded correctly.
15510
15511 * JavaScriptCore.exp:
15512 * profiler/ProfileNode.cpp:
15513 (KJS::ProfileNode::printDataInspectorStyle): Dump more info for debugging
15514 purposes.
15515 * profiler/Profiler.cpp:
15516 (KJS::Profiler::startProfiling):
15517 * profiler/Profiler.h:
15518
15519 2008-05-19 Kevin McCullough <kmccullough@apple.com>
15520
15521 Rubberstamped by Geoff.
15522
15523 Turn off the profiler because it is a performance regression.
15524
15525 * kjs/config.h:
15526
15527 2008-05-19 Alp Toker <alp@nuanti.com>
15528
15529 Reviewed by Anders and Beth.
15530
15531 http://bugs.webkit.org/show_bug.cgi?id=16495
15532 [GTK] Accessibility support with ATK/AT-SPI
15533
15534 Initial ATK/AT-SPI accessibility support for the GTK+ port.
15535
15536 * wtf/Platform.h:
15537
15538 2008-05-19 Kevin McCullough <kmccullough@apple.com>
15539
15540 Reviewed by Tim.
15541
15542 <rdar://problem/5770054> JavaScript profiler (10928)
15543 -In an effort to make the profiler as efficient as possible instead of
15544 prepending to a vector we keep the vector in reverse order and operate
15545 over it backwards.
15546
15547 * profiler/Profile.cpp:
15548 (KJS::Profile::willExecute):
15549 (KJS::Profile::didExecute):
15550 * profiler/ProfileNode.cpp:
15551 (KJS::ProfileNode::didExecute):
15552 (KJS::ProfileNode::endAndRecordCall):
15553 * profiler/ProfileNode.h:
15554 * profiler/Profiler.cpp:
15555 (KJS::getStackNames):
15556
15557 2008-05-16 Kevin McCullough <kmccullough@apple.com>
15558
15559 Reviewed by Tim.
15560
15561 <rdar://problem/5770054> JavaScript profiler (10928)
15562 Implement sorting for the profiler.
15563 I chose to sort the profileNodes in place since there is no reason they
15564 need to retain their original order.
15565
15566 * JavaScriptCore.exp: Export the symbols.
15567 * profiler/Profile.h: Add the different ways a profile can be sorted.
15568 (KJS::Profile::sortTotalTimeDescending):
15569 (KJS::Profile::sortTotalTimeAscending):
15570 (KJS::Profile::sortSelfTimeDescending):
15571 (KJS::Profile::sortSelfTimeAscending):
15572 (KJS::Profile::sortCallsDescending):
15573 (KJS::Profile::sortCallsAscending):
15574 * profiler/ProfileNode.cpp: Implement those ways.
15575 (KJS::totalTimeDescendingComparator):
15576 (KJS::ProfileNode::sortTotalTimeDescending):
15577 (KJS::totalTimeAscendingComparator):
15578 (KJS::ProfileNode::sortTotalTimeAscending):
15579 (KJS::selfTimeDescendingComparator):
15580 (KJS::ProfileNode::sortSelfTimeDescending):
15581 (KJS::selfTimeAscendingComparator):
15582 (KJS::ProfileNode::sortSelfTimeAscending):
15583 (KJS::callsDescendingComparator):
15584 (KJS::ProfileNode::sortCallsDescending):
15585 (KJS::callsAscendingComparator):
15586 (KJS::ProfileNode::sortCallsAscending):
15587 * profiler/ProfileNode.h: No longer use a Deque since it cannot be
15588 sorted by std::sort and there was no reason not to use a Vector. I
15589 previously had though I would do prepending but am not.
15590 (KJS::ProfileNode::selfTime):
15591 (KJS::ProfileNode::totalPercent):
15592 (KJS::ProfileNode::selfPercent):
15593 (KJS::ProfileNode::children):
15594 * profiler/Profiler.cpp: Removed these functions as they can be called
15595 directoy on the Profile object after getting the Vector of them.
15596 (KJS::getStackNames):
15597 * profiler/Profiler.h:
15598
15599 2008-05-15 Ariya Hidayat <ariya.hidayat@trolltech.com>
15600
15601 Reviewed by Simon.
15602
15603 Since WebKitGtk is fully using autotools now, clean-up the .pro/.pri files
15604 from gtk-port.
15605
15606 * JavaScriptCore.pro:
15607 * kjs/testkjs.pro:
15608
15609 2008-05-15 Kevin McCullough <kmccullough@apple.com>
15610
15611 - Build fix.
15612
15613 * JavaScriptCore.exp:
15614
15615 2008-05-15 Kevin McCullough <kmccullough@apple.com>
15616
15617 Reviewed by Tim.
15618
15619 <rdar://problem/5770054> JavaScript profiler (10928)
15620 - Cache some values to save on computing them repetitively. This will be
15621 a big savings when we sort since we won't have to walk the tree for
15622 every comparison!
15623 - We cache these values when we end profiling because otherwise we won't
15624 know which profile to get the totalTime for the whole profile from without
15625 retaining a reference to the head profile or looking up the profile from
15626 the list of all profiles.
15627 - Also it's safe to assume we won't be asked for these values while we
15628 are still profiling since the WebInspector only get's profileNodes from
15629 profiles that are in the allProfiles() list and a profile is only added
15630 to that list after it has finished and these values will no longer
15631 change.
15632
15633 * JavaScriptCore.exp:
15634 * profiler/ProfileNode.cpp:
15635 (KJS::ProfileNode::ProfileNode):
15636 (KJS::ProfileNode::stopProfiling):
15637 (KJS::ProfileNode::printDataInspectorStyle):
15638 (KJS::ProfileNode::printDataSampleStyle):
15639 (KJS::ProfileNode::endAndRecordCall):
15640 * profiler/ProfileNode.h:
15641 (KJS::ProfileNode::totalTime):
15642 (KJS::ProfileNode::selfTime):
15643 (KJS::ProfileNode::totalPercent):
15644 (KJS::ProfileNode::selfPercent):
15645 * profiler/Profiler.cpp:
15646 (KJS::Profiler::stopProfiling):
15647
15648 2008-05-15 Simon Hausmann <shausman@trolltech.com>
15649
15650 Reviewed by Holger.
15651
15652 Fix compilation when compiling with MSVC and wchar_t support.
15653
15654 * wtf/unicode/qt4/UnicodeQt4.h:
15655 (WTF::Unicode::foldCase):
15656 (WTF::Unicode::umemcasecmp):
15657
15658 2008-05-14 Kevin McCullough <kmccullough@apple.com>
15659
15660 Reviewed by Tim.
15661
15662 <rdar://problem/5770054> JavaScript profiler (10928)
15663 - Turn on the profiler.
15664
15665 * kjs/config.h:
15666
15667 2008-05-14 Kevin McCullough <kmccullough@apple.com>
15668
15669 Reviewed by Tim.
15670
15671 <rdar://problem/5770054> JavaScript profiler (10928)
15672 - Expose the new profiler functions to the WebInspector.
15673
15674 * JavaScriptCore.exp:
15675
15676 2008-05-14 Kevin McCullough <kmccullough@apple.com>
15677
15678 Giving credit where credit is due.
15679
15680 * ChangeLog:
15681
15682 2008-05-14 Kevin McCullough <kmccullough@apple.com>
15683
15684 Reviewed by Geoff and Sam.
15685
15686 <rdar://problem/5770054> JavaScript profiler (10928)
15687 Add the ability to get percentages of total and self time for displaying
15688 in the WebInspector.
15689
15690 * profiler/Profile.h:
15691 (KJS::Profile::totalProfileTime):
15692 * profiler/ProfileNode.cpp:
15693 (KJS::ProfileNode::totalPercent):
15694 (KJS::ProfileNode::selfPercent):
15695 * profiler/ProfileNode.h:
15696 * profiler/Profiler.h:
15697 (KJS::Profiler::currentProfile):
15698
15699 2008-05-14 Kevin McCullough <kmccullough@apple.com>
15700
15701 Reviewed by Sam.
15702
15703 <rdar://problem/5770054> JavaScript profiler (10928)
15704 - Rename FunctionCallProfile to ProfileNode.
15705
15706 * GNUmakefile.am:
15707 * JavaScriptCore.exp:
15708 * JavaScriptCore.pri:
15709 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
15710 * JavaScriptCore.xcodeproj/project.pbxproj:
15711 * JavaScriptCoreSources.bkl:
15712 * profiler/FunctionCallProfile.cpp: Removed.
15713 * profiler/FunctionCallProfile.h: Removed.
15714 * profiler/Profile.cpp:
15715 (KJS::Profile::Profile):
15716 (KJS::Profile::willExecute):
15717 * profiler/Profile.h:
15718 (KJS::Profile::callTree):
15719 * profiler/ProfileNode.cpp: Copied from profiler/FunctionCallProfile.cpp.
15720 (KJS::ProfileNode::ProfileNode):
15721 (KJS::ProfileNode::willExecute):
15722 (KJS::ProfileNode::didExecute):
15723 (KJS::ProfileNode::addChild):
15724 (KJS::ProfileNode::findChild):
15725 (KJS::ProfileNode::stopProfiling):
15726 (KJS::ProfileNode::selfTime):
15727 (KJS::ProfileNode::printDataInspectorStyle):
15728 (KJS::ProfileNode::printDataSampleStyle):
15729 (KJS::ProfileNode::endAndRecordCall):
15730 * profiler/ProfileNode.h: Copied from profiler/FunctionCallProfile.h.
15731 (KJS::ProfileNode::create):
15732 (KJS::ProfileNode::children):
15733 * profiler/Profiler.cpp:
15734
15735 2008-05-14 Kevin McCullough <kmccullough@apple.com>
15736
15737 Reviewed by John.
15738
15739 <rdar://problem/5770054> JavaScript profiler (10928)
15740 - Have each FunctionCallProfile be able to return it's total and self time.
15741
15742 * JavaScriptCore.exp:
15743 * profiler/FunctionCallProfile.cpp:
15744 (KJS::FunctionCallProfile::selfTime):
15745 * profiler/FunctionCallProfile.h:
15746 (KJS::FunctionCallProfile::totalTime):
15747
15748 2008-05-14 Alexey Proskuryakov <ap@webkit.org>
15749
15750 Reviewed by Darin.
15751
15752 <rdar://problem/5934376> REGRESSION: A script fails because of a straw BOM character in it.
15753
15754 <https://bugs.webkit.org/show_bug.cgi?id=4931>
15755 Unicode format characters (Cf) should be removed from JavaScript source
15756
15757 Of all Cf characters, we are only removing BOM, because this is what Firefox trunk has
15758 settled upon, after extensive discussion and investigation.
15759
15760 Based on Darin's work on this bug.
15761
15762 Test: fast/js/removing-Cf-characters.html
15763
15764 * kjs/lexer.cpp:
15765 (KJS::Lexer::setCode): Tweak formatting. Use a call to shift(4) to read in the
15766 first characters, instead of having special case code here.
15767 (KJS::Lexer::shift): Add a loop when reading a character to skip BOM characters.
15768
15769 2008-05-13 Matt Lilek <webkit@mattlilek.com>
15770
15771 Not reviewed, build fix.
15772
15773 * kjs/date_object.cpp:
15774 (KJS::DateObjectFuncImp::callAsFunction):
15775
15776 2008-05-13 Anders Carlsson <andersca@apple.com>
15777
15778 Reviewed by Sam.
15779
15780 <rdar://problem/5933644> Implement Date.now
15781
15782 Implement Date.now which returns the number of milliseconds since the epoch.
15783
15784 * kjs/CommonIdentifiers.h:
15785 * kjs/date_object.cpp:
15786 (KJS::DateObjectFuncImp::):
15787 (KJS::DateObjectImp::DateObjectImp):
15788 (KJS::DateObjectFuncImp::callAsFunction):
15789
15790 2008-05-13 Kevin McCullough <kmccullough@apple.com>
15791
15792 Giving credit where credit is due.
15793
15794 * ChangeLog:
15795
15796 2008-05-13 Kevin McCullough <kmccullough@apple.com>
15797
15798 Reviewed by Adam and Geoff.
15799
15800 <rdar://problem/5770054> JavaScript profiler (10928)
15801 Use PassRefPtrs instead of RefPtrs when appropriate.
15802
15803 * profiler/FunctionCallProfile.cpp:
15804 (KJS::FunctionCallProfile::addChild):
15805 * profiler/FunctionCallProfile.h:
15806 * profiler/Profile.h:
15807 (KJS::Profile::callTree):
15808
15809 2008-05-13 Kevin McCullough <kmccullough@apple.com>
15810
15811 Reviewed by Sam.
15812
15813 <rdar://problem/5770054> JavaScript profiler (10928)
15814 - Made some functions static (as per Adam) and changed from using raw
15815 pointers to RefPtr for making these JavaScript Objects.
15816
15817 * profiler/FunctionCallProfile.cpp:
15818 (KJS::FunctionCallProfile::addChild):
15819 (KJS::FunctionCallProfile::findChild):
15820 * profiler/FunctionCallProfile.h:
15821 (KJS::FunctionCallProfile::create):
15822 * profiler/Profile.cpp:
15823 (KJS::Profile::Profile):
15824 (KJS::Profile::willExecute):
15825 (KJS::Profile::didExecute):
15826 (KJS::functionNameCountPairComparator):
15827 * profiler/Profile.h:
15828 (KJS::Profile::create):
15829 (KJS::Profile::title):
15830 (KJS::Profile::callTree):
15831 * profiler/Profiler.cpp:
15832 (KJS::Profiler::startProfiling):
15833 * profiler/Profiler.h:
15834 (KJS::Profiler::allProfiles):
15835 (KJS::Profiler::clearProfiles):
15836
15837 2008-05-13 Alexey Proskuryakov <ap@webkit.org>
15838
15839 Reviewed by Geoffrey Garen.
15840
15841 <rdar://problem/4949018> JavaScriptCore API claims to work with UTF8 strings, but only works
15842 with ASCII strings
15843
15844 * kjs/ustring.h:
15845 * kjs/ustring.cpp:
15846 (KJS::UString::Rep::createFromUTF8):
15847 Added. Implementation adapted from JSStringCreateWithUTF8CString().
15848
15849 * API/JSStringRef.cpp:
15850 (JSStringCreateWithUTF8CString):
15851 * API/JSClassRef.cpp:
15852 (OpaqueJSClass::OpaqueJSClass):
15853 Use UString::Rep::createFromUTF8().
15854
15855 2008-05-12 Mark Rowe <mrowe@apple.com>
15856
15857 Reviewed by Tim Hatcher.
15858
15859 <rdar://problem/4859666> WebKit needs availability macros in order to deprecate APIs
15860
15861 Create WebKit availability macros that key off the Mac OS X version being targeted to
15862 determine the WebKit version being targeted. Applications can define
15863 WEBKIT_VERSION_MIN_REQUIRED before including WebKit headers in order to target a specific
15864 version of WebKit.
15865
15866 The availability header is being added to JavaScriptCore rather than WebKit as JavaScriptCore
15867 is the lowest-level portion of the public WebKit API.
15868
15869 * API/WebKitAvailability.h: Added.
15870 * JavaScriptCore.xcodeproj/project.pbxproj:
15871
15872 2008-05-12 Alexey Proskuryakov <ap@webkit.org>
15873
15874 Reviewed by Maciej.
15875
15876 https://bugs.webkit.org/show_bug.cgi?id=18828
15877 Reproducible crash with PAC file
15878
15879 Naively moving JavaScriptCore into thread-specific data was inappropriate in the face of
15880 exiting JavaScriptCore API clients, which expect a different therading model. Temporarily
15881 disabling ThreadSpecific implementation until this can be sorted out.
15882
15883 * wtf/ThreadSpecific.h:
15884 (WTF::::ThreadSpecific):
15885 (WTF::::~ThreadSpecific):
15886 (WTF::::get):
15887 (WTF::::set):
15888
15889 2008-05-12 Alexey Proskuryakov <ap@webkit.org>
15890
15891 Roll out recent threading changes (r32807, r32810, r32819, r32822) to simplify
15892 SquirrelFish merging.
15893
15894 * API/JSBase.cpp:
15895 (JSGarbageCollect):
15896 * API/JSCallbackObjectFunctions.h:
15897 (KJS::::staticFunctionGetter):
15898 * API/JSClassRef.cpp:
15899 (OpaqueJSClass::prototype):
15900 * API/JSObjectRef.cpp:
15901 (JSObjectMake):
15902 (JSObjectMakeFunctionWithCallback):
15903 (JSObjectMakeConstructor):
15904 (JSObjectMakeFunction):
15905 * API/JSValueRef.cpp:
15906 (JSValueMakeNumber):
15907 (JSValueMakeString):
15908 * JavaScriptCore.exp:
15909 * kjs/ExecState.h:
15910 * kjs/InitializeThreading.cpp:
15911 (KJS::initializeThreadingOnce):
15912 * kjs/JSGlobalObject.cpp:
15913 (KJS::JSGlobalObject::~JSGlobalObject):
15914 (KJS::JSGlobalObject::init):
15915 (KJS::JSGlobalObject::put):
15916 (KJS::JSGlobalObject::reset):
15917 (KJS::JSGlobalObject::tearOffActivation):
15918 * kjs/JSGlobalObject.h:
15919 (KJS::JSGlobalObject::head):
15920 (KJS::JSGlobalObject::perThreadData):
15921 * kjs/JSLock.cpp:
15922 (KJS::JSLock::registerThread):
15923 * kjs/JSLock.h:
15924 (KJS::JSLock::JSLock):
15925 * kjs/array_instance.cpp:
15926 (KJS::ArrayInstance::ArrayInstance):
15927 (KJS::ArrayInstance::lengthGetter):
15928 * kjs/array_object.cpp:
15929 (KJS::arrayProtoFuncToString):
15930 (KJS::arrayProtoFuncToLocaleString):
15931 (KJS::arrayProtoFuncJoin):
15932 (KJS::arrayProtoFuncConcat):
15933 (KJS::arrayProtoFuncPop):
15934 (KJS::arrayProtoFuncPush):
15935 (KJS::arrayProtoFuncShift):
15936 (KJS::arrayProtoFuncSlice):
15937 (KJS::arrayProtoFuncSplice):
15938 (KJS::arrayProtoFuncUnShift):
15939 (KJS::arrayProtoFuncFilter):
15940 (KJS::arrayProtoFuncMap):
15941 (KJS::arrayProtoFuncEvery):
15942 (KJS::arrayProtoFuncForEach):
15943 (KJS::arrayProtoFuncSome):
15944 (KJS::arrayProtoFuncIndexOf):
15945 (KJS::arrayProtoFuncLastIndexOf):
15946 (KJS::ArrayObjectImp::ArrayObjectImp):
15947 (KJS::ArrayObjectImp::construct):
15948 * kjs/bool_object.cpp:
15949 (KJS::BooleanPrototype::BooleanPrototype):
15950 (KJS::booleanProtoFuncToString):
15951 (KJS::BooleanObjectImp::BooleanObjectImp):
15952 (KJS::BooleanObjectImp::construct):
15953 * kjs/collector.cpp:
15954 (KJS::allocateBlock):
15955 (KJS::Collector::recordExtraCost):
15956 (KJS::Collector::heapAllocate):
15957 (KJS::Collector::allocate):
15958 (KJS::Collector::allocateNumber):
15959 (KJS::Collector::registerAsMainThread):
15960 (KJS::onMainThread):
15961 (KJS::PlatformThread::PlatformThread):
15962 (KJS::getCurrentPlatformThread):
15963 (KJS::Collector::Thread::Thread):
15964 (KJS::destroyRegisteredThread):
15965 (KJS::initializeRegisteredThreadKey):
15966 (KJS::Collector::registerThread):
15967 (KJS::Collector::markStackObjectsConservatively):
15968 (KJS::Collector::markCurrentThreadConservativelyInternal):
15969 (KJS::Collector::markCurrentThreadConservatively):
15970 (KJS::suspendThread):
15971 (KJS::resumeThread):
15972 (KJS::getPlatformThreadRegisters):
15973 (KJS::otherThreadStackPointer):
15974 (KJS::Collector::markOtherThreadConservatively):
15975 (KJS::protectedValues):
15976 (KJS::Collector::protect):
15977 (KJS::Collector::unprotect):
15978 (KJS::Collector::collectOnMainThreadOnly):
15979 (KJS::Collector::markProtectedObjects):
15980 (KJS::Collector::markMainThreadOnlyObjects):
15981 (KJS::Collector::sweep):
15982 (KJS::Collector::collect):
15983 (KJS::Collector::size):
15984 (KJS::Collector::globalObjectCount):
15985 (KJS::Collector::protectedGlobalObjectCount):
15986 (KJS::Collector::protectedObjectCount):
15987 (KJS::Collector::protectedObjectTypeCounts):
15988 (KJS::Collector::isBusy):
15989 (KJS::Collector::reportOutOfMemoryToAllExecStates):
15990 * kjs/collector.h:
15991 (KJS::Collector::cellBlock):
15992 (KJS::Collector::cellOffset):
15993 (KJS::Collector::isCellMarked):
15994 (KJS::Collector::markCell):
15995 (KJS::Collector::reportExtraMemoryCost):
15996 * kjs/date_object.cpp:
15997 (KJS::formatLocaleDate):
15998 (KJS::DatePrototype::DatePrototype):
15999 (KJS::DateObjectImp::DateObjectImp):
16000 (KJS::DateObjectImp::construct):
16001 (KJS::DateObjectImp::callAsFunction):
16002 (KJS::DateObjectFuncImp::DateObjectFuncImp):
16003 (KJS::DateObjectFuncImp::callAsFunction):
16004 (KJS::dateProtoFuncToString):
16005 (KJS::dateProtoFuncToUTCString):
16006 (KJS::dateProtoFuncToDateString):
16007 (KJS::dateProtoFuncToTimeString):
16008 (KJS::dateProtoFuncToLocaleString):
16009 (KJS::dateProtoFuncToLocaleDateString):
16010 (KJS::dateProtoFuncToLocaleTimeString):
16011 (KJS::dateProtoFuncValueOf):
16012 (KJS::dateProtoFuncGetTime):
16013 (KJS::dateProtoFuncGetFullYear):
16014 (KJS::dateProtoFuncGetUTCFullYear):
16015 (KJS::dateProtoFuncToGMTString):
16016 (KJS::dateProtoFuncGetMonth):
16017 (KJS::dateProtoFuncGetUTCMonth):
16018 (KJS::dateProtoFuncGetDate):
16019 (KJS::dateProtoFuncGetUTCDate):
16020 (KJS::dateProtoFuncGetDay):
16021 (KJS::dateProtoFuncGetUTCDay):
16022 (KJS::dateProtoFuncGetHours):
16023 (KJS::dateProtoFuncGetUTCHours):
16024 (KJS::dateProtoFuncGetMinutes):
16025 (KJS::dateProtoFuncGetUTCMinutes):
16026 (KJS::dateProtoFuncGetSeconds):
16027 (KJS::dateProtoFuncGetUTCSeconds):
16028 (KJS::dateProtoFuncGetMilliSeconds):
16029 (KJS::dateProtoFuncGetUTCMilliseconds):
16030 (KJS::dateProtoFuncGetTimezoneOffset):
16031 (KJS::dateProtoFuncSetTime):
16032 (KJS::setNewValueFromTimeArgs):
16033 (KJS::setNewValueFromDateArgs):
16034 (KJS::dateProtoFuncSetYear):
16035 (KJS::dateProtoFuncGetYear):
16036 * kjs/error_object.cpp:
16037 (KJS::ErrorPrototype::ErrorPrototype):
16038 (KJS::errorProtoFuncToString):
16039 (KJS::ErrorObjectImp::ErrorObjectImp):
16040 (KJS::ErrorObjectImp::construct):
16041 (KJS::NativeErrorPrototype::NativeErrorPrototype):
16042 (KJS::NativeErrorImp::NativeErrorImp):
16043 (KJS::NativeErrorImp::construct):
16044 * kjs/function.cpp:
16045 (KJS::FunctionImp::lengthGetter):
16046 (KJS::FunctionImp::construct):
16047 (KJS::Arguments::Arguments):
16048 (KJS::ActivationImp::createArgumentsObject):
16049 (KJS::encode):
16050 (KJS::decode):
16051 (KJS::globalFuncParseInt):
16052 (KJS::globalFuncParseFloat):
16053 (KJS::globalFuncEscape):
16054 (KJS::globalFuncUnescape):
16055 (KJS::PrototypeFunction::PrototypeFunction):
16056 (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
16057 * kjs/function_object.cpp:
16058 (KJS::FunctionPrototype::FunctionPrototype):
16059 (KJS::functionProtoFuncToString):
16060 (KJS::FunctionObjectImp::FunctionObjectImp):
16061 (KJS::FunctionObjectImp::construct):
16062 * kjs/internal.cpp:
16063 (KJS::StringImp::toObject):
16064 * kjs/internal.h:
16065 (KJS::StringImp::StringImp):
16066 (KJS::NumberImp::operator new):
16067 * kjs/list.cpp:
16068 (KJS::List::markSet):
16069 (KJS::List::markProtectedListsSlowCase):
16070 (KJS::List::expandAndAppend):
16071 * kjs/list.h:
16072 (KJS::List::List):
16073 (KJS::List::~List):
16074 (KJS::List::markProtectedLists):
16075 * kjs/lookup.h:
16076 (KJS::staticFunctionGetter):
16077 (KJS::cacheGlobalObject):
16078 * kjs/math_object.cpp:
16079 (KJS::MathObjectImp::getValueProperty):
16080 (KJS::mathProtoFuncAbs):
16081 (KJS::mathProtoFuncACos):
16082 (KJS::mathProtoFuncASin):
16083 (KJS::mathProtoFuncATan):
16084 (KJS::mathProtoFuncATan2):
16085 (KJS::mathProtoFuncCeil):
16086 (KJS::mathProtoFuncCos):
16087 (KJS::mathProtoFuncExp):
16088 (KJS::mathProtoFuncFloor):
16089 (KJS::mathProtoFuncLog):
16090 (KJS::mathProtoFuncMax):
16091 (KJS::mathProtoFuncMin):
16092 (KJS::mathProtoFuncPow):
16093 (KJS::mathProtoFuncRandom):
16094 (KJS::mathProtoFuncRound):
16095 (KJS::mathProtoFuncSin):
16096 (KJS::mathProtoFuncSqrt):
16097 (KJS::mathProtoFuncTan):
16098 * kjs/nodes.cpp:
16099 (KJS::ParserRefCounted::ParserRefCounted):
16100 (KJS::ParserRefCounted::ref):
16101 (KJS::ParserRefCounted::deref):
16102 (KJS::ParserRefCounted::refcount):
16103 (KJS::ParserRefCounted::deleteNewObjects):
16104 (KJS::Node::handleException):
16105 (KJS::NumberNode::evaluate):
16106 (KJS::StringNode::evaluate):
16107 (KJS::ArrayNode::evaluate):
16108 (KJS::PostIncResolveNode::evaluate):
16109 (KJS::PostIncLocalVarNode::evaluate):
16110 (KJS::PostDecResolveNode::evaluate):
16111 (KJS::PostDecLocalVarNode::evaluate):
16112 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
16113 (KJS::PostIncBracketNode::evaluate):
16114 (KJS::PostDecBracketNode::evaluate):
16115 (KJS::PostIncDotNode::evaluate):
16116 (KJS::PostDecDotNode::evaluate):
16117 (KJS::typeStringForValue):
16118 (KJS::LocalVarTypeOfNode::evaluate):
16119 (KJS::TypeOfResolveNode::evaluate):
16120 (KJS::TypeOfValueNode::evaluate):
16121 (KJS::PreIncLocalVarNode::evaluate):
16122 (KJS::PreIncResolveNode::evaluate):
16123 (KJS::PreDecLocalVarNode::evaluate):
16124 (KJS::PreDecResolveNode::evaluate):
16125 (KJS::PreIncConstNode::evaluate):
16126 (KJS::PreDecConstNode::evaluate):
16127 (KJS::PostIncConstNode::evaluate):
16128 (KJS::PostDecConstNode::evaluate):
16129 (KJS::PreIncBracketNode::evaluate):
16130 (KJS::PreDecBracketNode::evaluate):
16131 (KJS::PreIncDotNode::evaluate):
16132 (KJS::PreDecDotNode::evaluate):
16133 (KJS::NegateNode::evaluate):
16134 (KJS::BitwiseNotNode::evaluate):
16135 (KJS::MultNode::evaluate):
16136 (KJS::DivNode::evaluate):
16137 (KJS::ModNode::evaluate):
16138 (KJS::addSlowCase):
16139 (KJS::add):
16140 (KJS::AddNumbersNode::evaluate):
16141 (KJS::AddStringsNode::evaluate):
16142 (KJS::AddStringLeftNode::evaluate):
16143 (KJS::AddStringRightNode::evaluate):
16144 (KJS::SubNode::evaluate):
16145 (KJS::LeftShiftNode::evaluate):
16146 (KJS::RightShiftNode::evaluate):
16147 (KJS::UnsignedRightShiftNode::evaluate):
16148 (KJS::BitXOrNode::evaluate):
16149 (KJS::BitOrNode::evaluate):
16150 (KJS::valueForReadModifyAssignment):
16151 (KJS::ForInNode::execute):
16152 (KJS::TryNode::execute):
16153 (KJS::FuncDeclNode::makeFunction):
16154 (KJS::FuncExprNode::evaluate):
16155 * kjs/nodes.h:
16156 * kjs/number_object.cpp:
16157 (KJS::NumberPrototype::NumberPrototype):
16158 (KJS::numberProtoFuncToString):
16159 (KJS::numberProtoFuncToLocaleString):
16160 (KJS::numberProtoFuncToFixed):
16161 (KJS::numberProtoFuncToExponential):
16162 (KJS::numberProtoFuncToPrecision):
16163 (KJS::NumberObjectImp::NumberObjectImp):
16164 (KJS::NumberObjectImp::getValueProperty):
16165 (KJS::NumberObjectImp::construct):
16166 (KJS::NumberObjectImp::callAsFunction):
16167 * kjs/object.cpp:
16168 (KJS::JSObject::call):
16169 (KJS::JSObject::get):
16170 (KJS::JSObject::put):
16171 (KJS::JSObject::defineGetter):
16172 (KJS::JSObject::defineSetter):
16173 (KJS::JSObject::putDirect):
16174 (KJS::Error::create):
16175 * kjs/object.h:
16176 * kjs/object_object.cpp:
16177 (KJS::ObjectPrototype::ObjectPrototype):
16178 (KJS::objectProtoFuncToLocaleString):
16179 (KJS::objectProtoFuncToString):
16180 (KJS::ObjectObjectImp::ObjectObjectImp):
16181 (KJS::ObjectObjectImp::construct):
16182 * kjs/property_map.h:
16183 (KJS::SavedProperty::SavedProperty):
16184 (KJS::SavedProperty::init):
16185 (KJS::SavedProperty::~SavedProperty):
16186 (KJS::SavedProperty::name):
16187 (KJS::SavedProperty::value):
16188 (KJS::SavedProperty::attributes):
16189 * kjs/protect.h:
16190 (KJS::gcProtect):
16191 (KJS::gcUnprotect):
16192 * kjs/regexp_object.cpp:
16193 (KJS::RegExpPrototype::RegExpPrototype):
16194 (KJS::regExpProtoFuncToString):
16195 (KJS::RegExpImp::getValueProperty):
16196 (KJS::RegExpObjectImp::RegExpObjectImp):
16197 (KJS::RegExpObjectImp::arrayOfMatches):
16198 (KJS::RegExpObjectImp::getBackref):
16199 (KJS::RegExpObjectImp::getLastParen):
16200 (KJS::RegExpObjectImp::getLeftContext):
16201 (KJS::RegExpObjectImp::getRightContext):
16202 (KJS::RegExpObjectImp::getValueProperty):
16203 (KJS::RegExpObjectImp::createRegExpImp):
16204 * kjs/regexp_object.h:
16205 * kjs/string_object.cpp:
16206 (KJS::StringInstance::StringInstance):
16207 (KJS::StringInstance::lengthGetter):
16208 (KJS::StringInstance::indexGetter):
16209 (KJS::stringInstanceNumericPropertyGetter):
16210 (KJS::StringPrototype::StringPrototype):
16211 (KJS::replace):
16212 (KJS::stringProtoFuncCharAt):
16213 (KJS::stringProtoFuncCharCodeAt):
16214 (KJS::stringProtoFuncConcat):
16215 (KJS::stringProtoFuncIndexOf):
16216 (KJS::stringProtoFuncLastIndexOf):
16217 (KJS::stringProtoFuncMatch):
16218 (KJS::stringProtoFuncSearch):
16219 (KJS::stringProtoFuncReplace):
16220 (KJS::stringProtoFuncSlice):
16221 (KJS::stringProtoFuncSplit):
16222 (KJS::stringProtoFuncSubstr):
16223 (KJS::stringProtoFuncSubstring):
16224 (KJS::stringProtoFuncToLowerCase):
16225 (KJS::stringProtoFuncToUpperCase):
16226 (KJS::stringProtoFuncToLocaleLowerCase):
16227 (KJS::stringProtoFuncToLocaleUpperCase):
16228 (KJS::stringProtoFuncLocaleCompare):
16229 (KJS::stringProtoFuncBig):
16230 (KJS::stringProtoFuncSmall):
16231 (KJS::stringProtoFuncBlink):
16232 (KJS::stringProtoFuncBold):
16233 (KJS::stringProtoFuncFixed):
16234 (KJS::stringProtoFuncItalics):
16235 (KJS::stringProtoFuncStrike):
16236 (KJS::stringProtoFuncSub):
16237 (KJS::stringProtoFuncSup):
16238 (KJS::stringProtoFuncFontcolor):
16239 (KJS::stringProtoFuncFontsize):
16240 (KJS::stringProtoFuncAnchor):
16241 (KJS::stringProtoFuncLink):
16242 (KJS::StringObjectImp::StringObjectImp):
16243 (KJS::StringObjectImp::construct):
16244 (KJS::StringObjectImp::callAsFunction):
16245 (KJS::StringObjectFuncImp::StringObjectFuncImp):
16246 (KJS::StringObjectFuncImp::callAsFunction):
16247 * kjs/string_object.h:
16248 (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
16249 * kjs/testkjs.cpp:
16250 (GlobalObject::GlobalObject):
16251 (functionGC):
16252 (functionRun):
16253 (functionReadline):
16254 (kjsmain):
16255 * kjs/ustring.h:
16256 * kjs/value.cpp:
16257 (KJS::JSCell::operator new):
16258 (KJS::jsString):
16259 (KJS::jsOwnedString):
16260 (KJS::jsNumberCell):
16261 * kjs/value.h:
16262 (KJS::jsNaN):
16263 (KJS::jsNumber):
16264 (KJS::jsNumberFromAnd):
16265 (KJS::JSCell::marked):
16266 (KJS::JSCell::mark):
16267 (KJS::JSValue::toJSNumber):
16268 * wtf/ThreadSpecific.h:
16269 (WTF::T):
16270
16271 2008-05-10 Julien Chaffraix <jchaffraix@webkit.org>
16272
16273 Qt & wx build fix.
16274
16275 * JavaScriptCore.pri: Add profiler/Profile.cpp.
16276 * JavaScriptCoreSources.bkl: Ditto.
16277
16278 2008-05-10 Jan Michael Alonzo <jmalonzo@unpluggable.com>
16279
16280 Reviewed by Maciej.
16281
16282 Gtk+ build fix
16283
16284 * GNUmakefile.am: Add Profile.cpp in _sources
16285
16286 2008-05-09 Brady Eidson <beidson@apple.com>
16287
16288 Build Fix. Kevin is an idiot.
16289 ("My name is Kevin McCullough and I approve this message.")
16290
16291 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
16292
16293 2008-05-09 Kevin McCullough <kmccullough@apple.com>
16294
16295 Reviewed by Tim.
16296
16297 -<rdar://problem/5770054> JavaScript profiler (10928)
16298 -Add Profile class so that all profiles can be stored and retrieved by
16299 the WebInspector when that time comes.
16300
16301 * JavaScriptCore.exp: Export the new function signatures.
16302 * JavaScriptCore.xcodeproj/project.pbxproj: Add the new files to the
16303 project
16304 * profiler/Profile.cpp: Added. This class represents a single run of the
16305 profiler.
16306 (KJS::Profile::Profile):
16307 (KJS::Profile::willExecute):
16308 (KJS::Profile::didExecute):
16309 (KJS::Profile::printDataInspectorStyle):
16310 (KJS::functionNameCountPairComparator):
16311 (KJS::Profile::printDataSampleStyle):
16312 * profiler/Profile.h: Added. Ditto
16313 (KJS::Profile::stopProfiling):
16314 * profiler/Profiler.cpp: Now the profiler keeps track of many profiles
16315 but only runs one at a time.
16316 (KJS::Profiler::startProfiling):
16317 (KJS::Profiler::stopProfiling):
16318 (KJS::Profiler::willExecute):
16319 (KJS::Profiler::didExecute):
16320 (KJS::Profiler::printDataInspectorStyle):
16321 (KJS::Profiler::printDataSampleStyle):
16322 * profiler/Profiler.h: Ditto.
16323 (KJS::Profiler::~Profiler):
16324 (KJS::Profiler::allProfiles):
16325 (KJS::Profiler::clearProfiles):
16326
16327 2008-05-08 Anders Carlsson <andersca@apple.com>
16328
16329 Reviewed by Mark.
16330
16331 Enable NPAPI plug-ins on 64-bit.
16332
16333 * wtf/Platform.h:
16334
16335 2008-05-07 Julien Chaffraix <jchaffraix@webkit.org>
16336
16337 Reviewed by Adam Roben.
16338
16339 wx & Gtk build fix.
16340
16341 Add SIZE_MAX definition for the wx port.
16342
16343 * os-win32/stdint.h:
16344
16345 2008-05-07 Ariya Hidayat <ariya.hidayat@trolltech.com>
16346
16347 Reviewed by Simon.
16348
16349 Support for isMainThread in the Qt port.
16350
16351 * wtf/ThreadingQt.cpp:
16352 (WTF::initializeThreading): Adjusted.
16353 (WTF::isMainThread): Added.
16354
16355 2008-05-05 Darin Adler <darin@apple.com>
16356
16357 Reviewed by John Sullivan.
16358
16359 - fix debug-only leak seen on buildbot
16360
16361 * wtf/HashTable.h:
16362 (WTF::HashTable::checkKey): After writing an empty value in, but before constructing a
16363 deleted value on top of it, call the destructor so the empty value doesn't leak.
16364
16365 2008-05-02 Alexey Proskuryakov <ap@webkit.org>
16366
16367 Reviewed by Geoffrey Garen.
16368
16369 Get rid of static data in nodes.cpp (well, at least of non-debug one).
16370
16371 No measurable change on SunSpider.
16372
16373 * kjs/InitializeThreading.cpp:
16374 (KJS::initializeThreadingOnce):
16375 * kjs/nodes.cpp:
16376 (KJS::newTrackedObjects):
16377 (KJS::trackedObjectExtraRefCounts):
16378 (KJS::initializeNodesThreading):
16379 (KJS::ParserRefCounted::ParserRefCounted):
16380 (KJS::ParserRefCounted::ref):
16381 (KJS::ParserRefCounted::deref):
16382 (KJS::ParserRefCounted::refcount):
16383 (KJS::ParserRefCounted::deleteNewObjects):
16384 * kjs/nodes.h:
16385 Made newTrackedObjects and trackedObjectExtraRefCounts per-thread.
16386
16387 2008-05-02 Alexey Proskuryakov <ap@webkit.org>
16388
16389 Reviewed by Darin.
16390
16391 Move call stack depth counter to global object.
16392
16393 * kjs/ExecState.h: (KJS::ExecState::functionCallDepth): Added a recursion depth counter to
16394 per-thread data.
16395 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Initialize PerThreadData.functionCallDepth.
16396 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::perThreadData): Made the result non-const.
16397
16398 * kjs/object.cpp:
16399 (KJS::throwStackSizeExceededError): Moved throwError to a separate function, since it is now
16400 the only thing in JSObject::call that needs a PIC branch.
16401 (KJS::JSObject::call): Use a per-thread variable instead of local static for recursion depth
16402 tracking.
16403
16404 2008-05-02 Alexey Proskuryakov <ap@webkit.org>
16405
16406 Reviewed by Darin.
16407
16408 Make JavaScriptGlue and JavaScriptCore API functions implicitly call initializeThreading
16409 for the sake of non-WebKit clients.
16410
16411 * API/JSBase.cpp:
16412 (JSGarbageCollect):
16413 * API/JSContextRef.cpp:
16414 (JSGlobalContextCreate):
16415 These are the JavaScriptCore API bottlenecks. There are a few other JSStringRef
16416 and JSClassRef functions that can be called earlier, but they do not do anything that
16417 requires initializeThreading.
16418
16419 * kjs/InitializeThreading.cpp:
16420 (KJS::doInitializeThreading):
16421 (KJS::initializeThreading):
16422 On Darwin, make the initialization happen under pthread_once, since there is no guarantee
16423 that non-WebKit clients won't try to call this function re-entrantly.
16424
16425 * kjs/InitializeThreading.h:
16426 * wtf/Threading.h:
16427 Spell out initializeThreading contract.
16428
16429 * wtf/ThreadingPthreads.cpp: (WTF::isMainThread): Make sure that results are correct on
16430 Darwin, even if threading was initialized from a secondary thread.
16431
16432 2008-05-02 Alexey Proskuryakov <ap@webkit.org>
16433
16434 Reviewed by Geoffrey Garen.
16435
16436 https://bugs.webkit.org/show_bug.cgi?id=18826
16437 Make JavaScript heap per-thread
16438
16439 * wtf/ThreadSpecific.h: Make sure to initialize POD thread-specific varaibles, too
16440 (replaced "new T" with "new T()").
16441
16442 * kjs/collector.h: Renamed Collector to Heap, made the heap per-thread. Removed support for
16443 multithreaded access to a heap.
16444 (KJS::CollectorBlock): Removed collectOnMainThreadOnly bitmap, added a reference to owner heap.
16445 (KJS::SmallCellCollectorBlock): Ditto.
16446 (KJS::Heap::markListSet): Moved from a static variable in List.cpp to a per-thread one here.
16447 (KJS::Heap::heap): Added a method to find which heap a JSValue is allocated in.
16448
16449 * kjs/collector.cpp: Changed "const size_t" constants to #defines, to avoid a PIC branch
16450 (gcc was using one to access a constant used in std::max(), because it takes a reference,
16451 even though std::max() itself was inlined).
16452 (KJS::Heap::threadHeap): JS heap is now per-thread.
16453 (KJS::Heap::Heap): Zero-initialize the heap.
16454 (KJS::allocateBlock): Added NEVER_INLINE, because this function uses a PIC branch, so
16455 inlining it in Heap::heapAllocate() is bad for performance, now that the latter doesn't
16456 use any global data.
16457 (KJS::Heap::heapAllocate): Initialize Block::heap.
16458 (KJS::Heap::markCurrentThreadConservatively): Moved into markStackObjectsConservatively(),
16459 as GC only works with a current thread's heap now.
16460 (KJS::Heap::sweep): Removed collectOnMainThreadOnly checks.
16461 (KJS::Heap::collect): Ditto.
16462
16463 * kjs/JSLock.cpp:
16464 * kjs/JSLock.h:
16465 (KJS::JSLock::JSLock):
16466 Removed registerThread(), as the heap no longer cares.
16467
16468 * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize new per-thread
16469 variables in Heap and JSGlobalObject.
16470
16471 * kjs/ExecState.h: (KJS::ExecState::heap): Added a heap pointer for faster access to
16472 per-thread heap, and an accessor for it.
16473
16474 * kjs/JSGlobalObject.h: Made JSGlobalObject linked list per-thread.
16475 * kjs/JSGlobalObject.cpp:
16476 (KJS::JSGlobalObject::~JSGlobalObject): Fixed a bug in linked list handling. It only worked
16477 right if the removed object was the head one!
16478 (KJS::JSGlobalObject::head): Return a per-thread list head.
16479 (KJS::JSGlobalObject::init): Store a reference to per-thread heap.
16480 (KJS::JSGlobalObject::reset): Pass ExecState to functions that need it.
16481 (KJS::JSGlobalObject::tearOffActivation): Ditto.
16482 (KJS::JSGlobalObject::operator new): JSGlobalObject allocation cannot use an ExecState,
16483 so it needs a custom operator new that directly accesses per-thread heap.
16484
16485 * kjs/list.h:
16486 (KJS::List::List): Replaced m_isInMarkSet boolean with an actual pointer to the set, since it
16487 is no longer a single static object.
16488 (KJS::List::~List): Ditto.
16489 * kjs/list.cpp:
16490 (KJS::List::markSet): Removed, this is now stored in Heap.
16491 (KJS::List::markProtectedLists): Take a reference to the list.
16492 (KJS::List::expandAndAppend): Ask the current thread heap for a mark set reference.
16493
16494 * kjs/protect.h:
16495 (KJS::gcProtect):
16496 (KJS::gcUnprotect):
16497 Use the newly added Heap::heap() method to find out which heap the value to be (un)protected
16498 belongs to.
16499
16500 * kjs/property_map.h: Removed unused SavedProperty class.
16501
16502 * JavaScriptCore.exp:
16503 * API/JSBase.cpp:
16504 (JSGarbageCollect):
16505 * API/JSCallbackObjectFunctions.h:
16506 (KJS::::staticFunctionGetter):
16507 * API/JSClassRef.cpp:
16508 (OpaqueJSClass::prototype):
16509 * API/JSObjectRef.cpp:
16510 (JSObjectMake):
16511 (JSObjectMakeFunctionWithCallback):
16512 (JSObjectMakeConstructor):
16513 (JSObjectMakeFunction):
16514 * API/JSValueRef.cpp:
16515 (JSValueMakeNumber):
16516 (JSValueMakeString):
16517 * kjs/array_instance.cpp:
16518 (KJS::ArrayInstance::ArrayInstance):
16519 (KJS::ArrayInstance::lengthGetter):
16520 * kjs/array_object.cpp:
16521 (KJS::arrayProtoFuncToString):
16522 (KJS::arrayProtoFuncToLocaleString):
16523 (KJS::arrayProtoFuncJoin):
16524 (KJS::arrayProtoFuncConcat):
16525 (KJS::arrayProtoFuncPop):
16526 (KJS::arrayProtoFuncPush):
16527 (KJS::arrayProtoFuncShift):
16528 (KJS::arrayProtoFuncSlice):
16529 (KJS::arrayProtoFuncSplice):
16530 (KJS::arrayProtoFuncUnShift):
16531 (KJS::arrayProtoFuncFilter):
16532 (KJS::arrayProtoFuncMap):
16533 (KJS::arrayProtoFuncEvery):
16534 (KJS::arrayProtoFuncForEach):
16535 (KJS::arrayProtoFuncSome):
16536 (KJS::arrayProtoFuncIndexOf):
16537 (KJS::arrayProtoFuncLastIndexOf):
16538 (KJS::ArrayObjectImp::ArrayObjectImp):
16539 (KJS::ArrayObjectImp::construct):
16540 * kjs/bool_object.cpp:
16541 (KJS::BooleanPrototype::BooleanPrototype):
16542 (KJS::booleanProtoFuncToString):
16543 (KJS::BooleanObjectImp::BooleanObjectImp):
16544 (KJS::BooleanObjectImp::construct):
16545 * kjs/date_object.cpp:
16546 (KJS::formatLocaleDate):
16547 (KJS::DatePrototype::DatePrototype):
16548 (KJS::DateObjectImp::DateObjectImp):
16549 (KJS::DateObjectImp::construct):
16550 (KJS::DateObjectImp::callAsFunction):
16551 (KJS::DateObjectFuncImp::DateObjectFuncImp):
16552 (KJS::DateObjectFuncImp::callAsFunction):
16553 (KJS::dateProtoFuncToString):
16554 (KJS::dateProtoFuncToUTCString):
16555 (KJS::dateProtoFuncToDateString):
16556 (KJS::dateProtoFuncToTimeString):
16557 (KJS::dateProtoFuncToLocaleString):
16558 (KJS::dateProtoFuncToLocaleDateString):
16559 (KJS::dateProtoFuncToLocaleTimeString):
16560 (KJS::dateProtoFuncValueOf):
16561 (KJS::dateProtoFuncGetTime):
16562 (KJS::dateProtoFuncGetFullYear):
16563 (KJS::dateProtoFuncGetUTCFullYear):
16564 (KJS::dateProtoFuncToGMTString):
16565 (KJS::dateProtoFuncGetMonth):
16566 (KJS::dateProtoFuncGetUTCMonth):
16567 (KJS::dateProtoFuncGetDate):
16568 (KJS::dateProtoFuncGetUTCDate):
16569 (KJS::dateProtoFuncGetDay):
16570 (KJS::dateProtoFuncGetUTCDay):
16571 (KJS::dateProtoFuncGetHours):
16572 (KJS::dateProtoFuncGetUTCHours):
16573 (KJS::dateProtoFuncGetMinutes):
16574 (KJS::dateProtoFuncGetUTCMinutes):
16575 (KJS::dateProtoFuncGetSeconds):
16576 (KJS::dateProtoFuncGetUTCSeconds):
16577 (KJS::dateProtoFuncGetMilliSeconds):
16578 (KJS::dateProtoFuncGetUTCMilliseconds):
16579 (KJS::dateProtoFuncGetTimezoneOffset):
16580 (KJS::dateProtoFuncSetTime):
16581 (KJS::setNewValueFromTimeArgs):
16582 (KJS::setNewValueFromDateArgs):
16583 (KJS::dateProtoFuncSetYear):
16584 (KJS::dateProtoFuncGetYear):
16585 * kjs/error_object.cpp:
16586 (KJS::ErrorPrototype::ErrorPrototype):
16587 (KJS::errorProtoFuncToString):
16588 (KJS::ErrorObjectImp::ErrorObjectImp):
16589 (KJS::ErrorObjectImp::construct):
16590 (KJS::NativeErrorPrototype::NativeErrorPrototype):
16591 (KJS::NativeErrorImp::NativeErrorImp):
16592 (KJS::NativeErrorImp::construct):
16593 * kjs/function.cpp:
16594 (KJS::FunctionImp::lengthGetter):
16595 (KJS::FunctionImp::construct):
16596 (KJS::Arguments::Arguments):
16597 (KJS::ActivationImp::createArgumentsObject):
16598 (KJS::encode):
16599 (KJS::decode):
16600 (KJS::globalFuncParseInt):
16601 (KJS::globalFuncParseFloat):
16602 (KJS::globalFuncEscape):
16603 (KJS::globalFuncUnescape):
16604 (KJS::PrototypeFunction::PrototypeFunction):
16605 (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
16606 * kjs/function_object.cpp:
16607 (KJS::FunctionPrototype::FunctionPrototype):
16608 (KJS::functionProtoFuncToString):
16609 (KJS::FunctionObjectImp::FunctionObjectImp):
16610 (KJS::FunctionObjectImp::construct):
16611 * kjs/internal.cpp:
16612 (KJS::StringImp::toObject):
16613 * kjs/internal.h:
16614 (KJS::StringImp::StringImp):
16615 (KJS::NumberImp::operator new):
16616 * kjs/lookup.h:
16617 (KJS::staticFunctionGetter):
16618 (KJS::cacheGlobalObject):
16619 * kjs/math_object.cpp:
16620 (KJS::MathObjectImp::getValueProperty):
16621 (KJS::mathProtoFuncAbs):
16622 (KJS::mathProtoFuncACos):
16623 (KJS::mathProtoFuncASin):
16624 (KJS::mathProtoFuncATan):
16625 (KJS::mathProtoFuncATan2):
16626 (KJS::mathProtoFuncCeil):
16627 (KJS::mathProtoFuncCos):
16628 (KJS::mathProtoFuncExp):
16629 (KJS::mathProtoFuncFloor):
16630 (KJS::mathProtoFuncLog):
16631 (KJS::mathProtoFuncMax):
16632 (KJS::mathProtoFuncMin):
16633 (KJS::mathProtoFuncPow):
16634 (KJS::mathProtoFuncRandom):
16635 (KJS::mathProtoFuncRound):
16636 (KJS::mathProtoFuncSin):
16637 (KJS::mathProtoFuncSqrt):
16638 (KJS::mathProtoFuncTan):
16639 * kjs/nodes.cpp:
16640 (KJS::Node::handleException):
16641 (KJS::NumberNode::evaluate):
16642 (KJS::StringNode::evaluate):
16643 (KJS::ArrayNode::evaluate):
16644 (KJS::PostIncResolveNode::evaluate):
16645 (KJS::PostIncLocalVarNode::evaluate):
16646 (KJS::PostDecResolveNode::evaluate):
16647 (KJS::PostDecLocalVarNode::evaluate):
16648 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
16649 (KJS::PostIncBracketNode::evaluate):
16650 (KJS::PostDecBracketNode::evaluate):
16651 (KJS::PostIncDotNode::evaluate):
16652 (KJS::PostDecDotNode::evaluate):
16653 (KJS::typeStringForValue):
16654 (KJS::LocalVarTypeOfNode::evaluate):
16655 (KJS::TypeOfResolveNode::evaluate):
16656 (KJS::TypeOfValueNode::evaluate):
16657 (KJS::PreIncLocalVarNode::evaluate):
16658 (KJS::PreIncResolveNode::evaluate):
16659 (KJS::PreDecLocalVarNode::evaluate):
16660 (KJS::PreDecResolveNode::evaluate):
16661 (KJS::PreIncConstNode::evaluate):
16662 (KJS::PreDecConstNode::evaluate):
16663 (KJS::PostIncConstNode::evaluate):
16664 (KJS::PostDecConstNode::evaluate):
16665 (KJS::PreIncBracketNode::evaluate):
16666 (KJS::PreDecBracketNode::evaluate):
16667 (KJS::PreIncDotNode::evaluate):
16668 (KJS::PreDecDotNode::evaluate):
16669 (KJS::NegateNode::evaluate):
16670 (KJS::BitwiseNotNode::evaluate):
16671 (KJS::MultNode::evaluate):
16672 (KJS::DivNode::evaluate):
16673 (KJS::ModNode::evaluate):
16674 (KJS::addSlowCase):
16675 (KJS::add):
16676 (KJS::AddNumbersNode::evaluate):
16677 (KJS::AddStringsNode::evaluate):
16678 (KJS::AddStringLeftNode::evaluate):
16679 (KJS::AddStringRightNode::evaluate):
16680 (KJS::SubNode::evaluate):
16681 (KJS::LeftShiftNode::evaluate):
16682 (KJS::RightShiftNode::evaluate):
16683 (KJS::UnsignedRightShiftNode::evaluate):
16684 (KJS::BitXOrNode::evaluate):
16685 (KJS::BitOrNode::evaluate):
16686 (KJS::valueForReadModifyAssignment):
16687 (KJS::ForInNode::execute):
16688 (KJS::TryNode::execute):
16689 (KJS::FuncDeclNode::makeFunction):
16690 (KJS::FuncExprNode::evaluate):
16691 * kjs/number_object.cpp:
16692 (KJS::NumberPrototype::NumberPrototype):
16693 (KJS::numberProtoFuncToString):
16694 (KJS::numberProtoFuncToLocaleString):
16695 (KJS::numberProtoFuncToFixed):
16696 (KJS::numberProtoFuncToExponential):
16697 (KJS::numberProtoFuncToPrecision):
16698 (KJS::NumberObjectImp::NumberObjectImp):
16699 (KJS::NumberObjectImp::getValueProperty):
16700 (KJS::NumberObjectImp::construct):
16701 (KJS::NumberObjectImp::callAsFunction):
16702 * kjs/object.cpp:
16703 (KJS::JSObject::defineGetter):
16704 (KJS::JSObject::defineSetter):
16705 (KJS::JSObject::putDirect):
16706 (KJS::Error::create):
16707 * kjs/object.h:
16708 * kjs/object_object.cpp:
16709 (KJS::ObjectPrototype::ObjectPrototype):
16710 (KJS::objectProtoFuncToLocaleString):
16711 (KJS::objectProtoFuncToString):
16712 (KJS::ObjectObjectImp::ObjectObjectImp):
16713 (KJS::ObjectObjectImp::construct):
16714 * kjs/regexp_object.cpp:
16715 (KJS::RegExpPrototype::RegExpPrototype):
16716 (KJS::regExpProtoFuncToString):
16717 (KJS::RegExpImp::getValueProperty):
16718 (KJS::RegExpObjectImp::RegExpObjectImp):
16719 (KJS::RegExpObjectImp::arrayOfMatches):
16720 (KJS::RegExpObjectImp::getBackref):
16721 (KJS::RegExpObjectImp::getLastParen):
16722 (KJS::RegExpObjectImp::getLeftContext):
16723 (KJS::RegExpObjectImp::getRightContext):
16724 (KJS::RegExpObjectImp::getValueProperty):
16725 (KJS::RegExpObjectImp::createRegExpImp):
16726 * kjs/regexp_object.h:
16727 * kjs/string_object.cpp:
16728 (KJS::StringInstance::StringInstance):
16729 (KJS::StringInstance::lengthGetter):
16730 (KJS::StringInstance::indexGetter):
16731 (KJS::stringInstanceNumericPropertyGetter):
16732 (KJS::StringPrototype::StringPrototype):
16733 (KJS::replace):
16734 (KJS::stringProtoFuncCharAt):
16735 (KJS::stringProtoFuncCharCodeAt):
16736 (KJS::stringProtoFuncConcat):
16737 (KJS::stringProtoFuncIndexOf):
16738 (KJS::stringProtoFuncLastIndexOf):
16739 (KJS::stringProtoFuncMatch):
16740 (KJS::stringProtoFuncSearch):
16741 (KJS::stringProtoFuncReplace):
16742 (KJS::stringProtoFuncSlice):
16743 (KJS::stringProtoFuncSplit):
16744 (KJS::stringProtoFuncSubstr):
16745 (KJS::stringProtoFuncSubstring):
16746 (KJS::stringProtoFuncToLowerCase):
16747 (KJS::stringProtoFuncToUpperCase):
16748 (KJS::stringProtoFuncToLocaleLowerCase):
16749 (KJS::stringProtoFuncToLocaleUpperCase):
16750 (KJS::stringProtoFuncLocaleCompare):
16751 (KJS::stringProtoFuncBig):
16752 (KJS::stringProtoFuncSmall):
16753 (KJS::stringProtoFuncBlink):
16754 (KJS::stringProtoFuncBold):
16755 (KJS::stringProtoFuncFixed):
16756 (KJS::stringProtoFuncItalics):
16757 (KJS::stringProtoFuncStrike):
16758 (KJS::stringProtoFuncSub):
16759 (KJS::stringProtoFuncSup):
16760 (KJS::stringProtoFuncFontcolor):
16761 (KJS::stringProtoFuncFontsize):
16762 (KJS::stringProtoFuncAnchor):
16763 (KJS::stringProtoFuncLink):
16764 (KJS::StringObjectImp::StringObjectImp):
16765 (KJS::StringObjectImp::construct):
16766 (KJS::StringObjectImp::callAsFunction):
16767 (KJS::StringObjectFuncImp::StringObjectFuncImp):
16768 (KJS::StringObjectFuncImp::callAsFunction):
16769 * kjs/string_object.h:
16770 (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
16771 * kjs/testkjs.cpp:
16772 (GlobalObject::GlobalObject):
16773 (functionGC):
16774 (functionRun):
16775 (functionReadline):
16776 (kjsmain):
16777 * kjs/ustring.h:
16778 * kjs/value.cpp:
16779 (KJS::JSCell::operator new):
16780 (KJS::jsString):
16781 (KJS::jsOwnedString):
16782 (KJS::jsNumberCell):
16783 * kjs/value.h:
16784 (KJS::jsNaN):
16785 (KJS::jsNumber):
16786 (KJS::jsNumberFromAnd):
16787 (KJS::JSCell::marked):
16788 (KJS::JSCell::mark):
16789 (KJS::JSValue::toJSNumber):
16790 Removed collectOnMainThreadOnly, as this is the only way to collect now. Replaced calls to
16791 static Collector methods with calls to per-thread Heap ones.
16792
16793 2008-05-02 Dan Bernstein <mitz@apple.com>
16794
16795 Reviewed by Maciej Stachowiak.
16796
16797 - Mac build fix
16798
16799 * wtf/StrHash.h: Added header guards and removed #include "config.h".
16800
16801 2008-05-01 Ada Chan <adachan@apple.com>
16802
16803 #include <wtf/StrHash.h> in identifier.cpp.
16804
16805 Reviewed by Maciej.
16806
16807 * kjs/identifier.cpp:
16808
16809 2008-05-01 Steve Falkenburg <sfalken@apple.com>
16810
16811 Build fix.
16812
16813 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
16814
16815 2008-05-01 Sam Weinig <sam@webkit.org>
16816
16817 Fix build.
16818
16819 * JavaScriptCore.xcodeproj/project.pbxproj:
16820
16821 2008-05-01 Kevin McCullough <kmccullough@apple.com>
16822
16823 Reviewed by Darin.
16824
16825 <rdar://problem/5770054> JavaScript profiler (10928)
16826 - Fix "sample" output so that it can be imported into Instruments
16827 - Also keep track of number of times a function is profiled.
16828
16829 * JavaScriptCore.xcodeproj/project.pbxproj: Add StrHash.h which needed
16830 to be pulled out of identifier.cpp so that it could be used by the
16831 profiler and identifiers.
16832 * kjs/identifier.cpp: Ditto.
16833 * profiler/FunctionCallProfile.cpp:
16834 (KJS::FunctionCallProfile::printDataInspectorStyle): Inspector style
16835 printing should show microseconds.
16836 (KJS::FunctionCallProfile::printDataSampleStyle): Sample style printing
16837 now counts the number of times a function is in the stack tree and does
16838 not print microseconds since that does not make sense for a sampler.
16839 * profiler/FunctionCallProfile.h: Keep track of number of times a
16840 function is profiled.
16841 (KJS::FunctionCallProfile::numberOfCalls):
16842 * profiler/Profiler.cpp:
16843 (KJS::functionNameCountPairComparator): Comparator for sort function in
16844 printDataSampleStyle.
16845 (KJS::Profiler::printDataSampleStyle): Print the number of times that a
16846 function is listed in the stack tree in order of most times listed.
16847 * wtf/HashCountedSet.h: Added copyToVector since it didn't exist and is
16848 a more standard way to copy a HashSet to a Vector. I added on variant
16849 that takes a pair as the Vector's type and so the HashCountedSet simply
16850 fills in that pair with its internal pair, and another variant that
16851 takes a Vector of the type of the HashCountedSet and only fills in the
16852 Vector with the first element of the pair.
16853 (WTF::copyToVector):
16854 * wtf/StrHash.h: Added.
16855 (WTF::):
16856
16857 2008-04-29 David Kilzer <ddkilzer@apple.com>
16858
16859 BUILD FIX for ENABLE(DASHBOARD_SUPPORT)
16860
16861 * wtf/Platform.h: Defined ENABLE(DASHBOARD_SUPPORT) to 1 only for
16862 PLATFORM(MAC) and PLATFORM(WIN). Changed default to 0 for other
16863 ports.
16864
16865 2008-04-29 Greg Bolsinga <bolsinga@apple.com>
16866
16867 Reviewed by Darin.
16868
16869 Wrapped Dashboard code with ENABLE(DASHBOARD_SUPPORT)
16870
16871 * wtf/Platform.h:
16872
16873 2008-04-29 Kevin McCullough <kmccullough@apple.com>
16874
16875 Reviewed by Geoff.
16876
16877 -<rdar://problem/5770054> JavaScript profiler (10928)
16878 -Keep call count.
16879
16880 * profiler/FunctionCallProfile.cpp:
16881 (KJS::FunctionCallProfile::FunctionCallProfile):
16882 (KJS::FunctionCallProfile::didExecute): Implements call count and fixed a bug where a stackIndex
16883 of 0 was causing the assert to be hit.
16884 (KJS::FunctionCallProfile::stopProfiling):
16885 (KJS::FunctionCallProfile::endAndRecordCall):
16886 * profiler/FunctionCallProfile.h:
16887
16888 2008-04-29 Simon Hausmann <hausmann@webkit.org>
16889
16890 Qt/Windows build fix. The externally declared hash tables are actually
16891 declared const and the const is mangled in the symbol name, so when
16892 importing they also need to be marked const.
16893
16894 When compiling without MULTIPLE_THREADS use a const HashTable&
16895 instead of a HashTable& in ThreadClassInfoHashTables to avoid
16896 initializing the latter with a const reference.
16897
16898 * kjs/JSGlobalObject.cpp:
16899
16900 2008-04-28 Alexey Proskuryakov <ap@webkit.org>
16901
16902 Windows build fix.
16903
16904 * kjs/ExecState.h: For whatever reason, MSVC couldn't generate a default constructor for
16905 a struct that had a "const List" member. Removing the const qulifier makes the problem go away.
16906
16907 2008-04-28 Alexey Proskuryakov <ap@webkit.org>
16908
16909 Reviewed by Darin.
16910
16911 Fix run-webkit-tests --threading
16912 and provisionally fix <https://bugs.webkit.org/show_bug.cgi?id=18661>
16913 Proxy server issue in Sunday's Nightly
16914
16915 Changed ClassInfo objects for built-in objects to hold a getter function returning
16916 a per-thread instance. This makes it safe to share these ClassInfo objects between threads -
16917 and these are the only ones that need to be shared.
16918
16919 * kjs/lexer.cpp:
16920 (KJS::Lexer::Lexer):
16921 (KJS::Lexer::~Lexer):
16922 * kjs/lexer.h:
16923 Made mainTable a member of Lexer, so that it no longer needs to be shared between threads.
16924
16925 * kjs/object.cpp:
16926 (KJS::JSObject::deleteProperty):
16927 (KJS::JSObject::findPropertyHashEntry):
16928 (KJS::JSObject::propertyIsEnumerable):
16929 (KJS::JSObject::getPropertyAttributes):
16930 (KJS::JSObject::getPropertyNames):
16931 * kjs/object.h:
16932 (KJS::ClassInfo::propHashTable):
16933 Added a new classPropHashTableGetterFunction field to ClassInfo. If it is non-zero, the
16934 static table is not used.
16935
16936 * kjs/JSGlobalObject.cpp:
16937 (KJS::ThreadClassInfoHashTables::ThreadClassInfoHashTables): This new class holds per-thread
16938 HashTables for built-in classes. The old static structs are copied to create per-thread
16939 instances.
16940 (KJS::JSGlobalObject::threadClassInfoHashTables): An accessor/initializer for the above.
16941 (KJS::JSGlobalObject::init): Copy per-thread data into a single structure for faster access.
16942 Also, construct globalExec.
16943 (KJS::JSGlobalObject::reset): Adapted for globalExec now being an OwnPtr.
16944 (KJS::JSGlobalObject::mark): Ditto.
16945 (KJS::JSGlobalObject::globalExec): Ditto.
16946 * kjs/JSGlobalObject.h:
16947 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Made JSGlobalObject::JSGlobalObjectData::globalExec an OwnPtr, so that it can
16948 be initialized from JSGlobalObject::init() after them. Otherwise, ExecState constructor was
16949 trying to access half-initialized JSGlobalObject to make its own copy of these table
16950 references, and failed.
16951 (KJS::JSGlobalObject::JSGlobalObject): Pass "this" value to init() to create globalExec.
16952 (KJS::JSGlobalObject::perThreadData): An accessor for per-thread data.
16953
16954 * kjs/ExecState.cpp:
16955 (KJS::ExecState::ExecState):
16956 * kjs/ExecState.h:
16957 (KJS::ExecState::propertyNames):
16958 (KJS::ExecState::emptyList):
16959 (KJS::ExecState::arrayTable):
16960 (KJS::ExecState::dateTable):
16961 (KJS::ExecState::mathTable):
16962 (KJS::ExecState::numberTable):
16963 (KJS::ExecState::RegExpImpTable):
16964 (KJS::ExecState::RegExpObjectImpTable):
16965 (KJS::ExecState::stringTable):
16966 * kjs/ExecStateInlines.h:
16967 (KJS::ExecState::ExecState):
16968 Each ExecState holds its own reference to per-thread data, for even faster access. Moved
16969 m_emptyList and m_propertyNames to the same structure, making ExecState faster to construct
16970 and take less space on the stack.
16971
16972 * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize thread-static data
16973 added to JSGlobalObject.
16974
16975 * API/JSCallbackConstructor.cpp:
16976 * API/JSCallbackFunction.cpp:
16977 * API/JSCallbackObject.cpp:
16978 * JavaScriptCore.exp:
16979 * kjs/JSVariableObject.cpp:
16980 (KJS::JSVariableObject::getPropertyAttributes):
16981 * kjs/JSVariableObject.h:
16982 * kjs/array_instance.cpp:
16983 * kjs/array_object.cpp:
16984 (KJS::ArrayPrototype::getOwnPropertySlot):
16985 * kjs/bool_object.cpp:
16986 * kjs/create_hash_table:
16987 * kjs/date_object.cpp:
16988 (KJS::DatePrototype::getOwnPropertySlot):
16989 (KJS::DateObjectImp::DateObjectImp):
16990 * kjs/error_object.cpp:
16991 * kjs/function.cpp:
16992 * kjs/function_object.cpp:
16993 (KJS::FunctionPrototype::FunctionPrototype):
16994 * kjs/internal.cpp:
16995 * kjs/lookup.h:
16996 * kjs/math_object.cpp:
16997 (KJS::MathObjectImp::getOwnPropertySlot):
16998 * kjs/number_object.cpp:
16999 (KJS::NumberObjectImp::getOwnPropertySlot):
17000 * kjs/object_object.cpp:
17001 (KJS::ObjectPrototype::ObjectPrototype):
17002 * kjs/regexp_object.cpp:
17003 (KJS::RegExpPrototype::RegExpPrototype):
17004 (KJS::RegExpImp::getOwnPropertySlot):
17005 (KJS::RegExpImp::put):
17006 (KJS::RegExpObjectImp::getOwnPropertySlot):
17007 (KJS::RegExpObjectImp::put):
17008 * kjs/string_object.cpp:
17009 (KJS::StringPrototype::getOwnPropertySlot):
17010 Adjust for the above changes.
17011
17012 2008-04-28 Darin Adler <darin@apple.com>
17013
17014 Reviewed by Adam.
17015
17016 - make sure RefPtr's default hash doesn't ref/deref when computing the hash
17017 - remove remnants of the hash table storage type optimization
17018
17019 * wtf/HashFunctions.h: Used "using" to get the hash and equal functions
17020 from PtrHash<P*> into PtrHash<RefPtr<P>>.
17021
17022 * wtf/HashMap.h: Replaced uses of PairBaseHashTraits with PairHashTraits.
17023 Eliminated storage-related typedefs. Removed constructor, destructor,
17024 copy constructor, and destructor since the compiler-generated ones are
17025 fine. Removed refAll and derefAll. Took out unnnecessary typecasts.
17026 Removed use of RefCounter.
17027
17028 * wtf/HashSet.h: Eliminated storage-related typedefs. Removed constructor,
17029 destructor, copy constructor, and destructor since the compiler-generated
17030 ones are fine. Removed refAll and derefAll. Removed unneeded template
17031 arguents from HashSetTranslatorAdapter. Eliminated unneeded HashSetTranslator
17032 template.
17033
17034 * wtf/HashTable.h: Tweaked formatting. Removed NeedsRef, RefCounterBase,
17035 RefCounter, HashTableRefCounterBase, HashTableRefCounter, and Assigner
17036 class templates.
17037
17038 * wtf/HashTraits.h: Removed StorageTraits, needsRef, PairBaseHashTraits,
17039 and HashKeyStorageTraits.
17040
17041 * wtf/RefPtrHashMap.h: Made all the same fixes as in HashMap. Also made
17042 the corresponding changes to RefPtrHashMapRawKeyTranslator.
17043
17044 2008-04-28 Darin Adler <darin@apple.com>
17045
17046 Reviewed by Mitz.
17047
17048 - fix assertion hit every time you view www.apple.com
17049
17050 * kjs/PropertyNameArray.cpp:
17051 (KJS::PropertyNameArray::add): Changed assertion to allow null and empty strings.
17052 Now to find out why we have a property named "" and if that's a bug!
17053
17054 2008-04-27 Mark Rowe <mrowe@apple.com>
17055
17056 Reviewed by Maciej Stachowiak.
17057
17058 Fix crash inside PtrHash::hash when loading a page.
17059
17060 * wtf/HashFunctions.h: Explicitly use the superclass implementation of hash to avoid infinite recursion.
17061
17062 2008-04-27 Darin Adler <darin@apple.com>
17063
17064 Reviewed by Maciej.
17065
17066 - fix <rdar://problem/5657459> REGRESSION: JavaScriptCore no longer builds with
17067 GCC 4.2 due to pointer aliasing warnings
17068
17069 Fix this by removing the HashTable optimizations that allowed us to share a back end
17070 implementation between hash tables with integers, pointers, RefPtr, and String objects
17071 as keys. The way it worked was incompatible with strict aliasing.
17072
17073 This increases code size. On Mac OS X we'll have to regenerate .order files to avoid
17074 slowing down Safari startup times.
17075
17076 This creates a slight slowdown in SunSpider, mitigated by the following four speedups:
17077
17078 - speed up array put slightly by moving a branch (was already done for get)
17079
17080 - speed up symbol table access by adding a function named inlineGet to HashMap
17081 and using that in symbolTableGet/Put
17082
17083 - speed up PropertyNameArray creation by reducing the amount of reference count
17084 churn and uniqueness checking when adding names and not doing any allocation at
17085 all when building small arrays
17086
17087 - speed up conversion of strings to floating point numbers by eliminating the
17088 malloc/free of the buffer for the ASCII copy of the string; a way to make
17089 things even faster would be to change strtod to take a UTF-16 string
17090
17091 Note that there is considerable unused complexity now in HashSet/Map/Table to support
17092 "storage types", which is no longer used. Will do in a separate patch.
17093
17094 * API/JSCallbackObjectFunctions.h:
17095 (KJS::JSCallbackObject<Base>::getPropertyNames): Removed explicit cast to Identifier to
17096 take advantage of the new PropertyNameArray::add overload and avoid reference count churn.
17097 * API/JSObjectRef.cpp:
17098 (JSPropertyNameAccumulatorAddName): Ditto.
17099 * JavaScriptCore.exp: Updated PropertyNameArray::add entry point name.
17100
17101 * kjs/JSVariableObject.cpp: Removed now-unneeded IdentifierRepHashTraits::nullRepPtr
17102 definition (see below).
17103 (KJS::JSVariableObject::getPropertyNames): Removed explicit cast to Identifier.
17104
17105 * kjs/JSVariableObject.h:
17106 (KJS::JSVariableObject::symbolTableGet): Use inlineGet for speed. Also changed to do
17107 early exit instead of nesting the body inside an if.
17108 (KJS::JSVariableObject::symbolTablePut): Ditto.
17109
17110 * kjs/PropertyNameArray.cpp:
17111 (KJS::PropertyNameArray::add): Changed implementation to take a raw pointer instead of
17112 a reference to an identifier. Do uniqueness checking by searching the vector when the
17113 vector is short, only building the set once the vector is large enough.
17114
17115 * kjs/PropertyNameArray.h: Added an overload of add for a raw pointer, and made the old
17116 add function call that one. Added an addKnownUnique function for use when the new
17117 name is known to be different from any other in the array. Changed the vector to have
17118 an inline capacity of 20.
17119
17120 * kjs/SymbolTable.h: Changed IdentifierRepHash to inherit from the default hash for
17121 a RefPtr so we don't have to define so much. Added an overload of the hash function for
17122 a raw pointer as required by the new RefPtrHashMap. Got rid of the now-unneeded
17123 IdentifierRepHashTraits -- the default traits now work fine. Added a definition of
17124 empthValueIsZero to SymbolTableIndexHashTraits; not having it was incorrect, but harmless.
17125
17126 * kjs/array_instance.cpp:
17127 (KJS::ArrayInstance::put): Move the maxArrayIndex check inside the branch that checks
17128 the index against the length, as done in the get function.
17129
17130 * kjs/function.cpp:
17131 (KJS::globalFuncKJSPrint): Changed to use the new getCString instead of cstring.
17132
17133 * kjs/internal.cpp: Removed printInfo debugging function, a client of cstring.
17134 If we need a debugging function we can easily make a better one and we haven't
17135 used this one in a long time.
17136 * kjs/internal.h: Ditto.
17137
17138 * kjs/object.cpp:
17139 (KJS::JSObject::getPropertyNames): Removed explicit cast to Identifier.
17140 * kjs/property_map.cpp:
17141 (KJS::PropertyMap::getEnumerablePropertyNames): Ditto. Also added a special case for
17142 the case where the propertyNames array is empty -- in that case we know we're adding
17143 a set of names that are non-overlapping so we can use addKnownUnique.
17144 * kjs/ustring.cpp:
17145 (KJS::UString::getCString): Replaces cstring. Puts the C string into a CStringBuffer,
17146 which is a char Vector with an inline capacity. Also returns a boolean to indicate if
17147 the converion was lossy, which eliminates the need for a separate is8Bit call.
17148 (KJS::UString::toDouble): Changed to call getCString instead of cstring.
17149 * kjs/ustring.h: Ditto.
17150
17151 * wtf/HashFunctions.h: Overload the hash and equal functions for RefPtr's default
17152 hash to take raw pointers. This works with the changes to RefPtrHashMap to avoid
17153 introducing refcount churn.
17154
17155 * wtf/HashMap.h: Removed special code to convert the deleted value to the empty value
17156 when writing a new value into the map. This is now handled elsewhere.
17157 (WTF::HashMap::get): Removed code that checks for an empty hash table before calling
17158 HashTable::lookup; it's slightly more efficient to do this check inside lookup.
17159
17160 * wtf/HashTable.h:
17161 (WTF::HashTable::isDeletedBucket): Changed to use isDeletedValue instead of using
17162 deletedValue and the equality operator.
17163 (WTF::HashTable::deleteBucket): Changed to use constructDeletedValue instead of
17164 using deletedValue and the assignment operator.
17165 (WTF::HashTable::checkKey): Added. Factors out the check for values that are empty
17166 or deleted keys that's used in various functions below.
17167 (WTF::HashTable::lookup): Changed to use checkKey, check for a 0 table, and also
17168 made public for use by RefPtrHashMap.
17169 (WTF::HashTable::lookupForWriting): Changed to use checkKey.
17170 (WTF::HashTable::fullLookupForWriting): Changed to use checkKey.
17171 (WTF::HashTable::add): Changed to use checkKey, and call initializeBucket on a
17172 deleted bucket before putting a new entry into it.
17173 (WTF::HashTable::addPassingHashCode): Ditto.
17174 (WTF::HashTable::deallocateTable): Check isDeletedBucket before calling ~ValueType.
17175
17176 * wtf/HashTraits.h: Got ridd of all the HashTraits specialization for the integer
17177 types, since GeneicHashTraitsBase already deals with integers separately. Put the
17178 deleted value support into GenericHashTraitsBase. Changed FloatHashTraits to
17179 inherit from GenericHashTraits, and define construct/isDeletedValue rather than
17180 deletedValue. Removed the ref and deref functions from RefPtr's HashTraits, and
17181 defined construct/isDeletedValue. Eliminated DeletedValueAssigner. Changed
17182 PairHashTraits to define construct/isDeletedValue, and also merged
17183 PairBaseHashTraits in with PairHashTraits. Got rid of all specialization of
17184 HashKeyStorageTraits. We'll remove that, and the needsRef data member, later.
17185
17186 * wtf/RefPtr.h: Added HashTableDeletedValueType, an enum type with a single value,
17187 HashTableDeletedValue. Used that type to make a new constructor to construct
17188 deleted values and also added an isHashTableDeletedValue function.
17189
17190 * wtf/RefPtrHashMap.h: Added RefPtrHashMapRawKeyTranslator and used it to implement
17191 the raw pointer functions. This is a way to continue to avoid refcount thrash. We
17192 can't use the old way because it depended on the underlying map using a non-RefPtr
17193 type.
17194 (WTF::HashMap::find): Use find with RefPtrHashMapRawKeyTranslator.
17195 (WTF::HashMap::contains): Use contains with RefPtrHashMapRawKeyTranslator.
17196 (WTF::HashMap::inlineAdd): Use add with RefPtrHashMapRawKeyTranslator.
17197 (WTF::HashMap::get): Removed code that checks for an empty hash table before calling
17198 HashTable::lookup; it's slightly more efficient to do this check inside lookup.
17199 (WTF::HashMap::inlineGet): Added. Just like get, but marked inline for use in the
17200 symbol table code.
17201
17202 2008-04-25 Sam Weinig <sam@webkit.org>
17203
17204 Rubber-stamped by Mark Rowe.
17205
17206 Remove SavedBuiltins and SavedProperties classes and the methods used to
17207 save data to them. The CachedPage now stores a the JSGlobalObject in full.
17208
17209 * JavaScriptCore.exp:
17210 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
17211 * JavaScriptCore.xcodeproj/project.pbxproj:
17212 * kjs/JSGlobalObject.cpp:
17213 * kjs/JSGlobalObject.h:
17214 * kjs/JSVariableObject.cpp:
17215 * kjs/JSVariableObject.h:
17216 (KJS::JSVariableObject::localStorage):
17217 * kjs/SavedBuiltins.h: Removed.
17218 * kjs/object.h:
17219 * kjs/property_map.cpp:
17220 * kjs/property_map.h:
17221
17222 2008-04-25 Mark Rowe <mrowe@apple.com>
17223
17224 Rubber-stamped by Sam Weinig.
17225
17226 Add some content to an empty ICU header file to prevent verification errors.
17227
17228 * icu/unicode/utf_old.h:
17229
17230 2008-04-25 David Kilzer <ddkilzer@apple.com>
17231
17232 <rdar://problem/5819422> REGRESSION: Wrong line number passed to -willLeaveCallFrame
17233
17234 Patch by George Dicker and Michael Kahl. Reviewed by Darin.
17235
17236 When -[NSObject(WebScriptDebugDelegate) webView:willLeaveCallFrame:sourceId:line:forWebFrame:]
17237 is invoked, the first line number of the function is returned instead of the last
17238 line number. This regressed in r28458.
17239
17240 * kjs/nodes.cpp:
17241 (KJS::FunctionBodyNodeWithDebuggerHooks::execute): Pass lastLine() instead of lineNo()
17242 when calling Debugger::returnEvent().
17243
17244 2008-04-25 Darin Adler <darin@apple.com>
17245
17246 Done with Stephanie Lewis.
17247
17248 * JavaScriptCore.xcodeproj/project.pbxproj: Prepare for compilation with gcc 4.2 by
17249 adding -fno-strict-aliasing to CollatorICU.cpp.
17250
17251 2008-04-24 Sam Weinig <sam@webkit.org>
17252
17253 Reviewed by Geoffrey Garen.
17254
17255 Add a #define to easily enable collecting on every allocation to aid
17256 debugging GC bugs.
17257
17258 * kjs/collector.cpp:
17259 (KJS::Collector::heapAllocate):
17260
17261 2008-04-24 Kevin McCullough <kmccullough@apple.com>
17262
17263 Reviewed by Adam and Sam.
17264
17265 -<rdar://problem/5770054> JavaScript profiler (10928)
17266 -Only profile the page group that starts profiling to avoid profiling
17267 tools that shouldn't be profiled unless explicitly requested to.
17268
17269 * JavaScriptCore.exp: Export new signature.
17270 * kjs/JSGlobalObject.cpp: Add unique identifiers to the JSGlobalObject.
17271 (KJS::JSGlobalObject::init):
17272 * kjs/JSGlobalObject.h: Ditto.
17273 (KJS::JSGlobalObject::setPageGroupIdentifier):
17274 (KJS::JSGlobalObject::pageGroupIdentifier):
17275 * profiler/Profiler.cpp: Check the identifier of the page group of the
17276 lexical global exec state and only profile if it matches the given page
17277 group identifier.
17278 (KJS::Profiler::startProfiling):
17279 (KJS::Profiler::willExecute):
17280 (KJS::Profiler::didExecute):
17281 * profiler/Profiler.h: Ditto.
17282 (KJS::Profiler::Profiler):
17283
17284 2008-04-24 Julien Chaffraix <jchaffraix@webkit.org>
17285
17286 Reviewed by Simon.
17287
17288 Bug 15940: Implement threading API for Qt
17289 https://bugs.webkit.org/show_bug.cgi?id=15940
17290
17291 Original patch by Justin Haygood, tweaked by me.
17292
17293 * JavaScriptCore.pri:
17294 * wtf/ThreadingQt.cpp: Added.
17295 (WTF::threadMapMutex):
17296 (WTF::threadMap):
17297 (WTF::establishIdentifierForThread):
17298 (WTF::clearThreadForIdentifier):
17299 (WTF::threadForIdentifier):
17300 (WTF::initializeThreading):
17301 (WTF::ThreadPrivate::getReturnValue):
17302 (WTF::ThreadPrivate::ThreadPrivate):
17303 (WTF::ThreadPrivate::run):
17304 (WTF::createThread):
17305 (WTF::waitForThreadCompletion): return !res to return
17306 0 on success (to match the pthreads implementation).
17307 (WTF::detachThread):
17308 (WTF::identifierByQthreadHandle):
17309 (WTF::currentThread):
17310 (WTF::Mutex::Mutex):
17311 (WTF::Mutex::~Mutex):
17312 (WTF::Mutex::lock):
17313 (WTF::Mutex::tryLock):
17314 (WTF::Mutex::unlock):
17315 (WTF::ThreadCondition::ThreadCondition):
17316 (WTF::ThreadCondition::~ThreadCondition):
17317 (WTF::ThreadCondition::wait):
17318 (WTF::ThreadCondition::timedWait):
17319 (WTF::ThreadCondition::signal):
17320
17321 2008-04-22 Darin Adler <darin@apple.com>
17322
17323 Reviewed by Anders.
17324
17325 - simplify use of HashTraits to prepare for some upcoming hash table changes
17326
17327 * kjs/SymbolTable.h: Made SymbolTableIndexHashTraits derive from HashTraits<size_t>
17328 and specialize only the empty value.
17329
17330 2008-04-23 Holger Hans Peter Freyther <zecke@selfish.org>
17331
17332 Reviewed by Simon.
17333
17334 Removed the #define for USE_SYSTEM_MALLOC that we set in WebKit.pri
17335 already.
17336
17337 * wtf/Platform.h:
17338
17339 2008-04-21 Kevin McCullough <kmccullough@apple.com>
17340
17341 Reviewed by Adam.
17342
17343 <rdar://problem/5770054> JavaScript profiler (10928)
17344 - When stop profiling is called we need to stop the timers on all the
17345 functions that are still running.
17346
17347 * profiler/FunctionCallProfile.cpp:
17348 (KJS::FunctionCallProfile::didExecute):
17349 (KJS::FunctionCallProfile::stopProfiling):
17350 * profiler/FunctionCallProfile.h:
17351 * profiler/Profiler.cpp:
17352 (KJS::Profiler::stopProfiling):
17353
17354 2008-04-21 Alexey Proskuryakov <ap@webkit.org>
17355
17356 Reviewed by Darin.
17357
17358 Move collector main thread initialization from WebKit/win to KJS::initializeThreading.
17359
17360 * kjs/InitializeThreading.cpp:
17361 (KJS::initializeThreading):
17362
17363 2008-04-21 Adam Roben <aroben@apple.com>
17364
17365 MSVC build fix
17366
17367 Reviewed by Alexey Proskuryakov.
17368
17369 * kjs/ustring.h:
17370 (KJS::UString::cost): Disable a warning about assigning a 32-bit
17371 size_t into a 31-bit size_t.
17372
17373 2008-04-21 Simon Hausmann <hausmann@webkit.org>
17374
17375 Reviewed by Lars.
17376
17377 Made convertValueToQVariant accessible from within WebKit/qt/Api
17378
17379 * bindings/qt/qt_runtime.h:
17380
17381 2008-04-21 Holger Hans Peter Freyther <holger.freyther@trolltech.com>
17382
17383 Reviewed by Simon.
17384
17385 Build fix for Qt 4.3
17386
17387 * When building WebCore/internal make sure the QT_[BEGIN,END]_NAMESPACE is
17388 always defined. Do this by adding defines to the compiler line
17389 * For users of our API this is not feasible. Every public header file should
17390 include qwebkitglobal.h. Define the QT_BEGIN_NAMESPACE and QT_END_NAMESPACE
17391 when we are building everything < 4.4.0 and don't have them defined.
17392
17393 * kjs/testkjs.pro:
17394
17395 2008-04-19 Matt Lilek <webkit@mattlilek.com>
17396
17397 Not reviewed, Windows build fix - copy the profiler headers in all
17398 configurations, not just Debug_Internal.
17399
17400 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
17401
17402 2008-04-19 Mike Hommey <glandium@debian.org>
17403
17404 Reviewed by Alp Toker.
17405
17406 Don't build testkjs with rpath.
17407
17408 * GNUmakefile.am:
17409
17410 2008-04-18 Kevin Ollivier <kevino@theolliviers.com>
17411
17412 wx build fixes. Rename LocalStorage.h to LocalStorageEntry.h
17413 to avoid header detection issues between WebCore/storage/LocalStorage.h
17414 and it, and add $(PROFILER_SOURCES) to the wx JSCore build.
17415
17416 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
17417 * JavaScriptCore.xcodeproj/project.pbxproj:
17418 * jscore.bkl:
17419 * kjs/ExecState.h:
17420 * kjs/JSVariableObject.h:
17421 * kjs/LocalStorage.h: Removed.
17422 * kjs/LocalStorageEntry.h: Copied from JavaScriptCore/kjs/LocalStorage.h.
17423 * kjs/function.h:
17424
17425 2008-04-18 Jan Michael Alonzo <jmalonzo@unpluggable.com>
17426
17427 Reviewed by Alp Toker.
17428
17429 http://bugs.webkit.org/show_bug.cgi?id=16620
17430 [GTK] Autotools make dist and make check support
17431
17432 Cleanups.
17433
17434 * GNUmakefile.am:
17435
17436 2008-04-18 Jon Honeycutt <jhoneycutt@apple.com>
17437
17438 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Windows
17439 build fix.
17440
17441 2008-04-11 Mark Rowe <mrowe@apple.com>
17442
17443 Rubber-stamped by Antti Koivisto.
17444
17445 Silence GCC 4.3 warnings by removing extraneous consts.
17446
17447 * kjs/ustring.cpp:
17448 * kjs/ustring.h:
17449
17450 2008-04-18 Kevin McCullough <kmccullough@apple.com>
17451
17452 Reviewed by Sam.
17453
17454 -<rdar://problem/5770054> JavaScript profiler (10928)
17455 - Use Deque instead of Vector since the profiler uses prepend a lot
17456 and deque is faster at that.
17457
17458 * profiler/FunctionCallProfile.h:
17459 (KJS::FunctionCallProfile::milliSecs): Corrected the name to match
17460 its output.
17461 * wtf/Deque.h:
17462 (WTF::deleteAllValues):
17463
17464 2008-04-18 Kevin McCullough <kmccullough@apple.com>
17465
17466 Reviewed by Sam and Adam.
17467
17468 -<rdar://problem/5770054> JavaScript profiler (10928)
17469 - Cleaned up the header file and made some functions static, added
17470 a new, sane, printing function, and fixed a few minor bugs.
17471
17472 * JavaScriptCore.exp:
17473 * JavaScriptCore.xcodeproj/project.pbxproj:
17474 * profiler/FunctionCallProfile.cpp:
17475 (KJS::FunctionCallProfile::didExecute): Removed assertion that time is
17476 > 0 because at ms resolution that may not be true and only cross-
17477 platform way to get time differences is in ms.
17478 (KJS::FunctionCallProfile::printDataInspectorStyle): Added a new
17479 printing function for dumping data in a sane style.
17480 (KJS::FunctionCallProfile::printDataSampleStyle): Fixed a bug where we
17481 displayed too much precision when printing our floats. Also added logic
17482 to make sure we don't display 0 because that doesn't make sense for a
17483 sampling profile.
17484 * profiler/FunctionCallProfile.h:
17485 * profiler/Profiler.cpp: Moved functions that could be static into the
17486 implementation, and chaned the ASSERTs to early returns. I did this
17487 because console.profile() is a JS function and so was being profiled
17488 but asserting because the profiler had not been started! In the future
17489 I would like to put the ASSERTs back and not profile the calls to
17490 console.profile() and console.profileEnd().
17491 (KJS::Profiler::willExecute):
17492 (KJS::Profiler::didExecute):
17493 (KJS::getStackNames): Fixed a bug where the wrong ExecState was being
17494 used.
17495 (KJS::getFunctionName):
17496 (KJS::Profiler::printDataInspectorStyle):
17497 * profiler/Profiler.h:
17498
17499 2008-04-18 Alexey Proskuryakov <ap@webkit.org>
17500
17501 Reviewed by Darin.
17502
17503 Fix leaks during plugin tests (which actually excercise background JS), and potential
17504 PAC brokenness that was not reported, but very likely.
17505
17506 The leaks shadowed a bigger problem with Identifier destruction. Identifier::remove involves
17507 an IdentifierTable lookup, which is now a per-thread instance. Since garbage collection can
17508 currently happen on a different thread than allocation, a wrong table was used.
17509
17510 No measurable change on SunSpider total, ~1% variation on individual tests.
17511
17512 * kjs/ustring.cpp:
17513 (KJS::UString::Rep::create):
17514 (KJS::UString::Rep::destroy):
17515 * kjs/ustring.h:
17516 Replaced isIdentifier with a pointer to IdentifierTable, so that destruction can be done
17517 correctly. Took one bit from reportedCost, to avoid making UString::Rep larger (performance
17518 effect was measurable on SunSpider).
17519
17520 * kjs/identifier.cpp:
17521 (KJS::IdentifierTable::IdentifierTable):
17522 (KJS::IdentifierTable::~IdentifierTable):
17523 (KJS::IdentifierTable::add):
17524 (KJS::IdentifierTable::remove):
17525 Make IdentifierTable a real class. Its destructor needs to zero out outstanding references,
17526 because some identifiers may briefly outlive it during thread destruction, and we don't want
17527 them to use their stale pointers.
17528
17529 (KJS::LiteralIdentifierTable):
17530 (KJS::Identifier::add):
17531 Now that LiteralIdentifierTable is per-thread and can be destroyed not just during application
17532 shutdown, it is not appropriate to simply bump refcount for strings that get there; changed
17533 the table to hold RefPtrs.
17534
17535 (KJS::CStringTranslator::translate):
17536 (KJS::UCharBufferTranslator::translate):
17537 (KJS::Identifier::addSlowCase):
17538 (KJS::Identifier::remove):
17539 * kjs/identifier.h:
17540 (KJS::Identifier::add):
17541 Use and update UString::Rep::identifierTable as appropriate. Updating it is now done in
17542 IdentifierTable::add, not in translators.
17543
17544 2008-04-18 Alexey Proskuryakov <ap@webkit.org>
17545
17546 Reviewed by Darin.
17547
17548 Get rid of static compareWithCompareFunctionArguments in array_instance.cpp.
17549
17550 No change on SunSpider, CelticKane or iBench JavaScript. It is probable that in some cases,
17551 merge sort is still faster, but more investigation is needed to determine a new cutoff.
17552 Or possibly, it would be better to do what FIXME says (change to tree sort).
17553
17554 Also, made arguments a local variable - not sure why it was a member of
17555 CompareWithCompareFunctionArguments.
17556
17557 * kjs/array_instance.cpp:
17558 (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
17559 (KJS::CompareWithCompareFunctionArguments::operator()):
17560 (KJS::ArrayInstance::sort):
17561
17562 2008-04-18 Simon Hausmann <hausmann@webkit.org>
17563
17564 Build fix for gcc 4.3. Include stdio.h for printf.
17565
17566 * profiler/FunctionCallProfile.cpp:
17567 * profiler/Profiler.cpp:
17568
17569 2008-04-17 Jon Honeycutt <jhoneycutt@apple.com>
17570
17571 Reviewed by mrowe.
17572
17573 * wtf/Platform.h: Add HAVE_ACCESSIBILITY to Platform.h.
17574
17575 2008-04-17 Alexey Proskuryakov <ap@webkit.org>
17576
17577 Reviewed by Maciej.
17578
17579 Thread static data destructors are not guaranteed to be called in any particular order;
17580 turn ThreadSpecific into a phoenix-style singleton to avoid accessing freed memory when
17581 deleted objects are interdependent (e.g. CommonIdentifiers and internal identifier tables).
17582
17583 No change on SunSpider.
17584
17585 * wtf/ThreadSpecific.h:
17586 (WTF::ThreadSpecific::Data::Data):
17587 (WTF::::get):
17588 (WTF::::set):
17589 (WTF::::destroy):
17590
17591 2008-04-15 Srinivas Rao. M Hamse <msrinirao@gmail.com>
17592
17593 Reviewed by Maciej Stachowiak.
17594
17595 - gcc 3.x build fix
17596
17597 * kjs/nodes.h: CallerType definition made public for gcc 3.x compilation
17598
17599 2008-04-16 Brady Eidson <beidson@apple.com>
17600
17601 Reviewed by Sam Weinig
17602
17603 Change ThreadSafeShared to act like RefCounted by starting out with a single ref by default
17604
17605 * wtf/Threading.h:
17606 (WTF::ThreadSafeShared::ThreadSafeShared):
17607
17608 2008-04-16 Sam Weinig <sam@webkit.org>
17609
17610 Reviewed by Geoffrey Garen.
17611
17612 - To keep the behavior of the WebKit and JavaScriptCore API's the same,
17613 we need to hide the fact that the global object and the window object
17614 are no longer the same thing, and the the global object now changes on
17615 navigations. To do this, only the wrapper should ever be exposed. This
17616 fixes the two remaining spots where the internal global object is exposed,
17617 the windowScriptObject returned from [WebFrame windowObject] and the object
17618 return by calling JSContextGetGlobalObject on [WebFrame globalContext].
17619
17620 * API/JSContextRef.cpp:
17621 (JSContextGetGlobalObject):
17622 This is a bit of a hack, this returns the "this" representation of the globalObject
17623 which will be the WrapperWindow for WebCore and the globalObject for non-WebCore.
17624
17625 * API/JSObjectRef.cpp:
17626 (JSObjectSetProperty):
17627 Call the new putWithAttributes method instead of relying on lower-level calls.
17628 This is needed so that the window wrapper can forward the calls.
17629
17630 * JavaScriptCore.exp:
17631 * kjs/Activation.h:
17632 * kjs/JSGlobalObject.cpp:
17633 (KJS::JSGlobalObject::putWithAttributes):
17634 * kjs/JSGlobalObject.h:
17635 * kjs/JSVariableObject.h:
17636 (KJS::JSVariableObject::symbolTablePutWithAttributes):
17637 * kjs/function.cpp:
17638 (KJS::ActivationImp::putWithAttributes):
17639 * kjs/nodes.cpp:
17640 (KJS::ConstDeclNode::handleSlowCase):
17641 (KJS::ConstDeclNode::evaluateSingle):
17642 (KJS::EvalNode::processDeclarations):
17643 * kjs/object.cpp:
17644 (KJS::JSObject::putWithAttributes):
17645 * kjs/object.h:
17646 Rename initializeVariable to putWithAttributes and move it down to JSObject so it
17647 can be used for JSObjectSetProperty.
17648
17649 2008-04-16 Kevin McCullough <kmccullough@apple.com>
17650
17651 Reviewed by Sam and Geoff.
17652
17653 -<rdar://problem/5770054> JavaScript profiler (10928)
17654 Inital profiler prototype
17655
17656 * GNUmakefile.am: Added new files to project
17657 * JavaScriptCore.pri: Ditto
17658 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto
17659 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto
17660 * JavaScriptCoreSources.bkl: Ditto
17661 * kjs/config.h: Put compiling flag in here.
17662 * kjs/function.cpp: Instrument calling the function eval().
17663 (KJS::eval):
17664 * kjs/interpreter.cpp: Instrument evaluating global scopes.
17665 (KJS::Interpreter::evaluate):
17666 * kjs/object.cpp: Instrument JS function calls.
17667 (KJS::JSObject::call):
17668 * profiler: Added.
17669 * profiler/FunctionCallProfile.cpp: Added.
17670 (KJS::FunctionCallProfile::FunctionCallProfile):
17671 (KJS::FunctionCallProfile::~FunctionCallProfile):
17672 (KJS::FunctionCallProfile::willExecute): Call right before the JS function or executing context is executed to start the profiler's timer.
17673 (KJS::FunctionCallProfile::didExecute): Call right after the JS function or executing context is executed to stop the profiler's timer.
17674 (KJS::FunctionCallProfile::addChild): Add a child to the current FunctionCallProfile if it isn't already a child of the current FunctionalCallProfile.
17675 (KJS::FunctionCallProfile::findChild): Return the child that matches the given name if there is one.
17676 (KJS::FunctionCallProfile::printDataSampleStyle): Print the current profiled information in a format that matches sample's output.
17677 * profiler/FunctionCallProfile.h: Added.
17678 (KJS::FunctionCallProfile::FunctionCallProfile):
17679 (KJS::FunctionCallProfile::~FunctionCallProfile):
17680 (KJS::FunctionCallProfile::functionName):
17681 (KJS::FunctionCallProfile::microSecs):
17682 * profiler/Profiler.cpp: Added.
17683 (KJS::Profiler::profiler):
17684 (KJS::Profiler::sharedProfiler): Return global singleton (may change due to multi-threading concerns)
17685 (KJS::Profiler::startProfiling): Don't start collecting profiling information until the user starts the profiler. Also don't clear old prfiled data until the profiler is restarted.
17686 (KJS::Profiler::stopProfiling): Stop collecting profile information.
17687 (KJS::Profiler::willExecute): Same as above.
17688 (KJS::Profiler::didExecute): Same as above.
17689 (KJS::Profiler::insertStackNamesInTree): Follow the stack of the given names and if a sub-stack is not in the current tree, add it.
17690 (KJS::Profiler::getStackNames): Get the names from the different passed in parameters and order them as a stack.
17691 (KJS::Profiler::getFunctionName): Get the function name from the given parameter.
17692 (KJS::Profiler::printDataSampleStyle): Print the current profiled information in a format that matches sample's output.
17693 (KJS::Profiler::debugLog):
17694 * profiler/Profiler.h: Added.
17695 (KJS::Profiler::Profiler):
17696
17697 2008-04-16 Sam Weinig <sam@webkit.org>
17698
17699 Reviewed by Darin Adler.
17700
17701 - Remove kjs_ prefix from strtod, dtoa, and freedtoa and put it
17702 in the KJS namespace.
17703 - Make strtod, dtoa, and freedtoa c++ functions instead of extern "C".
17704 - Remove mode switching from dtoa. ~2% improvement on test 26.
17705 - Removes all unnecessary #defines from dtoa code.
17706
17707 * JavaScriptCore.exp:
17708 * kjs/dtoa.cpp:
17709 (KJS::ulp):
17710 (KJS::b2d):
17711 (KJS::d2b):
17712 (KJS::ratio):
17713 (KJS::strtod):
17714 (KJS::freedtoa):
17715 (KJS::dtoa):
17716 * kjs/dtoa.h:
17717 * kjs/function.cpp:
17718 (KJS::parseInt):
17719 * kjs/lexer.cpp:
17720 (KJS::Lexer::lex):
17721 * kjs/number_object.cpp:
17722 (KJS::integer_part_noexp):
17723 (KJS::numberProtoFuncToExponential):
17724 * kjs/ustring.cpp:
17725 (KJS::UString::from):
17726 (KJS::UString::toDouble):
17727
17728 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
17729
17730 Reviewed by Darin.
17731
17732 Get rid of static execForCompareByStringForQSort in array_instance.cpp.
17733
17734 No change on SunSpider, CelticKane or iBench JavaScript.
17735
17736 * kjs/array_instance.cpp:
17737 (KJS::ArraySortComparator::ArraySortComparator):
17738 (KJS::ArraySortComparator::operator()):
17739 (KJS::ArrayInstance::sort):
17740 Switch slow case to std::sort, so that ExecState can be passed in a comparator.
17741
17742 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
17743
17744 Reviewed by Adam Roben.
17745
17746 MSVC build fix.
17747
17748 * kjs/CommonIdentifiers.cpp:
17749 * kjs/CommonIdentifiers.h:
17750 * kjs/Parser.cpp:
17751 * kjs/Parser.h:
17752 * kjs/identifier.cpp:
17753 * kjs/lexer.h:
17754 * wtf/ThreadSpecific.h:
17755
17756 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
17757
17758 Build fix.
17759
17760 * kjs/date_object.cpp:
17761 * kjs/date_object.h:
17762 Don't include DateMath.h from date_object.h, as the latter is used from WebCore, while
17763 where the former is not available.
17764
17765 2008-04-16 Holger Hans Peter Freyther <zecke@selfish.org>
17766
17767 Unreviewed build fix for MSVC. It does not want to have
17768 WTF in the KJS namespace.
17769
17770 * kjs/CommonIdentifiers.h:
17771
17772 2008-04-16 Holger Hans Peter Freyther <zecke@selfish.org>
17773
17774 Unreviewed build fix for gcc.
17775
17776 ::msToGregorianDateTime is not known to it.
17777
17778 * kjs/date_object.cpp:
17779 (KJS::DateInstance::msToGregorianDateTime):
17780
17781 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
17782
17783 Reviewed by Oliver Hunt.
17784
17785 Initialize threadMapMutex safely (as already done in ThreadingWin).
17786
17787 * wtf/ThreadingGtk.cpp:
17788 (WTF::threadMapMutex):
17789 (WTF::initializeThreading):
17790 * wtf/ThreadingPthreads.cpp:
17791 (WTF::threadMapMutex):
17792 (WTF::initializeThreading):
17793
17794 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
17795
17796 Reviewed by Adam Roben.
17797
17798 Cache Gregorian date/time structure on DateInstance objects for 1.027x SunSpider speedup
17799 (1.65x on date-format-xparb, 1.13x on date-format-tofte).
17800
17801 * kjs/DateMath.h:
17802 (KJS::GregorianDateTime::copyFrom): Added. It presumably makes sense to keep GregorianDateTime
17803 Noncopyable, so it's not just operator=.
17804
17805 * kjs/date_object.h: Added a per-object cache.
17806
17807 * kjs/date_object.cpp:
17808 (KJS::DateInstance::DateInstance):
17809 (KJS::DateInstance::msToGregorianDateTime):
17810 (KJS::dateProtoFuncToString):
17811 (KJS::dateProtoFuncToUTCString):
17812 (KJS::dateProtoFuncToDateString):
17813 (KJS::dateProtoFuncToTimeString):
17814 (KJS::dateProtoFuncToLocaleString):
17815 (KJS::dateProtoFuncToLocaleDateString):
17816 (KJS::dateProtoFuncToLocaleTimeString):
17817 (KJS::dateProtoFuncGetFullYear):
17818 (KJS::dateProtoFuncGetUTCFullYear):
17819 (KJS::dateProtoFuncToGMTString):
17820 (KJS::dateProtoFuncGetMonth):
17821 (KJS::dateProtoFuncGetUTCMonth):
17822 (KJS::dateProtoFuncGetDate):
17823 (KJS::dateProtoFuncGetUTCDate):
17824 (KJS::dateProtoFuncGetDay):
17825 (KJS::dateProtoFuncGetUTCDay):
17826 (KJS::dateProtoFuncGetHours):
17827 (KJS::dateProtoFuncGetUTCHours):
17828 (KJS::dateProtoFuncGetMinutes):
17829 (KJS::dateProtoFuncGetUTCMinutes):
17830 (KJS::dateProtoFuncGetSeconds):
17831 (KJS::dateProtoFuncGetUTCSeconds):
17832 (KJS::dateProtoFuncGetTimezoneOffset):
17833 (KJS::setNewValueFromTimeArgs):
17834 (KJS::setNewValueFromDateArgs):
17835 (KJS::dateProtoFuncSetYear):
17836 (KJS::dateProtoFuncGetYear):
17837 Use the cache when converting.
17838
17839 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
17840
17841 Reviewed by Darin.
17842
17843 Implement an abstraction for thread-specific storage, use it to get rid of some static objects.
17844
17845 SunSpider results were not conclusive, possibly up to 0.2% slowdown.
17846
17847 * JavaScriptCore.xcodeproj/project.pbxproj:
17848 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
17849 Added ThreadSpecific.h
17850
17851 * wtf/ThreadSpecific.h: Added.
17852 (WTF::::ThreadSpecific):
17853 (WTF::::~ThreadSpecific):
17854 (WTF::::get):
17855 (WTF::::set):
17856 (WTF::::destroy):
17857 (WTF::T):
17858 (WTF::::operator):
17859 Only implemented for platforms that use pthreads.
17860
17861 * kjs/CommonIdentifiers.cpp:
17862 (KJS::CommonIdentifiers::shared):
17863 * kjs/CommonIdentifiers.h:
17864 * kjs/InitializeThreading.cpp:
17865 (KJS::initializeThreading):
17866 * kjs/Parser.cpp:
17867 (KJS::parser):
17868 * kjs/Parser.h:
17869 * kjs/identifier.cpp:
17870 (KJS::identifierTable):
17871 (KJS::literalIdentifierTable):
17872 (KJS::Identifier::initializeIdentifierThreading):
17873 * kjs/identifier.h:
17874 * kjs/lexer.cpp:
17875 (KJS::lexer):
17876 * kjs/lexer.h:
17877 Make static instances per-thread.
17878
17879 2008-04-15 Anders Carlsson <andersca@apple.com>
17880
17881 Reviewed by Adam.
17882
17883 Add ENABLE_OFFLINE_WEB_APPLICATIONS to FEATURE_DEFINES.
17884
17885 * Configurations/JavaScriptCore.xcconfig:
17886
17887 2008-04-15 Andre Poenitz <andre.poenitz@trolltech.com>
17888
17889 Reviewed by Simon.
17890
17891 Fix compilation with Qt namespaces
17892
17893 Qt can be configured to have all of its classes inside a specified namespaces.
17894 This is for example used in plugin/component environments like Eclipse.
17895
17896 This change makes it possible to let the Qt port compile against a namespaced
17897 Qt by the use of macros Qt provides to properly forward declare Qt classes in
17898 the namespace.
17899
17900 * wtf/unicode/qt4/UnicodeQt4.h:
17901
17902 2008-04-14 Anders Carlsson <andersca@apple.com>
17903
17904 Reviewed by Adam.
17905
17906 Don't leak the prototype class.
17907
17908 * API/JSClassRef.cpp:
17909 (OpaqueJSClass::create):
17910
17911 2008-04-14 Steve Falkenburg <sfalken@apple.com>
17912
17913 Fix build.
17914
17915 * wtf/ThreadingWin.cpp:
17916
17917 2008-04-14 Alexey Proskuryakov <ap@webkit.org>
17918
17919 Reviewed by Adam Roben.
17920
17921 https://bugs.webkit.org/show_bug.cgi?id=18488
17922 FastMalloc doesn't release thread-specific data on Windows
17923
17924 * wtf/ThreadingWin.cpp:
17925 (WTF::threadMapMutex): (WTF::initializeThreading): Call threadMapMutex once to initialize the static safely.
17926 (WTF::ThreadFunctionInvocation::ThreadFunctionInvocation): Added a structure to wrap thread entry point and arguments.
17927 (WTF::wtfThreadEntryPoint): Make sure to end all WTF threads with pthread_exit(), to give pthreads-win32 a chance to call
17928 destructors of thread-specific data.
17929 (WTF::createThread): Use _beginthreadex instead of CreateThread, because MSDN says so. Also removed a call to CreateEvent,
17930 for which I could see no reason at all.
17931
17932 2008-04-14 Alexey Proskuryakov <ap@webkit.org>
17933
17934 Touched a file to make JavaScriptCore.vcproj rebuild.
17935
17936 * wtf/MathExtras.h:
17937
17938 2008-04-14 Adam Roben <aroben@apple.com>
17939
17940 Windows build fix
17941
17942 Rubberstamped by Alexey Proskuryakov.
17943
17944 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
17945 the "potentially uninitialized variable" warning for grammar.cpp, as
17946 it seems to be incorrect. yylval gets initialized by the lexer, but
17947 MSVC doesn't seem to understand this.
17948
17949 2008-04-11 Antti Koivisto <antti@apple.com>
17950
17951 Reviewed by Maciej.
17952
17953 Add default hash for pairs of hashable types.
17954
17955 * wtf/HashFunctions.h:
17956 (WTF::PairHash::hash):
17957 (WTF::PairHash::equal):
17958 (WTF::):
17959
17960 2008-04-11 Alexey Proskuryakov <ap@webkit.org>
17961
17962 Reviewed by Geoff.
17963
17964 Make DateMath.cpp thread safe.
17965
17966 No measurable change on SunSpider (should be a very small speedup).
17967
17968 * kjs/DateMath.cpp:
17969 (KJS::mimimumYearForDST): (KJS::equivalentYearForDST): Got rid of double caching of the
17970 same precomputed value.
17971 (KJS::calculateUTCOffset): (KJS::getUTCOffset): Factored actual UTC offset calculation code
17972 out of getUTCOffset(), and notification setup into initDateMath().
17973
17974 (KJS::initDateMath): Added.
17975
17976 * kjs/DateMath.h:
17977 * kjs/InitializeThreading.cpp:
17978 (KJS::initializeThreading):
17979 Added initDateMath().
17980
17981 2008-04-11 Alexey Proskuryakov <ap@webkit.org>
17982
17983 Windows build fix.
17984
17985 * kjs/grammar.y:
17986
17987 2008-04-11 Alexey Proskuryakov <ap@webkit.org>
17988
17989 Tiger build fix. Forward declaring a union didn't work for whatever reason, make the
17990 parameters void*.
17991
17992 * kjs/grammar.y:
17993 * kjs/lexer.cpp:
17994 (kjsyylex):
17995 (KJS::Lexer::lex):
17996 * kjs/lexer.h:
17997
17998 2008-04-11 Alexey Proskuryakov <ap@webkit.org>
17999
18000 Reviewed by Geoff.
18001
18002 Generate a pure (re-entrant) parser with Bison.
18003
18004 No change on SunSpider.
18005
18006 * kjs/Parser.cpp:
18007 (KJS::Parser::parse):
18008 * kjs/grammar.y:
18009 * kjs/lexer.cpp:
18010 (kjsyylex):
18011 (KJS::Lexer::lex):
18012 * kjs/lexer.h:
18013 Pass state as function arguments, instead of global data. Don't call lexer() as often as
18014 before, as this function is about to become slower due to thread-specific storage.
18015
18016 * kjs/function.cpp:
18017 (KJS::isStrWhiteSpace): Don't call isSeparatorSpace() for 8-bit characters, as these are
18018 already taken care of. This is a small speedup, compensating for a small slowdown caused
18019 by switching Bison mode.
18020
18021 2008-04-10 Alexey Proskuryakov <ap@webkit.org>
18022
18023 Reviewed by Geoff.
18024
18025 https://bugs.webkit.org/show_bug.cgi?id=18402
18026 REGRESSION: visited element handling is incorrect in nested join/toString calls
18027
18028 No change on SunSpider total, possibly a tiny improvement (about 0.1%).
18029
18030 Test: fast/js/array-tostring-and-join.html
18031
18032 * kjs/JSGlobalObject.h:
18033 (KJS::JSGlobalObject::visitedElements): Store visited elements HashSet here, making it
18034 common to toString/toLocalizedString/join again.
18035
18036 * kjs/array_object.cpp:
18037 (KJS::arrayProtoFuncToString):
18038 (KJS::arrayProtoFuncToLocaleString):
18039 (KJS::arrayProtoFuncJoin):
18040 Got rid of static variables. Replaced UString with Vector to avoid O(n^2) behavior and
18041 regain performance.
18042
18043 * wtf/Vector.h:
18044 (WTF::::resize):
18045 (WTF::::grow):
18046 (WTF::::reserveCapacity):
18047 (WTF::::append):
18048 (WTF::::insert):
18049 Added null checks, so that Vector methods don't crash when out of memory. The caller should
18050 check that data pointer is not null before proceeding.
18051
18052 2008-04-10 Mark Rowe <mrowe@apple.com>
18053
18054 Reviewed by Maciej Stachowiak.
18055
18056 Fix https://bugs.webkit.org/show_bug.cgi?id=18367 and the many dupes.
18057 Bug 18367: Crash during celtic kane js speed 2007 test
18058
18059 GCC 4.2 on x86_64 Linux decided to reorder the local variables in markCurrentThreadConservatively's
18060 stack frame. This lead to the range of addresses the collector treated as stack to exclude the
18061 contents of volatile registers that markCurrentThreadConservatively forces onto the stack. This was
18062 leading to objects being prematurely collected if the only reference to them was via a register at
18063 the time a collection occurred.
18064
18065 The fix for this is to move the calculation of the top of the stack into a NEVER_INLINE function
18066 that is called from markCurrentThreadConservatively. This forces the dummy variable we use for
18067 determining the top of stack to be in a different stack frame which prevents the compiler from
18068 reordering it relative to the registers that markCurrentThreadConservatively forces onto the stack.
18069
18070 * kjs/collector.cpp:
18071 (KJS::Collector::markCurrentThreadConservativelyInternal):
18072 (KJS::Collector::markCurrentThreadConservatively):
18073 * kjs/collector.h:
18074
18075 2008-04-10 Adam Roben <aroben@apple.com>
18076
18077 VC++ Express build fix
18078
18079 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Link against user32.lib so
18080 that anyone who links against WTF.lib will get user32.lib
18081 automatically.
18082
18083 2008-04-09 Adam Roben <aroben@apple.com>
18084
18085 VC++ Express build fix
18086
18087 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Link against
18088 user32.lib.
18089
18090 2008-04-09 Adam Roben <aroben@apple.com>
18091
18092 Build fix
18093
18094 * JavaScriptCore.exp: Export isMainThread.
18095
18096 2008-04-09 Adam Roben <aroben@apple.com>
18097
18098 Build fix
18099
18100 * wtf/AlwaysInline.h: Make sure to #include Platform.h before using
18101 the macros it defines.
18102
18103 2008-04-08 Mark Rowe <mrowe@apple.com>
18104
18105 Export WTF::initializeThreading() from JavaScriptCore.
18106
18107 * JavaScriptCore.exp:
18108
18109 2008-04-04 Sam Weinig <sam@webkit.org>
18110
18111 Reviewed by Geoffrey Garen.
18112
18113 First step in implementing the "split window"
18114
18115 - Add a GlobalThisValue to ExecState which should be used
18116 in places that used to implement the "use the global object
18117 as this if null" rule.
18118 - Factor out lookupGetter/lookupSetter into virtual methods
18119 on JSObject so that they can be forwarded.
18120 - Make defineGetter/defineSetter virtual methods for the same
18121 reason.
18122 - Have PrototypeReflexiveFunction store the globalObject used
18123 to create it so that it can be used to get the correct thisObject
18124 for eval.
18125
18126 * API/JSObjectRef.cpp:
18127 (JSObjectCallAsFunction):
18128 * JavaScriptCore.exp:
18129 * kjs/Activation.h:
18130 * kjs/ExecState.cpp:
18131 (KJS::ExecState::ExecState):
18132 (KJS::GlobalExecState::GlobalExecState):
18133 * kjs/ExecState.h:
18134 (KJS::ExecState::globalThisValue):
18135 * kjs/ExecStateInlines.h:
18136 (KJS::ExecState::ExecState):
18137 (KJS::FunctionExecState::FunctionExecState):
18138 * kjs/JSGlobalObject.cpp:
18139 (KJS::JSGlobalObject::reset):
18140 (KJS::JSGlobalObject::toGlobalObject):
18141 * kjs/JSGlobalObject.h:
18142 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
18143 (KJS::JSGlobalObject::JSGlobalObject):
18144 * kjs/array_instance.cpp:
18145 (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
18146 (KJS::compareWithCompareFunctionForQSort):
18147 * kjs/array_object.cpp:
18148 (KJS::arrayProtoFuncSort):
18149 (KJS::arrayProtoFuncFilter):
18150 (KJS::arrayProtoFuncMap):
18151 (KJS::arrayProtoFuncEvery):
18152 (KJS::arrayProtoFuncForEach):
18153 (KJS::arrayProtoFuncSome):
18154 * kjs/function.cpp:
18155 (KJS::FunctionImp::callAsFunction):
18156 (KJS::ActivationImp::toThisObject):
18157 (KJS::globalFuncEval):
18158 (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
18159 (KJS::PrototypeReflexiveFunction::mark):
18160 * kjs/function.h:
18161 (KJS::PrototypeReflexiveFunction::cachedGlobalObject):
18162 * kjs/function_object.cpp:
18163 (KJS::functionProtoFuncApply):
18164 (KJS::functionProtoFuncCall):
18165 * kjs/nodes.cpp:
18166 (KJS::ExpressionNode::resolveAndCall):
18167 (KJS::FunctionCallValueNode::evaluate):
18168 (KJS::LocalVarFunctionCallNode::inlineEvaluate):
18169 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
18170 (KJS::FunctionCallBracketNode::evaluate):
18171 (KJS::FunctionCallDotNode::inlineEvaluate):
18172 * kjs/object.cpp:
18173 (KJS::JSObject::call):
18174 (KJS::JSObject::put):
18175 (KJS::tryGetAndCallProperty):
18176 (KJS::JSObject::lookupGetter):
18177 (KJS::JSObject::lookupSetter):
18178 (KJS::JSObject::toThisObject):
18179 (KJS::JSObject::toGlobalObject):
18180 (KJS::JSObject::fillGetterPropertySlot):
18181 * kjs/object.h:
18182 * kjs/object_object.cpp:
18183 (KJS::objectProtoFuncLookupGetter):
18184 (KJS::objectProtoFuncLookupSetter):
18185 * kjs/string_object.cpp:
18186 (KJS::replace):
18187
18188 2008-04-08 Brady Eidson <beidson@apple.com>
18189
18190 Encourage Windows to rebuild - AGAIN...
18191
18192 * kjs/DateMath.cpp:
18193
18194 2008-04-08 Adam Roben <aroben@apple.com>
18195
18196 Mac build fix
18197
18198 * JavaScriptCore.exp: Add callOnMainThread, and sorted the list.
18199
18200 2008-04-08 Brady Eidson <beidson@apple.com>
18201
18202 Rubberstamped by Adam Roben
18203
18204 Touch some files to *strongly* encourage Windows to rebuilt with DOM_STORAGE enabled
18205
18206 * kjs/DateMath.cpp:
18207
18208 2008-04-08 Adam Roben <aroben@apple.com>
18209
18210 Move callOnMainThread to WTF
18211
18212 Reviewed by Alexey Proskuryakov.
18213
18214 * GNUmakefile.am:
18215 * JavaScriptCore.pri:
18216 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
18217 * JavaScriptCore.xcodeproj/project.pbxproj:
18218 * JavaScriptCoreSources.bkl:
18219 Added new files.
18220
18221 * wtf/MainThread.cpp:
18222 * wtf/MainThread.h:
18223 * wtf/gtk/MainThreadGtk.cpp:
18224 * wtf/mac/MainThreadMac.mm:
18225 * wtf/qt/MainThreadQt.cpp:
18226 * wtf/win/MainThreadWin.cpp:
18227 * wtf/wx/MainThreadWx.cpp:
18228 Moved here from WebCore/platform. Replaced all instances of "WebCore"
18229 with "WTF".
18230
18231 * kjs/bool_object.cpp: Touched to force JavaScriptCore.vcproj to
18232 build.
18233 to the WTF namespace.
18234 * wtf/ThreadingWin.cpp:
18235 (WTF::initializeThreading): Call initializeMainThread.
18236
18237 2008-04-07 Brady Eidson <beidson@apple.com>
18238
18239 Add "ENABLE_DOM_STORAGE" to keep in sync with the rest of the project
18240
18241 * Configurations/JavaScriptCore.xcconfig:
18242
18243 2008-04-07 Adam Roben <aroben@apple.com>
18244
18245 Windows build fix
18246
18247 * wtf/ThreadingWin.cpp: Back out some changes I didn't mean to land.
18248
18249 2008-04-07 Adam Roben <aroben@apple.com>
18250
18251 Add WTF::isMainThread
18252
18253 Reviewed by Alexey Proskuryakov.
18254
18255 * wtf/Threading.h: Declare the new function.
18256 * wtf/ThreadingGtk.cpp:
18257 (WTF::initializeThreading): Initialize the main thread identifier.
18258 (WTF::isMainThread): Added.
18259 * wtf/ThreadingNone.cpp: Ditto ThreadingGtk.cpp.
18260 (WTF::initializeThreading):
18261 (WTF::isMainThread):
18262 * wtf/ThreadingPthreads.cpp: Ditto.
18263 (WTF::initializeThreading):
18264 (WTF::isMainThread):
18265 * wtf/ThreadingWin.cpp: Ditto.
18266 (WTF::initializeThreading):
18267 (WTF::isMainThread):
18268
18269 2008-04-06 Alexey Proskuryakov <ap@webkit.org>
18270
18271 Reviewed by Darin.
18272
18273 Make UString thread-safe.
18274
18275 No change on SunSpider total, although individual tests have changed a lot, up to 3%.
18276
18277 * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Call UString::null() to initialize
18278 a static.
18279
18280 * kjs/identifier.cpp:
18281 (KJS::CStringTranslator::translate):
18282 (KJS::UCharBufferTranslator::translate):
18283 Use "true" for a boolean value instead of 1, because it's C++.
18284
18285 * kjs/ustring.h:
18286 (KJS::CString::adopt): Added a method to create from a char* buffer without copying.
18287 (KJS::UString::Rep::ref): Removed an assertion for JSLock::lockCount, as it's no longer
18288 necessary to hold JSLock when working with strings.
18289 (KJS::UString::Rep::deref): Ditto.
18290 (KJS::UString::Rep::isStatic): Added a field to quickly determine that this is an empty
18291 or null static string.
18292
18293 * kjs/ustring.cpp:
18294 (KJS::): Removed normalStatBufferSize and statBufferSize, as there is no reason to have such
18295 an advanced implementation of a debug-only ascii() method. Removed a long-obsolete comment
18296 about UChar.
18297 (KJS::UString::Rep::createCopying): Removed an assertion for JSLock::lockCount.
18298 (KJS::UString::Rep::create): Ditto.
18299 (KJS::UString::Rep::destroy): Ditto. Do not do anything for static null and empty strings,
18300 as refcounting is not reliable for those. Reordered branches for a noticeable speed gain -
18301 apparently this functiton is hot enough for SunSpider to see an effect from this!
18302 (KJS::UString::null): Moved a star, added a comment.
18303 (KJS::UString::cstring): Reimplemented to not call ascii(), which is not thread-safe.
18304 (KJS::UString::ascii): Simplified statBuffer handling logic.
18305 (KJS::UString::toDouble): Use cstring() instead of ascii().
18306
18307 2008-04-02 Mark Rowe <mrowe@apple.com>
18308
18309 Reviewed by Oliver Hunt.
18310
18311 Ensure that debug symbols are generated for x86_64 and ppc64 builds.
18312
18313 * Configurations/Base.xcconfig:
18314
18315 2008-04-01 Christian Dywan <christian@imendio.com>
18316
18317 Build fix for GCC 4.3.
18318
18319 * wtf/unicode/icu/CollatorICU.cpp: include string.h
18320
18321 2008-04-01 Alexey Proskuryakov <ap@webkit.org>
18322
18323 Rubber-stamped by Darin.
18324
18325 Turn off using 64-bit arithmetic on 32-bit hardware, as dtoa own code is faster than
18326 compiler-provided emulation.
18327
18328 1% speedup on Acid3 test 26.
18329
18330 * kjs/dtoa.cpp:
18331
18332 2008-04-01 Alexey Proskuryakov <ap@webkit.org>
18333
18334 Reviewed by Darin.
18335
18336 Make MathExtras.h thread safe.
18337
18338 * kjs/math_object.cpp:
18339 (KJS::mathProtoFuncRandom): If threading is enabled, rely on initializeThreading to call
18340 wtf_random_init().
18341
18342 * wtf/Threading.h:
18343 * wtf/ThreadingGtk.cpp:
18344 (WTF::initializeThreading):
18345 * wtf/ThreadingNone.cpp:
18346 (WTF::initializeThreading):
18347 * wtf/ThreadingPthreads.cpp:
18348 (WTF::initializeThreading):
18349 * wtf/ThreadingWin.cpp:
18350 (WTF::initializeThreading):
18351 Call wtf_random_init(); made the function non-inline to avoid having to include too many
18352 headers in Threading.h.
18353
18354 2008-03-31 Eric Seidel <eric@webkit.org>
18355
18356 Reviewed by darin.
18357
18358 Make matching of regexps using ^ much faster
18359 http://bugs.webkit.org/show_bug.cgi?id=18086
18360
18361 * pcre/pcre_compile.cpp:
18362 (compileBranch):
18363 (branchNeedsLineStart):
18364 * pcre/pcre_exec.cpp:
18365 (match):
18366 (jsRegExpExecute):
18367 * pcre/pcre_internal.h:
18368
18369 2008-03-29 Alexey Proskuryakov <ap@webkit.org>
18370
18371 Reviewed by Oliver Hunt.
18372
18373 <rdar://problem/5829556> REGRESSION: Leak in KJS::initializeThreading()
18374
18375 * kjs/InitializeThreading.cpp: (KJS::initializeThreading): There is no guarantee that
18376 initializeThreading() is called only once; check that the mutex hasn't been already allocated.
18377
18378 2008-03-29 Oliver Hunt <oliver@apple.com>
18379
18380 Reviewed by Geoff.
18381
18382 Bug 17924: Crash in KJS::ConstDeclNode::evaluate with |with| and |const|
18383 <http://bugs.webkit.org/show_bug.cgi?id=17924>
18384 <rdar://problem/5806933>
18385
18386 It turns out this is trivially avoidable if we just match firefox's
18387 semantics and ensure that an assignment in a const declaration always
18388 writes to the variable object.
18389
18390 * kjs/nodes.cpp:
18391 (KJS::ConstDeclNode::handleSlowCase):
18392
18393 2008-03-28 Alexey Proskuryakov <ap@webkit.org>
18394
18395 Reviewed by Sam Weinig.
18396
18397 Fix a dtoa thread safety issue.
18398
18399 WebCore can call kjs_strtod without holding JS lock, but we didn't have thread safety
18400 compiled in for dtoa.
18401
18402 This is a 0.5% regression on SunSpider, which Sam Weinig has volunteered to cover with
18403 his recent improvement.
18404
18405 * kjs/dtoa.cpp:
18406 (Bigint::Balloc):
18407 (Bigint::Bfree):
18408 Changed to use fastMalloc/fastDelete - they are much faster than the dtoa custom version was
18409 in the presence of locking (but somewhat slower in single-threaded case).
18410 (Bigint::pow5mult): Got rid of the dreaded double-checked locking anti-pattern (had to
18411 restructure the code to avoid significant performance implications).
18412 (Bigint::lshift): Rewrote to avoid an allocation, if possible.
18413
18414 (Bigint::rv_alloc):
18415 (Bigint::kjs_freedtoa):
18416 (Bigint::kjs_dtoa):
18417 Check for USE(MULTIPLE_THREADS), not dtoa legacy MULTIPLE_THREADS.
18418
18419 * kjs/InitializeThreading.cpp: Added.
18420 (KJS::initializeThreading):
18421 * kjs/InitializeThreading.h: Added.
18422 Initialize threading at KJS level, if enabled.
18423
18424 * kjs/dtoa.h: Expose dtoa mutex for KJS::initializeThreading.
18425
18426 * kjs/testkjs.cpp: (kjsmain): Call initializeThreading.
18427
18428 * JavaScriptCore.exp: Export KJS::initializeThreading.
18429
18430 * GNUmakefile.am:
18431 * JavaScriptCore.exp:
18432 * JavaScriptCore.pri:
18433 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
18434 * JavaScriptCoreSources.bkl:
18435 * JavaScriptCore.xcodeproj/project.pbxproj:
18436 Added InitializeThreading.{h,cpp}.
18437
18438 * wtf/Threading.h: Removed a using directive for WTF::initializeThreading - it is only
18439 to be called from KJS::initializeThreading, and having it in the global namespace is useless.
18440
18441 2008-03-28 Brady Eidson <beidson@apple.com>
18442
18443 Reviewed by Darin
18444
18445 Export Unicode/UTF8.h and convertUTF16ToUTF8() for more flexible conversion in WebCore
18446
18447 * JavaScriptCore.exp:
18448 * JavaScriptCore.xcodeproj/project.pbxproj:
18449
18450 2008-03-27 Darin Adler <darin@apple.com>
18451
18452 Reviewed by Mark Rowe.
18453
18454 <rdar://problem/5826236> Regular expressions with large nested repetition counts can have their
18455 compiled length calculated incorrectly.
18456
18457 * pcre/pcre_compile.cpp:
18458 (multiplyWithOverflowCheck):
18459 (calculateCompiledPatternLength): Check for overflow when dealing with nested repetition counts
18460 and bail with an error rather than returning incorrect results.
18461
18462 2008-03-26 Mark Rowe <mrowe@apple.com>
18463
18464 Rubber-stamped by Brady Eidson.
18465
18466 Update FEATURE_DEFINES to be consistent with the other locations in which it is defined.
18467
18468 * Configurations/JavaScriptCore.xcconfig:
18469
18470 2008-03-26 Adam Roben <aroben@apple.com>
18471
18472 Fix Bug 18060: Assertion failure (JSLock not held) beneath
18473 JSCallbackObject<Base>::toString
18474
18475 <http://bugs.webkit.org/show_bug.cgi?id=18060>
18476
18477 Reviewed by Geoff Garen.
18478
18479 Bug fix:
18480
18481 * API/JSCallbackObjectFunctions.h:
18482 (KJS::JSCallbackObject<Base>::toString): Make the DropAllLocks
18483 instance only be in scope while calling convertToType.
18484
18485 Test:
18486
18487 * API/testapi.c:
18488 (MyObject_convertToType): Implement type conversion to string.
18489 * API/testapi.js: Add a test for type conversion to string.
18490
18491 2008-03-26 Adam Roben <aroben@apple.com>
18492
18493 Windows build fix
18494
18495 * kjs/array_instance.cpp: Touched this.
18496 * wtf/HashFunctions.h:
18497 (WTF::intHash): Added 8- and 16-bit versions of intHash.
18498
18499 2008-03-26 Adam Roben <aroben@apple.com>
18500
18501 Force JSC headers to be copied by touching a file
18502
18503 * kjs/array_instance.cpp:
18504 (KJS::ArrayInstance::getPropertyNames):
18505
18506 2008-03-26 Adam Roben <aroben@apple.com>
18507
18508 Windows build fix after r31324
18509
18510 Written with Darin.
18511
18512 Added HashTable plumbing to support using wchar_t as a key type.
18513
18514 * wtf/HashFunctions.h:
18515 * wtf/HashTraits.h:
18516 (WTF::):
18517
18518 2008-03-26 Maciej Stachowiak <mjs@apple.com>
18519
18520 Reviewed by Darin.
18521
18522 - JSC part of fix for "SVG multichar glyph matching matches longest instead of first (affects Acid3 test 79)"
18523 http://bugs.webkit.org/show_bug.cgi?id=18118
18524
18525 * wtf/HashFunctions.h:
18526 (WTF::):
18527 * wtf/HashTraits.h:
18528 (WTF::):
18529
18530 2008-03-26 Alexey Proskuryakov <ap@webkit.org>
18531
18532 Reviewed by Darin.
18533
18534 Cache C string identifiers by address, not value, assuming that C strings can only
18535 be literals.
18536
18537 1% speedup on Acid3 test 26.
18538
18539 * kjs/identifier.cpp:
18540 (KJS::literalIdentifierTable):
18541 (KJS::Identifier::add):
18542 Added a new table to cache UString::Reps created from C strings by address. Elements are
18543 never removed from this cache, as only predefined identifiers can get there.
18544
18545 * kjs/identifier.h:
18546 (KJS::Identifier::Identifier): Added a warning.
18547
18548 2008-03-26 Alexey Proskuryakov <ap@webkit.org>
18549
18550 Rubber-stamped by Maciej.
18551
18552 An assertion was failing in function-toString-object-literals.html when parsing 1e-500.
18553 The condition existed before, and got uncovered by turning compiled-out dtoa checks into
18554 ASSERTs.
18555
18556 The assertion was verifying that the caller wasn't constructing a Bigint from 0.
18557 This might have had some reason behind it originally, but I couldn't find any,
18558 and this doesn't look like a reasonable requirement.
18559
18560 * kjs/dtoa.cpp: (d2b): Removed the assertion (two copies in different code paths).
18561
18562 2008-03-25 Adam Roben <aroben@apple.com>
18563
18564 Fix Bug 18077: Integrate testapi.c into the Windows build
18565
18566 <http://bugs.webkit.org/show_bug.cgi?id=18077>
18567
18568 Reviewed by Steve Falkenburg.
18569
18570 * JavaScriptCore.vcproj/testapi/testapi.vcproj: Added.
18571
18572 2008-03-25 Adam Roben <aroben@apple.com>
18573
18574 Make testapi.c compile under MSVC
18575
18576 Currently you must compile testapi.c as C++ code since MSVC does not
18577 support many C features that GCC does.
18578
18579 Reviewed by Steve Falkenburg.
18580
18581 * API/testapi.c:
18582 (nan): Added an implementation of this for MSVC.
18583 (assertEqualsAsUTF8String): Use malloc instead of dynamically-sized
18584 stack arrays.
18585 (assertEqualsAsCharactersPtr): Ditto.
18586 (print_callAsFunction): Ditto.
18587 (main): Ditto, and explicitly cast from UniChar* to JSChar*.
18588
18589 2008-03-25 Adam Roben <aroben@apple.com>
18590
18591 Stop using JavaScriptCore's custom stdbool.h and stdint.h on Windows
18592
18593 We can't remove the os-win32 directory yet because other ports (at
18594 least wx) are still relying on it.
18595
18596 Reviewed by Steve Falkenburg.
18597
18598 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
18599 - Made all the include paths match the one for the Debug
18600 configuration (these got out of sync in r30797)
18601 - Removed os-win32 from the include path
18602 - Removed os-win32 from the directories we copy to $WebKitOutputDir.
18603 - Removed stdint.h from the project
18604 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
18605 Delete the files that we may have previously copied from the os-win32
18606 directory.
18607
18608 2008-03-25 Alexey Proskuryakov <ap@webkit.org>
18609
18610 Windows build fix.
18611
18612 * kjs/dtoa.cpp: Include stdint.h.
18613
18614 2008-03-25 Alexey Proskuryakov <ap@webkit.org>
18615
18616 Rubber-stamped by Darin.
18617
18618 Cleanup dtoa.cpp style.
18619
18620 * kjs/dtoa.cpp:
18621 (Bigint::Balloc):
18622 (Bigint::Bfree):
18623 (Bigint::multadd):
18624 (Bigint::s2b):
18625 (Bigint::hi0bits):
18626 (Bigint::lo0bits):
18627 (Bigint::i2b):
18628 (Bigint::mult):
18629 (Bigint::pow5mult):
18630 (Bigint::lshift):
18631 (Bigint::cmp):
18632 (Bigint::diff):
18633 (Bigint::ulp):
18634 (Bigint::b2d):
18635 (Bigint::d2b):
18636 (Bigint::ratio):
18637 (Bigint::):
18638 (Bigint::match):
18639 (Bigint::hexnan):
18640 (Bigint::kjs_strtod):
18641 (Bigint::quorem):
18642 (Bigint::rv_alloc):
18643 (Bigint::nrv_alloc):
18644 (Bigint::kjs_freedtoa):
18645 (Bigint::kjs_dtoa):
18646 * kjs/dtoa.h:
18647
18648 2008-03-24 Darin Adler <darin@apple.com>
18649
18650 Reviewed by Sam.
18651
18652 - convert a JavaScript immediate number to a string more efficiently
18653
18654 2% speedup of Acid3 test 26
18655
18656 * kjs/JSImmediate.cpp:
18657 (KJS::JSImmediate::toString): Take advantage of the fact that all immediate
18658 numbers are integers, and use the faster UString function for formatting integers
18659 instead of the slower one that works for floating point. I think this is a leftover
18660 from when immediate numbers were floating point.
18661
18662 2008-03-23 Sam Weinig <sam@webkit.org>
18663
18664 Reviewed by Darin Adler.
18665
18666 Fix http://bugs.webkit.org/show_bug.cgi?id=18048
18667 The "thisObject" parameter to JSEvaluateScript is not used properly
18668
18669 Making passing a thisObject to JSEvaluateScript actually set the thisObject of the created
18670 ExecState.
18671
18672 * API/testapi.c:
18673 (main): Add tests for setting the thisObject when calling JSEvaluateScript.
18674
18675 * kjs/ExecState.cpp:
18676 (KJS::ExecState::ExecState): Assign the thisObject to m_thisValue and remove the comment.
18677
18678 2008-03-22 Jesse Ruderman <jruderman@gmail.com>
18679
18680 Reviewed by Sam Weinig. Landed by eseidel.
18681
18682 Make testkjs flush stdout after printing.
18683
18684 * JavaScriptCore.xcodeproj/project.pbxproj:
18685 * kjs/testkjs.cpp:
18686 (functionPrint):
18687
18688 2008-03-21 Oliver Hunt <oliver@apple.com>
18689
18690 Reviewed by Maciej.
18691
18692 Optimise lookup of Math, undefined, NaN and Infinity
18693
18694 Added a method to JSVariableObject to allow us to inject DontDelete properties
18695 into the symbol table and localStorage. This results in a 0.4% progression in
18696 SunSpider, with a 8% gain in math-partial-sums.
18697
18698 * kjs/JSGlobalObject.cpp:
18699 (KJS::JSGlobalObject::reset):
18700 * kjs/JSVariableObject.h:
18701 (KJS::JSVariableObject::symbolTableInsert):
18702
18703 2008-03-21 Oliver Hunt <oliver@apple.com>
18704
18705 Reviewed by Geoff Garen.
18706
18707 Global properties that use LocalStorage are not correctly listed as enumerable.
18708
18709 The problem was caused by JSObject::getPropertyAttributes not being aware
18710 of the JSVariableObject SymbolTable. The fix is to make getPropertyAttributes
18711 virtual and override in JSVariableObject. This does not produce any performance
18712 regression.
18713
18714 * JavaScriptCore.exp:
18715 * kjs/JSVariableObject.cpp:
18716 (KJS::JSVariableObject::getPropertyNames):
18717 (KJS::JSVariableObject::getPropertyAttributes):
18718 * kjs/JSVariableObject.h:
18719 * kjs/object.h:
18720
18721 2008-03-21 Arkadiusz Miskiewicz <arekm@maven.pl>
18722
18723 Webkit does not build on linux powerpc
18724
18725 <http://bugs.webkit.org/show_bug.cgi?id=17019>
18726
18727 Reviewed by David Kilzer.
18728
18729 * wtf/TCSpinLock.h:
18730 (TCMalloc_SpinLock::Unlock):
18731
18732 2008-03-21 Rodney Dawes <dobey@wayofthemonkey.com>
18733
18734 Reviewed by Holger.
18735
18736 http://bugs.webkit.org/show_bug.cgi?id=17981
18737
18738 Add javascriptcore_cppflags to Programs_minidom_CPPFLAGS.
18739
18740 * GNUmakefile.am:
18741
18742 2008-03-21 Alexey Proskuryakov <ap@webkit.org>
18743
18744 Reviewed by Oliver Hunt.
18745
18746 Consolidate static identifier initializers within CommonIdentifiers.
18747
18748 No reliably measurable change on SunSpider; maybe a tiny improvement (within 0.2%).
18749
18750 * kjs/CommonIdentifiers.h: Added static identifiers that were lazily initialized
18751 throughout the code.
18752
18753 * kjs/date_object.cpp:
18754 (KJS::DateObjectImp::DateObjectImp):
18755 * kjs/function_object.cpp:
18756 (KJS::FunctionPrototype::FunctionPrototype):
18757 * kjs/object_object.cpp:
18758 (KJS::ObjectPrototype::ObjectPrototype):
18759 * kjs/regexp_object.cpp:
18760 (KJS::RegExpPrototype::RegExpPrototype):
18761 Use the values from CommonIdentifiers.
18762
18763 * kjs/lookup.h: Caching the identifier in a static wasn't a win on SunSpider, removed it.
18764
18765 * kjs/value.h:
18766 (KJS::jsNaN): We already have a shared NaN value, no need for a duplicate here.
18767
18768 * wtf/MathExtras.h:
18769 (wtf_atan2): Having local variables for numeric_limits constants is good for readability,
18770 but there is no reason to keep them static.
18771
18772 * JavaScriptCore.exp: Don't needlessly export JSGlobalObject::s_head.
18773
18774 2008-03-20 Oliver Hunt <oliver@apple.com>
18775
18776 Reviewed by Maciej.
18777
18778 Fix for leak introduced by inline ScopeChainNode use
18779
18780 To avoid any extra branches when managing an inline ScopeChainNode
18781 in the ScopeChain the inline node gets inserted with a refcount of
18782 2. This meant than when the ScopeChain was destroyed the ScopeChainNodes
18783 above the inline node would be leaked.
18784
18785 We resolve this by manually popping the inline node in the
18786 FunctionExecState destructor.
18787
18788 * JavaScriptCore.xcodeproj/project.pbxproj:
18789 * kjs/ExecStateInlines.h:
18790 (KJS::FunctionExecState::~FunctionExecState):
18791 * kjs/scope_chain.h:
18792 (KJS::ScopeChain::popInlineScopeNode):
18793
18794 2008-03-20 Mark Rowe <mrowe@apple.com>
18795
18796 Reviewed by Sam Weinig.
18797
18798 Ensure that the defines in FEATURE_DEFINES are sorted so that they will match the default settings of build-webkit.
18799 This will prevent the world from being rebuilt if you happen to switch between building in Xcode and with build-webkit on the
18800 command-line.
18801
18802 * Configurations/JavaScriptCore.xcconfig:
18803
18804 2008-03-20 David Krause <david.krause@gmail.com>
18805
18806 Reviewed by David Kilzer.
18807
18808 Fix http://bugs.webkit.org/show_bug.cgi?id=17923
18809 Bug 17923: ARM platform endian defines inaccurate
18810
18811 * wtf/Platform.h:
18812 Replaced !defined(__ARMEL__) check with !defined(__VFP_FP__)
18813 for PLATFORM(MIDDLE_ENDIAN)
18814
18815 2008-03-20 Maciej Stachowiak <mjs@apple.com>
18816
18817 - fix build
18818
18819 * JavaScriptCore.xcodeproj/project.pbxproj: install Activation.h as private
18820
18821 2008-03-20 Maciej Stachowiak <mjs@apple.com>
18822
18823 Reviewed by Oliver.
18824
18825 - reduce function call overhead for 1.014x speedup on SunSpider
18826
18827 I moved some functions from ExecState.cpp to ExecStateInline.h and
18828 from JSGlobalObject.cpp to JSGlobalObject.h, and declared them
18829 inline; machine function call overhead for these was hurting JS
18830 funcion call overhead.
18831
18832 * kjs/ExecState.cpp:
18833 * kjs/ExecStateInlines.h: Added.
18834 (KJS::ExecState::ExecState):
18835 (KJS::ExecState::~ExecState):
18836 (KJS::FunctionExecState::FunctionExecState):
18837 (KJS::FunctionExecState::~FunctionExecState):
18838 * kjs/JSGlobalObject.cpp:
18839 * kjs/JSGlobalObject.h:
18840 (KJS::JSGlobalObject::pushActivation):
18841 (KJS::JSGlobalObject::checkActivationCount):
18842 (KJS::JSGlobalObject::popActivation):
18843 * kjs/function.cpp:
18844
18845 2008-03-19 Oliver Hunt <oliver@apple.com>
18846
18847 Reviewed by Maciej.
18848
18849 Avoid heap allocating the root scope chain node for eval and closure free functions
18850
18851 Maciej suggested using an inline ScopeChainNode for functions that don't use eval
18852 or closures as they are unable to ever capture the scope chain. This gives us a 2.4%
18853 win in sunspider, a 15% win in controlflow-recursive, and big (>5%) wins in a number
18854 of other tests.
18855
18856 * kjs/ExecState.cpp:
18857 (KJS::ExecState::ExecState):
18858 * kjs/ExecState.h:
18859 * kjs/scope_chain.h:
18860 (KJS::ScopeChain::push):
18861
18862 2008-03-19 Mark Rowe <mrowe@apple.com>
18863
18864 Reviewed by Sam Weinig.
18865
18866 Fix release build.
18867
18868 * kjs/JSGlobalObject.cpp: Add missing #include.
18869
18870 2008-03-19 Sam Weinig <sam@webkit.org>
18871
18872 Reviewed by Anders Carlsson.
18873
18874 Fix for <rdar://problem/5785694>
18875 Crash occurs at KJS::Collector::collect() when loading web clip widgets with a PAC file
18876
18877 Make the activeExecStates stack per JSGlobalObject instead of static to ensure
18878 thread safety.
18879
18880 * JavaScriptCore.exp:
18881 * kjs/ExecState.cpp:
18882 (KJS::InterpreterExecState::InterpreterExecState):
18883 (KJS::InterpreterExecState::~InterpreterExecState):
18884 (KJS::EvalExecState::EvalExecState):
18885 (KJS::EvalExecState::~EvalExecState):
18886 (KJS::FunctionExecState::FunctionExecState):
18887 (KJS::FunctionExecState::~FunctionExecState):
18888 * kjs/ExecState.h:
18889 * kjs/JSGlobalObject.cpp:
18890 (KJS::JSGlobalObject::mark):
18891 * kjs/JSGlobalObject.h:
18892 (KJS::JSGlobalObject::activeExecStates):
18893 * kjs/collector.cpp:
18894 (KJS::Collector::collect):
18895 (KJS::Collector::reportOutOfMemoryToAllExecStates): Iterate all JSGlobalObjects and report
18896 the OutOfMemory condition to all the ExecStates in each.
18897
18898 2008-03-19 Jasper Bryant-Greene <jasper@unix.geek.nz>
18899
18900 Reviewed by Maciej Stachowiak.
18901
18902 Fix http://bugs.webkit.org/show_bug.cgi?id=17941
18903 Bug 17941: C++-style comments in JavaScriptCore API
18904
18905 * API/JSBase.h:
18906 Remove C++-style comments from public JavaScriptCore API, replacing
18907 with standard C90 block comments.
18908
18909 2008-03-19 Mark Rowe <mrowe@apple.com>
18910
18911 Reviewed by Oliver Hunt.
18912
18913 Fix http://bugs.webkit.org/show_bug.cgi?id=17939
18914 Bug 17939: Crash decompiling "const a = 1, b;"
18915
18916 * kjs/nodes2string.cpp:
18917 (KJS::ConstDeclNode::streamTo): Null-check the correct variable.
18918
18919 2008-03-18 Oliver Hunt <oliver@apple.com>
18920
18921 Reviewed by Mark Rowe.
18922
18923 Bug 17929: Incorrect decompilation with |const|, comma
18924 http://bugs.webkit.org/show_bug.cgi?id=17929
18925
18926 There were actually two bugs here. First we weren't correctly handling const
18927 nodes with multiple declarations. The second issue was caused by us not
18928 giving the correct precedence to the initialisers.
18929
18930 * kjs/nodes2string.cpp:
18931 (KJS::ConstDeclNode::streamTo):
18932
18933 2008-03-18 Darin Adler <darin@apple.com>
18934
18935 Reviewed by Maciej.
18936
18937 - Speed up JavaScript built-in properties by changing the
18938 hash table to take advantage of the identifier objects
18939
18940 5% speedup for Acid3 test 26
18941
18942 * JavaScriptCore.exp: Updated.
18943 * kjs/create_hash_table: Compute size of hash table large enough so that there
18944 are no collisions, but don't generate the hash table.
18945 * kjs/identifier.h: Made the add function that returns a PassRefPtr public.
18946 * kjs/lexer.cpp:
18947 (KJS::Lexer::lex): Updated for change to HashTable interface.
18948 * kjs/lookup.cpp:
18949 (KJS::HashTable::changeKeysToIdentifiers): Added. Finds the identifier for
18950 each property so the equality comparision can be done with pointer comparision.
18951 * kjs/lookup.h: Made the key be a union of char* with UString::Rep* so it can
18952 hold identifiers. Added a keysAreIdentifiers flag to the HashTable. Changed
18953 the Lookup functions to be member functions of HashTable instead.
18954 * kjs/object.cpp:
18955 (KJS::JSObject::deleteProperty): Update for change to HashTable.
18956 (KJS::JSObject::findPropertyHashEntry): Ditto.
18957 (KJS::JSObject::getPropertyAttributes): Ditto.
18958 (KJS::JSObject::getPropertyNames): Ditto.
18959
18960 2008-03-18 Mark Rowe <mrowe@apple.com>
18961
18962 Reviewed by Oliver Hunt.
18963
18964 Fix http://bugs.webkit.org/show_bug.cgi?id=17925 and http://bugs.webkit.org/show_bug.cgi?id=17927.
18965 - Bug 17925: Crash in KJS::JSObject::put after setting this.__proto__
18966 - Bug 17927: Hang after attempting to create circular __proto__
18967
18968 * kjs/object.cpp:
18969 (KJS::JSObject::put): Silently ignore attempts to set __proto__ to a non-object, non-null value.
18970 Return after setting the exception when an attempt to set a cyclic __proto__ is detected so that
18971 the cyclic value is not set.
18972
18973 2008-03-18 Maciej Stachowiak <mjs@apple.com>
18974
18975 Reviewed by Oliver.
18976
18977 - inline ActivationImp::init for 0.8% SunSpider speedup
18978
18979 * kjs/Activation.h:
18980 (KJS::ActivationImp::init): Moved here from function.cpp
18981 * kjs/function.cpp:
18982
18983 2008-03-18 Simon Hausmann <hausmann@webkit.org>
18984
18985 Fix the Qt build.
18986
18987 Including config.h like in the other .cpp files gets the #ifdeffery
18988 correct for rand_s.
18989
18990 * kjs/JSWrapperObject.cpp:
18991
18992 2008-03-17 Darin Adler <darin@apple.com>
18993
18994 Reviewed by Maciej.
18995
18996 JavaScriptCore changes to support a WebCore speedup.
18997
18998 * JavaScriptCore.exp: Export the UString::Rep::computeHash function.
18999 * wtf/HashSet.h: Added a find and contains function that take a translator,
19000 like the add function.
19001
19002 2008-03-18 Maciej Stachowiak <mjs@apple.com>
19003
19004 Reviewed by Oliver.
19005
19006 - a few micro-optimizations for 1.2% SunSpider speedup
19007
19008 * kjs/function.cpp:
19009 (KJS::FunctionImp::callAsFunction): check for Return completion before Throw,
19010 it is more likely.
19011 * kjs/object.cpp:
19012 (KJS::JSObject::put): When walking prototype chain, instead of
19013 checking isObject (a virtual call), compare to jsNull (compare to
19014 a constant) since null is the only non-object that can be in a
19015 prototype chain.
19016
19017 2008-03-17 Oliver Hunt <oliver@apple.com>
19018
19019 Reviewed by Geoff.
19020
19021 Optimise multi-scope function call resolution
19022
19023 Refactor multiscope variable resolution and use to add
19024 optimised FunctionCallResolveNode subclasses.
19025
19026 2.6% gain in sunspider performance, *25%* gain in controlflow-recursive
19027
19028 * kjs/nodes.cpp:
19029 (KJS::getSymbolTableEntry):
19030 (KJS::ResolveNode::optimizeVariableAccess):
19031 (KJS::getNonLocalSymbol):
19032 (KJS::ExpressionNode::resolveAndCall):
19033 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
19034 (KJS::FunctionCallResolveNode::inlineEvaluate):
19035 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
19036 (KJS::ScopedVarFunctionCallNode::evaluate):
19037 (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
19038 (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
19039 (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
19040 (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
19041 (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
19042 (KJS::NonLocalVarFunctionCallNode::evaluate):
19043 (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
19044 (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
19045 (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
19046 (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
19047 * kjs/nodes.h:
19048 (KJS::ScopedVarFunctionCallNode::):
19049 (KJS::NonLocalVarFunctionCallNode::):
19050
19051 2008-03-17 David Kilzer <ddkilzer@apple.com>
19052
19053 Don't define PLATFORM(MIDDLE_ENDIAN) on little endian ARM.
19054
19055 Reviewed by Darin.
19056
19057 See <http://bugs.webkit.org/show_bug.cgi?id=15416#c13>.
19058
19059 * wtf/Platform.h: Added check for !defined(__ARMEL__) when defining
19060 PLATFORM(MIDDLE_ENDIAN).
19061
19062 2008-03-17 Oliver Hunt <oliver@apple.com>
19063
19064 Reviewed by Geoff, Darin and Weinig.
19065
19066 Add fast multi-level scope lookup
19067
19068 Add logic and AST nodes to provide rapid variable resolution across
19069 static scope boundaries. This also adds logic that allows us to skip
19070 any static scopes that do not contain the variable to be resolved.
19071
19072 This results in a ~2.5% speedup in SunSpider, and gives a 25-30% speedup
19073 in some simple and ad hoc closure and global variable access tests.
19074
19075 * JavaScriptCore.exp:
19076 * kjs/Activation.h:
19077 * kjs/JSGlobalObject.cpp:
19078 * kjs/JSGlobalObject.h:
19079 * kjs/JSVariableObject.cpp:
19080 * kjs/JSVariableObject.h:
19081 * kjs/function.cpp:
19082 (KJS::ActivationImp::isDynamicScope):
19083 * kjs/nodes.cpp:
19084 (KJS::ResolveNode::optimizeVariableAccess):
19085 (KJS::ScopedVarAccessNode::inlineEvaluate):
19086 (KJS::ScopedVarAccessNode::evaluate):
19087 (KJS::ScopedVarAccessNode::evaluateToNumber):
19088 (KJS::ScopedVarAccessNode::evaluateToBoolean):
19089 (KJS::ScopedVarAccessNode::evaluateToInt32):
19090 (KJS::ScopedVarAccessNode::evaluateToUInt32):
19091 (KJS::NonLocalVarAccessNode::inlineEvaluate):
19092 (KJS::NonLocalVarAccessNode::evaluate):
19093 (KJS::NonLocalVarAccessNode::evaluateToNumber):
19094 (KJS::NonLocalVarAccessNode::evaluateToBoolean):
19095 (KJS::NonLocalVarAccessNode::evaluateToInt32):
19096 (KJS::NonLocalVarAccessNode::evaluateToUInt32):
19097 (KJS::IfElseNode::optimizeVariableAccess):
19098 (KJS::ScopeNode::optimizeVariableAccess):
19099 * kjs/nodes.h:
19100 (KJS::ScopedVarAccessNode::):
19101 (KJS::NonLocalVarAccessNode::):
19102 * kjs/object.h:
19103
19104 2008-03-16 weihongzeng <weihong.zeng@hotmail.com>
19105
19106 Reviewed by Darin Adler.
19107
19108 http://bugs.webkit.org/show_bug.cgi?id=15416
19109 Add support for mixed-endian processors
19110
19111 * kjs/dtoa.cpp: Add IEEE_ARM, triggered by PLATFORM(MIDDLE_ENDIAN).
19112
19113 2008-03-16 Kevin Ollivier <kevino@theolliviers.com>
19114
19115 Rubber stamped by Darin.
19116
19117 Add set-webkit-configuration support for wx port, and centralize
19118 build dir location setting.
19119
19120 http://bugs.webkit.org/show_bug.cgi?id=17790
19121
19122 * jscore.bkl:
19123
19124 2008-03-14 Steve Falkenburg <sfalken@apple.com>
19125
19126 PGO build fixes.
19127
19128 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
19129
19130 2008-03-14 Oliver Hunt <oliver@apple.com>
19131
19132 Reviewed by Maciej.
19133
19134 Add logic to track whether a function uses a locally scoped eval or requires a closure
19135
19136 Now that we limit eval we can track those uses of eval that operate
19137 in the local scope and functions that require a closure. We track
19138 this information during initial parsing to avoid yet another tree
19139 walk.
19140
19141 * JavaScriptCore.exp:
19142 * kjs/NodeInfo.h:
19143 * kjs/Parser.cpp:
19144 (KJS::Parser::didFinishParsing):
19145 * kjs/Parser.h:
19146 (KJS::Parser::parse):
19147 * kjs/grammar.y:
19148 * kjs/nodes.cpp:
19149 (KJS::ScopeNode::ScopeNode):
19150 (KJS::ProgramNode::ProgramNode):
19151 (KJS::ProgramNode::create):
19152 (KJS::EvalNode::EvalNode):
19153 (KJS::EvalNode::create):
19154 (KJS::FunctionBodyNode::FunctionBodyNode):
19155 (KJS::FunctionBodyNode::create):
19156 * kjs/nodes.h:
19157 (KJS::ScopeNode::):
19158 (KJS::ScopeNode::usesEval):
19159 (KJS::ScopeNode::needsClosure):
19160
19161 2008-03-14 Geoffrey Garen <ggaren@apple.com>
19162
19163 Reviewed by Beth Dakin.
19164
19165 Fixed another problem with Vector::shrinkCapacity.
19166
19167 moveOverlapping isn't good enough for the case where the buffer hasn't
19168 changed, because it still destroys the contents of the buffer.
19169
19170 * wtf/Vector.h:
19171 (WTF::::shrinkCapacity): Changed to explicitly check whether the call
19172 to allocateBuffer produced a new buffer. If it didn't, there's no need
19173 to move.
19174
19175 2008-03-14 Geoffrey Garen <ggaren@apple.com>
19176
19177 Reviewed by Beth Dakin.
19178
19179 Fixed a few problems with Vector::shrinkCapacity that I noticed in testing.
19180
19181 * wtf/Vector.h:
19182 (WTF::VectorBufferBase::deallocateBuffer): Clear our m_buffer pointer
19183 when we deallocate m_buffer, in case we're not asked to reallocate a new
19184 buffer. (Otherwise, we would use a stale m_buffer if we were asked to
19185 perform any operations after shrinkCapacity was called.)
19186
19187 (WTF::VectorBuffer::allocateBuffer): Made VectorBuffer with inline
19188 capacity aware that calls to allocateBuffer might be shrinks, rather
19189 than grows, so we shouldn't allocate a new buffer on the heap unless
19190 our inline buffer is too small.
19191
19192 (WTF::::shrinkCapacity): Call resize() instead of just setting m_size,
19193 so destructors run. Call resize before reallocating the buffer to make
19194 sure that we still have access to the objects we need to destroy. Call
19195 moveOverlapping instead of move, since a call to allocateBuffer on an
19196 inline buffer may produce identical storage.
19197
19198 2008-03-14 Alexey Proskuryakov <ap@webkit.org>
19199
19200 Reviewed by Darin.
19201
19202 Get rid of a localime() call on platforms that have better alternatives.
19203
19204 * kjs/DateMath.h: Added getLocalTime();
19205
19206 * kjs/DateMath.cpp:
19207 (KJS::getLocalTime):
19208 (KJS::getDSTOffsetSimple):
19209 Implementation moved from getDSTOffsetSimple().
19210
19211 * kjs/date_object.cpp:
19212 (KJS::DateObjectImp::callAsFunction): Switched to getLocalTime().
19213
19214 2008-03-14 David D. Kilzer <ddkilzer@apple.com>
19215
19216 Unify concept of enabling the Mac Java bridge.
19217
19218 Reviewed by Darin and Anders.
19219
19220 * wtf/Platform.h: Define ENABLE_MAC_JAVA_BRIDGE here.
19221
19222 2008-03-13 Mark Mentovai <mark@moxienet.com>
19223
19224 Reviewed by eseidel. Landed by eseidel.
19225
19226 * wtf/FastMalloc.cpp: #include <wtf/HashSet.h> outside of any
19227 namespaces.
19228
19229 2008-03-13 Mark Mentovai <mark@moxienet.com>
19230
19231 Reviewed by eseidel. Landed by eseidel.
19232
19233 * pcre/pcre_exec.cpp: Fix misnamed variable, allowing -DDEBUG build
19234 to succeed.
19235 * wtf/ThreadingPthreads.cpp: #include <sys/time.h> for gettimeofday
19236 in non-pch build.
19237
19238 2008-03-13 Steve Falkenburg <sfalken@apple.com>
19239
19240 PGO build fixes.
19241
19242 Disable PGO for normal release builds.
19243 Added work-in-progress Release_PGOInstrument/Release_PGOOptimize targets.
19244
19245 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
19246
19247 2008-03-13 Beth Dakin <bdakin@apple.com>
19248
19249 Reviewed by Geoff.
19250
19251 Adding new functionality to Vector. Currently all of the shrink and
19252 resize functions on Vector only shrink the size of the Vector, not
19253 the capacity. For the Vector to take up as little memory as
19254 possible, though, it is necessary to be able to shrink the capacity
19255 as well. So this patch adds that functionality.
19256
19257 I need this for a speed up I am working on, and Geoff wants to use
19258 it in a speed up he is working on also, so he asked me to commit it
19259 now.
19260
19261 * wtf/Vector.h:
19262 (WTF::VectorBufferBase::allocateBuffer):
19263 (WTF::::shrinkCapacity):
19264
19265 2008-03-13 Simon Hausmann <hausmann@webkit.org>
19266
19267 Reviewed by Adam Roben.
19268
19269 Attempt at fixing the Qt/Windows build bot. Quote using double-quotes
19270 instead of single quotes.
19271
19272 * pcre/dftables:
19273
19274 2008-03-12 Steve Falkenburg <sfalken@apple.com>
19275
19276 Build fix.
19277
19278 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
19279
19280 2008-03-12 Alp Toker <alp@atoker.com>
19281
19282 Another autotools testkjs build fix attempt.
19283
19284 * GNUmakefile.am:
19285
19286 2008-03-12 Alp Toker <alp@atoker.com>
19287
19288 Attempt to fix the autotools testkjs build on systems with
19289 non-standard include paths.
19290
19291 * GNUmakefile.am:
19292
19293 2008-03-11 Alexey Proskuryakov <ap@webkit.org>
19294
19295 Reviewed by Darin.
19296
19297 <rdar://problem/5787743> REGRESSION: Crash at WTF::Collator::CreateCollator() running fast/js/kde/StringObject.html on Windows
19298
19299 * wtf/unicode/icu/CollatorICU.cpp:
19300 (WTF::Collator::createCollator): Check for null (== user default) m_locale before calling strcmp.
19301
19302 2008-03-11 Steve Falkenburg <sfalken@apple.com>
19303
19304 Disable LTCG/PGO for grammar.cpp and nodes.cpp.
19305 PGO on these files causes us to hang.
19306
19307 Copy newer vsprops files from relative WebKitLibraries path to environment variable based path.
19308
19309 Reviewed by Oliver.
19310
19311 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
19312 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
19313
19314 2008-03-10 Darin Adler <darin@apple.com>
19315
19316 - Windows build fix
19317
19318 * kjs/function.cpp: (KJS::decode): Initialize variable.
19319
19320 2008-03-10 Brent Fulgham <bfulgham@gmail.com>
19321
19322 Windows build fix
19323
19324 Reviewed by Adam.
19325
19326 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
19327 Set the PATH to include Cygwin before running touch.
19328
19329 2008-03-10 Eric Seidel <eric@webkit.org>
19330
19331 Build fix for JSC on windows.
19332
19333 * API/JSStringRefCF.cpp:
19334 (JSStringCreateWithCFString):
19335 * kjs/function.cpp:
19336 (KJS::decode):
19337 * kjs/nodes2string.cpp:
19338 (KJS::escapeStringForPrettyPrinting):
19339
19340 2008-03-10 Eric Seidel <eric@webkit.org>
19341
19342 No review, build fix only.
19343
19344 Attempt to fix the windows build?
19345
19346 * kjs/ustring.h: change unsigned short to UChar
19347
19348 2008-03-10 Eric Seidel <eric@webkit.org>
19349
19350 Reviewed by Darin.
19351
19352 Remove KJS::UChar, use ::UChar instead
19353 http://bugs.webkit.org/show_bug.cgi?id=17017
19354
19355 * API/JSStringRef.cpp:
19356 (JSStringCreateWithCharacters):
19357 (JSStringCreateWithUTF8CString):
19358 * API/JSStringRefCF.cpp:
19359 (JSStringCreateWithCFString):
19360 * JavaScriptCore.exp:
19361 * kjs/Parser.h:
19362 * kjs/function.cpp:
19363 (KJS::decode):
19364 (KJS::parseInt):
19365 (KJS::parseFloat):
19366 (KJS::globalFuncEscape):
19367 (KJS::globalFuncUnescape):
19368 * kjs/function_object.cpp:
19369 (KJS::FunctionObjectImp::construct):
19370 * kjs/identifier.cpp:
19371 (KJS::Identifier::equal):
19372 (KJS::CStringTranslator::translate):
19373 * kjs/interpreter.h:
19374 * kjs/lexer.cpp:
19375 (KJS::Lexer::setCode):
19376 (KJS::Lexer::shift):
19377 (KJS::Lexer::lex):
19378 (KJS::Lexer::convertUnicode):
19379 (KJS::Lexer::makeIdentifier):
19380 * kjs/lookup.cpp:
19381 (KJS::keysMatch):
19382 * kjs/nodes2string.cpp:
19383 (KJS::escapeStringForPrettyPrinting):
19384 (KJS::SourceStream::operator<<):
19385 * kjs/regexp.cpp:
19386 (KJS::RegExp::RegExp):
19387 (KJS::RegExp::match):
19388 * kjs/string_object.cpp:
19389 (KJS::substituteBackreferences):
19390 (KJS::stringProtoFuncCharCodeAt):
19391 (KJS::stringProtoFuncToLowerCase):
19392 (KJS::stringProtoFuncToUpperCase):
19393 (KJS::stringProtoFuncToLocaleLowerCase):
19394 (KJS::stringProtoFuncToLocaleUpperCase):
19395 * kjs/ustring.cpp:
19396 (KJS::UString::Rep::computeHash):
19397 (KJS::UString::UString):
19398 (KJS::UString::append):
19399 (KJS::UString::ascii):
19400 (KJS::UString::operator=):
19401 (KJS::UString::is8Bit):
19402 (KJS::UString::toStrictUInt32):
19403 (KJS::UString::find):
19404 (KJS::operator==):
19405 (KJS::operator<):
19406 (KJS::compare):
19407 (KJS::UString::UTF8String):
19408 * kjs/ustring.h:
19409 * pcre/pcre.h:
19410
19411 2008-03-09 Steve Falkenburg <sfalken@apple.com>
19412
19413 Stop Windows build if an error occurs in a prior project.
19414
19415 Rubber stamped by Darin.
19416
19417 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
19418 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
19419 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
19420 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
19421
19422 2008-03-09 J¸rg Billeter <j@bitron.ch>
19423
19424 Reviewed by Alp Toker.
19425
19426 Conditionalise ICU for Unicode in the GTK+ port.
19427
19428 * wtf/Platform.h:
19429
19430 2008-03-07 David D. Kilzer <ddkilzer@apple.com>
19431
19432 Unify concept of enabling Netscape Plug-in API (NPAPI).
19433
19434 Reviewed by Darin.
19435
19436 * wtf/Platform.h: Define ENABLE_NETSCAPE_PLUGIN_API here.
19437
19438 2008-03-07 Geoffrey Garen <ggaren@apple.com>
19439
19440 Reviewed by Darin Adler.
19441
19442 Fixed <rdar://problem/5689093> Stricter (ES4) eval semantics
19443
19444 The basic rule is:
19445
19446 - "eval(s)" is treated as an operator that gives the ES3 eval behavior.
19447 ... but only if there is no overriding declaration of "eval" in scope.
19448 - All other invocations treat eval as a function that evaluates a
19449 script in the context of its "this" object.
19450 ... but if its "this" object is not the global object it was
19451 originally associated with, eval throws an exception.
19452
19453 Because only expressions of the form "eval(s)" have access to local
19454 scope, the compiler can now statically determine whether a function
19455 needs local scope to be dynamic.
19456
19457 * kjs/nodes.h: Added FunctionCallEvalNode. It works just like
19458 FuncationCallResolveNode, except it statically indicates that the node
19459 may execute eval in the ES3 way.
19460 * kjs/nodes.cpp:
19461 * kjs/nodes2string.cpp:
19462
19463 * tests/mozilla/expected.html: This patch happens to fix a Mozilla JS
19464 test, but it's a bit of a pyrrhic victory. The test intends to test
19465 Mozilla's generic API for calling eval on any object, but, in reality,
19466 we only support calling eval on the global object.
19467
19468 2008-03-06 Steve Falkenburg <sfalken@apple.com>
19469
19470 Build fix.
19471
19472 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
19473
19474 2008-03-06 Steve Falkenburg <sfalken@apple.com>
19475
19476 Build fix.
19477
19478 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
19479
19480 2008-03-06 Alp Toker <alp@atoker.com>
19481
19482 Fix the build fix in r30845 to support out-of-tree builds.
19483
19484 * GNUmakefile.am:
19485
19486 2008-03-06 Steve Falkenburg <sfalken@apple.com>
19487
19488 Build fix.
19489
19490 * wtf/ThreadingWin.cpp:
19491 (WTF::ThreadCondition::timedWait):
19492
19493 2008-03-06 Darin Adler <darin@apple.com>
19494
19495 - another small step towards fixing the Qt build
19496
19497 * JavaScriptCore.pri: Remove more references to the now-obsolete bindings directory.
19498
19499 2008-03-06 Darin Adler <darin@apple.com>
19500
19501 - a small step towards fixing the Qt build
19502
19503 * JavaScriptCore.pri: Remove references to files no longer present in JavaScriptCore/bindings.
19504
19505 2008-03-06 Brady Eidson <beidson@apple.com>
19506
19507 Gtk Build fix
19508
19509 * wtf/ThreadingGtk.cpp:
19510 (WTF::ThreadCondition::timedWait):
19511
19512 2008-03-06 Alexey Proskuryakov <ap@webkit.org>
19513
19514 Wx build fix.
19515
19516 * wtf/unicode/icu/CollatorICU.cpp:
19517 (WTF::Collator::userDefault): Put ICU workaround under both PLATFORM(DARWIN) and
19518 PLATFORM(CF) checks, so that each port can decide if it wants to use CF on Mac for it.
19519
19520 2008-03-06 Brady Eidson <beidson@apple.com>
19521
19522 Reviewed by Darin
19523
19524 Add a timedWait() method to ThreadCondition
19525
19526 * JavaScriptCore.exp:
19527
19528 * wtf/Threading.h:
19529
19530 * wtf/ThreadingGtk.cpp:
19531 (WTF::ThreadCondition::timedWait):
19532
19533 * wtf/ThreadingNone.cpp:
19534 (WTF::ThreadCondition::timedWait):
19535
19536 * wtf/ThreadingPthreads.cpp:
19537 (WTF::ThreadCondition::timedWait):
19538
19539 * wtf/ThreadingWin.cpp:
19540 (WTF::ThreadCondition::timedWait): Needs implementation
19541
19542 2008-03-06 Alexey Proskuryakov <ap@webkit.org>
19543
19544 More build fixes.
19545
19546 * jscore.bkl: Add the wtf/unicode directory.
19547 * wtf/unicode/CollatorDefault.cpp:
19548 (WTF::Collator::userDefault): Use a constructor that does exist.
19549 * wtf/unicode/icu/CollatorICU.cpp: Mac build fix for case-sensitive file systems.
19550
19551 2008-03-06 Darin Adler <darin@apple.com>
19552
19553 - try to fix the Qt build
19554
19555 * JavaScriptCore.pri: Add the wtf/unicode directory.
19556
19557 2008-03-06 Darin Adler <darin@apple.com>
19558
19559 - try to fix the GTK build
19560
19561 * GNUmakefile.am: Add a -I for the wtf/unicode directory.
19562
19563 2008-03-06 Darin Adler <darin@apple.com>
19564
19565 - try to fix the Mac build
19566
19567 * icu/unicode/parseerr.h: Copied from ../WebCore/icu/unicode/parseerr.h.
19568 * icu/unicode/ucol.h: Copied from ../WebCore/icu/unicode/ucol.h.
19569 * icu/unicode/uloc.h: Copied from ../WebCore/icu/unicode/uloc.h.
19570 * icu/unicode/unorm.h: Copied from ../WebCore/icu/unicode/unorm.h.
19571 * icu/unicode/uset.h: Copied from ../WebCore/icu/unicode/uset.h.
19572
19573 2008-03-06 Alexey Proskuryakov <ap@webkit.org>
19574
19575 Reviewed by Darin.
19576
19577 <rdar://problem/5687269> Need to create a Collator abstraction for WebCore and JavaScriptCore
19578
19579 * wtf/Threading.h:
19580 (WTF::initializeThreading):
19581 * wtf/ThreadingGtk.cpp:
19582 (WTF::initializeThreading):
19583 * wtf/ThreadingNone.cpp:
19584 * wtf/ThreadingPthreads.cpp:
19585 * wtf/ThreadingWin.cpp:
19586 Added AtomicallyInitializedStatic.
19587
19588 * kjs/string_object.cpp: (KJS::localeCompare): Changed to use Collator.
19589
19590 * GNUmakefile.am:
19591 * JavaScriptCore.exp:
19592 * JavaScriptCore.pri:
19593 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
19594 * JavaScriptCore.xcodeproj/project.pbxproj:
19595 * JavaScriptCoreSources.bkl:
19596 Added new fiiles to projects.
19597
19598 * wtf/unicode/Collator.h: Added.
19599 (WTF::Collator::):
19600 * wtf/unicode/CollatorDefault.cpp: Added.
19601 (WTF::Collator::Collator):
19602 (WTF::Collator::~Collator):
19603 (WTF::Collator::setOrderLowerFirst):
19604 (WTF::Collator::collate):
19605 * wtf/unicode/icu/CollatorICU.cpp: Added.
19606 (WTF::cachedCollatorMutex):
19607 (WTF::Collator::Collator):
19608 (WTF::Collator::~Collator):
19609 (WTF::Collator::setOrderLowerFirst):
19610 (WTF::Collator::collate):
19611 (WTF::Collator::createCollator):
19612 (WTF::Collator::releaseCollator):
19613
19614 2008-03-05 Kevin Ollivier <kevino@theolliviers.com>
19615
19616 Fix the wx build after the bindings move.
19617
19618 * JavaScriptCoreSources.bkl:
19619 * jscore.bkl:
19620
19621 2008-03-05 Alp Toker <alp@atoker.com>
19622
19623 GTK+ build fix for breakage introduced in r30800.
19624
19625 Track moved bridge sources from JavaScriptCore to WebCore.
19626
19627 * GNUmakefile.am:
19628
19629 2008-03-05 Brent Fulgham <bfulgham@gmail.com>
19630
19631 Reviewed by Adam Roben.
19632
19633 Remove definition of WTF_USE_SAFARI_THEME from wtf/Platform.h
19634 because the PLATFORM(CG) flag is not set until config.h has
19635 already included this file.
19636
19637 * wtf/Platform.h: Remove useless definition of WTF_USE_SAFARI_THEME
19638
19639 2008-03-05 Brady Eidson <beidson@apple.com>
19640
19641 Reviewed by Alexey and Mark Rowe
19642
19643 Fix for <rdar://problem/5778247> - Reproducible crash on storage/execute-sql-args.html
19644
19645 DatabaseThread::unscheduleDatabaseTasks() manually filters through a MessageQueue,
19646 removing particular items for Databases that were shutting down.
19647
19648 This filtering operation is not atomic, and therefore causes a race condition with the
19649 MessageQueue waking up and reading from the message queue.
19650
19651 The end result was an attempt to dereference a null DatabaseTask. Timing-wise, this never
19652 seemed to happen in a debug build, otherwise an assertion would've caught it. Replacing that
19653 assertion with a crash in a release build is what revealed this bug.
19654
19655 * wtf/MessageQueue.h:
19656 (WTF::::waitForMessage): Tweak the waiting logic to check the queue's empty state then go back
19657 to sleep if the queue was empty - checking m_killed each time it wakes up.
19658
19659 2008-03-05 David D. Kilzer <ddkilzer@apple.com>
19660
19661 Remove unused header includes from interpreter.cpp.
19662
19663 Reviewed by Darin.
19664
19665 * kjs/interpreter.cpp: Remove unused header includes.
19666
19667 2008-03-05 Anders Carlsson <andersca@apple.com>
19668
19669 Reviewed by Sam.
19670
19671 Remove bindings/.
19672
19673 * bindings: Removed.
19674
19675 2008-03-05 Anders Carlsson <andersca@apple.com>
19676
19677 Don't build bindings/ anymore.
19678
19679 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
19680
19681 2008-03-05 Anders Carlsson <andersca@apple.com>
19682
19683 Reviewed by Geoff.
19684
19685 Don't build JavaScriptCore/bindings.
19686
19687 * JavaScriptCore.exp:
19688 Export a couple of new functions.
19689
19690 * JavaScriptCore.xcodeproj/project.pbxproj:
19691 Remove bindings/
19692
19693 * kjs/config.h:
19694 No need to define HAVE_JNI anymore.
19695
19696 * kjs/interpreter.cpp:
19697 Remove unnecessary include.
19698
19699 2008-03-05 David D. Kilzer <ddkilzer@apple.com>
19700
19701 Allow override of default script file name using command-line argument.
19702
19703 Reviewed by Adele.
19704
19705 * API/minidom.c:
19706 (main): Allow first command-line argument to override the default script
19707 file name of "minidom.js".
19708 * API/testapi.c:
19709 (main): Allow first command-line argument to override the default script
19710 file name of "testapi.js".
19711
19712 2008-03-04 Mark Rowe <mrowe@apple.com>
19713
19714 Mac build fix.
19715
19716 * JavaScriptCore.exp: Add new symbol to exports file.
19717
19718 2008-03-03 Oliver Hunt <oliver@apple.com>
19719
19720 Reviewed by Anders.
19721
19722 Make ForInNode check for the timeout interrupt
19723
19724 * kjs/nodes.cpp:
19725 (KJS::ForInNode::execute):
19726
19727 2008-03-02 Brent Fulgham <bfulgham@gmail.com>
19728
19729 Reviewed by Alp Toker.
19730
19731 http://bugs.webkit.org/show_bug.cgi?id=17415
19732 GTK Build (using autotools) on Mac OS (DarwinPorts) Fails
19733
19734 Add -lstdc++ to link flags for minidom program. This corrects
19735 a build error for the GTK+ on Mac OS.
19736
19737 * GNUmakefile.am:
19738
19739 2008-03-01 Mark Rowe <mrowe@apple.com>
19740
19741 Reviewed by Tim Hatcher.
19742
19743 Update Xcode configuration to support building debug and release from the mysterious future.
19744
19745 * Configurations/Base.xcconfig:
19746 * Configurations/DebugRelease.xcconfig:
19747
19748 2008-02-29 Brent Fulgham <bfulgham@gmail.com>
19749
19750 http://bugs.webkit.org/show_bug.cgi?id=17483
19751 Implement scrollbars on Windows (Cairo)
19752
19753 Reviewed by Adam Roben.
19754
19755 * wtf/Platform.h:
19756
19757 2008-02-29 Adam Roben <aroben@apple.com>
19758
19759 Remove unused DebuggerImp::abort and DebuggerImp::aborted
19760
19761 Reviewed by Tim and Sam.
19762
19763 * kjs/function_object.cpp:
19764 (KJS::FunctionObjectImp::construct):
19765 * kjs/internal.h:
19766 (KJS::DebuggerImp::DebuggerImp):
19767 * kjs/nodes.cpp:
19768 (KJS::Node::handleException):
19769 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
19770
19771 2008-02-28 Eric Christopher <echristo@apple.com>
19772
19773 Reviewed by Geoffrey Garen.
19774
19775 ** TOTAL **: 1.005x as fast 2867.6ms +/- 0.4% 2853.2ms +/- 0.3% significant
19776
19777 * kjs/nodes.cpp: Tell the compiler that exceptions are unexpected (for
19778 the sake of branch prediction and code organization).
19779
19780 2008-02-27 Alexey Proskuryakov <ap@webkit.org>
19781
19782 Reviewed by Sam Weinig.
19783
19784 http://bugs.webkit.org/show_bug.cgi?id=17030
19785 Small buffer overflow within initialization
19786
19787 * kjs/date_object.cpp:
19788 (KJS::DateObjectFuncImp::callAsFunction):
19789 (KJS::parseDate):
19790 Remove unnecessary and incorrect memset() calls - GregorianDateTime can initialize itself.
19791
19792 2008-02-25 Sam Weinig <sam@webkit.org>
19793
19794 Reviewed by Dan Bernstein.
19795
19796 - Add a variant of remove that takes a position and a length.
19797
19798 * wtf/Vector.h:
19799 (WTF::Vector::remove):
19800
19801 2008-02-25 Mark Mentovai <mark@moxienet.com>
19802
19803 Reviewed by Mark Rowe.
19804
19805 Enable CollectorHeapIntrospector to build by itself, as well as in an AllInOneFile build.
19806 http://bugs.webkit.org/show_bug.cgi?id=17538
19807
19808 * kjs/CollectorHeapIntrospector.cpp: Provide "using" declaration for
19809 WTF::RemoteMemoryReader.
19810 * kjs/collector.h: Move CollectorHeap declaration here...
19811 * kjs/collector.cpp: ... from here.
19812
19813 2008-02-25 Darin Adler <darin@apple.com>
19814
19815 Reviewed by Adam.
19816
19817 * JavaScriptCore.exp: Sort the contents of this file.
19818
19819 2008-02-25 Adam Roben <aroben@apple.com>
19820
19821 MSVC build fix
19822
19823 * kjs/testkjs.cpp:
19824 (functionQuit): Don't add a return statement after exit(0) for MSVC.
19825
19826 2008-02-24 Sam Weinig <sam@webkit.org>
19827
19828 Reviewed by Mark Rowe.
19829
19830 http://bugs.webkit.org/show_bug.cgi?id=17529
19831 Add support for reading from stdin from testkjs
19832
19833 * kjs/testkjs.cpp:
19834 (GlobalObject::GlobalObject): Add readline function to global object.
19835 (functionReadline): Added. Reads characters from stdin until a '\n' or
19836 EOF is encountered. The input is returned as a String to the caller.
19837
19838 2008-02-24 Sam Weinig <sam@webkit.org>
19839
19840 Reviewed by Mark Rowe.
19841
19842 http://bugs.webkit.org/show_bug.cgi?id=17528
19843 Give testkjs a bath
19844
19845 * JavaScriptCore.exp:
19846 * JavaScriptCore.xcodeproj/project.pbxproj: Make the testkjs.cpp use 4 space indentation.
19847 * kjs/testkjs.cpp:
19848 (StopWatch::getElapsedMS):
19849 (GlobalObject::className):
19850 (GlobalObject::GlobalObject):
19851 Rename GlobalImp to GlobalObject and setup the global functions
19852 in the GlobalObject's constructor. Also, use static functions for
19853 the implementation so we can use the standard PrototypeFunction
19854 class and remove TestFunctionImp.
19855 (functionPrint): Move print() functionality here.
19856 (functionDebug): Move debug() functionality here.
19857 (functionGC): Move gc() functionality here.
19858 (functionVersion): Move version() functionality here.
19859 (functionRun): Move run() functionality here.
19860 (functionLoad): Move load() functionality here.
19861 (functionQuit): Move quit() functionality here.
19862 (prettyPrintScript): Fix indentation.
19863 (runWithScripts): Since all the functionality of createGlobalObject is
19864 now in the GlobalObject constructor, just call new here.
19865 (parseArguments): Fix indentation.
19866 (kjsmain): Ditto
19867 (fillBufferWithContentsOfFile): Ditto.
19868
19869 2008-02-24 Sam Weinig <sam@webkit.org>
19870
19871 Reviewed by Oliver Hunt and Mark Rowe.
19872
19873 http://bugs.webkit.org/show_bug.cgi?id=17505
19874 Add support for getting command line arguments in testkjs
19875
19876 - This slightly changes the behavior of parsing arguments by requiring
19877 a '-f' before all files.
19878
19879 * kjs/testkjs.cpp:
19880 (createGlobalObject): Add a global property called 'arguments' which
19881 contains an array with the parsed arguments as strings.
19882 (runWithScripts): Pass in the arguments vector so that it can be passed
19883 to the global object.
19884 (parseArguments): Change parsing rules to require a '-f' before any script
19885 file. After all '-f' and '-p' arguments have been parsed, the remaining
19886 are added to the arguments vector and exposed to the script. If there is a
19887 chance of ambiguity (the user wants to pass the string '-f' to the script),
19888 the string '--' can be used separate the options from the pass through
19889 arguments.
19890 (kjsmain):
19891
19892 2008-02-24 Dan Bernstein <mitz@apple.com>
19893
19894 Reviewed by Darin Adler.
19895
19896 - fix http://bugs.webkit.org/show_bug.cgi?id=17511
19897 REGRESSION: Reproducible crash in SegmentedSubstring::SegmentedSubstring(SegmentedSubstring const&)
19898
19899 * wtf/Deque.h:
19900 (WTF::::expandCapacityIfNeeded): Fixed the case where m_start and m_end
19901 are both zero but the buffer capacity is non-zero.
19902 (WTF::::prepend): Added validity checks.
19903
19904 2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
19905
19906 Rubber stamped by Darin.
19907
19908 Add separator '\' after libJavaScriptCore_la_LIBADD and cleanup
19909 whitespaces introduced in the previous commit.
19910
19911 * GNUmakefile.am:
19912
19913 2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
19914
19915 * GNUmakefile.am: Add GLOBALDEPS for testkjs and minidom.
19916
19917 2008-02-23 Darin Adler <darin@apple.com>
19918
19919 Reviewed by Anders.
19920
19921 - http://bugs.webkit.org/show_bug.cgi?id=17496
19922 make Deque use a circular array; add iterators
19923
19924 * wtf/Deque.h: Wrote an all-new version of this class that uses a circular
19925 buffer. Growth policy is identical to vector. Added iterators.
19926
19927 * wtf/Vector.h: Made two small refinements while using this to implement
19928 Deque: Made VectorBufferBase derive from Noncopyable, which would have
19929 saved me some debugging time if it had been there. Renamed Impl and
19930 m_impl to Buffer and m_buffer.
19931
19932 2008-02-23 Darin Adler <darin@apple.com>
19933
19934 Reviewed by Anders.
19935
19936 - http://bugs.webkit.org/show_bug.cgi?id=17067
19937 eliminate attributes parameter from JSObject::put for speed/clarity
19938
19939 * API/JSCallbackObject.h: Removed attribute arguments.
19940 * API/JSCallbackObjectFunctions.h:
19941 (KJS::JSCallbackObject<Base>::put): Ditto.
19942 * API/JSObjectRef.cpp:
19943 (JSObjectSetProperty): Use initializeVariable or putDirect when necessary
19944 to set attribute values.
19945 * JavaScriptCore.exp: Updated.
19946 * bindings/objc/objc_runtime.h: Removed attribute arguments.
19947 * bindings/objc/objc_runtime.mm:
19948 (ObjcFallbackObjectImp::put): Ditto.
19949 * bindings/runtime_array.cpp:
19950 (RuntimeArray::put): Ditto.
19951 * bindings/runtime_array.h: Ditto.
19952 * bindings/runtime_object.cpp:
19953 (RuntimeObjectImp::put): Ditto.
19954 * bindings/runtime_object.h: Ditto. Also removed canPut which was only
19955 called from one place in WebCore that can use hasProperty instead.
19956
19957 * kjs/Activation.h: Removed attribute argument from put and added the new
19958 initializeVariable function that's used to put variables in variable objects.
19959 Also made isActivationObject a const member.
19960
19961 * kjs/JSGlobalObject.cpp:
19962 (KJS::JSGlobalObject::put): Removed attribute argument.
19963 (KJS::JSGlobalObject::initializeVariable): Added. Used to give variables
19964 their initial values, which can include the read-only property.
19965 (KJS::JSGlobalObject::reset): Removed obsolete comments about flags.
19966 Removed Internal flag, which is no longer needed.
19967 * kjs/JSGlobalObject.h: More of the same.
19968
19969 * kjs/JSVariableObject.h: Added pure virtual initializeVariable function.
19970 (KJS::JSVariableObject::symbolTablePut): Removed checkReadOnly flag; we always
19971 check read-only.
19972 (KJS::JSVariableObject::symbolTableInitializeVariable): Added.
19973
19974 * kjs/array_instance.cpp:
19975 (KJS::ArrayInstance::put): Removed attribute argument.
19976 * kjs/array_instance.h: Ditto.
19977
19978 * kjs/function.cpp:
19979 (KJS::FunctionImp::put): Ditto.
19980 (KJS::Arguments::put): Ditto.
19981 (KJS::ActivationImp::put): Ditto.
19982 (KJS::ActivationImp::initializeVariable): Added.
19983 * kjs/function.h: Removed attribute arguments.
19984
19985 * kjs/function_object.cpp:
19986 (KJS::FunctionObjectImp::construct): Removed Internal flag.
19987
19988 * kjs/lookup.h:
19989 (KJS::lookupPut): Removed attributes argument. Also changed to use putDirect
19990 instead of calling JSObject::put.
19991 (KJS::cacheGlobalObject): Ditto.
19992
19993 * kjs/nodes.cpp:
19994 (KJS::ConstDeclNode::handleSlowCase): Call initializeVariable to initialize
19995 the constant.
19996 (KJS::ConstDeclNode::evaluateSingle): Ditto.
19997 (KJS::TryNode::execute): Use putDirect to set up the new object.
19998 (KJS::FunctionBodyNode::processDeclarations): Removed Internal.
19999 (KJS::ProgramNode::processDeclarations): Ditto.
20000 (KJS::EvalNode::processDeclarations): Call initializeVariable to initialize
20001 the variables and functions.
20002 (KJS::FuncDeclNode::makeFunction): Removed Internal.
20003 (KJS::FuncExprNode::evaluate): Ditto.
20004
20005 * kjs/object.cpp: Removed canPut, which was only being used in one code path,
20006 not the normal high speed one.
20007 (KJS::JSObject::put): Removed attribute argument. Moved the logic from
20008 canPut here, in the one code ath that was still using it.
20009 * kjs/object.h: Removed Internal attribute, ad canPut function. Removed the
20010 attributes argument to the put function. Made isActivationObject const.
20011
20012 * kjs/regexp_object.cpp:
20013 (KJS::RegExpImp::put): Removed attributes argument.
20014 (KJS::RegExpImp::putValueProperty): Ditto.
20015 (KJS::RegExpObjectImp::put): Ditto.
20016 (KJS::RegExpObjectImp::putValueProperty): Ditto.
20017 * kjs/regexp_object.h: Ditto.
20018
20019 * kjs/string_object.cpp:
20020 (KJS::StringInstance::put): Removed attributes argument.
20021 * kjs/string_object.h: Ditto.
20022
20023 2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
20024
20025 Not reviewed, Gtk build fix.
20026
20027 * kjs/testkjs.pro:
20028
20029 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
20030
20031 Windows build fix - move ThreadCondition implementation from WebCore to WTF.
20032
20033 * wtf/ThreadingWin.cpp:
20034 (WTF::ThreadCondition::ThreadCondition):
20035 (WTF::ThreadCondition::~ThreadCondition):
20036 (WTF::ThreadCondition::wait):
20037 (WTF::ThreadCondition::signal):
20038 (WTF::ThreadCondition::broadcast):
20039
20040 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
20041
20042 Touch some files, hoping that Windows build bot will create JSC headers.
20043
20044 * kjs/AllInOneFile.cpp:
20045 * kjs/array_instance.cpp:
20046 * wtf/HashTable.cpp:
20047
20048 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
20049
20050 Qt/Wx build fix - this file was still in a wrong namespace, too.
20051
20052 * wtf/ThreadingNone.cpp:
20053
20054 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
20055
20056 More build fixing - fix mismatched braces.
20057
20058 * JavaScriptCore.pri:
20059
20060 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
20061
20062 Wx and Gtk build fixes.
20063
20064 * JavaScriptCore.pri: Don't try to compile ThreadingPthreads.
20065 * wtf/ThreadingGtk.cpp: Use a correct namespace.
20066
20067 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
20068
20069 Reviewed by Darin.
20070
20071 Move basic threading support from WebCore to WTF.
20072
20073 Added mutex protection to MessageQueue::killed() for paranoia sake.
20074
20075 * GNUmakefile.am:
20076 * JavaScriptCore.exp:
20077 * JavaScriptCore.pri:
20078 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
20079 * JavaScriptCore.xcodeproj/project.pbxproj:
20080 * JavaScriptCoreSources.bkl:
20081 * wtf/Locker.h: Copied from WebCore/platform/Locker.h.
20082 * wtf/MessageQueue.h: Copied from WebCore/platform/MessageQueue.h.
20083 (WTF::::killed):
20084 * wtf/Threading.h: Copied from WebCore/platform/Threading.h.
20085 * wtf/ThreadingGtk.cpp: Copied from WebCore/platform/gtk/ThreadingGtk.cpp.
20086 (WebCore::createThread):
20087 * wtf/ThreadingNone.cpp: Copied from WebCore/platform/ThreadingNone.cpp.
20088 * wtf/ThreadingPthreads.cpp: Copied from WebCore/platform/pthreads/ThreadingPthreads.cpp.
20089 (WTF::createThread):
20090 * wtf/ThreadingWin.cpp: Copied from WebCore/platform/win/ThreadingWin.cpp.
20091 (WTF::createThread):
20092 (WTF::Mutex::Mutex):
20093 (WTF::Mutex::~Mutex):
20094 (WTF::Mutex::lock):
20095 (WTF::Mutex::tryLock):
20096 (WTF::Mutex::unlock):
20097
20098 2008-02-22 Geoffrey Garen <ggaren@apple.com>
20099
20100 Reviewed by Sam Weinig.
20101
20102 Partial fix for <rdar://problem/5744037> Gmail out of memory (17455)
20103
20104 I'm removing KJS_MEM_LIMIT for the following reasons:
20105
20106 - We have a few reports of KJS_MEM_LIMIT breaking important web
20107 applications, like GMail and Google Reader. (For example, if you
20108 simply open 12 GMail tabs, tab #12 will hit the limit.)
20109
20110 - Firefox has no discernable JS object count limit, so any limit, even
20111 a large one, is a potential compatibility problem.
20112
20113 - KJS_MEM_LIMIT does not protect against malicious memory allocation,
20114 since there are many ways to maliciously allocate memory without
20115 increasing the JS object count.
20116
20117 - KJS_MEM_LIMIT is already mostly broken, since it only aborts the
20118 script that breaches the limit, not any subsequent scripts.
20119
20120 - We've never gotten bug reports about websites that would have
20121 benefited from an unbroken KJS_MEM_LIMIT. The initial check-in of
20122 KJS_MEM_LIMIT (KJS revision 80061) doesn't mention a website that
20123 needed it.
20124
20125 - Any website that brings you anywhere close to crashing due to the
20126 number of live JS objects will almost certainly put up the "slow
20127 script" dialog at least 20 times beforehand.
20128
20129 * kjs/collector.cpp:
20130 (KJS::Collector::collect):
20131 * kjs/collector.h:
20132 * kjs/nodes.cpp:
20133 (KJS::TryNode::execute):
20134
20135 2008-02-22 Oliver Hunt <oliver@apple.com>
20136
20137 Reviewed by Alexey P.
20138
20139 <rdar://problem/5759327> REGRESSION: while(NaN) acts like while(true)
20140
20141 Fix yet another case where we incorrectly relied on implicit double
20142 to bool coercion.
20143
20144 * kjs/nodes.cpp:
20145 (KJS::PostDecLocalVarNode::evaluateToBoolean):
20146
20147 2008-02-20 Michael Knaup <michael.knaup@mac.com>
20148
20149 Reviewed by Darin.
20150
20151 Fix for Bug 16753: date set methods with no args should result in NaN (Acid3 bug)
20152 The set values result in NaN now when called with no args, NaN or +/- inf values.
20153 The setYear, setFullYear and setUTCFullYear methods used on NaN dates work as
20154 descripted in the standard.
20155
20156 * kjs/date_object.cpp:
20157 (KJS::fillStructuresUsingTimeArgs):
20158 (KJS::fillStructuresUsingDateArgs):
20159 (KJS::setNewValueFromTimeArgs):
20160 (KJS::setNewValueFromDateArgs):
20161 (KJS::dateProtoFuncSetYear):
20162
20163 2008-02-19 Anders Carlsson <andersca@apple.com>
20164
20165 Reviewed by Darin.
20166
20167 Change OpaqueJSClass and RootObject to start with a ref count of 1.
20168
20169 * API/JSClassRef.cpp:
20170 (OpaqueJSClass::OpaqueJSClass):
20171 (OpaqueJSClass::createNoAutomaticPrototype):
20172 (OpaqueJSClass::create):
20173 * API/JSClassRef.h:
20174 * API/JSObjectRef.cpp:
20175 (JSClassCreate):
20176 * bindings/runtime_root.cpp:
20177 (KJS::Bindings::RootObject::create):
20178 (KJS::Bindings::RootObject::RootObject):
20179
20180 2008-02-19 Darin Adler <darin@apple.com>
20181
20182 Rubber stamped by Anders.
20183
20184 - removed explicit initialization to 1 for RefCounted; that's now the default
20185
20186 * kjs/regexp.cpp:
20187 (KJS::RegExp::RegExp): Removed RefCounted initializer.
20188
20189 2008-02-19 Darin Adler <darin@apple.com>
20190
20191 Reviewed by Anders.
20192
20193 - next step for http://bugs.webkit.org/show_bug.cgi?id=17257
20194 start ref counts at 1 instead of 0 for speed
20195
20196 * wtf/RefCounted.h:
20197 (WTF::RefCounted::RefCounted): Have refcounts default to 1. This allows us to start
20198 removing the explicit initialization of RefCounted from classes and eventually we
20199 can remove the ability to have the initial count of 0 entirely.
20200
20201 2008-02-18 Samuel Weinig <sam@webkit.org>
20202
20203 Reviewed by Geoff Garen.
20204
20205 Fix for http://bugs.webkit.org/show_bug.cgi?id=17419
20206 Remove CompatMode from JavaScriptCore as it is never set to anything other than NativeMode
20207
20208 * kjs/JSGlobalObject.cpp:
20209 (KJS::JSGlobalObject::init):
20210 * kjs/JSGlobalObject.h:
20211 (KJS::JSGlobalObject::setDebugger):
20212 * kjs/date_object.cpp:
20213 (KJS::dateProtoFuncGetYear):
20214
20215 2008-02-18 Darin Adler <darin@apple.com>
20216
20217 Reviewed by Sam.
20218
20219 * wtf/ASCIICType.h:
20220 (WTF::toASCIIHexValue): Added.
20221
20222 2008-02-17 Darin Adler <darin@apple.com>
20223
20224 * wtf/ListHashSet.h: (WTF::swap): Removed stray return statement.
20225
20226 2008-02-15 Adam Roben <aroben@apple.com>
20227
20228 Make JavaScriptCore's FEATURE_DEFINES match WebCore's
20229
20230 Reviewed by Mark.
20231
20232 * Configurations/JavaScriptCore.xcconfig:
20233
20234 2008-02-14 Stephanie Lewis <slewis@apple.com>
20235
20236 Reviewed by Geoff.
20237
20238 Update order files.
20239
20240 * JavaScriptCore.order:
20241
20242 2008-02-14 Geoffrey Garen <ggaren@apple.com>
20243
20244 Reviewed by Sam Weinig.
20245
20246 Fixed <rdar://problem/5737835> nee http://bugs.webkit.org/show_bug.cgi?id=17329
20247 Crash in JSGlobalObject::popActivation when inserting hyperlink in Wordpress (17329)
20248
20249 Don't reset the "activations" stack in JSGlobalObject::reset, since we
20250 might be executing a script during the call to reset, and the script
20251 needs to safely run to completion.
20252
20253 Instead, initialize the "activations" stack when the global object is
20254 created, and subsequently rely on pushing and popping during normal
20255 execution to maintain the stack's state.
20256
20257 * kjs/JSGlobalObject.cpp:
20258 (KJS::JSGlobalObject::init):
20259 (KJS::JSGlobalObject::reset):
20260
20261 2008-02-13 Bernhard Rosenkraenzer <bero@arklinux.org>
20262
20263 Reviewed by Darin.
20264
20265 - http://bugs.webkit.org/show_bug.cgi?id=17339
20266 JavaScriptCore does not build with gcc 4.3
20267
20268 * kjs/interpreter.cpp: Add include of <unistd.h>, since that's where
20269 getpid() comes from.
20270
20271 2008-02-13 Oliver Hunt <oliver@apple.com>
20272
20273 Reviewed by Alexey P.
20274
20275 <rdar://problem/5737003> REGRESSION (r27747): can't browse pictures on fastcupid.com
20276
20277 When converting numeric values to booleans we need to account for NaN
20278
20279 * kjs/nodes.cpp:
20280 (KJS::MultNode::evaluateToBoolean):
20281 (KJS::ModNode::evaluateToBoolean):
20282
20283 2008-02-08 Samuel Weinig <sam@webkit.org>
20284
20285 Reviewed by Brady Eidson.
20286
20287 <rdar://problem/5659216> REGRESSION: PLT 0.3% slower due to r28868 (caching ClassNodeList and NamedNodeList)
20288
20289 - Tweak the statements in isASCIISpace to account for the statistical distribution of
20290 usage in the PLT.
20291
20292 .4% speedup on my machine. Stephanie's machine shows this as .3% speedup.
20293
20294 * wtf/ASCIICType.h:
20295 (WTF::isASCIISpace):
20296
20297 2008-02-11 Sam Weinig <sam@webkit.org>
20298
20299 Reviewed by Anders Carlsson.
20300
20301 Fixes for:
20302 <rdar://problem/5735497> Match Firefox's cross-domain model more accurately by return the built-in version of functions even if they have been overridden
20303 <rdar://problem/5735443> Crash when setting the Window objects prototype to a custom Object and then calling a method on it
20304
20305 - Expose the native Object.prototype.toString implementation so that it can be used for cross-domain
20306 toString calling.
20307
20308 * JavaScriptCore.exp:
20309 * kjs/object_object.cpp:
20310 * kjs/object_object.h:
20311
20312 2008-02-10 Darin Adler <darin@apple.com>
20313
20314 Rubber stamped by Eric.
20315
20316 * kjs/ExecState.h:
20317 (KJS::ExecState::takeException): Added.
20318
20319 2008-02-10 Darin Adler <darin@apple.com>
20320
20321 Reviewed by Eric.
20322
20323 - http://bugs.webkit.org/show_bug.cgi?id=17256
20324 eliminate default ref. count of 0 in RefCounted class
20325
20326 * wtf/RefCounted.h:
20327 (WTF::RefCounted::RefCounted): Remove default of 0.
20328
20329 2008-02-10 Darin Adler <darin@apple.com>
20330
20331 Reviewed by Eric.
20332
20333 - http://bugs.webkit.org/show_bug.cgi?id=17256
20334 Make clients of RefCounted explicitly set the count to 0.
20335
20336 * API/JSClassRef.cpp:
20337 (OpaqueJSClass::OpaqueJSClass):
20338 * bindings/runtime_root.cpp:
20339 (KJS::Bindings::RootObject::RootObject):
20340
20341 2008-02-09 Darin Adler <darin@apple.com>
20342
20343 Reviewed by Mitz.
20344
20345 - http://bugs.webkit.org/show_bug.cgi?id=17256
20346 Change RegExp to start its ref count at 1, not 0
20347
20348 We'll want to do this to every RefCounted class, one at a time.
20349
20350 * kjs/nodes.h:
20351 (KJS::RegExpNode::RegExpNode): Use RegExp::create instead of new RegExp.
20352 * kjs/regexp.cpp:
20353 (KJS::RegExp::RegExp): Marked inline, set initial ref count to 1.
20354 (KJS::RegExp::create): Added. Calls new RegExp then adopts the initial ref.
20355 * kjs/regexp.h: Reformatted. Made the constructors private. Added static
20356 create functions that return objects already wrapped in PassRefPtr.
20357 * kjs/regexp_object.cpp:
20358 (KJS::regExpProtoFuncCompile): Use RegExp::create instead of new RegExp.
20359 (KJS::RegExpObjectImp::construct): Ditto.
20360 * kjs/string_object.cpp:
20361 (KJS::stringProtoFuncMatch): Ditto.
20362 (KJS::stringProtoFuncSearch): Ditto.
20363
20364 2008-02-08 Oliver Hunt <oliver@apple.com>
20365
20366 Reviewed by Maciej.
20367
20368 <rdar://problem/5731773> REGRESSION (r28973): Extraneous parentheses in function.toString()
20369 https://bugs.webkit.org/show_bug.cgi?id=17214
20370
20371 Make a subclass of CommaNode to provide the correct precedence for each expression in
20372 a variable declaration list.
20373
20374 * kjs/grammar.y:
20375 * kjs/nodes.h:
20376 (KJS::VarDeclCommaNode::):
20377
20378 2008-02-08 Darin Adler <darin@apple.com>
20379
20380 Reviewed by Oliver.
20381
20382 - fix http://bugs.webkit.org/show_bug.cgi?id=17247
20383 Labelled continue/break can fail in some cases
20384
20385 Test: fast/js/continue-break-multiple-labels.html
20386
20387 * kjs/nodes.h:
20388 (KJS::StatementNode::pushLabel): Made this virtual.
20389 (KJS::LabelNode::pushLabel): Forward pushLabel calls to the statement inside.
20390
20391 2008-02-08 Darin Adler <darin@apple.com>
20392
20393 Reviewed by Eric.
20394
20395 - fix http://bugs.webkit.org/show_bug.cgi?id=15003
20396 Function.prototype.constructor should not be DontDelete/ReadOnly (Acid3 bug)
20397
20398 Test: fast/js/constructor-attributes.html
20399
20400 * kjs/JSGlobalObject.cpp:
20401 (KJS::JSGlobalObject::reset): Remove unwanted attributes from "constructor".
20402 * kjs/function_object.cpp:
20403 (KJS::FunctionObjectImp::construct): Ditto.
20404 * kjs/nodes.cpp:
20405 (KJS::FuncDeclNode::makeFunction): Ditto.
20406 (KJS::FuncExprNode::evaluate): Ditto.
20407
20408 2008-02-06 Geoffrey Garen <ggaren@apple.com>
20409
20410 Reviewed by Oliver Hunt.
20411
20412 Added an ASSERT to catch refCount underflow, since it caused a leak in
20413 my last check-in.
20414
20415 * wtf/RefCounted.h:
20416 (WTF::RefCounted::deref):
20417
20418 2008-02-06 Geoffrey Garen <ggaren@apple.com>
20419
20420 Reviewed by Darin Adler.
20421
20422 PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
20423 slower due to r28884 (global variable symbol table optimization)
20424
20425 Tweaked RefCounted::deref() to be a little more efficient.
20426
20427 1% - 1.5% speedup on my machine. .7% speedup on Stephanie's machine.
20428
20429 * wtf/RefCounted.h:
20430 (WTF::RefCounted::deref): Don't modify m_refCount if we're just going
20431 to delete the object anyway. Also, use a simple == test, which might be
20432 faster than <= on some hardware.
20433
20434 2008-02-06 Darin Adler <darin@apple.com>
20435
20436 Reviewed by Sam.
20437
20438 - fix http://bugs.webkit.org/show_bug.cgi?id=17094
20439 Array.prototype functions create length properties with DontEnum/DontDelete
20440
20441 Test results match Gecko with very few obscure exceptions that seem to be
20442 bugs in Gecko.
20443
20444 Test: fast/js/array-functions-non-arrays.html
20445
20446 * kjs/array_object.cpp:
20447 (KJS::arrayProtoFuncConcat): Removed DontEnum and DontDelete from the call
20448 to set length.
20449 (KJS::arrayProtoFuncPop): Ditto. Also added missing call to deleteProperty,
20450 which is not needed for real arrays, but is needed for non-arrays.
20451 (KJS::arrayProtoFuncPush): Ditto.
20452 (KJS::arrayProtoFuncShift): Ditto.
20453 (KJS::arrayProtoFuncSlice): Ditto.
20454 (KJS::arrayProtoFuncSort): Removed incorrect call to set length when
20455 the array has no elements.
20456 (KJS::arrayProtoFuncSplice): Removed DontEnum and DontDelete from the call
20457 to set length.
20458 (KJS::arrayProtoFuncUnShift): Ditto. Also added a check for 0 arguments to
20459 make behavior match the specification in that case.
20460 * kjs/nodes.cpp:
20461 (KJS::ArrayNode::evaluate): Removed DontEnum and DontDelete from the call
20462 to set length.
20463
20464 2008-02-06 Darin Adler <darin@apple.com>
20465
20466 Reviewed by Sam.
20467
20468 - replace calls to put to set up properties with calls to putDirect, to
20469 prepare for a future change where put won't take attributes any more,
20470 and for a slight performance boost
20471
20472 * API/JSObjectRef.cpp:
20473 (JSObjectMakeConstructor): Use putDirect instead of put.
20474 * kjs/CommonIdentifiers.h: Removed lastIndex.
20475 * kjs/JSGlobalObject.cpp:
20476 (KJS::JSGlobalObject::reset): Use putDirect instead of put.
20477 * kjs/array_object.cpp:
20478 (KJS::arrayProtoFuncConcat): Took out extra call to get length (unused).
20479 (KJS::ArrayObjectImp::ArrayObjectImp): Use putDirect instead of put.
20480 * kjs/error_object.cpp:
20481 (KJS::ErrorPrototype::ErrorPrototype): Use putDirect instead of put.
20482 * kjs/function.cpp:
20483 (KJS::Arguments::Arguments): Use putDirect instead of put.
20484 (KJS::PrototypeFunction::PrototypeFunction): Use putDirect instead of put.
20485 * kjs/function_object.cpp:
20486 (KJS::FunctionObjectImp::construct): Use putDirect instead of put.
20487 * kjs/nodes.cpp:
20488 (KJS::FuncDeclNode::makeFunction): Use putDirect instead of put.
20489 (KJS::FuncExprNode::evaluate): Use putDirect instead of put.
20490 * kjs/regexp_object.cpp:
20491 (KJS::regExpProtoFuncCompile): Use setLastIndex instead of put(lastIndex).
20492 (KJS::RegExpImp::match): Get and set lastIndex by using m_lastIndex instead of
20493 calling get and put.
20494 * kjs/regexp_object.h:
20495 (KJS::RegExpImp::setLastIndex): Added.
20496 * kjs/string_object.cpp:
20497 (KJS::stringProtoFuncMatch): Use setLastIndex instead of put(lastIndex).
20498
20499 2008-02-05 Sam Weinig <sam@webkit.org>
20500
20501 Reviewed by Anders Carlsson.
20502
20503 Fix for http://bugs.webkit.org/show_bug.cgi?id=8080
20504 NodeList (and other DOM lists) items are not enumeratable using for..in
20505
20506 * JavaScriptCore.exp:
20507
20508 2008-02-05 Mark Rowe <mrowe@apple.com>
20509
20510 Reviewed by Oliver Hunt.
20511
20512 Update versioning to support the mysterious future.
20513
20514 * Configurations/Version.xcconfig: Add SYSTEM_VERSION_PREFIX_1060.
20515
20516 2008-02-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
20517
20518 Reviewed by Oliver Hunt.
20519
20520 Fixes Bug 16889: REGRESSION (r29425): Canvas-based graphing calculator fails to run
20521 Bug 17015: REGRESSION (r29414-29428): www.fox.com "shows" menu fails to render
20522 Bug 17164: REGRESSION: JavaScript pop-up menu appears at wrong location when hovering image at http://news.chinatimes.com/
20523
20524 <http://bugs.webkit.org/show_bug.cgi?id=16889>
20525 <rdar://problem/5696255>
20526
20527 <http://bugs.webkit.org/show_bug.cgi?id=17015>
20528
20529 <http://bugs.webkit.org/show_bug.cgi?id=17164>
20530 <rdar://problem/5720947>
20531
20532 The ActivationImp tear-off (r29425) introduced a problem with ReadModify
20533 nodes that first resolve a slot, call valueForReadModifyNode(), and then
20534 store a value in the previously resolved slot. Since valueForReadModifyNode()
20535 may cause a tear-off, the slot needs to be resolved again, but this was
20536 not happening with the existing code.
20537
20538 * kjs/nodes.cpp:
20539 (KJS::ReadModifyLocalVarNode::evaluate):
20540 (KJS::ReadModifyResolveNode::evaluate):
20541
20542 2008-02-04 Cameron McCormack <cam@mcc.id.au>
20543
20544 Reviewed by Geoff Garen.
20545
20546 Remove some unneccesary UNUSED_PARAMs. Clarify ownership rule of return value of JSObjectCopyPropertyNames.
20547
20548 * API/JSNode.c:
20549 (JSNode_appendChild):
20550 (JSNode_removeChild):
20551 (JSNode_replaceChild):
20552 (JSNode_getNodeType):
20553 (JSNode_getFirstChild):
20554 * API/JSNodeList.c:
20555 (JSNodeList_length):
20556 * API/JSObjectRef.h:
20557
20558 2008-02-04 Rodney Dawes <dobey@wayofthemonkey.com>
20559
20560 Reviewed by Alp Toker and Mark Rowe.
20561
20562 Fix http://bugs.webkit.org/show_bug.cgi?id=17175.
20563 Bug 17175: Use of C++ compiler flags in CFLAGS
20564
20565 * GNUmakefile.am: Use global_cxxflags as well as global_cflags in CXXFLAGS.
20566
20567 2008-02-04 Alp Toker <alp@atoker.com>
20568
20569 Rubber-stamped by Mark Rowe.
20570
20571 Remove all trailing whitespace in the GTK+ port and related
20572 components.
20573
20574 * GNUmakefile.am:
20575
20576 2008-02-02 Darin Adler <darin@apple.com>
20577
20578 Reviewed by Geoff Garen.
20579
20580 PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
20581 slower due to r28884 (global variable symbol table optimization)
20582
20583 Geoff's theory is that the slowdown was due to copying hash tables when
20584 putting things into the back/forward cache. If that's true, then this
20585 should fix the problem.
20586
20587 (According to Geoff's measurements, in a PLT that exaggerates the
20588 importance of symbol table saving during cached page creation, this
20589 patch is a ~3X speedup in cached page creation, and a 9% speedup overall.)
20590
20591 * JavaScriptCore.exp: Updated.
20592
20593 * kjs/JSVariableObject.cpp:
20594 (KJS::JSVariableObject::saveLocalStorage): Updated for changes to SavedProperty,
20595 which has been revised to avoid initializing each SavedProperty twice when building
20596 the array. Store the property names too, so we don't have to store the symbol table
20597 separately. Do this by iterating the symbol table instead of the local storage vector.
20598 (KJS::JSVariableObject::restoreLocalStorage): Ditto. Restore the symbol table as
20599 well as the local storage vector.
20600
20601 * kjs/JSVariableObject.h: Removed save/restoreSymbolTable and do that work inside
20602 save/restoreLocalStorage instead. Made restoreLocalStorage a non-const member function
20603 that takes a const reference to a SavedProperties object.
20604
20605 * kjs/LocalStorage.h: Changed attributes to be unsigned instead of int to match
20606 other declarations of attributes elsewhere.
20607
20608 * kjs/property_map.cpp:
20609 (KJS::SavedProperties::SavedProperties): Updated for data member name change.
20610 (KJS::PropertyMap::save): Updated for data member name change and to use the new
20611 inline init function instead of setting the fields directly. This allows us to
20612 skip initializing the SavedProperty objects when first allocating the array, and
20613 just do it when we're actually setting up the individual elements.
20614 (KJS::PropertyMap::restore): Updated for SavedProperty changes.
20615
20616 * kjs/property_map.h: Changed SavedProperty from a struct to a class. Set it up so
20617 it does not get initialized at construction time to avoid initializing twice when
20618 creating an array of SavedProperty. Removed the m_ prefixes from the members of
20619 the SavedProperties struct. Generally we use m_ for class members and not struct.
20620
20621 2008-02-02 Tony Chang <idealisms@gmail.com>
20622
20623 Reviewed by darin. Landed by eseidel.
20624
20625 Add #define guards for WIN32_LEAN_AND_MEAN and _CRT_RAND_S.
20626
20627 * kjs/config.h:
20628 * wtf/FastMalloc.cpp:
20629 * wtf/TCSpinLock.h:
20630
20631 2008-01-28 Sam Weinig <sam@webkit.org>
20632
20633 Rubber-stamped by Darin Adler.
20634
20635 - Fix whitespace in nodes.h/cpp and nodes2string.cpp.
20636
20637 (NOTE: Specific changed functions elided for space and clarity)
20638 * kjs/nodes.cpp:
20639 * kjs/nodes.h:
20640 * kjs/nodes2string.cpp:
20641
20642 2008-01-27 Sam Weinig <sam@webkit.org>
20643
20644 Reviewed by Oliver Hunt.
20645
20646 Patch for http://bugs.webkit.org/show_bug.cgi?id=17025
20647 nodes.h/cpp has been rolling around in the mud - lets hose it down
20648
20649 - Rename member variables to use the m_ prefix.
20650
20651 (NOTE: Specific changed functions elided for space and clarity)
20652 * kjs/grammar.y:
20653 * kjs/nodes.cpp:
20654 * kjs/nodes.h:
20655 * kjs/nodes2string.cpp:
20656
20657 2008-01-27 Darin Adler <darin@apple.com>
20658
20659 Reviewed by Oliver.
20660
20661 - fix <rdar://problem/5657450> REGRESSION: const is broken
20662
20663 Test: fast/js/const.html
20664
20665 SunSpider said this was 0.3% slower. And I saw some Shark samples in
20666 JSGlobalObject::put -- not a lot but a few. We may be able to regain the
20667 speed, but for now we will take that small hit for correctness sake.
20668
20669 * kjs/JSGlobalObject.cpp:
20670 (KJS::JSGlobalObject::put): Pass the checkReadOnly flag in to symbolTablePut
20671 instead of passing attributes.
20672
20673 * kjs/JSVariableObject.h:
20674 (KJS::JSVariableObject::symbolTablePut): Removed the code to set attributes
20675 here, since we only set attributes when creating a property. Added the code
20676 to check read-only here, since we need that to implement const!
20677
20678 * kjs/function.cpp:
20679 (KJS::ActivationImp::put): Pass the checkReadOnly flag in to symbolTablePut
20680 instead of passing attributes.
20681
20682 * kjs/nodes.cpp:
20683 (KJS::isConstant): Added.
20684 (KJS::PostIncResolveNode::optimizeVariableAccess): Create a PostIncConstNode
20685 if optimizing for a local variable and the variable is constant.
20686 (KJS::PostDecResolveNode::optimizeVariableAccess): Ditto. But PostDecConstNode.
20687 (KJS::PreIncResolveNode::optimizeVariableAccess): Ditto. But PreIncConstNode.
20688 (KJS::PreDecResolveNode::optimizeVariableAccess): Ditto. But PreDecConstNode.
20689 (KJS::PreIncConstNode::evaluate): Return the value + 1.
20690 (KJS::PreDecConstNode::evaluate): Return the value - 1.
20691 (KJS::PostIncConstNode::evaluate): Return the value converted to a number.
20692 (KJS::PostDecConstNode::evaluate): Ditto.
20693 (KJS::ReadModifyResolveNode::optimizeVariableAccess): Create a ReadModifyConstNode
20694 if optimizing for a local variable and the variable is constant.
20695 (KJS::AssignResolveNode::optimizeVariableAccess): Ditto. But AssignConstNode.
20696 (KJS::ScopeNode::optimizeVariableAccess): Pass the local storage to the
20697 node optimizeVariableAccess functions, since that's where we need to look to
20698 figure out if a variable is constant.
20699 (KJS::FunctionBodyNode::processDeclarations): Moved the call to
20700 optimizeVariableAccess until after localStorage is set up.
20701 (KJS::ProgramNode::processDeclarations): Ditto.
20702
20703 * kjs/nodes.h: Fixed the IsConstant and HasInitializer values. They are used
20704 as flag masks, so a value of 0 will not work for IsConstant. Changed the
20705 first parameter to optimizeVariableAccess to be a const reference to a symbol
20706 table and added a const reference to local storage. Added classes for const
20707 versions of local variable access: PostIncConstNode, PostDecConstNode,
20708 PreIncConstNode, PreDecConstNode, ReadModifyConstNode, and AssignConstNode.
20709
20710 * kjs/object.cpp:
20711 (KJS::JSObject::put): Tweaked comments a bit, and changed the checkReadOnly
20712 expression to match the form used at the two other call sites.
20713
20714 2008-01-27 Darin Adler <darin@apple.com>
20715
20716 Reviewed by Oliver.
20717
20718 - fix http://bugs.webkit.org/show_bug.cgi?id=16498
20719 ''.constructor.toString() gives [function]
20720
20721 Test: fast/js/function-names.html
20722
20723 * kjs/array_object.cpp:
20724 (KJS::ArrayObjectImp::ArrayObjectImp): Use the class name as the constructor's function name.
20725 * kjs/bool_object.cpp:
20726 (KJS::BooleanObjectImp::BooleanObjectImp): Ditto.
20727 * kjs/date_object.cpp:
20728 (KJS::DateObjectImp::DateObjectImp): Ditto.
20729 * kjs/error_object.cpp:
20730 (KJS::ErrorPrototype::ErrorPrototype): Make the error object be an Error.
20731 (KJS::ErrorObjectImp::ErrorObjectImp): Use the class name as the constructor's function name.
20732 (KJS::NativeErrorPrototype::NativeErrorPrototype): Take const UString&.
20733 (KJS::NativeErrorImp::NativeErrorImp): Use the prototype's name as the constructor's function
20734 name.
20735 * kjs/error_object.h: Change ErrorPrototype to inherit from ErrorInstance. Change the
20736 NativeErrorImp constructor to take a NativeErrorPrototype pointer for its prototype.
20737 * kjs/function.h: Removed unneeded constructor for internal functions without names.
20738 We want to avoid those!
20739 * kjs/function_object.cpp:
20740 (KJS::functionProtoFuncToString): Removed code that writes out just [function] for functions
20741 that have no names. There's no reason to do that.
20742 (KJS::FunctionObjectImp::FunctionObjectImp): Use the class name as the constructor's
20743 function name.
20744 * kjs/internal.cpp: Removed the unused constructor.
20745 * kjs/number_object.cpp:
20746 (KJS::fractionalPartToString): Marked static for internal linkage.
20747 (KJS::exponentialPartToString): Ditto.
20748 (KJS::numberProtoFuncToPrecision): Removed an unneeded else.
20749 (KJS::NumberObjectImp::NumberObjectImp): Use the class name as the constructor's
20750 function name.
20751 (KJS::NumberObjectImp::getValueProperty): Tweaked formatting.
20752 * kjs/object_object.cpp:
20753 (KJS::ObjectObjectImp::ObjectObjectImp): Use "Object" for the function name.
20754 * kjs/regexp_object.cpp:
20755 (KJS::RegExpObjectImp::RegExpObjectImp): Use "RegExp" for the function name.
20756 * kjs/string_object.cpp:
20757 (KJS::StringObjectImp::StringObjectImp): Use the class name as the constructor's
20758 function name.
20759
20760 2008-01-26 Darin Adler <darin@apple.com>
20761
20762 Reviewed by Oliver.
20763
20764 - fix http://bugs.webkit.org/show_bug.cgi?id=17027
20765 Incorrect Function.toString behaviour with read/modify/write operators performed on negative numbers
20766
20767 Test: fast/js/function-toString-parentheses.html
20768
20769 The problem here was that a NumberNode with a negative number in it had the wrong
20770 precedence. It's not a primary expression, it's a unary operator with a primary
20771 expression after it.
20772
20773 Once the precedence of NumberNode was fixed, the cases from bug 17020 were also
20774 fixed without trying to treat bracket nodes like dot nodes. That wasn't needed.
20775 The reason we handle numbers before dot nodes specially is that the dot is a
20776 legal character in a number. The same is not true of a bracket. Eventually we
20777 could get smarter, and only add the parentheses when there is actual ambiguity.
20778 There is none if the string form of the number already has a dot in it, or if
20779 it's a number with a alphabetic name like infinity or NAN.
20780
20781 * kjs/nodes.h: Renamed back from ObjectAccess to DotExpr.
20782 (KJS::NumberNode::precedence): Return PrecUnary for negative numbers, since
20783 they serialize as a unary operator, not a primary expression.
20784 * kjs/nodes2string.cpp:
20785 (KJS::SourceStream::operator<<): Clear m_numberNeedsParens if this adds
20786 parens; one set is enough.
20787 (KJS::bracketNodeStreamTo): Remove unneeded special flag here. Normal
20788 operator precedence suffices.
20789 (KJS::NewExprNode::streamTo): Ditto.
20790
20791 2008-01-26 Oliver Hunt <oliver@apple.com>
20792
20793 Reviewed by Maciej and Darin.
20794
20795 Fix for http://bugs.webkit.org/show_bug.cgi?id=17020
20796 Function.toString does not parenthesise numbers for the bracket accessor
20797
20798 It turns out that logic was there for all of the dot accessor nodes to make numbers be
20799 parenthesised properly, so it was a trivial extension to extend that to the bracket nodes.
20800 I renamed the enum type to reflect the fact that it is now used for both dot and bracket
20801 accessors.
20802
20803 * kjs/nodes2string.cpp:
20804 (KJS::bracketNodeStreamTo):
20805 (KJS::BracketAccessorNode::streamTo):
20806
20807 2008-01-26 Oliver Hunt <oliver@apple.com>
20808
20809 Reviewed by Darin.
20810
20811 Fix Bug 17018: Incorrect code generated from Function.toString for get/setters in object literals
20812
20813 Don't quote getter and setter names during output, as that is simply wrong.
20814
20815 * kjs/nodes2string.cpp:
20816 (KJS::PropertyNode::streamTo):
20817
20818 2008-01-26 Darin Adler <darin@apple.com>
20819
20820 Reviewed by Eric Seidel.
20821
20822 - http://bugs.webkit.org/show_bug.cgi?id=16860
20823 a bit of cleanup after the Activation optimization
20824
20825 * JavaScriptCore.exp: Export the GlobalExecState constructor instead of
20826 the global flavor of the ExecState constructor. It'd probably be cleaner
20827 to not export either one, but JSGlobalObject inlines the code that
20828 constructs the ExecState. If we changed that, we could remove this export.
20829
20830 * JavaScriptCore.xcodeproj/project.pbxproj: Re-sorted a few things and
20831 put the new source files into the kjs group rather than at the top level.
20832
20833 * kjs/ExecState.cpp:
20834 (KJS::ExecState::ExecState): Marked inline and updated for data member
20835 name changes. This is now only for use for the derived classes. Also removed
20836 code that sets the unused m_savedExec data member for the global case. That
20837 data member is only used for the other two types.
20838 (KJS::ExecState::~ExecState): Marked inline and removed all the code.
20839 The derived class destructors now inclde the appropriate code.
20840 (KJS::ExecState::lexicalGlobalObject): Removed unneeded special case for
20841 an empty scope chain. The bottom function already returns 0 for that case,
20842 so the general case code handles it fine. Also changed to use data members
20843 directly rather than calling functions.
20844 (KJS::GlobalExecState::GlobalExecState): Added. Calls through to the base
20845 class constructor.
20846 (KJS::GlobalExecState::~GlobalExecState): Added.
20847 (KJS::InterpreterExecState::InterpreterExecState): Added. Moved code to
20848 manipulate activeExecStates here since we don't want to have to check for the
20849 special case of globalExec.
20850 (KJS::InterpreterExecState::~InterpreterExecState): Added.
20851 (KJS::EvalExecState::EvalExecState): Added.
20852 (KJS::EvalExecState::~EvalExecState): Added.
20853 (KJS::FunctionExecState::FunctionExecState): Added.
20854 (KJS::FunctionExecState::~FunctionExecState): Added.
20855
20856 * kjs/ExecState.h: Tweaked the header, includes, and declarations a bit.
20857 Made ExecState inherit from Noncopyable. Reformatted some comments and
20858 made them a bit more brief. Rearranged declarations a little bit and removed
20859 unused savedExec function. Changed seenLabels function to return a reference
20860 rather than a pointer. Made constructors and destructor protected, and also
20861 did the same with all data members. Renamed m_thisVal to m_thisValue and
20862 ls to m_labelStack. Added three new derived classes for each of the
20863 types of ExecState. The primary goal here was to remove a branch from the
20864 code in the destructor, but it's also clearer than overloading the arguments
20865 to the ExecState constructor.
20866
20867 * kjs/JSGlobalObject.cpp:
20868 (KJS::getCurrentTime): Fixed formatting.
20869 (KJS::JSGlobalObject::pushActivation): Removed parentheses that don't make
20870 the expression clearer -- other similar sites didn't have these parentheses,
20871 even the one a couple lines earlier that sets stackEntry.
20872 (KJS::JSGlobalObject::tearOffActivation): Got rid of unneeded static_cast
20873 (I think I mentioned this during patch review) and used an early exit so that
20874 the entire contents of the function aren't nested inside an if statement.
20875 Also removed the check of codeType, instead checking Activation for 0.
20876 For now, I kept the codeType check, but inside an assertion.
20877
20878 * kjs/JSGlobalObject.h: Changed type of globalExec to GlobalExecState.
20879 * kjs/function.cpp:
20880 (KJS::FunctionImp::callAsFunction): Changed type to FunctionExecState.
20881 (KJS::GlobalFuncImp::callAsFunction): Changed type to EvalExecState.
20882 * kjs/interpreter.cpp:
20883 (KJS::Interpreter::evaluate): Changed type to GlobalExecState.
20884
20885 * kjs/nodes.cpp:
20886 (KJS::ContinueNode::execute): Changed code since seenLabels() returns a
20887 reference now instead of a pointer.
20888 (KJS::BreakNode::execute): Ditto.
20889 (KJS::LabelNode::execute): Ditto.
20890
20891 2008-01-26 Sam Weinig <sam@webkit.org>
20892
20893 Reviewed by Mark Rowe.
20894
20895 Cleanup node2string a little.
20896 - Remove some unnecessary branching.
20897 - Factor out bracket and dot streaming into static inline functions.
20898
20899 * kjs/nodes.h:
20900 * kjs/nodes2string.cpp:
20901 (KJS::bracketNodeStreamTo):
20902 (KJS::dotNodeStreamTo):
20903 (KJS::FunctionCallBracketNode::streamTo):
20904 (KJS::FunctionCallDotNode::streamTo):
20905 (KJS::PostIncBracketNode::streamTo):
20906 (KJS::PostDecBracketNode::streamTo):
20907 (KJS::PostIncDotNode::streamTo):
20908 (KJS::PostDecDotNode::streamTo):
20909 (KJS::DeleteBracketNode::streamTo):
20910 (KJS::DeleteDotNode::streamTo):
20911 (KJS::PreIncBracketNode::streamTo):
20912 (KJS::PreDecBracketNode::streamTo):
20913 (KJS::PreIncDotNode::streamTo):
20914 (KJS::PreDecDotNode::streamTo):
20915 (KJS::ReadModifyBracketNode::streamTo):
20916 (KJS::AssignBracketNode::streamTo):
20917 (KJS::ReadModifyDotNode::streamTo):
20918 (KJS::AssignDotNode::streamTo):
20919 (KJS::WhileNode::streamTo):
20920
20921 2008-01-26 Mark Rowe <mrowe@apple.com>
20922
20923 Reviewed by Darin Adler.
20924
20925 Fix http://bugs.webkit.org/show_bug.cgi?id=17001
20926 Bug 17001: Build error with Gtk port on Mac OS X
20927
20928 If both XP_MACOSX and XP_UNIX are defined then X11.h and Carbon.h will both be included.
20929 These provide conflicting definitions for a type named 'Cursor'. As XP_UNIX is set by
20930 the build system when targeting X11, it doesn't make sense for XP_MACOSX to also be set
20931 in this instance.
20932
20933 * bindings/npapi.h: Don't define XP_MACOSX if XP_UNIX is defined.
20934
20935 2008-01-26 Darin Adler <darin@apple.com>
20936
20937 Reviewed by Oliver.
20938
20939 - fix http://bugs.webkit.org/show_bug.cgi?id=17013
20940 JSC can't round trip certain for-loops
20941
20942 Test: fast/js/toString-for-var-decl.html
20943
20944 * kjs/nodes.h: Added PlaceholderTrueNode so we can put nodes into
20945 for loops without injecting the word "true" into them (nice, but not
20946 the bug fix). Fixed ForNode constructor so expr1WasVarDecl is set
20947 only when there is an expression, since it's common for the actual
20948 variable declaration to be moved by the parser.
20949
20950 * kjs/nodes2string.cpp:
20951 (KJS::PlaceholderTrueNode::streamTo): Added. Empty.
20952
20953 2008-01-25 Oliver Hunt <oliver@apple.com>
20954
20955 Reviewed by Maciej.
20956
20957 Fix for bug 17012: REGRESSION: JSC can't round trip an object literal
20958
20959 Add logic to ensure that object literals and function expressions get
20960 parentheses when necessary.
20961
20962 * kjs/nodes.h:
20963 * kjs/nodes2string.cpp:
20964 (KJS::SourceStream::operator<<):
20965
20966 2008-01-24 Steve Falkenburg <sfalken@apple.com>
20967
20968 Build fix.
20969
20970 * JavaScriptCore.vcproj/JavaScriptCore.sln:
20971
20972 2008-01-24 Steve Falkenburg <sfalken@apple.com>
20973
20974 Build fix.
20975
20976 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
20977
20978 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
20979
20980 Reviewed by Simon.
20981
20982 Fix QDateTime to JS Date conversion.
20983 Several conversion errors (some UTC related, some month
20984 offset related) and the conversion distance for Date
20985 to DateTime conversion weights were fixed (it should never
20986 be better to convert a JS Number into a Date rather than
20987 an int).
20988
20989 * bindings/qt/qt_runtime.cpp:
20990 (KJS::Bindings::convertValueToQVariant):
20991 (KJS::Bindings::convertQVariantToValue):
20992
20993 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
20994
20995 Reviewed by Simon.
20996
20997 Add support for calling QObjects.
20998 Add support for invokeDefaultMethod (via a call to
20999 a specific slot), and also allow using it as a
21000 constructor, like QtScript.
21001
21002
21003 * bindings/qt/qt_class.cpp:
21004 (KJS::Bindings::QtClass::fallbackObject):
21005 * bindings/qt/qt_instance.cpp:
21006 (KJS::Bindings::QtRuntimeObjectImp::construct):
21007 (KJS::Bindings::QtInstance::QtInstance):
21008 (KJS::Bindings::QtInstance::~QtInstance):
21009 (KJS::Bindings::QtInstance::implementsCall):
21010 (KJS::Bindings::QtInstance::invokeDefaultMethod):
21011 * bindings/qt/qt_instance.h:
21012 * bindings/qt/qt_runtime.cpp:
21013 (KJS::Bindings::findMethodIndex):
21014 (KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
21015 (KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
21016 * bindings/qt/qt_runtime.h:
21017
21018 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
21019
21020 Reviewed by Simon.
21021
21022 Code style cleanups.
21023 Add spaces before/after braces in inline function.
21024
21025 * bindings/qt/qt_instance.h:
21026
21027 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
21028
21029 Reviewed by Simon.
21030
21031 Code style cleanups.
21032 Remove spaces and unneeded declared parameter names.
21033
21034 * bindings/qt/qt_instance.cpp:
21035 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
21036
21037 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
21038
21039 Reviewed by Simon.
21040
21041 Clear stale RuntimeObjectImps.
21042 Since other objects can have refs to the QtInstance,
21043 we can't rely on the QtInstance being deleted when the
21044 RuntimeObjectImp is invalidate or deleted. This
21045 could result in a stale JSObject being returned for
21046 a valid Instance.
21047
21048 * bindings/qt/qt_instance.cpp:
21049 (KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
21050 (KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
21051 (KJS::Bindings::QtRuntimeObjectImp::invalidate):
21052 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
21053 (KJS::Bindings::QtInstance::getRuntimeObject):
21054 * bindings/runtime.cpp:
21055 (KJS::Bindings::Instance::createRuntimeObject):
21056 * bindings/runtime.h:
21057
21058 2008-01-23 Alp Toker <alp@atoker.com>
21059
21060 Rubber-stamped by Mark Rowe.
21061
21062 Remove whitespace after -I in automake include lists.
21063
21064 * GNUmakefile.am:
21065
21066 2008-01-23 Michael Goddard <michael.goddard@trolltech.com>
21067
21068 Reviewed by Lars Knoll <lars@trolltech.com>.
21069
21070 Reworked the JavaScriptCore Qt bindings:
21071
21072 * Add initial support for string and variant arrays, as well
21073 as sub QObjects in the JS bindings.
21074
21075 * Don't expose fields marked as not scriptable by moc.
21076
21077 * Add support for dynamic properties and accessing named
21078 QObject children of an object (like QtScript and older
21079 IE DOM style JS).
21080 * Add support for custom toString methods.
21081
21082 * Fine tune some bindings to be closer to QtScript.
21083 Make void functions return undefined, and empty/
21084 null QStrings return a zero length string.
21085
21086 * Create framework for allowing more direct method calls.
21087 Since RuntimeMethod doesn't allow us to add additional
21088 methods/properties to a function, add these classes.
21089 Start prototyping object.signal.connect(...).
21090
21091 * Add signal support to the Qt bindings.
21092 Allow connecting to signals (object.signal.connect(slot)),
21093 disconnecting, and emitting signals. Currently chooses
21094 the first signal that matches the name, so this will need
21095 improvement.
21096
21097 * Add property names, and resolve signals closer to use.
21098 Enumerating properties now returns some of the Qt properties
21099 and signals. Slots and methods aren't quite present. Also,
21100 resolve signal connections etc. closer to the time of use, so
21101 we can do more dynamic resolution based on argument type etc.
21102 Still picks the first one with the same name, at the moment.
21103
21104 * Make signature comparison code consistent.
21105 Use the same code for checking meta signatures in
21106 the method and fallback getters, and avoid a
21107 QByteArray construction when we can.
21108
21109 * Fix minor memory leak, and handle pointers better.
21110 Delete the private object in the dtors, and use RefPtrs
21111 for holding Instances etc.
21112
21113 * Handle method lookup better.
21114 Allow invocation time method lookup based on the arguments,
21115 which is closer to QtScript behaviour. Also, cache the
21116 method lists and delete them in the QtClass dtor (stops
21117 a memory leak).
21118
21119 * Improve JS to Qt data type conversions.
21120 Add some support for Date & RegExp JS objects,
21121 and provide some metrics on the quality of the
21122 conversion.
21123
21124 * A couple of fixes for autotest failures.
21125 Better support for converting lists, read/write only
21126 QMetaProperty support, modified slot search order...)
21127
21128 * bindings/qt/qt_class.cpp:
21129 (KJS::Bindings::QtClass::QtClass):
21130 (KJS::Bindings::QtClass::~QtClass):
21131 (KJS::Bindings::QtClass::name):
21132 (KJS::Bindings::QtClass::fallbackObject):
21133 (KJS::Bindings::QtClass::methodsNamed):
21134 (KJS::Bindings::QtClass::fieldNamed):
21135 * bindings/qt/qt_class.h:
21136 * bindings/qt/qt_instance.cpp:
21137 (KJS::Bindings::QtInstance::QtInstance):
21138 (KJS::Bindings::QtInstance::~QtInstance):
21139 (KJS::Bindings::QtInstance::getRuntimeObject):
21140 (KJS::Bindings::QtInstance::getClass):
21141 (KJS::Bindings::QtInstance::implementsCall):
21142 (KJS::Bindings::QtInstance::getPropertyNames):
21143 (KJS::Bindings::QtInstance::invokeMethod):
21144 (KJS::Bindings::QtInstance::invokeDefaultMethod):
21145 (KJS::Bindings::QtInstance::stringValue):
21146 (KJS::Bindings::QtInstance::booleanValue):
21147 (KJS::Bindings::QtInstance::valueOf):
21148 (KJS::Bindings::QtField::name):
21149 (KJS::Bindings::QtField::valueFromInstance):
21150 (KJS::Bindings::QtField::setValueToInstance):
21151 * bindings/qt/qt_instance.h:
21152 (KJS::Bindings::QtInstance::getBindingLanguage):
21153 (KJS::Bindings::QtInstance::getObject):
21154 * bindings/qt/qt_runtime.cpp:
21155 (KJS::Bindings::QWKNoDebug::QWKNoDebug):
21156 (KJS::Bindings::QWKNoDebug::~QWKNoDebug):
21157 (KJS::Bindings::QWKNoDebug::operator<<):
21158 (KJS::Bindings::):
21159 (KJS::Bindings::valueRealType):
21160 (KJS::Bindings::convertValueToQVariant):
21161 (KJS::Bindings::convertQVariantToValue):
21162 (KJS::Bindings::QtRuntimeMethod::QtRuntimeMethod):
21163 (KJS::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
21164 (KJS::Bindings::QtRuntimeMethod::codeType):
21165 (KJS::Bindings::QtRuntimeMethod::execute):
21166 (KJS::Bindings::QtRuntimeMethodData::~QtRuntimeMethodData):
21167 (KJS::Bindings::QtRuntimeMetaMethodData::~QtRuntimeMetaMethodData):
21168 (KJS::Bindings::QtRuntimeConnectionMethodData::~QtRuntimeConnectionMethodData):
21169 (KJS::Bindings::QtMethodMatchType::):
21170 (KJS::Bindings::QtMethodMatchType::QtMethodMatchType):
21171 (KJS::Bindings::QtMethodMatchType::kind):
21172 (KJS::Bindings::QtMethodMatchType::isValid):
21173 (KJS::Bindings::QtMethodMatchType::isVariant):
21174 (KJS::Bindings::QtMethodMatchType::isMetaType):
21175 (KJS::Bindings::QtMethodMatchType::isUnresolved):
21176 (KJS::Bindings::QtMethodMatchType::isMetaEnum):
21177 (KJS::Bindings::QtMethodMatchType::enumeratorIndex):
21178 (KJS::Bindings::QtMethodMatchType::variant):
21179 (KJS::Bindings::QtMethodMatchType::metaType):
21180 (KJS::Bindings::QtMethodMatchType::metaEnum):
21181 (KJS::Bindings::QtMethodMatchType::unresolved):
21182 (KJS::Bindings::QtMethodMatchType::typeId):
21183 (KJS::Bindings::QtMethodMatchType::name):
21184 (KJS::Bindings::QtMethodMatchData::QtMethodMatchData):
21185 (KJS::Bindings::QtMethodMatchData::isValid):
21186 (KJS::Bindings::QtMethodMatchData::firstUnresolvedIndex):
21187 (KJS::Bindings::indexOfMetaEnum):
21188 (KJS::Bindings::findMethodIndex):
21189 (KJS::Bindings::findSignalIndex):
21190 (KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
21191 (KJS::Bindings::QtRuntimeMetaMethod::mark):
21192 (KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
21193 (KJS::Bindings::QtRuntimeMetaMethod::getOwnPropertySlot):
21194 (KJS::Bindings::QtRuntimeMetaMethod::lengthGetter):
21195 (KJS::Bindings::QtRuntimeMetaMethod::connectGetter):
21196 (KJS::Bindings::QtRuntimeMetaMethod::disconnectGetter):
21197 (KJS::Bindings::QtRuntimeConnectionMethod::QtRuntimeConnectionMethod):
21198 (KJS::Bindings::QtRuntimeConnectionMethod::callAsFunction):
21199 (KJS::Bindings::QtRuntimeConnectionMethod::getOwnPropertySlot):
21200 (KJS::Bindings::QtRuntimeConnectionMethod::lengthGetter):
21201 (KJS::Bindings::QtConnectionObject::QtConnectionObject):
21202 (KJS::Bindings::QtConnectionObject::~QtConnectionObject):
21203 (KJS::Bindings::QtConnectionObject::metaObject):
21204 (KJS::Bindings::QtConnectionObject::qt_metacast):
21205 (KJS::Bindings::QtConnectionObject::qt_metacall):
21206 (KJS::Bindings::QtConnectionObject::execute):
21207 (KJS::Bindings::QtConnectionObject::match):
21208 (KJS::Bindings::::QtArray):
21209 (KJS::Bindings::::~QtArray):
21210 (KJS::Bindings::::rootObject):
21211 (KJS::Bindings::::setValueAt):
21212 (KJS::Bindings::::valueAt):
21213 * bindings/qt/qt_runtime.h:
21214 (KJS::Bindings::QtField::):
21215 (KJS::Bindings::QtField::QtField):
21216 (KJS::Bindings::QtField::fieldType):
21217 (KJS::Bindings::QtMethod::QtMethod):
21218 (KJS::Bindings::QtMethod::name):
21219 (KJS::Bindings::QtMethod::numParameters):
21220 (KJS::Bindings::QtArray::getLength):
21221 (KJS::Bindings::QtRuntimeMethod::d_func):
21222 (KJS::Bindings::QtRuntimeMetaMethod::d_func):
21223 (KJS::Bindings::QtRuntimeConnectionMethod::d_func):
21224 (KJS::Bindings::):
21225 * bindings/runtime.cpp:
21226 (KJS::Bindings::Instance::createBindingForLanguageInstance):
21227 (KJS::Bindings::Instance::createRuntimeObject):
21228 (KJS::Bindings::Instance::reallyCreateRuntimeObject):
21229 * bindings/runtime.h:
21230
21231 2008-01-22 Anders Carlsson <andersca@apple.com>
21232
21233 Reviewed by Darin and Adam.
21234
21235 <rdar://problem/5688975>
21236 div element on microsoft site has wrong left offset.
21237
21238 Return true even if NPN_GetProperty returns null or undefined. This matches Firefox
21239 (and is what the Silverlight plug-in expects).
21240
21241 * bindings/NP_jsobject.cpp:
21242 (_NPN_GetProperty):
21243
21244 2008-01-21 Geoffrey Garen <ggaren@apple.com>
21245
21246 Reviewed by Maciej Stachowiak.
21247
21248 Fixed http://bugs.webkit.org/show_bug.cgi?id=16909
21249 REGRESSION: Amazon.com crash (ActivationImp)
21250
21251 (and a bunch of other crashes)
21252
21253 Plus, a .7% SunSpider speedup to boot.
21254
21255 Replaced the buggy currentExec and savedExec mechanisms with an
21256 explicit ExecState stack.
21257
21258 * kjs/collector.cpp:
21259 (KJS::Collector::collect): Explicitly mark the ExecState stack.
21260
21261 (KJS::Collector::reportOutOfMemoryToAllExecStates): Slight change in
21262 behavior: We no longer throw an exception in any global ExecStates,
21263 since global ExecStates are more like pseudo-ExecStates, and aren't
21264 used for script execution. (It's unclear what would happen if you left
21265 an exception waiting around in a global ExecState, but it probably
21266 wouldn't be good.)
21267
21268 2008-01-21 Jan Michael Alonzo <jmalonzo@unpluggable.com>
21269
21270 Reviewed by Alp Toker.
21271
21272 http://bugs.webkit.org/show_bug.cgi?id=16955
21273 Get errors when cross-compile webkit-gtk
21274
21275 * GNUmakefile.am: removed ICU_CFLAGS
21276
21277 2008-01-18 Kevin McCullough <kmccullough@apple.com>
21278
21279 - Build fix.
21280
21281 * kjs/ustring.h:
21282
21283 2008-01-18 Kevin McCullough <kmccullough@apple.com>
21284
21285 - Build fix.
21286
21287 * kjs/ustring.cpp:
21288 * kjs/ustring.h:
21289 (KJS::UString::cost):
21290
21291 2008-01-18 Kevin McCullough <kmccullough@apple.com>
21292
21293 Reviewed by Geoff.
21294
21295 - Correctly report cost of appended strings to trigger GC.
21296
21297 * kjs/ustring.cpp:
21298 (KJS::UString::Rep::create):
21299 (KJS::UString::UString): Don't create unnecssary objects.
21300 (KJS::UString::cost): Report cost if necessary but also keep track of
21301 reported cost.
21302 * kjs/ustring.h:
21303
21304 2008-01-18 Simon Hausmann <hausmann@webkit.org>
21305
21306 Reviewed by Holger.
21307
21308 Fix return type conversions from Qt slots to JS values.
21309
21310 This also fixes fast/dom/open-and-close-by-DOM.html, which called
21311 layoutTestController.windowCount().
21312
21313 When constructing the QVariant that holds the return type we cannot
21314 use the QVarian(Type) constuctor as that will create a null variant.
21315 We have to use the QVariant(Type, void *) constructor instead, just
21316 like in QMetaObject::read() for example.
21317
21318
21319 * bindings/qt/qt_instance.cpp:
21320 (KJS::Bindings::QtInstance::getRuntimeObject):
21321
21322 2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
21323
21324 Reviewed by Simon Hausmann <hausmann@webkit.org>.
21325
21326 Fix compilation on Win64(2): Implemented currentThreadStackBase on X86-64 on Windows
21327
21328
21329 * kjs/collector.cpp:
21330 (KJS::Collector::heapAllocate):
21331
21332 2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
21333
21334 Reviewed by Simon Hausmann <hausmann@webkit.org>.
21335
21336 Fix compilation on Win64(1): Define WTF_PLATFORM_X86_64 correctly on Win64.
21337
21338
21339 * wtf/Platform.h:
21340
21341 2008-01-17 Antti Koivisto <antti@apple.com>
21342
21343 Fix Windows build.
21344
21345 * kjs/regexp_object.cpp:
21346 (KJS::regExpProtoFuncToString):
21347
21348 2008-01-16 Sam Weinig <sam@webkit.org>
21349
21350 Reviewed by Darin.
21351
21352 Fix for http://bugs.webkit.org/show_bug.cgi?id=16901
21353 Convert remaining JS function objects to use the new PrototypeFunction class
21354
21355 - Moves Boolean, Function, RegExp, Number, Object and Global functions to their
21356 own static function implementations so that they can be used with the
21357 PrototypeFunction class. SunSpider says this is 1.003x as fast.
21358
21359 * kjs/JSGlobalObject.cpp:
21360 (KJS::JSGlobalObject::reset):
21361 * kjs/array_object.h:
21362 * kjs/bool_object.cpp:
21363 (KJS::BooleanInstance::BooleanInstance):
21364 (KJS::BooleanPrototype::BooleanPrototype):
21365 (KJS::booleanProtoFuncToString):
21366 (KJS::booleanProtoFuncValueOf):
21367 (KJS::BooleanObjectImp::BooleanObjectImp):
21368 (KJS::BooleanObjectImp::implementsConstruct):
21369 (KJS::BooleanObjectImp::construct):
21370 (KJS::BooleanObjectImp::callAsFunction):
21371 * kjs/bool_object.h:
21372 (KJS::BooleanInstance::classInfo):
21373 * kjs/error_object.cpp:
21374 (KJS::ErrorPrototype::ErrorPrototype):
21375 (KJS::errorProtoFuncToString):
21376 * kjs/error_object.h:
21377 * kjs/function.cpp:
21378 (KJS::globalFuncEval):
21379 (KJS::globalFuncParseInt):
21380 (KJS::globalFuncParseFloat):
21381 (KJS::globalFuncIsNaN):
21382 (KJS::globalFuncIsFinite):
21383 (KJS::globalFuncDecodeURI):
21384 (KJS::globalFuncDecodeURIComponent):
21385 (KJS::globalFuncEncodeURI):
21386 (KJS::globalFuncEncodeURIComponent):
21387 (KJS::globalFuncEscape):
21388 (KJS::globalFuncUnEscape):
21389 (KJS::globalFuncKJSPrint):
21390 (KJS::PrototypeFunction::PrototypeFunction):
21391 * kjs/function.h:
21392 * kjs/function_object.cpp:
21393 (KJS::FunctionPrototype::FunctionPrototype):
21394 (KJS::functionProtoFuncToString):
21395 (KJS::functionProtoFuncApply):
21396 (KJS::functionProtoFuncCall):
21397 * kjs/function_object.h:
21398 * kjs/number_object.cpp:
21399 (KJS::NumberPrototype::NumberPrototype):
21400 (KJS::numberProtoFuncToString):
21401 (KJS::numberProtoFuncToLocaleString):
21402 (KJS::numberProtoFuncValueOf):
21403 (KJS::numberProtoFuncToFixed):
21404 (KJS::numberProtoFuncToExponential):
21405 (KJS::numberProtoFuncToPrecision):
21406 * kjs/number_object.h:
21407 (KJS::NumberInstance::classInfo):
21408 (KJS::NumberObjectImp::classInfo):
21409 (KJS::NumberObjectImp::):
21410 * kjs/object_object.cpp:
21411 (KJS::ObjectPrototype::ObjectPrototype):
21412 (KJS::objectProtoFuncValueOf):
21413 (KJS::objectProtoFuncHasOwnProperty):
21414 (KJS::objectProtoFuncIsPrototypeOf):
21415 (KJS::objectProtoFuncDefineGetter):
21416 (KJS::objectProtoFuncDefineSetter):
21417 (KJS::objectProtoFuncLookupGetter):
21418 (KJS::objectProtoFuncLookupSetter):
21419 (KJS::objectProtoFuncPropertyIsEnumerable):
21420 (KJS::objectProtoFuncToLocaleString):
21421 (KJS::objectProtoFuncToString):
21422 * kjs/object_object.h:
21423 * kjs/regexp_object.cpp:
21424 (KJS::RegExpPrototype::RegExpPrototype):
21425 (KJS::regExpProtoFuncTest):
21426 (KJS::regExpProtoFuncExec):
21427 (KJS::regExpProtoFuncCompile):
21428 (KJS::regExpProtoFuncToString):
21429 * kjs/regexp_object.h:
21430
21431 2008-01-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
21432
21433 Reviewed by Maciej & Darin.
21434
21435 Fixes Bug 16868: Gmail crash
21436 and Bug 16871: Crash when loading apple.com/startpage
21437
21438 <http://bugs.webkit.org/show_bug.cgi?id=16868>
21439 <rdar://problem/5686108>
21440
21441 <http://bugs.webkit.org/show_bug.cgi?id=16871>
21442 <rdar://problem/5686670>
21443
21444 Adds ActivationImp tear-off for cross-window eval() and fixes an
21445 existing garbage collection issue exposed by the ActivationImp tear-off
21446 patch (r29425) that can occur when an ExecState's m_callingExec is
21447 different than its m_savedExec.
21448
21449 * kjs/ExecState.cpp:
21450 (KJS::ExecState::mark):
21451 * kjs/function.cpp:
21452 (KJS::GlobalFuncImp::callAsFunction):
21453
21454 2008-01-16 Sam Weinig <sam@webkit.org>
21455
21456 Reviewed by Oliver.
21457
21458 Clean up MathObjectImp, it needed a little scrubbing.
21459
21460 * kjs/math_object.cpp:
21461 (KJS::MathObjectImp::MathObjectImp):
21462 (KJS::MathObjectImp::getOwnPropertySlot):
21463 (KJS::MathObjectImp::getValueProperty):
21464 (KJS::mathProtoFuncACos):
21465 (KJS::mathProtoFuncASin):
21466 (KJS::mathProtoFuncATan):
21467 (KJS::mathProtoFuncATan2):
21468 (KJS::mathProtoFuncCos):
21469 (KJS::mathProtoFuncExp):
21470 (KJS::mathProtoFuncLog):
21471 (KJS::mathProtoFuncSin):
21472 (KJS::mathProtoFuncSqrt):
21473 (KJS::mathProtoFuncTan):
21474 * kjs/math_object.h:
21475 (KJS::MathObjectImp::classInfo):
21476 (KJS::MathObjectImp::):
21477
21478 2008-01-16 Sam Weinig <sam@webkit.org>
21479
21480 Reviewed by Geoffrey Garen.
21481
21482 Rename Lexer variable bol to atLineStart.
21483
21484 * kjs/lexer.cpp:
21485 (KJS::Lexer::Lexer):
21486 (KJS::Lexer::setCode):
21487 (KJS::Lexer::nextLine):
21488 (KJS::Lexer::lex):
21489 * kjs/lexer.h:
21490
21491 2008-01-16 Sam Weinig <sam@webkit.org>
21492
21493 Reviewed by Geoffrey Garen and Anders Carlsson.
21494
21495 Remove uses of KJS_PURE_ECMA as we don't ever build with it defined,
21496 and we have many features that are not included in the ECMA spec.
21497
21498 * kjs/lexer.cpp:
21499 (KJS::Lexer::Lexer):
21500 (KJS::Lexer::setCode):
21501 (KJS::Lexer::nextLine):
21502 (KJS::Lexer::lex):
21503 * kjs/lexer.h:
21504 * kjs/string_object.cpp:
21505 * kjs/string_object.h:
21506
21507 2008-01-15 Sam Weinig <sam@webkit.org>
21508
21509 Reviewed by Geoffrey Garen.
21510
21511 Fix <rdar://problem/5595552> r27608 introduced a 20% increase in JS binary size, 4% increase in WebCore binary size
21512
21513 - This changes the way JS functions that use Lookup tables are handled. Instead of using
21514 one class per function, which allowed specialization of the virtual callAsFunction
21515 method, we now use one class, PrototypeFunction, which takes a pointer to a static
21516 function to use as the implementation. This significantly decreases the binary size
21517 of JavaScriptCore (about 145k on an Intel only build) while still keeping some of the
21518 speedup r27608 garnered (SunSpider says this is 1.005x as slow, which should leave some
21519 wiggle room from the original 1% speedup) and keeps the functions implementations in separate
21520 functions to help with optimizations.
21521
21522 * JavaScriptCore.exp:
21523 * JavaScriptCore.xcodeproj/project.pbxproj:
21524 * kjs/array_object.cpp:
21525 (KJS::arrayProtoFuncToString):
21526 (KJS::arrayProtoFuncToLocaleString):
21527 (KJS::arrayProtoFuncJoin):
21528 (KJS::arrayProtoFuncConcat):
21529 (KJS::arrayProtoFuncPop):
21530 (KJS::arrayProtoFuncPush):
21531 (KJS::arrayProtoFuncReverse):
21532 (KJS::arrayProtoFuncShift):
21533 (KJS::arrayProtoFuncSlice):
21534 (KJS::arrayProtoFuncSort):
21535 (KJS::arrayProtoFuncSplice):
21536 (KJS::arrayProtoFuncUnShift):
21537 (KJS::arrayProtoFuncFilter):
21538 (KJS::arrayProtoFuncMap):
21539 (KJS::arrayProtoFuncEvery):
21540 (KJS::arrayProtoFuncForEach):
21541 (KJS::arrayProtoFuncSome):
21542 (KJS::arrayProtoFuncIndexOf):
21543 (KJS::arrayProtoFuncLastIndexOf):
21544 * kjs/array_object.h:
21545 * kjs/date_object.cpp:
21546 (KJS::DatePrototype::getOwnPropertySlot):
21547 (KJS::dateProtoFuncToString):
21548 (KJS::dateProtoFuncToUTCString):
21549 (KJS::dateProtoFuncToDateString):
21550 (KJS::dateProtoFuncToTimeString):
21551 (KJS::dateProtoFuncToLocaleString):
21552 (KJS::dateProtoFuncToLocaleDateString):
21553 (KJS::dateProtoFuncToLocaleTimeString):
21554 (KJS::dateProtoFuncValueOf):
21555 (KJS::dateProtoFuncGetTime):
21556 (KJS::dateProtoFuncGetFullYear):
21557 (KJS::dateProtoFuncGetUTCFullYear):
21558 (KJS::dateProtoFuncToGMTString):
21559 (KJS::dateProtoFuncGetMonth):
21560 (KJS::dateProtoFuncGetUTCMonth):
21561 (KJS::dateProtoFuncGetDate):
21562 (KJS::dateProtoFuncGetUTCDate):
21563 (KJS::dateProtoFuncGetDay):
21564 (KJS::dateProtoFuncGetUTCDay):
21565 (KJS::dateProtoFuncGetHours):
21566 (KJS::dateProtoFuncGetUTCHours):
21567 (KJS::dateProtoFuncGetMinutes):
21568 (KJS::dateProtoFuncGetUTCMinutes):
21569 (KJS::dateProtoFuncGetSeconds):
21570 (KJS::dateProtoFuncGetUTCSeconds):
21571 (KJS::dateProtoFuncGetMilliSeconds):
21572 (KJS::dateProtoFuncGetUTCMilliseconds):
21573 (KJS::dateProtoFuncGetTimezoneOffset):
21574 (KJS::dateProtoFuncSetTime):
21575 (KJS::dateProtoFuncSetMilliSeconds):
21576 (KJS::dateProtoFuncSetUTCMilliseconds):
21577 (KJS::dateProtoFuncSetSeconds):
21578 (KJS::dateProtoFuncSetUTCSeconds):
21579 (KJS::dateProtoFuncSetMinutes):
21580 (KJS::dateProtoFuncSetUTCMinutes):
21581 (KJS::dateProtoFuncSetHours):
21582 (KJS::dateProtoFuncSetUTCHours):
21583 (KJS::dateProtoFuncSetDate):
21584 (KJS::dateProtoFuncSetUTCDate):
21585 (KJS::dateProtoFuncSetMonth):
21586 (KJS::dateProtoFuncSetUTCMonth):
21587 (KJS::dateProtoFuncSetFullYear):
21588 (KJS::dateProtoFuncSetUTCFullYear):
21589 (KJS::dateProtoFuncSetYear):
21590 (KJS::dateProtoFuncGetYear):
21591 * kjs/date_object.h:
21592 * kjs/function.cpp:
21593 (KJS::PrototypeFunction::PrototypeFunction):
21594 (KJS::PrototypeFunction::callAsFunction):
21595 * kjs/function.h:
21596 * kjs/lookup.h:
21597 (KJS::HashEntry::):
21598 (KJS::staticFunctionGetter):
21599 * kjs/math_object.cpp:
21600 (KJS::mathProtoFuncAbs):
21601 (KJS::mathProtoFuncACos):
21602 (KJS::mathProtoFuncASin):
21603 (KJS::mathProtoFuncATan):
21604 (KJS::mathProtoFuncATan2):
21605 (KJS::mathProtoFuncCeil):
21606 (KJS::mathProtoFuncCos):
21607 (KJS::mathProtoFuncExp):
21608 (KJS::mathProtoFuncFloor):
21609 (KJS::mathProtoFuncLog):
21610 (KJS::mathProtoFuncMax):
21611 (KJS::mathProtoFuncMin):
21612 (KJS::mathProtoFuncPow):
21613 (KJS::mathProtoFuncRandom):
21614 (KJS::mathProtoFuncRound):
21615 (KJS::mathProtoFuncSin):
21616 (KJS::mathProtoFuncSqrt):
21617 (KJS::mathProtoFuncTan):
21618 * kjs/math_object.h:
21619 * kjs/string_object.cpp:
21620 (KJS::stringProtoFuncToString):
21621 (KJS::stringProtoFuncValueOf):
21622 (KJS::stringProtoFuncCharAt):
21623 (KJS::stringProtoFuncCharCodeAt):
21624 (KJS::stringProtoFuncConcat):
21625 (KJS::stringProtoFuncIndexOf):
21626 (KJS::stringProtoFuncLastIndexOf):
21627 (KJS::stringProtoFuncMatch):
21628 (KJS::stringProtoFuncSearch):
21629 (KJS::stringProtoFuncReplace):
21630 (KJS::stringProtoFuncSlice):
21631 (KJS::stringProtoFuncSplit):
21632 (KJS::stringProtoFuncSubstr):
21633 (KJS::stringProtoFuncSubstring):
21634 (KJS::stringProtoFuncToLowerCase):
21635 (KJS::stringProtoFuncToUpperCase):
21636 (KJS::stringProtoFuncToLocaleLowerCase):
21637 (KJS::stringProtoFuncToLocaleUpperCase):
21638 (KJS::stringProtoFuncLocaleCompare):
21639 (KJS::stringProtoFuncBig):
21640 (KJS::stringProtoFuncSmall):
21641 (KJS::stringProtoFuncBlink):
21642 (KJS::stringProtoFuncBold):
21643 (KJS::stringProtoFuncFixed):
21644 (KJS::stringProtoFuncItalics):
21645 (KJS::stringProtoFuncStrike):
21646 (KJS::stringProtoFuncSub):
21647 (KJS::stringProtoFuncSup):
21648 (KJS::stringProtoFuncFontcolor):
21649 (KJS::stringProtoFuncFontsize):
21650 (KJS::stringProtoFuncAnchor):
21651 (KJS::stringProtoFuncLink):
21652 * kjs/string_object.h:
21653
21654 2008-01-15 Geoffrey Garen <ggaren@apple.com>
21655
21656 Reviewed by Adam Roben.
21657
21658 Some tweaks to our headerdoc, suggested by David Gatwood on the docs
21659 team.
21660
21661 * API/JSBase.h:
21662 * API/JSObjectRef.h:
21663 * API/JSStringRef.h:
21664 * API/JSValueRef.h:
21665
21666 2008-01-15 Alp Toker <alp@atoker.com>
21667
21668 Rubber-stamped by Anders.
21669
21670 Make the HTTP backend configurable in the GTK+ port. curl is currently
21671 the only option.
21672
21673 * wtf/Platform.h: Don't hard-code WTF_USE_CURL for GTK
21674
21675 2008-01-15 Sam Weinig <sam@webkit.org>
21676
21677 Reviewed by Beth Dakin.
21678
21679 Remove unneeded variable.
21680
21681 * kjs/string_object.cpp:
21682 (KJS::StringProtoFuncSubstr::callAsFunction):
21683
21684 2008-01-14 Steve Falkenburg <sfalken@apple.com>
21685
21686 Use shared vsprops for most vcproj properties.
21687
21688 Reviewed by Darin.
21689
21690 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add missing Debug_Internal config.
21691 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add missing Debug_Internal config.
21692 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
21693
21694 2008-01-14 Adam Roben <aroben@apple.com>
21695
21696 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
21697 some headers that were missing from the vcproj so their contents will
21698 be included in Find in Files.
21699
21700 2008-01-14 Adam Roben <aroben@apple.com>
21701
21702 Fix Bug 16871: Crash when loading apple.com/startpage
21703
21704 <http://bugs.webkit.org/show_bug.cgi?id=16871>
21705 <rdar://problem/5686670>
21706
21707 Patch written by Darin, reviewed by me.
21708
21709 * kjs/ExecState.cpp:
21710 (KJS::ExecState::mark): Call ActivationImp::markChildren if our
21711 m_activation is on the stack. This is what ScopeChain::mark also does,
21712 but apparently in some cases it's possible for an ExecState's
21713 ActivationImp to not be in any ScopeChain.
21714
21715 2008-01-14 Kevin McCullough <kmccullough@apple.com>
21716
21717 Reviewed by Oliver.
21718
21719 -<rdar://problem/5622667> REGRESSION (Leopard-ToT): Endless loading loop
21720 trying to view techreport.com comments
21721 - We need to set values in the map, because if they are already in the
21722 map they will not be reset when we use add().
21723
21724 * kjs/array_instance.cpp:
21725 (KJS::ArrayInstance::put):
21726
21727 2008-01-14 Darin Adler <darin@apple.com>
21728
21729 Reviewed by Adam.
21730
21731 - re-speed-up the page load test (my StringImpl change slowed it down)
21732
21733 * wtf/RefCounted.h:
21734 (WTF::RefCounted::RefCounted): Allow derived classes to start with a reference
21735 count other than 0. Eventually everyone will want to start with a 1. This is a
21736 staged change. For now, there's a default of 0, and you can specify 1. Later,
21737 there will be no default and everyone will have to specify. And then later, there
21738 will be a default of 1. Eventually, we can take away even the option of starting
21739 with 0!
21740
21741 * wtf/Vector.h:
21742 (WTF::Vector::Vector): Sped up creation of non-empty vectors by removing the
21743 overhead of first constructing something empty and then calling resize.
21744 (WTF::Vector::clear): Sped up the common case of calling clear on an empty
21745 vector by adding a check for that case.
21746 (WTF::Vector::releaseBuffer): Marked this function inline and removed a branch
21747 in the case of vectors with no inline capacity (normal vectors) by leaving out
21748 the code to copy the inline buffer in that case.
21749
21750 2008-01-14 Alexey Proskuryakov <ap@webkit.org>
21751
21752 Reviewed by David Kilzer.
21753
21754 http://bugs.webkit.org/show_bug.cgi?id=16787
21755 array.splice() with 1 element not working
21756
21757 Test: fast/js/array-splice.html
21758
21759 * kjs/array_object.cpp:
21760 (KJS::ArrayProtoFuncSplice::callAsFunction): Implement this Mozilla extension, and fix
21761 some other edge cases.
21762
21763 2008-01-13 Steve Falkenburg <sfalken@apple.com>
21764
21765 Share common files across projects.
21766
21767 Unify vsprops files
21768 Debug: common.vsprops, debug.vsprops
21769 Debug_Internal: common.vsprops, debug.vsprops, debug_internal.vsprops
21770 Release: common.vsprops, release.vsprops
21771
21772 Shared properties can go into common.vsprops, shared debug settings can go into debug.vsprops.
21773 debug_internal.vsprops will be mostly empty except for file path prefix modifiers.
21774
21775 Reviewed by Adam Roben.
21776
21777 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
21778 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
21779 * JavaScriptCore.vcproj/debug.vsprops: Removed.
21780 * JavaScriptCore.vcproj/debug_internal.vsprops: Removed.
21781 * JavaScriptCore.vcproj/release.vsprops: Removed.
21782 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
21783
21784 2008-01-13 Marius Bugge Monsen <mbm@trolltech.com>
21785
21786 Contributions and review by Adriaan de Groot,
21787 Simon Hausmann, Eric Seidel, and Darin Adler.
21788
21789 - http://bugs.webkit.org/show_bug.cgi?id=16590
21790 Compilation fixes for Solaris.
21791
21792 * kjs/DateMath.h:
21793 (KJS::GregorianDateTime::GregorianDateTime): Use the WIN_OS code path
21794 for SOLARIS too, presumably because Solaris also lacks the tm_gtoff and tm_zone
21795 fields.
21796 (KJS::GregorianDateTime::operator tm): Ditto.
21797
21798 * kjs/collector.cpp:
21799 (KJS::currentThreadStackBase): Use thr_stksegment on Solaris.
21800
21801 * wtf/MathExtras.h:
21802 (isfinite): Implement for Solaris.
21803 (isinf): Ditto.
21804 (signbit): Ditto. But this one is wrong, so I added a FIXME.
21805
21806 * wtf/Platform.h: Define PLATFORM(SOLARIS) when "sun" or "__sun" is defined.
21807
21808 2008-01-13 Michael Goddard <michael.goddard@trolltech.com>
21809
21810 Reviewed by Anders Carlsson.
21811
21812 Add binding language type to Instance.
21813 Allows runtime determination of the type of an
21814 Instance, to allow safe casting. Doesn't actually
21815 add any safe casting yet, though.
21816
21817 Add a helper function to get an Instance from a JSObject*.
21818 Given an object and the expected binding language, see if
21819 the JSObject actually wraps an Instance of the given type
21820 and return it. Otherwise return 0.
21821
21822 Move RuntimeObjectImp creations into Instance.
21823 Make the ctor protected, and Instance a friend class, so
21824 that all creation of RuntimeObjectImps goes through
21825 one place.
21826
21827 Remove copy ctor/assignment operator for QtInstance.
21828 Instance itself is Noncopyable, so QtInstance doesn't
21829 need to have these.
21830
21831 Add caching for QtInstance and associated RuntimeObjectImps.
21832 Push any dealings with QtLanguage bindings into QtInstance,
21833 and cache them there, rather than in the Instance layer. Add
21834 a QtRuntimeObjectImp to help with caching.
21835
21836 * JavaScriptCore.exp:
21837 * bindings/c/c_instance.h:
21838 * bindings/jni/jni_instance.h:
21839 * bindings/objc/objc_instance.h:
21840 * bindings/qt/qt_instance.cpp:
21841 (KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
21842 (KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
21843 (KJS::Bindings::QtRuntimeObjectImp::invalidate):
21844 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
21845 (KJS::Bindings::QtInstance::QtInstance):
21846 (KJS::Bindings::QtInstance::~QtInstance):
21847 (KJS::Bindings::QtInstance::getQtInstance):
21848 (KJS::Bindings::QtInstance::getRuntimeObject):
21849 * bindings/qt/qt_instance.h:
21850 (KJS::Bindings::QtInstance::getBindingLanguage):
21851 * bindings/runtime.cpp:
21852 (KJS::Bindings::Instance::createBindingForLanguageInstance):
21853 (KJS::Bindings::Instance::createRuntimeObject):
21854 (KJS::Bindings::Instance::getInstance):
21855 * bindings/runtime.h:
21856 * bindings/runtime_object.h:
21857 (KJS::RuntimeObjectImp::getInternalInstance):
21858
21859 2008-01-12 Alp Toker <alp@atoker.com>
21860
21861 Reviewed by Mark Rowe.
21862
21863 Hide non-public symbols in GTK+/autotools release builds.
21864
21865 * GNUmakefile.am:
21866
21867 2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
21868
21869 Reviewed by Mark Rowe.
21870
21871 Fix http://bugs.webkit.org/show_bug.cgi?id=16852
21872 Fixes leaking of ActivationStackNode objects.
21873
21874 * kjs/JSGlobalObject.cpp:
21875 (KJS::JSGlobalObject::deleteActivationStack):
21876 (KJS::JSGlobalObject::~JSGlobalObject):
21877 (KJS::JSGlobalObject::init):
21878 (KJS::JSGlobalObject::reset):
21879 * kjs/JSGlobalObject.h:
21880
21881 2008-01-12 Darin Adler <darin@apple.com>
21882
21883 - try to fix Qt Windows build
21884
21885 * pcre/dftables: Remove reliance on the list form of Perl pipes.
21886
21887 2008-01-12 Darin Adler <darin@apple.com>
21888
21889 - try to fix Qt build
21890
21891 * kjs/function.cpp: Added include of scope_chain_mark.h.
21892 * kjs/scope_chain_mark.h: Added multiple-include guards.
21893
21894 2008-01-12 Mark Rowe <mrowe@apple.com>
21895
21896 Another Windows build fix.
21897
21898 * kjs/Activation.h:
21899
21900 2008-01-12 Mark Rowe <mrowe@apple.com>
21901
21902 Attempted Windows build fix. Use struct consistently when forward-declaring
21903 ActivationStackNode and StackActivation.
21904
21905 * kjs/Activation.h:
21906 * kjs/JSGlobalObject.h:
21907
21908 2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
21909
21910 Reviewed by Maciej.
21911
21912 Fixes a problem with the ActivationImp tear-off patch (r29425) where
21913 some of the calls to JSGlobalObject::tearOffActivation() were using
21914 the wrong test to determine whether it should leave a relic behind.
21915
21916 * kjs/function.cpp:
21917 (KJS::FunctionImp::argumentsGetter):
21918 (KJS::ActivationImp::getOwnPropertySlot):
21919
21920 2008-01-11 Geoffrey Garen <ggaren@apple.com>
21921
21922 Reviewed by Oliver Hunt.
21923
21924 Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
21925 variable access (16644)
21926
21927 This bug was caused by var declarations shadowing built-in properties of
21928 the global object.
21929
21930 To match Firefox, we've decided that var declarations will never shadow
21931 built-in properties of the global object or its prototypes. We used to
21932 behave more like IE, which allows shadowing, but walking that line got
21933 us into trouble with websites that sent us down the Firefox codepath.
21934
21935 * kjs/JSVariableObject.h:
21936 (KJS::JSVariableObject::symbolTableGet): New code to support calling
21937 hasProperty before the variable object is fully initialized (so you
21938 can call it during initialization).
21939
21940 * kjs/nodes.cpp:.
21941 (KJS::ProgramNode::initializeSymbolTable): Always do a full hasProperty
21942 check when looking for duplicates, not getDirect, since it only checks
21943 the property map, and not hasOwnProperty, since it doesn't check
21944 prototypes.
21945 (KJS::EvalNode::processDeclarations): ditto
21946
21947 * kjs/property_slot.h:
21948 (KJS::PropertySlot::ungettableGetter): Best function name evar.
21949
21950 2008-01-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
21951
21952 Reviewed by Maciej.
21953
21954 Optimized ActivationImp allocation, so that activation records are now
21955 first allocated on an explicitly managed stack and only heap allocated
21956 when necessary. Roughly a 5% improvement on SunSpider, and a larger
21957 improvement on benchmarks that use more function calls.
21958
21959 * JavaScriptCore.xcodeproj/project.pbxproj:
21960 * kjs/Activation.h: Added.
21961 (KJS::ActivationImp::ActivationData::ActivationData):
21962 (KJS::ActivationImp::ActivationImp):
21963 (KJS::ActivationImp::classInfo):
21964 (KJS::ActivationImp::isActivationObject):
21965 (KJS::ActivationImp::isOnStack):
21966 (KJS::ActivationImp::d):
21967 (KJS::StackActivation::StackActivation):
21968 * kjs/ExecState.cpp:
21969 (KJS::ExecState::ExecState):
21970 (KJS::ExecState::~ExecState):
21971 * kjs/ExecState.h:
21972 (KJS::ExecState::replaceScopeChainTop):
21973 (KJS::ExecState::setActivationObject):
21974 (KJS::ExecState::setLocalStorage):
21975 * kjs/JSGlobalObject.cpp:
21976 (KJS::JSGlobalObject::reset):
21977 (KJS::JSGlobalObject::pushActivation):
21978 (KJS::JSGlobalObject::checkActivationCount):
21979 (KJS::JSGlobalObject::popActivationHelper):
21980 (KJS::JSGlobalObject::popActivation):
21981 (KJS::JSGlobalObject::tearOffActivation):
21982 * kjs/JSGlobalObject.h:
21983 * kjs/JSVariableObject.h:
21984 (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
21985 (KJS::JSVariableObject::JSVariableObject):
21986 * kjs/function.cpp:
21987 (KJS::FunctionImp::argumentsGetter):
21988 (KJS::ActivationImp::ActivationImp):
21989 (KJS::ActivationImp::~ActivationImp):
21990 (KJS::ActivationImp::init):
21991 (KJS::ActivationImp::getOwnPropertySlot):
21992 (KJS::ActivationImp::markHelper):
21993 (KJS::ActivationImp::mark):
21994 (KJS::ActivationImp::ActivationData::ActivationData):
21995 (KJS::GlobalFuncImp::callAsFunction):
21996 * kjs/function.h:
21997 * kjs/nodes.cpp:
21998 (KJS::PostIncResolveNode::evaluate):
21999 (KJS::PostDecResolveNode::evaluate):
22000 (KJS::PreIncResolveNode::evaluate):
22001 (KJS::PreDecResolveNode::evaluate):
22002 (KJS::ReadModifyResolveNode::evaluate):
22003 (KJS::AssignResolveNode::evaluate):
22004 (KJS::WithNode::execute):
22005 (KJS::TryNode::execute):
22006 (KJS::FunctionBodyNode::processDeclarations):
22007 (KJS::FuncExprNode::evaluate):
22008 * kjs/object.h:
22009 * kjs/scope_chain.h:
22010 (KJS::ScopeChain::replace):
22011 * kjs/scope_chain_mark.h: Added.
22012 (KJS::ScopeChain::mark):
22013
22014 2008-01-11 Simon Hausmann <hausmann@webkit.org>
22015
22016 Reviewed by Mark Rowe.
22017
22018 Fix the (clean) qmake build. For generating chartables.c we don't
22019 depend on a separate input source file anymore, the dftables perl
22020 script is enough. So use that instead as value for the .input
22021 variable, to ensure that qmake also generates a rule to call dftables.
22022
22023 * pcre/pcre.pri:
22024
22025 2008-01-10 Geoffrey Garen <ggaren@apple.com>
22026
22027 Reviewed by John Sullivan.
22028
22029 Fixed some world leak reports:
22030 * <rdar://problem/5669436> PLT complains about world leak of 1 JavaScript
22031 Interpreter after running cvs-base suite
22032
22033 * <rdar://problem/5669423> PLT complains about world leak if browser
22034 window is open when PLT starts
22035
22036 * kjs/collector.h: Added the ability to distinguish between global
22037 objects and GC-protected global objects, since we only consider the
22038 latter to be world leaks.
22039 * kjs/collector.cpp:
22040
22041 2008-01-11 Mark Rowe <mrowe@apple.com>
22042
22043 Silence qmake warning about ctgen lacking input.
22044
22045 Rubber-stamped by Alp Toker.
22046
22047 * pcre/pcre.pri:
22048
22049 2008-01-10 David Kilzer <ddkilzer@apple.com>
22050
22051 dftables should be rewritten as a script
22052
22053 <http://bugs.webkit.org/show_bug.cgi?id=16818>
22054 <rdar://problem/5681463>
22055
22056 Reviewed by Darin.
22057
22058 Rewrote the dftables utility in Perl. Attempted to switch all
22059 build systems to call the script directly instead of building
22060 a binary first. Only the Xcode build was able to be tested.
22061
22062 * DerivedSources.make: Added pcre directory to VPATH and changed
22063 to invoke dftables directly.
22064 * GNUmakefile.am: Removed build information and changed to invoke
22065 dftables directly.
22066 * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed reference to
22067 dftables project.
22068 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
22069 * JavaScriptCore.vcproj/dftables: Removed.
22070 * JavaScriptCore.vcproj/dftables/dftables.vcproj: Removed.
22071 * JavaScriptCore.xcodeproj/project.pbxproj: Removed dftables target.
22072 * jscore.bkl: Removed dftables executable definition.
22073 * pcre/dftables: Copied from JavaScriptCore/pcre/dftables.cpp.
22074 * pcre/dftables.cpp: Removed.
22075 * pcre/dftables.pro: Removed.
22076 * pcre/pcre.pri: Removed references to dftables.cpp and changed to
22077 invoke dftables directly.
22078
22079 2008-01-10 Dan Bernstein <mitz@apple.com>
22080
22081 Reviewed by Darin Adler.
22082
22083 - fix http://bugs.webkit.org/show_bug.cgi?id=16782
22084 <rdar://problem/5675331> REGRESSION(r29266): Reproducible crash in fast/replaced/image-map.html
22085
22086 The crash resulted from a native object (DumpRenderTree's
22087 EventSender) causing its wrapper to be invalidated (by clicking a
22088 link that replaced the document in the window) and consequently
22089 deallocated. The fix is to use RefPtrs to protect the native object
22090 from deletion by self-invalidation.
22091
22092 * bindings/runtime_method.cpp:
22093 (RuntimeMethod::callAsFunction):
22094 * bindings/runtime_object.cpp:
22095 (RuntimeObjectImp::fallbackObjectGetter):
22096 (RuntimeObjectImp::fieldGetter):
22097 (RuntimeObjectImp::methodGetter):
22098 (RuntimeObjectImp::put):
22099 (RuntimeObjectImp::defaultValue):
22100 (RuntimeObjectImp::callAsFunction):
22101
22102 2008-01-07 Mark Rowe <mrowe@apple.com>
22103
22104 Reviewed by Maciej Stachowiak.
22105
22106 Turn testIsInteger assertions into compile-time asserts and move them into HashTraits.h
22107 where possible.
22108
22109 * kjs/testkjs.cpp:
22110 * wtf/HashTraits.h:
22111
22112 2008-01-07 Nikolas Zimmermann <zimmermann@kde.org>
22113
22114 Reviewed by Mark.
22115
22116 Enable SVG_FONTS by default.
22117
22118 * Configurations/JavaScriptCore.xcconfig:
22119
22120 2008-01-07 Darin Adler <darin@apple.com>
22121
22122 Rubber stamped by David Kilzer.
22123
22124 - get rid of empty fpconst.cpp
22125
22126 * GNUmakefile.am: Remove fpconst.cpp.
22127 * JavaScriptCore.pri: Ditto.
22128 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
22129 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
22130 * JavaScriptCoreSources.bkl: Ditto.
22131
22132 * kjs/fpconst.cpp: Removed.
22133
22134 2008-01-07 Darin Adler <darin@apple.com>
22135
22136 Reviewed by David Kilzer.
22137
22138 - fix alignment problem with NaN and Inf globals
22139
22140 * kjs/fpconst.cpp: Move the contents of this file from here back to
22141 value.cpp. The reason this was in a separate file is that the DARWIN
22142 version of this used a declaration of the globals with a different
22143 type to avoid creating "init routines". That's no longer necessary for
22144 DARWIN and was never necessary for the non-DARWIN code path.
22145 To make this patch easy to merge, I didn't actually delete this file
22146 yet. We'll do that in a separate changeset.
22147
22148 * kjs/value.cpp: If C99's NAN and INFINITY are present, then use them,
22149 othrewise use the union trick from fpconst.cpp. I think it would be
22150 better to eliminate KJS::NaN and KJS::Inf and just use NAN and INFINITY
22151 directly or std::numeric_limits<double>::quiet_nan() and
22152 std::numeric_limits<double>::infinity(). But when I tried that, it
22153 slowed down SunSpider. Someone else could do that cleanup if they
22154 could do it without slowing down the engine.
22155
22156 2008-01-07 Adam Roben <aroben@apple.com>
22157
22158 Windows build fix
22159
22160 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
22161 JavaScript.h to the project.
22162 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
22163 Copy JavaScript.h to WEBKITOUTPUTDIR.
22164
22165 2008-01-07 Timothy Hatcher <timothy@apple.com>
22166
22167 Reviewed by Darin.
22168
22169 Fix Mac build.
22170
22171 * API/JSNode.c:
22172 * API/JSNode.h:
22173 * API/JSNodeList.c:
22174 * API/JSNodeList.h:
22175 * API/JavaScript.h:
22176 * API/JavaScriptCore.h:
22177 * API/minidom.c:
22178 * JavaScriptCore.xcodeproj/project.pbxproj:
22179
22180 2008-01-07 Alp Toker <alp@atoker.com>
22181
22182 Reviewed by Darin.
22183
22184 http://bugs.webkit.org/show_bug.cgi?id=16029
22185 JavaScriptCore.h is not suitable for platforms other than Mac OS X
22186
22187 Introduce a new JavaScriptCore/JavaScript.h public API header. This
22188 should be used by all new portable code using the JavaScriptCore API.
22189
22190 JavaScriptCore/JavaScriptCore.h will remain for compatibility with
22191 existing applications that depend on it including JSStringRefCF.h
22192 which isn't portable.
22193
22194 Also add minidom to the GTK+/autotools build since we can now support
22195 it on all platforms.
22196
22197 * API/JSNode.h:
22198 * API/JSNodeList.h:
22199 * API/JavaScript.h: Added.
22200 * API/JavaScriptCore.h:
22201 * ForwardingHeaders/JavaScriptCore/JavaScript.h: Added.
22202 * GNUmakefile.am:
22203 * JavaScriptCore.xcodeproj/project.pbxproj:
22204
22205 2008-01-06 Eric Seidel <eric@webkit.org>
22206
22207 Reviewed by Sam.
22208
22209 Abstract all DateObject.set* functions in preparation for fixing:
22210 http://bugs.webkit.org/show_bug.cgi?id=16753
22211
22212 SunSpider had random changes here and there but was overall a wash.
22213
22214 * kjs/date_object.cpp:
22215 (KJS::fillStructuresUsingTimeArgs):
22216 (KJS::setNewValueFromTimeArgs):
22217 (KJS::setNewValueFromDateArgs):
22218 (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
22219 (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
22220 (KJS::DateProtoFuncSetSeconds::callAsFunction):
22221 (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
22222 (KJS::DateProtoFuncSetMinutes::callAsFunction):
22223 (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
22224 (KJS::DateProtoFuncSetHours::callAsFunction):
22225 (KJS::DateProtoFuncSetUTCHours::callAsFunction):
22226 (KJS::DateProtoFuncSetDate::callAsFunction):
22227 (KJS::DateProtoFuncSetUTCDate::callAsFunction):
22228 (KJS::DateProtoFuncSetMonth::callAsFunction):
22229 (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
22230 (KJS::DateProtoFuncSetFullYear::callAsFunction):
22231 (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
22232
22233 2008-01-06 Nikolas Zimmermann <zimmermann@kde.org>
22234
22235 Reviewed by Dan.
22236
22237 Add new helper function isArabicChar - SVG Fonts support needs it.
22238
22239 * wtf/unicode/icu/UnicodeIcu.h:
22240 (WTF::Unicode::isArabicChar):
22241 * wtf/unicode/qt4/UnicodeQt4.h:
22242 (WTF::Unicode::isArabicChar):
22243
22244 2008-01-06 Alp Toker <alp@atoker.com>
22245
22246 Reviewed by Mark Rowe.
22247
22248 Use $(EXEEXT) to account for the .exe extension in the GTK+ Windows
22249 build. (This is already done correctly in DerivedSources.make.) Issue
22250 noticed by Mikkel when building in Cygwin.
22251
22252 Add a missing slash. This was a hack from the qmake build system that
22253 isn't necessary with autotools.
22254
22255 * GNUmakefile.am:
22256
22257 2008-01-05 Darin Adler <darin@apple.com>
22258
22259 * API/JSRetainPtr.h: One more file that needed the change below.
22260
22261 2008-01-05 Darin Adler <darin@apple.com>
22262
22263 * wtf/OwnPtr.h: OwnPtr needs the same fix as RefPtr below.
22264
22265 2008-01-05 Adam Roben <aroben@apple.com>
22266
22267 Build fix.
22268
22269 Reviewed by Maciej.
22270
22271 * wtf/RetainPtr.h: Use PtrType instead of T* because of the
22272 RemovePointer magic.
22273
22274 2008-01-05 Darin Adler <darin@apple.com>
22275
22276 Rubber stamped by Maciej Stachowiak.
22277
22278 - cut down own PIC branches by using a pointer-to-member-data instead of a
22279 pointer-to-member-function in WTF smart pointers
22280
22281 * wtf/OwnArrayPtr.h:
22282 * wtf/OwnPtr.h:
22283 * wtf/PassRefPtr.h:
22284 * wtf/RefPtr.h:
22285 * wtf/RetainPtr.h:
22286 Use a pointer to the m_ptr member instead of the get member.
22287 The GCC compiler generates better code for this idiom.
22288
22289 2008-01-05 Henry Mason <hmason@mac.com>
22290
22291 Reviewed by Maciej Stachowiak.
22292
22293 http://bugs.webkit.org/show_bug.cgi?id=16738
22294 Bug 16738: Collector block offset could be stored as an cell offset instead of a byte offset
22295
22296 Gives a 0.4% SunSpider boost and prettier code.
22297
22298 * kjs/collector.cpp: Switched to cell offsets from byte offsets
22299 (KJS::Collector::heapAllocate):
22300 (KJS::Collector::sweep):
22301
22302 2008-01-04 Mark Rowe <mrowe@apple.com>
22303
22304 Reviewed by Maciej Stachowiak.
22305
22306 Have the two malloc zones print useful diagnostics if their free method are unexpectedly invoked.
22307 Due to <rdar://problem/5671357> this can happen if an application attempts to free a pointer that
22308 was not allocated by any registered malloc zone on the system.
22309
22310 * kjs/CollectorHeapIntrospector.h:
22311 * wtf/FastMalloc.cpp:
22312
22313 2008-01-04 Alp Toker <alp@atoker.com>
22314
22315 GTK+ autotools build fix. Terminate empty rules.
22316
22317 * GNUmakefile.am:
22318
22319 2008-01-03 Simon Hausmann <hausmann@webkit.org>
22320
22321 Reviewed by Mark Rowe.
22322
22323 Fix compilation with gcc 4.3: limits.h is needed for INT_MAX.
22324
22325 * pcre/pcre_exec.cpp:
22326
22327 2008-01-03 Darin Adler <darin@apple.com>
22328
22329 * tests/mozilla/expected.html: The fix for bug 16696 also fixed a test
22330 case, ecma_3/RegExp/perlstress-002.js, so updated results to expect
22331 that test to succeed.
22332
22333 2008-01-02 Darin Adler <darin@apple.com>
22334
22335 Reviewed by Geoff.
22336
22337 - fix http://bugs.webkit.org/show_bug.cgi?id=16696
22338 JSCRE fails fails to match Acid3 regexp
22339
22340 Test: fast/regex/early-acid3-86.html
22341
22342 The problem was with the cutoff point between backreferences and octal
22343 escape sequences. We need to determine the cutoff point by counting the
22344 total number of capturing brackets, which requires an extra pass through
22345 the expression when compiling it.
22346
22347 * pcre/pcre_compile.cpp:
22348 (CompileData::CompileData): Added numCapturingBrackets. Removed some
22349 unused fields.
22350 (compileBranch): Use numCapturingBrackets when calling checkEscape.
22351 (calculateCompiledPatternLength): Use numCapturingBrackets when calling
22352 checkEscape, and also store the bracket count at the end of the compile.
22353 (jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
22354 count the number of brackets and then a second time to calculate the length.
22355
22356 2008-01-02 Darin Adler <darin@apple.com>
22357
22358 Reviewed by Geoff.
22359
22360 - fix http://bugs.webkit.org/show_bug.cgi?id=16696
22361 JSCRE fails fails to match Acid3 regexp
22362
22363 Test: fast/regex/early-acid3-86.html
22364
22365 The problem was with the cutoff point between backreferences and octal
22366 escape sequences. We need to determine the cutoff point by counting the
22367 total number of capturing brackets, which requires an extra pass through
22368 the expression when compiling it.
22369
22370 * pcre/pcre_compile.cpp:
22371 (CompileData::CompileData): Added numCapturingBrackets. Removed some
22372 unused fields.
22373 (compileBranch): Use numCapturingBrackets when calling checkEscape.
22374 (calculateCompiledPatternLength): Use numCapturingBrackets when calling
22375 checkEscape, and also store the bracket count at the end of the compile.
22376 (jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
22377 count the number of brackets and then a second time to calculate the length.
22378
22379 2008-01-02 David Kilzer <ddkilzer@webkit.org>
22380
22381 Reviewed and landed by Darin.
22382
22383 * kjs/nodes.cpp:
22384 (KJS::DoWhileNode::execute): Added a missing return.
22385
22386 2008-01-02 Darin Adler <darin@apple.com>
22387
22388 - try to fix Qt build
22389
22390 * wtf/unicode/qt4/UnicodeQt4.h:
22391 (WTF::Unicode::foldCase): Add some missing const.
22392
22393 2008-01-02 Alice Liu <alice.liu@apple.com>
22394
22395 Reviewed by Sam Weinig.
22396
22397 need to export ASCIICType.h for use in DRT
22398
22399 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
22400 * wtf/ASCIICType.h:
22401 (WTF::isASCIIUpper):
22402
22403 2008-01-02 Sam Weinig <sam@webkit.org>
22404
22405 Reviewed by Beth Dakin.
22406
22407 Cleanup error_object.h/cpp.
22408
22409 * kjs/JSGlobalObject.cpp:
22410 (KJS::JSGlobalObject::reset):
22411 * kjs/error_object.cpp:
22412 (KJS::ErrorInstance::ErrorInstance):
22413 (KJS::ErrorPrototype::ErrorPrototype):
22414 (KJS::ErrorProtoFuncToString::ErrorProtoFuncToString):
22415 (KJS::ErrorProtoFuncToString::callAsFunction):
22416 (KJS::ErrorObjectImp::ErrorObjectImp):
22417 (KJS::ErrorObjectImp::implementsConstruct):
22418 (KJS::ErrorObjectImp::construct):
22419 (KJS::ErrorObjectImp::callAsFunction):
22420 (KJS::NativeErrorPrototype::NativeErrorPrototype):
22421 (KJS::NativeErrorImp::NativeErrorImp):
22422 (KJS::NativeErrorImp::implementsConstruct):
22423 (KJS::NativeErrorImp::construct):
22424 (KJS::NativeErrorImp::callAsFunction):
22425 (KJS::NativeErrorImp::mark):
22426 * kjs/error_object.h:
22427 (KJS::ErrorInstance::classInfo):
22428 (KJS::NativeErrorImp::classInfo):
22429
22430 2008-01-02 Mark Rowe <mrowe@apple.com>
22431
22432 Rubber-stamped by Alp Toker.
22433
22434 * GNUmakefile.am: Add missing dependency on grammar.y.
22435
22436 2008-01-01 Darin Adler <darin@apple.com>
22437
22438 Reviewed by Eric.
22439
22440 - fix for http://bugs.webkit.org/show_bug.cgi?id=16695
22441 JSC allows non-identifier codepoints in identifiers (affects Acid3)
22442
22443 Test: fast/js/kde/parse.html
22444
22445 * kjs/lexer.cpp:
22446 (KJS::Lexer::lex): Added additional states to distinguish Unicode escapes at the
22447 start of identifiers from ones inside identifiers. Rejected characters that don't pass
22448 the isIdentStart and isIdentPart tests.
22449 (KJS::Lexer::convertUnicode): Removed incorrect FIXME comment.
22450
22451 * kjs/lexer.h: Added new states to distinguish \u escapes at the start of identifiers
22452 from \u escapes inside identifiers.
22453
22454 2008-01-01 Darin Adler <darin@apple.com>
22455
22456 - rolled scope chain optimization out; it was breaking the world
22457
22458 2008-01-01 Darin Adler <darin@apple.com>
22459
22460 Reviewed by Geoff.
22461
22462 - http://bugs.webkit.org/show_bug.cgi?id=16685
22463 eliminate List::empty() to cut down on PIC branches
22464
22465 Also included one other speed-up -- remove the call to reserveCapacity from
22466 FunctionBodyNode::processDeclarations in all but the most unusual cases.
22467
22468 Together these make SunSpider 1.016x as fast.
22469
22470 * JavaScriptCore.exp: Updated.
22471 * kjs/ExecState.cpp:
22472 (KJS::globalEmptyList): Added. Called only when creating global ExecState
22473 instances.
22474 (KJS::ExecState::ExecState): Broke constructor up into three separate functions,
22475 for the three separate node types. Also went through each of the three and
22476 streamlined as much as possible, removing dead code. This prevents us from having
22477 to access the global in the function body version of the constructor.
22478
22479 * kjs/ExecState.h: Added emptyList(). Replaced the constructor with a set of
22480 three that are specific to the different node types that can create new execution
22481 state objects.
22482
22483 * kjs/array_object.cpp:
22484 (KJS::ArrayProtoFuncToLocaleString::callAsFunction): Use exec->emptyList() instead
22485 of List::empty().
22486 (KJS::ArrayProtoFuncConcat::callAsFunction): Ditto.
22487 (KJS::ArrayProtoFuncSlice::callAsFunction): Ditto.
22488 (KJS::ArrayProtoFuncSplice::callAsFunction): Ditto.
22489 (KJS::ArrayProtoFuncFilter::callAsFunction): Ditto.
22490 * kjs/function.cpp:
22491 (KJS::FunctionImp::callAsFunction): Updated to call new ExecState constructor.
22492 (KJS::GlobalFuncImp::callAsFunction): Ditto (for eval).
22493 * kjs/function_object.cpp:
22494 (FunctionObjectImp::construct): Use exec->emptyList() instead of List::empty().
22495
22496 * kjs/list.cpp: Removed List::empty.
22497 * kjs/list.h: Ditto.
22498
22499 * kjs/nodes.cpp:
22500 (KJS::ElementNode::evaluate): Use exec->emptyList() instead of List::empty().
22501 (KJS::ArrayNode::evaluate): Ditto.
22502 (KJS::ObjectLiteralNode::evaluate): Ditto.
22503 (KJS::PropertyListNode::evaluate): Ditto.
22504 (KJS::FunctionBodyNode::processDeclarations): Another speed-up. Check the capacity
22505 before calling reserveCapacity, because it doesn't get inlined the local storage
22506 vector is almost always big enough -- saving the function call overhead is a big
22507 deal.
22508 (KJS::FuncDeclNode::makeFunction): Use exec->emptyList() instead of List::empty().
22509 (KJS::FuncExprNode::evaluate): Ditto.
22510 * kjs/object.cpp:
22511 (KJS::tryGetAndCallProperty): Ditto.
22512 * kjs/property_slot.cpp:
22513 (KJS::PropertySlot::functionGetter): Ditto.
22514 * kjs/string_object.cpp:
22515 (KJS::StringProtoFuncSplit::callAsFunction): Ditto.
22516
22517 2008-01-01 Darin Adler <darin@apple.com>
22518
22519 Reviewed by Geoff.
22520
22521 - fix http://bugs.webkit.org/show_bug.cgi?id=16648
22522 REGRESSION (r28165): Yuku.com navigation prints "jsRegExpExecute failed with result -2"
22523 <rdar://problem/5646486> REGRESSION (r28165): Layout test fast/regex/test1 fails intermittently
22524
22525 Fixes 34 failing test cases in the fast/regex/test1.html test.
22526
22527 Restored the stack which prevents infinite loops for brackets that match the empty
22528 string; it had been removed as an optimization.
22529
22530 Unfortunately, restoring this stack causes the regular expression test in SunSpider
22531 to be 1.095x as slow and the overall test to be 1.004x as slow. Maybe we can find
22532 a correct optimization to restore the speed!
22533
22534 It's possible the original change was on the right track but just off by one.
22535
22536 * pcre/pcre_exec.cpp: Add back eptrblock, but name it BracketChainNode.
22537 (MatchStack::pushNewFrame): Add back the logic needed here.
22538 (startNewGroup): Ditto.
22539 (match): Ditto.
22540
22541 2008-01-01 Darin Adler <darin@apple.com>
22542
22543 Reviewed by Geoff.
22544
22545 - http://bugs.webkit.org/show_bug.cgi?id=16683
22546 speed up function calls by making ScopeChain::push cheaper
22547
22548 This gives a 1.019x speedup on SunSpider.
22549
22550 After doing this, I realized this probably will be obsolete when the optimization
22551 to avoid creating an activation object is done. When we do that one we should check
22552 if rolling this out will speed things up, since this does add overhead at the time
22553 you copy the scope chain.
22554
22555 * kjs/object.h: Removed the ScopeChain::release function. It was
22556 marked inline, and called in exactly one place, so moved it there.
22557 No idea why it was in this header file!
22558
22559 * kjs/scope_chain.cpp: Removed the overload of the ScopeChain::push
22560 function that takes another ScopeChain. It was unused. I think we used
22561 it over in WebCore at one point, but not any more.
22562
22563 * kjs/scope_chain.h: Changed ScopeChainNode into a struct rather than
22564 a class, got rid of its constructor so we can have one that's uninitialized,
22565 and moved the refCount into a derived struct, ScopeChainHeapNode. Made _node
22566 mutable so it can be changed in the moveToHeap function. Changed the copy
22567 constructor and assignment operator to call moveToHeap, since the top node
22568 can't be shared when it's embedded in another ScopeChain object. Updated
22569 functions as needed to handle the case where the first object isn't on the
22570 heap or to add casts for cases where it's guaranteed to be. Changed the push
22571 function to always put the new node into the ScopeChain object; it will get
22572 put onto the heap when needed later.
22573
22574 2008-01-01 Geoffrey Garen <ggaren@apple.com>
22575
22576 Reviewed by Darin Adler.
22577
22578 Fixed slight logic error in reserveCapacity, where we would reallocate
22579 the storage buffer unnecessarily.
22580
22581 * wtf/Vector.h:
22582 (WTF::::reserveCapacity): No need to grow the buffer if newCapacity is
22583 equal to capacity().
22584
22585 2008-01-01 Darin Adler <darin@apple.com>
22586
22587 Reviewed by Oliver.
22588
22589 - http://bugs.webkit.org/show_bug.cgi?id=16684
22590 eliminate debugger overhead from function body execution
22591
22592 Speeds SunSpider up 1.003x. That's a small amount, but measurable.
22593
22594 * JavaScriptCore.exp: Updated.
22595 * kjs/Parser.h:
22596 (KJS::Parser::parse): Create the node with a static member function named create() instead
22597 of using new explicitly.
22598
22599 * kjs/grammar.y: Changed calls to new FunctionBodyNode to use FunctionBodyNode::create().
22600
22601 * kjs/nodes.cpp:
22602 (KJS::ProgramNode::create): Added. Calls new.
22603 (KJS::EvalNode::create): Ditto.
22604 (KJS::FunctionBodyNode::create): Ditto, but creates FunctionBodyNodeWithDebuggerHooks
22605 when a debugger is present.
22606 (KJS::FunctionBodyNode::execute): Removed debugger hooks.
22607 (KJS::FunctionBodyNodeWithDebuggerHooks::FunctionBodyNodeWithDebuggerHooks): Added.
22608 (KJS::FunctionBodyNodeWithDebuggerHooks::execute): Calls the debugger, then the code,
22609 then the debugger again.
22610
22611 * kjs/nodes.h: Added create functions, made the constructors private and protected.
22612
22613 2007-12-30 Eric Seidel <eric@webkit.org>
22614
22615 Reviewed by Sam.
22616
22617 More small cleanup to array_object.cpp
22618
22619 * kjs/array_object.cpp:
22620 (KJS::ArrayProtoFuncToString::callAsFunction):
22621 (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
22622 (KJS::ArrayProtoFuncJoin::callAsFunction):
22623 (KJS::ArrayProtoFuncConcat::callAsFunction):
22624 (KJS::ArrayProtoFuncReverse::callAsFunction):
22625 (KJS::ArrayProtoFuncShift::callAsFunction):
22626 (KJS::ArrayProtoFuncSlice::callAsFunction):
22627 (KJS::ArrayProtoFuncSort::callAsFunction):
22628 (KJS::ArrayProtoFuncSplice::callAsFunction):
22629 (KJS::ArrayProtoFuncUnShift::callAsFunction):
22630 (KJS::ArrayProtoFuncFilter::callAsFunction):
22631 (KJS::ArrayProtoFuncMap::callAsFunction):
22632 (KJS::ArrayProtoFuncEvery::callAsFunction):
22633
22634 2007-12-30 Eric Seidel <eric@webkit.org>
22635
22636 Reviewed by Sam.
22637
22638 Apply wkstyle to array_object.cpp
22639
22640 * kjs/array_object.cpp:
22641 (KJS::ArrayPrototype::ArrayPrototype):
22642 (KJS::ArrayPrototype::getOwnPropertySlot):
22643 (KJS::ArrayProtoFuncConcat::callAsFunction):
22644 (KJS::ArrayProtoFuncPop::callAsFunction):
22645 (KJS::ArrayProtoFuncReverse::callAsFunction):
22646 (KJS::ArrayProtoFuncShift::callAsFunction):
22647 (KJS::ArrayProtoFuncSlice::callAsFunction):
22648 (KJS::ArrayProtoFuncSort::callAsFunction):
22649 (KJS::ArrayProtoFuncSplice::callAsFunction):
22650 (KJS::ArrayProtoFuncUnShift::callAsFunction):
22651 (KJS::ArrayProtoFuncFilter::callAsFunction):
22652 (KJS::ArrayProtoFuncMap::callAsFunction):
22653 (KJS::ArrayProtoFuncEvery::callAsFunction):
22654 (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
22655 (KJS::ArrayObjectImp::ArrayObjectImp):
22656 (KJS::ArrayObjectImp::implementsConstruct):
22657 (KJS::ArrayObjectImp::construct):
22658 (KJS::ArrayObjectImp::callAsFunction):
22659
22660 2007-12-30 Eric Seidel <eric@webkit.org>
22661
22662 Reviewed by Sam.
22663
22664 Remove maxInt/minInt, replacing with std:max/min<int>()
22665
22666 * kjs/array_object.cpp:
22667 (KJS::ArrayProtoFuncSplice::callAsFunction):
22668 * kjs/operations.cpp:
22669 * kjs/operations.h:
22670
22671 2007-12-30 Eric Seidel <eric@webkit.org>
22672
22673 Reviewed by Sam.
22674
22675 Update Number.toString to properly throw exceptions.
22676 Cleanup code in Number.toString implementation.
22677
22678 * kjs/number_object.cpp:
22679 (KJS::numberToString):
22680 * kjs/object.cpp:
22681 (KJS::Error::create): Remove bogus debug lines.
22682
22683 2007-12-28 Eric Seidel <eric@webkit.org>
22684
22685 Reviewed by Oliver.
22686
22687 ASSERT when debugging via Drosera due to missed var lookup optimization.
22688 http://bugs.webkit.org/show_bug.cgi?id=16634
22689
22690 No test case possible.
22691
22692 * kjs/nodes.cpp:
22693 (KJS::BreakpointCheckStatement::optimizeVariableAccess):
22694 * kjs/nodes.h:
22695
22696 2007-12-28 Eric Seidel <eric@webkit.org>
22697
22698 Reviewed by Oliver.
22699
22700 Fix (-0).toFixed() and re-factor a little
22701 Fix (-0).toExponential() and printing of trailing 0s in toExponential
22702 Fix toPrecision(nan) handling
22703 http://bugs.webkit.org/show_bug.cgi?id=16640
22704
22705 * kjs/number_object.cpp:
22706 (KJS::numberToFixed):
22707 (KJS::fractionalPartToString):
22708 (KJS::numberToExponential):
22709 (KJS::numberToPrecision):
22710
22711 2007-12-28 Eric Seidel <eric@webkit.org>
22712
22713 Reviewed by Sam.
22714
22715 More changes to make number code readable
22716
22717 * kjs/number_object.cpp:
22718 (KJS::integer_part_noexp):
22719 (KJS::numberToFixed):
22720 (KJS::numberToExponential):
22721
22722 2007-12-28 Eric Seidel <eric@webkit.org>
22723
22724 Reviewed by Sam.
22725
22726 More small cleanups to toPrecision
22727
22728 * kjs/number_object.cpp:
22729 (KJS::numberToPrecision):
22730
22731 2007-12-28 Eric Seidel <eric@webkit.org>
22732
22733 Reviewed by Sam.
22734
22735 More small attempts to make number code readable
22736
22737 * kjs/number_object.cpp:
22738 (KJS::exponentialPartToString):
22739 (KJS::numberToExponential):
22740 (KJS::numberToPrecision):
22741
22742 2007-12-28 Eric Seidel <eric@webkit.org>
22743
22744 Reviewed by Sam.
22745
22746 Break out callAsFunction implementations into static functions
22747
22748 * kjs/number_object.cpp:
22749 (KJS::numberToString):
22750 (KJS::numberToFixed):
22751 (KJS::numberToExponential):
22752 (KJS::numberToPrecision):
22753 (KJS::NumberProtoFunc::callAsFunction):
22754
22755 2007-12-28 Eric Seidel <eric@webkit.org>
22756
22757 Reviewed by Sam.
22758
22759 Apply wkstyle/astyle and fix placement of *
22760
22761 * kjs/number_object.cpp:
22762 (KJS::NumberInstance::NumberInstance):
22763 (KJS::NumberPrototype::NumberPrototype):
22764 (KJS::NumberProtoFunc::NumberProtoFunc):
22765 (KJS::integer_part_noexp):
22766 (KJS::intPow10):
22767 (KJS::NumberProtoFunc::callAsFunction):
22768 (KJS::NumberObjectImp::NumberObjectImp):
22769 (KJS::NumberObjectImp::getOwnPropertySlot):
22770 (KJS::NumberObjectImp::getValueProperty):
22771 (KJS::NumberObjectImp::implementsConstruct):
22772 (KJS::NumberObjectImp::construct):
22773 (KJS::NumberObjectImp::callAsFunction):
22774 * kjs/object.cpp:
22775 (KJS::JSObject::put):
22776
22777 2007-12-27 Eric Seidel <eric@webkit.org>
22778
22779 Reviewed by Sam.
22780
22781 ASSERT in JavaScriptCore while viewing WICD test case
22782 http://bugs.webkit.org/show_bug.cgi?id=16626
22783
22784 * kjs/nodes.cpp:
22785 (KJS::ForInNode::execute): move KJS_CHECK_EXCEPTION to proper place
22786
22787 2007-12-26 Jan Michael Alonzo <jmalonzo@unpluggable.com>
22788
22789 Reviewed by Alp Toker.
22790
22791 http://bugs.webkit.org/show_bug.cgi?id=16390
22792 Use autotools or GNU make as the build system for the GTK port
22793
22794 * GNUmakefile.am: Added.
22795
22796 2007-12-25 Maciej Stachowiak <mjs@apple.com>
22797
22798 Reviewed by Oliver.
22799
22800 - Remove unnecessary redundant check from property setting
22801 http://bugs.webkit.org/show_bug.cgi?id=16602
22802
22803 1.3% speedup on SunSpider.
22804
22805 * kjs/object.cpp:
22806 (KJS::JSObject::put): Don't do canPut check when not needed; let
22807 the PropertyMap handle it.
22808 (KJS::JSObject::canPut): Don't check the static property
22809 table. lookupPut does that already.
22810
22811 2007-12-24 Alp Toker <alp@atoker.com>
22812
22813 Fix builds that don't use AllInOneFile.cpp following breakage
22814 introduced in r28973.
22815
22816 * kjs/grammar.y:
22817
22818 2007-12-24 Maciej Stachowiak <mjs@apple.com>
22819
22820 Reviewed by Eric.
22821
22822 - Optimize variable declarations
22823 http://bugs.webkit.org/show_bug.cgi?id=16585
22824
22825 3.5% speedup on SunSpider.
22826
22827 var statements now result in either assignments or empty statements.
22828
22829 This allows a couple of optimization opportunities:
22830 - No need to branch at runtime to check if there is an initializer
22831 - EmptyStatementNodes can be removed entirely (also done in this patch)
22832 - Assignment expressions get properly optimized for local variables
22833
22834 This patch also includes some code cleanup:
22835 - Most of the old VarStatement/VarDecl logic is now only used for const declarations,
22836 thus it is renamed appropriately
22837 - AssignExprNode is gone
22838
22839 * JavaScriptCore.exp:
22840 * kjs/NodeInfo.h:
22841 * kjs/grammar.y:
22842 * kjs/nodes.cpp:
22843 (KJS::SourceElements::append):
22844 (KJS::ConstDeclNode::ConstDeclNode):
22845 (KJS::ConstDeclNode::optimizeVariableAccess):
22846 (KJS::ConstDeclNode::handleSlowCase):
22847 (KJS::ConstDeclNode::evaluateSingle):
22848 (KJS::ConstDeclNode::evaluate):
22849 (KJS::ConstStatementNode::optimizeVariableAccess):
22850 (KJS::ConstStatementNode::execute):
22851 (KJS::VarStatementNode::optimizeVariableAccess):
22852 (KJS::VarStatementNode::execute):
22853 (KJS::ForInNode::ForInNode):
22854 (KJS::ForInNode::optimizeVariableAccess):
22855 (KJS::ForInNode::execute):
22856 (KJS::FunctionBodyNode::initializeSymbolTable):
22857 (KJS::ProgramNode::initializeSymbolTable):
22858 (KJS::FunctionBodyNode::processDeclarations):
22859 (KJS::ProgramNode::processDeclarations):
22860 (KJS::EvalNode::processDeclarations):
22861 * kjs/nodes.h:
22862 (KJS::DeclarationStacks::):
22863 (KJS::StatementNode::):
22864 (KJS::ConstDeclNode::):
22865 (KJS::ConstStatementNode::):
22866 (KJS::EmptyStatementNode::):
22867 (KJS::VarStatementNode::):
22868 (KJS::ForNode::):
22869 * kjs/nodes2string.cpp:
22870 (KJS::ConstDeclNode::streamTo):
22871 (KJS::ConstStatementNode::streamTo):
22872 (KJS::ScopeNode::streamTo):
22873 (KJS::VarStatementNode::streamTo):
22874 (KJS::ForNode::streamTo):
22875 (KJS::ForInNode::streamTo):
22876
22877 2007-12-21 Mark Rowe <mrowe@apple.com>
22878
22879 Reviewed by Oliver Hunt.
22880
22881 * JavaScriptCore.exp: Remove unused symbol to prevent a weak external symbol
22882 being generated in JavaScriptCore.framework.
22883
22884 2007-12-21 Darin Adler <darin@apple.com>
22885
22886 Requested by Maciej.
22887
22888 * kjs/nodes.h: Use the new NEVER_INLINE here and eliminate the old
22889 KJS_NO_INLINE. We don't want to have two, and we figured it was better
22890 to keep the one that's in WTF.
22891
22892 2007-12-21 Darin Adler <darin@apple.com>
22893
22894 Reviewed by Eric.
22895
22896 - http://bugs.webkit.org/show_bug.cgi?id=16561
22897 remove debugger overhead from non-debugged JavaScript execution
22898
22899 1.022x as fast on SunSpider.
22900
22901 * JavaScriptCore.exp: Updated.
22902
22903 * kjs/NodeInfo.h: Renamed SourceElementsStub to SourceElements,
22904 since that more accurately describes the role of this object, which
22905 is a reference-counted wrapper for a Vector.
22906
22907 * kjs/Parser.cpp:
22908 (KJS::Parser::didFinishParsing): Changed parameter type to SourceElements,
22909 and use plain assignment instead of set.
22910 * kjs/Parser.h: Changed parameter type of didFinishParsing to a
22911 SourceElements. Also changed m_sourceElements; we now use a RefPtr instead
22912 of an OwnPtr as well.
22913
22914 * kjs/grammar.y: Got rid of all the calls to release() on SourceElements.
22915 That's now handed inside the constructors for various node types, since we now
22916 use vector swapping instead.
22917
22918 * kjs/nodes.cpp:
22919 (KJS::Node::rethrowException): Added NEVER_INLINE, because this was getting inlined
22920 and we want exception handling out of the normal code flow.
22921 (KJS::SourceElements::append): Moved here from the header. This now handles
22922 creating a BreakpointCheckStatement for each statement in the debugger case.
22923 That way we can get breakpoint handling without having it in every execute function.
22924 (KJS::BreakpointCheckStatement::BreakpointCheckStatement): Added.
22925 (KJS::BreakpointCheckStatement::execute): Added. Contains the code that was formerly
22926 in the StatementNode::hitStatement function and the KJS_BREAKPOINT macro.
22927 (KJS::BreakpointCheckStatement::streamTo): Added.
22928 (KJS::ArgumentListNode::evaluateList): Use KJS_CHECKEXCEPTIONVOID since the return
22929 type is void.
22930 (KJS::VarStatementNode::execute): Removed KJS_BREAKPOINT.
22931 (KJS::BlockNode::BlockNode): Changed parameter type to SourceElements.
22932 Changed code to use release since the class now contains a vector rather than
22933 a vector point.
22934 (KJS::BlockNode::optimizeVariableAccess): Updated since member is now a vector
22935 rather than a vector pointer.
22936 (KJS::BlockNode::execute): Ditto.
22937 (KJS::ExprStatementNode::execute): Removed KJS_BREAKPOINT.
22938 (KJS::IfNode::execute): Ditto.
22939 (KJS::IfElseNode::execute): Ditto.
22940 (KJS::DoWhileNode::execute): Ditto.
22941 (KJS::WhileNode::execute): Ditto.
22942 (KJS::ContinueNode::execute): Ditto.
22943 (KJS::BreakNode::execute): Ditto.
22944 (KJS::ReturnNode::execute): Ditto.
22945 (KJS::WithNode::execute): Ditto.
22946 (KJS::CaseClauseNode::optimizeVariableAccess): Updated since member is now a vector
22947 rather than a vector pointer.
22948 (KJS::CaseClauseNode::executeStatements): Ditto.
22949 (KJS::SwitchNode::execute): Removed KJS_BREAKPOINT.
22950 (KJS::ThrowNode::execute): Ditto.
22951 (KJS::TryNode::execute): Ditto.
22952 (KJS::ScopeNode::ScopeNode): Changed parameter type to SourceElements.
22953 (KJS::ProgramNode::ProgramNode): Ditto.
22954 (KJS::EvalNode::EvalNode): Ditto.
22955 (KJS::FunctionBodyNode::FunctionBodyNode): Ditto.
22956 (KJS::ScopeNode::optimizeVariableAccess): Updated since member is now a vector
22957 rather than a vector pointer.
22958
22959 * kjs/nodes.h: Removed hitStatement. Renamed SourceElements to StatementVector.
22960 Renamed SourceElementsStub to SourceElements and made it derive from
22961 ParserRefCounted rather than from Node, hold a vector rather than a pointer to
22962 a vector, and changed the release function to swap with another vector rather
22963 than the pointer idiom. Updated BlockNode and CaseClauseNode to hold actual
22964 vectors instead of pointers to vectors. Added BreakpointCheckStatement.
22965
22966 * kjs/nodes2string.cpp:
22967 (KJS::statementListStreamTo): Changed to work on a vector instead of a pointer
22968 to a vector.
22969 (KJS::BlockNode::streamTo): Ditto.
22970 (KJS::CaseClauseNode::streamTo): Ditto.
22971
22972 * wtf/AlwaysInline.h: Added NEVER_INLINE.
22973 * wtf/PassRefPtr.h: Tweaked formatting. Added clear() function that matches the
22974 ones in OwnPtr and auto_ptr.
22975 * wtf/RefPtr.h: Ditto.
22976
22977 2007-12-21 Darin Adler <darin@apple.com>
22978
22979 - fix broken regression tests
22980
22981 The broken tests were fast/js/do-while-expression-value.html and
22982 fast/js/while-expression-value.html.
22983
22984 * kjs/nodes.cpp: Check in the correct version of this file. I had accidentally landed
22985 an old version of my patch for bug 16471.
22986 (KJS::statementListExecute): The logic here was backwards. Have to set the value
22987 even for non-normal execution results.
22988
22989 2007-12-20 Alexey Proskuryakov <ap@webkit.org>
22990
22991 Windows build fix
22992
22993 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Copy npruntime_internal.h
22994 to WebKitBuild.
22995
22996 2007-12-20 Eric Seidel <eric@webkit.org>
22997
22998 Reviewed by mjs.
22999
23000 Split IfNode into IfNode and IfElseNode for speedup.
23001 http://bugs.webkit.org/show_bug.cgi?id=16470
23002
23003 SunSpider claims this is 1.003x as fast as before.
23004 (This required running with --runs 15 to get consistent enough results to tell!)
23005
23006 * kjs/grammar.y:
23007 * kjs/nodes.cpp:
23008 (KJS::IfNode::optimizeVariableAccess):
23009 (KJS::IfNode::execute):
23010 (KJS::IfNode::getDeclarations):
23011 (KJS::IfElseNode::optimizeVariableAccess):
23012 (KJS::IfElseNode::execute):
23013 (KJS::IfElseNode::getDeclarations):
23014 * kjs/nodes.h:
23015 (KJS::IfNode::):
23016 (KJS::IfElseNode::):
23017 * kjs/nodes2string.cpp:
23018 (KJS::IfNode::streamTo):
23019 (KJS::IfElseNode::streamTo):
23020
23021 2007-12-20 Darin Adler <darin@apple.com>
23022
23023 Reviewed by Sam.
23024
23025 * wtf/OwnPtr.h:
23026 (WTF::operator==): Added.
23027 (WTF::operator!=): Added.
23028
23029 2007-12-20 Geoffrey Garen <ggaren@apple.com>
23030
23031 Reviewed by Oliver Hunt.
23032
23033 AST optimization: Avoid NULL-checking ForNode's child nodes.
23034
23035 0.6% speedup on SunSpider.
23036
23037 This is a proof of concept patch that demonstrates how to optimize
23038 grammar productions with optional components, like
23039
23040 for (optional; optional; optional) {
23041 ...
23042 }
23043
23044 The parser emits NULL for an optional component that is not present.
23045
23046 Instead of checking for a NULL child at execution time, a node that
23047 expects an optional component to be present more often than not checks
23048 for a NULL child at construction time, and substitutes a viable
23049 alternative node in its place.
23050
23051 (We'd like the parser to start emitting NULL a lot more once we teach
23052 it to emit NULL for certain no-op productions like EmptyStatement and
23053 VariableStatement, so, as a foundation, it's important for nodes with
23054 NULL optional components to be fast.)
23055
23056 * kjs/Parser.cpp:
23057 (KJS::Parser::didFinishParsing): Check for NULL SourceElements. Also,
23058 moved didFinishParsing into the .cpp file because adding a branch while
23059 it was in the header file caused a substantial and inexplicable
23060 performance regression. (Did I mention that GCC is crazy?)
23061
23062 * kjs/grammar.y:
23063
23064 * kjs/nodes.cpp:
23065 (KJS::BlockNode::BlockNode): Check for NULL SourceElements.
23066 (KJS::ForNode::optimizeVariableAccess): No need to check for NULL here.
23067 (KJS::ForNode::execute): No need to check for NULL here.
23068 * kjs/nodes.h:
23069 (KJS::ForNode::): Check for NULL SourceElements. Substitute a TrueNode
23070 because it's semantically harmless, and it evaluates to boolean in an
23071 efficient manner.
23072
23073 2007-12-20 Oliver Hunt <oliver@apple.com>
23074
23075 Reviewed by Geoff.
23076
23077 Slight logic reordering in JSImmediate::from(double)
23078
23079 This gives a 0.6% improvement in SunSpider.
23080
23081 * kjs/JSImmediate.h:
23082 (KJS::JSImmediate::from):
23083
23084 2007-12-20 Eric Seidel <eric@webkit.org>
23085
23086 Reviewed by mjs.
23087
23088 Fix major Array regression introduced by 28899.
23089
23090 SunSpider claims this is at least 1.37x as fast as pre-regression. :)
23091
23092 * kjs/array_instance.cpp: make Arrays fast again!
23093
23094 2007-12-20 Eric Seidel <eric@webkit.org>
23095
23096 Reviewed by Geoff, then re-rubber-stamped by Geoff after final search/replace and testing.
23097
23098 Small reworking of Date code for 4% speedup on Date tests (0.2% overall)
23099 http://bugs.webkit.org/show_bug.cgi?id=16537
23100
23101 Make msToYear human-readable
23102 Make msToDayInMonth slightly more readable and avoid recalculating msToYear
23103 Remove use of isInLeapYear to avoid calling msToYear
23104 Remove dayInYear call by changing msToDayInMonth to dayInMonthFromDayInYear
23105 Remove more duplicate calls to dayInYear and getUTCOffset for further speedup
23106
23107 * kjs/DateMath.cpp:
23108 (KJS::daysFrom1970ToYear):
23109 (KJS::msToYear):
23110 (KJS::monthFromDayInYear):
23111 (KJS::checkMonth):
23112 (KJS::dayInMonthFromDayInYear):
23113 (KJS::dateToDayInYear):
23114 (KJS::getDSTOffsetSimple):
23115 (KJS::getDSTOffset):
23116 (KJS::gregorianDateTimeToMS):
23117 (KJS::msToGregorianDateTime):
23118
23119 2007-12-20 Rodney Dawes <dobey@wayofthemonkey.com>
23120
23121 Reviewed by Darin Adler.
23122
23123 Proxy includes of npruntime.h or npapi.h through npruntime_internal.h
23124 Include stdio.h in npapi.h for the use of FILE with XP_UNIX defined
23125 This is for building with X11, as some type and enum names conflict
23126 with #define names in X11 headers.
23127 http://bugs.webkit.org/show_bug.cgi?id=15669
23128
23129 * JavaScriptCore.xcodeproj/project.pbxproj:
23130 * bindings/NP_jsobject.h:
23131 * bindings/npapi.h:
23132 * bindings/npruntime.cpp:
23133 * bindings/npruntime_impl.h:
23134 * bindings/npruntime_priv.h:
23135 * bindings/npruntime_internal.h:
23136 * bindings/testbindings.cpp:
23137 * bindings/c/c_class.h:
23138 * bindings/c/c_runtime.h:
23139 * bindings/c/c_utility.h:
23140
23141 2007-12-20 Darin Adler <darin@apple.com>
23142
23143 - re-fix http://bugs.webkit.org/show_bug.cgi?id=16471
23144 Completions need to be smaller (or not exist at all)
23145
23146 Same patch as last time with the test failures problem fixed.
23147
23148 * kjs/function.cpp:
23149 (KJS::GlobalFuncImp::callAsFunction): Make sure to check the completion
23150 type from newExec to see if the execute raised an exception.
23151
23152 2007-12-20 Darin Adler <darin@apple.com>
23153
23154 - roll out that last change -- it was causing test failures;
23155 I'll check it back in after fixing them
23156
23157 2007-12-20 Darin Adler <darin@apple.com>
23158
23159 Reviewed by Eric.
23160
23161 - http://bugs.webkit.org/show_bug.cgi?id=16471
23162 Completions need to be smaller (or not exist at all)
23163
23164 SuSpider shows 2.4% speedup.
23165
23166 Stop using completions in the execution engine.
23167 Instead, the completion type and label target are both
23168 stored in the ExecState.
23169
23170 * API/JSContextRef.cpp: Removed unneeded include of "completion.h".
23171 * bindings/runtime_method.cpp: Removed unused execute function.
23172 * bindings/runtime_method.h: Ditto.
23173
23174 * kjs/ExecState.h: Added completionType, breakOrContinueTarget,
23175 setCompletionType, setNormalCompletion, setBreakCompletion,
23176 setContinueCompletion, setReturnValueCompletion, setThrowCompletion,
23177 setInterruptedCompletion, m_completionType, and m_breakOrContinueTarget.
23178
23179 * kjs/completion.h: Removed constructor and getter for target
23180 for break and continue from Completion. This class is now only
23181 used for the public API to Interpreter and such.
23182
23183 * kjs/date_object.h: Removed unused execute function.
23184
23185 * kjs/function.cpp:
23186 (KJS::FunctionImp::callAsFunction): Removed some unneeded
23187 exception processing. Updated to call the new execute function
23188 and to get the completion type from the ExecState. Merged in
23189 the execute function, which repeated some of the same logic and
23190 was called only from here.
23191 (KJS::GlobalFuncImp::callAsFunction): More of the same for eval.
23192 * kjs/function.h: Removed execute.
23193
23194 * kjs/interpreter.cpp:
23195 (KJS::Interpreter::evaluate): Added code to convert the result of
23196 execut into a Completion.
23197
23198 * kjs/nodes.cpp:
23199 (KJS::Node::setErrorCompletion): Renamed from createErrorCompletion.
23200 Now sets the completion type in the ExecState.
23201 (KJS::Node::rethrowException): Now sets the completion type in the
23202 ExecState.
23203 (KJS::StatementNode::hitStatement): Now sets the completion type in
23204 the ExecState.
23205 (KJS::VarStatementNode::execute): Updated to put completion type in
23206 the ExecState instead of a Completion object.
23207 (KJS::statementListExecute): Ditto. Also changed the for loop to use
23208 indices instead of iterators.
23209 (KJS::BlockNode::execute): Updated return type.
23210 (KJS::EmptyStatementNode::execute): Updated to put completion type in
23211 the ExecState instead of a Completion object.
23212 (KJS::ExprStatementNode::execute): Ditto.
23213 (KJS::IfNode::execute): Ditto.
23214 (KJS::DoWhileNode::execute): Ditto. Also streamlined the logic a little
23215 to make the normal case a little faster and moved the end outside the
23216 loop so that "break" can do a break.
23217 (KJS::WhileNode::execute): Ditto.
23218 (KJS::ForNode::execute): Ditto.
23219 (KJS::ForInNode::execute): Ditto.
23220 (KJS::ContinueNode::execute): Updated to put completion type in
23221 the ExecState instead of a Completion object.
23222 (KJS::BreakNode::execute): Ditto.
23223 (KJS::ReturnNode::execute): Ditto.
23224 (KJS::WithNode::execute): Ditto.
23225 (KJS::CaseClauseNode::executeStatements): Ditto. Also renamed to have
23226 execute in its name to reflect the fact that it's a member of the same
23227 family of functions.
23228 (KJS::CaseBlockNode::executeBlock): Ditto.
23229 (KJS::SwitchNode::execute): Ditto.
23230 (KJS::LabelNode::execute): Ditto.
23231 (KJS::ThrowNode::execute): Ditto.
23232 (KJS::TryNode::execute): Ditto.
23233 (KJS::ProgramNode::execute): Ditto.
23234 (KJS::EvalNode::execute): Ditto.
23235 (KJS::FunctionBodyNode::execute): Ditto.
23236 (KJS::FuncDeclNode::execute): Ditto.
23237
23238 * kjs/nodes.h: Renamed setErrorCompletion to createErrorCompletion, made
23239 hitStatement protected, changed return value of execute to a JSValue,
23240 renamed evalStatements to executeStatements, and evalBlock to executeBlock.
23241
23242 * kjs/number_object.h: Removed unused execute function.
23243
23244 2007-12-20 Geoffrey Garen <ggaren@apple.com>
23245
23246 Added Radar number.
23247
23248 * kjs/nodes.cpp:
23249 (KJS::ProgramNode::processDeclarations):
23250
23251 2007-12-20 Geoffrey Garen <ggaren@apple.com>
23252
23253 Linux build fix: config.h has to come first.
23254
23255 * kjs/error_object.cpp:
23256
23257 2007-12-19 Geoffrey Garen <ggaren@apple.com>
23258
23259 Reviewed by Oliver Hunt.
23260
23261 Optimized global access to global variables, using a symbol table.
23262
23263 SunSpider reports a 1.5% overall speedup, a 6.2% speedup on 3d-morph,
23264 and a whopping 33.1% speedup on bitops-bitwise-and.
23265
23266 * API/JSCallbackObjectFunctions.h: Replaced calls to JSObject:: with
23267 calls to Base::, since JSObject is not always our base class. This
23268 was always a bug, but the bug is even more apparent after some of my
23269 changes.
23270
23271 (KJS::::staticFunctionGetter): Replaced use of getDirect with call to
23272 getOwnPropertySlot. Global declarations are no longer stored in the
23273 property map, so a call to getDirect is insufficient for finding
23274 override properties.
23275
23276 * API/testapi.c:
23277 * API/testapi.js: Added test for the getDirect change mentioned above.
23278
23279 * kjs/ExecState.cpp:
23280 * kjs/ExecState.h: Dialed back the optimization to store a direct
23281 pointer to the localStorage buffer. One ExecState can grow the global
23282 object's localStorage without another ExecState's knowledge, so
23283 ExecState can't store a direct pointer to the localStorage buffer
23284 unless/until we invent a way to update all the relevant ExecStates.
23285
23286 * kjs/JSGlobalObject.cpp: Inserted the symbol table into get and put
23287 operations.
23288 (KJS::JSGlobalObject::reset): Reset the symbol table and local storage,
23289 too. Also, clear the property map here, removing the need for a
23290 separate call.
23291
23292 * kjs/JSVariableObject.cpp:
23293 * kjs/JSVariableObject.h: Added support for saving localStorage and the
23294 symbol table to the back/forward cache, and restoring them.
23295
23296 * kjs/function.cpp:
23297 (KJS::GlobalFuncImp::callAsFunction): Renamed progNode to evalNode
23298 because it's an EvalNode, not a ProgramNode.
23299
23300 * kjs/lookup.h:
23301 (KJS::cacheGlobalObject): Replaced put with faster putDirect, since
23302 that's how the rest of lookup.h works. putDirect is safe here because
23303 cacheGlobalObject is only used for objects whose names are not valid
23304 identifiers.
23305
23306 * kjs/nodes.cpp: The good stuff!
23307
23308 (KJS::EvalNode::processDeclarations): Replaced hasProperty with
23309 the new hasOwnProperty, which is slightly faster.
23310
23311 * kjs/object.h: Nixed clearProperties because clear() does this job now.
23312
23313 * kjs/property_map.cpp:
23314 * kjs/property_map.h: More back/forward cache support.
23315
23316 * wtf/Vector.h:
23317 (WTF::::grow): Added fast non-branching grow function. I used it in
23318 an earlier version of this patch, even though it's not used anymore.
23319
23320 2007-12-09 Mark Rowe <mrowe@apple.com>
23321
23322 Reviewed by Oliver Hunt.
23323
23324 Build fix for non-Mac platforms. Move NodeInfo into its own header so that the YYTYPE
23325 declaration in grammar.h is able to declare members of that type.
23326
23327 * kjs/NodeInfo.h: Added.
23328 (KJS::createNodeInfo):
23329 (KJS::mergeDeclarationLists):
23330 (KJS::appendToVarDeclarationList):
23331 * kjs/grammar.y:
23332 * kjs/lexer.cpp:
23333
23334 2007-12-19 Oliver Hunt <oliver@apple.com>
23335
23336 Make appendToVarDeclarationList static
23337
23338 RS=Weinig.
23339
23340 * kjs/grammar.y:
23341
23342 2007-12-18 Oliver Hunt <oliver@apple.com>
23343
23344 Remove dead code due to removal of post-parse declaration discovery.
23345
23346 RS=Geoff.
23347
23348 Due to the removal of the declaration discovery pass after parsing we
23349 no longer need any of the logic used for that discovery.
23350
23351 * kjs/nodes.cpp:
23352 (KJS::Node::Node):
23353 (KJS::VarDeclNode::VarDeclNode):
23354 (KJS::BlockNode::BlockNode):
23355 (KJS::ForInNode::ForInNode):
23356 (KJS::CaseBlockNode::CaseBlockNode):
23357 * kjs/nodes.h:
23358 (KJS::VarStatementNode::):
23359 (KJS::IfNode::):
23360 (KJS::DoWhileNode::):
23361 (KJS::WhileNode::):
23362 (KJS::WithNode::):
23363 (KJS::LabelNode::):
23364 (KJS::TryNode::):
23365 (KJS::FuncDeclNode::):
23366 (KJS::CaseClauseNode::):
23367 (KJS::ClauseListNode::):
23368 (KJS::SwitchNode::):
23369
23370 2007-12-18 Oliver Hunt <oliver@apple.com>
23371
23372 Replace post-parse pass to find declarations with logic in the parser itself
23373
23374 Reviewed by Geoff.
23375
23376 Instead of finding declarations in a pass following the initial parsing of
23377 a program, we incorporate the logic directly into the parser. This lays
23378 the groundwork for further optimisations (such as improving performance in
23379 declaration expressions -- var x = y; -- to match that of standard assignment)
23380 in addition to providing a 0.4% performance improvement in SunSpider.
23381
23382 * JavaScriptCore.exp:
23383 * kjs/Parser.cpp:
23384 (KJS::Parser::parse):
23385 * kjs/Parser.h:
23386 (KJS::Parser::didFinishParsing):
23387 (KJS::Parser::parse):
23388 * kjs/grammar.y:
23389 * kjs/nodes.cpp:
23390 (KJS::ParserTracked::ParserTracked):
23391 (KJS::ParserTracked::~ParserTracked):
23392 (KJS::ParserTracked::ref):
23393 (KJS::ParserTracked::deref):
23394 (KJS::ParserTracked::refcount):
23395 (KJS::ParserTracked::clearNewTrackedObjects):
23396 (KJS::Node::Node):
23397 (KJS::ScopeNode::ScopeNode):
23398 (KJS::ProgramNode::ProgramNode):
23399 (KJS::EvalNode::EvalNode):
23400 (KJS::FunctionBodyNode::FunctionBodyNode):
23401 (KJS::FunctionBodyNode::initializeSymbolTable):
23402 (KJS::FunctionBodyNode::processDeclarations):
23403 * kjs/nodes.h:
23404 (KJS::ParserTracked::):
23405 (KJS::Node::):
23406 (KJS::ScopeNode::):
23407
23408 2007-12-18 Xan Lopez <xan@gnome.org>
23409
23410 Reviewed by Geoff.
23411
23412 Fix http://bugs.webkit.org/show_bug.cgi?id=14521
23413 Bug 14521: JavaScriptCore fails to build on Linux/PPC gcc 4.1.2
23414
23415 * wtf/TCSpinLock.h:
23416 (TCMalloc_SpinLock::Unlock):
23417
23418 Use less strict memory operand constraint on inline asm generation.
23419 PLATFORM(DARWIN) left unpatched due to Apple's GCC bug.
23420
23421 Patch by David Kilzer <ddkilzer@webkit.org>
23422
23423 2007-12-18 Mark Rowe <mrowe@apple.com>
23424
23425 Rubber-stamped by Maciej Stachowiak.
23426
23427 Remove outdated and non-functioning project files for the Apollo port.
23428
23429 * JavaScriptCore.apolloproj: Removed.
23430
23431 2007-12-18 Darin Adler <darin@apple.com>
23432
23433 - fix Windows build
23434
23435 * pcre/pcre_exec.cpp:
23436 (jsRegExpExecute): Change back from false/true to 0/1 -- I probably should not have
23437 deleted MATCH_MATCH and MATCH_NOMATCH, but I'm going to leave them out.
23438
23439 2007-12-18 Darin Adler <darin@apple.com>
23440
23441 Reviewed by Geoff.
23442
23443 - fix http://bugs.webkit.org/show_bug.cgi?id=16458
23444 REGRESSION (r28164): regular expressions can now hang due to lack of a match limit
23445 <rdar://problem/5636067>
23446
23447 Test: fast/regex/slow.html
23448
23449 Slows down SunSpider a bit (about 1.01x); filed a bug to follow up on that:
23450 http://bugs.webkit.org/show_bug.cgi?id=16503
23451
23452 * pcre/pcre.h: Changed name of error code to not specifically mention "recursion".
23453 * pcre/pcre_exec.cpp:
23454 (match): Replaced the depth limit, MATCH_RECURSION_LIMIT, with a total match looping
23455 limit, matchLimit. Also eliminated the constants for MATCH_MATCH and MATCH_NOMATCH,
23456 since they are just true and false (1 and 0).
23457 (jsRegExpExecute): More of the MATCH_MATCH change.
23458
23459 2007-12-17 Darin Adler <darin@apple.com>
23460
23461 - speculative build fix for non-gcc platforms
23462
23463 * pcre/pcre_exec.cpp: (match): Remove unused cases from return switch.
23464
23465 2007-12-16 Mark Rowe <mrowe@apple.com>
23466
23467 Speculative build fix for non-Mac platforms.
23468
23469 * pcre/pcre_compile.cpp: Include string.h for memset, memmove, etc.
23470
23471 2007-12-16 Darin Adler <darin@apple.com>
23472
23473 Reviewed by Maciej.
23474
23475 - http://bugs.webkit.org/show_bug.cgi?id=16438
23476 - removed some more unused code
23477 - changed quite a few more names to WebKit-style
23478 - moved more things out of pcre_internal.h
23479 - changed some indentation to WebKit-style
23480 - improved design of the functions for reading and writing
23481 2-byte values from the opcode stream (in pcre_internal.h)
23482
23483 * pcre/dftables.cpp:
23484 (main): Added the kjs prefix a normal way in lieu of using macros.
23485
23486 * pcre/pcre_compile.cpp: Moved some definitions here from pcre_internal.h.
23487 (errorText): Name changes, fewer typedefs.
23488 (checkEscape): Ditto. Changed uppercase conversion to use toASCIIUpper.
23489 (isCountedRepeat): Name change.
23490 (readRepeatCounts): Name change.
23491 (firstSignificantOpcode): Got rid of the use of OP_lengths, which is
23492 very lightly used here. Hard-coded the length of OP_BRANUMBER.
23493 (firstSignificantOpcodeSkippingAssertions): Ditto. Also changed to
23494 use the advanceToEndOfBracket function.
23495 (getOthercaseRange): Name changes.
23496 (encodeUTF8): Ditto.
23497 (compileBranch): Name changes. Removed unused after_manual_callout and
23498 the code to handle it. Removed code to handle OP_ONCE since we never
23499 emit this opcode. Changed to use advanceToEndOfBracket in more places.
23500 (compileBracket): Name changes.
23501 (branchIsAnchored): Removed code to handle OP_ONCE since we never emit
23502 this opcode.
23503 (bracketIsAnchored): Name changes.
23504 (branchNeedsLineStart): More fo the same.
23505 (bracketNeedsLineStart): Ditto.
23506 (branchFindFirstAssertedCharacter): Removed OP_ONCE code.
23507 (bracketFindFirstAssertedCharacter): More of the same.
23508 (calculateCompiledPatternLengthAndFlags): Ditto.
23509 (returnError): Name changes.
23510 (jsRegExpCompile): Ditto.
23511
23512 * pcre/pcre_exec.cpp: Moved some definitions here from pcre_internal.h.
23513 (matchRef): Updated names.
23514 Improved macros to use the do { } while(0) idiom so they expand to single
23515 statements rather than to blocks or multiple statements. And refeactored
23516 the recursive match macros.
23517 (MatchStack::pushNewFrame): Name changes.
23518 (getUTF8CharAndIncrementLength): Name changes.
23519 (match): Name changes. Removed the ONCE opcode.
23520 (jsRegExpExecute): Name changes.
23521
23522 * pcre/pcre_internal.h: Removed quite a few unneeded includes. Rewrote
23523 quite a few comments. Removed the macros that add kjs prefixes to the
23524 functions with external linkage; instead renamed the functions. Removed
23525 the unneeded typedefs pcre_uint16, pcre_uint32, and uschar. Removed the
23526 dead and not-all-working code for LINK_SIZE values other than 2, although
23527 we aim to keep the abstraction working. Removed the OP_LENGTHS macro.
23528 (put2ByteValue): Replaces put2ByteOpcodeValueAtOffset.
23529 (get2ByteValue): Replaces get2ByteOpcodeValueAtOffset.
23530 (put2ByteValueAndAdvance): Replaces put2ByteOpcodeValueAtOffsetAndAdvance.
23531 (putLinkValueAllowZero): Replaces putOpcodeValueAtOffset; doesn't do the
23532 addition, since a comma is really no better than a plus sign. Added an
23533 assertion to catch out of range values and changed the parameter type to
23534 int rather than unsigned.
23535 (getLinkValueAllowZero): Replaces getOpcodeValueAtOffset.
23536 (putLinkValue): New function that most former callers of the
23537 putOpcodeValueAtOffset function can use; asserts the value that is
23538 being stored is non-zero and then calls putLinkValueAllowZero.
23539 (getLinkValue): Ditto.
23540 (putLinkValueAndAdvance): Replaces putOpcodeValueAtOffsetAndAdvance. No
23541 caller was using an offset, which makes sense given the advancing behavior.
23542 (putLinkValueAllowZeroAndAdvance): Ditto.
23543 (isBracketOpcode): Added. For use in an assertion.
23544 (advanceToEndOfBracket): Renamed from moveOpcodePtrPastAnyAlternateBranches,
23545 and removed comments about how it's not well designed. This function takes
23546 a pointer to the beginning of a bracket and advances to the end of the
23547 bracket.
23548
23549 * pcre/pcre_tables.cpp: Updated names.
23550 * pcre/pcre_ucp_searchfuncs.cpp:
23551 (kjs_pcre_ucp_othercase): Ditto.
23552 * pcre/pcre_xclass.cpp:
23553 (getUTF8CharAndAdvancePointer): Ditto.
23554 (kjs_pcre_xclass): Ditto.
23555 * pcre/ucpinternal.h: Ditto.
23556
23557 * wtf/ASCIICType.h:
23558 (WTF::isASCIIAlpha): Added an int overload, like the one we already have for
23559 isASCIIDigit.
23560 (WTF::isASCIIAlphanumeric): Ditto.
23561 (WTF::isASCIIHexDigit): Ditto.
23562 (WTF::isASCIILower): Ditto.
23563 (WTF::isASCIISpace): Ditto.
23564 (WTF::toASCIILower): Ditto.
23565 (WTF::toASCIIUpper): Ditto.
23566
23567 2007-12-16 Darin Adler <darin@apple.com>
23568
23569 Reviewed by Maciej.
23570
23571 - fix http://bugs.webkit.org/show_bug.cgi?id=16459
23572 REGRESSION: assertion failure with regexp with \B in a case-ignoring character range
23573 <rdar://problem/5646361>
23574
23575 The problem was that \B was not handled properly in character classes.
23576
23577 Test: fast/js/regexp-overflow.html
23578
23579 * pcre/pcre_compile.cpp:
23580 (check_escape): Added handling of ESC_b and ESC_B in character classes here.
23581 Allows us to get rid of the handling of \b in character classes from all the
23582 call sites that handle it separately and to handle \B properly as well.
23583 (compileBranch): Remove the ESC_b handling, since it's not needed any more.
23584 (calculateCompiledPatternLengthAndFlags): Ditto.
23585
23586 2007-12-16 Mark Rowe <mrowe@apple.com>
23587
23588 Reviewed by Maciej Stachowiak.
23589
23590 Fix http://bugs.webkit.org/show_bug.cgi?id=16448
23591 Bug 16448: [GTK] Celtic Kane JavaScript performance on Array test is slow relative to Mac
23592
23593 * kjs/array_instance.cpp:
23594 (KJS::compareByStringPairForQSort):
23595 (KJS::ArrayInstance::sort): Convert JSValue's to strings once up front and then sort the
23596 results. This avoids calling toString twice per comparison, but requires a temporary buffer
23597 so we only use this approach in cases where the array being sorted is not too large.
23598
23599 2007-12-16 Geoffrey Garen <ggaren@apple.com>
23600
23601 Reviewed by Darin Adler and Maciej Stachowiak.
23602
23603 More refactoring to support global variable optimization.
23604
23605 Changed SymbolTable to use RefPtr<UString::Rep> as its key instead of
23606 UString::Rep*. With globals, the symbol table can outlast the
23607 declaration node for any given symbol, so the symbol table needs to ref
23608 its symbol names.
23609
23610 In support, specialized HashMaps with RefPtr keys to allow lookup
23611 via raw pointer, avoiding refcount churn.
23612
23613 SunSpider reports a .6% speedup (prolly just noise).
23614
23615 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added new file: wtf/RefPtrHashMap.h
23616 * JavaScriptCore.xcodeproj/project.pbxproj: ditto
23617
23618 * kjs/JSVariableObject.cpp:
23619 (KJS::JSVariableObject::getPropertyNames): Symbol table keys are RefPtrs now.
23620
23621 * kjs/SymbolTable.h: Modified key traits to match RefPtr. Added a
23622 static Rep* for null, which helps compute the deletedValue() trait.
23623
23624 * wtf/HashMap.h: #include the RefPtr specialization so everyone can use it.
23625
23626 * wtf/RefPtrHashMap.h: Copied from wtf/HashMap.h. Added overloaded versions
23627 of find(), contains(), get(), set(), add(), remove(), and take() that take
23628 raw pointers as keys.
23629
23630 2007-12-16 Alexey Proskuryakov <ap@webkit.org>
23631
23632 Reviewed by Darin.
23633
23634 http://bugs.webkit.org/show_bug.cgi?id=16162
23635 Problems with float parsing on Linux (locale-dependent parsing was used).
23636
23637 * kjs/dtoa.cpp: Removed USE_LOCALE to reduce future confusion.
23638 * kjs/lexer.cpp: (KJS::Lexer::lex): Parse with kjs_strtod, not the system one.
23639
23640 2007-12-14 Alp Toker <alp@atoker.com>
23641
23642 Reviewed by Mark Rowe.
23643
23644 Enable the AllInOneFile.cpp optimization for the GTK+ port.
23645
23646 * JavaScriptCore.pri:
23647
23648 2007-12-14 Mark Rowe <mrowe@apple.com>
23649
23650 Unreviewed. Remove commented out fprintf's that were for debugging purposes only.
23651
23652 * wtf/FastMalloc.cpp:
23653 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
23654
23655 2007-12-14 Mark Rowe <mrowe@apple.com>
23656
23657 Reviewed by Maciej Stachowiak.
23658
23659 Don't use the MADV_DONTNEED code path for now as it has no effect on Mac OS X and is
23660 currently untested on other platforms.
23661
23662 * wtf/TCSystemAlloc.cpp:
23663 (TCMalloc_SystemRelease): Return after releasing memory rather than potentially falling
23664 through into another mechanism if multiple are supported.
23665
23666 2007-12-14 Alp Toker <alp@atoker.com>
23667
23668 Build fix for GTK+/Qt and ports that don't use AllInOneFile.cpp.
23669
23670 Include UnusedParam.h.
23671
23672 * wtf/TCSystemAlloc.cpp:
23673
23674 2007-12-14 Oliver Hunt <oliver@apple.com>
23675
23676 Reviewed by Stephanie.
23677
23678 Fix build on windows
23679
23680 * wtf/FastMalloc.cpp:
23681 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
23682
23683 2007-12-14 Dan Bernstein <mitz@apple.com>
23684
23685 - try again to fix the Windows build
23686
23687 * wtf/TCSystemAlloc.cpp:
23688 (TCMalloc_SystemRelease):
23689
23690 2007-12-14 Dan Bernstein <mitz@apple.com>
23691
23692 - try to fix the Windows build
23693
23694 * wtf/TCSystemAlloc.cpp:
23695 (TCMalloc_SystemRelease):
23696
23697 2007-12-14 Mark Rowe <mrowe@apple.com>
23698
23699 Reviewed by Maciej and Oliver.
23700
23701 Add final changes to make TCMalloc release memory to the system.
23702 This results in a 0.4% regression against ToT, but this is offset
23703 against the gains made by the original TCMalloc r38 merge - in fact
23704 we retain around 0.3-0.4% progression overall.
23705
23706 * wtf/FastMalloc.cpp:
23707 (WTF::InitSizeClasses):
23708 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
23709 * wtf/TCSystemAlloc.cpp:
23710 (TCMalloc_SystemRelease):
23711
23712 2007-12-14 Darin Adler <darin@apple.com>
23713
23714 Reviewed by Sam.
23715
23716 - removed unnecessary includes of "Vector.h"
23717
23718 * wtf/HashMap.h:
23719 (WTF::copyKeysToVector): Make the type of the vector be a template parameter.
23720 This allows copying keys into a vector of a base class or one with an inline capacity.
23721 (WTF::copyValuesToVector): Ditto.
23722 * wtf/HashSet.h:
23723 (WTF::copyToVector): Ditto.
23724
23725 2007-12-14 Anders Carlsson <andersca@apple.com>
23726
23727 Reviewed by Darin and Geoff.
23728
23729 <rdar://problem/5619295>
23730 REGRESSION: 303-304: Embedded YouTube video fails to render- JS errors (16150) (Flash 9)
23731
23732 Get rid of unnecessary and incorrect security checks for plug-ins accessing JavaScript objects.
23733
23734 The way this used to work was that each NPObject that wrapped a JSObject would have a root object
23735 corresponding to the frame object (used for managing the lifecycle) and an origin root object (used for
23736 doing security checks).
23737
23738 This would prevent a plug-in from accessing a frame's window object if it's security origin was different
23739 (some parts of the window, such as the location object, can be accessed from frames with different security
23740 origins, and those checks are being done in WebCore).
23741
23742 Also, if a plug-in were to access a window object of a frame that later went away, it could lead to that
23743 Window JSObject being garbage collected and the NPObject pointing to freed memory.
23744
23745 How this works now is that there is no origin root object anymore, and all NPObject wrappers that are created
23746 for a plug-in will have the root object of the containing frame of that plug-in.
23747
23748 * bindings/NP_jsobject.cpp:
23749 (jsDeallocate):
23750 Don't free the origin root object.
23751
23752 (_NPN_CreateScriptObject):
23753 Remove the origin root object parameter.
23754
23755 (_NPN_InvokeDefault):
23756 (_NPN_Invoke):
23757 (_NPN_Evaluate):
23758 (_NPN_GetProperty):
23759 (_NPN_SetProperty):
23760 (_NPN_RemoveProperty):
23761 (_NPN_HasProperty):
23762 (_NPN_HasMethod):
23763 (_NPN_Enumerate):
23764 Get rid of all security checks.
23765
23766 * bindings/NP_jsobject.h:
23767 Remove originRootObject from the JavaScriptObject struct.
23768
23769 * bindings/c/c_utility.cpp:
23770 (KJS::Bindings::convertValueToNPVariant):
23771 Always use the root object from the ExecState.
23772
23773 2007-12-13 Steve Falkenburg <sfalken@apple.com>
23774
23775 Move source file generation into its own vcproj to fix build dependencies.
23776
23777 Reviewed by Adam.
23778
23779 * JavaScriptCore.vcproj/JavaScriptCore.sln:
23780 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
23781 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Added.
23782 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Added.
23783 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
23784
23785 2007-12-13 Alp Toker <alp@atoker.com>
23786
23787 http://bugs.webkit.org/show_bug.cgi?id=16406
23788 [Gtk] JavaScriptCore needs -lpthread
23789
23790 Build fix for Debian and any other platforms that don't implicitly
23791 link to pthread.
23792
23793 Link to pthread on non-Windows platforms until this dependency is
23794 removed from JSC.
23795
23796 2007-12-11 Geoffrey Garen <ggaren@apple.com>
23797
23798 Reviewed by Sam Weinig.
23799
23800 Build fix: Note some variables that are used only for ASSERTs.
23801
23802 * API/testapi.c:
23803 (Base_finalize):
23804 (globalObject_initialize):
23805 (testInitializeFinalize):
23806
23807 2007-12-11 Geoffrey Garen <ggaren@apple.com>
23808
23809 Reviewed by Darin Adler.
23810
23811 Fixed: All JS tests crash on Windows.
23812
23813 NDEBUG wasn't defined when compiling testkjs in release builds, so the
23814 HashTable definition in HashTable.h included an extra data member.
23815
23816 The solution was to add NDEBUG to the release testkjs configuration on
23817 Windows and Mac.
23818
23819 For giggles, I also added other missing #defines to testkjs on Windows.
23820
23821 * Configurations/Base.xcconfig:
23822 * Configurations/JavaScriptCore.xcconfig:
23823 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
23824 * JavaScriptCore.xcodeproj/project.pbxproj:
23825 * kjs/testkjs.cpp:
23826 (main):
23827
23828 2007-12-11 Geoffrey Garen <ggaren@apple.com>
23829
23830 Reviewed by Darin Adler.
23831
23832 Removed bogus ASSERT.
23833
23834 ASSERT should only be used when we know that a code path will not be
23835 taken. This code path is taken often during the jsFunFuzz test.
23836
23837 * pcre/pcre_exec.cpp:
23838 (jsRegExpExecute):
23839
23840 2007-12-11 Darin Adler <darin@apple.com>
23841
23842 * wtf/unicode/qt4/UnicodeQt4.h: Try to fix Qt build by adding U16_IS_SINGLE.
23843
23844 2007-12-10 Darin Adler <darin@apple.com>
23845
23846 Reviewed by Sam Weinig.
23847
23848 - fix http://bugs.webkit.org/show_bug.cgi?id=16379
23849 REGRESSION(r28525): Failures in http/tests/xmlhttprequest/response-encoding.html and
23850 fast/dom/xmlhttprequest-html-response-encoding.html
23851 and <rdar://problem/5640230> REGRESSION (306A4-ToT): Access violation in PCRE function
23852 find_firstassertedchar
23853
23854 Test: fast/js/regexp-find-first-asserted.html
23855
23856 * pcre/pcre_compile.cpp:
23857 (compileBracket): Take out unnecessary initialization of out parameters.
23858 (branchFindFirstAssertedCharacter): Added. Broke out the half of the function that handles
23859 a branch.
23860 (bracketFindFirstAssertedCharacter): Renamed from find_firstassertedchar. Also removed the
23861 options parameter -- the caller can handle the options.
23862 (jsRegExpCompile): Changed call site to call the appropriate bracket or branch version of
23863 the find_firstassertedchar function. Also put the REQ_IGNORE_CASE code here instead of
23864 passing in the options.
23865
23866 2007-12-10 Geoffrey Garen <ggaren@apple.com>
23867
23868 Reviewed by Sam Weinig.
23869
23870 Split this:
23871
23872 FunctionBodyNode
23873 ^
23874 |
23875 ProgramNode
23876
23877 into this:
23878
23879 ScopeNode
23880 ^ ^ ^
23881 | | |
23882 FunctionBodyNode ProgramNode EvalNode
23883
23884 in preparation for specializing each class more while optimizing global
23885 variable access.
23886
23887 Also removed some cruft from the FunctionBodyNode interface to simplify
23888 things.
23889
23890 SunSpider says this patch is a .8% speedup, which seems reasonable,
23891 since it eliminates a few branches and adds KJS_FAST_CALL in a few
23892 places.
23893
23894 Layout tests and JS tests pass. Also, this baby builds on Windows! (Qt
23895 mileage may vary...)
23896
23897 2007-12-10 Geoffrey Garen <ggaren@apple.com>
23898
23899 RS by Mark Rowe.
23900
23901 Mac build fix: added some exported symbols, now that Parser::parse is
23902 defined in the header.
23903
23904 * JavaScriptCore.exp:
23905
23906 2007-12-10 Sam Weinig <sam@webkit.org>
23907
23908 Build fix.
23909
23910 Template methods need to be in the header.
23911
23912 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
23913 * kjs/Parser.cpp:
23914 * kjs/Parser.h:
23915 (KJS::Parser::parse):
23916
23917 2007-12-10 Geoffrey Garen <ggaren@apple.com>
23918
23919 Reviewed by Sam Weinig.
23920
23921 Merged different implementations of Parser::parse into a single,
23922 templatized implementation, in preparation for adding yet another
23923 implementation for "eval" code.
23924
23925 JS and layout tests pass.
23926
23927 2007-12-10 Timothy Hatcher <timothy@apple.com>
23928
23929 Reviewed by Mark Rowe
23930
23931 <rdar://problem/5639463> Bundle versions on Tiger should be 4523.x not 523.x
23932
23933 * Configurations/Version.xcconfig: Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR,
23934 so assume Tiger and use a 4 for the SYSTEM_VERSION_PREFIX.
23935
23936 2007-12-10 Mark Rowe <mrowe@apple.com>
23937
23938 Tiger build fix.
23939
23940 * kjs/grammar.y: Use @1 and @0 in place of @$ where Tiger's bison chokes.
23941
23942 2007-12-10 Darin Adler <darin@apple.com>
23943
23944 Reviewed by Mark Rowe.
23945
23946 - fix http://bugs.webkit.org/show_bug.cgi?id=16375
23947 REGRESSION: Safari crashes on quit
23948
23949 Probably a debug-only issue.
23950
23951 * kjs/Parser.cpp:
23952 (KJS::parser): Create the parser and never destroy it by using a pointer instead
23953 of a global object.
23954
23955 2007-12-09 Darin Adler <darin@apple.com>
23956
23957 Reviewed by Sam Weinig.
23958
23959 - fix http://bugs.webkit.org/show_bug.cgi?id=16369
23960 REGRESSION (r28525): regular expression tests failing due to bad firstByte optimization
23961
23962 * pcre/pcre_compile.cpp: Changed some names to use interCaps intead of under_scores.
23963 (branchIsAnchored): Broke is_anchored into two separate functions; this one works on a
23964 branch and the other on an anchor. The old function would only work on a bracket.
23965 Also removed unneeded parameters; the anchored check does not require the bracket
23966 map or the options any more because we have a reduced set of features.
23967 (bracketIsAnchored): Ditto.
23968 (branchNeedsLineStart): Broke canApplyFirstCharOptimization into two functions and gave
23969 both a better name. This is the function that was returning the wrong value. The failure
23970 was beacuse the old function would only work on a bracket.
23971 (bracketNeedsLineStart): Ditto.
23972 (jsRegExpCompile): Changed to call the appropriate branch or bracket flavor of the
23973 functions based on whether we compiled an outer bracket. Also removed inaccurate comments
23974 and unneeded parameters.
23975
23976 - other small changes
23977
23978 * pcre/pcre.h: Renumbered error codes, in a logical order. First, normal failure, then
23979 the recursion limit, then running out of memory, and finally an unexpected internal error.
23980
23981 * pcre/pcre_exec.cpp: Fixed indentation.
23982 (jsRegExpExecute): Corrected an inaccurate comment.
23983
23984 2007-12-09 Darin Adler <darin@apple.com>
23985
23986 Reviewed by Maciej.
23987
23988 - fix http://bugs.webkit.org/show_bug.cgi?id=16370
23989 REGRESSION (r28540): source URL and line number no longer set for outer function/programs
23990
23991 Test: fast/js/exception-linenums-in-html-1.html
23992 Test: fast/js/exception-linenums-in-html-2.html
23993 Test: fast/js/exception-linenums.html
23994
23995 By the time the ProgramNode was constructed, the source URL was empty.
23996
23997 * kjs/Parser.cpp:
23998 (KJS::Parser::parseProgram): Added code to set and clear m_sourceURL, which is now
23999 handled here instead of in the lexer; it needs to still be set when we create the
24000 program node. Call setLoc to set the first and last line number.
24001 (KJS::Parser::parseFunctionBody): Ditto, but for the body.
24002 (KJS::Parser::parse): Removed the sourceURL argument.
24003
24004 * kjs/Parser.h: Added sourceURL(), m_sourceURL, and m_lastLine. Added a lastLine
24005 parameter to didFinishParsing, since the bison grammar knows the last line number
24006 and we otherwise do not know it. Removed the sourceURL parameter from parse, since
24007 that's now handled at a higher level.
24008
24009 * kjs/grammar.y: Pass the last line number to didFinishParsing.
24010
24011 * kjs/lexer.cpp:
24012 (KJS::Lexer::setCode): Removed the sourceURL argument and the code to set m_sourceURL.
24013 (KJS::Lexer::clear): Ditto.
24014 * kjs/lexer.h: More of the same.
24015
24016 * kjs/nodes.cpp:
24017 (KJS::FunctionBodyNode::FunctionBodyNode): Get the source URL from the parser rather
24018 than from the lexer. Removed unneeded call to setLoc, since the line numbers already
24019 both default to -1.
24020
24021 2007-12-08 Oliver Hunt <oliver@apple.com>
24022
24023 Reviewed by Sam W.
24024
24025 Split the ENABLE_SVG_EXPERIMENTAL_FEATURES flag into separate flags.
24026
24027 Fixes <rdar://problem/5620249> Must disable SVG animation
24028 <rdar://problem/5612772> Disable SVG filters on Mac to match Windows behavior
24029
24030 Minor config changes.
24031
24032 * Configurations/JavaScriptCore.xcconfig:
24033 * JavaScriptCore.xcodeproj/project.pbxproj:
24034
24035 2007-12-07 Sam Weinig <sam@webkit.org>
24036
24037 Reviewed by Darin.
24038
24039 - Rename isSafeScript to allowsAccessFrom.
24040
24041 * bindings/NP_jsobject.cpp:
24042 (_isSafeScript):
24043 * kjs/JSGlobalObject.h:
24044 (KJS::JSGlobalObject::allowsAccessFrom): Reverse caller/argument of allowsAccessFrom to match
24045 the new call.
24046
24047 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24048
24049 Reviewed by Sam Weinig.
24050
24051 Refactored variable access optimization: Removed the assumption that
24052 the FunctionBodyNode holds the symbol table.
24053
24054 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24055
24056 Build fix: added #include.
24057
24058 * kjs/nodes.cpp:
24059
24060 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24061
24062 Build fix: added #include.
24063
24064 * kjs/interpreter.cpp:
24065
24066 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24067
24068 Build fix: added #include.
24069
24070 * kjs/grammar.y:
24071
24072 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24073
24074 Build fix: added #include.
24075
24076 * kjs/function_object.cpp:
24077
24078 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24079
24080 Reviewed by Sam Weinig.
24081
24082 Fixed crash seen running layout tests.
24083
24084 Reverted a change I made earlier today. Added a comment to try to
24085 discourage myself from making this mistake a third time.
24086
24087 * kjs/function.cpp:
24088 (KJS::ActivationImp::mark):
24089 * kjs/function.h:
24090 (KJS::ActivationImp::ActivationImpData::ActivationImpData):
24091
24092 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24093
24094 Reviewed by Sam Weinig.
24095
24096 Refactored parsing of global code: Removed the assumption that
24097 ProgramNode inherits from FunctionBodyNode from the parser.
24098
24099 * kjs/Parser.cpp:
24100 (KJS::Parser::parseProgram):
24101 (KJS::Parser::parseFunctionBody):
24102 (KJS::Parser::parse):
24103 * kjs/Parser.h:
24104 (KJS::Parser::didFinishParsing):
24105 * kjs/function.cpp:
24106 * kjs/grammar.y:
24107 * kjs/nodes.h:
24108
24109 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24110
24111 Build fix: added JSVariableObject.cpp to the .pri file.
24112
24113 * JavaScriptCore.pri:
24114
24115 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24116
24117 Build fix: added #include.
24118
24119 * kjs/function.cpp:
24120
24121 2007-12-07 Steve Falkenburg <sfalken@apple.com>
24122
24123 Re-named our B&I flag from BUILDBOT to PRODUCTION.
24124
24125 Reviewed by Sam Weinig.
24126
24127 * JavaScriptCore.vcproj/JavaScriptCore.make:
24128 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
24129
24130 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24131
24132 Build fix: removed stray name qualification.
24133
24134 * kjs/function.h:
24135 (KJS::ActivationImp::ActivationImp):
24136
24137 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24138
24139 Build fix: moved functions with qualified names outside of class
24140 declaration.
24141
24142 * kjs/JSVariableObject.h:
24143 (KJS::JSVariableObject::symbolTableGet):
24144 (KJS::JSVariableObject::symbolTablePut):
24145
24146 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24147
24148 Reviewed by Sam Weinig.
24149
24150 Next step in refactoring JSGlobalObject: Added JSVariableObject class,
24151 and factored symbol-table-related code into it. (JSGlobalObject doesn't
24152 use the symbol table code yet, though.)
24153
24154 Layout and JS tests, and testapi, pass. SunSpider reports no regression.
24155
24156 2007-12-07 Darin Adler <darin@apple.com>
24157
24158 Reviewed by Geoff.
24159
24160 - fix http://bugs.webkit.org/show_bug.cgi?id=16185
24161 jsRegExpCompile should not add implicit non-capturing bracket
24162
24163 While this does not make SunSpider faster, it will make many regular
24164 expressions a bit faster.
24165
24166 * pcre/pcre_compile.cpp: Moved CompileData struct in here from the
24167 header since it's private to this file.
24168 (compile_branch): Updated for function name change.
24169 (compile_bracket): Renamed from compile_regex, since, for one thing,
24170 this does not compile an entire regular expression.
24171 (calculateCompiledPatternLengthAndFlags): Removed unused item_count
24172 local variable. Renamed CompileData to cd instead of compile_block
24173 to be consistent with other functions. Added code to set the
24174 needOuterBracket flag if there's at least one "|" at the outer level.
24175 (jsRegExpCompile): Renamed CompileData to cd instead of compile_block
24176 to be consistent with other functions. Removed unneeded "size" field
24177 from the compiled regular expression. If no outer bracket is needed,
24178 then use compile_branch to compile the regular expression.
24179
24180 * pcre/pcre_internal.h: Removed the CompileData struct, which is now
24181 private to pcre_compile.cpp. Removed the size member from JSRegExp.
24182
24183 2007-12-06 Kevin Ollivier <kevino@theolliviers.com>
24184
24185 MSVC7 build fix due to a compiler bug with placement new and/or
24186 templates and casting.
24187
24188 Reviewed by Darin Adler.
24189
24190 * wtf/Vector.h:
24191 (WTF::::append):
24192
24193 2007-12-06 Darin Adler <darin@apple.com>
24194
24195 Reviewed by Eric Seidel.
24196
24197 - fix http://bugs.webkit.org/show_bug.cgi?id=16321
24198 new RegExp("[\u0097]{4,6}", "gmy") crashes in DEBUG builds
24199 <rdar://problem/5632992>
24200
24201 Test: fast/js/regexp-oveflow.html
24202
24203 * pcre/pcre_compile.cpp:
24204 (calculateCompiledPatternLengthAndFlags): In the case where a single character
24205 character class is optimized to not use a character class at all, the preflight
24206 code was not setting the lastitemlength variable.
24207
24208 2007-12-05 Mark Rowe <mrowe@apple.com>
24209
24210 Qt Windows build fix. Include the time-related headers in the correct place.
24211
24212 * kjs/JSGlobalObject.cpp:
24213 * kjs/interpreter.cpp:
24214
24215 2007-12-05 Darin Adler <darin@apple.com>
24216
24217 Not reviewed; just undoing a previous commit.
24218
24219 - remove earlier incorrect fix for http://bugs.webkit.org/show_bug.cgi?id=16220
24220 <rdar://problem/5625221> Crash opening www.news.com (CNet)
24221
24222 The real bug was the backwards ?: in the compile function, which Geoff just
24223 fixed. Rolling out the incorrect earlier fix.
24224
24225 * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags): Take out
24226 the unneeded preflight change. The regression test proves this is still working
24227 fine, so the bug remains fixed.
24228
24229 2007-12-01 Mark Rowe <mrowe@apple.com>
24230
24231 Build fix. Include headers before trying to use the things that they declare.
24232
24233 * kjs/JSImmediate.cpp:
24234 * kjs/nodes.cpp:
24235 * kjs/object.cpp:
24236 * kjs/object_object.cpp:
24237 * kjs/regexp_object.cpp:
24238 * kjs/string_object.cpp:
24239
24240 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24241
24242 Build fix: added some #includes.
24243
24244 * kjs/JSImmediate.cpp:
24245
24246 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24247
24248 Build fix: added some #includes.
24249
24250 * kjs/JSGlobalObject.cpp:
24251 * kjs/JSImmediate.cpp:
24252
24253 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24254
24255 Build fix: Fixed #include spelling.
24256
24257 * kjs/debugger.cpp:
24258
24259 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24260
24261 Build fix: added #include.
24262
24263 * kjs/debugger.cpp:
24264
24265 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24266
24267 Build fix: added a forward declaration.
24268
24269 * kjs/debugger.h:
24270
24271 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24272
24273 Build fix: added an #include.
24274
24275 * kjs/error_object.cpp:
24276
24277 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24278
24279 Build fix: added an #include.
24280
24281 * kjs/bool_object.cpp:
24282
24283 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24284
24285 Reviewed by Darin Adler.
24286
24287 Third step in refactoring JSGlobalObject: Moved data members and
24288 functions accessing data members from Interpreter to JSGlobalObject.
24289 Changed Interpreter member functions to static functions.
24290
24291 This resolves a bug in global object bootstrapping, where the global
24292 ExecState could be used when uninitialized.
24293
24294 This is a big change, but it's mostly code motion and renaming.
24295
24296 Layout and JS tests, and testjsglue and testapi, pass. SunSpider reports
24297 a .7% regression, but Shark sees no difference related to this patch,
24298 and SunSpider reported a .7% speedup from an earlier step in this
24299 refactoring, so I think it's fair to call that a wash.
24300
24301 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24302
24303 Reviewed by Darin Adler. (Or vice versa.)
24304
24305 Fixed ASSERT during run-javascriptcore-tests. (Darin just added the
24306 ASSERT, but the bug wasn't new.)
24307
24308 * pcre/pcre_compile.cpp:
24309 (compile_branch): The ?: operator here was backwards, causing us to
24310 execute the loop too many times, adding stray KET opcodes to the
24311 compiled regular expression.
24312
24313 2007-12-05 Kevin McCullough <kmccullough@apple.com>
24314
24315 Reviewed by Geoff.
24316
24317 - Wait until local variable data is fully constructed before notifying the debugger of entering
24318 or leaving a call frame.
24319
24320 * kjs/function.cpp:
24321 (KJS::FunctionImp::callAsFunction):
24322 * kjs/nodes.cpp:
24323 (KJS::FunctionBodyNode::execute):
24324
24325 2007-12-05 Mark Rowe <mrowe@apple.com>
24326
24327 Reviewed by Oliver.
24328
24329 Build fix for GCC 4.2. Cast via a union to avoid strict-aliasing issues.
24330
24331 * wtf/FastMalloc.cpp:
24332 (WTF::):
24333 (WTF::getPageHeap):
24334
24335 2007-12-05 Mark Rowe <mrowe@apple.com>
24336
24337 Reviewed by Darin.
24338
24339 Fix testkjs in 64-bit.
24340
24341 When built for 64-bit the TCMalloc spin lock uses pthread mutexes rather than a custom spin lock
24342 implemented in assembly. If we fail to initialize the pthread mutex, attempts to lock or unlock
24343 it will fail and trigger a call to abort.
24344
24345 * wtf/FastMalloc.cpp: Initialize the spin lock so that we can later lock and unlock it.
24346 * wtf/TCSpinLock.h: Add an Init method to the optimised spin lock.
24347
24348 2007-12-04 Oliver Hunt <oliver@apple.com>
24349
24350 Fix gtk build.
24351
24352 * wtf/TCSystemAlloc.cpp:
24353
24354 2007-12-03 Oliver Hunt <oliver@apple.com>
24355
24356 Reviewed by Mark Rowe and Geoff Garen.
24357
24358 Merge TCMalloc r38
24359
24360 It also result in a performance progression between 0.5% and
24361 0.9% depending on the test, however most if not all of this
24362 gain will be consumed by the overhead involved in the later
24363 change to release memory to the system.
24364
24365 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
24366 * JavaScriptCore.xcodeproj/project.pbxproj:
24367 * wtf/FastMalloc.cpp:
24368 (WTF::KernelSupportsTLS):
24369 (WTF::CheckIfKernelSupportsTLS):
24370 (WTF::):
24371 (WTF::ClassIndex):
24372 (WTF::SLL_Next):
24373 (WTF::SLL_SetNext):
24374 (WTF::SLL_Push):
24375 (WTF::SLL_Pop):
24376 (WTF::SLL_PopRange):
24377 (WTF::SLL_PushRange):
24378 (WTF::SLL_Size):
24379 (WTF::SizeClass):
24380 (WTF::ByteSizeForClass):
24381 (WTF::NumMoveSize):
24382 (WTF::InitSizeClasses):
24383 (WTF::AllocationSize):
24384 (WTF::TCMalloc_PageHeap::GetSizeClassIfCached):
24385 (WTF::TCMalloc_PageHeap::CacheSizeClass):
24386 (WTF::TCMalloc_PageHeap::init):
24387 (WTF::TCMalloc_PageHeap::New):
24388 (WTF::TCMalloc_PageHeap::AllocLarge):
24389 (WTF::TCMalloc_PageHeap::Carve):
24390 (WTF::TCMalloc_PageHeap::Delete):
24391 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
24392 (WTF::PagesToMB):
24393 (WTF::TCMalloc_PageHeap::Dump):
24394 (WTF::TCMalloc_PageHeap::GrowHeap):
24395 (WTF::TCMalloc_PageHeap::Check):
24396 (WTF::ReleaseFreeList):
24397 (WTF::TCMalloc_PageHeap::ReleaseFreePages):
24398 (WTF::TCMalloc_ThreadCache_FreeList::Push):
24399 (WTF::TCMalloc_ThreadCache_FreeList::PushRange):
24400 (WTF::TCMalloc_ThreadCache_FreeList::PopRange):
24401 (WTF::TCMalloc_ThreadCache_FreeList::Pop):
24402 (WTF::TCMalloc_Central_FreeList::length):
24403 (WTF::TCMalloc_Central_FreeList::tc_length):
24404 (WTF::TCMalloc_Central_FreeList::Init):
24405 (WTF::TCMalloc_Central_FreeList::ReleaseListToSpans):
24406 (WTF::TCMalloc_Central_FreeList::EvictRandomSizeClass):
24407 (WTF::TCMalloc_Central_FreeList::MakeCacheSpace):
24408 (WTF::TCMalloc_Central_FreeList::ShrinkCache):
24409 (WTF::TCMalloc_Central_FreeList::InsertRange):
24410 (WTF::TCMalloc_Central_FreeList::RemoveRange):
24411 (WTF::TCMalloc_Central_FreeList::FetchFromSpansSafe):
24412 (WTF::TCMalloc_Central_FreeList::Populate):
24413 (WTF::TCMalloc_ThreadCache::Init):
24414 (WTF::TCMalloc_ThreadCache::Cleanup):
24415 (WTF::TCMalloc_ThreadCache::Allocate):
24416 (WTF::TCMalloc_ThreadCache::Deallocate):
24417 (WTF::TCMalloc_ThreadCache::FetchFromCentralCache):
24418 (WTF::TCMalloc_ThreadCache::ReleaseToCentralCache):
24419 (WTF::TCMalloc_ThreadCache::Scavenge):
24420 (WTF::TCMalloc_ThreadCache::PickNextSample):
24421 (WTF::TCMalloc_ThreadCache::NewHeap):
24422 (WTF::TCMalloc_ThreadCache::GetThreadHeap):
24423 (WTF::TCMalloc_ThreadCache::GetCache):
24424 (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
24425 (WTF::TCMalloc_ThreadCache::InitTSD):
24426 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
24427 (WTF::TCMallocStats::ExtractStats):
24428 (WTF::TCMallocStats::DumpStats):
24429 (WTF::TCMallocStats::DumpStackTraces):
24430 (WTF::TCMallocStats::TCMallocImplementation::MarkThreadIdle):
24431 (WTF::TCMallocStats::TCMallocImplementation::ReleaseFreeMemory):
24432 (WTF::TCMallocStats::TCMallocGuard::TCMallocGuard):
24433 (WTF::TCMallocStats::TCMallocGuard::~TCMallocGuard):
24434 (WTF::TCMallocStats::DoSampledAllocation):
24435 (WTF::TCMallocStats::CheckCachedSizeClass):
24436 (WTF::TCMallocStats::CheckedMallocResult):
24437 (WTF::TCMallocStats::SpanToMallocResult):
24438 (WTF::TCMallocStats::do_malloc):
24439 (WTF::TCMallocStats::do_free):
24440 (WTF::TCMallocStats::do_memalign):
24441 (WTF::TCMallocStats::do_malloc_stats):
24442 (WTF::TCMallocStats::do_mallopt):
24443 (WTF::TCMallocStats::do_mallinfo):
24444 (WTF::TCMallocStats::realloc):
24445 (WTF::TCMallocStats::cpp_alloc):
24446 (WTF::TCMallocStats::operator new):
24447 (WTF::TCMallocStats::):
24448 (WTF::TCMallocStats::operator new[]):
24449 (WTF::TCMallocStats::malloc_stats):
24450 (WTF::TCMallocStats::mallopt):
24451 (WTF::TCMallocStats::mallinfo):
24452 * wtf/TCPackedCache.h: Added.
24453 (PackedCache::PackedCache):
24454 (PackedCache::Put):
24455 (PackedCache::Has):
24456 (PackedCache::GetOrDefault):
24457 (PackedCache::Clear):
24458 (PackedCache::EntryToValue):
24459 (PackedCache::EntryToUpper):
24460 (PackedCache::KeyToUpper):
24461 (PackedCache::UpperToPartialKey):
24462 (PackedCache::Hash):
24463 (PackedCache::KeyMatch):
24464 * wtf/TCPageMap.h:
24465 (TCMalloc_PageMap2::PreallocateMoreMemory):
24466 * wtf/TCSystemAlloc.cpp:
24467 (TCMalloc_SystemRelease):
24468 * wtf/TCSystemAlloc.h:
24469
24470 2007-12-04 Anders Carlsson <andersca@apple.com>
24471
24472 Reviewed by Sam.
24473
24474 Make isSafeScript const.
24475
24476 * kjs/JSGlobalObject.h:
24477 (KJS::JSGlobalObject::isSafeScript):
24478
24479 2007-12-04 Darin Adler <darin@apple.com>
24480
24481 Reviewed by Geoff.
24482
24483 - fix first part of http://bugs.webkit.org/show_bug.cgi?id=16220
24484 <rdar://problem/5625221> Crash opening www.news.com (CNet)
24485
24486 Test: fast/js/regexp-overflow.html
24487
24488 * pcre/pcre_compile.cpp:
24489 (calculateCompiledPatternLengthAndFlags): Add room for the additional BRA/KET that
24490 was generated in the compile code but not taken into account here.
24491
24492 2007-12-03 Darin Adler <darin@apple.com>
24493
24494 Reviewed by Geoff.
24495
24496 - fix http://bugs.webkit.org/show_bug.cgi?id=15618
24497 <rdar://problem/5619353> REGRESSION: Stack overflow/crash in KJS::equal (15618)
24498
24499 Test: fast/js/recursion-limit-equal.html
24500
24501 * kjs/operations.cpp: (KJS::equal): Check the exception from toPrimitive.
24502
24503 2007-12-03 Dan Bernstein <mitz@apple.com>
24504
24505 - fix a copy-and-paste-o
24506
24507 * bindings/npruntime.cpp:
24508 (_NPN_GetIntIdentifier):
24509
24510 2007-12-03 Dan Bernstein <mitz@apple.com>
24511
24512 Reviewed by Darin Adler.
24513
24514 - fix an ASSERT when getIntIdentifier is called with 0 or -1
24515
24516 * bindings/npruntime.cpp:
24517 (_NPN_GetIntIdentifier): We cannot use the hashmap for 0 and -1 since
24518 they are the empty value and the deleted value. Instead, keep the
24519 identifiers for those two integers in a static array.
24520
24521 2007-12-02 Darin Adler <darin@apple.com>
24522
24523 Reviewed by Mitz.
24524
24525 - fix http://bugs.webkit.org/show_bug.cgi?id=15848
24526 <rdar://problem/5619330> REGRESSION: Assertion failure viewing comments page on digg.com
24527
24528 Test: fast/js/sparse-array.html
24529
24530 * kjs/array_instance.cpp:
24531 (KJS::ArrayInstance::inlineGetOwnPropertySlot): Check sparse array cutoff before looking
24532 in hash map. Can't avoid the branch because we can't look for 0 in the hash.
24533 (KJS::ArrayInstance::deleteProperty): Ditto.
24534
24535 2007-12-02 Geoffrey Garen <ggaren@apple.com>
24536
24537 Build fix: added an #include.
24538
24539 * kjs/collector.cpp:
24540
24541 2007-12-02 Geoffrey Garen <ggaren@apple.com>
24542
24543 Reviewed by Eric Seidel.
24544
24545 Second step in refactoring JSGlobalObject: moved virtual functions from
24546 Interpreter to JSGlobalObject.
24547
24548 Layout and JS tests pass. SunSpider reports a .7% speedup -- don't
24549 believe his lies.
24550
24551 2007-12-01 Alp Toker <alp@atoker.com>
24552
24553 Reviewed by Adam Roben.
24554
24555 http://bugs.webkit.org/show_bug.cgi?id=16228
24556 kJSClassDefinitionEmpty is not exported with JS_EXPORT
24557
24558 Add JS_EXPORT to kJSClassDefinitionEmpty.
24559
24560 Make the gcc compiler check take precedence over the WIN32||_WIN32
24561 check to ensure that symbols are exported on Windows when using gcc.
24562
24563 Add a TODO referencing the bug about JS_EXPORT in the Win build
24564 (http://bugs.webkit.org/show_bug.cgi?id=16227)
24565
24566 Don't define JS_EXPORT as 'extern' when the compiler is unknown since
24567 it would result in the incorrect expansion:
24568
24569 extern extern const JSClassDefinition kJSClassDefinitionEmpty;
24570
24571 (This was something we inherited from CFBase.h that doesn't make sense
24572 for JSBase.h)
24573
24574 * API/JSBase.h:
24575 * API/JSObjectRef.h:
24576
24577 2007-11-30 Geoffrey Garen <ggaren@apple.com>
24578
24579 Reviewed by Beth Dakin.
24580
24581 Reversed the ownership relationship between Interpreter and JSGlobalObject.
24582 Now, the JSGlobalObject owns the Interpreter, and top-level objects
24583 that need the two to persist just protect the JSGlobalObject from GC.
24584
24585 Global object bootstrapping looks a little odd right now, but it will
24586 make much more sense soon, after further rounds of refactoring.
24587
24588 * bindings/runtime_root.h: Made this class inherit from RefCounted,
24589 to avoid code duplication.
24590
24591 * kjs/collector.cpp:
24592 (KJS::Collector::collect): No need to give special GC treatment to
24593 Interpreters, since we mark their global objects, which mark them.
24594
24595 * kjs/interpreter.cpp:
24596 (KJS::Interpreter::mark): No need to mark our global object, since it
24597 marks us.
24598 * kjs/interpreter.h: Don't inherit from RefCounted -- JSGlobalObject
24599 owns us directly.
24600
24601 * kjs/testkjs.cpp: Modified to follow the new rules.
24602 (createGlobalObject):
24603 (runWithScripts):
24604
24605 2007-11-30 Brent Fulgham <bfulgham@gmail.com>
24606
24607 Reviewed by Eric.
24608
24609 * ChangeLog:
24610 * pcre/pcre_compile.cpp:
24611 (compile_branch):
24612
24613 2007-11-30 Eric Seidel <eric@webkit.org>
24614
24615 No review, build fix only.
24616
24617 Fix uninitialized var warnings in release build.
24618
24619 * JavaScriptCore.xcodeproj/project.pbxproj:
24620 * pcre/pcre_compile.cpp:
24621 (compile_regex):
24622
24623 2007-11-30 Darin Adler <darin@apple.com>
24624
24625 Reviewed by Adam Roben.
24626
24627 - fix http://bugs.webkit.org/show_bug.cgi?id=16207
24628 JavaScript regular expressions should match UTF-16 code units rather than characters
24629
24630 SunSpider says this is 5.5% faster on the regexp test, 0.4% faste overall.
24631
24632 Test: fast/js/regexp-non-bmp.html
24633
24634 Renamed ANY_CHAR to NOT_NEWLINE to more-accurately reflect its meaning.
24635
24636 * pcre/pcre_compile.cpp:
24637 (compile_branch): Removed calls to the UTF-16 character accessor functions, replacing
24638 them with simple pointer dereferences in some cases, and no code at all in others.
24639 (calculateCompiledPatternLengthAndFlags): Ditto.
24640
24641 * pcre/pcre_exec.cpp:
24642 (match): Fixed indentation of some case labels (including all the BEGIN_OPCODE).
24643 Removed calls to the UTF-16 character accessor functions, replacing them with simple
24644 pointer dereferences in some cases, and no code at all in others. Also removed some
24645 explicit UTF-16 support code in a few cases. Removed the unneeded "UTF-8" code path
24646 in the ANY_CHAR repeat code, and in another case, eliminated the code to check against
24647 end_subject in because it is already done outside the loop.
24648 (jsRegExpExecute):
24649
24650 * pcre/pcre_internal.h: Removed all the UTF-16 helper functions.
24651
24652 2007-11-30 Eric Seidel <eric@webkit.org>
24653
24654 Reviewed by darin.
24655
24656 PCRE crashes under GuardMalloc
24657 http://bugs.webkit.org/show_bug.cgi?id=16127
24658 check against patternEnd to make sure we don't walk off the end of the string
24659
24660 * pcre/pcre_compile.cpp:
24661 (compile_branch):
24662 (calculateCompiledPatternLengthAndFlags):
24663
24664 2007-11-30 Eric Seidel <eric@webkit.org>
24665
24666 Reviewed by Maciej.
24667
24668 Fix layout test regressions caused by r28186
24669 http://bugs.webkit.org/show_bug.cgi?id=16195
24670 change first_byte and req_byte back to shorts instead of chars
24671 (I think PCRE stuffs information in the high bits)
24672
24673 * pcre/pcre_internal.h:
24674
24675 2007-11-29 Oliver Hunt <oliver@apple.com>
24676
24677 Reviewed by Maciej and Darin.
24678
24679 Make the JS collector work with multiple threads
24680
24681 Under heavy contention it was possible the GC to suspend other
24682 threads inside the pthread spinlock, which could lead to the GC
24683 thread blocking on the pthread spinlock itself.
24684
24685 We now determine and store each thread's stack base when it is
24686 registered, thus removing the need for any calls to pthread_get_stackaddr_np
24687 that needed the pthread spinlock.
24688
24689 * kjs/collector.cpp:
24690 (KJS::Collector::Thread::Thread):
24691 (KJS::Collector::registerThread):
24692 (KJS::Collector::markOtherThreadConservatively):
24693
24694 2007-11-29 Adam Roben <aroben@apple.com>
24695
24696 Windows build fix
24697
24698 Removed some unreachable code (ironically, the code was some
24699 ASSERT_NOT_REACHED()s).
24700
24701 * pcre/pcre_compile.cpp:
24702 (compile_branch):
24703 * pcre/pcre_exec.cpp:
24704 (match):
24705
24706 2007-11-29 Eric Seidel <eric@webkit.org>
24707
24708 Reviewed by Mark Rowe.
24709
24710 Fix for --guard crash of fast/js/regexp-charclass-crash introduced by r28151.
24711
24712 * pcre/pcre_compile.cpp:
24713 (is_anchored):
24714
24715 2007-11-28 Mark Rowe <mrowe@apple.com>
24716
24717 Gtk build fix. Rubber-stamped by Eric.
24718
24719 * pcre/pcre_exec.cpp:
24720 (match): Add braces around the body of the case statement to prevent
24721 wanings about jumps across the initialization of a variable.
24722
24723 2007-11-29 Eric Seidel <eric@webkit.org>
24724
24725 Reviewed by Mark Rowe.
24726
24727 Attempt to fix non-mac builds after PCRE cleanup.
24728
24729 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
24730 * JavaScriptCoreSources.bkl:
24731 * pcre/pcre.pri:
24732
24733 2007-11-28 Eric Seidel <eric@webkit.org>
24734
24735 Reviewed by Maciej.
24736
24737 Centralize code for subjectPtr adjustments using inlines, only ever check for a single
24738 trailing surrogate (as UTF16 only allows one), possibly fix PCRE bugs involving char
24739 classes and garbled UTF16 strings.
24740
24741 * pcre/pcre_exec.cpp:
24742 (match):
24743 (jsRegExpExecute):
24744 * pcre/pcre_internal.h:
24745 (getPreviousChar):
24746 (movePtrToPreviousChar):
24747 (movePtrToNextChar):
24748 (movePtrToStartOfCurrentChar):
24749
24750 2007-11-28 Eric Seidel <eric@webkit.org>
24751
24752 Reviewed by Maciej.
24753
24754 change getChar* functions to return result and push 'c' into local scopes for clarity
24755
24756 * pcre/pcre_compile.cpp:
24757 (compile_branch):
24758 (calculateCompiledPatternLengthAndFlags):
24759 * pcre/pcre_exec.cpp:
24760 (match):
24761 * pcre/pcre_internal.h:
24762 (getChar):
24763 (getCharAndAdvance):
24764 (getCharAndLength):
24765 (getCharAndAdvanceIfSurrogate):
24766
24767 2007-11-28 Eric Seidel <eric@webkit.org>
24768
24769 Reviewed by Sam.
24770
24771 Comment cleanup
24772
24773 * pcre/pcre_exec.cpp:
24774 (match):
24775
24776 2007-11-26 Eric Seidel <eric@webkit.org>
24777
24778 Reviewed by Sam.
24779
24780 Further cleanups to calculateCompiledPatternLengthAndFlags
24781
24782 * pcre/pcre_compile.cpp:
24783 (calculateCompiledPatternLengthAndFlags):
24784 * pcre/pcre_internal.h:
24785
24786 2007-11-26 Eric Seidel <eric@webkit.org>
24787
24788 Reviewed by Sam.
24789
24790 Give consistent naming to the RegExp options/compile flags
24791
24792 * pcre/pcre_compile.cpp:
24793 (compile_branch):
24794 (is_anchored):
24795 (find_firstassertedchar):
24796 (printCompiledRegExp):
24797 (jsRegExpCompile):
24798 * pcre/pcre_exec.cpp:
24799 (jsRegExpExecute):
24800 * pcre/pcre_internal.h:
24801
24802 2007-11-26 Eric Seidel <eric@webkit.org>
24803
24804 Reviewed by Sam.
24805
24806 Pull first_byte and req_byte optimizations out into separate static funtions, SunSpider reported this as a win.
24807
24808 * pcre/pcre_exec.cpp:
24809 (tryFirstByteOptimization):
24810 (tryRequiredByteOptimization):
24811 (jsRegExpExecute):
24812 * pcre/pcre_internal.h:
24813
24814 2007-11-26 Eric Seidel <eric@webkit.org>
24815
24816 Reviewed by Maciej.
24817
24818 give PCRE_MULTILINE a better name: OptionMatchAcrossMultipleLines
24819
24820 * pcre/pcre_compile.cpp:
24821 (compile_branch):
24822 (is_anchored):
24823 (printCompiledRegExp):
24824 (jsRegExpCompile):
24825 * pcre/pcre_exec.cpp:
24826 (jsRegExpExecute):
24827 * pcre/pcre_internal.h:
24828
24829 2007-11-26 Eric Seidel <eric@webkit.org>
24830
24831 Reviewed by Oliver.
24832
24833 Deprecate jsRegExpExecute's offset-vector fallback code
24834
24835 * pcre/pcre_exec.cpp:
24836 (jsRegExpExecute):
24837
24838 2007-11-26 Eric Seidel <eric@webkit.org>
24839
24840 Reviewed by Maciej.
24841
24842 Make cur_is_word and prev_is_word locals, and change OP_ANY to OP_ANY_CHAR for clarity
24843
24844 * pcre/pcre_compile.cpp:
24845 (find_fixedlength):
24846 (compile_branch):
24847 (canApplyFirstCharOptimization):
24848 * pcre/pcre_exec.cpp:
24849 (match):
24850 * pcre/pcre_internal.h:
24851
24852 2007-11-26 Eric Seidel <eric@webkit.org>
24853
24854 Reviewed by Mitz & Maciej.
24855
24856 Change _NC operators to use _IGNORING_CASE for clarity
24857
24858 * pcre/pcre_compile.cpp:
24859 (find_fixedlength):
24860 (compile_branch):
24861 (find_firstassertedchar):
24862 * pcre/pcre_exec.cpp:
24863 (match):
24864 * pcre/pcre_internal.h:
24865
24866 2007-11-26 Eric Seidel <eric@webkit.org>
24867
24868 Reviewed by Mitz.
24869
24870 Remove branch from return
24871
24872 * pcre/pcre_compile.cpp:
24873 (compile_branch):
24874 * pcre/pcre_exec.cpp:
24875 (match):
24876
24877 2007-11-26 Eric Seidel <eric@webkit.org>
24878
24879 Reviewed by Maciej.
24880
24881 Add repeatInformationFromInstructionOffset inline
24882
24883 * pcre/pcre_exec.cpp:
24884 (repeatInformationFromInstructionOffset):
24885 (match):
24886
24887 2007-11-26 Eric Seidel <eric@webkit.org>
24888
24889 Reviewed by Maciej.
24890
24891 Remove no longer used error code JSRegExpErrorMatchLimit
24892
24893 * kjs/regexp.cpp:
24894 (KJS::RegExp::match):
24895 * pcre/pcre.h:
24896 * pcre/pcre_internal.h:
24897
24898 2007-11-26 Eric Seidel <eric@webkit.org>
24899
24900 Reviewed by Sam.
24901
24902 Make i locally scoped for better code clarity
24903
24904 * pcre/pcre_exec.cpp:
24905 (match):
24906
24907 2007-11-26 Eric Seidel <eric@webkit.org>
24908
24909 Reviewed by Maciej.
24910
24911 Give subjectPtr and instructionPtr sane names, reduce size of MatchFrame for a 0.2% speedup.
24912
24913 * pcre/pcre_compile.cpp:
24914 (compile_branch):
24915 (calculateCompiledPatternLengthAndFlags):
24916 * pcre/pcre_exec.cpp:
24917 (match_ref):
24918 (MatchStack::pushNewFrame):
24919 (getUTF8CharAndIncrementLength):
24920 (match):
24921 * pcre/pcre_internal.h:
24922 (getChar):
24923 (getCharAndAdvance):
24924 (getCharAndLength):
24925 (getCharAndAdvanceIfSurrogate):
24926 * pcre/pcre_xclass.cpp:
24927 (getUTF8CharAndAdvancePointer):
24928
24929 2007-11-26 Eric Seidel <eric@webkit.org>
24930
24931 Reviewed by Sam.
24932
24933 Small speedup (0.7%) by simplifying canUseStackBufferForNextFrame() check
24934
24935 * pcre/pcre_exec.cpp:
24936 (MatchStack::MatchStack):
24937 (MatchStack::popCurrentFrame):
24938
24939 2007-11-25 Eric Seidel <eric@webkit.org>
24940
24941 Reviewed by Sam.
24942
24943 Lower MATCH_LIMIT_RECURSION to more sane levels to prevent hangs on run-javascriptcore-tests
24944
24945 * pcre/pcre_internal.h:
24946
24947 2007-11-25 Eric Seidel <eric@webkit.org>
24948
24949 Reviewed by Maciej.
24950
24951 Remove match_is_group variable for another 5% speedup
24952
24953 * pcre/pcre_compile.cpp:
24954 * pcre/pcre_exec.cpp:
24955 (startNewGroup):
24956 (match):
24957
24958 2007-11-28 Eric Seidel <eric@webkit.org>
24959
24960 Reviewed by Sam.
24961
24962 Abstract frame variables into locals and args
24963
24964 * pcre/pcre_compile.cpp:
24965 (compile_branch):
24966 * pcre/pcre_exec.cpp:
24967 (match):
24968 * pcre/pcre_internal.h:
24969
24970 2007-11-28 Eric Seidel <eric@webkit.org>
24971
24972 Reviewed by Sam.
24973
24974 Section off MatchData arguments into args struct
24975
24976 * pcre/pcre_exec.cpp:
24977 (MatchStack::pushNewFrame):
24978 (match):
24979
24980 2007-11-24 Eric Seidel <eric@webkit.org>
24981
24982 Reviewed by Sam.
24983
24984 Remove redundant eptrblock struct
24985
24986 * pcre/pcre_exec.cpp:
24987 (MatchStack::pushNewFrame):
24988 (match):
24989
24990 2007-11-24 Eric Seidel <eric@webkit.org>
24991
24992 Reviewed by Maciej.
24993
24994 Remove redundant match_call_count and move recursion check out of super-hot code path
24995 SunSpider says this is at least an 8% speedup for regexp.
24996
24997 * pcre/pcre_exec.cpp:
24998 (MatchStack::MatchStack):
24999 (MatchStack::pushNewFrame):
25000 (MatchStack::popCurrentFrame):
25001 (MatchStack::popAllFrames):
25002 (match):
25003 (jsRegExpExecute):
25004 * pcre/pcre_internal.h:
25005
25006 2007-11-24 Eric Seidel <eric@webkit.org>
25007
25008 Reviewed by Sam.
25009
25010 Get rid of GETCHAR* macros, replacing them with better named inlines
25011
25012 * pcre/pcre_compile.cpp:
25013 (compile_branch):
25014 (calculateCompiledPatternLengthAndFlags):
25015 * pcre/pcre_exec.cpp:
25016 (match):
25017 * pcre/pcre_internal.h:
25018 (getCharAndAdvance):
25019 (getCharAndLength):
25020 (getCharAndAdvanceIfSurrogate):
25021
25022 2007-11-24 Eric Seidel <eric@webkit.org>
25023
25024 Reviewed by Sam.
25025
25026 Further cleanup GET/PUT inlines
25027
25028 * pcre/pcre_internal.h:
25029 (putOpcodeValueAtOffset):
25030 (getOpcodeValueAtOffset):
25031 (putOpcodeValueAtOffsetAndAdvance):
25032 (put2ByteOpcodeValueAtOffset):
25033 (get2ByteOpcodeValueAtOffset):
25034 (put2ByteOpcodeValueAtOffsetAndAdvance):
25035
25036 2007-11-24 Eric Seidel <eric@webkit.org>
25037
25038 Reviewed by Sam.
25039
25040 Give GET, PUT better names, and add (poor) moveOpcodePtrPastAnyAlternateBranches
25041
25042 * pcre/pcre_compile.cpp:
25043 (firstSignificantOpCodeSkippingAssertions):
25044 (find_fixedlength):
25045 (complete_callout):
25046 (compile_branch):
25047 (compile_regex):
25048 (is_anchored):
25049 (canApplyFirstCharOptimization):
25050 (find_firstassertedchar):
25051 * pcre/pcre_exec.cpp:
25052 (match):
25053 * pcre/pcre_internal.h:
25054 (putOpcodeValueAtOffset):
25055 (getOpcodeValueAtOffset):
25056 (putOpcodeValueAtOffsetAndAdvance):
25057 (put2ByteOpcodeValueAtOffset):
25058 (get2ByteOpcodeValueAtOffset):
25059 (moveOpcodePtrPastAnyAlternateBranches):
25060 * pcre/pcre_ucp_searchfuncs.cpp:
25061 (_pcre_ucp_othercase):
25062
25063 2007-11-24 Eric Seidel <eric@webkit.org>
25064
25065 Reviewed by Sam.
25066
25067 Add inlines for toLowerCase, isWordChar, isSpaceChar for further regexp speedup
25068
25069 * pcre/pcre_compile.cpp:
25070 (compile_branch):
25071 (jsRegExpCompile):
25072 * pcre/pcre_exec.cpp:
25073 (match):
25074 (jsRegExpExecute):
25075 * pcre/pcre_internal.h:
25076 (toLowerCase):
25077 (flipCase):
25078 (classBitmapForChar):
25079 (charTypeForChar):
25080 (isWordChar):
25081 (isSpaceChar):
25082 (CompileData::CompileData):
25083 * pcre/pcre_xclass.cpp:
25084 (_pcre_xclass):
25085
25086 2007-11-24 Eric Seidel <eric@webkit.org>
25087
25088 Reviewed by Sam.
25089
25090 cleanup _pcre_ucp_othercase
25091
25092 * pcre/pcre_ucp_searchfuncs.cpp:
25093 (_pcre_ucp_othercase):
25094
25095 2007-11-24 Eric Seidel <eric@webkit.org>
25096
25097 Reviewed by Maciej.
25098
25099 Use better variable names for case ignoring options
25100
25101 * pcre/pcre_compile.cpp:
25102 (compile_branch):
25103 (find_firstassertedchar):
25104 (printCompiledRegExp):
25105 (jsRegExpCompile):
25106 * pcre/pcre_exec.cpp:
25107 (match_ref):
25108 (match):
25109 (jsRegExpExecute):
25110 * pcre/pcre_internal.h:
25111
25112 2007-11-24 Eric Seidel <eric@webkit.org>
25113
25114 Reviewed by Sam.
25115
25116 split first_significant_code into two simpler functions
25117
25118 * pcre/pcre_compile.cpp:
25119 (firstSignificantOpCode):
25120 (firstSignificantOpCodeSkippingAssertions):
25121 (is_anchored):
25122 (canApplyFirstCharOptimization):
25123 (find_firstassertedchar):
25124
25125 2007-11-24 Eric Seidel <eric@webkit.org>
25126
25127 Reviewed by Sam.
25128
25129 clean up is_counted_repeat
25130
25131 * pcre/pcre_compile.cpp:
25132 (is_counted_repeat):
25133
25134 2007-11-24 Eric Seidel <eric@webkit.org>
25135
25136 Reviewed by Sam.
25137
25138 clean up check_escape
25139
25140 * pcre/pcre_compile.cpp:
25141 (check_escape):
25142
25143 2007-11-24 Eric Seidel <eric@webkit.org>
25144
25145 Reviewed by Sam.
25146
25147 Reformat find_fixedlength
25148
25149 * pcre/pcre_compile.cpp:
25150 (find_fixedlength):
25151
25152 2007-11-24 Eric Seidel <eric@webkit.org>
25153
25154 Reviewed by Sam.
25155
25156 reformat is_anchored
25157
25158 * pcre/pcre_compile.cpp:
25159 (is_anchored):
25160
25161 2007-11-24 Eric Seidel <eric@webkit.org>
25162
25163 Reviewed by Maciej.
25164
25165 Remove unused function could_be_empty_branch
25166
25167 * pcre/pcre_compile.cpp:
25168 (first_significant_code):
25169 (find_fixedlength):
25170 (compile_branch):
25171 (canApplyFirstCharOptimization):
25172
25173 2007-11-24 Eric Seidel <eric@webkit.org>
25174
25175 Reviewed by Sam.
25176
25177 Pass around MatchData objects by reference
25178
25179 * pcre/pcre_exec.cpp:
25180 (pchars):
25181 (match_ref):
25182 (match):
25183 (jsRegExpExecute):
25184
25185 2007-11-24 Eric Seidel <eric@webkit.org>
25186
25187 Reviewed by Sam.
25188
25189 give PCRE_STARTLINE a better name and rename match_data to MatchData
25190
25191 * pcre/pcre_compile.cpp:
25192 (compile_branch):
25193 (canApplyFirstCharOptimization):
25194 (find_firstassertedchar):
25195 (printCompiledRegExp):
25196 (jsRegExpCompile):
25197 * pcre/pcre_exec.cpp:
25198 (pchars):
25199 (jsRegExpExecute):
25200 * pcre/pcre_internal.h:
25201
25202 2007-11-24 Eric Seidel <eric@webkit.org>
25203
25204 Reviewed by Sam.
25205
25206 Clean up find_firstassertedchar
25207
25208 * pcre/pcre_compile.cpp:
25209 (get_othercase_range):
25210 (find_firstassertedchar):
25211 (calculateCompiledPatternLengthAndFlags):
25212
25213 2007-11-24 Eric Seidel <eric@webkit.org>
25214
25215 Reviewed by Tim Hatcher.
25216
25217 Pass around CompileData& instead of CompileData*
25218
25219 * pcre/pcre_compile.cpp:
25220 (compile_branch):
25221 (jsRegExpCompile):
25222
25223 2007-11-24 Eric Seidel <eric@webkit.org>
25224
25225 Reviewed by Sam.
25226
25227 Clean up compile_branch, move _pcre_ord2utf8, and rename CompileData
25228
25229 * JavaScriptCore.xcodeproj/project.pbxproj:
25230 * pcre/pcre_compile.cpp:
25231 (_pcre_ord2utf8):
25232 (calculateCompiledPatternLengthAndFlags):
25233 (jsRegExpCompile):
25234 * pcre/pcre_internal.h:
25235 * pcre/pcre_ord2utf8.cpp: Removed.
25236
25237 2007-11-24 Eric Seidel <eric@webkit.org>
25238
25239 Reviewed by Sam.
25240
25241 removing more macros
25242
25243 * pcre/pcre_compile.cpp:
25244 (could_be_empty_branch):
25245 (compile_branch):
25246 (calculateCompiledPatternLengthAndFlags):
25247 * pcre/pcre_exec.cpp:
25248 (match):
25249 (jsRegExpExecute):
25250 * pcre/pcre_internal.h:
25251 * pcre/pcre_xclass.cpp:
25252
25253 2007-11-24 Eric Seidel <eric@webkit.org>
25254
25255 Reviewed by Maciej.
25256
25257 clean up formating in compile_branch
25258
25259 * pcre/pcre_compile.cpp:
25260 (compile_branch):
25261
25262 2007-11-24 Eric Seidel <eric@webkit.org>
25263
25264 Reviewed by Sam.
25265
25266 Fix spacing for read_repeat_counts
25267
25268 * pcre/pcre_compile.cpp:
25269 (read_repeat_counts):
25270
25271 2007-11-24 Eric Seidel <eric@webkit.org>
25272
25273 Reviewed by Sam.
25274
25275 Get rid of PCRE custom char types
25276
25277 * pcre/pcre_compile.cpp:
25278 (check_escape):
25279 (complete_callout):
25280 (compile_branch):
25281 (compile_regex):
25282 (calculateCompiledPatternLengthAndFlags):
25283 (jsRegExpCompile):
25284 * pcre/pcre_exec.cpp:
25285 (match_ref):
25286 (match):
25287 (jsRegExpExecute):
25288 * pcre/pcre_internal.h:
25289
25290 2007-11-24 Eric Seidel <eric@webkit.org>
25291
25292 Reviewed by Sam.
25293
25294 reformat get_othercase_range
25295
25296 * pcre/pcre_compile.cpp:
25297 (get_othercase_range):
25298
25299 2007-11-24 Eric Seidel <eric@webkit.org>
25300
25301 Reviewed by Maciej.
25302
25303 Remove register keyword and more cleanup
25304
25305 * pcre/pcre_compile.cpp:
25306 (find_fixedlength):
25307 (compile_branch):
25308 (is_anchored):
25309 (is_startline):
25310 (find_firstassertedchar):
25311 (calculateCompiledPatternLengthAndFlags):
25312 (jsRegExpCompile):
25313 * pcre/pcre_exec.cpp:
25314 (MatchStack::canUseStackBufferForNextFrame):
25315 (MatchStack::allocateNextFrame):
25316 (MatchStack::pushNewFrame):
25317 (MatchStack::frameIsStackAllocated):
25318 (MatchStack::popCurrentFrame):
25319 (MatchStack::unrollAnyHeapAllocatedFrames):
25320 (getUTF8CharAndIncrementLength):
25321 (match):
25322 (jsRegExpExecute):
25323 * pcre/pcre_internal.h:
25324 (PUT2INC):
25325 (isLeadingSurrogate):
25326 (isTrailingSurrogate):
25327 (decodeSurrogatePair):
25328 (getChar):
25329 * pcre/pcre_ord2utf8.cpp:
25330 (_pcre_ord2utf8):
25331 * pcre/pcre_xclass.cpp:
25332 (getUTF8CharAndAdvancePointer):
25333 (_pcre_xclass):
25334
25335 2007-11-24 Eric Seidel <eric@webkit.org>
25336
25337 Reviewed by Maciej.
25338
25339 Clean up jsRegExpExecute
25340
25341 * pcre/pcre_compile.cpp:
25342 (returnError):
25343 (jsRegExpCompile):
25344 * pcre/pcre_exec.cpp:
25345 (jsRegExpExecute):
25346 * pcre/pcre_internal.h:
25347
25348 2007-11-29 Oliver Hunt <oliver@apple.com>
25349
25350 Reviewed by Geoff.
25351
25352 Merging updated system alloc and spinlock code from r38 of TCMalloc.
25353
25354 This is needed as a precursor to the merge of TCMalloc proper.
25355
25356 * wtf/FastMalloc.cpp:
25357 (WTF::TCMalloc_PageHeap::GrowHeap):
25358 * wtf/TCSpinLock.h:
25359 (TCMalloc_SpinLock::TCMalloc_SpinLock):
25360 (TCMalloc_SpinLock::):
25361 (TCMalloc_SpinLock::Lock):
25362 (TCMalloc_SpinLock::Unlock):
25363 (TCMalloc_SpinLock::IsHeld):
25364 * wtf/TCSystemAlloc.cpp:
25365 (TrySbrk):
25366 (TryMmap):
25367 (TryVirtualAlloc):
25368 (TryDevMem):
25369 (TCMalloc_SystemAlloc):
25370 * wtf/TCSystemAlloc.h:
25371
25372 2007-11-28 Brady Eidson <beidson@apple.com>
25373
25374 Reviewed by Geoff
25375
25376 Add copyKeysToVector utility, mirroring copyValuesToVector
25377 Also change the copyValuesToVector implementation to be a little more attractive
25378
25379 * wtf/HashMap.h:
25380 (WTF::copyKeysToVector):
25381 (WTF::copyValuesToVector):
25382
25383 2007-11-27 Alp Toker <alp@atoker.com>
25384
25385 Reviewed by Mark Rowe.
25386
25387 Add a list of public JavaScriptCore headers for installation.
25388
25389 This follows the convention used for the Qt and GTK+ header lists.
25390
25391 * headers.pri: Added.
25392
25393 2007-11-27 Alp Toker <alp@atoker.com>
25394
25395 Prospective MSVC build fix.
25396
25397 Roll back dllexport/dllimport support for now.
25398
25399 * API/JSBase.h:
25400
25401 2007-11-27 Alp Toker <alp@atoker.com>
25402
25403 Reviewed by Maciej.
25404
25405 http://bugs.webkit.org/show_bug.cgi?id=15569
25406 [gtk] GTK JavaScriptCore needs to export symbols for JSC API and WTF
25407
25408 Introduce JS_EXPORT to mark symbols to be exported as public API.
25409
25410 Export all public symbols in the JavaScriptCore C API.
25411
25412 This matches conventions for exporting symbols set by the CF and CG
25413 frameworks.
25414
25415 * API/JSBase.h:
25416 * API/JSContextRef.h:
25417 * API/JSObjectRef.h:
25418 * API/JSStringRef.h:
25419 * API/JSStringRefBSTR.h:
25420 * API/JSStringRefCF.h:
25421 * API/JSValueRef.h:
25422
25423 2007-11-27 Anders Carlsson <andersca@apple.com>
25424
25425 Reviewed by Adam.
25426
25427 Make PropertyNameArray and ScopeChain COMEnumVariant friendly.
25428
25429 * kjs/PropertyNameArray.cpp:
25430 (KJS::PropertyNameArray::swap):
25431 Implement PropertyNameArray::swap.
25432
25433 * kjs/PropertyNameArray.h:
25434 Add ValueType typedef. Replace PropertyNameArrayIterator with
25435 PropertyNameArray::const_iterator.
25436
25437 * kjs/nodes.cpp:
25438 (KJS::ForInNode::execute):
25439 * kjs/scope_chain.cpp:
25440 (KJS::ScopeChain::print):
25441 Update for changes to PropertyNameArray.
25442
25443 * kjs/scope_chain.h:
25444 Add const_iterator and ValueType typedef.
25445
25446 2007-11-27 Anders Carlsson <andersca@apple.com>
25447
25448 Reviewed by Darin.
25449
25450 Add a ValueType typedef.
25451
25452 * wtf/Vector.h:
25453
25454 2007-11-26 Darin Adler <darin@apple.com>
25455
25456 Reviewed by Mitz.
25457
25458 - fix http://bugs.webkit.org/show_bug.cgi?id=16096
25459 REGRESSION (r26653-r26699): Plaxo.com addressbook does not load in webkit nightlies
25460
25461 Test: fast/js/regexp-overflow.html
25462
25463 * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags):
25464 Removed a stray "ptr++" that I added by accident when merging the
25465 changes between PCRE 6.4 and 6.5.
25466
25467 2007-11-26 Geoffrey Garen <ggaren@apple.com>
25468
25469 Reviewed by Kevin McCullough.
25470
25471 Fixed <rdar://problem/5597937> REGRESSION (r27126): Drosera does not
25472 show variables (can't enumerate ActivationImp properties)
25473
25474 Implemented a custom ActivationImp::getPropertyNames, since
25475 ActivationImp now uses a custom property storage mechanism for local
25476 variables.
25477
25478 * kjs/function.cpp:
25479 (KJS::ActivationImp::getPropertyNames):
25480 * kjs/function.h:
25481
25482 2007-11-26 Alp Toker <alp@atoker.com>
25483
25484 GTK+/Qt/Wx build fix for breakage introduced in r28039.
25485
25486 * ForwardingHeaders/JavaScriptCore/JSRetainPtr.h: Added.
25487
25488 2007-11-24 Laszlo Gombos <laszlo.gombos@gmail.com>
25489
25490 Reviewed by Maciej Stachowiak.
25491
25492 Fix minor compiler warning (GCC 4.1.3)
25493
25494 * pcre/pcre_internal.h:
25495 * pcre/pcre_ucp_searchfuncs.cpp:
25496 (_pcre_ucp_othercase):
25497
25498 2007-11-25 Mark Rowe <mrowe@apple.com>
25499
25500 Reviewed by Dan Bernstein.
25501
25502 Fix http://bugs.webkit.org/show_bug.cgi?id=16129
25503 Bug 16129: REGRESSION (r27761-r27811): malloc error while visiting http://mysit.es (crashes release build)
25504
25505 * pcre/pcre_compile.cpp: Change errorcode to be passed by reference so that any error code is propagated
25506 to our caller like they expect.
25507
25508 2007-11-23 Kevin Ollivier <kevino@theolliviers.com>
25509
25510 MSVC7 build fix. (rand_s doesn't exist there)
25511
25512 Reviewed by Adam Roben.
25513
25514 * kjs/config.h:
25515 * wtf/MathExtras.h:
25516
25517 2007-11-23 Kevin Ollivier <kevino@theolliviers.com>
25518
25519 wx build fix. Move WX_PYTHON logic into project build settings,
25520 add WebKitLibraries dirs on Win, and explicitly include JSCore
25521 headers in testkjs rather than getting them from a template.
25522 (Include dir order of JSCore/WTF and ICU headers is important due
25523 to wtf/unicode/utf8.h.)
25524
25525 * jscore.bkl:
25526
25527 2007-11-23 Simon Hausmann <hausmann@webkit.org>
25528
25529 Reviewed by George Staikos <staikos@kde.org>.
25530
25531 Fix make (dist)clean on Windows.
25532
25533 OBJECTS_DIR_WTR does not exist anymore, use GENERATED_SOURCES_DIR.
25534
25535
25536 * JavaScriptCore.pri:
25537 * pcre/pcre.pri:
25538
25539 2007-11-22 Simon Hausmann <hausmann@kde.org>
25540
25541 Reviewed by George.
25542
25543 Make the directory of where to put the generated sources configurable through the GENERATED_SOURCE_DIR variable
25544
25545 * JavaScriptCore.pri:
25546 * pcre/pcre.pri:
25547
25548 2007-11-22 Simon Hausmann <hausmann@kde.org>
25549
25550 Reviewed by George.
25551
25552 Centralize the setup for all the extra compilers in a addExtraCompiler function.
25553
25554 This allows adding a "generated_files" target that builds all generated files using "make generated_files".
25555 For the build inside Qt we do not generate actual rules for the extra compilers but instead
25556 do the variable substitution of compiler.output manually and add the generated sources to SOURCES.
25557
25558 * JavaScriptCore.pri:
25559 * pcre/pcre.pri:
25560
25561 2007-11-20 Mark Rowe <mrowe@apple.com>
25562
25563 Reviewed by Tim Hatcher.
25564
25565 <rdar://problem/5602936> Need to resolve new GCC 4.2 warnings
25566
25567 Fix all warnings emitted by GCC 4.2 when building JavaScriptCore. This allows builds with
25568 -Werror to succeed. At present they will crash when executed due to code that is not safe
25569 under strict aliasing (<rdar://problem/5536806>).
25570
25571 * Configurations/Base.xcconfig: Remove the -Wno-long-double flag.
25572 * kjs/date_object.cpp:
25573 (KJS::formatTime): Test whether the stack-allocated string is empty rather than at a non-null address.
25574 * kjs/dtoa.cpp:
25575 (Bigint::): Tweak formatting to silence warnings.
25576 * pcre/pcre_exec.cpp:
25577 (match): Tweak formatting to silence warnings
25578 * wtf/Assertions.cpp: Add printf format attribute to functions that warrant it.
25579 * wtf/Assertions.h: Ditto.
25580
25581 2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
25582
25583 wx port build fix (wx headers include ctype functions).
25584
25585 * kjs/config.h:
25586
25587 2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
25588
25589 Remove outdated and unused Windows port files.
25590
25591 Reviewed by Adam Roben.
25592
25593 * Makefile.vc: Removed.
25594 * README-Win32.txt: Removed.
25595
25596 2007-11-18 Eric Seidel <eric@webkit.org>
25597
25598 Reviewed by Oliver.
25599
25600 * tests/mozilla/jsDriver.pl: exit non-0 when user aborts test run
25601
25602 2007-11-17 Mark Rowe <mrowe@apple.com>
25603
25604 Reviewed by Darin Adler.
25605
25606 Fix: <rdar://problem/5607032> REGRESSION: testapi exits with assertion failure in debug build
25607 <rdar://problem/5440659> JSGlobalContextCreate throws away globalObjectClass's prototype
25608 http://bugs.webkit.org/show_bug.cgi?id=16033
25609
25610 Split Interpreter's initialization into two distinct steps: the creation of the global prototypes
25611 and constructors, and storing them on the global object. This allows JSClassRef's passed to
25612 JSGlobalContextCreate to be instantiated with the correct prototype.
25613
25614 * API/JSCallbackObject.cpp: Assert at compile-time that the custom global object will fit in a collector cell.
25615 * API/JSCallbackObject.h:
25616 * API/JSCallbackObjectFunctions.h:
25617 (KJS::::JSCallbackObject):
25618 (KJS::::init):
25619 * API/JSContextRef.cpp:
25620 (JSGlobalContextCreate): Construct and set the interpreter's global object separately. When globalObjectClass
25621 is passed we need to set the interpreter's global object before doing the JSCallbackObject's initialization to
25622 prevent any JSObjectInitializeCallback's being invoked before a global object is set.
25623 * API/testapi.c:
25624 (globalObject_initialize): Test the object passed in is correct and that it has the expected global properties.
25625 (globalObject_get):
25626 (globalObject_set):
25627 (main):
25628 * API/testapi.js: Test that any static properties exposed by the global object's custom class are found.
25629 * JavaScriptCore.exp:
25630 * bindings/testbindings.cpp:
25631 (main): Update for changes in Interpreter method signatures.
25632 * bindings/testbindings.mm:
25633 (main): Ditto.
25634 * kjs/ExecState.cpp:
25635 (KJS::ExecState::ExecState):
25636 (KJS::ExecState::mark):
25637 (KJS::ExecState::setGlobalObject):
25638 * kjs/ExecState.h: Rename scope to m_scopeChain.
25639 * kjs/interpreter.cpp:
25640 (KJS::Interpreter::Interpreter):
25641 (KJS::Interpreter::init):
25642 (KJS::Interpreter::globalObject):
25643 (KJS::Interpreter::setGlobalObject):
25644 (KJS::Interpreter::resetGlobalObjectProperties):
25645 (KJS::Interpreter::createObjectsForGlobalObjectProperties):
25646 (KJS::Interpreter::setGlobalObjectProperties): Switch to using putDirect to ensure that the global object's put method
25647 cannot interfere with setting of the global properties. This prevents a user-written JSClassRef from attempting to
25648 call back into JavaScript from the initialization of the global object's members.
25649 * kjs/interpreter.h:
25650 * kjs/testkjs.cpp:
25651 (setupInterpreter): Update for changes in Interpreter method signatures.
25652
25653 2007-11-17 Mark Rowe <mrowe@apple.com>
25654
25655 Reviewed by Sam Weinig.
25656
25657 Prevent testapi from reporting false leaks. Clear out local variables pointing at
25658 JSObjectRefs to allow their values to be collected.
25659
25660 * API/testapi.c:
25661 (main):
25662
25663 2007-11-17 Mark Rowe <mrowe@apple.com>
25664
25665 Reviewed by Sam Weinig.
25666
25667 Prevent testapi from crashing if testapi.js can not be found by nil-checking the result of createStringWithContentsOfFile.
25668
25669 * API/testapi.c:
25670 (main):
25671
25672 2007-11-17 Alp Toker <alp@atoker.com>
25673
25674 Reviewed by Eric.
25675
25676 http://bugs.webkit.org/show_bug.cgi?id=16032
25677 JS minidom is not portable
25678
25679 Use a plain UTF-8 string instead of a CFString.
25680
25681 Print to stdout, not stderr like CFShow() would have done, since that
25682 behaviour seems unintentional.
25683
25684 * API/minidom.c:
25685 (main):
25686
25687 2007-11-17 Steve Falkenburg <sfalken@apple.com>
25688
25689 Windows build fix.
25690
25691 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
25692
25693 2007-11-16 Mark Rowe <mrowe@apple.com>
25694
25695 Windows build fix.
25696
25697 * kjs/lexer.cpp:
25698 (KJS::Lexer::record8):
25699
25700 2007-11-16 Mark Rowe <mrowe@apple.com>
25701
25702 Reviewed by Eric.
25703
25704 Replace strings, identifier, buffer8 and buffer16 members of Lexer with vectors.
25705 SunSpider claims this is a 0.7% speedup.
25706
25707 * kjs/lexer.cpp:
25708 (KJS::Lexer::Lexer):
25709 (KJS::Lexer::lex):
25710 (KJS::Lexer::record8):
25711 (KJS::Lexer::record16):
25712 (KJS::Lexer::scanRegExp):
25713 (KJS::Lexer::clear):
25714 (KJS::Lexer::makeIdentifier):
25715 (KJS::Lexer::makeUString):
25716 * kjs/lexer.h:
25717 * kjs/ustring.cpp:
25718 (KJS::UString::UString): Add a convenience constructor that takes a const Vector<UChar>&.
25719 * kjs/ustring.h:
25720
25721 2007-11-16 Adam Roben <aroben@apple.com>
25722
25723 Windows build fix
25724
25725 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Add a new include path
25726 and ignore the int -> bool conversion warning.
25727
25728 2007-11-16 Alexey Proskuryakov <ap@webkit.org>
25729
25730 Fix Windows debug build.
25731 Rubber-stamped by Eric
25732
25733 * pcre/pcre_exec.cpp: (match): Removed ASSERT_NOT_REACHED assertions that were making MSVC
25734 complain about unreachable code.
25735
25736 2007-11-15 Mark Rowe <mrowe@apple.com>
25737
25738 Gtk build fix.
25739
25740 * kjs/Parser.cpp:
25741
25742 2007-11-15 Mark Rowe <mrowe@apple.com>
25743
25744 Mac build and header search path sanity fix.
25745
25746 Reviewed by Sam Weinig and Tim Hatcher.
25747
25748 Move base setting for HEADER_SEARCH_PATHS into Base.xcconfig, and extend
25749 it in JavaScriptCore.xcconfig. This removes the need to override it on a
25750 per-target basis inside the .xcodeproj file.
25751
25752 * Configurations/Base.xcconfig:
25753 * Configurations/JavaScriptCore.xcconfig:
25754 * JavaScriptCore.xcodeproj/project.pbxproj:
25755
25756 2007-11-15 Mark Rowe <mrowe@apple.com>
25757
25758 Qt build fix.
25759
25760 * kjs/Parser.h:
25761
25762 2007-11-15 Geoffrey Garen <ggaren@apple.com>
25763
25764 Reviewed by Eric Seidel.
25765
25766 Another round of grammar / parsing cleanup.
25767
25768 1. Created distinct parser calls for parsing function bodies vs
25769 programs. This will help later with optimizing global variable access.
25770
25771 2. Turned Parser into a singleton. Cleaned up Lexer's singleton
25772 interface.
25773
25774 3. Modified Lexer to free a little more memory when done lexing. (Added
25775 FIXMEs for similar issues that I didn't fix.)
25776
25777 4. Changed Lexer::makeIdentifier and Lexer::makeUString to start
25778 respecting the arguments passed to them. (No behavior change, but this
25779 problem could have caused serious problems for an unsuspecting user of
25780 these functions.)
25781
25782 5. Removed KJS_DEBUG_MEM because it was bit-rotted.
25783
25784 6. Removed Parser::prettyPrint because the same work was simpler to do
25785 at the call site.
25786
25787 7. Some renames:
25788
25789 "Parser::accept" => "Parser::didFinishParsing"
25790 "Parser::sid" => "Parser::m_sourceID"
25791 "Lexer::doneParsing" => "Lexer::clear"
25792 "sid" => "sourceId"
25793 "lineno" => "lineNo"
25794
25795 * JavaScriptCore.exp:
25796 * kjs/Parser.cpp:
25797 (KJS::Parser::Parser):
25798 (KJS::Parser::parseProgram):
25799 (KJS::Parser::parseFunctionBody):
25800 (KJS::Parser::parse):
25801 (KJS::Parser::didFinishParsing):
25802 (KJS::parser):
25803 * kjs/Parser.h:
25804 (KJS::Parser::sourceId):
25805 * kjs/function.cpp:
25806 (KJS::GlobalFuncImp::callAsFunction):
25807 * kjs/function_object.cpp:
25808 (FunctionObjectImp::construct):
25809 * kjs/grammar.y:
25810 * kjs/interpreter.cpp:
25811 (KJS::Interpreter::checkSyntax):
25812 (KJS::Interpreter::evaluate):
25813 * kjs/interpreter.h:
25814 * kjs/lexer.cpp:
25815 (kjsyylex):
25816 (KJS::lexer):
25817 (KJS::Lexer::Lexer):
25818 (KJS::Lexer::~Lexer):
25819 (KJS::Lexer::scanRegExp):
25820 (KJS::Lexer::doneParsing):
25821 (KJS::Lexer::makeIdentifier):
25822 (KJS::Lexer::makeUString):
25823 * kjs/lexer.h:
25824 (KJS::Lexer::pattern):
25825 (KJS::Lexer::flags):
25826 (KJS::Lexer::sawError):
25827 * kjs/nodes.cpp:
25828 (KJS::Node::Node):
25829 (KJS::FunctionBodyNode::FunctionBodyNode):
25830 * kjs/nodes.h:
25831 * kjs/testkjs.cpp:
25832 (prettyPrintScript):
25833 (kjsmain):
25834 * kjs/ustring.cpp:
25835 * kjs/ustring.h:
25836
25837 2007-11-15 Oliver Hunt <oliver@apple.com>
25838
25839 Reviewed by Darin.
25840
25841 <rdar://problem/5601548> REGRESSION: All SourceElements and their children leak after a syntax error
25842
25843 Add a stub node to maintain the Vector of SourceElements until assignment.
25844
25845 * kjs/grammar.y:
25846 * kjs/nodes.h:
25847 (KJS::SourceElementsStub::SourceElementsStub):
25848 (KJS::SourceElementsStub::append):
25849 (KJS::SourceElementsStub::release):
25850 (KJS::SourceElementsStub::):
25851 (KJS::SourceElementsStub::precedence):
25852
25853 2007-11-15 Eric Seidel <eric@webkit.org>
25854
25855 Reviewed by Sam.
25856
25857 Abstract most of RMATCH into MatchStack functions.
25858
25859 SunSpider claims this, combined with the last 2 patches was a 1% speedup, 10% for dna-regexp.
25860
25861 * pcre/pcre_exec.cpp:
25862 (MatchStack::canUseStackBufferForNextFrame):
25863 (MatchStack::allocateNextFrame):
25864 (MatchStack::pushNewFrame):
25865 (MatchStack::frameIsStackAllocated):
25866 (MatchStack::popCurrentFrame):
25867 (MatchStack::unrollAnyHeapAllocatedFrames):
25868 (match):
25869
25870 2007-11-15 Eric Seidel <eric@webkit.org>
25871
25872 Reviewed by Sam.
25873
25874 Remove RETURN_ERROR, add MatchStack
25875
25876 * pcre/pcre_exec.cpp:
25877 (MatchStack::MatchStack):
25878 (MatchStack::unrollAnyHeapAllocatedFrames):
25879 (matchError):
25880 (match):
25881
25882 2007-11-15 Eric Seidel <eric@webkit.org>
25883
25884 Reviewed by Sam.
25885
25886 Clean up match function to match WebKit style
25887
25888 * JavaScriptCore.xcodeproj/project.pbxproj:
25889 * pcre/pcre_exec.cpp:
25890 (match):
25891
25892 2007-11-15 Steve Falkenburg <sfalken@apple.com>
25893
25894 Windows build fix.
25895
25896 * JavaScriptCore.vcproj/JavaScriptCore.make:
25897
25898 2007-11-14 Alexey Proskuryakov <ap@webkit.org>
25899
25900 Reviewed by Darin.
25901
25902 http://bugs.webkit.org/show_bug.cgi?id=15982
25903 Improve JSString UTF-8 decoding
25904
25905 * API/JSStringRef.cpp:
25906 (JSStringCreateWithUTF8CString): Use strict decoding, return 0 on error.
25907
25908 * wtf/unicode/UTF8.cpp:
25909 (WTF::Unicode::convertUTF16ToUTF8):
25910 (WTF::Unicode::convertUTF8ToUTF16):
25911 * wtf/unicode/UTF8.h:
25912 Made these function names start with a lower case letter.
25913
25914 * kjs/ustring.cpp: (KJS::UString::UTF8String): Updated for the above renaming.
25915
25916 * bindings/c/c_utility.cpp:
25917 (KJS::Bindings::convertUTF8ToUTF16WithLatin1Fallback): Renamed to highlight the difference
25918 from convertUTF8ToUTF16 in wtf/unicode.
25919 (KJS::Bindings::convertNPStringToUTF16): Updated for the above renaming.
25920 (KJS::Bindings::identifierFromNPIdentifier): Ditto.
25921 * bindings/c/c_utility.h: Made convertUTF8ToUTF16WithLatin1Fallback() a file static.
25922
25923 2007-11-14 Sam Weinig <sam@webkit.org>
25924
25925 Rubber-stamped by Anders.
25926
25927 Fix the Xcode project file after it was messed up in r27402.
25928
25929 * JavaScriptCore.xcodeproj/project.pbxproj:
25930
25931 2007-11-14 Eric Seidel <eric@webkit.org>
25932
25933 Reviewed by Oliver.
25934
25935 More PCRE style cleanup.
25936
25937 * pcre/pcre_compile.cpp:
25938 (compile_regex):
25939
25940 2007-11-14 Adam Roben <aroben@apple.com>
25941
25942 Clean up the bison conflict checking script
25943
25944 Reviewed by Geoff.
25945
25946 * DerivedSources.make:
25947
25948 2007-11-14 Eric Seidel <eric@webkit.org>
25949
25950 Reviewed by Geoff.
25951
25952 Another round of PCRE cleanups: inlines
25953
25954 SunSpider claims that this, combined with my previous PCRE cleanup were a 0.7% speedup, go figure.
25955
25956 * pcre/pcre_compile.cpp:
25957 (jsRegExpCompile):
25958 * pcre/pcre_exec.cpp:
25959 (match):
25960 (jsRegExpExecute):
25961 * pcre/pcre_internal.h:
25962 (PUT):
25963 (GET):
25964 (PUT2):
25965 (GET2):
25966 (isNewline):
25967
25968 2007-11-14 Eric Seidel <eric@webkit.org>
25969
25970 Reviewed by Sam.
25971
25972 Give PCRE a (small) bath.
25973 Fix some formating and break things off into separate functions
25974 http://bugs.webkit.org/show_bug.cgi?id=15993
25975
25976 * pcre/pcre_compile.cpp:
25977 (calculateCompiledPatternLengthAndFlags):
25978 (printCompiledRegExp):
25979 (returnError):
25980 (jsRegExpCompile):
25981 * pcre/pcre_internal.h:
25982 (compile_data::compile_data):
25983
25984 2007-11-14 Geoffrey Garen <ggaren@apple.com>
25985
25986 Reviewed by Eric Seidel.
25987
25988 Cleaned up the JavaScript grammar a bit.
25989
25990 1. Changed BlockNode to always hold a child vector (which may be empty),
25991 eliminating a few NULL-check branches in the common execution case.
25992
25993 2. Changed the Block production to correctly report its starting and
25994 ending line numbers to the debugger. (It used to report its ending line
25995 as its starting line.) Also, removed duplicate line-reporting code
25996 inside the BlockNode constructor.
25997
25998 3. Moved curly braces up from FunctionBody production into parent
25999 productions. (I had to move the line number reporting code, too, since
26000 it depends on the location of the curly braces.) This matches the ECMA
26001 spec more closely, and makes some future changes I plan easier.
26002
26003 4. Fixed statementList* convenience functions to deal appropriately with
26004 empty Vectors.
26005
26006 SunSpider reports a small and statistically insignificant speedup.
26007
26008 * kjs/grammar.y:
26009 * kjs/nodes.cpp:
26010 (KJS::statementListPushFIFO):
26011 (KJS::statementListGetDeclarations):
26012 (KJS::statementListInitializeDeclarationStack):
26013 (KJS::statementListInitializeVariableAccessStack):
26014 (KJS::BlockNode::BlockNode):
26015 (KJS::BlockNode::optimizeVariableAccess):
26016 (KJS::BlockNode::getDeclarations):
26017 (KJS::BlockNode::execute):
26018 (KJS::FunctionBodyNode::initializeDeclarationStacks):
26019 (KJS::FunctionBodyNode::optimizeVariableAccess):
26020
26021 2007-11-13 Anders Carlsson <andersca@apple.com>
26022
26023 Add RefCounted.h (And remove Shared.h)
26024
26025 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
26026
26027 2007-11-13 Geoffrey Garen <ggaren@apple.com>
26028
26029 Build fix.
26030
26031 * kjs/regexp.h:
26032
26033 2007-11-13 Geoffrey Garen <ggaren@apple.com>
26034
26035 Reviewed by Anders Carlsson.
26036
26037 Renamed Shared to RefCounted.
26038
26039 * API/JSClassRef.h:
26040 * JavaScriptCore.xcodeproj/project.pbxproj:
26041 * kjs/interpreter.h:
26042 * kjs/regexp.h:
26043 * wtf/RefCounted.h: Copied from JavaScriptCore/wtf/Shared.h.
26044 (WTF::RefCounted::RefCounted):
26045 * wtf/Shared.h: Removed.
26046
26047 2007-11-13 Adam Roben <aroben@apple.com>
26048
26049 Build fix
26050
26051 Reviewed by Geoff.
26052
26053 * kjs/regexp.h: Added a missing #include.
26054
26055 2007-11-13 Geoffrey Garen <ggaren@apple.com>
26056
26057 Reviewed by Sam Weinig.
26058
26059 Moved Shared.h into wtf so it could be used in more places. Deployed
26060 Shared in places where JSCore previously had hand-rolled ref-counting
26061 classes.
26062
26063 * API/JSClassRef.cpp:
26064 (OpaqueJSClass::OpaqueJSClass):
26065 * API/JSClassRef.h:
26066 * API/JSObjectRef.cpp:
26067 (JSClassRetain):
26068 (JSClassRelease):
26069 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
26070 * JavaScriptCore.xcodeproj/project.pbxproj:
26071 * kjs/interpreter.cpp:
26072 (KJS::Interpreter::init):
26073 * kjs/interpreter.h:
26074 * kjs/regexp.cpp:
26075 (KJS::RegExp::RegExp):
26076 * kjs/regexp.h:
26077 * wtf/Shared.h: Copied from WebCore/platform/Shared.h.
26078
26079 2007-11-13 Eric Seidel <eric@webkit.org>
26080
26081 Reviewed by Maciej.
26082
26083 Add an ASSERT to getTruncatedInt32 to enforce proper usage.
26084 Best part about this patch? It doesn't break the web!
26085
26086 * kjs/JSImmediate.h:
26087 (KJS::JSImmediate::getTruncatedInt32):
26088 (KJS::JSImmediate::toDouble):
26089 (KJS::JSImmediate::getUInt32):
26090
26091 2007-11-13 Alexey Proskuryakov <ap@webkit.org>
26092
26093 Windows build fix.
26094
26095 * bindings/c/c_utility.cpp:
26096 (KJS::Bindings::convertUTF8ToUTF16):
26097 * kjs/ustring.cpp:
26098 (KJS::UString::UTF8String):
26099 * wtf/unicode/UTF8.cpp:
26100 (WTF::Unicode::ConvertUTF8ToUTF16):
26101
26102 2007-11-13 Darin Adler <darin@apple.com>
26103
26104 Reviewed by Geoff.
26105
26106 - fix http://bugs.webkit.org/show_bug.cgi?id=11231
26107 RegExp bug when handling newline characters
26108 and a number of other differences between PCRE behvior
26109 and JavaScript regular expressions:
26110
26111 + single-digit sequences like \4 should be treated as octal
26112 character constants, unless there is a sufficient number
26113 of brackets for them to be treated as backreferences
26114
26115 + \8 turns into the character "8", not a binary zero character
26116 followed by "8" (same for 9)
26117
26118 + only the first 3 digits should be considered part of an
26119 octal character constant (the old behavior was to decode
26120 an arbitrarily long sequence and then mask with 0xFF)
26121
26122 + if \x is followed by anything other than two valid hex digits,
26123 then it should simply be treated a the letter "x"; that includes
26124 not supporting the \x{41} syntax
26125
26126 + if \u is followed by anything less than four valid hex digits,
26127 then it should simply be treated a the letter "u"
26128
26129 + an extra "+" should be a syntax error, rather than being treated
26130 as the "possessive quantifier"
26131
26132 + if a "]" character appears immediately after a "[" character that
26133 starts a character class, then that's an empty character class,
26134 rather than being the start of a character class that includes a
26135 "]" character
26136
26137 + a "$" should not match a terminating newline; we could have gotten
26138 PCRE to handle this the way we wanted by passing an appropriate option
26139
26140 Test: fast/js/regexp-no-extensions.html
26141
26142 * pcre/pcre_compile.cpp:
26143 (check_escape): Check backreferences against bracount to catch both
26144 overflows and things that should be treated as octal. Rewrite octal
26145 loop to not go on indefinitely. Rewrite both hex loops to match and
26146 remove \x{} support.
26147 (compile_branch): Restructure loops so that we don't special-case a "]"
26148 at the beginning of a character class. Remove code that treated "+" as
26149 the possessive quantifier.
26150 (jsRegExpCompile): Change the "]" handling here too.
26151
26152 * pcre/pcre_exec.cpp: (match): Changed CIRC to match the DOLL implementation.
26153 Changed DOLL to remove handling of "terminating newline", a Perl concept
26154 which we don't need.
26155
26156 * tests/mozilla/expected.html: Two tests are fixed now:
26157 ecma_3/RegExp/regress-100199.js and ecma_3/RegExp/regress-188206.js.
26158 One test fails now: ecma_3/RegExp/perlstress-002.js -- our success before
26159 was due to a bug (we treated all 1-character numeric escapes as backreferences).
26160 The date tests also now both expect success -- whatever was making them fail
26161 before was probably due to the time being close to a DST shift; maybe we need
26162 to get rid of those tests.
26163
26164 2007-11-13 Darin Adler <darin@apple.com>
26165
26166 * kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32):
26167 Remove too-strong assert that was firing constantly and preventing even basic
26168 web browsing from working in a debug build. This function is used in many
26169 cases where the immediate value is not a number; the assertion could perhaps
26170 be added back later with a bit of reorganization.
26171
26172 2007-11-13 Alp Toker <alp@atoker.com>
26173
26174 Build fix for breakage to non-Mac builds introduced in r27746.
26175
26176 * kjs/ustring.cpp:
26177
26178 2007-11-13 Eric Seidel <eric@webkit.org>
26179
26180 Reviewed by Maciej.
26181
26182 Clean up evaluateToBoolean functions to use inlines instead of copy/paste code
26183
26184 * kjs/JSImmediate.h:
26185 * kjs/nodes.cpp:
26186 (KJS::GreaterNode::inlineEvaluateToBoolean):
26187 (KJS::GreaterNode::evaluate):
26188 (KJS::LessEqNode::inlineEvaluateToBoolean):
26189 (KJS::LessEqNode::evaluate):
26190 (KJS::GreaterEqNode::inlineEvaluateToBoolean):
26191 (KJS::GreaterEqNode::evaluate):
26192 (KJS::InNode::evaluateToBoolean):
26193 (KJS::EqualNode::inlineEvaluateToBoolean):
26194 (KJS::EqualNode::evaluate):
26195 (KJS::NotEqualNode::inlineEvaluateToBoolean):
26196 (KJS::NotEqualNode::evaluate):
26197 (KJS::StrictEqualNode::inlineEvaluateToBoolean):
26198 (KJS::StrictEqualNode::evaluate):
26199 (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
26200 (KJS::NotStrictEqualNode::evaluate):
26201 * kjs/nodes.h:
26202
26203 2007-11-12 Geoffrey Garen <ggaren@apple.com>
26204
26205 Reviewed by Sam Weinig.
26206
26207 Fixed http://bugs.webkit.org/show_bug.cgi?id=15958
26208 base64 spends 1.1% of total time checking for special Infinity case
26209
26210 Use a fast character test instead of calling strncmp.
26211
26212 1.1% speedup on string-base64. SunSpider reports a .4% speedup overall;
26213 Sharks reports only .1%. Who are you going to believe? Huh?
26214
26215 * kjs/ustring.cpp:
26216 (KJS::UString::toDouble):
26217
26218 2007-11-12 Eric Seidel <eric@webkit.org>
26219
26220 Reviewed by Oliver.
26221
26222 Add evaluateToInt32 and evaluateUInt32 methods and deploy them.
26223 Fix a few missing evaluateToBoolean methods
26224 Deploy all evaluateTo* functions to more nodes to avoid slowdowns
26225 http://bugs.webkit.org/show_bug.cgi?id=15950
26226
26227 SunSpider claims this is at least a 1.4% speedup.
26228
26229 * kjs/JSImmediate.h:
26230 (KJS::JSImmediate::getTruncatedInt32):
26231 (KJS::JSImmediate::toDouble):
26232 (KJS::JSImmediate::getUInt32):
26233 * kjs/nodes.cpp:
26234 (KJS::ExpressionNode::evaluateToNumber):
26235 (KJS::ExpressionNode::evaluateToInt32):
26236 (KJS::ExpressionNode::evaluateToUInt32):
26237 (KJS::NumberNode::evaluateToInt32):
26238 (KJS::NumberNode::evaluateToUInt32):
26239 (KJS::ImmediateNumberNode::evaluateToInt32):
26240 (KJS::ImmediateNumberNode::evaluateToUInt32):
26241 (KJS::ResolveNode::evaluate):
26242 (KJS::ResolveNode::evaluateToNumber):
26243 (KJS::ResolveNode::evaluateToBoolean):
26244 (KJS::ResolveNode::evaluateToInt32):
26245 (KJS::ResolveNode::evaluateToUInt32):
26246 (KJS::LocalVarAccessNode::evaluateToInt32):
26247 (KJS::LocalVarAccessNode::evaluateToUInt32):
26248 (KJS::BracketAccessorNode::evaluateToNumber):
26249 (KJS::BracketAccessorNode::evaluateToBoolean):
26250 (KJS::BracketAccessorNode::evaluateToInt32):
26251 (KJS::BracketAccessorNode::evaluateToUInt32):
26252 (KJS::DotAccessorNode::inlineEvaluate):
26253 (KJS::DotAccessorNode::evaluate):
26254 (KJS::DotAccessorNode::evaluateToNumber):
26255 (KJS::DotAccessorNode::evaluateToBoolean):
26256 (KJS::DotAccessorNode::evaluateToInt32):
26257 (KJS::DotAccessorNode::evaluateToUInt32):
26258 (KJS::NewExprNode::inlineEvaluate):
26259 (KJS::NewExprNode::evaluate):
26260 (KJS::NewExprNode::evaluateToNumber):
26261 (KJS::NewExprNode::evaluateToBoolean):
26262 (KJS::NewExprNode::evaluateToInt32):
26263 (KJS::NewExprNode::evaluateToUInt32):
26264 (KJS::FunctionCallResolveNode::inlineEvaluate):
26265 (KJS::FunctionCallResolveNode::evaluate):
26266 (KJS::FunctionCallResolveNode::evaluateToNumber):
26267 (KJS::FunctionCallResolveNode::evaluateToBoolean):
26268 (KJS::FunctionCallResolveNode::evaluateToInt32):
26269 (KJS::FunctionCallResolveNode::evaluateToUInt32):
26270 (KJS::LocalVarFunctionCallNode::evaluate):
26271 (KJS::LocalVarFunctionCallNode::evaluateToNumber):
26272 (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
26273 (KJS::LocalVarFunctionCallNode::evaluateToInt32):
26274 (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
26275 (KJS::FunctionCallDotNode::evaluate):
26276 (KJS::FunctionCallDotNode::evaluateToNumber):
26277 (KJS::FunctionCallDotNode::evaluateToBoolean):
26278 (KJS::FunctionCallDotNode::evaluateToInt32):
26279 (KJS::FunctionCallDotNode::evaluateToUInt32):
26280 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
26281 (KJS::PostDecLocalVarNode::evaluateToNumber):
26282 (KJS::PostDecLocalVarNode::evaluateToBoolean):
26283 (KJS::PostDecLocalVarNode::evaluateToInt32):
26284 (KJS::PostDecLocalVarNode::evaluateToUInt32):
26285 (KJS::typeStringForValue):
26286 (KJS::UnaryPlusNode::evaluate):
26287 (KJS::UnaryPlusNode::evaluateToBoolean):
26288 (KJS::UnaryPlusNode::evaluateToNumber):
26289 (KJS::UnaryPlusNode::evaluateToInt32):
26290 (KJS::BitwiseNotNode::inlineEvaluateToInt32):
26291 (KJS::BitwiseNotNode::evaluate):
26292 (KJS::BitwiseNotNode::evaluateToNumber):
26293 (KJS::BitwiseNotNode::evaluateToBoolean):
26294 (KJS::BitwiseNotNode::evaluateToInt32):
26295 (KJS::MultNode::evaluateToBoolean):
26296 (KJS::MultNode::evaluateToInt32):
26297 (KJS::MultNode::evaluateToUInt32):
26298 (KJS::DivNode::evaluateToInt32):
26299 (KJS::DivNode::evaluateToUInt32):
26300 (KJS::ModNode::evaluateToBoolean):
26301 (KJS::ModNode::evaluateToInt32):
26302 (KJS::ModNode::evaluateToUInt32):
26303 (KJS::AddNode::evaluateToNumber):
26304 (KJS::AddNode::evaluateToInt32):
26305 (KJS::AddNode::evaluateToUInt32):
26306 (KJS::AddNumbersNode::evaluateToInt32):
26307 (KJS::AddNumbersNode::evaluateToUInt32):
26308 (KJS::SubNode::evaluateToInt32):
26309 (KJS::SubNode::evaluateToUInt32):
26310 (KJS::LeftShiftNode::inlineEvaluateToInt32):
26311 (KJS::LeftShiftNode::evaluate):
26312 (KJS::LeftShiftNode::evaluateToNumber):
26313 (KJS::LeftShiftNode::evaluateToInt32):
26314 (KJS::RightShiftNode::inlineEvaluateToInt32):
26315 (KJS::RightShiftNode::evaluate):
26316 (KJS::RightShiftNode::evaluateToNumber):
26317 (KJS::RightShiftNode::evaluateToInt32):
26318 (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
26319 (KJS::UnsignedRightShiftNode::evaluate):
26320 (KJS::UnsignedRightShiftNode::evaluateToNumber):
26321 (KJS::UnsignedRightShiftNode::evaluateToInt32):
26322 (KJS::LessNode::inlineEvaluateToBoolean):
26323 (KJS::LessNode::evaluate):
26324 (KJS::LessNode::evaluateToBoolean):
26325 (KJS::LessNumbersNode::inlineEvaluateToBoolean):
26326 (KJS::LessNumbersNode::evaluate):
26327 (KJS::LessNumbersNode::evaluateToBoolean):
26328 (KJS::LessStringsNode::inlineEvaluateToBoolean):
26329 (KJS::LessStringsNode::evaluate):
26330 (KJS::BitAndNode::evaluate):
26331 (KJS::BitAndNode::inlineEvaluateToInt32):
26332 (KJS::BitAndNode::evaluateToNumber):
26333 (KJS::BitAndNode::evaluateToBoolean):
26334 (KJS::BitAndNode::evaluateToInt32):
26335 (KJS::BitXOrNode::inlineEvaluateToInt32):
26336 (KJS::BitXOrNode::evaluate):
26337 (KJS::BitXOrNode::evaluateToNumber):
26338 (KJS::BitXOrNode::evaluateToBoolean):
26339 (KJS::BitXOrNode::evaluateToInt32):
26340 (KJS::BitOrNode::inlineEvaluateToInt32):
26341 (KJS::BitOrNode::evaluate):
26342 (KJS::BitOrNode::evaluateToNumber):
26343 (KJS::BitOrNode::evaluateToBoolean):
26344 (KJS::BitOrNode::evaluateToInt32):
26345 (KJS::ConditionalNode::evaluateToNumber):
26346 (KJS::ConditionalNode::evaluateToInt32):
26347 (KJS::ConditionalNode::evaluateToUInt32):
26348 (KJS::valueForReadModifyAssignment):
26349 (KJS::AssignExprNode::evaluate):
26350 (KJS::AssignExprNode::evaluateToBoolean):
26351 (KJS::AssignExprNode::evaluateToNumber):
26352 (KJS::AssignExprNode::evaluateToInt32):
26353 (KJS::VarDeclNode::handleSlowCase):
26354 * kjs/nodes.h:
26355 (KJS::FunctionCallResolveNode::precedence):
26356 (KJS::AddNode::precedence):
26357 (KJS::AddNode::):
26358 (KJS::LessNumbersNode::):
26359 (KJS::LessStringsNode::):
26360 * kjs/value.cpp:
26361 (KJS::JSValue::toInt32SlowCase):
26362 (KJS::JSValue::toUInt32SlowCase):
26363 * kjs/value.h:
26364 (KJS::JSValue::asCell):
26365 (KJS::JSValue::toInt32):
26366 (KJS::JSValue::toUInt32):
26367
26368 2007-11-12 Alexey Proskuryakov <ap@webkit.org>
26369
26370 Reviewed by Darin.
26371
26372 http://bugs.webkit.org/show_bug.cgi?id=15953
26373 Add UTF-8 encoding/decoding to WTF
26374
26375 * kjs/ustring.h: Moved UTF8SequenceLength() and decodeUTF8Sequence() to wtf/unicode.
26376 * kjs/ustring.cpp: (KJS::UString::UTF8String): Changed this function to take a strict/lenient
26377 parameter. Callers are not interested in getting decoding results in strict mode, so
26378 this allows for bailing out as soon as an error is seen.
26379
26380 * kjs/function.cpp:
26381 (KJS::encode): Updated for new UString::UTF8String() signature.
26382
26383 * API/JSStringRef.cpp:
26384 (JSStringCreateWithCharacters): Disambiguate UChar.
26385 (JSStringCreateWithUTF8CString): Actually use UTF-8 when creating the string!
26386 * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): Use ConvertUTF8ToUTF16().
26387
26388 * wtf/unicode/UTF8.cpp: Added.
26389 (WTF::Unicode::inlineUTF8SequenceLengthNonASCII):
26390 (WTF::Unicode::inlineUTF8SequenceLength):
26391 (WTF::Unicode::UTF8SequenceLength):
26392 (WTF::Unicode::decodeUTF8Sequence):
26393 (WTF::Unicode::):
26394 (WTF::Unicode::ConvertUTF16ToUTF8):
26395 (WTF::Unicode::isLegalUTF8):
26396 (WTF::Unicode::ConvertUTF8ToUTF16):
26397 * wtf/unicode/UTF8.h: Added.
26398 (WTF::Unicode::):
26399 Some code moved from ustring.h, some adapted from unicode.org sources.
26400
26401 * JavaScriptCore.exp:
26402 * JavaScriptCore.pri:
26403 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
26404 * JavaScriptCore.xcodeproj/project.pbxproj:
26405 * JavaScriptCoreSources.bkl:
26406 Added UTF8.{h,cpp}
26407
26408 2007-11-12 Josh Aas <joshmoz@gmail.com>
26409
26410 Reviewed by Darin.
26411
26412 - http://bugs.webkit.org/show_bug.cgi?id=15946
26413 add NPPValue NPPVpluginDrawingModel (Mozilla bug 403418 compat)
26414
26415 * bindings/npapi.h:
26416
26417 2007-11-12 Darin Adler <darin@apple.com>
26418
26419 Reviewed by Sam.
26420
26421 - http://bugs.webkit.org/show_bug.cgi?id=15951
26422 REGRESSION: assertion failure in regexp match() when running JS tests
26423
26424 Test: fast/js/regexp-many-brackets.html
26425
26426 * pcre/pcre_exec.cpp: (match): Added back accidentally-removed case for
26427 the BRANUMBER opcode.
26428
26429 2007-11-12 Darin Adler <darin@apple.com>
26430
26431 Reviewed by Geoff.
26432
26433 - fix use of prefix and config.h, got rid of a few unneeded things in
26434 the PCRE code; no behavior changes
26435
26436 * API/JSBase.cpp: Added include of config.h.
26437 * API/JSCallbackConstructor.cpp: Ditto.
26438 * API/JSCallbackFunction.cpp: Ditto.
26439 * API/JSCallbackObject.cpp: Ditto.
26440 * API/JSClassRef.cpp: Ditto.
26441 * API/JSContextRef.cpp: Ditto.
26442 * API/JSObjectRef.cpp: Ditto.
26443 * API/JSStringRef.cpp: Ditto.
26444 * API/JSValueRef.cpp: Ditto.
26445
26446 * JavaScriptCorePrefix.h: Removed obsolete <ctype.h> workaround.
26447 Moved new/delete macros after includes, as they are in WebCore's prefix.
26448 Removed "config.h".
26449
26450 * pcre/dftables.cpp: (main): Changed back to not use a separate maketables
26451 function. This is needed for PCRE, but not helpful for our use. Also changed
26452 the tables to all be 128 entries long instead of 256, since only the first
26453 128 are ever used.
26454
26455 * pcre/pcre_compile.cpp: Added include of config.h. Eliminated digitab,
26456 which was only being used to check hex digits. Changed all uses of TRUE and
26457 FALSE to use the C++ true and false instead.
26458 (check_escape): Just the TRUE/FALSE thing.
26459 (is_counted_repeat): Ditto.
26460 (could_be_empty_branch): Ditto.
26461 (get_othercase_range): Ditto.
26462 (compile_branch): Ditto.
26463 (compile_regex): Ditto.
26464 (is_anchored): Ditto.
26465 (is_startline): Ditto.
26466 (find_firstassertedchar): Ditto.
26467 (jsRegExpCompile): Ditto.
26468
26469 * pcre/pcre_exec.cpp: Added include of config.h. Changed all uses of TRUE and
26470 FALSE to use the C++ true and false instead.
26471 (match_ref): Just the TRUE/FALSE thing.
26472 (match): Ditto. Removed some unneeded braces.
26473 (jsRegExpExecute): Just the TRUE/FALSE thing.
26474
26475 * pcre/pcre_internal.h: Moved the constants needed by dftables.cpp to the top
26476 of the file instead of the bottom, so they can be used. Also changed the table
26477 sizes to 128 instead of 256. Removed macro definitions of FALSE and TRUE.
26478 Set array sizes for all the const arrays. Changed _pcre_utf8_table1_size to
26479 be a macro instead of a extern int.
26480
26481 * pcre/pcre_maketables.cpp: Removed. It's all in dftables.cpp now.
26482
26483 * pcre/pcre_tables.cpp: Made table sizes explicit.
26484
26485 * pcre/pcre_xclass.cpp: Just the TRUE/FALSE thing.
26486
26487 2007-11-12 Adam Roben <aroben@apple.com>
26488
26489 Build fix
26490
26491 * wtf/FastMalloc.h: Add missing using statement.
26492
26493 2007-11-11 Oliver Hunt <oliver@apple.com>
26494
26495 Reviewed by Darin.
26496
26497 Add special fastZeroedMalloc function to replace a
26498 number of fastCalloc calls where one argument was 1.
26499
26500 This results in a 0.4% progression in SunSpider, more
26501 than making up for the earlier regression caused by
26502 additional overflow checks.
26503
26504 * JavaScriptCore.exp:
26505 * kjs/array_instance.cpp:
26506 * kjs/property_map.cpp:
26507 * wtf/FastMalloc.cpp:
26508 * wtf/FastMalloc.h:
26509 * wtf/HashTable.h:
26510
26511 2007-11-11 Adam Roben <aroben@apple.com>
26512
26513 Fix <rdar://5578982> ASSERT in HashTable::checkTableConsistencyExceptSize beneath WebNotificationCenter
26514
26515 The bug was due to a mismatch between HashMap::remove and
26516 HashTable::checkTableConsistency. HashMap::remove can delete the value
26517 stored in the HashTable (by derefing it), which is not normally
26518 allowed by HashTable. It's OK in this case because the value is about
26519 to be removed from the table, but HashTable wasn't aware of this.
26520
26521 HashMap::remove now performs the consistency check itself before
26522 derefing the value.
26523
26524 Darin noticed that the same bug would occur in HashSet, so I've fixed
26525 it there as well.
26526
26527 Reviewed by Darin.
26528
26529 * wtf/HashMap.h:
26530 (WTF::HashMap::remove): Perform the HashTable consistency check
26531 manually before calling deref.
26532 * wtf/HashSet.h:
26533 (WTF::HashSet::remove): Ditto.
26534 * wtf/HashTable.h: Made checkTableConsistency public so that HashMap
26535 and HashSet can call it.
26536 (WTF::HashTable::removeAndInvalidateWithoutEntryConsistencyCheck):
26537 Added.
26538 (WTF::HashTable::removeAndInvalidate): Added.
26539 (WTF::HashTable::remove):
26540 (WTF::HashTable::removeWithoutEntryConsistencyCheck): Added.
26541
26542 2007-11-11 Mark Rowe <mrowe@apple.com>
26543
26544 Build fix. Use the correct filename case.
26545
26546 * kjs/nodes.h:
26547
26548 2007-11-11 Geoffrey Garen <ggaren@apple.com>
26549
26550 Reviewed by Sam Weinig.
26551
26552 Fixed http://bugs.webkit.org/show_bug.cgi?id=15902
26553 15% of string-validate-input.js is spent compiling the same regular expression
26554
26555 Store a compiled representation of the regular expression in the AST.
26556
26557 Only a .2% SunSpider speedup overall, but a 10.6% speedup on
26558 string-validate-input.js.
26559
26560 * kjs/nodes.cpp:
26561 (KJS::RegExpNode::evaluate):
26562 * kjs/nodes.h:
26563 (KJS::RegExpNode::):
26564 * kjs/nodes2string.cpp:
26565 (KJS::RegExpNode::streamTo):
26566 * kjs/regexp.cpp:
26567 (KJS::RegExp::flags):
26568 * kjs/regexp.h:
26569 (KJS::RegExp::pattern):
26570 * kjs/regexp_object.cpp:
26571 (KJS::RegExpObjectImp::construct):
26572 (KJS::RegExpObjectImp::createRegExpImp):
26573 * kjs/regexp_object.h:
26574
26575 2007-11-11 Oliver Hunt <oliver@apple.com>
26576
26577 Reviewed by Eric.
26578
26579 Partial fix for <rdar://problem/5585334> numfuzz: integer overflows opening malformed SVG file in WebCore::ImageBuffer::create
26580
26581 Unfortunately this is a very slight regression, but is unavoidable.
26582
26583 * wtf/FastMalloc.cpp:
26584
26585 2007-11-10 Eric Seidel <eric@webkit.org>
26586
26587 Reviewed by darin.
26588
26589 Add simple type inferencing to the parser, and create custom
26590 AddNode and LessNode subclasses based on inferred types.
26591 http://bugs.webkit.org/show_bug.cgi?id=15884
26592
26593 SunSpider claims this is at least a 0.5% speedup.
26594
26595 * JavaScriptCore.exp:
26596 * kjs/grammar.y:
26597 * kjs/internal.cpp:
26598 (KJS::NumberImp::getPrimitiveNumber):
26599 (KJS::GetterSetterImp::getPrimitiveNumber):
26600 * kjs/internal.h:
26601 * kjs/lexer.cpp:
26602 (KJS::Lexer::lex):
26603 * kjs/nodes.cpp:
26604 (KJS::Node::Node):
26605 (KJS::StringNode::evaluate):
26606 (KJS::StringNode::evaluateToNumber):
26607 (KJS::StringNode::evaluateToBoolean):
26608 (KJS::RegExpNode::evaluate):
26609 (KJS::UnaryPlusNode::optimizeVariableAccess):
26610 (KJS::AddNode::evaluate):
26611 (KJS::AddNode::evaluateToNumber):
26612 (KJS::AddNumbersNode::inlineEvaluateToNumber):
26613 (KJS::AddNumbersNode::evaluate):
26614 (KJS::AddNumbersNode::evaluateToNumber):
26615 (KJS::AddStringsNode::evaluate):
26616 (KJS::AddStringLeftNode::evaluate):
26617 (KJS::AddStringRightNode::evaluate):
26618 (KJS::lessThan):
26619 (KJS::lessThanEq):
26620 (KJS::LessNumbersNode::evaluate):
26621 (KJS::LessStringsNode::evaluate):
26622 * kjs/nodes.h:
26623 (KJS::ExpressionNode::):
26624 (KJS::RegExpNode::):
26625 (KJS::RegExpNode::precedence):
26626 (KJS::TypeOfResolveNode::):
26627 (KJS::LocalVarTypeOfNode::):
26628 (KJS::UnaryPlusNode::):
26629 (KJS::UnaryPlusNode::precedence):
26630 (KJS::AddNode::):
26631 (KJS::AddNode::precedence):
26632 (KJS::AddNumbersNode::):
26633 (KJS::AddStringLeftNode::):
26634 (KJS::AddStringRightNode::):
26635 (KJS::AddStringsNode::):
26636 (KJS::LessNode::):
26637 (KJS::LessNode::precedence):
26638 (KJS::LessNumbersNode::):
26639 (KJS::LessStringsNode::):
26640 * kjs/nodes2string.cpp:
26641 (KJS::StringNode::streamTo):
26642 * kjs/object.cpp:
26643 * kjs/object.h:
26644 * kjs/value.h:
26645 (KJS::JSValue::getPrimitiveNumber):
26646
26647 2007-11-11 Darin Adler <darin@apple.com>
26648
26649 - try another way of fixing dftables builds -- refactor pcre_internal.h a bit
26650
26651 * pcre/pcre_internal.h: Make most of this header do nothing when DFTABLES is set.
26652 Later we can break it into two files.
26653
26654 * JavaScriptCore.vcproj/dftables/dftables.vcproj: Take out now-unneeded include paths.
26655 * pcre/dftables.cpp: Set DFTABLES. Use delete instead of free.
26656 * pcre/dftables.pro: Take out now-unneeded include paths.
26657 * pcre/pcre_maketables.cpp: Use new instead of malloc.
26658
26659 2007-11-11 Darin Adler <darin@apple.com>
26660
26661 * pcre/dftables.pro: Try fixing Qt builds (I looked at qt-win) by adding
26662 another include path.
26663
26664 2007-11-11 Darin Adler <darin@apple.com>
26665
26666 * JavaScriptCore.xcodeproj/project.pbxproj: Try fixing Mac Tiger builds
26667 by adding another include path.
26668
26669 2007-11-11 Darin Adler <darin@apple.com>
26670
26671 Reviewed by Sam.
26672
26673 - http://bugs.webkit.org/show_bug.cgi?id=15924
26674 next round of changes to JSRegExp (formerly PCRE)
26675
26676 This is a combination of converting to C++, tweaking the API, and adding
26677 some additional optimizations.
26678
26679 Future steps will involve getting rid of the use of UTF-8 completely
26680 (we'll use UTF-16 exclusively instead), eliminating more source files,
26681 and some more speed-ups.
26682
26683 SunSpider says the current round is an 0.9% speed-up overall, and a
26684 5.3% speed-up for regexp.
26685
26686 * JavaScriptCore.exp: Updated for new entry points.
26687
26688 * JavaScriptCore.pri:
26689 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
26690 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
26691 * JavaScriptCore.xcodeproj/project.pbxproj:
26692 * JavaScriptCoreSources.bkl:
26693 * jscore.bkl:
26694 Updated for new source file names and ForwardingHeaders.
26695
26696 * kjs/regexp.cpp:
26697 (KJS::RegExp::RegExp): Changed to use the error message without calling
26698 strdup on it and to pass the new types and options.
26699 (KJS::RegExp::~RegExp): Removed the now-unneeded free of the error message.
26700 (KJS::RegExp::match): Pass the new types and options.
26701 * kjs/regexp.h: Update type of m_constructionError.
26702
26703 * pcre/AUTHORS: Update to reflect the status of the project -- we don't include
26704 the Google parts, and this isn't the PCRE library, per se.
26705 * pcre/COPYING: Ditto.
26706
26707 * pcre/dftables.cpp: Copied from JavaScriptCore/pcre/dftables.c.
26708 (main): Removed unneeded ctype_digit.
26709
26710 * pcre/pcre.h: Convert to C++, tweak API a bit. Use UChar instead of JSRegExpChar.
26711
26712 * pcre/pcre_compile.cpp: Copied from JavaScriptCore/pcre/pcre_compile.c.
26713 Moved a lot of private stuff used only within this file here from pcre_internal.h.
26714 Renumbered the error codes.
26715 (error_text): Use a single string with embedded nulls for the error text (I got
26716 this idea from newer versions of PCRE).
26717 (check_escape): Changed return type to be enum instead of int. Replaced ctype_digit
26718 uses with isASCIIDigit.
26719 (is_counted_repeat): Ditto.
26720 (read_repeat_counts): Ditto.
26721 (first_significant_code): Ditto.
26722 (find_fixedlength): Ditto.
26723 (could_be_empty_branch): Ditto.
26724 (compile_branch): Ditto. Also removed some code that handles changing options.
26725 JavaScript doesn't have any of the features that allow options to change.
26726 (compile_regex): Updated for change to options parameter.
26727 (is_anchored): Ditto.
26728 (find_firstassertedchar): Ditto.
26729 (jsRegExpCompile): Changed to take separate flags instead of an options int.
26730 Also changed to call new/delete instead of pcre_malloc/free.
26731 (jsRegExpFree): Ditto.
26732
26733 * pcre/pcre_exec.cpp: Copied from JavaScriptCore/pcre/pcre_exec.c.
26734 Added a case that uses computed goto for the opcode loop, but did not turn it on.
26735 Changed the RMATCH macro to handle returns more efficiently by putting the where
26736 pointer in the new frame instead of the old one, allowing us to branch to the
26737 return with a single statement. Switched to new/delete from pcre_malloc/free.
26738 Changed many RRETURN callers to not set the return value since it's already
26739 set correctly. Replaced the rrc variable with an is_match variable. Values other
26740 than "match" and "no match" are now handled differently. This allows us to remove
26741 the code to check for those cases in various rules.
26742 (match): All the case statements use a macro BEGIN_OPCODE instead. And all the
26743 continue statements, or break statements that break out of the outer case use
26744 a macro NEXT_OPCODE instead. Replaced a few if statements with assertions.
26745 (jsRegExpExecute): Use new/delete instead of pcre_malloc/free. Removed unused
26746 start_match field from the match block.
26747
26748 * pcre/pcre_internal.h: Moved the last few configuration macros from pcre-config.h
26749 in here. Removed various unused types. Converted from JSRegExpChar to UChar.
26750 Eliminated pcre_malloc/free. Replaced the opcode enum with a macro that can be
26751 used in multiple places. Unfortunately we lose the comments for each opcode; we
26752 should find a place to put those back. Removed ctype_digit.
26753
26754 * pcre/pcre_maketables.cpp: Copied from JavaScriptCore/pcre/pcre_maketables.c.
26755 (pcre_maketables): Got rid of the conditional code that allows this to be compiled
26756 in -- it's only used for dftables now (and soon may be obsolete entirely).
26757 Changed code for cbit_digit to not use isdigit, and took the "_" case out of the
26758 loop. Removed ctype_digit.
26759
26760 * pcre/pcre_ord2utf8.cpp: Copied from JavaScriptCore/pcre/pcre_ord2utf8.c.
26761
26762 * pcre/pcre_tables.cpp: Copied from JavaScriptCore/pcre/pcre_tables.c.
26763 Moved _pcre_OP_lengths out of here into pcre_exec.cpp.
26764
26765 * pcre/pcre_ucp_searchfuncs.cpp: Copied from JavaScriptCore/pcre/pcre_ucp_searchfuncs.c.
26766 Updated for other file name changes.
26767
26768 * pcre/pcre_xclass.cpp: Copied from JavaScriptCore/pcre/pcre_xclass.c.
26769
26770 * pcre/ucpinternal.h: Updated header.
26771
26772 * pcre/ucptable.cpp: Copied from JavaScriptCore/pcre/ucptable.c.
26773
26774 * wtf/ASCIICType.h: (WTF::isASCIIDigit): Removed a branch by changing from && to
26775 & for this operation. Also added an overload that takes an int because that's
26776 useful for PCRE. Later we could optimize for int and overload other functions in
26777 this file; stuck to this simple one for now.
26778
26779 * wtf/unicode/icu/UnicodeIcu.h: Removed unused isUpper.
26780 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
26781
26782 * pcre/LICENCE: Removed.
26783 * pcre/pcre-config.h: Removed.
26784 * wtf/FastMallocPCRE.cpp: Removed.
26785
26786 * pcre/dftables.c: Renamed to cpp.
26787 * pcre/pcre_compile.c: Ditto.
26788 * pcre/pcre_exec.c: Ditto.
26789 * pcre/pcre_maketables.c: Ditto.
26790 * pcre/pcre_ord2utf8.c: Ditto.
26791 * pcre/pcre_tables.c: Ditto.
26792 * pcre/pcre_ucp_searchfuncs.c: Ditto.
26793 * pcre/pcre_xclass.c: Ditto.
26794 * pcre/ucptable.c: Ditto.
26795
26796 2007-11-11 Eric Seidel <eric@webkit.org>
26797
26798 Reviewed by Oliver.
26799
26800 Add KJS_CHECKEXCEPTIONBOOLEAN to match rest of nodes.cpp
26801
26802 * kjs/nodes.cpp:
26803 (KJS::ExpressionNode::evaluateToBoolean):
26804 (KJS::LessNode::evaluateToBoolean):
26805 (KJS::GreaterNode::evaluateToBoolean):
26806 (KJS::LessEqNode::evaluateToBoolean):
26807 (KJS::GreaterEqNode::evaluateToBoolean):
26808 (KJS::InstanceOfNode::evaluateToBoolean):
26809 (KJS::InNode::evaluateToBoolean):
26810 (KJS::EqualNode::evaluateToBoolean):
26811 (KJS::NotEqualNode::evaluateToBoolean):
26812 (KJS::StrictEqualNode::evaluateToBoolean):
26813 (KJS::NotStrictEqualNode::evaluateToBoolean):
26814 (KJS::LogicalAndNode::evaluateToBoolean):
26815 (KJS::LogicalOrNode::evaluateToBoolean):
26816 (KJS::ConditionalNode::evaluateToBoolean):
26817
26818 2007-11-10 Darin Adler <darin@apple.com>
26819
26820 Reviewed by Sam.
26821
26822 - fix http://bugs.webkit.org/show_bug.cgi?id=15927
26823 REGRESSION(r27487): delete a.c followed by __defineGetter__("c", ...) incorrectly deletes another property
26824 and <rdar://problem/5586384> REGRESSION (r27487): Can't switch out of Edit HTML Source mode on Leopard Wiki
26825
26826 Test: fast/js/delete-then-put.html
26827
26828 * kjs/property_map.cpp:
26829 (KJS::PropertyMap::put): Added a missing "- 1"; code to find an empty slot was not working.
26830 (KJS::PropertyMap::checkConsistency): Added a missing range check that would have caught this
26831 problem before.
26832
26833 - roll out a last-minute change to my evaluateToBoolean patch that was incorrect.
26834
26835 * kjs/nodes.h: (KJS::ExprStatementNode::ExprStatementNode): Take out call to
26836 optimizeForUnnecessaryResult, since the result is used in some cases.
26837
26838 2007-11-10 Adam Roben <aroben@apple.com>
26839
26840 Windows build fix
26841
26842 Roll out some changes that were (seemingly accidentally) checked in
26843 with r27664.
26844
26845 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
26846
26847 2007-11-10 Darin Adler <darin@apple.com>
26848
26849 Reviewed by Sam.
26850
26851 - http://bugs.webkit.org/show_bug.cgi?id=15915
26852 add an evaluation path for booleans like the one we have for numbers
26853
26854 Gives 1.1% on SunSpider.
26855
26856 * kjs/grammar.y: Create TrueNode and FalseNode instead of BooleanNode.
26857
26858 * kjs/nodes.h: Changed to use Noncopyable. Moved optimizeForUnnecessaryResult
26859 down from Node to ExpressionNode. Changed some classes to not inherit from
26860 ExpressionNode where not necessary, and removed unnneeded evaluate functions
26861 as well as evaluate functions that need not be virtual. Call the
26862 optimizeForUnnecessaryResult function on the start of a for loop too.
26863 * kjs/nodes.cpp:
26864 (KJS::ExpressionNode::evaluateToBoolean): Added.
26865 (KJS::FalseNode::evaluate): Added.
26866 (KJS::TrueNode::evaluate): Added.
26867 (KJS::NumberNode::evaluateToBoolean): Added.
26868 (KJS::StringNode::evaluateToBoolean): Added.
26869 (KJS::LocalVarAccessNode::evaluateToBoolean): Added.
26870 (KJS::BracketAccessorNode::evaluateToBoolean): Added.
26871 (KJS::LogicalNotNode::evaluate): Changed to call evaluateToBoolean.
26872 (KJS::LogicalNotNode::evaluateToBoolean): Added.
26873 (KJS::lessThan): Changed to return bool.
26874 (KJS::lessThanEq): Ditto.
26875 (KJS::LessNode::evaluate): Changed since lessThan returns bool.
26876 (KJS::LessNode::evaluateToBoolean): Added.
26877 (KJS::GreaterNode::evaluate): Changed since lessThanEq returns bool.
26878 (KJS::GreaterNode::evaluateToBoolean): Added.
26879 (KJS::LessEqNode::evaluate): Changed since lessThanEq returns bool.
26880 (KJS::LessEqNode::evaluateToBoolean): Added.
26881 (KJS::GreaterEqNode::evaluate): Changed since lessThan returns bool.
26882 (KJS::GreaterEqNode::evaluateToBoolean): Added.
26883 (KJS::InstanceOfNode::evaluateToBoolean): Added.
26884 (KJS::InNode::evaluateToBoolean): Added.
26885 (KJS::EqualNode::evaluateToBoolean): Added.
26886 (KJS::NotEqualNode::evaluateToBoolean): Added.
26887 (KJS::StrictEqualNode::evaluateToBoolean): Added.
26888 (KJS::NotStrictEqualNode::evaluateToBoolean): Added.
26889 (KJS::ConditionalNode::evaluate): Changed to call evaluateToBoolean.
26890 (KJS::IfNode::execute): Ditto.
26891 (KJS::DoWhileNode::execute): Ditto.
26892 (KJS::WhileNode::execute): Ditto.
26893 (KJS::ForNode::execute): Ditto.
26894
26895 * kjs/nodes2string.cpp:
26896 (KJS::FalseNode::streamTo): Added.
26897 (KJS::TrueNode::streamTo): Added.
26898
26899 2007-11-09 Adam Roben <aroben@apple.com>
26900
26901 Windows build fix
26902
26903 Reviewed by Darin.
26904
26905 * kjs/value.h:
26906 (KJS::jsNumber): Add some explicit casts.
26907
26908 2007-11-08 Darin Adler <darin@apple.com>
26909
26910 - fix build
26911
26912 * kjs/grammar.y:
26913 * kjs/nodes.h:
26914 * kjs/property_map.cpp:
26915
26916 2007-11-08 Darin Adler <darin@apple.com>
26917
26918 - roll out accidentally-checked in changes
26919
26920 * kjs/nodes.cpp: Back to previous version.
26921 * kjs/nodes.h: Ditto.
26922 * kjs/grammar.y: Ditto.
26923
26924 2007-11-08 Darin Adler <darin@apple.com>
26925
26926 Reviewed by Maciej.
26927
26928 - http://bugs.webkit.org/show_bug.cgi?id=15912
26929 fasta spends a lot of time in qsort
26930
26931 * kjs/property_map.cpp:
26932 (KJS::PropertyMap::getEnumerablePropertyNames):
26933 Use insertion sort instead of qsort for small sets of property names.
26934 We can probably do some even-better speedups of for/in, but this nets
26935 0.6% overall and 6.7% on fasta.
26936
26937 2007-11-08 Darin Adler <darin@apple.com>
26938
26939 Reviewed by Maciej.
26940
26941 - http://bugs.webkit.org/show_bug.cgi?id=15906
26942 getting characters by indexing into a string is very slow
26943
26944 This fixes one source of the slowness -- the conversion to an unused
26945 Identifier as we call the get function from the slot -- but doesn't
26946 fix others, such as the fact that we have to allocate a new UString::Rep
26947 for every single character.
26948
26949 Speeds up string-base64 30%, and at least 0.5% overall.
26950 But does slow down access-fannkuch quite a bit. Might be worth
26951 revisiting in the future to see what we can do about that (although
26952 I did look at a profile for a while).
26953
26954 * kjs/property_slot.h: Add a new marker for "numeric" property slots;
26955 slots where we don't need to pass the identifier to the get function.
26956 (KJS::PropertySlot::getValue): Added code to call the numeric get function.
26957 (KJS::PropertySlot::setCustomNumeric): Added.
26958 * kjs/string_object.cpp:
26959 (KJS::StringInstance::indexGetter): Changed to use substr() instead
26960 of constructing a wholly new UString each time.
26961 (KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but
26962 takes advantage of setCustomNumeric to avoid creating an Identifier.
26963 (KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric.
26964
26965 2007-11-08 Darin Adler <darin@apple.com>
26966
26967 Reviewed by Oliver.
26968
26969 - http://bugs.webkit.org/show_bug.cgi?id=15904
26970 more speed-ups possible by tightening up int version of JSImmediate
26971
26972 1% improvement of SunSpider
26973
26974 * kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template.
26975 (KJS::JSImmediate::from): Overload for most numeric types; many types can
26976 do fewer branches and checks.
26977 (KJS::JSImmediate::getUInt32): Removed unneeded check for undefined.
26978 (KJS::JSImmediate::getTruncatedInt32): Ditto.
26979 (KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more
26980 between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later.
26981
26982 * kjs/grammar.y: Update since fromDouble is now just from.
26983 * kjs/nodes.h: Ditto.
26984
26985 * kjs/value.h: (KJS::jsNumber): Overload for most numeric types.
26986
26987 2007-11-08 Kevin Ollivier <kevino@theolliviers.com>
26988
26989 Bakefiles for building JavaScriptCore, needed by wx port.
26990
26991 Reviewed by Mark Rowe.
26992
26993 * JavaScriptCoreSources.bkl: Added.
26994 * jscore.bkl: Added.
26995
26996 2007-11-08 Oliver Hunt <oliver@apple.com>
26997
26998 Reviewed by Maciej.
26999
27000 Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
27001
27002 The implementation of JSImmediate::areBothImmediateNumbers relies on
27003 (JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having
27004 a unique result when both immediate values are numbers.
27005
27006 The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
27007 By swapping the value of NumberType and UndefinedType this ceases to be a problem.
27008
27009 * kjs/JSType.h:
27010
27011 2007-11-08 Darin Adler <darin@apple.com>
27012
27013 - fix build
27014
27015 * kjs/nodes.h: Add missing parameter name.
27016
27017 2007-11-08 Eric Seidel <eric@webkit.org>
27018
27019 Reviewed by darin.
27020
27021 Add ExpressionNode subclass of Node, use it.
27022
27023 * kjs/grammar.y:
27024 * kjs/nodes.cpp:
27025 (KJS::ForInNode::ForInNode):
27026 * kjs/nodes.h:
27027 (KJS::ExpressionNode::):
27028 (KJS::NullNode::):
27029 (KJS::NullNode::precedence):
27030 (KJS::BooleanNode::):
27031 (KJS::BooleanNode::precedence):
27032 (KJS::RegExpNode::):
27033 (KJS::RegExpNode::precedence):
27034 (KJS::ThisNode::):
27035 (KJS::ThisNode::precedence):
27036 (KJS::ResolveNode::):
27037 (KJS::ElementNode::):
27038 (KJS::ArrayNode::):
27039 (KJS::PropertyNode::):
27040 (KJS::PropertyNode::precedence):
27041 (KJS::PropertyNode::name):
27042 (KJS::PropertyListNode::):
27043 (KJS::ObjectLiteralNode::):
27044 (KJS::ObjectLiteralNode::precedence):
27045 (KJS::BracketAccessorNode::):
27046 (KJS::DotAccessorNode::):
27047 (KJS::DotAccessorNode::precedence):
27048 (KJS::ArgumentListNode::):
27049 (KJS::ArgumentsNode::):
27050 (KJS::NewExprNode::):
27051 (KJS::NewExprNode::precedence):
27052 (KJS::FunctionCallValueNode::):
27053 (KJS::FunctionCallValueNode::precedence):
27054 (KJS::FunctionCallResolveNode::):
27055 (KJS::FunctionCallBracketNode::):
27056 (KJS::FunctionCallBracketNode::precedence):
27057 (KJS::FunctionCallDotNode::):
27058 (KJS::FunctionCallDotNode::precedence):
27059 (KJS::PrePostResolveNode::):
27060 (KJS::PostfixBracketNode::):
27061 (KJS::PostfixBracketNode::precedence):
27062 (KJS::PostIncBracketNode::):
27063 (KJS::PostIncBracketNode::isIncrement):
27064 (KJS::PostDecBracketNode::):
27065 (KJS::PostDecBracketNode::isIncrement):
27066 (KJS::PostfixDotNode::):
27067 (KJS::PostfixDotNode::precedence):
27068 (KJS::PostIncDotNode::):
27069 (KJS::PostIncDotNode::isIncrement):
27070 (KJS::PostDecDotNode::):
27071 (KJS::PostDecDotNode::isIncrement):
27072 (KJS::PostfixErrorNode::):
27073 (KJS::PostfixErrorNode::precedence):
27074 (KJS::DeleteResolveNode::):
27075 (KJS::DeleteBracketNode::):
27076 (KJS::DeleteBracketNode::precedence):
27077 (KJS::DeleteDotNode::):
27078 (KJS::DeleteDotNode::precedence):
27079 (KJS::DeleteValueNode::):
27080 (KJS::DeleteValueNode::precedence):
27081 (KJS::VoidNode::):
27082 (KJS::VoidNode::precedence):
27083 (KJS::TypeOfResolveNode::):
27084 (KJS::TypeOfValueNode::):
27085 (KJS::PrefixBracketNode::):
27086 (KJS::PrefixBracketNode::precedence):
27087 (KJS::PreIncBracketNode::):
27088 (KJS::PreIncBracketNode::isIncrement):
27089 (KJS::PreDecBracketNode::):
27090 (KJS::PreDecBracketNode::isIncrement):
27091 (KJS::PrefixDotNode::):
27092 (KJS::PrefixDotNode::precedence):
27093 (KJS::PreIncDotNode::):
27094 (KJS::PreIncDotNode::isIncrement):
27095 (KJS::PreDecDotNode::):
27096 (KJS::PreDecDotNode::isIncrement):
27097 (KJS::PrefixErrorNode::):
27098 (KJS::PrefixErrorNode::precedence):
27099 (KJS::UnaryPlusNode::):
27100 (KJS::UnaryPlusNode::precedence):
27101 (KJS::NegateNode::):
27102 (KJS::NegateNode::precedence):
27103 (KJS::BitwiseNotNode::):
27104 (KJS::BitwiseNotNode::precedence):
27105 (KJS::LogicalNotNode::):
27106 (KJS::LogicalNotNode::precedence):
27107 (KJS::AddNode::):
27108 (KJS::AddNode::precedence):
27109 (KJS::LeftShiftNode::):
27110 (KJS::LeftShiftNode::precedence):
27111 (KJS::RightShiftNode::):
27112 (KJS::RightShiftNode::precedence):
27113 (KJS::UnsignedRightShiftNode::):
27114 (KJS::UnsignedRightShiftNode::precedence):
27115 (KJS::LessNode::):
27116 (KJS::LessNode::precedence):
27117 (KJS::GreaterNode::):
27118 (KJS::GreaterNode::precedence):
27119 (KJS::LessEqNode::):
27120 (KJS::LessEqNode::precedence):
27121 (KJS::GreaterEqNode::):
27122 (KJS::GreaterEqNode::precedence):
27123 (KJS::InstanceOfNode::):
27124 (KJS::InstanceOfNode::precedence):
27125 (KJS::InNode::):
27126 (KJS::InNode::precedence):
27127 (KJS::EqualNode::):
27128 (KJS::EqualNode::precedence):
27129 (KJS::NotEqualNode::):
27130 (KJS::NotEqualNode::precedence):
27131 (KJS::StrictEqualNode::):
27132 (KJS::StrictEqualNode::precedence):
27133 (KJS::NotStrictEqualNode::):
27134 (KJS::NotStrictEqualNode::precedence):
27135 (KJS::BitAndNode::):
27136 (KJS::BitAndNode::precedence):
27137 (KJS::BitOrNode::):
27138 (KJS::BitOrNode::precedence):
27139 (KJS::BitXOrNode::):
27140 (KJS::BitXOrNode::precedence):
27141 (KJS::LogicalAndNode::):
27142 (KJS::LogicalAndNode::precedence):
27143 (KJS::LogicalOrNode::):
27144 (KJS::LogicalOrNode::precedence):
27145 (KJS::ConditionalNode::):
27146 (KJS::ConditionalNode::precedence):
27147 (KJS::ReadModifyResolveNode::):
27148 (KJS::ReadModifyResolveNode::precedence):
27149 (KJS::AssignResolveNode::):
27150 (KJS::AssignResolveNode::precedence):
27151 (KJS::ReadModifyBracketNode::):
27152 (KJS::ReadModifyBracketNode::precedence):
27153 (KJS::AssignBracketNode::):
27154 (KJS::AssignBracketNode::precedence):
27155 (KJS::AssignDotNode::):
27156 (KJS::AssignDotNode::precedence):
27157 (KJS::ReadModifyDotNode::):
27158 (KJS::ReadModifyDotNode::precedence):
27159 (KJS::AssignErrorNode::):
27160 (KJS::AssignErrorNode::precedence):
27161 (KJS::CommaNode::):
27162 (KJS::CommaNode::precedence):
27163 (KJS::AssignExprNode::):
27164 (KJS::AssignExprNode::precedence):
27165 (KJS::ExprStatementNode::):
27166 (KJS::IfNode::):
27167 (KJS::DoWhileNode::):
27168 (KJS::WhileNode::):
27169 (KJS::ReturnNode::):
27170 (KJS::WithNode::):
27171 (KJS::ThrowNode::):
27172 (KJS::ParameterNode::):
27173 (KJS::CaseClauseNode::):
27174 (KJS::CaseClauseNode::precedence):
27175 (KJS::ClauseListNode::):
27176 (KJS::SwitchNode::):
27177
27178 2007-11-08 Oliver Hunt <oliver@apple.com>
27179
27180 Reviewed by Sam.
27181
27182 Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
27183
27184 This only improves bitwise-and performance, as the additional logic required
27185 for similar code paths on or, xor, and shifting requires additional operations
27186 and branches that negate (and in certain cases, regress) any advantage we might
27187 otherwise receive.
27188
27189 This improves performance on all bitop tests, the cryptography tests, as well as
27190 the string-base64 and string-unpack-code tests. No significant degradation on
27191 any other tests.
27192
27193 * kjs/JSImmediate.h:
27194 (KJS::JSImmediate::areBothImmediateNumbers):
27195 (KJS::JSImmediate::andImmediateNumbers):
27196 * kjs/nodes.cpp:
27197 (KJS::BitAndNode::evaluate):
27198 * kjs/value.h:
27199 (KJS::jsNumberFromAnd):
27200
27201 2007-11-08 Adam Roben <aroben@apple.com>
27202
27203 Stop using KJS inside of MathExtras.h
27204
27205 Reviewed by Darin.
27206
27207 * wtf/MathExtras.h: Removed an unused header, and a now-unused
27208 forward-declaration.
27209 (wtf_atan2): Use std::numeric_limits intead of KJS.
27210
27211 2007-11-08 Sam Weinig <sam@webkit.org>
27212
27213 Windows build fix.
27214
27215 * kjs/date_object.cpp:
27216 (KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
27217 (KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
27218 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
27219
27220 2007-11-08 Mark Rowe <mrowe@apple.com>
27221
27222 Gtk build fix.
27223
27224 * kjs/lookup.h: Add missing include.
27225
27226 2007-11-08 Sam Weinig <sam@webkit.org>
27227
27228 Reviewed by Darin.
27229
27230 Convert JavaScript internal function objects to use one class per
27231 function. This avoids a switch statement inside what used to be
27232 the shared function classes and will allow Shark to better analyze
27233 the code.
27234
27235 To make this switch, the value property of the HashEntry was changed
27236 to a union of an intptr_t (which is used to continue handle valueGetters)
27237 and function pointer which points to a static constructor for the
27238 individual new function objects.
27239
27240 SunSpider claims this is a 1.0% speedup.
27241
27242 * kjs/array_object.cpp:
27243 (KJS::ArrayPrototype::getOwnPropertySlot):
27244 (KJS::getProperty):
27245 (KJS::ArrayProtoFuncToString::callAsFunction):
27246 (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
27247 (KJS::ArrayProtoFuncJoin::callAsFunction):
27248 (KJS::ArrayProtoFuncConcat::callAsFunction):
27249 (KJS::ArrayProtoFuncPop::callAsFunction):
27250 (KJS::ArrayProtoFuncPush::callAsFunction):
27251 (KJS::ArrayProtoFuncReverse::callAsFunction):
27252 (KJS::ArrayProtoFuncShift::callAsFunction):
27253 (KJS::ArrayProtoFuncSlice::callAsFunction):
27254 (KJS::ArrayProtoFuncSort::callAsFunction):
27255 (KJS::ArrayProtoFuncSplice::callAsFunction):
27256 (KJS::ArrayProtoFuncUnShift::callAsFunction):
27257 (KJS::ArrayProtoFuncFilter::callAsFunction):
27258 (KJS::ArrayProtoFuncMap::callAsFunction):
27259 (KJS::ArrayProtoFuncEvery::callAsFunction):
27260 (KJS::ArrayProtoFuncForEach::callAsFunction):
27261 (KJS::ArrayProtoFuncSome::callAsFunction):
27262 (KJS::ArrayProtoFuncIndexOf::callAsFunction):
27263 (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
27264 * kjs/array_object.h:
27265 (KJS::ArrayPrototype::classInfo):
27266 * kjs/create_hash_table:
27267 * kjs/date_object.cpp:
27268 (KJS::DatePrototype::getOwnPropertySlot):
27269 (KJS::DateProtoFuncToString::callAsFunction):
27270 (KJS::DateProtoFuncToUTCString::callAsFunction):
27271 (KJS::DateProtoFuncToDateString::callAsFunction):
27272 (KJS::DateProtoFuncToTimeString::callAsFunction):
27273 (KJS::DateProtoFuncToLocaleString::callAsFunction):
27274 (KJS::DateProtoFuncToLocaleDateString::callAsFunction):
27275 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
27276 (KJS::DateProtoFuncValueOf::callAsFunction):
27277 (KJS::DateProtoFuncGetTime::callAsFunction):
27278 (KJS::DateProtoFuncGetFullYear::callAsFunction):
27279 (KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
27280 (KJS::DateProtoFuncToGMTString::callAsFunction):
27281 (KJS::DateProtoFuncGetMonth::callAsFunction):
27282 (KJS::DateProtoFuncGetUTCMonth::callAsFunction):
27283 (KJS::DateProtoFuncGetDate::callAsFunction):
27284 (KJS::DateProtoFuncGetUTCDate::callAsFunction):
27285 (KJS::DateProtoFuncGetDay::callAsFunction):
27286 (KJS::DateProtoFuncGetUTCDay::callAsFunction):
27287 (KJS::DateProtoFuncGetHours::callAsFunction):
27288 (KJS::DateProtoFuncGetUTCHours::callAsFunction):
27289 (KJS::DateProtoFuncGetMinutes::callAsFunction):
27290 (KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
27291 (KJS::DateProtoFuncGetSeconds::callAsFunction):
27292 (KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
27293 (KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
27294 (KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
27295 (KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
27296 (KJS::DateProtoFuncSetTime::callAsFunction):
27297 (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
27298 (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
27299 (KJS::DateProtoFuncSetSeconds::callAsFunction):
27300 (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
27301 (KJS::DateProtoFuncSetMinutes::callAsFunction):
27302 (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
27303 (KJS::DateProtoFuncSetHours::callAsFunction):
27304 (KJS::DateProtoFuncSetUTCHours::callAsFunction):
27305 (KJS::DateProtoFuncSetDate::callAsFunction):
27306 (KJS::DateProtoFuncSetUTCDate::callAsFunction):
27307 (KJS::DateProtoFuncSetMonth::callAsFunction):
27308 (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
27309 (KJS::DateProtoFuncSetFullYear::callAsFunction):
27310 (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
27311 (KJS::DateProtoFuncSetYear::callAsFunction):
27312 (KJS::DateProtoFuncGetYear::callAsFunction):
27313 * kjs/date_object.h:
27314 * kjs/lookup.cpp:
27315 (KJS::Lookup::find):
27316 * kjs/lookup.h:
27317 (KJS::HashEntry::):
27318 (KJS::staticFunctionGetter):
27319 (KJS::staticValueGetter):
27320 (KJS::getStaticPropertySlot):
27321 (KJS::getStaticFunctionSlot):
27322 (KJS::lookupPut):
27323 * kjs/math_object.cpp:
27324 (KJS::MathObjectImp::getOwnPropertySlot):
27325 (KJS::MathProtoFuncAbs::callAsFunction):
27326 (KJS::MathProtoFuncACos::callAsFunction):
27327 (KJS::MathProtoFuncASin::callAsFunction):
27328 (KJS::MathProtoFuncATan::callAsFunction):
27329 (KJS::MathProtoFuncATan2::callAsFunction):
27330 (KJS::MathProtoFuncCeil::callAsFunction):
27331 (KJS::MathProtoFuncCos::callAsFunction):
27332 (KJS::MathProtoFuncExp::callAsFunction):
27333 (KJS::MathProtoFuncFloor::callAsFunction):
27334 (KJS::MathProtoFuncLog::callAsFunction):
27335 (KJS::MathProtoFuncMax::callAsFunction):
27336 (KJS::MathProtoFuncMin::callAsFunction):
27337 (KJS::MathProtoFuncPow::callAsFunction):
27338 (KJS::MathProtoFuncRandom::callAsFunction):
27339 (KJS::MathProtoFuncRound::callAsFunction):
27340 (KJS::MathProtoFuncSin::callAsFunction):
27341 (KJS::MathProtoFuncSqrt::callAsFunction):
27342 (KJS::MathProtoFuncTan::callAsFunction):
27343 * kjs/math_object.h:
27344 (KJS::MathObjectImp::classInfo):
27345 (KJS::MathObjectImp::):
27346 * kjs/string_object.cpp:
27347 (KJS::StringPrototype::getOwnPropertySlot):
27348 (KJS::StringProtoFuncToString::callAsFunction):
27349 (KJS::StringProtoFuncValueOf::callAsFunction):
27350 (KJS::StringProtoFuncCharAt::callAsFunction):
27351 (KJS::StringProtoFuncCharCodeAt::callAsFunction):
27352 (KJS::StringProtoFuncConcat::callAsFunction):
27353 (KJS::StringProtoFuncIndexOf::callAsFunction):
27354 (KJS::StringProtoFuncLastIndexOf::callAsFunction):
27355 (KJS::StringProtoFuncMatch::callAsFunction):
27356 (KJS::StringProtoFuncSearch::callAsFunction):
27357 (KJS::StringProtoFuncReplace::callAsFunction):
27358 (KJS::StringProtoFuncSlice::callAsFunction):
27359 (KJS::StringProtoFuncSplit::callAsFunction):
27360 (KJS::StringProtoFuncSubstr::callAsFunction):
27361 (KJS::StringProtoFuncSubstring::callAsFunction):
27362 (KJS::StringProtoFuncToLowerCase::callAsFunction):
27363 (KJS::StringProtoFuncToUpperCase::callAsFunction):
27364 (KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
27365 (KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
27366 (KJS::StringProtoFuncLocaleCompare::callAsFunction):
27367 (KJS::StringProtoFuncBig::callAsFunction):
27368 (KJS::StringProtoFuncSmall::callAsFunction):
27369 (KJS::StringProtoFuncBlink::callAsFunction):
27370 (KJS::StringProtoFuncBold::callAsFunction):
27371 (KJS::StringProtoFuncFixed::callAsFunction):
27372 (KJS::StringProtoFuncItalics::callAsFunction):
27373 (KJS::StringProtoFuncStrike::callAsFunction):
27374 (KJS::StringProtoFuncSub::callAsFunction):
27375 (KJS::StringProtoFuncSup::callAsFunction):
27376 (KJS::StringProtoFuncFontcolor::callAsFunction):
27377 (KJS::StringProtoFuncFontsize::callAsFunction):
27378 (KJS::StringProtoFuncAnchor::callAsFunction):
27379 (KJS::StringProtoFuncLink::callAsFunction):
27380 * kjs/string_object.h:
27381
27382 2007-11-08 Adam Roben <aroben@apple.com>
27383
27384 Windows build fix
27385
27386 Reviewed by Sam and Ada.
27387
27388 * wtf/MathExtras.h: Get rid of a circular #include dependency to fix
27389 the build.
27390
27391 2007-11-08 Adam Roben <aroben@apple.com>
27392
27393 Fix a precedence warning on Windows
27394
27395 * kjs/JSImmediate.h:
27396 (KJS::JSImmediate::toBoolean):
27397
27398 2007-11-08 Mark Rowe <mrowe@apple.com>
27399
27400 Build fix for JavaScriptGlue.
27401
27402 * wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
27403
27404 2007-11-08 Darin Adler <darin@apple.com>
27405
27406 - Windows build fix
27407
27408 * kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
27409
27410 2007-11-08 Oliver Hunt <oliver@apple.com>
27411
27412 Reviewed by Darin.
27413
27414 Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
27415
27416 Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
27417 we should now have faster array access, faster immediate to double conversion, and the
27418 potential to further improve bitwise operators in future.
27419
27420 This also removes the need for unions to avoid strict aliasing problems when extracting
27421 a value from immediates.
27422
27423 * kjs/JSImmediate.h:
27424 (KJS::JSImmediate::trueImmediate):
27425 (KJS::JSImmediate::falseImmediate):
27426 (KJS::JSImmediate::undefinedImmediate):
27427 (KJS::JSImmediate::nullImmediate):
27428 (KJS::JSImmediate::toBoolean):
27429 * kjs/value.h:
27430 (KJS::jsNaN):
27431
27432 2007-11-07 Eric Seidel <eric@webkit.org>
27433
27434 Reviewed by Darin and Oliver.
27435
27436 Add evaluateToNumber parallel evaluation tree to speed up number operations.
27437 Make ImmediateNumberNode a subclass of NumberNode.
27438 Share evaluate logic between evaluate and evaluateToNumber using inline functions
27439 There is still a lot of improvement to be made here.
27440
27441 SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
27442 Given the huge win that this prepares us for with simple type inferencing I see the small
27443 regression in base64 being worth the substantial overall improvement.
27444
27445 * kjs/grammar.y:
27446 * kjs/nodes.cpp:
27447 (KJS::Node::evaluateToNumber):
27448 (KJS::NumberNode::evaluate):
27449 (KJS::NumberNode::evaluateToNumber):
27450 (KJS::StringNode::evaluateToNumber):
27451 (KJS::LocalVarAccessNode::inlineEvaluate):
27452 (KJS::LocalVarAccessNode::evaluate):
27453 (KJS::LocalVarAccessNode::evaluateToNumber):
27454 (KJS::BracketAccessorNode::inlineEvaluate):
27455 (KJS::BracketAccessorNode::evaluate):
27456 (KJS::BracketAccessorNode::evaluateToNumber):
27457 (KJS::NegateNode::evaluate):
27458 (KJS::NegateNode::evaluateToNumber):
27459 (KJS::MultNode::inlineEvaluateToNumber):
27460 (KJS::MultNode::evaluate):
27461 (KJS::MultNode::evaluateToNumber):
27462 (KJS::DivNode::inlineEvaluateToNumber):
27463 (KJS::DivNode::evaluate):
27464 (KJS::DivNode::evaluateToNumber):
27465 (KJS::ModNode::inlineEvaluateToNumber):
27466 (KJS::ModNode::evaluate):
27467 (KJS::ModNode::evaluateToNumber):
27468 (KJS::throwOutOfMemoryErrorToNumber):
27469 (KJS::addSlowCaseToNumber):
27470 (KJS::add):
27471 (KJS::addToNumber):
27472 (KJS::AddNode::evaluateToNumber):
27473 (KJS::SubNode::inlineEvaluateToNumber):
27474 (KJS::SubNode::evaluate):
27475 (KJS::SubNode::evaluateToNumber):
27476 (KJS::valueForReadModifyAssignment):
27477 (KJS::ReadModifyLocalVarNode::evaluate):
27478 (KJS::ReadModifyResolveNode::evaluate):
27479 (KJS::ReadModifyDotNode::evaluate):
27480 (KJS::ReadModifyBracketNode::evaluate):
27481 * kjs/nodes.h:
27482 (KJS::Node::):
27483 (KJS::NumberNode::):
27484 (KJS::ImmediateNumberNode::):
27485 (KJS::AddNode::precedence):
27486 * kjs/nodes2string.cpp:
27487 (KJS::NumberNode::streamTo):
27488
27489 2007-11-07 Mark Rowe <mrowe@apple.com>
27490
27491 Reviewed by Eric.
27492
27493 Fix up initialization after being mangled in r27572, and remove the
27494 ternary expression as extraCost will always be zero for the numeric
27495 heap.
27496
27497 * kjs/collector.cpp:
27498 (KJS::Collector::heapAllocate):
27499
27500 2007-11-07 Mark Rowe <mrowe@apple.com>
27501
27502 Gtk build fix.
27503
27504 * kjs/regexp_object.cpp:
27505
27506 2007-11-07 Geoffrey Garen <ggaren@apple.com>
27507
27508 Reviewed by Beth Dakin.
27509
27510 Eliminated a bogus (though compiled-out) branch in the collector.
27511
27512 * kjs/collector.cpp:
27513 (KJS::Collector::heapAllocate):
27514
27515 2007-11-06 Geoffrey Garen <ggaren@apple.com>
27516
27517 Reviewed by Darin Adler.
27518
27519 Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861
27520 5.8% of string-validate-input.js is spent creating RegExpImps
27521
27522 Put RegExpImp properties into a static hashtable to avoid a slew of
27523 PropertyMap churn when creating a RegExpImp.
27524
27525 Factored important bits of regular expression implementation out of
27526 RegExpImp (the JS object) and into RegExp (the PCRE wrapper class),
27527 making RegExp a ref-counted class. (This will help later.)
27528
27529 Removed PCRE_POSIX support because I didn't quite know how to test it
27530 and keep it working with these changes.
27531
27532 1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
27533
27534 * kjs/regexp.h: A few interface changes:
27535 1. Renamed "subpatterns()" => "numSubpatterns()"
27536 2. Made flag enumeration private and replaced it with public getters for
27537 specific flags.
27538 3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
27539 4. Made RegExp take a string of flags instead of an int, eliminating
27540 duplicated flag parsing code elsewhere.
27541
27542 * kjs/regexp_object.cpp:
27543 (KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile:
27544 - Fixed a bug where compile(undefined) would throw an exception.
27545 - Removed some now-redundant code.
27546 - Used RegExp sharing to eliminate an allocation and a bunch of
27547 PropertyMap thrash. (Not a big win since compile is a deprecated
27548 function. I mainly did this to test the plubming.)
27549
27550 2007-11-07 Simon Hausmann <hausmann@kde.org>
27551
27552 Reviewed by nobody, Qt/Windows build fix.
27553
27554 JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
27555 testkjs.pro, too, where it's included from.
27556
27557 * kjs/testkjs.pro:
27558
27559 2007-11-07 Simon Hausmann <shausman@trolltech.com>
27560
27561 Reviewed by Lars.
27562
27563 Fix "nmake clean" for the Qt/Windows build by replacing tmp/ with a variable that ends with the correct type of slash/backslash depending on the choice of compiler/make tool.
27564
27565 * JavaScriptCore.pri:
27566 * pcre/pcre.pri:
27567
27568 2007-11-07 Lars Knoll <lars@trolltech.com>
27569
27570 Reviewed by Simon.
27571
27572 fix umemcasecmp
27573
27574 Pretty embarrassing bug. Has the potential to fix quite a few test failures.
27575
27576 * wtf/unicode/qt4/UnicodeQt4.h:
27577 (WTF::Unicode::umemcasecmp):
27578
27579 2007-11-06 Maciej Stachowiak <mjs@apple.com>
27580
27581 Reviewed by Eric.
27582
27583 - only collect when the heap is full, unless we have lots of extra cost garbage
27584
27585 1.1% SunSpider speedup.
27586
27587 This shouldn't hit memory use much since the extra space in those
27588 blocks hangs around either way.
27589
27590 * kjs/collector.cpp:
27591 (KJS::Collector::heapAllocate):
27592 (KJS::Collector::collect): Fix logic error that reversed the sense of collect's
27593 return value.
27594
27595 2007-11-06 Oliver Hunt <oliver@apple.com>
27596
27597 Reviewed by Maciej.
27598
27599 Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
27600
27601 We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
27602 'for (...; ...; ++<var>) ...'.
27603
27604 * kjs/nodes.cpp:
27605 (KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
27606 (KJS::PostIncLocalVarNode::evaluate):
27607 (KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
27608 (KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
27609 (KJS::PostDecLocalVarNode::evaluate):
27610 (KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
27611 * kjs/nodes.h:
27612 (KJS::PrePostResolveNode::):
27613 (KJS::PostIncResolveNode::):
27614 (KJS::PostIncLocalVarNode::):
27615 (KJS::PostDecResolveNode::):
27616 (KJS::PostDecLocalVarNode::):
27617 (KJS::PreIncResolveNode::):
27618 (KJS::PreDecResolveNode::):
27619 (KJS::ForNode::ForNode):
27620
27621 2007-11-06 Eric Seidel <eric@webkit.org>
27622
27623 Reviewed by darin.
27624
27625 This fixes a regressed layout test for string + object
27626
27627 SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
27628
27629 * kjs/nodes.cpp:
27630 (KJS::add): remove erroneous "fast path" for string + *
27631
27632 2007-11-06 Geoffrey Garen <ggaren@apple.com>
27633
27634 Reviewed by Eric Seidel.
27635
27636 Added toJSNumber, a fast path for converting a JSValue to a JS number,
27637 and deployed it in postfix expressions. In the fast case this
27638 eliminates a call to jsNumber.
27639
27640 0.4% speedup on SunSpider.
27641
27642 * ChangeLog:
27643 * kjs/nodes.cpp:
27644 (KJS::PostIncResolveNode::evaluate):
27645 (KJS::PostIncLocalVarNode::evaluate):
27646 (KJS::PostDecResolveNode::evaluate):
27647 (KJS::PostDecLocalVarNode::evaluate):
27648 (KJS::PostIncBracketNode::evaluate):
27649 (KJS::PostDecBracketNode::evaluate):
27650 (KJS::PostIncDotNode::evaluate):
27651 (KJS::PostDecDotNode::evaluate):
27652 (KJS::UnaryPlusNode::evaluate):
27653 * kjs/value.h:
27654 (KJS::JSValue::toJSNumber):
27655
27656 2007-11-06 Darin Adler <darin@apple.com>
27657
27658 Reviewed by Maciej.
27659
27660 - http://bugs.webkit.org/show_bug.cgi?id=15846
27661 REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
27662
27663 There was a mistake in the algorithm used to find an empty slot in the property
27664 map entries vector; when we were putting in a new property value and not overwriting
27665 an existing deleted sentinel, we would enlarge the entries vector, but would not
27666 overwrite the stale data that's in the new part. It was easy to pin this down by
27667 turning on property map consistency checks -- I never would have landed with this
27668 bug if I had run the regression tests once with consistency checks on!
27669
27670 * kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
27671 foundDeletedElement is false to always use the item at the end of the entries vector.
27672 Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
27673
27674 2007-11-06 Oliver Hunt <oliver@apple.com>
27675
27676 RS=Darin.
27677
27678 Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
27679
27680 * kjs/nodes.cpp:
27681 (KJS::add):
27682
27683 2007-11-06 Oliver Hunt <oliver@apple.com>
27684
27685 Reviewed by Darin.
27686
27687 Replace boolean comparisons in AddNode with mask
27688 comparisons for a 0.2% improvement in sunspider.
27689
27690 * JavaScriptCore.xcodeproj/project.pbxproj:
27691 * kjs/nodes.cpp:
27692 (KJS::add):
27693
27694 2007-11-06 Eric Seidel <eric@webkit.org>
27695
27696 Reviewed by darin.
27697
27698 SunSpider claims this is a 1.1% speedup.
27699
27700 * kjs/nodes.cpp:
27701 (KJS::throwOutOfMemoryError): Added, non inline.
27702 (KJS::addSlowCase): renamed from add(), non inline.
27703 (KJS::add): add fast path for String + String, Number + Number and String + *
27704
27705 2007-11-06 Eric Seidel <eric@webkit.org>
27706
27707 Reviewed by mjs.
27708
27709 Avoid more UString creation.
27710
27711 SunSpider claims this is a 0.4% speedup.
27712
27713 * kjs/regexp_object.cpp:
27714 (KJS::RegExpObjectImp::construct): use UString::find(UChar)
27715
27716 2007-11-05 Mark Rowe <mrowe@apple.com>
27717
27718 Mac build fix.
27719
27720 * kjs/array_object.cpp:
27721 (KJS::ArrayProtoFunc::callAsFunction):
27722
27723 2007-11-05 Adam Roben <aroben@apple.com>
27724
27725 Windows build fix
27726
27727 * kjs/list.h:
27728
27729 2007-11-05 Mark Rowe <mrowe@apple.com>
27730
27731 Build fix. Add missing #include.
27732
27733 * kjs/operations.cpp:
27734
27735 2007-11-05 Eric Seidel <eric@webkit.org>
27736
27737 Reviewed by mjs.
27738
27739 Remove another call to toString(exec)
27740
27741 SunSpider claims this is a 0.5% speedup.
27742
27743 * kjs/operations.cpp:
27744 (KJS::equal): remove another toString
27745
27746 2007-11-05 Eric Seidel <eric@webkit.org>
27747
27748 * kjs/operations.cpp:
27749 (KJS::equal): correct broken change.
27750
27751 2007-11-05 Eric Seidel <eric@webkit.org>
27752
27753 Reviewed by mjs.
27754
27755 Remove one more call to toString(exec).
27756
27757 SunSpider claims this is a 0.7% speedup.
27758
27759 * kjs/operations.cpp:
27760 (KJS::equal): remove a call to toString()
27761
27762 2007-11-05 Mark Rowe <mrowe@apple.com>
27763
27764 Gtk build fix.
27765
27766 * pcre/pcre.pri:
27767
27768 2007-11-05 Mark Rowe <mrowe@apple.com>
27769
27770 Gtk build fix.
27771
27772 * kjs/list.cpp:
27773
27774 2007-11-05 Geoffrey Garen <ggaren@apple.com>
27775
27776 Touched a file to test my new HTTP access.
27777
27778 * kjs/scope_chain.cpp:
27779
27780 2007-11-05 Alp Toker <alp@atoker.com>
27781
27782 Unreviewed build fix for qmake-based ports.
27783
27784 Someone with a better understanding of qmake still needs to sort out
27785 the INCLUDEPATH/DEPENDPATH mess.
27786
27787 * JavaScriptCore.pri:
27788
27789 2007-11-05 Geoffrey Garen <ggaren@apple.com>
27790
27791 Reviewed by Darin Adler.
27792
27793 http://bugs.webkit.org/show_bug.cgi?id=15835
27794
27795 Switched List implementation from a custom heap allocator to an inline
27796 Vector, for a disappointing .5% SunSpider speedup.
27797
27798 Also renamed List::slice to List::getSlice because "get" is the
27799 conventional prefix for functions returning a value through an out
27800 parameter.
27801
27802 * kjs/array_object.cpp:
27803 (KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
27804 calls and memory accesses.
27805
27806 * kjs/bool_object.cpp:
27807 (BooleanObjectImp::construct): Removed questionable use of iterator.
27808
27809 * kjs/list.cpp:
27810 * kjs/list.h: New List class, implemented in terms of Vector. Two
27811 interesting differences:
27812 1. The inline capacity is 8, not 5. Many of the Lists constructed
27813 during a SunSpider run are larger than 5; almost none are larger
27814 than 8.
27815
27816 2. The growth factor is 4, not 2. Since we can guarantee that Lists
27817 aren't long-lived, we can grow them more aggressively, to avoid
27818 excessive copying.
27819
27820 * kjs/regexp_object.cpp:
27821 (RegExpObjectImp::construct): Removed redundant function calls.
27822
27823 * kjs/string_object.cpp:
27824 (KJS::StringObjectImp::construct): Removed questionable use of iterator.
27825
27826 * wtf/Vector.h:
27827 (WTF::::uncheckedAppend): Added a fast, unchecked version of append.
27828
27829 2007-11-05 Mark Rowe <mrowe@apple.com>
27830
27831 Reviewed by Alp Toker.
27832
27833 Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
27834
27835 * JavaScriptCore.pri:
27836 * pcre/pcre.pri:
27837
27838 2007-11-04 Darin Adler <darin@apple.com>
27839
27840 Reviewed by Maciej.
27841
27842 - http://bugs.webkit.org/show_bug.cgi?id=15826
27843 optimize opcode loop and case insensitive ASCII compares for a 30% speedup
27844
27845 SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
27846
27847 * pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
27848
27849 * pcre/pcre_compile.c:
27850 (find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
27851 added OP_NOT since there was no reason it should not be in here.
27852 (could_be_empty_branch): Ditto.
27853 (compile_branch): Streamlined all the single-character cases; there was a bit of
27854 duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
27855 But in particular, compile to those opcodes when the single character match is
27856 ASCII.
27857 (find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
27858
27859 * pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
27860 the matchframe, after I discovered that none of them needed to be saved and restored
27861 across recursive match calls. Also eliminated the ignored result field from the
27862 matchframe, since I discovered that rrc ("recursive result code") was already the
27863 exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
27864 statement of the switch instead of doing them before the switch. This removes a
27865 branch from each iteration of the opcode interpreter, just as removal of "op"
27866 removed at least one store from each iteration. Last, but not least, add the
27867 OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
27868 surrogate pair and the letter case can be handled efficiently.
27869
27870 2007-11-04 Darin Adler <darin@apple.com>
27871
27872 * pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
27873
27874 2007-11-03 Darin Adler <darin@apple.com>
27875
27876 - fix non-Mac builds; remove some more unused PCRE stuff
27877
27878 * pcre/pcre_compile.c:
27879 (compile_branch): Removed branch chain and some unused ESC values.
27880 (compile_regex): Ditto.
27881 (jsRegExpCompile): Ditto.
27882 * pcre/pcre_exec.c:
27883 (match): Removed unused branch targets. Don't use macros any more.
27884 (jsRegExpExecute): More of the same.
27885
27886 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
27887 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
27888 * pcre/pcre.pri: Ditto.
27889
27890 * pcre/MERGING: Removed.
27891 * pcre/pcre_fullinfo.c: Removed.
27892 * pcre/pcre_get.c: Removed.
27893 * pcre/pcre_internal.h:
27894 * pcre/ucp.h: Removed.
27895
27896 2007-11-03 Darin Adler <darin@apple.com>
27897
27898 Reviewed by Maciej.
27899
27900 - http://bugs.webkit.org/show_bug.cgi?id=15821
27901 remove unused PCRE features for speed
27902
27903 A first step toward removing the PCRE features we don't use.
27904 This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
27905 the SunSpider regular expression test.
27906
27907 Replaced the public interface with one that doesn't use the
27908 name PCRE. Removed code we don't need for JavaScript and various
27909 configurations we don't use. This is in preparation for still
27910 more changes in the future. We'll probably switch to C++ and
27911 make some even more significant changes to the regexp engine
27912 to get some additional speed.
27913
27914 There's probably additional unused stuff that I haven't
27915 deleted yet.
27916
27917 This does mean that our PCRE is now a fork, but I think that's
27918 not really a big deal.
27919
27920 * JavaScriptCore.exp: Remove the 5 old entry points and add
27921 the 3 new entry points for WebCore's direct use of the regular
27922 expression engine.
27923
27924 * kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
27925 its sense and now there's a USE(POSIX_REGEX) instead, which should
27926 probably not be set by anyone. Maybe later we'll just get rid of it
27927 altogether.
27928
27929 * kjs/regexp.h:
27930 * kjs/regexp.cpp:
27931 (KJS::RegExp::RegExp): Switch to new jsRegExp function names and
27932 defines. Cut down on the number of functions used.
27933 (KJS::RegExp::~RegExp): Ditto.
27934 (KJS::RegExp::match): Ditto.
27935
27936 * pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
27937 which are unused.
27938
27939 * pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
27940 size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
27941 POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
27942 and JAVASCRIPT. These are all no longer configurable in our copy
27943 of the library.
27944
27945 * pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
27946 version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
27947 the include of <stdlib.h>, and most of the constants and
27948 functions defined in this header. Changed the naming scheme to
27949 use a JSRegExp prefix rather than a pcre prefix. In the future,
27950 we'll probably change this to be a C++ header.
27951
27952 * pcre/pcre_compile.c: Removed all unused code branches,
27953 including many whole functions and various byte codes.
27954 Kept changes outside of removal to a minimum.
27955 (check_escape):
27956 (first_significant_code):
27957 (find_fixedlength):
27958 (find_recurse):
27959 (could_be_empty_branch):
27960 (compile_branch):
27961 (compile_regex):
27962 (is_anchored):
27963 (is_startline):
27964 (find_firstassertedchar):
27965 (jsRegExpCompile): Renamed from pcre_compile2 and changed the
27966 parameters around a bit.
27967 (jsRegExpFree): Added.
27968
27969 * pcre/pcre_exec.c: Removed many unused opcodes and variables.
27970 Also started tearing down the NO_RECURSE mechanism since it's
27971 now the default. In some cases there were things in the explicit
27972 frame that could be turned into plain old local variables and
27973 other small like optimizations.
27974 (pchars):
27975 (match_ref):
27976 (match): Changed parameters quite a bit since it's now not used
27977 recursively.
27978 (jsRegExpExecute): Renamed from pcre_exec.
27979
27980 * pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
27981 PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
27982 PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
27983 PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
27984 _pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
27985 and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
27986
27987 * pcre/pcre_maketables.c: Changed to only compile in dftables.
27988 Also got rid of many of the tables that we don't use.
27989
27990 * pcre/pcre_tables.c: Removed the unused Unicode property tables.
27991
27992 * pcre/pcre_ucp_searchfuncs.c: Removed everything except for
27993 _pcre_ucp_othercase.
27994
27995 * pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
27996 for classes based on Unicode properties.
27997
27998 * wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
27999 to eliminate this completely, but we need the regular expression
28000 code to be C++ first.
28001
28002 * pcre/pcre_fullinfo.c:
28003 * pcre/pcre_get.c:
28004 * pcre/ucp.h:
28005 Files that are no longer needed. I didn't remove them with this
28006 check-in, because I didn't want to modify all the project files.
28007
28008 2007-11-03 Maciej Stachowiak <mjs@apple.com>
28009
28010 Reviewed by Sam.
28011
28012 - remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
28013
28014 It turns out that doing this check costs more than it saves.
28015
28016 * kjs/JSImmediate.h:
28017 (KJS::JSImmediate::fromDouble):
28018
28019 2007-11-03 Sam Weinig <sam@webkit.org>
28020
28021 Reviewed by Oliver.
28022
28023 Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
28024 The variable had been kept around for binary compatibility, but since nothing
28025 else is there is no point in continuing to keep it around.
28026
28027 * API/JSCallbackConstructor.cpp:
28028 * API/JSCallbackFunction.cpp:
28029 * API/JSCallbackObject.cpp:
28030 * bindings/objc/objc_runtime.mm:
28031 * bindings/runtime_array.cpp:
28032 * bindings/runtime_object.cpp:
28033 * kjs/array_instance.cpp:
28034 * kjs/array_object.cpp:
28035 * kjs/bool_object.cpp:
28036 * kjs/date_object.cpp:
28037 * kjs/error_object.cpp:
28038 * kjs/function.cpp:
28039 * kjs/internal.cpp:
28040 * kjs/lookup.h:
28041 * kjs/math_object.cpp:
28042 * kjs/number_object.cpp:
28043 * kjs/object.h:
28044 * kjs/regexp_object.cpp:
28045 * kjs/string_object.cpp:
28046
28047 2007-11-03 Kevin McCullough <kmccullough@apple.com>
28048
28049 - Updated testkjs results to make the build bots green until we
28050 can fix the tests that are failing. The new failures are in DST.
28051
28052 * tests/mozilla/expected.html:
28053
28054 2007-11-03 Maciej Stachowiak <mjs@apple.com>
28055
28056 Reviewed by Adam.
28057
28058 - don't print the var twice for ForInNodes with a var declaration
28059
28060 * kjs/nodes2string.cpp:
28061 (KJS::ForInNode::streamTo):
28062
28063 2007-11-03 Darin Adler <darin@apple.com>
28064
28065 * pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
28066 C-incompatible declaration.
28067
28068 2007-11-03 Mark Rowe <mrowe@apple.com>
28069
28070 Gtk build fix.
28071
28072 * kjs/nodes.cpp: Add missing include.
28073
28074 2007-11-03 Darin Adler <darin@apple.com>
28075
28076 Reviewed by Maciej.
28077
28078 - fix http://bugs.webkit.org/show_bug.cgi?id=15814
28079 <rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
28080
28081 These changes cause us to match the JavaScript specification and pass the
28082 fast/js/kde/encode_decode_uri.html test.
28083
28084 * kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
28085 new strict mode, throwing an exception if there are malformed UTF-16 surrogate
28086 pairs in the text.
28087
28088 * kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
28089 * kjs/ustring.cpp:
28090 (KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
28091 those might be illegal in some sense, they aren't supposed to get any special
28092 handling in the place where this function is currently used.
28093 (KJS::UString::UTF8String): Added the strictness.
28094
28095 2007-11-03 Darin Adler <darin@apple.com>
28096
28097 Reviewed by Maciej.
28098
28099 - http://bugs.webkit.org/show_bug.cgi?id=15812
28100 some JavaScript tests (from the Mozilla test suite) are failing
28101
28102 Two or three fixes get 7 more of the Mozilla tests passing.
28103 This gets us down from 61 failing tests to 54.
28104
28105 * kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
28106 Made this inline and gave it a more specific type. Some day we should
28107 probably do that for all of these -- might even get a bit of a speed
28108 boost from it.
28109 * kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
28110 inline in the header.
28111
28112 * kjs/regexp_object.h:
28113 * kjs/regexp_object.cpp:
28114 (KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
28115 switch statement into the RegExpImp object, so they can be shared with
28116 RegExpImp::callAsFunction.
28117 (KJS::RegExpImp::match): Added. Common code used by both test and exec.
28118 (KJS::RegExpImp::test): Added.
28119 (KJS::RegExpImp::exec): Added.
28120 (KJS::RegExpImp::implementsCall): Added.
28121 (KJS::RegExpImp::callAsFunction): Added.
28122 (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
28123 lastInput to null rather than empty string -- we take advantage of the
28124 difference in RegExpImp::match.
28125 (KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
28126 just to get at a field like this.
28127
28128 * pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
28129 the JavaScript specification. If there are not 4 hex digits after the \u,
28130 then it's processed as if it wasn't an escape sequence at all.
28131
28132 * pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
28133 for JavaScript (4 specific Unicode values).
28134 * pcre/pcre_exec.c:
28135 (match): Changed all call sites to use IS_NEWLINE.
28136 (pcre_exec): Ditto.
28137
28138 * tests/mozilla/expected.html: Updated to expect 7 more successful tests.
28139
28140 2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
28141
28142 Sort files(...); sections of Xcode project files.
28143
28144 Rubber-stamped by Darin.
28145
28146 * JavaScriptCore.xcodeproj/project.pbxproj:
28147
28148 2007-11-03 Maciej Stachowiak <mjs@apple.com>
28149
28150 Reviewed by Oliver.
28151
28152 - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
28153
28154 * kjs/grammar.y:
28155 * kjs/nodes.cpp:
28156 (KJS::VarDeclNode::optimizeVariableAccess):
28157 (KJS::VarDeclNode::getDeclarations):
28158 (KJS::VarDeclNode::handleSlowCase):
28159 (KJS::VarDeclNode::evaluateSingle):
28160 (KJS::VarDeclNode::evaluate):
28161 (KJS::VarStatementNode::execute):
28162 * kjs/nodes.h:
28163 (KJS::VarDeclNode::):
28164 (KJS::VarStatementNode::):
28165 * kjs/nodes2string.cpp:
28166 (KJS::VarDeclNode::streamTo):
28167
28168 2007-11-03 Alexey Proskuryakov <ap@webkit.org>
28169
28170 Reviewed by Darin.
28171
28172 http://bugs.webkit.org/show_bug.cgi?id=15800
28173 REGRESSION (r27303): RegExp leaks
28174
28175 * kjs/regexp_object.h:
28176 (KJS::RegExpImp::setRegExp):
28177 (KJS::RegExpImp::regExp):
28178 (KJS::RegExpImp::classInfo):
28179 * kjs/regexp_object.cpp:
28180 (RegExpImp::RegExpImp):
28181 (RegExpImp::~RegExpImp):
28182 Renamed reg member variable to m_regExp, changed it to use OwnPtr.
28183
28184 2007-11-02 Maciej Stachowiak <mjs@apple.com>
28185
28186 Reviewed by Oliver.
28187
28188 - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
28189
28190 * kjs/grammar.y:
28191 * kjs/nodes.cpp:
28192 (KJS::statementListPushFIFO):
28193 (KJS::statementListGetDeclarations):
28194 (KJS::statementListInitializeDeclarationStacks):
28195 (KJS::statementListInitializeVariableAccessStack):
28196 (KJS::statementListExecute):
28197 (KJS::BlockNode::BlockNode):
28198 (KJS::FunctionBodyNode::FunctionBodyNode):
28199 (KJS::ProgramNode::ProgramNode):
28200 * kjs/nodes.h:
28201 (KJS::CaseClauseNode::):
28202
28203 2007-11-02 Darin Adler <darin@apple.com>
28204
28205 Reviewed by Maciej.
28206
28207 - http://bugs.webkit.org/show_bug.cgi?id=15791
28208 change property map data structure for less memory use, better speed
28209
28210 The property map now has an array of indices and a separate array of
28211 property map entries. This slightly slows down lookup because of a second
28212 memory acess, but makes property maps smaller and faster to iterate in
28213 functions like mark().
28214
28215 SunSpider says this is 1.2% faster, although it makes the bitwise-end test
28216 more than 10% slower. To fix that we'll need to optimize global variable lookup.
28217
28218 * kjs/property_map.cpp:
28219 (KJS::PropertyMapEntry::PropertyMapEntry):
28220 (KJS::PropertyMapHashTable::entries):
28221 (KJS::PropertyMapHashTable::allocationSize):
28222 (KJS::SavedProperties::SavedProperties):
28223 (KJS::SavedProperties::~SavedProperties):
28224 (KJS::PropertyMap::checkConsistency):
28225 (KJS::PropertyMap::~PropertyMap):
28226 (KJS::PropertyMap::clear):
28227 (KJS::PropertyMap::get):
28228 (KJS::PropertyMap::getLocation):
28229 (KJS::PropertyMap::put):
28230 (KJS::PropertyMap::insert):
28231 (KJS::PropertyMap::createTable):
28232 (KJS::PropertyMap::rehash):
28233 (KJS::PropertyMap::remove):
28234 (KJS::PropertyMap::mark):
28235 (KJS::comparePropertyMapEntryIndices):
28236 (KJS::PropertyMap::containsGettersOrSetters):
28237 (KJS::PropertyMap::getEnumerablePropertyNames):
28238 (KJS::PropertyMap::save):
28239 (KJS::PropertyMap::restore):
28240 * kjs/property_map.h:
28241
28242 2007-11-02 Darin Adler <darin@apple.com>
28243
28244 Reviewed by Maciej.
28245
28246 - http://bugs.webkit.org/show_bug.cgi?id=15807
28247 HashMap needs a take() function that combines get and remove
28248
28249 * wtf/HashMap.h: Added take function. Simplistic implementation for now,
28250 but still does only one hash table lookup.
28251
28252 * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
28253 a find followed by a remove.
28254
28255 2007-11-02 David Carson <dacarson@gmail.com>
28256
28257 Reviewed by Darin.
28258
28259 Fix compiler warning "warning: suggest parentheses around && within ||"
28260 http://bugs.webkit.org/show_bug.cgi?id=15764
28261
28262 * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
28263
28264 2007-11-01 Geoffrey Garen <ggaren@apple.com>
28265
28266 Reviewed by Maciej Stachowiak.
28267
28268 In preparation for making List a simple stack-allocated Vector:
28269
28270 Removed all instances of List copying and/or assignment, and made List
28271 inherit from Noncopyable.
28272
28273 Functions that used to return a List by copy now take List& out
28274 parameters.
28275
28276 Layout tests and JS tests pass.
28277
28278 * kjs/list.cpp:
28279 (KJS::List::slice): Replaced copyTail with a more generic slice
28280 alternative. (JavaScriptCore only calls slice(1), but WebCore calls
28281 slice(2)).
28282
28283 2007-11-01 Geoffrey Garen <ggaren@apple.com>
28284
28285 Reviewed by Maciej Stachowiak.
28286
28287 Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
28288 REGRESSION(r27344): Crash on load at finance.yahoo.com
28289
28290 Reverted a small portion of my last check-in. (The speedup and the List
28291 removal are still there, though.)
28292
28293 ActivationImp needs to hold a pointer to its function, and mark that
28294 pointer (rather than accessing its function through its ExecState, and
28295 counting on the active scope to mark its function) because a closure
28296 can cause an ActivationImp to outlive its ExecState along with any
28297 active scope.
28298
28299 * kjs/ExecState.cpp:
28300 (KJS::ExecState::ExecState):
28301 * kjs/function.cpp:
28302 (KJS::FunctionImp::~FunctionImp):
28303 (KJS::ActivationImp::ActivationImp):
28304 * kjs/function.h:
28305 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
28306
28307 Also made HashTable a little more crash-happy in debug builds, so
28308 problems like this will show up earlier:
28309
28310 * wtf/HashTable.h:
28311 (WTF::HashTable::~HashTable):
28312
28313 2007-11-01 Geoffrey Garen <ggaren@apple.com>
28314
28315 Reviewed by Adam Roben.
28316
28317 Addressed some of Darin's review comments.
28318
28319 Used perl -p, which is the shorthand while(<>) {}.
28320
28321 Made sure not to suppress bison's output.
28322
28323 Added line to removed bison_out.txt, since this script removes other
28324 intermediate files, too.
28325
28326 * DerivedSources.make:
28327
28328 2007-11-01 Geoffrey Garen <ggaren@apple.com>
28329
28330 Reviewed by Oliver Hunt.
28331
28332 Removed List from ActivationImp, in preparation for making all lists
28333 stack-allocated.
28334
28335 Tests pass.
28336
28337 1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
28338
28339 * kjs/ExecState.cpp:
28340 (KJS::ExecState::ExecState):
28341 (KJS::ExecState::~ExecState):
28342 * kjs/function.cpp:
28343 (KJS::ActivationImp::ActivationImp):
28344 (KJS::ActivationImp::createArgumentsObject):
28345 * kjs/function.h:
28346 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
28347
28348 2007-11-01 Adam Roben <aroben@apple.com>
28349
28350 Use jsNumberCell instead of jsNumber when converting double constants to JSValues
28351
28352 This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
28353 ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
28354
28355 It also gets rid of an MSVC warning that we previously had to silence.
28356
28357 Reviewed by Geoff.
28358
28359 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
28360 back on the "overflow in constant arithmetic" warning.
28361 * kjs/number_object.cpp:
28362 (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
28363 jsNumber.
28364
28365 2007-10-31 Adam Roben <aroben@apple.com>
28366
28367 Windows build fix
28368
28369 * kjs/ExecState.h:
28370
28371 2007-10-31 Maciej Stachowiak <mjs@apple.com>
28372
28373 Reviewed by Oliver.
28374
28375 - shave some cycles off of local storage access for a 1% SunSpider speedup
28376
28377 Keep the LocalStorage pointer in the ExecState, instead of getting
28378 it from the ActivationImp all the time.
28379
28380 * kjs/ExecState.cpp:
28381 (KJS::ExecState::updateLocalStorage):
28382 * kjs/ExecState.h:
28383 (KJS::ExecState::localStorage):
28384 * kjs/nodes.cpp:
28385 (KJS::LocalVarAccessNode::evaluate):
28386 (KJS::LocalVarFunctionCallNode::evaluate):
28387 (KJS::PostIncLocalVarNode::evaluate):
28388 (KJS::PostDecLocalVarNode::evaluate):
28389 (KJS::LocalVarTypeOfNode::evaluate):
28390 (KJS::PreIncLocalVarNode::evaluate):
28391 (KJS::PreDecLocalVarNode::evaluate):
28392 (KJS::ReadModifyLocalVarNode::evaluate):
28393 (KJS::AssignLocalVarNode::evaluate):
28394 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
28395
28396 2007-10-31 Adam Roben <aroben@apple.com>
28397
28398 Fix a crash on launch due to a static initializer race
28399
28400 We now use fast inline assembler spinlocks which can be statically
28401 initialized at compile time.
28402
28403 As a side benefit, this speeds up SunSpider by 0.4%.
28404
28405 Reviewed by Oliver.
28406
28407 * wtf/FastMalloc.cpp:
28408 * wtf/TCSpinLock.h:
28409 (TCMalloc_SpinLock::Lock):
28410 (TCMalloc_SpinLock::Unlock):
28411 (TCMalloc_SlowLock):
28412 * wtf/TCSystemAlloc.cpp:
28413
28414 2007-10-31 Kevin McCullough <kmccullough@apple.com>
28415
28416 Reviewed by Sam.
28417
28418 - Corrected spelling.
28419
28420 * wtf/HashTraits.h:
28421
28422 2007-10-31 Mark Rowe <mrowe@apple.com>
28423
28424 Further Gtk build fixage.
28425
28426 * kjs/regexp_object.cpp:
28427
28428 2007-10-31 Mark Rowe <mrowe@apple.com>
28429
28430 Gtk build fix.
28431
28432 * kjs/regexp.h:
28433
28434 2007-10-31 Darin Adler <darin@apple.com>
28435
28436 Reviewed by Maciej.
28437
28438 - fix http://bugs.webkit.org/show_bug.cgi?id=15749
28439 RegExp/RegExpObjectImp cause needless UString creation
28440
28441 Speeds things up 0.4% according to SunSpider.
28442
28443 * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
28444 because this library doesn't use the real PCRE -- it uses its
28445 own PCRE that works on UTF-16.
28446
28447 * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
28448 Use Noncopyable. Change the return value of match.
28449 * kjs/regexp.cpp:
28450 (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
28451 (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
28452 (KJS::RegExp::match): Change to return the position as an int and the
28453 ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
28454
28455 * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
28456 require a result string.
28457 * kjs/regexp_object.cpp:
28458 (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
28459 (RegExpObjectImp::performMatch): Change so it doesn't return a string.
28460 (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
28461 the main result with the backreferences; now it doesn't need to take
28462 a result parameter.
28463 (RegExpObjectImp::getBackref): Minor tweaks.
28464 (RegExpObjectImp::getLastParen): Ditto.
28465 (RegExpObjectImp::getLeftContext): Ditto.
28466 (RegExpObjectImp::getRightContext): Ditto.
28467 (RegExpObjectImp::getValueProperty): Change LastMatch case to call
28468 getBackref(0) so we don't need a separate getLastMatch function.
28469
28470 * kjs/string_object.cpp:
28471 (KJS::replace): Update to use new performMatch, including merging the
28472 matched string section with the other substrings.
28473 (KJS::StringProtoFunc::callAsFunction): Update functions to use the
28474 new performMatch and match. Also change to use OwnArrayPtr.
28475
28476 2007-10-31 Oliver Hunt <oliver@apple.com>
28477
28478 * kjs/nodes.h: include OwnPtr.h
28479
28480 2007-10-31 Oliver Hunt <oliver@apple.com>
28481
28482 Reviewed by Maciej.
28483
28484 Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
28485
28486 * kjs/grammar.y:
28487 * kjs/nodes.cpp:
28488 (KJS::statementListPushFIFO):
28489 (KJS::statementListGetDeclarations):
28490 (KJS::statementListInitializeDeclarationStacks):
28491 (KJS::statementListInitializeVariableAccessStack):
28492 (KJS::statementListExecute):
28493 (KJS::BlockNode::optimizeVariableAccess):
28494 (KJS::BlockNode::BlockNode):
28495 (KJS::BlockNode::getDeclarations):
28496 (KJS::BlockNode::execute):
28497 (KJS::CaseClauseNode::optimizeVariableAccess):
28498 (KJS::CaseClauseNode::getDeclarations):
28499 (KJS::CaseClauseNode::evalStatements):
28500 (KJS::FunctionBodyNode::initializeDeclarationStacks):
28501 (KJS::FunctionBodyNode::optimizeVariableAccess):
28502 * kjs/nodes.h:
28503 * kjs/nodes2string.cpp:
28504 (KJS::statementListStreamTo):
28505 (KJS::BlockNode::streamTo):
28506 (KJS::CaseClauseNode::streamTo):
28507
28508 2007-10-30 Mark Rowe <mrowe@apple.com>
28509
28510 * kjs/property_map.cpp: Added a missing using directive to fix the build
28511 for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
28512
28513 2007-10-31 Maciej Stachowiak <mjs@apple.com>
28514
28515 * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
28516 for non-Mac ports.
28517
28518 2007-10-31 Alexey Proskuryakov <ap@webkit.org>
28519
28520 Reviewed by Darin.
28521
28522 http://bugs.webkit.org/show_bug.cgi?id=11001
28523 WebKit doesn't support RegExp.compile method
28524
28525 Test: fast/js/regexp-compile.html
28526
28527 * kjs/regexp_object.cpp:
28528 (RegExpPrototype::RegExpPrototype):
28529 (RegExpProtoFunc::callAsFunction):
28530 * kjs/regexp_object.h:
28531 (KJS::RegExpProtoFunc::):
28532 Added RegExp.compile.
28533
28534 * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
28535
28536 2007-10-31 Maciej Stachowiak <mjs@apple.com>
28537
28538 Reviewed by Oliver.
28539
28540 - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
28541
28542 Integer divide sucks. Fortunately, a bunch of shifts and XORs
28543 biased towards the high bits is sufficient to provide a good
28544 double hash. Besides the SunSpider win, I used the dump statistics
28545 mode for both to verify that collisions did not increase and that
28546 the longest collision chain is not any longer.
28547
28548 * kjs/property_map.cpp:
28549 (KJS::doubleHash):
28550 (KJS::PropertyMap::get):
28551 (KJS::PropertyMap::getLocation):
28552 (KJS::PropertyMap::put):
28553 (KJS::PropertyMap::insert):
28554 (KJS::PropertyMap::remove):
28555 (KJS::PropertyMap::checkConsistency):
28556 * wtf/HashTable.h:
28557 (WTF::doubleHash):
28558 (WTF::::lookup):
28559 (WTF::::lookupForWriting):
28560 (WTF::::fullLookupForWriting):
28561 (WTF::::add):
28562
28563 2007-10-30 Adam Roben <aroben@apple.com>
28564
28565 * kjs/collector.h: Make HeapType public so it can be used for non-member
28566 things like the HeapConstants struct template. Fixes the build on Windows.
28567
28568 2007-10-30 Adam Roben <aroben@apple.com>
28569
28570 Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
28571
28572 Speeds up SunSpider by 0.4%.
28573
28574 Reviewed by Steve and Maciej.
28575
28576 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
28577 a warning during LTCG in release builds about double -> float
28578 conversion.
28579 * wtf/AlwaysInline.h:
28580 * wtf/FastMalloc.h:
28581
28582 2007-10-30 Adam Roben <aroben@apple.com>
28583
28584 Use GetCurrentThreadId instead of pthread_self in FastMalloc
28585
28586 Speeds up SunSpider by 0.3%.
28587
28588 Reviewed by Steve.
28589
28590 * wtf/FastMalloc.cpp:
28591 (WTF::TCMalloc_ThreadCache::InitTSD):
28592 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
28593
28594 2007-10-30 Adam Roben <aroben@apple.com>
28595
28596 Switch to a Win32 critical section implementation of spinlocks
28597
28598 Speeds up SunSpider by 0.4%.
28599
28600 Reviewed by Steve.
28601
28602 * wtf/FastMalloc.cpp:
28603 * wtf/TCSpinLock.h:
28604 (TCMalloc_SpinLock::TCMalloc_SpinLock):
28605 (TCMalloc_SpinLock::Init):
28606 (TCMalloc_SpinLock::Finalize):
28607 (TCMalloc_SpinLock::Lock):
28608 (TCMalloc_SpinLock::Unlock):
28609 * wtf/TCSystemAlloc.cpp:
28610
28611 2007-10-30 Adam Roben <aroben@apple.com>
28612
28613 Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
28614
28615 http://bugs.webkit.org/show_bug.cgi?id=15586
28616
28617 Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
28618
28619 Use Win32 TLS functions instead of __declspec(thread), which breaks
28620 delay-loading.
28621
28622 Reviewed by Steve.
28623
28624 * wtf/FastMalloc.cpp:
28625 (WTF::getThreadHeap):
28626 (WTF::TCMalloc_ThreadCache::InitModule):
28627
28628 2007-10-30 Maciej Stachowiak <mjs@apple.com>
28629
28630 Reviewed by Oliver.
28631
28632 - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
28633 http://bugs.webkit.org/show_bug.cgi?id=15772
28634
28635 We do this by using a single mark bit per two number cells, and
28636 tweaking marking.
28637
28638 Besides being an 0.5% win overall, this is a 7.1% win on morph.
28639
28640 * kjs/collector.cpp:
28641 (KJS::Collector::heapAllocate):
28642 (KJS::Collector::markStackObjectsConservatively):
28643 (KJS::Collector::sweep):
28644 * kjs/collector.h:
28645 (KJS::SmallCollectorCell::):
28646
28647 2007-10-30 Geoffrey Garen <ggaren@apple.com>
28648
28649 Reviewed by Adam Roben, Sam Weinig.
28650
28651 Made conflicts in grammar.y a persistent build failure.
28652
28653 * DerivedSources.make:
28654
28655 2007-10-30 Kevin McCullough <kmccullough@apple.com>
28656
28657 Reviewed by Adam and Geoff.
28658
28659 - Added a new cast so all the casts are in the same place.
28660
28661 * API/APICast.h:
28662 (toGlobalRef):
28663
28664 2007-10-30 Geoffrey Garen <ggaren@apple.com>
28665
28666 Reviewed by Darin Adler.
28667
28668 Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
28669
28670 JS tests, including
28671
28672 ecma_2/Statements/dowhile-001.js
28673 ecma_2/Statements/dowhile-002.js
28674 ecma_2/Statements/dowhile-003.js
28675 ecma_2/Statements/dowhile-004.js
28676 ecma_2/Statements/dowhile-005.js
28677 ecma_2/Statements/dowhile-006.js
28678 ecma_2/Statements/dowhile-007.js
28679 js1_2/statements/do_while.js
28680
28681 and layout tests, including
28682
28683 do-while-expression-value.html
28684 do-while-semicolon.html
28685 do-while-without-semicolon.html
28686
28687 pass.
28688
28689 * kjs/grammar.y: Use the explicit "error" production, as we do with other
28690 automatic semicolon insertions, to disambiguate "do { } while();" from
28691 "do { } while()" followed by ";" (the empty statement).
28692
28693 2007-10-29 Oliver Hunt <oliver@apple.com>
28694
28695 Reviewed by Maciej.
28696
28697 Debranching remaining assignment nodes, and miscellaneous cleanup
28698
28699 Split read-modify code paths out of AssignBracketNode and AssignDotNode
28700 Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
28701 and ReadModifyResolveNode evaluate methods
28702
28703 Leads to a 1% gain in SunSpider.
28704
28705 * kjs/grammar.y:
28706 * kjs/nodes.cpp:
28707 (KJS::ReadModifyLocalVarNode::evaluate):
28708 (KJS::ReadModifyResolveNode::evaluate):
28709 (KJS::AssignDotNode::evaluate):
28710 (KJS::ReadModifyDotNode::optimizeVariableAccess):
28711 (KJS::ReadModifyDotNode::evaluate):
28712 (KJS::AssignBracketNode::evaluate):
28713 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
28714 (KJS::ReadModifyBracketNode::evaluate):
28715 * kjs/nodes.h:
28716 (KJS::AssignBracketNode::):
28717 (KJS::AssignBracketNode::precedence):
28718 (KJS::AssignDotNode::):
28719 (KJS::AssignDotNode::precedence):
28720 * kjs/nodes2string.cpp:
28721 (KJS::ReadModifyBracketNode::streamTo):
28722 (KJS::AssignBracketNode::streamTo):
28723 (KJS::ReadModifyDotNode::streamTo):
28724 (KJS::AssignDotNode::streamTo):
28725
28726 2007-10-29 Oliver Hunt <oliver@apple.com>
28727
28728 Debranching various Node::evaluate implementations
28729
28730 Reviewed by Maciej.
28731
28732 Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
28733 Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
28734
28735 Gains 1.6% on SunSpider
28736
28737 * JavaScriptCore.xcodeproj/project.pbxproj:
28738 * kjs/grammar.y:
28739 * kjs/nodes.cpp:
28740 (KJS::PostIncResolveNode::optimizeVariableAccess):
28741 (KJS::PostIncResolveNode::evaluate):
28742 (KJS::PostIncLocalVarNode::evaluate):
28743 (KJS::PostDecResolveNode::optimizeVariableAccess):
28744 (KJS::PostDecResolveNode::evaluate):
28745 (KJS::PostDecLocalVarNode::evaluate):
28746 (KJS::PostIncBracketNode::evaluate):
28747 (KJS::PostDecBracketNode::evaluate):
28748 (KJS::PostIncDotNode::evaluate):
28749 (KJS::PostDecDotNode::evaluate):
28750 (KJS::PreIncResolveNode::optimizeVariableAccess):
28751 (KJS::PreIncLocalVarNode::evaluate):
28752 (KJS::PreIncResolveNode::evaluate):
28753 (KJS::PreDecResolveNode::optimizeVariableAccess):
28754 (KJS::PreDecLocalVarNode::evaluate):
28755 (KJS::PreDecResolveNode::evaluate):
28756 (KJS::PreIncBracketNode::evaluate):
28757 (KJS::PreDecBracketNode::evaluate):
28758 (KJS::PreIncDotNode::evaluate):
28759 (KJS::PreDecDotNode::evaluate):
28760 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
28761 (KJS::AssignResolveNode::optimizeVariableAccess):
28762 (KJS::AssignLocalVarNode::evaluate):
28763 (KJS::AssignResolveNode::evaluate):
28764 * kjs/nodes.h:
28765 (KJS::PostDecResolveNode::):
28766 (KJS::PostDecResolveNode::precedence):
28767 (KJS::PostDecLocalVarNode::):
28768 (KJS::PostfixBracketNode::):
28769 (KJS::PostfixBracketNode::precedence):
28770 (KJS::PostIncBracketNode::):
28771 (KJS::PostIncBracketNode::isIncrement):
28772 (KJS::PostDecBracketNode::):
28773 (KJS::PostDecBracketNode::isIncrement):
28774 (KJS::PostfixDotNode::):
28775 (KJS::PostfixDotNode::precedence):
28776 (KJS::PostIncDotNode::):
28777 (KJS::PostIncDotNode::isIncrement):
28778 (KJS::PostDecDotNode::):
28779 (KJS::PreIncResolveNode::):
28780 (KJS::PreDecResolveNode::):
28781 (KJS::PreDecResolveNode::precedence):
28782 (KJS::PreDecLocalVarNode::):
28783 (KJS::PrefixBracketNode::):
28784 (KJS::PrefixBracketNode::precedence):
28785 (KJS::PreIncBracketNode::):
28786 (KJS::PreIncBracketNode::isIncrement):
28787 (KJS::PreDecBracketNode::):
28788 (KJS::PreDecBracketNode::isIncrement):
28789 (KJS::PrefixDotNode::):
28790 (KJS::PrefixDotNode::precedence):
28791 (KJS::PreIncDotNode::):
28792 (KJS::PreIncDotNode::isIncrement):
28793 (KJS::PreDecDotNode::):
28794 (KJS::ReadModifyResolveNode::):
28795 (KJS::ReadModifyLocalVarNode::):
28796 (KJS::AssignResolveNode::):
28797 (KJS::AssignResolveNode::precedence):
28798 * kjs/nodes2string.cpp:
28799 (KJS::PostIncResolveNode::streamTo):
28800 (KJS::PostDecResolveNode::streamTo):
28801 (KJS::PostfixBracketNode::streamTo):
28802 (KJS::PostfixDotNode::streamTo):
28803 (KJS::PreIncResolveNode::streamTo):
28804 (KJS::PreDecResolveNode::streamTo):
28805 (KJS::ReadModifyResolveNode::streamTo):
28806 (KJS::AssignResolveNode::streamTo):
28807
28808 2007-10-29 Maciej Stachowiak <mjs@apple.com>
28809
28810 Not reviewed, build fix.
28811
28812 - Include Vector.h in a way that actually works.
28813
28814 * kjs/LocalStorage.h:
28815
28816 2007-10-29 Maciej Stachowiak <mjs@apple.com>
28817
28818 Not reviewed, build fix.
28819
28820 - Install LocalStorage.h as a private header.
28821
28822 * JavaScriptCore.xcodeproj/project.pbxproj:
28823
28824 2007-10-29 Maciej Stachowiak <mjs@apple.com>
28825
28826 Reviewed by Darin.
28827
28828 - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
28829
28830 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
28831 * JavaScriptCore.xcodeproj/project.pbxproj:
28832 * kjs/LocalStorage.h: Added.
28833 (KJS::LocalStorageEntry::LocalStorageEntry):
28834 (WTF::):
28835 * kjs/function.h:
28836 * kjs/nodes.cpp:
28837 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
28838
28839 2007-10-29 Geoffrey Garen <ggaren@apple.com>
28840
28841 Reviewed by Oliver Hunt.
28842
28843 Some small tweaks that I notice while reviewing Oliver's last patch.
28844
28845 Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
28846
28847 No change in SunSpider because SunSpider doesn't take the code path that
28848 would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
28849
28850 * kjs/nodes.cpp:
28851 (KJS::LocalVarPostfixNode::evaluate):
28852 (KJS::TypeOfResolveNode::optimizeVariableAccess):
28853 (KJS::LocalVarTypeOfNode::evaluate):
28854 (KJS::PrefixResolveNode::optimizeVariableAccess):
28855 (KJS::LocalVarPrefixNode::evaluate):
28856 (KJS::AssignResolveNode::optimizeVariableAccess):
28857 (KJS::LocalVarAssignNode::evaluate):
28858 * kjs/nodes.h:
28859 (KJS::LocalVarTypeOfNode::):
28860 (KJS::PrefixResolveNode::):
28861 (KJS::LocalVarPrefixNode::):
28862 (KJS::AssignResolveNode::):
28863 (KJS::LocalVarAssignNode::):
28864
28865 2007-10-29 Eric Seidel <eric@webkit.org>
28866
28867 Reviewed by Maciej.
28868
28869 SunSpider claims this was a 0.7% speedup.
28870
28871 * kjs/string_object.cpp:
28872 (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
28873
28874 2007-10-29 Maciej Stachowiak <mjs@apple.com>
28875
28876 Reviewed by Mark.
28877
28878 - re-enable asserts for access to empty or deleted keys
28879
28880 * wtf/HashTable.h:
28881 (WTF::::lookup):
28882 (WTF::::lookupForWriting):
28883 (WTF::::fullLookupForWriting):
28884 (WTF::::add):
28885
28886 2007-10-29 Eric Seidel <eric@webkit.org>
28887
28888 Build fix only, no review.
28889
28890 * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
28891
28892 2007-10-29 Mark Rowe <mrowe@apple.com>
28893
28894 Gtk build fix. Move struct declarations into nodes.h.
28895
28896 * kjs/grammar.y:
28897 * kjs/nodes.h:
28898
28899 2007-10-29 Eric Seidel <eric@webkit.org>
28900
28901 Reviewed by darin.
28902
28903 Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
28904 Make it a compile time error to use toString(ExecState) on a StringInstance
28905
28906 SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
28907
28908 * kjs/internal.h:
28909 (KJS::StringImp::getLength):
28910 * kjs/string_object.cpp:
28911 (KJS::StringInstance::lengthGetter):
28912 (KJS::StringInstance::inlineGetOwnPropertySlot):
28913 (KJS::StringInstance::getOwnPropertySlot):
28914 * kjs/string_object.h:
28915
28916 2007-10-28 Oliver Hunt <oliver@apple.com>
28917
28918 Reviewed by Darin.
28919
28920 Add nodes to allow Assignment, TypeOf, and prefix operators to
28921 make use of the new optimised local variable look up.
28922
28923 5% gain on sunspider
28924
28925 * kjs/nodes.cpp:
28926 (KJS::TypeOfResolveNode::optimizeVariableAccess):
28927 (KJS::LocalTypeOfAccessNode::evaluate):
28928 (KJS::PrefixResolveNode::optimizeVariableAccess):
28929 (KJS::PrefixLocalAccessNode::evaluate):
28930 (KJS::AssignResolveNode::optimizeVariableAccess):
28931 (KJS::AssignLocalAccessNode::evaluate):
28932 * kjs/nodes.h:
28933 (KJS::TypeOfResolveNode::):
28934 (KJS::TypeOfResolveNode::precedence):
28935 (KJS::LocalTypeOfAccessNode::):
28936 (KJS::PrefixResolveNode::):
28937 (KJS::PrefixResolveNode::precedence):
28938 (KJS::PrefixLocalAccessNode::):
28939 (KJS::AssignResolveNode::):
28940 (KJS::AssignLocalAccessNode::):
28941
28942 2007-10-28 Maciej Stachowiak <mjs@apple.com>
28943
28944 Reviewed by Darin.
28945
28946 - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
28947 http://bugs.webkit.org/show_bug.cgi?id=15748
28948
28949 Not a significant speedup or slowdown on SunSpider.
28950
28951 * kjs/Parser.cpp:
28952 (KJS::clearNewNodes):
28953 * kjs/Parser.h:
28954 * kjs/grammar.y:
28955 * kjs/nodes.cpp:
28956 (KJS::BlockNode::BlockNode):
28957 (KJS::CaseBlockNode::CaseBlockNode):
28958 (KJS::FunctionBodyNode::FunctionBodyNode):
28959 (KJS::SourceElementsNode::SourceElementsNode):
28960 (KJS::ProgramNode::ProgramNode):
28961 * kjs/nodes.h:
28962 (KJS::ElementNode::):
28963 (KJS::ArrayNode::):
28964 (KJS::PropertyListNode::):
28965 (KJS::ObjectLiteralNode::):
28966 (KJS::ArgumentListNode::):
28967 (KJS::ArgumentsNode::):
28968 (KJS::VarDeclListNode::):
28969 (KJS::VarStatementNode::):
28970 (KJS::ForNode::):
28971 (KJS::ParameterNode::):
28972 (KJS::FuncExprNode::):
28973 (KJS::FuncDeclNode::):
28974 (KJS::SourceElementsNode::):
28975 (KJS::CaseClauseNode::):
28976 (KJS::ClauseListNode::):
28977
28978 2007-10-28 Mark Rowe <mrowe@apple.com>
28979
28980 Disable assertions in a manner that doesn't break the Qt Windows build.
28981
28982 * wtf/HashTable.h:
28983 (WTF::::lookup):
28984 (WTF::::lookupForWriting):
28985 (WTF::::fullLookupForWriting):
28986
28987 2007-10-28 Geoffrey Garen <ggaren@apple.com>
28988
28989 Temporarily disabling some ASSERTs I introduced in my last check-in
28990 because of http://bugs.webkit.org/show_bug.cgi?id=15747
28991 Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
28992
28993 * wtf/HashTable.h:
28994 (WTF::::lookup):
28995 (WTF::::lookupForWriting):
28996 (WTF::::fullLookupForWriting):
28997 (WTF::::add):
28998
28999 2007-10-28 Geoffrey Garen <ggaren@apple.com>
29000
29001 Reviewed by Darin Adler.
29002
29003 Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
29004 #ifndef ASSERT_DISABLED is no good!
29005
29006 Replaced with #if !ASSERT_DISABLED.
29007
29008 * wtf/HashTable.h:
29009 (WTF::::lookup):
29010 (WTF::::lookupForWriting):
29011 (WTF::::fullLookupForWriting):
29012 (WTF::::add):
29013
29014 2007-10-28 Geoffrey Garen <ggaren@apple.com>
29015
29016 Reviewed by Darin Adler.
29017
29018 Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
29019 to the AST transfom that replaces slow resolve nodes with fast local
29020 variable alternatives.
29021
29022 2.5% speedup on SunSpider.
29023
29024 Also added some missing copyright notices.
29025
29026 * kjs/nodes.cpp:
29027 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
29028 (KJS::FunctionCallResolveNode::evaluate):
29029 (KJS::LocalVarFunctionCallNode::evaluate):
29030 (KJS::PostfixResolveNode::optimizeVariableAccess):
29031 (KJS::PostfixResolveNode::evaluate):
29032 (KJS::LocalVarPostfixNode::evaluate):
29033 (KJS::DeleteResolveNode::optimizeVariableAccess):
29034 (KJS::DeleteResolveNode::evaluate):
29035 (KJS::LocalVarDeleteNode::evaluate):
29036 * kjs/nodes.h:
29037 (KJS::FunctionCallResolveNode::):
29038 (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
29039 (KJS::PostfixResolveNode::):
29040 (KJS::LocalVarPostfixNode::LocalVarPostfixNode):
29041 (KJS::DeleteResolveNode::):
29042 (KJS::LocalVarDeleteNode::LocalVarDeleteNode):
29043
29044 2007-10-28 Eric Seidel <eric@webkit.org>
29045
29046 Reviewed by darin.
29047
29048 Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
29049 Add virtual keyword to a few virtual functions previously unmarked.
29050
29051 * kjs/internal.h:
29052 (KJS::StringImp::type):
29053 (KJS::NumberImp::type):
29054 * kjs/ustring.h:
29055 (KJS::UString::Rep::deref):
29056
29057 2007-10-28 Darin Adler <darin@apple.com>
29058
29059 - fix "broken everything" from the storage leak fix
29060
29061 * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
29062 * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
29063
29064 2007-10-28 Darin Adler <darin@apple.com>
29065
29066 Reviewed by Adam.
29067
29068 - turn on unused parameter waring on Mac OS X because it's already on elsewhere
29069
29070 * Configurations/Base.xcconfig: Took out -wno-unused-parameter.
29071
29072 * API/JSNode.c:
29073 * API/JSNodeList.c:
29074 * API/minidom.c:
29075 * API/testapi.c:
29076 Fixed unused variables by using them or marked them with UNUSED_PARAM.
29077
29078 * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
29079 Removed parameter names to indicate they are unused.
29080
29081 2007-10-28 Darin Adler <darin@apple.com>
29082
29083 Reviewed by Maciej.
29084
29085 - fix a storage leak where we ref the UString every time we replace
29086 a ResolveNode with a LocalVarAccessNode
29087
29088 * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
29089 that takes PlacementNewAdopt.
29090
29091 * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
29092 with PlacementNewAdopt instead of the old value of ident.
29093
29094 * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
29095 takes PlacementNewAdopt.
29096
29097 2007-10-28 Darin Adler <darin@apple.com>
29098
29099 - Windows build fix; get rid of unused parameter
29100
29101 * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
29102 * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
29103 The assertions weren't all that helpful.
29104
29105 2007-10-28 Mark Rowe <mrowe@apple.com>
29106
29107 Gtk build fix. Add include of MathExtras.h.
29108
29109 * kjs/string_object.cpp:
29110
29111 2007-10-28 Mark Rowe <mrowe@apple.com>
29112
29113 Reviewed by Maciej and Tim.
29114
29115 Replace uses of isNaN and isInf with isnan and isinf, and
29116 remove isNaN and isInf.
29117
29118 * kjs/config.h: Remove unused HAVE_'s.
29119 * kjs/date_object.cpp:
29120 (KJS::DateInstance::getTime):
29121 (KJS::DateInstance::getUTCTime):
29122 (KJS::DateProtoFunc::callAsFunction):
29123 (KJS::DateObjectImp::construct):
29124 (KJS::DateObjectFuncImp::callAsFunction):
29125 * kjs/function.cpp:
29126 (KJS::GlobalFuncImp::callAsFunction):
29127 * kjs/math_object.cpp:
29128 (MathFuncImp::callAsFunction):
29129 * kjs/nodes2string.cpp:
29130 (KJS::isParserRoundTripNumber):
29131 * kjs/number_object.cpp:
29132 (NumberProtoFunc::callAsFunction):
29133 * kjs/operations.cpp:
29134 * kjs/operations.h:
29135 * kjs/string_object.cpp:
29136 (KJS::StringProtoFunc::callAsFunction):
29137 * kjs/ustring.cpp:
29138 (KJS::UString::from):
29139 * kjs/value.cpp:
29140 (KJS::JSValue::toInteger):
29141 (KJS::JSValue::toInt32SlowCase):
29142 (KJS::JSValue::toUInt32SlowCase):
29143
29144 2007-10-28 Geoffrey Garen <ggaren@apple.com>
29145
29146 Build fix: use the new-fangled missingSymbolMarker().
29147
29148 * kjs/nodes.cpp:
29149 (KJS::ResolveNode::optimizeVariableAccess):
29150 * kjs/nodes.h:
29151 (KJS::LocalVarAccessNode::LocalVarAccessNode):
29152
29153 2007-10-28 Geoffrey Garen <ggaren@apple.com>
29154
29155 Reviewed by Maciej Stachowiak, Darin Adler.
29156
29157 Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
29158 Cameron Zwarich.
29159
29160 AST transfom to replace slow resolve nodes with fast local variable
29161 alternatives that do direct memory access. Currently, only ResolveNode
29162 provides a fast local variable alternative. 6 others are soon to come.
29163
29164 16.7% speedup on SunSpider.
29165
29166 Most of this patch is just scaffolding to support iterating all the
29167 resolve nodes in the AST through optimizeResolveNodes(). In
29168 optimizeResolveNodes(), most classes just push their child nodes onto
29169 the processing stack, while ResolveNodes actually replace themselves in
29170 the tree with more optimized alternatives, if possible.
29171
29172 Here are the interesting bits:
29173
29174 * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
29175 in Node and ResolveNode. This tag allows you to use placement new to
29176 swap out a base class Node in favor of a subclass copy that holds the
29177 same data. (Without this tag, default initialization would NULL out
29178 RefPtrs, change line numbers, etc.)
29179
29180 * kjs/nodes.cpp:
29181 (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
29182 that the fast path is impossible, to make sure we didn't leave anything
29183 on the table.
29184
29185 (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
29186 transformation happens.
29187
29188 (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
29189 optimization happens.
29190
29191 * kjs/function.h: Added symbolTable() accessor for, for the sake of
29192 an ASSERT.
29193
29194 2007-10-28 Mark Rowe <mrowe@apple.com>
29195
29196 Reviewed by Maciej.
29197
29198 Fix "AllInOneFile.o has a global initializer in it".
29199
29200 Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
29201 We can avoid this by moving it inside an inline function.
29202
29203 * kjs/SymbolTable.h:
29204 (KJS::missingSymbolMarker):
29205 * kjs/function.cpp:
29206 (KJS::ActivationImp::getOwnPropertySlot):
29207 (KJS::ActivationImp::put):
29208
29209 2007-10-28 Maciej Stachowiak <mjs@apple.com>
29210
29211 Reviewed by Mark.
29212
29213 - Added assertions to protect against adding empty or deleted keys to a HashTable
29214
29215 * wtf/HashTable.h:
29216 (WTF::HashTable::lookup):
29217 (WTF::HashTable::lookupForWriting):
29218 (WTF::HashTable::fullLookupForWriting):
29219 (WTF::HashTable::add):
29220
29221 2007-10-28 Darin Adler <darin@apple.com>
29222
29223 - fix GTK build
29224
29225 * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
29226 Use isNaN and isInf instead of isnan and isinf.
29227
29228 2007-10-28 Darin Adler <darin@apple.com>
29229
29230 Reviewed by Maciej.
29231
29232 - http://bugs.webkit.org/show_bug.cgi?id=15735
29233 remove GroupNode to simplify AST and possibly get a modest speedup
29234
29235 This patch removes 4 node types: GroupNode, PropertyNameNode,
29236 FunctionCallParenBracketNode, and FunctionCallParenDotNode.
29237
29238 To remove GroupNode, we add knowledge of precedence to the tree nodes,
29239 and use that when serializing to determine where parentheses are needed.
29240 This means we no longer have to represent parentheses in the tree.
29241
29242 The precedence values are named after productions in the grammar from the
29243 JavaScript standard.
29244
29245 SunSpider says this is an 0.4% speedup.
29246
29247 * kjs/function.h:
29248 * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
29249 serialization, so I moved it to the file that takes care of that.
29250
29251 * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
29252 indicate failure instead of a separate boolean. Got rid of PropertyNameNode
29253 by merging the PropertyName rule into the Property rule (which was easier
29254 than figuring out how to pass the Identifier from one node to another).
29255 Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
29256 and FunctionCallParenDotNode.
29257
29258 * kjs/nodes.h: Removed unused forward declarations and Operator values.
29259 Added Precedence enum, and precedence function to all nodes. Removed
29260 nodeInsideAllParens. Added streamBinaryOperator function for serialization.
29261 Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
29262 Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
29263
29264 * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
29265 (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
29266 of converting it from an Identifier to a jsString then back to a UString
29267 then into an Identifier again!
29268
29269 * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
29270 function for each of Endl, Indent, Unindent, and DotExpr instead of using a
29271 single function with a switch. Added a precedence that you can stream in, to
29272 cause the next node serialized to add parentheses based on that precedence value.
29273 (KJS::operatorString): Moved to the top of the file.
29274 (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
29275 workaround for snprintf, since StringExtras.h takes care of that.
29276 (KJS::operator<<): Made the char and char* versions faster by using UString's
29277 character append functions instead of constructing a UString. Added the logic
29278 to the Node* version to add parentheses if needed.
29279 (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
29280 (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
29281 (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
29282 the bracket.
29283 (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
29284 (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
29285 (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
29286 (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
29287 (KJS::FunctionCallBracketNode::streamTo): Ditto.
29288 (KJS::FunctionCallDotNode::streamTo): Ditto.
29289 (KJS::PostfixBracketNode::streamTo): Ditto.
29290 (KJS::PostfixDotNode::streamTo): Ditto.
29291 (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
29292 (KJS::DeleteBracketNode::streamTo): Use PrecCall.
29293 (KJS::DeleteDotNode::streamTo): Ditto.
29294 (KJS::DeleteValueNode::streamTo): Use PrecUnary.
29295 (KJS::VoidNode::streamTo): Ditto.
29296 (KJS::TypeOfValueNode::streamTo): Ditto.
29297 (KJS::PrefixBracketNode::streamTo): Use PrecCall.
29298 (KJS::PrefixDotNode::streamTo): Ditto.
29299 (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
29300 (KJS::UnaryPlusNode::streamTo): Ditto.
29301 (KJS::NegateNode::streamTo): Ditto.
29302 (KJS::BitwiseNotNode::streamTo): Ditto.
29303 (KJS::LogicalNotNode::streamTo): Ditto.
29304 (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
29305 (KJS::DivNode::streamTo): Ditto.
29306 (KJS::ModNode::streamTo): Ditto.
29307 (KJS::AddNode::streamTo): Ditto.
29308 (KJS::SubNode::streamTo): Ditto.
29309 (KJS::LeftShiftNode::streamTo): Ditto.
29310 (KJS::RightShiftNode::streamTo): Ditto.
29311 (KJS::UnsignedRightShiftNode::streamTo): Ditto.
29312 (KJS::LessNode::streamTo): Ditto.
29313 (KJS::GreaterNode::streamTo): Ditto.
29314 (KJS::LessEqNode::streamTo): Ditto.
29315 (KJS::GreaterEqNode::streamTo): Ditto.
29316 (KJS::InstanceOfNode::streamTo): Ditto.
29317 (KJS::InNode::streamTo): Ditto.
29318 (KJS::EqualNode::streamTo): Ditto.
29319 (KJS::NotEqualNode::streamTo): Ditto.
29320 (KJS::StrictEqualNode::streamTo): Ditto.
29321 (KJS::NotStrictEqualNode::streamTo): Ditto.
29322 (KJS::BitAndNode::streamTo): Ditto.
29323 (KJS::BitXOrNode::streamTo): Ditto.
29324 (KJS::BitOrNode::streamTo): Ditto.
29325 (KJS::LogicalAndNode::streamTo): Ditto.
29326 (KJS::LogicalOrNode::streamTo): Ditto.
29327 (KJS::ConditionalNode::streamTo): Ditto.
29328 (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
29329 (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
29330 the bracket and PrecAssignment for the right side.
29331 (KJS::AssignDotNode::streamTo): Ditto.
29332 (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
29333 and PrecAssignment for the right side.
29334 (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
29335 (KJS::AssignExprNode::streamTo): Use PrecAssignment.
29336
29337 2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
29338
29339 Define wx port and set wx port USE options.
29340
29341 Reviewed by Adam Roben.
29342
29343 * wtf/Platform.h:
29344
29345 2007-10-28 Mark Rowe <mrowe@apple.com>
29346
29347 We don't include "config.h" in headers.
29348
29349 * bindings/jni/jni_instance.h:
29350 * kjs/regexp.h:
29351 * wtf/TCPageMap.h:
29352 * wtf/TCSpinLock.h:
29353
29354 2007-10-28 Maciej Stachowiak <mjs@apple.com>
29355
29356 Rubber stamped by Mark.
29357
29358 - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
29359
29360 * kjs/SymbolTable.h:
29361 (KJS::SymbolTableIndexHashTraits::emptyValue):
29362 * kjs/function.cpp:
29363 (KJS::ActivationImp::getOwnPropertySlot):
29364 (KJS::ActivationImp::put):
29365
29366 2007-10-28 Maciej Stachowiak <mjs@apple.com>
29367
29368 Reviewed by Eric.
29369
29370 - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
29371
29372 * kjs/SymbolTable.h:
29373 (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
29374 (KJS::IdentifierRepHash::equal): ditto
29375 (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
29376 (KJS::SymbolTable): change to a typedef for a HashMap.
29377 * kjs/function.cpp:
29378 (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
29379 (KJS::ActivationImp::deleteProperty): ditto
29380 (KJS::ActivationImp::put): ditto
29381
29382 * kjs/nodes.cpp:
29383 (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
29384 you now have to store a UString::rep, not an identifier.
29385
29386 2007-10-27 Maciej Stachowiak <mjs@apple.com>
29387
29388 Reviewed by Oliver.
29389
29390 - numerous HashTable performance improvements
29391
29392 This does not quite add up to a measurable win on SunSpider, but it allows a
29393 follow-on > 3% improvement and probably helps WebCore too.
29394
29395 I made the following improvements, among others:
29396
29397 - Made HashFunctions note whether it is ok to compare a real value with the equal() function
29398 to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
29399
29400 - Specialized lookup so it doesn't have to do so many extra branches and build so many extra
29401 std::pairs for cases that don't need them. There are now four versions, one for read-only access,
29402 two for writing, and one folded directly into add() (these all were improvments).
29403
29404 - Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
29405
29406 - Made a special constructor for iterators that knows it points to
29407 a valid filled cell and so skips updating itself.
29408
29409 - Reordered memory accesses in the various lookup functions for better code generation
29410
29411 - Made simple translators avoid passing a hash code around
29412
29413 - Other minor tweaks
29414
29415 * wtf/HashTable.h:
29416 (WTF::):
29417 (WTF::HashTableConstIterator::HashTableConstIterator):
29418 (WTF::HashTableIterator::HashTableIterator):
29419 (WTF::IdentityHashTranslator::translate):
29420 (WTF::HashTable::end):
29421 (WTF::HashTable::lookup):
29422 (WTF::HashTable::lookupForWriting):
29423 (WTF::HashTable::makeKnownGoodIterator):
29424 (WTF::HashTable::makeKnownGoodConstIterator):
29425 (WTF::::lookup):
29426 (WTF::::lookupForWriting):
29427 (WTF::::fullLookupForWriting):
29428 (WTF::::add):
29429 (WTF::::addPassingHashCode):
29430 (WTF::::reinsert):
29431 (WTF::::find):
29432 (WTF::::contains):
29433 * kjs/identifier.cpp:
29434 (WTF::):
29435 * wtf/HashFunctions.h:
29436 (WTF::):
29437 * wtf/HashMap.h:
29438 (WTF::):
29439 (WTF::::get):
29440 * wtf/HashSet.h:
29441 (WTF::):
29442 (WTF::::add):
29443 * wtf/ListHashSet.h:
29444 (WTF::ListHashSetTranslator::translate):
29445
29446 2007-10-27 Darin Adler <darin@apple.com>
29447
29448 Reviewed by Eric.
29449
29450 - fix ASCIICType.h for some Windows compiles
29451
29452 * wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
29453 compiler/library that has the wchar_t that is just a typedef.
29454
29455 2007-10-27 Kevin McCullough <kmccullough@apple.com>
29456
29457 - BuildFix
29458 - Forgot to change the build step when I changed the filename.
29459
29460 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
29461
29462 2007-10-27 Geoffrey Garen <ggaren@apple.com>
29463
29464 Reviewed by Darin Adler.
29465
29466 Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
29467 computedHash()"
29468 http://bugs.webkit.org/show_bug.cgi?id=15718
29469
29470 * kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a
29471 hash value. Also changed O(n) strlen to O(1) check for empty string.
29472 (KJS::Identifier::add):
29473
29474 * kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
29475 (KJS::UString::UString):
29476 (KJS::UString::operator=):
29477
29478 2007-10-27 Darin Adler <darin@apple.com>
29479
29480 Reviewed by Eric.
29481
29482 - fix pow on Windows
29483
29484 * wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
29485 a "pow" function that does not properly handle the case where arg1 is
29486 NaN and arg2 is 0.
29487
29488 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
29489 specify "::pow" -- just "pow" is fine.
29490
29491 2007-10-27 Darin Adler <darin@apple.com>
29492
29493 Reviewed by Maciej.
29494
29495 - http://bugs.webkit.org/show_bug.cgi?id=15711
29496 force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
29497
29498 * kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
29499
29500 * kjs/object.h: Removed redundant includes.
29501 * kjs/value.h: Ditto.
29502
29503 2007-10-27 Maciej Stachowiak <mjs@apple.com>
29504
29505 Reviewed by Mark.
29506
29507 - fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
29508 http://bugs.webkit.org/show_bug.cgi?id=15718
29509
29510 * kjs/identifier.cpp:
29511 (KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
29512 now that we count on all Identifiers already having one.
29513
29514 2007-10-27 Mark Rowe <mrowe@apple.com>
29515
29516 Silence a warning.
29517
29518 * kjs/SymbolTable.h:
29519
29520 2007-10-27 Mark Rowe <mrowe@apple.com>
29521
29522 Gtk build fix.
29523
29524 * kjs/function.h:
29525
29526 2007-10-26 Kevin McCullough <kmccullough@apple.com>
29527
29528 Rubber stamp by Adam.
29529
29530 - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
29531 files contain are functions that operate on BSTRs.
29532
29533 * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
29534 * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
29535 * API/JSStringRefCOM.cpp: Removed.
29536 * API/JSStringRefCOM.h: Removed.
29537 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
29538
29539 2007-10-26 Kevin McCullough <kmccullough@apple.com>
29540
29541 Reviewed by Adam.
29542
29543 - Made JSStringCreateWithBSTR capable of handling null BSTRs.
29544
29545 * API/JSStringRefCOM.cpp:
29546 (JSStringCreateWithBSTR):
29547
29548 2007-10-26 Sam Weinig <sam@webkit.org>
29549
29550 Windows build fix.
29551
29552 * kjs/SymbolTable.h: Add header gaurd.
29553 * kjs/nodes.h: #include "SymbolTable.h"
29554
29555 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29556
29557 Suggested by Anders Carlsson.
29558
29559 Fixed tyop.
29560
29561 * kjs/function.cpp:
29562 (KJS::ActivationImp::getOwnPropertySlot):
29563
29564 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29565
29566 Suggested by Darin Adler.
29567
29568 Use computedHash(), which is safer than just directly accessing _hash.
29569
29570 * kjs/lookup.cpp:
29571 (KJS::Lookup::findEntry):
29572 (KJS::Lookup::find):
29573
29574 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29575
29576 Build fix: svn add SymbolTable.h
29577
29578 * kjs/SymbolTable.h: Added.
29579 (KJS::SymbolTable::set):
29580 (KJS::SymbolTable::get):
29581
29582 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29583
29584 Build fix: export SymbolTable.h to WebCore.
29585
29586 * JavaScriptCore.xcodeproj/project.pbxproj:
29587
29588 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29589
29590 Comment tweak suggested by Maciej.
29591
29592 * kjs/function.cpp:
29593 (KJS::ActivationImp::getOwnPropertySlot):
29594
29595 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29596
29597 Reviewed by Maciej Stachowiak.
29598
29599 Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
29600
29601 * kjs/property_map.cpp: Use a special no branch accessor to the UString's
29602 hash value. Also, return immediately instead of branching to the end
29603 of the loop if the value is not found.
29604 (KJS::PropertyMap::get):
29605 (KJS::PropertyMap::getLocation):
29606 (KJS::PropertyMap::put):
29607 (KJS::PropertyMap::insert):
29608 (KJS::PropertyMap::remove):
29609 (KJS::PropertyMap::checkConsistency):
29610
29611 * kjs/ustring.h:
29612 (KJS::UString::Rep::computedHash): Special no branch accessor to the
29613 UString's hash value. Used when the caller knows that the hash value
29614 has already been computed. (For example, if the caller got the UString
29615 from an Identifier.)
29616
29617 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29618
29619 Reviewed by Maciej Stachowiak.
29620
29621 Switched ActivationImp to using a symbol table. For now, though, all
29622 clients take the slow path.
29623
29624 Net .6% speedup on SunSpider.
29625
29626 Slowdowns:
29627 - ActivationImp now mallocs in its constructor
29628 - Local variable hits use an extra level of indirection to retrieve
29629 data
29630 - Local variable misses do two lookups
29631
29632 Speedups:
29633 - Fast initialization of local variables upon function entry
29634
29635 * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
29636
29637 * kjs/function.cpp:
29638 (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
29639 data that won't fit in a JSCell.
29640 (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
29641 lookup.
29642 (KJS::ActivationImp::getOwnPropertySlot): ditto
29643 (KJS::ActivationImp::deleteProperty): ditto
29644 (KJS::ActivationImp::put): ditto
29645 (KJS::ActivationImp::createArgumentsObject): ditto
29646
29647 (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
29648 our properties doesn't try to recursively mark us. (This caused a crash
29649 in earlier testing. Not sure why we haven't run into it before.)
29650
29651 * kjs/nodes.cpp: Functions now build a symbol table the first time
29652 they're called.
29653 (KJS::VarDeclNode::evaluate):
29654 (KJS::FunctionBodyNode::FunctionBodyNode):
29655 (KJS::FunctionBodyNode::initializeSymbolTable):
29656 (KJS::FunctionBodyNode::processDeclarations):
29657 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
29658 (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
29659
29660 * kjs/nodes.h:
29661 (KJS::FunctionBodyNode::symbolTable):
29662
29663 * wtf/Forward.h: Added Vector.
29664
29665 2007-10-26 Kevin McCullough <kmccullough@apple.com>
29666
29667 - Corrected function name mistake in this changelog.
29668
29669 2007-10-26 Kevin McCullough <kmccullough@apple.com>
29670 Reviewed by Sam and Steve.
29671
29672 - Added convenience methods for converting between BSTR and JSStringRefs
29673
29674 * API/JSStringRefCOM.cpp: Added.
29675 (JSStringCreateWithBSTR):
29676 (JSStringCopyBSTR):
29677 * API/JSStringRefCOM.h: Added.
29678 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
29679
29680 2007-10-26 Mark Rowe <mrowe@apple.com>
29681
29682 Windows build fix.
29683
29684 * kjs/collector.cpp:
29685 (KJS::Collector::collect):
29686
29687 2007-10-26 Oliver Hunt <oliver@apple.com>
29688
29689 Reviewed by Maciej.
29690
29691 Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
29692
29693 * kjs/CollectorHeapIntrospector.cpp:
29694 (KJS::CollectorHeapIntrospector::init):
29695 (KJS::CollectorHeapIntrospector::enumerate):
29696 * kjs/CollectorHeapIntrospector.h:
29697 * kjs/collector.cpp:
29698 (KJS::Collector::recordExtraCost):
29699 (KJS::Collector::heapAllocate):
29700 (KJS::Collector::allocate):
29701 (KJS::Collector::allocateNumber):
29702 (KJS::Collector::registerThread):
29703 (KJS::Collector::markStackObjectsConservatively):
29704 (KJS::Collector::markMainThreadOnlyObjects):
29705 (KJS::Collector::sweep):
29706 (KJS::Collector::collect):
29707 * kjs/collector.h:
29708 * kjs/internal.h:
29709 (KJS::NumberImp::operator new):
29710 Force numbers to be allocated in the secondary heap.
29711
29712 2007-10-26 Maciej Stachowiak <mjs@apple.com>
29713
29714 Reviewed by Oliver.
29715
29716 - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
29717
29718 * kjs/value.h:
29719 (KJS::JSValue::getUInt32):
29720 (KJS::JSValue::getTruncatedInt32):
29721 (KJS::JSValue::toNumber):
29722 * wtf/PassRefPtr.h:
29723 (WTF::PassRefPtr::~PassRefPtr):
29724 * wtf/RefPtr.h:
29725 (WTF::RefPtr::operator->):
29726
29727 2007-10-26 Mark Rowe <mrowe@apple.com>
29728
29729 Gtk build fix.
29730
29731 * kjs/ExecState.h:
29732
29733 2007-10-26 Maciej Stachowiak <mjs@apple.com>
29734
29735 Reviewed by Mark.
29736
29737 - Merge Context class fully into ExecState, since they are always created and used together.
29738
29739 No measurable performance impact but this is a useful cleanup.
29740
29741 * JavaScriptCore.pri:
29742 * kjs/ExecState.cpp:
29743 (KJS::ExecState::ExecState):
29744 (KJS::ExecState::~ExecState):
29745 (KJS::ExecState::mark):
29746 (KJS::ExecState::lexicalInterpreter):
29747 * kjs/ExecState.h:
29748 (KJS::ExecState::dynamicInterpreter):
29749 (KJS::ExecState::setException):
29750 (KJS::ExecState::clearException):
29751 (KJS::ExecState::exception):
29752 (KJS::ExecState::exceptionSlot):
29753 (KJS::ExecState::hadException):
29754 (KJS::ExecState::scopeChain):
29755 (KJS::ExecState::callingExecState):
29756 (KJS::ExecState::propertyNames):
29757 * kjs/collector.cpp:
29758 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
29759 * kjs/function.cpp:
29760 (KJS::FunctionImp::callAsFunction):
29761 (KJS::FunctionImp::argumentsGetter):
29762 (KJS::FunctionImp::callerGetter):
29763 (KJS::GlobalFuncImp::callAsFunction):
29764 * kjs/interpreter.cpp:
29765 (KJS::Interpreter::Interpreter):
29766 (KJS::Interpreter::init):
29767 (KJS::Interpreter::evaluate):
29768 (KJS::Interpreter::mark):
29769 * kjs/interpreter.h:
29770 (KJS::Interpreter::setCurrentExec):
29771 (KJS::Interpreter::currentExec):
29772 * kjs/nodes.cpp:
29773 (KJS::currentSourceId):
29774 (KJS::currentSourceURL):
29775 (KJS::ThisNode::evaluate):
29776 (KJS::ResolveNode::evaluate):
29777 (KJS::FunctionCallResolveNode::evaluate):
29778 (KJS::PostfixResolveNode::evaluate):
29779 (KJS::DeleteResolveNode::evaluate):
29780 (KJS::TypeOfResolveNode::evaluate):
29781 (KJS::PrefixResolveNode::evaluate):
29782 (KJS::AssignResolveNode::evaluate):
29783 (KJS::VarDeclNode::evaluate):
29784 (KJS::DoWhileNode::execute):
29785 (KJS::WhileNode::execute):
29786 (KJS::ForNode::execute):
29787 (KJS::ForInNode::execute):
29788 (KJS::ContinueNode::execute):
29789 (KJS::BreakNode::execute):
29790 (KJS::ReturnNode::execute):
29791 (KJS::WithNode::execute):
29792 (KJS::SwitchNode::execute):
29793 (KJS::LabelNode::execute):
29794 (KJS::TryNode::execute):
29795 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
29796 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
29797 (KJS::FunctionBodyNode::processDeclarations):
29798 (KJS::FuncDeclNode::makeFunction):
29799 (KJS::FuncExprNode::evaluate):
29800
29801 2007-10-26 Mark Rowe <mrowe@apple.com>
29802
29803 Windows build fix.
29804
29805 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
29806
29807 2007-10-26 Mark Rowe <mrowe@apple.com>
29808
29809 Gtk build fix.
29810
29811 * JavaScriptCore.pri:
29812 * kjs/ExecState.cpp:
29813
29814 2007-10-26 Maciej Stachowiak <mjs@apple.com>
29815
29816 Reviewed by Oliver.
29817
29818 - moved Context class into ExecState.{h,cpp} in preparation for merging
29819 ExecState and Context classes.
29820
29821 * kjs/ExecState.h: Moved CodeType enum and Context class here in
29822 preparation for merging ExecState and Context.
29823 * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
29824 (KJS::Context::Context):
29825 (KJS::Context::~Context):
29826 (KJS::Context::mark):
29827 * kjs/context.h: Removed.
29828 * kjs/Context.cpp: Removed.
29829 * kjs/function.h: Removed CodeType enum.
29830 * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
29831 * kjs/internal.h: Removed LabelStack.
29832 * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
29833 * kjs/collector.cpp: Fixed includes.
29834 * kjs/function.cpp: ditto
29835 * kjs/internal.cpp: ditto
29836 * kjs/interpreter.cpp: ditto
29837 * kjs/lookup.h: ditto
29838 * kjs/nodes.cpp: ditto
29839
29840 2007-10-26 Mark Rowe <mrowe@apple.com>
29841
29842 Windows build fix.
29843
29844 * kjs/string_object.cpp:
29845 (KJS::StringObjectFuncImp::callAsFunction):
29846
29847 2007-10-25 Darin Adler <darin@apple.com>
29848
29849 Reviewed by Maciej.
29850
29851 - http://bugs.webkit.org/show_bug.cgi?id=15703
29852 fix numeric functions -- improve correctness and speed
29853
29854 Gives about 1% gain on SunSpider.
29855
29856 * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
29857 (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
29858 with both immediate and number values.
29859 (KJS::JSValue::toUInt32): Ditto.
29860 * kjs/value.cpp:
29861 (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
29862 differences. One is that it now correctly returns 0 for NaN, and another is that
29863 there's no special case for 0 or infinity, since the general case already handles
29864 those correctly.
29865 (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
29866 check for NaN.
29867 (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
29868 truncation done by the typecast already does the necessary truncation that
29869 roundValue was doing.
29870 (KJS::JSValue::toUInt32SlowCase): Ditto.
29871 (KJS::JSValue::toUInt16): Removed.
29872
29873 * kjs/internal.h: Removed roundValue.
29874 * kjs/internal.cpp: Ditto.
29875
29876 * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
29877 code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
29878
29879 * kjs/date_object.cpp:
29880 (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
29881 toNumber as specified.
29882 (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
29883 with a call to toNumber and timeClip as specified.
29884 (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
29885 where the default behavior of toInt32 (returning 0) was already correct. Replaced
29886 call to roundValue with a call to toNumber as specified.
29887 (KJS::DateObjectFuncImp::callAsFunction): Ditto.
29888
29889 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
29890 cases for the pow function that the library already handles correctly.
29891
29892 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
29893 call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
29894 The real toInteger now returns 0 for NaN. Took out unneeded special case in
29895 ToFixed for undefined; was only needed because our toInteger was wrong. Same
29896 thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
29897
29898 * kjs/string_object.cpp:
29899 (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
29900 cases for undefined that were only needed because toInteger was wrong. Same in
29901 IndexOf, and was able to remove some special cases. In LastIndexOf, used
29902 toIntegerPreserveNaN, but was able to remove some special cases there too.
29903 Changed Substr implementation to preserve correct behavior with the change
29904 to toInteger and match the specification. Also made sure we weren't converting
29905 an out of range double to an int.
29906 (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
29907 toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
29908 no reason to have toUInt16 as a second, less-optimized function that's only
29909 called at this one call site.
29910
29911 * wtf/MathExtras.h: Added trunc function for Windows.
29912
29913 2007-10-25 Geoffrey Garen <ggaren@apple.com>
29914
29915 Reviewed by Maciej Stachowiak.
29916
29917 Tweaked the inner hashtable lookup loop to remove a branch in the "not
29918 found" case. .5% speedup on SunSpider.
29919
29920 * JavaScriptCore.xcodeproj/project.pbxproj:
29921 * wtf/HashTable.h:
29922 (WTF::::lookup):
29923
29924 2007-10-25 Maciej Stachowiak <mjs@apple.com>
29925
29926 Reviewed by Oliver.
29927
29928 - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
29929
29930 * kjs/nodes.cpp:
29931 (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
29932 adding any value over toNumber() here.
29933 (KJS::valueForReadModifyAssignment): Ditto.
29934 (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
29935 and branches.
29936 (KJS::lessThanEq): Ditto.
29937 * JavaScriptCore.exp: Export new functions as needed.
29938 * kjs/value.h:
29939 (KJS::JSValue::toPrimitive): Fixed formatting.
29940 (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
29941 to number and tells you whether a toPrimitive() conversion with a Number hint
29942 would have given a string.
29943 * kjs/internal.cpp:
29944 (KJS::StringImp::getPrimitiveNumber): Implemented.
29945 (KJS::NumberImp::getPrimitiveNumber): ditto
29946 (KJS::GetterSetterImp::getPrimitiveNumber): ditto
29947 (KJS::StringImp::toPrimitive): Fixed formatting.
29948 (KJS::NumberImp::toPrimitive): ditto
29949 (KJS::GetterSetterImp::toPrimitive): ditto
29950 * kjs/internal.h:
29951 * kjs/object.cpp:
29952 (KJS::JSObject::getPrimitiveNumber): Implemented.
29953 * kjs/object.h:
29954
29955 2007-10-25 Sam Weinig <sam@webkit.org>
29956
29957 Reviewed by Adam Roben.
29958
29959 Remove JSStringRefCFHack from windows as it is no longer needed.
29960
29961 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
29962
29963 2007-10-25 Geoffrey Garen <ggaren@apple.com>
29964
29965 Reviewed by Oliver Hunt.
29966
29967 Rolled out my last patch. It turns out that I needed 2 words, not 1,
29968 so it didn't help.
29969
29970 2007-10-25 Geoffrey Garen <ggaren@apple.com>
29971
29972 Reviewed by Oliver Hunt.
29973
29974 Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
29975 Shrink the size of an activation object by 1 word
29976
29977 This is in preparation for adding a symbol table to the activation
29978 object.
29979
29980 The basic strategy here is to rely on the mutual exclusion between
29981 the arguments object pointer and the function pointer (you only need
29982 the latter in order to create the former), and store them in the same
29983 place. The LazyArgumentsObject class encapsulates this strategy.
29984
29985 Also inlined the ArgumentsImp constructor, for good measure.
29986
29987 SunSpider reports no regression. Regression tests pass.
29988
29989 * JavaScriptCore.xcodeproj/project.pbxproj:
29990 * kjs/Context.cpp:
29991 (KJS::Context::~Context):
29992 * kjs/function.cpp:
29993 (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
29994 (KJS::ActivationImp::LazyArgumentsObject::mark):
29995 (KJS::ActivationImp::argumentsGetter):
29996 (KJS::ActivationImp::mark):
29997 * kjs/function.h:
29998 (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
29999 (KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
30000 (KJS::ActivationImp::LazyArgumentsObject::resetArguments):
30001 (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
30002 (KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
30003 (KJS::ActivationImp::LazyArgumentsObject::setFunction):
30004 (KJS::ActivationImp::LazyArgumentsObject::function):
30005 (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
30006 (KJS::ActivationImp::LazyArgumentsObject::):
30007 (KJS::ActivationImp::ActivationImp::ActivationImp):
30008 (KJS::ActivationImp::resetArguments):
30009
30010 2007-10-25 Adam Roben <aroben@apple.com>
30011
30012 Change JavaScriptCore.vcproj to use DerivedSources.make
30013
30014 We were trying to emulate the logic of make in
30015 build-generated-files.sh, but we got it wrong. We now use a
30016 build-generated-files very much like the one that WebCore uses to
30017 invoke make.
30018
30019 We also now only have a Debug configuration of dftables which we build
30020 even when doing a Release build of JavaScriptCore. dftables also no
30021 longer has the "_debug" name suffix.
30022
30023 Changes mostly made by Darin, reviewed by me.
30024
30025 * DerivedSources.make: Add a variable to set the extension used for
30026 the dftables executable.
30027 * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
30028 dftables in Release configurations.
30029 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
30030 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
30031 - Updated include path to point to the new location of the derived
30032 sources.
30033 - Modified pre-build event to pass the right arguments to
30034 build-generated-files.sh and not call dftables directly.
30035 - Added the derived source files to the project.
30036 - Removed grammarWrapper.cpp, which isn't needed now that we're
30037 compiling grammar.cpp directly.
30038 * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
30039 Slightly modified from the WebCore version.
30040 * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
30041 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
30042 - Changed the output location to match Mac.
30043 - Removed the Release configuration.
30044 - Removed the _debug suffix.
30045
30046 2007-10-25 Geoffrey Garen <ggaren@apple.com>
30047
30048 Reviewed by Eric Seidel.
30049
30050 Slightly elaborated the differences between declaration procesing in
30051 Function Code and Program Code.
30052
30053 .3% speedup on SunSpider.
30054
30055 * kjs/nodes.cpp:
30056 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
30057 (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a
30058 minimum set of attributes instead of recomputing all the time. Also,
30059 ignore m_parameters, since programs don't have arguments.
30060
30061 2007-10-25 Eric Seidel <eric@webkit.org>
30062
30063 Reviewed by Maciej.
30064
30065 More preparation work before adding long-running mode to testkjs.
30066
30067 * kjs/testkjs.cpp:
30068 (TestFunctionImp::callAsFunction):
30069 (prettyPrintScript):
30070 (runWithScripts):
30071 (parseArguments):
30072 (kjsmain):
30073 (fillBufferWithContentsOfFile):
30074
30075 2007-10-25 Eric Seidel <eric@webkit.org>
30076
30077 Reviewed by Maciej.
30078
30079 Bring testkjs code out of the dark ages in preparation for more
30080 radical improvements (like long-running testing support!)
30081
30082 * kjs/testkjs.cpp:
30083 (TestFunctionImp::callAsFunction):
30084 (setupInterpreter):
30085 (doIt):
30086 (fillBufferWithContentsOfFile):
30087
30088 2007-10-25 Geoffrey Garen <ggaren@apple.com>
30089
30090 Reviewed by Maciej Stachowiak.
30091
30092 Make a fast path for declaration processing inside Function Code.
30093
30094 Lifted declaration processing code up from individual declaration nodes
30095 and into processDeclarations.
30096
30097 Broke out processDeclarations into two cases, depending on the type of
30098 code. This eliminates 2 branches, and facilitates more radical
30099 divergeance in the future.
30100
30101 2.5% SunSpider speedup.
30102
30103 * JavaScriptCore.xcodeproj/project.pbxproj:
30104 * kjs/nodes.cpp:
30105 (KJS::FunctionBodyNode::initializeDeclarationStacks):
30106 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
30107 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
30108 (KJS::FunctionBodyNode::execute):
30109 (KJS::FuncDeclNode::makeFunction):
30110 * kjs/nodes.h:
30111
30112 2007-10-25 Maciej Stachowiak <mjs@apple.com>
30113
30114 Reviewed by Adam.
30115
30116 - add header includes needed on platforms that don't use AllInOneFile.cpp
30117
30118 * API/JSCallbackObject.cpp:
30119 * kjs/Context.cpp:
30120 * kjs/ExecState.cpp:
30121 * kjs/array_instance.cpp:
30122 * kjs/function_object.cpp:
30123 * kjs/interpreter.cpp:
30124 * kjs/nodes.cpp:
30125
30126 2007-10-25 Eric Seidel <eric@webkit.org>
30127
30128 Reviewed by Geoff.
30129
30130 * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
30131
30132 2007-10-25 Geoffrey Garen <ggaren@apple.com>
30133
30134 Reviewed by Maciej Stachowiak.
30135
30136 Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
30137 Re-order declaration initialization to avoid calling hasProperty inside
30138 VarDeclNode::processDeclaration
30139
30140 .7% speedup on SunSpider.
30141
30142 * kjs/function.h:
30143 * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
30144 other processing of declared symbols, so the order of execution could
30145 change.
30146
30147 * kjs/nodes.cpp:
30148 (KJS::VarDeclNode::getDeclarations): Added special case for the
30149 "arguments" property name, explained in the comment.
30150
30151 (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
30152 in the case of function code, since we know the declared symbol
30153 management will resolve conflicts between symbols. Yay!
30154
30155 (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
30156 implementation of getDeclarations is non-trivial, we can't take a
30157 short-cut here any longer -- we need to put the VarDecl node on the
30158 stack so it gets processed normally.
30159
30160 (KJS::FunctionBodyNode::processDeclarations): Changed the order of
30161 processing to enforce mutual exclusion rules.
30162
30163 * kjs/nodes.h:
30164 (KJS::DeclarationStacks::DeclarationStacks): Structure includes an
30165 ExecState now, for fast access to the "arguments" property name.
30166
30167 2007-10-24 Eric Seidel <eric@webkit.org>
30168
30169 Reviewed by Maciej.
30170
30171 Add a JSGlobalObject class and remove the InterpreterMap
30172 http://bugs.webkit.org/show_bug.cgi?id=15681
30173
30174 This required making JSCallbackObject a template class to allow for
30175 JSGlobalObjects with JSCallbackObject functionality.
30176
30177 SunSpider claims this was a 0.5% speedup.
30178
30179 * API/JSCallbackObject.cpp:
30180 * API/JSCallbackObject.h:
30181 * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
30182 (KJS::::JSCallbackObject):
30183 (KJS::::init):
30184 (KJS::::~JSCallbackObject):
30185 (KJS::::initializeIfNeeded):
30186 (KJS::::className):
30187 (KJS::::getOwnPropertySlot):
30188 (KJS::::put):
30189 (KJS::::deleteProperty):
30190 (KJS::::implementsConstruct):
30191 (KJS::::construct):
30192 (KJS::::implementsHasInstance):
30193 (KJS::::hasInstance):
30194 (KJS::::implementsCall):
30195 (KJS::::callAsFunction):
30196 (KJS::::getPropertyNames):
30197 (KJS::::toNumber):
30198 (KJS::::toString):
30199 (KJS::::setPrivate):
30200 (KJS::::getPrivate):
30201 (KJS::::inherits):
30202 (KJS::::cachedValueGetter):
30203 (KJS::::staticValueGetter):
30204 (KJS::::staticFunctionGetter):
30205 (KJS::::callbackGetter):
30206 * API/JSClassRef.cpp:
30207 (OpaqueJSClass::prototype):
30208 * API/JSContextRef.cpp:
30209 (JSGlobalContextCreate):
30210 * API/JSObjectRef.cpp:
30211 (JSObjectMake):
30212 (JSObjectGetPrivate):
30213 (JSObjectSetPrivate):
30214 * API/JSValueRef.cpp:
30215 (JSValueIsObjectOfClass):
30216 * JavaScriptCore.exp:
30217 * JavaScriptCore.xcodeproj/project.pbxproj:
30218 * bindings/c/c_utility.cpp:
30219 (KJS::Bindings::convertValueToNPVariant):
30220 * bindings/jni/jni_jsobject.cpp:
30221 * bindings/objc/objc_utility.mm:
30222 (KJS::Bindings::convertValueToObjcValue):
30223 * kjs/Context.cpp:
30224 (KJS::Context::Context):
30225 * kjs/ExecState.cpp:
30226 (KJS::ExecState::lexicalInterpreter):
30227 * kjs/JSGlobalObject.h: Added.
30228 (KJS::JSGlobalObject::JSGlobalObject):
30229 (KJS::JSGlobalObject::isGlobalObject):
30230 (KJS::JSGlobalObject::interpreter):
30231 (KJS::JSGlobalObject::setInterpreter):
30232 * kjs/array_instance.cpp:
30233 * kjs/context.h:
30234 * kjs/function.cpp:
30235 (KJS::FunctionImp::callAsFunction):
30236 (KJS::GlobalFuncImp::callAsFunction):
30237 * kjs/interpreter.cpp:
30238 (KJS::Interpreter::Interpreter):
30239 (KJS::Interpreter::init):
30240 (KJS::Interpreter::~Interpreter):
30241 (KJS::Interpreter::globalObject):
30242 (KJS::Interpreter::initGlobalObject):
30243 (KJS::Interpreter::evaluate):
30244 * kjs/interpreter.h:
30245 * kjs/lookup.h:
30246 (KJS::cacheGlobalObject):
30247 * kjs/object.h:
30248 (KJS::JSObject::isGlobalObject):
30249 * kjs/testkjs.cpp:
30250
30251 2007-10-24 Eric Seidel <eric@webkit.org>
30252
30253 Build fix for Gtk, no review.
30254
30255 * kjs/collector.cpp: #include "context.h"
30256
30257 2007-10-24 Eric Seidel <eric@webkit.org>
30258
30259 Reviewed by Maciej.
30260
30261 Stop checking isOutOfMemory after every allocation, instead let the collector
30262 notify all ExecStates if we ever hit this rare condition.
30263
30264 SunSpider claims this was a 2.2% speedup.
30265
30266 * kjs/collector.cpp:
30267 (KJS::Collector::collect):
30268 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
30269 * kjs/collector.h:
30270 * kjs/nodes.cpp:
30271 (KJS::TryNode::execute):
30272
30273 2007-10-24 Mark Rowe <mrowe@apple.com>
30274
30275 Gtk build fix.
30276
30277 * kjs/identifier.h: Remove extra qualification.
30278
30279 2007-10-24 Geoffrey Garen <ggaren@apple.com>
30280
30281 Reviewed by Sam Weinig.
30282
30283 Disable ALWAYS_INLINE in debug builds, since it drives the debugger
30284 crazy.
30285
30286 * wtf/AlwaysInline.h:
30287
30288 2007-10-24 Geoffrey Garen <ggaren@apple.com>
30289
30290 Reviewed by Sam Weinig.
30291
30292 Inlined the fast path for creating an Identifier from an Identifier.
30293
30294 This is a .4% speedup on SunSpider overall, but as big as a 2.5%
30295 speedup on certain individual tests. 65% of the Identifiers creating
30296 by SunSpider are already Identifiers.
30297
30298 (The main reason I'm making this change is that it resolves a large
30299 regression in a patch I haven't checked in yet.)
30300
30301 * JavaScriptCore.exp:
30302 * kjs/identifier.cpp:
30303 (KJS::Identifier::addSlowCase):
30304 * kjs/identifier.h:
30305 (KJS::Identifier::Identifier::add):
30306
30307 2007-10-24 Lars Knoll <lars@trolltech.com>
30308
30309 Reviewed by Simon.
30310
30311 some changes to the way JS values are converted to Qt values in the script bindings. Added support for converting JS arrays into QStringList's.
30312
30313 * bindings/qt/qt_instance.cpp:
30314 (KJS::Bindings::QtInstance::invokeMethod):
30315 * bindings/qt/qt_runtime.cpp:
30316 (KJS::Bindings::convertValueToQVariant):
30317 (KJS::Bindings::QtField::setValueToInstance):
30318
30319 2007-10-24 Oliver Hunt <oliver@apple.com>
30320
30321 Reviewed by Darin.
30322
30323 Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
30324
30325 * kjs/nodes.cpp:
30326 (KJS::lessThan):
30327 (KJS::lessThanEq):
30328 (KJS::LessNode::evaluate):
30329 (KJS::GreaterNode::evaluate):
30330 (KJS::LessEqNode::evaluate):
30331 (KJS::GreaterEqNode::evaluate):
30332 * kjs/operations.cpp:
30333 * kjs/operations.h:
30334
30335 2007-10-24 Eric Seidel <eric@webkit.org>
30336
30337 Reviewed by darin.
30338
30339 * kjs/nodes.h:
30340 (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
30341
30342 2007-10-24 Darin Adler <darin@apple.com>
30343
30344 Reviewed by Eric.
30345
30346 * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
30347 Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
30348
30349 2007-10-24 Darin Adler <darin@apple.com>
30350
30351 Reviewed by Maciej.
30352
30353 - separate out the code to create a hash table the first time from the code
30354 to rehash
30355
30356 SunSpider claims this was a 0.7% speedup.
30357
30358 * kjs/property_map.cpp:
30359 (KJS::PropertyMap::expand): Changed to call either createTable or rehash.
30360 (KJS::PropertyMap::createTable): Added. For the case where we had no table.
30361 (KJS::PropertyMap::rehash): Removed code needed only in the case where we
30362 had no table.
30363 * kjs/property_map.h: Added createTable.
30364
30365 2007-10-24 Eric Seidel <eric@webkit.org>
30366
30367 Reviewed by darin.
30368
30369 Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
30370 which can be represented by JSImmediate.
30371
30372 SunSpider claims this was a 0.6% speedup.
30373
30374 * kjs/grammar.y:
30375 * kjs/nodes.cpp:
30376 (KJS::NumberNode::evaluate):
30377 (KJS::ImmediateNumberNode::evaluate):
30378 * kjs/nodes.h:
30379 (KJS::Node::):
30380 (KJS::ImmediateNumberNode::):
30381 * kjs/nodes2string.cpp:
30382 (ImmediateNumberNode::streamTo):
30383
30384 2007-10-24 Darin Adler <darin@apple.com>
30385
30386 Reviewed by Maciej.
30387
30388 - http://bugs.webkit.org/show_bug.cgi?id=15657
30389 change static hash tables to use powers of two for speed
30390
30391 Seems to give 0.7% SunSpider speedup.
30392
30393 * kjs/create_hash_table: Updated to generate new format.
30394 * kjs/lookup.cpp:
30395 (KJS::keysMatch): Took out unneeded typecast.
30396 (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
30397 Replaced the modulus with a bit mask.
30398 (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
30399 their hash -- saves a branch.
30400 (KJS::Lookup::find): Ditto.
30401 * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
30402
30403 2007-10-24 Maciej Stachowiak <mjs@apple.com>
30404
30405 Reviewed by Darin.
30406
30407 - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
30408
30409 * kjs/nodes.cpp:
30410 (KJS::DoWhileNode::execute):
30411 (KJS::WhileNode::execute):
30412 (KJS::ForNode::execute):
30413 (KJS::ForInNode::execute):
30414 (KJS::SourceElementsNode::execute):
30415
30416 2007-10-23 Darin Adler <darin@apple.com>
30417
30418 Reviewed by Maciej.
30419
30420 * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
30421 Changed an && to an & for a 1% gain in SunSpider.
30422
30423 2007-10-23 Oliver Hunt <oliver@apple.com>
30424
30425 Reviewed by Maciej.
30426
30427 Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
30428
30429 * kjs/nodes.cpp:
30430 (KJS::MultNode::evaluate):
30431 (KJS::DivNode::evaluate):
30432 (KJS::ModNode::evaluate):
30433 (KJS::add):
30434 (KJS::sub):
30435 (KJS::AddNode::evaluate):
30436 (KJS::SubNode::evaluate):
30437 (KJS::valueForReadModifyAssignment):
30438 * kjs/operations.cpp:
30439 * kjs/operations.h:
30440
30441 2007-10-23 Oliver Hunt <oliver@apple.com>
30442
30443 Reviewed by Maciej.
30444
30445 Separating all of the simple (eg. non-read-modify-write) binary operators
30446 into separate classes in preparation for further JS optimisations.
30447
30448 Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
30449 no further work.
30450
30451 * JavaScriptCore.xcodeproj/project.pbxproj:
30452 * kjs/grammar.y:
30453 * kjs/nodes.cpp:
30454 (KJS::MultNode::evaluate):
30455 (KJS::DivNode::evaluate):
30456 (KJS::ModNode::evaluate):
30457 (KJS::AddNode::evaluate):
30458 (KJS::SubNode::evaluate):
30459 (KJS::LeftShiftNode::evaluate):
30460 (KJS::RightShiftNode::evaluate):
30461 (KJS::UnsignedRightShiftNode::evaluate):
30462 (KJS::LessNode::evaluate):
30463 (KJS::GreaterNode::evaluate):
30464 (KJS::LessEqNode::evaluate):
30465 (KJS::GreaterEqNode::evaluate):
30466 (KJS::InstanceOfNode::evaluate):
30467 (KJS::InNode::evaluate):
30468 (KJS::EqualNode::evaluate):
30469 (KJS::NotEqualNode::evaluate):
30470 (KJS::StrictEqualNode::evaluate):
30471 (KJS::NotStrictEqualNode::evaluate):
30472 (KJS::BitAndNode::evaluate):
30473 (KJS::BitXOrNode::evaluate):
30474 (KJS::BitOrNode::evaluate):
30475 (KJS::LogicalAndNode::evaluate):
30476 (KJS::LogicalOrNode::evaluate):
30477 * kjs/nodes.h:
30478 (KJS::MultNode::):
30479 (KJS::DivNode::):
30480 (KJS::ModNode::):
30481 (KJS::AddNode::):
30482 (KJS::SubNode::):
30483 (KJS::LeftShiftNode::):
30484 (KJS::RightShiftNode::):
30485 (KJS::UnsignedRightShiftNode::):
30486 (KJS::LessNode::):
30487 (KJS::GreaterNode::):
30488 (KJS::LessEqNode::):
30489 (KJS::GreaterEqNode::):
30490 (KJS::InstanceOfNode::):
30491 (KJS::InNode::):
30492 (KJS::EqualNode::):
30493 (KJS::NotEqualNode::):
30494 (KJS::StrictEqualNode::):
30495 (KJS::NotStrictEqualNode::):
30496 (KJS::BitAndNode::):
30497 (KJS::BitOrNode::):
30498 (KJS::BitXOrNode::):
30499 (KJS::LogicalAndNode::):
30500 (KJS::LogicalOrNode::):
30501 * kjs/nodes2string.cpp:
30502 (MultNode::streamTo):
30503 (DivNode::streamTo):
30504 (ModNode::streamTo):
30505 (AddNode::streamTo):
30506 (SubNode::streamTo):
30507 (LeftShiftNode::streamTo):
30508 (RightShiftNode::streamTo):
30509 (UnsignedRightShiftNode::streamTo):
30510 (LessNode::streamTo):
30511 (GreaterNode::streamTo):
30512 (LessEqNode::streamTo):
30513 (GreaterEqNode::streamTo):
30514 (InstanceOfNode::streamTo):
30515 (InNode::streamTo):
30516 (EqualNode::streamTo):
30517 (NotEqualNode::streamTo):
30518 (StrictEqualNode::streamTo):
30519 (NotStrictEqualNode::streamTo):
30520 (BitAndNode::streamTo):
30521 (BitXOrNode::streamTo):
30522 (BitOrNode::streamTo):
30523 (LogicalAndNode::streamTo):
30524
30525 2007-10-23 Darin Adler <darin@apple.com>
30526
30527 Reviewed by Maciej.
30528
30529 - fix http://bugs.webkit.org/show_bug.cgi?id=15639
30530 fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
30531
30532 Test: fast/js/math.html
30533
30534 * kjs/math_object.cpp: (MathFuncImp::callAsFunction):
30535 Fix abs to look at the sign bit. Add a special case for values in the range
30536 between -0 and -1 and a special case for ceil and for -0 for floor.
30537
30538 2007-10-23 Darin Adler <darin@apple.com>
30539
30540 Reviewed by Eric.
30541
30542 - streamline exception handling code for a >1% speed-up of SunSpider
30543
30544 * kjs/nodes.cpp: Changed macros to use functions for everything that's not
30545 part of normal execution. We'll take function call overhead when propagating
30546 an exception or out of memory.
30547 (KJS::createOutOfMemoryCompletion): Added.
30548 (KJS::substitute): Use append instead of the relatively inefficient + operator.
30549 (KJS::Node::rethrowException): Added.
30550 * kjs/nodes.h: Added rethrowException.
30551
30552 2007-10-22 Darin Adler <darin@apple.com>
30553
30554 Reviewed by Maciej.
30555
30556 - fix http://bugs.webkit.org/show_bug.cgi?id=15636
30557 some JavaScriptCore regression tests are failing due to numeric conversion
30558
30559 This should restore correctness and make speed better too, restoring some
30560 of the optimization we lost in my last check-in.
30561
30562 * kjs/JSImmediate.h:
30563 (KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom
30564 I used in my patch yesterday.
30565 (KJS::JSImmediate::getTruncatedUInt32): Ditto.
30566
30567 * kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32.
30568 * kjs/internal.cpp:
30569 (KJS::NumberImp::getUInt32): Changed to always use double, since I can't find
30570 a way to write this more efficiently for float.
30571 (KJS::NumberImp::getTruncatedInt32): Added.
30572 (KJS::NumberImp::getTruncatedUInt32): Added.
30573
30574 * kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32.
30575 (KJS::JSValue::getUInt32):
30576 (KJS::JSValue::getTruncatedInt32): Added.
30577 (KJS::JSValue::getTruncatedUInt32): Added.
30578 (KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32.
30579 (KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32.
30580 * kjs/value.cpp:
30581 (KJS::JSCell::getTruncatedInt32): Added.
30582 (KJS::JSCell::getTruncatedUInt32): Added.
30583 (KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32.
30584 (KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally
30585 had left in here.
30586 (KJS::JSValue::toUInt32SlowCase): Ditto.
30587 (KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32.
30588
30589 * JavaScriptCore.exp: Updated.
30590
30591 2007-10-22 Darin Adler <darin@apple.com>
30592
30593 Reviewed by Geoff.
30594
30595 - fix http://bugs.webkit.org/show_bug.cgi?id=15632
30596 js1_5/Array/array-001.js test failing
30597
30598 One of the JavaScriptCore tests was failing; it failed because of
30599 my change to NumberImp::getUInt32. The incorrect code I copied was
30600 from JSImmediate::getUInt32, and was a pre-existing bug.
30601
30602 This patch fixes correctness, but will surely slow down SunSpider.
30603 We may be able to code this tighter and get the speed back.
30604
30605 * kjs/JSImmediate.h:
30606 (KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately
30607 reflect the fact that this function only returns true if the value is
30608 accurate (no fractional part, etc.). Changed code so that it returns
30609 false when the value has a fraction.
30610 (KJS::JSImmediate::getUInt32): Ditto.
30611
30612 * kjs/internal.cpp:
30613 (KJS::NumberImp::getInt32): Changed code so that it returns false when
30614 the value has a fraction. Restores the old behavior.
30615 (KJS::NumberImp::getUInt32): Ditto.
30616
30617 * kjs/value.h:
30618 (KJS::JSValue::getInt32): Updated for name change.
30619 (KJS::JSValue::getUInt32): Ditto.
30620 (KJS::JSValue::toInt32): Ditto.
30621 (KJS::JSValue::toUInt32): Ditto.
30622
30623 2007-10-22 Darin Adler <darin@apple.com>
30624
30625 Reviewed by Brady.
30626
30627 - fix crash seen when running JavaScriptCore tests
30628
30629 * kjs/array_instance.cpp: (KJS::ArrayInstance::mark):
30630 Copy and paste error: I accidentally had code here that was
30631 making a copy of the HashMap -- that's illegal inside a mark
30632 function and was unnecessary. The other callsite was modifying
30633 the map as it iterated it, but this function is not.
30634
30635 2007-10-22 Maciej Stachowiak <mjs@apple.com>
30636
30637 Reviewed by Oliver.
30638
30639 - Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider
30640 http://bugs.webkit.org/show_bug.cgi?id=15627
30641
30642 * kjs/JSImmediate.h:
30643 (KJS::JSImmediate::fromDouble): Avoid moving floats to integer
30644 registers since this is very slow.
30645
30646 2007-10-22 Darin Adler <darin@apple.com>
30647
30648 Reviewed by Eric Seidel.
30649
30650 - http://bugs.webkit.org/show_bug.cgi?id=15617
30651 improve speed of integer conversions
30652
30653 Makes SunSpider 6% faster.
30654
30655 * kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for
30656 32-bit and 64-bit.
30657 * kjs/value.h:
30658 (KJS::JSValue::getUInt32): Call JSImmediate::toUInt32.
30659
30660 * kjs/internal.h: Added getInt32.
30661 * kjs/internal.cpp:
30662 (KJS::NumberImp::getInt32): Added.
30663 (KJS::NumberImp::getUInt32): Replaced with more-optimal implementation
30664 stolen from JSValue.
30665
30666 * kjs/value.h:
30667 (KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting
30668 inlined.
30669 (KJS::JSValue::getInt32): Added.
30670 (KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32
30671 to avoid converting from float to double.
30672 (KJS::JSValue::toInt32): Made inline, separated out the slow case.
30673 (KJS::JSValue::toUInt32): Ditto.
30674 * kjs/value.cpp:
30675 (KJS::JSCell::getInt32): Added.
30676 (KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the
30677 new getInt32. Added a faster case for in-range numbers.
30678 (KJS::JSValue::toUInt32SlowCase): Ditto.
30679 (KJS::JSValue::toUInt16): Added a faster case for in-range numbers.
30680
30681 * JavaScriptCore.exp: Updated for changes.
30682
30683 2007-10-22 Adam Roben <aroben@apple.com>
30684
30685 Windows build fix
30686
30687 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off
30688 warning about implicit conversion to bool.
30689
30690 2007-10-22 Mark Rowe <mrowe@apple.com>
30691
30692 Gtk build fix.
30693
30694 * kjs/array_instance.cpp:
30695
30696 2007-10-22 Darin Adler <darin@apple.com>
30697
30698 Reviewed by Maciej.
30699
30700 - http://bugs.webkit.org/show_bug.cgi?id=15606
30701 make cut-off for sparse vs. dense arrays smarter for speed with large arrays
30702
30703 Makes the morph test in SunSpider 26% faster, and the overall
30704 benchmark 3% faster.
30705
30706 This also fixes some small problems we had with the distinction
30707 between nonexistent and undefined values in arrays.
30708
30709 * kjs/array_instance.h: Tweaked formatting and naming.
30710 * kjs/array_instance.cpp: Copied from kjs/array_object.cpp.
30711 (KJS::storageSize): Added. Computes the size of the storage given a vector length.
30712 (KJS::increasedVectorLength): Added. Implements the rule for resizing the vector.
30713 (KJS::isDenseEnoughForVector): Added.
30714 (KJS::ArrayInstance::ArrayInstance): Initialize the new fields.
30715 (KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it.
30716 (KJS::ArrayInstance::getItem): Updated for name changes.
30717 (KJS::ArrayInstance::lengthGetter): Ditto.
30718 (KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of
30719 getOwnPropertySlot to share more code.
30720 (KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change.
30721 (KJS::ArrayInstance::put): Added logic for extending the vector as long as the
30722 array is dense enough. Also keep m_numValuesInVector up to date.
30723 (KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector
30724 up to date.
30725 (KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names
30726 for array indices with undefined values.
30727 (KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also
30728 simplified to only handle getting larger.
30729 (KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to
30730 zero out the unused part of the vector and to delete the map if it's no longer
30731 needed.
30732 (KJS::ArrayInstance::mark): Tweaked formatting.
30733 (KJS::compareByStringForQSort): Ditto.
30734 (KJS::ArrayInstance::sort): Ditto.
30735 (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
30736 Ditto.
30737 (KJS::compareWithCompareFunctionForQSort): Ditto.
30738 (KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn
30739 undefined values into nonexistent values in some cases.
30740
30741 * kjs/array_object.h: Removed MAX_ARRAY_INDEX.
30742 * kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file.
30743
30744 * JavaScriptCore.pri: Added array_instance.cpp.
30745 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
30746 * kjs/AllInOneFile.cpp: Ditto.
30747
30748 2007-10-22 Andrew Wellington <proton@wiretapped.net>
30749
30750 Reviewed by Mark Rowe.
30751
30752 Fix for local database support after r26879
30753 Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set
30754
30755 * Configurations/JavaScriptCore.xcconfig:
30756
30757 2007-10-22 Simon Hausmann <hausmann@kde.org>
30758
30759 Reviewed by Alp.
30760
30761 Build fix for the non-qmake builds.
30762
30763 * wtf/Platform.h: Default to enabling the database features unless
30764 otherwise specified. (similar to ENABLE_ICONDATABASE)
30765
30766 2007-10-22 Holger Freyther <zecke@selfish.org>
30767
30768 Reviewed by Simon Hausmann <hausmann@kde.org>.
30769
30770 * Do not build testkjs as an application bundle. This is
30771 needed for run-javascriptcore-tests on OSX.
30772 * Also, based on r26633, allow to test the WebKit/Qt port on OSX.
30773 * Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set
30774 as we do not have -rpath on OSX.
30775
30776 * kjs/testkjs.pro:
30777
30778 2007-10-21 Mark Rowe <mrowe@apple.com>
30779
30780 Reviewed by Alp.
30781
30782 http://bugs.webkit.org/show_bug.cgi?id=15575
30783 Bug 15575: [GTK] Implement threading using GThread
30784
30785 * wtf/Platform.h: Do not enable pthreads for Gtk.
30786
30787 2007-10-21 Mark Rowe <mrowe@apple.com>
30788
30789 Reviewed by Mitz.
30790
30791 Fix http://bugs.webkit.org/show_bug.cgi?id=15603
30792 Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript
30793
30794 * kjs/array_object.cpp:
30795 (KJS::freeStorage): Reinstate null-check that was removed in r26847.
30796
30797 2007-10-21 Darin Adler <darin@apple.com>
30798
30799 - fix Windows build
30800
30801 * kjs/array_instance.h: Removed unused ExecState parameter.
30802 * kjs/array_object.cpp:
30803 (KJS::ArrayInstance::put): Ditto.
30804 (KJS::ArrayInstance::setLength): Ditto.
30805
30806 2007-10-21 Darin Adler <darin@apple.com>
30807
30808 * kjs/array_object.cpp: (KJS::ArrayInstance::put):
30809 Add missing assignment that was causing regression test crash.
30810
30811 2007-10-21 Darin Adler <darin@apple.com>
30812
30813 Reviewed by Maciej.
30814
30815 - http://bugs.webkit.org/show_bug.cgi?id=15585
30816 speed up sparse arrays by using a custom map
30817
30818 Speeds up SunSpider by 10%.
30819
30820 * kjs/array_object.cpp:
30821 (allocateStorage): Leave room for an additional pointer.
30822 (reallocateStorage): Ditto.
30823 (freeStorage): Ditto.
30824 (ArrayInstance::~ArrayInstance): Delete the overflow map if present.
30825 (ArrayInstance::getItem): Read values from the overflow map if present.
30826 Removed the check of length, since it slows down the common case.
30827 (ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback
30828 to the property map.
30829 (ArrayInstance::put): Write values into the overflow map as needed.
30830 Also create overflow map when needed.
30831 (ArrayInstance::deleteProperty): Remove values from the overflow map
30832 as appropriate.
30833 (ArrayInstance::getPropertyNames): Add a name for each identifier in
30834 the property map. This is extremely inefficient.
30835 (ArrayInstance::setLength): Remove any values in the overflow map
30836 that are past the new length, as we formerly did with the property map.
30837 (ArrayInstance::mark): Mark any values in the overflow map.
30838 (compareByStringForQSort): Removed unneeded undefined case, since
30839 compactForSorting guarantees we will have no undefined values.
30840 (compareWithCompareFunctionForQSort): Ditto.
30841 (ArrayInstance::compactForSorting): Copy all the values out of the
30842 overflow map and destroy it.
30843
30844 * kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
30845 * kjs/property_map.cpp: Ditto.
30846
30847 2007-10-20 Darin Adler <darin@apple.com>
30848
30849 Reviewed by Maciej.
30850
30851 - http://bugs.webkit.org/show_bug.cgi?id=15579
30852 stop churning identifier reference counts copying Completion objects
30853
30854 * kjs/completion.h: Replace the Identifier with an Identifier*.
30855 * kjs/nodes.cpp:
30856 (ForInNode::execute): Update for change to Completion constructor.
30857 (ContinueNode::execute): Ditto.
30858 (BreakNode::execute): Ditto.
30859
30860 2007-10-20 Mark Rowe <mrowe@apple.com>
30861
30862 Reviewed by Alp.
30863
30864 Gtk changes needed to enable HTML 5 client-side database storage.
30865
30866 * wtf/Platform.h: Have Gtk use pthreads for now.
30867
30868 2007-10-20 Geoffrey Garen <ggaren@apple.com>
30869
30870 Reviewed by Maciej Stachowiak.
30871
30872 Fixed http://bugs.webkit.org/show_bug.cgi?id=15570
30873 Store gathered declaration nodes in the function body node.
30874
30875 This means that you only have to gather the declaration nodes the first
30876 time the function executes. Performance gain of 2.10% on SunSpider,
30877 0.90% on command-line JS iBench.
30878
30879 * kjs/nodes.cpp: Split declaration stack initialization code off into
30880 initializeDeclarationStacks().
30881 (FunctionBodyNode::FunctionBodyNode):
30882 (FunctionBodyNode::initializeDeclarationStacks):
30883 (FunctionBodyNode::processDeclarations):
30884
30885 * kjs/nodes.h: Changed DeclarationStacks structure to hold references,
30886 since the actual Vectors are now stored either on the stack or in the
30887 function body node.
30888
30889 2007-10-19 Geoffrey Garen <ggaren@apple.com>
30890
30891 Reviewed by Darin Adler.
30892
30893 http://bugs.webkit.org/show_bug.cgi?id=15559
30894 Moved processDeclarations call into FunctionBodyNode::execute
30895
30896 To improve encapsulation, moved processDeclarations call into
30897 FunctionBodyNode::execute. Also marked processDeclarations
30898 ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup
30899 on command-line JS iBench.
30900
30901 * kjs/function.cpp:
30902 (KJS::FunctionImp::callAsFunction):
30903 (KJS::GlobalFuncImp::callAsFunction):
30904 * kjs/function.h:
30905 * kjs/interpreter.cpp:
30906 (KJS::Interpreter::evaluate):
30907 * kjs/nodes.cpp:
30908 (FunctionBodyNode::execute):
30909 * kjs/nodes.h:
30910
30911 2007-10-19 Brady Eidson <beidson@apple.com>
30912
30913 Reviewed by Sam
30914
30915 Queue -> Deque! and small style tweaks
30916
30917 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
30918 * JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
30919 * wtf/Deque.h: Added.
30920 (WTF::DequeNode::DequeNode):
30921 (WTF::Deque::Deque):
30922 (WTF::Deque::~Deque):
30923 (WTF::Deque::size):
30924 (WTF::Deque::isEmpty):
30925 (WTF::Deque::append):
30926 (WTF::Deque::prepend):
30927 (WTF::Deque::first):
30928 (WTF::Deque::last):
30929 (WTF::Deque::removeFirst):
30930 (WTF::Deque::clear):
30931 * wtf/Queue.h: Removed.
30932
30933
30934 2007-10-19 Brady Eidson <beidson@apple.com>
30935
30936 Reviewed by Oliver
30937
30938 Added a simple LinkedList based Queue to wtf
30939 We can make a better, more sophisticated an efficient one later, but have
30940 needed one for some time, now!
30941
30942 * JavaScriptCore.xcodeproj/project.pbxproj:
30943 * wtf/Queue.h: Added.
30944 (WTF::QueueNode::QueueNode):
30945 (WTF::Queue::Queue):
30946 (WTF::Queue::~Queue):
30947 (WTF::Queue::size):
30948 (WTF::Queue::isEmpty):
30949 (WTF::Queue::append):
30950 (WTF::Queue::prepend):
30951 (WTF::Queue::first):
30952 (WTF::Queue::last):
30953 (WTF::Queue::removeFirst):
30954 (WTF::Queue::clear):
30955
30956 2007-10-19 Nikolas Zimmermann <zimmermann@kde.org>
30957
30958 Reviewed by Anders.
30959
30960 Try to fix Qt/Win build slave, by including windows.h also on Qt/Win.
30961
30962 * kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS)
30963
30964 2007-10-19 Simon Hausmann <hausmann@kde.org>
30965
30966 Reviewed by Lars.
30967
30968 Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-).
30969 Don't provide the wchar_t overloads then as they conflict with the unsigned short ones.
30970
30971 * wtf/ASCIICType.h:
30972 (WTF::isASCIIAlpha):
30973 (WTF::isASCIIAlphanumeric):
30974 (WTF::isASCIIDigit):
30975 (WTF::isASCIIHexDigit):
30976 (WTF::isASCIILower):
30977 (WTF::isASCIISpace):
30978 (WTF::toASCIILower):
30979 (WTF::toASCIIUpper):
30980
30981 2007-10-19 Simon Hausmann <hausmann@kde.org>
30982
30983 Reviewed by Lars.
30984
30985 Another build fix for the windows/qt build: Apply the same fix as in revision 26686 also to kjs/config.h to disable the disallowctype feature.
30986
30987 * kjs/config.h:
30988
30989 2007-10-18 Maciej Stachowiak <mjs@apple.com>
30990
30991 Reviewed by Adam.
30992
30993 - use __declspec(thread) for fast thread-local storage on Windows
30994
30995 - 2.2% speedup on sunspider (on Windows)
30996 - 7% speedup on the string section
30997 - 6% speedup on JS iBench
30998
30999 - fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422
31000 - fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10
31001
31002
31003 * wtf/FastMalloc.cpp:
31004 (WTF::getThreadHeap):
31005 (WTF::setThreadHeap):
31006 (WTF::TCMalloc_ThreadCache::GetCache):
31007 (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
31008 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
31009
31010 2007-10-17 Darin Adler <darin@apple.com>
31011
31012 Reviewed by Mark Rowe.
31013
31014 - fix http://bugs.webkit.org/show_bug.cgi?id=15543
31015 <rdar://problem/5545639> REGRESSION (r26697):
31016 GoogleDocs: Can't create new documents or open existing ones
31017
31018 Test: fast/js/regexp-non-character.html
31019
31020 * pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters
31021 in the \u sequences -- not needed and actively harmful.
31022
31023 2007-10-17 Anders Carlsson <andersca@apple.com>
31024
31025 Reviewed by Oliver.
31026
31027 * wtf/Platform.h:
31028 #define USE_PTHREADS on Mac.
31029
31030 2007-10-17 Geoffrey Garen <ggaren@apple.com>
31031
31032 Reviewed by Darin Adler.
31033
31034 Merged DeclaredFunctionImp into FunctionImp (the base class) because
31035 the distinction between the two was unused.
31036
31037 Removed codeType() from FunctionImp because FunctionImp and its
31038 subclasses all returned FunctionCode, so it was unused, practically
31039 speaking.
31040
31041 Removed a different codeType() from GlobalFuncImp because it was unused.
31042 (Perhaps it was vestigial from a time when GlobalFuncImp used to
31043 inherit from FunctionImp.)
31044
31045 * bindings/runtime_method.cpp:
31046 * bindings/runtime_method.h:
31047 * kjs/function.cpp:
31048 (KJS::FunctionImp::FunctionImp):
31049 (KJS::FunctionImp::callAsFunction):
31050 (KJS::FunctionImp::construct):
31051 (KJS::FunctionImp::execute):
31052 (KJS::FunctionImp::processVarDecls):
31053 * kjs/function.h:
31054 (KJS::FunctionImp::implementsConstruct):
31055 (KJS::FunctionImp::scope):
31056 * kjs/function_object.cpp:
31057 (FunctionProtoFunc::callAsFunction):
31058 (FunctionObjectImp::construct):
31059 * kjs/nodes.cpp:
31060 (FuncDeclNode::processFuncDecl):
31061 (FuncExprNode::evaluate):
31062
31063 2007-10-17 Adam Roben <aroben@apple.com>
31064
31065 Windows build fix part 2.
31066
31067 Fix was by Darin, reviewed by Anders and Adam.
31068
31069 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
31070 FastMallocPCRE.cpp to the project, and let Visual Studio have its way
31071 with the post-build step.
31072 * pcre/pcre.h: Don't DLL export the entry points just because this
31073 is Win32 -- this is an internal copy of PCRE and should be private.
31074 * pcre/pcre_compile.c: Fix an uninitialized variable warning --
31075 there's no real problem but it's better to quiet the compiler by
31076 tweaking the code slightly than turn off the warning entirely.
31077
31078 2007-10-17 Adam Roben <aroben@apple.com>
31079
31080 Windows build fix.
31081
31082 Reviewed by Anders.
31083
31084 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
31085 some mismatched signed/unsigned comparison warnings.
31086 * pcre/pcre_exec.c:
31087 (match): #if-out some labels that don't seem to exist.
31088
31089 2007-10-17 Mark Rowe <mrowe@apple.com>
31090
31091 Gtk build fix.
31092
31093 * JavaScriptCore.pri: Add FastMallocPCRE.cpp.
31094 * pcre/pcre_get. #if out two functions that depend on pcre_get_stringnumber, which
31095 is currently unavailable for UTF-16.
31096
31097 2007-10-16 Darin Adler <darin@apple.com>
31098
31099 Reviewed by Geoff.
31100
31101 - merged PCRE changes between 6.4 and 6.5
31102
31103 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
31104 * JavaScriptCore.xcodeproj/project.pbxproj:
31105 Removed pcre_config.c, pcre_globals.c, pcre_info.c, pcre_maketables.c,
31106 pcre_printint.src, pcre_refcount.c, pcre_study.c, pcre_try_flipped.c,
31107 pcre_ucp_findchar.c, pcre_version.c, and ucptable.c. Added pcre_ucp_searchfuncs.c.
31108
31109 * pcre/AUTHORS:
31110 * pcre/LICENCE:
31111 * pcre/MERGING:
31112 * pcre/dftables.c:
31113 * pcre/pcre-config.h:
31114 * pcre/pcre.h:
31115 * pcre/pcre.pri:
31116 * pcre/pcre_compile.c:
31117 * pcre/pcre_exec.c:
31118 * pcre/pcre_fullinfo.c:
31119 * pcre/pcre_get.c:
31120 * pcre/pcre_internal.h:
31121 * pcre/pcre_maketables.c:
31122 * pcre/pcre_ord2utf8.c:
31123 * pcre/pcre_tables.c:
31124 * pcre/pcre_ucp_searchfuncs.c: Copied from pcre/pcre_ucp_findchar.c.
31125 * pcre/pcre_xclass.c:
31126 * pcre/ucp.h:
31127 * pcre/ucpinternal.h:
31128 * pcre/ucptable.c:
31129 Updated with new versions from the PCRE 6.5 release, merged with changes.
31130
31131 * pcre/pcre_config.c: Removed.
31132 * pcre/pcre_globals.c: Removed.
31133 * pcre/pcre_info.c: Removed.
31134 * pcre/pcre_printint.src: Removed.
31135 * pcre/pcre_refcount.c: Removed.
31136 * pcre/pcre_study.c: Removed.
31137 * pcre/pcre_try_flipped.c: Removed.
31138 * pcre/pcre_ucp_findchar.c: Removed.
31139 * pcre/pcre_version.c: Removed.
31140
31141 2007-10-16 Geoffrey Garen <ggaren@apple.com>
31142
31143 Reviewed by Darin Adler.
31144
31145 Removed KJS_VERBOSE because it was getting in the way of readability,
31146 and the messages didn't seem very helpful.
31147
31148 * kjs/function.cpp:
31149 (KJS::FunctionImp::callAsFunction):
31150 (KJS::FunctionImp::passInParameters):
31151 * kjs/lookup.h:
31152 (KJS::lookupPut):
31153 * kjs/object.cpp:
31154 (KJS::JSObject::put):
31155 * kjs/value.h:
31156
31157 2007-10-16 Geoffrey Garen <ggaren@apple.com>
31158
31159 Reviewed by Darin Adler.
31160
31161 Removed the Parameter class because it was a redundant wrapper around
31162 Identifier.
31163
31164 * kjs/function.cpp:
31165 (KJS::FunctionImp::passInParameters):
31166 (KJS::FunctionImp::getParameterName):
31167 * kjs/nodes.cpp:
31168 (FunctionBodyNode::addParam):
31169 * kjs/nodes.h:
31170 (KJS::FunctionBodyNode::):
31171
31172 2007-10-16 Geoffrey Garen <ggaren@apple.com>
31173
31174 Reviewed by Darin Adler.
31175
31176 Global replace of assert with ASSERT.
31177
31178 2007-10-16 Adam Roben <aroben@apple.com>
31179
31180 Make testkjs not delay-load WebKit
31181
31182 Soon, delay-loading WebKit will be impossible (because we will be
31183 using __declspec(thread) for thread-local storage). This change
31184 prepares testkjs for the future.
31185
31186 Reviewed by Sam.
31187
31188 * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed WebKitInitializer,
31189 added FindSafari.
31190 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Don't link against
31191 WebKitInitializer, don't delay-load WebKit.
31192 * kjs/testkjs.cpp: Don't use WebKitInitializer.
31193
31194 2007-10-16 Adam Roben <aroben@apple.com>
31195
31196 Updated testkjs for the rename of WebKit_debug.dll to WebKit.dll for the Debug configuration
31197
31198 Reviewed by Kevin McCullough.
31199
31200 * JavaScriptCore.vcproj/debug.vsprops: Added WebKitDLLConfigSuffix.
31201 * JavaScriptCore.vcproj/debug_internal.vsprops: Ditto.
31202 * JavaScriptCore.vcproj/release.vsprops: Ditto.
31203 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Use
31204 WebKitDLLConfigSuffix when referring to WebKit.dll, and fixed a typo
31205 in the name of icuuc36[_debug].dll.
31206
31207 2007-10-16 Geoffrey Garen <ggaren@apple.com>
31208
31209 Reviewed by Maciej Stachowiak.
31210
31211 Re-structured variable and function declaration code.
31212
31213 Command-line JS iBench shows no regression.
31214
31215 Here are the changes:
31216
31217 1. Function declarations are now processed at the same time as var
31218 declarations -- namely, immediately upon entry to an execution context.
31219 This does not match Firefox, which waits to process a function
31220 declaration until the declaration's containing block executes, but it
31221 does match IE and the ECMA spec. (10.1.3 states that var and function
31222 declarations should be processed at the same time -- namely, "On
31223 entering an execution context." 12.2 states that "A Block does not
31224 define a new execution scope.")
31225
31226 2. Declaration processing proceeds iteratively now, rather than
31227 recursively, storing the nodes is finds in stacks. This will later
31228 facilitate an optimization to hold on to the gathered declaration nodes,
31229 rather than re-fetching them in every function call.
31230 [ http://bugs.webkit.org/show_bug.cgi?id=14868 ]
31231
31232 Modified these tests because they expected the incorrect Mozilla
31233 behavior described above:
31234
31235 * tests/mozilla/ecma_3/Function/scope-001.js:
31236 * tests/mozilla/js1_5/Scope/regress-184107.js:
31237
31238 2007-10-16 Darin Adler <darin@apple.com>
31239
31240 - try to fix the GTK build
31241
31242 * kjs/ustring.cpp: Include ASCIICType.h, not ASCIICtype.h.
31243
31244 2007-10-16 Darin Adler <darin@apple.com>
31245
31246 - try to fix the Windows build
31247
31248 * kjs/date_object.cpp: (KJS::parseDate): A couple instances of isspace were
31249 in here. Not sure why it wasn't failing elsewhere. Changed to isASCIISpace.
31250
31251 2007-10-16 Darin Adler <darin@apple.com>
31252
31253 - try to fix the GTK build
31254
31255 * kjs/ustring.cpp: Include ASCIICType.h.
31256
31257 2007-10-16 Darin Adler <darin@apple.com>
31258
31259 Reviewed by Maciej and Geoff (and looked over by Eric).
31260
31261 - http://bugs.webkit.org/show_bug.cgi?id=15519
31262 eliminate use of <ctype.h> for processing ASCII
31263
31264 * wtf/ASCIICType.h: Added.
31265 * wtf/DisallowCType.h: Added.
31266
31267 * kjs/config.h: Include DisallowCType.h.
31268
31269 * kjs/date_object.cpp:
31270 (KJS::skipSpacesAndComments):
31271 (KJS::findMonth):
31272 (KJS::parseDate):
31273 * kjs/function.cpp:
31274 (KJS::decode):
31275 * kjs/ustring.cpp:
31276 (KJS::UString::toDouble):
31277 Use ASCIICType.h functions instead of ctype.h ones.
31278
31279 2007-10-14 Maciej Stachowiak <mjs@apple.com>
31280
31281 Reviewed by Darin.
31282
31283 - fixes for "New JavaScript benchmark"
31284 http://bugs.webkit.org/show_bug.cgi?id=15515
31285
31286 * kjs/testkjs.cpp:
31287 (TestFunctionImp::callAsFunction): Implement "load" for compatibility
31288 with SpiderMonkey.
31289 (TestFunctionImp::): ditto
31290 (doIt): ditto
31291 (kjsmain): Drop useless --> from output.
31292
31293 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31294
31295 Removed unnecessary #include.
31296
31297 * API/JSObjectRef.cpp:
31298
31299 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31300
31301 Double-reverse build fix. My tree was out of date.
31302
31303 * kjs/nodes.cpp:
31304 (NumberNode::evaluate):
31305
31306 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31307
31308 Build fix.
31309
31310 * kjs/nodes.cpp:
31311 (NumberNode::evaluate):
31312
31313 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31314
31315 Reviewed by Darin Adler.
31316
31317 Removed surprising self-named "hack" that made nested functions
31318 available as named properties of their containing functions, and placed
31319 containing function objects in the scope chains of nested functions.
31320
31321 There were a few reasons to remove this "hack:"
31322
31323 1. It contradicted FF, IE, and the ECMA spec.
31324
31325 2. It incurred a performance penalty, since merely parsing a function
31326 required parsing its body for nested functions (and so on).
31327
31328 3. SVN history contains no explanation for why it was added. It was just
31329 legacy code in a large merge a long, long time ago.
31330
31331 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
31332
31333 * kjs/nodes.cpp:
31334 (FuncDeclNode::processFuncDecl):
31335
31336 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31337
31338 Reviewed by Darin Adler.
31339
31340 Removed the concept of AnonymousCode. It was unused, and it doesn't
31341 exist in the ECMA spec.
31342
31343 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
31344
31345 * kjs/Context.cpp:
31346 (KJS::Context::Context):
31347 * kjs/function.h:
31348 * kjs/nodes.cpp:
31349 (ReturnNode::execute):
31350
31351 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31352
31353 Reviewed by Darin Adler.
31354
31355 Made function parameters DontDelete. This matches FF and the vague
31356 description in ECMA 10.1.3. It's also required in order to make
31357 symbol table based lookup of function parameters valid. (If the
31358 parameters aren't DontDelete, you can't guarantee that you'll find
31359 them later in the symbol table.)
31360
31361 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
31362
31363 * kjs/function.cpp:
31364 (KJS::FunctionImp::passInParameters):
31365
31366 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31367
31368 Reviewed by Maciej Stachowiak.
31369
31370 Some Vector optimizations. These are especially important when using
31371 Vector as a stack for implementing recursive algorithms iteratively.
31372
31373 [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
31374
31375 1. Added shrink(), which is a version of resize() that you can call
31376 to save a branch / improve code generation and inlining when you know
31377 that the vector is not getting bigger.
31378
31379 2. Changed subclassing relationship in VectorBuffer to remove a call to
31380 fastFree() in the destructor for the inlineCapacity != 0 template
31381 specialization. This brings inline Vectors one step closer to true
31382 stack-allocated arrays.
31383
31384 Also changed abort() to CRASH(), since the latter works better.
31385
31386 * wtf/Vector.h:
31387 (WTF::VectorBufferBase::allocateBuffer):
31388 (WTF::VectorBufferBase::deallocateBuffer):
31389 (WTF::VectorBufferBase::VectorBufferBase):
31390 (WTF::VectorBufferBase::~VectorBufferBase):
31391 (WTF::):
31392 (WTF::VectorBuffer::VectorBuffer):
31393 (WTF::VectorBuffer::~VectorBuffer):
31394 (WTF::VectorBuffer::deallocateBuffer):
31395 (WTF::VectorBuffer::releaseBuffer):
31396 (WTF::Vector::clear):
31397 (WTF::Vector::removeLast):
31398 (WTF::::operator):
31399 (WTF::::fill):
31400 (WTF::::shrink):
31401
31402 2007-10-12 Geoffrey Garen <ggaren@apple.com>
31403
31404 Reviewed by Maciej Stachowiak.
31405
31406 Fixed http://bugs.webkit.org/show_bug.cgi?id=15490
31407 Iteration statements sometimes incorrectly evaluate to the empty value
31408 (KDE r670547).
31409
31410 [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
31411
31412 This patch is a merge of KDE r670547, with substantial modification
31413 for performance.
31414
31415 It fixes do-while statements to evaluate to a value. (They used
31416 to evaluate to the empty value in all cases.)
31417
31418 It also fixes SourceElementsNode to maintain the value of abnormal
31419 completions like "break" and "continue."
31420
31421 It also re-works the main execution loop in SourceElementsNode so that
31422 it (1) makes a little more sense and (2) avoids unnecessary work. This
31423 is a .28% speedup on command-line JS iBench.
31424
31425 * kjs/nodes.cpp:
31426 (DoWhileNode::execute):
31427 (SourceElementsNode::execute):
31428
31429 2007-10-15 Simon Hausmann <hausmann@kde.org>
31430
31431 Reviewed by Lars.
31432
31433 Fix compilation with gcc 4.3 by including 'limits' due to the use of std::numeric_limits.
31434
31435 * wtf/HashTraits.h:
31436
31437 2007-10-5 Kevin Ollivier <kevino@theolliviers.com>
31438
31439 Reviewed by Adam.
31440
31441 Add support for MSVC7, and fix cases where PLATFORM(WIN) should
31442 be PLATFORM(WIN_OS) for other ports building on Windows.
31443
31444 * kjs/DateMath.cpp:
31445 (KJS::getDSTOffsetSimple):
31446 * kjs/JSImmediate.h:
31447 * wtf/Assertions.cpp:
31448 * wtf/Assertions.h:
31449 * wtf/Platform.h:
31450 * wtf/StringExtras.h:
31451 (snprintf):
31452 (vsnprintf):
31453
31454 2007-10-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
31455
31456 Reviewed by Darin.
31457
31458 Adds NegateNode optimization from KJS. The relevant revision in KDE
31459 is 666736.
31460
31461 * kjs/grammar.y:
31462 * kjs/nodes.cpp:
31463 (NumberNode::evaluate):
31464 * kjs/nodes.h:
31465 (KJS::Node::):
31466 (KJS::NumberNode::):
31467 * kjs/nodes2string.cpp:
31468 (NumberNode::streamTo):
31469
31470 2007-10-14 Jason Foreman <jason@threeve.org>
31471
31472 Reviewed by Maciej.
31473
31474 Fix http://bugs.webkit.org/show_bug.cgi?id=15145
31475
31476 Ensure that if adjusting n to minimize the difference of n*intPow10(e-p+1) to x,
31477 that the property n < intPow10(p) is maintained.
31478
31479 * kjs/number_object.cpp:
31480 (NumberProtoFunc::callAsFunction):
31481
31482 == Rolled over to ChangeLog-2007-10-14 ==