1 2007-11-09 Adam Roben <aroben@apple.com>
8 (KJS::jsNumber): Add some explicit casts.
10 2007-11-08 Darin Adler <darin@apple.com>
16 * kjs/property_map.cpp:
18 2007-11-08 Darin Adler <darin@apple.com>
20 - roll out accidentally-checked in changes
22 * kjs/nodes.cpp: Back to previous version.
24 * kjs/grammar.y: Ditto.
26 2007-11-08 Darin Adler <darin@apple.com>
30 - http://bugs.webkit.org/show_bug.cgi?id=15912
31 fasta spends a lot of time in qsort
33 * kjs/property_map.cpp:
34 (KJS::PropertyMap::getEnumerablePropertyNames):
35 Use insertion sort instead of qsort for small sets of property names.
36 We can probably do some even-better speedups of for/in, but this nets
37 0.6% overall and 6.7% on fasta.
39 2007-11-08 Darin Adler <darin@apple.com>
43 - http://bugs.webkit.org/show_bug.cgi?id=15906
44 getting characters by indexing into a string is very slow
46 This fixes one source of the slowness -- the conversion to an unused
47 Identifier as we call the get function from the slot -- but doesn't
48 fix others, such as the fact that we have to allocate a new UString::Rep
49 for every single character.
51 Speeds up string-base64 30%, and at least 0.5% overall.
52 But does slow down access-fannkuch quite a bit. Might be worth
53 revisiting in the future to see what we can do about that (although
54 I did look at a profile for a while).
56 * kjs/property_slot.h: Add a new marker for "numeric" property slots;
57 slots where we don't need to pass the identifier to the get function.
58 (KJS::PropertySlot::getValue): Added code to call the numeric get function.
59 (KJS::PropertySlot::setCustomNumeric): Added.
60 * kjs/string_object.cpp:
61 (KJS::StringInstance::indexGetter): Changed to use substr() instead
62 of constructing a wholly new UString each time.
63 (KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but
64 takes advantage of setCustomNumeric to avoid creating an Identifier.
65 (KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric.
67 2007-11-08 Darin Adler <darin@apple.com>
71 - http://bugs.webkit.org/show_bug.cgi?id=15904
72 more speed-ups possible by tightening up int version of JSImmediate
74 1% improvement of SunSpider
76 * kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template.
77 (KJS::JSImmediate::from): Overload for most numeric types; many types can
78 do fewer branches and checks.
79 (KJS::JSImmediate::getUInt32): Removed unneeded check for undefined.
80 (KJS::JSImmediate::getTruncatedInt32): Ditto.
81 (KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more
82 between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later.
84 * kjs/grammar.y: Update since fromDouble is now just from.
87 * kjs/value.h: (KJS::jsNumber): Overload for most numeric types.
89 2007-11-08 Kevin Ollivier <kevino@theolliviers.com>
91 Bakefiles for building JavaScriptCore, needed by wx port.
93 Reviewed by Mark Rowe.
95 * JavaScriptCoreSources.bkl: Added.
98 2007-11-08 Oliver Hunt <oliver@apple.com>
102 Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
104 The implementation of JSImmediate::areBothImmediateNumbers relies on
105 (JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having
106 a unique result when both immediate values are numbers.
108 The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
109 By swapping the value of NumberType and UndefinedType this ceases to be a problem.
114 2007-11-08 Darin Adler <darin@apple.com>
118 * kjs/nodes.h: Add missing parameter name.
120 2007-11-08 Eric Seidel <eric@webkit.org>
124 Add ExpressionNode subclass of Node, use it.
128 (KJS::ForInNode::ForInNode):
130 (KJS::ExpressionNode::):
132 (KJS::NullNode::precedence):
133 (KJS::BooleanNode::):
134 (KJS::BooleanNode::precedence):
136 (KJS::RegExpNode::precedence):
138 (KJS::ThisNode::precedence):
139 (KJS::ResolveNode::):
140 (KJS::ElementNode::):
142 (KJS::PropertyNode::):
143 (KJS::PropertyNode::precedence):
144 (KJS::PropertyNode::name):
145 (KJS::PropertyListNode::):
146 (KJS::ObjectLiteralNode::):
147 (KJS::ObjectLiteralNode::precedence):
148 (KJS::BracketAccessorNode::):
149 (KJS::DotAccessorNode::):
150 (KJS::DotAccessorNode::precedence):
151 (KJS::ArgumentListNode::):
152 (KJS::ArgumentsNode::):
153 (KJS::NewExprNode::):
154 (KJS::NewExprNode::precedence):
155 (KJS::FunctionCallValueNode::):
156 (KJS::FunctionCallValueNode::precedence):
157 (KJS::FunctionCallResolveNode::):
158 (KJS::FunctionCallBracketNode::):
159 (KJS::FunctionCallBracketNode::precedence):
160 (KJS::FunctionCallDotNode::):
161 (KJS::FunctionCallDotNode::precedence):
162 (KJS::PrePostResolveNode::):
163 (KJS::PostfixBracketNode::):
164 (KJS::PostfixBracketNode::precedence):
165 (KJS::PostIncBracketNode::):
166 (KJS::PostIncBracketNode::isIncrement):
167 (KJS::PostDecBracketNode::):
168 (KJS::PostDecBracketNode::isIncrement):
169 (KJS::PostfixDotNode::):
170 (KJS::PostfixDotNode::precedence):
171 (KJS::PostIncDotNode::):
172 (KJS::PostIncDotNode::isIncrement):
173 (KJS::PostDecDotNode::):
174 (KJS::PostDecDotNode::isIncrement):
175 (KJS::PostfixErrorNode::):
176 (KJS::PostfixErrorNode::precedence):
177 (KJS::DeleteResolveNode::):
178 (KJS::DeleteBracketNode::):
179 (KJS::DeleteBracketNode::precedence):
180 (KJS::DeleteDotNode::):
181 (KJS::DeleteDotNode::precedence):
182 (KJS::DeleteValueNode::):
183 (KJS::DeleteValueNode::precedence):
185 (KJS::VoidNode::precedence):
186 (KJS::TypeOfResolveNode::):
187 (KJS::TypeOfValueNode::):
188 (KJS::PrefixBracketNode::):
189 (KJS::PrefixBracketNode::precedence):
190 (KJS::PreIncBracketNode::):
191 (KJS::PreIncBracketNode::isIncrement):
192 (KJS::PreDecBracketNode::):
193 (KJS::PreDecBracketNode::isIncrement):
194 (KJS::PrefixDotNode::):
195 (KJS::PrefixDotNode::precedence):
196 (KJS::PreIncDotNode::):
197 (KJS::PreIncDotNode::isIncrement):
198 (KJS::PreDecDotNode::):
199 (KJS::PreDecDotNode::isIncrement):
200 (KJS::PrefixErrorNode::):
201 (KJS::PrefixErrorNode::precedence):
202 (KJS::UnaryPlusNode::):
203 (KJS::UnaryPlusNode::precedence):
205 (KJS::NegateNode::precedence):
206 (KJS::BitwiseNotNode::):
207 (KJS::BitwiseNotNode::precedence):
208 (KJS::LogicalNotNode::):
209 (KJS::LogicalNotNode::precedence):
211 (KJS::AddNode::precedence):
212 (KJS::LeftShiftNode::):
213 (KJS::LeftShiftNode::precedence):
214 (KJS::RightShiftNode::):
215 (KJS::RightShiftNode::precedence):
216 (KJS::UnsignedRightShiftNode::):
217 (KJS::UnsignedRightShiftNode::precedence):
219 (KJS::LessNode::precedence):
220 (KJS::GreaterNode::):
221 (KJS::GreaterNode::precedence):
223 (KJS::LessEqNode::precedence):
224 (KJS::GreaterEqNode::):
225 (KJS::GreaterEqNode::precedence):
226 (KJS::InstanceOfNode::):
227 (KJS::InstanceOfNode::precedence):
229 (KJS::InNode::precedence):
231 (KJS::EqualNode::precedence):
232 (KJS::NotEqualNode::):
233 (KJS::NotEqualNode::precedence):
234 (KJS::StrictEqualNode::):
235 (KJS::StrictEqualNode::precedence):
236 (KJS::NotStrictEqualNode::):
237 (KJS::NotStrictEqualNode::precedence):
239 (KJS::BitAndNode::precedence):
241 (KJS::BitOrNode::precedence):
243 (KJS::BitXOrNode::precedence):
244 (KJS::LogicalAndNode::):
245 (KJS::LogicalAndNode::precedence):
246 (KJS::LogicalOrNode::):
247 (KJS::LogicalOrNode::precedence):
248 (KJS::ConditionalNode::):
249 (KJS::ConditionalNode::precedence):
250 (KJS::ReadModifyResolveNode::):
251 (KJS::ReadModifyResolveNode::precedence):
252 (KJS::AssignResolveNode::):
253 (KJS::AssignResolveNode::precedence):
254 (KJS::ReadModifyBracketNode::):
255 (KJS::ReadModifyBracketNode::precedence):
256 (KJS::AssignBracketNode::):
257 (KJS::AssignBracketNode::precedence):
258 (KJS::AssignDotNode::):
259 (KJS::AssignDotNode::precedence):
260 (KJS::ReadModifyDotNode::):
261 (KJS::ReadModifyDotNode::precedence):
262 (KJS::AssignErrorNode::):
263 (KJS::AssignErrorNode::precedence):
265 (KJS::CommaNode::precedence):
266 (KJS::AssignExprNode::):
267 (KJS::AssignExprNode::precedence):
268 (KJS::ExprStatementNode::):
270 (KJS::DoWhileNode::):
275 (KJS::ParameterNode::):
276 (KJS::CaseClauseNode::):
277 (KJS::CaseClauseNode::precedence):
278 (KJS::ClauseListNode::):
281 2007-11-08 Oliver Hunt <oliver@apple.com>
285 Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
287 This only improves bitwise-and performance, as the additional logic required
288 for similar code paths on or, xor, and shifting requires additional operations
289 and branches that negate (and in certain cases, regress) any advantage we might
292 This improves performance on all bitop tests, the cryptography tests, as well as
293 the string-base64 and string-unpack-code tests. No significant degradation on
297 (KJS::JSImmediate::areBothImmediateNumbers):
298 (KJS::JSImmediate::andImmediateNumbers):
300 (KJS::BitAndNode::evaluate):
302 (KJS::jsNumberFromAnd):
304 2007-11-08 Adam Roben <aroben@apple.com>
306 Stop using KJS inside of MathExtras.h
310 * wtf/MathExtras.h: Removed an unused header, and a now-unused
312 (wtf_atan2): Use std::numeric_limits intead of KJS.
314 2007-11-08 Sam Weinig <sam@webkit.org>
318 * kjs/date_object.cpp:
319 (KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
320 (KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
321 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
323 2007-11-08 Mark Rowe <mrowe@apple.com>
327 * kjs/lookup.h: Add missing include.
329 2007-11-08 Sam Weinig <sam@webkit.org>
333 Convert JavaScript internal function objects to use one class per
334 function. This avoids a switch statement inside what used to be
335 the shared function classes and will allow Shark to better analyze
338 To make this switch, the value property of the HashEntry was changed
339 to a union of an intptr_t (which is used to continue handle valueGetters)
340 and function pointer which points to a static constructor for the
341 individual new function objects.
343 SunSpider claims this is a 1.0% speedup.
345 * kjs/array_object.cpp:
346 (KJS::ArrayPrototype::getOwnPropertySlot):
348 (KJS::ArrayProtoFuncToString::callAsFunction):
349 (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
350 (KJS::ArrayProtoFuncJoin::callAsFunction):
351 (KJS::ArrayProtoFuncConcat::callAsFunction):
352 (KJS::ArrayProtoFuncPop::callAsFunction):
353 (KJS::ArrayProtoFuncPush::callAsFunction):
354 (KJS::ArrayProtoFuncReverse::callAsFunction):
355 (KJS::ArrayProtoFuncShift::callAsFunction):
356 (KJS::ArrayProtoFuncSlice::callAsFunction):
357 (KJS::ArrayProtoFuncSort::callAsFunction):
358 (KJS::ArrayProtoFuncSplice::callAsFunction):
359 (KJS::ArrayProtoFuncUnShift::callAsFunction):
360 (KJS::ArrayProtoFuncFilter::callAsFunction):
361 (KJS::ArrayProtoFuncMap::callAsFunction):
362 (KJS::ArrayProtoFuncEvery::callAsFunction):
363 (KJS::ArrayProtoFuncForEach::callAsFunction):
364 (KJS::ArrayProtoFuncSome::callAsFunction):
365 (KJS::ArrayProtoFuncIndexOf::callAsFunction):
366 (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
367 * kjs/array_object.h:
368 (KJS::ArrayPrototype::classInfo):
369 * kjs/create_hash_table:
370 * kjs/date_object.cpp:
371 (KJS::DatePrototype::getOwnPropertySlot):
372 (KJS::DateProtoFuncToString::callAsFunction):
373 (KJS::DateProtoFuncToUTCString::callAsFunction):
374 (KJS::DateProtoFuncToDateString::callAsFunction):
375 (KJS::DateProtoFuncToTimeString::callAsFunction):
376 (KJS::DateProtoFuncToLocaleString::callAsFunction):
377 (KJS::DateProtoFuncToLocaleDateString::callAsFunction):
378 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
379 (KJS::DateProtoFuncValueOf::callAsFunction):
380 (KJS::DateProtoFuncGetTime::callAsFunction):
381 (KJS::DateProtoFuncGetFullYear::callAsFunction):
382 (KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
383 (KJS::DateProtoFuncToGMTString::callAsFunction):
384 (KJS::DateProtoFuncGetMonth::callAsFunction):
385 (KJS::DateProtoFuncGetUTCMonth::callAsFunction):
386 (KJS::DateProtoFuncGetDate::callAsFunction):
387 (KJS::DateProtoFuncGetUTCDate::callAsFunction):
388 (KJS::DateProtoFuncGetDay::callAsFunction):
389 (KJS::DateProtoFuncGetUTCDay::callAsFunction):
390 (KJS::DateProtoFuncGetHours::callAsFunction):
391 (KJS::DateProtoFuncGetUTCHours::callAsFunction):
392 (KJS::DateProtoFuncGetMinutes::callAsFunction):
393 (KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
394 (KJS::DateProtoFuncGetSeconds::callAsFunction):
395 (KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
396 (KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
397 (KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
398 (KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
399 (KJS::DateProtoFuncSetTime::callAsFunction):
400 (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
401 (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
402 (KJS::DateProtoFuncSetSeconds::callAsFunction):
403 (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
404 (KJS::DateProtoFuncSetMinutes::callAsFunction):
405 (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
406 (KJS::DateProtoFuncSetHours::callAsFunction):
407 (KJS::DateProtoFuncSetUTCHours::callAsFunction):
408 (KJS::DateProtoFuncSetDate::callAsFunction):
409 (KJS::DateProtoFuncSetUTCDate::callAsFunction):
410 (KJS::DateProtoFuncSetMonth::callAsFunction):
411 (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
412 (KJS::DateProtoFuncSetFullYear::callAsFunction):
413 (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
414 (KJS::DateProtoFuncSetYear::callAsFunction):
415 (KJS::DateProtoFuncGetYear::callAsFunction):
421 (KJS::staticFunctionGetter):
422 (KJS::staticValueGetter):
423 (KJS::getStaticPropertySlot):
424 (KJS::getStaticFunctionSlot):
426 * kjs/math_object.cpp:
427 (KJS::MathObjectImp::getOwnPropertySlot):
428 (KJS::MathProtoFuncAbs::callAsFunction):
429 (KJS::MathProtoFuncACos::callAsFunction):
430 (KJS::MathProtoFuncASin::callAsFunction):
431 (KJS::MathProtoFuncATan::callAsFunction):
432 (KJS::MathProtoFuncATan2::callAsFunction):
433 (KJS::MathProtoFuncCeil::callAsFunction):
434 (KJS::MathProtoFuncCos::callAsFunction):
435 (KJS::MathProtoFuncExp::callAsFunction):
436 (KJS::MathProtoFuncFloor::callAsFunction):
437 (KJS::MathProtoFuncLog::callAsFunction):
438 (KJS::MathProtoFuncMax::callAsFunction):
439 (KJS::MathProtoFuncMin::callAsFunction):
440 (KJS::MathProtoFuncPow::callAsFunction):
441 (KJS::MathProtoFuncRandom::callAsFunction):
442 (KJS::MathProtoFuncRound::callAsFunction):
443 (KJS::MathProtoFuncSin::callAsFunction):
444 (KJS::MathProtoFuncSqrt::callAsFunction):
445 (KJS::MathProtoFuncTan::callAsFunction):
447 (KJS::MathObjectImp::classInfo):
448 (KJS::MathObjectImp::):
449 * kjs/string_object.cpp:
450 (KJS::StringPrototype::getOwnPropertySlot):
451 (KJS::StringProtoFuncToString::callAsFunction):
452 (KJS::StringProtoFuncValueOf::callAsFunction):
453 (KJS::StringProtoFuncCharAt::callAsFunction):
454 (KJS::StringProtoFuncCharCodeAt::callAsFunction):
455 (KJS::StringProtoFuncConcat::callAsFunction):
456 (KJS::StringProtoFuncIndexOf::callAsFunction):
457 (KJS::StringProtoFuncLastIndexOf::callAsFunction):
458 (KJS::StringProtoFuncMatch::callAsFunction):
459 (KJS::StringProtoFuncSearch::callAsFunction):
460 (KJS::StringProtoFuncReplace::callAsFunction):
461 (KJS::StringProtoFuncSlice::callAsFunction):
462 (KJS::StringProtoFuncSplit::callAsFunction):
463 (KJS::StringProtoFuncSubstr::callAsFunction):
464 (KJS::StringProtoFuncSubstring::callAsFunction):
465 (KJS::StringProtoFuncToLowerCase::callAsFunction):
466 (KJS::StringProtoFuncToUpperCase::callAsFunction):
467 (KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
468 (KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
469 (KJS::StringProtoFuncLocaleCompare::callAsFunction):
470 (KJS::StringProtoFuncBig::callAsFunction):
471 (KJS::StringProtoFuncSmall::callAsFunction):
472 (KJS::StringProtoFuncBlink::callAsFunction):
473 (KJS::StringProtoFuncBold::callAsFunction):
474 (KJS::StringProtoFuncFixed::callAsFunction):
475 (KJS::StringProtoFuncItalics::callAsFunction):
476 (KJS::StringProtoFuncStrike::callAsFunction):
477 (KJS::StringProtoFuncSub::callAsFunction):
478 (KJS::StringProtoFuncSup::callAsFunction):
479 (KJS::StringProtoFuncFontcolor::callAsFunction):
480 (KJS::StringProtoFuncFontsize::callAsFunction):
481 (KJS::StringProtoFuncAnchor::callAsFunction):
482 (KJS::StringProtoFuncLink::callAsFunction):
483 * kjs/string_object.h:
485 2007-11-08 Adam Roben <aroben@apple.com>
489 Reviewed by Sam and Ada.
491 * wtf/MathExtras.h: Get rid of a circular #include dependency to fix
494 2007-11-08 Adam Roben <aroben@apple.com>
496 Fix a precedence warning on Windows
499 (KJS::JSImmediate::toBoolean):
501 2007-11-08 Mark Rowe <mrowe@apple.com>
503 Build fix for JavaScriptGlue.
505 * wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
507 2007-11-08 Darin Adler <darin@apple.com>
511 * kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
513 2007-11-08 Oliver Hunt <oliver@apple.com>
517 Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
519 Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
520 we should now have faster array access, faster immediate to double conversion, and the
521 potential to further improve bitwise operators in future.
523 This also removes the need for unions to avoid strict aliasing problems when extracting
524 a value from immediates.
528 (KJS::JSImmediate::trueImmediate):
529 (KJS::JSImmediate::falseImmediate):
530 (KJS::JSImmediate::undefinedImmediate):
531 (KJS::JSImmediate::nullImmediate):
532 (KJS::JSImmediate::toBoolean):
536 2007-11-07 Eric Seidel <eric@webkit.org>
538 Reviewed by Darin and Oliver.
540 Add evaluateToNumber parallel evaluation tree to speed up number operations.
541 Make ImmediateNumberNode a subclass of NumberNode.
542 Share evaluate logic between evaluate and evaluateToNumber using inline functions
543 There is still a lot of improvement to be made here.
545 SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
546 Given the huge win that this prepares us for with simple type inferencing I see the small
547 regression in base64 being worth the substantial overall improvement.
551 (KJS::Node::evaluateToNumber):
552 (KJS::NumberNode::evaluate):
553 (KJS::NumberNode::evaluateToNumber):
554 (KJS::StringNode::evaluateToNumber):
555 (KJS::LocalVarAccessNode::inlineEvaluate):
556 (KJS::LocalVarAccessNode::evaluate):
557 (KJS::LocalVarAccessNode::evaluateToNumber):
558 (KJS::BracketAccessorNode::inlineEvaluate):
559 (KJS::BracketAccessorNode::evaluate):
560 (KJS::BracketAccessorNode::evaluateToNumber):
561 (KJS::NegateNode::evaluate):
562 (KJS::NegateNode::evaluateToNumber):
563 (KJS::MultNode::inlineEvaluateToNumber):
564 (KJS::MultNode::evaluate):
565 (KJS::MultNode::evaluateToNumber):
566 (KJS::DivNode::inlineEvaluateToNumber):
567 (KJS::DivNode::evaluate):
568 (KJS::DivNode::evaluateToNumber):
569 (KJS::ModNode::inlineEvaluateToNumber):
570 (KJS::ModNode::evaluate):
571 (KJS::ModNode::evaluateToNumber):
572 (KJS::throwOutOfMemoryErrorToNumber):
573 (KJS::addSlowCaseToNumber):
576 (KJS::AddNode::evaluateToNumber):
577 (KJS::SubNode::inlineEvaluateToNumber):
578 (KJS::SubNode::evaluate):
579 (KJS::SubNode::evaluateToNumber):
580 (KJS::valueForReadModifyAssignment):
581 (KJS::ReadModifyLocalVarNode::evaluate):
582 (KJS::ReadModifyResolveNode::evaluate):
583 (KJS::ReadModifyDotNode::evaluate):
584 (KJS::ReadModifyBracketNode::evaluate):
588 (KJS::ImmediateNumberNode::):
589 (KJS::AddNode::precedence):
590 * kjs/nodes2string.cpp:
591 (KJS::NumberNode::streamTo):
593 2007-11-07 Mark Rowe <mrowe@apple.com>
597 Fix up initialization after being mangled in r27572, and remove the
598 ternary expression as extraCost will always be zero for the numeric
602 (KJS::Collector::heapAllocate):
604 2007-11-07 Mark Rowe <mrowe@apple.com>
608 * kjs/regexp_object.cpp:
610 2007-11-07 Geoffrey Garen <ggaren@apple.com>
612 Reviewed by Beth Dakin.
614 Eliminated a bogus (though compiled-out) branch in the collector.
617 (KJS::Collector::heapAllocate):
619 2007-11-06 Geoffrey Garen <ggaren@apple.com>
621 Reviewed by Darin Adler.
623 Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861
624 5.8% of string-validate-input.js is spent creating RegExpImps
626 Put RegExpImp properties into a static hashtable to avoid a slew of
627 PropertyMap churn when creating a RegExpImp.
629 Factored important bits of regular expression implementation out of
630 RegExpImp (the JS object) and into RegExp (the PCRE wrapper class),
631 making RegExp a ref-counted class. (This will help later.)
633 Removed PCRE_POSIX support because I didn't quite know how to test it
634 and keep it working with these changes.
636 1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
638 * kjs/regexp.h: A few interface changes:
639 1. Renamed "subpatterns()" => "numSubpatterns()"
640 2. Made flag enumeration private and replaced it with public getters for
642 3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
643 4. Made RegExp take a string of flags instead of an int, eliminating
644 duplicated flag parsing code elsewhere.
646 * kjs/regexp_object.cpp:
647 (KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile:
648 - Fixed a bug where compile(undefined) would throw an exception.
649 - Removed some now-redundant code.
650 - Used RegExp sharing to eliminate an allocation and a bunch of
651 PropertyMap thrash. (Not a big win since compile is a deprecated
652 function. I mainly did this to test the plubming.)
654 2007-11-07 Simon Hausmann <hausmann@kde.org>
656 Reviewed by nobody, Qt/Windows build fix.
658 JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
659 testkjs.pro, too, where it's included from.
663 2007-11-07 Simon Hausmann <shausman@trolltech.com>
667 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.
669 * JavaScriptCore.pri:
672 2007-11-07 Lars Knoll <lars@trolltech.com>
678 Pretty embarrassing bug. Has the potential to fix quite a few test failures.
680 * wtf/unicode/qt4/UnicodeQt4.h:
681 (WTF::Unicode::umemcasecmp):
683 2007-11-06 Maciej Stachowiak <mjs@apple.com>
687 - only collect when the heap is full, unless we have lots of extra cost garbage
689 1.1% SunSpider speedup.
691 This shouldn't hit memory use much since the extra space in those
692 blocks hangs around either way.
695 (KJS::Collector::heapAllocate):
696 (KJS::Collector::collect): Fix logic error that reversed the sense of collect's
699 2007-11-06 Oliver Hunt <oliver@apple.com>
703 Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
705 We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
706 'for (...; ...; ++<var>) ...'.
709 (KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
710 (KJS::PostIncLocalVarNode::evaluate):
711 (KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
712 (KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
713 (KJS::PostDecLocalVarNode::evaluate):
714 (KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
716 (KJS::PrePostResolveNode::):
717 (KJS::PostIncResolveNode::):
718 (KJS::PostIncLocalVarNode::):
719 (KJS::PostDecResolveNode::):
720 (KJS::PostDecLocalVarNode::):
721 (KJS::PreIncResolveNode::):
722 (KJS::PreDecResolveNode::):
723 (KJS::ForNode::ForNode):
725 2007-11-06 Eric Seidel <eric@webkit.org>
729 This fixes a regressed layout test for string + object
731 SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
734 (KJS::add): remove erroneous "fast path" for string + *
736 2007-11-06 Geoffrey Garen <ggaren@apple.com>
738 Reviewed by Eric Seidel.
740 Added toJSNumber, a fast path for converting a JSValue to a JS number,
741 and deployed it in postfix expressions. In the fast case this
742 eliminates a call to jsNumber.
744 0.4% speedup on SunSpider.
748 (KJS::PostIncResolveNode::evaluate):
749 (KJS::PostIncLocalVarNode::evaluate):
750 (KJS::PostDecResolveNode::evaluate):
751 (KJS::PostDecLocalVarNode::evaluate):
752 (KJS::PostIncBracketNode::evaluate):
753 (KJS::PostDecBracketNode::evaluate):
754 (KJS::PostIncDotNode::evaluate):
755 (KJS::PostDecDotNode::evaluate):
756 (KJS::UnaryPlusNode::evaluate):
758 (KJS::JSValue::toJSNumber):
760 2007-11-06 Darin Adler <darin@apple.com>
764 - http://bugs.webkit.org/show_bug.cgi?id=15846
765 REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
767 There was a mistake in the algorithm used to find an empty slot in the property
768 map entries vector; when we were putting in a new property value and not overwriting
769 an existing deleted sentinel, we would enlarge the entries vector, but would not
770 overwrite the stale data that's in the new part. It was easy to pin this down by
771 turning on property map consistency checks -- I never would have landed with this
772 bug if I had run the regression tests once with consistency checks on!
774 * kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
775 foundDeletedElement is false to always use the item at the end of the entries vector.
776 Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
778 2007-11-06 Oliver Hunt <oliver@apple.com>
782 Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
787 2007-11-06 Oliver Hunt <oliver@apple.com>
791 Replace boolean comparisons in AddNode with mask
792 comparisons for a 0.2% improvement in sunspider.
794 * JavaScriptCore.xcodeproj/project.pbxproj:
798 2007-11-06 Eric Seidel <eric@webkit.org>
802 SunSpider claims this is a 1.1% speedup.
805 (KJS::throwOutOfMemoryError): Added, non inline.
806 (KJS::addSlowCase): renamed from add(), non inline.
807 (KJS::add): add fast path for String + String, Number + Number and String + *
809 2007-11-06 Eric Seidel <eric@webkit.org>
813 Avoid more UString creation.
815 SunSpider claims this is a 0.4% speedup.
817 * kjs/regexp_object.cpp:
818 (KJS::RegExpObjectImp::construct): use UString::find(UChar)
820 2007-11-05 Mark Rowe <mrowe@apple.com>
824 * kjs/array_object.cpp:
825 (KJS::ArrayProtoFunc::callAsFunction):
827 2007-11-05 Adam Roben <aroben@apple.com>
833 2007-11-05 Mark Rowe <mrowe@apple.com>
835 Build fix. Add missing #include.
837 * kjs/operations.cpp:
839 2007-11-05 Eric Seidel <eric@webkit.org>
843 Remove another call to toString(exec)
845 SunSpider claims this is a 0.5% speedup.
847 * kjs/operations.cpp:
848 (KJS::equal): remove another toString
850 2007-11-05 Eric Seidel <eric@webkit.org>
852 * kjs/operations.cpp:
853 (KJS::equal): correct broken change.
855 2007-11-05 Eric Seidel <eric@webkit.org>
859 Remove one more call to toString(exec).
861 SunSpider claims this is a 0.7% speedup.
863 * kjs/operations.cpp:
864 (KJS::equal): remove a call to toString()
866 2007-11-05 Mark Rowe <mrowe@apple.com>
872 2007-11-05 Mark Rowe <mrowe@apple.com>
878 2007-11-05 Geoffrey Garen <ggaren@apple.com>
880 Touched a file to test my new HTTP access.
882 * kjs/scope_chain.cpp:
884 2007-11-05 Alp Toker <alp@atoker.com>
886 Unreviewed build fix for qmake-based ports.
888 Someone with a better understanding of qmake still needs to sort out
889 the INCLUDEPATH/DEPENDPATH mess.
891 * JavaScriptCore.pri:
893 2007-11-05 Geoffrey Garen <ggaren@apple.com>
895 Reviewed by Darin Adler.
897 http://bugs.webkit.org/show_bug.cgi?id=15835
899 Switched List implementation from a custom heap allocator to an inline
900 Vector, for a disappointing .5% SunSpider speedup.
902 Also renamed List::slice to List::getSlice because "get" is the
903 conventional prefix for functions returning a value through an out
906 * kjs/array_object.cpp:
907 (KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
908 calls and memory accesses.
910 * kjs/bool_object.cpp:
911 (BooleanObjectImp::construct): Removed questionable use of iterator.
914 * kjs/list.h: New List class, implemented in terms of Vector. Two
915 interesting differences:
916 1. The inline capacity is 8, not 5. Many of the Lists constructed
917 during a SunSpider run are larger than 5; almost none are larger
920 2. The growth factor is 4, not 2. Since we can guarantee that Lists
921 aren't long-lived, we can grow them more aggressively, to avoid
924 * kjs/regexp_object.cpp:
925 (RegExpObjectImp::construct): Removed redundant function calls.
927 * kjs/string_object.cpp:
928 (KJS::StringObjectImp::construct): Removed questionable use of iterator.
931 (WTF::::uncheckedAppend): Added a fast, unchecked version of append.
933 2007-11-05 Mark Rowe <mrowe@apple.com>
935 Reviewed by Alp Toker.
937 Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
939 * JavaScriptCore.pri:
942 2007-11-04 Darin Adler <darin@apple.com>
946 - http://bugs.webkit.org/show_bug.cgi?id=15826
947 optimize opcode loop and case insensitive ASCII compares for a 30% speedup
949 SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
951 * pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
953 * pcre/pcre_compile.c:
954 (find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
955 added OP_NOT since there was no reason it should not be in here.
956 (could_be_empty_branch): Ditto.
957 (compile_branch): Streamlined all the single-character cases; there was a bit of
958 duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
959 But in particular, compile to those opcodes when the single character match is
961 (find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
963 * pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
964 the matchframe, after I discovered that none of them needed to be saved and restored
965 across recursive match calls. Also eliminated the ignored result field from the
966 matchframe, since I discovered that rrc ("recursive result code") was already the
967 exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
968 statement of the switch instead of doing them before the switch. This removes a
969 branch from each iteration of the opcode interpreter, just as removal of "op"
970 removed at least one store from each iteration. Last, but not least, add the
971 OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
972 surrogate pair and the letter case can be handled efficiently.
974 2007-11-04 Darin Adler <darin@apple.com>
976 * pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
978 2007-11-03 Darin Adler <darin@apple.com>
980 - fix non-Mac builds; remove some more unused PCRE stuff
982 * pcre/pcre_compile.c:
983 (compile_branch): Removed branch chain and some unused ESC values.
984 (compile_regex): Ditto.
985 (jsRegExpCompile): Ditto.
987 (match): Removed unused branch targets. Don't use macros any more.
988 (jsRegExpExecute): More of the same.
990 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
991 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
992 * pcre/pcre.pri: Ditto.
994 * pcre/MERGING: Removed.
995 * pcre/pcre_fullinfo.c: Removed.
996 * pcre/pcre_get.c: Removed.
997 * pcre/pcre_internal.h:
998 * pcre/ucp.h: Removed.
1000 2007-11-03 Darin Adler <darin@apple.com>
1004 - http://bugs.webkit.org/show_bug.cgi?id=15821
1005 remove unused PCRE features for speed
1007 A first step toward removing the PCRE features we don't use.
1008 This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
1009 the SunSpider regular expression test.
1011 Replaced the public interface with one that doesn't use the
1012 name PCRE. Removed code we don't need for JavaScript and various
1013 configurations we don't use. This is in preparation for still
1014 more changes in the future. We'll probably switch to C++ and
1015 make some even more significant changes to the regexp engine
1016 to get some additional speed.
1018 There's probably additional unused stuff that I haven't
1021 This does mean that our PCRE is now a fork, but I think that's
1022 not really a big deal.
1024 * JavaScriptCore.exp: Remove the 5 old entry points and add
1025 the 3 new entry points for WebCore's direct use of the regular
1028 * kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
1029 its sense and now there's a USE(POSIX_REGEX) instead, which should
1030 probably not be set by anyone. Maybe later we'll just get rid of it
1035 (KJS::RegExp::RegExp): Switch to new jsRegExp function names and
1036 defines. Cut down on the number of functions used.
1037 (KJS::RegExp::~RegExp): Ditto.
1038 (KJS::RegExp::match): Ditto.
1040 * pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
1043 * pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
1044 size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
1045 POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
1046 and JAVASCRIPT. These are all no longer configurable in our copy
1049 * pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
1050 version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
1051 the include of <stdlib.h>, and most of the constants and
1052 functions defined in this header. Changed the naming scheme to
1053 use a JSRegExp prefix rather than a pcre prefix. In the future,
1054 we'll probably change this to be a C++ header.
1056 * pcre/pcre_compile.c: Removed all unused code branches,
1057 including many whole functions and various byte codes.
1058 Kept changes outside of removal to a minimum.
1060 (first_significant_code):
1063 (could_be_empty_branch):
1068 (find_firstassertedchar):
1069 (jsRegExpCompile): Renamed from pcre_compile2 and changed the
1070 parameters around a bit.
1071 (jsRegExpFree): Added.
1073 * pcre/pcre_exec.c: Removed many unused opcodes and variables.
1074 Also started tearing down the NO_RECURSE mechanism since it's
1075 now the default. In some cases there were things in the explicit
1076 frame that could be turned into plain old local variables and
1077 other small like optimizations.
1080 (match): Changed parameters quite a bit since it's now not used
1082 (jsRegExpExecute): Renamed from pcre_exec.
1084 * pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
1085 PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
1086 PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
1087 PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
1088 _pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
1089 and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
1091 * pcre/pcre_maketables.c: Changed to only compile in dftables.
1092 Also got rid of many of the tables that we don't use.
1094 * pcre/pcre_tables.c: Removed the unused Unicode property tables.
1096 * pcre/pcre_ucp_searchfuncs.c: Removed everything except for
1097 _pcre_ucp_othercase.
1099 * pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
1100 for classes based on Unicode properties.
1102 * wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
1103 to eliminate this completely, but we need the regular expression
1104 code to be C++ first.
1106 * pcre/pcre_fullinfo.c:
1109 Files that are no longer needed. I didn't remove them with this
1110 check-in, because I didn't want to modify all the project files.
1112 2007-11-03 Maciej Stachowiak <mjs@apple.com>
1116 - remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
1118 It turns out that doing this check costs more than it saves.
1120 * kjs/JSImmediate.h:
1121 (KJS::JSImmediate::fromDouble):
1123 2007-11-03 Sam Weinig <sam@webkit.org>
1127 Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
1128 The variable had been kept around for binary compatibility, but since nothing
1129 else is there is no point in continuing to keep it around.
1131 * API/JSCallbackConstructor.cpp:
1133 * API/JSCallbackFunction.cpp:
1135 * API/JSCallbackObject.cpp:
1137 * bindings/objc/objc_runtime.mm:
1138 * bindings/runtime_array.cpp:
1139 * bindings/runtime_object.cpp:
1140 * kjs/array_instance.cpp:
1142 * kjs/array_object.cpp:
1144 * kjs/bool_object.cpp:
1145 * kjs/date_object.cpp:
1147 * kjs/error_object.cpp:
1153 * kjs/math_object.cpp:
1154 * kjs/number_object.cpp:
1156 * kjs/regexp_object.cpp:
1157 * kjs/string_object.cpp:
1160 2007-11-03 Kevin McCullough <kmccullough@apple.com>
1162 - Updated testkjs results to make the build bots green until we
1163 can fix the tests that are failing. The new failures are in DST.
1165 * tests/mozilla/expected.html:
1167 2007-11-03 Maciej Stachowiak <mjs@apple.com>
1171 - don't print the var twice for ForInNodes with a var declaration
1173 * kjs/nodes2string.cpp:
1174 (KJS::ForInNode::streamTo):
1176 2007-11-03 Darin Adler <darin@apple.com>
1178 * pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
1179 C-incompatible declaration.
1181 2007-11-03 Mark Rowe <mrowe@apple.com>
1185 * kjs/nodes.cpp: Add missing include.
1187 2007-11-03 Darin Adler <darin@apple.com>
1191 - fix http://bugs.webkit.org/show_bug.cgi?id=15814
1192 <rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
1194 These changes cause us to match the JavaScript specification and pass the
1195 fast/js/kde/encode_decode_uri.html test.
1197 * kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
1198 new strict mode, throwing an exception if there are malformed UTF-16 surrogate
1201 * kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
1203 (KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
1204 those might be illegal in some sense, they aren't supposed to get any special
1205 handling in the place where this function is currently used.
1206 (KJS::UString::UTF8String): Added the strictness.
1208 2007-11-03 Darin Adler <darin@apple.com>
1212 - http://bugs.webkit.org/show_bug.cgi?id=15812
1213 some JavaScript tests (from the Mozilla test suite) are failing
1215 Two or three fixes get 7 more of the Mozilla tests passing.
1216 This gets us down from 61 failing tests to 54.
1218 * kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
1219 Made this inline and gave it a more specific type. Some day we should
1220 probably do that for all of these -- might even get a bit of a speed
1222 * kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
1223 inline in the header.
1225 * kjs/regexp_object.h:
1226 * kjs/regexp_object.cpp:
1227 (KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
1228 switch statement into the RegExpImp object, so they can be shared with
1229 RegExpImp::callAsFunction.
1230 (KJS::RegExpImp::match): Added. Common code used by both test and exec.
1231 (KJS::RegExpImp::test): Added.
1232 (KJS::RegExpImp::exec): Added.
1233 (KJS::RegExpImp::implementsCall): Added.
1234 (KJS::RegExpImp::callAsFunction): Added.
1235 (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
1236 lastInput to null rather than empty string -- we take advantage of the
1237 difference in RegExpImp::match.
1238 (KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
1239 just to get at a field like this.
1241 * pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
1242 the JavaScript specification. If there are not 4 hex digits after the \u,
1243 then it's processed as if it wasn't an escape sequence at all.
1245 * pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
1246 for JavaScript (4 specific Unicode values).
1248 (match): Changed all call sites to use IS_NEWLINE.
1251 * tests/mozilla/expected.html: Updated to expect 7 more successful tests.
1253 2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
1255 Sort files(...); sections of Xcode project files.
1257 Rubber-stamped by Darin.
1259 * JavaScriptCore.xcodeproj/project.pbxproj:
1261 2007-11-03 Maciej Stachowiak <mjs@apple.com>
1265 - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
1269 (KJS::VarDeclNode::optimizeVariableAccess):
1270 (KJS::VarDeclNode::getDeclarations):
1271 (KJS::VarDeclNode::handleSlowCase):
1272 (KJS::VarDeclNode::evaluateSingle):
1273 (KJS::VarDeclNode::evaluate):
1274 (KJS::VarStatementNode::execute):
1276 (KJS::VarDeclNode::):
1277 (KJS::VarStatementNode::):
1278 * kjs/nodes2string.cpp:
1279 (KJS::VarDeclNode::streamTo):
1281 2007-11-03 Alexey Proskuryakov <ap@webkit.org>
1285 http://bugs.webkit.org/show_bug.cgi?id=15800
1286 REGRESSION (r27303): RegExp leaks
1288 * kjs/regexp_object.h:
1289 (KJS::RegExpImp::setRegExp):
1290 (KJS::RegExpImp::regExp):
1291 (KJS::RegExpImp::classInfo):
1292 * kjs/regexp_object.cpp:
1293 (RegExpImp::RegExpImp):
1294 (RegExpImp::~RegExpImp):
1295 Renamed reg member variable to m_regExp, changed it to use OwnPtr.
1297 2007-11-02 Maciej Stachowiak <mjs@apple.com>
1301 - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
1305 (KJS::statementListPushFIFO):
1306 (KJS::statementListGetDeclarations):
1307 (KJS::statementListInitializeDeclarationStacks):
1308 (KJS::statementListInitializeVariableAccessStack):
1309 (KJS::statementListExecute):
1310 (KJS::BlockNode::BlockNode):
1311 (KJS::FunctionBodyNode::FunctionBodyNode):
1312 (KJS::ProgramNode::ProgramNode):
1314 (KJS::CaseClauseNode::):
1316 2007-11-02 Darin Adler <darin@apple.com>
1320 - http://bugs.webkit.org/show_bug.cgi?id=15791
1321 change property map data structure for less memory use, better speed
1323 The property map now has an array of indices and a separate array of
1324 property map entries. This slightly slows down lookup because of a second
1325 memory acess, but makes property maps smaller and faster to iterate in
1326 functions like mark().
1328 SunSpider says this is 1.2% faster, although it makes the bitwise-end test
1329 more than 10% slower. To fix that we'll need to optimize global variable lookup.
1331 * kjs/property_map.cpp:
1332 (KJS::PropertyMapEntry::PropertyMapEntry):
1333 (KJS::PropertyMapHashTable::entries):
1334 (KJS::PropertyMapHashTable::allocationSize):
1335 (KJS::SavedProperties::SavedProperties):
1336 (KJS::SavedProperties::~SavedProperties):
1337 (KJS::PropertyMap::checkConsistency):
1338 (KJS::PropertyMap::~PropertyMap):
1339 (KJS::PropertyMap::clear):
1340 (KJS::PropertyMap::get):
1341 (KJS::PropertyMap::getLocation):
1342 (KJS::PropertyMap::put):
1343 (KJS::PropertyMap::insert):
1344 (KJS::PropertyMap::createTable):
1345 (KJS::PropertyMap::rehash):
1346 (KJS::PropertyMap::remove):
1347 (KJS::PropertyMap::mark):
1348 (KJS::comparePropertyMapEntryIndices):
1349 (KJS::PropertyMap::containsGettersOrSetters):
1350 (KJS::PropertyMap::getEnumerablePropertyNames):
1351 (KJS::PropertyMap::save):
1352 (KJS::PropertyMap::restore):
1353 * kjs/property_map.h:
1355 2007-11-02 Darin Adler <darin@apple.com>
1359 - http://bugs.webkit.org/show_bug.cgi?id=15807
1360 HashMap needs a take() function that combines get and remove
1362 * wtf/HashMap.h: Added take function. Simplistic implementation for now,
1363 but still does only one hash table lookup.
1365 * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
1366 a find followed by a remove.
1368 2007-11-02 David Carson <dacarson@gmail.com>
1372 Fix compiler warning "warning: suggest parentheses around && within ||"
1373 http://bugs.webkit.org/show_bug.cgi?id=15764
1375 * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
1377 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1379 Reviewed by Maciej Stachowiak.
1381 In preparation for making List a simple stack-allocated Vector:
1383 Removed all instances of List copying and/or assignment, and made List
1384 inherit from Noncopyable.
1386 Functions that used to return a List by copy now take List& out
1389 Layout tests and JS tests pass.
1392 (KJS::List::slice): Replaced copyTail with a more generic slice
1393 alternative. (JavaScriptCore only calls slice(1), but WebCore calls
1396 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1398 Reviewed by Maciej Stachowiak.
1400 Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
1401 REGRESSION(r27344): Crash on load at finance.yahoo.com
1403 Reverted a small portion of my last check-in. (The speedup and the List
1404 removal are still there, though.)
1406 ActivationImp needs to hold a pointer to its function, and mark that
1407 pointer (rather than accessing its function through its ExecState, and
1408 counting on the active scope to mark its function) because a closure
1409 can cause an ActivationImp to outlive its ExecState along with any
1412 * kjs/ExecState.cpp:
1413 (KJS::ExecState::ExecState):
1415 (KJS::FunctionImp::~FunctionImp):
1416 (KJS::ActivationImp::ActivationImp):
1418 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
1420 Also made HashTable a little more crash-happy in debug builds, so
1421 problems like this will show up earlier:
1424 (WTF::HashTable::~HashTable):
1426 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1428 Reviewed by Adam Roben.
1430 Addressed some of Darin's review comments.
1432 Used perl -p, which is the shorthand while(<>) {}.
1434 Made sure not to suppress bison's output.
1436 Added line to removed bison_out.txt, since this script removes other
1437 intermediate files, too.
1439 * DerivedSources.make:
1441 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1443 Reviewed by Oliver Hunt.
1445 Removed List from ActivationImp, in preparation for making all lists
1450 1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
1452 * kjs/ExecState.cpp:
1453 (KJS::ExecState::ExecState):
1454 (KJS::ExecState::~ExecState):
1456 (KJS::ActivationImp::ActivationImp):
1457 (KJS::ActivationImp::createArgumentsObject):
1459 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
1461 2007-11-01 Adam Roben <aroben@apple.com>
1463 Use jsNumberCell instead of jsNumber when converting double constants to JSValues
1465 This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
1466 ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
1468 It also gets rid of an MSVC warning that we previously had to silence.
1472 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
1473 back on the "overflow in constant arithmetic" warning.
1474 * kjs/number_object.cpp:
1475 (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
1478 2007-10-31 Adam Roben <aroben@apple.com>
1484 2007-10-31 Maciej Stachowiak <mjs@apple.com>
1488 - shave some cycles off of local storage access for a 1% SunSpider speedup
1490 Keep the LocalStorage pointer in the ExecState, instead of getting
1491 it from the ActivationImp all the time.
1493 * kjs/ExecState.cpp:
1494 (KJS::ExecState::updateLocalStorage):
1496 (KJS::ExecState::localStorage):
1498 (KJS::LocalVarAccessNode::evaluate):
1499 (KJS::LocalVarFunctionCallNode::evaluate):
1500 (KJS::PostIncLocalVarNode::evaluate):
1501 (KJS::PostDecLocalVarNode::evaluate):
1502 (KJS::LocalVarTypeOfNode::evaluate):
1503 (KJS::PreIncLocalVarNode::evaluate):
1504 (KJS::PreDecLocalVarNode::evaluate):
1505 (KJS::ReadModifyLocalVarNode::evaluate):
1506 (KJS::AssignLocalVarNode::evaluate):
1507 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
1509 2007-10-31 Adam Roben <aroben@apple.com>
1511 Fix a crash on launch due to a static initializer race
1513 We now use fast inline assembler spinlocks which can be statically
1514 initialized at compile time.
1516 As a side benefit, this speeds up SunSpider by 0.4%.
1520 * wtf/FastMalloc.cpp:
1522 (TCMalloc_SpinLock::Lock):
1523 (TCMalloc_SpinLock::Unlock):
1524 (TCMalloc_SlowLock):
1525 * wtf/TCSystemAlloc.cpp:
1527 2007-10-31 Kevin McCullough <kmccullough@apple.com>
1531 - Corrected spelling.
1535 2007-10-31 Mark Rowe <mrowe@apple.com>
1537 Further Gtk build fixage.
1539 * kjs/regexp_object.cpp:
1541 2007-10-31 Mark Rowe <mrowe@apple.com>
1547 2007-10-31 Darin Adler <darin@apple.com>
1551 - fix http://bugs.webkit.org/show_bug.cgi?id=15749
1552 RegExp/RegExpObjectImp cause needless UString creation
1554 Speeds things up 0.4% according to SunSpider.
1556 * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
1557 because this library doesn't use the real PCRE -- it uses its
1558 own PCRE that works on UTF-16.
1560 * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
1561 Use Noncopyable. Change the return value of match.
1563 (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
1564 (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
1565 (KJS::RegExp::match): Change to return the position as an int and the
1566 ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
1568 * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
1569 require a result string.
1570 * kjs/regexp_object.cpp:
1571 (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
1572 (RegExpObjectImp::performMatch): Change so it doesn't return a string.
1573 (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
1574 the main result with the backreferences; now it doesn't need to take
1576 (RegExpObjectImp::getBackref): Minor tweaks.
1577 (RegExpObjectImp::getLastParen): Ditto.
1578 (RegExpObjectImp::getLeftContext): Ditto.
1579 (RegExpObjectImp::getRightContext): Ditto.
1580 (RegExpObjectImp::getValueProperty): Change LastMatch case to call
1581 getBackref(0) so we don't need a separate getLastMatch function.
1583 * kjs/string_object.cpp:
1584 (KJS::replace): Update to use new performMatch, including merging the
1585 matched string section with the other substrings.
1586 (KJS::StringProtoFunc::callAsFunction): Update functions to use the
1587 new performMatch and match. Also change to use OwnArrayPtr.
1589 2007-10-31 Oliver Hunt <oliver@apple.com>
1591 * kjs/nodes.h: include OwnPtr.h
1593 2007-10-31 Oliver Hunt <oliver@apple.com>
1597 Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
1601 (KJS::statementListPushFIFO):
1602 (KJS::statementListGetDeclarations):
1603 (KJS::statementListInitializeDeclarationStacks):
1604 (KJS::statementListInitializeVariableAccessStack):
1605 (KJS::statementListExecute):
1606 (KJS::BlockNode::optimizeVariableAccess):
1607 (KJS::BlockNode::BlockNode):
1608 (KJS::BlockNode::getDeclarations):
1609 (KJS::BlockNode::execute):
1610 (KJS::CaseClauseNode::optimizeVariableAccess):
1611 (KJS::CaseClauseNode::getDeclarations):
1612 (KJS::CaseClauseNode::evalStatements):
1613 (KJS::FunctionBodyNode::initializeDeclarationStacks):
1614 (KJS::FunctionBodyNode::optimizeVariableAccess):
1616 * kjs/nodes2string.cpp:
1617 (KJS::statementListStreamTo):
1618 (KJS::BlockNode::streamTo):
1619 (KJS::CaseClauseNode::streamTo):
1621 2007-10-30 Mark Rowe <mrowe@apple.com>
1623 * kjs/property_map.cpp: Added a missing using directive to fix the build
1624 for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
1626 2007-10-31 Maciej Stachowiak <mjs@apple.com>
1628 * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
1631 2007-10-31 Alexey Proskuryakov <ap@webkit.org>
1635 http://bugs.webkit.org/show_bug.cgi?id=11001
1636 WebKit doesn't support RegExp.compile method
1638 Test: fast/js/regexp-compile.html
1640 * kjs/regexp_object.cpp:
1641 (RegExpPrototype::RegExpPrototype):
1642 (RegExpProtoFunc::callAsFunction):
1643 * kjs/regexp_object.h:
1644 (KJS::RegExpProtoFunc::):
1645 Added RegExp.compile.
1647 * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
1649 2007-10-31 Maciej Stachowiak <mjs@apple.com>
1653 - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
1655 Integer divide sucks. Fortunately, a bunch of shifts and XORs
1656 biased towards the high bits is sufficient to provide a good
1657 double hash. Besides the SunSpider win, I used the dump statistics
1658 mode for both to verify that collisions did not increase and that
1659 the longest collision chain is not any longer.
1661 * kjs/property_map.cpp:
1663 (KJS::PropertyMap::get):
1664 (KJS::PropertyMap::getLocation):
1665 (KJS::PropertyMap::put):
1666 (KJS::PropertyMap::insert):
1667 (KJS::PropertyMap::remove):
1668 (KJS::PropertyMap::checkConsistency):
1672 (WTF::::lookupForWriting):
1673 (WTF::::fullLookupForWriting):
1676 2007-10-30 Adam Roben <aroben@apple.com>
1678 * kjs/collector.h: Make HeapType public so it can be used for non-member
1679 things like the HeapConstants struct template. Fixes the build on Windows.
1681 2007-10-30 Adam Roben <aroben@apple.com>
1683 Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
1685 Speeds up SunSpider by 0.4%.
1687 Reviewed by Steve and Maciej.
1689 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
1690 a warning during LTCG in release builds about double -> float
1692 * wtf/AlwaysInline.h:
1695 2007-10-30 Adam Roben <aroben@apple.com>
1697 Use GetCurrentThreadId instead of pthread_self in FastMalloc
1699 Speeds up SunSpider by 0.3%.
1703 * wtf/FastMalloc.cpp:
1704 (WTF::TCMalloc_ThreadCache::InitTSD):
1705 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
1707 2007-10-30 Adam Roben <aroben@apple.com>
1709 Switch to a Win32 critical section implementation of spinlocks
1711 Speeds up SunSpider by 0.4%.
1715 * wtf/FastMalloc.cpp:
1717 (TCMalloc_SpinLock::TCMalloc_SpinLock):
1718 (TCMalloc_SpinLock::Init):
1719 (TCMalloc_SpinLock::Finalize):
1720 (TCMalloc_SpinLock::Lock):
1721 (TCMalloc_SpinLock::Unlock):
1722 * wtf/TCSystemAlloc.cpp:
1724 2007-10-30 Adam Roben <aroben@apple.com>
1726 Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
1728 http://bugs.webkit.org/show_bug.cgi?id=15586
1730 Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
1732 Use Win32 TLS functions instead of __declspec(thread), which breaks
1737 * wtf/FastMalloc.cpp:
1738 (WTF::getThreadHeap):
1739 (WTF::TCMalloc_ThreadCache::InitModule):
1741 2007-10-30 Maciej Stachowiak <mjs@apple.com>
1745 - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
1746 http://bugs.webkit.org/show_bug.cgi?id=15772
1748 We do this by using a single mark bit per two number cells, and
1751 Besides being an 0.5% win overall, this is a 7.1% win on morph.
1753 * kjs/collector.cpp:
1755 (KJS::Collector::heapAllocate):
1756 (KJS::Collector::markStackObjectsConservatively):
1757 (KJS::Collector::sweep):
1759 (KJS::SmallCollectorCell::):
1761 2007-10-30 Geoffrey Garen <ggaren@apple.com>
1763 Reviewed by Adam Roben, Sam Weinig.
1765 Made conflicts in grammar.y a persistent build failure.
1767 * DerivedSources.make:
1769 2007-10-30 Kevin McCullough <kmccullough@apple.com>
1771 Reviewed by Adam and Geoff.
1773 - Added a new cast so all the casts are in the same place.
1778 2007-10-30 Geoffrey Garen <ggaren@apple.com>
1780 Reviewed by Darin Adler.
1782 Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
1786 ecma_2/Statements/dowhile-001.js
1787 ecma_2/Statements/dowhile-002.js
1788 ecma_2/Statements/dowhile-003.js
1789 ecma_2/Statements/dowhile-004.js
1790 ecma_2/Statements/dowhile-005.js
1791 ecma_2/Statements/dowhile-006.js
1792 ecma_2/Statements/dowhile-007.js
1793 js1_2/statements/do_while.js
1795 and layout tests, including
1797 do-while-expression-value.html
1798 do-while-semicolon.html
1799 do-while-without-semicolon.html
1803 * kjs/grammar.y: Use the explicit "error" production, as we do with other
1804 automatic semicolon insertions, to disambiguate "do { } while();" from
1805 "do { } while()" followed by ";" (the empty statement).
1807 2007-10-29 Oliver Hunt <oliver@apple.com>
1811 Debranching remaining assignment nodes, and miscellaneous cleanup
1813 Split read-modify code paths out of AssignBracketNode and AssignDotNode
1814 Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
1815 and ReadModifyResolveNode evaluate methods
1817 Leads to a 1% gain in SunSpider.
1821 (KJS::ReadModifyLocalVarNode::evaluate):
1822 (KJS::ReadModifyResolveNode::evaluate):
1823 (KJS::AssignDotNode::evaluate):
1824 (KJS::ReadModifyDotNode::optimizeVariableAccess):
1825 (KJS::ReadModifyDotNode::evaluate):
1826 (KJS::AssignBracketNode::evaluate):
1827 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
1828 (KJS::ReadModifyBracketNode::evaluate):
1830 (KJS::AssignBracketNode::):
1831 (KJS::AssignBracketNode::precedence):
1832 (KJS::AssignDotNode::):
1833 (KJS::AssignDotNode::precedence):
1834 * kjs/nodes2string.cpp:
1835 (KJS::ReadModifyBracketNode::streamTo):
1836 (KJS::AssignBracketNode::streamTo):
1837 (KJS::ReadModifyDotNode::streamTo):
1838 (KJS::AssignDotNode::streamTo):
1840 2007-10-29 Oliver Hunt <oliver@apple.com>
1842 Debranching various Node::evaluate implementations
1846 Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
1847 Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
1849 Gains 1.6% on SunSpider
1851 * JavaScriptCore.xcodeproj/project.pbxproj:
1854 (KJS::PostIncResolveNode::optimizeVariableAccess):
1855 (KJS::PostIncResolveNode::evaluate):
1856 (KJS::PostIncLocalVarNode::evaluate):
1857 (KJS::PostDecResolveNode::optimizeVariableAccess):
1858 (KJS::PostDecResolveNode::evaluate):
1859 (KJS::PostDecLocalVarNode::evaluate):
1860 (KJS::PostIncBracketNode::evaluate):
1861 (KJS::PostDecBracketNode::evaluate):
1862 (KJS::PostIncDotNode::evaluate):
1863 (KJS::PostDecDotNode::evaluate):
1864 (KJS::PreIncResolveNode::optimizeVariableAccess):
1865 (KJS::PreIncLocalVarNode::evaluate):
1866 (KJS::PreIncResolveNode::evaluate):
1867 (KJS::PreDecResolveNode::optimizeVariableAccess):
1868 (KJS::PreDecLocalVarNode::evaluate):
1869 (KJS::PreDecResolveNode::evaluate):
1870 (KJS::PreIncBracketNode::evaluate):
1871 (KJS::PreDecBracketNode::evaluate):
1872 (KJS::PreIncDotNode::evaluate):
1873 (KJS::PreDecDotNode::evaluate):
1874 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1875 (KJS::AssignResolveNode::optimizeVariableAccess):
1876 (KJS::AssignLocalVarNode::evaluate):
1877 (KJS::AssignResolveNode::evaluate):
1879 (KJS::PostDecResolveNode::):
1880 (KJS::PostDecResolveNode::precedence):
1881 (KJS::PostDecLocalVarNode::):
1882 (KJS::PostfixBracketNode::):
1883 (KJS::PostfixBracketNode::precedence):
1884 (KJS::PostIncBracketNode::):
1885 (KJS::PostIncBracketNode::isIncrement):
1886 (KJS::PostDecBracketNode::):
1887 (KJS::PostDecBracketNode::isIncrement):
1888 (KJS::PostfixDotNode::):
1889 (KJS::PostfixDotNode::precedence):
1890 (KJS::PostIncDotNode::):
1891 (KJS::PostIncDotNode::isIncrement):
1892 (KJS::PostDecDotNode::):
1893 (KJS::PreIncResolveNode::):
1894 (KJS::PreDecResolveNode::):
1895 (KJS::PreDecResolveNode::precedence):
1896 (KJS::PreDecLocalVarNode::):
1897 (KJS::PrefixBracketNode::):
1898 (KJS::PrefixBracketNode::precedence):
1899 (KJS::PreIncBracketNode::):
1900 (KJS::PreIncBracketNode::isIncrement):
1901 (KJS::PreDecBracketNode::):
1902 (KJS::PreDecBracketNode::isIncrement):
1903 (KJS::PrefixDotNode::):
1904 (KJS::PrefixDotNode::precedence):
1905 (KJS::PreIncDotNode::):
1906 (KJS::PreIncDotNode::isIncrement):
1907 (KJS::PreDecDotNode::):
1908 (KJS::ReadModifyResolveNode::):
1909 (KJS::ReadModifyLocalVarNode::):
1910 (KJS::AssignResolveNode::):
1911 (KJS::AssignResolveNode::precedence):
1912 * kjs/nodes2string.cpp:
1913 (KJS::PostIncResolveNode::streamTo):
1914 (KJS::PostDecResolveNode::streamTo):
1915 (KJS::PostfixBracketNode::streamTo):
1916 (KJS::PostfixDotNode::streamTo):
1917 (KJS::PreIncResolveNode::streamTo):
1918 (KJS::PreDecResolveNode::streamTo):
1919 (KJS::ReadModifyResolveNode::streamTo):
1920 (KJS::AssignResolveNode::streamTo):
1922 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1924 Not reviewed, build fix.
1926 - Include Vector.h in a way that actually works.
1928 * kjs/LocalStorage.h:
1930 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1932 Not reviewed, build fix.
1934 - Install LocalStorage.h as a private header.
1936 * JavaScriptCore.xcodeproj/project.pbxproj:
1938 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1942 - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
1944 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1945 * JavaScriptCore.xcodeproj/project.pbxproj:
1946 * kjs/LocalStorage.h: Added.
1947 (KJS::LocalStorageEntry::LocalStorageEntry):
1951 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
1953 2007-10-29 Geoffrey Garen <ggaren@apple.com>
1955 Reviewed by Oliver Hunt.
1957 Some small tweaks that I notice while reviewing Oliver's last patch.
1959 Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
1961 No change in SunSpider because SunSpider doesn't take the code path that
1962 would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
1965 (KJS::LocalVarPostfixNode::evaluate):
1966 (KJS::TypeOfResolveNode::optimizeVariableAccess):
1967 (KJS::LocalVarTypeOfNode::evaluate):
1968 (KJS::PrefixResolveNode::optimizeVariableAccess):
1969 (KJS::LocalVarPrefixNode::evaluate):
1970 (KJS::AssignResolveNode::optimizeVariableAccess):
1971 (KJS::LocalVarAssignNode::evaluate):
1973 (KJS::LocalVarTypeOfNode::):
1974 (KJS::PrefixResolveNode::):
1975 (KJS::LocalVarPrefixNode::):
1976 (KJS::AssignResolveNode::):
1977 (KJS::LocalVarAssignNode::):
1979 2007-10-29 Eric Seidel <eric@webkit.org>
1983 SunSpider claims this was a 0.7% speedup.
1985 * kjs/string_object.cpp:
1986 (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
1988 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1992 - re-enable asserts for access to empty or deleted keys
1996 (WTF::::lookupForWriting):
1997 (WTF::::fullLookupForWriting):
2000 2007-10-29 Eric Seidel <eric@webkit.org>
2002 Build fix only, no review.
2004 * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
2006 2007-10-29 Mark Rowe <mrowe@apple.com>
2008 Gtk build fix. Move struct declarations into nodes.h.
2013 2007-10-29 Eric Seidel <eric@webkit.org>
2017 Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
2018 Make it a compile time error to use toString(ExecState) on a StringInstance
2020 SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
2023 (KJS::StringImp::getLength):
2024 * kjs/string_object.cpp:
2025 (KJS::StringInstance::lengthGetter):
2026 (KJS::StringInstance::inlineGetOwnPropertySlot):
2027 (KJS::StringInstance::getOwnPropertySlot):
2028 * kjs/string_object.h:
2030 2007-10-28 Oliver Hunt <oliver@apple.com>
2034 Add nodes to allow Assignment, TypeOf, and prefix operators to
2035 make use of the new optimised local variable look up.
2037 5% gain on sunspider
2040 (KJS::TypeOfResolveNode::optimizeVariableAccess):
2041 (KJS::LocalTypeOfAccessNode::evaluate):
2042 (KJS::PrefixResolveNode::optimizeVariableAccess):
2043 (KJS::PrefixLocalAccessNode::evaluate):
2044 (KJS::AssignResolveNode::optimizeVariableAccess):
2045 (KJS::AssignLocalAccessNode::evaluate):
2047 (KJS::TypeOfResolveNode::):
2048 (KJS::TypeOfResolveNode::precedence):
2049 (KJS::LocalTypeOfAccessNode::):
2050 (KJS::PrefixResolveNode::):
2051 (KJS::PrefixResolveNode::precedence):
2052 (KJS::PrefixLocalAccessNode::):
2053 (KJS::AssignResolveNode::):
2054 (KJS::AssignLocalAccessNode::):
2056 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2060 - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
2061 http://bugs.webkit.org/show_bug.cgi?id=15748
2063 Not a significant speedup or slowdown on SunSpider.
2066 (KJS::clearNewNodes):
2070 (KJS::BlockNode::BlockNode):
2071 (KJS::CaseBlockNode::CaseBlockNode):
2072 (KJS::FunctionBodyNode::FunctionBodyNode):
2073 (KJS::SourceElementsNode::SourceElementsNode):
2074 (KJS::ProgramNode::ProgramNode):
2076 (KJS::ElementNode::):
2078 (KJS::PropertyListNode::):
2079 (KJS::ObjectLiteralNode::):
2080 (KJS::ArgumentListNode::):
2081 (KJS::ArgumentsNode::):
2082 (KJS::VarDeclListNode::):
2083 (KJS::VarStatementNode::):
2085 (KJS::ParameterNode::):
2086 (KJS::FuncExprNode::):
2087 (KJS::FuncDeclNode::):
2088 (KJS::SourceElementsNode::):
2089 (KJS::CaseClauseNode::):
2090 (KJS::ClauseListNode::):
2092 2007-10-28 Mark Rowe <mrowe@apple.com>
2094 Disable assertions in a manner that doesn't break the Qt Windows build.
2098 (WTF::::lookupForWriting):
2099 (WTF::::fullLookupForWriting):
2101 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2103 Temporarily disabling some ASSERTs I introduced in my last check-in
2104 because of http://bugs.webkit.org/show_bug.cgi?id=15747
2105 Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
2109 (WTF::::lookupForWriting):
2110 (WTF::::fullLookupForWriting):
2113 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2115 Reviewed by Darin Adler.
2117 Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
2118 #ifndef ASSERT_DISABLED is no good!
2120 Replaced with #if !ASSERT_DISABLED.
2124 (WTF::::lookupForWriting):
2125 (WTF::::fullLookupForWriting):
2128 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2130 Reviewed by Darin Adler.
2132 Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
2133 to the AST transfom that replaces slow resolve nodes with fast local
2134 variable alternatives.
2136 2.5% speedup on SunSpider.
2138 Also added some missing copyright notices.
2141 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
2142 (KJS::FunctionCallResolveNode::evaluate):
2143 (KJS::LocalVarFunctionCallNode::evaluate):
2144 (KJS::PostfixResolveNode::optimizeVariableAccess):
2145 (KJS::PostfixResolveNode::evaluate):
2146 (KJS::LocalVarPostfixNode::evaluate):
2147 (KJS::DeleteResolveNode::optimizeVariableAccess):
2148 (KJS::DeleteResolveNode::evaluate):
2149 (KJS::LocalVarDeleteNode::evaluate):
2151 (KJS::FunctionCallResolveNode::):
2152 (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
2153 (KJS::PostfixResolveNode::):
2154 (KJS::LocalVarPostfixNode::LocalVarPostfixNode):
2155 (KJS::DeleteResolveNode::):
2156 (KJS::LocalVarDeleteNode::LocalVarDeleteNode):
2158 2007-10-28 Eric Seidel <eric@webkit.org>
2162 Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
2163 Add virtual keyword to a few virtual functions previously unmarked.
2166 (KJS::StringImp::type):
2167 (KJS::NumberImp::type):
2169 (KJS::UString::Rep::deref):
2171 2007-10-28 Darin Adler <darin@apple.com>
2173 - fix "broken everything" from the storage leak fix
2175 * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
2176 * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
2178 2007-10-28 Darin Adler <darin@apple.com>
2182 - turn on unused parameter waring on Mac OS X because it's already on elsewhere
2184 * Configurations/Base.xcconfig: Took out -wno-unused-parameter.
2190 Fixed unused variables by using them or marked them with UNUSED_PARAM.
2192 * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
2193 Removed parameter names to indicate they are unused.
2195 2007-10-28 Darin Adler <darin@apple.com>
2199 - fix a storage leak where we ref the UString every time we replace
2200 a ResolveNode with a LocalVarAccessNode
2202 * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
2203 that takes PlacementNewAdopt.
2205 * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
2206 with PlacementNewAdopt instead of the old value of ident.
2208 * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
2209 takes PlacementNewAdopt.
2211 2007-10-28 Darin Adler <darin@apple.com>
2213 - Windows build fix; get rid of unused parameter
2215 * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
2216 * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
2217 The assertions weren't all that helpful.
2219 2007-10-28 Mark Rowe <mrowe@apple.com>
2221 Gtk build fix. Add include of MathExtras.h.
2223 * kjs/string_object.cpp:
2225 2007-10-28 Mark Rowe <mrowe@apple.com>
2227 Reviewed by Maciej and Tim.
2229 Replace uses of isNaN and isInf with isnan and isinf, and
2230 remove isNaN and isInf.
2232 * kjs/config.h: Remove unused HAVE_'s.
2233 * kjs/date_object.cpp:
2234 (KJS::DateInstance::getTime):
2235 (KJS::DateInstance::getUTCTime):
2236 (KJS::DateProtoFunc::callAsFunction):
2237 (KJS::DateObjectImp::construct):
2238 (KJS::DateObjectFuncImp::callAsFunction):
2240 (KJS::GlobalFuncImp::callAsFunction):
2241 * kjs/math_object.cpp:
2242 (MathFuncImp::callAsFunction):
2243 * kjs/nodes2string.cpp:
2244 (KJS::isParserRoundTripNumber):
2245 * kjs/number_object.cpp:
2246 (NumberProtoFunc::callAsFunction):
2247 * kjs/operations.cpp:
2249 * kjs/string_object.cpp:
2250 (KJS::StringProtoFunc::callAsFunction):
2252 (KJS::UString::from):
2254 (KJS::JSValue::toInteger):
2255 (KJS::JSValue::toInt32SlowCase):
2256 (KJS::JSValue::toUInt32SlowCase):
2258 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2260 Build fix: use the new-fangled missingSymbolMarker().
2263 (KJS::ResolveNode::optimizeVariableAccess):
2265 (KJS::LocalVarAccessNode::LocalVarAccessNode):
2267 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2269 Reviewed by Maciej Stachowiak, Darin Adler.
2271 Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
2274 AST transfom to replace slow resolve nodes with fast local variable
2275 alternatives that do direct memory access. Currently, only ResolveNode
2276 provides a fast local variable alternative. 6 others are soon to come.
2278 16.7% speedup on SunSpider.
2280 Most of this patch is just scaffolding to support iterating all the
2281 resolve nodes in the AST through optimizeResolveNodes(). In
2282 optimizeResolveNodes(), most classes just push their child nodes onto
2283 the processing stack, while ResolveNodes actually replace themselves in
2284 the tree with more optimized alternatives, if possible.
2286 Here are the interesting bits:
2288 * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
2289 in Node and ResolveNode. This tag allows you to use placement new to
2290 swap out a base class Node in favor of a subclass copy that holds the
2291 same data. (Without this tag, default initialization would NULL out
2292 RefPtrs, change line numbers, etc.)
2295 (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
2296 that the fast path is impossible, to make sure we didn't leave anything
2299 (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
2300 transformation happens.
2302 (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
2303 optimization happens.
2305 * kjs/function.h: Added symbolTable() accessor for, for the sake of
2308 2007-10-28 Mark Rowe <mrowe@apple.com>
2312 Fix "AllInOneFile.o has a global initializer in it".
2314 Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
2315 We can avoid this by moving it inside an inline function.
2317 * kjs/SymbolTable.h:
2318 (KJS::missingSymbolMarker):
2320 (KJS::ActivationImp::getOwnPropertySlot):
2321 (KJS::ActivationImp::put):
2323 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2327 - Added assertions to protect against adding empty or deleted keys to a HashTable
2330 (WTF::HashTable::lookup):
2331 (WTF::HashTable::lookupForWriting):
2332 (WTF::HashTable::fullLookupForWriting):
2333 (WTF::HashTable::add):
2335 2007-10-28 Darin Adler <darin@apple.com>
2339 * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
2340 Use isNaN and isInf instead of isnan and isinf.
2342 2007-10-28 Darin Adler <darin@apple.com>
2346 - http://bugs.webkit.org/show_bug.cgi?id=15735
2347 remove GroupNode to simplify AST and possibly get a modest speedup
2349 This patch removes 4 node types: GroupNode, PropertyNameNode,
2350 FunctionCallParenBracketNode, and FunctionCallParenDotNode.
2352 To remove GroupNode, we add knowledge of precedence to the tree nodes,
2353 and use that when serializing to determine where parentheses are needed.
2354 This means we no longer have to represent parentheses in the tree.
2356 The precedence values are named after productions in the grammar from the
2357 JavaScript standard.
2359 SunSpider says this is an 0.4% speedup.
2362 * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
2363 serialization, so I moved it to the file that takes care of that.
2365 * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
2366 indicate failure instead of a separate boolean. Got rid of PropertyNameNode
2367 by merging the PropertyName rule into the Property rule (which was easier
2368 than figuring out how to pass the Identifier from one node to another).
2369 Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
2370 and FunctionCallParenDotNode.
2372 * kjs/nodes.h: Removed unused forward declarations and Operator values.
2373 Added Precedence enum, and precedence function to all nodes. Removed
2374 nodeInsideAllParens. Added streamBinaryOperator function for serialization.
2375 Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
2376 Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
2378 * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
2379 (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
2380 of converting it from an Identifier to a jsString then back to a UString
2381 then into an Identifier again!
2383 * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
2384 function for each of Endl, Indent, Unindent, and DotExpr instead of using a
2385 single function with a switch. Added a precedence that you can stream in, to
2386 cause the next node serialized to add parentheses based on that precedence value.
2387 (KJS::operatorString): Moved to the top of the file.
2388 (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
2389 workaround for snprintf, since StringExtras.h takes care of that.
2390 (KJS::operator<<): Made the char and char* versions faster by using UString's
2391 character append functions instead of constructing a UString. Added the logic
2392 to the Node* version to add parentheses if needed.
2393 (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
2394 (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
2395 (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
2397 (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
2398 (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
2399 (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
2400 (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
2401 (KJS::FunctionCallBracketNode::streamTo): Ditto.
2402 (KJS::FunctionCallDotNode::streamTo): Ditto.
2403 (KJS::PostfixBracketNode::streamTo): Ditto.
2404 (KJS::PostfixDotNode::streamTo): Ditto.
2405 (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
2406 (KJS::DeleteBracketNode::streamTo): Use PrecCall.
2407 (KJS::DeleteDotNode::streamTo): Ditto.
2408 (KJS::DeleteValueNode::streamTo): Use PrecUnary.
2409 (KJS::VoidNode::streamTo): Ditto.
2410 (KJS::TypeOfValueNode::streamTo): Ditto.
2411 (KJS::PrefixBracketNode::streamTo): Use PrecCall.
2412 (KJS::PrefixDotNode::streamTo): Ditto.
2413 (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
2414 (KJS::UnaryPlusNode::streamTo): Ditto.
2415 (KJS::NegateNode::streamTo): Ditto.
2416 (KJS::BitwiseNotNode::streamTo): Ditto.
2417 (KJS::LogicalNotNode::streamTo): Ditto.
2418 (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
2419 (KJS::DivNode::streamTo): Ditto.
2420 (KJS::ModNode::streamTo): Ditto.
2421 (KJS::AddNode::streamTo): Ditto.
2422 (KJS::SubNode::streamTo): Ditto.
2423 (KJS::LeftShiftNode::streamTo): Ditto.
2424 (KJS::RightShiftNode::streamTo): Ditto.
2425 (KJS::UnsignedRightShiftNode::streamTo): Ditto.
2426 (KJS::LessNode::streamTo): Ditto.
2427 (KJS::GreaterNode::streamTo): Ditto.
2428 (KJS::LessEqNode::streamTo): Ditto.
2429 (KJS::GreaterEqNode::streamTo): Ditto.
2430 (KJS::InstanceOfNode::streamTo): Ditto.
2431 (KJS::InNode::streamTo): Ditto.
2432 (KJS::EqualNode::streamTo): Ditto.
2433 (KJS::NotEqualNode::streamTo): Ditto.
2434 (KJS::StrictEqualNode::streamTo): Ditto.
2435 (KJS::NotStrictEqualNode::streamTo): Ditto.
2436 (KJS::BitAndNode::streamTo): Ditto.
2437 (KJS::BitXOrNode::streamTo): Ditto.
2438 (KJS::BitOrNode::streamTo): Ditto.
2439 (KJS::LogicalAndNode::streamTo): Ditto.
2440 (KJS::LogicalOrNode::streamTo): Ditto.
2441 (KJS::ConditionalNode::streamTo): Ditto.
2442 (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
2443 (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
2444 the bracket and PrecAssignment for the right side.
2445 (KJS::AssignDotNode::streamTo): Ditto.
2446 (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
2447 and PrecAssignment for the right side.
2448 (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
2449 (KJS::AssignExprNode::streamTo): Use PrecAssignment.
2451 2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
2453 Define wx port and set wx port USE options.
2455 Reviewed by Adam Roben.
2459 2007-10-28 Mark Rowe <mrowe@apple.com>
2461 We don't include "config.h" in headers.
2463 * bindings/jni/jni_instance.h:
2468 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2470 Rubber stamped by Mark.
2472 - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
2474 * kjs/SymbolTable.h:
2475 (KJS::SymbolTableIndexHashTraits::emptyValue):
2477 (KJS::ActivationImp::getOwnPropertySlot):
2478 (KJS::ActivationImp::put):
2480 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2484 - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
2486 * kjs/SymbolTable.h:
2487 (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
2488 (KJS::IdentifierRepHash::equal): ditto
2489 (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
2490 (KJS::SymbolTable): change to a typedef for a HashMap.
2492 (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
2493 (KJS::ActivationImp::deleteProperty): ditto
2494 (KJS::ActivationImp::put): ditto
2497 (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
2498 you now have to store a UString::rep, not an identifier.
2500 2007-10-27 Maciej Stachowiak <mjs@apple.com>
2504 - numerous HashTable performance improvements
2506 This does not quite add up to a measurable win on SunSpider, but it allows a
2507 follow-on > 3% improvement and probably helps WebCore too.
2509 I made the following improvements, among others:
2511 - Made HashFunctions note whether it is ok to compare a real value with the equal() function
2512 to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
2514 - Specialized lookup so it doesn't have to do so many extra branches and build so many extra
2515 std::pairs for cases that don't need them. There are now four versions, one for read-only access,
2516 two for writing, and one folded directly into add() (these all were improvments).
2518 - Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
2520 - Made a special constructor for iterators that knows it points to
2521 a valid filled cell and so skips updating itself.
2523 - Reordered memory accesses in the various lookup functions for better code generation
2525 - Made simple translators avoid passing a hash code around
2527 - Other minor tweaks
2531 (WTF::HashTableConstIterator::HashTableConstIterator):
2532 (WTF::HashTableIterator::HashTableIterator):
2533 (WTF::IdentityHashTranslator::translate):
2534 (WTF::HashTable::end):
2535 (WTF::HashTable::lookup):
2536 (WTF::HashTable::lookupForWriting):
2537 (WTF::HashTable::makeKnownGoodIterator):
2538 (WTF::HashTable::makeKnownGoodConstIterator):
2540 (WTF::::lookupForWriting):
2541 (WTF::::fullLookupForWriting):
2543 (WTF::::addPassingHashCode):
2547 * kjs/identifier.cpp:
2549 * wtf/HashFunctions.h:
2557 * wtf/ListHashSet.h:
2558 (WTF::ListHashSetTranslator::translate):
2560 2007-10-27 Darin Adler <darin@apple.com>
2564 - fix ASCIICType.h for some Windows compiles
2566 * wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
2567 compiler/library that has the wchar_t that is just a typedef.
2569 2007-10-27 Kevin McCullough <kmccullough@apple.com>
2572 - Forgot to change the build step when I changed the filename.
2574 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2576 2007-10-27 Geoffrey Garen <ggaren@apple.com>
2578 Reviewed by Darin Adler.
2580 Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
2582 http://bugs.webkit.org/show_bug.cgi?id=15718
2584 * kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a
2585 hash value. Also changed O(n) strlen to O(1) check for empty string.
2586 (KJS::Identifier::add):
2588 * kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
2589 (KJS::UString::UString):
2590 (KJS::UString::operator=):
2592 2007-10-27 Darin Adler <darin@apple.com>
2596 - fix pow on Windows
2598 * wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
2599 a "pow" function that does not properly handle the case where arg1 is
2602 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
2603 specify "::pow" -- just "pow" is fine.
2605 2007-10-27 Darin Adler <darin@apple.com>
2609 - http://bugs.webkit.org/show_bug.cgi?id=15711
2610 force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
2612 * kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
2614 * kjs/object.h: Removed redundant includes.
2615 * kjs/value.h: Ditto.
2617 2007-10-27 Maciej Stachowiak <mjs@apple.com>
2621 - fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
2622 http://bugs.webkit.org/show_bug.cgi?id=15718
2624 * kjs/identifier.cpp:
2625 (KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
2626 now that we count on all Identifiers already having one.
2628 2007-10-27 Mark Rowe <mrowe@apple.com>
2632 * kjs/SymbolTable.h:
2634 2007-10-27 Mark Rowe <mrowe@apple.com>
2640 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2642 Rubber stamp by Adam.
2644 - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
2645 files contain are functions that operate on BSTRs.
2647 * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
2648 * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
2649 * API/JSStringRefCOM.cpp: Removed.
2650 * API/JSStringRefCOM.h: Removed.
2651 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2653 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2657 - Made JSStringCreateWithBSTR capable of handling null BSTRs.
2659 * API/JSStringRefCOM.cpp:
2660 (JSStringCreateWithBSTR):
2662 2007-10-26 Sam Weinig <sam@webkit.org>
2666 * kjs/SymbolTable.h: Add header gaurd.
2667 * kjs/nodes.h: #include "SymbolTable.h"
2669 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2671 Suggested by Anders Carlsson.
2676 (KJS::ActivationImp::getOwnPropertySlot):
2678 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2680 Suggested by Darin Adler.
2682 Use computedHash(), which is safer than just directly accessing _hash.
2685 (KJS::Lookup::findEntry):
2686 (KJS::Lookup::find):
2688 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2690 Build fix: svn add SymbolTable.h
2692 * kjs/SymbolTable.h: Added.
2693 (KJS::SymbolTable::set):
2694 (KJS::SymbolTable::get):
2696 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2698 Build fix: export SymbolTable.h to WebCore.
2700 * JavaScriptCore.xcodeproj/project.pbxproj:
2702 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2704 Comment tweak suggested by Maciej.
2707 (KJS::ActivationImp::getOwnPropertySlot):
2709 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2711 Reviewed by Maciej Stachowiak.
2713 Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
2715 * kjs/property_map.cpp: Use a special no branch accessor to the UString's
2716 hash value. Also, return immediately instead of branching to the end
2717 of the loop if the value is not found.
2718 (KJS::PropertyMap::get):
2719 (KJS::PropertyMap::getLocation):
2720 (KJS::PropertyMap::put):
2721 (KJS::PropertyMap::insert):
2722 (KJS::PropertyMap::remove):
2723 (KJS::PropertyMap::checkConsistency):
2726 (KJS::UString::Rep::computedHash): Special no branch accessor to the
2727 UString's hash value. Used when the caller knows that the hash value
2728 has already been computed. (For example, if the caller got the UString
2729 from an Identifier.)
2731 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2733 Reviewed by Maciej Stachowiak.
2735 Switched ActivationImp to using a symbol table. For now, though, all
2736 clients take the slow path.
2738 Net .6% speedup on SunSpider.
2741 - ActivationImp now mallocs in its constructor
2742 - Local variable hits use an extra level of indirection to retrieve
2744 - Local variable misses do two lookups
2747 - Fast initialization of local variables upon function entry
2749 * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
2752 (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
2753 data that won't fit in a JSCell.
2754 (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
2756 (KJS::ActivationImp::getOwnPropertySlot): ditto
2757 (KJS::ActivationImp::deleteProperty): ditto
2758 (KJS::ActivationImp::put): ditto
2759 (KJS::ActivationImp::createArgumentsObject): ditto
2761 (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
2762 our properties doesn't try to recursively mark us. (This caused a crash
2763 in earlier testing. Not sure why we haven't run into it before.)
2765 * kjs/nodes.cpp: Functions now build a symbol table the first time
2767 (KJS::VarDeclNode::evaluate):
2768 (KJS::FunctionBodyNode::FunctionBodyNode):
2769 (KJS::FunctionBodyNode::initializeSymbolTable):
2770 (KJS::FunctionBodyNode::processDeclarations):
2771 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2772 (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
2775 (KJS::FunctionBodyNode::symbolTable):
2777 * wtf/Forward.h: Added Vector.
2779 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2781 - Corrected function name mistake in this changelog.
2783 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2784 Reviewed by Sam and Steve.
2786 - Added convenience methods for converting between BSTR and JSStringRefs
2788 * API/JSStringRefCOM.cpp: Added.
2789 (JSStringCreateWithBSTR):
2791 * API/JSStringRefCOM.h: Added.
2792 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2794 2007-10-26 Mark Rowe <mrowe@apple.com>
2798 * kjs/collector.cpp:
2799 (KJS::Collector::collect):
2801 2007-10-26 Oliver Hunt <oliver@apple.com>
2805 Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
2807 * kjs/CollectorHeapIntrospector.cpp:
2808 (KJS::CollectorHeapIntrospector::init):
2809 (KJS::CollectorHeapIntrospector::enumerate):
2810 * kjs/CollectorHeapIntrospector.h:
2811 * kjs/collector.cpp:
2812 (KJS::Collector::recordExtraCost):
2813 (KJS::Collector::heapAllocate):
2814 (KJS::Collector::allocate):
2815 (KJS::Collector::allocateNumber):
2816 (KJS::Collector::registerThread):
2817 (KJS::Collector::markStackObjectsConservatively):
2818 (KJS::Collector::markMainThreadOnlyObjects):
2819 (KJS::Collector::sweep):
2820 (KJS::Collector::collect):
2823 (KJS::NumberImp::operator new):
2824 Force numbers to be allocated in the secondary heap.
2826 2007-10-26 Maciej Stachowiak <mjs@apple.com>
2830 - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
2833 (KJS::JSValue::getUInt32):
2834 (KJS::JSValue::getTruncatedInt32):
2835 (KJS::JSValue::toNumber):
2837 (WTF::PassRefPtr::~PassRefPtr):
2839 (WTF::RefPtr::operator->):
2841 2007-10-26 Mark Rowe <mrowe@apple.com>
2847 2007-10-26 Maciej Stachowiak <mjs@apple.com>
2851 - Merge Context class fully into ExecState, since they are always created and used together.
2853 No measurable performance impact but this is a useful cleanup.
2855 * JavaScriptCore.pri:
2856 * kjs/ExecState.cpp:
2857 (KJS::ExecState::ExecState):
2858 (KJS::ExecState::~ExecState):
2859 (KJS::ExecState::mark):
2860 (KJS::ExecState::lexicalInterpreter):
2862 (KJS::ExecState::dynamicInterpreter):
2863 (KJS::ExecState::setException):
2864 (KJS::ExecState::clearException):
2865 (KJS::ExecState::exception):
2866 (KJS::ExecState::exceptionSlot):
2867 (KJS::ExecState::hadException):
2868 (KJS::ExecState::scopeChain):
2869 (KJS::ExecState::callingExecState):
2870 (KJS::ExecState::propertyNames):
2871 * kjs/collector.cpp:
2872 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
2874 (KJS::FunctionImp::callAsFunction):
2875 (KJS::FunctionImp::argumentsGetter):
2876 (KJS::FunctionImp::callerGetter):
2877 (KJS::GlobalFuncImp::callAsFunction):
2878 * kjs/interpreter.cpp:
2879 (KJS::Interpreter::Interpreter):
2880 (KJS::Interpreter::init):
2881 (KJS::Interpreter::evaluate):
2882 (KJS::Interpreter::mark):
2883 * kjs/interpreter.h:
2884 (KJS::Interpreter::setCurrentExec):
2885 (KJS::Interpreter::currentExec):
2887 (KJS::currentSourceId):
2888 (KJS::currentSourceURL):
2889 (KJS::ThisNode::evaluate):
2890 (KJS::ResolveNode::evaluate):
2891 (KJS::FunctionCallResolveNode::evaluate):
2892 (KJS::PostfixResolveNode::evaluate):
2893 (KJS::DeleteResolveNode::evaluate):
2894 (KJS::TypeOfResolveNode::evaluate):
2895 (KJS::PrefixResolveNode::evaluate):
2896 (KJS::AssignResolveNode::evaluate):
2897 (KJS::VarDeclNode::evaluate):
2898 (KJS::DoWhileNode::execute):
2899 (KJS::WhileNode::execute):
2900 (KJS::ForNode::execute):
2901 (KJS::ForInNode::execute):
2902 (KJS::ContinueNode::execute):
2903 (KJS::BreakNode::execute):
2904 (KJS::ReturnNode::execute):
2905 (KJS::WithNode::execute):
2906 (KJS::SwitchNode::execute):
2907 (KJS::LabelNode::execute):
2908 (KJS::TryNode::execute):
2909 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
2910 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
2911 (KJS::FunctionBodyNode::processDeclarations):
2912 (KJS::FuncDeclNode::makeFunction):
2913 (KJS::FuncExprNode::evaluate):
2915 2007-10-26 Mark Rowe <mrowe@apple.com>
2919 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2921 2007-10-26 Mark Rowe <mrowe@apple.com>
2925 * JavaScriptCore.pri:
2926 * kjs/ExecState.cpp:
2928 2007-10-26 Maciej Stachowiak <mjs@apple.com>
2932 - moved Context class into ExecState.{h,cpp} in preparation for merging
2933 ExecState and Context classes.
2935 * kjs/ExecState.h: Moved CodeType enum and Context class here in
2936 preparation for merging ExecState and Context.
2937 * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
2938 (KJS::Context::Context):
2939 (KJS::Context::~Context):
2940 (KJS::Context::mark):
2941 * kjs/context.h: Removed.
2942 * kjs/Context.cpp: Removed.
2943 * kjs/function.h: Removed CodeType enum.
2944 * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
2945 * kjs/internal.h: Removed LabelStack.
2946 * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
2947 * kjs/collector.cpp: Fixed includes.
2948 * kjs/function.cpp: ditto
2949 * kjs/internal.cpp: ditto
2950 * kjs/interpreter.cpp: ditto
2951 * kjs/lookup.h: ditto
2952 * kjs/nodes.cpp: ditto
2954 2007-10-26 Mark Rowe <mrowe@apple.com>
2958 * kjs/string_object.cpp:
2959 (KJS::StringObjectFuncImp::callAsFunction):
2961 2007-10-25 Darin Adler <darin@apple.com>
2965 - http://bugs.webkit.org/show_bug.cgi?id=15703
2966 fix numeric functions -- improve correctness and speed
2968 Gives about 1% gain on SunSpider.
2970 * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
2971 (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
2972 with both immediate and number values.
2973 (KJS::JSValue::toUInt32): Ditto.
2975 (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
2976 differences. One is that it now correctly returns 0 for NaN, and another is that
2977 there's no special case for 0 or infinity, since the general case already handles
2979 (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
2981 (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
2982 truncation done by the typecast already does the necessary truncation that
2983 roundValue was doing.
2984 (KJS::JSValue::toUInt32SlowCase): Ditto.
2985 (KJS::JSValue::toUInt16): Removed.
2987 * kjs/internal.h: Removed roundValue.
2988 * kjs/internal.cpp: Ditto.
2990 * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
2991 code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
2993 * kjs/date_object.cpp:
2994 (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
2995 toNumber as specified.
2996 (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
2997 with a call to toNumber and timeClip as specified.
2998 (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
2999 where the default behavior of toInt32 (returning 0) was already correct. Replaced
3000 call to roundValue with a call to toNumber as specified.
3001 (KJS::DateObjectFuncImp::callAsFunction): Ditto.
3003 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
3004 cases for the pow function that the library already handles correctly.
3006 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
3007 call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
3008 The real toInteger now returns 0 for NaN. Took out unneeded special case in
3009 ToFixed for undefined; was only needed because our toInteger was wrong. Same
3010 thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
3012 * kjs/string_object.cpp:
3013 (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
3014 cases for undefined that were only needed because toInteger was wrong. Same in
3015 IndexOf, and was able to remove some special cases. In LastIndexOf, used
3016 toIntegerPreserveNaN, but was able to remove some special cases there too.
3017 Changed Substr implementation to preserve correct behavior with the change
3018 to toInteger and match the specification. Also made sure we weren't converting
3019 an out of range double to an int.
3020 (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
3021 toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
3022 no reason to have toUInt16 as a second, less-optimized function that's only
3023 called at this one call site.
3025 * wtf/MathExtras.h: Added trunc function for Windows.
3027 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3029 Reviewed by Maciej Stachowiak.
3031 Tweaked the inner hashtable lookup loop to remove a branch in the "not
3032 found" case. .5% speedup on SunSpider.
3034 * JavaScriptCore.xcodeproj/project.pbxproj:
3038 2007-10-25 Maciej Stachowiak <mjs@apple.com>
3042 - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
3045 (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
3046 adding any value over toNumber() here.
3047 (KJS::valueForReadModifyAssignment): Ditto.
3048 (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
3050 (KJS::lessThanEq): Ditto.
3051 * JavaScriptCore.exp: Export new functions as needed.
3053 (KJS::JSValue::toPrimitive): Fixed formatting.
3054 (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
3055 to number and tells you whether a toPrimitive() conversion with a Number hint
3056 would have given a string.
3058 (KJS::StringImp::getPrimitiveNumber): Implemented.
3059 (KJS::NumberImp::getPrimitiveNumber): ditto
3060 (KJS::GetterSetterImp::getPrimitiveNumber): ditto
3061 (KJS::StringImp::toPrimitive): Fixed formatting.
3062 (KJS::NumberImp::toPrimitive): ditto
3063 (KJS::GetterSetterImp::toPrimitive): ditto
3066 (KJS::JSObject::getPrimitiveNumber): Implemented.
3069 2007-10-25 Sam Weinig <sam@webkit.org>
3071 Reviewed by Adam Roben.
3073 Remove JSStringRefCFHack from windows as it is no longer needed.
3075 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3077 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3079 Reviewed by Oliver Hunt.
3081 Rolled out my last patch. It turns out that I needed 2 words, not 1,
3084 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3086 Reviewed by Oliver Hunt.
3088 Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
3089 Shrink the size of an activation object by 1 word
3091 This is in preparation for adding a symbol table to the activation
3094 The basic strategy here is to rely on the mutual exclusion between
3095 the arguments object pointer and the function pointer (you only need
3096 the latter in order to create the former), and store them in the same
3097 place. The LazyArgumentsObject class encapsulates this strategy.
3099 Also inlined the ArgumentsImp constructor, for good measure.
3101 SunSpider reports no regression. Regression tests pass.
3103 * JavaScriptCore.xcodeproj/project.pbxproj:
3105 (KJS::Context::~Context):
3107 (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
3108 (KJS::ActivationImp::LazyArgumentsObject::mark):
3110 (KJS::ActivationImp::argumentsGetter):
3111 (KJS::ActivationImp::mark):
3113 (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
3114 (KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
3115 (KJS::ActivationImp::LazyArgumentsObject::resetArguments):
3116 (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
3117 (KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
3118 (KJS::ActivationImp::LazyArgumentsObject::setFunction):
3119 (KJS::ActivationImp::LazyArgumentsObject::function):
3120 (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
3121 (KJS::ActivationImp::LazyArgumentsObject::):
3122 (KJS::ActivationImp::ActivationImp::ActivationImp):
3123 (KJS::ActivationImp::resetArguments):
3125 2007-10-25 Adam Roben <aroben@apple.com>
3127 Change JavaScriptCore.vcproj to use DerivedSources.make
3129 We were trying to emulate the logic of make in
3130 build-generated-files.sh, but we got it wrong. We now use a
3131 build-generated-files very much like the one that WebCore uses to
3134 We also now only have a Debug configuration of dftables which we build
3135 even when doing a Release build of JavaScriptCore. dftables also no
3136 longer has the "_debug" name suffix.
3138 Changes mostly made by Darin, reviewed by me.
3140 * DerivedSources.make: Add a variable to set the extension used for
3141 the dftables executable.
3142 * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
3143 dftables in Release configurations.
3144 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
3145 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3146 - Updated include path to point to the new location of the derived
3148 - Modified pre-build event to pass the right arguments to
3149 build-generated-files.sh and not call dftables directly.
3150 - Added the derived source files to the project.
3151 - Removed grammarWrapper.cpp, which isn't needed now that we're
3152 compiling grammar.cpp directly.
3153 * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
3154 Slightly modified from the WebCore version.
3155 * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
3156 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
3157 - Changed the output location to match Mac.
3158 - Removed the Release configuration.
3159 - Removed the _debug suffix.
3161 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3163 Reviewed by Eric Seidel.
3165 Slightly elaborated the differences between declaration procesing in
3166 Function Code and Program Code.
3168 .3% speedup on SunSpider.
3171 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
3172 (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a
3173 minimum set of attributes instead of recomputing all the time. Also,
3174 ignore m_parameters, since programs don't have arguments.
3176 2007-10-25 Eric Seidel <eric@webkit.org>
3180 More preparation work before adding long-running mode to testkjs.
3183 (TestFunctionImp::callAsFunction):
3184 (prettyPrintScript):
3188 (fillBufferWithContentsOfFile):
3190 2007-10-25 Eric Seidel <eric@webkit.org>
3194 Bring testkjs code out of the dark ages in preparation for more
3195 radical improvements (like long-running testing support!)
3198 (TestFunctionImp::callAsFunction):
3201 (fillBufferWithContentsOfFile):
3203 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3205 Reviewed by Maciej Stachowiak.
3207 Make a fast path for declaration processing inside Function Code.
3209 Lifted declaration processing code up from individual declaration nodes
3210 and into processDeclarations.
3212 Broke out processDeclarations into two cases, depending on the type of
3213 code. This eliminates 2 branches, and facilitates more radical
3214 divergeance in the future.
3216 2.5% SunSpider speedup.
3218 * JavaScriptCore.xcodeproj/project.pbxproj:
3220 (KJS::FunctionBodyNode::initializeDeclarationStacks):
3221 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
3222 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
3223 (KJS::FunctionBodyNode::execute):
3224 (KJS::FuncDeclNode::makeFunction):
3228 2007-10-25 Maciej Stachowiak <mjs@apple.com>
3232 - add header includes needed on platforms that don't use AllInOneFile.cpp
3234 * API/JSCallbackObject.cpp:
3236 * kjs/ExecState.cpp:
3237 * kjs/array_instance.cpp:
3238 * kjs/function_object.cpp:
3239 * kjs/interpreter.cpp:
3242 2007-10-25 Eric Seidel <eric@webkit.org>
3246 * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
3248 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3250 Reviewed by Maciej Stachowiak.
3252 Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
3253 Re-order declaration initialization to avoid calling hasProperty inside
3254 VarDeclNode::processDeclaration
3256 .7% speedup on SunSpider.
3259 * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
3260 other processing of declared symbols, so the order of execution could
3264 (KJS::VarDeclNode::getDeclarations): Added special case for the
3265 "arguments" property name, explained in the comment.
3267 (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
3268 in the case of function code, since we know the declared symbol
3269 management will resolve conflicts between symbols. Yay!
3271 (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
3272 implementation of getDeclarations is non-trivial, we can't take a
3273 short-cut here any longer -- we need to put the VarDecl node on the
3274 stack so it gets processed normally.
3276 (KJS::FunctionBodyNode::processDeclarations): Changed the order of
3277 processing to enforce mutual exclusion rules.
3280 (KJS::DeclarationStacks::DeclarationStacks): Structure includes an
3281 ExecState now, for fast access to the "arguments" property name.
3283 2007-10-24 Eric Seidel <eric@webkit.org>
3287 Add a JSGlobalObject class and remove the InterpreterMap
3288 http://bugs.webkit.org/show_bug.cgi?id=15681
3290 This required making JSCallbackObject a template class to allow for
3291 JSGlobalObjects with JSCallbackObject functionality.
3293 SunSpider claims this was a 0.5% speedup.
3295 * API/JSCallbackObject.cpp:
3297 * API/JSCallbackObject.h:
3298 * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
3299 (KJS::::JSCallbackObject):
3301 (KJS::::~JSCallbackObject):
3302 (KJS::::initializeIfNeeded):
3304 (KJS::::getOwnPropertySlot):
3306 (KJS::::deleteProperty):
3307 (KJS::::implementsConstruct):
3309 (KJS::::implementsHasInstance):
3310 (KJS::::hasInstance):
3311 (KJS::::implementsCall):
3312 (KJS::::callAsFunction):
3313 (KJS::::getPropertyNames):
3316 (KJS::::setPrivate):
3317 (KJS::::getPrivate):
3319 (KJS::::cachedValueGetter):
3320 (KJS::::staticValueGetter):
3321 (KJS::::staticFunctionGetter):
3322 (KJS::::callbackGetter):
3323 * API/JSClassRef.cpp:
3324 (OpaqueJSClass::prototype):
3325 * API/JSContextRef.cpp:
3326 (JSGlobalContextCreate):
3327 * API/JSObjectRef.cpp:
3329 (JSObjectGetPrivate):
3330 (JSObjectSetPrivate):
3331 * API/JSValueRef.cpp:
3332 (JSValueIsObjectOfClass):
3333 * JavaScriptCore.exp:
3334 * JavaScriptCore.xcodeproj/project.pbxproj:
3335 * bindings/c/c_utility.cpp:
3336 (KJS::Bindings::convertValueToNPVariant):
3337 * bindings/jni/jni_jsobject.cpp:
3338 * bindings/objc/objc_utility.mm:
3339 (KJS::Bindings::convertValueToObjcValue):
3341 (KJS::Context::Context):
3342 * kjs/ExecState.cpp:
3343 (KJS::ExecState::lexicalInterpreter):
3344 * kjs/JSGlobalObject.h: Added.
3345 (KJS::JSGlobalObject::JSGlobalObject):
3346 (KJS::JSGlobalObject::isGlobalObject):
3347 (KJS::JSGlobalObject::interpreter):
3348 (KJS::JSGlobalObject::setInterpreter):
3349 * kjs/array_instance.cpp:
3352 (KJS::FunctionImp::callAsFunction):
3353 (KJS::GlobalFuncImp::callAsFunction):
3354 * kjs/interpreter.cpp:
3355 (KJS::Interpreter::Interpreter):
3356 (KJS::Interpreter::init):
3357 (KJS::Interpreter::~Interpreter):
3358 (KJS::Interpreter::globalObject):
3359 (KJS::Interpreter::initGlobalObject):
3360 (KJS::Interpreter::evaluate):
3361 * kjs/interpreter.h:
3363 (KJS::cacheGlobalObject):
3365 (KJS::JSObject::isGlobalObject):
3368 2007-10-24 Eric Seidel <eric@webkit.org>
3370 Build fix for Gtk, no review.
3372 * kjs/collector.cpp: #include "context.h"
3374 2007-10-24 Eric Seidel <eric@webkit.org>
3378 Stop checking isOutOfMemory after every allocation, instead let the collector
3379 notify all ExecStates if we ever hit this rare condition.
3381 SunSpider claims this was a 2.2% speedup.
3383 * kjs/collector.cpp:
3384 (KJS::Collector::collect):
3385 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
3388 (KJS::TryNode::execute):
3390 2007-10-24 Mark Rowe <mrowe@apple.com>
3394 * kjs/identifier.h: Remove extra qualification.
3396 2007-10-24 Geoffrey Garen <ggaren@apple.com>
3398 Reviewed by Sam Weinig.
3400 Disable ALWAYS_INLINE in debug builds, since it drives the debugger
3403 * wtf/AlwaysInline.h:
3405 2007-10-24 Geoffrey Garen <ggaren@apple.com>
3407 Reviewed by Sam Weinig.
3409 Inlined the fast path for creating an Identifier from an Identifier.
3411 This is a .4% speedup on SunSpider overall, but as big as a 2.5%
3412 speedup on certain individual tests. 65% of the Identifiers creating
3413 by SunSpider are already Identifiers.
3415 (The main reason I'm making this change is that it resolves a large
3416 regression in a patch I haven't checked in yet.)
3418 * JavaScriptCore.exp:
3419 * kjs/identifier.cpp:
3420 (KJS::Identifier::addSlowCase):
3422 (KJS::Identifier::Identifier::add):
3424 2007-10-24 Lars Knoll <lars@trolltech.com>
3428 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.
3430 * bindings/qt/qt_instance.cpp:
3431 (KJS::Bindings::QtInstance::invokeMethod):
3432 * bindings/qt/qt_runtime.cpp:
3433 (KJS::Bindings::convertValueToQVariant):
3434 (KJS::Bindings::QtField::setValueToInstance):
3436 2007-10-24 Oliver Hunt <oliver@apple.com>
3440 Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
3445 (KJS::LessNode::evaluate):
3446 (KJS::GreaterNode::evaluate):
3447 (KJS::LessEqNode::evaluate):
3448 (KJS::GreaterEqNode::evaluate):
3449 * kjs/operations.cpp:
3452 2007-10-24 Eric Seidel <eric@webkit.org>
3457 (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
3459 2007-10-24 Darin Adler <darin@apple.com>
3463 * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
3464 Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
3466 2007-10-24 Darin Adler <darin@apple.com>
3470 - separate out the code to create a hash table the first time from the code
3473 SunSpider claims this was a 0.7% speedup.
3475 * kjs/property_map.cpp:
3476 (KJS::PropertyMap::expand): Changed to call either createTable or rehash.
3477 (KJS::PropertyMap::createTable): Added. For the case where we had no table.
3478 (KJS::PropertyMap::rehash): Removed code needed only in the case where we
3480 * kjs/property_map.h: Added createTable.
3482 2007-10-24 Eric Seidel <eric@webkit.org>
3486 Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
3487 which can be represented by JSImmediate.
3489 SunSpider claims this was a 0.6% speedup.
3493 (KJS::NumberNode::evaluate):
3494 (KJS::ImmediateNumberNode::evaluate):
3497 (KJS::ImmediateNumberNode::):
3498 * kjs/nodes2string.cpp:
3499 (ImmediateNumberNode::streamTo):
3501 2007-10-24 Darin Adler <darin@apple.com>
3505 - http://bugs.webkit.org/show_bug.cgi?id=15657
3506 change static hash tables to use powers of two for speed
3508 Seems to give 0.7% SunSpider speedup.
3510 * kjs/create_hash_table: Updated to generate new format.
3512 (KJS::keysMatch): Took out unneeded typecast.
3513 (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
3514 Replaced the modulus with a bit mask.
3515 (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
3516 their hash -- saves a branch.
3517 (KJS::Lookup::find): Ditto.
3518 * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
3520 2007-10-24 Maciej Stachowiak <mjs@apple.com>
3524 - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
3527 (KJS::DoWhileNode::execute):
3528 (KJS::WhileNode::execute):
3529 (KJS::ForNode::execute):
3530 (KJS::ForInNode::execute):
3531 (KJS::SourceElementsNode::execute):
3533 2007-10-23 Darin Adler <darin@apple.com>
3537 * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
3538 Changed an && to an & for a 1% gain in SunSpider.
3540 2007-10-23 Oliver Hunt <oliver@apple.com>
3544 Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
3547 (KJS::MultNode::evaluate):
3548 (KJS::DivNode::evaluate):
3549 (KJS::ModNode::evaluate):