| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 2153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2164 break; | 2164 break; |
| 2165 } | 2165 } |
| 2166 default: | 2166 default: |
| 2167 UNREACHABLE(); | 2167 UNREACHABLE(); |
| 2168 break; | 2168 break; |
| 2169 } | 2169 } |
| 2170 } | 2170 } |
| 2171 | 2171 |
| 2172 | 2172 |
| 2173 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary() const { | 2173 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary() const { |
| 2174 ASSERT((left()->Type()->ToCid() != kDoubleCid) && | 2174 intptr_t left_cid = left()->Type()->ToCid(); |
| 2175 (right()->Type()->ToCid() != kDoubleCid)); | 2175 intptr_t right_cid = right()->Type()->ToCid(); |
| 2176 ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid)); |
| 2176 const intptr_t kNumInputs = 2; | 2177 const intptr_t kNumInputs = 2; |
| 2177 const intptr_t kNumTemps = 1; | 2178 const bool need_temp = (left_cid != kSmiCid) && (right_cid != kSmiCid); |
| 2179 const intptr_t kNumTemps = need_temp ? 1 : 0; |
| 2178 LocationSummary* summary = | 2180 LocationSummary* summary = |
| 2179 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2181 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2180 summary->set_in(0, Location::RequiresRegister()); | 2182 summary->set_in(0, Location::RequiresRegister()); |
| 2181 summary->set_in(1, Location::RequiresRegister()); | 2183 summary->set_in(1, Location::RequiresRegister()); |
| 2182 summary->set_temp(0, Location::RequiresRegister()); | 2184 if (need_temp) summary->set_temp(0, Location::RequiresRegister()); |
| 2183 return summary; | 2185 return summary; |
| 2184 } | 2186 } |
| 2185 | 2187 |
| 2186 | 2188 |
| 2187 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2189 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2188 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptBinaryDoubleOp); | 2190 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptBinaryDoubleOp); |
| 2189 Register temp = locs()->temp(0).reg(); | 2191 intptr_t left_cid = left()->Type()->ToCid(); |
| 2190 __ movq(temp, locs()->in(0).reg()); | 2192 intptr_t right_cid = right()->Type()->ToCid(); |
| 2191 __ orq(temp, locs()->in(1).reg()); | 2193 Register left = locs()->in(0).reg(); |
| 2192 __ testl(temp, Immediate(kSmiTagMask)); | 2194 Register right = locs()->in(1).reg(); |
| 2195 if (left_cid == kSmiCid) { |
| 2196 __ testq(right, Immediate(kSmiTagMask)); |
| 2197 } else if (right_cid == kSmiCid) { |
| 2198 __ testq(left, Immediate(kSmiTagMask)); |
| 2199 } else { |
| 2200 Register temp = locs()->temp(0).reg(); |
| 2201 __ movq(temp, left); |
| 2202 __ orq(temp, right); |
| 2203 __ testq(temp, Immediate(kSmiTagMask)); |
| 2204 } |
| 2193 __ j(ZERO, deopt); | 2205 __ j(ZERO, deopt); |
| 2194 } | 2206 } |
| 2195 | 2207 |
| 2196 | 2208 |
| 2197 LocationSummary* BoxDoubleInstr::MakeLocationSummary() const { | 2209 LocationSummary* BoxDoubleInstr::MakeLocationSummary() const { |
| 2198 const intptr_t kNumInputs = 1; | 2210 const intptr_t kNumInputs = 1; |
| 2199 const intptr_t kNumTemps = 0; | 2211 const intptr_t kNumTemps = 0; |
| 2200 LocationSummary* summary = | 2212 LocationSummary* summary = |
| 2201 new LocationSummary(kNumInputs, | 2213 new LocationSummary(kNumInputs, |
| 2202 kNumTemps, | 2214 kNumTemps, |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3096 PcDescriptors::kOther, | 3108 PcDescriptors::kOther, |
| 3097 locs()); | 3109 locs()); |
| 3098 __ Drop(2); // Discard type arguments and receiver. | 3110 __ Drop(2); // Discard type arguments and receiver. |
| 3099 } | 3111 } |
| 3100 | 3112 |
| 3101 } // namespace dart | 3113 } // namespace dart |
| 3102 | 3114 |
| 3103 #undef __ | 3115 #undef __ |
| 3104 | 3116 |
| 3105 #endif // defined TARGET_ARCH_X64 | 3117 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |