blob: f2d9ac4c51ddd988a55f027075a5a4bcc2e73b35 [file] [log] [blame]
2008-09-04 Gavin Barraclough <barraclough@apple.com>
Reviewed by Geoffrey Garen.
Fixed an off-by-one error that would cause the StructureIDChain to
be one object too short.
Can't construct a test case because other factors make this not crash
(yet!).
* kjs/StructureID.cpp:
(KJS::StructureIDChain::StructureIDChain):
2008-09-04 Kevin Ollivier <kevino@theolliviers.com>
wx build fixes.
* JavaScriptCoreSources.bkl:
2008-09-04 Mark Rowe <mrowe@apple.com>
Reviewed by Eric Seidel.
Fix https://bugs.webkit.org/show_bug.cgi?id=20639.
Bug 20639: ENABLE_DASHBOARD_SUPPORT does not need to be a FEATURE_DEFINE
* Configurations/JavaScriptCore.xcconfig: Remove ENABLE_DASHBOARD_SUPPORT from FEATURE_DEFINES.
* wtf/Platform.h: Set ENABLE_DASHBOARD_SUPPORT for PLATFORM(MAC).
2008-09-04 Adele Peterson <adele@apple.com>
Build fix.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.vcproj/jsc/jsc.vcproj:
2008-09-04 Mark Rowe <mrowe@apple.com>
Mac build fix.
* kjs/config.h: Only check the value of HAVE_CONFIG_H if it is defined.
2008-09-04 Marco Barisione <marco.barisione@collabora.co.uk>
Reviewed by Eric Seidel.
http://bugs.webkit.org/show_bug.cgi?id=20380
[GTK][AUTOTOOLS] Include autotoolsconfig.h from config.h
* kjs/config.h: Include the configuration header generated by
autotools if available.
2008-09-04 Tor Arne Vestbø <tavestbo@trolltech.com>
Reviewed by Simon.
Fix the QtWebKit build to match changes in r36016
* JavaScriptCore.pri:
2008-09-04 Mark Rowe <mrowe@apple.com>
Fix the 64-bit build.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::printStructureID): Store the instruction offset into an unsigned local
to avoid a warning related to format specifiers.
(KJS::CodeBlock::printStructureIDs): Ditto.
2008-09-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Rubber-stamped by Oliver Hunt.
Correct the spelling of 'entryIndices'.
* kjs/PropertyMap.cpp:
(KJS::PropertyMap::get):
(KJS::PropertyMap::getLocation):
(KJS::PropertyMap::put):
(KJS::PropertyMap::insert):
(KJS::PropertyMap::remove):
(KJS::PropertyMap::checkConsistency):
* kjs/PropertyMap.h:
(KJS::PropertyMapHashTable::entries):
(KJS::PropertyMap::getOffset):
(KJS::PropertyMap::putOffset):
(KJS::PropertyMap::offsetForTableLocation):
2008-09-03 Geoffrey Garen <ggaren@apple.com>
Reviewed by Cameron Zwarich.
Fixed <rdar://problem/6193925> REGRESSION: Crash occurs at
KJS::Machine::privateExecute() when attempting to load my Mobile Gallery
(http://www.me.com/gallery/#home)
also
https://bugs.webkit.org/show_bug.cgi?id=20633 Crash in privateExecute
@ cs.byu.edu
The underlying problem was that we would cache prototype properties
even if the prototype was a dictionary.
The fix is to transition a prototype back from dictionary to normal
status when an opcode caches access to it. (This is better than just
refusing to cache, since a heavily accessed prototype is almost
certainly not a true dictionary.)
* VM/Machine.cpp:
(KJS::Machine::tryCacheGetByID):
* kjs/JSObject.h:
2008-09-03 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Clean up Platform.h and add PLATFORM(CHROMIUM), PLATFORM(SKIA) and USE(V8_BINDINGS)
* Configurations/JavaScriptCore.xcconfig: add missing ENABLE_*
* wtf/ASCIICType.h: include <wtf/Assertions.h> since it depends on it.
* wtf/Platform.h:
2008-09-03 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
Remove the rest of the "zombie" code from the profiler.
- There is no longer a need for the ProfilerClient callback mechanism.
* API/JSProfilerPrivate.cpp:
(JSStartProfiling):
* JavaScriptCore.exp:
* profiler/HeavyProfile.h:
* profiler/ProfileGenerator.cpp:
(KJS::ProfileGenerator::create):
(KJS::ProfileGenerator::ProfileGenerator):
* profiler/ProfileGenerator.h:
(KJS::ProfileGenerator::profileGroup):
* profiler/Profiler.cpp:
(KJS::Profiler::startProfiling):
(KJS::Profiler::stopProfiling): Immediately return the profile when
stopped instead of using a callback.
* profiler/Profiler.h:
* profiler/TreeProfile.h:
2008-09-03 Adele Peterson <adele@apple.com>
Build fix.
* wtf/win/MainThreadWin.cpp:
2008-09-02 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin and Tim.
Remove most of the "zombie" mode from the profiler. Next we will need
to remove the client callback mechanism in profiles.
- This simplifies the code, leverages the recent changes I've made in
getting line numbers from SquirrelFish, and is a slight speed
improvement on SunSpider.
- Also the "zombie" mode was a constant source of odd edge cases and
obscure bugs so it's good to remove since all of its issues may not have
been found.
* API/JSProfilerPrivate.cpp: No need to call didFinishAllExecution() any
more.
(JSEndProfiling):
* JavaScriptCore.exp: Export the new signature of retrieveLastCaller()
* VM/Machine.cpp:
(KJS::Machine::execute): No need to call didFinishAllExecution() any
more.
(KJS::Machine::retrieveCaller): Now operates on InternalFunctions now
since the RegisterFile is no longer guaranteeded to store only
JSFunctions
(KJS::Machine::retrieveLastCaller): Now also retrieve the function's
name
(KJS::Machine::callFrame): A result of changing retrieveCaller()
* VM/Machine.h:
* VM/Register.h:
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::~JSGlobalObject):
* kjs/nodes.h:
* profiler/ProfileGenerator.cpp:
(KJS::ProfileGenerator::create): Now pass the original exec and get the
global exec and client when necessary. We need the original exec so we
can have the stack frame where profiling started.
(KJS::ProfileGenerator::ProfileGenerator): ditto.
(KJS::ProfileGenerator::addParentForConsoleStart): This is where the
parent to star of the profile is added, if there is one.
(KJS::ProfileGenerator::willExecute): Remove uglyness!
(KJS::ProfileGenerator::didExecute): Ditto!
(KJS::ProfileGenerator::stopProfiling):
(KJS::ProfileGenerator::removeProfileStart): Use a better way to find
and remove the function we are looking for.
(KJS::ProfileGenerator::removeProfileEnd): Ditto.
* profiler/ProfileGenerator.h:
(KJS::ProfileGenerator::client):
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::removeChild): Add a better way to remove a child from
a ProfileNode.
(KJS::ProfileNode::stopProfiling):
(KJS::ProfileNode::debugPrintData): Modified a debug-only diagnostic
function to be sane.
* profiler/ProfileNode.h:
* profiler/Profiler.cpp: Change to pass the original exec state.
(KJS::Profiler::startProfiling):
(KJS::Profiler::stopProfiling):
(KJS::Profiler::willExecute):
(KJS::Profiler::didExecute):
(KJS::Profiler::createCallIdentifier):
* profiler/Profiler.h:
2008-09-01 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin Adler.
Implement callOnMainThreadAndWait().
This will be useful when a background thread needs to perform UI calls synchronously
(e.g. an openDatabase() call cannot return until the user answers to a confirmation dialog).
* wtf/MainThread.cpp:
(WTF::FunctionWithContext::FunctionWithContext): Added a ThreadCondition member. When
non-zero, the condition is signalled after the function is called.
(WTF::mainThreadFunctionQueueMutex): Renamed from functionQueueMutex, sinc this is no longer
static. Changed to be initialized from initializeThreading() to avoid lock contention.
(WTF::initializeMainThread): On non-Windows platforms, just call mainThreadFunctionQueueMutex.
(WTF::dispatchFunctionsFromMainThread): Signal synchronous calls when done.
(WTF::callOnMainThread): Updated for functionQueueMutex rename.
(WTF::callOnMainThreadAndWait): Added.
* wtf/MainThread.h: Added callOnMainThreadAndWait(); initializeMainThread() now exists on
all platforms.
* wtf/win/MainThreadWin.cpp: (WTF::initializeMainThread): Added a callOnMainThreadAndWait()
call to initialize function queue mutex.
* wtf/ThreadingGtk.cpp: (WTF::initializeThreading):
* wtf/ThreadingPthreads.cpp: (WTF::initializeThreading):
* wtf/ThreadingQt.cpp: (WTF::initializeThreading):
Only initialize mainThreadIdentifier on non-Darwin platforms. It was not guaranteed to be
accurate on Darwin.
2008-09-03 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Use isUndefinedOrNull() instead of separate checks for each in op_eq_null
and op_neq_null.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-09-02 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
Reviewed by Darin Adler.
Bug 20296: OpcodeStats doesn't build on platforms which don't have mergesort().
<https://bugs.webkit.org/show_bug.cgi?id=20296>
* VM/Opcode.cpp:
(KJS::OpcodeStats::~OpcodeStats): mergesort() replaced with qsort()
2008-09-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fast path for array.length and string.length.
SunSpider says 0.5% faster.
2008-09-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Anders Carlsson.
Added optimized paths for comparing to null.
SunSpider says 0.5% faster.
2008-09-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Changed jsDriver.pl to dump the exact text you would need in order to
reproduce a test result. This enables a fast workflow where you copy
and paste a test failure in the terminal.
* tests/mozilla/jsDriver.pl:
2008-09-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Implemented the rest of Darin's review comments for the 09-01 inline
caching patch.
SunSpider says 0.5% faster, but that seems like noise.
* JavaScriptCore.xcodeproj/project.pbxproj: Put PutPropertySlot into
its own file, and added BatchedTransitionOptimizer.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::~CodeBlock): Use array indexing instead of a pointer
iterator.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator): Used BatchedTransitionOptimizer to
make batched put and remove for declared variables fast, without forever
pessimizing the global object. Removed the old getDirect/removeDirect hack
that tried to do the same in a more limited way.
* VM/CodeGenerator.h: Moved IdentifierRepHash to the KJS namespace since
it doesn't specialize anything in WTF.
* VM/Machine.cpp:
(KJS::Machine::Machine): Nixed the DummyConstruct tag because it was
confusingly named.
(KJS::Machine::execute): Used BatchedTransitionOptimizer, as above. Fixed
up some comments.
(KJS::cachePrototypeChain): Cast to JSObject*, since it's more specific.
(KJS::Machine::tryCachePutByID): Use isNull() instead of comparing to
jsNull(), since isNull() leaves more options open for the future.
(KJS::Machine::tryCacheGetByID): ditto
(KJS::Machine::privateExecute): ditto
* VM/SamplingTool.cpp:
(KJS::SamplingTool::dump): Use C++-style cast, to match our style
guidelines.
* kjs/BatchedTransitionOptimizer.h: Added. New class that allows host
code to add a batch of properties to an object in an efficient way.
* kjs/JSActivation.cpp: Use isNull(), as above.
* kjs/JSArray.cpp: Get rid of DummyConstruct tag, as above.
* kjs/JSArray.h:
* kjs/JSGlobalData.cpp: Nixed two unused StructureIDs.
* kjs/JSGlobalData.h:
* kjs/JSImmediate.cpp: Use isNull(), as above.
* kjs/JSObject.cpp:
(KJS::JSObject::mark): Moved mark tracing code elsewhere, to make this
function more readable.
(KJS::JSObject::put): Use isNull(), as above.
(KJS::JSObject::createInheritorID): Return a raw pointer, since the
object is owned by a data member, not necessarily the caller.
* kjs/JSObject.h:
* kjs/JSString.cpp: Use isNull(), as above.
* kjs/PropertyMap.h: Updated to use PropertySlot::invalidOffset.
* kjs/PropertySlot.h: Changed KJS_INVALID_OFFSET to WTF::notFound
because C macros are so 80's.
* kjs/PutPropertySlot.h: Added. Split out of PropertySlot.h. Also renamed
PutPropertySlot::SlotType to PutPropertySlot::Type, and slotBase to base,
since "slot" was redundant.
* kjs/StructureID.cpp: Added a new transition *away* from dictionary
status, to support BatchedTransitionOptimizer.
(KJS::StructureIDChain::StructureIDChain): No need to store m_size as
a data member, so keep it in a local, which might be faster.
* kjs/StructureID.h:
* kjs/SymbolTable.h: Moved IdentifierRepHash to KJS namespace, as above.
* kjs/ustring.h:
2008-09-02 Adam Roben <aroben@apple.com>
Windows build fixes
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
StructureID.{cpp,h} to the project. Also let VS reorder this file.
* VM/CodeBlock.cpp: Include StringExtras so that snprintf will be
defined on Windows.
2008-09-01 Sam Weinig <sam@webkit.org>
Fix release build.
* JavaScriptCore.exp:
2008-09-01 Jan Michael Alonzo <jmalonzo@webkit.org>
Reviewed by Oliver Hunt.
Gtk buildfix
* GNUmakefile.am:
* kjs/PropertyMap.cpp: rename Identifier.h to identifier.h
* kjs/StructureID.cpp: include JSObject.h
2008-09-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
First cut at inline caching for access to vanilla JavaScript properties.
SunSpider says 4% faster. Tests heavy on dictionary-like access have
regressed a bit -- we have a lot of room to improve in this area,
but this patch is over-ripe as-is.
JSCells now have a StructureID that uniquely identifies their layout,
and holds their prototype.
JSValue::put takes a PropertySlot& argument, so it can fill in details
about where it put a value, for the sake of caching.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator): Avoid calling removeDirect if we
can, since it disables inline caching in the global object. This can
probably improve in the future.
* kjs/JSGlobalObject.cpp: Nixed reset(), since it complicates caching, and
wasn't really necessary.
* kjs/JSObject.cpp: Tweaked getter / setter behavior not to rely on the
IsGetterSetter flag, since the flag was buggy. This is necessary in order
to avoid accidentally accessing a getter / setter as a normal property.
Also changed getter / setter creation to honor ReadOnly, matching Mozilla.
* kjs/PropertyMap.cpp: Nixed clear(), since it complicates caching and
isn't necessary.
* kjs/Shell.cpp: Moved SamplingTool dumping outside the loop. This allows
you to aggregate sampling of multiple files (or the same file repeatedly),
which helped me track down regressions.
* kjs/ustring.h: Moved IdentifierRepHash here to share it.
2008-09-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Eagerly allocate the Math object's numeric constants. This avoids
constantly reallocating them in loops, and also ensures that the Math
object will not use the single property optimization, which makes
properties ineligible for caching.
SunSpider reports a small speedup, in combination with inline caching.
* kjs/MathObject.cpp:
(KJS::MathObject::MathObject):
(KJS::MathObject::getOwnPropertySlot):
* kjs/MathObject.h:
2008-09-01 Jan Michael Alonzo <jmalonzo@webkit.org>
Gtk build fix, not reviewed.
* GNUmakefile.am: Add SmallStrings.cpp in both release and debug builds
2008-08-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej Stachowiak.
Bug 20577: REGRESSION (r36006): Gmail is broken
<https://bugs.webkit.org/show_bug.cgi?id=20577>
r36006 changed stringProtoFuncSubstr() so that it is uses the more
efficient jsSubstring(), rather than using UString::substr() and then
calling jsString(). However, the change did not account for the case
where the start and the length of the substring extend beyond the length
of the original string. This patch corrects that.
* kjs/StringPrototype.cpp:
(KJS::stringProtoFuncSubstr):
2008-08-31 Simon Hausmann <hausmann@wekit.org>
Unreviewed build fix (with gcc 4.3)
* kjs/ustring.h: Properly forward declare operator== for UString and
the the concatenate functions inside the KJS namespace.
2008-08-30 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- https://bugs.webkit.org/show_bug.cgi?id=20333
improve JavaScript speed when handling single-character strings
1.035x as fast on SunSpider overall.
1.127x as fast on SunSpider string tests.
1.910x as fast on SunSpider string-base64 test.
* API/JSObjectRef.cpp:
(JSObjectMakeFunction): Removed unneeded explicit construction of UString.
* GNUmakefile.am: Added SmallStrings.h and SmallStrings.cpp.
* JavaScriptCore.pri: Ditto.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
Ditto.
* JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
* JavaScriptCoreSources.bkl: Ditto.
* JavaScriptCore.exp: Updated.
* VM/Machine.cpp:
(KJS::jsAddSlowCase): Changed to use a code path that doesn't involve
a UString constructor. This avoids an extra jump caused by the "in charge"
vs. "not in charge" constructors.
(KJS::jsAdd): Ditto.
(KJS::jsTypeStringForValue): Adopted jsNontrivialString.
* kjs/ArrayPrototype.cpp:
(KJS::arrayProtoFuncToString): Adopted jsEmptyString.
(KJS::arrayProtoFuncToLocaleString): Ditto.
(KJS::arrayProtoFuncJoin): Ditto.
* kjs/BooleanPrototype.cpp:
(KJS::booleanProtoFuncToString): Adopted jsNontrivialString.
* kjs/DateConstructor.cpp:
(KJS::callDate): Ditto.
* kjs/DatePrototype.cpp:
(KJS::formatLocaleDate): Adopted jsEmptyString and jsNontrivialString.
(KJS::dateProtoFuncToString): Ditto.
(KJS::dateProtoFuncToUTCString): Ditto.
(KJS::dateProtoFuncToDateString): Ditto.
(KJS::dateProtoFuncToTimeString): Ditto.
(KJS::dateProtoFuncToLocaleString): Ditto.
(KJS::dateProtoFuncToLocaleDateString): Ditto.
(KJS::dateProtoFuncToLocaleTimeString): Ditto.
(KJS::dateProtoFuncToGMTString): Ditto.
* kjs/ErrorPrototype.cpp:
(KJS::ErrorPrototype::ErrorPrototype): Ditto.
(KJS::errorProtoFuncToString): Ditto.
* kjs/JSGlobalData.h: Added SmallStrings.
* kjs/JSString.cpp:
(KJS::jsString): Eliminated the overload that takes a const char*.
Added code to use SmallStrings to get strings of small sizes rather
than creating a new JSString every time.
(KJS::jsSubstring): Added. Used when creating a string from a substring
to avoid creating a JSString in cases where the substring will end up
empty or as one character.
(KJS::jsOwnedString): Added the same code as in jsString.
* kjs/JSString.h: Added new functions jsEmptyString, jsSingleCharacterString,
jsSingleCharacterSubstring, jsSubstring, and jsNontrivialString for various
cases where we want to create JSString, and want special handling for small
strings.
(KJS::JSString::JSString): Added an overload that takes a PassRefPtr of
a UString::Rep so you don't have to construct a UString; PassRefPtr can be
more efficient.
(KJS::jsEmptyString): Added.
(KJS::jsSingleCharacterString): Added.
(KJS::jsSingleCharacterSubstring): Added.
(KJS::jsNontrivialString): Added.
(KJS::JSString::getIndex): Adopted jsSingleCharacterSubstring.
(KJS::JSString::getStringPropertySlot): Ditto.
* kjs/NumberPrototype.cpp:
(KJS::numberProtoFuncToFixed): Adopted jsNontrivialString.
(KJS::numberProtoFuncToExponential): Ditto.
(KJS::numberProtoFuncToPrecision): Ditto.
* kjs/ObjectPrototype.cpp:
(KJS::objectProtoFuncToLocaleString): Adopted toThisJSString.
(KJS::objectProtoFuncToString): Adopted jsNontrivialString.
* kjs/RegExpConstructor.cpp: Separated the lastInput value that's used
with the lastOvector to return matches from the input value that can be
changed via JavaScript. They will be equal in many cases, but not all.
(KJS::RegExpConstructor::performMatch): Set input.
(KJS::RegExpMatchesArray::RegExpMatchesArray): Ditto.
(KJS::RegExpMatchesArray::fillArrayInstance): Adopted jsSubstring. Also,
use input rather than lastInput in the appropriate place.
(KJS::RegExpConstructor::getBackref): Adopted jsSubstring and jsEmptyString.
Added code to handle the case where there is no backref -- before this
depended on range checking in UString::substr which is not present in
jsSubstring.
(KJS::RegExpConstructor::getLastParen): Ditto.
(KJS::RegExpConstructor::getLeftContext): Ditto.
(KJS::RegExpConstructor::getRightContext): Ditto.
(KJS::RegExpConstructor::getValueProperty): Use input rather than lastInput.
Also adopt jsEmptyString.
(KJS::RegExpConstructor::putValueProperty): Ditto.
(KJS::RegExpConstructor::input): Ditto.
* kjs/RegExpPrototype.cpp:
(KJS::regExpProtoFuncToString): Adopt jsNonTrivialString. Also changed to
use UString::append to append single characters rather than using += and
a C-style string.
* kjs/SmallStrings.cpp: Added.
(KJS::SmallStringsStorage::SmallStringsStorage): Construct the
buffer and UString::Rep for all 256 single-character strings for
the U+0000 through U+00FF. This covers all the values used in
the base64 test as well as most values seen elsewhere on the web
as well. It's possible that later we might fix this to only work
for U+0000 through U+007F but the others are used quite a bit in
the current version of the base64 test.
(KJS::SmallStringsStorage::~SmallStringsStorage): Free memory.
(KJS::SmallStrings::SmallStrings): Create a set of small strings,
initially not created; created later when they are used.
(KJS::SmallStrings::~SmallStrings): Deallocate. Not left compiler
generated because the SmallStringsStorage class's destructor needs
to be visible.
(KJS::SmallStrings::mark): Mark all the strings.
(KJS::SmallStrings::createEmptyString): Create a cell for the
empty string. Called only the first time.
(KJS::SmallStrings::createSingleCharacterString): Create a cell
for one of the single-character strings. Called only the first time.
* kjs/SmallStrings.h: Added.
* kjs/StringConstructor.cpp:
(KJS::stringFromCharCodeSlowCase): Factored out of strinFromCharCode.
Only used for cases where the caller does not pass exactly one argument.
(KJS::stringFromCharCode): Adopted jsSingleCharacterString.
(KJS::callStringConstructor): Adopted jsEmptyString.
* kjs/StringObject.cpp:
(KJS::StringObject::StringObject): Adopted jsEmptyString.
* kjs/StringPrototype.cpp:
(KJS::stringProtoFuncReplace): Adopted jsSubstring.
(KJS::stringProtoFuncCharAt): Adopted jsEmptyString and
jsSingleCharacterSubstring and also added a special case when the
index is an immediate number to avoid conversion to and from floating
point, since that's the common case.
(KJS::stringProtoFuncCharCodeAt): Ditto.
(KJS::stringProtoFuncMatch): Adopted jsSubstring and jsEmptyString.
(KJS::stringProtoFuncSlice): Adopted jsSubstring and
jsSingleCharacterSubstring. Also got rid of some unneeded locals and
removed unneeded code to set the length property of the array, since it
is automatically updated as values are added to the array.
(KJS::stringProtoFuncSplit): Adopted jsEmptyString.
(KJS::stringProtoFuncSubstr): Adopted jsSubstring.
(KJS::stringProtoFuncSubstring): Ditto.
* kjs/collector.cpp:
(KJS::Heap::collect): Added a call to mark SmallStrings.
* kjs/ustring.cpp:
(KJS::UString::expandedSize): Made this a static member function since
it doesn't need to look at any data members.
(KJS::UString::expandCapacity): Use a non-inline function, makeNull, to
set the rep to null in failure cases. This avoids adding a PIC branch for
the normal case when there is no failure.
(KJS::UString::expandPreCapacity): Ditto.
(KJS::UString::UString): Ditto.
(KJS::concatenate): Refactored the concatenation constructor into this
separate function. Calling the concatenation constructor was leading to
an extra branch because of the in-charge vs. not-in-charge versions not
both being inlined, and this was showing up as nearly 1% on Shark. Also
added a special case for when the second string is a single character,
since it's a common idiom to build up a string that way and we can do
things much more quickly, without involving memcpy for example. Also
adopted the non-inline function, nullRep, for the same reason given for
makeNull above.
(KJS::UString::append): Adopted makeNull for failure cases.
(KJS::UString::operator=): Ditto.
(KJS::UString::toDouble): Added a special case for converting single
character strings to numbers. We're doing this a ton of times while
running the base64 test.
(KJS::operator==): Added special cases so we can compare single-character
strings without calling memcmp. Later we might want to special case other
short lengths similarly.
(KJS::UString::makeNull): Added.
(KJS::UString::nullRep): Added.
* kjs/ustring.h: Added declarations for the nullRep and makeNull. Changed
expandedSize to be a static member function. Added a declaration of the
concatenate function. Removed the concatenation constructor. Rewrote
operator+ to use the concatenate function.
2008-08-29 Anders Carlsson <andersca@apple.com>
Build fix.
* VM/Machine.cpp:
(KJS::getCPUTime):
2008-08-29 Anders Carlsson <andersca@apple.com>
Reviewed by Darin.
<rdar://problem/6174667>
When a machine is under heavy load, the Slow Script dialog often comes up many times and just gets in the way
Instead of using clock time, use the CPU time spent executing the current thread when
determining if the script has been running for too long.
* VM/Machine.cpp:
(KJS::getCPUTime):
(KJS::Machine::checkTimeout):
2008-08-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Rubber-stamped by Sam Weinig.
Change 'term' to 'expr' in variable names to standardize terminology.
* kjs/nodes.cpp:
(KJS::BinaryOpNode::emitCode):
(KJS::ReverseBinaryOpNode::emitCode):
(KJS::ThrowableBinaryOpNode::emitCode):
* kjs/nodes.h:
(KJS::BinaryOpNode::BinaryOpNode):
(KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
(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::ThrowableBinaryOpNode::):
(KJS::InstanceOfNode::):
(KJS::InNode::):
(KJS::EqualNode::):
(KJS::NotEqualNode::):
(KJS::StrictEqualNode::):
(KJS::NotStrictEqualNode::):
(KJS::BitAndNode::):
(KJS::BitOrNode::):
(KJS::BitXOrNode::):
* kjs/nodes2string.cpp:
(KJS::MultNode::streamTo):
(KJS::DivNode::streamTo):
(KJS::ModNode::streamTo):
(KJS::AddNode::streamTo):
(KJS::SubNode::streamTo):
(KJS::LeftShiftNode::streamTo):
(KJS::RightShiftNode::streamTo):
(KJS::UnsignedRightShiftNode::streamTo):
(KJS::LessNode::streamTo):
(KJS::GreaterNode::streamTo):
(KJS::LessEqNode::streamTo):
(KJS::GreaterEqNode::streamTo):
(KJS::InstanceOfNode::streamTo):
(KJS::InNode::streamTo):
(KJS::EqualNode::streamTo):
(KJS::NotEqualNode::streamTo):
(KJS::StrictEqualNode::streamTo):
(KJS::NotStrictEqualNode::streamTo):
(KJS::BitAndNode::streamTo):
(KJS::BitXOrNode::streamTo):
(KJS::BitOrNode::streamTo):
2008-08-28 Alp Toker <alp@nuanti.com>
GTK+ dist/build fix. List newly added header files.
* GNUmakefile.am:
2008-08-28 Sam Weinig <sam@webkit.org>
Reviewed by Oliver Hunt.
Change to throw a ReferenceError at runtime instead of a ParseError
at parse time, when the left hand side expression of a for-in statement
is not an lvalue.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ForInNode::emitCode):
2008-08-28 Alexey Proskuryakov <ap@webkit.org>
Not reviewed, build fix (at least for OpenBSD, posssibly more).
https://bugs.webkit.org/show_bug.cgi?id=20545
missing #include <unistd.h> in JavaScriptCore/VM/SamplingTool.cpp
* VM/SamplingTool.cpp: add the missing include.
2008-08-26 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff and Cameron.
<rdar://problem/6174603> Hitting assertion in Register::codeBlock when
loading facebook (20516).
- This was a result of my line numbers change. After a host function is
called the stack does not get reset correctly.
- Oddly this also appears to be a slight speedup on SunSpider.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-08-26 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff and Tim.
Export new API methods.
* JavaScriptCore.exp:
2008-08-25 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff, Tim and Mark.
<rdar://problem/6150623> JSProfiler: It would be nice if the profiles
in the console said what file and line number they came from
- Lay the foundation for getting line numbers and other data from the
JavaScript engine. With the cleanup in kjs/ExecState this is actually
a slight performance improvement.
* JavaScriptCore.exp: Export retrieveLastCaller() for WebCore.
* JavaScriptCore.xcodeproj/project.pbxproj:
* VM/Machine.cpp: Now Host and JS functions set a call frame on the
exec state, so this and the profiler code were pulled out of the
branches.
(KJS::Machine::privateExecute):
(KJS::Machine::retrieveLastCaller): This get's the lineNumber, sourceID
and sourceURL for the previously called function.
* VM/Machine.h:
* kjs/ExecState.cpp: Remove references to JSFunction since it's not used
anywhere.
* kjs/ExecState.h:
2008-08-25 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Ensure that JSGlobalContextRelease() performs garbage collection, even if there are other
contexts in the current context's group.
This is only really necessary when the last reference is released, but there is no way to
determine that, and no harm in collecting slightly more often.
* API/JSContextRef.cpp: (JSGlobalContextRelease): Explicitly collect the heap if it is not
being destroyed.
2008-08-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver Hunt.
Bug 20093: JSC shell does not clear exceptions after it executes toString on an expression
<https://bugs.webkit.org/show_bug.cgi?id=20093>
Clear exceptions after evaluating any code in the JSC shell. We do not
report exceptions that are caused by calling toString on the final
valued, but at least we avoid incorrect behaviour.
Also, print any exceptions that occurred while evaluating code at the
interactive prompt, not just while evaluating code from a file.
* kjs/Shell.cpp:
(runWithScripts):
(runInteractive):
2008-08-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Remove an unnecessary RefPtr to a RegisterID.
* kjs/nodes.cpp:
(KJS::DeleteBracketNode::emitCode):
2008-08-24 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Use the correct version number for when JSGlobalContextCreate was introduced.
* API/JSContextRef.h:
2008-08-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Rubber-stamped by Mark Rowe.
Remove modelines.
* API/APICast.h:
* API/JSBase.cpp:
* API/JSCallbackConstructor.cpp:
* API/JSCallbackConstructor.h:
* API/JSCallbackFunction.cpp:
* API/JSCallbackFunction.h:
* API/JSCallbackObject.cpp:
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
* API/JSClassRef.cpp:
* API/JSContextRef.cpp:
* API/JSObjectRef.cpp:
* API/JSProfilerPrivate.cpp:
* API/JSStringRef.cpp:
* API/JSStringRefBSTR.cpp:
* API/JSStringRefCF.cpp:
* API/JSValueRef.cpp:
* API/tests/JSNode.c:
* API/tests/JSNode.h:
* API/tests/JSNodeList.c:
* API/tests/JSNodeList.h:
* API/tests/Node.c:
* API/tests/Node.h:
* API/tests/NodeList.c:
* API/tests/NodeList.h:
* API/tests/minidom.c:
* API/tests/minidom.js:
* API/tests/testapi.c:
* API/tests/testapi.js:
* JavaScriptCore.pro:
* kjs/FunctionConstructor.h:
* kjs/FunctionPrototype.h:
* kjs/JSArray.h:
* kjs/JSString.h:
* kjs/JSWrapperObject.cpp:
* kjs/NumberConstructor.h:
* kjs/NumberObject.h:
* kjs/NumberPrototype.h:
* kjs/lexer.h:
* kjs/lookup.h:
* wtf/Assertions.cpp:
* wtf/Assertions.h:
* wtf/HashCountedSet.h:
* wtf/HashFunctions.h:
* wtf/HashIterators.h:
* wtf/HashMap.h:
* wtf/HashSet.h:
* wtf/HashTable.h:
* wtf/HashTraits.h:
* wtf/ListHashSet.h:
* wtf/ListRefPtr.h:
* wtf/Noncopyable.h:
* wtf/OwnArrayPtr.h:
* wtf/OwnPtr.h:
* wtf/PassRefPtr.h:
* wtf/Platform.h:
* wtf/RefPtr.h:
* wtf/RefPtrHashMap.h:
* wtf/RetainPtr.h:
* wtf/UnusedParam.h:
* wtf/Vector.h:
* wtf/VectorTraits.h:
* wtf/unicode/Unicode.h:
* wtf/unicode/icu/UnicodeIcu.h:
2008-08-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Some cleanup to match our coding style.
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/ExecState.cpp:
* kjs/ExecState.h:
* kjs/completion.h:
* kjs/identifier.cpp:
(KJS::Identifier::equal):
(KJS::CStringTranslator::hash):
(KJS::CStringTranslator::equal):
(KJS::CStringTranslator::translate):
(KJS::UCharBufferTranslator::equal):
(KJS::UCharBufferTranslator::translate):
(KJS::Identifier::remove):
* kjs/operations.h:
2008-08-20 Alexey Proskuryakov <ap@webkit.org>
Windows build fix.
* API/WebKitAvailability.h: Define DEPRECATED_ATTRIBUTE.
2008-08-19 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff Garen.
Bring back shared JSGlobalData and implicit locking, because too many clients rely on it.
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::~JSGlobalData):
(KJS::JSGlobalData::JSGlobalData): Re-add shared instance.
(KJS::JSGlobalData::sharedInstanceExists): Ditto.
(KJS::JSGlobalData::sharedInstance): Ditto.
(KJS::JSGlobalData::sharedInstanceInternal): Ditto.
* API/JSContextRef.h: Deprecated JSGlobalContextCreate(). Added a very conservative
description of its threading model (nothing is allowed).
* API/JSContextRef.cpp:
(JSGlobalContextCreate): Use shared JSGlobalData.
(JSGlobalContextCreateInGroup): Support passing NULL group to request a unique one.
(JSGlobalContextRetain): Added back locking.
(JSGlobalContextRelease): Ditto.
(JSContextGetGlobalObject): Ditto.
* API/tests/minidom.c: (main):
* API/tests/testapi.c: (main):
Switched to JSGlobalContextCreateInGroup() to avoid deprecation warnings.
* JavaScriptCore.exp: Re-added JSLock methods. Added JSGlobalContextCreateInGroup (d'oh!).
* API/JSBase.cpp:
(JSEvaluateScript):
(JSCheckScriptSyntax):
(JSGarbageCollect):
* API/JSCallbackConstructor.cpp:
(KJS::constructJSCallback):
* API/JSCallbackFunction.cpp:
(KJS::JSCallbackFunction::call):
* API/JSCallbackObjectFunctions.h:
(KJS::::init):
(KJS::::getOwnPropertySlot):
(KJS::::put):
(KJS::::deleteProperty):
(KJS::::construct):
(KJS::::hasInstance):
(KJS::::call):
(KJS::::getPropertyNames):
(KJS::::toNumber):
(KJS::::toString):
(KJS::::staticValueGetter):
(KJS::::callbackGetter):
* API/JSObjectRef.cpp:
(JSObjectMake):
(JSObjectMakeFunctionWithCallback):
(JSObjectMakeConstructor):
(JSObjectMakeFunction):
(JSObjectHasProperty):
(JSObjectGetProperty):
(JSObjectSetProperty):
(JSObjectGetPropertyAtIndex):
(JSObjectSetPropertyAtIndex):
(JSObjectDeleteProperty):
(JSObjectCallAsFunction):
(JSObjectCallAsConstructor):
(JSObjectCopyPropertyNames):
(JSPropertyNameArrayRelease):
(JSPropertyNameAccumulatorAddName):
* API/JSValueRef.cpp:
(JSValueIsEqual):
(JSValueIsInstanceOfConstructor):
(JSValueMakeNumber):
(JSValueMakeString):
(JSValueToNumber):
(JSValueToStringCopy):
(JSValueToObject):
(JSValueProtect):
(JSValueUnprotect):
* ForwardingHeaders/JavaScriptCore/JSLock.h: Added.
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* kjs/AllInOneFile.cpp:
* kjs/JSGlobalData.h:
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::~JSGlobalObject):
(KJS::JSGlobalObject::init):
* kjs/JSLock.cpp: Added.
(KJS::createJSLockCount):
(KJS::JSLock::lockCount):
(KJS::setLockCount):
(KJS::JSLock::JSLock):
(KJS::JSLock::lock):
(KJS::JSLock::unlock):
(KJS::JSLock::currentThreadIsHoldingLock):
(KJS::JSLock::DropAllLocks::DropAllLocks):
(KJS::JSLock::DropAllLocks::~DropAllLocks):
* kjs/JSLock.h: Added.
(KJS::JSLock::JSLock):
(KJS::JSLock::~JSLock):
* kjs/Shell.cpp:
(functionGC):
(jscmain):
* kjs/collector.cpp:
(KJS::Heap::~Heap):
(KJS::Heap::heapAllocate):
(KJS::Heap::setGCProtectNeedsLocking):
(KJS::Heap::protect):
(KJS::Heap::unprotect):
(KJS::Heap::collect):
* kjs/identifier.cpp:
* kjs/interpreter.cpp:
(KJS::Interpreter::checkSyntax):
(KJS::Interpreter::evaluate):
Re-added implicit locking.
2008-08-19 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim and Mark.
Implement DTrace hooks for dashcode and instruments.
* API/JSProfilerPrivate.cpp: Added. Expose SPI so that profiling can be
turned on from a client. The DTrace probes were added within the
profiler mechanism for performance reasons so the profiler must be
started to enable tracing.
(JSStartProfiling):
(JSEndProfiling):
* API/JSProfilerPrivate.h: Added. Ditto.
* JavaScriptCore.exp: Exposing the start/stop methods to clients.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/Tracing.d: Define the DTrace probes.
* kjs/Tracing.h: Ditto.
* profiler/ProfileGenerator.cpp: Implement the DTrace probes in the
profiler.
(KJS::ProfileGenerator::willExecute):
(KJS::ProfileGenerator::didExecute):
2008-08-19 Steve Falkenburg <sfalken@apple.com>
Build fix.
* kjs/operations.cpp:
(KJS::equal):
2008-08-18 Timothy Hatcher <timothy@apple.com>
Fix an assertion when generating a heavy profile because the
empty value and deleted value of CallIdentifier where equal.
https://bugs.webkit.org/show_bug.cgi?id=20439
Reviewed by Dan Bernstein.
* profiler/CallIdentifier.h: Make the emptyValue for CallIdentifier
use empty strings for URL and function name.
2008-08-12 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- eliminate JSValue::type()
This will make it slightly easier to change the JSImmediate design without
having to touch so many call sites.
SunSpider says this change is a wash (looked like a slight speedup, but not
statistically significant).
* API/JSStringRef.cpp: Removed include of JSType.h.
* API/JSValueRef.cpp: Removed include of JSType.h.
(JSValueGetType): Replaced use of JSValue::type() with
JSValue::is functions.
* JavaScriptCore.exp: Updated.
* VM/JSPropertyNameIterator.cpp: Removed type() implementation.
(KJS::JSPropertyNameIterator::toPrimitive): Changed to take
PreferredPrimitiveType argument instead of JSType.
* VM/JSPropertyNameIterator.h: Ditto.
* VM/Machine.cpp:
(KJS::fastIsNumber): Updated for name change.
(KJS::fastToInt32): Ditto.
(KJS::fastToUInt32): Ditto.
(KJS::jsAddSlowCase): Updated toPrimitive caller for change from
JSType to PreferredPrimitiveType.
(KJS::jsAdd): Replaced calls to JSValue::type() with calls to
JSValue::isString().
(KJS::jsTypeStringForValue): Replaced calls to JSValue::type()
with multiple calls to JSValue::is -- we could make this a
virtual function instead if we want to have faster performance.
(KJS::Machine::privateExecute): Renamed JSImmediate::toTruncatedUInt32
to JSImmediate::getTruncatedUInt32 for consistency with other functions.
Changed two calls of JSValue::type() to JSValue::isString().
* kjs/GetterSetter.cpp:
(KJS::GetterSetter::toPrimitive): Changed to take
PreferredPrimitiveType argument instead of JSType.
(KJS::GetterSetter::isGetterSetter): Added.
* kjs/GetterSetter.h:
* kjs/JSCell.cpp:
(KJS::JSCell::isString): Added.
(KJS::JSCell::isGetterSetter): Added.
(KJS::JSCell::isObject): Added.
* kjs/JSCell.h: Eliminated type function. Added isGetterSetter.
Made isString and isObject virtual. Changed toPrimitive to take
PreferredPrimitiveType argument instead of JSType.
(KJS::JSCell::isNumber): Use Heap::isNumber for faster performance.
(KJS::JSValue::isGetterSetter): Added.
(KJS::JSValue::toPrimitive): Changed to take
PreferredPrimitiveType argument instead of JSType.
* kjs/JSImmediate.h: Removed JSValue::type() and replaced
JSValue::toTruncatedUInt32 with JSValue::getTruncatedUInt32.
(KJS::JSImmediate::isEitherImmediate): Added.
* kjs/JSNotAnObject.cpp:
(KJS::JSNotAnObject::toPrimitive): Changed to take
PreferredPrimitiveType argument instead of JSType.
* kjs/JSNotAnObject.h: Ditto.
* kjs/JSNumberCell.cpp:
(KJS::JSNumberCell::toPrimitive): Ditto.
* kjs/JSNumberCell.h:
(KJS::JSNumberCell::toInt32): Renamed from fastToInt32. There's no
other "slow" version of this once you have a JSNumberCell, so there's
no need for "fast" in the name. It's a feature that this hides the
base class toInt32, which does the same job less efficiently (and has
an additional ExecState argument).
(KJS::JSNumberCell::toUInt32): Ditto.
* kjs/JSObject.cpp:
(KJS::callDefaultValueFunction): Use isGetterSetter instead of type.
(KJS::JSObject::getPrimitiveNumber): Use PreferredPrimitiveType.
(KJS::JSObject::defaultValue): Ditto.
(KJS::JSObject::defineGetter): Use isGetterSetter.
(KJS::JSObject::defineSetter): Ditto.
(KJS::JSObject::lookupGetter): Ditto.
(KJS::JSObject::lookupSetter): Ditto.
(KJS::JSObject::toNumber): Use PreferredPrimitiveType.
(KJS::JSObject::toString): Ditto.
(KJS::JSObject::isObject): Added.
* kjs/JSObject.h:
(KJS::JSObject::inherits): Call the isObject from JSCell; it's now
hidden by our override of isObject.
(KJS::JSObject::getOwnPropertySlotForWrite): Use isGetterSetter
instead of type.
(KJS::JSObject::getOwnPropertySlot): Ditto.
(KJS::JSObject::toPrimitive): Use PreferredPrimitiveType.
* kjs/JSString.cpp:
(KJS::JSString::toPrimitive): Use PreferredPrimitiveType.
(KJS::JSString::isString): Added.
* kjs/JSString.h: Ditto.
* kjs/JSValue.h: Removed type(), added isGetterSetter(). Added
PreferredPrimitiveType enum and used it as the argument for the
toPrimitive function.
(KJS::JSValue::getBoolean): Simplified a bit an removed a branch.
* kjs/collector.cpp:
(KJS::typeName): Changed to use JSCell::is functions instead of
calling JSCell::type.
* kjs/collector.h:
(KJS::Heap::isNumber): Renamed from fastIsNumber.
* kjs/nodes.h: Added now-needed include of JSType, since the type
is used here to record types of values in the tree.
* kjs/operations.cpp:
(KJS::equal): Rewrote to no longer depend on type().
(KJS::strictEqual): Ditto.
2008-08-18 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
If there are no nodes in a profile all the time should be attributed to
(idle)
* profiler/Profile.cpp: If ther are no nodes make sure we still process
the head.
(KJS::Profile::forEach):
* profiler/ProfileGenerator.cpp: Remove some useless code.
(KJS::ProfileGenerator::stopProfiling):
2008-08-18 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Maciej.
Make JSGlobalContextRetain/Release actually work.
* API/JSContextRef.cpp:
(JSGlobalContextRetain):
(JSGlobalContextRelease):
Ref/deref global data to give checking for globalData.refCount() some sense.
* API/tests/testapi.c: (main): Added a test for this bug.
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::~JSGlobalData):
While checking for memory leaks, found that JSGlobalData::emptyList has changed to
a pointer, but it was not destructed, causing a huge leak in run-webkit-tests --threaded.
2008-08-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Change the counting of constants so that preincrement and predecrement of
const local variables are considered unexpected loads.
* kjs/nodes.cpp:
(KJS::PrefixResolveNode::emitCode):
* kjs/nodes.h:
(KJS::ScopeNode::neededConstants):
2008-08-17 Oliver Hunt <oliver@apple.com>
Reviewed by Cameron Zwarich.
<rdar://problem/6150322> In Gmail, a crash occurs at KJS::Machine::privateExecute() when applying list styling to text after a quote had been removed
<https://bugs.webkit.org/show_bug.cgi?id=20386>
This crash was caused by "depth()" incorrectly determining the scope depth
of a 0 depth function without a full scope chain. Because such a function
would not have an activation the depth function would return the scope depth
of the parent frame, thus triggering an incorrect unwind. Any subsequent
look up that walked the scope chain would result in incorrect behaviour,
leading to a crash or incorrect variable resolution. This can only actually
happen in try...finally statements as that's the only path that can result in
the need to unwind the scope chain, but not force the function to need a
full scope chain.
The fix is simply to check for this case before attempting to walk the scope chain.
* VM/Machine.cpp:
(KJS::depth):
(KJS::Machine::throwException):
2008-08-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Bug 20419: Remove op_jless
<https://bugs.webkit.org/show_bug.cgi?id=20419>
Remove op_jless, which is rarely used now that we have op_loop_if_less.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitJumpIfTrue):
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
2008-08-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Dan Bernstein.
Fix a typo in r35807 that is also causing build failures for
non-AllInOne builds.
* kjs/NumberConstructor.cpp:
2008-08-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Cameron Zwarich.
Made room for a free word in JSCell.
SunSpider says no change.
I changed JSCallbackObjectData, Arguments, JSArray, and RegExpObject to
store auxiliary data in a secondary structure.
I changed InternalFunction to store the function's name in the property
map.
I changed JSGlobalObjectData to use a virtual destructor, so WebCore's
JSDOMWindowBaseData could inherit from it safely. (It's a strange design
for JSDOMWindowBase to allocate an object that JSGlobalObject deletes,
but that's really our only option, given the size constraint.)
I also added a bunch of compile-time ASSERTs, and removed lots of comments
in JSObject.h because they were often out of date, and they got in the
way of reading what was actually going on.
Also renamed JSArray::getLength to JSArray::length, to match our style
guidelines.
2008-08-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Sped up property access for array.length and string.length by adding a
mechanism for returning a temporary value directly instead of returning
a pointer to a function that retrieves the value.
Also removed some unused cruft from PropertySlot.
SunSpider says 0.5% - 1.2% faster.
NOTE: This optimization is not a good idea in general, because it's
actually a pessimization in the case of resolve for assignment,
and it may get in the way of other optimizations in the future.
2008-08-16 Dan Bernstein <mitz@apple.com>
Reviewed by Geoffrey Garen.
Disable dead code stripping in debug builds.
* Configurations/Base.xcconfig:
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-08-15 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
<rdar://problem/6143072> FastMallocZone's enumeration code makes assumptions about handling of remote memory regions that overlap
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_Central_FreeList::enumerateFreeObjects): Don't directly compare pointers mapped into the local process with
a pointer that has not been mapped. Instead, calculate a local address for the pointer and compare with that.
(WTF::TCMallocStats::FreeObjectFinder::findFreeObjects): Pass in the remote address of the central free list so that it can
be used when calculating local addresses.
(WTF::TCMallocStats::FastMallocZone::enumerate): Ditto.
2008-08-15 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Geoff Garen.
<rdar://problem/6139914> Please include a _debug version of JavaScriptCore framework
* Configurations/Base.xcconfig: Factor out the debug-only settings so that they can shared
between the Debug configuration and debug Production variant.
* JavaScriptCore.xcodeproj/project.pbxproj: Enable the debug variant.
2008-08-15 Mark Rowe <mrowe@apple.com>
Fix the 64-bit build.
Add extra cast to avoid warnings about loss of precision when casting from
JSValue* to an integer type.
* kjs/JSImmediate.h:
(KJS::JSImmediate::intValue):
(KJS::JSImmediate::uintValue):
2008-08-15 Alexey Proskuryakov <ap@webkit.org>
Still fixing Windows build.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Added OpaqueJSString
to yet another place.
2008-08-15 Alexey Proskuryakov <ap@webkit.org>
Trying to fix non-Apple builds.
* ForwardingHeaders/JavaScriptCore/OpaqueJSString.h: Added.
2008-08-15 Gavin Barraclough <barraclough@apple.com>
Reviewed by Geoff Garen.
Allow JSImmediate to hold 31 bit signed integer immediate values. The low two bits of a
JSValue* are a tag, with the tag value 00 indicating the JSValue* is a pointer to a
JSCell. Non-zero tag values used to indicate that the JSValue* is not a real pointer,
but instead holds an immediate value encoded within the pointer. This patch changes the
encoding so both the tag values 01 and 11 indicate the value is a signed integer, allowing
a 31 bit value to be stored. All other immediates are tagged with the value 10, and
distinguished by a secondary tag.
Roughly +2% on SunSpider.
* kjs/JSImmediate.h: Encoding of JSImmediates has changed - see comment at head of file for
descption of new layout.
2008-08-15 Alexey Proskuryakov <ap@webkit.org>
More build fixes.
* API/OpaqueJSString.h: Add a namespace to friend declaration to appease MSVC.
* API/JSStringRefCF.h: (JSStringCreateWithCFString) Cast UniChar* to UChar* explicitly.
* JavaScriptCore.exp: Added OpaqueJSString::create(const KJS::UString&) to fix WebCore build.
2008-08-15 Alexey Proskuryakov <ap@webkit.org>
Build fix.
* JavaScriptCore.xcodeproj/project.pbxproj: Marked OpaqueJSString as private
* kjs/identifier.cpp:
(KJS::Identifier::checkSameIdentifierTable):
* kjs/identifier.h:
(KJS::Identifier::add):
Since checkSameIdentifierTable is exported for debug build's sake, gcc wants it to be
non-inline in release builds, too.
* JavaScriptCore.exp: Don't export inline OpaqueJSString destructor.
2008-08-15 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff Garen.
JSStringRef is created context-free, but can get linked to one via an identifier table,
breaking an implicit API contract.
Made JSStringRef point to OpaqueJSString, which is a new string object separate from UString.
* API/APICast.h: Removed toRef/toJS conversions for JSStringRef, as this is no longer a
simple typecast.
* kjs/identifier.cpp:
(KJS::Identifier::checkSameIdentifierTable):
* kjs/identifier.h:
(KJS::Identifier::add):
(KJS::UString::checkSameIdentifierTable):
Added assertions to verify that an identifier is not being added to a different JSGlobalData.
* API/JSObjectRef.cpp:
(OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray): Changed OpaqueJSPropertyNameArray to
hold JSStringRefs. This is necessary to avoid having to construct (and leak) a new instance
in JSPropertyNameArrayGetNameAtIndex(), now that making a JSStringRef is not just a typecast.
* API/OpaqueJSString.cpp: Added.
(OpaqueJSString::create):
(OpaqueJSString::ustring):
(OpaqueJSString::identifier):
* API/OpaqueJSString.h: Added.
(OpaqueJSString::create):
(OpaqueJSString::characters):
(OpaqueJSString::length):
(OpaqueJSString::OpaqueJSString):
(OpaqueJSString::~OpaqueJSString):
* API/JSBase.cpp:
(JSEvaluateScript):
(JSCheckScriptSyntax):
* API/JSCallbackObjectFunctions.h:
(KJS::::getOwnPropertySlot):
(KJS::::put):
(KJS::::deleteProperty):
(KJS::::staticValueGetter):
(KJS::::callbackGetter):
* API/JSStringRef.cpp:
(JSStringCreateWithCharacters):
(JSStringCreateWithUTF8CString):
(JSStringRetain):
(JSStringRelease):
(JSStringGetLength):
(JSStringGetCharactersPtr):
(JSStringGetMaximumUTF8CStringSize):
(JSStringGetUTF8CString):
(JSStringIsEqual):
* API/JSStringRefCF.cpp:
(JSStringCreateWithCFString):
(JSStringCopyCFString):
* API/JSValueRef.cpp:
(JSValueMakeString):
(JSValueToStringCopy):
Updated to use OpaqueJSString.
* GNUmakefile.am:
* JavaScriptCore.exp:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
Added OpaqueJSString.
2008-08-14 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/6115819> Notify of profile in console
- Profiles now have a unique ID so that they can be linked to the
console message that announces that a profile completed.
* profiler/HeavyProfile.cpp:
(KJS::HeavyProfile::HeavyProfile):
* profiler/Profile.cpp:
(KJS::Profile::create):
(KJS::Profile::Profile):
* profiler/Profile.h:
(KJS::Profile::uid):
* profiler/ProfileGenerator.cpp:
(KJS::ProfileGenerator::create):
(KJS::ProfileGenerator::ProfileGenerator):
* profiler/ProfileGenerator.h:
* profiler/Profiler.cpp:
(KJS::Profiler::startProfiling):
* profiler/TreeProfile.cpp:
(KJS::TreeProfile::create):
(KJS::TreeProfile::TreeProfile):
* profiler/TreeProfile.h:
2008-08-13 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Nixed a PIC branch from JSObject::getOwnPropertySlot, by forcing
fillGetterProperty, which references a global function pointer,
out-of-line.
.2% SunSpider speedup, 4.3% access-nbody speedup, 8.7% speedup on a
custom property access benchmark for objects with one property.
* kjs/JSObject.cpp:
(KJS::JSObject::fillGetterPropertySlot):
2008-08-13 Alp Toker <alp@nuanti.com>
Reviewed by Eric Seidel.
https://bugs.webkit.org/show_bug.cgi?id=20349
WTF::initializeThreading() fails if threading is already initialized
Fix threading initialization logic to support cases where
g_thread_init() has already been called elsewhere.
Resolves database-related crashers reported in several applications.
* wtf/ThreadingGtk.cpp:
(WTF::initializeThreading):
2008-08-13 Brad Hughes <bhughes@trolltech.com>
Reviewed by Simon.
Fix compiling of QtWebKit in release mode with the Intel C++ Compiler for Linux
The latest upgrade of the intel compiler allows us to compile all of
Qt with optimizations enabled (yay!).
* JavaScriptCore.pro:
2008-08-12 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff Garen.
Add peephole optimisation to 'op_not... jfalse...' (eg. if(!...) )
This is a very slight win in sunspider, and a fairly substantial win
in hot code that does if(!...), etc.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::retrieveLastUnaryOp):
(KJS::CodeGenerator::rewindBinaryOp):
(KJS::CodeGenerator::rewindUnaryOp):
(KJS::CodeGenerator::emitJumpIfFalse):
* VM/CodeGenerator.h:
2008-08-12 Dan Bernstein <mitz@apple.com>
- JavaScriptCore part of <rdar://problem/6121636>
Make fast*alloc() abort() on failure and add "try" variants that
return NULL on failure.
Reviewed by Darin Adler.
* JavaScriptCore.exp: Exported tryFastCalloc().
* VM/RegisterFile.h:
(KJS::RegisterFile::RegisterFile): Removed an ASSERT().
* kjs/JSArray.cpp:
(KJS::JSArray::putSlowCase): Changed to use tryFastRealloc().
(KJS::JSArray::increaseVectorLength): Ditto.
* kjs/ustring.cpp:
(KJS::allocChars): Changed to use tryFastMalloc().
(KJS::reallocChars): Changed to use tryFastRealloc().
* wtf/FastMalloc.cpp:
(WTF::fastZeroedMalloc): Removed null checking of fastMalloc()'s result
and removed extra call to InvokeNewHook().
(WTF::tryFastZeroedMalloc): Added. Uses tryFastMalloc().
(WTF::tryFastMalloc): Renamed fastMalloc() to this.
(WTF::fastMalloc): Added. This version abort()s if allocation fails.
(WTF::tryFastCalloc): Renamed fastCalloc() to this.
(WTF::fastCalloc): Added. This version abort()s if allocation fails.
(WTF::tryFastRealloc): Renamed fastRealloc() to this.
(WTF::fastRealloc): Added. This version abort()s if allocation fails.
(WTF::do_malloc): Made this a function template. When the abortOnFailure
template parameter is set, the function abort()s on failure to allocate.
Otherwise, it sets errno to ENOMEM and returns zero.
(WTF::TCMallocStats::fastMalloc): Defined to abort() on failure.
(WTF::TCMallocStats::tryFastMalloc): Added. Does not abort() on
failure.
(WTF::TCMallocStats::fastCalloc): Defined to abort() on failure.
(WTF::TCMallocStats::tryFastCalloc): Added. Does not abort() on
failure.
(WTF::TCMallocStats::fastRealloc): Defined to abort() on failure.
(WTF::TCMallocStats::tryFastRealloc): Added. Does not abort() on
failure.
* wtf/FastMalloc.h: Declared the "try" variants.
2008-08-11 Adam Roben <aroben@apple.com>
Move WTF::notFound into its own header so that it can be used
independently of Vector
Rubberstamped by Darin Adler.
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
Added NotFound.h to the project.
* wtf/NotFound.h: Added. Moved the notFound constant here...
* wtf/Vector.h: ...from here.
2008-08-11 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Mark Rowe.
<rdar://problem/6130393> REGRESSION: PhotoBooth hangs after launching under TOT Webkit
* API/JSContextRef.cpp: (JSGlobalContextRelease): Corrected a comment.
* kjs/collector.cpp: (KJS::Heap::~Heap): Ensure that JSGlobalData is not deleted while
sweeping the heap.
== Rolled over to ChangeLog-2008-08-10 ==