Changeset 36427 in webkit for trunk/JavaScriptCore
- Timestamp:
- Sep 14, 2008, 11:26:15 PM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r36425 r36427 1 2008-09-14 Maciej Stachowiak <[email protected]> 2 3 Reviewed by Cameron Zwarich. 4 5 - speed up JS construction by extracting "prototype" lookup so PIC applies. 6 7 ~0.5% speedup on SunSpider 8 Speeds up some of the V8 tests as well, most notably earley-boyer. 9 10 * VM/CTI.cpp: 11 (JSC::CTI::compileOpCall): Account for extra arg for prototype. 12 (JSC::CTI::privateCompileMainPass): Account for increased size of op_construct. 13 * VM/CodeGenerator.cpp: 14 (JSC::CodeGenerator::emitConstruct): Emit separate lookup to get prototype property. 15 * VM/Machine.cpp: 16 (JSC::Machine::privateExecute): Expect prototype arg in op_construct. 17 (JSC::Machine::cti_op_construct_JSConstruct): ditto 18 (JSC::Machine::cti_op_construct_NotJSConstruct): ditto 19 1 20 2008-09-10 Alexey Proskuryakov <[email protected]> 2 21 -
trunk/JavaScriptCore/VM/CTI.cpp
r36418 r36427 413 413 { 414 414 if (type == OpConstruct) { 415 emitPutArgConstant(reinterpret_cast<unsigned>(instruction + i), 12); 415 emitPutArgConstant(reinterpret_cast<unsigned>(instruction + i), 16); 416 emitPutArgConstant(instruction[i + 5].u.operand, 12); 416 417 emitPutArgConstant(instruction[i + 4].u.operand, 8); 417 emit PutArgConstant(instruction[i + 3].u.operand, 4);418 emitGetPutArg(instruction[i + 3].u.operand, 4, X86::ecx); 418 419 } else { 419 420 emitPutArgConstant(reinterpret_cast<unsigned>(instruction + i), 16); … … 434 435 m_jit.emitRestoreArgumentReference(); 435 436 436 emitGetCTIParam(CTI_ARGS_r, X86::edi); // edi := r437 emitGetCTIParam(CTI_ARGS_r, X86::edi); // edi := r 437 438 438 439 m_jit.cmpl_i32r(reinterpret_cast<unsigned>(JSImmediate::impossibleValue()), X86::eax); … … 825 826 case op_construct: { 826 827 compileOpCall(instruction, i, OpConstruct); 827 i += 5;828 i += 6; 828 829 break; 829 830 } -
trunk/JavaScriptCore/VM/CodeGenerator.cpp
r36417 r36427 1101 1101 // is safe. 1102 1102 1103 RefPtr<RegisterID> protectFunc = func; 1104 1105 // Reserve space for prototype 1106 RefPtr<RegisterID> funcProto = newTemporary(); 1107 1103 1108 // Reserve space for call frame. 1104 1109 Vector<RefPtr<RegisterID>, RegisterFile::CallFrameHeaderSize> callFrame; … … 1114 1119 } 1115 1120 1121 emitGetById(funcProto.get(), func, globalExec()->propertyNames().prototype); 1122 1116 1123 emitOpcode(op_construct); 1117 1124 instructions().append(dst->index()); 1118 1125 instructions().append(func->index()); 1126 instructions().append(funcProto->index()); 1119 1127 instructions().append(argv.size() ? argv[0]->index() : m_temporaries.size()); // argv 1120 1128 instructions().append(argv.size()); // argc -
trunk/JavaScriptCore/VM/Machine.cpp
r36418 r36427 3280 3280 } 3281 3281 BEGIN_OPCODE(op_construct) { 3282 /* construct dst(r) constr(r) firstArg(r) argCount(n)3282 /* construct dst(r) constr(r) constrProto(r) firstArg(r) argCount(n) 3283 3283 3284 3284 Invoke register "constr" as a constructor. For JS … … 3288 3288 value is passed. In either case, the firstArg and argCount 3289 3289 registers are interpreted as for the "call" opcode. 3290 3291 Register constrProto must contain the prototype property of 3292 register constsr. This is to enable polymorphic inline 3293 caching of this lookup. 3290 3294 */ 3291 3295 3292 3296 int dst = (++vPC)->u.operand; 3293 3297 int constr = (++vPC)->u.operand; 3298 int constrProto = (++vPC)->u.operand; 3294 3299 int firstArg = (++vPC)->u.operand; 3295 3300 int argCount = (++vPC)->u.operand; … … 3308 3313 3309 3314 JSObject* prototype; 3310 JSValue* p = constructor->get(exec, exec->propertyNames().prototype);3315 JSValue* p = r[constrProto].jsValue(exec); 3311 3316 if (p->isObject()) 3312 3317 prototype = static_cast<JSObject*>(p); … … 4430 4435 4431 4436 JSValue* constrVal = ARG_src1; 4432 int firstArg = ARG_int2; 4433 int argCount = ARG_int3; 4437 JSValue* constrProtoVal = ARG_src2; 4438 int firstArg = ARG_int3; 4439 int argCount = ARG_int4; 4434 4440 4435 4441 ConstructData constructData; … … 4439 4445 constrVal->getConstructData(constructData); 4440 4446 4441 // Removing this line of code causes a measurable regression on s quirrelfish.4447 // Removing this line of code causes a measurable regression on sunspider. 4442 4448 JSObject* constructor = static_cast<JSObject*>(constrVal); 4443 4449 … … 4448 4454 4449 4455 JSObject* prototype; 4450 JSValue* p = constr uctor->get(exec, exec->propertyNames().prototype);4456 JSValue* p = constrProtoVal; 4451 4457 if (p->isObject()) 4452 4458 prototype = static_cast<JSObject*>(p); … … 4486 4492 4487 4493 JSValue* constrVal = ARG_src1; 4488 int firstArg = ARG_int 2;4489 int argCount = ARG_int 3;4494 int firstArg = ARG_int3; 4495 int argCount = ARG_int4; 4490 4496 4491 4497 ConstructData constructData;
Note:
See TracChangeset
for help on using the changeset viewer.