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

Side by Side Diff: runtime/vm/intermediate_language_mips.cc

Issue 1192103004: VM: New calling convention for generated code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: ARM64 port Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, 266 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count,
267 argument_names())); 267 argument_names()));
268 __ LoadObject(S4, arguments_descriptor); 268 __ LoadObject(S4, arguments_descriptor);
269 269
270 // Load closure function code in T2. 270 // Load closure function code in T2.
271 // S4: arguments descriptor array. 271 // S4: arguments descriptor array.
272 // S5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). 272 // S5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value).
273 ASSERT(locs()->in(0).reg() == T0); 273 ASSERT(locs()->in(0).reg() == T0);
274 __ LoadImmediate(S5, 0); 274 __ LoadImmediate(S5, 0);
275 __ lw(T2, FieldAddress(T0, Function::entry_point_offset())); 275 __ lw(T2, FieldAddress(T0, Function::entry_point_offset()));
276 __ lw(CODE_REG, FieldAddress(T0, Function::code_offset()));
276 __ jalr(T2); 277 __ jalr(T2);
277 compiler->RecordSafepoint(locs()); 278 compiler->RecordSafepoint(locs());
278 // Marks either the continuation point in unoptimized code or the 279 // Marks either the continuation point in unoptimized code or the
279 // deoptimization point in optimized code, after call. 280 // deoptimization point in optimized code, after call.
280 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id()); 281 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id());
281 if (compiler->is_optimizing()) { 282 if (compiler->is_optimizing()) {
282 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); 283 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos());
283 } 284 }
284 // Add deoptimization continuation point after the call and before the 285 // Add deoptimization continuation point after the call and before the
285 // arguments are removed. 286 // arguments are removed.
(...skipping 2372 matching lines...) Expand 10 before | Expand all | Expand 10 after
2658 2659
2659 2660
2660 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2661 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2661 __ Bind(compiler->GetJumpLabel(this)); 2662 __ Bind(compiler->GetJumpLabel(this));
2662 compiler->AddExceptionHandler(catch_try_index(), 2663 compiler->AddExceptionHandler(catch_try_index(),
2663 try_index(), 2664 try_index(),
2664 compiler->assembler()->CodeSize(), 2665 compiler->assembler()->CodeSize(),
2665 catch_handler_types_, 2666 catch_handler_types_,
2666 needs_stacktrace()); 2667 needs_stacktrace());
2667 // Restore pool pointer. 2668 // Restore pool pointer.
2668 __ GetNextPC(CMPRES1, TMP); 2669 __ RestoreCodePointer();
2669 const intptr_t object_pool_pc_dist = 2670 __ LoadPoolPointer();
2670 Instructions::HeaderSize() - Instructions::object_pool_offset() +
2671 compiler->assembler()->CodeSize() - 1 * Instr::kInstrSize;
2672 __ LoadFromOffset(PP, CMPRES1, -object_pool_pc_dist);
2673 2671
2674 if (HasParallelMove()) { 2672 if (HasParallelMove()) {
2675 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 2673 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
2676 } 2674 }
2677 2675
2678 // Restore SP from FP as we are coming from a throw and the code for 2676 // Restore SP from FP as we are coming from a throw and the code for
2679 // popping arguments has not been run. 2677 // popping arguments has not been run.
2680 const intptr_t fp_sp_dist = 2678 const intptr_t fp_sp_dist =
2681 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; 2679 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize;
2682 ASSERT(fp_sp_dist <= 0); 2680 ASSERT(fp_sp_dist <= 0);
(...skipping 2735 matching lines...) Expand 10 before | Expand all | Expand 10 after
5418 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5416 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5419 5417
5420 summary->set_in(0, Location::RequiresRegister()); 5418 summary->set_in(0, Location::RequiresRegister());
5421 summary->set_temp(0, Location::RequiresRegister()); 5419 summary->set_temp(0, Location::RequiresRegister());
5422 5420
5423 return summary; 5421 return summary;
5424 } 5422 }
5425 5423
5426 5424
5427 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5425 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5428 Register target_address_reg = locs()->temp_slot(0)->reg(); 5426 Register target_reg = locs()->temp_slot(0)->reg();
5429 5427
5430 // Load from [current frame pointer] + kPcMarkerSlotFromFp. 5428 __ GetNextPC(target_reg, TMP);
5431 __ lw(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize)); 5429 const intptr_t entry_offset =
5430 __ CodeSize() - 1 * Instr::kInstrSize;
5431 __ AddImmediate(target_reg, target_reg, -entry_offset);
5432 5432
5433 // Add the offset. 5433 // Add the offset.
5434 Register offset_reg = locs()->in(0).reg(); 5434 Register offset_reg = locs()->in(0).reg();
5435 if (offset()->definition()->representation() == kTagged) { 5435 if (offset()->definition()->representation() == kTagged) {
5436 __ SmiUntag(offset_reg); 5436 __ SmiUntag(offset_reg);
5437 } 5437 }
5438 __ addu(target_address_reg, target_address_reg, offset_reg); 5438 __ addu(target_reg, target_reg, offset_reg);
5439 5439
5440 // Jump to the absolute address. 5440 // Jump to the absolute address.
5441 __ jr(target_address_reg); 5441 __ jr(target_reg);
5442 } 5442 }
5443 5443
5444 5444
5445 LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone, 5445 LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone,
5446 bool opt) const { 5446 bool opt) const {
5447 const intptr_t kNumInputs = 2; 5447 const intptr_t kNumInputs = 2;
5448 const intptr_t kNumTemps = 0; 5448 const intptr_t kNumTemps = 0;
5449 if (needs_number_check()) { 5449 if (needs_number_check()) {
5450 LocationSummary* locs = new(zone) LocationSummary( 5450 LocationSummary* locs = new(zone) LocationSummary(
5451 zone, kNumInputs, kNumTemps, LocationSummary::kCall); 5451 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
5601 1, 5601 1,
5602 locs()); 5602 locs());
5603 __ lw(result, Address(SP, 1 * kWordSize)); 5603 __ lw(result, Address(SP, 1 * kWordSize));
5604 __ addiu(SP, SP, Immediate(2 * kWordSize)); 5604 __ addiu(SP, SP, Immediate(2 * kWordSize));
5605 } 5605 }
5606 5606
5607 5607
5608 } // namespace dart 5608 } // namespace dart
5609 5609
5610 #endif // defined TARGET_ARCH_MIPS 5610 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698