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

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

Issue 178193020: Better inlining of type tests. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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
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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 intptr_t token_pos, 511 intptr_t token_pos,
512 const AbstractType& type, 512 const AbstractType& type,
513 Label* is_instance_lbl, 513 Label* is_instance_lbl,
514 Label* is_not_instance_lbl) { 514 Label* is_not_instance_lbl) {
515 __ Comment("InlineInstanceof"); 515 __ Comment("InlineInstanceof");
516 if (type.IsVoidType()) { 516 if (type.IsVoidType()) {
517 // A non-null value is returned from a void function, which will result in a 517 // A non-null value is returned from a void function, which will result in a
518 // type error. A null value is handled prior to executing this inline code. 518 // type error. A null value is handled prior to executing this inline code.
519 return SubtypeTestCache::null(); 519 return SubtypeTestCache::null();
520 } 520 }
521 if (TypeCheckAsClassEquality(type)) {
522 const intptr_t type_cid = Class::Handle(type.type_class()).id();
523 const Register kInstanceReg = EAX;
524 __ testl(kInstanceReg, Immediate(kSmiTagMask));
525 if (type_cid == kSmiCid) {
526 __ j(ZERO, is_instance_lbl);
527 } else {
528 __ j(ZERO, is_not_instance_lbl);
529 __ CompareClassId(kInstanceReg, type_cid, EDI);
530 __ j(EQUAL, is_instance_lbl);
531 }
532 __ jmp(is_not_instance_lbl);
533 return SubtypeTestCache::null();
534 }
535 if (type.IsInstantiated()) { 521 if (type.IsInstantiated()) {
536 const Class& type_class = Class::ZoneHandle(type.type_class()); 522 const Class& type_class = Class::ZoneHandle(type.type_class());
537 // A class equality check is only applicable with a dst type of a 523 // A class equality check is only applicable with a dst type of a
538 // non-parameterized class, non-signature class, or with a raw dst type of 524 // non-parameterized class, non-signature class, or with a raw dst type of
539 // a parameterized class. 525 // a parameterized class.
540 if (type_class.IsSignatureClass() || (type_class.NumTypeArguments() > 0)) { 526 if (type_class.IsSignatureClass() || (type_class.NumTypeArguments() > 0)) {
541 return GenerateInstantiatedTypeWithArgumentsTest(token_pos, 527 return GenerateInstantiatedTypeWithArgumentsTest(token_pos,
542 type, 528 type,
543 is_instance_lbl, 529 is_instance_lbl,
544 is_not_instance_lbl); 530 is_not_instance_lbl);
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 __ movups(reg, Address(ESP, 0)); 1818 __ movups(reg, Address(ESP, 0));
1833 __ addl(ESP, Immediate(kFpuRegisterSize)); 1819 __ addl(ESP, Immediate(kFpuRegisterSize));
1834 } 1820 }
1835 1821
1836 1822
1837 #undef __ 1823 #undef __
1838 1824
1839 } // namespace dart 1825 } // namespace dart
1840 1826
1841 #endif // defined TARGET_ARCH_IA32 1827 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698