| 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/dart_entry.h" | 10 #include "vm/dart_entry.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 TokenPosition 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 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1676 __ Bind(entry_label()); | 1676 __ Bind(entry_label()); |
| 1677 const Code& stub = Code::ZoneHandle(compiler->zone(), | 1677 const Code& stub = Code::ZoneHandle(compiler->zone(), |
| 1678 StubCode::GetAllocationStubForClass(cls_)); | 1678 StubCode::GetAllocationStubForClass(cls_)); |
| 1679 const StubEntry stub_entry(stub); | 1679 const StubEntry stub_entry(stub); |
| 1680 | 1680 |
| 1681 LocationSummary* locs = instruction_->locs(); | 1681 LocationSummary* locs = instruction_->locs(); |
| 1682 | 1682 |
| 1683 locs->live_registers()->Remove(Location::RegisterLocation(result_)); | 1683 locs->live_registers()->Remove(Location::RegisterLocation(result_)); |
| 1684 | 1684 |
| 1685 compiler->SaveLiveRegisters(locs); | 1685 compiler->SaveLiveRegisters(locs); |
| 1686 compiler->GenerateCall(Token::kNoSourcePos, // No token position. | 1686 compiler->GenerateCall(TokenPosition::kNoSource, // No token position. |
| 1687 stub_entry, | 1687 stub_entry, |
| 1688 RawPcDescriptors::kOther, | 1688 RawPcDescriptors::kOther, |
| 1689 locs); | 1689 locs); |
| 1690 compiler->AddStubCallTarget(stub); | 1690 compiler->AddStubCallTarget(stub); |
| 1691 __ MoveRegister(result_, RAX); | 1691 __ MoveRegister(result_, RAX); |
| 1692 compiler->RestoreLiveRegisters(locs); | 1692 compiler->RestoreLiveRegisters(locs); |
| 1693 __ jmp(exit_label()); | 1693 __ jmp(exit_label()); |
| 1694 } | 1694 } |
| 1695 | 1695 |
| 1696 static void Allocate(FlowGraphCompiler* compiler, | 1696 static void Allocate(FlowGraphCompiler* compiler, |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2619 compiler->GenerateRuntimeCall(instruction_->token_pos(), | 2619 compiler->GenerateRuntimeCall(instruction_->token_pos(), |
| 2620 instruction_->deopt_id(), | 2620 instruction_->deopt_id(), |
| 2621 kStackOverflowRuntimeEntry, | 2621 kStackOverflowRuntimeEntry, |
| 2622 0, | 2622 0, |
| 2623 instruction_->locs()); | 2623 instruction_->locs()); |
| 2624 | 2624 |
| 2625 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { | 2625 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { |
| 2626 // In unoptimized code, record loop stack checks as possible OSR entries. | 2626 // In unoptimized code, record loop stack checks as possible OSR entries. |
| 2627 compiler->AddCurrentDescriptor(RawPcDescriptors::kOsrEntry, | 2627 compiler->AddCurrentDescriptor(RawPcDescriptors::kOsrEntry, |
| 2628 instruction_->deopt_id(), | 2628 instruction_->deopt_id(), |
| 2629 0); // No token position. | 2629 TokenPosition::kNoSource); |
| 2630 } | 2630 } |
| 2631 compiler->pending_deoptimization_env_ = NULL; | 2631 compiler->pending_deoptimization_env_ = NULL; |
| 2632 compiler->RestoreLiveRegisters(instruction_->locs()); | 2632 compiler->RestoreLiveRegisters(instruction_->locs()); |
| 2633 __ jmp(exit_label()); | 2633 __ jmp(exit_label()); |
| 2634 } | 2634 } |
| 2635 | 2635 |
| 2636 | 2636 |
| 2637 Label* osr_entry_label() { | 2637 Label* osr_entry_label() { |
| 2638 ASSERT(FLAG_use_osr); | 2638 ASSERT(FLAG_use_osr); |
| 2639 return &osr_entry_label_; | 2639 return &osr_entry_label_; |
| (...skipping 3543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6183 | 6183 |
| 6184 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6184 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6185 if (!compiler->is_optimizing()) { | 6185 if (!compiler->is_optimizing()) { |
| 6186 if (FLAG_emit_edge_counters) { | 6186 if (FLAG_emit_edge_counters) { |
| 6187 compiler->EmitEdgeCounter(block()->preorder_number()); | 6187 compiler->EmitEdgeCounter(block()->preorder_number()); |
| 6188 } | 6188 } |
| 6189 // Add a deoptimization descriptor for deoptimizing instructions that | 6189 // Add a deoptimization descriptor for deoptimizing instructions that |
| 6190 // may be inserted before this instruction. | 6190 // may be inserted before this instruction. |
| 6191 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 6191 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 6192 GetDeoptId(), | 6192 GetDeoptId(), |
| 6193 Token::kNoSourcePos); | 6193 TokenPosition::kNoSource); |
| 6194 } | 6194 } |
| 6195 if (HasParallelMove()) { | 6195 if (HasParallelMove()) { |
| 6196 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 6196 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 6197 } | 6197 } |
| 6198 | 6198 |
| 6199 // We can fall through if the successor is the next block in the list. | 6199 // We can fall through if the successor is the next block in the list. |
| 6200 // Otherwise, we need a jump. | 6200 // Otherwise, we need a jump. |
| 6201 if (!compiler->CanFallThroughTo(successor())) { | 6201 if (!compiler->CanFallThroughTo(successor())) { |
| 6202 __ jmp(compiler->GetJumpLabel(successor())); | 6202 __ jmp(compiler->GetJumpLabel(successor())); |
| 6203 } | 6203 } |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6435 locs->set_out(0, Location::RegisterLocation(RAX)); | 6435 locs->set_out(0, Location::RegisterLocation(RAX)); |
| 6436 return locs; | 6436 return locs; |
| 6437 } | 6437 } |
| 6438 | 6438 |
| 6439 | 6439 |
| 6440 void GrowRegExpStackInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6440 void GrowRegExpStackInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6441 const Register typed_data = locs()->in(0).reg(); | 6441 const Register typed_data = locs()->in(0).reg(); |
| 6442 const Register result = locs()->out(0).reg(); | 6442 const Register result = locs()->out(0).reg(); |
| 6443 __ PushObject(Object::null_object()); | 6443 __ PushObject(Object::null_object()); |
| 6444 __ pushq(typed_data); | 6444 __ pushq(typed_data); |
| 6445 compiler->GenerateRuntimeCall(Token::kNoSourcePos, // No token position. | 6445 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, |
| 6446 deopt_id(), | 6446 deopt_id(), |
| 6447 kGrowRegExpStackRuntimeEntry, | 6447 kGrowRegExpStackRuntimeEntry, |
| 6448 1, | 6448 1, |
| 6449 locs()); | 6449 locs()); |
| 6450 __ Drop(1); | 6450 __ Drop(1); |
| 6451 __ popq(result); | 6451 __ popq(result); |
| 6452 } | 6452 } |
| 6453 | 6453 |
| 6454 | 6454 |
| 6455 } // namespace dart | 6455 } // namespace dart |
| 6456 | 6456 |
| 6457 #undef __ | 6457 #undef __ |
| 6458 | 6458 |
| 6459 #endif // defined TARGET_ARCH_X64 | 6459 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |