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

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

Issue 10713008: Introduce a VM type cast to avoid repeating a type test and spare a handle. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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') | runtime/vm/object.h » ('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_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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 intptr_t cid, 305 intptr_t cid,
306 intptr_t token_pos, 306 intptr_t token_pos,
307 const AbstractType& type, 307 const AbstractType& type,
308 Label* is_instance_lbl, 308 Label* is_instance_lbl,
309 Label* is_not_instance_lbl) { 309 Label* is_not_instance_lbl) {
310 ASSERT(!type.IsInstantiated()); 310 ASSERT(!type.IsInstantiated());
311 // Skip check if destination is a dynamic type. 311 // Skip check if destination is a dynamic type.
312 const Immediate raw_null = 312 const Immediate raw_null =
313 Immediate(reinterpret_cast<intptr_t>(Object::null())); 313 Immediate(reinterpret_cast<intptr_t>(Object::null()));
314 if (type.IsTypeParameter()) { 314 if (type.IsTypeParameter()) {
315 // TODO(regis): Introduce and use TypeParameter::Cast(). 315 const TypeParameter& type_param = TypeParameter::Cast(type);
316 const TypeParameter* type_param =
317 reinterpret_cast<const TypeParameter*>(&type);
318 // Load instantiator (or null) and instantiator type arguments on stack. 316 // Load instantiator (or null) and instantiator type arguments on stack.
319 __ movq(RDX, Address(RSP, 0)); // Get instantiator type arguments. 317 __ movq(RDX, Address(RSP, 0)); // Get instantiator type arguments.
320 // RDX: instantiator type arguments. 318 // RDX: instantiator type arguments.
321 // Check if type argument is Dynamic. 319 // Check if type argument is Dynamic.
322 __ cmpq(RDX, raw_null); 320 __ cmpq(RDX, raw_null);
323 __ j(EQUAL, is_instance_lbl); 321 __ j(EQUAL, is_instance_lbl);
324 // Can handle only type arguments that are instances of TypeArguments. 322 // Can handle only type arguments that are instances of TypeArguments.
325 // (runtime checks canonicalize type arguments). 323 // (runtime checks canonicalize type arguments).
326 Label fall_through; 324 Label fall_through;
327 __ CompareClassId(RDX, kTypeArguments); 325 __ CompareClassId(RDX, kTypeArguments);
328 __ j(NOT_EQUAL, &fall_through); 326 __ j(NOT_EQUAL, &fall_through);
329 __ movq(RDI, 327 __ movq(RDI,
330 FieldAddress(RDX, TypeArguments::type_at_offset(type_param->index()))); 328 FieldAddress(RDX, TypeArguments::type_at_offset(type_param.index())));
331 // RDI: Concrete type of type. 329 // RDI: Concrete type of type.
332 // Check if type argument is dynamic. 330 // Check if type argument is dynamic.
333 __ CompareObject(RDI, Type::ZoneHandle(Type::DynamicType())); 331 __ CompareObject(RDI, Type::ZoneHandle(Type::DynamicType()));
334 __ j(EQUAL, is_instance_lbl); 332 __ j(EQUAL, is_instance_lbl);
335 __ cmpq(RDI, raw_null); 333 __ cmpq(RDI, raw_null);
336 __ j(EQUAL, is_instance_lbl); 334 __ j(EQUAL, is_instance_lbl);
337 const Type& object_type = Type::ZoneHandle(Type::ObjectType()); 335 const Type& object_type = Type::ZoneHandle(Type::ObjectType());
338 __ CompareObject(RDI, object_type); 336 __ CompareObject(RDI, object_type);
339 __ j(EQUAL, is_instance_lbl); 337 __ j(EQUAL, is_instance_lbl);
340 338
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 __ cvtsi2sd(result, temp); 1078 __ cvtsi2sd(result, temp);
1081 __ Bind(&done); 1079 __ Bind(&done);
1082 } 1080 }
1083 1081
1084 1082
1085 #undef __ 1083 #undef __
1086 1084
1087 } // namespace dart 1085 } // namespace dart
1088 1086
1089 #endif // defined TARGET_ARCH_X64 1087 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698