blob: baa329e3c163ede447ec9a07643860b70cc3d6dd [file] [log] [blame]
2008-10-21 Mark Rowe <mrowe@apple.com>
Merge r31577.
2008-04-02 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Ensure that debug symbols are generated for x86_64 and ppc64 builds.
* Configurations/Base.xcconfig:
2008-10-12 Mark Rowe <mrowe@apple.com>
Merge r37526.
2008-10-12 Anders Carlsson <andersca@apple.com>
Reviewed by Darin Adler.
Make the append method that takes a Vector more strict - it now requires the elements
of the vector to be appended same type as the elements of the Vector they're being appended to.
This would cause problems when dealing with Vectors containing other Vectors.
* wtf/Vector.h:
(WTF::::append):
2008-10-06 Mark Rowe <mrowe@apple.com>
Merge r33972.
2008-05-21 Darin Adler <darin@apple.com>
Reviewed by Anders.
- fix <rdar://problem/5952721> bug in JavaScript arguments object property lookup
Test: fast/js/arguments-bad-index.html
* kjs/function.cpp:
(KJS::IndexToNameMap::IndexToNameMap): Use unsigned instead of int.
(KJS::IndexToNameMap::isMapped): Use unsigned instead of int, and also use the
strict version of the numeric conversion function, since we don't want to allow
trailing junk.
(KJS::IndexToNameMap::unMap): Ditto.
(KJS::IndexToNameMap::operator[]): Ditto.
* kjs/function.h: Changed IndexToNameMap::size type from int to unsigned.
2008-10-04 Mark Rowe <mrowe@apple.com>
Merge r35278.
2008-07-21 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
<rdar://problem/6091287> Revamp the handling of CFBundleShortVersionString to be fixed at the major component of the version number.
* Configurations/Version.xcconfig:
* Info.plist:
2008-06-09 Mark Rowe <mrowe@apple.com>
Merge r31824.
2008-04-11 Antti Koivisto <antti@apple.com>
Reviewed by Maciej.
Add default hash for pairs of hashable types.
* wtf/HashFunctions.h:
(WTF::PairHash::hash):
(WTF::PairHash::equal):
(WTF::):
2008-09-21 Steve Falkenburg <sfalken@apple.com>
Merge r36578.
2008-09-15 Steve Falkenburg <sfalken@apple.com>
Improve timer accuracy for JavaScript Date object on Windows.
Use a combination of ftime and QueryPerformanceCounter.
ftime returns the information we want, but doesn't have sufficient resolution.
QueryPerformanceCounter has high resolution, but is only usable to measure time intervals.
To combine them, we call ftime and QueryPerformanceCounter initially. Later calls will use
QueryPerformanceCounter by itself, adding the delta to the saved ftime. We re-sync to
correct for drift if the low-res and high-res elapsed time between calls differs by more
than twice the low-resolution timer resolution.
QueryPerformanceCounter may be inaccurate due to a problems with:
- some PCI bridge chipsets (http://support.microsoft.com/kb/274323)
- BIOS bugs (http://support.microsoft.com/kb/895980/)
- BIOS/HAL bugs on multiprocessor/multicore systems (http://msdn.microsoft.com/en-us/library/ms644904.aspx)
Reviewed by Darin Adler.
* kjs/DateMath.cpp:
(JSC::highResUpTime):
(JSC::lowResUTCTime):
(JSC::qpcAvailable):
(JSC::getCurrentUTCTimeWithMicroseconds):
2008-06-09 Mark Rowe <mrowe@apple.com>
Merge r34204 to Safari-3-1-branch.
2008-05-29 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
https://bugs.webkit.org/show_bug.cgi?id=19294
<rdar://problem/5969062> A crash when iterating over a sparse array backwards.
* kjs/array_instance.cpp: Turned sparseArrayCutoff into a macro, so that using max() on it
doesn't cause a PIC branch.
(KJS::ArrayInstance::increaseVectorLength): Added a comment about this function not
preserving class invariants.
(KJS::ArrayInstance::put): Update m_storage after reallocation. Move values that fit to
the vector from the map in all code paths.
2008-03-31 Mark Rowe <mrowe@apple.com>
Merge r31388 to Safari-3-1-branch.
2008-03-27 Darin Adler <darin@apple.com>
Reviewed by Mark Rowe.
<rdar://problem/5826236> Regular expressions with large nested repetition counts can have their
compiled length calculated incorrectly.
* pcre/pcre_compile.cpp:
(multiplyWithOverflowCheck):
(calculateCompiledPatternLength): Check for overflow when dealing with nested repetition counts
and bail with an error rather than returning incorrect results.
2008-02-29 Mark Rowe <mrowe@apple.com>
Merge r30475 to Safari-3-1-branch.
2008-02-22 Oliver Hunt <oliver@apple.com>
Reviewed by Alexey P.
<rdar://problem/5759327> REGRESSION: while(NaN) acts like while(true)
Fix yet another case where we incorrectly relied on implicit double
to bool coercion.
* kjs/nodes.cpp:
(KJS::PostDecLocalVarNode::evaluateToBoolean):
2008-02-22 Mark Rowe <mrowe@apple.com>
Merge r30492 to Safari-3-1-branch.
2008-02-22 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Partial fix for <rdar://problem/5744037> Gmail out of memory (17455)
I'm removing KJS_MEM_LIMIT for the following reasons:
- We have a few reports of KJS_MEM_LIMIT breaking important web
applications, like GMail and Google Reader. (For example, if you
simply open 12 GMail tabs, tab #12 will hit the limit.)
- Firefox has no discernable JS object count limit, so any limit, even
a large one, is a potential compatibility problem.
- KJS_MEM_LIMIT does not protect against malicious memory allocation,
since there are many ways to maliciously allocate memory without
increasing the JS object count.
- KJS_MEM_LIMIT is already mostly broken, since it only aborts the
script that breaches the limit, not any subsequent scripts.
- We've never gotten bug reports about websites that would have
benefited from an unbroken KJS_MEM_LIMIT. The initial check-in of
KJS_MEM_LIMIT (KJS revision 80061) doesn't mention a website that
needed it.
- Any website that brings you anywhere close to crashing due to the
number of live JS objects will almost certainly put up the "slow
script" dialog at least 20 times beforehand.
* kjs/collector.cpp:
(KJS::Collector::collect):
* kjs/collector.h:
* kjs/nodes.cpp:
(KJS::TryNode::execute):
2008-02-17 Mark Rowe <mrowe@apple.com>
Unreviewed. Really make JavaScriptCore's FEATURE_DEFINES match WebCore's.
* Configurations/JavaScriptCore.xcconfig:
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30276 to Safari-3-1-branch.
2008-02-15 Adam Roben <aroben@apple.com>
Make JavaScriptCore's FEATURE_DEFINES match WebCore's
Reviewed by Mark.
* Configurations/JavaScriptCore.xcconfig:
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30239 to Safari-3-1-branch.
2008-02-14 Stephanie Lewis <slewis@apple.com>
Reviewed by Geoff.
Update order files.
* JavaScriptCore.order:
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30235 to Safari-3-1-branch.
2008-02-14 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed <rdar://problem/5737835> nee http://bugs.webkit.org/show_bug.cgi?id=17329
Crash in JSGlobalObject::popActivation when inserting hyperlink in Wordpress (17329)
Don't reset the "activations" stack in JSGlobalObject::reset, since we
might be executing a script during the call to reset, and the script
needs to safely run to completion.
Instead, initialize the "activations" stack when the global object is
created, and subsequently rely on pushing and popping during normal
execution to maintain the stack's state.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::init):
(KJS::JSGlobalObject::reset):
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30191 to Safari-3-1-branch.
2008-02-13 Oliver Hunt <oliver@apple.com>
Reviewed by Alexey P.
<rdar://problem/5737003> REGRESSION (r27747): can't browse pictures on fastcupid.com
When converting numeric values to booleans we need to account for NaN
* kjs/nodes.cpp:
(KJS::MultNode::evaluateToBoolean):
(KJS::ModNode::evaluateToBoolean):
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30177 to Safari-3-1-branch.
2008-02-08 Samuel Weinig <sam@webkit.org>
Reviewed by Brady Eidson.
<rdar://problem/5659216> REGRESSION: PLT 0.3% slower due to r28868 (caching ClassNodeList and NamedNodeList)
- Tweak the statements in isASCIISpace to account for the statistical distribution of
usage in the PLT.
.4% speedup on my machine. Stephanie's machine shows this as .3% speedup.
* wtf/ASCIICType.h:
(WTF::isASCIISpace):
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30158 to Safari-3-1-branch.
2008-02-11 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Fixes for:
<rdar://problem/5735497> Match Firefox's cross-domain model more accurately by return the built-in version of functions even if they have been overridden
<rdar://problem/5735443> Crash when setting the Window objects prototype to a custom Object and then calling a method on it
- Expose the native Object.prototype.toString implementation so that it can be used for cross-domain
toString calling.
* JavaScriptCore.exp:
* kjs/object_object.cpp:
* kjs/object_object.h:
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30105 to Safari-3-1-branch.
2008-02-08 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
<rdar://problem/5731773> REGRESSION (r28973): Extraneous parentheses in function.toString()
https://bugs.webkit.org/show_bug.cgi?id=17214
Make a subclass of CommaNode to provide the correct precedence for each expression in
a variable declaration list.
* kjs/grammar.y:
* kjs/nodes.h:
(KJS::VarDeclCommaNode::):
2008-02-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Added an ASSERT to catch refCount underflow, since it caused a leak in
my last check-in.
* wtf/RefCounted.h:
(WTF::RefCounted::deref):
2008-02-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
slower due to r28884 (global variable symbol table optimization)
Tweaked RefCounted::deref() to be a little more efficient.
1% - 1.5% speedup on my machine. .7% speedup on Stephanie's machine.
* wtf/RefCounted.h:
(WTF::RefCounted::deref): Don't modify m_refCount if we're just going
to delete the object anyway. Also, use a simple == test, which might be
faster than <= on some hardware.
2008-02-06 Darin Adler <darin@apple.com>
Reviewed by Sam.
- fix http://bugs.webkit.org/show_bug.cgi?id=17094
Array.prototype functions create length properties with DontEnum/DontDelete
Test results match Gecko with very few obscure exceptions that seem to be
bugs in Gecko.
Test: fast/js/array-functions-non-arrays.html
* kjs/array_object.cpp:
(KJS::arrayProtoFuncConcat): Removed DontEnum and DontDelete from the call
to set length.
(KJS::arrayProtoFuncPop): Ditto. Also added missing call to deleteProperty,
which is not needed for real arrays, but is needed for non-arrays.
(KJS::arrayProtoFuncPush): Ditto.
(KJS::arrayProtoFuncShift): Ditto.
(KJS::arrayProtoFuncSlice): Ditto.
(KJS::arrayProtoFuncSort): Removed incorrect call to set length when
the array has no elements.
(KJS::arrayProtoFuncSplice): Removed DontEnum and DontDelete from the call
to set length.
(KJS::arrayProtoFuncUnShift): Ditto. Also added a check for 0 arguments to
make behavior match the specification in that case.
* kjs/nodes.cpp:
(KJS::ArrayNode::evaluate): Removed DontEnum and DontDelete from the call
to set length.
2008-02-06 Darin Adler <darin@apple.com>
Reviewed by Sam.
- replace calls to put to set up properties with calls to putDirect, to
prepare for a future change where put won't take attributes any more,
and for a slight performance boost
* API/JSObjectRef.cpp:
(JSObjectMakeConstructor): Use putDirect instead of put.
* kjs/CommonIdentifiers.h: Removed lastIndex.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset): Use putDirect instead of put.
* kjs/array_object.cpp:
(KJS::arrayProtoFuncConcat): Took out extra call to get length (unused).
(KJS::ArrayObjectImp::ArrayObjectImp): Use putDirect instead of put.
* kjs/error_object.cpp:
(KJS::ErrorPrototype::ErrorPrototype): Use putDirect instead of put.
* kjs/function.cpp:
(KJS::Arguments::Arguments): Use putDirect instead of put.
(KJS::PrototypeFunction::PrototypeFunction): Use putDirect instead of put.
* kjs/function_object.cpp:
(KJS::FunctionObjectImp::construct): Use putDirect instead of put.
* kjs/nodes.cpp:
(KJS::FuncDeclNode::makeFunction): Use putDirect instead of put.
(KJS::FuncExprNode::evaluate): Use putDirect instead of put.
* kjs/regexp_object.cpp:
(KJS::regExpProtoFuncCompile): Use setLastIndex instead of put(lastIndex).
(KJS::RegExpImp::match): Get and set lastIndex by using m_lastIndex instead of
calling get and put.
* kjs/regexp_object.h:
(KJS::RegExpImp::setLastIndex): Added.
* kjs/string_object.cpp:
(KJS::stringProtoFuncMatch): Use setLastIndex instead of put(lastIndex).
2008-02-05 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Fix for http://bugs.webkit.org/show_bug.cgi?id=8080
NodeList (and other DOM lists) items are not enumeratable using for..in
* JavaScriptCore.exp:
2008-02-05 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Update versioning to support the mysterious future.
* Configurations/Version.xcconfig: Add SYSTEM_VERSION_PREFIX_1060.
2008-02-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver Hunt.
Fixes Bug 16889: REGRESSION (r29425): Canvas-based graphing calculator fails to run
Bug 17015: REGRESSION (r29414-29428): www.fox.com "shows" menu fails to render
Bug 17164: REGRESSION: JavaScript pop-up menu appears at wrong location when hovering image at http://news.chinatimes.com/
<http://bugs.webkit.org/show_bug.cgi?id=16889>
<rdar://problem/5696255>
<http://bugs.webkit.org/show_bug.cgi?id=17015>
<http://bugs.webkit.org/show_bug.cgi?id=17164>
<rdar://problem/5720947>
The ActivationImp tear-off (r29425) introduced a problem with ReadModify
nodes that first resolve a slot, call valueForReadModifyNode(), and then
store a value in the previously resolved slot. Since valueForReadModifyNode()
may cause a tear-off, the slot needs to be resolved again, but this was
not happening with the existing code.
* kjs/nodes.cpp:
(KJS::ReadModifyLocalVarNode::evaluate):
(KJS::ReadModifyResolveNode::evaluate):
2008-02-04 Cameron McCormack <cam@mcc.id.au>
Reviewed by Geoff Garen.
Remove some unneccesary UNUSED_PARAMs. Clarify ownership rule of return value of JSObjectCopyPropertyNames.
* API/JSNode.c:
(JSNode_appendChild):
(JSNode_removeChild):
(JSNode_replaceChild):
(JSNode_getNodeType):
(JSNode_getFirstChild):
* API/JSNodeList.c:
(JSNodeList_length):
* API/JSObjectRef.h:
2008-02-04 Rodney Dawes <dobey@wayofthemonkey.com>
Reviewed by Alp Toker and Mark Rowe.
Fix http://bugs.webkit.org/show_bug.cgi?id=17175.
Bug 17175: Use of C++ compiler flags in CFLAGS
* GNUmakefile.am: Use global_cxxflags as well as global_cflags in CXXFLAGS.
2008-02-04 Alp Toker <alp@atoker.com>
Rubber-stamped by Mark Rowe.
Remove all trailing whitespace in the GTK+ port and related
components.
* GNUmakefile.am:
2008-02-02 Darin Adler <darin@apple.com>
Reviewed by Geoff Garen.
PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
slower due to r28884 (global variable symbol table optimization)
Geoff's theory is that the slowdown was due to copying hash tables when
putting things into the back/forward cache. If that's true, then this
should fix the problem.
(According to Geoff's measurements, in a PLT that exaggerates the
importance of symbol table saving during cached page creation, this
patch is a ~3X speedup in cached page creation, and a 9% speedup overall.)
* JavaScriptCore.exp: Updated.
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::saveLocalStorage): Updated for changes to SavedProperty,
which has been revised to avoid initializing each SavedProperty twice when building
the array. Store the property names too, so we don't have to store the symbol table
separately. Do this by iterating the symbol table instead of the local storage vector.
(KJS::JSVariableObject::restoreLocalStorage): Ditto. Restore the symbol table as
well as the local storage vector.
* kjs/JSVariableObject.h: Removed save/restoreSymbolTable and do that work inside
save/restoreLocalStorage instead. Made restoreLocalStorage a non-const member function
that takes a const reference to a SavedProperties object.
* kjs/LocalStorage.h: Changed attributes to be unsigned instead of int to match
other declarations of attributes elsewhere.
* kjs/property_map.cpp:
(KJS::SavedProperties::SavedProperties): Updated for data member name change.
(KJS::PropertyMap::save): Updated for data member name change and to use the new
inline init function instead of setting the fields directly. This allows us to
skip initializing the SavedProperty objects when first allocating the array, and
just do it when we're actually setting up the individual elements.
(KJS::PropertyMap::restore): Updated for SavedProperty changes.
* kjs/property_map.h: Changed SavedProperty from a struct to a class. Set it up so
it does not get initialized at construction time to avoid initializing twice when
creating an array of SavedProperty. Removed the m_ prefixes from the members of
the SavedProperties struct. Generally we use m_ for class members and not struct.
2008-02-02 Tony Chang <idealisms@gmail.com>
Reviewed by darin. Landed by eseidel.
Add #define guards for WIN32_LEAN_AND_MEAN and _CRT_RAND_S.
* kjs/config.h:
* wtf/FastMalloc.cpp:
* wtf/TCSpinLock.h:
2008-01-28 Sam Weinig <sam@webkit.org>
Rubber-stamped by Darin Adler.
- Fix whitespace in nodes.h/cpp and nodes2string.cpp.
(NOTE: Specific changed functions elided for space and clarity)
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
2008-01-27 Sam Weinig <sam@webkit.org>
Reviewed by Oliver Hunt.
Patch for http://bugs.webkit.org/show_bug.cgi?id=17025
nodes.h/cpp has been rolling around in the mud - lets hose it down
- Rename member variables to use the m_ prefix.
(NOTE: Specific changed functions elided for space and clarity)
* kjs/grammar.y:
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
2008-01-27 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix <rdar://problem/5657450> REGRESSION: const is broken
Test: fast/js/const.html
SunSpider said this was 0.3% slower. And I saw some Shark samples in
JSGlobalObject::put -- not a lot but a few. We may be able to regain the
speed, but for now we will take that small hit for correctness sake.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::put): Pass the checkReadOnly flag in to symbolTablePut
instead of passing attributes.
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTablePut): Removed the code to set attributes
here, since we only set attributes when creating a property. Added the code
to check read-only here, since we need that to implement const!
* kjs/function.cpp:
(KJS::ActivationImp::put): Pass the checkReadOnly flag in to symbolTablePut
instead of passing attributes.
* kjs/nodes.cpp:
(KJS::isConstant): Added.
(KJS::PostIncResolveNode::optimizeVariableAccess): Create a PostIncConstNode
if optimizing for a local variable and the variable is constant.
(KJS::PostDecResolveNode::optimizeVariableAccess): Ditto. But PostDecConstNode.
(KJS::PreIncResolveNode::optimizeVariableAccess): Ditto. But PreIncConstNode.
(KJS::PreDecResolveNode::optimizeVariableAccess): Ditto. But PreDecConstNode.
(KJS::PreIncConstNode::evaluate): Return the value + 1.
(KJS::PreDecConstNode::evaluate): Return the value - 1.
(KJS::PostIncConstNode::evaluate): Return the value converted to a number.
(KJS::PostDecConstNode::evaluate): Ditto.
(KJS::ReadModifyResolveNode::optimizeVariableAccess): Create a ReadModifyConstNode
if optimizing for a local variable and the variable is constant.
(KJS::AssignResolveNode::optimizeVariableAccess): Ditto. But AssignConstNode.
(KJS::ScopeNode::optimizeVariableAccess): Pass the local storage to the
node optimizeVariableAccess functions, since that's where we need to look to
figure out if a variable is constant.
(KJS::FunctionBodyNode::processDeclarations): Moved the call to
optimizeVariableAccess until after localStorage is set up.
(KJS::ProgramNode::processDeclarations): Ditto.
* kjs/nodes.h: Fixed the IsConstant and HasInitializer values. They are used
as flag masks, so a value of 0 will not work for IsConstant. Changed the
first parameter to optimizeVariableAccess to be a const reference to a symbol
table and added a const reference to local storage. Added classes for const
versions of local variable access: PostIncConstNode, PostDecConstNode,
PreIncConstNode, PreDecConstNode, ReadModifyConstNode, and AssignConstNode.
* kjs/object.cpp:
(KJS::JSObject::put): Tweaked comments a bit, and changed the checkReadOnly
expression to match the form used at the two other call sites.
2008-01-27 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix http://bugs.webkit.org/show_bug.cgi?id=16498
''.constructor.toString() gives [function]
Test: fast/js/function-names.html
* kjs/array_object.cpp:
(KJS::ArrayObjectImp::ArrayObjectImp): Use the class name as the constructor's function name.
* kjs/bool_object.cpp:
(KJS::BooleanObjectImp::BooleanObjectImp): Ditto.
* kjs/date_object.cpp:
(KJS::DateObjectImp::DateObjectImp): Ditto.
* kjs/error_object.cpp:
(KJS::ErrorPrototype::ErrorPrototype): Make the error object be an Error.
(KJS::ErrorObjectImp::ErrorObjectImp): Use the class name as the constructor's function name.
(KJS::NativeErrorPrototype::NativeErrorPrototype): Take const UString&.
(KJS::NativeErrorImp::NativeErrorImp): Use the prototype's name as the constructor's function
name.
* kjs/error_object.h: Change ErrorPrototype to inherit from ErrorInstance. Change the
NativeErrorImp constructor to take a NativeErrorPrototype pointer for its prototype.
* kjs/function.h: Removed unneeded constructor for internal functions without names.
We want to avoid those!
* kjs/function_object.cpp:
(KJS::functionProtoFuncToString): Removed code that writes out just [function] for functions
that have no names. There's no reason to do that.
(KJS::FunctionObjectImp::FunctionObjectImp): Use the class name as the constructor's
function name.
* kjs/internal.cpp: Removed the unused constructor.
* kjs/number_object.cpp:
(KJS::fractionalPartToString): Marked static for internal linkage.
(KJS::exponentialPartToString): Ditto.
(KJS::numberProtoFuncToPrecision): Removed an unneeded else.
(KJS::NumberObjectImp::NumberObjectImp): Use the class name as the constructor's
function name.
(KJS::NumberObjectImp::getValueProperty): Tweaked formatting.
* kjs/object_object.cpp:
(KJS::ObjectObjectImp::ObjectObjectImp): Use "Object" for the function name.
* kjs/regexp_object.cpp:
(KJS::RegExpObjectImp::RegExpObjectImp): Use "RegExp" for the function name.
* kjs/string_object.cpp:
(KJS::StringObjectImp::StringObjectImp): Use the class name as the constructor's
function name.
2008-01-26 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix http://bugs.webkit.org/show_bug.cgi?id=17027
Incorrect Function.toString behaviour with read/modify/write operators performed on negative numbers
Test: fast/js/function-toString-parentheses.html
The problem here was that a NumberNode with a negative number in it had the wrong
precedence. It's not a primary expression, it's a unary operator with a primary
expression after it.
Once the precedence of NumberNode was fixed, the cases from bug 17020 were also
fixed without trying to treat bracket nodes like dot nodes. That wasn't needed.
The reason we handle numbers before dot nodes specially is that the dot is a
legal character in a number. The same is not true of a bracket. Eventually we
could get smarter, and only add the parentheses when there is actual ambiguity.
There is none if the string form of the number already has a dot in it, or if
it's a number with a alphabetic name like infinity or NAN.
* kjs/nodes.h: Renamed back from ObjectAccess to DotExpr.
(KJS::NumberNode::precedence): Return PrecUnary for negative numbers, since
they serialize as a unary operator, not a primary expression.
* kjs/nodes2string.cpp:
(KJS::SourceStream::operator<<): Clear m_numberNeedsParens if this adds
parens; one set is enough.
(KJS::bracketNodeStreamTo): Remove unneeded special flag here. Normal
operator precedence suffices.
(KJS::NewExprNode::streamTo): Ditto.
2008-01-26 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej and Darin.
Fix for http://bugs.webkit.org/show_bug.cgi?id=17020
Function.toString does not parenthesise numbers for the bracket accessor
It turns out that logic was there for all of the dot accessor nodes to make numbers be
parenthesised properly, so it was a trivial extension to extend that to the bracket nodes.
I renamed the enum type to reflect the fact that it is now used for both dot and bracket
accessors.
* kjs/nodes2string.cpp:
(KJS::bracketNodeStreamTo):
(KJS::BracketAccessorNode::streamTo):
2008-01-26 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Fix Bug 17018: Incorrect code generated from Function.toString for get/setters in object literals
Don't quote getter and setter names during output, as that is simply wrong.
* kjs/nodes2string.cpp:
(KJS::PropertyNode::streamTo):
2008-01-26 Darin Adler <darin@apple.com>
Reviewed by Eric Seidel.
- http://bugs.webkit.org/show_bug.cgi?id=16860
a bit of cleanup after the Activation optimization
* JavaScriptCore.exp: Export the GlobalExecState constructor instead of
the global flavor of the ExecState constructor. It'd probably be cleaner
to not export either one, but JSGlobalObject inlines the code that
constructs the ExecState. If we changed that, we could remove this export.
* JavaScriptCore.xcodeproj/project.pbxproj: Re-sorted a few things and
put the new source files into the kjs group rather than at the top level.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState): Marked inline and updated for data member
name changes. This is now only for use for the derived classes. Also removed
code that sets the unused m_savedExec data member for the global case. That
data member is only used for the other two types.
(KJS::ExecState::~ExecState): Marked inline and removed all the code.
The derived class destructors now inclde the appropriate code.
(KJS::ExecState::lexicalGlobalObject): Removed unneeded special case for
an empty scope chain. The bottom function already returns 0 for that case,
so the general case code handles it fine. Also changed to use data members
directly rather than calling functions.
(KJS::GlobalExecState::GlobalExecState): Added. Calls through to the base
class constructor.
(KJS::GlobalExecState::~GlobalExecState): Added.
(KJS::InterpreterExecState::InterpreterExecState): Added. Moved code to
manipulate activeExecStates here since we don't want to have to check for the
special case of globalExec.
(KJS::InterpreterExecState::~InterpreterExecState): Added.
(KJS::EvalExecState::EvalExecState): Added.
(KJS::EvalExecState::~EvalExecState): Added.
(KJS::FunctionExecState::FunctionExecState): Added.
(KJS::FunctionExecState::~FunctionExecState): Added.
* kjs/ExecState.h: Tweaked the header, includes, and declarations a bit.
Made ExecState inherit from Noncopyable. Reformatted some comments and
made them a bit more brief. Rearranged declarations a little bit and removed
unused savedExec function. Changed seenLabels function to return a reference
rather than a pointer. Made constructors and destructor protected, and also
did the same with all data members. Renamed m_thisVal to m_thisValue and
ls to m_labelStack. Added three new derived classes for each of the
types of ExecState. The primary goal here was to remove a branch from the
code in the destructor, but it's also clearer than overloading the arguments
to the ExecState constructor.
* kjs/JSGlobalObject.cpp:
(KJS::getCurrentTime): Fixed formatting.
(KJS::JSGlobalObject::pushActivation): Removed parentheses that don't make
the expression clearer -- other similar sites didn't have these parentheses,
even the one a couple lines earlier that sets stackEntry.
(KJS::JSGlobalObject::tearOffActivation): Got rid of unneeded static_cast
(I think I mentioned this during patch review) and used an early exit so that
the entire contents of the function aren't nested inside an if statement.
Also removed the check of codeType, instead checking Activation for 0.
For now, I kept the codeType check, but inside an assertion.
* kjs/JSGlobalObject.h: Changed type of globalExec to GlobalExecState.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction): Changed type to FunctionExecState.
(KJS::GlobalFuncImp::callAsFunction): Changed type to EvalExecState.
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate): Changed type to GlobalExecState.
* kjs/nodes.cpp:
(KJS::ContinueNode::execute): Changed code since seenLabels() returns a
reference now instead of a pointer.
(KJS::BreakNode::execute): Ditto.
(KJS::LabelNode::execute): Ditto.
2008-01-26 Sam Weinig <sam@webkit.org>
Reviewed by Mark Rowe.
Cleanup node2string a little.
- Remove some unnecessary branching.
- Factor out bracket and dot streaming into static inline functions.
* kjs/nodes.h:
* kjs/nodes2string.cpp:
(KJS::bracketNodeStreamTo):
(KJS::dotNodeStreamTo):
(KJS::FunctionCallBracketNode::streamTo):
(KJS::FunctionCallDotNode::streamTo):
(KJS::PostIncBracketNode::streamTo):
(KJS::PostDecBracketNode::streamTo):
(KJS::PostIncDotNode::streamTo):
(KJS::PostDecDotNode::streamTo):
(KJS::DeleteBracketNode::streamTo):
(KJS::DeleteDotNode::streamTo):
(KJS::PreIncBracketNode::streamTo):
(KJS::PreDecBracketNode::streamTo):
(KJS::PreIncDotNode::streamTo):
(KJS::PreDecDotNode::streamTo):
(KJS::ReadModifyBracketNode::streamTo):
(KJS::AssignBracketNode::streamTo):
(KJS::ReadModifyDotNode::streamTo):
(KJS::AssignDotNode::streamTo):
(KJS::WhileNode::streamTo):
2008-01-26 Mark Rowe <mrowe@apple.com>
Reviewed by Darin Adler.
Fix http://bugs.webkit.org/show_bug.cgi?id=17001
Bug 17001: Build error with Gtk port on Mac OS X
If both XP_MACOSX and XP_UNIX are defined then X11.h and Carbon.h will both be included.
These provide conflicting definitions for a type named 'Cursor'. As XP_UNIX is set by
the build system when targeting X11, it doesn't make sense for XP_MACOSX to also be set
in this instance.
* bindings/npapi.h: Don't define XP_MACOSX if XP_UNIX is defined.
2008-01-26 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix http://bugs.webkit.org/show_bug.cgi?id=17013
JSC can't round trip certain for-loops
Test: fast/js/toString-for-var-decl.html
* kjs/nodes.h: Added PlaceholderTrueNode so we can put nodes into
for loops without injecting the word "true" into them (nice, but not
the bug fix). Fixed ForNode constructor so expr1WasVarDecl is set
only when there is an expression, since it's common for the actual
variable declaration to be moved by the parser.
* kjs/nodes2string.cpp:
(KJS::PlaceholderTrueNode::streamTo): Added. Empty.
2008-01-25 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Fix for bug 17012: REGRESSION: JSC can't round trip an object literal
Add logic to ensure that object literals and function expressions get
parentheses when necessary.
* kjs/nodes.h:
* kjs/nodes2string.cpp:
(KJS::SourceStream::operator<<):
2008-01-24 Steve Falkenburg <sfalken@apple.com>
Build fix.
* JavaScriptCore.vcproj/JavaScriptCore.sln:
2008-01-24 Steve Falkenburg <sfalken@apple.com>
Build fix.
* JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Fix QDateTime to JS Date conversion.
Several conversion errors (some UTC related, some month
offset related) and the conversion distance for Date
to DateTime conversion weights were fixed (it should never
be better to convert a JS Number into a Date rather than
an int).
* bindings/qt/qt_runtime.cpp:
(KJS::Bindings::convertValueToQVariant):
(KJS::Bindings::convertQVariantToValue):
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Add support for calling QObjects.
Add support for invokeDefaultMethod (via a call to
a specific slot), and also allow using it as a
constructor, like QtScript.
* bindings/qt/qt_class.cpp:
(KJS::Bindings::QtClass::fallbackObject):
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtRuntimeObjectImp::construct):
(KJS::Bindings::QtInstance::QtInstance):
(KJS::Bindings::QtInstance::~QtInstance):
(KJS::Bindings::QtInstance::implementsCall):
(KJS::Bindings::QtInstance::invokeDefaultMethod):
* bindings/qt/qt_instance.h:
* bindings/qt/qt_runtime.cpp:
(KJS::Bindings::findMethodIndex):
(KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
(KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
* bindings/qt/qt_runtime.h:
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Code style cleanups.
Add spaces before/after braces in inline function.
* bindings/qt/qt_instance.h:
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Code style cleanups.
Remove spaces and unneeded declared parameter names.
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Clear stale RuntimeObjectImps.
Since other objects can have refs to the QtInstance,
we can't rely on the QtInstance being deleted when the
RuntimeObjectImp is invalidate or deleted. This
could result in a stale JSObject being returned for
a valid Instance.
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
(KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
(KJS::Bindings::QtRuntimeObjectImp::invalidate):
(KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
(KJS::Bindings::QtInstance::getRuntimeObject):
* bindings/runtime.cpp:
(KJS::Bindings::Instance::createRuntimeObject):
* bindings/runtime.h:
2008-01-23 Alp Toker <alp@atoker.com>
Rubber-stamped by Mark Rowe.
Remove whitespace after -I in automake include lists.
* GNUmakefile.am:
2008-01-23 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Lars Knoll <lars@trolltech.com>.
Reworked the JavaScriptCore Qt bindings:
* Add initial support for string and variant arrays, as well
as sub QObjects in the JS bindings.
* Don't expose fields marked as not scriptable by moc.
* Add support for dynamic properties and accessing named
QObject children of an object (like QtScript and older
IE DOM style JS).
* Add support for custom toString methods.
* Fine tune some bindings to be closer to QtScript.
Make void functions return undefined, and empty/
null QStrings return a zero length string.
* Create framework for allowing more direct method calls.
Since RuntimeMethod doesn't allow us to add additional
methods/properties to a function, add these classes.
Start prototyping object.signal.connect(...).
* Add signal support to the Qt bindings.
Allow connecting to signals (object.signal.connect(slot)),
disconnecting, and emitting signals. Currently chooses
the first signal that matches the name, so this will need
improvement.
* Add property names, and resolve signals closer to use.
Enumerating properties now returns some of the Qt properties
and signals. Slots and methods aren't quite present. Also,
resolve signal connections etc. closer to the time of use, so
we can do more dynamic resolution based on argument type etc.
Still picks the first one with the same name, at the moment.
* Make signature comparison code consistent.
Use the same code for checking meta signatures in
the method and fallback getters, and avoid a
QByteArray construction when we can.
* Fix minor memory leak, and handle pointers better.
Delete the private object in the dtors, and use RefPtrs
for holding Instances etc.
* Handle method lookup better.
Allow invocation time method lookup based on the arguments,
which is closer to QtScript behaviour. Also, cache the
method lists and delete them in the QtClass dtor (stops
a memory leak).
* Improve JS to Qt data type conversions.
Add some support for Date & RegExp JS objects,
and provide some metrics on the quality of the
conversion.
* A couple of fixes for autotest failures.
Better support for converting lists, read/write only
QMetaProperty support, modified slot search order...)
* bindings/qt/qt_class.cpp:
(KJS::Bindings::QtClass::QtClass):
(KJS::Bindings::QtClass::~QtClass):
(KJS::Bindings::QtClass::name):
(KJS::Bindings::QtClass::fallbackObject):
(KJS::Bindings::QtClass::methodsNamed):
(KJS::Bindings::QtClass::fieldNamed):
* bindings/qt/qt_class.h:
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtInstance::QtInstance):
(KJS::Bindings::QtInstance::~QtInstance):
(KJS::Bindings::QtInstance::getRuntimeObject):
(KJS::Bindings::QtInstance::getClass):
(KJS::Bindings::QtInstance::implementsCall):
(KJS::Bindings::QtInstance::getPropertyNames):
(KJS::Bindings::QtInstance::invokeMethod):
(KJS::Bindings::QtInstance::invokeDefaultMethod):
(KJS::Bindings::QtInstance::stringValue):
(KJS::Bindings::QtInstance::booleanValue):
(KJS::Bindings::QtInstance::valueOf):
(KJS::Bindings::QtField::name):
(KJS::Bindings::QtField::valueFromInstance):
(KJS::Bindings::QtField::setValueToInstance):
* bindings/qt/qt_instance.h:
(KJS::Bindings::QtInstance::getBindingLanguage):
(KJS::Bindings::QtInstance::getObject):
* bindings/qt/qt_runtime.cpp:
(KJS::Bindings::QWKNoDebug::QWKNoDebug):
(KJS::Bindings::QWKNoDebug::~QWKNoDebug):
(KJS::Bindings::QWKNoDebug::operator<<):
(KJS::Bindings::):
(KJS::Bindings::valueRealType):
(KJS::Bindings::convertValueToQVariant):
(KJS::Bindings::convertQVariantToValue):
(KJS::Bindings::QtRuntimeMethod::QtRuntimeMethod):
(KJS::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
(KJS::Bindings::QtRuntimeMethod::codeType):
(KJS::Bindings::QtRuntimeMethod::execute):
(KJS::Bindings::QtRuntimeMethodData::~QtRuntimeMethodData):
(KJS::Bindings::QtRuntimeMetaMethodData::~QtRuntimeMetaMethodData):
(KJS::Bindings::QtRuntimeConnectionMethodData::~QtRuntimeConnectionMethodData):
(KJS::Bindings::QtMethodMatchType::):
(KJS::Bindings::QtMethodMatchType::QtMethodMatchType):
(KJS::Bindings::QtMethodMatchType::kind):
(KJS::Bindings::QtMethodMatchType::isValid):
(KJS::Bindings::QtMethodMatchType::isVariant):
(KJS::Bindings::QtMethodMatchType::isMetaType):
(KJS::Bindings::QtMethodMatchType::isUnresolved):
(KJS::Bindings::QtMethodMatchType::isMetaEnum):
(KJS::Bindings::QtMethodMatchType::enumeratorIndex):
(KJS::Bindings::QtMethodMatchType::variant):
(KJS::Bindings::QtMethodMatchType::metaType):
(KJS::Bindings::QtMethodMatchType::metaEnum):
(KJS::Bindings::QtMethodMatchType::unresolved):
(KJS::Bindings::QtMethodMatchType::typeId):
(KJS::Bindings::QtMethodMatchType::name):
(KJS::Bindings::QtMethodMatchData::QtMethodMatchData):
(KJS::Bindings::QtMethodMatchData::isValid):
(KJS::Bindings::QtMethodMatchData::firstUnresolvedIndex):
(KJS::Bindings::indexOfMetaEnum):
(KJS::Bindings::findMethodIndex):
(KJS::Bindings::findSignalIndex):
(KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
(KJS::Bindings::QtRuntimeMetaMethod::mark):
(KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
(KJS::Bindings::QtRuntimeMetaMethod::getOwnPropertySlot):
(KJS::Bindings::QtRuntimeMetaMethod::lengthGetter):
(KJS::Bindings::QtRuntimeMetaMethod::connectGetter):
(KJS::Bindings::QtRuntimeMetaMethod::disconnectGetter):
(KJS::Bindings::QtRuntimeConnectionMethod::QtRuntimeConnectionMethod):
(KJS::Bindings::QtRuntimeConnectionMethod::callAsFunction):
(KJS::Bindings::QtRuntimeConnectionMethod::getOwnPropertySlot):
(KJS::Bindings::QtRuntimeConnectionMethod::lengthGetter):
(KJS::Bindings::QtConnectionObject::QtConnectionObject):
(KJS::Bindings::QtConnectionObject::~QtConnectionObject):
(KJS::Bindings::QtConnectionObject::metaObject):
(KJS::Bindings::QtConnectionObject::qt_metacast):
(KJS::Bindings::QtConnectionObject::qt_metacall):
(KJS::Bindings::QtConnectionObject::execute):
(KJS::Bindings::QtConnectionObject::match):
(KJS::Bindings::::QtArray):
(KJS::Bindings::::~QtArray):
(KJS::Bindings::::rootObject):
(KJS::Bindings::::setValueAt):
(KJS::Bindings::::valueAt):
* bindings/qt/qt_runtime.h:
(KJS::Bindings::QtField::):
(KJS::Bindings::QtField::QtField):
(KJS::Bindings::QtField::fieldType):
(KJS::Bindings::QtMethod::QtMethod):
(KJS::Bindings::QtMethod::name):
(KJS::Bindings::QtMethod::numParameters):
(KJS::Bindings::QtArray::getLength):
(KJS::Bindings::QtRuntimeMethod::d_func):
(KJS::Bindings::QtRuntimeMetaMethod::d_func):
(KJS::Bindings::QtRuntimeConnectionMethod::d_func):
(KJS::Bindings::):
* bindings/runtime.cpp:
(KJS::Bindings::Instance::createBindingForLanguageInstance):
(KJS::Bindings::Instance::createRuntimeObject):
(KJS::Bindings::Instance::reallyCreateRuntimeObject):
* bindings/runtime.h:
2008-01-22 Anders Carlsson <andersca@apple.com>
Reviewed by Darin and Adam.
<rdar://problem/5688975>
div element on microsoft site has wrong left offset.
Return true even if NPN_GetProperty returns null or undefined. This matches Firefox
(and is what the Silverlight plug-in expects).
* bindings/NP_jsobject.cpp:
(_NPN_GetProperty):
2008-01-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=16909
REGRESSION: Amazon.com crash (ActivationImp)
(and a bunch of other crashes)
Plus, a .7% SunSpider speedup to boot.
Replaced the buggy currentExec and savedExec mechanisms with an
explicit ExecState stack.
* kjs/collector.cpp:
(KJS::Collector::collect): Explicitly mark the ExecState stack.
(KJS::Collector::reportOutOfMemoryToAllExecStates): Slight change in
behavior: We no longer throw an exception in any global ExecStates,
since global ExecStates are more like pseudo-ExecStates, and aren't
used for script execution. (It's unclear what would happen if you left
an exception waiting around in a global ExecState, but it probably
wouldn't be good.)
2008-01-21 Jan Michael Alonzo <jmalonzo@unpluggable.com>
Reviewed by Alp Toker.
http://bugs.webkit.org/show_bug.cgi?id=16955
Get errors when cross-compile webkit-gtk
* GNUmakefile.am: removed ICU_CFLAGS
2008-01-18 Kevin McCullough <kmccullough@apple.com>
- Build fix.
* kjs/ustring.h:
2008-01-18 Kevin McCullough <kmccullough@apple.com>
- Build fix.
* kjs/ustring.cpp:
* kjs/ustring.h:
(KJS::UString::cost):
2008-01-18 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff.
- Correctly report cost of appended strings to trigger GC.
* kjs/ustring.cpp:
(KJS::):
(KJS::UString::Rep::create):
(KJS::UString::UString): Don't create unnecssary objects.
(KJS::UString::cost): Report cost if necessary but also keep track of
reported cost.
* kjs/ustring.h:
2008-01-18 Simon Hausmann <hausmann@webkit.org>
Reviewed by Holger.
Fix return type conversions from Qt slots to JS values.
This also fixes fast/dom/open-and-close-by-DOM.html, which called
layoutTestController.windowCount().
When constructing the QVariant that holds the return type we cannot
use the QVarian(Type) constuctor as that will create a null variant.
We have to use the QVariant(Type, void *) constructor instead, just
like in QMetaObject::read() for example.
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtInstance::getRuntimeObject):
2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
Reviewed by Simon Hausmann <hausmann@webkit.org>.
Fix compilation on Win64(2): Implemented currentThreadStackBase on X86-64 on Windows
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
Reviewed by Simon Hausmann <hausmann@webkit.org>.
Fix compilation on Win64(1): Define WTF_PLATFORM_X86_64 correctly on Win64.
* wtf/Platform.h:
2008-01-17 Antti Koivisto <antti@apple.com>
Fix Windows build.
* kjs/regexp_object.cpp:
(KJS::regExpProtoFuncToString):
2008-01-16 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Fix for http://bugs.webkit.org/show_bug.cgi?id=16901
Convert remaining JS function objects to use the new PrototypeFunction class
- Moves Boolean, Function, RegExp, Number, Object and Global functions to their
own static function implementations so that they can be used with the
PrototypeFunction class. SunSpider says this is 1.003x as fast.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
* kjs/array_object.h:
* kjs/bool_object.cpp:
(KJS::BooleanInstance::BooleanInstance):
(KJS::BooleanPrototype::BooleanPrototype):
(KJS::booleanProtoFuncToString):
(KJS::booleanProtoFuncValueOf):
(KJS::BooleanObjectImp::BooleanObjectImp):
(KJS::BooleanObjectImp::implementsConstruct):
(KJS::BooleanObjectImp::construct):
(KJS::BooleanObjectImp::callAsFunction):
* kjs/bool_object.h:
(KJS::BooleanInstance::classInfo):
* kjs/error_object.cpp:
(KJS::ErrorPrototype::ErrorPrototype):
(KJS::errorProtoFuncToString):
* kjs/error_object.h:
* kjs/function.cpp:
(KJS::globalFuncEval):
(KJS::globalFuncParseInt):
(KJS::globalFuncParseFloat):
(KJS::globalFuncIsNaN):
(KJS::globalFuncIsFinite):
(KJS::globalFuncDecodeURI):
(KJS::globalFuncDecodeURIComponent):
(KJS::globalFuncEncodeURI):
(KJS::globalFuncEncodeURIComponent):
(KJS::globalFuncEscape):
(KJS::globalFuncUnEscape):
(KJS::globalFuncKJSPrint):
(KJS::PrototypeFunction::PrototypeFunction):
* kjs/function.h:
* kjs/function_object.cpp:
(KJS::FunctionPrototype::FunctionPrototype):
(KJS::functionProtoFuncToString):
(KJS::functionProtoFuncApply):
(KJS::functionProtoFuncCall):
* kjs/function_object.h:
* kjs/number_object.cpp:
(KJS::NumberPrototype::NumberPrototype):
(KJS::numberProtoFuncToString):
(KJS::numberProtoFuncToLocaleString):
(KJS::numberProtoFuncValueOf):
(KJS::numberProtoFuncToFixed):
(KJS::numberProtoFuncToExponential):
(KJS::numberProtoFuncToPrecision):
* kjs/number_object.h:
(KJS::NumberInstance::classInfo):
(KJS::NumberObjectImp::classInfo):
(KJS::NumberObjectImp::):
* kjs/object_object.cpp:
(KJS::ObjectPrototype::ObjectPrototype):
(KJS::objectProtoFuncValueOf):
(KJS::objectProtoFuncHasOwnProperty):
(KJS::objectProtoFuncIsPrototypeOf):
(KJS::objectProtoFuncDefineGetter):
(KJS::objectProtoFuncDefineSetter):
(KJS::objectProtoFuncLookupGetter):
(KJS::objectProtoFuncLookupSetter):
(KJS::objectProtoFuncPropertyIsEnumerable):
(KJS::objectProtoFuncToLocaleString):
(KJS::objectProtoFuncToString):
* kjs/object_object.h:
* kjs/regexp_object.cpp:
(KJS::RegExpPrototype::RegExpPrototype):
(KJS::regExpProtoFuncTest):
(KJS::regExpProtoFuncExec):
(KJS::regExpProtoFuncCompile):
(KJS::regExpProtoFuncToString):
* kjs/regexp_object.h:
2008-01-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej & Darin.
Fixes Bug 16868: Gmail crash
and Bug 16871: Crash when loading apple.com/startpage
<http://bugs.webkit.org/show_bug.cgi?id=16868>
<rdar://problem/5686108>
<http://bugs.webkit.org/show_bug.cgi?id=16871>
<rdar://problem/5686670>
Adds ActivationImp tear-off for cross-window eval() and fixes an
existing garbage collection issue exposed by the ActivationImp tear-off
patch (r29425) that can occur when an ExecState's m_callingExec is
different than its m_savedExec.
* kjs/ExecState.cpp:
(KJS::ExecState::mark):
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction):
2008-01-16 Sam Weinig <sam@webkit.org>
Reviewed by Oliver.
Clean up MathObjectImp, it needed a little scrubbing.
* kjs/math_object.cpp:
(KJS::MathObjectImp::MathObjectImp):
(KJS::MathObjectImp::getOwnPropertySlot):
(KJS::MathObjectImp::getValueProperty):
(KJS::mathProtoFuncACos):
(KJS::mathProtoFuncASin):
(KJS::mathProtoFuncATan):
(KJS::mathProtoFuncATan2):
(KJS::mathProtoFuncCos):
(KJS::mathProtoFuncExp):
(KJS::mathProtoFuncLog):
(KJS::mathProtoFuncSin):
(KJS::mathProtoFuncSqrt):
(KJS::mathProtoFuncTan):
* kjs/math_object.h:
(KJS::MathObjectImp::classInfo):
(KJS::MathObjectImp::):
2008-01-16 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Rename Lexer variable bol to atLineStart.
* kjs/lexer.cpp:
(KJS::Lexer::Lexer):
(KJS::Lexer::setCode):
(KJS::Lexer::nextLine):
(KJS::Lexer::lex):
* kjs/lexer.h:
2008-01-16 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen and Anders Carlsson.
Remove uses of KJS_PURE_ECMA as we don't ever build with it defined,
and we have many features that are not included in the ECMA spec.
* kjs/lexer.cpp:
(KJS::Lexer::Lexer):
(KJS::Lexer::setCode):
(KJS::Lexer::nextLine):
(KJS::Lexer::lex):
* kjs/lexer.h:
* kjs/string_object.cpp:
* kjs/string_object.h:
2008-01-15 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Fix <rdar://problem/5595552> r27608 introduced a 20% increase in JS binary size, 4% increase in WebCore binary size
- This changes the way JS functions that use Lookup tables are handled. Instead of using
one class per function, which allowed specialization of the virtual callAsFunction
method, we now use one class, PrototypeFunction, which takes a pointer to a static
function to use as the implementation. This significantly decreases the binary size
of JavaScriptCore (about 145k on an Intel only build) while still keeping some of the
speedup r27608 garnered (SunSpider says this is 1.005x as slow, which should leave some
wiggle room from the original 1% speedup) and keeps the functions implementations in separate
functions to help with optimizations.
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/array_object.cpp:
(KJS::arrayProtoFuncToString):
(KJS::arrayProtoFuncToLocaleString):
(KJS::arrayProtoFuncJoin):
(KJS::arrayProtoFuncConcat):
(KJS::arrayProtoFuncPop):
(KJS::arrayProtoFuncPush):
(KJS::arrayProtoFuncReverse):
(KJS::arrayProtoFuncShift):
(KJS::arrayProtoFuncSlice):
(KJS::arrayProtoFuncSort):
(KJS::arrayProtoFuncSplice):
(KJS::arrayProtoFuncUnShift):
(KJS::arrayProtoFuncFilter):
(KJS::arrayProtoFuncMap):
(KJS::arrayProtoFuncEvery):
(KJS::arrayProtoFuncForEach):
(KJS::arrayProtoFuncSome):
(KJS::arrayProtoFuncIndexOf):
(KJS::arrayProtoFuncLastIndexOf):
* kjs/array_object.h:
* kjs/date_object.cpp:
(KJS::DatePrototype::getOwnPropertySlot):
(KJS::dateProtoFuncToString):
(KJS::dateProtoFuncToUTCString):
(KJS::dateProtoFuncToDateString):
(KJS::dateProtoFuncToTimeString):
(KJS::dateProtoFuncToLocaleString):
(KJS::dateProtoFuncToLocaleDateString):
(KJS::dateProtoFuncToLocaleTimeString):
(KJS::dateProtoFuncValueOf):
(KJS::dateProtoFuncGetTime):
(KJS::dateProtoFuncGetFullYear):
(KJS::dateProtoFuncGetUTCFullYear):
(KJS::dateProtoFuncToGMTString):
(KJS::dateProtoFuncGetMonth):
(KJS::dateProtoFuncGetUTCMonth):
(KJS::dateProtoFuncGetDate):
(KJS::dateProtoFuncGetUTCDate):
(KJS::dateProtoFuncGetDay):
(KJS::dateProtoFuncGetUTCDay):
(KJS::dateProtoFuncGetHours):
(KJS::dateProtoFuncGetUTCHours):
(KJS::dateProtoFuncGetMinutes):
(KJS::dateProtoFuncGetUTCMinutes):
(KJS::dateProtoFuncGetSeconds):
(KJS::dateProtoFuncGetUTCSeconds):
(KJS::dateProtoFuncGetMilliSeconds):
(KJS::dateProtoFuncGetUTCMilliseconds):
(KJS::dateProtoFuncGetTimezoneOffset):
(KJS::dateProtoFuncSetTime):
(KJS::dateProtoFuncSetMilliSeconds):
(KJS::dateProtoFuncSetUTCMilliseconds):
(KJS::dateProtoFuncSetSeconds):
(KJS::dateProtoFuncSetUTCSeconds):
(KJS::dateProtoFuncSetMinutes):
(KJS::dateProtoFuncSetUTCMinutes):
(KJS::dateProtoFuncSetHours):
(KJS::dateProtoFuncSetUTCHours):
(KJS::dateProtoFuncSetDate):
(KJS::dateProtoFuncSetUTCDate):
(KJS::dateProtoFuncSetMonth):
(KJS::dateProtoFuncSetUTCMonth):
(KJS::dateProtoFuncSetFullYear):
(KJS::dateProtoFuncSetUTCFullYear):
(KJS::dateProtoFuncSetYear):
(KJS::dateProtoFuncGetYear):
* kjs/date_object.h:
* kjs/function.cpp:
(KJS::PrototypeFunction::PrototypeFunction):
(KJS::PrototypeFunction::callAsFunction):
* kjs/function.h:
* kjs/lookup.h:
(KJS::HashEntry::):
(KJS::staticFunctionGetter):
* kjs/math_object.cpp:
(KJS::mathProtoFuncAbs):
(KJS::mathProtoFuncACos):
(KJS::mathProtoFuncASin):
(KJS::mathProtoFuncATan):
(KJS::mathProtoFuncATan2):
(KJS::mathProtoFuncCeil):
(KJS::mathProtoFuncCos):
(KJS::mathProtoFuncExp):
(KJS::mathProtoFuncFloor):
(KJS::mathProtoFuncLog):
(KJS::mathProtoFuncMax):
(KJS::mathProtoFuncMin):
(KJS::mathProtoFuncPow):
(KJS::mathProtoFuncRandom):
(KJS::mathProtoFuncRound):
(KJS::mathProtoFuncSin):
(KJS::mathProtoFuncSqrt):
(KJS::mathProtoFuncTan):
* kjs/math_object.h:
* kjs/string_object.cpp:
(KJS::stringProtoFuncToString):
(KJS::stringProtoFuncValueOf):
(KJS::stringProtoFuncCharAt):
(KJS::stringProtoFuncCharCodeAt):
(KJS::stringProtoFuncConcat):
(KJS::stringProtoFuncIndexOf):
(KJS::stringProtoFuncLastIndexOf):
(KJS::stringProtoFuncMatch):
(KJS::stringProtoFuncSearch):
(KJS::stringProtoFuncReplace):
(KJS::stringProtoFuncSlice):
(KJS::stringProtoFuncSplit):
(KJS::stringProtoFuncSubstr):
(KJS::stringProtoFuncSubstring):
(KJS::stringProtoFuncToLowerCase):
(KJS::stringProtoFuncToUpperCase):
(KJS::stringProtoFuncToLocaleLowerCase):
(KJS::stringProtoFuncToLocaleUpperCase):
(KJS::stringProtoFuncLocaleCompare):
(KJS::stringProtoFuncBig):
(KJS::stringProtoFuncSmall):
(KJS::stringProtoFuncBlink):
(KJS::stringProtoFuncBold):
(KJS::stringProtoFuncFixed):
(KJS::stringProtoFuncItalics):
(KJS::stringProtoFuncStrike):
(KJS::stringProtoFuncSub):
(KJS::stringProtoFuncSup):
(KJS::stringProtoFuncFontcolor):
(KJS::stringProtoFuncFontsize):
(KJS::stringProtoFuncAnchor):
(KJS::stringProtoFuncLink):
* kjs/string_object.h:
2008-01-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Adam Roben.
Some tweaks to our headerdoc, suggested by David Gatwood on the docs
team.
* API/JSBase.h:
* API/JSObjectRef.h:
* API/JSStringRef.h:
* API/JSValueRef.h:
2008-01-15 Alp Toker <alp@atoker.com>
Rubber-stamped by Anders.
Make the HTTP backend configurable in the GTK+ port. curl is currently
the only option.
* wtf/Platform.h: Don't hard-code WTF_USE_CURL for GTK
2008-01-15 Sam Weinig <sam@webkit.org>
Reviewed by Beth Dakin.
Remove unneeded variable.
* kjs/string_object.cpp:
(KJS::StringProtoFuncSubstr::callAsFunction):
2008-01-14 Steve Falkenburg <sfalken@apple.com>
Use shared vsprops for most vcproj properties.
Reviewed by Darin.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add missing Debug_Internal config.
* JavaScriptCore.vcproj/WTF/WTF.vcproj: Add missing Debug_Internal config.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2008-01-14 Adam Roben <aroben@apple.com>
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
some headers that were missing from the vcproj so their contents will
be included in Find in Files.
2008-01-14 Adam Roben <aroben@apple.com>
Fix Bug 16871: Crash when loading apple.com/startpage
<http://bugs.webkit.org/show_bug.cgi?id=16871>
<rdar://problem/5686670>
Patch written by Darin, reviewed by me.
* kjs/ExecState.cpp:
(KJS::ExecState::mark): Call ActivationImp::markChildren if our
m_activation is on the stack. This is what ScopeChain::mark also does,
but apparently in some cases it's possible for an ExecState's
ActivationImp to not be in any ScopeChain.
2008-01-14 Kevin McCullough <kmccullough@apple.com>
Reviewed by Oliver.
-<rdar://problem/5622667> REGRESSION (Leopard-ToT): Endless loading loop
trying to view techreport.com comments
- We need to set values in the map, because if they are already in the
map they will not be reset when we use add().
* kjs/array_instance.cpp:
(KJS::ArrayInstance::put):
2008-01-14 Darin Adler <darin@apple.com>
Reviewed by Adam.
- re-speed-up the page load test (my StringImpl change slowed it down)
* wtf/RefCounted.h:
(WTF::RefCounted::RefCounted): Allow derived classes to start with a reference
count other than 0. Eventually everyone will want to start with a 1. This is a
staged change. For now, there's a default of 0, and you can specify 1. Later,
there will be no default and everyone will have to specify. And then later, there
will be a default of 1. Eventually, we can take away even the option of starting
with 0!
* wtf/Vector.h:
(WTF::Vector::Vector): Sped up creation of non-empty vectors by removing the
overhead of first constructing something empty and then calling resize.
(WTF::Vector::clear): Sped up the common case of calling clear on an empty
vector by adding a check for that case.
(WTF::Vector::releaseBuffer): Marked this function inline and removed a branch
in the case of vectors with no inline capacity (normal vectors) by leaving out
the code to copy the inline buffer in that case.
2008-01-14 Alexey Proskuryakov <ap@webkit.org>
Reviewed by David Kilzer.
http://bugs.webkit.org/show_bug.cgi?id=16787
array.splice() with 1 element not working
Test: fast/js/array-splice.html
* kjs/array_object.cpp:
(KJS::ArrayProtoFuncSplice::callAsFunction): Implement this Mozilla extension, and fix
some other edge cases.
2008-01-13 Steve Falkenburg <sfalken@apple.com>
Share common files across projects.
Unify vsprops files
Debug: common.vsprops, debug.vsprops
Debug_Internal: common.vsprops, debug.vsprops, debug_internal.vsprops
Release: common.vsprops, release.vsprops
Shared properties can go into common.vsprops, shared debug settings can go into debug.vsprops.
debug_internal.vsprops will be mostly empty except for file path prefix modifiers.
Reviewed by Adam Roben.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.vcproj/debug.vsprops: Removed.
* JavaScriptCore.vcproj/debug_internal.vsprops: Removed.
* JavaScriptCore.vcproj/release.vsprops: Removed.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2008-01-13 Marius Bugge Monsen <mbm@trolltech.com>
Contributions and review by Adriaan de Groot,
Simon Hausmann, Eric Seidel, and Darin Adler.
- http://bugs.webkit.org/show_bug.cgi?id=16590
Compilation fixes for Solaris.
* kjs/DateMath.h:
(KJS::GregorianDateTime::GregorianDateTime): Use the WIN_OS code path
for SOLARIS too, presumably because Solaris also lacks the tm_gtoff and tm_zone
fields.
(KJS::GregorianDateTime::operator tm): Ditto.
* kjs/collector.cpp:
(KJS::currentThreadStackBase): Use thr_stksegment on Solaris.
* wtf/MathExtras.h:
(isfinite): Implement for Solaris.
(isinf): Ditto.
(signbit): Ditto. But this one is wrong, so I added a FIXME.
* wtf/Platform.h: Define PLATFORM(SOLARIS) when "sun" or "__sun" is defined.
2008-01-13 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Anders Carlsson.
Add binding language type to Instance.
Allows runtime determination of the type of an
Instance, to allow safe casting. Doesn't actually
add any safe casting yet, though.
Add a helper function to get an Instance from a JSObject*.
Given an object and the expected binding language, see if
the JSObject actually wraps an Instance of the given type
and return it. Otherwise return 0.
Move RuntimeObjectImp creations into Instance.
Make the ctor protected, and Instance a friend class, so
that all creation of RuntimeObjectImps goes through
one place.
Remove copy ctor/assignment operator for QtInstance.
Instance itself is Noncopyable, so QtInstance doesn't
need to have these.
Add caching for QtInstance and associated RuntimeObjectImps.
Push any dealings with QtLanguage bindings into QtInstance,
and cache them there, rather than in the Instance layer. Add
a QtRuntimeObjectImp to help with caching.
* JavaScriptCore.exp:
* bindings/c/c_instance.h:
* bindings/jni/jni_instance.h:
* bindings/objc/objc_instance.h:
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
(KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
(KJS::Bindings::QtRuntimeObjectImp::invalidate):
(KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
(KJS::Bindings::QtInstance::QtInstance):
(KJS::Bindings::QtInstance::~QtInstance):
(KJS::Bindings::QtInstance::getQtInstance):
(KJS::Bindings::QtInstance::getRuntimeObject):
* bindings/qt/qt_instance.h:
(KJS::Bindings::QtInstance::getBindingLanguage):
* bindings/runtime.cpp:
(KJS::Bindings::Instance::createBindingForLanguageInstance):
(KJS::Bindings::Instance::createRuntimeObject):
(KJS::Bindings::Instance::getInstance):
* bindings/runtime.h:
* bindings/runtime_object.h:
(KJS::RuntimeObjectImp::getInternalInstance):
2008-01-12 Alp Toker <alp@atoker.com>
Reviewed by Mark Rowe.
Hide non-public symbols in GTK+/autotools release builds.
* GNUmakefile.am:
2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Mark Rowe.
Fix http://bugs.webkit.org/show_bug.cgi?id=16852
Fixes leaking of ActivationStackNode objects.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::deleteActivationStack):
(KJS::JSGlobalObject::~JSGlobalObject):
(KJS::JSGlobalObject::init):
(KJS::JSGlobalObject::reset):
* kjs/JSGlobalObject.h:
2008-01-12 Darin Adler <darin@apple.com>
- try to fix Qt Windows build
* pcre/dftables: Remove reliance on the list form of Perl pipes.
2008-01-12 Darin Adler <darin@apple.com>
- try to fix Qt build
* kjs/function.cpp: Added include of scope_chain_mark.h.
* kjs/scope_chain_mark.h: Added multiple-include guards.
2008-01-12 Mark Rowe <mrowe@apple.com>
Another Windows build fix.
* kjs/Activation.h:
2008-01-12 Mark Rowe <mrowe@apple.com>
Attempted Windows build fix. Use struct consistently when forward-declaring
ActivationStackNode and StackActivation.
* kjs/Activation.h:
* kjs/JSGlobalObject.h:
2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Fixes a problem with the ActivationImp tear-off patch (r29425) where
some of the calls to JSGlobalObject::tearOffActivation() were using
the wrong test to determine whether it should leave a relic behind.
* kjs/function.cpp:
(KJS::FunctionImp::argumentsGetter):
(KJS::ActivationImp::getOwnPropertySlot):
2008-01-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
variable access (16644)
This bug was caused by var declarations shadowing built-in properties of
the global object.
To match Firefox, we've decided that var declarations will never shadow
built-in properties of the global object or its prototypes. We used to
behave more like IE, which allows shadowing, but walking that line got
us into trouble with websites that sent us down the Firefox codepath.
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableGet): New code to support calling
hasProperty before the variable object is fully initialized (so you
can call it during initialization).
* kjs/nodes.cpp:.
(KJS::ProgramNode::initializeSymbolTable): Always do a full hasProperty
check when looking for duplicates, not getDirect, since it only checks
the property map, and not hasOwnProperty, since it doesn't check
prototypes.
(KJS::EvalNode::processDeclarations): ditto
* kjs/property_slot.h:
(KJS::PropertySlot::ungettableGetter): Best function name evar.
2008-01-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Optimized ActivationImp allocation, so that activation records are now
first allocated on an explicitly managed stack and only heap allocated
when necessary. Roughly a 5% improvement on SunSpider, and a larger
improvement on benchmarks that use more function calls.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/Activation.h: Added.
(KJS::ActivationImp::ActivationData::ActivationData):
(KJS::ActivationImp::ActivationImp):
(KJS::ActivationImp::classInfo):
(KJS::ActivationImp::isActivationObject):
(KJS::ActivationImp::isOnStack):
(KJS::ActivationImp::d):
(KJS::StackActivation::StackActivation):
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
(KJS::ExecState::~ExecState):
* kjs/ExecState.h:
(KJS::ExecState::replaceScopeChainTop):
(KJS::ExecState::setActivationObject):
(KJS::ExecState::setLocalStorage):
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
(KJS::JSGlobalObject::pushActivation):
(KJS::JSGlobalObject::checkActivationCount):
(KJS::JSGlobalObject::popActivationHelper):
(KJS::JSGlobalObject::popActivation):
(KJS::JSGlobalObject::tearOffActivation):
* kjs/JSGlobalObject.h:
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
(KJS::JSVariableObject::JSVariableObject):
* kjs/function.cpp:
(KJS::FunctionImp::argumentsGetter):
(KJS::ActivationImp::ActivationImp):
(KJS::ActivationImp::~ActivationImp):
(KJS::ActivationImp::init):
(KJS::ActivationImp::getOwnPropertySlot):
(KJS::ActivationImp::markHelper):
(KJS::ActivationImp::mark):
(KJS::ActivationImp::ActivationData::ActivationData):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function.h:
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::evaluate):
(KJS::PostDecResolveNode::evaluate):
(KJS::PreIncResolveNode::evaluate):
(KJS::PreDecResolveNode::evaluate):
(KJS::ReadModifyResolveNode::evaluate):
(KJS::AssignResolveNode::evaluate):
(KJS::WithNode::execute):
(KJS::TryNode::execute):
(KJS::FunctionBodyNode::processDeclarations):
(KJS::FuncExprNode::evaluate):
* kjs/object.h:
* kjs/scope_chain.h:
(KJS::ScopeChain::replace):
* kjs/scope_chain_mark.h: Added.
(KJS::ScopeChain::mark):
2008-01-11 Simon Hausmann <hausmann@webkit.org>
Reviewed by Mark Rowe.
Fix the (clean) qmake build. For generating chartables.c we don't
depend on a separate input source file anymore, the dftables perl
script is enough. So use that instead as value for the .input
variable, to ensure that qmake also generates a rule to call dftables.
* pcre/pcre.pri:
2008-01-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by John Sullivan.
Fixed some world leak reports:
* <rdar://problem/5669436> PLT complains about world leak of 1 JavaScript
Interpreter after running cvs-base suite
* <rdar://problem/5669423> PLT complains about world leak if browser
window is open when PLT starts
* kjs/collector.h: Added the ability to distinguish between global
objects and GC-protected global objects, since we only consider the
latter to be world leaks.
* kjs/collector.cpp:
2008-01-11 Mark Rowe <mrowe@apple.com>
Silence qmake warning about ctgen lacking input.
Rubber-stamped by Alp Toker.
* pcre/pcre.pri:
2008-01-10 David Kilzer <ddkilzer@apple.com>
dftables should be rewritten as a script
<http://bugs.webkit.org/show_bug.cgi?id=16818>
<rdar://problem/5681463>
Reviewed by Darin.
Rewrote the dftables utility in Perl. Attempted to switch all
build systems to call the script directly instead of building
a binary first. Only the Xcode build was able to be tested.
* DerivedSources.make: Added pcre directory to VPATH and changed
to invoke dftables directly.
* GNUmakefile.am: Removed build information and changed to invoke
dftables directly.
* JavaScriptCore.vcproj/JavaScriptCore.sln: Removed reference to
dftables project.
* JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
* JavaScriptCore.vcproj/dftables: Removed.
* JavaScriptCore.vcproj/dftables/dftables.vcproj: Removed.
* JavaScriptCore.xcodeproj/project.pbxproj: Removed dftables target.
* jscore.bkl: Removed dftables executable definition.
* pcre/dftables: Copied from JavaScriptCore/pcre/dftables.cpp.
* pcre/dftables.cpp: Removed.
* pcre/dftables.pro: Removed.
* pcre/pcre.pri: Removed references to dftables.cpp and changed to
invoke dftables directly.
2008-01-10 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
- fix http://bugs.webkit.org/show_bug.cgi?id=16782
<rdar://problem/5675331> REGRESSION(r29266): Reproducible crash in fast/replaced/image-map.html
The crash resulted from a native object (DumpRenderTree's
EventSender) causing its wrapper to be invalidated (by clicking a
link that replaced the document in the window) and consequently
deallocated. The fix is to use RefPtrs to protect the native object
from deletion by self-invalidation.
* bindings/runtime_method.cpp:
(RuntimeMethod::callAsFunction):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::fallbackObjectGetter):
(RuntimeObjectImp::fieldGetter):
(RuntimeObjectImp::methodGetter):
(RuntimeObjectImp::put):
(RuntimeObjectImp::defaultValue):
(RuntimeObjectImp::callAsFunction):
2008-01-07 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Turn testIsInteger assertions into compile-time asserts and move them into HashTraits.h
where possible.
* kjs/testkjs.cpp:
* wtf/HashTraits.h:
2008-01-07 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Mark.
Enable SVG_FONTS by default.
* Configurations/JavaScriptCore.xcconfig:
2008-01-07 Darin Adler <darin@apple.com>
Rubber stamped by David Kilzer.
- get rid of empty fpconst.cpp
* GNUmakefile.am: Remove fpconst.cpp.
* JavaScriptCore.pri: Ditto.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
* JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
* JavaScriptCoreSources.bkl: Ditto.
* kjs/fpconst.cpp: Removed.
2008-01-07 Darin Adler <darin@apple.com>
Reviewed by David Kilzer.
- fix alignment problem with NaN and Inf globals
* kjs/fpconst.cpp: Move the contents of this file from here back to
value.cpp. The reason this was in a separate file is that the DARWIN
version of this used a declaration of the globals with a different
type to avoid creating "init routines". That's no longer necessary for
DARWIN and was never necessary for the non-DARWIN code path.
To make this patch easy to merge, I didn't actually delete this file
yet. We'll do that in a separate changeset.
* kjs/value.cpp: If C99's NAN and INFINITY are present, then use them,
othrewise use the union trick from fpconst.cpp. I think it would be
better to eliminate KJS::NaN and KJS::Inf and just use NAN and INFINITY
directly or std::numeric_limits<double>::quiet_nan() and
std::numeric_limits<double>::infinity(). But when I tried that, it
slowed down SunSpider. Someone else could do that cleanup if they
could do it without slowing down the engine.
2008-01-07 Adam Roben <aroben@apple.com>
Windows build fix
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
JavaScript.h to the project.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
Copy JavaScript.h to WEBKITOUTPUTDIR.
2008-01-07 Timothy Hatcher <timothy@apple.com>
Reviewed by Darin.
Fix Mac build.
* API/JSNode.c:
* API/JSNode.h:
* API/JSNodeList.c:
* API/JSNodeList.h:
* API/JavaScript.h:
* API/JavaScriptCore.h:
* API/minidom.c:
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-01-07 Alp Toker <alp@atoker.com>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=16029
JavaScriptCore.h is not suitable for platforms other than Mac OS X
Introduce a new JavaScriptCore/JavaScript.h public API header. This
should be used by all new portable code using the JavaScriptCore API.
JavaScriptCore/JavaScriptCore.h will remain for compatibility with
existing applications that depend on it including JSStringRefCF.h
which isn't portable.
Also add minidom to the GTK+/autotools build since we can now support
it on all platforms.
* API/JSNode.h:
* API/JSNodeList.h:
* API/JavaScript.h: Added.
* API/JavaScriptCore.h:
* ForwardingHeaders/JavaScriptCore/JavaScript.h: Added.
* GNUmakefile.am:
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-01-06 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Abstract all DateObject.set* functions in preparation for fixing:
http://bugs.webkit.org/show_bug.cgi?id=16753
SunSpider had random changes here and there but was overall a wash.
* kjs/date_object.cpp:
(KJS::fillStructuresUsingTimeArgs):
(KJS::setNewValueFromTimeArgs):
(KJS::setNewValueFromDateArgs):
(KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
(KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
(KJS::DateProtoFuncSetSeconds::callAsFunction):
(KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
(KJS::DateProtoFuncSetMinutes::callAsFunction):
(KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
(KJS::DateProtoFuncSetHours::callAsFunction):
(KJS::DateProtoFuncSetUTCHours::callAsFunction):
(KJS::DateProtoFuncSetDate::callAsFunction):
(KJS::DateProtoFuncSetUTCDate::callAsFunction):
(KJS::DateProtoFuncSetMonth::callAsFunction):
(KJS::DateProtoFuncSetUTCMonth::callAsFunction):
(KJS::DateProtoFuncSetFullYear::callAsFunction):
(KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
2008-01-06 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Dan.
Add new helper function isArabicChar - SVG Fonts support needs it.
* wtf/unicode/icu/UnicodeIcu.h:
(WTF::Unicode::isArabicChar):
* wtf/unicode/qt4/UnicodeQt4.h:
(WTF::Unicode::isArabicChar):
2008-01-06 Alp Toker <alp@atoker.com>
Reviewed by Mark Rowe.
Use $(EXEEXT) to account for the .exe extension in the GTK+ Windows
build. (This is already done correctly in DerivedSources.make.) Issue
noticed by Mikkel when building in Cygwin.
Add a missing slash. This was a hack from the qmake build system that
isn't necessary with autotools.
* GNUmakefile.am:
2008-01-05 Darin Adler <darin@apple.com>
* API/JSRetainPtr.h: One more file that needed the change below.
2008-01-05 Darin Adler <darin@apple.com>
* wtf/OwnPtr.h: OwnPtr needs the same fix as RefPtr below.
2008-01-05 Adam Roben <aroben@apple.com>
Build fix.
Reviewed by Maciej.
* wtf/RetainPtr.h: Use PtrType instead of T* because of the
RemovePointer magic.
2008-01-05 Darin Adler <darin@apple.com>
Rubber stamped by Maciej Stachowiak.
- cut down own PIC branches by using a pointer-to-member-data instead of a
pointer-to-member-function in WTF smart pointers
* wtf/OwnArrayPtr.h:
* wtf/OwnPtr.h:
* wtf/PassRefPtr.h:
* wtf/RefPtr.h:
* wtf/RetainPtr.h:
Use a pointer to the m_ptr member instead of the get member.
The GCC compiler generates better code for this idiom.
2008-01-05 Henry Mason <hmason@mac.com>
Reviewed by Maciej Stachowiak.
http://bugs.webkit.org/show_bug.cgi?id=16738
Bug 16738: Collector block offset could be stored as an cell offset instead of a byte offset
Gives a 0.4% SunSpider boost and prettier code.
* kjs/collector.cpp: Switched to cell offsets from byte offsets
(KJS::Collector::heapAllocate):
(KJS::Collector::sweep):
2008-01-04 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Have the two malloc zones print useful diagnostics if their free method are unexpectedly invoked.
Due to <rdar://problem/5671357> this can happen if an application attempts to free a pointer that
was not allocated by any registered malloc zone on the system.
* kjs/CollectorHeapIntrospector.h:
* wtf/FastMalloc.cpp:
2008-01-04 Alp Toker <alp@atoker.com>
GTK+ autotools build fix. Terminate empty rules.
* GNUmakefile.am:
2008-01-03 Simon Hausmann <hausmann@webkit.org>
Reviewed by Mark Rowe.
Fix compilation with gcc 4.3: limits.h is needed for INT_MAX.
* pcre/pcre_exec.cpp:
2008-01-03 Darin Adler <darin@apple.com>
* tests/mozilla/expected.html: The fix for bug 16696 also fixed a test
case, ecma_3/RegExp/perlstress-002.js, so updated results to expect
that test to succeed.
2008-01-02 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16696
JSCRE fails fails to match Acid3 regexp
Test: fast/regex/early-acid3-86.html
The problem was with the cutoff point between backreferences and octal
escape sequences. We need to determine the cutoff point by counting the
total number of capturing brackets, which requires an extra pass through
the expression when compiling it.
* pcre/pcre_compile.cpp:
(CompileData::CompileData): Added numCapturingBrackets. Removed some
unused fields.
(compileBranch): Use numCapturingBrackets when calling checkEscape.
(calculateCompiledPatternLength): Use numCapturingBrackets when calling
checkEscape, and also store the bracket count at the end of the compile.
(jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
count the number of brackets and then a second time to calculate the length.
2008-01-02 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16696
JSCRE fails fails to match Acid3 regexp
Test: fast/regex/early-acid3-86.html
The problem was with the cutoff point between backreferences and octal
escape sequences. We need to determine the cutoff point by counting the
total number of capturing brackets, which requires an extra pass through
the expression when compiling it.
* pcre/pcre_compile.cpp:
(CompileData::CompileData): Added numCapturingBrackets. Removed some
unused fields.
(compileBranch): Use numCapturingBrackets when calling checkEscape.
(calculateCompiledPatternLength): Use numCapturingBrackets when calling
checkEscape, and also store the bracket count at the end of the compile.
(jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
count the number of brackets and then a second time to calculate the length.
2008-01-02 David Kilzer <ddkilzer@webkit.org>
Reviewed and landed by Darin.
* kjs/nodes.cpp:
(KJS::DoWhileNode::execute): Added a missing return.
2008-01-02 Darin Adler <darin@apple.com>
- try to fix Qt build
* wtf/unicode/qt4/UnicodeQt4.h:
(WTF::Unicode::foldCase): Add some missing const.
2008-01-02 Alice Liu <alice.liu@apple.com>
Reviewed by Sam Weinig.
need to export ASCIICType.h for use in DRT
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* wtf/ASCIICType.h:
(WTF::isASCIIUpper):
2008-01-02 Sam Weinig <sam@webkit.org>
Reviewed by Beth Dakin.
Cleanup error_object.h/cpp.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
* kjs/error_object.cpp:
(KJS::):
(KJS::ErrorInstance::ErrorInstance):
(KJS::ErrorPrototype::ErrorPrototype):
(KJS::ErrorProtoFuncToString::ErrorProtoFuncToString):
(KJS::ErrorProtoFuncToString::callAsFunction):
(KJS::ErrorObjectImp::ErrorObjectImp):
(KJS::ErrorObjectImp::implementsConstruct):
(KJS::ErrorObjectImp::construct):
(KJS::ErrorObjectImp::callAsFunction):
(KJS::NativeErrorPrototype::NativeErrorPrototype):
(KJS::NativeErrorImp::NativeErrorImp):
(KJS::NativeErrorImp::implementsConstruct):
(KJS::NativeErrorImp::construct):
(KJS::NativeErrorImp::callAsFunction):
(KJS::NativeErrorImp::mark):
* kjs/error_object.h:
(KJS::ErrorInstance::classInfo):
(KJS::NativeErrorImp::classInfo):
2008-01-02 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Alp Toker.
* GNUmakefile.am: Add missing dependency on grammar.y.
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Eric.
- fix for http://bugs.webkit.org/show_bug.cgi?id=16695
JSC allows non-identifier codepoints in identifiers (affects Acid3)
Test: fast/js/kde/parse.html
* kjs/lexer.cpp:
(KJS::Lexer::lex): Added additional states to distinguish Unicode escapes at the
start of identifiers from ones inside identifiers. Rejected characters that don't pass
the isIdentStart and isIdentPart tests.
(KJS::Lexer::convertUnicode): Removed incorrect FIXME comment.
* kjs/lexer.h: Added new states to distinguish \u escapes at the start of identifiers
from \u escapes inside identifiers.
2008-01-01 Darin Adler <darin@apple.com>
- rolled scope chain optimization out; it was breaking the world
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- http://bugs.webkit.org/show_bug.cgi?id=16685
eliminate List::empty() to cut down on PIC branches
Also included one other speed-up -- remove the call to reserveCapacity from
FunctionBodyNode::processDeclarations in all but the most unusual cases.
Together these make SunSpider 1.016x as fast.
* JavaScriptCore.exp: Updated.
* kjs/ExecState.cpp:
(KJS::globalEmptyList): Added. Called only when creating global ExecState
instances.
(KJS::ExecState::ExecState): Broke constructor up into three separate functions,
for the three separate node types. Also went through each of the three and
streamlined as much as possible, removing dead code. This prevents us from having
to access the global in the function body version of the constructor.
* kjs/ExecState.h: Added emptyList(). Replaced the constructor with a set of
three that are specific to the different node types that can create new execution
state objects.
* kjs/array_object.cpp:
(KJS::ArrayProtoFuncToLocaleString::callAsFunction): Use exec->emptyList() instead
of List::empty().
(KJS::ArrayProtoFuncConcat::callAsFunction): Ditto.
(KJS::ArrayProtoFuncSlice::callAsFunction): Ditto.
(KJS::ArrayProtoFuncSplice::callAsFunction): Ditto.
(KJS::ArrayProtoFuncFilter::callAsFunction): Ditto.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction): Updated to call new ExecState constructor.
(KJS::GlobalFuncImp::callAsFunction): Ditto (for eval).
* kjs/function_object.cpp:
(FunctionObjectImp::construct): Use exec->emptyList() instead of List::empty().
* kjs/list.cpp: Removed List::empty.
* kjs/list.h: Ditto.
* kjs/nodes.cpp:
(KJS::ElementNode::evaluate): Use exec->emptyList() instead of List::empty().
(KJS::ArrayNode::evaluate): Ditto.
(KJS::ObjectLiteralNode::evaluate): Ditto.
(KJS::PropertyListNode::evaluate): Ditto.
(KJS::FunctionBodyNode::processDeclarations): Another speed-up. Check the capacity
before calling reserveCapacity, because it doesn't get inlined the local storage
vector is almost always big enough -- saving the function call overhead is a big
deal.
(KJS::FuncDeclNode::makeFunction): Use exec->emptyList() instead of List::empty().
(KJS::FuncExprNode::evaluate): Ditto.
* kjs/object.cpp:
(KJS::tryGetAndCallProperty): Ditto.
* kjs/property_slot.cpp:
(KJS::PropertySlot::functionGetter): Ditto.
* kjs/string_object.cpp:
(KJS::StringProtoFuncSplit::callAsFunction): Ditto.
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16648
REGRESSION (r28165): Yuku.com navigation prints "jsRegExpExecute failed with result -2"
<rdar://problem/5646486> REGRESSION (r28165): Layout test fast/regex/test1 fails intermittently
Fixes 34 failing test cases in the fast/regex/test1.html test.
Restored the stack which prevents infinite loops for brackets that match the empty
string; it had been removed as an optimization.
Unfortunately, restoring this stack causes the regular expression test in SunSpider
to be 1.095x as slow and the overall test to be 1.004x as slow. Maybe we can find
a correct optimization to restore the speed!
It's possible the original change was on the right track but just off by one.
* pcre/pcre_exec.cpp: Add back eptrblock, but name it BracketChainNode.
(MatchStack::pushNewFrame): Add back the logic needed here.
(startNewGroup): Ditto.
(match): Ditto.
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- http://bugs.webkit.org/show_bug.cgi?id=16683
speed up function calls by making ScopeChain::push cheaper
This gives a 1.019x speedup on SunSpider.
After doing this, I realized this probably will be obsolete when the optimization
to avoid creating an activation object is done. When we do that one we should check
if rolling this out will speed things up, since this does add overhead at the time
you copy the scope chain.
* kjs/object.h: Removed the ScopeChain::release function. It was
marked inline, and called in exactly one place, so moved it there.
No idea why it was in this header file!
* kjs/scope_chain.cpp: Removed the overload of the ScopeChain::push
function that takes another ScopeChain. It was unused. I think we used
it over in WebCore at one point, but not any more.
* kjs/scope_chain.h: Changed ScopeChainNode into a struct rather than
a class, got rid of its constructor so we can have one that's uninitialized,
and moved the refCount into a derived struct, ScopeChainHeapNode. Made _node
mutable so it can be changed in the moveToHeap function. Changed the copy
constructor and assignment operator to call moveToHeap, since the top node
can't be shared when it's embedded in another ScopeChain object. Updated
functions as needed to handle the case where the first object isn't on the
heap or to add casts for cases where it's guaranteed to be. Changed the push
function to always put the new node into the ScopeChain object; it will get
put onto the heap when needed later.
2008-01-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed slight logic error in reserveCapacity, where we would reallocate
the storage buffer unnecessarily.
* wtf/Vector.h:
(WTF::::reserveCapacity): No need to grow the buffer if newCapacity is
equal to capacity().
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- http://bugs.webkit.org/show_bug.cgi?id=16684
eliminate debugger overhead from function body execution
Speeds SunSpider up 1.003x. That's a small amount, but measurable.
* JavaScriptCore.exp: Updated.
* kjs/Parser.h:
(KJS::Parser::parse): Create the node with a static member function named create() instead
of using new explicitly.
* kjs/grammar.y: Changed calls to new FunctionBodyNode to use FunctionBodyNode::create().
* kjs/nodes.cpp:
(KJS::ProgramNode::create): Added. Calls new.
(KJS::EvalNode::create): Ditto.
(KJS::FunctionBodyNode::create): Ditto, but creates FunctionBodyNodeWithDebuggerHooks
when a debugger is present.
(KJS::FunctionBodyNode::execute): Removed debugger hooks.
(KJS::FunctionBodyNodeWithDebuggerHooks::FunctionBodyNodeWithDebuggerHooks): Added.
(KJS::FunctionBodyNodeWithDebuggerHooks::execute): Calls the debugger, then the code,
then the debugger again.
* kjs/nodes.h: Added create functions, made the constructors private and protected.
2007-12-30 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
More small cleanup to array_object.cpp
* kjs/array_object.cpp:
(KJS::ArrayProtoFuncToString::callAsFunction):
(KJS::ArrayProtoFuncToLocaleString::callAsFunction):
(KJS::ArrayProtoFuncJoin::callAsFunction):
(KJS::ArrayProtoFuncConcat::callAsFunction):
(KJS::ArrayProtoFuncReverse::callAsFunction):
(KJS::ArrayProtoFuncShift::callAsFunction):
(KJS::ArrayProtoFuncSlice::callAsFunction):
(KJS::ArrayProtoFuncSort::callAsFunction):
(KJS::ArrayProtoFuncSplice::callAsFunction):
(KJS::ArrayProtoFuncUnShift::callAsFunction):
(KJS::ArrayProtoFuncFilter::callAsFunction):
(KJS::ArrayProtoFuncMap::callAsFunction):
(KJS::ArrayProtoFuncEvery::callAsFunction):
2007-12-30 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Apply wkstyle to array_object.cpp
* kjs/array_object.cpp:
(KJS::ArrayPrototype::ArrayPrototype):
(KJS::ArrayPrototype::getOwnPropertySlot):
(KJS::ArrayProtoFuncConcat::callAsFunction):
(KJS::ArrayProtoFuncPop::callAsFunction):
(KJS::ArrayProtoFuncReverse::callAsFunction):
(KJS::ArrayProtoFuncShift::callAsFunction):
(KJS::ArrayProtoFuncSlice::callAsFunction):
(KJS::ArrayProtoFuncSort::callAsFunction):
(KJS::ArrayProtoFuncSplice::callAsFunction):
(KJS::ArrayProtoFuncUnShift::callAsFunction):
(KJS::ArrayProtoFuncFilter::callAsFunction):
(KJS::ArrayProtoFuncMap::callAsFunction):
(KJS::ArrayProtoFuncEvery::callAsFunction):
(KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
(KJS::ArrayObjectImp::ArrayObjectImp):
(KJS::ArrayObjectImp::implementsConstruct):
(KJS::ArrayObjectImp::construct):
(KJS::ArrayObjectImp::callAsFunction):
2007-12-30 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Remove maxInt/minInt, replacing with std:max/min<int>()
* kjs/array_object.cpp:
(KJS::ArrayProtoFuncSplice::callAsFunction):
* kjs/operations.cpp:
* kjs/operations.h:
2007-12-30 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Update Number.toString to properly throw exceptions.
Cleanup code in Number.toString implementation.
* kjs/number_object.cpp:
(KJS::numberToString):
* kjs/object.cpp:
(KJS::Error::create): Remove bogus debug lines.
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
ASSERT when debugging via Drosera due to missed var lookup optimization.
http://bugs.webkit.org/show_bug.cgi?id=16634
No test case possible.
* kjs/nodes.cpp:
(KJS::BreakpointCheckStatement::optimizeVariableAccess):
* kjs/nodes.h:
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
Fix (-0).toFixed() and re-factor a little
Fix (-0).toExponential() and printing of trailing 0s in toExponential
Fix toPrecision(nan) handling
http://bugs.webkit.org/show_bug.cgi?id=16640
* kjs/number_object.cpp:
(KJS::numberToFixed):
(KJS::fractionalPartToString):
(KJS::numberToExponential):
(KJS::numberToPrecision):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
More changes to make number code readable
* kjs/number_object.cpp:
(KJS::integer_part_noexp):
(KJS::numberToFixed):
(KJS::numberToExponential):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
More small cleanups to toPrecision
* kjs/number_object.cpp:
(KJS::numberToPrecision):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
More small attempts to make number code readable
* kjs/number_object.cpp:
(KJS::exponentialPartToString):
(KJS::numberToExponential):
(KJS::numberToPrecision):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Break out callAsFunction implementations into static functions
* kjs/number_object.cpp:
(KJS::numberToString):
(KJS::numberToFixed):
(KJS::numberToExponential):
(KJS::numberToPrecision):
(KJS::NumberProtoFunc::callAsFunction):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Apply wkstyle/astyle and fix placement of *
* kjs/number_object.cpp:
(KJS::):
(KJS::NumberInstance::NumberInstance):
(KJS::NumberPrototype::NumberPrototype):
(KJS::NumberProtoFunc::NumberProtoFunc):
(KJS::integer_part_noexp):
(KJS::intPow10):
(KJS::NumberProtoFunc::callAsFunction):
(KJS::NumberObjectImp::NumberObjectImp):
(KJS::NumberObjectImp::getOwnPropertySlot):
(KJS::NumberObjectImp::getValueProperty):
(KJS::NumberObjectImp::implementsConstruct):
(KJS::NumberObjectImp::construct):
(KJS::NumberObjectImp::callAsFunction):
* kjs/object.cpp:
(KJS::JSObject::put):
2007-12-27 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
ASSERT in JavaScriptCore while viewing WICD test case
http://bugs.webkit.org/show_bug.cgi?id=16626
* kjs/nodes.cpp:
(KJS::ForInNode::execute): move KJS_CHECK_EXCEPTION to proper place
2007-12-26 Jan Michael Alonzo <jmalonzo@unpluggable.com>
Reviewed by Alp Toker.
http://bugs.webkit.org/show_bug.cgi?id=16390
Use autotools or GNU make as the build system for the GTK port
* GNUmakefile.am: Added.
2007-12-25 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- Remove unnecessary redundant check from property setting
http://bugs.webkit.org/show_bug.cgi?id=16602
1.3% speedup on SunSpider.
* kjs/object.cpp:
(KJS::JSObject::put): Don't do canPut check when not needed; let
the PropertyMap handle it.
(KJS::JSObject::canPut): Don't check the static property
table. lookupPut does that already.
2007-12-24 Alp Toker <alp@atoker.com>
Fix builds that don't use AllInOneFile.cpp following breakage
introduced in r28973.
* kjs/grammar.y:
2007-12-24 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- Optimize variable declarations
http://bugs.webkit.org/show_bug.cgi?id=16585
3.5% speedup on SunSpider.
var statements now result in either assignments or empty statements.
This allows a couple of optimization opportunities:
- No need to branch at runtime to check if there is an initializer
- EmptyStatementNodes can be removed entirely (also done in this patch)
- Assignment expressions get properly optimized for local variables
This patch also includes some code cleanup:
- Most of the old VarStatement/VarDecl logic is now only used for const declarations,
thus it is renamed appropriately
- AssignExprNode is gone
* JavaScriptCore.exp:
* kjs/NodeInfo.h:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::SourceElements::append):
(KJS::ConstDeclNode::ConstDeclNode):
(KJS::ConstDeclNode::optimizeVariableAccess):
(KJS::ConstDeclNode::handleSlowCase):
(KJS::ConstDeclNode::evaluateSingle):
(KJS::ConstDeclNode::evaluate):
(KJS::ConstStatementNode::optimizeVariableAccess):
(KJS::ConstStatementNode::execute):
(KJS::VarStatementNode::optimizeVariableAccess):
(KJS::VarStatementNode::execute):
(KJS::ForInNode::ForInNode):
(KJS::ForInNode::optimizeVariableAccess):
(KJS::ForInNode::execute):
(KJS::FunctionBodyNode::initializeSymbolTable):
(KJS::ProgramNode::initializeSymbolTable):
(KJS::FunctionBodyNode::processDeclarations):
(KJS::ProgramNode::processDeclarations):
(KJS::EvalNode::processDeclarations):
* kjs/nodes.h:
(KJS::DeclarationStacks::):
(KJS::StatementNode::):
(KJS::ConstDeclNode::):
(KJS::ConstStatementNode::):
(KJS::EmptyStatementNode::):
(KJS::VarStatementNode::):
(KJS::ForNode::):
* kjs/nodes2string.cpp:
(KJS::ConstDeclNode::streamTo):
(KJS::ConstStatementNode::streamTo):
(KJS::ScopeNode::streamTo):
(KJS::VarStatementNode::streamTo):
(KJS::ForNode::streamTo):
(KJS::ForInNode::streamTo):
2007-12-21 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
* JavaScriptCore.exp: Remove unused symbol to prevent a weak external symbol
being generated in JavaScriptCore.framework.
2007-12-21 Darin Adler <darin@apple.com>
Requested by Maciej.
* kjs/nodes.h: Use the new NEVER_INLINE here and eliminate the old
KJS_NO_INLINE. We don't want to have two, and we figured it was better
to keep the one that's in WTF.
2007-12-21 Darin Adler <darin@apple.com>
Reviewed by Eric.
- http://bugs.webkit.org/show_bug.cgi?id=16561
remove debugger overhead from non-debugged JavaScript execution
1.022x as fast on SunSpider.
* JavaScriptCore.exp: Updated.
* kjs/NodeInfo.h: Renamed SourceElementsStub to SourceElements,
since that more accurately describes the role of this object, which
is a reference-counted wrapper for a Vector.
* kjs/Parser.cpp:
(KJS::Parser::didFinishParsing): Changed parameter type to SourceElements,
and use plain assignment instead of set.
* kjs/Parser.h: Changed parameter type of didFinishParsing to a
SourceElements. Also changed m_sourceElements; we now use a RefPtr instead
of an OwnPtr as well.
* kjs/grammar.y: Got rid of all the calls to release() on SourceElements.
That's now handed inside the constructors for various node types, since we now
use vector swapping instead.
* kjs/nodes.cpp:
(KJS::Node::rethrowException): Added NEVER_INLINE, because this was getting inlined
and we want exception handling out of the normal code flow.
(KJS::SourceElements::append): Moved here from the header. This now handles
creating a BreakpointCheckStatement for each statement in the debugger case.
That way we can get breakpoint handling without having it in every execute function.
(KJS::BreakpointCheckStatement::BreakpointCheckStatement): Added.
(KJS::BreakpointCheckStatement::execute): Added. Contains the code that was formerly
in the StatementNode::hitStatement function and the KJS_BREAKPOINT macro.
(KJS::BreakpointCheckStatement::streamTo): Added.
(KJS::ArgumentListNode::evaluateList): Use KJS_CHECKEXCEPTIONVOID since the return
type is void.
(KJS::VarStatementNode::execute): Removed KJS_BREAKPOINT.
(KJS::BlockNode::BlockNode): Changed parameter type to SourceElements.
Changed code to use release since the class now contains a vector rather than
a vector point.
(KJS::BlockNode::optimizeVariableAccess): Updated since member is now a vector
rather than a vector pointer.
(KJS::BlockNode::execute): Ditto.
(KJS::ExprStatementNode::execute): Removed KJS_BREAKPOINT.
(KJS::IfNode::execute): Ditto.
(KJS::IfElseNode::execute): Ditto.
(KJS::DoWhileNode::execute): Ditto.
(KJS::WhileNode::execute): Ditto.
(KJS::ContinueNode::execute): Ditto.
(KJS::BreakNode::execute): Ditto.
(KJS::ReturnNode::execute): Ditto.
(KJS::WithNode::execute): Ditto.
(KJS::CaseClauseNode::optimizeVariableAccess): Updated since member is now a vector
rather than a vector pointer.
(KJS::CaseClauseNode::executeStatements): Ditto.
(KJS::SwitchNode::execute): Removed KJS_BREAKPOINT.
(KJS::ThrowNode::execute): Ditto.
(KJS::TryNode::execute): Ditto.
(KJS::ScopeNode::ScopeNode): Changed parameter type to SourceElements.
(KJS::ProgramNode::ProgramNode): Ditto.
(KJS::EvalNode::EvalNode): Ditto.
(KJS::FunctionBodyNode::FunctionBodyNode): Ditto.
(KJS::ScopeNode::optimizeVariableAccess): Updated since member is now a vector
rather than a vector pointer.
* kjs/nodes.h: Removed hitStatement. Renamed SourceElements to StatementVector.
Renamed SourceElementsStub to SourceElements and made it derive from
ParserRefCounted rather than from Node, hold a vector rather than a pointer to
a vector, and changed the release function to swap with another vector rather
than the pointer idiom. Updated BlockNode and CaseClauseNode to hold actual
vectors instead of pointers to vectors. Added BreakpointCheckStatement.
* kjs/nodes2string.cpp:
(KJS::statementListStreamTo): Changed to work on a vector instead of a pointer
to a vector.
(KJS::BlockNode::streamTo): Ditto.
(KJS::CaseClauseNode::streamTo): Ditto.
* wtf/AlwaysInline.h: Added NEVER_INLINE.
* wtf/PassRefPtr.h: Tweaked formatting. Added clear() function that matches the
ones in OwnPtr and auto_ptr.
* wtf/RefPtr.h: Ditto.
2007-12-21 Darin Adler <darin@apple.com>
- fix broken regression tests
The broken tests were fast/js/do-while-expression-value.html and
fast/js/while-expression-value.html.
* kjs/nodes.cpp: Check in the correct version of this file. I had accidentally landed
an old version of my patch for bug 16471.
(KJS::statementListExecute): The logic here was backwards. Have to set the value
even for non-normal execution results.
2007-12-20 Alexey Proskuryakov <ap@webkit.org>
Windows build fix
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Copy npruntime_internal.h
to WebKitBuild.
2007-12-20 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Split IfNode into IfNode and IfElseNode for speedup.
http://bugs.webkit.org/show_bug.cgi?id=16470
SunSpider claims this is 1.003x as fast as before.
(This required running with --runs 15 to get consistent enough results to tell!)
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::IfNode::optimizeVariableAccess):
(KJS::IfNode::execute):
(KJS::IfNode::getDeclarations):
(KJS::IfElseNode::optimizeVariableAccess):
(KJS::IfElseNode::execute):
(KJS::IfElseNode::getDeclarations):
* kjs/nodes.h:
(KJS::IfNode::):
(KJS::IfElseNode::):
* kjs/nodes2string.cpp:
(KJS::IfNode::streamTo):
(KJS::IfElseNode::streamTo):
2007-12-20 Darin Adler <darin@apple.com>
Reviewed by Sam.
* wtf/OwnPtr.h:
(WTF::operator==): Added.
(WTF::operator!=): Added.
2007-12-20 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
AST optimization: Avoid NULL-checking ForNode's child nodes.
0.6% speedup on SunSpider.
This is a proof of concept patch that demonstrates how to optimize
grammar productions with optional components, like
for (optional; optional; optional) {
...
}
The parser emits NULL for an optional component that is not present.
Instead of checking for a NULL child at execution time, a node that
expects an optional component to be present more often than not checks
for a NULL child at construction time, and substitutes a viable
alternative node in its place.
(We'd like the parser to start emitting NULL a lot more once we teach
it to emit NULL for certain no-op productions like EmptyStatement and
VariableStatement, so, as a foundation, it's important for nodes with
NULL optional components to be fast.)
* kjs/Parser.cpp:
(KJS::Parser::didFinishParsing): Check for NULL SourceElements. Also,
moved didFinishParsing into the .cpp file because adding a branch while
it was in the header file caused a substantial and inexplicable
performance regression. (Did I mention that GCC is crazy?)
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::BlockNode::BlockNode): Check for NULL SourceElements.
(KJS::ForNode::optimizeVariableAccess): No need to check for NULL here.
(KJS::ForNode::execute): No need to check for NULL here.
* kjs/nodes.h:
(KJS::ForNode::): Check for NULL SourceElements. Substitute a TrueNode
because it's semantically harmless, and it evaluates to boolean in an
efficient manner.
2007-12-20 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Slight logic reordering in JSImmediate::from(double)
This gives a 0.6% improvement in SunSpider.
* kjs/JSImmediate.h:
(KJS::JSImmediate::from):
2007-12-20 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Fix major Array regression introduced by 28899.
SunSpider claims this is at least 1.37x as fast as pre-regression. :)
* kjs/array_instance.cpp: make Arrays fast again!
2007-12-20 Eric Seidel <eric@webkit.org>
Reviewed by Geoff, then re-rubber-stamped by Geoff after final search/replace and testing.
Small reworking of Date code for 4% speedup on Date tests (0.2% overall)
http://bugs.webkit.org/show_bug.cgi?id=16537
Make msToYear human-readable
Make msToDayInMonth slightly more readable and avoid recalculating msToYear
Remove use of isInLeapYear to avoid calling msToYear
Remove dayInYear call by changing msToDayInMonth to dayInMonthFromDayInYear
Remove more duplicate calls to dayInYear and getUTCOffset for further speedup
* kjs/DateMath.cpp:
(KJS::daysFrom1970ToYear):
(KJS::msToYear):
(KJS::monthFromDayInYear):
(KJS::checkMonth):
(KJS::dayInMonthFromDayInYear):
(KJS::dateToDayInYear):
(KJS::getDSTOffsetSimple):
(KJS::getDSTOffset):
(KJS::gregorianDateTimeToMS):
(KJS::msToGregorianDateTime):
2007-12-20 Rodney Dawes <dobey@wayofthemonkey.com>
Reviewed by Darin Adler.
Proxy includes of npruntime.h or npapi.h through npruntime_internal.h
Include stdio.h in npapi.h for the use of FILE with XP_UNIX defined
This is for building with X11, as some type and enum names conflict
with #define names in X11 headers.
http://bugs.webkit.org/show_bug.cgi?id=15669
* JavaScriptCore.xcodeproj/project.pbxproj:
* bindings/NP_jsobject.h:
* bindings/npapi.h:
* bindings/npruntime.cpp:
* bindings/npruntime_impl.h:
* bindings/npruntime_priv.h:
* bindings/npruntime_internal.h:
* bindings/testbindings.cpp:
* bindings/c/c_class.h:
* bindings/c/c_runtime.h:
* bindings/c/c_utility.h:
2007-12-20 Darin Adler <darin@apple.com>
- re-fix http://bugs.webkit.org/show_bug.cgi?id=16471
Completions need to be smaller (or not exist at all)
Same patch as last time with the test failures problem fixed.
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction): Make sure to check the completion
type from newExec to see if the execute raised an exception.
2007-12-20 Darin Adler <darin@apple.com>
- roll out that last change -- it was causing test failures;
I'll check it back in after fixing them
2007-12-20 Darin Adler <darin@apple.com>
Reviewed by Eric.
- http://bugs.webkit.org/show_bug.cgi?id=16471
Completions need to be smaller (or not exist at all)
SuSpider shows 2.4% speedup.
Stop using completions in the execution engine.
Instead, the completion type and label target are both
stored in the ExecState.
* API/JSContextRef.cpp: Removed unneeded include of "completion.h".
* bindings/runtime_method.cpp: Removed unused execute function.
* bindings/runtime_method.h: Ditto.
* kjs/ExecState.h: Added completionType, breakOrContinueTarget,
setCompletionType, setNormalCompletion, setBreakCompletion,
setContinueCompletion, setReturnValueCompletion, setThrowCompletion,
setInterruptedCompletion, m_completionType, and m_breakOrContinueTarget.
* kjs/completion.h: Removed constructor and getter for target
for break and continue from Completion. This class is now only
used for the public API to Interpreter and such.
* kjs/date_object.h: Removed unused execute function.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction): Removed some unneeded
exception processing. Updated to call the new execute function
and to get the completion type from the ExecState. Merged in
the execute function, which repeated some of the same logic and
was called only from here.
(KJS::GlobalFuncImp::callAsFunction): More of the same for eval.
* kjs/function.h: Removed execute.
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate): Added code to convert the result of
execut into a Completion.
* kjs/nodes.cpp:
(KJS::Node::setErrorCompletion): Renamed from createErrorCompletion.
Now sets the completion type in the ExecState.
(KJS::Node::rethrowException): Now sets the completion type in the
ExecState.
(KJS::StatementNode::hitStatement): Now sets the completion type in
the ExecState.
(KJS::VarStatementNode::execute): Updated to put completion type in
the ExecState instead of a Completion object.
(KJS::statementListExecute): Ditto. Also changed the for loop to use
indices instead of iterators.
(KJS::BlockNode::execute): Updated return type.
(KJS::EmptyStatementNode::execute): Updated to put completion type in
the ExecState instead of a Completion object.
(KJS::ExprStatementNode::execute): Ditto.
(KJS::IfNode::execute): Ditto.
(KJS::DoWhileNode::execute): Ditto. Also streamlined the logic a little
to make the normal case a little faster and moved the end outside the
loop so that "break" can do a break.
(KJS::WhileNode::execute): Ditto.
(KJS::ForNode::execute): Ditto.
(KJS::ForInNode::execute): Ditto.
(KJS::ContinueNode::execute): Updated to put completion type in
the ExecState instead of a Completion object.
(KJS::BreakNode::execute): Ditto.
(KJS::ReturnNode::execute): Ditto.
(KJS::WithNode::execute): Ditto.
(KJS::CaseClauseNode::executeStatements): Ditto. Also renamed to have
execute in its name to reflect the fact that it's a member of the same
family of functions.
(KJS::CaseBlockNode::executeBlock): Ditto.
(KJS::SwitchNode::execute): Ditto.
(KJS::LabelNode::execute): Ditto.
(KJS::ThrowNode::execute): Ditto.
(KJS::TryNode::execute): Ditto.
(KJS::ProgramNode::execute): Ditto.
(KJS::EvalNode::execute): Ditto.
(KJS::FunctionBodyNode::execute): Ditto.
(KJS::FuncDeclNode::execute): Ditto.
* kjs/nodes.h: Renamed setErrorCompletion to createErrorCompletion, made
hitStatement protected, changed return value of execute to a JSValue,
renamed evalStatements to executeStatements, and evalBlock to executeBlock.
* kjs/number_object.h: Removed unused execute function.
2007-12-20 Geoffrey Garen <ggaren@apple.com>
Added Radar number.
* kjs/nodes.cpp:
(KJS::ProgramNode::processDeclarations):
2007-12-20 Geoffrey Garen <ggaren@apple.com>
Linux build fix: config.h has to come first.
* kjs/error_object.cpp:
2007-12-19 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Optimized global access to global variables, using a symbol table.
SunSpider reports a 1.5% overall speedup, a 6.2% speedup on 3d-morph,
and a whopping 33.1% speedup on bitops-bitwise-and.
* API/JSCallbackObjectFunctions.h: Replaced calls to JSObject:: with
calls to Base::, since JSObject is not always our base class. This
was always a bug, but the bug is even more apparent after some of my
changes.
(KJS::::staticFunctionGetter): Replaced use of getDirect with call to
getOwnPropertySlot. Global declarations are no longer stored in the
property map, so a call to getDirect is insufficient for finding
override properties.
* API/testapi.c:
* API/testapi.js: Added test for the getDirect change mentioned above.
* kjs/ExecState.cpp:
* kjs/ExecState.h: Dialed back the optimization to store a direct
pointer to the localStorage buffer. One ExecState can grow the global
object's localStorage without another ExecState's knowledge, so
ExecState can't store a direct pointer to the localStorage buffer
unless/until we invent a way to update all the relevant ExecStates.
* kjs/JSGlobalObject.cpp: Inserted the symbol table into get and put
operations.
(KJS::JSGlobalObject::reset): Reset the symbol table and local storage,
too. Also, clear the property map here, removing the need for a
separate call.
* kjs/JSVariableObject.cpp:
* kjs/JSVariableObject.h: Added support for saving localStorage and the
symbol table to the back/forward cache, and restoring them.
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction): Renamed progNode to evalNode
because it's an EvalNode, not a ProgramNode.
* kjs/lookup.h:
(KJS::cacheGlobalObject): Replaced put with faster putDirect, since
that's how the rest of lookup.h works. putDirect is safe here because
cacheGlobalObject is only used for objects whose names are not valid
identifiers.
* kjs/nodes.cpp: The good stuff!
(KJS::EvalNode::processDeclarations): Replaced hasProperty with
the new hasOwnProperty, which is slightly faster.
* kjs/object.h: Nixed clearProperties because clear() does this job now.
* kjs/property_map.cpp:
* kjs/property_map.h: More back/forward cache support.
* wtf/Vector.h:
(WTF::::grow): Added fast non-branching grow function. I used it in
an earlier version of this patch, even though it's not used anymore.
2007-12-09 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Build fix for non-Mac platforms. Move NodeInfo into its own header so that the YYTYPE
declaration in grammar.h is able to declare members of that type.
* kjs/NodeInfo.h: Added.
(KJS::createNodeInfo):
(KJS::mergeDeclarationLists):
(KJS::appendToVarDeclarationList):
* kjs/grammar.y:
* kjs/lexer.cpp:
2007-12-19 Oliver Hunt <oliver@apple.com>
Make appendToVarDeclarationList static
RS=Weinig.
* kjs/grammar.y:
2007-12-18 Oliver Hunt <oliver@apple.com>
Remove dead code due to removal of post-parse declaration discovery.
RS=Geoff.
Due to the removal of the declaration discovery pass after parsing we
no longer need any of the logic used for that discovery.
* kjs/nodes.cpp:
(KJS::Node::Node):
(KJS::VarDeclNode::VarDeclNode):
(KJS::BlockNode::BlockNode):
(KJS::ForInNode::ForInNode):
(KJS::CaseBlockNode::CaseBlockNode):
* kjs/nodes.h:
(KJS::VarStatementNode::):
(KJS::IfNode::):
(KJS::DoWhileNode::):
(KJS::WhileNode::):
(KJS::WithNode::):
(KJS::LabelNode::):
(KJS::TryNode::):
(KJS::FuncDeclNode::):
(KJS::CaseClauseNode::):
(KJS::ClauseListNode::):
(KJS::SwitchNode::):
2007-12-18 Oliver Hunt <oliver@apple.com>
Replace post-parse pass to find declarations with logic in the parser itself
Reviewed by Geoff.
Instead of finding declarations in a pass following the initial parsing of
a program, we incorporate the logic directly into the parser. This lays
the groundwork for further optimisations (such as improving performance in
declaration expressions -- var x = y; -- to match that of standard assignment)
in addition to providing a 0.4% performance improvement in SunSpider.
* JavaScriptCore.exp:
* kjs/Parser.cpp:
(KJS::Parser::parse):
* kjs/Parser.h:
(KJS::Parser::didFinishParsing):
(KJS::Parser::parse):
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ParserTracked::ParserTracked):
(KJS::ParserTracked::~ParserTracked):
(KJS::ParserTracked::ref):
(KJS::ParserTracked::deref):
(KJS::ParserTracked::refcount):
(KJS::ParserTracked::clearNewTrackedObjects):
(KJS::Node::Node):
(KJS::ScopeNode::ScopeNode):
(KJS::ProgramNode::ProgramNode):
(KJS::EvalNode::EvalNode):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::FunctionBodyNode::initializeSymbolTable):
(KJS::FunctionBodyNode::processDeclarations):
* kjs/nodes.h:
(KJS::ParserTracked::):
(KJS::Node::):
(KJS::ScopeNode::):
2007-12-18 Xan Lopez <xan@gnome.org>
Reviewed by Geoff.
Fix http://bugs.webkit.org/show_bug.cgi?id=14521
Bug 14521: JavaScriptCore fails to build on Linux/PPC gcc 4.1.2
* wtf/TCSpinLock.h:
(TCMalloc_SpinLock::Unlock):
Use less strict memory operand constraint on inline asm generation.
PLATFORM(DARWIN) left unpatched due to Apple's GCC bug.
Patch by David Kilzer <ddkilzer@webkit.org>
2007-12-18 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Maciej Stachowiak.
Remove outdated and non-functioning project files for the Apollo port.
* JavaScriptCore.apolloproj: Removed.
2007-12-18 Darin Adler <darin@apple.com>
- fix Windows build
* pcre/pcre_exec.cpp:
(jsRegExpExecute): Change back from false/true to 0/1 -- I probably should not have
deleted MATCH_MATCH and MATCH_NOMATCH, but I'm going to leave them out.
2007-12-18 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16458
REGRESSION (r28164): regular expressions can now hang due to lack of a match limit
<rdar://problem/5636067>
Test: fast/regex/slow.html
Slows down SunSpider a bit (about 1.01x); filed a bug to follow up on that:
http://bugs.webkit.org/show_bug.cgi?id=16503
* pcre/pcre.h: Changed name of error code to not specifically mention "recursion".
* pcre/pcre_exec.cpp:
(match): Replaced the depth limit, MATCH_RECURSION_LIMIT, with a total match looping
limit, matchLimit. Also eliminated the constants for MATCH_MATCH and MATCH_NOMATCH,
since they are just true and false (1 and 0).
(jsRegExpExecute): More of the MATCH_MATCH change.
2007-12-17 Darin Adler <darin@apple.com>
- speculative build fix for non-gcc platforms
* pcre/pcre_exec.cpp: (match): Remove unused cases from return switch.
2007-12-16 Mark Rowe <mrowe@apple.com>
Speculative build fix for non-Mac platforms.
* pcre/pcre_compile.cpp: Include string.h for memset, memmove, etc.
2007-12-16 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=16438
- removed some more unused code
- changed quite a few more names to WebKit-style
- moved more things out of pcre_internal.h
- changed some indentation to WebKit-style
- improved design of the functions for reading and writing
2-byte values from the opcode stream (in pcre_internal.h)
* pcre/dftables.cpp:
(main): Added the kjs prefix a normal way in lieu of using macros.
* pcre/pcre_compile.cpp: Moved some definitions here from pcre_internal.h.
(errorText): Name changes, fewer typedefs.
(checkEscape): Ditto. Changed uppercase conversion to use toASCIIUpper.
(isCountedRepeat): Name change.
(readRepeatCounts): Name change.
(firstSignificantOpcode): Got rid of the use of OP_lengths, which is
very lightly used here. Hard-coded the length of OP_BRANUMBER.
(firstSignificantOpcodeSkippingAssertions): Ditto. Also changed to
use the advanceToEndOfBracket function.
(getOthercaseRange): Name changes.
(encodeUTF8): Ditto.
(compileBranch): Name changes. Removed unused after_manual_callout and
the code to handle it. Removed code to handle OP_ONCE since we never
emit this opcode. Changed to use advanceToEndOfBracket in more places.
(compileBracket): Name changes.
(branchIsAnchored): Removed code to handle OP_ONCE since we never emit
this opcode.
(bracketIsAnchored): Name changes.
(branchNeedsLineStart): More fo the same.
(bracketNeedsLineStart): Ditto.
(branchFindFirstAssertedCharacter): Removed OP_ONCE code.
(bracketFindFirstAssertedCharacter): More of the same.
(calculateCompiledPatternLengthAndFlags): Ditto.
(returnError): Name changes.
(jsRegExpCompile): Ditto.
* pcre/pcre_exec.cpp: Moved some definitions here from pcre_internal.h.
(matchRef): Updated names.
Improved macros to use the do { } while(0) idiom so they expand to single
statements rather than to blocks or multiple statements. And refeactored
the recursive match macros.
(MatchStack::pushNewFrame): Name changes.
(getUTF8CharAndIncrementLength): Name changes.
(match): Name changes. Removed the ONCE opcode.
(jsRegExpExecute): Name changes.
* pcre/pcre_internal.h: Removed quite a few unneeded includes. Rewrote
quite a few comments. Removed the macros that add kjs prefixes to the
functions with external linkage; instead renamed the functions. Removed
the unneeded typedefs pcre_uint16, pcre_uint32, and uschar. Removed the
dead and not-all-working code for LINK_SIZE values other than 2, although
we aim to keep the abstraction working. Removed the OP_LENGTHS macro.
(put2ByteValue): Replaces put2ByteOpcodeValueAtOffset.
(get2ByteValue): Replaces get2ByteOpcodeValueAtOffset.
(put2ByteValueAndAdvance): Replaces put2ByteOpcodeValueAtOffsetAndAdvance.
(putLinkValueAllowZero): Replaces putOpcodeValueAtOffset; doesn't do the
addition, since a comma is really no better than a plus sign. Added an
assertion to catch out of range values and changed the parameter type to
int rather than unsigned.
(getLinkValueAllowZero): Replaces getOpcodeValueAtOffset.
(putLinkValue): New function that most former callers of the
putOpcodeValueAtOffset function can use; asserts the value that is
being stored is non-zero and then calls putLinkValueAllowZero.
(getLinkValue): Ditto.
(putLinkValueAndAdvance): Replaces putOpcodeValueAtOffsetAndAdvance. No
caller was using an offset, which makes sense given the advancing behavior.
(putLinkValueAllowZeroAndAdvance): Ditto.
(isBracketOpcode): Added. For use in an assertion.
(advanceToEndOfBracket): Renamed from moveOpcodePtrPastAnyAlternateBranches,
and removed comments about how it's not well designed. This function takes
a pointer to the beginning of a bracket and advances to the end of the
bracket.
* pcre/pcre_tables.cpp: Updated names.
* pcre/pcre_ucp_searchfuncs.cpp:
(kjs_pcre_ucp_othercase): Ditto.
* pcre/pcre_xclass.cpp:
(getUTF8CharAndAdvancePointer): Ditto.
(kjs_pcre_xclass): Ditto.
* pcre/ucpinternal.h: Ditto.
* wtf/ASCIICType.h:
(WTF::isASCIIAlpha): Added an int overload, like the one we already have for
isASCIIDigit.
(WTF::isASCIIAlphanumeric): Ditto.
(WTF::isASCIIHexDigit): Ditto.
(WTF::isASCIILower): Ditto.
(WTF::isASCIISpace): Ditto.
(WTF::toASCIILower): Ditto.
(WTF::toASCIIUpper): Ditto.
2007-12-16 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=16459
REGRESSION: assertion failure with regexp with \B in a case-ignoring character range
<rdar://problem/5646361>
The problem was that \B was not handled properly in character classes.
Test: fast/js/regexp-overflow.html
* pcre/pcre_compile.cpp:
(check_escape): Added handling of ESC_b and ESC_B in character classes here.
Allows us to get rid of the handling of \b in character classes from all the
call sites that handle it separately and to handle \B properly as well.
(compileBranch): Remove the ESC_b handling, since it's not needed any more.
(calculateCompiledPatternLengthAndFlags): Ditto.
2007-12-16 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Fix http://bugs.webkit.org/show_bug.cgi?id=16448
Bug 16448: [GTK] Celtic Kane JavaScript performance on Array test is slow relative to Mac
* kjs/array_instance.cpp:
(KJS::compareByStringPairForQSort):
(KJS::ArrayInstance::sort): Convert JSValue's to strings once up front and then sort the
results. This avoids calling toString twice per comparison, but requires a temporary buffer
so we only use this approach in cases where the array being sorted is not too large.
2007-12-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler and Maciej Stachowiak.
More refactoring to support global variable optimization.
Changed SymbolTable to use RefPtr<UString::Rep> as its key instead of
UString::Rep*. With globals, the symbol table can outlast the
declaration node for any given symbol, so the symbol table needs to ref
its symbol names.
In support, specialized HashMaps with RefPtr keys to allow lookup
via raw pointer, avoiding refcount churn.
SunSpider reports a .6% speedup (prolly just noise).
* JavaScriptCore.vcproj/WTF/WTF.vcproj: Added new file: wtf/RefPtrHashMap.h
* JavaScriptCore.xcodeproj/project.pbxproj: ditto
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::getPropertyNames): Symbol table keys are RefPtrs now.
* kjs/SymbolTable.h: Modified key traits to match RefPtr. Added a
static Rep* for null, which helps compute the deletedValue() trait.
* wtf/HashMap.h: #include the RefPtr specialization so everyone can use it.
* wtf/RefPtrHashMap.h: Copied from wtf/HashMap.h. Added overloaded versions
of find(), contains(), get(), set(), add(), remove(), and take() that take
raw pointers as keys.
2007-12-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=16162
Problems with float parsing on Linux (locale-dependent parsing was used).
* kjs/dtoa.cpp: Removed USE_LOCALE to reduce future confusion.
* kjs/lexer.cpp: (KJS::Lexer::lex): Parse with kjs_strtod, not the system one.
2007-12-14 Alp Toker <alp@atoker.com>
Reviewed by Mark Rowe.
Enable the AllInOneFile.cpp optimization for the GTK+ port.
* JavaScriptCore.pri:
2007-12-14 Mark Rowe <mrowe@apple.com>
Unreviewed. Remove commented out fprintf's that were for debugging purposes only.
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_PageHeap::IncrementalScavenge):
2007-12-14 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Don't use the MADV_DONTNEED code path for now as it has no effect on Mac OS X and is
currently untested on other platforms.
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease): Return after releasing memory rather than potentially falling
through into another mechanism if multiple are supported.
2007-12-14 Alp Toker <alp@atoker.com>
Build fix for GTK+/Qt and ports that don't use AllInOneFile.cpp.
Include UnusedParam.h.
* wtf/TCSystemAlloc.cpp:
2007-12-14 Oliver Hunt <oliver@apple.com>
Reviewed by Stephanie.
Fix build on windows
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_PageHeap::IncrementalScavenge):
2007-12-14 Dan Bernstein <mitz@apple.com>
- try again to fix the Windows build
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease):
2007-12-14 Dan Bernstein <mitz@apple.com>
- try to fix the Windows build
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease):
2007-12-14 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej and Oliver.
Add final changes to make TCMalloc release memory to the system.
This results in a 0.4% regression against ToT, but this is offset
against the gains made by the original TCMalloc r38 merge - in fact
we retain around 0.3-0.4% progression overall.
* wtf/FastMalloc.cpp:
(WTF::InitSizeClasses):
(WTF::TCMalloc_PageHeap::IncrementalScavenge):
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease):
2007-12-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
- removed unnecessary includes of "Vector.h"
* wtf/HashMap.h:
(WTF::copyKeysToVector): Make the type of the vector be a template parameter.
This allows copying keys into a vector of a base class or one with an inline capacity.
(WTF::copyValuesToVector): Ditto.
* wtf/HashSet.h:
(WTF::copyToVector): Ditto.
2007-12-14 Anders Carlsson <andersca@apple.com>
Reviewed by Darin and Geoff.
<rdar://problem/5619295>
REGRESSION: 303-304: Embedded YouTube video fails to render- JS errors (16150) (Flash 9)
Get rid of unnecessary and incorrect security checks for plug-ins accessing JavaScript objects.
The way this used to work was that each NPObject that wrapped a JSObject would have a root object
corresponding to the frame object (used for managing the lifecycle) and an origin root object (used for
doing security checks).
This would prevent a plug-in from accessing a frame's window object if it's security origin was different
(some parts of the window, such as the location object, can be accessed from frames with different security
origins, and those checks are being done in WebCore).
Also, if a plug-in were to access a window object of a frame that later went away, it could lead to that
Window JSObject being garbage collected and the NPObject pointing to freed memory.
How this works now is that there is no origin root object anymore, and all NPObject wrappers that are created
for a plug-in will have the root object of the containing frame of that plug-in.
* bindings/NP_jsobject.cpp:
(jsDeallocate):
Don't free the origin root object.
(_NPN_CreateScriptObject):
Remove the origin root object parameter.
(_NPN_InvokeDefault):
(_NPN_Invoke):