Changeset 49005 in webkit for trunk/JavaScriptCore
- Timestamp:
- Oct 1, 2009, 4:49:28 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r49004 r49005 1 2009-10-01 Geoffrey Garen <[email protected]>2 3 Reviewed by Sam Weinig.4 5 Take one branch instead of two to test for JSValue().6 7 1.1% SunSpider speedup.8 9 * jit/JITCall.cpp:10 (JSC::JIT::compileOpCall):11 * jit/JITOpcodes.cpp:12 (JSC::JIT::emit_op_to_jsnumber):13 (JSC::JIT::emit_op_create_arguments):14 * jit/JITPropertyAccess.cpp:15 (JSC::JIT::emitSlow_op_get_by_val):16 (JSC::JIT::emit_op_put_by_val): Test for the empty value tag, instead17 of testing for the cell tag with a 0 payload.18 19 * runtime/JSValue.cpp:20 (JSC::JSValue::description): Added support for dumping the new empty value,21 and deleted values, in debug builds.22 23 * runtime/JSValue.h:24 (JSC::JSValue::JSValue()): Construct JSValue() with the empty value tag.25 26 (JSC::JSValue::JSValue(JSCell*)): Convert null pointer to the empty value27 tag, to avoid having two different c++ versions of null / empty.28 29 (JSC::JSValue::operator bool): Test for the empty value tag, instead30 of testing for the cell tag with a 0 payload.31 32 1 2009-10-01 Yongjun Zhang <[email protected]> 33 2 -
trunk/JavaScriptCore/jit/JITCall.cpp
r49004 r49005 237 237 int registerOffset = instruction[4].u.operand; 238 238 239 Jump wasEval; 239 Jump wasEval1; 240 Jump wasEval2; 240 241 if (opcodeID == op_call_eval) { 241 242 JITStubCall stubCall(this, cti_op_call_eval); … … 244 245 stubCall.addArgument(JIT::Imm32(argCount)); 245 246 stubCall.call(); 246 wasEval = branch32(Equal, regT1, Imm32(JSValue::EmptyValueTag)); 247 wasEval1 = branchTest32(NonZero, regT0); 248 wasEval2 = branch32(NotEqual, regT1, Imm32(JSValue::CellTag)); 247 249 } 248 250 … … 270 272 emitNakedCall(m_globalData->jitStubs.ctiVirtualCall()); 271 273 272 if (opcodeID == op_call_eval) 273 wasEval.link(this); 274 if (opcodeID == op_call_eval) { 275 wasEval1.link(this); 276 wasEval2.link(this); 277 } 274 278 275 279 emitStore(dst, regT1, regT0);; … … 303 307 int registerOffset = instruction[4].u.operand; 304 308 305 Jump wasEval; 309 Jump wasEval1; 310 Jump wasEval2; 306 311 if (opcodeID == op_call_eval) { 307 312 JITStubCall stubCall(this, cti_op_call_eval); … … 310 315 stubCall.addArgument(JIT::Imm32(argCount)); 311 316 stubCall.call(); 312 wasEval = branch32(NotEqual, regT1, Imm32(JSValue::EmptyValueTag)); 317 wasEval1 = branchTest32(NonZero, regT0); 318 wasEval2 = branch32(NotEqual, regT1, Imm32(JSValue::CellTag)); 313 319 } 314 320 … … 354 360 m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall(); 355 361 356 if (opcodeID == op_call_eval) 357 wasEval.link(this); 362 if (opcodeID == op_call_eval) { 363 wasEval1.link(this); 364 wasEval2.link(this); 365 } 358 366 359 367 // Put the return value in dst. In the interpreter, op_ret does this. -
trunk/JavaScriptCore/jit/JITOpcodes.cpp
r49004 r49005 249 249 250 250 // Check for an exception 251 // FIXME: Maybe we can optimize this comparison to JSValue(). 251 252 move(ImmPtr(&globalData->exception), regT2); 252 Jump sawException = branch32(NotEqual, tagFor(0, regT2), Imm32(JSValue::EmptyValueTag)); 253 Jump sawException1 = branch32(NotEqual, tagFor(0, regT2), Imm32(JSValue::CellTag)); 254 Jump sawException2 = branch32(NonZero, payloadFor(0, regT2), Imm32(0)); 253 255 254 256 // Grab the return address. … … 263 265 264 266 // Handle an exception 265 sawException.link(this); 267 sawException1.link(this); 268 sawException2.link(this); 266 269 // Grab the return address. 267 270 emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1); … … 1235 1238 1236 1239 Jump isInt32 = branch32(Equal, regT1, Imm32(JSValue::Int32Tag)); 1237 addSlowCase(branch32(AboveOrEqual, regT1, Imm32(JSValue:: EmptyValueTag)));1240 addSlowCase(branch32(AboveOrEqual, regT1, Imm32(JSValue::DeletedValueTag))); 1238 1241 isInt32.link(this); 1239 1242 … … 1379 1382 void JIT::emit_op_create_arguments(Instruction*) 1380 1383 { 1381 Jump argsCreated = branch32(NotEqual, tagFor(RegisterFile::ArgumentsRegister, callFrameRegister), Imm32(JSValue::EmptyValueTag)); 1384 Jump argsNotCell = branch32(NotEqual, tagFor(RegisterFile::ArgumentsRegister, callFrameRegister), Imm32(JSValue::CellTag)); 1385 Jump argsNotNull = branchTestPtr(NonZero, payloadFor(RegisterFile::ArgumentsRegister, callFrameRegister)); 1382 1386 1383 1387 // If we get here the arguments pointer is a null cell - i.e. arguments need lazy creation. … … 1387 1391 JITStubCall(this, cti_op_create_arguments).call(); 1388 1392 1389 argsCreated.link(this); 1393 argsNotCell.link(this); 1394 argsNotNull.link(this); 1390 1395 } 1391 1396 -
trunk/JavaScriptCore/jit/JITPropertyAccess.cpp
r49004 r49005 311 311 load32(BaseIndex(regT0, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4), regT1); // tag 312 312 load32(BaseIndex(regT0, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), regT0); // payload 313 branch32(Equal, regT1, Imm32(JSValue::EmptyValueTag)).linkTo(callGetByValJITStub, this); 314 313 314 // FIXME: Maybe we can optimize this comparison to JSValue(). 315 Jump skip = branch32(NotEqual, regT0, Imm32(0)); 316 branch32(Equal, regT1, Imm32(JSValue::CellTag), callGetByValJITStub); 317 318 skip.link(this); 315 319 emitStore(dst, regT1, regT0); 316 320 } … … 330 334 331 335 Jump inFastVector = branch32(Below, regT2, Address(regT0, OBJECT_OFFSETOF(JSArray, m_fastAccessCutoff))); 332 336 333 337 // Check if the access is within the vector. 334 338 addSlowCase(branch32(AboveOrEqual, regT2, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_vectorLength)))); … … 336 340 // This is a write to the slow part of the vector; first, we have to check if this would be the first write to this location. 337 341 // FIXME: should be able to handle initial write to array; increment the the number of items in the array, and potentially update fast access cutoff. 338 addSlowCase(branch32(Equal, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4), Imm32(JSValue::EmptyValueTag))); 342 Jump skip = branch32(NotEqual, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4), Imm32(JSValue::CellTag)); 343 addSlowCase(branch32(Equal, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), Imm32(0))); 344 skip.link(this); 339 345 340 346 inFastVector.link(this); -
trunk/JavaScriptCore/runtime/JSValue.cpp
r49004 r49005 123 123 else if (isNull()) 124 124 snprintf(description, size, "Null"); 125 else if (isUndefined()) 125 else { 126 ASSERT(isUndefined()); 126 127 snprintf(description, size, "Undefined"); 127 else if (tag() == EmptyValueTag)128 snprintf(description, size, "<JSValue()>");129 else {130 ASSERT(tag() == DeletedValueTag);131 snprintf(description, size, "<HashTableDeletedValue>");132 128 } 133 129 -
trunk/JavaScriptCore/runtime/JSValue.h
r49004 r49005 214 214 enum { NullTag = 0xfffffffb }; 215 215 enum { UndefinedTag = 0xfffffffa }; 216 enum { EmptyValueTag = 0xfffffff9 }; 217 enum { DeletedValueTag = 0xfffffff8 }; 216 enum { DeletedValueTag = 0xfffffff9 }; 218 217 219 218 enum { LowestTag = DeletedValueTag }; … … 429 428 inline JSValue::JSValue() 430 429 { 431 u.asBits.tag = EmptyValueTag;430 u.asBits.tag = CellTag; 432 431 u.asBits.payload = 0; 433 432 } … … 465 464 inline JSValue::JSValue(JSCell* ptr) 466 465 { 467 if (ptr) 468 u.asBits.tag = CellTag; 469 else 470 u.asBits.tag = EmptyValueTag; 466 u.asBits.tag = CellTag; 471 467 u.asBits.payload = reinterpret_cast<int32_t>(ptr); 472 468 } … … 474 470 inline JSValue::JSValue(const JSCell* ptr) 475 471 { 476 if (ptr) 477 u.asBits.tag = CellTag; 478 else 479 u.asBits.tag = EmptyValueTag; 472 u.asBits.tag = CellTag; 480 473 u.asBits.payload = reinterpret_cast<int32_t>(const_cast<JSCell*>(ptr)); 481 474 } … … 483 476 inline JSValue::operator bool() const 484 477 { 485 ASSERT(tag() != DeletedValueTag); 486 return tag() != EmptyValueTag; 478 return u.asBits.payload || tag() != CellTag; 487 479 } 488 480
Note:
See TracChangeset
for help on using the changeset viewer.