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

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

Issue 384703002: Revert r38116 because of crashes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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.h ('k') | runtime/vm/intermediate_language_arm.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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 return AttributesEqual(other); 89 return AttributesEqual(other);
90 } 90 }
91 91
92 92
93 bool Value::Equals(Value* other) const { 93 bool Value::Equals(Value* other) const {
94 return definition() == other->definition(); 94 return definition() == other->definition();
95 } 95 }
96 96
97 97
98 static int LowestFirst(const intptr_t* a, const intptr_t* b) {
99 return *a - *b;
100 }
101
102
103 CheckClassInstr::CheckClassInstr(Value* value, 98 CheckClassInstr::CheckClassInstr(Value* value,
104 intptr_t deopt_id, 99 intptr_t deopt_id,
105 const ICData& unary_checks, 100 const ICData& unary_checks,
106 intptr_t token_pos) 101 intptr_t token_pos)
107 : unary_checks_(unary_checks), 102 : unary_checks_(unary_checks), licm_hoisted_(false), token_pos_(token_pos) {
108 cids_(unary_checks.NumberOfChecks()),
109 licm_hoisted_(false),
110 token_pos_(token_pos) {
111 ASSERT(unary_checks.IsZoneHandle()); 103 ASSERT(unary_checks.IsZoneHandle());
112 // Expected useful check data. 104 // Expected useful check data.
113 ASSERT(!unary_checks_.IsNull()); 105 ASSERT(!unary_checks_.IsNull());
114 ASSERT(unary_checks_.NumberOfChecks() > 0); 106 ASSERT(unary_checks_.NumberOfChecks() > 0);
115 ASSERT(unary_checks_.NumArgsTested() == 1); 107 ASSERT(unary_checks_.NumArgsTested() == 1);
116 SetInputAt(0, value); 108 SetInputAt(0, value);
117 deopt_id_ = deopt_id; 109 deopt_id_ = deopt_id;
118 // Otherwise use CheckSmiInstr. 110 // Otherwise use CheckSmiInstr.
119 ASSERT((unary_checks_.NumberOfChecks() != 1) || 111 ASSERT((unary_checks_.NumberOfChecks() != 1) ||
120 (unary_checks_.GetReceiverClassIdAt(0) != kSmiCid)); 112 (unary_checks_.GetReceiverClassIdAt(0) != kSmiCid));
121 for (intptr_t i = 0; i < unary_checks.NumberOfChecks(); ++i) {
122 cids_.Add(unary_checks.GetReceiverClassIdAt(i));
123 }
124 cids_.Sort(LowestFirst);
125 } 113 }
126 114
127 115
128 bool CheckClassInstr::AttributesEqual(Instruction* other) const { 116 bool CheckClassInstr::AttributesEqual(Instruction* other) const {
129 CheckClassInstr* other_check = other->AsCheckClass(); 117 CheckClassInstr* other_check = other->AsCheckClass();
130 ASSERT(other_check != NULL); 118 ASSERT(other_check != NULL);
131 if (unary_checks().NumberOfChecks() != 119 if (unary_checks().NumberOfChecks() !=
132 other_check->unary_checks().NumberOfChecks()) { 120 other_check->unary_checks().NumberOfChecks()) {
133 return false; 121 return false;
134 } 122 }
(...skipping 22 matching lines...) Expand all
157 return false; 145 return false;
158 } 146 }
159 CompileType* in_type = value()->Type(); 147 CompileType* in_type = value()->Type();
160 const intptr_t cid = unary_checks().GetCidAt(0); 148 const intptr_t cid = unary_checks().GetCidAt(0);
161 // Performance check: use CheckSmiInstr instead. 149 // Performance check: use CheckSmiInstr instead.
162 ASSERT(cid != kSmiCid); 150 ASSERT(cid != kSmiCid);
163 return in_type->is_nullable() && (in_type->ToNullableCid() == cid); 151 return in_type->is_nullable() && (in_type->ToNullableCid() == cid);
164 } 152 }
165 153
166 154
167 bool CheckClassInstr::IsDenseSwitch() const {
168 if (unary_checks().GetReceiverClassIdAt(0) == kSmiCid) return false;
169 if (cids_.length() > 2 &&
170 cids_[cids_.length() - 1] - cids_[0] < kBitsPerWord) {
171 return true;
172 }
173 return false;
174 }
175
176
177 intptr_t CheckClassInstr::ComputeCidMask() const {
178 ASSERT(IsDenseSwitch());
179 intptr_t mask = 0;
180 for (intptr_t i = 0; i < cids_.length(); ++i) {
181 mask |= 1 << (cids_[i] - cids_[0]);
182 }
183 return mask;
184 }
185
186
187 bool CheckClassInstr::IsDenseMask(intptr_t mask) {
188 // Returns true if the mask is a continuos sequence of ones in its binary
189 // representation (i.e. no holes)
190 return mask == -1 || Utils::IsPowerOfTwo(mask + 1);
191 }
192
193
194 bool LoadFieldInstr::IsUnboxedLoad() const { 155 bool LoadFieldInstr::IsUnboxedLoad() const {
195 return FLAG_unbox_numeric_fields 156 return FLAG_unbox_numeric_fields
196 && (field() != NULL) 157 && (field() != NULL)
197 && field()->IsUnboxedField(); 158 && field()->IsUnboxedField();
198 } 159 }
199 160
200 161
201 bool LoadFieldInstr::IsPotentialUnboxedLoad() const { 162 bool LoadFieldInstr::IsPotentialUnboxedLoad() const {
202 return FLAG_unbox_numeric_fields 163 return FLAG_unbox_numeric_fields
203 && (field() != NULL) 164 && (field() != NULL)
(...skipping 3810 matching lines...) Expand 10 before | Expand all | Expand 10 after
4014 case Token::kTRUNCDIV: return 0; 3975 case Token::kTRUNCDIV: return 0;
4015 case Token::kMOD: return 1; 3976 case Token::kMOD: return 1;
4016 default: UNIMPLEMENTED(); return -1; 3977 default: UNIMPLEMENTED(); return -1;
4017 } 3978 }
4018 } 3979 }
4019 3980
4020 3981
4021 #undef __ 3982 #undef __
4022 3983
4023 } // namespace dart 3984 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698