| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } | 220 } |
| 221 return locs; | 221 return locs; |
| 222 } | 222 } |
| 223 UNREACHABLE(); | 223 UNREACHABLE(); |
| 224 return NULL; | 224 return NULL; |
| 225 } | 225 } |
| 226 | 226 |
| 227 | 227 |
| 228 static void EmitSmiEqualityCompare(FlowGraphCompiler* compiler, | 228 static void EmitSmiEqualityCompare(FlowGraphCompiler* compiler, |
| 229 EqualityCompareComp* comp) { | 229 EqualityCompareComp* comp) { |
| 230 // TODO(srdjan): Should we always include NULL test (common case)? | |
| 231 Register left = comp->locs()->in(0).reg(); | 230 Register left = comp->locs()->in(0).reg(); |
| 232 Register right = comp->locs()->in(1).reg(); | 231 Register right = comp->locs()->in(1).reg(); |
| 233 Register result = comp->locs()->out().reg(); | |
| 234 Register temp = comp->locs()->temp(0).reg(); | 232 Register temp = comp->locs()->temp(0).reg(); |
| 235 Label* deopt = compiler->AddDeoptStub(comp->cid(), | 233 Label* deopt = compiler->AddDeoptStub(comp->cid(), |
| 236 comp->token_index(), | 234 comp->token_index(), |
| 237 comp->try_index(), | 235 comp->try_index(), |
| 238 kDeoptSmiCompareSmis, | 236 kDeoptSmiCompareSmis, |
| 239 left, | 237 left, |
| 240 right); | 238 right); |
| 239 // TODO(srdjan): Should we always include NULL test (common case)? |
| 241 __ movq(temp, left); | 240 __ movq(temp, left); |
| 242 __ orq(temp, right); | 241 __ orq(temp, right); |
| 243 __ testq(temp, Immediate(kSmiTagMask)); | 242 __ testq(temp, Immediate(kSmiTagMask)); |
| 244 __ j(NOT_ZERO, deopt); | 243 __ j(NOT_ZERO, deopt); |
| 245 __ cmpq(left, right); | 244 __ cmpq(left, right); |
| 246 if (comp->is_fused_with_branch()) { | 245 if (comp->is_fused_with_branch()) { |
| 247 comp->fused_with_branch()->EmitBranchOnCondition(compiler, EQUAL); | 246 comp->fused_with_branch()->EmitBranchOnCondition(compiler, EQUAL); |
| 248 } else { | 247 } else { |
| 248 Register result = comp->locs()->out().reg(); |
| 249 Label load_true, done; | 249 Label load_true, done; |
| 250 __ j(EQUAL, &load_true, Assembler::kNearJump); | 250 __ j(EQUAL, &load_true, Assembler::kNearJump); |
| 251 __ LoadObject(result, compiler->bool_false()); | 251 __ LoadObject(result, compiler->bool_false()); |
| 252 __ jmp(&done, Assembler::kNearJump); | 252 __ jmp(&done, Assembler::kNearJump); |
| 253 __ Bind(&load_true); | 253 __ Bind(&load_true); |
| 254 __ LoadObject(result, compiler->bool_true()); | 254 __ LoadObject(result, compiler->bool_true()); |
| 255 __ Bind(&done); | 255 __ Bind(&done); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 277 __ LoadObject(result, compiler->bool_false()); | 277 __ LoadObject(result, compiler->bool_false()); |
| 278 __ jmp(&done, Assembler::kNearJump); | 278 __ jmp(&done, Assembler::kNearJump); |
| 279 __ Bind(&load_true); | 279 __ Bind(&load_true); |
| 280 __ LoadObject(result, compiler->bool_true()); | 280 __ LoadObject(result, compiler->bool_true()); |
| 281 } | 281 } |
| 282 __ jmp(&done); | 282 __ jmp(&done); |
| 283 | 283 |
| 284 __ Bind(&non_null_compare); | 284 __ Bind(&non_null_compare); |
| 285 __ pushq(left); | 285 __ pushq(left); |
| 286 __ pushq(right); | 286 __ pushq(right); |
| 287 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 288 comp->cid(), |
| 289 comp->token_index(), |
| 290 comp->try_index()); |
| 287 const String& operator_name = String::ZoneHandle(String::NewSymbol("==")); | 291 const String& operator_name = String::ZoneHandle(String::NewSymbol("==")); |
| 288 const int kNumberOfArguments = 2; | 292 const int kNumberOfArguments = 2; |
| 289 const Array& kNoArgumentNames = Array::Handle(); | 293 const Array& kNoArgumentNames = Array::Handle(); |
| 290 const int kNumArgumentsChecked = 1; | 294 const int kNumArgumentsChecked = 2; |
| 291 | 295 |
| 292 compiler->GenerateInstanceCall(comp->cid(), | 296 compiler->GenerateInstanceCall(comp->cid(), |
| 293 comp->token_index(), | 297 comp->token_index(), |
| 294 comp->try_index(), | 298 comp->try_index(), |
| 295 operator_name, | 299 operator_name, |
| 296 kNumberOfArguments, | 300 kNumberOfArguments, |
| 297 kNoArgumentNames, | 301 kNoArgumentNames, |
| 298 kNumArgumentsChecked); | 302 kNumArgumentsChecked); |
| 299 ASSERT(comp->is_fused_with_branch() || (comp->locs()->out().reg() == RAX)); | 303 ASSERT(comp->is_fused_with_branch() || (comp->locs()->out().reg() == RAX)); |
| 300 | 304 |
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 __ cvtsi2sd(XMM0, value); | 1598 __ cvtsi2sd(XMM0, value); |
| 1595 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); | 1599 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); |
| 1596 } | 1600 } |
| 1597 | 1601 |
| 1598 | 1602 |
| 1599 } // namespace dart | 1603 } // namespace dart |
| 1600 | 1604 |
| 1601 #undef __ | 1605 #undef __ |
| 1602 | 1606 |
| 1603 #endif // defined TARGET_ARCH_X64 | 1607 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |