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

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

Issue 681713003: Revert "Revert "IR refactoring: reduce duplication related to MayThrow/AllowsCSE."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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') | 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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cpu.h" 8 #include "vm/cpu.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_allocator.h" 10 #include "vm/flow_graph_allocator.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 static int LowestFirst(const intptr_t* a, const intptr_t* b) { 103 static int LowestFirst(const intptr_t* a, const intptr_t* b) {
104 return *a - *b; 104 return *a - *b;
105 } 105 }
106 106
107 107
108 CheckClassInstr::CheckClassInstr(Value* value, 108 CheckClassInstr::CheckClassInstr(Value* value,
109 intptr_t deopt_id, 109 intptr_t deopt_id,
110 const ICData& unary_checks, 110 const ICData& unary_checks,
111 intptr_t token_pos) 111 intptr_t token_pos)
112 : TemplateInstruction<1>(deopt_id), 112 : TemplateInstruction(deopt_id),
113 unary_checks_(unary_checks), 113 unary_checks_(unary_checks),
114 cids_(unary_checks.NumberOfChecks()), 114 cids_(unary_checks.NumberOfChecks()),
115 licm_hoisted_(false), 115 licm_hoisted_(false),
116 token_pos_(token_pos) { 116 token_pos_(token_pos) {
117 ASSERT(unary_checks.IsZoneHandle()); 117 ASSERT(unary_checks.IsZoneHandle());
118 // Expected useful check data. 118 // Expected useful check data.
119 ASSERT(!unary_checks_.IsNull()); 119 ASSERT(!unary_checks_.IsNull());
120 ASSERT(unary_checks_.NumberOfChecks() > 0); 120 ASSERT(unary_checks_.NumberOfChecks() > 0);
121 ASSERT(unary_checks_.NumArgsTested() == 1); 121 ASSERT(unary_checks_.NumArgsTested() == 1);
122 SetInputAt(0, value); 122 SetInputAt(0, value);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 ASSERT(other_assert != NULL); 285 ASSERT(other_assert != NULL);
286 // This predicate has to be commutative for DominatorBasedCSE to work. 286 // This predicate has to be commutative for DominatorBasedCSE to work.
287 // TODO(fschneider): Eliminate more asserts with subtype relation. 287 // TODO(fschneider): Eliminate more asserts with subtype relation.
288 return dst_type().raw() == other_assert->dst_type().raw(); 288 return dst_type().raw() == other_assert->dst_type().raw();
289 } 289 }
290 290
291 291
292 bool StrictCompareInstr::AttributesEqual(Instruction* other) const { 292 bool StrictCompareInstr::AttributesEqual(Instruction* other) const {
293 StrictCompareInstr* other_op = other->AsStrictCompare(); 293 StrictCompareInstr* other_op = other->AsStrictCompare();
294 ASSERT(other_op != NULL); 294 ASSERT(other_op != NULL);
295 return kind() == other_op->kind(); 295 return ComparisonInstr::AttributesEqual(other) &&
296 (needs_number_check() == other_op->needs_number_check());
296 } 297 }
297 298
298 299
299 bool MathMinMaxInstr::AttributesEqual(Instruction* other) const { 300 bool MathMinMaxInstr::AttributesEqual(Instruction* other) const {
300 MathMinMaxInstr* other_op = other->AsMathMinMax(); 301 MathMinMaxInstr* other_op = other->AsMathMinMax();
301 ASSERT(other_op != NULL); 302 ASSERT(other_op != NULL);
302 return (op_kind() == other_op->op_kind()) && 303 return (op_kind() == other_op->op_kind()) &&
303 (result_cid() == other_op->result_cid()); 304 (result_cid() == other_op->result_cid());
304 } 305 }
305 306
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 354 }
354 355
355 356
356 const Field& LoadStaticFieldInstr::StaticField() const { 357 const Field& LoadStaticFieldInstr::StaticField() const {
357 Field& field = Field::Handle(); 358 Field& field = Field::Handle();
358 field ^= field_value()->BoundConstant().raw(); 359 field ^= field_value()->BoundConstant().raw();
359 return field; 360 return field;
360 } 361 }
361 362
362 363
363 EffectSet LoadIndexedInstr::Dependencies() const {
364 return EffectSet::All();
365 }
366
367
368 bool LoadIndexedInstr::AttributesEqual(Instruction* other) const {
369 LoadIndexedInstr* other_load = other->AsLoadIndexed();
370 ASSERT(other_load != NULL);
371 return class_id() == other_load->class_id();
372 }
373
374
375 ConstantInstr::ConstantInstr(const Object& value) : value_(value) { 364 ConstantInstr::ConstantInstr(const Object& value) : value_(value) {
376 // Check that the value is not an incorrect Integer representation. 365 // Check that the value is not an incorrect Integer representation.
377 ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoSmi()); 366 ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoSmi());
378 ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoInt64()); 367 ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoInt64());
379 ASSERT(!value.IsMint() || !Smi::IsValid(Mint::Cast(value).AsInt64Value())); 368 ASSERT(!value.IsMint() || !Smi::IsValid(Mint::Cast(value).AsInt64Value()));
380 } 369 }
381 370
382 371
383 bool ConstantInstr::AttributesEqual(Instruction* other) const { 372 bool ConstantInstr::AttributesEqual(Instruction* other) const {
384 ConstantInstr* other_constant = other->AsConstant(); 373 ConstantInstr* other_constant = other->AsConstant();
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after
3041 return new TestCidsInstr(token_pos(), 3030 return new TestCidsInstr(token_pos(),
3042 kind(), 3031 kind(),
3043 new_left, 3032 new_left,
3044 cid_results(), 3033 cid_results(),
3045 deopt_id()); 3034 deopt_id());
3046 } 3035 }
3047 3036
3048 3037
3049 bool TestCidsInstr::AttributesEqual(Instruction* other) const { 3038 bool TestCidsInstr::AttributesEqual(Instruction* other) const {
3050 TestCidsInstr* other_instr = other->AsTestCids(); 3039 TestCidsInstr* other_instr = other->AsTestCids();
3051 ASSERT(other != NULL); 3040 if (!ComparisonInstr::AttributesEqual(other)) {
3052 if (kind() != other_instr->kind()) {
3053 return false; 3041 return false;
3054 } 3042 }
3055 if (cid_results().length() != other_instr->cid_results().length()) { 3043 if (cid_results().length() != other_instr->cid_results().length()) {
3056 return false; 3044 return false;
3057 } 3045 }
3058 for (intptr_t i = 0; i < cid_results().length(); i++) { 3046 for (intptr_t i = 0; i < cid_results().length(); i++) {
3059 if (cid_results()[i] != other_instr->cid_results()[i]) { 3047 if (cid_results()[i] != other_instr->cid_results()[i]) {
3060 return false; 3048 return false;
3061 } 3049 }
3062 } 3050 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
3216 String::ZoneHandle(Symbols::New(String::Cast(result))); 3204 String::ZoneHandle(Symbols::New(String::Cast(result)));
3217 return flow_graph->GetConstant(concatenated); 3205 return flow_graph->GetConstant(concatenated);
3218 } 3206 }
3219 3207
3220 3208
3221 InvokeMathCFunctionInstr::InvokeMathCFunctionInstr( 3209 InvokeMathCFunctionInstr::InvokeMathCFunctionInstr(
3222 ZoneGrowableArray<Value*>* inputs, 3210 ZoneGrowableArray<Value*>* inputs,
3223 intptr_t deopt_id, 3211 intptr_t deopt_id,
3224 MethodRecognizer::Kind recognized_kind, 3212 MethodRecognizer::Kind recognized_kind,
3225 intptr_t token_pos) 3213 intptr_t token_pos)
3226 : Definition(deopt_id), 3214 : PureDefinition(deopt_id),
3227 inputs_(inputs), 3215 inputs_(inputs),
3228 recognized_kind_(recognized_kind), 3216 recognized_kind_(recognized_kind),
3229 token_pos_(token_pos) { 3217 token_pos_(token_pos) {
3230 ASSERT(inputs_->length() == ArgumentCountFor(recognized_kind_)); 3218 ASSERT(inputs_->length() == ArgumentCountFor(recognized_kind_));
3231 for (intptr_t i = 0; i < inputs_->length(); ++i) { 3219 for (intptr_t i = 0; i < inputs_->length(); ++i) {
3232 ASSERT((*inputs)[i] != NULL); 3220 ASSERT((*inputs)[i] != NULL);
3233 (*inputs)[i]->set_instruction(this); 3221 (*inputs)[i]->set_instruction(this);
3234 (*inputs)[i]->set_use_index(i); 3222 (*inputs)[i]->set_use_index(i);
3235 } 3223 }
3236 } 3224 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
3337 case kDoubleSquare: return "double-square"; 3325 case kDoubleSquare: return "double-square";
3338 } 3326 }
3339 UNREACHABLE(); 3327 UNREACHABLE();
3340 return ""; 3328 return "";
3341 } 3329 }
3342 3330
3343 3331
3344 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, 3332 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs,
3345 intptr_t deopt_id, 3333 intptr_t deopt_id,
3346 MergedMathInstr::Kind kind) 3334 MergedMathInstr::Kind kind)
3347 : Definition(deopt_id), 3335 : PureDefinition(deopt_id),
3348 inputs_(inputs), 3336 inputs_(inputs),
3349 kind_(kind) { 3337 kind_(kind) {
3350 ASSERT(inputs_->length() == InputCountFor(kind_)); 3338 ASSERT(inputs_->length() == InputCountFor(kind_));
3351 for (intptr_t i = 0; i < inputs_->length(); ++i) { 3339 for (intptr_t i = 0; i < inputs_->length(); ++i) {
3352 ASSERT((*inputs)[i] != NULL); 3340 ASSERT((*inputs)[i] != NULL);
3353 (*inputs)[i]->set_instruction(this); 3341 (*inputs)[i]->set_instruction(this);
3354 (*inputs)[i]->set_use_index(i); 3342 (*inputs)[i]->set_use_index(i);
3355 } 3343 }
3356 } 3344 }
3357 3345
(...skipping 12 matching lines...) Expand all
3370 case Token::kTRUNCDIV: return 0; 3358 case Token::kTRUNCDIV: return 0;
3371 case Token::kMOD: return 1; 3359 case Token::kMOD: return 1;
3372 default: UNIMPLEMENTED(); return -1; 3360 default: UNIMPLEMENTED(); return -1;
3373 } 3361 }
3374 } 3362 }
3375 3363
3376 3364
3377 #undef __ 3365 #undef __
3378 3366
3379 } // namespace dart 3367 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698