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