1 2006-01-11 Ricci Adams <ricciadams@apple.com>
3 Reviewed by Geoff, landed by Darin.
5 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5307
6 Number.toFixed doesn't round 0.5 up
8 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
9 Fixed a ">" that should have been a ">=".
11 2006-01-11 Justin Haygood <justin@xiondigital.net>
13 Reviewed and landed by Darin.
15 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6486
16 JavaScriptCore should use system malloc on Windows
18 * kjs/config.h: Add USE_SYSTEM_MALLOC to the Win32 section.
20 2006-01-10 Darin Adler <darin@apple.com>
22 * Makefile: Took out unneeded "export" line.
23 * <many-files>: Changed a lot of flags (cleared bogus executable bits, set
24 MIME types, other small corrections).
26 2006-01-09 Darin Adler <darin@apple.com>
28 * Makefile.am: Removed.
30 2006-01-07 Anders Carlsson <andersca@mac.com>
34 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6373
35 REGRESSION: JavaScript hang when comparing large array to null
38 (KJS::JSObject::isEqualToNull):
39 Add new function which returns true if an object should be treated as null when
46 2006-01-07 Alexey Proskuryakov <ap@nypop.com>
50 - Fix WebCore development build
51 http://bugzilla.opendarwin.org/show_bug.cgi?id=6408
53 * kxmlcore/Assertions.h: Use __VA_ARGS__ in variadic macros.
55 2006-01-06 Maciej Stachowiak <mjs@apple.com>
59 - miscellaneous changes for 4% speedup on the JavaScript iBench
60 http://bugzilla.opendarwin.org/show_bug.cgi?id=6396
62 Changes mostly thanks to Maks Orlovich, tweaked a little by me.
64 * kjs/create_hash_table: Use the same hash as the one used by Identifier.
66 (KJS::FunctionImp::processParameters): Use the new List::copyFrom
67 (KJS::ActivationImp::ActivationImp): track variable while iterating
69 (KJS::StringImp::toObject): create StringInstance directly
71 (KJS::List::copy): implement in terms of copyFrom
72 (KJS::List::copyFrom): more efficient way to copy in another list
75 (keysMatch): updated to work with identifier hash
77 (Lookup::findEntry): ditto
81 2006-01-06 Maciej Stachowiak <mjs@apple.com>
83 - fix development build failure from the previous checkin
86 (KJS::ActivationImp::put): Use prototype() accessor in assert.
88 2006-01-05 Maciej Stachowiak <mjs@apple.com>
92 - fix remaining performance regression from Getter/Setter change
93 http://bugzilla.opendarwin.org/show_bug.cgi?id=6249
95 - Activation objects should not have __proto__ property
96 http://bugzilla.opendarwin.org/show_bug.cgi?id=6395
99 (KJS::ActivationImp::getOwnPropertySlot): Implement directly, thus
100 skipping getter/setter handling and __proto__ handling, as well
101 as inlining needed superclass stuff.
102 (KJS::ActivationImp::put): Implement directly, skipping getter/setter,
103 __proto__, and do canPut directly in PropertyMap::put since there's no
104 static property table either.
106 * kjs/property_map.cpp:
107 (KJS::PropertyMap::put): Allow optionally inlining canPut check.
108 * kjs/property_map.h:
110 2006-01-04 Geoffrey Garen <ggaren@apple.com>
112 Patch by kimmo.t.kinnunen@nokia.com, reviewed by darin, tweaked by me.
114 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4921
115 \u escape sequences in JavaScript identifiers
117 * kjs/function_object.cpp:
118 (FunctionObjectImp::construct):
122 (Lexer::isWhiteSpace):
123 (Lexer::isLineTerminator):
124 (Lexer::isIdentStart):
125 (Lexer::isIdentPart):
131 * tests/mozilla/expected.html: Updated test results.
133 2005-12-30 Maciej Stachowiak <mjs@apple.com>
135 No review, just test result update.
137 * tests/mozilla/expected.html: Updated for newly passing test from recent fixes.
139 2005-12-30 Anders Carlsson <andersca@mac.com>
143 - Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6298
144 Getter setter test is failing
147 (KJS::JSObject::put):
148 Rework the getter setter part. We now walk the prototype chain, checking for
149 getter/setter properties and only take the slow path if any are found.
151 2005-12-30 Maks Orlovich <maksim@kde.org>
153 Reviewed and committed by Maciej.
155 - Handle negative, FP numbers with non-10 radix in toString
156 http://bugzilla.opendarwin.org/show_bug.cgi?id=6259
158 (Merged from KJS, original work by Harri Porten)
160 * kjs/number_object.cpp:
161 (NumberProtoFunc::callAsFunction): rewrote Number.toString(radix) to work with
162 negative numbers, floating point and very large numbers.
164 2005-12-29 Geoffrey Garen <ggaren@apple.com>
166 Patch by Maks Orlovich, reviewed and landed by me.
168 - http://bugzilla.opendarwin.org/show_bug.cgi?id=6267
169 Fix Number.prototype.toFixed/toExponential(undefined)
171 * kjs/number_object.cpp:
172 (NumberProtoFunc::callAsFunction):
174 2005-12-29 Geoffrey Garen <ggaren@apple.com>
176 Patch by Maks Orlovich, Reviewed and landed by me.
178 - http://bugzilla.opendarwin.org/show_bug.cgi?id=6266
179 Minor object naming updates (to match Mozilla, KJS)
181 * kjs/number_object.cpp:
182 * kjs/regexp_object.cpp:
184 2005-12-29 Geoffrey Garen <ggaren@apple.com>
186 Patch by Maks Orlovich, reviewed by mjs.
188 This has 2 very minor fixes, covered by KJS testsuite:
189 1. Enumerates string indices in property list (with the same bug as array
190 object has in corresponding code). This is a mozilla emulation thing.
191 2. Permits properties with integer names in prototypes to be found
193 * kjs/string_object.cpp:
194 (StringInstance::getOwnPropertySlot):
195 (StringInstanceImp::propList):
196 * kjs/string_object.h:
198 2005-12-26 Geoffrey Garen <ggaren@apple.com>
202 - Fixed <rdar://problem/4364705> run-javascriptcore-tests crashes in
203 KJS::BlockNode::deref
205 http://bugzilla.opendarwin.org/show_bug.cgi?id=6233
206 Reproducible stack-overflow crash in ~RefPtr<T> due to RefPtr<T> use in
209 This patch does four things:
210 (1) Standardizes all our linked list nodes to use "next" as their next
212 (2) Creates the ListRefPtr<T> class, a subclass of RefPtr<T> specialized
213 to iteratively deref "next" pointers.
214 (3) Standardizes our linked list nodes to use ListRefPtr<T> and
215 implement the releaseNext() function used by ~ListRefPtr<T>().
216 (4) Adds to RefPtr<T> the release() method used by releaseNext().
218 - Modified existing mozilla test to ensure it would make deployment
219 builds crash as well.
221 * JavaScriptCore.xcodeproj/project.pbxproj:
223 (ElementNode::evaluate):
224 (PropertyListNode::evaluate):
225 (ArgumentListNode::evaluateList):
226 (StatListNode::StatListNode):
227 (StatListNode::execute):
228 (StatListNode::processVarDecls):
229 (VarDeclListNode::evaluate):
230 (VarDeclListNode::processVarDecls):
231 (VarStatementNode::execute):
232 (VarStatementNode::processVarDecls):
233 (BlockNode::BlockNode):
234 (CaseClauseNode::evalStatements):
235 (CaseClauseNode::processVarDecls):
236 (ClauseListNode::processVarDecls):
237 (CaseBlockNode::CaseBlockNode):
238 (CaseBlockNode::evalBlock):
239 (SourceElementsNode::SourceElementsNode):
240 (SourceElementsNode::execute):
241 (SourceElementsNode::processFuncDecl):
242 (SourceElementsNode::processVarDecls):
244 (KJS::ElementNode::ElementNode):
245 (KJS::ElementNode::releaseNext):
246 (KJS::ArrayNode::ArrayNode):
247 (KJS::PropertyListNode::PropertyListNode):
248 (KJS::PropertyListNode::releaseNext):
249 (KJS::ObjectLiteralNode::ObjectLiteralNode):
250 (KJS::ArgumentListNode::ArgumentListNode):
251 (KJS::ArgumentListNode::releaseNext):
252 (KJS::ArgumentsNode::ArgumentsNode):
253 (KJS::StatListNode::releaseNext):
254 (KJS::VarDeclListNode::VarDeclListNode):
255 (KJS::VarDeclListNode::releaseNext):
256 (KJS::VarStatementNode::VarStatementNode):
257 (KJS::ForNode::ForNode):
258 (KJS::CaseClauseNode::CaseClauseNode):
259 (KJS::ClauseListNode::ClauseListNode):
260 (KJS::ClauseListNode::getClause):
261 (KJS::ClauseListNode::getNext):
262 (KJS::ClauseListNode::releaseNext):
263 (KJS::ParameterNode::ParameterNode):
264 (KJS::ParameterNode::releaseNext):
265 (KJS::SourceElementsNode::releaseNext):
266 * kjs/nodes2string.cpp:
267 (ElementNode::streamTo):
268 (PropertyListNode::streamTo):
269 (ArgumentListNode::streamTo):
270 (StatListNode::streamTo):
271 (VarDeclListNode::streamTo):
272 (VarStatementNode::streamTo):
273 (CaseClauseNode::streamTo):
274 (ClauseListNode::streamTo):
275 (CaseBlockNode::streamTo):
276 (SourceElementsNode::streamTo):
277 * kxmlcore/ListRefPtr.h: Added.
278 (KXMLCore::ListRefPtr::ListRefPtr):
279 (KXMLCore::ListRefPtr::~ListRefPtr):
280 (KXMLCore::ListRefPtr::operator=):
282 (KXMLCore::RefPtr::release):
284 2005-12-29 Geoffrey Garen <ggaren@apple.com>
288 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4026
289 Math.random() not seeded.
291 Added call to sranddev() -- it executes the first time a process
294 * kjs/math_object.cpp:
295 (MathFuncImp::callAsFunction):
297 2005-12-29 Geoffrey Garen <ggaren@apple.com>
301 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6265
302 Name change regression: Java doesn't know what JavaJSObject is
304 Changed strings passed to Java back to original "JSObject".
306 * bindings/jni/jni_jsobject.cpp:
307 (JavaJSObject::convertValueToJObject):
308 (JavaJSObject::convertJObjectToValue):
310 2005-12-28 Anders Carlsson <andersca@mac.com>
314 - The JSC part of http://bugzilla.opendarwin.org/show_bug.cgi?id=6268
315 Add undetectable document.all
317 * kjs/operations.cpp:
319 When comparing an object with null or undefined, call toPrimitive with
320 NullType as the preferred type.
322 2005-12-27 Anders Carlsson <andersca@mac.com>
326 * kjs/array_object.cpp:
327 (ArrayProtoFunc::callAsFunction):
328 Implement filter and map. Also, make the existing
329 array iteration functions not invoke the callback for
330 non-existing properties, just as Mozilla does now.
332 * kjs/array_object.h:
333 (KJS::ArrayProtoFunc::):
336 * tests/mozilla/expected.html:
337 Update, two 1.6 tests now pass.
339 2005-12-27 Maciej Stachowiak <mjs@apple.com>
341 - updated test results for new JS 1.6 tests
343 * tests/mozilla/expected.html:
345 2005-12-27 Anders Carlsson <andersca@mac.com>
349 Add Mozilla JS 1.6 tests.
351 * tests/mozilla/js1_6/Array/browser.js: Added.
352 * tests/mozilla/js1_6/Array/regress-290592.js: Added.
353 * tests/mozilla/js1_6/Array/regress-304828.js: Added.
354 * tests/mozilla/js1_6/Array/regress-305002.js: Added.
355 * tests/mozilla/js1_6/Array/regress-310425-01.js: Added.
356 * tests/mozilla/js1_6/Array/regress-310425-02.js: Added.
357 * tests/mozilla/js1_6/Array/regress-320887.js: Added.
358 * tests/mozilla/js1_6/Array/shell.js: Added.
359 * tests/mozilla/js1_6/README: Added.
360 * tests/mozilla/js1_6/Regress/browser.js: Added.
361 * tests/mozilla/js1_6/Regress/regress-301574.js: Added.
362 * tests/mozilla/js1_6/Regress/regress-309242.js: Added.
363 * tests/mozilla/js1_6/Regress/regress-311157-01.js: Added.
364 * tests/mozilla/js1_6/Regress/regress-311157-02.js: Added.
365 * tests/mozilla/js1_6/Regress/regress-314887.js: Added.
366 * tests/mozilla/js1_6/Regress/regress-320172.js: Added.
367 * tests/mozilla/js1_6/Regress/shell.js: Added.
368 * tests/mozilla/js1_6/String/browser.js: Added.
369 * tests/mozilla/js1_6/String/regress-306591.js: Added.
370 * tests/mozilla/js1_6/String/shell.js: Added.
371 * tests/mozilla/js1_6/browser.js: Added.
372 * tests/mozilla/js1_6/shell.js: Added.
373 * tests/mozilla/js1_6/template.js: Added.
375 2005-12-27 Maks Orlovich <maksim@kde.org>
377 Reviewed and landed by Maciej.
379 - fixed 6234: Can delete array index property incorrectly.
380 http://bugzilla.opendarwin.org/show_bug.cgi?id=6234
382 * kjs/array_object.cpp:
383 (ArrayInstance::deleteProperty): use toArrayIndex instead of toUInt32 when
384 looking for array properties.
386 2005-12-27 Anders Carlsson <andersca@mac.com>
391 (KJS::JSObject::defineSetter):
392 Remove duplicate call to putDirect.
394 2005-12-26 Maciej Stachowiak <mjs@apple.com>
396 Reviewed by Darin and Geoff.
398 Changes by me and Anders.
400 - mostly fixed REGRESSION: 5-10% performance regression on JS iBench from getter/setter change
401 http://bugzilla.opendarwin.org/show_bug.cgi?id=6083
403 - also fixed some warnings reported by -Winline
405 * JavaScriptCorePrefix.h: Move new and delete definitions higher so there
406 aren't conflicts with use in standard C++ headers
408 (KJS::throwSetterError): Moved this piece of put into a seprate function
409 to avoid the PIC branch.
410 (KJS::JSObject::put): Use hasGetterSetterProperties to avoid expensive stuff
411 when not needed. Also use GetterSetter properties attribute.
412 (KJS::JSObject::deleteProperty): Recompute whether any properties are getter/setter
413 properties any more, if this one was one.
414 (KJS::JSObject::defineGetter): Let the PropertyMap know that it has getter/setter
415 properties now (and use the new attribute).
416 (KJS::JSObject::defineSetter): Ditto.
417 (KJS::JSObject::fillGetterPropertySlot): Out-of-line helper for getOwnPropertySlot,
418 to avoid global variable access in the hot code path.
420 (KJS::): Added GetterSetter attribute.
421 (KJS::JSCell::isObject): Moved lower to be after inline methods it uses.
422 (KJS::JSValue::isObject): ditto
423 (KJS::JSObject::getOwnPropertySlot): try to avoid impact of getters and setters
424 as much as possible in the case where they are not being used
425 * kjs/property_map.cpp:
426 (KJS::PropertyMap::containsGettersOrSetters): New method to help with this
427 * kjs/property_map.h:
428 (KJS::PropertyMap::hasGetterSetterProperties): Ditto
429 (KJS::PropertyMap::setHasGetterSetterProperties): Ditto
430 (KJS::PropertyMap::PropertyMap): Added a crazy hack to store the
431 global "has getter/setter properties" flag in the property map
432 single entry, to avoid making objects any bigger.
433 * kjs/value.h: Moved some things to object.h to make -Winline happier
435 2005-12-24 Maciej Stachowiak <mjs@apple.com>
437 Reviewed by Eric and Dave Hyatt.
439 - make even const PassRefPtrs give transfer of ownership semantics
440 http://bugzilla.opendarwin.org/show_bug.cgi?id=6238
442 This is a somewhat cheesy change. Having to use PassRefPtr_Ref creates ambiguities
443 in assignment and copy construction. And this makes life way easier and removes
444 the need for pass(). It is not really correct, but we pretty much never need a real
445 const PassRefPtr, and this takes care of things for PassRefPtr temporaries.
447 * kjs/identifier.cpp:
448 (KJS::Identifier::add): No more need for pass()
449 * kjs/property_map.cpp:
450 (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): No more need for pass()
452 (KJS::UString::Rep::create): Use adoptRef
453 (KJS::UString::UString): No more need for pass
454 (KJS::UString::append): No more need for pass
455 (KJS::UString::substr): No more need for pass
456 * kxmlcore/PassRefPtr.h: made m_ptr mutable (ugh)
457 (KXMLCore::PassRefPtr::PassRefPtr): Take a const PassRefPtr reference
458 (KXMLCore::PassRefPtr::release): Made this a const method (ugh)
459 (KXMLCore::PassRefPtr::operator=): clean up appropriately
460 (KXMLCore::adoptRef): Added this to use instead of PassRefPtr<T>::adopt, I think
461 it makes the behavior more clear and it is less verbose.
462 (KXMLCore::static_pointer_cast): use adoptRef
463 (KXMLCore::const_pointer_cast): use adoptRef
465 (KXMLCore::RefPtr::RefPtr): take const PassRefPtr&
466 (KXMLCore::PassRefPtr::operator=): take const PassRefPtr&
468 2005-12-25 Eric Seidel <eseidel@apple.com>
472 Unbreak HashTableConstIterator++ by returning const_iterator
474 * kxmlcore/HashTable.h:
475 (KXMLCore::HashTableConstIterator::operator++): use const_iterator
477 2005-12-25 Eric Seidel <eseidel@apple.com>
481 Un-break HashTable copy constructor.
483 * kxmlcore/HashTable.h:
484 (KXMLCore::::HashTable): use const_iterator instead
486 2005-12-23 Maciej Stachowiak <mjs@apple.com>
490 - fixed "HashMap does not work with const pointer keys or values"
491 http://bugzilla.opendarwin.org/show_bug.cgi?id=6222
493 * kxmlcore/HashMapPtrSpec.h:
494 (KXMLCore::HashMap): In all methods, explicitly cast all pointers
495 to void * before passing to internal implementation. Use C-style
496 casts instead of new-style casts, because the real solution would
497 require a combo of reinterpret_cast anc const_cast.
500 2005-12-23 Maciej Stachowiak <mjs@apple.com>
507 2005-12-22 Maciej Stachowiak <mjs@apple.com>
509 - fix build problem from last commit.
514 2005-12-21 Maciej Stachowiak <mjs@apple.com>
518 - Make HashMap/HashSet support non-POD types
519 http://bugzilla.opendarwin.org/show_bug.cgi?id=5332
521 The changes for support are relatively simple, but I also made extensive changes to
522 avoid copying, so that there isn't refcount thrash when you put RefPtrs into a HashMap.
524 * kxmlcore/HashTable.h:
525 (KXMLCore::swap): specialize swap for pairs, to swap elements individually,
526 so that excess copies can be avoided.
527 (KXMLCore::Mover::move): Template function to either copy or swap, used
528 when transferring elements from old table to new.
529 (KXMLCore::IdentityHashTranslator::hash): The old "converting lookup" templates
530 that took two or three function parameters now take a class parameter, this is
531 the class used to do a normal lookup.
532 (KXMLCore::IdentityHashTranslator::equal): Ditto.
533 (KXMLCore::IdentityHashTranslator::translate): Ditto. Translate now takes a reference
534 to write into instead of returning a value to avoid redundant copies.
535 (KXMLCore::HashTable::~HashTable): Use deallocateTable instead of freeing directly.
536 (KXMLCore::HashTable::insert): Based on HashTranslator now instead of separate
537 functions. Added a FIXME about a remaining rare excess copy.
538 (KXMLCore::HashTable::isEmptyBucket): Use KeyTraits directly instead of unwrapping
539 the key from Traits, to avoid creating and destroying pair, which copies.
540 (KXMLCore::HashTable::isDeletedBucket): ditto
541 (KXMLCore::HashTable::lookup): Use HashTranslator now instead of separate functions.
542 (KXMLCore::HashTable::initializeBucket): Renamed from emptyBucket. Use placement new to
543 work right for non-POD types.
544 (KXMLCore::HashTable::deleteBucket): Use assignDeleted to avoid excess copies.
545 (KXMLCore::HashTable::reinsert): use Mover template to copy or swap as appropriate
546 (KXMLCore::HashTable::allocateTable): Initialize every bucket if calloc won't do.
547 (KXMLCore::HashTable::deallocateTable): Destruct every bucket if needed.
548 (KXMLCore::HashTable::rehash): Avoid copy before reinserting, so that swap can do its magic.
549 (KXMLCore::HashTable::clear): use deallocateTable instead of freeing directly.
550 (KXMLCore::HashTable::HashTable): be more dumb when copying to ensure that non-POD types
552 * kxmlcore/HashFunctions.h:
553 (KXMLCore::PointerHash): Specialize PointerHash for RefPtr
554 * kxmlcore/HashMap.h:
555 (KXMLCore::extractFirst): Return a reference not a full object to avoid
557 (KXMLCore::HashMapTranslator::hash): Use a special translator for insertion
558 to defer making the pair as long as possible, thus avoiding needless copies.
559 (KXMLCore::HashMapTranslator::equal): ditto
560 (KXMLCore::HashMapTranslator::translate): ditto
561 (KXMLCore::::inlineAdd): Shared by set and add to insert using HashMapTranslator
562 (KXMLCore::::set): Use inlineAdd
563 (KXMLCore::::add): Use inlineAdd
564 * kxmlcore/HashMapPtrSpec.h:
565 (KXMLCore::): Pass KeyTraits along
566 * kxmlcore/HashSet.h:
567 (KXMLCore::identityExtract): Return a reference not a full object to avoid copies.
568 (KXMLCore::HashSetTranslatorAdapter::hash): Redo adapter stuff to work with
569 the new HashTranslator approach.
570 (KXMLCore::HashSetTranslatorAdapter::equal): ditto
571 (KXMLCore::HashSetTranslatorAdapter::translate): ditto
572 (KXMLCore::::insert): ditto
573 * kxmlcore/HashTraits.h:
574 (KXMLCore::GenericHashTraits): This is intended be used as a base class for
575 customized traits: sensible defaults.
576 (KXMLCore::): Use it a bunch
577 (KXMLCore::assignDeleted): template function to allow pairs to be assigned the
578 deleted value w/o excess copies.
579 (KXMLCore::PairHashTraits::emptyValue): Updated
580 (KXMLCore::PairHashTraits::deletedValue): Updated
581 (KXMLCore::PairHashTraits::assignDeletedValue): part of assignDeleted hack
582 (KXMLCore::DeletedValueAssigner::assignDeletedValue): Use template magic
583 to either use use deletedValue or assignDeletedValue for the cases where we care.
585 (KXMLCore::RefPtr::swap): Added swap method.
586 (KXMLCore::swap): Added swap free function.
587 * kjs/identifier.cpp:
588 (KJS::CStringTranslator::hash): Use new HashTranslator class approach to
589 alternate type based insertion.
590 (KJS::CStringTranslator::equal): ditto
591 (KJS::CStringTranslator::translate): ditto
592 (KJS::Identifier::add): ditto
593 (KJS::UCharBufferTranslator::hash): ditto
594 (KJS::UCharBufferTranslator::equal): ditto
595 (KJS::UCharBufferTranslator::translate): ditto
599 * kjs/array_object.cpp:
600 (ArrayProtoFunc::callAsFunction): Removed a stray space.
602 2005-12-22 Anders Carlsson <andersca@mac.com>
604 Reviewed by Eric and Darin.
606 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6196
607 Would like to be able to define prototypes in headers
610 Move ClassName from KJS_DECLARE_PROTOTYPE to KJS_IMPLEMENT_PROTOTYPE.
611 Also, namespace all macros by prefixing them with KJS_.
613 2005-12-22 Darin Adler <darin@apple.com>
617 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6191
618 RefPtr/PassRefPtr have a leak issue, operator== issues
620 * kxmlcore/PassRefPtr.h:
621 (KXMLCore::PassRefPtr::PassRefPtr): Remove non-template constructor that takes RefPtr
622 since the constructor template that takes RefPtr should be sufficient. Add a constructor
623 template that takes PassRefPtr&.
624 (KXMLCore::PassRefPtr::adopt): Use PassRefPtr_Ref to avoid setting pointer first to
625 0 and then to the pointer.
626 (KXMLCore::PassRefPtr::operator=): Added template versions that take PassRefPtr& and
628 (KXMLCore::PassRefPtr::operator PassRefPtr<U>): Changed to fix leak -- old version
629 would release and then ref.
630 (KXMLCore::operator==): Make templates have two parameters so you can mix types.
631 Also remove unneeded const in raw pointer versions.
632 (KXMLCore::operator!=): Ditto.
635 (KXMLCore::RefPtr::RefPtr): Add constructor template that takes PassRefPtr.
636 (KXMLCore::RefPtr::operator=): Add assignment operator templates that take
637 RefPtr and PassRefPtr.
638 (KXMLCore::operator==): Make templates have two parameters so you can mix types.
639 Also remove unneeded const in raw pointer versions.
640 (KXMLCore::operator!=): Ditto.
642 2005-12-21 Timothy Hatcher <timothy@apple.com>
644 * JavaScriptCore.xcodeproj/project.pbxproj:
645 Set tab width to 8, indent width to 4 and uses tabs to false per file.
647 2005-12-21 Geoffrey Garen <ggaren@apple.com>
651 Removed evil hack for determining if a type is an integer, replaced
652 with template metaprogramming.
654 * JavaScriptCore.xcodeproj/project.pbxproj: Set tab size to 2 for
657 (main): Inserted asserts to test IsInteger. FIXME: Move these to
658 KXMLCore unit tests directory when we create one.
659 * kxmlcore/HashTraits.h:
660 (KXMLCore::): Added IsInteger class for querying types.
662 2005-12-20 Maciej Stachowiak <mjs@apple.com>
666 - made ALWAYS_INLINE declare things inline as well as __attribute__((always_inline))
667 http://bugzilla.opendarwin.org/show_bug.cgi?id=6159
669 * kxmlcore/AlwaysInline.h:
671 2005-12-19 Maciej Stachowiak <mjs@apple.com>
675 - fixed a leak in the assignment operator from PassRefPtr to RefPtr
676 http://bugzilla.opendarwin.org/show_bug.cgi?id=6158
679 (KXMLCore::RefPtr::operator=):
681 - fix problem with PassRefPtr that darin spotted - it lacked a copy constructor
682 and therefore was using the default one, which can lead to excess derefs
684 I fixed this by adding a copy constructor from non-const
685 reference, and by adding a template pass() function that you have
686 to use when raw pointer or RefPtr are passed where PassRefPtr is
689 * kjs/identifier.cpp:
690 (KJS::Identifier::add): Changed to have PassRefPtr return type and
693 * kjs/property_map.cpp:
694 (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Use pass()
697 (KJS::UString::UString): Use pass() as needed.
698 (KJS::UString::append): ditto
699 (KJS::UString::substr): ditto
701 (KJS::UString::UString): Use initializer instead of assignment
702 * kxmlcore/PassRefPtr.h:
703 (KXMLCore::PassRefPtr::PassRefPtr): Added copy constructor
704 (KXMLCore::pass): new template function to make it convenient to pass
707 2005-12-19 Geoffrey Garen <ggaren@apple.com>
711 Fixed <rdar://problem/4370397> Missing return statement in
712 JSMethodNameToObjcMethodName.
714 JSMethodNameToObjcMethodName had a check for a name being too long, but
715 the check was missing a return statement.
717 A lot of this code was confusing and some of it was wrong, so I fixed
718 it up, added some asserts to catch this type of bug in the future,
719 changed some comments, and renamed some variables.
721 The two advantages of the new algorithm are (1) It makes writing past
722 the end of the buffer virtually impossible because the test on the main
723 loop is "while (not past end of buffer)" and (2) It's twice as fast
724 because it doesn't call strlen. (There's no need to call strlen when
725 we're walking the string ourselves.)
727 methodsNamed also supports arbitrary-length method names now. Just in
728 case the AppKit folks start getting REALLY verbose...
730 * bindings/objc/objc_class.mm:
731 (KJS::Bindings::ObjcClass::methodsNamed):
732 * bindings/objc/objc_utility.h:
733 * bindings/objc/objc_utility.mm:
734 (KJS::Bindings::JSMethodNameToObjcMethodName):
736 2005-12-19 Darin Adler <darin@apple.com>
738 Originally done by both George Staikos and Alexey Proskuryakov.
740 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5706
741 Sharedptr dependency can be removed
743 Our coding guidelines say "use 0 instead of NULL" and both RefPtr and
744 PassRefPtr were using NULL, which required including a header that
747 * kxmlcore/PassRefPtr.h:
748 (KXMLCore::PassRefPtr::PassRefPtr): Use 0 instead of NULL.
749 (KXMLCore::PassRefPtr::operator!): Use ! instead of == NULL.
751 (KXMLCore::RefPtr::RefPtr): Use 0 instead of NULL.
752 (KXMLCore::RefPtr::operator!): Use ! instead of == NULL.
753 Also did some reformatting.
755 2005-12-19 Darin Adler <darin@apple.com>
757 Reviewed by Geoff Garen and Eric Seidel.
759 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4923
760 stop using <ostream> in WebCore, eliminating the <cmath> troubles it causes
762 * kjs/simple_number.h: Removed many unnecessary includes, including
763 the <cmath> one to work around GCC library header bugs. We may have to
764 add some includes elsewhere for platforms other than OS X, since our
765 prefix header takes care of some things.
767 * kxmlcore/AlwaysInline.h: Added. Now clients that don't include
768 simple_number.h can still get the ALWAYS_INLINE macro.
769 * JavaScriptCore.xcodeproj/project.pbxproj: Added AlwaysInline.h.
771 * bindings/NP_jsobject.h: Removed a lot of unnecessary includes
772 and removed C-specific stuff from this C++-only header.
773 * bindings/jni/jni_jsobject.h: Removed a lot of unnecessary includes
774 and did some reformatting.
775 * bindings/objc/objc_runtime.h: Removed an unnecessary include.
776 * bindings/runtime.h: Removed some unneeded includes. Reformatted.
777 * bindings/runtime.cpp: Updated to compile with header changes,
778 including a lot of reformatting.
779 * bindings/runtime_object.h: Removed an unnecessary include.
781 2005-12-13 Maciej Stachowiak <mjs@apple.com>
783 Reviewed by Geoff and Adele
785 - replaced custom Identifier hashtable with HashSet
787 * kjs/identifier.cpp:
789 (KJS::identifierTable):
790 (KJS::Identifier::equal):
794 (KJS::Identifier::add):
795 (KJS::Identifier::remove):
798 (KJS::InterpreterImp::initGlobalObject):
800 2005-12-18 Justin Haygood <justin@xiondigital.net>
802 Reviewed, tweaked, and landed by Darin.
804 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5227
805 Array indexOf() extension for JavaScript 1.5 Core
807 * kjs/array_object.h:
808 * kjs/array_object.cpp: (ArrayProtoFunc::callAsFunction): Added implementation of indexOf.
810 2005-12-18 Anders Carlsson <andersca@mac.com>
812 Reviewed by Darin and Geoffrey.
814 - fix for <http://bugzilla.opendarwin.org/show_bug.cgi?id=4000>
815 Object.prototype is missing isPrototypeOf
817 * kjs/object_object.cpp:
818 (ObjectPrototype::ObjectPrototype):
819 Add isPrototypeOf to object prototype.
821 (ObjectProtoFunc::callAsFunction):
822 Implement isPrototypeOf
824 * kjs/object_object.h:
825 (KJS::ObjectProtoFunc::):
826 Add id for isPrototypeOf.
828 2005-12-17 Geoffrey Garen <ggaren@apple.com>
832 Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6119
833 split() function ignores case insensitive modifier.
836 RegExpImp: The C++ object you get when JavaScript executes
838 RegExp: A C++ wrapper object that performs regular expression
839 matching on behalf of a RegExpImp.
841 Instead of unnecessarily constructing a RegExp which (wrongly) lacks
842 any modifiers, String.split() now uses the RegExp built in to the
843 RegExpImp passed to it, which has the right modifiers already.
845 I also cleaned up other bits of the string code to standardized how
846 we handle RegExpImp arguments.
849 * kjs/string_object.cpp:
851 (StringProtoFunc::callAsFunction):
853 2005-12-16 David Hyatt <hyatt@apple.com>
855 Remove unused RefPtr constructors that can create an ambiguity in ustring on some platforms.
860 (KXMLCore::RefPtr::RefPtr):
862 2005-12-15 Darin Adler <darin@apple.com>
866 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5688
867 speed up JavaScript parsing by not creating a UString just to parse
870 * kjs/internal.cpp: (KJS::InterpreterImp::evaluate): Change to take a character pointer
871 and length rather than a UString.
874 * kjs/interpreter.cpp: (Interpreter::evaluate): Ditto.
876 * kjs/protect.h: Remove uneeded "convert to bool" operator since we already have a
877 "convert to raw pointer" operator in this class.
881 2005-12-13 Geoffrey Garen <ggaren@apple.com>
883 Updated test results to match Anders's last fix.
885 * tests/mozilla/expected.html:
887 2005-12-13 Anders Carlsson <andersca@mac.com>
889 * ChangeLog: Add titles for my bugzilla bugs.
891 2005-12-13 Anders Carlsson <andersca@mac.com>
895 - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=6041>
896 Support property getters and setters.
898 * bindings/runtime_array.cpp:
899 (RuntimeArray::lengthGetter):
900 (RuntimeArray::indexGetter):
901 * bindings/runtime_array.h:
902 * bindings/runtime_method.cpp:
903 (RuntimeMethod::lengthGetter):
904 * bindings/runtime_method.h:
905 * bindings/runtime_object.cpp:
906 (RuntimeObjectImp::fallbackObjectGetter):
907 (RuntimeObjectImp::fieldGetter):
908 (RuntimeObjectImp::methodGetter):
909 * bindings/runtime_object.h:
910 * kjs/array_instance.h:
911 * kjs/array_object.cpp:
912 (ArrayInstance::lengthGetter):
914 Update for changes to PropertySlot::getValue and
915 PropertySlot::GetValueFunc.
919 Handle GetterSetterType.
922 (KJS::FunctionImp::argumentsGetter):
923 (KJS::FunctionImp::lengthGetter):
924 (KJS::Arguments::mappedIndexGetter):
925 (KJS::ActivationImp::argumentsGetter):
927 Update for changes to PropertySlot::getValue and
928 PropertySlot::GetValueFunc.
931 Rework grammar parts for get set declarations directly
932 in the object literal.
935 (KJS::GetterSetterImp::mark):
936 (KJS::GetterSetterImp::toPrimitive):
937 (KJS::GetterSetterImp::toBoolean):
938 (KJS::GetterSetterImp::toNumber):
939 (KJS::GetterSetterImp::toString):
940 (KJS::GetterSetterImp::toObject):
941 Add type conversion functions. These aren't meant to be called.
944 Handle GetterSetterType.
947 (KJS::staticFunctionGetter):
948 (KJS::staticValueGetter):
949 Update for changes to PropertySlot::GetValueFunc.
952 Refactor they way properties nodes are implemented.
953 We now have a PropertyListNode which is a list of PropertyNodes.
954 Each PropertyNode has a name (which is a PropertyNameNode) and an associated
955 value node. PropertyNodes can be of different types. The Constant type is the
956 old constant declaration and the Getter and Setter types are for property getters
958 (ResolveNode::evaluate):
959 Update for changes to PropertySlot::getValue.
961 (PropertyListNode::evaluate):
962 Go through all property nodes and set them on the newly created object. If the
963 property nodes are of type Getter or Setter, define getters and setters. Otherwise,
964 just add the properties like before.
966 (PropertyNode::evaluate):
967 This should never be called directly.
969 (PropertyNameNode::evaluate):
970 Rename from PropertyNode::evaluate.
972 (FunctionCallResolveNode::evaluate):
973 (FunctionCallBracketNode::evaluate):
974 (FunctionCallDotNode::evaluate):
975 (PostfixResolveNode::evaluate):
976 (PostfixBracketNode::evaluate):
977 (PostfixDotNode::evaluate):
978 (TypeOfResolveNode::evaluate):
979 (PrefixResolveNode::evaluate):
980 (PrefixBracketNode::evaluate):
981 (PrefixDotNode::evaluate):
982 (AssignResolveNode::evaluate):
983 (AssignDotNode::evaluate):
984 (AssignBracketNode::evaluate):
985 Update for changes to PropertySlot::getValue.
988 (KJS::PropertyNameNode::PropertyNameNode):
989 Rename from PropertyNode.
991 (KJS::PropertyNode::):
992 (KJS::PropertyNode::PropertyNode):
993 New class, representing a single property.
995 (KJS::PropertyListNode::PropertyListNode):
996 Rename from PropertyValueNode.
998 (KJS::FuncExprNode::FuncExprNode):
999 Put ParameterNode parameter last, and make it optional.
1001 (KJS::ObjectLiteralNode::ObjectLiteralNode):
1002 Use a PropertyListNode here now.
1004 * kjs/nodes2string.cpp:
1005 (PropertyListNode::streamTo):
1006 Iterate through all property nodes.
1008 (PropertyNode::streamTo):
1009 Print out the name and value. Doesn't handle getters and setters currently.
1011 (PropertyNameNode::streamTo):
1012 Rename from PropertyNode::streamTo.
1015 (KJS::JSObject::get):
1016 Update for changes to PropertySlot::getValue.
1018 (KJS::JSObject::put):
1019 If the property already exists and has a Setter, invoke
1020 the setter function instead of setting the property directly.
1022 (KJS::JSObject::defineGetter):
1023 (KJS::JSObject::defineSetter):
1024 New functions for defining property getters and setters on the object.
1027 (KJS::GetterSetterImp::type):
1028 (KJS::GetterSetterImp::GetterSetterImp):
1029 (KJS::GetterSetterImp::getGetter):
1030 (KJS::GetterSetterImp::setGetter):
1031 (KJS::GetterSetterImp::getSetter):
1032 (KJS::GetterSetterImp::setSetter):
1033 New class for properties which have getters and setters defined.
1034 This class is only used internally and should never be seen from the outside.
1036 (KJS::JSObject::getOwnPropertySlot):
1037 If the property is a getter, call setGetterSlot on the property slot.
1039 * kjs/object_object.cpp:
1040 (ObjectPrototype::ObjectPrototype):
1041 Add __defineGetter__, __defineSetter, __lookupGetter__, __lookupSetter__
1044 (ObjectProtoFunc::callAsFunction):
1045 Implement handlers for new functions.
1047 * kjs/object_object.h:
1048 (KJS::ObjectProtoFunc::):
1049 Add ids for new functions.
1051 * kjs/property_slot.cpp:
1052 (KJS::PropertySlot::undefinedGetter):
1053 Update for changes to PropertySlot::GetValueFunc.
1055 (KJS::PropertySlot::functionGetter):
1056 Call the function getter object and return its value.
1058 * kjs/property_slot.h:
1059 (KJS::PropertySlot::getValue):
1060 Add a new argument which is the original object that
1061 getPropertySlot was called on.
1063 (KJS::PropertySlot::setGetterSlot):
1064 (KJS::PropertySlot::):
1065 New function which sets a getter slot. When getValue is called on a
1066 getter slot, the getter function object is invoked.
1068 * kjs/string_object.cpp:
1069 (StringInstance::lengthGetter):
1070 (StringInstance::indexGetter):
1071 * kjs/string_object.h:
1072 Update for changes to PropertySlot::GetValueFunc.
1076 Add GetterSetterType and make GetterSetterImp a friend class of JSCell.
1078 2005-12-12 Maciej Stachowiak <mjs@apple.com>
1082 - added a new HashCountedSet class for the common pattern of mapping items to counts that can change
1084 * kxmlcore/HashCountedSet.h: Added.
1085 (KXMLCore::HashCountedSet::*): Implemented, on top of HashMap.
1086 * kxmlcore/HashMap.h:
1087 (KXMLCore::HashMap::add): New method - does not replace existing value if key already present
1088 but otherwise like set().
1089 (KXMLCore::HashMap::set): Improved comments.
1090 * kxmlcore/HashMapPtrSpec.h:
1091 (KXMLCore::HashMap::add): Added to specializations too.
1092 * JavaScriptCore.xcodeproj/project.pbxproj: Add new file.
1093 * kxmlcore/HashFunctions.h: Added include of stdint.h
1095 - replaced the custom hashtable for values protected from GC with HashCountedSet
1097 * kjs/collector.cpp:
1098 (KJS::Collector::protect): Moved code here from ProtectedValues::increaseProtectCount
1099 since the code is so simple now.
1100 (KJS::Collector::unprotect): Ditto for ProtectedValues::decreaseProtectCount.
1101 (KJS::Collector::markProtectedObjects): Updated for new way of doing things, now
1103 (KJS::Collector::numReferencedObjects): ditto
1104 (KJS::Collector::rootObjectClasses): ditto
1105 * kjs/collector.h: Added protect and unprotect static methods
1107 (KJS::gcProtect): Updated for removal of ProtectedValues class
1108 (KJS::gcUnprotect): likewise
1109 * kjs/protected_values.cpp: Removed.
1110 * kjs/protected_values.h: Removed.
1112 2005-12-10 Darin Adler <darin@apple.com>
1114 Rubber stamped by Maciej.
1116 - did long-promised KJS renaming:
1119 ObjectImp -> JSObject
1120 AllocatedValueImp -> JSCell
1122 A renaming to get a class out of the way
1124 KJS::Bindings::JSObject -> JavaJSObject
1126 and some other "imp-reduction" renaming
1128 *InstanceImp -> *Instance
1129 *ProtoFuncImp -> *ProtoFunc
1130 *PrototypeImp -> *Prototype
1131 ArgumentsImp -> Arguments
1132 RuntimeArrayImp -> RuntimeArray
1133 RuntimeMethodImp -> RuntimeMethod
1135 * most files and functions
1137 2005-12-10 Darin Adler <darin@apple.com>
1141 - eliminated the old Undefined(), Null(), Boolean(), Number(), and String()
1143 Code now uses jsUndefined(), jsNull(), jsBoolean(), jsNumber(), and jsString().
1145 * bindings/NP_jsobject.cpp:
1147 * bindings/c/c_instance.cpp:
1148 (KJS::Bindings::CInstance::invokeMethod):
1149 (KJS::Bindings::CInstance::invokeDefaultMethod):
1150 * bindings/c/c_runtime.cpp:
1151 (CField::valueFromInstance):
1152 * bindings/c/c_utility.cpp:
1153 (KJS::Bindings::convertNPVariantToValue):
1154 * bindings/jni/jni_instance.cpp:
1155 (JavaInstance::invokeMethod):
1156 (JavaInstance::invokeDefaultMethod):
1157 * bindings/jni/jni_jsobject.cpp:
1159 (JSObject::convertJObjectToValue):
1160 * bindings/jni/jni_runtime.cpp:
1161 (JavaArray::convertJObjectToArray):
1162 (JavaField::valueFromInstance):
1163 (JavaArray::valueAt):
1164 * bindings/objc/WebScriptObject.mm:
1165 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1166 (-[WebScriptObject evaluateWebScript:]):
1167 (-[WebScriptObject valueForKey:]):
1168 (-[WebScriptObject webScriptValueAtIndex:]):
1169 * bindings/objc/objc_instance.mm:
1170 (ObjcInstance::invokeMethod):
1171 (ObjcInstance::invokeDefaultMethod):
1172 (ObjcInstance::getValueOfUndefinedField):
1173 * bindings/objc/objc_runtime.mm:
1174 (ObjcField::valueFromInstance):
1175 (ObjcFallbackObjectImp::callAsFunction):
1176 * bindings/objc/objc_utility.mm:
1177 (KJS::Bindings::convertNSStringToString):
1178 (KJS::Bindings::convertObjcValueToValue):
1179 * bindings/runtime.h:
1180 (KJS::Bindings::Class::fallbackObject):
1181 (KJS::Bindings::Instance::getValueOfUndefinedField):
1182 (KJS::Bindings::Instance::valueOf):
1183 * bindings/runtime_array.cpp:
1184 (RuntimeArrayImp::lengthGetter):
1185 * bindings/runtime_method.cpp:
1186 (RuntimeMethodImp::lengthGetter):
1187 (RuntimeMethodImp::callAsFunction):
1188 (RuntimeMethodImp::execute):
1189 * kjs/array_object.cpp:
1190 (ArrayInstanceImp::lengthGetter):
1191 (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
1192 (ArrayPrototypeImp::ArrayPrototypeImp):
1193 (ArrayProtoFuncImp::ArrayProtoFuncImp):
1194 (ArrayProtoFuncImp::callAsFunction):
1195 (ArrayObjectImp::ArrayObjectImp):
1196 * kjs/bool_object.cpp:
1197 (BooleanPrototypeImp::BooleanPrototypeImp):
1198 (BooleanProtoFuncImp::callAsFunction):
1199 (BooleanObjectImp::BooleanObjectImp):
1200 (BooleanObjectImp::callAsFunction):
1201 * kjs/error_object.cpp:
1202 (ErrorPrototypeImp::ErrorPrototypeImp):
1203 (ErrorProtoFuncImp::ErrorProtoFuncImp):
1204 (ErrorProtoFuncImp::callAsFunction):
1205 (ErrorObjectImp::ErrorObjectImp):
1206 (NativeErrorImp::NativeErrorImp):
1208 (KJS::FunctionImp::callAsFunction):
1209 (KJS::FunctionImp::processParameters):
1210 (KJS::FunctionImp::argumentsGetter):
1211 (KJS::FunctionImp::lengthGetter):
1212 (KJS::DeclaredFunctionImp::execute):
1215 (KJS::GlobalFuncImp::callAsFunction):
1216 * kjs/function_object.cpp:
1217 (FunctionPrototypeImp::FunctionPrototypeImp):
1218 (FunctionPrototypeImp::callAsFunction):
1219 (FunctionProtoFuncImp::callAsFunction):
1220 (FunctionObjectImp::FunctionObjectImp):
1222 (KJS::InterpreterImp::initGlobalObject):
1223 * kjs/interpreter.h:
1225 * kjs/math_object.cpp:
1226 (MathObjectImp::getValueProperty):
1227 (MathFuncImp::callAsFunction):
1229 (Node::setExceptionDetailsIfNeeded):
1230 (NullNode::evaluate):
1231 (PropertyNode::evaluate):
1232 (FunctionCallBracketNode::evaluate):
1233 (FunctionCallDotNode::evaluate):
1234 (PostfixBracketNode::evaluate):
1235 (PostfixDotNode::evaluate):
1236 (VoidNode::evaluate):
1237 (PrefixBracketNode::evaluate):
1238 (PrefixDotNode::evaluate):
1239 (ShiftNode::evaluate):
1240 (valueForReadModifyAssignment):
1241 (AssignDotNode::evaluate):
1242 (AssignBracketNode::evaluate):
1243 (VarDeclNode::evaluate):
1244 (VarDeclNode::processVarDecls):
1245 (VarDeclListNode::evaluate):
1246 (ReturnNode::execute):
1247 (CaseClauseNode::evalStatements):
1248 (ParameterNode::evaluate):
1249 (FuncDeclNode::processFuncDecl):
1251 (KJS::StatementNode::evaluate):
1252 * kjs/number_object.cpp:
1253 (NumberPrototypeImp::NumberPrototypeImp):
1254 (NumberProtoFuncImp::callAsFunction):
1255 (NumberObjectImp::NumberObjectImp):
1256 (NumberObjectImp::getValueProperty):
1257 (NumberObjectImp::callAsFunction):
1259 (KJS::ObjectImp::get):
1260 (KJS::Error::create):
1261 * kjs/object_object.cpp:
1262 (ObjectPrototypeImp::ObjectPrototypeImp):
1263 (ObjectProtoFuncImp::callAsFunction):
1264 (ObjectObjectImp::ObjectObjectImp):
1265 * kjs/property_slot.cpp:
1266 (KJS::PropertySlot::undefinedGetter):
1267 * kjs/regexp_object.cpp:
1268 (RegExpPrototypeImp::RegExpPrototypeImp):
1269 (RegExpProtoFuncImp::callAsFunction):
1270 (RegExpObjectImp::RegExpObjectImp):
1271 (RegExpObjectImp::arrayOfMatches):
1272 (RegExpObjectImp::getBackref):
1273 (RegExpObjectImp::getLastMatch):
1274 (RegExpObjectImp::getLastParen):
1275 (RegExpObjectImp::getLeftContext):
1276 (RegExpObjectImp::getRightContext):
1277 (RegExpObjectImp::getValueProperty):
1278 (RegExpObjectImp::construct):
1279 * kjs/string_object.cpp:
1280 (StringInstanceImp::StringInstanceImp):
1281 (StringPrototypeImp::StringPrototypeImp):
1283 (StringProtoFuncImp::callAsFunction):
1284 (StringObjectImp::StringObjectImp):
1285 (StringObjectImp::callAsFunction):
1286 (StringObjectFuncImp::StringObjectFuncImp):
1287 (StringObjectFuncImp::callAsFunction):
1289 (TestFunctionImp::callAsFunction):
1290 (VersionFunctionImp::callAsFunction):
1293 2005-12-10 Oliver Hunt <ojh16@student.canterbury.ac.nz>
1295 Reviewed by Maciej, landed by Darin.
1297 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=3539
1298 Array join and toString methods do not support circular references
1300 * kjs/array_object.cpp: (ArrayProtoFuncImp::callAsFunction):
1301 Added set of visited objects -- don't recurse if item is already in the set.
1303 2005-12-08 Maciej Stachowiak <mjs@apple.com>
1307 - fix major memory leak and resultant slowdown on JavaScript iBench from
1308 my PassRefPtr changes
1311 (KJS::UString::Rep::create): I forgot to change one of the two overloads to create
1312 with a refcount of 0 instead of 1 (the smart pointer then bumps it. But instead of
1313 changing it, I changed both to start with a refcounter of 1 and use PassRefPtr::adopt
1314 to adopt the initial refcount, this may be a hair more efficient.
1316 - made the assignment operators for smart pointers inline because Shark said so
1318 * kxmlcore/PassRefPtr.h:
1319 (KXMLCore::::operator=):
1320 * kxmlcore/RefPtr.h:
1321 (KXMLCore::::operator=):
1323 2005-12-06 Anders Carlsson <andersca@mac.com>
1327 - fix build when using gcc 4
1332 * kxmlcore/PassRefPtr.h:
1333 (KXMLCore::::operator):
1336 2005-12-05 Maciej Stachowiak <mjs@apple.com>
1340 - add PassRefPtr, a smart pointer class that works in conjunction
1341 with RefPtr but has transfer-of-ownership semantics
1342 - apply RefPtr and PassRefPtr to UString
1343 - cleaned up UString a little so that it doesn't need to have so many friend classes
1345 * JavaScriptCore.xcodeproj/project.pbxproj:
1346 * kjs/identifier.cpp:
1347 (KJS::Identifier::add):
1349 (KJS::Identifier::Identifier):
1350 (KJS::Identifier::equal):
1351 * kjs/property_map.cpp:
1352 (KJS::PropertyMap::get):
1353 (KJS::PropertyMap::getLocation):
1354 (KJS::PropertyMap::put):
1355 (KJS::PropertyMap::remove):
1357 (KJS::UCharReference::operator=):
1358 (KJS::UCharReference::ref):
1359 (KJS::UString::Rep::createCopying):
1360 (KJS::UString::Rep::create):
1361 (KJS::UString::usedCapacity):
1362 (KJS::UString::usedPreCapacity):
1363 (KJS::UString::expandCapacity):
1364 (KJS::UString::expandPreCapacity):
1365 (KJS::UString::UString):
1366 (KJS::UString::spliceSubstringsWithSeparators):
1367 (KJS::UString::append):
1368 (KJS::UString::operator=):
1369 (KJS::UString::toStrictUInt32):
1370 (KJS::UString::substr):
1371 (KJS::UString::copyForWriting):
1374 (KJS::UString::UString):
1375 (KJS::UString::~UString):
1376 (KJS::UString::data):
1377 (KJS::UString::isNull):
1378 (KJS::UString::isEmpty):
1379 (KJS::UString::size):
1380 (KJS::UString::rep):
1381 * kxmlcore/RefPtr.h:
1382 (KXMLCore::RefPtr::RefPtr):
1383 (KXMLCore::RefPtr::operator*):
1384 (KXMLCore::::operator):
1385 (KXMLCore::operator==):
1386 (KXMLCore::operator!=):
1387 (KXMLCore::static_pointer_cast):
1388 (KXMLCore::const_pointer_cast):
1390 2005-12-04 Geoffrey Garen <ggaren@apple.com>
1392 Update test results to match Anders's last checkin.
1394 * tests/mozilla/expected.html:
1396 2005-12-04 Anders Carlsson <andersca@mac.com>
1398 Reviewed by Geoffrey.
1400 - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3999>
1401 Object.prototype is missing propertyIsEnumerable
1404 (KJS::ObjectImp::canPut):
1405 Refactor to use getPropertyAttributes.
1407 (KJS::ObjectImp::propertyIsEnumerable):
1408 New function which checks if a property is enumerable.
1410 (KJS::ObjectImp::getPropertyAttributes):
1412 Add getPropertyAttributes and propertyIsEnumerable.
1414 * kjs/object_object.cpp:
1415 (ObjectPrototypeImp::ObjectPrototypeImp):
1416 (ObjectProtoFuncImp::callAsFunction):
1417 * kjs/object_object.h:
1418 (KJS::ObjectProtoFuncImp::):
1419 Add propertyIsEnumerable to the Object prototype.
1421 2005-12-01 Maciej Stachowiak <mjs@apple.com>
1423 Reviewed by Tim Hatcher.
1425 - removed deprecated reset, isNull and nonNull methods
1427 * kxmlcore/RefPtr.h:
1429 2005-12-01 Anders Carlsson <andersca@mac.com>
1433 - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3382>
1434 nodes2strings.cpp fails to print left expression of ForInNode when 'var' is not used
1438 * kjs/nodes2string.cpp:
1439 (ForInNode::streamTo):
1440 Add lexpr if there's no varDecl.
1442 2005-12-01 Maciej Stachowiak <mjs@apple.com>
1444 Rubber stamped by Eric.
1446 - renamed SharedPtr to RefPtr via script
1448 * JavaScriptCore.xcodeproj/project.pbxproj:
1450 (KJS::GlobalFuncImp::callAsFunction):
1452 * kjs/function_object.cpp:
1453 (FunctionObjectImp::construct):
1455 (KJS::Parser::parse):
1456 (KJS::InterpreterImp::checkSyntax):
1457 (KJS::InterpreterImp::evaluate):
1460 * kjs/nodes2string.cpp:
1461 (KJS::SourceStream::operator<<):
1463 * kxmlcore/RefPtr.h: Added.
1464 (KXMLCore::RefPtr::RefPtr):
1465 (KXMLCore::RefPtr::~RefPtr):
1466 (KXMLCore::RefPtr::isNull):
1467 (KXMLCore::RefPtr::notNull):
1468 (KXMLCore::RefPtr::reset):
1469 (KXMLCore::RefPtr::get):
1470 (KXMLCore::RefPtr::operator*):
1471 (KXMLCore::RefPtr::operator->):
1472 (KXMLCore::RefPtr::operator!):
1473 (KXMLCore::RefPtr::operator UnspecifiedBoolType):
1474 (KXMLCore::::operator):
1475 (KXMLCore::operator==):
1476 (KXMLCore::operator!=):
1477 (KXMLCore::static_pointer_cast):
1478 (KXMLCore::const_pointer_cast):
1479 * kxmlcore/SharedPtr.h: Removed.
1481 2005-11-30 Maciej Stachowiak <mjs@apple.com>
1483 Reviewed by Dave Hyatt.
1485 - change idiom used for implicit bool conversion of smart pointers, because the old one gives weird error messages sometimes
1488 (KJS::ProtectedPtr::operator UnspecifiedBoolType):
1489 * kxmlcore/SharedPtr.h:
1490 (KXMLCore::SharedPtr::operator UnspecifiedBoolType):
1492 2005-11-29 Mitz Pettel <opendarwin.org@mitzpettel.com>
1494 Reviewed by ggaren. Committed by eseidel.
1496 Date conversion to local time gets the DST flag wrong sometimes
1497 http://bugzilla.opendarwin.org/show_bug.cgi?id=5514
1499 * kjs/date_object.cpp:
1500 (KJS::isTime_tSigned):
1501 (KJS::DateProtoFuncImp::callAsFunction):
1503 2005-11-26 Maciej Stachowiak <mjs@apple.com>
1505 Rubber stamped by Eric.
1507 - renamed InterpreterLock to JSLock
1509 * bindings/NP_jsobject.cpp:
1514 (_NPN_RemoveProperty):
1517 (_NPN_SetException):
1518 * bindings/jni/jni_jsobject.cpp:
1521 (JSObject::getMember):
1522 (JSObject::setMember):
1523 (JSObject::removeMember):
1524 (JSObject::getSlot):
1525 (JSObject::setSlot):
1526 (JSObject::toString):
1527 (JSObject::convertJObjectToValue):
1528 * bindings/objc/WebScriptObject.mm:
1529 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1530 (-[WebScriptObject evaluateWebScript:]):
1531 (-[WebScriptObject setValue:forKey:]):
1532 (-[WebScriptObject valueForKey:]):
1533 (-[WebScriptObject removeWebScriptKey:]):
1534 (-[WebScriptObject stringRepresentation]):
1535 (-[WebScriptObject webScriptValueAtIndex:]):
1536 (-[WebScriptObject setWebScriptValueAtIndex:value:]):
1537 (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
1538 * bindings/runtime.cpp:
1539 (Instance::createRuntimeObject):
1540 * bindings/runtime_root.cpp:
1541 (KJS::Bindings::addNativeReference):
1542 (KJS::Bindings::removeNativeReference):
1543 (RootObject::removeAllNativeReferences):
1544 * bindings/runtime_root.h:
1545 (KJS::Bindings::RootObject::~RootObject):
1546 (KJS::Bindings::RootObject::setRootObjectImp):
1547 * bindings/testbindings.cpp:
1549 * bindings/testbindings.mm:
1552 (KJS::initializeJSLock):
1553 (KJS::JSLock::lock):
1554 (KJS::JSLock::unlock):
1555 (KJS::JSLock::lockCount):
1556 (KJS::JSLock::DropAllLocks::DropAllLocks):
1557 (KJS::JSLock::DropAllLocks::~DropAllLocks):
1559 (KJS::JSLock::JSLock):
1560 (KJS::JSLock::~JSLock):
1561 * kjs/collector.cpp:
1562 (KJS::Collector::allocate):
1563 (KJS::Collector::collect):
1565 (KJS::InterpreterImp::InterpreterImp):
1566 (KJS::InterpreterImp::clear):
1567 (KJS::InterpreterImp::checkSyntax):
1568 (KJS::InterpreterImp::evaluate):
1569 * kjs/interpreter.cpp:
1570 (Interpreter::evaluate):
1572 (KJS::::ProtectedPtr):
1573 (KJS::::~ProtectedPtr):
1575 * kjs/protected_reference.h:
1576 (KJS::ProtectedReference::ProtectedReference):
1577 (KJS::ProtectedReference::~ProtectedReference):
1578 (KJS::ProtectedReference::operator=):
1579 * kjs/protected_values.cpp:
1580 (KJS::ProtectedValues::getProtectCount):
1581 (KJS::ProtectedValues::increaseProtectCount):
1582 (KJS::ProtectedValues::decreaseProtectCount):
1584 (TestFunctionImp::callAsFunction):
1587 2005-11-26 Darin Adler <darin@apple.com>
1589 Reviewed by eseidel. Committed by eseidel.
1591 Inline ScopeChain functions for speed.
1592 http://bugzilla.opendarwin.org/show_bug.cgi?id=5687
1595 (KJS::ScopeChain::mark):
1596 * kjs/scope_chain.cpp:
1597 * kjs/scope_chain.h:
1598 (KJS::ScopeChain::ref):
1599 (KJS::ScopeChain::operator=):
1600 (KJS::ScopeChain::bottom):
1601 (KJS::ScopeChain::push):
1602 (KJS::ScopeChain::pop):
1604 2005-11-21 Maciej Stachowiak <mjs@apple.com>
1608 <rdar://problem/4139620> Seed: WebKit: hang when sending XMLHttpRequest if automatic proxy config is used
1610 Also factored locking code completely into a separate class, and
1611 added a convenient packaged way to temporarily drop locks.
1613 * JavaScriptCore.xcodeproj/project.pbxproj:
1614 * kjs/JSLock.cpp: Added.
1615 (KJS::initializeInterpreterLock):
1616 (KJS::InterpreterLock::lock):
1617 (KJS::InterpreterLock::unlock):
1618 (KJS::InterpreterLock::lockCount):
1619 (KJS::InterpreterLock::DropAllLocks::DropAllLocks):
1620 (KJS::InterpreterLock::DropAllLocks::~DropAllLocks):
1621 * kjs/JSLock.h: Added.
1622 (KJS::InterpreterLock::InterpreterLock):
1623 (KJS::InterpreterLock::~InterpreterLock):
1626 * kjs/interpreter.cpp:
1627 * kjs/interpreter.h:
1630 (TestFunctionImp::callAsFunction):
1632 2005-11-21 Eric Seidel <eseidel@apple.com>
1634 Rubber-stamped by hyatt.
1636 Removed JavaScriptCore+SVG target.
1638 * JavaScriptCore.xcodeproj/project.pbxproj:
1640 2005-11-15 Geoffrey Garen <ggaren@apple.com>
1644 - Fixed <rdar://problem/4342216> Installer crash in
1645 KJS::ValueImp::marked() when garbage collector runs inside call to
1646 ConstantValues::init()
1648 I took responsibility for initializing and marking ConstantValues away
1649 from InterpreterImp, since it's possible to reference such a value
1650 before any interpreter has been created and after the last interpreter
1653 InterpreterImp::lock now initializes ConstantValues. It's a good
1654 place for the initialization because you have to call it before
1655 creating any objects. Since ::lock can be called more than once,
1656 I added a check in ConstantValues::init to ensure that it executes
1659 Collector:collect is now responsible for marking ConstantValues.
1661 We no longer clear the ConstantValues since we can't guarantee that no
1662 one has a reference to them.
1664 FIXME: This is hackery. The long-term plan is to make ConstantValues
1665 use immediate values that require no initialization.
1668 * kjs/collector.cpp:
1669 (KJS::Collector::collect):
1671 (KJS::InterpreterImp::InterpreterImp):
1672 (KJS::InterpreterImp::lock):
1673 (KJS::InterpreterImp::clear):
1674 (KJS::InterpreterImp::mark):
1677 (KJS::ConstantValues::initIfNeeded):
1680 2005-11-08 Geoffrey Garen <ggaren@apple.com>
1684 This patch fixes some naughty naughty code -- 5 crashes and 2
1685 may-go-haywire-in-the-futures.
1687 One such crash is <rdar://problem/4247330> 8C46 Crash with with
1688 incomplete parameter list to webScript object function.
1690 I replaced early returns from within NS_DURINGs with calls to
1691 NS_VALUERETURN because the doc says, "You cannot use goto or
1692 return to exit an exception handling domain -- errors will result."
1694 I replaced hard-coded analyses of -[NSMethodSignature
1695 methodReturnType] with more abstracted alternatives, since
1696 the documentation says "This encoding is implementation-specific,
1697 so applications should use it with caution," and then emits an
1700 I removed the early return in the case where a JavaScript caller
1701 supplies an insufficient number of arguments, because the right
1702 thing to do in such a case is to use JavaScript's defined behavior
1703 of supplying "undefined" for any missing arguments.
1705 I also changed ObjcInstance::invokeMethod so that it no longer
1706 deletes the method passed to it. It doesn't create the method,
1707 so it shouldn't delete it. A friend of mine named
1708 KERNEL_PROTECTION_FAILURE agrees with me on this point.
1710 Finally, I changed an assert(true) to assert(false) because
1711 all the other asserts were making fun of it.
1713 * bindings/objc/objc_instance.mm:
1714 (ObjcInstance::invokeMethod):
1715 (ObjcInstance::invokeDefaultMethod):
1717 2005-11-06 Geoffrey Garen <ggaren@apple.com>
1721 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5571
1722 REGRESSION (412.5-TOT): duplicated words/sentences at
1723 shakespeer.sourceforge.net
1725 Our UTF16-modified PCRE didn't work with extended character classes
1726 (classes involving characters > 255) because it used the GETCHARINC
1727 macro to read through them. In UTF16 mode, GETCHARINC expects UTF16
1728 input, but PCRE encodes character classes in UTF8 regardless of the
1729 input mode of the subject string.
1731 The fix is to explicitly define GETUTF8CHARINC, and to use it,
1732 rather than GETCHARINC, when reading extended character classes.
1734 In UTF8 mode, we simply define GETCHARINC to be GETUTF8CHARINC.
1736 * pcre/pcre_internal.h:
1737 * pcre/pcre_xclass.c:
1740 2005-11-05 Geoffrey Garen <ggaren@apple.com>
1742 Patch by Mitz Pettel, reviewed by Maciej.
1744 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5357
1745 REGRESSION: Scriptable plugin hides properties of OBJECT element
1747 * bindings/objc/objc_class.mm:
1748 (KJS::Bindings::ObjcClass::fallbackObject):
1750 2005-11-05 Geoffrey Garen <ggaren@apple.com>
1754 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5409
1755 slice() testcase doesn't pass
1757 Modified String.slice to deal with funky values.
1758 Updated test results. We now pass <js1_2/String/slice.js>.
1760 * kjs/string_object.cpp:
1761 (StringProtoFuncImp::callAsFunction):
1762 * tests/mozilla/expected.html:
1764 2005-11-04 Darin Adler <darin@apple.com>
1766 Reviewed by Tim Hatcher.
1768 * kxmlcore/HashSet.h: Fixed case of "hashfunctions.h" -- needs to be "HashFunctions.h".
1770 2005-11-03 Timothy Hatcher <timothy@apple.com>
1772 Reviewed by Darin and Vicki.
1774 * JavaScriptCore.xcodeproj/project.pbxproj:
1775 Change to use $(SYSTEM_LIBRARY_DIR) consistently and place
1776 $(NEXT_ROOT) in a few spots to make build-root work.
1778 2005-11-03 Geoffrey Garen <ggaren@apple.com>
1780 - Updated JavaScriptCore test results to reflect recent fixes.
1782 * tests/mozilla/expected.html:
1784 2005-11-03 Geoffrey Garen <ggaren@apple.com>
1788 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5602
1789 REGRESSION: RegExp("[^\\s$]+", "g") returns extra matches
1791 We now update lastIndex relative to the start of the last match,
1792 rather than the start of the last search. We used to assume that
1793 the two were equal, but that is not the case when a pattern
1794 matches at a character after the first in the string.
1796 * kjs/regexp_object.cpp:
1797 (RegExpProtoFuncImp::callAsFunction):
1799 2005-10-24 John Sullivan <sullivan@apple.com>
1801 Reviewed by Darin Adler. Code changes by Alexey Proskuryakov.
1803 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4931
1804 Unicode format characters (Cf) should be removed from JavaScript source
1807 include <unicode/uchar.h>
1809 use KJS::UChar instead of UChar to avoid ambiguity caused by new include
1811 ditto; also, use shift(4) to skip first 4 chars to take advantage of new
1814 skip chars of type U_FORMAT_CHAR
1815 (Lexer::convertUnicode):
1816 use KJS::UChar instead of UChar to avoid ambiguity caused by new include
1819 (Lexer::makeIdentifier):
1821 (Lexer::makeUString):
1824 * tests/mozilla/ecma/Array/15.4.5.1-1.js:
1825 updated to skip soft hyphens
1827 2005-10-24 John Sullivan <sullivan@apple.com>
1829 Reviewed by Darin Adler. Code changes by George Staikos/Geoff Garen.
1831 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4142
1832 Date object does not always adjust daylight savings correctly
1834 * kjs/date_object.cpp:
1836 Fix the case where a time change crosses the daylight savings start/end dates.
1838 2005-10-17 Maciej Stachowiak <mjs@apple.com>
1840 Reviewed by Geoff. Code changes by Darin.
1842 - some micro-optimizations to FastMalloc to reduce math and branches.
1844 * kxmlcore/FastMalloc.cpp:
1845 (KXMLCore::TCMalloc_Central_FreeList::Populate):
1846 (KXMLCore::fastMallocRegisterThread):
1847 (KXMLCore::TCMalloc_ThreadCache::GetCache):
1848 (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
1850 2005-10-15 Maciej Stachowiak <mjs@apple.com>
1852 Reverted fix for this bug, because it was part of a time range that caused a performance
1855 <rdar://problem/4260481> Remove Reference type from JavaScriptCore
1857 2005-10-15 Darin Adler <darin@apple.com>
1859 * kxmlcore/HashTable.cpp: Fixed build failure (said hashtable.h instead of HashTable.h).
1861 2005-10-14 Geoffrey Garen <ggaren@apple.com>
1863 Style changes recommended by Darin.
1865 Changed to camelCase, changed ValueImp* to ValueImp *.
1867 * kjs/simple_number.h:
1868 (KJS::SimpleNumber::make):
1869 (KJS::SimpleNumber::value):
1871 2005-10-11 Geoffrey Garen <ggaren@apple.com>
1873 Added regexp_object.lut.h build phase from JavaScriptCore
1874 to JavaScriptCore+SVG.
1878 * JavaScriptCore.xcodeproj/project.pbxproj:
1880 2005-10-11 Geoffrey Garen <ggaren@apple.com>
1882 Fixed build bustage from last checkin (stray characters
1883 in the project file).
1887 * JavaScriptCore.xcodeproj/project.pbxproj:
1889 2005-10-11 Geoffrey Garen <ggaren@apple.com>
1891 New JavaScriptCore test results to reflect the last change.
1893 * tests/mozilla/expected.html:
1895 2005-10-10 Geoffrey Garen <ggaren@apple.com>
1897 - Implemented caching of match state inside the global RegExp object
1898 (lastParen, leftContext, rightContext, lastMatch, input).
1900 exec(), test(), match(), search(), and replace() now dipatch regular
1901 expression matching through the RegExp object's performMatch function,
1902 to facilitate caching. This replaces registerRegexp and
1905 - Implemented the special '$' aliases (e.g. RegExp.input aliases to
1908 - Moved support for backreferences into the new static hash table
1909 used for other special RegExp properties. Truncated backreferences
1910 at $9 to match IE, FF, and the "What's New in Netscape 1.2?" doc.
1911 (String.replace still supports double-digit backreferences.)
1913 - Tweaked RegExp.prototype.exec to handle ginormous values in lastIndex.
1915 Fixes 11 -- count em, 11 -- JavaScriptCore tests.
1917 * fast/js/regexp-caching-expected.txt: Added.
1918 * fast/js/regexp-caching.html: Added.
1922 * JavaScriptCore.xcodeproj/project.pbxproj: Added regexp_object.lut.h
1923 * kjs/create_hash_table: Tweaked to allow for more exotic characters.
1924 We now rely on the compiler to catch illegal
1927 (KJS::RegExp::RegExp):
1928 * kjs/regexp_object.cpp:
1929 (RegExpProtoFuncImp::callAsFunction):
1930 (RegExpObjectImp::RegExpObjectImp):
1931 (RegExpObjectImp::performMatch):
1932 (RegExpObjectImp::arrayOfMatches):
1933 (RegExpObjectImp::backrefGetter):
1934 (RegExpObjectImp::getLastMatch):
1935 (RegExpObjectImp::getLastParen):
1936 (RegExpObjectImp::getLeftContext):
1937 (RegExpObjectImp::getRightContext):
1938 (RegExpObjectImp::getOwnPropertySlot):
1939 (RegExpObjectImp::getValueProperty):
1940 (RegExpObjectImp::put):
1941 (RegExpObjectImp::putValueProperty):
1942 * kjs/regexp_object.h:
1943 (KJS::RegExpObjectImp::):
1944 * kjs/string_object.cpp:
1945 (substituteBackreferences):
1947 (StringProtoFuncImp::callAsFunction):
1949 2005-10-09 Darin Adler <darin@apple.com>
1951 Reviewed by Maciej; some changes done after review.
1953 - fixed <rdar://problem/4092064> hanging loading page; rte.ie (works in IE and Firefox)
1954 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5280
1955 Date.setMonth fails with negative values
1956 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5154
1957 JSC should switch to _r variants of unix time/date functions
1958 - fixed a few possible overflow cases
1960 Retested all tests to be sure nothing broke; added layout test for bug 5280.
1962 * kjs/config.h: Removed TIME_WITH_SYS_TIME define. Also set HAVE_SYS_TIMEB_H
1963 for the __APPLE__ case (the latter is accurate but irrelevant).
1965 * kjs/date_object.h: Reformatted. Removed unnecessary include of "function_object.h".
1966 Moved declarations of helper classes and functions into the cpp file.
1968 * kjs/date_object.cpp: Removed code at top to define macros to use CoreFoundation instead of
1969 POSIX date functions.
1970 (KJS::styleFromArgString): Tweaked to return early instead of using a variable.
1971 (KJS::formatLocaleDate): Tweaked to check for undefined rather than checking argument count.
1972 (KJS::formatDate): Made parameter const.
1973 (KJS::formatDateUTCVariant): Ditto.
1974 (KJS::formatTime): Ditto.
1975 (KJS::DateProtoFuncImp::callAsFunction): Use gmtime_r and localtime_r instead of gmtime and
1977 (KJS::DateObjectImp::callAsFunction): Use localtime_r instead of localtime.
1978 (KJS::ymdhmsToSeconds): Renamed from ymdhms_to_seconds. Changed computation to avoid possible
1979 overflow if year is an extremely large or small number.
1980 (KJS::makeTime): Removed code to move large month numbers from tm_mon to tm_year; this was
1981 to accomodate CFGregorianDate, which is no longer used (and didn't handle negative values).
1982 (KJS::parseDate): Renamed from KRFCDate_parseDate; changed to return a value in milliseconds
1983 rather than in seconds. Reformatted the code. Changed to use UTF8String() instead of ascii(),
1984 since ascii() is not thread safe. Changed some variables back from int to long to avoid
1985 trouble if the result of strtol does not fit in an int (64-bit issue only).
1987 2005-10-08 Mitz Pettel <opendarwin.org@mitzpettel.com>
1990 Tweaked and landed by Darin.
1992 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5266
1993 Support parenthesized comments in Date.parse()
1995 * kjs/date_object.cpp:
1996 (KJS::skipSpacesAndComments): Take a pointer, and advance it past spaces,
1997 and also past anything enclosed in parentheses.
1998 (KJS::KRFCDate_parseDate): Use skipSpacesAndComments wherever we formerly had
1999 code to skip spaces.
2001 2005-10-08 Justin Haygood <justin@xiondigital.net>
2003 Reviewed, tweaked, and landed by Darin.
2005 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5189
2006 pcre_exec.c fails to compile using MSVC
2007 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5190
2008 KJS config.h adjustment for Win32
2010 * kjs/config.h: Make sure HAVE_MMAP and HAVE_SBRK are off for Win32.
2011 Turn HAVE_ERRNO_H on for Mac OS X. Sort defines so they are easy to compare
2012 with each other. Remove #undef of DEBUG_COLLECTOR.
2013 * pcre/pcre_exec.c: (match): Work around strange MSVC complaint by splitting
2014 the definition of a local variable into a separate declaration and
2017 2005-10-05 Geoffrey Garen <ggaren@apple.com>
2019 - Darin and I rewrote our implementation of the SimpleNumber class
2020 to store number bit patterns in their floating point formats.
2022 My tweaks reviewed by Darin.
2024 ~1% speedup on JS iBench.
2026 * kjs/internal.h: removed obsolete jsNumber declarations.
2027 * kjs/math_object.cpp:
2028 (MathFuncImp::callAsFunction): changed KJS::isNaN to isNaN
2030 (PostfixResolveNode::evaluate): removed obsolete knownToBeInteger
2031 (PostfixBracketNode::evaluate): ditto
2032 (PostfixDotNode::evaluate): ditto
2033 (PrefixResolveNode::evaluate): ditto
2034 (PrefixBracketNode::evaluate): ditto
2035 (PrefixDotNode::evaluate): ditto
2036 (NegateNode::evaluate): ditto
2037 (valueForReadModifyAssignment): ditto
2038 * kjs/number_object.cpp: removed obsolete comment
2039 * kjs/operations.cpp:
2040 (KJS::equal): removed unnecessary isNaN checks
2041 (KJS::strictEqual): ditto
2042 (KJS::add): removed obsolete knownToBeInteger
2044 * kjs/operations.h: removed include of "value.h" to prevent circular reference
2045 * kjs/simple_number.h: removed unnecessary #includes
2046 (KJS::SimpleNumber::make): see above
2047 (KJS::SimpleNumber::is): ditto
2048 (KJS::SimpleNumber::value): ditto
2049 * kjs/string_object.cpp:
2050 (StringProtoFuncImp::callAsFunction): changed KJS::isNaN to isNaN
2051 * kjs/ustring.cpp: removed unnecessary isNaN check
2052 (KJS::UString::toUInt32): ditto
2054 (KJS::jsNumber): removed obsolete jsNumber definitions
2055 (KJS::ConstantValues::init): NaN is no longer a ConstantValue
2056 (KJS::ConstantValues::clear): ditto
2057 (KJS::ConstantValues::mark): ditto
2058 * kjs/value.h: removed obsolete knownToBeInteger
2059 (KJS::jsNaN): now returns a SimpleNumber
2060 (KJS::ValueImp::getUInt32): changed to account for NaN being a SimpleNumber
2061 (KJS::ValueImp::toBoolean): ditto
2062 (KJS::ValueImp::toString): changed to account for +/- 0.0
2063 (KJS::jsZero): changed to reflect that SimpleNumber::make takes a double
2066 (KJS::Number): removed obsolete non-double constructor declarations
2068 2005-10-05 Maciej Stachowiak <mjs@apple.com>
2072 - fixed <rdar://problem/4260481> Remove Reference type from JavaScriptCore
2074 Also fixed some bugs with for..in enumeration while I was at it. object
2075 properties now come before prototype properties and duplicates
2076 between object and prototype are listed only once.
2078 * JavaScriptCore.xcodeproj/project.pbxproj:
2079 * kjs/IdentifierSequencedSet.cpp: Added.
2080 (KJS::IdentifierSequencedSet::IdentifierSequencedSet):
2081 (KJS::IdentifierSequencedSet::deallocateVector):
2082 (KJS::IdentifierSequencedSet::~IdentifierSequencedSet):
2083 (KJS::IdentifierSequencedSet::insert):
2084 * kjs/IdentifierSequencedSet.h: Added.
2085 (KJS::IdentifierSequencedSetIterator::IdentifierSequencedSetIterator):
2086 (KJS::IdentifierSequencedSetIterator::operator*):
2087 (KJS::IdentifierSequencedSetIterator::operator->):
2088 (KJS::IdentifierSequencedSetIterator::operator++):
2089 (KJS::IdentifierSequencedSetIterator::operator==):
2090 (KJS::IdentifierSequencedSetIterator::operator!=):
2091 (KJS::IdentifierSequencedSet::begin):
2092 (KJS::IdentifierSequencedSet::end):
2093 (KJS::IdentifierSequencedSet::size):
2094 * kjs/array_instance.h:
2095 * kjs/array_object.cpp:
2096 (ArrayInstanceImp::getPropertyNames):
2097 (ArrayInstanceImp::setLength):
2098 (ArrayInstanceImp::pushUndefinedObjectsToEnd):
2100 (ForInNode::execute):
2103 (KJS::ObjectImp::getPropertyNames):
2105 * kjs/property_map.cpp:
2106 (KJS::PropertyMap::getEnumerablePropertyNames):
2107 (KJS::PropertyMap::getSparseArrayPropertyNames):
2108 * kjs/property_map.h:
2110 * kjs/protected_reference.h: Removed.
2111 * kjs/reference.cpp: Removed.
2112 * kjs/reference.h: Removed.
2113 * kjs/reference_list.cpp: Removed.
2114 * kjs/reference_list.h: Removed.
2116 (KJS::UString::impl):
2117 * kxmlcore/HashSet.h:
2119 2005-10-04 Eric Seidel <eseidel@apple.com>
2123 Code cleanup, which resulted in a small win on iBench.
2126 (KJS::tryGetAndCallProperty): new static inline
2127 (KJS::ObjectImp::defaultValue): code cleanup
2129 2005-10-03 Maciej Stachowiak <mjs@apple.com>
2131 Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
2133 - more Linux build fixes
2135 * kjs/operations.cpp:
2136 * kxmlcore/FastMalloc.h:
2137 * kxmlcore/TCSystemAlloc.cpp:
2138 (TCMalloc_SystemAlloc):
2140 2005-10-03 Maciej Stachowiak <mjs@apple.com>
2142 Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
2144 http://bugzilla.opendarwin.org/show_bug.cgi?id=5174
2145 Add support for compiling on Linux (likely to help for other POSIX systems too)
2147 * kjs/collector.cpp:
2148 (KJS::Collector::markCurrentThreadConservatively):
2149 (KJS::Collector::markOtherThreadConservatively):
2151 * kjs/date_object.cpp:
2153 (KJS::formatDateUTCVariant):
2155 (KJS::timeZoneOffset):
2156 (KJS::DateProtoFuncImp::callAsFunction):
2157 (KJS::DateObjectImp::construct):
2158 (KJS::DateObjectImp::callAsFunction):
2160 * kjs/identifier.cpp:
2162 (KJS::initializeInterpreterLock):
2163 (KJS::lockInterpreter):
2164 (KJS::unlockInterpreter):
2165 (KJS::UndefinedImp::toPrimitive):
2166 (KJS::UndefinedImp::toBoolean):
2167 (KJS::UndefinedImp::toNumber):
2168 (KJS::UndefinedImp::toString):
2169 (KJS::NullImp::toPrimitive):
2170 (KJS::NullImp::toBoolean):
2171 (KJS::NullImp::toNumber):
2172 (KJS::NullImp::toString):
2173 (KJS::BooleanImp::toPrimitive):
2174 (KJS::BooleanImp::toBoolean):
2175 (KJS::BooleanImp::toNumber):
2176 (KJS::BooleanImp::toString):
2177 (KJS::StringImp::toPrimitive):
2178 (KJS::StringImp::toBoolean):
2179 (KJS::StringImp::toNumber):
2180 (KJS::StringImp::toString):
2182 * kjs/protected_values.cpp:
2184 2005-10-03 Maciej Stachowiak <mjs@apple.com>
2186 - fix Development build after last checkin
2188 * kxmlcore/FastMalloc.cpp:
2189 (KXMLCore::fastMallocRegisterThread):
2191 2005-10-02 Maciej Stachowiak <mjs@apple.com>
2195 <rdar://problem/4283967> REGRESSION: 3% regression on PLT from new FastMalloc
2196 http://bugzilla.opendarwin.org/show_bug.cgi?id=5243
2198 A number of optimizations to the new threadsafe malloc that make it actually as fast
2199 as dlmalloc (I measured wrong before) and as memory-efficient as the system malloc.
2201 - use fastMalloc for everything - it now gets applied to all new/delete allocations
2202 via a private inline operator new that is now included into every file via config.h.
2204 - tweaked some of the numeric parameters for size classes and amount of wasted memory
2205 allowed per allocation - this saves on memory use and consequently improves speed.
2207 - so long as the allocator is not being used on background threads, get the per-thread
2208 cache from a global variable instead of from pthread_getspecific, since the latter is slow.
2210 - inline more functions, and force the ones GCC refuses to inline with
2211 attribute(always_inline), nearly all of these have one call site so inlining them has
2214 - use some tricks to calculate allocation size more efficiently and fewer times for small
2215 allocations, to avoid hitting the huge size table array.
2217 - avoid hitting the per-thread cache on code paths that don't need it.
2219 - implement inline assembly version of spinlock for PowerPC (was already done for x86)
2221 * bindings/NP_jsobject.cpp:
2222 * bindings/c/c_class.cpp:
2223 * bindings/c/c_instance.cpp:
2224 * bindings/c/c_runtime.cpp:
2225 * bindings/c/c_utility.cpp:
2226 * bindings/jni/jni_class.cpp:
2227 * bindings/jni/jni_instance.cpp:
2228 * bindings/jni/jni_jsobject.cpp:
2229 * bindings/jni/jni_objc.mm:
2230 * bindings/jni/jni_runtime.cpp:
2231 * bindings/jni/jni_utility.cpp:
2232 * bindings/npruntime.cpp:
2233 * bindings/objc/WebScriptObject.mm:
2234 * bindings/objc/objc_class.mm:
2235 * bindings/objc/objc_instance.mm:
2236 * bindings/objc/objc_runtime.mm:
2237 * bindings/objc/objc_utility.mm:
2238 * bindings/runtime.cpp:
2239 * bindings/runtime_array.cpp:
2240 * bindings/runtime_method.cpp:
2241 * bindings/runtime_object.cpp:
2242 * bindings/runtime_root.cpp:
2243 * bindings/testbindings.cpp:
2244 * bindings/testbindings.mm:
2245 * kjs/array_object.cpp:
2246 (ArrayInstanceImp::ArrayInstanceImp):
2247 (ArrayInstanceImp::~ArrayInstanceImp):
2248 (ArrayInstanceImp::resizeStorage):
2249 * kjs/bool_object.cpp:
2250 * kjs/collector.cpp:
2251 (KJS::Collector::registerThread):
2254 * kjs/error_object.cpp:
2256 * kjs/function_object.cpp:
2257 * kjs/identifier.cpp:
2258 (KJS::Identifier::rehash):
2260 (KJS::Parser::saveNewNode):
2261 (KJS::clearNewNodes):
2262 * kjs/interpreter.cpp:
2264 (Lexer::doneParsing):
2265 (Lexer::makeIdentifier):
2266 (Lexer::makeUString):
2268 * kjs/math_object.cpp:
2271 * kjs/nodes2string.cpp:
2272 * kjs/number_object.cpp:
2273 (integer_part_noexp):
2276 * kjs/object_object.cpp:
2277 * kjs/property_map.cpp:
2278 * kjs/property_slot.cpp:
2279 * kjs/protected_values.cpp:
2280 (KJS::ProtectedValues::rehash):
2281 * kjs/reference.cpp:
2282 * kjs/reference_list.cpp:
2284 * kjs/regexp_object.cpp:
2285 * kjs/scope_chain.cpp:
2286 * kjs/scope_chain.h:
2287 * kjs/string_object.cpp:
2291 * kxmlcore/Assertions.mm:
2292 * kxmlcore/FastMalloc.cpp:
2293 (KXMLCore::InitSizeClasses):
2294 (KXMLCore::DLL_IsEmpty):
2295 (KXMLCore::DLL_Prepend):
2296 (KXMLCore::TCMalloc_Central_FreeList::Insert):
2297 (KXMLCore::TCMalloc_Central_FreeList::Remove):
2298 (KXMLCore::TCMalloc_Central_FreeList::Populate):
2299 (KXMLCore::TCMalloc_ThreadCache::Allocate):
2300 (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
2301 (KXMLCore::fastMallocRegisterThread):
2302 (KXMLCore::TCMalloc_ThreadCache::GetCache):
2303 (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
2304 (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2305 (KXMLCore::do_malloc):
2306 (KXMLCore::do_free):
2307 (KXMLCore::realloc):
2308 * kxmlcore/FastMalloc.h:
2312 (operator delete[]):
2313 * kxmlcore/HashTable.cpp:
2314 * kxmlcore/TCSpinLock.h:
2315 (TCMalloc_SpinLock::Lock):
2316 (TCMalloc_SpinLock::Unlock):
2317 (TCMalloc_SlowLock):
2318 * kxmlcore/TCSystemAlloc.cpp:
2320 2005-09-30 Geoffrey Garen <ggaren@apple.com>
2322 - Second cut at fixing <rdar://problem/4275206> Denver Regression: Seed:
2323 Past Editions of Opinions display "NAN/Undefined" for www.washingtonpost.com
2327 * kjs/date_object.cpp:
2328 (KJS::KRFCDate_parseDate): Intead of creating a timezone when one isn't specified,
2329 just rely on the fallback logic, which will do it for you. Also, return invalidDate
2330 if the date includes trailing garbage. (Somewhat accidentally, the timezone logic
2331 used to catch trailing garbage.)
2333 Added test case to fast/js/date-parse-test.html.
2335 2005-09-29 Eric Seidel <eseidel@apple.com>
2336 Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
2340 Fix JSC memory smasher in TOT.
2341 http://bugzilla.opendarwin.org/show_bug.cgi?id=5176
2346 2005-09-29 Eric Seidel <eseidel@apple.com>
2347 Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
2351 * JavaScriptCore.xcodeproj/project.pbxproj:
2352 Build fix for JSC+SVG after 5161.
2353 http://bugzilla.opendarwin.org/show_bug.cgi?id=5179
2355 2005-09-28 Geoffrey Garen <ggaren@apple.com>
2357 - Fixed <rdar://problem/4275206> Denver Regression: Seed: Past Editions of Opinions display
2358 "NAN/Undefined" for www.washingtonpost.com
2362 * kjs/date_object.cpp:
2363 (KJS::KRFCDate_parseDate): If the timezone isn't specified, rather than returning
2364 invalidDate, substitute the local timezone. This matches the behavior of FF/IE.
2366 2005-09-28 Maciej Stachowiak <mjs@apple.com>
2368 Patch from George Staikos, reviewed by me.
2370 - fixed some compile issues on Linux
2372 * kjs/property_slot.h:
2373 * kjs/simple_number.h:
2375 2005-09-27 Maciej Stachowiak <mjs@apple.com>
2379 - move HashMap/HashSet code down to JavaScriptCore
2380 http://bugzilla.opendarwin.org/show_bug.cgi?id=5161
2382 * JavaScriptCore.xcodeproj/project.pbxproj:
2384 (KJS::interpreterMap): Function that fetches the interpreter map on demand.
2385 (KJS::InterpreterImp::InterpreterImp): Replace use of InterpreterMap
2386 class with an appropriate HashMap.
2387 (KJS::InterpreterImp::clear): ditto
2388 (KJS::InterpreterImp::interpreterWithGlobalObject): ditto
2389 * kjs/interpreter_map.cpp: Removed.
2390 * kjs/interpreter_map.h: Removed.
2392 The HashMap/HashSet code (copied and slightly tweaked from WebCore)
2394 * kxmlcore/HashFunctions.h: Added.
2398 (KXMLCore::PointerHash::hash):
2399 (KXMLCore::PointerHash::equal):
2400 * kxmlcore/HashMap.h: Added.
2401 (KXMLCore::extractFirst):
2402 (KXMLCore::HashMap::HashMap):
2404 (KXMLCore::::capacity):
2405 (KXMLCore::::isEmpty):
2406 (KXMLCore::::begin):
2409 (KXMLCore::::contains):
2412 (KXMLCore::::remove):
2413 (KXMLCore::::clear):
2414 (KXMLCore::deleteAllValues):
2415 * kxmlcore/HashMapPtrSpec.h: Added.
2416 (KXMLCore::PointerHashIteratorAdapter::PointerHashIteratorAdapter):
2417 (KXMLCore::PointerHashIteratorAdapter::operator*):
2418 (KXMLCore::PointerHashIteratorAdapter::operator->):
2419 (KXMLCore::PointerHashIteratorAdapter::operator++):
2420 (KXMLCore::PointerHashIteratorAdapter::operator==):
2421 (KXMLCore::PointerHashIteratorAdapter::operator!=):
2422 (KXMLCore::PointerHashConstIteratorAdapter::PointerHashConstIteratorAdapter):
2423 (KXMLCore::PointerHashConstIteratorAdapter::operator*):
2424 (KXMLCore::PointerHashConstIteratorAdapter::operator->):
2425 (KXMLCore::PointerHashConstIteratorAdapter::operator++):
2426 (KXMLCore::PointerHashConstIteratorAdapter::operator==):
2427 (KXMLCore::PointerHashConstIteratorAdapter::operator!=):
2429 * kxmlcore/HashSet.h: Added.
2430 (KXMLCore::identityExtract):
2431 (KXMLCore::convertAdapter):
2432 (KXMLCore::HashSet::HashSet):
2434 (KXMLCore::::capacity):
2435 (KXMLCore::::isEmpty):
2436 (KXMLCore::::begin):
2439 (KXMLCore::::contains):
2440 (KXMLCore::::insert):
2441 (KXMLCore::::remove):
2442 (KXMLCore::::clear):
2443 * kxmlcore/HashTable.cpp: Added.
2444 (KXMLCore::HashTableStats::~HashTableStats):
2445 (KXMLCore::HashTableStats::recordCollisionAtCount):
2446 * kxmlcore/HashTable.h: Added.
2447 (KXMLCore::HashTableIterator::skipEmptyBuckets):
2448 (KXMLCore::HashTableIterator::HashTableIterator):
2449 (KXMLCore::HashTableIterator::operator*):
2450 (KXMLCore::HashTableIterator::operator->):
2451 (KXMLCore::HashTableIterator::operator++):
2452 (KXMLCore::HashTableIterator::operator==):
2453 (KXMLCore::HashTableIterator::operator!=):
2454 (KXMLCore::HashTableConstIterator::HashTableConstIterator):
2455 (KXMLCore::HashTableConstIterator::operator*):
2456 (KXMLCore::HashTableConstIterator::operator->):
2457 (KXMLCore::HashTableConstIterator::skipEmptyBuckets):
2458 (KXMLCore::HashTableConstIterator::operator++):
2459 (KXMLCore::HashTableConstIterator::operator==):
2460 (KXMLCore::HashTableConstIterator::operator!=):
2461 (KXMLCore::HashTable::HashTable):
2462 (KXMLCore::HashTable::~HashTable):
2463 (KXMLCore::HashTable::begin):
2464 (KXMLCore::HashTable::end):
2465 (KXMLCore::HashTable::size):
2466 (KXMLCore::HashTable::capacity):
2467 (KXMLCore::HashTable::insert):
2468 (KXMLCore::HashTable::isEmptyBucket):
2469 (KXMLCore::HashTable::isDeletedBucket):
2470 (KXMLCore::HashTable::isEmptyOrDeletedBucket):
2471 (KXMLCore::HashTable::hash):
2472 (KXMLCore::HashTable::equal):
2473 (KXMLCore::HashTable::identityConvert):
2474 (KXMLCore::HashTable::extractKey):
2475 (KXMLCore::HashTable::lookup):
2476 (KXMLCore::HashTable::shouldExpand):
2477 (KXMLCore::HashTable::mustRehashInPlace):
2478 (KXMLCore::HashTable::shouldShrink):
2479 (KXMLCore::HashTable::shrink):
2480 (KXMLCore::HashTable::clearBucket):
2481 (KXMLCore::HashTable::deleteBucket):
2482 (KXMLCore::HashTable::makeLookupResult):
2483 (KXMLCore::HashTable::makeIterator):
2484 (KXMLCore::HashTable::makeConstIterator):
2485 (KXMLCore::::lookup):
2486 (KXMLCore::::insert):
2487 (KXMLCore::::reinsert):
2489 (KXMLCore::::contains):
2490 (KXMLCore::::remove):
2491 (KXMLCore::::allocateTable):
2492 (KXMLCore::::expand):
2493 (KXMLCore::::rehash):
2494 (KXMLCore::::clear):
2495 (KXMLCore::::HashTable):
2497 (KXMLCore::::operator):
2498 (KXMLCore::::checkTableConsistency):
2499 (KXMLCore::::checkTableConsistencyExceptSize):
2500 * kxmlcore/HashTraits.h: Added.
2501 (KXMLCore::HashTraits::emptyValue):
2503 (KXMLCore::PairHashTraits::emptyValue):
2504 (KXMLCore::PairHashTraits::deletedValue):
2506 2005-09-27 Darin Adler <darin@apple.com>
2510 - update grammar to fix conflicts; fixes one of our test cases
2511 because it resolves the relationship between function expressions
2512 and declarations in the way required by the ECMA specification
2514 * kjs/grammar.y: Added lots of new grammar rules so we have no conflicts.
2515 A new set of rules for "no bracket or function at start of expression" and
2516 another set of rules for "no in anywhere in expression". Also simplified the
2517 handling of try to use only a single node and used operator precedence to
2518 get rid of the conflict in handling of if and else. Also used a macro to
2519 streamline the handling of automatic semicolons and changed parenthesis
2520 handling to use a virtual function.
2522 * kjs/nodes.h: Added nodeInsideAllParens, removed unused abortStatement.
2523 (KJS::TryNode::TryNode): Updated to hold catch and finally blocks directly instead
2524 of using a special node for each.
2526 (Node::createErrorCompletion): Added. Used instead of throwError when creating errors
2527 that should not be in a completion rather than an ExecState.
2528 (Node::throwUndefinedVariableError): Added. Sets source location unlike the call it
2530 (Node::nodeInsideAllParens): Added.
2531 (GroupNode::nodeInsideAllParens): Added.
2532 (StatListNode::execute): Removed code to move exceptions into completion objects;
2533 that's now done solely by the KJS_CHECKEXCEPTION macro.
2534 (TryNode::execute): Include execution of catch and finally here rather than using
2536 (FuncDeclNode::execute): Moved here, no longer inline.
2537 * kjs/nodes2string.cpp:
2538 (TryNode::streamTo): Updated for change.
2539 (FuncDeclNode::streamTo): Ditto.
2540 (FuncExprNode::streamTo): Ditto.
2542 * kjs/kjs-test: Removed. Was part of "make check".
2543 * kjs/kjs-test.chk: Ditto.
2544 * kjs/test.js: Ditto.
2546 * tests/mozilla/expected.html: Updated because one more test succeeds.
2548 2005-09-27 Adele Peterson <adele@apple.com>
2552 Changed ints to size_t where appropriate.
2554 * kjs/collector.cpp:
2555 (KJS::Collector::allocate):
2556 (KJS::Collector::markStackObjectsConservatively):
2557 (KJS::Collector::collect):
2558 (KJS::Collector::size):
2559 (KJS::Collector::numInterpreters):
2560 (KJS::Collector::numGCNotAllowedObjects):
2561 (KJS::Collector::numReferencedObjects):
2564 2005-09-27 Eric Seidel <eseidel@apple.com>
2568 * JavaScriptCore.xcodeproj/project.pbxproj: fix after malloc changes.
2570 2005-09-27 Eric Seidel <eseidel@apple.com>
2575 (FuncExprNode::evaluate): Now sets .constructor properly.
2576 Test cases added to WebCore/layout-tests.
2577 http://bugzilla.opendarwin.org/show_bug.cgi?id=3537
2579 2005-09-26 Maciej Stachowiak <mjs@apple.com>
2583 - replace dlmalloc with tcmalloc
2584 http://bugzilla.opendarwin.org/show_bug.cgi?id=5145
2586 I also moved SharedPtr and the assertion code from WebCore into a
2587 new kxmlcore directory.
2589 * JavaScriptCore.xcodeproj/project.pbxproj:
2590 * kjs/collector.cpp:
2591 (KJS::Collector::allocate):
2592 (KJS::Collector::collect):
2594 * kjs/fast_malloc.cpp: Removed.
2595 * kjs/fast_malloc.h: Removed.
2598 * kjs/function_object.cpp:
2599 * kjs/identifier.cpp:
2600 (KJS::Identifier::add):
2604 * kjs/nodes2string.cpp:
2605 * kjs/property_map.cpp:
2606 (KJS::PropertyMap::~PropertyMap):
2607 (KJS::PropertyMap::rehash):
2608 * kjs/scope_chain.h:
2609 * kjs/shared_ptr.h: Removed.
2610 * kjs/string_object.cpp:
2611 (StringObjectFuncImp::callAsFunction):
2613 (KJS::UString::Rep::createCopying):
2614 (KJS::UString::Rep::destroy):
2615 (KJS::UString::expandCapacity):
2616 (KJS::UString::expandPreCapacity):
2617 (KJS::UString::UString):
2618 (KJS::UString::spliceSubstringsWithSeparators):
2619 (KJS::UString::append):
2620 (KJS::UString::operator=):
2621 (KJS::UString::detach):
2623 * kxmlcore/Assertions.h: Added.
2624 * kxmlcore/Assertions.mm: Added.
2625 * kxmlcore/FastMalloc.cpp: Added.
2626 (KXMLCore::LgFloor):
2627 (KXMLCore::SizeClass):
2628 (KXMLCore::ByteSizeForClass):
2629 (KXMLCore::InitSizeClasses):
2630 (KXMLCore::MetaDataAlloc):
2631 (KXMLCore::PageHeapAllocator::Init):
2632 (KXMLCore::PageHeapAllocator::New):
2633 (KXMLCore::PageHeapAllocator::Delete):
2634 (KXMLCore::PageHeapAllocator::inuse):
2636 (KXMLCore::AllocationSize):
2638 (KXMLCore::NewSpan):
2639 (KXMLCore::DeleteSpan):
2640 (KXMLCore::DLL_Init):
2641 (KXMLCore::DLL_Remove):
2642 (KXMLCore::DLL_IsEmpty):
2643 (KXMLCore::DLL_Length):
2644 (KXMLCore::DLL_Print):
2645 (KXMLCore::DLL_Prepend):
2646 (KXMLCore::DLL_InsertOrdered):
2648 (KXMLCore::TCMalloc_PageHeap::GetDescriptor):
2649 (KXMLCore::TCMalloc_PageHeap::SystemBytes):
2650 (KXMLCore::TCMalloc_PageHeap::FreeBytes):
2651 (KXMLCore::TCMalloc_PageHeap::RecordSpan):
2652 (KXMLCore::TCMalloc_PageHeap::TCMalloc_PageHeap):
2653 (KXMLCore::TCMalloc_PageHeap::New):
2654 (KXMLCore::TCMalloc_PageHeap::Split):
2655 (KXMLCore::TCMalloc_PageHeap::Carve):
2656 (KXMLCore::TCMalloc_PageHeap::Delete):
2657 (KXMLCore::TCMalloc_PageHeap::RegisterSizeClass):
2658 (KXMLCore::TCMalloc_PageHeap::Dump):
2659 (KXMLCore::TCMalloc_PageHeap::GrowHeap):
2660 (KXMLCore::TCMalloc_PageHeap::Check):
2661 (KXMLCore::TCMalloc_PageHeap::CheckList):
2662 (KXMLCore::TCMalloc_ThreadCache_FreeList::Init):
2663 (KXMLCore::TCMalloc_ThreadCache_FreeList::length):
2664 (KXMLCore::TCMalloc_ThreadCache_FreeList::empty):
2665 (KXMLCore::TCMalloc_ThreadCache_FreeList::lowwatermark):
2666 (KXMLCore::TCMalloc_ThreadCache_FreeList::clear_lowwatermark):
2667 (KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
2668 (KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
2669 (KXMLCore::TCMalloc_ThreadCache::freelist_length):
2670 (KXMLCore::TCMalloc_ThreadCache::Size):
2671 (KXMLCore::TCMalloc_Central_FreeList::length):
2672 (KXMLCore::TCMalloc_Central_FreeList::Init):
2673 (KXMLCore::TCMalloc_Central_FreeList::Insert):
2674 (KXMLCore::TCMalloc_Central_FreeList::Remove):
2675 (KXMLCore::TCMalloc_Central_FreeList::Populate):
2676 (KXMLCore::TCMalloc_ThreadCache::SampleAllocation):
2677 (KXMLCore::TCMalloc_ThreadCache::Init):
2678 (KXMLCore::TCMalloc_ThreadCache::Cleanup):
2679 (KXMLCore::TCMalloc_ThreadCache::Allocate):
2680 (KXMLCore::TCMalloc_ThreadCache::Deallocate):
2681 (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
2682 (KXMLCore::TCMalloc_ThreadCache::ReleaseToCentralCache):
2683 (KXMLCore::TCMalloc_ThreadCache::Scavenge):
2684 (KXMLCore::TCMalloc_ThreadCache::GetCache):
2685 (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
2686 (KXMLCore::TCMalloc_ThreadCache::PickNextSample):
2687 (KXMLCore::TCMalloc_ThreadCache::InitModule):
2688 (KXMLCore::TCMalloc_ThreadCache::InitTSD):
2689 (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2690 (KXMLCore::TCMalloc_ThreadCache::DeleteCache):
2691 (KXMLCore::TCMalloc_ThreadCache::RecomputeThreadCacheSize):
2692 (KXMLCore::TCMalloc_ThreadCache::Print):
2693 (KXMLCore::ExtractStats):
2694 (KXMLCore::DumpStats):
2695 (KXMLCore::PrintStats):
2696 (KXMLCore::DumpStackTraces):
2697 (KXMLCore::TCMallocImplementation::GetStats):
2698 (KXMLCore::TCMallocImplementation::ReadStackTraces):
2699 (KXMLCore::TCMallocImplementation::GetNumericProperty):
2700 (KXMLCore::TCMallocImplementation::SetNumericProperty):
2701 (KXMLCore::DoSampledAllocation):
2702 (KXMLCore::do_malloc):
2703 (KXMLCore::do_free):
2704 (KXMLCore::do_memalign):
2705 (KXMLCore::TCMallocGuard::TCMallocGuard):
2706 (KXMLCore::TCMallocGuard::~TCMallocGuard):
2711 (KXMLCore::realloc):
2712 (KXMLCore::memalign):
2713 (KXMLCore::posix_memalign):
2715 (KXMLCore::pvalloc):
2716 (KXMLCore::malloc_stats):
2717 (KXMLCore::mallopt):
2718 (KXMLCore::mallinfo):
2719 * kxmlcore/FastMalloc.h: Added.
2720 (KXMLCore::FastAllocated::operator new):
2721 (KXMLCore::FastAllocated::operator delete):
2722 (KXMLCore::FastAllocated::operator new[]):
2723 (KXMLCore::FastAllocated::operator delete[]):
2724 * kxmlcore/SharedPtr.h: Added.
2725 (KXMLCore::SharedPtr::SharedPtr):
2726 (KXMLCore::SharedPtr::~SharedPtr):
2727 (KXMLCore::SharedPtr::isNull):
2728 (KXMLCore::SharedPtr::notNull):
2729 (KXMLCore::SharedPtr::reset):
2730 (KXMLCore::SharedPtr::get):
2731 (KXMLCore::SharedPtr::operator*):
2732 (KXMLCore::SharedPtr::operator->):
2733 (KXMLCore::SharedPtr::operator!):
2734 (KXMLCore::SharedPtr::operator bool):
2735 (KXMLCore::::operator):
2736 (KXMLCore::operator==):
2737 (KXMLCore::operator!=):
2738 (KXMLCore::static_pointer_cast):
2739 (KXMLCore::const_pointer_cast):
2740 * kxmlcore/TCPageMap.h: Added.
2741 (TCMalloc_PageMap1::TCMalloc_PageMap1):
2742 (TCMalloc_PageMap1::Ensure):
2743 (TCMalloc_PageMap1::get):
2744 (TCMalloc_PageMap1::set):
2745 (TCMalloc_PageMap2::TCMalloc_PageMap2):
2746 (TCMalloc_PageMap2::get):
2747 (TCMalloc_PageMap2::set):
2748 (TCMalloc_PageMap2::Ensure):
2749 (TCMalloc_PageMap3::NewNode):
2750 (TCMalloc_PageMap3::TCMalloc_PageMap3):
2751 (TCMalloc_PageMap3::get):
2752 (TCMalloc_PageMap3::set):
2753 (TCMalloc_PageMap3::Ensure):
2754 * kxmlcore/TCSpinLock.h: Added.
2755 (TCMalloc_SpinLock::Init):
2756 (TCMalloc_SpinLock::Finalize):
2757 (TCMalloc_SpinLock::Lock):
2758 (TCMalloc_SpinLock::Unlock):
2759 (TCMalloc_SlowLock):
2760 (TCMalloc_SpinLockHolder::TCMalloc_SpinLockHolder):
2761 (TCMalloc_SpinLockHolder::~TCMalloc_SpinLockHolder):
2762 * kxmlcore/TCSystemAlloc.cpp: Added.
2766 (TCMalloc_SystemAlloc):
2767 * kxmlcore/TCSystemAlloc.h: Added.
2769 2005-09-23 Maciej Stachowiak <mjs@apple.com>
2773 <rdar://problem/4260479> Finish deploying PropertySlot in the interpreter
2774 http://bugzilla.opendarwin.org/show_bug.cgi?id=5112
2776 Convert postfix, prefix, delete, prefix, and for..in expressions to use
2777 PropertySlot-based lookup instead of evaluateReference.
2779 3% speedup on JS iBench.
2781 Fixed two of the JS tests:
2782 * tests/mozilla/expected.html:
2786 (PostfixResolveNode::evaluate):
2787 (PostfixBracketNode::evaluate):
2788 (PostfixDotNode::evaluate):
2789 (DeleteResolveNode::evaluate):
2790 (DeleteBracketNode::evaluate):
2791 (DeleteDotNode::evaluate):
2792 (DeleteValueNode::evaluate):
2793 (typeStringForValue):
2794 (TypeOfResolveNode::evaluate):
2795 (TypeOfValueNode::evaluate):
2796 (PrefixResolveNode::evaluate):
2797 (PrefixBracketNode::evaluate):
2798 (PrefixDotNode::evaluate):
2799 (ForInNode::execute):
2801 (KJS::PostfixResolveNode::PostfixResolveNode):
2802 (KJS::PostfixBracketNode::PostfixBracketNode):
2803 (KJS::PostfixDotNode::PostfixDotNode):
2804 (KJS::DeleteResolveNode::DeleteResolveNode):
2805 (KJS::DeleteBracketNode::DeleteBracketNode):
2806 (KJS::DeleteDotNode::DeleteDotNode):
2807 (KJS::DeleteValueNode::DeleteValueNode):
2808 (KJS::TypeOfResolveNode::TypeOfResolveNode):
2809 (KJS::TypeOfValueNode::TypeOfValueNode):
2810 (KJS::PrefixResolveNode::PrefixResolveNode):
2811 (KJS::PrefixBracketNode::PrefixBracketNode):
2812 (KJS::PrefixDotNode::PrefixDotNode):
2813 * kjs/nodes2string.cpp:
2814 (PostfixResolveNode::streamTo):
2815 (PostfixBracketNode::streamTo):
2816 (PostfixDotNode::streamTo):
2817 (DeleteResolveNode::streamTo):
2818 (DeleteBracketNode::streamTo):
2819 (DeleteDotNode::streamTo):
2820 (DeleteValueNode::streamTo):
2821 (TypeOfValueNode::streamTo):
2822 (TypeOfResolveNode::streamTo):
2823 (PrefixResolveNode::streamTo):
2824 (PrefixBracketNode::streamTo):
2825 (PrefixDotNode::streamTo):
2826 * kjs/reference.cpp:
2827 (KJS::Reference::Reference):
2828 (KJS::Reference::getPropertyName):
2829 (KJS::Reference::getValue):
2830 (KJS::Reference::deleteValue):
2833 2005-09-23 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
2835 Reviewed and landed by Darin.
2837 - a Windows-specific file
2839 * os-win32/stdint.h: Added. We plan to remove dependency on the <stdint.h> types,
2840 and if we do so, we will remove this file.
2842 2005-09-22 Geoffrey Garen <ggaren@apple.com>
2844 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5053
2845 Need to restore int/long changes to simple_number.h
2847 Reviewed by darin and mjs.
2849 * kjs/simple_number.h: changed enums to indenpendent constants to clarify types
2850 (KJS::isNegativeZero): changed to static function - no reason to export
2851 (KJS::SimpleNumber::rightShiftSignExtended): new function for clarity
2852 (KJS::SimpleNumber::make): specified cast as reinterpret_cast
2853 (KJS::SimpleNumber::is): changed to use uintptr_t for portability
2854 (KJS::SimpleNumber::value): changed to use uintptr_t and rightShiftSignExtended
2855 (KJS::SimpleNumber::fits): inverted tests - probably only a performance win for double
2856 (KJS::SimpleNumber::integerFits): ditto
2858 2005-09-20 Maciej Stachowiak <mjs@apple.com>
2860 Reviewed by Geoff and partly by Darin.
2862 - fixed http://bugzilla.opendarwin.org/post_bug.cgi
2863 (Reduce conflicts in JavaScriptCore grammar)
2865 This change gets us down from over 200 shift/reduce and 45 reduce/reduce to
2866 9 shift/reduce and 45 reduce/reduce.
2869 * kjs/grammar_types.h: Removed.
2872 (KJS::Node::isGroupNode):
2873 (KJS::Node::isLocation):
2874 (KJS::Node::isResolveNode):
2875 (KJS::Node::isBracketAccessorNode):
2876 (KJS::Node::isDotAccessorNode):
2877 (KJS::ResolveNode::isLocation):
2878 (KJS::ResolveNode::isResolveNode):
2879 (KJS::ResolveNode::identifier):
2880 (KJS::GroupNode::isGroupNode):
2881 (KJS::GroupNode::leafNode):
2882 (KJS::BracketAccessorNode::isLocation):
2883 (KJS::BracketAccessorNode::isBracketAccessorNode):
2884 (KJS::BracketAccessorNode::base):
2885 (KJS::BracketAccessorNode::subscript):
2886 (KJS::DotAccessorNode::isLocation):
2887 (KJS::DotAccessorNode::isDotAccessorNode):
2888 (KJS::DotAccessorNode::base):
2889 (KJS::DotAccessorNode::identifier):
2890 (KJS::FuncExprNode::FuncExprNode):
2891 (KJS::FuncExprNode::identifier):
2892 (KJS::FuncDeclNode::FuncDeclNode):
2893 (KJS::FuncDeclNode::execute):
2895 2005-09-20 Geoffrey Garen <ggaren@apple.com>
2897 - Oops. The 4263434 change was only appropriate on the branch. Rolling out.
2902 (KJS::InterpreterImp::mark):
2904 2005-09-20 Geoffrey Garen <ggaren@apple.com>
2906 - More changes needed to fix <rdar://problem/4214783> 8F29 REGRESSION(Denver/Chardonnay):
2907 kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in
2910 Added InterpreterLocks in some places in the bindings we missed before.
2914 * bindings/runtime_root.cpp:
2915 (KJS::Bindings::addNativeReference):
2916 (KJS::Bindings::removeNativeReference):
2917 (RootObject::removeAllNativeReferences):
2918 * bindings/runtime_root.h:
2919 (KJS::Bindings::RootObject::~RootObject):
2920 (KJS::Bindings::RootObject::setRootObjectImp):
2922 2005-09-20 Geoffrey Garen <ggaren@apple.com>
2924 - Fixed <rdar://problem/4263434> <rdar://problem/4263434> Denver 8F29 Regression:
2925 KJS::InterpreterImp::mark() crash
2927 Fix by mjs, review by me.
2930 (KJS::InterpreterImp::mark): Added a null check on globExec in case a
2931 garbage collection occurs inside InterpreterImp::globalInit (called
2932 from InterpreterImp::InterpreterImp), at which point globExec has not yet been initialized.
2934 2005-09-20 Geoffrey Garen <ggaren@apple.com>
2936 - Rolled in fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4892
2937 Date constructor has problems with months larger than 11
2941 * layout-tests/fast/js/date-big-constructor-expected.txt: Added.
2942 * layout-tests/fast/js/date-big-constructor.html: Added.
2946 * kjs/date_object.cpp:
2947 (KJS::fillStructuresUsingDateArgs):
2950 2005-09-19 Geoffrey Garen <ggaren@apple.com>
2952 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5028
2953 9 layout tests fail following the change from long to int
2955 - Rolled out changes to simple_number.h, and added fits(long long)
2956 and SimpleNumber::fits(unsigned long long) to the old system.
2960 * kjs/simple_number.h:
2961 (KJS::SimpleNumber::):
2962 (KJS::SimpleNumber::value):
2963 (KJS::SimpleNumber::fits):
2964 (KJS::SimpleNumber::integerFits):
2965 (KJS::SimpleNumber::make):
2967 2005-09-14 Maciej Stachowiak <mjs@apple.com>
2971 - fixed <rdar://problem/4214783> REGRESSION: kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in the installer)
2973 Make sure to lock using the InterpreterLock class in all places that need it
2974 (including anything that uses the collector, the parser, the protect count hash table,
2975 and anything that allocates via fast_malloc).
2977 Also added assertions to ensure that the locking rules are followed for the relevant
2981 * bindings/NP_jsobject.cpp:
2982 (identifierFromNPIdentifier):
2987 (_NPN_RemoveProperty):
2990 (_NPN_SetException):
2991 * bindings/jni/jni_jsobject.cpp:
2994 (JSObject::getMember):
2995 (JSObject::setMember):
2996 (JSObject::removeMember):
2997 (JSObject::getSlot):
2998 (JSObject::setSlot):
2999 (JSObject::toString):
3000 (JSObject::convertJObjectToValue):
3001 * bindings/objc/WebScriptObject.mm:
3002 (-[WebScriptObject callWebScriptMethod:withArguments:]):
3003 (-[WebScriptObject evaluateWebScript:]):
3004 (-[WebScriptObject setValue:forKey:]):
3005 (-[WebScriptObject valueForKey:]):
3006 (-[WebScriptObject removeWebScriptKey:]):
3007 (-[WebScriptObject stringRepresentation]):
3008 (-[WebScriptObject webScriptValueAtIndex:]):
3009 (-[WebScriptObject setWebScriptValueAtIndex:value:]):
3010 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
3011 * bindings/runtime.cpp:
3012 (Instance::createRuntimeObject):
3013 * bindings/runtime_root.h:
3014 * bindings/testbindings.cpp:
3016 * bindings/testbindings.mm:
3018 * kjs/fast_malloc.cpp:
3019 (KJS::kjs_fast_malloc):
3020 (KJS::kjs_fast_calloc):
3021 (KJS::kjs_fast_free):
3022 (KJS::kjs_fast_realloc):
3023 * kjs/fast_malloc.h:
3026 (InterpreterImp::InterpreterImp):
3027 (InterpreterImp::clear):
3028 (InterpreterImp::mark):
3029 (InterpreterImp::checkSyntax):
3030 (InterpreterImp::evaluate):
3032 (KJS::InterpreterImp::globalObject):
3033 * kjs/interpreter.cpp:
3034 (Interpreter::evaluate):
3035 * kjs/interpreter.h:
3036 (KJS::InterpreterLock::InterpreterLock):
3037 (KJS::InterpreterLock::~InterpreterLock):
3040 (KJS::ProtectedValue::ProtectedValue):
3041 (KJS::ProtectedValue::~ProtectedValue):
3042 (KJS::ProtectedValue::operator=):
3043 (KJS::ProtectedObject::ProtectedObject):
3044 (KJS::ProtectedObject::~ProtectedObject):
3045 (KJS::ProtectedObject::operator=):
3046 (KJS::ProtectedReference::ProtectedReference):
3047 (KJS::ProtectedReference::~ProtectedReference):
3048 (KJS::ProtectedReference::operator=):
3049 * kjs/protected_object.h:
3050 * kjs/protected_values.cpp:
3051 (KJS::ProtectedValues::getProtectCount):
3052 (KJS::ProtectedValues::increaseProtectCount):
3053 (KJS::ProtectedValues::decreaseProtectCount):
3054 * kjs/string_object.cpp:
3055 (StringObjectImp::StringObjectImp):
3059 2005-09-16 Adele Peterson <adele@apple.com>
3061 Change by Darin, reviewed by me and Maciej.
3063 Fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=4547
3064 use int instead of long for 32-bit (to prepare for LP64 compiling)
3066 * bindings/c/c_class.h:
3067 (KJS::Bindings::CClass::constructorAt):
3068 (KJS::Bindings::CClass::numConstructors):
3069 * bindings/c/c_runtime.h:
3070 (KJS::Bindings::CMethod::numParameters):
3071 * bindings/jni/jni_class.cpp:
3072 (JavaClass::JavaClass):
3073 * bindings/jni/jni_class.h:
3074 (KJS::Bindings::JavaClass::constructorAt):
3075 (KJS::Bindings::JavaClass::numConstructors):
3076 * bindings/jni/jni_instance.cpp:
3077 (JavaInstance::invokeMethod):
3078 * bindings/jni/jni_jsobject.cpp:
3079 (JSObject::convertJObjectToValue):
3080 (JSObject::listFromJArray):
3081 * bindings/jni/jni_runtime.cpp:
3082 (JavaMethod::JavaMethod):
3083 * bindings/jni/jni_runtime.h:
3084 (KJS::Bindings::JavaConstructor::_commonCopy):
3085 (KJS::Bindings::JavaConstructor::parameterAt):
3086 (KJS::Bindings::JavaConstructor::numParameters):
3087 (KJS::Bindings::JavaMethod::_commonCopy):
3088 (KJS::Bindings::JavaMethod::parameterAt):
3089 (KJS::Bindings::JavaMethod::numParameters):
3091 * bindings/objc/WebScriptObject.mm:
3093 * bindings/objc/objc_class.h:
3094 (KJS::Bindings::ObjcClass::constructorAt):
3095 (KJS::Bindings::ObjcClass::numConstructors):
3096 * bindings/objc/objc_instance.h:
3097 * bindings/objc/objc_runtime.h:
3098 * bindings/objc/objc_runtime.mm:
3099 (ObjcMethod::numParameters):
3100 * bindings/runtime.h:
3103 * kjs/property_slot.h:
3104 (KJS::PropertySlot::setCustomIndex):
3105 (KJS::PropertySlot::index):
3106 (KJS::PropertySlot::):
3107 * kjs/regexp_object.cpp:
3108 (RegExpObjectImp::backrefGetter):
3109 (RegExpObjectImp::getOwnPropertySlot):
3110 * kjs/simple_number.h:
3111 (KJS::SimpleNumber::):
3112 (KJS::SimpleNumber::value):
3113 (KJS::SimpleNumber::fits):
3114 (KJS::SimpleNumber::integerFits):
3115 (KJS::SimpleNumber::make):
3116 * kjs/string_object.cpp:
3117 (substituteBackreferences):
3119 (KJS::UString::from):
3120 (KJS::UString::toUInt32):
3121 (KJS::UString::find):
3122 (KJS::UString::rfind):
3128 2005-09-11 Eric Seidel <eseidel@apple.com>
3130 No review requested, build fix affects only SVG.
3132 * JavaScriptCore.xcodeproj/project.pbxproj: Fixed JSC+SVG
3133 Fixed JavaScriptCore+SVG after PCRE 6.1 merger.
3134 http://bugzilla.opendarwin.org/show_bug.cgi?id=4932
3136 2005-09-10 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
3138 Reviewed and landed by Darin.
3140 * Makefile.vc: Added.
3141 * README-Win32.txt: Added.
3143 2005-09-10 Darin Adler <darin@apple.com>
3145 - fixed compilation for WebCore (another try)
3147 * kjs/simple_number.h: Added more "using" lines.
3149 2005-09-10 Darin Adler <darin@apple.com>
3151 - fixed compilation for WebCore
3153 * kjs/simple_number.h: Have to include <cmath> here to work around a bug in the GCC
3154 standard C++ library headers.
3156 2005-09-10 Darin Adler <darin@apple.com>
3158 Windows changes by Krzysztof Kowalczyk <kkowalczyk@gmail.com>.
3160 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4870
3161 win portability: fix IS_NEGATIVE_ZERO macro in simple_number.h
3163 * kjs/simple_number.h:
3164 (KJS::isNegativeZero): Added. Inline function. Has a case for Windows that
3165 uses _fpclass and a case for other platforms that uses signbit.
3166 (KJS::SimpleNumber::fits): Use inline isNegativeZero instead of macro IS_NEGATIVE_ZERO.
3168 * kjs/internal.cpp: Remove definition of now-unneeded negZero global.
3170 * kjs/value.cpp: Touched the file because Xcode didn't know it needed to
3173 - improved test engine
3175 * tests/mozilla/jsDriver.pl: Sort tests in numeric order instead of using
3176 a plain-ASCII sort; now test 33 will be after test 5 in any given set of
3179 2005-09-08 Darin Adler <darin@apple.com>
3181 - fixed overloaded versions of throwError so that they substitute *all*
3182 expected parameters into the message string -- some versions used to
3183 skip parameters, resulting in "%s" being printed in the error message.
3187 * kjs/nodes.h: Updated declarations to use "const &" and not to name parameters
3188 * kjs/nodes.cpp: (Node::throwError): Updated to match above and add one missing
3191 2005-09-08 Darin Adler <darin@apple.com>
3195 - updated to PCRE 6.1
3197 The original PCRE 6.1 sources are checked into the tree with the tag
3198 "pcre-6-1" for reference. What we're checking in right now is the original
3199 plus our changes to make it support UTF-16 and at least one other tweak
3200 (vertical tab considered whitespace). Our work to get our changes was
3201 done on "pcre-6-1-branch", with an anchor at "pcre-6-1-anchor" so you can
3202 see the evolution of the UTF-16 changes.
3204 Note also that there was one small change made here that's not on the branch
3207 * Info.plist: Updated the part of the copyright message that's about PCRE.
3209 * JavaScriptCore.xcodeproj/project.pbxproj: Added new PCRE source files,
3210 removed obsolete ones.
3212 * pcre/AUTHORS: Updated to PCRE 6.1. Includes credits for Apple's UTF-16
3213 changes, but not the credits for Google's C++ wrapper, since we don't include that.
3214 * pcre/COPYING: Updated to PCRE 6.1.
3215 * pcre/LICENCE: Ditto.
3216 * pcre/dftables.c: Ditto.
3217 * pcre/pcre-config.h: Ditto.
3218 * pcre/pcre.h: Ditto.
3220 * pcre/pcre_compile.c: Added for PCRE 6.1.
3221 * pcre/pcre_config.c: Ditto.
3222 * pcre/pcre_exec.c: Ditto.
3223 * pcre/pcre_fullinfo.c: Ditto.
3224 * pcre/pcre_get.c: Ditto.
3225 * pcre/pcre_globals.c: Ditto.
3226 * pcre/pcre_info.c: Ditto.
3227 * pcre/pcre_internal.h: Ditto.
3228 * pcre/pcre_maketables.c: Ditto.
3229 * pcre/pcre_ord2utf8.c: Ditto.
3230 * pcre/pcre_printint.c: Ditto.
3231 * pcre/pcre_refcount.c: Ditto.
3232 * pcre/pcre_study.c: Ditto.
3233 * pcre/pcre_tables.c: Ditto.
3234 * pcre/pcre_try_flipped.c: Ditto.
3235 * pcre/pcre_ucp_findchar.c: Ditto.
3236 * pcre/pcre_version.c: Ditto.
3237 * pcre/pcre_xclass.c: Ditto.
3238 * pcre/ucp.h: Ditto.
3239 * pcre/ucp_findchar.c: Ditto.
3240 * pcre/ucpinternal.h: Ditto.
3241 * pcre/ucptable.c: Ditto.
3243 * pcre/get.c: Removed.
3244 * pcre/internal.h: Removed.
3245 * pcre/maketables.c: Removed.
3246 * pcre/pcre.c: Removed.
3247 * pcre/study.c: Removed.
3249 2005-09-07 Geoffrey Garen <ggaren@apple.com>
3251 -fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4781
3252 Date.setMonth fails with big values due to overflow
3256 * kjs/date_object.cpp:
3257 (timetUsingCF): for consistency, changed return statement to invalidDate instead of LONG_MAX
3258 (KJS::fillStructuresUsingTimeArgs): modified for readability
3259 (KJS::fillStructuresUsingDateArgs): new function analogous to fillStructuresUsingTimeArgs
3260 (KJS::DateProtoFuncImp::callAsFunction): modified to use fillStructuresUsingDateArgs
3261 (KJS::DateObjectImp::construct): moved variable declaration to proper scope
3262 (KJS::DateObjectFuncImp::callAsFunction): moved variable declaration to proper scope
3264 2005-09-07 Geoffrey Garen <ggaren@apple.com>
3265 -updated expected test results to reflect fix for
3266 http://bugzilla.opendarwin.org/show_bug.cgi?id=4698
3267 kjs does not allow named functions in function expressions
3269 * tests/mozilla/expected.html:
3271 2005-09-04 Darin Adler <darin@apple.com>
3273 * kjs/identifier.cpp: Fix comment, add missing include.
3274 (Follow-on to changes from yesterday.)
3276 2005-09-03 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
3278 Reviewed, tweaked and landed by Darin.
3280 - another try at some of the Windows compilation fixes
3281 should fix these bugs: 4546, 4831, 4834, 4643, 4830, 4832, 4833, 4835
3283 * kjs/collector.cpp: Add missing <setjmp.h> include.
3284 * kjs/date_object.cpp: Fix broken copysign macro.
3285 * kjs/dtoa.cpp: Move macro definitions down after all header includes.
3286 * kjs/fast_malloc.cpp: Add missing <assert.h> and <stddef.h> includes.
3287 * kjs/function.cpp: Remove broken isxdigit definition.
3288 * kjs/grammar.y: Add a missing semicolon (and remove an excess one).
3289 * kjs/identifier.cpp: Turn off AVOID_STATIC_CONSTRUCTORS because the placement new syntax
3290 doesn't seem to work in Visual C++ (I'm surprised to hear that, by the way).
3291 * kjs/value.h: Made ValueImp's destructor virtual because otherwise pointers to ValueImp
3292 on the stack aren't right for garbage collection on Windows (don't think it works that
3293 way with gcc's virtual table scheme, but it's a harmless change).
3295 2005-09-03 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
3297 Reviewed, tweaked and landed by Darin.
3299 - some Windows compilation fixes, hoping to fix the problems reported in these bugs:
3300 4627, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4639, 4640, 4641, 4644, 4645
3302 * kjs/collector.cpp: Include <windows.h> on WIN32. Put thread-related code inside
3303 KJS_MULTIPLE_THREADS #if directives.
3304 (KJS::Collector::markCurrentThreadConservatively): Use NT_TIB to find the stack base on Win32.
3306 * kjs/config.h: Define HAVE_SYS_TIMEB_H for Win32.
3308 * kjs/date_object.cpp: Add include of <limits.h>. Add definitions of strncasecmp, isfinite, and
3310 (KJS::KRFCDate_parseDate): Move "errno = 0" line down closer to the first call to strol -- I believe
3311 that on Win32 there's some other call before that setting errno.
3313 * kjs/date_object.h: Remove unneeded include of <sys/time.h>.
3315 * kjs/dtoa.cpp: Add an undef of strtod, needed on Win32.
3317 * kjs/fast_malloc.cpp: Put #if !WIN32 around some customization that's not appropriate on Win32.
3318 (KJS::region_list_append): Add a missing cast so this Win32-specific function compiles in C++.
3319 (KJS::sbrk): Change parameter type to match the declaration.
3321 * kjs/function.cpp: (isxdigit): Define a locale-independent isxdigit on Win32.
3323 * kjs/function.h: Remove unneeded friend class Function for FunctionImp.
3325 * kjs/identifier.cpp: Took out the APPLE_CHANGES from around the AVOID_STATIC_CONSTRUCTORS
3326 define. We ultimately intend to phase out APPLE_CHANGES entirely. Also fix the
3327 non-AVOID_STATIC_CONSTRUCTORS code path.
3329 * kjs/internal.cpp: Remove uneeded include of <strings.h>, which was confused with <string.h>!
3330 Add a Win32 implementation of copysign. Put the threads code inside KJS_MULTIPLE_THREADS.
3332 * kjs/internal.h: Define a KJS_MULTIPLE_THREADS macro on non-Win32 only. Later we can make this
3333 specific to Mac OS X if we like.
3335 * kjs/interpreter_map.cpp: Add missing include of <stdlib.h>.
3338 (KJS::ListImp::markValues): Use std::min instead of MIN.
3339 (KJS::List::copy): Ditto.
3340 (KJS::List::copyTail): Ditto.
3342 * kjs/math_object.cpp: (signbit): Add a Win32 implementation of signbit.
3344 * kjs/nodes.cpp: (Node::finalCheck): Use unsigned instead of uint.
3345 Put the use of always_inline inside __GNUC__.
3347 * kjs/number_object.cpp: (NumberProtoFuncImp::callAsFunction): Use "10.0" instead of "10"
3348 inside all the calls to pow to avoid ambiguity caused by overloading of pow on Win32, seen
3349 when passing an int rather than a double or float.
3351 * kjs/operations.cpp:
3352 (KJS::isInf): Add Win32 implementation.
3353 (KJS::isPosInf): Add Win32 implementation.
3354 (KJS::isNegInf): Add Win32 implementation.
3356 * kjs/regexp.cpp: Use unsigned instead of uint.
3357 * kjs/regexp.h: Ditto.
3358 * kjs/regexp_object.cpp: Ditto.
3359 * kjs/regexp_object.h: Ditto.
3361 2005-09-02 Beth Dakin <bdakin@apple.com>
3363 Fix for <rdar://problem/4235531> Denver Regression: Safari crash in KWQStringData::makeUnicode
3364 The other half of the fix is in WebCore.
3366 Fix written by Maciej and Darin.
3367 Reviewed by me/Maciej
3369 As Maciej said in Radar: These problems was caused by a conflict between some of our custom
3370 allocators, causing them to return null. Symptom is typically a null pointer dereference in
3371 a place where it might be expected an allocation has just occurred.
3373 * kjs/fast_malloc.cpp: Added #define for MORECORE_CONTIGUOUS, MORECORE_CANNOT_TRIM,
3374 and MALLOC_FAILURE_ACTION.
3376 2005-08-31 Geoffrey Garen <ggaren@apple.com>
3378 -rolled in fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4698
3379 kjs does not allow named functions in function expressions
3381 Fix by Arthur Langereis.
3387 (FuncExprNode::evaluate):
3389 (KJS::FuncExprNode::FuncExprNode):
3393 * layout-tests/fast/js/named-function-expression-expected.txt: Added.
3394 * layout-tests/fast/js/named-function-expression.html: Added.
3396 2005-08-31 Justin Haygood <justin@xiondigital.net>
3398 Reviewed, tweaked, and landed by Darin.
3400 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4085
3401 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4087
3402 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4096
3403 Some fixes for compiling on windows.
3405 * kjs/config.h: Added a WIN32 case in here, with suitable defines.
3406 (To be tweaked as necessary.)
3407 * kjs/function.cpp: Took out APPLE_CHANGES around use of ICU.
3408 * kjs/operations.cpp: Removed some bogus code that always set HAVE_FLOAT_H.
3410 2005-08-30 Darin Adler <darin@apple.com>
3412 Reviewed by John Sullivan.
3414 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4758
3415 unify SharedPtr in WebCore and JavaScriptCore
3417 * kjs/shared_ptr.h: Updated namespace to KXMLCore instead of kxhmlcore.
3418 Made a few small improvements to use local variables a bit more and added
3419 an "operator int" to reduce the chance that we'll convert a SharedPtr to
3420 an int by accident. Also made the == operators normal functions rather than
3421 friend functions, added a couple of comemnts.
3423 * kjs/function.h: Updated for namespace change.
3424 * kjs/function.cpp: Ditto.
3425 * kjs/function_object.cpp: Ditto.
3426 * kjs/internal.h: Ditto.
3427 * kjs/internal.cpp: Ditto.
3428 * kjs/nodes.h: Ditto.
3429 * kjs/nodes2string.cpp: Ditto.
3431 2005-08-26 Maciej Stachowiak <mjs@apple.com>
3435 <rdar://problem/4224911> many many leaks in kjsyyparse with malformed Javascript
3437 Record all nodes that are created during parsing, and delete any
3438 that are left floating with a refcount of 0.
3441 (KJS::Parser::saveNewNode):
3442 (KJS::clearNewNodes):
3443 (KJS::Parser::parse):
3448 (KJS::Node::refcount):
3450 2005-08-26 Maciej Stachowiak <mjs@apple.com>
3454 - fixed <rdar://problem/4232452> many many leaks in kjsyyparse on some well-formed JavaScript (can repro on sony.com, webkit tests)
3456 Fixed by changing the refcounting scheme for nodes. Instead of each node implementing a custom ref and
3457 deref for all its children (and being responsible for deleting them), nodes use a smart pointer to
3458 hold their children, and smart pointers are used outside the node tree as well. This change mostly
3461 * JavaScriptCore.xcodeproj/project.pbxproj:
3463 (KJS::DeclaredFunctionImp::DeclaredFunctionImp):
3464 (KJS::GlobalFuncImp::callAsFunction):
3466 * kjs/function_object.cpp:
3467 (FunctionObjectImp::construct):
3470 (KJS::Parser::parse):
3471 (KJS::Parser::accept):
3472 (KJS::InterpreterImp::checkSyntax):
3473 (KJS::InterpreterImp::evaluate):
3478 (ElementNode::evaluate):
3479 (PropertyValueNode::evaluate):
3480 (ArgumentListNode::evaluateList):
3481 (NewExprNode::evaluate):
3482 (FunctionCallValueNode::evaluate):
3483 (FunctionCallBracketNode::evaluate):
3484 (FunctionCallDotNode::evaluate):
3485 (RelationalNode::evaluate):
3486 (StatListNode::execute):
3487 (StatListNode::processVarDecls):
3488 (VarDeclListNode::evaluate):
3489 (VarDeclListNode::processVarDecls):
3490 (ForInNode::ForInNode):
3491 (ClauseListNode::processVarDecls):
3492 (CaseBlockNode::evalBlock):
3493 (FuncDeclNode::processFuncDecl):
3494 (FuncExprNode::evaluate):
3495 (SourceElementsNode::execute):
3496 (SourceElementsNode::processFuncDecl):
3497 (SourceElementsNode::processVarDecls):
3501 (KJS::NumberNode::NumberNode):
3502 (KJS::GroupNode::GroupNode):
3503 (KJS::ElementNode::ElementNode):
3504 (KJS::ArrayNode::ArrayNode):
3505 (KJS::PropertyValueNode::PropertyValueNode):
3506 (KJS::ObjectLiteralNode::ObjectLiteralNode):
3507 (KJS::BracketAccessorNode::BracketAccessorNode):
3508 (KJS::DotAccessorNode::DotAccessorNode):
3509 (KJS::ArgumentListNode::ArgumentListNode):
3510 (KJS::ArgumentsNode::ArgumentsNode):
3511 (KJS::NewExprNode::NewExprNode):
3512 (KJS::FunctionCallValueNode::FunctionCallValueNode):
3513 (KJS::FunctionCallResolveNode::FunctionCallResolveNode):
3514 (KJS::FunctionCallBracketNode::FunctionCallBracketNode):
3515 (KJS::FunctionCallDotNode::FunctionCallDotNode):
3516 (KJS::PostfixNode::PostfixNode):
3517 (KJS::DeleteNode::DeleteNode):
3518 (KJS::VoidNode::VoidNode):
3519 (KJS::TypeOfNode::TypeOfNode):
3520 (KJS::PrefixNode::PrefixNode):
3521 (KJS::UnaryPlusNode::UnaryPlusNode):
3522 (KJS::NegateNode::NegateNode):
3523 (KJS::BitwiseNotNode::BitwiseNotNode):
3524 (KJS::LogicalNotNode::LogicalNotNode):
3525 (KJS::MultNode::MultNode):
3526 (KJS::AddNode::AddNode):
3527 (KJS::ShiftNode::ShiftNode):
3528 (KJS::RelationalNode::RelationalNode):
3529 (KJS::EqualNode::EqualNode):
3530 (KJS::BitOperNode::BitOperNode):
3531 (KJS::BinaryLogicalNode::BinaryLogicalNode):
3532 (KJS::ConditionalNode::ConditionalNode):
3533 (KJS::AssignResolveNode::AssignResolveNode):
3534 (KJS::AssignBracketNode::AssignBracketNode):
3535 (KJS::AssignDotNode::AssignDotNode):
3536 (KJS::CommaNode::CommaNode):
3537 (KJS::AssignExprNode::AssignExprNode):
3538 (KJS::VarDeclListNode::VarDeclListNode):
3539 (KJS::VarStatementNode::VarStatementNode):
3540 (KJS::ExprStatementNode::ExprStatementNode):
3541 (KJS::IfNode::IfNode):
3542 (KJS::DoWhileNode::DoWhileNode):
3543 (KJS::WhileNode::WhileNode):
3544 (KJS::ForNode::ForNode):
3545 (KJS::ReturnNode::ReturnNode):
3546 (KJS::WithNode::WithNode):
3547 (KJS::CaseClauseNode::CaseClauseNode):
3548 (KJS::ClauseListNode::ClauseListNode):
3549 (KJS::ClauseListNode::clause):
3550 (KJS::ClauseListNode::next):
3551 (KJS::SwitchNode::SwitchNode):
3552 (KJS::LabelNode::LabelNode):
3553 (KJS::ThrowNode::ThrowNode):
3554 (KJS::CatchNode::CatchNode):
3555 (KJS::FinallyNode::FinallyNode):
3556 (KJS::TryNode::TryNode):
3557 (KJS::ParameterNode::ParameterNode):
3558 (KJS::ParameterNode::nextParam):
3559 (KJS::FuncDeclNode::FuncDeclNode):
3560 (KJS::FuncExprNode::FuncExprNode):
3561 * kjs/nodes2string.cpp:
3562 (KJS::SourceStream::operator<<):
3563 (ElementNode::streamTo):
3564 (PropertyValueNode::streamTo):
3565 (ArgumentListNode::streamTo):
3566 (StatListNode::streamTo):
3567 (VarDeclListNode::streamTo):
3568 (CaseBlockNode::streamTo):
3569 (ParameterNode::streamTo):
3570 (SourceElementsNode::streamTo):
3571 * kjs/shared_ptr.h: Added.
3572 (kxmlcore::SharedPtr::SharedPtr):
3573 (kxmlcore::SharedPtr::~SharedPtr):
3574 (kxmlcore::SharedPtr::isNull):
3575 (kxmlcore::SharedPtr::notNull):
3576 (kxmlcore::SharedPtr::reset):
3577 (kxmlcore::SharedPtr::get):
3578 (kxmlcore::SharedPtr::operator*):
3579 (kxmlcore::SharedPtr::operator->):
3580 (kxmlcore::SharedPtr::operator!):
3581 (kxmlcore::SharedPtr::operator bool):
3582 (kxmlcore::SharedPtr::operator==):
3583 (kxmlcore::::operator):
3584 (kxmlcore::operator!=):
3585 (kxmlcore::static_pointer_cast):
3586 (kxmlcore::const_pointer_cast):
3588 2005-08-26 Geoff Garen <ggaren@apple.com>
3593 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4664
3594 TOT Crash from backwards null check in WebScriptObject.mm
3596 * bindings/objc/WebScriptObject.mm:
3597 (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
3600 2005-08-25 Darin Adler <darin@apple.com>
3602 Reviewed by John Sullivan.
3604 - rename KJS::UString::string() to KJS::UString::domString()
3605 - rename KJS::Identifier::string() to KJS::Identifier::domString()
3607 * kjs/identifier.h: Renamed.
3608 * kjs/ustring.h: Ditto.
3610 2005-08-19 Darin Adler <darin@apple.com>
3614 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4435
3615 speed up JavaScript by tweaking the Identifier class
3617 * kjs/identifier.h: Add a new global nullIdentifier and make Identifier::null a function
3619 * kjs/identifier.cpp: (KJS::Identifier::init): Initialize a global for the null identifier
3620 as well as all the other globals for special identifiers.
3622 * kjs/ustring.h: (KJS::UString::UString): Make this empty constructor inline.
3623 * kjs/ustring.cpp: Remove the old non-inline version.
3625 2005-08-19 Mitz Pettel <opendarwin.org@mitzpettel.com>
3628 Revised and landed by Darin.
3630 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4474
3631 REGRESSION: Crash when using in-place operator on uninitialized array element
3634 (AssignResolveNode::evaluate): Remove unneeded "isSet" assertion.
3635 (AssignBracketNode::evaluate): Replace code that tested "isSet" with code that
3636 tests the return value of getPropertySlot.
3638 * kjs/property_slot.h: Removed unneeded "isSet" function. Property slots are
3639 either uninitialized or set. There's no "initialized and not set" state.
3641 2005-08-18 Adele Peterson <adele@apple.com>
3643 Checked "Inline Functions Hidden" box
3645 * JavaScriptCore.xcodeproj/project.pbxproj:
3647 2005-08-16 Darin Adler <darin@apple.com>
3651 - fixed crash in one of the JavaScript tests (introduced by my throwError change)
3653 * kjs/nodes.cpp: (Node::setExceptionDetailsIfNeeded): Check if the exception is an
3654 object before setting the file and line number properties on it. Something to think
3655 about in the future -- do we really want to do this on any object that's thrown?
3656 How about limiting it to error objects that were created by the JavaScript engine?
3658 - changed kjs_fast_malloc so we don't have two conflicting versions of the same function
3660 * kjs/fast_malloc.h: Took out all the ifdefs from this header.
3661 * kjs/fast_malloc.cpp: Added non-NDEBUG versions of the functions that just call
3662 the system malloc, and put the NDEBUG versions in an #else.
3664 2005-08-16 Darin Adler <darin@apple.com>
3668 - clean up exported symbols that are not in a "KJS" namespace
3670 * bindings/NP_jsobject.cpp: (identiferFromNPIdentifier): Marked this function static
3671 so it no longer has external linkage.
3672 * bindings/c/c_utility.h: Put all this stuff inside the KJS namespace.
3673 * bindings/c/c_utility.cpp: Also marked some globals static so they don't have external
3674 linkage; not as important given the namespace.
3675 * bindings/npruntime.cpp: Marked functions static so they no longer have internal linkage.
3676 Also removed unused _NPN_SetExceptionWithUTF8 function (not in header, had C++ linkage!).
3678 * bindings/jni/jni_utility.cpp: (KJS::Bindings::getJavaVM): Call KJS_GetCreatedJavaVMs
3679 using the soft linking header, instead of calling the JNI call. This allows processes
3680 to link both JavaScriptCore and JavaVM without a symbol conflict.
3681 * bindings/softlinking.c:
3682 (loadFramework): Marked this function static so it no longer has external linkage.
3683 (getFunctionPointer): Ditto.
3684 (KJS_GetCreatedJavaVMs): Renamed this so it has a KJS prefix.
3686 * JavaScriptCore.xcodeproj/project.pbxproj: Added softlinking.h.
3687 * bindings/softlinking.h: Added.
3689 * kjs/nodes2string.cpp: (streamAssignmentOperatorTo): Marked this function static so it
3690 no longer has external linkage.
3692 2005-08-15 Darin Adler <darin@apple.com>
3696 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4437
3697 clean up error creation with new throwError function
3699 * bindings/NP_jsobject.cpp:
3700 (_NPN_SetException):
3701 * bindings/jni/jni_instance.cpp:
3702 (JavaInstance::invokeMethod):
3703 * bindings/jni/jni_runtime.cpp:
3704 (JavaField::dispatchValueFromInstance):
3705 (JavaField::dispatchSetValueToInstance):
3706 * bindings/objc/WebScriptObject.mm:
3707 (-[WebScriptObject _initializeWithObjectImp:originExecutionContext:executionContext:]):
3708 (-[WebScriptObject _initWithObjectImp:originExecutionContext:executionContext:]):
3709 (+[WebScriptObject throwException:]):
3710 (-[WebScriptObject setException:]):
3711 (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
3712 * bindings/objc/objc_class.h:
3713 (KJS::Bindings::ObjcClass::~ObjcClass):
3714 (KJS::Bindings::ObjcClass::ObjcClass):
3715 (KJS::Bindings::ObjcClass::operator=):
3716 (KJS::Bindings::ObjcClass::constructorAt):
3717 (KJS::Bindings::ObjcClass::numConstructors):
3718 * bindings/objc/objc_header.h:
3719 * bindings/objc/objc_runtime.h:
3720 (KJS::Bindings::ObjcField::~ObjcField):
3721 (KJS::Bindings::ObjcField::ObjcField):
3722 (KJS::Bindings::ObjcField::operator=):
3723 (KJS::Bindings::ObjcMethod::ObjcMethod):
3724 (KJS::Bindings::ObjcMethod::~ObjcMethod):
3725 (KJS::Bindings::ObjcMethod::operator=):
3726 * bindings/objc/objc_runtime.mm:
3727 (ObjcField::valueFromInstance):
3728 (ObjcField::setValueToInstance):
3729 (ObjcArray::setValueAt):
3730 (ObjcArray::valueAt):
3731 * bindings/objc/objc_utility.h:
3732 * bindings/objc/objc_utility.mm:
3733 (KJS::Bindings::JSMethodNameToObjCMethodName):
3734 (KJS::Bindings::convertValueToObjcValue):
3735 (KJS::Bindings::convertNSStringToString):
3736 (KJS::Bindings::convertObjcValueToValue):
3737 (KJS::Bindings::objcValueTypeForType):
3738 (KJS::Bindings::createObjcInstanceForValue):
3739 (KJS::Bindings::throwError):
3740 * bindings/runtime.h:
3741 (KJS::Bindings::Parameter::~Parameter):
3742 (KJS::Bindings::Method::~Method):
3743 (KJS::Bindings::Instance::Instance):
3744 (KJS::Bindings::Instance::begin):
3745 (KJS::Bindings::Instance::end):
3746 (KJS::Bindings::Instance::getValueOfUndefinedField):
3747 (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
3748 (KJS::Bindings::Instance::setValueOfUndefinedField):
3749 (KJS::Bindings::Instance::valueOf):
3750 * bindings/runtime_array.cpp:
3751 (RuntimeArrayImp::put):
3752 * bindings/runtime_object.h:
3753 (KJS::RuntimeObjectImp::setInternalInstance):
3754 (KJS::RuntimeObjectImp::getInternalInstance):
3755 * kjs/array_object.cpp:
3757 (ArrayProtoFuncImp::callAsFunction):
3758 (ArrayObjectImp::construct):
3759 * kjs/bool_object.cpp:
3760 (BooleanProtoFuncImp::callAsFunction):
3761 * kjs/date_object.cpp:
3762 (KJS::DateProtoFuncImp::callAsFunction):
3765 (KJS::GlobalFuncImp::callAsFunction):
3766 * kjs/function_object.cpp:
3767 (FunctionProtoFuncImp::callAsFunction):
3768 (FunctionObjectImp::construct):
3770 (KJS::UndefinedImp::toObject):
3771 (KJS::NullImp::toObject):
3772 (KJS::InterpreterImp::evaluate):
3773 (KJS::InternalFunctionImp::hasInstance):
3777 (Node::setExceptionDetailsIfNeeded):
3778 (undefinedVariableError):
3779 (ProgramNode::ProgramNode):
3780 * kjs/number_object.cpp:
3781 (NumberProtoFuncImp::callAsFunction):
3783 (KJS::ObjectImp::call):
3784 (KJS::ObjectImp::defaultValue):
3785 (KJS::Error::create):
3788 (KJS::ObjectImp::clearProperties):
3789 (KJS::ObjectImp::getPropertySlot):
3790 (KJS::ObjectImp::getOwnPropertySlot):
3791 * kjs/object_object.cpp:
3792 (ObjectProtoFuncImp::callAsFunction):
3793 * kjs/reference.cpp:
3794 (KJS::Reference::getBase):
3795 (KJS::Reference::getValue):
3796 (KJS::Reference::putValue):
3797 (KJS::Reference::deleteValue):
3798 * kjs/regexp_object.cpp:
3799 (RegExpProtoFuncImp::callAsFunction):
3800 (RegExpObjectImp::construct):
3801 * kjs/string_object.cpp:
3802 (StringProtoFuncImp::callAsFunction):
3804 2005-08-15 Anders Carlsson <andersca@mac.com>
3808 * tests/mozilla/ecma_3/Date/15.9.5.5.js:
3809 Remove the code which tests that Date.toLocaleString should be parsable
3810 by Date.parse. That is not true according to the spec.
3812 2005-08-15 Darin Adler <darin@apple.com>
3816 * kjs/collector.cpp: (KJS::Collector::allocate): Use a local instead of a global in one
3817 more place; slight speedup.
3819 2005-08-14 Darin Adler <darin@apple.com>
3823 - fixed crash observed on one of the Apple-only layout tests
3825 * kjs/property_map.cpp: (KJS::PropertyMap::mark): Change code to understand that deleted
3826 entries have a value of NULL, so the deleted sentinel count doesn't need to be included
3827 in the count of things to mark since we're ignoring the keys.
3829 2005-08-14 Darin Adler <darin@apple.com>
3833 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4421
3834 speed up JavaScript by inlining some label stack functions
3836 * kjs/internal.h: Removed the copy constructor and assignment operator for LabelStack.
3837 They were unused, and the implementations had bugs; I removed them rather than fixing them.
3838 Also removed the clear function, since that was only needed to help the assignment operator
3839 share code with the destructor, and was not efficient enough for the destructor.
3840 (KJS::LabelStack::~LabelStack): Made this inline. Also used an efficient implementation
3841 that's nice and fast when the stack is empty, better than the old clear() function which
3842 used to keep updating and refetching "tos" each time through the loop.
3843 (KJS::LabelStack::pop): Made this inline.
3845 * kjs/internal.cpp: Deleted the now-inline functions and the obsolete functions. Also
3846 deleted a commented-out line of code.
3848 2005-08-14 Darin Adler <darin@apple.com>
3852 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4419
3853 speed up JavaScript by improving KJS::List
3855 my measurements show an improvement of 1% on iBench JavaScript
3857 * kjs/list.cpp: Rearrange list to make the values and free list share the same storage,
3858 which saves 4 bytes per list. Also remove the pointers used only on the heap from the
3859 lists that are in the pool, which saves 8 bytes per list. Moving the free list pointer
3860 closer to the start of the list object also speeds up access to the free list. New
3861 "HeapListImp" struct is used only for the lists on the heap.
3862 (KJS::List::markProtectedLists): Shadowed global variable in local and updated for the
3863 new terminology ("heap" instead of "outside pool").
3864 (KJS::allocateListImp): Updated for new terminology.
3865 (KJS::List::release): Moved the code from deallocateListImp in here -- it wasn't being
3866 inlined and didn't need to be in a separate function.
3868 2005-08-14 Darin Adler <darin@apple.com>
3872 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4417
3873 speed up JavaScript with some small changes to the property map code
3875 my measurements show an improvement of 2% on iBench JavaScript
3877 * kjs/property_map.h: (KJS::PropertyMap::PropertyMap): Made the default constructor inline.
3878 * kjs/property_map.cpp:
3879 (KJS::PropertyMap::~PropertyMap): Changed loop to exit early once we know we've processed
3880 all the hash table entries, based on the count.
3881 (KJS::PropertyMap::mark): Ditto.
3883 * kjs/object.h: Made an arbitrary change here to force recompiling so we pick up changes to
3884 property_map.h. Works around what seems to be an Xcode header dependency bug.
3886 2005-08-14 Darin Adler <darin@apple.com>
3890 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4416
3891 speed up JavaScript with some improvements to the garbage collector
3893 my measurements show an improvement of 2% on iBench JavaScript
3895 * kjs/collector.cpp:
3896 (KJS::Collector::allocate): Use local variables to shadow globals instead of repeatedly
3897 going at global variables. Tighten up loop implementations to make the common case fast.
3898 (KJS::Collector::markStackObjectsConservatively): Use local variables to shadow globals.
3899 Used a goto to eliminate a boolean since it was showing up in the profile.
3900 (KJS::Collector::markProtectedObjects): Iterate through the table using pointer rather
3901 than an index since the profile showed that generating better code.
3902 (KJS::Collector::collect): Added a special case for blocks where all cells are used,
3903 Use local variables to shadow globals. Eliminated a boolean by computing it another
3904 way (checking to see if the number of live objects changed). Also used local variables
3905 to shadow fields in the current cell when sweeping.
3906 (KJS::Collector::numReferencedObjects): Use AllocatedValueImp instead of ValueImp
3907 in one place -- means we get faster versions of various functions that don't worry
3909 (KJS::className): Ditto.
3910 (KJS::Collector::rootObjectClasses): Ditto.
3912 2005-08-14 Darin Adler <darin@apple.com>
3914 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4344
3915 REGRESSION: JavaScript crash when going back from viewing a thread (NULL protoype)
3917 * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set proto in a more
3918 straightforward way. The old code set the proto to 0 and then to the correct value.
3919 This showed up as a "false positive" when searching for places that set prototype
3920 to NULL/0 so I fixed it.
3922 * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Change to
3923 not pass an explicit "0" to the base class (InternalFunctionImp) constructor.
3925 * kjs/internal.h: Added a default constructor for InternalFunctionImp.
3926 * kjs/internal.cpp: (KJS::InternalFunctionImp::InternalFunctionImp): Added the
3927 default constructor (empty body, just calls base class's default constructor).
3930 (KJS::ObjectImp::ObjectImp): Add an assertion to catch NULL prototypes earlier
3931 in Development builds.
3932 (KJS::ObjectImp::setPrototype): Ditto.
3934 2005-08-12 Maciej Stachowiak <mjs@apple.com>
3938 - two simple speed improvements for a 3% speed gain
3940 * JavaScriptCore.xcodeproj/project.pbxproj: turn on -fstrict-aliasing
3942 * kjs/scope_chain.h:
3943 (KJS::ScopeChainIterator::ScopeChainIterator): Add a scope chain iterator
3944 so you can walk a scope chain without having to make a copy that you then mutate.
3945 (KJS::ScopeChainIterator::operator*): standard iterator operation
3946 (KJS::ScopeChainIterator::operator->): ditto
3947 (KJS::ScopeChainIterator::operator++): ditto
3948 (KJS::ScopeChainIterator::operator==): ditto
3949 (KJS::ScopeChainIterator::operator!=): ditto
3950 (KJS::ScopeChain::begin): Iterator for the top of the scope chain
3951 (KJS::ScopeChain::end): Iterator for one past the bottom (i.e. null)
3953 (ResolveNode::evaluate): Use scope chain iterator instead of copying
3954 a scope chain and then modifying the copy
3955 (ResolveNode::evaluateReference): ditto
3956 (FunctionCallResolveNode::evaluate): ditto
3957 (AssignResolveNode::evaluate): ditto
3959 2005-08-12 Maciej Stachowiak <mjs@apple.com>
3961 Patch from Anders Carlsson, reviewed by me.
3963 * kjs/nodes.h: Fix build breakage.
3965 2005-08-12 Maciej Stachowiak <mjs@apple.com>
3969 - refactor function calls, 3% speedup on JS iBench.
3973 (Node::throwError): Added new useful variants.
3974 (FunctionCallValueNode::evaluate): New node to handle calls on expressions
3975 that are strictly values, not references.
3976 (FunctionCallValueNode::ref): ditto
3977 (FunctionCallValueNode::deref): ditto
3978 (FunctionCallResolveNode::evaluate): New node to handle calls on identifier
3979 expressions, so that they are looked up in the scope chain.
3980 (FunctionCallResolveNode::ref): ditto
3981 (FunctionCallResolveNode::deref): ditto
3982 (FunctionCallBracketNode::evaluate): New node to handle calls on bracket
3983 dereferences, so that the expression before brackets is used as the this
3985 (FunctionCallBracketNode::ref): ditto
3986 (FunctionCallBracketNode::deref): ditto
3987 (FunctionCallDotNode::evaluate): New node to handle calls on dot
3988 dereferences, so that the expression before the dot is used as the this
3990 (FunctionCallDotNode::ref): ditto
3991 (FunctionCallDotNode::deref): ditto
3992 (dotExprNotAnObjectString): helper function to avoid global variable access.
3993 (dotExprDoesNotAllowCallsString): ditto
3994 * kjs/nodes.h: Declared new classes.
3995 * kjs/nodes2string.cpp:
3996 (FunctionCallValueNode::streamTo): Added - serializes the appropriate function call
3997 (FunctionCallResolveNode::streamTo): ditto
3998 (FunctionCallBracketNode::streamTo): ditto
3999 (FunctionCallParenBracketNode::streamTo): ditto
4000 (FunctionCallDotNode::streamTo): ditto
4001 (FunctionCallParenDotNode::streamTo): ditto
4003 (KJS::ObjectImp::isActivation): Change how activation objects are
4004 detected in the scope chain, a virtual function is cheaper than the
4005 old inheritance test.
4007 (KJS::ActivationImp::isActivation): Ditto.
4009 2005-08-11 Maciej Stachowiak <mjs@apple.com>
4011 - added missing file from earlier checkin
4013 * kjs/grammar_types.h: Added.
4014 (KJS::makeNodePair):
4015 (KJS::makeNodeWithIdent):
4017 2005-08-11 Maciej Stachowiak <mjs@apple.com>
4021 * kjs/date_object.cpp:
4022 (timetUsingCF): Fix one of the date tests my making the CF version of mktime
4023 have the same quirk about the DST field as the real mktime.
4024 * tests/mozilla/expected.html: Updated for newly fixed test.
4026 2005-08-11 Maciej Stachowiak <mjs@apple.com>
4028 - updated for one of the tests that Darin incidentally fixed.
4030 * tests/mozilla/expected.html:
4032 2005-08-10 Maciej Stachowiak <mjs@apple.com>
4036 Refactor assignment grammar to avoid Reference type, and to later
4037 be able to take advantage of writeable PropertySlots, when those
4038 are added. I also fixed a minor bug, turning a function to a
4039 string lost parentheses, I made sure they are printed at least
4040 where semantically significant.
4042 Test cases: see WebCore
4044 * kjs/grammar.y: Change grammar so that assignment expressions are parsed
4045 directly to nodes that know how to set the kind of location being assigned, instead
4046 of having a generic assign node that counts on evaluateReference.
4047 * kjs/lexer.cpp: Include grammar_types.h.
4049 (BracketAccessorNode): Renamed from AccessorNode1 for clarity.
4050 (DotAccessorNode): Renamed from AccessorNode2 for clarity.
4051 (combineForAssignment): Inline function for doing the proper kind of
4052 operation for various update assignments like += or *=.
4053 (AssignResolveNode): Node that handles assignment to a bare identifier.
4054 (AssignDotNode): Node that handles assignments of the form EXPR . IDENT = EXPR
4055 (AssignBracketNode): EXPR [ IDENT ] = EXPR
4056 * kjs/nodes.h: Updated for declarations/renames of new classes.
4057 * kjs/nodes2string.cpp:
4058 (GroupNode::streamTo): Fixed to print parens around the expression.
4059 (BracketAccessorNode::streamTo): Renamed.
4060 (DotAccessorNode::streamTo): Renamed.
4061 (AssignResolveNode::streamTo): Added.
4062 (AssignBracketNode::streamTo): Added.
4063 (AssignDotNode::streamTo): Added.
4064 (streamAssignmentOperatorTo): helper function for the above
4065 * kjs/property_slot.h:
4066 (KJS::PropertySlot::isSet): Made this const.
4068 2005-08-10 Adele Peterson <adele@apple.com>
4070 Bumping version to 420+
4074 2005-08-10 Geoffrey Garen <ggaren@apple.com>
4076 -fixed <rdar://problem/4151132> REGRESSION: Some applet liveconnect calls
4077 throws privilege exception.
4079 Reviewed by richard and mjs.
4081 -I removed the global static JavaClass cache, since it violated Java
4082 security to cache classes between websites and applets.
4084 * bindings/jni/jni_class.cpp:
4085 -removed global static cache dictionary
4086 -instance constructor and destructor now do the work that used to
4087 be done by static factory methods
4088 -removed obsolete functions
4089 (JavaClass::JavaClass):
4090 (JavaClass::~JavaClass):
4091 * bindings/jni/jni_class.h: