| 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 #ifndef DART_PRECOMPILED_RUNTIME | 4 #ifndef DART_PRECOMPILED_RUNTIME |
| 5 #include "vm/jit_optimizer.h" | 5 #include "vm/jit_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/branch_optimizer.h" | 8 #include "vm/branch_optimizer.h" |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1798 const String& field_name = | 1798 const String& field_name = |
| 1799 String::Handle(Z, Field::NameFromSetter(instr->function_name())); | 1799 String::Handle(Z, Field::NameFromSetter(instr->function_name())); |
| 1800 const Field& field = Field::ZoneHandle(Z, GetField(class_id, field_name)); | 1800 const Field& field = Field::ZoneHandle(Z, GetField(class_id, field_name)); |
| 1801 ASSERT(!field.IsNull()); | 1801 ASSERT(!field.IsNull()); |
| 1802 | 1802 |
| 1803 if (flow_graph()->InstanceCallNeedsClassCheck(instr, | 1803 if (flow_graph()->InstanceCallNeedsClassCheck(instr, |
| 1804 RawFunction::kImplicitSetter)) { | 1804 RawFunction::kImplicitSetter)) { |
| 1805 AddReceiverCheck(instr); | 1805 AddReceiverCheck(instr); |
| 1806 } | 1806 } |
| 1807 if (field.guarded_cid() != kDynamicCid) { | 1807 if (field.guarded_cid() != kDynamicCid) { |
| 1808 ASSERT(FLAG_use_field_guards); | 1808 ASSERT(I->use_field_guards()); |
| 1809 InsertBefore( | 1809 InsertBefore( |
| 1810 instr, new (Z) GuardFieldClassInstr(new (Z) Value(instr->ArgumentAt(1)), | 1810 instr, new (Z) GuardFieldClassInstr(new (Z) Value(instr->ArgumentAt(1)), |
| 1811 field, instr->deopt_id()), | 1811 field, instr->deopt_id()), |
| 1812 instr->env(), FlowGraph::kEffect); | 1812 instr->env(), FlowGraph::kEffect); |
| 1813 } | 1813 } |
| 1814 | 1814 |
| 1815 if (field.needs_length_check()) { | 1815 if (field.needs_length_check()) { |
| 1816 ASSERT(FLAG_use_field_guards); | 1816 ASSERT(I->use_field_guards()); |
| 1817 InsertBefore(instr, new (Z) GuardFieldLengthInstr( | 1817 InsertBefore(instr, new (Z) GuardFieldLengthInstr( |
| 1818 new (Z) Value(instr->ArgumentAt(1)), field, | 1818 new (Z) Value(instr->ArgumentAt(1)), field, |
| 1819 instr->deopt_id()), | 1819 instr->deopt_id()), |
| 1820 instr->env(), FlowGraph::kEffect); | 1820 instr->env(), FlowGraph::kEffect); |
| 1821 } | 1821 } |
| 1822 | 1822 |
| 1823 // Field guard was detached. | 1823 // Field guard was detached. |
| 1824 StoreInstanceFieldInstr* store = new (Z) | 1824 StoreInstanceFieldInstr* store = new (Z) |
| 1825 StoreInstanceFieldInstr(field, new (Z) Value(instr->ArgumentAt(0)), | 1825 StoreInstanceFieldInstr(field, new (Z) Value(instr->ArgumentAt(0)), |
| 1826 new (Z) Value(instr->ArgumentAt(1)), | 1826 new (Z) Value(instr->ArgumentAt(1)), |
| 1827 kEmitStoreBarrier, instr->token_pos()); | 1827 kEmitStoreBarrier, instr->token_pos()); |
| 1828 | 1828 |
| 1829 if (store->IsUnboxedStore()) { | 1829 if (store->IsUnboxedStore()) { |
| 1830 flow_graph()->parsed_function().AddToGuardedFields(&field); | 1830 flow_graph()->parsed_function().AddToGuardedFields(&field); |
| 1831 } | 1831 } |
| 1832 | 1832 |
| 1833 // Discard the environment from the original instruction because the store | 1833 // Discard the environment from the original instruction because the store |
| 1834 // can't deoptimize. | 1834 // can't deoptimize. |
| 1835 instr->RemoveEnvironment(); | 1835 instr->RemoveEnvironment(); |
| 1836 ReplaceCall(instr, store); | 1836 ReplaceCall(instr, store); |
| 1837 return true; | 1837 return true; |
| 1838 } | 1838 } |
| 1839 | 1839 |
| 1840 | 1840 |
| 1841 } // namespace dart | 1841 } // namespace dart |
| 1842 #endif // DART_PRECOMPILED_RUNTIME | 1842 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |