| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 348 |
| 349 __ Bind(&check_identity); | 349 __ Bind(&check_identity); |
| 350 Label equality_done; | 350 Label equality_done; |
| 351 if (compiler->is_optimizing()) { | 351 if (compiler->is_optimizing()) { |
| 352 // No need to update IC data. | 352 // No need to update IC data. |
| 353 Label is_true; | 353 Label is_true; |
| 354 __ popl(EAX); | 354 __ popl(EAX); |
| 355 __ popl(EDX); | 355 __ popl(EDX); |
| 356 __ cmpl(EAX, EDX); | 356 __ cmpl(EAX, EDX); |
| 357 __ j(EQUAL, &is_true); | 357 __ j(EQUAL, &is_true); |
| 358 __ LoadObject(EAX, (kind == Token::kEQ) ? Bool::False() : Bool::True()); | 358 __ LoadObject(EAX, Bool::Get(kind != Token::kEQ)); |
| 359 __ jmp(&equality_done); | 359 __ jmp(&equality_done); |
| 360 __ Bind(&is_true); | 360 __ Bind(&is_true); |
| 361 __ LoadObject(EAX, (kind == Token::kEQ) ? Bool::True() : Bool::False()); | 361 __ LoadObject(EAX, Bool::Get(kind == Token::kEQ)); |
| 362 if (kind == Token::kNE) { | 362 if (kind == Token::kNE) { |
| 363 // Skip not-equal result conversion. | 363 // Skip not-equal result conversion. |
| 364 __ jmp(&equality_done); | 364 __ jmp(&equality_done); |
| 365 } | 365 } |
| 366 } else { | 366 } else { |
| 367 // Call stub, load IC data in register. The stub will update ICData if | 367 // Call stub, load IC data in register. The stub will update ICData if |
| 368 // necessary. | 368 // necessary. |
| 369 Register ic_data_reg = locs->temp(0).reg(); | 369 Register ic_data_reg = locs->temp(0).reg(); |
| 370 ASSERT(ic_data_reg == ECX); // Stub depends on it. | 370 ASSERT(ic_data_reg == ECX); // Stub depends on it. |
| 371 __ LoadObject(ic_data_reg, equality_ic_data); | 371 __ LoadObject(ic_data_reg, equality_ic_data); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 __ j(EQUAL, &identity_compare); | 528 __ j(EQUAL, &identity_compare); |
| 529 } | 529 } |
| 530 } | 530 } |
| 531 __ Bind(&identity_compare); | 531 __ Bind(&identity_compare); |
| 532 __ cmpl(left, right); | 532 __ cmpl(left, right); |
| 533 if (branch == NULL) { | 533 if (branch == NULL) { |
| 534 Label done, is_equal; | 534 Label done, is_equal; |
| 535 Register result = locs.out().reg(); | 535 Register result = locs.out().reg(); |
| 536 __ j(EQUAL, &is_equal, Assembler::kNearJump); | 536 __ j(EQUAL, &is_equal, Assembler::kNearJump); |
| 537 // Not equal. | 537 // Not equal. |
| 538 __ LoadObject(result, (kind == Token::kEQ) ? Bool::False() : Bool::True()); | 538 __ LoadObject(result, Bool::Get(kind != Token::kEQ)); |
| 539 __ jmp(&done, Assembler::kNearJump); | 539 __ jmp(&done, Assembler::kNearJump); |
| 540 __ Bind(&is_equal); | 540 __ Bind(&is_equal); |
| 541 __ LoadObject(result, (kind == Token::kEQ) ? Bool::True() : Bool::False()); | 541 __ LoadObject(result, Bool::Get(kind == Token::kEQ)); |
| 542 __ Bind(&done); | 542 __ Bind(&done); |
| 543 } else { | 543 } else { |
| 544 Condition cond = TokenKindToSmiCondition(kind); | 544 Condition cond = TokenKindToSmiCondition(kind); |
| 545 branch->EmitBranchOnCondition(compiler, cond); | 545 branch->EmitBranchOnCondition(compiler, cond); |
| 546 } | 546 } |
| 547 } | 547 } |
| 548 | 548 |
| 549 | 549 |
| 550 // First test if receiver is NULL, in which case === is applied. | 550 // First test if receiver is NULL, in which case === is applied. |
| 551 // If type feedback was provided (lists of <class-id, target>), do a | 551 // If type feedback was provided (lists of <class-id, target>), do a |
| (...skipping 4339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4891 // Special code for numbers (compare values instead of references.) | 4891 // Special code for numbers (compare values instead of references.) |
| 4892 void StrictCompareInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4892 void StrictCompareInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4893 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT); | 4893 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT); |
| 4894 Location left = locs()->in(0); | 4894 Location left = locs()->in(0); |
| 4895 Location right = locs()->in(1); | 4895 Location right = locs()->in(1); |
| 4896 if (left.IsConstant() && right.IsConstant()) { | 4896 if (left.IsConstant() && right.IsConstant()) { |
| 4897 // TODO(vegorov): should be eliminated earlier by constant propagation. | 4897 // TODO(vegorov): should be eliminated earlier by constant propagation. |
| 4898 const bool result = (kind() == Token::kEQ_STRICT) ? | 4898 const bool result = (kind() == Token::kEQ_STRICT) ? |
| 4899 left.constant().raw() == right.constant().raw() : | 4899 left.constant().raw() == right.constant().raw() : |
| 4900 left.constant().raw() != right.constant().raw(); | 4900 left.constant().raw() != right.constant().raw(); |
| 4901 __ LoadObject(locs()->out().reg(), result ? Bool::True() : Bool::False()); | 4901 __ LoadObject(locs()->out().reg(), Bool::Get(result)); |
| 4902 return; | 4902 return; |
| 4903 } | 4903 } |
| 4904 if (left.IsConstant()) { | 4904 if (left.IsConstant()) { |
| 4905 compiler->EmitEqualityRegConstCompare(right.reg(), | 4905 compiler->EmitEqualityRegConstCompare(right.reg(), |
| 4906 left.constant(), | 4906 left.constant(), |
| 4907 needs_number_check(), | 4907 needs_number_check(), |
| 4908 token_pos()); | 4908 token_pos()); |
| 4909 } else if (right.IsConstant()) { | 4909 } else if (right.IsConstant()) { |
| 4910 compiler->EmitEqualityRegConstCompare(left.reg(), | 4910 compiler->EmitEqualityRegConstCompare(left.reg(), |
| 4911 right.constant(), | 4911 right.constant(), |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5211 PcDescriptors::kOther, | 5211 PcDescriptors::kOther, |
| 5212 locs()); | 5212 locs()); |
| 5213 __ Drop(2); // Discard type arguments and receiver. | 5213 __ Drop(2); // Discard type arguments and receiver. |
| 5214 } | 5214 } |
| 5215 | 5215 |
| 5216 } // namespace dart | 5216 } // namespace dart |
| 5217 | 5217 |
| 5218 #undef __ | 5218 #undef __ |
| 5219 | 5219 |
| 5220 #endif // defined TARGET_ARCH_IA32 | 5220 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |