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

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

Issue 2748063003: Reland "VM: Simplify lowering of is-tests."" (Closed)
Patch Set: Created 3 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
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm64.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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 // - Class equality (only if class is not parameterized). 554 // - Class equality (only if class is not parameterized).
555 // Inputs: 555 // Inputs:
556 // - EAX: object. 556 // - EAX: object.
557 // - EDX: instantiator type arguments or raw_null. 557 // - EDX: instantiator type arguments or raw_null.
558 // Clobbers EDX. 558 // Clobbers EDX.
559 // Returns: 559 // Returns:
560 // - true or false in EAX. 560 // - true or false in EAX.
561 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, 561 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos,
562 intptr_t deopt_id, 562 intptr_t deopt_id,
563 const AbstractType& type, 563 const AbstractType& type,
564 bool negate_result,
565 LocationSummary* locs) { 564 LocationSummary* locs) {
566 ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded()); 565 ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded());
567 ASSERT(!type.IsObjectType() && !type.IsDynamicType()); 566 ASSERT(!type.IsObjectType() && !type.IsDynamicType());
568 567
569 const Immediate& raw_null = 568 const Immediate& raw_null =
570 Immediate(reinterpret_cast<intptr_t>(Object::null())); 569 Immediate(reinterpret_cast<intptr_t>(Object::null()));
571 Label is_instance, is_not_instance; 570 Label is_instance, is_not_instance;
572 __ pushl(EDX); // Store instantiator type arguments. 571 __ pushl(EDX); // Store instantiator type arguments.
573 // If type is instantiated and non-parameterized, we can inline code 572 // If type is instantiated and non-parameterized, we can inline code
574 // checking whether the tested instance is a Smi. 573 // checking whether the tested instance is a Smi.
(...skipping 22 matching lines...) Expand all
597 __ PushObject(Object::null_object()); // Make room for the result. 596 __ PushObject(Object::null_object()); // Make room for the result.
598 __ pushl(EAX); // Push the instance. 597 __ pushl(EAX); // Push the instance.
599 __ PushObject(type); // Push the type. 598 __ PushObject(type); // Push the type.
600 __ pushl(EDX); // Instantiator type arguments. 599 __ pushl(EDX); // Instantiator type arguments.
601 __ LoadObject(EAX, test_cache); 600 __ LoadObject(EAX, test_cache);
602 __ pushl(EAX); 601 __ pushl(EAX);
603 GenerateRuntimeCall(token_pos, deopt_id, kInstanceofRuntimeEntry, 4, locs); 602 GenerateRuntimeCall(token_pos, deopt_id, kInstanceofRuntimeEntry, 4, locs);
604 // Pop the parameters supplied to the runtime entry. The result of the 603 // Pop the parameters supplied to the runtime entry. The result of the
605 // instanceof runtime call will be left as the result of the operation. 604 // instanceof runtime call will be left as the result of the operation.
606 __ Drop(4); 605 __ Drop(4);
607 if (negate_result) { 606 __ popl(EAX);
608 __ popl(EDX);
609 __ LoadObject(EAX, Bool::True());
610 __ cmpl(EDX, EAX);
611 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
612 __ LoadObject(EAX, Bool::False());
613 } else {
614 __ popl(EAX);
615 }
616 __ jmp(&done, Assembler::kNearJump); 607 __ jmp(&done, Assembler::kNearJump);
617 } 608 }
618 __ Bind(&is_not_instance); 609 __ Bind(&is_not_instance);
619 __ LoadObject(EAX, Bool::Get(negate_result)); 610 __ LoadObject(EAX, Bool::Get(false));
620 __ jmp(&done, Assembler::kNearJump); 611 __ jmp(&done, Assembler::kNearJump);
621 612
622 __ Bind(&is_instance); 613 __ Bind(&is_instance);
623 __ LoadObject(EAX, Bool::Get(!negate_result)); 614 __ LoadObject(EAX, Bool::Get(true));
624 __ Bind(&done); 615 __ Bind(&done);
625 __ popl(EDX); // Remove pushed instantiator type arguments. 616 __ popl(EDX); // Remove pushed instantiator type arguments.
626 } 617 }
627 618
628 619
629 // Optimize assignable type check by adding inlined tests for: 620 // Optimize assignable type check by adding inlined tests for:
630 // - NULL -> return NULL. 621 // - NULL -> return NULL.
631 // - Smi -> compile time subtype check (only if dst class is not parameterized). 622 // - Smi -> compile time subtype check (only if dst class is not parameterized).
632 // - Class equality (only if class is not parameterized). 623 // - Class equality (only if class is not parameterized).
633 // Inputs: 624 // Inputs:
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 __ movups(reg, Address(ESP, 0)); 1759 __ movups(reg, Address(ESP, 0));
1769 __ addl(ESP, Immediate(kFpuRegisterSize)); 1760 __ addl(ESP, Immediate(kFpuRegisterSize));
1770 } 1761 }
1771 1762
1772 1763
1773 #undef __ 1764 #undef __
1774 1765
1775 } // namespace dart 1766 } // namespace dart
1776 1767
1777 #endif // defined TARGET_ARCH_IA32 1768 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm64.cc ('k') | runtime/vm/flow_graph_compiler_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698