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

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

Issue 3003593002: [vm] Cleanup Instruction::Effects(), prepare to cleanup Dependencies() (Closed)
Patch Set: Address review comment Created 3 years, 3 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/intermediate_language.h ('k') | runtime/vm/redundancy_elimination.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/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/constant_propagator.h" 10 #include "vm/constant_propagator.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 421
422 bool BinaryIntegerOpInstr::AttributesEqual(Instruction* other) const { 422 bool BinaryIntegerOpInstr::AttributesEqual(Instruction* other) const {
423 ASSERT(other->tag() == tag()); 423 ASSERT(other->tag() == tag());
424 BinaryIntegerOpInstr* other_op = other->AsBinaryIntegerOp(); 424 BinaryIntegerOpInstr* other_op = other->AsBinaryIntegerOp();
425 return (op_kind() == other_op->op_kind()) && 425 return (op_kind() == other_op->op_kind()) &&
426 (can_overflow() == other_op->can_overflow()) && 426 (can_overflow() == other_op->can_overflow()) &&
427 (is_truncating() == other_op->is_truncating()); 427 (is_truncating() == other_op->is_truncating());
428 } 428 }
429 429
430 EffectSet LoadFieldInstr::Dependencies() const { 430 EffectSet LoadFieldInstr::Dependencies() const {
431 return immutable_ ? EffectSet::None() : EffectSet::All(); 431 if (immutable_) {
432 return EffectSet::None();
433 } else {
434 UNREACHABLE(); // TODO(dartbug.com/30474): cleanup
435 return EffectSet::All();
436 }
432 } 437 }
433 438
434 bool LoadFieldInstr::AttributesEqual(Instruction* other) const { 439 bool LoadFieldInstr::AttributesEqual(Instruction* other) const {
435 LoadFieldInstr* other_load = other->AsLoadField(); 440 LoadFieldInstr* other_load = other->AsLoadField();
436 ASSERT(other_load != NULL); 441 ASSERT(other_load != NULL);
437 if (field() != NULL) { 442 if (field() != NULL) {
438 return (other_load->field() != NULL) && 443 return (other_load->field() != NULL) &&
439 (field()->raw() == other_load->field()->raw()); 444 (field()->raw() == other_load->field()->raw());
440 } 445 }
441 return (other_load->field() == NULL) && 446 return (other_load->field() == NULL) &&
442 (offset_in_bytes() == other_load->offset_in_bytes()); 447 (offset_in_bytes() == other_load->offset_in_bytes());
443 } 448 }
444 449
445 Instruction* InitStaticFieldInstr::Canonicalize(FlowGraph* flow_graph) { 450 Instruction* InitStaticFieldInstr::Canonicalize(FlowGraph* flow_graph) {
446 const bool is_initialized = 451 const bool is_initialized =
447 (field_.StaticValue() != Object::sentinel().raw()) && 452 (field_.StaticValue() != Object::sentinel().raw()) &&
448 (field_.StaticValue() != Object::transition_sentinel().raw()); 453 (field_.StaticValue() != Object::transition_sentinel().raw());
449 // When precompiling, the fact that a field is currently initialized does not 454 // When precompiling, the fact that a field is currently initialized does not
450 // make it safe to omit code that checks if the field needs initialization 455 // make it safe to omit code that checks if the field needs initialization
451 // because the field will be reset so it starts uninitialized in the process 456 // because the field will be reset so it starts uninitialized in the process
452 // running the precompiled code. We must be prepared to reinitialize fields. 457 // running the precompiled code. We must be prepared to reinitialize fields.
453 return is_initialized && !FLAG_fields_may_be_reset ? NULL : this; 458 return is_initialized && !FLAG_fields_may_be_reset ? NULL : this;
454 } 459 }
455 460
456 EffectSet LoadStaticFieldInstr::Dependencies() const { 461 EffectSet LoadStaticFieldInstr::Dependencies() const {
457 return (StaticField().is_final() && !FLAG_fields_may_be_reset) 462 if (StaticField().is_final() && !FLAG_fields_may_be_reset) {
458 ? EffectSet::None() 463 return EffectSet::None();
459 : EffectSet::All(); 464 } else {
465 UNREACHABLE(); // TODO(dartbug.com/30474): cleanup
466 return EffectSet::All();
467 }
460 } 468 }
461 469
462 bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const { 470 bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const {
463 LoadStaticFieldInstr* other_load = other->AsLoadStaticField(); 471 LoadStaticFieldInstr* other_load = other->AsLoadStaticField();
464 ASSERT(other_load != NULL); 472 ASSERT(other_load != NULL);
465 // Assert that the field is initialized. 473 // Assert that the field is initialized.
466 ASSERT(StaticField().StaticValue() != Object::sentinel().raw()); 474 ASSERT(StaticField().StaticValue() != Object::sentinel().raw());
467 ASSERT(StaticField().StaticValue() != Object::transition_sentinel().raw()); 475 ASSERT(StaticField().StaticValue() != Object::transition_sentinel().raw());
468 return StaticField().raw() == other_load->StaticField().raw(); 476 return StaticField().raw() == other_load->StaticField().raw();
469 } 477 }
(...skipping 3560 matching lines...) Expand 10 before | Expand all | Expand 10 after
4030 "native function '%s' (%" Pd " arguments) cannot be found", 4038 "native function '%s' (%" Pd " arguments) cannot be found",
4031 native_name().ToCString(), function().NumParameters()); 4039 native_name().ToCString(), function().NumParameters());
4032 } 4040 }
4033 set_is_auto_scope(auto_setup_scope); 4041 set_is_auto_scope(auto_setup_scope);
4034 set_native_c_function(native_function); 4042 set_native_c_function(native_function);
4035 } 4043 }
4036 4044
4037 #undef __ 4045 #undef __
4038 4046
4039 } // namespace dart 4047 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/redundancy_elimination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698