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

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

Issue 252873003: Address comments on Issue 258563004. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | « no previous file | no next file » | 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/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 3665 matching lines...) Expand 10 before | Expand all | Expand 10 after
3676 // If type tests specified by 'ic_data' do not depend on type arguments, 3676 // If type tests specified by 'ic_data' do not depend on type arguments,
3677 // return mapping cid->result in 'results' (i : cid; i + 1: result). 3677 // return mapping cid->result in 'results' (i : cid; i + 1: result).
3678 // If all tests yield the same result, return it otherwise return Bool::null. 3678 // If all tests yield the same result, return it otherwise return Bool::null.
3679 // If no mapping is possible, 'results' is empty. 3679 // If no mapping is possible, 'results' is empty.
3680 // An instance-of test returning all same results can be converted to a class 3680 // An instance-of test returning all same results can be converted to a class
3681 // check. 3681 // check.
3682 RawBool* FlowGraphOptimizer::InstanceOfAsBool( 3682 RawBool* FlowGraphOptimizer::InstanceOfAsBool(
3683 const ICData& ic_data, 3683 const ICData& ic_data,
3684 const AbstractType& type, 3684 const AbstractType& type,
3685 ZoneGrowableArray<intptr_t>* results) const { 3685 ZoneGrowableArray<intptr_t>* results) const {
3686 results->Clear(); 3686 ASSERT(results->is_empty());
3687 ASSERT(ic_data.NumArgsTested() == 1); // Unary checks only. 3687 ASSERT(ic_data.NumArgsTested() == 1); // Unary checks only.
3688 if (!type.IsInstantiated() || type.IsMalformedOrMalbounded()) { 3688 if (!type.IsInstantiated() || type.IsMalformedOrMalbounded()) {
3689 return Bool::null(); 3689 return Bool::null();
3690 } 3690 }
3691 const Class& type_class = Class::Handle(type.type_class()); 3691 const Class& type_class = Class::Handle(type.type_class());
3692 const intptr_t num_type_args = type_class.NumTypeArguments(); 3692 const intptr_t num_type_args = type_class.NumTypeArguments();
3693 if (num_type_args > 0) { 3693 if (num_type_args > 0) {
3694 // Only raw types can be directly compared, thus disregarding type 3694 // Only raw types can be directly compared, thus disregarding type
3695 // arguments. 3695 // arguments.
3696 const intptr_t num_type_params = type_class.NumTypeParameters(); 3696 const intptr_t num_type_params = type_class.NumTypeParameters();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
3811 results->Add((*results)[results->length() - 2]); 3811 results->Add((*results)[results->length() - 2]);
3812 for (intptr_t i = results->length() - 3; i > 1; --i) { 3812 for (intptr_t i = results->length() - 3; i > 1; --i) {
3813 (*results)[i] = (*results)[i - 2]; 3813 (*results)[i] = (*results)[i - 2];
3814 } 3814 }
3815 (*results)[0] = kSmiCid; 3815 (*results)[0] = kSmiCid;
3816 (*results)[1] = smi_is_subtype; 3816 (*results)[1] = smi_is_subtype;
3817 } 3817 }
3818 3818
3819 ASSERT(type.IsInstantiated() && !type.IsMalformedOrMalbounded()); 3819 ASSERT(type.IsInstantiated() && !type.IsMalformedOrMalbounded());
3820 ASSERT(results->length() >= 2); 3820 ASSERT(results->length() >= 2);
3821 // const Class& type_class = Class::Handle(type.type_class())
3822 if (type.IsIntType()) { 3821 if (type.IsIntType()) {
3823 ASSERT((*results)[0] == kSmiCid); 3822 ASSERT((*results)[0] == kSmiCid);
3824 TryAddTest(results, kMintCid, true); 3823 TryAddTest(results, kMintCid, true);
3825 TryAddTest(results, kBigintCid, true); 3824 TryAddTest(results, kBigintCid, true);
3826 // Cannot deoptimize since all tests returning true have been added. 3825 // Cannot deoptimize since all tests returning true have been added.
3827 return false; 3826 return false;
3828 } 3827 }
3829 3828
3830 return true; // May deoptimize since we have not identified all 'true' tests. 3829 return true; // May deoptimize since we have not identified all 'true' tests.
3831 } 3830 }
(...skipping 5321 matching lines...) Expand 10 before | Expand all | Expand 10 after
9153 } 9152 }
9154 9153
9155 // Insert materializations at environment uses. 9154 // Insert materializations at environment uses.
9156 for (intptr_t i = 0; i < exits.length(); i++) { 9155 for (intptr_t i = 0; i < exits.length(); i++) {
9157 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots); 9156 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots);
9158 } 9157 }
9159 } 9158 }
9160 9159
9161 9160
9162 } // namespace dart 9161 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698