1 2007-11-08 Darin Adler <darin@apple.com>
3 - roll out accidentally-checked in changes
5 * kjs/nodes.cpp: Back to previous version.
7 * kjs/grammar.y: Ditto.
9 2007-11-08 Darin Adler <darin@apple.com>
13 - http://bugs.webkit.org/show_bug.cgi?id=15912
14 fasta spends a lot of time in qsort
16 * kjs/property_map.cpp:
17 (KJS::PropertyMap::getEnumerablePropertyNames):
18 Use insertion sort instead of qsort for small sets of property names.
19 We can probably do some even-better speedups of for/in, but this nets
20 0.6% overall and 6.7% on fasta.
22 2007-11-08 Darin Adler <darin@apple.com>
26 - http://bugs.webkit.org/show_bug.cgi?id=15906
27 getting characters by indexing into a string is very slow
29 This fixes one source of the slowness -- the conversion to an unused
30 Identifier as we call the get function from the slot -- but doesn't
31 fix others, such as the fact that we have to allocate a new UString::Rep
32 for every single character.
34 Speeds up string-base64 30%, and at least 0.5% overall.
35 But does slow down access-fannkuch quite a bit. Might be worth
36 revisiting in the future to see what we can do about that (although
37 I did look at a profile for a while).
39 * kjs/property_slot.h: Add a new marker for "numeric" property slots;
40 slots where we don't need to pass the identifier to the get function.
41 (KJS::PropertySlot::getValue): Added code to call the numeric get function.
42 (KJS::PropertySlot::setCustomNumeric): Added.
43 * kjs/string_object.cpp:
44 (KJS::StringInstance::indexGetter): Changed to use substr() instead
45 of constructing a wholly new UString each time.
46 (KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but
47 takes advantage of setCustomNumeric to avoid creating an Identifier.
48 (KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric.
50 2007-11-08 Darin Adler <darin@apple.com>
54 - http://bugs.webkit.org/show_bug.cgi?id=15904
55 more speed-ups possible by tightening up int version of JSImmediate
57 1% improvement of SunSpider
59 * kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template.
60 (KJS::JSImmediate::from): Overload for most numeric types; many types can
61 do fewer branches and checks.
62 (KJS::JSImmediate::getUInt32): Removed unneeded check for undefined.
63 (KJS::JSImmediate::getTruncatedInt32): Ditto.
64 (KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more
65 between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later.
67 * kjs/grammar.y: Update since fromDouble is now just from.
70 * kjs/value.h: (KJS::jsNumber): Overload for most numeric types.
72 2007-11-08 Kevin Ollivier <kevino@theolliviers.com>
74 Bakefiles for building JavaScriptCore, needed by wx port.
76 Reviewed by Mark Rowe.
78 * JavaScriptCoreSources.bkl: Added.
81 2007-11-08 Oliver Hunt <oliver@apple.com>
85 Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
87 The implementation of JSImmediate::areBothImmediateNumbers relies on
88 (JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having
89 a unique result when both immediate values are numbers.
91 The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
92 By swapping the value of NumberType and UndefinedType this ceases to be a problem.
97 2007-11-08 Darin Adler <darin@apple.com>
101 * kjs/nodes.h: Add missing parameter name.
103 2007-11-08 Eric Seidel <eric@webkit.org>
107 Add ExpressionNode subclass of Node, use it.
111 (KJS::ForInNode::ForInNode):
113 (KJS::ExpressionNode::):
115 (KJS::NullNode::precedence):
116 (KJS::BooleanNode::):
117 (KJS::BooleanNode::precedence):
119 (KJS::RegExpNode::precedence):
121 (KJS::ThisNode::precedence):
122 (KJS::ResolveNode::):
123 (KJS::ElementNode::):
125 (KJS::PropertyNode::):
126 (KJS::PropertyNode::precedence):
127 (KJS::PropertyNode::name):
128 (KJS::PropertyListNode::):
129 (KJS::ObjectLiteralNode::):
130 (KJS::ObjectLiteralNode::precedence):
131 (KJS::BracketAccessorNode::):
132 (KJS::DotAccessorNode::):
133 (KJS::DotAccessorNode::precedence):
134 (KJS::ArgumentListNode::):
135 (KJS::ArgumentsNode::):
136 (KJS::NewExprNode::):
137 (KJS::NewExprNode::precedence):
138 (KJS::FunctionCallValueNode::):
139 (KJS::FunctionCallValueNode::precedence):
140 (KJS::FunctionCallResolveNode::):
141 (KJS::FunctionCallBracketNode::):
142 (KJS::FunctionCallBracketNode::precedence):
143 (KJS::FunctionCallDotNode::):
144 (KJS::FunctionCallDotNode::precedence):
145 (KJS::PrePostResolveNode::):
146 (KJS::PostfixBracketNode::):
147 (KJS::PostfixBracketNode::precedence):
148 (KJS::PostIncBracketNode::):
149 (KJS::PostIncBracketNode::isIncrement):
150 (KJS::PostDecBracketNode::):
151 (KJS::PostDecBracketNode::isIncrement):
152 (KJS::PostfixDotNode::):
153 (KJS::PostfixDotNode::precedence):
154 (KJS::PostIncDotNode::):
155 (KJS::PostIncDotNode::isIncrement):
156 (KJS::PostDecDotNode::):
157 (KJS::PostDecDotNode::isIncrement):
158 (KJS::PostfixErrorNode::):
159 (KJS::PostfixErrorNode::precedence):
160 (KJS::DeleteResolveNode::):
161 (KJS::DeleteBracketNode::):
162 (KJS::DeleteBracketNode::precedence):
163 (KJS::DeleteDotNode::):
164 (KJS::DeleteDotNode::precedence):
165 (KJS::DeleteValueNode::):
166 (KJS::DeleteValueNode::precedence):
168 (KJS::VoidNode::precedence):
169 (KJS::TypeOfResolveNode::):
170 (KJS::TypeOfValueNode::):
171 (KJS::PrefixBracketNode::):
172 (KJS::PrefixBracketNode::precedence):
173 (KJS::PreIncBracketNode::):
174 (KJS::PreIncBracketNode::isIncrement):
175 (KJS::PreDecBracketNode::):
176 (KJS::PreDecBracketNode::isIncrement):
177 (KJS::PrefixDotNode::):
178 (KJS::PrefixDotNode::precedence):
179 (KJS::PreIncDotNode::):
180 (KJS::PreIncDotNode::isIncrement):
181 (KJS::PreDecDotNode::):
182 (KJS::PreDecDotNode::isIncrement):
183 (KJS::PrefixErrorNode::):
184 (KJS::PrefixErrorNode::precedence):
185 (KJS::UnaryPlusNode::):
186 (KJS::UnaryPlusNode::precedence):
188 (KJS::NegateNode::precedence):
189 (KJS::BitwiseNotNode::):
190 (KJS::BitwiseNotNode::precedence):
191 (KJS::LogicalNotNode::):
192 (KJS::LogicalNotNode::precedence):
194 (KJS::AddNode::precedence):
195 (KJS::LeftShiftNode::):
196 (KJS::LeftShiftNode::precedence):
197 (KJS::RightShiftNode::):
198 (KJS::RightShiftNode::precedence):
199 (KJS::UnsignedRightShiftNode::):
200 (KJS::UnsignedRightShiftNode::precedence):
202 (KJS::LessNode::precedence):
203 (KJS::GreaterNode::):
204 (KJS::GreaterNode::precedence):
206 (KJS::LessEqNode::precedence):
207 (KJS::GreaterEqNode::):
208 (KJS::GreaterEqNode::precedence):
209 (KJS::InstanceOfNode::):
210 (KJS::InstanceOfNode::precedence):
212 (KJS::InNode::precedence):
214 (KJS::EqualNode::precedence):
215 (KJS::NotEqualNode::):
216 (KJS::NotEqualNode::precedence):
217 (KJS::StrictEqualNode::):
218 (KJS::StrictEqualNode::precedence):
219 (KJS::NotStrictEqualNode::):
220 (KJS::NotStrictEqualNode::precedence):
222 (KJS::BitAndNode::precedence):
224 (KJS::BitOrNode::precedence):
226 (KJS::BitXOrNode::precedence):
227 (KJS::LogicalAndNode::):
228 (KJS::LogicalAndNode::precedence):
229 (KJS::LogicalOrNode::):
230 (KJS::LogicalOrNode::precedence):
231 (KJS::ConditionalNode::):
232 (KJS::ConditionalNode::precedence):
233 (KJS::ReadModifyResolveNode::):
234 (KJS::ReadModifyResolveNode::precedence):
235 (KJS::AssignResolveNode::):
236 (KJS::AssignResolveNode::precedence):
237 (KJS::ReadModifyBracketNode::):
238 (KJS::ReadModifyBracketNode::precedence):
239 (KJS::AssignBracketNode::):
240 (KJS::AssignBracketNode::precedence):
241 (KJS::AssignDotNode::):
242 (KJS::AssignDotNode::precedence):
243 (KJS::ReadModifyDotNode::):
244 (KJS::ReadModifyDotNode::precedence):
245 (KJS::AssignErrorNode::):
246 (KJS::AssignErrorNode::precedence):
248 (KJS::CommaNode::precedence):
249 (KJS::AssignExprNode::):
250 (KJS::AssignExprNode::precedence):
251 (KJS::ExprStatementNode::):
253 (KJS::DoWhileNode::):
258 (KJS::ParameterNode::):
259 (KJS::CaseClauseNode::):
260 (KJS::CaseClauseNode::precedence):
261 (KJS::ClauseListNode::):
264 2007-11-08 Oliver Hunt <oliver@apple.com>
268 Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
270 This only improves bitwise-and performance, as the additional logic required
271 for similar code paths on or, xor, and shifting requires additional operations
272 and branches that negate (and in certain cases, regress) any advantage we might
275 This improves performance on all bitop tests, the cryptography tests, as well as
276 the string-base64 and string-unpack-code tests. No significant degradation on
280 (KJS::JSImmediate::areBothImmediateNumbers):
281 (KJS::JSImmediate::andImmediateNumbers):
283 (KJS::BitAndNode::evaluate):
285 (KJS::jsNumberFromAnd):
287 2007-11-08 Adam Roben <aroben@apple.com>
289 Stop using KJS inside of MathExtras.h
293 * wtf/MathExtras.h: Removed an unused header, and a now-unused
295 (wtf_atan2): Use std::numeric_limits intead of KJS.
297 2007-11-08 Sam Weinig <sam@webkit.org>
301 * kjs/date_object.cpp:
302 (KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
303 (KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
304 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
306 2007-11-08 Mark Rowe <mrowe@apple.com>
310 * kjs/lookup.h: Add missing include.
312 2007-11-08 Sam Weinig <sam@webkit.org>
316 Convert JavaScript internal function objects to use one class per
317 function. This avoids a switch statement inside what used to be
318 the shared function classes and will allow Shark to better analyze
321 To make this switch, the value property of the HashEntry was changed
322 to a union of an intptr_t (which is used to continue handle valueGetters)
323 and function pointer which points to a static constructor for the
324 individual new function objects.
326 SunSpider claims this is a 1.0% speedup.
328 * kjs/array_object.cpp:
329 (KJS::ArrayPrototype::getOwnPropertySlot):
331 (KJS::ArrayProtoFuncToString::callAsFunction):
332 (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
333 (KJS::ArrayProtoFuncJoin::callAsFunction):
334 (KJS::ArrayProtoFuncConcat::callAsFunction):
335 (KJS::ArrayProtoFuncPop::callAsFunction):
336 (KJS::ArrayProtoFuncPush::callAsFunction):
337 (KJS::ArrayProtoFuncReverse::callAsFunction):
338 (KJS::ArrayProtoFuncShift::callAsFunction):
339 (KJS::ArrayProtoFuncSlice::callAsFunction):
340 (KJS::ArrayProtoFuncSort::callAsFunction):
341 (KJS::ArrayProtoFuncSplice::callAsFunction):
342 (KJS::ArrayProtoFuncUnShift::callAsFunction):
343 (KJS::ArrayProtoFuncFilter::callAsFunction):
344 (KJS::ArrayProtoFuncMap::callAsFunction):
345 (KJS::ArrayProtoFuncEvery::callAsFunction):
346 (KJS::ArrayProtoFuncForEach::callAsFunction):
347 (KJS::ArrayProtoFuncSome::callAsFunction):
348 (KJS::ArrayProtoFuncIndexOf::callAsFunction):
349 (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
350 * kjs/array_object.h:
351 (KJS::ArrayPrototype::classInfo):
352 * kjs/create_hash_table:
353 * kjs/date_object.cpp:
354 (KJS::DatePrototype::getOwnPropertySlot):
355 (KJS::DateProtoFuncToString::callAsFunction):
356 (KJS::DateProtoFuncToUTCString::callAsFunction):
357 (KJS::DateProtoFuncToDateString::callAsFunction):
358 (KJS::DateProtoFuncToTimeString::callAsFunction):
359 (KJS::DateProtoFuncToLocaleString::callAsFunction):
360 (KJS::DateProtoFuncToLocaleDateString::callAsFunction):
361 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
362 (KJS::DateProtoFuncValueOf::callAsFunction):
363 (KJS::DateProtoFuncGetTime::callAsFunction):
364 (KJS::DateProtoFuncGetFullYear::callAsFunction):
365 (KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
366 (KJS::DateProtoFuncToGMTString::callAsFunction):
367 (KJS::DateProtoFuncGetMonth::callAsFunction):
368 (KJS::DateProtoFuncGetUTCMonth::callAsFunction):
369 (KJS::DateProtoFuncGetDate::callAsFunction):
370 (KJS::DateProtoFuncGetUTCDate::callAsFunction):
371 (KJS::DateProtoFuncGetDay::callAsFunction):
372 (KJS::DateProtoFuncGetUTCDay::callAsFunction):
373 (KJS::DateProtoFuncGetHours::callAsFunction):
374 (KJS::DateProtoFuncGetUTCHours::callAsFunction):
375 (KJS::DateProtoFuncGetMinutes::callAsFunction):
376 (KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
377 (KJS::DateProtoFuncGetSeconds::callAsFunction):
378 (KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
379 (KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
380 (KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
381 (KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
382 (KJS::DateProtoFuncSetTime::callAsFunction):
383 (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
384 (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
385 (KJS::DateProtoFuncSetSeconds::callAsFunction):
386 (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
387 (KJS::DateProtoFuncSetMinutes::callAsFunction):
388 (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
389 (KJS::DateProtoFuncSetHours::callAsFunction):
390 (KJS::DateProtoFuncSetUTCHours::callAsFunction):
391 (KJS::DateProtoFuncSetDate::callAsFunction):
392 (KJS::DateProtoFuncSetUTCDate::callAsFunction):
393 (KJS::DateProtoFuncSetMonth::callAsFunction):
394 (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
395 (KJS::DateProtoFuncSetFullYear::callAsFunction):
396 (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
397 (KJS::DateProtoFuncSetYear::callAsFunction):
398 (KJS::DateProtoFuncGetYear::callAsFunction):
404 (KJS::staticFunctionGetter):
405 (KJS::staticValueGetter):
406 (KJS::getStaticPropertySlot):
407 (KJS::getStaticFunctionSlot):
409 * kjs/math_object.cpp:
410 (KJS::MathObjectImp::getOwnPropertySlot):
411 (KJS::MathProtoFuncAbs::callAsFunction):
412 (KJS::MathProtoFuncACos::callAsFunction):
413 (KJS::MathProtoFuncASin::callAsFunction):
414 (KJS::MathProtoFuncATan::callAsFunction):
415 (KJS::MathProtoFuncATan2::callAsFunction):
416 (KJS::MathProtoFuncCeil::callAsFunction):
417 (KJS::MathProtoFuncCos::callAsFunction):
418 (KJS::MathProtoFuncExp::callAsFunction):
419 (KJS::MathProtoFuncFloor::callAsFunction):
420 (KJS::MathProtoFuncLog::callAsFunction):
421 (KJS::MathProtoFuncMax::callAsFunction):
422 (KJS::MathProtoFuncMin::callAsFunction):
423 (KJS::MathProtoFuncPow::callAsFunction):
424 (KJS::MathProtoFuncRandom::callAsFunction):
425 (KJS::MathProtoFuncRound::callAsFunction):
426 (KJS::MathProtoFuncSin::callAsFunction):
427 (KJS::MathProtoFuncSqrt::callAsFunction):
428 (KJS::MathProtoFuncTan::callAsFunction):
430 (KJS::MathObjectImp::classInfo):
431 (KJS::MathObjectImp::):
432 * kjs/string_object.cpp:
433 (KJS::StringPrototype::getOwnPropertySlot):
434 (KJS::StringProtoFuncToString::callAsFunction):
435 (KJS::StringProtoFuncValueOf::callAsFunction):
436 (KJS::StringProtoFuncCharAt::callAsFunction):
437 (KJS::StringProtoFuncCharCodeAt::callAsFunction):
438 (KJS::StringProtoFuncConcat::callAsFunction):
439 (KJS::StringProtoFuncIndexOf::callAsFunction):
440 (KJS::StringProtoFuncLastIndexOf::callAsFunction):
441 (KJS::StringProtoFuncMatch::callAsFunction):
442 (KJS::StringProtoFuncSearch::callAsFunction):
443 (KJS::StringProtoFuncReplace::callAsFunction):
444 (KJS::StringProtoFuncSlice::callAsFunction):
445 (KJS::StringProtoFuncSplit::callAsFunction):
446 (KJS::StringProtoFuncSubstr::callAsFunction):
447 (KJS::StringProtoFuncSubstring::callAsFunction):
448 (KJS::StringProtoFuncToLowerCase::callAsFunction):
449 (KJS::StringProtoFuncToUpperCase::callAsFunction):
450 (KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
451 (KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
452 (KJS::StringProtoFuncLocaleCompare::callAsFunction):
453 (KJS::StringProtoFuncBig::callAsFunction):
454 (KJS::StringProtoFuncSmall::callAsFunction):
455 (KJS::StringProtoFuncBlink::callAsFunction):
456 (KJS::StringProtoFuncBold::callAsFunction):
457 (KJS::StringProtoFuncFixed::callAsFunction):
458 (KJS::StringProtoFuncItalics::callAsFunction):
459 (KJS::StringProtoFuncStrike::callAsFunction):
460 (KJS::StringProtoFuncSub::callAsFunction):
461 (KJS::StringProtoFuncSup::callAsFunction):
462 (KJS::StringProtoFuncFontcolor::callAsFunction):
463 (KJS::StringProtoFuncFontsize::callAsFunction):
464 (KJS::StringProtoFuncAnchor::callAsFunction):
465 (KJS::StringProtoFuncLink::callAsFunction):
466 * kjs/string_object.h:
468 2007-11-08 Adam Roben <aroben@apple.com>
472 Reviewed by Sam and Ada.
474 * wtf/MathExtras.h: Get rid of a circular #include dependency to fix
477 2007-11-08 Adam Roben <aroben@apple.com>
479 Fix a precedence warning on Windows
482 (KJS::JSImmediate::toBoolean):
484 2007-11-08 Mark Rowe <mrowe@apple.com>
486 Build fix for JavaScriptGlue.
488 * wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
490 2007-11-08 Darin Adler <darin@apple.com>
494 * kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
496 2007-11-08 Oliver Hunt <oliver@apple.com>
500 Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
502 Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
503 we should now have faster array access, faster immediate to double conversion, and the
504 potential to further improve bitwise operators in future.
506 This also removes the need for unions to avoid strict aliasing problems when extracting
507 a value from immediates.
511 (KJS::JSImmediate::trueImmediate):
512 (KJS::JSImmediate::falseImmediate):
513 (KJS::JSImmediate::undefinedImmediate):
514 (KJS::JSImmediate::nullImmediate):
515 (KJS::JSImmediate::toBoolean):
519 2007-11-07 Eric Seidel <eric@webkit.org>
521 Reviewed by Darin and Oliver.
523 Add evaluateToNumber parallel evaluation tree to speed up number operations.
524 Make ImmediateNumberNode a subclass of NumberNode.
525 Share evaluate logic between evaluate and evaluateToNumber using inline functions
526 There is still a lot of improvement to be made here.
528 SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
529 Given the huge win that this prepares us for with simple type inferencing I see the small
530 regression in base64 being worth the substantial overall improvement.
534 (KJS::Node::evaluateToNumber):
535 (KJS::NumberNode::evaluate):
536 (KJS::NumberNode::evaluateToNumber):
537 (KJS::StringNode::evaluateToNumber):
538 (KJS::LocalVarAccessNode::inlineEvaluate):
539 (KJS::LocalVarAccessNode::evaluate):
540 (KJS::LocalVarAccessNode::evaluateToNumber):
541 (KJS::BracketAccessorNode::inlineEvaluate):
542 (KJS::BracketAccessorNode::evaluate):
543 (KJS::BracketAccessorNode::evaluateToNumber):
544 (KJS::NegateNode::evaluate):
545 (KJS::NegateNode::evaluateToNumber):
546 (KJS::MultNode::inlineEvaluateToNumber):
547 (KJS::MultNode::evaluate):
548 (KJS::MultNode::evaluateToNumber):
549 (KJS::DivNode::inlineEvaluateToNumber):
550 (KJS::DivNode::evaluate):
551 (KJS::DivNode::evaluateToNumber):
552 (KJS::ModNode::inlineEvaluateToNumber):
553 (KJS::ModNode::evaluate):
554 (KJS::ModNode::evaluateToNumber):
555 (KJS::throwOutOfMemoryErrorToNumber):
556 (KJS::addSlowCaseToNumber):
559 (KJS::AddNode::evaluateToNumber):
560 (KJS::SubNode::inlineEvaluateToNumber):
561 (KJS::SubNode::evaluate):
562 (KJS::SubNode::evaluateToNumber):
563 (KJS::valueForReadModifyAssignment):
564 (KJS::ReadModifyLocalVarNode::evaluate):
565 (KJS::ReadModifyResolveNode::evaluate):
566 (KJS::ReadModifyDotNode::evaluate):
567 (KJS::ReadModifyBracketNode::evaluate):
571 (KJS::ImmediateNumberNode::):
572 (KJS::AddNode::precedence):
573 * kjs/nodes2string.cpp:
574 (KJS::NumberNode::streamTo):
576 2007-11-07 Mark Rowe <mrowe@apple.com>
580 Fix up initialization after being mangled in r27572, and remove the
581 ternary expression as extraCost will always be zero for the numeric
585 (KJS::Collector::heapAllocate):
587 2007-11-07 Mark Rowe <mrowe@apple.com>
591 * kjs/regexp_object.cpp:
593 2007-11-07 Geoffrey Garen <ggaren@apple.com>
595 Reviewed by Beth Dakin.
597 Eliminated a bogus (though compiled-out) branch in the collector.
600 (KJS::Collector::heapAllocate):
602 2007-11-06 Geoffrey Garen <ggaren@apple.com>
604 Reviewed by Darin Adler.
606 Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861
607 5.8% of string-validate-input.js is spent creating RegExpImps
609 Put RegExpImp properties into a static hashtable to avoid a slew of
610 PropertyMap churn when creating a RegExpImp.
612 Factored important bits of regular expression implementation out of
613 RegExpImp (the JS object) and into RegExp (the PCRE wrapper class),
614 making RegExp a ref-counted class. (This will help later.)
616 Removed PCRE_POSIX support because I didn't quite know how to test it
617 and keep it working with these changes.
619 1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
621 * kjs/regexp.h: A few interface changes:
622 1. Renamed "subpatterns()" => "numSubpatterns()"
623 2. Made flag enumeration private and replaced it with public getters for
625 3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
626 4. Made RegExp take a string of flags instead of an int, eliminating
627 duplicated flag parsing code elsewhere.
629 * kjs/regexp_object.cpp:
630 (KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile:
631 - Fixed a bug where compile(undefined) would throw an exception.
632 - Removed some now-redundant code.
633 - Used RegExp sharing to eliminate an allocation and a bunch of
634 PropertyMap thrash. (Not a big win since compile is a deprecated
635 function. I mainly did this to test the plubming.)
637 2007-11-07 Simon Hausmann <hausmann@kde.org>
639 Reviewed by nobody, Qt/Windows build fix.
641 JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
642 testkjs.pro, too, where it's included from.
646 2007-11-07 Simon Hausmann <shausman@trolltech.com>
650 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.
652 * JavaScriptCore.pri:
655 2007-11-07 Lars Knoll <lars@trolltech.com>
661 Pretty embarrassing bug. Has the potential to fix quite a few test failures.
663 * wtf/unicode/qt4/UnicodeQt4.h:
664 (WTF::Unicode::umemcasecmp):
666 2007-11-06 Maciej Stachowiak <mjs@apple.com>
670 - only collect when the heap is full, unless we have lots of extra cost garbage
672 1.1% SunSpider speedup.
674 This shouldn't hit memory use much since the extra space in those
675 blocks hangs around either way.
678 (KJS::Collector::heapAllocate):
679 (KJS::Collector::collect): Fix logic error that reversed the sense of collect's
682 2007-11-06 Oliver Hunt <oliver@apple.com>
686 Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
688 We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
689 'for (...; ...; ++<var>) ...'.
692 (KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
693 (KJS::PostIncLocalVarNode::evaluate):
694 (KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
695 (KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
696 (KJS::PostDecLocalVarNode::evaluate):
697 (KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
699 (KJS::PrePostResolveNode::):
700 (KJS::PostIncResolveNode::):
701 (KJS::PostIncLocalVarNode::):
702 (KJS::PostDecResolveNode::):
703 (KJS::PostDecLocalVarNode::):
704 (KJS::PreIncResolveNode::):
705 (KJS::PreDecResolveNode::):
706 (KJS::ForNode::ForNode):
708 2007-11-06 Eric Seidel <eric@webkit.org>
712 This fixes a regressed layout test for string + object
714 SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
717 (KJS::add): remove erroneous "fast path" for string + *
719 2007-11-06 Geoffrey Garen <ggaren@apple.com>
721 Reviewed by Eric Seidel.
723 Added toJSNumber, a fast path for converting a JSValue to a JS number,
724 and deployed it in postfix expressions. In the fast case this
725 eliminates a call to jsNumber.
727 0.4% speedup on SunSpider.
731 (KJS::PostIncResolveNode::evaluate):
732 (KJS::PostIncLocalVarNode::evaluate):
733 (KJS::PostDecResolveNode::evaluate):
734 (KJS::PostDecLocalVarNode::evaluate):
735 (KJS::PostIncBracketNode::evaluate):
736 (KJS::PostDecBracketNode::evaluate):
737 (KJS::PostIncDotNode::evaluate):
738 (KJS::PostDecDotNode::evaluate):
739 (KJS::UnaryPlusNode::evaluate):
741 (KJS::JSValue::toJSNumber):
743 2007-11-06 Darin Adler <darin@apple.com>
747 - http://bugs.webkit.org/show_bug.cgi?id=15846
748 REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
750 There was a mistake in the algorithm used to find an empty slot in the property
751 map entries vector; when we were putting in a new property value and not overwriting
752 an existing deleted sentinel, we would enlarge the entries vector, but would not
753 overwrite the stale data that's in the new part. It was easy to pin this down by
754 turning on property map consistency checks -- I never would have landed with this
755 bug if I had run the regression tests once with consistency checks on!
757 * kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
758 foundDeletedElement is false to always use the item at the end of the entries vector.
759 Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
761 2007-11-06 Oliver Hunt <oliver@apple.com>
765 Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
770 2007-11-06 Oliver Hunt <oliver@apple.com>
774 Replace boolean comparisons in AddNode with mask
775 comparisons for a 0.2% improvement in sunspider.
777 * JavaScriptCore.xcodeproj/project.pbxproj:
781 2007-11-06 Eric Seidel <eric@webkit.org>
785 SunSpider claims this is a 1.1% speedup.
788 (KJS::throwOutOfMemoryError): Added, non inline.
789 (KJS::addSlowCase): renamed from add(), non inline.
790 (KJS::add): add fast path for String + String, Number + Number and String + *
792 2007-11-06 Eric Seidel <eric@webkit.org>
796 Avoid more UString creation.
798 SunSpider claims this is a 0.4% speedup.
800 * kjs/regexp_object.cpp:
801 (KJS::RegExpObjectImp::construct): use UString::find(UChar)
803 2007-11-05 Mark Rowe <mrowe@apple.com>
807 * kjs/array_object.cpp:
808 (KJS::ArrayProtoFunc::callAsFunction):
810 2007-11-05 Adam Roben <aroben@apple.com>
816 2007-11-05 Mark Rowe <mrowe@apple.com>
818 Build fix. Add missing #include.
820 * kjs/operations.cpp:
822 2007-11-05 Eric Seidel <eric@webkit.org>
826 Remove another call to toString(exec)
828 SunSpider claims this is a 0.5% speedup.
830 * kjs/operations.cpp:
831 (KJS::equal): remove another toString
833 2007-11-05 Eric Seidel <eric@webkit.org>
835 * kjs/operations.cpp:
836 (KJS::equal): correct broken change.
838 2007-11-05 Eric Seidel <eric@webkit.org>
842 Remove one more call to toString(exec).
844 SunSpider claims this is a 0.7% speedup.
846 * kjs/operations.cpp:
847 (KJS::equal): remove a call to toString()
849 2007-11-05 Mark Rowe <mrowe@apple.com>
855 2007-11-05 Mark Rowe <mrowe@apple.com>
861 2007-11-05 Geoffrey Garen <ggaren@apple.com>
863 Touched a file to test my new HTTP access.
865 * kjs/scope_chain.cpp:
867 2007-11-05 Alp Toker <alp@atoker.com>
869 Unreviewed build fix for qmake-based ports.
871 Someone with a better understanding of qmake still needs to sort out
872 the INCLUDEPATH/DEPENDPATH mess.
874 * JavaScriptCore.pri:
876 2007-11-05 Geoffrey Garen <ggaren@apple.com>
878 Reviewed by Darin Adler.
880 http://bugs.webkit.org/show_bug.cgi?id=15835
882 Switched List implementation from a custom heap allocator to an inline
883 Vector, for a disappointing .5% SunSpider speedup.
885 Also renamed List::slice to List::getSlice because "get" is the
886 conventional prefix for functions returning a value through an out
889 * kjs/array_object.cpp:
890 (KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
891 calls and memory accesses.
893 * kjs/bool_object.cpp:
894 (BooleanObjectImp::construct): Removed questionable use of iterator.
897 * kjs/list.h: New List class, implemented in terms of Vector. Two
898 interesting differences:
899 1. The inline capacity is 8, not 5. Many of the Lists constructed
900 during a SunSpider run are larger than 5; almost none are larger
903 2. The growth factor is 4, not 2. Since we can guarantee that Lists
904 aren't long-lived, we can grow them more aggressively, to avoid
907 * kjs/regexp_object.cpp:
908 (RegExpObjectImp::construct): Removed redundant function calls.
910 * kjs/string_object.cpp:
911 (KJS::StringObjectImp::construct): Removed questionable use of iterator.
914 (WTF::::uncheckedAppend): Added a fast, unchecked version of append.
916 2007-11-05 Mark Rowe <mrowe@apple.com>
918 Reviewed by Alp Toker.
920 Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
922 * JavaScriptCore.pri:
925 2007-11-04 Darin Adler <darin@apple.com>
929 - http://bugs.webkit.org/show_bug.cgi?id=15826
930 optimize opcode loop and case insensitive ASCII compares for a 30% speedup
932 SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
934 * pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
936 * pcre/pcre_compile.c:
937 (find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
938 added OP_NOT since there was no reason it should not be in here.
939 (could_be_empty_branch): Ditto.
940 (compile_branch): Streamlined all the single-character cases; there was a bit of
941 duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
942 But in particular, compile to those opcodes when the single character match is
944 (find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
946 * pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
947 the matchframe, after I discovered that none of them needed to be saved and restored
948 across recursive match calls. Also eliminated the ignored result field from the
949 matchframe, since I discovered that rrc ("recursive result code") was already the
950 exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
951 statement of the switch instead of doing them before the switch. This removes a
952 branch from each iteration of the opcode interpreter, just as removal of "op"
953 removed at least one store from each iteration. Last, but not least, add the
954 OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
955 surrogate pair and the letter case can be handled efficiently.
957 2007-11-04 Darin Adler <darin@apple.com>
959 * pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
961 2007-11-03 Darin Adler <darin@apple.com>
963 - fix non-Mac builds; remove some more unused PCRE stuff
965 * pcre/pcre_compile.c:
966 (compile_branch): Removed branch chain and some unused ESC values.
967 (compile_regex): Ditto.
968 (jsRegExpCompile): Ditto.
970 (match): Removed unused branch targets. Don't use macros any more.
971 (jsRegExpExecute): More of the same.
973 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
974 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
975 * pcre/pcre.pri: Ditto.
977 * pcre/MERGING: Removed.
978 * pcre/pcre_fullinfo.c: Removed.
979 * pcre/pcre_get.c: Removed.
980 * pcre/pcre_internal.h:
981 * pcre/ucp.h: Removed.
983 2007-11-03 Darin Adler <darin@apple.com>
987 - http://bugs.webkit.org/show_bug.cgi?id=15821
988 remove unused PCRE features for speed
990 A first step toward removing the PCRE features we don't use.
991 This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
992 the SunSpider regular expression test.
994 Replaced the public interface with one that doesn't use the
995 name PCRE. Removed code we don't need for JavaScript and various
996 configurations we don't use. This is in preparation for still
997 more changes in the future. We'll probably switch to C++ and
998 make some even more significant changes to the regexp engine
999 to get some additional speed.
1001 There's probably additional unused stuff that I haven't
1004 This does mean that our PCRE is now a fork, but I think that's
1005 not really a big deal.
1007 * JavaScriptCore.exp: Remove the 5 old entry points and add
1008 the 3 new entry points for WebCore's direct use of the regular
1011 * kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
1012 its sense and now there's a USE(POSIX_REGEX) instead, which should
1013 probably not be set by anyone. Maybe later we'll just get rid of it
1018 (KJS::RegExp::RegExp): Switch to new jsRegExp function names and
1019 defines. Cut down on the number of functions used.
1020 (KJS::RegExp::~RegExp): Ditto.
1021 (KJS::RegExp::match): Ditto.
1023 * pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
1026 * pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
1027 size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
1028 POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
1029 and JAVASCRIPT. These are all no longer configurable in our copy
1032 * pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
1033 version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
1034 the include of <stdlib.h>, and most of the constants and
1035 functions defined in this header. Changed the naming scheme to
1036 use a JSRegExp prefix rather than a pcre prefix. In the future,
1037 we'll probably change this to be a C++ header.
1039 * pcre/pcre_compile.c: Removed all unused code branches,
1040 including many whole functions and various byte codes.
1041 Kept changes outside of removal to a minimum.
1043 (first_significant_code):
1046 (could_be_empty_branch):
1051 (find_firstassertedchar):
1052 (jsRegExpCompile): Renamed from pcre_compile2 and changed the
1053 parameters around a bit.
1054 (jsRegExpFree): Added.
1056 * pcre/pcre_exec.c: Removed many unused opcodes and variables.
1057 Also started tearing down the NO_RECURSE mechanism since it's
1058 now the default. In some cases there were things in the explicit
1059 frame that could be turned into plain old local variables and
1060 other small like optimizations.
1063 (match): Changed parameters quite a bit since it's now not used
1065 (jsRegExpExecute): Renamed from pcre_exec.
1067 * pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
1068 PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
1069 PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
1070 PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
1071 _pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
1072 and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
1074 * pcre/pcre_maketables.c: Changed to only compile in dftables.
1075 Also got rid of many of the tables that we don't use.
1077 * pcre/pcre_tables.c: Removed the unused Unicode property tables.
1079 * pcre/pcre_ucp_searchfuncs.c: Removed everything except for
1080 _pcre_ucp_othercase.
1082 * pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
1083 for classes based on Unicode properties.
1085 * wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
1086 to eliminate this completely, but we need the regular expression
1087 code to be C++ first.
1089 * pcre/pcre_fullinfo.c:
1092 Files that are no longer needed. I didn't remove them with this
1093 check-in, because I didn't want to modify all the project files.
1095 2007-11-03 Maciej Stachowiak <mjs@apple.com>
1099 - remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
1101 It turns out that doing this check costs more than it saves.
1103 * kjs/JSImmediate.h:
1104 (KJS::JSImmediate::fromDouble):
1106 2007-11-03 Sam Weinig <sam@webkit.org>
1110 Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
1111 The variable had been kept around for binary compatibility, but since nothing
1112 else is there is no point in continuing to keep it around.
1114 * API/JSCallbackConstructor.cpp:
1116 * API/JSCallbackFunction.cpp:
1118 * API/JSCallbackObject.cpp:
1120 * bindings/objc/objc_runtime.mm:
1121 * bindings/runtime_array.cpp:
1122 * bindings/runtime_object.cpp:
1123 * kjs/array_instance.cpp:
1125 * kjs/array_object.cpp:
1127 * kjs/bool_object.cpp:
1128 * kjs/date_object.cpp:
1130 * kjs/error_object.cpp:
1136 * kjs/math_object.cpp:
1137 * kjs/number_object.cpp:
1139 * kjs/regexp_object.cpp:
1140 * kjs/string_object.cpp:
1143 2007-11-03 Kevin McCullough <kmccullough@apple.com>
1145 - Updated testkjs results to make the build bots green until we
1146 can fix the tests that are failing. The new failures are in DST.
1148 * tests/mozilla/expected.html:
1150 2007-11-03 Maciej Stachowiak <mjs@apple.com>
1154 - don't print the var twice for ForInNodes with a var declaration
1156 * kjs/nodes2string.cpp:
1157 (KJS::ForInNode::streamTo):
1159 2007-11-03 Darin Adler <darin@apple.com>
1161 * pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
1162 C-incompatible declaration.
1164 2007-11-03 Mark Rowe <mrowe@apple.com>
1168 * kjs/nodes.cpp: Add missing include.
1170 2007-11-03 Darin Adler <darin@apple.com>
1174 - fix http://bugs.webkit.org/show_bug.cgi?id=15814
1175 <rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
1177 These changes cause us to match the JavaScript specification and pass the
1178 fast/js/kde/encode_decode_uri.html test.
1180 * kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
1181 new strict mode, throwing an exception if there are malformed UTF-16 surrogate
1184 * kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
1186 (KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
1187 those might be illegal in some sense, they aren't supposed to get any special
1188 handling in the place where this function is currently used.
1189 (KJS::UString::UTF8String): Added the strictness.
1191 2007-11-03 Darin Adler <darin@apple.com>
1195 - http://bugs.webkit.org/show_bug.cgi?id=15812
1196 some JavaScript tests (from the Mozilla test suite) are failing
1198 Two or three fixes get 7 more of the Mozilla tests passing.
1199 This gets us down from 61 failing tests to 54.
1201 * kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
1202 Made this inline and gave it a more specific type. Some day we should
1203 probably do that for all of these -- might even get a bit of a speed
1205 * kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
1206 inline in the header.
1208 * kjs/regexp_object.h:
1209 * kjs/regexp_object.cpp:
1210 (KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
1211 switch statement into the RegExpImp object, so they can be shared with
1212 RegExpImp::callAsFunction.
1213 (KJS::RegExpImp::match): Added. Common code used by both test and exec.
1214 (KJS::RegExpImp::test): Added.
1215 (KJS::RegExpImp::exec): Added.
1216 (KJS::RegExpImp::implementsCall): Added.
1217 (KJS::RegExpImp::callAsFunction): Added.
1218 (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
1219 lastInput to null rather than empty string -- we take advantage of the
1220 difference in RegExpImp::match.
1221 (KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
1222 just to get at a field like this.
1224 * pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
1225 the JavaScript specification. If there are not 4 hex digits after the \u,
1226 then it's processed as if it wasn't an escape sequence at all.
1228 * pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
1229 for JavaScript (4 specific Unicode values).
1231 (match): Changed all call sites to use IS_NEWLINE.
1234 * tests/mozilla/expected.html: Updated to expect 7 more successful tests.
1236 2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
1238 Sort files(...); sections of Xcode project files.
1240 Rubber-stamped by Darin.
1242 * JavaScriptCore.xcodeproj/project.pbxproj:
1244 2007-11-03 Maciej Stachowiak <mjs@apple.com>
1248 - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
1252 (KJS::VarDeclNode::optimizeVariableAccess):
1253 (KJS::VarDeclNode::getDeclarations):
1254 (KJS::VarDeclNode::handleSlowCase):
1255 (KJS::VarDeclNode::evaluateSingle):
1256 (KJS::VarDeclNode::evaluate):
1257 (KJS::VarStatementNode::execute):
1259 (KJS::VarDeclNode::):
1260 (KJS::VarStatementNode::):
1261 * kjs/nodes2string.cpp:
1262 (KJS::VarDeclNode::streamTo):
1264 2007-11-03 Alexey Proskuryakov <ap@webkit.org>
1268 http://bugs.webkit.org/show_bug.cgi?id=15800
1269 REGRESSION (r27303): RegExp leaks
1271 * kjs/regexp_object.h:
1272 (KJS::RegExpImp::setRegExp):
1273 (KJS::RegExpImp::regExp):
1274 (KJS::RegExpImp::classInfo):
1275 * kjs/regexp_object.cpp:
1276 (RegExpImp::RegExpImp):
1277 (RegExpImp::~RegExpImp):
1278 Renamed reg member variable to m_regExp, changed it to use OwnPtr.
1280 2007-11-02 Maciej Stachowiak <mjs@apple.com>
1284 - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
1288 (KJS::statementListPushFIFO):
1289 (KJS::statementListGetDeclarations):
1290 (KJS::statementListInitializeDeclarationStacks):
1291 (KJS::statementListInitializeVariableAccessStack):
1292 (KJS::statementListExecute):
1293 (KJS::BlockNode::BlockNode):
1294 (KJS::FunctionBodyNode::FunctionBodyNode):
1295 (KJS::ProgramNode::ProgramNode):
1297 (KJS::CaseClauseNode::):
1299 2007-11-02 Darin Adler <darin@apple.com>
1303 - http://bugs.webkit.org/show_bug.cgi?id=15791
1304 change property map data structure for less memory use, better speed
1306 The property map now has an array of indices and a separate array of
1307 property map entries. This slightly slows down lookup because of a second
1308 memory acess, but makes property maps smaller and faster to iterate in
1309 functions like mark().
1311 SunSpider says this is 1.2% faster, although it makes the bitwise-end test
1312 more than 10% slower. To fix that we'll need to optimize global variable lookup.
1314 * kjs/property_map.cpp:
1315 (KJS::PropertyMapEntry::PropertyMapEntry):
1316 (KJS::PropertyMapHashTable::entries):
1317 (KJS::PropertyMapHashTable::allocationSize):
1318 (KJS::SavedProperties::SavedProperties):
1319 (KJS::SavedProperties::~SavedProperties):
1320 (KJS::PropertyMap::checkConsistency):
1321 (KJS::PropertyMap::~PropertyMap):
1322 (KJS::PropertyMap::clear):
1323 (KJS::PropertyMap::get):
1324 (KJS::PropertyMap::getLocation):
1325 (KJS::PropertyMap::put):
1326 (KJS::PropertyMap::insert):
1327 (KJS::PropertyMap::createTable):
1328 (KJS::PropertyMap::rehash):
1329 (KJS::PropertyMap::remove):
1330 (KJS::PropertyMap::mark):
1331 (KJS::comparePropertyMapEntryIndices):
1332 (KJS::PropertyMap::containsGettersOrSetters):
1333 (KJS::PropertyMap::getEnumerablePropertyNames):
1334 (KJS::PropertyMap::save):
1335 (KJS::PropertyMap::restore):
1336 * kjs/property_map.h:
1338 2007-11-02 Darin Adler <darin@apple.com>
1342 - http://bugs.webkit.org/show_bug.cgi?id=15807
1343 HashMap needs a take() function that combines get and remove
1345 * wtf/HashMap.h: Added take function. Simplistic implementation for now,
1346 but still does only one hash table lookup.
1348 * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
1349 a find followed by a remove.
1351 2007-11-02 David Carson <dacarson@gmail.com>
1355 Fix compiler warning "warning: suggest parentheses around && within ||"
1356 http://bugs.webkit.org/show_bug.cgi?id=15764
1358 * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
1360 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1362 Reviewed by Maciej Stachowiak.
1364 In preparation for making List a simple stack-allocated Vector:
1366 Removed all instances of List copying and/or assignment, and made List
1367 inherit from Noncopyable.
1369 Functions that used to return a List by copy now take List& out
1372 Layout tests and JS tests pass.
1375 (KJS::List::slice): Replaced copyTail with a more generic slice
1376 alternative. (JavaScriptCore only calls slice(1), but WebCore calls
1379 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1381 Reviewed by Maciej Stachowiak.
1383 Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
1384 REGRESSION(r27344): Crash on load at finance.yahoo.com
1386 Reverted a small portion of my last check-in. (The speedup and the List
1387 removal are still there, though.)
1389 ActivationImp needs to hold a pointer to its function, and mark that
1390 pointer (rather than accessing its function through its ExecState, and
1391 counting on the active scope to mark its function) because a closure
1392 can cause an ActivationImp to outlive its ExecState along with any
1395 * kjs/ExecState.cpp:
1396 (KJS::ExecState::ExecState):
1398 (KJS::FunctionImp::~FunctionImp):
1399 (KJS::ActivationImp::ActivationImp):
1401 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
1403 Also made HashTable a little more crash-happy in debug builds, so
1404 problems like this will show up earlier:
1407 (WTF::HashTable::~HashTable):
1409 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1411 Reviewed by Adam Roben.
1413 Addressed some of Darin's review comments.
1415 Used perl -p, which is the shorthand while(<>) {}.
1417 Made sure not to suppress bison's output.
1419 Added line to removed bison_out.txt, since this script removes other
1420 intermediate files, too.
1422 * DerivedSources.make:
1424 2007-11-01 Geoffrey Garen <ggaren@apple.com>
1426 Reviewed by Oliver Hunt.
1428 Removed List from ActivationImp, in preparation for making all lists
1433 1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
1435 * kjs/ExecState.cpp:
1436 (KJS::ExecState::ExecState):
1437 (KJS::ExecState::~ExecState):
1439 (KJS::ActivationImp::ActivationImp):
1440 (KJS::ActivationImp::createArgumentsObject):
1442 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
1444 2007-11-01 Adam Roben <aroben@apple.com>
1446 Use jsNumberCell instead of jsNumber when converting double constants to JSValues
1448 This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
1449 ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
1451 It also gets rid of an MSVC warning that we previously had to silence.
1455 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
1456 back on the "overflow in constant arithmetic" warning.
1457 * kjs/number_object.cpp:
1458 (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
1461 2007-10-31 Adam Roben <aroben@apple.com>
1467 2007-10-31 Maciej Stachowiak <mjs@apple.com>
1471 - shave some cycles off of local storage access for a 1% SunSpider speedup
1473 Keep the LocalStorage pointer in the ExecState, instead of getting
1474 it from the ActivationImp all the time.
1476 * kjs/ExecState.cpp:
1477 (KJS::ExecState::updateLocalStorage):
1479 (KJS::ExecState::localStorage):
1481 (KJS::LocalVarAccessNode::evaluate):
1482 (KJS::LocalVarFunctionCallNode::evaluate):
1483 (KJS::PostIncLocalVarNode::evaluate):
1484 (KJS::PostDecLocalVarNode::evaluate):
1485 (KJS::LocalVarTypeOfNode::evaluate):
1486 (KJS::PreIncLocalVarNode::evaluate):
1487 (KJS::PreDecLocalVarNode::evaluate):
1488 (KJS::ReadModifyLocalVarNode::evaluate):
1489 (KJS::AssignLocalVarNode::evaluate):
1490 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
1492 2007-10-31 Adam Roben <aroben@apple.com>
1494 Fix a crash on launch due to a static initializer race
1496 We now use fast inline assembler spinlocks which can be statically
1497 initialized at compile time.
1499 As a side benefit, this speeds up SunSpider by 0.4%.
1503 * wtf/FastMalloc.cpp:
1505 (TCMalloc_SpinLock::Lock):
1506 (TCMalloc_SpinLock::Unlock):
1507 (TCMalloc_SlowLock):
1508 * wtf/TCSystemAlloc.cpp:
1510 2007-10-31 Kevin McCullough <kmccullough@apple.com>
1514 - Corrected spelling.
1518 2007-10-31 Mark Rowe <mrowe@apple.com>
1520 Further Gtk build fixage.
1522 * kjs/regexp_object.cpp:
1524 2007-10-31 Mark Rowe <mrowe@apple.com>
1530 2007-10-31 Darin Adler <darin@apple.com>
1534 - fix http://bugs.webkit.org/show_bug.cgi?id=15749
1535 RegExp/RegExpObjectImp cause needless UString creation
1537 Speeds things up 0.4% according to SunSpider.
1539 * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
1540 because this library doesn't use the real PCRE -- it uses its
1541 own PCRE that works on UTF-16.
1543 * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
1544 Use Noncopyable. Change the return value of match.
1546 (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
1547 (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
1548 (KJS::RegExp::match): Change to return the position as an int and the
1549 ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
1551 * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
1552 require a result string.
1553 * kjs/regexp_object.cpp:
1554 (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
1555 (RegExpObjectImp::performMatch): Change so it doesn't return a string.
1556 (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
1557 the main result with the backreferences; now it doesn't need to take
1559 (RegExpObjectImp::getBackref): Minor tweaks.
1560 (RegExpObjectImp::getLastParen): Ditto.
1561 (RegExpObjectImp::getLeftContext): Ditto.
1562 (RegExpObjectImp::getRightContext): Ditto.
1563 (RegExpObjectImp::getValueProperty): Change LastMatch case to call
1564 getBackref(0) so we don't need a separate getLastMatch function.
1566 * kjs/string_object.cpp:
1567 (KJS::replace): Update to use new performMatch, including merging the
1568 matched string section with the other substrings.
1569 (KJS::StringProtoFunc::callAsFunction): Update functions to use the
1570 new performMatch and match. Also change to use OwnArrayPtr.
1572 2007-10-31 Oliver Hunt <oliver@apple.com>
1574 * kjs/nodes.h: include OwnPtr.h
1576 2007-10-31 Oliver Hunt <oliver@apple.com>
1580 Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
1584 (KJS::statementListPushFIFO):
1585 (KJS::statementListGetDeclarations):
1586 (KJS::statementListInitializeDeclarationStacks):
1587 (KJS::statementListInitializeVariableAccessStack):
1588 (KJS::statementListExecute):
1589 (KJS::BlockNode::optimizeVariableAccess):
1590 (KJS::BlockNode::BlockNode):
1591 (KJS::BlockNode::getDeclarations):
1592 (KJS::BlockNode::execute):
1593 (KJS::CaseClauseNode::optimizeVariableAccess):
1594 (KJS::CaseClauseNode::getDeclarations):
1595 (KJS::CaseClauseNode::evalStatements):
1596 (KJS::FunctionBodyNode::initializeDeclarationStacks):
1597 (KJS::FunctionBodyNode::optimizeVariableAccess):
1599 * kjs/nodes2string.cpp:
1600 (KJS::statementListStreamTo):
1601 (KJS::BlockNode::streamTo):
1602 (KJS::CaseClauseNode::streamTo):
1604 2007-10-30 Mark Rowe <mrowe@apple.com>
1606 * kjs/property_map.cpp: Added a missing using directive to fix the build
1607 for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
1609 2007-10-31 Maciej Stachowiak <mjs@apple.com>
1611 * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
1614 2007-10-31 Alexey Proskuryakov <ap@webkit.org>
1618 http://bugs.webkit.org/show_bug.cgi?id=11001
1619 WebKit doesn't support RegExp.compile method
1621 Test: fast/js/regexp-compile.html
1623 * kjs/regexp_object.cpp:
1624 (RegExpPrototype::RegExpPrototype):
1625 (RegExpProtoFunc::callAsFunction):
1626 * kjs/regexp_object.h:
1627 (KJS::RegExpProtoFunc::):
1628 Added RegExp.compile.
1630 * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
1632 2007-10-31 Maciej Stachowiak <mjs@apple.com>
1636 - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
1638 Integer divide sucks. Fortunately, a bunch of shifts and XORs
1639 biased towards the high bits is sufficient to provide a good
1640 double hash. Besides the SunSpider win, I used the dump statistics
1641 mode for both to verify that collisions did not increase and that
1642 the longest collision chain is not any longer.
1644 * kjs/property_map.cpp:
1646 (KJS::PropertyMap::get):
1647 (KJS::PropertyMap::getLocation):
1648 (KJS::PropertyMap::put):
1649 (KJS::PropertyMap::insert):
1650 (KJS::PropertyMap::remove):
1651 (KJS::PropertyMap::checkConsistency):
1655 (WTF::::lookupForWriting):
1656 (WTF::::fullLookupForWriting):
1659 2007-10-30 Adam Roben <aroben@apple.com>
1661 * kjs/collector.h: Make HeapType public so it can be used for non-member
1662 things like the HeapConstants struct template. Fixes the build on Windows.
1664 2007-10-30 Adam Roben <aroben@apple.com>
1666 Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
1668 Speeds up SunSpider by 0.4%.
1670 Reviewed by Steve and Maciej.
1672 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
1673 a warning during LTCG in release builds about double -> float
1675 * wtf/AlwaysInline.h:
1678 2007-10-30 Adam Roben <aroben@apple.com>
1680 Use GetCurrentThreadId instead of pthread_self in FastMalloc
1682 Speeds up SunSpider by 0.3%.
1686 * wtf/FastMalloc.cpp:
1687 (WTF::TCMalloc_ThreadCache::InitTSD):
1688 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
1690 2007-10-30 Adam Roben <aroben@apple.com>
1692 Switch to a Win32 critical section implementation of spinlocks
1694 Speeds up SunSpider by 0.4%.
1698 * wtf/FastMalloc.cpp:
1700 (TCMalloc_SpinLock::TCMalloc_SpinLock):
1701 (TCMalloc_SpinLock::Init):
1702 (TCMalloc_SpinLock::Finalize):
1703 (TCMalloc_SpinLock::Lock):
1704 (TCMalloc_SpinLock::Unlock):
1705 * wtf/TCSystemAlloc.cpp:
1707 2007-10-30 Adam Roben <aroben@apple.com>
1709 Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
1711 http://bugs.webkit.org/show_bug.cgi?id=15586
1713 Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
1715 Use Win32 TLS functions instead of __declspec(thread), which breaks
1720 * wtf/FastMalloc.cpp:
1721 (WTF::getThreadHeap):
1722 (WTF::TCMalloc_ThreadCache::InitModule):
1724 2007-10-30 Maciej Stachowiak <mjs@apple.com>
1728 - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
1729 http://bugs.webkit.org/show_bug.cgi?id=15772
1731 We do this by using a single mark bit per two number cells, and
1734 Besides being an 0.5% win overall, this is a 7.1% win on morph.
1736 * kjs/collector.cpp:
1738 (KJS::Collector::heapAllocate):
1739 (KJS::Collector::markStackObjectsConservatively):
1740 (KJS::Collector::sweep):
1742 (KJS::SmallCollectorCell::):
1744 2007-10-30 Geoffrey Garen <ggaren@apple.com>
1746 Reviewed by Adam Roben, Sam Weinig.
1748 Made conflicts in grammar.y a persistent build failure.
1750 * DerivedSources.make:
1752 2007-10-30 Kevin McCullough <kmccullough@apple.com>
1754 Reviewed by Adam and Geoff.
1756 - Added a new cast so all the casts are in the same place.
1761 2007-10-30 Geoffrey Garen <ggaren@apple.com>
1763 Reviewed by Darin Adler.
1765 Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
1769 ecma_2/Statements/dowhile-001.js
1770 ecma_2/Statements/dowhile-002.js
1771 ecma_2/Statements/dowhile-003.js
1772 ecma_2/Statements/dowhile-004.js
1773 ecma_2/Statements/dowhile-005.js
1774 ecma_2/Statements/dowhile-006.js
1775 ecma_2/Statements/dowhile-007.js
1776 js1_2/statements/do_while.js
1778 and layout tests, including
1780 do-while-expression-value.html
1781 do-while-semicolon.html
1782 do-while-without-semicolon.html
1786 * kjs/grammar.y: Use the explicit "error" production, as we do with other
1787 automatic semicolon insertions, to disambiguate "do { } while();" from
1788 "do { } while()" followed by ";" (the empty statement).
1790 2007-10-29 Oliver Hunt <oliver@apple.com>
1794 Debranching remaining assignment nodes, and miscellaneous cleanup
1796 Split read-modify code paths out of AssignBracketNode and AssignDotNode
1797 Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
1798 and ReadModifyResolveNode evaluate methods
1800 Leads to a 1% gain in SunSpider.
1804 (KJS::ReadModifyLocalVarNode::evaluate):
1805 (KJS::ReadModifyResolveNode::evaluate):
1806 (KJS::AssignDotNode::evaluate):
1807 (KJS::ReadModifyDotNode::optimizeVariableAccess):
1808 (KJS::ReadModifyDotNode::evaluate):
1809 (KJS::AssignBracketNode::evaluate):
1810 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
1811 (KJS::ReadModifyBracketNode::evaluate):
1813 (KJS::AssignBracketNode::):
1814 (KJS::AssignBracketNode::precedence):
1815 (KJS::AssignDotNode::):
1816 (KJS::AssignDotNode::precedence):
1817 * kjs/nodes2string.cpp:
1818 (KJS::ReadModifyBracketNode::streamTo):
1819 (KJS::AssignBracketNode::streamTo):
1820 (KJS::ReadModifyDotNode::streamTo):
1821 (KJS::AssignDotNode::streamTo):
1823 2007-10-29 Oliver Hunt <oliver@apple.com>
1825 Debranching various Node::evaluate implementations
1829 Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
1830 Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
1832 Gains 1.6% on SunSpider
1834 * JavaScriptCore.xcodeproj/project.pbxproj:
1837 (KJS::PostIncResolveNode::optimizeVariableAccess):
1838 (KJS::PostIncResolveNode::evaluate):
1839 (KJS::PostIncLocalVarNode::evaluate):
1840 (KJS::PostDecResolveNode::optimizeVariableAccess):
1841 (KJS::PostDecResolveNode::evaluate):
1842 (KJS::PostDecLocalVarNode::evaluate):
1843 (KJS::PostIncBracketNode::evaluate):
1844 (KJS::PostDecBracketNode::evaluate):
1845 (KJS::PostIncDotNode::evaluate):
1846 (KJS::PostDecDotNode::evaluate):
1847 (KJS::PreIncResolveNode::optimizeVariableAccess):
1848 (KJS::PreIncLocalVarNode::evaluate):
1849 (KJS::PreIncResolveNode::evaluate):
1850 (KJS::PreDecResolveNode::optimizeVariableAccess):
1851 (KJS::PreDecLocalVarNode::evaluate):
1852 (KJS::PreDecResolveNode::evaluate):
1853 (KJS::PreIncBracketNode::evaluate):
1854 (KJS::PreDecBracketNode::evaluate):
1855 (KJS::PreIncDotNode::evaluate):
1856 (KJS::PreDecDotNode::evaluate):
1857 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1858 (KJS::AssignResolveNode::optimizeVariableAccess):
1859 (KJS::AssignLocalVarNode::evaluate):
1860 (KJS::AssignResolveNode::evaluate):
1862 (KJS::PostDecResolveNode::):
1863 (KJS::PostDecResolveNode::precedence):
1864 (KJS::PostDecLocalVarNode::):
1865 (KJS::PostfixBracketNode::):
1866 (KJS::PostfixBracketNode::precedence):
1867 (KJS::PostIncBracketNode::):
1868 (KJS::PostIncBracketNode::isIncrement):
1869 (KJS::PostDecBracketNode::):
1870 (KJS::PostDecBracketNode::isIncrement):
1871 (KJS::PostfixDotNode::):
1872 (KJS::PostfixDotNode::precedence):
1873 (KJS::PostIncDotNode::):
1874 (KJS::PostIncDotNode::isIncrement):
1875 (KJS::PostDecDotNode::):
1876 (KJS::PreIncResolveNode::):
1877 (KJS::PreDecResolveNode::):
1878 (KJS::PreDecResolveNode::precedence):
1879 (KJS::PreDecLocalVarNode::):
1880 (KJS::PrefixBracketNode::):
1881 (KJS::PrefixBracketNode::precedence):
1882 (KJS::PreIncBracketNode::):
1883 (KJS::PreIncBracketNode::isIncrement):
1884 (KJS::PreDecBracketNode::):
1885 (KJS::PreDecBracketNode::isIncrement):
1886 (KJS::PrefixDotNode::):
1887 (KJS::PrefixDotNode::precedence):
1888 (KJS::PreIncDotNode::):
1889 (KJS::PreIncDotNode::isIncrement):
1890 (KJS::PreDecDotNode::):
1891 (KJS::ReadModifyResolveNode::):
1892 (KJS::ReadModifyLocalVarNode::):
1893 (KJS::AssignResolveNode::):
1894 (KJS::AssignResolveNode::precedence):
1895 * kjs/nodes2string.cpp:
1896 (KJS::PostIncResolveNode::streamTo):
1897 (KJS::PostDecResolveNode::streamTo):
1898 (KJS::PostfixBracketNode::streamTo):
1899 (KJS::PostfixDotNode::streamTo):
1900 (KJS::PreIncResolveNode::streamTo):
1901 (KJS::PreDecResolveNode::streamTo):
1902 (KJS::ReadModifyResolveNode::streamTo):
1903 (KJS::AssignResolveNode::streamTo):
1905 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1907 Not reviewed, build fix.
1909 - Include Vector.h in a way that actually works.
1911 * kjs/LocalStorage.h:
1913 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1915 Not reviewed, build fix.
1917 - Install LocalStorage.h as a private header.
1919 * JavaScriptCore.xcodeproj/project.pbxproj:
1921 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1925 - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
1927 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1928 * JavaScriptCore.xcodeproj/project.pbxproj:
1929 * kjs/LocalStorage.h: Added.
1930 (KJS::LocalStorageEntry::LocalStorageEntry):
1934 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
1936 2007-10-29 Geoffrey Garen <ggaren@apple.com>
1938 Reviewed by Oliver Hunt.
1940 Some small tweaks that I notice while reviewing Oliver's last patch.
1942 Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
1944 No change in SunSpider because SunSpider doesn't take the code path that
1945 would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
1948 (KJS::LocalVarPostfixNode::evaluate):
1949 (KJS::TypeOfResolveNode::optimizeVariableAccess):
1950 (KJS::LocalVarTypeOfNode::evaluate):
1951 (KJS::PrefixResolveNode::optimizeVariableAccess):
1952 (KJS::LocalVarPrefixNode::evaluate):
1953 (KJS::AssignResolveNode::optimizeVariableAccess):
1954 (KJS::LocalVarAssignNode::evaluate):
1956 (KJS::LocalVarTypeOfNode::):
1957 (KJS::PrefixResolveNode::):
1958 (KJS::LocalVarPrefixNode::):
1959 (KJS::AssignResolveNode::):
1960 (KJS::LocalVarAssignNode::):
1962 2007-10-29 Eric Seidel <eric@webkit.org>
1966 SunSpider claims this was a 0.7% speedup.
1968 * kjs/string_object.cpp:
1969 (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
1971 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1975 - re-enable asserts for access to empty or deleted keys
1979 (WTF::::lookupForWriting):
1980 (WTF::::fullLookupForWriting):
1983 2007-10-29 Eric Seidel <eric@webkit.org>
1985 Build fix only, no review.
1987 * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
1989 2007-10-29 Mark Rowe <mrowe@apple.com>
1991 Gtk build fix. Move struct declarations into nodes.h.
1996 2007-10-29 Eric Seidel <eric@webkit.org>
2000 Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
2001 Make it a compile time error to use toString(ExecState) on a StringInstance
2003 SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
2006 (KJS::StringImp::getLength):
2007 * kjs/string_object.cpp:
2008 (KJS::StringInstance::lengthGetter):
2009 (KJS::StringInstance::inlineGetOwnPropertySlot):
2010 (KJS::StringInstance::getOwnPropertySlot):
2011 * kjs/string_object.h:
2013 2007-10-28 Oliver Hunt <oliver@apple.com>
2017 Add nodes to allow Assignment, TypeOf, and prefix operators to
2018 make use of the new optimised local variable look up.
2020 5% gain on sunspider
2023 (KJS::TypeOfResolveNode::optimizeVariableAccess):
2024 (KJS::LocalTypeOfAccessNode::evaluate):
2025 (KJS::PrefixResolveNode::optimizeVariableAccess):
2026 (KJS::PrefixLocalAccessNode::evaluate):
2027 (KJS::AssignResolveNode::optimizeVariableAccess):
2028 (KJS::AssignLocalAccessNode::evaluate):
2030 (KJS::TypeOfResolveNode::):
2031 (KJS::TypeOfResolveNode::precedence):
2032 (KJS::LocalTypeOfAccessNode::):
2033 (KJS::PrefixResolveNode::):
2034 (KJS::PrefixResolveNode::precedence):
2035 (KJS::PrefixLocalAccessNode::):
2036 (KJS::AssignResolveNode::):
2037 (KJS::AssignLocalAccessNode::):
2039 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2043 - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
2044 http://bugs.webkit.org/show_bug.cgi?id=15748
2046 Not a significant speedup or slowdown on SunSpider.
2049 (KJS::clearNewNodes):
2053 (KJS::BlockNode::BlockNode):
2054 (KJS::CaseBlockNode::CaseBlockNode):
2055 (KJS::FunctionBodyNode::FunctionBodyNode):
2056 (KJS::SourceElementsNode::SourceElementsNode):
2057 (KJS::ProgramNode::ProgramNode):
2059 (KJS::ElementNode::):
2061 (KJS::PropertyListNode::):
2062 (KJS::ObjectLiteralNode::):
2063 (KJS::ArgumentListNode::):
2064 (KJS::ArgumentsNode::):
2065 (KJS::VarDeclListNode::):
2066 (KJS::VarStatementNode::):
2068 (KJS::ParameterNode::):
2069 (KJS::FuncExprNode::):
2070 (KJS::FuncDeclNode::):
2071 (KJS::SourceElementsNode::):
2072 (KJS::CaseClauseNode::):
2073 (KJS::ClauseListNode::):
2075 2007-10-28 Mark Rowe <mrowe@apple.com>
2077 Disable assertions in a manner that doesn't break the Qt Windows build.
2081 (WTF::::lookupForWriting):
2082 (WTF::::fullLookupForWriting):
2084 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2086 Temporarily disabling some ASSERTs I introduced in my last check-in
2087 because of http://bugs.webkit.org/show_bug.cgi?id=15747
2088 Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
2092 (WTF::::lookupForWriting):
2093 (WTF::::fullLookupForWriting):
2096 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2098 Reviewed by Darin Adler.
2100 Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
2101 #ifndef ASSERT_DISABLED is no good!
2103 Replaced with #if !ASSERT_DISABLED.
2107 (WTF::::lookupForWriting):
2108 (WTF::::fullLookupForWriting):
2111 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2113 Reviewed by Darin Adler.
2115 Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
2116 to the AST transfom that replaces slow resolve nodes with fast local
2117 variable alternatives.
2119 2.5% speedup on SunSpider.
2121 Also added some missing copyright notices.
2124 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
2125 (KJS::FunctionCallResolveNode::evaluate):
2126 (KJS::LocalVarFunctionCallNode::evaluate):
2127 (KJS::PostfixResolveNode::optimizeVariableAccess):
2128 (KJS::PostfixResolveNode::evaluate):
2129 (KJS::LocalVarPostfixNode::evaluate):
2130 (KJS::DeleteResolveNode::optimizeVariableAccess):
2131 (KJS::DeleteResolveNode::evaluate):
2132 (KJS::LocalVarDeleteNode::evaluate):
2134 (KJS::FunctionCallResolveNode::):
2135 (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
2136 (KJS::PostfixResolveNode::):
2137 (KJS::LocalVarPostfixNode::LocalVarPostfixNode):
2138 (KJS::DeleteResolveNode::):
2139 (KJS::LocalVarDeleteNode::LocalVarDeleteNode):
2141 2007-10-28 Eric Seidel <eric@webkit.org>
2145 Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
2146 Add virtual keyword to a few virtual functions previously unmarked.
2149 (KJS::StringImp::type):
2150 (KJS::NumberImp::type):
2152 (KJS::UString::Rep::deref):
2154 2007-10-28 Darin Adler <darin@apple.com>
2156 - fix "broken everything" from the storage leak fix
2158 * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
2159 * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
2161 2007-10-28 Darin Adler <darin@apple.com>
2165 - turn on unused parameter waring on Mac OS X because it's already on elsewhere
2167 * Configurations/Base.xcconfig: Took out -wno-unused-parameter.
2173 Fixed unused variables by using them or marked them with UNUSED_PARAM.
2175 * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
2176 Removed parameter names to indicate they are unused.
2178 2007-10-28 Darin Adler <darin@apple.com>
2182 - fix a storage leak where we ref the UString every time we replace
2183 a ResolveNode with a LocalVarAccessNode
2185 * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
2186 that takes PlacementNewAdopt.
2188 * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
2189 with PlacementNewAdopt instead of the old value of ident.
2191 * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
2192 takes PlacementNewAdopt.
2194 2007-10-28 Darin Adler <darin@apple.com>
2196 - Windows build fix; get rid of unused parameter
2198 * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
2199 * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
2200 The assertions weren't all that helpful.
2202 2007-10-28 Mark Rowe <mrowe@apple.com>
2204 Gtk build fix. Add include of MathExtras.h.
2206 * kjs/string_object.cpp:
2208 2007-10-28 Mark Rowe <mrowe@apple.com>
2210 Reviewed by Maciej and Tim.
2212 Replace uses of isNaN and isInf with isnan and isinf, and
2213 remove isNaN and isInf.
2215 * kjs/config.h: Remove unused HAVE_'s.
2216 * kjs/date_object.cpp:
2217 (KJS::DateInstance::getTime):
2218 (KJS::DateInstance::getUTCTime):
2219 (KJS::DateProtoFunc::callAsFunction):
2220 (KJS::DateObjectImp::construct):
2221 (KJS::DateObjectFuncImp::callAsFunction):
2223 (KJS::GlobalFuncImp::callAsFunction):
2224 * kjs/math_object.cpp:
2225 (MathFuncImp::callAsFunction):
2226 * kjs/nodes2string.cpp:
2227 (KJS::isParserRoundTripNumber):
2228 * kjs/number_object.cpp:
2229 (NumberProtoFunc::callAsFunction):
2230 * kjs/operations.cpp:
2232 * kjs/string_object.cpp:
2233 (KJS::StringProtoFunc::callAsFunction):
2235 (KJS::UString::from):
2237 (KJS::JSValue::toInteger):
2238 (KJS::JSValue::toInt32SlowCase):
2239 (KJS::JSValue::toUInt32SlowCase):
2241 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2243 Build fix: use the new-fangled missingSymbolMarker().
2246 (KJS::ResolveNode::optimizeVariableAccess):
2248 (KJS::LocalVarAccessNode::LocalVarAccessNode):
2250 2007-10-28 Geoffrey Garen <ggaren@apple.com>
2252 Reviewed by Maciej Stachowiak, Darin Adler.
2254 Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
2257 AST transfom to replace slow resolve nodes with fast local variable
2258 alternatives that do direct memory access. Currently, only ResolveNode
2259 provides a fast local variable alternative. 6 others are soon to come.
2261 16.7% speedup on SunSpider.
2263 Most of this patch is just scaffolding to support iterating all the
2264 resolve nodes in the AST through optimizeResolveNodes(). In
2265 optimizeResolveNodes(), most classes just push their child nodes onto
2266 the processing stack, while ResolveNodes actually replace themselves in
2267 the tree with more optimized alternatives, if possible.
2269 Here are the interesting bits:
2271 * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
2272 in Node and ResolveNode. This tag allows you to use placement new to
2273 swap out a base class Node in favor of a subclass copy that holds the
2274 same data. (Without this tag, default initialization would NULL out
2275 RefPtrs, change line numbers, etc.)
2278 (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
2279 that the fast path is impossible, to make sure we didn't leave anything
2282 (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
2283 transformation happens.
2285 (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
2286 optimization happens.
2288 * kjs/function.h: Added symbolTable() accessor for, for the sake of
2291 2007-10-28 Mark Rowe <mrowe@apple.com>
2295 Fix "AllInOneFile.o has a global initializer in it".
2297 Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
2298 We can avoid this by moving it inside an inline function.
2300 * kjs/SymbolTable.h:
2301 (KJS::missingSymbolMarker):
2303 (KJS::ActivationImp::getOwnPropertySlot):
2304 (KJS::ActivationImp::put):
2306 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2310 - Added assertions to protect against adding empty or deleted keys to a HashTable
2313 (WTF::HashTable::lookup):
2314 (WTF::HashTable::lookupForWriting):
2315 (WTF::HashTable::fullLookupForWriting):
2316 (WTF::HashTable::add):
2318 2007-10-28 Darin Adler <darin@apple.com>
2322 * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
2323 Use isNaN and isInf instead of isnan and isinf.
2325 2007-10-28 Darin Adler <darin@apple.com>
2329 - http://bugs.webkit.org/show_bug.cgi?id=15735
2330 remove GroupNode to simplify AST and possibly get a modest speedup
2332 This patch removes 4 node types: GroupNode, PropertyNameNode,
2333 FunctionCallParenBracketNode, and FunctionCallParenDotNode.
2335 To remove GroupNode, we add knowledge of precedence to the tree nodes,
2336 and use that when serializing to determine where parentheses are needed.
2337 This means we no longer have to represent parentheses in the tree.
2339 The precedence values are named after productions in the grammar from the
2340 JavaScript standard.
2342 SunSpider says this is an 0.4% speedup.
2345 * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
2346 serialization, so I moved it to the file that takes care of that.
2348 * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
2349 indicate failure instead of a separate boolean. Got rid of PropertyNameNode
2350 by merging the PropertyName rule into the Property rule (which was easier
2351 than figuring out how to pass the Identifier from one node to another).
2352 Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
2353 and FunctionCallParenDotNode.
2355 * kjs/nodes.h: Removed unused forward declarations and Operator values.
2356 Added Precedence enum, and precedence function to all nodes. Removed
2357 nodeInsideAllParens. Added streamBinaryOperator function for serialization.
2358 Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
2359 Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
2361 * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
2362 (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
2363 of converting it from an Identifier to a jsString then back to a UString
2364 then into an Identifier again!
2366 * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
2367 function for each of Endl, Indent, Unindent, and DotExpr instead of using a
2368 single function with a switch. Added a precedence that you can stream in, to
2369 cause the next node serialized to add parentheses based on that precedence value.
2370 (KJS::operatorString): Moved to the top of the file.
2371 (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
2372 workaround for snprintf, since StringExtras.h takes care of that.
2373 (KJS::operator<<): Made the char and char* versions faster by using UString's
2374 character append functions instead of constructing a UString. Added the logic
2375 to the Node* version to add parentheses if needed.
2376 (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
2377 (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
2378 (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
2380 (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
2381 (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
2382 (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
2383 (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
2384 (KJS::FunctionCallBracketNode::streamTo): Ditto.
2385 (KJS::FunctionCallDotNode::streamTo): Ditto.
2386 (KJS::PostfixBracketNode::streamTo): Ditto.
2387 (KJS::PostfixDotNode::streamTo): Ditto.
2388 (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
2389 (KJS::DeleteBracketNode::streamTo): Use PrecCall.
2390 (KJS::DeleteDotNode::streamTo): Ditto.
2391 (KJS::DeleteValueNode::streamTo): Use PrecUnary.
2392 (KJS::VoidNode::streamTo): Ditto.
2393 (KJS::TypeOfValueNode::streamTo): Ditto.
2394 (KJS::PrefixBracketNode::streamTo): Use PrecCall.
2395 (KJS::PrefixDotNode::streamTo): Ditto.
2396 (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
2397 (KJS::UnaryPlusNode::streamTo): Ditto.
2398 (KJS::NegateNode::streamTo): Ditto.
2399 (KJS::BitwiseNotNode::streamTo): Ditto.
2400 (KJS::LogicalNotNode::streamTo): Ditto.
2401 (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
2402 (KJS::DivNode::streamTo): Ditto.
2403 (KJS::ModNode::streamTo): Ditto.
2404 (KJS::AddNode::streamTo): Ditto.
2405 (KJS::SubNode::streamTo): Ditto.
2406 (KJS::LeftShiftNode::streamTo): Ditto.
2407 (KJS::RightShiftNode::streamTo): Ditto.
2408 (KJS::UnsignedRightShiftNode::streamTo): Ditto.
2409 (KJS::LessNode::streamTo): Ditto.
2410 (KJS::GreaterNode::streamTo): Ditto.
2411 (KJS::LessEqNode::streamTo): Ditto.
2412 (KJS::GreaterEqNode::streamTo): Ditto.
2413 (KJS::InstanceOfNode::streamTo): Ditto.
2414 (KJS::InNode::streamTo): Ditto.
2415 (KJS::EqualNode::streamTo): Ditto.
2416 (KJS::NotEqualNode::streamTo): Ditto.
2417 (KJS::StrictEqualNode::streamTo): Ditto.
2418 (KJS::NotStrictEqualNode::streamTo): Ditto.
2419 (KJS::BitAndNode::streamTo): Ditto.
2420 (KJS::BitXOrNode::streamTo): Ditto.
2421 (KJS::BitOrNode::streamTo): Ditto.
2422 (KJS::LogicalAndNode::streamTo): Ditto.
2423 (KJS::LogicalOrNode::streamTo): Ditto.
2424 (KJS::ConditionalNode::streamTo): Ditto.
2425 (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
2426 (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
2427 the bracket and PrecAssignment for the right side.
2428 (KJS::AssignDotNode::streamTo): Ditto.
2429 (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
2430 and PrecAssignment for the right side.
2431 (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
2432 (KJS::AssignExprNode::streamTo): Use PrecAssignment.
2434 2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
2436 Define wx port and set wx port USE options.
2438 Reviewed by Adam Roben.
2442 2007-10-28 Mark Rowe <mrowe@apple.com>
2444 We don't include "config.h" in headers.
2446 * bindings/jni/jni_instance.h:
2451 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2453 Rubber stamped by Mark.
2455 - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
2457 * kjs/SymbolTable.h:
2458 (KJS::SymbolTableIndexHashTraits::emptyValue):
2460 (KJS::ActivationImp::getOwnPropertySlot):
2461 (KJS::ActivationImp::put):
2463 2007-10-28 Maciej Stachowiak <mjs@apple.com>
2467 - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
2469 * kjs/SymbolTable.h:
2470 (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
2471 (KJS::IdentifierRepHash::equal): ditto
2472 (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
2473 (KJS::SymbolTable): change to a typedef for a HashMap.
2475 (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
2476 (KJS::ActivationImp::deleteProperty): ditto
2477 (KJS::ActivationImp::put): ditto
2480 (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
2481 you now have to store a UString::rep, not an identifier.
2483 2007-10-27 Maciej Stachowiak <mjs@apple.com>
2487 - numerous HashTable performance improvements
2489 This does not quite add up to a measurable win on SunSpider, but it allows a
2490 follow-on > 3% improvement and probably helps WebCore too.
2492 I made the following improvements, among others:
2494 - Made HashFunctions note whether it is ok to compare a real value with the equal() function
2495 to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
2497 - Specialized lookup so it doesn't have to do so many extra branches and build so many extra
2498 std::pairs for cases that don't need them. There are now four versions, one for read-only access,
2499 two for writing, and one folded directly into add() (these all were improvments).
2501 - Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
2503 - Made a special constructor for iterators that knows it points to
2504 a valid filled cell and so skips updating itself.
2506 - Reordered memory accesses in the various lookup functions for better code generation
2508 - Made simple translators avoid passing a hash code around
2510 - Other minor tweaks
2514 (WTF::HashTableConstIterator::HashTableConstIterator):
2515 (WTF::HashTableIterator::HashTableIterator):
2516 (WTF::IdentityHashTranslator::translate):
2517 (WTF::HashTable::end):
2518 (WTF::HashTable::lookup):
2519 (WTF::HashTable::lookupForWriting):
2520 (WTF::HashTable::makeKnownGoodIterator):
2521 (WTF::HashTable::makeKnownGoodConstIterator):
2523 (WTF::::lookupForWriting):
2524 (WTF::::fullLookupForWriting):
2526 (WTF::::addPassingHashCode):
2530 * kjs/identifier.cpp:
2532 * wtf/HashFunctions.h:
2540 * wtf/ListHashSet.h:
2541 (WTF::ListHashSetTranslator::translate):
2543 2007-10-27 Darin Adler <darin@apple.com>
2547 - fix ASCIICType.h for some Windows compiles
2549 * wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
2550 compiler/library that has the wchar_t that is just a typedef.
2552 2007-10-27 Kevin McCullough <kmccullough@apple.com>
2555 - Forgot to change the build step when I changed the filename.
2557 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2559 2007-10-27 Geoffrey Garen <ggaren@apple.com>
2561 Reviewed by Darin Adler.
2563 Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
2565 http://bugs.webkit.org/show_bug.cgi?id=15718
2567 * kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a
2568 hash value. Also changed O(n) strlen to O(1) check for empty string.
2569 (KJS::Identifier::add):
2571 * kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
2572 (KJS::UString::UString):
2573 (KJS::UString::operator=):
2575 2007-10-27 Darin Adler <darin@apple.com>
2579 - fix pow on Windows
2581 * wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
2582 a "pow" function that does not properly handle the case where arg1 is
2585 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
2586 specify "::pow" -- just "pow" is fine.
2588 2007-10-27 Darin Adler <darin@apple.com>
2592 - http://bugs.webkit.org/show_bug.cgi?id=15711
2593 force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
2595 * kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
2597 * kjs/object.h: Removed redundant includes.
2598 * kjs/value.h: Ditto.
2600 2007-10-27 Maciej Stachowiak <mjs@apple.com>
2604 - fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
2605 http://bugs.webkit.org/show_bug.cgi?id=15718
2607 * kjs/identifier.cpp:
2608 (KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
2609 now that we count on all Identifiers already having one.
2611 2007-10-27 Mark Rowe <mrowe@apple.com>
2615 * kjs/SymbolTable.h:
2617 2007-10-27 Mark Rowe <mrowe@apple.com>
2623 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2625 Rubber stamp by Adam.
2627 - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
2628 files contain are functions that operate on BSTRs.
2630 * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
2631 * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
2632 * API/JSStringRefCOM.cpp: Removed.
2633 * API/JSStringRefCOM.h: Removed.
2634 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2636 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2640 - Made JSStringCreateWithBSTR capable of handling null BSTRs.
2642 * API/JSStringRefCOM.cpp:
2643 (JSStringCreateWithBSTR):
2645 2007-10-26 Sam Weinig <sam@webkit.org>
2649 * kjs/SymbolTable.h: Add header gaurd.
2650 * kjs/nodes.h: #include "SymbolTable.h"
2652 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2654 Suggested by Anders Carlsson.
2659 (KJS::ActivationImp::getOwnPropertySlot):
2661 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2663 Suggested by Darin Adler.
2665 Use computedHash(), which is safer than just directly accessing _hash.
2668 (KJS::Lookup::findEntry):
2669 (KJS::Lookup::find):
2671 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2673 Build fix: svn add SymbolTable.h
2675 * kjs/SymbolTable.h: Added.
2676 (KJS::SymbolTable::set):
2677 (KJS::SymbolTable::get):
2679 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2681 Build fix: export SymbolTable.h to WebCore.
2683 * JavaScriptCore.xcodeproj/project.pbxproj:
2685 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2687 Comment tweak suggested by Maciej.
2690 (KJS::ActivationImp::getOwnPropertySlot):
2692 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2694 Reviewed by Maciej Stachowiak.
2696 Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
2698 * kjs/property_map.cpp: Use a special no branch accessor to the UString's
2699 hash value. Also, return immediately instead of branching to the end
2700 of the loop if the value is not found.
2701 (KJS::PropertyMap::get):
2702 (KJS::PropertyMap::getLocation):
2703 (KJS::PropertyMap::put):
2704 (KJS::PropertyMap::insert):
2705 (KJS::PropertyMap::remove):
2706 (KJS::PropertyMap::checkConsistency):
2709 (KJS::UString::Rep::computedHash): Special no branch accessor to the
2710 UString's hash value. Used when the caller knows that the hash value
2711 has already been computed. (For example, if the caller got the UString
2712 from an Identifier.)
2714 2007-10-26 Geoffrey Garen <ggaren@apple.com>
2716 Reviewed by Maciej Stachowiak.
2718 Switched ActivationImp to using a symbol table. For now, though, all
2719 clients take the slow path.
2721 Net .6% speedup on SunSpider.
2724 - ActivationImp now mallocs in its constructor
2725 - Local variable hits use an extra level of indirection to retrieve
2727 - Local variable misses do two lookups
2730 - Fast initialization of local variables upon function entry
2732 * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
2735 (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
2736 data that won't fit in a JSCell.
2737 (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
2739 (KJS::ActivationImp::getOwnPropertySlot): ditto
2740 (KJS::ActivationImp::deleteProperty): ditto
2741 (KJS::ActivationImp::put): ditto
2742 (KJS::ActivationImp::createArgumentsObject): ditto
2744 (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
2745 our properties doesn't try to recursively mark us. (This caused a crash
2746 in earlier testing. Not sure why we haven't run into it before.)
2748 * kjs/nodes.cpp: Functions now build a symbol table the first time
2750 (KJS::VarDeclNode::evaluate):
2751 (KJS::FunctionBodyNode::FunctionBodyNode):
2752 (KJS::FunctionBodyNode::initializeSymbolTable):
2753 (KJS::FunctionBodyNode::processDeclarations):
2754 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2755 (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
2758 (KJS::FunctionBodyNode::symbolTable):
2760 * wtf/Forward.h: Added Vector.
2762 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2764 - Corrected function name mistake in this changelog.
2766 2007-10-26 Kevin McCullough <kmccullough@apple.com>
2767 Reviewed by Sam and Steve.
2769 - Added convenience methods for converting between BSTR and JSStringRefs
2771 * API/JSStringRefCOM.cpp: Added.
2772 (JSStringCreateWithBSTR):
2774 * API/JSStringRefCOM.h: Added.
2775 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2777 2007-10-26 Mark Rowe <mrowe@apple.com>
2781 * kjs/collector.cpp:
2782 (KJS::Collector::collect):
2784 2007-10-26 Oliver Hunt <oliver@apple.com>
2788 Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
2790 * kjs/CollectorHeapIntrospector.cpp:
2791 (KJS::CollectorHeapIntrospector::init):
2792 (KJS::CollectorHeapIntrospector::enumerate):
2793 * kjs/CollectorHeapIntrospector.h:
2794 * kjs/collector.cpp:
2795 (KJS::Collector::recordExtraCost):
2796 (KJS::Collector::heapAllocate):
2797 (KJS::Collector::allocate):
2798 (KJS::Collector::allocateNumber):
2799 (KJS::Collector::registerThread):
2800 (KJS::Collector::markStackObjectsConservatively):
2801 (KJS::Collector::markMainThreadOnlyObjects):
2802 (KJS::Collector::sweep):
2803 (KJS::Collector::collect):
2806 (KJS::NumberImp::operator new):
2807 Force numbers to be allocated in the secondary heap.
2809 2007-10-26 Maciej Stachowiak <mjs@apple.com>
2813 - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
2816 (KJS::JSValue::getUInt32):
2817 (KJS::JSValue::getTruncatedInt32):
2818 (KJS::JSValue::toNumber):
2820 (WTF::PassRefPtr::~PassRefPtr):
2822 (WTF::RefPtr::operator->):
2824 2007-10-26 Mark Rowe <mrowe@apple.com>
2830 2007-10-26 Maciej Stachowiak <mjs@apple.com>
2834 - Merge Context class fully into ExecState, since they are always created and used together.
2836 No measurable performance impact but this is a useful cleanup.
2838 * JavaScriptCore.pri:
2839 * kjs/ExecState.cpp:
2840 (KJS::ExecState::ExecState):
2841 (KJS::ExecState::~ExecState):
2842 (KJS::ExecState::mark):
2843 (KJS::ExecState::lexicalInterpreter):
2845 (KJS::ExecState::dynamicInterpreter):
2846 (KJS::ExecState::setException):
2847 (KJS::ExecState::clearException):
2848 (KJS::ExecState::exception):
2849 (KJS::ExecState::exceptionSlot):
2850 (KJS::ExecState::hadException):
2851 (KJS::ExecState::scopeChain):
2852 (KJS::ExecState::callingExecState):
2853 (KJS::ExecState::propertyNames):
2854 * kjs/collector.cpp:
2855 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
2857 (KJS::FunctionImp::callAsFunction):
2858 (KJS::FunctionImp::argumentsGetter):
2859 (KJS::FunctionImp::callerGetter):
2860 (KJS::GlobalFuncImp::callAsFunction):
2861 * kjs/interpreter.cpp:
2862 (KJS::Interpreter::Interpreter):
2863 (KJS::Interpreter::init):
2864 (KJS::Interpreter::evaluate):
2865 (KJS::Interpreter::mark):
2866 * kjs/interpreter.h:
2867 (KJS::Interpreter::setCurrentExec):
2868 (KJS::Interpreter::currentExec):
2870 (KJS::currentSourceId):
2871 (KJS::currentSourceURL):
2872 (KJS::ThisNode::evaluate):
2873 (KJS::ResolveNode::evaluate):
2874 (KJS::FunctionCallResolveNode::evaluate):
2875 (KJS::PostfixResolveNode::evaluate):
2876 (KJS::DeleteResolveNode::evaluate):
2877 (KJS::TypeOfResolveNode::evaluate):
2878 (KJS::PrefixResolveNode::evaluate):
2879 (KJS::AssignResolveNode::evaluate):
2880 (KJS::VarDeclNode::evaluate):
2881 (KJS::DoWhileNode::execute):
2882 (KJS::WhileNode::execute):
2883 (KJS::ForNode::execute):
2884 (KJS::ForInNode::execute):
2885 (KJS::ContinueNode::execute):
2886 (KJS::BreakNode::execute):
2887 (KJS::ReturnNode::execute):
2888 (KJS::WithNode::execute):
2889 (KJS::SwitchNode::execute):
2890 (KJS::LabelNode::execute):
2891 (KJS::TryNode::execute):
2892 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
2893 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
2894 (KJS::FunctionBodyNode::processDeclarations):
2895 (KJS::FuncDeclNode::makeFunction):
2896 (KJS::FuncExprNode::evaluate):
2898 2007-10-26 Mark Rowe <mrowe@apple.com>
2902 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2904 2007-10-26 Mark Rowe <mrowe@apple.com>
2908 * JavaScriptCore.pri:
2909 * kjs/ExecState.cpp:
2911 2007-10-26 Maciej Stachowiak <mjs@apple.com>
2915 - moved Context class into ExecState.{h,cpp} in preparation for merging
2916 ExecState and Context classes.
2918 * kjs/ExecState.h: Moved CodeType enum and Context class here in
2919 preparation for merging ExecState and Context.
2920 * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
2921 (KJS::Context::Context):
2922 (KJS::Context::~Context):
2923 (KJS::Context::mark):
2924 * kjs/context.h: Removed.
2925 * kjs/Context.cpp: Removed.
2926 * kjs/function.h: Removed CodeType enum.
2927 * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
2928 * kjs/internal.h: Removed LabelStack.
2929 * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
2930 * kjs/collector.cpp: Fixed includes.
2931 * kjs/function.cpp: ditto
2932 * kjs/internal.cpp: ditto
2933 * kjs/interpreter.cpp: ditto
2934 * kjs/lookup.h: ditto
2935 * kjs/nodes.cpp: ditto
2937 2007-10-26 Mark Rowe <mrowe@apple.com>
2941 * kjs/string_object.cpp:
2942 (KJS::StringObjectFuncImp::callAsFunction):
2944 2007-10-25 Darin Adler <darin@apple.com>
2948 - http://bugs.webkit.org/show_bug.cgi?id=15703
2949 fix numeric functions -- improve correctness and speed
2951 Gives about 1% gain on SunSpider.
2953 * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
2954 (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
2955 with both immediate and number values.
2956 (KJS::JSValue::toUInt32): Ditto.
2958 (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
2959 differences. One is that it now correctly returns 0 for NaN, and another is that
2960 there's no special case for 0 or infinity, since the general case already handles
2962 (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
2964 (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
2965 truncation done by the typecast already does the necessary truncation that
2966 roundValue was doing.
2967 (KJS::JSValue::toUInt32SlowCase): Ditto.
2968 (KJS::JSValue::toUInt16): Removed.
2970 * kjs/internal.h: Removed roundValue.
2971 * kjs/internal.cpp: Ditto.
2973 * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
2974 code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
2976 * kjs/date_object.cpp:
2977 (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
2978 toNumber as specified.
2979 (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
2980 with a call to toNumber and timeClip as specified.
2981 (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
2982 where the default behavior of toInt32 (returning 0) was already correct. Replaced
2983 call to roundValue with a call to toNumber as specified.
2984 (KJS::DateObjectFuncImp::callAsFunction): Ditto.
2986 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
2987 cases for the pow function that the library already handles correctly.
2989 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
2990 call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
2991 The real toInteger now returns 0 for NaN. Took out unneeded special case in
2992 ToFixed for undefined; was only needed because our toInteger was wrong. Same
2993 thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
2995 * kjs/string_object.cpp:
2996 (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
2997 cases for undefined that were only needed because toInteger was wrong. Same in
2998 IndexOf, and was able to remove some special cases. In LastIndexOf, used
2999 toIntegerPreserveNaN, but was able to remove some special cases there too.
3000 Changed Substr implementation to preserve correct behavior with the change
3001 to toInteger and match the specification. Also made sure we weren't converting
3002 an out of range double to an int.
3003 (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
3004 toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
3005 no reason to have toUInt16 as a second, less-optimized function that's only
3006 called at this one call site.
3008 * wtf/MathExtras.h: Added trunc function for Windows.
3010 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3012 Reviewed by Maciej Stachowiak.
3014 Tweaked the inner hashtable lookup loop to remove a branch in the "not
3015 found" case. .5% speedup on SunSpider.
3017 * JavaScriptCore.xcodeproj/project.pbxproj:
3021 2007-10-25 Maciej Stachowiak <mjs@apple.com>
3025 - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
3028 (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
3029 adding any value over toNumber() here.
3030 (KJS::valueForReadModifyAssignment): Ditto.
3031 (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
3033 (KJS::lessThanEq): Ditto.
3034 * JavaScriptCore.exp: Export new functions as needed.
3036 (KJS::JSValue::toPrimitive): Fixed formatting.
3037 (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
3038 to number and tells you whether a toPrimitive() conversion with a Number hint
3039 would have given a string.
3041 (KJS::StringImp::getPrimitiveNumber): Implemented.
3042 (KJS::NumberImp::getPrimitiveNumber): ditto
3043 (KJS::GetterSetterImp::getPrimitiveNumber): ditto
3044 (KJS::StringImp::toPrimitive): Fixed formatting.
3045 (KJS::NumberImp::toPrimitive): ditto
3046 (KJS::GetterSetterImp::toPrimitive): ditto
3049 (KJS::JSObject::getPrimitiveNumber): Implemented.
3052 2007-10-25 Sam Weinig <sam@webkit.org>
3054 Reviewed by Adam Roben.
3056 Remove JSStringRefCFHack from windows as it is no longer needed.
3058 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3060 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3062 Reviewed by Oliver Hunt.
3064 Rolled out my last patch. It turns out that I needed 2 words, not 1,
3067 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3069 Reviewed by Oliver Hunt.
3071 Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
3072 Shrink the size of an activation object by 1 word
3074 This is in preparation for adding a symbol table to the activation
3077 The basic strategy here is to rely on the mutual exclusion between
3078 the arguments object pointer and the function pointer (you only need
3079 the latter in order to create the former), and store them in the same
3080 place. The LazyArgumentsObject class encapsulates this strategy.
3082 Also inlined the ArgumentsImp constructor, for good measure.
3084 SunSpider reports no regression. Regression tests pass.
3086 * JavaScriptCore.xcodeproj/project.pbxproj:
3088 (KJS::Context::~Context):
3090 (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
3091 (KJS::ActivationImp::LazyArgumentsObject::mark):
3093 (KJS::ActivationImp::argumentsGetter):
3094 (KJS::ActivationImp::mark):
3096 (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
3097 (KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
3098 (KJS::ActivationImp::LazyArgumentsObject::resetArguments):
3099 (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
3100 (KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
3101 (KJS::ActivationImp::LazyArgumentsObject::setFunction):
3102 (KJS::ActivationImp::LazyArgumentsObject::function):
3103 (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
3104 (KJS::ActivationImp::LazyArgumentsObject::):
3105 (KJS::ActivationImp::ActivationImp::ActivationImp):
3106 (KJS::ActivationImp::resetArguments):
3108 2007-10-25 Adam Roben <aroben@apple.com>
3110 Change JavaScriptCore.vcproj to use DerivedSources.make
3112 We were trying to emulate the logic of make in
3113 build-generated-files.sh, but we got it wrong. We now use a
3114 build-generated-files very much like the one that WebCore uses to
3117 We also now only have a Debug configuration of dftables which we build
3118 even when doing a Release build of JavaScriptCore. dftables also no
3119 longer has the "_debug" name suffix.
3121 Changes mostly made by Darin, reviewed by me.
3123 * DerivedSources.make: Add a variable to set the extension used for
3124 the dftables executable.
3125 * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
3126 dftables in Release configurations.
3127 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
3128 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3129 - Updated include path to point to the new location of the derived
3131 - Modified pre-build event to pass the right arguments to
3132 build-generated-files.sh and not call dftables directly.
3133 - Added the derived source files to the project.
3134 - Removed grammarWrapper.cpp, which isn't needed now that we're
3135 compiling grammar.cpp directly.
3136 * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
3137 Slightly modified from the WebCore version.
3138 * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
3139 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
3140 - Changed the output location to match Mac.
3141 - Removed the Release configuration.
3142 - Removed the _debug suffix.
3144 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3146 Reviewed by Eric Seidel.
3148 Slightly elaborated the differences between declaration procesing in
3149 Function Code and Program Code.
3151 .3% speedup on SunSpider.
3154 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
3155 (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a
3156 minimum set of attributes instead of recomputing all the time. Also,
3157 ignore m_parameters, since programs don't have arguments.
3159 2007-10-25 Eric Seidel <eric@webkit.org>
3163 More preparation work before adding long-running mode to testkjs.
3166 (TestFunctionImp::callAsFunction):
3167 (prettyPrintScript):
3171 (fillBufferWithContentsOfFile):
3173 2007-10-25 Eric Seidel <eric@webkit.org>
3177 Bring testkjs code out of the dark ages in preparation for more
3178 radical improvements (like long-running testing support!)
3181 (TestFunctionImp::callAsFunction):
3184 (fillBufferWithContentsOfFile):
3186 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3188 Reviewed by Maciej Stachowiak.
3190 Make a fast path for declaration processing inside Function Code.
3192 Lifted declaration processing code up from individual declaration nodes
3193 and into processDeclarations.
3195 Broke out processDeclarations into two cases, depending on the type of
3196 code. This eliminates 2 branches, and facilitates more radical
3197 divergeance in the future.
3199 2.5% SunSpider speedup.
3201 * JavaScriptCore.xcodeproj/project.pbxproj:
3203 (KJS::FunctionBodyNode::initializeDeclarationStacks):
3204 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
3205 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
3206 (KJS::FunctionBodyNode::execute):
3207 (KJS::FuncDeclNode::makeFunction):
3211 2007-10-25 Maciej Stachowiak <mjs@apple.com>
3215 - add header includes needed on platforms that don't use AllInOneFile.cpp
3217 * API/JSCallbackObject.cpp:
3219 * kjs/ExecState.cpp:
3220 * kjs/array_instance.cpp:
3221 * kjs/function_object.cpp:
3222 * kjs/interpreter.cpp:
3225 2007-10-25 Eric Seidel <eric@webkit.org>
3229 * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
3231 2007-10-25 Geoffrey Garen <ggaren@apple.com>
3233 Reviewed by Maciej Stachowiak.
3235 Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
3236 Re-order declaration initialization to avoid calling hasProperty inside
3237 VarDeclNode::processDeclaration
3239 .7% speedup on SunSpider.
3242 * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
3243 other processing of declared symbols, so the order of execution could
3247 (KJS::VarDeclNode::getDeclarations): Added special case for the
3248 "arguments" property name, explained in the comment.
3250 (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
3251 in the case of function code, since we know the declared symbol
3252 management will resolve conflicts between symbols. Yay!
3254 (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
3255 implementation of getDeclarations is non-trivial, we can't take a
3256 short-cut here any longer -- we need to put the VarDecl node on the
3257 stack so it gets processed normally.
3259 (KJS::FunctionBodyNode::processDeclarations): Changed the order of
3260 processing to enforce mutual exclusion rules.
3263 (KJS::DeclarationStacks::DeclarationStacks): Structure includes an
3264 ExecState now, for fast access to the "arguments" property name.
3266 2007-10-24 Eric Seidel <eric@webkit.org>
3270 Add a JSGlobalObject class and remove the InterpreterMap
3271 http://bugs.webkit.org/show_bug.cgi?id=15681
3273 This required making JSCallbackObject a template class to allow for
3274 JSGlobalObjects with JSCallbackObject functionality.
3276 SunSpider claims this was a 0.5% speedup.
3278 * API/JSCallbackObject.cpp:
3280 * API/JSCallbackObject.h:
3281 * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
3282 (KJS::::JSCallbackObject):
3284 (KJS::::~JSCallbackObject):
3285 (KJS::::initializeIfNeeded):
3287 (KJS::::getOwnPropertySlot):
3289 (KJS::::deleteProperty):
3290 (KJS::::implementsConstruct):
3292 (KJS::::implementsHasInstance):
3293 (KJS::::hasInstance):
3294 (KJS::::implementsCall):
3295 (KJS::::callAsFunction):
3296 (KJS::::getPropertyNames):
3299 (KJS::::setPrivate):
3300 (KJS::::getPrivate):
3302 (KJS::::cachedValueGetter):
3303 (KJS::::staticValueGetter):
3304 (KJS::::staticFunctionGetter):
3305 (KJS::::callbackGetter):
3306 * API/JSClassRef.cpp:
3307 (OpaqueJSClass::prototype):
3308 * API/JSContextRef.cpp:
3309 (JSGlobalContextCreate):
3310 * API/JSObjectRef.cpp:
3312 (JSObjectGetPrivate):
3313 (JSObjectSetPrivate):
3314 * API/JSValueRef.cpp:
3315 (JSValueIsObjectOfClass):
3316 * JavaScriptCore.exp:
3317 * JavaScriptCore.xcodeproj/project.pbxproj:
3318 * bindings/c/c_utility.cpp:
3319 (KJS::Bindings::convertValueToNPVariant):
3320 * bindings/jni/jni_jsobject.cpp:
3321 * bindings/objc/objc_utility.mm:
3322 (KJS::Bindings::convertValueToObjcValue):
3324 (KJS::Context::Context):
3325 * kjs/ExecState.cpp:
3326 (KJS::ExecState::lexicalInterpreter):
3327 * kjs/JSGlobalObject.h: Added.
3328 (KJS::JSGlobalObject::JSGlobalObject):
3329 (KJS::JSGlobalObject::isGlobalObject):
3330 (KJS::JSGlobalObject::interpreter):
3331 (KJS::JSGlobalObject::setInterpreter):
3332 * kjs/array_instance.cpp:
3335 (KJS::FunctionImp::callAsFunction):
3336 (KJS::GlobalFuncImp::callAsFunction):
3337 * kjs/interpreter.cpp:
3338 (KJS::Interpreter::Interpreter):
3339 (KJS::Interpreter::init):
3340 (KJS::Interpreter::~Interpreter):
3341 (KJS::Interpreter::globalObject):
3342 (KJS::Interpreter::initGlobalObject):
3343 (KJS::Interpreter::evaluate):
3344 * kjs/interpreter.h:
3346 (KJS::cacheGlobalObject):
3348 (KJS::JSObject::isGlobalObject):
3351 2007-10-24 Eric Seidel <eric@webkit.org>
3353 Build fix for Gtk, no review.
3355 * kjs/collector.cpp: #include "context.h"
3357 2007-10-24 Eric Seidel <eric@webkit.org>
3361 Stop checking isOutOfMemory after every allocation, instead let the collector
3362 notify all ExecStates if we ever hit this rare condition.
3364 SunSpider claims this was a 2.2% speedup.
3366 * kjs/collector.cpp:
3367 (KJS::Collector::collect):
3368 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
3371 (KJS::TryNode::execute):
3373 2007-10-24 Mark Rowe <mrowe@apple.com>
3377 * kjs/identifier.h: Remove extra qualification.
3379 2007-10-24 Geoffrey Garen <ggaren@apple.com>
3381 Reviewed by Sam Weinig.
3383 Disable ALWAYS_INLINE in debug builds, since it drives the debugger
3386 * wtf/AlwaysInline.h:
3388 2007-10-24 Geoffrey Garen <ggaren@apple.com>
3390 Reviewed by Sam Weinig.
3392 Inlined the fast path for creating an Identifier from an Identifier.
3394 This is a .4% speedup on SunSpider overall, but as big as a 2.5%
3395 speedup on certain individual tests. 65% of the Identifiers creating
3396 by SunSpider are already Identifiers.
3398 (The main reason I'm making this change is that it resolves a large
3399 regression in a patch I haven't checked in yet.)
3401 * JavaScriptCore.exp:
3402 * kjs/identifier.cpp:
3403 (KJS::Identifier::addSlowCase):
3405 (KJS::Identifier::Identifier::add):
3407 2007-10-24 Lars Knoll <lars@trolltech.com>
3411 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.
3413 * bindings/qt/qt_instance.cpp:
3414 (KJS::Bindings::QtInstance::invokeMethod):
3415 * bindings/qt/qt_runtime.cpp:
3416 (KJS::Bindings::convertValueToQVariant):
3417 (KJS::Bindings::QtField::setValueToInstance):
3419 2007-10-24 Oliver Hunt <oliver@apple.com>
3423 Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
3428 (KJS::LessNode::evaluate):
3429 (KJS::GreaterNode::evaluate):
3430 (KJS::LessEqNode::evaluate):
3431 (KJS::GreaterEqNode::evaluate):
3432 * kjs/operations.cpp:
3435 2007-10-24 Eric Seidel <eric@webkit.org>
3440 (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
3442 2007-10-24 Darin Adler <darin@apple.com>
3446 * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
3447 Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
3449 2007-10-24 Darin Adler <darin@apple.com>
3453 - separate out the code to create a hash table the first time from the code
3456 SunSpider claims this was a 0.7% speedup.
3458 * kjs/property_map.cpp:
3459 (KJS::PropertyMap::expand): Changed to call either createTable or rehash.
3460 (KJS::PropertyMap::createTable): Added. For the case where we had no table.
3461 (KJS::PropertyMap::rehash): Removed code needed only in the case where we
3463 * kjs/property_map.h: Added createTable.
3465 2007-10-24 Eric Seidel <eric@webkit.org>
3469 Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
3470 which can be represented by JSImmediate.
3472 SunSpider claims this was a 0.6% speedup.
3476 (KJS::NumberNode::evaluate):
3477 (KJS::ImmediateNumberNode::evaluate):
3480 (KJS::ImmediateNumberNode::):
3481 * kjs/nodes2string.cpp:
3482 (ImmediateNumberNode::streamTo):
3484 2007-10-24 Darin Adler <darin@apple.com>
3488 - http://bugs.webkit.org/show_bug.cgi?id=15657
3489 change static hash tables to use powers of two for speed
3491 Seems to give 0.7% SunSpider speedup.
3493 * kjs/create_hash_table: Updated to generate new format.
3495 (KJS::keysMatch): Took out unneeded typecast.
3496 (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
3497 Replaced the modulus with a bit mask.
3498 (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
3499 their hash -- saves a branch.
3500 (KJS::Lookup::find): Ditto.
3501 * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
3503 2007-10-24 Maciej Stachowiak <mjs@apple.com>
3507 - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
3510 (KJS::DoWhileNode::execute):
3511 (KJS::WhileNode::execute):
3512 (KJS::ForNode::execute):
3513 (KJS::ForInNode::execute):
3514 (KJS::SourceElementsNode::execute):
3516 2007-10-23 Darin Adler <darin@apple.com>
3520 * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
3521 Changed an && to an & for a 1% gain in SunSpider.
3523 2007-10-23 Oliver Hunt <oliver@apple.com>
3527 Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
3530 (KJS::MultNode::evaluate):
3531 (KJS::DivNode::evaluate):
3532 (KJS::ModNode::evaluate):
3535 (KJS::AddNode::evaluate):
3536 (KJS::SubNode::evaluate):
3537 (KJS::valueForReadModifyAssignment):
3538 * kjs/operations.cpp:
3541 2007-10-23 Oliver Hunt <oliver@apple.com>
3545 Separating all of the simple (eg. non-read-modify-write) binary operators
3546 into separate classes in preparation for further JS optimisations.
3548 Happily this produces a 0.8% to 1.0% performance increase in SunSpider with