blob: 9f4d93cabab3e79de23d34af1ed25ff2983861bc [file] [log] [blame]
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):
(_NPN_Evaluate):
(_NPN_GetProperty):
(_NPN_SetProperty):
(_NPN_RemoveProperty):
(_NPN_HasProperty):
(_NPN_HasMethod):
(_NPN_Enumerate):
Get rid of all security checks.
* bindings/NP_jsobject.h:
Remove originRootObject from the JavaScriptObject struct.
* bindings/c/c_utility.cpp:
(KJS::Bindings::convertValueToNPVariant):
Always use the root object from the ExecState.
2007-12-13 Steve Falkenburg <sfalken@apple.com>
Move source file generation into its own vcproj to fix build dependencies.
Reviewed by Adam.
* JavaScriptCore.vcproj/JavaScriptCore.sln:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Added.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Added.
* JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
2007-12-13 Alp Toker <alp@atoker.com>
http://bugs.webkit.org/show_bug.cgi?id=16406
[Gtk] JavaScriptCore needs -lpthread
Build fix for Debian and any other platforms that don't implicitly
link to pthread.
Link to pthread on non-Windows platforms until this dependency is
removed from JSC.
2007-12-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Build fix: Note some variables that are used only for ASSERTs.
* API/testapi.c:
(Base_finalize):
(globalObject_initialize):
(testInitializeFinalize):
2007-12-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed: All JS tests crash on Windows.
NDEBUG wasn't defined when compiling testkjs in release builds, so the
HashTable definition in HashTable.h included an extra data member.
The solution was to add NDEBUG to the release testkjs configuration on
Windows and Mac.
For giggles, I also added other missing #defines to testkjs on Windows.
* Configurations/Base.xcconfig:
* Configurations/JavaScriptCore.xcconfig:
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/testkjs.cpp:
(main):
2007-12-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed bogus ASSERT.
ASSERT should only be used when we know that a code path will not be
taken. This code path is taken often during the jsFunFuzz test.
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
2007-12-11 Darin Adler <darin@apple.com>
* wtf/unicode/qt4/UnicodeQt4.h: Try to fix Qt build by adding U16_IS_SINGLE.
2007-12-10 Darin Adler <darin@apple.com>
Reviewed by Sam Weinig.
- fix http://bugs.webkit.org/show_bug.cgi?id=16379
REGRESSION(r28525): Failures in http/tests/xmlhttprequest/response-encoding.html and
fast/dom/xmlhttprequest-html-response-encoding.html
and <rdar://problem/5640230> REGRESSION (306A4-ToT): Access violation in PCRE function
find_firstassertedchar
Test: fast/js/regexp-find-first-asserted.html
* pcre/pcre_compile.cpp:
(compileBracket): Take out unnecessary initialization of out parameters.
(branchFindFirstAssertedCharacter): Added. Broke out the half of the function that handles
a branch.
(bracketFindFirstAssertedCharacter): Renamed from find_firstassertedchar. Also removed the
options parameter -- the caller can handle the options.
(jsRegExpCompile): Changed call site to call the appropriate bracket or branch version of
the find_firstassertedchar function. Also put the REQ_IGNORE_CASE code here instead of
passing in the options.
2007-12-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Split this:
FunctionBodyNode
^
|
ProgramNode
into this:
ScopeNode
^ ^ ^
| | |
FunctionBodyNode ProgramNode EvalNode
in preparation for specializing each class more while optimizing global
variable access.
Also removed some cruft from the FunctionBodyNode interface to simplify
things.
SunSpider says this patch is a .8% speedup, which seems reasonable,
since it eliminates a few branches and adds KJS_FAST_CALL in a few
places.
Layout tests and JS tests pass. Also, this baby builds on Windows! (Qt
mileage may vary...)
2007-12-10 Geoffrey Garen <ggaren@apple.com>
RS by Mark Rowe.
Mac build fix: added some exported symbols, now that Parser::parse is
defined in the header.
* JavaScriptCore.exp:
2007-12-10 Sam Weinig <sam@webkit.org>
Build fix.
Template methods need to be in the header.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* kjs/Parser.cpp:
* kjs/Parser.h:
(KJS::Parser::parse):
2007-12-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Merged different implementations of Parser::parse into a single,
templatized implementation, in preparation for adding yet another
implementation for "eval" code.
JS and layout tests pass.
2007-12-10 Timothy Hatcher <timothy@apple.com>
Reviewed by Mark Rowe
<rdar://problem/5639463> Bundle versions on Tiger should be 4523.x not 523.x
* Configurations/Version.xcconfig: Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR,
so assume Tiger and use a 4 for the SYSTEM_VERSION_PREFIX.
2007-12-10 Mark Rowe <mrowe@apple.com>
Tiger build fix.
* kjs/grammar.y: Use @1 and @0 in place of @$ where Tiger's bison chokes.
2007-12-10 Darin Adler <darin@apple.com>
Reviewed by Mark Rowe.
- fix http://bugs.webkit.org/show_bug.cgi?id=16375
REGRESSION: Safari crashes on quit
Probably a debug-only issue.
* kjs/Parser.cpp:
(KJS::parser): Create the parser and never destroy it by using a pointer instead
of a global object.
2007-12-09 Darin Adler <darin@apple.com>
Reviewed by Sam Weinig.
- fix http://bugs.webkit.org/show_bug.cgi?id=16369
REGRESSION (r28525): regular expression tests failing due to bad firstByte optimization
* pcre/pcre_compile.cpp: Changed some names to use interCaps intead of under_scores.
(branchIsAnchored): Broke is_anchored into two separate functions; this one works on a
branch and the other on an anchor. The old function would only work on a bracket.
Also removed unneeded parameters; the anchored check does not require the bracket
map or the options any more because we have a reduced set of features.
(bracketIsAnchored): Ditto.
(branchNeedsLineStart): Broke canApplyFirstCharOptimization into two functions and gave
both a better name. This is the function that was returning the wrong value. The failure
was beacuse the old function would only work on a bracket.
(bracketNeedsLineStart): Ditto.
(jsRegExpCompile): Changed to call the appropriate branch or bracket flavor of the
functions based on whether we compiled an outer bracket. Also removed inaccurate comments
and unneeded parameters.
- other small changes
* pcre/pcre.h: Renumbered error codes, in a logical order. First, normal failure, then
the recursion limit, then running out of memory, and finally an unexpected internal error.
* pcre/pcre_exec.cpp: Fixed indentation.
(jsRegExpExecute): Corrected an inaccurate comment.
2007-12-09 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=16370
REGRESSION (r28540): source URL and line number no longer set for outer function/programs
Test: fast/js/exception-linenums-in-html-1.html
Test: fast/js/exception-linenums-in-html-2.html
Test: fast/js/exception-linenums.html
By the time the ProgramNode was constructed, the source URL was empty.
* kjs/Parser.cpp:
(KJS::Parser::parseProgram): Added code to set and clear m_sourceURL, which is now
handled here instead of in the lexer; it needs to still be set when we create the
program node. Call setLoc to set the first and last line number.
(KJS::Parser::parseFunctionBody): Ditto, but for the body.
(KJS::Parser::parse): Removed the sourceURL argument.
* kjs/Parser.h: Added sourceURL(), m_sourceURL, and m_lastLine. Added a lastLine
parameter to didFinishParsing, since the bison grammar knows the last line number
and we otherwise do not know it. Removed the sourceURL parameter from parse, since
that's now handled at a higher level.
* kjs/grammar.y: Pass the last line number to didFinishParsing.
* kjs/lexer.cpp:
(KJS::Lexer::setCode): Removed the sourceURL argument and the code to set m_sourceURL.
(KJS::Lexer::clear): Ditto.
* kjs/lexer.h: More of the same.
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::FunctionBodyNode): Get the source URL from the parser rather
than from the lexer. Removed unneeded call to setLoc, since the line numbers already
both default to -1.
2007-12-08 Oliver Hunt <oliver@apple.com>
Reviewed by Sam W.
Split the ENABLE_SVG_EXPERIMENTAL_FEATURES flag into separate flags.
Fixes <rdar://problem/5620249> Must disable SVG animation
<rdar://problem/5612772> Disable SVG filters on Mac to match Windows behavior
Minor config changes.
* Configurations/JavaScriptCore.xcconfig:
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-12-07 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
- Rename isSafeScript to allowsAccessFrom.
* bindings/NP_jsobject.cpp:
(_isSafeScript):
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::allowsAccessFrom): Reverse caller/argument of allowsAccessFrom to match
the new call.
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Refactored variable access optimization: Removed the assumption that
the FunctionBodyNode holds the symbol table.
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/nodes.cpp:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/interpreter.cpp:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/grammar.y:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/function_object.cpp:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed crash seen running layout tests.
Reverted a change I made earlier today. Added a comment to try to
discourage myself from making this mistake a third time.
* kjs/function.cpp:
(KJS::ActivationImp::mark):
* kjs/function.h:
(KJS::ActivationImp::ActivationImpData::ActivationImpData):
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Refactored parsing of global code: Removed the assumption that
ProgramNode inherits from FunctionBodyNode from the parser.
* kjs/Parser.cpp:
(KJS::Parser::parseProgram):
(KJS::Parser::parseFunctionBody):
(KJS::Parser::parse):
* kjs/Parser.h:
(KJS::Parser::didFinishParsing):
* kjs/function.cpp:
* kjs/grammar.y:
* kjs/nodes.h:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added JSVariableObject.cpp to the .pri file.
* JavaScriptCore.pri:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/function.cpp:
2007-12-07 Steve Falkenburg <sfalken@apple.com>
Re-named our B&I flag from BUILDBOT to PRODUCTION.
Reviewed by Sam Weinig.
* JavaScriptCore.vcproj/JavaScriptCore.make:
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: removed stray name qualification.
* kjs/function.h:
(KJS::ActivationImp::ActivationImp):
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: moved functions with qualified names outside of class
declaration.
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableGet):
(KJS::JSVariableObject::symbolTablePut):
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Next step in refactoring JSGlobalObject: Added JSVariableObject class,
and factored symbol-table-related code into it. (JSGlobalObject doesn't
use the symbol table code yet, though.)
Layout and JS tests, and testapi, pass. SunSpider reports no regression.
2007-12-07 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16185
jsRegExpCompile should not add implicit non-capturing bracket
While this does not make SunSpider faster, it will make many regular
expressions a bit faster.
* pcre/pcre_compile.cpp: Moved CompileData struct in here from the
header since it's private to this file.
(compile_branch): Updated for function name change.
(compile_bracket): Renamed from compile_regex, since, for one thing,
this does not compile an entire regular expression.
(calculateCompiledPatternLengthAndFlags): Removed unused item_count
local variable. Renamed CompileData to cd instead of compile_block
to be consistent with other functions. Added code to set the
needOuterBracket flag if there's at least one "|" at the outer level.
(jsRegExpCompile): Renamed CompileData to cd instead of compile_block
to be consistent with other functions. Removed unneeded "size" field
from the compiled regular expression. If no outer bracket is needed,
then use compile_branch to compile the regular expression.
* pcre/pcre_internal.h: Removed the CompileData struct, which is now
private to pcre_compile.cpp. Removed the size member from JSRegExp.
2007-12-06 Kevin Ollivier <kevino@theolliviers.com>
MSVC7 build fix due to a compiler bug with placement new and/or
templates and casting.
Reviewed by Darin Adler.
* wtf/Vector.h:
(WTF::::append):
2007-12-06 Darin Adler <darin@apple.com>
Reviewed by Eric Seidel.
- fix http://bugs.webkit.org/show_bug.cgi?id=16321
new RegExp("[\u0097]{4,6}", "gmy") crashes in DEBUG builds
<rdar://problem/5632992>
Test: fast/js/regexp-oveflow.html
* pcre/pcre_compile.cpp:
(calculateCompiledPatternLengthAndFlags): In the case where a single character
character class is optimized to not use a character class at all, the preflight
code was not setting the lastitemlength variable.
2007-12-05 Mark Rowe <mrowe@apple.com>
Qt Windows build fix. Include the time-related headers in the correct place.
* kjs/JSGlobalObject.cpp:
* kjs/interpreter.cpp:
2007-12-05 Darin Adler <darin@apple.com>
Not reviewed; just undoing a previous commit.
- remove earlier incorrect fix for http://bugs.webkit.org/show_bug.cgi?id=16220
<rdar://problem/5625221> Crash opening www.news.com (CNet)
The real bug was the backwards ?: in the compile function, which Geoff just
fixed. Rolling out the incorrect earlier fix.
* pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags): Take out
the unneeded preflight change. The regression test proves this is still working
fine, so the bug remains fixed.
2007-12-01 Mark Rowe <mrowe@apple.com>
Build fix. Include headers before trying to use the things that they declare.
* kjs/JSImmediate.cpp:
* kjs/nodes.cpp:
* kjs/object.cpp:
* kjs/object_object.cpp:
* kjs/regexp_object.cpp:
* kjs/string_object.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added some #includes.
* kjs/JSImmediate.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added some #includes.
* kjs/JSGlobalObject.cpp:
* kjs/JSImmediate.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: Fixed #include spelling.
* kjs/debugger.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/debugger.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added a forward declaration.
* kjs/debugger.h:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added an #include.
* kjs/error_object.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added an #include.
* kjs/bool_object.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Third step in refactoring JSGlobalObject: Moved data members and
functions accessing data members from Interpreter to JSGlobalObject.
Changed Interpreter member functions to static functions.
This resolves a bug in global object bootstrapping, where the global
ExecState could be used when uninitialized.
This is a big change, but it's mostly code motion and renaming.
Layout and JS tests, and testjsglue and testapi, pass. SunSpider reports
a .7% regression, but Shark sees no difference related to this patch,
and SunSpider reported a .7% speedup from an earlier step in this
refactoring, so I think it's fair to call that a wash.
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler. (Or vice versa.)
Fixed ASSERT during run-javascriptcore-tests. (Darin just added the
ASSERT, but the bug wasn't new.)
* pcre/pcre_compile.cpp:
(compile_branch): The ?: operator here was backwards, causing us to
execute the loop too many times, adding stray KET opcodes to the
compiled regular expression.
2007-12-05 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff.
- Wait until local variable data is fully constructed before notifying the debugger of entering
or leaving a call frame.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::execute):
2007-12-05 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver.
Build fix for GCC 4.2. Cast via a union to avoid strict-aliasing issues.
* wtf/FastMalloc.cpp:
(WTF::):
(WTF::getPageHeap):
2007-12-05 Mark Rowe <mrowe@apple.com>
Reviewed by Darin.
Fix testkjs in 64-bit.
When built for 64-bit the TCMalloc spin lock uses pthread mutexes rather than a custom spin lock
implemented in assembly. If we fail to initialize the pthread mutex, attempts to lock or unlock
it will fail and trigger a call to abort.
* wtf/FastMalloc.cpp: Initialize the spin lock so that we can later lock and unlock it.
* wtf/TCSpinLock.h: Add an Init method to the optimised spin lock.
2007-12-04 Oliver Hunt <oliver@apple.com>
Reviewed by NOBODY (Build fix).
Fix gtk build.
* wtf/TCSystemAlloc.cpp:
2007-12-03 Oliver Hunt <oliver@apple.com>
Reviewed by Mark Rowe and Geoff Garen.
Merge TCMalloc r38
It also result in a performance progression between 0.5% and
0.9% depending on the test, however most if not all of this
gain will be consumed by the overhead involved in the later
change to release memory to the system.
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/FastMalloc.cpp:
(WTF::KernelSupportsTLS):
(WTF::CheckIfKernelSupportsTLS):
(WTF::):
(WTF::ClassIndex):
(WTF::SLL_Next):
(WTF::SLL_SetNext):
(WTF::SLL_Push):
(WTF::SLL_Pop):
(WTF::SLL_PopRange):
(WTF::SLL_PushRange):
(WTF::SLL_Size):
(WTF::SizeClass):
(WTF::ByteSizeForClass):
(WTF::NumMoveSize):
(WTF::InitSizeClasses):
(WTF::AllocationSize):
(WTF::TCMalloc_PageHeap::GetSizeClassIfCached):
(WTF::TCMalloc_PageHeap::CacheSizeClass):
(WTF::TCMalloc_PageHeap::init):
(WTF::TCMalloc_PageHeap::New):
(WTF::TCMalloc_PageHeap::AllocLarge):
(WTF::TCMalloc_PageHeap::Carve):
(WTF::TCMalloc_PageHeap::Delete):
(WTF::TCMalloc_PageHeap::IncrementalScavenge):
(WTF::PagesToMB):
(WTF::TCMalloc_PageHeap::Dump):
(WTF::TCMalloc_PageHeap::GrowHeap):
(WTF::TCMalloc_PageHeap::Check):
(WTF::ReleaseFreeList):
(WTF::TCMalloc_PageHeap::ReleaseFreePages):
(WTF::TCMalloc_ThreadCache_FreeList::Push):
(WTF::TCMalloc_ThreadCache_FreeList::PushRange):
(WTF::TCMalloc_ThreadCache_FreeList::PopRange):
(WTF::TCMalloc_ThreadCache_FreeList::Pop):
(WTF::TCMalloc_Central_FreeList::length):
(WTF::TCMalloc_Central_FreeList::tc_length):
(WTF::TCMalloc_Central_FreeList::Init):
(WTF::TCMalloc_Central_FreeList::ReleaseListToSpans):
(WTF::TCMalloc_Central_FreeList::EvictRandomSizeClass):
(WTF::TCMalloc_Central_FreeList::MakeCacheSpace):
(WTF::TCMalloc_Central_FreeList::ShrinkCache):
(WTF::TCMalloc_Central_FreeList::InsertRange):
(WTF::TCMalloc_Central_FreeList::RemoveRange):
(WTF::TCMalloc_Central_FreeList::FetchFromSpansSafe):
(WTF::TCMalloc_Central_FreeList::Populate):
(WTF::TCMalloc_ThreadCache::Init):
(WTF::TCMalloc_ThreadCache::Cleanup):
(WTF::TCMalloc_ThreadCache::Allocate):
(WTF::TCMalloc_ThreadCache::Deallocate):
(WTF::TCMalloc_ThreadCache::FetchFromCentralCache):
(WTF::TCMalloc_ThreadCache::ReleaseToCentralCache):
(WTF::TCMalloc_ThreadCache::Scavenge):
(WTF::TCMalloc_ThreadCache::PickNextSample):
(WTF::TCMalloc_ThreadCache::NewHeap):
(WTF::TCMalloc_ThreadCache::GetThreadHeap):
(WTF::TCMalloc_ThreadCache::GetCache):
(WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
(WTF::TCMalloc_ThreadCache::InitTSD):
(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
(WTF::TCMallocStats::ExtractStats):
(WTF::TCMallocStats::DumpStats):
(WTF::TCMallocStats::DumpStackTraces):
(WTF::TCMallocStats::TCMallocImplementation::MarkThreadIdle):
(WTF::TCMallocStats::TCMallocImplementation::ReleaseFreeMemory):
(WTF::TCMallocStats::TCMallocGuard::TCMallocGuard):
(WTF::TCMallocStats::TCMallocGuard::~TCMallocGuard):
(WTF::TCMallocStats::DoSampledAllocation):
(WTF::TCMallocStats::CheckCachedSizeClass):
(WTF::TCMallocStats::CheckedMallocResult):
(WTF::TCMallocStats::SpanToMallocResult):
(WTF::TCMallocStats::do_malloc):
(WTF::TCMallocStats::do_free):
(WTF::TCMallocStats::do_memalign):
(WTF::TCMallocStats::do_malloc_stats):
(WTF::TCMallocStats::do_mallopt):
(WTF::TCMallocStats::do_mallinfo):
(WTF::TCMallocStats::realloc):
(WTF::TCMallocStats::cpp_alloc):
(WTF::TCMallocStats::operator new):
(WTF::TCMallocStats::):
(WTF::TCMallocStats::operator new[]):
(WTF::TCMallocStats::malloc_stats):
(WTF::TCMallocStats::mallopt):
(WTF::TCMallocStats::mallinfo):
* wtf/TCPackedCache.h: Added.
(PackedCache::PackedCache):
(PackedCache::Put):
(PackedCache::Has):
(PackedCache::GetOrDefault):
(PackedCache::Clear):
(PackedCache::EntryToValue):
(PackedCache::EntryToUpper):
(PackedCache::KeyToUpper):
(PackedCache::UpperToPartialKey):
(PackedCache::Hash):
(PackedCache::KeyMatch):
* wtf/TCPageMap.h:
(TCMalloc_PageMap2::PreallocateMoreMemory):
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease):
* wtf/TCSystemAlloc.h:
2007-12-04 Anders Carlsson <andersca@apple.com>
Reviewed by Sam.
Make isSafeScript const.
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::isSafeScript):
2007-12-04 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix first part of http://bugs.webkit.org/show_bug.cgi?id=16220
<rdar://problem/5625221> Crash opening www.news.com (CNet)
Test: fast/js/regexp-overflow.html
* pcre/pcre_compile.cpp:
(calculateCompiledPatternLengthAndFlags): Add room for the additional BRA/KET that
was generated in the compile code but not taken into account here.
2007-12-03 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=15618
<rdar://problem/5619353> REGRESSION: Stack overflow/crash in KJS::equal (15618)
Test: fast/js/recursion-limit-equal.html
* kjs/operations.cpp: (KJS::equal): Check the exception from toPrimitive.
2007-12-03 Dan Bernstein <mitz@apple.com>
- fix a copy-and-paste-o
* bindings/npruntime.cpp:
(_NPN_GetIntIdentifier):
2007-12-03 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
- fix an ASSERT when getIntIdentifier is called with 0 or -1
* bindings/npruntime.cpp:
(_NPN_GetIntIdentifier): We cannot use the hashmap for 0 and -1 since
they are the empty value and the deleted value. Instead, keep the
identifiers for those two integers in a static array.
2007-12-02 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- fix http://bugs.webkit.org/show_bug.cgi?id=15848
<rdar://problem/5619330> REGRESSION: Assertion failure viewing comments page on digg.com
Test: fast/js/sparse-array.html
* kjs/array_instance.cpp:
(KJS::ArrayInstance::inlineGetOwnPropertySlot): Check sparse array cutoff before looking
in hash map. Can't avoid the branch because we can't look for 0 in the hash.
(KJS::ArrayInstance::deleteProperty): Ditto.
2007-12-02 Geoffrey Garen <ggaren@apple.com>
Build fix: added an #include.
* kjs/collector.cpp:
2007-12-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Second step in refactoring JSGlobalObject: moved virtual functions from
Interpreter to JSGlobalObject.
Layout and JS tests pass. SunSpider reports a .7% speedup -- don't
believe his lies.
2007-12-01 Alp Toker <alp@atoker.com>
Reviewed by Adam Roben.
http://bugs.webkit.org/show_bug.cgi?id=16228
kJSClassDefinitionEmpty is not exported with JS_EXPORT
Add JS_EXPORT to kJSClassDefinitionEmpty.
Make the gcc compiler check take precedence over the WIN32||_WIN32
check to ensure that symbols are exported on Windows when using gcc.
Add a TODO referencing the bug about JS_EXPORT in the Win build
(http://bugs.webkit.org/show_bug.cgi?id=16227)
Don't define JS_EXPORT as 'extern' when the compiler is unknown since
it would result in the incorrect expansion:
extern extern const JSClassDefinition kJSClassDefinitionEmpty;
(This was something we inherited from CFBase.h that doesn't make sense
for JSBase.h)
* API/JSBase.h:
* API/JSObjectRef.h:
2007-11-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Reversed the ownership relationship between Interpreter and JSGlobalObject.
Now, the JSGlobalObject owns the Interpreter, and top-level objects
that need the two to persist just protect the JSGlobalObject from GC.
Global object bootstrapping looks a little odd right now, but it will
make much more sense soon, after further rounds of refactoring.
* bindings/runtime_root.h: Made this class inherit from RefCounted,
to avoid code duplication.
* kjs/collector.cpp:
(KJS::Collector::collect): No need to give special GC treatment to
Interpreters, since we mark their global objects, which mark them.
* kjs/interpreter.cpp:
(KJS::Interpreter::mark): No need to mark our global object, since it
marks us.
* kjs/interpreter.h: Don't inherit from RefCounted -- JSGlobalObject
owns us directly.
* kjs/testkjs.cpp: Modified to follow the new rules.
(createGlobalObject):
(runWithScripts):
2007-11-30 Brent Fulgham <bfulgham@gmail.com>
Reviewed by Eric.
* ChangeLog:
* pcre/pcre_compile.cpp:
(compile_branch):
2007-11-30 Eric Seidel <eric@webkit.org>
No review, build fix only.
Fix uninitialized var warnings in release build.
* JavaScriptCore.xcodeproj/project.pbxproj:
* pcre/pcre_compile.cpp:
(compile_regex):
2007-11-30 Darin Adler <darin@apple.com>
Reviewed by Adam Roben.
- fix http://bugs.webkit.org/show_bug.cgi?id=16207
JavaScript regular expressions should match UTF-16 code units rather than characters
SunSpider says this is 5.5% faster on the regexp test, 0.4% faste overall.
Test: fast/js/regexp-non-bmp.html
Renamed ANY_CHAR to NOT_NEWLINE to more-accurately reflect its meaning.
* pcre/pcre_compile.cpp:
(compile_branch): Removed calls to the UTF-16 character accessor functions, replacing
them with simple pointer dereferences in some cases, and no code at all in others.
(calculateCompiledPatternLengthAndFlags): Ditto.
* pcre/pcre_exec.cpp:
(match): Fixed indentation of some case labels (including all the BEGIN_OPCODE).
Removed calls to the UTF-16 character accessor functions, replacing them with simple
pointer dereferences in some cases, and no code at all in others. Also removed some
explicit UTF-16 support code in a few cases. Removed the unneeded "UTF-8" code path
in the ANY_CHAR repeat code, and in another case, eliminated the code to check against
end_subject in because it is already done outside the loop.
(jsRegExpExecute):
* pcre/pcre_internal.h: Removed all the UTF-16 helper functions.
2007-11-30 Eric Seidel <eric@webkit.org>
Reviewed by darin.
PCRE crashes under GuardMalloc
http://bugs.webkit.org/show_bug.cgi?id=16127
check against patternEnd to make sure we don't walk off the end of the string
* pcre/pcre_compile.cpp:
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
2007-11-30 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Fix layout test regressions caused by r28186
http://bugs.webkit.org/show_bug.cgi?id=16195
change first_byte and req_byte back to shorts instead of chars
(I think PCRE stuffs information in the high bits)
* pcre/pcre_internal.h:
2007-11-29 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej and Darin.
Make the JS collector work with multiple threads
Under heavy contention it was possible the GC to suspend other
threads inside the pthread spinlock, which could lead to the GC
thread blocking on the pthread spinlock itself.
We now determine and store each thread's stack base when it is
registered, thus removing the need for any calls to pthread_get_stackaddr_np
that needed the pthread spinlock.
* kjs/collector.cpp:
(KJS::Collector::Thread::Thread):
(KJS::Collector::registerThread):
(KJS::Collector::markOtherThreadConservatively):
2007-11-29 Adam Roben <aroben@apple.com>
Windows build fix
Removed some unreachable code (ironically, the code was some
ASSERT_NOT_REACHED()s).
* pcre/pcre_compile.cpp:
(compile_branch):
* pcre/pcre_exec.cpp:
(match):
2007-11-29 Eric Seidel <eric@webkit.org>
Reviewed by Mark Rowe.
Fix for --guard crash of fast/js/regexp-charclass-crash introduced by r28151.
* pcre/pcre_compile.cpp:
(is_anchored):
2007-11-28 Mark Rowe <mrowe@apple.com>
Gtk build fix. Rubber-stamped by Eric.
* pcre/pcre_exec.cpp:
(match): Add braces around the body of the case statement to prevent
wanings about jumps across the initialization of a variable.
2007-11-29 Eric Seidel <eric@webkit.org>
Reviewed by Mark Rowe.
Attempt to fix non-mac builds after PCRE cleanup.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCoreSources.bkl:
* pcre/pcre.pri:
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Centralize code for subjectPtr adjustments using inlines, only ever check for a single
trailing surrogate (as UTF16 only allows one), possibly fix PCRE bugs involving char
classes and garbled UTF16 strings.
* pcre/pcre_exec.cpp:
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
(getPreviousChar):
(movePtrToPreviousChar):
(movePtrToNextChar):
(movePtrToStartOfCurrentChar):
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
change getChar* functions to return result and push 'c' into local scopes for clarity
* pcre/pcre_compile.cpp:
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
(getChar):
(getCharAndAdvance):
(getCharAndLength):
(getCharAndAdvanceIfSurrogate):
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Comment cleanup
* pcre/pcre_exec.cpp:
(match):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Further cleanups to calculateCompiledPatternLengthAndFlags
* pcre/pcre_compile.cpp:
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Give consistent naming to the RegExp options/compile flags
* pcre/pcre_compile.cpp:
(compile_branch):
(is_anchored):
(find_firstassertedchar):
(printCompiledRegExp):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Pull first_byte and req_byte optimizations out into separate static funtions, SunSpider reported this as a win.
* pcre/pcre_exec.cpp:
(tryFirstByteOptimization):
(tryRequiredByteOptimization):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
give PCRE_MULTILINE a better name: OptionMatchAcrossMultipleLines
* pcre/pcre_compile.cpp:
(compile_branch):
(is_anchored):
(printCompiledRegExp):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
Deprecate jsRegExpExecute's offset-vector fallback code
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Make cur_is_word and prev_is_word locals, and change OP_ANY to OP_ANY_CHAR for clarity
* pcre/pcre_compile.cpp:
(find_fixedlength):
(compile_branch):
(canApplyFirstCharOptimization):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Mitz & Maciej.
Change _NC operators to use _IGNORING_CASE for clarity
* pcre/pcre_compile.cpp:
(find_fixedlength):
(compile_branch):
(find_firstassertedchar):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Mitz.
Remove branch from return
* pcre/pcre_compile.cpp:
(compile_branch):
* pcre/pcre_exec.cpp:
(match):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Add repeatInformationFromInstructionOffset inline
* pcre/pcre_exec.cpp:
(repeatInformationFromInstructionOffset):
(match):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove no longer used error code JSRegExpErrorMatchLimit
* kjs/regexp.cpp:
(KJS::RegExp::match):
* pcre/pcre.h:
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Make i locally scoped for better code clarity
* pcre/pcre_exec.cpp:
(match):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Give subjectPtr and instructionPtr sane names, reduce size of MatchFrame for a 0.2% speedup.
* pcre/pcre_compile.cpp:
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_exec.cpp:
(match_ref):
(MatchStack::pushNewFrame):
(getUTF8CharAndIncrementLength):
(match):
* pcre/pcre_internal.h:
(getChar):
(getCharAndAdvance):
(getCharAndLength):
(getCharAndAdvanceIfSurrogate):
* pcre/pcre_xclass.cpp:
(getUTF8CharAndAdvancePointer):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Small speedup (0.7%) by simplifying canUseStackBufferForNextFrame() check
* pcre/pcre_exec.cpp:
(MatchStack::MatchStack):
(MatchStack::popCurrentFrame):
2007-11-25 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Lower MATCH_LIMIT_RECURSION to more sane levels to prevent hangs on run-javascriptcore-tests
* pcre/pcre_internal.h:
2007-11-25 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove match_is_group variable for another 5% speedup
* pcre/pcre_compile.cpp:
* pcre/pcre_exec.cpp:
(startNewGroup):
(match):
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Abstract frame variables into locals and args
* pcre/pcre_compile.cpp:
(compile_branch):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Section off MatchData arguments into args struct
* pcre/pcre_exec.cpp:
(MatchStack::pushNewFrame):
(match):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Remove redundant eptrblock struct
* pcre/pcre_exec.cpp:
(MatchStack::pushNewFrame):
(match):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove redundant match_call_count and move recursion check out of super-hot code path
SunSpider says this is at least an 8% speedup for regexp.
* pcre/pcre_exec.cpp:
(MatchStack::MatchStack):
(MatchStack::pushNewFrame):
(MatchStack::popCurrentFrame):
(MatchStack::popAllFrames):
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Get rid of GETCHAR* macros, replacing them with better named inlines
* pcre/pcre_compile.cpp:
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
(getCharAndAdvance):
(getCharAndLength):
(getCharAndAdvanceIfSurrogate):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Further cleanup GET/PUT inlines
* pcre/pcre_internal.h:
(putOpcodeValueAtOffset):
(getOpcodeValueAtOffset):
(putOpcodeValueAtOffsetAndAdvance):
(put2ByteOpcodeValueAtOffset):
(get2ByteOpcodeValueAtOffset):
(put2ByteOpcodeValueAtOffsetAndAdvance):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Give GET, PUT better names, and add (poor) moveOpcodePtrPastAnyAlternateBranches
* pcre/pcre_compile.cpp:
(firstSignificantOpCodeSkippingAssertions):
(find_fixedlength):
(complete_callout):
(compile_branch):
(compile_regex):
(is_anchored):
(canApplyFirstCharOptimization):
(find_firstassertedchar):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
(putOpcodeValueAtOffset):
(getOpcodeValueAtOffset):
(putOpcodeValueAtOffsetAndAdvance):
(put2ByteOpcodeValueAtOffset):
(get2ByteOpcodeValueAtOffset):
(moveOpcodePtrPastAnyAlternateBranches):
* pcre/pcre_ucp_searchfuncs.cpp:
(_pcre_ucp_othercase):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Add inlines for toLowerCase, isWordChar, isSpaceChar for further regexp speedup
* pcre/pcre_compile.cpp:
(compile_branch):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
(toLowerCase):
(flipCase):
(classBitmapForChar):
(charTypeForChar):
(isWordChar):
(isSpaceChar):
(CompileData::CompileData):
* pcre/pcre_xclass.cpp:
(_pcre_xclass):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
cleanup _pcre_ucp_othercase
* pcre/pcre_ucp_searchfuncs.cpp:
(_pcre_ucp_othercase):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Use better variable names for case ignoring options
* pcre/pcre_compile.cpp:
(compile_branch):
(find_firstassertedchar):
(printCompiledRegExp):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(match_ref):
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
split first_significant_code into two simpler functions
* pcre/pcre_compile.cpp:
(firstSignificantOpCode):
(firstSignificantOpCodeSkippingAssertions):
(is_anchored):
(canApplyFirstCharOptimization):
(find_firstassertedchar):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
clean up is_counted_repeat
* pcre/pcre_compile.cpp:
(is_counted_repeat):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
clean up check_escape
* pcre/pcre_compile.cpp:
(check_escape):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Reformat find_fixedlength
* pcre/pcre_compile.cpp:
(find_fixedlength):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
reformat is_anchored
* pcre/pcre_compile.cpp:
(is_anchored):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove unused function could_be_empty_branch
* pcre/pcre_compile.cpp:
(first_significant_code):
(find_fixedlength):
(compile_branch):
(canApplyFirstCharOptimization):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Pass around MatchData objects by reference
* pcre/pcre_exec.cpp:
(pchars):
(match_ref):
(match):
(jsRegExpExecute):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
give PCRE_STARTLINE a better name and rename match_data to MatchData
* pcre/pcre_compile.cpp:
(compile_branch):
(canApplyFirstCharOptimization):
(find_firstassertedchar):
(printCompiledRegExp):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(pchars):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Clean up find_firstassertedchar
* pcre/pcre_compile.cpp:
(get_othercase_range):
(find_firstassertedchar):
(calculateCompiledPatternLengthAndFlags):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Tim Hatcher.
Pass around CompileData& instead of CompileData*
* pcre/pcre_compile.cpp:
(compile_branch):
(jsRegExpCompile):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Clean up compile_branch, move _pcre_ord2utf8, and rename CompileData
* JavaScriptCore.xcodeproj/project.pbxproj:
* pcre/pcre_compile.cpp:
(_pcre_ord2utf8):
(calculateCompiledPatternLengthAndFlags):
(jsRegExpCompile):
* pcre/pcre_internal.h:
* pcre/pcre_ord2utf8.cpp: Removed.
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
removing more macros
* pcre/pcre_compile.cpp:
(could_be_empty_branch):
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_exec.cpp:
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
* pcre/pcre_xclass.cpp:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
clean up formating in compile_branch
* pcre/pcre_compile.cpp:
(compile_branch):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Fix spacing for read_repeat_counts
* pcre/pcre_compile.cpp:
(read_repeat_counts):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Get rid of PCRE custom char types
* pcre/pcre_compile.cpp:
(check_escape):
(complete_callout):
(compile_branch):
(compile_regex):
(calculateCompiledPatternLengthAndFlags):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(match_ref):
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
reformat get_othercase_range
* pcre/pcre_compile.cpp:
(get_othercase_range):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove register keyword and more cleanup
* pcre/pcre_compile.cpp:
(find_fixedlength):
(compile_branch):
(is_anchored):
(is_startline):
(find_firstassertedchar):
(calculateCompiledPatternLengthAndFlags):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(MatchStack::canUseStackBufferForNextFrame):
(MatchStack::allocateNextFrame):
(MatchStack::pushNewFrame):
(MatchStack::frameIsStackAllocated):
(MatchStack::popCurrentFrame):
(MatchStack::unrollAnyHeapAllocatedFrames):
(getUTF8CharAndIncrementLength):
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
(PUT2INC):
(isLeadingSurrogate):
(isTrailingSurrogate):
(decodeSurrogatePair):
(getChar):
* pcre/pcre_ord2utf8.cpp:
(_pcre_ord2utf8):
* pcre/pcre_xclass.cpp:
(getUTF8CharAndAdvancePointer):
(_pcre_xclass):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Clean up jsRegExpExecute
* pcre/pcre_compile.cpp:
(returnError):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-29 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Merging updated system alloc and spinlock code from r38 of TCMalloc.
This is needed as a precursor to the merge of TCMalloc proper.
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_PageHeap::GrowHeap):
* wtf/TCSpinLock.h:
(TCMalloc_SpinLock::TCMalloc_SpinLock):
(TCMalloc_SpinLock::):
(TCMalloc_SpinLock::Lock):
(TCMalloc_SpinLock::Unlock):
(TCMalloc_SpinLock::IsHeld):
* wtf/TCSystemAlloc.cpp:
(TrySbrk):
(TryMmap):
(TryVirtualAlloc):
(TryDevMem):
(TCMalloc_SystemAlloc):
* wtf/TCSystemAlloc.h:
2007-11-28 Brady Eidson <beidson@apple.com>
Reviewed by Geoff
Add copyKeysToVector utility, mirroring copyValuesToVector
Also change the copyValuesToVector implementation to be a little more attractive
* wtf/HashMap.h:
(WTF::copyKeysToVector):
(WTF::copyValuesToVector):
2007-11-27 Alp Toker <alp@atoker.com>
Reviewed by Mark Rowe.
Add a list of public JavaScriptCore headers for installation.
This follows the convention used for the Qt and GTK+ header lists.
* headers.pri: Added.
2007-11-27 Alp Toker <alp@atoker.com>
Prospective MSVC build fix.
Roll back dllexport/dllimport support for now.
* API/JSBase.h:
2007-11-27 Alp Toker <alp@atoker.com>
Reviewed by Maciej.
http://bugs.webkit.org/show_bug.cgi?id=15569
[gtk] GTK JavaScriptCore needs to export symbols for JSC API and WTF
Introduce JS_EXPORT to mark symbols to be exported as public API.
Export all public symbols in the JavaScriptCore C API.
This matches conventions for exporting symbols set by the CF and CG
frameworks.
* API/JSBase.h:
* API/JSContextRef.h:
* API/JSObjectRef.h:
* API/JSStringRef.h:
* API/JSStringRefBSTR.h:
* API/JSStringRefCF.h:
* API/JSValueRef.h:
2007-11-27 Anders Carlsson <andersca@apple.com>
Reviewed by Adam.
Make PropertyNameArray and ScopeChain COMEnumVariant friendly.
* kjs/PropertyNameArray.cpp:
(KJS::PropertyNameArray::swap):
Implement PropertyNameArray::swap.
* kjs/PropertyNameArray.h:
Add ValueType typedef. Replace PropertyNameArrayIterator with
PropertyNameArray::const_iterator.
* kjs/nodes.cpp:
(KJS::ForInNode::execute):
* kjs/scope_chain.cpp:
(KJS::ScopeChain::print):
Update for changes to PropertyNameArray.
* kjs/scope_chain.h:
Add const_iterator and ValueType typedef.
2007-11-27 Anders Carlsson <andersca@apple.com>
Reviewed by Darin.
Add a ValueType typedef.
* wtf/Vector.h:
2007-11-26 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- fix http://bugs.webkit.org/show_bug.cgi?id=16096
REGRESSION (r26653-r26699): Plaxo.com addressbook does not load in webkit nightlies
Test: fast/js/regexp-overflow.html
* pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags):
Removed a stray "ptr++" that I added by accident when merging the
changes between PCRE 6.4 and 6.5.
2007-11-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Kevin McCullough.
Fixed <rdar://problem/5597937> REGRESSION (r27126): Drosera does not
show variables (can't enumerate ActivationImp properties)
Implemented a custom ActivationImp::getPropertyNames, since
ActivationImp now uses a custom property storage mechanism for local
variables.
* kjs/function.cpp:
(KJS::ActivationImp::getPropertyNames):
* kjs/function.h:
2007-11-26 Alp Toker <alp@atoker.com>
GTK+/Qt/Wx build fix for breakage introduced in r28039.
* ForwardingHeaders/JavaScriptCore/JSRetainPtr.h: Added.
2007-11-24 Laszlo Gombos <laszlo.gombos@gmail.com>
Reviewed by Maciej Stachowiak.
Fix minor compiler warning (GCC 4.1.3)
* pcre/pcre_internal.h:
* pcre/pcre_ucp_searchfuncs.cpp:
(_pcre_ucp_othercase):
2007-11-25 Mark Rowe <mrowe@apple.com>
Reviewed by Dan Bernstein.
Fix http://bugs.webkit.org/show_bug.cgi?id=16129
Bug 16129: REGRESSION (r27761-r27811): malloc error while visiting http://mysit.es (crashes release build)
* pcre/pcre_compile.cpp: Change errorcode to be passed by reference so that any error code is propagated
to our caller like they expect.
2007-11-23 Kevin Ollivier <kevino@theolliviers.com>
MSVC7 build fix. (rand_s doesn't exist there)
Reviewed by Adam Roben.
* kjs/config.h:
* wtf/MathExtras.h:
2007-11-23 Kevin Ollivier <kevino@theolliviers.com>
wx build fix. Move WX_PYTHON logic into project build settings,
add WebKitLibraries dirs on Win, and explicitly include JSCore
headers in testkjs rather than getting them from a template.
(Include dir order of JSCore/WTF and ICU headers is important due
to wtf/unicode/utf8.h.)
* jscore.bkl:
2007-11-23 Simon Hausmann <hausmann@webkit.org>
Reviewed by George Staikos <staikos@kde.org>.
Fix make (dist)clean on Windows.
OBJECTS_DIR_WTR does not exist anymore, use GENERATED_SOURCES_DIR.
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-22 Simon Hausmann <hausmann@kde.org>
Reviewed by George.
Make the directory of where to put the generated sources configurable through the GENERATED_SOURCE_DIR variable
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-22 Simon Hausmann <hausmann@kde.org>
Reviewed by George.
Centralize the setup for all the extra compilers in a addExtraCompiler function.
This allows adding a "generated_files" target that builds all generated files using "make generated_files".
For the build inside Qt we do not generate actual rules for the extra compilers but instead
do the variable substitution of compiler.output manually and add the generated sources to SOURCES.
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-20 Mark Rowe <mrowe@apple.com>
Reviewed by Tim Hatcher.
<rdar://problem/5602936> Need to resolve new GCC 4.2 warnings
Fix all warnings emitted by GCC 4.2 when building JavaScriptCore. This allows builds with
-Werror to succeed. At present they will crash when executed due to code that is not safe
under strict aliasing (<rdar://problem/5536806>).
* Configurations/Base.xcconfig: Remove the -Wno-long-double flag.
* kjs/date_object.cpp:
(KJS::formatTime): Test whether the stack-allocated string is empty rather than at a non-null address.
* kjs/dtoa.cpp:
(Bigint::): Tweak formatting to silence warnings.
* pcre/pcre_exec.cpp:
(match): Tweak formatting to silence warnings
* wtf/Assertions.cpp: Add printf format attribute to functions that warrant it.
* wtf/Assertions.h: Ditto.
2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
wx port build fix (wx headers include ctype functions).
* kjs/config.h:
2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
Remove outdated and unused Windows port files.
Reviewed by Adam Roben.
* Makefile.vc: Removed.
* README-Win32.txt: Removed.
2007-11-18 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
* tests/mozilla/jsDriver.pl: exit non-0 when user aborts test run
2007-11-17 Mark Rowe <mrowe@apple.com>
Reviewed by Darin Adler.
Fix: <rdar://problem/5607032> REGRESSION: testapi exits with assertion failure in debug build
<rdar://problem/5440659> JSGlobalContextCreate throws away globalObjectClass's prototype
http://bugs.webkit.org/show_bug.cgi?id=16033
Split Interpreter's initialization into two distinct steps: the creation of the global prototypes
and constructors, and storing them on the global object. This allows JSClassRef's passed to
JSGlobalContextCreate to be instantiated with the correct prototype.
* API/JSCallbackObject.cpp: Assert at compile-time that the custom global object will fit in a collector cell.
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(KJS::::JSCallbackObject):
(KJS::::init):
* API/JSContextRef.cpp:
(JSGlobalContextCreate): Construct and set the interpreter's global object separately. When globalObjectClass
is passed we need to set the interpreter's global object before doing the JSCallbackObject's initialization to
prevent any JSObjectInitializeCallback's being invoked before a global object is set.
* API/testapi.c:
(globalObject_initialize): Test the object passed in is correct and that it has the expected global properties.
(globalObject_get):
(globalObject_set):
(main):
* API/testapi.js: Test that any static properties exposed by the global object's custom class are found.
* JavaScriptCore.exp:
* bindings/testbindings.cpp:
(main): Update for changes in Interpreter method signatures.
* bindings/testbindings.mm:
(main): Ditto.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
(KJS::ExecState::mark):
(KJS::ExecState::setGlobalObject):
* kjs/ExecState.h: Rename scope to m_scopeChain.
* kjs/interpreter.cpp:
(KJS::Interpreter::Interpreter):
(KJS::Interpreter::init):
(KJS::Interpreter::globalObject):
(KJS::Interpreter::setGlobalObject):
(KJS::Interpreter::resetGlobalObjectProperties):
(KJS::Interpreter::createObjectsForGlobalObjectProperties):
(KJS::Interpreter::setGlobalObjectProperties): Switch to using putDirect to ensure that the global object's put method
cannot interfere with setting of the global properties. This prevents a user-written JSClassRef from attempting to
call back into JavaScript from the initialization of the global object's members.
* kjs/interpreter.h:
* kjs/testkjs.cpp:
(setupInterpreter): Update for changes in Interpreter method signatures.
2007-11-17 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Prevent testapi from reporting false leaks. Clear out local variables pointing at
JSObjectRefs to allow their values to be collected.
* API/testapi.c:
(main):
2007-11-17 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Prevent testapi from crashing if testapi.js can not be found by nil-checking the result of createStringWithContentsOfFile.
* API/testapi.c:
(main):
2007-11-17 Alp Toker <alp@atoker.com>
Reviewed by Eric.
http://bugs.webkit.org/show_bug.cgi?id=16032
JS minidom is not portable
Use a plain UTF-8 string instead of a CFString.
Print to stdout, not stderr like CFShow() would have done, since that
behaviour seems unintentional.
* API/minidom.c:
(main):
2007-11-17 Steve Falkenburg <sfalken@apple.com>
Windows build fix.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-11-16 Mark Rowe <mrowe@apple.com>
Windows build fix.
* kjs/lexer.cpp:
(KJS::Lexer::record8):
2007-11-16 Mark Rowe <mrowe@apple.com>
Reviewed by Eric.
Replace strings, identifier, buffer8 and buffer16 members of Lexer with vectors.
SunSpider claims this is a 0.7% speedup.
* kjs/lexer.cpp:
(KJS::Lexer::Lexer):
(KJS::Lexer::lex):
(KJS::Lexer::record8):
(KJS::Lexer::record16):
(KJS::Lexer::scanRegExp):
(KJS::Lexer::clear):
(KJS::Lexer::makeIdentifier):
(KJS::Lexer::makeUString):
* kjs/lexer.h:
* kjs/ustring.cpp:
(KJS::UString::UString): Add a convenience constructor that takes a const Vector<UChar>&.
* kjs/ustring.h:
2007-11-16 Adam Roben <aroben@apple.com>
Windows build fix
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Add a new include path
and ignore the int -> bool conversion warning.
2007-11-16 Alexey Proskuryakov <ap@webkit.org>
Fix Windows debug build.
Rubber-stamped by Eric
* pcre/pcre_exec.cpp: (match): Removed ASSERT_NOT_REACHED assertions that were making MSVC
complain about unreachable code.
2007-11-15 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/Parser.cpp:
2007-11-15 Mark Rowe <mrowe@apple.com>
Mac build and header search path sanity fix.
Reviewed by Sam Weinig and Tim Hatcher.
Move base setting for HEADER_SEARCH_PATHS into Base.xcconfig, and extend
it in JavaScriptCore.xcconfig. This removes the need to override it on a
per-target basis inside the .xcodeproj file.
* Configurations/Base.xcconfig:
* Configurations/JavaScriptCore.xcconfig:
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-11-15 Mark Rowe <mrowe@apple.com>
Qt build fix.
* kjs/Parser.h:
2007-11-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Another round of grammar / parsing cleanup.
1. Created distinct parser calls for parsing function bodies vs
programs. This will help later with optimizing global variable access.
2. Turned Parser into a singleton. Cleaned up Lexer's singleton
interface.
3. Modified Lexer to free a little more memory when done lexing. (Added
FIXMEs for similar issues that I didn't fix.)
4. Changed Lexer::makeIdentifier and Lexer::makeUString to start
respecting the arguments passed to them. (No behavior change, but this
problem could have caused serious problems for an unsuspecting user of
these functions.)
5. Removed KJS_DEBUG_MEM because it was bit-rotted.
6. Removed Parser::prettyPrint because the same work was simpler to do
at the call site.
7. Some renames:
"Parser::accept" => "Parser::didFinishParsing"
"Parser::sid" => "Parser::m_sourceID"
"Lexer::doneParsing" => "Lexer::clear"
"sid" => "sourceId"
"lineno" => "lineNo"
* JavaScriptCore.exp:
* kjs/Parser.cpp:
(KJS::Parser::Parser):
(KJS::Parser::parseProgram):
(KJS::Parser::parseFunctionBody):
(KJS::Parser::parse):
(KJS::Parser::didFinishParsing):
(KJS::parser):
* kjs/Parser.h:
(KJS::Parser::sourceId):
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function_object.cpp:
(FunctionObjectImp::construct):
* kjs/grammar.y:
* kjs/interpreter.cpp:
(KJS::Interpreter::checkSyntax):
(KJS::Interpreter::evaluate):
* kjs/interpreter.h:
* kjs/lexer.cpp:
(kjsyylex):
(KJS::lexer):
(KJS::Lexer::Lexer):
(KJS::Lexer::~Lexer):
(KJS::Lexer::scanRegExp):
(KJS::Lexer::doneParsing):
(KJS::Lexer::makeIdentifier):
(KJS::Lexer::makeUString):
* kjs/lexer.h:
(KJS::Lexer::pattern):
(KJS::Lexer::flags):
(KJS::Lexer::sawError):
* kjs/nodes.cpp:
(KJS::Node::Node):
(KJS::FunctionBodyNode::FunctionBodyNode):
* kjs/nodes.h:
* kjs/testkjs.cpp:
(prettyPrintScript):
(kjsmain):
* kjs/ustring.cpp:
* kjs/ustring.h:
2007-11-15 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
<rdar://problem/5601548> REGRESSION: All SourceElements and their children leak after a syntax error
Add a stub node to maintain the Vector of SourceElements until assignment.
* kjs/grammar.y:
* kjs/nodes.h:
(KJS::SourceElementsStub::SourceElementsStub):
(KJS::SourceElementsStub::append):
(KJS::SourceElementsStub::release):
(KJS::SourceElementsStub::):
(KJS::SourceElementsStub::precedence):
2007-11-15 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Abstract most of RMATCH into MatchStack functions.
SunSpider claims this, combined with the last 2 patches was a 1% speedup, 10% for dna-regexp.
* pcre/pcre_exec.cpp:
(MatchStack::canUseStackBufferForNextFrame):
(MatchStack::allocateNextFrame):
(MatchStack::pushNewFrame):
(MatchStack::frameIsStackAllocated):
(MatchStack::popCurrentFrame):
(MatchStack::unrollAnyHeapAllocatedFrames):
(match):
2007-11-15 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Remove RETURN_ERROR, add MatchStack
* pcre/pcre_exec.cpp:
(MatchStack::MatchStack):
(MatchStack::unrollAnyHeapAllocatedFrames):
(matchError):
(match):
2007-11-15 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Clean up match function to match WebKit style
* JavaScriptCore.xcodeproj/project.pbxproj:
* pcre/pcre_exec.cpp:
(match):
2007-11-15 Steve Falkenburg <sfalken@apple.com>
Windows build fix.
* JavaScriptCore.vcproj/JavaScriptCore.make:
2007-11-14 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=15982
Improve JSString UTF-8 decoding
* API/JSStringRef.cpp:
(JSStringCreateWithUTF8CString): Use strict decoding, return 0 on error.
* wtf/unicode/UTF8.cpp:
(WTF::Unicode::convertUTF16ToUTF8):
(WTF::Unicode::convertUTF8ToUTF16):
* wtf/unicode/UTF8.h:
Made these function names start with a lower case letter.
* kjs/ustring.cpp: (KJS::UString::UTF8String): Updated for the above renaming.
* bindings/c/c_utility.cpp:
(KJS::Bindings::convertUTF8ToUTF16WithLatin1Fallback): Renamed to highlight the difference
from convertUTF8ToUTF16 in wtf/unicode.
(KJS::Bindings::convertNPStringToUTF16): Updated for the above renaming.
(KJS::Bindings::identifierFromNPIdentifier): Ditto.
* bindings/c/c_utility.h: Made convertUTF8ToUTF16WithLatin1Fallback() a file static.
2007-11-14 Sam Weinig <sam@webkit.org>
Rubber-stamped by Anders.
Fix the Xcode project file after it was messed up in r27402.
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-11-14 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
More PCRE style cleanup.
* pcre/pcre_compile.cpp:
(compile_regex):
2007-11-14 Adam Roben <aroben@apple.com>
Clean up the bison conflict checking script
Reviewed by Geoff.
* DerivedSources.make:
2007-11-14 Eric Seidel <eric@webkit.org>
Reviewed by Geoff.
Another round of PCRE cleanups: inlines
SunSpider claims that this, combined with my previous PCRE cleanup were a 0.7% speedup, go figure.
* pcre/pcre_compile.cpp:
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
(PUT):
(GET):
(PUT2):
(GET2):
(isNewline):
2007-11-14 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Give PCRE a (small) bath.
Fix some formating and break things off into separate functions
http://bugs.webkit.org/show_bug.cgi?id=15993
* pcre/pcre_compile.cpp:
(calculateCompiledPatternLengthAndFlags):
(printCompiledRegExp):
(returnError):
(jsRegExpCompile):
* pcre/pcre_internal.h:
(compile_data::compile_data):
2007-11-14 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Cleaned up the JavaScript grammar a bit.
1. Changed BlockNode to always hold a child vector (which may be empty),
eliminating a few NULL-check branches in the common execution case.
2. Changed the Block production to correctly report its starting and
ending line numbers to the debugger. (It used to report its ending line
as its starting line.) Also, removed duplicate line-reporting code
inside the BlockNode constructor.
3. Moved curly braces up from FunctionBody production into parent
productions. (I had to move the line number reporting code, too, since
it depends on the location of the curly braces.) This matches the ECMA
spec more closely, and makes some future changes I plan easier.
4. Fixed statementList* convenience functions to deal appropriately with
empty Vectors.
SunSpider reports a small and statistically insignificant speedup.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::statementListPushFIFO):
(KJS::statementListGetDeclarations):
(KJS::statementListInitializeDeclarationStack):
(KJS::statementListInitializeVariableAccessStack):
(KJS::BlockNode::BlockNode):
(KJS::BlockNode::optimizeVariableAccess):
(KJS::BlockNode::getDeclarations):
(KJS::BlockNode::execute):
(KJS::FunctionBodyNode::initializeDeclarationStacks):
(KJS::FunctionBodyNode::optimizeVariableAccess):
2007-11-13 Anders Carlsson <andersca@apple.com>
Add RefCounted.h (And remove Shared.h)
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
2007-11-13 Geoffrey Garen <ggaren@apple.com>
Build fix.
* kjs/regexp.h:
2007-11-13 Geoffrey Garen <ggaren@apple.com>
Reviewed by Anders Carlsson.
Renamed Shared to RefCounted.
* API/JSClassRef.h:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/interpreter.h:
* kjs/regexp.h:
* wtf/RefCounted.h: Copied from JavaScriptCore/wtf/Shared.h.
(WTF::RefCounted::RefCounted):
* wtf/Shared.h: Removed.
2007-11-13 Adam Roben <aroben@apple.com>
Build fix
Reviewed by Geoff.
* kjs/regexp.h: Added a missing #include.
2007-11-13 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Moved Shared.h into wtf so it could be used in more places. Deployed
Shared in places where JSCore previously had hand-rolled ref-counting
classes.
* API/JSClassRef.cpp:
(OpaqueJSClass::OpaqueJSClass):
* API/JSClassRef.h:
* API/JSObjectRef.cpp:
(JSClassRetain):
(JSClassRelease):
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/interpreter.cpp:
(KJS::Interpreter::init):
* kjs/interpreter.h:
* kjs/regexp.cpp:
(KJS::RegExp::RegExp):
* kjs/regexp.h:
* wtf/Shared.h: Copied from WebCore/platform/Shared.h.
2007-11-13 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Add an ASSERT to getTruncatedInt32 to enforce proper usage.
Best part about this patch? It doesn't break the web!
* kjs/JSImmediate.h:
(KJS::JSImmediate::getTruncatedInt32):
(KJS::JSImmediate::toDouble):
(KJS::JSImmediate::getUInt32):
2007-11-13 Alexey Proskuryakov <ap@webkit.org>
Windows build fix.
* bindings/c/c_utility.cpp:
(KJS::Bindings::convertUTF8ToUTF16):
* kjs/ustring.cpp:
(KJS::UString::UTF8String):
* wtf/unicode/UTF8.cpp:
(WTF::Unicode::ConvertUTF8ToUTF16):
2007-11-13 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=11231
RegExp bug when handling newline characters
and a number of other differences between PCRE behvior
and JavaScript regular expressions:
+ single-digit sequences like \4 should be treated as octal
character constants, unless there is a sufficient number
of brackets for them to be treated as backreferences
+ \8 turns into the character "8", not a binary zero character
followed by "8" (same for 9)
+ only the first 3 digits should be considered part of an
octal character constant (the old behavior was to decode
an arbitrarily long sequence and then mask with 0xFF)
+ if \x is followed by anything other than two valid hex digits,
then it should simply be treated a the letter "x"; that includes
not supporting the \x{41} syntax
+ if \u is followed by anything less than four valid hex digits,
then it should simply be treated a the letter "u"
+ an extra "+" should be a syntax error, rather than being treated
as the "possessive quantifier"
+ if a "]" character appears immediately after a "[" character that
starts a character class, then that's an empty character class,
rather than being the start of a character class that includes a
"]" character
+ a "$" should not match a terminating newline; we could have gotten
PCRE to handle this the way we wanted by passing an appropriate option
Test: fast/js/regexp-no-extensions.html
* pcre/pcre_compile.cpp:
(check_escape): Check backreferences against bracount to catch both
overflows and things that should be treated as octal. Rewrite octal
loop to not go on indefinitely. Rewrite both hex loops to match and
remove \x{} support.
(compile_branch): Restructure loops so that we don't special-case a "]"
at the beginning of a character class. Remove code that treated "+" as
the possessive quantifier.
(jsRegExpCompile): Change the "]" handling here too.
* pcre/pcre_exec.cpp: (match): Changed CIRC to match the DOLL implementation.
Changed DOLL to remove handling of "terminating newline", a Perl concept
which we don't need.
* tests/mozilla/expected.html: Two tests are fixed now:
ecma_3/RegExp/regress-100199.js and ecma_3/RegExp/regress-188206.js.
One test fails now: ecma_3/RegExp/perlstress-002.js -- our success before
was due to a bug (we treated all 1-character numeric escapes as backreferences).
The date tests also now both expect success -- whatever was making them fail
before was probably due to the time being close to a DST shift; maybe we need
to get rid of those tests.
2007-11-13 Darin Adler <darin@apple.com>
* kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32):
Remove too-strong assert that was firing constantly and preventing even basic
web browsing from working in a debug build. This function is used in many
cases where the immediate value is not a number; the assertion could perhaps
be added back later with a bit of reorganization.
2007-11-13 Alp Toker <alp@atoker.com>
Build fix for breakage to non-Mac builds introduced in r27746.
* kjs/ustring.cpp:
2007-11-13 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Clean up evaluateToBoolean functions to use inlines instead of copy/paste code
* kjs/JSImmediate.h:
* kjs/nodes.cpp:
(KJS::GreaterNode::inlineEvaluateToBoolean):
(KJS::GreaterNode::evaluate):
(KJS::LessEqNode::inlineEvaluateToBoolean):
(KJS::LessEqNode::evaluate):
(KJS::GreaterEqNode::inlineEvaluateToBoolean):
(KJS::GreaterEqNode::evaluate):
(KJS::InNode::evaluateToBoolean):
(KJS::EqualNode::inlineEvaluateToBoolean):
(KJS::EqualNode::evaluate):
(KJS::NotEqualNode::inlineEvaluateToBoolean):
(KJS::NotEqualNode::evaluate):
(KJS::StrictEqualNode::inlineEvaluateToBoolean):
(KJS::StrictEqualNode::evaluate):
(KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
(KJS::NotStrictEqualNode::evaluate):
* kjs/nodes.h:
2007-11-12 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15958
base64 spends 1.1% of total time checking for special Infinity case
Use a fast character test instead of calling strncmp.
1.1% speedup on string-base64. SunSpider reports a .4% speedup overall;
Sharks reports only .1%. Who are you going to believe? Huh?
* kjs/ustring.cpp:
(KJS::UString::toDouble):
2007-11-12 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
Add evaluateToInt32 and evaluateUInt32 methods and deploy them.
Fix a few missing evaluateToBoolean methods
Deploy all evaluateTo* functions to more nodes to avoid slowdowns
http://bugs.webkit.org/show_bug.cgi?id=15950
SunSpider claims this is at least a 1.4% speedup.
* kjs/JSImmediate.h:
(KJS::JSImmediate::getTruncatedInt32):
(KJS::JSImmediate::toDouble):
(KJS::JSImmediate::getUInt32):
* kjs/nodes.cpp:
(KJS::ExpressionNode::evaluateToNumber):
(KJS::ExpressionNode::evaluateToInt32):
(KJS::ExpressionNode::evaluateToUInt32):
(KJS::NumberNode::evaluateToInt32):
(KJS::NumberNode::evaluateToUInt32):
(KJS::ImmediateNumberNode::evaluateToInt32):
(KJS::ImmediateNumberNode::evaluateToUInt32):
(KJS::ResolveNode::evaluate):
(KJS::ResolveNode::evaluateToNumber):
(KJS::ResolveNode::evaluateToBoolean):
(KJS::ResolveNode::evaluateToInt32):
(KJS::ResolveNode::evaluateToUInt32):
(KJS::LocalVarAccessNode::evaluateToInt32):
(KJS::LocalVarAccessNode::evaluateToUInt32):
(KJS::BracketAccessorNode::evaluateToNumber):
(KJS::BracketAccessorNode::evaluateToBoolean):
(KJS::BracketAccessorNode::evaluateToInt32):
(KJS::BracketAccessorNode::evaluateToUInt32):
(KJS::DotAccessorNode::inlineEvaluate):
(KJS::DotAccessorNode::evaluate):
(KJS::DotAccessorNode::evaluateToNumber):
(KJS::DotAccessorNode::evaluateToBoolean):
(KJS::DotAccessorNode::evaluateToInt32):
(KJS::DotAccessorNode::evaluateToUInt32):
(KJS::NewExprNode::inlineEvaluate):
(KJS::NewExprNode::evaluate):
(KJS::NewExprNode::evaluateToNumber):
(KJS::NewExprNode::evaluateToBoolean):
(KJS::NewExprNode::evaluateToInt32):
(KJS::NewExprNode::evaluateToUInt32):
(KJS::FunctionCallResolveNode::inlineEvaluate):
(KJS::FunctionCallResolveNode::evaluate):
(KJS::FunctionCallResolveNode::evaluateToNumber):
(KJS::FunctionCallResolveNode::evaluateToBoolean):
(KJS::FunctionCallResolveNode::evaluateToInt32):
(KJS::FunctionCallResolveNode::evaluateToUInt32):
(KJS::LocalVarFunctionCallNode::evaluate):
(KJS::LocalVarFunctionCallNode::evaluateToNumber):
(KJS::LocalVarFunctionCallNode::evaluateToBoolean):
(KJS::LocalVarFunctionCallNode::evaluateToInt32):
(KJS::LocalVarFunctionCallNode::evaluateToUInt32):
(KJS::FunctionCallDotNode::evaluate):
(KJS::FunctionCallDotNode::evaluateToNumber):
(KJS::FunctionCallDotNode::evaluateToBoolean):
(KJS::FunctionCallDotNode::evaluateToInt32):
(KJS::FunctionCallDotNode::evaluateToUInt32):
(KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
(KJS::PostDecLocalVarNode::evaluateToNumber):
(KJS::PostDecLocalVarNode::evaluateToBoolean):
(KJS::PostDecLocalVarNode::evaluateToInt32):
(KJS::PostDecLocalVarNode::evaluateToUInt32):
(KJS::typeStringForValue):
(KJS::UnaryPlusNode::evaluate):
(KJS::UnaryPlusNode::evaluateToBoolean):
(KJS::UnaryPlusNode::evaluateToNumber):
(KJS::UnaryPlusNode::evaluateToInt32):
(KJS::BitwiseNotNode::inlineEvaluateToInt32):
(KJS::BitwiseNotNode::evaluate):
(KJS::BitwiseNotNode::evaluateToNumber):
(KJS::BitwiseNotNode::evaluateToBoolean):
(KJS::BitwiseNotNode::evaluateToInt32):
(KJS::MultNode::evaluateToBoolean):
(KJS::MultNode::evaluateToInt32):
(KJS::MultNode::evaluateToUInt32):
(KJS::DivNode::evaluateToInt32):
(KJS::DivNode::evaluateToUInt32):
(KJS::ModNode::evaluateToBoolean):
(KJS::ModNode::evaluateToInt32):
(KJS::ModNode::evaluateToUInt32):
(KJS::AddNode::evaluateToNumber):
(KJS::AddNode::evaluateToInt32):
(KJS::AddNode::evaluateToUInt32):
(KJS::AddNumbersNode::evaluateToInt32):
(KJS::AddNumbersNode::evaluateToUInt32):
(KJS::SubNode::evaluateToInt32):
(KJS::SubNode::evaluateToUInt32):
(KJS::LeftShiftNode::inlineEvaluateToInt32):
(KJS::LeftShiftNode::evaluate):
(KJS::LeftShiftNode::evaluateToNumber):
(KJS::LeftShiftNode::evaluateToInt32):
(KJS::RightShiftNode::inlineEvaluateToInt32):
(KJS::RightShiftNode::evaluate):
(KJS::RightShiftNode::evaluateToNumber):
(KJS::RightShiftNode::evaluateToInt32):
(KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
(KJS::UnsignedRightShiftNode::evaluate):
(KJS::UnsignedRightShiftNode::evaluateToNumber):
(KJS::UnsignedRightShiftNode::evaluateToInt32):
(KJS::LessNode::inlineEvaluateToBoolean):
(KJS::LessNode::evaluate):
(KJS::LessNode::evaluateToBoolean):
(KJS::LessNumbersNode::inlineEvaluateToBoolean):
(KJS::LessNumbersNode::evaluate):
(KJS::LessNumbersNode::evaluateToBoolean):
(KJS::LessStringsNode::inlineEvaluateToBoolean):
(KJS::LessStringsNode::evaluate):
(KJS::BitAndNode::evaluate):
(KJS::BitAndNode::inlineEvaluateToInt32):
(KJS::BitAndNode::evaluateToNumber):
(KJS::BitAndNode::evaluateToBoolean):
(KJS::BitAndNode::evaluateToInt32):
(KJS::BitXOrNode::inlineEvaluateToInt32):
(KJS::BitXOrNode::evaluate):
(KJS::BitXOrNode::evaluateToNumber):
(KJS::BitXOrNode::evaluateToBoolean):
(KJS::BitXOrNode::evaluateToInt32):
(KJS::BitOrNode::inlineEvaluateToInt32):
(KJS::BitOrNode::evaluate):
(KJS::BitOrNode::evaluateToNumber):
(KJS::BitOrNode::evaluateToBoolean):
(KJS::BitOrNode::evaluateToInt32):
(KJS::ConditionalNode::evaluateToNumber):
(KJS::ConditionalNode::evaluateToInt32):
(KJS::ConditionalNode::evaluateToUInt32):
(KJS::valueForReadModifyAssignment):
(KJS::AssignExprNode::evaluate):
(KJS::AssignExprNode::evaluateToBoolean):
(KJS::AssignExprNode::evaluateToNumber):
(KJS::AssignExprNode::evaluateToInt32):
(KJS::VarDeclNode::handleSlowCase):
* kjs/nodes.h:
(KJS::FunctionCallResolveNode::precedence):
(KJS::AddNode::precedence):
(KJS::AddNode::):
(KJS::LessNumbersNode::):
(KJS::LessStringsNode::):
* kjs/value.cpp:
(KJS::JSValue::toInt32SlowCase):
(KJS::JSValue::toUInt32SlowCase):
* kjs/value.h:
(KJS::JSValue::asCell):
(KJS::JSValue::toInt32):
(KJS::JSValue::toUInt32):
2007-11-12 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=15953
Add UTF-8 encoding/decoding to WTF
* kjs/ustring.h: Moved UTF8SequenceLength() and decodeUTF8Sequence() to wtf/unicode.
* kjs/ustring.cpp: (KJS::UString::UTF8String): Changed this function to take a strict/lenient
parameter. Callers are not interested in getting decoding results in strict mode, so
this allows for bailing out as soon as an error is seen.
* kjs/function.cpp:
(KJS::encode): Updated for new UString::UTF8String() signature.
* API/JSStringRef.cpp:
(JSStringCreateWithCharacters): Disambiguate UChar.
(JSStringCreateWithUTF8CString): Actually use UTF-8 when creating the string!
* bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): Use ConvertUTF8ToUTF16().
* wtf/unicode/UTF8.cpp: Added.
(WTF::Unicode::inlineUTF8SequenceLengthNonASCII):
(WTF::Unicode::inlineUTF8SequenceLength):
(WTF::Unicode::UTF8SequenceLength):
(WTF::Unicode::decodeUTF8Sequence):
(WTF::Unicode::):
(WTF::Unicode::ConvertUTF16ToUTF8):
(WTF::Unicode::isLegalUTF8):
(WTF::Unicode::ConvertUTF8ToUTF16):
* wtf/unicode/UTF8.h: Added.
(WTF::Unicode::):
Some code moved from ustring.h, some adapted from unicode.org sources.
* JavaScriptCore.exp:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
Added UTF8.{h,cpp}
2007-11-12 Josh Aas <joshmoz@gmail.com>
Reviewed by Darin.
- http://bugs.webkit.org/show_bug.cgi?id=15946
add NPPValue NPPVpluginDrawingModel (Mozilla bug 403418 compat)
* bindings/npapi.h:
2007-11-12 Darin Adler <darin@apple.com>
Reviewed by Sam.
- http://bugs.webkit.org/show_bug.cgi?id=15951
REGRESSION: assertion failure in regexp match() when running JS tests
Test: fast/js/regexp-many-brackets.html
* pcre/pcre_exec.cpp: (match): Added back accidentally-removed case for
the BRANUMBER opcode.
2007-11-12 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix use of prefix and config.h, got rid of a few unneeded things in
the PCRE code; no behavior changes
* API/JSBase.cpp: Added include of config.h.
* API/JSCallbackConstructor.cpp: Ditto.
* API/JSCallbackFunction.cpp: Ditto.
* API/JSCallbackObject.cpp: Ditto.
* API/JSClassRef.cpp: Ditto.
* API/JSContextRef.cpp: Ditto.
* API/JSObjectRef.cpp: Ditto.
* API/JSStringRef.cpp: Ditto.
* API/JSValueRef.cpp: Ditto.
* JavaScriptCorePrefix.h: Removed obsolete <ctype.h> workaround.
Moved new/delete macros after includes, as they are in WebCore's prefix.
Removed "config.h".
* pcre/dftables.cpp: (main): Changed back to not use a separate maketables
function. This is needed for PCRE, but not helpful for our use. Also changed
the tables to all be 128 entries long instead of 256, since only the first
128 are ever used.
* pcre/pcre_compile.cpp: Added include of config.h. Eliminated digitab,
which was only being used to check hex digits. Changed all uses of TRUE and
FALSE to use the C++ true and false instead.
(check_escape): Just the TRUE/FALSE thing.
(is_counted_repeat): Ditto.
(could_be_empty_branch): Ditto.
(get_othercase_range): Ditto.
(compile_branch): Ditto.
(compile_regex): Ditto.
(is_anchored): Ditto.
(is_startline): Ditto.
(find_firstassertedchar): Ditto.
(jsRegExpCompile): Ditto.
* pcre/pcre_exec.cpp: Added include of config.h. Changed all uses of TRUE and
FALSE to use the C++ true and false instead.
(match_ref): Just the TRUE/FALSE thing.
(match): Ditto. Removed some unneeded braces.
(jsRegExpExecute): Just the TRUE/FALSE thing.
* pcre/pcre_internal.h: Moved the constants needed by dftables.cpp to the top
of the file instead of the bottom, so they can be used. Also changed the table
sizes to 128 instead of 256. Removed macro definitions of FALSE and TRUE.
Set array sizes for all the const arrays. Changed _pcre_utf8_table1_size to
be a macro instead of a extern int.
* pcre/pcre_maketables.cpp: Removed. It's all in dftables.cpp now.
* pcre/pcre_tables.cpp: Made table sizes explicit.
* pcre/pcre_xclass.cpp: Just the TRUE/FALSE thing.
2007-11-12 Adam Roben <aroben@apple.com>
Build fix
* wtf/FastMalloc.h: Add missing using statement.
2007-11-11 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Add special fastZeroedMalloc function to replace a
number of fastCalloc calls where one argument was 1.
This results in a 0.4% progression in SunSpider, more
than making up for the earlier regression caused by
additional overflow checks.
* JavaScriptCore.exp:
* kjs/array_instance.cpp:
* kjs/property_map.cpp:
* wtf/FastMalloc.cpp:
* wtf/FastMalloc.h:
* wtf/HashTable.h:
2007-11-11 Adam Roben <aroben@apple.com>
Fix <rdar://5578982> ASSERT in HashTable::checkTableConsistencyExceptSize beneath WebNotificationCenter
The bug was due to a mismatch between HashMap::remove and
HashTable::checkTableConsistency. HashMap::remove can delete the value
stored in the HashTable (by derefing it), which is not normally
allowed by HashTable. It's OK in this case because the value is about
to be removed from the table, but HashTable wasn't aware of this.
HashMap::remove now performs the consistency check itself before
derefing the value.
Darin noticed that the same bug would occur in HashSet, so I've fixed
it there as well.
Reviewed by Darin.
* wtf/HashMap.h:
(WTF::HashMap::remove): Perform the HashTable consistency check
manually before calling deref.
* wtf/HashSet.h:
(WTF::HashSet::remove): Ditto.
* wtf/HashTable.h: Made checkTableConsistency public so that HashMap
and HashSet can call it.
(WTF::HashTable::removeAndInvalidateWithoutEntryConsistencyCheck):
Added.
(WTF::HashTable::removeAndInvalidate): Added.
(WTF::HashTable::remove):
(WTF::HashTable::removeWithoutEntryConsistencyCheck): Added.
2007-11-11 Mark Rowe <mrowe@apple.com>
Build fix. Use the correct filename case.
* kjs/nodes.h:
2007-11-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15902
15% of string-validate-input.js is spent compiling the same regular expression
Store a compiled representation of the regular expression in the AST.
Only a .2% SunSpider speedup overall, but a 10.6% speedup on
string-validate-input.js.
* kjs/nodes.cpp:
(KJS::RegExpNode::evaluate):
* kjs/nodes.h:
(KJS::RegExpNode::):
* kjs/nodes2string.cpp:
(KJS::RegExpNode::streamTo):
* kjs/regexp.cpp:
(KJS::RegExp::flags):
* kjs/regexp.h:
(KJS::RegExp::pattern):
* kjs/regexp_object.cpp:
(KJS::RegExpObjectImp::construct):
(KJS::RegExpObjectImp::createRegExpImp):
* kjs/regexp_object.h:
2007-11-11 Oliver Hunt <oliver@apple.com>
Reviewed by Eric.
Partial fix for <rdar://problem/5585334> numfuzz: integer overflows opening malformed SVG file in WebCore::ImageBuffer::create
Unfortunately this is a very slight regression, but is unavoidable.
* wtf/FastMalloc.cpp:
2007-11-10 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Add simple type inferencing to the parser, and create custom
AddNode and LessNode subclasses based on inferred types.
http://bugs.webkit.org/show_bug.cgi?id=15884
SunSpider claims this is at least a 0.5% speedup.
* JavaScriptCore.exp:
* kjs/grammar.y:
* kjs/internal.cpp:
(KJS::NumberImp::getPrimitiveNumber):
(KJS::GetterSetterImp::getPrimitiveNumber):
* kjs/internal.h:
* kjs/lexer.cpp:
(KJS::Lexer::lex):
* kjs/nodes.cpp:
(KJS::Node::Node):
(KJS::StringNode::evaluate):
(KJS::StringNode::evaluateToNumber):
(KJS::StringNode::evaluateToBoolean):
(KJS::RegExpNode::evaluate):
(KJS::UnaryPlusNode::optimizeVariableAccess):
(KJS::AddNode::evaluate):
(KJS::AddNode::evaluateToNumber):
(KJS::AddNumbersNode::inlineEvaluateToNumber):
(KJS::AddNumbersNode::evaluate):
(KJS::AddNumbersNode::evaluateToNumber):
(KJS::AddStringsNode::evaluate):
(KJS::AddStringLeftNode::evaluate):
(KJS::AddStringRightNode::evaluate):
(KJS::lessThan):
(KJS::lessThanEq):
(KJS::LessNumbersNode::evaluate):
(KJS::LessStringsNode::evaluate):
* kjs/nodes.h:
(KJS::ExpressionNode::):
(KJS::RegExpNode::):
(KJS::RegExpNode::precedence):
(KJS::TypeOfResolveNode::):
(KJS::LocalVarTypeOfNode::):
(KJS::UnaryPlusNode::):
(KJS::UnaryPlusNode::precedence):
(KJS::AddNode::):
(KJS::AddNode::precedence):
(KJS::AddNumbersNode::):
(KJS::AddStringLeftNode::):
(KJS::AddStringRightNode::):
(KJS::AddStringsNode::):
(KJS::LessNode::):
(KJS::LessNode::precedence):
(KJS::LessNumbersNode::):
(KJS::LessStringsNode::):
* kjs/nodes2string.cpp:
(KJS::StringNode::streamTo):
* kjs/object.cpp:
* kjs/object.h:
* kjs/value.h:
(KJS::JSValue::getPrimitiveNumber):
2007-11-11 Darin Adler <darin@apple.com>
- try another way of fixing dftables builds -- refactor pcre_internal.h a bit
* pcre/pcre_internal.h: Make most of this header do nothing when DFTABLES is set.
Later we can break it into two files.
* JavaScriptCore.vcproj/dftables/dftables.vcproj: Take out now-unneeded include paths.
* pcre/dftables.cpp: Set DFTABLES. Use delete instead of free.
* pcre/dftables.pro: Take out now-unneeded include paths.
* pcre/pcre_maketables.cpp: Use new instead of malloc.
2007-11-11 Darin Adler <darin@apple.com>
* pcre/dftables.pro: Try fixing Qt builds (I looked at qt-win) by adding
another include path.
2007-11-11 Darin Adler <darin@apple.com>
* JavaScriptCore.xcodeproj/project.pbxproj: Try fixing Mac Tiger builds
by adding another include path.
2007-11-11 Darin Adler <darin@apple.com>
Reviewed by Sam.
- http://bugs.webkit.org/show_bug.cgi?id=15924
next round of changes to JSRegExp (formerly PCRE)
This is a combination of converting to C++, tweaking the API, and adding
some additional optimizations.
Future steps will involve getting rid of the use of UTF-8 completely
(we'll use UTF-16 exclusively instead), eliminating more source files,
and some more speed-ups.
SunSpider says the current round is an 0.9% speed-up overall, and a
5.3% speed-up for regexp.
* JavaScriptCore.exp: Updated for new entry points.
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/dftables/dftables.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* jscore.bkl:
Updated for new source file names and ForwardingHeaders.
* kjs/regexp.cpp:
(KJS::RegExp::RegExp): Changed to use the error message without calling
strdup on it and to pass the new types and options.
(KJS::RegExp::~RegExp): Removed the now-unneeded free of the error message.
(KJS::RegExp::match): Pass the new types and options.
* kjs/regexp.h: Update type of m_constructionError.
* pcre/AUTHORS: Update to reflect the status of the project -- we don't include
the Google parts, and this isn't the PCRE library, per se.
* pcre/COPYING: Ditto.
* pcre/dftables.cpp: Copied from JavaScriptCore/pcre/dftables.c.
(main): Removed unneeded ctype_digit.
* pcre/pcre.h: Convert to C++, tweak API a bit. Use UChar instead of JSRegExpChar.
* pcre/pcre_compile.cpp: Copied from JavaScriptCore/pcre/pcre_compile.c.
Moved a lot of private stuff used only within this file here from pcre_internal.h.
Renumbered the error codes.
(error_text): Use a single string with embedded nulls for the error text (I got
this idea from newer versions of PCRE).
(check_escape): Changed return type to be enum instead of int. Replaced ctype_digit
uses with isASCIIDigit.
(is_counted_repeat): Ditto.
(read_repeat_counts): Ditto.
(first_significant_code): Ditto.
(find_fixedlength): Ditto.
(could_be_empty_branch): Ditto.
(compile_branch): Ditto. Also removed some code that handles changing options.
JavaScript doesn't have any of the features that allow options to change.
(compile_regex): Updated for change to options parameter.
(is_anchored): Ditto.
(find_firstassertedchar): Ditto.
(jsRegExpCompile): Changed to take separate flags instead of an options int.
Also changed to call new/delete instead of pcre_malloc/free.
(jsRegExpFree): Ditto.
* pcre/pcre_exec.cpp: Copied from JavaScriptCore/pcre/pcre_exec.c.
Added a case that uses computed goto for the opcode loop, but did not turn it on.
Changed the RMATCH macro to handle returns more efficiently by putting the where
pointer in the new frame instead of the old one, allowing us to branch to the
return with a single statement. Switched to new/delete from pcre_malloc/free.
Changed many RRETURN callers to not set the return value since it's already
set correctly. Replaced the rrc variable with an is_match variable. Values other
than "match" and "no match" are now handled differently. This allows us to remove
the code to check for those cases in various rules.
(match): All the case statements use a macro BEGIN_OPCODE instead. And all the
continue statements, or break statements that break out of the outer case use
a macro NEXT_OPCODE instead. Replaced a few if statements with assertions.
(jsRegExpExecute): Use new/delete instead of pcre_malloc/free. Removed unused
start_match field from the match block.
* pcre/pcre_internal.h: Moved the last few configuration macros from pcre-config.h
in here. Removed various unused types. Converted from JSRegExpChar to UChar.
Eliminated pcre_malloc/free. Replaced the opcode enum with a macro that can be
used in multiple places. Unfortunately we lose the comments for each opcode; we
should find a place to put those back. Removed ctype_digit.
* pcre/pcre_maketables.cpp: Copied from JavaScriptCore/pcre/pcre_maketables.c.
(pcre_maketables): Got rid of the conditional code that allows this to be compiled
in -- it's only used for dftables now (and soon may be obsolete entirely).
Changed code for cbit_digit to not use isdigit, and took the "_" case out of the
loop. Removed ctype_digit.
* pcre/pcre_ord2utf8.cpp: Copied from JavaScriptCore/pcre/pcre_ord2utf8.c.
* pcre/pcre_tables.cpp: Copied from JavaScriptCore/pcre/pcre_tables.c.
Moved _pcre_OP_lengths out of here into pcre_exec.cpp.
* pcre/pcre_ucp_searchfuncs.cpp: Copied from JavaScriptCore/pcre/pcre_ucp_searchfuncs.c.
Updated for other file name changes.
* pcre/pcre_xclass.cpp: Copied from JavaScriptCore/pcre/pcre_xclass.c.
* pcre/ucpinternal.h: Updated header.
* pcre/ucptable.cpp: Copied from JavaScriptCore/pcre/ucptable.c.
* wtf/ASCIICType.h: (WTF::isASCIIDigit): Removed a branch by changing from && to
& for this operation. Also added an overload that takes an int because that's
useful for PCRE. Later we could optimize for int and overload other functions in
this file; stuck to this simple one for now.
* wtf/unicode/icu/UnicodeIcu.h: Removed unused isUpper.
* wtf/unicode/qt4/UnicodeQt4.h: Ditto.
* pcre/LICENCE: Removed.
* pcre/pcre-config.h: Removed.
* wtf/FastMallocPCRE.cpp: Removed.
* pcre/dftables.c: Renamed to cpp.
* pcre/pcre_compile.c: Ditto.
* pcre/pcre_exec.c: Ditto.
* pcre/pcre_maketables.c: Ditto.
* pcre/pcre_ord2utf8.c: Ditto.
* pcre/pcre_tables.c: Ditto.
* pcre/pcre_ucp_searchfuncs.c: Ditto.
* pcre/pcre_xclass.c: Ditto.
* pcre/ucptable.c: Ditto.
2007-11-11 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
Add KJS_CHECKEXCEPTIONBOOLEAN to match rest of nodes.cpp
* kjs/nodes.cpp:
(KJS::ExpressionNode::evaluateToBoolean):
(KJS::LessNode::evaluateToBoolean):
(KJS::GreaterNode::evaluateToBoolean):
(KJS::LessEqNode::evaluateToBoolean):
(KJS::GreaterEqNode::evaluateToBoolean):
(KJS::InstanceOfNode::evaluateToBoolean):
(KJS::InNode::evaluateToBoolean):
(KJS::EqualNode::evaluateToBoolean):
(KJS::NotEqualNode::evaluateToBoolean):
(KJS::StrictEqualNode::evaluateToBoolean):
(KJS::NotStrictEqualNode::evaluateToBoolean):
(KJS::LogicalAndNode::evaluateToBoolean):
(KJS::LogicalOrNode::evaluateToBoolean):
(KJS::ConditionalNode::evaluateToBoolean):
2007-11-10 Darin Adler <darin@apple.com>
Reviewed by Sam.
- fix http://bugs.webkit.org/show_bug.cgi?id=15927
REGRESSION(r27487): delete a.c followed by __defineGetter__("c", ...) incorrectly deletes another property
and <rdar://problem/5586384> REGRESSION (r27487): Can't switch out of Edit HTML Source mode on Leopard Wiki
Test: fast/js/delete-then-put.html
* kjs/property_map.cpp:
(KJS::PropertyMap::put): Added a missing "- 1"; code to find an empty slot was not working.
(KJS::PropertyMap::checkConsistency): Added a missing range check that would have caught this
problem before.
- roll out a last-minute change to my evaluateToBoolean patch that was incorrect.
* kjs/nodes.h: (KJS::ExprStatementNode::ExprStatementNode): Take out call to
optimizeForUnnecessaryResult, since the result is used in some cases.
2007-11-10 Adam Roben <aroben@apple.com>
Windows build fix
Roll out some changes that were (seemingly accidentally) checked in
with r27664.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-11-10 Darin Adler <darin@apple.com>
Reviewed by Sam.
- http://bugs.webkit.org/show_bug.cgi?id=15915
add an evaluation path for booleans like the one we have for numbers
Gives 1.1% on SunSpider.
* kjs/grammar.y: Create TrueNode and FalseNode instead of BooleanNode.
* kjs/nodes.h: Changed to use Noncopyable. Moved optimizeForUnnecessaryResult
down from Node to ExpressionNode. Changed some classes to not inherit from
ExpressionNode where not necessary, and removed unnneeded evaluate functions
as well as evaluate functions that need not be virtual. Call the
optimizeForUnnecessaryResult function on the start of a for loop too.
* kjs/nodes.cpp:
(KJS::ExpressionNode::evaluateToBoolean): Added.
(KJS::FalseNode::evaluate): Added.
(KJS::TrueNode::evaluate): Added.
(KJS::NumberNode::evaluateToBoolean): Added.
(KJS::StringNode::evaluateToBoolean): Added.
(KJS::LocalVarAccessNode::evaluateToBoolean): Added.
(KJS::BracketAccessorNode::evaluateToBoolean): Added.
(KJS::LogicalNotNode::evaluate): Changed to call evaluateToBoolean.
(KJS::LogicalNotNode::evaluateToBoolean): Added.
(KJS::lessThan): Changed to return bool.
(KJS::lessThanEq): Ditto.
(KJS::LessNode::evaluate): Changed since lessThan returns bool.
(KJS::LessNode::evaluateToBoolean): Added.
(KJS::GreaterNode::evaluate): Changed since lessThanEq returns bool.
(KJS::GreaterNode::evaluateToBoolean): Added.
(KJS::LessEqNode::evaluate): Changed since lessThanEq returns bool.
(KJS::LessEqNode::evaluateToBoolean): Added.
(KJS::GreaterEqNode::evaluate): Changed since lessThan returns bool.
(KJS::GreaterEqNode::evaluateToBoolean): Added.
(KJS::InstanceOfNode::evaluateToBoolean): Added.
(KJS::InNode::evaluateToBoolean): Added.
(KJS::EqualNode::evaluateToBoolean): Added.
(KJS::NotEqualNode::evaluateToBoolean): Added.
(KJS::StrictEqualNode::evaluateToBoolean): Added.
(KJS::NotStrictEqualNode::evaluateToBoolean): Added.
(KJS::ConditionalNode::evaluate): Changed to call evaluateToBoolean.
(KJS::IfNode::execute): Ditto.
(KJS::DoWhileNode::execute): Ditto.
(KJS::WhileNode::execute): Ditto.
(KJS::ForNode::execute): Ditto.
* kjs/nodes2string.cpp:
(KJS::FalseNode::streamTo): Added.
(KJS::TrueNode::streamTo): Added.
2007-11-09 Adam Roben <aroben@apple.com>
Windows build fix
Reviewed by Darin.
* kjs/value.h:
(KJS::jsNumber): Add some explicit casts.
2007-11-08 Darin Adler <darin@apple.com>
- fix build
* kjs/grammar.y:
* kjs/nodes.h:
* kjs/property_map.cpp:
2007-11-08 Darin Adler <darin@apple.com>
- roll out accidentally-checked in changes
* kjs/nodes.cpp: Back to previous version.
* kjs/nodes.h: Ditto.
* kjs/grammar.y: Ditto.
2007-11-08 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15912
fasta spends a lot of time in qsort
* kjs/property_map.cpp:
(KJS::PropertyMap::getEnumerablePropertyNames):
Use insertion sort instead of qsort for small sets of property names.
We can probably do some even-better speedups of for/in, but this nets
0.6% overall and 6.7% on fasta.
2007-11-08 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15906
getting characters by indexing into a string is very slow
This fixes one source of the slowness -- the conversion to an unused
Identifier as we call the get function from the slot -- but doesn't
fix others, such as the fact that we have to allocate a new UString::Rep
for every single character.
Speeds up string-base64 30%, and at least 0.5% overall.
But does slow down access-fannkuch quite a bit. Might be worth
revisiting in the future to see what we can do about that (although
I did look at a profile for a while).
* kjs/property_slot.h: Add a new marker for "numeric" property slots;
slots where we don't need to pass the identifier to the get function.
(KJS::PropertySlot::getValue): Added code to call the numeric get function.
(KJS::PropertySlot::setCustomNumeric): Added.
* kjs/string_object.cpp:
(KJS::StringInstance::indexGetter): Changed to use substr() instead
of constructing a wholly new UString each time.
(KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but
takes advantage of setCustomNumeric to avoid creating an Identifier.
(KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric.
2007-11-08 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- http://bugs.webkit.org/show_bug.cgi?id=15904
more speed-ups possible by tightening up int version of JSImmediate
1% improvement of SunSpider
* kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template.
(KJS::JSImmediate::from): Overload for most numeric types; many types can
do fewer branches and checks.
(KJS::JSImmediate::getUInt32): Removed unneeded check for undefined.
(KJS::JSImmediate::getTruncatedInt32): Ditto.
(KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more
between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later.
* kjs/grammar.y: Update since fromDouble is now just from.
* kjs/nodes.h: Ditto.
* kjs/value.h: (KJS::jsNumber): Overload for most numeric types.
2007-11-08 Kevin Ollivier <kevino@theolliviers.com>
Bakefiles for building JavaScriptCore, needed by wx port.
Reviewed by Mark Rowe.
* JavaScriptCoreSources.bkl: Added.
* jscore.bkl: Added.
2007-11-08 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
The implementation of JSImmediate::areBothImmediateNumbers relies on
(JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having
a unique result when both immediate values are numbers.
The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
By swapping the value of NumberType and UndefinedType this ceases to be a problem.
* kjs/JSType.h:
(KJS::):
2007-11-08 Darin Adler <darin@apple.com>
- fix build
* kjs/nodes.h: Add missing parameter name.
2007-11-08 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Add ExpressionNode subclass of Node, use it.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ForInNode::ForInNode):
* kjs/nodes.h:
(KJS::ExpressionNode::):
(KJS::NullNode::):
(KJS::NullNode::precedence):
(KJS::BooleanNode::):
(KJS::BooleanNode::precedence):
(KJS::RegExpNode::):
(KJS::RegExpNode::precedence):
(KJS::ThisNode::):
(KJS::ThisNode::precedence):
(KJS::ResolveNode::):
(KJS::ElementNode::):
(KJS::ArrayNode::):
(KJS::PropertyNode::):
(KJS::PropertyNode::precedence):
(KJS::PropertyNode::name):
(KJS::PropertyListNode::):
(KJS::ObjectLiteralNode::):
(KJS::ObjectLiteralNode::precedence):
(KJS::BracketAccessorNode::):
(KJS::DotAccessorNode::):
(KJS::DotAccessorNode::precedence):
(KJS::ArgumentListNode::):
(KJS::ArgumentsNode::):
(KJS::NewExprNode::):
(KJS::NewExprNode::precedence):
(KJS::FunctionCallValueNode::):
(KJS::FunctionCallValueNode::precedence):
(KJS::FunctionCallResolveNode::):
(KJS::FunctionCallBracketNode::):
(KJS::FunctionCallBracketNode::precedence):
(KJS::FunctionCallDotNode::):
(KJS::FunctionCallDotNode::precedence):
(KJS::PrePostResolveNode::):
(KJS::PostfixBracketNode::):
(KJS::PostfixBracketNode::precedence):
(KJS::PostIncBracketNode::):
(KJS::PostIncBracketNode::isIncrement):
(KJS::PostDecBracketNode::):
(KJS::PostDecBracketNode::isIncrement):
(KJS::PostfixDotNode::):
(KJS::PostfixDotNode::precedence):
(KJS::PostIncDotNode::):
(KJS::PostIncDotNode::isIncrement):
(KJS::PostDecDotNode::):
(KJS::PostDecDotNode::isIncrement):
(KJS::PostfixErrorNode::):
(KJS::PostfixErrorNode::precedence):
(KJS::DeleteResolveNode::):
(KJS::DeleteBracketNode::):
(KJS::DeleteBracketNode::precedence):
(KJS::DeleteDotNode::):
(KJS::DeleteDotNode::precedence):
(KJS::DeleteValueNode::):
(KJS::DeleteValueNode::precedence):
(KJS::VoidNode::):
(KJS::VoidNode::precedence):
(KJS::TypeOfResolveNode::):
(KJS::TypeOfValueNode::):
(KJS::PrefixBracketNode::):
(KJS::PrefixBracketNode::precedence):
(KJS::PreIncBracketNode::):
(KJS::PreIncBracketNode::isIncrement):
(KJS::PreDecBracketNode::):
(KJS::PreDecBracketNode::isIncrement):
(KJS::PrefixDotNode::):
(KJS::PrefixDotNode::precedence):
(KJS::PreIncDotNode::):
(KJS::PreIncDotNode::isIncrement):
(KJS::PreDecDotNode::):
(KJS::PreDecDotNode::isIncrement):
(KJS::PrefixErrorNode::):
(KJS::PrefixErrorNode::precedence):
(KJS::UnaryPlusNode::):
(KJS::UnaryPlusNode::precedence):
(KJS::NegateNode::):
(KJS::NegateNode::precedence):
(KJS::BitwiseNotNode::):
(KJS::BitwiseNotNode::precedence):
(KJS::LogicalNotNode::):
(KJS::LogicalNotNode::precedence):
(KJS::AddNode::):
(KJS::AddNode::precedence):
(KJS::LeftShiftNode::):
(KJS::LeftShiftNode::precedence):
(KJS::RightShiftNode::):
(KJS::RightShiftNode::precedence):
(KJS::UnsignedRightShiftNode::):
(KJS::UnsignedRightShiftNode::precedence):
(KJS::LessNode::):
(KJS::LessNode::precedence):
(KJS::GreaterNode::):
(KJS::GreaterNode::precedence):
(KJS::LessEqNode::):
(KJS::LessEqNode::precedence):
(KJS::GreaterEqNode::):
(KJS::GreaterEqNode::precedence):
(KJS::InstanceOfNode::):
(KJS::InstanceOfNode::precedence):
(KJS::InNode::):
(KJS::InNode::precedence):
(KJS::EqualNode::):
(KJS::EqualNode::precedence):
(KJS::NotEqualNode::):
(KJS::NotEqualNode::precedence):
(KJS::StrictEqualNode::):
(KJS::StrictEqualNode::precedence):
(KJS::NotStrictEqualNode::):
(KJS::NotStrictEqualNode::precedence):
(KJS::BitAndNode::):
(KJS::BitAndNode::precedence):
(KJS::BitOrNode::):
(KJS::BitOrNode::precedence):
(KJS::BitXOrNode::):
(KJS::BitXOrNode::precedence):
(KJS::LogicalAndNode::):
(KJS::LogicalAndNode::precedence):
(KJS::LogicalOrNode::):
(KJS::LogicalOrNode::precedence):
(KJS::ConditionalNode::):
(KJS::ConditionalNode::precedence):
(KJS::ReadModifyResolveNode::):
(KJS::ReadModifyResolveNode::precedence):
(KJS::AssignResolveNode::):
(KJS::AssignResolveNode::precedence):
(KJS::ReadModifyBracketNode::):
(KJS::ReadModifyBracketNode::precedence):
(KJS::AssignBracketNode::):
(KJS::AssignBracketNode::precedence):
(KJS::AssignDotNode::):
(KJS::AssignDotNode::precedence):
(KJS::ReadModifyDotNode::):
(KJS::ReadModifyDotNode::precedence):
(KJS::AssignErrorNode::):
(KJS::AssignErrorNode::precedence):
(KJS::CommaNode::):
(KJS::CommaNode::precedence):
(KJS::AssignExprNode::):
(KJS::AssignExprNode::precedence):
(KJS::ExprStatementNode::):
(KJS::IfNode::):
(KJS::DoWhileNode::):
(KJS::WhileNode::):
(KJS::ReturnNode::):
(KJS::WithNode::):
(KJS::ThrowNode::):
(KJS::ParameterNode::):
(KJS::CaseClauseNode::):
(KJS::CaseClauseNode::precedence):
(KJS::ClauseListNode::):
(KJS::SwitchNode::):
2007-11-08 Oliver Hunt <oliver@apple.com>
Reviewed by Sam.
Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
This only improves bitwise-and performance, as the additional logic required
for similar code paths on or, xor, and shifting requires additional operations
and branches that negate (and in certain cases, regress) any advantage we might
otherwise receive.
This improves performance on all bitop tests, the cryptography tests, as well as
the string-base64 and string-unpack-code tests. No significant degradation on
any other tests.
* kjs/JSImmediate.h:
(KJS::JSImmediate::areBothImmediateNumbers):
(KJS::JSImmediate::andImmediateNumbers):
* kjs/nodes.cpp:
(KJS::BitAndNode::evaluate):
* kjs/value.h:
(KJS::jsNumberFromAnd):
2007-11-08 Adam Roben <aroben@apple.com>
Stop using KJS inside of MathExtras.h
Reviewed by Darin.
* wtf/MathExtras.h: Removed an unused header, and a now-unused
forward-declaration.
(wtf_atan2): Use std::numeric_limits intead of KJS.
2007-11-08 Sam Weinig <sam@webkit.org>
Windows build fix.
* kjs/date_object.cpp:
(KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
(KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
(KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
2007-11-08 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/lookup.h: Add missing include.
2007-11-08 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Convert JavaScript internal function objects to use one class per
function. This avoids a switch statement inside what used to be
the shared function classes and will allow Shark to better analyze
the code.
To make this switch, the value property of the HashEntry was changed
to a union of an intptr_t (which is used to continue handle valueGetters)
and function pointer which points to a static constructor for the
individual new function objects.
SunSpider claims this is a 1.0% speedup.
* kjs/array_object.cpp:
(KJS::ArrayPrototype::getOwnPropertySlot):
(KJS::getProperty):
(KJS::ArrayProtoFuncToString::callAsFunction):
(KJS::ArrayProtoFuncToLocaleString::callAsFunction):
(KJS::ArrayProtoFuncJoin::callAsFunction):
(KJS::ArrayProtoFuncConcat::callAsFunction):
(KJS::ArrayProtoFuncPop::callAsFunction):
(KJS::ArrayProtoFuncPush::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::ArrayProtoFuncForEach::callAsFunction):
(KJS::ArrayProtoFuncSome::callAsFunction):
(KJS::ArrayProtoFuncIndexOf::callAsFunction):
(KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
* kjs/array_object.h:
(KJS::ArrayPrototype::classInfo):
* kjs/create_hash_table:
* kjs/date_object.cpp:
(KJS::DatePrototype::getOwnPropertySlot):
(KJS::DateProtoFuncToString::callAsFunction):
(KJS::DateProtoFuncToUTCString::callAsFunction):
(KJS::DateProtoFuncToDateString::callAsFunction):
(KJS::DateProtoFuncToTimeString::callAsFunction):
(KJS::DateProtoFuncToLocaleString::callAsFunction):
(KJS::DateProtoFuncToLocaleDateString::callAsFunction):
(KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
(KJS::DateProtoFuncValueOf::callAsFunction):
(KJS::DateProtoFuncGetTime::callAsFunction):
(KJS::DateProtoFuncGetFullYear::callAsFunction):
(KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
(KJS::DateProtoFuncToGMTString::callAsFunction):
(KJS::DateProtoFuncGetMonth::callAsFunction):
(KJS::DateProtoFuncGetUTCMonth::callAsFunction):
(KJS::DateProtoFuncGetDate::callAsFunction):
(KJS::DateProtoFuncGetUTCDate::callAsFunction):
(KJS::DateProtoFuncGetDay::callAsFunction):
(KJS::DateProtoFuncGetUTCDay::callAsFunction):
(KJS::DateProtoFuncGetHours::callAsFunction):
(KJS::DateProtoFuncGetUTCHours::callAsFunction):
(KJS::DateProtoFuncGetMinutes::callAsFunction):
(KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
(KJS::DateProtoFuncGetSeconds::callAsFunction):
(KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
(KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
(KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
(KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
(KJS::DateProtoFuncSetTime::callAsFunction):
(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):
(KJS::DateProtoFuncSetYear::callAsFunction):
(KJS::DateProtoFuncGetYear::callAsFunction):
* kjs/date_object.h:
* kjs/lookup.cpp:
(KJS::Lookup::find):
* kjs/lookup.h:
(KJS::HashEntry::):
(KJS::staticFunctionGetter):
(KJS::staticValueGetter):
(KJS::getStaticPropertySlot):
(KJS::getStaticFunctionSlot):
(KJS::lookupPut):
* kjs/math_object.cpp:
(KJS::MathObjectImp::getOwnPropertySlot):
(KJS::MathProtoFuncAbs::callAsFunction):
(KJS::MathProtoFuncACos::callAsFunction):
(KJS::MathProtoFuncASin::callAsFunction):
(KJS::MathProtoFuncATan::callAsFunction):
(KJS::MathProtoFuncATan2::callAsFunction):
(KJS::MathProtoFuncCeil::callAsFunction):
(KJS::MathProtoFuncCos::callAsFunction):
(KJS::MathProtoFuncExp::callAsFunction):
(KJS::MathProtoFuncFloor::callAsFunction):
(KJS::MathProtoFuncLog::callAsFunction):
(KJS::MathProtoFuncMax::callAsFunction):
(KJS::MathProtoFuncMin::callAsFunction):
(KJS::MathProtoFuncPow::callAsFunction):
(KJS::MathProtoFuncRandom::callAsFunction):
(KJS::MathProtoFuncRound::callAsFunction):
(KJS::MathProtoFuncSin::callAsFunction):
(KJS::MathProtoFuncSqrt::callAsFunction):
(KJS::MathProtoFuncTan::callAsFunction):
* kjs/math_object.h:
(KJS::MathObjectImp::classInfo):
(KJS::MathObjectImp::):
* kjs/string_object.cpp:
(KJS::StringPrototype::getOwnPropertySlot):
(KJS::StringProtoFuncToString::callAsFunction):
(KJS::StringProtoFuncValueOf::callAsFunction):
(KJS::StringProtoFuncCharAt::callAsFunction):
(KJS::StringProtoFuncCharCodeAt::callAsFunction):
(KJS::StringProtoFuncConcat::callAsFunction):
(KJS::StringProtoFuncIndexOf::callAsFunction):
(KJS::StringProtoFuncLastIndexOf::callAsFunction):
(KJS::StringProtoFuncMatch::callAsFunction):
(KJS::StringProtoFuncSearch::callAsFunction):
(KJS::StringProtoFuncReplace::callAsFunction):
(KJS::StringProtoFuncSlice::callAsFunction):
(KJS::StringProtoFuncSplit::callAsFunction):
(KJS::StringProtoFuncSubstr::callAsFunction):
(KJS::StringProtoFuncSubstring::callAsFunction):
(KJS::StringProtoFuncToLowerCase::callAsFunction):
(KJS::StringProtoFuncToUpperCase::callAsFunction):
(KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
(KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
(KJS::StringProtoFuncLocaleCompare::callAsFunction):
(KJS::StringProtoFuncBig::callAsFunction):
(KJS::StringProtoFuncSmall::callAsFunction):
(KJS::StringProtoFuncBlink::callAsFunction):
(KJS::StringProtoFuncBold::callAsFunction):
(KJS::StringProtoFuncFixed::callAsFunction):
(KJS::StringProtoFuncItalics::callAsFunction):
(KJS::StringProtoFuncStrike::callAsFunction):
(KJS::StringProtoFuncSub::callAsFunction):
(KJS::StringProtoFuncSup::callAsFunction):
(KJS::StringProtoFuncFontcolor::callAsFunction):
(KJS::StringProtoFuncFontsize::callAsFunction):
(KJS::StringProtoFuncAnchor::callAsFunction):
(KJS::StringProtoFuncLink::callAsFunction):
* kjs/string_object.h:
2007-11-08 Adam Roben <aroben@apple.com>
Windows build fix
Reviewed by Sam and Ada.
* wtf/MathExtras.h: Get rid of a circular #include dependency to fix
the build.
2007-11-08 Adam Roben <aroben@apple.com>
Fix a precedence warning on Windows
* kjs/JSImmediate.h:
(KJS::JSImmediate::toBoolean):
2007-11-08 Mark Rowe <mrowe@apple.com>
Build fix for JavaScriptGlue.
* wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
2007-11-08 Darin Adler <darin@apple.com>
- Windows build fix
* kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
2007-11-08 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
we should now have faster array access, faster immediate to double conversion, and the
potential to further improve bitwise operators in future.
This also removes the need for unions to avoid strict aliasing problems when extracting
a value from immediates.
* kjs/JSImmediate.h:
(KJS::):
(KJS::JSImmediate::trueImmediate):
(KJS::JSImmediate::falseImmediate):
(KJS::JSImmediate::undefinedImmediate):
(KJS::JSImmediate::nullImmediate):
(KJS::JSImmediate::toBoolean):
* kjs/value.h:
(KJS::jsNaN):
2007-11-07 Eric Seidel <eric@webkit.org>
Reviewed by Darin and Oliver.
Add evaluateToNumber parallel evaluation tree to speed up number operations.
Make ImmediateNumberNode a subclass of NumberNode.
Share evaluate logic between evaluate and evaluateToNumber using inline functions
There is still a lot of improvement to be made here.
SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
Given the huge win that this prepares us for with simple type inferencing I see the small
regression in base64 being worth the substantial overall improvement.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::Node::evaluateToNumber):
(KJS::NumberNode::evaluate):
(KJS::NumberNode::evaluateToNumber):
(KJS::StringNode::evaluateToNumber):
(KJS::LocalVarAccessNode::inlineEvaluate):
(KJS::LocalVarAccessNode::evaluate):
(KJS::LocalVarAccessNode::evaluateToNumber):
(KJS::BracketAccessorNode::inlineEvaluate):
(KJS::BracketAccessorNode::evaluate):
(KJS::BracketAccessorNode::evaluateToNumber):
(KJS::NegateNode::evaluate):
(KJS::NegateNode::evaluateToNumber):
(KJS::MultNode::inlineEvaluateToNumber):
(KJS::MultNode::evaluate):
(KJS::MultNode::evaluateToNumber):
(KJS::DivNode::inlineEvaluateToNumber):
(KJS::DivNode::evaluate):
(KJS::DivNode::evaluateToNumber):
(KJS::ModNode::inlineEvaluateToNumber):
(KJS::ModNode::evaluate):
(KJS::ModNode::evaluateToNumber):
(KJS::throwOutOfMemoryErrorToNumber):
(KJS::addSlowCaseToNumber):
(KJS::add):
(KJS::addToNumber):
(KJS::AddNode::evaluateToNumber):
(KJS::SubNode::inlineEvaluateToNumber):
(KJS::SubNode::evaluate):
(KJS::SubNode::evaluateToNumber):
(KJS::valueForReadModifyAssignment):
(KJS::ReadModifyLocalVarNode::evaluate):
(KJS::ReadModifyResolveNode::evaluate):
(KJS::ReadModifyDotNode::evaluate):
(KJS::ReadModifyBracketNode::evaluate):
* kjs/nodes.h:
(KJS::Node::):
(KJS::NumberNode::):
(KJS::ImmediateNumberNode::):
(KJS::AddNode::precedence):
* kjs/nodes2string.cpp:
(KJS::NumberNode::streamTo):
2007-11-07 Mark Rowe <mrowe@apple.com>
Reviewed by Eric.
Fix up initialization after being mangled in r27572, and remove the
ternary expression as extraCost will always be zero for the numeric
heap.
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
2007-11-07 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/regexp_object.cpp:
2007-11-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Eliminated a bogus (though compiled-out) branch in the collector.
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
2007-11-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861
5.8% of string-validate-input.js is spent creating RegExpImps
Put RegExpImp properties into a static hashtable to avoid a slew of
PropertyMap churn when creating a RegExpImp.
Factored important bits of regular expression implementation out of
RegExpImp (the JS object) and into RegExp (the PCRE wrapper class),
making RegExp a ref-counted class. (This will help later.)
Removed PCRE_POSIX support because I didn't quite know how to test it
and keep it working with these changes.
1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
* kjs/regexp.h: A few interface changes:
1. Renamed "subpatterns()" => "numSubpatterns()"
2. Made flag enumeration private and replaced it with public getters for
specific flags.
3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
4. Made RegExp take a string of flags instead of an int, eliminating
duplicated flag parsing code elsewhere.
* kjs/regexp_object.cpp:
(KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile:
- Fixed a bug where compile(undefined) would throw an exception.
- Removed some now-redundant code.
- Used RegExp sharing to eliminate an allocation and a bunch of
PropertyMap thrash. (Not a big win since compile is a deprecated
function. I mainly did this to test the plubming.)
2007-11-07 Simon Hausmann <hausmann@kde.org>
Reviewed by nobody, Qt/Windows build fix.
JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
testkjs.pro, too, where it's included from.
* kjs/testkjs.pro:
2007-11-07 Simon Hausmann <shausman@trolltech.com>
Reviewed by Lars.
Fix "nmake clean" for the Qt/Windows build by replacing tmp/ with a variable that ends with the correct type of slash/backslash depending on the choice of compiler/make tool.
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-07 Lars Knoll <lars@trolltech.com>
Reviewed by Simon.
fix umemcasecmp
Pretty embarrassing bug. Has the potential to fix quite a few test failures.
* wtf/unicode/qt4/UnicodeQt4.h:
(WTF::Unicode::umemcasecmp):
2007-11-06 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- only collect when the heap is full, unless we have lots of extra cost garbage
1.1% SunSpider speedup.
This shouldn't hit memory use much since the extra space in those
blocks hangs around either way.
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
(KJS::Collector::collect): Fix logic error that reversed the sense of collect's
return value.
2007-11-06 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
'for (...; ...; ++<var>) ...'.
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
(KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
* kjs/nodes.h:
(KJS::PrePostResolveNode::):
(KJS::PostIncResolveNode::):
(KJS::PostIncLocalVarNode::):
(KJS::PostDecResolveNode::):
(KJS::PostDecLocalVarNode::):
(KJS::PreIncResolveNode::):
(KJS::PreDecResolveNode::):
(KJS::ForNode::ForNode):
2007-11-06 Eric Seidel <eric@webkit.org>
Reviewed by darin.
This fixes a regressed layout test for string + object
SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
* kjs/nodes.cpp:
(KJS::add): remove erroneous "fast path" for string + *
2007-11-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Added toJSNumber, a fast path for converting a JSValue to a JS number,
and deployed it in postfix expressions. In the fast case this
eliminates a call to jsNumber.
0.4% speedup on SunSpider.
* ChangeLog:
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::evaluate):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostDecResolveNode::evaluate):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::PostIncBracketNode::evaluate):
(KJS::PostDecBracketNode::evaluate):
(KJS::PostIncDotNode::evaluate):
(KJS::PostDecDotNode::evaluate):
(KJS::UnaryPlusNode::evaluate):
* kjs/value.h:
(KJS::JSValue::toJSNumber):
2007-11-06 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15846
REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
There was a mistake in the algorithm used to find an empty slot in the property
map entries vector; when we were putting in a new property value and not overwriting
an existing deleted sentinel, we would enlarge the entries vector, but would not
overwrite the stale data that's in the new part. It was easy to pin this down by
turning on property map consistency checks -- I never would have landed with this
bug if I had run the regression tests once with consistency checks on!
* kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
foundDeletedElement is false to always use the item at the end of the entries vector.
Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
2007-11-06 Oliver Hunt <oliver@apple.com>
RS=Darin.
Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
* kjs/nodes.cpp:
(KJS::add):
2007-11-06 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Replace boolean comparisons in AddNode with mask
comparisons for a 0.2% improvement in sunspider.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/nodes.cpp:
(KJS::add):
2007-11-06 Eric Seidel <eric@webkit.org>
Reviewed by darin.
SunSpider claims this is a 1.1% speedup.
* kjs/nodes.cpp:
(KJS::throwOutOfMemoryError): Added, non inline.
(KJS::addSlowCase): renamed from add(), non inline.
(KJS::add): add fast path for String + String, Number + Number and String + *
2007-11-06 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Avoid more UString creation.
SunSpider claims this is a 0.4% speedup.
* kjs/regexp_object.cpp:
(KJS::RegExpObjectImp::construct): use UString::find(UChar)
2007-11-05 Mark Rowe <mrowe@apple.com>
Mac build fix.
* kjs/array_object.cpp:
(KJS::ArrayProtoFunc::callAsFunction):
2007-11-05 Adam Roben <aroben@apple.com>
Windows build fix
* kjs/list.h:
2007-11-05 Mark Rowe <mrowe@apple.com>
Build fix. Add missing #include.
* kjs/operations.cpp:
2007-11-05 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Remove another call to toString(exec)
SunSpider claims this is a 0.5% speedup.
* kjs/operations.cpp:
(KJS::equal): remove another toString
2007-11-05 Eric Seidel <eric@webkit.org>
* kjs/operations.cpp:
(KJS::equal): correct broken change.
2007-11-05 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Remove one more call to toString(exec).
SunSpider claims this is a 0.7% speedup.
* kjs/operations.cpp:
(KJS::equal): remove a call to toString()
2007-11-05 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* pcre/pcre.pri:
2007-11-05 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/list.cpp:
2007-11-05 Geoffrey Garen <ggaren@apple.com>
Touched a file to test my new HTTP access.
* kjs/scope_chain.cpp:
2007-11-05 Alp Toker <alp@atoker.com>
Unreviewed build fix for qmake-based ports.
Someone with a better understanding of qmake still needs to sort out
the INCLUDEPATH/DEPENDPATH mess.
* JavaScriptCore.pri:
2007-11-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
http://bugs.webkit.org/show_bug.cgi?id=15835
Switched List implementation from a custom heap allocator to an inline
Vector, for a disappointing .5% SunSpider speedup.
Also renamed List::slice to List::getSlice because "get" is the
conventional prefix for functions returning a value through an out
parameter.
* kjs/array_object.cpp:
(KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
calls and memory accesses.
* kjs/bool_object.cpp:
(BooleanObjectImp::construct): Removed questionable use of iterator.
* kjs/list.cpp:
* kjs/list.h: New List class, implemented in terms of Vector. Two
interesting differences:
1. The inline capacity is 8, not 5. Many of the Lists constructed
during a SunSpider run are larger than 5; almost none are larger
than 8.
2. The growth factor is 4, not 2. Since we can guarantee that Lists
aren't long-lived, we can grow them more aggressively, to avoid
excessive copying.
* kjs/regexp_object.cpp:
(RegExpObjectImp::construct): Removed redundant function calls.
* kjs/string_object.cpp:
(KJS::StringObjectImp::construct): Removed questionable use of iterator.
* wtf/Vector.h:
(WTF::::uncheckedAppend): Added a fast, unchecked version of append.
2007-11-05 Mark Rowe <mrowe@apple.com>
Reviewed by Alp Toker.
Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-04 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15826
optimize opcode loop and case insensitive ASCII compares for a 30% speedup
SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
* pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
* pcre/pcre_compile.c:
(find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
added OP_NOT since there was no reason it should not be in here.
(could_be_empty_branch): Ditto.
(compile_branch): Streamlined all the single-character cases; there was a bit of
duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
But in particular, compile to those opcodes when the single character match is
ASCII.
(find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
* pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
the matchframe, after I discovered that none of them needed to be saved and restored
across recursive match calls. Also eliminated the ignored result field from the
matchframe, since I discovered that rrc ("recursive result code") was already the
exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
statement of the switch instead of doing them before the switch. This removes a
branch from each iteration of the opcode interpreter, just as removal of "op"
removed at least one store from each iteration. Last, but not least, add the
OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
surrogate pair and the letter case can be handled efficiently.
2007-11-04 Darin Adler <darin@apple.com>
* pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
2007-11-03 Darin Adler <darin@apple.com>
- fix non-Mac builds; remove some more unused PCRE stuff
* pcre/pcre_compile.c:
(compile_branch): Removed branch chain and some unused ESC values.
(compile_regex): Ditto.
(jsRegExpCompile): Ditto.
* pcre/pcre_exec.c:
(match): Removed unused branch targets. Don't use macros any more.
(jsRegExpExecute): More of the same.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
* JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
* pcre/pcre.pri: Ditto.
* pcre/MERGING: Removed.
* pcre/pcre_fullinfo.c: Removed.
* pcre/pcre_get.c: Removed.
* pcre/pcre_internal.h:
* pcre/ucp.h: Removed.
2007-11-03 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15821
remove unused PCRE features for speed
A first step toward removing the PCRE features we don't use.
This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
the SunSpider regular expression test.
Replaced the public interface with one that doesn't use the
name PCRE. Removed code we don't need for JavaScript and various
configurations we don't use. This is in preparation for still
more changes in the future. We'll probably switch to C++ and
make some even more significant changes to the regexp engine
to get some additional speed.
There's probably additional unused stuff that I haven't
deleted yet.
This does mean that our PCRE is now a fork, but I think that's
not really a big deal.
* JavaScriptCore.exp: Remove the 5 old entry points and add
the 3 new entry points for WebCore's direct use of the regular
expression engine.
* kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
its sense and now there's a USE(POSIX_REGEX) instead, which should
probably not be set by anyone. Maybe later we'll just get rid of it
altogether.
* kjs/regexp.h:
* kjs/regexp.cpp:
(KJS::RegExp::RegExp): Switch to new jsRegExp function names and
defines. Cut down on the number of functions used.
(KJS::RegExp::~RegExp): Ditto.
(KJS::RegExp::match): Ditto.
* pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
which are unused.
* pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
and JAVASCRIPT. These are all no longer configurable in our copy
of the library.
* pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
the include of <stdlib.h>, and most of the constants and
functions defined in this header. Changed the naming scheme to
use a JSRegExp prefix rather than a pcre prefix. In the future,
we'll probably change this to be a C++ header.
* pcre/pcre_compile.c: Removed all unused code branches,
including many whole functions and various byte codes.
Kept changes outside of removal to a minimum.
(check_escape):
(first_significant_code):
(find_fixedlength):
(find_recurse):
(could_be_empty_branch):
(compile_branch):
(compile_regex):
(is_anchored):
(is_startline):
(find_firstassertedchar):
(jsRegExpCompile): Renamed from pcre_compile2 and changed the
parameters around a bit.
(jsRegExpFree): Added.
* pcre/pcre_exec.c: Removed many unused opcodes and variables.
Also started tearing down the NO_RECURSE mechanism since it's
now the default. In some cases there were things in the explicit
frame that could be turned into plain old local variables and
other small like optimizations.
(pchars):
(match_ref):
(match): Changed parameters quite a bit since it's now not used
recursively.
(jsRegExpExecute): Renamed from pcre_exec.
* pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
_pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
* pcre/pcre_maketables.c: Changed to only compile in dftables.
Also got rid of many of the tables that we don't use.
* pcre/pcre_tables.c: Removed the unused Unicode property tables.
* pcre/pcre_ucp_searchfuncs.c: Removed everything except for
_pcre_ucp_othercase.
* pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
for classes based on Unicode properties.
* wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
to eliminate this completely, but we need the regular expression
code to be C++ first.
* pcre/pcre_fullinfo.c:
* pcre/pcre_get.c:
* pcre/ucp.h:
Files that are no longer needed. I didn't remove them with this
check-in, because I didn't want to modify all the project files.
2007-11-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Sam.
- remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
It turns out that doing this check costs more than it saves.
* kjs/JSImmediate.h:
(KJS::JSImmediate::fromDouble):
2007-11-03 Sam Weinig <sam@webkit.org>
Reviewed by Oliver.
Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
The variable had been kept around for binary compatibility, but since nothing
else is there is no point in continuing to keep it around.
* API/JSCallbackConstructor.cpp:
(KJS::):
* API/JSCallbackFunction.cpp:
(KJS::):
* API/JSCallbackObject.cpp:
(KJS::):
* bindings/objc/objc_runtime.mm:
* bindings/runtime_array.cpp:
* bindings/runtime_object.cpp:
* kjs/array_instance.cpp:
(KJS::):
* kjs/array_object.cpp:
(KJS::):
* kjs/bool_object.cpp:
* kjs/date_object.cpp:
(KJS::):
* kjs/error_object.cpp:
* kjs/function.cpp:
(KJS::):
* kjs/internal.cpp:
(KJS::):
* kjs/lookup.h:
* kjs/math_object.cpp:
* kjs/number_object.cpp:
* kjs/object.h:
* kjs/regexp_object.cpp:
* kjs/string_object.cpp:
(KJS::):
2007-11-03 Kevin McCullough <kmccullough@apple.com>
- Updated testkjs results to make the build bots green until we
can fix the tests that are failing. The new failures are in DST.
* tests/mozilla/expected.html:
2007-11-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Adam.
- don't print the var twice for ForInNodes with a var declaration
* kjs/nodes2string.cpp:
(KJS::ForInNode::streamTo):
2007-11-03 Darin Adler <darin@apple.com>
* pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
C-incompatible declaration.
2007-11-03 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/nodes.cpp: Add missing include.
2007-11-03 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=15814
<rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
These changes cause us to match the JavaScript specification and pass the
fast/js/kde/encode_decode_uri.html test.
* kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
new strict mode, throwing an exception if there are malformed UTF-16 surrogate
pairs in the text.
* kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
* kjs/ustring.cpp:
(KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
those might be illegal in some sense, they aren't supposed to get any special
handling in the place where this function is currently used.
(KJS::UString::UTF8String): Added the strictness.
2007-11-03 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15812
some JavaScript tests (from the Mozilla test suite) are failing
Two or three fixes get 7 more of the Mozilla tests passing.
This gets us down from 61 failing tests to 54.
* kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
Made this inline and gave it a more specific type. Some day we should
probably do that for all of these -- might even get a bit of a speed
boost from it.
* kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
inline in the header.
* kjs/regexp_object.h:
* kjs/regexp_object.cpp:
(KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
switch statement into the RegExpImp object, so they can be shared with
RegExpImp::callAsFunction.
(KJS::RegExpImp::match): Added. Common code used by both test and exec.
(KJS::RegExpImp::test): Added.
(KJS::RegExpImp::exec): Added.
(KJS::RegExpImp::implementsCall): Added.
(KJS::RegExpImp::callAsFunction): Added.
(KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
lastInput to null rather than empty string -- we take advantage of the
difference in RegExpImp::match.
(KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
just to get at a field like this.
* pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
the JavaScript specification. If there are not 4 hex digits after the \u,
then it's processed as if it wasn't an escape sequence at all.
* pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
for JavaScript (4 specific Unicode values).
* pcre/pcre_exec.c:
(match): Changed all call sites to use IS_NEWLINE.
(pcre_exec): Ditto.
* tests/mozilla/expected.html: Updated to expect 7 more successful tests.
2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
Sort files(...); sections of Xcode project files.
Rubber-stamped by Darin.
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-11-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::VarDeclNode::optimizeVariableAccess):
(KJS::VarDeclNode::getDeclarations):
(KJS::VarDeclNode::handleSlowCase):
(KJS::VarDeclNode::evaluateSingle):
(KJS::VarDeclNode::evaluate):
(KJS::VarStatementNode::execute):
* kjs/nodes.h:
(KJS::VarDeclNode::):
(KJS::VarStatementNode::):
* kjs/nodes2string.cpp:
(KJS::VarDeclNode::streamTo):
2007-11-03 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=15800
REGRESSION (r27303): RegExp leaks
* kjs/regexp_object.h:
(KJS::RegExpImp::setRegExp):
(KJS::RegExpImp::regExp):
(KJS::RegExpImp::classInfo):
* kjs/regexp_object.cpp:
(RegExpImp::RegExpImp):
(RegExpImp::~RegExpImp):
Renamed reg member variable to m_regExp, changed it to use OwnPtr.
2007-11-02 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::statementListPushFIFO):
(KJS::statementListGetDeclarations):
(KJS::statementListInitializeDeclarationStacks):
(KJS::statementListInitializeVariableAccessStack):
(KJS::statementListExecute):
(KJS::BlockNode::BlockNode):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::ProgramNode::ProgramNode):
* kjs/nodes.h:
(KJS::CaseClauseNode::):
2007-11-02 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15791
change property map data structure for less memory use, better speed
The property map now has an array of indices and a separate array of
property map entries. This slightly slows down lookup because of a second
memory acess, but makes property maps smaller and faster to iterate in
functions like mark().
SunSpider says this is 1.2% faster, although it makes the bitwise-end test
more than 10% slower. To fix that we'll need to optimize global variable lookup.
* kjs/property_map.cpp:
(KJS::PropertyMapEntry::PropertyMapEntry):
(KJS::PropertyMapHashTable::entries):
(KJS::PropertyMapHashTable::allocationSize):
(KJS::SavedProperties::SavedProperties):
(KJS::SavedProperties::~SavedProperties):
(KJS::PropertyMap::checkConsistency):
(KJS::PropertyMap::~PropertyMap):
(KJS::PropertyMap::clear):
(KJS::PropertyMap::get):
(KJS::PropertyMap::getLocation):
(KJS::PropertyMap::put):
(KJS::PropertyMap::insert):
(KJS::PropertyMap::createTable):
(KJS::PropertyMap::rehash):
(KJS::PropertyMap::remove):
(KJS::PropertyMap::mark):
(KJS::comparePropertyMapEntryIndices):
(KJS::PropertyMap::containsGettersOrSetters):
(KJS::PropertyMap::getEnumerablePropertyNames):
(KJS::PropertyMap::save):
(KJS::PropertyMap::restore):
* kjs/property_map.h:
2007-11-02 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15807
HashMap needs a take() function that combines get and remove
* wtf/HashMap.h: Added take function. Simplistic implementation for now,
but still does only one hash table lookup.
* kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
a find followed by a remove.
2007-11-02 David Carson <dacarson@gmail.com>
Reviewed by Darin.
Fix compiler warning "warning: suggest parentheses around && within ||"
http://bugs.webkit.org/show_bug.cgi?id=15764
* kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
2007-11-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
In preparation for making List a simple stack-allocated Vector:
Removed all instances of List copying and/or assignment, and made List
inherit from Noncopyable.
Functions that used to return a List by copy now take List& out
parameters.
Layout tests and JS tests pass.
* kjs/list.cpp:
(KJS::List::slice): Replaced copyTail with a more generic slice
alternative. (JavaScriptCore only calls slice(1), but WebCore calls
slice(2)).
2007-11-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
REGRESSION(r27344): Crash on load at finance.yahoo.com
Reverted a small portion of my last check-in. (The speedup and the List
removal are still there, though.)
ActivationImp needs to hold a pointer to its function, and mark that
pointer (rather than accessing its function through its ExecState, and
counting on the active scope to mark its function) because a closure
can cause an ActivationImp to outlive its ExecState along with any
active scope.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
* kjs/function.cpp:
(KJS::FunctionImp::~FunctionImp):
(KJS::ActivationImp::ActivationImp):
* kjs/function.h:
(KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
Also made HashTable a little more crash-happy in debug builds, so
problems like this will show up earlier:
* wtf/HashTable.h:
(WTF::HashTable::~HashTable):
2007-11-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Adam Roben.
Addressed some of Darin's review comments.
Used perl -p, which is the shorthand while(<>) {}.
Made sure not to suppress bison's output.
Added line to removed bison_out.txt, since this script removes other
intermediate files, too.
* DerivedSources.make:
2007-11-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Removed List from ActivationImp, in preparation for making all lists
stack-allocated.
Tests pass.
1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
(KJS::ExecState::~ExecState):
* kjs/function.cpp:
(KJS::ActivationImp::ActivationImp):
(KJS::ActivationImp::createArgumentsObject):
* kjs/function.h:
(KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
2007-11-01 Adam Roben <aroben@apple.com>
Use jsNumberCell instead of jsNumber when converting double constants to JSValues
This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
It also gets rid of an MSVC warning that we previously had to silence.
Reviewed by Geoff.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
back on the "overflow in constant arithmetic" warning.
* kjs/number_object.cpp:
(NumberObjectImp::getValueProperty): Use jsNumberCell instead of
jsNumber.
2007-10-31 Adam Roben <aroben@apple.com>
Windows build fix
* kjs/ExecState.h:
2007-10-31 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- shave some cycles off of local storage access for a 1% SunSpider speedup
Keep the LocalStorage pointer in the ExecState, instead of getting
it from the ActivationImp all the time.
* kjs/ExecState.cpp:
(KJS::ExecState::updateLocalStorage):
* kjs/ExecState.h:
(KJS::ExecState::localStorage):
* kjs/nodes.cpp:
(KJS::LocalVarAccessNode::evaluate):
(KJS::LocalVarFunctionCallNode::evaluate):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::LocalVarTypeOfNode::evaluate):
(KJS::PreIncLocalVarNode::evaluate):
(KJS::PreDecLocalVarNode::evaluate):
(KJS::ReadModifyLocalVarNode::evaluate):
(KJS::AssignLocalVarNode::evaluate):
(KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2007-10-31 Adam Roben <aroben@apple.com>
Fix a crash on launch due to a static initializer race
We now use fast inline assembler spinlocks which can be statically
initialized at compile time.
As a side benefit, this speeds up SunSpider by 0.4%.
Reviewed by Oliver.
* wtf/FastMalloc.cpp:
* wtf/TCSpinLock.h:
(TCMalloc_SpinLock::Lock):
(TCMalloc_SpinLock::Unlock):
(TCMalloc_SlowLock):
* wtf/TCSystemAlloc.cpp:
2007-10-31 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam.
- Corrected spelling.
* wtf/HashTraits.h:
2007-10-31 Mark Rowe <mrowe@apple.com>
Further Gtk build fixage.
* kjs/regexp_object.cpp:
2007-10-31 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/regexp.h:
2007-10-31 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=15749
RegExp/RegExpObjectImp cause needless UString creation
Speeds things up 0.4% according to SunSpider.
* kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
because this library doesn't use the real PCRE -- it uses its
own PCRE that works on UTF-16.
* kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
Use Noncopyable. Change the return value of match.
* kjs/regexp.cpp:
(KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
(KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
(KJS::RegExp::match): Change to return the position as an int and the
ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
* kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
require a result string.
* kjs/regexp_object.cpp:
(RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
(RegExpObjectImp::performMatch): Change so it doesn't return a string.
(RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
the main result with the backreferences; now it doesn't need to take
a result parameter.
(RegExpObjectImp::getBackref): Minor tweaks.
(RegExpObjectImp::getLastParen): Ditto.
(RegExpObjectImp::getLeftContext): Ditto.
(RegExpObjectImp::getRightContext): Ditto.
(RegExpObjectImp::getValueProperty): Change LastMatch case to call
getBackref(0) so we don't need a separate getLastMatch function.
* kjs/string_object.cpp:
(KJS::replace): Update to use new performMatch, including merging the
matched string section with the other substrings.
(KJS::StringProtoFunc::callAsFunction): Update functions to use the
new performMatch and match. Also change to use OwnArrayPtr.
2007-10-31 Oliver Hunt <oliver@apple.com>
* kjs/nodes.h: include OwnPtr.h
2007-10-31 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::statementListPushFIFO):
(KJS::statementListGetDeclarations):
(KJS::statementListInitializeDeclarationStacks):
(KJS::statementListInitializeVariableAccessStack):
(KJS::statementListExecute):
(KJS::BlockNode::optimizeVariableAccess):
(KJS::BlockNode::BlockNode):
(KJS::BlockNode::getDeclarations):
(KJS::BlockNode::execute):
(KJS::CaseClauseNode::optimizeVariableAccess):
(KJS::CaseClauseNode::getDeclarations):
(KJS::CaseClauseNode::evalStatements):
(KJS::FunctionBodyNode::initializeDeclarationStacks):
(KJS::FunctionBodyNode::optimizeVariableAccess):
* kjs/nodes.h:
* kjs/nodes2string.cpp:
(KJS::statementListStreamTo):
(KJS::BlockNode::streamTo):
(KJS::CaseClauseNode::streamTo):
2007-10-30 Mark Rowe <mrowe@apple.com>
* kjs/property_map.cpp: Added a missing using directive to fix the build
for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
2007-10-31 Maciej Stachowiak <mjs@apple.com>
* kjs/property_map.cpp: Include HashTable.h the right way to fix the build
for non-Mac ports.
2007-10-31 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=11001
WebKit doesn't support RegExp.compile method
Test: fast/js/regexp-compile.html
* kjs/regexp_object.cpp:
(RegExpPrototype::RegExpPrototype):
(RegExpProtoFunc::callAsFunction):
* kjs/regexp_object.h:
(KJS::RegExpProtoFunc::):
Added RegExp.compile.
* tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
2007-10-31 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
Integer divide sucks. Fortunately, a bunch of shifts and XORs
biased towards the high bits is sufficient to provide a good
double hash. Besides the SunSpider win, I used the dump statistics
mode for both to verify that collisions did not increase and that
the longest collision chain is not any longer.
* kjs/property_map.cpp:
(KJS::doubleHash):
(KJS::PropertyMap::get):
(KJS::PropertyMap::getLocation):
(KJS::PropertyMap::put):
(KJS::PropertyMap::insert):
(KJS::PropertyMap::remove):
(KJS::PropertyMap::checkConsistency):
* wtf/HashTable.h:
(WTF::doubleHash):
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
2007-10-30 Adam Roben <aroben@apple.com>
* kjs/collector.h: Make HeapType public so it can be used for non-member
things like the HeapConstants struct template. Fixes the build on Windows.
2007-10-30 Adam Roben <aroben@apple.com>
Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
Speeds up SunSpider by 0.4%.
Reviewed by Steve and Maciej.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
a warning during LTCG in release builds about double -> float
conversion.
* wtf/AlwaysInline.h:
* wtf/FastMalloc.h:
2007-10-30 Adam Roben <aroben@apple.com>
Use GetCurrentThreadId instead of pthread_self in FastMalloc
Speeds up SunSpider by 0.3%.
Reviewed by Steve.
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_ThreadCache::InitTSD):
(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2007-10-30 Adam Roben <aroben@apple.com>
Switch to a Win32 critical section implementation of spinlocks
Speeds up SunSpider by 0.4%.
Reviewed by Steve.
* wtf/FastMalloc.cpp:
* wtf/TCSpinLock.h:
(TCMalloc_SpinLock::TCMalloc_SpinLock):
(TCMalloc_SpinLock::Init):
(TCMalloc_SpinLock::Finalize):
(TCMalloc_SpinLock::Lock):
(TCMalloc_SpinLock::Unlock):
* wtf/TCSystemAlloc.cpp:
2007-10-30 Adam Roben <aroben@apple.com>
Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
http://bugs.webkit.org/show_bug.cgi?id=15586
Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
Use Win32 TLS functions instead of __declspec(thread), which breaks
delay-loading.
Reviewed by Steve.
* wtf/FastMalloc.cpp:
(WTF::getThreadHeap):
(WTF::TCMalloc_ThreadCache::InitModule):
2007-10-30 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- allocate numbers in half-size cells, for an 0.5% SunSpider speedup
http://bugs.webkit.org/show_bug.cgi?id=15772
We do this by using a single mark bit per two number cells, and
tweaking marking.
Besides being an 0.5% win overall, this is a 7.1% win on morph.
* kjs/collector.cpp:
(KJS::):
(KJS::Collector::heapAllocate):
(KJS::Collector::markStackObjectsConservatively):
(KJS::Collector::sweep):
* kjs/collector.h:
(KJS::SmallCollectorCell::):
2007-10-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Adam Roben, Sam Weinig.
Made conflicts in grammar.y a persistent build failure.
* DerivedSources.make:
2007-10-30 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam and Geoff.
- Added a new cast so all the casts are in the same place.
* API/APICast.h:
(toGlobalRef):
2007-10-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
JS tests, including
ecma_2/Statements/dowhile-001.js
ecma_2/Statements/dowhile-002.js
ecma_2/Statements/dowhile-003.js
ecma_2/Statements/dowhile-004.js
ecma_2/Statements/dowhile-005.js
ecma_2/Statements/dowhile-006.js
ecma_2/Statements/dowhile-007.js
js1_2/statements/do_while.js
and layout tests, including
do-while-expression-value.html
do-while-semicolon.html
do-while-without-semicolon.html
pass.
* kjs/grammar.y: Use the explicit "error" production, as we do with other
automatic semicolon insertions, to disambiguate "do { } while();" from
"do { } while()" followed by ";" (the empty statement).
2007-10-29 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Debranching remaining assignment nodes, and miscellaneous cleanup
Split read-modify code paths out of AssignBracketNode and AssignDotNode
Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
and ReadModifyResolveNode evaluate methods
Leads to a 1% gain in SunSpider.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ReadModifyLocalVarNode::evaluate):
(KJS::ReadModifyResolveNode::evaluate):
(KJS::AssignDotNode::evaluate):
(KJS::ReadModifyDotNode::optimizeVariableAccess):
(KJS::ReadModifyDotNode::evaluate):
(KJS::AssignBracketNode::evaluate):
(KJS::ReadModifyBracketNode::optimizeVariableAccess):
(KJS::ReadModifyBracketNode::evaluate):
* kjs/nodes.h:
(KJS::AssignBracketNode::):
(KJS::AssignBracketNode::precedence):
(KJS::AssignDotNode::):
(KJS::AssignDotNode::precedence):
* kjs/nodes2string.cpp:
(KJS::ReadModifyBracketNode::streamTo):
(KJS::AssignBracketNode::streamTo):
(KJS::ReadModifyDotNode::streamTo):
(KJS::AssignDotNode::streamTo):
2007-10-29 Oliver Hunt <oliver@apple.com>
Debranching various Node::evaluate implementations
Reviewed by Maciej.
Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
Gains 1.6% on SunSpider
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::optimizeVariableAccess):
(KJS::PostIncResolveNode::evaluate):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostDecResolveNode::optimizeVariableAccess):
(KJS::PostDecResolveNode::evaluate):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::PostIncBracketNode::evaluate):
(KJS::PostDecBracketNode::evaluate):
(KJS::PostIncDotNode::evaluate):
(KJS::PostDecDotNode::evaluate):
(KJS::PreIncResolveNode::optimizeVariableAccess):
(KJS::PreIncLocalVarNode::evaluate):
(KJS::PreIncResolveNode::evaluate):
(KJS::PreDecResolveNode::optimizeVariableAccess):
(KJS::PreDecLocalVarNode::evaluate):
(KJS::PreDecResolveNode::evaluate):
(KJS::PreIncBracketNode::evaluate):
(KJS::PreDecBracketNode::evaluate):
(KJS::PreIncDotNode::evaluate):
(KJS::PreDecDotNode::evaluate):
(KJS::ReadModifyResolveNode::optimizeVariableAccess):
(KJS::AssignResolveNode::optimizeVariableAccess):
(KJS::AssignLocalVarNode::evaluate):
(KJS::AssignResolveNode::evaluate):
* kjs/nodes.h:
(KJS::PostDecResolveNode::):
(KJS::PostDecResolveNode::precedence):
(KJS::PostDecLocalVarNode::):
(KJS::PostfixBracketNode::):
(KJS::PostfixBracketNode::precedence):
(KJS::PostIncBracketNode::):
(KJS::PostIncBracketNode::isIncrement):
(KJS::PostDecBracketNode::):
(KJS::PostDecBracketNode::isIncrement):
(KJS::PostfixDotNode::):
(KJS::PostfixDotNode::precedence):
(KJS::PostIncDotNode::):
(KJS::PostIncDotNode::isIncrement):
(KJS::PostDecDotNode::):
(KJS::PreIncResolveNode::):
(KJS::PreDecResolveNode::):
(KJS::PreDecResolveNode::precedence):
(KJS::PreDecLocalVarNode::):
(KJS::PrefixBracketNode::):
(KJS::PrefixBracketNode::precedence):
(KJS::PreIncBracketNode::):
(KJS::PreIncBracketNode::isIncrement):
(KJS::PreDecBracketNode::):
(KJS::PreDecBracketNode::isIncrement):
(KJS::PrefixDotNode::):
(KJS::PrefixDotNode::precedence):
(KJS::PreIncDotNode::):
(KJS::PreIncDotNode::isIncrement):
(KJS::PreDecDotNode::):
(KJS::ReadModifyResolveNode::):
(KJS::ReadModifyLocalVarNode::):
(KJS::AssignResolveNode::):
(KJS::AssignResolveNode::precedence):
* kjs/nodes2string.cpp:
(KJS::PostIncResolveNode::streamTo):
(KJS::PostDecResolveNode::streamTo):
(KJS::PostfixBracketNode::streamTo):
(KJS::PostfixDotNode::streamTo):
(KJS::PreIncResolveNode::streamTo):
(KJS::PreDecResolveNode::streamTo):
(KJS::ReadModifyResolveNode::streamTo):
(KJS::AssignResolveNode::streamTo):
2007-10-29 Maciej Stachowiak <mjs@apple.com>
Not reviewed, build fix.
- Include Vector.h in a way that actually works.
* kjs/LocalStorage.h:
2007-10-29 Maciej Stachowiak <mjs@apple.com>
Not reviewed, build fix.
- Install LocalStorage.h as a private header.
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-10-29 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/LocalStorage.h: Added.
(KJS::LocalStorageEntry::LocalStorageEntry):
(WTF::):
* kjs/function.h:
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2007-10-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Some small tweaks that I notice while reviewing Oliver's last patch.
Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
No change in SunSpider because SunSpider doesn't take the code path that
would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
* kjs/nodes.cpp:
(KJS::LocalVarPostfixNode::evaluate):
(KJS::TypeOfResolveNode::optimizeVariableAccess):
(KJS::LocalVarTypeOfNode::evaluate):
(KJS::PrefixResolveNode::optimizeVariableAccess):
(KJS::LocalVarPrefixNode::evaluate):
(KJS::AssignResolveNode::optimizeVariableAccess):
(KJS::LocalVarAssignNode::evaluate):
* kjs/nodes.h:
(KJS::LocalVarTypeOfNode::):
(KJS::PrefixResolveNode::):
(KJS::LocalVarPrefixNode::):
(KJS::AssignResolveNode::):
(KJS::LocalVarAssignNode::):
2007-10-29 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
SunSpider claims this was a 0.7% speedup.
* kjs/string_object.cpp:
(KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
2007-10-29 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark.
- re-enable asserts for access to empty or deleted keys
* wtf/HashTable.h:
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
2007-10-29 Eric Seidel <eric@webkit.org>
Build fix only, no review.
* JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
2007-10-29 Mark Rowe <mrowe@apple.com>
Gtk build fix. Move struct declarations into nodes.h.
* kjs/grammar.y:
* kjs/nodes.h:
2007-10-29 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
Make it a compile time error to use toString(ExecState) on a StringInstance
SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
* kjs/internal.h:
(KJS::StringImp::getLength):
* kjs/string_object.cpp:
(KJS::StringInstance::lengthGetter):
(KJS::StringInstance::inlineGetOwnPropertySlot):
(KJS::StringInstance::getOwnPropertySlot):
* kjs/string_object.h:
2007-10-28 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Add nodes to allow Assignment, TypeOf, and prefix operators to
make use of the new optimised local variable look up.
5% gain on sunspider
* kjs/nodes.cpp:
(KJS::TypeOfResolveNode::optimizeVariableAccess):
(KJS::LocalTypeOfAccessNode::evaluate):
(KJS::PrefixResolveNode::optimizeVariableAccess):
(KJS::PrefixLocalAccessNode::evaluate):
(KJS::AssignResolveNode::optimizeVariableAccess):
(KJS::AssignLocalAccessNode::evaluate):
* kjs/nodes.h:
(KJS::TypeOfResolveNode::):
(KJS::TypeOfResolveNode::precedence):
(KJS::LocalTypeOfAccessNode::):
(KJS::PrefixResolveNode::):
(KJS::PrefixResolveNode::precedence):
(KJS::PrefixLocalAccessNode::):
(KJS::AssignResolveNode::):
(KJS::AssignLocalAccessNode::):
2007-10-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
http://bugs.webkit.org/show_bug.cgi?id=15748
Not a significant speedup or slowdown on SunSpider.
* kjs/Parser.cpp:
(KJS::clearNewNodes):
* kjs/Parser.h:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::BlockNode::BlockNode):
(KJS::CaseBlockNode::CaseBlockNode):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::SourceElementsNode::SourceElementsNode):
(KJS::ProgramNode::ProgramNode):
* kjs/nodes.h:
(KJS::ElementNode::):
(KJS::ArrayNode::):
(KJS::PropertyListNode::):
(KJS::ObjectLiteralNode::):
(KJS::ArgumentListNode::):
(KJS::ArgumentsNode::):
(KJS::VarDeclListNode::):
(KJS::VarStatementNode::):
(KJS::ForNode::):
(KJS::ParameterNode::):
(KJS::FuncExprNode::):
(KJS::FuncDeclNode::):
(KJS::SourceElementsNode::):
(KJS::CaseClauseNode::):
(KJS::ClauseListNode::):
2007-10-28 Mark Rowe <mrowe@apple.com>
Disable assertions in a manner that doesn't break the Qt Windows build.
* wtf/HashTable.h:
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Temporarily disabling some ASSERTs I introduced in my last check-in
because of http://bugs.webkit.org/show_bug.cgi?id=15747
Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
* wtf/HashTable.h:
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
#ifndef ASSERT_DISABLED is no good!
Replaced with #if !ASSERT_DISABLED.
* wtf/HashTable.h:
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
to the AST transfom that replaces slow resolve nodes with fast local
variable alternatives.
2.5% speedup on SunSpider.
Also added some missing copyright notices.
* kjs/nodes.cpp:
(KJS::FunctionCallResolveNode::optimizeVariableAccess):
(KJS::FunctionCallResolveNode::evaluate):
(KJS::LocalVarFunctionCallNode::evaluate):
(KJS::PostfixResolveNode::optimizeVariableAccess):
(KJS::PostfixResolveNode::evaluate):
(KJS::LocalVarPostfixNode::evaluate):
(KJS::DeleteResolveNode::optimizeVariableAccess):
(KJS::DeleteResolveNode::evaluate):
(KJS::LocalVarDeleteNode::evaluate):
* kjs/nodes.h:
(KJS::FunctionCallResolveNode::):
(KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
(KJS::PostfixResolveNode::):
(KJS::LocalVarPostfixNode::LocalVarPostfixNode):
(KJS::DeleteResolveNode::):
(KJS::LocalVarDeleteNode::LocalVarDeleteNode):
2007-10-28 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
Add virtual keyword to a few virtual functions previously unmarked.
* kjs/internal.h:
(KJS::StringImp::type):
(KJS::NumberImp::type):
* kjs/ustring.h:
(KJS::UString::Rep::deref):
2007-10-28 Darin Adler <darin@apple.com>
- fix "broken everything" from the storage leak fix
* wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
* kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
2007-10-28 Darin Adler <darin@apple.com>
Reviewed by Adam.
- turn on unused parameter waring on Mac OS X because it's already on elsewhere
* Configurations/Base.xcconfig: Took out -wno-unused-parameter.
* API/JSNode.c:
* API/JSNodeList.c:
* API/minidom.c:
* API/testapi.c:
Fixed unused variables by using them or marked them with UNUSED_PARAM.
* kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
Removed parameter names to indicate they are unused.
2007-10-28 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix a storage leak where we ref the UString every time we replace
a ResolveNode with a LocalVarAccessNode
* kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
that takes PlacementNewAdopt.
* kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
with PlacementNewAdopt instead of the old value of ident.
* kjs/ustring.h: (KJS::UString::UString): Added a constructor that
takes PlacementNewAdopt.
2007-10-28 Darin Adler <darin@apple.com>
- Windows build fix; get rid of unused parameter
* kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
* kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
The assertions weren't all that helpful.
2007-10-28 Mark Rowe <mrowe@apple.com>
Gtk build fix. Add include of MathExtras.h.
* kjs/string_object.cpp:
2007-10-28 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej and Tim.
Replace uses of isNaN and isInf with isnan and isinf, and
remove isNaN and isInf.
* kjs/config.h: Remove unused HAVE_'s.
* kjs/date_object.cpp:
(KJS::DateInstance::getTime):
(KJS::DateInstance::getUTCTime):
(KJS::DateProtoFunc::callAsFunction):
(KJS::DateObjectImp::construct):
(KJS::DateObjectFuncImp::callAsFunction):
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction):
* kjs/math_object.cpp:
(MathFuncImp::callAsFunction):
* kjs/nodes2string.cpp:
(KJS::isParserRoundTripNumber):
* kjs/number_object.cpp:
(NumberProtoFunc::callAsFunction):
* kjs/operations.cpp:
* kjs/operations.h:
* kjs/string_object.cpp:
(KJS::StringProtoFunc::callAsFunction):
* kjs/ustring.cpp:
(KJS::UString::from):
* kjs/value.cpp:
(KJS::JSValue::toInteger):
(KJS::JSValue::toInt32SlowCase):
(KJS::JSValue::toUInt32SlowCase):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Build fix: use the new-fangled missingSymbolMarker().
* kjs/nodes.cpp:
(KJS::ResolveNode::optimizeVariableAccess):
* kjs/nodes.h:
(KJS::LocalVarAccessNode::LocalVarAccessNode):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak, Darin Adler.
Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
Cameron Zwarich.
AST transfom to replace slow resolve nodes with fast local variable
alternatives that do direct memory access. Currently, only ResolveNode
provides a fast local variable alternative. 6 others are soon to come.
16.7% speedup on SunSpider.
Most of this patch is just scaffolding to support iterating all the
resolve nodes in the AST through optimizeResolveNodes(). In
optimizeResolveNodes(), most classes just push their child nodes onto
the processing stack, while ResolveNodes actually replace themselves in
the tree with more optimized alternatives, if possible.
Here are the interesting bits:
* kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
in Node and ResolveNode. This tag allows you to use placement new to
swap out a base class Node in favor of a subclass copy that holds the
same data. (Without this tag, default initialization would NULL out
RefPtrs, change line numbers, etc.)
* kjs/nodes.cpp:
(KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
that the fast path is impossible, to make sure we didn't leave anything
on the table.
(KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
transformation happens.
(KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
optimization happens.
* kjs/function.h: Added symbolTable() accessor for, for the sake of
an ASSERT.
2007-10-28 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej.
Fix "AllInOneFile.o has a global initializer in it".
Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
We can avoid this by moving it inside an inline function.
* kjs/SymbolTable.h:
(KJS::missingSymbolMarker):
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot):
(KJS::ActivationImp::put):
2007-10-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark.
- Added assertions to protect against adding empty or deleted keys to a HashTable
* wtf/HashTable.h:
(WTF::HashTable::lookup):
(WTF::HashTable::lookupForWriting):
(WTF::HashTable::fullLookupForWriting):
(WTF::HashTable::add):
2007-10-28 Darin Adler <darin@apple.com>
- fix GTK build
* kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
Use isNaN and isInf instead of isnan and isinf.
2007-10-28 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15735
remove GroupNode to simplify AST and possibly get a modest speedup
This patch removes 4 node types: GroupNode, PropertyNameNode,
FunctionCallParenBracketNode, and FunctionCallParenDotNode.
To remove GroupNode, we add knowledge of precedence to the tree nodes,
and use that when serializing to determine where parentheses are needed.
This means we no longer have to represent parentheses in the tree.
The precedence values are named after productions in the grammar from the
JavaScript standard.
SunSpider says this is an 0.4% speedup.
* kjs/function.h:
* kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
serialization, so I moved it to the file that takes care of that.
* kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
indicate failure instead of a separate boolean. Got rid of PropertyNameNode
by merging the PropertyName rule into the Property rule (which was easier
than figuring out how to pass the Identifier from one node to another).
Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
and FunctionCallParenDotNode.
* kjs/nodes.h: Removed unused forward declarations and Operator values.
Added Precedence enum, and precedence function to all nodes. Removed
nodeInsideAllParens. Added streamBinaryOperator function for serialization.
Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
* kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
(KJS::PropertyListNode::evaluate): Changed code to get name directly instead
of converting it from an Identifier to a jsString then back to a UString
then into an Identifier again!
* kjs/nodes2string.cpp: Changed special-token implementation to use a separate
function for each of Endl, Indent, Unindent, and DotExpr instead of using a
single function with a switch. Added a precedence that you can stream in, to
cause the next node serialized to add parentheses based on that precedence value.
(KJS::operatorString): Moved to the top of the file.
(KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
workaround for snprintf, since StringExtras.h takes care of that.
(KJS::operator<<): Made the char and char* versions faster by using UString's
character append functions instead of constructing a UString. Added the logic
to the Node* version to add parentheses if needed.
(KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
(KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
(KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
the bracket.
(KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
(KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
(KJS::NewExprNode::streamTo): Use PrecMember for the expression.
(KJS::FunctionCallValueNode::streamTo): Use PrecCall.
(KJS::FunctionCallBracketNode::streamTo): Ditto.
(KJS::FunctionCallDotNode::streamTo): Ditto.
(KJS::PostfixBracketNode::streamTo): Ditto.
(KJS::PostfixDotNode::streamTo): Ditto.
(KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
(KJS::DeleteBracketNode::streamTo): Use PrecCall.
(KJS::DeleteDotNode::streamTo): Ditto.
(KJS::DeleteValueNode::streamTo): Use PrecUnary.
(KJS::VoidNode::streamTo): Ditto.
(KJS::TypeOfValueNode::streamTo): Ditto.
(KJS::PrefixBracketNode::streamTo): Use PrecCall.
(KJS::PrefixDotNode::streamTo): Ditto.
(KJS::PrefixErrorNode::streamTo): Use PrecUnary.
(KJS::UnaryPlusNode::streamTo): Ditto.
(KJS::NegateNode::streamTo): Ditto.
(KJS::BitwiseNotNode::streamTo): Ditto.
(KJS::LogicalNotNode::streamTo): Ditto.
(KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
(KJS::DivNode::streamTo): Ditto.
(KJS::ModNode::streamTo): Ditto.
(KJS::AddNode::streamTo): Ditto.
(KJS::SubNode::streamTo): Ditto.
(KJS::LeftShiftNode::streamTo): Ditto.
(KJS::RightShiftNode::streamTo): Ditto.
(KJS::UnsignedRightShiftNode::streamTo): Ditto.
(KJS::LessNode::streamTo): Ditto.
(KJS::GreaterNode::streamTo): Ditto.
(KJS::LessEqNode::streamTo): Ditto.
(KJS::GreaterEqNode::streamTo): Ditto.
(KJS::InstanceOfNode::streamTo): Ditto.
(KJS::InNode::streamTo): Ditto.
(KJS::EqualNode::streamTo): Ditto.
(KJS::NotEqualNode::streamTo): Ditto.
(KJS::StrictEqualNode::streamTo): Ditto.
(KJS::NotStrictEqualNode::streamTo): Ditto.
(KJS::BitAndNode::streamTo): Ditto.
(KJS::BitXOrNode::streamTo): Ditto.
(KJS::BitOrNode::streamTo): Ditto.
(KJS::LogicalAndNode::streamTo): Ditto.
(KJS::LogicalOrNode::streamTo): Ditto.
(KJS::ConditionalNode::streamTo): Ditto.
(KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
(KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
the bracket and PrecAssignment for the right side.
(KJS::AssignDotNode::streamTo): Ditto.
(KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
and PrecAssignment for the right side.
(KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
(KJS::AssignExprNode::streamTo): Use PrecAssignment.
2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
Define wx port and set wx port USE options.
Reviewed by Adam Roben.
* wtf/Platform.h:
2007-10-28 Mark Rowe <mrowe@apple.com>
We don't include "config.h" in headers.
* bindings/jni/jni_instance.h:
* kjs/regexp.h:
* wtf/TCPageMap.h:
* wtf/TCSpinLock.h:
2007-10-28 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Mark.
- avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
* kjs/SymbolTable.h:
(KJS::SymbolTableIndexHashTraits::emptyValue):
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot):
(KJS::ActivationImp::put):
2007-10-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
* kjs/SymbolTable.h:
(KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
(KJS::IdentifierRepHash::equal): ditto
(KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
(KJS::SymbolTable): change to a typedef for a HashMap.
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
(KJS::ActivationImp::deleteProperty): ditto
(KJS::ActivationImp::put): ditto
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
you now have to store a UString::rep, not an identifier.
2007-10-27 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- numerous HashTable performance improvements
This does not quite add up to a measurable win on SunSpider, but it allows a
follow-on > 3% improvement and probably helps WebCore too.
I made the following improvements, among others:
- Made HashFunctions note whether it is ok to compare a real value with the equal() function
to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
- Specialized lookup so it doesn't have to do so many extra branches and build so many extra
std::pairs for cases that don't need them. There are now four versions, one for read-only access,
two for writing, and one folded directly into add() (these all were improvments).
- Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
- Made a special constructor for iterators that knows it points to
a valid filled cell and so skips updating itself.
- Reordered memory accesses in the various lookup functions for better code generation
- Made simple translators avoid passing a hash code around
- Other minor tweaks
* wtf/HashTable.h:
(WTF::):
(WTF::HashTableConstIterator::HashTableConstIterator):
(WTF::HashTableIterator::HashTableIterator):
(WTF::IdentityHashTranslator::translate):
(WTF::HashTable::end):
(WTF::HashTable::lookup):
(WTF::HashTable::lookupForWriting):
(WTF::HashTable::makeKnownGoodIterator):
(WTF::HashTable::makeKnownGoodConstIterator):
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
(WTF::::addPassingHashCode):
(WTF::::reinsert):
(WTF::::find):
(WTF::::contains):
* kjs/identifier.cpp:
(WTF::):
* wtf/HashFunctions.h:
(WTF::):
* wtf/HashMap.h:
(WTF::):
(WTF::::get):
* wtf/HashSet.h:
(WTF::):
(WTF::::add):
* wtf/ListHashSet.h:
(WTF::ListHashSetTranslator::translate):
2007-10-27 Darin Adler <darin@apple.com>
Reviewed by Eric.
- fix ASCIICType.h for some Windows compiles
* wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
compiler/library that has the wchar_t that is just a typedef.
2007-10-27 Kevin McCullough <kmccullough@apple.com>
- BuildFix
- Forgot to change the build step when I changed the filename.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-27 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
computedHash()"
http://bugs.webkit.org/show_bug.cgi?id=15718
* kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a
hash value. Also changed O(n) strlen to O(1) check for empty string.
(KJS::Identifier::add):
* kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
(KJS::UString::UString):
(KJS::UString::operator=):
2007-10-27 Darin Adler <darin@apple.com>
Reviewed by Eric.
- fix pow on Windows
* wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
a "pow" function that does not properly handle the case where arg1 is
NaN and arg2 is 0.
* kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
specify "::pow" -- just "pow" is fine.
2007-10-27 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15711
force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
* kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
* kjs/object.h: Removed redundant includes.
* kjs/value.h: Ditto.
2007-10-27 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark.
- fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
http://bugs.webkit.org/show_bug.cgi?id=15718
* kjs/identifier.cpp:
(KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
now that we count on all Identifiers already having one.
2007-10-27 Mark Rowe <mrowe@apple.com>
Silence a warning.
* kjs/SymbolTable.h:
2007-10-27 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/function.h:
2007-10-26 Kevin McCullough <kmccullough@apple.com>
Rubber stamp by Adam.
- Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
files contain are functions that operate on BSTRs.
* API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
* API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
* API/JSStringRefCOM.cpp: Removed.
* API/JSStringRefCOM.h: Removed.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-26 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
- Made JSStringCreateWithBSTR capable of handling null BSTRs.
* API/JSStringRefCOM.cpp:
(JSStringCreateWithBSTR):
2007-10-26 Sam Weinig <sam@webkit.org>
Windows build fix.
* kjs/SymbolTable.h: Add header gaurd.
* kjs/nodes.h: #include "SymbolTable.h"
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Suggested by Anders Carlsson.
Fixed tyop.
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot):
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Suggested by Darin Adler.
Use computedHash(), which is safer than just directly accessing _hash.
* kjs/lookup.cpp:
(KJS::Lookup::findEntry):
(KJS::Lookup::find):
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Build fix: svn add SymbolTable.h
* kjs/SymbolTable.h: Added.
(KJS::SymbolTable::set):
(KJS::SymbolTable::get):
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Build fix: export SymbolTable.h to WebCore.
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Comment tweak suggested by Maciej.
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot):
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
* kjs/property_map.cpp: Use a special no branch accessor to the UString's
hash value. Also, return immediately instead of branching to the end
of the loop if the value is not found.
(KJS::PropertyMap::get):
(KJS::PropertyMap::getLocation):
(KJS::PropertyMap::put):
(KJS::PropertyMap::insert):
(KJS::PropertyMap::remove):
(KJS::PropertyMap::checkConsistency):
* kjs/ustring.h:
(KJS::UString::Rep::computedHash): Special no branch accessor to the
UString's hash value. Used when the caller knows that the hash value
has already been computed. (For example, if the caller got the UString
from an Identifier.)
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Switched ActivationImp to using a symbol table. For now, though, all
clients take the slow path.
Net .6% speedup on SunSpider.
Slowdowns:
- ActivationImp now mallocs in its constructor
- Local variable hits use an extra level of indirection to retrieve
data
- Local variable misses do two lookups
Speedups:
- Fast initialization of local variables upon function entry
* JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
* kjs/function.cpp:
(KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
data that won't fit in a JSCell.
(KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
lookup.
(KJS::ActivationImp::getOwnPropertySlot): ditto
(KJS::ActivationImp::deleteProperty): ditto
(KJS::ActivationImp::put): ditto
(KJS::ActivationImp::createArgumentsObject): ditto
(KJS::ActivationImp::mark): Call JSObject::mark first so that one of
our properties doesn't try to recursively mark us. (This caused a crash
in earlier testing. Not sure why we haven't run into it before.)
* kjs/nodes.cpp: Functions now build a symbol table the first time
they're called.
(KJS::VarDeclNode::evaluate):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::FunctionBodyNode::initializeSymbolTable):
(KJS::FunctionBodyNode::processDeclarations):
(KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
(KJS::FunctionBodyNode::processDeclarationsForProgramCode):
* kjs/nodes.h:
(KJS::FunctionBodyNode::symbolTable):
* wtf/Forward.h: Added Vector.
2007-10-26 Kevin McCullough <kmccullough@apple.com>
- Corrected function name mistake in this changelog.
2007-10-26 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam and Steve.
- Added convenience methods for converting between BSTR and JSStringRefs
* API/JSStringRefCOM.cpp: Added.
(JSStringCreateWithBSTR):
(JSStringCopyBSTR):
* API/JSStringRefCOM.h: Added.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-26 Mark Rowe <mrowe@apple.com>
Windows build fix.
* kjs/collector.cpp:
(KJS::Collector::collect):
2007-10-26 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
* kjs/CollectorHeapIntrospector.cpp:
(KJS::CollectorHeapIntrospector::init):
(KJS::CollectorHeapIntrospector::enumerate):
* kjs/CollectorHeapIntrospector.h:
* kjs/collector.cpp:
(KJS::Collector::recordExtraCost):
(KJS::Collector::heapAllocate):
(KJS::Collector::allocate):
(KJS::Collector::allocateNumber):
(KJS::Collector::registerThread):
(KJS::Collector::markStackObjectsConservatively):
(KJS::Collector::markMainThreadOnlyObjects):
(KJS::Collector::sweep):
(KJS::Collector::collect):
* kjs/collector.h:
* kjs/internal.h:
(KJS::NumberImp::operator new):
Force numbers to be allocated in the secondary heap.
2007-10-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
* kjs/value.h:
(KJS::JSValue::getUInt32):
(KJS::JSValue::getTruncatedInt32):
(KJS::JSValue::toNumber):
* wtf/PassRefPtr.h:
(WTF::PassRefPtr::~PassRefPtr):
* wtf/RefPtr.h:
(WTF::RefPtr::operator->):
2007-10-26 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/ExecState.h:
2007-10-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark.
- Merge Context class fully into ExecState, since they are always created and used together.
No measurable performance impact but this is a useful cleanup.
* JavaScriptCore.pri:
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
(KJS::ExecState::~ExecState):
(KJS::ExecState::mark):
(KJS::ExecState::lexicalInterpreter):
* kjs/ExecState.h:
(KJS::ExecState::dynamicInterpreter):
(KJS::ExecState::setException):
(KJS::ExecState::clearException):
(KJS::ExecState::exception):
(KJS::ExecState::exceptionSlot):
(KJS::ExecState::hadException):
(KJS::ExecState::scopeChain):
(KJS::ExecState::callingExecState):
(KJS::ExecState::propertyNames):
* kjs/collector.cpp:
(KJS::Collector::reportOutOfMemoryToAllInterpreters):
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::FunctionImp::argumentsGetter):
(KJS::FunctionImp::callerGetter):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/interpreter.cpp:
(KJS::Interpreter::Interpreter):
(KJS::Interpreter::init):
(KJS::Interpreter::evaluate):
(KJS::Interpreter::mark):
* kjs/interpreter.h:
(KJS::Interpreter::setCurrentExec):
(KJS::Interpreter::currentExec):
* kjs/nodes.cpp:
(KJS::currentSourceId):
(KJS::currentSourceURL):
(KJS::ThisNode::evaluate):
(KJS::ResolveNode::evaluate):
(KJS::FunctionCallResolveNode::evaluate):
(KJS::PostfixResolveNode::evaluate):
(KJS::DeleteResolveNode::evaluate):
(KJS::TypeOfResolveNode::evaluate):
(KJS::PrefixResolveNode::evaluate):
(KJS::AssignResolveNode::evaluate):
(KJS::VarDeclNode::evaluate):
(KJS::DoWhileNode::execute):
(KJS::WhileNode::execute):
(KJS::ForNode::execute):
(KJS::ForInNode::execute):
(KJS::ContinueNode::execute):
(KJS::BreakNode::execute):
(KJS::ReturnNode::execute):
(KJS::WithNode::execute):
(KJS::SwitchNode::execute):
(KJS::LabelNode::execute):
(KJS::TryNode::execute):
(KJS::FunctionBodyNode::processDeclarationsFunctionCode):
(KJS::FunctionBodyNode::processDeclarationsProgramCode):
(KJS::FunctionBodyNode::processDeclarations):
(KJS::FuncDeclNode::makeFunction):
(KJS::FuncExprNode::evaluate):
2007-10-26 Mark Rowe <mrowe@apple.com>
Windows build fix.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-26 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* JavaScriptCore.pri:
* kjs/ExecState.cpp:
2007-10-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- moved Context class into ExecState.{h,cpp} in preparation for merging
ExecState and Context classes.
* kjs/ExecState.h: Moved CodeType enum and Context class here in
preparation for merging ExecState and Context.
* kjs/ExecState.cpp: Moved Context class here from Context.cpp.
(KJS::Context::Context):
(KJS::Context::~Context):
(KJS::Context::mark):
* kjs/context.h: Removed.
* kjs/Context.cpp: Removed.
* kjs/function.h: Removed CodeType enum.
* kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
* kjs/internal.h: Removed LabelStack.
* JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
* kjs/collector.cpp: Fixed includes.
* kjs/function.cpp: ditto
* kjs/internal.cpp: ditto
* kjs/interpreter.cpp: ditto
* kjs/lookup.h: ditto
* kjs/nodes.cpp: ditto
2007-10-26 Mark Rowe <mrowe@apple.com>
Windows build fix.
* kjs/string_object.cpp:
(KJS::StringObjectFuncImp::callAsFunction):
2007-10-25 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15703
fix numeric functions -- improve correctness and speed
Gives about 1% gain on SunSpider.
* kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
(KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
with both immediate and number values.
(KJS::JSValue::toUInt32): Ditto.
* kjs/value.cpp:
(KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
differences. One is that it now correctly returns 0 for NaN, and another is that
there's no special case for 0 or infinity, since the general case already handles
those correctly.
(KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
check for NaN.
(KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
truncation done by the typecast already does the necessary truncation that
roundValue was doing.
(KJS::JSValue::toUInt32SlowCase): Ditto.
(KJS::JSValue::toUInt16): Removed.
* kjs/internal.h: Removed roundValue.
* kjs/internal.cpp: Ditto.
* kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
* kjs/date_object.cpp:
(KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
toNumber as specified.
(KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
with a call to toNumber and timeClip as specified.
(KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
where the default behavior of toInt32 (returning 0) was already correct. Replaced
call to roundValue with a call to toNumber as specified.
(KJS::DateObjectFuncImp::callAsFunction): Ditto.
* kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
cases for the pow function that the library already handles correctly.
* kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
The real toInteger now returns 0 for NaN. Took out unneeded special case in
ToFixed for undefined; was only needed because our toInteger was wrong. Same
thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
* kjs/string_object.cpp:
(KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
cases for undefined that were only needed because toInteger was wrong. Same in
IndexOf, and was able to remove some special cases. In LastIndexOf, used
toIntegerPreserveNaN, but was able to remove some special cases there too.
Changed Substr implementation to preserve correct behavior with the change
to toInteger and match the specification. Also made sure we weren't converting
an out of range double to an int.
(KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
no reason to have toUInt16 as a second, less-optimized function that's only
called at this one call site.
* wtf/MathExtras.h: Added trunc function for Windows.
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Tweaked the inner hashtable lookup loop to remove a branch in the "not
found" case. .5% speedup on SunSpider.
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/HashTable.h:
(WTF::::lookup):
2007-10-25 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
* kjs/nodes.cpp:
(KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
adding any value over toNumber() here.
(KJS::valueForReadModifyAssignment): Ditto.
(KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
and branches.
(KJS::lessThanEq): Ditto.
* JavaScriptCore.exp: Export new functions as needed.
* kjs/value.h:
(KJS::JSValue::toPrimitive): Fixed formatting.
(KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
to number and tells you whether a toPrimitive() conversion with a Number hint
would have given a string.
* kjs/internal.cpp:
(KJS::StringImp::getPrimitiveNumber): Implemented.
(KJS::NumberImp::getPrimitiveNumber): ditto
(KJS::GetterSetterImp::getPrimitiveNumber): ditto
(KJS::StringImp::toPrimitive): Fixed formatting.
(KJS::NumberImp::toPrimitive): ditto
(KJS::GetterSetterImp::toPrimitive): ditto
* kjs/internal.h:
* kjs/object.cpp:
(KJS::JSObject::getPrimitiveNumber): Implemented.
* kjs/object.h:
2007-10-25 Sam Weinig <sam@webkit.org>
Reviewed by Adam Roben.
Remove JSStringRefCFHack from windows as it is no longer needed.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Rolled out my last patch. It turns out that I needed 2 words, not 1,
so it didn't help.
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
Shrink the size of an activation object by 1 word
This is in preparation for adding a symbol table to the activation
object.
The basic strategy here is to rely on the mutual exclusion between
the arguments object pointer and the function pointer (you only need
the latter in order to create the former), and store them in the same
place. The LazyArgumentsObject class encapsulates this strategy.
Also inlined the ArgumentsImp constructor, for good measure.
SunSpider reports no regression. Regression tests pass.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/Context.cpp:
(KJS::Context::~Context):
* kjs/function.cpp:
(KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::mark):
(KJS::):
(KJS::ActivationImp::argumentsGetter):
(KJS::ActivationImp::mark):
* kjs/function.h:
(KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
(KJS::ActivationImp::LazyArgumentsObject::resetArguments):
(KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::setFunction):
(KJS::ActivationImp::LazyArgumentsObject::function):
(KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::):
(KJS::ActivationImp::ActivationImp::ActivationImp):
(KJS::ActivationImp::resetArguments):
2007-10-25 Adam Roben <aroben@apple.com>
Change JavaScriptCore.vcproj to use DerivedSources.make
We were trying to emulate the logic of make in
build-generated-files.sh, but we got it wrong. We now use a
build-generated-files very much like the one that WebCore uses to
invoke make.
We also now only have a Debug configuration of dftables which we build
even when doing a Release build of JavaScriptCore. dftables also no
longer has the "_debug" name suffix.
Changes mostly made by Darin, reviewed by me.
* DerivedSources.make: Add a variable to set the extension used for
the dftables executable.
* JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
dftables in Release configurations.
* JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
- Updated include path to point to the new location of the derived
sources.
- Modified pre-build event to pass the right arguments to
build-generated-files.sh and not call dftables directly.
- Added the derived source files to the project.
- Removed grammarWrapper.cpp, which isn't needed now that we're
compiling grammar.cpp directly.
* JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
Slightly modified from the WebCore version.
* JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
* JavaScriptCore.vcproj/dftables/dftables.vcproj:
- Changed the output location to match Mac.
- Removed the Release configuration.
- Removed the _debug suffix.
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Slightly elaborated the differences between declaration procesing in
Function Code and Program Code.
.3% speedup on SunSpider.
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::processDeclarationsFunctionCode):
(KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a
minimum set of attributes instead of recomputing all the time. Also,
ignore m_parameters, since programs don't have arguments.
2007-10-25 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
More preparation work before adding long-running mode to testkjs.
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction):
(prettyPrintScript):
(runWithScripts):
(parseArguments):
(kjsmain):
(fillBufferWithContentsOfFile):
2007-10-25 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Bring testkjs code out of the dark ages in preparation for more
radical improvements (like long-running testing support!)
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction):
(setupInterpreter):
(doIt):
(fillBufferWithContentsOfFile):
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Make a fast path for declaration processing inside Function Code.
Lifted declaration processing code up from individual declaration nodes
and into processDeclarations.
Broke out processDeclarations into two cases, depending on the type of
code. This eliminates 2 branches, and facilitates more radical
divergeance in the future.
2.5% SunSpider speedup.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::initializeDeclarationStacks):
(KJS::FunctionBodyNode::processDeclarationsFunctionCode):
(KJS::FunctionBodyNode::processDeclarationsProgramCode):
(KJS::FunctionBodyNode::execute):
(KJS::FuncDeclNode::makeFunction):
* kjs/nodes.h:
(KJS::):
2007-10-25 Maciej Stachowiak <mjs@apple.com>
Reviewed by Adam.
- add header includes needed on platforms that don't use AllInOneFile.cpp
* API/JSCallbackObject.cpp:
* kjs/Context.cpp:
* kjs/ExecState.cpp:
* kjs/array_instance.cpp:
* kjs/function_object.cpp:
* kjs/interpreter.cpp:
* kjs/nodes.cpp:
2007-10-25 Eric Seidel <eric@webkit.org>
Reviewed by Geoff.
* JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
Re-order declaration initialization to avoid calling hasProperty inside
VarDeclNode::processDeclaration
.7% speedup on SunSpider.
* kjs/function.h:
* kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
other processing of declared symbols, so the order of execution could
change.
* kjs/nodes.cpp:
(KJS::VarDeclNode::getDeclarations): Added special case for the
"arguments" property name, explained in the comment.
(KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
in the case of function code, since we know the declared symbol
management will resolve conflicts between symbols. Yay!
(KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
implementation of getDeclarations is non-trivial, we can't take a
short-cut here any longer -- we need to put the VarDecl node on the
stack so it gets processed normally.
(KJS::FunctionBodyNode::processDeclarations): Changed the order of
processing to enforce mutual exclusion rules.
* kjs/nodes.h:
(KJS::DeclarationStacks::DeclarationStacks): Structure includes an
ExecState now, for fast access to the "arguments" property name.
2007-10-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Add a JSGlobalObject class and remove the InterpreterMap
http://bugs.webkit.org/show_bug.cgi?id=15681
This required making JSCallbackObject a template class to allow for
JSGlobalObjects with JSCallbackObject functionality.
SunSpider claims this was a 0.5% speedup.
* API/JSCallbackObject.cpp:
(KJS::):
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
(KJS::::JSCallbackObject):
(KJS::::init):
(KJS::::~JSCallbackObject):
(KJS::::initializeIfNeeded):
(KJS::::className):
(KJS::::getOwnPropertySlot):
(KJS::::put):
(KJS::::deleteProperty):
(KJS::::implementsConstruct):
(KJS::::construct):
(KJS::::implementsHasInstance):
(KJS::::hasInstance):
(KJS::::implementsCall):
(KJS::::callAsFunction):
(KJS::::getPropertyNames):
(KJS::::toNumber):
(KJS::::toString):
(KJS::::setPrivate):
(KJS::::getPrivate):
(KJS::::inherits):
(KJS::::cachedValueGetter):
(KJS::::staticValueGetter):
(KJS::::staticFunctionGetter):
(KJS::::callbackGetter):
* API/JSClassRef.cpp:
(OpaqueJSClass::prototype):
* API/JSContextRef.cpp:
(JSGlobalContextCreate):
* API/JSObjectRef.cpp:
(JSObjectMake):
(JSObjectGetPrivate):
(JSObjectSetPrivate):
* API/JSValueRef.cpp:
(JSValueIsObjectOfClass):
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bindings/c/c_utility.cpp:
(KJS::Bindings::convertValueToNPVariant):
* bindings/jni/jni_jsobject.cpp:
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertValueToObjcValue):
* kjs/Context.cpp:
(KJS::Context::Context):
* kjs/ExecState.cpp:
(KJS::ExecState::lexicalInterpreter):
* kjs/JSGlobalObject.h: Added.
(KJS::JSGlobalObject::JSGlobalObject):
(KJS::JSGlobalObject::isGlobalObject):
(KJS::JSGlobalObject::interpreter):
(KJS::JSGlobalObject::setInterpreter):
* kjs/array_instance.cpp:
* kjs/context.h:
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/interpreter.cpp:
(KJS::Interpreter::Interpreter):
(KJS::Interpreter::init):
(KJS::Interpreter::~Interpreter):
(KJS::Interpreter::globalObject):
(KJS::Interpreter::initGlobalObject):
(KJS::Interpreter::evaluate):
* kjs/interpreter.h:
* kjs/lookup.h:
(KJS::cacheGlobalObject):
* kjs/object.h:
(KJS::JSObject::isGlobalObject):
* kjs/testkjs.cpp:
2007-10-24 Eric Seidel <eric@webkit.org>
Build fix for Gtk, no review.
* kjs/collector.cpp: #include "context.h"
2007-10-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Stop checking isOutOfMemory after every allocation, instead let the collector
notify all ExecStates if we ever hit this rare condition.
SunSpider claims this was a 2.2% speedup.
* kjs/collector.cpp:
(KJS::Collector::collect):
(KJS::Collector::reportOutOfMemoryToAllInterpreters):
* kjs/collector.h:
* kjs/nodes.cpp:
(KJS::TryNode::execute):
2007-10-24 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/identifier.h: Remove extra qualification.
2007-10-24 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Disable ALWAYS_INLINE in debug builds, since it drives the debugger
crazy.
* wtf/AlwaysInline.h:
2007-10-24 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Inlined the fast path for creating an Identifier from an Identifier.
This is a .4% speedup on SunSpider overall, but as big as a 2.5%
speedup on certain individual tests. 65% of the Identifiers creating
by SunSpider are already Identifiers.
(The main reason I'm making this change is that it resolves a large
regression in a patch I haven't checked in yet.)
* JavaScriptCore.exp:
* kjs/identifier.cpp:
(KJS::Identifier::addSlowCase):
* kjs/identifier.h:
(KJS::Identifier::Identifier::add):
2007-10-24 Lars Knoll <lars@trolltech.com>
Reviewed by Simon.
some changes to the way JS values are converted to Qt values in the script bindings. Added support for converting JS arrays into QStringList's.
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtInstance::invokeMethod):
* bindings/qt/qt_runtime.cpp:
(KJS::Bindings::convertValueToQVariant):
(KJS::Bindings::QtField::setValueToInstance):
2007-10-24 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
* kjs/nodes.cpp:
(KJS::lessThan):
(KJS::lessThanEq):
(KJS::LessNode::evaluate):
(KJS::GreaterNode::evaluate):
(KJS::LessEqNode::evaluate):
(KJS::GreaterEqNode::evaluate):
* kjs/operations.cpp:
* kjs/operations.h:
2007-10-24 Eric Seidel <eric@webkit.org>
Reviewed by darin.
* kjs/nodes.h:
(KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
2007-10-24 Darin Adler <darin@apple.com>
Reviewed by Eric.
* kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
2007-10-24 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- separate out the code to create a hash table the first time from the code
to rehash
SunSpider claims this was a 0.7% speedup.
* kjs/property_map.cpp:
(KJS::PropertyMap::expand): Changed to call either createTable or rehash.
(KJS::PropertyMap::createTable): Added. For the case where we had no table.
(KJS::PropertyMap::rehash): Removed code needed only in the case where we
had no table.
* kjs/property_map.h: Added createTable.
2007-10-24 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
which can be represented by JSImmediate.
SunSpider claims this was a 0.6% speedup.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::NumberNode::evaluate):
(KJS::ImmediateNumberNode::evaluate):
* kjs/nodes.h:
(KJS::Node::):
(KJS::ImmediateNumberNode::):
* kjs/nodes2string.cpp:
(ImmediateNumberNode::streamTo):
2007-10-24 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15657
change static hash tables to use powers of two for speed
Seems to give 0.7% SunSpider speedup.
* kjs/create_hash_table: Updated to generate new format.
* kjs/lookup.cpp:
(KJS::keysMatch): Took out unneeded typecast.
(KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
Replaced the modulus with a bit mask.
(KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
their hash -- saves a branch.
(KJS::Lookup::find): Ditto.
* kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
2007-10-24 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
* kjs/nodes.cpp:
(KJS::DoWhileNode::execute):
(KJS::WhileNode::execute):
(KJS::ForNode::execute):
(KJS::ForInNode::execute):
(KJS::SourceElementsNode::execute):
2007-10-23 Darin Adler <darin@apple.com>
Reviewed by Maciej.
* kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
Changed an && to an & for a 1% gain in SunSpider.
2007-10-23 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
* kjs/nodes.cpp:
(KJS::MultNode::evaluate):
(KJS::DivNode::evaluate):
(KJS::ModNode::evaluate):
(KJS::add):
(KJS::sub):
(KJS::AddNode::evaluate):
(KJS::SubNode::evaluate):
(KJS::valueForReadModifyAssignment):
* kjs/operations.cpp:
* kjs/operations.h:
2007-10-23 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Separating all of the simple (eg. non-read-modify-write) binary operators
into separate classes in preparation for further JS optimisations.
Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
no further work.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::MultNode::evaluate):
(KJS::DivNode::evaluate):
(KJS::ModNode::evaluate):
(KJS::AddNode::evaluate):
(KJS::SubNode::evaluate):
(KJS::LeftShiftNode::evaluate):
(KJS::RightShiftNode::evaluate):
(KJS::UnsignedRightShiftNode::evaluate):
(KJS::LessNode::evaluate):
(KJS::GreaterNode::evaluate):
(KJS::LessEqNode::evaluate):
(KJS::GreaterEqNode::evaluate):
(KJS::InstanceOfNode::evaluate):
(KJS::InNode::evaluate):
(KJS::EqualNode::evaluate):
(KJS::NotEqualNode::evaluate):
(KJS::StrictEqualNode::evaluate):
(KJS::NotStrictEqualNode::evaluate):
(KJS::BitAndNode::evaluate):
(KJS::BitXOrNode::evaluate):
(KJS::BitOrNode::evaluate):
(KJS::LogicalAndNode::evaluate):
(KJS::LogicalOrNode::evaluate):
* kjs/nodes.h:
(KJS::MultNode::):
(KJS::DivNode::):
(KJS::ModNode::):
(KJS::AddNode::):
(KJS::SubNode::):
(KJS::LeftShiftNode::):
(KJS::RightShiftNode::):
(KJS::UnsignedRightShiftNode::):
(KJS::LessNode::):
(KJS::GreaterNode::):
(KJS::LessEqNode::):
(KJS::GreaterEqNode::):
(KJS::InstanceOfNode::):
(KJS::InNode::):
(KJS::EqualNode::):
(KJS::NotEqualNode::):
(KJS::StrictEqualNode::):
(KJS::NotStrictEqualNode::):
(KJS::BitAndNode::):
(KJS::BitOrNode::):
(KJS::BitXOrNode::):
(KJS::LogicalAndNode::):
(KJS::LogicalOrNode::):
* kjs/nodes2string.cpp:
(MultNode::streamTo):
(DivNode::streamTo):
(ModNode::streamTo):
(AddNode::streamTo):
(SubNode::streamTo):
(LeftShiftNode::streamTo):
(RightShiftNode::streamTo):
(UnsignedRightShiftNode::streamTo):
(LessNode::streamTo):
(GreaterNode::streamTo):
(LessEqNode::streamTo):
(GreaterEqNode::streamTo):
(InstanceOfNode::streamTo):
(InNode::streamTo):
(EqualNode::streamTo):
(NotEqualNode::streamTo):
(StrictEqualNode::streamTo):
(NotStrictEqualNode::streamTo):
(BitAndNode::streamTo):
(BitXOrNode::streamTo):
(BitOrNode::streamTo):
(LogicalAndNode::streamTo):
2007-10-23 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=15639
fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
Test: fast/js/math.html
* kjs/math_object.cpp: (MathFuncImp::callAsFunction):
Fix abs to look at the sign bit. Add a special case for values in the range
between -0 and -1 and a special case for ceil and for -0 for floor.
2007-10-23 Darin Adler <darin@apple.com>
Reviewed by Eric.
- streamline exception handling code for a >1% speed-up of SunSpider
* kjs/nodes.cpp: Changed macros to use functions for everything that's not
part of normal execution. We'll take function call overhead when propagating
an exception or out of memory.
(KJS::createOutOfMemoryCompletion): Added.
(KJS::substitute): Use append instead of the relatively inefficient + operator.
(KJS::Node::rethrowException): Added.
* kjs/nodes.h: Added rethrowException.
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=15636
some JavaScriptCore regression tests are failing due to numeric conversion
This should restore correctness and make speed better too, restoring some
of the optimization we lost in my last check-in.
* kjs/JSImmediate.h:
(KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom
I used in my patch yesterday.
(KJS::JSImmediate::getTruncatedUInt32): Ditto.
* kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32.
* kjs/internal.cpp:
(KJS::NumberImp::getUInt32): Changed to always use double, since I can't find
a way to write this more efficiently for float.
(KJS::NumberImp::getTruncatedInt32): Added.
(KJS::NumberImp::getTruncatedUInt32): Added.
* kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32.
(KJS::JSValue::getUInt32):
(KJS::JSValue::getTruncatedInt32): Added.
(KJS::JSValue::getTruncatedUInt32): Added.
(KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32.
(KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32.
* kjs/value.cpp:
(KJS::JSCell::getTruncatedInt32): Added.
(KJS::JSCell::getTruncatedUInt32): Added.
(KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32.
(KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally
had left in here.
(KJS::JSValue::toUInt32SlowCase): Ditto.
(KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32.
* JavaScriptCore.exp: Updated.
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=15632
js1_5/Array/array-001.js test failing
One of the JavaScriptCore tests was failing; it failed because of
my change to NumberImp::getUInt32. The incorrect code I copied was
from JSImmediate::getUInt32, and was a pre-existing bug.
This patch fixes correctness, but will surely slow down SunSpider.
We may be able to code this tighter and get the speed back.
* kjs/JSImmediate.h:
(KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately
reflect the fact that this function only returns true if the value is
accurate (no fractional part, etc.). Changed code so that it returns
false when the value has a fraction.
(KJS::JSImmediate::getUInt32): Ditto.
* kjs/internal.cpp:
(KJS::NumberImp::getInt32): Changed code so that it returns false when
the value has a fraction. Restores the old behavior.
(KJS::NumberImp::getUInt32): Ditto.
* kjs/value.h:
(KJS::JSValue::getInt32): Updated for name change.
(KJS::JSValue::getUInt32): Ditto.
(KJS::JSValue::toInt32): Ditto.
(KJS::JSValue::toUInt32): Ditto.
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Brady.
- fix crash seen when running JavaScriptCore tests
* kjs/array_instance.cpp: (KJS::ArrayInstance::mark):
Copy and paste error: I accidentally had code here that was
making a copy of the HashMap -- that's illegal inside a mark
function and was unnecessary. The other callsite was modifying
the map as it iterated it, but this function is not.
2007-10-22 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider
http://bugs.webkit.org/show_bug.cgi?id=15627
* kjs/JSImmediate.h:
(KJS::JSImmediate::fromDouble): Avoid moving floats to integer
registers since this is very slow.
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Eric Seidel.
- http://bugs.webkit.org/show_bug.cgi?id=15617
improve speed of integer conversions
Makes SunSpider 6% faster.
* kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for
32-bit and 64-bit.
* kjs/value.h:
(KJS::JSValue::getUInt32): Call JSImmediate::toUInt32.
* kjs/internal.h: Added getInt32.
* kjs/internal.cpp:
(KJS::NumberImp::getInt32): Added.
(KJS::NumberImp::getUInt32): Replaced with more-optimal implementation
stolen from JSValue.
* kjs/value.h:
(KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting
inlined.
(KJS::JSValue::getInt32): Added.
(KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32
to avoid converting from float to double.
(KJS::JSValue::toInt32): Made inline, separated out the slow case.
(KJS::JSValue::toUInt32): Ditto.
* kjs/value.cpp:
(KJS::JSCell::getInt32): Added.
(KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the
new getInt32. Added a faster case for in-range numbers.
(KJS::JSValue::toUInt32SlowCase): Ditto.
(KJS::JSValue::toUInt16): Added a faster case for in-range numbers.
* JavaScriptCore.exp: Updated for changes.
2007-10-22 Adam Roben <aroben@apple.com>
Windows build fix
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off
warning about implicit conversion to bool.
2007-10-22 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/array_instance.cpp:
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15606
make cut-off for sparse vs. dense arrays smarter for speed with large arrays
Makes the morph test in SunSpider 26% faster, and the overall
benchmark 3% faster.
This also fixes some small problems we had with the distinction
between nonexistent and undefined values in arrays.
* kjs/array_instance.h: Tweaked formatting and naming.
* kjs/array_instance.cpp: Copied from kjs/array_object.cpp.
(KJS::storageSize): Added. Computes the size of the storage given a vector length.
(KJS::increasedVectorLength): Added. Implements the rule for resizing the vector.
(KJS::isDenseEnoughForVector): Added.
(KJS::ArrayInstance::ArrayInstance): Initialize the new fields.
(KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it.
(KJS::ArrayInstance::getItem): Updated for name changes.
(KJS::ArrayInstance::lengthGetter): Ditto.
(KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of
getOwnPropertySlot to share more code.
(KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change.
(KJS::ArrayInstance::put): Added logic for extending the vector as long as the
array is dense enough. Also keep m_numValuesInVector up to date.
(KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector
up to date.
(KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names
for array indices with undefined values.
(KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also
simplified to only handle getting larger.
(KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to
zero out the unused part of the vector and to delete the map if it's no longer
needed.
(KJS::ArrayInstance::mark): Tweaked formatting.
(KJS::compareByStringForQSort): Ditto.
(KJS::ArrayInstance::sort): Ditto.
(KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
Ditto.
(KJS::compareWithCompareFunctionForQSort): Ditto.
(KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn
undefined values into nonexistent values in some cases.
* kjs/array_object.h: Removed MAX_ARRAY_INDEX.
* kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file.
* JavaScriptCore.pri: Added array_instance.cpp.
* JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
* kjs/AllInOneFile.cpp: Ditto.
2007-10-22 Andrew Wellington <proton@wiretapped.net>
Reviewed by Mark Rowe.
Fix for local database support after r26879
Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set
* Configurations/JavaScriptCore.xcconfig:
2007-10-22 Simon Hausmann <hausmann@kde.org>
Reviewed by Alp.
Build fix for the non-qmake builds.
* wtf/Platform.h: Default to enabling the database features unless
otherwise specified. (similar to ENABLE_ICONDATABASE)
2007-10-22 Holger Freyther <zecke@selfish.org>
Reviewed by Simon Hausmann <hausmann@kde.org>.
* Do not build testkjs as an application bundle. This is
needed for run-javascriptcore-tests on OSX.
* Also, based on r26633, allow to test the WebKit/Qt port on OSX.
* Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set
as we do not have -rpath on OSX.
* kjs/testkjs.pro:
2007-10-21 Mark Rowe <mrowe@apple.com>
Reviewed by Alp.
http://bugs.webkit.org/show_bug.cgi?id=15575
Bug 15575: [GTK] Implement threading using GThread
* wtf/Platform.h: Do not enable pthreads for Gtk.
2007-10-21 Mark Rowe <mrowe@apple.com>
Reviewed by Mitz.
Fix http://bugs.webkit.org/show_bug.cgi?id=15603
Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript
* kjs/array_object.cpp:
(KJS::freeStorage): Reinstate null-check that was removed in r26847.
2007-10-21 Darin Adler <darin@apple.com>
- fix Windows build
* kjs/array_instance.h: Removed unused ExecState parameter.
* kjs/array_object.cpp:
(KJS::ArrayInstance::put): Ditto.
(KJS::ArrayInstance::setLength): Ditto.
2007-10-21 Darin Adler <darin@apple.com>
* kjs/array_object.cpp: (KJS::ArrayInstance::put):
Add missing assignment that was causing regression test crash.
2007-10-21 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15585
speed up sparse arrays by using a custom map
Speeds up SunSpider by 10%.
* kjs/array_object.cpp:
(allocateStorage): Leave room for an additional pointer.
(reallocateStorage): Ditto.
(freeStorage): Ditto.
(ArrayInstance::~ArrayInstance): Delete the overflow map if present.
(ArrayInstance::getItem): Read values from the overflow map if present.
Removed the check of length, since it slows down the common case.
(ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback
to the property map.
(ArrayInstance::put): Write values into the overflow map as needed.
Also create overflow map when needed.
(ArrayInstance::deleteProperty): Remove values from the overflow map
as appropriate.
(ArrayInstance::getPropertyNames): Add a name for each identifier in
the property map. This is extremely inefficient.
(ArrayInstance::setLength): Remove any values in the overflow map
that are past the new length, as we formerly did with the property map.
(ArrayInstance::mark): Mark any values in the overflow map.
(compareByStringForQSort): Removed unneeded undefined case, since
compactForSorting guarantees we will have no undefined values.
(compareWithCompareFunctionForQSort): Ditto.
(ArrayInstance::compactForSorting): Copy all the values out of the
overflow map and destroy it.
* kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
* kjs/property_map.cpp: Ditto.
2007-10-20 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15579
stop churning identifier reference counts copying Completion objects
* kjs/completion.h: Replace the Identifier with an Identifier*.
* kjs/nodes.cpp:
(ForInNode::execute): Update for change to Completion constructor.
(ContinueNode::execute): Ditto.
(BreakNode::execute): Ditto.
2007-10-20 Mark Rowe <mrowe@apple.com>
Reviewed by Alp.
Gtk changes needed to enable HTML 5 client-side database storage.
* wtf/Platform.h: Have Gtk use pthreads for now.
2007-10-20 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15570
Store gathered declaration nodes in the function body node.
This means that you only have to gather the declaration nodes the first
time the function executes. Performance gain of 2.10% on SunSpider,
0.90% on command-line JS iBench.
* kjs/nodes.cpp: Split declaration stack initialization code off into
initializeDeclarationStacks().
(FunctionBodyNode::FunctionBodyNode):
(FunctionBodyNode::initializeDeclarationStacks):
(FunctionBodyNode::processDeclarations):
* kjs/nodes.h: Changed DeclarationStacks structure to hold references,
since the actual Vectors are now stored either on the stack or in the
function body node.
2007-10-19 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
http://bugs.webkit.org/show_bug.cgi?id=15559
Moved processDeclarations call into FunctionBodyNode::execute
To improve encapsulation, moved processDeclarations call into
FunctionBodyNode::execute. Also marked processDeclarations
ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup
on command-line JS iBench.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function.h:
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate):
* kjs/nodes.cpp:
(FunctionBodyNode::execute):
* kjs/nodes.h:
2007-10-19 Brady Eidson <beidson@apple.com>
Reviewed by Sam
Queue -> Deque! and small style tweaks
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
* wtf/Deque.h: Added.
(WTF::DequeNode::DequeNode):
(WTF::Deque::Deque):
(WTF::Deque::~Deque):
(WTF::Deque::size):
(WTF::Deque::isEmpty):
(WTF::Deque::append):
(WTF::Deque::prepend):
(WTF::Deque::first):
(WTF::Deque::last):
(WTF::Deque::removeFirst):
(WTF::Deque::clear):
* wtf/Queue.h: Removed.
2007-10-19 Brady Eidson <beidson@apple.com>
Reviewed by Oliver
Added a simple LinkedList based Queue to wtf
We can make a better, more sophisticated an efficient one later, but have
needed one for some time, now!
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/Queue.h: Added.
(WTF::QueueNode::QueueNode):
(WTF::Queue::Queue):
(WTF::Queue::~Queue):
(WTF::Queue::size):
(WTF::Queue::isEmpty):
(WTF::Queue::append):
(WTF::Queue::prepend):
(WTF::Queue::first):
(WTF::Queue::last):
(WTF::Queue::removeFirst):
(WTF::Queue::clear):
2007-10-19 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Anders.
Try to fix Qt/Win build slave, by including windows.h also on Qt/Win.
* kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS)
2007-10-19 Simon Hausmann <hausmann@kde.org>
Reviewed by Lars.
Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-).
Don't provide the wchar_t overloads then as they conflict with the unsigned short ones.
* wtf/ASCIICType.h:
(WTF::isASCIIAlpha):
(WTF::isASCIIAlphanumeric):
(WTF::isASCIIDigit):
(WTF::isASCIIHexDigit):
(WTF::isASCIILower):
(WTF::isASCIISpace):
(WTF::toASCIILower):
(WTF::toASCIIUpper):
2007-10-19 Simon Hausmann <hausmann@kde.org>
Reviewed by Lars.
Another build fix for the windows/qt build: Apply the same fix as in revision 26686 also to kjs/config.h to disable the disallowctype feature.
* kjs/config.h:
2007-10-18 Maciej Stachowiak <mjs@apple.com>
Reviewed by Adam.
- use __declspec(thread) for fast thread-local storage on Windows
- 2.2% speedup on sunspider (on Windows)
- 7% speedup on the string section
- 6% speedup on JS iBench
- fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422
- fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10
* wtf/FastMalloc.cpp:
(WTF::getThreadHeap):
(WTF::setThreadHeap):
(WTF::TCMalloc_ThreadCache::GetCache):
(WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2007-10-17 Darin Adler <darin@apple.com>
Reviewed by Mark Rowe.
- fix http://bugs.webkit.org/show_bug.cgi?id=15543
<rdar://problem/5545639> REGRESSION (r26697):
GoogleDocs: Can't create new documents or open existing ones
Test: fast/js/regexp-non-character.html
* pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters
in the \u sequences -- not needed and actively harmful.
2007-10-17 Anders Carlsson <andersca@apple.com>
Reviewed by Oliver.
* wtf/Platform.h:
#define USE_PTHREADS on Mac.
2007-10-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Merged DeclaredFunctionImp into FunctionImp (the base class) because
the distinction between the two was unused.
Removed codeType() from FunctionImp because FunctionImp and its
subclasses all returned FunctionCode, so it was unused, practically
speaking.
Removed a different codeType() from GlobalFuncImp because it was unused.
(Perhaps it was vestigial from a time when GlobalFuncImp used to
inherit from FunctionImp.)
* bindings/runtime_method.cpp:
* bindings/runtime_method.h:
* kjs/function.cpp:
(KJS::):
(KJS::FunctionImp::FunctionImp):
(KJS::FunctionImp::callAsFunction):
(KJS::FunctionImp::construct):
(KJS::FunctionImp::execute):
(KJS::FunctionImp::processVarDecls):
* kjs/function.h:
(KJS::FunctionImp::implementsConstruct):
(KJS::FunctionImp::scope):
* kjs/function_object.cpp:
(FunctionProtoFunc::callAsFunction):
(FunctionObjectImp::construct):
* kjs/nodes.cpp:
(FuncDeclNode::processFuncDecl):
(FuncExprNode::evaluate):
2007-10-17 Adam Roben <aroben@apple.com>
Windows build fix part 2.
Fix was by Darin, reviewed by Anders and Adam.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
FastMallocPCRE.cpp to the project, and let Visual Studio have its way
with the post-build step.
* pcre/pcre.h: Don't DLL export the entry points just because this
is Win32 -- this is an internal copy of PCRE and should be private.
* pcre/pcre_compile.c: Fix an uninitialized variable warning --
there's no real problem but it's better to quiet the compiler by
tweaking the code slightly than turn off the warning entirely.
2007-10-17 Adam Roben <aroben@apple.com>
Windows build fix.
Reviewed by Anders.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
some mismatched signed/unsigned comparison warnings.
* pcre/pcre_exec.c:
(match): #if-out some labels that don't seem to exist.
2007-10-17 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* JavaScriptCore.pri: Add FastMallocPCRE.cpp.
* pcre/pcre_get. #if out two functions that depend on pcre_get_stringnumber, which
is currently unavailable for UTF-16.
2007-10-16 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- merged PCRE changes between 6.4 and 6.5
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
Removed pcre_config.c, pcre_globals.c, pcre_info.c, pcre_maketables.c,
pcre_printint.src, pcre_refcount.c, pcre_study.c, pcre_try_flipped.c,
pcre_ucp_findchar.c, pcre_version.c, and ucptable.c. Added pcre_ucp_searchfuncs.c.
* pcre/AUTHORS:
* pcre/LICENCE:
* pcre/MERGING:
* pcre/dftables.c:
* pcre/pcre-config.h:
* pcre/pcre.h:
* pcre/pcre.pri:
* pcre/pcre_compile.c:
* pcre/pcre_exec.c:
* pcre/pcre_fullinfo.c:
* pcre/pcre_get.c:
* pcre/pcre_internal.h:
* pcre/pcre_maketables.c:
* pcre/pcre_ord2utf8.c:
* pcre/pcre_tables.c:
* pcre/pcre_ucp_searchfuncs.c: Copied from pcre/pcre_ucp_findchar.c.
* pcre/pcre_xclass.c:
* pcre/ucp.h:
* pcre/ucpinternal.h:
* pcre/ucptable.c:
Updated with new versions from the PCRE 6.5 release, merged with changes.
* pcre/pcre_config.c: Removed.
* pcre/pcre_globals.c: Removed.
* pcre/pcre_info.c: Removed.
* pcre/pcre_printint.src: Removed.
* pcre/pcre_refcount.c: Removed.
* pcre/pcre_study.c: Removed.
* pcre/pcre_try_flipped.c: Removed.
* pcre/pcre_ucp_findchar.c: Removed.
* pcre/pcre_version.c: Removed.
2007-10-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed KJS_VERBOSE because it was getting in the way of readability,
and the messages didn't seem very helpful.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::FunctionImp::passInParameters):
* kjs/lookup.h:
(KJS::lookupPut):
* kjs/object.cpp:
(KJS::JSObject::put):
* kjs/value.h:
2007-10-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed the Parameter class because it was a redundant wrapper around
Identifier.
* kjs/function.cpp:
(KJS::FunctionImp::passInParameters):
(KJS::FunctionImp::getParameterName):
* kjs/nodes.cpp:
(FunctionBodyNode::addParam):
* kjs/nodes.h:
(KJS::FunctionBodyNode::):
2007-10-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Global replace of assert with ASSERT.
2007-10-16 Adam Roben <aroben@apple.com>
Make testkjs not delay-load WebKit
Soon, delay-loading WebKit will be impossible (because we will be
using __declspec(thread) for thread-local storage). This change
prepares testkjs for the future.
Reviewed by Sam.
* JavaScriptCore.vcproj/JavaScriptCore.sln: Removed WebKitInitializer,
added FindSafari.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Don't link against
WebKitInitializer, don't delay-load WebKit.
* kjs/testkjs.cpp: Don't use WebKitInitializer.
2007-10-16 Adam Roben <aroben@apple.com>
Updated testkjs for the rename of WebKit_debug.dll to WebKit.dll for the Debug configuration
Reviewed by Kevin McCullough.
* JavaScriptCore.vcproj/debug.vsprops: Added WebKitDLLConfigSuffix.
* JavaScriptCore.vcproj/debug_internal.vsprops: Ditto.
* JavaScriptCore.vcproj/release.vsprops: Ditto.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Use
WebKitDLLConfigSuffix when referring to WebKit.dll, and fixed a typo
in the name of icuuc36[_debug].dll.
2007-10-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Re-structured variable and function declaration code.
Command-line JS iBench shows no regression.
Here are the changes:
1. Function declarations are now processed at the same time as var
declarations -- namely, immediately upon entry to an execution context.
This does not match Firefox, which waits to process a function
declaration until the declaration's containing block executes, but it
does match IE and the ECMA spec. (10.1.3 states that var and function
declarations should be processed at the same time -- namely, "On
entering an execution context." 12.2 states that "A Block does not
define a new execution scope.")
2. Declaration processing proceeds iteratively now, rather than
recursively, storing the nodes is finds in stacks. This will later
facilitate an optimization to hold on to the gathered declaration nodes,
rather than re-fetching them in every function call.
[ http://bugs.webkit.org/show_bug.cgi?id=14868 ]
Modified these tests because they expected the incorrect Mozilla
behavior described above:
* tests/mozilla/ecma_3/Function/scope-001.js:
* tests/mozilla/js1_5/Scope/regress-184107.js:
2007-10-16 Darin Adler <darin@apple.com>
- try to fix the GTK build
* kjs/ustring.cpp: Include ASCIICType.h, not ASCIICtype.h.
2007-10-16 Darin Adler <darin@apple.com>
- try to fix the Windows build
* kjs/date_object.cpp: (KJS::parseDate): A couple instances of isspace were
in here. Not sure why it wasn't failing elsewhere. Changed to isASCIISpace.
2007-10-16 Darin Adler <darin@apple.com>
- try to fix the GTK build
* kjs/ustring.cpp: Include ASCIICType.h.
2007-10-16 Darin Adler <darin@apple.com>
Reviewed by Maciej and Geoff (and looked over by Eric).
- http://bugs.webkit.org/show_bug.cgi?id=15519
eliminate use of <ctype.h> for processing ASCII
* wtf/ASCIICType.h: Added.
* wtf/DisallowCType.h: Added.
* kjs/config.h: Include DisallowCType.h.
* kjs/date_object.cpp:
(KJS::skipSpacesAndComments):
(KJS::findMonth):
(KJS::parseDate):
* kjs/function.cpp:
(KJS::decode):
* kjs/ustring.cpp:
(KJS::UString::toDouble):
Use ASCIICType.h functions instead of ctype.h ones.
2007-10-14 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- fixes for "New JavaScript benchmark"
http://bugs.webkit.org/show_bug.cgi?id=15515
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction): Implement "load" for compatibility
with SpiderMonkey.
(TestFunctionImp::): ditto
(doIt): ditto
(kjsmain): Drop useless --> from output.
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Removed unnecessary #include.
* API/JSObjectRef.cpp:
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Double-reverse build fix. My tree was out of date.
* kjs/nodes.cpp:
(NumberNode::evaluate):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Build fix.
* kjs/nodes.cpp:
(NumberNode::evaluate):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed surprising self-named "hack" that made nested functions
available as named properties of their containing functions, and placed
containing function objects in the scope chains of nested functions.
There were a few reasons to remove this "hack:"
1. It contradicted FF, IE, and the ECMA spec.
2. It incurred a performance penalty, since merely parsing a function
required parsing its body for nested functions (and so on).
3. SVN history contains no explanation for why it was added. It was just
legacy code in a large merge a long, long time ago.
[ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
* kjs/nodes.cpp:
(FuncDeclNode::processFuncDecl):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed the concept of AnonymousCode. It was unused, and it doesn't
exist in the ECMA spec.
[ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
* kjs/Context.cpp:
(KJS::Context::Context):
* kjs/function.h:
(KJS::):
* kjs/nodes.cpp:
(ReturnNode::execute):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Made function parameters DontDelete. This matches FF and the vague
description in ECMA 10.1.3. It's also required in order to make
symbol table based lookup of function parameters valid. (If the
parameters aren't DontDelete, you can't guarantee that you'll find
them later in the symbol table.)
[ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
* kjs/function.cpp:
(KJS::FunctionImp::passInParameters):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Some Vector optimizations. These are especially important when using
Vector as a stack for implementing recursive algorithms iteratively.
[ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1. Added shrink(), which is a version of resize() that you can call
to save a branch / improve code generation and inlining when you know
that the vector is not getting bigger.
2. Changed subclassing relationship in VectorBuffer to remove a call to
fastFree() in the destructor for the inlineCapacity != 0 template
specialization. This brings inline Vectors one step closer to true
stack-allocated arrays.
Also changed abort() to CRASH(), since the latter works better.
* wtf/Vector.h:
(WTF::VectorBufferBase::allocateBuffer):
(WTF::VectorBufferBase::deallocateBuffer):
(WTF::VectorBufferBase::VectorBufferBase):
(WTF::VectorBufferBase::~VectorBufferBase):
(WTF::):
(WTF::VectorBuffer::VectorBuffer):
(WTF::VectorBuffer::~VectorBuffer):
(WTF::VectorBuffer::deallocateBuffer):
(WTF::VectorBuffer::releaseBuffer):
(WTF::Vector::clear):
(WTF::Vector::removeLast):
(WTF::::operator):
(WTF::::fill):
(WTF::::shrink):
2007-10-12 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15490
Iteration statements sometimes incorrectly evaluate to the empty value
(KDE r670547).
[ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
This patch is a merge of KDE r670547, with substantial modification
for performance.
It fixes do-while statements to evaluate to a value. (They used
to evaluate to the empty value in all cases.)
It also fixes SourceElementsNode to maintain the value of abnormal
completions like "break" and "continue."
It also re-works the main execution loop in SourceElementsNode so that
it (1) makes a little more sense and (2) avoids unnecessary work. This
is a .28% speedup on command-line JS iBench.
* kjs/nodes.cpp:
(DoWhileNode::execute):
(SourceElementsNode::execute):
2007-10-15 Simon Hausmann <hausmann@kde.org>
Reviewed by Lars.
Fix compilation with gcc 4.3 by including 'limits' due to the use of std::numeric_limits.
* wtf/HashTraits.h:
2007-10-5 Kevin Ollivier <kevino@theolliviers.com>
Reviewed by Adam.
Add support for MSVC7, and fix cases where PLATFORM(WIN) should
be PLATFORM(WIN_OS) for other ports building on Windows.
* kjs/DateMath.cpp:
(KJS::getDSTOffsetSimple):
* kjs/JSImmediate.h:
* wtf/Assertions.cpp:
* wtf/Assertions.h:
* wtf/Platform.h:
* wtf/StringExtras.h:
(snprintf):
(vsnprintf):
2007-10-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Darin.
Adds NegateNode optimization from KJS. The relevant revision in KDE
is 666736.
* kjs/grammar.y:
* kjs/nodes.cpp:
(NumberNode::evaluate):
* kjs/nodes.h:
(KJS::Node::):
(KJS::NumberNode::):
* kjs/nodes2string.cpp:
(NumberNode::streamTo):
2007-10-14 Jason Foreman <jason@threeve.org>
Reviewed by Maciej.
Fix http://bugs.webkit.org/show_bug.cgi?id=15145
Ensure that if adjusting n to minimize the difference of n*intPow10(e-p+1) to x,
that the property n < intPow10(p) is maintained.
* kjs/number_object.cpp:
(NumberProtoFunc::callAsFunction):
== Rolled over to ChangeLog-2007-10-14 ==