| 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_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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 213 } |
| 214 UNREACHABLE(); | 214 UNREACHABLE(); |
| 215 return NULL; | 215 return NULL; |
| 216 } | 216 } |
| 217 | 217 |
| 218 | 218 |
| 219 static void EmitSmiEqualityCompare(FlowGraphCompiler* compiler, | 219 static void EmitSmiEqualityCompare(FlowGraphCompiler* compiler, |
| 220 EqualityCompareComp* comp) { | 220 EqualityCompareComp* comp) { |
| 221 Register left = comp->locs()->in(0).reg(); | 221 Register left = comp->locs()->in(0).reg(); |
| 222 Register right = comp->locs()->in(1).reg(); | 222 Register right = comp->locs()->in(1).reg(); |
| 223 // TODO(srdjan): Should we always include NULL test (common case)? | |
| 224 Register result = comp->locs()->out().reg(); | |
| 225 Register temp = comp->locs()->temp(0).reg(); | 223 Register temp = comp->locs()->temp(0).reg(); |
| 226 Label* deopt = compiler->AddDeoptStub(comp->cid(), | 224 Label* deopt = compiler->AddDeoptStub(comp->cid(), |
| 227 comp->token_index(), | 225 comp->token_index(), |
| 228 comp->try_index(), | 226 comp->try_index(), |
| 229 kDeoptSmiCompareSmis, | 227 kDeoptSmiCompareSmis, |
| 230 left, | 228 left, |
| 231 right); | 229 right); |
| 230 // TODO(srdjan): Should we always include NULL test (common case)? |
| 232 __ movl(temp, left); | 231 __ movl(temp, left); |
| 233 __ orl(temp, right); | 232 __ orl(temp, right); |
| 234 __ testl(temp, Immediate(kSmiTagMask)); | 233 __ testl(temp, Immediate(kSmiTagMask)); |
| 235 __ j(NOT_ZERO, deopt); | 234 __ j(NOT_ZERO, deopt); |
| 236 __ cmpl(left, right); | 235 __ cmpl(left, right); |
| 237 if (comp->is_fused_with_branch()) { | 236 if (comp->is_fused_with_branch()) { |
| 238 comp->fused_with_branch()->EmitBranchOnCondition(compiler, EQUAL); | 237 comp->fused_with_branch()->EmitBranchOnCondition(compiler, EQUAL); |
| 239 } else { | 238 } else { |
| 239 Register result = comp->locs()->out().reg(); |
| 240 Label load_true, done; | 240 Label load_true, done; |
| 241 __ j(EQUAL, &load_true, Assembler::kNearJump); | 241 __ j(EQUAL, &load_true, Assembler::kNearJump); |
| 242 __ LoadObject(result, compiler->bool_false()); | 242 __ LoadObject(result, compiler->bool_false()); |
| 243 __ jmp(&done, Assembler::kNearJump); | 243 __ jmp(&done, Assembler::kNearJump); |
| 244 __ Bind(&load_true); | 244 __ Bind(&load_true); |
| 245 __ LoadObject(result, compiler->bool_true()); | 245 __ LoadObject(result, compiler->bool_true()); |
| 246 __ Bind(&done); | 246 __ Bind(&done); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 268 __ LoadObject(result, compiler->bool_false()); | 268 __ LoadObject(result, compiler->bool_false()); |
| 269 __ jmp(&done, Assembler::kNearJump); | 269 __ jmp(&done, Assembler::kNearJump); |
| 270 __ Bind(&load_true); | 270 __ Bind(&load_true); |
| 271 __ LoadObject(result, compiler->bool_true()); | 271 __ LoadObject(result, compiler->bool_true()); |
| 272 } | 272 } |
| 273 __ jmp(&done); | 273 __ jmp(&done); |
| 274 | 274 |
| 275 __ Bind(&non_null_compare); | 275 __ Bind(&non_null_compare); |
| 276 __ pushl(left); | 276 __ pushl(left); |
| 277 __ pushl(right); | 277 __ pushl(right); |
| 278 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 279 comp->cid(), |
| 280 comp->token_index(), |
| 281 comp->try_index()); |
| 278 const String& operator_name = String::ZoneHandle(String::NewSymbol("==")); | 282 const String& operator_name = String::ZoneHandle(String::NewSymbol("==")); |
| 279 const int kNumberOfArguments = 2; | 283 const int kNumberOfArguments = 2; |
| 280 const Array& kNoArgumentNames = Array::Handle(); | 284 const Array& kNoArgumentNames = Array::Handle(); |
| 281 const int kNumArgumentsChecked = 1; | 285 const int kNumArgumentsChecked = 2; |
| 282 | 286 |
| 283 compiler->GenerateInstanceCall(comp->cid(), | 287 compiler->GenerateInstanceCall(comp->cid(), |
| 284 comp->token_index(), | 288 comp->token_index(), |
| 285 comp->try_index(), | 289 comp->try_index(), |
| 286 operator_name, | 290 operator_name, |
| 287 kNumberOfArguments, | 291 kNumberOfArguments, |
| 288 kNoArgumentNames, | 292 kNoArgumentNames, |
| 289 kNumArgumentsChecked); | 293 kNumArgumentsChecked); |
| 290 ASSERT(comp->is_fused_with_branch() || (comp->locs()->out().reg() == EAX)); | 294 ASSERT(comp->is_fused_with_branch() || (comp->locs()->out().reg() == EAX)); |
| 291 | 295 |
| (...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 __ cvtsi2sd(XMM0, value); | 1583 __ cvtsi2sd(XMM0, value); |
| 1580 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); | 1584 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); |
| 1581 } | 1585 } |
| 1582 | 1586 |
| 1583 | 1587 |
| 1584 } // namespace dart | 1588 } // namespace dart |
| 1585 | 1589 |
| 1586 #undef __ | 1590 #undef __ |
| 1587 | 1591 |
| 1588 #endif // defined TARGET_ARCH_X64 | 1592 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |