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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 const intptr_t kNumTemps = 0; | 235 const intptr_t kNumTemps = 0; |
236 LocationSummary* locs = new(zone) LocationSummary( | 236 LocationSummary* locs = new(zone) LocationSummary( |
237 zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 237 zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
238 locs->set_in(0, Location::RegisterLocation(EAX)); | 238 locs->set_in(0, Location::RegisterLocation(EAX)); |
239 locs->set_out(0, Location::RegisterLocation(EAX)); | 239 locs->set_out(0, Location::RegisterLocation(EAX)); |
240 return locs; | 240 return locs; |
241 } | 241 } |
242 | 242 |
243 | 243 |
244 static void EmitAssertBoolean(Register reg, | 244 static void EmitAssertBoolean(Register reg, |
245 intptr_t token_pos, | 245 TokenPosition token_pos, |
246 intptr_t deopt_id, | 246 intptr_t deopt_id, |
247 LocationSummary* locs, | 247 LocationSummary* locs, |
248 FlowGraphCompiler* compiler) { | 248 FlowGraphCompiler* compiler) { |
249 // Check that the type of the value is allowed in conditional context. | 249 // Check that the type of the value is allowed in conditional context. |
250 // Call the runtime if the object is not bool::true or bool::false. | 250 // Call the runtime if the object is not bool::true or bool::false. |
251 ASSERT(locs->always_calls()); | 251 ASSERT(locs->always_calls()); |
252 Label done; | 252 Label done; |
253 | 253 |
254 if (Isolate::Current()->flags().type_checks()) { | 254 if (Isolate::Current()->flags().type_checks()) { |
255 __ CompareObject(reg, Bool::True()); | 255 __ CompareObject(reg, Bool::True()); |
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 __ Bind(entry_label()); | 1666 __ Bind(entry_label()); |
1667 const Code& stub = Code::ZoneHandle( | 1667 const Code& stub = Code::ZoneHandle( |
1668 compiler->zone(), StubCode::GetAllocationStubForClass(cls_)); | 1668 compiler->zone(), StubCode::GetAllocationStubForClass(cls_)); |
1669 const StubEntry stub_entry(stub); | 1669 const StubEntry stub_entry(stub); |
1670 | 1670 |
1671 LocationSummary* locs = instruction_->locs(); | 1671 LocationSummary* locs = instruction_->locs(); |
1672 | 1672 |
1673 locs->live_registers()->Remove(Location::RegisterLocation(result_)); | 1673 locs->live_registers()->Remove(Location::RegisterLocation(result_)); |
1674 | 1674 |
1675 compiler->SaveLiveRegisters(locs); | 1675 compiler->SaveLiveRegisters(locs); |
1676 compiler->GenerateCall(Token::kNoSourcePos, // No token position. | 1676 compiler->GenerateCall(TokenPosition::kNoSource, |
1677 stub_entry, | 1677 stub_entry, |
1678 RawPcDescriptors::kOther, | 1678 RawPcDescriptors::kOther, |
1679 locs); | 1679 locs); |
1680 compiler->AddStubCallTarget(stub); | 1680 compiler->AddStubCallTarget(stub); |
1681 __ MoveRegister(result_, EAX); | 1681 __ MoveRegister(result_, EAX); |
1682 compiler->RestoreLiveRegisters(locs); | 1682 compiler->RestoreLiveRegisters(locs); |
1683 __ jmp(exit_label()); | 1683 __ jmp(exit_label()); |
1684 } | 1684 } |
1685 | 1685 |
1686 static void Allocate(FlowGraphCompiler* compiler, | 1686 static void Allocate(FlowGraphCompiler* compiler, |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2616 compiler->GenerateRuntimeCall(instruction_->token_pos(), | 2616 compiler->GenerateRuntimeCall(instruction_->token_pos(), |
2617 instruction_->deopt_id(), | 2617 instruction_->deopt_id(), |
2618 kStackOverflowRuntimeEntry, | 2618 kStackOverflowRuntimeEntry, |
2619 0, | 2619 0, |
2620 instruction_->locs()); | 2620 instruction_->locs()); |
2621 | 2621 |
2622 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { | 2622 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { |
2623 // In unoptimized code, record loop stack checks as possible OSR entries. | 2623 // In unoptimized code, record loop stack checks as possible OSR entries. |
2624 compiler->AddCurrentDescriptor(RawPcDescriptors::kOsrEntry, | 2624 compiler->AddCurrentDescriptor(RawPcDescriptors::kOsrEntry, |
2625 instruction_->deopt_id(), | 2625 instruction_->deopt_id(), |
2626 0); // No token position. | 2626 TokenPosition::kNoSource); |
2627 } | 2627 } |
2628 compiler->pending_deoptimization_env_ = NULL; | 2628 compiler->pending_deoptimization_env_ = NULL; |
2629 compiler->RestoreLiveRegisters(instruction_->locs()); | 2629 compiler->RestoreLiveRegisters(instruction_->locs()); |
2630 __ jmp(exit_label()); | 2630 __ jmp(exit_label()); |
2631 } | 2631 } |
2632 | 2632 |
2633 Label* osr_entry_label() { | 2633 Label* osr_entry_label() { |
2634 ASSERT(FLAG_use_osr); | 2634 ASSERT(FLAG_use_osr); |
2635 return &osr_entry_label_; | 2635 return &osr_entry_label_; |
2636 } | 2636 } |
(...skipping 3905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6542 | 6542 |
6543 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6543 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
6544 if (!compiler->is_optimizing()) { | 6544 if (!compiler->is_optimizing()) { |
6545 if (FLAG_emit_edge_counters) { | 6545 if (FLAG_emit_edge_counters) { |
6546 compiler->EmitEdgeCounter(block()->preorder_number()); | 6546 compiler->EmitEdgeCounter(block()->preorder_number()); |
6547 } | 6547 } |
6548 // Add a deoptimization descriptor for deoptimizing instructions that | 6548 // Add a deoptimization descriptor for deoptimizing instructions that |
6549 // may be inserted before this instruction. | 6549 // may be inserted before this instruction. |
6550 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 6550 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
6551 GetDeoptId(), | 6551 GetDeoptId(), |
6552 Token::kNoSourcePos); | 6552 TokenPosition::kNoSource); |
6553 } | 6553 } |
6554 if (HasParallelMove()) { | 6554 if (HasParallelMove()) { |
6555 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 6555 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
6556 } | 6556 } |
6557 | 6557 |
6558 // We can fall through if the successor is the next block in the list. | 6558 // We can fall through if the successor is the next block in the list. |
6559 // Otherwise, we need a jump. | 6559 // Otherwise, we need a jump. |
6560 if (!compiler->CanFallThroughTo(successor())) { | 6560 if (!compiler->CanFallThroughTo(successor())) { |
6561 __ jmp(compiler->GetJumpLabel(successor())); | 6561 __ jmp(compiler->GetJumpLabel(successor())); |
6562 } | 6562 } |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6853 locs->set_out(0, Location::RegisterLocation(EAX)); | 6853 locs->set_out(0, Location::RegisterLocation(EAX)); |
6854 return locs; | 6854 return locs; |
6855 } | 6855 } |
6856 | 6856 |
6857 | 6857 |
6858 void GrowRegExpStackInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6858 void GrowRegExpStackInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
6859 const Register typed_data = locs()->in(0).reg(); | 6859 const Register typed_data = locs()->in(0).reg(); |
6860 const Register result = locs()->out(0).reg(); | 6860 const Register result = locs()->out(0).reg(); |
6861 __ PushObject(Object::null_object()); | 6861 __ PushObject(Object::null_object()); |
6862 __ pushl(typed_data); | 6862 __ pushl(typed_data); |
6863 compiler->GenerateRuntimeCall(Token::kNoSourcePos, // No token position. | 6863 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, |
6864 deopt_id(), | 6864 deopt_id(), |
6865 kGrowRegExpStackRuntimeEntry, | 6865 kGrowRegExpStackRuntimeEntry, |
6866 1, | 6866 1, |
6867 locs()); | 6867 locs()); |
6868 __ Drop(1); | 6868 __ Drop(1); |
6869 __ popl(result); | 6869 __ popl(result); |
6870 } | 6870 } |
6871 | 6871 |
6872 | 6872 |
6873 } // namespace dart | 6873 } // namespace dart |
6874 | 6874 |
6875 #undef __ | 6875 #undef __ |
6876 | 6876 |
6877 #endif // defined TARGET_ARCH_IA32 | 6877 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |