blob: 9d56542c5dd8bb295587ca77a8f55ad8bf0bc6e5 [file] [log] [blame]
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 ==