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=5308
6 Number.toFixed doesn't include leading 0
8 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
9 Fixed a "<" that should have been a "<=".
11 2006-01-11 Ricci Adams <ricciadams@apple.com>
13 Reviewed by Geoff, landed by Darin.
15 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5307
16 Number.toFixed doesn't round 0.5 up
18 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
19 Fixed a ">" that should have been a ">=".
21 2006-01-11 Justin Haygood <justin@xiondigital.net>
23 Reviewed and landed by Darin.
25 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6486
26 JavaScriptCore should use system malloc on Windows
28 * kjs/config.h: Add USE_SYSTEM_MALLOC to the Win32 section.
30 2006-01-10 Darin Adler <darin@apple.com>
32 * Makefile: Took out unneeded "export" line.
33 * <many-files>: Changed a lot of flags (cleared bogus executable bits, set
34 MIME types, other small corrections).
36 2006-01-09 Darin Adler <darin@apple.com>
38 * Makefile.am: Removed.
40 2006-01-07 Anders Carlsson <andersca@mac.com>
44 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6373
45 REGRESSION: JavaScript hang when comparing large array to null
48 (KJS::JSObject::isEqualToNull):
49 Add new function which returns true if an object should be treated as null when
56 2006-01-07 Alexey Proskuryakov <ap@nypop.com>
60 - Fix WebCore development build
61 http://bugzilla.opendarwin.org/show_bug.cgi?id=6408
63 * kxmlcore/Assertions.h: Use __VA_ARGS__ in variadic macros.
65 2006-01-06 Maciej Stachowiak <mjs@apple.com>
69 - miscellaneous changes for 4% speedup on the JavaScript iBench
70 http://bugzilla.opendarwin.org/show_bug.cgi?id=6396
72 Changes mostly thanks to Maks Orlovich, tweaked a little by me.
74 * kjs/create_hash_table: Use the same hash as the one used by Identifier.
76 (KJS::FunctionImp::processParameters): Use the new List::copyFrom
77 (KJS::ActivationImp::ActivationImp): track variable while iterating
79 (KJS::StringImp::toObject): create StringInstance directly
81 (KJS::List::copy): implement in terms of copyFrom
82 (KJS::List::copyFrom): more efficient way to copy in another list
85 (keysMatch): updated to work with identifier hash
87 (Lookup::findEntry): ditto
91 2006-01-06 Maciej Stachowiak <mjs@apple.com>
93 - fix development build failure from the previous checkin
96 (KJS::ActivationImp::put): Use prototype() accessor in assert.
98 2006-01-05 Maciej Stachowiak <mjs@apple.com>
102 - fix remaining performance regression from Getter/Setter change
103 http://bugzilla.opendarwin.org/show_bug.cgi?id=6249
105 - Activation objects should not have __proto__ property
106 http://bugzilla.opendarwin.org/show_bug.cgi?id=6395
109 (KJS::ActivationImp::getOwnPropertySlot): Implement directly, thus
110 skipping getter/setter handling and __proto__ handling, as well
111 as inlining needed superclass stuff.
112 (KJS::ActivationImp::put): Implement directly, skipping getter/setter,
113 __proto__, and do canPut directly in PropertyMap::put since there's no
114 static property table either.
116 * kjs/property_map.cpp:
117 (KJS::PropertyMap::put): Allow optionally inlining canPut check.
118 * kjs/property_map.h:
120 2006-01-04 Geoffrey Garen <ggaren@apple.com>
122 Patch by kimmo.t.kinnunen@nokia.com, reviewed by darin, tweaked by me.
124 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4921
125 \u escape sequences in JavaScript identifiers
127 * kjs/function_object.cpp:
128 (FunctionObjectImp::construct):
132 (Lexer::isWhiteSpace):
133 (Lexer::isLineTerminator):
134 (Lexer::isIdentStart):
135 (Lexer::isIdentPart):
141 * tests/mozilla/expected.html: Updated test results.
143 2005-12-30 Maciej Stachowiak <mjs@apple.com>
145 No review, just test result update.
147 * tests/mozilla/expected.html: Updated for newly passing test from recent fixes.
149 2005-12-30 Anders Carlsson <andersca@mac.com>
153 - Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6298
154 Getter setter test is failing
157 (KJS::JSObject::put):
158 Rework the getter setter part. We now walk the prototype chain, checking for
159 getter/setter properties and only take the slow path if any are found.
161 2005-12-30 Maks Orlovich <maksim@kde.org>
163 Reviewed and committed by Maciej.
165 - Handle negative, FP numbers with non-10 radix in toString
166 http://bugzilla.opendarwin.org/show_bug.cgi?id=6259
168 (Merged from KJS, original work by Harri Porten)
170 * kjs/number_object.cpp:
171 (NumberProtoFunc::callAsFunction): rewrote Number.toString(radix) to work with
172 negative numbers, floating point and very large numbers.
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=6267
179 Fix Number.prototype.toFixed/toExponential(undefined)
181 * kjs/number_object.cpp:
182 (NumberProtoFunc::callAsFunction):
184 2005-12-29 Geoffrey Garen <ggaren@apple.com>
186 Patch by Maks Orlovich, Reviewed and landed by me.
188 - http://bugzilla.opendarwin.org/show_bug.cgi?id=6266
189 Minor object naming updates (to match Mozilla, KJS)
191 * kjs/number_object.cpp:
192 * kjs/regexp_object.cpp:
194 2005-12-29 Geoffrey Garen <ggaren@apple.com>
196 Patch by Maks Orlovich, reviewed by mjs.
198 This has 2 very minor fixes, covered by KJS testsuite:
199 1. Enumerates string indices in property list (with the same bug as array
200 object has in corresponding code). This is a mozilla emulation thing.
201 2. Permits properties with integer names in prototypes to be found
203 * kjs/string_object.cpp:
204 (StringInstance::getOwnPropertySlot):
205 (StringInstanceImp::propList):
206 * kjs/string_object.h:
208 2005-12-26 Geoffrey Garen <ggaren@apple.com>
212 - Fixed <rdar://problem/4364705> run-javascriptcore-tests crashes in
213 KJS::BlockNode::deref
215 http://bugzilla.opendarwin.org/show_bug.cgi?id=6233
216 Reproducible stack-overflow crash in ~RefPtr<T> due to RefPtr<T> use in
219 This patch does four things:
220 (1) Standardizes all our linked list nodes to use "next" as their next
222 (2) Creates the ListRefPtr<T> class, a subclass of RefPtr<T> specialized
223 to iteratively deref "next" pointers.
224 (3) Standardizes our linked list nodes to use ListRefPtr<T> and
225 implement the releaseNext() function used by ~ListRefPtr<T>().
226 (4) Adds to RefPtr<T> the release() method used by releaseNext().
228 - Modified existing mozilla test to ensure it would make deployment
229 builds crash as well.
231 * JavaScriptCore.xcodeproj/project.pbxproj:
233 (ElementNode::evaluate):
234 (PropertyListNode::evaluate):
235 (ArgumentListNode::evaluateList):
236 (StatListNode::StatListNode):
237 (StatListNode::execute):
238 (StatListNode::processVarDecls):
239 (VarDeclListNode::evaluate):
240 (VarDeclListNode::processVarDecls):
241 (VarStatementNode::execute):
242 (VarStatementNode::processVarDecls):
243 (BlockNode::BlockNode):
244 (CaseClauseNode::evalStatements):
245 (CaseClauseNode::processVarDecls):
246 (ClauseListNode::processVarDecls):
247 (CaseBlockNode::CaseBlockNode):
248 (CaseBlockNode::evalBlock):
249 (SourceElementsNode::SourceElementsNode):
250 (SourceElementsNode::execute):
251 (SourceElementsNode::processFuncDecl):
252 (SourceElementsNode::processVarDecls):
254 (KJS::ElementNode::ElementNode):
255 (KJS::ElementNode::releaseNext):
256 (KJS::ArrayNode::ArrayNode):
257 (KJS::PropertyListNode::PropertyListNode):
258 (KJS::PropertyListNode::releaseNext):
259 (KJS::ObjectLiteralNode::ObjectLiteralNode):
260 (KJS::ArgumentListNode::ArgumentListNode):
261 (KJS::ArgumentListNode::releaseNext):
262 (KJS::ArgumentsNode::ArgumentsNode):
263 (KJS::StatListNode::releaseNext):
264 (KJS::VarDeclListNode::VarDeclListNode):
265 (KJS::VarDeclListNode::releaseNext):
266 (KJS::VarStatementNode::VarStatementNode):
267 (KJS::ForNode::ForNode):
268 (KJS::CaseClauseNode::CaseClauseNode):
269 (KJS::ClauseListNode::ClauseListNode):
270 (KJS::ClauseListNode::getClause):
271 (KJS::ClauseListNode::getNext):
272 (KJS::ClauseListNode::releaseNext):
273 (KJS::ParameterNode::ParameterNode):
274 (KJS::ParameterNode::releaseNext):
275 (KJS::SourceElementsNode::releaseNext):
276 * kjs/nodes2string.cpp:
277 (ElementNode::streamTo):
278 (PropertyListNode::streamTo):
279 (ArgumentListNode::streamTo):
280 (StatListNode::streamTo):
281 (VarDeclListNode::streamTo):
282 (VarStatementNode::streamTo):
283 (CaseClauseNode::streamTo):
284 (ClauseListNode::streamTo):
285 (CaseBlockNode::streamTo):
286 (SourceElementsNode::streamTo):
287 * kxmlcore/ListRefPtr.h: Added.
288 (KXMLCore::ListRefPtr::ListRefPtr):
289 (KXMLCore::ListRefPtr::~ListRefPtr):
290 (KXMLCore::ListRefPtr::operator=):
292 (KXMLCore::RefPtr::release):
294 2005-12-29 Geoffrey Garen <ggaren@apple.com>
298 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4026
299 Math.random() not seeded.
301 Added call to sranddev() -- it executes the first time a process
304 * kjs/math_object.cpp:
305 (MathFuncImp::callAsFunction):
307 2005-12-29 Geoffrey Garen <ggaren@apple.com>
311 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6265
312 Name change regression: Java doesn't know what JavaJSObject is
314 Changed strings passed to Java back to original "JSObject".
316 * bindings/jni/jni_jsobject.cpp:
317 (JavaJSObject::convertValueToJObject):
318 (JavaJSObject::convertJObjectToValue):
320 2005-12-28 Anders Carlsson <andersca@mac.com>
324 - The JSC part of http://bugzilla.opendarwin.org/show_bug.cgi?id=6268
325 Add undetectable document.all
327 * kjs/operations.cpp:
329 When comparing an object with null or undefined, call toPrimitive with
330 NullType as the preferred type.
332 2005-12-27 Anders Carlsson <andersca@mac.com>
336 * kjs/array_object.cpp:
337 (ArrayProtoFunc::callAsFunction):
338 Implement filter and map. Also, make the existing
339 array iteration functions not invoke the callback for
340 non-existing properties, just as Mozilla does now.
342 * kjs/array_object.h:
343 (KJS::ArrayProtoFunc::):
346 * tests/mozilla/expected.html:
347 Update, two 1.6 tests now pass.
349 2005-12-27 Maciej Stachowiak <mjs@apple.com>
351 - updated test results for new JS 1.6 tests
353 * tests/mozilla/expected.html:
355 2005-12-27 Anders Carlsson <andersca@mac.com>
359 Add Mozilla JS 1.6 tests.
361 * tests/mozilla/js1_6/Array/browser.js: Added.
362 * tests/mozilla/js1_6/Array/regress-290592.js: Added.
363 * tests/mozilla/js1_6/Array/regress-304828.js: Added.
364 * tests/mozilla/js1_6/Array/regress-305002.js: Added.
365 * tests/mozilla/js1_6/Array/regress-310425-01.js: Added.
366 * tests/mozilla/js1_6/Array/regress-310425-02.js: Added.
367 * tests/mozilla/js1_6/Array/regress-320887.js: Added.
368 * tests/mozilla/js1_6/Array/shell.js: Added.
369 * tests/mozilla/js1_6/README: Added.
370 * tests/mozilla/js1_6/Regress/browser.js: Added.
371 * tests/mozilla/js1_6/Regress/regress-301574.js: Added.
372 * tests/mozilla/js1_6/Regress/regress-309242.js: Added.
373 * tests/mozilla/js1_6/Regress/regress-311157-01.js: Added.
374 * tests/mozilla/js1_6/Regress/regress-311157-02.js: Added.
375 * tests/mozilla/js1_6/Regress/regress-314887.js: Added.
376 * tests/mozilla/js1_6/Regress/regress-320172.js: Added.
377 * tests/mozilla/js1_6/Regress/shell.js: Added.
378 * tests/mozilla/js1_6/String/browser.js: Added.
379 * tests/mozilla/js1_6/String/regress-306591.js: Added.
380 * tests/mozilla/js1_6/String/shell.js: Added.
381 * tests/mozilla/js1_6/browser.js: Added.
382 * tests/mozilla/js1_6/shell.js: Added.
383 * tests/mozilla/js1_6/template.js: Added.
385 2005-12-27 Maks Orlovich <maksim@kde.org>
387 Reviewed and landed by Maciej.
389 - fixed 6234: Can delete array index property incorrectly.
390 http://bugzilla.opendarwin.org/show_bug.cgi?id=6234
392 * kjs/array_object.cpp:
393 (ArrayInstance::deleteProperty): use toArrayIndex instead of toUInt32 when
394 looking for array properties.
396 2005-12-27 Anders Carlsson <andersca@mac.com>
401 (KJS::JSObject::defineSetter):
402 Remove duplicate call to putDirect.
404 2005-12-26 Maciej Stachowiak <mjs@apple.com>
406 Reviewed by Darin and Geoff.
408 Changes by me and Anders.
410 - mostly fixed REGRESSION: 5-10% performance regression on JS iBench from getter/setter change
411 http://bugzilla.opendarwin.org/show_bug.cgi?id=6083
413 - also fixed some warnings reported by -Winline
415 * JavaScriptCorePrefix.h: Move new and delete definitions higher so there
416 aren't conflicts with use in standard C++ headers
418 (KJS::throwSetterError): Moved this piece of put into a seprate function
419 to avoid the PIC branch.
420 (KJS::JSObject::put): Use hasGetterSetterProperties to avoid expensive stuff
421 when not needed. Also use GetterSetter properties attribute.
422 (KJS::JSObject::deleteProperty): Recompute whether any properties are getter/setter
423 properties any more, if this one was one.
424 (KJS::JSObject::defineGetter): Let the PropertyMap know that it has getter/setter
425 properties now (and use the new attribute).
426 (KJS::JSObject::defineSetter): Ditto.
427 (KJS::JSObject::fillGetterPropertySlot): Out-of-line helper for getOwnPropertySlot,
428 to avoid global variable access in the hot code path.
430 (KJS::): Added GetterSetter attribute.
431 (KJS::JSCell::isObject): Moved lower to be after inline methods it uses.
432 (KJS::JSValue::isObject): ditto
433 (KJS::JSObject::getOwnPropertySlot): try to avoid impact of getters and setters
434 as much as possible in the case where they are not being used
435 * kjs/property_map.cpp:
436 (KJS::PropertyMap::containsGettersOrSetters): New method to help with this
437 * kjs/property_map.h:
438 (KJS::PropertyMap::hasGetterSetterProperties): Ditto
439 (KJS::PropertyMap::setHasGetterSetterProperties): Ditto
440 (KJS::PropertyMap::PropertyMap): Added a crazy hack to store the
441 global "has getter/setter properties" flag in the property map
442 single entry, to avoid making objects any bigger.
443 * kjs/value.h: Moved some things to object.h to make -Winline happier
445 2005-12-24 Maciej Stachowiak <mjs@apple.com>
447 Reviewed by Eric and Dave Hyatt.
449 - make even const PassRefPtrs give transfer of ownership semantics
450 http://bugzilla.opendarwin.org/show_bug.cgi?id=6238
452 This is a somewhat cheesy change. Having to use PassRefPtr_Ref creates ambiguities
453 in assignment and copy construction. And this makes life way easier and removes
454 the need for pass(). It is not really correct, but we pretty much never need a real
455 const PassRefPtr, and this takes care of things for PassRefPtr temporaries.
457 * kjs/identifier.cpp:
458 (KJS::Identifier::add): No more need for pass()
459 * kjs/property_map.cpp:
460 (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): No more need for pass()
462 (KJS::UString::Rep::create): Use adoptRef
463 (KJS::UString::UString): No more need for pass
464 (KJS::UString::append): No more need for pass
465 (KJS::UString::substr): No more need for pass
466 * kxmlcore/PassRefPtr.h: made m_ptr mutable (ugh)
467 (KXMLCore::PassRefPtr::PassRefPtr): Take a const PassRefPtr reference
468 (KXMLCore::PassRefPtr::release): Made this a const method (ugh)
469 (KXMLCore::PassRefPtr::operator=): clean up appropriately
470 (KXMLCore::adoptRef): Added this to use instead of PassRefPtr<T>::adopt, I think
471 it makes the behavior more clear and it is less verbose.
472 (KXMLCore::static_pointer_cast): use adoptRef
473 (KXMLCore::const_pointer_cast): use adoptRef
475 (KXMLCore::RefPtr::RefPtr): take const PassRefPtr&
476 (KXMLCore::PassRefPtr::operator=): take const PassRefPtr&
478 2005-12-25 Eric Seidel <eseidel@apple.com>
482 Unbreak HashTableConstIterator++ by returning const_iterator
484 * kxmlcore/HashTable.h:
485 (KXMLCore::HashTableConstIterator::operator++): use const_iterator
487 2005-12-25 Eric Seidel <eseidel@apple.com>
491 Un-break HashTable copy constructor.
493 * kxmlcore/HashTable.h:
494 (KXMLCore::::HashTable): use const_iterator instead
496 2005-12-23 Maciej Stachowiak <mjs@apple.com>
500 - fixed "HashMap does not work with const pointer keys or values"
501 http://bugzilla.opendarwin.org/show_bug.cgi?id=6222
503 * kxmlcore/HashMapPtrSpec.h:
504 (KXMLCore::HashMap): In all methods, explicitly cast all pointers
505 to void * before passing to internal implementation. Use C-style
506 casts instead of new-style casts, because the real solution would
507 require a combo of reinterpret_cast anc const_cast.
510 2005-12-23 Maciej Stachowiak <mjs@apple.com>
517 2005-12-22 Maciej Stachowiak <mjs@apple.com>
519 - fix build problem from last commit.
524 2005-12-21 Maciej Stachowiak <mjs@apple.com>
528 - Make HashMap/HashSet support non-POD types
529 http://bugzilla.opendarwin.org/show_bug.cgi?id=5332
531 The changes for support are relatively simple, but I also made extensive changes to
532 avoid copying, so that there isn't refcount thrash when you put RefPtrs into a HashMap.
534 * kxmlcore/HashTable.h:
535 (KXMLCore::swap): specialize swap for pairs, to swap elements individually,
536 so that excess copies can be avoided.
537 (KXMLCore::Mover::move): Template function to either copy or swap, used
538 when transferring elements from old table to new.
539 (KXMLCore::IdentityHashTranslator::hash): The old "converting lookup" templates
540 that took two or three function parameters now take a class parameter, this is
541 the class used to do a normal lookup.
542 (KXMLCore::IdentityHashTranslator::equal): Ditto.
543 (KXMLCore::IdentityHashTranslator::translate): Ditto. Translate now takes a reference
544 to write into instead of returning a value to avoid redundant copies.
545 (KXMLCore::HashTable::~HashTable): Use deallocateTable instead of freeing directly.
546 (KXMLCore::HashTable::insert): Based on HashTranslator now instead of separate
547 functions. Added a FIXME about a remaining rare excess copy.
548 (KXMLCore::HashTable::isEmptyBucket): Use KeyTraits directly instead of unwrapping
549 the key from Traits, to avoid creating and destroying pair, which copies.
550 (KXMLCore::HashTable::isDeletedBucket): ditto
551 (KXMLCore::HashTable::lookup): Use HashTranslator now instead of separate functions.
552 (KXMLCore::HashTable::initializeBucket): Renamed from emptyBucket. Use placement new to
553 work right for non-POD types.
554 (KXMLCore::HashTable::deleteBucket): Use assignDeleted to avoid excess copies.
555 (KXMLCore::HashTable::reinsert): use Mover template to copy or swap as appropriate
556 (KXMLCore::HashTable::allocateTable): Initialize every bucket if calloc won't do.
557 (KXMLCore::HashTable::deallocateTable): Destruct every bucket if needed.
558 (KXMLCore::HashTable::rehash): Avoid copy before reinserting, so that swap can do its magic.
559 (KXMLCore::HashTable::clear): use deallocateTable instead of freeing directly.
560 (KXMLCore::HashTable::HashTable): be more dumb when copying to ensure that non-POD types
562 * kxmlcore/HashFunctions.h:
563 (KXMLCore::PointerHash): Specialize PointerHash for RefPtr
564 * kxmlcore/HashMap.h:
565 (KXMLCore::extractFirst): Return a reference not a full object to avoid
567 (KXMLCore::HashMapTranslator::hash): Use a special translator for insertion
568 to defer making the pair as long as possible, thus avoiding needless copies.
569 (KXMLCore::HashMapTranslator::equal): ditto
570 (KXMLCore::HashMapTranslator::translate): ditto
571 (KXMLCore::::inlineAdd): Shared by set and add to insert using HashMapTranslator
572 (KXMLCore::::set): Use inlineAdd
573 (KXMLCore::::add): Use inlineAdd
574 * kxmlcore/HashMapPtrSpec.h:
575 (KXMLCore::): Pass KeyTraits along
576 * kxmlcore/HashSet.h:
577 (KXMLCore::identityExtract): Return a reference not a full object to avoid copies.
578 (KXMLCore::HashSetTranslatorAdapter::hash): Redo adapter stuff to work with
579 the new HashTranslator approach.
580 (KXMLCore::HashSetTranslatorAdapter::equal): ditto
581 (KXMLCore::HashSetTranslatorAdapter::translate): ditto
582 (KXMLCore::::insert): ditto
583 * kxmlcore/HashTraits.h:
584 (KXMLCore::GenericHashTraits): This is intended be used as a base class for
585 customized traits: sensible defaults.
586 (KXMLCore::): Use it a bunch
587 (KXMLCore::assignDeleted): template function to allow pairs to be assigned the
588 deleted value w/o excess copies.
589 (KXMLCore::PairHashTraits::emptyValue): Updated
590 (KXMLCore::PairHashTraits::deletedValue): Updated
591 (KXMLCore::PairHashTraits::assignDeletedValue): part of assignDeleted hack
592 (KXMLCore::DeletedValueAssigner::assignDeletedValue): Use template magic
593 to either use use deletedValue or assignDeletedValue for the cases where we care.
595 (KXMLCore::RefPtr::swap): Added swap method.
596 (KXMLCore::swap): Added swap free function.
597 * kjs/identifier.cpp:
598 (KJS::CStringTranslator::hash): Use new HashTranslator class approach to
599 alternate type based insertion.
600 (KJS::CStringTranslator::equal): ditto
601 (KJS::CStringTranslator::translate): ditto
602 (KJS::Identifier::add): ditto
603 (KJS::UCharBufferTranslator::hash): ditto
604 (KJS::UCharBufferTranslator::equal): ditto
605 (KJS::UCharBufferTranslator::translate): ditto
609 * kjs/array_object.cpp:
610 (ArrayProtoFunc::callAsFunction): Removed a stray space.
612 2005-12-22 Anders Carlsson <andersca@mac.com>
614 Reviewed by Eric and Darin.
616 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6196
617 Would like to be able to define prototypes in headers
620 Move ClassName from KJS_DECLARE_PROTOTYPE to KJS_IMPLEMENT_PROTOTYPE.
621 Also, namespace all macros by prefixing them with KJS_.
623 2005-12-22 Darin Adler <darin@apple.com>
627 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6191
628 RefPtr/PassRefPtr have a leak issue, operator== issues
630 * kxmlcore/PassRefPtr.h:
631 (KXMLCore::PassRefPtr::PassRefPtr): Remove non-template constructor that takes RefPtr
632 since the constructor template that takes RefPtr should be sufficient. Add a constructor
633 template that takes PassRefPtr&.
634 (KXMLCore::PassRefPtr::adopt): Use PassRefPtr_Ref to avoid setting pointer first to
635 0 and then to the pointer.
636 (KXMLCore::PassRefPtr::operator=): Added template versions that take PassRefPtr& and
638 (KXMLCore::PassRefPtr::operator PassRefPtr<U>): Changed to fix leak -- old version
639 would release and then ref.
640 (KXMLCore::operator==): Make templates have two parameters so you can mix types.
641 Also remove unneeded const in raw pointer versions.
642 (KXMLCore::operator!=): Ditto.
645 (KXMLCore::RefPtr::RefPtr): Add constructor template that takes PassRefPtr.
646 (KXMLCore::RefPtr::operator=): Add assignment operator templates that take
647 RefPtr and PassRefPtr.
648 (KXMLCore::operator==): Make templates have two parameters so you can mix types.
649 Also remove unneeded const in raw pointer versions.
650 (KXMLCore::operator!=): Ditto.
652 2005-12-21 Timothy Hatcher <timothy@apple.com>
654 * JavaScriptCore.xcodeproj/project.pbxproj:
655 Set tab width to 8, indent width to 4 and uses tabs to false per file.
657 2005-12-21 Geoffrey Garen <ggaren@apple.com>
661 Removed evil hack for determining if a type is an integer, replaced
662 with template metaprogramming.
664 * JavaScriptCore.xcodeproj/project.pbxproj: Set tab size to 2 for
667 (main): Inserted asserts to test IsInteger. FIXME: Move these to
668 KXMLCore unit tests directory when we create one.
669 * kxmlcore/HashTraits.h:
670 (KXMLCore::): Added IsInteger class for querying types.
672 2005-12-20 Maciej Stachowiak <mjs@apple.com>
676 - made ALWAYS_INLINE declare things inline as well as __attribute__((always_inline))
677 http://bugzilla.opendarwin.org/show_bug.cgi?id=6159
679 * kxmlcore/AlwaysInline.h:
681 2005-12-19 Maciej Stachowiak <mjs@apple.com>
685 - fixed a leak in the assignment operator from PassRefPtr to RefPtr
686 http://bugzilla.opendarwin.org/show_bug.cgi?id=6158
689 (KXMLCore::RefPtr::operator=):
691 - fix problem with PassRefPtr that darin spotted - it lacked a copy constructor
692 and therefore was using the default one, which can lead to excess derefs
694 I fixed this by adding a copy constructor from non-const
695 reference, and by adding a template pass() function that you have
696 to use when raw pointer or RefPtr are passed where PassRefPtr is
699 * kjs/identifier.cpp:
700 (KJS::Identifier::add): Changed to have PassRefPtr return type and
703 * kjs/property_map.cpp:
704 (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Use pass()
707 (KJS::UString::UString): Use pass() as needed.
708 (KJS::UString::append): ditto
709 (KJS::UString::substr): ditto
711 (KJS::UString::UString): Use initializer instead of assignment
712 * kxmlcore/PassRefPtr.h:
713 (KXMLCore::PassRefPtr::PassRefPtr): Added copy constructor
714 (KXMLCore::pass): new template function to make it convenient to pass
717 2005-12-19 Geoffrey Garen <ggaren@apple.com>
721 Fixed <rdar://problem/4370397> Missing return statement in
722 JSMethodNameToObjcMethodName.
724 JSMethodNameToObjcMethodName had a check for a name being too long, but
725 the check was missing a return statement.
727 A lot of this code was confusing and some of it was wrong, so I fixed
728 it up, added some asserts to catch this type of bug in the future,
729 changed some comments, and renamed some variables.
731 The two advantages of the new algorithm are (1) It makes writing past
732 the end of the buffer virtually impossible because the test on the main
733 loop is "while (not past end of buffer)" and (2) It's twice as fast
734 because it doesn't call strlen. (There's no need to call strlen when
735 we're walking the string ourselves.)
737 methodsNamed also supports arbitrary-length method names now. Just in
738 case the AppKit folks start getting REALLY verbose...
740 * bindings/objc/objc_class.mm:
741 (KJS::Bindings::ObjcClass::methodsNamed):
742 * bindings/objc/objc_utility.h:
743 * bindings/objc/objc_utility.mm:
744 (KJS::Bindings::JSMethodNameToObjcMethodName):
746 2005-12-19 Darin Adler <darin@apple.com>
748 Originally done by both George Staikos and Alexey Proskuryakov.
750 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5706
751 Sharedptr dependency can be removed
753 Our coding guidelines say "use 0 instead of NULL" and both RefPtr and
754 PassRefPtr were using NULL, which required including a header that
757 * kxmlcore/PassRefPtr.h:
758 (KXMLCore::PassRefPtr::PassRefPtr): Use 0 instead of NULL.
759 (KXMLCore::PassRefPtr::operator!): Use ! instead of == NULL.
761 (KXMLCore::RefPtr::RefPtr): Use 0 instead of NULL.
762 (KXMLCore::RefPtr::operator!): Use ! instead of == NULL.
763 Also did some reformatting.
765 2005-12-19 Darin Adler <darin@apple.com>
767 Reviewed by Geoff Garen and Eric Seidel.
769 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4923
770 stop using <ostream> in WebCore, eliminating the <cmath> troubles it causes
772 * kjs/simple_number.h: Removed many unnecessary includes, including
773 the <cmath> one to work around GCC library header bugs. We may have to
774 add some includes elsewhere for platforms other than OS X, since our
775 prefix header takes care of some things.
777 * kxmlcore/AlwaysInline.h: Added. Now clients that don't include
778 simple_number.h can still get the ALWAYS_INLINE macro.
779 * JavaScriptCore.xcodeproj/project.pbxproj: Added AlwaysInline.h.
781 * bindings/NP_jsobject.h: Removed a lot of unnecessary includes
782 and removed C-specific stuff from this C++-only header.
783 * bindings/jni/jni_jsobject.h: Removed a lot of unnecessary includes
784 and did some reformatting.
785 * bindings/objc/objc_runtime.h: Removed an unnecessary include.
786 * bindings/runtime.h: Removed some unneeded includes. Reformatted.
787 * bindings/runtime.cpp: Updated to compile with header changes,
788 including a lot of reformatting.
789 * bindings/runtime_object.h: Removed an unnecessary include.
791 2005-12-13 Maciej Stachowiak <mjs@apple.com>
793 Reviewed by Geoff and Adele
795 - replaced custom Identifier hashtable with HashSet
797 * kjs/identifier.cpp:
799 (KJS::identifierTable):
800 (KJS::Identifier::equal):
804 (KJS::Identifier::add):
805 (KJS::Identifier::remove):
808 (KJS::InterpreterImp::initGlobalObject):
810 2005-12-18 Justin Haygood <justin@xiondigital.net>
812 Reviewed, tweaked, and landed by Darin.
814 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5227
815 Array indexOf() extension for JavaScript 1.5 Core
817 * kjs/array_object.h:
818 * kjs/array_object.cpp: (ArrayProtoFunc::callAsFunction): Added implementation of indexOf.
820 2005-12-18 Anders Carlsson <andersca@mac.com>
822 Reviewed by Darin and Geoffrey.
824 - fix for <http://bugzilla.opendarwin.org/show_bug.cgi?id=4000>
825 Object.prototype is missing isPrototypeOf
827 * kjs/object_object.cpp:
828 (ObjectPrototype::ObjectPrototype):
829 Add isPrototypeOf to object prototype.
831 (ObjectProtoFunc::callAsFunction):
832 Implement isPrototypeOf
834 * kjs/object_object.h:
835 (KJS::ObjectProtoFunc::):
836 Add id for isPrototypeOf.
838 2005-12-17 Geoffrey Garen <ggaren@apple.com>
842 Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6119
843 split() function ignores case insensitive modifier.
846 RegExpImp: The C++ object you get when JavaScript executes
848 RegExp: A C++ wrapper object that performs regular expression
849 matching on behalf of a RegExpImp.
851 Instead of unnecessarily constructing a RegExp which (wrongly) lacks
852 any modifiers, String.split() now uses the RegExp built in to the
853 RegExpImp passed to it, which has the right modifiers already.
855 I also cleaned up other bits of the string code to standardized how
856 we handle RegExpImp arguments.
859 * kjs/string_object.cpp:
861 (StringProtoFunc::callAsFunction):
863 2005-12-16 David Hyatt <hyatt@apple.com>
865 Remove unused RefPtr constructors that can create an ambiguity in ustring on some platforms.
870 (KXMLCore::RefPtr::RefPtr):
872 2005-12-15 Darin Adler <darin@apple.com>
876 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5688
877 speed up JavaScript parsing by not creating a UString just to parse
880 * kjs/internal.cpp: (KJS::InterpreterImp::evaluate): Change to take a character pointer
881 and length rather than a UString.
884 * kjs/interpreter.cpp: (Interpreter::evaluate): Ditto.
886 * kjs/protect.h: Remove uneeded "convert to bool" operator since we already have a
887 "convert to raw pointer" operator in this class.
891 2005-12-13 Geoffrey Garen <ggaren@apple.com>
893 Updated test results to match Anders's last fix.
895 * tests/mozilla/expected.html:
897 2005-12-13 Anders Carlsson <andersca@mac.com>
899 * ChangeLog: Add titles for my bugzilla bugs.
901 2005-12-13 Anders Carlsson <andersca@mac.com>
905 - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=6041>
906 Support property getters and setters.
908 * bindings/runtime_array.cpp:
909 (RuntimeArray::lengthGetter):
910 (RuntimeArray::indexGetter):
911 * bindings/runtime_array.h:
912 * bindings/runtime_method.cpp:
913 (RuntimeMethod::lengthGetter):
914 * bindings/runtime_method.h:
915 * bindings/runtime_object.cpp:
916 (RuntimeObjectImp::fallbackObjectGetter):
917 (RuntimeObjectImp::fieldGetter):
918 (RuntimeObjectImp::methodGetter):
919 * bindings/runtime_object.h:
920 * kjs/array_instance.h:
921 * kjs/array_object.cpp:
922 (ArrayInstance::lengthGetter):
924 Update for changes to PropertySlot::getValue and
925 PropertySlot::GetValueFunc.
929 Handle GetterSetterType.
932 (KJS::FunctionImp::argumentsGetter):
933 (KJS::FunctionImp::lengthGetter):
934 (KJS::Arguments::mappedIndexGetter):
935 (KJS::ActivationImp::argumentsGetter):
937 Update for changes to PropertySlot::getValue and
938 PropertySlot::GetValueFunc.
941 Rework grammar parts for get set declarations directly
942 in the object literal.
945 (KJS::GetterSetterImp::mark):
946 (KJS::GetterSetterImp::toPrimitive):
947 (KJS::GetterSetterImp::toBoolean):
948 (KJS::GetterSetterImp::toNumber):
949 (KJS::GetterSetterImp::toString):
950 (KJS::GetterSetterImp::toObject):
951 Add type conversion functions. These aren't meant to be called.
954 Handle GetterSetterType.
957 (KJS::staticFunctionGetter):
958 (KJS::staticValueGetter):
959 Update for changes to PropertySlot::GetValueFunc.
962 Refactor they way properties nodes are implemented.
963 We now have a PropertyListNode which is a list of PropertyNodes.
964 Each PropertyNode has a name (which is a PropertyNameNode) and an associated
965 value node. PropertyNodes can be of different types. The Constant type is the
966 old constant declaration and the Getter and Setter types are for property getters
968 (ResolveNode::evaluate):
969 Update for changes to PropertySlot::getValue.
971 (PropertyListNode::evaluate):
972 Go through all property nodes and set them on the newly created object. If the
973 property nodes are of type Getter or Setter, define getters and setters. Otherwise,
974 just add the properties like before.
976 (PropertyNode::evaluate):
977 This should never be called directly.
979 (PropertyNameNode::evaluate):
980 Rename from PropertyNode::evaluate.
982 (FunctionCallResolveNode::evaluate):
983 (FunctionCallBracketNode::evaluate):
984 (FunctionCallDotNode::evaluate):
985 (PostfixResolveNode::evaluate):
986 (PostfixBracketNode::evaluate):
987 (PostfixDotNode::evaluate):
988 (TypeOfResolveNode::evaluate):
989 (PrefixResolveNode::evaluate):
990 (PrefixBracketNode::evaluate):
991 (PrefixDotNode::evaluate):
992 (AssignResolveNode::evaluate):
993 (AssignDotNode::evaluate):
994 (AssignBracketNode::evaluate):
995 Update for changes to PropertySlot::getValue.
998 (KJS::PropertyNameNode::PropertyNameNode):
999 Rename from PropertyNode.
1001 (KJS::PropertyNode::):
1002 (KJS::PropertyNode::PropertyNode):
1003 New class, representing a single property.
1005 (KJS::PropertyListNode::PropertyListNode):
1006 Rename from PropertyValueNode.
1008 (KJS::FuncExprNode::FuncExprNode):
1009 Put ParameterNode parameter last, and make it optional.
1011 (KJS::ObjectLiteralNode::ObjectLiteralNode):
1012 Use a PropertyListNode here now.
1014 * kjs/nodes2string.cpp:
1015 (PropertyListNode::streamTo):
1016 Iterate through all property nodes.
1018 (PropertyNode::streamTo):
1019 Print out the name and value. Doesn't handle getters and setters currently.
1021 (PropertyNameNode::streamTo):
1022 Rename from PropertyNode::streamTo.
1025 (KJS::JSObject::get):
1026 Update for changes to PropertySlot::getValue.
1028 (KJS::JSObject::put):
1029 If the property already exists and has a Setter, invoke
1030 the setter function instead of setting the property directly.
1032 (KJS::JSObject::defineGetter):
1033 (KJS::JSObject::defineSetter):
1034 New functions for defining property getters and setters on the object.
1037 (KJS::GetterSetterImp::type):
1038 (KJS::GetterSetterImp::GetterSetterImp):
1039 (KJS::GetterSetterImp::getGetter):
1040 (KJS::GetterSetterImp::setGetter):
1041 (KJS::GetterSetterImp::getSetter):
1042 (KJS::GetterSetterImp::setSetter):
1043 New class for properties which have getters and setters defined.
1044 This class is only used internally and should never be seen from the outside.
1046 (KJS::JSObject::getOwnPropertySlot):
1047 If the property is a getter, call setGetterSlot on the property slot.
1049 * kjs/object_object.cpp:
1050 (ObjectPrototype::ObjectPrototype):
1051 Add __defineGetter__, __defineSetter, __lookupGetter__, __lookupSetter__
1054 (ObjectProtoFunc::callAsFunction):
1055 Implement handlers for new functions.
1057 * kjs/object_object.h:
1058 (KJS::ObjectProtoFunc::):
1059 Add ids for new functions.
1061 * kjs/property_slot.cpp:
1062 (KJS::PropertySlot::undefinedGetter):
1063 Update for changes to PropertySlot::GetValueFunc.
1065 (KJS::PropertySlot::functionGetter):
1066 Call the function getter object and return its value.
1068 * kjs/property_slot.h:
1069 (KJS::PropertySlot::getValue):
1070 Add a new argument which is the original object that
1071 getPropertySlot was called on.
1073 (KJS::PropertySlot::setGetterSlot):
1074 (KJS::PropertySlot::):
1075 New function which sets a getter slot. When getValue is called on a
1076 getter slot, the getter function object is invoked.
1078 * kjs/string_object.cpp:
1079 (StringInstance::lengthGetter):
1080 (StringInstance::indexGetter):
1081 * kjs/string_object.h:
1082 Update for changes to PropertySlot::GetValueFunc.
1086 Add GetterSetterType and make GetterSetterImp a friend class of JSCell.
1088 2005-12-12 Maciej Stachowiak <mjs@apple.com>
1092 - added a new HashCountedSet class for the common pattern of mapping items to counts that can change
1094 * kxmlcore/HashCountedSet.h: Added.
1095 (KXMLCore::HashCountedSet::*): Implemented, on top of HashMap.
1096 * kxmlcore/HashMap.h:
1097 (KXMLCore::HashMap::add): New method - does not replace existing value if key already present
1098 but otherwise like set().
1099 (KXMLCore::HashMap::set): Improved comments.
1100 * kxmlcore/HashMapPtrSpec.h:
1101 (KXMLCore::HashMap::add): Added to specializations too.
1102 * JavaScriptCore.xcodeproj/project.pbxproj: Add new file.
1103 * kxmlcore/HashFunctions.h: Added include of stdint.h
1105 - replaced the custom hashtable for values protected from GC with HashCountedSet
1107 * kjs/collector.cpp:
1108 (KJS::Collector::protect): Moved code here from ProtectedValues::increaseProtectCount
1109 since the code is so simple now.
1110 (KJS::Collector::unprotect): Ditto for ProtectedValues::decreaseProtectCount.
1111 (KJS::Collector::markProtectedObjects): Updated for new way of doing things, now
1113 (KJS::Collector::numReferencedObjects): ditto
1114 (KJS::Collector::rootObjectClasses): ditto
1115 * kjs/collector.h: Added protect and unprotect static methods
1117 (KJS::gcProtect): Updated for removal of ProtectedValues class
1118 (KJS::gcUnprotect): likewise
1119 * kjs/protected_values.cpp: Removed.
1120 * kjs/protected_values.h: Removed.
1122 2005-12-10 Darin Adler <darin@apple.com>
1124 Rubber stamped by Maciej.
1126 - did long-promised KJS renaming:
1129 ObjectImp -> JSObject
1130 AllocatedValueImp -> JSCell
1132 A renaming to get a class out of the way
1134 KJS::Bindings::JSObject -> JavaJSObject
1136 and some other "imp-reduction" renaming
1138 *InstanceImp -> *Instance
1139 *ProtoFuncImp -> *ProtoFunc
1140 *PrototypeImp -> *Prototype
1141 ArgumentsImp -> Arguments
1142 RuntimeArrayImp -> RuntimeArray
1143 RuntimeMethodImp -> RuntimeMethod
1145 * most files and functions
1147 2005-12-10 Darin Adler <darin@apple.com>
1151 - eliminated the old Undefined(), Null(), Boolean(), Number(), and String()
1153 Code now uses jsUndefined(), jsNull(), jsBoolean(), jsNumber(), and jsString().
1155 * bindings/NP_jsobject.cpp:
1157 * bindings/c/c_instance.cpp:
1158 (KJS::Bindings::CInstance::invokeMethod):
1159 (KJS::Bindings::CInstance::invokeDefaultMethod):
1160 * bindings/c/c_runtime.cpp:
1161 (CField::valueFromInstance):
1162 * bindings/c/c_utility.cpp:
1163 (KJS::Bindings::convertNPVariantToValue):
1164 * bindings/jni/jni_instance.cpp:
1165 (JavaInstance::invokeMethod):
1166 (JavaInstance::invokeDefaultMethod):
1167 * bindings/jni/jni_jsobject.cpp:
1169 (JSObject::convertJObjectToValue):
1170 * bindings/jni/jni_runtime.cpp:
1171 (JavaArray::convertJObjectToArray):
1172 (JavaField::valueFromInstance):
1173 (JavaArray::valueAt):
1174 * bindings/objc/WebScriptObject.mm:
1175 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1176 (-[WebScriptObject evaluateWebScript:]):
1177 (-[WebScriptObject valueForKey:]):
1178 (-[WebScriptObject webScriptValueAtIndex:]):
1179 * bindings/objc/objc_instance.mm:
1180 (ObjcInstance::invokeMethod):
1181 (ObjcInstance::invokeDefaultMethod):
1182 (ObjcInstance::getValueOfUndefinedField):
1183 * bindings/objc/objc_runtime.mm:
1184 (ObjcField::valueFromInstance):
1185 (ObjcFallbackObjectImp::callAsFunction):
1186 * bindings/objc/objc_utility.mm:
1187 (KJS::Bindings::convertNSStringToString):
1188 (KJS::Bindings::convertObjcValueToValue):
1189 * bindings/runtime.h:
1190 (KJS::Bindings::Class::fallbackObject):
1191 (KJS::Bindings::Instance::getValueOfUndefinedField):
1192 (KJS::Bindings::Instance::valueOf):
1193 * bindings/runtime_array.cpp:
1194 (RuntimeArrayImp::lengthGetter):
1195 * bindings/runtime_method.cpp:
1196 (RuntimeMethodImp::lengthGetter):
1197 (RuntimeMethodImp::callAsFunction):
1198 (RuntimeMethodImp::execute):
1199 * kjs/array_object.cpp:
1200 (ArrayInstanceImp::lengthGetter):
1201 (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
1202 (ArrayPrototypeImp::ArrayPrototypeImp):
1203 (ArrayProtoFuncImp::ArrayProtoFuncImp):
1204 (ArrayProtoFuncImp::callAsFunction):
1205 (ArrayObjectImp::ArrayObjectImp):
1206 * kjs/bool_object.cpp:
1207 (BooleanPrototypeImp::BooleanPrototypeImp):
1208 (BooleanProtoFuncImp::callAsFunction):
1209 (BooleanObjectImp::BooleanObjectImp):
1210 (BooleanObjectImp::callAsFunction):
1211 * kjs/error_object.cpp:
1212 (ErrorPrototypeImp::ErrorPrototypeImp):
1213 (ErrorProtoFuncImp::ErrorProtoFuncImp):
1214 (ErrorProtoFuncImp::callAsFunction):
1215 (ErrorObjectImp::ErrorObjectImp):
1216 (NativeErrorImp::NativeErrorImp):
1218 (KJS::FunctionImp::callAsFunction):
1219 (KJS::FunctionImp::processParameters):
1220 (KJS::FunctionImp::argumentsGetter):
1221 (KJS::FunctionImp::lengthGetter):
1222 (KJS::DeclaredFunctionImp::execute):
1225 (KJS::GlobalFuncImp::callAsFunction):
1226 * kjs/function_object.cpp:
1227 (FunctionPrototypeImp::FunctionPrototypeImp):
1228 (FunctionPrototypeImp::callAsFunction):
1229 (FunctionProtoFuncImp::callAsFunction):
1230 (FunctionObjectImp::FunctionObjectImp):
1232 (KJS::InterpreterImp::initGlobalObject):
1233 * kjs/interpreter.h:
1235 * kjs/math_object.cpp:
1236 (MathObjectImp::getValueProperty):
1237 (MathFuncImp::callAsFunction):
1239 (Node::setExceptionDetailsIfNeeded):
1240 (NullNode::evaluate):
1241 (PropertyNode::evaluate):
1242 (FunctionCallBracketNode::evaluate):
1243 (FunctionCallDotNode::evaluate):
1244 (PostfixBracketNode::evaluate):
1245 (PostfixDotNode::evaluate):
1246 (VoidNode::evaluate):
1247 (PrefixBracketNode::evaluate):
1248 (PrefixDotNode::evaluate):
1249 (ShiftNode::evaluate):
1250 (valueForReadModifyAssignment):
1251 (AssignDotNode::evaluate):
1252 (AssignBracketNode::evaluate):
1253 (VarDeclNode::evaluate):
1254 (VarDeclNode::processVarDecls):
1255 (VarDeclListNode::evaluate):
1256 (ReturnNode::execute):
1257 (CaseClauseNode::evalStatements):
1258 (ParameterNode::evaluate):
1259 (FuncDeclNode::processFuncDecl):
1261 (KJS::StatementNode::evaluate):
1262 * kjs/number_object.cpp:
1263 (NumberPrototypeImp::NumberPrototypeImp):
1264 (NumberProtoFuncImp::callAsFunction):
1265 (NumberObjectImp::NumberObjectImp):
1266 (NumberObjectImp::getValueProperty):
1267 (NumberObjectImp::callAsFunction):
1269 (KJS::ObjectImp::get):
1270 (KJS::Error::create):
1271 * kjs/object_object.cpp:
1272 (ObjectPrototypeImp::ObjectPrototypeImp):
1273 (ObjectProtoFuncImp::callAsFunction):
1274 (ObjectObjectImp::ObjectObjectImp):
1275 * kjs/property_slot.cpp:
1276 (KJS::PropertySlot::undefinedGetter):
1277 * kjs/regexp_object.cpp:
1278 (RegExpPrototypeImp::RegExpPrototypeImp):
1279 (RegExpProtoFuncImp::callAsFunction):
1280 (RegExpObjectImp::RegExpObjectImp):
1281 (RegExpObjectImp::arrayOfMatches):
1282 (RegExpObjectImp::getBackref):
1283 (RegExpObjectImp::getLastMatch):
1284 (RegExpObjectImp::getLastParen):
1285 (RegExpObjectImp::getLeftContext):
1286 (RegExpObjectImp::getRightContext):
1287 (RegExpObjectImp::getValueProperty):
1288 (RegExpObjectImp::construct):
1289 * kjs/string_object.cpp:
1290 (StringInstanceImp::StringInstanceImp):
1291 (StringPrototypeImp::StringPrototypeImp):
1293 (StringProtoFuncImp::callAsFunction):
1294 (StringObjectImp::StringObjectImp):
1295 (StringObjectImp::callAsFunction):
1296 (StringObjectFuncImp::StringObjectFuncImp):
1297 (StringObjectFuncImp::callAsFunction):
1299 (TestFunctionImp::callAsFunction):
1300 (VersionFunctionImp::callAsFunction):
1303 2005-12-10 Oliver Hunt <ojh16@student.canterbury.ac.nz>
1305 Reviewed by Maciej, landed by Darin.
1307 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=3539
1308 Array join and toString methods do not support circular references
1310 * kjs/array_object.cpp: (ArrayProtoFuncImp::callAsFunction):
1311 Added set of visited objects -- don't recurse if item is already in the set.
1313 2005-12-08 Maciej Stachowiak <mjs@apple.com>
1317 - fix major memory leak and resultant slowdown on JavaScript iBench from
1318 my PassRefPtr changes
1321 (KJS::UString::Rep::create): I forgot to change one of the two overloads to create
1322 with a refcount of 0 instead of 1 (the smart pointer then bumps it. But instead of
1323 changing it, I changed both to start with a refcounter of 1 and use PassRefPtr::adopt
1324 to adopt the initial refcount, this may be a hair more efficient.
1326 - made the assignment operators for smart pointers inline because Shark said so
1328 * kxmlcore/PassRefPtr.h:
1329 (KXMLCore::::operator=):
1330 * kxmlcore/RefPtr.h:
1331 (KXMLCore::::operator=):
1333 2005-12-06 Anders Carlsson <andersca@mac.com>
1337 - fix build when using gcc 4
1342 * kxmlcore/PassRefPtr.h:
1343 (KXMLCore::::operator):
1346 2005-12-05 Maciej Stachowiak <mjs@apple.com>
1350 - add PassRefPtr, a smart pointer class that works in conjunction
1351 with RefPtr but has transfer-of-ownership semantics
1352 - apply RefPtr and PassRefPtr to UString
1353 - cleaned up UString a little so that it doesn't need to have so many friend classes
1355 * JavaScriptCore.xcodeproj/project.pbxproj:
1356 * kjs/identifier.cpp:
1357 (KJS::Identifier::add):
1359 (KJS::Identifier::Identifier):
1360 (KJS::Identifier::equal):
1361 * kjs/property_map.cpp:
1362 (KJS::PropertyMap::get):
1363 (KJS::PropertyMap::getLocation):
1364 (KJS::PropertyMap::put):
1365 (KJS::PropertyMap::remove):
1367 (KJS::UCharReference::operator=):
1368 (KJS::UCharReference::ref):
1369 (KJS::UString::Rep::createCopying):
1370 (KJS::UString::Rep::create):
1371 (KJS::UString::usedCapacity):
1372 (KJS::UString::usedPreCapacity):
1373 (KJS::UString::expandCapacity):
1374 (KJS::UString::expandPreCapacity):
1375 (KJS::UString::UString):
1376 (KJS::UString::spliceSubstringsWithSeparators):
1377 (KJS::UString::append):
1378 (KJS::UString::operator=):
1379 (KJS::UString::toStrictUInt32):
1380 (KJS::UString::substr):
1381 (KJS::UString::copyForWriting):
1384 (KJS::UString::UString):
1385 (KJS::UString::~UString):
1386 (KJS::UString::data):
1387 (KJS::UString::isNull):
1388 (KJS::UString::isEmpty):
1389 (KJS::UString::size):
1390 (KJS::UString::rep):
1391 * kxmlcore/RefPtr.h:
1392 (KXMLCore::RefPtr::RefPtr):
1393 (KXMLCore::RefPtr::operator*):
1394 (KXMLCore::::operator):
1395 (KXMLCore::operator==):
1396 (KXMLCore::operator!=):
1397 (KXMLCore::static_pointer_cast):
1398 (KXMLCore::const_pointer_cast):
1400 2005-12-04 Geoffrey Garen <ggaren@apple.com>
1402 Update test results to match Anders's last checkin.
1404 * tests/mozilla/expected.html:
1406 2005-12-04 Anders Carlsson <andersca@mac.com>
1408 Reviewed by Geoffrey.
1410 - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3999>
1411 Object.prototype is missing propertyIsEnumerable
1414 (KJS::ObjectImp::canPut):
1415 Refactor to use getPropertyAttributes.
1417 (KJS::ObjectImp::propertyIsEnumerable):
1418 New function which checks if a property is enumerable.
1420 (KJS::ObjectImp::getPropertyAttributes):
1422 Add getPropertyAttributes and propertyIsEnumerable.
1424 * kjs/object_object.cpp:
1425 (ObjectPrototypeImp::ObjectPrototypeImp):
1426 (ObjectProtoFuncImp::callAsFunction):
1427 * kjs/object_object.h:
1428 (KJS::ObjectProtoFuncImp::):
1429 Add propertyIsEnumerable to the Object prototype.
1431 2005-12-01 Maciej Stachowiak <mjs@apple.com>
1433 Reviewed by Tim Hatcher.
1435 - removed deprecated reset, isNull and nonNull methods
1437 * kxmlcore/RefPtr.h:
1439 2005-12-01 Anders Carlsson <andersca@mac.com>
1443 - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3382>
1444 nodes2strings.cpp fails to print left expression of ForInNode when 'var' is not used
1448 * kjs/nodes2string.cpp:
1449 (ForInNode::streamTo):
1450 Add lexpr if there's no varDecl.
1452 2005-12-01 Maciej Stachowiak <mjs@apple.com>
1454 Rubber stamped by Eric.
1456 - renamed SharedPtr to RefPtr via script
1458 * JavaScriptCore.xcodeproj/project.pbxproj:
1460 (KJS::GlobalFuncImp::callAsFunction):
1462 * kjs/function_object.cpp:
1463 (FunctionObjectImp::construct):
1465 (KJS::Parser::parse):
1466 (KJS::InterpreterImp::checkSyntax):
1467 (KJS::InterpreterImp::evaluate):
1470 * kjs/nodes2string.cpp:
1471 (KJS::SourceStream::operator<<):
1473 * kxmlcore/RefPtr.h: Added.
1474 (KXMLCore::RefPtr::RefPtr):
1475 (KXMLCore::RefPtr::~RefPtr):
1476 (KXMLCore::RefPtr::isNull):
1477 (KXMLCore::RefPtr::notNull):
1478 (KXMLCore::RefPtr::reset):
1479 (KXMLCore::RefPtr::get):
1480 (KXMLCore::RefPtr::operator*):
1481 (KXMLCore::RefPtr::operator->):
1482 (KXMLCore::RefPtr::operator!):
1483 (KXMLCore::RefPtr::operator UnspecifiedBoolType):
1484 (KXMLCore::::operator):
1485 (KXMLCore::operator==):
1486 (KXMLCore::operator!=):
1487 (KXMLCore::static_pointer_cast):
1488 (KXMLCore::const_pointer_cast):
1489 * kxmlcore/SharedPtr.h: Removed.
1491 2005-11-30 Maciej Stachowiak <mjs@apple.com>
1493 Reviewed by Dave Hyatt.
1495 - change idiom used for implicit bool conversion of smart pointers, because the old one gives weird error messages sometimes
1498 (KJS::ProtectedPtr::operator UnspecifiedBoolType):
1499 * kxmlcore/SharedPtr.h:
1500 (KXMLCore::SharedPtr::operator UnspecifiedBoolType):
1502 2005-11-29 Mitz Pettel <opendarwin.org@mitzpettel.com>
1504 Reviewed by ggaren. Committed by eseidel.
1506 Date conversion to local time gets the DST flag wrong sometimes
1507 http://bugzilla.opendarwin.org/show_bug.cgi?id=5514
1509 * kjs/date_object.cpp:
1510 (KJS::isTime_tSigned):
1511 (KJS::DateProtoFuncImp::callAsFunction):
1513 2005-11-26 Maciej Stachowiak <mjs@apple.com>
1515 Rubber stamped by Eric.
1517 - renamed InterpreterLock to JSLock
1519 * bindings/NP_jsobject.cpp:
1524 (_NPN_RemoveProperty):
1527 (_NPN_SetException):
1528 * bindings/jni/jni_jsobject.cpp:
1531 (JSObject::getMember):
1532 (JSObject::setMember):
1533 (JSObject::removeMember):
1534 (JSObject::getSlot):
1535 (JSObject::setSlot):
1536 (JSObject::toString):
1537 (JSObject::convertJObjectToValue):
1538 * bindings/objc/WebScriptObject.mm:
1539 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1540 (-[WebScriptObject evaluateWebScript:]):
1541 (-[WebScriptObject setValue:forKey:]):
1542 (-[WebScriptObject valueForKey:]):
1543 (-[WebScriptObject removeWebScriptKey:]):
1544 (-[WebScriptObject stringRepresentation]):
1545 (-[WebScriptObject webScriptValueAtIndex:]):
1546 (-[WebScriptObject setWebScriptValueAtIndex:value:]):
1547 (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
1548 * bindings/runtime.cpp:
1549 (Instance::createRuntimeObject):
1550 * bindings/runtime_root.cpp:
1551 (KJS::Bindings::addNativeReference):
1552 (KJS::Bindings::removeNativeReference):
1553 (RootObject::removeAllNativeReferences):
1554 * bindings/runtime_root.h:
1555 (KJS::Bindings::RootObject::~RootObject):
1556 (KJS::Bindings::RootObject::setRootObjectImp):
1557 * bindings/testbindings.cpp:
1559 * bindings/testbindings.mm:
1562 (KJS::initializeJSLock):
1563 (KJS::JSLock::lock):
1564 (KJS::JSLock::unlock):
1565 (KJS::JSLock::lockCount):
1566 (KJS::JSLock::DropAllLocks::DropAllLocks):
1567 (KJS::JSLock::DropAllLocks::~DropAllLocks):
1569 (KJS::JSLock::JSLock):
1570 (KJS::JSLock::~JSLock):
1571 * kjs/collector.cpp:
1572 (KJS::Collector::allocate):
1573 (KJS::Collector::collect):
1575 (KJS::InterpreterImp::InterpreterImp):
1576 (KJS::InterpreterImp::clear):
1577 (KJS::InterpreterImp::checkSyntax):
1578 (KJS::InterpreterImp::evaluate):
1579 * kjs/interpreter.cpp:
1580 (Interpreter::evaluate):
1582 (KJS::::ProtectedPtr):
1583 (KJS::::~ProtectedPtr):
1585 * kjs/protected_reference.h:
1586 (KJS::ProtectedReference::ProtectedReference):
1587 (KJS::ProtectedReference::~ProtectedReference):
1588 (KJS::ProtectedReference::operator=):
1589 * kjs/protected_values.cpp:
1590 (KJS::ProtectedValues::getProtectCount):
1591 (KJS::ProtectedValues::increaseProtectCount):
1592 (KJS::ProtectedValues::decreaseProtectCount):
1594 (TestFunctionImp::callAsFunction):
1597 2005-11-26 Darin Adler <darin@apple.com>
1599 Reviewed by eseidel. Committed by eseidel.
1601 Inline ScopeChain functions for speed.
1602 http://bugzilla.opendarwin.org/show_bug.cgi?id=5687
1605 (KJS::ScopeChain::mark):
1606 * kjs/scope_chain.cpp:
1607 * kjs/scope_chain.h:
1608 (KJS::ScopeChain::ref):
1609 (KJS::ScopeChain::operator=):
1610 (KJS::ScopeChain::bottom):
1611 (KJS::ScopeChain::push):
1612 (KJS::ScopeChain::pop):
1614 2005-11-21 Maciej Stachowiak <mjs@apple.com>
1618 <rdar://problem/4139620> Seed: WebKit: hang when sending XMLHttpRequest if automatic proxy config is used
1620 Also factored locking code completely into a separate class, and
1621 added a convenient packaged way to temporarily drop locks.
1623 * JavaScriptCore.xcodeproj/project.pbxproj:
1624 * kjs/JSLock.cpp: Added.
1625 (KJS::initializeInterpreterLock):
1626 (KJS::InterpreterLock::lock):
1627 (KJS::InterpreterLock::unlock):
1628 (KJS::InterpreterLock::lockCount):
1629 (KJS::InterpreterLock::DropAllLocks::DropAllLocks):
1630 (KJS::InterpreterLock::DropAllLocks::~DropAllLocks):
1631 * kjs/JSLock.h: Added.
1632 (KJS::InterpreterLock::InterpreterLock):
1633 (KJS::InterpreterLock::~InterpreterLock):
1636 * kjs/interpreter.cpp:
1637 * kjs/interpreter.h:
1640 (TestFunctionImp::callAsFunction):
1642 2005-11-21 Eric Seidel <eseidel@apple.com>
1644 Rubber-stamped by hyatt.
1646 Removed JavaScriptCore+SVG target.
1648 * JavaScriptCore.xcodeproj/project.pbxproj:
1650 2005-11-15 Geoffrey Garen <ggaren@apple.com>
1654 - Fixed <rdar://problem/4342216> Installer crash in
1655 KJS::ValueImp::marked() when garbage collector runs inside call to
1656 ConstantValues::init()
1658 I took responsibility for initializing and marking ConstantValues away
1659 from InterpreterImp, since it's possible to reference such a value
1660 before any interpreter has been created and after the last interpreter
1663 InterpreterImp::lock now initializes ConstantValues. It's a good
1664 place for the initialization because you have to call it before
1665 creating any objects. Since ::lock can be called more than once,
1666 I added a check in ConstantValues::init to ensure that it executes
1669 Collector:collect is now responsible for marking ConstantValues.
1671 We no longer clear the ConstantValues since we can't guarantee that no
1672 one has a reference to them.
1674 FIXME: This is hackery. The long-term plan is to make ConstantValues
1675 use immediate values that require no initialization.
1678 * kjs/collector.cpp:
1679 (KJS::Collector::collect):
1681 (KJS::InterpreterImp::InterpreterImp):
1682 (KJS::InterpreterImp::lock):
1683 (KJS::InterpreterImp::clear):
1684 (KJS::InterpreterImp::mark):
1687 (KJS::ConstantValues::initIfNeeded):
1690 2005-11-08 Geoffrey Garen <ggaren@apple.com>
1694 This patch fixes some naughty naughty code -- 5 crashes and 2
1695 may-go-haywire-in-the-futures.
1697 One such crash is <rdar://problem/4247330> 8C46 Crash with with
1698 incomplete parameter list to webScript object function.
1700 I replaced early returns from within NS_DURINGs with calls to
1701 NS_VALUERETURN because the doc says, "You cannot use goto or
1702 return to exit an exception handling domain -- errors will result."
1704 I replaced hard-coded analyses of -[NSMethodSignature
1705 methodReturnType] with more abstracted alternatives, since
1706 the documentation says "This encoding is implementation-specific,
1707 so applications should use it with caution," and then emits an
1710 I removed the early return in the case where a JavaScript caller
1711 supplies an insufficient number of arguments, because the right
1712 thing to do in such a case is to use JavaScript's defined behavior
1713 of supplying "undefined" for any missing arguments.
1715 I also changed ObjcInstance::invokeMethod so that it no longer
1716 deletes the method passed to it. It doesn't create the method,
1717 so it shouldn't delete it. A friend of mine named
1718 KERNEL_PROTECTION_FAILURE agrees with me on this point.
1720 Finally, I changed an assert(true) to assert(false) because
1721 all the other asserts were making fun of it.
1723 * bindings/objc/objc_instance.mm:
1724 (ObjcInstance::invokeMethod):
1725 (ObjcInstance::invokeDefaultMethod):
1727 2005-11-06 Geoffrey Garen <ggaren@apple.com>
1731 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5571
1732 REGRESSION (412.5-TOT): duplicated words/sentences at
1733 shakespeer.sourceforge.net
1735 Our UTF16-modified PCRE didn't work with extended character classes
1736 (classes involving characters > 255) because it used the GETCHARINC
1737 macro to read through them. In UTF16 mode, GETCHARINC expects UTF16
1738 input, but PCRE encodes character classes in UTF8 regardless of the
1739 input mode of the subject string.
1741 The fix is to explicitly define GETUTF8CHARINC, and to use it,
1742 rather than GETCHARINC, when reading extended character classes.
1744 In UTF8 mode, we simply define GETCHARINC to be GETUTF8CHARINC.
1746 * pcre/pcre_internal.h:
1747 * pcre/pcre_xclass.c:
1750 2005-11-05 Geoffrey Garen <ggaren@apple.com>
1752 Patch by Mitz Pettel, reviewed by Maciej.
1754 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5357
1755 REGRESSION: Scriptable plugin hides properties of OBJECT element
1757 * bindings/objc/objc_class.mm:
1758 (KJS::Bindings::ObjcClass::fallbackObject):
1760 2005-11-05 Geoffrey Garen <ggaren@apple.com>
1764 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5409
1765 slice() testcase doesn't pass
1767 Modified String.slice to deal with funky values.
1768 Updated test results. We now pass <js1_2/String/slice.js>.
1770 * kjs/string_object.cpp:
1771 (StringProtoFuncImp::callAsFunction):
1772 * tests/mozilla/expected.html:
1774 2005-11-04 Darin Adler <darin@apple.com>
1776 Reviewed by Tim Hatcher.
1778 * kxmlcore/HashSet.h: Fixed case of "hashfunctions.h" -- needs to be "HashFunctions.h".
1780 2005-11-03 Timothy Hatcher <timothy@apple.com>
1782 Reviewed by Darin and Vicki.
1784 * JavaScriptCore.xcodeproj/project.pbxproj:
1785 Change to use $(SYSTEM_LIBRARY_DIR) consistently and place
1786 $(NEXT_ROOT) in a few spots to make build-root work.
1788 2005-11-03 Geoffrey Garen <ggaren@apple.com>
1790 - Updated JavaScriptCore test results to reflect recent fixes.
1792 * tests/mozilla/expected.html:
1794 2005-11-03 Geoffrey Garen <ggaren@apple.com>
1798 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5602
1799 REGRESSION: RegExp("[^\\s$]+", "g") returns extra matches
1801 We now update lastIndex relative to the start of the last match,
1802 rather than the start of the last search. We used to assume that
1803 the two were equal, but that is not the case when a pattern
1804 matches at a character after the first in the string.
1806 * kjs/regexp_object.cpp:
1807 (RegExpProtoFuncImp::callAsFunction):
1809 2005-10-24 John Sullivan <sullivan@apple.com>
1811 Reviewed by Darin Adler. Code changes by Alexey Proskuryakov.
1813 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4931
1814 Unicode format characters (Cf) should be removed from JavaScript source
1817 include <unicode/uchar.h>
1819 use KJS::UChar instead of UChar to avoid ambiguity caused by new include
1821 ditto; also, use shift(4) to skip first 4 chars to take advantage of new
1824 skip chars of type U_FORMAT_CHAR
1825 (Lexer::convertUnicode):
1826 use KJS::UChar instead of UChar to avoid ambiguity caused by new include
1829 (Lexer::makeIdentifier):
1831 (Lexer::makeUString):
1834 * tests/mozilla/ecma/Array/15.4.5.1-1.js:
1835 updated to skip soft hyphens
1837 2005-10-24 John Sullivan <sullivan@apple.com>
1839 Reviewed by Darin Adler. Code changes by George Staikos/Geoff Garen.
1841 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4142
1842 Date object does not always adjust daylight savings correctly
1844 * kjs/date_object.cpp:
1846 Fix the case where a time change crosses the daylight savings start/end dates.
1848 2005-10-17 Maciej Stachowiak <mjs@apple.com>
1850 Reviewed by Geoff. Code changes by Darin.
1852 - some micro-optimizations to FastMalloc to reduce math and branches.
1854 * kxmlcore/FastMalloc.cpp:
1855 (KXMLCore::TCMalloc_Central_FreeList::Populate):
1856 (KXMLCore::fastMallocRegisterThread):
1857 (KXMLCore::TCMalloc_ThreadCache::GetCache):
1858 (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
1860 2005-10-15 Maciej Stachowiak <mjs@apple.com>
1862 Reverted fix for this bug, because it was part of a time range that caused a performance
1865 <rdar://problem/4260481> Remove Reference type from JavaScriptCore
1867 2005-10-15 Darin Adler <darin@apple.com>
1869 * kxmlcore/HashTable.cpp: Fixed build failure (said hashtable.h instead of HashTable.h).
1871 2005-10-14 Geoffrey Garen <ggaren@apple.com>
1873 Style changes recommended by Darin.
1875 Changed to camelCase, changed ValueImp* to ValueImp *.
1877 * kjs/simple_number.h:
1878 (KJS::SimpleNumber::make):
1879 (KJS::SimpleNumber::value):
1881 2005-10-11 Geoffrey Garen <ggaren@apple.com>
1883 Added regexp_object.lut.h build phase from JavaScriptCore
1884 to JavaScriptCore+SVG.
1888 * JavaScriptCore.xcodeproj/project.pbxproj:
1890 2005-10-11 Geoffrey Garen <ggaren@apple.com>
1892 Fixed build bustage from last checkin (stray characters
1893 in the project file).
1897 * JavaScriptCore.xcodeproj/project.pbxproj:
1899 2005-10-11 Geoffrey Garen <ggaren@apple.com>
1901 New JavaScriptCore test results to reflect the last change.
1903 * tests/mozilla/expected.html:
1905 2005-10-10 Geoffrey Garen <ggaren@apple.com>
1907 - Implemented caching of match state inside the global RegExp object
1908 (lastParen, leftContext, rightContext, lastMatch, input).
1910 exec(), test(), match(), search(), and replace() now dipatch regular
1911 expression matching through the RegExp object's performMatch function,
1912 to facilitate caching. This replaces registerRegexp and
1915 - Implemented the special '$' aliases (e.g. RegExp.input aliases to
1918 - Moved support for backreferences into the new static hash table
1919 used for other special RegExp properties. Truncated backreferences
1920 at $9 to match IE, FF, and the "What's New in Netscape 1.2?" doc.
1921 (String.replace still supports double-digit backreferences.)
1923 - Tweaked RegExp.prototype.exec to handle ginormous values in lastIndex.
1925 Fixes 11 -- count em, 11 -- JavaScriptCore tests.
1927 * fast/js/regexp-caching-expected.txt: Added.
1928 * fast/js/regexp-caching.html: Added.
1932 * JavaScriptCore.xcodeproj/project.pbxproj: Added regexp_object.lut.h
1933 * kjs/create_hash_table: Tweaked to allow for more exotic characters.
1934 We now rely on the compiler to catch illegal
1937 (KJS::RegExp::RegExp):
1938 * kjs/regexp_object.cpp:
1939 (RegExpProtoFuncImp::callAsFunction):
1940 (RegExpObjectImp::RegExpObjectImp):
1941 (RegExpObjectImp::performMatch):
1942 (RegExpObjectImp::arrayOfMatches):
1943 (RegExpObjectImp::backrefGetter):
1944 (RegExpObjectImp::getLastMatch):
1945 (RegExpObjectImp::getLastParen):
1946 (RegExpObjectImp::getLeftContext):
1947 (RegExpObjectImp::getRightContext):
1948 (RegExpObjectImp::getOwnPropertySlot):
1949 (RegExpObjectImp::getValueProperty):
1950 (RegExpObjectImp::put):
1951 (RegExpObjectImp::putValueProperty):
1952 * kjs/regexp_object.h:
1953 (KJS::RegExpObjectImp::):
1954 * kjs/string_object.cpp:
1955 (substituteBackreferences):
1957 (StringProtoFuncImp::callAsFunction):
1959 2005-10-09 Darin Adler <darin@apple.com>
1961 Reviewed by Maciej; some changes done after review.
1963 - fixed <rdar://problem/4092064> hanging loading page; rte.ie (works in IE and Firefox)
1964 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5280
1965 Date.setMonth fails with negative values
1966 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5154
1967 JSC should switch to _r variants of unix time/date functions
1968 - fixed a few possible overflow cases
1970 Retested all tests to be sure nothing broke; added layout test for bug 5280.
1972 * kjs/config.h: Removed TIME_WITH_SYS_TIME define. Also set HAVE_SYS_TIMEB_H
1973 for the __APPLE__ case (the latter is accurate but irrelevant).
1975 * kjs/date_object.h: Reformatted. Removed unnecessary include of "function_object.h".
1976 Moved declarations of helper classes and functions into the cpp file.
1978 * kjs/date_object.cpp: Removed code at top to define macros to use CoreFoundation instead of
1979 POSIX date functions.
1980 (KJS::styleFromArgString): Tweaked to return early instead of using a variable.
1981 (KJS::formatLocaleDate): Tweaked to check for undefined rather than checking argument count.
1982 (KJS::formatDate): Made parameter const.
1983 (KJS::formatDateUTCVariant): Ditto.
1984 (KJS::formatTime): Ditto.
1985 (KJS::DateProtoFuncImp::callAsFunction): Use gmtime_r and localtime_r instead of gmtime and
1987 (KJS::DateObjectImp::callAsFunction): Use localtime_r instead of localtime.
1988 (KJS::ymdhmsToSeconds): Renamed from ymdhms_to_seconds. Changed computation to avoid possible
1989 overflow if year is an extremely large or small number.
1990 (KJS::makeTime): Removed code to move large month numbers from tm_mon to tm_year; this was
1991 to accomodate CFGregorianDate, which is no longer used (and didn't handle negative values).
1992 (KJS::parseDate): Renamed from KRFCDate_parseDate; changed to return a value in milliseconds
1993 rather than in seconds. Reformatted the code. Changed to use UTF8String() instead of ascii(),
1994 since ascii() is not thread safe. Changed some variables back from int to long to avoid
1995 trouble if the result of strtol does not fit in an int (64-bit issue only).
1997 2005-10-08 Mitz Pettel <opendarwin.org@mitzpettel.com>
2000 Tweaked and landed by Darin.
2002 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5266
2003 Support parenthesized comments in Date.parse()
2005 * kjs/date_object.cpp:
2006 (KJS::skipSpacesAndComments): Take a pointer, and advance it past spaces,
2007 and also past anything enclosed in parentheses.
2008 (KJS::KRFCDate_parseDate): Use skipSpacesAndComments wherever we formerly had
2009 code to skip spaces.
2011 2005-10-08 Justin Haygood <justin@xiondigital.net>
2013 Reviewed, tweaked, and landed by Darin.
2015 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5189
2016 pcre_exec.c fails to compile using MSVC
2017 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5190
2018 KJS config.h adjustment for Win32
2020 * kjs/config.h: Make sure HAVE_MMAP and HAVE_SBRK are off for Win32.
2021 Turn HAVE_ERRNO_H on for Mac OS X. Sort defines so they are easy to compare
2022 with each other. Remove #undef of DEBUG_COLLECTOR.
2023 * pcre/pcre_exec.c: (match): Work around strange MSVC complaint by splitting
2024 the definition of a local variable into a separate declaration and
2027 2005-10-05 Geoffrey Garen <ggaren@apple.com>
2029 - Darin and I rewrote our implementation of the SimpleNumber class
2030 to store number bit patterns in their floating point formats.
2032 My tweaks reviewed by Darin.
2034 ~1% speedup on JS iBench.
2036 * kjs/internal.h: removed obsolete jsNumber declarations.
2037 * kjs/math_object.cpp:
2038 (MathFuncImp::callAsFunction): changed KJS::isNaN to isNaN
2040 (PostfixResolveNode::evaluate): removed obsolete knownToBeInteger
2041 (PostfixBracketNode::evaluate): ditto
2042 (PostfixDotNode::evaluate): ditto
2043 (PrefixResolveNode::evaluate): ditto
2044 (PrefixBracketNode::evaluate): ditto
2045 (PrefixDotNode::evaluate): ditto
2046 (NegateNode::evaluate): ditto
2047 (valueForReadModifyAssignment): ditto
2048 * kjs/number_object.cpp: removed obsolete comment
2049 * kjs/operations.cpp:
2050 (KJS::equal): removed unnecessary isNaN checks
2051 (KJS::strictEqual): ditto
2052 (KJS::add): removed obsolete knownToBeInteger
2054 * kjs/operations.h: removed include of "value.h" to prevent circular reference
2055 * kjs/simple_number.h: removed unnecessary #includes
2056 (KJS::SimpleNumber::make): see above
2057 (KJS::SimpleNumber::is): ditto
2058 (KJS::SimpleNumber::value): ditto
2059 * kjs/string_object.cpp:
2060 (StringProtoFuncImp::callAsFunction): changed KJS::isNaN to isNaN
2061 * kjs/ustring.cpp: removed unnecessary isNaN check
2062 (KJS::UString::toUInt32): ditto
2064 (KJS::jsNumber): removed obsolete jsNumber definitions
2065 (KJS::ConstantValues::init): NaN is no longer a ConstantValue
2066 (KJS::ConstantValues::clear): ditto
2067 (KJS::ConstantValues::mark): ditto
2068 * kjs/value.h: removed obsolete knownToBeInteger
2069 (KJS::jsNaN): now returns a SimpleNumber
2070 (KJS::ValueImp::getUInt32): changed to account for NaN being a SimpleNumber
2071 (KJS::ValueImp::toBoolean): ditto
2072 (KJS::ValueImp::toString): changed to account for +/- 0.0
2073 (KJS::jsZero): changed to reflect that SimpleNumber::make takes a double
2076 (KJS::Number): removed obsolete non-double constructor declarations
2078 2005-10-05 Maciej Stachowiak <mjs@apple.com>
2082 - fixed <rdar://problem/4260481> Remove Reference type from JavaScriptCore
2084 Also fixed some bugs with for..in enumeration while I was at it. object
2085 properties now come before prototype properties and duplicates
2086 between object and prototype are listed only once.
2088 * JavaScriptCore.xcodeproj/project.pbxproj:
2089 * kjs/IdentifierSequencedSet.cpp: Added.
2090 (KJS::IdentifierSequencedSet::IdentifierSequencedSet):
2091 (KJS::IdentifierSequencedSet::deallocateVector):
2092 (KJS::IdentifierSequencedSet::~IdentifierSequencedSet):
2093 (KJS::IdentifierSequencedSet::insert):
2094 * kjs/IdentifierSequencedSet.h: Added.
2095 (KJS::IdentifierSequencedSetIterator::IdentifierSequencedSetIterator):
2096 (KJS::IdentifierSequencedSetIterator::operator*):
2097 (KJS::IdentifierSequencedSetIterator::operator->):
2098 (KJS::IdentifierSequencedSetIterator::operator++):
2099 (KJS::IdentifierSequencedSetIterator::operator==):
2100 (KJS::IdentifierSequencedSetIterator::operator!=):
2101 (KJS::IdentifierSequencedSet::begin):
2102 (KJS::IdentifierSequencedSet::end):
2103 (KJS::IdentifierSequencedSet::size):
2104 * kjs/array_instance.h:
2105 * kjs/array_object.cpp:
2106 (ArrayInstanceImp::getPropertyNames):
2107 (ArrayInstanceImp::setLength):
2108 (ArrayInstanceImp::pushUndefinedObjectsToEnd):
2110 (ForInNode::execute):
2113 (KJS::ObjectImp::getPropertyNames):
2115 * kjs/property_map.cpp:
2116 (KJS::PropertyMap::getEnumerablePropertyNames):
2117 (KJS::PropertyMap::getSparseArrayPropertyNames):
2118 * kjs/property_map.h:
2120 * kjs/protected_reference.h: Removed.
2121 * kjs/reference.cpp: Removed.
2122 * kjs/reference.h: Removed.
2123 * kjs/reference_list.cpp: Removed.
2124 * kjs/reference_list.h: Removed.
2126 (KJS::UString::impl):
2127 * kxmlcore/HashSet.h:
2129 2005-10-04 Eric Seidel <eseidel@apple.com>
2133 Code cleanup, which resulted in a small win on iBench.
2136 (KJS::tryGetAndCallProperty): new static inline
2137 (KJS::ObjectImp::defaultValue): code cleanup
2139 2005-10-03 Maciej Stachowiak <mjs@apple.com>
2141 Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
2143 - more Linux build fixes
2145 * kjs/operations.cpp:
2146 * kxmlcore/FastMalloc.h:
2147 * kxmlcore/TCSystemAlloc.cpp:
2148 (TCMalloc_SystemAlloc):
2150 2005-10-03 Maciej Stachowiak <mjs@apple.com>
2152 Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
2154 http://bugzilla.opendarwin.org/show_bug.cgi?id=5174
2155 Add support for compiling on Linux (likely to help for other POSIX systems too)
2157 * kjs/collector.cpp:
2158 (KJS::Collector::markCurrentThreadConservatively):
2159 (KJS::Collector::markOtherThreadConservatively):
2161 * kjs/date_object.cpp:
2163 (KJS::formatDateUTCVariant):
2165 (KJS::timeZoneOffset):
2166 (KJS::DateProtoFuncImp::callAsFunction):
2167 (KJS::DateObjectImp::construct):
2168 (KJS::DateObjectImp::callAsFunction):
2170 * kjs/identifier.cpp:
2172 (KJS::initializeInterpreterLock):
2173 (KJS::lockInterpreter):
2174 (KJS::unlockInterpreter):
2175 (KJS::UndefinedImp::toPrimitive):
2176 (KJS::UndefinedImp::toBoolean):
2177 (KJS::UndefinedImp::toNumber):
2178 (KJS::UndefinedImp::toString):
2179 (KJS::NullImp::toPrimitive):
2180 (KJS::NullImp::toBoolean):
2181 (KJS::NullImp::toNumber):
2182 (KJS::NullImp::toString):
2183 (KJS::BooleanImp::toPrimitive):
2184 (KJS::BooleanImp::toBoolean):
2185 (KJS::BooleanImp::toNumber):
2186 (KJS::BooleanImp::toString):
2187 (KJS::StringImp::toPrimitive):
2188 (KJS::StringImp::toBoolean):
2189 (KJS::StringImp::toNumber):
2190 (KJS::StringImp::toString):
2192 * kjs/protected_values.cpp:
2194 2005-10-03 Maciej Stachowiak <mjs@apple.com>
2196 - fix Development build after last checkin
2198 * kxmlcore/FastMalloc.cpp:
2199 (KXMLCore::fastMallocRegisterThread):
2201 2005-10-02 Maciej Stachowiak <mjs@apple.com>
2205 <rdar://problem/4283967> REGRESSION: 3% regression on PLT from new FastMalloc
2206 http://bugzilla.opendarwin.org/show_bug.cgi?id=5243
2208 A number of optimizations to the new threadsafe malloc that make it actually as fast
2209 as dlmalloc (I measured wrong before) and as memory-efficient as the system malloc.
2211 - use fastMalloc for everything - it now gets applied to all new/delete allocations
2212 via a private inline operator new that is now included into every file via config.h.
2214 - tweaked some of the numeric parameters for size classes and amount of wasted memory
2215 allowed per allocation - this saves on memory use and consequently improves speed.
2217 - so long as the allocator is not being used on background threads, get the per-thread
2218 cache from a global variable instead of from pthread_getspecific, since the latter is slow.
2220 - inline more functions, and force the ones GCC refuses to inline with
2221 attribute(always_inline), nearly all of these have one call site so inlining them has
2224 - use some tricks to calculate allocation size more efficiently and fewer times for small
2225 allocations, to avoid hitting the huge size table array.
2227 - avoid hitting the per-thread cache on code paths that don't need it.
2229 - implement inline assembly version of spinlock for PowerPC (was already done for x86)
2231 * bindings/NP_jsobject.cpp:
2232 * bindings/c/c_class.cpp:
2233 * bindings/c/c_instance.cpp:
2234 * bindings/c/c_runtime.cpp:
2235 * bindings/c/c_utility.cpp:
2236 * bindings/jni/jni_class.cpp:
2237 * bindings/jni/jni_instance.cpp:
2238 * bindings/jni/jni_jsobject.cpp:
2239 * bindings/jni/jni_objc.mm:
2240 * bindings/jni/jni_runtime.cpp:
2241 * bindings/jni/jni_utility.cpp:
2242 * bindings/npruntime.cpp:
2243 * bindings/objc/WebScriptObject.mm:
2244 * bindings/objc/objc_class.mm:
2245 * bindings/objc/objc_instance.mm:
2246 * bindings/objc/objc_runtime.mm:
2247 * bindings/objc/objc_utility.mm:
2248 * bindings/runtime.cpp:
2249 * bindings/runtime_array.cpp:
2250 * bindings/runtime_method.cpp:
2251 * bindings/runtime_object.cpp:
2252 * bindings/runtime_root.cpp:
2253 * bindings/testbindings.cpp:
2254 * bindings/testbindings.mm:
2255 * kjs/array_object.cpp:
2256 (ArrayInstanceImp::ArrayInstanceImp):
2257 (ArrayInstanceImp::~ArrayInstanceImp):
2258 (ArrayInstanceImp::resizeStorage):
2259 * kjs/bool_object.cpp:
2260 * kjs/collector.cpp:
2261 (KJS::Collector::registerThread):
2264 * kjs/error_object.cpp:
2266 * kjs/function_object.cpp:
2267 * kjs/identifier.cpp:
2268 (KJS::Identifier::rehash):
2270 (KJS::Parser::saveNewNode):
2271 (KJS::clearNewNodes):
2272 * kjs/interpreter.cpp:
2274 (Lexer::doneParsing):
2275 (Lexer::makeIdentifier):
2276 (Lexer::makeUString):
2278 * kjs/math_object.cpp:
2281 * kjs/nodes2string.cpp:
2282 * kjs/number_object.cpp:
2283 (integer_part_noexp):
2286 * kjs/object_object.cpp:
2287 * kjs/property_map.cpp:
2288 * kjs/property_slot.cpp:
2289 * kjs/protected_values.cpp:
2290 (KJS::ProtectedValues::rehash):
2291 * kjs/reference.cpp:
2292 * kjs/reference_list.cpp:
2294 * kjs/regexp_object.cpp:
2295 * kjs/scope_chain.cpp:
2296 * kjs/scope_chain.h:
2297 * kjs/string_object.cpp:
2301 * kxmlcore/Assertions.mm:
2302 * kxmlcore/FastMalloc.cpp:
2303 (KXMLCore::InitSizeClasses):
2304 (KXMLCore::DLL_IsEmpty):
2305 (KXMLCore::DLL_Prepend):
2306 (KXMLCore::TCMalloc_Central_FreeList::Insert):
2307 (KXMLCore::TCMalloc_Central_FreeList::Remove):
2308 (KXMLCore::TCMalloc_Central_FreeList::Populate):
2309 (KXMLCore::TCMalloc_ThreadCache::Allocate):
2310 (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
2311 (KXMLCore::fastMallocRegisterThread):
2312 (KXMLCore::TCMalloc_ThreadCache::GetCache):
2313 (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
2314 (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2315 (KXMLCore::do_malloc):
2316 (KXMLCore::do_free):
2317 (KXMLCore::realloc):
2318 * kxmlcore/FastMalloc.h:
2322 (operator delete[]):
2323 * kxmlcore/HashTable.cpp:
2324 * kxmlcore/TCSpinLock.h:
2325 (TCMalloc_SpinLock::Lock):
2326 (TCMalloc_SpinLock::Unlock):
2327 (TCMalloc_SlowLock):
2328 * kxmlcore/TCSystemAlloc.cpp:
2330 2005-09-30 Geoffrey Garen <ggaren@apple.com>
2332 - Second cut at fixing <rdar://problem/4275206> Denver Regression: Seed:
2333 Past Editions of Opinions display "NAN/Undefined" for www.washingtonpost.com
2337 * kjs/date_object.cpp:
2338 (KJS::KRFCDate_parseDate): Intead of creating a timezone when one isn't specified,
2339 just rely on the fallback logic, which will do it for you. Also, return invalidDate
2340 if the date includes trailing garbage. (Somewhat accidentally, the timezone logic
2341 used to catch trailing garbage.)
2343 Added test case to fast/js/date-parse-test.html.
2345 2005-09-29 Eric Seidel <eseidel@apple.com>
2346 Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
2350 Fix JSC memory smasher in TOT.
2351 http://bugzilla.opendarwin.org/show_bug.cgi?id=5176
2356 2005-09-29 Eric Seidel <eseidel@apple.com>
2357 Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
2361 * JavaScriptCore.xcodeproj/project.pbxproj:
2362 Build fix for JSC+SVG after 5161.
2363 http://bugzilla.opendarwin.org/show_bug.cgi?id=5179
2365 2005-09-28 Geoffrey Garen <ggaren@apple.com>
2367 - Fixed <rdar://problem/4275206> Denver Regression: Seed: Past Editions of Opinions display
2368 "NAN/Undefined" for www.washingtonpost.com
2372 * kjs/date_object.cpp:
2373 (KJS::KRFCDate_parseDate): If the timezone isn't specified, rather than returning
2374 invalidDate, substitute the local timezone. This matches the behavior of FF/IE.
2376 2005-09-28 Maciej Stachowiak <mjs@apple.com>
2378 Patch from George Staikos, reviewed by me.
2380 - fixed some compile issues on Linux
2382 * kjs/property_slot.h:
2383 * kjs/simple_number.h:
2385 2005-09-27 Maciej Stachowiak <mjs@apple.com>
2389 - move HashMap/HashSet code down to JavaScriptCore
2390 http://bugzilla.opendarwin.org/show_bug.cgi?id=5161
2392 * JavaScriptCore.xcodeproj/project.pbxproj:
2394 (KJS::interpreterMap): Function that fetches the interpreter map on demand.
2395 (KJS::InterpreterImp::InterpreterImp): Replace use of InterpreterMap
2396 class with an appropriate HashMap.
2397 (KJS::InterpreterImp::clear): ditto
2398 (KJS::InterpreterImp::interpreterWithGlobalObject): ditto
2399 * kjs/interpreter_map.cpp: Removed.
2400 * kjs/interpreter_map.h: Removed.
2402 The HashMap/HashSet code (copied and slightly tweaked from WebCore)
2404 * kxmlcore/HashFunctions.h: Added.
2408 (KXMLCore::PointerHash::hash):
2409 (KXMLCore::PointerHash::equal):
2410 * kxmlcore/HashMap.h: Added.
2411 (KXMLCore::extractFirst):
2412 (KXMLCore::HashMap::HashMap):
2414 (KXMLCore::::capacity):
2415 (KXMLCore::::isEmpty):
2416 (KXMLCore::::begin):
2419 (KXMLCore::::contains):
2422 (KXMLCore::::remove):
2423 (KXMLCore::::clear):
2424 (KXMLCore::deleteAllValues):
2425 * kxmlcore/HashMapPtrSpec.h: Added.
2426 (KXMLCore::PointerHashIteratorAdapter::PointerHashIteratorAdapter):
2427 (KXMLCore::PointerHashIteratorAdapter::operator*):
2428 (KXMLCore::PointerHashIteratorAdapter::operator->):
2429 (KXMLCore::PointerHashIteratorAdapter::operator++):
2430 (KXMLCore::PointerHashIteratorAdapter::operator==):
2431 (KXMLCore::PointerHashIteratorAdapter::operator!=):
2432 (KXMLCore::PointerHashConstIteratorAdapter::PointerHashConstIteratorAdapter):
2433 (KXMLCore::PointerHashConstIteratorAdapter::operator*):
2434 (KXMLCore::PointerHashConstIteratorAdapter::operator->):
2435 (KXMLCore::PointerHashConstIteratorAdapter::operator++):
2436 (KXMLCore::PointerHashConstIteratorAdapter::operator==):
2437 (KXMLCore::PointerHashConstIteratorAdapter::operator!=):
2439 * kxmlcore/HashSet.h: Added.
2440 (KXMLCore::identityExtract):
2441 (KXMLCore::convertAdapter):
2442 (KXMLCore::HashSet::HashSet):
2444 (KXMLCore::::capacity):
2445 (KXMLCore::::isEmpty):
2446 (KXMLCore::::begin):
2449 (KXMLCore::::contains):
2450 (KXMLCore::::insert):
2451 (KXMLCore::::remove):
2452 (KXMLCore::::clear):
2453 * kxmlcore/HashTable.cpp: Added.
2454 (KXMLCore::HashTableStats::~HashTableStats):
2455 (KXMLCore::HashTableStats::recordCollisionAtCount):
2456 * kxmlcore/HashTable.h: Added.
2457 (KXMLCore::HashTableIterator::skipEmptyBuckets):
2458 (KXMLCore::HashTableIterator::HashTableIterator):
2459 (KXMLCore::HashTableIterator::operator*):
2460 (KXMLCore::HashTableIterator::operator->):
2461 (KXMLCore::HashTableIterator::operator++):
2462 (KXMLCore::HashTableIterator::operator==):
2463 (KXMLCore::HashTableIterator::operator!=):
2464 (KXMLCore::HashTableConstIterator::HashTableConstIterator):
2465 (KXMLCore::HashTableConstIterator::operator*):
2466 (KXMLCore::HashTableConstIterator::operator->):
2467 (KXMLCore::HashTableConstIterator::skipEmptyBuckets):
2468 (KXMLCore::HashTableConstIterator::operator++):
2469 (KXMLCore::HashTableConstIterator::operator==):
2470 (KXMLCore::HashTableConstIterator::operator!=):
2471 (KXMLCore::HashTable::HashTable):
2472 (KXMLCore::HashTable::~HashTable):
2473 (KXMLCore::HashTable::begin):
2474 (KXMLCore::HashTable::end):
2475 (KXMLCore::HashTable::size):
2476 (KXMLCore::HashTable::capacity):
2477 (KXMLCore::HashTable::insert):
2478 (KXMLCore::HashTable::isEmptyBucket):
2479 (KXMLCore::HashTable::isDeletedBucket):
2480 (KXMLCore::HashTable::isEmptyOrDeletedBucket):
2481 (KXMLCore::HashTable::hash):
2482 (KXMLCore::HashTable::equal):
2483 (KXMLCore::HashTable::identityConvert):
2484 (KXMLCore::HashTable::extractKey):
2485 (KXMLCore::HashTable::lookup):
2486 (KXMLCore::HashTable::shouldExpand):
2487 (KXMLCore::HashTable::mustRehashInPlace):
2488 (KXMLCore::HashTable::shouldShrink):
2489 (KXMLCore::HashTable::shrink):
2490 (KXMLCore::HashTable::clearBucket):
2491 (KXMLCore::HashTable::deleteBucket):
2492 (KXMLCore::HashTable::makeLookupResult):
2493 (KXMLCore::HashTable::makeIterator):
2494 (KXMLCore::HashTable::makeConstIterator):
2495 (KXMLCore::::lookup):
2496 (KXMLCore::::insert):
2497 (KXMLCore::::reinsert):
2499 (KXMLCore::::contains):
2500 (KXMLCore::::remove):
2501 (KXMLCore::::allocateTable):
2502 (KXMLCore::::expand):
2503 (KXMLCore::::rehash):
2504 (KXMLCore::::clear):
2505 (KXMLCore::::HashTable):
2507 (KXMLCore::::operator):
2508 (KXMLCore::::checkTableConsistency):
2509 (KXMLCore::::checkTableConsistencyExceptSize):
2510 * kxmlcore/HashTraits.h: Added.
2511 (KXMLCore::HashTraits::emptyValue):
2513 (KXMLCore::PairHashTraits::emptyValue):
2514 (KXMLCore::PairHashTraits::deletedValue):
2516 2005-09-27 Darin Adler <darin@apple.com>
2520 - update grammar to fix conflicts; fixes one of our test cases
2521 because it resolves the relationship between function expressions
2522 and declarations in the way required by the ECMA specification
2524 * kjs/grammar.y: Added lots of new grammar rules so we have no conflicts.
2525 A new set of rules for "no bracket or function at start of expression" and
2526 another set of rules for "no in anywhere in expression". Also simplified the
2527 handling of try to use only a single node and used operator precedence to
2528 get rid of the conflict in handling of if and else. Also used a macro to
2529 streamline the handling of automatic semicolons and changed parenthesis
2530 handling to use a virtual function.
2532 * kjs/nodes.h: Added nodeInsideAllParens, removed unused abortStatement.
2533 (KJS::TryNode::TryNode): Updated to hold catch and finally blocks directly instead
2534 of using a special node for each.
2536 (Node::createErrorCompletion): Added. Used instead of throwError when creating errors
2537 that should not be in a completion rather than an ExecState.
2538 (Node::throwUndefinedVariableError): Added. Sets source location unlike the call it
2540 (Node::nodeInsideAllParens): Added.
2541 (GroupNode::nodeInsideAllParens): Added.
2542 (StatListNode::execute): Removed code to move exceptions into completion objects;
2543 that's now done solely by the KJS_CHECKEXCEPTION macro.
2544 (TryNode::execute): Include execution of catch and finally here rather than using
2546 (FuncDeclNode::execute): Moved here, no longer inline.
2547 * kjs/nodes2string.cpp:
2548 (TryNode::streamTo): Updated for change.
2549 (FuncDeclNode::streamTo): Ditto.
2550 (FuncExprNode::streamTo): Ditto.
2552 * kjs/kjs-test: Removed. Was part of "make check".
2553 * kjs/kjs-test.chk: Ditto.
2554 * kjs/test.js: Ditto.
2556 * tests/mozilla/expected.html: Updated because one more test succeeds.
2558 2005-09-27 Adele Peterson <adele@apple.com>
2562 Changed ints to size_t where appropriate.
2564 * kjs/collector.cpp:
2565 (KJS::Collector::allocate):
2566 (KJS::Collector::markStackObjectsConservatively):
2567 (KJS::Collector::collect):
2568 (KJS::Collector::size):
2569 (KJS::Collector::numInterpreters):
2570 (KJS::Collector::numGCNotAllowedObjects):
2571 (KJS::Collector::numReferencedObjects):
2574 2005-09-27 Eric Seidel <eseidel@apple.com>
2578 * JavaScriptCore.xcodeproj/project.pbxproj: fix after malloc changes.
2580 2005-09-27 Eric Seidel <eseidel@apple.com>
2585 (FuncExprNode::evaluate): Now sets .constructor properly.
2586 Test cases added to WebCore/layout-tests.
2587 http://bugzilla.opendarwin.org/show_bug.cgi?id=3537
2589 2005-09-26 Maciej Stachowiak <mjs@apple.com>
2593 - replace dlmalloc with tcmalloc
2594 http://bugzilla.opendarwin.org/show_bug.cgi?id=5145
2596 I also moved SharedPtr and the assertion code from WebCore into a
2597 new kxmlcore directory.
2599 * JavaScriptCore.xcodeproj/project.pbxproj:
2600 * kjs/collector.cpp:
2601 (KJS::Collector::allocate):
2602 (KJS::Collector::collect):
2604 * kjs/fast_malloc.cpp: Removed.
2605 * kjs/fast_malloc.h: Removed.
2608 * kjs/function_object.cpp:
2609 * kjs/identifier.cpp:
2610 (KJS::Identifier::add):
2614 * kjs/nodes2string.cpp:
2615 * kjs/property_map.cpp:
2616 (KJS::PropertyMap::~PropertyMap):
2617 (KJS::PropertyMap::rehash):
2618 * kjs/scope_chain.h:
2619 * kjs/shared_ptr.h: Removed.
2620 * kjs/string_object.cpp:
2621 (StringObjectFuncImp::callAsFunction):
2623 (KJS::UString::Rep::createCopying):
2624 (KJS::UString::Rep::destroy):
2625 (KJS::UString::expandCapacity):
2626 (KJS::UString::expandPreCapacity):
2627 (KJS::UString::UString):
2628 (KJS::UString::spliceSubstringsWithSeparators):
2629 (KJS::UString::append):
2630 (KJS::UString::operator=):
2631 (KJS::UString::detach):
2633 * kxmlcore/Assertions.h: Added.
2634 * kxmlcore/Assertions.mm: Added.
2635 * kxmlcore/FastMalloc.cpp: Added.
2636 (KXMLCore::LgFloor):
2637 (KXMLCore::SizeClass):
2638 (KXMLCore::ByteSizeForClass):
2639 (KXMLCore::InitSizeClasses):
2640 (KXMLCore::MetaDataAlloc):
2641 (KXMLCore::PageHeapAllocator::Init):
2642 (KXMLCore::PageHeapAllocator::New):
2643 (KXMLCore::PageHeapAllocator::Delete):
2644 (KXMLCore::PageHeapAllocator::inuse):
2646 (KXMLCore::AllocationSize):
2648 (KXMLCore::NewSpan):
2649 (KXMLCore::DeleteSpan):
2650 (KXMLCore::DLL_Init):
2651 (KXMLCore::DLL_Remove):
2652 (KXMLCore::DLL_IsEmpty):
2653 (KXMLCore::DLL_Length):
2654 (KXMLCore::DLL_Print):
2655 (KXMLCore::DLL_Prepend):
2656 (KXMLCore::DLL_InsertOrdered):
2658 (KXMLCore::TCMalloc_PageHeap::GetDescriptor):
2659 (KXMLCore::TCMalloc_PageHeap::SystemBytes):
2660 (KXMLCore::TCMalloc_PageHeap::FreeBytes):
2661 (KXMLCore::TCMalloc_PageHeap::RecordSpan):
2662 (KXMLCore::TCMalloc_PageHeap::TCMalloc_PageHeap):
2663 (KXMLCore::TCMalloc_PageHeap::New):
2664 (KXMLCore::TCMalloc_PageHeap::Split):
2665 (KXMLCore::TCMalloc_PageHeap::Carve):
2666 (KXMLCore::TCMalloc_PageHeap::Delete):
2667 (KXMLCore::TCMalloc_PageHeap::RegisterSizeClass):
2668 (KXMLCore::TCMalloc_PageHeap::Dump):
2669 (KXMLCore::TCMalloc_PageHeap::GrowHeap):
2670 (KXMLCore::TCMalloc_PageHeap::Check):
2671 (KXMLCore::TCMalloc_PageHeap::CheckList):
2672 (KXMLCore::TCMalloc_ThreadCache_FreeList::Init):
2673 (KXMLCore::TCMalloc_ThreadCache_FreeList::length):
2674 (KXMLCore::TCMalloc_ThreadCache_FreeList::empty):
2675 (KXMLCore::TCMalloc_ThreadCache_FreeList::lowwatermark):
2676 (KXMLCore::TCMalloc_ThreadCache_FreeList::clear_lowwatermark):
2677 (KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
2678 (KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
2679 (KXMLCore::TCMalloc_ThreadCache::freelist_length):
2680 (KXMLCore::TCMalloc_ThreadCache::Size):
2681 (KXMLCore::TCMalloc_Central_FreeList::length):
2682 (KXMLCore::TCMalloc_Central_FreeList::Init):
2683 (KXMLCore::TCMalloc_Central_FreeList::Insert):
2684 (KXMLCore::TCMalloc_Central_FreeList::Remove):
2685 (KXMLCore::TCMalloc_Central_FreeList::Populate):
2686 (KXMLCore::TCMalloc_ThreadCache::SampleAllocation):
2687 (KXMLCore::TCMalloc_ThreadCache::Init):
2688 (KXMLCore::TCMalloc_ThreadCache::Cleanup):
2689 (KXMLCore::TCMalloc_ThreadCache::Allocate):
2690 (KXMLCore::TCMalloc_ThreadCache::Deallocate):
2691 (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
2692 (KXMLCore::TCMalloc_ThreadCache::ReleaseToCentralCache):
2693 (KXMLCore::TCMalloc_ThreadCache::Scavenge):
2694 (KXMLCore::TCMalloc_ThreadCache::GetCache):
2695 (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
2696 (KXMLCore::TCMalloc_ThreadCache::PickNextSample):
2697 (KXMLCore::TCMalloc_ThreadCache::InitModule):
2698 (KXMLCore::TCMalloc_ThreadCache::InitTSD):
2699 (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2700 (KXMLCore::TCMalloc_ThreadCache::DeleteCache):
2701 (KXMLCore::TCMalloc_ThreadCache::RecomputeThreadCacheSize):
2702 (KXMLCore::TCMalloc_ThreadCache::Print):
2703 (KXMLCore::ExtractStats):
2704 (KXMLCore::DumpStats):
2705 (KXMLCore::PrintStats):
2706 (KXMLCore::DumpStackTraces):
2707 (KXMLCore::TCMallocImplementation::GetStats):
2708 (KXMLCore::TCMallocImplementation::ReadStackTraces):
2709 (KXMLCore::TCMallocImplementation::GetNumericProperty):
2710 (KXMLCore::TCMallocImplementation::SetNumericProperty):
2711 (KXMLCore::DoSampledAllocation):
2712 (KXMLCore::do_malloc):
2713 (KXMLCore::do_free):
2714 (KXMLCore::do_memalign):
2715 (KXMLCore::TCMallocGuard::TCMallocGuard):
2716 (KXMLCore::TCMallocGuard::~TCMallocGuard):
2721 (KXMLCore::realloc):
2722 (KXMLCore::memalign):
2723 (KXMLCore::posix_memalign):
2725 (KXMLCore::pvalloc):
2726 (KXMLCore::malloc_stats):
2727 (KXMLCore::mallopt):
2728 (KXMLCore::mallinfo):
2729 * kxmlcore/FastMalloc.h: Added.
2730 (KXMLCore::FastAllocated::operator new):
2731 (KXMLCore::FastAllocated::operator delete):
2732 (KXMLCore::FastAllocated::operator new[]):
2733 (KXMLCore::FastAllocated::operator delete[]):
2734 * kxmlcore/SharedPtr.h: Added.
2735 (KXMLCore::SharedPtr::SharedPtr):
2736 (KXMLCore::SharedPtr::~SharedPtr):
2737 (KXMLCore::SharedPtr::isNull):
2738 (KXMLCore::SharedPtr::notNull):
2739 (KXMLCore::SharedPtr::reset):
2740 (KXMLCore::SharedPtr::get):
2741 (KXMLCore::SharedPtr::operator*):
2742 (KXMLCore::SharedPtr::operator->):
2743 (KXMLCore::SharedPtr::operator!):
2744 (KXMLCore::SharedPtr::operator bool):
2745 (KXMLCore::::operator):
2746 (KXMLCore::operator==):
2747 (KXMLCore::operator!=):
2748 (KXMLCore::static_pointer_cast):
2749 (KXMLCore::const_pointer_cast):
2750 * kxmlcore/TCPageMap.h: Added.
2751 (TCMalloc_PageMap1::TCMalloc_PageMap1):
2752 (TCMalloc_PageMap1::Ensure):
2753 (TCMalloc_PageMap1::get):
2754 (TCMalloc_PageMap1::set):
2755 (TCMalloc_PageMap2::TCMalloc_PageMap2):
2756 (TCMalloc_PageMap2::get):
2757 (TCMalloc_PageMap2::set):
2758 (TCMalloc_PageMap2::Ensure):
2759 (TCMalloc_PageMap3::NewNode):
2760 (TCMalloc_PageMap3::TCMalloc_PageMap3):
2761 (TCMalloc_PageMap3::get):
2762 (TCMalloc_PageMap3::set):
2763 (TCMalloc_PageMap3::Ensure):
2764 * kxmlcore/TCSpinLock.h: Added.
2765 (TCMalloc_SpinLock::Init):
2766 (TCMalloc_SpinLock::Finalize):
2767 (TCMalloc_SpinLock::Lock):
2768 (TCMalloc_SpinLock::Unlock):
2769 (TCMalloc_SlowLock):
2770 (TCMalloc_SpinLockHolder::TCMalloc_SpinLockHolder):
2771 (TCMalloc_SpinLockHolder::~TCMalloc_SpinLockHolder):
2772 * kxmlcore/TCSystemAlloc.cpp: Added.
2776 (TCMalloc_SystemAlloc):
2777 * kxmlcore/TCSystemAlloc.h: Added.
2779 2005-09-23 Maciej Stachowiak <mjs@apple.com>
2783 <rdar://problem/4260479> Finish deploying PropertySlot in the interpreter
2784 http://bugzilla.opendarwin.org/show_bug.cgi?id=5112
2786 Convert postfix, prefix, delete, prefix, and for..in expressions to use
2787 PropertySlot-based lookup instead of evaluateReference.
2789 3% speedup on JS iBench.
2791 Fixed two of the JS tests:
2792 * tests/mozilla/expected.html:
2796 (PostfixResolveNode::evaluate):
2797 (PostfixBracketNode::evaluate):
2798 (PostfixDotNode::evaluate):
2799 (DeleteResolveNode::evaluate):
2800 (DeleteBracketNode::evaluate):
2801 (DeleteDotNode::evaluate):
2802 (DeleteValueNode::evaluate):
2803 (typeStringForValue):
2804 (TypeOfResolveNode::evaluate):
2805 (TypeOfValueNode::evaluate):
2806 (PrefixResolveNode::evaluate):
2807 (PrefixBracketNode::evaluate):
2808 (PrefixDotNode::evaluate):
2809 (ForInNode::execute):
2811 (KJS::PostfixResolveNode::PostfixResolveNode):
2812 (KJS::PostfixBracketNode::PostfixBracketNode):
2813 (KJS::PostfixDotNode::PostfixDotNode):
2814 (KJS::DeleteResolveNode::DeleteResolveNode):
2815 (KJS::DeleteBracketNode::DeleteBracketNode):
2816 (KJS::DeleteDotNode::DeleteDotNode):
2817 (KJS::DeleteValueNode::DeleteValueNode):
2818 (KJS::TypeOfResolveNode::TypeOfResolveNode):
2819 (KJS::TypeOfValueNode::TypeOfValueNode):
2820 (KJS::PrefixResolveNode::PrefixResolveNode):
2821 (KJS::PrefixBracketNode::PrefixBracketNode):
2822 (KJS::PrefixDotNode::PrefixDotNode):
2823 * kjs/nodes2string.cpp:
2824 (PostfixResolveNode::streamTo):
2825 (PostfixBracketNode::streamTo):
2826 (PostfixDotNode::streamTo):
2827 (DeleteResolveNode::streamTo):
2828 (DeleteBracketNode::streamTo):
2829 (DeleteDotNode::streamTo):
2830 (DeleteValueNode::streamTo):
2831 (TypeOfValueNode::streamTo):
2832 (TypeOfResolveNode::streamTo):
2833 (PrefixResolveNode::streamTo):
2834 (PrefixBracketNode::streamTo):
2835 (PrefixDotNode::streamTo):
2836 * kjs/reference.cpp:
2837 (KJS::Reference::Reference):
2838 (KJS::Reference::getPropertyName):
2839 (KJS::Reference::getValue):
2840 (KJS::Reference::deleteValue):
2843 2005-09-23 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
2845 Reviewed and landed by Darin.
2847 - a Windows-specific file
2849 * os-win32/stdint.h: Added. We plan to remove dependency on the <stdint.h> types,
2850 and if we do so, we will remove this file.
2852 2005-09-22 Geoffrey Garen <ggaren@apple.com>
2854 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5053
2855 Need to restore int/long changes to simple_number.h
2857 Reviewed by darin and mjs.
2859 * kjs/simple_number.h: changed enums to indenpendent constants to clarify types
2860 (KJS::isNegativeZero): changed to static function - no reason to export
2861 (KJS::SimpleNumber::rightShiftSignExtended): new function for clarity
2862 (KJS::SimpleNumber::make): specified cast as reinterpret_cast
2863 (KJS::SimpleNumber::is): changed to use uintptr_t for portability
2864 (KJS::SimpleNumber::value): changed to use uintptr_t and rightShiftSignExtended
2865 (KJS::SimpleNumber::fits): inverted tests - probably only a performance win for double
2866 (KJS::SimpleNumber::integerFits): ditto
2868 2005-09-20 Maciej Stachowiak <mjs@apple.com>
2870 Reviewed by Geoff and partly by Darin.
2872 - fixed http://bugzilla.opendarwin.org/post_bug.cgi
2873 (Reduce conflicts in JavaScriptCore grammar)
2875 This change gets us down from over 200 shift/reduce and 45 reduce/reduce to
2876 9 shift/reduce and 45 reduce/reduce.
2879 * kjs/grammar_types.h: Removed.
2882 (KJS::Node::isGroupNode):
2883 (KJS::Node::isLocation):
2884 (KJS::Node::isResolveNode):
2885 (KJS::Node::isBracketAccessorNode):
2886 (KJS::Node::isDotAccessorNode):
2887 (KJS::ResolveNode::isLocation):
2888 (KJS::ResolveNode::isResolveNode):
2889 (KJS::ResolveNode::identifier):
2890 (KJS::GroupNode::isGroupNode):
2891 (KJS::GroupNode::leafNode):
2892 (KJS::BracketAccessorNode::isLocation):
2893 (KJS::BracketAccessorNode::isBracketAccessorNode):
2894 (KJS::BracketAccessorNode::base):
2895 (KJS::BracketAccessorNode::subscript):
2896 (KJS::DotAccessorNode::isLocation):
2897 (KJS::DotAccessorNode::isDotAccessorNode):
2898 (KJS::DotAccessorNode::base):
2899 (KJS::DotAccessorNode::identifier):
2900 (KJS::FuncExprNode::FuncExprNode):
2901 (KJS::FuncExprNode::identifier):
2902 (KJS::FuncDeclNode::FuncDeclNode):
2903 (KJS::FuncDeclNode::execute):
2905 2005-09-20 Geoffrey Garen <ggaren@apple.com>
2907 - Oops. The 4263434 change was only appropriate on the branch. Rolling out.
2912 (KJS::InterpreterImp::mark):
2914 2005-09-20 Geoffrey Garen <ggaren@apple.com>
2916 - More changes needed to fix <rdar://problem/4214783> 8F29 REGRESSION(Denver/Chardonnay):
2917 kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in
2920 Added InterpreterLocks in some places in the bindings we missed before.
2924 * bindings/runtime_root.cpp:
2925 (KJS::Bindings::addNativeReference):
2926 (KJS::Bindings::removeNativeReference):
2927 (RootObject::removeAllNativeReferences):
2928 * bindings/runtime_root.h:
2929 (KJS::Bindings::RootObject::~RootObject):
2930 (KJS::Bindings::RootObject::setRootObjectImp):
2932 2005-09-20 Geoffrey Garen <ggaren@apple.com>
2934 - Fixed <rdar://problem/4263434> <rdar://problem/4263434> Denver 8F29 Regression:
2935 KJS::InterpreterImp::mark() crash
2937 Fix by mjs, review by me.
2940 (KJS::InterpreterImp::mark): Added a null check on globExec in case a
2941 garbage collection occurs inside InterpreterImp::globalInit (called
2942 from InterpreterImp::InterpreterImp), at which point globExec has not yet been initialized.
2944 2005-09-20 Geoffrey Garen <ggaren@apple.com>
2946 - Rolled in fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4892
2947 Date constructor has problems with months larger than 11
2951 * layout-tests/fast/js/date-big-constructor-expected.txt: Added.
2952 * layout-tests/fast/js/date-big-constructor.html: Added.
2956 * kjs/date_object.cpp:
2957 (KJS::fillStructuresUsingDateArgs):
2960 2005-09-19 Geoffrey Garen <ggaren@apple.com>
2962 - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5028
2963 9 layout tests fail following the change from long to int
2965 - Rolled out changes to simple_number.h, and added fits(long long)
2966 and SimpleNumber::fits(unsigned long long) to the old system.
2970 * kjs/simple_number.h:
2971 (KJS::SimpleNumber::):
2972 (KJS::SimpleNumber::value):
2973 (KJS::SimpleNumber::fits):
2974 (KJS::SimpleNumber::integerFits):
2975 (KJS::SimpleNumber::make):
2977 2005-09-14 Maciej Stachowiak <mjs@apple.com>
2981 - fixed <rdar://problem/4214783> REGRESSION: kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in the installer)
2983 Make sure to lock using the InterpreterLock class in all places that need it
2984 (including anything that uses the collector, the parser, the protect count hash table,
2985 and anything that allocates via fast_malloc).
2987 Also added assertions to ensure that the locking rules are followed for the relevant
2991 * bindings/NP_jsobject.cpp:
2992 (identifierFromNPIdentifier):
2997 (_NPN_RemoveProperty):
3000 (_NPN_SetException):
3001 * bindings/jni/jni_jsobject.cpp:
3004 (JSObject::getMember):
3005 (JSObject::setMember):
3006 (JSObject::removeMember):
3007 (JSObject::getSlot):
3008 (JSObject::setSlot):
3009 (JSObject::toString):
3010 (JSObject::convertJObjectToValue):
3011 * bindings/objc/WebScriptObject.mm:
3012 (-[WebScriptObject callWebScriptMethod:withArguments:]):
3013 (-[WebScriptObject evaluateWebScript:]):
3014 (-[WebScriptObject setValue:forKey:]):
3015 (-[WebScriptObject valueForKey:]):
3016 (-[WebScriptObject removeWebScriptKey:]):
3017 (-[WebScriptObject stringRepresentation]):
3018 (-[WebScriptObject webScriptValueAtIndex:]):
3019 (-[WebScriptObject setWebScriptValueAtIndex:value:]):
3020 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
3021 * bindings/runtime.cpp:
3022 (Instance::createRuntimeObject):
3023 * bindings/runtime_root.h:
3024 * bindings/testbindings.cpp:
3026 * bindings/testbindings.mm:
3028 * kjs/fast_malloc.cpp:
3029 (KJS::kjs_fast_malloc):
3030 (KJS::kjs_fast_calloc):
3031 (KJS::kjs_fast_free):
3032 (KJS::kjs_fast_realloc):
3033 * kjs/fast_malloc.h:
3036 (InterpreterImp::InterpreterImp):
3037 (InterpreterImp::clear):
3038 (InterpreterImp::mark):
3039 (InterpreterImp::checkSyntax):
3040 (InterpreterImp::evaluate):
3042 (KJS::InterpreterImp::globalObject):
3043 * kjs/interpreter.cpp:
3044 (Interpreter::evaluate):
3045 * kjs/interpreter.h:
3046 (KJS::InterpreterLock::InterpreterLock):
3047 (KJS::InterpreterLock::~InterpreterLock):
3050 (KJS::ProtectedValue::ProtectedValue):
3051 (KJS::ProtectedValue::~ProtectedValue):
3052 (KJS::ProtectedValue::operator=):
3053 (KJS::ProtectedObject::ProtectedObject):
3054 (KJS::ProtectedObject::~ProtectedObject):
3055 (KJS::ProtectedObject::operator=):
3056 (KJS::ProtectedReference::ProtectedReference):
3057 (KJS::ProtectedReference::~ProtectedReference):
3058 (KJS::ProtectedReference::operator=):
3059 * kjs/protected_object.h:
3060 * kjs/protected_values.cpp:
3061 (KJS::ProtectedValues::getProtectCount):
3062 (KJS::ProtectedValues::increaseProtectCount):
3063 (KJS::ProtectedValues::decreaseProtectCount):
3064 * kjs/string_object.cpp:
3065 (StringObjectImp::StringObjectImp):
3069 2005-09-16 Adele Peterson <adele@apple.com>
3071 Change by Darin, reviewed by me and Maciej.
3073 Fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=4547
3074 use int instead of long for 32-bit (to prepare for LP64 compiling)
3076 * bindings/c/c_class.h:
3077 (KJS::Bindings::CClass::constructorAt):
3078 (KJS::Bindings::CClass::numConstructors):
3079 * bindings/c/c_runtime.h:
3080 (KJS::Bindings::CMethod::numParameters):
3081 * bindings/jni/jni_class.cpp:
3082 (JavaClass::JavaClass):
3083 * bindings/jni/jni_class.h:
3084 (KJS::Bindings::JavaClass::constructorAt):
3085 (KJS::Bindings::JavaClass::numConstructors):
3086 * bindings/jni/jni_instance.cpp:
3087 (JavaInstance::invokeMethod):
3088 * bindings/jni/jni_jsobject.cpp:
3089 (JSObject::convertJObjectToValue):
3090 (JSObject::listFromJArray):
3091 * bindings/jni/jni_runtime.cpp:
3092 (JavaMethod::JavaMethod):
3093 * bindings/jni/jni_runtime.h:
3094 (KJS::Bindings::JavaConstructor::_commonCopy):
3095 (KJS::Bindings::JavaConstructor::parameterAt):
3096 (KJS::Bindings::JavaConstructor::numParameters):
3097 (KJS::Bindings::JavaMethod::_commonCopy):
3098 (KJS::Bindings::JavaMethod::parameterAt):
3099 (KJS::Bindings::JavaMethod::numParameters):
3101 * bindings/objc/WebScriptObject.mm:
3103 * bindings/objc/objc_class.h:
3104 (KJS::Bindings::ObjcClass::constructorAt):
3105 (KJS::Bindings::ObjcClass::numConstructors):
3106 * bindings/objc/objc_instance.h:
3107 * bindings/objc/objc_runtime.h:
3108 * bindings/objc/objc_runtime.mm:
3109 (ObjcMethod::numParameters):
3110 * bindings/runtime.h:
3113 * kjs/property_slot.h:
3114 (KJS::PropertySlot::setCustomIndex):
3115 (KJS::PropertySlot::index):
3116 (KJS::PropertySlot::):
3117 * kjs/regexp_object.cpp:
3118 (RegExpObjectImp::backrefGetter):
3119 (RegExpObjectImp::getOwnPropertySlot):
3120 * kjs/simple_number.h:
3121 (KJS::SimpleNumber::):
3122 (KJS::SimpleNumber::value):
3123 (KJS::SimpleNumber::fits):
3124 (KJS::SimpleNumber::integerFits):
3125 (KJS::SimpleNumber::make):
3126 * kjs/string_object.cpp:
3127 (substituteBackreferences):
3129 (KJS::UString::from):
3130 (KJS::UString::toUInt32):
3131 (KJS::UString::find):
3132 (KJS::UString::rfind):
3138 2005-09-11 Eric Seidel <eseidel@apple.com>
3140 No review requested, build fix affects only SVG.
3142 * JavaScriptCore.xcodeproj/project.pbxproj: Fixed JSC+SVG
3143 Fixed JavaScriptCore+SVG after PCRE 6.1 merger.
3144 http://bugzilla.opendarwin.org/show_bug.cgi?id=4932
3146 2005-09-10 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
3148 Reviewed and landed by Darin.
3150 * Makefile.vc: Added.
3151 * README-Win32.txt: Added.
3153 2005-09-10 Darin Adler <darin@apple.com>
3155 - fixed compilation for WebCore (another try)
3157 * kjs/simple_number.h: Added more "using" lines.
3159 2005-09-10 Darin Adler <darin@apple.com>
3161 - fixed compilation for WebCore
3163 * kjs/simple_number.h: Have to include <cmath> here to work around a bug in the GCC
3164 standard C++ library headers.
3166 2005-09-10 Darin Adler <darin@apple.com>
3168 Windows changes by Krzysztof Kowalczyk <kkowalczyk@gmail.com>.
3170 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4870
3171 win portability: fix IS_NEGATIVE_ZERO macro in simple_number.h
3173 * kjs/simple_number.h:
3174 (KJS::isNegativeZero): Added. Inline function. Has a case for Windows that
3175 uses _fpclass and a case for other platforms that uses signbit.
3176 (KJS::SimpleNumber::fits): Use inline isNegativeZero instead of macro IS_NEGATIVE_ZERO.
3178 * kjs/internal.cpp: Remove definition of now-unneeded negZero global.
3180 * kjs/value.cpp: Touched the file because Xcode didn't know it needed to
3183 - improved test engine
3185 * tests/mozilla/jsDriver.pl: Sort tests in numeric order instead of using
3186 a plain-ASCII sort; now test 33 will be after test 5 in any given set of
3189 2005-09-08 Darin Adler <darin@apple.com>
3191 - fixed overloaded versions of throwError so that they substitute *all*
3192 expected parameters into the message string -- some versions used to
3193 skip parameters, resulting in "%s" being printed in the error message.
3197 * kjs/nodes.h: Updated declarations to use "const &" and not to name parameters
3198 * kjs/nodes.cpp: (Node::throwError): Updated to match above and add one missing
3201 2005-09-08 Darin Adler <darin@apple.com>
3205 - updated to PCRE 6.1
3207 The original PCRE 6.1 sources are checked into the tree with the tag
3208 "pcre-6-1" for reference. What we're checking in right now is the original
3209 plus our changes to make it support UTF-16 and at least one other tweak
3210 (vertical tab considered whitespace). Our work to get our changes was
3211 done on "pcre-6-1-branch", with an anchor at "pcre-6-1-anchor" so you can
3212 see the evolution of the UTF-16 changes.
3214 Note also that there was one small change made here that's not on the branch
3217 * Info.plist: Updated the part of the copyright message that's about PCRE.
3219 * JavaScriptCore.xcodeproj/project.pbxproj: Added new PCRE source files,
3220 removed obsolete ones.
3222 * pcre/AUTHORS: Updated to PCRE 6.1. Includes credits for Apple's UTF-16
3223 changes, but not the credits for Google's C++ wrapper, since we don't include that.
3224 * pcre/COPYING: Updated to PCRE 6.1.
3225 * pcre/LICENCE: Ditto.
3226 * pcre/dftables.c: Ditto.
3227 * pcre/pcre-config.h: Ditto.
3228 * pcre/pcre.h: Ditto.
3230 * pcre/pcre_compile.c: Added for PCRE 6.1.
3231 * pcre/pcre_config.c: Ditto.
3232 * pcre/pcre_exec.c: Ditto.
3233 * pcre/pcre_fullinfo.c: Ditto.
3234 * pcre/pcre_get.c: Ditto.
3235 * pcre/pcre_globals.c: Ditto.
3236 * pcre/pcre_info.c: Ditto.
3237 * pcre/pcre_internal.h: Ditto.
3238 * pcre/pcre_maketables.c: Ditto.
3239 * pcre/pcre_ord2utf8.c: Ditto.
3240 * pcre/pcre_printint.c: Ditto.
3241 * pcre/pcre_refcount.c: Ditto.
3242 * pcre/pcre_study.c: Ditto.
3243 * pcre/pcre_tables.c: Ditto.
3244 * pcre/pcre_try_flipped.c: Ditto.
3245 * pcre/pcre_ucp_findchar.c: Ditto.
3246 * pcre/pcre_version.c: Ditto.
3247 * pcre/pcre_xclass.c: Ditto.
3248 * pcre/ucp.h: Ditto.
3249 * pcre/ucp_findchar.c: Ditto.
3250 * pcre/ucpinternal.h: Ditto.
3251 * pcre/ucptable.c: Ditto.
3253 * pcre/get.c: Removed.
3254 * pcre/internal.h: Removed.
3255 * pcre/maketables.c: Removed.
3256 * pcre/pcre.c: Removed.
3257 * pcre/study.c: Removed.
3259 2005-09-07 Geoffrey Garen <ggaren@apple.com>
3261 -fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4781
3262 Date.setMonth fails with big values due to overflow
3266 * kjs/date_object.cpp:
3267 (timetUsingCF): for consistency, changed return statement to invalidDate instead of LONG_MAX
3268 (KJS::fillStructuresUsingTimeArgs): modified for readability
3269 (KJS::fillStructuresUsingDateArgs): new function analogous to fillStructuresUsingTimeArgs
3270 (KJS::DateProtoFuncImp::callAsFunction): modified to use fillStructuresUsingDateArgs
3271 (KJS::DateObjectImp::construct): moved variable declaration to proper scope
3272 (KJS::DateObjectFuncImp::callAsFunction): moved variable declaration to proper scope
3274 2005-09-07 Geoffrey Garen <ggaren@apple.com>
3275 -updated expected test results to reflect fix for
3276 http://bugzilla.opendarwin.org/show_bug.cgi?id=4698
3277 kjs does not allow named functions in function expressions
3279 * tests/mozilla/expected.html:
3281 2005-09-04 Darin Adler <darin@apple.com>
3283 * kjs/identifier.cpp: Fix comment, add missing include.
3284 (Follow-on to changes from yesterday.)
3286 2005-09-03 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
3288 Reviewed, tweaked and landed by Darin.
3290 - another try at some of the Windows compilation fixes
3291 should fix these bugs: 4546, 4831, 4834, 4643, 4830, 4832, 4833, 4835
3293 * kjs/collector.cpp: Add missing <setjmp.h> include.
3294 * kjs/date_object.cpp: Fix broken copysign macro.
3295 * kjs/dtoa.cpp: Move macro definitions down after all header includes.
3296 * kjs/fast_malloc.cpp: Add missing <assert.h> and <stddef.h> includes.
3297 * kjs/function.cpp: Remove broken isxdigit definition.
3298 * kjs/grammar.y: Add a missing semicolon (and remove an excess one).
3299 * kjs/identifier.cpp: Turn off AVOID_STATIC_CONSTRUCTORS because the placement new syntax
3300 doesn't seem to work in Visual C++ (I'm surprised to hear that, by the way).
3301 * kjs/value.h: Made ValueImp's destructor virtual because otherwise pointers to ValueImp
3302 on the stack aren't right for garbage collection on Windows (don't think it works that
3303 way with gcc's virtual table scheme, but it's a harmless change).
3305 2005-09-03 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
3307 Reviewed, tweaked and landed by Darin.
3309 - some Windows compilation fixes, hoping to fix the problems reported in these bugs:
3310 4627, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4639, 4640, 4641, 4644, 4645
3312 * kjs/collector.cpp: Include <windows.h> on WIN32. Put thread-related code inside
3313 KJS_MULTIPLE_THREADS #if directives.
3314 (KJS::Collector::markCurrentThreadConservatively): Use NT_TIB to find the stack base on Win32.
3316 * kjs/config.h: Define HAVE_SYS_TIMEB_H for Win32.
3318 * kjs/date_object.cpp: Add include of <limits.h>. Add definitions of strncasecmp, isfinite, and
3320 (KJS::KRFCDate_parseDate): Move "errno = 0" line down closer to the first call to strol -- I believe
3321 that on Win32 there's some other call before that setting errno.
3323 * kjs/date_object.h: Remove unneeded include of <sys/time.h>.
3325 * kjs/dtoa.cpp: Add an undef of strtod, needed on Win32.
3327 * kjs/fast_malloc.cpp: Put #if !WIN32 around some customization that's not appropriate on Win32.
3328 (KJS::region_list_append): Add a missing cast so this Win32-specific function compiles in C++.
3329 (KJS::sbrk): Change parameter type to match the declaration.
3331 * kjs/function.cpp: (isxdigit): Define a locale-independent isxdigit on Win32.
3333 * kjs/function.h: Remove unneeded friend class Function for FunctionImp.
3335 * kjs/identifier.cpp: Took out the APPLE_CHANGES from around the AVOID_STATIC_CONSTRUCTORS
3336 define. We ultimately intend to phase out APPLE_CHANGES entirely. Also fix the
3337 non-AVOID_STATIC_CONSTRUCTORS code path.
3339 * kjs/internal.cpp: Remove uneeded include of <strings.h>, which was confused with <string.h>!
3340 Add a Win32 implementation of copysign. Put the threads code inside KJS_MULTIPLE_THREADS.
3342 * kjs/internal.h: Define a KJS_MULTIPLE_THREADS macro on non-Win32 only. Later we can make this
3343 specific to Mac OS X if we like.
3345 * kjs/interpreter_map.cpp: Add missing include of <stdlib.h>.
3348 (KJS::ListImp::markValues): Use std::min instead of MIN.
3349 (KJS::List::copy): Ditto.
3350 (KJS::List::copyTail): Ditto.
3352 * kjs/math_object.cpp: (signbit): Add a Win32 implementation of signbit.
3354 * kjs/nodes.cpp: (Node::finalCheck): Use unsigned instead of uint.
3355 Put the use of always_inline inside __GNUC__.
3357 * kjs/number_object.cpp: (NumberProtoFuncImp::callAsFunction): Use "10.0" instead of "10"
3358 inside all the calls to pow to avoid ambiguity caused by overloading of pow on Win32, seen
3359 when passing an int rather than a double or float.
3361 * kjs/operations.cpp:
3362 (KJS::isInf): Add Win32 implementation.
3363 (KJS::isPosInf): Add Win32 implementation.
3364 (KJS::isNegInf): Add Win32 implementation.
3366 * kjs/regexp.cpp: Use unsigned instead of uint.
3367 * kjs/regexp.h: Ditto.
3368 * kjs/regexp_object.cpp: Ditto.
3369 * kjs/regexp_object.h: Ditto.
3371 2005-09-02 Beth Dakin <bdakin@apple.com>
3373 Fix for <rdar://problem/4235531> Denver Regression: Safari crash in KWQStringData::makeUnicode
3374 The other half of the fix is in WebCore.
3376 Fix written by Maciej and Darin.
3377 Reviewed by me/Maciej
3379 As Maciej said in Radar: These problems was caused by a conflict between some of our custom
3380 allocators, causing them to return null. Symptom is typically a null pointer dereference in
3381 a place where it might be expected an allocation has just occurred.
3383 * kjs/fast_malloc.cpp: Added #define for MORECORE_CONTIGUOUS, MORECORE_CANNOT_TRIM,
3384 and MALLOC_FAILURE_ACTION.
3386 2005-08-31 Geoffrey Garen <ggaren@apple.com>
3388 -rolled in fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4698
3389 kjs does not allow named functions in function expressions
3391 Fix by Arthur Langereis.
3397 (FuncExprNode::evaluate):
3399 (KJS::FuncExprNode::FuncExprNode):
3403 * layout-tests/fast/js/named-function-expression-expected.txt: Added.
3404 * layout-tests/fast/js/named-function-expression.html: Added.
3406 2005-08-31 Justin Haygood <justin@xiondigital.net>
3408 Reviewed, tweaked, and landed by Darin.
3410 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4085
3411 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4087
3412 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4096
3413 Some fixes for compiling on windows.
3415 * kjs/config.h: Added a WIN32 case in here, with suitable defines.
3416 (To be tweaked as necessary.)
3417 * kjs/function.cpp: Took out APPLE_CHANGES around use of ICU.
3418 * kjs/operations.cpp: Removed some bogus code that always set HAVE_FLOAT_H.
3420 2005-08-30 Darin Adler <darin@apple.com>
3422 Reviewed by John Sullivan.
3424 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4758
3425 unify SharedPtr in WebCore and JavaScriptCore
3427 * kjs/shared_ptr.h: Updated namespace to KXMLCore instead of kxhmlcore.
3428 Made a few small improvements to use local variables a bit more and added
3429 an "operator int" to reduce the chance that we'll convert a SharedPtr to
3430 an int by accident. Also made the == operators normal functions rather than
3431 friend functions, added a couple of comemnts.
3433 * kjs/function.h: Updated for namespace change.
3434 * kjs/function.cpp: Ditto.
3435 * kjs/function_object.cpp: Ditto.
3436 * kjs/internal.h: Ditto.
3437 * kjs/internal.cpp: Ditto.
3438 * kjs/nodes.h: Ditto.
3439 * kjs/nodes2string.cpp: Ditto.
3441 2005-08-26 Maciej Stachowiak <mjs@apple.com>
3445 <rdar://problem/4224911> many many leaks in kjsyyparse with malformed Javascript
3447 Record all nodes that are created during parsing, and delete any
3448 that are left floating with a refcount of 0.
3451 (KJS::Parser::saveNewNode):
3452 (KJS::clearNewNodes):
3453 (KJS::Parser::parse):
3458 (KJS::Node::refcount):
3460 2005-08-26 Maciej Stachowiak <mjs@apple.com>
3464 - fixed <rdar://problem/4232452> many many leaks in kjsyyparse on some well-formed JavaScript (can repro on sony.com, webkit tests)
3466 Fixed by changing the refcounting scheme for nodes. Instead of each node implementing a custom ref and
3467 deref for all its children (and being responsible for deleting them), nodes use a smart pointer to
3468 hold their children, and smart pointers are used outside the node tree as well. This change mostly
3471 * JavaScriptCore.xcodeproj/project.pbxproj:
3473 (KJS::DeclaredFunctionImp::DeclaredFunctionImp):
3474 (KJS::GlobalFuncImp::callAsFunction):
3476 * kjs/function_object.cpp:
3477 (FunctionObjectImp::construct):
3480 (KJS::Parser::parse):
3481 (KJS::Parser::accept):
3482 (KJS::InterpreterImp::checkSyntax):
3483 (KJS::InterpreterImp::evaluate):
3488 (ElementNode::evaluate):
3489 (PropertyValueNode::evaluate):
3490 (ArgumentListNode::evaluateList):
3491 (NewExprNode::evaluate):
3492 (FunctionCallValueNode::evaluate):
3493 (FunctionCallBracketNode::evaluate):
3494 (FunctionCallDotNode::evaluate):
3495 (RelationalNode::evaluate):
3496 (StatListNode::execute):
3497 (StatListNode::processVarDecls):
3498 (VarDeclListNode::evaluate):
3499 (VarDeclListNode::processVarDecls):
3500 (ForInNode::ForInNode):