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

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.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 | « runtime/vm/flow_graph_compiler_ia32.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) 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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 = RAX; 202 const Register kInstanceReg = RAX;
203 Label compare_classes;
204 __ testq(kInstanceReg, Immediate(kSmiTagMask)); 203 __ testq(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 = R10; 215 const Register kClassIdReg = R10;
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 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { 1479 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) {
1483 __ Exchange(mem1, mem2); 1480 __ Exchange(mem1, mem2);
1484 } 1481 }
1485 1482
1486 1483
1487 #undef __ 1484 #undef __
1488 1485
1489 } // namespace dart 1486 } // namespace dart
1490 1487
1491 #endif // defined TARGET_ARCH_X64 1488 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698