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 5645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5656 // Sign extend into result_hi. | 5656 // Sign extend into result_hi. |
5657 __ cdq(); | 5657 __ cdq(); |
5658 __ Bind(&done); | 5658 __ Bind(&done); |
5659 } | 5659 } |
5660 } | 5660 } |
5661 | 5661 |
5662 | 5662 |
5663 LocationSummary* BoxIntegerInstr::MakeLocationSummary(Isolate* isolate, | 5663 LocationSummary* BoxIntegerInstr::MakeLocationSummary(Isolate* isolate, |
5664 bool opt) const { | 5664 bool opt) const { |
5665 const intptr_t kNumInputs = 1; | 5665 const intptr_t kNumInputs = 1; |
5666 const intptr_t kNumTemps = 1; | 5666 const intptr_t kNumTemps = is_smi() ? 0 : 1; |
5667 LocationSummary* summary = new(isolate) LocationSummary( | 5667 LocationSummary* summary = new(isolate) LocationSummary( |
5668 isolate, kNumInputs, | 5668 isolate, kNumInputs, |
5669 kNumTemps, | 5669 kNumTemps, |
5670 LocationSummary::kCallOnSlowPath); | 5670 is_smi() |
| 5671 ? LocationSummary::kNoCall |
| 5672 : LocationSummary::kCallOnSlowPath); |
5671 summary->set_in(0, Location::Pair(Location::RequiresRegister(), | 5673 summary->set_in(0, Location::Pair(Location::RequiresRegister(), |
5672 Location::RequiresRegister())); | 5674 Location::RequiresRegister())); |
5673 summary->set_temp(0, Location::RequiresRegister()); | 5675 if (!is_smi()) { |
| 5676 summary->set_temp(0, Location::RequiresRegister()); |
| 5677 } |
5674 summary->set_out(0, Location::RequiresRegister()); | 5678 summary->set_out(0, Location::RequiresRegister()); |
5675 return summary; | 5679 return summary; |
5676 } | 5680 } |
5677 | 5681 |
5678 | 5682 |
5679 class BoxIntegerSlowPath : public SlowPathCode { | 5683 class BoxIntegerSlowPath : public SlowPathCode { |
5680 public: | 5684 public: |
5681 explicit BoxIntegerSlowPath(BoxIntegerInstr* instruction) | 5685 explicit BoxIntegerSlowPath(BoxIntegerInstr* instruction) |
5682 : instruction_(instruction) { } | 5686 : instruction_(instruction) { } |
5683 | 5687 |
(...skipping 19 matching lines...) Expand all Loading... |
5703 | 5707 |
5704 __ jmp(exit_label()); | 5708 __ jmp(exit_label()); |
5705 } | 5709 } |
5706 | 5710 |
5707 private: | 5711 private: |
5708 BoxIntegerInstr* instruction_; | 5712 BoxIntegerInstr* instruction_; |
5709 }; | 5713 }; |
5710 | 5714 |
5711 | 5715 |
5712 void BoxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5716 void BoxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5717 if (is_smi()) { |
| 5718 PairLocation* value_pair = locs()->in(0).AsPairLocation(); |
| 5719 Register value_lo = value_pair->At(0).reg(); |
| 5720 Register out_reg = locs()->out(0).reg(); |
| 5721 __ movl(out_reg, value_lo); |
| 5722 __ SmiTag(out_reg); |
| 5723 return; |
| 5724 } |
| 5725 |
5713 BoxIntegerSlowPath* slow_path = new BoxIntegerSlowPath(this); | 5726 BoxIntegerSlowPath* slow_path = new BoxIntegerSlowPath(this); |
5714 compiler->AddSlowPathCode(slow_path); | 5727 compiler->AddSlowPathCode(slow_path); |
5715 PairLocation* value_pair = locs()->in(0).AsPairLocation(); | 5728 PairLocation* value_pair = locs()->in(0).AsPairLocation(); |
5716 Register value_lo = value_pair->At(0).reg(); | 5729 Register value_lo = value_pair->At(0).reg(); |
5717 Register value_hi = value_pair->At(1).reg(); | 5730 Register value_hi = value_pair->At(1).reg(); |
5718 Register out_reg = locs()->out(0).reg(); | 5731 Register out_reg = locs()->out(0).reg(); |
5719 | 5732 |
5720 // Copy value_hi into out_reg as a temporary. | 5733 // Copy value_hi into out_reg as a temporary. |
5721 // We modify value_lo but restore it before using it. | 5734 // We modify value_lo but restore it before using it. |
5722 __ movl(out_reg, value_hi); | 5735 __ movl(out_reg, value_hi); |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6307 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6320 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
6308 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6321 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
6309 #endif | 6322 #endif |
6310 } | 6323 } |
6311 | 6324 |
6312 } // namespace dart | 6325 } // namespace dart |
6313 | 6326 |
6314 #undef __ | 6327 #undef __ |
6315 | 6328 |
6316 #endif // defined TARGET_ARCH_IA32 | 6329 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |