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

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

Issue 10659005: Implement type cast in the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 months 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
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 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 __ j(condition, &is_true); 2091 __ j(condition, &is_true);
2092 __ PushObject(bool_false); 2092 __ PushObject(bool_false);
2093 __ jmp(&done); 2093 __ jmp(&done);
2094 __ Bind(&is_true); 2094 __ Bind(&is_true);
2095 __ PushObject(bool_true); 2095 __ PushObject(bool_true);
2096 __ Bind(&done); 2096 __ Bind(&done);
2097 } 2097 }
2098 return; 2098 return;
2099 } 2099 }
2100 2100
2101 if (Token::IsInstanceofOperator(node->kind())) { 2101 if (Token::IsTypeTestOperator(node->kind())) {
2102 VisitLoadOne(node->left(), EAX); 2102 VisitLoadOne(node->left(), EAX);
2103 ASSERT(node->right()->IsTypeNode()); 2103 ASSERT(node->right()->IsTypeNode());
2104 GenerateInstanceOf(node->id(), 2104 GenerateInstanceOf(node->id(),
2105 node->token_pos(), 2105 node->token_pos(),
2106 node->left(), 2106 node->left(),
2107 node->right()->AsTypeNode()->type(), 2107 node->right()->AsTypeNode()->type(),
2108 (node->kind() == Token::kISNOT)); 2108 (node->kind() == Token::kISNOT));
2109 if (!IsResultNeeded(node)) { 2109 if (!IsResultNeeded(node)) {
2110 __ popl(EAX); // Pop the result of the instanceof operation. 2110 __ popl(EAX); // Pop the result of the instanceof operation.
2111 } 2111 }
2112 return; 2112 return;
2113 } 2113 }
2114 2114
2115 if (Token::IsTypeCastOperator(node->kind())) {
2116 // This code generator is not maintained anymore.
2117 UNIMPLEMENTED();
2118 }
2119
2115 if (NodeHasClassAt(node, smi_class_, 0)) { 2120 if (NodeHasClassAt(node, smi_class_, 0)) {
2116 if (GenerateSmiComparison(node)) { 2121 if (GenerateSmiComparison(node)) {
2117 // The comparison was handled, code was emitted. 2122 // The comparison was handled, code was emitted.
2118 return; 2123 return;
2119 } 2124 }
2120 // Fall through if condition is not supported. 2125 // Fall through if condition is not supported.
2121 } else if (NodeHasClassAt(node, double_class_, 0)) { 2126 } else if (NodeHasClassAt(node, double_class_, 0)) {
2122 // Double comparison. 2127 // Double comparison.
2123 if (GenerateDoubleComparison(node)) { 2128 if (GenerateDoubleComparison(node)) {
2124 return; 2129 return;
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
2880 } 2885 }
2881 } 2886 }
2882 // TODO(srdjan): Implement unary kSUB (negate) Mint. 2887 // TODO(srdjan): Implement unary kSUB (negate) Mint.
2883 CodeGenerator::VisitUnaryOpNode(node); 2888 CodeGenerator::VisitUnaryOpNode(node);
2884 } 2889 }
2885 2890
2886 2891
2887 } // namespace dart 2892 } // namespace dart
2888 2893
2889 #endif // defined TARGET_ARCH_IA32 2894 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698