Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 110013005: MIPS: Reland "Allocation site support for monomorphic StringAdds in BinaryOps". (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 Isolate* isolate, 321 Isolate* isolate,
322 CodeStubInterfaceDescriptor* descriptor) { 322 CodeStubInterfaceDescriptor* descriptor) {
323 static Register registers[] = { a0, a3, a1, a2 }; 323 static Register registers[] = { a0, a3, a1, a2 };
324 descriptor->register_param_count_ = 4; 324 descriptor->register_param_count_ = 4;
325 descriptor->register_params_ = registers; 325 descriptor->register_params_ = registers;
326 descriptor->deoptimization_handler_ = 326 descriptor->deoptimization_handler_ =
327 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss); 327 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss);
328 } 328 }
329 329
330 330
331 void BinaryOpICStub::InitializeInterfaceDescriptor(
332 Isolate* isolate,
333 CodeStubInterfaceDescriptor* descriptor) {
334 static Register registers[] = { a1, a0 };
335 descriptor->register_param_count_ = 2;
336 descriptor->register_params_ = registers;
337 descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss);
338 descriptor->SetMissHandler(
339 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate));
340 }
341
342
343 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
344 Isolate* isolate,
345 CodeStubInterfaceDescriptor* descriptor) {
346 static Register registers[] = { a2, a1, a0 };
347 descriptor->register_param_count_ = 3;
348 descriptor->register_params_ = registers;
349 descriptor->deoptimization_handler_ =
350 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite);
351 }
352
353
331 void NewStringAddStub::InitializeInterfaceDescriptor( 354 void NewStringAddStub::InitializeInterfaceDescriptor(
332 Isolate* isolate, 355 Isolate* isolate,
333 CodeStubInterfaceDescriptor* descriptor) { 356 CodeStubInterfaceDescriptor* descriptor) {
334 static Register registers[] = { a1, a0 }; 357 static Register registers[] = { a1, a0 };
335 descriptor->register_param_count_ = 2; 358 descriptor->register_param_count_ = 2;
336 descriptor->register_params_ = registers; 359 descriptor->register_params_ = registers;
337 descriptor->deoptimization_handler_ = 360 descriptor->deoptimization_handler_ =
338 Runtime::FunctionForId(Runtime::kStringAdd)->entry; 361 Runtime::FunctionForId(Runtime::kStringAdd)->entry;
339 } 362 }
340 363
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 argument_count); 1302 argument_count);
1280 if (save_doubles_ == kSaveFPRegs) { 1303 if (save_doubles_ == kSaveFPRegs) {
1281 __ MultiPopFPU(kCallerSavedFPU); 1304 __ MultiPopFPU(kCallerSavedFPU);
1282 } 1305 }
1283 1306
1284 __ MultiPop(kJSCallerSaved | ra.bit()); 1307 __ MultiPop(kJSCallerSaved | ra.bit());
1285 __ Ret(); 1308 __ Ret();
1286 } 1309 }
1287 1310
1288 1311
1289 void BinaryOpICStub::InitializeInterfaceDescriptor(
1290 Isolate* isolate,
1291 CodeStubInterfaceDescriptor* descriptor) {
1292 static Register registers[] = { a1, a0 };
1293 descriptor->register_param_count_ = 2;
1294 descriptor->register_params_ = registers;
1295 descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss);
1296 descriptor->SetMissHandler(
1297 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate));
1298 }
1299
1300
1301 void MathPowStub::Generate(MacroAssembler* masm) { 1312 void MathPowStub::Generate(MacroAssembler* masm) {
1302 const Register base = a1; 1313 const Register base = a1;
1303 const Register exponent = a2; 1314 const Register exponent = a2;
1304 const Register heapnumbermap = t1; 1315 const Register heapnumbermap = t1;
1305 const Register heapnumber = v0; 1316 const Register heapnumber = v0;
1306 const DoubleRegister double_base = f2; 1317 const DoubleRegister double_base = f2;
1307 const DoubleRegister double_exponent = f4; 1318 const DoubleRegister double_exponent = f4;
1308 const DoubleRegister double_result = f0; 1319 const DoubleRegister double_result = f0;
1309 const DoubleRegister double_scratch = f6; 1320 const DoubleRegister double_scratch = f6;
1310 const FPURegister single_scratch = f8; 1321 const FPURegister single_scratch = f8;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { 1532 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
1522 CEntryStub::GenerateAheadOfTime(isolate); 1533 CEntryStub::GenerateAheadOfTime(isolate);
1523 WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(isolate); 1534 WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(isolate);
1524 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); 1535 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate);
1525 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); 1536 StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
1526 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 1537 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
1527 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); 1538 CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
1528 BinaryOpICStub::GenerateAheadOfTime(isolate); 1539 BinaryOpICStub::GenerateAheadOfTime(isolate);
1529 StoreRegistersStateStub::GenerateAheadOfTime(isolate); 1540 StoreRegistersStateStub::GenerateAheadOfTime(isolate);
1530 RestoreRegistersStateStub::GenerateAheadOfTime(isolate); 1541 RestoreRegistersStateStub::GenerateAheadOfTime(isolate);
1542 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate);
1531 } 1543 }
1532 1544
1533 1545
1534 void StoreRegistersStateStub::GenerateAheadOfTime( 1546 void StoreRegistersStateStub::GenerateAheadOfTime(
1535 Isolate* isolate) { 1547 Isolate* isolate) {
1536 StoreRegistersStateStub stub1(kDontSaveFPRegs); 1548 StoreRegistersStateStub stub1(kDontSaveFPRegs);
1537 stub1.GetCode(isolate); 1549 stub1.GetCode(isolate);
1538 // Hydrogen code stubs need stub2 at snapshot time. 1550 // Hydrogen code stubs need stub2 at snapshot time.
1539 StoreRegistersStateStub stub2(kSaveFPRegs); 1551 StoreRegistersStateStub stub2(kSaveFPRegs);
1540 stub2.GetCode(isolate); 1552 stub2.GetCode(isolate);
(...skipping 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after
4299 // Compare flat ASCII strings natively. Remove arguments from stack first. 4311 // Compare flat ASCII strings natively. Remove arguments from stack first.
4300 __ IncrementCounter(counters->string_compare_native(), 1, a2, a3); 4312 __ IncrementCounter(counters->string_compare_native(), 1, a2, a3);
4301 __ Addu(sp, sp, Operand(2 * kPointerSize)); 4313 __ Addu(sp, sp, Operand(2 * kPointerSize));
4302 GenerateCompareFlatAsciiStrings(masm, a1, a0, a2, a3, t0, t1); 4314 GenerateCompareFlatAsciiStrings(masm, a1, a0, a2, a3, t0, t1);
4303 4315
4304 __ bind(&runtime); 4316 __ bind(&runtime);
4305 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 4317 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
4306 } 4318 }
4307 4319
4308 4320
4321 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
4322 // ----------- S t a t e -------------
4323 // -- a1 : left
4324 // -- a0 : right
4325 // -- ar : return address
Paul Lind 2014/01/02 21:36:14 nit: typo on ra
4326 // -----------------------------------
4327 Isolate* isolate = masm->isolate();
4328
4329 // Load a2 with the allocation site. We stick an undefined dummy value here
4330 // and replace it with the real allocation site later when we instantiate this
4331 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate().
4332 __ li(a2, handle(isolate->heap()->undefined_value()));
4333
4334 // Make sure that we actually patched the allocation site.
4335 if (FLAG_debug_code) {
4336 __ And(at, a2, Operand(kSmiTagMask));
4337 __ Assert(ne, kExpectedAllocationSite, at, Operand(zero_reg));
4338 __ lw(t0, FieldMemOperand(a2, HeapObject::kMapOffset));
4339 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
4340 __ Assert(eq, kExpectedAllocationSite, t0, Operand(at));
4341 }
4342
4343 // Tail call into the stub that handles binary operations with allocation
4344 // sites.
4345 BinaryOpWithAllocationSiteStub stub(state_);
4346 __ TailCallStub(&stub);
4347 }
4348
4349
4309 void StringAddStub::Generate(MacroAssembler* masm) { 4350 void StringAddStub::Generate(MacroAssembler* masm) {
4310 Label call_runtime, call_builtin; 4351 Label call_runtime, call_builtin;
4311 Builtins::JavaScript builtin_id = Builtins::ADD; 4352 Builtins::JavaScript builtin_id = Builtins::ADD;
4312 4353
4313 Counters* counters = masm->isolate()->counters(); 4354 Counters* counters = masm->isolate()->counters();
4314 4355
4315 // Stack on entry: 4356 // Stack on entry:
4316 // sp[0]: second argument (right). 4357 // sp[0]: second argument (right).
4317 // sp[4]: first argument (left). 4358 // sp[4]: first argument (left).
4318 4359
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
5975 __ bind(&fast_elements_case); 6016 __ bind(&fast_elements_case);
5976 GenerateCase(masm, FAST_ELEMENTS); 6017 GenerateCase(masm, FAST_ELEMENTS);
5977 } 6018 }
5978 6019
5979 6020
5980 #undef __ 6021 #undef __
5981 6022
5982 } } // namespace v8::internal 6023 } } // namespace v8::internal
5983 6024
5984 #endif // V8_TARGET_ARCH_MIPS 6025 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698