1 2008-02-04 Alp Toker <alp@atoker.com>
3 Rubber-stamped by Mark Rowe.
5 Remove all trailing whitespace in the GTK+ port and related
10 2008-02-02 Darin Adler <darin@apple.com>
12 Reviewed by Geoff Garen.
14 PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
15 slower due to r28884 (global variable symbol table optimization)
17 Geoff's theory is that the slowdown was due to copying hash tables when
18 putting things into the back/forward cache. If that's true, then this
19 should fix the problem.
21 (According to Geoff's measurements, in a PLT that exaggerates the
22 importance of symbol table saving during cached page creation, this
23 patch is a ~3X speedup in cached page creation, and a 9% speedup overall.)
25 * JavaScriptCore.exp: Updated.
27 * kjs/JSVariableObject.cpp:
28 (KJS::JSVariableObject::saveLocalStorage): Updated for changes to SavedProperty,
29 which has been revised to avoid initializing each SavedProperty twice when building
30 the array. Store the property names too, so we don't have to store the symbol table
31 separately. Do this by iterating the symbol table instead of the local storage vector.
32 (KJS::JSVariableObject::restoreLocalStorage): Ditto. Restore the symbol table as
33 well as the local storage vector.
35 * kjs/JSVariableObject.h: Removed save/restoreSymbolTable and do that work inside
36 save/restoreLocalStorage instead. Made restoreLocalStorage a non-const member function
37 that takes a const reference to a SavedProperties object.
39 * kjs/LocalStorage.h: Changed attributes to be unsigned instead of int to match
40 other declarations of attributes elsewhere.
42 * kjs/property_map.cpp:
43 (KJS::SavedProperties::SavedProperties): Updated for data member name change.
44 (KJS::PropertyMap::save): Updated for data member name change and to use the new
45 inline init function instead of setting the fields directly. This allows us to
46 skip initializing the SavedProperty objects when first allocating the array, and
47 just do it when we're actually setting up the individual elements.
48 (KJS::PropertyMap::restore): Updated for SavedProperty changes.
50 * kjs/property_map.h: Changed SavedProperty from a struct to a class. Set it up so
51 it does not get initialized at construction time to avoid initializing twice when
52 creating an array of SavedProperty. Removed the m_ prefixes from the members of
53 the SavedProperties struct. Generally we use m_ for class members and not struct.
55 2008-02-02 Tony Chang <idealisms@gmail.com>
57 Reviewed by darin. Landed by eseidel.
59 Add #define guards for WIN32_LEAN_AND_MEAN and _CRT_RAND_S.
65 2008-01-28 Sam Weinig <sam@webkit.org>
67 Rubber-stamped by Darin Adler.
69 - Fix whitespace in nodes.h/cpp and nodes2string.cpp.
71 (NOTE: Specific changed functions elided for space and clarity)
74 * kjs/nodes2string.cpp:
76 2008-01-27 Sam Weinig <sam@webkit.org>
78 Reviewed by Oliver Hunt.
80 Patch for http://bugs.webkit.org/show_bug.cgi?id=17025
81 nodes.h/cpp has been rolling around in the mud - lets hose it down
83 - Rename member variables to use the m_ prefix.
85 (NOTE: Specific changed functions elided for space and clarity)
89 * kjs/nodes2string.cpp:
91 2008-01-27 Darin Adler <darin@apple.com>
95 - fix <rdar://problem/5657450> REGRESSION: const is broken
97 Test: fast/js/const.html
99 SunSpider said this was 0.3% slower. And I saw some Shark samples in
100 JSGlobalObject::put -- not a lot but a few. We may be able to regain the
101 speed, but for now we will take that small hit for correctness sake.
103 * kjs/JSGlobalObject.cpp:
104 (KJS::JSGlobalObject::put): Pass the checkReadOnly flag in to symbolTablePut
105 instead of passing attributes.
107 * kjs/JSVariableObject.h:
108 (KJS::JSVariableObject::symbolTablePut): Removed the code to set attributes
109 here, since we only set attributes when creating a property. Added the code
110 to check read-only here, since we need that to implement const!
113 (KJS::ActivationImp::put): Pass the checkReadOnly flag in to symbolTablePut
114 instead of passing attributes.
117 (KJS::isConstant): Added.
118 (KJS::PostIncResolveNode::optimizeVariableAccess): Create a PostIncConstNode
119 if optimizing for a local variable and the variable is constant.
120 (KJS::PostDecResolveNode::optimizeVariableAccess): Ditto. But PostDecConstNode.
121 (KJS::PreIncResolveNode::optimizeVariableAccess): Ditto. But PreIncConstNode.
122 (KJS::PreDecResolveNode::optimizeVariableAccess): Ditto. But PreDecConstNode.
123 (KJS::PreIncConstNode::evaluate): Return the value + 1.
124 (KJS::PreDecConstNode::evaluate): Return the value - 1.
125 (KJS::PostIncConstNode::evaluate): Return the value converted to a number.
126 (KJS::PostDecConstNode::evaluate): Ditto.
127 (KJS::ReadModifyResolveNode::optimizeVariableAccess): Create a ReadModifyConstNode
128 if optimizing for a local variable and the variable is constant.
129 (KJS::AssignResolveNode::optimizeVariableAccess): Ditto. But AssignConstNode.
130 (KJS::ScopeNode::optimizeVariableAccess): Pass the local storage to the
131 node optimizeVariableAccess functions, since that's where we need to look to
132 figure out if a variable is constant.
133 (KJS::FunctionBodyNode::processDeclarations): Moved the call to
134 optimizeVariableAccess until after localStorage is set up.
135 (KJS::ProgramNode::processDeclarations): Ditto.
137 * kjs/nodes.h: Fixed the IsConstant and HasInitializer values. They are used
138 as flag masks, so a value of 0 will not work for IsConstant. Changed the
139 first parameter to optimizeVariableAccess to be a const reference to a symbol
140 table and added a const reference to local storage. Added classes for const
141 versions of local variable access: PostIncConstNode, PostDecConstNode,
142 PreIncConstNode, PreDecConstNode, ReadModifyConstNode, and AssignConstNode.
145 (KJS::JSObject::put): Tweaked comments a bit, and changed the checkReadOnly
146 expression to match the form used at the two other call sites.
148 2008-01-27 Darin Adler <darin@apple.com>
152 - fix http://bugs.webkit.org/show_bug.cgi?id=16498
153 ''.constructor.toString() gives [function]
155 Test: fast/js/function-names.html
157 * kjs/array_object.cpp:
158 (KJS::ArrayObjectImp::ArrayObjectImp): Use the class name as the constructor's function name.
159 * kjs/bool_object.cpp:
160 (KJS::BooleanObjectImp::BooleanObjectImp): Ditto.
161 * kjs/date_object.cpp:
162 (KJS::DateObjectImp::DateObjectImp): Ditto.
163 * kjs/error_object.cpp:
164 (KJS::ErrorPrototype::ErrorPrototype): Make the error object be an Error.
165 (KJS::ErrorObjectImp::ErrorObjectImp): Use the class name as the constructor's function name.
166 (KJS::NativeErrorPrototype::NativeErrorPrototype): Take const UString&.
167 (KJS::NativeErrorImp::NativeErrorImp): Use the prototype's name as the constructor's function
169 * kjs/error_object.h: Change ErrorPrototype to inherit from ErrorInstance. Change the
170 NativeErrorImp constructor to take a NativeErrorPrototype pointer for its prototype.
171 * kjs/function.h: Removed unneeded constructor for internal functions without names.
172 We want to avoid those!
173 * kjs/function_object.cpp:
174 (KJS::functionProtoFuncToString): Removed code that writes out just [function] for functions
175 that have no names. There's no reason to do that.
176 (KJS::FunctionObjectImp::FunctionObjectImp): Use the class name as the constructor's
178 * kjs/internal.cpp: Removed the unused constructor.
179 * kjs/number_object.cpp:
180 (KJS::fractionalPartToString): Marked static for internal linkage.
181 (KJS::exponentialPartToString): Ditto.
182 (KJS::numberProtoFuncToPrecision): Removed an unneeded else.
183 (KJS::NumberObjectImp::NumberObjectImp): Use the class name as the constructor's
185 (KJS::NumberObjectImp::getValueProperty): Tweaked formatting.
186 * kjs/object_object.cpp:
187 (KJS::ObjectObjectImp::ObjectObjectImp): Use "Object" for the function name.
188 * kjs/regexp_object.cpp:
189 (KJS::RegExpObjectImp::RegExpObjectImp): Use "RegExp" for the function name.
190 * kjs/string_object.cpp:
191 (KJS::StringObjectImp::StringObjectImp): Use the class name as the constructor's
194 2008-01-26 Darin Adler <darin@apple.com>
198 - fix http://bugs.webkit.org/show_bug.cgi?id=17027
199 Incorrect Function.toString behaviour with read/modify/write operators performed on negative numbers
201 Test: fast/js/function-toString-parentheses.html
203 The problem here was that a NumberNode with a negative number in it had the wrong
204 precedence. It's not a primary expression, it's a unary operator with a primary
207 Once the precedence of NumberNode was fixed, the cases from bug 17020 were also
208 fixed without trying to treat bracket nodes like dot nodes. That wasn't needed.
209 The reason we handle numbers before dot nodes specially is that the dot is a
210 legal character in a number. The same is not true of a bracket. Eventually we
211 could get smarter, and only add the parentheses when there is actual ambiguity.
212 There is none if the string form of the number already has a dot in it, or if
213 it's a number with a alphabetic name like infinity or NAN.
215 * kjs/nodes.h: Renamed back from ObjectAccess to DotExpr.
216 (KJS::NumberNode::precedence): Return PrecUnary for negative numbers, since
217 they serialize as a unary operator, not a primary expression.
218 * kjs/nodes2string.cpp:
219 (KJS::SourceStream::operator<<): Clear m_numberNeedsParens if this adds
220 parens; one set is enough.
221 (KJS::bracketNodeStreamTo): Remove unneeded special flag here. Normal
222 operator precedence suffices.
223 (KJS::NewExprNode::streamTo): Ditto.
225 2008-01-26 Oliver Hunt <oliver@apple.com>
227 Reviewed by Maciej and Darin.
229 Fix for http://bugs.webkit.org/show_bug.cgi?id=17020
230 Function.toString does not parenthesise numbers for the bracket accessor
232 It turns out that logic was there for all of the dot accessor nodes to make numbers be
233 parenthesised properly, so it was a trivial extension to extend that to the bracket nodes.
234 I renamed the enum type to reflect the fact that it is now used for both dot and bracket
237 * kjs/nodes2string.cpp:
238 (KJS::bracketNodeStreamTo):
239 (KJS::BracketAccessorNode::streamTo):
241 2008-01-26 Oliver Hunt <oliver@apple.com>
245 Fix Bug 17018: Incorrect code generated from Function.toString for get/setters in object literals
247 Don't quote getter and setter names during output, as that is simply wrong.
249 * kjs/nodes2string.cpp:
250 (KJS::PropertyNode::streamTo):
252 2008-01-26 Darin Adler <darin@apple.com>
254 Reviewed by Eric Seidel.
256 - http://bugs.webkit.org/show_bug.cgi?id=16860
257 a bit of cleanup after the Activation optimization
259 * JavaScriptCore.exp: Export the GlobalExecState constructor instead of
260 the global flavor of the ExecState constructor. It'd probably be cleaner
261 to not export either one, but JSGlobalObject inlines the code that
262 constructs the ExecState. If we changed that, we could remove this export.
264 * JavaScriptCore.xcodeproj/project.pbxproj: Re-sorted a few things and
265 put the new source files into the kjs group rather than at the top level.
268 (KJS::ExecState::ExecState): Marked inline and updated for data member
269 name changes. This is now only for use for the derived classes. Also removed
270 code that sets the unused m_savedExec data member for the global case. That
271 data member is only used for the other two types.
272 (KJS::ExecState::~ExecState): Marked inline and removed all the code.
273 The derived class destructors now inclde the appropriate code.
274 (KJS::ExecState::lexicalGlobalObject): Removed unneeded special case for
275 an empty scope chain. The bottom function already returns 0 for that case,
276 so the general case code handles it fine. Also changed to use data members
277 directly rather than calling functions.
278 (KJS::GlobalExecState::GlobalExecState): Added. Calls through to the base
280 (KJS::GlobalExecState::~GlobalExecState): Added.
281 (KJS::InterpreterExecState::InterpreterExecState): Added. Moved code to
282 manipulate activeExecStates here since we don't want to have to check for the
283 special case of globalExec.
284 (KJS::InterpreterExecState::~InterpreterExecState): Added.
285 (KJS::EvalExecState::EvalExecState): Added.
286 (KJS::EvalExecState::~EvalExecState): Added.
287 (KJS::FunctionExecState::FunctionExecState): Added.
288 (KJS::FunctionExecState::~FunctionExecState): Added.
290 * kjs/ExecState.h: Tweaked the header, includes, and declarations a bit.
291 Made ExecState inherit from Noncopyable. Reformatted some comments and
292 made them a bit more brief. Rearranged declarations a little bit and removed
293 unused savedExec function. Changed seenLabels function to return a reference
294 rather than a pointer. Made constructors and destructor protected, and also
295 did the same with all data members. Renamed m_thisVal to m_thisValue and
296 ls to m_labelStack. Added three new derived classes for each of the
297 types of ExecState. The primary goal here was to remove a branch from the
298 code in the destructor, but it's also clearer than overloading the arguments
299 to the ExecState constructor.
301 * kjs/JSGlobalObject.cpp:
302 (KJS::getCurrentTime): Fixed formatting.
303 (KJS::JSGlobalObject::pushActivation): Removed parentheses that don't make
304 the expression clearer -- other similar sites didn't have these parentheses,
305 even the one a couple lines earlier that sets stackEntry.
306 (KJS::JSGlobalObject::tearOffActivation): Got rid of unneeded static_cast
307 (I think I mentioned this during patch review) and used an early exit so that
308 the entire contents of the function aren't nested inside an if statement.
309 Also removed the check of codeType, instead checking Activation for 0.
310 For now, I kept the codeType check, but inside an assertion.
312 * kjs/JSGlobalObject.h: Changed type of globalExec to GlobalExecState.
314 (KJS::FunctionImp::callAsFunction): Changed type to FunctionExecState.
315 (KJS::GlobalFuncImp::callAsFunction): Changed type to EvalExecState.
316 * kjs/interpreter.cpp:
317 (KJS::Interpreter::evaluate): Changed type to GlobalExecState.
320 (KJS::ContinueNode::execute): Changed code since seenLabels() returns a
321 reference now instead of a pointer.
322 (KJS::BreakNode::execute): Ditto.
323 (KJS::LabelNode::execute): Ditto.
325 2008-01-26 Sam Weinig <sam@webkit.org>
327 Reviewed by Mark Rowe.
329 Cleanup node2string a little.
330 - Remove some unnecessary branching.
331 - Factor out bracket and dot streaming into static inline functions.
334 * kjs/nodes2string.cpp:
335 (KJS::bracketNodeStreamTo):
336 (KJS::dotNodeStreamTo):
337 (KJS::FunctionCallBracketNode::streamTo):
338 (KJS::FunctionCallDotNode::streamTo):
339 (KJS::PostIncBracketNode::streamTo):
340 (KJS::PostDecBracketNode::streamTo):
341 (KJS::PostIncDotNode::streamTo):
342 (KJS::PostDecDotNode::streamTo):
343 (KJS::DeleteBracketNode::streamTo):
344 (KJS::DeleteDotNode::streamTo):
345 (KJS::PreIncBracketNode::streamTo):
346 (KJS::PreDecBracketNode::streamTo):
347 (KJS::PreIncDotNode::streamTo):
348 (KJS::PreDecDotNode::streamTo):
349 (KJS::ReadModifyBracketNode::streamTo):
350 (KJS::AssignBracketNode::streamTo):
351 (KJS::ReadModifyDotNode::streamTo):
352 (KJS::AssignDotNode::streamTo):
353 (KJS::WhileNode::streamTo):
355 2008-01-26 Mark Rowe <mrowe@apple.com>
357 Reviewed by Darin Adler.
359 Fix http://bugs.webkit.org/show_bug.cgi?id=17001
360 Bug 17001: Build error with Gtk port on Mac OS X
362 If both XP_MACOSX and XP_UNIX are defined then X11.h and Carbon.h will both be included.
363 These provide conflicting definitions for a type named 'Cursor'. As XP_UNIX is set by
364 the build system when targeting X11, it doesn't make sense for XP_MACOSX to also be set
367 * bindings/npapi.h: Don't define XP_MACOSX if XP_UNIX is defined.
369 2008-01-26 Darin Adler <darin@apple.com>
373 - fix http://bugs.webkit.org/show_bug.cgi?id=17013
374 JSC can't round trip certain for-loops
376 Test: fast/js/toString-for-var-decl.html
378 * kjs/nodes.h: Added PlaceholderTrueNode so we can put nodes into
379 for loops without injecting the word "true" into them (nice, but not
380 the bug fix). Fixed ForNode constructor so expr1WasVarDecl is set
381 only when there is an expression, since it's common for the actual
382 variable declaration to be moved by the parser.
384 * kjs/nodes2string.cpp:
385 (KJS::PlaceholderTrueNode::streamTo): Added. Empty.
387 2008-01-25 Oliver Hunt <oliver@apple.com>
391 Fix for bug 17012: REGRESSION: JSC can't round trip an object literal
393 Add logic to ensure that object literals and function expressions get
394 parentheses when necessary.
397 * kjs/nodes2string.cpp:
398 (KJS::SourceStream::operator<<):
400 2008-01-24 Steve Falkenburg <sfalken@apple.com>
404 * JavaScriptCore.vcproj/JavaScriptCore.sln:
406 2008-01-24 Steve Falkenburg <sfalken@apple.com>
410 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
412 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
416 Fix QDateTime to JS Date conversion.
417 Several conversion errors (some UTC related, some month
418 offset related) and the conversion distance for Date
419 to DateTime conversion weights were fixed (it should never
420 be better to convert a JS Number into a Date rather than
423 * bindings/qt/qt_runtime.cpp:
424 (KJS::Bindings::convertValueToQVariant):
425 (KJS::Bindings::convertQVariantToValue):
427 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
431 Add support for calling QObjects.
432 Add support for invokeDefaultMethod (via a call to
433 a specific slot), and also allow using it as a
434 constructor, like QtScript.
437 * bindings/qt/qt_class.cpp:
438 (KJS::Bindings::QtClass::fallbackObject):
439 * bindings/qt/qt_instance.cpp:
440 (KJS::Bindings::QtRuntimeObjectImp::construct):
441 (KJS::Bindings::QtInstance::QtInstance):
442 (KJS::Bindings::QtInstance::~QtInstance):
443 (KJS::Bindings::QtInstance::implementsCall):
444 (KJS::Bindings::QtInstance::invokeDefaultMethod):
445 * bindings/qt/qt_instance.h:
446 * bindings/qt/qt_runtime.cpp:
447 (KJS::Bindings::findMethodIndex):
448 (KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
449 (KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
450 * bindings/qt/qt_runtime.h:
452 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
457 Add spaces before/after braces in inline function.
459 * bindings/qt/qt_instance.h:
461 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
466 Remove spaces and unneeded declared parameter names.
468 * bindings/qt/qt_instance.cpp:
469 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
471 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
475 Clear stale RuntimeObjectImps.
476 Since other objects can have refs to the QtInstance,
477 we can't rely on the QtInstance being deleted when the
478 RuntimeObjectImp is invalidate or deleted. This
479 could result in a stale JSObject being returned for
482 * bindings/qt/qt_instance.cpp:
483 (KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
484 (KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
485 (KJS::Bindings::QtRuntimeObjectImp::invalidate):
486 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
487 (KJS::Bindings::QtInstance::getRuntimeObject):
488 * bindings/runtime.cpp:
489 (KJS::Bindings::Instance::createRuntimeObject):
490 * bindings/runtime.h:
492 2008-01-23 Alp Toker <alp@atoker.com>
494 Rubber-stamped by Mark Rowe.
496 Remove whitespace after -I in automake include lists.
500 2008-01-23 Michael Goddard <michael.goddard@trolltech.com>
502 Reviewed by Lars Knoll <lars@trolltech.com>.
504 Reworked the JavaScriptCore Qt bindings:
506 * Add initial support for string and variant arrays, as well
507 as sub QObjects in the JS bindings.
509 * Don't expose fields marked as not scriptable by moc.
511 * Add support for dynamic properties and accessing named
512 QObject children of an object (like QtScript and older
514 * Add support for custom toString methods.
516 * Fine tune some bindings to be closer to QtScript.
517 Make void functions return undefined, and empty/
518 null QStrings return a zero length string.
520 * Create framework for allowing more direct method calls.
521 Since RuntimeMethod doesn't allow us to add additional
522 methods/properties to a function, add these classes.
523 Start prototyping object.signal.connect(...).
525 * Add signal support to the Qt bindings.
526 Allow connecting to signals (object.signal.connect(slot)),
527 disconnecting, and emitting signals. Currently chooses
528 the first signal that matches the name, so this will need
531 * Add property names, and resolve signals closer to use.
532 Enumerating properties now returns some of the Qt properties
533 and signals. Slots and methods aren't quite present. Also,
534 resolve signal connections etc. closer to the time of use, so
535 we can do more dynamic resolution based on argument type etc.
536 Still picks the first one with the same name, at the moment.
538 * Make signature comparison code consistent.
539 Use the same code for checking meta signatures in
540 the method and fallback getters, and avoid a
541 QByteArray construction when we can.
543 * Fix minor memory leak, and handle pointers better.
544 Delete the private object in the dtors, and use RefPtrs
545 for holding Instances etc.
547 * Handle method lookup better.
548 Allow invocation time method lookup based on the arguments,
549 which is closer to QtScript behaviour. Also, cache the
550 method lists and delete them in the QtClass dtor (stops
553 * Improve JS to Qt data type conversions.
554 Add some support for Date & RegExp JS objects,
555 and provide some metrics on the quality of the
558 * A couple of fixes for autotest failures.
559 Better support for converting lists, read/write only
560 QMetaProperty support, modified slot search order...)
562 * bindings/qt/qt_class.cpp:
563 (KJS::Bindings::QtClass::QtClass):
564 (KJS::Bindings::QtClass::~QtClass):
565 (KJS::Bindings::QtClass::name):
566 (KJS::Bindings::QtClass::fallbackObject):
567 (KJS::Bindings::QtClass::methodsNamed):
568 (KJS::Bindings::QtClass::fieldNamed):
569 * bindings/qt/qt_class.h:
570 * bindings/qt/qt_instance.cpp:
571 (KJS::Bindings::QtInstance::QtInstance):
572 (KJS::Bindings::QtInstance::~QtInstance):
573 (KJS::Bindings::QtInstance::getRuntimeObject):
574 (KJS::Bindings::QtInstance::getClass):
575 (KJS::Bindings::QtInstance::implementsCall):
576 (KJS::Bindings::QtInstance::getPropertyNames):
577 (KJS::Bindings::QtInstance::invokeMethod):
578 (KJS::Bindings::QtInstance::invokeDefaultMethod):
579 (KJS::Bindings::QtInstance::stringValue):
580 (KJS::Bindings::QtInstance::booleanValue):
581 (KJS::Bindings::QtInstance::valueOf):
582 (KJS::Bindings::QtField::name):
583 (KJS::Bindings::QtField::valueFromInstance):
584 (KJS::Bindings::QtField::setValueToInstance):
585 * bindings/qt/qt_instance.h:
586 (KJS::Bindings::QtInstance::getBindingLanguage):
587 (KJS::Bindings::QtInstance::getObject):
588 * bindings/qt/qt_runtime.cpp:
589 (KJS::Bindings::QWKNoDebug::QWKNoDebug):
590 (KJS::Bindings::QWKNoDebug::~QWKNoDebug):
591 (KJS::Bindings::QWKNoDebug::operator<<):
593 (KJS::Bindings::valueRealType):
594 (KJS::Bindings::convertValueToQVariant):
595 (KJS::Bindings::convertQVariantToValue):
596 (KJS::Bindings::QtRuntimeMethod::QtRuntimeMethod):
597 (KJS::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
598 (KJS::Bindings::QtRuntimeMethod::codeType):
599 (KJS::Bindings::QtRuntimeMethod::execute):
600 (KJS::Bindings::QtRuntimeMethodData::~QtRuntimeMethodData):
601 (KJS::Bindings::QtRuntimeMetaMethodData::~QtRuntimeMetaMethodData):
602 (KJS::Bindings::QtRuntimeConnectionMethodData::~QtRuntimeConnectionMethodData):
603 (KJS::Bindings::QtMethodMatchType::):
604 (KJS::Bindings::QtMethodMatchType::QtMethodMatchType):
605 (KJS::Bindings::QtMethodMatchType::kind):
606 (KJS::Bindings::QtMethodMatchType::isValid):
607 (KJS::Bindings::QtMethodMatchType::isVariant):
608 (KJS::Bindings::QtMethodMatchType::isMetaType):
609 (KJS::Bindings::QtMethodMatchType::isUnresolved):
610 (KJS::Bindings::QtMethodMatchType::isMetaEnum):
611 (KJS::Bindings::QtMethodMatchType::enumeratorIndex):
612 (KJS::Bindings::QtMethodMatchType::variant):
613 (KJS::Bindings::QtMethodMatchType::metaType):
614 (KJS::Bindings::QtMethodMatchType::metaEnum):
615 (KJS::Bindings::QtMethodMatchType::unresolved):
616 (KJS::Bindings::QtMethodMatchType::typeId):
617 (KJS::Bindings::QtMethodMatchType::name):
618 (KJS::Bindings::QtMethodMatchData::QtMethodMatchData):
619 (KJS::Bindings::QtMethodMatchData::isValid):
620 (KJS::Bindings::QtMethodMatchData::firstUnresolvedIndex):
621 (KJS::Bindings::indexOfMetaEnum):
622 (KJS::Bindings::findMethodIndex):
623 (KJS::Bindings::findSignalIndex):
624 (KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
625 (KJS::Bindings::QtRuntimeMetaMethod::mark):
626 (KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
627 (KJS::Bindings::QtRuntimeMetaMethod::getOwnPropertySlot):
628 (KJS::Bindings::QtRuntimeMetaMethod::lengthGetter):
629 (KJS::Bindings::QtRuntimeMetaMethod::connectGetter):
630 (KJS::Bindings::QtRuntimeMetaMethod::disconnectGetter):
631 (KJS::Bindings::QtRuntimeConnectionMethod::QtRuntimeConnectionMethod):
632 (KJS::Bindings::QtRuntimeConnectionMethod::callAsFunction):
633 (KJS::Bindings::QtRuntimeConnectionMethod::getOwnPropertySlot):
634 (KJS::Bindings::QtRuntimeConnectionMethod::lengthGetter):
635 (KJS::Bindings::QtConnectionObject::QtConnectionObject):
636 (KJS::Bindings::QtConnectionObject::~QtConnectionObject):
637 (KJS::Bindings::QtConnectionObject::metaObject):
638 (KJS::Bindings::QtConnectionObject::qt_metacast):
639 (KJS::Bindings::QtConnectionObject::qt_metacall):
640 (KJS::Bindings::QtConnectionObject::execute):
641 (KJS::Bindings::QtConnectionObject::match):
642 (KJS::Bindings::::QtArray):
643 (KJS::Bindings::::~QtArray):
644 (KJS::Bindings::::rootObject):
645 (KJS::Bindings::::setValueAt):
646 (KJS::Bindings::::valueAt):
647 * bindings/qt/qt_runtime.h:
648 (KJS::Bindings::QtField::):
649 (KJS::Bindings::QtField::QtField):
650 (KJS::Bindings::QtField::fieldType):
651 (KJS::Bindings::QtMethod::QtMethod):
652 (KJS::Bindings::QtMethod::name):
653 (KJS::Bindings::QtMethod::numParameters):
654 (KJS::Bindings::QtArray::getLength):
655 (KJS::Bindings::QtRuntimeMethod::d_func):
656 (KJS::Bindings::QtRuntimeMetaMethod::d_func):
657 (KJS::Bindings::QtRuntimeConnectionMethod::d_func):
659 * bindings/runtime.cpp:
660 (KJS::Bindings::Instance::createBindingForLanguageInstance):
661 (KJS::Bindings::Instance::createRuntimeObject):
662 (KJS::Bindings::Instance::reallyCreateRuntimeObject):
663 * bindings/runtime.h:
665 2008-01-22 Anders Carlsson <andersca@apple.com>
667 Reviewed by Darin and Adam.
669 <rdar://problem/5688975>
670 div element on microsoft site has wrong left offset.
672 Return true even if NPN_GetProperty returns null or undefined. This matches Firefox
673 (and is what the Silverlight plug-in expects).
675 * bindings/NP_jsobject.cpp:
678 2008-01-21 Geoffrey Garen <ggaren@apple.com>
680 Reviewed by Maciej Stachowiak.
682 Fixed http://bugs.webkit.org/show_bug.cgi?id=16909
683 REGRESSION: Amazon.com crash (ActivationImp)
685 (and a bunch of other crashes)
687 Plus, a .7% SunSpider speedup to boot.
689 Replaced the buggy currentExec and savedExec mechanisms with an
690 explicit ExecState stack.
693 (KJS::Collector::collect): Explicitly mark the ExecState stack.
695 (KJS::Collector::reportOutOfMemoryToAllExecStates): Slight change in
696 behavior: We no longer throw an exception in any global ExecStates,
697 since global ExecStates are more like pseudo-ExecStates, and aren't
698 used for script execution. (It's unclear what would happen if you left
699 an exception waiting around in a global ExecState, but it probably
702 2008-01-21 Jan Michael Alonzo <jmalonzo@unpluggable.com>
704 Reviewed by Alp Toker.
706 http://bugs.webkit.org/show_bug.cgi?id=16955
707 Get errors when cross-compile webkit-gtk
709 * GNUmakefile.am: removed ICU_CFLAGS
711 2008-01-18 Kevin McCullough <kmccullough@apple.com>
717 2008-01-18 Kevin McCullough <kmccullough@apple.com>
723 (KJS::UString::cost):
725 2008-01-18 Kevin McCullough <kmccullough@apple.com>
729 - Correctly report cost of appended strings to trigger GC.
733 (KJS::UString::Rep::create):
734 (KJS::UString::UString): Don't create unnecssary objects.
735 (KJS::UString::cost): Report cost if necessary but also keep track of
739 2008-01-18 Simon Hausmann <hausmann@webkit.org>
743 Fix return type conversions from Qt slots to JS values.
745 This also fixes fast/dom/open-and-close-by-DOM.html, which called
746 layoutTestController.windowCount().
748 When constructing the QVariant that holds the return type we cannot
749 use the QVarian(Type) constuctor as that will create a null variant.
750 We have to use the QVariant(Type, void *) constructor instead, just
751 like in QMetaObject::read() for example.
754 * bindings/qt/qt_instance.cpp:
755 (KJS::Bindings::QtInstance::getRuntimeObject):
757 2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
759 Reviewed by Simon Hausmann <hausmann@webkit.org>.
761 Fix compilation on Win64(2): Implemented currentThreadStackBase on X86-64 on Windows
765 (KJS::Collector::heapAllocate):
767 2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
769 Reviewed by Simon Hausmann <hausmann@webkit.org>.
771 Fix compilation on Win64(1): Define WTF_PLATFORM_X86_64 correctly on Win64.
776 2008-01-17 Antti Koivisto <antti@apple.com>
780 * kjs/regexp_object.cpp:
781 (KJS::regExpProtoFuncToString):
783 2008-01-16 Sam Weinig <sam@webkit.org>
787 Fix for http://bugs.webkit.org/show_bug.cgi?id=16901
788 Convert remaining JS function objects to use the new PrototypeFunction class
790 - Moves Boolean, Function, RegExp, Number, Object and Global functions to their
791 own static function implementations so that they can be used with the
792 PrototypeFunction class. SunSpider says this is 1.003x as fast.
794 * kjs/JSGlobalObject.cpp:
795 (KJS::JSGlobalObject::reset):
796 * kjs/array_object.h:
797 * kjs/bool_object.cpp:
798 (KJS::BooleanInstance::BooleanInstance):
799 (KJS::BooleanPrototype::BooleanPrototype):
800 (KJS::booleanProtoFuncToString):
801 (KJS::booleanProtoFuncValueOf):
802 (KJS::BooleanObjectImp::BooleanObjectImp):
803 (KJS::BooleanObjectImp::implementsConstruct):
804 (KJS::BooleanObjectImp::construct):
805 (KJS::BooleanObjectImp::callAsFunction):
807 (KJS::BooleanInstance::classInfo):
808 * kjs/error_object.cpp:
809 (KJS::ErrorPrototype::ErrorPrototype):
810 (KJS::errorProtoFuncToString):
811 * kjs/error_object.h:
813 (KJS::globalFuncEval):
814 (KJS::globalFuncParseInt):
815 (KJS::globalFuncParseFloat):
816 (KJS::globalFuncIsNaN):
817 (KJS::globalFuncIsFinite):
818 (KJS::globalFuncDecodeURI):
819 (KJS::globalFuncDecodeURIComponent):
820 (KJS::globalFuncEncodeURI):
821 (KJS::globalFuncEncodeURIComponent):
822 (KJS::globalFuncEscape):
823 (KJS::globalFuncUnEscape):
824 (KJS::globalFuncKJSPrint):
825 (KJS::PrototypeFunction::PrototypeFunction):
827 * kjs/function_object.cpp:
828 (KJS::FunctionPrototype::FunctionPrototype):
829 (KJS::functionProtoFuncToString):
830 (KJS::functionProtoFuncApply):
831 (KJS::functionProtoFuncCall):
832 * kjs/function_object.h:
833 * kjs/number_object.cpp:
834 (KJS::NumberPrototype::NumberPrototype):
835 (KJS::numberProtoFuncToString):
836 (KJS::numberProtoFuncToLocaleString):
837 (KJS::numberProtoFuncValueOf):
838 (KJS::numberProtoFuncToFixed):
839 (KJS::numberProtoFuncToExponential):
840 (KJS::numberProtoFuncToPrecision):
841 * kjs/number_object.h:
842 (KJS::NumberInstance::classInfo):
843 (KJS::NumberObjectImp::classInfo):
844 (KJS::NumberObjectImp::):
845 * kjs/object_object.cpp:
846 (KJS::ObjectPrototype::ObjectPrototype):
847 (KJS::objectProtoFuncValueOf):
848 (KJS::objectProtoFuncHasOwnProperty):
849 (KJS::objectProtoFuncIsPrototypeOf):
850 (KJS::objectProtoFuncDefineGetter):
851 (KJS::objectProtoFuncDefineSetter):
852 (KJS::objectProtoFuncLookupGetter):
853 (KJS::objectProtoFuncLookupSetter):
854 (KJS::objectProtoFuncPropertyIsEnumerable):
855 (KJS::objectProtoFuncToLocaleString):
856 (KJS::objectProtoFuncToString):
857 * kjs/object_object.h:
858 * kjs/regexp_object.cpp:
859 (KJS::RegExpPrototype::RegExpPrototype):
860 (KJS::regExpProtoFuncTest):
861 (KJS::regExpProtoFuncExec):
862 (KJS::regExpProtoFuncCompile):
863 (KJS::regExpProtoFuncToString):
864 * kjs/regexp_object.h:
866 2008-01-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
868 Reviewed by Maciej & Darin.
870 Fixes Bug 16868: Gmail crash
871 and Bug 16871: Crash when loading apple.com/startpage
873 <http://bugs.webkit.org/show_bug.cgi?id=16868>
874 <rdar://problem/5686108>
876 <http://bugs.webkit.org/show_bug.cgi?id=16871>
877 <rdar://problem/5686670>
879 Adds ActivationImp tear-off for cross-window eval() and fixes an
880 existing garbage collection issue exposed by the ActivationImp tear-off
881 patch (r29425) that can occur when an ExecState's m_callingExec is
882 different than its m_savedExec.
885 (KJS::ExecState::mark):
887 (KJS::GlobalFuncImp::callAsFunction):
889 2008-01-16 Sam Weinig <sam@webkit.org>
893 Clean up MathObjectImp, it needed a little scrubbing.
895 * kjs/math_object.cpp:
896 (KJS::MathObjectImp::MathObjectImp):
897 (KJS::MathObjectImp::getOwnPropertySlot):
898 (KJS::MathObjectImp::getValueProperty):
899 (KJS::mathProtoFuncACos):
900 (KJS::mathProtoFuncASin):
901 (KJS::mathProtoFuncATan):
902 (KJS::mathProtoFuncATan2):
903 (KJS::mathProtoFuncCos):
904 (KJS::mathProtoFuncExp):
905 (KJS::mathProtoFuncLog):
906 (KJS::mathProtoFuncSin):
907 (KJS::mathProtoFuncSqrt):
908 (KJS::mathProtoFuncTan):
910 (KJS::MathObjectImp::classInfo):
911 (KJS::MathObjectImp::):
913 2008-01-16 Sam Weinig <sam@webkit.org>
915 Reviewed by Geoffrey Garen.
917 Rename Lexer variable bol to atLineStart.
921 (KJS::Lexer::setCode):
922 (KJS::Lexer::nextLine):
926 2008-01-16 Sam Weinig <sam@webkit.org>
928 Reviewed by Geoffrey Garen and Anders Carlsson.
930 Remove uses of KJS_PURE_ECMA as we don't ever build with it defined,
931 and we have many features that are not included in the ECMA spec.
935 (KJS::Lexer::setCode):
936 (KJS::Lexer::nextLine):
939 * kjs/string_object.cpp:
940 * kjs/string_object.h:
942 2008-01-15 Sam Weinig <sam@webkit.org>
944 Reviewed by Geoffrey Garen.
946 Fix <rdar://problem/5595552> r27608 introduced a 20% increase in JS binary size, 4% increase in WebCore binary size
948 - This changes the way JS functions that use Lookup tables are handled. Instead of using
949 one class per function, which allowed specialization of the virtual callAsFunction
950 method, we now use one class, PrototypeFunction, which takes a pointer to a static
951 function to use as the implementation. This significantly decreases the binary size
952 of JavaScriptCore (about 145k on an Intel only build) while still keeping some of the
953 speedup r27608 garnered (SunSpider says this is 1.005x as slow, which should leave some
954 wiggle room from the original 1% speedup) and keeps the functions implementations in separate
955 functions to help with optimizations.
957 * JavaScriptCore.exp:
958 * JavaScriptCore.xcodeproj/project.pbxproj:
959 * kjs/array_object.cpp:
960 (KJS::arrayProtoFuncToString):
961 (KJS::arrayProtoFuncToLocaleString):
962 (KJS::arrayProtoFuncJoin):
963 (KJS::arrayProtoFuncConcat):
964 (KJS::arrayProtoFuncPop):
965 (KJS::arrayProtoFuncPush):
966 (KJS::arrayProtoFuncReverse):
967 (KJS::arrayProtoFuncShift):
968 (KJS::arrayProtoFuncSlice):
969 (KJS::arrayProtoFuncSort):
970 (KJS::arrayProtoFuncSplice):
971 (KJS::arrayProtoFuncUnShift):
972 (KJS::arrayProtoFuncFilter):
973 (KJS::arrayProtoFuncMap):
974 (KJS::arrayProtoFuncEvery):
975 (KJS::arrayProtoFuncForEach):
976 (KJS::arrayProtoFuncSome):
977 (KJS::arrayProtoFuncIndexOf):
978 (KJS::arrayProtoFuncLastIndexOf):
979 * kjs/array_object.h:
980 * kjs/date_object.cpp:
981 (KJS::DatePrototype::getOwnPropertySlot):
982 (KJS::dateProtoFuncToString):
983 (KJS::dateProtoFuncToUTCString):
984 (KJS::dateProtoFuncToDateString):
985 (KJS::dateProtoFuncToTimeString):
986 (KJS::dateProtoFuncToLocaleString):
987 (KJS::dateProtoFuncToLocaleDateString):
988 (KJS::dateProtoFuncToLocaleTimeString):
989 (KJS::dateProtoFuncValueOf):
990 (KJS::dateProtoFuncGetTime):
991 (KJS::dateProtoFuncGetFullYear):
992 (KJS::dateProtoFuncGetUTCFullYear):
993 (KJS::dateProtoFuncToGMTString):
994 (KJS::dateProtoFuncGetMonth):
995 (KJS::dateProtoFuncGetUTCMonth):
996 (KJS::dateProtoFuncGetDate):
997 (KJS::dateProtoFuncGetUTCDate):
998 (KJS::dateProtoFuncGetDay):
999 (KJS::dateProtoFuncGetUTCDay):
1000 (KJS::dateProtoFuncGetHours):
1001 (KJS::dateProtoFuncGetUTCHours):
1002 (KJS::dateProtoFuncGetMinutes):
1003 (KJS::dateProtoFuncGetUTCMinutes):
1004 (KJS::dateProtoFuncGetSeconds):
1005 (KJS::dateProtoFuncGetUTCSeconds):
1006 (KJS::dateProtoFuncGetMilliSeconds):
1007 (KJS::dateProtoFuncGetUTCMilliseconds):
1008 (KJS::dateProtoFuncGetTimezoneOffset):
1009 (KJS::dateProtoFuncSetTime):
1010 (KJS::dateProtoFuncSetMilliSeconds):
1011 (KJS::dateProtoFuncSetUTCMilliseconds):
1012 (KJS::dateProtoFuncSetSeconds):
1013 (KJS::dateProtoFuncSetUTCSeconds):
1014 (KJS::dateProtoFuncSetMinutes):
1015 (KJS::dateProtoFuncSetUTCMinutes):
1016 (KJS::dateProtoFuncSetHours):
1017 (KJS::dateProtoFuncSetUTCHours):
1018 (KJS::dateProtoFuncSetDate):
1019 (KJS::dateProtoFuncSetUTCDate):
1020 (KJS::dateProtoFuncSetMonth):
1021 (KJS::dateProtoFuncSetUTCMonth):
1022 (KJS::dateProtoFuncSetFullYear):
1023 (KJS::dateProtoFuncSetUTCFullYear):
1024 (KJS::dateProtoFuncSetYear):
1025 (KJS::dateProtoFuncGetYear):
1026 * kjs/date_object.h:
1028 (KJS::PrototypeFunction::PrototypeFunction):
1029 (KJS::PrototypeFunction::callAsFunction):
1033 (KJS::staticFunctionGetter):
1034 * kjs/math_object.cpp:
1035 (KJS::mathProtoFuncAbs):
1036 (KJS::mathProtoFuncACos):
1037 (KJS::mathProtoFuncASin):
1038 (KJS::mathProtoFuncATan):
1039 (KJS::mathProtoFuncATan2):
1040 (KJS::mathProtoFuncCeil):
1041 (KJS::mathProtoFuncCos):
1042 (KJS::mathProtoFuncExp):
1043 (KJS::mathProtoFuncFloor):
1044 (KJS::mathProtoFuncLog):
1045 (KJS::mathProtoFuncMax):
1046 (KJS::mathProtoFuncMin):
1047 (KJS::mathProtoFuncPow):
1048 (KJS::mathProtoFuncRandom):
1049 (KJS::mathProtoFuncRound):
1050 (KJS::mathProtoFuncSin):
1051 (KJS::mathProtoFuncSqrt):
1052 (KJS::mathProtoFuncTan):
1053 * kjs/math_object.h:
1054 * kjs/string_object.cpp:
1055 (KJS::stringProtoFuncToString):
1056 (KJS::stringProtoFuncValueOf):
1057 (KJS::stringProtoFuncCharAt):
1058 (KJS::stringProtoFuncCharCodeAt):
1059 (KJS::stringProtoFuncConcat):
1060 (KJS::stringProtoFuncIndexOf):
1061 (KJS::stringProtoFuncLastIndexOf):
1062 (KJS::stringProtoFuncMatch):
1063 (KJS::stringProtoFuncSearch):
1064 (KJS::stringProtoFuncReplace):
1065 (KJS::stringProtoFuncSlice):
1066 (KJS::stringProtoFuncSplit):
1067 (KJS::stringProtoFuncSubstr):
1068 (KJS::stringProtoFuncSubstring):
1069 (KJS::stringProtoFuncToLowerCase):
1070 (KJS::stringProtoFuncToUpperCase):
1071 (KJS::stringProtoFuncToLocaleLowerCase):
1072 (KJS::stringProtoFuncToLocaleUpperCase):
1073 (KJS::stringProtoFuncLocaleCompare):
1074 (KJS::stringProtoFuncBig):
1075 (KJS::stringProtoFuncSmall):
1076 (KJS::stringProtoFuncBlink):
1077 (KJS::stringProtoFuncBold):
1078 (KJS::stringProtoFuncFixed):
1079 (KJS::stringProtoFuncItalics):
1080 (KJS::stringProtoFuncStrike):
1081 (KJS::stringProtoFuncSub):
1082 (KJS::stringProtoFuncSup):
1083 (KJS::stringProtoFuncFontcolor):
1084 (KJS::stringProtoFuncFontsize):
1085 (KJS::stringProtoFuncAnchor):
1086 (KJS::stringProtoFuncLink):
1087 * kjs/string_object.h:
1089 2008-01-15 Geoffrey Garen <ggaren@apple.com>
1091 Reviewed by Adam Roben.
1093 Some tweaks to our headerdoc, suggested by David Gatwood on the docs
1097 * API/JSObjectRef.h:
1098 * API/JSStringRef.h:
1101 2008-01-15 Alp Toker <alp@atoker.com>
1103 Rubber-stamped by Anders.
1105 Make the HTTP backend configurable in the GTK+ port. curl is currently
1108 * wtf/Platform.h: Don't hard-code WTF_USE_CURL for GTK
1110 2008-01-15 Sam Weinig <sam@webkit.org>
1112 Reviewed by Beth Dakin.
1114 Remove unneeded variable.
1116 * kjs/string_object.cpp:
1117 (KJS::StringProtoFuncSubstr::callAsFunction):
1119 2008-01-14 Steve Falkenburg <sfalken@apple.com>
1121 Use shared vsprops for most vcproj properties.
1125 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add missing Debug_Internal config.
1126 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add missing Debug_Internal config.
1127 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
1129 2008-01-14 Adam Roben <aroben@apple.com>
1131 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
1132 some headers that were missing from the vcproj so their contents will
1133 be included in Find in Files.
1135 2008-01-14 Adam Roben <aroben@apple.com>
1137 Fix Bug 16871: Crash when loading apple.com/startpage
1139 <http://bugs.webkit.org/show_bug.cgi?id=16871>
1140 <rdar://problem/5686670>
1142 Patch written by Darin, reviewed by me.
1144 * kjs/ExecState.cpp:
1145 (KJS::ExecState::mark): Call ActivationImp::markChildren if our
1146 m_activation is on the stack. This is what ScopeChain::mark also does,
1147 but apparently in some cases it's possible for an ExecState's
1148 ActivationImp to not be in any ScopeChain.
1150 2008-01-14 Kevin McCullough <kmccullough@apple.com>
1154 -<rdar://problem/5622667> REGRESSION (Leopard-ToT): Endless loading loop
1155 trying to view techreport.com comments
1156 - We need to set values in the map, because if they are already in the
1157 map they will not be reset when we use add().
1159 * kjs/array_instance.cpp:
1160 (KJS::ArrayInstance::put):
1162 2008-01-14 Darin Adler <darin@apple.com>
1166 - re-speed-up the page load test (my StringImpl change slowed it down)
1169 (WTF::RefCounted::RefCounted): Allow derived classes to start with a reference
1170 count other than 0. Eventually everyone will want to start with a 1. This is a
1171 staged change. For now, there's a default of 0, and you can specify 1. Later,
1172 there will be no default and everyone will have to specify. And then later, there
1173 will be a default of 1. Eventually, we can take away even the option of starting
1177 (WTF::Vector::Vector): Sped up creation of non-empty vectors by removing the
1178 overhead of first constructing something empty and then calling resize.
1179 (WTF::Vector::clear): Sped up the common case of calling clear on an empty
1180 vector by adding a check for that case.
1181 (WTF::Vector::releaseBuffer): Marked this function inline and removed a branch
1182 in the case of vectors with no inline capacity (normal vectors) by leaving out
1183 the code to copy the inline buffer in that case.
1185 2008-01-14 Alexey Proskuryakov <ap@webkit.org>
1187 Reviewed by David Kilzer.
1189 http://bugs.webkit.org/show_bug.cgi?id=16787
1190 array.splice() with 1 element not working
1192 Test: fast/js/array-splice.html
1194 * kjs/array_object.cpp:
1195 (KJS::ArrayProtoFuncSplice::callAsFunction): Implement this Mozilla extension, and fix
1196 some other edge cases.
1198 2008-01-13 Steve Falkenburg <sfalken@apple.com>
1200 Share common files across projects.
1203 Debug: common.vsprops, debug.vsprops
1204 Debug_Internal: common.vsprops, debug.vsprops, debug_internal.vsprops
1205 Release: common.vsprops, release.vsprops
1207 Shared properties can go into common.vsprops, shared debug settings can go into debug.vsprops.
1208 debug_internal.vsprops will be mostly empty except for file path prefix modifiers.
1210 Reviewed by Adam Roben.
1212 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1213 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
1214 * JavaScriptCore.vcproj/debug.vsprops: Removed.
1215 * JavaScriptCore.vcproj/debug_internal.vsprops: Removed.
1216 * JavaScriptCore.vcproj/release.vsprops: Removed.
1217 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
1219 2008-01-13 Marius Bugge Monsen <mbm@trolltech.com>
1221 Contributions and review by Adriaan de Groot,
1222 Simon Hausmann, Eric Seidel, and Darin Adler.
1224 - http://bugs.webkit.org/show_bug.cgi?id=16590
1225 Compilation fixes for Solaris.
1228 (KJS::GregorianDateTime::GregorianDateTime): Use the WIN_OS code path
1229 for SOLARIS too, presumably because Solaris also lacks the tm_gtoff and tm_zone
1231 (KJS::GregorianDateTime::operator tm): Ditto.
1233 * kjs/collector.cpp:
1234 (KJS::currentThreadStackBase): Use thr_stksegment on Solaris.
1237 (isfinite): Implement for Solaris.
1239 (signbit): Ditto. But this one is wrong, so I added a FIXME.
1241 * wtf/Platform.h: Define PLATFORM(SOLARIS) when "sun" or "__sun" is defined.
1243 2008-01-13 Michael Goddard <michael.goddard@trolltech.com>
1245 Reviewed by Anders Carlsson.
1247 Add binding language type to Instance.
1248 Allows runtime determination of the type of an
1249 Instance, to allow safe casting. Doesn't actually
1250 add any safe casting yet, though.
1252 Add a helper function to get an Instance from a JSObject*.
1253 Given an object and the expected binding language, see if
1254 the JSObject actually wraps an Instance of the given type
1255 and return it. Otherwise return 0.
1257 Move RuntimeObjectImp creations into Instance.
1258 Make the ctor protected, and Instance a friend class, so
1259 that all creation of RuntimeObjectImps goes through
1262 Remove copy ctor/assignment operator for QtInstance.
1263 Instance itself is Noncopyable, so QtInstance doesn't
1266 Add caching for QtInstance and associated RuntimeObjectImps.
1267 Push any dealings with QtLanguage bindings into QtInstance,
1268 and cache them there, rather than in the Instance layer. Add
1269 a QtRuntimeObjectImp to help with caching.
1271 * JavaScriptCore.exp:
1272 * bindings/c/c_instance.h:
1273 * bindings/jni/jni_instance.h:
1274 * bindings/objc/objc_instance.h:
1275 * bindings/qt/qt_instance.cpp:
1276 (KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
1277 (KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
1278 (KJS::Bindings::QtRuntimeObjectImp::invalidate):
1279 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
1280 (KJS::Bindings::QtInstance::QtInstance):
1281 (KJS::Bindings::QtInstance::~QtInstance):
1282 (KJS::Bindings::QtInstance::getQtInstance):
1283 (KJS::Bindings::QtInstance::getRuntimeObject):
1284 * bindings/qt/qt_instance.h:
1285 (KJS::Bindings::QtInstance::getBindingLanguage):
1286 * bindings/runtime.cpp:
1287 (KJS::Bindings::Instance::createBindingForLanguageInstance):
1288 (KJS::Bindings::Instance::createRuntimeObject):
1289 (KJS::Bindings::Instance::getInstance):
1290 * bindings/runtime.h:
1291 * bindings/runtime_object.h:
1292 (KJS::RuntimeObjectImp::getInternalInstance):
1294 2008-01-12 Alp Toker <alp@atoker.com>
1296 Reviewed by Mark Rowe.
1298 Hide non-public symbols in GTK+/autotools release builds.
1302 2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1304 Reviewed by Mark Rowe.
1306 Fix http://bugs.webkit.org/show_bug.cgi?id=16852
1307 Fixes leaking of ActivationStackNode objects.
1309 * kjs/JSGlobalObject.cpp:
1310 (KJS::JSGlobalObject::deleteActivationStack):
1311 (KJS::JSGlobalObject::~JSGlobalObject):
1312 (KJS::JSGlobalObject::init):
1313 (KJS::JSGlobalObject::reset):
1314 * kjs/JSGlobalObject.h:
1316 2008-01-12 Darin Adler <darin@apple.com>
1318 - try to fix Qt Windows build
1320 * pcre/dftables: Remove reliance on the list form of Perl pipes.
1322 2008-01-12 Darin Adler <darin@apple.com>
1324 - try to fix Qt build
1326 * kjs/function.cpp: Added include of scope_chain_mark.h.
1327 * kjs/scope_chain_mark.h: Added multiple-include guards.
1329 2008-01-12 Mark Rowe <mrowe@apple.com>
1331 Another Windows build fix.
1335 2008-01-12 Mark Rowe <mrowe@apple.com>
1337 Attempted Windows build fix. Use struct consistently when forward-declaring
1338 ActivationStackNode and StackActivation.
1341 * kjs/JSGlobalObject.h:
1343 2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1347 Fixes a problem with the ActivationImp tear-off patch (r29425) where
1348 some of the calls to JSGlobalObject::tearOffActivation() were using
1349 the wrong test to determine whether it should leave a relic behind.
1352 (KJS::FunctionImp::argumentsGetter):
1353 (KJS::ActivationImp::getOwnPropertySlot):
1355 2008-01-11 Geoffrey Garen <ggaren@apple.com>
1357 Reviewed by Oliver Hunt.
1359 Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
1360 variable access (16644)
1362 This bug was caused by var declarations shadowing built-in properties of
1365 To match Firefox, we've decided that var declarations will never shadow
1366 built-in properties of the global object or its prototypes. We used to
1367 behave more like IE, which allows shadowing, but walking that line got
1368 us into trouble with websites that sent us down the Firefox codepath.
1370 * kjs/JSVariableObject.h:
1371 (KJS::JSVariableObject::symbolTableGet): New code to support calling
1372 hasProperty before the variable object is fully initialized (so you
1373 can call it during initialization).
1376 (KJS::ProgramNode::initializeSymbolTable): Always do a full hasProperty
1377 check when looking for duplicates, not getDirect, since it only checks
1378 the property map, and not hasOwnProperty, since it doesn't check
1380 (KJS::EvalNode::processDeclarations): ditto
1382 * kjs/property_slot.h:
1383 (KJS::PropertySlot::ungettableGetter): Best function name evar.
1385 2008-01-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1389 Optimized ActivationImp allocation, so that activation records are now
1390 first allocated on an explicitly managed stack and only heap allocated
1391 when necessary. Roughly a 5% improvement on SunSpider, and a larger
1392 improvement on benchmarks that use more function calls.
1394 * JavaScriptCore.xcodeproj/project.pbxproj:
1395 * kjs/Activation.h: Added.
1396 (KJS::ActivationImp::ActivationData::ActivationData):
1397 (KJS::ActivationImp::ActivationImp):
1398 (KJS::ActivationImp::classInfo):
1399 (KJS::ActivationImp::isActivationObject):
1400 (KJS::ActivationImp::isOnStack):
1401 (KJS::ActivationImp::d):
1402 (KJS::StackActivation::StackActivation):
1403 * kjs/ExecState.cpp:
1404 (KJS::ExecState::ExecState):
1405 (KJS::ExecState::~ExecState):
1407 (KJS::ExecState::replaceScopeChainTop):
1408 (KJS::ExecState::setActivationObject):
1409 (KJS::ExecState::setLocalStorage):
1410 * kjs/JSGlobalObject.cpp:
1411 (KJS::JSGlobalObject::reset):
1412 (KJS::JSGlobalObject::pushActivation):
1413 (KJS::JSGlobalObject::checkActivationCount):
1414 (KJS::JSGlobalObject::popActivationHelper):
1415 (KJS::JSGlobalObject::popActivation):
1416 (KJS::JSGlobalObject::tearOffActivation):
1417 * kjs/JSGlobalObject.h:
1418 * kjs/JSVariableObject.h:
1419 (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
1420 (KJS::JSVariableObject::JSVariableObject):
1422 (KJS::FunctionImp::argumentsGetter):
1423 (KJS::ActivationImp::ActivationImp):
1424 (KJS::ActivationImp::~ActivationImp):
1425 (KJS::ActivationImp::init):
1426 (KJS::ActivationImp::getOwnPropertySlot):
1427 (KJS::ActivationImp::markHelper):
1428 (KJS::ActivationImp::mark):
1429 (KJS::ActivationImp::ActivationData::ActivationData):
1430 (KJS::GlobalFuncImp::callAsFunction):
1433 (KJS::PostIncResolveNode::evaluate):
1434 (KJS::PostDecResolveNode::evaluate):
1435 (KJS::PreIncResolveNode::evaluate):
1436 (KJS::PreDecResolveNode::evaluate):
1437 (KJS::ReadModifyResolveNode::evaluate):
1438 (KJS::AssignResolveNode::evaluate):
1439 (KJS::WithNode::execute):
1440 (KJS::TryNode::execute):
1441 (KJS::FunctionBodyNode::processDeclarations):
1442 (KJS::FuncExprNode::evaluate):
1444 * kjs/scope_chain.h:
1445 (KJS::ScopeChain::replace):
1446 * kjs/scope_chain_mark.h: Added.
1447 (KJS::ScopeChain::mark):
1449 2008-01-11 Simon Hausmann <hausmann@webkit.org>
1451 Reviewed by Mark Rowe.
1453 Fix the (clean) qmake build. For generating chartables.c we don't
1454 depend on a separate input source file anymore, the dftables perl
1455 script is enough. So use that instead as value for the .input
1456 variable, to ensure that qmake also generates a rule to call dftables.
1460 2008-01-10 Geoffrey Garen <ggaren@apple.com>
1462 Reviewed by John Sullivan.
1464 Fixed some world leak reports:
1465 * <rdar://problem/5669436> PLT complains about world leak of 1 JavaScript
1466 Interpreter after running cvs-base suite
1468 * <rdar://problem/5669423> PLT complains about world leak if browser
1469 window is open when PLT starts
1471 * kjs/collector.h: Added the ability to distinguish between global
1472 objects and GC-protected global objects, since we only consider the
1473 latter to be world leaks.
1474 * kjs/collector.cpp:
1476 2008-01-11 Mark Rowe <mrowe@apple.com>
1478 Silence qmake warning about ctgen lacking input.
1480 Rubber-stamped by Alp Toker.
1484 2008-01-10 David Kilzer <ddkilzer@apple.com>
1486 dftables should be rewritten as a script
1488 <http://bugs.webkit.org/show_bug.cgi?id=16818>
1489 <rdar://problem/5681463>
1493 Rewrote the dftables utility in Perl. Attempted to switch all
1494 build systems to call the script directly instead of building
1495 a binary first. Only the Xcode build was able to be tested.
1497 * DerivedSources.make: Added pcre directory to VPATH and changed
1498 to invoke dftables directly.
1499 * GNUmakefile.am: Removed build information and changed to invoke
1501 * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed reference to
1503 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
1504 * JavaScriptCore.vcproj/dftables: Removed.
1505 * JavaScriptCore.vcproj/dftables/dftables.vcproj: Removed.
1506 * JavaScriptCore.xcodeproj/project.pbxproj: Removed dftables target.
1507 * jscore.bkl: Removed dftables executable definition.
1508 * pcre/dftables: Copied from JavaScriptCore/pcre/dftables.cpp.
1509 * pcre/dftables.cpp: Removed.
1510 * pcre/dftables.pro: Removed.
1511 * pcre/pcre.pri: Removed references to dftables.cpp and changed to
1512 invoke dftables directly.
1514 2008-01-10 Dan Bernstein <mitz@apple.com>
1516 Reviewed by Darin Adler.
1518 - fix http://bugs.webkit.org/show_bug.cgi?id=16782
1519 <rdar://problem/5675331> REGRESSION(r29266): Reproducible crash in fast/replaced/image-map.html
1521 The crash resulted from a native object (DumpRenderTree's
1522 EventSender) causing its wrapper to be invalidated (by clicking a
1523 link that replaced the document in the window) and consequently
1524 deallocated. The fix is to use RefPtrs to protect the native object
1525 from deletion by self-invalidation.
1527 * bindings/runtime_method.cpp:
1528 (RuntimeMethod::callAsFunction):
1529 * bindings/runtime_object.cpp:
1530 (RuntimeObjectImp::fallbackObjectGetter):
1531 (RuntimeObjectImp::fieldGetter):
1532 (RuntimeObjectImp::methodGetter):
1533 (RuntimeObjectImp::put):
1534 (RuntimeObjectImp::defaultValue):
1535 (RuntimeObjectImp::callAsFunction):
1537 2008-01-07 Mark Rowe <mrowe@apple.com>
1539 Reviewed by Maciej Stachowiak.
1541 Turn testIsInteger assertions into compile-time asserts and move them into HashTraits.h
1547 2008-01-07 Nikolas Zimmermann <zimmermann@kde.org>
1551 Enable SVG_FONTS by default.
1553 * Configurations/JavaScriptCore.xcconfig:
1555 2008-01-07 Darin Adler <darin@apple.com>
1557 Rubber stamped by David Kilzer.
1559 - get rid of empty fpconst.cpp
1561 * GNUmakefile.am: Remove fpconst.cpp.
1562 * JavaScriptCore.pri: Ditto.
1563 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
1564 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
1565 * JavaScriptCoreSources.bkl: Ditto.
1567 * kjs/fpconst.cpp: Removed.
1569 2008-01-07 Darin Adler <darin@apple.com>
1571 Reviewed by David Kilzer.
1573 - fix alignment problem with NaN and Inf globals
1575 * kjs/fpconst.cpp: Move the contents of this file from here back to
1576 value.cpp. The reason this was in a separate file is that the DARWIN
1577 version of this used a declaration of the globals with a different
1578 type to avoid creating "init routines". That's no longer necessary for
1579 DARWIN and was never necessary for the non-DARWIN code path.
1580 To make this patch easy to merge, I didn't actually delete this file
1581 yet. We'll do that in a separate changeset.
1583 * kjs/value.cpp: If C99's NAN and INFINITY are present, then use them,
1584 othrewise use the union trick from fpconst.cpp. I think it would be
1585 better to eliminate KJS::NaN and KJS::Inf and just use NAN and INFINITY
1586 directly or std::numeric_limits<double>::quiet_nan() and
1587 std::numeric_limits<double>::infinity(). But when I tried that, it
1588 slowed down SunSpider. Someone else could do that cleanup if they
1589 could do it without slowing down the engine.
1591 2008-01-07 Adam Roben <aroben@apple.com>
1595 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
1596 JavaScript.h to the project.
1597 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
1598 Copy JavaScript.h to WEBKITOUTPUTDIR.
1600 2008-01-07 Timothy Hatcher <timothy@apple.com>
1611 * API/JavaScriptCore.h:
1613 * JavaScriptCore.xcodeproj/project.pbxproj:
1615 2008-01-07 Alp Toker <alp@atoker.com>
1619 http://bugs.webkit.org/show_bug.cgi?id=16029
1620 JavaScriptCore.h is not suitable for platforms other than Mac OS X
1622 Introduce a new JavaScriptCore/JavaScript.h public API header. This
1623 should be used by all new portable code using the JavaScriptCore API.
1625 JavaScriptCore/JavaScriptCore.h will remain for compatibility with
1626 existing applications that depend on it including JSStringRefCF.h
1627 which isn't portable.
1629 Also add minidom to the GTK+/autotools build since we can now support
1630 it on all platforms.
1634 * API/JavaScript.h: Added.
1635 * API/JavaScriptCore.h:
1636 * ForwardingHeaders/JavaScriptCore/JavaScript.h: Added.
1638 * JavaScriptCore.xcodeproj/project.pbxproj:
1640 2008-01-06 Eric Seidel <eric@webkit.org>
1644 Abstract all DateObject.set* functions in preparation for fixing:
1645 http://bugs.webkit.org/show_bug.cgi?id=16753
1647 SunSpider had random changes here and there but was overall a wash.
1649 * kjs/date_object.cpp:
1650 (KJS::fillStructuresUsingTimeArgs):
1651 (KJS::setNewValueFromTimeArgs):
1652 (KJS::setNewValueFromDateArgs):
1653 (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
1654 (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
1655 (KJS::DateProtoFuncSetSeconds::callAsFunction):
1656 (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
1657 (KJS::DateProtoFuncSetMinutes::callAsFunction):
1658 (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
1659 (KJS::DateProtoFuncSetHours::callAsFunction):
1660 (KJS::DateProtoFuncSetUTCHours::callAsFunction):
1661 (KJS::DateProtoFuncSetDate::callAsFunction):
1662 (KJS::DateProtoFuncSetUTCDate::callAsFunction):
1663 (KJS::DateProtoFuncSetMonth::callAsFunction):
1664 (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
1665 (KJS::DateProtoFuncSetFullYear::callAsFunction):
1666 (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
1668 2008-01-06 Nikolas Zimmermann <zimmermann@kde.org>
1672 Add new helper function isArabicChar - SVG Fonts support needs it.
1674 * wtf/unicode/icu/UnicodeIcu.h:
1675 (WTF::Unicode::isArabicChar):
1676 * wtf/unicode/qt4/UnicodeQt4.h:
1677 (WTF::Unicode::isArabicChar):
1679 2008-01-06 Alp Toker <alp@atoker.com>
1681 Reviewed by Mark Rowe.
1683 Use $(EXEEXT) to account for the .exe extension in the GTK+ Windows
1684 build. (This is already done correctly in DerivedSources.make.) Issue
1685 noticed by Mikkel when building in Cygwin.
1687 Add a missing slash. This was a hack from the qmake build system that
1688 isn't necessary with autotools.
1692 2008-01-05 Darin Adler <darin@apple.com>
1694 * API/JSRetainPtr.h: One more file that needed the change below.
1696 2008-01-05 Darin Adler <darin@apple.com>
1698 * wtf/OwnPtr.h: OwnPtr needs the same fix as RefPtr below.
1700 2008-01-05 Adam Roben <aroben@apple.com>
1706 * wtf/RetainPtr.h: Use PtrType instead of T* because of the
1707 RemovePointer magic.
1709 2008-01-05 Darin Adler <darin@apple.com>
1711 Rubber stamped by Maciej Stachowiak.
1713 - cut down own PIC branches by using a pointer-to-member-data instead of a
1714 pointer-to-member-function in WTF smart pointers
1716 * wtf/OwnArrayPtr.h:
1721 Use a pointer to the m_ptr member instead of the get member.
1722 The GCC compiler generates better code for this idiom.
1724 2008-01-05 Henry Mason <hmason@mac.com>
1726 Reviewed by Maciej Stachowiak.
1728 http://bugs.webkit.org/show_bug.cgi?id=16738
1729 Bug 16738: Collector block offset could be stored as an cell offset instead of a byte offset
1731 Gives a 0.4% SunSpider boost and prettier code.
1733 * kjs/collector.cpp: Switched to cell offsets from byte offsets
1734 (KJS::Collector::heapAllocate):
1735 (KJS::Collector::sweep):
1737 2008-01-04 Mark Rowe <mrowe@apple.com>
1739 Reviewed by Maciej Stachowiak.
1741 Have the two malloc zones print useful diagnostics if their free method are unexpectedly invoked.
1742 Due to <rdar://problem/5671357> this can happen if an application attempts to free a pointer that
1743 was not allocated by any registered malloc zone on the system.
1745 * kjs/CollectorHeapIntrospector.h:
1746 * wtf/FastMalloc.cpp:
1748 2008-01-04 Alp Toker <alp@atoker.com>
1750 GTK+ autotools build fix. Terminate empty rules.
1754 2008-01-03 Simon Hausmann <hausmann@webkit.org>
1756 Reviewed by Mark Rowe.
1758 Fix compilation with gcc 4.3: limits.h is needed for INT_MAX.
1760 * pcre/pcre_exec.cpp:
1762 2008-01-03 Darin Adler <darin@apple.com>
1764 * tests/mozilla/expected.html: The fix for bug 16696 also fixed a test
1765 case, ecma_3/RegExp/perlstress-002.js, so updated results to expect
1766 that test to succeed.
1768 2008-01-02 Darin Adler <darin@apple.com>
1772 - fix http://bugs.webkit.org/show_bug.cgi?id=16696
1773 JSCRE fails fails to match Acid3 regexp
1775 Test: fast/regex/early-acid3-86.html
1777 The problem was with the cutoff point between backreferences and octal
1778 escape sequences. We need to determine the cutoff point by counting the
1779 total number of capturing brackets, which requires an extra pass through
1780 the expression when compiling it.
1782 * pcre/pcre_compile.cpp:
1783 (CompileData::CompileData): Added numCapturingBrackets. Removed some
1785 (compileBranch): Use numCapturingBrackets when calling checkEscape.
1786 (calculateCompiledPatternLength): Use numCapturingBrackets when calling
1787 checkEscape, and also store the bracket count at the end of the compile.
1788 (jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
1789 count the number of brackets and then a second time to calculate the length.
1791 2008-01-02 Darin Adler <darin@apple.com>
1795 - fix http://bugs.webkit.org/show_bug.cgi?id=16696
1796 JSCRE fails fails to match Acid3 regexp
1798 Test: fast/regex/early-acid3-86.html
1800 The problem was with the cutoff point between backreferences and octal
1801 escape sequences. We need to determine the cutoff point by counting the
1802 total number of capturing brackets, which requires an extra pass through
1803 the expression when compiling it.
1805 * pcre/pcre_compile.cpp:
1806 (CompileData::CompileData): Added numCapturingBrackets. Removed some
1808 (compileBranch): Use numCapturingBrackets when calling checkEscape.
1809 (calculateCompiledPatternLength): Use numCapturingBrackets when calling
1810 checkEscape, and also store the bracket count at the end of the compile.
1811 (jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
1812 count the number of brackets and then a second time to calculate the length.
1814 2008-01-02 David Kilzer <ddkilzer@webkit.org>
1816 Reviewed and landed by Darin.
1819 (KJS::DoWhileNode::execute): Added a missing return.
1821 2008-01-02 Darin Adler <darin@apple.com>
1823 - try to fix Qt build
1825 * wtf/unicode/qt4/UnicodeQt4.h:
1826 (WTF::Unicode::foldCase): Add some missing const.
1828 2008-01-02 Alice Liu <alice.liu@apple.com>
1830 Reviewed by Sam Weinig.
1832 need to export ASCIICType.h for use in DRT
1834 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
1836 (WTF::isASCIIUpper):
1838 2008-01-02 Sam Weinig <sam@webkit.org>
1840 Reviewed by Beth Dakin.
1842 Cleanup error_object.h/cpp.
1844 * kjs/JSGlobalObject.cpp:
1845 (KJS::JSGlobalObject::reset):
1846 * kjs/error_object.cpp:
1848 (KJS::ErrorInstance::ErrorInstance):
1849 (KJS::ErrorPrototype::ErrorPrototype):
1850 (KJS::ErrorProtoFuncToString::ErrorProtoFuncToString):
1851 (KJS::ErrorProtoFuncToString::callAsFunction):
1852 (KJS::ErrorObjectImp::ErrorObjectImp):
1853 (KJS::ErrorObjectImp::implementsConstruct):
1854 (KJS::ErrorObjectImp::construct):
1855 (KJS::ErrorObjectImp::callAsFunction):
1856 (KJS::NativeErrorPrototype::NativeErrorPrototype):
1857 (KJS::NativeErrorImp::NativeErrorImp):
1858 (KJS::NativeErrorImp::implementsConstruct):
1859 (KJS::NativeErrorImp::construct):
1860 (KJS::NativeErrorImp::callAsFunction):
1861 (KJS::NativeErrorImp::mark):
1862 * kjs/error_object.h:
1863 (KJS::ErrorInstance::classInfo):
1864 (KJS::NativeErrorImp::classInfo):
1866 2008-01-02 Mark Rowe <mrowe@apple.com>
1868 Rubber-stamped by Alp Toker.
1870 * GNUmakefile.am: Add missing dependency on grammar.y.
1872 2008-01-01 Darin Adler <darin@apple.com>
1876 - fix for http://bugs.webkit.org/show_bug.cgi?id=16695
1877 JSC allows non-identifier codepoints in identifiers (affects Acid3)
1879 Test: fast/js/kde/parse.html
1882 (KJS::Lexer::lex): Added additional states to distinguish Unicode escapes at the
1883 start of identifiers from ones inside identifiers. Rejected characters that don't pass
1884 the isIdentStart and isIdentPart tests.
1885 (KJS::Lexer::convertUnicode): Removed incorrect FIXME comment.
1887 * kjs/lexer.h: Added new states to distinguish \u escapes at the start of identifiers
1888 from \u escapes inside identifiers.
1890 2008-01-01 Darin Adler <darin@apple.com>
1892 - rolled scope chain optimization out; it was breaking the world
1894 2008-01-01 Darin Adler <darin@apple.com>
1898 - http://bugs.webkit.org/show_bug.cgi?id=16685
1899 eliminate List::empty() to cut down on PIC branches
1901 Also included one other speed-up -- remove the call to reserveCapacity from
1902 FunctionBodyNode::processDeclarations in all but the most unusual cases.
1904 Together these make SunSpider 1.016x as fast.
1906 * JavaScriptCore.exp: Updated.
1907 * kjs/ExecState.cpp:
1908 (KJS::globalEmptyList): Added. Called only when creating global ExecState
1910 (KJS::ExecState::ExecState): Broke constructor up into three separate functions,
1911 for the three separate node types. Also went through each of the three and
1912 streamlined as much as possible, removing dead code. This prevents us from having
1913 to access the global in the function body version of the constructor.
1915 * kjs/ExecState.h: Added emptyList(). Replaced the constructor with a set of
1916 three that are specific to the different node types that can create new execution
1919 * kjs/array_object.cpp:
1920 (KJS::ArrayProtoFuncToLocaleString::callAsFunction): Use exec->emptyList() instead
1922 (KJS::ArrayProtoFuncConcat::callAsFunction): Ditto.
1923 (KJS::ArrayProtoFuncSlice::callAsFunction): Ditto.
1924 (KJS::ArrayProtoFuncSplice::callAsFunction): Ditto.
1925 (KJS::ArrayProtoFuncFilter::callAsFunction): Ditto.
1927 (KJS::FunctionImp::callAsFunction): Updated to call new ExecState constructor.
1928 (KJS::GlobalFuncImp::callAsFunction): Ditto (for eval).
1929 * kjs/function_object.cpp:
1930 (FunctionObjectImp::construct): Use exec->emptyList() instead of List::empty().
1932 * kjs/list.cpp: Removed List::empty.
1933 * kjs/list.h: Ditto.
1936 (KJS::ElementNode::evaluate): Use exec->emptyList() instead of List::empty().
1937 (KJS::ArrayNode::evaluate): Ditto.
1938 (KJS::ObjectLiteralNode::evaluate): Ditto.
1939 (KJS::PropertyListNode::evaluate): Ditto.
1940 (KJS::FunctionBodyNode::processDeclarations): Another speed-up. Check the capacity
1941 before calling reserveCapacity, because it doesn't get inlined the local storage
1942 vector is almost always big enough -- saving the function call overhead is a big
1944 (KJS::FuncDeclNode::makeFunction): Use exec->emptyList() instead of List::empty().
1945 (KJS::FuncExprNode::evaluate): Ditto.
1947 (KJS::tryGetAndCallProperty): Ditto.
1948 * kjs/property_slot.cpp:
1949 (KJS::PropertySlot::functionGetter): Ditto.
1950 * kjs/string_object.cpp:
1951 (KJS::StringProtoFuncSplit::callAsFunction): Ditto.
1953 2008-01-01 Darin Adler <darin@apple.com>
1957 - fix http://bugs.webkit.org/show_bug.cgi?id=16648
1958 REGRESSION (r28165): Yuku.com navigation prints "jsRegExpExecute failed with result -2"
1959 <rdar://problem/5646486> REGRESSION (r28165): Layout test fast/regex/test1 fails intermittently
1961 Fixes 34 failing test cases in the fast/regex/test1.html test.
1963 Restored the stack which prevents infinite loops for brackets that match the empty
1964 string; it had been removed as an optimization.
1966 Unfortunately, restoring this stack causes the regular expression test in SunSpider
1967 to be 1.095x as slow and the overall test to be 1.004x as slow. Maybe we can find
1968 a correct optimization to restore the speed!
1970 It's possible the original change was on the right track but just off by one.
1972 * pcre/pcre_exec.cpp: Add back eptrblock, but name it BracketChainNode.
1973 (MatchStack::pushNewFrame): Add back the logic needed here.
1974 (startNewGroup): Ditto.
1977 2008-01-01 Darin Adler <darin@apple.com>
1981 - http://bugs.webkit.org/show_bug.cgi?id=16683
1982 speed up function calls by making ScopeChain::push cheaper
1984 This gives a 1.019x speedup on SunSpider.
1986 After doing this, I realized this probably will be obsolete when the optimization
1987 to avoid creating an activation object is done. When we do that one we should check
1988 if rolling this out will speed things up, since this does add overhead at the time
1989 you copy the scope chain.
1991 * kjs/object.h: Removed the ScopeChain::release function. It was
1992 marked inline, and called in exactly one place, so moved it there.
1993 No idea why it was in this header file!
1995 * kjs/scope_chain.cpp: Removed the overload of the ScopeChain::push
1996 function that takes another ScopeChain. It was unused. I think we used
1997 it over in WebCore at one point, but not any more.
1999 * kjs/scope_chain.h: Changed ScopeChainNode into a struct rather than
2000 a class, got rid of its constructor so we can have one that's uninitialized,
2001 and moved the refCount into a derived struct, ScopeChainHeapNode. Made _node
2002 mutable so it can be changed in the moveToHeap function. Changed the copy
2003 constructor and assignment operator to call moveToHeap, since the top node
2004 can't be shared when it's embedded in another ScopeChain object. Updated
2005 functions as needed to handle the case where the first object isn't on the
2006 heap or to add casts for cases where it's guaranteed to be. Changed the push
2007 function to always put the new node into the ScopeChain object; it will get
2008 put onto the heap when needed later.
2010 2008-01-01 Geoffrey Garen <ggaren@apple.com>
2012 Reviewed by Darin Adler.
2014 Fixed slight logic error in reserveCapacity, where we would reallocate
2015 the storage buffer unnecessarily.
2018 (WTF::::reserveCapacity): No need to grow the buffer if newCapacity is
2019 equal to capacity().
2021 2008-01-01 Darin Adler <darin@apple.com>
2025 - http://bugs.webkit.org/show_bug.cgi?id=16684
2026 eliminate debugger overhead from function body execution
2028 Speeds SunSpider up 1.003x. That's a small amount, but measurable.
2030 * JavaScriptCore.exp: Updated.
2032 (KJS::Parser::parse): Create the node with a static member function named create() instead
2033 of using new explicitly.
2035 * kjs/grammar.y: Changed calls to new FunctionBodyNode to use FunctionBodyNode::create().
2038 (KJS::ProgramNode::create): Added. Calls new.
2039 (KJS::EvalNode::create): Ditto.
2040 (KJS::FunctionBodyNode::create): Ditto, but creates FunctionBodyNodeWithDebuggerHooks
2041 when a debugger is present.
2042 (KJS::FunctionBodyNode::execute): Removed debugger hooks.
2043 (KJS::FunctionBodyNodeWithDebuggerHooks::FunctionBodyNodeWithDebuggerHooks): Added.
2044 (KJS::FunctionBodyNodeWithDebuggerHooks::execute): Calls the debugger, then the code,
2045 then the debugger again.
2047 * kjs/nodes.h: Added create functions, made the constructors private and protected.
2049 2007-12-30 Eric Seidel <eric@webkit.org>
2053 More small cleanup to array_object.cpp
2055 * kjs/array_object.cpp:
2056 (KJS::ArrayProtoFuncToString::callAsFunction):
2057 (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
2058 (KJS::ArrayProtoFuncJoin::callAsFunction):
2059 (KJS::ArrayProtoFuncConcat::callAsFunction):
2060 (KJS::ArrayProtoFuncReverse::callAsFunction):
2061 (KJS::ArrayProtoFuncShift::callAsFunction):
2062 (KJS::ArrayProtoFuncSlice::callAsFunction):
2063 (KJS::ArrayProtoFuncSort::callAsFunction):
2064 (KJS::ArrayProtoFuncSplice::callAsFunction):
2065 (KJS::ArrayProtoFuncUnShift::callAsFunction):
2066 (KJS::ArrayProtoFuncFilter::callAsFunction):
2067 (KJS::ArrayProtoFuncMap::callAsFunction):
2068 (KJS::ArrayProtoFuncEvery::callAsFunction):
2070 2007-12-30 Eric Seidel <eric@webkit.org>
2074 Apply wkstyle to array_object.cpp
2076 * kjs/array_object.cpp:
2077 (KJS::ArrayPrototype::ArrayPrototype):
2078 (KJS::ArrayPrototype::getOwnPropertySlot):
2079 (KJS::ArrayProtoFuncConcat::callAsFunction):
2080 (KJS::ArrayProtoFuncPop::callAsFunction):
2081 (KJS::ArrayProtoFuncReverse::callAsFunction):
2082 (KJS::ArrayProtoFuncShift::callAsFunction):
2083 (KJS::ArrayProtoFuncSlice::callAsFunction):
2084 (KJS::ArrayProtoFuncSort::callAsFunction):
2085 (KJS::ArrayProtoFuncSplice::callAsFunction):
2086 (KJS::ArrayProtoFuncUnShift::callAsFunction):
2087 (KJS::ArrayProtoFuncFilter::callAsFunction):
2088 (KJS::ArrayProtoFuncMap::callAsFunction):
2089 (KJS::ArrayProtoFuncEvery::callAsFunction):
2090 (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
2091 (KJS::ArrayObjectImp::ArrayObjectImp):
2092 (KJS::ArrayObjectImp::implementsConstruct):
2093 (KJS::ArrayObjectImp::construct):
2094 (KJS::ArrayObjectImp::callAsFunction):
2096 2007-12-30 Eric Seidel <eric@webkit.org>
2100 Remove maxInt/minInt, replacing with std:max/min<int>()
2102 * kjs/array_object.cpp:
2103 (KJS::ArrayProtoFuncSplice::callAsFunction):
2104 * kjs/operations.cpp:
2107 2007-12-30 Eric Seidel <eric@webkit.org>
2111 Update Number.toString to properly throw exceptions.
2112 Cleanup code in Number.toString implementation.
2114 * kjs/number_object.cpp:
2115 (KJS::numberToString):
2117 (KJS::Error::create): Remove bogus debug lines.
2119 2007-12-28 Eric Seidel <eric@webkit.org>
2123 ASSERT when debugging via Drosera due to missed var lookup optimization.
2124 http://bugs.webkit.org/show_bug.cgi?id=16634
2126 No test case possible.
2129 (KJS::BreakpointCheckStatement::optimizeVariableAccess):
2132 2007-12-28 Eric Seidel <eric@webkit.org>
2136 Fix (-0).toFixed() and re-factor a little
2137 Fix (-0).toExponential() and printing of trailing 0s in toExponential
2138 Fix toPrecision(nan) handling
2139 http://bugs.webkit.org/show_bug.cgi?id=16640
2141 * kjs/number_object.cpp:
2142 (KJS::numberToFixed):
2143 (KJS::fractionalPartToString):
2144 (KJS::numberToExponential):
2145 (KJS::numberToPrecision):
2147 2007-12-28 Eric Seidel <eric@webkit.org>
2151 More changes to make number code readable
2153 * kjs/number_object.cpp:
2154 (KJS::integer_part_noexp):
2155 (KJS::numberToFixed):
2156 (KJS::numberToExponential):
2158 2007-12-28 Eric Seidel <eric@webkit.org>
2162 More small cleanups to toPrecision
2164 * kjs/number_object.cpp:
2165 (KJS::numberToPrecision):
2167 2007-12-28 Eric Seidel <eric@webkit.org>
2171 More small attempts to make number code readable
2173 * kjs/number_object.cpp:
2174 (KJS::exponentialPartToString):
2175 (KJS::numberToExponential):
2176 (KJS::numberToPrecision):
2178 2007-12-28 Eric Seidel <eric@webkit.org>
2182 Break out callAsFunction implementations into static functions
2184 * kjs/number_object.cpp:
2185 (KJS::numberToString):
2186 (KJS::numberToFixed):
2187 (KJS::numberToExponential):
2188 (KJS::numberToPrecision):
2189 (KJS::NumberProtoFunc::callAsFunction):
2191 2007-12-28 Eric Seidel <eric@webkit.org>
2195 Apply wkstyle/astyle and fix placement of *
2197 * kjs/number_object.cpp:
2199 (KJS::NumberInstance::NumberInstance):
2200 (KJS::NumberPrototype::NumberPrototype):
2201 (KJS::NumberProtoFunc::NumberProtoFunc):
2202 (KJS::integer_part_noexp):
2204 (KJS::NumberProtoFunc::callAsFunction):
2205 (KJS::NumberObjectImp::NumberObjectImp):
2206 (KJS::NumberObjectImp::getOwnPropertySlot):
2207 (KJS::NumberObjectImp::getValueProperty):
2208 (KJS::NumberObjectImp::implementsConstruct):
2209 (KJS::NumberObjectImp::construct):
2210 (KJS::NumberObjectImp::callAsFunction):
2212 (KJS::JSObject::put):
2214 2007-12-27 Eric Seidel <eric@webkit.org>
2218 ASSERT in JavaScriptCore while viewing WICD test case
2219 http://bugs.webkit.org/show_bug.cgi?id=16626
2222 (KJS::ForInNode::execute): move KJS_CHECK_EXCEPTION to proper place
2224 2007-12-26 Jan Michael Alonzo <jmalonzo@unpluggable.com>
2226 Reviewed by Alp Toker.
2228 http://bugs.webkit.org/show_bug.cgi?id=16390
2229 Use autotools or GNU make as the build system for the GTK port
2231 * GNUmakefile.am: Added.
2233 2007-12-25 Maciej Stachowiak <mjs@apple.com>
2237 - Remove unnecessary redundant check from property setting
2238 http://bugs.webkit.org/show_bug.cgi?id=16602
2240 1.3% speedup on SunSpider.
2243 (KJS::JSObject::put): Don't do canPut check when not needed; let
2244 the PropertyMap handle it.
2245 (KJS::JSObject::canPut): Don't check the static property
2246 table. lookupPut does that already.
2248 2007-12-24 Alp Toker <alp@atoker.com>
2250 Fix builds that don't use AllInOneFile.cpp following breakage
2251 introduced in r28973.
2255 2007-12-24 Maciej Stachowiak <mjs@apple.com>
2259 - Optimize variable declarations
2260 http://bugs.webkit.org/show_bug.cgi?id=16585
2262 3.5% speedup on SunSpider.
2264 var statements now result in either assignments or empty statements.
2266 This allows a couple of optimization opportunities:
2267 - No need to branch at runtime to check if there is an initializer
2268 - EmptyStatementNodes can be removed entirely (also done in this patch)
2269 - Assignment expressions get properly optimized for local variables
2271 This patch also includes some code cleanup:
2272 - Most of the old VarStatement/VarDecl logic is now only used for const declarations,
2273 thus it is renamed appropriately
2274 - AssignExprNode is gone
2276 * JavaScriptCore.exp:
2280 (KJS::SourceElements::append):
2281 (KJS::ConstDeclNode::ConstDeclNode):
2282 (KJS::ConstDeclNode::optimizeVariableAccess):
2283 (KJS::ConstDeclNode::handleSlowCase):
2284 (KJS::ConstDeclNode::evaluateSingle):
2285 (KJS::ConstDeclNode::evaluate):
2286 (KJS::ConstStatementNode::optimizeVariableAccess):
2287 (KJS::ConstStatementNode::execute):
2288 (KJS::VarStatementNode::optimizeVariableAccess):
2289 (KJS::VarStatementNode::execute):
2290 (KJS::ForInNode::ForInNode):
2291 (KJS::ForInNode::optimizeVariableAccess):
2292 (KJS::ForInNode::execute):
2293 (KJS::FunctionBodyNode::initializeSymbolTable):
2294 (KJS::ProgramNode::initializeSymbolTable):
2295 (KJS::FunctionBodyNode::processDeclarations):
2296 (KJS::ProgramNode::processDeclarations):
2297 (KJS::EvalNode::processDeclarations):
2299 (KJS::DeclarationStacks::):
2300 (KJS::StatementNode::):
2301 (KJS::ConstDeclNode::):
2302 (KJS::ConstStatementNode::):
2303 (KJS::EmptyStatementNode::):
2304 (KJS::VarStatementNode::):
2306 * kjs/nodes2string.cpp:
2307 (KJS::ConstDeclNode::streamTo):
2308 (KJS::ConstStatementNode::streamTo):
2309 (KJS::ScopeNode::streamTo):
2310 (KJS::VarStatementNode::streamTo):
2311 (KJS::ForNode::streamTo):
2312 (KJS::ForInNode::streamTo):
2314 2007-12-21 Mark Rowe <mrowe@apple.com>
2316 Reviewed by Oliver Hunt.
2318 * JavaScriptCore.exp: Remove unused symbol to prevent a weak external symbol
2319 being generated in JavaScriptCore.framework.
2321 2007-12-21 Darin Adler <darin@apple.com>
2323 Requested by Maciej.
2325 * kjs/nodes.h: Use the new NEVER_INLINE here and eliminate the old
2326 KJS_NO_INLINE. We don't want to have two, and we figured it was better
2327 to keep the one that's in WTF.
2329 2007-12-21 Darin Adler <darin@apple.com>
2333 - http://bugs.webkit.org/show_bug.cgi?id=16561
2334 remove debugger overhead from non-debugged JavaScript execution
2336 1.022x as fast on SunSpider.
2338 * JavaScriptCore.exp: Updated.
2340 * kjs/NodeInfo.h: Renamed SourceElementsStub to SourceElements,
2341 since that more accurately describes the role of this object, which
2342 is a reference-counted wrapper for a Vector.
2345 (KJS::Parser::didFinishParsing): Changed parameter type to SourceElements,
2346 and use plain assignment instead of set.
2347 * kjs/Parser.h: Changed parameter type of didFinishParsing to a
2348 SourceElements. Also changed m_sourceElements; we now use a RefPtr instead
2349 of an OwnPtr as well.
2351 * kjs/grammar.y: Got rid of all the calls to release() on SourceElements.
2352 That's now handed inside the constructors for various node types, since we now
2353 use vector swapping instead.
2356 (KJS::Node::rethrowException): Added NEVER_INLINE, because this was getting inlined
2357 and we want exception handling out of the normal code flow.
2358 (KJS::SourceElements::append): Moved here from the header. This now handles
2359 creating a BreakpointCheckStatement for each statement in the debugger case.
2360 That way we can get breakpoint handling without having it in every execute function.
2361 (KJS::BreakpointCheckStatement::BreakpointCheckStatement): Added.
2362 (KJS::BreakpointCheckStatement::execute): Added. Contains the code that was formerly
2363 in the StatementNode::hitStatement function and the KJS_BREAKPOINT macro.
2364 (KJS::BreakpointCheckStatement::streamTo): Added.
2365 (KJS::ArgumentListNode::evaluateList): Use KJS_CHECKEXCEPTIONVOID since the return
2367 (KJS::VarStatementNode::execute): Removed KJS_BREAKPOINT.
2368 (KJS::BlockNode::BlockNode): Changed parameter type to SourceElements.
2369 Changed code to use release since the class now contains a vector rather than
2371 (KJS::BlockNode::optimizeVariableAccess): Updated since member is now a vector
2372 rather than a vector pointer.
2373 (KJS::BlockNode::execute): Ditto.
2374 (KJS::ExprStatementNode::execute): Removed KJS_BREAKPOINT.
2375 (KJS::IfNode::execute): Ditto.
2376 (KJS::IfElseNode::execute): Ditto.
2377 (KJS::DoWhileNode::execute): Ditto.
2378 (KJS::WhileNode::execute): Ditto.
2379 (KJS::ContinueNode::execute): Ditto.
2380 (KJS::BreakNode::execute): Ditto.
2381 (KJS::ReturnNode::execute): Ditto.
2382 (KJS::WithNode::execute): Ditto.
2383 (KJS::CaseClauseNode::optimizeVariableAccess): Updated since member is now a vector
2384 rather than a vector pointer.
2385 (KJS::CaseClauseNode::executeStatements): Ditto.
2386 (KJS::SwitchNode::execute): Removed KJS_BREAKPOINT.
2387 (KJS::ThrowNode::execute): Ditto.
2388 (KJS::TryNode::execute): Ditto.
2389 (KJS::ScopeNode::ScopeNode): Changed parameter type to SourceElements.
2390 (KJS::ProgramNode::ProgramNode): Ditto.
2391 (KJS::EvalNode::EvalNode): Ditto.
2392 (KJS::FunctionBodyNode::FunctionBodyNode): Ditto.
2393 (KJS::ScopeNode::optimizeVariableAccess): Updated since member is now a vector
2394 rather than a vector pointer.
2396 * kjs/nodes.h: Removed hitStatement. Renamed SourceElements to StatementVector.
2397 Renamed SourceElementsStub to SourceElements and made it derive from
2398 ParserRefCounted rather than from Node, hold a vector rather than a pointer to
2399 a vector, and changed the release function to swap with another vector rather
2400 than the pointer idiom. Updated BlockNode and CaseClauseNode to hold actual
2401 vectors instead of pointers to vectors. Added BreakpointCheckStatement.
2403 * kjs/nodes2string.cpp:
2404 (KJS::statementListStreamTo): Changed to work on a vector instead of a pointer
2406 (KJS::BlockNode::streamTo): Ditto.
2407 (KJS::CaseClauseNode::streamTo): Ditto.
2409 * wtf/AlwaysInline.h: Added NEVER_INLINE.
2410 * wtf/PassRefPtr.h: Tweaked formatting. Added clear() function that matches the
2411 ones in OwnPtr and auto_ptr.
2412 * wtf/RefPtr.h: Ditto.
2414 2007-12-21 Darin Adler <darin@apple.com>
2416 - fix broken regression tests
2418 The broken tests were fast/js/do-while-expression-value.html and
2419 fast/js/while-expression-value.html.
2421 * kjs/nodes.cpp: Check in the correct version of this file. I had accidentally landed
2422 an old version of my patch for bug 16471.
2423 (KJS::statementListExecute): The logic here was backwards. Have to set the value
2424 even for non-normal execution results.
2426 2007-12-20 Alexey Proskuryakov <ap@webkit.org>
2430 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Copy npruntime_internal.h
2433 2007-12-20 Eric Seidel <eric@webkit.org>
2437 Split IfNode into IfNode and IfElseNode for speedup.
2438 http://bugs.webkit.org/show_bug.cgi?id=16470
2440 SunSpider claims this is 1.003x as fast as before.
2441 (This required running with --runs 15 to get consistent enough results to tell!)
2445 (KJS::IfNode::optimizeVariableAccess):
2446 (KJS::IfNode::execute):
2447 (KJS::IfNode::getDeclarations):
2448 (KJS::IfElseNode::optimizeVariableAccess):
2449 (KJS::IfElseNode::execute):
2450 (KJS::IfElseNode::getDeclarations):
2453 (KJS::IfElseNode::):
2454 * kjs/nodes2string.cpp:
2455 (KJS::IfNode::streamTo):
2456 (KJS::IfElseNode::streamTo):
2458 2007-12-20 Darin Adler <darin@apple.com>
2463 (WTF::operator==): Added.
2464 (WTF::operator!=): Added.
2466 2007-12-20 Geoffrey Garen <ggaren@apple.com>
2468 Reviewed by Oliver Hunt.
2470 AST optimization: Avoid NULL-checking ForNode's child nodes.
2472 0.6% speedup on SunSpider.
2474 This is a proof of concept patch that demonstrates how to optimize
2475 grammar productions with optional components, like
2477 for (optional; optional; optional) {
2481 The parser emits NULL for an optional component that is not present.
2483 Instead of checking for a NULL child at execution time, a node that
2484 expects an optional component to be present more often than not checks
2485 for a NULL child at construction time, and substitutes a viable
2486 alternative node in its place.
2488 (We'd like the parser to start emitting NULL a lot more once we teach
2489 it to emit NULL for certain no-op productions like EmptyStatement and
2490 VariableStatement, so, as a foundation, it's important for nodes with
2491 NULL optional components to be fast.)
2494 (KJS::Parser::didFinishParsing): Check for NULL SourceElements. Also,
2495 moved didFinishParsing into the .cpp file because adding a branch while
2496 it was in the header file caused a substantial and inexplicable
2497 performance regression. (Did I mention that GCC is crazy?)
2502 (KJS::BlockNode::BlockNode): Check for NULL SourceElements.
2503 (KJS::ForNode::optimizeVariableAccess): No need to check for NULL here.
2504 (KJS::ForNode::execute): No need to check for NULL here.
2506 (KJS::ForNode::): Check for NULL SourceElements. Substitute a TrueNode
2507 because it's semantically harmless, and it evaluates to boolean in an
2510 2007-12-20 Oliver Hunt <oliver@apple.com>
2514 Slight logic reordering in JSImmediate::from(double)
2516 This gives a 0.6% improvement in SunSpider.
2518 * kjs/JSImmediate.h:
2519 (KJS::JSImmediate::from):
2521 2007-12-20 Eric Seidel <eric@webkit.org>
2525 Fix major Array regression introduced by 28899.
2527 SunSpider claims this is at least 1.37x as fast as pre-regression. :)
2529 * kjs/array_instance.cpp: make Arrays fast again!
2531 2007-12-20 Eric Seidel <eric@webkit.org>
2533 Reviewed by Geoff, then re-rubber-stamped by Geoff after final search/replace and testing.
2535 Small reworking of Date code for 4% speedup on Date tests (0.2% overall)
2536 http://bugs.webkit.org/show_bug.cgi?id=16537
2538 Make msToYear human-readable
2539 Make msToDayInMonth slightly more readable and avoid recalculating msToYear
2540 Remove use of isInLeapYear to avoid calling msToYear
2541 Remove dayInYear call by changing msToDayInMonth to dayInMonthFromDayInYear
2542 Remove more duplicate calls to dayInYear and getUTCOffset for further speedup
2545 (KJS::daysFrom1970ToYear):
2547 (KJS::monthFromDayInYear):
2549 (KJS::dayInMonthFromDayInYear):
2550 (KJS::dateToDayInYear):
2551 (KJS::getDSTOffsetSimple):
2552 (KJS::getDSTOffset):
2553 (KJS::gregorianDateTimeToMS):
2554 (KJS::msToGregorianDateTime):
2556 2007-12-20 Rodney Dawes <dobey@wayofthemonkey.com>
2558 Reviewed by Darin Adler.
2560 Proxy includes of npruntime.h or npapi.h through npruntime_internal.h
2561 Include stdio.h in npapi.h for the use of FILE with XP_UNIX defined
2562 This is for building with X11, as some type and enum names conflict
2563 with #define names in X11 headers.
2564 http://bugs.webkit.org/show_bug.cgi?id=15669
2566 * JavaScriptCore.xcodeproj/project.pbxproj:
2567 * bindings/NP_jsobject.h:
2569 * bindings/npruntime.cpp:
2570 * bindings/npruntime_impl.h:
2571 * bindings/npruntime_priv.h:
2572 * bindings/npruntime_internal.h:
2573 * bindings/testbindings.cpp:
2574 * bindings/c/c_class.h:
2575 * bindings/c/c_runtime.h:
2576 * bindings/c/c_utility.h:
2578 2007-12-20 Darin Adler <darin@apple.com>
2580 - re-fix http://bugs.webkit.org/show_bug.cgi?id=16471
2581 Completions need to be smaller (or not exist at all)
2583 Same patch as last time with the test failures problem fixed.
2586 (KJS::GlobalFuncImp::callAsFunction): Make sure to check the completion
2587 type from newExec to see if the execute raised an exception.
2589 2007-12-20 Darin Adler <darin@apple.com>
2591 - roll out that last change -- it was causing test failures;
2592 I'll check it back in after fixing them
2594 2007-12-20 Darin Adler <darin@apple.com>
2598 - http://bugs.webkit.org/show_bug.cgi?id=16471
2599 Completions need to be smaller (or not exist at all)
2601 SuSpider shows 2.4% speedup.
2603 Stop using completions in the execution engine.
2604 Instead, the completion type and label target are both
2605 stored in the ExecState.
2607 * API/JSContextRef.cpp: Removed unneeded include of "completion.h".
2608 * bindings/runtime_method.cpp: Removed unused execute function.
2609 * bindings/runtime_method.h: Ditto.
2611 * kjs/ExecState.h: Added completionType, breakOrContinueTarget,
2612 setCompletionType, setNormalCompletion, setBreakCompletion,
2613 setContinueCompletion, setReturnValueCompletion, setThrowCompletion,
2614 setInterruptedCompletion, m_completionType, and m_breakOrContinueTarget.
2616 * kjs/completion.h: Removed constructor and getter for target
2617 for break and continue from Completion. This class is now only
2618 used for the public API to Interpreter and such.
2620 * kjs/date_object.h: Removed unused execute function.
2623 (KJS::FunctionImp::callAsFunction): Removed some unneeded
2624 exception processing. Updated to call the new execute function
2625 and to get the completion type from the ExecState. Merged in
2626 the execute function, which repeated some of the same logic and
2627 was called only from here.
2628 (KJS::GlobalFuncImp::callAsFunction): More of the same for eval.
2629 * kjs/function.h: Removed execute.
2631 * kjs/interpreter.cpp:
2632 (KJS::Interpreter::evaluate): Added code to convert the result of
2633 execut into a Completion.
2636 (KJS::Node::setErrorCompletion): Renamed from createErrorCompletion.
2637 Now sets the completion type in the ExecState.
2638 (KJS::Node::rethrowException): Now sets the completion type in the
2640 (KJS::StatementNode::hitStatement): Now sets the completion type in
2642 (KJS::VarStatementNode::execute): Updated to put completion type in
2643 the ExecState instead of a Completion object.
2644 (KJS::statementListExecute): Ditto. Also changed the for loop to use
2645 indices instead of iterators.
2646 (KJS::BlockNode::execute): Updated return type.
2647 (KJS::EmptyStatementNode::execute): Updated to put completion type in
2648 the ExecState instead of a Completion object.
2649 (KJS::ExprStatementNode::execute): Ditto.
2650 (KJS::IfNode::execute): Ditto.
2651 (KJS::DoWhileNode::execute): Ditto. Also streamlined the logic a little
2652 to make the normal case a little faster and moved the end outside the
2653 loop so that "break" can do a break.
2654 (KJS::WhileNode::execute): Ditto.
2655 (KJS::ForNode::execute): Ditto.
2656 (KJS::ForInNode::execute): Ditto.
2657 (KJS::ContinueNode::execute): Updated to put completion type in
2658 the ExecState instead of a Completion object.
2659 (KJS::BreakNode::execute): Ditto.
2660 (KJS::ReturnNode::execute): Ditto.
2661 (KJS::WithNode::execute): Ditto.
2662 (KJS::CaseClauseNode::executeStatements): Ditto. Also renamed to have
2663 execute in its name to reflect the fact that it's a member of the same
2664 family of functions.
2665 (KJS::CaseBlockNode::executeBlock): Ditto.
2666 (KJS::SwitchNode::execute): Ditto.
2667 (KJS::LabelNode::execute): Ditto.
2668 (KJS::ThrowNode::execute): Ditto.
2669 (KJS::TryNode::execute): Ditto.
2670 (KJS::ProgramNode::execute): Ditto.
2671 (KJS::EvalNode::execute): Ditto.
2672 (KJS::FunctionBodyNode::execute): Ditto.
2673 (KJS::FuncDeclNode::execute): Ditto.
2675 * kjs/nodes.h: Renamed setErrorCompletion to createErrorCompletion, made
2676 hitStatement protected, changed return value of execute to a JSValue,
2677 renamed evalStatements to executeStatements, and evalBlock to executeBlock.
2679 * kjs/number_object.h: Removed unused execute function.
2681 2007-12-20 Geoffrey Garen <ggaren@apple.com>
2686 (KJS::ProgramNode::processDeclarations):
2688 2007-12-20 Geoffrey Garen <ggaren@apple.com>
2690 Linux build fix: config.h has to come first.
2692 * kjs/error_object.cpp:
2694 2007-12-19 Geoffrey Garen <ggaren@apple.com>
2696 Reviewed by Oliver Hunt.
2698 Optimized global access to global variables, using a symbol table.
2700 SunSpider reports a 1.5% overall speedup, a 6.2% speedup on 3d-morph,
2701 and a whopping 33.1% speedup on bitops-bitwise-and.
2703 * API/JSCallbackObjectFunctions.h: Replaced calls to JSObject:: with
2704 calls to Base::, since JSObject is not always our base class. This
2705 was always a bug, but the bug is even more apparent after some of my
2708 (KJS::::staticFunctionGetter): Replaced use of getDirect with call to
2709 getOwnPropertySlot. Global declarations are no longer stored in the
2710 property map, so a call to getDirect is insufficient for finding
2711 override properties.
2714 * API/testapi.js: Added test for the getDirect change mentioned above.
2716 * kjs/ExecState.cpp:
2717 * kjs/ExecState.h: Dialed back the optimization to store a direct
2718 pointer to the localStorage buffer. One ExecState can grow the global
2719 object's localStorage without another ExecState's knowledge, so
2720 ExecState can't store a direct pointer to the localStorage buffer
2721 unless/until we invent a way to update all the relevant ExecStates.
2723 * kjs/JSGlobalObject.cpp: Inserted the symbol table into get and put
2725 (KJS::JSGlobalObject::reset): Reset the symbol table and local storage,
2726 too. Also, clear the property map here, removing the need for a
2729 * kjs/JSVariableObject.cpp:
2730 * kjs/JSVariableObject.h: Added support for saving localStorage and the
2731 symbol table to the back/forward cache, and restoring them.
2734 (KJS::GlobalFuncImp::callAsFunction): Renamed progNode to evalNode
2735 because it's an EvalNode, not a ProgramNode.
2738 (KJS::cacheGlobalObject): Replaced put with faster putDirect, since
2739 that's how the rest of lookup.h works. putDirect is safe here because
2740 cacheGlobalObject is only used for objects whose names are not valid
2743 * kjs/nodes.cpp: The good stuff!
2745 (KJS::EvalNode::processDeclarations): Replaced hasProperty with
2746 the new hasOwnProperty, which is slightly faster.
2748 * kjs/object.h: Nixed clearProperties because clear() does this job now.
2750 * kjs/property_map.cpp:
2751 * kjs/property_map.h: More back/forward cache support.
2754 (WTF::::grow): Added fast non-branching grow function. I used it in
2755 an earlier version of this patch, even though it's not used anymore.
2757 2007-12-09 Mark Rowe <mrowe@apple.com>
2759 Reviewed by Oliver Hunt.
2761 Build fix for non-Mac platforms. Move NodeInfo into its own header so that the YYTYPE
2762 declaration in grammar.h is able to declare members of that type.
2764 * kjs/NodeInfo.h: Added.
2765 (KJS::createNodeInfo):
2766 (KJS::mergeDeclarationLists):
2767 (KJS::appendToVarDeclarationList):
2771 2007-12-19 Oliver Hunt <oliver@apple.com>
2773 Make appendToVarDeclarationList static
2779 2007-12-18 Oliver Hunt <oliver@apple.com>
2781 Remove dead code due to removal of post-parse declaration discovery.
2785 Due to the removal of the declaration discovery pass after parsing we
2786 no longer need any of the logic used for that discovery.
2790 (KJS::VarDeclNode::VarDeclNode):
2791 (KJS::BlockNode::BlockNode):
2792 (KJS::ForInNode::ForInNode):
2793 (KJS::CaseBlockNode::CaseBlockNode):
2795 (KJS::VarStatementNode::):
2797 (KJS::DoWhileNode::):
2802 (KJS::FuncDeclNode::):
2803 (KJS::CaseClauseNode::):
2804 (KJS::ClauseListNode::):
2805 (KJS::SwitchNode::):
2807 2007-12-18 Oliver Hunt <oliver@apple.com>
2809 Replace post-parse pass to find declarations with logic in the parser itself
2813 Instead of finding declarations in a pass following the initial parsing of
2814 a program, we incorporate the logic directly into the parser. This lays
2815 the groundwork for further optimisations (such as improving performance in
2816 declaration expressions -- var x = y; -- to match that of standard assignment)
2817 in addition to providing a 0.4% performance improvement in SunSpider.
2819 * JavaScriptCore.exp:
2821 (KJS::Parser::parse):
2823 (KJS::Parser::didFinishParsing):
2824 (KJS::Parser::parse):
2827 (KJS::ParserTracked::ParserTracked):
2828 (KJS::ParserTracked::~ParserTracked):
2829 (KJS::ParserTracked::ref):
2830 (KJS::ParserTracked::deref):
2831 (KJS::ParserTracked::refcount):
2832 (KJS::ParserTracked::clearNewTrackedObjects):
2834 (KJS::ScopeNode::ScopeNode):
2835 (KJS::ProgramNode::ProgramNode):
2836 (KJS::EvalNode::EvalNode):
2837 (KJS::FunctionBodyNode::FunctionBodyNode):
2838 (KJS::FunctionBodyNode::initializeSymbolTable):
2839 (KJS::FunctionBodyNode::processDeclarations):
2841 (KJS::ParserTracked::):
2845 2007-12-18 Xan Lopez <xan@gnome.org>
2849 Fix http://bugs.webkit.org/show_bug.cgi?id=14521
2850 Bug 14521: JavaScriptCore fails to build on Linux/PPC gcc 4.1.2
2853 (TCMalloc_SpinLock::Unlock):
2855 Use less strict memory operand constraint on inline asm generation.
2856 PLATFORM(DARWIN) left unpatched due to Apple's GCC bug.
2858 Patch by David Kilzer <ddkilzer@webkit.org>
2860 2007-12-18 Mark Rowe <mrowe@apple.com>
2862 Rubber-stamped by Maciej Stachowiak.
2864 Remove outdated and non-functioning project files for the Apollo port.
2866 * JavaScriptCore.apolloproj: Removed.
2868 2007-12-18 Darin Adler <darin@apple.com>
2872 * pcre/pcre_exec.cpp:
2873 (jsRegExpExecute): Change back from false/true to 0/1 -- I probably should not have
2874 deleted MATCH_MATCH and MATCH_NOMATCH, but I'm going to leave them out.
2876 2007-12-18 Darin Adler <darin@apple.com>
2880 - fix http://bugs.webkit.org/show_bug.cgi?id=16458
2881 REGRESSION (r28164): regular expressions can now hang due to lack of a match limit
2882 <rdar://problem/5636067>
2884 Test: fast/regex/slow.html
2886 Slows down SunSpider a bit (about 1.01x); filed a bug to follow up on that:
2887 http://bugs.webkit.org/show_bug.cgi?id=16503
2889 * pcre/pcre.h: Changed name of error code to not specifically mention "recursion".
2890 * pcre/pcre_exec.cpp:
2891 (match): Replaced the depth limit, MATCH_RECURSION_LIMIT, with a total match looping
2892 limit, matchLimit. Also eliminated the constants for MATCH_MATCH and MATCH_NOMATCH,
2893 since they are just true and false (1 and 0).
2894 (jsRegExpExecute): More of the MATCH_MATCH change.
2896 2007-12-17 Darin Adler <darin@apple.com>
2898 - speculative build fix for non-gcc platforms
2900 * pcre/pcre_exec.cpp: (match): Remove unused cases from return switch.
2902 2007-12-16 Mark Rowe <mrowe@apple.com>
2904 Speculative build fix for non-Mac platforms.
2906 * pcre/pcre_compile.cpp: Include string.h for memset, memmove, etc.
2908 2007-12-16 Darin Adler <darin@apple.com>
2912 - http://bugs.webkit.org/show_bug.cgi?id=16438
2913 - removed some more unused code
2914 - changed quite a few more names to WebKit-style
2915 - moved more things out of pcre_internal.h
2916 - changed some indentation to WebKit-style
2917 - improved design of the functions for reading and writing
2918 2-byte values from the opcode stream (in pcre_internal.h)
2920 * pcre/dftables.cpp:
2921 (main): Added the kjs prefix a normal way in lieu of using macros.
2923 * pcre/pcre_compile.cpp: Moved some definitions here from pcre_internal.h.
2924 (errorText): Name changes, fewer typedefs.
2925 (checkEscape): Ditto. Changed uppercase conversion to use toASCIIUpper.
2926 (isCountedRepeat): Name change.
2927 (readRepeatCounts): Name change.
2928 (firstSignificantOpcode): Got rid of the use of OP_lengths, which is
2929 very lightly used here. Hard-coded the length of OP_BRANUMBER.
2930 (firstSignificantOpcodeSkippingAssertions): Ditto. Also changed to
2931 use the advanceToEndOfBracket function.
2932 (getOthercaseRange): Name changes.
2933 (encodeUTF8): Ditto.
2934 (compileBranch): Name changes. Removed unused after_manual_callout and
2935 the code to handle it. Removed code to handle OP_ONCE since we never
2936 emit this opcode. Changed to use advanceToEndOfBracket in more places.
2937 (compileBracket): Name changes.
2938 (branchIsAnchored): Removed code to handle OP_ONCE since we never emit
2940 (bracketIsAnchored): Name changes.
2941 (branchNeedsLineStart): More fo the same.
2942 (bracketNeedsLineStart): Ditto.
2943 (branchFindFirstAssertedCharacter): Removed OP_ONCE code.
2944 (bracketFindFirstAssertedCharacter): More of the same.
2945 (calculateCompiledPatternLengthAndFlags): Ditto.
2946 (returnError): Name changes.
2947 (jsRegExpCompile): Ditto.
2949 * pcre/pcre_exec.cpp: Moved some definitions here from pcre_internal.h.
2950 (matchRef): Updated names.
2951 Improved macros to use the do { } while(0) idiom so they expand to single
2952 statements rather than to blocks or multiple statements. And refeactored
2953 the recursive match macros.
2954 (MatchStack::pushNewFrame): Name changes.
2955 (getUTF8CharAndIncrementLength): Name changes.
2956 (match): Name changes. Removed the ONCE opcode.
2957 (jsRegExpExecute): Name changes.
2959 * pcre/pcre_internal.h: Removed quite a few unneeded includes. Rewrote
2960 quite a few comments. Removed the macros that add kjs prefixes to the
2961 functions with external linkage; instead renamed the functions. Removed
2962 the unneeded typedefs pcre_uint16, pcre_uint32, and uschar. Removed the
2963 dead and not-all-working code for LINK_SIZE values other than 2, although
2964 we aim to keep the abstraction working. Removed the OP_LENGTHS macro.
2965 (put2ByteValue): Replaces put2ByteOpcodeValueAtOffset.
2966 (get2ByteValue): Replaces get2ByteOpcodeValueAtOffset.
2967 (put2ByteValueAndAdvance): Replaces put2ByteOpcodeValueAtOffsetAndAdvance.
2968 (putLinkValueAllowZero): Replaces putOpcodeValueAtOffset; doesn't do the
2969 addition, since a comma is really no better than a plus sign. Added an
2970 assertion to catch out of range values and changed the parameter type to
2971 int rather than unsigned.
2972 (getLinkValueAllowZero): Replaces getOpcodeValueAtOffset.
2973 (putLinkValue): New function that most former callers of the
2974 putOpcodeValueAtOffset function can use; asserts the value that is
2975 being stored is non-zero and then calls putLinkValueAllowZero.
2976 (getLinkValue): Ditto.
2977 (putLinkValueAndAdvance): Replaces putOpcodeValueAtOffsetAndAdvance. No
2978 caller was using an offset, which makes sense given the advancing behavior.
2979 (putLinkValueAllowZeroAndAdvance): Ditto.
2980 (isBracketOpcode): Added. For use in an assertion.
2981 (advanceToEndOfBracket): Renamed from moveOpcodePtrPastAnyAlternateBranches,
2982 and removed comments about how it's not well designed. This function takes
2983 a pointer to the beginning of a bracket and advances to the end of the
2986 * pcre/pcre_tables.cpp: Updated names.
2987 * pcre/pcre_ucp_searchfuncs.cpp:
2988 (kjs_pcre_ucp_othercase): Ditto.
2989 * pcre/pcre_xclass.cpp:
2990 (getUTF8CharAndAdvancePointer): Ditto.
2991 (kjs_pcre_xclass): Ditto.
2992 * pcre/ucpinternal.h: Ditto.
2995 (WTF::isASCIIAlpha): Added an int overload, like the one we already have for
2997 (WTF::isASCIIAlphanumeric): Ditto.
2998 (WTF::isASCIIHexDigit): Ditto.
2999 (WTF::isASCIILower): Ditto.
3000 (WTF::isASCIISpace): Ditto.
3001 (WTF::toASCIILower): Ditto.
3002 (WTF::toASCIIUpper): Ditto.
3004 2007-12-16 Darin Adler <darin@apple.com>
3008 - fix http://bugs.webkit.org/show_bug.cgi?id=16459
3009 REGRESSION: assertion failure with regexp with \B in a case-ignoring character range
3010 <rdar://problem/5646361>
3012 The problem was that \B was not handled properly in character classes.
3014 Test: fast/js/regexp-overflow.html
3016 * pcre/pcre_compile.cpp:
3017 (check_escape): Added handling of ESC_b and ESC_B in character classes here.
3018 Allows us to get rid of the handling of \b in character classes from all the
3019 call sites that handle it separately and to handle \B properly as well.
3020 (compileBranch): Remove the ESC_b handling, since it's not needed any more.
3021 (calculateCompiledPatternLengthAndFlags): Ditto.
3023 2007-12-16 Mark Rowe <mrowe@apple.com>
3025 Reviewed by Maciej Stachowiak.
3027 Fix http://bugs.webkit.org/show_bug.cgi?id=16448
3028 Bug 16448: [GTK] Celtic Kane JavaScript performance on Array test is slow relative to Mac
3030 * kjs/array_instance.cpp:
3031 (KJS::compareByStringPairForQSort):
3032 (KJS::ArrayInstance::sort): Convert JSValue's to strings once up front and then sort the
3033 results. This avoids calling toString twice per comparison, but requires a temporary buffer
3034 so we only use this approach in cases where the array being sorted is not too large.
3036 2007-12-16 Geoffrey Garen <ggaren@apple.com>
3038 Reviewed by Darin Adler and Maciej Stachowiak.
3040 More refactoring to support global variable optimization.
3042 Changed SymbolTable to use RefPtr<UString::Rep> as its key instead of
3043 UString::Rep*. With globals, the symbol table can outlast the
3044 declaration node for any given symbol, so the symbol table needs to ref
3047 In support, specialized HashMaps with RefPtr keys to allow lookup
3048 via raw pointer, avoiding refcount churn.
3050 SunSpider reports a .6% speedup (prolly just noise).
3052 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added new file: wtf/RefPtrHashMap.h
3053 * JavaScriptCore.xcodeproj/project.pbxproj: ditto
3055 * kjs/JSVariableObject.cpp:
3056 (KJS::JSVariableObject::getPropertyNames): Symbol table keys are RefPtrs now.
3058 * kjs/SymbolTable.h: Modified key traits to match RefPtr. Added a
3059 static Rep* for null, which helps compute the deletedValue() trait.
3061 * wtf/HashMap.h: #include the RefPtr specialization so everyone can use it.
3063 * wtf/RefPtrHashMap.h: Copied from wtf/HashMap.h. Added overloaded versions
3064 of find(), contains(), get(), set(), add(), remove(), and take() that take
3065 raw pointers as keys.
3067 2007-12-16 Alexey Proskuryakov <ap@webkit.org>
3071 http://bugs.webkit.org/show_bug.cgi?id=16162
3072 Problems with float parsing on Linux (locale-dependent parsing was used).
3074 * kjs/dtoa.cpp: Removed USE_LOCALE to reduce future confusion.
3075 * kjs/lexer.cpp: (KJS::Lexer::lex): Parse with kjs_strtod, not the system one.
3077 2007-12-14 Alp Toker <alp@atoker.com>
3079 Reviewed by Mark Rowe.
3081 Enable the AllInOneFile.cpp optimization for the GTK+ port.
3083 * JavaScriptCore.pri:
3085 2007-12-14 Mark Rowe <mrowe@apple.com>
3087 Unreviewed. Remove commented out fprintf's that were for debugging purposes only.
3089 * wtf/FastMalloc.cpp:
3090 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
3092 2007-12-14 Mark Rowe <mrowe@apple.com>
3094 Reviewed by Maciej Stachowiak.
3096 Don't use the MADV_DONTNEED code path for now as it has no effect on Mac OS X and is
3097 currently untested on other platforms.
3099 * wtf/TCSystemAlloc.cpp:
3100 (TCMalloc_SystemRelease): Return after releasing memory rather than potentially falling
3101 through into another mechanism if multiple are supported.
3103 2007-12-14 Alp Toker <alp@atoker.com>
3105 Build fix for GTK+/Qt and ports that don't use AllInOneFile.cpp.
3107 Include UnusedParam.h.
3109 * wtf/TCSystemAlloc.cpp:
3111 2007-12-14 Oliver Hunt <oliver@apple.com>
3113 Reviewed by Stephanie.
3115 Fix build on windows
3117 * wtf/FastMalloc.cpp:
3118 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
3120 2007-12-14 Dan Bernstein <mitz@apple.com>
3122 - try again to fix the Windows build
3124 * wtf/TCSystemAlloc.cpp:
3125 (TCMalloc_SystemRelease):
3127 2007-12-14 Dan Bernstein <mitz@apple.com>
3129 - try to fix the Windows build
3131 * wtf/TCSystemAlloc.cpp:
3132 (TCMalloc_SystemRelease):
3134 2007-12-14 Mark Rowe <mrowe@apple.com>
3136 Reviewed by Maciej and Oliver.
3138 Add final changes to make TCMalloc release memory to the system.
3139 This results in a 0.4% regression against ToT, but this is offset
3140 against the gains made by the original TCMalloc r38 merge - in fact
3141 we retain around 0.3-0.4% progression overall.
3143 * wtf/FastMalloc.cpp:
3144 (WTF::InitSizeClasses):
3145 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
3146 * wtf/TCSystemAlloc.cpp:
3147 (TCMalloc_SystemRelease):
3149 2007-12-14 Darin Adler <darin@apple.com>
3153 - removed unnecessary includes of "Vector.h"
3156 (WTF::copyKeysToVector): Make the type of the vector be a template parameter.
3157 This allows copying keys into a vector of a base class or one with an inline capacity.
3158 (WTF::copyValuesToVector): Ditto.
3160 (WTF::copyToVector): Ditto.
3162 2007-12-14 Anders Carlsson <andersca@apple.com>
3164 Reviewed by Darin and Geoff.
3166 <rdar://problem/5619295>
3167 REGRESSION: 303-304: Embedded YouTube video fails to render- JS errors (16150) (Flash 9)
3169 Get rid of unnecessary and incorrect security checks for plug-ins accessing JavaScript objects.
3171 The way this used to work was that each NPObject that wrapped a JSObject would have a root object
3172 corresponding to the frame object (used for managing the lifecycle) and an origin root object (used for
3173 doing security checks).
3175 This would prevent a plug-in from accessing a frame's window object if it's security origin was different
3176 (some parts of the window, such as the location object, can be accessed from frames with different security
3177 origins, and those checks are being done in WebCore).
3179 Also, if a plug-in were to access a window object of a frame that later went away, it could lead to that
3180 Window JSObject being garbage collected and the NPObject pointing to freed memory.
3182 How this works now is that there is no origin root object anymore, and all NPObject wrappers that are created
3183 for a plug-in will have the root object of the containing frame of that plug-in.
3185 * bindings/NP_jsobject.cpp:
3187 Don't free the origin root object.
3189 (_NPN_CreateScriptObject):
3190 Remove the origin root object parameter.
3192 (_NPN_InvokeDefault):
3197 (_NPN_RemoveProperty):
3201 Get rid of all security checks.
3203 * bindings/NP_jsobject.h:
3204 Remove originRootObject from the JavaScriptObject struct.
3206 * bindings/c/c_utility.cpp:
3207 (KJS::Bindings::convertValueToNPVariant):
3208 Always use the root object from the ExecState.
3210 2007-12-13 Steve Falkenburg <sfalken@apple.com>
3212 Move source file generation into its own vcproj to fix build dependencies.
3216 * JavaScriptCore.vcproj/JavaScriptCore.sln:
3217 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3218 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Added.
3219 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Added.
3220 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
3222 2007-12-13 Alp Toker <alp@atoker.com>
3224 http://bugs.webkit.org/show_bug.cgi?id=16406
3225 [Gtk] JavaScriptCore needs -lpthread
3227 Build fix for Debian and any other platforms that don't implicitly
3230 Link to pthread on non-Windows platforms until this dependency is
3233 2007-12-11 Geoffrey Garen <ggaren@apple.com>
3235 Reviewed by Sam Weinig.
3237 Build fix: Note some variables that are used only for ASSERTs.
3241 (globalObject_initialize):
3242 (testInitializeFinalize):
3244 2007-12-11 Geoffrey Garen <ggaren@apple.com>
3246 Reviewed by Darin Adler.
3248 Fixed: All JS tests crash on Windows.
3250 NDEBUG wasn't defined when compiling testkjs in release builds, so the
3251 HashTable definition in HashTable.h included an extra data member.
3253 The solution was to add NDEBUG to the release testkjs configuration on
3256 For giggles, I also added other missing #defines to testkjs on Windows.
3258 * Configurations/Base.xcconfig:
3259 * Configurations/JavaScriptCore.xcconfig:
3260 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
3261 * JavaScriptCore.xcodeproj/project.pbxproj:
3265 2007-12-11 Geoffrey Garen <ggaren@apple.com>
3267 Reviewed by Darin Adler.
3269 Removed bogus ASSERT.
3271 ASSERT should only be used when we know that a code path will not be
3272 taken. This code path is taken often during the jsFunFuzz test.
3274 * pcre/pcre_exec.cpp:
3277 2007-12-11 Darin Adler <darin@apple.com>
3279 * wtf/unicode/qt4/UnicodeQt4.h: Try to fix Qt build by adding U16_IS_SINGLE.
3281 2007-12-10 Darin Adler <darin@apple.com>
3283 Reviewed by Sam Weinig.
3285 - fix http://bugs.webkit.org/show_bug.cgi?id=16379
3286 REGRESSION(r28525): Failures in http/tests/xmlhttprequest/response-encoding.html and
3287 fast/dom/xmlhttprequest-html-response-encoding.html
3288 and <rdar://problem/5640230> REGRESSION (306A4-ToT): Access violation in PCRE function
3289 find_firstassertedchar
3291 Test: fast/js/regexp-find-first-asserted.html
3293 * pcre/pcre_compile.cpp:
3294 (compileBracket): Take out unnecessary initialization of out parameters.
3295 (branchFindFirstAssertedCharacter): Added. Broke out the half of the function that handles
3297 (bracketFindFirstAssertedCharacter): Renamed from find_firstassertedchar. Also removed the
3298 options parameter -- the caller can handle the options.
3299 (jsRegExpCompile): Changed call site to call the appropriate bracket or branch version of
3300 the find_firstassertedchar function. Also put the REQ_IGNORE_CASE code here instead of
3301 passing in the options.
3303 2007-12-10 Geoffrey Garen <ggaren@apple.com>
3305 Reviewed by Sam Weinig.
3319 FunctionBodyNode ProgramNode EvalNode
3321 in preparation for specializing each class more while optimizing global
3324 Also removed some cruft from the FunctionBodyNode interface to simplify
3327 SunSpider says this patch is a .8% speedup, which seems reasonable,
3328 since it eliminates a few branches and adds KJS_FAST_CALL in a few
3331 Layout tests and JS tests pass. Also, this baby builds on Windows! (Qt
3332 mileage may vary...)
3334 2007-12-10 Geoffrey Garen <ggaren@apple.com>
3338 Mac build fix: added some exported symbols, now that Parser::parse is
3339 defined in the header.
3341 * JavaScriptCore.exp:
3343 2007-12-10 Sam Weinig <sam@webkit.org>
3347 Template methods need to be in the header.
3349 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3352 (KJS::Parser::parse):
3354 2007-12-10 Geoffrey Garen <ggaren@apple.com>
3356 Reviewed by Sam Weinig.
3358 Merged different implementations of Parser::parse into a single,
3359 templatized implementation, in preparation for adding yet another
3360 implementation for "eval" code.
3362 JS and layout tests pass.
3364 2007-12-10 Timothy Hatcher <timothy@apple.com>
3366 Reviewed by Mark Rowe
3368 <rdar://problem/5639463> Bundle versions on Tiger should be 4523.x not 523.x
3370 * Configurations/Version.xcconfig: Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR,
3371 so assume Tiger and use a 4 for the SYSTEM_VERSION_PREFIX.
3373 2007-12-10 Mark Rowe <mrowe@apple.com>
3377 * kjs/grammar.y: Use @1 and @0 in place of @$ where Tiger's bison chokes.
3379 2007-12-10 Darin Adler <darin@apple.com>
3381 Reviewed by Mark Rowe.
3383 - fix http://bugs.webkit.org/show_bug.cgi?id=16375
3384 REGRESSION: Safari crashes on quit
3386 Probably a debug-only issue.
3389 (KJS::parser): Create the parser and never destroy it by using a pointer instead
3392 2007-12-09 Darin Adler <darin@apple.com>
3394 Reviewed by Sam Weinig.
3396 - fix http://bugs.webkit.org/show_bug.cgi?id=16369
3397 REGRESSION (r28525): regular expression tests failing due to bad firstByte optimization
3399 * pcre/pcre_compile.cpp: Changed some names to use interCaps intead of under_scores.
3400 (branchIsAnchored): Broke is_anchored into two separate functions; this one works on a
3401 branch and the other on an anchor. The old function would only work on a bracket.
3402 Also removed unneeded parameters; the anchored check does not require the bracket
3403 map or the options any more because we have a reduced set of features.
3404 (bracketIsAnchored): Ditto.
3405 (branchNeedsLineStart): Broke canApplyFirstCharOptimization into two functions and gave
3406 both a better name. This is the function that was returning the wrong value. The failure
3407 was beacuse the old function would only work on a bracket.
3408 (bracketNeedsLineStart): Ditto.
3409 (jsRegExpCompile): Changed to call the appropriate branch or bracket flavor of the
3410 functions based on whether we compiled an outer bracket. Also removed inaccurate comments
3411 and unneeded parameters.
3413 - other small changes
3415 * pcre/pcre.h: Renumbered error codes, in a logical order. First, normal failure, then
3416 the recursion limit, then running out of memory, and finally an unexpected internal error.
3418 * pcre/pcre_exec.cpp: Fixed indentation.
3419 (jsRegExpExecute): Corrected an inaccurate comment.
3421 2007-12-09 Darin Adler <darin@apple.com>
3425 - fix http://bugs.webkit.org/show_bug.cgi?id=16370
3426 REGRESSION (r28540): source URL and line number no longer set for outer function/programs
3428 Test: fast/js/exception-linenums-in-html-1.html
3429 Test: fast/js/exception-linenums-in-html-2.html
3430 Test: fast/js/exception-linenums.html
3432 By the time the ProgramNode was constructed, the source URL was empty.
3435 (KJS::Parser::parseProgram): Added code to set and clear m_sourceURL, which is now
3436 handled here instead of in the lexer; it needs to still be set when we create the
3437 program node. Call setLoc to set the first and last line number.
3438 (KJS::Parser::parseFunctionBody): Ditto, but for the body.
3439 (KJS::Parser::parse): Removed the sourceURL argument.
3441 * kjs/Parser.h: Added sourceURL(), m_sourceURL, and m_lastLine. Added a lastLine
3442 parameter to didFinishParsing, since the bison grammar knows the last line number
3443 and we otherwise do not know it. Removed the sourceURL parameter from parse, since
3444 that's now handled at a higher level.
3446 * kjs/grammar.y: Pass the last line number to didFinishParsing.
3449 (KJS::Lexer::setCode): Removed the sourceURL argument and the code to set m_sourceURL.
3450 (KJS::Lexer::clear): Ditto.
3451 * kjs/lexer.h: More of the same.
3454 (KJS::FunctionBodyNode::FunctionBodyNode): Get the source URL from the parser rather
3455 than from the lexer. Removed unneeded call to setLoc, since the line numbers already
3458 2007-12-08 Oliver Hunt <oliver@apple.com>
3462 Split the ENABLE_SVG_EXPERIMENTAL_FEATURES flag into separate flags.
3464 Fixes <rdar://problem/5620249> Must disable SVG animation
3465 <rdar://problem/5612772> Disable SVG filters on Mac to match Windows behavior
3467 Minor config changes.
3469 * Configurations/JavaScriptCore.xcconfig:
3470 * JavaScriptCore.xcodeproj/project.pbxproj:
3472 2007-12-07 Sam Weinig <sam@webkit.org>
3476 - Rename isSafeScript to allowsAccessFrom.
3478 * bindings/NP_jsobject.cpp:
3480 * kjs/JSGlobalObject.h:
3481 (KJS::JSGlobalObject::allowsAccessFrom): Reverse caller/argument of allowsAccessFrom to match
3484 2007-12-07 Geoffrey Garen <ggaren@apple.com>
3486 Reviewed by Sam Weinig.
3488 Refactored variable access optimization: Removed the assumption that
3489 the FunctionBodyNode holds the symbol table.
3491 2007-12-07 Geoffrey Garen <ggaren@apple.com>
3493 Build fix: added #include.
3497 2007-12-07 Geoffrey Garen <ggaren@apple.com>
3499 Build fix: added #include.
3501 * kjs/interpreter.cpp:
3503 2007-12-07 Geoffrey Garen <ggaren@apple.com>
3505 Build fix: added #include.
3509 2007-12-07 Geoffrey Garen <ggaren@apple.com>
3511 Build fix: added #include.
3513 * kjs/function_object.cpp:
3515 2007-12-07 Geoffrey Garen <ggaren@apple.com>
3517 Reviewed by Sam Weinig.
3519 Fixed crash seen running layout tests.
3521 Reverted a change I made earlier today. Added a comment to try to
3522 discourage myself from making this mistake a third time.
3525 (KJS::ActivationImp::mark):
3527 (KJS::ActivationImp::ActivationImpData::ActivationImpData):
3529 2007-12-07 Geoffrey Garen <ggaren@apple.com>
3531 Reviewed by Sam Weinig.
3533 Refactored parsing of global code: Removed the assumption that
3534 ProgramNode inherits from FunctionBodyNode from the parser.
3537 (KJS::Parser::parseProgram):
3538 (KJS::Parser::parseFunctionBody):
3539 (KJS::Parser::parse):
3541 (KJS::Parser::didFinishParsing):
3546 2007-12-07 Geoffrey Garen <ggaren@apple.com>
3548 Build fix: added JSVariableObject.cpp to the .pri file.
3550 * JavaScriptCore.pri:
3552 2007-12-07 Geoffrey Garen <ggaren@apple.com>
3554 Build fix: added #include.
3558 2007-12-07 Steve Falkenburg <sfalken@apple.com>
3560 Re-named our B&I flag from BUILDBOT to PRODUCTION.
3562 Reviewed by Sam Weinig.
3564 * JavaScriptCore.vcproj/JavaScriptCore.make:
3565 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
3567 2007-12-07 Geoffrey Garen <ggaren@apple.com>
3569 Build fix: removed stray name qualification.
3572 (KJS::ActivationImp::ActivationImp):
3574 2007-12-07 Geoffrey Garen <ggaren@apple.com>
3576 Build fix: moved functions with qualified names outside of class
3579 * kjs/JSVariableObject.h:
3580 (KJS::JSVariableObject::symbolTableGet):
3581 (KJS::JSVariableObject::symbolTablePut):
3583 2007-12-07 Geoffrey Garen <ggaren@apple.com>
3585 Reviewed by Sam Weinig.
3587 Next step in refactoring JSGlobalObject: Added JSVariableObject class,
3588 and factored symbol-table-related code into it. (JSGlobalObject doesn't
3589 use the symbol table code yet, though.)
3591 Layout and JS tests, and testapi, pass. SunSpider reports no regression.
3593 2007-12-07 Darin Adler <darin@apple.com>
3597 - fix http://bugs.webkit.org/show_bug.cgi?id=16185
3598 jsRegExpCompile should not add implicit non-capturing bracket
3600 While this does not make SunSpider faster, it will make many regular
3601 expressions a bit faster.
3603 * pcre/pcre_compile.cpp: Moved CompileData struct in here from the
3604 header since it's private to this file.
3605 (compile_branch): Updated for function name change.
3606 (compile_bracket): Renamed from compile_regex, since, for one thing,
3607 this does not compile an entire regular expression.
3608 (calculateCompiledPatternLengthAndFlags): Removed unused item_count
3609 local variable. Renamed CompileData to cd instead of compile_block
3610 to be consistent with other functions. Added code to set the
3611 needOuterBracket flag if there's at least one "|" at the outer level.
3612 (jsRegExpCompile): Renamed CompileData to cd instead of compile_block
3613 to be consistent with other functions. Removed unneeded "size" field
3614 from the compiled regular expression. If no outer bracket is needed,
3615 then use compile_branch to compile the regular expression.
3617 * pcre/pcre_internal.h: Removed the CompileData struct, which is now
3618 private to pcre_compile.cpp. Removed the size member from JSRegExp.
3620 2007-12-06 Kevin Ollivier <kevino@theolliviers.com>
3622 MSVC7 build fix due to a compiler bug with placement new and/or
3623 templates and casting.
3625 Reviewed by Darin Adler.
3630 2007-12-06 Darin Adler <darin@apple.com>
3632 Reviewed by Eric Seidel.
3634 - fix http://bugs.webkit.org/show_bug.cgi?id=16321
3635 new RegExp("[\u0097]{4,6}", "gmy") crashes in DEBUG builds
3636 <rdar://problem/5632992>
3638 Test: fast/js/regexp-oveflow.html
3640 * pcre/pcre_compile.cpp:
3641 (calculateCompiledPatternLengthAndFlags): In the case where a single character
3642 character class is optimized to not use a character class at all, the preflight
3643 code was not setting the lastitemlength variable.
3645 2007-12-05 Mark Rowe <mrowe@apple.com>
3647 Qt Windows build fix. Include the time-related headers in the correct place.
3649 * kjs/JSGlobalObject.cpp:
3650 * kjs/interpreter.cpp:
3652 2007-12-05 Darin Adler <darin@apple.com>
3654 Not reviewed; just undoing a previous commit.
3656 - remove earlier incorrect fix for http://bugs.webkit.org/show_bug.cgi?id=16220
3657 <rdar://problem/5625221> Crash opening www.news.com (CNet)
3659 The real bug was the backwards ?: in the compile function, which Geoff just
3660 fixed. Rolling out the incorrect earlier fix.
3662 * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags): Take out
3663 the unneeded preflight change. The regression test proves this is still working
3664 fine, so the bug remains fixed.
3666 2007-12-01 Mark Rowe <mrowe@apple.com>
3668 Build fix. Include headers before trying to use the things that they declare.
3670 * kjs/JSImmediate.cpp:
3673 * kjs/object_object.cpp:
3674 * kjs/regexp_object.cpp:
3675 * kjs/string_object.cpp:
3677 2007-12-05 Geoffrey Garen <ggaren@apple.com>
3679 Build fix: added some #includes.
3681 * kjs/JSImmediate.cpp:
3683 2007-12-05 Geoffrey Garen <ggaren@apple.com>
3685 Build fix: added some #includes.
3687 * kjs/JSGlobalObject.cpp:
3688 * kjs/JSImmediate.cpp:
3690 2007-12-05 Geoffrey Garen <ggaren@apple.com>
3692 Build fix: Fixed #include spelling.
3696 2007-12-05 Geoffrey Garen <ggaren@apple.com>
3698 Build fix: added #include.
3702 2007-12-05 Geoffrey Garen <ggaren@apple.com>
3704 Build fix: added a forward declaration.
3708 2007-12-05 Geoffrey Garen <ggaren@apple.com>
3710 Build fix: added an #include.
3712 * kjs/error_object.cpp:
3714 2007-12-05 Geoffrey Garen <ggaren@apple.com>
3716 Build fix: added an #include.
3718 * kjs/bool_object.cpp:
3720 2007-12-05 Geoffrey Garen <ggaren@apple.com>
3722 Reviewed by Darin Adler.
3724 Third step in refactoring JSGlobalObject: Moved data members and
3725 functions accessing data members from Interpreter to JSGlobalObject.
3726 Changed Interpreter member functions to static functions.
3728 This resolves a bug in global object bootstrapping, where the global
3729 ExecState could be used when uninitialized.
3731 This is a big change, but it's mostly code motion and renaming.
3733 Layout and JS tests, and testjsglue and testapi, pass. SunSpider reports
3734 a .7% regression, but Shark sees no difference related to this patch,
3735 and SunSpider reported a .7% speedup from an earlier step in this
3736 refactoring, so I think it's fair to call that a wash.
3738 2007-12-05 Geoffrey Garen <ggaren@apple.com>
3740 Reviewed by Darin Adler. (Or vice versa.)
3742 Fixed ASSERT during run-javascriptcore-tests. (Darin just added the
3743 ASSERT, but the bug wasn't new.)
3745 * pcre/pcre_compile.cpp:
3746 (compile_branch): The ?: operator here was backwards, causing us to
3747 execute the loop too many times, adding stray KET opcodes to the
3748 compiled regular expression.
3750 2007-12-05 Kevin McCullough <kmccullough@apple.com>
3754 - Wait until local variable data is fully constructed before notifying the debugger of entering
3755 or leaving a call frame.
3758 (KJS::FunctionImp::callAsFunction):
3760 (KJS::FunctionBodyNode::execute):
3762 2007-12-05 Mark Rowe <mrowe@apple.com>
3766 Build fix for GCC 4.2. Cast via a union to avoid strict-aliasing issues.
3768 * wtf/FastMalloc.cpp:
3772 2007-12-05 Mark Rowe <mrowe@apple.com>
3776 Fix testkjs in 64-bit.
3778 When built for 64-bit the TCMalloc spin lock uses pthread mutexes rather than a custom spin lock
3779 implemented in assembly. If we fail to initialize the pthread mutex, attempts to lock or unlock
3780 it will fail and trigger a call to abort.
3782 * wtf/FastMalloc.cpp: Initialize the spin lock so that we can later lock and unlock it.
3783 * wtf/TCSpinLock.h: Add an Init method to the optimised spin lock.
3785 2007-12-04 Oliver Hunt <oliver@apple.com>
3787 Reviewed by NOBODY (Build fix).
3791 * wtf/TCSystemAlloc.cpp:
3793 2007-12-03 Oliver Hunt <oliver@apple.com>
3795 Reviewed by Mark Rowe and Geoff Garen.
3799 It also result in a performance progression between 0.5% and
3800 0.9% depending on the test, however most if not all of this
3801 gain will be consumed by the overhead involved in the later
3802 change to release memory to the system.
3804 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
3805 * JavaScriptCore.xcodeproj/project.pbxproj:
3806 * wtf/FastMalloc.cpp:
3807 (WTF::KernelSupportsTLS):
3808 (WTF::CheckIfKernelSupportsTLS):
3815 (WTF::SLL_PopRange):
3816 (WTF::SLL_PushRange):
3819 (WTF::ByteSizeForClass):
3821 (WTF::InitSizeClasses):
3822 (WTF::AllocationSize):
3823 (WTF::TCMalloc_PageHeap::GetSizeClassIfCached):
3824 (WTF::TCMalloc_PageHeap::CacheSizeClass):
3825 (WTF::TCMalloc_PageHeap::init):
3826 (WTF::TCMalloc_PageHeap::New):
3827 (WTF::TCMalloc_PageHeap::AllocLarge):
3828 (WTF::TCMalloc_PageHeap::Carve):
3829 (WTF::TCMalloc_PageHeap::Delete):
3830 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
3832 (WTF::TCMalloc_PageHeap::Dump):
3833 (WTF::TCMalloc_PageHeap::GrowHeap):
3834 (WTF::TCMalloc_PageHeap::Check):
3835 (WTF::ReleaseFreeList):
3836 (WTF::TCMalloc_PageHeap::ReleaseFreePages):
3837 (WTF::TCMalloc_ThreadCache_FreeList::Push):
3838 (WTF::TCMalloc_ThreadCache_FreeList::PushRange):
3839 (WTF::TCMalloc_ThreadCache_FreeList::PopRange):
3840 (WTF::TCMalloc_ThreadCache_FreeList::Pop):
3841 (WTF::TCMalloc_Central_FreeList::length):
3842 (WTF::TCMalloc_Central_FreeList::tc_length):
3843 (WTF::TCMalloc_Central_FreeList::Init):
3844 (WTF::TCMalloc_Central_FreeList::ReleaseListToSpans):
3845 (WTF::TCMalloc_Central_FreeList::EvictRandomSizeClass):
3846 (WTF::TCMalloc_Central_FreeList::MakeCacheSpace):
3847 (WTF::TCMalloc_Central_FreeList::ShrinkCache):
3848 (WTF::TCMalloc_Central_FreeList::InsertRange):
3849 (WTF::TCMalloc_Central_FreeList::RemoveRange):
3850 (WTF::TCMalloc_Central_FreeList::FetchFromSpansSafe):
3851 (WTF::TCMalloc_Central_FreeList::Populate):
3852 (WTF::TCMalloc_ThreadCache::Init):
3853 (WTF::TCMalloc_ThreadCache::Cleanup):
3854 (WTF::TCMalloc_ThreadCache::Allocate):
3855 (WTF::TCMalloc_ThreadCache::Deallocate):
3856 (WTF::TCMalloc_ThreadCache::FetchFromCentralCache):
3857 (WTF::TCMalloc_ThreadCache::ReleaseToCentralCache):
3858 (WTF::TCMalloc_ThreadCache::Scavenge):
3859 (WTF::TCMalloc_ThreadCache::PickNextSample):
3860 (WTF::TCMalloc_ThreadCache::NewHeap):
3861 (WTF::TCMalloc_ThreadCache::GetThreadHeap):
3862 (WTF::TCMalloc_ThreadCache::GetCache):
3863 (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
3864 (WTF::TCMalloc_ThreadCache::InitTSD):
3865 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
3866 (WTF::TCMallocStats::ExtractStats):
3867 (WTF::TCMallocStats::DumpStats):
3868 (WTF::TCMallocStats::DumpStackTraces):
3869 (WTF::TCMallocStats::TCMallocImplementation::MarkThreadIdle):
3870 (WTF::TCMallocStats::TCMallocImplementation::ReleaseFreeMemory):
3871 (WTF::TCMallocStats::TCMallocGuard::TCMallocGuard):
3872 (WTF::TCMallocStats::TCMallocGuard::~TCMallocGuard):
3873 (WTF::TCMallocStats::DoSampledAllocation):
3874 (WTF::TCMallocStats::CheckCachedSizeClass):
3875 (WTF::TCMallocStats::CheckedMallocResult):
3876 (WTF::TCMallocStats::SpanToMallocResult):
3877 (WTF::TCMallocStats::do_malloc):
3878 (WTF::TCMallocStats::do_free):
3879 (WTF::TCMallocStats::do_memalign):
3880 (WTF::TCMallocStats::do_malloc_stats):
3881 (WTF::TCMallocStats::do_mallopt):
3882 (WTF::TCMallocStats::do_mallinfo):
3883 (WTF::TCMallocStats::realloc):
3884 (WTF::TCMallocStats::cpp_alloc):
3885 (WTF::TCMallocStats::operator new):
3886 (WTF::TCMallocStats::):
3887 (WTF::TCMallocStats::operator new[]):
3888 (WTF::TCMallocStats::malloc_stats):
3889 (WTF::TCMallocStats::mallopt):
3890 (WTF::TCMallocStats::mallinfo):
3891 * wtf/TCPackedCache.h: Added.
3892 (PackedCache::PackedCache):
3895 (PackedCache::GetOrDefault):
3896 (PackedCache::Clear):
3897 (PackedCache::EntryToValue):
3898 (PackedCache::EntryToUpper):
3899 (PackedCache::KeyToUpper):
3900 (PackedCache::UpperToPartialKey):
3901 (PackedCache::Hash):
3902 (PackedCache::KeyMatch):
3904 (TCMalloc_PageMap2::PreallocateMoreMemory):
3905 * wtf/TCSystemAlloc.cpp:
3906 (TCMalloc_SystemRelease):
3907 * wtf/TCSystemAlloc.h:
3909 2007-12-04 Anders Carlsson <andersca@apple.com>
3913 Make isSafeScript const.
3915 * kjs/JSGlobalObject.h:
3916 (KJS::JSGlobalObject::isSafeScript):
3918 2007-12-04 Darin Adler <darin@apple.com>
3922 - fix first part of http://bugs.webkit.org/show_bug.cgi?id=16220
3923 <rdar://problem/5625221> Crash opening www.news.com (CNet)
3925 Test: fast/js/regexp-overflow.html
3927 * pcre/pcre_compile.cpp:
3928 (calculateCompiledPatternLengthAndFlags): Add room for the additional BRA/KET that
3929 was generated in the compile code but not taken into account here.
3931 2007-12-03 Darin Adler <darin@apple.com>
3935 - fix http://bugs.webkit.org/show_bug.cgi?id=15618
3936 <rdar://problem/5619353> REGRESSION: Stack overflow/crash in KJS::equal (15618)
3938 Test: fast/js/recursion-limit-equal.html
3940 * kjs/operations.cpp: (KJS::equal): Check the exception from toPrimitive.
3942 2007-12-03 Dan Bernstein <mitz@apple.com>
3944 - fix a copy-and-paste-o
3946 * bindings/npruntime.cpp:
3947 (_NPN_GetIntIdentifier):
3949 2007-12-03 Dan Bernstein <mitz@apple.com>
3951 Reviewed by Darin Adler.
3953 - fix an ASSERT when getIntIdentifier is called with 0 or -1
3955 * bindings/npruntime.cpp:
3956 (_NPN_GetIntIdentifier): We cannot use the hashmap for 0 and -1 since
3957 they are the empty value and the deleted value. Instead, keep the
3958 identifiers for those two integers in a static array.
3960 2007-12-02 Darin Adler <darin@apple.com>
3964 - fix http://bugs.webkit.org/show_bug.cgi?id=15848
3965 <rdar://problem/5619330> REGRESSION: Assertion failure viewing comments page on digg.com
3967 Test: fast/js/sparse-array.html
3969 * kjs/array_instance.cpp:
3970 (KJS::ArrayInstance::inlineGetOwnPropertySlot): Check sparse array cutoff before looking
3971 in hash map. Can't avoid the branch because we can't look for 0 in the hash.
3972 (KJS::ArrayInstance::deleteProperty): Ditto.
3974 2007-12-02 Geoffrey Garen <ggaren@apple.com>
3976 Build fix: added an #include.
3978 * kjs/collector.cpp:
3980 2007-12-02 Geoffrey Garen <ggaren@apple.com>
3982 Reviewed by Eric Seidel.
3984 Second step in refactoring JSGlobalObject: moved virtual functions from
3985 Interpreter to JSGlobalObject.
3987 Layout and JS tests pass. SunSpider reports a .7% speedup -- don't
3990 2007-12-01 Alp Toker <alp@atoker.com>
3992 Reviewed by Adam Roben.
3994 http://bugs.webkit.org/show_bug.cgi?id=16228
3995 kJSClassDefinitionEmpty is not exported with JS_EXPORT
3997 Add JS_EXPORT to kJSClassDefinitionEmpty.
3999 Make the gcc compiler check take precedence over the WIN32||_WIN32
4000 check to ensure that symbols are exported on Windows when using gcc.
4002 Add a TODO referencing the bug about JS_EXPORT in the Win build
4003 (http://bugs.webkit.org/show_bug.cgi?id=16227)
4005 Don't define JS_EXPORT as 'extern' when the compiler is unknown since
4006 it would result in the incorrect expansion:
4008 extern extern const JSClassDefinition kJSClassDefinitionEmpty;
4010 (This was something we inherited from CFBase.h that doesn't make sense
4014 * API/JSObjectRef.h:
4016 2007-11-30 Geoffrey Garen <ggaren@apple.com>
4018 Reviewed by Beth Dakin.
4020 Reversed the ownership relationship between Interpreter and JSGlobalObject.
4021 Now, the JSGlobalObject owns the Interpreter, and top-level objects
4022 that need the two to persist just protect the JSGlobalObject from GC.
4024 Global object bootstrapping looks a little odd right now, but it will
4025 make much more sense soon, after further rounds of refactoring.
4027 * bindings/runtime_root.h: Made this class inherit from RefCounted,
4028 to avoid code duplication.
4030 * kjs/collector.cpp:
4031 (KJS::Collector::collect): No need to give special GC treatment to
4032 Interpreters, since we mark their global objects, which mark them.
4034 * kjs/interpreter.cpp:
4035 (KJS::Interpreter::mark): No need to mark our global object, since it
4037 * kjs/interpreter.h: Don't inherit from RefCounted -- JSGlobalObject
4040 * kjs/testkjs.cpp: Modified to follow the new rules.
4041 (createGlobalObject):
4044 2007-11-30 Brent Fulgham <bfulgham@gmail.com>
4049 * pcre/pcre_compile.cpp:
4052 2007-11-30 Eric Seidel <eric@webkit.org>
4054 No review, build fix only.
4056 Fix uninitialized var warnings in release build.
4058 * JavaScriptCore.xcodeproj/project.pbxproj:
4059 * pcre/pcre_compile.cpp:
4062 2007-11-30 Darin Adler <darin@apple.com>
4064 Reviewed by Adam Roben.
4066 - fix http://bugs.webkit.org/show_bug.cgi?id=16207
4067 JavaScript regular expressions should match UTF-16 code units rather than characters
4069 SunSpider says this is 5.5% faster on the regexp test, 0.4% faste overall.
4071 Test: fast/js/regexp-non-bmp.html
4073 Renamed ANY_CHAR to NOT_NEWLINE to more-accurately reflect its meaning.
4075 * pcre/pcre_compile.cpp:
4076 (compile_branch): Removed calls to the UTF-16 character accessor functions, replacing
4077 them with simple pointer dereferences in some cases, and no code at all in others.
4078 (calculateCompiledPatternLengthAndFlags): Ditto.
4080 * pcre/pcre_exec.cpp:
4081 (match): Fixed indentation of some case labels (including all the BEGIN_OPCODE).
4082 Removed calls to the UTF-16 character accessor functions, replacing them with simple
4083 pointer dereferences in some cases, and no code at all in others. Also removed some
4084 explicit UTF-16 support code in a few cases. Removed the unneeded "UTF-8" code path
4085 in the ANY_CHAR repeat code, and in another case, eliminated the code to check against
4086 end_subject in because it is already done outside the loop.
4089 * pcre/pcre_internal.h: Removed all the UTF-16 helper functions.
4091 2007-11-30 Eric Seidel <eric@webkit.org>
4095 PCRE crashes under GuardMalloc
4096 http://bugs.webkit.org/show_bug.cgi?id=16127
4097 check against patternEnd to make sure we don't walk off the end of the string
4099 * pcre/pcre_compile.cpp:
4101 (calculateCompiledPatternLengthAndFlags):
4103 2007-11-30 Eric Seidel <eric@webkit.org>
4107 Fix layout test regressions caused by r28186
4108 http://bugs.webkit.org/show_bug.cgi?id=16195
4109 change first_byte and req_byte back to shorts instead of chars
4110 (I think PCRE stuffs information in the high bits)
4112 * pcre/pcre_internal.h:
4114 2007-11-29 Oliver Hunt <oliver@apple.com>
4116 Reviewed by Maciej and Darin.
4118 Make the JS collector work with multiple threads
4120 Under heavy contention it was possible the GC to suspend other
4121 threads inside the pthread spinlock, which could lead to the GC
4122 thread blocking on the pthread spinlock itself.
4124 We now determine and store each thread's stack base when it is