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/globals.h" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
11 #include "vm/compiler.h" | 11 #include "vm/compiler.h" |
12 #include "vm/cpu.h" | 12 #include "vm/cpu.h" |
13 #include "vm/dart_entry.h" | 13 #include "vm/dart_entry.h" |
14 #include "vm/deopt_instructions.h" | 14 #include "vm/deopt_instructions.h" |
15 #include "vm/il_printer.h" | 15 #include "vm/il_printer.h" |
16 #include "vm/locations.h" | 16 #include "vm/locations.h" |
17 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
18 #include "vm/parser.h" | 18 #include "vm/parser.h" |
19 #include "vm/stack_frame.h" | 19 #include "vm/stack_frame.h" |
20 #include "vm/stub_code.h" | 20 #include "vm/stub_code.h" |
21 #include "vm/symbols.h" | 21 #include "vm/symbols.h" |
| 22 #include "vm/verified_memory.h" |
22 | 23 |
23 namespace dart { | 24 namespace dart { |
24 | 25 |
25 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 26 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
26 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); | 27 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); |
27 DEFINE_FLAG(bool, unbox_doubles, true, "Optimize double arithmetic."); | 28 DEFINE_FLAG(bool, unbox_doubles, true, "Optimize double arithmetic."); |
28 DECLARE_FLAG(bool, enable_type_checks); | 29 DECLARE_FLAG(bool, enable_type_checks); |
29 DECLARE_FLAG(bool, enable_simd_inline); | 30 DECLARE_FLAG(bool, enable_simd_inline); |
30 | 31 |
31 | 32 |
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 void FlowGraphCompiler::EmitEdgeCounter() { | 1189 void FlowGraphCompiler::EmitEdgeCounter() { |
1189 // We do not check for overflow when incrementing the edge counter. The | 1190 // We do not check for overflow when incrementing the edge counter. The |
1190 // function should normally be optimized long before the counter can | 1191 // function should normally be optimized long before the counter can |
1191 // overflow; and though we do not reset the counters when we optimize or | 1192 // overflow; and though we do not reset the counters when we optimize or |
1192 // deoptimize, there is a bound on the number of | 1193 // deoptimize, there is a bound on the number of |
1193 // optimization/deoptimization cycles we will attempt. | 1194 // optimization/deoptimization cycles we will attempt. |
1194 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); | 1195 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); |
1195 counter.SetAt(0, Smi::Handle(Smi::New(0))); | 1196 counter.SetAt(0, Smi::Handle(Smi::New(0))); |
1196 __ Comment("Edge counter"); | 1197 __ Comment("Edge counter"); |
1197 __ LoadObject(R0, counter); | 1198 __ LoadObject(R0, counter); |
| 1199 #if defined(DEBUG) |
| 1200 intptr_t increment_start = assembler_->CodeSize(); |
| 1201 #endif // DEBUG |
1198 __ ldr(IP, FieldAddress(R0, Array::element_offset(0))); | 1202 __ ldr(IP, FieldAddress(R0, Array::element_offset(0))); |
1199 __ add(IP, IP, Operand(Smi::RawValue(1))); | 1203 __ add(IP, IP, Operand(Smi::RawValue(1))); |
1200 __ str(IP, FieldAddress(R0, Array::element_offset(0))); | 1204 __ StoreIntoSmiField(FieldAddress(R0, Array::element_offset(0)), IP); |
| 1205 #if defined(DEBUG) |
| 1206 // If the assertion below fails, update EdgeCounterIncrementSizeInBytes. |
| 1207 intptr_t expected = EdgeCounterIncrementSizeInBytes(); |
| 1208 intptr_t actual = assembler_->CodeSize() - increment_start; |
| 1209 if (actual != expected) { |
| 1210 FATAL2("Edge counter increment length: %" Pd ", expected %" Pd "\n", |
| 1211 actual, |
| 1212 expected); |
| 1213 } |
| 1214 #endif // DEBUG |
| 1215 } |
| 1216 |
| 1217 |
| 1218 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { |
| 1219 // Used by CodePatcher; so must be constant across all code in an isolate. |
| 1220 #if defined(DEBUG) |
| 1221 return (VerifiedMemory::enabled() ? 34 : 15) * Instr::kInstrSize; |
| 1222 #else |
| 1223 return return 3 * Instr::kInstrSize; |
| 1224 #endif // DEBUG |
1201 } | 1225 } |
1202 | 1226 |
1203 | 1227 |
1204 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1228 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
1205 ExternalLabel* target_label, | 1229 ExternalLabel* target_label, |
1206 const ICData& ic_data, | 1230 const ICData& ic_data, |
1207 intptr_t argument_count, | 1231 intptr_t argument_count, |
1208 intptr_t deopt_id, | 1232 intptr_t deopt_id, |
1209 intptr_t token_pos, | 1233 intptr_t token_pos, |
1210 LocationSummary* locs) { | 1234 LocationSummary* locs) { |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1832 DRegister dreg = EvenDRegisterOf(reg); | 1856 DRegister dreg = EvenDRegisterOf(reg); |
1833 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1857 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
1834 } | 1858 } |
1835 | 1859 |
1836 | 1860 |
1837 #undef __ | 1861 #undef __ |
1838 | 1862 |
1839 } // namespace dart | 1863 } // namespace dart |
1840 | 1864 |
1841 #endif // defined TARGET_ARCH_ARM | 1865 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |