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

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.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_arm.cc ('k') | runtime/vm/flow_graph_compiler_mips.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_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 "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Clobbers ECX, EDI. 224 // Clobbers ECX, EDI.
225 RawSubtypeTestCache* 225 RawSubtypeTestCache*
226 FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest( 226 FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
227 intptr_t token_pos, 227 intptr_t token_pos,
228 const AbstractType& type, 228 const AbstractType& type,
229 Label* is_instance_lbl, 229 Label* is_instance_lbl,
230 Label* is_not_instance_lbl) { 230 Label* is_not_instance_lbl) {
231 __ Comment("InstantiatedTypeWithArgumentsTest"); 231 __ Comment("InstantiatedTypeWithArgumentsTest");
232 ASSERT(type.IsInstantiated()); 232 ASSERT(type.IsInstantiated());
233 const Class& type_class = Class::ZoneHandle(type.type_class()); 233 const Class& type_class = Class::ZoneHandle(type.type_class());
234 ASSERT(type_class.HasTypeArguments() || type_class.IsSignatureClass()); 234 ASSERT((type_class.NumTypeArguments() > 0) || type_class.IsSignatureClass());
235 const Register kInstanceReg = EAX; 235 const Register kInstanceReg = EAX;
236 Error& malformed_error = Error::Handle(); 236 Error& malformed_error = Error::Handle();
237 const Type& int_type = Type::Handle(Type::IntType()); 237 const Type& int_type = Type::Handle(Type::IntType());
238 const bool smi_is_ok = int_type.IsSubtypeOf(type, &malformed_error); 238 const bool smi_is_ok = int_type.IsSubtypeOf(type, &malformed_error);
239 // Malformed type should have been handled at graph construction time. 239 // Malformed type should have been handled at graph construction time.
240 ASSERT(smi_is_ok || malformed_error.IsNull()); 240 ASSERT(smi_is_ok || malformed_error.IsNull());
241 __ testl(kInstanceReg, Immediate(kSmiTagMask)); 241 __ testl(kInstanceReg, Immediate(kSmiTagMask));
242 if (smi_is_ok) { 242 if (smi_is_ok) {
243 __ j(ZERO, is_instance_lbl); 243 __ j(ZERO, is_instance_lbl);
244 } else { 244 } else {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 // Clobbers ECX, EDI. 310 // Clobbers ECX, EDI.
311 // Returns true if there is a fallthrough. 311 // Returns true if there is a fallthrough.
312 bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest( 312 bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
313 intptr_t token_pos, 313 intptr_t token_pos,
314 const AbstractType& type, 314 const AbstractType& type,
315 Label* is_instance_lbl, 315 Label* is_instance_lbl,
316 Label* is_not_instance_lbl) { 316 Label* is_not_instance_lbl) {
317 __ Comment("InstantiatedTypeNoArgumentsTest"); 317 __ Comment("InstantiatedTypeNoArgumentsTest");
318 ASSERT(type.IsInstantiated()); 318 ASSERT(type.IsInstantiated());
319 const Class& type_class = Class::Handle(type.type_class()); 319 const Class& type_class = Class::Handle(type.type_class());
320 ASSERT(!type_class.HasTypeArguments()); 320 ASSERT(type_class.NumTypeArguments() == 0);
321 321
322 const Register kInstanceReg = EAX; 322 const Register kInstanceReg = EAX;
323 __ testl(kInstanceReg, Immediate(kSmiTagMask)); 323 __ testl(kInstanceReg, Immediate(kSmiTagMask));
324 // If instance is Smi, check directly. 324 // If instance is Smi, check directly.
325 const Class& smi_class = Class::Handle(Smi::Class()); 325 const Class& smi_class = Class::Handle(Smi::Class());
326 if (smi_class.IsSubtypeOf(TypeArguments::Handle(), 326 if (smi_class.IsSubtypeOf(TypeArguments::Handle(),
327 type_class, 327 type_class,
328 TypeArguments::Handle(), 328 TypeArguments::Handle(),
329 NULL)) { 329 NULL)) {
330 __ j(ZERO, is_instance_lbl); 330 __ j(ZERO, is_instance_lbl);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 __ j(EQUAL, is_instance_lbl); 521 __ j(EQUAL, is_instance_lbl);
522 } 522 }
523 __ jmp(is_not_instance_lbl); 523 __ jmp(is_not_instance_lbl);
524 return SubtypeTestCache::null(); 524 return SubtypeTestCache::null();
525 } 525 }
526 if (type.IsInstantiated()) { 526 if (type.IsInstantiated()) {
527 const Class& type_class = Class::ZoneHandle(type.type_class()); 527 const Class& type_class = Class::ZoneHandle(type.type_class());
528 // A class equality check is only applicable with a dst type of a 528 // A class equality check is only applicable with a dst type of a
529 // non-parameterized class, non-signature class, or with a raw dst type of 529 // non-parameterized class, non-signature class, or with a raw dst type of
530 // a parameterized class. 530 // a parameterized class.
531 if (type_class.IsSignatureClass() || type_class.HasTypeArguments()) { 531 if (type_class.IsSignatureClass() || (type_class.NumTypeArguments() > 0)) {
532 return GenerateInstantiatedTypeWithArgumentsTest(token_pos, 532 return GenerateInstantiatedTypeWithArgumentsTest(token_pos,
533 type, 533 type,
534 is_instance_lbl, 534 is_instance_lbl,
535 is_not_instance_lbl); 535 is_not_instance_lbl);
536 // Fall through to runtime call. 536 // Fall through to runtime call.
537 } 537 }
538 const bool has_fall_through = 538 const bool has_fall_through =
539 GenerateInstantiatedTypeNoArgumentsTest(token_pos, 539 GenerateInstantiatedTypeNoArgumentsTest(token_pos,
540 type, 540 type,
541 is_instance_lbl, 541 is_instance_lbl,
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 __ movups(reg, Address(ESP, 0)); 1915 __ movups(reg, Address(ESP, 0));
1916 __ addl(ESP, Immediate(kFpuRegisterSize)); 1916 __ addl(ESP, Immediate(kFpuRegisterSize));
1917 } 1917 }
1918 1918
1919 1919
1920 #undef __ 1920 #undef __
1921 1921
1922 } // namespace dart 1922 } // namespace dart
1923 1923
1924 #endif // defined TARGET_ARCH_IA32 1924 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm.cc ('k') | runtime/vm/flow_graph_compiler_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698