blob: 8f69ec1a4646376988f96b0512d1ed96ef9fa325 [file] [log] [blame]
2002-08-12 Darin Adler <darin@apple.com>
Speed improvements. 19% faster on cvs-js-performance, 1% on cvs-static-urls.
Use global string objects for length and other common property names rather
than constantly making and destroying them. Use integer versions of get() and
other related calls rather than always making a string.
Also get rid of many unneeded constructors, destructors, copy constructors, and
assignment operators. And make some functions non-virtual.
* kjs/internal.h:
* kjs/internal.cpp:
(NumberImp::toUInt32): Implement.
(ReferenceImp::ReferenceImp): Special case for numeric property names.
(ReferenceImp::getPropertyName): Moved guts here from ValueImp. Handle numeric case.
(ReferenceImp::getValue): Moved guts here from ValueImp. Handle numeric case.
(ReferenceImp::putValue): Moved guts here from ValueImp. Handle numeric case.
(ReferenceImp::deleteValue): Added. Handle numeric case.
* kjs/array_object.h:
* kjs/array_object.cpp: All-new array implementation that stores the elements
in a C++ array rather than in a property map.
(ArrayInstanceImp::ArrayInstanceImp): Allocate the C++ array.
(ArrayInstanceImp::~ArrayInstanceImp): Delete the C++ array.
(ArrayInstanceImp::get): Implement both the old version and the new overload that
takes an unsigned index for speed.
(ArrayInstanceImp::put): Implement both the old version and the new overload that
takes an unsigned index for speed.
(ArrayInstanceImp::hasProperty): Implement both the old version and the new overload that
takes an unsigned index for speed.
(ArrayInstanceImp::deleteProperty): Implement both the old version and the new overload that
takes an unsigned index for speed.
(ArrayInstanceImp::setLength): Added. Used by the above to resize the array.
(ArrayInstanceImp::mark): Mark the elements of the array too.
(ArrayPrototypeImp::ArrayPrototypeImp): Pass the length to the array instance constructor.
* kjs/bool_object.cpp:
* kjs/date_object.cpp:
* kjs/error_object.cpp:
* kjs/function.cpp:
* kjs/function_object.cpp:
* kjs/math_object.cpp:
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/number_object.cpp:
* kjs/object_object.cpp:
* kjs/regexp_object.cpp:
* kjs/string_object.cpp:
* kjs/nodes2string.cpp: (SourceStream::operator<<): Add a special case for char now that
you can't create a UString from a char implicitly.
* kjs/object.h:
* kjs/object.cpp:
(ObjectImp::get): Call through to the string version if the numeric version is not implemented.
(ObjectImp::put): Call through to the string version if the numeric version is not implemented.
(ObjectImp::hasProperty): Call through to the string version if the numeric version is not implemented.
(ObjectImp::deleteProperty): Call through to the string version if the numeric version is not implemented.
* kjs/types.h:
* kjs/types.cpp:
(Reference::Reference): Added constructors for the numeric property name case.
* kjs/ustring.h: Made the constructor that turns a character into a string be explicit so we
don't get numbers that turn themselves into strings.
* kjs/ustring.cpp:
(UString::UString): Detect the empty string case, and use a shared empty string.
(UString::find): Add an overload for single character finds.
(UString::rfind): Add an overload for single character finds.
(KJS::operator==): Fix bug where it would call strlen(0) if the first string was not null.
Also handle non-ASCII characters consistently with the rest of the code by casting to unsigned char
just in case.
* kjs/value.h: Make ValueImp and all subclasses non-copyable and non-assignable.
* kjs/value.cpp:
(ValueImp::toUInt32): New interface, mainly useful so we can detect array indices and not turn
them into strings and back.
(ValueImp::toInteger): Use the new toUInt32. Probably can use more improvement.
(ValueImp::toInt32): Use the new toUInt32. Probably can use more improvement.
(ValueImp::toUInt16): Use the new toUInt32. Probably can use more improvement.
(ValueImp::getBase): Remove handling of the Reference case. That's in ReferenceImp now.
(ValueImp::getPropertyName): Remove handling of the Reference case. That's in ReferenceImp now.
(ValueImp::getValue): Remove handling of the Reference case. That's in ReferenceImp now.
(ValueImp::putValue): Remove handling of the Reference case. That's in ReferenceImp now.
(ValueImp::deleteValue): Added. Used so we can do delete the same way we do put.
=== Alexander-17 ===
2002-08-09 Darin Adler <darin@apple.com>
Some string speedups. Makes sony.com cached 11% faster on Development, but
the improvement for Deployment should be greater.
* kjs/ustring.h: Made it possible for UChar objects to be uninitialized, which
gives a speed boost. Inlined CString's +=, UString's destructor, +=, and +.
* kjs/ustring.cpp:
(UString::UString): Optimize const char * version, which showed up
heavily in performance analysis. Added new two-UString version, which
makes the + operator fast.
(UString::ascii): Remove thread safety changes. Change static buffer to remember
its size, and to always be at least 4096 bytes long; that way we never have to
reallocate unless it's for a long string. Also make code to extract the characters
significantly faster by getting rid of two pointer dereferences per character.
(UString::is8Bit): Avoid one pointer dereference per character.
(UString::toDouble): Use ascii() instead of cstring() to avoid copying the string.
* kjs/collector.cpp: Remove unneeded APPLE_CHANGES.
* kjs/regexp.cpp: Remove ifdefs around some APPLE_CHANGES that we
want to keep, because they just fix warnings.
* kjs/value.h: Remove obsolete APPLE_CHANGES comment.
* JavaScriptCore.pbproj/project.pbxproj: Project Builder decided
to move a line around in the file.
2002-08-09 Maciej Stachowiak <mjs@apple.com>
Fix my last change to actually call the versions of the lock functions
that are recursive and initialize as needed.
* kjs/internal.cpp:
(InterpreterImp::InterpreterImp):
(InterpreterImp::clear):
(InterpreterImp::evaluate):
2002-08-09 Maciej Stachowiak <mjs@apple.com>
- fixed 2948835 - JavaScriptCore locking is too fine grained, makes it too slow
* kjs/collector.cpp:
(Collector::allocate):
(Collector::collect):
(Collector::finalCheck):
(Collector::numInterpreters):
(Collector::numGCNotAllowedObjects):
(Collector::numReferencedObjects):
* kjs/collector.h:
* kjs/internal.cpp:
(initializeInterpreterLock):
(lockInterpreter):
(unlockInterpreter):
(Parser::parse):
(InterpreterImp::InterpreterImp):
(InterpreterImp::clear):
(InterpreterImp::evaluate):
* kjs/value.cpp:
(ValueImp::ValueImp):
(ValueImp::setGcAllowed):
=== milestone 0.5 ===
=== Alexander-16 ===
2002-08-05 Maciej Stachowiak <mjs@apple.com>
- fixed 3007072 - need to be able to build fat
* JavaScriptCore.pbproj/project.pbxproj: Fixed DeploymentFat build.
=== Alexander-15 ===
2002-07-25 Darin Adler <darin@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Add DeploymentFat build style.
=== Alexander-14 ===
2002-07-21 Darin Adler <darin@apple.com>
* kjs/*: Roll KDE 3.0.2 changes in. Also switch to not using APPLE_CHANGES
for some of the changes that we definitely want to contribute upstream.
2002-07-21 Maciej Stachowiak <mjs@apple.com>
* Makefile.am: Remove products from symroots on `make clean'.
=== Alexander-13 ===
2002-07-13 Darin Adler <darin@apple.com>
* Makefile.am: Don't use embed.am any more.
* JavaScriptCore.pbproj/project.pbxproj: Use embed-into-alex instead
of make embed.
2002-07-12 Darin Adler <darin@apple.com>
* kjs/ustring.h: Since <sys/types.h> includes ushort and uint now, had
to change the includes here to be compatible with that.
2002-07-11 Darin Adler <darin@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: To make the build of
WebCore work without using -I to peek at JavaScriptCore sources,
made all the Public sources Private so they are all in one directory.
Also, made lookup.h be Private.
=== Alexander-11 ===
=== Alexander-10 ===
2002-06-25 Darin Adler <darin@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Re-add -Wmissing-format-attribute.
=== Alexander-9 ===
2002-06-19 Kenneth Kocienda <kocienda@apple.com>
I just played alchemical voodoo games with the linker to
make all our frameworks and Alexander prebound.
* JavaScriptCore.pbproj/project.pbxproj
2002-06-15 Darin Adler <darin@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Removed explicit PFE_FILE_C_DIALECTS now that
Project Builder handles this automatically. Removed explicit USE_GCC3 since that's implicit
now. Also, since this project is all C++, only use WARNING_CFLAGS with flags that are appropriate
for C++; don't bother breaking out C vs. C++.
* kjs/collector.cpp: Now that the system warning is fixed, use PTHREAD_MUTEX_INITIALIZER and
PTHREAD_COND_INITIALIZER.
* kjs/internal.cpp: Use PTHREAD_MUTEX_INITIALIZER.
* kjs/ustring.cpp: Use PTHREAD_ONCE_INIT.
2002-06-15 Maciej Stachowiak <mjs@apple.com>
Made Development build mode mean what Unoptimized used to mean. Removed Unoptimized build mode.
Added a Mixed build mode which does what Deployment used to. All this to fix:
Radar 2955367 - Change default build style to "Unoptimized"
* JavaScriptCore.pbproj/project.pbxproj:
2002-06-12 Darin Adler <darin@apple.com>
* kjs/nodes.cpp: (Node::finalCheck): A bit of APPLE_CHANGES so we
can compile with KJS_DEBUG_MEM defined if we want to.
2002-06-10 Darin Adler <darin@apple.com>
Merged in changes from KDE 3.0.1.
* kjs/collector.cpp:
* kjs/date_object.cpp:
* kjs/function.cpp:
* kjs/internal.cpp:
* kjs/lookup.h:
* kjs/object.cpp:
* kjs/operations.cpp:
* kjs/regexp.cpp:
* kjs/regexp_object.cpp:
* kjs/regexp_object.h:
* kjs/string_object.cpp:
* kjs/testkjs.cpp:
* kjs/ustring.cpp:
* kjs/value.cpp:
* kjs/value.h:
Do the merge, and add APPLE_CHANGES as needed to make things compile.
* kjs/date_object.lut.h: Re-generated.
2002-06-07 Darin Adler <darin@apple.com>
* Makefile.am: Use new shared "embed.am" file so we don't need four copies of
the embedding rules for WebFoundation, JavaScriptCore, WebCore, and WebKit.
2002-06-07 Darin Adler <darin@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Don't use any warning flags for C that won't work
for C++, because PFE uses the C warning flags on a C++ compile.
=== Alexander-8 ===
2002-06-06 Darin Adler <darin@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Update warning flags for compatibility
with new C++.
2002-06-05 Darin Adler <darin@apple.com>
Fix problem seen as build failure on Jersey.
* Makefile.am: JavaScriptCore-stamp needs to be a dependency, not a
source file, because it doesn't have a corresponding object file.
Making it a dependency causes things to compile in the right order.
2002-06-04 Darin Adler <darin@apple.com>
Improve the speed of the JavaScript string append operation by growing
the capacity so we don't need to reallocate the string every time.
Also fix script execution so it doesn't use recursion to advance from
one statement to the next, using iteration instead.
* Makefile.am: Stop using BUILT_SOURCES to build JavaScriptCore-stamp,
because this causes the Project Builder project to build *before* the
subdir. Intead, use an all-am rule in a way more similar to all our
other directories.
* kjs/grammar.y: Link the SourceElementsNode in the opposite direction,
so we can walk the list and execute each element instead of using
recursion to reverse the list.
* kjs/grammar.cpp: Check in new generated file.
* kjs/nodes.cpp:
(SourceElementsNode::execute):
(SourceElementsNode::processFuncDecl):
(SourceElementsNode::processVarDecls):
Use loops instead of recursion.
* kjs/ustring.h: Don't initialize all UChar objects to 0. This was
wasting a *huge* amount of time.
* kjs/ustring.cpp:
(UString::Rep::create): Add a "capacity" along with the length.
(UString::append): Include 50% extra capacity when appending.
(UString::operator=): Reuse the buffer if possible rather than
always creating a new one.
2002-06-02 Darin Adler <darin@apple.com>
* COPYING.LIB: Fix line endings. It was using CRs.
2002-05-31 Darin Adler <darin@apple.com>
* Makefile.am:
* kjs/Makefile.am:
Slight improvements to rules that touch stamp files.
2002-05-28 Maciej Stachowiak <mjs@apple.com>
* THANKS: Demangled.
=== Alexander-7 ===
2002-05-24 Maciej Stachowiak <mjs@apple.com>
Added license and acknowledgements.
* AUTHORS: Added.
* COPYING.LIB: Added.
* THANKS: Added.
=== 0.3 ===
=== Alexander-6 ===
=== Alexander-5 ===
=== Alexander-4 ===
=== JavaScriptCore-5 ===
2002-05-21 Maciej Stachowiak <mjs@apple.com>
Reviewed by: Richard Williamson
Fixed Radar 2928775 - Sherlock crashes sitting in stocks channel
* kjs/internal.cpp:
(InterpreterImp::InterpreterImp): Set the interp pointer earlier,
in case garbage collection takes place while creating the global
values.
2002-05-15 Darin Adler <darin@apple.com>
Reviewed by: Maciej Stachowiak
* Makefile.am:
Use all-am and clean-am instead of all and clean because it's better and
to make "make check" at the top level work right.
2002-05-13 Darin Adler <darin@apple.com>
Reviewed by: Maciej Stachowiak
* kjs/value.h: Fix comment typos.
=== JavaScriptCore-4 ===
2002-05-10 Maciej Stachowiak <mjs@apple.com>
Reviewed by: Ken Kocienda and Darin Adler
Fixed the following bug:
Radar 2890573 - JavaScriptCore needs to be thread-safe
Actually this is only a weak form of thread-safety - you can safely
use different interpreters from different threads at the same
time. If you try to use a single interpreter object from multiple
threads, you need to provide your own locking.
* kjs/collector.h, kjs/collector.cpp:
(Collector::lock, Collector::unlock): Trivial implementation of a
recursive mutex.
(Collector::allocate): Lock around the body of this function.
(Collector::collect): Likewise.
(Collector::finalCheck): Likewise.
(Collector::numInterpreters): Likewise.
(Collector::numGCNotAllowedObjects): Likewise.
(Collector::numReferencedObjects): Likewise.
* kjs/internal.cpp:
(Parser::parse): use a mutex to lock around the whole parse, since
it uses a bunch of global state.
(InterpreterImp::InterpreterImp): Grab the Collector lock here,
both the mutually exclude calls to the body of this function, and
to protect the s_hook static member which the collector pokes at.
(InterpreterImp::clear): Likewise.
* kjs/ustring.cpp:
(statBufferKeyCleanup, statBufferKeyInit, UString::ascii): Convert
use of static variable
* kjs/value.cpp:
(ValueImp::ValueImp, ValueImp::mark, ValueImp::marked,
ValueImp::setGcAllowed): Grab the GC lock around any flag changes.
=== Alexander-3 ===
2002-05-08 Darin Adler <darin@apple.com>
* kjs/collector.h:
* kjs/collector.cpp:
(Collector::numInterpreters):
(Collector::numGCNotAllowedObjects):
(Collector::numReferencedObjects):
Add three new functions so we can see a bit more about leaking JavaScriptCore.
2002-05-06 Darin Adler <darin@apple.com>
* JavaScriptCorePrefix.h: Added.
* JavaScriptCore.pbproj/project.pbxproj: Use PFE precompiling.
Also switch from xNDEBUG to NDEBUG.
=== Alexander 0.3c2 (v1) ===
2002-04-18 Darin Adler <darin@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Oops. Take out -Wstrict-prototypes, put back
-Wmissing-prototypes.
2002-04-18 Darin Adler <darin@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Take out -Wmissing-prototypes
because system headers are triggering it when we don't have
precompiled headers on.
2002-04-18 Darin Adler <darin@apple.com>
Reviewed by Maciej
* JavaScriptCore.pbproj/project.pbxproj: Turn on gcc3 and the same set of warnings
as in the rest of Labyrinth (see top level ChangeLog for details).
2002-04-17 Maciej Stachowiak <mjs@apple.com>
Reviewed by: Darin Adler <darin@apple.com>
* kjs/testkjs.cpp: Don't include <iostream.h> to avoid gcc3
warning.
2002-04-15 Darin Adler <darin@apple.com>
Reviwed by: Maciej Stachowiak <mjs@apple.com>
* kjs/internal.cpp:
* kjs/property_map.cpp:
* kjs/ustring.h:
Removed some unneeded <config.h> includes so we are more similar
to the real KDE sources.
2002-04-15 Darin Adler <darin@apple.com>
Reviwed by: Maciej Stachowiak <mjs@apple.com>
Merged changes from KDE 3.0 final and did some build fixes.
* JavaScriptCore.pbproj/project.pbxproj: Added nodes2string.cpp.
* kjs/grammar.*: Regenerated.
* kjs/*.lut.h: Regenerated.
2002-04-08 Darin Adler <darin@apple.com>
Reviwed by: Maciej Stachowiak <mjs@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Re-added -Wno-format-y2k.
2002-04-04 Darin Adler <darin@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Add an Unoptimized build
style: exactly like Development except without the -O.
2002-04-03 Darin Adler <darin@apple.com>
* kjs/Makefile.am: Gratuitous cleanup.
2002-04-02 Darin Adler <darin@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Update flags as I did for
WebFoundation.
2002-04-02 Maciej Stachowiak <mjs@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Pass -Wno-format-y2k so
the project builds with gcc3.
* kjs/nodes.cpp: Avoid including an obsolete header to avoid
warning with gcc3.
2002-04-02 Darin Adler <darin@apple.com>
* kjs/property_map.cpp: (PropertyMap::~PropertyMap): Deallocate the
map by calling clear so we don't leak the entire map.
2002-04-02 Darin Adler <darin@apple.com>
* kjs/internal.cpp: (InterpreterImp::globalClear): Add code to
deallocate and null out emptyList, because once the last interpreter
is destroyed there's nothing to keep it from being garbage collected.
2002-04-01 Darin Adler <darin@apple.com>
Got rid of KWQDef.h because it's dangerous to have two files with
the same name and different contents.
* JavaScriptCore.pbproj/project.pbxproj:
* kjs/KWQDef.h: Removed.
* kjs/ustring.h: Defines unsigned int types inline now.
2002-03-30 Maciej Stachowiak <mjs@apple.com>
Fixed Radar 2891272 (JavaScript crashes loading quicktime.com and
apple.com)
* kjs/object.cpp: (ObjectImp::~ObjectImp): Don't call setGCAlloc
on object internals pointed to, because they may have already been
collected by the time this object is collected, and in that case
we would corrupt the malloc arena.
* Makefile.am: Make the stamp file depend on all the sources and
headers so the framework gets rebuilt properly.
* JavaScriptCore.pbproj/project.pbxproj: Some random numbers moved
around. No idea what I really changed.
2002-03-30 Darin Adler <darin@apple.com>
* kjs/grammar.y: Took out Id tag so we won't constantly need to
update grammar.cpp.
* kjs/grammar.cpp: Regenerated without Id tag.
* .cvsignore: Ignore some additional autogenerated files.
* kjs/.cvsignore: Ignore some additional autogenerated files.
2002-03-30 Maciej Stachowiak <mjs@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Install some of the
headers.
2002-03-30 Maciej Stachowiak <mjs@apple.com>
Converted JavaScriptCore to build with Project Builder, in
preparation for B&I submission.
* English.lproj/InfoPlist.strings: Added.
* JavaScriptCore.pbproj/.cvsignore: Added.
* JavaScriptCore.pbproj/project.pbxproj: Added.
* .cvsignore: Update the set of ignored things.
* Makefile.am: Hand off to PB for the main build, but still handle
the generated files and the test program.
* kjs/Makefile.am: Don't build anything except the generated
source files.
* kjs/KWQDef.h, kjs/config.h: Added minimal versions of these
files to get kjs to build.
Check in all the genrated files, since Project Builder isn't up to
the task of handling built sources:
* kjs/array_object.lut.h: Added.
* kjs/date_object.lut.h: Added.
* kjs/grammar.cpp: Added.
* kjs/grammar.cpp.h: Added.
* kjs/grammar.h: Added.
* kjs/lexer.lut.h: Added.
* kjs/math_object.lut.h: Added.
* kjs/number_object.lut.h: Added.
* kjs/string_object.lut.h: Added.
* kjs/.cvsignore: Update set of ignored things.
2002-03-28 Maciej Stachowiak <mjs@apple.com>
* kjs/kjs-test.chk: Update output for new test results.
2002-03-26 Maciej Stachowiak <mjs@apple.com>
Set up kjs to build by itself into libJavaScriptCore.dylib.
* .cvsignore: Added.
* Makefile.am: Added.
* dummy.cpp: Added.
* kjs/.cvsignore: Added.