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

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

Issue 895603002: VM: Improve polymorphic check-class in optimized code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 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/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_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/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 5728 matching lines...) Expand 10 before | Expand all | Expand 10 after
5739 __ cmpl(locs()->in(0).reg(), raw_null); 5739 __ cmpl(locs()->in(0).reg(), raw_null);
5740 __ j(EQUAL, deopt); 5740 __ j(EQUAL, deopt);
5741 return; 5741 return;
5742 } 5742 }
5743 5743
5744 ASSERT((unary_checks().GetReceiverClassIdAt(0) != kSmiCid) || 5744 ASSERT((unary_checks().GetReceiverClassIdAt(0) != kSmiCid) ||
5745 (unary_checks().NumberOfChecks() > 1)); 5745 (unary_checks().NumberOfChecks() > 1));
5746 Register value = locs()->in(0).reg(); 5746 Register value = locs()->in(0).reg();
5747 Register temp = locs()->temp(0).reg(); 5747 Register temp = locs()->temp(0).reg();
5748 Label is_ok; 5748 Label is_ok;
5749 intptr_t cix = 0; 5749 if (unary_checks().GetReceiverClassIdAt(0) == kSmiCid) {
5750 if (unary_checks().GetReceiverClassIdAt(cix) == kSmiCid) {
5751 __ testl(value, Immediate(kSmiTagMask)); 5750 __ testl(value, Immediate(kSmiTagMask));
5752 __ j(ZERO, &is_ok); 5751 __ j(ZERO, &is_ok);
5753 cix++; // Skip first check.
5754 } else { 5752 } else {
5755 __ testl(value, Immediate(kSmiTagMask)); 5753 __ testl(value, Immediate(kSmiTagMask));
5756 __ j(ZERO, deopt); 5754 __ j(ZERO, deopt);
5757 } 5755 }
5758 __ LoadClassId(temp, value); 5756 __ LoadClassId(temp, value);
5759 5757
5760 if (IsDenseSwitch()) { 5758 if (IsDenseSwitch()) {
5761 ASSERT(cids_[0] < cids_[cids_.length() - 1]); 5759 ASSERT(cids_[0] < cids_[cids_.length() - 1]);
5762 __ subl(temp, Immediate(cids_[0])); 5760 __ subl(temp, Immediate(cids_[0]));
5763 __ cmpl(temp, Immediate(cids_[cids_.length() - 1] - cids_[0])); 5761 __ cmpl(temp, Immediate(cids_[cids_.length() - 1] - cids_[0]));
5764 __ j(ABOVE, deopt); 5762 __ j(ABOVE, deopt);
5765 5763
5766 intptr_t mask = ComputeCidMask(); 5764 intptr_t mask = ComputeCidMask();
5767 if (!IsDenseMask(mask)) { 5765 if (!IsDenseMask(mask)) {
5768 // Only need mask if there are missing numbers in the range. 5766 // Only need mask if there are missing numbers in the range.
5769 ASSERT(cids_.length() > 2); 5767 ASSERT(cids_.length() > 2);
5770 Register mask_reg = locs()->temp(1).reg(); 5768 Register mask_reg = locs()->temp(1).reg();
5771 __ movl(mask_reg, Immediate(mask)); 5769 __ movl(mask_reg, Immediate(mask));
5772 __ bt(mask_reg, temp); 5770 __ bt(mask_reg, temp);
5773 __ j(NOT_CARRY, deopt); 5771 __ j(NOT_CARRY, deopt);
5774 } 5772 }
5775 } else { 5773 } else {
5776 const intptr_t num_checks = unary_checks().NumberOfChecks(); 5774 GrowableArray<CidTarget> sorted_ic_data;
5775 FlowGraphCompiler::SortICDataByCount(unary_checks(),
5776 &sorted_ic_data,
5777 /* drop_smi = */ true);
5778 const intptr_t num_checks = sorted_ic_data.length();
5777 const bool use_near_jump = num_checks < 5; 5779 const bool use_near_jump = num_checks < 5;
5778 for (intptr_t i = cix; i < num_checks; i++) { 5780 for (intptr_t i = 0; i < num_checks; i++) {
5779 ASSERT(unary_checks().GetReceiverClassIdAt(i) != kSmiCid); 5781 const intptr_t cid = sorted_ic_data[i].cid;
5780 __ cmpl(temp, Immediate(unary_checks().GetReceiverClassIdAt(i))); 5782 ASSERT(cid != kSmiCid);
5783 __ cmpl(temp, Immediate(cid));
5781 if (i == (num_checks - 1)) { 5784 if (i == (num_checks - 1)) {
5782 __ j(NOT_EQUAL, deopt); 5785 __ j(NOT_EQUAL, deopt);
5783 } else { 5786 } else {
5784 if (use_near_jump) { 5787 if (use_near_jump) {
5785 __ j(EQUAL, &is_ok, Assembler::kNearJump); 5788 __ j(EQUAL, &is_ok, Assembler::kNearJump);
5786 } else { 5789 } else {
5787 __ j(EQUAL, &is_ok); 5790 __ j(EQUAL, &is_ok);
5788 } 5791 }
5789 } 5792 }
5790 } 5793 }
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
6845 __ Drop(1); 6848 __ Drop(1);
6846 __ popl(result); 6849 __ popl(result);
6847 } 6850 }
6848 6851
6849 6852
6850 } // namespace dart 6853 } // namespace dart
6851 6854
6852 #undef __ 6855 #undef __
6853 6856
6854 #endif // defined TARGET_ARCH_IA32 6857 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698