Changeset 2738 in webkit for trunk/JavaScriptCore
- Timestamp:
- Nov 18, 2002, 2:49:26 PM (23 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r2736 r2738 1 2002-11-18 Darin Adler <[email protected]> 2 3 - simplified the ExecState class, which was showing up in profiles 4 5 Sped up JavaScript iBench by 6%. 6 7 * kjs/interpreter.h: Removed the level of indirection, and made it all inline. 8 * kjs/interpreter.cpp: Removed ExecState implementation from here altogether. 9 10 - fixed an oversight in my sort speedup 11 12 * kjs/array_object.h: Add pushUndefinedObjectsToEnd. 13 * kjs/array_object.cpp: 14 (ArrayInstanceImp::sort): Call pushUndefinedObjectsToEnd. 15 (ArrayInstanceImp::pushUndefinedObjectsToEnd): Added. 16 Pushes all undefined to the end of the array. 17 1 18 2002-11-18 Darin Adler <[email protected]> 2 19 -
trunk/JavaScriptCore/ChangeLog-2002-12-03
r2736 r2738 1 2002-11-18 Darin Adler <[email protected]> 2 3 - simplified the ExecState class, which was showing up in profiles 4 5 Sped up JavaScript iBench by 6%. 6 7 * kjs/interpreter.h: Removed the level of indirection, and made it all inline. 8 * kjs/interpreter.cpp: Removed ExecState implementation from here altogether. 9 10 - fixed an oversight in my sort speedup 11 12 * kjs/array_object.h: Add pushUndefinedObjectsToEnd. 13 * kjs/array_object.cpp: 14 (ArrayInstanceImp::sort): Call pushUndefinedObjectsToEnd. 15 (ArrayInstanceImp::pushUndefinedObjectsToEnd): Added. 16 Pushes all undefined to the end of the array. 17 1 18 2002-11-18 Darin Adler <[email protected]> 2 19 -
trunk/JavaScriptCore/ChangeLog-2003-10-25
r2736 r2738 1 2002-11-18 Darin Adler <[email protected]> 2 3 - simplified the ExecState class, which was showing up in profiles 4 5 Sped up JavaScript iBench by 6%. 6 7 * kjs/interpreter.h: Removed the level of indirection, and made it all inline. 8 * kjs/interpreter.cpp: Removed ExecState implementation from here altogether. 9 10 - fixed an oversight in my sort speedup 11 12 * kjs/array_object.h: Add pushUndefinedObjectsToEnd. 13 * kjs/array_object.cpp: 14 (ArrayInstanceImp::sort): Call pushUndefinedObjectsToEnd. 15 (ArrayInstanceImp::pushUndefinedObjectsToEnd): Added. 16 Pushes all undefined to the end of the array. 17 1 18 2002-11-18 Darin Adler <[email protected]> 2 19 -
trunk/JavaScriptCore/kjs/array_object.cpp
r2736 r2738 203 203 void ArrayInstanceImp::sort(ExecState *exec) 204 204 { 205 int lengthNotIncludingUndefined = pushUndefinedObjectsToEnd(); 206 205 207 execForCompareByStringForQSort = exec; 206 qsort(storage, length , sizeof(ValueImp *), compareByStringForQSort);208 qsort(storage, lengthNotIncludingUndefined, sizeof(ValueImp *), compareByStringForQSort); 207 209 execForCompareByStringForQSort = 0; 208 210 } … … 236 238 void ArrayInstanceImp::sort(ExecState *exec, Object &compareFunction) 237 239 { 240 int lengthNotIncludingUndefined = pushUndefinedObjectsToEnd(); 241 238 242 CompareWithCompareFunctionArguments args(exec, compareFunction.imp()); 239 243 compareWithCompareFunctionArguments = &args; 240 qsort(storage, length , sizeof(ValueImp *), compareWithCompareFunctionForQSort);244 qsort(storage, lengthNotIncludingUndefined, sizeof(ValueImp *), compareWithCompareFunctionForQSort); 241 245 compareWithCompareFunctionArguments = 0; 246 } 247 248 unsigned ArrayInstanceImp::pushUndefinedObjectsToEnd() 249 { 250 ValueImp *undefined = UndefinedImp::staticUndefined; 251 252 unsigned o = 0; 253 for (unsigned i = 0; i != length; ++i) { 254 ValueImp *v = storage[i]; 255 if (v && v != undefined) { 256 if (o != i) 257 storage[o] = v; 258 o++; 259 } 260 } 261 if (o != length) 262 memset(storage + o, 0, sizeof(ValueImp *) * (length - o)); 263 return o; 242 264 } 243 265 -
trunk/JavaScriptCore/kjs/array_object.h
r2736 r2738 56 56 void setLength(unsigned newLength); 57 57 58 unsigned pushUndefinedObjectsToEnd(); 59 58 60 unsigned length; 59 61 unsigned capacity; -
trunk/JavaScriptCore/kjs/interpreter.cpp
r2256 r2738 318 318 #endif 319 319 320 // ------------------------------ ExecState --------------------------------------321 322 namespace KJS {323 class ExecStateImp324 {325 public:326 ExecStateImp(Interpreter *interp, ContextImp *con)327 : interpreter(interp), context(con) {};328 Interpreter *interpreter;329 ContextImp *context;330 Value exception;331 };332 };333 334 ExecState::~ExecState()335 {336 delete rep;337 }338 339 Interpreter *ExecState::interpreter() const340 {341 return rep->interpreter;342 }343 344 const Context ExecState::context() const345 {346 return rep->context;347 }348 349 void ExecState::setException(const Value &e)350 {351 rep->exception = e;352 }353 354 void ExecState::clearException()355 {356 rep->exception = Value();357 }358 359 Value ExecState::exception() const360 {361 return rep->exception;362 }363 364 bool ExecState::hadException() const365 {366 return !rep->exception.isNull();367 }368 369 ExecState::ExecState(Interpreter *interp, ContextImp *con)370 {371 rep = new ExecStateImp(interp,con);372 }373 374 320 void Interpreter::virtual_hook( int, void* ) 375 321 { /*BASE::virtual_hook( id, data );*/ } -
trunk/JavaScriptCore/kjs/interpreter.h
r1024 r2738 369 369 friend class GlobalFuncImp; 370 370 public: 371 virtual ~ExecState();372 373 371 /** 374 372 * Returns the interpreter associated with this execution state … … 376 374 * @return The interpreter executing the script 377 375 */ 378 Interpreter *interpreter() const ;376 Interpreter *interpreter() const { return _interpreter; } 379 377 380 378 /** … … 383 381 * @return The current execution state context 384 382 */ 385 const Context context() const ;386 387 void setException(const Value &e) ;388 void clearException() ;389 Value exception() const ;390 bool hadException() const ;383 const Context context() const { return _context; } 384 385 void setException(const Value &e) { _exception = e; } 386 void clearException() { _exception = Value(); } 387 Value exception() const { return _exception; } 388 bool hadException() const { return !_exception.isNull(); } 391 389 392 390 private: 393 ExecState(Interpreter *interp, ContextImp *con); 394 ExecStateImp *rep; 391 ExecState(Interpreter *interp, ContextImp *con) 392 : _interpreter(interp), _context(con) { } 393 Interpreter *_interpreter; 394 ContextImp *_context; 395 Value _exception; 395 396 }; 396 397
Note:
See TracChangeset
for help on using the changeset viewer.