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

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

Issue 11674011: Small code cleanup in instanceof test. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_x64.cc » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 intptr_t token_pos, 193 intptr_t token_pos,
194 const AbstractType& type, 194 const AbstractType& type,
195 Label* is_instance_lbl, 195 Label* is_instance_lbl,
196 Label* is_not_instance_lbl) { 196 Label* is_not_instance_lbl) {
197 __ Comment("InstantiatedTypeNoArgumentsTest"); 197 __ Comment("InstantiatedTypeNoArgumentsTest");
198 ASSERT(type.IsInstantiated()); 198 ASSERT(type.IsInstantiated());
199 const Class& type_class = Class::Handle(type.type_class()); 199 const Class& type_class = Class::Handle(type.type_class());
200 ASSERT(!type_class.HasTypeArguments()); 200 ASSERT(!type_class.HasTypeArguments());
201 201
202 const Register kInstanceReg = EAX; 202 const Register kInstanceReg = EAX;
203 Label compare_classes;
204 __ testl(kInstanceReg, Immediate(kSmiTagMask)); 203 __ testl(kInstanceReg, Immediate(kSmiTagMask));
205 __ j(NOT_ZERO, &compare_classes, Assembler::kNearJump); 204 // If instance is Smi, check directly.
206 // Instance is Smi, check directly.
207 const Class& smi_class = Class::Handle(Smi::Class()); 205 const Class& smi_class = Class::Handle(Smi::Class());
208 if (smi_class.IsSubtypeOf(TypeArguments::Handle(), 206 if (smi_class.IsSubtypeOf(TypeArguments::Handle(),
209 type_class, 207 type_class,
210 TypeArguments::Handle(), 208 TypeArguments::Handle(),
211 NULL)) { 209 NULL)) {
212 __ jmp(is_instance_lbl); 210 __ j(ZERO, is_instance_lbl);
213 } else { 211 } else {
214 __ jmp(is_not_instance_lbl); 212 __ j(ZERO, is_not_instance_lbl);
215 } 213 }
216 // Compare if the classes are equal. 214 // Compare if the classes are equal.
217 __ Bind(&compare_classes);
218 const Register kClassIdReg = ECX; 215 const Register kClassIdReg = ECX;
219 __ LoadClassId(kClassIdReg, kInstanceReg); 216 __ LoadClassId(kClassIdReg, kInstanceReg);
220 __ cmpl(kClassIdReg, Immediate(type_class.id())); 217 __ cmpl(kClassIdReg, Immediate(type_class.id()));
221 __ j(EQUAL, is_instance_lbl); 218 __ j(EQUAL, is_instance_lbl);
222 // Bool interface can be implemented only by core class Bool. 219 // Bool interface can be implemented only by core class Bool.
223 // (see ClassFinalizer::ResolveInterfaces for list of restricted interfaces). 220 // (see ClassFinalizer::ResolveInterfaces for list of restricted interfaces).
224 if (type.IsBoolType()) { 221 if (type.IsBoolType()) {
225 __ cmpl(kClassIdReg, Immediate(kBoolCid)); 222 __ cmpl(kClassIdReg, Immediate(kBoolCid));
226 __ j(EQUAL, is_instance_lbl); 223 __ j(EQUAL, is_instance_lbl);
227 __ jmp(is_not_instance_lbl); 224 __ jmp(is_not_instance_lbl);
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 __ popl(ECX); 1501 __ popl(ECX);
1505 __ popl(EAX); 1502 __ popl(EAX);
1506 } 1503 }
1507 1504
1508 1505
1509 #undef __ 1506 #undef __
1510 1507
1511 } // namespace dart 1508 } // namespace dart
1512 1509
1513 #endif // defined TARGET_ARCH_IA32 1510 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698