1 2007-11-08 Oliver Hunt <oliver@apple.com>
5 Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
7 The implementation of JSImmediate::areBothImmediateNumbers relies on
8 (JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having
9 a unique result when both immediate values are numbers.
11 The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
12 By swapping the value of NumberType and UndefinedType this ceases to be a problem.
17 2007-11-08 Darin Adler <darin@apple.com>
21 * kjs/nodes.h: Add missing parameter name.
23 2007-11-08 Eric Seidel <eric@webkit.org>
27 Add ExpressionNode subclass of Node, use it.
31 (KJS::ForInNode::ForInNode):
33 (KJS::ExpressionNode::):
35 (KJS::NullNode::precedence):
37 (KJS::BooleanNode::precedence):
39 (KJS::RegExpNode::precedence):
41 (KJS::ThisNode::precedence):
45 (KJS::PropertyNode::):
46 (KJS::PropertyNode::precedence):
47 (KJS::PropertyNode::name):
48 (KJS::PropertyListNode::):
49 (KJS::ObjectLiteralNode::):
50 (KJS::ObjectLiteralNode::precedence):
51 (KJS::BracketAccessorNode::):
52 (KJS::DotAccessorNode::):
53 (KJS::DotAccessorNode::precedence):
54 (KJS::ArgumentListNode::):
55 (KJS::ArgumentsNode::):
57 (KJS::NewExprNode::precedence):
58 (KJS::FunctionCallValueNode::):
59 (KJS::FunctionCallValueNode::precedence):
60 (KJS::FunctionCallResolveNode::):
61 (KJS::FunctionCallBracketNode::):
62 (KJS::FunctionCallBracketNode::precedence):
63 (KJS::FunctionCallDotNode::):
64 (KJS::FunctionCallDotNode::precedence):
65 (KJS::PrePostResolveNode::):
66 (KJS::PostfixBracketNode::):
67 (KJS::PostfixBracketNode::precedence):
68 (KJS::PostIncBracketNode::):
69 (KJS::PostIncBracketNode::isIncrement):
70 (KJS::PostDecBracketNode::):
71 (KJS::PostDecBracketNode::isIncrement):
72 (KJS::PostfixDotNode::):
73 (KJS::PostfixDotNode::precedence):
74 (KJS::PostIncDotNode::):
75 (KJS::PostIncDotNode::isIncrement):
76 (KJS::PostDecDotNode::):
77 (KJS::PostDecDotNode::isIncrement):
78 (KJS::PostfixErrorNode::):
79 (KJS::PostfixErrorNode::precedence):
80 (KJS::DeleteResolveNode::):
81 (KJS::DeleteBracketNode::):
82 (KJS::DeleteBracketNode::precedence):
83 (KJS::DeleteDotNode::):
84 (KJS::DeleteDotNode::precedence):
85 (KJS::DeleteValueNode::):
86 (KJS::DeleteValueNode::precedence):
88 (KJS::VoidNode::precedence):
89 (KJS::TypeOfResolveNode::):
90 (KJS::TypeOfValueNode::):
91 (KJS::PrefixBracketNode::):
92 (KJS::PrefixBracketNode::precedence):
93 (KJS::PreIncBracketNode::):
94 (KJS::PreIncBracketNode::isIncrement):
95 (KJS::PreDecBracketNode::):
96 (KJS::PreDecBracketNode::isIncrement):
97 (KJS::PrefixDotNode::):
98 (KJS::PrefixDotNode::precedence):
99 (KJS::PreIncDotNode::):
100 (KJS::PreIncDotNode::isIncrement):
101 (KJS::PreDecDotNode::):
102 (KJS::PreDecDotNode::isIncrement):
103 (KJS::PrefixErrorNode::):
104 (KJS::PrefixErrorNode::precedence):
105 (KJS::UnaryPlusNode::):
106 (KJS::UnaryPlusNode::precedence):
108 (KJS::NegateNode::precedence):
109 (KJS::BitwiseNotNode::):
110 (KJS::BitwiseNotNode::precedence):
111 (KJS::LogicalNotNode::):
112 (KJS::LogicalNotNode::precedence):
114 (KJS::AddNode::precedence):
115 (KJS::LeftShiftNode::):
116 (KJS::LeftShiftNode::precedence):
117 (KJS::RightShiftNode::):
118 (KJS::RightShiftNode::precedence):
119 (KJS::UnsignedRightShiftNode::):
120 (KJS::UnsignedRightShiftNode::precedence):
122 (KJS::LessNode::precedence):
123 (KJS::GreaterNode::):
124 (KJS::GreaterNode::precedence):
126 (KJS::LessEqNode::precedence):
127 (KJS::GreaterEqNode::):
128 (KJS::GreaterEqNode::precedence):
129 (KJS::InstanceOfNode::):
130 (KJS::InstanceOfNode::precedence):
132 (KJS::InNode::precedence):
134 (KJS::EqualNode::precedence):
135 (KJS::NotEqualNode::):
136 (KJS::NotEqualNode::precedence):
137 (KJS::StrictEqualNode::):
138 (KJS::StrictEqualNode::precedence):
139 (KJS::NotStrictEqualNode::):
140 (KJS::NotStrictEqualNode::precedence):
142 (KJS::BitAndNode::precedence):
144 (KJS::BitOrNode::precedence):
146 (KJS::BitXOrNode::precedence):
147 (KJS::LogicalAndNode::):
148 (KJS::LogicalAndNode::precedence):
149 (KJS::LogicalOrNode::):
150 (KJS::LogicalOrNode::precedence):
151 (KJS::ConditionalNode::):
152 (KJS::ConditionalNode::precedence):
153 (KJS::ReadModifyResolveNode::):
154 (KJS::ReadModifyResolveNode::precedence):
155 (KJS::AssignResolveNode::):
156 (KJS::AssignResolveNode::precedence):
157 (KJS::ReadModifyBracketNode::):
158 (KJS::ReadModifyBracketNode::precedence):
159 (KJS::AssignBracketNode::):
160 (KJS::AssignBracketNode::precedence):
161 (KJS::AssignDotNode::):
162 (KJS::AssignDotNode::precedence):
163 (KJS::ReadModifyDotNode::):
164 (KJS::ReadModifyDotNode::precedence):
165 (KJS::AssignErrorNode::):
166 (KJS::AssignErrorNode::precedence):
168 (KJS::CommaNode::precedence):
169 (KJS::AssignExprNode::):
170 (KJS::AssignExprNode::precedence):
171 (KJS::ExprStatementNode::):
173 (KJS::DoWhileNode::):
178 (KJS::ParameterNode::):
179 (KJS::CaseClauseNode::):
180 (KJS::CaseClauseNode::precedence):
181 (KJS::ClauseListNode::):
184 2007-11-08 Oliver Hunt <oliver@apple.com>
188 Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
190 This only improves bitwise-and performance, as the additional logic required
191 for similar code paths on or, xor, and shifting requires additional operations
192 and branches that negate (and in certain cases, regress) any advantage we might
195 This improves performance on all bitop tests, the cryptography tests, as well as
196 the string-base64 and string-unpack-code tests. No significant degradation on
200 (KJS::JSImmediate::areBothImmediateNumbers):
201 (KJS::JSImmediate::andImmediateNumbers):
203 (KJS::BitAndNode::evaluate):
205 (KJS::jsNumberFromAnd):
207 2007-11-08 Adam Roben <aroben@apple.com>
209 Stop using KJS inside of MathExtras.h
213 * wtf/MathExtras.h: Removed an unused header, and a now-unused
215 (wtf_atan2): Use std::numeric_limits intead of KJS.
217 2007-11-08 Sam Weinig <sam@webkit.org>
221 * kjs/date_object.cpp:
222 (KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
223 (KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
224 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
226 2007-11-08 Mark Rowe <mrowe@apple.com>
230 * kjs/lookup.h: Add missing include.
232 2007-11-08 Sam Weinig <sam@webkit.org>
236 Convert JavaScript internal function objects to use one class per
237 function. This avoids a switch statement inside what used to be
238 the shared function classes and will allow Shark to better analyze
241 To make this switch, the value property of the HashEntry was changed
242 to a union of an intptr_t (which is used to continue handle valueGetters)
243 and function pointer which points to a static constructor for the
244 individual new function objects.
246 SunSpider claims this is a 1.0% speedup.
248 * kjs/array_object.cpp:
249 (KJS::ArrayPrototype::getOwnPropertySlot):
251 (KJS::ArrayProtoFuncToString::callAsFunction):
252 (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
253 (KJS::ArrayProtoFuncJoin::callAsFunction):
254 (KJS::ArrayProtoFuncConcat::callAsFunction):
255 (KJS::ArrayProtoFuncPop::callAsFunction):
256 (KJS::ArrayProtoFuncPush::callAsFunction):
257 (KJS::ArrayProtoFuncReverse::callAsFunction):
258 (KJS::ArrayProtoFuncShift::callAsFunction):
259 (KJS::ArrayProtoFuncSlice::callAsFunction):
260 (KJS::ArrayProtoFuncSort::callAsFunction):
261 (KJS::ArrayProtoFuncSplice::callAsFunction):
262 (KJS::ArrayProtoFuncUnShift::callAsFunction):
263 (KJS::ArrayProtoFuncFilter::callAsFunction):
264 (KJS::ArrayProtoFuncMap::callAsFunction):
265 (KJS::ArrayProtoFuncEvery::callAsFunction):
266 (KJS::ArrayProtoFuncForEach::callAsFunction):
267 (KJS::ArrayProtoFuncSome::callAsFunction):
268 (KJS::ArrayProtoFuncIndexOf::callAsFunction):
269 (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
270 * kjs/array_object.h:
271 (KJS::ArrayPrototype::classInfo):
272 * kjs/create_hash_table:
273 * kjs/date_object.cpp:
274 (KJS::DatePrototype::getOwnPropertySlot):
275 (KJS::DateProtoFuncToString::callAsFunction):
276 (KJS::DateProtoFuncToUTCString::callAsFunction):
277 (KJS::DateProtoFuncToDateString::callAsFunction):
278 (KJS::DateProtoFuncToTimeString::callAsFunction):
279 (KJS::DateProtoFuncToLocaleString::callAsFunction):
280 (KJS::DateProtoFuncToLocaleDateString::callAsFunction):
281 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
282 (KJS::DateProtoFuncValueOf::callAsFunction):
283 (KJS::DateProtoFuncGetTime::callAsFunction):
284 (KJS::DateProtoFuncGetFullYear::callAsFunction):
285 (KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
286 (KJS::DateProtoFuncToGMTString::callAsFunction):
287 (KJS::DateProtoFuncGetMonth::callAsFunction):
288 (KJS::DateProtoFuncGetUTCMonth::callAsFunction):
289 (KJS::DateProtoFuncGetDate::callAsFunction):
290 (KJS::DateProtoFuncGetUTCDate::callAsFunction):
291 (KJS::DateProtoFuncGetDay::callAsFunction):
292 (KJS::DateProtoFuncGetUTCDay::callAsFunction):
293 (KJS::DateProtoFuncGetHours::callAsFunction):
294 (KJS::DateProtoFuncGetUTCHours::callAsFunction):
295 (KJS::DateProtoFuncGetMinutes::callAsFunction):
296 (KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
297 (KJS::DateProtoFuncGetSeconds::callAsFunction):
298 (KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
299 (KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
300 (KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
301 (KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
302 (KJS::DateProtoFuncSetTime::callAsFunction):
303 (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
304 (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
305 (KJS::DateProtoFuncSetSeconds::callAsFunction):
306 (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
307 (KJS::DateProtoFuncSetMinutes::callAsFunction):
308 (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
309 (KJS::DateProtoFuncSetHours::callAsFunction):
310 (KJS::DateProtoFuncSetUTCHours::callAsFunction):
311 (KJS::DateProtoFuncSetDate::callAsFunction):
312 (KJS::DateProtoFuncSetUTCDate::callAsFunction):
313 (KJS::DateProtoFuncSetMonth::callAsFunction):
314 (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
315 (KJS::DateProtoFuncSetFullYear::callAsFunction):
316 (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
317 (KJS::DateProtoFuncSetYear::callAsFunction):
318 (KJS::DateProtoFuncGetYear::callAsFunction):
324 (KJS::staticFunctionGetter):
325 (KJS::staticValueGetter):
326 (KJS::getStaticPropertySlot):
327 (KJS::getStaticFunctionSlot):
329 * kjs/math_object.cpp:
330 (KJS::MathObjectImp::getOwnPropertySlot):
331 (KJS::MathProtoFuncAbs::callAsFunction):
332 (KJS::MathProtoFuncACos::callAsFunction):
333 (KJS::MathProtoFuncASin::callAsFunction):
334 (KJS::MathProtoFuncATan::callAsFunction):
335 (KJS::MathProtoFuncATan2::callAsFunction):
336 (KJS::MathProtoFuncCeil::callAsFunction):
337 (KJS::MathProtoFuncCos::callAsFunction):
338 (KJS::MathProtoFuncExp::callAsFunction):
339 (KJS::MathProtoFuncFloor::callAsFunction):
340 (KJS::MathProtoFuncLog::callAsFunction):
341 (KJS::MathProtoFuncMax::callAsFunction):
342 (KJS::MathProtoFuncMin::callAsFunction):
343 (KJS::MathProtoFuncPow::callAsFunction):
344 (KJS::MathProtoFuncRandom::callAsFunction):
345 (KJS::MathProtoFuncRound::callAsFunction):
346 (KJS::MathProtoFuncSin::callAsFunction):
347 (KJS::MathProtoFuncSqrt::callAsFunction):
348 (KJS::MathProtoFuncTan::callAsFunction):
350 (KJS::MathObjectImp::classInfo):
351 (KJS::MathObjectImp::):
352 * kjs/string_object.cpp:
353 (KJS::StringPrototype::getOwnPropertySlot):
354 (KJS::StringProtoFuncToString::callAsFunction):
355 (KJS::StringProtoFuncValueOf::callAsFunction):
356 (KJS::StringProtoFuncCharAt::callAsFunction):
357 (KJS::StringProtoFuncCharCodeAt::callAsFunction):
358 (KJS::StringProtoFuncConcat::callAsFunction):
359 (KJS::StringProtoFuncIndexOf::callAsFunction):
360 (KJS::StringProtoFuncLastIndexOf::callAsFunction):
361 (KJS::StringProtoFuncMatch::callAsFunction):
362 (KJS::StringProtoFuncSearch::callAsFunction):
363 (KJS::StringProtoFuncReplace::callAsFunction):
364 (KJS::StringProtoFuncSlice::callAsFunction):
365 (KJS::StringProtoFuncSplit::callAsFunction):
366 (KJS::StringProtoFuncSubstr::callAsFunction):
367 (KJS::StringProtoFuncSubstring::callAsFunction):
368 (KJS::StringProtoFuncToLowerCase::callAsFunction):
369 (KJS::StringProtoFuncToUpperCase::callAsFunction):
370 (KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
371 (KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
372 (KJS::StringProtoFuncLocaleCompare::callAsFunction):
373 (KJS::StringProtoFuncBig::callAsFunction):
374 (KJS::StringProtoFuncSmall::callAsFunction):
375 (KJS::StringProtoFuncBlink::callAsFunction):
376 (KJS::StringProtoFuncBold::callAsFunction):
377 (KJS::StringProtoFuncFixed::callAsFunction):
378 (KJS::StringProtoFuncItalics::callAsFunction):
379 (KJS::StringProtoFuncStrike::callAsFunction):
380 (KJS::StringProtoFuncSub::callAsFunction):
381 (KJS::StringProtoFuncSup::callAsFunction):
382 (KJS::StringProtoFuncFontcolor::callAsFunction):
383 (KJS::StringProtoFuncFontsize::callAsFunction):
384 (KJS::StringProtoFuncAnchor::callAsFunction):
385 (KJS::StringProtoFuncLink::callAsFunction):
386 * kjs/string_object.h:
388 2007-11-08 Adam Roben <aroben@apple.com>
392 Reviewed by Sam and Ada.
394 * wtf/MathExtras.h: Get rid of a circular #include dependency to fix
397 2007-11-08 Adam Roben <aroben@apple.com>
399 Fix a precedence warning on Windows
402 (KJS::JSImmediate::toBoolean):
404 2007-11-08 Mark Rowe <mrowe@apple.com>
406 Build fix for JavaScriptGlue.
408 * wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
410 2007-11-08 Darin Adler <darin@apple.com>
414 * kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
416 2007-11-08 Oliver Hunt <oliver@apple.com>
420 Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
422 Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
423 we should now have faster array access, faster immediate to double conversion, and the
424 potential to further improve bitwise operators in future.
426 This also removes the need for unions to avoid strict aliasing problems when extracting
427 a value from immediates.
431 (KJS::JSImmediate::trueImmediate):
432 (KJS::JSImmediate::falseImmediate):
433 (KJS::JSImmediate::undefinedImmediate):
434 (KJS::JSImmediate::nullImmediate):
435 (KJS::JSImmediate::toBoolean):
439 2007-11-07 Eric Seidel <eric@webkit.org>
441 Reviewed by Darin and Oliver.
443 Add evaluateToNumber parallel evaluation tree to speed up number operations.
444 Make ImmediateNumberNode a subclass of NumberNode.
445 Share evaluate logic between evaluate and evaluateToNumber using inline functions
446 There is still a lot of improvement to be made here.
448 SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
449 Given the huge win that this prepares us for with simple type inferencing I see the small
450 regression in base64 being worth the substantial overall improvement.
454 (KJS::Node::evaluateToNumber):
455 (KJS::NumberNode::evaluate):
456 (KJS::NumberNode::evaluateToNumber):
457 (KJS::StringNode::evaluateToNumber):
458 (KJS::LocalVarAccessNode::inlineEvaluate):
459 (KJS::LocalVarAccessNode::evaluate):
460 (KJS::LocalVarAccessNode::evaluateToNumber):
461 (KJS::BracketAccessorNode::inlineEvaluate):
462 (KJS::BracketAccessorNode::evaluate):
463 (KJS::BracketAccessorNode::evaluateToNumber):
464 (KJS::NegateNode::evaluate):
465 (KJS::NegateNode::evaluateToNumber):
466 (KJS::MultNode::inlineEvaluateToNumber):
467 (KJS::MultNode::evaluate):
468 (KJS::MultNode::evaluateToNumber):
469 (KJS::DivNode::inlineEvaluateToNumber):
470 (KJS::DivNode::evaluate):
471 (KJS::DivNode::evaluateToNumber):
472 (KJS::ModNode::inlineEvaluateToNumber):
473 (KJS::ModNode::evaluate):
474 (KJS::ModNode::evaluateToNumber):
475 (KJS::throwOutOfMemoryErrorToNumber):
476 (KJS::addSlowCaseToNumber):
479 (KJS::AddNode::evaluateToNumber):
480 (KJS::SubNode::inlineEvaluateToNumber):
481 (KJS::SubNode::evaluate):
482 (KJS::SubNode::evaluateToNumber):
483 (KJS::valueForReadModifyAssignment):
484 (KJS::ReadModifyLocalVarNode::evaluate):
485 (KJS::ReadModifyResolveNode::evaluate):
486 (KJS::ReadModifyDotNode::evaluate):
487 (KJS::ReadModifyBracketNode::evaluate):
491 (KJS::ImmediateNumberNode::):
492 (KJS::AddNode::precedence):
493 * kjs/nodes2string.cpp:
494 (KJS::NumberNode::streamTo):
496 2007-11-07 Mark Rowe <mrowe@apple.com>
500 Fix up initialization after being mangled in r27572, and remove the
501 ternary expression as extraCost will always be zero for the numeric
505 (KJS::Collector::heapAllocate):
507 2007-11-07 Mark Rowe <mrowe@apple.com>
511 * kjs/regexp_object.cpp:
513 2007-11-07 Geoffrey Garen <ggaren@apple.com>
515 Reviewed by Beth Dakin.
517 Eliminated a bogus (though compiled-out) branch in the collector.
520 (KJS::Collector::heapAllocate):
522 2007-11-06 Geoffrey Garen <ggaren@apple.com>
524 Reviewed by Darin Adler.
526 Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861
527 5.8% of string-validate-input.js is spent creating RegExpImps
529 Put RegExpImp properties into a static hashtable to avoid a slew of
530 PropertyMap churn when creating a RegExpImp.
532 Factored important bits of regular expression implementation out of
533 RegExpImp (the JS object) and into RegExp (the PCRE wrapper class),
534 making RegExp a ref-counted class. (This will help later.)
536 Removed PCRE_POSIX support because I didn't quite know how to test it
537 and keep it working with these changes.
539 1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
541 * kjs/regexp.h: A few interface changes:
542 1. Renamed "subpatterns()" => "numSubpatterns()"
543 2. Made flag enumeration private and replaced it with public getters for
545 3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
546 4. Made RegExp take a string of flags instead of an int, eliminating
547 duplicated flag parsing code elsewhere.
549 * kjs/regexp_object.cpp:
550 (KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile:
551 - Fixed a bug where compile(undefined) would throw an exception.
552 - Removed some now-redundant code.
553 - Used RegExp sharing to eliminate an allocation and a bunch of
554 PropertyMap thrash. (Not a big win since compile is a deprecated
555 function. I mainly did this to test the plubming.)
557 2007-11-07 Simon Hausmann <hausmann@kde.org>
559 Reviewed by nobody, Qt/Windows build fix.
561 JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
562 testkjs.pro, too, where it's included from.
566 2007-11-07 Simon Hausmann <shausman@trolltech.com>
570 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.
572 * JavaScriptCore.pri:
575 2007-11-07 Lars Knoll <lars@trolltech.com>
581 Pretty embarrassing bug. Has the potential to fix quite a few test failures.
583 * wtf/unicode/qt4/UnicodeQt4.h:
584 (WTF::Unicode::umemcasecmp):
586 2007-11-06 Maciej Stachowiak <mjs@apple.com>
590 - only collect when the heap is full, unless we have lots of extra cost garbage
592 1.1% SunSpider speedup.
594 This shouldn't hit memory use much since the extra space in those
595 blocks hangs around either way.
598 (KJS::Collector::heapAllocate):
599 (KJS::Collector::collect): Fix logic error that reversed the sense of collect's
602 2007-11-06 Oliver Hunt <oliver@apple.com>
606 Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
608 We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
609 'for (...; ...; ++<var>) ...'.
612 (KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
613 (KJS::PostIncLocalVarNode::evaluate):
614 (KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
615 (KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
616 (KJS::PostDecLocalVarNode::evaluate):
617 (KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
619 (KJS::PrePostResolveNode::):
620 (KJS::PostIncResolveNode::):
621 (KJS::PostIncLocalVarNode::):
622 (KJS::PostDecResolveNode::):
623 (KJS::PostDecLocalVarNode::):
624 (KJS::PreIncResolveNode::):
625 (KJS::PreDecResolveNode::):
626 (KJS::ForNode::ForNode):
628 2007-11-06 Eric Seidel <eric@webkit.org>
632 This fixes a regressed layout test for string + object
634 SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
637 (KJS::add): remove erroneous "fast path" for string + *
639 2007-11-06 Geoffrey Garen <ggaren@apple.com>
641 Reviewed by Eric Seidel.
643 Added toJSNumber, a fast path for converting a JSValue to a JS number,
644 and deployed it in postfix expressions. In the fast case this
645 eliminates a call to jsNumber.
647 0.4% speedup on SunSpider.
651 (KJS::PostIncResolveNode::evaluate):
652 (KJS::PostIncLocalVarNode::evaluate):
653 (KJS::PostDecResolveNode::evaluate):
654 (KJS::PostDecLocalVarNode::evaluate):
655 (KJS::PostIncBracketNode::evaluate):
656 (KJS::PostDecBracketNode::evaluate):
657 (KJS::PostIncDotNode::evaluate):
658 (KJS::PostDecDotNode::evaluate):
659 (KJS::UnaryPlusNode::evaluate):
661 (KJS::JSValue::toJSNumber):
663 2007-11-06 Darin Adler <darin@apple.com>
667 - http://bugs.webkit.org/show_bug.cgi?id=15846
668 REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
670 There was a mistake in the algorithm used to find an empty slot in the property
671 map entries vector; when we were putting in a new property value and not overwriting
672 an existing deleted sentinel, we would enlarge the entries vector, but would not
673 overwrite the stale data that's in the new part. It was easy to pin this down by
674 turning on property map consistency checks -- I never would have landed with this
675 bug if I had run the regression tests once with consistency checks on!
677 * kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
678 foundDeletedElement is false to always use the item at the end of the entries vector.
679 Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
681 2007-11-06 Oliver Hunt <oliver@apple.com>
685 Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
690 2007-11-06 Oliver Hunt <oliver@apple.com>
694 Replace boolean comparisons in AddNode with mask
695 comparisons for a 0.2% improvement in sunspider.
697 * JavaScriptCore.xcodeproj/project.pbxproj:
701 2007-11-06 Eric Seidel <eric@webkit.org>
705 SunSpider claims this is a 1.1% speedup.
708 (KJS::throwOutOfMemoryError): Added, non inline.
709 (KJS::addSlowCase): renamed from add(), non inline.
710 (KJS::add): add fast path for String + String, Number + Number and String + *
712 2007-11-06 Eric Seidel <eric@webkit.org>
716 Avoid more UString creation.
718 SunSpider claims this is a 0.4% speedup.
720 * kjs/regexp_object.cpp:
721 (KJS::RegExpObjectImp::construct): use UString::find(UChar)
723 2007-11-05 Mark Rowe <mrowe@apple.com>
727 * kjs/array_object.cpp:
728 (KJS::ArrayProtoFunc::callAsFunction):
730 2007-11-05 Adam Roben <aroben@apple.com>
736 2007-11-05 Mark Rowe <mrowe@apple.com>
738 Build fix. Add missing #include.
740 * kjs/operations.cpp:
742 2007-11-05 Eric Seidel <eric@webkit.org>
746 Remove another call to toString(exec)
748 SunSpider claims this is a 0.5% speedup.
750 * kjs/operations.cpp:
751 (KJS::equal): remove another toString
753 2007-11-05 Eric Seidel <eric@webkit.org>
755 * kjs/operations.cpp:
756 (KJS::equal): correct broken change.
758 2007-11-05 Eric Seidel <eric@webkit.org>
762 Remove one more call to toString(exec).
764 SunSpider claims this is a 0.7% speedup.
766 * kjs/operations.cpp:
767 (KJS::equal): remove a call to toString()
769 2007-11-05 Mark Rowe <mrowe@apple.com>
775 2007-11-05 Mark Rowe <mrowe@apple.com>
781 2007-11-05 Geoffrey Garen <ggaren@apple.com>
783 Touched a file to test my new HTTP access.
785 * kjs/scope_chain.cpp:
787 2007-11-05 Alp Toker <alp@atoker.com>
789 Unreviewed build fix for qmake-based ports.
791 Someone with a better understanding of qmake still needs to sort out
792 the INCLUDEPATH/DEPENDPATH mess.
794 * JavaScriptCore.pri:
796 2007-11-05 Geoffrey Garen <ggaren@apple.com>
798 Reviewed by Darin Adler.
800 http://bugs.webkit.org/show_bug.cgi?id=15835
802 Switched List implementation from a custom heap allocator to an inline
803 Vector, for a disappointing .5% SunSpider speedup.
805 Also renamed List::slice to List::getSlice because "get" is the
806 conventional prefix for functions returning a value through an out
809 * kjs/array_object.cpp:
810 (KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
811 calls and memory accesses.
813 * kjs/bool_object.cpp:
814 (BooleanObjectImp::construct): Removed questionable use of iterator.
817 * kjs/list.h: New List class, implemented in terms of Vector. Two
818 interesting differences:
819 1. The inline capacity is 8, not 5. Many of the Lists constructed
820 during a SunSpider run are larger than 5; almost none are larger
823 2. The growth factor is 4, not 2. Since we can guarantee that Lists
824 aren't long-lived, we can grow them more aggressively, to avoid
827 * kjs/regexp_object.cpp:
828 (RegExpObjectImp::construct): Removed redundant function calls.
830 * kjs/string_object.cpp:
831 (KJS::StringObjectImp::construct): Removed questionable use of iterator.
834 (WTF::::uncheckedAppend): Added a fast, unchecked version of append.
836 2007-11-05 Mark Rowe <mrowe@apple.com>
838 Reviewed by Alp Toker.
840 Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
842 * JavaScriptCore.pri:
845 2007-11-04 Darin Adler <darin@apple.com>
849 - http://bugs.webkit.org/show_bug.cgi?id=15826
850 optimize opcode loop and case insensitive ASCII compares for a 30% speedup
852 SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
854 * pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
856 * pcre/pcre_compile.c:
857 (find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
858 added OP_NOT since there was no reason it should not be in here.
859 (could_be_empty_branch): Ditto.
860 (compile_branch): Streamlined all the single-character cases; there was a bit of
861 duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
862 But in particular, compile to those opcodes when the single character match is
864 (find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
866 * pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
867 the matchframe, after I discovered that none of them needed to be saved and restored
868 across recursive match calls. Also eliminated the ignored result field from the
869 matchframe, since I discovered that rrc ("recursive result code") was already the
870 exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
871 statement of the switch instead of doing them before the switch. This removes a
872 branch from each iteration of the opcode interpreter, just as removal of "op"
873 removed at least one store from each iteration. Last, but not least, add the
874 OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
875 surrogate pair and the letter case can be handled efficiently.
877 2007-11-04 Darin Adler <darin@apple.com>
879 * pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
881 2007-11-03 Darin Adler <darin@apple.com>
883 - fix non-Mac builds; remove some more unused PCRE stuff
885 * pcre/pcre_compile.c:
886 (compile_branch): Removed branch chain and some unused ESC values.
887 (compile_regex): Ditto.
888 (jsRegExpCompile): Ditto.
890 (match): Removed unused branch targets. Don't use macros any more.
891 (jsRegExpExecute): More of the same.
893 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
894 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
895 * pcre/pcre.pri: Ditto.
897 * pcre/MERGING: Removed.
898 * pcre/pcre_fullinfo.c: Removed.
899 * pcre/pcre_get.c: Removed.
900 * pcre/pcre_internal.h:
901 * pcre/ucp.h: Removed.
903 2007-11-03 Darin Adler <darin@apple.com>
907 - http://bugs.webkit.org/show_bug.cgi?id=15821
908 remove unused PCRE features for speed
910 A first step toward removing the PCRE features we don't use.
911 This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
912 the SunSpider regular expression test.
914 Replaced the public interface with one that doesn't use the
915 name PCRE. Removed code we don't need for JavaScript and various
916 configurations we don't use. This is in preparation for still
917 more changes in the future. We'll probably switch to C++ and
918 make some even more significant changes to the regexp engine
919 to get some additional speed.
921 There's probably additional unused stuff that I haven't
924 This does mean that our PCRE is now a fork, but I think that's
925 not really a big deal.
927 * JavaScriptCore.exp: Remove the 5 old entry points and add
928 the 3 new entry points for WebCore's direct use of the regular
931 * kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
932 its sense and now there's a USE(POSIX_REGEX) instead, which should
933 probably not be set by anyone. Maybe later we'll just get rid of it
938 (KJS::RegExp::RegExp): Switch to new jsRegExp function names and
939 defines. Cut down on the number of functions used.
940 (KJS::RegExp::~RegExp): Ditto.
941 (KJS::RegExp::match): Ditto.
943 * pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
946 * pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
947 size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
948 POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
949 and JAVASCRIPT. These are all no longer configurable in our copy
952 * pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
953 version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
954 the include of <stdlib.h>, and most of the constants and
955 functions defined in this header. Changed the naming scheme to
956 use a JSRegExp prefix rather than a pcre prefix. In the future,
957 we'll probably change this to be a C++ header.
959 * pcre/pcre_compile.c: Removed all unused code branches,
960 including many whole functions and various byte codes.
961 Kept changes outside of removal to a minimum.
963 (first_significant_code):
966 (could_be_empty_branch):
971 (find_firstassertedchar):
972 (jsRegExpCompile): Renamed from pcre_compile2 and changed the
973 parameters around a bit.
974 (jsRegExpFree): Added.
976 * pcre/pcre_exec.c: Removed many unused opcodes and variables.
977 Also started tearing down the NO_RECURSE mechanism since it's
978 now the default. In some cases there were things in the explicit
979 frame that could be turned into plain old local variables and
980 other small like optimizations.
983 (match): Changed parameters quite a bit since it's now not used
985 (jsRegExpExecute): Renamed from pcre_exec.
987 * pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
988 PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
989 PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
990 PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
991 _pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
992 and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
994 * pcre/pcre_maketables.c: Changed to only compile in dftables.
995 Also got rid of many of the tables that we don't use.
997 * pcre/pcre_tables.c: Removed the unused Unicode property tables.
999 * pcre/pcre_ucp_searchfuncs.c: Removed everything except for
1000 _pcre_ucp_othercase.
1002 * pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
1003 for classes based on Unicode properties.
1005 * wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
1006 to eliminate this completely, but we need the regular expression
1007 code to be C++ first.
1009 * pcre/pcre_fullinfo.c:
1012 Files that are no longer needed. I didn't remove them with this
1013 check-in, because I didn't want to modify all the project files.
1015 2007-11-03 Maciej Stachowiak <mjs@apple.com>
1019 - remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
1021 It turns out that doing this check costs more than it saves.
1023 * kjs/JSImmediate.h:
1024 (KJS::JSImmediate::fromDouble):
1026 2007-11-03 Sam Weinig <sam@webkit.org>
1030 Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
1031 The variable had been kept around for binary compatibility, but since nothing
1032 else is there is no point in continuing to keep it around.
1034 * API/JSCallbackConstructor.cpp:
1036 * API/JSCallbackFunction.cpp:
1038 * API/JSCallbackObject.cpp:
1040 * bindings/objc/objc_runtime.mm:
1041 * bindings/runtime_array.cpp:
1042 * bindings/runtime_object.cpp:
1043 * kjs/array_instance.cpp:
1045 * kjs/array_object.cpp:
1047 * kjs/bool_object.cpp:
1048 * kjs/date_object.cpp:
1050 * kjs/error_object.cpp:
1056 * kjs/math_object.cpp:
1057 * kjs/number_object.cpp:
1059 * kjs/regexp_object.cpp:
1060 * kjs/string_object.cpp:
1063 2007-11-03 Kevin McCullough <kmccullough@apple.com>
1065 - Updated testkjs results to make the build bots green until we
1066 can fix the tests that are failing. The new failures are in DST.
1068 * tests/mozilla/expected.html:
1070 2007-11-03 Maciej Stachowiak <mjs@apple.com>
1074 - don't print the var twice for ForInNodes with a var declaration
1076 * kjs/nodes2string.cpp:
1077 (KJS::ForInNode::streamTo):
1079 2007-11-03 Darin Adler <darin@apple.com>
1081 * pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
1082 C-incompatible declaration.
1084 2007-11-03 Mark Rowe <mrowe@apple.com>
1088 * kjs/nodes.cpp: Add missing include.
1090 2007-11-03 Darin Adler <darin@apple.com>
1094 - fix http://bugs.webkit.org/show_bug.cgi?id=15814
1095 <rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
1097 These changes cause us to match the JavaScript specification and pass the
1098 fast/js/kde/encode_decode_uri.html test.
1100 * kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
1101 new strict mode, throwing an exception if there are malformed UTF-16 surrogate
1104 * kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
1106 (KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
1107 those might be illegal in some sense, they aren't supposed to get any special
1108 handling in the place where this function is currently used.
1109 (KJS::UString::UTF8String): Added the strictness.
1111 2007-11-03 Darin Adler <darin@apple.com>
1115 - http://bugs.webkit.org/show_bug.cgi?id=15812
1116 some JavaScript tests (from the Mozilla test suite) are failing
1118 Two or three fixes get 7 more of the Mozilla tests passing.
1119 This gets us down from 61 failing tests to 54.
1121 * kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
1122 Made this inline and gave it a more specific type. Some day we should
1123 probably do that for all of these -- might even get a bit of a speed
1125 * kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
1126 inline in the header.
1128 * kjs/regexp_object.h:
1129 * kjs/regexp_object.cpp:
1130 (KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
1131 switch statement into the RegExpImp object, so they can be shared with
1132 RegExpImp::callAsFunction.
1133 (KJS::RegExpImp::match): Added. Common code used by both test and exec.
1134 (KJS::RegExpImp::test): Added.
1135 (KJS::RegExpImp::exec): Added.
1136 (KJS::RegExpImp::implementsCall): Added.
1137 (KJS::RegExpImp::callAsFunction): Added.
1138 (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
1139 lastInput to null rather than empty string -- we take advantage of the
1140 difference in RegExpImp::match.
1141 (KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
1142 just to get at a field like this.
1144 * pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
1145 the JavaScript specification. If there are not 4 hex digits after the \u,
1146 then it's processed as if it wasn't an escape sequence at all.
1148 * pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
1149 for JavaScript (4 specific Unicode values).
1151 (match): Changed all call sites to use IS_NEWLINE.
1154 * tests/mozilla/expected.html: Updated to expect 7 more successful tests.
1156 2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
1158 Sort files(...); sections of Xcode project files.
1160 Rubber-stamped by Darin.
1162 * JavaScriptCore.xcodeproj/project.pbxproj:
1164 2007-11-03 Maciej Stachowiak <mjs@apple.com>
1168 - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
1172 (KJS::VarDeclNode::optimizeVariableAccess):
1173 (KJS::VarDeclNode::getDeclarations):
1174 (KJS::VarDeclNode::handleSlowCase):
1175 (KJS::VarDeclNode::evaluateSingle):
1176 (KJS::VarDeclNode::evaluate):
1177 (KJS::VarStatementNode::execute):
1179 (KJS::VarDeclNode::):
1180 (KJS::VarStatementNode::):
1181 * kjs/nodes2string.cpp:
1182 (KJS::VarDeclNode::streamTo):
1184 2007-11-03 Alexey Proskuryakov <ap@webkit.org>
1188 http://bugs.webkit.org/show_bug.cgi?id=15800
1189 REGRESSION (r27303): RegExp leaks
1191 * kjs/regexp_object.h:
1192 (KJS::RegExpImp::setRegExp):
1193 (KJS::RegExpImp::regExp):
1194 (KJS::RegExpImp::classInfo):
1195 * kjs/regexp_object.cpp:
1196 (RegExpImp::RegExpImp):
1197 (RegExpImp::~RegExpImp):
1198 Renamed reg member variable to m_regExp, changed it to use OwnPtr.
1200 2007-11-02 Maciej Stachowiak <mjs@apple.com>
1204 - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
1208 (KJS::statementListPushFIFO):
1209 (KJS::statementListGetDeclarations):
1210 (KJS::statementListInitializeDeclarationStacks):
1211 (KJS::statementListInitializeVariableAccessStack):
1212 (KJS::statementListExecute):
1213 (KJS::BlockNode::BlockNode):
1214 (KJS::FunctionBodyNode::FunctionBodyNode):
1215 (KJS::ProgramNode::ProgramNode):
1217 (KJS::CaseClauseNode::):
1219 2007-11-02 Darin Adler <darin@apple.com>
1223 - http://bugs.webkit.org/show_bug.cgi?id=15791
1224 change property map data structure for less memory use, better speed
1226 The property map now has an array of indices and a separate array of
1227 property map entries. This slightly slows down lookup because of a second
1228 memory acess, but makes property maps smaller and faster to iterate in
1229 functions like mark().
1231 SunSpider says this is 1.2% faster, although it makes the bitwise-end test
1232 more than 10% slower. To fix that we'll need to optimize global variable lookup.
1234 * kjs/property_map.cpp:
1235 (KJS::PropertyMapEntry::PropertyMapEntry):
1236 (KJS::PropertyMapHashTable::entries):
1237 (KJS::PropertyMapHashTable::allocationSize):
1238 (KJS::SavedProperties::SavedProperties):
1239 (KJS::SavedProperties::~SavedProperties):
1240 (KJS::PropertyMap::checkConsistency):
1241 (KJS::PropertyMap::~PropertyMap):
1242 (KJS::PropertyMap::clear):
1243 (KJS::PropertyMap::get):
1244 (KJS::PropertyMap::getLocation):
1245 (KJS::PropertyMap::put):
1246 (KJS::PropertyMap::insert):
1247 (KJS::PropertyMap::createTable):
1248 (KJS::PropertyMap::rehash):
1249 (KJS::PropertyMap::remove):
1250 (KJS::PropertyMap::mark):
1251 (KJS::comparePropertyMapEntryIndices):
1252 (KJS::PropertyMap::containsGettersOrSetters):
1253 (KJS::PropertyMap::getEnumerablePropertyNames):
1254 (KJS::PropertyMap::save):
1255 (KJS::PropertyMap::restore):
1256 * kjs/property_map.h:
1258 2007-11-02 Darin Adler <darin@apple.com>
1262 - http://bugs.webkit.org/show_bug.cgi?id=15807
1263 HashMap needs a take() function that combines get and remove
1265 * wtf/HashMap.h: Added take function. Simplistic implementation for now,
1266 but still does only one hash table lookup.
1268 * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
1269 a find followed by a remove.
1271 2007-11-02 David Carson <dacarson@gmail.com>
1275 Fix compiler warning "warning: suggest parentheses around && within ||"
1276 http://bugs.webkit.org/show_bug.cgi?id=15764
1278 * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
1280 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1282 Reviewed by Maciej Stachowiak.
1284 In preparation for making List a simple stack-allocated Vector:
1286 Removed all instances of List copying and/or assignment, and made List
1287 inherit from Noncopyable.
1289 Functions that used to return a List by copy now take List& out
1292 Layout tests and JS tests pass.
1295 (KJS::List::slice): Replaced copyTail with a more generic slice
1296 alternative. (JavaScriptCore only calls slice(1), but WebCore calls
1299 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1301 Reviewed by Maciej Stachowiak.
1303 Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
1304 REGRESSION(r27344): Crash on load at finance.yahoo.com
1306 Reverted a small portion of my last check-in. (The speedup and the List
1307 removal are still there, though.)
1309 ActivationImp needs to hold a pointer to its function, and mark that
1310 pointer (rather than accessing its function through its ExecState, and
1311 counting on the active scope to mark its function) because a closure
1312 can cause an ActivationImp to outlive its ExecState along with any
1315 * kjs/ExecState.cpp:
1316 (KJS::ExecState::ExecState):
1318 (KJS::FunctionImp::~FunctionImp):
1319 (KJS::ActivationImp::ActivationImp):
1321 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
1323 Also made HashTable a little more crash-happy in debug builds, so
1324 problems like this will show up earlier:
1327 (WTF::HashTable::~HashTable):
1329 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1331 Reviewed by Adam Roben.
1333 Addressed some of Darin's review comments.
1335 Used perl -p, which is the shorthand while(<>) {}.
1337 Made sure not to suppress bison's output.
1339 Added line to removed bison_out.txt, since this script removes other
1340 intermediate files, too.
1342 * DerivedSources.make:
1344 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1346 Reviewed by Oliver Hunt.
1348 Removed List from ActivationImp, in preparation for making all lists
1353 1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
1355 * kjs/ExecState.cpp:
1356 (KJS::ExecState::ExecState):
1357 (KJS::ExecState::~ExecState):
1359 (KJS::ActivationImp::ActivationImp):
1360 (KJS::ActivationImp::createArgumentsObject):
1362 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
1364 2007-11-01 Adam Roben <aroben@apple.com>
1366 Use jsNumberCell instead of jsNumber when converting double constants to JSValues
1368 This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
1369 ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
1371 It also gets rid of an MSVC warning that we previously had to silence.
1375 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
1376 back on the "overflow in constant arithmetic" warning.
1377 * kjs/number_object.cpp:
1378 (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
1381 2007-10-31 Adam Roben <aroben@apple.com>
1387 2007-10-31 Maciej Stachowiak <mjs@apple.com>
1391 - shave some cycles off of local storage access for a 1% SunSpider speedup
1393 Keep the LocalStorage pointer in the ExecState, instead of getting
1394 it from the ActivationImp all the time.
1396 * kjs/ExecState.cpp:
1397 (KJS::ExecState::updateLocalStorage):
1399 (KJS::ExecState::localStorage):
1401 (KJS::LocalVarAccessNode::evaluate):
1402 (KJS::LocalVarFunctionCallNode::evaluate):
1403 (KJS::PostIncLocalVarNode::evaluate):
1404 (KJS::PostDecLocalVarNode::evaluate):
1405 (KJS::LocalVarTypeOfNode::evaluate):
1406 (KJS::PreIncLocalVarNode::evaluate):
1407 (KJS::PreDecLocalVarNode::evaluate):
1408 (KJS::ReadModifyLocalVarNode::evaluate):
1409 (KJS::AssignLocalVarNode::evaluate):
1410 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
1412 2007-10-31 Adam Roben <aroben@apple.com>
1414 Fix a crash on launch due to a static initializer race
1416 We now use fast inline assembler spinlocks which can be statically
1417 initialized at compile time.
1419 As a side benefit, this speeds up SunSpider by 0.4%.
1423 * wtf/FastMalloc.cpp:
1425 (TCMalloc_SpinLock::Lock):
1426 (TCMalloc_SpinLock::Unlock):
1427 (TCMalloc_SlowLock):
1428 * wtf/TCSystemAlloc.cpp:
1430 2007-10-31 Kevin McCullough <kmccullough@apple.com>
1434 - Corrected spelling.
1438 2007-10-31 Mark Rowe <mrowe@apple.com>
1440 Further Gtk build fixage.
1442 * kjs/regexp_object.cpp:
1444 2007-10-31 Mark Rowe <mrowe@apple.com>
1450 2007-10-31 Darin Adler <darin@apple.com>
1454 - fix http://bugs.webkit.org/show_bug.cgi?id=15749
1455 RegExp/RegExpObjectImp cause needless UString creation
1457 Speeds things up 0.4% according to SunSpider.
1459 * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
1460 because this library doesn't use the real PCRE -- it uses its
1461 own PCRE that works on UTF-16.
1463 * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
1464 Use Noncopyable. Change the return value of match.
1466 (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
1467 (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
1468 (KJS::RegExp::match): Change to return the position as an int and the
1469 ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
1471 * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
1472 require a result string.
1473 * kjs/regexp_object.cpp:
1474 (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
1475 (RegExpObjectImp::performMatch): Change so it doesn't return a string.
1476 (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
1477 the main result with the backreferences; now it doesn't need to take
1479 (RegExpObjectImp::getBackref): Minor tweaks.
1480 (RegExpObjectImp::getLastParen): Ditto.
1481 (RegExpObjectImp::getLeftContext): Ditto.
1482 (RegExpObjectImp::getRightContext): Ditto.
1483 (RegExpObjectImp::getValueProperty): Change LastMatch case to call
1484 getBackref(0) so we don't need a separate getLastMatch function.
1486 * kjs/string_object.cpp:
1487 (KJS::replace): Update to use new performMatch, including merging the
1488 matched string section with the other substrings.
1489 (KJS::StringProtoFunc::callAsFunction): Update functions to use the
1490 new performMatch and match. Also change to use OwnArrayPtr.
1492 2007-10-31 Oliver Hunt <oliver@apple.com>
1494 * kjs/nodes.h: include OwnPtr.h
1496 2007-10-31 Oliver Hunt <oliver@apple.com>
1500 Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
1504 (KJS::statementListPushFIFO):
1505 (KJS::statementListGetDeclarations):
1506 (KJS::statementListInitializeDeclarationStacks):
1507 (KJS::statementListInitializeVariableAccessStack):
1508 (KJS::statementListExecute):
1509 (KJS::BlockNode::optimizeVariableAccess):
1510 (KJS::BlockNode::BlockNode):
1511 (KJS::BlockNode::getDeclarations):
1512 (KJS::BlockNode::execute):
1513 (KJS::CaseClauseNode::optimizeVariableAccess):
1514 (KJS::CaseClauseNode::getDeclarations):
1515 (KJS::CaseClauseNode::evalStatements):
1516 (KJS::FunctionBodyNode::initializeDeclarationStacks):
1517 (KJS::FunctionBodyNode::optimizeVariableAccess):
1519 * kjs/nodes2string.cpp:
1520 (KJS::statementListStreamTo):
1521 (KJS::BlockNode::streamTo):
1522 (KJS::CaseClauseNode::streamTo):
1524 2007-10-30 Mark Rowe <mrowe@apple.com>
1526 * kjs/property_map.cpp: Added a missing using directive to fix the build
1527 for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
1529 2007-10-31 Maciej Stachowiak <mjs@apple.com>
1531 * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
1534 2007-10-31 Alexey Proskuryakov <ap@webkit.org>
1538 http://bugs.webkit.org/show_bug.cgi?id=11001
1539 WebKit doesn't support RegExp.compile method
1541 Test: fast/js/regexp-compile.html
1543 * kjs/regexp_object.cpp:
1544 (RegExpPrototype::RegExpPrototype):
1545 (RegExpProtoFunc::callAsFunction):
1546 * kjs/regexp_object.h:
1547 (KJS::RegExpProtoFunc::):
1548 Added RegExp.compile.
1550 * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
1552 2007-10-31 Maciej Stachowiak <mjs@apple.com>
1556 - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
1558 Integer divide sucks. Fortunately, a bunch of shifts and XORs
1559 biased towards the high bits is sufficient to provide a good
1560 double hash. Besides the SunSpider win, I used the dump statistics
1561 mode for both to verify that collisions did not increase and that
1562 the longest collision chain is not any longer.
1564 * kjs/property_map.cpp:
1566 (KJS::PropertyMap::get):
1567 (KJS::PropertyMap::getLocation):
1568 (KJS::PropertyMap::put):
1569 (KJS::PropertyMap::insert):
1570 (KJS::PropertyMap::remove):
1571 (KJS::PropertyMap::checkConsistency):
1575 (WTF::::lookupForWriting):
1576 (WTF::::fullLookupForWriting):
1579 2007-10-30 Adam Roben <aroben@apple.com>
1581 * kjs/collector.h: Make HeapType public so it can be used for non-member
1582 things like the HeapConstants struct template. Fixes the build on Windows.
1584 2007-10-30 Adam Roben <aroben@apple.com>
1586 Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
1588 Speeds up SunSpider by 0.4%.
1590 Reviewed by Steve and Maciej.
1592 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
1593 a warning during LTCG in release builds about double -> float
1595 * wtf/AlwaysInline.h:
1598 2007-10-30 Adam Roben <aroben@apple.com>
1600 Use GetCurrentThreadId instead of pthread_self in FastMalloc
1602 Speeds up SunSpider by 0.3%.
1606 * wtf/FastMalloc.cpp:
1607 (WTF::TCMalloc_ThreadCache::InitTSD):
1608 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
1610 2007-10-30 Adam Roben <aroben@apple.com>
1612 Switch to a Win32 critical section implementation of spinlocks
1614 Speeds up SunSpider by 0.4%.
1618 * wtf/FastMalloc.cpp:
1620 (TCMalloc_SpinLock::TCMalloc_SpinLock):
1621 (TCMalloc_SpinLock::Init):
1622 (TCMalloc_SpinLock::Finalize):
1623 (TCMalloc_SpinLock::Lock):
1624 (TCMalloc_SpinLock::Unlock):
1625 * wtf/TCSystemAlloc.cpp:
1627 2007-10-30 Adam Roben <aroben@apple.com>
1629 Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
1631 http://bugs.webkit.org/show_bug.cgi?id=15586
1633 Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
1635 Use Win32 TLS functions instead of __declspec(thread), which breaks
1640 * wtf/FastMalloc.cpp:
1641 (WTF::getThreadHeap):
1642 (WTF::TCMalloc_ThreadCache::InitModule):
1644 2007-10-30 Maciej Stachowiak <mjs@apple.com>
1648 - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
1649 http://bugs.webkit.org/show_bug.cgi?id=15772
1651 We do this by using a single mark bit per two number cells, and
1654 Besides being an 0.5% win overall, this is a 7.1% win on morph.
1656 * kjs/collector.cpp:
1658 (KJS::Collector::heapAllocate):
1659 (KJS::Collector::markStackObjectsConservatively):
1660 (KJS::Collector::sweep):
1662 (KJS::SmallCollectorCell::):
1664 2007-10-30 Geoffrey Garen <ggaren@apple.com>
1666 Reviewed by Adam Roben, Sam Weinig.
1668 Made conflicts in grammar.y a persistent build failure.
1670 * DerivedSources.make:
1672 2007-10-30 Kevin McCullough <kmccullough@apple.com>
1674 Reviewed by Adam and Geoff.
1676 - Added a new cast so all the casts are in the same place.
1681 2007-10-30 Geoffrey Garen <ggaren@apple.com>
1683 Reviewed by Darin Adler.
1685 Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
1689 ecma_2/Statements/dowhile-001.js
1690 ecma_2/Statements/dowhile-002.js
1691 ecma_2/Statements/dowhile-003.js
1692 ecma_2/Statements/dowhile-004.js
1693 ecma_2/Statements/dowhile-005.js
1694 ecma_2/Statements/dowhile-006.js
1695 ecma_2/Statements/dowhile-007.js
1696 js1_2/statements/do_while.js
1698 and layout tests, including
1700 do-while-expression-value.html
1701 do-while-semicolon.html
1702 do-while-without-semicolon.html
1706 * kjs/grammar.y: Use the explicit "error" production, as we do with other
1707 automatic semicolon insertions, to disambiguate "do { } while();" from
1708 "do { } while()" followed by ";" (the empty statement).
1710 2007-10-29 Oliver Hunt <oliver@apple.com>
1714 Debranching remaining assignment nodes, and miscellaneous cleanup
1716 Split read-modify code paths out of AssignBracketNode and AssignDotNode
1717 Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
1718 and ReadModifyResolveNode evaluate methods
1720 Leads to a 1% gain in SunSpider.
1724 (KJS::ReadModifyLocalVarNode::evaluate):
1725 (KJS::ReadModifyResolveNode::evaluate):
1726 (KJS::AssignDotNode::evaluate):
1727 (KJS::ReadModifyDotNode::optimizeVariableAccess):
1728 (KJS::ReadModifyDotNode::evaluate):
1729 (KJS::AssignBracketNode::evaluate):
1730 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
1731 (KJS::ReadModifyBracketNode::evaluate):
1733 (KJS::AssignBracketNode::):
1734 (KJS::AssignBracketNode::precedence):
1735 (KJS::AssignDotNode::):
1736 (KJS::AssignDotNode::precedence):
1737 * kjs/nodes2string.cpp:
1738 (KJS::ReadModifyBracketNode::streamTo):
1739 (KJS::AssignBracketNode::streamTo):
1740 (KJS::ReadModifyDotNode::streamTo):
1741 (KJS::AssignDotNode::streamTo):
1743 2007-10-29 Oliver Hunt <oliver@apple.com>
1745 Debranching various Node::evaluate implementations
1749 Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
1750 Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
1752 Gains 1.6% on SunSpider
1754 * JavaScriptCore.xcodeproj/project.pbxproj:
1757 (KJS::PostIncResolveNode::optimizeVariableAccess):
1758 (KJS::PostIncResolveNode::evaluate):
1759 (KJS::PostIncLocalVarNode::evaluate):
1760 (KJS::PostDecResolveNode::optimizeVariableAccess):
1761 (KJS::PostDecResolveNode::evaluate):
1762 (KJS::PostDecLocalVarNode::evaluate):
1763 (KJS::PostIncBracketNode::evaluate):
1764 (KJS::PostDecBracketNode::evaluate):
1765 (KJS::PostIncDotNode::evaluate):
1766 (KJS::PostDecDotNode::evaluate):
1767 (KJS::PreIncResolveNode::optimizeVariableAccess):
1768 (KJS::PreIncLocalVarNode::evaluate):
1769 (KJS::PreIncResolveNode::evaluate):
1770 (KJS::PreDecResolveNode::optimizeVariableAccess):
1771 (KJS::PreDecLocalVarNode::evaluate):
1772 (KJS::PreDecResolveNode::evaluate):
1773 (KJS::PreIncBracketNode::evaluate):
1774 (KJS::PreDecBracketNode::evaluate):
1775 (KJS::PreIncDotNode::evaluate):
1776 (KJS::PreDecDotNode::evaluate):
1777 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1778 (KJS::AssignResolveNode::optimizeVariableAccess):
1779 (KJS::AssignLocalVarNode::evaluate):
1780 (KJS::AssignResolveNode::evaluate):
1782 (KJS::PostDecResolveNode::):
1783 (KJS::PostDecResolveNode::precedence):
1784 (KJS::PostDecLocalVarNode::):
1785 (KJS::PostfixBracketNode::):
1786 (KJS::PostfixBracketNode::precedence):
1787 (KJS::PostIncBracketNode::):
1788 (KJS::PostIncBracketNode::isIncrement):
1789 (KJS::PostDecBracketNode::):
1790 (KJS::PostDecBracketNode::isIncrement):
1791 (KJS::PostfixDotNode::):
1792 (KJS::PostfixDotNode::precedence):
1793 (KJS::PostIncDotNode::):
1794 (KJS::PostIncDotNode::isIncrement):
1795 (KJS::PostDecDotNode::):
1796 (KJS::PreIncResolveNode::):
1797 (KJS::PreDecResolveNode::):
1798 (KJS::PreDecResolveNode::precedence):
1799 (KJS::PreDecLocalVarNode::):
1800 (KJS::PrefixBracketNode::):
1801 (KJS::PrefixBracketNode::precedence):
1802 (KJS::PreIncBracketNode::):
1803 (KJS::PreIncBracketNode::isIncrement):
1804 (KJS::PreDecBracketNode::):
1805 (KJS::PreDecBracketNode::isIncrement):
1806 (KJS::PrefixDotNode::):
1807 (KJS::PrefixDotNode::precedence):
1808 (KJS::PreIncDotNode::):
1809 (KJS::PreIncDotNode::isIncrement):
1810 (KJS::PreDecDotNode::):
1811 (KJS::ReadModifyResolveNode::):
1812 (KJS::ReadModifyLocalVarNode::):
1813 (KJS::AssignResolveNode::):
1814 (KJS::AssignResolveNode::precedence):
1815 * kjs/nodes2string.cpp:
1816 (KJS::PostIncResolveNode::streamTo):
1817 (KJS::PostDecResolveNode::streamTo):
1818 (KJS::PostfixBracketNode::streamTo):
1819 (KJS::PostfixDotNode::streamTo):
1820 (KJS::PreIncResolveNode::streamTo):
1821 (KJS::PreDecResolveNode::streamTo):
1822 (KJS::ReadModifyResolveNode::streamTo):
1823 (KJS::AssignResolveNode::streamTo):
1825 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1827 Not reviewed, build fix.
1829 - Include Vector.h in a way that actually works.
1831 * kjs/LocalStorage.h:
1833 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1835 Not reviewed, build fix.
1837 - Install LocalStorage.h as a private header.
1839 * JavaScriptCore.xcodeproj/project.pbxproj:
1841 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1845 - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
1847 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1848 * JavaScriptCore.xcodeproj/project.pbxproj:
1849 * kjs/LocalStorage.h: Added.
1850 (KJS::LocalStorageEntry::LocalStorageEntry):
1854 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
1856 2007-10-29 Geoffrey Garen <ggaren@apple.com>
1858 Reviewed by Oliver Hunt.
1860 Some small tweaks that I notice while reviewing Oliver's last patch.
1862 Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
1864 No change in SunSpider because SunSpider doesn't take the code path that
1865 would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
1868 (KJS::LocalVarPostfixNode::evaluate):
1869 (KJS::TypeOfResolveNode::optimizeVariableAccess):
1870 (KJS::LocalVarTypeOfNode::evaluate):
1871 (KJS::PrefixResolveNode::optimizeVariableAccess):
1872 (KJS::LocalVarPrefixNode::evaluate):
1873 (KJS::AssignResolveNode::optimizeVariableAccess):
1874 (KJS::LocalVarAssignNode::evaluate):
1876 (KJS::LocalVarTypeOfNode::):
1877 (KJS::PrefixResolveNode::):
1878 (KJS::LocalVarPrefixNode::):
1879 (KJS::AssignResolveNode::):
1880 (KJS::LocalVarAssignNode::):
1882 2007-10-29 Eric Seidel <eric@webkit.org>
1886 SunSpider claims this was a 0.7% speedup.
1888 * kjs/string_object.cpp:
1889 (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
1891 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1895 - re-enable asserts for access to empty or deleted keys
1899 (WTF::::lookupForWriting):
1900 (WTF::::fullLookupForWriting):
1903 2007-10-29 Eric Seidel <eric@webkit.org>
1905 Build fix only, no review.
1907 * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
1909 2007-10-29 Mark Rowe <mrowe@apple.com>
1911 Gtk build fix. Move struct declarations into nodes.h.
1916 2007-10-29 Eric Seidel <eric@webkit.org>
1920 Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
1921 Make it a compile time error to use toString(ExecState) on a StringInstance
1923 SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
1926 (KJS::StringImp::getLength):
1927 * kjs/string_object.cpp:
1928 (KJS::StringInstance::lengthGetter):
1929 (KJS::StringInstance::inlineGetOwnPropertySlot):
1930 (KJS::StringInstance::getOwnPropertySlot):
1931 * kjs/string_object.h:
1933 2007-10-28 Oliver Hunt <oliver@apple.com>
1937 Add nodes to allow Assignment, TypeOf, and prefix operators to
1938 make use of the new optimised local variable look up.
1940 5% gain on sunspider
1943 (KJS::TypeOfResolveNode::optimizeVariableAccess):
1944 (KJS::LocalTypeOfAccessNode::evaluate):
1945 (KJS::PrefixResolveNode::optimizeVariableAccess):
1946 (KJS::PrefixLocalAccessNode::evaluate):
1947 (KJS::AssignResolveNode::optimizeVariableAccess):
1948 (KJS::AssignLocalAccessNode::evaluate):
1950 (KJS::TypeOfResolveNode::):
1951 (KJS::TypeOfResolveNode::precedence):
1952 (KJS::LocalTypeOfAccessNode::):
1953 (KJS::PrefixResolveNode::):
1954 (KJS::PrefixResolveNode::precedence):
1955 (KJS::PrefixLocalAccessNode::):
1956 (KJS::AssignResolveNode::):
1957 (KJS::AssignLocalAccessNode::):
1959 2007-10-28 Maciej Stachowiak <mjs@apple.com>
1963 - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
1964 http://bugs.webkit.org/show_bug.cgi?id=15748
1966 Not a significant speedup or slowdown on SunSpider.
1969 (KJS::clearNewNodes):
1973 (KJS::BlockNode::BlockNode):
1974 (KJS::CaseBlockNode::CaseBlockNode):
1975 (KJS::FunctionBodyNode::FunctionBodyNode):
1976 (KJS::SourceElementsNode::SourceElementsNode):
1977 (KJS::ProgramNode::ProgramNode):
1979 (KJS::ElementNode::):
1981 (KJS::PropertyListNode::):
1982 (KJS::ObjectLiteralNode::):
1983 (KJS::ArgumentListNode::):
1984 (KJS::ArgumentsNode::):
1985 (KJS::VarDeclListNode::):
1986 (KJS::VarStatementNode::):
1988 (KJS::ParameterNode::):
1989 (KJS::FuncExprNode::):
1990 (KJS::FuncDeclNode::):
1991 (KJS::SourceElementsNode::):
1992 (KJS::CaseClauseNode::):
1993 (KJS::ClauseListNode::):
1995 2007-10-28 Mark Rowe <mrowe@apple.com>
1997 Disable assertions in a manner that doesn't break the Qt Windows build.
2001 (WTF::::lookupForWriting):
2002 (WTF::::fullLookupForWriting):
2004 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2006 Temporarily disabling some ASSERTs I introduced in my last check-in
2007 because of http://bugs.webkit.org/show_bug.cgi?id=15747
2008 Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
2012 (WTF::::lookupForWriting):
2013 (WTF::::fullLookupForWriting):
2016 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2018 Reviewed by Darin Adler.
2020 Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
2021 #ifndef ASSERT_DISABLED is no good!
2023 Replaced with #if !ASSERT_DISABLED.
2027 (WTF::::lookupForWriting):
2028 (WTF::::fullLookupForWriting):
2031 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2033 Reviewed by Darin Adler.
2035 Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
2036 to the AST transfom that replaces slow resolve nodes with fast local
2037 variable alternatives.
2039 2.5% speedup on SunSpider.
2041 Also added some missing copyright notices.
2044 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
2045 (KJS::FunctionCallResolveNode::evaluate):
2046 (KJS::LocalVarFunctionCallNode::evaluate):
2047 (KJS::PostfixResolveNode::optimizeVariableAccess):
2048 (KJS::PostfixResolveNode::evaluate):
2049 (KJS::LocalVarPostfixNode::evaluate):
2050 (KJS::DeleteResolveNode::optimizeVariableAccess):
2051 (KJS::DeleteResolveNode::evaluate):
2052 (KJS::LocalVarDeleteNode::evaluate):
2054 (KJS::FunctionCallResolveNode::):
2055 (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
2056 (KJS::PostfixResolveNode::):
2057 (KJS::LocalVarPostfixNode::LocalVarPostfixNode):
2058 (KJS::DeleteResolveNode::):
2059 (KJS::LocalVarDeleteNode::LocalVarDeleteNode):
2061 2007-10-28 Eric Seidel <eric@webkit.org>
2065 Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
2066 Add virtual keyword to a few virtual functions previously unmarked.
2069 (KJS::StringImp::type):
2070 (KJS::NumberImp::type):
2072 (KJS::UString::Rep::deref):
2074 2007-10-28 Darin Adler <darin@apple.com>
2076 - fix "broken everything" from the storage leak fix
2078 * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
2079 * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
2081 2007-10-28 Darin Adler <darin@apple.com>
2085 - turn on unused parameter waring on Mac OS X because it's already on elsewhere
2087 * Configurations/Base.xcconfig: Took out -wno-unused-parameter.
2093 Fixed unused variables by using them or marked them with UNUSED_PARAM.
2095 * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
2096 Removed parameter names to indicate they are unused.
2098 2007-10-28 Darin Adler <darin@apple.com>
2102 - fix a storage leak where we ref the UString every time we replace
2103 a ResolveNode with a LocalVarAccessNode
2105 * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
2106 that takes PlacementNewAdopt.
2108 * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
2109 with PlacementNewAdopt instead of the old value of ident.
2111 * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
2112 takes PlacementNewAdopt.
2114 2007-10-28 Darin Adler <darin@apple.com>
2116 - Windows build fix; get rid of unused parameter
2118 * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
2119 * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
2120 The assertions weren't all that helpful.
2122 2007-10-28 Mark Rowe <mrowe@apple.com>
2124 Gtk build fix. Add include of MathExtras.h.
2126 * kjs/string_object.cpp:
2128 2007-10-28 Mark Rowe <mrowe@apple.com>
2130 Reviewed by Maciej and Tim.
2132 Replace uses of isNaN and isInf with isnan and isinf, and
2133 remove isNaN and isInf.
2135 * kjs/config.h: Remove unused HAVE_'s.
2136 * kjs/date_object.cpp:
2137 (KJS::DateInstance::getTime):
2138 (KJS::DateInstance::getUTCTime):
2139 (KJS::DateProtoFunc::callAsFunction):
2140 (KJS::DateObjectImp::construct):
2141 (KJS::DateObjectFuncImp::callAsFunction):
2143 (KJS::GlobalFuncImp::callAsFunction):
2144 * kjs/math_object.cpp:
2145 (MathFuncImp::callAsFunction):
2146 * kjs/nodes2string.cpp:
2147 (KJS::isParserRoundTripNumber):
2148 * kjs/number_object.cpp:
2149 (NumberProtoFunc::callAsFunction):
2150 * kjs/operations.cpp:
2152 * kjs/string_object.cpp:
2153 (KJS::StringProtoFunc::callAsFunction):
2155 (KJS::UString::from):
2157 (KJS::JSValue::toInteger):
2158 (KJS::JSValue::toInt32SlowCase):
2159 (KJS::JSValue::toUInt32SlowCase):
2161 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2163 Build fix: use the new-fangled missingSymbolMarker().
2166 (KJS::ResolveNode::optimizeVariableAccess):
2168 (KJS::LocalVarAccessNode::LocalVarAccessNode):
2170 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2172 Reviewed by Maciej Stachowiak, Darin Adler.
2174 Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
2177 AST transfom to replace slow resolve nodes with fast local variable
2178 alternatives that do direct memory access. Currently, only ResolveNode
2179 provides a fast local variable alternative. 6 others are soon to come.
2181 16.7% speedup on SunSpider.
2183 Most of this patch is just scaffolding to support iterating all the
2184 resolve nodes in the AST through optimizeResolveNodes(). In
2185 optimizeResolveNodes(), most classes just push their child nodes onto
2186 the processing stack, while ResolveNodes actually replace themselves in
2187 the tree with more optimized alternatives, if possible.
2189 Here are the interesting bits:
2191 * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
2192 in Node and ResolveNode. This tag allows you to use placement new to
2193 swap out a base class Node in favor of a subclass copy that holds the
2194 same data. (Without this tag, default initialization would NULL out
2195 RefPtrs, change line numbers, etc.)
2198 (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
2199 that the fast path is impossible, to make sure we didn't leave anything
2202 (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
2203 transformation happens.
2205 (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
2206 optimization happens.
2208 * kjs/function.h: Added symbolTable() accessor for, for the sake of
2211 2007-10-28 Mark Rowe <mrowe@apple.com>
2215 Fix "AllInOneFile.o has a global initializer in it".
2217 Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
2218 We can avoid this by moving it inside an inline function.
2220 * kjs/SymbolTable.h:
2221 (KJS::missingSymbolMarker):
2223 (KJS::ActivationImp::getOwnPropertySlot):
2224 (KJS::ActivationImp::put):
2226 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2230 - Added assertions to protect against adding empty or deleted keys to a HashTable
2233 (WTF::HashTable::lookup):
2234 (WTF::HashTable::lookupForWriting):
2235 (WTF::HashTable::fullLookupForWriting):
2236 (WTF::HashTable::add):
2238 2007-10-28 Darin Adler <darin@apple.com>
2242 * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
2243 Use isNaN and isInf instead of isnan and isinf.
2245 2007-10-28 Darin Adler <darin@apple.com>
2249 - http://bugs.webkit.org/show_bug.cgi?id=15735
2250 remove GroupNode to simplify AST and possibly get a modest speedup
2252 This patch removes 4 node types: GroupNode, PropertyNameNode,
2253 FunctionCallParenBracketNode, and FunctionCallParenDotNode.
2255 To remove GroupNode, we add knowledge of precedence to the tree nodes,
2256 and use that when serializing to determine where parentheses are needed.
2257 This means we no longer have to represent parentheses in the tree.
2259 The precedence values are named after productions in the grammar from the
2260 JavaScript standard.
2262 SunSpider says this is an 0.4% speedup.
2265 * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
2266 serialization, so I moved it to the file that takes care of that.
2268 * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
2269 indicate failure instead of a separate boolean. Got rid of PropertyNameNode
2270 by merging the PropertyName rule into the Property rule (which was easier
2271 than figuring out how to pass the Identifier from one node to another).
2272 Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
2273 and FunctionCallParenDotNode.
2275 * kjs/nodes.h: Removed unused forward declarations and Operator values.
2276 Added Precedence enum, and precedence function to all nodes. Removed
2277 nodeInsideAllParens. Added streamBinaryOperator function for serialization.
2278 Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
2279 Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
2281 * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
2282 (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
2283 of converting it from an Identifier to a jsString then back to a UString
2284 then into an Identifier again!
2286 * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
2287 function for each of Endl, Indent, Unindent, and DotExpr instead of using a
2288 single function with a switch. Added a precedence that you can stream in, to
2289 cause the next node serialized to add parentheses based on that precedence value.
2290 (KJS::operatorString): Moved to the top of the file.
2291 (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
2292 workaround for snprintf, since StringExtras.h takes care of that.
2293 (KJS::operator<<): Made the char and char* versions faster by using UString's
2294 character append functions instead of constructing a UString. Added the logic
2295 to the Node* version to add parentheses if needed.
2296 (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
2297 (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
2298 (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
2300 (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
2301 (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
2302 (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
2303 (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
2304 (KJS::FunctionCallBracketNode::streamTo): Ditto.
2305 (KJS::FunctionCallDotNode::streamTo): Ditto.
2306 (KJS::PostfixBracketNode::streamTo): Ditto.
2307 (KJS::PostfixDotNode::streamTo): Ditto.
2308 (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
2309 (KJS::DeleteBracketNode::streamTo): Use PrecCall.
2310 (KJS::DeleteDotNode::streamTo): Ditto.
2311 (KJS::DeleteValueNode::streamTo): Use PrecUnary.
2312 (KJS::VoidNode::streamTo): Ditto.
2313 (KJS::TypeOfValueNode::streamTo): Ditto.
2314 (KJS::PrefixBracketNode::streamTo): Use PrecCall.
2315 (KJS::PrefixDotNode::streamTo): Ditto.
2316 (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
2317 (KJS::UnaryPlusNode::streamTo): Ditto.
2318 (KJS::NegateNode::streamTo): Ditto.
2319 (KJS::BitwiseNotNode::streamTo): Ditto.
2320 (KJS::LogicalNotNode::streamTo): Ditto.
2321 (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
2322 (KJS::DivNode::streamTo): Ditto.
2323 (KJS::ModNode::streamTo): Ditto.
2324 (KJS::AddNode::streamTo): Ditto.
2325 (KJS::SubNode::streamTo): Ditto.
2326 (KJS::LeftShiftNode::streamTo): Ditto.
2327 (KJS::RightShiftNode::streamTo): Ditto.
2328 (KJS::UnsignedRightShiftNode::streamTo): Ditto.
2329 (KJS::LessNode::streamTo): Ditto.
2330 (KJS::GreaterNode::streamTo): Ditto.
2331 (KJS::LessEqNode::streamTo): Ditto.
2332 (KJS::GreaterEqNode::streamTo): Ditto.
2333 (KJS::InstanceOfNode::streamTo): Ditto.
2334 (KJS::InNode::streamTo): Ditto.
2335 (KJS::EqualNode::streamTo): Ditto.
2336 (KJS::NotEqualNode::streamTo): Ditto.
2337 (KJS::StrictEqualNode::streamTo): Ditto.
2338 (KJS::NotStrictEqualNode::streamTo): Ditto.
2339 (KJS::BitAndNode::streamTo): Ditto.
2340 (KJS::BitXOrNode::streamTo): Ditto.
2341 (KJS::BitOrNode::streamTo): Ditto.
2342 (KJS::LogicalAndNode::streamTo): Ditto.
2343 (KJS::LogicalOrNode::streamTo): Ditto.
2344 (KJS::ConditionalNode::streamTo): Ditto.
2345 (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
2346 (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
2347 the bracket and PrecAssignment for the right side.
2348 (KJS::AssignDotNode::streamTo): Ditto.
2349 (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
2350 and PrecAssignment for the right side.
2351 (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
2352 (KJS::AssignExprNode::streamTo): Use PrecAssignment.
2354 2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
2356 Define wx port and set wx port USE options.
2358 Reviewed by Adam Roben.
2362 2007-10-28 Mark Rowe <mrowe@apple.com>
2364 We don't include "config.h" in headers.
2366 * bindings/jni/jni_instance.h:
2371 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2373 Rubber stamped by Mark.
2375 - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
2377 * kjs/SymbolTable.h:
2378 (KJS::SymbolTableIndexHashTraits::emptyValue):
2380 (KJS::ActivationImp::getOwnPropertySlot):
2381 (KJS::ActivationImp::put):
2383 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2387 - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
2389 * kjs/SymbolTable.h:
2390 (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
2391 (KJS::IdentifierRepHash::equal): ditto
2392 (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
2393 (KJS::SymbolTable): change to a typedef for a HashMap.
2395 (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
2396 (KJS::ActivationImp::deleteProperty): ditto
2397 (KJS::ActivationImp::put): ditto
2400 (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
2401 you now have to store a UString::rep, not an identifier.
2403 2007-10-27 Maciej Stachowiak <mjs@apple.com>
2407 - numerous HashTable performance improvements
2409 This does not quite add up to a measurable win on SunSpider, but it allows a
2410 follow-on > 3% improvement and probably helps WebCore too.
2412 I made the following improvements, among others:
2414 - Made HashFunctions note whether it is ok to compare a real value with the equal() function
2415 to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
2417 - Specialized lookup so it doesn't have to do so many extra branches and build so many extra
2418 std::pairs for cases that don't need them. There are now four versions, one for read-only access,
2419 two for writing, and one folded directly into add() (these all were improvments).
2421 - Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
2423 - Made a special constructor for iterators that knows it points to
2424 a valid filled cell and so skips updating itself.
2426 - Reordered memory accesses in the various lookup functions for better code generation
2428 - Made simple translators avoid passing a hash code around
2430 - Other minor tweaks
2434 (WTF::HashTableConstIterator::HashTableConstIterator):
2435 (WTF::HashTableIterator::HashTableIterator):
2436 (WTF::IdentityHashTranslator::translate):
2437 (WTF::HashTable::end):
2438 (WTF::HashTable::lookup):
2439 (WTF::HashTable::lookupForWriting):
2440 (WTF::HashTable::makeKnownGoodIterator):
2441 (WTF::HashTable::makeKnownGoodConstIterator):
2443 (WTF::::lookupForWriting):
2444 (WTF::::fullLookupForWriting):
2446 (WTF::::addPassingHashCode):
2450 * kjs/identifier.cpp:
2452 * wtf/HashFunctions.h:
2460 * wtf/ListHashSet.h:
2461 (WTF::ListHashSetTranslator::translate):
2463 2007-10-27 Darin Adler <darin@apple.com>
2467 - fix ASCIICType.h for some Windows compiles
2469 * wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
2470 compiler/library that has the wchar_t that is just a typedef.
2472 2007-10-27 Kevin McCullough <kmccullough@apple.com>
2475 - Forgot to change the build step when I changed the filename.
2477 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2479 2007-10-27 Geoffrey Garen <ggaren@apple.com>
2481 Reviewed by Darin Adler.
2483 Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
2485 http://bugs.webkit.org/show_bug.cgi?id=15718
2487 * kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a
2488 hash value. Also changed O(n) strlen to O(1) check for empty string.
2489 (KJS::Identifier::add):
2491 * kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
2492 (KJS::UString::UString):
2493 (KJS::UString::operator=):
2495 2007-10-27 Darin Adler <darin@apple.com>
2499 - fix pow on Windows
2501 * wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
2502 a "pow" function that does not properly handle the case where arg1 is
2505 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
2506 specify "::pow" -- just "pow" is fine.
2508 2007-10-27 Darin Adler <darin@apple.com>
2512 - http://bugs.webkit.org/show_bug.cgi?id=15711
2513 force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
2515 * kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
2517 * kjs/object.h: Removed redundant includes.
2518 * kjs/value.h: Ditto.
2520 2007-10-27 Maciej Stachowiak <mjs@apple.com>
2524 - fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
2525 http://bugs.webkit.org/show_bug.cgi?id=15718
2527 * kjs/identifier.cpp:
2528 (KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
2529 now that we count on all Identifiers already having one.
2531 2007-10-27 Mark Rowe <mrowe@apple.com>
2535 * kjs/SymbolTable.h:
2537 2007-10-27 Mark Rowe <mrowe@apple.com>
2543 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2545 Rubber stamp by Adam.
2547 - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
2548 files contain are functions that operate on BSTRs.
2550 * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
2551 * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
2552 * API/JSStringRefCOM.cpp: Removed.
2553 * API/JSStringRefCOM.h: Removed.
2554 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2556 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2560 - Made JSStringCreateWithBSTR capable of handling null BSTRs.
2562 * API/JSStringRefCOM.cpp:
2563 (JSStringCreateWithBSTR):
2565 2007-10-26 Sam Weinig <sam@webkit.org>
2569 * kjs/SymbolTable.h: Add header gaurd.
2570 * kjs/nodes.h: #include "SymbolTable.h"
2572 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2574 Suggested by Anders Carlsson.
2579 (KJS::ActivationImp::getOwnPropertySlot):
2581 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2583 Suggested by Darin Adler.
2585 Use computedHash(), which is safer than just directly accessing _hash.
2588 (KJS::Lookup::findEntry):
2589 (KJS::Lookup::find):
2591 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2593 Build fix: svn add SymbolTable.h
2595 * kjs/SymbolTable.h: Added.
2596 (KJS::SymbolTable::set):
2597 (KJS::SymbolTable::get):
2599 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2601 Build fix: export SymbolTable.h to WebCore.
2603 * JavaScriptCore.xcodeproj/project.pbxproj:
2605 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2607 Comment tweak suggested by Maciej.
2610 (KJS::ActivationImp::getOwnPropertySlot):
2612 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2614 Reviewed by Maciej Stachowiak.
2616 Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
2618 * kjs/property_map.cpp: Use a special no branch accessor to the UString's
2619 hash value. Also, return immediately instead of branching to the end
2620 of the loop if the value is not found.
2621 (KJS::PropertyMap::get):
2622 (KJS::PropertyMap::getLocation):
2623 (KJS::PropertyMap::put):
2624 (KJS::PropertyMap::insert):
2625 (KJS::PropertyMap::remove):
2626 (KJS::PropertyMap::checkConsistency):
2629 (KJS::UString::Rep::computedHash): Special no branch accessor to the
2630 UString's hash value. Used when the caller knows that the hash value
2631 has already been computed. (For example, if the caller got the UString
2632 from an Identifier.)
2634 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2636 Reviewed by Maciej Stachowiak.
2638 Switched ActivationImp to using a symbol table. For now, though, all
2639 clients take the slow path.
2641 Net .6% speedup on SunSpider.
2644 - ActivationImp now mallocs in its constructor
2645 - Local variable hits use an extra level of indirection to retrieve
2647 - Local variable misses do two lookups
2650 - Fast initialization of local variables upon function entry
2652 * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
2655 (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
2656 data that won't fit in a JSCell.
2657 (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
2659 (KJS::ActivationImp::getOwnPropertySlot): ditto
2660 (KJS::ActivationImp::deleteProperty): ditto
2661 (KJS::ActivationImp::put): ditto
2662 (KJS::ActivationImp::createArgumentsObject): ditto
2664 (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
2665 our properties doesn't try to recursively mark us. (This caused a crash
2666 in earlier testing. Not sure why we haven't run into it before.)
2668 * kjs/nodes.cpp: Functions now build a symbol table the first time
2670 (KJS::VarDeclNode::evaluate):
2671 (KJS::FunctionBodyNode::FunctionBodyNode):
2672 (KJS::FunctionBodyNode::initializeSymbolTable):
2673 (KJS::FunctionBodyNode::processDeclarations):
2674 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2675 (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
2678 (KJS::FunctionBodyNode::symbolTable):
2680 * wtf/Forward.h: Added Vector.
2682 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2684 - Corrected function name mistake in this changelog.
2686 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2687 Reviewed by Sam and Steve.
2689 - Added convenience methods for converting between BSTR and JSStringRefs
2691 * API/JSStringRefCOM.cpp: Added.
2692 (JSStringCreateWithBSTR):
2694 * API/JSStringRefCOM.h: Added.
2695 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2697 2007-10-26 Mark Rowe <mrowe@apple.com>
2701 * kjs/collector.cpp:
2702 (KJS::Collector::collect):
2704 2007-10-26 Oliver Hunt <oliver@apple.com>
2708 Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
2710 * kjs/CollectorHeapIntrospector.cpp:
2711 (KJS::CollectorHeapIntrospector::init):
2712 (KJS::CollectorHeapIntrospector::enumerate):
2713 * kjs/CollectorHeapIntrospector.h:
2714 * kjs/collector.cpp:
2715 (KJS::Collector::recordExtraCost):
2716 (KJS::Collector::heapAllocate):
2717 (KJS::Collector::allocate):
2718 (KJS::Collector::allocateNumber):
2719 (KJS::Collector::registerThread):
2720 (KJS::Collector::markStackObjectsConservatively):
2721 (KJS::Collector::markMainThreadOnlyObjects):
2722 (KJS::Collector::sweep):
2723 (KJS::Collector::collect):
2726 (KJS::NumberImp::operator new):
2727 Force numbers to be allocated in the secondary heap.
2729 2007-10-26 Maciej Stachowiak <mjs@apple.com>
2733 - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
2736 (KJS::JSValue::getUInt32):
2737 (KJS::JSValue::getTruncatedInt32):
2738 (KJS::JSValue::toNumber):
2740 (WTF::PassRefPtr::~PassRefPtr):
2742 (WTF::RefPtr::operator->):
2744 2007-10-26 Mark Rowe <mrowe@apple.com>
2750 2007-10-26 Maciej Stachowiak <mjs@apple.com>
2754 - Merge Context class fully into ExecState, since they are always created and used together.
2756 No measurable performance impact but this is a useful cleanup.
2758 * JavaScriptCore.pri:
2759 * kjs/ExecState.cpp:
2760 (KJS::ExecState::ExecState):
2761 (KJS::ExecState::~ExecState):
2762 (KJS::ExecState::mark):
2763 (KJS::ExecState::lexicalInterpreter):
2765 (KJS::ExecState::dynamicInterpreter):
2766 (KJS::ExecState::setException):
2767 (KJS::ExecState::clearException):
2768 (KJS::ExecState::exception):
2769 (KJS::ExecState::exceptionSlot):
2770 (KJS::ExecState::hadException):
2771 (KJS::ExecState::scopeChain):
2772 (KJS::ExecState::callingExecState):
2773 (KJS::ExecState::propertyNames):
2774 * kjs/collector.cpp:
2775 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
2777 (KJS::FunctionImp::callAsFunction):
2778 (KJS::FunctionImp::argumentsGetter):
2779 (KJS::FunctionImp::callerGetter):
2780 (KJS::GlobalFuncImp::callAsFunction):
2781 * kjs/interpreter.cpp:
2782 (KJS::Interpreter::Interpreter):
2783 (KJS::Interpreter::init):
2784 (KJS::Interpreter::evaluate):
2785 (KJS::Interpreter::mark):
2786 * kjs/interpreter.h:
2787 (KJS::Interpreter::setCurrentExec):
2788 (KJS::Interpreter::currentExec):
2790 (KJS::currentSourceId):
2791 (KJS::currentSourceURL):
2792 (KJS::ThisNode::evaluate):
2793 (KJS::ResolveNode::evaluate):
2794 (KJS::FunctionCallResolveNode::evaluate):
2795 (KJS::PostfixResolveNode::evaluate):
2796 (KJS::DeleteResolveNode::evaluate):
2797 (KJS::TypeOfResolveNode::evaluate):
2798 (KJS::PrefixResolveNode::evaluate):
2799 (KJS::AssignResolveNode::evaluate):
2800 (KJS::VarDeclNode::evaluate):
2801 (KJS::DoWhileNode::execute):
2802 (KJS::WhileNode::execute):
2803 (KJS::ForNode::execute):
2804 (KJS::ForInNode::execute):
2805 (KJS::ContinueNode::execute):
2806 (KJS::BreakNode::execute):
2807 (KJS::ReturnNode::execute):
2808 (KJS::WithNode::execute):
2809 (KJS::SwitchNode::execute):
2810 (KJS::LabelNode::execute):
2811 (KJS::TryNode::execute):
2812 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
2813 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
2814 (KJS::FunctionBodyNode::processDeclarations):
2815 (KJS::FuncDeclNode::makeFunction):
2816 (KJS::FuncExprNode::evaluate):
2818 2007-10-26 Mark Rowe <mrowe@apple.com>
2822 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2824 2007-10-26 Mark Rowe <mrowe@apple.com>
2828 * JavaScriptCore.pri:
2829 * kjs/ExecState.cpp:
2831 2007-10-26 Maciej Stachowiak <mjs@apple.com>
2835 - moved Context class into ExecState.{h,cpp} in preparation for merging
2836 ExecState and Context classes.
2838 * kjs/ExecState.h: Moved CodeType enum and Context class here in
2839 preparation for merging ExecState and Context.
2840 * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
2841 (KJS::Context::Context):
2842 (KJS::Context::~Context):
2843 (KJS::Context::mark):
2844 * kjs/context.h: Removed.
2845 * kjs/Context.cpp: Removed.
2846 * kjs/function.h: Removed CodeType enum.
2847 * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
2848 * kjs/internal.h: Removed LabelStack.
2849 * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
2850 * kjs/collector.cpp: Fixed includes.
2851 * kjs/function.cpp: ditto
2852 * kjs/internal.cpp: ditto
2853 * kjs/interpreter.cpp: ditto
2854 * kjs/lookup.h: ditto
2855 * kjs/nodes.cpp: ditto
2857 2007-10-26 Mark Rowe <mrowe@apple.com>
2861 * kjs/string_object.cpp:
2862 (KJS::StringObjectFuncImp::callAsFunction):
2864 2007-10-25 Darin Adler <darin@apple.com>
2868 - http://bugs.webkit.org/show_bug.cgi?id=15703
2869 fix numeric functions -- improve correctness and speed
2871 Gives about 1% gain on SunSpider.
2873 * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
2874 (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
2875 with both immediate and number values.
2876 (KJS::JSValue::toUInt32): Ditto.
2878 (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
2879 differences. One is that it now correctly returns 0 for NaN, and another is that
2880 there's no special case for 0 or infinity, since the general case already handles
2882 (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
2884 (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
2885 truncation done by the typecast already does the necessary truncation that
2886 roundValue was doing.
2887 (KJS::JSValue::toUInt32SlowCase): Ditto.
2888 (KJS::JSValue::toUInt16): Removed.
2890 * kjs/internal.h: Removed roundValue.
2891 * kjs/internal.cpp: Ditto.
2893 * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
2894 code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
2896 * kjs/date_object.cpp:
2897 (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
2898 toNumber as specified.
2899 (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
2900 with a call to toNumber and timeClip as specified.
2901 (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
2902 where the default behavior of toInt32 (returning 0) was already correct. Replaced
2903 call to roundValue with a call to toNumber as specified.
2904 (KJS::DateObjectFuncImp::callAsFunction): Ditto.
2906 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
2907 cases for the pow function that the library already handles correctly.
2909 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
2910 call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
2911 The real toInteger now returns 0 for NaN. Took out unneeded special case in
2912 ToFixed for undefined; was only needed because our toInteger was wrong. Same
2913 thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
2915 * kjs/string_object.cpp:
2916 (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
2917 cases for undefined that were only needed because toInteger was wrong. Same in
2918 IndexOf, and was able to remove some special cases. In LastIndexOf, used
2919 toIntegerPreserveNaN, but was able to remove some special cases there too.
2920 Changed Substr implementation to preserve correct behavior with the change
2921 to toInteger and match the specification. Also made sure we weren't converting
2922 an out of range double to an int.
2923 (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
2924 toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
2925 no reason to have toUInt16 as a second, less-optimized function that's only
2926 called at this one call site.
2928 * wtf/MathExtras.h: Added trunc function for Windows.
2930 2007-10-25 Geoffrey Garen <ggaren@apple.com>
2932 Reviewed by Maciej Stachowiak.
2934 Tweaked the inner hashtable lookup loop to remove a branch in the "not
2935 found" case. .5% speedup on SunSpider.
2937 * JavaScriptCore.xcodeproj/project.pbxproj:
2941 2007-10-25 Maciej Stachowiak <mjs@apple.com>
2945 - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
2948 (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
2949 adding any value over toNumber() here.
2950 (KJS::valueForReadModifyAssignment): Ditto.
2951 (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
2953 (KJS::lessThanEq): Ditto.
2954 * JavaScriptCore.exp: Export new functions as needed.
2956 (KJS::JSValue::toPrimitive): Fixed formatting.
2957 (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
2958 to number and tells you whether a toPrimitive() conversion with a Number hint
2959 would have given a string.
2961 (KJS::StringImp::getPrimitiveNumber): Implemented.
2962 (KJS::NumberImp::getPrimitiveNumber): ditto
2963 (KJS::GetterSetterImp::getPrimitiveNumber): ditto
2964 (KJS::StringImp::toPrimitive): Fixed formatting.
2965 (KJS::NumberImp::toPrimitive): ditto
2966 (KJS::GetterSetterImp::toPrimitive): ditto
2969 (KJS::JSObject::getPrimitiveNumber): Implemented.
2972 2007-10-25 Sam Weinig <sam@webkit.org>
2974 Reviewed by Adam Roben.
2976 Remove JSStringRefCFHack from windows as it is no longer needed.
2978 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2980 2007-10-25 Geoffrey Garen <ggaren@apple.com>
2982 Reviewed by Oliver Hunt.
2984 Rolled out my last patch. It turns out that I needed 2 words, not 1,
2987 2007-10-25 Geoffrey Garen <ggaren@apple.com>
2989 Reviewed by Oliver Hunt.
2991 Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
2992 Shrink the size of an activation object by 1 word
2994 This is in preparation for adding a symbol table to the activation
2997 The basic strategy here is to rely on the mutual exclusion between
2998 the arguments object pointer and the function pointer (you only need
2999 the latter in order to create the former), and store them in the same
3000 place. The LazyArgumentsObject class encapsulates this strategy.
3002 Also inlined the ArgumentsImp constructor, for good measure.
3004 SunSpider reports no regression. Regression tests pass.
3006 * JavaScriptCore.xcodeproj/project.pbxproj:
3008 (KJS::Context::~Context):
3010 (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
3011 (KJS::ActivationImp::LazyArgumentsObject::mark):
3013 (KJS::ActivationImp::argumentsGetter):
3014 (KJS::ActivationImp::mark):
3016 (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
3017 (KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
3018 (KJS::ActivationImp::LazyArgumentsObject::resetArguments):
3019 (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
3020 (KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
3021 (KJS::ActivationImp::LazyArgumentsObject::setFunction):
3022 (KJS::ActivationImp::LazyArgumentsObject::function):
3023 (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
3024 (KJS::ActivationImp::LazyArgumentsObject::):
3025 (KJS::ActivationImp::ActivationImp::ActivationImp):
3026 (KJS::ActivationImp::resetArguments):
3028 2007-10-25 Adam Roben <aroben@apple.com>
3030 Change JavaScriptCore.vcproj to use DerivedSources.make
3032 We were trying to emulate the logic of make in
3033 build-generated-files.sh, but we got it wrong. We now use a
3034 build-generated-files very much like the one that WebCore uses to
3037 We also now only have a Debug configuration of dftables which we build
3038 even when doing a Release build of JavaScriptCore. dftables also no
3039 longer has the "_debug" name suffix.
3041 Changes mostly made by Darin, reviewed by me.
3043 * DerivedSources.make: Add a variable to set the extension used for
3044 the dftables executable.
3045 * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
3046 dftables in Release configurations.
3047 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
3048 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3049 - Updated include path to point to the new location of the derived
3051 - Modified pre-build event to pass the right arguments to
3052 build-generated-files.sh and not call dftables directly.
3053 - Added the derived source files to the project.
3054 - Removed grammarWrapper.cpp, which isn't needed now that we're
3055 compiling grammar.cpp directly.
3056 * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
3057 Slightly modified from the WebCore version.
3058 * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
3059 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
3060 - Changed the output location to match Mac.
3061 - Removed the Release configuration.
3062 - Removed the _debug suffix.
3064 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3066 Reviewed by Eric Seidel.
3068 Slightly elaborated the differences between declaration procesing in
3069 Function Code and Program Code.
3071 .3% speedup on SunSpider.
3074 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
3075 (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a
3076 minimum set of attributes instead of recomputing all the time. Also,
3077 ignore m_parameters, since programs don't have arguments.
3079 2007-10-25 Eric Seidel <eric@webkit.org>
3083 More preparation work before adding long-running mode to testkjs.
3086 (TestFunctionImp::callAsFunction):
3087 (prettyPrintScript):
3091 (fillBufferWithContentsOfFile):
3093 2007-10-25 Eric Seidel <eric@webkit.org>
3097 Bring testkjs code out of the dark ages in preparation for more
3098 radical improvements (like long-running testing support!)
3101 (TestFunctionImp::callAsFunction):
3104 (fillBufferWithContentsOfFile):
3106 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3108 Reviewed by Maciej Stachowiak.
3110 Make a fast path for declaration processing inside Function Code.
3112 Lifted declaration processing code up from individual declaration nodes
3113 and into processDeclarations.
3115 Broke out processDeclarations into two cases, depending on the type of
3116 code. This eliminates 2 branches, and facilitates more radical
3117 divergeance in the future.
3119 2.5% SunSpider speedup.
3121 * JavaScriptCore.xcodeproj/project.pbxproj:
3123 (KJS::FunctionBodyNode::initializeDeclarationStacks):
3124 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
3125 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
3126 (KJS::FunctionBodyNode::execute):
3127 (KJS::FuncDeclNode::makeFunction):
3131 2007-10-25 Maciej Stachowiak <mjs@apple.com>
3135 - add header includes needed on platforms that don't use AllInOneFile.cpp
3137 * API/JSCallbackObject.cpp:
3139 * kjs/ExecState.cpp:
3140 * kjs/array_instance.cpp:
3141 * kjs/function_object.cpp:
3142 * kjs/interpreter.cpp:
3145 2007-10-25 Eric Seidel <eric@webkit.org>
3149 * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
3151 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3153 Reviewed by Maciej Stachowiak.
3155 Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
3156 Re-order declaration initialization to avoid calling hasProperty inside
3157 VarDeclNode::processDeclaration
3159 .7% speedup on SunSpider.
3162 * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
3163 other processing of declared symbols, so the order of execution could
3167 (KJS::VarDeclNode::getDeclarations): Added special case for the
3168 "arguments" property name, explained in the comment.
3170 (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
3171 in the case of function code, since we know the declared symbol
3172 management will resolve conflicts between symbols. Yay!
3174 (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
3175 implementation of getDeclarations is non-trivial, we can't take a
3176 short-cut here any longer -- we need to put the VarDecl node on the
3177 stack so it gets processed normally.
3179 (KJS::FunctionBodyNode::processDeclarations): Changed the order of
3180 processing to enforce mutual exclusion rules.
3183 (KJS::DeclarationStacks::DeclarationStacks): Structure includes an
3184 ExecState now, for fast access to the "arguments" property name.
3186 2007-10-24 Eric Seidel <eric@webkit.org>
3190 Add a JSGlobalObject class and remove the InterpreterMap
3191 http://bugs.webkit.org/show_bug.cgi?id=15681
3193 This required making JSCallbackObject a template class to allow for
3194 JSGlobalObjects with JSCallbackObject functionality.
3196 SunSpider claims this was a 0.5% speedup.
3198 * API/JSCallbackObject.cpp:
3200 * API/JSCallbackObject.h:
3201 * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
3202 (KJS::::JSCallbackObject):
3204 (KJS::::~JSCallbackObject):
3205 (KJS::::initializeIfNeeded):
3207 (KJS::::getOwnPropertySlot):
3209 (KJS::::deleteProperty):
3210 (KJS::::implementsConstruct):
3212 (KJS::::implementsHasInstance):
3213 (KJS::::hasInstance):
3214 (KJS::::implementsCall):
3215 (KJS::::callAsFunction):
3216 (KJS::::getPropertyNames):
3219 (KJS::::setPrivate):
3220 (KJS::::getPrivate):
3222 (KJS::::cachedValueGetter):
3223 (KJS::::staticValueGetter):
3224 (KJS::::staticFunctionGetter):
3225 (KJS::::callbackGetter):
3226 * API/JSClassRef.cpp:
3227 (OpaqueJSClass::prototype):
3228 * API/JSContextRef.cpp:
3229 (JSGlobalContextCreate):
3230 * API/JSObjectRef.cpp:
3232 (JSObjectGetPrivate):
3233 (JSObjectSetPrivate):
3234 * API/JSValueRef.cpp:
3235 (JSValueIsObjectOfClass):
3236 * JavaScriptCore.exp:
3237 * JavaScriptCore.xcodeproj/project.pbxproj:
3238 * bindings/c/c_utility.cpp:
3239 (KJS::Bindings::convertValueToNPVariant):
3240 * bindings/jni/jni_jsobject.cpp:
3241 * bindings/objc/objc_utility.mm:
3242 (KJS::Bindings::convertValueToObjcValue):
3244 (KJS::Context::Context):
3245 * kjs/ExecState.cpp:
3246 (KJS::ExecState::lexicalInterpreter):
3247 * kjs/JSGlobalObject.h: Added.
3248 (KJS::JSGlobalObject::JSGlobalObject):
3249 (KJS::JSGlobalObject::isGlobalObject):
3250 (KJS::JSGlobalObject::interpreter):
3251 (KJS::JSGlobalObject::setInterpreter):
3252 * kjs/array_instance.cpp:
3255 (KJS::FunctionImp::callAsFunction):
3256 (KJS::GlobalFuncImp::callAsFunction):
3257 * kjs/interpreter.cpp:
3258 (KJS::Interpreter::Interpreter):
3259 (KJS::Interpreter::init):
3260 (KJS::Interpreter::~Interpreter):
3261 (KJS::Interpreter::globalObject):
3262 (KJS::Interpreter::initGlobalObject):
3263 (KJS::Interpreter::evaluate):
3264 * kjs/interpreter.h:
3266 (KJS::cacheGlobalObject):
3268 (KJS::JSObject::isGlobalObject):
3271 2007-10-24 Eric Seidel <eric@webkit.org>
3273 Build fix for Gtk, no review.
3275 * kjs/collector.cpp: #include "context.h"
3277 2007-10-24 Eric Seidel <eric@webkit.org>
3281 Stop checking isOutOfMemory after every allocation, instead let the collector
3282 notify all ExecStates if we ever hit this rare condition.
3284 SunSpider claims this was a 2.2% speedup.
3286 * kjs/collector.cpp:
3287 (KJS::Collector::collect):
3288 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
3291 (KJS::TryNode::execute):
3293 2007-10-24 Mark Rowe <mrowe@apple.com>
3297 * kjs/identifier.h: Remove extra qualification.
3299 2007-10-24 Geoffrey Garen <ggaren@apple.com>
3301 Reviewed by Sam Weinig.
3303 Disable ALWAYS_INLINE in debug builds, since it drives the debugger
3306 * wtf/AlwaysInline.h:
3308 2007-10-24 Geoffrey Garen <ggaren@apple.com>
3310 Reviewed by Sam Weinig.
3312 Inlined the fast path for creating an Identifier from an Identifier.
3314 This is a .4% speedup on SunSpider overall, but as big as a 2.5%
3315 speedup on certain individual tests. 65% of the Identifiers creating
3316 by SunSpider are already Identifiers.
3318 (The main reason I'm making this change is that it resolves a large
3319 regression in a patch I haven't checked in yet.)
3321 * JavaScriptCore.exp:
3322 * kjs/identifier.cpp:
3323 (KJS::Identifier::addSlowCase):
3325 (KJS::Identifier::Identifier::add):
3327 2007-10-24 Lars Knoll <lars@trolltech.com>
3331 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.
3333 * bindings/qt/qt_instance.cpp:
3334 (KJS::Bindings::QtInstance::invokeMethod):
3335 * bindings/qt/qt_runtime.cpp:
3336 (KJS::Bindings::convertValueToQVariant):
3337 (KJS::Bindings::QtField::setValueToInstance):
3339 2007-10-24 Oliver Hunt <oliver@apple.com>
3343 Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
3348 (KJS::LessNode::evaluate):
3349 (KJS::GreaterNode::evaluate):
3350 (KJS::LessEqNode::evaluate):
3351 (KJS::GreaterEqNode::evaluate):
3352 * kjs/operations.cpp:
3355 2007-10-24 Eric Seidel <eric@webkit.org>
3360 (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
3362 2007-10-24 Darin Adler <darin@apple.com>
3366 * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
3367 Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
3369 2007-10-24 Darin Adler <darin@apple.com>
3373 - separate out the code to create a hash table the first time from the code
3376 SunSpider claims this was a 0.7% speedup.
3378 * kjs/property_map.cpp:
3379 (KJS::PropertyMap::expand): Changed to call either createTable or rehash.
3380 (KJS::PropertyMap::createTable): Added. For the case where we had no table.
3381 (KJS::PropertyMap::rehash): Removed code needed only in the case where we
3383 * kjs/property_map.h: Added createTable.
3385 2007-10-24 Eric Seidel <eric@webkit.org>
3389 Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
3390 which can be represented by JSImmediate.
3392 SunSpider claims this was a 0.6% speedup.
3396 (KJS::NumberNode::evaluate):
3397 (KJS::ImmediateNumberNode::evaluate):
3400 (KJS::ImmediateNumberNode::):
3401 * kjs/nodes2string.cpp:
3402 (ImmediateNumberNode::streamTo):
3404 2007-10-24 Darin Adler <darin@apple.com>
3408 - http://bugs.webkit.org/show_bug.cgi?id=15657
3409 change static hash tables to use powers of two for speed
3411 Seems to give 0.7% SunSpider speedup.
3413 * kjs/create_hash_table: Updated to generate new format.
3415 (KJS::keysMatch): Took out unneeded typecast.
3416 (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
3417 Replaced the modulus with a bit mask.
3418 (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
3419 their hash -- saves a branch.
3420 (KJS::Lookup::find): Ditto.
3421 * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
3423 2007-10-24 Maciej Stachowiak <mjs@apple.com>
3427 - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
3430 (KJS::DoWhileNode::execute):
3431 (KJS::WhileNode::execute):
3432 (KJS::ForNode::execute):
3433 (KJS::ForInNode::execute):
3434 (KJS::SourceElementsNode::execute):
3436 2007-10-23 Darin Adler <darin@apple.com>
3440 * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
3441 Changed an && to an & for a 1% gain in SunSpider.
3443 2007-10-23 Oliver Hunt <oliver@apple.com>
3447 Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
3450 (KJS::MultNode::evaluate):
3451 (KJS::DivNode::evaluate):
3452 (KJS::ModNode::evaluate):
3455 (KJS::AddNode::evaluate):
3456 (KJS::SubNode::evaluate):
3457 (KJS::valueForReadModifyAssignment):
3458 * kjs/operations.cpp:
3461 2007-10-23 Oliver Hunt <oliver@apple.com>
3465 Separating all of the simple (eg. non-read-modify-write) binary operators
3466 into separate classes in preparation for further JS optimisations.
3468 Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
3471 * JavaScriptCore.xcodeproj/project.pbxproj:
3474 (KJS::MultNode::evaluate):
3475 (KJS::DivNode::evaluate):
3476 (KJS::ModNode::evaluate):
3477 (KJS::AddNode::evaluate):
3478 (KJS::SubNode::evaluate):
3479 (KJS::LeftShiftNode::evaluate):
3480 (KJS::RightShiftNode::evaluate):
3481 (KJS::UnsignedRightShiftNode::evaluate):
3482 (KJS::LessNode::evaluate):
3483 (KJS::GreaterNode::evaluate):
3484 (KJS::LessEqNode::evaluate):
3485 (KJS::GreaterEqNode::evaluate):
3486 (KJS::InstanceOfNode::evaluate):
3487 (KJS::InNode::evaluate):
3488 (KJS::EqualNode::evaluate):
3489 (KJS::NotEqualNode::evaluate):
3490 (KJS::StrictEqualNode::evaluate):
3491 (KJS::NotStrictEqualNode::evaluate):
3492 (KJS::BitAndNode::evaluate):
3493 (KJS::BitXOrNode::evaluate):
3494 (KJS::BitOrNode::evaluate):
3495 (KJS::LogicalAndNode::evaluate):
3496 (KJS::LogicalOrNode::evaluate):
3503 (KJS::LeftShiftNode::):
3504 (KJS::RightShiftNode::):
3505 (KJS::UnsignedRightShiftNode::):
3507 (KJS::GreaterNode::):
3508 (KJS::LessEqNode::):
3509 (KJS::GreaterEqNode::):
3510 (KJS::InstanceOfNode::):
3513 (KJS::NotEqualNode::):
3514 (KJS::StrictEqualNode::):
3515 (KJS::NotStrictEqualNode::):
3516 (KJS::BitAndNode::):
3518 (KJS::BitXOrNode::):
3519 (KJS::LogicalAndNode::):
3520 (KJS::LogicalOrNode::):
3521 * kjs/nodes2string.cpp:
3522 (MultNode::streamTo):
3523 (DivNode::streamTo):
3524 (ModNode::streamTo):
3525 (AddNode::streamTo):
3526 (SubNode::streamTo):
3527 (LeftShiftNode::streamTo):
3528 (RightShiftNode::streamTo):
3529 (UnsignedRightShiftNode::streamTo):
3530 (LessNode::streamTo):
3531 (GreaterNode::streamTo):
3532 (LessEqNode::streamTo):
3533 (GreaterEqNode::streamTo):
3534 (InstanceOfNode::streamTo):
3536 (EqualNode::streamTo):
3537 (NotEqualNode::streamTo):
3538 (StrictEqualNode::streamTo):
3539 (NotStrictEqualNode::streamTo):
3540 (BitAndNode::streamTo):
3541 (BitXOrNode::streamTo):
3542 (BitOrNode::streamTo):
3543 (LogicalAndNode::streamTo):
3545 2007-10-23 Darin Adler <darin@apple.com>
3549 - fix http://bugs.webkit.org/show_bug.cgi?id=15639
3550 fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
3552 Test: fast/js/math.html