Newer
Older
2002-12-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by: Darin Adler
- fixed Deployment build.
* kjs/dtoa.cpp: Work around warnings.
2002-12-03 Maciej Stachowiak <mjs@apple.com>
- fixed 3114790 - Gamespot reviews pages badly mis-rendering
because floating point numbers format wide
Reviewed by: David Hyatt
* kjs/dtoa.cpp: Imported float <--> string conversion routines
from David M. Gay. I changed this to fix warnings and avoid
colliding with names of standard library functions.
* kjs/dtoa.h: Added a header I made up for dtoa.cpp
* kjs/ustring.cpp:
(UString::from): Use new double to string routine (kjs_strtod).
(UString::toDouble): Use new string to double routine (kjs_dtoa).
* JavaScriptCore.pbproj/project.pbxproj: Added new files
2002-11-27 John Sullivan <sullivan@apple.com>
* kjs/collector.cpp:
removed puts("COLLECT") leftover debugging spam that was
buggin' gramps
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
2002-11-26 Maciej Stachowiak <mjs@apple.com>
Change ActivationImp to be allocated via the garbage collector
again instead of on the stack. This fixes the following four
regressions but sadly it causes a 6% performance hit. It's
probably possibly to reduce the hit a bit by being smarter about
inlining and the way the marking list variant is implemented, but
I'll look into that later.
- fixed 3111500 - REGRESSION: crash in "KJS::ScopeChain::mark()" on www.posci.com
- fixed 3111145 - REGRESSION: reproducible crash in KJS hashtable lookup at time.com
- fixed 3110897 - REGRESSION: javascript crasher on http://bmwgallery.tripod.com/
- fixed 3109987 - REGRESSION: Reproducible crash in KJS ObjectImp at live365.com
Also:
- improved DEBUG_COLLECTOR mode a bit by never giving memory back
to the system.
* kjs/collector.cpp:
* kjs/context.h:
* kjs/function.cpp:
(ActivationImp::ActivationImp):
(ActivationImp::mark):
(ActivationImp::createArgumentsObject):
* kjs/function.h:
* kjs/internal.cpp:
(ContextImp::ContextImp):
(ContextImp::mark):
* kjs/list.cpp:
* kjs/list.h:
* kjs/value.cpp:
(Value::Value):
2002-11-26 Darin Adler <darin@apple.com>
* kjs/property_map.cpp:
(PropertyMap::save): Look at the attributes the same way in the single hash entry
case as in the actual hash table case. Change the rule for which attributes to save
to "attributes that don't have the ReadOnly, DontEnum, or Function bit set".
Also fix bug where saving an empty property map would leave the count set to the old value.
2002-11-26 Richard Williamson <rjw@apple.com>
Remove debugging code. Could be cause of performance regresssion.
* kjs/nodes.cpp:
(FunctionCallNode::evaluate):
Restire attributes correctly.
* kjs/property_map.cpp:
2002-11-25 Richard Williamson <rjw@apple.com>
Use delete[] (not delete) operator to delete array.
* kjs/property_map.cpp:
2002-11-25 Richard Williamson <rjw@apple.com>
Added debugging info. Fixed property map save function.
* kjs/nodes.cpp:
(FunctionCallNode::evaluate):
* kjs/property_map.cpp:
2002-11-25 Richard Williamson <rjw@apple.com>
Changes for back/forward. Currently disabled.
* kjs/property_map.cpp:
* kjs/property_map.h:
2002-11-25 Darin Adler <darin@apple.com>
* kjs/property_map.cpp: Rearrange code a little bit and tweak indentation.
This might provide a tiny speedup because we don't look at the single entry
any more in cases where the _table pointer is non-0.
2002-11-24 Darin Adler <darin@apple.com>
- changed ScopeChain to not ref each item in the chain, and use
marking instead; gains 1% on JavaScript iBench
* kjs/context.h: Return chain by reference.
* kjs/internal.cpp: (ContextImp::mark): Mark the scope chain.
* kjs/interpreter.cpp: (Context::scopeChain): Return chain by reference.
* kjs/interpreter.h: Make some Context methods inline.
* kjs/nodes.cpp:
(ThisNode::evaluate): Get at ContextImp directly.
(ResolveNode::evaluateReference): Ditto.
(VarDeclNode::evaluate): Ditto.
(VarDeclNode::processVarDecls): Ditto.
(FuncDeclNode::processFuncDecl): Pass ScopeChain directly to avoid copying.
(FuncExprNode::evaluate): Ditto.
* kjs/object.cpp: Make scope and setScope inline.
* kjs/object.h: Make scope return a chain by reference. Make scope and
setScope both be inline. Use a normal ScopeChain instead of NoRefScopeChain
since they are now one and the same.
* kjs/scope_chain.cpp: Remove all the code to ref and deref objects.
Merge NoRefScopeChain in with ScopeChain since they both work this way now.
* kjs/scope_chain.h: Remove NoRefScopeChain and simplify the ref counts.
Make more functions inline.
2002-11-24 Maciej Stachowiak <mjs@apple.com>
- fixed 3098356 - Hard hang on movie search at www.movietickets.com
* kjs/string_object.cpp:
(StringProtoFuncImp::call): When doing a regexp replacement that
results in an empty match, always move on to the next character
after doing the replacement. The previous code would hit an
infinite loop if an initial empty match was replaced with the
empty string.
2002-11-24 Maciej Stachowiak <mjs@apple.com>
- fixed 3095446 - Crash on AppleScript page due to very long argument list
* kjs/grammar.y: Don't try to construct the argument list in the
right order, since that blows out the parser stack.
* kjs/nodes.cpp:
(ArgumentsNode::ArgumentsNode): Instead reverse the argument list
here.
* kjs/nodes.h: Make ArgumentsNode a friend of ArgumentListNode.
* kjs/grammar.cpp: Updated from grammar.y.
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
2002-11-23 Maciej Stachowiak <mjs@apple.com>
- completed Darin's mostly-fix for 3037795 - Resource use
increases when accessing very high index value in array
The two missing pieces were handling sparse properties when
shrinking the array, and when sorting. Thse are now both taken
care of.
* kjs/array_instance.h:
* kjs/array_object.cpp:
(ArrayInstanceImp::put):
(ArrayInstanceImp::deleteProperty):
(ArrayInstanceImp::resizeStorage):
(ArrayInstanceImp::setLength):
(ArrayInstanceImp::sort):
(ArrayInstanceImp::pushUndefinedObjectsToEnd):
* kjs/identifier.h:
* kjs/object.h:
* kjs/property_map.cpp:
* kjs/property_map.h:
* kjs/reference_list.cpp:
(ReferenceList::append):
(ReferenceList::length):
* kjs/reference_list.h:
* kjs/ustring.cpp:
(UString::toUInt32):
* kjs/ustring.h:
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
2002-11-23 Maciej Stachowiak <mjs@apple.com>
Numerous collector changes for a net gain of 3% on JS ibench:
- Replaced per-block bitmap with free list.
- Increased number of empty blocks kept around to 2.
- Doubled block size.
- When scanning heap in collector, skip scanning the rest of a
block as soon as we see as many live cells as the the number of
used cells it had originally.
Also the following collector changes unrelated to performance:
- Made constants `const int' instead of `static const int'.
- Miscellaneous code cleanup.
* kjs/collector.cpp:
- Added debugging mode enabled by defining DEBUG_GC which asserts
when a destroyed ValueImp
* kjs/internal.cpp:
(ContextImp::mark):
* kjs/value.cpp:
(Value::Value):
* kjs/value.h:
* kjs/config.h:
2002-11-22 Darin Adler <darin@apple.com>
- replaced List class with a vector rather than a linked list, changed it
to use a pool of instances instead of all the nodes allocated off of the
heap; gives 10% gain on iBench
* kjs/list.h: Complete rewrite.
* kjs/list.cpp: Ditto.
* kjs/array_object.cpp: (compareWithCompareFunctionForQSort): Go back to
doing a clear and two appends here. Fast with the new list implementation.
* kjs/collector.h: Remove _COLLECTOR hack and just make rootObjectClasses
return a const void *.
* kjs/collector.cpp: Remove _COLLECTOR hack, and various other minor tweaks.
2002-11-22 Darin Adler <darin@apple.com>
- prepare to reimplement KJS::List; move to its own file, add statistics
* kjs/function_object.cpp: (FunctionProtoFuncImp::call): Use new copyTail()
function rather than copy() and removeFirst().
* kjs/identifier.cpp: Add statistics, off by default.
* kjs/property_map.cpp: Add statistics, off by default.
* kjs/list.cpp: Added. Moved code here. To be rewritten.
* kjs/list.h: Added. Moved interface here. To be rewritten.
* kjs/types.cpp: Removed.
* kjs/types.h: Now just an empty header that includes other headers.
* JavaScriptCore.pbproj/project.pbxproj: Add new files, rearrange.
2002-11-22 Maciej Stachowiak <mjs@apple.com>
- reduce cell size to 56 bytes from 64, now that nearly all
objects fit in that size. .5% speed gain and probably some
footprint gain.
* kjs/collector.cpp: Change CELL_SIZE from 64 to 56.
2002-11-22 Darin Adler <darin@apple.com>
- change ScopeChain to be a singly linked list shares tails, gives 11% gain on iBench
* kjs/context.h:
(ContextImp::pushScope): Make inline, use push instead of prepend, and pass imp pointer.
(ContextImp::popScope): Make inline, use pop instead of removeFirst.
* kjs/function.cpp: (DeclaredFunctionImp::DeclaredFunctionImp): No need to copy.
* kjs/function_object.cpp: (FunctionObjectImp::construct): Use push instead of
prepend, and pass imp pointer.
* kjs/internal.cpp: (ContextImp::ContextImp): Use clear, push instead of prepend,
and pass imp pointers.
* kjs/nodes.cpp: (ResolveNode::evaluateReference): Use isEmpty, pop, and top instead
of ScopeChainIterator.
* kjs/object.h: Change _scope to be a NoRefScopeChain.
* kjs/object.cpp: No need to initialize _scope any more, since it's not a NoRefScopeChain.
* kjs/scope_chain.h: Rewrite, different implementation and interface.
* kjs/scope_chain.cpp: More of the same.
2002-11-22 Maciej Stachowiak <mjs@apple.com>
- a simple change for .4% gain on ibench - instead of unmarking
all objects at the start of collection, instead unmark as part of
the sweep phase
* kjs/collector.cpp:
(Collector::collect): Remove separate unmarking pass and instead
unmark the objects that don't get collected during the sweep
phase.
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
2002-11-21 Darin Adler <darin@apple.com>
- stop garbage collecting the ActivationImp objects, gets 3% on iBench
- pave the way to separate the argument lists from scope chains
* kjs/context.h: Added. Moved ContextImp here so it can use things defined
in function.h
* kjs/scope_chain.h: Added. Starting as a copy of List, to be improved.
* kjs/scope_chain.cpp: Added. Starting as a copy of List, to be improved.
* JavaScriptCore.pbproj/project.pbxproj: Rearranged things, added context.h.
* kjs/function.cpp:
(FunctionImp::call): Pass InterpreterImp, not ExecState, to ContextImp.
(DeclaredFunctionImp::DeclaredFunctionImp): List -> ScopeChain.
(ActivationImp::createArgumentsObject): ArgumentList -> List.
(GlobalFuncImp::call): Pass InterpreterImp, not an ExecState, to ContextImp.
* kjs/function.h: List -> ScopeChain.
* kjs/function_object.cpp: (FunctionObjectImp::construct): List -> ScopeChain.
* kjs/internal.cpp:
(ContextImp::ContextImp): Set the context in the interpreter.
(ContextImp::~ContextImp): Set the context in the interpreter to the caller.
(ContextImp::mark): Mark all the activation objects.
(InterpreterImp::InterpreterImp): Initialize context to 0.
(InterpreterImp::mark): Mark the top context.
(InterpreterImp::evaluate): Pass InterpreterImp to ContextImp.
* kjs/internal.h: Move ContextImp to its own header. Add setContext to InterpreterImp.
* kjs/interpreter.cpp: (Context::scopeChain): List -> ScopeChain.
* kjs/interpreter.h: List -> ScopeChain.
* kjs/nodes.cpp:
(ResolveNode::evaluateReference): List -> ScopeChain.
(FuncDeclNode::processFuncDecl): List -> ScopeChain.
(FuncExprNode::evaluate): List -> ScopeChain.
* kjs/object.cpp: List -> ScopeChain.
* kjs/object.h: List -> ScopeChain.
* kjs/types.h: Remove needsMarking features from List.
* kjs/types.cpp: Ditto.
2002-11-21 Maciej Stachowiak <mjs@apple.com>
- reduced the size of PropertyMap by storing sizes and such in the
dynamically allocated part of the object to reduce the size of
ObjectImp - .5% speed improvement on JS iBench.
* kjs/property_map.cpp:
* kjs/property_map.h:
2002-11-21 Maciej Stachowiak <mjs@apple.com>
* Makefile.am: Pass symroots for this tree to pbxbuild.
2002-11-21 Darin Adler <darin@apple.com>
* kjs/property_map.cpp: More assertions.
2002-11-21 Darin Adler <darin@apple.com>
* kjs/property_map.cpp: Turn that consistency check back off.
darin
committed
2002-11-21 Darin Adler <darin@apple.com>
- someone somewhere must be defining a macro named check, causing a compile failure in WebCore
Rename check() to checkConsistency().
* kjs/property_map.h: Rename.
* kjs/property_map.cpp: Yes, rename.
2002-11-21 Darin Adler <darin@apple.com>
- add self-check to property map in hopes of finding the cnet.com bug
* kjs/property_map.h: Add check() function.
* kjs/property_map.cpp: Add the checking, controlled by DO_CONSISTENCY_CHECK.
- fixed UChar interface so it's not so slow in debug builds
* kjs/ustring.h: Nothing in UChar needs to be private.
* kjs/function.cpp: (GlobalFuncImp::call):
* kjs/function_object.cpp: (FunctionObjectImp::construct):
* kjs/identifier.cpp:
* kjs/lexer.cpp: (Lexer::setCode), (Lexer::shift):
* kjs/lookup.cpp: (keysMatch):
* kjs/ustring.cpp: (UString::Rep::computeHash), (KJS::compare):
Use the "uc" field instead of the "unicode()" inline function.
2002-11-21 Darin Adler <darin@apple.com>
- fixed a null-dereference I ran into while trying to reproduce bug 3107351
* kjs/function.h: Change ActivationImp constructor to take context parameter.
* kjs/function.cpp: (ActivationImp::ActivationImp): Take context parameter,
not execution state parameter.
* kjs/internal.cpp: (ContextImp::ContextImp): Initialize activation object
from context, not execution state, because the new context is not yet in the
execution state.
2002-11-20 Darin Adler <darin@apple.com>
- added a feature for Richard to use in his back/forward cache
* kjs/object.h: Added save/restoreProperties.
* kjs/property_map.h: Here too.
* kjs/property_map.cpp: Here too.
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
2002-11-20 Darin Adler <darin@apple.com>
- created argument list objects only on demand for a 7.5% speedup
* kjs/function.h: Change ActivationImp around.
* kjs/function.cpp:
(FunctionImp::call): Pass a pointer to the arguments list to avoid ref/unref.
(FunctionImp::get): Get the function pointer from the context directly,
not the activation object.
(ArgumentsImp::ArgumentsImp): Add an overload that takes no arguments.
(ActivationImp::ActivationImp): Store a context pointer and an arguments object pointer.
(ActivationImp::get): Special case for arguments, create it and return it.
(ActivationImp::put): Special case for arguments, can't be set.
(ActivationImp::hasProperty): Special case for arguments, return true.
(ActivationImp::deleteProperty): Special case for arguments, refuse to delete.
(ActivationImp::mark): Mark the arguments object.
(ActivationImp::createArgumentsObject): Do the work of actually creating it.
(GlobalFuncImp::call): Use stack-based objects for the ContextImp and ExecState.
* kjs/internal.h: Keep function and arguments pointer in the context.
* kjs/internal.cpp:
(ContextImp::ContextImp): Don't pass in the func and args when making an ActivationImp.
(InterpreterImp::evaluate): Use stack-based objects here.
* kjs/types.h: Add ArgumentList as a synonym for List, soon to be separate.
2002-11-20 Maciej Stachowiak <mjs@apple.com>
Reduced the size of ValueImp by 8 bytes for a .5% speedup.
* kjs/value.h: Removed destructed flag. Made refcount and flag 16
bits each.
* kjs/value.cpp:
(ValueImp::~ValueImp): Don't set destructed flag.
2002-11-20 Darin Adler <darin@apple.com>
* kjs/types.cpp: Keep ref count for the whole lists of nodes.
Doesn't speed things up much, less than 1%.
2002-11-20 Maciej Stachowiak <mjs@apple.com>
* kjs/collector.cpp:
(Collector::allocate): Clear the flags on newly allocated objects.
2002-11-20 Darin Adler <darin@apple.com>
- oops, checked in big regression instead of 5% speedup
* kjs/function.cpp: (ActivationImp::ActivationImp): Make a marking
list, not a refing list.
- a cut at the sparse array implementation
* kjs/array_instance.h: Keep storageLength separate from length.
* kjs/array_object.cpp:
(ArrayInstanceImp::ArrayInstanceImp): Start with storageLength == length.
(ArrayInstanceImp::get): Check against storage length.
(ArrayInstanceImp::put): Ditto.
(ArrayInstanceImp::hasProperty): Ditto.
(ArrayInstanceImp::deleteProperty): Ditto.
(ArrayInstanceImp::setLength): Only enlarge storage length up to a cutoff.
(ArrayInstanceImp::mark): Use storageLength.
(ArrayInstanceImp::pushUndefinedObjectsToEnd): Added FIXME.
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
2002-11-20 Darin Adler <darin@apple.com>
- decrease ref/deref -- 5% speedup in iBench
* JavaScriptCore.pbproj/project.pbxproj: Added array_instance.h
* kjs/array_instance.h: Added so it can be shared by function.h.
* kjs/array_object.cpp:
* kjs/array_object.h:
* kjs/bool_object.cpp:
* kjs/bool_object.h:
* kjs/collector.cpp:
* kjs/date_object.cpp:
* kjs/date_object.h:
* kjs/error_object.cpp:
* kjs/function.cpp:
* kjs/function.h:
* kjs/function_object.cpp:
* kjs/internal.cpp:
* kjs/internal.h:
* kjs/math_object.cpp:
* kjs/nodes.cpp:
* kjs/number_object.cpp:
* kjs/object.cpp:
* kjs/object.h:
* kjs/object_object.cpp:
* kjs/property_map.cpp:
* kjs/reference.cpp:
* kjs/reference.h:
* kjs/regexp_object.cpp:
* kjs/string_object.cpp:
* kjs/string_object.h:
* kjs/value.cpp:
* kjs/value.h:
Switched lots of interfaces so they don't require ref/deref.
2002-11-20 Maciej Stachowiak <mjs@apple.com>
Fixed the two most obvious problems with the new GC for another 6%
improvement.
* kjs/collector.cpp:
(Collector::allocate): Don't bother doing the bit tests on a bitmap word if
all it's bits are on.
(Collector::collect): Track memoryFull boolean.
* kjs/collector.h: Inlined outOfMemory since it was showing up on profiles.
2002-11-20 Maciej Stachowiak <mjs@apple.com>
Rewrote garbage collector to make blocks of actual memory instead
of blocks of pointers. 7% improvement on JavaScript
iBench. There's still lots of room to tune the new GC, this is
just my first cut.
* kjs/collector.cpp:
(Collector::allocate):
(Collector::collect):
(Collector::size):
(Collector::outOfMemory):
(Collector::finalCheck):
(Collector::numGCNotAllowedObjects):
(Collector::numReferencedObjects):
(Collector::liveObjectClasses):
* kjs/collector.h:
* kjs/function.cpp:
(ActivationImp::ActivationImp):
* kjs/function.h:
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
2002-11-20 Darin Adler <darin@apple.com>
- on the road to killing ActivationImp
* kjs/function.h: Add get/put to FunctionImp. Remove argumentsObject() from
ActivationImp. Add function() to ActivationImp.
* kjs/function.cpp:
(FunctionImp::FunctionImp): No arguments property.
(FunctionImp::call): No need to set up the arguments property.
(FunctionImp::parameterString): Remove ** strangeness.
(FunctionImp::processParameters): Ditto.
(FunctionImp::get): Added, handles arguments and length properties.
(FunctionImp::put): Ditto.
(FunctionImp::hasProperty): Ditto.
(FunctionImp::deleteProperty): Ditto.
(ActivationImp::ActivationImp): Store a function pointer so we can find it
in the context.
* kjs/function_object.cpp: (FunctionObjectImp::construct): No need to set up
arguments property.
* kjs/nodes.cpp: (FuncExprNode::evaluate): No need to set up length property.
* kjs/internal.h: Return ObjectImp * for activation object.
* kjs/interpreter.h: Remove stray declaration of ExecStateImp.
2002-11-20 Darin Adler <darin@apple.com>
- add a couple of list operations to avoid clearing lists so much during sorting; gives 1.5% iBench
* kjs/types.h: Added replaceFirst/replaceLast.
* kjs/types.cpp: (List::replaceFirst), (List::replaceLast): Added.
* kjs/array_object.cpp: (compareWithCompareFunctionForQSort): Use replaceFirst/replaceLast.
* kjs/property_map.cpp: Put in an ifdef so I can re-add/remove the single entry to see if
it has outlived its usefulness. (It hasn't yet.)
2002-11-20 Darin Adler <darin@apple.com>
- atomic identifiers; gives another 6.5% in the iBench suite
* kjs/identifier.h: Did the real thing.
* kjs/identifier.cpp: Ditto.
* kjs/property_map.h: _tableSizeHashMask -> _tableSizeMask
* kjs/property_map.cpp: The above, plus take advantage of comparing
by pointer instead of by comparing bytes.
2002-11-19 Darin Adler <darin@apple.com>
- a few more globals for often-used property names
- conversion to Identifier from UString must now be explicit
* kjs/error_object.cpp:
* kjs/function.cpp:
* kjs/function_object.cpp:
* kjs/identifier.cpp:
* kjs/identifier.h:
* kjs/lexer.cpp:
* kjs/nodes.cpp:
* kjs/number_object.cpp:
* kjs/object.cpp:
* kjs/object.h:
* kjs/string_object.cpp:
* kjs/testkjs.cpp:
* kjs/ustring.cpp:
* kjs/ustring.h:
darin
committed
2002-11-19 Darin Adler <darin@apple.com>
- another step towards atomic identifiers; storing hash in the string rep. gives about
a 1.5% speedup in the JavaScript iBench
* kjs/ustring.h: Add a hash field to UString::Rep.
* kjs/ustring.cpp:
(UString::Rep::create): Set hash to uninitialized value.
(UString::Rep::destroy): Do the deleting in her, and call Identifier if needed.
(UString::Rep::computeHash): Added.
(UString::append): Set hash to 0 when modifying the string in place.
(UString::operator=): Ditto.
* kjs/property_map.cpp: Use the hash from UString.
* kjs/identifier.h: Added aboutToDestroyUStringRep.
* kjs/identifier.cpp: (Identifier::aboutToDestroyUStringRep): Added.
2002-11-19 Darin Adler <darin@apple.com>
- next step towards atomic identifiers; Identifier is no longer derived from UString
* kjs/identifier.h: Remove base class and add _ustring member.
* kjs/identifier.cpp: Add null and an == that works with const char *.
* kjs/property_map.cpp: Get rep through _ustring.
* kjs/function.cpp: (FunctionImp::parameterString): Call ustring().
* kjs/function_object.cpp: (FunctionProtoFuncImp::call): Ditto.
* kjs/nodes.cpp:
(PropertyNode::evaluate): Ditto.
(VarDeclNode::evaluate): Ditto.
(ForInNode::execute): Ditto.
* kjs/nodes2string.cpp: (SourceStream::operator<<): Add overload for Identifier.
* kjs/reference.cpp: (Reference::getValue): Call ustring().
* kjs/regexp_object.cpp: (RegExpObjectImp::get): Call ustring().
2002-11-19 Darin Adler <darin@apple.com>
- fixed memory trasher
* kjs/ustring.cpp: (UString::from): Fix "end of buffer" computation.
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
2002-11-19 Darin Adler <darin@apple.com>
- a first step towards atomic identifiers in JavaScript
Most places that work with identifiers now use Identifier
instead of UString.
* kjs/identifier.cpp: Added.
* kjs/identifier.h: Added.
* JavaScriptCore.pbproj/project.pbxproj: Added files.
* kjs/array_object.cpp:
* kjs/array_object.h:
* kjs/completion.cpp:
* kjs/completion.h:
* kjs/date_object.cpp:
* kjs/date_object.h:
* kjs/function.cpp:
* kjs/function.h:
* kjs/function_object.cpp:
* kjs/grammar.cpp:
* kjs/grammar.cpp.h:
* kjs/grammar.h:
* kjs/grammar.y:
* kjs/internal.cpp:
* kjs/internal.h:
* kjs/lexer.cpp:
* kjs/lookup.cpp:
* kjs/lookup.h:
* kjs/math_object.cpp:
* kjs/math_object.h:
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/number_object.cpp:
* kjs/number_object.h:
* kjs/object.cpp:
* kjs/object.h:
* kjs/property_map.cpp:
* kjs/property_map.h:
* kjs/reference.cpp:
* kjs/reference.h:
* kjs/regexp_object.cpp:
* kjs/regexp_object.h:
* kjs/string_object.cpp:
* kjs/string_object.h:
2002-11-19 Darin Adler <darin@apple.com>
- fix hash function and key comparison for the other kind of hash table; yields 3%
* kjs/lookup.cpp:
(keysMatch): Added.
(Lookup::findEntry): Don't allocate and convert to ASCII just to search.
2002-11-19 Darin Adler <darin@apple.com>
- another hash table fix; yields a 2% improvement on iBench JavaScript
* kjs/property_map.cpp: A few more places where we use & instead of %.
- some List changes that don't affect speed yet
* kjs/types.cpp:
(List::prependList): Tighten up a tiny bit.
(List::copy): Use prependList.
* kjs/types.h: Remove appendList and globalClear.
* kjs/interpreter.cpp: (Interpreter::finalCheck): Remove List::globalClear().
2002-11-19 Darin Adler <darin@apple.com>
- fixed 3105026 -- REGRESSION: DHTML menus are broken all over the place
* kjs/types.cpp: (List::prepend): Fix backwards links in new node.
2002-11-19 Darin Adler <darin@apple.com>
- a fix that gives another 1.5% on the iBench JavaScript test
* kjs/ustring.cpp: (UString::from): Stop using sprintf to format integers.
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
2002-11-18 Darin Adler <darin@apple.com>
- reduced the creation of Value objects and hoisted the property map
into Object for another gain of about 6%
* JavaScriptCore.pbproj/project.pbxproj: Made property_map.h public.
* kjs/array_object.cpp:
(compareWithCompareFunctionForQSort): Don't wrap the ValueImp * in a Value
just to add it to a list.
(ArrayProtoFuncImp::call): Pass the globalObject directly so we don't have
to ref/deref.
* kjs/function.cpp:
(FunctionImp::call): Use a reference for the global object to avoid ref/deref.
(GlobalFuncImp::call): Ditto.
* kjs/internal.cpp:
(BooleanImp::toObject): Put the object directly into the list, don't create a Value.
(StringImp::toObject): Ditto.
(NumberImp::toObject): Ditto.
(InterpreterImp::evaluate): Use a reference for the global object.
* kjs/internal.h: Return a reference for the global object.
* kjs/interpreter.cpp: (Interpreter::globalObject): Ditto.
* kjs/interpreter.h: Ditto.
* kjs/object.cpp: Use _prop directly in the object, not a separate pointer.
* kjs/object.h: Ditto.
* kjs/types.cpp: Added List methods that work directly with ValueImp.
(List::append): Added a ValueImp version.
(List::prepend): Ditto.
(List::appendList): Work directly with the ValueImp's.
(List::prependList): Ditto.
(List::copy): Use appendList.
(List::empty): Use a shared global List.
* kjs/types.h: Update for above changes.
2002-11-18 Darin Adler <darin@apple.com>
* kjs/property_map.cpp: Oops, copyright goes to Apple, not me.
* kjs/property_map.h: Ditto.
darin
committed
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
2002-11-18 Darin Adler <darin@apple.com>
- property and string improvements giving a 7% or so improvement in JavaScript iBench
* kjs/property_map.h: Rewrite to use a hash table.
* kjs/property_map.cpp: Ditto.
* kjs/string_object.h:
* kjs/string_object.cpp:
(StringInstanceImp::StringInstanceImp): Construct a string with the right value
instead of putting the string in later.
(StringInstanceImp::get): Get the length from the string, not a separate property.
(StringInstanceImp::put): Ignore attempts to set length, since we don't put it in
the property map.
(StringInstanceImp::hasProperty): Return true for length.
(StringInstanceImp::deleteProperty): Return false for length.
(StringObjectImp::construct): Call new StringInstanceImp constructor. Don't try
to set a length property.
* kjs/ustring.h: Make the rep deref know how to deallocate the rep.
* kjs/ustring.cpp:
(UString::release): Move the real work to the rep's deref, since the hash table
now uses the rep directly.
* kjs/object.h: Remove unused field.
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
2002-11-18 Maciej Stachowiak <mjs@apple.com>
Change List to completely avoid going through the GC
allocator. 3.6% performance improvement on JavaScript iBench.
* kjs/internal.cpp:
(InterpreterImp::mark): Don't mark the empty list.
For all the methods below I basically lifted the ListImp version
up to the List method with minor tweaks.
* kjs/types.cpp:
(ListIterator::ListIterator):
(List::List):
(List::operator=):
(List::~List):
(List::mark):
(List::append):
(List::prepend):
(List::appendList):
(List::prependList):
(List::removeFirst):
(List::removeLast):
(List::remove):
(List::clear):
(List::clearInternal):
(List::copy):
(List::begin):
(List::end):
(List::isEmpty):
(List::size):
(List::at):
(List::operator[]):
(List::empty):
(List::erase):
(List::refAll):
(List::derefAll):
(List::swap):
(List::globalClear):
* kjs/types.h:
2002-11-18 Maciej Stachowiak <mjs@apple.com>
Fixed a horrible leak introduced with my last change that
somehow did not show up on my machine.
* kjs/types.cpp:
(List::List): Mark ListImp as GC allowed.
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
2002-11-18 Maciej Stachowiak <mjs@apple.com>
Another step towards the List conversion: stop inheriting from Value.
* kjs/types.cpp:
(ListIterator::ListIterator):
(List::List):
(List::operator=):
(List::~List):
(List::mark):
(List::append):
(List::prepend):
(List::appendList):
(List::prependList):
(List::removeFirst):
(List::removeLast):
(List::remove):
(List::clear):
(List::copy):
(List::begin):
(List::end):
(List::isEmpty):
(List::size):
(List::at):
(List::operator[]):
* kjs/types.h:
2002-11-18 Maciej Stachowiak <mjs@apple.com>
Partway to removing Value from List. Created a marking List
variant, used it in place of ListImp.
* kjs/internal.h: Removed List stuff.
* kjs/internal.cpp:
(InterpreterImp::mark): Call appropriate List method to do marking of
empty ListImp.
* kjs/object.h:
* kjs/object.cpp: Use marking List instead of ListImp *.
* kjs/types.h:
* kjs/types.cpp:
(List::List): New boolean needsMarking parameter.
(List::operator=): Perform trickery related to needsMarking.
(List::~List): Likewise.
(List::mark): Mark the ListImp.
(List::markEmptyList):
(ListImp::*): Moved here fron internal.cpp, they will be
integrated into the relevant List methods soon.
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
2002-11-18 Darin Adler <darin@apple.com>
- another string constant discovered that can be optimized
* kjs/object.h: Add a property name constant for "__proto__".
* kjs/object.cpp: Define it.
(ObjectImp::get): Use it.
(ObjectImp::hasProperty): Use it.
- prepare to turn PropertyMap into a hash table
* kjs/object.cpp:
(ObjectImp::mark): Use the new PropertyMap::mark().
(ObjectImp::put): Use the new overload of PropertyMap::get().
(ObjectImp::deleteProperty): Use the new overload of PropertyMap::get().
(ObjectImp::propList): Use PropertyMap::addEnumerablesToReferenceList().
* kjs/property_map.h: Remove PropertyMapNode and make all node-related methods private.
Add mark(), a new overload of get() that returns attributes, a clear() that takes no attributes,
and addEnumerablesToReferenceList().
* kjs/property_map.cpp:
(PropertyMap::get): Added new overload.
(PropertyMap::clear): Added new overload.
(PropertyMap::mark): Added.
(PropertyMap::addEnumerablesToReferenceList): Added.
* kjs/ustring.h: Added a hash function.
* kjs/ustring.cpp: (KJS::hash): Added.
2002-11-18 Darin Adler <darin@apple.com>
- simplified the ExecState class, which was showing up in profiles
Sped up JavaScript iBench by 6%.
* kjs/interpreter.h: Removed the level of indirection, and made it all inline.
* kjs/interpreter.cpp: Removed ExecState implementation from here altogether.
- fixed an oversight in my sort speedup
* kjs/array_object.h: Add pushUndefinedObjectsToEnd.
* kjs/array_object.cpp:
(ArrayInstanceImp::sort): Call pushUndefinedObjectsToEnd.
(ArrayInstanceImp::pushUndefinedObjectsToEnd): Added.
Pushes all undefined to the end of the array.
2002-11-18 Darin Adler <darin@apple.com>
- fix worst speed problems on the sort page of the iBench JavaScript test
Sped up JavaScript iBench by 70%, the sort page by 88%.
* kjs/array_object.h: Add array-specific sort functions.
* kjs/array_object.cpp:
(compareByStringForQSort): Added.
(ArrayInstanceImp::sort): Added.
(compareWithCompareFunctionForQSort): Added.
(ArrayProtoFuncImp::call): Use ArrayInstanceImp::sort if the object being
sorted is actually an array.
* kjs/object.h: Add argumentsPropertyName.
* kjs/object.cpp: Add argumentsPropertyName.
* kjs/function.cpp:
(FunctionImp::FunctionImp): Use argumentsPropertyName to avoid making a UString.
(FunctionImp::call): Ditto.
(ActivationImp::ActivationImp): Ditto.
* kjs/function_object.cpp: (FunctionObjectImp::construct): Ditto.
* kjs/ustring.h: Added compare function for -1/0/+1 comparison.
* kjs/ustring.cpp: (KJS::compare): Added.
2002-11-18 Maciej Stachowiak <mjs@apple.com>
Change ArgumentListNode operations to be iterative instead of
recursive. This probably fixes 3095446 (Crash in
KJS::ArgumentListNode::ref()) but I can't reproduce it myself so
I'm not 100% sure. I think the original bug was a stack overflow
and this change would remove that possibility.
* kjs/nodes.cpp:
(ArgumentListNode::ref): Make iterative.
(ArgumentListNode::deref): Make iterative.
(ArgumentListNode::evaluateList): Make iterative.
2002-11-14 Darin Adler <darin@apple.com>
- fixed 3101243 -- excite passes date that can't be parsed, results in bogus date at top right corner
* kjs/date_object.cpp: (KJS::KRFCDate_parseDate): Handle errors from strtol
by checking errno. Check the "string in a haystack" to be sure it's a multiple
of 3. Add case that allows year to be after time.
2002-11-14 Darin Adler <darin@apple.com>
- fixed 3101191 -- REGRESSION: Hang loading excite.com
* kjs/date_object.cpp:
(mktimeUsingCF): Pick an arbitrary cutoff of 3000, and return -1 if the
year passed in is that big so we don't infinite loop. Also validate the
rest of the date with CFGregorianDateIsValid.
(DateProtoFuncImp::call): Handle a -1 result from mktime.
(DateObjectImp::construct): Check for NaN before calling mktime, and also
handle a -1 result from mktime.
(DateObjectFuncImp::call): Check for NaN before calling mktime, and also
handle a -1 result from mktime.
2002-11-13 Darin Adler <darin@apple.com>
- fixed 3099930 -- dates/times without time zones are parsed as UTC by kjs,
local time by other browsers
* kjs/date_object.cpp:
(DateProtoFuncImp::call): Handle the NaN case better, like Mozilla and OmniWeb.