| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 const intptr_t kNumTemps = 0; | 322 const intptr_t kNumTemps = 0; |
| 323 LocationSummary* locs = new(zone) LocationSummary( | 323 LocationSummary* locs = new(zone) LocationSummary( |
| 324 zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 324 zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 325 locs->set_in(0, Location::RegisterLocation(RAX)); | 325 locs->set_in(0, Location::RegisterLocation(RAX)); |
| 326 locs->set_out(0, Location::RegisterLocation(RAX)); | 326 locs->set_out(0, Location::RegisterLocation(RAX)); |
| 327 return locs; | 327 return locs; |
| 328 } | 328 } |
| 329 | 329 |
| 330 | 330 |
| 331 static void EmitAssertBoolean(Register reg, | 331 static void EmitAssertBoolean(Register reg, |
| 332 intptr_t token_pos, | 332 TokenDescriptor token_pos, |
| 333 intptr_t deopt_id, | 333 intptr_t deopt_id, |
| 334 LocationSummary* locs, | 334 LocationSummary* locs, |
| 335 FlowGraphCompiler* compiler) { | 335 FlowGraphCompiler* compiler) { |
| 336 // Check that the type of the value is allowed in conditional context. | 336 // Check that the type of the value is allowed in conditional context. |
| 337 // Call the runtime if the object is not bool::true or bool::false. | 337 // Call the runtime if the object is not bool::true or bool::false. |
| 338 ASSERT(locs->always_calls()); | 338 ASSERT(locs->always_calls()); |
| 339 Label done; | 339 Label done; |
| 340 | 340 |
| 341 if (Isolate::Current()->flags().type_checks()) { | 341 if (Isolate::Current()->flags().type_checks()) { |
| 342 __ CompareObject(reg, Bool::True()); | 342 __ CompareObject(reg, Bool::True()); |
| (...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1678 __ Bind(entry_label()); | 1678 __ Bind(entry_label()); |
| 1679 const Code& stub = Code::ZoneHandle(compiler->zone(), | 1679 const Code& stub = Code::ZoneHandle(compiler->zone(), |
| 1680 StubCode::GetAllocationStubForClass(cls_)); | 1680 StubCode::GetAllocationStubForClass(cls_)); |
| 1681 const StubEntry stub_entry(stub); | 1681 const StubEntry stub_entry(stub); |
| 1682 | 1682 |
| 1683 LocationSummary* locs = instruction_->locs(); | 1683 LocationSummary* locs = instruction_->locs(); |
| 1684 | 1684 |
| 1685 locs->live_registers()->Remove(Location::RegisterLocation(result_)); | 1685 locs->live_registers()->Remove(Location::RegisterLocation(result_)); |
| 1686 | 1686 |
| 1687 compiler->SaveLiveRegisters(locs); | 1687 compiler->SaveLiveRegisters(locs); |
| 1688 compiler->GenerateCall(Token::kNoSourcePos, // No token position. | 1688 compiler->GenerateCall(TokenDescriptor::kNoSource, // No token position. |
| 1689 stub_entry, | 1689 stub_entry, |
| 1690 RawPcDescriptors::kOther, | 1690 RawPcDescriptors::kOther, |
| 1691 locs); | 1691 locs); |
| 1692 compiler->AddStubCallTarget(stub); | 1692 compiler->AddStubCallTarget(stub); |
| 1693 __ MoveRegister(result_, RAX); | 1693 __ MoveRegister(result_, RAX); |
| 1694 compiler->RestoreLiveRegisters(locs); | 1694 compiler->RestoreLiveRegisters(locs); |
| 1695 __ jmp(exit_label()); | 1695 __ jmp(exit_label()); |
| 1696 } | 1696 } |
| 1697 | 1697 |
| 1698 static void Allocate(FlowGraphCompiler* compiler, | 1698 static void Allocate(FlowGraphCompiler* compiler, |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2621 compiler->GenerateRuntimeCall(instruction_->token_pos(), | 2621 compiler->GenerateRuntimeCall(instruction_->token_pos(), |
| 2622 instruction_->deopt_id(), | 2622 instruction_->deopt_id(), |
| 2623 kStackOverflowRuntimeEntry, | 2623 kStackOverflowRuntimeEntry, |
| 2624 0, | 2624 0, |
| 2625 instruction_->locs()); | 2625 instruction_->locs()); |
| 2626 | 2626 |
| 2627 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { | 2627 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { |
| 2628 // In unoptimized code, record loop stack checks as possible OSR entries. | 2628 // In unoptimized code, record loop stack checks as possible OSR entries. |
| 2629 compiler->AddCurrentDescriptor(RawPcDescriptors::kOsrEntry, | 2629 compiler->AddCurrentDescriptor(RawPcDescriptors::kOsrEntry, |
| 2630 instruction_->deopt_id(), | 2630 instruction_->deopt_id(), |
| 2631 0); // No token position. | 2631 TokenDescriptor::kNoSource); |
| 2632 } | 2632 } |
| 2633 compiler->pending_deoptimization_env_ = NULL; | 2633 compiler->pending_deoptimization_env_ = NULL; |
| 2634 compiler->RestoreLiveRegisters(instruction_->locs()); | 2634 compiler->RestoreLiveRegisters(instruction_->locs()); |
| 2635 __ jmp(exit_label()); | 2635 __ jmp(exit_label()); |
| 2636 } | 2636 } |
| 2637 | 2637 |
| 2638 | 2638 |
| 2639 Label* osr_entry_label() { | 2639 Label* osr_entry_label() { |
| 2640 ASSERT(FLAG_use_osr); | 2640 ASSERT(FLAG_use_osr); |
| 2641 return &osr_entry_label_; | 2641 return &osr_entry_label_; |
| (...skipping 3543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6185 | 6185 |
| 6186 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6186 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6187 if (!compiler->is_optimizing()) { | 6187 if (!compiler->is_optimizing()) { |
| 6188 if (FLAG_emit_edge_counters) { | 6188 if (FLAG_emit_edge_counters) { |
| 6189 compiler->EmitEdgeCounter(block()->preorder_number()); | 6189 compiler->EmitEdgeCounter(block()->preorder_number()); |
| 6190 } | 6190 } |
| 6191 // Add a deoptimization descriptor for deoptimizing instructions that | 6191 // Add a deoptimization descriptor for deoptimizing instructions that |
| 6192 // may be inserted before this instruction. | 6192 // may be inserted before this instruction. |
| 6193 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 6193 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 6194 GetDeoptId(), | 6194 GetDeoptId(), |
| 6195 Token::kNoSourcePos); | 6195 TokenDescriptor::kNoSource); |
| 6196 } | 6196 } |
| 6197 if (HasParallelMove()) { | 6197 if (HasParallelMove()) { |
| 6198 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 6198 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 6199 } | 6199 } |
| 6200 | 6200 |
| 6201 // We can fall through if the successor is the next block in the list. | 6201 // We can fall through if the successor is the next block in the list. |
| 6202 // Otherwise, we need a jump. | 6202 // Otherwise, we need a jump. |
| 6203 if (!compiler->CanFallThroughTo(successor())) { | 6203 if (!compiler->CanFallThroughTo(successor())) { |
| 6204 __ jmp(compiler->GetJumpLabel(successor())); | 6204 __ jmp(compiler->GetJumpLabel(successor())); |
| 6205 } | 6205 } |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6437 locs->set_out(0, Location::RegisterLocation(RAX)); | 6437 locs->set_out(0, Location::RegisterLocation(RAX)); |
| 6438 return locs; | 6438 return locs; |
| 6439 } | 6439 } |
| 6440 | 6440 |
| 6441 | 6441 |
| 6442 void GrowRegExpStackInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6442 void GrowRegExpStackInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6443 const Register typed_data = locs()->in(0).reg(); | 6443 const Register typed_data = locs()->in(0).reg(); |
| 6444 const Register result = locs()->out(0).reg(); | 6444 const Register result = locs()->out(0).reg(); |
| 6445 __ PushObject(Object::null_object()); | 6445 __ PushObject(Object::null_object()); |
| 6446 __ pushq(typed_data); | 6446 __ pushq(typed_data); |
| 6447 compiler->GenerateRuntimeCall(Token::kNoSourcePos, // No token position. | 6447 compiler->GenerateRuntimeCall(TokenDescriptor::kNoSource, |
| 6448 deopt_id(), | 6448 deopt_id(), |
| 6449 kGrowRegExpStackRuntimeEntry, | 6449 kGrowRegExpStackRuntimeEntry, |
| 6450 1, | 6450 1, |
| 6451 locs()); | 6451 locs()); |
| 6452 __ Drop(1); | 6452 __ Drop(1); |
| 6453 __ popq(result); | 6453 __ popq(result); |
| 6454 } | 6454 } |
| 6455 | 6455 |
| 6456 | 6456 |
| 6457 } // namespace dart | 6457 } // namespace dart |
| 6458 | 6458 |
| 6459 #undef __ | 6459 #undef __ |
| 6460 | 6460 |
| 6461 #endif // defined TARGET_ARCH_X64 | 6461 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |