OLD | NEW |
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/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 const intptr_t kNumTemps = 0; | 411 const intptr_t kNumTemps = 0; |
412 LocationSummary* locs = new(zone) LocationSummary( | 412 LocationSummary* locs = new(zone) LocationSummary( |
413 zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 413 zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
414 locs->set_in(0, Location::RegisterLocation(A0)); | 414 locs->set_in(0, Location::RegisterLocation(A0)); |
415 locs->set_out(0, Location::RegisterLocation(A0)); | 415 locs->set_out(0, Location::RegisterLocation(A0)); |
416 return locs; | 416 return locs; |
417 } | 417 } |
418 | 418 |
419 | 419 |
420 static void EmitAssertBoolean(Register reg, | 420 static void EmitAssertBoolean(Register reg, |
421 intptr_t token_pos, | 421 TokenDescriptor token_pos, |
422 intptr_t deopt_id, | 422 intptr_t deopt_id, |
423 LocationSummary* locs, | 423 LocationSummary* locs, |
424 FlowGraphCompiler* compiler) { | 424 FlowGraphCompiler* compiler) { |
425 // Check that the type of the value is allowed in conditional context. | 425 // Check that the type of the value is allowed in conditional context. |
426 // Call the runtime if the object is not bool::true or bool::false. | 426 // Call the runtime if the object is not bool::true or bool::false. |
427 ASSERT(locs->always_calls()); | 427 ASSERT(locs->always_calls()); |
428 Label done; | 428 Label done; |
429 | 429 |
430 if (Isolate::Current()->flags().type_checks()) { | 430 if (Isolate::Current()->flags().type_checks()) { |
431 __ BranchEqual(reg, Bool::True(), &done); | 431 __ BranchEqual(reg, Bool::True(), &done); |
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 } | 1852 } |
1853 __ Bind(entry_label()); | 1853 __ Bind(entry_label()); |
1854 const Code& stub = Code::ZoneHandle( | 1854 const Code& stub = Code::ZoneHandle( |
1855 compiler->zone(), StubCode::GetAllocationStubForClass(cls_)); | 1855 compiler->zone(), StubCode::GetAllocationStubForClass(cls_)); |
1856 const StubEntry stub_entry(stub); | 1856 const StubEntry stub_entry(stub); |
1857 | 1857 |
1858 LocationSummary* locs = instruction_->locs(); | 1858 LocationSummary* locs = instruction_->locs(); |
1859 locs->live_registers()->Remove(Location::RegisterLocation(result_)); | 1859 locs->live_registers()->Remove(Location::RegisterLocation(result_)); |
1860 | 1860 |
1861 compiler->SaveLiveRegisters(locs); | 1861 compiler->SaveLiveRegisters(locs); |
1862 compiler->GenerateCall(Token::kNoSourcePos, // No token position. | 1862 compiler->GenerateCall(TokenDescriptor::kNoSource, // No token position. |
1863 stub_entry, | 1863 stub_entry, |
1864 RawPcDescriptors::kOther, | 1864 RawPcDescriptors::kOther, |
1865 locs); | 1865 locs); |
1866 compiler->AddStubCallTarget(stub); | 1866 compiler->AddStubCallTarget(stub); |
1867 if (result_ != V0) { | 1867 if (result_ != V0) { |
1868 __ mov(result_, V0); | 1868 __ mov(result_, V0); |
1869 } | 1869 } |
1870 compiler->RestoreLiveRegisters(locs); | 1870 compiler->RestoreLiveRegisters(locs); |
1871 __ b(exit_label()); | 1871 __ b(exit_label()); |
1872 } | 1872 } |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2726 compiler->GenerateRuntimeCall(instruction_->token_pos(), | 2726 compiler->GenerateRuntimeCall(instruction_->token_pos(), |
2727 instruction_->deopt_id(), | 2727 instruction_->deopt_id(), |
2728 kStackOverflowRuntimeEntry, | 2728 kStackOverflowRuntimeEntry, |
2729 0, | 2729 0, |
2730 instruction_->locs()); | 2730 instruction_->locs()); |
2731 | 2731 |
2732 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { | 2732 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { |
2733 // In unoptimized code, record loop stack checks as possible OSR entries. | 2733 // In unoptimized code, record loop stack checks as possible OSR entries. |
2734 compiler->AddCurrentDescriptor(RawPcDescriptors::kOsrEntry, | 2734 compiler->AddCurrentDescriptor(RawPcDescriptors::kOsrEntry, |
2735 instruction_->deopt_id(), | 2735 instruction_->deopt_id(), |
2736 0); // No token position. | 2736 TokenDescriptor::kNoSource); |
2737 } | 2737 } |
2738 compiler->pending_deoptimization_env_ = NULL; | 2738 compiler->pending_deoptimization_env_ = NULL; |
2739 compiler->RestoreLiveRegisters(instruction_->locs()); | 2739 compiler->RestoreLiveRegisters(instruction_->locs()); |
2740 __ b(exit_label()); | 2740 __ b(exit_label()); |
2741 } | 2741 } |
2742 | 2742 |
2743 Label* osr_entry_label() { | 2743 Label* osr_entry_label() { |
2744 ASSERT(FLAG_use_osr); | 2744 ASSERT(FLAG_use_osr); |
2745 return &osr_entry_label_; | 2745 return &osr_entry_label_; |
2746 } | 2746 } |
(...skipping 2635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5382 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5382 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
5383 __ Comment("GotoInstr"); | 5383 __ Comment("GotoInstr"); |
5384 if (!compiler->is_optimizing()) { | 5384 if (!compiler->is_optimizing()) { |
5385 if (FLAG_emit_edge_counters) { | 5385 if (FLAG_emit_edge_counters) { |
5386 compiler->EmitEdgeCounter(block()->preorder_number()); | 5386 compiler->EmitEdgeCounter(block()->preorder_number()); |
5387 } | 5387 } |
5388 // Add a deoptimization descriptor for deoptimizing instructions that | 5388 // Add a deoptimization descriptor for deoptimizing instructions that |
5389 // may be inserted before this instruction. | 5389 // may be inserted before this instruction. |
5390 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 5390 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
5391 GetDeoptId(), | 5391 GetDeoptId(), |
5392 Token::kNoSourcePos); | 5392 TokenDescriptor::kNoSource); |
5393 } | 5393 } |
5394 if (HasParallelMove()) { | 5394 if (HasParallelMove()) { |
5395 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 5395 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
5396 } | 5396 } |
5397 | 5397 |
5398 // We can fall through if the successor is the next block in the list. | 5398 // We can fall through if the successor is the next block in the list. |
5399 // Otherwise, we need a jump. | 5399 // Otherwise, we need a jump. |
5400 if (!compiler->CanFallThroughTo(successor())) { | 5400 if (!compiler->CanFallThroughTo(successor())) { |
5401 __ b(compiler->GetJumpLabel(successor())); | 5401 __ b(compiler->GetJumpLabel(successor())); |
5402 } | 5402 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5584 | 5584 |
5585 | 5585 |
5586 void GrowRegExpStackInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5586 void GrowRegExpStackInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
5587 const Register typed_data = locs()->in(0).reg(); | 5587 const Register typed_data = locs()->in(0).reg(); |
5588 const Register result = locs()->out(0).reg(); | 5588 const Register result = locs()->out(0).reg(); |
5589 __ Comment("GrowRegExpStackInstr"); | 5589 __ Comment("GrowRegExpStackInstr"); |
5590 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 5590 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
5591 __ LoadObject(TMP, Object::null_object()); | 5591 __ LoadObject(TMP, Object::null_object()); |
5592 __ sw(TMP, Address(SP, 1 * kWordSize)); | 5592 __ sw(TMP, Address(SP, 1 * kWordSize)); |
5593 __ sw(typed_data, Address(SP, 0 * kWordSize)); | 5593 __ sw(typed_data, Address(SP, 0 * kWordSize)); |
5594 compiler->GenerateRuntimeCall(Token::kNoSourcePos, // No token position. | 5594 compiler->GenerateRuntimeCall(TokenDescriptor::kNoSource, |
5595 deopt_id(), | 5595 deopt_id(), |
5596 kGrowRegExpStackRuntimeEntry, | 5596 kGrowRegExpStackRuntimeEntry, |
5597 1, | 5597 1, |
5598 locs()); | 5598 locs()); |
5599 __ lw(result, Address(SP, 1 * kWordSize)); | 5599 __ lw(result, Address(SP, 1 * kWordSize)); |
5600 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5600 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
5601 } | 5601 } |
5602 | 5602 |
5603 | 5603 |
5604 } // namespace dart | 5604 } // namespace dart |
5605 | 5605 |
5606 #endif // defined TARGET_ARCH_MIPS | 5606 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |