| 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/constant_propagator.h" | 8 #include "vm/constant_propagator.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | 42 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
| 43 | 43 |
| 44 Definition::Definition(intptr_t deopt_id) | 44 Definition::Definition(intptr_t deopt_id) |
| 45 : Instruction(deopt_id), | 45 : Instruction(deopt_id), |
| 46 range_(NULL), | 46 range_(NULL), |
| 47 type_(NULL), | 47 type_(NULL), |
| 48 temp_index_(-1), | 48 temp_index_(-1), |
| 49 ssa_temp_index_(-1), | 49 ssa_temp_index_(-1), |
| 50 input_use_list_(NULL), | 50 input_use_list_(NULL), |
| 51 env_use_list_(NULL), | 51 env_use_list_(NULL), |
| 52 constant_value_(Object::ZoneHandle(ConstantPropagator::Unknown())) { | 52 constant_value_(NULL) { |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 // A value in the constant propagation lattice. |
| 57 // - non-constant sentinel |
| 58 // - a constant (any non-sentinel value) |
| 59 // - unknown sentinel |
| 60 Object& Definition::constant_value() { |
| 61 if (constant_value_ == NULL) { |
| 62 constant_value_ = &Object::ZoneHandle(ConstantPropagator::Unknown()); |
| 63 } |
| 64 return *constant_value_; |
| 65 } |
| 66 |
| 67 |
| 56 Definition* Definition::OriginalDefinition() { | 68 Definition* Definition::OriginalDefinition() { |
| 57 Definition* defn = this; | 69 Definition* defn = this; |
| 58 while (defn->IsRedefinition() || defn->IsAssertAssignable()) { | 70 while (defn->IsRedefinition() || defn->IsAssertAssignable()) { |
| 59 if (defn->IsRedefinition()) { | 71 if (defn->IsRedefinition()) { |
| 60 defn = defn->AsRedefinition()->value()->definition(); | 72 defn = defn->AsRedefinition()->value()->definition(); |
| 61 } else { | 73 } else { |
| 62 defn = defn->AsAssertAssignable()->value()->definition(); | 74 defn = defn->AsAssertAssignable()->value()->definition(); |
| 63 } | 75 } |
| 64 } | 76 } |
| 65 return defn; | 77 return defn; |
| (...skipping 3568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3634 case Token::kTRUNCDIV: return 0; | 3646 case Token::kTRUNCDIV: return 0; |
| 3635 case Token::kMOD: return 1; | 3647 case Token::kMOD: return 1; |
| 3636 default: UNIMPLEMENTED(); return -1; | 3648 default: UNIMPLEMENTED(); return -1; |
| 3637 } | 3649 } |
| 3638 } | 3650 } |
| 3639 | 3651 |
| 3640 | 3652 |
| 3641 #undef __ | 3653 #undef __ |
| 3642 | 3654 |
| 3643 } // namespace dart | 3655 } // namespace dart |
| OLD | NEW |