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

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

Issue 26682003: Cache number of type arguments in class object instead of recalculating it. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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_mips.cc ('k') | runtime/vm/flow_graph_optimizer.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // Clobbers R10. 217 // Clobbers R10.
218 RawSubtypeTestCache* 218 RawSubtypeTestCache*
219 FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest( 219 FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
220 intptr_t token_pos, 220 intptr_t token_pos,
221 const AbstractType& type, 221 const AbstractType& type,
222 Label* is_instance_lbl, 222 Label* is_instance_lbl,
223 Label* is_not_instance_lbl) { 223 Label* is_not_instance_lbl) {
224 __ Comment("InstantiatedTypeWithArgumentsTest"); 224 __ Comment("InstantiatedTypeWithArgumentsTest");
225 ASSERT(type.IsInstantiated()); 225 ASSERT(type.IsInstantiated());
226 const Class& type_class = Class::ZoneHandle(type.type_class()); 226 const Class& type_class = Class::ZoneHandle(type.type_class());
227 ASSERT(type_class.HasTypeArguments() || type_class.IsSignatureClass()); 227 ASSERT((type_class.NumTypeArguments() > 0) || type_class.IsSignatureClass());
228 const Register kInstanceReg = RAX; 228 const Register kInstanceReg = RAX;
229 Error& malformed_error = Error::Handle(); 229 Error& malformed_error = Error::Handle();
230 const Type& int_type = Type::Handle(Type::IntType()); 230 const Type& int_type = Type::Handle(Type::IntType());
231 const bool smi_is_ok = int_type.IsSubtypeOf(type, &malformed_error); 231 const bool smi_is_ok = int_type.IsSubtypeOf(type, &malformed_error);
232 // Malformed type should have been handled at graph construction time. 232 // Malformed type should have been handled at graph construction time.
233 ASSERT(smi_is_ok || malformed_error.IsNull()); 233 ASSERT(smi_is_ok || malformed_error.IsNull());
234 __ testq(kInstanceReg, Immediate(kSmiTagMask)); 234 __ testq(kInstanceReg, Immediate(kSmiTagMask));
235 if (smi_is_ok) { 235 if (smi_is_ok) {
236 __ j(ZERO, is_instance_lbl); 236 __ j(ZERO, is_instance_lbl);
237 } else { 237 } else {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 // Clobbers R10, R13. 303 // Clobbers R10, R13.
304 // Returns true if there is a fallthrough. 304 // Returns true if there is a fallthrough.
305 bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest( 305 bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
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 __ Comment("InstantiatedTypeNoArgumentsTest"); 310 __ Comment("InstantiatedTypeNoArgumentsTest");
311 ASSERT(type.IsInstantiated()); 311 ASSERT(type.IsInstantiated());
312 const Class& type_class = Class::Handle(type.type_class()); 312 const Class& type_class = Class::Handle(type.type_class());
313 ASSERT(!type_class.HasTypeArguments()); 313 ASSERT(type_class.NumTypeArguments() == 0);
314 314
315 const Register kInstanceReg = RAX; 315 const Register kInstanceReg = RAX;
316 __ testq(kInstanceReg, Immediate(kSmiTagMask)); 316 __ testq(kInstanceReg, Immediate(kSmiTagMask));
317 // If instance is Smi, check directly. 317 // If instance is Smi, check directly.
318 const Class& smi_class = Class::Handle(Smi::Class()); 318 const Class& smi_class = Class::Handle(Smi::Class());
319 if (smi_class.IsSubtypeOf(TypeArguments::Handle(), 319 if (smi_class.IsSubtypeOf(TypeArguments::Handle(),
320 type_class, 320 type_class,
321 TypeArguments::Handle(), 321 TypeArguments::Handle(),
322 NULL)) { 322 NULL)) {
323 __ j(ZERO, is_instance_lbl); 323 __ j(ZERO, is_instance_lbl);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 __ j(EQUAL, is_instance_lbl); 510 __ j(EQUAL, is_instance_lbl);
511 } 511 }
512 __ jmp(is_not_instance_lbl); 512 __ jmp(is_not_instance_lbl);
513 return SubtypeTestCache::null(); 513 return SubtypeTestCache::null();
514 } 514 }
515 if (type.IsInstantiated()) { 515 if (type.IsInstantiated()) {
516 const Class& type_class = Class::ZoneHandle(type.type_class()); 516 const Class& type_class = Class::ZoneHandle(type.type_class());
517 // A class equality check is only applicable with a dst type of a 517 // A class equality check is only applicable with a dst type of a
518 // non-parameterized class, non-signature class, or with a raw dst type of 518 // non-parameterized class, non-signature class, or with a raw dst type of
519 // a parameterized class. 519 // a parameterized class.
520 if (type_class.IsSignatureClass() || type_class.HasTypeArguments()) { 520 if (type_class.IsSignatureClass() || (type_class.NumTypeArguments() > 0)) {
521 return GenerateInstantiatedTypeWithArgumentsTest(token_pos, 521 return GenerateInstantiatedTypeWithArgumentsTest(token_pos,
522 type, 522 type,
523 is_instance_lbl, 523 is_instance_lbl,
524 is_not_instance_lbl); 524 is_not_instance_lbl);
525 // Fall through to runtime call. 525 // Fall through to runtime call.
526 } 526 }
527 const bool has_fall_through = 527 const bool has_fall_through =
528 GenerateInstantiatedTypeNoArgumentsTest(token_pos, 528 GenerateInstantiatedTypeNoArgumentsTest(token_pos,
529 type, 529 type,
530 is_instance_lbl, 530 is_instance_lbl,
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 __ movups(reg, Address(RSP, 0)); 1934 __ movups(reg, Address(RSP, 0));
1935 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); 1935 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP);
1936 } 1936 }
1937 1937
1938 1938
1939 #undef __ 1939 #undef __
1940 1940
1941 } // namespace dart 1941 } // namespace dart
1942 1942
1943 #endif // defined TARGET_ARCH_X64 1943 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698