blob: ed3d58ff2e22ba397c4cdf120b66c04adcb83417 [file] [log] [blame]
2006-01-25 George Staikos <staikos@opensource.apple.com>
Reviewed by Darin.
* kxmlcore/HashFunctions.h: Merge build fix from KDE.
2006-01-25 Darin Adler <darin@apple.com>
- removed an unused source file
* kjs/pointer_hash.h: Removed.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Removed reference to pointer_hash.h.
2006-01-23 Anders Carlsson <andersca@mac.com>
Reviewed by Maciej.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6737
KJS_DEFINE_PROTOTYPE should work outside of the KJS namespace
* kjs/lookup.h:
Prefix all KJS types with KJS:: in KJS_DEFINE_PROTOTYPE.
(cacheGlobalObject):
Move this out of the KJS namespace.
2006-01-23 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- renamed PointerHash to PtrHash
- made PtrHash the default hash function for int and pointer types that aren't further specialized
- added an AtomicStringImpl class to make it easier and more typesafe to identity hash atomic strings
- did appropriate consequent cleanup (very few places now need to declare a hash function)
http://bugzilla.opendarwin.org/show_bug.cgi?id=6752
* kjs/array_object.cpp:
(ArrayProtoFunc::callAsFunction): no need to mention PointerHash
* kjs/collector.cpp: ditto
* kjs/identifier.cpp:
(KXMLCore::): declare DefaultHash the new way
* kjs/internal.cpp: no need to mention PointerHash
* kjs/ustring.h:
* kxmlcore/HashCountedSet.h: change how we get the default hash to make it
easier to specialize on PtrHash
* kxmlcore/HashFunctions.h:
(KXMLCore::): renamed PointerHash to PtrHash; changed DefaultHash so that it has
a Hash typedef rather than being a hash function class itself; declared DefaultHash
for int and partializy specialized for pointer types
* kxmlcore/HashMapPtrSpec.h:
(KXMLCore::PtrHashIteratorAdapter::PtrHashIteratorAdapter): Slight tweaks for new
way of handling pointer hash
(KXMLCore::PtrHashConstIteratorAdapter::PtrHashConstIteratorAdapter): ditto
(KXMLCore::): ditto
* kxmlcore/HashMap.h: ditto
* kxmlcore/HashSet.h: ditto
2006-01-23 Maciej Stachowiak <mjs@apple.com>
Reviewed by Tim Omernick.
- use classes instead of free functions for extractors, this better matches how other
things work and should avoid the need for hacky workarounds on other compilers
http://bugzilla.opendarwin.org/show_bug.cgi?id=6748
* kjs/array_object.cpp:
* kjs/identifier.cpp:
* kjs/internal.cpp:
* kxmlcore/HashMap.h:
(KXMLCore::PairFirstExtractor::extract):
* kxmlcore/HashMapPtrSpec.h:
(KXMLCore::):
* kxmlcore/HashSet.h:
(KXMLCore::IdentityExtractor::extract):
* kxmlcore/HashTable.h:
(KXMLCore::addIterator):
(KXMLCore::removeIterator):
(KXMLCore::HashTable::add):
(KXMLCore::HashTable::isEmptyBucket):
(KXMLCore::HashTable::isDeletedBucket):
(KXMLCore::HashTable::HashTable):
(KXMLCore::HashTable::lookup):
(KXMLCore::HashTable::add):
(KXMLCore::HashTable::reinsert):
(KXMLCore::HashTable::find):
(KXMLCore::HashTable::contains):
(KXMLCore::HashTable::remove):
(KXMLCore::HashTable::allocateTable):
(KXMLCore::HashTable::deallocateTable):
(KXMLCore::HashTable::expand):
(KXMLCore::HashTable::rehash):
(KXMLCore::HashTable::clear):
(KXMLCore::HashTable::swap):
(KXMLCore::HashTable::operator):
(KXMLCore::HashTable::checkTableConsistency):
(KXMLCore::HashTable::checkTableConsistencyExceptSize):
(KXMLCore::HashTable::invalidateIterators):
2006-01-23 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Tim Hatcher.
- renamed inert() operation on HashSet, HashCountedSet and HashTable to add()
for consistency with HashMap
* kjs/array_object.cpp:
(ArrayProtoFunc::callAsFunction):
* kjs/collector.cpp:
(KJS::Collector::protect):
* kjs/identifier.cpp:
(KJS::Identifier::add):
* kxmlcore/HashCountedSet.h:
(KXMLCore::::add):
* kxmlcore/HashMap.h:
(KXMLCore::::inlineAdd):
* kxmlcore/HashSet.h:
(KXMLCore::::add):
* kxmlcore/HashTable.h:
(KXMLCore::HashTable::add):
(KXMLCore::::add):
(KXMLCore::::HashTable):
2006-01-23 Justin Garcia <justin.garcia@apple.com>
Reviewed by thatcher
Turned on -O2 for B&I build.
* JavaScriptCore.xcodeproj/project.pbxproj:
2006-01-23 Maciej Stachowiak <mjs@apple.com>
Reviewed by Tim Hatcher.
- it's "Franklin Street", not "Franklin Steet"
* kjs/array_instance.h:
* kjs/array_object.cpp:
* kjs/array_object.h:
* kjs/bool_object.cpp:
* kjs/bool_object.h:
* kjs/collector.cpp:
* kjs/collector.h:
* kjs/completion.h:
* kjs/context.h:
* kjs/date_object.cpp:
* kjs/date_object.h:
* kjs/debugger.cpp:
* kjs/debugger.h:
* kjs/dtoa.h:
* kjs/error_object.cpp:
* kjs/error_object.h:
* kjs/function.cpp:
* kjs/function.h:
* kjs/function_object.cpp:
* kjs/function_object.h:
* kjs/grammar.y:
* kjs/identifier.cpp:
* kjs/identifier.h:
* kjs/internal.cpp:
* kjs/internal.h:
* kjs/interpreter.cpp:
* kjs/interpreter.h:
* kjs/lexer.cpp:
* kjs/lexer.h:
* kjs/list.cpp:
* kjs/list.h:
* kjs/lookup.cpp:
* kjs/lookup.h:
* kjs/math_object.cpp:
* kjs/math_object.h:
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
* kjs/number_object.cpp:
* kjs/number_object.h:
* kjs/object.cpp:
* kjs/object.h:
* kjs/object_object.cpp:
* kjs/object_object.h:
* kjs/operations.cpp:
* kjs/operations.h:
* kjs/property_map.cpp:
* kjs/property_map.h:
* kjs/property_slot.cpp:
* kjs/property_slot.h:
* kjs/reference.cpp:
* kjs/reference.h:
* kjs/reference_list.cpp:
* kjs/reference_list.h:
* kjs/regexp.cpp:
* kjs/regexp.h:
* kjs/regexp_object.cpp:
* kjs/regexp_object.h:
* kjs/scope_chain.cpp:
* kjs/scope_chain.h:
* kjs/simple_number.h:
* kjs/string_object.cpp:
* kjs/string_object.h:
* kjs/testkjs.cpp:
* kjs/types.h:
* kjs/ustring.cpp:
* kjs/ustring.h:
* kjs/value.cpp:
* kjs/value.h:
* kxmlcore/AlwaysInline.h:
* kxmlcore/ListRefPtr.h:
* kxmlcore/PassRefPtr.h:
* kxmlcore/RefPtr.h:
2006-01-23 Darin Adler <darin@apple.com>
Reviewed by John Sullivan.
- change needed for fix to http://bugzilla.opendarwin.org/show_bug.cgi?id=6617
REGRESSION: Crash in cloneChildNodes when clicking element
* kxmlcore/PassRefPtr.h: Fix assignment operator from RefPtr of a different
type by calling get() instead of going directly at m_ptr.
* kxmlcore/RefPtr.h: Ditto.
- other changes
* JavaScriptCore.xcodeproj/project.pbxproj: Xcode decided to change this file.
It's just a resorted list of keys in a dictionary.
* kjs/fpconst.cpp: Wrap this file in #if __APPLE__ since the alternate version
in internal.cpp is in #if !__APPLE__. This file is to give us the "no init
routine" property we want to have on OS X.
2006-01-22 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- Set up Page class and invert Frame / WebCoreFrameBridge ownership
http://bugzilla.opendarwin.org/show_bug.cgi?id=6577
* kjs/interpreter.h: make globalExec virtual so ScriptInterpreter can
override it
2006-01-23 George Staikos <staikos@opensource.apple.com>
Reviewed by Maciej and Darin.
* kxmlcore/Assertions.h: This file only works with __APPLE__ right now
* kjs/interpreter.cpp: ditto
* kjs/simple_number.h: Add assert.h and remove from config.h
* kjs/array_object.cpp: Use relative paths for kxmlcore includes
* kjs/testkjs.cpp: Use relative paths for kxmlcore includes
2006-01-23 George Staikos <staikos@opensource.apple.com>
Reviewed by Maciej.
* kjs/config.h: unbreak preprocessor change
2006-01-23 George Staikos <staikos@opensource.apple.com>
Approved by Maciej and Darin.
* kjs/:
* kxmlcore/:
Update FSF address in license to make merging easier
2006-01-22 George Staikos <staikos@opensource.apple.com>
Reviewed by Maciej.
* kjs/collector.cpp: merge major speedup from KDE on Linux
patch by Maks Orlovich, bug #6145
Also unify cpu detection
* kjs/config.h: define simpler CPU macros
2006-01-22 George Staikos <staikos@opensource.apple.com>
Reviewed by Maciej.
* kjs/collector.cpp: merge FreeBSD compile fix from KDE
-> requires build magic for use
2006-01-21 George Staikos <staikos@opensource.apple.com>
Reviewed by Maciej.
* kjs/nodes2string.cpp
* kjs/operations.h
* kjs/debugger.h
Fix pedantic compile with some gcc versions (Merge from KDE)
* kjs/create_hash_table:
Fix build with Perl 5.8.0 (Merge from KDE)
2006-01-18 Darin Adler <darin@apple.com>
Reviewed by Hyatt.
- hash table fixes needed for my WebCore changes
* kxmlcore/HashTable.h: (KXMLCore::HashTableConstIterator::operator=):
Added a missing return statement.
* kxmlcore/HashTraits.h: Fix traits so they work properly for classes where you
can't instantiate with a 0 by using traits rather than ? : to select the default
emtpy value of hash table keys.
- small cleanup of "runtime" code left over from recent JavaScript crash fix
* bindings/runtime_root.h:
(KJS::Bindings::RootObject::RootObject): No explicit initialization of _imp needed
since it's now a ProtectedPtr.
(KJS::Bindings::RootObject::setRootObjectImp): Remove old code that relied on the
fact that _imp was 0 and replaced with use of ProtectedPtr.
(KJS::Bindings::RootObject::rootObjectImp): Updated since _imp is a ProtectedPtr.
2006-01-17 Darin Adler <darin@apple.com>
Reviewed by Anders.
- http://bugzilla.opendarwin.org/show_bug.cgi?id=6611
add assertions to check correct use of hash table iterators
* kxmlcore/HashTable.h:
(KXMLCore::addIterator): Added. Helper function that adds an iterator to the list
maintained by the specified hash table.
(KXMLCore::removeIterator): Added. Helper function that removes an iterator from
the list maintained by the hash table it's in.
(KXMLCore::HashTableConstIterator::HashTableConstIterator): Added a HashTable
parameter, ignored when not debugging. Call addIterator.
(KXMLCore::HashTableConstIterator::~HashTableConstIterator):
(KXMLCore::HashTableConstIterator::operator=): Call removeIterator.
(KXMLCore::HashTableConstIterator::operator*): Call checkValidity.
(KXMLCore::HashTableConstIterator::operator->): Ditto.
(KXMLCore::HashTableConstIterator::operator++): Ditto.
(KXMLCore::HashTableConstIterator::operator==): Ditto.
(KXMLCore::HashTableConstIterator::operator!=): Ditto.
(KXMLCore::HashTableConstIterator::checkValidity): Checks that the hash table
pointer is not 0 and if there are two iterators that both point at the same table.
(KXMLCore::HashTableIterator::HashTableIterator): Changed to use the const iterator
as an implementation detail, to avoid having two separate iterator implementations.
(KXMLCore::HashTableIterator::operator*): Ditto.
(KXMLCore::HashTableIterator::operator->): Ditto.
(KXMLCore::HashTableIterator::operator++): Ditto.
(KXMLCore::HashTableIterator::operator==): Ditto.
(KXMLCore::HashTableIterator::operator!=): Ditto.
(KXMLCore::HashTable::HashTable): Initialize pointer to head of iterators list.
(KXMLCore::HashTable::~HashTable): Added call to invalidateIterators.
(KXMLCore::HashTable::makeIterator): Pass this pointer.
(KXMLCore::HashTable::makeConstIterator): Ditto.
(KXMLCore::HashTable::insert): Call invalidateIterators, since this is a public
entry point that modifies the hash table.
(KXMLCore::HashTable::remove): Ditto.
(KXMLCore::HashTable::clear): Ditto.
(KXMLCore::HashTable::swap): Ditto.
(KXMLCore::HashTable::invalidateIterators): Added. Walks the iterators list and
clears out the table, next, and previous pointers in all of them, and then clears
the head so we have an empty list.
(KXMLCore::addIterator): Added. Adds the iterator the the linked list in the
passed-in table, and points the iterator at the table.
(KXMLCore::removeIterator): Added. Removes the iterator from the linked list in
the passed-in table.
* kxmlcore/HashTraits.h: A bit of tweaking and formatting.
2006-01-17 Justin Garcia <justin.garcia@apple.com>
Reviewed by eric
Deployment builds now use -O2
* JavaScriptCore.xcodeproj/project.pbxproj:
2006-01-17 Darin Adler <darin@apple.com>
Reviewed by Anders.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6610
change RefPtr so that it works when deref ends up deleting the RefPtr
* kxmlcore/PassRefPtr.h: Always set m_ptr before calling deref.
* kxmlcore/RefPtr.h: Ditto.
2006-01-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by darin.
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6322
DateProtoFuncImp::callAsFunction can crash due to lack of type checking
* kjs/date_object.cpp:
(KJS::DateProtoFunc::callAsFunction): Type check calls to all methods.
This matches section 15.9.5 in the spec.
2006-01-16 Tim Omernick <timo@apple.com>
Reviewed by John Sullivan.
JavaScriptCore part of <rdar://problem/4211707> NPAPI ref count behavior differs with Mozilla
* bindings/npruntime.cpp:
(_NPN_ReleaseObject):
Refactored part of this function out into _NPN_DeallocateObject.
(_NPN_DeallocateObject):
Forcibly deallocates the passed object, even if its refcount is
greater than zero.
* bindings/npruntime_impl.h:
Declared _NPN_DeallocateObject().
2006-01-16 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix problem with ++, ==, and != on const iterators in
HashMaps that are using the pointer specialization
* kxmlcore/HashMapPtrSpec.h:
(KXMLCore::PointerHashConstIteratorAdapter::operator++): Change type to const_iterator.
(KXMLCore::PointerHashConstIteratorAdapter::operator==): Ditto.
(KXMLCore::PointerHashConstIteratorAdapter::operator!=): Ditto.
2006-01-15 Alexey Proskuryakov <ap@nypop.com>
Reviewed by Anders.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6561
run-javascriptcore-tests doesn't work
* JavaScriptCore/tests/mozilla/Getopt/Mixed.pm:
Changed revision number to 1.8 (broken by svn migration).
2006-01-14 David Kilzer <ddkilzer@kilzer.net>
Reviewed and landed by Anders.
* kjs/create_hash_table: Fixed comment typo.
2006-01-13 Maks Orlovich <maksim@kde.org>
Mostly merging work by Peter Kelly. Reviewed by Maciej, landed by ap.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6261
Misc. array object fixes from KJS
* kjs/array_object.cpp: Don't treat 2^32-1 as a real array index property.
(ArrayInstance::getOwnPropertySlot): Ditto.
(ArrayInstance::deleteProperty): Ditto.
(ArrayInstance::put): Ditto.
(ArrayInstance::propList): Added a FIXME comment.
(ArrayInstance::put): Throw exception on trying to set invalid array length.
(ArrayProtoFunc::callAsFunction): Do not use a separator argument when doing toString/toLocalString.
* kjs/array_object.h: Added MAX_ARRAY_INDEX.
2006-01-13 Darin Adler <darin@apple.com>
- Replaced tabs with spaces in source files that had less than 10 lines with tabs.
- Set allow-tabs Subversion property in source files that have more than 10 lines with tabs.
2006-01-13 Anders Carlsson <andersca@mac.com>
Reviewed by Eric.
* kjs/create_hash_table:
Use correct size variables.
2006-01-13 Anders Carlsson <andersca@mac.com>
Reviewed by Darin.
* kjs/create_hash_table:
Don't create an empty entry array, instead add a entry with all fields
set to null and set the hash table size to 1.
* kjs/lookup.cpp:
(findEntry):
Remove the hash table size check
2006-01-12 Anders Carlsson <andersca@mac.com>
Reviewed by Maciej.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6494
Crash when assigning a new function to a DOMParser object
* JavaScriptCore.xcodeproj/project.pbxproj:
Move lookup.cpp before lookup.h
* kjs/lookup.cpp:
(findEntry):
If the hash table is empty, return 0 early.
2006-01-12 George Staikos <staikos@kde.org>
Reviewed by Darin.
* kjs/interpreter.cpp:
* kjs/testkjs.cpp:
* kjs/interpreter.h:
Add helper to interpreter to call the collector in order to facilitate
visibility rules in KDE.
2006-01-12 George Staikos <staikos@kde.org>
Reviewed by Maciej.
* kjs/kjs.pro: Updates to build the whole thing on Linux at least.
* kxmlcore/HashTable.h: Add missing assert.h
2006-01-12 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6505
retire APPLE_CHANGES from JavaScriptCore
* JavaScriptCore.xcodeproj/project.pbxproj: Removed both
APPLE_CHANGES and HAVE_CONFIG_H from all targets.
* README: Removed. This had obsolete information in it
and it wasn't clear what to replace it with.
* kjs/collector.h: Removed an APPLE_CHANGES if around something
that's not really platform-specific (although it does use a
platform-specific API at the moment).
* kjs/collector.cpp: Removed a mistaken comment.
* kjs/grammar.y:
* kjs/internal.cpp:
* kjs/object.h:
* kjs/operations.cpp:
* kjs/operations.h:
* kjs/ustring.h:
Use __APPLE__ instead of APPLE_CHANGES for code that should be
used only on Mac OS X.
* kjs/interpreter.cpp: Removed APPLE_CHANGES ifdef around the include
of the runtime.h header. Even though that header isn't needed at the
moment on platforms other than Mac OS X, the conditional stuff should
be in the header itself, not in this one client.
* kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed some
code inside APPLE_CHANGES. I'm pretty sure this code isn't needed on
any platform where pow is implemented corrrectly according to the IEEE
standard. If it is needed on some, we can add it back with an appropriate
#if for the platforms where it is needed.
2006-01-12 Justin Haygood <justin@xiondigital.net>
Reviewed, tweaked, and landed by Darin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6416
lexer.cpp, grammar.y protect include of config.h with "HAVE_CONFIG_H"
* kjs/dtoa.cpp: Removed HAVE_CONFIG_H, changed config.h to use
quotes instead of angle brackets. Moved dtoa.h include to the top.
Changed system header includes to use angle brackets instead of quotes.
* kjs/grammar.y: Removed HAVE_CONFIG_H, changed config.h to use
quotes instead of angle brackets.
* kjs/lexer.cpp: Removed HAVE_CONFIG_H, changed config.h to use
quotes instead of angle brackets. Moved lexer.h include to the top.
* kjs/ustring.cpp: Removed HAVE_CONFIG_H, changed config.h to use
quotes instead of angle brackets. Moved ustring.h include to the top.
2006-01-12 George Staikos <staikos@kde.org>
Reviewed by Maciej
- Import initial QMake file. Doesn't fully work yet.
2006-01-11 Ricci Adams <ricciadams@apple.com>
Reviewed by Maciej and Darin, landed by Darin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5939
final comma in javascript object prevents parsing
* kjs/grammar.y: Added rule to allow trailing comma in
object construction.
2006-01-11 Ricci Adams <ricciadams@apple.com>
Reviewed by Geoff, landed by Darin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5308
Number.toFixed doesn't include leading 0
* kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
Fixed a "<" that should have been a "<=".
2006-01-11 Ricci Adams <ricciadams@apple.com>
Reviewed by Geoff, landed by Darin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5307
Number.toFixed doesn't round 0.5 up
* kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
Fixed a ">" that should have been a ">=".
2006-01-11 Justin Haygood <justin@xiondigital.net>
Reviewed and landed by Darin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6486
JavaScriptCore should use system malloc on Windows
* kjs/config.h: Add USE_SYSTEM_MALLOC to the Win32 section.
2006-01-10 Darin Adler <darin@apple.com>
* Makefile: Took out unneeded "export" line.
* <many-files>: Changed a lot of flags (cleared bogus executable bits, set
MIME types, other small corrections).
2006-01-09 Darin Adler <darin@apple.com>
* Makefile.am: Removed.
2006-01-07 Anders Carlsson <andersca@mac.com>
Reviewed by Maciej.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6373
REGRESSION: JavaScript hang when comparing large array to null
* kjs/object.h:
(KJS::JSObject::isEqualToNull):
Add new function which returns true if an object should be treated as null when
doing comparisons.
* kjs/operations.cpp:
(KJS::equal):
Use isEqualToNull.
2006-01-07 Alexey Proskuryakov <ap@nypop.com>
Reviewed by Maciej.
- Fix WebCore development build
http://bugzilla.opendarwin.org/show_bug.cgi?id=6408
* kxmlcore/Assertions.h: Use __VA_ARGS__ in variadic macros.
2006-01-06 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- miscellaneous changes for 4% speedup on the JavaScript iBench
http://bugzilla.opendarwin.org/show_bug.cgi?id=6396
Changes mostly thanks to Maks Orlovich, tweaked a little by me.
* kjs/create_hash_table: Use the same hash as the one used by Identifier.
* kjs/function.cpp:
(KJS::FunctionImp::processParameters): Use the new List::copyFrom
(KJS::ActivationImp::ActivationImp): track variable while iterating
* kjs/internal.cpp:
(KJS::StringImp::toObject): create StringInstance directly
* kjs/list.cpp:
(KJS::List::copy): implement in terms of copyFrom
(KJS::List::copyFrom): more efficient way to copy in another list
* kjs/list.h:
* kjs/lookup.cpp:
(keysMatch): updated to work with identifier hash
(findEntry): ditto
(Lookup::findEntry): ditto
(Lookup::find): ditto
* kjs/lookup.h:
2006-01-06 Maciej Stachowiak <mjs@apple.com>
- fix development build failure from the previous checkin
* kjs/function.cpp:
(KJS::ActivationImp::put): Use prototype() accessor in assert.
2006-01-05 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- fix remaining performance regression from Getter/Setter change
http://bugzilla.opendarwin.org/show_bug.cgi?id=6249
- Activation objects should not have __proto__ property
http://bugzilla.opendarwin.org/show_bug.cgi?id=6395
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot): Implement directly, thus
skipping getter/setter handling and __proto__ handling, as well
as inlining needed superclass stuff.
(KJS::ActivationImp::put): Implement directly, skipping getter/setter,
__proto__, and do canPut directly in PropertyMap::put since there's no
static property table either.
* kjs/function.h:
* kjs/property_map.cpp:
(KJS::PropertyMap::put): Allow optionally inlining canPut check.
* kjs/property_map.h:
2006-01-04 Geoffrey Garen <ggaren@apple.com>
Patch by kimmo.t.kinnunen@nokia.com, reviewed by darin, tweaked by me.
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4921
\u escape sequences in JavaScript identifiers
* kjs/function_object.cpp:
(FunctionObjectImp::construct):
* kjs/lexer.cpp:
(Lexer::shift):
(Lexer::lex):
(Lexer::isWhiteSpace):
(Lexer::isLineTerminator):
(Lexer::isIdentStart):
(Lexer::isIdentPart):
(isDecimalDigit):
(Lexer::scanRegExp):
* kjs/lexer.h:
(KJS::Lexer::):
* tests/mozilla/expected.html: Updated test results.
2005-12-30 Maciej Stachowiak <mjs@apple.com>
No review, just test result update.
* tests/mozilla/expected.html: Updated for newly passing test from recent fixes.
2005-12-30 Anders Carlsson <andersca@mac.com>
Reviewed by Maciej.
- Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6298
Getter setter test is failing
* kjs/object.cpp:
(KJS::JSObject::put):
Rework the getter setter part. We now walk the prototype chain, checking for
getter/setter properties and only take the slow path if any are found.
2005-12-30 Maks Orlovich <maksim@kde.org>
Reviewed and committed by Maciej.
- Handle negative, FP numbers with non-10 radix in toString
http://bugzilla.opendarwin.org/show_bug.cgi?id=6259
(Merged from KJS, original work by Harri Porten)
* kjs/number_object.cpp:
(NumberProtoFunc::callAsFunction): rewrote Number.toString(radix) to work with
negative numbers, floating point and very large numbers.
2005-12-29 Geoffrey Garen <ggaren@apple.com>
Patch by Maks Orlovich, reviewed and landed by me.
- http://bugzilla.opendarwin.org/show_bug.cgi?id=6267
Fix Number.prototype.toFixed/toExponential(undefined)
* kjs/number_object.cpp:
(NumberProtoFunc::callAsFunction):
2005-12-29 Geoffrey Garen <ggaren@apple.com>
Patch by Maks Orlovich, Reviewed and landed by me.
- http://bugzilla.opendarwin.org/show_bug.cgi?id=6266
Minor object naming updates (to match Mozilla, KJS)
* kjs/number_object.cpp:
* kjs/regexp_object.cpp:
2005-12-29 Geoffrey Garen <ggaren@apple.com>
Patch by Maks Orlovich, reviewed by mjs.
This has 2 very minor fixes, covered by KJS testsuite:
1. Enumerates string indices in property list (with the same bug as array
object has in corresponding code). This is a mozilla emulation thing.
2. Permits properties with integer names in prototypes to be found
* kjs/string_object.cpp:
(StringInstance::getOwnPropertySlot):
(StringInstanceImp::propList):
* kjs/string_object.h:
2005-12-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by mjs.
- Fixed <rdar://problem/4364705> run-javascriptcore-tests crashes in
KJS::BlockNode::deref
AKA
http://bugzilla.opendarwin.org/show_bug.cgi?id=6233
Reproducible stack-overflow crash in ~RefPtr<T> due to RefPtr<T> use in
linked lists
This patch does four things:
(1) Standardizes all our linked list nodes to use "next" as their next
pointers.
(2) Creates the ListRefPtr<T> class, a subclass of RefPtr<T> specialized
to iteratively deref "next" pointers.
(3) Standardizes our linked list nodes to use ListRefPtr<T> and
implement the releaseNext() function used by ~ListRefPtr<T>().
(4) Adds to RefPtr<T> the release() method used by releaseNext().
- Modified existing mozilla test to ensure it would make deployment
builds crash as well.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/nodes.cpp:
(ElementNode::evaluate):
(PropertyListNode::evaluate):
(ArgumentListNode::evaluateList):
(StatListNode::StatListNode):
(StatListNode::execute):
(StatListNode::processVarDecls):
(VarDeclListNode::evaluate):
(VarDeclListNode::processVarDecls):
(VarStatementNode::execute):
(VarStatementNode::processVarDecls):
(BlockNode::BlockNode):
(CaseClauseNode::evalStatements):
(CaseClauseNode::processVarDecls):
(ClauseListNode::processVarDecls):
(CaseBlockNode::CaseBlockNode):
(CaseBlockNode::evalBlock):
(SourceElementsNode::SourceElementsNode):
(SourceElementsNode::execute):
(SourceElementsNode::processFuncDecl):
(SourceElementsNode::processVarDecls):
* kjs/nodes.h:
(KJS::ElementNode::ElementNode):
(KJS::ElementNode::releaseNext):
(KJS::ArrayNode::ArrayNode):
(KJS::PropertyListNode::PropertyListNode):
(KJS::PropertyListNode::releaseNext):
(KJS::ObjectLiteralNode::ObjectLiteralNode):
(KJS::ArgumentListNode::ArgumentListNode):
(KJS::ArgumentListNode::releaseNext):
(KJS::ArgumentsNode::ArgumentsNode):
(KJS::StatListNode::releaseNext):
(KJS::VarDeclListNode::VarDeclListNode):
(KJS::VarDeclListNode::releaseNext):
(KJS::VarStatementNode::VarStatementNode):
(KJS::ForNode::ForNode):
(KJS::CaseClauseNode::CaseClauseNode):
(KJS::ClauseListNode::ClauseListNode):
(KJS::ClauseListNode::getClause):
(KJS::ClauseListNode::getNext):
(KJS::ClauseListNode::releaseNext):
(KJS::ParameterNode::ParameterNode):
(KJS::ParameterNode::releaseNext):
(KJS::SourceElementsNode::releaseNext):
* kjs/nodes2string.cpp:
(ElementNode::streamTo):
(PropertyListNode::streamTo):
(ArgumentListNode::streamTo):
(StatListNode::streamTo):
(VarDeclListNode::streamTo):
(VarStatementNode::streamTo):
(CaseClauseNode::streamTo):
(ClauseListNode::streamTo):
(CaseBlockNode::streamTo):
(SourceElementsNode::streamTo):
* kxmlcore/ListRefPtr.h: Added.
(KXMLCore::ListRefPtr::ListRefPtr):
(KXMLCore::ListRefPtr::~ListRefPtr):
(KXMLCore::ListRefPtr::operator=):
* kxmlcore/RefPtr.h:
(KXMLCore::RefPtr::release):
2005-12-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by mjs.
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4026
Math.random() not seeded.
Added call to sranddev() -- it executes the first time a process
calls Math.random().
* kjs/math_object.cpp:
(MathFuncImp::callAsFunction):
2005-12-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by darin.
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6265
Name change regression: Java doesn't know what JavaJSObject is
Changed strings passed to Java back to original "JSObject".
* bindings/jni/jni_jsobject.cpp:
(JavaJSObject::convertValueToJObject):
(JavaJSObject::convertJObjectToValue):
2005-12-28 Anders Carlsson <andersca@mac.com>
Reviewed by Maciej.
- The JSC part of http://bugzilla.opendarwin.org/show_bug.cgi?id=6268
Add undetectable document.all
* kjs/operations.cpp:
(KJS::equal):
When comparing an object with null or undefined, call toPrimitive with
NullType as the preferred type.
2005-12-27 Anders Carlsson <andersca@mac.com>
Reviewed by Darin.
* kjs/array_object.cpp:
(ArrayProtoFunc::callAsFunction):
Implement filter and map. Also, make the existing
array iteration functions not invoke the callback for
non-existing properties, just as Mozilla does now.
* kjs/array_object.h:
(KJS::ArrayProtoFunc::):
Add filter and map.
* tests/mozilla/expected.html:
Update, two 1.6 tests now pass.
2005-12-27 Maciej Stachowiak <mjs@apple.com>
- updated test results for new JS 1.6 tests
* tests/mozilla/expected.html:
2005-12-27 Anders Carlsson <andersca@mac.com>
Reviewed by Maciej.
Add Mozilla JS 1.6 tests.
* tests/mozilla/js1_6/Array/browser.js: Added.
* tests/mozilla/js1_6/Array/regress-290592.js: Added.
* tests/mozilla/js1_6/Array/regress-304828.js: Added.
* tests/mozilla/js1_6/Array/regress-305002.js: Added.
* tests/mozilla/js1_6/Array/regress-310425-01.js: Added.
* tests/mozilla/js1_6/Array/regress-310425-02.js: Added.
* tests/mozilla/js1_6/Array/regress-320887.js: Added.
* tests/mozilla/js1_6/Array/shell.js: Added.
* tests/mozilla/js1_6/README: Added.
* tests/mozilla/js1_6/Regress/browser.js: Added.
* tests/mozilla/js1_6/Regress/regress-301574.js: Added.
* tests/mozilla/js1_6/Regress/regress-309242.js: Added.
* tests/mozilla/js1_6/Regress/regress-311157-01.js: Added.
* tests/mozilla/js1_6/Regress/regress-311157-02.js: Added.
* tests/mozilla/js1_6/Regress/regress-314887.js: Added.
* tests/mozilla/js1_6/Regress/regress-320172.js: Added.
* tests/mozilla/js1_6/Regress/shell.js: Added.
* tests/mozilla/js1_6/String/browser.js: Added.
* tests/mozilla/js1_6/String/regress-306591.js: Added.
* tests/mozilla/js1_6/String/shell.js: Added.
* tests/mozilla/js1_6/browser.js: Added.
* tests/mozilla/js1_6/shell.js: Added.
* tests/mozilla/js1_6/template.js: Added.
2005-12-27 Maks Orlovich <maksim@kde.org>
Reviewed and landed by Maciej.
- fixed 6234: Can delete array index property incorrectly.
http://bugzilla.opendarwin.org/show_bug.cgi?id=6234
* kjs/array_object.cpp:
(ArrayInstance::deleteProperty): use toArrayIndex instead of toUInt32 when
looking for array properties.
2005-12-27 Anders Carlsson <andersca@mac.com>
Reviewed by Maciej.
* kjs/object.cpp:
(KJS::JSObject::defineSetter):
Remove duplicate call to putDirect.
2005-12-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin and Geoff.
Changes by me and Anders.
- mostly fixed REGRESSION: 5-10% performance regression on JS iBench from getter/setter change
http://bugzilla.opendarwin.org/show_bug.cgi?id=6083
- also fixed some warnings reported by -Winline
* JavaScriptCorePrefix.h: Move new and delete definitions higher so there
aren't conflicts with use in standard C++ headers
* kjs/object.cpp:
(KJS::throwSetterError): Moved this piece of put into a seprate function
to avoid the PIC branch.
(KJS::JSObject::put): Use hasGetterSetterProperties to avoid expensive stuff
when not needed. Also use GetterSetter properties attribute.
(KJS::JSObject::deleteProperty): Recompute whether any properties are getter/setter
properties any more, if this one was one.
(KJS::JSObject::defineGetter): Let the PropertyMap know that it has getter/setter
properties now (and use the new attribute).
(KJS::JSObject::defineSetter): Ditto.
(KJS::JSObject::fillGetterPropertySlot): Out-of-line helper for getOwnPropertySlot,
to avoid global variable access in the hot code path.
* kjs/object.h:
(KJS::): Added GetterSetter attribute.
(KJS::JSCell::isObject): Moved lower to be after inline methods it uses.
(KJS::JSValue::isObject): ditto
(KJS::JSObject::getOwnPropertySlot): try to avoid impact of getters and setters
as much as possible in the case where they are not being used
* kjs/property_map.cpp:
(KJS::PropertyMap::containsGettersOrSetters): New method to help with this
* kjs/property_map.h:
(KJS::PropertyMap::hasGetterSetterProperties): Ditto
(KJS::PropertyMap::setHasGetterSetterProperties): Ditto
(KJS::PropertyMap::PropertyMap): Added a crazy hack to store the
global "has getter/setter properties" flag in the property map
single entry, to avoid making objects any bigger.
* kjs/value.h: Moved some things to object.h to make -Winline happier
2005-12-24 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric and Dave Hyatt.
- make even const PassRefPtrs give transfer of ownership semantics
http://bugzilla.opendarwin.org/show_bug.cgi?id=6238
This is a somewhat cheesy change. Having to use PassRefPtr_Ref creates ambiguities
in assignment and copy construction. And this makes life way easier and removes
the need for pass(). It is not really correct, but we pretty much never need a real
const PassRefPtr, and this takes care of things for PassRefPtr temporaries.
* kjs/identifier.cpp:
(KJS::Identifier::add): No more need for pass()
* kjs/property_map.cpp:
(KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): No more need for pass()
* kjs/ustring.cpp:
(KJS::UString::Rep::create): Use adoptRef
(KJS::UString::UString): No more need for pass
(KJS::UString::append): No more need for pass
(KJS::UString::substr): No more need for pass
* kxmlcore/PassRefPtr.h: made m_ptr mutable (ugh)
(KXMLCore::PassRefPtr::PassRefPtr): Take a const PassRefPtr reference
(KXMLCore::PassRefPtr::release): Made this a const method (ugh)
(KXMLCore::PassRefPtr::operator=): clean up appropriately
(KXMLCore::adoptRef): Added this to use instead of PassRefPtr<T>::adopt, I think
it makes the behavior more clear and it is less verbose.
(KXMLCore::static_pointer_cast): use adoptRef
(KXMLCore::const_pointer_cast): use adoptRef
* kxmlcore/RefPtr.h:
(KXMLCore::RefPtr::RefPtr): take const PassRefPtr&
(KXMLCore::PassRefPtr::operator=): take const PassRefPtr&
2005-12-25 Eric Seidel <eseidel@apple.com>
Reviewed by mjs.
Unbreak HashTableConstIterator++ by returning const_iterator
* kxmlcore/HashTable.h:
(KXMLCore::HashTableConstIterator::operator++): use const_iterator
2005-12-25 Eric Seidel <eseidel@apple.com>
Reviewed by mjs.
Un-break HashTable copy constructor.
* kxmlcore/HashTable.h:
(KXMLCore::::HashTable): use const_iterator instead
2005-12-23 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- fixed "HashMap does not work with const pointer keys or values"
http://bugzilla.opendarwin.org/show_bug.cgi?id=6222
* kxmlcore/HashMapPtrSpec.h:
(KXMLCore::HashMap): In all methods, explicitly cast all pointers
to void * before passing to internal implementation. Use C-style
casts instead of new-style casts, because the real solution would
require a combo of reinterpret_cast anc const_cast.
2005-12-23 Maciej Stachowiak <mjs@apple.com>
- this time for sure
* kxmlcore/RefPtr.h:
(KXMLCore::::swap):
2005-12-22 Maciej Stachowiak <mjs@apple.com>
- fix build problem from last commit.
* kxmlcore/RefPtr.h:
(KXMLCore::::swap):
2005-12-21 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- Make HashMap/HashSet support non-POD types
http://bugzilla.opendarwin.org/show_bug.cgi?id=5332
The changes for support are relatively simple, but I also made extensive changes to
avoid copying, so that there isn't refcount thrash when you put RefPtrs into a HashMap.
* kxmlcore/HashTable.h:
(KXMLCore::swap): specialize swap for pairs, to swap elements individually,
so that excess copies can be avoided.
(KXMLCore::Mover::move): Template function to either copy or swap, used
when transferring elements from old table to new.
(KXMLCore::IdentityHashTranslator::hash): The old "converting lookup" templates
that took two or three function parameters now take a class parameter, this is
the class used to do a normal lookup.
(KXMLCore::IdentityHashTranslator::equal): Ditto.
(KXMLCore::IdentityHashTranslator::translate): Ditto. Translate now takes a reference
to write into instead of returning a value to avoid redundant copies.
(KXMLCore::HashTable::~HashTable): Use deallocateTable instead of freeing directly.
(KXMLCore::HashTable::insert): Based on HashTranslator now instead of separate
functions. Added a FIXME about a remaining rare excess copy.
(KXMLCore::HashTable::isEmptyBucket): Use KeyTraits directly instead of unwrapping
the key from Traits, to avoid creating and destroying pair, which copies.
(KXMLCore::HashTable::isDeletedBucket): ditto
(KXMLCore::HashTable::lookup): Use HashTranslator now instead of separate functions.
(KXMLCore::HashTable::initializeBucket): Renamed from emptyBucket. Use placement new to
work right for non-POD types.
(KXMLCore::HashTable::deleteBucket): Use assignDeleted to avoid excess copies.
(KXMLCore::HashTable::reinsert): use Mover template to copy or swap as appropriate
(KXMLCore::HashTable::allocateTable): Initialize every bucket if calloc won't do.
(KXMLCore::HashTable::deallocateTable): Destruct every bucket if needed.
(KXMLCore::HashTable::rehash): Avoid copy before reinserting, so that swap can do its magic.
(KXMLCore::HashTable::clear): use deallocateTable instead of freeing directly.
(KXMLCore::HashTable::HashTable): be more dumb when copying to ensure that non-POD types
work right
* kxmlcore/HashFunctions.h:
(KXMLCore::PointerHash): Specialize PointerHash for RefPtr
* kxmlcore/HashMap.h:
(KXMLCore::extractFirst): Return a reference not a full object to avoid
copies.
(KXMLCore::HashMapTranslator::hash): Use a special translator for insertion
to defer making the pair as long as possible, thus avoiding needless copies.
(KXMLCore::HashMapTranslator::equal): ditto
(KXMLCore::HashMapTranslator::translate): ditto
(KXMLCore::::inlineAdd): Shared by set and add to insert using HashMapTranslator
(KXMLCore::::set): Use inlineAdd
(KXMLCore::::add): Use inlineAdd
* kxmlcore/HashMapPtrSpec.h:
(KXMLCore::): Pass KeyTraits along
* kxmlcore/HashSet.h:
(KXMLCore::identityExtract): Return a reference not a full object to avoid copies.
(KXMLCore::HashSetTranslatorAdapter::hash): Redo adapter stuff to work with
the new HashTranslator approach.
(KXMLCore::HashSetTranslatorAdapter::equal): ditto
(KXMLCore::HashSetTranslatorAdapter::translate): ditto
(KXMLCore::::insert): ditto
* kxmlcore/HashTraits.h:
(KXMLCore::GenericHashTraits): This is intended be used as a base class for
customized traits: sensible defaults.
(KXMLCore::): Use it a bunch
(KXMLCore::assignDeleted): template function to allow pairs to be assigned the
deleted value w/o excess copies.
(KXMLCore::PairHashTraits::emptyValue): Updated
(KXMLCore::PairHashTraits::deletedValue): Updated
(KXMLCore::PairHashTraits::assignDeletedValue): part of assignDeleted hack
(KXMLCore::DeletedValueAssigner::assignDeletedValue): Use template magic
to either use use deletedValue or assignDeletedValue for the cases where we care.
* kxmlcore/RefPtr.h:
(KXMLCore::RefPtr::swap): Added swap method.
(KXMLCore::swap): Added swap free function.
* kjs/identifier.cpp:
(KJS::CStringTranslator::hash): Use new HashTranslator class approach to
alternate type based insertion.
(KJS::CStringTranslator::equal): ditto
(KJS::CStringTranslator::translate): ditto
(KJS::Identifier::add): ditto
(KJS::UCharBufferTranslator::hash): ditto
(KJS::UCharBufferTranslator::equal): ditto
(KJS::UCharBufferTranslator::translate): ditto
- irrelevant change:
* kjs/array_object.cpp:
(ArrayProtoFunc::callAsFunction): Removed a stray space.
2005-12-22 Anders Carlsson <andersca@mac.com>
Reviewed by Eric and Darin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6196
Would like to be able to define prototypes in headers
* kjs/lookup.h:
Move ClassName from KJS_DECLARE_PROTOTYPE to KJS_IMPLEMENT_PROTOTYPE.
Also, namespace all macros by prefixing them with KJS_.
2005-12-22 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6191
RefPtr/PassRefPtr have a leak issue, operator== issues
* kxmlcore/PassRefPtr.h:
(KXMLCore::PassRefPtr::PassRefPtr): Remove non-template constructor that takes RefPtr
since the constructor template that takes RefPtr should be sufficient. Add a constructor
template that takes PassRefPtr&.
(KXMLCore::PassRefPtr::adopt): Use PassRefPtr_Ref to avoid setting pointer first to
0 and then to the pointer.
(KXMLCore::PassRefPtr::operator=): Added template versions that take PassRefPtr& and
RefPtr parameters.
(KXMLCore::PassRefPtr::operator PassRefPtr<U>): Changed to fix leak -- old version
would release and then ref.
(KXMLCore::operator==): Make templates have two parameters so you can mix types.
Also remove unneeded const in raw pointer versions.
(KXMLCore::operator!=): Ditto.
* kxmlcore/RefPtr.h:
(KXMLCore::RefPtr::RefPtr): Add constructor template that takes PassRefPtr.
(KXMLCore::RefPtr::operator=): Add assignment operator templates that take
RefPtr and PassRefPtr.
(KXMLCore::operator==): Make templates have two parameters so you can mix types.
Also remove unneeded const in raw pointer versions.
(KXMLCore::operator!=): Ditto.
2005-12-21 Timothy Hatcher <timothy@apple.com>
* JavaScriptCore.xcodeproj/project.pbxproj:
Set tab width to 8, indent width to 4 and uses tabs to false per file.
2005-12-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin.
Removed evil hack for determining if a type is an integer, replaced
with template metaprogramming.
* JavaScriptCore.xcodeproj/project.pbxproj: Set tab size to 2 for
testkjs.cpp
* kjs/testkjs.cpp:
(main): Inserted asserts to test IsInteger. FIXME: Move these to
KXMLCore unit tests directory when we create one.
* kxmlcore/HashTraits.h:
(KXMLCore::): Added IsInteger class for querying types.
2005-12-20 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- made ALWAYS_INLINE declare things inline as well as __attribute__((always_inline))
http://bugzilla.opendarwin.org/show_bug.cgi?id=6159
* kxmlcore/AlwaysInline.h:
2005-12-19 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- fixed a leak in the assignment operator from PassRefPtr to RefPtr
http://bugzilla.opendarwin.org/show_bug.cgi?id=6158
* kxmlcore/RefPtr.h:
(KXMLCore::RefPtr::operator=):
- fix problem with PassRefPtr that darin spotted - it lacked a copy constructor
and therefore was using the default one, which can lead to excess derefs
I fixed this by adding a copy constructor from non-const
reference, and by adding a template pass() function that you have
to use when raw pointer or RefPtr are passed where PassRefPtr is
expected.
* kjs/identifier.cpp:
(KJS::Identifier::add): Changed to have PassRefPtr return type and
pass() the results.
* kjs/identifier.h:
* kjs/property_map.cpp:
(KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Use pass()
where required.
* kjs/ustring.cpp:
(KJS::UString::UString): Use pass() as needed.
(KJS::UString::append): ditto
(KJS::UString::substr): ditto
* kjs/ustring.h:
(KJS::UString::UString): Use initializer instead of assignment
* kxmlcore/PassRefPtr.h:
(KXMLCore::PassRefPtr::PassRefPtr): Added copy constructor
(KXMLCore::pass): new template function to make it convenient to pass
a PassRefPtr
2005-12-19 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej.
Fixed <rdar://problem/4370397> Missing return statement in
JSMethodNameToObjcMethodName.
JSMethodNameToObjcMethodName had a check for a name being too long, but
the check was missing a return statement.
A lot of this code was confusing and some of it was wrong, so I fixed
it up, added some asserts to catch this type of bug in the future,
changed some comments, and renamed some variables.
The two advantages of the new algorithm are (1) It makes writing past
the end of the buffer virtually impossible because the test on the main
loop is "while (not past end of buffer)" and (2) It's twice as fast
because it doesn't call strlen. (There's no need to call strlen when
we're walking the string ourselves.)
methodsNamed also supports arbitrary-length method names now. Just in
case the AppKit folks start getting REALLY verbose...
* bindings/objc/objc_class.mm:
(KJS::Bindings::ObjcClass::methodsNamed):
* bindings/objc/objc_utility.h:
* bindings/objc/objc_utility.mm:
(KJS::Bindings::JSMethodNameToObjcMethodName):
2005-12-19 Darin Adler <darin@apple.com>
Originally done by both George Staikos and Alexey Proskuryakov.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5706
Sharedptr dependency can be removed
Our coding guidelines say "use 0 instead of NULL" and both RefPtr and
PassRefPtr were using NULL, which required including a header that
defines NULL.
* kxmlcore/PassRefPtr.h:
(KXMLCore::PassRefPtr::PassRefPtr): Use 0 instead of NULL.
(KXMLCore::PassRefPtr::operator!): Use ! instead of == NULL.
* kxmlcore/RefPtr.h:
(KXMLCore::RefPtr::RefPtr): Use 0 instead of NULL.
(KXMLCore::RefPtr::operator!): Use ! instead of == NULL.
Also did some reformatting.
2005-12-19 Darin Adler <darin@apple.com>
Reviewed by Geoff Garen and Eric Seidel.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4923
stop using <ostream> in WebCore, eliminating the <cmath> troubles it causes
* kjs/simple_number.h: Removed many unnecessary includes, including
the <cmath> one to work around GCC library header bugs. We may have to
add some includes elsewhere for platforms other than OS X, since our
prefix header takes care of some things.
* kxmlcore/AlwaysInline.h: Added. Now clients that don't include
simple_number.h can still get the ALWAYS_INLINE macro.
* JavaScriptCore.xcodeproj/project.pbxproj: Added AlwaysInline.h.
* bindings/NP_jsobject.h: Removed a lot of unnecessary includes
and removed C-specific stuff from this C++-only header.
* bindings/jni/jni_jsobject.h: Removed a lot of unnecessary includes
and did some reformatting.
* bindings/objc/objc_runtime.h: Removed an unnecessary include.
* bindings/runtime.h: Removed some unneeded includes. Reformatted.
* bindings/runtime.cpp: Updated to compile with header changes,
including a lot of reformatting.
* bindings/runtime_object.h: Removed an unnecessary include.
2005-12-13 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff and Adele
- replaced custom Identifier hashtable with HashSet
* kjs/identifier.cpp:
(KXMLCore::):
(KJS::identifierTable):
(KJS::Identifier::equal):
(KJS::hash):
(KJS::equal):
(KJS::convert):
(KJS::Identifier::add):
(KJS::Identifier::remove):
* kjs/identifier.h:
* kjs/internal.cpp:
(KJS::InterpreterImp::initGlobalObject):
2005-12-18 Justin Haygood <justin@xiondigital.net>
Reviewed, tweaked, and landed by Darin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5227
Array indexOf() extension for JavaScript 1.5 Core
* kjs/array_object.h:
* kjs/array_object.cpp: (ArrayProtoFunc::callAsFunction): Added implementation of indexOf.
2005-12-18 Anders Carlsson <andersca@mac.com>
Reviewed by Darin and Geoffrey.
- fix for <http://bugzilla.opendarwin.org/show_bug.cgi?id=4000>
Object.prototype is missing isPrototypeOf
* kjs/object_object.cpp:
(ObjectPrototype::ObjectPrototype):
Add isPrototypeOf to object prototype.
(ObjectProtoFunc::callAsFunction):
Implement isPrototypeOf
* kjs/object_object.h:
(KJS::ObjectProtoFunc::):
Add id for isPrototypeOf.
2005-12-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin.
Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6119
split() function ignores case insensitive modifier.
Glossary:
RegExpImp: The C++ object you get when JavaScript executes
"new RegExp()".
RegExp: A C++ wrapper object that performs regular expression
matching on behalf of a RegExpImp.
Instead of unnecessarily constructing a RegExp which (wrongly) lacks
any modifiers, String.split() now uses the RegExp built in to the
RegExpImp passed to it, which has the right modifiers already.
I also cleaned up other bits of the string code to standardized how
we handle RegExpImp arguments.
* ChangeLog:
* kjs/string_object.cpp:
(replace):
(StringProtoFunc::callAsFunction):
2005-12-16 David Hyatt <hyatt@apple.com>
Remove unused RefPtr constructors that can create an ambiguity in ustring on some platforms.
Reviewed by mjs
* kxmlcore/RefPtr.h:
(KXMLCore::RefPtr::RefPtr):
2005-12-15 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5688
speed up JavaScript parsing by not creating a UString just to parse
* kjs/internal.h:
* kjs/internal.cpp: (KJS::InterpreterImp::evaluate): Change to take a character pointer
and length rather than a UString.
* kjs/interpreter.h:
* kjs/interpreter.cpp: (Interpreter::evaluate): Ditto.
* kjs/protect.h: Remove uneeded "convert to bool" operator since we already have a
"convert to raw pointer" operator in this class.
=== Safari-521~5 ===
2005-12-13 Geoffrey Garen <ggaren@apple.com>
Updated test results to match Anders's last fix.
* tests/mozilla/expected.html:
2005-12-13 Anders Carlsson <andersca@mac.com>
* ChangeLog: Add titles for my bugzilla bugs.
2005-12-13 Anders Carlsson <andersca@mac.com>
Reviewed by Darin.
- Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=6041>
Support property getters and setters.
* bindings/runtime_array.cpp:
(RuntimeArray::lengthGetter):
(RuntimeArray::indexGetter):
* bindings/runtime_array.h:
* bindings/runtime_method.cpp:
(RuntimeMethod::lengthGetter):
* bindings/runtime_method.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::fallbackObjectGetter):
(RuntimeObjectImp::fieldGetter):
(RuntimeObjectImp::methodGetter):
* bindings/runtime_object.h:
* kjs/array_instance.h:
* kjs/array_object.cpp:
(ArrayInstance::lengthGetter):
(getProperty):
Update for changes to PropertySlot::getValue and
PropertySlot::GetValueFunc.
* kjs/collector.cpp:
(KJS::className):
Handle GetterSetterType.
* kjs/function.cpp:
(KJS::FunctionImp::argumentsGetter):
(KJS::FunctionImp::lengthGetter):
(KJS::Arguments::mappedIndexGetter):
(KJS::ActivationImp::argumentsGetter):
* kjs/function.h:
Update for changes to PropertySlot::getValue and
PropertySlot::GetValueFunc.
* kjs/grammar.y:
Rework grammar parts for get set declarations directly
in the object literal.
* kjs/internal.cpp:
(KJS::GetterSetterImp::mark):
(KJS::GetterSetterImp::toPrimitive):
(KJS::GetterSetterImp::toBoolean):
(KJS::GetterSetterImp::toNumber):
(KJS::GetterSetterImp::toString):
(KJS::GetterSetterImp::toObject):
Add type conversion functions. These aren't meant to be called.
(KJS::printInfo):
Handle GetterSetterType.
* kjs/lookup.h:
(KJS::staticFunctionGetter):
(KJS::staticValueGetter):
Update for changes to PropertySlot::GetValueFunc.
* kjs/nodes.cpp:
Refactor they way properties nodes are implemented.
We now have a PropertyListNode which is a list of PropertyNodes.
Each PropertyNode has a name (which is a PropertyNameNode) and an associated
value node. PropertyNodes can be of different types. The Constant type is the
old constant declaration and the Getter and Setter types are for property getters
and setters.
(ResolveNode::evaluate):
Update for changes to PropertySlot::getValue.
(PropertyListNode::evaluate):
Go through all property nodes and set them on the newly created object. If the
property nodes are of type Getter or Setter, define getters and setters. Otherwise,
just add the properties like before.
(PropertyNode::evaluate):
This should never be called directly.
(PropertyNameNode::evaluate):
Rename from PropertyNode::evaluate.
(FunctionCallResolveNode::evaluate):
(FunctionCallBracketNode::evaluate):
(FunctionCallDotNode::evaluate):
(PostfixResolveNode::evaluate):
(PostfixBracketNode::evaluate):
(PostfixDotNode::evaluate):
(TypeOfResolveNode::evaluate):
(PrefixResolveNode::evaluate):
(PrefixBracketNode::evaluate):
(PrefixDotNode::evaluate):
(AssignResolveNode::evaluate):
(AssignDotNode::evaluate):
(AssignBracketNode::evaluate):
Update for changes to PropertySlot::getValue.
* kjs/nodes.h:
(KJS::PropertyNameNode::PropertyNameNode):
Rename from PropertyNode.
(KJS::PropertyNode::):
(KJS::PropertyNode::PropertyNode):
New class, representing a single property.
(KJS::PropertyListNode::PropertyListNode):
Rename from PropertyValueNode.
(KJS::FuncExprNode::FuncExprNode):
Put ParameterNode parameter last, and make it optional.
(KJS::ObjectLiteralNode::ObjectLiteralNode):
Use a PropertyListNode here now.
* kjs/nodes2string.cpp:
(PropertyListNode::streamTo):
Iterate through all property nodes.
(PropertyNode::streamTo):
Print out the name and value. Doesn't handle getters and setters currently.
(PropertyNameNode::streamTo):
Rename from PropertyNode::streamTo.
* kjs/object.cpp:
(KJS::JSObject::get):
Update for changes to PropertySlot::getValue.
(KJS::JSObject::put):
If the property already exists and has a Setter, invoke
the setter function instead of setting the property directly.
(KJS::JSObject::defineGetter):
(KJS::JSObject::defineSetter):
New functions for defining property getters and setters on the object.
* kjs/object.h:
(KJS::GetterSetterImp::type):
(KJS::GetterSetterImp::GetterSetterImp):
(KJS::GetterSetterImp::getGetter):
(KJS::GetterSetterImp::setGetter):
(KJS::GetterSetterImp::getSetter):
(KJS::GetterSetterImp::setSetter):
New class for properties which have getters and setters defined.
This class is only used internally and should never be seen from the outside.
(KJS::JSObject::getOwnPropertySlot):
If the property is a getter, call setGetterSlot on the property slot.
* kjs/object_object.cpp:
(ObjectPrototype::ObjectPrototype):
Add __defineGetter__, __defineSetter, __lookupGetter__, __lookupSetter__
to prototype.
(ObjectProtoFunc::callAsFunction):
Implement handlers for new functions.
* kjs/object_object.h:
(KJS::ObjectProtoFunc::):
Add ids for new functions.
* kjs/property_slot.cpp:
(KJS::PropertySlot::undefinedGetter):
Update for changes to PropertySlot::GetValueFunc.
(KJS::PropertySlot::functionGetter):
Call the function getter object and return its value.
* kjs/property_slot.h:
(KJS::PropertySlot::getValue):
Add a new argument which is the original object that
getPropertySlot was called on.
(KJS::PropertySlot::setGetterSlot):
(KJS::PropertySlot::):
New function which sets a getter slot. When getValue is called on a
getter slot, the getter function object is invoked.
* kjs/string_object.cpp:
(StringInstance::lengthGetter):
(StringInstance::indexGetter):
* kjs/string_object.h:
Update for changes to PropertySlot::GetValueFunc.
* kjs/value.h:
(KJS::):
Add GetterSetterType and make GetterSetterImp a friend class of JSCell.
2005-12-12 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- added a new HashCountedSet class for the common pattern of mapping items to counts that can change
* kxmlcore/HashCountedSet.h: Added.
(KXMLCore::HashCountedSet::*): Implemented, on top of HashMap.
* kxmlcore/HashMap.h:
(KXMLCore::HashMap::add): New method - does not replace existing value if key already present
but otherwise like set().
(KXMLCore::HashMap::set): Improved comments.
* kxmlcore/HashMapPtrSpec.h:
(KXMLCore::HashMap::add): Added to specializations too.
* JavaScriptCore.xcodeproj/project.pbxproj: Add new file.
* kxmlcore/HashFunctions.h: Added include of stdint.h
- replaced the custom hashtable for values protected from GC with HashCountedSet
* kjs/collector.cpp:
(KJS::Collector::protect): Moved code here from ProtectedValues::increaseProtectCount
since the code is so simple now.
(KJS::Collector::unprotect): Ditto for ProtectedValues::decreaseProtectCount.
(KJS::Collector::markProtectedObjects): Updated for new way of doing things, now
simpler and safer.
(KJS::Collector::numReferencedObjects): ditto
(KJS::Collector::rootObjectClasses): ditto
* kjs/collector.h: Added protect and unprotect static methods
* kjs/protect.h:
(KJS::gcProtect): Updated for removal of ProtectedValues class
(KJS::gcUnprotect): likewise
* kjs/protected_values.cpp: Removed.
* kjs/protected_values.h: Removed.
2005-12-10 Darin Adler <darin@apple.com>
Rubber stamped by Maciej.
- did long-promised KJS renaming:
ValueImp -> JSValue
ObjectImp -> JSObject
AllocatedValueImp -> JSCell
A renaming to get a class out of the way
KJS::Bindings::JSObject -> JavaJSObject
and some other "imp-reduction" renaming
*InstanceImp -> *Instance
*ProtoFuncImp -> *ProtoFunc
*PrototypeImp -> *Prototype
ArgumentsImp -> Arguments
RuntimeArrayImp -> RuntimeArray
RuntimeMethodImp -> RuntimeMethod
* most files and functions
2005-12-10 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- eliminated the old Undefined(), Null(), Boolean(), Number(), and String()
Code now uses jsUndefined(), jsNull(), jsBoolean(), jsNumber(), and jsString().
* bindings/NP_jsobject.cpp:
(_NPN_Evaluate):
* bindings/c/c_instance.cpp:
(KJS::Bindings::CInstance::invokeMethod):
(KJS::Bindings::CInstance::invokeDefaultMethod):
* bindings/c/c_runtime.cpp:
(CField::valueFromInstance):
* bindings/c/c_utility.cpp:
(KJS::Bindings::convertNPVariantToValue):
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
(JavaInstance::invokeDefaultMethod):
* bindings/jni/jni_jsobject.cpp:
(JSObject::eval):
(JSObject::convertJObjectToValue):
* bindings/jni/jni_runtime.cpp:
(JavaArray::convertJObjectToArray):
(JavaField::valueFromInstance):
(JavaArray::valueAt):
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(-[WebScriptObject evaluateWebScript:]):
(-[WebScriptObject valueForKey:]):
(-[WebScriptObject webScriptValueAtIndex:]):
* bindings/objc/objc_instance.mm:
(ObjcInstance::invokeMethod):
(ObjcInstance::invokeDefaultMethod):
(ObjcInstance::getValueOfUndefinedField):
* bindings/objc/objc_runtime.mm:
(ObjcField::valueFromInstance):
(ObjcFallbackObjectImp::callAsFunction):
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertNSStringToString):
(KJS::Bindings::convertObjcValueToValue):
* bindings/runtime.h:
(KJS::Bindings::Class::fallbackObject):
(KJS::Bindings::Instance::getValueOfUndefinedField):
(KJS::Bindings::Instance::valueOf):
* bindings/runtime_array.cpp:
(RuntimeArrayImp::lengthGetter):
* bindings/runtime_method.cpp:
(RuntimeMethodImp::lengthGetter):
(RuntimeMethodImp::callAsFunction):
(RuntimeMethodImp::execute):
* kjs/array_object.cpp:
(ArrayInstanceImp::lengthGetter):
(CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
(ArrayPrototypeImp::ArrayPrototypeImp):
(ArrayProtoFuncImp::ArrayProtoFuncImp):
(ArrayProtoFuncImp::callAsFunction):
(ArrayObjectImp::ArrayObjectImp):
* kjs/bool_object.cpp:
(BooleanPrototypeImp::BooleanPrototypeImp):
(BooleanProtoFuncImp::callAsFunction):
(BooleanObjectImp::BooleanObjectImp):
(BooleanObjectImp::callAsFunction):
* kjs/error_object.cpp:
(ErrorPrototypeImp::ErrorPrototypeImp):
(ErrorProtoFuncImp::ErrorProtoFuncImp):
(ErrorProtoFuncImp::callAsFunction):
(ErrorObjectImp::ErrorObjectImp):
(NativeErrorImp::NativeErrorImp):
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::FunctionImp::processParameters):
(KJS::FunctionImp::argumentsGetter):
(KJS::FunctionImp::lengthGetter):
(KJS::DeclaredFunctionImp::execute):
(KJS::encode):
(KJS::decode):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function_object.cpp:
(FunctionPrototypeImp::FunctionPrototypeImp):
(FunctionPrototypeImp::callAsFunction):
(FunctionProtoFuncImp::callAsFunction):
(FunctionObjectImp::FunctionObjectImp):
* kjs/internal.cpp:
(KJS::InterpreterImp::initGlobalObject):
* kjs/interpreter.h:
* kjs/lookup.h:
* kjs/math_object.cpp:
(MathObjectImp::getValueProperty):
(MathFuncImp::callAsFunction):
* kjs/nodes.cpp:
(Node::setExceptionDetailsIfNeeded):
(NullNode::evaluate):
(PropertyNode::evaluate):
(FunctionCallBracketNode::evaluate):
(FunctionCallDotNode::evaluate):
(PostfixBracketNode::evaluate):
(PostfixDotNode::evaluate):
(VoidNode::evaluate):
(PrefixBracketNode::evaluate):
(PrefixDotNode::evaluate):
(ShiftNode::evaluate):
(valueForReadModifyAssignment):
(AssignDotNode::evaluate):
(AssignBracketNode::evaluate):
(VarDeclNode::evaluate):
(VarDeclNode::processVarDecls):
(VarDeclListNode::evaluate):
(ReturnNode::execute):
(CaseClauseNode::evalStatements):
(ParameterNode::evaluate):
(FuncDeclNode::processFuncDecl):
* kjs/nodes.h:
(KJS::StatementNode::evaluate):
* kjs/number_object.cpp:
(NumberPrototypeImp::NumberPrototypeImp):
(NumberProtoFuncImp::callAsFunction):
(NumberObjectImp::NumberObjectImp):
(NumberObjectImp::getValueProperty):
(NumberObjectImp::callAsFunction):
* kjs/object.cpp:
(KJS::ObjectImp::get):
(KJS::Error::create):
* kjs/object_object.cpp:
(ObjectPrototypeImp::ObjectPrototypeImp):
(ObjectProtoFuncImp::callAsFunction):
(ObjectObjectImp::ObjectObjectImp):
* kjs/property_slot.cpp:
(KJS::PropertySlot::undefinedGetter):
* kjs/regexp_object.cpp:
(RegExpPrototypeImp::RegExpPrototypeImp):
(RegExpProtoFuncImp::callAsFunction):
(RegExpObjectImp::RegExpObjectImp):
(RegExpObjectImp::arrayOfMatches):
(RegExpObjectImp::getBackref):
(RegExpObjectImp::getLastMatch):
(RegExpObjectImp::getLastParen):
(RegExpObjectImp::getLeftContext):
(RegExpObjectImp::getRightContext):
(RegExpObjectImp::getValueProperty):
(RegExpObjectImp::construct):
* kjs/string_object.cpp:
(StringInstanceImp::StringInstanceImp):
(StringPrototypeImp::StringPrototypeImp):
(replace):
(StringProtoFuncImp::callAsFunction):
(StringObjectImp::StringObjectImp):
(StringObjectImp::callAsFunction):
(StringObjectFuncImp::StringObjectFuncImp):
(StringObjectFuncImp::callAsFunction):
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction):
(VersionFunctionImp::callAsFunction):
* kjs/value.h:
2005-12-10 Oliver Hunt <ojh16@student.canterbury.ac.nz>
Reviewed by Maciej, landed by Darin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=3539
Array join and toString methods do not support circular references
* kjs/array_object.cpp: (ArrayProtoFuncImp::callAsFunction):
Added set of visited objects -- don't recurse if item is already in the set.
2005-12-08 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
- fix major memory leak and resultant slowdown on JavaScript iBench from
my PassRefPtr changes
* kjs/ustring.cpp:
(KJS::UString::Rep::create): I forgot to change one of the two overloads to create
with a refcount of 0 instead of 1 (the smart pointer then bumps it. But instead of
changing it, I changed both to start with a refcounter of 1 and use PassRefPtr::adopt
to adopt the initial refcount, this may be a hair more efficient.
- made the assignment operators for smart pointers inline because Shark said so
* kxmlcore/PassRefPtr.h:
(KXMLCore::::operator=):
* kxmlcore/RefPtr.h:
(KXMLCore::::operator=):
2005-12-06 Anders Carlsson <andersca@mac.com>
Reviewed by Darin.
- fix build when using gcc 4
* kjs/ustring.h:
Make Rep public.
* kxmlcore/PassRefPtr.h:
(KXMLCore::::operator):
Fix a typo.
2005-12-05 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- add PassRefPtr, a smart pointer class that works in conjunction
with RefPtr but has transfer-of-ownership semantics
- apply RefPtr and PassRefPtr to UString
- cleaned up UString a little so that it doesn't need to have so many friend classes
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/identifier.cpp:
(KJS::Identifier::add):
* kjs/identifier.h:
(KJS::Identifier::Identifier):
(KJS::Identifier::equal):
* kjs/property_map.cpp:
(KJS::PropertyMap::get):
(KJS::PropertyMap::getLocation):
(KJS::PropertyMap::put):
(KJS::PropertyMap::remove):
* kjs/ustring.cpp:
(KJS::UCharReference::operator=):
(KJS::UCharReference::ref):
(KJS::UString::Rep::createCopying):
(KJS::UString::Rep::create):
(KJS::UString::usedCapacity):
(KJS::UString::usedPreCapacity):
(KJS::UString::expandCapacity):
(KJS::UString::expandPreCapacity):
(KJS::UString::UString):
(KJS::UString::spliceSubstringsWithSeparators):
(KJS::UString::append):
(KJS::UString::operator=):
(KJS::UString::toStrictUInt32):
(KJS::UString::substr):
(KJS::UString::copyForWriting):
(KJS::operator==):
* kjs/ustring.h:
(KJS::UString::UString):
(KJS::UString::~UString):
(KJS::UString::data):
(KJS::UString::isNull):
(KJS::UString::isEmpty):
(KJS::UString::size):
(KJS::UString::rep):
* kxmlcore/RefPtr.h:
(KXMLCore::RefPtr::RefPtr):
(KXMLCore::RefPtr::operator*):
(KXMLCore::::operator):
(KXMLCore::operator==):
(KXMLCore::operator!=):
(KXMLCore::static_pointer_cast):
(KXMLCore::const_pointer_cast):
2005-12-04 Geoffrey Garen <ggaren@apple.com>
Update test results to match Anders's last checkin.
* tests/mozilla/expected.html:
2005-12-04 Anders Carlsson <andersca@mac.com>
Reviewed by Geoffrey.
- Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3999>
Object.prototype is missing propertyIsEnumerable
* kjs/object.cpp:
(KJS::ObjectImp::canPut):
Refactor to use getPropertyAttributes.
(KJS::ObjectImp::propertyIsEnumerable):
New function which checks if a property is enumerable.
(KJS::ObjectImp::getPropertyAttributes):
* kjs/object.h:
Add getPropertyAttributes and propertyIsEnumerable.
* kjs/object_object.cpp:
(ObjectPrototypeImp::ObjectPrototypeImp):
(ObjectProtoFuncImp::callAsFunction):
* kjs/object_object.h:
(KJS::ObjectProtoFuncImp::):
Add propertyIsEnumerable to the Object prototype.
2005-12-01 Maciej Stachowiak <mjs@apple.com>
Reviewed by Tim Hatcher.
- removed deprecated reset, isNull and nonNull methods
* kxmlcore/RefPtr.h:
2005-12-01 Anders Carlsson <andersca@mac.com>
Reviewed by Darin.
- Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3382>
nodes2strings.cpp fails to print left expression of ForInNode when 'var' is not used
Patch by Mark Rowe.
* kjs/nodes2string.cpp:
(ForInNode::streamTo):
Add lexpr if there's no varDecl.
2005-12-01 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Eric.
- renamed SharedPtr to RefPtr via script
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function.h:
* kjs/function_object.cpp:
(FunctionObjectImp::construct):
* kjs/internal.cpp:
(KJS::Parser::parse):
(KJS::InterpreterImp::checkSyntax):
(KJS::InterpreterImp::evaluate):
* kjs/internal.h:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
(KJS::SourceStream::operator<<):
* kjs/protect.h:
* kxmlcore/RefPtr.h: Added.
(KXMLCore::RefPtr::RefPtr):
(KXMLCore::RefPtr::~RefPtr):
(KXMLCore::RefPtr::isNull):
(KXMLCore::RefPtr::notNull):
(KXMLCore::RefPtr::reset):
(KXMLCore::RefPtr::get):
(KXMLCore::RefPtr::operator*):
(KXMLCore::RefPtr::operator->):
(KXMLCore::RefPtr::operator!):
(KXMLCore::RefPtr::operator UnspecifiedBoolType):
(KXMLCore::::operator):
(KXMLCore::operator==):
(KXMLCore::operator!=):
(KXMLCore::static_pointer_cast):
(KXMLCore::const_pointer_cast):
* kxmlcore/SharedPtr.h: Removed.
2005-11-30 Maciej Stachowiak <mjs@apple.com>
Reviewed by Dave Hyatt.
- change idiom used for implicit bool conversion of smart pointers, because the old one gives weird error messages sometimes
* kjs/protect.h:
(KJS::ProtectedPtr::operator UnspecifiedBoolType):
* kxmlcore/SharedPtr.h:
(KXMLCore::SharedPtr::operator UnspecifiedBoolType):
2005-11-29 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by ggaren. Committed by eseidel.
Date conversion to local time gets the DST flag wrong sometimes
http://bugzilla.opendarwin.org/show_bug.cgi?id=5514
* kjs/date_object.cpp:
(KJS::isTime_tSigned):
(KJS::DateProtoFuncImp::callAsFunction):
2005-11-26 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Eric.
- renamed InterpreterLock to JSLock
* bindings/NP_jsobject.cpp:
(_NPN_Invoke):
(_NPN_Evaluate):
(_NPN_GetProperty):
(_NPN_SetProperty):
(_NPN_RemoveProperty):
(_NPN_HasProperty):
(_NPN_HasMethod):
(_NPN_SetException):
* bindings/jni/jni_jsobject.cpp:
(JSObject::call):
(JSObject::eval):
(JSObject::getMember):
(JSObject::setMember):
(JSObject::removeMember):
(JSObject::getSlot):
(JSObject::setSlot):
(JSObject::toString):
(JSObject::convertJObjectToValue):
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(-[WebScriptObject evaluateWebScript:]):
(-[WebScriptObject setValue:forKey:]):
(-[WebScriptObject valueForKey:]):
(-[WebScriptObject removeWebScriptKey:]):
(-[WebScriptObject stringRepresentation]):
(-[WebScriptObject webScriptValueAtIndex:]):
(-[WebScriptObject setWebScriptValueAtIndex:value:]):
(+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
* bindings/runtime.cpp:
(Instance::createRuntimeObject):
* bindings/runtime_root.cpp:
(KJS::Bindings::addNativeReference):
(KJS::Bindings::removeNativeReference):
(RootObject::removeAllNativeReferences):
* bindings/runtime_root.h:
(KJS::Bindings::RootObject::~RootObject):
(KJS::Bindings::RootObject::setRootObjectImp):
* bindings/testbindings.cpp:
(main):
* bindings/testbindings.mm:
(main):
* kjs/JSLock.cpp:
(KJS::initializeJSLock):
(KJS::JSLock::lock):
(KJS::JSLock::unlock):
(KJS::JSLock::lockCount):
(KJS::JSLock::DropAllLocks::DropAllLocks):
(KJS::JSLock::DropAllLocks::~DropAllLocks):
* kjs/JSLock.h:
(KJS::JSLock::JSLock):
(KJS::JSLock::~JSLock):
* kjs/collector.cpp:
(KJS::Collector::allocate):
(KJS::Collector::collect):
* kjs/internal.cpp:
(KJS::InterpreterImp::InterpreterImp):
(KJS::InterpreterImp::clear):
(KJS::InterpreterImp::checkSyntax):
(KJS::InterpreterImp::evaluate):
* kjs/interpreter.cpp:
(Interpreter::evaluate):
* kjs/protect.h:
(KJS::::ProtectedPtr):
(KJS::::~ProtectedPtr):
(KJS::::operator):
* kjs/protected_reference.h:
(KJS::ProtectedReference::ProtectedReference):
(KJS::ProtectedReference::~ProtectedReference):
(KJS::ProtectedReference::operator=):
* kjs/protected_values.cpp:
(KJS::ProtectedValues::getProtectCount):
(KJS::ProtectedValues::increaseProtectCount):
(KJS::ProtectedValues::decreaseProtectCount):
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction):
(main):
2005-11-26 Darin Adler <darin@apple.com>
Reviewed by eseidel. Committed by eseidel.
Inline ScopeChain functions for speed.
http://bugzilla.opendarwin.org/show_bug.cgi?id=5687
* kjs/object.h:
(KJS::ScopeChain::mark):
* kjs/scope_chain.cpp:
* kjs/scope_chain.h:
(KJS::ScopeChain::ref):
(KJS::ScopeChain::operator=):
(KJS::ScopeChain::bottom):
(KJS::ScopeChain::push):
(KJS::ScopeChain::pop):
2005-11-21 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
<rdar://problem/4139620> Seed: WebKit: hang when sending XMLHttpRequest if automatic proxy config is used
Also factored locking code completely into a separate class, and
added a convenient packaged way to temporarily drop locks.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/JSLock.cpp: Added.
(KJS::initializeInterpreterLock):
(KJS::InterpreterLock::lock):
(KJS::InterpreterLock::unlock):
(KJS::InterpreterLock::lockCount):
(KJS::InterpreterLock::DropAllLocks::DropAllLocks):
(KJS::InterpreterLock::DropAllLocks::~DropAllLocks):
* kjs/JSLock.h: Added.
(KJS::InterpreterLock::InterpreterLock):
(KJS::InterpreterLock::~InterpreterLock):
* kjs/internal.cpp:
* kjs/internal.h:
* kjs/interpreter.cpp:
* kjs/interpreter.h:
* kjs/protect.h:
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction):
2005-11-21 Eric Seidel <eseidel@apple.com>
Rubber-stamped by hyatt.
Removed JavaScriptCore+SVG target.
* JavaScriptCore.xcodeproj/project.pbxproj:
2005-11-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by mjs.
- Fixed <rdar://problem/4342216> Installer crash in
KJS::ValueImp::marked() when garbage collector runs inside call to
ConstantValues::init()
I took responsibility for initializing and marking ConstantValues away
from InterpreterImp, since it's possible to reference such a value
before any interpreter has been created and after the last interpreter
has been destroyed.
InterpreterImp::lock now initializes ConstantValues. It's a good
place for the initialization because you have to call it before
creating any objects. Since ::lock can be called more than once,
I added a check in ConstantValues::init to ensure that it executes
only once.
Collector:collect is now responsible for marking ConstantValues.
We no longer clear the ConstantValues since we can't guarantee that no
one has a reference to them.
FIXME: This is hackery. The long-term plan is to make ConstantValues
use immediate values that require no initialization.
* ChangeLog:
* kjs/collector.cpp:
(KJS::Collector::collect):
* kjs/internal.cpp:
(KJS::InterpreterImp::InterpreterImp):
(KJS::InterpreterImp::lock):
(KJS::InterpreterImp::clear):
(KJS::InterpreterImp::mark):
* kjs/internal.h:
* kjs/value.cpp:
(KJS::ConstantValues::initIfNeeded):
* kjs/value.h:
2005-11-08 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin.
This patch fixes some naughty naughty code -- 5 crashes and 2
may-go-haywire-in-the-futures.
One such crash is <rdar://problem/4247330> 8C46 Crash with with
incomplete parameter list to webScript object function.
I replaced early returns from within NS_DURINGs with calls to
NS_VALUERETURN because the doc says, "You cannot use goto or
return to exit an exception handling domain -- errors will result."
I replaced hard-coded analyses of -[NSMethodSignature
methodReturnType] with more abstracted alternatives, since
the documentation says "This encoding is implementation-specific,
so applications should use it with caution," and then emits an
evil cackle.
I removed the early return in the case where a JavaScript caller
supplies an insufficient number of arguments, because the right
thing to do in such a case is to use JavaScript's defined behavior
of supplying "undefined" for any missing arguments.
I also changed ObjcInstance::invokeMethod so that it no longer
deletes the method passed to it. It doesn't create the method,
so it shouldn't delete it. A friend of mine named
KERNEL_PROTECTION_FAILURE agrees with me on this point.
Finally, I changed an assert(true) to assert(false) because
all the other asserts were making fun of it.
* bindings/objc/objc_instance.mm:
(ObjcInstance::invokeMethod):
(ObjcInstance::invokeDefaultMethod):
2005-11-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin.
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5571
REGRESSION (412.5-TOT): duplicated words/sentences at
shakespeer.sourceforge.net
Our UTF16-modified PCRE didn't work with extended character classes
(classes involving characters > 255) because it used the GETCHARINC
macro to read through them. In UTF16 mode, GETCHARINC expects UTF16
input, but PCRE encodes character classes in UTF8 regardless of the
input mode of the subject string.
The fix is to explicitly define GETUTF8CHARINC, and to use it,
rather than GETCHARINC, when reading extended character classes.
In UTF8 mode, we simply define GETCHARINC to be GETUTF8CHARINC.
* pcre/pcre_internal.h:
* pcre/pcre_xclass.c:
(_pcre_xclass):
2005-11-05 Geoffrey Garen <ggaren@apple.com>
Patch by Mitz Pettel, reviewed by Maciej.
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5357
REGRESSION: Scriptable plugin hides properties of OBJECT element
* bindings/objc/objc_class.mm:
(KJS::Bindings::ObjcClass::fallbackObject):
2005-11-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin.
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5409
slice() testcase doesn't pass
Modified String.slice to deal with funky values.
Updated test results. We now pass <js1_2/String/slice.js>.
* kjs/string_object.cpp:
(StringProtoFuncImp::callAsFunction):
* tests/mozilla/expected.html:
2005-11-04 Darin Adler <darin@apple.com>
Reviewed by Tim Hatcher.
* kxmlcore/HashSet.h: Fixed case of "hashfunctions.h" -- needs to be "HashFunctions.h".
2005-11-03 Timothy Hatcher <timothy@apple.com>
Reviewed by Darin and Vicki.
* JavaScriptCore.xcodeproj/project.pbxproj:
Change to use $(SYSTEM_LIBRARY_DIR) consistently and place
$(NEXT_ROOT) in a few spots to make build-root work.
2005-11-03 Geoffrey Garen <ggaren@apple.com>
- Updated JavaScriptCore test results to reflect recent fixes.
* tests/mozilla/expected.html:
2005-11-03 Geoffrey Garen <ggaren@apple.com>
Reviewed by darin.
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5602
REGRESSION: RegExp("[^\\s$]+", "g") returns extra matches
We now update lastIndex relative to the start of the last match,
rather than the start of the last search. We used to assume that
the two were equal, but that is not the case when a pattern
matches at a character after the first in the string.
* kjs/regexp_object.cpp:
(RegExpProtoFuncImp::callAsFunction):
2005-10-24 John Sullivan <sullivan@apple.com>
Reviewed by Darin Adler. Code changes by Alexey Proskuryakov.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4931
Unicode format characters (Cf) should be removed from JavaScript source
* kjs/lexer.cpp:
include <unicode/uchar.h>
(Lexer::Lexer):
use KJS::UChar instead of UChar to avoid ambiguity caused by new include
(Lexer::setCode):
ditto; also, use shift(4) to skip first 4 chars to take advantage of new
logic there.
(Lexer::shift):
skip chars of type U_FORMAT_CHAR
(Lexer::convertUnicode):
use KJS::UChar instead of UChar to avoid ambiguity caused by new include
(Lexer::record16):
ditto
(Lexer::makeIdentifier):
ditto
(Lexer::makeUString):
ditto
* tests/mozilla/ecma/Array/15.4.5.1-1.js:
updated to skip soft hyphens
2005-10-24 John Sullivan <sullivan@apple.com>
Reviewed by Darin Adler. Code changes by George Staikos/Geoff Garen.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4142
Date object does not always adjust daylight savings correctly
* kjs/date_object.cpp:
(KJS::makeTime):
Fix the case where a time change crosses the daylight savings start/end dates.
2005-10-17 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff. Code changes by Darin.
- some micro-optimizations to FastMalloc to reduce math and branches.
* kxmlcore/FastMalloc.cpp:
(KXMLCore::TCMalloc_Central_FreeList::Populate):
(KXMLCore::fastMallocRegisterThread):
(KXMLCore::TCMalloc_ThreadCache::GetCache):
(KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
2005-10-15 Maciej Stachowiak <mjs@apple.com>
Reverted fix for this bug, because it was part of a time range that caused a performance
regression:
<rdar://problem/4260481> Remove Reference type from JavaScriptCore
2005-10-15 Darin Adler <darin@apple.com>
* kxmlcore/HashTable.cpp: Fixed build failure (said hashtable.h instead of HashTable.h).
2005-10-14 Geoffrey Garen <ggaren@apple.com>
Style changes recommended by Darin.
Changed to camelCase, changed ValueImp* to ValueImp *.
* kjs/simple_number.h:
(KJS::SimpleNumber::make):
(KJS::SimpleNumber::value):
2005-10-11 Geoffrey Garen <ggaren@apple.com>
Added regexp_object.lut.h build phase from JavaScriptCore
to JavaScriptCore+SVG.
Reviewed by mitz.
* JavaScriptCore.xcodeproj/project.pbxproj:
2005-10-11 Geoffrey Garen <ggaren@apple.com>
Fixed build bustage from last checkin (stray characters
in the project file).
Reviewed by mitz.
* JavaScriptCore.xcodeproj/project.pbxproj:
2005-10-11 Geoffrey Garen <ggaren@apple.com>
New JavaScriptCore test results to reflect the last change.
* tests/mozilla/expected.html:
2005-10-10 Geoffrey Garen <ggaren@apple.com>
- Implemented caching of match state inside the global RegExp object
(lastParen, leftContext, rightContext, lastMatch, input).
exec(), test(), match(), search(), and replace() now dipatch regular
expression matching through the RegExp object's performMatch function,
to facilitate caching. This replaces registerRegexp and
setSubPatterns.
- Implemented the special '$' aliases (e.g. RegExp.input aliases to
RegExp.$_).
- Moved support for backreferences into the new static hash table
used for other special RegExp properties. Truncated backreferences
at $9 to match IE, FF, and the "What's New in Netscape 1.2?" doc.
(String.replace still supports double-digit backreferences.)
- Tweaked RegExp.prototype.exec to handle ginormous values in lastIndex.
Fixes 11 -- count em, 11 -- JavaScriptCore tests.
* fast/js/regexp-caching-expected.txt: Added.
* fast/js/regexp-caching.html: Added.
Reviewed by mjs.
* JavaScriptCore.xcodeproj/project.pbxproj: Added regexp_object.lut.h
* kjs/create_hash_table: Tweaked to allow for more exotic characters.
We now rely on the compiler to catch illegal
identifiers.
* kjs/regexp.cpp:
(KJS::RegExp::RegExp):
* kjs/regexp_object.cpp:
(RegExpProtoFuncImp::callAsFunction):
(RegExpObjectImp::RegExpObjectImp):
(RegExpObjectImp::performMatch):
(RegExpObjectImp::arrayOfMatches):
(RegExpObjectImp::backrefGetter):
(RegExpObjectImp::getLastMatch):
(RegExpObjectImp::getLastParen):
(RegExpObjectImp::getLeftContext):
(RegExpObjectImp::getRightContext):
(RegExpObjectImp::getOwnPropertySlot):
(RegExpObjectImp::getValueProperty):
(RegExpObjectImp::put):
(RegExpObjectImp::putValueProperty):
* kjs/regexp_object.h:
(KJS::RegExpObjectImp::):
* kjs/string_object.cpp:
(substituteBackreferences):
(replace):
(StringProtoFuncImp::callAsFunction):
2005-10-09 Darin Adler <darin@apple.com>
Reviewed by Maciej; some changes done after review.
- fixed <rdar://problem/4092064> hanging loading page; rte.ie (works in IE and Firefox)
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5280
Date.setMonth fails with negative values
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5154
JSC should switch to _r variants of unix time/date functions
- fixed a few possible overflow cases
Retested all tests to be sure nothing broke; added layout test for bug 5280.
* kjs/config.h: Removed TIME_WITH_SYS_TIME define. Also set HAVE_SYS_TIMEB_H
for the __APPLE__ case (the latter is accurate but irrelevant).
* kjs/date_object.h: Reformatted. Removed unnecessary include of "function_object.h".
Moved declarations of helper classes and functions into the cpp file.
* kjs/date_object.cpp: Removed code at top to define macros to use CoreFoundation instead of
POSIX date functions.
(KJS::styleFromArgString): Tweaked to return early instead of using a variable.
(KJS::formatLocaleDate): Tweaked to check for undefined rather than checking argument count.
(KJS::formatDate): Made parameter const.
(KJS::formatDateUTCVariant): Ditto.
(KJS::formatTime): Ditto.
(KJS::DateProtoFuncImp::callAsFunction): Use gmtime_r and localtime_r instead of gmtime and
localtime.
(KJS::DateObjectImp::callAsFunction): Use localtime_r instead of localtime.
(KJS::ymdhmsToSeconds): Renamed from ymdhms_to_seconds. Changed computation to avoid possible
overflow if year is an extremely large or small number.
(KJS::makeTime): Removed code to move large month numbers from tm_mon to tm_year; this was
to accomodate CFGregorianDate, which is no longer used (and didn't handle negative values).
(KJS::parseDate): Renamed from KRFCDate_parseDate; changed to return a value in milliseconds
rather than in seconds. Reformatted the code. Changed to use UTF8String() instead of ascii(),
since ascii() is not thread safe. Changed some variables back from int to long to avoid
trouble if the result of strtol does not fit in an int (64-bit issue only).
2005-10-08 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by Geoff.
Tweaked and landed by Darin.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5266
Support parenthesized comments in Date.parse()
* kjs/date_object.cpp:
(KJS::skipSpacesAndComments): Take a pointer, and advance it past spaces,
and also past anything enclosed in parentheses.
(KJS::KRFCDate_parseDate): Use skipSpacesAndComments wherever we formerly had
code to skip spaces.
2005-10-08 Justin Haygood <justin@xiondigital.net>
Reviewed, tweaked, and landed by Darin.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5189
pcre_exec.c fails to compile using MSVC
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5190
KJS config.h adjustment for Win32
* kjs/config.h: Make sure HAVE_MMAP and HAVE_SBRK are off for Win32.
Turn HAVE_ERRNO_H on for Mac OS X. Sort defines so they are easy to compare
with each other. Remove #undef of DEBUG_COLLECTOR.
* pcre/pcre_exec.c: (match): Work around strange MSVC complaint by splitting
the definition of a local variable into a separate declaration and
initialization.
2005-10-05 Geoffrey Garen <ggaren@apple.com>
- Darin and I rewrote our implementation of the SimpleNumber class
to store number bit patterns in their floating point formats.
My tweaks reviewed by Darin.
~1% speedup on JS iBench.
* kjs/internal.h: removed obsolete jsNumber declarations.
* kjs/math_object.cpp:
(MathFuncImp::callAsFunction): changed KJS::isNaN to isNaN
* kjs/nodes.cpp:
(PostfixResolveNode::evaluate): removed obsolete knownToBeInteger
(PostfixBracketNode::evaluate): ditto
(PostfixDotNode::evaluate): ditto
(PrefixResolveNode::evaluate): ditto
(PrefixBracketNode::evaluate): ditto
(PrefixDotNode::evaluate): ditto
(NegateNode::evaluate): ditto
(valueForReadModifyAssignment): ditto
* kjs/number_object.cpp: removed obsolete comment
* kjs/operations.cpp:
(KJS::equal): removed unnecessary isNaN checks
(KJS::strictEqual): ditto
(KJS::add): removed obsolete knownToBeInteger
(KJS::mult): ditto
* kjs/operations.h: removed include of "value.h" to prevent circular reference
* kjs/simple_number.h: removed unnecessary #includes
(KJS::SimpleNumber::make): see above
(KJS::SimpleNumber::is): ditto
(KJS::SimpleNumber::value): ditto
* kjs/string_object.cpp:
(StringProtoFuncImp::callAsFunction): changed KJS::isNaN to isNaN
* kjs/ustring.cpp: removed unnecessary isNaN check
(KJS::UString::toUInt32): ditto
* kjs/value.cpp:
(KJS::jsNumber): removed obsolete jsNumber definitions
(KJS::ConstantValues::init): NaN is no longer a ConstantValue
(KJS::ConstantValues::clear): ditto
(KJS::ConstantValues::mark): ditto
* kjs/value.h: removed obsolete knownToBeInteger
(KJS::jsNaN): now returns a SimpleNumber
(KJS::ValueImp::getUInt32): changed to account for NaN being a SimpleNumber
(KJS::ValueImp::toBoolean): ditto
(KJS::ValueImp::toString): changed to account for +/- 0.0
(KJS::jsZero): changed to reflect that SimpleNumber::make takes a double
(KJS::jsOne): ditto
(KJS::jsTwo): ditto
(KJS::Number): removed obsolete non-double constructor declarations
2005-10-05 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- fixed <rdar://problem/4260481> Remove Reference type from JavaScriptCore
Also fixed some bugs with for..in enumeration while I was at it. object
properties now come before prototype properties and duplicates
between object and prototype are listed only once.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/IdentifierSequencedSet.cpp: Added.
(KJS::IdentifierSequencedSet::IdentifierSequencedSet):
(KJS::IdentifierSequencedSet::deallocateVector):
(KJS::IdentifierSequencedSet::~IdentifierSequencedSet):
(KJS::IdentifierSequencedSet::insert):
* kjs/IdentifierSequencedSet.h: Added.
(KJS::IdentifierSequencedSetIterator::IdentifierSequencedSetIterator):
(KJS::IdentifierSequencedSetIterator::operator*):
(KJS::IdentifierSequencedSetIterator::operator->):
(KJS::IdentifierSequencedSetIterator::operator++):
(KJS::IdentifierSequencedSetIterator::operator==):
(KJS::IdentifierSequencedSetIterator::operator!=):
(KJS::IdentifierSequencedSet::begin):
(KJS::IdentifierSequencedSet::end):
(KJS::IdentifierSequencedSet::size):
* kjs/array_instance.h:
* kjs/array_object.cpp:
(ArrayInstanceImp::getPropertyNames):
(ArrayInstanceImp::setLength):
(ArrayInstanceImp::pushUndefinedObjectsToEnd):
* kjs/nodes.cpp:
(ForInNode::execute):
* kjs/nodes.h:
* kjs/object.cpp:
(KJS::ObjectImp::getPropertyNames):
* kjs/object.h:
* kjs/property_map.cpp:
(KJS::PropertyMap::getEnumerablePropertyNames):
(KJS::PropertyMap::getSparseArrayPropertyNames):
* kjs/property_map.h:
* kjs/protect.h:
* kjs/protected_reference.h: Removed.
* kjs/reference.cpp: Removed.
* kjs/reference.h: Removed.
* kjs/reference_list.cpp: Removed.
* kjs/reference_list.h: Removed.
* kjs/ustring.h:
(KJS::UString::impl):
* kxmlcore/HashSet.h:
2005-10-04 Eric Seidel <eseidel@apple.com>
Reviewed by mjs.
Code cleanup, which resulted in a small win on iBench.
* kjs/object.cpp:
(KJS::tryGetAndCallProperty): new static inline
(KJS::ObjectImp::defaultValue): code cleanup
2005-10-03 Maciej Stachowiak <mjs@apple.com>
Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
- more Linux build fixes
* kjs/operations.cpp:
* kxmlcore/FastMalloc.h:
* kxmlcore/TCSystemAlloc.cpp:
(TCMalloc_SystemAlloc):
2005-10-03 Maciej Stachowiak <mjs@apple.com>
Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
http://bugzilla.opendarwin.org/show_bug.cgi?id=5174
Add support for compiling on Linux (likely to help for other POSIX systems too)
* kjs/collector.cpp:
(KJS::Collector::markCurrentThreadConservatively):
(KJS::Collector::markOtherThreadConservatively):
* kjs/config.h:
* kjs/date_object.cpp:
(KJS::formatDate):
(KJS::formatDateUTCVariant):
(KJS::formatTime):
(KJS::timeZoneOffset):
(KJS::DateProtoFuncImp::callAsFunction):
(KJS::DateObjectImp::construct):
(KJS::DateObjectImp::callAsFunction):
(KJS::makeTime):
* kjs/identifier.cpp:
* kjs/internal.cpp:
(KJS::initializeInterpreterLock):
(KJS::lockInterpreter):
(KJS::unlockInterpreter):
(KJS::UndefinedImp::toPrimitive):
(KJS::UndefinedImp::toBoolean):
(KJS::UndefinedImp::toNumber):
(KJS::UndefinedImp::toString):
(KJS::NullImp::toPrimitive):
(KJS::NullImp::toBoolean):
(KJS::NullImp::toNumber):
(KJS::NullImp::toString):
(KJS::BooleanImp::toPrimitive):
(KJS::BooleanImp::toBoolean):
(KJS::BooleanImp::toNumber):
(KJS::BooleanImp::toString):
(KJS::StringImp::toPrimitive):
(KJS::StringImp::toBoolean):
(KJS::StringImp::toNumber):
(KJS::StringImp::toString):
* kjs/internal.h:
* kjs/protected_values.cpp:
2005-10-03 Maciej Stachowiak <mjs@apple.com>
- fix Development build after last checkin
* kxmlcore/FastMalloc.cpp:
(KXMLCore::fastMallocRegisterThread):
2005-10-02 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
<rdar://problem/4283967> REGRESSION: 3% regression on PLT from new FastMalloc
http://bugzilla.opendarwin.org/show_bug.cgi?id=5243
A number of optimizations to the new threadsafe malloc that make it actually as fast
as dlmalloc (I measured wrong before) and as memory-efficient as the system malloc.
- use fastMalloc for everything - it now gets applied to all new/delete allocations
via a private inline operator new that is now included into every file via config.h.
- tweaked some of the numeric parameters for size classes and amount of wasted memory
allowed per allocation - this saves on memory use and consequently improves speed.
- so long as the allocator is not being used on background threads, get the per-thread
cache from a global variable instead of from pthread_getspecific, since the latter is slow.
- inline more functions, and force the ones GCC refuses to inline with
attribute(always_inline), nearly all of these have one call site so inlining them has
to be a win.
- use some tricks to calculate allocation size more efficiently and fewer times for small
allocations, to avoid hitting the huge size table array.
- avoid hitting the per-thread cache on code paths that don't need it.
- implement inline assembly version of spinlock for PowerPC (was already done for x86)
* bindings/NP_jsobject.cpp:
* bindings/c/c_class.cpp:
* bindings/c/c_instance.cpp:
* bindings/c/c_runtime.cpp:
* bindings/c/c_utility.cpp:
* bindings/jni/jni_class.cpp:
* bindings/jni/jni_instance.cpp:
* bindings/jni/jni_jsobject.cpp:
* bindings/jni/jni_objc.mm:
* bindings/jni/jni_runtime.cpp:
* bindings/jni/jni_utility.cpp:
* bindings/npruntime.cpp:
* bindings/objc/WebScriptObject.mm:
* bindings/objc/objc_class.mm:
* bindings/objc/objc_instance.mm:
* bindings/objc/objc_runtime.mm:
* bindings/objc/objc_utility.mm:
* bindings/runtime.cpp:
* bindings/runtime_array.cpp:
* bindings/runtime_method.cpp:
* bindings/runtime_object.cpp:
* bindings/runtime_root.cpp:
* bindings/testbindings.cpp:
* bindings/testbindings.mm:
* kjs/array_object.cpp:
(ArrayInstanceImp::ArrayInstanceImp):
(ArrayInstanceImp::~ArrayInstanceImp):
(ArrayInstanceImp::resizeStorage):
* kjs/bool_object.cpp:
* kjs/collector.cpp:
(KJS::Collector::registerThread):
* kjs/config.h:
* kjs/debugger.cpp:
* kjs/error_object.cpp:
* kjs/function.cpp:
* kjs/function_object.cpp:
* kjs/identifier.cpp:
(KJS::Identifier::rehash):
* kjs/internal.cpp:
(KJS::Parser::saveNewNode):
(KJS::clearNewNodes):
* kjs/interpreter.cpp:
* kjs/lexer.cpp:
(Lexer::doneParsing):
(Lexer::makeIdentifier):
(Lexer::makeUString):
* kjs/list.cpp:
* kjs/math_object.cpp:
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
* kjs/number_object.cpp:
(integer_part_noexp):
(char_sequence):
* kjs/object.cpp:
* kjs/object_object.cpp:
* kjs/property_map.cpp:
* kjs/property_slot.cpp:
* kjs/protected_values.cpp:
(KJS::ProtectedValues::rehash):
* kjs/reference.cpp:
* kjs/reference_list.cpp:
* kjs/regexp.cpp:
* kjs/regexp_object.cpp:
* kjs/scope_chain.cpp:
* kjs/scope_chain.h:
* kjs/string_object.cpp:
* kjs/testkjs.cpp:
* kjs/ustring.h:
* kjs/value.cpp:
* kxmlcore/Assertions.mm:
* kxmlcore/FastMalloc.cpp:
(KXMLCore::InitSizeClasses):
(KXMLCore::DLL_IsEmpty):
(KXMLCore::DLL_Prepend):
(KXMLCore::TCMalloc_Central_FreeList::Insert):
(KXMLCore::TCMalloc_Central_FreeList::Remove):
(KXMLCore::TCMalloc_Central_FreeList::Populate):
(KXMLCore::TCMalloc_ThreadCache::Allocate):
(KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
(KXMLCore::fastMallocRegisterThread):
(KXMLCore::TCMalloc_ThreadCache::GetCache):
(KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
(KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
(KXMLCore::do_malloc):
(KXMLCore::do_free):
(KXMLCore::realloc):
* kxmlcore/FastMalloc.h:
(operator new):
(operator delete):
(operator new[]):
(operator delete[]):
* kxmlcore/HashTable.cpp:
* kxmlcore/TCSpinLock.h:
(TCMalloc_SpinLock::Lock):
(TCMalloc_SpinLock::Unlock):
(TCMalloc_SlowLock):
* kxmlcore/TCSystemAlloc.cpp:
2005-09-30 Geoffrey Garen <ggaren@apple.com>
- Second cut at fixing <rdar://problem/4275206> Denver Regression: Seed:
Past Editions of Opinions display "NAN/Undefined" for www.washingtonpost.com
Reviewed by john.
* kjs/date_object.cpp:
(KJS::KRFCDate_parseDate): Intead of creating a timezone when one isn't specified,
just rely on the fallback logic, which will do it for you. Also, return invalidDate
if the date includes trailing garbage. (Somewhat accidentally, the timezone logic
used to catch trailing garbage.)
Added test case to fast/js/date-parse-test.html.
2005-09-29 Eric Seidel <eseidel@apple.com>
Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by darin.
Fix JSC memory smasher in TOT.
http://bugzilla.opendarwin.org/show_bug.cgi?id=5176
* pcre/pcre_exec.c:
(match):
2005-09-29 Eric Seidel <eseidel@apple.com>
Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by mjs.
* JavaScriptCore.xcodeproj/project.pbxproj:
Build fix for JSC+SVG after 5161.
http://bugzilla.opendarwin.org/show_bug.cgi?id=5179
2005-09-28 Geoffrey Garen <ggaren@apple.com>
- Fixed <rdar://problem/4275206> Denver Regression: Seed: Past Editions of Opinions display
"NAN/Undefined" for www.washingtonpost.com
Reviewed by darin.
* kjs/date_object.cpp:
(KJS::KRFCDate_parseDate): If the timezone isn't specified, rather than returning
invalidDate, substitute the local timezone. This matches the behavior of FF/IE.
2005-09-28 Maciej Stachowiak <mjs@apple.com>
Patch from George Staikos, reviewed by me.
- fixed some compile issues on Linux
* kjs/property_slot.h:
* kjs/simple_number.h:
2005-09-27 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- move HashMap/HashSet code down to JavaScriptCore
http://bugzilla.opendarwin.org/show_bug.cgi?id=5161
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/internal.cpp:
(KJS::interpreterMap): Function that fetches the interpreter map on demand.
(KJS::InterpreterImp::InterpreterImp): Replace use of InterpreterMap
class with an appropriate HashMap.
(KJS::InterpreterImp::clear): ditto
(KJS::InterpreterImp::interpreterWithGlobalObject): ditto
* kjs/interpreter_map.cpp: Removed.
* kjs/interpreter_map.h: Removed.
The HashMap/HashSet code (copied and slightly tweaked from WebCore)
* kxmlcore/HashFunctions.h: Added.
(KXMLCore::4):
(KXMLCore::8):
(KXMLCore::):
(KXMLCore::PointerHash::hash):
(KXMLCore::PointerHash::equal):
* kxmlcore/HashMap.h: Added.
(KXMLCore::extractFirst):
(KXMLCore::HashMap::HashMap):
(KXMLCore::::size):
(KXMLCore::::capacity):
(KXMLCore::::isEmpty):
(KXMLCore::::begin):
(KXMLCore::::end):
(KXMLCore::::find):
(KXMLCore::::contains):
(KXMLCore::::set):
(KXMLCore::::get):
(KXMLCore::::remove):
(KXMLCore::::clear):
(KXMLCore::deleteAllValues):
* kxmlcore/HashMapPtrSpec.h: Added.
(KXMLCore::PointerHashIteratorAdapter::PointerHashIteratorAdapter):
(KXMLCore::PointerHashIteratorAdapter::operator*):
(KXMLCore::PointerHashIteratorAdapter::operator->):
(KXMLCore::PointerHashIteratorAdapter::operator++):
(KXMLCore::PointerHashIteratorAdapter::operator==):
(KXMLCore::PointerHashIteratorAdapter::operator!=):
(KXMLCore::PointerHashConstIteratorAdapter::PointerHashConstIteratorAdapter):
(KXMLCore::PointerHashConstIteratorAdapter::operator*):
(KXMLCore::PointerHashConstIteratorAdapter::operator->):
(KXMLCore::PointerHashConstIteratorAdapter::operator++):
(KXMLCore::PointerHashConstIteratorAdapter::operator==):
(KXMLCore::PointerHashConstIteratorAdapter::operator!=):
(KXMLCore::):
* kxmlcore/HashSet.h: Added.
(KXMLCore::identityExtract):
(KXMLCore::convertAdapter):
(KXMLCore::HashSet::HashSet):
(KXMLCore::::size):
(KXMLCore::::capacity):
(KXMLCore::::isEmpty):
(KXMLCore::::begin):
(KXMLCore::::end):
(KXMLCore::::find):
(KXMLCore::::contains):
(KXMLCore::::insert):
(KXMLCore::::remove):
(KXMLCore::::clear):
* kxmlcore/HashTable.cpp: Added.
(KXMLCore::HashTableStats::~HashTableStats):
(KXMLCore::HashTableStats::recordCollisionAtCount):
* kxmlcore/HashTable.h: Added.
(KXMLCore::HashTableIterator::skipEmptyBuckets):
(KXMLCore::HashTableIterator::HashTableIterator):
(KXMLCore::HashTableIterator::operator*):
(KXMLCore::HashTableIterator::operator->):
(KXMLCore::HashTableIterator::operator++):
(KXMLCore::HashTableIterator::operator==):
(KXMLCore::HashTableIterator::operator!=):
(KXMLCore::HashTableConstIterator::HashTableConstIterator):
(KXMLCore::HashTableConstIterator::operator*):
(KXMLCore::HashTableConstIterator::operator->):
(KXMLCore::HashTableConstIterator::skipEmptyBuckets):
(KXMLCore::HashTableConstIterator::operator++):
(KXMLCore::HashTableConstIterator::operator==):
(KXMLCore::HashTableConstIterator::operator!=):
(KXMLCore::HashTable::HashTable):
(KXMLCore::HashTable::~HashTable):
(KXMLCore::HashTable::begin):
(KXMLCore::HashTable::end):
(KXMLCore::HashTable::size):
(KXMLCore::HashTable::capacity):
(KXMLCore::HashTable::insert):
(KXMLCore::HashTable::isEmptyBucket):
(KXMLCore::HashTable::isDeletedBucket):
(KXMLCore::HashTable::isEmptyOrDeletedBucket):
(KXMLCore::HashTable::hash):
(KXMLCore::HashTable::equal):
(KXMLCore::HashTable::identityConvert):
(KXMLCore::HashTable::extractKey):
(KXMLCore::HashTable::lookup):
(KXMLCore::HashTable::shouldExpand):
(KXMLCore::HashTable::mustRehashInPlace):
(KXMLCore::HashTable::shouldShrink):
(KXMLCore::HashTable::shrink):
(KXMLCore::HashTable::clearBucket):
(KXMLCore::HashTable::deleteBucket):
(KXMLCore::HashTable::makeLookupResult):
(KXMLCore::HashTable::makeIterator):
(KXMLCore::HashTable::makeConstIterator):
(KXMLCore::::lookup):
(KXMLCore::::insert):
(KXMLCore::::reinsert):
(KXMLCore::::find):
(KXMLCore::::contains):
(KXMLCore::::remove):
(KXMLCore::::allocateTable):
(KXMLCore::::expand):
(KXMLCore::::rehash):
(KXMLCore::::clear):
(KXMLCore::::HashTable):
(KXMLCore::::swap):
(KXMLCore::::operator):
(KXMLCore::::checkTableConsistency):
(KXMLCore::::checkTableConsistencyExceptSize):
* kxmlcore/HashTraits.h: Added.
(KXMLCore::HashTraits::emptyValue):
(KXMLCore::):
(KXMLCore::PairHashTraits::emptyValue):
(KXMLCore::PairHashTraits::deletedValue):
2005-09-27 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- update grammar to fix conflicts; fixes one of our test cases
because it resolves the relationship between function expressions
and declarations in the way required by the ECMA specification
* kjs/grammar.y: Added lots of new grammar rules so we have no conflicts.
A new set of rules for "no bracket or function at start of expression" and
another set of rules for "no in anywhere in expression". Also simplified the
handling of try to use only a single node and used operator precedence to
get rid of the conflict in handling of if and else. Also used a macro to
streamline the handling of automatic semicolons and changed parenthesis
handling to use a virtual function.
* kjs/nodes.h: Added nodeInsideAllParens, removed unused abortStatement.
(KJS::TryNode::TryNode): Updated to hold catch and finally blocks directly instead
of using a special node for each.
* kjs/nodes.cpp:
(Node::createErrorCompletion): Added. Used instead of throwError when creating errors
that should not be in a completion rather than an ExecState.
(Node::throwUndefinedVariableError): Added. Sets source location unlike the call it
replaces.
(Node::nodeInsideAllParens): Added.
(GroupNode::nodeInsideAllParens): Added.
(StatListNode::execute): Removed code to move exceptions into completion objects;
that's now done solely by the KJS_CHECKEXCEPTION macro.
(TryNode::execute): Include execution of catch and finally here rather than using
separate nodes.
(FuncDeclNode::execute): Moved here, no longer inline.
* kjs/nodes2string.cpp:
(TryNode::streamTo): Updated for change.
(FuncDeclNode::streamTo): Ditto.
(FuncExprNode::streamTo): Ditto.
* kjs/kjs-test: Removed. Was part of "make check".
* kjs/kjs-test.chk: Ditto.
* kjs/test.js: Ditto.
* tests/mozilla/expected.html: Updated because one more test succeeds.
2005-09-27 Adele Peterson <adele@apple.com>
Reviewed by Maciej.
Changed ints to size_t where appropriate.
* kjs/collector.cpp:
(KJS::Collector::allocate):
(KJS::Collector::markStackObjectsConservatively):
(KJS::Collector::collect):
(KJS::Collector::size):
(KJS::Collector::numInterpreters):
(KJS::Collector::numGCNotAllowedObjects):
(KJS::Collector::numReferencedObjects):
* kjs/collector.h:
2005-09-27 Eric Seidel <eseidel@apple.com>
Reviewed by kevin.
* JavaScriptCore.xcodeproj/project.pbxproj: fix after malloc changes.
2005-09-27 Eric Seidel <eseidel@apple.com>
Reviewed by mjs.
* kjs/nodes.cpp:
(FuncExprNode::evaluate): Now sets .constructor properly.
Test cases added to WebCore/layout-tests.
http://bugzilla.opendarwin.org/show_bug.cgi?id=3537
2005-09-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
- replace dlmalloc with tcmalloc
http://bugzilla.opendarwin.org/show_bug.cgi?id=5145
I also moved SharedPtr and the assertion code from WebCore into a
new kxmlcore directory.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/collector.cpp:
(KJS::Collector::allocate):
(KJS::Collector::collect):
* kjs/config.h:
* kjs/fast_malloc.cpp: Removed.
* kjs/fast_malloc.h: Removed.
* kjs/function.cpp:
* kjs/function.h:
* kjs/function_object.cpp:
* kjs/identifier.cpp:
(KJS::Identifier::add):
* kjs/internal.cpp:
* kjs/internal.h:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
* kjs/property_map.cpp:
(KJS::PropertyMap::~PropertyMap):
(KJS::PropertyMap::rehash):
* kjs/scope_chain.h:
* kjs/shared_ptr.h: Removed.
* kjs/string_object.cpp:
(StringObjectFuncImp::callAsFunction):
* kjs/ustring.cpp:
(KJS::UString::Rep::createCopying):
(KJS::UString::Rep::destroy):
(KJS::UString::expandCapacity):
(KJS::UString::expandPreCapacity):
(KJS::UString::UString):
(KJS::UString::spliceSubstringsWithSeparators):
(KJS::UString::append):
(KJS::UString::operator=):
(KJS::UString::detach):
* kjs/ustring.h:
* kxmlcore/Assertions.h: Added.
* kxmlcore/Assertions.mm: Added.
* kxmlcore/FastMalloc.cpp: Added.
(KXMLCore::LgFloor):
(KXMLCore::SizeClass):
(KXMLCore::ByteSizeForClass):
(KXMLCore::InitSizeClasses):
(KXMLCore::MetaDataAlloc):
(KXMLCore::PageHeapAllocator::Init):
(KXMLCore::PageHeapAllocator::New):
(KXMLCore::PageHeapAllocator::Delete):
(KXMLCore::PageHeapAllocator::inuse):
(KXMLCore::pages):
(KXMLCore::AllocationSize):
(KXMLCore::Event):
(KXMLCore::NewSpan):
(KXMLCore::DeleteSpan):
(KXMLCore::DLL_Init):
(KXMLCore::DLL_Remove):
(KXMLCore::DLL_IsEmpty):
(KXMLCore::DLL_Length):
(KXMLCore::DLL_Print):
(KXMLCore::DLL_Prepend):
(KXMLCore::DLL_InsertOrdered):
(KXMLCore::):
(KXMLCore::TCMalloc_PageHeap::GetDescriptor):
(KXMLCore::TCMalloc_PageHeap::SystemBytes):
(KXMLCore::TCMalloc_PageHeap::FreeBytes):
(KXMLCore::TCMalloc_PageHeap::RecordSpan):
(KXMLCore::TCMalloc_PageHeap::TCMalloc_PageHeap):
(KXMLCore::TCMalloc_PageHeap::New):
(KXMLCore::TCMalloc_PageHeap::Split):
(KXMLCore::TCMalloc_PageHeap::Carve):
(KXMLCore::TCMalloc_PageHeap::Delete):
(KXMLCore::TCMalloc_PageHeap::RegisterSizeClass):
(KXMLCore::TCMalloc_PageHeap::Dump):
(KXMLCore::TCMalloc_PageHeap::GrowHeap):
(KXMLCore::TCMalloc_PageHeap::Check):
(KXMLCore::TCMalloc_PageHeap::CheckList):
(KXMLCore::TCMalloc_ThreadCache_FreeList::Init):
(KXMLCore::TCMalloc_ThreadCache_FreeList::length):
(KXMLCore::TCMalloc_ThreadCache_FreeList::empty):
(KXMLCore::TCMalloc_ThreadCache_FreeList::lowwatermark):
(KXMLCore::TCMalloc_ThreadCache_FreeList::clear_lowwatermark):
(KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
(KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
(KXMLCore::TCMalloc_ThreadCache::freelist_length):
(KXMLCore::TCMalloc_ThreadCache::Size):
(KXMLCore::TCMalloc_Central_FreeList::length):
(KXMLCore::TCMalloc_Central_FreeList::Init):
(KXMLCore::TCMalloc_Central_FreeList::Insert):
(KXMLCore::TCMalloc_Central_FreeList::Remove):
(KXMLCore::TCMalloc_Central_FreeList::Populate):
(KXMLCore::TCMalloc_ThreadCache::SampleAllocation):
(KXMLCore::TCMalloc_ThreadCache::Init):
(KXMLCore::TCMalloc_ThreadCache::Cleanup):
(KXMLCore::TCMalloc_ThreadCache::Allocate):
(KXMLCore::TCMalloc_ThreadCache::Deallocate):
(KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
(KXMLCore::TCMalloc_ThreadCache::ReleaseToCentralCache):
(KXMLCore::TCMalloc_ThreadCache::Scavenge):
(KXMLCore::TCMalloc_ThreadCache::GetCache):
(KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
(KXMLCore::TCMalloc_ThreadCache::PickNextSample):
(KXMLCore::TCMalloc_ThreadCache::InitModule):
(KXMLCore::TCMalloc_ThreadCache::InitTSD):
(KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
(KXMLCore::TCMalloc_ThreadCache::DeleteCache):
(KXMLCore::TCMalloc_ThreadCache::RecomputeThreadCacheSize):
(KXMLCore::TCMalloc_ThreadCache::Print):
(KXMLCore::ExtractStats):
(KXMLCore::DumpStats):
(KXMLCore::PrintStats):
(KXMLCore::DumpStackTraces):
(KXMLCore::TCMallocImplementation::GetStats):
(KXMLCore::TCMallocImplementation::ReadStackTraces):
(KXMLCore::TCMallocImplementation::GetNumericProperty):
(KXMLCore::TCMallocImplementation::SetNumericProperty):
(KXMLCore::DoSampledAllocation):
(KXMLCore::do_malloc):
(KXMLCore::do_free):
(KXMLCore::do_memalign):
(KXMLCore::TCMallocGuard::TCMallocGuard):
(KXMLCore::TCMallocGuard::~TCMallocGuard):
(KXMLCore::malloc):
(KXMLCore::free):
(KXMLCore::calloc):
(KXMLCore::cfree):
(KXMLCore::realloc):
(KXMLCore::memalign):
(KXMLCore::posix_memalign):
(KXMLCore::valloc):
(KXMLCore::pvalloc):
(KXMLCore::malloc_stats):
(KXMLCore::mallopt):
(KXMLCore::mallinfo):
* kxmlcore/FastMalloc.h: Added.
(KXMLCore::FastAllocated::operator new):
(KXMLCore::FastAllocated::operator delete):
(KXMLCore::FastAllocated::operator new[]):
(KXMLCore::FastAllocated::operator delete[]):
* kxmlcore/SharedPtr.h: Added.
(KXMLCore::SharedPtr::SharedPtr):
(KXMLCore::SharedPtr::~SharedPtr):
(KXMLCore::SharedPtr::isNull):
(KXMLCore::SharedPtr::notNull):
(KXMLCore::SharedPtr::reset):
(KXMLCore::SharedPtr::get):
(KXMLCore::SharedPtr::operator*):
(KXMLCore::SharedPtr::operator->):
(KXMLCore::SharedPtr::operator!):
(KXMLCore::SharedPtr::operator bool):
(KXMLCore::::operator):
(KXMLCore::operator==):
(KXMLCore::operator!=):
(KXMLCore::static_pointer_cast):
(KXMLCore::const_pointer_cast):
* kxmlcore/TCPageMap.h: Added.
(TCMalloc_PageMap1::TCMalloc_PageMap1):
(TCMalloc_PageMap1::Ensure):
(TCMalloc_PageMap1::get):
(TCMalloc_PageMap1::set):
(TCMalloc_PageMap2::TCMalloc_PageMap2):
(TCMalloc_PageMap2::get):
(TCMalloc_PageMap2::set):
(TCMalloc_PageMap2::Ensure):
(TCMalloc_PageMap3::NewNode):
(TCMalloc_PageMap3::TCMalloc_PageMap3):
(TCMalloc_PageMap3::get):
(TCMalloc_PageMap3::set):
(TCMalloc_PageMap3::Ensure):
* kxmlcore/TCSpinLock.h: Added.
(TCMalloc_SpinLock::Init):
(TCMalloc_SpinLock::Finalize):
(TCMalloc_SpinLock::Lock):
(TCMalloc_SpinLock::Unlock):
(TCMalloc_SlowLock):
(TCMalloc_SpinLockHolder::TCMalloc_SpinLockHolder):
(TCMalloc_SpinLockHolder::~TCMalloc_SpinLockHolder):
* kxmlcore/TCSystemAlloc.cpp: Added.
(TrySbrk):
(TryMmap):
(TryDevMem):
(TCMalloc_SystemAlloc):
* kxmlcore/TCSystemAlloc.h: Added.
2005-09-23 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
<rdar://problem/4260479> Finish deploying PropertySlot in the interpreter
http://bugzilla.opendarwin.org/show_bug.cgi?id=5112
Convert postfix, prefix, delete, prefix, and for..in expressions to use
PropertySlot-based lookup instead of evaluateReference.
3% speedup on JS iBench.
Fixed two of the JS tests:
* tests/mozilla/expected.html:
* kjs/grammar.y:
* kjs/nodes.cpp:
(PostfixResolveNode::evaluate):
(PostfixBracketNode::evaluate):
(PostfixDotNode::evaluate):
(DeleteResolveNode::evaluate):
(DeleteBracketNode::evaluate):
(DeleteDotNode::evaluate):
(DeleteValueNode::evaluate):
(typeStringForValue):
(TypeOfResolveNode::evaluate):
(TypeOfValueNode::evaluate):
(PrefixResolveNode::evaluate):
(PrefixBracketNode::evaluate):
(PrefixDotNode::evaluate):
(ForInNode::execute):
* kjs/nodes.h:
(KJS::PostfixResolveNode::PostfixResolveNode):
(KJS::PostfixBracketNode::PostfixBracketNode):
(KJS::PostfixDotNode::PostfixDotNode):
(KJS::DeleteResolveNode::DeleteResolveNode):
(KJS::DeleteBracketNode::DeleteBracketNode):
(KJS::DeleteDotNode::DeleteDotNode):
(KJS::DeleteValueNode::DeleteValueNode):
(KJS::TypeOfResolveNode::TypeOfResolveNode):
(KJS::TypeOfValueNode::TypeOfValueNode):
(KJS::PrefixResolveNode::PrefixResolveNode):
(KJS::PrefixBracketNode::PrefixBracketNode):
(KJS::PrefixDotNode::PrefixDotNode):
* kjs/nodes2string.cpp:
(PostfixResolveNode::streamTo):
(PostfixBracketNode::streamTo):
(PostfixDotNode::streamTo):
(DeleteResolveNode::streamTo):
(DeleteBracketNode::streamTo):
(DeleteDotNode::streamTo):
(DeleteValueNode::streamTo):
(TypeOfValueNode::streamTo):
(TypeOfResolveNode::streamTo):
(PrefixResolveNode::streamTo):
(PrefixBracketNode::streamTo):
(PrefixDotNode::streamTo):
* kjs/reference.cpp:
(KJS::Reference::Reference):
(KJS::Reference::getPropertyName):
(KJS::Reference::getValue):
(KJS::Reference::deleteValue):
* kjs/reference.h:
2005-09-23 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
Reviewed and landed by Darin.
- a Windows-specific file
* os-win32/stdint.h: Added. We plan to remove dependency on the <stdint.h> types,
and if we do so, we will remove this file.
2005-09-22 Geoffrey Garen <ggaren@apple.com>
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5053
Need to restore int/long changes to simple_number.h
Reviewed by darin and mjs.
* kjs/simple_number.h: changed enums to indenpendent constants to clarify types
(KJS::isNegativeZero): changed to static function - no reason to export
(KJS::SimpleNumber::rightShiftSignExtended): new function for clarity
(KJS::SimpleNumber::make): specified cast as reinterpret_cast
(KJS::SimpleNumber::is): changed to use uintptr_t for portability
(KJS::SimpleNumber::value): changed to use uintptr_t and rightShiftSignExtended
(KJS::SimpleNumber::fits): inverted tests - probably only a performance win for double
(KJS::SimpleNumber::integerFits): ditto
2005-09-20 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff and partly by Darin.
- fixed http://bugzilla.opendarwin.org/post_bug.cgi
(Reduce conflicts in JavaScriptCore grammar)
This change gets us down from over 200 shift/reduce and 45 reduce/reduce to
9 shift/reduce and 45 reduce/reduce.
* kjs/grammar.y:
* kjs/grammar_types.h: Removed.
* kjs/lexer.cpp:
* kjs/nodes.h:
(KJS::Node::isGroupNode):
(KJS::Node::isLocation):
(KJS::Node::isResolveNode):
(KJS::Node::isBracketAccessorNode):
(KJS::Node::isDotAccessorNode):
(KJS::ResolveNode::isLocation):
(KJS::ResolveNode::isResolveNode):
(KJS::ResolveNode::identifier):
(KJS::GroupNode::isGroupNode):
(KJS::GroupNode::leafNode):
(KJS::BracketAccessorNode::isLocation):
(KJS::BracketAccessorNode::isBracketAccessorNode):
(KJS::BracketAccessorNode::base):
(KJS::BracketAccessorNode::subscript):
(KJS::DotAccessorNode::isLocation):
(KJS::DotAccessorNode::isDotAccessorNode):
(KJS::DotAccessorNode::base):
(KJS::DotAccessorNode::identifier):
(KJS::FuncExprNode::FuncExprNode):
(KJS::FuncExprNode::identifier):
(KJS::FuncDeclNode::FuncDeclNode):
(KJS::FuncDeclNode::execute):
2005-09-20 Geoffrey Garen <ggaren@apple.com>
- Oops. The 4263434 change was only appropriate on the branch. Rolling out.
Reviewed by eric.
* kjs/internal.cpp:
(KJS::InterpreterImp::mark):
2005-09-20 Geoffrey Garen <ggaren@apple.com>
- More changes needed to fix <rdar://problem/4214783> 8F29 REGRESSION(Denver/Chardonnay):
kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in
the installer)
Added InterpreterLocks in some places in the bindings we missed before.
Reviewed by john.
* bindings/runtime_root.cpp:
(KJS::Bindings::addNativeReference):
(KJS::Bindings::removeNativeReference):
(RootObject::removeAllNativeReferences):
* bindings/runtime_root.h:
(KJS::Bindings::RootObject::~RootObject):
(KJS::Bindings::RootObject::setRootObjectImp):
2005-09-20 Geoffrey Garen <ggaren@apple.com>
- Fixed <rdar://problem/4263434> <rdar://problem/4263434> Denver 8F29 Regression:
KJS::InterpreterImp::mark() crash
Fix by mjs, review by me.
* kjs/internal.cpp:
(KJS::InterpreterImp::mark): Added a null check on globExec in case a
garbage collection occurs inside InterpreterImp::globalInit (called
from InterpreterImp::InterpreterImp), at which point globExec has not yet been initialized.
2005-09-20 Geoffrey Garen <ggaren@apple.com>
- Rolled in fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4892
Date constructor has problems with months larger than 11
Test cases added:
* layout-tests/fast/js/date-big-constructor-expected.txt: Added.
* layout-tests/fast/js/date-big-constructor.html: Added.
Reviewed by darin.
* kjs/date_object.cpp:
(KJS::fillStructuresUsingDateArgs):
(KJS::makeTime):
2005-09-19 Geoffrey Garen <ggaren@apple.com>
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5028
9 layout tests fail following the change from long to int
- Rolled out changes to simple_number.h, and added fits(long long)
and SimpleNumber::fits(unsigned long long) to the old system.
Reviewed by mjs.
* kjs/simple_number.h:
(KJS::SimpleNumber::):
(KJS::SimpleNumber::value):
(KJS::SimpleNumber::fits):
(KJS::SimpleNumber::integerFits):
(KJS::SimpleNumber::make):
2005-09-14 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- fixed <rdar://problem/4214783> REGRESSION: kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in the installer)
Make sure to lock using the InterpreterLock class in all places that need it
(including anything that uses the collector, the parser, the protect count hash table,
and anything that allocates via fast_malloc).
Also added assertions to ensure that the locking rules are followed for the relevant
resources.
* Makefile.am:
* bindings/NP_jsobject.cpp:
(identifierFromNPIdentifier):
(_NPN_Invoke):
(_NPN_Evaluate):
(_NPN_GetProperty):
(_NPN_SetProperty):
(_NPN_RemoveProperty):
(_NPN_HasProperty):
(_NPN_HasMethod):
(_NPN_SetException):
* bindings/jni/jni_jsobject.cpp:
(JSObject::call):
(JSObject::eval):
(JSObject::getMember):
(JSObject::setMember):
(JSObject::removeMember):
(JSObject::getSlot):
(JSObject::setSlot):
(JSObject::toString):
(JSObject::convertJObjectToValue):
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(-[WebScriptObject evaluateWebScript:]):
(-[WebScriptObject setValue:forKey:]):
(-[WebScriptObject valueForKey:]):
(-[WebScriptObject removeWebScriptKey:]):
(-[WebScriptObject stringRepresentation]):
(-[WebScriptObject webScriptValueAtIndex:]):
(-[WebScriptObject setWebScriptValueAtIndex:value:]):
(+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
* bindings/runtime.cpp:
(Instance::createRuntimeObject):
* bindings/runtime_root.h:
* bindings/testbindings.cpp:
(main):
* bindings/testbindings.mm:
(main):
* kjs/fast_malloc.cpp:
(KJS::kjs_fast_malloc):
(KJS::kjs_fast_calloc):
(KJS::kjs_fast_free):
(KJS::kjs_fast_realloc):
* kjs/fast_malloc.h:
* kjs/identifier.h:
* kjs/internal.cpp:
(InterpreterImp::InterpreterImp):
(InterpreterImp::clear):
(InterpreterImp::mark):
(InterpreterImp::checkSyntax):
(InterpreterImp::evaluate):
* kjs/internal.h:
(KJS::InterpreterImp::globalObject):
* kjs/interpreter.cpp:
(Interpreter::evaluate):
* kjs/interpreter.h:
(KJS::InterpreterLock::InterpreterLock):
(KJS::InterpreterLock::~InterpreterLock):
* kjs/nodes.h:
* kjs/protect.h:
(KJS::ProtectedValue::ProtectedValue):
(KJS::ProtectedValue::~ProtectedValue):
(KJS::ProtectedValue::operator=):
(KJS::ProtectedObject::ProtectedObject):
(KJS::ProtectedObject::~ProtectedObject):
(KJS::ProtectedObject::operator=):
(KJS::ProtectedReference::ProtectedReference):
(KJS::ProtectedReference::~ProtectedReference):
(KJS::ProtectedReference::operator=):
* kjs/protected_object.h:
* kjs/protected_values.cpp:
(KJS::ProtectedValues::getProtectCount):
(KJS::ProtectedValues::increaseProtectCount):
(KJS::ProtectedValues::decreaseProtectCount):
* kjs/string_object.cpp:
(StringObjectImp::StringObjectImp):
* kjs/testkjs.cpp:
(main):
2005-09-16 Adele Peterson <adele@apple.com>
Change by Darin, reviewed by me and Maciej.
Fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=4547
use int instead of long for 32-bit (to prepare for LP64 compiling)
* bindings/c/c_class.h:
(KJS::Bindings::CClass::constructorAt):
(KJS::Bindings::CClass::numConstructors):
* bindings/c/c_runtime.h:
(KJS::Bindings::CMethod::numParameters):
* bindings/jni/jni_class.cpp:
(JavaClass::JavaClass):
* bindings/jni/jni_class.h:
(KJS::Bindings::JavaClass::constructorAt):
(KJS::Bindings::JavaClass::numConstructors):
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
* bindings/jni/jni_jsobject.cpp:
(JSObject::convertJObjectToValue):
(JSObject::listFromJArray):
* bindings/jni/jni_runtime.cpp:
(JavaMethod::JavaMethod):
* bindings/jni/jni_runtime.h:
(KJS::Bindings::JavaConstructor::_commonCopy):
(KJS::Bindings::JavaConstructor::parameterAt):
(KJS::Bindings::JavaConstructor::numParameters):
(KJS::Bindings::JavaMethod::_commonCopy):
(KJS::Bindings::JavaMethod::parameterAt):
(KJS::Bindings::JavaMethod::numParameters):
* bindings/npapi.h:
* bindings/objc/WebScriptObject.mm:
(listFromNSArray):
* bindings/objc/objc_class.h:
(KJS::Bindings::ObjcClass::constructorAt):
(KJS::Bindings::ObjcClass::numConstructors):
* bindings/objc/objc_instance.h:
* bindings/objc/objc_runtime.h:
* bindings/objc/objc_runtime.mm:
(ObjcMethod::numParameters):
* bindings/runtime.h:
* kjs/identifier.h:
* kjs/internal.h:
* kjs/property_slot.h:
(KJS::PropertySlot::setCustomIndex):
(KJS::PropertySlot::index):
(KJS::PropertySlot::):
* kjs/regexp_object.cpp:
(RegExpObjectImp::backrefGetter):
(RegExpObjectImp::getOwnPropertySlot):
* kjs/simple_number.h:
(KJS::SimpleNumber::):
(KJS::SimpleNumber::value):
(KJS::SimpleNumber::fits):
(KJS::SimpleNumber::integerFits):
(KJS::SimpleNumber::make):
* kjs/string_object.cpp:
(substituteBackreferences):
* kjs/ustring.cpp:
(KJS::UString::from):
(KJS::UString::toUInt32):
(KJS::UString::find):
(KJS::UString::rfind):
* kjs/ustring.h:
* kjs/value.cpp:
(KJS::jsNumber):
* kjs/value.h:
2005-09-11 Eric Seidel <eseidel@apple.com>
No review requested, build fix affects only SVG.
* JavaScriptCore.xcodeproj/project.pbxproj: Fixed JSC+SVG
Fixed JavaScriptCore+SVG after PCRE 6.1 merger.
http://bugzilla.opendarwin.org/show_bug.cgi?id=4932
2005-09-10 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
Reviewed and landed by Darin.
* Makefile.vc: Added.
* README-Win32.txt: Added.
2005-09-10 Darin Adler <darin@apple.com>
- fixed compilation for WebCore (another try)
* kjs/simple_number.h: Added more "using" lines.
2005-09-10 Darin Adler <darin@apple.com>
- fixed compilation for WebCore
* kjs/simple_number.h: Have to include <cmath> here to work around a bug in the GCC
standard C++ library headers.
2005-09-10 Darin Adler <darin@apple.com>
Windows changes by Krzysztof Kowalczyk <kkowalczyk@gmail.com>.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4870
win portability: fix IS_NEGATIVE_ZERO macro in simple_number.h
* kjs/simple_number.h:
(KJS::isNegativeZero): Added. Inline function. Has a case for Windows that
uses _fpclass and a case for other platforms that uses signbit.
(KJS::SimpleNumber::fits): Use inline isNegativeZero instead of macro IS_NEGATIVE_ZERO.
* kjs/internal.cpp: Remove definition of now-unneeded negZero global.
* kjs/value.cpp: Touched the file because Xcode didn't know it needed to
recompile it.
- improved test engine
* tests/mozilla/jsDriver.pl: Sort tests in numeric order instead of using
a plain-ASCII sort; now test 33 will be after test 5 in any given set of
numbered tests.
2005-09-08 Darin Adler <darin@apple.com>
- fixed overloaded versions of throwError so that they substitute *all*
expected parameters into the message string -- some versions used to
skip parameters, resulting in "%s" being printed in the error message.
Reviewed by Geoff.
* kjs/nodes.h: Updated declarations to use "const &" and not to name parameters
* kjs/nodes.cpp: (Node::throwError): Updated to match above and add one missing
call to substitute.
2005-09-08 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- updated to PCRE 6.1
The original PCRE 6.1 sources are checked into the tree with the tag
"pcre-6-1" for reference. What we're checking in right now is the original
plus our changes to make it support UTF-16 and at least one other tweak
(vertical tab considered whitespace). Our work to get our changes was
done on "pcre-6-1-branch", with an anchor at "pcre-6-1-anchor" so you can
see the evolution of the UTF-16 changes.
Note also that there was one small change made here that's not on the branch
in pcre_compile.c.
* Info.plist: Updated the part of the copyright message that's about PCRE.
* JavaScriptCore.xcodeproj/project.pbxproj: Added new PCRE source files,
removed obsolete ones.
* pcre/AUTHORS: Updated to PCRE 6.1. Includes credits for Apple's UTF-16
changes, but not the credits for Google's C++ wrapper, since we don't include that.
* pcre/COPYING: Updated to PCRE 6.1.
* pcre/LICENCE: Ditto.
* pcre/dftables.c: Ditto.
* pcre/pcre-config.h: Ditto.
* pcre/pcre.h: Ditto.
* pcre/pcre_compile.c: Added for PCRE 6.1.
* pcre/pcre_config.c: Ditto.
* pcre/pcre_exec.c: Ditto.
* pcre/pcre_fullinfo.c: Ditto.
* pcre/pcre_get.c: Ditto.
* pcre/pcre_globals.c: Ditto.
* pcre/pcre_info.c: Ditto.
* pcre/pcre_internal.h: Ditto.
* pcre/pcre_maketables.c: Ditto.
* pcre/pcre_ord2utf8.c: Ditto.
* pcre/pcre_printint.c: Ditto.
* pcre/pcre_refcount.c: Ditto.
* pcre/pcre_study.c: Ditto.
* pcre/pcre_tables.c: Ditto.
* pcre/pcre_try_flipped.c: Ditto.
* pcre/pcre_ucp_findchar.c: Ditto.
* pcre/pcre_version.c: Ditto.
* pcre/pcre_xclass.c: Ditto.
* pcre/ucp.h: Ditto.
* pcre/ucp_findchar.c: Ditto.
* pcre/ucpinternal.h: Ditto.
* pcre/ucptable.c: Ditto.
* pcre/get.c: Removed.
* pcre/internal.h: Removed.
* pcre/maketables.c: Removed.
* pcre/pcre.c: Removed.
* pcre/study.c: Removed.
2005-09-07 Geoffrey Garen <ggaren@apple.com>
-fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4781
Date.setMonth fails with big values due to overflow
Reviewed by darin.
* kjs/date_object.cpp:
(timetUsingCF): for consistency, changed return statement to invalidDate instead of LONG_MAX
(KJS::fillStructuresUsingTimeArgs): modified for readability
(KJS::fillStructuresUsingDateArgs): new function analogous to fillStructuresUsingTimeArgs
(KJS::DateProtoFuncImp::callAsFunction): modified to use fillStructuresUsingDateArgs
(KJS::DateObjectImp::construct): moved variable declaration to proper scope
(KJS::DateObjectFuncImp::callAsFunction): moved variable declaration to proper scope
2005-09-07 Geoffrey Garen <ggaren@apple.com>
-updated expected test results to reflect fix for
http://bugzilla.opendarwin.org/show_bug.cgi?id=4698
kjs does not allow named functions in function expressions
* tests/mozilla/expected.html:
2005-09-04 Darin Adler <darin@apple.com>
* kjs/identifier.cpp: Fix comment, add missing include.
(Follow-on to changes from yesterday.)
2005-09-03 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
Reviewed, tweaked and landed by Darin.
- another try at some of the Windows compilation fixes
should fix these bugs: 4546, 4831, 4834, 4643, 4830, 4832, 4833, 4835
* kjs/collector.cpp: Add missing <setjmp.h> include.
* kjs/date_object.cpp: Fix broken copysign macro.
* kjs/dtoa.cpp: Move macro definitions down after all header includes.
* kjs/fast_malloc.cpp: Add missing <assert.h> and <stddef.h> includes.
* kjs/function.cpp: Remove broken isxdigit definition.
* kjs/grammar.y: Add a missing semicolon (and remove an excess one).
* kjs/identifier.cpp: Turn off AVOID_STATIC_CONSTRUCTORS because the placement new syntax
doesn't seem to work in Visual C++ (I'm surprised to hear that, by the way).
* kjs/value.h: Made ValueImp's destructor virtual because otherwise pointers to ValueImp
on the stack aren't right for garbage collection on Windows (don't think it works that
way with gcc's virtual table scheme, but it's a harmless change).
2005-09-03 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
Reviewed, tweaked and landed by Darin.
- some Windows compilation fixes, hoping to fix the problems reported in these bugs:
4627, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4639, 4640, 4641, 4644, 4645
* kjs/collector.cpp: Include <windows.h> on WIN32. Put thread-related code inside
KJS_MULTIPLE_THREADS #if directives.
(KJS::Collector::markCurrentThreadConservatively): Use NT_TIB to find the stack base on Win32.
* kjs/config.h: Define HAVE_SYS_TIMEB_H for Win32.
* kjs/date_object.cpp: Add include of <limits.h>. Add definitions of strncasecmp, isfinite, and
copysign for Win32.
(KJS::KRFCDate_parseDate): Move "errno = 0" line down closer to the first call to strol -- I believe
that on Win32 there's some other call before that setting errno.
* kjs/date_object.h: Remove unneeded include of <sys/time.h>.
* kjs/dtoa.cpp: Add an undef of strtod, needed on Win32.
* kjs/fast_malloc.cpp: Put #if !WIN32 around some customization that's not appropriate on Win32.
(KJS::region_list_append): Add a missing cast so this Win32-specific function compiles in C++.
(KJS::sbrk): Change parameter type to match the declaration.
* kjs/function.cpp: (isxdigit): Define a locale-independent isxdigit on Win32.
* kjs/function.h: Remove unneeded friend class Function for FunctionImp.
* kjs/identifier.cpp: Took out the APPLE_CHANGES from around the AVOID_STATIC_CONSTRUCTORS
define. We ultimately intend to phase out APPLE_CHANGES entirely. Also fix the
non-AVOID_STATIC_CONSTRUCTORS code path.
* kjs/internal.cpp: Remove uneeded include of <strings.h>, which was confused with <string.h>!
Add a Win32 implementation of copysign. Put the threads code inside KJS_MULTIPLE_THREADS.
* kjs/internal.h: Define a KJS_MULTIPLE_THREADS macro on non-Win32 only. Later we can make this
specific to Mac OS X if we like.
* kjs/interpreter_map.cpp: Add missing include of <stdlib.h>.
* kjs/list.cpp:
(KJS::ListImp::markValues): Use std::min instead of MIN.
(KJS::List::copy): Ditto.
(KJS::List::copyTail): Ditto.
* kjs/math_object.cpp: (signbit): Add a Win32 implementation of signbit.
* kjs/nodes.cpp: (Node::finalCheck): Use unsigned instead of uint.
Put the use of always_inline inside __GNUC__.
* kjs/number_object.cpp: (NumberProtoFuncImp::callAsFunction): Use "10.0" instead of "10"
inside all the calls to pow to avoid ambiguity caused by overloading of pow on Win32, seen
when passing an int rather than a double or float.
* kjs/operations.cpp:
(KJS::isInf): Add Win32 implementation.
(KJS::isPosInf): Add Win32 implementation.
(KJS::isNegInf): Add Win32 implementation.
* kjs/regexp.cpp: Use unsigned instead of uint.
* kjs/regexp.h: Ditto.
* kjs/regexp_object.cpp: Ditto.
* kjs/regexp_object.h: Ditto.
2005-09-02 Beth Dakin <bdakin@apple.com>
Fix for <rdar://problem/4235531> Denver Regression: Safari crash in KWQStringData::makeUnicode
The other half of the fix is in WebCore.
Fix written by Maciej and Darin.
Reviewed by me/Maciej
As Maciej said in Radar: These problems was caused by a conflict between some of our custom
allocators, causing them to return null. Symptom is typically a null pointer dereference in
a place where it might be expected an allocation has just occurred.
* kjs/fast_malloc.cpp: Added #define for MORECORE_CONTIGUOUS, MORECORE_CANNOT_TRIM,
and MALLOC_FAILURE_ACTION.
2005-08-31 Geoffrey Garen <ggaren@apple.com>
-rolled in fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4698
kjs does not allow named functions in function expressions
Fix by Arthur Langereis.
Reviewed by darin.
* kjs/grammar.y:
* kjs/nodes.cpp:
(FuncExprNode::evaluate):
* kjs/nodes.h:
(KJS::FuncExprNode::FuncExprNode):
Test cases added:
* layout-tests/fast/js/named-function-expression-expected.txt: Added.
* layout-tests/fast/js/named-function-expression.html: Added.
2005-08-31 Justin Haygood <justin@xiondigital.net>
Reviewed, tweaked, and landed by Darin.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4085
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4087
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4096
Some fixes for compiling on windows.
* kjs/config.h: Added a WIN32 case in here, with suitable defines.
(To be tweaked as necessary.)
* kjs/function.cpp: Took out APPLE_CHANGES around use of ICU.
* kjs/operations.cpp: Removed some bogus code that always set HAVE_FLOAT_H.
2005-08-30 Darin Adler <darin@apple.com>
Reviewed by John Sullivan.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4758
unify SharedPtr in WebCore and JavaScriptCore
* kjs/shared_ptr.h: Updated namespace to KXMLCore instead of kxhmlcore.
Made a few small improvements to use local variables a bit more and added
an "operator int" to reduce the chance that we'll convert a SharedPtr to
an int by accident. Also made the == operators normal functions rather than
friend functions, added a couple of comemnts.
* kjs/function.h: Updated for namespace change.
* kjs/function.cpp: Ditto.
* kjs/function_object.cpp: Ditto.
* kjs/internal.h: Ditto.
* kjs/internal.cpp: Ditto.
* kjs/nodes.h: Ditto.
* kjs/nodes2string.cpp: Ditto.
2005-08-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
<rdar://problem/4224911> many many leaks in kjsyyparse with malformed Javascript
Record all nodes that are created during parsing, and delete any
that are left floating with a refcount of 0.
* kjs/internal.cpp:
(KJS::Parser::saveNewNode):
(KJS::clearNewNodes):
(KJS::Parser::parse):
* kjs/internal.h:
* kjs/nodes.cpp:
(Node::Node):
* kjs/nodes.h:
(KJS::Node::refcount):
2005-08-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
- fixed <rdar://problem/4232452> many many leaks in kjsyyparse on some well-formed JavaScript (can repro on sony.com, webkit tests)
Fixed by changing the refcounting scheme for nodes. Instead of each node implementing a custom ref and
deref for all its children (and being responsible for deleting them), nodes use a smart pointer to
hold their children, and smart pointers are used outside the node tree as well. This change mostly
removes code.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/function.cpp:
(KJS::DeclaredFunctionImp::DeclaredFunctionImp):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function.h:
* kjs/function_object.cpp:
(FunctionObjectImp::construct):
* kjs/grammar.y:
* kjs/internal.cpp:
(KJS::Parser::parse):
(KJS::Parser::accept):
(KJS::InterpreterImp::checkSyntax):
(KJS::InterpreterImp::evaluate):
* kjs/internal.h:
* kjs/nodes.cpp:
(Node::Node):
(Node::~Node):
(ElementNode::evaluate):
(PropertyValueNode::evaluate):
(ArgumentListNode::evaluateList):
(NewExprNode::evaluate):
(FunctionCallValueNode::evaluate):
(FunctionCallBracketNode::evaluate):
(FunctionCallDotNode::evaluate):
(RelationalNode::evaluate):
(StatListNode::execute):
(StatListNode::processVarDecls):
(VarDeclListNode::evaluate):
(VarDeclListNode::processVarDecls):
(ForInNode::ForInNode):
(ClauseListNode::processVarDecls):
(CaseBlockNode::evalBlock):
(FuncDeclNode::processFuncDecl):
(FuncExprNode::evaluate):
(SourceElementsNode::execute):
(SourceElementsNode::processFuncDecl):
(SourceElementsNode::processVarDecls):
* kjs/nodes.h:
(KJS::Node::ref):
(KJS::Node::deref):
(KJS::NumberNode::NumberNode):
(KJS::GroupNode::GroupNode):
(KJS::ElementNode::ElementNode):
(KJS::ArrayNode::ArrayNode):
(KJS::PropertyValueNode::PropertyValueNode):
(KJS::ObjectLiteralNode::ObjectLiteralNode):
(KJS::BracketAccessorNode::BracketAccessorNode):
(KJS::DotAccessorNode::DotAccessorNode):
(KJS::ArgumentListNode::ArgumentListNode):
(KJS::ArgumentsNode::ArgumentsNode):
(KJS::NewExprNode::NewExprNode):
(KJS::FunctionCallValueNode::FunctionCallValueNode):
(KJS::FunctionCallResolveNode::FunctionCallResolveNode):
(KJS::FunctionCallBracketNode::FunctionCallBracketNode):
(KJS::FunctionCallDotNode::FunctionCallDotNode):
(KJS::PostfixNode::PostfixNode):
(KJS::DeleteNode::DeleteNode):
(KJS::VoidNode::VoidNode):
(KJS::TypeOfNode::TypeOfNode):
(KJS::PrefixNode::PrefixNode):
(KJS::UnaryPlusNode::UnaryPlusNode):
(KJS::NegateNode::NegateNode):
(KJS::BitwiseNotNode::BitwiseNotNode):
(KJS::LogicalNotNode::LogicalNotNode):
(KJS::MultNode::MultNode):
(KJS::AddNode::AddNode):
(KJS::ShiftNode::ShiftNode):
(KJS::RelationalNode::RelationalNode):
(KJS::EqualNode::EqualNode):
(KJS::BitOperNode::BitOperNode):
(KJS::BinaryLogicalNode::BinaryLogicalNode):
(KJS::ConditionalNode::ConditionalNode):
(KJS::AssignResolveNode::AssignResolveNode):
(KJS::AssignBracketNode::AssignBracketNode):
(KJS::AssignDotNode::AssignDotNode):
(KJS::CommaNode::CommaNode):
(KJS::AssignExprNode::AssignExprNode):
(KJS::VarDeclListNode::VarDeclListNode):
(KJS::VarStatementNode::VarStatementNode):
(KJS::ExprStatementNode::ExprStatementNode):
(KJS::IfNode::IfNode):
(KJS::DoWhileNode::DoWhileNode):
(KJS::WhileNode::WhileNode):
(KJS::ForNode::ForNode):
(KJS::ReturnNode::ReturnNode):
(KJS::WithNode::WithNode):
(KJS::CaseClauseNode::CaseClauseNode):
(KJS::ClauseListNode::ClauseListNode):
(KJS::ClauseListNode::clause):
(KJS::ClauseListNode::next):
(KJS::SwitchNode::SwitchNode):
(KJS::LabelNode::LabelNode):
(KJS::ThrowNode::ThrowNode):
(KJS::CatchNode::CatchNode):
(KJS::FinallyNode::FinallyNode):
(KJS::TryNode::TryNode):
(KJS::ParameterNode::ParameterNode):
(KJS::ParameterNode::nextParam):
(KJS::FuncDeclNode::FuncDeclNode):
(KJS::FuncExprNode::FuncExprNode):
* kjs/nodes2string.cpp:
(KJS::SourceStream::operator<<):
(ElementNode::streamTo):
(PropertyValueNode::streamTo):
(ArgumentListNode::streamTo):
(StatListNode::streamTo):
(VarDeclListNode::streamTo):
(CaseBlockNode::streamTo):
(ParameterNode::streamTo):
(SourceElementsNode::streamTo):
* kjs/shared_ptr.h: Added.
(kxmlcore::SharedPtr::SharedPtr):
(kxmlcore::SharedPtr::~SharedPtr):
(kxmlcore::SharedPtr::isNull):
(kxmlcore::SharedPtr::notNull):
(kxmlcore::SharedPtr::reset):
(kxmlcore::SharedPtr::get):
(kxmlcore::SharedPtr::operator*):
(kxmlcore::SharedPtr::operator->):
(kxmlcore::SharedPtr::operator!):
(kxmlcore::SharedPtr::operator bool):
(kxmlcore::SharedPtr::operator==):
(kxmlcore::::operator):
(kxmlcore::operator!=):
(kxmlcore::static_pointer_cast):
(kxmlcore::const_pointer_cast):
2005-08-26 Geoff Garen <ggaren@apple.com>
Reviewed by John.
Landed by Darin.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4664
TOT Crash from backwards null check in WebScriptObject.mm
* bindings/objc/WebScriptObject.mm:
(+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
Remove bogus !.
2005-08-25 Darin Adler <darin@apple.com>
Reviewed by John Sullivan.
- rename KJS::UString::string() to KJS::UString::domString()
- rename KJS::Identifier::string() to KJS::Identifier::domString()
* kjs/identifier.h: Renamed.
* kjs/ustring.h: Ditto.
2005-08-19 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4435
speed up JavaScript by tweaking the Identifier class
* kjs/identifier.h: Add a new global nullIdentifier and make Identifier::null a function
that returns it.
* kjs/identifier.cpp: (KJS::Identifier::init): Initialize a global for the null identifier
as well as all the other globals for special identifiers.
* kjs/ustring.h: (KJS::UString::UString): Make this empty constructor inline.
* kjs/ustring.cpp: Remove the old non-inline version.
2005-08-19 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by Maciej.
Revised and landed by Darin.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4474
REGRESSION: Crash when using in-place operator on uninitialized array element
* kjs/nodes.cpp:
(AssignResolveNode::evaluate): Remove unneeded "isSet" assertion.
(AssignBracketNode::evaluate): Replace code that tested "isSet" with code that
tests the return value of getPropertySlot.
* kjs/property_slot.h: Removed unneeded "isSet" function. Property slots are
either uninitialized or set. There's no "initialized and not set" state.
2005-08-18 Adele Peterson <adele@apple.com>
Checked "Inline Functions Hidden" box
* JavaScriptCore.xcodeproj/project.pbxproj:
2005-08-16 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fixed crash in one of the JavaScript tests (introduced by my throwError change)
* kjs/nodes.cpp: (Node::setExceptionDetailsIfNeeded): Check if the exception is an
object before setting the file and line number properties on it. Something to think
about in the future -- do we really want to do this on any object that's thrown?
How about limiting it to error objects that were created by the JavaScript engine?
- changed kjs_fast_malloc so we don't have two conflicting versions of the same function
* kjs/fast_malloc.h: Took out all the ifdefs from this header.
* kjs/fast_malloc.cpp: Added non-NDEBUG versions of the functions that just call
the system malloc, and put the NDEBUG versions in an #else.
2005-08-16 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- clean up exported symbols that are not in a "KJS" namespace
* bindings/NP_jsobject.cpp: (identiferFromNPIdentifier): Marked this function static
so it no longer has external linkage.
* bindings/c/c_utility.h: Put all this stuff inside the KJS namespace.
* bindings/c/c_utility.cpp: Also marked some globals static so they don't have external
linkage; not as important given the namespace.
* bindings/npruntime.cpp: Marked functions static so they no longer have internal linkage.
Also removed unused _NPN_SetExceptionWithUTF8 function (not in header, had C++ linkage!).
* bindings/jni/jni_utility.cpp: (KJS::Bindings::getJavaVM): Call KJS_GetCreatedJavaVMs
using the soft linking header, instead of calling the JNI call. This allows processes
to link both JavaScriptCore and JavaVM without a symbol conflict.
* bindings/softlinking.c:
(loadFramework): Marked this function static so it no longer has external linkage.
(getFunctionPointer): Ditto.
(KJS_GetCreatedJavaVMs): Renamed this so it has a KJS prefix.
* JavaScriptCore.xcodeproj/project.pbxproj: Added softlinking.h.
* bindings/softlinking.h: Added.
* kjs/nodes2string.cpp: (streamAssignmentOperatorTo): Marked this function static so it
no longer has external linkage.
2005-08-15 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4437
clean up error creation with new throwError function
* bindings/NP_jsobject.cpp:
(_NPN_SetException):
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
* bindings/jni/jni_runtime.cpp:
(JavaField::dispatchValueFromInstance):
(JavaField::dispatchSetValueToInstance):
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject _initializeWithObjectImp:originExecutionContext:executionContext:]):
(-[WebScriptObject _initWithObjectImp:originExecutionContext:executionContext:]):
(+[WebScriptObject throwException:]):
(-[WebScriptObject setException:]):
(+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
* bindings/objc/objc_class.h:
(KJS::Bindings::ObjcClass::~ObjcClass):
(KJS::Bindings::ObjcClass::ObjcClass):
(KJS::Bindings::ObjcClass::operator=):
(KJS::Bindings::ObjcClass::constructorAt):
(KJS::Bindings::ObjcClass::numConstructors):
* bindings/objc/objc_header.h:
* bindings/objc/objc_runtime.h:
(KJS::Bindings::ObjcField::~ObjcField):
(KJS::Bindings::ObjcField::ObjcField):
(KJS::Bindings::ObjcField::operator=):
(KJS::Bindings::ObjcMethod::ObjcMethod):
(KJS::Bindings::ObjcMethod::~ObjcMethod):
(KJS::Bindings::ObjcMethod::operator=):
* bindings/objc/objc_runtime.mm:
(ObjcField::valueFromInstance):
(ObjcField::setValueToInstance):
(ObjcArray::setValueAt):
(ObjcArray::valueAt):
* bindings/objc/objc_utility.h:
* bindings/objc/objc_utility.mm:
(KJS::Bindings::JSMethodNameToObjCMethodName):
(KJS::Bindings::convertValueToObjcValue):
(KJS::Bindings::convertNSStringToString):
(KJS::Bindings::convertObjcValueToValue):
(KJS::Bindings::objcValueTypeForType):
(KJS::Bindings::createObjcInstanceForValue):
(KJS::Bindings::throwError):
* bindings/runtime.h:
(KJS::Bindings::Parameter::~Parameter):
(KJS::Bindings::Method::~Method):
(KJS::Bindings::Instance::Instance):
(KJS::Bindings::Instance::begin):
(KJS::Bindings::Instance::end):
(KJS::Bindings::Instance::getValueOfUndefinedField):
(KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
(KJS::Bindings::Instance::setValueOfUndefinedField):
(KJS::Bindings::Instance::valueOf):
* bindings/runtime_array.cpp:
(RuntimeArrayImp::put):
* bindings/runtime_object.h:
(KJS::RuntimeObjectImp::setInternalInstance):
(KJS::RuntimeObjectImp::getInternalInstance):
* kjs/array_object.cpp:
(getProperty):
(ArrayProtoFuncImp::callAsFunction):
(ArrayObjectImp::construct):
* kjs/bool_object.cpp:
(BooleanProtoFuncImp::callAsFunction):
* kjs/date_object.cpp:
(KJS::DateProtoFuncImp::callAsFunction):
* kjs/function.cpp:
(KJS::decode):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function_object.cpp:
(FunctionProtoFuncImp::callAsFunction):
(FunctionObjectImp::construct):
* kjs/internal.cpp:
(KJS::UndefinedImp::toObject):
(KJS::NullImp::toObject):
(KJS::InterpreterImp::evaluate):
(KJS::InternalFunctionImp::hasInstance):
* kjs/nodes.cpp:
(Node::throwError):
(substitute):
(Node::setExceptionDetailsIfNeeded):
(undefinedVariableError):
(ProgramNode::ProgramNode):
* kjs/number_object.cpp:
(NumberProtoFuncImp::callAsFunction):
* kjs/object.cpp:
(KJS::ObjectImp::call):
(KJS::ObjectImp::defaultValue):
(KJS::Error::create):
(KJS::throwError):
* kjs/object.h:
(KJS::ObjectImp::clearProperties):
(KJS::ObjectImp::getPropertySlot):
(KJS::ObjectImp::getOwnPropertySlot):
* kjs/object_object.cpp:
(ObjectProtoFuncImp::callAsFunction):
* kjs/reference.cpp:
(KJS::Reference::getBase):
(KJS::Reference::getValue):
(KJS::Reference::putValue):
(KJS::Reference::deleteValue):
* kjs/regexp_object.cpp:
(RegExpProtoFuncImp::callAsFunction):
(RegExpObjectImp::construct):
* kjs/string_object.cpp:
(StringProtoFuncImp::callAsFunction):
2005-08-15 Anders Carlsson <andersca@mac.com>
Reviewed by Darin.
* tests/mozilla/ecma_3/Date/15.9.5.5.js:
Remove the code which tests that Date.toLocaleString should be parsable
by Date.parse. That is not true according to the spec.
2005-08-15 Darin Adler <darin@apple.com>
Reviewed by Geoff.
* kjs/collector.cpp: (KJS::Collector::allocate): Use a local instead of a global in one
more place; slight speedup.
2005-08-14 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed crash observed on one of the Apple-only layout tests
* kjs/property_map.cpp: (KJS::PropertyMap::mark): Change code to understand that deleted
entries have a value of NULL, so the deleted sentinel count doesn't need to be included
in the count of things to mark since we're ignoring the keys.
2005-08-14 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4421
speed up JavaScript by inlining some label stack functions
* kjs/internal.h: Removed the copy constructor and assignment operator for LabelStack.
They were unused, and the implementations had bugs; I removed them rather than fixing them.
Also removed the clear function, since that was only needed to help the assignment operator
share code with the destructor, and was not efficient enough for the destructor.
(KJS::LabelStack::~LabelStack): Made this inline. Also used an efficient implementation
that's nice and fast when the stack is empty, better than the old clear() function which
used to keep updating and refetching "tos" each time through the loop.
(KJS::LabelStack::pop): Made this inline.
* kjs/internal.cpp: Deleted the now-inline functions and the obsolete functions. Also
deleted a commented-out line of code.
2005-08-14 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4419
speed up JavaScript by improving KJS::List
my measurements show an improvement of 1% on iBench JavaScript
* kjs/list.cpp: Rearrange list to make the values and free list share the same storage,
which saves 4 bytes per list. Also remove the pointers used only on the heap from the
lists that are in the pool, which saves 8 bytes per list. Moving the free list pointer
closer to the start of the list object also speeds up access to the free list. New
"HeapListImp" struct is used only for the lists on the heap.
(KJS::List::markProtectedLists): Shadowed global variable in local and updated for the
new terminology ("heap" instead of "outside pool").
(KJS::allocateListImp): Updated for new terminology.
(KJS::List::release): Moved the code from deallocateListImp in here -- it wasn't being
inlined and didn't need to be in a separate function.
2005-08-14 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4417
speed up JavaScript with some small changes to the property map code
my measurements show an improvement of 2% on iBench JavaScript
* kjs/property_map.h: (KJS::PropertyMap::PropertyMap): Made the default constructor inline.
* kjs/property_map.cpp:
(KJS::PropertyMap::~PropertyMap): Changed loop to exit early once we know we've processed
all the hash table entries, based on the count.
(KJS::PropertyMap::mark): Ditto.
* kjs/object.h: Made an arbitrary change here to force recompiling so we pick up changes to
property_map.h. Works around what seems to be an Xcode header dependency bug.
2005-08-14 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4416
speed up JavaScript with some improvements to the garbage collector
my measurements show an improvement of 2% on iBench JavaScript
* kjs/collector.cpp:
(KJS::Collector::allocate): Use local variables to shadow globals instead of repeatedly
going at global variables. Tighten up loop implementations to make the common case fast.
(KJS::Collector::markStackObjectsConservatively): Use local variables to shadow globals.
Used a goto to eliminate a boolean since it was showing up in the profile.
(KJS::Collector::markProtectedObjects): Iterate through the table using pointer rather
than an index since the profile showed that generating better code.
(KJS::Collector::collect): Added a special case for blocks where all cells are used,
Use local variables to shadow globals. Eliminated a boolean by computing it another
way (checking to see if the number of live objects changed). Also used local variables
to shadow fields in the current cell when sweeping.
(KJS::Collector::numReferencedObjects): Use AllocatedValueImp instead of ValueImp
in one place -- means we get faster versions of various functions that don't worry
about SimpleNumber.
(KJS::className): Ditto.
(KJS::Collector::rootObjectClasses): Ditto.
2005-08-14 Darin Adler <darin@apple.com>
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4344
REGRESSION: JavaScript crash when going back from viewing a thread (NULL protoype)
* kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set proto in a more
straightforward way. The old code set the proto to 0 and then to the correct value.
This showed up as a "false positive" when searching for places that set prototype
to NULL/0 so I fixed it.
* kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Change to
not pass an explicit "0" to the base class (InternalFunctionImp) constructor.
* kjs/internal.h: Added a default constructor for InternalFunctionImp.
* kjs/internal.cpp: (KJS::InternalFunctionImp::InternalFunctionImp): Added the
default constructor (empty body, just calls base class's default constructor).
* kjs/object.h:
(KJS::ObjectImp::ObjectImp): Add an assertion to catch NULL prototypes earlier
in Development builds.
(KJS::ObjectImp::setPrototype): Ditto.
2005-08-12 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
- two simple speed improvements for a 3% speed gain
* JavaScriptCore.xcodeproj/project.pbxproj: turn on -fstrict-aliasing
* kjs/scope_chain.h:
(KJS::ScopeChainIterator::ScopeChainIterator): Add a scope chain iterator
so you can walk a scope chain without having to make a copy that you then mutate.
(KJS::ScopeChainIterator::operator*): standard iterator operation
(KJS::ScopeChainIterator::operator->): ditto
(KJS::ScopeChainIterator::operator++): ditto
(KJS::ScopeChainIterator::operator==): ditto
(KJS::ScopeChainIterator::operator!=): ditto
(KJS::ScopeChain::begin): Iterator for the top of the scope chain
(KJS::ScopeChain::end): Iterator for one past the bottom (i.e. null)
* kjs/nodes.cpp:
(ResolveNode::evaluate): Use scope chain iterator instead of copying
a scope chain and then modifying the copy
(ResolveNode::evaluateReference): ditto
(FunctionCallResolveNode::evaluate): ditto
(AssignResolveNode::evaluate): ditto
2005-08-12 Maciej Stachowiak <mjs@apple.com>
Patch from Anders Carlsson, reviewed by me.
* kjs/nodes.h: Fix build breakage.
2005-08-12 Maciej Stachowiak <mjs@apple.com>
Reviewed by hyatt.
- refactor function calls, 3% speedup on JS iBench.
* kjs/grammar.y:
* kjs/nodes.cpp:
(Node::throwError): Added new useful variants.
(FunctionCallValueNode::evaluate): New node to handle calls on expressions
that are strictly values, not references.
(FunctionCallValueNode::ref): ditto
(FunctionCallValueNode::deref): ditto
(FunctionCallResolveNode::evaluate): New node to handle calls on identifier
expressions, so that they are looked up in the scope chain.
(FunctionCallResolveNode::ref): ditto
(FunctionCallResolveNode::deref): ditto
(FunctionCallBracketNode::evaluate): New node to handle calls on bracket
dereferences, so that the expression before brackets is used as the this
object.
(FunctionCallBracketNode::ref): ditto
(FunctionCallBracketNode::deref): ditto
(FunctionCallDotNode::evaluate): New node to handle calls on dot
dereferences, so that the expression before the dot is used as the this
object.
(FunctionCallDotNode::ref): ditto
(FunctionCallDotNode::deref): ditto
(dotExprNotAnObjectString): helper function to avoid global variable access.
(dotExprDoesNotAllowCallsString): ditto
* kjs/nodes.h: Declared new classes.
* kjs/nodes2string.cpp:
(FunctionCallValueNode::streamTo): Added - serializes the appropriate function call
(FunctionCallResolveNode::streamTo): ditto
(FunctionCallBracketNode::streamTo): ditto
(FunctionCallParenBracketNode::streamTo): ditto
(FunctionCallDotNode::streamTo): ditto
(FunctionCallParenDotNode::streamTo): ditto
* kjs/object.h:
(KJS::ObjectImp::isActivation): Change how activation objects are
detected in the scope chain, a virtual function is cheaper than the
old inheritance test.
* kjs/function.h:
(KJS::ActivationImp::isActivation): Ditto.
2005-08-11 Maciej Stachowiak <mjs@apple.com>
- added missing file from earlier checkin
* kjs/grammar_types.h: Added.
(KJS::makeNodePair):
(KJS::makeNodeWithIdent):
2005-08-11 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
* kjs/date_object.cpp:
(timetUsingCF): Fix one of the date tests my making the CF version of mktime
have the same quirk about the DST field as the real mktime.
* tests/mozilla/expected.html: Updated for newly fixed test.
2005-08-11 Maciej Stachowiak <mjs@apple.com>
- updated for one of the tests that Darin incidentally fixed.
* tests/mozilla/expected.html:
2005-08-10 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
Refactor assignment grammar to avoid Reference type, and to later
be able to take advantage of writeable PropertySlots, when those
are added. I also fixed a minor bug, turning a function to a
string lost parentheses, I made sure they are printed at least
where semantically significant.
Test cases: see WebCore
* kjs/grammar.y: Change grammar so that assignment expressions are parsed
directly to nodes that know how to set the kind of location being assigned, instead
of having a generic assign node that counts on evaluateReference.
* kjs/lexer.cpp: Include grammar_types.h.
* kjs/nodes.cpp:
(BracketAccessorNode): Renamed from AccessorNode1 for clarity.
(DotAccessorNode): Renamed from AccessorNode2 for clarity.
(combineForAssignment): Inline function for doing the proper kind of
operation for various update assignments like += or *=.
(AssignResolveNode): Node that handles assignment to a bare identifier.
(AssignDotNode): Node that handles assignments of the form EXPR . IDENT = EXPR
(AssignBracketNode): EXPR [ IDENT ] = EXPR
* kjs/nodes.h: Updated for declarations/renames of new classes.
* kjs/nodes2string.cpp:
(GroupNode::streamTo): Fixed to print parens around the expression.
(BracketAccessorNode::streamTo): Renamed.
(DotAccessorNode::streamTo): Renamed.
(AssignResolveNode::streamTo): Added.
(AssignBracketNode::streamTo): Added.
(AssignDotNode::streamTo): Added.
(streamAssignmentOperatorTo): helper function for the above
* kjs/property_slot.h:
(KJS::PropertySlot::isSet): Made this const.
2005-08-10 Adele Peterson <adele@apple.com>
Bumping version to 420+
* Info.plist:
2005-08-10 Geoffrey Garen <ggaren@apple.com>
-fixed <rdar://problem/4151132> REGRESSION: Some applet liveconnect calls
throws privilege exception.
Reviewed by richard and mjs.
-I removed the global static JavaClass cache, since it violated Java
security to cache classes between websites and applets.
* bindings/jni/jni_class.cpp:
-removed global static cache dictionary
-instance constructor and destructor now do the work that used to
be done by static factory methods
-removed obsolete functions
(JavaClass::JavaClass):
(JavaClass::~JavaClass):
* bindings/jni/jni_class.h:
-removed obsolete function declarations
-made copying private since it's unused and it's also not clear
excatly how copying would work with Java security
-made default construction private since it's meaningless
* bindings/jni/jni_instance.cpp:
-removed obsolete functions
(JavaInstance::~JavaInstance):
(JavaInstance::getClass):
* bindings/jni/jni_instance.h:
-made copying private since it's unused and it's also not clear
excatly how copying would work with Java security
-made default construction private since it's meaningless
2005-08-08 Geoffrey Garen <ggaren@apple.com>
-fixed crash caused by fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4313
- exceptionDescription now gets explicitly initialized to NULL in all
the places listed below -- our wrapper classes used to take care of this
automagically
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
* bindings/jni/jni_runtime.cpp:
(JavaField::dispatchValueFromInstance):
(JavaField::dispatchSetValueToInstance):
2005-08-08 Darin Adler <darin@apple.com>
Reviewed by John Sullivan.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4325
Mozilla Date tests have an unnecessary loop that runs 1970 times before each test
* tests/mozilla/ecma/shell.js: Added TIME_YEAR_0 constant.
* tests/mozilla/ecma/Date/15.9.5.10-1.js: Removed the loop and changed code to use the constant.
* tests/mozilla/ecma/Date/15.9.5.10-10.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.10-11.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.10-12.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.10-13.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.10-2.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.10-3.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.10-4.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.10-5.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.10-6.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.10-7.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.10-8.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.10-9.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.11-2.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.12-1.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.12-2.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.12-3.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.12-4.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.12-5.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.12-6.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.12-7.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.12-8.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.13-2.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.13-8.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.14.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.15.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.16.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.17.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.18.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.19.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.20.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.21-1.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.21-2.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.21-3.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.21-4.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.21-5.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.21-6.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.21-7.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.21-8.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.22-1.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.22-2.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.22-3.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.22-4.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.22-5.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.22-6.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.22-7.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.22-8.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.23-4.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.23-5.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.23-6.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.23-7.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.23-8.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.23-9.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.5.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.6.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.7.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.8.js: Ditto.
* tests/mozilla/ecma/Date/15.9.5.9.js: Ditto.
2005-08-08 Darin Adler <darin@apple.com>
- forgot to delete an obsolete file
* kjs/object_wrapper.h: Deleted.
2005-08-07 Darin Adler <darin@apple.com>
- fixed two problems compiling with gcc 4.0
* kjs/array_object.cpp: (ArrayProtoFuncImp::callAsFunction): Initialized a
variable to quiet an erroneous warning.
* kjs/date_object.cpp: (KJS::makeTime): Removed extraneous KJS:: prefix.
2005-08-07 Darin Adler <darin@apple.com>
Rubber stamped by Maciej.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4313
eliminate KJS::Value and KJS::Object smart pointer wrappers (for simplicity and speed)
* JavaScriptCore.xcodeproj/project.pbxproj: Removed object_wrapper.h.
Global replaces and other wonderful stuff.
* bindings/NP_jsobject.cpp:
(_NPN_Invoke):
(_NPN_Evaluate):
(_NPN_GetProperty):
(_NPN_SetProperty):
(_NPN_HasMethod):
(_NPN_SetException):
* bindings/c/c_instance.cpp:
(KJS::Bindings::CInstance::CInstance):
(KJS::Bindings::CInstance::invokeMethod):
(KJS::Bindings::CInstance::invokeDefaultMethod):
(KJS::Bindings::CInstance::defaultValue):
(KJS::Bindings::CInstance::stringValue):
(KJS::Bindings::CInstance::numberValue):
(KJS::Bindings::CInstance::booleanValue):
(KJS::Bindings::CInstance::valueOf):
* bindings/c/c_instance.h:
* bindings/c/c_runtime.cpp:
(CField::valueFromInstance):
(CField::setValueToInstance):
* bindings/c/c_runtime.h:
* bindings/c/c_utility.cpp:
(convertNPStringToUTF16):
(convertUTF8ToUTF16):
(coerceValueToNPVariantStringType):
(convertValueToNPVariant):
(convertNPVariantToValue):
* bindings/c/c_utility.h:
* bindings/jni/jni_instance.cpp:
(JavaInstance::stringValue):
(JavaInstance::numberValue):
(JavaInstance::booleanValue):
(JavaInstance::invokeMethod):
(JavaInstance::invokeDefaultMethod):
(JavaInstance::defaultValue):
(JavaInstance::valueOf):
* bindings/jni/jni_instance.h:
* bindings/jni/jni_jsobject.cpp:
(JSObject::invoke):
(JSObject::call):
(JSObject::eval):
(JSObject::getMember):
(JSObject::getSlot):
(JSObject::toString):
(JSObject::convertValueToJObject):
(JSObject::convertJObjectToValue):
(JSObject::listFromJArray):
* bindings/jni/jni_jsobject.h:
* bindings/jni/jni_objc.mm:
(KJS::Bindings::dispatchJNICall):
* bindings/jni/jni_runtime.cpp:
(JavaArray::convertJObjectToArray):
(JavaField::dispatchValueFromInstance):
(JavaField::valueFromInstance):
(JavaField::dispatchSetValueToInstance):
(JavaField::setValueToInstance):
(JavaArray::setValueAt):
(JavaArray::valueAt):
* bindings/jni/jni_runtime.h:
(KJS::Bindings::JavaString::ustring):
* bindings/jni/jni_utility.cpp:
(KJS::Bindings::getJavaVM):
(KJS::Bindings::getJNIEnv):
(KJS::Bindings::getMethodID):
(KJS::Bindings::callJNIVoidMethod):
(KJS::Bindings::callJNIObjectMethod):
(KJS::Bindings::callJNIBooleanMethod):
(KJS::Bindings::callJNIStaticBooleanMethod):
(KJS::Bindings::callJNIByteMethod):
(KJS::Bindings::callJNICharMethod):
(KJS::Bindings::callJNIShortMethod):
(KJS::Bindings::callJNIIntMethod):
(KJS::Bindings::callJNILongMethod):
(KJS::Bindings::callJNIFloatMethod):
(KJS::Bindings::callJNIDoubleMethod):
(KJS::Bindings::callJNIVoidMethodA):
(KJS::Bindings::callJNIObjectMethodA):
(KJS::Bindings::callJNIByteMethodA):
(KJS::Bindings::callJNICharMethodA):
(KJS::Bindings::callJNIShortMethodA):
(KJS::Bindings::callJNIIntMethodA):
(KJS::Bindings::callJNILongMethodA):
(KJS::Bindings::callJNIFloatMethodA):
(KJS::Bindings::callJNIDoubleMethodA):
(KJS::Bindings::callJNIBooleanMethodA):
(KJS::Bindings::callJNIVoidMethodIDA):
(KJS::Bindings::callJNIObjectMethodIDA):
(KJS::Bindings::callJNIByteMethodIDA):
(KJS::Bindings::callJNICharMethodIDA):
(KJS::Bindings::callJNIShortMethodIDA):
(KJS::Bindings::callJNIIntMethodIDA):
(KJS::Bindings::callJNILongMethodIDA):
(KJS::Bindings::callJNIFloatMethodIDA):
(KJS::Bindings::callJNIDoubleMethodIDA):
(KJS::Bindings::callJNIBooleanMethodIDA):
(KJS::Bindings::getCharactersFromJString):
(KJS::Bindings::releaseCharactersForJString):
(KJS::Bindings::getCharactersFromJStringInEnv):
(KJS::Bindings::releaseCharactersForJStringInEnv):
(KJS::Bindings::getUCharactersFromJStringInEnv):
(KJS::Bindings::releaseUCharactersForJStringInEnv):
(KJS::Bindings::JNITypeFromClassName):
(KJS::Bindings::signatureFromPrimitiveType):
(KJS::Bindings::JNITypeFromPrimitiveType):
(KJS::Bindings::getJNIField):
(KJS::Bindings::convertValueToJValue):
* bindings/jni/jni_utility.h:
* bindings/objc/WebScriptObject.mm:
(_didExecute):
(-[WebScriptObject _initializeWithObjectImp:originExecutionContext:Bindings::executionContext:Bindings::]):
(-[WebScriptObject _initWithObjectImp:originExecutionContext:Bindings::executionContext:Bindings::]):
(-[WebScriptObject _imp]):
(-[WebScriptObject _executionContext]):
(-[WebScriptObject _setExecutionContext:]):
(-[WebScriptObject _originExecutionContext]):
(-[WebScriptObject _setOriginExecutionContext:]):
(+[WebScriptObject throwException:]):
(listFromNSArray):
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(-[WebScriptObject evaluateWebScript:]):
(-[WebScriptObject setValue:forKey:]):
(-[WebScriptObject valueForKey:]):
(-[WebScriptObject removeWebScriptKey:]):
(-[WebScriptObject stringRepresentation]):
(-[WebScriptObject webScriptValueAtIndex:]):
(-[WebScriptObject setException:]):
(+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:Bindings::]):
* bindings/objc/WebScriptObjectPrivate.h:
* bindings/objc/objc_class.h:
* bindings/objc/objc_class.mm:
(KJS::Bindings::ObjcClass::fallbackObject):
* bindings/objc/objc_instance.h:
* bindings/objc/objc_instance.mm:
(ObjcInstance::invokeMethod):
(ObjcInstance::invokeDefaultMethod):
(ObjcInstance::setValueOfField):
(ObjcInstance::setValueOfUndefinedField):
(ObjcInstance::getValueOfField):
(ObjcInstance::getValueOfUndefinedField):
(ObjcInstance::defaultValue):
(ObjcInstance::stringValue):
(ObjcInstance::numberValue):
(ObjcInstance::booleanValue):
(ObjcInstance::valueOf):
* bindings/objc/objc_runtime.h:
* bindings/objc/objc_runtime.mm:
(ObjcField::valueFromInstance):
(convertValueToObjcObject):
(ObjcField::setValueToInstance):
(ObjcArray::setValueAt):
(ObjcArray::valueAt):
(ObjcFallbackObjectImp::put):
(ObjcFallbackObjectImp::callAsFunction):
(ObjcFallbackObjectImp::defaultValue):
* bindings/objc/objc_utility.h:
* bindings/objc/objc_utility.mm:
(Bindings::JSMethodNameToObjCMethodName):
(Bindings::convertValueToObjcValue):
(Bindings::convertNSStringToString):
(Bindings::convertObjcValueToValue):
(Bindings::objcValueTypeForType):
(Bindings::createObjcInstanceForValue):
* bindings/runtime.cpp:
(Instance::getValueOfField):
(Instance::setValueOfField):
(Instance::createRuntimeObject):
(Instance::createLanguageInstanceForValue):
* bindings/runtime.h:
(KJS::Bindings::Constructor::~Constructor):
(KJS::Bindings::Field::~Field):
(KJS::Bindings::MethodList::MethodList):
(KJS::Bindings::Class::fallbackObject):
(KJS::Bindings::Class::~Class):
(KJS::Bindings::Instance::Instance):
(KJS::Bindings::Instance::getValueOfUndefinedField):
(KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
(KJS::Bindings::Instance::setValueOfUndefinedField):
(KJS::Bindings::Instance::valueOf):
(KJS::Bindings::Instance::setExecutionContext):
(KJS::Bindings::Instance::~Instance):
(KJS::Bindings::Array::~Array):
* bindings/runtime_array.cpp:
(RuntimeArrayImp::RuntimeArrayImp):
(RuntimeArrayImp::lengthGetter):
(RuntimeArrayImp::indexGetter):
(RuntimeArrayImp::put):
* bindings/runtime_array.h:
* bindings/runtime_method.cpp:
(RuntimeMethodImp::lengthGetter):
(RuntimeMethodImp::callAsFunction):
* bindings/runtime_method.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::fallbackObjectGetter):
(RuntimeObjectImp::fieldGetter):
(RuntimeObjectImp::methodGetter):
(RuntimeObjectImp::getOwnPropertySlot):
(RuntimeObjectImp::put):
(RuntimeObjectImp::defaultValue):
(RuntimeObjectImp::callAsFunction):
* bindings/runtime_object.h:
* kjs/array_instance.h:
* kjs/array_object.cpp:
(ArrayInstanceImp::ArrayInstanceImp):
(ArrayInstanceImp::lengthGetter):
(ArrayInstanceImp::getOwnPropertySlot):
(ArrayInstanceImp::put):
(ArrayInstanceImp::propList):
(ArrayInstanceImp::setLength):
(compareByStringForQSort):
(compareWithCompareFunctionForQSort):
(ArrayInstanceImp::sort):
(ArrayInstanceImp::pushUndefinedObjectsToEnd):
(ArrayPrototypeImp::ArrayPrototypeImp):
(ArrayProtoFuncImp::ArrayProtoFuncImp):
(ArrayProtoFuncImp::callAsFunction):
(ArrayObjectImp::ArrayObjectImp):
(ArrayObjectImp::construct):
(ArrayObjectImp::callAsFunction):
* kjs/array_object.h:
* kjs/bool_object.cpp:
(BooleanPrototypeImp::BooleanPrototypeImp):
(BooleanProtoFuncImp::BooleanProtoFuncImp):
(BooleanProtoFuncImp::callAsFunction):
(BooleanObjectImp::BooleanObjectImp):
(BooleanObjectImp::construct):
(BooleanObjectImp::callAsFunction):
* kjs/bool_object.h:
* kjs/collector.cpp:
(KJS::Collector::markStackObjectsConservatively):
(KJS::Collector::collect):
(KJS::className):
* kjs/completion.h:
(KJS::Completion::Completion):
(KJS::Completion::value):
(KJS::Completion::isValueCompletion):
* kjs/context.h:
(KJS::ContextImp::variableObject):
(KJS::ContextImp::setVariableObject):
(KJS::ContextImp::thisValue):
(KJS::ContextImp::activationObject):
(KJS::ContextImp::pushScope):
* kjs/date_object.cpp:
(formatLocaleDate):
(KJS::timeFromArgs):
(KJS::DatePrototypeImp::DatePrototypeImp):
(KJS::DateProtoFuncImp::DateProtoFuncImp):
(KJS::DateProtoFuncImp::callAsFunction):
(KJS::DateObjectImp::DateObjectImp):
(KJS::DateObjectImp::construct):
(KJS::DateObjectImp::callAsFunction):
(KJS::DateObjectFuncImp::DateObjectFuncImp):
(KJS::DateObjectFuncImp::callAsFunction):
(KJS::parseDate):
(KJS::KRFCDate_parseDate):
(KJS::timeClip):
* kjs/date_object.h:
* kjs/debugger.cpp:
(Debugger::exception):
(Debugger::callEvent):
(Debugger::returnEvent):
* kjs/debugger.h:
* kjs/error_object.cpp:
(ErrorPrototypeImp::ErrorPrototypeImp):
(ErrorProtoFuncImp::ErrorProtoFuncImp):
(ErrorProtoFuncImp::callAsFunction):
(ErrorObjectImp::ErrorObjectImp):
(ErrorObjectImp::construct):
(ErrorObjectImp::callAsFunction):
(NativeErrorPrototypeImp::NativeErrorPrototypeImp):
(NativeErrorImp::NativeErrorImp):
(NativeErrorImp::construct):
(NativeErrorImp::callAsFunction):
* kjs/error_object.h:
* kjs/function.cpp:
(KJS::FunctionImp::FunctionImp):
(KJS::FunctionImp::callAsFunction):
(KJS::FunctionImp::processParameters):
(KJS::FunctionImp::argumentsGetter):
(KJS::FunctionImp::lengthGetter):
(KJS::FunctionImp::put):
(KJS::DeclaredFunctionImp::DeclaredFunctionImp):
(KJS::DeclaredFunctionImp::construct):
(KJS::ArgumentsImp::ArgumentsImp):
(KJS::ArgumentsImp::mappedIndexGetter):
(KJS::ArgumentsImp::put):
(KJS::ActivationImp::argumentsGetter):
(KJS::GlobalFuncImp::GlobalFuncImp):
(KJS::encode):
(KJS::decode):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function.h:
* kjs/function_object.cpp:
(FunctionPrototypeImp::FunctionPrototypeImp):
(FunctionPrototypeImp::callAsFunction):
(FunctionProtoFuncImp::FunctionProtoFuncImp):
(FunctionProtoFuncImp::callAsFunction):
(FunctionObjectImp::FunctionObjectImp):
(FunctionObjectImp::construct):
(FunctionObjectImp::callAsFunction):
* kjs/function_object.h:
* kjs/internal.cpp:
(KJS::UndefinedImp::toPrimitive):
(KJS::UndefinedImp::toObject):
(KJS::NullImp::toPrimitive):
(KJS::NullImp::toObject):
(KJS::BooleanImp::toPrimitive):
(KJS::BooleanImp::toObject):
(KJS::StringImp::toPrimitive):
(KJS::StringImp::toObject):
(KJS::NumberImp::toPrimitive):
(KJS::NumberImp::toObject):
(KJS::NumberImp::getUInt32):
(KJS::LabelStack::push):
(KJS::ContextImp::ContextImp):
(KJS::InterpreterImp::globalInit):
(KJS::InterpreterImp::globalClear):
(KJS::InterpreterImp::InterpreterImp):
(KJS::InterpreterImp::initGlobalObject):
(KJS::InterpreterImp::clear):
(KJS::InterpreterImp::mark):
(KJS::InterpreterImp::evaluate):
(KJS::InternalFunctionImp::hasInstance):
(KJS::roundValue):
(KJS::printInfo):
* kjs/internal.h:
(KJS::InterpreterImp::builtinObject):
(KJS::InterpreterImp::builtinFunction):
(KJS::InterpreterImp::builtinArray):
(KJS::InterpreterImp::builtinBoolean):
(KJS::InterpreterImp::builtinString):
(KJS::InterpreterImp::builtinNumber):
(KJS::InterpreterImp::builtinDate):
(KJS::InterpreterImp::builtinRegExp):
(KJS::InterpreterImp::builtinError):
(KJS::InterpreterImp::builtinObjectPrototype):
(KJS::InterpreterImp::builtinFunctionPrototype):
(KJS::InterpreterImp::builtinArrayPrototype):
(KJS::InterpreterImp::builtinBooleanPrototype):
(KJS::InterpreterImp::builtinStringPrototype):
(KJS::InterpreterImp::builtinNumberPrototype):
(KJS::InterpreterImp::builtinDatePrototype):
(KJS::InterpreterImp::builtinRegExpPrototype):
(KJS::InterpreterImp::builtinErrorPrototype):
(KJS::InterpreterImp::builtinEvalError):
(KJS::InterpreterImp::builtinRangeError):
(KJS::InterpreterImp::builtinReferenceError):
(KJS::InterpreterImp::builtinSyntaxError):
(KJS::InterpreterImp::builtinTypeError):
(KJS::InterpreterImp::builtinURIError):
(KJS::InterpreterImp::builtinEvalErrorPrototype):
(KJS::InterpreterImp::builtinRangeErrorPrototype):
(KJS::InterpreterImp::builtinReferenceErrorPrototype):
(KJS::InterpreterImp::builtinSyntaxErrorPrototype):
(KJS::InterpreterImp::builtinTypeErrorPrototype):
(KJS::InterpreterImp::builtinURIErrorPrototype):
* kjs/interpreter.cpp:
(Context::variableObject):
(Context::thisValue):
(Interpreter::Interpreter):
(Interpreter::globalObject):
(Interpreter::evaluate):
(Interpreter::builtinObject):
(Interpreter::builtinFunction):
(Interpreter::builtinArray):
(Interpreter::builtinBoolean):
(Interpreter::builtinString):
(Interpreter::builtinNumber):
(Interpreter::builtinDate):
(Interpreter::builtinRegExp):
(Interpreter::builtinError):
(Interpreter::builtinObjectPrototype):
(Interpreter::builtinFunctionPrototype):
(Interpreter::builtinArrayPrototype):
(Interpreter::builtinBooleanPrototype):
(Interpreter::builtinStringPrototype):
(Interpreter::builtinNumberPrototype):
(Interpreter::builtinDatePrototype):
(Interpreter::builtinRegExpPrototype):
(Interpreter::builtinErrorPrototype):
(Interpreter::builtinEvalError):
(Interpreter::builtinRangeError):
(Interpreter::builtinReferenceError):
(Interpreter::builtinSyntaxError):
(Interpreter::builtinTypeError):
(Interpreter::builtinURIError):
(Interpreter::builtinEvalErrorPrototype):
(Interpreter::builtinRangeErrorPrototype):
(Interpreter::builtinReferenceErrorPrototype):
(Interpreter::builtinSyntaxErrorPrototype):
(Interpreter::builtinTypeErrorPrototype):
(Interpreter::builtinURIErrorPrototype):
(Interpreter::createLanguageInstanceForValue):
* kjs/interpreter.h:
(KJS::Interpreter::isGlobalObject):
(KJS::ExecState::setException):
(KJS::ExecState::clearException):
(KJS::ExecState::exception):
(KJS::ExecState::hadException):
(KJS::ExecState::ExecState):
* kjs/list.cpp:
(KJS::List::at):
* kjs/list.h:
(KJS::List::operator[]):
(KJS::ListIterator::operator->):
(KJS::ListIterator::operator*):
(KJS::ListIterator::operator++):
(KJS::ListIterator::operator--):
* kjs/lookup.h:
(KJS::staticFunctionGetter):
(KJS::staticValueGetter):
(KJS::lookupPut):
(KJS::cacheGlobalObject):
* kjs/math_object.cpp:
(MathObjectImp::getValueProperty):
(MathFuncImp::MathFuncImp):
(MathFuncImp::callAsFunction):
* kjs/math_object.h:
* kjs/nodes.cpp:
(Node::evaluateReference):
(Node::throwError):
(Node::setExceptionDetailsIfNeeded):
(NullNode::evaluate):
(BooleanNode::evaluate):
(NumberNode::evaluate):
(StringNode::evaluate):
(RegExpNode::evaluate):
(ThisNode::evaluate):
(ResolveNode::evaluate):
(ResolveNode::evaluateReference):
(GroupNode::evaluate):
(ElementNode::evaluate):
(ArrayNode::evaluate):
(ObjectLiteralNode::evaluate):
(PropertyValueNode::evaluate):
(PropertyNode::evaluate):
(AccessorNode1::evaluate):
(AccessorNode1::evaluateReference):
(AccessorNode2::evaluate):
(AccessorNode2::evaluateReference):
(ArgumentListNode::evaluate):
(ArgumentListNode::evaluateList):
(ArgumentsNode::evaluate):
(NewExprNode::evaluate):
(FunctionCallNode::evaluate):
(PostfixNode::evaluate):
(DeleteNode::evaluate):
(VoidNode::evaluate):
(TypeOfNode::evaluate):
(PrefixNode::evaluate):
(UnaryPlusNode::evaluate):
(NegateNode::evaluate):
(BitwiseNotNode::evaluate):
(LogicalNotNode::evaluate):
(MultNode::evaluate):
(AddNode::evaluate):
(ShiftNode::evaluate):
(RelationalNode::evaluate):
(EqualNode::evaluate):
(BitOperNode::evaluate):
(BinaryLogicalNode::evaluate):
(ConditionalNode::evaluate):
(AssignNode::evaluate):
(CommaNode::evaluate):
(StatListNode::execute):
(AssignExprNode::evaluate):
(VarDeclNode::evaluate):
(VarDeclNode::processVarDecls):
(VarDeclListNode::evaluate):
(ExprStatementNode::execute):
(IfNode::execute):
(DoWhileNode::execute):
(WhileNode::execute):
(ForNode::execute):
(ForInNode::execute):
(ContinueNode::execute):
(BreakNode::execute):
(ReturnNode::execute):
(WithNode::execute):
(CaseClauseNode::evaluate):
(ClauseListNode::evaluate):
(CaseBlockNode::evaluate):
(CaseBlockNode::evalBlock):
(SwitchNode::execute):
(ThrowNode::execute):
(CatchNode::execute):
(TryNode::execute):
(ParameterNode::evaluate):
(FuncDeclNode::processFuncDecl):
(FuncExprNode::evaluate):
(SourceElementsNode::execute):
* kjs/nodes.h:
(KJS::StatementNode::evaluate):
* kjs/number_object.cpp:
(NumberPrototypeImp::NumberPrototypeImp):
(NumberProtoFuncImp::NumberProtoFuncImp):
(NumberProtoFuncImp::callAsFunction):
(NumberObjectImp::NumberObjectImp):
(NumberObjectImp::getValueProperty):
(NumberObjectImp::construct):
(NumberObjectImp::callAsFunction):
* kjs/number_object.h:
* kjs/object.cpp:
(KJS::ObjectImp::call):
(KJS::ObjectImp::mark):
(KJS::ObjectImp::classInfo):
(KJS::ObjectImp::get):
(KJS::ObjectImp::getProperty):
(KJS::ObjectImp::getPropertySlot):
(KJS::ObjectImp::put):
(KJS::ObjectImp::hasOwnProperty):
(KJS::ObjectImp::defaultValue):
(KJS::ObjectImp::findPropertyHashEntry):
(KJS::ObjectImp::construct):
(KJS::ObjectImp::callAsFunction):
(KJS::ObjectImp::hasInstance):
(KJS::ObjectImp::propList):
(KJS::ObjectImp::toPrimitive):
(KJS::ObjectImp::toNumber):
(KJS::ObjectImp::toString):
(KJS::ObjectImp::toObject):
(KJS::ObjectImp::putDirect):
(KJS::Error::create):
(KJS::error):
* kjs/object.h:
(KJS::):
(KJS::ObjectImp::getPropertySlot):
(KJS::AllocatedValueImp::isObject):
(KJS::ObjectImp::ObjectImp):
(KJS::ObjectImp::internalValue):
(KJS::ObjectImp::setInternalValue):
(KJS::ObjectImp::prototype):
(KJS::ObjectImp::setPrototype):
(KJS::ObjectImp::inherits):
* kjs/object_object.cpp:
(ObjectPrototypeImp::ObjectPrototypeImp):
(ObjectProtoFuncImp::ObjectProtoFuncImp):
(ObjectProtoFuncImp::callAsFunction):
(ObjectObjectImp::ObjectObjectImp):
(ObjectObjectImp::construct):
(ObjectObjectImp::callAsFunction):
* kjs/object_object.h:
* kjs/operations.cpp:
(KJS::equal):
(KJS::strictEqual):
(KJS::relation):
(KJS::add):
(KJS::mult):
* kjs/operations.h:
* kjs/property_map.cpp:
(KJS::PropertyMap::mark):
(KJS::PropertyMap::addEnumerablesToReferenceList):
(KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
(KJS::PropertyMap::save):
(KJS::PropertyMap::restore):
* kjs/property_map.h:
* kjs/property_slot.cpp:
(KJS::PropertySlot::undefinedGetter):
* kjs/property_slot.h:
(KJS::PropertySlot::getValue):
* kjs/protect.h:
(KJS::gcUnprotectNullTolerant):
(KJS::ProtectedValue::ProtectedValue):
(KJS::ProtectedValue::~ProtectedValue):
(KJS::ProtectedValue::operator=):
(KJS::ProtectedValue::operator ValueImp *):
(KJS::ProtectedValue::operator->):
* kjs/protected_object.h:
(KJS::ProtectedObject::ProtectedObject):
(KJS::ProtectedObject::operator=):
(KJS::ProtectedObject::operator ValueImp *):
(KJS::ProtectedObject::operator ObjectImp *):
(KJS::ProtectedObject::operator->):
(KJS::ProtectedReference::ProtectedReference):
(KJS::ProtectedReference::~ProtectedReference):
(KJS::ProtectedReference::operator=):
* kjs/protected_values.cpp:
(KJS::ProtectedValues::getProtectCount):
(KJS::ProtectedValues::increaseProtectCount):
(KJS::ProtectedValues::insert):
(KJS::ProtectedValues::decreaseProtectCount):
* kjs/protected_values.h:
* kjs/reference.cpp:
(KJS::Reference::Reference):
(KJS::Reference::makeValueReference):
(KJS::Reference::getBase):
(KJS::Reference::getValue):
(KJS::Reference::putValue):
(KJS::Reference::deleteValue):
* kjs/reference.h:
(KJS::Reference::baseIfMutable):
* kjs/regexp_object.cpp:
(RegExpPrototypeImp::RegExpPrototypeImp):
(RegExpProtoFuncImp::RegExpProtoFuncImp):
(RegExpProtoFuncImp::callAsFunction):
(RegExpObjectImp::RegExpObjectImp):
(RegExpObjectImp::arrayOfMatches):
(RegExpObjectImp::backrefGetter):
(RegExpObjectImp::construct):
(RegExpObjectImp::callAsFunction):
* kjs/regexp_object.h:
* kjs/string_object.cpp:
(StringInstanceImp::lengthGetter):
(StringInstanceImp::indexGetter):
(StringInstanceImp::getOwnPropertySlot):
(StringInstanceImp::put):
(StringPrototypeImp::StringPrototypeImp):
(StringProtoFuncImp::StringProtoFuncImp):
(regExpIsGlobal):
(replace):
(StringProtoFuncImp::callAsFunction):
(StringObjectImp::StringObjectImp):
(StringObjectImp::construct):
(StringObjectImp::callAsFunction):
(StringObjectFuncImp::StringObjectFuncImp):
(StringObjectFuncImp::callAsFunction):
* kjs/string_object.h:
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction):
(VersionFunctionImp::callAsFunction):
(main):
* kjs/value.cpp:
(KJS::AllocatedValueImp::operator new):
(KJS::AllocatedValueImp::getUInt32):
(KJS::ValueImp::toInteger):
(KJS::ValueImp::toInt32):
(KJS::ValueImp::toUInt32):
(KJS::ValueImp::toUInt16):
(KJS::ValueImp::toObject):
(KJS::AllocatedValueImp::getBoolean):
(KJS::AllocatedValueImp::getNumber):
(KJS::AllocatedValueImp::getString):
(KJS::AllocatedValueImp::getObject):
(KJS::jsString):
(KJS::jsNumber):
(KJS::ConstantValues::init):
(KJS::ConstantValues::clear):
(KJS::ConstantValues::mark):
* kjs/value.h:
(KJS::):
(KJS::jsUndefined):
(KJS::jsNull):
(KJS::jsBoolean):
(KJS::jsNaN):
(KJS::ValueImp::ValueImp):
(KJS::ValueImp::~ValueImp):
(KJS::AllocatedValueImp::AllocatedValueImp):
(KJS::AllocatedValueImp::~AllocatedValueImp):
(KJS::AllocatedValueImp::isBoolean):
(KJS::AllocatedValueImp::isNumber):
(KJS::AllocatedValueImp::isString):
(KJS::AllocatedValueImp::isObject):
(KJS::AllocatedValueImp::marked):
(KJS::AllocatedValueImp::mark):
(KJS::ValueImp::downcast):
(KJS::ValueImp::isUndefined):
(KJS::ValueImp::isNull):
(KJS::ValueImp::isUndefinedOrNull):
(KJS::ValueImp::isBoolean):
(KJS::ValueImp::isNumber):
(KJS::ValueImp::isString):
(KJS::ValueImp::isObject):
(KJS::ValueImp::getBoolean):
(KJS::ValueImp::getNumber):
(KJS::ValueImp::getString):
(KJS::ValueImp::getObject):
(KJS::ValueImp::getUInt32):
(KJS::ValueImp::mark):
(KJS::ValueImp::marked):
(KJS::ValueImp::type):
(KJS::ValueImp::toPrimitive):
(KJS::ValueImp::toBoolean):
(KJS::ValueImp::toNumber):
(KJS::ValueImp::toString):
(KJS::jsZero):
(KJS::jsOne):
(KJS::jsTwo):
(KJS::Undefined):
(KJS::Null):
(KJS::Boolean):
(KJS::Number):
(KJS::String):
2005-08-06 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
Change over to the new PropertySlot mechanism for property
lookup. This allows the elimination of hasOwnProperty
methods. Also did some of the performance tuning enabled by this
(but not yet all the possible improvements for function calls,
assignment, ++, and so forth). And also much code cleanup.
Net result is about a 2% speedup on the JS iBench.
Also redid Geoff's fix for the chrashing applet by avoiding a NULL
prototype in the bindings code and using the default of Null()
instead.
* JavaScriptCore.xcodeproj/project.pbxproj:
* bindings/objc/objc_runtime.h:
* bindings/objc/objc_runtime.mm:
(ObjcFallbackObjectImp::ObjcFallbackObjectImp):
(ObjcFallbackObjectImp::getOwnPropertySlot):
* bindings/runtime_array.cpp:
(RuntimeArrayImp::lengthGetter):
(RuntimeArrayImp::indexGetter):
(RuntimeArrayImp::getOwnPropertySlot):
* bindings/runtime_array.h:
* bindings/runtime_method.cpp:
(RuntimeMethodImp::lengthGetter):
(RuntimeMethodImp::getOwnPropertySlot):
* bindings/runtime_method.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::RuntimeObjectImp):
(RuntimeObjectImp::fallbackObjectGetter):
(RuntimeObjectImp::fieldGetter):
(RuntimeObjectImp::methodGetter):
(RuntimeObjectImp::getOwnPropertySlot):
* bindings/runtime_object.h:
* bindings/runtime_root.h:
* kjs/array_instance.h:
* kjs/array_object.cpp:
(ArrayInstanceImp::lengthGetter):
(ArrayInstanceImp::getOwnPropertySlot):
(ArrayPrototypeImp::getOwnPropertySlot):
* kjs/array_object.h:
* kjs/date_object.cpp:
(DatePrototypeImp::getOwnPropertySlot):
* kjs/date_object.h:
* kjs/function.cpp:
(KJS::FunctionImp::argumentsGetter):
(KJS::FunctionImp::lengthGetter):
(KJS::FunctionImp::getOwnPropertySlot):
(KJS::FunctionImp::put):
(KJS::FunctionImp::deleteProperty):
(KJS::ArgumentsImp::mappedIndexGetter):
(KJS::ArgumentsImp::getOwnPropertySlot):
(KJS::ActivationImp::argumentsGetter):
(KJS::ActivationImp::getArgumentsGetter):
(KJS::ActivationImp::getOwnPropertySlot):
(KJS::ActivationImp::deleteProperty):
* kjs/function.h:
* kjs/internal.cpp:
(InterpreterImp::InterpreterImp):
(InterpreterImp::initGlobalObject):
(InterpreterImp::~InterpreterImp):
(InterpreterImp::evaluate):
* kjs/internal.h:
(KJS::InterpreterImp::globalExec):
* kjs/interpreter.cpp:
(Interpreter::Interpreter):
(Interpreter::createLanguageInstanceForValue):
* kjs/interpreter.h:
(KJS::Interpreter::argumentsIdentifier):
(KJS::Interpreter::specialPrototypeIdentifier):
* kjs/lookup.h:
(KJS::staticFunctionGetter):
(KJS::staticValueGetter):
(KJS::getStaticPropertySlot):
(KJS::getStaticFunctionSlot):
(KJS::getStaticValueSlot):
* kjs/math_object.cpp:
(MathObjectImp::getOwnPropertySlot):
* kjs/math_object.h:
* kjs/nodes.cpp:
(ResolveNode::evaluate):
(ResolveNode::evaluateReference):
(AccessorNode1::evaluate):
(AccessorNode2::evaluate):
* kjs/number_object.cpp:
(NumberObjectImp::getOwnPropertySlot):
* kjs/number_object.h:
* kjs/object.cpp:
(KJS::ObjectImp::get):
(KJS::ObjectImp::getProperty):
(KJS::ObjectImp::getPropertySlot):
(KJS::ObjectImp::getOwnPropertySlot):
(KJS::ObjectImp::put):
(KJS::ObjectImp::hasProperty):
(KJS::ObjectImp::hasOwnProperty):
* kjs/object.h:
(KJS::ObjectImp::getDirectLocation):
(KJS::ObjectImp::getPropertySlot):
(KJS::ObjectImp::getOwnPropertySlot):
* kjs/object_wrapper.h: Added.
(KJS::):
(KJS::Object::Object):
(KJS::Object::operator ObjectImp *):
* kjs/property_map.cpp:
(KJS::PropertyMap::getLocation):
* kjs/property_map.h:
* kjs/property_slot.cpp: Added.
(KJS::PropertySlot::undefinedGetter):
* kjs/property_slot.h: Added.
(KJS::PropertySlot::isSet):
(KJS::PropertySlot::getValue):
(KJS::PropertySlot::setValueSlot):
(KJS::PropertySlot::setStaticEntry):
(KJS::PropertySlot::setCustom):
(KJS::PropertySlot::setCustomIndex):
(KJS::PropertySlot::setUndefined):
(KJS::PropertySlot::slotBase):
(KJS::PropertySlot::staticEntry):
(KJS::PropertySlot::index):
(KJS::PropertySlot::):
* kjs/protect.h:
* kjs/protected_object.h: Added.
(KJS::ProtectedObject::ProtectedObject):
(KJS::ProtectedObject::~ProtectedObject):
(KJS::ProtectedObject::operator=):
(KJS::ProtectedReference::ProtectedReference):
(KJS::ProtectedReference::~ProtectedReference):
(KJS::ProtectedReference::operator=):
* kjs/reference.h:
* kjs/reference_list.cpp:
* kjs/regexp_object.cpp:
(RegExpObjectImp::backrefGetter):
(RegExpObjectImp::getOwnPropertySlot):
* kjs/regexp_object.h:
* kjs/string_object.cpp:
(StringInstanceImp::lengthGetter):
(StringInstanceImp::indexGetter):
(StringInstanceImp::getOwnPropertySlot):
(StringPrototypeImp::getOwnPropertySlot):
* kjs/string_object.h:
2005-08-05 Adele Peterson <adele@apple.com>
Reviewed by Darin.
* JavaScriptCore.xcodeproj/project.pbxproj: Unchecked 'statics are thread safe' option.
2005-08-05 Geoffrey Garen <ggaren@apple.com>
-fixed <rdar://problem/4207220> REGRESSION (DENVER): Crash occurs
after clicking on Hangman applet
Reviewed by darin.
* kjs/object.cpp:
(KJS::ObjectImp::hasProperty): added check for null prototype.
FIXME: The long-term plan is to make runtime objects use JS Null()
instead of null pointers, which will allow us to eliminate null
checks, improving performance.
2005-08-05 Geoffrey Garen <ggaren@apple.com>
Fix by darin, reviewed by me.
- rolled in fix for: <rdar://problem/4161606> JavaScript regular
expressions with certain ranges of Unicode characters cause a crash
Test cases added:
* layout-tests/fast/js/regexp-big-unicode-ranges-expected.txt: Added.
* layout-tests/fast/js/regexp-big-unicode-ranges.html: Added.
* pcre/pcre.c:
(compile_branch): added checks for characters > 255
2005-08-04 Maciej Stachowiak <mjs@apple.com>
- updated expected test results now that we no longer exlude the
date tests (apparently this was overlooked)
* tests/mozilla/expected.html:
2005-07-31 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- remove uses of Mac-OS-X-specific MAX macro
- remove one of the many excess "APPLE_CHANGES" ifdefs
* kjs/collector.cpp: (KJS::Collector::allocate): Use std::max instead of MAX.
* kjs/property_map.cpp: (KJS::PropertyMap::rehash): Ditto.
* kjs/ustring.cpp:
(KJS::UChar::toLower): Take out non-ICU code path.
(KJS::UChar::toUpper): Ditto.
(KJS::UString::spliceSubstringsWithSeparators): Use std::max instead of MAX.
2005-07-27 Geoffrey Garen <ggaren@apple.com>
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4147
Array.toString() and toLocaleString() improvements from KDE KJS
(rolled in KDE changes)
Test cases added:
* layout-tests/fast/js/toString-overrides-expected.txt: Added.
* layout-tests/fast/js/toString-overrides.html: Added.
* kjs/array_object.cpp:
(ArrayProtoFuncImp::call):
2005-07-27 Maciej Stachowiak <mjs@apple.com>
Changes by Michael Kahl, reviewed by me.
- fixed <rdar://problem/4194278> Need better debugging support in JavaScriptCore
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/debugger.cpp:
(KJS::AttachedInterpreter::AttachedInterpreter):
(KJS::AttachedInterpreter::~AttachedInterpreter):
(Debugger::~Debugger):
(Debugger::attach):
(Debugger::detach):
(Debugger::sourceParsed):
* kjs/debugger.h:
* kjs/function.cpp:
(KJS::FunctionImp::call):
(KJS::GlobalFuncImp::call):
* kjs/function_object.cpp:
(FunctionObjectImp::construct):
* kjs/grammar.y:
* kjs/internal.cpp:
(Parser::parse):
(InterpreterImp::evaluate):
* kjs/internal.h:
(KJS::InterpreterImp::setDebugger):
* kjs/interpreter.cpp:
* kjs/interpreter.h:
(KJS::Interpreter::imp):
* kjs/nodes.cpp:
2005-07-27 Geoffrey Garen <ggaren@apple.com>
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3381
Date.prototype.setDate() incorrect for values >=128
- Test cases added:
* layout-tests/fast/js/date-big-setdate-expected.txt: Added.
* layout-tests/fast/js/date-big-setdate.html: Added.
Reviewed by darin.
* kjs/date_object.cpp:
(DateProtoFuncImp::call):
2005-07-27 Geoffrey Garen <ggaren@apple.com>
-rolled in patch by Carsten Guenther <cguenther@gmail.com>
for http://bugzilla.opendarwin.org/show_bug.cgi?id=3759
Date object enhancements
Test cases added:
* layout-tests/fast/js/date-preserve-milliseconds-expected.txt: Added.
* layout-tests/fast/js/date-preserve-milliseconds.html: Added.
Reviewed by darin.
* kjs/date_object.cpp:
(timeFromArgs):
(DateProtoFuncImp::call):
(DateObjectImp::construct):
(DateObjectFuncImp::call):
(KJS::makeTime):
* kjs/date_object.h:
* tests/mozilla/expected.html:
2005-07-26 Justin Garcia <justin.garcia@apple.com>
Added a forward declaration to fix gcc4 build error
* kjs/function.h:
2005-07-25 Geoffrey Garen <ggaren@apple.com>
- fixed mistake in my last checkin -- the expected results included
results from a patch that hasn't landed yet.
* tests/mozilla/expected.html:
2005-07-25 Maciej Stachowiak <mjs@apple.com>
- fix mistake in last change that leads to assertion failure in the Development build
* kjs/lookup.h:
(KJS::lookupGetOwnValue):
2005-07-24 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- http://bugzilla.opendarwin.org/show_bug.cgi?id=4124
(change JavaScript property access to avoid double lookup)
- 10% speedup on JavaScript iBench
- 5% speedup on 24fun BenchJS benchmark
Changed all get methods to getOwnProperty - they are no longer
responsible for prototype lookup, and determine if the property
was found as a side efect.
get() is now a nonvirtual ObjectImp method which calls the virtual
getOwnProperty and walks the prototype chain. A few selected
methods were inlined.
Changed ResolveNode::evaluate plus some other places to use
getProperty which does get() and hasProperty() in one lookup.
Also miscellaneous code cleanup.
* bindings/objc/objc_runtime.h:
* bindings/objc/objc_runtime.mm:
(ObjcFallbackObjectImp::ObjcFallbackObjectImp):
(ObjcFallbackObjectImp::getOwnProperty):
* bindings/runtime_array.cpp:
(RuntimeArrayImp::RuntimeArrayImp):
(RuntimeArrayImp::getOwnProperty):
* bindings/runtime_array.h:
* bindings/runtime_method.cpp:
(RuntimeMethodImp::getOwnProperty):
* bindings/runtime_method.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::getOwnProperty):
* bindings/runtime_object.h:
* kjs/array_instance.h:
* kjs/array_object.cpp:
(ArrayInstanceImp::getOwnProperty):
(ArrayPrototypeImp::getOwnProperty):
(ArrayProtoFuncImp::call):
* kjs/array_object.h:
* kjs/date_object.cpp:
(DatePrototypeImp::getOwnProperty):
* kjs/date_object.h:
* kjs/function.cpp:
(KJS::FunctionImp::getOwnProperty):
(KJS::ArgumentsImp::getOwnProperty):
(KJS::ActivationImp::getOwnProperty):
* kjs/function.h:
* kjs/lookup.h:
(KJS::lookupGetOwnProperty):
(KJS::lookupGetOwnFunction):
(KJS::lookupGetOwnValue):
* kjs/math_object.cpp:
(MathObjectImp::getOwnProperty):
(MathObjectImp::getValueProperty):
* kjs/math_object.h:
* kjs/nodes.cpp:
(ResolveNode::evaluate):
* kjs/number_object.cpp:
(NumberObjectImp::getOwnProperty):
* kjs/number_object.h:
* kjs/object.cpp:
(KJS::ObjectImp::get):
(KJS::ObjectImp::getOwnProperty):
(KJS::ObjectImp::getProperty):
* kjs/object.h:
(KJS::ObjectImp::getProperty):
(KJS::ObjectImp::getOwnProperty):
* kjs/object_object.cpp:
(ObjectProtoFuncImp::call):
* kjs/regexp_object.cpp:
(RegExpObjectImp::getOwnProperty):
* kjs/regexp_object.h:
* kjs/string_object.cpp:
(StringInstanceImp::getOwnProperty):
(StringPrototypeImp::getOwnProperty):
* kjs/string_object.h:
2005-07-25 Geoffrey Garen <ggaren@apple.com>
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3971
JS test suite depends on JS 1.2 behavior
Reviewed by darin.
* tests/mozilla/js1_2/Array/tostring_1.js: now tests only for JS 1.5 behavior
* tests/mozilla/js1_2/Array/tostring_2.js: ditto
* tests/mozilla/expected.html:
2005-07-24 Justin Garcia <justin.garcia@apple.com>
Reviewed by kevin.
Fixes make clean problem introduced in xcode2.1 transition
* Makefile.am:
2005-07-22 Geoffrey Garen <ggaren@apple.com>
Reviewed by darin.
* kjs/date_object.cpp: DatePrototypeImp now identifies itself as a
child class of DateInstanceImp -- this enables calls to Date.ValueOf().
fixes: ecma/Date/15.9.5.js (once we enable the date tests).
2005-07-22 Geoffrey Garen <ggaren@apple.com>
Reviewed by darin.
* tests/mozilla/jsDriver.pl: now takes the path to testkjs as a command-line argument
* tests/mozilla/run-mozilla-tests: Removed.
2005-07-21 Geoffrey Garen <ggaren@apple.com>
* JavaScriptCore.xcodeproj/.cvsignore: Added.
2005-07-21 Geoffrey Garen <ggaren@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Removed.
* JavaScriptCore.xcodeproj/ggaren.pbxuser: Added.
* JavaScriptCore.xcodeproj/ggaren.perspective: Added.
* JavaScriptCore.xcodeproj/project.pbxproj: Added.
* Makefile.am:
2005-07-20 Maciej Stachowiak <mjs@apple.com>
Patch from Trey Matteson <trey@usa.net>, reviewed by me.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3956
some of WebKit builds with symbols, some doesn't
* JavaScriptCore.pbproj/project.pbxproj: Generate symbols even for
Deployment.
2005-07-19 Geoffrey Garen <ggaren@apple.com>
-fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3991
JSC doesn't implement Array.prototype.toLocaleString()
-test failure: ecma_3/Array/15.4.4.3-1.js
Reviewed by mjs.
* kjs/array_object.cpp:
(ArrayProtoFuncImp::call): now searches for toString and
toLocaleString overrides in the array's elements
* tests/mozilla/expected.html: failures are under 100! woohoo!
2005-07-19 Darin Adler <darin@apple.com>
- fixed the build
* kjs/lookup.h: (KJS::lookupPut): Remove bogus const; was preventing WebCore from
compiling (not sure why this didn't affect my other build machine).
- one other tiny tweak (so sue me)
* bindings/runtime_root.cpp: Remove unneeded declaration.
2005-07-19 Darin Adler <darin@apple.com>
Reviewed by Geoff Garen.
- eliminated try wrappers for get/put/call since we don't use C++ exceptions any more
* kjs/lookup.h: Changed tryCall in IMPLEMENT_PROTOFUNC here to call. It doesn't make
sense for this macro to use the name tryCall anyway, since that's specific to how
WebCore used this, so this is good anyway. On the other hand, it might be a problem
for KDOM or KSVG, in which case we'll need another macro for them, since JavaScriptCore
should presumably not have the C++ exception support.
2005-07-18 Geoffrey Garen <ggaren@apple.com>
-fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4008
Error objects report incorrect length
Reviewed by darin.
* kjs/error_object.cpp: Error objects now include a length property
(ErrorObjectImp::ErrorObjectImp):
* tests/mozilla/expected.html: updated expected results to reflect fix
* tests/mozilla/js1_5/Exceptions/regress-123002.js: test now expects
ecma compliant results
2005-07-15 Geoffrey Garen <ggaren@apple.com>
-rolled in KDE fixes for http://bugzilla.opendarwin.org/show_bug.cgi?id=3601
Error instance type info
Reviewed by mjs.
* kjs/error_object.cpp:
- Created ErrorInstanceImp class for Error() objects.
- Changed parent object for Native Errors to "Function" (matches
ECMA spec).
(ErrorInstanceImp::ErrorInstanceImp):
(ErrorProtoFuncImp::call):
(ErrorObjectImp::construct):
(NativeErrorImp::construct):
* kjs/error_object.h:
(KJS::ErrorInstanceImp::classInfo):
* kjs/object.h: made comment more informative about ClassInfo
* tests/mozilla/expected.html:
2005-07-14 Geoffrey Garen <ggaren@apple.com>
- fixed: JS test suite expects an out of memory error
that our memory efficiency avoids
Reviewed by mjs.
* tests/mozilla/js1_5/Array/regress-157652.js:
test now expects normal execution
* tests/mozilla/expected.html:
2005-07-14 Geoffrey Garen <ggaren@apple.com>
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4006
testkjs doesn't implement gc()
- test failure:
ecma_3/Function/regress-104584.js
Reviewed by mjs.
* kjs/interpreter.cpp:
(Interpreter::finalCheck): removed misleading while && comment
* kjs/testkjs.cpp: added "gc" function to global object
(TestFunctionImp::):
(TestFunctionImp::call):
(main):
* tests/mozilla/expected.html:
2005-07-14 Geoffrey Garen <ggaren@apple.com>
-rolled in patches for http://bugzilla.opendarwin.org/show_bug.cgi?id=3945
[PATCH] Safe merges of comments and other trivialities from KDE's kjs
-patch by Martijn Klingens <klingens@kde.org>
* kjs/array_instance.h:
* kjs/array_object.cpp:
* kjs/array_object.h:
* kjs/bool_object.cpp:
* kjs/bool_object.h:
* kjs/collector.cpp:
* kjs/collector.h:
* kjs/completion.h:
* kjs/context.h:
* kjs/date_object.cpp:
* kjs/date_object.h:
* kjs/debugger.cpp:
* kjs/debugger.h:
* kjs/dtoa.h:
* kjs/error_object.cpp:
* kjs/error_object.h:
* kjs/function.cpp:
* kjs/function.h:
* kjs/function_object.cpp:
* kjs/function_object.h:
* kjs/grammar.y:
* kjs/identifier.cpp:
* kjs/identifier.h:
* kjs/internal.cpp:
* kjs/internal.h:
* kjs/interpreter.cpp:
* kjs/interpreter.h:
* kjs/interpreter_map.cpp:
* kjs/interpreter_map.h:
* kjs/lexer.cpp:
* kjs/lexer.h:
* kjs/list.cpp:
* kjs/list.h:
* kjs/lookup.cpp:
* kjs/lookup.h:
* kjs/math_object.cpp:
* kjs/math_object.h:
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
* kjs/number_object.cpp:
* kjs/number_object.h:
* kjs/object.cpp:
* kjs/object.h:
* kjs/object_object.cpp:
* kjs/object_object.h:
* kjs/operations.cpp:
* kjs/operations.h:
* kjs/property_map.cpp:
* kjs/property_map.h:
* kjs/reference.cpp:
* kjs/reference.h:
* kjs/reference_list.cpp:
* kjs/reference_list.h:
* kjs/regexp.cpp:
* kjs/regexp.h:
* kjs/regexp_object.cpp:
* kjs/regexp_object.h:
* kjs/scope_chain.cpp:
* kjs/scope_chain.h:
* kjs/simple_number.h:
* kjs/string_object.cpp:
* kjs/string_object.h:
* kjs/testkjs.cpp:
* kjs/types.h:
* kjs/ustring.cpp:
* kjs/ustring.h:
* kjs/value.cpp:
* kjs/value.h:
2005-07-14 Geoffrey Garen <ggaren@apple.com>
-fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3970
throw statements fail inside eval statements
Reviewed by mjs.
* kjs/function.cpp:
(KJS::GlobalFuncImp::call):
Big change since I fixed the tabbing. The important part is:
if (c.complType() == Throw)
exec->setException(c.value());
* kjs/nodes.cpp:
(ThrowNode::execute): removed duplicate KJS_CHECKEXCEPTION
(TryNode::execute):
try now clears the exception state before the finally block executes,
and checks the state after the block executes, so that exceptions in
finally code get caught.
* tests/mozilla/expected.html:
2005-07-14 Geoffrey Garen <ggaren@apple.com>
-landed fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=3412
Object.prototype is missing toLocaleString
- patch by Mark Rowe (bdash) <opendarwin.org@bdash.net.nz>
-layout test info in webcore changelog
Reviewed by mjs.
* kjs/object_object.cpp:
(ObjectPrototypeImp::ObjectPrototypeImp):
(ObjectProtoFuncImp::call):
* kjs/object_object.h:
(KJS::ObjectProtoFuncImp::):
2005-07-12 Geoffrey Garen <ggaren@apple.com>
Reviewed by mjs.
* kjs/function.cpp:
(KJS::IndexToNameMap::operator[]): fixed infinite recursion
bug in last checkin
2005-07-12 Geoffrey Garen <ggaren@apple.com>
-fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3881
arguments object should share values with function parameters
Reviewed by mjs.
ArgumentsImp now uses a simple hash lookup to share values
with the activation object.
* kjs/function.cpp:
(KJS::FunctionImp::getParameterName):
(KJS::IndexToNameMap::IndexToNameMap):
(KJS::IndexToNameMap::~IndexToNameMap):
(KJS::IndexToNameMap::isMapped):
(KJS::IndexToNameMap::unMap):
(KJS::IndexToNameMap::operator[]):
(KJS::ArgumentsImp::ArgumentsImp):
(KJS::ArgumentsImp::mark):
(KJS::ArgumentsImp::get):
(KJS::ArgumentsImp::put):
(KJS::ArgumentsImp::deleteProperty):
(KJS::ArgumentsImp::hasOwnProperty):
(KJS::ActivationImp::createArgumentsObject):
* kjs/function.h:
* tests/mozilla/expected.html: updated results
2005-07-09 Maciej Stachowiak <mjs@apple.com>
- backing out my earlier collector change, it causes a performance regression in TOT
* kjs/collector.cpp:
(KJS::Collector::allocate):
2005-07-08 Eric Seidel <eseidel@apple.com>
Reviewed by mjs/hyatt (only in concept).
* JavaScriptCore.pbproj/project.pbxproj: Added JavaScriptCore+SVG
Turns on RTTI support for JavaScriptCore.framework when
building the JavaScriptCore+SVG target. This is needed as
kdom (part of WebCore+SVG) requires RTTI for the time being.
2005-07-08 Maciej Stachowiak <mjs@apple.com>
Reviewed by hyatt.
- When there are many live objects, GC less often, to try to make
GC cost proportional to garbage, not proportional to total memory used.
* kjs/collector.cpp:
(KJS::Collector::allocate):
2005-07-08 Vicki Murley <vicki@apple.com>
Fix from Carsten Guenther, reviewed by Maciej
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3644 (Error string representation)
Switch from "-" to ":" in error strings.
* kjs/error_object.cpp:
(ErrorProtoFuncImp::call):
* tests/mozilla/expected.html:
2005-07-08 Geoffrey Garen <ggaren@apple.com>
-rolled in patch for http://bugzilla.opendarwin.org/show_bug.cgi?id=3878
arguments object should be an object not an array
Reviewed by mjs.
* kjs/function.cpp:
(KJS::ArgumentsImp::ArgumentsImp): now manually handles initialization
we used to get for free by inheriting from ArrayInstanceImp
* kjs/function.h: ArgumentsImp now inherits from ObjectImp
* tests/mozilla/expected.html: updated expected test results
2005-07-07 Eric Seidel <eseidel@apple.com>
Reviewed by mjs.
* kjs/grammar.y: removed #define YYMAXDEPTH 0 for bison 2.0
http://bugzilla.opendarwin.org/show_bug.cgi?id=3882
2005-07-03 Maciej Stachowiak <mjs@apple.com>
Original patch from Mark Rowe <opendarwin.org@bdash.net.nz>, reviewed by me.
Fixes to patch by me, reviewed by John Sullivan.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3293
Test cases added:
* tests/mozilla/expected.html: Two tests newly pass.
* bindings/objc/objc_runtime.h:
* bindings/objc/objc_runtime.mm:
(ObjcFallbackObjectImp::hasOwnProperty):
* bindings/runtime_array.cpp:
(RuntimeArrayImp::hasOwnProperty):
* bindings/runtime_array.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::hasOwnProperty):
* bindings/runtime_object.h:
* kjs/array_instance.h:
* kjs/array_object.cpp:
(ArrayInstanceImp::hasOwnProperty):
* kjs/function.cpp:
(KJS::FunctionImp::hasOwnProperty):
(KJS::ActivationImp::hasOwnProperty):
* kjs/function.h:
* kjs/lookup.h:
* kjs/object.cpp:
(KJS::ObjectImp::hasProperty):
(KJS::ObjectImp::hasOwnProperty):
* kjs/object.h:
(KJS::Object::hasOwnProperty):
* kjs/object_object.cpp:
(ObjectPrototypeImp::ObjectPrototypeImp):
(ObjectProtoFuncImp::call):
* kjs/object_object.h:
(KJS::ObjectProtoFuncImp::):
* kjs/string_object.cpp:
(StringInstanceImp::hasOwnProperty):
* kjs/string_object.h:
2005-07-01 Geoffrey Garen <ggaren@apple.com>
-landed patch by Eric Seidel <macdome@opendarwin.org>
-for http://bugzilla.opendarwin.org/show_bug.cgi?id=3657
GroundWork: Moving some functions from khtml->jsc following kjs TOT
- no layout test necessary yet - only groundwork
Reviewed by darin.
* kjs/lookup.h:
(KJS::cacheGlobalObject):
2005-07-01 Geoffrey Garen <ggaren@apple.com>
-landed patch by Carsten Guenther <cguenther@gmail.com>
-fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3477
some US-centric date formats not parsed by JavaScript (clock at news8austin.com)
-relevant tests:
mozilla/ecma_3/Date/15.9.5.5.js
layout-tests/fast/js/date-parse-test.html
Reviewed by darin.
* kjs/date_object.cpp:
(formatLocaleDate):
(day):
(dayFromYear):
(daysInYear):
(timeFromYear):
(yearFromTime):
(weekDay):
(timeZoneOffset):
(DateProtoFuncImp::call):
(DateObjectImp::construct):
(KJS::parseDate):
(ymdhms_to_seconds):
(KJS::makeTime):
(findMonth):
(KJS::KRFCDate_parseDate):
* kjs/date_object.h:
* tests/mozilla/expected.html: updated expected results to reflect fix
2005-07-01 Geoffrey Garen <ggaren@apple.com>
-fixed <rdar://problem/4168186> JavaScript fails to throw exceptions
for invalid return statements
relevant tests:
ecma/Statements/12.9-1-n.js
ecma_2/Exceptions/lexical-052.js
ecma_2/Exceptions/statement-009.js
Reviewed by sullivan.
* kjs/nodes.cpp:
(ReturnNode::execute): now throws exception if return is not inside
a function.
* tests/mozilla/expected.html: updated to reflect fix
2005-07-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by sullivan.
* tests/mozilla/expected.html: Updated test results for last fix.
2005-07-01 Geoffrey Garen <ggaren@apple.com>
-fixed <rdar://problem/4168161> JavaScript fails to throw an exception
for invalid function calls
Reviewed by sullivan.
Relevant mozilla test: ecma_3/Exceptions/regress-95101.js
* kjs/nodes.cpp:
(FunctionCallNode::evaluate): evaluate now checks for an exception
after resolving a function name (in case the function is undefined)
2005-07-01 Eric Seidel <eseidel@apple.com>
Reviewed by darin.
* kjs/interpreter.h:
(KJS::Context::curStmtFirstLine): stub for compatibility with KDE
* kjs/value.h:
(KJS::Value::isValid): compatibility with KDE
http://bugzilla.opendarwin.org/show_bug.cgi?id=3687
2005-07-01 Eric Seidel <eseidel@apple.com>
Reviewed by darin.
* kjs/create_hash_table: rolled in changes from KDE, including
-n <namespace> support from KDOM and support for newer comments
http://bugzilla.opendarwin.org/show_bug.cgi?id=3771
2005-06-30 Geoffrey Garen <ggaren@apple.com>
-rolled in KDE fix to <rdar://problem/4167660> JavaScript fails to
throw exceptions for invalid break/continue statements
No layout tests because it's already covered by the Mozilla suite
Reviewed by mjs.
* kjs/internal.h: LabelStack now tracks where you are relative to
switch and iteration (loop) statements
(KJS::LabelStack::LabelStack):
(KJS::LabelStack::pushIteration):
(KJS::LabelStack::popIteration):
(KJS::LabelStack::inIteration):
(KJS::LabelStack::pushSwitch):
(KJS::LabelStack::popSwitch):
(KJS::LabelStack::inSwitch):
* kjs/nodes.cpp:
These files were updated to use the new LabelStack:
(DoWhileNode::execute):
(WhileNode::execute):
(ForNode::execute):
(ForInNode::execute):
(SwitchNode::execute):
These files were updated to throw exceptions for invalid
break/continue statements:
(BreakNode::execute):
(ContinueNode::execute):
* tests/mozilla/expected.html: Updated expected results to reflect fix
2005-06-30 Kevin Decker <kdecker@apple.com>
Reviewed by rjw.
fixed: <rdar://problem/4166838> failed assertion in`Interpreter::lockCount() > 0
no layout test added; this is in the bindings code.
* bindings/objc/WebScriptObject.mm:
(+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]): make sure to lock and unlock the interpreter around allocations.
2005-06-29 Geoffrey Garen <ggaren@apple.com>
Patch by Francisco Tolmasky <tolmasky@gmail.com>
- fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3667
Core JavaScript 1.5 Reference:Objects:Array:forEach
See WebCore Changelog for layout tests added.
Reviewed by darin.
* kjs/array_object.cpp:
(ArrayProtoFuncImp::call):
* kjs/array_object.h:
(KJS::ArrayProtoFuncImp::):
2005-06-29 Geoffrey Garen <ggaren@apple.com>
Patch contributed by Oliver Hunt <ojh16@student.canterbury.ac.nz>
-fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3743
Incorrect error message given for certain calls
See WebCore Changelog for layout test added.
Reviewed by mjs.
* kjs/object.cpp:
(KJS::ObjectImp::defaultValue):
2005-06-29 Geoffrey Garen <ggaren@apple.com>
Rolling out date patch from 6-28-05 because it breaks
fast/js/date-parse-test
* kjs/date_object.cpp:
(formatLocaleDate):
(DateProtoFuncImp::call):
(DateObjectImp::construct):
(KJS::parseDate):
(ymdhms_to_seconds):
(isSpaceOrTab):
(KJS::KRFCDate_parseDate):
* kjs/date_object.h:
* tests/mozilla/expected.html:
2005-06-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin.
-fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3750
build fails with KJS_VERBOSE set
* kjs/nodes.cpp: changed debug print statement to use UString
(VarDeclNode::evaluate):
* kjs/reference.cpp: ditto
(KJS::Reference::putValue):
2005-06-28 Geoffrey Garen <ggaren@apple.com>
Patch contributed by Carsten Guenther <cguenther@gmail.com>.
-fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3477
some US-centric date formats not parsed by JavaScript (clock at news8austin.com)
Reviewed by darin.
* kjs/date_object.cpp:
(formatLocaleDate):
(day):
(dayFromYear):
(daysInYear):
(timeFromYear):
(yearFromTime):
(weekDay):
(timeZoneOffset):
(DateProtoFuncImp::call):
(DateObjectImp::construct):
(KJS::parseDate):
(ymdhms_to_seconds):
(KJS::makeTime):
(findMonth):
(KJS::KRFCDate_parseDate):
* kjs/date_object.h:
* tests/mozilla/expected.html: updated expected test results to reflect fix
2005-06-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- replace hash functions with better ones
* JavaScriptCore.pbproj/project.pbxproj: Add new file to build.
* kjs/interpreter_map.cpp:
(KJS::InterpreterMap::computeHash): Use shared pointer hash.
* kjs/pointer_hash.h: Added.
(KJS::pointerHash): Pointer hash based on 32-bit mix and 64-bit mix hashes.
* kjs/protected_values.cpp:
(KJS::ProtectedValues::computeHash): Use shared pointer hash.
* kjs/ustring.cpp:
(KJS::UString::Rep::computeHash): Use SuperFastHash algorithm.
2005-06-22 Darin Adler <darin@apple.com>
Change by Anders Carlsson.
Reviewed by me.
- fixed <http://bugzilla.opendarwin.org/show_bug.cgi?id=3294>
String.prototype.replace() fails with function as second param
* kjs/string_object.cpp: (replace): Added code to handle functions.
* tests/mozilla/expected.html: Updated since ecma_3/RegExp/regress-209067.js is fixed now.
* tests/mozilla/run-mozilla-tests: Fix a minor coding style issue that leads to a warning each
time we run the tests.
2005-06-21 Adele Peterson <adele@apple.com>
rolling out fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=3293, since it caused layout test failures.
fast/forms/element-by-name
fast/loader/loadInProgress
* ChangeLog:
* bindings/objc/objc_runtime.h:
* bindings/objc/objc_runtime.mm:
(ObjcFallbackObjectImp::hasProperty):
* bindings/runtime_array.cpp:
(RuntimeArrayImp::hasProperty):
* bindings/runtime_array.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::hasProperty):
* bindings/runtime_object.h:
* kjs/array_instance.h:
* kjs/array_object.cpp:
(ArrayInstanceImp::hasProperty):
* kjs/function.cpp:
(KJS::FunctionImp::hasProperty):
(KJS::ActivationImp::hasProperty):
* kjs/function.h:
* kjs/object.cpp:
(KJS::ObjectImp::hasProperty):
* kjs/object.h:
* kjs/object_object.cpp:
(ObjectPrototypeImp::ObjectPrototypeImp):
(ObjectProtoFuncImp::call):
* kjs/object_object.h:
(KJS::ObjectProtoFuncImp::):
* kjs/string_object.cpp:
(StringInstanceImp::hasProperty):
* kjs/string_object.h:
* tests/mozilla/expected.html:
2005-06-21 Darin Adler <darin@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Switched to a build rule rather than a build phase for
.y files -- this gets rid of the problem where modifying the .y file would not cause sufficient
compilation.
* kjs/grammar_wrapper.cpp: Removed.
2005-06-21 Adele Peterson <adele@apple.com>
Patch from Anders Carlsson <andersca@mac.com>, reviewed by Darin.
Fixed: <http://bugzilla.opendarwin.org/show_bug.cgi?id=3450>
<rdar://problem/3881901> String.replace() method not working when regex pattern contains {n, m}
* pcre/pcre.c: (pcre_compile): Remember the last char length so it can be subtracted correctly if needed.
2005-06-21 Geoffrey Garen <ggaren@apple.com>
- fixed <rdar://problem/4155532> 'delete' succeeds on functions
- fixed <rdar://problem/4155049> javascript function named as "opener" doesn't get called because of window.opener property
Reviewed by cblu.
* kjs/nodes.cpp:
(FuncDeclNode::processFuncDecl): Functions now have DontDelete and Internal attributes set when appropriate.
Test cases:
* tests/mozilla/expected.html: Updated for one new success.
- see also test case added in WebCore.
2005-06-20 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin(first pass) and Hyatt.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3576
(roll in support for "const" keyword from KDE tree)
- make processVarDecls handle deletability of variables declared
in an eval block the same as evaluate would
- make eval() call processVarDecls - needed to match mozilla and
to make the second change testable
I started with the KDE implementation of const but I ended up changing it a bit
to avoid the use of a global variable. Now instead of the global variable it distinguishes
const and var at the grammar level so the appropriate node can know the right kind of
declaration.
Test cases:
* tests/mozilla/expected.html: Updated for one new test that is
failing - we used to bail on it entirely because it checks for
const support before starting.
- see also test cases added in WebCore
* kjs/grammar.y: Add rules for const declarations.
* kjs/keywords.table: Add const keyword.
* kjs/nodes.cpp:
(VarDeclNode::VarDeclNode): Add parameter.
(VarDeclNode::evaluate): Add const support.
(VarDeclNode::processVarDecls): Add const support.
(VarStatementNode::execute): Irrelevant change.
(ForInNode::ForInNode): Tell our variable node that it's a variable.
* kjs/nodes.h:
(KJS::VarDeclNode::): Add declaration of type enum, extra constructor parameter.
(KJS::VarStatementNode::VarStatementNode): Irrelevant change.
* kjs/function.cpp:
(KJS::GlobalFuncImp::call): Process var decls before evaluating.
2005-06-20 Maciej Stachowiak <mjs@apple.com>
Patch from Mark Rowe <opendarwin.org@bdash.net.nz>, reviewed by me.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3293
Test cases added:
* tests/mozilla/expected.html: Updated for two fixed tests.
- also added a layout test
* bindings/objc/objc_runtime.h:
* bindings/objc/objc_runtime.mm:
(ObjcFallbackObjectImp::hasOwnProperty):
* bindings/runtime_array.cpp:
(RuntimeArrayImp::hasOwnProperty):
* bindings/runtime_array.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::hasOwnProperty):
* bindings/runtime_object.h:
* kjs/array_instance.h:
* kjs/array_object.cpp:
(ArrayInstanceImp::hasOwnProperty):
* kjs/function.cpp:
(KJS::FunctionImp::hasOwnProperty):
(KJS::ActivationImp::hasOwnProperty):
* kjs/function.h:
* kjs/object.cpp:
(KJS::ObjectImp::hasProperty):
(KJS::ObjectImp::hasOwnProperty):
* kjs/object.h:
(KJS::Object::hasOwnProperty):
* kjs/object_object.cpp:
(ObjectPrototypeImp::ObjectPrototypeImp):
(ObjectProtoFuncImp::call):
* kjs/object_object.h:
(KJS::ObjectProtoFuncImp::):
* kjs/string_object.cpp:
(StringInstanceImp::hasOwnProperty):
* kjs/string_object.h:
2005-06-18 Darin Adler <darin@apple.com>
Reviewed by Eric Seidel.
* pcre/get.c: (pcre_get_substring): Fix some computations so this works for UTF-16.
This is unused in the current JavaScriptCore, but still good to fix.
2005-06-18 Darin Adler <darin@apple.com>
Change by Finlay Dobbie.
Reviewed by me.
- fixed <http://bugzilla.opendarwin.org/show_bug.cgi?id=3331>
10.3.9 Build Failure: NSString may not respond to `+stringWithCString:encoding:'
* bindings/objc/WebScriptObject.mm: (-[WebScriptObject stringRepresentation]):
Undo change we did a while back to work around the gcc 3.3 compiler error.
It no longer seems to happen, and the workaround code was 10.4-specific.
2005-06-16 Geoffrey Garen <ggaren@apple.com>
Fixed: <rdar://problem/4151759> 'delete' fails on variables declared inside 'eval' statements.
Reviewed by cblu.
* kjs/context.h:
(KJS::ContextImp::codeType): Added code type accessor for execution context objects.
* kjs/internal.cpp:
(ContextImp::ContextImp): Reflects change to ContextImp::codeType.
* kjs/nodes.cpp:
(VarDeclNode::evaluate): Added separate code path for variable declarations inside 'eval' statements.
* tests/mozilla/expected.html: Updated expected test results to reflect fix.
2005-06-14 Geoffrey Garen <ggaren@apple.com>
Updated expected.html to reflect fix to <rdar://problem/4147745>.
Reviewed by cblu.
* tests/mozilla/expected.html:
2005-06-14 Geoffrey Garen <ggaren@apple.com>
Fixed: <rdar://problem/4147745> JavaScript discards locally defined "arguments" property
No layout tests added because this change fixes existing tests:
ecma/ExecutionContexts/10.1.6.js
ecma_3/Function/regress-94506.js
js1_4/Functions/function-001.js
Reviewed by cblu.
* kjs/function.cpp:
(KJS::ActivationImp::get): get now checks for an "arguments" property defined in the local variable object
before trying to return the built-in arguments array.
* kjs/function.h: ActivationImp::put no longer overrides ObjectImp::put
2005-06-10 Darin Adler <darin@apple.com>
Change by Mark Rowe <opendarwin.org@bdash.net.nz>.
Reviewed by me.
- further improvements to exception file/line number fix
* kjs/nodes.h: Added setExceptionDetailsIfNeeded function.
* kjs/nodes.cpp: Updated macros to call the new setExceptionDetailsIfNeeded function.
(Node::setExceptionDetailsIfNeeded): Added.
2005-06-09 Darin Adler <darin@apple.com>
Change by Mark Rowe <opendarwin.org@bdash.net.nz>
Reviewed by me.
* kjs/nodes.cpp: Get rid of unneeded this->.
2005-06-08 Maciej Stachowiak <mjs@apple.com>
Change by Mark Rowe <opendarwin.org@bdash.net.nz>
Reviewed by me.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3327
(Exception When Setting Style to Invalid Value Lacks Line/File Information)
* kjs/nodes.cpp: Include source file and line number when making exception in
KJS_CHECKEXCEPTIONVALUE.
2005-06-07 Darin Adler <darin@apple.com>
Change by Toby Peterson <toby@opendarwin.org>.
Reviewed by me.
* JavaScriptCore.pbproj/project.pbxproj: Allow bison 2.0, which generates the file
with a different name.
2005-06-07 Darin Adler <darin@apple.com>
Change by Toby Peterson <toby@opendarwin.org>.
Reviewed by me.
* kjs/grammar.y: Remove bogus extra line from grammar.y. Toby got this change from KDE KJS.
2005-06-06 Darin Adler <darin@apple.com>
* tests/mozilla/run-mozilla-tests: Wrote a perl version of this so we don't require
the "jst" tool to run the tests.
2005-06-04 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- add libicu headers
* JavaScriptCore.pbproj/project.pbxproj: Added icu directory to header search path.
* icu/README: Added.
* icu/unicode/platform.h: Added.
* icu/unicode/uchar.h: Added.
* icu/unicode/uconfig.h: Added.
* icu/unicode/umachine.h: Added.
* icu/unicode/urename.h: Added.
* icu/unicode/utf.h: Added.
* icu/unicode/utf16.h: Added.
* icu/unicode/utf8.h: Added.
* icu/unicode/utf_old.h: Added.
* icu/unicode/utypes.h: Added.
* icu/unicode/uversion.h: Added.
2005-05-19 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- turned off exceptions and RTTI; seems to cut JavaScriptCore code size by about 22%
* JavaScriptCore.pbproj/project.pbxproj: Turn off exceptions and RTTI for both
the framework and testkjs tool.
2005-05-18 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- got rid of code that depended on RTTI
* kjs/collector.cpp:
(KJS::className): Added. Gets class name in a KJS way, rather than a C++ RTTI way.
(KJS::Collector::rootObjectClasses): Use className instead of typeid names.
2005-05-18 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix a failure seen in the Mozilla JavaScript tests where a live object was garbage-collected
when the only reference to it was in an argList on the stack
* kjs/list.h: Moved the operator= function into the .cpp file since it's too big to be
a good choice to inline.
* kjs/list.cpp: (KJS::List::operator=): Moved this formerly-inline function into a separate
file and added missing code to update valueRefCount. It's the latter that fixes the bug.
2005-05-16 Darin Adler <darin@apple.com>
Reviewed by Adele.
- fixed issues preventing us from compiling with newer versions of gcc 4.0
* kjs/ustring.cpp:
(KJS::operator==): Remove redundant and illegal KJS:: prefix on this function's definition.
(KJS::operator<): Ditto.
(KJS::compare): Ditto.
2005-05-09 Darin Adler <darin@apple.com>
Reviewed by John.
- turn on conservative GC unconditionally and start on SPI changes to
eliminate the now-unneeded smart pointers since we don't ref count any more
* kjs/value.h: Removed macros to turn conservative GC on and off.
Removed ref and deref functions.
(KJS::ValueImp::ValueImp): Removed non-conservative-GC code path.
(KJS::ValueImp::isUndefined): Added. New SPI to make it easier to deal with ValueImp directly.
(KJS::ValueImp::isNull): Ditto.
(KJS::ValueImp::isBoolean): Ditto.
(KJS::ValueImp::isNumber): Ditto.
(KJS::ValueImp::isString): Ditto.
(KJS::ValueImp::isObject): Ditto.
(KJS::Value::Value): Removed non-conservative-GC code path and made constructor no
longer explicit so we can quietly create Value wrappers from ValueImp *; inexpensive with
conservative GC and eases the transition.
(KJS::Value::operator ValueImp *): Added. Quietly creates ValueImp * from Value.
(KJS::ValueImp::marked): Removed non-conservative-GC code path.
* kjs/value.cpp:
(KJS::ValueImp::mark): Removed non-conservative-GC code path.
(KJS::ValueImp::isUndefinedOrNull): Added. New SPI to make it easier to deal with ValueImp directly.
(KJS::ValueImp::isBoolean): Ditto.
(KJS::ValueImp::isNumber): Ditto.
(KJS::ValueImp::isString): Ditto.
(KJS::ValueImp::asString): Ditto.
(KJS::ValueImp::isObject): Ditto.
(KJS::undefined): Ditto.
(KJS::null): Ditto.
(KJS::boolean): Ditto.
(KJS::string): Ditto.
(KJS::zero): Ditto.
(KJS::one): Ditto.
(KJS::two): Ditto.
(KJS::number): Ditto.
* kjs/object.h: Made constructor no longer explicit so we can quietly create Object
wrappers from ObjectImp *; inexpensive with conservative GC and eases the transition.
(KJS::Object::operator ObjectImp *): Added. Quietly creates ObjectImp * from Object.
(KJS::ValueImp::isObject): Added. Implementation of new object-related ValueImp function.
(KJS::ValueImp::asObject): Ditto.
* kjs/object.cpp:
(KJS::ObjectImp::setInternalValue): Remove non-conservative-GC code path.
(KJS::ObjectImp::putDirect): Ditto.
(KJS::error): Added. Function in the new SPI style to create an error object.
* kjs/internal.h: Added the new number-constructing functions as friends of NumberImp.
There may be a more elegant way to do this later; what's important now is the new SPI.
* kjs/collector.h: Remove non-conservative-GC code path and also take out some
unneeded APPLE_CHANGES.
* bindings/runtime_root.cpp:
(KJS::Bindings::addNativeReference): Remove non-conservative-GC code path.
(KJS::Bindings::removeNativeReference): Ditto.
(RootObject::removeAllNativeReferences): Ditto.
* bindings/runtime_root.h:
(KJS::Bindings::RootObject::~RootObject): Ditto.
(KJS::Bindings::RootObject::setRootObjectImp): Ditto.
* kjs/collector.cpp:
(KJS::Collector::allocate): Ditto.
(KJS::Collector::collect): Ditto.
(KJS::Collector::numGCNotAllowedObjects): Ditto.
(KJS::Collector::numReferencedObjects): Ditto.
(KJS::Collector::rootObjectClasses): Ditto.
* kjs/internal.cpp:
(NumberImp::create): Ditto.
(InterpreterImp::globalInit): Ditto.
(InterpreterImp::globalClear): Ditto.
* kjs/list.cpp:
(KJS::List::markProtectedLists): Ditto.
(KJS::List::clear): Ditto.
(KJS::List::append): Ditto.
* kjs/list.h:
(KJS::List::List): Ditto.
(KJS::List::deref): Ditto.
(KJS::List::operator=): Ditto.
* kjs/protect.h:
(KJS::gcProtect): Ditto.
(KJS::gcUnprotect): Ditto.
2005-05-09 Chris Blumenberg <cblu@apple.com>
Workaround gcc 3.3 internal compiler errors.
Reviewed by darin.
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject stringRepresentation]): call [NSString stringWithCString:encoding] rather than using @""
2005-05-09 Darin Adler <darin@apple.com>
* Makefile.am: Don't set up PBXIntermediatesDirectory explicitly;
Not needed to make builds work, spews undesirable error messages too.
2005-05-06 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- make building multiple trees with make work better
* Makefile.am: Set up Xcode build directory before invoking xcodebuild.
2005-05-04 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
<rdar://problem/4086570> Crash in JavaScriptCore with RSS Visualizer
* kjs/internal.cpp:
(InterpreterImp::mark): mark staticNaN, it is usually protected by the Number
prototype but there is a small window where it can get collected.
2005-05-04 Darin Adler <darin@apple.com>
Reviewed by Dave Hyatt.
- another gcc-4.0-related fix
* bindings/runtime_root.h: Take off extra namespace prefixes that apparently cause problems
compiling with gcc 4.0, although I have not observed the problems.
2005-05-04 Darin Adler <darin@apple.com>
Reviewed by Dave Hyatt.
- fixed build rules to match other projects
* JavaScriptCore.pbproj/project.pbxproj: Set deployment target to 10.3 in the build styles.
When built without a build style (by Apple B&I) we want to get the target from the
environment. But when built with a build style (by Safari engineers and others), we want
to use 10.3.
* Makefile.am: Took out extra parameters that make command-line building different from
Xcode building. Now that this is fixed, you should not get a full rebuild if you switch
from command line to Xcode or back.
2005-05-04 Maciej Stachowiak <mjs@apple.com>
- revert presumably accidental change to mozilla JS test expected results, this
was making the tests fail.
* tests/mozilla/expected.html:
2005-05-03 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/4102644> Crash in LiveConnect below KJS::Bindings::JavaInstance::stringValue() const
Correctly handle accessing nil objects from a Java object array.
Reviewed by John.
* bindings/jni/jni_runtime.cpp:
(JavaArray::valueAt):
2005-05-01 Darin Adler <darin@apple.com>
- move to Xcode native targets and stop checking in generated files
* JavaScriptCore.pbproj/project.pbxproj: Updated to use native targets and generate all the generated
files, so we don't have to check them in any more.
* Info.plist: Added. Native targets use a separate file for this.
* Makefile.am: Removed pcre and kjs SUBDIRS. Also removed code that deleted the embedded copy of this
framework, since we haven't been embedding it for some time.
* kjs/grammar_wrapper.cpp: Added. Shell used to compile grammar.cpp since we can't add a generated file
easily to the list of files to be compiled.
* kjs/.cvsignore: Removed.
* kjs/Makefile.am: Removed.
* kjs/array_object.lut.h: Removed.
* kjs/date_object.lut.h: Removed.
* kjs/grammar.cpp: Removed.
* kjs/grammar.cpp.h: Removed.
* kjs/grammar.h: Removed.
* kjs/lexer.lut.h: Removed.
* kjs/math_object.lut.h: Removed.
* kjs/number_object.lut.h: Removed.
* kjs/string_object.lut.h: Removed.
* pcre/.cvsignore: Removed.
* pcre/Makefile.am: Removed.
* pcre/chartables.c: Removed.
2005-04-28 Darin Adler <darin@apple.com>
Reviewed by Dave Harrison.
- fixed problems preventing us from compiling with gcc 4.0
* JavaScriptCore.pbproj/project.pbxproj: Removed -Wmissing-prototypes from
WARNING_CPLUSPLUSFLAGS since it's now a C-only warning.
* bindings/jni/jni_jsobject.cpp:
(JSObject::getSlot): Changed some %d to %ld where the parameters where long ints.
(JSObject::setSlot): Ditto.
* bindings/jni/jni_utility.cpp:
(KJS::Bindings::getJavaVM): Ditto.
(KJS::Bindings::getJNIEnv): Ditto.
* bindings/objc/objc_utility.mm: Fixed include of <JavascriptCore/internal.h> that needed the
letter "S" capitalized.
* kjs/bool_object.cpp: (BooleanProtoFuncImp::call): Rearranged how this function returns to
avoid incorrect gcc 4.0 warning.
* kjs/collector.cpp: (KJS::Collector::markStackObjectsConservatively): Changed code to check
the alignment of the passed-in pointers to only require pointer-level alignment, not 8-byte alignment.
Prevents a crash on garbage collect when compiled with gcc 4.0.
* kjs/nodes.cpp:
(WhileNode::execute): Added a redundant return after an infinite loop to work around incorrect gcc 4.0 warning.
(ForNode::execute): Ditto.
(SwitchNode::execute):Rearranged how this function returns to avoid incorrect gcc 4.0 warning.
(LabelNode::execute): Ditto.
* kjs/string_object.cpp: (replace): Ditto.
2005-04-26 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/4098713> Scripting API is incompatible with Mozilla
We were incompatible with Mozilla's implementation of the scripting APIs in
two ways:
Their NPN_SetException has the following signature:
void NPN_SetException(NPObject *npobj, const NPUTF8 *message);
ours has:
void NPN_SetException (NPObject * npobj, const NPString *message);
Also, they expect the string returned from NPN_UTF8FromIdentifier() to be freed by caller.
We do not.
I changed both behaviors to match Mozilla.
Reviewed by Chris.
* bindings/NP_jsobject.cpp:
(_NPN_SetException):
* bindings/npruntime.cpp:
(_NPN_UTF8FromIdentifier):
(_NPN_IntFromIdentifier):
(_NPN_SetExceptionWithUTF8):
* bindings/npruntime.h:
* bindings/npruntime_impl.h:
2005-04-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Chris.
<rdar://problem/4092136> reproducible crash in KJS::kjs_fast_realloc loading maps.google.com
* kjs/string_object.cpp:
(StringObjectFuncImp::call): Allocate adopted ustring buffer properly.
2005-04-22 Darin Adler <darin@apple.com>
Reviewed by Maciej.
* kjs/ustring.cpp: (KJS::UString::UTF8String): Fix off-by-one error in surrogate pair logic.
2005-04-22 Darin Adler <darin@apple.com>
Reviewed by John.
- fixed <rdar://problem/4090046> JavaScript throw statement causes parse error when no semicolon is present
* kjs/grammar.y: Added an additional rule for throw like the ones we have for all the other semicolon rules.
Not sure why we missed this one earlier.
* kjs/grammar.cpp: Regenerated.
=== JavaScriptCore-412.1 ===
2005-04-20 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- speedups, total 12% on JavaScript iBench
I ran the benchmark under Shark and followed its advice a lot, mainly.
* kjs/collector.cpp:
(KJS::Collector::allocate): Take out special case for 0; costing speed but unexercised.
Use numLiveObjectsAtLastCollect instead of numAllocationsSinceLastCollect so we don't
have to bump it each time we call allocate. Put numLiveObjects into a local variable to
cut down on global variable accesses. Make "next" cell pointer be a byte offset rather
than a pointer so we don't need a special case for NULL. Allow freeList to point to some
bogus item when the entire block is full rather than going out of our way to make it
point to NULL.
(KJS::Collector::markProtectedObjects): Get table size and pointer into locals outside
the loop to avoid re-loading them over and over again.
(KJS::Collector::collect): Put numLiveObjects into a local variable to cut down on global
variable accesses. Make "next" cell pointer be a byte offset as above. Put numLiveObjects
into a local variable to cut down on global variable accesses. Set numLiveObjectsAtLastCollect
rather than numAllocationsSinceLastCollect.
(KJS::Collector::numReferencedObjects): Get table size and pointer into locals outside
the loop to avoid re-loading them over and over again.
(KJS::Collector::rootObjectClasses): Ditto.
* kjs/internal.h: Make Value be a friend of NumberImp so it can construct number objects
directly, avoiding the conversion from Number to Value.
* kjs/internal.cpp: (StringImp::toObject): Don't use Object::dynamicCast, because we know
the thing is an object and we don't want to do all the extra work; just cast directly.
* kjs/list.cpp: (KJS::List::List): Construct valueRefCount in a way that avoids the need for
a branch -- in the hot case this just meant avoiding checking a variable we just set to false.
* kjs/lookup.cpp: (keysMatch): Marked this inline.
* kjs/nodes.cpp: Disabled KJS_BREAKPOINT, to avoid calling hitStatement all the time.
(BooleanNode::evaluate): Make a Value directly, rather than making a Boolean which is converted
into a Value.
(NumberNode::evaluate): Ditto.
(StringNode::evaluate): Ditto.
(ArrayNode::evaluate): Ditto.
(FunctionCallNode::evaluate): Use new inline baseIfMutable to avoid unnecessary getBase function.
Also just use a pointer for func, rather than an Object.
(PostfixNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
integer and back.
(DeleteNode::evaluate): Make a Value directly.
(TypeOfNode::evaluate): Use new inline baseIfMutable and make Value directly.
(PrefixNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
integer and back.
(UnaryPlusNode::evaluate): Make a Value directly.
(NegateNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
integer and back.
(BitwiseNotNode::evaluate): Make a Value directly.
(LogicalNotNode::evaluate): Ditto.
(ShiftNode::evaluate): Don't convert to a double before making a Value.
(RelationalNode::evaluate): Make a Value directly.
(EqualNode::evaluate): Ditto.
(BitOperNode::evaluate): Ditto.
(AssignNode::evaluate): Make a Value directly. Change code so that it passes a "known to be integer"
boolean in, often avoiding a conversion from floating point to integer and back.
(VarDeclNode::evaluate): Make a Value directly.
(ForNode::execute): Remove unused local variable.
* kjs/operations.h:
(KJS::isNaN): Inlined.
(KJS::isInf): Ditto.
(KJS::isPosInf): Ditto.
(KJS::isNegInf): Ditto.
* kjs/operations.cpp: Change isNaN, isInf, isPosInf, and isNegInf to be inlines.
(KJS::equal): Rewrite to avoid creating values and recursing back into the function.
(KJS::relation): Rearranged code so that we don't need explicit isNaN checks.
(KJS::add): Changed code to make Value directly, and so that it passes a "known to be integer"
boolean in, often avoiding a conversion from floating point to integer and back.
(KJS::mult): Ditto.
* kjs/property_map.cpp:
(KJS::PropertyMap::~PropertyMap): Get size and entries pointer outside loop to avoid
re-getting them inside the loop.
(KJS::PropertyMap::clear): Ditto. Clear value pointer in addition to key, so we can just
look at the value pointer in the mark function.
(KJS::PropertyMap::get): Get sizeMask and entries pointer outside loop to avoid
re-getting them inside the loop.
(KJS::PropertyMap::put): Ditto.
(KJS::PropertyMap::insert): Ditto.
(KJS::PropertyMap::remove): Ditto.
(KJS::PropertyMap::mark): Get size and entries pointer outside loop to avoid
re-getting them inside the loop. Don't bother checking key for 0, since we already have
to check value for 0. (Also had to change clear() to set value to 0.)
(KJS::PropertyMap::addEnumerablesToReferenceList): Get size and entries pointer outside
loop to avoid re-getting them inside the loop.
(KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Ditto.
(KJS::PropertyMap::save): Ditto.
- other changes
* kjs/protected_values.h: Remove unneeded class name qualifiers.
* kjs/reference.h:
(KJS::Reference::baseIfMutable): New inline function: replaces isMutable().
(KJS::Reference::Reference): Inlined.
* kjs/reference.cpp:
(KJS::Reference::getValue): Rewrite to not use getBase.
(KJS::Reference::putValue): Ditto.
(KJS::Reference::deleteValue): Dittol
* kjs/simple_number.h:
(KJS::SimpleNumber::integerFits): Added. For use when the parameter is known to be integral.
* kjs/string_object.cpp: (StringProtoFuncImp::call): Create the number without first converting
to double in various cases that involve integers.
* kjs/ustring.h:
(KJS::UString::attach): Inlined.
(KJS::UString::release): Inlined.
* kjs/ustring.cpp:
(KJS::UString::find): Get first character outside the loop instead of re-fetching it each time.
* kjs/value.cpp:
(Value::Value): Added overloads for all the various specific types of values, so you don't have
to convert from, say, Number to Value, just to create one.
(Number::Number): Added an overload that takes a boolean to indicate the number is already
known to be an integer.
* kjs/value.h: Added more Value constructors, added a version of toNumber that returns
a boolean to indicate if the number is known to be an integer (because it was a "simple number").
(KJS::ValueImp::marked): Inlined.
(KJS::ValueImp::dispatchType): Inlined.
(KJS::ValueImp::dispatchToPrimitive): Inlined.
(KJS::ValueImp::dispatchToBoolean): Inlined.
(KJS::ValueImp::dispatchToNumber): Inlined.
(KJS::ValueImp::dispatchToString): Inlined.
(KJS::ValueImp::dispatchToUInt32): Inlined.
2005-04-14 Maciej Stachowiak <mjs@apple.com>
- make fast_malloc.h a private header, not project
* JavaScriptCore.pbproj/project.pbxproj:
2005-04-12 Maciej Stachowiak <mjs@apple.com>
Reviewed by Richard.
<rdar://problem/4089734> JavaScript iBench can be sped up ~10% with custom allocator
- use custom single-threaded malloc for all non-GC JavaScriptCore
allocations, for a 9.1% speedup on JavaScript iBench
* JavaScriptCore.pbproj/project.pbxproj:
* kjs/collector.cpp:
(KJS::Collector::allocate): Use dlmalloc to allocate the collector blocks.
(KJS::Collector::collect): And dlfree to free it.
* kjs/fast_malloc.cpp: Added, just the standard dlmalloc here.
* kjs/fast_malloc.h: Added. Declarations for the functions. Also added a handy
macro to give a class custom operator new/delete
* kjs/identifier.cpp:
(KJS::Identifier::add): Use dlmalloc/dlfree.
* kjs/nodes.h: make nodes KJS_FAST_ALLOCATED.
* kjs/property_map.cpp:
(KJS::PropertyMap::~PropertyMap): Use dlmalloc/dlfree.
(KJS::PropertyMap::rehash): ditto
* kjs/scope_chain.h:
* kjs/ustring.cpp:
(KJS::UString::Rep::createCopying): New named constructor that copies a passed-in
buffer, to hide allocation details from webcore.
(KJS::UString::UString): use createCopying when appropriate.
(KJS::UString::Rep::destroy): Use dlmalloc/dlfree.
(KJS::UString::expandedSize): likewise
(KJS::UString::expandCapacity): likewise
(KJS::UString::expandPreCapacity): likewise
(KJS::UString::spliceSubstringsWithSeparators): likewise
(KJS::UString::append): likewise
(KJS::UString::operator=): likewise
(KJS::UString::detach): likewise
* kjs/ustring.h: make UString and UString::Rep KJS_FAST_ALLOCATED.
2005-04-11 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
<rdar://problem/4086819> Avoid using protect count hash table so much for 5.6% JS iBench speedup
- Avoid using protected values hash for the two most common cases
- Bump up ListImp high water mark, new testing shows 508 ListImps are
created during JS iBench.
Net result is a 5.6% speedup on JavaScript iBench
* kjs/collector.cpp:
(KJS::Collector::collect): mark protected lists as appropriate.
* kjs/context.h:
* kjs/list.cpp:
(KJS::ListImp::markValues): Moved implementation from List::markValues
(KJS::List::markProtectedLists): Implemented - scan pool and overflow
list.
(KJS::allocateListImp): link lists outside the pool into a separate
doubly linked list to be able to mark protected lists
(KJS::deallocateListImp): do the corresponding delinking
(KJS::List::derefValues): do nothing in conservative GC mode
(KJS::List::refValues): do nothing in conservative GC mode
(KJS::List::markValues): call ListImp version
(KJS::List::append):
* kjs/list.h:
=== Safari-412 ===
=== Safari-411 ===
=== Safari-410 ===
=== Safari-409 ===
=== Safari-408 ===
=== Safari-407 ===
2005-03-16 Jens Alfke <jens@apple.com>
Reviewed by Kevin.
Fix for <rdar://problem/4025212> "REGRESSION (163-164): search not performed correctly; united.com"
JavaScript unescape("") was returning a messed-up String object that appeared identical to an empty string, but would in some cases act as 'null' when passed to native functions, in this case the Option() constructor.
In the implementation of unescape, the UString holding the result was not initialized to "", so it started out as a null string. If nothing was appended to it, it remained null, resulting in a JavaScript String object with some bad behaviors (namely, converting it to a DOMStringImpl results in a NULL pointer.)
Darin says this regression occurred when we replaced our own implementation of unescape() with code from KJS.
* kjs/function.cpp:
(KJS::GlobalFuncImp::call):
2005-03-15 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/4053276> WebScripting protocol in WebKit cannot convert Boolean in Javascript to BOOL in Objective-C
Added JavaScript boolean to type that can be converted to
ObjC scalar parameters.
Reviewed by Ken Kocienda.
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertValueToObjcValue):
=== Safari-406 ===
=== Safari-405 ===
=== Safari-403 ===
=== Safari-402 ===
=== Safari-401 ===
=== Safari-400 ===
=== Safari-188 ===
2005-02-21 Darin Adler <darin@apple.com>
* kjs/date_object.cpp: (timetUsingCF): Fixed indenting.
2005-02-17 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/4003251> Safari crashed at www.icelandair.com in LiveConnect code converting a Java object to a string
Added nil check.
Reviewed by John Sullivan.
* bindings/jni/jni_runtime.cpp:
(JavaField::valueFromInstance):
=== Safari-187 ===
2005-02-11 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3985118> DOM objects not being marshaled on JS->native calls
Re-factored how 'native' wrappers for JS objects are created. The interpreter now
creates these wrappers. The WebCore subclass of the interpreter now overrides
createLanguageInstanceForValue() and creates a DOM ObjC wrapper for DOM objects.
Reviewed by Ken.
* bindings/c/c_utility.cpp:
(convertValueToNPVariant):
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
* bindings/jni/jni_objc.mm:
(KJS::Bindings::dispatchJNICall):
* bindings/jni/jni_runtime.cpp:
(JavaField::valueFromInstance):
(JavaArray::valueAt):
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject _setExecutionContext:KJS::Bindings::]):
(+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
* bindings/objc/WebScriptObjectPrivate.h:
* bindings/objc/objc_utility.h:
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertObjcValueToValue):
(KJS::Bindings::createObjcInstanceForValue):
* bindings/runtime.cpp:
(Instance::createBindingForLanguageInstance):
(Instance::createRuntimeObject):
(Instance::createLanguageInstanceForValue):
* bindings/runtime.h:
* kjs/interpreter.cpp:
(Interpreter::createLanguageInstanceForValue):
* kjs/interpreter.h:
=== Safari-186 ===
2005-02-10 Darin Adler <darin@apple.com>
"Reviewed" by Richard (he told me the file was obsolete).
- got rid of an obsolete file
* bindings/npsap.h: Removed.
=== Safari-185 ===
=== Safari-183 ===
2005-02-03 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3972905> CrashTracer: ...36 crashes at com.apple.WebCore: khtml::CSSStyleSelector::applyDeclarations + 120
Revert to old (and correct) behavior of returning runtime object
when passed as a parameter, rather than it's corresponding DOM
object.
Reviewed by Chris.
* bindings/objc/WebScriptObject.mm:
(+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
=== Safari-182 ===
2005-01-28 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3980389> JavaScript bindings access incorrect runtime object
Only use special 'back door' property to get the runtime object if thisObj isn't
already a runtime object.
<gratuitous> Cleaned up a couple of strcmp on ClassInfo name. Used == on
ClassInfo pointer instead.
Reviewed by Chris.
* bindings/c/c_utility.cpp:
(convertValueToNPVariant):
* bindings/objc/WebScriptObject.mm:
(+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
* bindings/runtime_method.cpp:
(RuntimeMethodImp::call):
=== Safari-181 ===
2005-01-26 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3972522> (179-180) 40% slowdown on iBench JavaScript test
I added a member variable to ObjectImp. This changed it's size and consequently
hampered the optimizations built into the garbage collector. Objects no longer
fit within the allocators cell size, and thus allocation fell back to a slower
allocator.
As a result of this fix I also dramatically cleaned up how runtime objects are
accessed. The path mostly *removes* code.
Reviewed by Chris.
* bindings/runtime_method.cpp:
(RuntimeMethodImp::call):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::get):
(RuntimeObjectImp::put):
(RuntimeObjectImp::canPut):
(RuntimeObjectImp::hasProperty):
(RuntimeObjectImp::defaultValue):
* bindings/runtime_object.h:
* kjs/object.cpp:
(KJS::ObjectImp::ObjectImp):
* kjs/object.h:
2005-01-20 Darin Adler <darin@apple.com>
Reviewed by me, changes by Han Ming Ong.
- <rdar://problem/3964302> SWB: A few files need to be updated to be compilable under GCC 4.0
* bindings/objc/WebScriptObjectPrivate.h: Make members public.
* kjs/lookup.h: Change "value.h" to "object.h" because we need KJS::Object to compile a template.
2005-01-20 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3964634> undefined property value from binding seems to evaluate to true in an if statement
The comprehensive fix for this problem requires new API, as described in 3965326. However,
given that we can't add new API at this point, the 'ObjcFallbackObjectImp' will behave
like and Undefined object if invokeUndefinedMethodFromWebScript:withArguments: isn't
implemented on the bound object.
Reviewed by Chris.
* bindings/objc/objc_runtime.h:
* bindings/objc/objc_runtime.mm:
(ObjcFallbackObjectImp::type):
(ObjcFallbackObjectImp::implementsCall):
(ObjcFallbackObjectImp::toBoolean):
* bindings/testbindings.mm:
(+[MyFirstInterface isSelectorExcludedFromWebScript:]):
(+[MyFirstInterface isKeyExcludedFromWebScript:]):
=== Safari-180 ===
2005-01-19 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3853676> Browser Crash when accessing CCWeb Progress Page - KJS::Bindings::convertValueToJValue
Fixed the following problems with LiveConnect that are demonstrated by the application
described in 3853676.
1. If a nil object is passed in an array from Java to JavaScript we will crash.
2. We sometimes will incorrectly attempt to access a generic JavaScript as a Java runtime object wrapper.
3. We will sometimes fail to find the correct static method ID.
Reviewed by Maciej.
* bindings/jni/jni_jsobject.cpp:
(JSObject::convertJObjectToValue):
(JSObject::listFromJArray):
* bindings/jni/jni_runtime.cpp:
(JavaField::valueFromInstance):
(JavaField::setValueToInstance):
* bindings/jni/jni_utility.cpp:
(KJS::Bindings::getMethodID):
(KJS::Bindings::convertValueToJValue):
* bindings/runtime_array.h:
2005-01-18 Richard Williamson <rjw@apple.com>
Fixed several issues all arising from analysis of plugin detection code at ifilm.com:
Fixed <rdar://problem/3958592> can't script plug-ins if plug-in is invoked with <object> element instead of <embed>
Fixed <rdar://problem/3958597> <object> elements with IDs do not show up as named properties of the document
Fixed <rdar://problem/3960973> DOM objects for plugin elements are not accessible
Fixed <rdar://problem/3958601> need an additional class ID in WebCore for the Real plug-in
We now support accessing scriptable plugin objects that are specified with <applet>, <embed>, or <object>
tags. Also, if any of these elements are named they can be accessed from the document or window objects.
Finally, DOM methods are properties will be forwarded appropriately for the plugin's root scriptable object.
Reviewed by Chris.
* bindings/objc/objc_instance.h:
* bindings/objc/objc_instance.mm:
(ObjcInstance::supportsSetValueOfUndefinedField):
* bindings/runtime.h:
(KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::RuntimeObjectImp):
(RuntimeObjectImp::get):
(RuntimeObjectImp::put):
(RuntimeObjectImp::canPut):
(RuntimeObjectImp::hasProperty):
(RuntimeObjectImp::defaultValue):
* bindings/runtime_object.h:
(KJS::RuntimeObjectImp::fallbackObject):
* kjs/object.cpp:
(KJS::ObjectImp::ObjectImp):
* kjs/object.h:
(KJS::ObjectImp::forwardingScriptMessage):
(KJS::ObjectImp::setForwardingScriptMessage):
2005-01-18 Richard Williamson <rjw@apple.com>
Back out a change that was incorrectly committed yesterday.
Reviewed by Chris.
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertValueToObjcValue):
2005-01-17 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3753030> Need to ensure same origin for plugin binding invocations (origin security rules)
Keep track of originating execution context and target execution
context for native JS object wrappers, and perform appropriate
security checks.
Reviewed by David Harrison.
* bindings/NP_jsobject.cpp:
(_isSafeScript):
(_NPN_CreateScriptObject):
(_NPN_Invoke):
(_NPN_Evaluate):
(_NPN_GetProperty):
(_NPN_SetProperty):
(_NPN_RemoveProperty):
(_NPN_HasProperty):
(_NPN_HasMethod):
(_NPN_SetException):
* bindings/NP_jsobject.h:
* bindings/c/c_instance.cpp:
(CInstance::CInstance):
(CInstance::stringValue):
* bindings/c/c_instance.h:
* bindings/c/c_utility.cpp:
(convertValueToNPVariant):
* bindings/jni/jni_instance.cpp:
(JavaInstance::JavaInstance):
(JavaInstance::valueOf):
* bindings/jni/jni_instance.h:
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject _initializeWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
(-[WebScriptObject _initWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
(-[WebScriptObject KJS::Bindings::]):
(-[WebScriptObject _setOriginExecutionContext:KJS::Bindings::]):
(-[WebScriptObject _isSafeScript]):
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(-[WebScriptObject evaluateWebScript:]):
(-[WebScriptObject setValue:forKey:]):
(-[WebScriptObject valueForKey:]):
(-[WebScriptObject removeWebScriptKey:]):
(-[WebScriptObject stringRepresentation]):
(-[WebScriptObject webScriptValueAtIndex:]):
(-[WebScriptObject setWebScriptValueAtIndex:value:]):
(+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
* bindings/objc/WebScriptObjectPrivate.h:
* bindings/objc/objc_instance.h:
* bindings/objc/objc_runtime.mm:
(convertValueToObjcObject):
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertValueToObjcValue):
* bindings/runtime.cpp:
(Instance::Instance):
(Instance::operator=):
* bindings/runtime.h:
(KJS::Bindings::Instance::Instance):
(KJS::Bindings::Instance::setExecutionContext):
(KJS::Bindings::Instance::executionContext):
* bindings/runtime_root.cpp:
(RootObject::setInterpreter):
* bindings/runtime_root.h:
* kjs/interpreter.h:
(KJS::Interpreter::isGlobalObject):
(KJS::Interpreter::interpreterForGlobalObject):
(KJS::Interpreter::isSafeScript):
=== Safari-179 ===
2005-01-13 Vicki Murley <vicki@apple.com>
Reviewed by Adele.
- fix <rdar://problem/3946836> Safari about box lists 2004 instead of 2005
* JavaScriptCore.pbproj/project.pbxproj: bump "2004" to "2005"
2005-01-12 Richard Williamson <rjw@apple.com>
Avoid additional work on dealloc by adding early out to
removeNativeReference(). (This will save time on dealloc
for all ObjC DOM objects.)
Reviewed by Darin.
* bindings/runtime_root.cpp:
(KJS::Bindings::removeNativeReference):
2005-01-12 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3923356> REGRESSION: Java/JavaScript security checks working incorrectly
We were always returning the first "root" object for all runtime
objects. Changed 0 in loop to i, the index.
Reviewed by David Harrison.
* bindings/runtime_root.cpp:
(KJS::Bindings::rootForImp):
2005-01-11 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3887930> Must use new Java plug-in API to get/set fields so exception handling works (fixes many LiveConnect crashes)
Use the new dispatching API to invoke JNI, rather than calling JNI
directly.
Reviewed by David Harrison.
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
* bindings/jni/jni_runtime.cpp:
(JavaField::dispatchValueFromInstance):
(JavaField::valueFromInstance):
(JavaField::dispatchSetValueToInstance):
(JavaField::setValueToInstance):
* bindings/jni/jni_runtime.h:
* bindings/jni/jni_utility.cpp:
(KJS::Bindings::convertValueToJValue):
=== Safari-178 ===
=== Safari-177 ===
=== Safari-176 ===
2004-12-17 Maciej Stachowiak <mjs@apple.com>
Reviewed by Kevin.
<rdar://problem/3926869> Opening caches window after running PLT causes crash
* kjs/protected_values.cpp:
(KJS::ProtectedValues::getProtectCount): Don't include simple numbers in
the protected value table.
(KJS::ProtectedValues::increaseProtectCount): Ditto.
(KJS::ProtectedValues::decreaseProtectCount): Ditto.
2004-12-16 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed <rdar://problem/3920764> Unimplemented String methods toLocaleLowerCase and toLocaleUpperCase
* kjs/string_object.h: Added toLocaleLowerCase and toLocaleUpperCase.
* kjs/string_object.cpp: (StringProtoFuncImp::call): Made locale versions be synonmyms for the
non-locale-specific versions.
* kjs/string_object.lut.h: Regenerated.
2004-12-14 Richard Williamson <rjw@apple.com>
Pass URL of plugin view when call into JNI.
Reviewed by Chris.
* bindings/jni/jni_objc.mm:
(KJS::Bindings::dispatchJNICall):
2004-12-13 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3827799> repro. crash with IBM Rational ClearCase Web under Safari (Java/LiveConnect-related)
Add support for calling static Java methods from JavaScript.
Reviewed by Maciej.
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
* bindings/jni/jni_runtime.cpp:
(JavaMethod::JavaMethod):
* bindings/jni/jni_runtime.h:
(KJS::Bindings::JavaMethod::isStatic):
* bindings/jni/jni_utility.cpp:
(callJNIStaticMethod):
(KJS::Bindings::callJNIBooleanMethod):
(KJS::Bindings::callJNIStaticBooleanMethod):
* bindings/jni/jni_utility.h:
2004-12-13 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3887767> LiveConnect doesn't propagate Java exceptions back to JavaScript (prevents security suite from running)
Reviewed by John.
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
* bindings/jni/jni_objc.mm:
(KJS::Bindings::dispatchJNICall):
* bindings/jni/jni_runtime.h:
* bindings/jni/jni_utility.h:
=== Safari-175 ===
2004-12-07 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
<rdar://problem/3908017> REGRESSION (172-173): assertion in ObjectImp::construct trying to create JS error (24hourfitness.com)
The fix was to implement copy constructor and assignment operator,
the ones that worked on the base class did not replace the
defaults apparently!
* kjs/protect.h:
(KJS::ProtectedValue::ProtectedValue):
(KJS::ProtectedValue::operator=):
(KJS::ProtectedObject::ProtectedObject):
(KJS::ProtectedObject::operator=):
Also fixed a bug in the GC test mode that compares the results of
the old collector and the new collector.
* kjs/value.cpp:
(ValueImp::mark):
=== Safari-173 ===
2004-11-23 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3890385> field and method cache incorrectly capped (c bindings)
Reviewed by Ken.
* bindings/c/c_class.cpp:
(CClass::_commonInit):
2004-11-21 Maciej Stachowiak <mjs@apple.com>
Reviewed by Ken.
<rdar://problem/3889696> Enable conservative garbage collection for JavaScript
* kjs/collector.cpp:
(KJS::Collector::Thread::Thread):
(KJS::destroyRegisteredThread):
(KJS::initializeRegisteredThreadKey):
(KJS::Collector::registerThread):
(KJS::Collector::markStackObjectsConservatively):
(KJS::Collector::markCurrentThreadConservatively):
(KJS::Collector::markOtherThreadConservatively):
* kjs/collector.h:
* kjs/internal.cpp:
(lockInterpreter):
* kjs/value.h:
=== Safari-172 ===
2004-11-15 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3880561> Default string value of ObjC object in JS should be [obj description].
Reviewed by Hyatt.
* bindings/objc/objc_instance.mm:
(ObjcInstance::stringValue):
* bindings/objc/objc_utility.h:
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertNSStringToString):
(KJS::Bindings::convertObjcValueToValue):
=== Safari-171 ===
2004-11-09 Chris Blumenberg <cblu@apple.com>
Fixed: <rdar://problem/3872724> soft link against JavaVM to save ~2MB RSHRD
Reviewed by rjw.
* ChangeLog:
* JavaScriptCore.pbproj/project.pbxproj: don't link against JavaVM
* bindings/softlinking.c: Added.
(loadFramework): new
(getFunctionPointer): new
(JNI_GetCreatedJavaVMs): load JavaVM if not already loaded, get _JNI_GetCreatedJavaVMs symbol if we don't already have it, call JNI_GetCreatedJavaVMs
=== Safari-170 ===
2004-11-04 Darin Adler <darin@apple.com>
Reviewed by Ken.
- fixed <rdar://problem/3865365> since -[WebScriptObject dealloc] does not call [super dealloc], the build will fail due to a warning
- fixed behavior so that [[WebScriptObject alloc] initWithCoder:] doesn't leak WebUndefined instances
and incidentally so that [[WebScriptObject alloc] init] returns the single shared instance rather
than allocating a new one
* bindings/objc/WebScriptObject.mm: Removed some stray semicolons.
(+[WebUndefined allocWithZone:]): Made this the common bottleneck that returns the single instance
of WebUndefined, since it's the single method that normally allocates new instances. Calls super to
actually allocate only the very first time it's called.
(-[WebUndefined initWithCoder:]): Simplified to just return self (no reason to re-lookup the single
shared instance since there can be only one).
(-[WebUndefined copyWithZone:]): Ditto.
(-[WebUndefined retain]): Ditto.
(-[WebUndefined retainCount]): Use UINT_MAX constant here (matches usage in NSObject.m for retain count
of class).
(-[WebUndefined autorelease]): Simplified to just return self (see above).
(-[WebUndefined copy]): No need to override this since it just turns around and calls copyWithZone:.
(-[WebUndefined dealloc]): Added an assertion since this method should never be called. Also added
a call to [super dealloc] after return; to make the new -Wdealloc-check compiler happy (fixing the
bug mentioned above).
(+[WebUndefined undefined]): Reimplemented; calls allocWithZone:NULL to get to the shared instance.
No need to call init, since that's a no-op for this class.
2004-11-03 David Harrison <harrison@apple.com>
Reviewed by Darin.
Eliminate the use of a marker file to determine how to build.
* .cvsignore:
* Makefile.am:
2004-11-01 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3861469> Latest Real player crashes Safari on some sites.
Reviewed by Ken.
* bindings/c/c_instance.cpp:
(CInstance::invokeMethod):
(CInstance::invokeDefaultMethod):
Initialize out parameters to void type.
* bindings/c/c_runtime.cpp:
(CField::valueFromInstance):
(CField::setValueToInstance):
Initialize out parameters to void type.
Also added additional checks to protect against classes that
don't implement all functions.
2004-11-01 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3861257> WebUndefined should be returned for undefined values
Reviewed by John.
* ChangeLog:
* bindings/objc/WebScriptObject.mm:
(+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
Added additional conversion Undefined -> WebUndefined.
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertObjcValueToValue):
Added additional conversion WebUndefined -> Undefined.
2004-11-01 Darin Adler <darin@apple.com>
- fixed <rdar://problem/3855573> Remove reference to "WebScriptMethods" from WebScriptObject.h comments
* bindings/objc/WebScriptObject.h: Removed unneeded #ifdef protection for multiple includes (since
this is an Objective-C header and we use #import for those). Fixed comments as requested in the bug
report to match the contents of the file.
=== Safari-169 ===
=== Safari-168 ===
2004-10-22 Ken Kocienda <kocienda@apple.com>
Reviewed by me
* JavaScriptCore.pbproj/project.pbxproj:
Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags.
=== Safari-167 ===
2004-10-13 Richard Williamson <rjw@apple.com>
Moved boolean checks prior to NSNumber checks. booleans are
NSNumbers.
Follow on to <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number.
Reviewed by John.
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertObjcValueToValue):
2004-10-12 Richard Williamson <rjw@apple.com>
Fixed access to DOM object via WebScriptObject API.
The execution context for DOM objects wasn't being found.
<rdar://problem/3831372> The valueForKey method for @"offsetLeft" on a paragraph element causes a crash.
Reviewed by Chris.
* bindings/objc/WebScriptObject.mm:
(_didExecute):
(-[WebScriptObject KJS::Bindings::]):
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(-[WebScriptObject evaluateWebScript:]):
(-[WebScriptObject setValue:forKey:]):
(-[WebScriptObject valueForKey:]):
(-[WebScriptObject stringRepresentation]):
* bindings/objc/WebScriptObjectPrivate.h:
2004-10-09 Darin Adler <darin@apple.com>
Reviewed by Kevin.
- fixed <rdar://problem/3804661> REGRESSION: JavaScriptCore framework now has two init routines
* bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was
creating an init routine.
* kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not
require a global constructor that creates an init routine.
2004-10-09 Darin Adler <darin@apple.com>
Reviewed by Kevin.
- fixed <rdar://problem/3822618> REGRESSION (164-165): expedia.com's popup help doesn't work
* kjs/reference.cpp: (Reference::putValue): Change so that references not found in any object
work with the window object of the page the function is in, not the page of the caller. This
is what all other browsers do. This code was hidden before by the "everything is defined on
window object" hack in WebCore.
2004-10-07 Richard Williamson <rjw@apple.com>
Added simple JavaScript call tracing. Very useful for
debugging complex pages.
Tracing is only available in development builds and is
enabled by:
(gdb) set traceJavaScript = 1
or programatically
setTraceJavaScript(true)
Function, args, and return values are printed to console. Very
verbose.
Reviewed by Ken.
* kjs/function_object.cpp:
(FunctionProtoFuncImp::call):
* kjs/object.cpp:
(KJS::Object::call):
=== Safari-166 ===
2004-10-05 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
Reviewed by Chris.
* bindings/NP_jsobject.cpp:
(_NPN_SetException):
* bindings/npruntime.cpp:
(_NPN_SetExceptionWithUTF8):
* bindings/objc/WebScriptObject.mm:
(+[WebScriptObject throwException:]):
* kjs/internal.h:
(KJS::InterpreterImp::context):
2004-10-05 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
Reviewed by Ken.
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertObjcValueToValue):
2004-10-04 Darin Adler <darin@apple.com>
Reviewed by Ken.
- rolled in a fix the KDE folks did for the operations that generate HTML fragments
* kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML.
- rolled out an old workaround we don't need any more
* JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the <math.h> issue that
required it is no longer there.
2004-09-30 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
Reviewed by Chris.
* bindings/NP_jsobject.cpp:
(_NPN_GetProperty):
(_NPN_HasProperty):
(_NPN_HasMethod):
* bindings/c/c_class.cpp:
(CClass::methodsNamed):
(CClass::fieldNamed):
* bindings/c/c_class.h:
* bindings/c/c_instance.cpp:
(CInstance::invokeMethod):
* bindings/jni/jni_class.cpp:
(JavaClass::methodsNamed):
* bindings/jni/jni_class.h:
* bindings/npruntime.h:
* bindings/objc/objc_class.h:
* bindings/objc/objc_class.mm:
(ObjcClass::methodsNamed):
* bindings/runtime.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::get):
(RuntimeObjectImp::hasProperty):
2004-09-29 Chris Blumenberg <cblu@apple.com>
Prepended underscores to NPN methods so that when the QT plug-in loads these symbols, it uses the non-underscore versions in WebKit. Without this, the QT plug-in was failing to load when launching Safari from the command-line.
Reviewed by rjw.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/NP_jsobject.cpp:
(_NPN_CreateScriptObject):
(_NPN_InvokeDefault):
(_NPN_Invoke):
(_NPN_Evaluate):
(_NPN_GetProperty):
(_NPN_SetProperty):
(_NPN_RemoveProperty):
(_NPN_HasProperty):
(_NPN_HasMethod):
* bindings/c/c_class.cpp:
(CClass::methodsNamed):
(CClass::fieldNamed):
* bindings/c/c_instance.cpp:
(CInstance::CInstance):
(CInstance::~CInstance):
(CInstance::operator=):
(CInstance::invokeMethod):
(CInstance::invokeDefaultMethod):
* bindings/c/c_runtime.cpp:
* bindings/c/c_runtime.h:
(KJS::Bindings::CField::name):
(KJS::Bindings::CMethod::name):
* bindings/npruntime.cpp:
(_NPN_GetStringIdentifier):
(_NPN_GetStringIdentifiers):
(_NPN_GetIntIdentifier):
(_NPN_IdentifierIsString):
(_NPN_UTF8FromIdentifier):
(_NPN_IntFromIdentifier):
(NPN_InitializeVariantWithObject):
(_NPN_ReleaseVariantValue):
(_NPN_CreateObject):
(_NPN_RetainObject):
(_NPN_ReleaseObject):
(_NPN_SetExceptionWithUTF8):
(_NPN_SetException):
2004-09-26 Darin Adler <darin@apple.com>
* kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and
low() to get Unicode value of character, and just use unicode().
2004-09-26 Darin Adler <darin@apple.com>
- refine charAt/charCodeAt fix slightly
* kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an
omitted parameter, as we do everywhere else, and as other browsers do here.
2004-09-26 Darin Adler <darin@apple.com>
Reviewed by Kevin.
- fixed <rdar://problem/3816097> REGRESSION: mailblocks, and presumably many other pages, failing because variable not found
* kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing
the program. We were doing this properly for functions, but not entire programs.
- fixed <rdar://problem/3814706> REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt()
* kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt
and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index.
* tests/mozilla/expected.html: Update for two tests that now pass with these changes.
=== Safari-165 ===
=== Safari-164 ===
2004-09-14 Richard Williamson <rjw@apple.com>
1. Add class parameter to object allocation function. This is somewhat redundant, given that
the allocation function is in the class function vector, but people wanted to use the same
allocation function for different classes.
2. Renamed NPN_Class to NPN_Invoke to match the name in the function vector.
3. Add support for a default function on an object. This is a feature that ActiveX supports,
and will allow JavaScript code to be written that will look exactly the same for both ActiveX
plugins and Netscape or WebKit plugins. There are implementations included for the 'C' and
'Objective-C' bindings.
There bugs are covered by
<rdar://problem/3776343> Support for default functions in the JavaScript bindings
<rdar://problem/3779186> NPN_Call needs to be renamed to NPN_Invoke
<rdar://problem/3674754> Need to implement latest npruntime.h
Reviewed by John.
* bindings/NP_jsobject.cpp:
(jsAllocate):
(NPN_InvokeDefault):
(NPN_Invoke):
* bindings/c/c_class.cpp:
* bindings/c/c_instance.cpp:
(CInstance::CInstance):
(CInstance::operator=):
(CInstance::invokeMethod):
(CInstance::invokeDefaultMethod):
* bindings/c/c_instance.h:
* bindings/c/c_runtime.cpp:
* bindings/c/c_runtime.h:
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeDefaultMethod):
* bindings/jni/jni_instance.h:
* bindings/npruntime.cpp:
(NPN_CreateObject):
* bindings/npruntime.h:
* bindings/objc/WebScriptObject.h:
* bindings/objc/objc_class.mm:
(ObjcClass::fallbackObject):
* bindings/objc/objc_instance.h:
* bindings/objc/objc_instance.mm:
(ObjcInstance::invokeDefaultMethod):
* bindings/objc/objc_runtime.h:
* bindings/objc/objc_runtime.mm:
(ObjcFallbackObjectImp::ObjcFallbackObjectImp):
(ObjcFallbackObjectImp::get):
(ObjcFallbackObjectImp::put):
(ObjcFallbackObjectImp::canPut):
(ObjcFallbackObjectImp::implementsCall):
(ObjcFallbackObjectImp::call):
(ObjcFallbackObjectImp::hasProperty):
(ObjcFallbackObjectImp::deleteProperty):
(ObjcFallbackObjectImp::defaultValue):
* bindings/runtime.h:
(KJS::Bindings::Class::fallbackObject):
(KJS::Bindings::Instance::getValueOfUndefinedField):
(KJS::Bindings::Instance::setValueOfUndefinedField):
(KJS::Bindings::Instance::valueOf):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::implementsCall):
(RuntimeObjectImp::call):
* bindings/runtime_object.h:
2004-09-13 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
<rdar://problem/3794735> Gmail- sending a very long message with Safari is so slow it seems like a hang
* kjs/string_object.cpp:
(StringProtoFuncImp::call): Replaced implementation of replace()
method with function below...
(replace): In order to avoid excessive allocation and copying,
figure out the ranges of the original string and replacement
strings to be assembled, instead of constantly creating new
strings at each substitution. The old behavior is basically O(N^2)
for a global replace on a pattern that matches many places in the
string.
(regExpIsGlobal): Helper function for the above.
(expandSourceRanges): ditto
(pushSourceRange): ditto
(expandReplacements): ditto
(pushReplacement): ditto
* kjs/ustring.cpp:
(KJS::UString::spliceSubstringsWithSeparators): New method that
pieces together substring ranges of this string together with
specified separators, all at one go.
* kjs/ustring.h:
(KJS::UString::Range::Range): Added new helper class to represent
substring choices.
2004-09-14 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- fixed <rdar://problem/3800315> encode-URI-test layout test is failing
* kjs/function.cpp:
(KJS::GlobalFuncImp::call): Make sure to escape null
characters. This is a bug in the new code that made part of the
test fail.
2004-09-13 Darin Adler <darin@apple.com>
Reviewed by Kevin and Maciej.
- new function to support fix for DIG bug in WebCore
* kjs/scope_chain.h: Added new push function that pushes another entire scope chain.
* kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto.
2004-09-12 Darin Adler <darin@apple.com>
* tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version
of escape and unescape.
2004-09-12 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed <rdar://problem/3798209> any non-ASCII characters are garbled in the result of toLocaleString
* kjs/date_object.cpp:
(formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that
uses CFDateFormatter.
(DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime.
2004-09-09 Maciej Stachowiak <mjs@apple.com>
Reviewed by Richard.
<rdar://problem/3493140> REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com
* kjs/function.cpp:
(KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with
ones from KDE KJS, which have the proper latin-1 behavior to match Win IE.
* kjs/lexer.cpp:
(Lexer::isHexDigit): Made static and non-const.
* kjs/lexer.h:
=== Safari-163 ===
2004-09-06 Darin Adler <darin@apple.com>
* JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3.
=== Safari-162 ===
2004-09-01 Richard Williamson <rjw@apple.com>
Add pid to exception messages (to help debug dashboard clients).
Reviewed by Chris.
* kjs/interpreter.cpp:
(Interpreter::evaluate):
=== Safari-161 ===
2004-08-20 Richard Williamson <rjw@apple.com>
Implemented new JNI abstraction. We no longer invoke Java methods
directly with JNI, rather we call into the plugin. This allows the
plugin to dispatch the call to the appropriate VM thread. This
change should (will?) fix a whole class of threading related problems with
the Java VM.
Reviewed by Hyatt.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/c/c_instance.h:
(KJS::Bindings::CInstance::setExecutionContext):
(KJS::Bindings::CInstance::executionContext):
* bindings/jni/jni_instance.cpp:
(JavaInstance::JavaInstance):
(JavaInstance::invokeMethod):
(JavaInstance::setExecutionContext):
(JavaInstance::executionContext):
* bindings/jni/jni_instance.h:
* bindings/jni/jni_jsobject.cpp:
(JSObject::convertJObjectToValue):
* bindings/jni/jni_runtime.cpp:
(JavaField::JavaField):
(JavaArray::convertJObjectToArray):
(JavaField::valueFromInstance):
(JavaArray::JavaArray):
(JavaArray::valueAt):
* bindings/jni/jni_runtime.h:
(KJS::Bindings::JavaArray::operator=):
(KJS::Bindings::JavaArray::executionContext):
* bindings/jni/jni_utility.h:
* bindings/objc/objc_instance.h:
(KJS::Bindings::ObjcInstance::setExecutionContext):
(KJS::Bindings::ObjcInstance::executionContext):
* bindings/runtime.cpp:
(Instance::createBindingForLanguageInstance):
* bindings/runtime.h:
* bindings/runtime_root.h:
(KJS::Bindings::RootObject::nativeHandle):
=== Safari-158 ===
2004-08-19 Vicki Murley <vicki@apple.com>
Reviewed by John.
* kjs/property_map.cpp:
(KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
2004-08-17 Darin Adler <darin@apple.com>
Reviewed by Adele.
- fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
* kjs/property_map.h: Added some private functions.
* kjs/property_map.cpp:
(KJS::PropertyMap::clear): Set sentinelCount to 0.
(KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
(KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
(KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
(KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
deleted-element sentinels.
(KJS::PropertyMap::checkConsistency): Check the sentinelCount.
2004-08-16 Maciej Stachowiak <mjs@apple.com>
Code change by Eric Albert, reviewd by me.
<rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
* kjs/date_object.cpp:
(timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
entirely would be even better, but is not required to fix this bug.
=== Safari-157 ===
2004-08-16 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
Reviewed by Chris.
* bindings/NP_jsobject.cpp:
(NPN_Evaluate):
* bindings/jni/jni_jsobject.cpp:
(JSObject::eval):
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject evaluateWebScript:]):
2004-08-15 Richard Williamson <rjw@apple.com>
More updates to np headers. Implemented new NPN functions.
Reviewed by Darin.
* bindings/NP_jsobject.cpp:
(NPN_HasProperty):
(NPN_HasMethod):
* bindings/npapi.h:
* bindings/npruntime.h:
2004-08-13 Darin Adler <darin@apple.com>
- fix build so we can compile again
* bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
is good enough so that we can compile, but it's only a stopgap measure, because I think
Richard has a newer one he wants to check in.
2004-08-12 Richard Williamson <rjw@apple.com>
Bring npruntime.h and friends closer to compliance with
latest spec.
Reviewed by Maciej.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/NP_jsobject.cpp:
(jsAllocate):
(_NPN_CreateScriptObject):
(NPN_Call):
(NPN_Evaluate):
(NPN_GetProperty):
(NPN_SetProperty):
(NPN_RemoveProperty):
* bindings/NP_jsobject.h:
* bindings/c/c_instance.cpp:
(CInstance::invokeMethod):
* bindings/c/c_utility.cpp:
(convertNPVariantToValue):
* bindings/npruntime.cpp:
(NPN_IdentifierIsString):
(NPN_VariantIsVoid):
(NPN_VariantIsNull):
(NPN_VariantIsUndefined):
(NPN_VariantIsBool):
(NPN_VariantIsInt32):
(NPN_VariantIsDouble):
(NPN_VariantIsString):
(NPN_VariantIsObject):
(NPN_VariantToBool):
(NPN_VariantToString):
(NPN_VariantToInt32):
(NPN_VariantToDouble):
(NPN_VariantToObject):
(NPN_InitializeVariantAsVoid):
(NPN_InitializeVariantAsNull):
(NPN_InitializeVariantAsUndefined):
(NPN_InitializeVariantWithBool):
(NPN_InitializeVariantWithInt32):
(NPN_InitializeVariantWithDouble):
(NPN_InitializeVariantWithString):
(NPN_InitializeVariantWithStringCopy):
(NPN_InitializeVariantWithObject):
(NPN_InitializeVariantWithVariant):
(NPN_ReleaseVariantValue):
(NPN_CreateObject):
* bindings/npruntime.h:
(_NPString::):
(_NPString::_NPVariant::):
* bindings/npruntime_priv.h: Added.
2004-08-12 Darin Adler <darin@apple.com>
Reviewed by Adele.
- fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
* kjs/function.cpp:
(KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
(KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
(KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
to skip leading "+" or "-".
=== Safari-156 ===
2004-08-12 Darin Adler <darin@apple.com>
Reviewed by Ken.
- fixed 43 Mozilla JavaScript tests
* kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
* kjs/date_object.cpp:
(DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
than constructing a number object to pass to it.
(DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
(KJS::parseDate): Change to return a double instead of creating the Number object here.
(KJS::timeClip): Implement this as specified in the language standard.
* kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
flags on the prototype property.
* kjs/function.cpp:
(KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
currently in scope.
(KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
file later.
(KJS::parseDigit): Added. Helper function for parseInt.
(KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
strtoll can handle. Also matches standard more closely.
(KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
instead of 0.
(KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
* kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
* kjs/lexer.h: Added error flag and sawError() function for detecting errors.
* kjs/lexer.cpp:
(Lexer::setCode): Clear error state.
(Lexer::lex): Set error state if the lexer encounters an error
* kjs/internal.cpp:
(NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
(Parser::parse): Use new lexer error method so those errors are treated like parser errors.
* kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
Change round to round values between -0.5 and -0 to -0 instead of +0.
* kjs/nodes.h: Add evaluateReference function to GroupNode.
* kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
would change x.y into a value that can't be deleted as a side effect.
* kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
the specification.
* kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
get rid of the fixed size limit for code.
* kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
returns the string without creating a new Rep, since I'm using substr in a place where it will
often be passed a 0.
* tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
the other day that was making a couple tests fail.
* tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
* tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
* tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
* tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
* tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
* kjs/string_object.lut.h: Regenerated.
2004-08-11 Darin Adler <darin@apple.com>
- fixed a tiny problem with the UTF-16 PCRE check-in
* pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
the ctype_meta flag to get set in items that should not have it.
* pcre/chartables.c: Regenerated.
2004-08-10 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
The following WebScripting methods are now supported on bound
objects:
- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
- (void)setValue:(id)value forUndefinedKey:(NSString *)key
- (id)valueForUndefinedKey:(NSString *)key
Reviewed by Chris.
* bindings/c/c_class.cpp:
(CClass::fieldNamed):
* bindings/c/c_class.h:
* bindings/jni/jni_class.cpp:
(JavaClass::fieldNamed):
* bindings/jni/jni_class.h:
* bindings/objc/objc_class.h:
(KJS::Bindings::ObjcClass::isa):
* bindings/objc/objc_class.mm:
(ObjcClass::methodsNamed):
(ObjcClass::fieldNamed):
(ObjcClass::fallbackObject):
* bindings/objc/objc_instance.h:
* bindings/objc/objc_instance.mm:
(ObjcInstance::invokeMethod):
(ObjcInstance::setValueOfField):
(ObjcInstance::setValueOfUndefinedField):
(ObjcInstance::getValueOfField):
(ObjcInstance::getValueOfUndefinedField):
* bindings/objc/objc_runtime.h:
(KJS::Bindings::ObjcField::~ObjcField):
(KJS::Bindings::ObjcField::ObjcField):
(KJS::Bindings::ObjcField::operator=):
(KJS::Bindings::FallbackObjectImp::classInfo):
* bindings/objc/objc_runtime.mm:
(ObjcField::ObjcField):
(ObjcField::name):
(ObjcField::type):
(ObjcField::valueFromInstance):
(ObjcField::setValueToInstance):
(FallbackObjectImp::FallbackObjectImp):
(FallbackObjectImp::get):
(FallbackObjectImp::put):
(FallbackObjectImp::canPut):
(FallbackObjectImp::implementsCall):
(FallbackObjectImp::call):
(FallbackObjectImp::hasProperty):
(FallbackObjectImp::deleteProperty):
(FallbackObjectImp::defaultValue):
* bindings/runtime.h:
(KJS::Bindings::Class::fallbackObject):
(KJS::Bindings::Instance::getValueOfUndefinedField):
(KJS::Bindings::Instance::setValueOfUndefinedField):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::get):
(RuntimeObjectImp::put):
(RuntimeObjectImp::canPut):
(RuntimeObjectImp::hasProperty):
* bindings/testbindings.mm:
(-[MyFirstInterface valueForUndefinedKey:]):
(-[MyFirstInterface setValue:forUndefinedKey:]):
2004-08-10 Darin Adler <darin@apple.com>
Reviewed by Dave.
- switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
* pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
or uint16_t depending on the mode, and used appropriate in the 7 public functions
that need to use it.
* pcre/pcre.c: Add UTF-16 support to all functions.
* pcre/study.c: Ditto.
* pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
the mode. Changed declarations to use symbolic constants and typedefs so we size
things to ichar when needed.
* pcre/maketables.c: (pcre_maketables): Change code to make tables that are
sized to 16-bit characters instead of 8-bit.
* pcre/get.c:
(pcre_copy_substring): Use pcre_char instead of char.
(pcre_get_substring_list): Ditto.
(pcre_free_substring_list): Ditto.
(pcre_get_substring): Ditto.
(pcre_free_substring): Ditto.
* pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
of hard-coding 8-bit table sizes.
* pcre/chartables.c: Regenerated.
* kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
* kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
is not null. The null string still has a null pointer. This prevents us from
passing a null through to the regular expression engine (which results in a null
error even when the string length is 0).
* kjs/regexp.cpp:
(KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
(KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
2004-08-09 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed 28 Mozilla JavaScript tests
* kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
checking the number of arguments for the join method.
* kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
than integers, so we aren't limited to 32 bits.
* kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
the implementation of the pow operation. Also simplied a case that was handling positive
and negative infinity separately.
* kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
putting them in a long, so that unsigned shift will work properly.
* kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
* kjs/operations.cpp:
(KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
sign of isinf; our isinf function returns +1 even for negative infinity.
(KJS::isNegInf): And again.
(KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
Our floating point already handles the various infinity cases correctly.
* kjs/regexp_object.cpp:
(RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
(RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
array in cases where we did not match.
(RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
"global", "ignoreCase", "multiline", and "source".
* kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
string into undefined rather than an empty string. For the slice method, handle an
undefined parameter for the limit properly as decribed in the specification, and add
the limit to one case that didn't have the limit at all. For the methods that generate
HTML strings, use lowercase tags instead of uppercase.
* kjs/ustring.cpp:
(KJS::UChar::toLower): Use u_tolower from the ICU library.
(KJS::UChar::toUpper): Use u_toupper from the ICU library.
(KJS::UString::append): Fix some math that caused a buffer overflow.
(KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
flag) rather than converting them all to 0.
(KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
* tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
* tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
the Unicode specification in a few cases where it was wrong before.
* tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
* tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
* tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
* tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
* tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
* tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
* tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
* tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
* tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
* JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
* kjs/number_object.lut.h: Regenerated.
2004-08-09 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
* kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
we get a buffer overflow.
=== Safari-155 ===
2004-08-05 Richard Williamson <rjw@apple.com>
Fixed part of 3674747. The QT guys need this for feature freeze.
This patch implements support for the
- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
method of objects bound to JavaScript.
Reviewed by John.
* ChangeLog:
* bindings/objc/objc_class.mm:
(ObjcClass::methodsNamed):
(ObjcClass::fieldNamed):
* bindings/objc/objc_instance.mm:
(ObjcInstance::invokeMethod):
* bindings/objc/objc_runtime.h:
(KJS::Bindings::ObjcMethod::~ObjcMethod):
(KJS::Bindings::ObjcMethod::isFallbackMethod):
(KJS::Bindings::ObjcMethod::javaScriptName):
* bindings/objc/objc_runtime.mm:
(ObjcMethod::ObjcMethod):
(ObjcMethod::getMethodSignature):
(ObjcMethod::setJavaScriptName):
* bindings/testbindings.mm:
2004-08-04 Vicki Murley <vicki@apple.com>
Reviewed by mjs.
- fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error
* kjs/lexer.cpp:
(Lexer::lex): if the current character is a '\' and the next character is a line terminator,
go to the next line and continue parsing the string (instead of failing). This matches
behavior in Mac IE and Mozilla.
2004-08-03 Kevin Decker <kdecker@apple.com>
Reviewed by Darin.
Rolled in changes from the latest KJS sources that support additional
Number.prototype functions.
Specifically this patch covers the follow parts of the ECMA 3 spec:
15.7.4.5, 15.7.4.6, and 15.7.4.7
Fixes:
<rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
<rdar://problem/3749492> missing Number.toPrecision prototype implementation
<rdar://problem/3749591> missing Number.toExponential prototype implementation
* kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
list of supported identifiers (a macro).
* kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
and toExponential().
(NumberPrototypeImp::NumberPrototypeImp):
(NumberProtoFuncImp::call):
* kjs/number_object.h: Added property names for toFixed, toPrecision,
and toExponential.
(KJS::NumberProtoFuncImp::):
* tests/mozilla/expected.html: Update results.
2004-08-03 Darin Adler <darin@apple.com>
Reviewed by Ken.
- added support for copying RegExp objects so 7 more Mozilla regexp tests pass
* kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
we are supposed to just copy the regular expression object, and do so.
Also tighten up arguments check to handle case where an actual "undefined"
is passed rather than just omitting an argument.
* tests/mozilla/expected.html: Update results.
2004-08-02 Darin Adler <darin@apple.com>
* tests/mozilla/.cvsignore: Added.
* tests/mozilla/expected.html: Update results.
2004-08-02 Darin Adler <darin@apple.com>
Reviewed by Ken.
- fixed RegExp.toString so 3 more Mozilla regexp tests pass
* kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
Append the flags here so more tests paseed.
2004-08-02 Darin Adler <darin@apple.com>
Reviewed by Ken.
- fixed a couple things making 5 Mozilla regexp tests pass
* kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
for the prototype.
(RegExpObjectImp::construct): Fix bug where the string "undefined" would
be used as the flags string when no parameter was passed.
* kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
Added a class info object for RegExp prototype so it can return
a string instead of raising an exception when converting to a string.
* tests/mozilla/expected.html: Update results.
2004-08-02 Darin Adler <darin@apple.com>
Reviewed by Kevin.
- fix crashes in mozilla tests due to mishandling NaN
* kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
calls to toInteger so that NaN will get turned into something that fits in an integer.
These were the ones John already fixed, but his fix used isnan and the new fix is
more efficient.
* kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
after a call to toInteger to handle NaN properly. Also removed separate check
for undefined that's not needed.
* kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
as in the above two files, but for a lot more functions. Also changed one place with
an explicit check for undefined to instead just check isNaN.
* tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
like me who don't keep $SYMROOTS in their $PATH.
=== Safari-154 ===
=== Safari-153 ===
2004-07-26 Kevin Decker <kdecker@apple.com>
Changes done by Darin, reviewed by Kevin.
- changed testkjs to build in Xcode rather than from Makefile
* .cvsignore: Removed obsolete files from this list.
* Makefile.am: Removed code to build testkjs; we do this in Xcode now.
Changed to build target "All" rather than default target. This makes us
build the testkjs test tool.
* dummy.cpp: Removed.
* kjs/.cvsignore: Removed obsolete files from this list, including
the testkjs tool, which is now built in the symroots directory.
* kjs/testkjs.cpp: Added copyright notice that was missing, since we have
changed this file. Also this has the nice side effect of causing the tool
to be rebuilt in the new location even if there are no other changes in
your tree when you check this out.
* tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
without setting the execute bit on jsDriver.pl.
2004-07-22 Kevin Decker <kdecker@apple.com>
Reviewed by Darin
Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions).
* kjs/function_object.cpp:
(FunctionObjectImp::construct):
* kjs/function_object.h:
* kjs/object.cpp:
(KJS::ObjectImp::construct):
* kjs/object.h:
(KJS::Object::construct):
2004-07-21 Darin Adler <darin@apple.com>
* bindings/npruntime.h: Fixed typo.
2004-07-19 John Sullivan <sullivan@apple.com>
Reviewed by Maciej.
- bulletproofed array.slice() against NAN arguments. Harri noticed this
vulnerability in my patch for 3714644
* kjs/array_object.cpp:
(ArrayProtoFuncImp::call):
handle NAN parameters passed to slice() by clamping to 0 and length.
2004-07-19 Richard Williamson <rjw@apple.com>
Fixed 3733349. Prevent Java applet callbacks into JavaScript after applet
has been destroyed.
Reviewed by John.
* bindings/jni/jni_jsobject.cpp:
(JSObject::invoke):
(JSObject::JSObject):
2004-07-16 John Sullivan <sullivan@apple.com>
Reviewed by Maciej.
- fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link
hangs browser with javascript
* kjs/array_object.cpp:
(ArrayProtoFuncImp::call):
Check for undefined type for args[0] the same way we were already checking
for args[1]. In this case, args was zero-length, but we were treating
args[0] like an integer anyway. Resulted in some code looping from a NAN
value to 4, taking approximately forever.
* JavaScriptCore.pbproj/project.pbxproj:
version wars
=== Safari-152 ===
2004-07-14 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
<rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
<rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
* kjs/number_object.cpp:
(NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
2004-07-13 Kevin Decker <kdecker@apple.com>
Reviewed by kocienda.
- made testkjs and JavaScriptCore a subtarget of 'All'
- testkjs now builds in $SYMROOTS
* JavaScriptCore.pbproj/project.pbxproj:
=== Safari-151 ===
2004-06-24 Chris Blumenberg <cblu@apple.com>
Ignore .mode1 files in JavaScriptCore.pbproj
Reviewed by kocienda.
* JavaScriptCore.pbproj/.cvsignore:
2004-06-23 Richard Williamson <rjw@apple.com>
Implemented changes for latest npruntime.h.
Reviewed by Chris.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/NP_jsobject.cpp:
(listFromVariantArgs):
(identiferFromNPIdentifier):
(_NPN_CreateScriptObject):
(NPN_Call):
(NPN_Evaluate):
(NPN_GetProperty):
(NPN_SetProperty):
(NPN_RemoveProperty):
* bindings/NP_jsobject.h:
* bindings/c/c_class.cpp:
(CClass::methodsNamed):
(CClass::fieldNamed):
* bindings/c/c_instance.cpp:
(CInstance::invokeMethod):
* bindings/c/c_utility.cpp:
(convertNPVariantToValue):
* bindings/c/c_utility.h:
* bindings/npruntime.cpp:
(stringIdentifierEqual):
(stringIdentifierHash):
(getStringIdentifierDictionary):
(intIdentifierEqual):
(intIdentifierHash):
(getIntIdentifierDictionary):
(NPN_GetStringIdentifier):
(NPN_GetStringIdentifiers):
(NPN_GetIntIdentifier):
(NPN_IdentifierIsString):
(NPN_UTF8FromIdentifier):
(NPN_VariantToInt32):
(NPN_VariantToDouble):
(NPN_SetException):
* bindings/npruntime.h:
* bindings/objc/WebScriptObject.mm:
(+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::~RuntimeObjectImp):
* bindings/runtime_root.cpp:
(KJS::Bindings::rootForInterpreter):
* bindings/testbindings.cpp:
(initializeIdentifiers):
(logMessage):
(setDoubleValue):
(setIntValue):
(setBooleanValue):
=== JavaScriptCore-146.1 ===
2004-06-16 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
This turned out to be a show stopper for Dashboard. Accessing a nil
ObjC property from JS caused a crash. Similar to the problem
3696112 fixed below.
Reviewed by Trey.
* bindings/objc/objc_runtime.mm:
(KJS::Bindings::ObjcField::valueFromInstance):
=== Safari-146 ===
2004-06-16 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
This turned out to be a show stopper for Dashboard. We now
return Undefined() when nil is returned from a ObjC method
that returns an object type.
Reviewed by Maciej.
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertObjcValueToValue):
=== Safari-145 ===
2004-06-15 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
No longer need to check respondsToSelector: for
isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
because these now have a default implementation on NSObject.
Reviewed by Trey.
* bindings/objc/objc_class.mm:
(ObjcClass::methodsNamed):
(ObjcClass::fieldNamed):
2004-06-14 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed some things for GC that Patrick missed, or that happened after the branch
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
(-[WebScriptObject finalize]): Added.
- added some missing nil checks
* bindings/objc/objc_instance.mm:
(ObjcInstance::ObjcInstance): Check for nil.
(ObjcInstance::~ObjcInstance): Check for nil.
(ObjcInstance::operator=): Check for nil.
2004-06-14 Darin Adler <darin@apple.com>
Reviewed by me, code changes by Patrick Beard.
- fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
* bindings/objc/objc_instance.mm:
(ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
(ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
(ObjcInstance::operator=): More of the same.
(ObjcInstance::end): Use [pool drain] if compiling on Tiger.
* bindings/objc/objc_runtime.mm:
(ObjcArray::ObjcArray): Use CFRetain instead of retain.
(ObjcArray::~ObjcArray): Use CFRelease instead of release.
(ObjcArray::operator=): More of the same.
* bindings/testbindings.mm: Fixed incorrect license.
(main): Use [pool drain] if compiling on Tiger.
=== Safari-144 ===
2004-06-10 Kevin Decker <kdecker@apple.com>
Reviewed by John.
* kjs/lexer.cpp:
(Lexer::setCode):
- fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
* kjs/lexer.h:
(KJS::Lexer::lineNo):
- fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
=== JavaScriptCore-143.2 ===
2004-06-07 Darin Adler <darin@apple.com>
- fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
* kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
* kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
=== JavaScriptCore-143.1 ===
2004-06-04 Kevin Decker <kdecker@apple.com>
Reviewed by Darin
- fixed <rdar://problem/3680594>
* kjs/object.cpp:
(KJS::Error::create):
=== Safari-143 ===
2004-06-04 Darin Adler <darin@apple.com>
* kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
2004-06-04 Kevin Decker <kdecker@apple.com>
Reviewed by Dave.
- ObjC bindings do not (yet) pass along sourceurl or line numbers
- we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
- changed the wording of an error message
- the lexer, parser, and interpreter have been made "sourceURL aware"
- stored the url into Error
* bindings/NP_jsobject.cpp:
(NPN_Evaluate):
* bindings/jni/jni_jsobject.cpp:
(JSObject::eval):
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject evaluateWebScript:]):
* kjs/function.cpp:
(GlobalFuncImp::call):
* kjs/function_object.cpp:
(FunctionObjectImp::construct):
* kjs/internal.cpp:
(Parser::parse):
(InterpreterImp::checkSyntax):
(InterpreterImp::evaluate):
* kjs/internal.h:
* kjs/interpreter.cpp:
(Interpreter::evaluate):
* kjs/interpreter.h:
* kjs/lexer.cpp:
(Lexer::setCode):
* kjs/lexer.h:
(KJS::Lexer::sourceURL):
* kjs/nodes.cpp:
(Node::Node):
(Node::throwError):
(FunctionCallNode::evaluate):
* kjs/nodes.h:
* kjs/object.cpp:
(KJS::Error::create):
* kjs/object.h:
2004-06-04 Richard Williamson <rjw@apple.com>
Fixed crash when attempting to access properties on nil
object.
Reviewed by John.
* bindings/objc/objc_instance.mm:
(ObjcInstance::getClass):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::get):
* bindings/testM.js:
* bindings/testbindings.mm:
(-[MyFirstInterface getString]):
2004-05-27 Kevin Decker <kdecker@apple.com>
Reviewed by Ken.
-revised generated error message content
* kjs/error_object.cpp:
(ErrorProtoFuncImp::call):
* kjs/internal.cpp:
(Parser::parse):
* kjs/object.cpp:
(KJS::Error::create):
=== Safari-142 ===
2004-05-27 Richard Williamson <rjw@apple.com>
Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
Reviewed by Chris.
* bindings/objc/WebScriptObject.h:
2004-05-27 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- moved to new symlink technique for embedding frameworks
* JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
because we don't need it any more.
2004-05-24 Richard Williamson <rjw@apple.com>
Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
fixed ClassInfo to correctly reflect inheritance. This is required
because of the runtime checks in JSC for arrays, i.e. in
the Function objects apply method.
Reviewed by Ken.
* bindings/jni/jni_runtime.cpp:
(JavaArray::convertJObjectToArray):
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertObjcValueToValue):
* bindings/runtime_array.cpp:
(RuntimeArrayImp::RuntimeArrayImp):
* bindings/runtime_array.h:
* bindings/testM.js: Added.
* bindings/testbindings.mm:
(+[MyFirstInterface webScriptNameForSelector:]):
(-[MyFirstInterface logMessages:]):
(-[MyFirstInterface logMessage:prefix:]):
(-[MyFirstInterface callJSObject::]):
2004-05-22 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
* kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
it hasn't been set explicitly.
=== Safari-141 ===
2004-05-20 Richard Williamson <rjw@apple.com>
Implemented WebScriptObject/DOM wrapper voodoo. DOM wrappers
can now be referenced like any other WebScriptObject, meaning
you can do JS operations on them.
All added implementation of finalizeForWebScript.
Reviewed by Ken.
* bindings/objc/WebScriptObject.h:
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
(-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
(-[WebScriptObject KJS::]):
(-[WebScriptObject dealloc]):
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(-[WebScriptObject evaluateWebScript:]):
(-[WebScriptObject setValue:forKey:]):
(-[WebScriptObject valueForKey:]):
(-[WebScriptObject stringRepresentation]):
* bindings/objc/WebScriptObjectPrivate.h:
* bindings/objc/objc_instance.mm:
(ObjcInstance::~ObjcInstance):
2004-05-19 Richard Williamson <rjw@apple.com>
Removed extraneous tabs that were added (by XCode?).
* bindings/objc/WebScriptObject.h:
2004-05-19 Darin Adler <darin@apple.com>
- fixed headers with licenses mangled by Xcode auto-indenting
* bindings/jni/jni_jsobject.cpp:
* bindings/jni/jni_jsobject.h:
* bindings/runtime_array.h:
* bindings/runtime_root.cpp:
* bindings/runtime_root.h:
2004-05-18 Richard Williamson <rjw@apple.com>
Added exception logging. Also check for exception and
set results as appropriate.
Reviewed by Maciej (partially reviewed).
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(-[WebScriptObject evaluateWebScript:]):
(-[WebScriptObject setValue:forKey:]):
(-[WebScriptObject valueForKey:]):
2004-05-18 Richard Williamson <rjw@apple.com>
Finsished implementing support for windowScriptObject.
Had to make WebScriptObjectPrivate.h accessible from
WebCore.
Reviewed by Maciej.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/objc/WebScriptObjectPrivate.h:
2004-05-18 Richard Williamson <rjw@apple.com>
Use KVC to set/get values instead of directly accessing
ivars.
Reviewed by Maciej.
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
* bindings/objc/objc_runtime.mm:
(ObjcField::valueFromInstance):
(convertValueToObjcObject):
(ObjcField::setValueToInstance):
2004-05-17 Richard Williamson <rjw@apple.com>
Implemented new API for WebScriptObject.
Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object) (w/ help from Vicki)
Reviewed by Hyatt.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/c/c_instance.cpp:
(CInstance::invokeMethod):
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
* bindings/jni/jni_jsobject.cpp:
(JSObject::convertValueToJObject):
* bindings/jni/jni_utility.cpp:
(KJS::Bindings::getJNIField):
* bindings/objc/WebScriptObject.mm:
(_didExecute):
(-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
(-[WebScriptObject KJS::]):
(-[WebScriptObject dealloc]):
(+[WebScriptObject throwException:]):
(listFromNSArray):
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(-[WebScriptObject evaluateWebScript:]):
(-[WebScriptObject setValue:forKey:]):
(-[WebScriptObject valueForKey:]):
(-[WebScriptObject stringRepresentation]):
(+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
(+[WebUndefined undefined]):
(-[WebUndefined initWithCoder:]):
(-[WebUndefined encodeWithCoder:]):
(-[WebUndefined copyWithZone:]):
(-[WebUndefined retain]):
(-[WebUndefined release]):
(-[WebUndefined retainCount]):
(-[WebUndefined autorelease]):
(-[WebUndefined dealloc]):
(-[WebUndefined copy]):
(-[WebUndefined replacementObjectForPortCoder:]):
* bindings/objc/WebScriptObjectPrivate.h: Added.
* bindings/objc/objc_class.mm:
(ObjcClass::methodsNamed):
(ObjcClass::fieldNamed):
* bindings/objc/objc_instance.mm:
(ObjcInstance::invokeMethod):
* bindings/objc/objc_jsobject.h:
* bindings/objc/objc_jsobject.mm:
* bindings/objc/objc_runtime.mm:
(ObjcField::valueFromInstance):
* bindings/objc/objc_utility.mm:
(KJS::Bindings::JSMethodNameToObjCMethodName):
(KJS::Bindings::convertValueToObjcValue):
(KJS::Bindings::convertObjcValueToValue):
* bindings/runtime.cpp:
(Instance::setDidExecuteFunction):
(Instance::didExecuteFunction):
(Instance::setValueOfField):
* bindings/runtime.h:
* bindings/testbindings.mm:
(+[MyFirstInterface webScriptNameForSelector:]):
(-[MyFirstInterface callJSObject::]):
2004-05-14 Vicki Murley <vicki@apple.com>
Reviewed by mjs.
<rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
* JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
=== Safari-140 ===
2004-05-13 Richard Williamson <rjw@apple.com>
Fixed indentation.
Reviewed by Chris.
* ChangeLog:
* bindings/objc/WebScriptObject.h:
2004-05-13 Richard Williamson <rjw@apple.com>
Approved API changes. Currently unimplemented.
Reviewed by Chris.
* ChangeLog:
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/objc/WebScriptObject.h: Added.
* bindings/objc/WebScriptObject.mm: Added.
(+[WebScriptObject throwException:]):
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(-[WebScriptObject evaluateWebScript:]):
(-[WebScriptObject stringRepresentation]):
(+[WebUndefined undefined]):
(-[WebUndefined initWithCoder:]):
(-[WebUndefined encodeWithCoder:]):
(-[WebUndefined copyWithZone:]):
2004-05-07 Vicki Murley <vicki@apple.com>
Reviewed by darin.
Turn off GC since it uses ppc only instructions (which breaks
the B&I build).
* kjs/value.h: set USE_CONSERVATIVE_GC to 0
=== Safari-139 ===
2004-05-07 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- add -funroll-loops=16 compiler option for approx .5% speedup on
HTML iBench and .5-1% speedup on JS iBench.
* JavaScriptCore.pbproj/project.pbxproj:
2004-04-25 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
Enable full conservative GC mode in addition to test mode. When
conservative GC is enabled, we now get an 11% speed improvement on
the iBench. Also fix some spots I missed before.
Specific noteworth changes:
* kjs/collector.cpp:
(KJS::Collector::markStackObjectsConservatively): Check possible
cell pointers for 8-byte aligment and verify they are not 0.
* kjs/protected_values.cpp:
(KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
(KJS::ProtectedValues::decreaseProtectCount): ...and here...
* kjs/protect.h:
(KJS::gcProtectNullTolerant): ...to here...
(KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
tolerance, and doing the check is expensive.
* kjs/protected_values.cpp:
(KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
that is still very good.
* kjs/protect.h:
(KJS::gcProtect):
(KJS::gcUnprotect):
(KJS::ProtectedValue::ProtectedValue):
(KJS::ProtectedValue::~ProtectedValue):
(KJS::ProtectedValue::operator=):
(KJS::ProtectedObject::ProtectedObject):
(KJS::ProtectedObject::~ProtectedObject):
(KJS::ProtectedObject::operator=):
(KJS::ProtectedReference::ProtectedReference):
(KJS::ProtectedReference::~ProtectedReference):
(KJS::ProtectedReference::operator=):
* kjs/protected_values.cpp:
(KJS::ProtectedValues::getProtectCount):
(KJS::ProtectedValues::increaseProtectCount):
(KJS::ProtectedValues::decreaseProtectCount):
(KJS::ProtectedValues::computeHash):
* bindings/runtime_root.cpp:
(KJS::Bindings::addNativeReference):
(KJS::Bindings::removeNativeReference):
(RootObject::removeAllNativeReferences):
* bindings/runtime_root.h:
(KJS::Bindings::RootObject::~RootObject):
(KJS::Bindings::RootObject::setRootObjectImp):
* kjs/collector.cpp:
(KJS::Collector::allocate):
(KJS::Collector::collect):
* kjs/collector.h:
* kjs/internal.cpp:
(NumberImp::create):
(InterpreterImp::globalInit):
(InterpreterImp::globalClear):
(InterpreterImp::mark):
* kjs/list.cpp:
(KJS::List::derefValues):
(KJS::List::refValues):
(KJS::List::append):
* kjs/object.cpp:
(KJS::ObjectImp::setInternalValue):
(KJS::ObjectImp::putDirect):
* kjs/value.cpp:
(ValueImp::mark):
(ValueImp::marked):
* kjs/value.h:
(KJS::ValueImp::ValueImp):
(KJS::ValueImp::~ValueImp):
(KJS::ValueImp::):
(KJS::Value::Value):
(KJS::Value::~Value):
(KJS::Value::operator=):
2004-04-30 Richard Williamson <rjw@apple.com>
Asking an NSInvocation for it's return value when return type
is void throws an exception. Added check for void return types
to avoid this exception.
Reviewed by Ken.
* bindings/objc/objc_instance.mm:
(ObjcInstance::invokeMethod):
2004-04-29 Richard Williamson <rjw@apple.com>
Fixed several bad problems with the ObjC bindings. In particular, conversion
to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
Reviewed by Chris.
* bindings/objc/objc_jsobject.h:
* bindings/objc/objc_jsobject.mm:
(-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
(-[JavaScriptObject KJS::]):
(+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
(-[JavaScriptObject call:arguments:]):
(-[JavaScriptObject evaluate:]):
(-[JavaScriptObject getMember:]):
(-[JavaScriptObject getSlot:]):
* bindings/objc/objc_runtime.mm:
(ObjcField::valueFromInstance):
(ObjcField::setValueToInstance):
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertValueToObjcValue):
(KJS::Bindings::convertObjcValueToValue):
* bindings/runtime.h:
* bindings/runtime_root.cpp:
(KJS::Bindings::rootForInterpreter):
(KJS::Bindings::addNativeReference):
(KJS::Bindings::removeNativeReference):
* bindings/runtime_root.h:
* bindings/testbindings.mm:
(-[MyFirstInterface logMessage:]):
(-[MyFirstInterface setJSObject:]):
(-[MyFirstInterface callJSObject::]):
2004-04-24 Darin Adler <darin@apple.com>
Reviewed by Dave.
* kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
that is 2x too big.
2004-04-23 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
Implementation of conservative GC, based partly on code from
Darin. It's turned off for now, so it shouldn't have any effect on
the normal build.
* JavaScriptCore.pbproj/project.pbxproj:
* kjs/collector.cpp:
(KJS::Collector::markStackObjectsConservatively):
(KJS::Collector::markProtectedObjects):
(KJS::Collector::collect):
* kjs/collector.h:
* kjs/protect.h:
(KJS::gcProtect):
(KJS::gcUnprotect):
* kjs/protected_values.cpp: Added.
(KJS::ProtectedValues::getProtectCount):
(KJS::ProtectedValues::increaseProtectCount):
(KJS::ProtectedValues::insert):
(KJS::ProtectedValues::decreaseProtectCount):
(KJS::ProtectedValues::expand):
(KJS::ProtectedValues::shrink):
(KJS::ProtectedValues::rehash):
(KJS::ProtectedValues::computeHash):
* kjs/protected_values.h: Added.
* kjs/value.cpp:
(ValueImp::useConservativeMark):
(ValueImp::mark):
(ValueImp::marked):
* kjs/value.h:
(KJS::ValueImp::):
=== Safari-138 ===
2004-04-22 Richard Williamson <rjw@apple.com>
Fixed build snafu (re-declaration of NPBool in npruntime.h and
npapi.h).
* bindings/npruntime.h:
2004-04-22 Richard Williamson <rjw@apple.com>
Updated plugin binding API to reflect latest revision from
working group.
Biggest change is the introduction of NPVariant used to represent
value types. NPVariant replaces the use of NPObject for the
exchange of values between scripting environment and native code.
Reviewed by John.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/NP_jsobject.cpp:
(identiferFromNPIdentifier):
(NPN_Call):
(NPN_Evaluate):
(NPN_GetProperty):
(NPN_SetProperty):
(NPN_ToString):
(NPN_GetPropertyAtIndex):
(NPN_SetPropertyAtIndex):
* bindings/c/c_class.cpp:
(CClass::methodsNamed):
(CClass::fieldNamed):
* bindings/c/c_instance.cpp:
(CInstance::invokeMethod):
(CInstance::defaultValue):
* bindings/c/c_runtime.cpp:
(CField::valueFromInstance):
(CField::setValueToInstance):
* bindings/c/c_utility.cpp:
(convertNPStringToUTF16):
(convertUTF8ToUTF16):
(coerceValueToNPVariantStringType):
(convertValueToNPVariant):
(convertNPVariantToValue):
* bindings/c/c_utility.h:
* bindings/npruntime.cpp:
(NPN_GetIdentifier):
(NPN_GetIdentifiers):
(NPN_UTF8FromIdentifier):
(NPN_VariantIsVoid):
(NPN_VariantIsNull):
(NPN_VariantIsUndefined):
(NPN_VariantIsBool):
(NPN_VariantIsInt32):
(NPN_VariantIsDouble):
(NPN_VariantIsString):
(NPN_VariantIsObject):
(NPN_VariantToBool):
(NPN_VariantToString):
(NPN_VariantToInt32):
(NPN_VariantToDouble):
(NPN_VariantToObject):
(NPN_InitializeVariantAsVoid):
(NPN_InitializeVariantAsNull):
(NPN_InitializeVariantAsUndefined):
(NPN_InitializeVariantWithBool):
(NPN_InitializeVariantWithInt32):
(NPN_InitializeVariantWithDouble):
(NPN_InitializeVariantWithString):
(NPN_InitializeVariantWithStringCopy):
(NPN_InitializeVariantWithObject):
(NPN_InitializeVariantWithVariant):
(NPN_ReleaseVariantValue):
(NPN_CreateObject):
(NPN_RetainObject):
(NPN_ReleaseObject):
(NPN_IsKindOfClass):
(NPN_SetExceptionWithUTF8):
(NPN_SetException):
* bindings/npruntime.h:
(_NPString::):
(_NPString::_NPVariant::):
* bindings/testbindings.cpp:
(logMessage):
(setDoubleValue):
(setIntValue):
(setStringValue):
(setBooleanValue):
(getDoubleValue):
(getIntValue):
(getStringValue):
(getBooleanValue):
(myGetProperty):
(mySetProperty):
(myInvoke):
(myAllocate):
2004-04-22 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
* kjs/ustring.cpp:
(KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
Was resulting in a buffer 2x the needed size.
(KJS::UString::expandPreCapacity): Ditto.
(KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
2004-04-21 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
Preliminary change for conservative GC. Create "protected"
subclasses to GC-protect objects when on heap, since we will soon
remove the built-in refcounting of the normal wrapper classes. Use
them where needed.
* JavaScriptCore.pbproj/project.pbxproj:
* kjs/context.h:
* kjs/internal.h:
(KJS::InterpreterImp::globalObject):
* kjs/interpreter.h:
* kjs/property_map.cpp:
* kjs/reference.h:
* kjs/reference_list.cpp:
2004-04-19 Maciej Stachowiak <mjs@apple.com>
Reviewed by Dave.
Optimize prepend using the shared substring optimization. Also,
limit the applicability of shared append and shared prepend. If
you overdo it, it does more harm than good, because you create a
bunch of strings that are disqualified from future shared
append/prepend, for not much immediate savings in allocate/copy
expense.
* kjs/ustring.cpp:
(KJS::):
(KJS::UString::Rep::create):
(KJS::UString::expandedSize):
(KJS::UString::usedPreCapacity):
(KJS::UString::expandCapacity):
(KJS::UString::expandPreCapacity):
(KJS::UString::UString):
(KJS::UString::append):
(KJS::UString::operator=):
* kjs/ustring.h:
(KJS::UString::Rep::data):
2004-04-16 Maciej Stachowiak <mjs@apple.com>
Reviewed by Richard.
No more need for Completion or Reference to privately inherit from
Value, none of the superclass functionality is used.
* kjs/completion.h:
* kjs/reference.h:
=== Safari-137 ===
2004-04-16 Richard Williamson <rjw@apple.com>
Added interpreter lock protection around object creation.
Reviewed by Chris.
* bindings/runtime.cpp:
(Instance::createRuntimeObject):
2004-04-16 Maciej Stachowiak <mjs@apple.com>
Reviewed by Ken.
Another JavaScript speed improvement: use the mechanism from
string append optimization to make taking a substring fast, again
sharing the buffer.
A further 22% improvement on the 24fun string speed test.
* kjs/ustring.cpp:
(KJS::):
(KJS::UString::Rep::create):
(KJS::UString::UString):
(KJS::UString::append):
(KJS::UString::operator=):
(KJS::UString::substr):
* kjs/ustring.h:
(KJS::UString::Rep::data):
2004-04-13 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
- fixed <rdar://problem/3600691>: Table generation test is really slow
- fixed <rdar://problem/3600661>: 24fun date test is really slow
80% speedup on the string test, lesser speedups on the other two.
Two different optimizations here:
1) Avoid large overhead of scanning strings to see if they are all
ASCII before numeric conversion.
* kjs/nodes.cpp:
(AssignNode::evaluate): Don't convert to integer until we know for
sure the operation will need it. Attempting to convert strings to
numbers is a waste when they are being appended with +=.
2) Avoid huge cost of appending strings.
This is done by allowing multiple strings to share a buffer but
actually use different ranges of it. The first time a string is
appended to, we start leaving at least 10% extra space in the
buffer, so doing N appends to the same string takes O(log N)
mallocs instead of O(N).
* kjs/identifier.cpp:
(KJS::Identifier::equal):
(KJS::Identifier::add):
* kjs/ustring.cpp:
(KJS::):
(KJS::UCharReference::operator=):
(KJS::UCharReference::ref):
(KJS::UString::Rep::create):
(KJS::UString::Rep::destroy):
(KJS::UString::expandedSize):
(KJS::UString::usedCapacity):
(KJS::UString::expandCapacity):
(KJS::UString::UString):
(KJS::UString::null):
(KJS::UString::append):
(KJS::UString::operator=):
(KJS::UString::toStrictUInt32):
(KJS::UString::detach):
(KJS::KJS::operator==):
* kjs/ustring.h:
(KJS::UString::Rep::data):
(KJS::UString::Rep::hash):
2004-04-09 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
- fix deployment build by avoiding deployment-only warning.
* kjs/scope_chain.cpp:
(KJS::ScopeChain::bottom):
2004-04-09 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
Changed things so that newly created objects get a prototype based
on the scope chain of the current function, rather than the
interpreter that started execution. This fixes the following bugs:
<rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
<rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
* JavaScriptCore.pbproj/project.pbxproj:
* kjs/array_object.cpp:
(CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
(ArrayProtoFuncImp::ArrayProtoFuncImp):
(ArrayProtoFuncImp::call):
(ArrayObjectImp::construct):
* kjs/bool_object.cpp:
(BooleanObjectImp::construct):
* kjs/date_object.cpp:
(DateProtoFuncImp::DateProtoFuncImp):
(DateProtoFuncImp::call):
(DateObjectImp::construct):
* kjs/error_object.cpp:
(ErrorObjectImp::construct):
* kjs/function.cpp:
(FunctionImp::FunctionImp):
(FunctionImp::call):
(DeclaredFunctionImp::construct):
(ArgumentsImp::ArgumentsImp):
(GlobalFuncImp::call):
* kjs/function_object.cpp:
(FunctionProtoFuncImp::call):
(FunctionObjectImp::construct):
* kjs/internal.cpp:
(BooleanImp::toObject):
(StringImp::toObject):
(NumberImp::toObject):
(InterpreterImp::InterpreterImp):
(InterpreterImp::clear):
(InterpreterImp::interpreterWithGlobalObject):
* kjs/internal.h:
* kjs/interpreter.cpp:
(ExecState::lexicalInterpreter):
* kjs/interpreter.h:
(KJS::ExecState::dynamicInterpreter):
(KJS::ExecState::interpreter):
* kjs/math_object.cpp:
(MathFuncImp::MathFuncImp):
* kjs/nodes.cpp:
(StatementNode::hitStatement):
(StatementNode::abortStatement):
(RegExpNode::evaluate):
(ElementNode::evaluate):
(ArrayNode::evaluate):
(ObjectLiteralNode::evaluate):
(PropertyValueNode::evaluate):
(FunctionCallNode::evaluate):
(FuncDeclNode::processFuncDecl):
(FuncExprNode::evaluate):
* kjs/number_object.cpp:
(NumberObjectImp::construct):
* kjs/object.cpp:
(KJS::ObjectImp::defaultValue):
(KJS::Error::create):
* kjs/object_object.cpp:
(ObjectObjectImp::construct):
* kjs/reference.cpp:
(Reference::putValue):
* kjs/regexp_object.cpp:
(RegExpProtoFuncImp::call):
(RegExpObjectImp::arrayOfMatches):
(RegExpObjectImp::construct):
* kjs/scope_chain.cpp:
(KJS::ScopeChain::bottom):
* kjs/scope_chain.h:
* kjs/string_object.cpp:
(StringProtoFuncImp::StringProtoFuncImp):
(StringProtoFuncImp::call):
(StringObjectImp::construct):
=== Safari-136 ===
=== Safari-135 ===
2004-03-31 Richard Williamson <rjw@apple.com>
Tedious renames based on feedback from plugin-futures list.
NP_ functions are renamed with NPN_ prefix.
Types prefix renamed from NP_ to NP.
NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated.
No review because this was just a renaming patch.
* bindings/NP_jsobject.cpp:
(listFromNPArray):
(jsAllocate):
(identiferFromNPIdentifier):
(NPN_Call):
(NPN_Evaluate):
(NPN_GetProperty):
(NPN_SetProperty):
(NPN_RemoveProperty):
(NPN_ToString):
(NPN_GetPropertyAtIndex):
(NPN_SetPropertyAtIndex):
* bindings/NP_jsobject.h:
* bindings/c/c_class.cpp:
(CClass::_commonInit):
(CClass::classForIsA):
(CClass::CClass):
(CClass::methodsNamed):
(CClass::fieldNamed):
* bindings/c/c_class.h:
* bindings/c/c_instance.cpp:
(CInstance::CInstance):
(CInstance::~CInstance):
(CInstance::operator=):
(CInstance::invokeMethod):
(CInstance::defaultValue):
* bindings/c/c_instance.h:
(KJS::Bindings::CInstance::getObject):
* bindings/c/c_runtime.cpp:
(CField::valueFromInstance):
(CField::setValueToInstance):
* bindings/c/c_runtime.h:
(KJS::Bindings::CField::CField):
(KJS::Bindings::CField::name):
(KJS::Bindings::CMethod::CMethod):
(KJS::Bindings::CMethod::name):
* bindings/c/c_utility.cpp:
(coerceValueToNPString):
(convertValueToNPValueType):
(convertNPValueTypeToValue):
* bindings/c/c_utility.h:
* bindings/npruntime.cpp:
(NPN_IdentifierFromUTF8):
(NPN_IsValidIdentifier):
(NPN_GetIdentifiers):
(NPN_UTF8FromIdentifier):
(NPN_CreateObject):
(NPN_RetainObject):
(NPN_ReleaseObject):
(NPN_IsKindOfClass):
(NPN_SetExceptionWithUTF8):
(NPN_SetException):
(numberAllocate):
(NPN_CreateNumberWithInt):
(NPN_CreateNumberWithFloat):
(NPN_CreateNumberWithDouble):
(NPN_IntFromNumber):
(NPN_FloatFromNumber):
(NPN_DoubleFromNumber):
(stringAllocate):
(NPN_CreateStringWithUTF8):
(NPN_CreateStringWithUTF16):
(NPN_DeallocateUTF8):
(NPN_UTF8FromString):
(NPN_UTF16FromString):
(NPN_StringLength):
(booleanAllocate):
(NPN_CreateBoolean):
(NPN_BoolFromBoolean):
(nullAllocate):
(NPN_GetNull):
(undefinedAllocate):
(NPN_GetUndefined):
(arrayAllocate):
(arrayDeallocate):
(NPN_CreateArray):
(NPN_CreateArrayV):
(NPN_ObjectAtIndex):
* bindings/npruntime.h:
* bindings/runtime.cpp:
(Instance::createBindingForLanguageInstance):
* bindings/testbindings.cpp:
(initializeIdentifiers):
(myHasProperty):
(myHasMethod):
(myGetProperty):
(mySetProperty):
(logMessage):
(setDoubleValue):
(setIntValue):
(setStringValue):
(setBooleanValue):
(getDoubleValue):
(getIntValue):
(getStringValue):
(getBooleanValue):
(myInvoke):
(myAllocate):
(myInvalidate):
(myDeallocate):
(main):
2004-03-31 Richard Williamson <rjw@apple.com>
Changed references to NP_runtime.h to npruntime.h
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/NP_jsobject.h:
* bindings/c/c_class.h:
* bindings/c/c_instance.h:
* bindings/c/c_runtime.h:
* bindings/c/c_utility.h:
* bindings/npruntime.cpp:
2004-03-31 Richard Williamson <rjw@apple.com>
Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/NP_jsobject.h:
* bindings/npruntime.cpp:
=== Safari-134 ===
2004-03-23 Richard Williamson <rjw@apple.com>
Added implementation of KJS::Value <-> NP_Object conversion functions.
Augmented test program for 'C' bindings.
Added asserts and parameter checking to all public API.
Reviewed by Ken.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/NP_jsobject.cpp:
(NP_ToString):
* bindings/NP_jsobject.h: Added.
* bindings/NP_runtime.cpp:
(NP_IdentifierFromUTF8):
(NP_IsValidIdentifier):
(NP_GetIdentifiers):
(NP_CreateObject):
(NP_RetainObject):
(NP_ReleaseObject):
(NP_IsKindOfClass):
(NP_SetExceptionWithUTF8):
(NP_SetException):
(NP_IntFromNumber):
(NP_FloatFromNumber):
(NP_DoubleFromNumber):
(NP_CreateStringWithUTF8):
(NP_CreateStringWithUTF16):
(NP_DeallocateUTF8):
(NP_UTF8FromString):
(NP_UTF16FromString):
(NP_StringLength):
(NP_BoolFromBoolean):
* bindings/NP_runtime.h:
* bindings/c/c_instance.cpp:
(CInstance::invokeMethod):
* bindings/c/c_utility.cpp:
(coerceValueToNPString):
(convertValueToNPValueType):
(convertNPValueTypeToValue):
* bindings/c/c_utility.h:
* bindings/test.js:
* bindings/testC.js: Added.
* bindings/testbindings.cpp:
(logMessage):
(setDoubleValue):
(setIntValue):
(setStringValue):
(setBooleanValue):
(getDoubleValue):
(getIntValue):
(getStringValue):
(getBooleanValue):
(myInterfaceInvoke):
(myInterfaceAllocate):
=== Safari-133 ===
2004-03-19 Darin Adler <darin@apple.com>
Reviewed by Ken.
- fixed problem with methods like setUTCHour
* kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
GMT vs. local time function based on the utc flag.
2004-03-17 Richard Williamson <rjw@apple.com>
Added a context parameter to result callbacks use by JavaScriptObject functions. This was a change requested by Eric Carlson on the QT plugin team.
Reviewed by Ken.
* bindings/NP_jsobject.cpp:
(NP_Call):
(NP_Evaluate):
(NP_GetProperty):
(NP_ToString):
(NP_GetPropertyAtIndex):
* bindings/NP_runtime.h:
2004-03-16 Richard Williamson <rjw@apple.com>
Fixed 3590169. Regression (crash) caused by the switch to MethodLists. Crash when attempting to invoke a method from JavaScript to Java that is not implemented.
Reviewed by John.
* bindings/jni/jni_class.cpp:
(JavaClass::methodsNamed):
2004-03-15 Richard Williamson <rjw@apple.com>
Fixed 3570854. Don't attempt to convert Null to strings. We
were incorrectly converting to "Null".
Actually fixed by Scott Kovatch.
Reviewed by Richard.
* bindings/jni/jni_utility.cpp:
(KJS::Bindings::convertValueToJValue):
=== Safari-132 ===
2004-03-11 Richard Williamson <rjw@apple.com>
Stitched together the NP stuff to our language independent
JavaScript binding stuff. Very close to being done.
Added program to test C bindings (and NP stuff). Just tests
properties. Will add methods and JavaScript access, etc.
Updated Makefile.am to account for new bindings/c directory.
Change NP_UTF8 from "const char *" to "char" to allow for
declarations like "const NP_UTF8 *" and "NP_UTF8 *". Ditto
for NP_UTF16.
Added NP_IsValidIdentifier().
Reviewed by Chris.
* JavaScriptCore.pbproj/project.pbxproj:
* Makefile.am:
* bindings/NP_jsobject.cpp:
(identiferFromNPIdentifier):
(NP_Evaluate):
* bindings/NP_runtime.cpp:
(NP_IdentifierFromUTF8):
(NP_IsValidIdentifier):
(NP_GetIdentifiers):
(NP_UTF8FromIdentifier):
(NP_SetExceptionWithUTF8):
(NP_SetException):
(NP_CreateStringWithUTF8):
(NP_CreateStringWithUTF16):
(NP_UTF8FromString):
(NP_UTF16FromString):
* bindings/NP_runtime.h:
* bindings/c/c_class.cpp: Added.
(CClass::_commonDelete):
(CClass::_commonCopy):
(CClass::_commonInit):
(_createClassesByIsAIfNecessary):
(CClass::classForIsA):
(CClass::CClass):
(CClass::name):
(CClass::methodsNamed):
(CClass::fieldNamed):
* bindings/c/c_class.h: Added.
(KJS::Bindings::CClass::~CClass):
(KJS::Bindings::CClass::CClass):
(KJS::Bindings::CClass::operator=):
(KJS::Bindings::CClass::constructorAt):
(KJS::Bindings::CClass::numConstructors):
* bindings/c/c_instance.cpp: Added.
(CInstance::CInstance):
(CInstance::~CInstance):
(CInstance::operator=):
(CInstance::getClass):
(CInstance::begin):
(CInstance::end):
(CInstance::invokeMethod):
(CInstance::defaultValue):
(CInstance::stringValue):
(CInstance::numberValue):
(CInstance::booleanValue):
(CInstance::valueOf):
* bindings/c/c_instance.h: Added.
(KJS::Bindings::CInstance::getObject):
* bindings/c/c_runtime.cpp: Added.
(CField::valueFromInstance):
(CField::setValueToInstance):
* bindings/c/c_runtime.h: Added.
(KJS::Bindings::CField::CField):
(KJS::Bindings::CField::name):
(KJS::Bindings::CField::type):
(KJS::Bindings::CMethod::CMethod):
(KJS::Bindings::CMethod::name):
(KJS::Bindings::CMethod::numParameters):
* bindings/c/c_utility.cpp: Added.
(coerceValueToNPValueType):
(convertValueToNPValueType):
(convertNPValueTypeToValue):
* bindings/c/c_utility.h: Added.
* bindings/make_testbindings:
* bindings/runtime.cpp:
(Instance::createBindingForLanguageInstance):
* bindings/runtime.h:
(KJS::Bindings::Instance::):
* bindings/testbindings.cpp: Added.
(initializeIdentifiers):
(myInterfaceHasProperty):
(myInterfaceHasMethod):
(myInterfaceGetProperty):
(myInterfaceSetProperty):
(myInterfaceInvoke):
(myInterfaceAllocate):
(myInterfaceInvalidate):
(myInterfaceDeallocate):
(GlobalImp::className):
(readJavaScriptFromFile):
(main):
2004-03-10 Richard Williamson <rjw@apple.com>
Made changes to support new asychronous approach to calls from
plugin to JavaScript
Reviewed by Chris.
* bindings/NP_jsobject.cpp:
(NP_Call):
(NP_Evaluate):
(NP_GetProperty):
(NP_ToString):
(NP_GetPropertyAtIndex):
* bindings/NP_runtime.h:
* bindings/make_testbindings:
* bindings/runtime.cpp:
(Instance::createBindingForLanguageInstance):
2004-03-10 Richard Williamson <rjw@apple.com>
Updated header to include proposed changes from
plugin-futures list. Calls from plugin to JavaScript
are now asynchronous.
Reviewed by Chris.
* bindings/NP_runtime.h:
=== Safari-131 ===
2004-03-04 Richard Williamson <rjw@apple.com>
Implementation of NP_JavaScriptObject. This is the 'C' class
that wraps a JavaScript object.
Reviewed by Chris.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/NP_jsobject.cpp: Added.
(coerceValueToNPValueType):
(convertValueToNPValueType):
(convertNPValueTypeToValue):
(listFromNPArray):
(jsAllocate):
(jsDeallocate):
(identiferFromNPIdentifier):
(NP_Call):
(NP_Evaluate):
(NP_GetProperty):
(NP_SetProperty):
(NP_RemoveProperty):
(NP_ToString):
(NP_GetPropertyAtIndex):
(NP_SetPropertyAtIndex):
* bindings/NP_runtime.cpp:
(NP_ObjectAtIndex):
* bindings/NP_runtime.h:
* bindings/runtime_object.h:
2004-03-04 Richard Williamson <rjw@apple.com>
Added NP_Array implementation.
Changed NP_Boolean to just depend on two static instances, no
space is required for values.
Reviewed by Chris.
* bindings/NP_runtime.cpp:
(NP_CreateBoolean):
(NP_BoolFromBoolean):
(arrayAllocate):
(arrayDeallocate):
(NP_CreateArray):
(NP_CreateArrayV):
(NP_ObjectAtIndex):
* bindings/NP_runtime.h:
2004-03-03 Darin Adler <darin@apple.com>
Reviewed by Vicki.
* English.lproj/InfoPlist.strings: Removed. No need to localize the version and
copyright string, and that's all that was in here.
* JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
2004-03-03 Richard Williamson <rjw@apple.com>
More 'C' binding implementation. Fleshed out all the
'primitive' data types.
Reviewed by Chris.
* bindings/NP_runtime.cpp:
(NP_ReleaseObject):
(numberAllocate):
(stringAllocate):
(stringDeallocate):
(NP_CreateStringWithUTF8):
(NP_CreateStringWithUTF16):
(NP_UTF8FromString):
(NP_UTF16FromString):
(NP_StringLength):
(booleanAllocate):
(booleanDeallocate):
(NP_CreateBoolean):
(NP_BoolFromBoolean):
(nullAllocate):
(nullDeallocate):
(NP_GetNull):
(undefinedAllocate):
(undefinedDeallocate):
(NP_GetUndefined):
* bindings/NP_runtime.h:
2004-03-03 Richard Williamson <rjw@apple.com>
More 'C' binding implementation.
Reviewed by Chris.
* bindings/NP_runtime.cpp:
(identifierEqual):
(identifierHash):
(getIdentifierDictionary):
(NP_IdentifierFromUTF8):
(NP_UTF8FromIdentifier):
(NP_CreateObject):
(NP_ReleaseObject):
(NP_IsKindOfClass):
(numberCreate):
(NP_CreateNumberWithInt):
(NP_CreateNumberWithFloat):
(NP_CreateNumberWithDouble):
(NP_IntFromNumber):
(NP_FloatFromNumber):
(NP_DoubleFromNumber):
* bindings/NP_runtime.h:
2004-03-02 Richard Williamson <rjw@apple.com>
Removed retain/release from NP_Class. Classes will not be allowed to implement their
own customer retain/release scheme.
Reviewed by Chris.
* bindings/NP_runtime.cpp:
(NP_RetainObject):
(NP_ReleaseObject):
* bindings/NP_runtime.h:
2004-03-02 Richard Williamson <rjw@apple.com>
C binding API. Partial implementation.
Completed ObjectiveC bindings (not based on the C API). These will re-implemented over the C binding API, but I wanted to get this code in the tree.
Factored root object reference counting scheme. It is now useful independent
of LiveConnect.
Reviewed by Chris.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/NP_runtime.cpp: Added.
(NP_IdentifierFromUTF8):
(NP_GetIdentifiers):
(NP_UTF8FromIdentifier):
(NP_CreateObject):
(NP_RetainObject):
(NP_ReleaseObject):
(NP_IsKindOfClass):
(NP_SetException):
(NP_Call):
(NP_Evaluate):
(NP_GetProperty):
(NP_SetProperty):
(NP_RemoveProperty):
(NP_ToString):
(NP_GetPropertyAtIndex):
(NP_SetPropertyAtIndex):
(NP_CreateNumberWithInt):
(NP_CreateNumberWithFloat):
(NP_CreateNumberWithDouble):
(NP_IntFromNumber):
(NP_FloatFromNumber):
(NP_DoubleFromNumber):
(NP_CreateStringWithUTF8):
(NP_CreateStringWithUTF16):
(NP_UTF8FromString):
(NP_UTF16FromString):
(NP_CreateBoolean):
(NP_BoolFromBoolean):
(NP_GetNull):
(NP_GetUndefined):
(NP_CreateArray):
(NP_CreateArrayV):
(NP_ObjectAtIndex):
* bindings/NP_runtime.h: Added.
* bindings/jni/jni_jsobject.cpp:
(JSObject::invoke):
(JSObject::finalize):
(JSObject::createNative):
(JSObject::convertValueToJObject):
* bindings/jni/jni_jsobject.h:
* bindings/objc/objc_jsobject.h:
* bindings/objc/objc_jsobject.mm:
(rootForView):
(windowJavaScriptObject):
(-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
(-[JavaScriptObject dealloc]):
(-[JavaScriptObject _convertValueToObjcValue:KJS::]):
(-[JavaScriptObject call:arguments:]):
(-[JavaScriptObject evaluate:]):
(-[JavaScriptObject getMember:]):
(-[JavaScriptObject setMember:value:]):
(-[JavaScriptObject removeMember:]):
(-[JavaScriptObject toString]):
(-[JavaScriptObject getSlot:]):
(-[JavaScriptObject setSlot:value:]):
* bindings/objc/objc_utility.h:
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertValueToObjcValue):
* bindings/runtime_root.cpp: Added.
(getReferencesByRootDictionary):
(getReferencesDictionary):
(KJS::Bindings::findReferenceDictionary):
(KJS::Bindings::rootForImp):
(KJS::Bindings::addNativeReference):
(KJS::Bindings::removeNativeReference):
(completedJavaScriptAccess):
(initializeJavaScriptAccessLock):
(lockJavaScriptAccess):
(unlockJavaScriptAccess):
(RootObject::dispatchToJavaScriptThread):
(performJavaScriptAccess):
(RootObject::setFindRootObjectForNativeHandleFunction):
(RootObject::removeAllNativeReferences):
* bindings/runtime_root.h: Added.
(KJS::Bindings::RootObject::RootObject):
(KJS::Bindings::RootObject::~RootObject):
(KJS::Bindings::RootObject::setRootObjectImp):
(KJS::Bindings::RootObject::rootObjectImp):
(KJS::Bindings::RootObject::setInterpreter):
(KJS::Bindings::RootObject::interpreter):
(KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
(KJS::Bindings::RootObject::runLoop):
(KJS::Bindings::RootObject::performJavaScriptSource):
=== Safari-130 ===
=== Safari-129 ===
2004-02-18 Richard Williamson <rjw@apple.com>
Added NSNumber/Number conversion.
Removed some unnecessary KJS:: namespace specifiers.
Reviewed by Ken.
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertValueToObjcValue):
(KJS::Bindings::convertObjcValueToValue):
* bindings/runtime_array.h:
2004-02-18 Richard Williamson <rjw@apple.com>
Added support for export NSArrays.
Updated valueAt() to take an ExecState so we can throw
JS exceptions.
Implemented excludeSelectorFromJavaScript: in ObjcClass. This allows
ObjectiveC classes to control the visibility of their methods in
JavaScript.
Reviewed by Ken.
* bindings/jni/jni_runtime.cpp:
(JavaField::valueFromInstance):
(JavaArray::valueAt):
* bindings/jni/jni_runtime.h:
* bindings/objc/objc_class.mm:
(ObjcClass::methodsNamed):
* bindings/objc/objc_runtime.h:
(KJS::Bindings::ObjcArray::getObjcArray):
* bindings/objc/objc_runtime.mm:
(ObjcField::valueFromInstance):
(ObjcField::setValueToInstance):
(ObjcArray::ObjcArray):
(ObjcArray::~ObjcArray):
(ObjcArray::operator=):
(ObjcArray::setValueAt):
(ObjcArray::valueAt):
(ObjcArray::getLength):
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertValueToObjcValue):
(KJS::Bindings::convertObjcValueToValue):
* bindings/runtime.cpp:
(Instance::getValueOfField):
* bindings/runtime.h:
* bindings/runtime_array.cpp:
(RuntimeArrayImp::get):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::get):
2004-02-17 Richard Williamson <rjw@apple.com>
Added String <-> NSString conversion.
Added tests of String <-> NSString conversion to test program.
Reviewed by Chris.
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertValueToObjcValue):
(KJS::Bindings::convertObjcValueToValue):
* bindings/test.js:
* bindings/testbindings.mm:
(-[MyFirstInterface getString]):
2004-02-15 Darin Adler <darin@apple.com>
Reviewed by Dave.
* JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
and removing redundant settings of things that match defaults in other build styles.
2004-02-13 Richard Williamson <rjw@apple.com>
Work towards the JavaScript ObjC bindings. The bindings now work for
simple scalar types. testbindings.mm is an illustration of how the
bindings work.
Reviewed by Ken.
* JavaScriptCore.pbproj/project.pbxproj:
* Makefile.am:
* bindings/jni/jni_class.cpp:
(JavaClass::methodsNamed):
* bindings/jni/jni_class.h:
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
* bindings/jni/jni_instance.h:
* bindings/jni/jni_runtime.h:
(KJS::Bindings::JavaMethod::returnType):
* bindings/make_testbindings: Added.
* bindings/objc/objc_class.h: Added.
(KJS::Bindings::ObjcClass::~ObjcClass):
(KJS::Bindings::ObjcClass::ObjcClass):
(KJS::Bindings::ObjcClass::operator=):
(KJS::Bindings::ObjcClass::constructorAt):
(KJS::Bindings::ObjcClass::numConstructors):
* bindings/objc/objc_class.mm: Added.
(ObjcClass::_commonDelete):
(ObjcClass::_commonCopy):
(ObjcClass::_commonInit):
(_createClassesByIsAIfNecessary):
(ObjcClass::classForIsA):
(ObjcClass::ObjcClass):
(ObjcClass::name):
(ObjcClass::methodsNamed):
(ObjcClass::fieldNamed):
* bindings/objc/objc_header.h: Added.
* bindings/objc/objc_instance.h: Added.
(KJS::Bindings::ObjcInstance::getObject):
* bindings/objc/objc_instance.mm: Added.
(ObjcInstance::ObjcInstance):
(ObjcInstance::~ObjcInstance):
(ObjcInstance::operator=):
(ObjcInstance::begin):
(ObjcInstance::end):
(ObjcInstance::getClass):
(ObjcInstance::invokeMethod):
(ObjcInstance::defaultValue):
(ObjcInstance::stringValue):
(ObjcInstance::numberValue):
(ObjcInstance::booleanValue):
(ObjcInstance::valueOf):
* bindings/objc/objc_jsobject.h: Added.
* bindings/objc/objc_jsobject.mm: Added.
* bindings/objc/objc_runtime.h:
(KJS::Bindings::ObjcField::~ObjcField):
(KJS::Bindings::ObjcField::ObjcField):
(KJS::Bindings::ObjcField::operator=):
(KJS::Bindings::ObjcMethod::ObjcMethod):
(KJS::Bindings::ObjcMethod::~ObjcMethod):
(KJS::Bindings::ObjcMethod::operator=):
* bindings/objc/objc_runtime.mm: Added.
(ObjcMethod::ObjcMethod):
(ObjcMethod::name):
(ObjcMethod::numParameters):
(ObjcMethod::getMethodSignature):
(ObjcField::ObjcField):
(ObjcField::name):
(ObjcField::type):
(ObjcField::valueFromInstance):
(ObjcField::setValueToInstance):
* bindings/objc/objc_utility.h: Added.
(KJS::Bindings::):
* bindings/objc/objc_utility.mm: Added.
(KJS::Bindings::JSMethodNameToObjCMethodName):
(KJS::Bindings::convertValueToObjcValue):
(KJS::Bindings::convertObjcValueToValue):
(KJS::Bindings::objcValueTypeForType):
* bindings/runtime.cpp:
(MethodList::MethodList):
(MethodList::operator=):
(Instance::setValueOfField):
(Instance::createBindingForLanguageInstance):
(Instance::createRuntimeObject):
* bindings/runtime.h:
* bindings/runtime_method.cpp:
(RuntimeMethodImp::RuntimeMethodImp):
(RuntimeMethodImp::get):
(RuntimeMethodImp::call):
* bindings/runtime_method.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::get):
(RuntimeObjectImp::hasProperty):
* bindings/test.js: Added.
* bindings/testbindings.mm: Added.
(-[MySecondInterface init]):
(-[MyFirstInterface init]):
(-[MyFirstInterface dealloc]):
(+[MyFirstInterface JavaScriptNameForSelector:]):
(-[MyFirstInterface getInt]):
(-[MyFirstInterface setInt:]):
(-[MyFirstInterface getMySecondInterface]):
(-[MyFirstInterface logMessage:]):
(GlobalImp::className):
(readJavaScriptFromFile):
(main):
=== Safari-128 ===
2004-02-08 Darin Adler <darin@apple.com>
Reviewed by Dave.
- fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
* JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
macros from working right in C++ code that uses the <cctype> header.
* kjs/ustring.cpp:
(KJS::inlineUTF8SequenceLengthNonASCII): Added.
(KJS::UTF8SequenceLengthNonASCII): Added.
(KJS::inlineUTF8SequenceLength): Added.
(KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
(KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
(KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
(KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
(KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
- fixed the test program so it won't hit the interpreter lock assertion
* kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
=== Safari-127 ===
2004-02-06 Richard Williamson <rjw@apple.com>
Fixed 3550242 and 3546977. The first diff prevents an assert from firing. The second diff prevents a JavaScript exception, caused be an invalid conversion, which has a downstream consequence of preventing a valid conversion.
Reviewed by John.
* bindings/jni/jni_jsobject.cpp:
(JSObject::toString):
* bindings/jni/jni_utility.cpp:
(KJS::Bindings::convertValueToJValue):
2004-02-02 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
* kjs/array_object.cpp:
(ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
we start putting values in. This prevents new Array(2147483647) from causing trouble.
(ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
number is out of range. This prevents new Array(-1) from causing trouble.
- fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
* kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
casting to int. Results now match those in other browsers.
2004-02-02 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
- fixed other related overflow issues
* kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
* kjs/value.cpp:
(ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
must not restrict values to the range of a particular integer type.
(ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
proper handling for negative results from fmod.
(ValueImp::toUInt32): Ditto.
(ValueImp::toUInt16): Ditto.
(ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
* kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
out-of-integer-range values better in the slice function.
* kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
* kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
out-of-integer-range values better in the toString function.
* kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
and substr functions.
=== Safari-126 ===
2004-01-30 Richard Williamson <rjw@apple.com>
Fixed 3542044. Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
Reviewed by Darin.
* bindings/jni/jni_instance.cpp:
(JavaInstance::stringValue):
2004-01-26 Darin Adler <darin@apple.com>
* Makefile.am: Switch from pbxbuild to xcodebuild.
2004-01-22 Richard Williamson <rjw@apple.com>
Added stubs for ObjC language binding to JavaScript.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/jni/jni_runtime.h:
* bindings/objc/objc_runtime.h: Added.
(KJS::Bindings::ObjcParameter::ObjcParameter):
(KJS::Bindings::ObjcParameter::~ObjcParameter):
(KJS::Bindings::ObjcParameter::operator=):
(KJS::Bindings::ObjcParameter::type):
(KJS::Bindings::ObjcConstructor::ObjcConstructor):
(KJS::Bindings::ObjcConstructor::~ObjcConstructor):
(KJS::Bindings::ObjcConstructor::_commonCopy):
(KJS::Bindings::ObjcConstructor::operator=):
(KJS::Bindings::ObjcConstructor::value):
(KJS::Bindings::ObjcConstructor::parameterAt):
(KJS::Bindings::ObjcConstructor::numParameters):
(KJS::Bindings::ObjcField::ObjcField):
(KJS::Bindings::ObjcField::~ObjcField):
* bindings/runtime.h:
2004-01-22 Richard Williamson <rjw@apple.com>
Simplified JavaString by using UString as backing store. This
revealed a bug in CString's assignment operator which I fixed.
Removed some dead code.
Reviewed by John.
* bindings/jni/jni_runtime.h:
(KJS::Bindings::JavaString::JavaString):
(KJS::Bindings::JavaString::_commonInit):
(KJS::Bindings::JavaString::UTF8String):
(KJS::Bindings::JavaString::uchars):
(KJS::Bindings::JavaString::length):
(KJS::Bindings::JavaString::ustring):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::RuntimeObjectImp):
* bindings/runtime_object.h:
* kjs/ustring.cpp:
(KJS::CString::CString):
(KJS::CString::operator=):
=== Safari-125 ===
=== Safari-124 ===
2004-01-16 Richard Williamson <rjw@apple.com>
Fixed 3525853. We weren't handling mapping to overloaded Java
methods very well. Even though this is undefined the other
browsers support it. Also fixed a bug with returning arrays
from Java functions.
Reviewed by John.
* bindings/jni/jni_class.cpp:
(JavaClass::_commonInit):
(JavaClass::methodsNamed):
* bindings/jni/jni_class.h:
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
* bindings/jni/jni_instance.h:
* bindings/jni/jni_runtime.cpp:
(JavaArray::convertJObjectToArray):
(JavaField::valueFromInstance):
(JavaMethod::signature):
(JavaArray::valueAt):
* bindings/jni/jni_runtime.h:
* bindings/jni_jsobject.cpp:
(JSObject::call):
(JSObject::convertJObjectToValue):
* bindings/runtime.cpp:
(MethodList::addMethod):
(MethodList::length):
(MethodList::methodAt):
(MethodList::~MethodList):
* bindings/runtime.h:
(KJS::Bindings::MethodList::MethodList):
* bindings/runtime_method.cpp:
(RuntimeMethodImp::RuntimeMethodImp):
(RuntimeMethodImp::get):
(RuntimeMethodImp::call):
* bindings/runtime_method.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::get):
(RuntimeObjectImp::hasProperty):
2004-01-16 Richard Williamson <rjw@apple.com>
Fixed 3531229. Another place that needs the Push/PopLocalFrame
protection implemented for 3530401.
Reviewed by John.
* bindings/runtime_method.cpp:
(RuntimeMethodImp::call):
2004-01-15 Richard Williamson <rjw@apple.com>
Fixed 3530401. JNI doesn't cleanup local refs created on the
main thread. IMO this is a bad bug in our JMI implementation.
To work-around the problem I explicitly delete all local refs.
Further, I've added Push/PopLocalFrame calls to catch any refs
that I may have missed. This will guarantee that we don't leak
any Java references.
Reviewed by John.
* bindings/jni/jni_class.cpp:
(JavaClass::_commonInit):
(JavaClass::JavaClass):
* bindings/jni/jni_instance.cpp:
(JavaInstance::begin):
(JavaInstance::end):
* bindings/jni/jni_instance.h:
* bindings/jni/jni_runtime.cpp:
(JavaConstructor::JavaConstructor):
(JavaMethod::JavaMethod):
* bindings/jni_jsobject.cpp:
(JSObject::listFromJArray):
* bindings/runtime.h:
(KJS::Bindings::Instance::begin):
(KJS::Bindings::Instance::end):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::get):
(RuntimeObjectImp::put):
(RuntimeObjectImp::canPut):
(RuntimeObjectImp::hasProperty):
(RuntimeObjectImp::defaultValue):
2004-01-15 Vicki Murley <vicki@apple.com>
Reviewed by Darin.
* JavaScriptCore.pbproj/project.pbxproj: Update copyright date to 2004.
2004-01-14 Richard Williamson <rjw@apple.com>
Fixed 3529466. With recent changes to Java plugin we must no
longer call DeleteLocalRef(). Not a problem, it was an optimization anyway.
Reviewed by John.
* bindings/jni/jni_instance.cpp:
(JObjectWrapper::JObjectWrapper):
=== Safari-122 ===
2004-01-14 Richard Williamson <rjw@apple.com>
Fixed 3529010.
Finalize may be called on an JSObject after we've already remove all our references. The assert in this case is firing because we've received a finalize call from Java for an instance that we no longer know about. The fix is to check in finalize that we're getting a call on an instance that we still care about.
Reviewed by John.
* bindings/jni_jsobject.cpp:
(addJavaReference):
(removeJavaReference):
(RootObject::removeAllJavaReferencesForRoot):
(JSObject::invoke):
2004-01-13 Richard Williamson <rjw@apple.com>
Fixed 3528324.
The run loop that is used to execute JavaScript (in practice, always the main run loop) is held in a class variable. It is set and retained once and should not be released. Unfortunately is it being released when the 'root' object on a LiveConnect applet is released. This has the symptom of eventually causing an deallocation of the main run loop! Usually after about 5 instantiations/destructions of a LiveConnect applet. The CFRelease of the run loop was removed.
Reviewed by Hyatt.
* bindings/jni_jsobject.h:
(KJS::Bindings::RootObject::~RootObject):
=== Safari-121 ===
=== Safari-120 ===
2004-01-06 Richard Williamson <rjw@apple.com>
Fixed 3521814. Finalize messages weren't being dispatched!
Reviewed by John.
* bindings/jni_jsobject.cpp:
(JSObject::invoke):
2004-01-05 Richard Williamson <rjw@apple.com>
Added cache of JNI method IDs to minimize allocations. This mitigates the problem
described by 3515579.
Also cleanup up logging of Java exceptions.
Reviewed by John.
* bindings/jni/jni_class.cpp:
(JavaClass::classForInstance):
* bindings/jni/jni_instance.cpp:
(JavaInstance::JavaInstance):
(JavaInstance::getClass):
(JavaInstance::invokeMethod):
(JObjectWrapper::JObjectWrapper):
(JObjectWrapper::~JObjectWrapper):
* bindings/jni/jni_instance.h:
(KJS::Bindings::JavaInstance::operator=):
* bindings/jni/jni_runtime.cpp:
(JavaMethod::JavaMethod):
(JavaMethod::methodID):
* bindings/jni/jni_runtime.h:
(KJS::Bindings::JavaMethod::JavaMethod):
* bindings/jni/jni_utility.cpp:
(callJNIMethod):
(callJNIMethodIDA):
(callJNIMethodA):
(KJS::Bindings::getMethodID):
(KJS::Bindings::callJNIVoidMethodIDA):
(KJS::Bindings::callJNIObjectMethodIDA):
(KJS::Bindings::callJNIByteMethodIDA):
(KJS::Bindings::callJNICharMethodIDA):
(KJS::Bindings::callJNIShortMethodIDA):
(KJS::Bindings::callJNIIntMethodIDA):
(KJS::Bindings::callJNILongMethodIDA):
(KJS::Bindings::callJNIFloatMethodIDA):
(KJS::Bindings::callJNIDoubleMethodIDA):
(KJS::Bindings::callJNIBooleanMethodIDA):
(KJS::Bindings::getCharactersFromJStringInEnv):
(KJS::Bindings::getUCharactersFromJStringInEnv):
(KJS::Bindings::getJNIField):
* bindings/jni/jni_utility.h:
l2003-12-23 John Sullivan <sullivan@apple.com>
* JavaScriptCore.pbproj/project.pbxproj:
Xcode version wars, harmless
2003-12-23 Darin Adler <darin@apple.com>
Reviewed by John (concept, not code, which is just the old code coming back).
- fixed 3518092: REGRESSION (100-119): getting NaN instead of HH:MM times
* kjs/date_object.cpp: Added back our CF-based implementations of gmtime, localtime,
mktime, timegm, and time, because mktime, at least, won't handle a year of 0.
2003-12-19 Richard Williamson <rjw@apple.com>
Fixed 3515597. When an error occurs we need
to make sure result values are zeroed.
Cleaned up logs by adding a newline.
Reviewed by John.
* bindings/jni/jni_utility.cpp:
(KJS::Bindings::getJavaVM):
(KJS::Bindings::getJNIEnv):
(callJNIMethod):
(callJNIMethodA):
(KJS::Bindings::getJNIField):
* bindings/jni_jsobject.cpp:
(JSObject::convertValueToJObject):
=== Safari-119 ===
2003-12-17 Richard Williamson <rjw@apple.com>
Ensure that all the symbols we export are in the KJS
namespace (3512245).
Also renamed JavaString.characters() to JavaString.UTF8String()
for enhanced clarity.
Added some sanity checking to constructor of JObjectWrapper.
Reviewed by Dave.
* ChangeLog:
* bindings/jni/jni_class.cpp:
* bindings/jni/jni_class.h:
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
(JObjectWrapper::JObjectWrapper):
* bindings/jni/jni_instance.h:
* bindings/jni/jni_runtime.cpp:
(JavaParameter::JavaParameter):
(JavaField::JavaField):
(JavaMethod::JavaMethod):
(JavaMethod::signature):
* bindings/jni/jni_runtime.h:
(KJS::Bindings::JavaString::ascii):
(KJS::Bindings::JavaString::UTF8String):
(KJS::Bindings::JavaString::JavaString):
(KJS::Bindings::JavaString::_commonInit):
(KJS::Bindings::JavaString::uchars):
(KJS::Bindings::JavaString::length):
(KJS::Bindings::JavaString::ustring):
(KJS::Bindings::JavaParameter::type):
(KJS::Bindings::JavaField::name):
(KJS::Bindings::JavaField::type):
(KJS::Bindings::JavaMethod::name):
(KJS::Bindings::JavaMethod::returnType):
* bindings/jni/jni_utility.cpp:
(KJS::Bindings::getJavaVM):
(KJS::Bindings::getJNIEnv):
(KJS::Bindings::callJNIVoidMethod):
(KJS::Bindings::callJNIObjectMethod):
(KJS::Bindings::callJNIBooleanMethod):
(KJS::Bindings::callJNIByteMethod):
(KJS::Bindings::callJNICharMethod):
(KJS::Bindings::callJNIShortMethod):
(KJS::Bindings::callJNIIntMethod):
(KJS::Bindings::callJNILongMethod):
(KJS::Bindings::callJNIFloatMethod):
(KJS::Bindings::callJNIDoubleMethod):
(KJS::Bindings::callJNIVoidMethodA):
(KJS::Bindings::callJNIObjectMethodA):
(KJS::Bindings::callJNIByteMethodA):
(KJS::Bindings::callJNICharMethodA):
(KJS::Bindings::callJNIShortMethodA):
(KJS::Bindings::callJNIIntMethodA):
(KJS::Bindings::callJNILongMethodA):
(KJS::Bindings::callJNIFloatMethodA):
(KJS::Bindings::callJNIDoubleMethodA):
(KJS::Bindings::callJNIBooleanMethodA):
(KJS::Bindings::getCharactersFromJString):
(KJS::Bindings::releaseCharactersForJString):
(KJS::Bindings::getCharactersFromJStringInEnv):
(KJS::Bindings::releaseCharactersForJStringInEnv):
(KJS::Bindings::getUCharactersFromJStringInEnv):
(KJS::Bindings::releaseUCharactersForJStringInEnv):
(KJS::Bindings::JNITypeFromClassName):
(KJS::Bindings::signatureFromPrimitiveType):
(KJS::Bindings::JNITypeFromPrimitiveType):
(KJS::Bindings::getJNIField):
(KJS::Bindings::convertValueToJValue):
* bindings/jni/jni_utility.h:
* bindings/jni_jsobject.cpp:
(KJS::Bindings::JSObject::invoke):
(KJS::Bindings::JSObject::JSObject):
(KJS::Bindings::JSObject::call):
(KJS::Bindings::JSObject::eval):
(KJS::Bindings::JSObject::getMember):
(KJS::Bindings::JSObject::setMember):
(KJS::Bindings::JSObject::removeMember):
(KJS::Bindings::JSObject::getSlot):
(KJS::Bindings::JSObject::setSlot):
(KJS::Bindings::JSObject::toString):
(KJS::Bindings::JSObject::finalize):
(KJS::Bindings::JSObject::createNative):
(KJS::Bindings::JSObject::convertValueToJObject):
(KJS::Bindings::JSObject::convertJObjectToValue):
(KJS::Bindings::JSObject::listFromJArray):
* bindings/jni_jsobject.h:
* bindings/runtime.cpp:
* bindings/runtime.h:
* bindings/runtime_method.cpp:
* bindings/runtime_method.h:
=== Safari-118 ===
2003-12-16 Richard Williamson <rjw@apple.com>
Ack! More assertions. Lock ALL entry points into the interpreter!
(3511733).
Reviewed by Ken.
* bindings/jni_jsobject.cpp:
(Bindings::JSObject::call):
(Bindings::JSObject::eval):
(Bindings::JSObject::getMember):
(Bindings::JSObject::setMember):
(Bindings::JSObject::removeMember):
(Bindings::JSObject::getSlot):
(Bindings::JSObject::setSlot):
(Bindings::JSObject::convertJObjectToValue):
2003-12-15 Richard Williamson <rjw@apple.com>
Fixed a couple of snafus and removed some logging.
Reviewed by Maciej.
* bindings/jni_jsobject.cpp:
(Bindings::performJavaScriptAccess):
(Bindings::completedJavaScriptAccess):
(Bindings::dispatchToJavaScriptThread):
Removed some annoying JS_LOG clutter.
(Bindings::RootObject::removeAllJavaReferencesForRoot):
Fixed allocation of key buffer that was called after it was needed.
(Bindings::JSObject::invoke):
(Bindings::JSObject::JSObject):
(Bindings::JSObject::getMember):
(Bindings::JSObject::getSlot):
Added additional interpreter locks around getMember and getSlot.
These functions may cause allocation of JS impls.
2003-12-15 Richard Williamson <rjw@apple.com>
args weren't passed to 'call' invocation. d'oh.
lock interpreter when we create instances of JS impls.
Reviewed by Maciej.
* bindings/jni_jsobject.cpp:
(Bindings::JSObject::call):
(Bindings::JSObject::eval):
(Bindings::JSObject::getMember):
(Bindings::JSObject::setMember):
(Bindings::JSObject::getSlot):
(Bindings::JSObject::convertValueToJObject):
(Bindings::JSObject::convertJObjectToValue):
(Bindings::JSObject::listFromJArray):
* bindings/jni_jsobject.h:
2003-12-15 Richard Williamson <rjw@apple.com>
Last piece of LiveConnect! This checkin adds implementation
of the Java to JavaScript object conversion functions.
Reviewed by John.
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
* bindings/jni/jni_utility.cpp:
* bindings/jni/jni_utility.h:
* bindings/jni_jsobject.cpp:
(Bindings::JSObject::invoke):
(Bindings::JSObject::call):
(Bindings::JSObject::eval):
(Bindings::JSObject::getMember):
(Bindings::JSObject::setMember):
(Bindings::JSObject::getSlot):
(Bindings::JSObject::setSlot):
(Bindings::JSObject::createNative):
(Bindings::JSObject::convertValueToJObject):
(Bindings::JSObject::convertJObjectToValue):
(Bindings::JSObject::listFromJArray):
* bindings/jni_jsobject.h:
(Bindings::):
* bindings/runtime_method.cpp:
(RuntimeMethodImp::get):
(RuntimeMethodImp::codeType):
(RuntimeMethodImp::execute):
2003-12-12 Richard Williamson <rjw@apple.com>
Added implementation of stubs in JSObject. All that
remains is a couple of simple conversion functions stubs and
we're done with LiveConnect. Also, changed string passing to
JS to use uchars instead of chars.
Reviewed by Maciej.
* bindings/jni/jni_runtime.h:
(Bindings::JavaString::JavaString):
(Bindings::JavaString::_commonInit):
(Bindings::JavaString::_commonCopy):
(Bindings::JavaString::_commonDelete):
(Bindings::JavaString::~JavaString):
(Bindings::JavaString::operator=):
(Bindings::JavaString::uchars):
(Bindings::JavaString::length):
(Bindings::JavaString::ustring):
* bindings/jni/jni_utility.cpp:
(getUCharactersFromJStringInEnv):
(releaseUCharactersForJStringInEnv):
(convertValueToJObject):
(convertJObjectToValue):
* bindings/jni/jni_utility.h:
* bindings/jni_jsobject.cpp:
(Bindings::JSObject::invoke):
(Bindings::JSObject::call):
(Bindings::JSObject::eval):
(Bindings::JSObject::getMember):
(Bindings::JSObject::setMember):
(Bindings::JSObject::removeMember):
(Bindings::JSObject::getSlot):
(Bindings::JSObject::setSlot):
* bindings/jni_jsobject.h:
2003-12-12 Richard Williamson <rjw@apple.com>
Ensure that all calls from Java into JavaScript are
performed on a designated thread (the main thread).
Reviewed by Ken.
* bindings/jni_jsobject.cpp:
(isJavaScriptThread):
(rootForImp):
(Bindings::performJavaScriptAccess):
(Bindings::completedJavaScriptAccess):
(Bindings::initializeJavaScriptAccessLock):
(Bindings::lockJavaScriptAccess):
(Bindings::unlockJavaScriptAccess):
(Bindings::dispatchToJavaScriptThread):
(Bindings::RootObject::setFindRootObjectForNativeHandleFunction):
(Bindings::RootObject::removeAllJavaReferencesForRoot):
(Bindings::JSObject::invoke):
(Bindings::JSObject::JSObject):
(Bindings::JSObject::call):
(Bindings::JSObject::eval):
(Bindings::JSObject::getMember):
(Bindings::JSObject::setMember):
(Bindings::JSObject::removeMember):
(Bindings::JSObject::getSlot):
(Bindings::JSObject::setSlot):
(Bindings::JSObject::toString):
(Bindings::JSObject::finalize):
(Bindings::JSObject::getWindow):
* bindings/jni_jsobject.h:
(Bindings::RootObject::~RootObject):
(Bindings::RootObject::findRootObjectForNativeHandleFunction):
(Bindings::RootObject::runLoop):
(Bindings::RootObject::performJavaScriptSource):
(Bindings::):
2003-12-11 Richard Williamson <rjw@apple.com>
Added support for calling a JavaScript function from
Java. Right now this only works for void func(void)
functions, but the conversion of args and return values
will come shortly.
Cleaned up and verified reference counting scheme, and
dereferencing of vended JavaScript objects when applet is
destroyed (actually when part is destroyed).
Removed link hack for testkjs now that the Java folks think
they have a solution for the 1.4.2 JavaVM link problem. Although
Greg B. thinks his solution may cause problems for the 1.3.1
version of the VM!?!
Reviewed by Ken.
* Makefile.am:
* bindings/jni/jni_runtime.h:
(Bindings::JavaString::JavaString):
* bindings/jni/jni_utility.cpp:
(convertValueToJValue):
(convertValueToJObject):
(listFromJArray):
* bindings/jni/jni_utility.h:
* bindings/jni_jsobject.cpp:
(KJS_setFindRootObjectForNativeHandleFunction):
(KJS_findRootObjectForNativeHandleFunction):
(getReferencesByRootDictionary):
(getReferencesDictionary):
(findReferenceDictionary):
(rootForImp):
(addJavaReference):
(removeJavaReference):
* bindings/jni_jsobject.h:
(Bindings::RootObject::RootObject):
(Bindings::RootObject::~RootObject):
(Bindings::RootObject::setRootObjectImp):
(Bindings::RootObject::rootObjectImp):
(Bindings::RootObject::setInterpreter):
(Bindings::RootObject::interpreter):
=== Safari-117 ===
2003-12-10 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed regression in JavaScript tests reported by the KDE guys
- fixed 3506345: REGRESSION (115-116): VIP: chordfind.com no longer displays chords
* kjs/ustring.h: Add tolerateEmptyString parameter to toDouble and toULong.
* kjs/ustring.cpp:
(KJS::UString::toDouble): Separate the "tolerant" parameter into two separate ones:
tolerateTrailingJunk and tolerateEmptyString. Add new overloads; better for code size
and binary compatibility than default parameter values.
(KJS::UString::toULong): Pass tolerateEmptyString down to toDouble. Add new overload.
* kjs/string_object.cpp: (StringProtoFuncImp::call): Pass false for the new
"tolerate empty string" parameter.
2003-12-10 Richard Williamson <rjw@apple.com>
Added code to manage reference counting of JavaScript
objects passed to Java. Also added implementation of
KJS_JSCreateNativeJSObject. This is the function that
provides the root object to Java (KJS::Window).
Reviewed by Hyatt.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/jni_jsobject.cpp:
(KJS_setFindObjectForNativeHandleFunction):
(KJS_findObjectForNativeHandleFunction):
(getReferencesByOwnerDictionary):
(getReferencesDictionary):
(findReferenceDictionary):
(addJavaReference):
(removeJavaReference):
(removeAllJavaReferencesForOwner):
* bindings/jni_jsobject.h:
2003-12-09 Richard Williamson <rjw@apple.com>
LiveConnect stubs that correspond to the native methods
on JSObject. These will be called from the new Java plugin
when an instance of JSObject is instantiated and messaged.
When these are implemented the Java will be able to originate
calls into JavaScript.
Also a temporary work-around added to Makefile.am to solve
a link problem. The 1.4.2 JavaVM accidentally links against
libobjc. This call a failure linking testkjs. Mike Hay is
working with someone to fix the problem (3505587).
Reviewed by Chris.
* JavaScriptCore.pbproj/project.pbxproj:
* Makefile.am:
* bindings/jni_jsobject.cpp: Added.
(KJS_JSCreateNativeJSObject):
(KJS_JSObject_JSFinalize):
(KJS_JSObject_JSObjectCall):
(KJS_JSObject_JSObjectEval):
(KJS_JSObject_JSObjectGetMember):
(KJS_JSObject_JSObjectSetMember):
(KJS_JSObject_JSObjectRemoveMember):
(KJS_JSObject_JSObjectGetSlot):
(KJS_JSObject_JSObjectSetSlot):
(KJS_JSObject_JSObjectToString):
* bindings/jni_jsobject.h: Added.
2003-12-09 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
<rdar://problem/3505183>: JavaScriptCore should assert that interpreter is locked in collector
* kjs/collector.cpp:
(KJS::Collector::allocate): Assert that interpreter lock count is not 0.
(KJS::Collector::collect): likewise
2003-12-08 Richard Williamson <rjw@apple.com>
LiveConnect: The last piece of the JavaScript side of the
LiveConnect implementation. This change adds support for
setting/getting values from Java arrays in JavaScript.
Reviewed by John.
* bindings/jni/jni_instance.h:
* bindings/jni/jni_runtime.cpp:
(JavaField::JavaField):
(convertJObjectToArray):
(JavaArray::JavaArray):
(JavaArray::~JavaArray):
(JavaArray::setValueAt):
(JavaArray::valueAt):
(JavaArray::getLength):
* bindings/jni/jni_runtime.h:
(Bindings::JavaArray::operator=):
(Bindings::JavaArray::javaArray):
* bindings/jni/jni_utility.cpp:
(JNITypeFromPrimitiveType):
(convertValueToJValue):
* bindings/jni/jni_utility.h:
* bindings/runtime.h:
* bindings/runtime_array.cpp:
(RuntimeArrayImp::RuntimeArrayImp):
(RuntimeArrayImp::~RuntimeArrayImp):
(RuntimeArrayImp::get):
(RuntimeArrayImp::put):
(RuntimeArrayImp::hasProperty):
* bindings/runtime_array.h:
(KJS::RuntimeArrayImp::getLength):
(KJS::RuntimeArrayImp::getConcreteArray):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::get):
(RuntimeObjectImp::canPut):
(RuntimeObjectImp::hasProperty):
2003-12-05 Richard Williamson <rjw@apple.com>
LiveConnect: Part 1 of supporting JS bindings to
native language arrays.
Reviewed by Chris.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/jni/jni_runtime.cpp:
(JavaField::JavaField):
(convertJObjectToArray):
(JavaField::valueFromInstance):
(JavaField::setValueToInstance):
* bindings/jni/jni_runtime.h:
* bindings/runtime.cpp:
(Instance::setValueOfField):
* bindings/runtime.h:
(Bindings::Array::~Array):
2003-12-04 Richard Williamson <rjw@apple.com>
LiveConnect: Moved defaultValue into concrete implementation because
more intelligent conversion can be perform with knowledge
of the class of the original instance.
Reviewed by Chris.
* bindings/jni/jni_class.cpp:
(JavaClass::isNumberClass):
(JavaClass::isBooleanClass):
(JavaClass::isStringClass):
* bindings/jni/jni_class.h:
* bindings/jni/jni_instance.cpp:
(JavaInstance::defaultValue):
(JavaInstance::valueOf):
* bindings/jni/jni_instance.h:
(Bindings::JavaInstance::javaInstance):
* bindings/runtime.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::defaultValue):
2003-12-04 Richard Williamson <rjw@apple.com>
LiveConnect: Added support for setting the value of Java
fields.
Reviewed by Chris.
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
* bindings/jni/jni_runtime.cpp:
(JavaParameter::JavaParameter):
(JavaField::JavaField):
(JavaField::valueFromInstance):
(JavaField::setValueToInstance):
(JavaMethod::JavaMethod):
* bindings/jni/jni_runtime.h:
(Bindings::JavaField::getJNIType):
* bindings/jni/jni_utility.cpp:
(JNITypeFromClassName):
(convertValueToJValue):
* bindings/jni/jni_utility.h:
* bindings/runtime.cpp:
(Instance::setValueOfField):
* bindings/runtime.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::get):
(RuntimeObjectImp::put):
(RuntimeObjectImp::defaultValue):
2003-12-04 Richard Williamson <rjw@apple.com>
Added support for string conversions.
Changed various JavaString member variables to be inline.
Implemented defaultValue for context relevant type coercion.
Reviewed by Chris.
* bindings/jni/jni_class.cpp:
(JavaClass::JavaClass):
(JavaClass::setClassName):
(JavaClass::classForInstance):
* bindings/jni/jni_class.h:
* bindings/jni/jni_instance.cpp:
(JavaInstance::stringValue):
(JavaInstance::numberValue):
(JavaInstance::booleanValue):
(JavaInstance::invokeMethod):
* bindings/jni/jni_instance.h:
* bindings/jni/jni_runtime.cpp:
(JavaParameter::JavaParameter):
(JavaField::JavaField):
(JavaMethod::JavaMethod):
(appendClassName):
(JavaMethod::signature):
* bindings/jni/jni_runtime.h:
(Bindings::JavaString::JavaString):
(Bindings::JavaString::~JavaString):
(Bindings::JavaString::operator=):
(Bindings::JavaString::characters):
(Bindings::JavaParameter::JavaParameter):
(Bindings::JavaParameter::~JavaParameter):
(Bindings::JavaParameter::operator=):
(Bindings::JavaParameter::type):
(Bindings::JavaField::JavaField):
(Bindings::JavaField::~JavaField):
(Bindings::JavaField::operator=):
(Bindings::JavaField::name):
(Bindings::JavaField::type):
(Bindings::JavaMethod::JavaMethod):
(Bindings::JavaMethod::_commonDelete):
(Bindings::JavaMethod::name):
(Bindings::JavaMethod::returnType):
* bindings/jni/jni_utility.cpp:
(convertValueToJValue):
* bindings/runtime.h:
(Bindings::Instance::valueOf):
* bindings/runtime_method.cpp:
(RuntimeMethodImp::call):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::RuntimeObjectImp):
(RuntimeObjectImp::get):
(RuntimeObjectImp::defaultValue):
* bindings/runtime_object.h:
(KJS::RuntimeObjectImp::classInfo):
=== Safari-116 ===
2003-12-03 Richard Williamson <rjw@apple.com>
LiveConnect: Added support for parameter passing to Java and conversion
of return values.
Reviewed by Chris.
* bindings/jni/jni_instance.cpp:
(JavaInstance::invokeMethod):
* bindings/jni/jni_instance.h:
* bindings/jni/jni_runtime.cpp:
(JavaParameter::JavaParameter):
(JavaMethod::JavaMethod):
(JavaMethod::signature):
* bindings/jni/jni_runtime.h:
(Bindings::JavaParameter::JavaParameter):
(Bindings::JavaParameter::operator=):
(Bindings::JavaParameter::getJNIType):
* bindings/jni/jni_utility.cpp:
(callJNIBooleanMethodA):
(convertValueToJValue):
* bindings/jni/jni_utility.h:
* bindings/runtime.h:
* bindings/runtime_method.cpp:
(RuntimeMethodImp::call):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::get):
2003-12-02 Richard Williamson <rjw@apple.com>
Added support for calling simple methods in Java from JavaScript.
(void return and no parameters). Yay, LiveConnect lives.
Still need write argument and return value conversion code.
Reviewed by Chris.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/jni/jni_instance.cpp:
(JavaInstance::getClass):
(JavaInstance::invokeMethod):
* bindings/jni/jni_instance.h:
* bindings/jni/jni_runtime.cpp:
(JavaMethod::JavaMethod):
(JavaMethod::signature):
(JavaMethod::JNIReturnType):
* bindings/jni/jni_runtime.h:
(Bindings::JavaMethod::_commonDelete):
(Bindings::JavaMethod::_commonCopy):
(Bindings::JavaMethod::name):
* bindings/jni/jni_utility.cpp:
(signatureFromPrimitiveType):
* bindings/jni/jni_utility.h:
* bindings/runtime.h:
* bindings/runtime_method.cpp: Added.
(RuntimeMethodImp::RuntimeMethodImp):
(RuntimeMethodImp::~RuntimeMethodImp):
(RuntimeMethodImp::get):
(RuntimeMethodImp::implementsCall):
(RuntimeMethodImp::call):
(RuntimeMethodImp::codeType):
(RuntimeMethodImp::execute):
* bindings/runtime_method.h: Added.
* bindings/runtime_object.cpp:
(RuntimeObjectImp::RuntimeObjectImp):
(RuntimeObjectImp::get):
* bindings/runtime_object.h:
* kjs/function.cpp:
(FunctionImp::FunctionImp):
* kjs/interpreter.h:
2003-12-01 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed 3493799: JavaScript string.replace expands $ if it's the last character in replacement string
* kjs/ustring.cpp: (KJS::UString::toDouble): Fix backwards handling of the "tolerant" boolean.
This indirectly caused the string.replace bug.
2003-12-02 Maciej Stachowiak <mjs@apple.com>
Merged patches from Harri Porten and David Faure to fix:
<rdar://problem/3497643>: reproducible crash printing self-referential array
* kjs/array_object.cpp:
(ArrayProtoFuncImp::call): Break out of the loop if an exception was thrown.
* kjs/nodes.cpp:
(FunctionCallNode::evaluate): Move function call depth check from here...
* kjs/object.cpp:
(KJS::Object::call): ...to here.
* kjs/object.h: Un-inline Object::call now that it does more.
2003-12-01 Richard Williamson <rjw@apple.com>
Fixed mistake in method signatures used to get boolean and integer fields.
Reviewed by Chris.
* bindings/jni/jni_runtime.cpp:
(JavaField::valueFromInstance):
2003-12-01 Richard Williamson <rjw@apple.com>
Fixed parameter passing to applet. Child elements are NOT valid in setStyle(). So we now create the widget before needed with createWidgetIfNecessary. This either happens when doing the first layout, or when JavaScript first references the applet element.
Fixed early delete of the the main applet instance. When the JS collector cleaned up the last JS object referring to the applet instance we were deleting the java instance. This caused the applet instance cached on the applet element to be invalid. The applet instance is the only Java object not to be cleaned up by the JS collector.
Added support for getting at Java object fields.
Reviewed by Chris.
* JavaScriptCore.pbproj/project.pbxproj:
* Makefile.am:
* bindings/jni/jni_instance.cpp:
(JObjectWrapper::JObjectWrapper):
* bindings/jni/jni_instance.h:
(Bindings::JObjectWrapper::~JObjectWrapper):
* bindings/jni/jni_runtime.cpp:
(JavaField::valueFromInstance):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::~RuntimeObjectImp):
(RuntimeObjectImp::RuntimeObjectImp):
(RuntimeObjectImp::get):
(RuntimeObjectImp::deleteProperty):
* bindings/runtime_object.h:
=== Safari-115 ===
2003-11-21 Maciej Stachowiak <mjs@apple.com>
Patch from Harri Porten, reviewed by me.
- fixed 3491712 - String slice with negative arguments does not offset from end of string
* kjs/string_object.cpp:
(StringProtoFuncImp::call): Handle negative arguments as offsets from end by
adding length and clamping to [0,length-1].
2003-11-21 Maciej Stachowiak <mjs@apple.com>
Patch from Harri Porten, reviewed by me.
- fixed 3491709 - using Function.apply with a primitive type as the arg list causes crash
* kjs/function_object.cpp:
(FunctionProtoFuncImp::call): Nest parentheses properly.
2003-11-20 Richard Williamson <rjw@apple.com>
More LiveConnect stuff. Primitive Java fields are now
accessible from JavaScript! Yay!
Reviewed by Maciej.
* bindings/jni/jni_class.cpp:
(JavaClass::methodNamed):
(JavaClass::fieldNamed):
* bindings/jni/jni_class.h:
(Bindings::JavaClass::_commonDelete):
* bindings/jni/jni_instance.cpp:
(JavaInstance::JavaInstance):
(JavaInstance::~JavaInstance):
(JavaInstance::getClass):
* bindings/jni/jni_instance.h:
(Bindings::JavaInstance::javaInstance):
* bindings/jni/jni_runtime.cpp:
(JavaField::JavaField):
(JavaField::valueFromInstance):
* bindings/jni/jni_runtime.h:
(Bindings::JavaField::JavaField):
(Bindings::JavaField::~JavaField):
(Bindings::JavaField::operator=):
* bindings/jni/jni_utility.cpp:
(callJNIMethod):
(callJNIMethodA):
(callJNIVoidMethod):
(callJNIObjectMethod):
(callJNIBooleanMethod):
(callJNIByteMethod):
(callJNICharMethod):
(callJNIShortMethod):
(callJNIIntMethod):
(callJNILongMethod):
(callJNIFloatMethod):
(callJNIDoubleMethod):
(callJNIVoidMethodA):
(callJNIObjectMethodA):
(callJNIByteMethodA):
(callJNICharMethodA):
(callJNIShortMethodA):
(callJNIIntMethodA):
(callJNILongMethodA):
(callJNIFloatMethodA):
(callJNIDoubleMethodA):
(releaseCharactersForJStringInEnv):
(primitiveTypeFromClassName):
(getJNIField):
* bindings/jni/jni_utility.h:
* bindings/runtime.cpp:
(Instance::createBindingForLanguageInstance):
(Instance::getValueOfField):
* bindings/runtime.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::get):
2003-11-20 Richard Williamson <rjw@apple.com>
More LiveConnect stuff.
Reviewed by Chris.
* bindings/jni/jni_class.cpp:
(JavaClass::classForName):
(JavaClass::classForInstance):
* bindings/jni/jni_instance.cpp:
(JavaInstance::getValueOfField):
* bindings/jni/jni_instance.h:
(Bindings::JObjectWrapper::JObjectWrapper):
* bindings/jni/jni_runtime.h:
(Bindings::JavaConstructor::~JavaConstructor):
(Bindings::JavaConstructor::operator=):
(Bindings::JavaMethod::JavaMethod):
(Bindings::JavaMethod::_commonDelete):
(Bindings::JavaMethod::signature):
* bindings/jni/jni_utility.cpp:
(getJNIEnv):
(attachToJavaVM):
* bindings/jni/jni_utility.h:
* bindings/runtime.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::~RuntimeObjectImp):
(RuntimeObjectImp::get):
* bindings/runtime_object.h:
2003-11-19 Richard Williamson <rjw@apple.com>
More LiveConnect stuff.
Reviewed by Ken.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/jni/jni_class.cpp: Added.
(JavaClass::_commonInit):
(JavaClass::JavaClass):
(_createClassesByNameIfNecessary):
(JavaClass::classForName):
(JavaClass::classForInstance):
(JavaClass::methodNamed):
(JavaClass::fieldNamed):
* bindings/jni/jni_class.h: Added.
(Bindings::JavaClass::_commonDelete):
(Bindings::JavaClass::~JavaClass):
(Bindings::JavaClass::_commonCopy):
(Bindings::JavaClass::JavaClass):
(Bindings::JavaClass::operator=):
(Bindings::JavaClass::name):
(Bindings::JavaClass::constructorAt):
(Bindings::JavaClass::numConstructors):
* bindings/jni/jni_instance.cpp: Added.
(JavaInstance::JavaInstance):
(JavaInstance::~JavaInstance):
* bindings/jni/jni_instance.h: Added.
(Bindings::JObjectWrapper::JObjectWrapper):
(Bindings::JObjectWrapper::~JObjectWrapper):
(Bindings::JObjectWrapper::ref):
(Bindings::JObjectWrapper::deref):
(Bindings::JavaInstance::getClass):
(Bindings::JavaInstance::operator=):
* bindings/jni/jni_runtime.cpp:
(JavaMethod::JavaMethod):
* bindings/jni/jni_runtime.h:
(Bindings::JavaString::JavaString):
(Bindings::JavaString::~JavaString):
(Bindings::JavaString::operator=):
* bindings/jni/jni_utility.cpp:
(getJavaVM):
(getJNIEnv):
(getCharactersFromJString):
(releaseCharactersForJString):
(getCharactersFromJStringInEnv):
(releaseCharactersForJStringInEnv):
* bindings/jni/jni_utility.h:
* bindings/runtime.cpp:
(Instance::createBindingForLanguageInstance):
* bindings/runtime.h:
(Bindings::Instance::):
2003-11-18 Richard Williamson <rjw@apple.com>
More live connect stubs. We're getting close.
Reviewed by Chris.
* JavaScriptCore.pbproj/project.pbxproj:
* bindings/jni/jni_runtime.cpp:
(JavaClass::JavaClass):
(JavaInstance::JavaInstance):
(JavaInstance::~JavaInstance):
* bindings/jni/jni_runtime.h:
(Bindings::JavaConstructor::value):
(Bindings::JavaField::value):
(Bindings::JavaMethod::value):
(Bindings::JavaClass::_commonDelete):
(Bindings::JavaClass::_commonCopy):
(Bindings::JavaClass::methodNamed):
(Bindings::JavaClass::fieldNamed):
(Bindings::JavaInstance::getClass):
* bindings/runtime.cpp: Added.
* bindings/runtime.h:
(Bindings::Instance::~Instance):
* bindings/runtime_object.cpp: Added.
(RuntimeObjectImp::classInfo):
(RuntimeObjectImp::RuntimeObjectImp):
(RuntimeObjectImp::get):
(RuntimeObjectImp::put):
(RuntimeObjectImp::canPut):
(RuntimeObjectImp::hasProperty):
(RuntimeObjectImp::deleteProperty):
(RuntimeObjectImp::defaultValue):
(RuntimeObjectImp::_initializeClassInfoFromInstance):
* bindings/runtime_object.h: Added.
(KJS::RuntimeObjectImp::setInternalInstance):
(KJS::RuntimeObjectImp::getInternalInstance):
* kjs/object.cpp:
(KJS::ObjectImp::get):
(KJS::ObjectImp::hasProperty):
* kjs/value.h:
(KJS::):
2003-11-17 Maciej Stachowiak <mjs@apple.com>
Patch from Harri, reviewed by me.
- fixed 3487375 - backwards array slice causes infinite loop
* kjs/array_object.cpp:
(ArrayProtoFuncImp::call):
2003-11-17 Maciej Stachowiak <mjs@apple.com>
Patch from Harri Porten reviewed by me.
- fixed 3487371 - operator precedence for bitwise or, xor and and is wrong
* kjs/grammar.y: Correct the precedence.
2003-11-16 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
- fixed 3483829 - JavaScriptCore needs workaround to compile on Merlot
* JavaScriptCore.pbproj/project.pbxproj: Add -Wno-long-double to
warning flags.
=== Safari-114 ===
2003-11-13 Richard Williamson <rjw@apple.com>
Factored common code between copy constructor and assignment operator.
Reviewed by Chris.
* ChangeLog:
* bindings/jni/jni_runtime.h:
(Bindings::JavaConstructor::_commonCopy):
(Bindings::JavaConstructor::JavaConstructor):
(Bindings::JavaConstructor::operator=):
(Bindings::JavaField::type):
* bindings/runtime.h:
2003-11-13 Richard Williamson <rjw@apple.com>
More LiveConnect stuff. This checkin adds abstract classes to model
language runtimes and a JNI based set of concrete implementations for
Java.
Reviewed by Chris.
* JavaScriptCore.pbproj/project.pbxproj:
* Makefile.am:
* bindings/Makefile.am: Removed.
* bindings/jni/Makefile.am: Removed.
* bindings/jni/jni_runtime.cpp: Added.
(JavaField::JavaField):
(JavaConstructor::JavaConstructor):
(JavaMethod::JavaMethod):
(JavaClass::JavaClass):
* bindings/jni/jni_runtime.h: Added.
(Bindings::JavaString::JavaString):
(Bindings::JavaString::~JavaString):
(Bindings::JavaString::operator=):
(Bindings::JavaString::characters):
(Bindings::JavaParameter::JavaParameter):
(Bindings::JavaParameter::~JavaParameter):
(Bindings::JavaParameter::operator=):
(Bindings::JavaParameter::type):
(Bindings::JavaConstructor::JavaConstructor):
(Bindings::JavaConstructor::~JavaConstructor):
(Bindings::JavaConstructor::operator=):
(Bindings::JavaConstructor::parameterAt):
(Bindings::JavaConstructor::numParameters):
(Bindings::JavaField::JavaField):
(Bindings::JavaField::~JavaField):
(Bindings::JavaField::operator=):
(Bindings::JavaField::name):
(Bindings::JavaField::type):
(Bindings::JavaMethod::JavaMethod):
(Bindings::JavaMethod::_commonDelete):
(Bindings::JavaMethod::~JavaMethod):
(Bindings::JavaMethod::_commonCopy):
(Bindings::JavaMethod::operator=):
(Bindings::JavaMethod::name):
(Bindings::JavaMethod::returnType):
(Bindings::JavaMethod::parameterAt):
(Bindings::JavaMethod::numParameters):
(Bindings::JavaClass::_commonDelete):
(Bindings::JavaClass::~JavaClass):
(Bindings::JavaClass::_commonCopy):
(Bindings::JavaClass::JavaClass):
(Bindings::JavaClass::operator=):
(Bindings::JavaClass::name):
(Bindings::JavaClass::methodAt):
(Bindings::JavaClass::numMethods):
(Bindings::JavaClass::constructorAt):
(Bindings::JavaClass::numConstructors):
(Bindings::JavaClass::fieldAt):
(Bindings::JavaClass::numFields):
* bindings/jni/jni_utility.cpp:
(callJNIMethod):
(callJNIMethodA):
(callJNIObjectMethod):
(callJNIByteMethod):
(callJNICharMethod):
(callJNIShortMethod):
(callJNIIntMethod):
(callJNILongMethod):
(callJNIFloatMethod):
(callJNIDoubleMethod):
(callJNIVoidMethodA):
(callJNIObjectMethodA):
(callJNIByteMethodA):
(callJNICharMethodA):
(callJNIShortMethodA):
(callJNIIntMethodA):
(callJNILongMethodA):
(callJNIFloatMethodA):
(callJNIDoubleMethodA):
(getCharactersFromJString):
(releaseCharactersForJString):
* bindings/jni/jni_utility.h:
* bindings/objc/Makefile.am: Removed.
* bindings/runtime.h: Added.
(Bindings::Parameter::~Parameter):
(Bindings::Constructor::~Constructor):
(Bindings::Field::~Field):
(Bindings::Method::~Method):
(Bindings::Class::~Class):
2003-11-13 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
- fixed 3472562 - Null or Undefined variables passed to IN operator cause javascript exceptions
* kjs/nodes.cpp:
(ForInNode::execute): If the in value is null or undefined, bail
out early, since attempting to iterate its properties will throw
an exception.
2003-11-12 Darin Adler <darin@apple.com>
- fixed the build
* Makefile.am: Fix the build by removing the bindings directory from SUBDIRS.
Later, we can either add this back and add the Makefile.am files to the top
level configure.in or leave it out and remove the Makefile.am files.
2003-11-12 Richard Williamson <rjw@apple.com>
Added utility functions for calling JNI methods.
Reviewed by Chris.
* JavaScriptCore.pbproj/project.pbxproj:
* Makefile.am:
* bindings/Makefile.am: Added.
* bindings/jni/Makefile.am: Added.
* bindings/jni/jni_utility.cpp: Added.
(attachToJavaVM):
(callJNIMethod):
(callJNIVoidMethod):
(callJNIObjectMethod):
(callJNIByteMethod):
(callJNICharMethod):
(callJNIShortMethod):
(callJNIIntMethod):
(callJNILongMethod):
(callJNIFloatMethod):
(callJNIDoubleMethod):
* bindings/jni/jni_utility.h: Added.
* bindings/objc/Makefile.am: Added.
2003-11-08 Darin Adler <darin@apple.com>
Reviewed by John.
- fixed 3477528 -- array.sort(function) fails if the function returns a non-zero value that rounds to zero
* kjs/array_object.cpp:
(compareByStringForQSort): Added checks for undefined values to match what the specification calls for.
(compareWithCompareFunctionForQSort): Added checks for undefined values as above, and also changed the
code that looks at the compare function result to look at the number returned without rounding to an integer.
(ArrayProtoFuncImp::call): Changed the code that looks at the compare function result to look at the number
returned without rounding to an integer.
=== Safari-113 ===
2003-11-03 Vicki Murley <vicki@apple.com>
Reviewed by kocienda.
- fixed <rdar://problem/3471096>: non-B&I builds should not use order files, because they cause false "regressions" in perf.
* JavaScriptCore.pbproj/project.pbxproj: added empty SECTORDER_FLAGS variables to the Development and Deployment build styles
2003-11-02 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- changed list manipulation to use Harri Porten's idea of a circular
linked list that is built from head to tail rather than building the
list backwards and reversing the list when done
* kjs/grammar.y: Handle CatchNode and FinallyNode in a type-safe way.
Change many places that passed 0L to pass nothing at all, or to pass 0.
* kjs/nodes.h:
(KJS::ElementNode::ElementNode): Build a circular list instead of a 0-terminated
backwards list.
(KJS::ArrayNode::ArrayNode): Break the circular list instead of reversing the list.
(KJS::PropertyValueNode::PropertyValueNode): Moved before ObjectLiteralNode so the
inline code in ObjectLiteralNode works. Build a circular list instead of a 0-terminated
backwards list. Made the case for the first node separate so we don't need a nil check.
(KJS::ObjectLiteralNode::ObjectLiteralNode): Break the circular list instead of
reversing the list.
(KJS::ArgumentListNode::ArgumentListNode): Build a circular list instead of a 0-terminated
backwards list. Also, made the constructors inline (moved here from .cpp file).
(KJS::ArgumentsNode::ArgumentsNode): Break the circular list instead of
reversing the list.
(KJS::NewExprNode::NewExprNode): Changed a 0L to 0.
(KJS::StatListNode::StatListNode): Make this constructor no longer inline (moved into
.cpp file). The one in the .cpp file builds a circular list instead of a 0-terminated
backwards list.
(KJS::VarDeclListNode::VarDeclListNode): Build a circular list instead of a 0-terminated
backwards list.
(KJS::VarStatementNode::VarStatementNode): Break the circular list instead of reversing
the list.
(KJS::BlockNode::BlockNode): Make this constructor no longer inline (moved into .cpp file).
The one in the .cpp file breaks the list instead of reversing it.
(KJS::ForNode::ForNode): Break the circular list instead of reversing the list.
(KJS::CaseClauseNode::CaseClauseNode): Break the circular list instead of reversing the
list.
(KJS::ClauseListNode::ClauseListNode): Build a circular list instead of a 0-terminated
backwards list.
(KJS::CaseBlockNode::CaseBlockNode): Make this constructor no longer inline (moved into
.cpp file). The one in the .cpp file breaks the list instead of reversing it.
(KJS::TryNode::TryNode): Changed constructor to take typed parameters for the catch and
finally nodes rather than just Node.
(KJS::ParameterNode::ParameterNode): Build a circular list instead of a 0-terminated
backwards list.
(KJS::FuncDeclNode::FuncDeclNode): Break the circular list instead of reversing the
list.
(KJS::FuncExprNode::FuncExprNode): Break the circular list instead of reversing the
list.
* kjs/nodes.cpp:
(StatListNode::StatListNode): Moved this constructor here, no longer inline.
Did the "break circular list" thing instead of the "reverse list" thing.
Added setLoc calls to match KJS in the KDE tree; since we don't currently
use the JavaScript debugging support, it's unclear whether there's any benefit, but
later we might be using it and it's good to be as close as possible.
(BlockNode::BlockNode): Moved this constructor here, no longer inline.
Did the "break circular list" thing instead of the "reverse list" thing.
Added setLoc calls.
(CaseBlockNode::CaseBlockNode): Moved this constructor here, no longer inline.
Did the "break circular list" thing instead of the "reverse list" thing.
(SourceElementsNode::SourceElementsNode): Moved this constructor here, no longer inline.
Did the "break circular list" thing instead of the "reverse list" thing.
Added setLoc calls.
* kjs/grammar.cpp: Regenerated.
* kjs/grammar.cpp.h: Regenerated.
* kjs/grammar.h: Regenerated.
=== Safari-112 ===
2003-10-30 Maciej Stachowiak <mjs@apple.com>
Reviewed by Ken.
- fixed 3427069 - browsing mp3.com causes leaks (KJS)
* kjs/string_object.cpp:
(StringProtoFuncImp::call): Don't do an early return, since that
could leak a temporary regexp.
2003-10-29 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- fixed 3426076 - Leak of JS lexer data visiting http://www.ebay.com
* kjs/grammar.cpp:
(yyerror): Updated the commented code.
* kjs/grammar.y: Don't delete string and identifier tokens when done
with them any more, they'll get cleaned up by the lexer now.
* kjs/internal.cpp:
(Parser::parse): Tell lexer when done parsing.
* kjs/lexer.cpp:
(Lexer::Lexer): Initialize new data members.
(Lexer::lex): Use new methods to make strings and identifiers, and
save them.
(Lexer::makeIdentifier): Make a new Identifier and save it in an
auto-growing array.
(Lexer::makeUString): Likewise for UStrings.
(Lexer::doneParsing): Clean up arrays of Ifentifiers and UStrings.
* kjs/lexer.h:
2003-10-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Ken.
- fixed 3413962 - malicious web pages can kill all future JavaScript execution by breaking recursion limit check
* kjs/nodes.cpp:
(FunctionCallNode::evaluate): If we're going to return early due
to breaking the recursion limit, make sure to lower it again, or
it will creep up by one each time it's exceeded.
2003-10-26 Darin Adler <darin@apple.com>
* JavaScriptCorePrefix.h: Added a C case to the NULL definition since we use C as well
as C++ in this project.
2003-10-26 Darin Adler <darin@apple.com>
- rolled in some CString changes Harri Porten did on the KDE side
* kjs/ustring.cpp:
(KJS::CString::CString): Use memcpy instead of strcpy for speed. Fix an off by one error
in the copy constructor.
(KJS::CString::operator=): Use memcpy instead of strcpy for speed.
* JavaScriptCorePrefix.h: Add a definition of NULL here that takes advantage of the GNU
__null feature even if the system C library doesn't.
== Rolled over to ChangeLog-2003-10-25 ==