1 2002-12-03 Maciej Stachowiak <mjs (a] apple.com> 2 3 Reviewed by: Darin Adler 4 5 - fixed Deployment build. 6 7 * kjs/dtoa.cpp: Work around warnings. 8 9 2002-12-03 Maciej Stachowiak <mjs (a] apple.com> 10 11 - fixed 3114790 - Gamespot reviews pages badly mis-rendering 12 because floating point numbers format wide 13 14 Reviewed by: David Hyatt 15 16 * kjs/dtoa.cpp: Imported float <--> string conversion routines 17 from David M. Gay. I changed this to fix warnings and avoid 18 colliding with names of standard library functions. 19 * kjs/dtoa.h: Added a header I made up for dtoa.cpp 20 * kjs/ustring.cpp: 21 (UString::from): Use new double to string routine (kjs_strtod). 22 (UString::toDouble): Use new string to double routine (kjs_dtoa). 23 * JavaScriptCore.pbproj/project.pbxproj: Added new files 24 25 2002-11-27 John Sullivan <sullivan (a] apple.com> 26 27 * kjs/collector.cpp: 28 removed puts("COLLECT") leftover debugging spam that was 29 buggin' gramps 30 31 === Alexander-34 === 32 33 2002-11-26 Maciej Stachowiak <mjs (a] apple.com> 34 35 Change ActivationImp to be allocated via the garbage collector 36 again instead of on the stack. This fixes the following four 37 regressions but sadly it causes a 6% performance hit. It's 38 probably possibly to reduce the hit a bit by being smarter about 39 inlining and the way the marking list variant is implemented, but 40 I'll look into that later. 41 42 - fixed 3111500 - REGRESSION: crash in "KJS::ScopeChain::mark()" on www.posci.com 43 - fixed 3111145 - REGRESSION: reproducible crash in KJS hashtable lookup at time.com 44 - fixed 3110897 - REGRESSION: javascript crasher on http://bmwgallery.tripod.com/ 45 - fixed 3109987 - REGRESSION: Reproducible crash in KJS ObjectImp at live365.com 46 47 Also: 48 49 - improved DEBUG_COLLECTOR mode a bit by never giving memory back 50 to the system. 51 52 * kjs/collector.cpp: 53 * kjs/context.h: 54 * kjs/function.cpp: 55 (ActivationImp::ActivationImp): 56 (ActivationImp::mark): 57 (ActivationImp::createArgumentsObject): 58 * kjs/function.h: 59 * kjs/internal.cpp: 60 (ContextImp::ContextImp): 61 (ContextImp::mark): 62 * kjs/list.cpp: 63 * kjs/list.h: 64 * kjs/value.cpp: 65 (Value::Value): 66 67 2002-11-26 Darin Adler <darin (a] apple.com> 68 69 * kjs/property_map.cpp: 70 (PropertyMap::save): Look at the attributes the same way in the single hash entry 71 case as in the actual hash table case. Change the rule for which attributes to save 72 to "attributes that don't have the ReadOnly, DontEnum, or Function bit set". 73 Also fix bug where saving an empty property map would leave the count set to the old value. 74 75 2002-11-26 Richard Williamson <rjw (a] apple.com> 76 77 Remove debugging code. Could be cause of performance regresssion. 78 * kjs/nodes.cpp: 79 (FunctionCallNode::evaluate): 80 81 Restire attributes correctly. 82 * kjs/property_map.cpp: 83 84 2002-11-25 Richard Williamson <rjw (a] apple.com> 85 86 Use delete[] (not delete) operator to delete array. 87 88 * kjs/property_map.cpp: 89 90 2002-11-25 Richard Williamson <rjw (a] apple.com> 91 92 Added debugging info. Fixed property map save function. 93 94 * kjs/nodes.cpp: 95 (FunctionCallNode::evaluate): 96 * kjs/property_map.cpp: 97 98 2002-11-25 Richard Williamson <rjw (a] apple.com> 99 100 Changes for back/forward. Currently disabled. 101 102 * kjs/property_map.cpp: 103 * kjs/property_map.h: 104 105 2002-11-25 Darin Adler <darin (a] apple.com> 106 107 * kjs/property_map.cpp: Rearrange code a little bit and tweak indentation. 108 This might provide a tiny speedup because we don't look at the single entry 109 any more in cases where the _table pointer is non-0. 110 111 2002-11-24 Darin Adler <darin (a] apple.com> 112 113 - changed ScopeChain to not ref each item in the chain, and use 114 marking instead; gains 1% on JavaScript iBench 115 116 * kjs/context.h: Return chain by reference. 117 * kjs/internal.cpp: (ContextImp::mark): Mark the scope chain. 118 * kjs/interpreter.cpp: (Context::scopeChain): Return chain by reference. 119 * kjs/interpreter.h: Make some Context methods inline. 120 * kjs/nodes.cpp: 121 (ThisNode::evaluate): Get at ContextImp directly. 122 (ResolveNode::evaluateReference): Ditto. 123 (VarDeclNode::evaluate): Ditto. 124 (VarDeclNode::processVarDecls): Ditto. 125 (FuncDeclNode::processFuncDecl): Pass ScopeChain directly to avoid copying. 126 (FuncExprNode::evaluate): Ditto. 127 * kjs/object.cpp: Make scope and setScope inline. 128 * kjs/object.h: Make scope return a chain by reference. Make scope and 129 setScope both be inline. Use a normal ScopeChain instead of NoRefScopeChain 130 since they are now one and the same. 131 * kjs/scope_chain.cpp: Remove all the code to ref and deref objects. 132 Merge NoRefScopeChain in with ScopeChain since they both work this way now. 133 * kjs/scope_chain.h: Remove NoRefScopeChain and simplify the ref counts. 134 Make more functions inline. 135 136 2002-11-24 Maciej Stachowiak <mjs (a] apple.com> 137 138 - fixed 3098356 - Hard hang on movie search at www.movietickets.com 139 140 * kjs/string_object.cpp: 141 (StringProtoFuncImp::call): When doing a regexp replacement that 142 results in an empty match, always move on to the next character 143 after doing the replacement. The previous code would hit an 144 infinite loop if an initial empty match was replaced with the 145 empty string. 146 147 2002-11-24 Maciej Stachowiak <mjs (a] apple.com> 148 149 - fixed 3095446 - Crash on AppleScript page due to very long argument list 150 151 * kjs/grammar.y: Don't try to construct the argument list in the 152 right order, since that blows out the parser stack. 153 * kjs/nodes.cpp: 154 (ArgumentsNode::ArgumentsNode): Instead reverse the argument list 155 here. 156 * kjs/nodes.h: Make ArgumentsNode a friend of ArgumentListNode. 157 * kjs/grammar.cpp: Updated from grammar.y. 158 159 2002-11-23 Maciej Stachowiak <mjs (a] apple.com> 160 161 - completed Darin's mostly-fix for 3037795 - Resource use 162 increases when accessing very high index value in array 163 164 The two missing pieces were handling sparse properties when 165 shrinking the array, and when sorting. Thse are now both taken 166 care of. 167 168 * kjs/array_instance.h: 169 * kjs/array_object.cpp: 170 (ArrayInstanceImp::put): 171 (ArrayInstanceImp::deleteProperty): 172 (ArrayInstanceImp::resizeStorage): 173 (ArrayInstanceImp::setLength): 174 (ArrayInstanceImp::sort): 175 (ArrayInstanceImp::pushUndefinedObjectsToEnd): 176 * kjs/identifier.h: 177 * kjs/object.h: 178 * kjs/property_map.cpp: 179 * kjs/property_map.h: 180 * kjs/reference_list.cpp: 181 (ReferenceList::append): 182 (ReferenceList::length): 183 * kjs/reference_list.h: 184 * kjs/ustring.cpp: 185 (UString::toUInt32): 186 * kjs/ustring.h: 187 188 2002-11-23 Maciej Stachowiak <mjs (a] apple.com> 189 190 Numerous collector changes for a net gain of 3% on JS ibench: 191 192 - Replaced per-block bitmap with free list. 193 - Increased number of empty blocks kept around to 2. 194 - Doubled block size. 195 - When scanning heap in collector, skip scanning the rest of a 196 block as soon as we see as many live cells as the the number of 197 used cells it had originally. 198 199 Also the following collector changes unrelated to performance: 200 201 - Made constants `const int' instead of `static const int'. 202 - Miscellaneous code cleanup. 203 204 * kjs/collector.cpp: 205 206 - Added debugging mode enabled by defining DEBUG_GC which asserts 207 when a destroyed ValueImp 208 209 * kjs/internal.cpp: 210 (ContextImp::mark): 211 * kjs/value.cpp: 212 (Value::Value): 213 * kjs/value.h: 214 * kjs/config.h: 215 216 2002-11-22 Darin Adler <darin (a] apple.com> 217 218 - replaced List class with a vector rather than a linked list, changed it 219 to use a pool of instances instead of all the nodes allocated off of the 220 heap; gives 10% gain on iBench 221 222 * kjs/list.h: Complete rewrite. 223 * kjs/list.cpp: Ditto. 224 225 * kjs/array_object.cpp: (compareWithCompareFunctionForQSort): Go back to 226 doing a clear and two appends here. Fast with the new list implementation. 227 228 * kjs/collector.h: Remove _COLLECTOR hack and just make rootObjectClasses 229 return a const void *. 230 * kjs/collector.cpp: Remove _COLLECTOR hack, and various other minor tweaks. 231 232 2002-11-22 Darin Adler <darin (a] apple.com> 233 234 - prepare to reimplement KJS::List; move to its own file, add statistics 235 236 * kjs/function_object.cpp: (FunctionProtoFuncImp::call): Use new copyTail() 237 function rather than copy() and removeFirst(). 238 239 * kjs/identifier.cpp: Add statistics, off by default. 240 * kjs/property_map.cpp: Add statistics, off by default. 241 242 * kjs/list.cpp: Added. Moved code here. To be rewritten. 243 * kjs/list.h: Added. Moved interface here. To be rewritten. 244 245 * kjs/types.cpp: Removed. 246 * kjs/types.h: Now just an empty header that includes other headers. 247 248 * JavaScriptCore.pbproj/project.pbxproj: Add new files, rearrange. 249 250 2002-11-22 Maciej Stachowiak <mjs (a] apple.com> 251 252 - reduce cell size to 56 bytes from 64, now that nearly all 253 objects fit in that size. .5% speed gain and probably some 254 footprint gain. 255 256 * kjs/collector.cpp: Change CELL_SIZE from 64 to 56. 257 258 2002-11-22 Darin Adler <darin (a] apple.com> 259 260 - change ScopeChain to be a singly linked list shares tails, gives 11% gain on iBench 261 262 * kjs/context.h: 263 (ContextImp::pushScope): Make inline, use push instead of prepend, and pass imp pointer. 264 (ContextImp::popScope): Make inline, use pop instead of removeFirst. 265 * kjs/function.cpp: (DeclaredFunctionImp::DeclaredFunctionImp): No need to copy. 266 * kjs/function_object.cpp: (FunctionObjectImp::construct): Use push instead of 267 prepend, and pass imp pointer. 268 * kjs/internal.cpp: (ContextImp::ContextImp): Use clear, push instead of prepend, 269 and pass imp pointers. 270 * kjs/nodes.cpp: (ResolveNode::evaluateReference): Use isEmpty, pop, and top instead 271 of ScopeChainIterator. 272 * kjs/object.h: Change _scope to be a NoRefScopeChain. 273 * kjs/object.cpp: No need to initialize _scope any more, since it's not a NoRefScopeChain. 274 275 * kjs/scope_chain.h: Rewrite, different implementation and interface. 276 * kjs/scope_chain.cpp: More of the same. 277 278 2002-11-22 Maciej Stachowiak <mjs (a] apple.com> 279 280 - a simple change for .4% gain on ibench - instead of unmarking 281 all objects at the start of collection, instead unmark as part of 282 the sweep phase 283 284 * kjs/collector.cpp: 285 (Collector::collect): Remove separate unmarking pass and instead 286 unmark the objects that don't get collected during the sweep 287 phase. 288 289 2002-11-21 Darin Adler <darin (a] apple.com> 290 291 - stop garbage collecting the ActivationImp objects, gets 3% on iBench 292 - pave the way to separate the argument lists from scope chains 293 294 * kjs/context.h: Added. Moved ContextImp here so it can use things defined 295 in function.h 296 297 * kjs/scope_chain.h: Added. Starting as a copy of List, to be improved. 298 * kjs/scope_chain.cpp: Added. Starting as a copy of List, to be improved. 299 300 * JavaScriptCore.pbproj/project.pbxproj: Rearranged things, added context.h. 301 302 * kjs/function.cpp: 303 (FunctionImp::call): Pass InterpreterImp, not ExecState, to ContextImp. 304 (DeclaredFunctionImp::DeclaredFunctionImp): List -> ScopeChain. 305 (ActivationImp::createArgumentsObject): ArgumentList -> List. 306 (GlobalFuncImp::call): Pass InterpreterImp, not an ExecState, to ContextImp. 307 * kjs/function.h: List -> ScopeChain. 308 * kjs/function_object.cpp: (FunctionObjectImp::construct): List -> ScopeChain. 309 * kjs/internal.cpp: 310 (ContextImp::ContextImp): Set the context in the interpreter. 311 (ContextImp::~ContextImp): Set the context in the interpreter to the caller. 312 (ContextImp::mark): Mark all the activation objects. 313 (InterpreterImp::InterpreterImp): Initialize context to 0. 314 (InterpreterImp::mark): Mark the top context. 315 (InterpreterImp::evaluate): Pass InterpreterImp to ContextImp. 316 * kjs/internal.h: Move ContextImp to its own header. Add setContext to InterpreterImp. 317 * kjs/interpreter.cpp: (Context::scopeChain): List -> ScopeChain. 318 * kjs/interpreter.h: List -> ScopeChain. 319 * kjs/nodes.cpp: 320 (ResolveNode::evaluateReference): List -> ScopeChain. 321 (FuncDeclNode::processFuncDecl): List -> ScopeChain. 322 (FuncExprNode::evaluate): List -> ScopeChain. 323 * kjs/object.cpp: List -> ScopeChain. 324 * kjs/object.h: List -> ScopeChain. 325 326 * kjs/types.h: Remove needsMarking features from List. 327 * kjs/types.cpp: Ditto. 328 329 2002-11-21 Maciej Stachowiak <mjs (a] apple.com> 330 331 - reduced the size of PropertyMap by storing sizes and such in the 332 dynamically allocated part of the object to reduce the size of 333 ObjectImp - .5% speed improvement on JS iBench. 334 335 * kjs/property_map.cpp: 336 * kjs/property_map.h: 337 338 2002-11-21 Maciej Stachowiak <mjs (a] apple.com> 339 340 * Makefile.am: Pass symroots for this tree to pbxbuild. 341 342 === Alexander-33 === 343 344 2002-11-21 Darin Adler <darin (a] apple.com> 345 346 * kjs/property_map.cpp: More assertions. 347 348 2002-11-21 Darin Adler <darin (a] apple.com> 349 350 * kjs/property_map.cpp: Turn that consistency check back off. 351 352 2002-11-21 Darin Adler <darin (a] apple.com> 353 354 - someone somewhere must be defining a macro named check, causing a compile failure in WebCore 355 356 Rename check() to checkConsistency(). 357 358 * kjs/property_map.h: Rename. 359 * kjs/property_map.cpp: Yes, rename. 360 361 2002-11-21 Darin Adler <darin (a] apple.com> 362 363 - add self-check to property map in hopes of finding the cnet.com bug 364 365 * kjs/property_map.h: Add check() function. 366 * kjs/property_map.cpp: Add the checking, controlled by DO_CONSISTENCY_CHECK. 367 368 - fixed UChar interface so it's not so slow in debug builds 369 370 * kjs/ustring.h: Nothing in UChar needs to be private. 371 372 * kjs/function.cpp: (GlobalFuncImp::call): 373 * kjs/function_object.cpp: (FunctionObjectImp::construct): 374 * kjs/identifier.cpp: 375 * kjs/lexer.cpp: (Lexer::setCode), (Lexer::shift): 376 * kjs/lookup.cpp: (keysMatch): 377 * kjs/ustring.cpp: (UString::Rep::computeHash), (KJS::compare): 378 Use the "uc" field instead of the "unicode()" inline function. 379 380 2002-11-21 Darin Adler <darin (a] apple.com> 381 382 - fixed a null-dereference I ran into while trying to reproduce bug 3107351 383 384 * kjs/function.h: Change ActivationImp constructor to take context parameter. 385 * kjs/function.cpp: (ActivationImp::ActivationImp): Take context parameter, 386 not execution state parameter. 387 388 * kjs/internal.cpp: (ContextImp::ContextImp): Initialize activation object 389 from context, not execution state, because the new context is not yet in the 390 execution state. 391 392 2002-11-20 Darin Adler <darin (a] apple.com> 393 394 - added a feature for Richard to use in his back/forward cache 395 396 * kjs/object.h: Added save/restoreProperties. 397 * kjs/property_map.h: Here too. 398 * kjs/property_map.cpp: Here too. 399 400 2002-11-20 Darin Adler <darin (a] apple.com> 401 402 - created argument list objects only on demand for a 7.5% speedup 403 404 * kjs/function.h: Change ActivationImp around. 405 * kjs/function.cpp: 406 (FunctionImp::call): Pass a pointer to the arguments list to avoid ref/unref. 407 (FunctionImp::get): Get the function pointer from the context directly, 408 not the activation object. 409 (ArgumentsImp::ArgumentsImp): Add an overload that takes no arguments. 410 (ActivationImp::ActivationImp): Store a context pointer and an arguments object pointer. 411 (ActivationImp::get): Special case for arguments, create it and return it. 412 (ActivationImp::put): Special case for arguments, can't be set. 413 (ActivationImp::hasProperty): Special case for arguments, return true. 414 (ActivationImp::deleteProperty): Special case for arguments, refuse to delete. 415 (ActivationImp::mark): Mark the arguments object. 416 (ActivationImp::createArgumentsObject): Do the work of actually creating it. 417 (GlobalFuncImp::call): Use stack-based objects for the ContextImp and ExecState. 418 419 * kjs/internal.h: Keep function and arguments pointer in the context. 420 * kjs/internal.cpp: 421 (ContextImp::ContextImp): Don't pass in the func and args when making an ActivationImp. 422 (InterpreterImp::evaluate): Use stack-based objects here. 423 424 * kjs/types.h: Add ArgumentList as a synonym for List, soon to be separate. 425 426 2002-11-20 Maciej Stachowiak <mjs (a] apple.com> 427 428 Reduced the size of ValueImp by 8 bytes for a .5% speedup. 429 430 * kjs/value.h: Removed destructed flag. Made refcount and flag 16 431 bits each. 432 * kjs/value.cpp: 433 (ValueImp::~ValueImp): Don't set destructed flag. 434 435 2002-11-20 Darin Adler <darin (a] apple.com> 436 437 * kjs/types.cpp: Keep ref count for the whole lists of nodes. 438 Doesn't speed things up much, less than 1%. 439 440 2002-11-20 Maciej Stachowiak <mjs (a] apple.com> 441 442 * kjs/collector.cpp: 443 (Collector::allocate): Clear the flags on newly allocated objects. 444 445 2002-11-20 Darin Adler <darin (a] apple.com> 446 447 - oops, checked in big regression instead of 5% speedup 448 449 * kjs/function.cpp: (ActivationImp::ActivationImp): Make a marking 450 list, not a refing list. 451 452 - a cut at the sparse array implementation 453 454 * kjs/array_instance.h: Keep storageLength separate from length. 455 * kjs/array_object.cpp: 456 (ArrayInstanceImp::ArrayInstanceImp): Start with storageLength == length. 457 (ArrayInstanceImp::get): Check against storage length. 458 (ArrayInstanceImp::put): Ditto. 459 (ArrayInstanceImp::hasProperty): Ditto. 460 (ArrayInstanceImp::deleteProperty): Ditto. 461 (ArrayInstanceImp::setLength): Only enlarge storage length up to a cutoff. 462 (ArrayInstanceImp::mark): Use storageLength. 463 (ArrayInstanceImp::pushUndefinedObjectsToEnd): Added FIXME. 464 465 2002-11-20 Darin Adler <darin (a] apple.com> 466 467 - decrease ref/deref -- 5% speedup in iBench 468 469 * JavaScriptCore.pbproj/project.pbxproj: Added array_instance.h 470 * kjs/array_instance.h: Added so it can be shared by function.h. 471 472 * kjs/array_object.cpp: 473 * kjs/array_object.h: 474 * kjs/bool_object.cpp: 475 * kjs/bool_object.h: 476 * kjs/collector.cpp: 477 * kjs/date_object.cpp: 478 * kjs/date_object.h: 479 * kjs/error_object.cpp: 480 * kjs/function.cpp: 481 * kjs/function.h: 482 * kjs/function_object.cpp: 483 * kjs/internal.cpp: 484 * kjs/internal.h: 485 * kjs/math_object.cpp: 486 * kjs/nodes.cpp: 487 * kjs/number_object.cpp: 488 * kjs/object.cpp: 489 * kjs/object.h: 490 * kjs/object_object.cpp: 491 * kjs/property_map.cpp: 492 * kjs/reference.cpp: 493 * kjs/reference.h: 494 * kjs/regexp_object.cpp: 495 * kjs/string_object.cpp: 496 * kjs/string_object.h: 497 * kjs/value.cpp: 498 * kjs/value.h: 499 Switched lots of interfaces so they don't require ref/deref. 500 501 2002-11-20 Maciej Stachowiak <mjs (a] apple.com> 502 503 Fixed the two most obvious problems with the new GC for another 6% 504 improvement. 505 506 * kjs/collector.cpp: 507 (Collector::allocate): Don't bother doing the bit tests on a bitmap word if 508 all it's bits are on. 509 (Collector::collect): Track memoryFull boolean. 510 * kjs/collector.h: Inlined outOfMemory since it was showing up on profiles. 511 512 2002-11-20 Maciej Stachowiak <mjs (a] apple.com> 513 514 Rewrote garbage collector to make blocks of actual memory instead 515 of blocks of pointers. 7% improvement on JavaScript 516 iBench. There's still lots of room to tune the new GC, this is 517 just my first cut. 518 519 * kjs/collector.cpp: 520 (Collector::allocate): 521 (Collector::collect): 522 (Collector::size): 523 (Collector::outOfMemory): 524 (Collector::finalCheck): 525 (Collector::numGCNotAllowedObjects): 526 (Collector::numReferencedObjects): 527 (Collector::liveObjectClasses): 528 * kjs/collector.h: 529 * kjs/function.cpp: 530 (ActivationImp::ActivationImp): 531 * kjs/function.h: 532 533 2002-11-20 Darin Adler <darin (a] apple.com> 534 535 - on the road to killing ActivationImp 536 537 * kjs/function.h: Add get/put to FunctionImp. Remove argumentsObject() from 538 ActivationImp. Add function() to ActivationImp. 539 * kjs/function.cpp: 540 (FunctionImp::FunctionImp): No arguments property. 541 (FunctionImp::call): No need to set up the arguments property. 542 (FunctionImp::parameterString): Remove ** strangeness. 543 (FunctionImp::processParameters): Ditto. 544 (FunctionImp::get): Added, handles arguments and length properties. 545 (FunctionImp::put): Ditto. 546 (FunctionImp::hasProperty): Ditto. 547 (FunctionImp::deleteProperty): Ditto. 548 (ActivationImp::ActivationImp): Store a function pointer so we can find it 549 in the context. 550 551 * kjs/function_object.cpp: (FunctionObjectImp::construct): No need to set up 552 arguments property. 553 * kjs/nodes.cpp: (FuncExprNode::evaluate): No need to set up length property. 554 555 * kjs/internal.h: Return ObjectImp * for activation object. 556 557 * kjs/interpreter.h: Remove stray declaration of ExecStateImp. 558 559 2002-11-20 Darin Adler <darin (a] apple.com> 560 561 - add a couple of list operations to avoid clearing lists so much during sorting; gives 1.5% iBench 562 563 * kjs/types.h: Added replaceFirst/replaceLast. 564 * kjs/types.cpp: (List::replaceFirst), (List::replaceLast): Added. 565 566 * kjs/array_object.cpp: (compareWithCompareFunctionForQSort): Use replaceFirst/replaceLast. 567 568 * kjs/property_map.cpp: Put in an ifdef so I can re-add/remove the single entry to see if 569 it has outlived its usefulness. (It hasn't yet.) 570 571 2002-11-20 Darin Adler <darin (a] apple.com> 572 573 - atomic identifiers; gives another 6.5% in the iBench suite 574 575 * kjs/identifier.h: Did the real thing. 576 * kjs/identifier.cpp: Ditto. 577 578 * kjs/property_map.h: _tableSizeHashMask -> _tableSizeMask 579 * kjs/property_map.cpp: The above, plus take advantage of comparing 580 by pointer instead of by comparing bytes. 581 582 2002-11-19 Darin Adler <darin (a] apple.com> 583 584 - a few more globals for often-used property names 585 - conversion to Identifier from UString must now be explicit 586 587 * kjs/error_object.cpp: 588 * kjs/function.cpp: 589 * kjs/function_object.cpp: 590 * kjs/identifier.cpp: 591 * kjs/identifier.h: 592 * kjs/lexer.cpp: 593 * kjs/nodes.cpp: 594 * kjs/number_object.cpp: 595 * kjs/object.cpp: 596 * kjs/object.h: 597 * kjs/string_object.cpp: 598 * kjs/testkjs.cpp: 599 * kjs/ustring.cpp: 600 * kjs/ustring.h: 601 602 2002-11-19 Darin Adler <darin (a] apple.com> 603 604 - another step towards atomic identifiers; storing hash in the string rep. gives about 605 a 1.5% speedup in the JavaScript iBench 606 607 * kjs/ustring.h: Add a hash field to UString::Rep. 608 * kjs/ustring.cpp: 609 (UString::Rep::create): Set hash to uninitialized value. 610 (UString::Rep::destroy): Do the deleting in her, and call Identifier if needed. 611 (UString::Rep::computeHash): Added. 612 (UString::append): Set hash to 0 when modifying the string in place. 613 (UString::operator=): Ditto. 614 615 * kjs/property_map.cpp: Use the hash from UString. 616 617 * kjs/identifier.h: Added aboutToDestroyUStringRep. 618 * kjs/identifier.cpp: (Identifier::aboutToDestroyUStringRep): Added. 619 620 2002-11-19 Darin Adler <darin (a] apple.com> 621 622 - next step towards atomic identifiers; Identifier is no longer derived from UString 623 624 * kjs/identifier.h: Remove base class and add _ustring member. 625 * kjs/identifier.cpp: Add null and an == that works with const char *. 626 * kjs/property_map.cpp: Get rep through _ustring. 627 628 * kjs/function.cpp: (FunctionImp::parameterString): Call ustring(). 629 * kjs/function_object.cpp: (FunctionProtoFuncImp::call): Ditto. 630 * kjs/nodes.cpp: 631 (PropertyNode::evaluate): Ditto. 632 (VarDeclNode::evaluate): Ditto. 633 (ForInNode::execute): Ditto. 634 * kjs/nodes2string.cpp: (SourceStream::operator<<): Add overload for Identifier. 635 * kjs/reference.cpp: (Reference::getValue): Call ustring(). 636 * kjs/regexp_object.cpp: (RegExpObjectImp::get): Call ustring(). 637 638 2002-11-19 Darin Adler <darin (a] apple.com> 639 640 - fixed memory trasher 641 642 * kjs/ustring.cpp: (UString::from): Fix "end of buffer" computation. 643 644 2002-11-19 Darin Adler <darin (a] apple.com> 645 646 - a first step towards atomic identifiers in JavaScript 647 648 Most places that work with identifiers now use Identifier 649 instead of UString. 650 651 * kjs/identifier.cpp: Added. 652 * kjs/identifier.h: Added. 653 * JavaScriptCore.pbproj/project.pbxproj: Added files. 654 655 * kjs/array_object.cpp: 656 * kjs/array_object.h: 657 * kjs/completion.cpp: 658 * kjs/completion.h: 659 * kjs/date_object.cpp: 660 * kjs/date_object.h: 661 * kjs/function.cpp: 662 * kjs/function.h: 663 * kjs/function_object.cpp: 664 * kjs/grammar.cpp: 665 * kjs/grammar.cpp.h: 666 * kjs/grammar.h: 667 * kjs/grammar.y: 668 * kjs/internal.cpp: 669 * kjs/internal.h: 670 * kjs/lexer.cpp: 671 * kjs/lookup.cpp: 672 * kjs/lookup.h: 673 * kjs/math_object.cpp: 674 * kjs/math_object.h: 675 * kjs/nodes.cpp: 676 * kjs/nodes.h: 677 * kjs/number_object.cpp: 678 * kjs/number_object.h: 679 * kjs/object.cpp: 680 * kjs/object.h: 681 * kjs/property_map.cpp: 682 * kjs/property_map.h: 683 * kjs/reference.cpp: 684 * kjs/reference.h: 685 * kjs/regexp_object.cpp: 686 * kjs/regexp_object.h: 687 * kjs/string_object.cpp: 688 * kjs/string_object.h: 689 690 2002-11-19 Darin Adler <darin (a] apple.com> 691 692 - fix hash function and key comparison for the other kind of hash table; yields 3% 693 694 * kjs/lookup.cpp: 695 (keysMatch): Added. 696 (Lookup::findEntry): Don't allocate and convert to ASCII just to search. 697 698 2002-11-19 Darin Adler <darin (a] apple.com> 699 700 - another hash table fix; yields a 2% improvement on iBench JavaScript 701 702 * kjs/property_map.cpp: A few more places where we use & instead of %. 703 704 - some List changes that don't affect speed yet 705 706 * kjs/types.cpp: 707 (List::prependList): Tighten up a tiny bit. 708 (List::copy): Use prependList. 709 * kjs/types.h: Remove appendList and globalClear. 710 711 * kjs/interpreter.cpp: (Interpreter::finalCheck): Remove List::globalClear(). 712 713 2002-11-19 Darin Adler <darin (a] apple.com> 714 715 - fixed 3105026 -- REGRESSION: DHTML menus are broken all over the place 716 717 * kjs/types.cpp: (List::prepend): Fix backwards links in new node. 718 719 2002-11-19 Darin Adler <darin (a] apple.com> 720 721 - a fix that gives another 1.5% on the iBench JavaScript test 722 723 * kjs/ustring.cpp: (UString::from): Stop using sprintf to format integers. 724 725 2002-11-18 Darin Adler <darin (a] apple.com> 726 727 - reduced the creation of Value objects and hoisted the property map 728 into Object for another gain of about 6% 729 730 * JavaScriptCore.pbproj/project.pbxproj: Made property_map.h public. 731 * kjs/array_object.cpp: 732 (compareWithCompareFunctionForQSort): Don't wrap the ValueImp * in a Value 733 just to add it to a list. 734 (ArrayProtoFuncImp::call): Pass the globalObject directly so we don't have 735 to ref/deref. 736 * kjs/function.cpp: 737 (FunctionImp::call): Use a reference for the global object to avoid ref/deref. 738 (GlobalFuncImp::call): Ditto. 739 * kjs/internal.cpp: 740 (BooleanImp::toObject): Put the object directly into the list, don't create a Value. 741 (StringImp::toObject): Ditto. 742 (NumberImp::toObject): Ditto. 743 (InterpreterImp::evaluate): Use a reference for the global object. 744 * kjs/internal.h: Return a reference for the global object. 745 * kjs/interpreter.cpp: (Interpreter::globalObject): Ditto. 746 * kjs/interpreter.h: Ditto. 747 * kjs/object.cpp: Use _prop directly in the object, not a separate pointer. 748 * kjs/object.h: Ditto. 749 * kjs/types.cpp: Added List methods that work directly with ValueImp. 750 (List::append): Added a ValueImp version. 751 (List::prepend): Ditto. 752 (List::appendList): Work directly with the ValueImp's. 753 (List::prependList): Ditto. 754 (List::copy): Use appendList. 755 (List::empty): Use a shared global List. 756 * kjs/types.h: Update for above changes. 757 758 2002-11-18 Darin Adler <darin (a] apple.com> 759 760 * kjs/property_map.cpp: Oops, copyright goes to Apple, not me. 761 * kjs/property_map.h: Ditto. 762 763 2002-11-18 Darin Adler <darin (a] apple.com> 764 765 - property and string improvements giving a 7% or so improvement in JavaScript iBench 766 767 * kjs/property_map.h: Rewrite to use a hash table. 768 * kjs/property_map.cpp: Ditto. 769 770 * kjs/string_object.h: 771 * kjs/string_object.cpp: 772 (StringInstanceImp::StringInstanceImp): Construct a string with the right value 773 instead of putting the string in later. 774 (StringInstanceImp::get): Get the length from the string, not a separate property. 775 (StringInstanceImp::put): Ignore attempts to set length, since we don't put it in 776 the property map. 777 (StringInstanceImp::hasProperty): Return true for length. 778 (StringInstanceImp::deleteProperty): Return false for length. 779 (StringObjectImp::construct): Call new StringInstanceImp constructor. Don't try 780 to set a length property. 781 782 * kjs/ustring.h: Make the rep deref know how to deallocate the rep. 783 * kjs/ustring.cpp: 784 (UString::release): Move the real work to the rep's deref, since the hash table 785 now uses the rep directly. 786 787 * kjs/object.h: Remove unused field. 788 789 2002-11-18 Maciej Stachowiak <mjs (a] apple.com> 790 791 Change List to completely avoid going through the GC 792 allocator. 3.6% performance improvement on JavaScript iBench. 793 794 * kjs/internal.cpp: 795 (InterpreterImp::mark): Don't mark the empty list. 796 797 For all the methods below I basically lifted the ListImp version 798 up to the List method with minor tweaks. 799 800 * kjs/types.cpp: 801 (ListIterator::ListIterator): 802 (List::List): 803 (List::operator=): 804 (List::~List): 805 (List::mark): 806 (List::append): 807 (List::prepend): 808 (List::appendList): 809 (List::prependList): 810 (List::removeFirst): 811 (List::removeLast): 812 (List::remove): 813 (List::clear): 814 (List::clearInternal): 815 (List::copy): 816 (List::begin): 817 (List::end): 818 (List::isEmpty): 819 (List::size): 820 (List::at): 821 (List::operator[]): 822 (List::empty): 823 (List::erase): 824 (List::refAll): 825 (List::derefAll): 826 (List::swap): 827 (List::globalClear): 828 * kjs/types.h: 829 830 2002-11-18 Maciej Stachowiak <mjs (a] apple.com> 831 832 Fixed a horrible leak introduced with my last change that 833 somehow did not show up on my machine. 834 835 * kjs/types.cpp: 836 (List::List): Mark ListImp as GC allowed. 837 838 2002-11-18 Maciej Stachowiak <mjs (a] apple.com> 839 840 Another step towards the List conversion: stop inheriting from Value. 841 842 * kjs/types.cpp: 843 (ListIterator::ListIterator): 844 (List::List): 845 (List::operator=): 846 (List::~List): 847 (List::mark): 848 (List::append): 849 (List::prepend): 850 (List::appendList): 851 (List::prependList): 852 (List::removeFirst): 853 (List::removeLast): 854 (List::remove): 855 (List::clear): 856 (List::copy): 857 (List::begin): 858 (List::end): 859 (List::isEmpty): 860 (List::size): 861 (List::at): 862 (List::operator[]): 863 * kjs/types.h: 864 865 2002-11-18 Maciej Stachowiak <mjs (a] apple.com> 866 867 Partway to removing Value from List. Created a marking List 868 variant, used it in place of ListImp. 869 870 * kjs/internal.h: Removed List stuff. 871 * kjs/internal.cpp: 872 (InterpreterImp::mark): Call appropriate List method to do marking of 873 empty ListImp. 874 * kjs/object.h: 875 * kjs/object.cpp: Use marking List instead of ListImp *. 876 * kjs/types.h: 877 * kjs/types.cpp: 878 (List::List): New boolean needsMarking parameter. 879 (List::operator=): Perform trickery related to needsMarking. 880 (List::~List): Likewise. 881 (List::mark): Mark the ListImp. 882 (List::markEmptyList): 883 (ListImp::*): Moved here fron internal.cpp, they will be 884 integrated into the relevant List methods soon. 885 886 2002-11-18 Darin Adler <darin (a] apple.com> 887 888 - another string constant discovered that can be optimized 889 890 * kjs/object.h: Add a property name constant for "__proto__". 891 * kjs/object.cpp: Define it. 892 (ObjectImp::get): Use it. 893 (ObjectImp::hasProperty): Use it. 894 895 - prepare to turn PropertyMap into a hash table 896 897 * kjs/object.cpp: 898 (ObjectImp::mark): Use the new PropertyMap::mark(). 899 (ObjectImp::put): Use the new overload of PropertyMap::get(). 900 (ObjectImp::deleteProperty): Use the new overload of PropertyMap::get(). 901 (ObjectImp::propList): Use PropertyMap::addEnumerablesToReferenceList(). 902 903 * kjs/property_map.h: Remove PropertyMapNode and make all node-related methods private. 904 Add mark(), a new overload of get() that returns attributes, a clear() that takes no attributes, 905 and addEnumerablesToReferenceList(). 906 * kjs/property_map.cpp: 907 (PropertyMap::get): Added new overload. 908 (PropertyMap::clear): Added new overload. 909 (PropertyMap::mark): Added. 910 (PropertyMap::addEnumerablesToReferenceList): Added. 911 912 * kjs/ustring.h: Added a hash function. 913 * kjs/ustring.cpp: (KJS::hash): Added. 914 915 2002-11-18 Darin Adler <darin (a] apple.com> 916 917 - simplified the ExecState class, which was showing up in profiles 918 919 Sped up JavaScript iBench by 6%. 920 921 * kjs/interpreter.h: Removed the level of indirection, and made it all inline. 922 * kjs/interpreter.cpp: Removed ExecState implementation from here altogether. 923 924 - fixed an oversight in my sort speedup 925 926 * kjs/array_object.h: Add pushUndefinedObjectsToEnd. 927 * kjs/array_object.cpp: 928 (ArrayInstanceImp::sort): Call pushUndefinedObjectsToEnd. 929 (ArrayInstanceImp::pushUndefinedObjectsToEnd): Added. 930 Pushes all undefined to the end of the array. 931 932 2002-11-18 Darin Adler <darin (a] apple.com> 933 934 - fix worst speed problems on the sort page of the iBench JavaScript test 935 936 Sped up JavaScript iBench by 70%, the sort page by 88%. 937 938 * kjs/array_object.h: Add array-specific sort functions. 939 * kjs/array_object.cpp: 940 (compareByStringForQSort): Added. 941 (ArrayInstanceImp::sort): Added. 942 (compareWithCompareFunctionForQSort): Added. 943 (ArrayProtoFuncImp::call): Use ArrayInstanceImp::sort if the object being 944 sorted is actually an array. 945 946 * kjs/object.h: Add argumentsPropertyName. 947 * kjs/object.cpp: Add argumentsPropertyName. 948 * kjs/function.cpp: 949 (FunctionImp::FunctionImp): Use argumentsPropertyName to avoid making a UString. 950 (FunctionImp::call): Ditto. 951 (ActivationImp::ActivationImp): Ditto. 952 * kjs/function_object.cpp: (FunctionObjectImp::construct): Ditto. 953 954 * kjs/ustring.h: Added compare function for -1/0/+1 comparison. 955 * kjs/ustring.cpp: (KJS::compare): Added. 956 957 2002-11-18 Maciej Stachowiak <mjs (a] apple.com> 958 959 Change ArgumentListNode operations to be iterative instead of 960 recursive. This probably fixes 3095446 (Crash in 961 KJS::ArgumentListNode::ref()) but I can't reproduce it myself so 962 I'm not 100% sure. I think the original bug was a stack overflow 963 and this change would remove that possibility. 964 965 * kjs/nodes.cpp: 966 (ArgumentListNode::ref): Make iterative. 967 (ArgumentListNode::deref): Make iterative. 968 (ArgumentListNode::evaluateList): Make iterative. 969 970 === Alexander-32 === 971 972 2002-11-14 Darin Adler <darin (a] apple.com> 973 974 - fixed 3101243 -- excite passes date that can't be parsed, results in bogus date at top right corner 975 976 * kjs/date_object.cpp: (KJS::KRFCDate_parseDate): Handle errors from strtol 977 by checking errno. Check the "string in a haystack" to be sure it's a multiple 978 of 3. Add case that allows year to be after time. 979 980 2002-11-14 Darin Adler <darin (a] apple.com> 981 982 - fixed 3101191 -- REGRESSION: Hang loading excite.com 983 984 * kjs/date_object.cpp: 985 (mktimeUsingCF): Pick an arbitrary cutoff of 3000, and return -1 if the 986 year passed in is that big so we don't infinite loop. Also validate the 987 rest of the date with CFGregorianDateIsValid. 988 (DateProtoFuncImp::call): Handle a -1 result from mktime. 989 (DateObjectImp::construct): Check for NaN before calling mktime, and also 990 handle a -1 result from mktime. 991 (DateObjectFuncImp::call): Check for NaN before calling mktime, and also 992 handle a -1 result from mktime. 993 994 2002-11-13 Darin Adler <darin (a] apple.com> 995 996 - fixed 3099930 -- dates/times without time zones are parsed as UTC by kjs, 997 local time by other browsers 998 999 * kjs/date_object.cpp: 1000 (DateProtoFuncImp::call): Handle the NaN case better, like Mozilla and OmniWeb. 1001 (DateObjectFuncImp::call): Return NaN rather than Undefined() for bad dates. 1002 (KJS::parseDate): Return NaN rather than Undefined() or 0 for bad dates. 1003 (KJS::KRFCDate_parseDate): Return -1 rather than 0 for bad dates. 1004 Assume local time if no time zone is passed. Don't return 1 if we parse 0. 1005 1006 2002-11-13 Darin Adler <darin (a] apple.com> 1007 1008 - fixed 3073230 -- JavaScript time calls do I/O by lstat()ing /etc/localtime 1009 1010 * kjs/date_object.cpp: 1011 (formatDate): Added. 1012 (formatTime): Added. 1013 (formatLocaleDate): Added. 1014 (formatLocaleTime): Added. 1015 (DateProtoFuncImp::call): Changed to use the above functions instead of 1016 using strftime. 1017 1018 2002-11-08 Darin Adler <darin (a] apple.com> 1019 1020 * kjs/date_object.cpp: 1021 (ctimeUsingCF): Added. 1022 (timeUsingCF): Added. 1023 1024 2002-11-07 Darin Adler <darin (a] apple.com> 1025 1026 * kjs/date_object.cpp: (mktimeUsingCF): Fix storage leak. 1027 1028 2002-11-07 Maciej Stachowiak <mjs (a] apple.com> 1029 1030 - partial fix to 3073230 - JavaScript time calls do I/O by 1031 lastat()ing /etc/localtime 1032 1033 * kjs/date_object.cpp: 1034 (mktimeUsingCF): Implementation of mktime using CF. 1035 1036 === Alexander-31 === 1037 1038 2002-11-01 Darin Adler <darin (a] apple.com> 1039 1040 * kjs/object.cpp: Make the same change Maciej just did, but to the 1041 other constructor right next to the one he changed. 1042 1043 2002-10-31 Maciej Stachowiak <mjs (a] apple.com> 1044 1045 - fixed 3082660 - REGRESSION: one ListImp leaks opening/closing nearly empty web page 1046 1047 * kjs/object.cpp: Set gc allowed on freshly created ListImp, since 1048 there is no List wrapper for it. 1049 1050 2002-10-31 Darin Adler <darin (a] apple.com> 1051 1052 * kjs/grammar.y: Fix the APPLE_CHANGES thing here too. 1053 * kjs/grammar.cpp: Regenerated this file. 1054 1055 === Alexander-30 === 1056 1057 2002-10-30 Darin Adler <darin (a] apple.com> 1058 1059 - fixed 3073230 -- Alex is doing file I/O when executing JavaScript by asking for localtime 1060 1061 I fixed this by using Core Foundation time functions instead. 1062 1063 * kjs/date_object.cpp: 1064 (tmUsingCF): Function that uses Core Foundation to get the time and then puts it into 1065 a tm struct. 1066 (gmtimeUsingCF): Function used instead of gmtime (used a macro to make the substitution). 1067 (localtimeUsingCF): Function used instead of localtime (used a macro to make the substitution). 1068 1069 2002-10-26 Darin Adler <darin (a] apple.com> 1070 1071 - changed to use #if APPLE_CHANGES and #if !APPLE_CHANGES consistently 1072 1073 We no longer do #ifdef APPLE_CHANGES or #ifndef APPLE_CHANGES. 1074 1075 * kjs/collector.cpp: 1076 * kjs/collector.h: 1077 * kjs/grammar.cpp: 1078 * kjs/internal.cpp: 1079 * kjs/ustring.h: 1080 1081 2002-10-25 Darin Adler <darin (a] apple.com> 1082 1083 - fixed 3038011 -- drop-down menu hierarchy broken at yahoo new acct page 1084 1085 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): 1086 Fix bug calling concat on an empty array. The old code tried to 1087 optimize in a way that would prevent appending any arrays until 1088 at least one element was in the destination array. So if you were 1089 concatenating a non-empty array into an empty array, you got an empty array. 1090 1091 === Alexander-29 === 1092 1093 === Alexander-28 === 1094 1095 2002-10-10 Darin Adler <darin (a] apple.com> 1096 1097 - fixed 3072643 -- infinite loop in JavaScript code at walgreens.com 1098 1099 The problem is that "xxx".indexOf("", 1) needs to return 1, but we 1100 were returning 0. 1101 1102 * kjs/ustring.cpp: 1103 (UString::find): Return pos, not 0, when the search string is empty. 1104 (UString::rfind): Make sure that pos is not past the end of the string, 1105 taking into account the search string; fixes a potential read off the end 1106 of the buffer. Also return pos, not 0, when the search string is empty. 1107 1108 === Alexander-27 === 1109 1110 2002-10-07 Darin Adler <darin (a] apple.com> 1111 1112 Fixed absurdly high memory usage when looking at pages that use a lot of JavaScript. 1113 1114 * kjs/collector.cpp: 1115 (Collector::allocate): Implement a new policy of doing a garbage collect every 1000 1116 allocations. The old policy was both complicated and misguided. 1117 (Collector::collect): Zero out the "number of allocations since last collect". 1118 1119 2002-10-06 Darin Adler <darin (a] apple.com> 1120 1121 I noticed some broken lists at mapblast.com and tracked it down to this. 1122 1123 * kjs/array_object.cpp: 1124 (ArrayInstanceImp::put): Don't truncate the list; only extend the length if 1125 it's not already long enough. 1126 (ArrayProtoFuncImp::call): Fix some ifdef'd code so it compiles if you turn 1127 the ifdefs on. 1128 1129 2002-10-04 Darin Adler <darin (a] apple.com> 1130 1131 Fixed problems parsing numbers that are larger than a long with parseInt. 1132 1133 * kjs/config.h: Define HAVE_FUNC_STRTOLL. 1134 * kjs/function.cpp: (GlobalFuncImp::call): 1135 Change parseInt to use strtoll if available. 1136 1137 === Alexander-26 === 1138 1139 2002-09-27 Darin Adler <darin (a] apple.com> 1140 1141 - fixed 3033969 -- repro crash (infinite recursion in JavaScript) 1142 clicking on "screens" option at fsv.sf.net 1143 1144 * kjs/object.h: Change recursion limit to 100 levels rather than 1000. 1145 1146 === Alexander-25 === 1147 1148 2002-09-26 Darin Adler <darin (a] apple.com> 1149 1150 Fix the infinity problem Dave worked around. We didn't have the 1151 configuration flags set right to make infinity work. Setting those 1152 properly made everything work without changes to min and max. 1153 1154 * kjs/config.h: Define HAVE_FUNC_ISINF, HAVE_STRING_H, and 1155 also WORDS_BIGENDIAN (if on ppc). 1156 1157 * kjs/math_object.cpp: (MathFuncImp::call): Roll out min and max 1158 changes from yesterday. 1159 1160 2002-09-25 David Hyatt <hyatt (a] apple.com> 1161 1162 Fix the impls of min/max to not use +inf/-inf when you have 1163 arguments. Technically there's still a bug here for the no 1164 argument case, probably caused by a screwup when +inf/-inf are 1165 converted to doubles. 1166 1167 * kjs/math_object.cpp: 1168 (MathFuncImp::call): 1169 1170 2002-09-25 Darin Adler <darin (a] apple.com> 1171 1172 - fixed 3057964 -- JS problem performing MD5 script embedded in yahoo login page 1173 1174 * kjs/simple_number.h: Fix incorrect check for sign bit that was munging numbers 1175 in the range 0x10000000 to 0x1FFFFFFF. 1176 1177 === Alexander-24 === 1178 1179 === Alexander-22 === 1180 1181 2002-09-05 Maciej Stachowiak <mjs (a] apple.com> 1182 1183 First baby step towards moving List away from garbage collection. 1184 1185 * kjs/types.h: Add needsMarking boolean and make List inherit from 1186 Value privately instead of publicly. 1187 1188 2002-08-30 Darin Adler <darin (a] apple.com> 1189 1190 * JavaScriptCore.pbproj/project.pbxproj: Allowed the new Project Builder to put in 1191 encodings for each file. 1192 1193 === Alexander-21 === 1194 1195 === Alexander-20 === 1196 1197 2002-08-20 Darin Adler <darin (a] apple.com> 1198 1199 Three small changes to things that showed up in the sample. 1200 1201 5% speed increase on cvs-js-performance test. 1202 1203 * kjs/simple_number.h: Check if double is an integer with d == (double)(int)d 1204 instead of remainder(d, 1) == 0, saving a function call each time. 1205 1206 * kjs/ustring.cpp: 1207 (UString::find): Compare the first character before calling memcmp for the rest. 1208 (UString::rfind): Ditto. 1209 (KJS::operator==): Don't do a strlen before starting to compare the characters. 1210 1211 2002-08-20 Maciej Stachowiak <mjs (a] apple.com> 1212 1213 * kjs/object.cpp: Don't reference other ValueImps in the 1214 destructor, they may have already been destroyed, and will have 1215 GC_ALLOWED set already in any case. 1216 1217 2002-08-19 Maciej Stachowiak <mjs (a] apple.com> 1218 1219 Fixed the bug that made sony.com menus come out wrong and made 1220 aa.com crash (Radar 3027762). 1221 1222 Mode most methods inline. 1223 1224 * kjs/completion.cpp: 1225 * kjs/completion.h: 1226 1227 2002-08-19 Maciej Stachowiak <mjs (a] apple.com> 1228 1229 Maintain stack of old "arguments" property values for functions 1230 implicitly on the system stack instead of explicitly in the 1231 FunctionImp. This eliminates only a trivial number of GC 1232 allocations (less than 200) but eliminates one of the two cases 1233 where a ListImp * is stored directly, paving the way to separate 1234 List from Value. 1235 1236 * kjs/function.h: Remove argStack, pushArgs and popArgs. 1237 * kjs/function.cpp: 1238 (FunctionImp::FunctionImp): Don't initalize argStack. 1239 (FunctionImp::~FunctionImp): Remove comment about argStack. 1240 (FunctionImp::mark): Don't mark the argStack. 1241 (FunctionImp::call): Save old "arguments" property in a Value, 1242 where it will be GC-protected, rather than keeping a list, and 1243 restore the old value when done executing. 1244 1245 2002-08-18 Darin Adler <darin (a] apple.com> 1246 1247 * kjs/internal.cpp: (KJS::printInfo): Remove one more CompletionType 1248 that Maciej missed. 1249 1250 2002-08-18 Maciej Stachowiak <mjs (a] apple.com> 1251 1252 Remove stray references to CompletionType and CompletionImp. 1253 1254 * kjs/completion.h: 1255 * kjs/object.cpp: 1256 * kjs/value.h: 1257 1258 2002-08-18 Maciej Stachowiak <mjs (a] apple.com> 1259 1260 Separated Completion from Value and made it a pure stack 1261 object. This removed another 160,000 of the remaining 580,000 1262 garbage collected object allocations. 1263 1264 6% speed increase on cvs-js-performance test. 1265 1266 * kjs/completion.cpp: Added. New implementation that doesn't 1267 require a ValueImp *. 1268 (Completion::Completion): 1269 (Completion::complType): 1270 (Completion::value): 1271 (Completion::target): 1272 (Completion::isValueCompletion): 1273 * kjs/completion.h: Added. 1274 * kjs/function.cpp: 1275 (GlobalFuncImp::call): Removed some (apparently mistaken) uses of 1276 Completion as a Value. 1277 * kjs/internal.cpp: 1278 * kjs/internal.h: 1279 * kjs/types.cpp: Removed Completion stuff. 1280 * kjs/types.h: Removed Completion stuff. 1281 * JavaScriptCore.pbproj/project.pbxproj: Added new header. 1282 1283 2002-08-16 Darin Adler <darin (a] apple.com> 1284 1285 Fix the Development build. 1286 1287 * kjs/object.cpp: Take out a use of ReferenceType. 1288 1289 * kjs/ustring.h: Added a bit more inlining. 1290 * kjs/ustring.cpp: Moved the function out of here. 1291 1292 2002-08-16 Maciej Stachowiak <mjs (a] apple.com> 1293 1294 Final step of the Reference change. Completely separate Reference 1295 from Value, and eliminate ReferenceImp. 1296 1297 18% speedup on cvs-js-performance test. 1298 1299 * kjs/internal.cpp, kjs/internal.h: Remove ReferenceImp. 1300 * kjs/nodes.cpp: 1301 (Node::evaluateReference): Use Reference::makeValueReference(), 1302 not ConstReference. 1303 * kjs/reference.cpp: 1304 (Reference::Reference): New implementation, handles both regular 1305 and value references. 1306 (Reference::makeValueReference): Incorporate functionality of ConstReference 1307 into this class. 1308 (Reference::getBase): New implementation (incorporates error vase 1309 for value references). 1310 (Reference::getPropertyName): New implementation (incorporates error case 1311 for value references). 1312 (Reference::putValue): New implementation (incorporates error case 1313 for value references). 1314 (Reference::deleteValue): New implementation (incorporates error case 1315 for value references). 1316 (Reference::getValue): New implementation (incorporates special case 1317 for value references). 1318 (Reference::isMutable): New implementation. 1319 * kjs/reference.h: New implementation that merges ReferenceImp 1320 into the stack object. 1321 * kjs/value.h, kjs/value.cpp: Removed all reference-related method. 1322 1323 2002-08-16 Darin Adler <darin (a] apple.com> 1324 1325 - fixed 3026184 -- Hang going to http://aa.com/ while executing JavaScript 1326 1327 * kjs/simple_number.h: (SimpleNumber::value): Fixed conversion to a negative 1328 number. The technique of using division was no good. Instead, or in the sign 1329 bits as needed. 1330 1331 2002-08-16 Maciej Stachowiak <mjs (a] apple.com> 1332 1333 * kjs/reference_list.h: Must include headers with "", not 1334 <>. D'oh! 1335 1336 2002-08-16 Maciej Stachowiak <mjs (a] apple.com> 1337 1338 * JavaScriptCore.pbproj/project.pbxproj: Install reference.h and 1339 reference_list.h so WebCore compiles (duh). 1340 1341 2002-08-16 Maciej Stachowiak <mjs (a] apple.com> 1342 1343 * JavaScriptCore.pbproj/project.pbxproj: 1344 * kjs/internal.cpp: 1345 * kjs/internal.h: 1346 * kjs/nodes.cpp: 1347 (Node::evaluateReference): 1348 * kjs/reference.cpp: 1349 (Reference::Reference): 1350 (Reference::makeValueReference): 1351 (Reference::getBase): 1352 (Reference::getPropertyName): 1353 (Reference::getValue): 1354 (Reference::putValue): 1355 (Reference::deleteValue): 1356 (Reference::isMutable): 1357 * kjs/reference.h: 1358 * kjs/reference_list.h: 1359 * kjs/value.cpp: 1360 (ValueImp::dispatchToUInt32): 1361 * kjs/value.h: 1362 1363 2002-08-16 Maciej Stachowiak <mjs (a] apple.com> 1364 1365 Next step: reimplement ReferenceList from scratch, and store it as 1366 an actual Reference object, so ReferenceList no longer depends on 1367 Reference being a Value or having a ReferenceImp. A resizing 1368 vector might be even better the way this is used. 1369 1370 Also moved Reference to its own header and implementation file in 1371 preparation for reimplementing it. 1372 1373 * JavaScriptCore.pbproj/project.pbxproj: 1374 * kjs/nodes.cpp: 1375 (ForInNode::execute): 1376 * kjs/reference.cpp: Added. 1377 (Reference::Reference): 1378 (Reference::dynamicCast): 1379 (ConstReference::ConstReference): 1380 * kjs/reference.h: Added. 1381 * kjs/reference_list.cpp: Added. 1382 (ReferenceList::ReferenceList): 1383 (ReferenceList::operator=): 1384 (ReferenceList::swap): 1385 (ReferenceList::append): 1386 (ReferenceList::~ReferenceList): 1387 (ReferenceList::begin): 1388 (ReferenceList::end): 1389 (ReferenceListIterator::ReferenceListIterator): 1390 (ReferenceListIterator::operator!=): 1391 (ReferenceListIterator::operator->): 1392 (ReferenceListIterator::operator++): 1393 * kjs/reference_list.h: 1394 * kjs/types.cpp: 1395 * kjs/types.h: 1396 1397 2002-08-16 Maciej Stachowiak <mjs (a] apple.com> 1398 1399 Fix Development build - some NDEBUG code had to be changed for the 1400 Value/Reference split. 1401 1402 * kjs/internal.cpp: 1403 (KJS::printInfo): 1404 * kjs/nodes.cpp: 1405 (FunctionCallNode::evaluate): 1406 1407 2002-08-16 Maciej Stachowiak <mjs (a] apple.com> 1408 1409 * kjs/reference_list.h: Added file I forgot to check in last time. 1410 1411 2002-08-15 Maciej Stachowiak <mjs (a] apple.com> 1412 1413 Phase 1 of optimization to stop allocating references through the 1414 collector. This step clearly splits evaluating to a reference and 1415 evaluating to a value, and moves all of the reference-specific 1416 operations from Value to Reference. A special ConstReference class 1417 helps out for the one case where you need special reference 1418 operations if the result is a reference, and not otherwise. 1419 1420 Also, Reference now inherits privately from Value, and there is a 1421 new ReferenceList class that inherits privately from List, so the 1422 uses of Reference and Value are now completely orthogonal. This 1423 means that as the next step, their implementations can be 1424 completely disentangled. 1425 1426 This step has no actual performance impact. 1427 1428 * kjs/collector.cpp: 1429 (Collector::collect): 1430 * kjs/nodes.cpp: 1431 (Node::evaluateReference): 1432 (ResolveNode::evaluate): 1433 (ResolveNode::evaluateReference): 1434 (ElementNode::evaluate): 1435 (PropertyValueNode::evaluate): 1436 (AccessorNode1::evaluate): 1437 (AccessorNode1::evaluateReference): 1438 (AccessorNode2::evaluate): 1439 (AccessorNode2::evaluateReference): 1440 (ArgumentListNode::evaluateList): 1441 (NewExprNode::evaluate): 1442 (FunctionCallNode::evaluate): 1443 (PostfixNode::evaluate): 1444 (DeleteNode::evaluate): 1445 (VoidNode::evaluate): 1446 (TypeOfNode::evaluate): 1447 (PrefixNode::evaluate): 1448 (UnaryPlusNode::evaluate): 1449 (NegateNode::evaluate): 1450 (BitwiseNotNode::evaluate): 1451 (LogicalNotNode::evaluate): 1452 (MultNode::evaluate): 1453 (AddNode::evaluate): 1454 (ShiftNode::evaluate): 1455 (RelationalNode::evaluate): 1456 (EqualNode::evaluate): 1457 (BitOperNode::evaluate): 1458 (BinaryLogicalNode::evaluate): 1459 (ConditionalNode::evaluate): 1460 (AssignNode::evaluate): 1461 (CommaNode::evaluate): 1462 (VarDeclNode::evaluate): 1463 (ExprStatementNode::execute): 1464 (IfNode::execute): 1465 (DoWhileNode::execute): 1466 (WhileNode::execute): 1467 (ForNode::execute): 1468 (ForInNode::execute): 1469 (ReturnNode::execute): 1470 (WithNode::execute): 1471 (CaseClauseNode::evaluate): 1472 (SwitchNode::execute): 1473 (ThrowNode::execute): 1474 * kjs/nodes.h: 1475 * kjs/types.cpp: 1476 (ConstReference::ConstReference): 1477 * kjs/types.h: 1478 * kjs/value.h: 1479 1480 2002-08-15 Darin Adler <darin (a] apple.com> 1481 1482 Tweaks and small bug fixes to Maciej's excellent new fixnum optimization. 1483 Also updated or removed comments that call it "fixnum" instead of "simple number". 1484 1485 * kjs/simple_number.h: Change constant names so they don't SHOUT the way macro 1486 names do. Added constants for shift, min, and max. Fixed off-by-1 error that 1487 prevented us from using the extreme values on either end. Base the range of 1488 numbers on a fixed 32 bits constant rather than the size of a long, because 1489 code elsewhere depends on positive numbers fitting into both "unsigned" and 1490 "UInt32" while assuming it doesn't need to check; we can easily change this 1491 later. Used int types rather than long for essentially the same reason. 1492 Fixed the value-extraction function so it will work for negative numbers even 1493 if the shift is logical, not arithmetic, by using division instead. 1494 Renamed functions to be quite terse since they are inside a class. 1495 1496 * kjs/value.h: 1497 * kjs/value.cpp: 1498 (ValueImp::dispatchToObject): Call NumberImp::toObject in a "non-virtual" 1499 way rather than repeating the code here. 1500 (ValueImp::dispatchToUInt32): Handle the negative number case correctly. 1501 (ValueImp::dispatchGetBase): Call ValueImp::getBase in a "non-virtual" 1502 way rather than repeating the code here. 1503 (ValueImp::dispatchGetPropertyName): Call ValueImp::getPropertyName in a 1504 "non-virtual" way rather than repeating the code here. 1505 (ValueImp::dispatchPutValue): Call ValueImp::putValue in a "non-virtual" 1506 way rather than repeating the code here. 1507 (ValueImp::dispatchDeleteValue): Call ValueImp::deleteValue in a "non-virtual" 1508 way rather than repeating the code here. 1509 (Number::Number): Fixed a bug where the double-based constructor was casting 1510 to long, so wouldn't do the "remainder" check. 1511 1512 === Alexander-19 === 1513 1514 === Alexander-18 === 1515 1516 2002-08-15 Maciej Stachowiak <mjs (a] apple.com> 1517 1518 Phase 2 of fixnum optimization. Store any integral number that 1519 will fit in two bits less than a long inside the ValueImp * 1520 itself, thus avoiding the need to deal with the garbage collector 1521 at all for these types. Such numbers comprised .5 million of the 1522 1.7 million ValueImps created during the cvs-js-performance test, 1523 so traffic through the garbage collector should be 1524 1525 20% improvement on cvs-js-performance. This may also show up on 1526 cvs-base, but I did not compare and I am too lazy to make clean in 1527 WebCore yet again. 1528 1529 This also significantly reduces memory footprint on 1530 JavaScript-heavy pages. Size after going through 1531 cvs-js-performance suite is now 22MB to 17.5MB. 1532 1533 * JavaScriptCore.pbproj/project.pbxproj: 1534 * kjs/simple_number.h: Added. Some inline static methods for handling 1535 simple numbers that are stored in the pointer. 1536 * kjs/ustring.h: 1537 * kjs/ustring.cpp: 1538 (UString::from): Added new overload for long. 1539 * kjs/value.cpp: 1540 (ValueImp::marked): Add special case for simple numbers. 1541 (ValueImp::setGcAllowed): Likewise. 1542 (ValueImp::toInteger): Call dispatch version of 1543 toUInt32(unsigned&), not the real method. 1544 (ValueImp::toInt32): Likewise. 1545 (ValueImp::toUInt32): Likewise. 1546 (ValueImp::toUInt16): Likewise. 1547 (ValueImp::dispatchType): Add special case for simple numbers. 1548 (ValueImp::dispatchToPrimitive): Likewise. 1549 (ValueImp::dispatchToBoolean): Likewise. 1550 (ValueImp::dispatchToNumber): Likewise. 1551 (ValueImp::dispatchToString): Likewise. 1552 (ValueImp::dispatchToObject): Likewise. 1553 (ValueImp::dispatchToUInt32): Likewise. 1554 (ValueImp::dispatchGetBase): Likewise. 1555 (ValueImp::dispatchGetPropertyName): Likewise. 1556 (ValueImp::dispatchPutValue): Likewise. 1557 (ValueImp::dispatchDeleteValue): Likewise. 1558 (Number::Number): Create a simple number instead of a full-blown 1559 ValueImp when possible. 1560 (Number::value): Likewise. 1561 * kjs/value.h: 1562 1563 2002-08-15 Maciej Stachowiak <mjs (a] apple.com> 1564 1565 Phase one of the "fixnum" optimization (storing small enough 1566 integers in the pointer). This just paves the way for the change 1567 by making all the virtual functions of ValueImp private and adding 1568 non-virtual dispatchers which can call the virtual function or 1569 handle fixnums specially. 1570 1571 Also, I marked every place that should need a special case with a 1572 FIXNUM comment. 1573 1574 * kjs/bool_object.cpp: 1575 (BooleanObjectImp::construct): Call dispatch method not the real method. 1576 * kjs/internal.h: Make toUInt32 private to make sure no one calls it directly 1577 on a NumberImp*. 1578 * kjs/nodes.cpp: 1579 (ForInNode::execute): Call dispatch method not the real method. 1580 * kjs/object.cpp: 1581 (ObjectImp::propList): Call dispatch method not the real method. 1582 * kjs/object.h: 1583 * kjs/string_object.cpp: 1584 (StringProtoFuncImp::call): Call dispatch method not the real method. 1585 (StringObjectImp::construct): Call dispatch method not the real method. 1586 * kjs/value.h: 1587 * kjs/value.cpp: 1588 (ValueImp::marked): Put a comment about required FIXNUM change. 1589 (ValueImp::setGcAllowed): Likewise. 1590 (ValueImp::dispatchType): Just call the virtual method for now. 1591 (ValueImp::dispatchToPrimitive): Likewise. 1592 (ValueImp::dispatchToBoolean): Likewise. 1593 (ValueImp::dispatchToNumber): Likewise. 1594 (ValueImp::dispatchToString): Likewise. 1595 (ValueImp::dispatchToObject): Likewise. 1596 (ValueImp::dispatchToUInt32): Likewise. 1597 (ValueImp::dispatchGetBase): Likewise. 1598 (ValueImp::dispatchGetPropertyName): Likewise. 1599 (ValueImp::dispatchGetValue): Likewise. 1600 (ValueImp::dispatchPutValue): Likewise. 1601 (ValueImp::dispatchDeleteValue): Likewise. 1602 1603 2002-08-14 Darin Adler <darin (a] apple.com> 1604 1605 Another pass of tweaks, including one bug fix. 1606 1607 * kjs/array_object.cpp: 1608 (ArrayInstanceImp::ArrayInstanceImp): Use malloc, not new. 1609 (ArrayInstanceImp::get): Use a local variable so we don't rely on the optimizer 1610 to avoid indexing twice. 1611 (ArrayInstanceImp::hasProperty): Use a local variable, and also check against 1612 UndefinedImp::staticUndefined rather than doing type() != UndefinedType. 1613 1614 2002-08-14 Maciej Stachowiak <mjs (a] apple.com> 1615 1616 Simplified array handling by using NULL to represent empty cells 1617 instead of the Undefined object, so we can use calloc, realloc and 1618 memset instead of loops. Inspired by a suggestion of Darin's. 1619 1620 * kjs/array_object.cpp: 1621 (ArrayInstanceImp::ArrayInstanceImp): 1622 (ArrayInstanceImp::~ArrayInstanceImp): 1623 (ArrayInstanceImp::get): 1624 (ArrayInstanceImp::hasProperty): 1625 (ArrayInstanceImp::deleteProperty): 1626 (ArrayInstanceImp::setLength): 1627 (ArrayInstanceImp::mark): 1628 1629 2002-08-14 Maciej Stachowiak <mjs (a] apple.com> 1630 1631 Fix major JavaScript memory leak. run-plt says cvs-base improved 1632 by 2% and cvs-js-performance improved by 7%. However, this was 1633 within the possible noise level in each case. 1634 1635 The fix was to store ValueImp *'s in the array instead of Value 1636 objects, since the Value wrapper will keep a ref and make the 1637 object immortal. 1638 1639 * kjs/array_object.cpp: 1640 (ArrayInstanceImp::ArrayInstanceImp): 1641 (ArrayInstanceImp::get): 1642 (ArrayInstanceImp::put): 1643 (ArrayInstanceImp::hasProperty): 1644 (ArrayInstanceImp::deleteProperty): 1645 (ArrayInstanceImp::setLength): 1646 (ArrayInstanceImp::mark): 1647 * kjs/array_object.h: 1648 1649 2002-08-13 Maciej Stachowiak <mjs (a] apple.com> 1650 1651 Add the ability to determine the classes of live JavaScript 1652 objects, to help with leak fixing. 1653 1654 * kjs/collector.h, kjs/collector.cpp: 1655 (Collector::liveObjectClasses): 1656 1657 2002-08-13 Maciej Stachowiak <mjs (a] apple.com> 1658 1659 Small speed improvement. 3% faster on cvs-js-performance, no 1660 measurable change on cvs-static-urls. 1661 1662 * kjs/collector.cpp: 1663 (Collector::collect): Combine 3 loops over all objects into one, 1664 to reduce flat time and improve locality of reference. 1665 1666 2002-08-12 Darin Adler <darin (a] apple.com> 1667 1668 Speed improvements. 19% faster on cvs-js-performance, 1% on cvs-static-urls. 1669 1670 Use global string objects for length and other common property names rather 1671 than constantly making and destroying them. Use integer versions of get() and 1672 other related calls rather than always making a string. 1673 1674 Also get rid of many unneeded constructors, destructors, copy constructors, and 1675 assignment operators. And make some functions non-virtual. 1676 1677 * kjs/internal.h: 1678 * kjs/internal.cpp: 1679 (NumberImp::toUInt32): Implement. 1680 (ReferenceImp::ReferenceImp): Special case for numeric property names. 1681 (ReferenceImp::getPropertyName): Moved guts here from ValueImp. Handle numeric case. 1682 (ReferenceImp::getValue): Moved guts here from ValueImp. Handle numeric case. 1683 (ReferenceImp::putValue): Moved guts here from ValueImp. Handle numeric case. 1684 (ReferenceImp::deleteValue): Added. Handle numeric case. 1685 1686 * kjs/array_object.h: 1687 * kjs/array_object.cpp: All-new array implementation that stores the elements 1688 in a C++ array rather than in a property map. 1689 (ArrayInstanceImp::ArrayInstanceImp): Allocate the C++ array. 1690 (ArrayInstanceImp::~ArrayInstanceImp): Delete the C++ array. 1691 (ArrayInstanceImp::get): Implement both the old version and the new overload that 1692 takes an unsigned index for speed. 1693 (ArrayInstanceImp::put): Implement both the old version and the new overload that 1694 takes an unsigned index for speed. 1695 (ArrayInstanceImp::hasProperty): Implement both the old version and the new overload that 1696 takes an unsigned index for speed. 1697 (ArrayInstanceImp::deleteProperty): Implement both the old version and the new overload that 1698 takes an unsigned index for speed. 1699 (ArrayInstanceImp::setLength): Added. Used by the above to resize the array. 1700 (ArrayInstanceImp::mark): Mark the elements of the array too. 1701 (ArrayPrototypeImp::ArrayPrototypeImp): Pass the length to the array instance constructor. 1702 1703 * kjs/bool_object.cpp: 1704 * kjs/date_object.cpp: 1705 * kjs/error_object.cpp: 1706 * kjs/function.cpp: 1707 * kjs/function_object.cpp: 1708 * kjs/math_object.cpp: 1709 * kjs/nodes.cpp: 1710 * kjs/nodes.h: 1711 * kjs/number_object.cpp: 1712 * kjs/object_object.cpp: 1713 * kjs/regexp_object.cpp: 1714 * kjs/string_object.cpp: 1715 1716 * kjs/nodes2string.cpp: (SourceStream::operator<<): Add a special case for char now that 1717 you can't create a UString from a char implicitly. 1718 1719 * kjs/object.h: 1720 * kjs/object.cpp: 1721 (ObjectImp::get): Call through to the string version if the numeric version is not implemented. 1722 (ObjectImp::put): Call through to the string version if the numeric version is not implemented. 1723 (ObjectImp::hasProperty): Call through to the string version if the numeric version is not implemented. 1724 (ObjectImp::deleteProperty): Call through to the string version if the numeric version is not implemented. 1725 1726 * kjs/types.h: 1727 * kjs/types.cpp: 1728 (Reference::Reference): Added constructors for the numeric property name case. 1729 1730 * kjs/ustring.h: Made the constructor that turns a character into a string be explicit so we 1731 don't get numbers that turn themselves into strings. 1732 * kjs/ustring.cpp: 1733 (UString::UString): Detect the empty string case, and use a shared empty string. 1734 (UString::find): Add an overload for single character finds. 1735 (UString::rfind): Add an overload for single character finds. 1736 (KJS::operator==): Fix bug where it would call strlen(0) if the first string was not null. 1737 Also handle non-ASCII characters consistently with the rest of the code by casting to unsigned char 1738 just in case. 1739 1740 * kjs/value.h: Make ValueImp and all subclasses non-copyable and non-assignable. 1741 * kjs/value.cpp: 1742 (ValueImp::toUInt32): New interface, mainly useful so we can detect array indices and not turn 1743 them into strings and back. 1744 (ValueImp::toInteger): Use the new toUInt32. Probably can use more improvement. 1745 (ValueImp::toInt32): Use the new toUInt32. Probably can use more improvement. 1746 (ValueImp::toUInt16): Use the new toUInt32. Probably can use more improvement. 1747 (ValueImp::getBase): Remove handling of the Reference case. That's in ReferenceImp now. 1748 (ValueImp::getPropertyName): Remove handling of the Reference case. That's in ReferenceImp now. 1749 (ValueImp::getValue): Remove handling of the Reference case. That's in ReferenceImp now. 1750 (ValueImp::putValue): Remove handling of the Reference case. That's in ReferenceImp now. 1751 (ValueImp::deleteValue): Added. Used so we can do delete the same way we do put. 1752 1753 === Alexander-17 === 1754 1755 2002-08-09 Darin Adler <darin (a] apple.com> 1756 1757 Some string speedups. Makes sony.com cached 11% faster on Development, but 1758 the improvement for Deployment should be greater. 1759 1760 * kjs/ustring.h: Made it possible for UChar objects to be uninitialized, which 1761 gives a speed boost. Inlined CString's +=, UString's destructor, +=, and +. 1762 * kjs/ustring.cpp: 1763 (UString::UString): Optimize const char * version, which showed up 1764 heavily in performance analysis. Added new two-UString version, which 1765 makes the + operator fast. 1766 (UString::ascii): Remove thread safety changes. Change static buffer to remember 1767 its size, and to always be at least 4096 bytes long; that way we never have to 1768 reallocate unless it's for a long string. Also make code to extract the characters 1769 significantly faster by getting rid of two pointer dereferences per character. 1770 (UString::is8Bit): Avoid one pointer dereference per character. 1771 (UString::toDouble): Use ascii() instead of cstring() to avoid copying the string. 1772 1773 * kjs/collector.cpp: Remove unneeded APPLE_CHANGES. 1774 * kjs/regexp.cpp: Remove ifdefs around some APPLE_CHANGES that we 1775 want to keep, because they just fix warnings. 1776 * kjs/value.h: Remove obsolete APPLE_CHANGES comment. 1777 1778 * JavaScriptCore.pbproj/project.pbxproj: Project Builder decided 1779 to move a line around in the file. 1780 1781 2002-08-09 Maciej Stachowiak <mjs (a] apple.com> 1782 1783 Fix my last change to actually call the versions of the lock functions 1784 that are recursive and initialize as needed. 1785 1786 * kjs/internal.cpp: 1787 (InterpreterImp::InterpreterImp): 1788 (InterpreterImp::clear): 1789 (InterpreterImp::evaluate): 1790 1791 2002-08-09 Maciej Stachowiak <mjs (a] apple.com> 1792 1793 - fixed 2948835 - JavaScriptCore locking is too fine grained, makes it too slow 1794 1795 * kjs/collector.cpp: 1796 (Collector::allocate): 1797 (Collector::collect): 1798 (Collector::finalCheck): 1799 (Collector::numInterpreters): 1800 (Collector::numGCNotAllowedObjects): 1801 (Collector::numReferencedObjects): 1802 * kjs/collector.h: 1803 * kjs/internal.cpp: 1804 (initializeInterpreterLock): 1805 (lockInterpreter): 1806 (unlockInterpreter): 1807 (Parser::parse): 1808 (InterpreterImp::InterpreterImp): 1809 (InterpreterImp::clear): 1810 (InterpreterImp::evaluate): 1811 * kjs/value.cpp: 1812 (ValueImp::ValueImp): 1813 (ValueImp::setGcAllowed): 1814 1815 === milestone 0.5 === 1816 1817 === Alexander-16 === 1818 1819 2002-08-05 Maciej Stachowiak <mjs (a] apple.com> 1820 1821 - fixed 3007072 - need to be able to build fat 1822 1823 * JavaScriptCore.pbproj/project.pbxproj: Fixed DeploymentFat build. 1824 1825 === Alexander-15 === 1826 1827 2002-07-25 Darin Adler <darin (a] apple.com> 1828 1829 * JavaScriptCore.pbproj/project.pbxproj: Add DeploymentFat build style. 1830 1831 === Alexander-14 === 1832 1833 2002-07-21 Darin Adler <darin (a] apple.com> 1834 1835 * kjs/*: Roll KDE 3.0.2 changes in. Also switch to not using APPLE_CHANGES 1836 for some of the changes that we definitely want to contribute upstream. 1837 1838 2002-07-21 Maciej Stachowiak <mjs (a] apple.com> 1839 1840 * Makefile.am: Remove products from symroots on `make clean'. 1841 1842 === Alexander-13 === 1843 1844 2002-07-13 Darin Adler <darin (a] apple.com> 1845 1846 * Makefile.am: Don't use embed.am any more. 1847 * JavaScriptCore.pbproj/project.pbxproj: Use embed-into-alex instead 1848 of make embed. 1849 1850 2002-07-12 Darin Adler <darin (a] apple.com> 1851 1852 * kjs/ustring.h: Since <sys/types.h> includes ushort and uint now, had 1853 to change the includes here to be compatible with that. 1854 1855 2002-07-11 Darin Adler <darin (a] apple.com> 1856 1857 * JavaScriptCore.pbproj/project.pbxproj: To make the build of 1858 WebCore work without using -I to peek at JavaScriptCore sources, 1859 made all the Public sources Private so they are all in one directory. 1860 Also, made lookup.h be Private. 1861 1862 === Alexander-11 === 1863 1864 === Alexander-10 === 1865 1866 2002-06-25 Darin Adler <darin (a] apple.com> 1867 1868 * JavaScriptCore.pbproj/project.pbxproj: Re-add -Wmissing-format-attribute. 1869 1870 === Alexander-9 === 1871 1872 2002-06-19 Kenneth Kocienda <kocienda (a] apple.com> 1873 1874 I just played alchemical voodoo games with the linker to 1875 make all our frameworks and Alexander prebound. 1876 1877 * JavaScriptCore.pbproj/project.pbxproj 1878 1879 2002-06-15 Darin Adler <darin (a] apple.com> 1880 1881 * JavaScriptCore.pbproj/project.pbxproj: Removed explicit PFE_FILE_C_DIALECTS now that 1882 Project Builder handles this automatically. Removed explicit USE_GCC3 since that's implicit 1883 now. Also, since this project is all C++, only use WARNING_CFLAGS with flags that are appropriate 1884 for C++; don't bother breaking out C vs. C++. 1885 1886 * kjs/collector.cpp: Now that the system warning is fixed, use PTHREAD_MUTEX_INITIALIZER and 1887 PTHREAD_COND_INITIALIZER. 1888 * kjs/internal.cpp: Use PTHREAD_MUTEX_INITIALIZER. 1889 * kjs/ustring.cpp: Use PTHREAD_ONCE_INIT. 1890 1891 2002-06-15 Maciej Stachowiak <mjs (a] apple.com> 1892 1893 Made Development build mode mean what Unoptimized used to mean. Removed Unoptimized build mode. 1894 Added a Mixed build mode which does what Deployment used to. All this to fix: 1895 1896 Radar 2955367 - Change default build style to "Unoptimized" 1897 1898 * JavaScriptCore.pbproj/project.pbxproj: 1899 1900 2002-06-12 Darin Adler <darin (a] apple.com> 1901 1902 * kjs/nodes.cpp: (Node::finalCheck): A bit of APPLE_CHANGES so we 1903 can compile with KJS_DEBUG_MEM defined if we want to. 1904 1905 2002-06-10 Darin Adler <darin (a] apple.com> 1906 1907 Merged in changes from KDE 3.0.1. 1908 1909 * kjs/collector.cpp: 1910 * kjs/date_object.cpp: 1911 * kjs/function.cpp: 1912 * kjs/internal.cpp: 1913 * kjs/lookup.h: 1914 * kjs/object.cpp: 1915 * kjs/operations.cpp: 1916 * kjs/regexp.cpp: 1917 * kjs/regexp_object.cpp: 1918 * kjs/regexp_object.h: 1919 * kjs/string_object.cpp: 1920 * kjs/testkjs.cpp: 1921 * kjs/ustring.cpp: 1922 * kjs/value.cpp: 1923 * kjs/value.h: 1924 Do the merge, and add APPLE_CHANGES as needed to make things compile. 1925 1926 * kjs/date_object.lut.h: Re-generated. 1927 1928 2002-06-07 Darin Adler <darin (a] apple.com> 1929 1930 * Makefile.am: Use new shared "embed.am" file so we don't need four copies of 1931 the embedding rules for WebFoundation, JavaScriptCore, WebCore, and WebKit. 1932 1933 2002-06-07 Darin Adler <darin (a] apple.com> 1934 1935 * JavaScriptCore.pbproj/project.pbxproj: Don't use any warning flags for C that won't work 1936 for C++, because PFE uses the C warning flags on a C++ compile. 1937 1938 === Alexander-8 === 1939 1940 2002-06-06 Darin Adler <darin (a] apple.com> 1941 1942 * JavaScriptCore.pbproj/project.pbxproj: Update warning flags for compatibility 1943 with new C++. 1944 1945 2002-06-05 Darin Adler <darin (a] apple.com> 1946 1947 Fix problem seen as build failure on Jersey. 1948 1949 * Makefile.am: JavaScriptCore-stamp needs to be a dependency, not a 1950 source file, because it doesn't have a corresponding object file. 1951 Making it a dependency causes things to compile in the right order. 1952 1953 2002-06-04 Darin Adler <darin (a] apple.com> 1954 1955 Improve the speed of the JavaScript string append operation by growing 1956 the capacity so we don't need to reallocate the string every time. 1957 1958 Also fix script execution so it doesn't use recursion to advance from 1959 one statement to the next, using iteration instead. 1960 1961 * Makefile.am: Stop using BUILT_SOURCES to build JavaScriptCore-stamp, 1962 because this causes the Project Builder project to build *before* the 1963 subdir. Intead, use an all-am rule in a way more similar to all our 1964 other directories. 1965 1966 * kjs/grammar.y: Link the SourceElementsNode in the opposite direction, 1967 so we can walk the list and execute each element instead of using 1968 recursion to reverse the list. 1969 * kjs/grammar.cpp: Check in new generated file. 1970 1971 * kjs/nodes.cpp: 1972 (SourceElementsNode::execute): 1973 (SourceElementsNode::processFuncDecl): 1974 (SourceElementsNode::processVarDecls): 1975 Use loops instead of recursion. 1976 1977 * kjs/ustring.h: Don't initialize all UChar objects to 0. This was 1978 wasting a *huge* amount of time. 1979 * kjs/ustring.cpp: 1980 (UString::Rep::create): Add a "capacity" along with the length. 1981 (UString::append): Include 50% extra capacity when appending. 1982 (UString::operator=): Reuse the buffer if possible rather than 1983 always creating a new one. 1984 1985 2002-06-02 Darin Adler <darin (a] apple.com> 1986 1987 * COPYING.LIB: Fix line endings. It was using CRs. 1988 1989 2002-05-31 Darin Adler <darin (a] apple.com> 1990 1991 * Makefile.am: 1992 * kjs/Makefile.am: 1993 Slight improvements to rules that touch stamp files. 1994 1995 2002-05-28 Maciej Stachowiak <mjs (a] apple.com> 1996 1997 * THANKS: Demangled. 1998 1999 === Alexander-7 === 2000 2001 2002-05-24 Maciej Stachowiak <mjs (a] apple.com> 2002 2003 Added license and acknowledgements. 2004 2005 * AUTHORS: Added. 2006 * COPYING.LIB: Added. 2007 * THANKS: Added. 2008 2009 === 0.3 === 2010 2011 === Alexander-6 === 2012 2013 === Alexander-5 === 2014 2015 === Alexander-4 === 2016 2017 === JavaScriptCore-5 === 2018 2019 2002-05-21 Maciej Stachowiak <mjs (a] apple.com> 2020 2021 Reviewed by: Richard Williamson 2022 2023 Fixed Radar 2928775 - Sherlock crashes sitting in stocks channel 2024 2025 * kjs/internal.cpp: 2026 (InterpreterImp::InterpreterImp): Set the interp pointer earlier, 2027 in case garbage collection takes place while creating the global 2028 values. 2029 2030 2002-05-15 Darin Adler <darin (a] apple.com> 2031 2032 Reviewed by: Maciej Stachowiak 2033 2034 * Makefile.am: 2035 Use all-am and clean-am instead of all and clean because it's better and 2036 to make "make check" at the top level work right. 2037 2038 2002-05-13 Darin Adler <darin (a] apple.com> 2039 2040 Reviewed by: Maciej Stachowiak 2041 2042 * kjs/value.h: Fix comment typos. 2043 2044 === JavaScriptCore-4 === 2045 2046 2002-05-10 Maciej Stachowiak <mjs (a] apple.com> 2047 2048 Reviewed by: Ken Kocienda and Darin Adler 2049 2050 Fixed the following bug: 2051 2052 Radar 2890573 - JavaScriptCore needs to be thread-safe 2053 2054 Actually this is only a weak form of thread-safety - you can safely 2055 use different interpreters from different threads at the same 2056 time. If you try to use a single interpreter object from multiple 2057 threads, you need to provide your own locking. 2058 2059 * kjs/collector.h, kjs/collector.cpp: 2060 (Collector::lock, Collector::unlock): Trivial implementation of a 2061 recursive mutex. 2062 (Collector::allocate): Lock around the body of this function. 2063 (Collector::collect): Likewise. 2064 (Collector::finalCheck): Likewise. 2065 (Collector::numInterpreters): Likewise. 2066 (Collector::numGCNotAllowedObjects): Likewise. 2067 (Collector::numReferencedObjects): Likewise. 2068 * kjs/internal.cpp: 2069 (Parser::parse): use a mutex to lock around the whole parse, since 2070 it uses a bunch of global state. 2071 (InterpreterImp::InterpreterImp): Grab the Collector lock here, 2072 both the mutually exclude calls to the body of this function, and 2073 to protect the s_hook static member which the collector pokes at. 2074 (InterpreterImp::clear): Likewise. 2075 * kjs/ustring.cpp: 2076 (statBufferKeyCleanup, statBufferKeyInit, UString::ascii): Convert 2077 use of static variable 2078 * kjs/value.cpp: 2079 (ValueImp::ValueImp, ValueImp::mark, ValueImp::marked, 2080 ValueImp::setGcAllowed): Grab the GC lock around any flag changes. 2081 2082 === Alexander-3 === 2083 2084 2002-05-08 Darin Adler <darin (a] apple.com> 2085 2086 * kjs/collector.h: 2087 * kjs/collector.cpp: 2088 (Collector::numInterpreters): 2089 (Collector::numGCNotAllowedObjects): 2090 (Collector::numReferencedObjects): 2091 Add three new functions so we can see a bit more about leaking JavaScriptCore. 2092 2093 2002-05-06 Darin Adler <darin (a] apple.com> 2094 2095 * JavaScriptCorePrefix.h: Added. 2096 * JavaScriptCore.pbproj/project.pbxproj: Use PFE precompiling. 2097 Also switch from xNDEBUG to NDEBUG. 2098 2099 === Alexander 0.3c2 (v1) === 2100 2101 2002-04-18 Darin Adler <darin (a] apple.com> 2102 2103 * JavaScriptCore.pbproj/project.pbxproj: Oops. Take out -Wstrict-prototypes, put back 2104 -Wmissing-prototypes. 2105 2106 2002-04-18 Darin Adler <darin (a] apple.com> 2107 2108 * JavaScriptCore.pbproj/project.pbxproj: Take out -Wmissing-prototypes 2109 because system headers are triggering it when we don't have 2110 precompiled headers on. 2111 2112 2002-04-18 Darin Adler <darin (a] apple.com> 2113 2114 Reviewed by Maciej 2115 2116 * JavaScriptCore.pbproj/project.pbxproj: Turn on gcc3 and the same set of warnings 2117 as in the rest of Labyrinth (see top level ChangeLog for details). 2118 2119 2002-04-17 Maciej Stachowiak <mjs (a] apple.com> 2120 2121 Reviewed by: Darin Adler <darin (a] apple.com> 2122 2123 * kjs/testkjs.cpp: Don't include <iostream.h> to avoid gcc3 2124 warning. 2125 2126 2002-04-15 Darin Adler <darin (a] apple.com> 2127 2128 Reviwed by: Maciej Stachowiak <mjs (a] apple.com> 2129 2130 * kjs/internal.cpp: 2131 * kjs/property_map.cpp: 2132 * kjs/ustring.h: 2133 Removed some unneeded <config.h> includes so we are more similar 2134 to the real KDE sources. 2135 2136 2002-04-15 Darin Adler <darin (a] apple.com> 2137 2138 Reviwed by: Maciej Stachowiak <mjs (a] apple.com> 2139 2140 Merged changes from KDE 3.0 final and did some build fixes. 2141 2142 * JavaScriptCore.pbproj/project.pbxproj: Added nodes2string.cpp. 2143 2144 * kjs/grammar.*: Regenerated. 2145 * kjs/*.lut.h: Regenerated. 2146 2147 2002-04-08 Darin Adler <darin (a] apple.com> 2148 2149 Reviwed by: Maciej Stachowiak <mjs (a] apple.com> 2150 2151 * JavaScriptCore.pbproj/project.pbxproj: Re-added -Wno-format-y2k. 2152 2153 2002-04-04 Darin Adler <darin (a] apple.com> 2154 2155 * JavaScriptCore.pbproj/project.pbxproj: Add an Unoptimized build 2156 style: exactly like Development except without the -O. 2157 2158 2002-04-03 Darin Adler <darin (a] apple.com> 2159 2160 * kjs/Makefile.am: Gratuitous cleanup. 2161 2162 2002-04-02 Darin Adler <darin (a] apple.com> 2163 2164 * JavaScriptCore.pbproj/project.pbxproj: Update flags as I did for 2165 WebFoundation. 2166 2167 2002-04-02 Maciej Stachowiak <mjs (a] apple.com> 2168 2169 * JavaScriptCore.pbproj/project.pbxproj: Pass -Wno-format-y2k so 2170 the project builds with gcc3. 2171 2172 * kjs/nodes.cpp: Avoid including an obsolete header to avoid 2173 warning with gcc3. 2174 2175 2002-04-02 Darin Adler <darin (a] apple.com> 2176 2177 * kjs/property_map.cpp: (PropertyMap::~PropertyMap): Deallocate the 2178 map by calling clear so we don't leak the entire map. 2179 2180 2002-04-02 Darin Adler <darin (a] apple.com> 2181 2182 * kjs/internal.cpp: (InterpreterImp::globalClear): Add code to 2183 deallocate and null out emptyList, because once the last interpreter 2184 is destroyed there's nothing to keep it from being garbage collected. 2185 2186 2002-04-01 Darin Adler <darin (a] apple.com> 2187 2188 Got rid of KWQDef.h because it's dangerous to have two files with 2189 the same name and different contents. 2190 2191 * JavaScriptCore.pbproj/project.pbxproj: 2192 * kjs/KWQDef.h: Removed. 2193 * kjs/ustring.h: Defines unsigned int types inline now. 2194 2195 2002-03-30 Maciej Stachowiak <mjs (a] apple.com> 2196 2197 Fixed Radar 2891272 (JavaScript crashes loading quicktime.com and 2198 apple.com) 2199 2200 * kjs/object.cpp: (ObjectImp::~ObjectImp): Don't call setGCAlloc 2201 on object internals pointed to, because they may have already been 2202 collected by the time this object is collected, and in that case 2203 we would corrupt the malloc arena. 2204 2205 * Makefile.am: Make the stamp file depend on all the sources and 2206 headers so the framework gets rebuilt properly. 2207 2208 * JavaScriptCore.pbproj/project.pbxproj: Some random numbers moved 2209 around. No idea what I really changed. 2210 2211 2002-03-30 Darin Adler <darin (a] apple.com> 2212 2213 * kjs/grammar.y: Took out Id tag so we won't constantly need to 2214 update grammar.cpp. 2215 * kjs/grammar.cpp: Regenerated without Id tag. 2216 2217 * .cvsignore: Ignore some additional autogenerated files. 2218 * kjs/.cvsignore: Ignore some additional autogenerated files. 2219 2220 2002-03-30 Maciej Stachowiak <mjs (a] apple.com> 2221 2222 * JavaScriptCore.pbproj/project.pbxproj: Install some of the 2223 headers. 2224 2225 2002-03-30 Maciej Stachowiak <mjs (a] apple.com> 2226 2227 Converted JavaScriptCore to build with Project Builder, in 2228 preparation for B&I submission. 2229 2230 * English.lproj/InfoPlist.strings: Added. 2231 * JavaScriptCore.pbproj/.cvsignore: Added. 2232 * JavaScriptCore.pbproj/project.pbxproj: Added. 2233 2234 * .cvsignore: Update the set of ignored things. 2235 2236 * Makefile.am: Hand off to PB for the main build, but still handle 2237 the generated files and the test program. 2238 2239 * kjs/Makefile.am: Don't build anything except the generated 2240 source files. 2241 2242 * kjs/KWQDef.h, kjs/config.h: Added minimal versions of these 2243 files to get kjs to build. 2244 2245 Check in all the genrated files, since Project Builder isn't up to 2246 the task of handling built sources: 2247 2248 * kjs/array_object.lut.h: Added. 2249 * kjs/date_object.lut.h: Added. 2250 * kjs/grammar.cpp: Added. 2251 * kjs/grammar.cpp.h: Added. 2252 * kjs/grammar.h: Added. 2253 * kjs/lexer.lut.h: Added. 2254 * kjs/math_object.lut.h: Added. 2255 * kjs/number_object.lut.h: Added. 2256 * kjs/string_object.lut.h: Added. 2257 2258 * kjs/.cvsignore: Update set of ignored things. 2259 2260 2002-03-28 Maciej Stachowiak <mjs (a] apple.com> 2261 2262 * kjs/kjs-test.chk: Update output for new test results. 2263 2264 2002-03-26 Maciej Stachowiak <mjs (a] apple.com> 2265 2266 Set up kjs to build by itself into libJavaScriptCore.dylib. 2267 2268 * .cvsignore: Added. 2269 * Makefile.am: Added. 2270 * dummy.cpp: Added. 2271 * kjs/.cvsignore: Added. 2272