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

Side by Side Diff: runtime/vm/flow_graph_compiler_arm.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.cc ('k') | runtime/vm/flow_graph_compiler_ia32.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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 R2. 217 // Clobbers R2.
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 = R0; 228 const Register kInstanceReg = R0;
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 __ tst(kInstanceReg, ShifterOperand(kSmiTagMask)); 234 __ tst(kInstanceReg, ShifterOperand(kSmiTagMask));
235 if (smi_is_ok) { 235 if (smi_is_ok) {
236 __ b(is_instance_lbl, EQ); 236 __ b(is_instance_lbl, EQ);
237 } else { 237 } else {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // Clobbers R2, R3. 304 // Clobbers R2, R3.
305 // Returns true if there is a fallthrough. 305 // Returns true if there is a fallthrough.
306 bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest( 306 bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
307 intptr_t token_pos, 307 intptr_t token_pos,
308 const AbstractType& type, 308 const AbstractType& type,
309 Label* is_instance_lbl, 309 Label* is_instance_lbl,
310 Label* is_not_instance_lbl) { 310 Label* is_not_instance_lbl) {
311 __ Comment("InstantiatedTypeNoArgumentsTest"); 311 __ Comment("InstantiatedTypeNoArgumentsTest");
312 ASSERT(type.IsInstantiated()); 312 ASSERT(type.IsInstantiated());
313 const Class& type_class = Class::Handle(type.type_class()); 313 const Class& type_class = Class::Handle(type.type_class());
314 ASSERT(!type_class.HasTypeArguments()); 314 ASSERT(type_class.NumTypeArguments() == 0);
315 315
316 const Register kInstanceReg = R0; 316 const Register kInstanceReg = R0;
317 __ tst(kInstanceReg, ShifterOperand(kSmiTagMask)); 317 __ tst(kInstanceReg, ShifterOperand(kSmiTagMask));
318 // If instance is Smi, check directly. 318 // If instance is Smi, check directly.
319 const Class& smi_class = Class::Handle(Smi::Class()); 319 const Class& smi_class = Class::Handle(Smi::Class());
320 if (smi_class.IsSubtypeOf(TypeArguments::Handle(), 320 if (smi_class.IsSubtypeOf(TypeArguments::Handle(),
321 type_class, 321 type_class,
322 TypeArguments::Handle(), 322 TypeArguments::Handle(),
323 NULL)) { 323 NULL)) {
324 __ b(is_instance_lbl, EQ); 324 __ b(is_instance_lbl, EQ);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 __ b(is_instance_lbl, EQ); 510 __ b(is_instance_lbl, EQ);
511 } 511 }
512 __ b(is_not_instance_lbl); 512 __ b(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 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 DRegister dreg = EvenDRegisterOf(reg); 1911 DRegister dreg = EvenDRegisterOf(reg);
1912 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1912 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1913 } 1913 }
1914 1914
1915 1915
1916 #undef __ 1916 #undef __
1917 1917
1918 } // namespace dart 1918 } // namespace dart
1919 1919
1920 #endif // defined TARGET_ARCH_ARM 1920 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698