| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 4358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4369 // TODO(vegorov): should be eliminated earlier by constant propagation. | 4369 // TODO(vegorov): should be eliminated earlier by constant propagation. |
| 4370 const bool result = (kind() == Token::kEQ_STRICT) ? | 4370 const bool result = (kind() == Token::kEQ_STRICT) ? |
| 4371 left.constant().raw() == right.constant().raw() : | 4371 left.constant().raw() == right.constant().raw() : |
| 4372 left.constant().raw() != right.constant().raw(); | 4372 left.constant().raw() != right.constant().raw(); |
| 4373 __ LoadObject(locs()->out().reg(), result ? Bool::True() : Bool::False()); | 4373 __ LoadObject(locs()->out().reg(), result ? Bool::True() : Bool::False()); |
| 4374 return; | 4374 return; |
| 4375 } | 4375 } |
| 4376 if (left.IsConstant()) { | 4376 if (left.IsConstant()) { |
| 4377 compiler->EmitEqualityRegConstCompare(right.reg(), | 4377 compiler->EmitEqualityRegConstCompare(right.reg(), |
| 4378 left.constant(), | 4378 left.constant(), |
| 4379 needs_number_check()); | 4379 needs_number_check(), |
| 4380 token_pos()); |
| 4380 } else if (right.IsConstant()) { | 4381 } else if (right.IsConstant()) { |
| 4381 compiler->EmitEqualityRegConstCompare(left.reg(), | 4382 compiler->EmitEqualityRegConstCompare(left.reg(), |
| 4382 right.constant(), | 4383 right.constant(), |
| 4383 needs_number_check()); | 4384 needs_number_check(), |
| 4385 token_pos()); |
| 4384 } else { | 4386 } else { |
| 4385 compiler->EmitEqualityRegRegCompare(left.reg(), | 4387 compiler->EmitEqualityRegRegCompare(left.reg(), |
| 4386 right.reg(), | 4388 right.reg(), |
| 4387 needs_number_check()); | 4389 needs_number_check(), |
| 4390 token_pos()); |
| 4388 } | 4391 } |
| 4389 | 4392 |
| 4390 Register result = locs()->out().reg(); | 4393 Register result = locs()->out().reg(); |
| 4391 Label load_true, done; | 4394 Label load_true, done; |
| 4392 Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; | 4395 Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; |
| 4393 __ j(true_condition, &load_true, Assembler::kNearJump); | 4396 __ j(true_condition, &load_true, Assembler::kNearJump); |
| 4394 __ LoadObject(result, Bool::False()); | 4397 __ LoadObject(result, Bool::False()); |
| 4395 __ jmp(&done, Assembler::kNearJump); | 4398 __ jmp(&done, Assembler::kNearJump); |
| 4396 __ Bind(&load_true); | 4399 __ Bind(&load_true); |
| 4397 __ LoadObject(result, Bool::True()); | 4400 __ LoadObject(result, Bool::True()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4408 // TODO(vegorov): should be eliminated earlier by constant propagation. | 4411 // TODO(vegorov): should be eliminated earlier by constant propagation. |
| 4409 const bool result = (kind() == Token::kEQ_STRICT) ? | 4412 const bool result = (kind() == Token::kEQ_STRICT) ? |
| 4410 left.constant().raw() == right.constant().raw() : | 4413 left.constant().raw() == right.constant().raw() : |
| 4411 left.constant().raw() != right.constant().raw(); | 4414 left.constant().raw() != right.constant().raw(); |
| 4412 branch->EmitBranchOnValue(compiler, result); | 4415 branch->EmitBranchOnValue(compiler, result); |
| 4413 return; | 4416 return; |
| 4414 } | 4417 } |
| 4415 if (left.IsConstant()) { | 4418 if (left.IsConstant()) { |
| 4416 compiler->EmitEqualityRegConstCompare(right.reg(), | 4419 compiler->EmitEqualityRegConstCompare(right.reg(), |
| 4417 left.constant(), | 4420 left.constant(), |
| 4418 needs_number_check()); | 4421 needs_number_check(), |
| 4422 token_pos()); |
| 4419 } else if (right.IsConstant()) { | 4423 } else if (right.IsConstant()) { |
| 4420 compiler->EmitEqualityRegConstCompare(left.reg(), | 4424 compiler->EmitEqualityRegConstCompare(left.reg(), |
| 4421 right.constant(), | 4425 right.constant(), |
| 4422 needs_number_check()); | 4426 needs_number_check(), |
| 4427 token_pos()); |
| 4423 } else { | 4428 } else { |
| 4424 compiler->EmitEqualityRegRegCompare(left.reg(), | 4429 compiler->EmitEqualityRegRegCompare(left.reg(), |
| 4425 right.reg(), | 4430 right.reg(), |
| 4426 needs_number_check()); | 4431 needs_number_check(), |
| 4432 token_pos()); |
| 4427 } | 4433 } |
| 4428 | 4434 |
| 4429 Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; | 4435 Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; |
| 4430 branch->EmitBranchOnCondition(compiler, true_condition); | 4436 branch->EmitBranchOnCondition(compiler, true_condition); |
| 4431 } | 4437 } |
| 4432 | 4438 |
| 4433 | 4439 |
| 4434 static bool BindsToSmiConstant(Value* val, intptr_t* smi_value) { | 4440 static bool BindsToSmiConstant(Value* val, intptr_t* smi_value) { |
| 4435 if (!val->BindsToConstant()) { | 4441 if (!val->BindsToConstant()) { |
| 4436 return false; | 4442 return false; |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4685 PcDescriptors::kOther, | 4691 PcDescriptors::kOther, |
| 4686 locs()); | 4692 locs()); |
| 4687 __ Drop(2); // Discard type arguments and receiver. | 4693 __ Drop(2); // Discard type arguments and receiver. |
| 4688 } | 4694 } |
| 4689 | 4695 |
| 4690 } // namespace dart | 4696 } // namespace dart |
| 4691 | 4697 |
| 4692 #undef __ | 4698 #undef __ |
| 4693 | 4699 |
| 4694 #endif // defined TARGET_ARCH_IA32 | 4700 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |