Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Side by Side Diff: runtime/vm/opt_code_generator_ia32.cc

Issue 8451010: Fix issue 5564152 (VM crash): stack at exit of method was incorrect. Smi equality with Mint was c... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/opt_code_generator.h" 8 #include "vm/opt_code_generator.h"
9 9
10 #include "vm/assembler_macros.h" 10 #include "vm/assembler_macros.h"
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 1592
1593 1593
1594 // Generate code under assumption that it is common that a Smi 1594 // Generate code under assumption that it is common that a Smi
1595 // is compared with null. 1595 // is compared with null.
1596 // Left argument can be Smi or null, otherwise deoptimize and collect more 1596 // Left argument can be Smi or null, otherwise deoptimize and collect more
1597 // type information. 1597 // type information.
1598 // Right operand can be Smi or null, otherwise call operator on Smi (e.g, 1598 // Right operand can be Smi or null, otherwise call operator on Smi (e.g,
1599 // when compared with double). 1599 // when compared with double).
1600 // This code will be more optimized once we collect types for two arguments. 1600 // This code will be more optimized once we collect types for two arguments.
1601 void OptimizingCodeGenerator::GenerateSmiEquality(ComparisonNode* node) { 1601 void OptimizingCodeGenerator::GenerateSmiEquality(ComparisonNode* node) {
1602 const Bool& bool_true = Bool::ZoneHandle(Bool::True());
1603 const Bool& bool_false = Bool::ZoneHandle(Bool::False());
1602 ASSERT((node->kind() == Token::kEQ) || (node->kind() == Token::kNE)); 1604 ASSERT((node->kind() == Token::kEQ) || (node->kind() == Token::kNE));
1603 CodeGenInfo left_info(node->left()); 1605 CodeGenInfo left_info(node->left());
1604 CodeGenInfo right_info(node->right()); 1606 CodeGenInfo right_info(node->right());
1605 VisitLoadTwo(node->left(), node->right(), EAX, EDX); 1607 VisitLoadTwo(node->left(), node->right(), EAX, EDX);
1606 if (!CodeGenerator::IsResultNeeded(node)) { 1608 if (!CodeGenerator::IsResultNeeded(node)) {
1607 return; 1609 return;
1608 } 1610 }
1609 const Immediate raw_null = 1611 const Immediate raw_null =
1610 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1612 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1611 Label evaluate_comparison; 1613 Label evaluate_comparison;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 const int kNumberOfArguments = 2; 1651 const int kNumberOfArguments = 2;
1650 const Array& kNoArgumentNames = Array::Handle(); 1652 const Array& kNoArgumentNames = Array::Handle();
1651 __ pushl(EAX); 1653 __ pushl(EAX);
1652 __ pushl(EDX); 1654 __ pushl(EDX);
1653 GenerateCheckedInstanceCalls(node, 1655 GenerateCheckedInstanceCalls(node,
1654 node->left(), 1656 node->left(),
1655 node->id(), 1657 node->id(),
1656 node->token_index(), 1658 node->token_index(),
1657 kNumberOfArguments, 1659 kNumberOfArguments,
1658 kNoArgumentNames); 1660 kNoArgumentNames);
1659 __ pushl(EAX); 1661 __ CompareObject(EAX, bool_true);
1660 __ jmp(&done, Assembler::kNearJump); 1662 // Fall through to evaluate result.
1661 } 1663 }
1662 __ Bind(&evaluate_comparison); 1664 __ Bind(&evaluate_comparison);
1663 // Condition is set by a previous comparison operation. 1665 // Condition is set by a previous comparison operation.
1664 Condition condition = OVERFLOW; // Initialize to something. 1666 Condition condition = OVERFLOW; // Initialize to something.
1665 bool ok = SupportedTokenKindToSmiCondition(node->kind(), &condition); 1667 bool ok = SupportedTokenKindToSmiCondition(node->kind(), &condition);
1666 ASSERT(ok); 1668 ASSERT(ok);
1667 if (NodeInfoHasLabels(node)) { 1669 if (NodeInfoHasLabels(node)) {
1668 GenerateConditionalJumps(*(node->info()), condition); 1670 GenerateConditionalJumps(*(node->info()), condition);
1669 node->info()->set_labels_used(true); 1671 node->info()->set_labels_used(true);
1670 } else { 1672 } else {
1671 const Bool& bool_true = Bool::ZoneHandle(Bool::True());
1672 const Bool& bool_false = Bool::ZoneHandle(Bool::False());
1673 Label true_label; 1673 Label true_label;
1674 __ j(condition, &true_label, Assembler::kNearJump); 1674 __ j(condition, &true_label, Assembler::kNearJump);
1675 __ PushObject(bool_false); 1675 __ PushObject(bool_false);
1676 __ jmp(&done, Assembler::kNearJump); 1676 __ jmp(&done, Assembler::kNearJump);
1677 __ Bind(&true_label); 1677 __ Bind(&true_label);
1678 __ PushObject(bool_true); 1678 __ PushObject(bool_true);
1679 } 1679 }
1680 __ Bind(&done); 1680 __ Bind(&done);
1681 } 1681 }
1682 1682
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2439 __ addl(ESP, Immediate(node->arguments()->length() * kWordSize)); 2439 __ addl(ESP, Immediate(node->arguments()->length() * kWordSize));
2440 // Result is in EAX. 2440 // Result is in EAX.
2441 if (IsResultNeeded(node)) { 2441 if (IsResultNeeded(node)) {
2442 __ pushl(EAX); 2442 __ pushl(EAX);
2443 } 2443 }
2444 } 2444 }
2445 2445
2446 } // namespace dart 2446 } // namespace dart
2447 2447
2448 #endif // defined TARGET_ARCH_IA32 2448 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698