| OLD | NEW |
| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 420 } |
| 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 { | |
| 431 if (immutable_) { | |
| 432 return EffectSet::None(); | |
| 433 } else { | |
| 434 UNREACHABLE(); // TODO(dartbug.com/30474): cleanup | |
| 435 return EffectSet::All(); | |
| 436 } | |
| 437 } | |
| 438 | |
| 439 bool LoadFieldInstr::AttributesEqual(Instruction* other) const { | 430 bool LoadFieldInstr::AttributesEqual(Instruction* other) const { |
| 440 LoadFieldInstr* other_load = other->AsLoadField(); | 431 LoadFieldInstr* other_load = other->AsLoadField(); |
| 441 ASSERT(other_load != NULL); | 432 ASSERT(other_load != NULL); |
| 442 if (field() != NULL) { | 433 if (field() != NULL) { |
| 443 return (other_load->field() != NULL) && | 434 return (other_load->field() != NULL) && |
| 444 (field()->raw() == other_load->field()->raw()); | 435 (field()->raw() == other_load->field()->raw()); |
| 445 } | 436 } |
| 446 return (other_load->field() == NULL) && | 437 return (other_load->field() == NULL) && |
| 447 (offset_in_bytes() == other_load->offset_in_bytes()); | 438 (offset_in_bytes() == other_load->offset_in_bytes()); |
| 448 } | 439 } |
| 449 | 440 |
| 450 Instruction* InitStaticFieldInstr::Canonicalize(FlowGraph* flow_graph) { | 441 Instruction* InitStaticFieldInstr::Canonicalize(FlowGraph* flow_graph) { |
| 451 const bool is_initialized = | 442 const bool is_initialized = |
| 452 (field_.StaticValue() != Object::sentinel().raw()) && | 443 (field_.StaticValue() != Object::sentinel().raw()) && |
| 453 (field_.StaticValue() != Object::transition_sentinel().raw()); | 444 (field_.StaticValue() != Object::transition_sentinel().raw()); |
| 454 // When precompiling, the fact that a field is currently initialized does not | 445 // When precompiling, the fact that a field is currently initialized does not |
| 455 // make it safe to omit code that checks if the field needs initialization | 446 // make it safe to omit code that checks if the field needs initialization |
| 456 // because the field will be reset so it starts uninitialized in the process | 447 // because the field will be reset so it starts uninitialized in the process |
| 457 // running the precompiled code. We must be prepared to reinitialize fields. | 448 // running the precompiled code. We must be prepared to reinitialize fields. |
| 458 return is_initialized && !FLAG_fields_may_be_reset ? NULL : this; | 449 return is_initialized && !FLAG_fields_may_be_reset ? NULL : this; |
| 459 } | 450 } |
| 460 | 451 |
| 461 EffectSet LoadStaticFieldInstr::Dependencies() const { | |
| 462 if (StaticField().is_final() && !FLAG_fields_may_be_reset) { | |
| 463 return EffectSet::None(); | |
| 464 } else { | |
| 465 UNREACHABLE(); // TODO(dartbug.com/30474): cleanup | |
| 466 return EffectSet::All(); | |
| 467 } | |
| 468 } | |
| 469 | |
| 470 bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const { | 452 bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const { |
| 471 LoadStaticFieldInstr* other_load = other->AsLoadStaticField(); | 453 LoadStaticFieldInstr* other_load = other->AsLoadStaticField(); |
| 472 ASSERT(other_load != NULL); | 454 ASSERT(other_load != NULL); |
| 473 // Assert that the field is initialized. | 455 // Assert that the field is initialized. |
| 474 ASSERT(StaticField().StaticValue() != Object::sentinel().raw()); | 456 ASSERT(StaticField().StaticValue() != Object::sentinel().raw()); |
| 475 ASSERT(StaticField().StaticValue() != Object::transition_sentinel().raw()); | 457 ASSERT(StaticField().StaticValue() != Object::transition_sentinel().raw()); |
| 476 return StaticField().raw() == other_load->StaticField().raw(); | 458 return StaticField().raw() == other_load->StaticField().raw(); |
| 477 } | 459 } |
| 478 | 460 |
| 479 const Field& LoadStaticFieldInstr::StaticField() const { | 461 const Field& LoadStaticFieldInstr::StaticField() const { |
| (...skipping 3558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4038 "native function '%s' (%" Pd " arguments) cannot be found", | 4020 "native function '%s' (%" Pd " arguments) cannot be found", |
| 4039 native_name().ToCString(), function().NumParameters()); | 4021 native_name().ToCString(), function().NumParameters()); |
| 4040 } | 4022 } |
| 4041 set_is_auto_scope(auto_setup_scope); | 4023 set_is_auto_scope(auto_setup_scope); |
| 4042 set_native_c_function(native_function); | 4024 set_native_c_function(native_function); |
| 4043 } | 4025 } |
| 4044 | 4026 |
| 4045 #undef __ | 4027 #undef __ |
| 4046 | 4028 |
| 4047 } // namespace dart | 4029 } // namespace dart |
| OLD | NEW |