1 2007-11-08 Darin Adler <darin@apple.com>
7 * kjs/property_map.cpp:
9 2007-11-08 Darin Adler <darin@apple.com>
11 - roll out accidentally-checked in changes
13 * kjs/nodes.cpp: Back to previous version.
15 * kjs/grammar.y: Ditto.
17 2007-11-08 Darin Adler <darin@apple.com>
21 - http://bugs.webkit.org/show_bug.cgi?id=15912
22 fasta spends a lot of time in qsort
24 * kjs/property_map.cpp:
25 (KJS::PropertyMap::getEnumerablePropertyNames):
26 Use insertion sort instead of qsort for small sets of property names.
27 We can probably do some even-better speedups of for/in, but this nets
28 0.6% overall and 6.7% on fasta.
30 2007-11-08 Darin Adler <darin@apple.com>
34 - http://bugs.webkit.org/show_bug.cgi?id=15906
35 getting characters by indexing into a string is very slow
37 This fixes one source of the slowness -- the conversion to an unused
38 Identifier as we call the get function from the slot -- but doesn't
39 fix others, such as the fact that we have to allocate a new UString::Rep
40 for every single character.
42 Speeds up string-base64 30%, and at least 0.5% overall.
43 But does slow down access-fannkuch quite a bit. Might be worth
44 revisiting in the future to see what we can do about that (although
45 I did look at a profile for a while).
47 * kjs/property_slot.h: Add a new marker for "numeric" property slots;
48 slots where we don't need to pass the identifier to the get function.
49 (KJS::PropertySlot::getValue): Added code to call the numeric get function.
50 (KJS::PropertySlot::setCustomNumeric): Added.
51 * kjs/string_object.cpp:
52 (KJS::StringInstance::indexGetter): Changed to use substr() instead
53 of constructing a wholly new UString each time.
54 (KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but
55 takes advantage of setCustomNumeric to avoid creating an Identifier.
56 (KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric.
58 2007-11-08 Darin Adler <darin@apple.com>
62 - http://bugs.webkit.org/show_bug.cgi?id=15904
63 more speed-ups possible by tightening up int version of JSImmediate
65 1% improvement of SunSpider
67 * kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template.
68 (KJS::JSImmediate::from): Overload for most numeric types; many types can
69 do fewer branches and checks.
70 (KJS::JSImmediate::getUInt32): Removed unneeded check for undefined.
71 (KJS::JSImmediate::getTruncatedInt32): Ditto.
72 (KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more
73 between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later.
75 * kjs/grammar.y: Update since fromDouble is now just from.
78 * kjs/value.h: (KJS::jsNumber): Overload for most numeric types.
80 2007-11-08 Kevin Ollivier <kevino@theolliviers.com>
82 Bakefiles for building JavaScriptCore, needed by wx port.
84 Reviewed by Mark Rowe.
86 * JavaScriptCoreSources.bkl: Added.
89 2007-11-08 Oliver Hunt <oliver@apple.com>
93 Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
95 The implementation of JSImmediate::areBothImmediateNumbers relies on
96 (JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having
97 a unique result when both immediate values are numbers.
99 The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
100 By swapping the value of NumberType and UndefinedType this ceases to be a problem.
105 2007-11-08 Darin Adler <darin@apple.com>
109 * kjs/nodes.h: Add missing parameter name.
111 2007-11-08 Eric Seidel <eric@webkit.org>
115 Add ExpressionNode subclass of Node, use it.
119 (KJS::ForInNode::ForInNode):
121 (KJS::ExpressionNode::):
123 (KJS::NullNode::precedence):
124 (KJS::BooleanNode::):
125 (KJS::BooleanNode::precedence):
127 (KJS::RegExpNode::precedence):
129 (KJS::ThisNode::precedence):
130 (KJS::ResolveNode::):
131 (KJS::ElementNode::):
133 (KJS::PropertyNode::):
134 (KJS::PropertyNode::precedence):
135 (KJS::PropertyNode::name):
136 (KJS::PropertyListNode::):
137 (KJS::ObjectLiteralNode::):
138 (KJS::ObjectLiteralNode::precedence):
139 (KJS::BracketAccessorNode::):
140 (KJS::DotAccessorNode::):
141 (KJS::DotAccessorNode::precedence):
142 (KJS::ArgumentListNode::):
143 (KJS::ArgumentsNode::):
144 (KJS::NewExprNode::):
145 (KJS::NewExprNode::precedence):
146 (KJS::FunctionCallValueNode::):
147 (KJS::FunctionCallValueNode::precedence):
148 (KJS::FunctionCallResolveNode::):
149 (KJS::FunctionCallBracketNode::):
150 (KJS::FunctionCallBracketNode::precedence):
151 (KJS::FunctionCallDotNode::):
152 (KJS::FunctionCallDotNode::precedence):
153 (KJS::PrePostResolveNode::):
154 (KJS::PostfixBracketNode::):
155 (KJS::PostfixBracketNode::precedence):
156 (KJS::PostIncBracketNode::):
157 (KJS::PostIncBracketNode::isIncrement):
158 (KJS::PostDecBracketNode::):
159 (KJS::PostDecBracketNode::isIncrement):
160 (KJS::PostfixDotNode::):
161 (KJS::PostfixDotNode::precedence):
162 (KJS::PostIncDotNode::):
163 (KJS::PostIncDotNode::isIncrement):
164 (KJS::PostDecDotNode::):
165 (KJS::PostDecDotNode::isIncrement):
166 (KJS::PostfixErrorNode::):
167 (KJS::PostfixErrorNode::precedence):
168 (KJS::DeleteResolveNode::):
169 (KJS::DeleteBracketNode::):
170 (KJS::DeleteBracketNode::precedence):
171 (KJS::DeleteDotNode::):
172 (KJS::DeleteDotNode::precedence):
173 (KJS::DeleteValueNode::):
174 (KJS::DeleteValueNode::precedence):
176 (KJS::VoidNode::precedence):
177 (KJS::TypeOfResolveNode::):
178 (KJS::TypeOfValueNode::):
179 (KJS::PrefixBracketNode::):
180 (KJS::PrefixBracketNode::precedence):
181 (KJS::PreIncBracketNode::):
182 (KJS::PreIncBracketNode::isIncrement):
183 (KJS::PreDecBracketNode::):
184 (KJS::PreDecBracketNode::isIncrement):
185 (KJS::PrefixDotNode::):
186 (KJS::PrefixDotNode::precedence):
187 (KJS::PreIncDotNode::):
188 (KJS::PreIncDotNode::isIncrement):
189 (KJS::PreDecDotNode::):
190 (KJS::PreDecDotNode::isIncrement):
191 (KJS::PrefixErrorNode::):
192 (KJS::PrefixErrorNode::precedence):
193 (KJS::UnaryPlusNode::):
194 (KJS::UnaryPlusNode::precedence):
196 (KJS::NegateNode::precedence):
197 (KJS::BitwiseNotNode::):
198 (KJS::BitwiseNotNode::precedence):
199 (KJS::LogicalNotNode::):
200 (KJS::LogicalNotNode::precedence):
202 (KJS::AddNode::precedence):
203 (KJS::LeftShiftNode::):
204 (KJS::LeftShiftNode::precedence):
205 (KJS::RightShiftNode::):
206 (KJS::RightShiftNode::precedence):
207 (KJS::UnsignedRightShiftNode::):
208 (KJS::UnsignedRightShiftNode::precedence):
210 (KJS::LessNode::precedence):
211 (KJS::GreaterNode::):
212 (KJS::GreaterNode::precedence):
214 (KJS::LessEqNode::precedence):
215 (KJS::GreaterEqNode::):
216 (KJS::GreaterEqNode::precedence):
217 (KJS::InstanceOfNode::):
218 (KJS::InstanceOfNode::precedence):
220 (KJS::InNode::precedence):
222 (KJS::EqualNode::precedence):
223 (KJS::NotEqualNode::):
224 (KJS::NotEqualNode::precedence):
225 (KJS::StrictEqualNode::):
226 (KJS::StrictEqualNode::precedence):
227 (KJS::NotStrictEqualNode::):
228 (KJS::NotStrictEqualNode::precedence):
230 (KJS::BitAndNode::precedence):
232 (KJS::BitOrNode::precedence):
234 (KJS::BitXOrNode::precedence):
235 (KJS::LogicalAndNode::):
236 (KJS::LogicalAndNode::precedence):
237 (KJS::LogicalOrNode::):
238 (KJS::LogicalOrNode::precedence):
239 (KJS::ConditionalNode::):
240 (KJS::ConditionalNode::precedence):
241 (KJS::ReadModifyResolveNode::):
242 (KJS::ReadModifyResolveNode::precedence):
243 (KJS::AssignResolveNode::):
244 (KJS::AssignResolveNode::precedence):
245 (KJS::ReadModifyBracketNode::):
246 (KJS::ReadModifyBracketNode::precedence):
247 (KJS::AssignBracketNode::):
248 (KJS::AssignBracketNode::precedence):
249 (KJS::AssignDotNode::):
250 (KJS::AssignDotNode::precedence):
251 (KJS::ReadModifyDotNode::):
252 (KJS::ReadModifyDotNode::precedence):
253 (KJS::AssignErrorNode::):
254 (KJS::AssignErrorNode::precedence):
256 (KJS::CommaNode::precedence):
257 (KJS::AssignExprNode::):
258 (KJS::AssignExprNode::precedence):
259 (KJS::ExprStatementNode::):
261 (KJS::DoWhileNode::):
266 (KJS::ParameterNode::):
267 (KJS::CaseClauseNode::):
268 (KJS::CaseClauseNode::precedence):
269 (KJS::ClauseListNode::):
272 2007-11-08 Oliver Hunt <oliver@apple.com>
276 Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
278 This only improves bitwise-and performance, as the additional logic required
279 for similar code paths on or, xor, and shifting requires additional operations
280 and branches that negate (and in certain cases, regress) any advantage we might
283 This improves performance on all bitop tests, the cryptography tests, as well as
284 the string-base64 and string-unpack-code tests. No significant degradation on
288 (KJS::JSImmediate::areBothImmediateNumbers):
289 (KJS::JSImmediate::andImmediateNumbers):
291 (KJS::BitAndNode::evaluate):
293 (KJS::jsNumberFromAnd):
295 2007-11-08 Adam Roben <aroben@apple.com>
297 Stop using KJS inside of MathExtras.h
301 * wtf/MathExtras.h: Removed an unused header, and a now-unused
303 (wtf_atan2): Use std::numeric_limits intead of KJS.
305 2007-11-08 Sam Weinig <sam@webkit.org>
309 * kjs/date_object.cpp:
310 (KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
311 (KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
312 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
314 2007-11-08 Mark Rowe <mrowe@apple.com>
318 * kjs/lookup.h: Add missing include.
320 2007-11-08 Sam Weinig <sam@webkit.org>
324 Convert JavaScript internal function objects to use one class per
325 function. This avoids a switch statement inside what used to be
326 the shared function classes and will allow Shark to better analyze
329 To make this switch, the value property of the HashEntry was changed
330 to a union of an intptr_t (which is used to continue handle valueGetters)
331 and function pointer which points to a static constructor for the
332 individual new function objects.
334 SunSpider claims this is a 1.0% speedup.
336 * kjs/array_object.cpp:
337 (KJS::ArrayPrototype::getOwnPropertySlot):
339 (KJS::ArrayProtoFuncToString::callAsFunction):
340 (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
341 (KJS::ArrayProtoFuncJoin::callAsFunction):
342 (KJS::ArrayProtoFuncConcat::callAsFunction):
343 (KJS::ArrayProtoFuncPop::callAsFunction):
344 (KJS::ArrayProtoFuncPush::callAsFunction):
345 (KJS::ArrayProtoFuncReverse::callAsFunction):
346 (KJS::ArrayProtoFuncShift::callAsFunction):
347 (KJS::ArrayProtoFuncSlice::callAsFunction):
348 (KJS::ArrayProtoFuncSort::callAsFunction):
349 (KJS::ArrayProtoFuncSplice::callAsFunction):
350 (KJS::ArrayProtoFuncUnShift::callAsFunction):
351 (KJS::ArrayProtoFuncFilter::callAsFunction):
352 (KJS::ArrayProtoFuncMap::callAsFunction):
353 (KJS::ArrayProtoFuncEvery::callAsFunction):
354 (KJS::ArrayProtoFuncForEach::callAsFunction):
355 (KJS::ArrayProtoFuncSome::callAsFunction):
356 (KJS::ArrayProtoFuncIndexOf::callAsFunction):
357 (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
358 * kjs/array_object.h:
359 (KJS::ArrayPrototype::classInfo):
360 * kjs/create_hash_table:
361 * kjs/date_object.cpp:
362 (KJS::DatePrototype::getOwnPropertySlot):
363 (KJS::DateProtoFuncToString::callAsFunction):
364 (KJS::DateProtoFuncToUTCString::callAsFunction):
365 (KJS::DateProtoFuncToDateString::callAsFunction):
366 (KJS::DateProtoFuncToTimeString::callAsFunction):
367 (KJS::DateProtoFuncToLocaleString::callAsFunction):
368 (KJS::DateProtoFuncToLocaleDateString::callAsFunction):
369 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
370 (KJS::DateProtoFuncValueOf::callAsFunction):
371 (KJS::DateProtoFuncGetTime::callAsFunction):
372 (KJS::DateProtoFuncGetFullYear::callAsFunction):
373 (KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
374 (KJS::DateProtoFuncToGMTString::callAsFunction):
375 (KJS::DateProtoFuncGetMonth::callAsFunction):
376 (KJS::DateProtoFuncGetUTCMonth::callAsFunction):
377 (KJS::DateProtoFuncGetDate::callAsFunction):
378 (KJS::DateProtoFuncGetUTCDate::callAsFunction):
379 (KJS::DateProtoFuncGetDay::callAsFunction):
380 (KJS::DateProtoFuncGetUTCDay::callAsFunction):
381 (KJS::DateProtoFuncGetHours::callAsFunction):
382 (KJS::DateProtoFuncGetUTCHours::callAsFunction):
383 (KJS::DateProtoFuncGetMinutes::callAsFunction):
384 (KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
385 (KJS::DateProtoFuncGetSeconds::callAsFunction):
386 (KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
387 (KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
388 (KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
389 (KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
390 (KJS::DateProtoFuncSetTime::callAsFunction):
391 (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
392 (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
393 (KJS::DateProtoFuncSetSeconds::callAsFunction):
394 (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
395 (KJS::DateProtoFuncSetMinutes::callAsFunction):
396 (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
397 (KJS::DateProtoFuncSetHours::callAsFunction):
398 (KJS::DateProtoFuncSetUTCHours::callAsFunction):
399 (KJS::DateProtoFuncSetDate::callAsFunction):
400 (KJS::DateProtoFuncSetUTCDate::callAsFunction):
401 (KJS::DateProtoFuncSetMonth::callAsFunction):
402 (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
403 (KJS::DateProtoFuncSetFullYear::callAsFunction):
404 (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
405 (KJS::DateProtoFuncSetYear::callAsFunction):
406 (KJS::DateProtoFuncGetYear::callAsFunction):
412 (KJS::staticFunctionGetter):
413 (KJS::staticValueGetter):
414 (KJS::getStaticPropertySlot):
415 (KJS::getStaticFunctionSlot):
417 * kjs/math_object.cpp:
418 (KJS::MathObjectImp::getOwnPropertySlot):
419 (KJS::MathProtoFuncAbs::callAsFunction):
420 (KJS::MathProtoFuncACos::callAsFunction):
421 (KJS::MathProtoFuncASin::callAsFunction):
422 (KJS::MathProtoFuncATan::callAsFunction):
423 (KJS::MathProtoFuncATan2::callAsFunction):
424 (KJS::MathProtoFuncCeil::callAsFunction):
425 (KJS::MathProtoFuncCos::callAsFunction):
426 (KJS::MathProtoFuncExp::callAsFunction):
427 (KJS::MathProtoFuncFloor::callAsFunction):
428 (KJS::MathProtoFuncLog::callAsFunction):
429 (KJS::MathProtoFuncMax::callAsFunction):
430 (KJS::MathProtoFuncMin::callAsFunction):
431 (KJS::MathProtoFuncPow::callAsFunction):
432 (KJS::MathProtoFuncRandom::callAsFunction):
433 (KJS::MathProtoFuncRound::callAsFunction):
434 (KJS::MathProtoFuncSin::callAsFunction):
435 (KJS::MathProtoFuncSqrt::callAsFunction):
436 (KJS::MathProtoFuncTan::callAsFunction):
438 (KJS::MathObjectImp::classInfo):
439 (KJS::MathObjectImp::):
440 * kjs/string_object.cpp:
441 (KJS::StringPrototype::getOwnPropertySlot):
442 (KJS::StringProtoFuncToString::callAsFunction):
443 (KJS::StringProtoFuncValueOf::callAsFunction):
444 (KJS::StringProtoFuncCharAt::callAsFunction):
445 (KJS::StringProtoFuncCharCodeAt::callAsFunction):
446 (KJS::StringProtoFuncConcat::callAsFunction):
447 (KJS::StringProtoFuncIndexOf::callAsFunction):
448 (KJS::StringProtoFuncLastIndexOf::callAsFunction):
449 (KJS::StringProtoFuncMatch::callAsFunction):
450 (KJS::StringProtoFuncSearch::callAsFunction):
451 (KJS::StringProtoFuncReplace::callAsFunction):
452 (KJS::StringProtoFuncSlice::callAsFunction):
453 (KJS::StringProtoFuncSplit::callAsFunction):
454 (KJS::StringProtoFuncSubstr::callAsFunction):
455 (KJS::StringProtoFuncSubstring::callAsFunction):
456 (KJS::StringProtoFuncToLowerCase::callAsFunction):
457 (KJS::StringProtoFuncToUpperCase::callAsFunction):
458 (KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
459 (KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
460 (KJS::StringProtoFuncLocaleCompare::callAsFunction):
461 (KJS::StringProtoFuncBig::callAsFunction):
462 (KJS::StringProtoFuncSmall::callAsFunction):
463 (KJS::StringProtoFuncBlink::callAsFunction):
464 (KJS::StringProtoFuncBold::callAsFunction):
465 (KJS::StringProtoFuncFixed::callAsFunction):
466 (KJS::StringProtoFuncItalics::callAsFunction):
467 (KJS::StringProtoFuncStrike::callAsFunction):
468 (KJS::StringProtoFuncSub::callAsFunction):
469 (KJS::StringProtoFuncSup::callAsFunction):
470 (KJS::StringProtoFuncFontcolor::callAsFunction):
471 (KJS::StringProtoFuncFontsize::callAsFunction):
472 (KJS::StringProtoFuncAnchor::callAsFunction):
473 (KJS::StringProtoFuncLink::callAsFunction):
474 * kjs/string_object.h:
476 2007-11-08 Adam Roben <aroben@apple.com>
480 Reviewed by Sam and Ada.
482 * wtf/MathExtras.h: Get rid of a circular #include dependency to fix
485 2007-11-08 Adam Roben <aroben@apple.com>
487 Fix a precedence warning on Windows
490 (KJS::JSImmediate::toBoolean):
492 2007-11-08 Mark Rowe <mrowe@apple.com>
494 Build fix for JavaScriptGlue.
496 * wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
498 2007-11-08 Darin Adler <darin@apple.com>
502 * kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
504 2007-11-08 Oliver Hunt <oliver@apple.com>
508 Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
510 Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
511 we should now have faster array access, faster immediate to double conversion, and the
512 potential to further improve bitwise operators in future.
514 This also removes the need for unions to avoid strict aliasing problems when extracting
515 a value from immediates.
519 (KJS::JSImmediate::trueImmediate):
520 (KJS::JSImmediate::falseImmediate):
521 (KJS::JSImmediate::undefinedImmediate):
522 (KJS::JSImmediate::nullImmediate):
523 (KJS::JSImmediate::toBoolean):
527 2007-11-07 Eric Seidel <eric@webkit.org>
529 Reviewed by Darin and Oliver.
531 Add evaluateToNumber parallel evaluation tree to speed up number operations.
532 Make ImmediateNumberNode a subclass of NumberNode.
533 Share evaluate logic between evaluate and evaluateToNumber using inline functions
534 There is still a lot of improvement to be made here.
536 SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
537 Given the huge win that this prepares us for with simple type inferencing I see the small
538 regression in base64 being worth the substantial overall improvement.
542 (KJS::Node::evaluateToNumber):
543 (KJS::NumberNode::evaluate):
544 (KJS::NumberNode::evaluateToNumber):
545 (KJS::StringNode::evaluateToNumber):
546 (KJS::LocalVarAccessNode::inlineEvaluate):
547 (KJS::LocalVarAccessNode::evaluate):
548 (KJS::LocalVarAccessNode::evaluateToNumber):
549 (KJS::BracketAccessorNode::inlineEvaluate):
550 (KJS::BracketAccessorNode::evaluate):
551 (KJS::BracketAccessorNode::evaluateToNumber):
552 (KJS::NegateNode::evaluate):
553 (KJS::NegateNode::evaluateToNumber):
554 (KJS::MultNode::inlineEvaluateToNumber):
555 (KJS::MultNode::evaluate):
556 (KJS::MultNode::evaluateToNumber):
557 (KJS::DivNode::inlineEvaluateToNumber):
558 (KJS::DivNode::evaluate):
559 (KJS::DivNode::evaluateToNumber):
560 (KJS::ModNode::inlineEvaluateToNumber):
561 (KJS::ModNode::evaluate):
562 (KJS::ModNode::evaluateToNumber):
563 (KJS::throwOutOfMemoryErrorToNumber):
564 (KJS::addSlowCaseToNumber):
567 (KJS::AddNode::evaluateToNumber):
568 (KJS::SubNode::inlineEvaluateToNumber):
569 (KJS::SubNode::evaluate):
570 (KJS::SubNode::evaluateToNumber):
571 (KJS::valueForReadModifyAssignment):
572 (KJS::ReadModifyLocalVarNode::evaluate):
573 (KJS::ReadModifyResolveNode::evaluate):
574 (KJS::ReadModifyDotNode::evaluate):
575 (KJS::ReadModifyBracketNode::evaluate):
579 (KJS::ImmediateNumberNode::):
580 (KJS::AddNode::precedence):
581 * kjs/nodes2string.cpp:
582 (KJS::NumberNode::streamTo):
584 2007-11-07 Mark Rowe <mrowe@apple.com>
588 Fix up initialization after being mangled in r27572, and remove the
589 ternary expression as extraCost will always be zero for the numeric
593 (KJS::Collector::heapAllocate):
595 2007-11-07 Mark Rowe <mrowe@apple.com>
599 * kjs/regexp_object.cpp:
601 2007-11-07 Geoffrey Garen <ggaren@apple.com>
603 Reviewed by Beth Dakin.
605 Eliminated a bogus (though compiled-out) branch in the collector.
608 (KJS::Collector::heapAllocate):
610 2007-11-06 Geoffrey Garen <ggaren@apple.com>
612 Reviewed by Darin Adler.
614 Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861
615 5.8% of string-validate-input.js is spent creating RegExpImps
617 Put RegExpImp properties into a static hashtable to avoid a slew of
618 PropertyMap churn when creating a RegExpImp.
620 Factored important bits of regular expression implementation out of
621 RegExpImp (the JS object) and into RegExp (the PCRE wrapper class),
622 making RegExp a ref-counted class. (This will help later.)
624 Removed PCRE_POSIX support because I didn't quite know how to test it
625 and keep it working with these changes.
627 1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
629 * kjs/regexp.h: A few interface changes:
630 1. Renamed "subpatterns()" => "numSubpatterns()"
631 2. Made flag enumeration private and replaced it with public getters for
633 3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
634 4. Made RegExp take a string of flags instead of an int, eliminating
635 duplicated flag parsing code elsewhere.
637 * kjs/regexp_object.cpp:
638 (KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile:
639 - Fixed a bug where compile(undefined) would throw an exception.
640 - Removed some now-redundant code.
641 - Used RegExp sharing to eliminate an allocation and a bunch of
642 PropertyMap thrash. (Not a big win since compile is a deprecated
643 function. I mainly did this to test the plubming.)
645 2007-11-07 Simon Hausmann <hausmann@kde.org>
647 Reviewed by nobody, Qt/Windows build fix.
649 JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
650 testkjs.pro, too, where it's included from.
654 2007-11-07 Simon Hausmann <shausman@trolltech.com>
658 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.
660 * JavaScriptCore.pri:
663 2007-11-07 Lars Knoll <lars@trolltech.com>
669 Pretty embarrassing bug. Has the potential to fix quite a few test failures.
671 * wtf/unicode/qt4/UnicodeQt4.h:
672 (WTF::Unicode::umemcasecmp):
674 2007-11-06 Maciej Stachowiak <mjs@apple.com>
678 - only collect when the heap is full, unless we have lots of extra cost garbage
680 1.1% SunSpider speedup.
682 This shouldn't hit memory use much since the extra space in those
683 blocks hangs around either way.
686 (KJS::Collector::heapAllocate):
687 (KJS::Collector::collect): Fix logic error that reversed the sense of collect's
690 2007-11-06 Oliver Hunt <oliver@apple.com>
694 Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
696 We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
697 'for (...; ...; ++<var>) ...'.
700 (KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
701 (KJS::PostIncLocalVarNode::evaluate):
702 (KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
703 (KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
704 (KJS::PostDecLocalVarNode::evaluate):
705 (KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
707 (KJS::PrePostResolveNode::):
708 (KJS::PostIncResolveNode::):
709 (KJS::PostIncLocalVarNode::):
710 (KJS::PostDecResolveNode::):
711 (KJS::PostDecLocalVarNode::):
712 (KJS::PreIncResolveNode::):
713 (KJS::PreDecResolveNode::):
714 (KJS::ForNode::ForNode):
716 2007-11-06 Eric Seidel <eric@webkit.org>
720 This fixes a regressed layout test for string + object
722 SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
725 (KJS::add): remove erroneous "fast path" for string + *
727 2007-11-06 Geoffrey Garen <ggaren@apple.com>
729 Reviewed by Eric Seidel.
731 Added toJSNumber, a fast path for converting a JSValue to a JS number,
732 and deployed it in postfix expressions. In the fast case this
733 eliminates a call to jsNumber.
735 0.4% speedup on SunSpider.
739 (KJS::PostIncResolveNode::evaluate):
740 (KJS::PostIncLocalVarNode::evaluate):
741 (KJS::PostDecResolveNode::evaluate):
742 (KJS::PostDecLocalVarNode::evaluate):
743 (KJS::PostIncBracketNode::evaluate):
744 (KJS::PostDecBracketNode::evaluate):
745 (KJS::PostIncDotNode::evaluate):
746 (KJS::PostDecDotNode::evaluate):
747 (KJS::UnaryPlusNode::evaluate):
749 (KJS::JSValue::toJSNumber):
751 2007-11-06 Darin Adler <darin@apple.com>
755 - http://bugs.webkit.org/show_bug.cgi?id=15846
756 REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
758 There was a mistake in the algorithm used to find an empty slot in the property
759 map entries vector; when we were putting in a new property value and not overwriting
760 an existing deleted sentinel, we would enlarge the entries vector, but would not
761 overwrite the stale data that's in the new part. It was easy to pin this down by
762 turning on property map consistency checks -- I never would have landed with this
763 bug if I had run the regression tests once with consistency checks on!
765 * kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
766 foundDeletedElement is false to always use the item at the end of the entries vector.
767 Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
769 2007-11-06 Oliver Hunt <oliver@apple.com>
773 Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
778 2007-11-06 Oliver Hunt <oliver@apple.com>
782 Replace boolean comparisons in AddNode with mask
783 comparisons for a 0.2% improvement in sunspider.
785 * JavaScriptCore.xcodeproj/project.pbxproj:
789 2007-11-06 Eric Seidel <eric@webkit.org>
793 SunSpider claims this is a 1.1% speedup.
796 (KJS::throwOutOfMemoryError): Added, non inline.
797 (KJS::addSlowCase): renamed from add(), non inline.
798 (KJS::add): add fast path for String + String, Number + Number and String + *
800 2007-11-06 Eric Seidel <eric@webkit.org>
804 Avoid more UString creation.
806 SunSpider claims this is a 0.4% speedup.
808 * kjs/regexp_object.cpp:
809 (KJS::RegExpObjectImp::construct): use UString::find(UChar)
811 2007-11-05 Mark Rowe <mrowe@apple.com>
815 * kjs/array_object.cpp:
816 (KJS::ArrayProtoFunc::callAsFunction):
818 2007-11-05 Adam Roben <aroben@apple.com>
824 2007-11-05 Mark Rowe <mrowe@apple.com>
826 Build fix. Add missing #include.
828 * kjs/operations.cpp:
830 2007-11-05 Eric Seidel <eric@webkit.org>
834 Remove another call to toString(exec)
836 SunSpider claims this is a 0.5% speedup.
838 * kjs/operations.cpp:
839 (KJS::equal): remove another toString
841 2007-11-05 Eric Seidel <eric@webkit.org>
843 * kjs/operations.cpp:
844 (KJS::equal): correct broken change.
846 2007-11-05 Eric Seidel <eric@webkit.org>
850 Remove one more call to toString(exec).
852 SunSpider claims this is a 0.7% speedup.
854 * kjs/operations.cpp:
855 (KJS::equal): remove a call to toString()
857 2007-11-05 Mark Rowe <mrowe@apple.com>
863 2007-11-05 Mark Rowe <mrowe@apple.com>
869 2007-11-05 Geoffrey Garen <ggaren@apple.com>
871 Touched a file to test my new HTTP access.
873 * kjs/scope_chain.cpp:
875 2007-11-05 Alp Toker <alp@atoker.com>
877 Unreviewed build fix for qmake-based ports.
879 Someone with a better understanding of qmake still needs to sort out
880 the INCLUDEPATH/DEPENDPATH mess.
882 * JavaScriptCore.pri:
884 2007-11-05 Geoffrey Garen <ggaren@apple.com>
886 Reviewed by Darin Adler.
888 http://bugs.webkit.org/show_bug.cgi?id=15835
890 Switched List implementation from a custom heap allocator to an inline
891 Vector, for a disappointing .5% SunSpider speedup.
893 Also renamed List::slice to List::getSlice because "get" is the
894 conventional prefix for functions returning a value through an out
897 * kjs/array_object.cpp:
898 (KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
899 calls and memory accesses.
901 * kjs/bool_object.cpp:
902 (BooleanObjectImp::construct): Removed questionable use of iterator.
905 * kjs/list.h: New List class, implemented in terms of Vector. Two
906 interesting differences:
907 1. The inline capacity is 8, not 5. Many of the Lists constructed
908 during a SunSpider run are larger than 5; almost none are larger
911 2. The growth factor is 4, not 2. Since we can guarantee that Lists
912 aren't long-lived, we can grow them more aggressively, to avoid
915 * kjs/regexp_object.cpp:
916 (RegExpObjectImp::construct): Removed redundant function calls.
918 * kjs/string_object.cpp:
919 (KJS::StringObjectImp::construct): Removed questionable use of iterator.
922 (WTF::::uncheckedAppend): Added a fast, unchecked version of append.
924 2007-11-05 Mark Rowe <mrowe@apple.com>
926 Reviewed by Alp Toker.
928 Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
930 * JavaScriptCore.pri:
933 2007-11-04 Darin Adler <darin@apple.com>
937 - http://bugs.webkit.org/show_bug.cgi?id=15826
938 optimize opcode loop and case insensitive ASCII compares for a 30% speedup
940 SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
942 * pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
944 * pcre/pcre_compile.c:
945 (find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
946 added OP_NOT since there was no reason it should not be in here.
947 (could_be_empty_branch): Ditto.
948 (compile_branch): Streamlined all the single-character cases; there was a bit of
949 duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
950 But in particular, compile to those opcodes when the single character match is
952 (find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
954 * pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
955 the matchframe, after I discovered that none of them needed to be saved and restored
956 across recursive match calls. Also eliminated the ignored result field from the
957 matchframe, since I discovered that rrc ("recursive result code") was already the
958 exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
959 statement of the switch instead of doing them before the switch. This removes a
960 branch from each iteration of the opcode interpreter, just as removal of "op"
961 removed at least one store from each iteration. Last, but not least, add the
962 OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
963 surrogate pair and the letter case can be handled efficiently.
965 2007-11-04 Darin Adler <darin@apple.com>
967 * pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
969 2007-11-03 Darin Adler <darin@apple.com>
971 - fix non-Mac builds; remove some more unused PCRE stuff
973 * pcre/pcre_compile.c:
974 (compile_branch): Removed branch chain and some unused ESC values.
975 (compile_regex): Ditto.
976 (jsRegExpCompile): Ditto.
978 (match): Removed unused branch targets. Don't use macros any more.
979 (jsRegExpExecute): More of the same.
981 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
982 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
983 * pcre/pcre.pri: Ditto.
985 * pcre/MERGING: Removed.
986 * pcre/pcre_fullinfo.c: Removed.
987 * pcre/pcre_get.c: Removed.
988 * pcre/pcre_internal.h:
989 * pcre/ucp.h: Removed.
991 2007-11-03 Darin Adler <darin@apple.com>
995 - http://bugs.webkit.org/show_bug.cgi?id=15821
996 remove unused PCRE features for speed
998 A first step toward removing the PCRE features we don't use.
999 This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
1000 the SunSpider regular expression test.
1002 Replaced the public interface with one that doesn't use the
1003 name PCRE. Removed code we don't need for JavaScript and various
1004 configurations we don't use. This is in preparation for still
1005 more changes in the future. We'll probably switch to C++ and
1006 make some even more significant changes to the regexp engine
1007 to get some additional speed.
1009 There's probably additional unused stuff that I haven't
1012 This does mean that our PCRE is now a fork, but I think that's
1013 not really a big deal.
1015 * JavaScriptCore.exp: Remove the 5 old entry points and add
1016 the 3 new entry points for WebCore's direct use of the regular
1019 * kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
1020 its sense and now there's a USE(POSIX_REGEX) instead, which should
1021 probably not be set by anyone. Maybe later we'll just get rid of it
1026 (KJS::RegExp::RegExp): Switch to new jsRegExp function names and
1027 defines. Cut down on the number of functions used.
1028 (KJS::RegExp::~RegExp): Ditto.
1029 (KJS::RegExp::match): Ditto.
1031 * pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
1034 * pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
1035 size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
1036 POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
1037 and JAVASCRIPT. These are all no longer configurable in our copy
1040 * pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
1041 version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
1042 the include of <stdlib.h>, and most of the constants and
1043 functions defined in this header. Changed the naming scheme to
1044 use a JSRegExp prefix rather than a pcre prefix. In the future,
1045 we'll probably change this to be a C++ header.
1047 * pcre/pcre_compile.c: Removed all unused code branches,
1048 including many whole functions and various byte codes.
1049 Kept changes outside of removal to a minimum.
1051 (first_significant_code):
1054 (could_be_empty_branch):
1059 (find_firstassertedchar):
1060 (jsRegExpCompile): Renamed from pcre_compile2 and changed the
1061 parameters around a bit.
1062 (jsRegExpFree): Added.
1064 * pcre/pcre_exec.c: Removed many unused opcodes and variables.
1065 Also started tearing down the NO_RECURSE mechanism since it's
1066 now the default. In some cases there were things in the explicit
1067 frame that could be turned into plain old local variables and
1068 other small like optimizations.
1071 (match): Changed parameters quite a bit since it's now not used
1073 (jsRegExpExecute): Renamed from pcre_exec.
1075 * pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
1076 PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
1077 PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
1078 PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
1079 _pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
1080 and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
1082 * pcre/pcre_maketables.c: Changed to only compile in dftables.
1083 Also got rid of many of the tables that we don't use.
1085 * pcre/pcre_tables.c: Removed the unused Unicode property tables.
1087 * pcre/pcre_ucp_searchfuncs.c: Removed everything except for
1088 _pcre_ucp_othercase.
1090 * pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
1091 for classes based on Unicode properties.
1093 * wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
1094 to eliminate this completely, but we need the regular expression
1095 code to be C++ first.
1097 * pcre/pcre_fullinfo.c:
1100 Files that are no longer needed. I didn't remove them with this
1101 check-in, because I didn't want to modify all the project files.
1103 2007-11-03 Maciej Stachowiak <mjs@apple.com>
1107 - remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
1109 It turns out that doing this check costs more than it saves.
1111 * kjs/JSImmediate.h:
1112 (KJS::JSImmediate::fromDouble):
1114 2007-11-03 Sam Weinig <sam@webkit.org>
1118 Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
1119 The variable had been kept around for binary compatibility, but since nothing
1120 else is there is no point in continuing to keep it around.
1122 * API/JSCallbackConstructor.cpp:
1124 * API/JSCallbackFunction.cpp:
1126 * API/JSCallbackObject.cpp:
1128 * bindings/objc/objc_runtime.mm:
1129 * bindings/runtime_array.cpp:
1130 * bindings/runtime_object.cpp:
1131 * kjs/array_instance.cpp:
1133 * kjs/array_object.cpp:
1135 * kjs/bool_object.cpp:
1136 * kjs/date_object.cpp:
1138 * kjs/error_object.cpp:
1144 * kjs/math_object.cpp:
1145 * kjs/number_object.cpp:
1147 * kjs/regexp_object.cpp:
1148 * kjs/string_object.cpp:
1151 2007-11-03 Kevin McCullough <kmccullough@apple.com>
1153 - Updated testkjs results to make the build bots green until we
1154 can fix the tests that are failing. The new failures are in DST.
1156 * tests/mozilla/expected.html:
1158 2007-11-03 Maciej Stachowiak <mjs@apple.com>
1162 - don't print the var twice for ForInNodes with a var declaration
1164 * kjs/nodes2string.cpp:
1165 (KJS::ForInNode::streamTo):
1167 2007-11-03 Darin Adler <darin@apple.com>
1169 * pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
1170 C-incompatible declaration.
1172 2007-11-03 Mark Rowe <mrowe@apple.com>
1176 * kjs/nodes.cpp: Add missing include.
1178 2007-11-03 Darin Adler <darin@apple.com>
1182 - fix http://bugs.webkit.org/show_bug.cgi?id=15814
1183 <rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
1185 These changes cause us to match the JavaScript specification and pass the
1186 fast/js/kde/encode_decode_uri.html test.
1188 * kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
1189 new strict mode, throwing an exception if there are malformed UTF-16 surrogate
1192 * kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
1194 (KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
1195 those might be illegal in some sense, they aren't supposed to get any special
1196 handling in the place where this function is currently used.
1197 (KJS::UString::UTF8String): Added the strictness.
1199 2007-11-03 Darin Adler <darin@apple.com>
1203 - http://bugs.webkit.org/show_bug.cgi?id=15812
1204 some JavaScript tests (from the Mozilla test suite) are failing
1206 Two or three fixes get 7 more of the Mozilla tests passing.
1207 This gets us down from 61 failing tests to 54.
1209 * kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
1210 Made this inline and gave it a more specific type. Some day we should
1211 probably do that for all of these -- might even get a bit of a speed
1213 * kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
1214 inline in the header.
1216 * kjs/regexp_object.h:
1217 * kjs/regexp_object.cpp:
1218 (KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
1219 switch statement into the RegExpImp object, so they can be shared with
1220 RegExpImp::callAsFunction.
1221 (KJS::RegExpImp::match): Added. Common code used by both test and exec.
1222 (KJS::RegExpImp::test): Added.
1223 (KJS::RegExpImp::exec): Added.
1224 (KJS::RegExpImp::implementsCall): Added.
1225 (KJS::RegExpImp::callAsFunction): Added.
1226 (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
1227 lastInput to null rather than empty string -- we take advantage of the
1228 difference in RegExpImp::match.
1229 (KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
1230 just to get at a field like this.
1232 * pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
1233 the JavaScript specification. If there are not 4 hex digits after the \u,
1234 then it's processed as if it wasn't an escape sequence at all.
1236 * pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
1237 for JavaScript (4 specific Unicode values).
1239 (match): Changed all call sites to use IS_NEWLINE.
1242 * tests/mozilla/expected.html: Updated to expect 7 more successful tests.
1244 2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
1246 Sort files(...); sections of Xcode project files.
1248 Rubber-stamped by Darin.
1250 * JavaScriptCore.xcodeproj/project.pbxproj:
1252 2007-11-03 Maciej Stachowiak <mjs@apple.com>
1256 - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
1260 (KJS::VarDeclNode::optimizeVariableAccess):
1261 (KJS::VarDeclNode::getDeclarations):
1262 (KJS::VarDeclNode::handleSlowCase):
1263 (KJS::VarDeclNode::evaluateSingle):
1264 (KJS::VarDeclNode::evaluate):
1265 (KJS::VarStatementNode::execute):
1267 (KJS::VarDeclNode::):
1268 (KJS::VarStatementNode::):
1269 * kjs/nodes2string.cpp:
1270 (KJS::VarDeclNode::streamTo):
1272 2007-11-03 Alexey Proskuryakov <ap@webkit.org>
1276 http://bugs.webkit.org/show_bug.cgi?id=15800
1277 REGRESSION (r27303): RegExp leaks
1279 * kjs/regexp_object.h:
1280 (KJS::RegExpImp::setRegExp):
1281 (KJS::RegExpImp::regExp):
1282 (KJS::RegExpImp::classInfo):
1283 * kjs/regexp_object.cpp:
1284 (RegExpImp::RegExpImp):
1285 (RegExpImp::~RegExpImp):
1286 Renamed reg member variable to m_regExp, changed it to use OwnPtr.
1288 2007-11-02 Maciej Stachowiak <mjs@apple.com>
1292 - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
1296 (KJS::statementListPushFIFO):
1297 (KJS::statementListGetDeclarations):
1298 (KJS::statementListInitializeDeclarationStacks):
1299 (KJS::statementListInitializeVariableAccessStack):
1300 (KJS::statementListExecute):
1301 (KJS::BlockNode::BlockNode):
1302 (KJS::FunctionBodyNode::FunctionBodyNode):
1303 (KJS::ProgramNode::ProgramNode):
1305 (KJS::CaseClauseNode::):
1307 2007-11-02 Darin Adler <darin@apple.com>
1311 - http://bugs.webkit.org/show_bug.cgi?id=15791
1312 change property map data structure for less memory use, better speed
1314 The property map now has an array of indices and a separate array of
1315 property map entries. This slightly slows down lookup because of a second
1316 memory acess, but makes property maps smaller and faster to iterate in
1317 functions like mark().
1319 SunSpider says this is 1.2% faster, although it makes the bitwise-end test
1320 more than 10% slower. To fix that we'll need to optimize global variable lookup.
1322 * kjs/property_map.cpp:
1323 (KJS::PropertyMapEntry::PropertyMapEntry):
1324 (KJS::PropertyMapHashTable::entries):
1325 (KJS::PropertyMapHashTable::allocationSize):
1326 (KJS::SavedProperties::SavedProperties):
1327 (KJS::SavedProperties::~SavedProperties):
1328 (KJS::PropertyMap::checkConsistency):
1329 (KJS::PropertyMap::~PropertyMap):
1330 (KJS::PropertyMap::clear):
1331 (KJS::PropertyMap::get):
1332 (KJS::PropertyMap::getLocation):
1333 (KJS::PropertyMap::put):
1334 (KJS::PropertyMap::insert):
1335 (KJS::PropertyMap::createTable):
1336 (KJS::PropertyMap::rehash):
1337 (KJS::PropertyMap::remove):
1338 (KJS::PropertyMap::mark):
1339 (KJS::comparePropertyMapEntryIndices):
1340 (KJS::PropertyMap::containsGettersOrSetters):
1341 (KJS::PropertyMap::getEnumerablePropertyNames):
1342 (KJS::PropertyMap::save):
1343 (KJS::PropertyMap::restore):
1344 * kjs/property_map.h:
1346 2007-11-02 Darin Adler <darin@apple.com>
1350 - http://bugs.webkit.org/show_bug.cgi?id=15807
1351 HashMap needs a take() function that combines get and remove
1353 * wtf/HashMap.h: Added take function. Simplistic implementation for now,
1354 but still does only one hash table lookup.
1356 * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
1357 a find followed by a remove.
1359 2007-11-02 David Carson <dacarson@gmail.com>
1363 Fix compiler warning "warning: suggest parentheses around && within ||"
1364 http://bugs.webkit.org/show_bug.cgi?id=15764
1366 * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
1368 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1370 Reviewed by Maciej Stachowiak.
1372 In preparation for making List a simple stack-allocated Vector:
1374 Removed all instances of List copying and/or assignment, and made List
1375 inherit from Noncopyable.
1377 Functions that used to return a List by copy now take List& out
1380 Layout tests and JS tests pass.
1383 (KJS::List::slice): Replaced copyTail with a more generic slice
1384 alternative. (JavaScriptCore only calls slice(1), but WebCore calls
1387 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1389 Reviewed by Maciej Stachowiak.
1391 Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
1392 REGRESSION(r27344): Crash on load at finance.yahoo.com
1394 Reverted a small portion of my last check-in. (The speedup and the List
1395 removal are still there, though.)
1397 ActivationImp needs to hold a pointer to its function, and mark that
1398 pointer (rather than accessing its function through its ExecState, and
1399 counting on the active scope to mark its function) because a closure
1400 can cause an ActivationImp to outlive its ExecState along with any
1403 * kjs/ExecState.cpp:
1404 (KJS::ExecState::ExecState):
1406 (KJS::FunctionImp::~FunctionImp):
1407 (KJS::ActivationImp::ActivationImp):
1409 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
1411 Also made HashTable a little more crash-happy in debug builds, so
1412 problems like this will show up earlier:
1415 (WTF::HashTable::~HashTable):
1417 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1419 Reviewed by Adam Roben.
1421 Addressed some of Darin's review comments.
1423 Used perl -p, which is the shorthand while(<>) {}.
1425 Made sure not to suppress bison's output.
1427 Added line to removed bison_out.txt, since this script removes other
1428 intermediate files, too.
1430 * DerivedSources.make:
1432 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1434 Reviewed by Oliver Hunt.
1436 Removed List from ActivationImp, in preparation for making all lists
1441 1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
1443 * kjs/ExecState.cpp:
1444 (KJS::ExecState::ExecState):
1445 (KJS::ExecState::~ExecState):
1447 (KJS::ActivationImp::ActivationImp):
1448 (KJS::ActivationImp::createArgumentsObject):
1450 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
1452 2007-11-01 Adam Roben <aroben@apple.com>
1454 Use jsNumberCell instead of jsNumber when converting double constants to JSValues
1456 This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
1457 ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
1459 It also gets rid of an MSVC warning that we previously had to silence.
1463 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
1464 back on the "overflow in constant arithmetic" warning.
1465 * kjs/number_object.cpp:
1466 (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
1469 2007-10-31 Adam Roben <aroben@apple.com>
1475 2007-10-31 Maciej Stachowiak <mjs@apple.com>
1479 - shave some cycles off of local storage access for a 1% SunSpider speedup
1481 Keep the LocalStorage pointer in the ExecState, instead of getting
1482 it from the ActivationImp all the time.
1484 * kjs/ExecState.cpp:
1485 (KJS::ExecState::updateLocalStorage):
1487 (KJS::ExecState::localStorage):
1489 (KJS::LocalVarAccessNode::evaluate):
1490 (KJS::LocalVarFunctionCallNode::evaluate):
1491 (KJS::PostIncLocalVarNode::evaluate):
1492 (KJS::PostDecLocalVarNode::evaluate):
1493 (KJS::LocalVarTypeOfNode::evaluate):
1494 (KJS::PreIncLocalVarNode::evaluate):
1495 (KJS::PreDecLocalVarNode::evaluate):
1496 (KJS::ReadModifyLocalVarNode::evaluate):
1497 (KJS::AssignLocalVarNode::evaluate):
1498 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
1500 2007-10-31 Adam Roben <aroben@apple.com>
1502 Fix a crash on launch due to a static initializer race
1504 We now use fast inline assembler spinlocks which can be statically
1505 initialized at compile time.
1507 As a side benefit, this speeds up SunSpider by 0.4%.
1511 * wtf/FastMalloc.cpp:
1513 (TCMalloc_SpinLock::Lock):
1514 (TCMalloc_SpinLock::Unlock):
1515 (TCMalloc_SlowLock):
1516 * wtf/TCSystemAlloc.cpp:
1518 2007-10-31 Kevin McCullough <kmccullough@apple.com>
1522 - Corrected spelling.
1526 2007-10-31 Mark Rowe <mrowe@apple.com>
1528 Further Gtk build fixage.
1530 * kjs/regexp_object.cpp:
1532 2007-10-31 Mark Rowe <mrowe@apple.com>
1538 2007-10-31 Darin Adler <darin@apple.com>
1542 - fix http://bugs.webkit.org/show_bug.cgi?id=15749
1543 RegExp/RegExpObjectImp cause needless UString creation
1545 Speeds things up 0.4% according to SunSpider.
1547 * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
1548 because this library doesn't use the real PCRE -- it uses its
1549 own PCRE that works on UTF-16.
1551 * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
1552 Use Noncopyable. Change the return value of match.
1554 (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
1555 (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
1556 (KJS::RegExp::match): Change to return the position as an int and the
1557 ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
1559 * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
1560 require a result string.
1561 * kjs/regexp_object.cpp:
1562 (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
1563 (RegExpObjectImp::performMatch): Change so it doesn't return a string.
1564 (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
1565 the main result with the backreferences; now it doesn't need to take
1567 (RegExpObjectImp::getBackref): Minor tweaks.
1568 (RegExpObjectImp::getLastParen): Ditto.
1569 (RegExpObjectImp::getLeftContext): Ditto.
1570 (RegExpObjectImp::getRightContext): Ditto.
1571 (RegExpObjectImp::getValueProperty): Change LastMatch case to call
1572 getBackref(0) so we don't need a separate getLastMatch function.
1574 * kjs/string_object.cpp:
1575 (KJS::replace): Update to use new performMatch, including merging the
1576 matched string section with the other substrings.
1577 (KJS::StringProtoFunc::callAsFunction): Update functions to use the
1578 new performMatch and match. Also change to use OwnArrayPtr.
1580 2007-10-31 Oliver Hunt <oliver@apple.com>
1582 * kjs/nodes.h: include OwnPtr.h
1584 2007-10-31 Oliver Hunt <oliver@apple.com>
1588 Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
1592 (KJS::statementListPushFIFO):
1593 (KJS::statementListGetDeclarations):
1594 (KJS::statementListInitializeDeclarationStacks):
1595 (KJS::statementListInitializeVariableAccessStack):
1596 (KJS::statementListExecute):
1597 (KJS::BlockNode::optimizeVariableAccess):
1598 (KJS::BlockNode::BlockNode):
1599 (KJS::BlockNode::getDeclarations):
1600 (KJS::BlockNode::execute):
1601 (KJS::CaseClauseNode::optimizeVariableAccess):
1602 (KJS::CaseClauseNode::getDeclarations):
1603 (KJS::CaseClauseNode::evalStatements):
1604 (KJS::FunctionBodyNode::initializeDeclarationStacks):
1605 (KJS::FunctionBodyNode::optimizeVariableAccess):
1607 * kjs/nodes2string.cpp:
1608 (KJS::statementListStreamTo):
1609 (KJS::BlockNode::streamTo):
1610 (KJS::CaseClauseNode::streamTo):
1612 2007-10-30 Mark Rowe <mrowe@apple.com>
1614 * kjs/property_map.cpp: Added a missing using directive to fix the build
1615 for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
1617 2007-10-31 Maciej Stachowiak <mjs@apple.com>
1619 * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
1622 2007-10-31 Alexey Proskuryakov <ap@webkit.org>
1626 http://bugs.webkit.org/show_bug.cgi?id=11001
1627 WebKit doesn't support RegExp.compile method
1629 Test: fast/js/regexp-compile.html
1631 * kjs/regexp_object.cpp:
1632 (RegExpPrototype::RegExpPrototype):
1633 (RegExpProtoFunc::callAsFunction):
1634 * kjs/regexp_object.h:
1635 (KJS::RegExpProtoFunc::):
1636 Added RegExp.compile.
1638 * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
1640 2007-10-31 Maciej Stachowiak <mjs@apple.com>
1644 - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
1646 Integer divide sucks. Fortunately, a bunch of shifts and XORs
1647 biased towards the high bits is sufficient to provide a good
1648 double hash. Besides the SunSpider win, I used the dump statistics
1649 mode for both to verify that collisions did not increase and that
1650 the longest collision chain is not any longer.
1652 * kjs/property_map.cpp:
1654 (KJS::PropertyMap::get):
1655 (KJS::PropertyMap::getLocation):
1656 (KJS::PropertyMap::put):
1657 (KJS::PropertyMap::insert):
1658 (KJS::PropertyMap::remove):
1659 (KJS::PropertyMap::checkConsistency):
1663 (WTF::::lookupForWriting):
1664 (WTF::::fullLookupForWriting):
1667 2007-10-30 Adam Roben <aroben@apple.com>
1669 * kjs/collector.h: Make HeapType public so it can be used for non-member
1670 things like the HeapConstants struct template. Fixes the build on Windows.
1672 2007-10-30 Adam Roben <aroben@apple.com>
1674 Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
1676 Speeds up SunSpider by 0.4%.
1678 Reviewed by Steve and Maciej.
1680 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
1681 a warning during LTCG in release builds about double -> float
1683 * wtf/AlwaysInline.h:
1686 2007-10-30 Adam Roben <aroben@apple.com>
1688 Use GetCurrentThreadId instead of pthread_self in FastMalloc
1690 Speeds up SunSpider by 0.3%.
1694 * wtf/FastMalloc.cpp:
1695 (WTF::TCMalloc_ThreadCache::InitTSD):
1696 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
1698 2007-10-30 Adam Roben <aroben@apple.com>
1700 Switch to a Win32 critical section implementation of spinlocks
1702 Speeds up SunSpider by 0.4%.
1706 * wtf/FastMalloc.cpp:
1708 (TCMalloc_SpinLock::TCMalloc_SpinLock):
1709 (TCMalloc_SpinLock::Init):
1710 (TCMalloc_SpinLock::Finalize):
1711 (TCMalloc_SpinLock::Lock):
1712 (TCMalloc_SpinLock::Unlock):
1713 * wtf/TCSystemAlloc.cpp:
1715 2007-10-30 Adam Roben <aroben@apple.com>
1717 Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
1719 http://bugs.webkit.org/show_bug.cgi?id=15586
1721 Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
1723 Use Win32 TLS functions instead of __declspec(thread), which breaks
1728 * wtf/FastMalloc.cpp:
1729 (WTF::getThreadHeap):
1730 (WTF::TCMalloc_ThreadCache::InitModule):
1732 2007-10-30 Maciej Stachowiak <mjs@apple.com>
1736 - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
1737 http://bugs.webkit.org/show_bug.cgi?id=15772
1739 We do this by using a single mark bit per two number cells, and
1742 Besides being an 0.5% win overall, this is a 7.1% win on morph.
1744 * kjs/collector.cpp:
1746 (KJS::Collector::heapAllocate):
1747 (KJS::Collector::markStackObjectsConservatively):
1748 (KJS::Collector::sweep):
1750 (KJS::SmallCollectorCell::):
1752 2007-10-30 Geoffrey Garen <ggaren@apple.com>
1754 Reviewed by Adam Roben, Sam Weinig.
1756 Made conflicts in grammar.y a persistent build failure.
1758 * DerivedSources.make:
1760 2007-10-30 Kevin McCullough <kmccullough@apple.com>
1762 Reviewed by Adam and Geoff.
1764 - Added a new cast so all the casts are in the same place.
1769 2007-10-30 Geoffrey Garen <ggaren@apple.com>
1771 Reviewed by Darin Adler.
1773 Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
1777 ecma_2/Statements/dowhile-001.js
1778 ecma_2/Statements/dowhile-002.js
1779 ecma_2/Statements/dowhile-003.js
1780 ecma_2/Statements/dowhile-004.js
1781 ecma_2/Statements/dowhile-005.js
1782 ecma_2/Statements/dowhile-006.js
1783 ecma_2/Statements/dowhile-007.js
1784 js1_2/statements/do_while.js
1786 and layout tests, including
1788 do-while-expression-value.html
1789 do-while-semicolon.html
1790 do-while-without-semicolon.html
1794 * kjs/grammar.y: Use the explicit "error" production, as we do with other
1795 automatic semicolon insertions, to disambiguate "do { } while();" from
1796 "do { } while()" followed by ";" (the empty statement).
1798 2007-10-29 Oliver Hunt <oliver@apple.com>
1802 Debranching remaining assignment nodes, and miscellaneous cleanup
1804 Split read-modify code paths out of AssignBracketNode and AssignDotNode
1805 Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
1806 and ReadModifyResolveNode evaluate methods
1808 Leads to a 1% gain in SunSpider.
1812 (KJS::ReadModifyLocalVarNode::evaluate):
1813 (KJS::ReadModifyResolveNode::evaluate):
1814 (KJS::AssignDotNode::evaluate):
1815 (KJS::ReadModifyDotNode::optimizeVariableAccess):
1816 (KJS::ReadModifyDotNode::evaluate):
1817 (KJS::AssignBracketNode::evaluate):
1818 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
1819 (KJS::ReadModifyBracketNode::evaluate):
1821 (KJS::AssignBracketNode::):
1822 (KJS::AssignBracketNode::precedence):
1823 (KJS::AssignDotNode::):
1824 (KJS::AssignDotNode::precedence):
1825 * kjs/nodes2string.cpp:
1826 (KJS::ReadModifyBracketNode::streamTo):
1827 (KJS::AssignBracketNode::streamTo):
1828 (KJS::ReadModifyDotNode::streamTo):
1829 (KJS::AssignDotNode::streamTo):
1831 2007-10-29 Oliver Hunt <oliver@apple.com>
1833 Debranching various Node::evaluate implementations
1837 Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
1838 Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
1840 Gains 1.6% on SunSpider
1842 * JavaScriptCore.xcodeproj/project.pbxproj:
1845 (KJS::PostIncResolveNode::optimizeVariableAccess):
1846 (KJS::PostIncResolveNode::evaluate):
1847 (KJS::PostIncLocalVarNode::evaluate):
1848 (KJS::PostDecResolveNode::optimizeVariableAccess):
1849 (KJS::PostDecResolveNode::evaluate):
1850 (KJS::PostDecLocalVarNode::evaluate):
1851 (KJS::PostIncBracketNode::evaluate):
1852 (KJS::PostDecBracketNode::evaluate):
1853 (KJS::PostIncDotNode::evaluate):
1854 (KJS::PostDecDotNode::evaluate):
1855 (KJS::PreIncResolveNode::optimizeVariableAccess):
1856 (KJS::PreIncLocalVarNode::evaluate):
1857 (KJS::PreIncResolveNode::evaluate):
1858 (KJS::PreDecResolveNode::optimizeVariableAccess):
1859 (KJS::PreDecLocalVarNode::evaluate):
1860 (KJS::PreDecResolveNode::evaluate):
1861 (KJS::PreIncBracketNode::evaluate):
1862 (KJS::PreDecBracketNode::evaluate):
1863 (KJS::PreIncDotNode::evaluate):
1864 (KJS::PreDecDotNode::evaluate):
1865 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1866 (KJS::AssignResolveNode::optimizeVariableAccess):
1867 (KJS::AssignLocalVarNode::evaluate):
1868 (KJS::AssignResolveNode::evaluate):
1870 (KJS::PostDecResolveNode::):
1871 (KJS::PostDecResolveNode::precedence):
1872 (KJS::PostDecLocalVarNode::):
1873 (KJS::PostfixBracketNode::):
1874 (KJS::PostfixBracketNode::precedence):
1875 (KJS::PostIncBracketNode::):
1876 (KJS::PostIncBracketNode::isIncrement):
1877 (KJS::PostDecBracketNode::):
1878 (KJS::PostDecBracketNode::isIncrement):
1879 (KJS::PostfixDotNode::):
1880 (KJS::PostfixDotNode::precedence):
1881 (KJS::PostIncDotNode::):
1882 (KJS::PostIncDotNode::isIncrement):
1883 (KJS::PostDecDotNode::):
1884 (KJS::PreIncResolveNode::):
1885 (KJS::PreDecResolveNode::):
1886 (KJS::PreDecResolveNode::precedence):
1887 (KJS::PreDecLocalVarNode::):
1888 (KJS::PrefixBracketNode::):
1889 (KJS::PrefixBracketNode::precedence):
1890 (KJS::PreIncBracketNode::):
1891 (KJS::PreIncBracketNode::isIncrement):
1892 (KJS::PreDecBracketNode::):
1893 (KJS::PreDecBracketNode::isIncrement):
1894 (KJS::PrefixDotNode::):
1895 (KJS::PrefixDotNode::precedence):
1896 (KJS::PreIncDotNode::):
1897 (KJS::PreIncDotNode::isIncrement):
1898 (KJS::PreDecDotNode::):
1899 (KJS::ReadModifyResolveNode::):
1900 (KJS::ReadModifyLocalVarNode::):
1901 (KJS::AssignResolveNode::):
1902 (KJS::AssignResolveNode::precedence):
1903 * kjs/nodes2string.cpp:
1904 (KJS::PostIncResolveNode::streamTo):
1905 (KJS::PostDecResolveNode::streamTo):
1906 (KJS::PostfixBracketNode::streamTo):
1907 (KJS::PostfixDotNode::streamTo):
1908 (KJS::PreIncResolveNode::streamTo):
1909 (KJS::PreDecResolveNode::streamTo):
1910 (KJS::ReadModifyResolveNode::streamTo):
1911 (KJS::AssignResolveNode::streamTo):
1913 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1915 Not reviewed, build fix.
1917 - Include Vector.h in a way that actually works.
1919 * kjs/LocalStorage.h:
1921 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1923 Not reviewed, build fix.
1925 - Install LocalStorage.h as a private header.
1927 * JavaScriptCore.xcodeproj/project.pbxproj:
1929 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1933 - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
1935 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1936 * JavaScriptCore.xcodeproj/project.pbxproj:
1937 * kjs/LocalStorage.h: Added.
1938 (KJS::LocalStorageEntry::LocalStorageEntry):
1942 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
1944 2007-10-29 Geoffrey Garen <ggaren@apple.com>
1946 Reviewed by Oliver Hunt.
1948 Some small tweaks that I notice while reviewing Oliver's last patch.
1950 Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
1952 No change in SunSpider because SunSpider doesn't take the code path that
1953 would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
1956 (KJS::LocalVarPostfixNode::evaluate):
1957 (KJS::TypeOfResolveNode::optimizeVariableAccess):
1958 (KJS::LocalVarTypeOfNode::evaluate):
1959 (KJS::PrefixResolveNode::optimizeVariableAccess):
1960 (KJS::LocalVarPrefixNode::evaluate):
1961 (KJS::AssignResolveNode::optimizeVariableAccess):
1962 (KJS::LocalVarAssignNode::evaluate):
1964 (KJS::LocalVarTypeOfNode::):
1965 (KJS::PrefixResolveNode::):
1966 (KJS::LocalVarPrefixNode::):
1967 (KJS::AssignResolveNode::):
1968 (KJS::LocalVarAssignNode::):
1970 2007-10-29 Eric Seidel <eric@webkit.org>
1974 SunSpider claims this was a 0.7% speedup.
1976 * kjs/string_object.cpp:
1977 (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
1979 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1983 - re-enable asserts for access to empty or deleted keys
1987 (WTF::::lookupForWriting):
1988 (WTF::::fullLookupForWriting):
1991 2007-10-29 Eric Seidel <eric@webkit.org>
1993 Build fix only, no review.
1995 * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
1997 2007-10-29 Mark Rowe <mrowe@apple.com>
1999 Gtk build fix. Move struct declarations into nodes.h.
2004 2007-10-29 Eric Seidel <eric@webkit.org>
2008 Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
2009 Make it a compile time error to use toString(ExecState) on a StringInstance
2011 SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
2014 (KJS::StringImp::getLength):
2015 * kjs/string_object.cpp:
2016 (KJS::StringInstance::lengthGetter):
2017 (KJS::StringInstance::inlineGetOwnPropertySlot):
2018 (KJS::StringInstance::getOwnPropertySlot):
2019 * kjs/string_object.h:
2021 2007-10-28 Oliver Hunt <oliver@apple.com>
2025 Add nodes to allow Assignment, TypeOf, and prefix operators to
2026 make use of the new optimised local variable look up.
2028 5% gain on sunspider
2031 (KJS::TypeOfResolveNode::optimizeVariableAccess):
2032 (KJS::LocalTypeOfAccessNode::evaluate):
2033 (KJS::PrefixResolveNode::optimizeVariableAccess):
2034 (KJS::PrefixLocalAccessNode::evaluate):
2035 (KJS::AssignResolveNode::optimizeVariableAccess):
2036 (KJS::AssignLocalAccessNode::evaluate):
2038 (KJS::TypeOfResolveNode::):
2039 (KJS::TypeOfResolveNode::precedence):
2040 (KJS::LocalTypeOfAccessNode::):
2041 (KJS::PrefixResolveNode::):
2042 (KJS::PrefixResolveNode::precedence):
2043 (KJS::PrefixLocalAccessNode::):
2044 (KJS::AssignResolveNode::):
2045 (KJS::AssignLocalAccessNode::):
2047 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2051 - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
2052 http://bugs.webkit.org/show_bug.cgi?id=15748
2054 Not a significant speedup or slowdown on SunSpider.
2057 (KJS::clearNewNodes):
2061 (KJS::BlockNode::BlockNode):
2062 (KJS::CaseBlockNode::CaseBlockNode):
2063 (KJS::FunctionBodyNode::FunctionBodyNode):
2064 (KJS::SourceElementsNode::SourceElementsNode):
2065 (KJS::ProgramNode::ProgramNode):
2067 (KJS::ElementNode::):
2069 (KJS::PropertyListNode::):
2070 (KJS::ObjectLiteralNode::):
2071 (KJS::ArgumentListNode::):
2072 (KJS::ArgumentsNode::):
2073 (KJS::VarDeclListNode::):
2074 (KJS::VarStatementNode::):
2076 (KJS::ParameterNode::):
2077 (KJS::FuncExprNode::):
2078 (KJS::FuncDeclNode::):
2079 (KJS::SourceElementsNode::):
2080 (KJS::CaseClauseNode::):
2081 (KJS::ClauseListNode::):
2083 2007-10-28 Mark Rowe <mrowe@apple.com>
2085 Disable assertions in a manner that doesn't break the Qt Windows build.
2089 (WTF::::lookupForWriting):
2090 (WTF::::fullLookupForWriting):
2092 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2094 Temporarily disabling some ASSERTs I introduced in my last check-in
2095 because of http://bugs.webkit.org/show_bug.cgi?id=15747
2096 Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
2100 (WTF::::lookupForWriting):
2101 (WTF::::fullLookupForWriting):
2104 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2106 Reviewed by Darin Adler.
2108 Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
2109 #ifndef ASSERT_DISABLED is no good!
2111 Replaced with #if !ASSERT_DISABLED.
2115 (WTF::::lookupForWriting):
2116 (WTF::::fullLookupForWriting):
2119 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2121 Reviewed by Darin Adler.
2123 Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
2124 to the AST transfom that replaces slow resolve nodes with fast local
2125 variable alternatives.
2127 2.5% speedup on SunSpider.
2129 Also added some missing copyright notices.
2132 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
2133 (KJS::FunctionCallResolveNode::evaluate):
2134 (KJS::LocalVarFunctionCallNode::evaluate):
2135 (KJS::PostfixResolveNode::optimizeVariableAccess):
2136 (KJS::PostfixResolveNode::evaluate):
2137 (KJS::LocalVarPostfixNode::evaluate):
2138 (KJS::DeleteResolveNode::optimizeVariableAccess):
2139 (KJS::DeleteResolveNode::evaluate):
2140 (KJS::LocalVarDeleteNode::evaluate):
2142 (KJS::FunctionCallResolveNode::):
2143 (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
2144 (KJS::PostfixResolveNode::):
2145 (KJS::LocalVarPostfixNode::LocalVarPostfixNode):
2146 (KJS::DeleteResolveNode::):
2147 (KJS::LocalVarDeleteNode::LocalVarDeleteNode):
2149 2007-10-28 Eric Seidel <eric@webkit.org>
2153 Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
2154 Add virtual keyword to a few virtual functions previously unmarked.
2157 (KJS::StringImp::type):
2158 (KJS::NumberImp::type):
2160 (KJS::UString::Rep::deref):
2162 2007-10-28 Darin Adler <darin@apple.com>
2164 - fix "broken everything" from the storage leak fix
2166 * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
2167 * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
2169 2007-10-28 Darin Adler <darin@apple.com>
2173 - turn on unused parameter waring on Mac OS X because it's already on elsewhere
2175 * Configurations/Base.xcconfig: Took out -wno-unused-parameter.
2181 Fixed unused variables by using them or marked them with UNUSED_PARAM.
2183 * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
2184 Removed parameter names to indicate they are unused.
2186 2007-10-28 Darin Adler <darin@apple.com>
2190 - fix a storage leak where we ref the UString every time we replace
2191 a ResolveNode with a LocalVarAccessNode
2193 * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
2194 that takes PlacementNewAdopt.
2196 * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
2197 with PlacementNewAdopt instead of the old value of ident.
2199 * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
2200 takes PlacementNewAdopt.
2202 2007-10-28 Darin Adler <darin@apple.com>
2204 - Windows build fix; get rid of unused parameter
2206 * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
2207 * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
2208 The assertions weren't all that helpful.
2210 2007-10-28 Mark Rowe <mrowe@apple.com>
2212 Gtk build fix. Add include of MathExtras.h.
2214 * kjs/string_object.cpp:
2216 2007-10-28 Mark Rowe <mrowe@apple.com>
2218 Reviewed by Maciej and Tim.
2220 Replace uses of isNaN and isInf with isnan and isinf, and
2221 remove isNaN and isInf.
2223 * kjs/config.h: Remove unused HAVE_'s.
2224 * kjs/date_object.cpp:
2225 (KJS::DateInstance::getTime):
2226 (KJS::DateInstance::getUTCTime):
2227 (KJS::DateProtoFunc::callAsFunction):
2228 (KJS::DateObjectImp::construct):
2229 (KJS::DateObjectFuncImp::callAsFunction):
2231 (KJS::GlobalFuncImp::callAsFunction):
2232 * kjs/math_object.cpp:
2233 (MathFuncImp::callAsFunction):
2234 * kjs/nodes2string.cpp:
2235 (KJS::isParserRoundTripNumber):
2236 * kjs/number_object.cpp:
2237 (NumberProtoFunc::callAsFunction):
2238 * kjs/operations.cpp:
2240 * kjs/string_object.cpp:
2241 (KJS::StringProtoFunc::callAsFunction):
2243 (KJS::UString::from):
2245 (KJS::JSValue::toInteger):
2246 (KJS::JSValue::toInt32SlowCase):
2247 (KJS::JSValue::toUInt32SlowCase):
2249 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2251 Build fix: use the new-fangled missingSymbolMarker().
2254 (KJS::ResolveNode::optimizeVariableAccess):
2256 (KJS::LocalVarAccessNode::LocalVarAccessNode):
2258 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2260 Reviewed by Maciej Stachowiak, Darin Adler.
2262 Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
2265 AST transfom to replace slow resolve nodes with fast local variable
2266 alternatives that do direct memory access. Currently, only ResolveNode
2267 provides a fast local variable alternative. 6 others are soon to come.
2269 16.7% speedup on SunSpider.
2271 Most of this patch is just scaffolding to support iterating all the
2272 resolve nodes in the AST through optimizeResolveNodes(). In
2273 optimizeResolveNodes(), most classes just push their child nodes onto
2274 the processing stack, while ResolveNodes actually replace themselves in
2275 the tree with more optimized alternatives, if possible.
2277 Here are the interesting bits:
2279 * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
2280 in Node and ResolveNode. This tag allows you to use placement new to
2281 swap out a base class Node in favor of a subclass copy that holds the
2282 same data. (Without this tag, default initialization would NULL out
2283 RefPtrs, change line numbers, etc.)
2286 (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
2287 that the fast path is impossible, to make sure we didn't leave anything
2290 (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
2291 transformation happens.
2293 (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
2294 optimization happens.
2296 * kjs/function.h: Added symbolTable() accessor for, for the sake of
2299 2007-10-28 Mark Rowe <mrowe@apple.com>
2303 Fix "AllInOneFile.o has a global initializer in it".
2305 Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
2306 We can avoid this by moving it inside an inline function.
2308 * kjs/SymbolTable.h:
2309 (KJS::missingSymbolMarker):
2311 (KJS::ActivationImp::getOwnPropertySlot):
2312 (KJS::ActivationImp::put):
2314 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2318 - Added assertions to protect against adding empty or deleted keys to a HashTable
2321 (WTF::HashTable::lookup):
2322 (WTF::HashTable::lookupForWriting):
2323 (WTF::HashTable::fullLookupForWriting):
2324 (WTF::HashTable::add):
2326 2007-10-28 Darin Adler <darin@apple.com>
2330 * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
2331 Use isNaN and isInf instead of isnan and isinf.
2333 2007-10-28 Darin Adler <darin@apple.com>
2337 - http://bugs.webkit.org/show_bug.cgi?id=15735
2338 remove GroupNode to simplify AST and possibly get a modest speedup
2340 This patch removes 4 node types: GroupNode, PropertyNameNode,
2341 FunctionCallParenBracketNode, and FunctionCallParenDotNode.
2343 To remove GroupNode, we add knowledge of precedence to the tree nodes,
2344 and use that when serializing to determine where parentheses are needed.
2345 This means we no longer have to represent parentheses in the tree.
2347 The precedence values are named after productions in the grammar from the
2348 JavaScript standard.
2350 SunSpider says this is an 0.4% speedup.
2353 * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
2354 serialization, so I moved it to the file that takes care of that.
2356 * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
2357 indicate failure instead of a separate boolean. Got rid of PropertyNameNode
2358 by merging the PropertyName rule into the Property rule (which was easier
2359 than figuring out how to pass the Identifier from one node to another).
2360 Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
2361 and FunctionCallParenDotNode.
2363 * kjs/nodes.h: Removed unused forward declarations and Operator values.
2364 Added Precedence enum, and precedence function to all nodes. Removed
2365 nodeInsideAllParens. Added streamBinaryOperator function for serialization.
2366 Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
2367 Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
2369 * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
2370 (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
2371 of converting it from an Identifier to a jsString then back to a UString
2372 then into an Identifier again!
2374 * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
2375 function for each of Endl, Indent, Unindent, and DotExpr instead of using a
2376 single function with a switch. Added a precedence that you can stream in, to
2377 cause the next node serialized to add parentheses based on that precedence value.
2378 (KJS::operatorString): Moved to the top of the file.
2379 (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
2380 workaround for snprintf, since StringExtras.h takes care of that.
2381 (KJS::operator<<): Made the char and char* versions faster by using UString's
2382 character append functions instead of constructing a UString. Added the logic
2383 to the Node* version to add parentheses if needed.
2384 (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
2385 (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
2386 (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
2388 (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
2389 (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
2390 (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
2391 (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
2392 (KJS::FunctionCallBracketNode::streamTo): Ditto.
2393 (KJS::FunctionCallDotNode::streamTo): Ditto.
2394 (KJS::PostfixBracketNode::streamTo): Ditto.
2395 (KJS::PostfixDotNode::streamTo): Ditto.
2396 (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
2397 (KJS::DeleteBracketNode::streamTo): Use PrecCall.
2398 (KJS::DeleteDotNode::streamTo): Ditto.
2399 (KJS::DeleteValueNode::streamTo): Use PrecUnary.
2400 (KJS::VoidNode::streamTo): Ditto.
2401 (KJS::TypeOfValueNode::streamTo): Ditto.
2402 (KJS::PrefixBracketNode::streamTo): Use PrecCall.
2403 (KJS::PrefixDotNode::streamTo): Ditto.
2404 (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
2405 (KJS::UnaryPlusNode::streamTo): Ditto.
2406 (KJS::NegateNode::streamTo): Ditto.
2407 (KJS::BitwiseNotNode::streamTo): Ditto.
2408 (KJS::LogicalNotNode::streamTo): Ditto.
2409 (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
2410 (KJS::DivNode::streamTo): Ditto.
2411 (KJS::ModNode::streamTo): Ditto.
2412 (KJS::AddNode::streamTo): Ditto.
2413 (KJS::SubNode::streamTo): Ditto.
2414 (KJS::LeftShiftNode::streamTo): Ditto.
2415 (KJS::RightShiftNode::streamTo): Ditto.
2416 (KJS::UnsignedRightShiftNode::streamTo): Ditto.
2417 (KJS::LessNode::streamTo): Ditto.
2418 (KJS::GreaterNode::streamTo): Ditto.
2419 (KJS::LessEqNode::streamTo): Ditto.
2420 (KJS::GreaterEqNode::streamTo): Ditto.
2421 (KJS::InstanceOfNode::streamTo): Ditto.
2422 (KJS::InNode::streamTo): Ditto.
2423 (KJS::EqualNode::streamTo): Ditto.
2424 (KJS::NotEqualNode::streamTo): Ditto.
2425 (KJS::StrictEqualNode::streamTo): Ditto.
2426 (KJS::NotStrictEqualNode::streamTo): Ditto.
2427 (KJS::BitAndNode::streamTo): Ditto.
2428 (KJS::BitXOrNode::streamTo): Ditto.
2429 (KJS::BitOrNode::streamTo): Ditto.
2430 (KJS::LogicalAndNode::streamTo): Ditto.
2431 (KJS::LogicalOrNode::streamTo): Ditto.
2432 (KJS::ConditionalNode::streamTo): Ditto.
2433 (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
2434 (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
2435 the bracket and PrecAssignment for the right side.
2436 (KJS::AssignDotNode::streamTo): Ditto.
2437 (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
2438 and PrecAssignment for the right side.
2439 (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
2440 (KJS::AssignExprNode::streamTo): Use PrecAssignment.
2442 2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
2444 Define wx port and set wx port USE options.
2446 Reviewed by Adam Roben.
2450 2007-10-28 Mark Rowe <mrowe@apple.com>
2452 We don't include "config.h" in headers.
2454 * bindings/jni/jni_instance.h:
2459 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2461 Rubber stamped by Mark.
2463 - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
2465 * kjs/SymbolTable.h:
2466 (KJS::SymbolTableIndexHashTraits::emptyValue):
2468 (KJS::ActivationImp::getOwnPropertySlot):
2469 (KJS::ActivationImp::put):
2471 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2475 - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
2477 * kjs/SymbolTable.h:
2478 (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
2479 (KJS::IdentifierRepHash::equal): ditto
2480 (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
2481 (KJS::SymbolTable): change to a typedef for a HashMap.
2483 (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
2484 (KJS::ActivationImp::deleteProperty): ditto
2485 (KJS::ActivationImp::put): ditto
2488 (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
2489 you now have to store a UString::rep, not an identifier.
2491 2007-10-27 Maciej Stachowiak <mjs@apple.com>
2495 - numerous HashTable performance improvements
2497 This does not quite add up to a measurable win on SunSpider, but it allows a
2498 follow-on > 3% improvement and probably helps WebCore too.
2500 I made the following improvements, among others:
2502 - Made HashFunctions note whether it is ok to compare a real value with the equal() function
2503 to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
2505 - Specialized lookup so it doesn't have to do so many extra branches and build so many extra
2506 std::pairs for cases that don't need them. There are now four versions, one for read-only access,
2507 two for writing, and one folded directly into add() (these all were improvments).
2509 - Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
2511 - Made a special constructor for iterators that knows it points to
2512 a valid filled cell and so skips updating itself.
2514 - Reordered memory accesses in the various lookup functions for better code generation
2516 - Made simple translators avoid passing a hash code around
2518 - Other minor tweaks
2522 (WTF::HashTableConstIterator::HashTableConstIterator):
2523 (WTF::HashTableIterator::HashTableIterator):
2524 (WTF::IdentityHashTranslator::translate):
2525 (WTF::HashTable::end):
2526 (WTF::HashTable::lookup):
2527 (WTF::HashTable::lookupForWriting):
2528 (WTF::HashTable::makeKnownGoodIterator):
2529 (WTF::HashTable::makeKnownGoodConstIterator):
2531 (WTF::::lookupForWriting):
2532 (WTF::::fullLookupForWriting):
2534 (WTF::::addPassingHashCode):
2538 * kjs/identifier.cpp:
2540 * wtf/HashFunctions.h:
2548 * wtf/ListHashSet.h:
2549 (WTF::ListHashSetTranslator::translate):
2551 2007-10-27 Darin Adler <darin@apple.com>
2555 - fix ASCIICType.h for some Windows compiles
2557 * wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
2558 compiler/library that has the wchar_t that is just a typedef.
2560 2007-10-27 Kevin McCullough <kmccullough@apple.com>
2563 - Forgot to change the build step when I changed the filename.
2565 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2567 2007-10-27 Geoffrey Garen <ggaren@apple.com>
2569 Reviewed by Darin Adler.
2571 Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
2573 http://bugs.webkit.org/show_bug.cgi?id=15718
2575 * kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a
2576 hash value. Also changed O(n) strlen to O(1) check for empty string.
2577 (KJS::Identifier::add):
2579 * kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
2580 (KJS::UString::UString):
2581 (KJS::UString::operator=):
2583 2007-10-27 Darin Adler <darin@apple.com>
2587 - fix pow on Windows
2589 * wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
2590 a "pow" function that does not properly handle the case where arg1 is
2593 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
2594 specify "::pow" -- just "pow" is fine.
2596 2007-10-27 Darin Adler <darin@apple.com>
2600 - http://bugs.webkit.org/show_bug.cgi?id=15711
2601 force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
2603 * kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
2605 * kjs/object.h: Removed redundant includes.
2606 * kjs/value.h: Ditto.
2608 2007-10-27 Maciej Stachowiak <mjs@apple.com>
2612 - fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
2613 http://bugs.webkit.org/show_bug.cgi?id=15718
2615 * kjs/identifier.cpp:
2616 (KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
2617 now that we count on all Identifiers already having one.
2619 2007-10-27 Mark Rowe <mrowe@apple.com>
2623 * kjs/SymbolTable.h:
2625 2007-10-27 Mark Rowe <mrowe@apple.com>
2631 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2633 Rubber stamp by Adam.
2635 - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
2636 files contain are functions that operate on BSTRs.
2638 * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
2639 * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
2640 * API/JSStringRefCOM.cpp: Removed.
2641 * API/JSStringRefCOM.h: Removed.
2642 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2644 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2648 - Made JSStringCreateWithBSTR capable of handling null BSTRs.
2650 * API/JSStringRefCOM.cpp:
2651 (JSStringCreateWithBSTR):
2653 2007-10-26 Sam Weinig <sam@webkit.org>
2657 * kjs/SymbolTable.h: Add header gaurd.
2658 * kjs/nodes.h: #include "SymbolTable.h"
2660 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2662 Suggested by Anders Carlsson.
2667 (KJS::ActivationImp::getOwnPropertySlot):
2669 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2671 Suggested by Darin Adler.
2673 Use computedHash(), which is safer than just directly accessing _hash.
2676 (KJS::Lookup::findEntry):
2677 (KJS::Lookup::find):
2679 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2681 Build fix: svn add SymbolTable.h
2683 * kjs/SymbolTable.h: Added.
2684 (KJS::SymbolTable::set):
2685 (KJS::SymbolTable::get):
2687 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2689 Build fix: export SymbolTable.h to WebCore.
2691 * JavaScriptCore.xcodeproj/project.pbxproj:
2693 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2695 Comment tweak suggested by Maciej.
2698 (KJS::ActivationImp::getOwnPropertySlot):
2700 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2702 Reviewed by Maciej Stachowiak.
2704 Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
2706 * kjs/property_map.cpp: Use a special no branch accessor to the UString's
2707 hash value. Also, return immediately instead of branching to the end
2708 of the loop if the value is not found.
2709 (KJS::PropertyMap::get):
2710 (KJS::PropertyMap::getLocation):
2711 (KJS::PropertyMap::put):
2712 (KJS::PropertyMap::insert):
2713 (KJS::PropertyMap::remove):
2714 (KJS::PropertyMap::checkConsistency):
2717 (KJS::UString::Rep::computedHash): Special no branch accessor to the
2718 UString's hash value. Used when the caller knows that the hash value
2719 has already been computed. (For example, if the caller got the UString
2720 from an Identifier.)
2722 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2724 Reviewed by Maciej Stachowiak.
2726 Switched ActivationImp to using a symbol table. For now, though, all
2727 clients take the slow path.
2729 Net .6% speedup on SunSpider.
2732 - ActivationImp now mallocs in its constructor
2733 - Local variable hits use an extra level of indirection to retrieve
2735 - Local variable misses do two lookups
2738 - Fast initialization of local variables upon function entry
2740 * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
2743 (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
2744 data that won't fit in a JSCell.
2745 (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
2747 (KJS::ActivationImp::getOwnPropertySlot): ditto
2748 (KJS::ActivationImp::deleteProperty): ditto
2749 (KJS::ActivationImp::put): ditto
2750 (KJS::ActivationImp::createArgumentsObject): ditto
2752 (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
2753 our properties doesn't try to recursively mark us. (This caused a crash
2754 in earlier testing. Not sure why we haven't run into it before.)
2756 * kjs/nodes.cpp: Functions now build a symbol table the first time
2758 (KJS::VarDeclNode::evaluate):
2759 (KJS::FunctionBodyNode::FunctionBodyNode):
2760 (KJS::FunctionBodyNode::initializeSymbolTable):
2761 (KJS::FunctionBodyNode::processDeclarations):
2762 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2763 (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
2766 (KJS::FunctionBodyNode::symbolTable):
2768 * wtf/Forward.h: Added Vector.
2770 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2772 - Corrected function name mistake in this changelog.
2774 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2775 Reviewed by Sam and Steve.
2777 - Added convenience methods for converting between BSTR and JSStringRefs
2779 * API/JSStringRefCOM.cpp: Added.
2780 (JSStringCreateWithBSTR):
2782 * API/JSStringRefCOM.h: Added.
2783 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2785 2007-10-26 Mark Rowe <mrowe@apple.com>
2789 * kjs/collector.cpp:
2790 (KJS::Collector::collect):
2792 2007-10-26 Oliver Hunt <oliver@apple.com>
2796 Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
2798 * kjs/CollectorHeapIntrospector.cpp:
2799 (KJS::CollectorHeapIntrospector::init):
2800 (KJS::CollectorHeapIntrospector::enumerate):
2801 * kjs/CollectorHeapIntrospector.h:
2802 * kjs/collector.cpp:
2803 (KJS::Collector::recordExtraCost):
2804 (KJS::Collector::heapAllocate):
2805 (KJS::Collector::allocate):
2806 (KJS::Collector::allocateNumber):
2807 (KJS::Collector::registerThread):
2808 (KJS::Collector::markStackObjectsConservatively):
2809 (KJS::Collector::markMainThreadOnlyObjects):
2810 (KJS::Collector::sweep):
2811 (KJS::Collector::collect):
2814 (KJS::NumberImp::operator new):
2815 Force numbers to be allocated in the secondary heap.
2817 2007-10-26 Maciej Stachowiak <mjs@apple.com>
2821 - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
2824 (KJS::JSValue::getUInt32):
2825 (KJS::JSValue::getTruncatedInt32):
2826 (KJS::JSValue::toNumber):
2828 (WTF::PassRefPtr::~PassRefPtr):
2830 (WTF::RefPtr::operator->):
2832 2007-10-26 Mark Rowe <mrowe@apple.com>
2838 2007-10-26 Maciej Stachowiak <mjs@apple.com>
2842 - Merge Context class fully into ExecState, since they are always created and used together.
2844 No measurable performance impact but this is a useful cleanup.
2846 * JavaScriptCore.pri:
2847 * kjs/ExecState.cpp:
2848 (KJS::ExecState::ExecState):
2849 (KJS::ExecState::~ExecState):
2850 (KJS::ExecState::mark):
2851 (KJS::ExecState::lexicalInterpreter):
2853 (KJS::ExecState::dynamicInterpreter):
2854 (KJS::ExecState::setException):
2855 (KJS::ExecState::clearException):
2856 (KJS::ExecState::exception):
2857 (KJS::ExecState::exceptionSlot):
2858 (KJS::ExecState::hadException):
2859 (KJS::ExecState::scopeChain):
2860 (KJS::ExecState::callingExecState):
2861 (KJS::ExecState::propertyNames):
2862 * kjs/collector.cpp:
2863 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
2865 (KJS::FunctionImp::callAsFunction):
2866 (KJS::FunctionImp::argumentsGetter):
2867 (KJS::FunctionImp::callerGetter):
2868 (KJS::GlobalFuncImp::callAsFunction):
2869 * kjs/interpreter.cpp:
2870 (KJS::Interpreter::Interpreter):
2871 (KJS::Interpreter::init):
2872 (KJS::Interpreter::evaluate):
2873 (KJS::Interpreter::mark):
2874 * kjs/interpreter.h:
2875 (KJS::Interpreter::setCurrentExec):
2876 (KJS::Interpreter::currentExec):
2878 (KJS::currentSourceId):
2879 (KJS::currentSourceURL):
2880 (KJS::ThisNode::evaluate):
2881 (KJS::ResolveNode::evaluate):
2882 (KJS::FunctionCallResolveNode::evaluate):
2883 (KJS::PostfixResolveNode::evaluate):
2884 (KJS::DeleteResolveNode::evaluate):
2885 (KJS::TypeOfResolveNode::evaluate):
2886 (KJS::PrefixResolveNode::evaluate):
2887 (KJS::AssignResolveNode::evaluate):
2888 (KJS::VarDeclNode::evaluate):
2889 (KJS::DoWhileNode::execute):
2890 (KJS::WhileNode::execute):
2891 (KJS::ForNode::execute):
2892 (KJS::ForInNode::execute):
2893 (KJS::ContinueNode::execute):
2894 (KJS::BreakNode::execute):
2895 (KJS::ReturnNode::execute):
2896 (KJS::WithNode::execute):
2897 (KJS::SwitchNode::execute):
2898 (KJS::LabelNode::execute):
2899 (KJS::TryNode::execute):
2900 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
2901 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
2902 (KJS::FunctionBodyNode::processDeclarations):
2903 (KJS::FuncDeclNode::makeFunction):
2904 (KJS::FuncExprNode::evaluate):
2906 2007-10-26 Mark Rowe <mrowe@apple.com>
2910 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2912 2007-10-26 Mark Rowe <mrowe@apple.com>
2916 * JavaScriptCore.pri:
2917 * kjs/ExecState.cpp:
2919 2007-10-26 Maciej Stachowiak <mjs@apple.com>
2923 - moved Context class into ExecState.{h,cpp} in preparation for merging
2924 ExecState and Context classes.
2926 * kjs/ExecState.h: Moved CodeType enum and Context class here in
2927 preparation for merging ExecState and Context.
2928 * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
2929 (KJS::Context::Context):
2930 (KJS::Context::~Context):
2931 (KJS::Context::mark):
2932 * kjs/context.h: Removed.
2933 * kjs/Context.cpp: Removed.
2934 * kjs/function.h: Removed CodeType enum.
2935 * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
2936 * kjs/internal.h: Removed LabelStack.
2937 * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
2938 * kjs/collector.cpp: Fixed includes.
2939 * kjs/function.cpp: ditto
2940 * kjs/internal.cpp: ditto
2941 * kjs/interpreter.cpp: ditto
2942 * kjs/lookup.h: ditto
2943 * kjs/nodes.cpp: ditto
2945 2007-10-26 Mark Rowe <mrowe@apple.com>
2949 * kjs/string_object.cpp:
2950 (KJS::StringObjectFuncImp::callAsFunction):
2952 2007-10-25 Darin Adler <darin@apple.com>
2956 - http://bugs.webkit.org/show_bug.cgi?id=15703
2957 fix numeric functions -- improve correctness and speed
2959 Gives about 1% gain on SunSpider.
2961 * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
2962 (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
2963 with both immediate and number values.
2964 (KJS::JSValue::toUInt32): Ditto.
2966 (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
2967 differences. One is that it now correctly returns 0 for NaN, and another is that
2968 there's no special case for 0 or infinity, since the general case already handles
2970 (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
2972 (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
2973 truncation done by the typecast already does the necessary truncation that
2974 roundValue was doing.
2975 (KJS::JSValue::toUInt32SlowCase): Ditto.
2976 (KJS::JSValue::toUInt16): Removed.
2978 * kjs/internal.h: Removed roundValue.
2979 * kjs/internal.cpp: Ditto.
2981 * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
2982 code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
2984 * kjs/date_object.cpp:
2985 (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
2986 toNumber as specified.
2987 (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
2988 with a call to toNumber and timeClip as specified.
2989 (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
2990 where the default behavior of toInt32 (returning 0) was already correct. Replaced
2991 call to roundValue with a call to toNumber as specified.
2992 (KJS::DateObjectFuncImp::callAsFunction): Ditto.
2994 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
2995 cases for the pow function that the library already handles correctly.
2997 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
2998 call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
2999 The real toInteger now returns 0 for NaN. Took out unneeded special case in
3000 ToFixed for undefined; was only needed because our toInteger was wrong. Same
3001 thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
3003 * kjs/string_object.cpp:
3004 (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
3005 cases for undefined that were only needed because toInteger was wrong. Same in
3006 IndexOf, and was able to remove some special cases. In LastIndexOf, used
3007 toIntegerPreserveNaN, but was able to remove some special cases there too.
3008 Changed Substr implementation to preserve correct behavior with the change
3009 to toInteger and match the specification. Also made sure we weren't converting
3010 an out of range double to an int.
3011 (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
3012 toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
3013 no reason to have toUInt16 as a second, less-optimized function that's only
3014 called at this one call site.
3016 * wtf/MathExtras.h: Added trunc function for Windows.
3018 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3020 Reviewed by Maciej Stachowiak.
3022 Tweaked the inner hashtable lookup loop to remove a branch in the "not
3023 found" case. .5% speedup on SunSpider.
3025 * JavaScriptCore.xcodeproj/project.pbxproj:
3029 2007-10-25 Maciej Stachowiak <mjs@apple.com>
3033 - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
3036 (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
3037 adding any value over toNumber() here.
3038 (KJS::valueForReadModifyAssignment): Ditto.
3039 (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
3041 (KJS::lessThanEq): Ditto.
3042 * JavaScriptCore.exp: Export new functions as needed.
3044 (KJS::JSValue::toPrimitive): Fixed formatting.
3045 (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
3046 to number and tells you whether a toPrimitive() conversion with a Number hint
3047 would have given a string.
3049 (KJS::StringImp::getPrimitiveNumber): Implemented.
3050 (KJS::NumberImp::getPrimitiveNumber): ditto
3051 (KJS::GetterSetterImp::getPrimitiveNumber): ditto
3052 (KJS::StringImp::toPrimitive): Fixed formatting.
3053 (KJS::NumberImp::toPrimitive): ditto
3054 (KJS::GetterSetterImp::toPrimitive): ditto
3057 (KJS::JSObject::getPrimitiveNumber): Implemented.
3060 2007-10-25 Sam Weinig <sam@webkit.org>
3062 Reviewed by Adam Roben.
3064 Remove JSStringRefCFHack from windows as it is no longer needed.
3066 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3068 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3070 Reviewed by Oliver Hunt.
3072 Rolled out my last patch. It turns out that I needed 2 words, not 1,
3075 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3077 Reviewed by Oliver Hunt.
3079 Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
3080 Shrink the size of an activation object by 1 word
3082 This is in preparation for adding a symbol table to the activation
3085 The basic strategy here is to rely on the mutual exclusion between
3086 the arguments object pointer and the function pointer (you only need
3087 the latter in order to create the former), and store them in the same
3088 place. The LazyArgumentsObject class encapsulates this strategy.
3090 Also inlined the ArgumentsImp constructor, for good measure.
3092 SunSpider reports no regression. Regression tests pass.
3094 * JavaScriptCore.xcodeproj/project.pbxproj:
3096 (KJS::Context::~Context):
3098 (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
3099 (KJS::ActivationImp::LazyArgumentsObject::mark):
3101 (KJS::ActivationImp::argumentsGetter):
3102 (KJS::ActivationImp::mark):
3104 (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
3105 (KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
3106 (KJS::ActivationImp::LazyArgumentsObject::resetArguments):
3107 (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
3108 (KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
3109 (KJS::ActivationImp::LazyArgumentsObject::setFunction):
3110 (KJS::ActivationImp::LazyArgumentsObject::function):
3111 (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
3112 (KJS::ActivationImp::LazyArgumentsObject::):
3113 (KJS::ActivationImp::ActivationImp::ActivationImp):
3114 (KJS::ActivationImp::resetArguments):
3116 2007-10-25 Adam Roben <aroben@apple.com>
3118 Change JavaScriptCore.vcproj to use DerivedSources.make
3120 We were trying to emulate the logic of make in
3121 build-generated-files.sh, but we got it wrong. We now use a
3122 build-generated-files very much like the one that WebCore uses to
3125 We also now only have a Debug configuration of dftables which we build
3126 even when doing a Release build of JavaScriptCore. dftables also no
3127 longer has the "_debug" name suffix.
3129 Changes mostly made by Darin, reviewed by me.
3131 * DerivedSources.make: Add a variable to set the extension used for
3132 the dftables executable.
3133 * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
3134 dftables in Release configurations.
3135 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
3136 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3137 - Updated include path to point to the new location of the derived
3139 - Modified pre-build event to pass the right arguments to
3140 build-generated-files.sh and not call dftables directly.
3141 - Added the derived source files to the project.
3142 - Removed grammarWrapper.cpp, which isn't needed now that we're
3143 compiling grammar.cpp directly.
3144 * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
3145 Slightly modified from the WebCore version.
3146 * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
3147 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
3148 - Changed the output location to match Mac.
3149 - Removed the Release configuration.
3150 - Removed the _debug suffix.
3152 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3154 Reviewed by Eric Seidel.
3156 Slightly elaborated the differences between declaration procesing in
3157 Function Code and Program Code.
3159 .3% speedup on SunSpider.
3162 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
3163 (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a
3164 minimum set of attributes instead of recomputing all the time. Also,
3165 ignore m_parameters, since programs don't have arguments.
3167 2007-10-25 Eric Seidel <eric@webkit.org>
3171 More preparation work before adding long-running mode to testkjs.
3174 (TestFunctionImp::callAsFunction):
3175 (prettyPrintScript):
3179 (fillBufferWithContentsOfFile):
3181 2007-10-25 Eric Seidel <eric@webkit.org>
3185 Bring testkjs code out of the dark ages in preparation for more
3186 radical improvements (like long-running testing support!)
3189 (TestFunctionImp::callAsFunction):
3192 (fillBufferWithContentsOfFile):
3194 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3196 Reviewed by Maciej Stachowiak.
3198 Make a fast path for declaration processing inside Function Code.
3200 Lifted declaration processing code up from individual declaration nodes
3201 and into processDeclarations.
3203 Broke out processDeclarations into two cases, depending on the type of
3204 code. This eliminates 2 branches, and facilitates more radical
3205 divergeance in the future.
3207 2.5% SunSpider speedup.
3209 * JavaScriptCore.xcodeproj/project.pbxproj:
3211 (KJS::FunctionBodyNode::initializeDeclarationStacks):
3212 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
3213 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
3214 (KJS::FunctionBodyNode::execute):
3215 (KJS::FuncDeclNode::makeFunction):
3219 2007-10-25 Maciej Stachowiak <mjs@apple.com>
3223 - add header includes needed on platforms that don't use AllInOneFile.cpp
3225 * API/JSCallbackObject.cpp:
3227 * kjs/ExecState.cpp:
3228 * kjs/array_instance.cpp:
3229 * kjs/function_object.cpp:
3230 * kjs/interpreter.cpp:
3233 2007-10-25 Eric Seidel <eric@webkit.org>
3237 * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
3239 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3241 Reviewed by Maciej Stachowiak.
3243 Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
3244 Re-order declaration initialization to avoid calling hasProperty inside
3245 VarDeclNode::processDeclaration
3247 .7% speedup on SunSpider.
3250 * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
3251 other processing of declared symbols, so the order of execution could
3255 (KJS::VarDeclNode::getDeclarations): Added special case for the
3256 "arguments" property name, explained in the comment.
3258 (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
3259 in the case of function code, since we know the declared symbol
3260 management will resolve conflicts between symbols. Yay!
3262 (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
3263 implementation of getDeclarations is non-trivial, we can't take a
3264 short-cut here any longer -- we need to put the VarDecl node on the
3265 stack so it gets processed normally.
3267 (KJS::FunctionBodyNode::processDeclarations): Changed the order of
3268 processing to enforce mutual exclusion rules.
3271 (KJS::DeclarationStacks::DeclarationStacks): Structure includes an
3272 ExecState now, for fast access to the "arguments" property name.
3274 2007-10-24 Eric Seidel <eric@webkit.org>
3278 Add a JSGlobalObject class and remove the InterpreterMap
3279 http://bugs.webkit.org/show_bug.cgi?id=15681
3281 This required making JSCallbackObject a template class to allow for
3282 JSGlobalObjects with JSCallbackObject functionality.
3284 SunSpider claims this was a 0.5% speedup.
3286 * API/JSCallbackObject.cpp:
3288 * API/JSCallbackObject.h:
3289 * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
3290 (KJS::::JSCallbackObject):
3292 (KJS::::~JSCallbackObject):
3293 (KJS::::initializeIfNeeded):
3295 (KJS::::getOwnPropertySlot):
3297 (KJS::::deleteProperty):
3298 (KJS::::implementsConstruct):
3300 (KJS::::implementsHasInstance):
3301 (KJS::::hasInstance):
3302 (KJS::::implementsCall):
3303 (KJS::::callAsFunction):
3304 (KJS::::getPropertyNames):
3307 (KJS::::setPrivate):
3308 (KJS::::getPrivate):
3310 (KJS::::cachedValueGetter):
3311 (KJS::::staticValueGetter):
3312 (KJS::::staticFunctionGetter):
3313 (KJS::::callbackGetter):
3314 * API/JSClassRef.cpp:
3315 (OpaqueJSClass::prototype):
3316 * API/JSContextRef.cpp:
3317 (JSGlobalContextCreate):
3318 * API/JSObjectRef.cpp:
3320 (JSObjectGetPrivate):
3321 (JSObjectSetPrivate):
3322 * API/JSValueRef.cpp:
3323 (JSValueIsObjectOfClass):
3324 * JavaScriptCore.exp:
3325 * JavaScriptCore.xcodeproj/project.pbxproj:
3326 * bindings/c/c_utility.cpp:
3327 (KJS::Bindings::convertValueToNPVariant):
3328 * bindings/jni/jni_jsobject.cpp:
3329 * bindings/objc/objc_utility.mm:
3330 (KJS::Bindings::convertValueToObjcValue):
3332 (KJS::Context::Context):
3333 * kjs/ExecState.cpp:
3334 (KJS::ExecState::lexicalInterpreter):
3335 * kjs/JSGlobalObject.h: Added.
3336 (KJS::JSGlobalObject::JSGlobalObject):
3337 (KJS::JSGlobalObject::isGlobalObject):
3338 (KJS::JSGlobalObject::interpreter):
3339 (KJS::JSGlobalObject::setInterpreter):
3340 * kjs/array_instance.cpp:
3343 (KJS::FunctionImp::callAsFunction):
3344 (KJS::GlobalFuncImp::callAsFunction):
3345 * kjs/interpreter.cpp:
3346 (KJS::Interpreter::Interpreter):
3347 (KJS::Interpreter::init):
3348 (KJS::Interpreter::~Interpreter):
3349 (KJS::Interpreter::globalObject):
3350 (KJS::Interpreter::initGlobalObject):
3351 (KJS::Interpreter::evaluate):
3352 * kjs/interpreter.h:
3354 (KJS::cacheGlobalObject):
3356 (KJS::JSObject::isGlobalObject):
3359 2007-10-24 Eric Seidel <eric@webkit.org>
3361 Build fix for Gtk, no review.
3363 * kjs/collector.cpp: #include "context.h"
3365 2007-10-24 Eric Seidel <eric@webkit.org>
3369 Stop checking isOutOfMemory after every allocation, instead let the collector
3370 notify all ExecStates if we ever hit this rare condition.
3372 SunSpider claims this was a 2.2% speedup.
3374 * kjs/collector.cpp:
3375 (KJS::Collector::collect):
3376 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
3379 (KJS::TryNode::execute):
3381 2007-10-24 Mark Rowe <mrowe@apple.com>
3385 * kjs/identifier.h: Remove extra qualification.
3387 2007-10-24 Geoffrey Garen <ggaren@apple.com>
3389 Reviewed by Sam Weinig.
3391 Disable ALWAYS_INLINE in debug builds, since it drives the debugger
3394 * wtf/AlwaysInline.h:
3396 2007-10-24 Geoffrey Garen <ggaren@apple.com>
3398 Reviewed by Sam Weinig.
3400 Inlined the fast path for creating an Identifier from an Identifier.
3402 This is a .4% speedup on SunSpider overall, but as big as a 2.5%
3403 speedup on certain individual tests. 65% of the Identifiers creating
3404 by SunSpider are already Identifiers.
3406 (The main reason I'm making this change is that it resolves a large
3407 regression in a patch I haven't checked in yet.)
3409 * JavaScriptCore.exp:
3410 * kjs/identifier.cpp:
3411 (KJS::Identifier::addSlowCase):
3413 (KJS::Identifier::Identifier::add):
3415 2007-10-24 Lars Knoll <lars@trolltech.com>
3419 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.
3421 * bindings/qt/qt_instance.cpp:
3422 (KJS::Bindings::QtInstance::invokeMethod):
3423 * bindings/qt/qt_runtime.cpp:
3424 (KJS::Bindings::convertValueToQVariant):
3425 (KJS::Bindings::QtField::setValueToInstance):
3427 2007-10-24 Oliver Hunt <oliver@apple.com>
3431 Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
3436 (KJS::LessNode::evaluate):
3437 (KJS::GreaterNode::evaluate):
3438 (KJS::LessEqNode::evaluate):
3439 (KJS::GreaterEqNode::evaluate):
3440 * kjs/operations.cpp:
3443 2007-10-24 Eric Seidel <eric@webkit.org>
3448 (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
3450 2007-10-24 Darin Adler <darin@apple.com>
3454 * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
3455 Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
3457 2007-10-24 Darin Adler <darin@apple.com>
3461 - separate out the code to create a hash table the first time from the code
3464 SunSpider claims this was a 0.7% speedup.
3466 * kjs/property_map.cpp:
3467 (KJS::PropertyMap::expand): Changed to call either createTable or rehash.
3468 (KJS::PropertyMap::createTable): Added. For the case where we had no table.
3469 (KJS::PropertyMap::rehash): Removed code needed only in the case where we
3471 * kjs/property_map.h: Added createTable.
3473 2007-10-24 Eric Seidel <eric@webkit.org>
3477 Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
3478 which can be represented by JSImmediate.
3480 SunSpider claims this was a 0.6% speedup.
3484 (KJS::NumberNode::evaluate):
3485 (KJS::ImmediateNumberNode::evaluate):
3488 (KJS::ImmediateNumberNode::):
3489 * kjs/nodes2string.cpp:
3490 (ImmediateNumberNode::streamTo):
3492 2007-10-24 Darin Adler <darin@apple.com>
3496 - http://bugs.webkit.org/show_bug.cgi?id=15657
3497 change static hash tables to use powers of two for speed
3499 Seems to give 0.7% SunSpider speedup.
3501 * kjs/create_hash_table: Updated to generate new format.
3503 (KJS::keysMatch): Took out unneeded typecast.
3504 (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
3505 Replaced the modulus with a bit mask.
3506 (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
3507 their hash -- saves a branch.
3508 (KJS::Lookup::find): Ditto.
3509 * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
3511 2007-10-24 Maciej Stachowiak <mjs@apple.com>
3515 - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
3518 (KJS::DoWhileNode::execute):
3519 (KJS::WhileNode::execute):
3520 (KJS::ForNode::execute):
3521 (KJS::ForInNode::execute):
3522 (KJS::SourceElementsNode::execute):
3524 2007-10-23 Darin Adler <darin@apple.com>
3528 * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
3529 Changed an && to an & for a 1% gain in SunSpider.
3531 2007-10-23 Oliver Hunt <oliver@apple.com>
3535 Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
3538 (KJS::MultNode::evaluate):
3539 (KJS::DivNode::evaluate):
3540 (KJS::ModNode::evaluate):
3543 (KJS::AddNode::evaluate):
3544 (KJS::SubNode::evaluate):
3545 (KJS::valueForReadModifyAssignment):
3546 * kjs/operations.cpp:
3549 2007-10-23 Oliver Hunt <oliver@apple.com>
3553 Separating all of the simple (eg. non-read-modify-write) binary operators
3554 into separate classes in preparation for further JS optimisations.
3556 Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
3559 * JavaScriptCore.xcodeproj/project.pbxproj:
3562 (KJS::MultNode::evaluate):
3563 (KJS::DivNode::evaluate):
3564 (KJS::ModNode::evaluate):
3565 (KJS::AddNode::evaluate):
3566 (KJS::SubNode::evaluate):
3567 (KJS::LeftShiftNode::evaluate):
3568 (KJS::RightShiftNode::evaluate):
3569 (KJS::UnsignedRightShiftNode::evaluate):
3570 (KJS::LessNode::evaluate):
3571 (KJS::GreaterNode::evaluate):
3572 (KJS::LessEqNode::evaluate):
3573 (KJS::GreaterEqNode::evaluate):
3574 (KJS::InstanceOfNode::evaluate):
3575 (KJS::InNode::evaluate):
3576 (KJS::EqualNode::evaluate):
3577 (KJS::NotEqualNode::evaluate):
3578 (KJS::StrictEqualNode::evaluate):
3579 (KJS::NotStrictEqualNode::evaluate):
3580 (KJS::BitAndNode::evaluate):
3581 (KJS::BitXOrNode::evaluate):
3582 (KJS::BitOrNode::evaluate):
3583 (KJS::LogicalAndNode::evaluate):
3584 (KJS::LogicalOrNode::evaluate):
3591 (KJS::LeftShiftNode::):
3592 (KJS::RightShiftNode::):
3593 (KJS::UnsignedRightShiftNode::):
3595 (KJS::GreaterNode::):
3596 (KJS::LessEqNode::):
3597 (KJS::GreaterEqNode::):
3598 (KJS::InstanceOfNode::):
3601 (KJS::NotEqualNode::):
3602 (KJS::StrictEqualNode::):
3603 (KJS::NotStrictEqualNode::):
3604 (KJS::BitAndNode::):
3606 (KJS::BitXOrNode::):
3607 (KJS::LogicalAndNode::):
3608 (KJS::LogicalOrNode::):
3609 * kjs/nodes2string.cpp:
3610 (MultNode::streamTo):
3611 (DivNode::streamTo):
3612 (ModNode::streamTo):
3613 (AddNode::streamTo):
3614 (SubNode::streamTo):
3615 (LeftShiftNode::streamTo):
3616 (RightShiftNode::streamTo):
3617 (UnsignedRightShiftNode::streamTo):
3618 (LessNode::streamTo):
3619 (GreaterNode::streamTo):
3620 (LessEqNode::streamTo):
3621 (GreaterEqNode::streamTo):
3622 (InstanceOfNode::streamTo):
3624 (EqualNode::streamTo):
3625 (NotEqualNode::streamTo):
3626 (StrictEqualNode::streamTo):
3627 (NotStrictEqualNode::streamTo):
3628 (BitAndNode::streamTo):
3629 (BitXOrNode::streamTo):
3630 (BitOrNode::streamTo):
3631 (LogicalAndNode::streamTo):
3633 2007-10-23 Darin Adler <darin@apple.com>
3637 - fix http://bugs.webkit.org/show_bug.cgi?id=15639
3638 fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
3640 Test: fast/js/math.html
3642 * kjs/math_object.cpp: (MathFuncImp::callAsFunction):
3643 Fix abs to look at the sign bit. Add a special case for values in the range
3644 between -0 and -1 and a special case for ceil and for -0 for floor.
3646 2007-10-23 Darin Adler <darin@apple.com>
3650 - streamline exception handling code for a >1% speed-up of SunSpider
3652 * kjs/nodes.cpp: Changed macros to use functions for everything that's not
3653 part of normal execution. We'll take function call overhead when propagating
3654 an exception or out of memory.
3655 (KJS::createOutOfMemoryCompletion): Added.
3656 (KJS::substitute): Use append instead of the relatively inefficient + operator.
3657 (KJS::Node::rethrowException): Added.
3658 * kjs/nodes.h: Added rethrowException.
3660 2007-10-22 Darin Adler <darin@apple.com>
3664 - fix http://bugs.webkit.org/show_bug.cgi?id=15636
3665 some JavaScriptCore regression tests are failing due to numeric conversion
3667 This should restore correctness and make speed better too, restoring some
3668 of the optimization we lost in my last check-in.
3670 * kjs/JSImmediate.h:
3671 (KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom
3672 I used in my patch yesterday.
3673 (KJS::JSImmediate::getTruncatedUInt32): Ditto.
3675 * kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32.
3677 (KJS::NumberImp::getUInt32): Changed to always use double, since I can't find
3678 a way to write this more efficiently for float.
3679 (KJS::NumberImp::getTruncatedInt32): Added.
3680 (KJS::NumberImp::getTruncatedUInt32): Added.
3682 * kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32.
3683 (KJS::JSValue::getUInt32):
3684 (KJS::JSValue::getTruncatedInt32): Added.
3685 (KJS::JSValue::getTruncatedUInt32): Added.
3686 (KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32.
3687 (KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32.
3689 (KJS::JSCell::getTruncatedInt32): Added.
3690 (KJS::JSCell::getTruncatedUInt32): Added.
3691 (KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32.
3692 (KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally
3694 (KJS::JSValue::toUInt32SlowCase): Ditto.
3695 (KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32.
3697 * JavaScriptCore.exp: Updated.
3699 2007-10-22 Darin Adler <darin@apple.com>
3703 - fix http://bugs.webkit.org/show_bug.cgi?id=15632
3704 js1_5/Array/array-001.js test failing
3706 One of the JavaScriptCore tests was failing; it failed because of
3707 my change to NumberImp::getUInt32. The incorrect code I copied was
3708 from JSImmediate::getUInt32, and was a pre-existing bug.
3710 This patch fixes correctness, but will surely slow down SunSpider.
3711 We may be able to code this tighter and get the speed back.
3713 * kjs/JSImmediate.h:
3714 (KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately
3715 reflect the fact that this function only returns true if the value is
3716 accurate (no fractional part, etc.). Changed code so that it returns
3717 false when the value has a fraction.
3718 (KJS::JSImmediate::getUInt32): Ditto.
3721 (KJS::NumberImp::getInt32): Changed code so that it returns false when
3722 the value has a fraction. Restores the old behavior.
3723 (KJS::NumberImp::getUInt32): Ditto.
3726 (KJS::JSValue::getInt32): Updated for name change.
3727 (KJS::JSValue::getUInt32): Ditto.
3728 (KJS::JSValue::toInt32): Ditto.
3729 (KJS::JSValue::toUInt32): Ditto.
3731 2007-10-22 Darin Adler <darin@apple.com>
3735 - fix crash seen when running JavaScriptCore tests
3737 * kjs/array_instance.cpp: (KJS::ArrayInstance::mark):
3738 Copy and paste error: I accidentally had code here that was
3739 making a copy of the HashMap -- that's illegal inside a mark
3740 function and was unnecessary. The other callsite was modifying
3741 the map as it iterated it, but this function is not.
3743 2007-10-22 Maciej Stachowiak <mjs@apple.com>
3747 - Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider
3748 http://bugs.webkit.org/show_bug.cgi?id=15627
3750 * kjs/JSImmediate.h:
3751 (KJS::JSImmediate::fromDouble): Avoid moving floats to integer
3752 registers since this is very slow.
3754 2007-10-22 Darin Adler <darin@apple.com>
3756 Reviewed by Eric Seidel.
3758 - http://bugs.webkit.org/show_bug.cgi?id=15617
3759 improve speed of integer conversions
3761 Makes SunSpider 6% faster.
3763 * kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for
3766 (KJS::JSValue::getUInt32): Call JSImmediate::toUInt32.
3768 * kjs/internal.h: Added getInt32.
3770 (KJS::NumberImp::getInt32): Added.
3771 (KJS::NumberImp::getUInt32): Replaced with more-optimal implementation
3772 stolen from JSValue.
3775 (KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting
3777 (KJS::JSValue::getInt32): Added.
3778 (KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32
3779 to avoid converting from float to double.
3780 (KJS::JSValue::toInt32): Made inline, separated out the slow case.
3781 (KJS::JSValue::toUInt32): Ditto.
3783 (KJS::JSCell::getInt32): Added.
3784 (KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the
3785 new getInt32. Added a faster case for in-range numbers.
3786 (KJS::JSValue::toUInt32SlowCase): Ditto.
3787 (KJS::JSValue::toUInt16): Added a faster case for in-range numbers.
3789 * JavaScriptCore.exp: Updated for changes.
3791 2007-10-22 Adam Roben <aroben@apple.com>
3795 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off
3796 warning about implicit conversion to bool.
3798 2007-10-22 Mark Rowe <mrowe@apple.com>
3802 * kjs/array_instance.cpp:
3804 2007-10-22 Darin Adler <darin@apple.com>
3808 - http://bugs.webkit.org/show_bug.cgi?id=15606
3809 make cut-off for sparse vs. dense arrays smarter for speed with large arrays
3811 Makes the morph test in SunSpider 26% faster, and the overall
3812 benchmark 3% faster.
3814 This also fixes some small problems we had with the distinction
3815 between nonexistent and undefined values in arrays.
3817 * kjs/array_instance.h: Tweaked formatting and naming.
3818 * kjs/array_instance.cpp: Copied from kjs/array_object.cpp.
3819 (KJS::storageSize): Added. Computes the size of the storage given a vector length.
3820 (KJS::increasedVectorLength): Added. Implements the rule for resizing the vector.
3821 (KJS::isDenseEnoughForVector): Added.
3822 (KJS::ArrayInstance::ArrayInstance): Initialize the new fields.
3823 (KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it.
3824 (KJS::ArrayInstance::getItem): Updated for name changes.
3825 (KJS::ArrayInstance::lengthGetter): Ditto.
3826 (KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of
3827 getOwnPropertySlot to share more code.
3828 (KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change.
3829 (KJS::ArrayInstance::put): Added logic for extending the vector as long as the
3830 array is dense enough. Also keep m_numValuesInVector up to date.
3831 (KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector
3833 (KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names
3834 for array indices with undefined values.
3835 (KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also
3836 simplified to only handle getting larger.
3837 (KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to
3838 zero out the unused part of the vector and to delete the map if it's no longer
3840 (KJS::ArrayInstance::mark): Tweaked formatting.
3841 (KJS::compareByStringForQSort): Ditto.
3842 (KJS::ArrayInstance::sort): Ditto.
3843 (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
3845 (KJS::compareWithCompareFunctionForQSort): Ditto.
3846 (KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn
3847 undefined values into nonexistent values in some cases.
3849 * kjs/array_object.h: Removed MAX_ARRAY_INDEX.
3850 * kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file.
3852 * JavaScriptCore.pri: Added array_instance.cpp.
3853 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
3854 * kjs/AllInOneFile.cpp: Ditto.
3856 2007-10-22 Andrew Wellington <proton@wiretapped.net>
3858 Reviewed by Mark Rowe.
3860 Fix for local database support after r26879
3861 Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set
3863 * Configurations/JavaScriptCore.xcconfig:
3865 2007-10-22 Simon Hausmann <hausmann@kde.org>
3869 Build fix for the non-qmake builds.
3871 * wtf/Platform.h: Default to enabling the database features unless
3872 otherwise specified. (similar to ENABLE_ICONDATABASE)
3874 2007-10-22 Holger Freyther <zecke@selfish.org>
3876 Reviewed by Simon Hausmann <hausmann@kde.org>.
3878 * Do not build testkjs as an application bundle. This is
3879 needed for run-javascriptcore-tests on OSX.
3880 * Also, based on r26633, allow to test the WebKit/Qt port on OSX.
3881 * Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set
3882 as we do not have -rpath on OSX.
3886 2007-10-21 Mark Rowe <mrowe@apple.com>
3890 http://bugs.webkit.org/show_bug.cgi?id=15575
3891 Bug 15575: [GTK] Implement threading using GThread
3893 * wtf/Platform.h: Do not enable pthreads for Gtk.
3895 2007-10-21 Mark Rowe <mrowe@apple.com>
3899 Fix http://bugs.webkit.org/show_bug.cgi?id=15603
3900 Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript
3902 * kjs/array_object.cpp:
3903 (KJS::freeStorage): Reinstate null-check that was removed in r26847.
3905 2007-10-21 Darin Adler <darin@apple.com>
3909 * kjs/array_instance.h: Removed unused ExecState parameter.
3910 * kjs/array_object.cpp:
3911 (KJS::ArrayInstance::put): Ditto.
3912 (KJS::ArrayInstance::setLength): Ditto.
3914 2007-10-21 Darin Adler <darin@apple.com>
3916 * kjs/array_object.cpp: (KJS::ArrayInstance::put):
3917 Add missing assignment that was causing regression test crash.
3919 2007-10-21 Darin Adler <darin@apple.com>
3923 - http://bugs.webkit.org/show_bug.cgi?id=15585
3924 speed up sparse arrays by using a custom map
3926 Speeds up SunSpider by 10%.
3928 * kjs/array_object.cpp:
3929 (allocateStorage): Leave room for an additional pointer.
3930 (reallocateStorage): Ditto.
3931 (freeStorage): Ditto.
3932 (ArrayInstance::~ArrayInstance): Delete the overflow map if present.
3933 (ArrayInstance::getItem): Read values from the overflow map if present.
3934 Removed the check of length, since it slows down the common case.
3935 (ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback
3936 to the property map.
3937 (ArrayInstance::put): Write values into the overflow map as needed.
3938 Also create overflow map when needed.
3939 (ArrayInstance::deleteProperty): Remove values from the overflow map
3941 (ArrayInstance::getPropertyNames): Add a name for each identifier in
3942 the property map. This is extremely inefficient.
3943 (ArrayInstance::setLength): Remove any values in the overflow map
3944 that are past the new length, as we formerly did with the property map.
3945 (ArrayInstance::mark): Mark any values in the overflow map.
3946 (compareByStringForQSort): Removed unneeded undefined case, since
3947 compactForSorting guarantees we will have no undefined values.
3948 (compareWithCompareFunctionForQSort): Ditto.
3949 (ArrayInstance::compactForSorting): Copy all the values out of the
3950 overflow map and destroy it.
3952 * kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
3953 * kjs/property_map.cpp: Ditto.
3955 2007-10-20 Darin Adler <darin@apple.com>
3959 - http://bugs.webkit.org/show_bug.cgi?id=15579
3960 stop churning identifier reference counts copying Completion objects
3962 * kjs/completion.h: Replace the Identifier with an Identifier*.
3964 (ForInNode::execute): Update for change to Completion constructor.
3965 (ContinueNode::execute): Ditto.
3966 (BreakNode::execute): Ditto.
3968 2007-10-20 Mark Rowe <mrowe@apple.com>
3972 Gtk changes needed to enable HTML 5 client-side database storage.
3974 * wtf/Platform.h: Have Gtk use pthreads for now.
3976 2007-10-20 Geoffrey Garen <ggaren@apple.com>
3978 Reviewed by Maciej Stachowiak.
3980 Fixed http://bugs.webkit.org/show_bug.cgi?id=15570
3981 Store gathered declaration nodes in the function body node.
3983 This means that you only have to gather the declaration nodes the first
3984 time the function executes. Performance gain of 2.10% on SunSpider,
3985 0.90% on command-line JS iBench.
3987 * kjs/nodes.cpp: Split declaration stack initialization code off into
3988 initializeDeclarationStacks().
3989 (FunctionBodyNode::FunctionBodyNode):
3990 (FunctionBodyNode::initializeDeclarationStacks):
3991 (FunctionBodyNode::processDeclarations):
3993 * kjs/nodes.h: Changed DeclarationStacks structure to hold references,
3994 since the actual Vectors are now stored either on the stack or in the
3997 2007-10-19 Geoffrey Garen <ggaren@apple.com>
3999 Reviewed by Darin Adler.
4001 http://bugs.webkit.org/show_bug.cgi?id=15559
4002 Moved processDeclarations call into FunctionBodyNode::execute
4004 To improve encapsulation, moved processDeclarations call into
4005 FunctionBodyNode::execute. Also marked processDeclarations
4006 ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup
4007 on command-line JS iBench.
4010 (KJS::FunctionImp::callAsFunction):
4011 (KJS::GlobalFuncImp::callAsFunction):
4013 * kjs/interpreter.cpp:
4014 (KJS::Interpreter::evaluate):
4016 (FunctionBodyNode::execute):
4019 2007-10-19 Brady Eidson <beidson@apple.com>
4023 Queue -> Deque! and small style tweaks
4025 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
4026 * JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
4027 * wtf/Deque.h: Added.
4028 (WTF::DequeNode::DequeNode):
4029 (WTF::Deque::Deque):
4030 (WTF::Deque::~Deque):
4032 (WTF::Deque::isEmpty):
4033 (WTF::Deque::append):
4034 (WTF::Deque::prepend):
4035 (WTF::Deque::first):
4037 (WTF::Deque::removeFirst):
4038 (WTF::Deque::clear):
4039 * wtf/Queue.h: Removed.
4042 2007-10-19 Brady Eidson <beidson@apple.com>
4046 Added a simple LinkedList based Queue to wtf
4047 We can make a better, more sophisticated an efficient one later, but have
4048 needed one for some time, now!
4050 * JavaScriptCore.xcodeproj/project.pbxproj:
4051 * wtf/Queue.h: Added.
4052 (WTF::QueueNode::QueueNode):
4053 (WTF::Queue::Queue):
4054 (WTF::Queue::~Queue):
4056 (WTF::Queue::isEmpty):
4057 (WTF::Queue::append):
4058 (WTF::Queue::prepend):
4059 (WTF::Queue::first):
4061 (WTF::Queue::removeFirst):
4062 (WTF::Queue::clear):
4064 2007-10-19 Nikolas Zimmermann <zimmermann@kde.org>
4068 Try to fix Qt/Win build slave, by including windows.h also on Qt/Win.
4070 * kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS)
4072 2007-10-19 Simon Hausmann <hausmann@kde.org>
4076 Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-).
4077 Don't provide the wchar_t overloads then as they conflict with the unsigned short ones.
4080 (WTF::isASCIIAlpha):
4081 (WTF::isASCIIAlphanumeric):
4082 (WTF::isASCIIDigit):
4083 (WTF::isASCIIHexDigit):
4084 (WTF::isASCIILower):
4085 (WTF::isASCIISpace):
4086 (WTF::toASCIILower):
4087 (WTF::toASCIIUpper):
4089 2007-10-19 Simon Hausmann <hausmann@kde.org>
4093 Another build fix for the windows/qt build: Apply the same fix as in revision 26686 also to kjs/config.h to disable the disallowctype feature.
4097 2007-10-18 Maciej Stachowiak <mjs@apple.com>
4101 - use __declspec(thread) for fast thread-local storage on Windows
4103 - 2.2% speedup on sunspider (on Windows)
4104 - 7% speedup on the string section
4105 - 6% speedup on JS iBench
4107 - fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422
4108 - fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10
4111 * wtf/FastMalloc.cpp:
4112 (WTF::getThreadHeap):
4113 (WTF::setThreadHeap):
4114 (WTF::TCMalloc_ThreadCache::GetCache):
4115 (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
4116 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
4118 2007-10-17 Darin Adler <darin@apple.com>
4120 Reviewed by Mark Rowe.
4122 - fix http://bugs.webkit.org/show_bug.cgi?id=15543
4123 <rdar://problem/5545639> REGRESSION (r26697):
4124 GoogleDocs: Can't create new documents or open existing ones
4126 Test: fast/js/regexp-non-character.html
4128 * pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters
4129 in the \u sequences -- not needed and actively harmful.
4131 2007-10-17 Anders Carlsson <andersca@apple.com>
4136 #define USE_PTHREADS on Mac.
4138 2007-10-17 Geoffrey Garen <ggaren@apple.com>
4140 Reviewed by Darin Adler.
4142 Merged DeclaredFunctionImp into FunctionImp (the base class) because
4143 the distinction between the two was unused.
4145 Removed codeType() from FunctionImp because FunctionImp and its
4146 subclasses all returned FunctionCode, so it was unused, practically
4149 Removed a different codeType() from GlobalFuncImp because it was unused.
4150 (Perhaps it was vestigial from a time when GlobalFuncImp used to
4151 inherit from FunctionImp.)
4153 * bindings/runtime_method.cpp:
4154 * bindings/runtime_method.h:
4157 (KJS::FunctionImp::FunctionImp):
4158 (KJS::FunctionImp::callAsFunction):
4159 (KJS::FunctionImp::construct):
4160 (KJS::FunctionImp::execute):
4161 (KJS::FunctionImp::processVarDecls):
4163 (KJS::FunctionImp::implementsConstruct):
4164 (KJS::FunctionImp::scope):
4165 * kjs/function_object.cpp:
4166 (FunctionProtoFunc::callAsFunction):
4167 (FunctionObjectImp::construct):
4169 (FuncDeclNode::processFuncDecl):
4170 (FuncExprNode::evaluate):
4172 2007-10-17 Adam Roben <aroben@apple.com>