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

Side by Side Diff: vm/opt_code_generator_ia32.cc

Issue 8873044: Fix crash from issue 744: evaluate left first before deopt happens (strict comparison). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 9 years 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 | « no previous file | 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 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 return true; 1936 return true;
1937 } 1937 }
1938 1938
1939 1939
1940 // IS, ISNOT are handled in class CodeGenerator. 1940 // IS, ISNOT are handled in class CodeGenerator.
1941 void OptimizingCodeGenerator::VisitComparisonNode(ComparisonNode* node) { 1941 void OptimizingCodeGenerator::VisitComparisonNode(ComparisonNode* node) {
1942 if ((node->kind() == Token::kEQ_STRICT) || 1942 if ((node->kind() == Token::kEQ_STRICT) ||
1943 (node->kind() == Token::kNE_STRICT)) { 1943 (node->kind() == Token::kNE_STRICT)) {
1944 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); 1944 const Bool& bool_true = Bool::ZoneHandle(Bool::True());
1945 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); 1945 const Bool& bool_false = Bool::ZoneHandle(Bool::False());
1946 // Note that evaluation of right may cause deoptimization, therefore left
1947 // must be on stack when evaluating right.
siva 2011/12/09 01:24:56 There seems to be other such cases in GenerateLogi
srdjan 2011/12/09 01:30:25 Will do and it will be part of the next CL.
1946 if (node->right()->IsLiteralNode()) { 1948 if (node->right()->IsLiteralNode()) {
1947 VisitLoadOne(node->left(), EAX); 1949 VisitLoadOne(node->left(), EAX);
1948 __ CompareObject(EAX, node->right()->AsLiteralNode()->literal()); 1950 __ CompareObject(EAX, node->right()->AsLiteralNode()->literal());
1949 } else if (node->left()->IsLiteralNode()) {
1950 VisitLoadOne(node->right(), EAX);
1951 __ CompareObject(EAX, node->left()->AsLiteralNode()->literal());
1952 } else { 1951 } else {
1953 VisitLoadTwo(node->left(), node->right(), EAX, EDX); 1952 VisitLoadTwo(node->left(), node->right(), EAX, EDX);
1954 __ cmpl(EAX, EDX); 1953 __ cmpl(EAX, EDX);
1955 } 1954 }
1956 if (!CodeGenerator::IsResultNeeded(node)) { 1955 if (!CodeGenerator::IsResultNeeded(node)) {
1957 return; 1956 return;
1958 } 1957 }
1959 Condition condition = node->kind() == Token::kEQ_STRICT ? EQUAL : NOT_EQUAL; 1958 Condition condition = node->kind() == Token::kEQ_STRICT ? EQUAL : NOT_EQUAL;
1960 if (NodeInfoHasLabels(node)) { 1959 if (NodeInfoHasLabels(node)) {
1961 GenerateConditionalJumps(*(node->info()), condition); 1960 GenerateConditionalJumps(*(node->info()), condition);
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
2595 if (IsResultNeeded(node)) { 2594 if (IsResultNeeded(node)) {
2596 // The result is the input value. 2595 // The result is the input value.
2597 __ pushl(EAX); 2596 __ pushl(EAX);
2598 } 2597 }
2599 } 2598 }
2600 2599
2601 2600
2602 } // namespace dart 2601 } // namespace dart
2603 2602
2604 #endif // defined TARGET_ARCH_IA32 2603 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698